Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[^459] Dropdown Select (phase 2) #462

Merged
merged 1 commit into from
Mar 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/_data/nav.json5
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
label: 'Custom Elements',
path: 'elements',
children: [
{ label: '<hx-accordion>', path: 'hx-accordion' },
{ label: '<hx-accordion-panel>', path: 'hx-accordion-panel' },
{ label: '<hx-accordion>', path: 'hx-accordion' },
{ label: '<hx-alert>', path: 'hx-alert' },
{ label: '<hx-busy>', path: 'hx-busy' },
{ label: '<hx-checkbox>', path: 'hx-checkbox' },
Expand All @@ -85,8 +85,9 @@
{ label: '<hx-progress>', path: 'hx-progress' },
{ label: '<hx-radio>', path: 'hx-radio' },
{ label: '<hx-reveal>', path: 'hx-reveal' },
{ label: '<hx-search>', path: 'hx-search' },
{ label: '<hx-search-assistance>', path: 'hx-search-assistance' },
{ label: '<hx-search>', path: 'hx-search' },
{ label: '<hx-select-control>', path: 'hx-select-control' },
{ label: '<hx-select>', path: 'hx-select' },
{ label: '<hx-status>', path: 'hx-status' },
{ label: '<hx-tab>', path: 'hx-tab' },
Expand Down
48 changes: 17 additions & 31 deletions docs/components/dropdown-select/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
minver: 0.16.0
also:
components/dropdown-select/test.html: Testing - Dropdown Select
elements/hx-select-control: <hx-select-control>
elements/hx-select: <hx-select>
---
{% extends 'component.njk' %}
{% block content %}
Expand Down Expand Up @@ -31,9 +33,8 @@ <h2 id="basic-select">Basic Select</h2>
</header>

<div>
<div class="hxSelect">
<hx-select-control>
<select
id="selDemo"
:disabled="isDisabled"
:required="isRequired"
>
Expand All @@ -43,10 +44,7 @@ <h2 id="basic-select">Basic Select</h2>
<option value="3">Option 3</option>
</select>
<hx-select></hx-select>
<label for="selDemo">
Choose an Option
</label>
</div>
</hx-select-control>
</div>

<footer>
Expand All @@ -57,40 +55,28 @@ <h2 id="basic-select">Basic Select</h2>
<hx-busy></hx-busy>
<p>Loading...</p>
</div>
<p class="hxSubBody hxSubdued">
<hx-icon type="info-circle"></hx-icon>
<code>&lt;select&gt;</code> must be defined before
<code>&lt;hx-select&gt;</code> and <code>&lt;label&gt;</code>
for styles to be effective.
</p>
<p class="hxSubBody hxSubdued">
<hx-icon type="info-circle"></hx-icon>
Extra elements will be hidden.
</p>
</section>

<!--
TODO:
Need centralized documentation of HelixUI form control validation behavior.
-->
<section>
<h2 id="validation">Validation</h2>
<p class="comfortable">
A {{page.title}} is designed to take advantage of standardized
<a href="https://mzl.la/2SuKTmv">HTML form validation</a> capabilities.
Error styles will be applied as long as the <code>&lt;select&gt;</code>
element matches the <code>:invalid</code> CSS pseudo-class.
</p>
<p>
There are two ways to modify validity of the
<code>&lt;select&gt;</code> element.
By default, a {{page.title}} is styled as if it were valid.
Otherwise, any form control that is invalid on initial render
would display as invalid before the user has had a chance to
interact with the form.
</p>
<p>
As the user interacts with a {{page.title}}, it will automatically update
itself in order to communicate when it is appropriate for the browser
to apply invalid control styles.
</p>
<ol class="hxList">
<li>
add or remove the <code>required</code> attribute
</li>
<li>
calling its
<a href="https://mzl.la/2MQYTkd">
<code>setCustomValidity()</code>
</a> method
</li>
</ol>
</section>
{% endblock %}
17 changes: 10 additions & 7 deletions docs/components/dropdown-select/select-demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,24 @@ if (document.getElementById('vue-selectDemo')) {
isRequired: false,
},
computed: {
attrDisabled: function () {
return (this.isDisabled ? 'disabled' : '');
},
attrRequired: function () {
return (this.isRequired ? 'required' : '');
},
snippet: function () {
return Util.snippet(`
<div class="hxSelect">
<hx-select-control>
<select
${this.isDisabled ? 'disabled' : ''}
id="demoSelect"
${this.isRequired ? 'required' : ''}
${this.attrDisabled}
${this.attrRequired}
>
...
</select>

<hx-select></hx-select>

<label for="demoSelect">...</label>
</div>
</hx-select-control>
`);
},
},
Expand Down
Loading