Skip to content

Commit 99d2fe8

Browse files
authored
Merge pull request #462 from rackerlabs/dev-bfc--dropdown-fast-follow
[^459] Dropdown Select (validation & behavior)
2 parents 00a3802 + 8e42b84 commit 99d2fe8

File tree

12 files changed

+597
-822
lines changed

12 files changed

+597
-822
lines changed

docs/_data/nav.json5

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363
label: 'Custom Elements',
6464
path: 'elements',
6565
children: [
66-
{ label: '<hx-accordion>', path: 'hx-accordion' },
6766
{ label: '<hx-accordion-panel>', path: 'hx-accordion-panel' },
67+
{ label: '<hx-accordion>', path: 'hx-accordion' },
6868
{ label: '<hx-alert>', path: 'hx-alert' },
6969
{ label: '<hx-busy>', path: 'hx-busy' },
7070
{ label: '<hx-checkbox>', path: 'hx-checkbox' },
@@ -85,8 +85,9 @@
8585
{ label: '<hx-progress>', path: 'hx-progress' },
8686
{ label: '<hx-radio>', path: 'hx-radio' },
8787
{ label: '<hx-reveal>', path: 'hx-reveal' },
88-
{ label: '<hx-search>', path: 'hx-search' },
8988
{ label: '<hx-search-assistance>', path: 'hx-search-assistance' },
89+
{ label: '<hx-search>', path: 'hx-search' },
90+
{ label: '<hx-select-control>', path: 'hx-select-control' },
9091
{ label: '<hx-select>', path: 'hx-select' },
9192
{ label: '<hx-status>', path: 'hx-status' },
9293
{ label: '<hx-tab>', path: 'hx-tab' },

docs/components/dropdown-select/index.html

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
minver: 0.16.0
44
also:
55
components/dropdown-select/test.html: Testing - Dropdown Select
6+
elements/hx-select-control: <hx-select-control>
7+
elements/hx-select: <hx-select>
68
---
79
{% extends 'component.njk' %}
810
{% block content %}
@@ -31,9 +33,8 @@ <h2 id="basic-select">Basic Select</h2>
3133
</header>
3234

3335
<div>
34-
<div class="hxSelect">
36+
<hx-select-control>
3537
<select
36-
id="selDemo"
3738
:disabled="isDisabled"
3839
:required="isRequired"
3940
>
@@ -43,10 +44,7 @@ <h2 id="basic-select">Basic Select</h2>
4344
<option value="3">Option 3</option>
4445
</select>
4546
<hx-select></hx-select>
46-
<label for="selDemo">
47-
Choose an Option
48-
</label>
49-
</div>
47+
</hx-select-control>
5048
</div>
5149

5250
<footer>
@@ -57,40 +55,28 @@ <h2 id="basic-select">Basic Select</h2>
5755
<hx-busy></hx-busy>
5856
<p>Loading...</p>
5957
</div>
60-
<p class="hxSubBody hxSubdued">
61-
<hx-icon type="info-circle"></hx-icon>
62-
<code>&lt;select&gt;</code> must be defined before
63-
<code>&lt;hx-select&gt;</code> and <code>&lt;label&gt;</code>
64-
for styles to be effective.
65-
</p>
66-
<p class="hxSubBody hxSubdued">
67-
<hx-icon type="info-circle"></hx-icon>
68-
Extra elements will be hidden.
69-
</p>
7058
</section>
7159

60+
<!--
61+
TODO:
62+
Need centralized documentation of HelixUI form control validation behavior.
63+
-->
7264
<section>
7365
<h2 id="validation">Validation</h2>
7466
<p class="comfortable">
7567
A {{page.title}} is designed to take advantage of standardized
7668
<a href="https://mzl.la/2SuKTmv">HTML form validation</a> capabilities.
77-
Error styles will be applied as long as the <code>&lt;select&gt;</code>
78-
element matches the <code>:invalid</code> CSS pseudo-class.
7969
</p>
8070
<p>
81-
There are two ways to modify validity of the
82-
<code>&lt;select&gt;</code> element.
71+
By default, a {{page.title}} is styled as if it were valid.
72+
Otherwise, any form control that is invalid on initial render
73+
would display as invalid before the user has had a chance to
74+
interact with the form.
75+
</p>
76+
<p>
77+
As the user interacts with a {{page.title}}, it will automatically update
78+
itself in order to communicate when it is appropriate for the browser
79+
to apply invalid control styles.
8380
</p>
84-
<ol class="hxList">
85-
<li>
86-
add or remove the <code>required</code> attribute
87-
</li>
88-
<li>
89-
calling its
90-
<a href="https://mzl.la/2MQYTkd">
91-
<code>setCustomValidity()</code>
92-
</a> method
93-
</li>
94-
</ol>
9581
</section>
9682
{% endblock %}

docs/components/dropdown-select/select-demo.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,24 @@ if (document.getElementById('vue-selectDemo')) {
88
isRequired: false,
99
},
1010
computed: {
11+
attrDisabled: function () {
12+
return (this.isDisabled ? 'disabled' : '');
13+
},
14+
attrRequired: function () {
15+
return (this.isRequired ? 'required' : '');
16+
},
1117
snippet: function () {
1218
return Util.snippet(`
13-
<div class="hxSelect">
19+
<hx-select-control>
1420
<select
15-
${this.isDisabled ? 'disabled' : ''}
16-
id="demoSelect"
17-
${this.isRequired ? 'required' : ''}
21+
${this.attrDisabled}
22+
${this.attrRequired}
1823
>
1924
...
2025
</select>
2126
2227
<hx-select></hx-select>
23-
24-
<label for="demoSelect">...</label>
25-
</div>
28+
</hx-select-control>
2629
`);
2730
},
2831
},

0 commit comments

Comments
 (0)