@aurodesignsystem/auro-formkit 3.4.1-rc-602.2.1 → 3.5.0-rc-627.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/checkbox/demo/api.md +1 -1
- package/components/checkbox/demo/api.min.js +31 -8
- package/components/checkbox/demo/index.min.js +31 -8
- package/components/checkbox/dist/auro-checkbox.d.ts +13 -6
- package/components/checkbox/dist/index.js +31 -8
- package/components/checkbox/dist/registered.js +31 -8
- package/components/combobox/demo/api.md +25 -25
- package/components/combobox/demo/api.min.js +48 -13
- package/components/combobox/demo/index.min.js +48 -13
- package/components/combobox/dist/auro-combobox.d.ts +2 -4
- package/components/combobox/dist/index.js +47 -12
- package/components/combobox/dist/registered.js +47 -12
- package/components/counter/demo/api.min.js +14 -1
- package/components/counter/demo/index.min.js +14 -1
- package/components/counter/dist/index.js +14 -1
- package/components/counter/dist/registered.js +14 -1
- package/components/datepicker/demo/api.min.js +45 -12
- package/components/datepicker/demo/index.min.js +45 -12
- package/components/datepicker/dist/index.js +45 -12
- package/components/datepicker/dist/registered.js +45 -12
- package/components/form/demo/api.md +1 -5
- package/components/form/demo/api.min.js +8 -2
- package/components/form/demo/index.html +1 -0
- package/components/form/demo/index.md +321 -27
- package/components/form/demo/index.min.js +8 -2
- package/components/form/demo/registerDemoDeps.js +1 -0
- package/components/form/dist/auro-form.d.ts +12 -6
- package/components/form/dist/index.js +8 -2
- package/components/form/dist/registered.js +8 -2
- package/components/input/demo/api.md +1 -1
- package/components/input/demo/api.min.js +31 -11
- package/components/input/demo/index.min.js +31 -11
- package/components/input/dist/base-input.d.ts +13 -6
- package/components/input/dist/index.js +31 -11
- package/components/input/dist/registered.js +31 -11
- package/components/menu/demo/api.md +11 -17
- package/components/menu/demo/api.min.js +1 -1
- package/components/menu/demo/index.min.js +1 -1
- package/components/menu/dist/auro-menu.d.ts +1 -1
- package/components/menu/dist/index.js +1 -1
- package/components/menu/dist/registered.js +1 -1
- package/components/radio/demo/api.md +1 -1
- package/components/radio/demo/api.min.js +32 -4
- package/components/radio/demo/index.min.js +32 -4
- package/components/radio/dist/auro-radio.d.ts +14 -3
- package/components/radio/dist/index.js +32 -4
- package/components/radio/dist/registered.js +32 -4
- package/components/select/demo/api.html +15 -0
- package/components/select/demo/api.md +178 -0
- package/components/select/demo/api.min.js +84 -3
- package/components/select/demo/index.html +15 -0
- package/components/select/demo/index.md +177 -0
- package/components/select/demo/index.min.js +84 -3
- package/components/select/dist/auro-select.d.ts +27 -0
- package/components/select/dist/index.js +84 -2
- package/components/select/dist/registered.js +84 -2
- package/package.json +1 -1
|
@@ -178,6 +178,183 @@ The following example illustrates the use of the `label`, `placeholder` and `hel
|
|
|
178
178
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
179
179
|
</auro-accordion>
|
|
180
180
|
|
|
181
|
+
## Autofill/Autocomplete Support
|
|
182
|
+
|
|
183
|
+
Use the `autocomplete` attribute to let browser's know what information to use to fill out the form.
|
|
184
|
+
|
|
185
|
+
<div class="exampleWrapper">
|
|
186
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/autocomplete.html) -->
|
|
187
|
+
<!-- The below content is automatically added from ./../apiExamples/autocomplete.html -->
|
|
188
|
+
<div class="autofill-example-form">
|
|
189
|
+
<div class="input-row">
|
|
190
|
+
<auro-input autocomplete="given-name">
|
|
191
|
+
<span slot="label">First Name</span>
|
|
192
|
+
<span slot="bib.fullscreen.headline">First Name</span>
|
|
193
|
+
</auro-input>
|
|
194
|
+
<auro-input autocomplete="family-name">
|
|
195
|
+
<span slot="label">Last Name</span>
|
|
196
|
+
<span slot="bib.fullscreen.headline">Last Name</span>
|
|
197
|
+
</auro-input>
|
|
198
|
+
</div>
|
|
199
|
+
<div class="input-row">
|
|
200
|
+
<auro-input autocomplete="address-line1">
|
|
201
|
+
<span slot="label">Street Address</span>
|
|
202
|
+
<span slot="bib.fullscreen.headline">Street Address</span>
|
|
203
|
+
</auro-input>
|
|
204
|
+
<auro-input autocomplete="address-level2">
|
|
205
|
+
<span slot="label">City</span>
|
|
206
|
+
<span slot="bib.fullscreen.headline">City</span>
|
|
207
|
+
</auro-input>
|
|
208
|
+
<auro-select autocomplete="address-level1">
|
|
209
|
+
<span slot="bib.fullscreen.headline">Select Your State</span>
|
|
210
|
+
<span slot="label">Select Your State</span>
|
|
211
|
+
<auro-menu>
|
|
212
|
+
<auro-menuoption value="AL">Alabama</auro-menuoption>
|
|
213
|
+
<auro-menuoption value="AK">Alaska</auro-menuoption>
|
|
214
|
+
<auro-menuoption value="AZ">Arizona</auro-menuoption>
|
|
215
|
+
<auro-menuoption value="AR">Arkansas</auro-menuoption>
|
|
216
|
+
<auro-menuoption value="CA">California</auro-menuoption>
|
|
217
|
+
<auro-menuoption value="CO">Colorado</auro-menuoption>
|
|
218
|
+
<auro-menuoption value="CT">Connecticut</auro-menuoption>
|
|
219
|
+
<auro-menuoption value="DE">Delaware</auro-menuoption>
|
|
220
|
+
<auro-menuoption value="DC">District of Columbia</auro-menuoption>
|
|
221
|
+
<auro-menuoption value="FL">Florida</auro-menuoption>
|
|
222
|
+
<auro-menuoption value="GA">Georgia</auro-menuoption>
|
|
223
|
+
<auro-menuoption value="HI">Hawaii</auro-menuoption>
|
|
224
|
+
<auro-menuoption value="ID">Idaho</auro-menuoption>
|
|
225
|
+
<auro-menuoption value="IL">Illinois</auro-menuoption>
|
|
226
|
+
<auro-menuoption value="IN">Indiana</auro-menuoption>
|
|
227
|
+
<auro-menuoption value="IA">Iowa</auro-menuoption>
|
|
228
|
+
<auro-menuoption value="KS">Kansas</auro-menuoption>
|
|
229
|
+
<auro-menuoption value="KY">Kentucky</auro-menuoption>
|
|
230
|
+
<auro-menuoption value="LA">Louisiana</auro-menuoption>
|
|
231
|
+
<auro-menuoption value="ME">Maine</auro-menuoption>
|
|
232
|
+
<auro-menuoption value="MD">Maryland</auro-menuoption>
|
|
233
|
+
<auro-menuoption value="MA">Massachusetts</auro-menuoption>
|
|
234
|
+
<auro-menuoption value="MI">Michigan</auro-menuoption>
|
|
235
|
+
<auro-menuoption value="MN">Minnesota</auro-menuoption>
|
|
236
|
+
<auro-menuoption value="MS">Mississippi</auro-menuoption>
|
|
237
|
+
<auro-menuoption value="MO">Missouri</auro-menuoption>
|
|
238
|
+
<auro-menuoption value="MT">Montana</auro-menuoption>
|
|
239
|
+
<auro-menuoption value="NE">Nebraska</auro-menuoption>
|
|
240
|
+
<auro-menuoption value="NV">Nevada</auro-menuoption>
|
|
241
|
+
<auro-menuoption value="NH">New Hampshire</auro-menuoption>
|
|
242
|
+
<auro-menuoption value="NJ">New Jersey</auro-menuoption>
|
|
243
|
+
<auro-menuoption value="NM">New Mexico</auro-menuoption>
|
|
244
|
+
<auro-menuoption value="NY">New York</auro-menuoption>
|
|
245
|
+
<auro-menuoption value="NC">North Carolina</auro-menuoption>
|
|
246
|
+
<auro-menuoption value="ND">North Dakota</auro-menuoption>
|
|
247
|
+
<auro-menuoption value="OH">Ohio</auro-menuoption>
|
|
248
|
+
<auro-menuoption value="OK">Oklahoma</auro-menuoption>
|
|
249
|
+
<auro-menuoption value="OR">Oregon</auro-menuoption>
|
|
250
|
+
<auro-menuoption value="PA">Pennsylvania</auro-menuoption>
|
|
251
|
+
<auro-menuoption value="RI">Rhode Island</auro-menuoption>
|
|
252
|
+
<auro-menuoption value="SC">South Carolina</auro-menuoption>
|
|
253
|
+
<auro-menuoption value="SD">South Dakota</auro-menuoption>
|
|
254
|
+
<auro-menuoption value="TN">Tennessee</auro-menuoption>
|
|
255
|
+
<auro-menuoption value="TX">Texas</auro-menuoption>
|
|
256
|
+
<auro-menuoption value="UT">Utah</auro-menuoption>
|
|
257
|
+
<auro-menuoption value="VT">Vermont</auro-menuoption>
|
|
258
|
+
<auro-menuoption value="VA">Virginia</auro-menuoption>
|
|
259
|
+
<auro-menuoption value="WA">Washington</auro-menuoption>
|
|
260
|
+
<auro-menuoption value="WV">West Virginia</auro-menuoption>
|
|
261
|
+
<auro-menuoption value="WI">Wisconsin</auro-menuoption>
|
|
262
|
+
<auro-menuoption value="WY">Wyoming</auro-menuoption>
|
|
263
|
+
</auro-menu>
|
|
264
|
+
</auro-select>
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
268
|
+
</div>
|
|
269
|
+
<auro-accordion alignRight>
|
|
270
|
+
<span slot="trigger">See code</span>
|
|
271
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/autocomplete.html) -->
|
|
272
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/autocomplete.html -->
|
|
273
|
+
|
|
274
|
+
```html
|
|
275
|
+
<div class="autofill-example-form">
|
|
276
|
+
<div class="input-row">
|
|
277
|
+
<auro-input autocomplete="given-name">
|
|
278
|
+
<span slot="label">First Name</span>
|
|
279
|
+
<span slot="bib.fullscreen.headline">First Name</span>
|
|
280
|
+
</auro-input>
|
|
281
|
+
<auro-input autocomplete="family-name">
|
|
282
|
+
<span slot="label">Last Name</span>
|
|
283
|
+
<span slot="bib.fullscreen.headline">Last Name</span>
|
|
284
|
+
</auro-input>
|
|
285
|
+
</div>
|
|
286
|
+
<div class="input-row">
|
|
287
|
+
<auro-input autocomplete="address-line1">
|
|
288
|
+
<span slot="label">Street Address</span>
|
|
289
|
+
<span slot="bib.fullscreen.headline">Street Address</span>
|
|
290
|
+
</auro-input>
|
|
291
|
+
<auro-input autocomplete="address-level2">
|
|
292
|
+
<span slot="label">City</span>
|
|
293
|
+
<span slot="bib.fullscreen.headline">City</span>
|
|
294
|
+
</auro-input>
|
|
295
|
+
<auro-select autocomplete="address-level1">
|
|
296
|
+
<span slot="bib.fullscreen.headline">Select Your State</span>
|
|
297
|
+
<span slot="label">Select Your State</span>
|
|
298
|
+
<auro-menu>
|
|
299
|
+
<auro-menuoption value="AL">Alabama</auro-menuoption>
|
|
300
|
+
<auro-menuoption value="AK">Alaska</auro-menuoption>
|
|
301
|
+
<auro-menuoption value="AZ">Arizona</auro-menuoption>
|
|
302
|
+
<auro-menuoption value="AR">Arkansas</auro-menuoption>
|
|
303
|
+
<auro-menuoption value="CA">California</auro-menuoption>
|
|
304
|
+
<auro-menuoption value="CO">Colorado</auro-menuoption>
|
|
305
|
+
<auro-menuoption value="CT">Connecticut</auro-menuoption>
|
|
306
|
+
<auro-menuoption value="DE">Delaware</auro-menuoption>
|
|
307
|
+
<auro-menuoption value="DC">District of Columbia</auro-menuoption>
|
|
308
|
+
<auro-menuoption value="FL">Florida</auro-menuoption>
|
|
309
|
+
<auro-menuoption value="GA">Georgia</auro-menuoption>
|
|
310
|
+
<auro-menuoption value="HI">Hawaii</auro-menuoption>
|
|
311
|
+
<auro-menuoption value="ID">Idaho</auro-menuoption>
|
|
312
|
+
<auro-menuoption value="IL">Illinois</auro-menuoption>
|
|
313
|
+
<auro-menuoption value="IN">Indiana</auro-menuoption>
|
|
314
|
+
<auro-menuoption value="IA">Iowa</auro-menuoption>
|
|
315
|
+
<auro-menuoption value="KS">Kansas</auro-menuoption>
|
|
316
|
+
<auro-menuoption value="KY">Kentucky</auro-menuoption>
|
|
317
|
+
<auro-menuoption value="LA">Louisiana</auro-menuoption>
|
|
318
|
+
<auro-menuoption value="ME">Maine</auro-menuoption>
|
|
319
|
+
<auro-menuoption value="MD">Maryland</auro-menuoption>
|
|
320
|
+
<auro-menuoption value="MA">Massachusetts</auro-menuoption>
|
|
321
|
+
<auro-menuoption value="MI">Michigan</auro-menuoption>
|
|
322
|
+
<auro-menuoption value="MN">Minnesota</auro-menuoption>
|
|
323
|
+
<auro-menuoption value="MS">Mississippi</auro-menuoption>
|
|
324
|
+
<auro-menuoption value="MO">Missouri</auro-menuoption>
|
|
325
|
+
<auro-menuoption value="MT">Montana</auro-menuoption>
|
|
326
|
+
<auro-menuoption value="NE">Nebraska</auro-menuoption>
|
|
327
|
+
<auro-menuoption value="NV">Nevada</auro-menuoption>
|
|
328
|
+
<auro-menuoption value="NH">New Hampshire</auro-menuoption>
|
|
329
|
+
<auro-menuoption value="NJ">New Jersey</auro-menuoption>
|
|
330
|
+
<auro-menuoption value="NM">New Mexico</auro-menuoption>
|
|
331
|
+
<auro-menuoption value="NY">New York</auro-menuoption>
|
|
332
|
+
<auro-menuoption value="NC">North Carolina</auro-menuoption>
|
|
333
|
+
<auro-menuoption value="ND">North Dakota</auro-menuoption>
|
|
334
|
+
<auro-menuoption value="OH">Ohio</auro-menuoption>
|
|
335
|
+
<auro-menuoption value="OK">Oklahoma</auro-menuoption>
|
|
336
|
+
<auro-menuoption value="OR">Oregon</auro-menuoption>
|
|
337
|
+
<auro-menuoption value="PA">Pennsylvania</auro-menuoption>
|
|
338
|
+
<auro-menuoption value="RI">Rhode Island</auro-menuoption>
|
|
339
|
+
<auro-menuoption value="SC">South Carolina</auro-menuoption>
|
|
340
|
+
<auro-menuoption value="SD">South Dakota</auro-menuoption>
|
|
341
|
+
<auro-menuoption value="TN">Tennessee</auro-menuoption>
|
|
342
|
+
<auro-menuoption value="TX">Texas</auro-menuoption>
|
|
343
|
+
<auro-menuoption value="UT">Utah</auro-menuoption>
|
|
344
|
+
<auro-menuoption value="VT">Vermont</auro-menuoption>
|
|
345
|
+
<auro-menuoption value="VA">Virginia</auro-menuoption>
|
|
346
|
+
<auro-menuoption value="WA">Washington</auro-menuoption>
|
|
347
|
+
<auro-menuoption value="WV">West Virginia</auro-menuoption>
|
|
348
|
+
<auro-menuoption value="WI">Wisconsin</auro-menuoption>
|
|
349
|
+
<auro-menuoption value="WY">Wyoming</auro-menuoption>
|
|
350
|
+
</auro-menu>
|
|
351
|
+
</auro-select>
|
|
352
|
+
</div>
|
|
353
|
+
</div>
|
|
354
|
+
```
|
|
355
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
356
|
+
</auro-accordion>
|
|
357
|
+
|
|
181
358
|
## Example with auro-icons in options
|
|
182
359
|
|
|
183
360
|
Displays an `<auro-select>` element with `<auro-icon>` elements in each option.
|
|
@@ -771,7 +771,20 @@ class AuroFormValidation {
|
|
|
771
771
|
* The validityState definitions are located at https://developer.mozilla.org/en-US/docs/Web/API/ValidityState.
|
|
772
772
|
*/
|
|
773
773
|
|
|
774
|
-
let hasValue =
|
|
774
|
+
let hasValue = false;
|
|
775
|
+
|
|
776
|
+
// Check string for having a value
|
|
777
|
+
if (typeof elem.value === "string") {
|
|
778
|
+
hasValue = elem.value && elem.value.length > 0;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
// Check array value types for having a value
|
|
782
|
+
if (Array.isArray(elem.value)) {
|
|
783
|
+
hasValue = Boolean(
|
|
784
|
+
elem.value.length > 0 &&
|
|
785
|
+
elem.value.some((value) => typeof value === "string" && value.length > 0)
|
|
786
|
+
);
|
|
787
|
+
}
|
|
775
788
|
|
|
776
789
|
// If there is a second input in the elem and that value is undefined or an empty string set hasValue to false;
|
|
777
790
|
if (this.auroInputElements?.length === 2) {
|
|
@@ -5472,7 +5485,7 @@ i$5`:host{--ds-auro-icon-color:var(--ds-basic-color-texticon-default, #2a2a2a);-
|
|
|
5472
5485
|
|
|
5473
5486
|
i$5`:host{color:var(--ds-auro-icon-color)}:host([customColor]){color:inherit}:host(:not([onDark])[variant=accent1]){--ds-auro-icon-color:var(--ds-basic-color-texticon-accent1, #265688)}:host(:not([onDark])[variant=disabled]){--ds-auro-icon-color:var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host(:not([onDark])[variant=muted]){--ds-auro-icon-color:var(--ds-basic-color-texticon-muted, #676767)}:host(:not([onDark])[variant=statusDefault]){--ds-auro-icon-color:var(--ds-basic-color-status-default, #afb9c6)}:host(:not([onDark])[variant=statusInfo]){--ds-auro-icon-color:var(--ds-basic-color-status-info, #01426a)}:host(:not([onDark])[variant=statusSuccess]){--ds-auro-icon-color:var(--ds-basic-color-status-success, #447a1f)}:host(:not([onDark])[variant=statusWarning]){--ds-auro-icon-color:var(--ds-basic-color-status-warning, #fac200)}:host(:not([onDark])[variant=statusError]){--ds-auro-icon-color:var(--ds-basic-color-status-error, #e31f26)}:host(:not([onDark])[variant=statusInfoSubtle]){--ds-auro-icon-color:var(--ds-basic-color-status-info-subtle, #ebf3f9)}:host(:not([onDark])[variant=statusSuccessSubtle]){--ds-auro-icon-color:var(--ds-basic-color-status-success-subtle, #d6eac7)}:host(:not([onDark])[variant=statusWarningSubtle]){--ds-auro-icon-color:var(--ds-basic-color-status-warning-subtle, #fff0b2)}:host(:not([onDark])[variant=statusErrorSubtle]){--ds-auro-icon-color:var(--ds-basic-color-status-error-subtle, #fbc6c6)}:host(:not([onDark])[variant=fareBasicEconomy]){--ds-auro-icon-color:var(--ds-basic-color-fare-basiceconomy, #97eaf8)}:host(:not([onDark])[variant=fareBusiness]){--ds-auro-icon-color:var(--ds-basic-color-fare-business, #01426a)}:host(:not([onDark])[variant=fareEconomy]){--ds-auro-icon-color:var(--ds-basic-color-fare-economy, #0074ca)}:host(:not([onDark])[variant=fareFirst]){--ds-auro-icon-color:var(--ds-basic-color-fare-first, #00274a)}:host(:not([onDark])[variant=farePremiumEconomy]){--ds-auro-icon-color:var(--ds-basic-color-fare-premiumeconomy, #005154)}:host(:not([onDark])[variant=tierOneWorldEmerald]){--ds-auro-icon-color:var(--ds-basic-color-tier-program-oneworld-emerald, #139142)}:host(:not([onDark])[variant=tierOneWorldSapphire]){--ds-auro-icon-color:var(--ds-basic-color-tier-program-oneworld-sapphire, #015daa)}:host(:not([onDark])[variant=tierOneWorldRuby]){--ds-auro-icon-color:var(--ds-basic-color-tier-program-oneworld-ruby, #a41d4a)}:host([onDark]){--ds-auro-icon-color:var(--ds-basic-color-texticon-inverse, #ffffff)}:host([onDark][variant=disabled]){--ds-auro-icon-color:var(--ds-basic-color-texticon-inverse-disabled, #7e8894)}:host([onDark][variant=muted]){--ds-auro-icon-color:var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}`;
|
|
5474
5487
|
|
|
5475
|
-
var styleCss$3 = i$5`:focus:not(:focus-visible){outline:3px solid transparent}.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock{display:block}.util_displayFlex{display:flex}.util_displayHidden{display:none}.util_displayHiddenVisually{position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}[slot=trigger]{width:100%;padding:0;border:0;cursor:pointer;font-family:inherit;font-size:inherit;text-align:left}[slot=trigger] .nestingSpacer{display:none}[slot=trigger] #placeholder.hidden{position:absolute;z-index:-1;opacity:0;pointer-events:none}:host [auro-dropdown]{position:relative}:host [auro-dropdown]::part(trigger){max-height:var(--ds-size-300, 1.5rem)}:host [auro-dropdown]::part(popover){max-width:-webkit-fill-available;overflow-y:scroll}:host([disabled]) *{user-select:none}.outerWrapper{position:relative}auro-menuoption{padding:0;pointer-events:none}.menuWrapper{padding:var(--ds-size-50, 0.25rem) 0}:host([multiselect]) [slot=trigger]{display:flex}:host([multiselect]) auro-menuoption:not(:first-child){margin-left:var(--ds-size-100)}#slotHolder{display:none}`;
|
|
5488
|
+
var styleCss$3 = i$5`:focus:not(:focus-visible){outline:3px solid transparent}.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock{display:block}.util_displayFlex{display:flex}.util_displayHidden{display:none}.util_displayHiddenVisually{position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}[slot=trigger]{width:100%;padding:0;border:0;cursor:pointer;font-family:inherit;font-size:inherit;text-align:left}[slot=trigger] .nestingSpacer{display:none}[slot=trigger] #placeholder.hidden{position:absolute;z-index:-1;opacity:0;pointer-events:none}:host .nativeSelectWrapper{position:absolute;overflow:hidden;width:1px;height:1px;padding:0;border:0;margin:-1px;clip:rect(0, 0, 0, 0);opacity:.01}:host [auro-dropdown]{position:relative}:host [auro-dropdown]::part(trigger){max-height:var(--ds-size-300, 1.5rem)}:host [auro-dropdown]::part(popover){max-width:-webkit-fill-available;overflow-y:scroll}:host([disabled]) *{user-select:none}.outerWrapper{position:relative}auro-menuoption{padding:0;pointer-events:none}.menuWrapper{padding:var(--ds-size-50, 0.25rem) 0}:host([multiselect]) [slot=trigger]{display:flex}:host([multiselect]) auro-menuoption:not(:first-child){margin-left:var(--ds-size-100)}#slotHolder{display:none}`;
|
|
5476
5489
|
|
|
5477
5490
|
// Copyright (c) 2021 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
5478
5491
|
// See LICENSE in the project root for license information.
|
|
@@ -5567,6 +5580,14 @@ class AuroSelect extends i$2 {
|
|
|
5567
5580
|
static get properties() {
|
|
5568
5581
|
return {
|
|
5569
5582
|
|
|
5583
|
+
/**
|
|
5584
|
+
* If declared, sets the autocomplete attribute for the select element.
|
|
5585
|
+
*/
|
|
5586
|
+
autocomplete: {
|
|
5587
|
+
type: String,
|
|
5588
|
+
reflect: true
|
|
5589
|
+
},
|
|
5590
|
+
|
|
5570
5591
|
/**
|
|
5571
5592
|
* If declared, bib's position will be automatically calculated where to appear.
|
|
5572
5593
|
* @default false
|
|
@@ -5584,6 +5605,14 @@ class AuroSelect extends i$2 {
|
|
|
5584
5605
|
reflect: true
|
|
5585
5606
|
},
|
|
5586
5607
|
|
|
5608
|
+
/**
|
|
5609
|
+
* The name for the select element.
|
|
5610
|
+
*/
|
|
5611
|
+
name: {
|
|
5612
|
+
type: String,
|
|
5613
|
+
reflect: true
|
|
5614
|
+
},
|
|
5615
|
+
|
|
5587
5616
|
/**
|
|
5588
5617
|
* If set, makes dropdown width match the size of the content, rather than the width of the trigger.
|
|
5589
5618
|
*/
|
|
@@ -6127,6 +6156,7 @@ class AuroSelect extends i$2 {
|
|
|
6127
6156
|
this.menu.value = undefined;
|
|
6128
6157
|
}
|
|
6129
6158
|
|
|
6159
|
+
this._updateNativeSelect();
|
|
6130
6160
|
this.validation.validate(this);
|
|
6131
6161
|
|
|
6132
6162
|
// LEGACY EVENT
|
|
@@ -6178,6 +6208,34 @@ class AuroSelect extends i$2 {
|
|
|
6178
6208
|
this.validation.validate(this, force);
|
|
6179
6209
|
}
|
|
6180
6210
|
|
|
6211
|
+
/**
|
|
6212
|
+
* Syncs the value from the native select element to the component's value.
|
|
6213
|
+
* @param {Event} event // The change event from the native select element.
|
|
6214
|
+
* @returns {void}
|
|
6215
|
+
* @private
|
|
6216
|
+
*/
|
|
6217
|
+
_handleNativeSelectChange(event) {
|
|
6218
|
+
const selectedOption = event.target.options[event.target.selectedIndex];
|
|
6219
|
+
const selectedValue = selectedOption.value;
|
|
6220
|
+
const [currentValue] = this.value || [];
|
|
6221
|
+
this.value = !currentValue || currentValue !== selectedValue ? [selectedValue] : this.value;
|
|
6222
|
+
}
|
|
6223
|
+
|
|
6224
|
+
/**
|
|
6225
|
+
* Updates the native select element's value based on the component's value.
|
|
6226
|
+
* @returns {void}
|
|
6227
|
+
* @private
|
|
6228
|
+
*/
|
|
6229
|
+
_updateNativeSelect() {
|
|
6230
|
+
const nativeSelect = this.shadowRoot.querySelector('select');
|
|
6231
|
+
if (!nativeSelect) {
|
|
6232
|
+
return;
|
|
6233
|
+
}
|
|
6234
|
+
const [value] = this.value || [];
|
|
6235
|
+
nativeSelect.value = value || '';
|
|
6236
|
+
}
|
|
6237
|
+
|
|
6238
|
+
|
|
6181
6239
|
// When using auroElement, use the following attribute and function when hiding content from screen readers.
|
|
6182
6240
|
// aria-hidden="${this.hideAudible(this.hiddenAudible)}"
|
|
6183
6241
|
|
|
@@ -6244,6 +6302,29 @@ class AuroSelect extends i$2 {
|
|
|
6244
6302
|
}
|
|
6245
6303
|
</p>
|
|
6246
6304
|
</${this.dropdownTag}>
|
|
6305
|
+
<div class="nativeSelectWrapper">
|
|
6306
|
+
<select
|
|
6307
|
+
tabindex="-1"
|
|
6308
|
+
id="${`native-select-${this.id || this.uniqueId}`}"
|
|
6309
|
+
name="${this.name || ''}"
|
|
6310
|
+
?disabled="${this.disabled}"
|
|
6311
|
+
?required="${this.required}"
|
|
6312
|
+
aria-hidden="true"
|
|
6313
|
+
autocomplete="${o(this.autocomplete)}"
|
|
6314
|
+
@change="${this._handleNativeSelectChange}">
|
|
6315
|
+
<option value="" ?selected="${!this.value}"></option>
|
|
6316
|
+
${this.options.map((option) => {
|
|
6317
|
+
const optionValue = option.value || option.textContent;
|
|
6318
|
+
return u`
|
|
6319
|
+
<option
|
|
6320
|
+
value="${optionValue}"
|
|
6321
|
+
?selected="${this.value === optionValue}">
|
|
6322
|
+
${option.textContent}
|
|
6323
|
+
</option>
|
|
6324
|
+
`;
|
|
6325
|
+
})}
|
|
6326
|
+
</select>
|
|
6327
|
+
</div>
|
|
6247
6328
|
<!-- Help text and error message template -->
|
|
6248
6329
|
</div>
|
|
6249
6330
|
`;
|
|
@@ -6396,7 +6477,7 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
6396
6477
|
// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
|
|
6397
6478
|
/**
|
|
6398
6479
|
* The auro-menu element provides users a way to select from a list of options.
|
|
6399
|
-
* @attr {Array<HTMLElement>|undefined}
|
|
6480
|
+
* @attr {Array<HTMLElement>|undefined} optionSelected - An array of currently selected menu options. In single-select mode, the array will contain only one HTMLElement. `undefined` when no options are selected.
|
|
6400
6481
|
* @attr {object} optionactive - Specifies the current active menuOption.
|
|
6401
6482
|
* @attr {string} matchword - Specifies a string used to highlight matched string parts in options.
|
|
6402
6483
|
* @attr {boolean} disabled - When true, the entire menu and all options are disabled;
|
|
@@ -13,6 +13,13 @@
|
|
|
13
13
|
*/
|
|
14
14
|
export class AuroSelect extends LitElement {
|
|
15
15
|
static get properties(): {
|
|
16
|
+
/**
|
|
17
|
+
* If declared, sets the autocomplete attribute for the select element.
|
|
18
|
+
*/
|
|
19
|
+
autocomplete: {
|
|
20
|
+
type: StringConstructor;
|
|
21
|
+
reflect: boolean;
|
|
22
|
+
};
|
|
16
23
|
/**
|
|
17
24
|
* If declared, bib's position will be automatically calculated where to appear.
|
|
18
25
|
* @default false
|
|
@@ -28,6 +35,13 @@ export class AuroSelect extends LitElement {
|
|
|
28
35
|
type: BooleanConstructor;
|
|
29
36
|
reflect: boolean;
|
|
30
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* The name for the select element.
|
|
40
|
+
*/
|
|
41
|
+
name: {
|
|
42
|
+
type: StringConstructor;
|
|
43
|
+
reflect: boolean;
|
|
44
|
+
};
|
|
31
45
|
/**
|
|
32
46
|
* If set, makes dropdown width match the size of the content, rather than the width of the trigger.
|
|
33
47
|
*/
|
|
@@ -325,6 +339,19 @@ export class AuroSelect extends LitElement {
|
|
|
325
339
|
* @param {boolean} [force=false] - Whether to force validation.
|
|
326
340
|
*/
|
|
327
341
|
validate(force?: boolean): void;
|
|
342
|
+
/**
|
|
343
|
+
* Syncs the value from the native select element to the component's value.
|
|
344
|
+
* @param {Event} event // The change event from the native select element.
|
|
345
|
+
* @returns {void}
|
|
346
|
+
* @private
|
|
347
|
+
*/
|
|
348
|
+
private _handleNativeSelectChange;
|
|
349
|
+
/**
|
|
350
|
+
* Updates the native select element's value based on the component's value.
|
|
351
|
+
* @returns {void}
|
|
352
|
+
* @private
|
|
353
|
+
*/
|
|
354
|
+
private _updateNativeSelect;
|
|
328
355
|
render(): import("lit-html").TemplateResult;
|
|
329
356
|
}
|
|
330
357
|
import { LitElement } from "lit";
|
|
@@ -2,6 +2,7 @@ import { css, LitElement, html as html$1 } from 'lit';
|
|
|
2
2
|
import { classMap } from 'lit/directives/class-map.js';
|
|
3
3
|
import { unsafeStatic, literal, html } from 'lit/static-html.js';
|
|
4
4
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
|
+
import { ifDefined as ifDefined$1 } from 'lit-html/directives/if-defined.js';
|
|
5
6
|
|
|
6
7
|
class DateFormatter {
|
|
7
8
|
|
|
@@ -730,7 +731,20 @@ class AuroFormValidation {
|
|
|
730
731
|
* The validityState definitions are located at https://developer.mozilla.org/en-US/docs/Web/API/ValidityState.
|
|
731
732
|
*/
|
|
732
733
|
|
|
733
|
-
let hasValue =
|
|
734
|
+
let hasValue = false;
|
|
735
|
+
|
|
736
|
+
// Check string for having a value
|
|
737
|
+
if (typeof elem.value === "string") {
|
|
738
|
+
hasValue = elem.value && elem.value.length > 0;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
// Check array value types for having a value
|
|
742
|
+
if (Array.isArray(elem.value)) {
|
|
743
|
+
hasValue = Boolean(
|
|
744
|
+
elem.value.length > 0 &&
|
|
745
|
+
elem.value.some((value) => typeof value === "string" && value.length > 0)
|
|
746
|
+
);
|
|
747
|
+
}
|
|
734
748
|
|
|
735
749
|
// If there is a second input in the elem and that value is undefined or an empty string set hasValue to false;
|
|
736
750
|
if (this.auroInputElements?.length === 2) {
|
|
@@ -5425,7 +5439,7 @@ css`:host{--ds-auro-icon-color:var(--ds-basic-color-texticon-default, #2a2a2a);-
|
|
|
5425
5439
|
|
|
5426
5440
|
css`:host{color:var(--ds-auro-icon-color)}:host([customColor]){color:inherit}:host(:not([onDark])[variant=accent1]){--ds-auro-icon-color:var(--ds-basic-color-texticon-accent1, #265688)}:host(:not([onDark])[variant=disabled]){--ds-auro-icon-color:var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host(:not([onDark])[variant=muted]){--ds-auro-icon-color:var(--ds-basic-color-texticon-muted, #676767)}:host(:not([onDark])[variant=statusDefault]){--ds-auro-icon-color:var(--ds-basic-color-status-default, #afb9c6)}:host(:not([onDark])[variant=statusInfo]){--ds-auro-icon-color:var(--ds-basic-color-status-info, #01426a)}:host(:not([onDark])[variant=statusSuccess]){--ds-auro-icon-color:var(--ds-basic-color-status-success, #447a1f)}:host(:not([onDark])[variant=statusWarning]){--ds-auro-icon-color:var(--ds-basic-color-status-warning, #fac200)}:host(:not([onDark])[variant=statusError]){--ds-auro-icon-color:var(--ds-basic-color-status-error, #e31f26)}:host(:not([onDark])[variant=statusInfoSubtle]){--ds-auro-icon-color:var(--ds-basic-color-status-info-subtle, #ebf3f9)}:host(:not([onDark])[variant=statusSuccessSubtle]){--ds-auro-icon-color:var(--ds-basic-color-status-success-subtle, #d6eac7)}:host(:not([onDark])[variant=statusWarningSubtle]){--ds-auro-icon-color:var(--ds-basic-color-status-warning-subtle, #fff0b2)}:host(:not([onDark])[variant=statusErrorSubtle]){--ds-auro-icon-color:var(--ds-basic-color-status-error-subtle, #fbc6c6)}:host(:not([onDark])[variant=fareBasicEconomy]){--ds-auro-icon-color:var(--ds-basic-color-fare-basiceconomy, #97eaf8)}:host(:not([onDark])[variant=fareBusiness]){--ds-auro-icon-color:var(--ds-basic-color-fare-business, #01426a)}:host(:not([onDark])[variant=fareEconomy]){--ds-auro-icon-color:var(--ds-basic-color-fare-economy, #0074ca)}:host(:not([onDark])[variant=fareFirst]){--ds-auro-icon-color:var(--ds-basic-color-fare-first, #00274a)}:host(:not([onDark])[variant=farePremiumEconomy]){--ds-auro-icon-color:var(--ds-basic-color-fare-premiumeconomy, #005154)}:host(:not([onDark])[variant=tierOneWorldEmerald]){--ds-auro-icon-color:var(--ds-basic-color-tier-program-oneworld-emerald, #139142)}:host(:not([onDark])[variant=tierOneWorldSapphire]){--ds-auro-icon-color:var(--ds-basic-color-tier-program-oneworld-sapphire, #015daa)}:host(:not([onDark])[variant=tierOneWorldRuby]){--ds-auro-icon-color:var(--ds-basic-color-tier-program-oneworld-ruby, #a41d4a)}:host([onDark]){--ds-auro-icon-color:var(--ds-basic-color-texticon-inverse, #ffffff)}:host([onDark][variant=disabled]){--ds-auro-icon-color:var(--ds-basic-color-texticon-inverse-disabled, #7e8894)}:host([onDark][variant=muted]){--ds-auro-icon-color:var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}`;
|
|
5427
5441
|
|
|
5428
|
-
var styleCss = css`:focus:not(:focus-visible){outline:3px solid transparent}.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock{display:block}.util_displayFlex{display:flex}.util_displayHidden{display:none}.util_displayHiddenVisually{position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}[slot=trigger]{width:100%;padding:0;border:0;cursor:pointer;font-family:inherit;font-size:inherit;text-align:left}[slot=trigger] .nestingSpacer{display:none}[slot=trigger] #placeholder.hidden{position:absolute;z-index:-1;opacity:0;pointer-events:none}:host [auro-dropdown]{position:relative}:host [auro-dropdown]::part(trigger){max-height:var(--ds-size-300, 1.5rem)}:host [auro-dropdown]::part(popover){max-width:-webkit-fill-available;overflow-y:scroll}:host([disabled]) *{user-select:none}.outerWrapper{position:relative}auro-menuoption{padding:0;pointer-events:none}.menuWrapper{padding:var(--ds-size-50, 0.25rem) 0}:host([multiselect]) [slot=trigger]{display:flex}:host([multiselect]) auro-menuoption:not(:first-child){margin-left:var(--ds-size-100)}#slotHolder{display:none}`;
|
|
5442
|
+
var styleCss = css`:focus:not(:focus-visible){outline:3px solid transparent}.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock{display:block}.util_displayFlex{display:flex}.util_displayHidden{display:none}.util_displayHiddenVisually{position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}[slot=trigger]{width:100%;padding:0;border:0;cursor:pointer;font-family:inherit;font-size:inherit;text-align:left}[slot=trigger] .nestingSpacer{display:none}[slot=trigger] #placeholder.hidden{position:absolute;z-index:-1;opacity:0;pointer-events:none}:host .nativeSelectWrapper{position:absolute;overflow:hidden;width:1px;height:1px;padding:0;border:0;margin:-1px;clip:rect(0, 0, 0, 0);opacity:.01}:host [auro-dropdown]{position:relative}:host [auro-dropdown]::part(trigger){max-height:var(--ds-size-300, 1.5rem)}:host [auro-dropdown]::part(popover){max-width:-webkit-fill-available;overflow-y:scroll}:host([disabled]) *{user-select:none}.outerWrapper{position:relative}auro-menuoption{padding:0;pointer-events:none}.menuWrapper{padding:var(--ds-size-50, 0.25rem) 0}:host([multiselect]) [slot=trigger]{display:flex}:host([multiselect]) auro-menuoption:not(:first-child){margin-left:var(--ds-size-100)}#slotHolder{display:none}`;
|
|
5429
5443
|
|
|
5430
5444
|
// Copyright (c) 2021 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
5431
5445
|
// See LICENSE in the project root for license information.
|
|
@@ -5520,6 +5534,14 @@ class AuroSelect extends LitElement {
|
|
|
5520
5534
|
static get properties() {
|
|
5521
5535
|
return {
|
|
5522
5536
|
|
|
5537
|
+
/**
|
|
5538
|
+
* If declared, sets the autocomplete attribute for the select element.
|
|
5539
|
+
*/
|
|
5540
|
+
autocomplete: {
|
|
5541
|
+
type: String,
|
|
5542
|
+
reflect: true
|
|
5543
|
+
},
|
|
5544
|
+
|
|
5523
5545
|
/**
|
|
5524
5546
|
* If declared, bib's position will be automatically calculated where to appear.
|
|
5525
5547
|
* @default false
|
|
@@ -5537,6 +5559,14 @@ class AuroSelect extends LitElement {
|
|
|
5537
5559
|
reflect: true
|
|
5538
5560
|
},
|
|
5539
5561
|
|
|
5562
|
+
/**
|
|
5563
|
+
* The name for the select element.
|
|
5564
|
+
*/
|
|
5565
|
+
name: {
|
|
5566
|
+
type: String,
|
|
5567
|
+
reflect: true
|
|
5568
|
+
},
|
|
5569
|
+
|
|
5540
5570
|
/**
|
|
5541
5571
|
* If set, makes dropdown width match the size of the content, rather than the width of the trigger.
|
|
5542
5572
|
*/
|
|
@@ -6080,6 +6110,7 @@ class AuroSelect extends LitElement {
|
|
|
6080
6110
|
this.menu.value = undefined;
|
|
6081
6111
|
}
|
|
6082
6112
|
|
|
6113
|
+
this._updateNativeSelect();
|
|
6083
6114
|
this.validation.validate(this);
|
|
6084
6115
|
|
|
6085
6116
|
// LEGACY EVENT
|
|
@@ -6131,6 +6162,34 @@ class AuroSelect extends LitElement {
|
|
|
6131
6162
|
this.validation.validate(this, force);
|
|
6132
6163
|
}
|
|
6133
6164
|
|
|
6165
|
+
/**
|
|
6166
|
+
* Syncs the value from the native select element to the component's value.
|
|
6167
|
+
* @param {Event} event // The change event from the native select element.
|
|
6168
|
+
* @returns {void}
|
|
6169
|
+
* @private
|
|
6170
|
+
*/
|
|
6171
|
+
_handleNativeSelectChange(event) {
|
|
6172
|
+
const selectedOption = event.target.options[event.target.selectedIndex];
|
|
6173
|
+
const selectedValue = selectedOption.value;
|
|
6174
|
+
const [currentValue] = this.value || [];
|
|
6175
|
+
this.value = !currentValue || currentValue !== selectedValue ? [selectedValue] : this.value;
|
|
6176
|
+
}
|
|
6177
|
+
|
|
6178
|
+
/**
|
|
6179
|
+
* Updates the native select element's value based on the component's value.
|
|
6180
|
+
* @returns {void}
|
|
6181
|
+
* @private
|
|
6182
|
+
*/
|
|
6183
|
+
_updateNativeSelect() {
|
|
6184
|
+
const nativeSelect = this.shadowRoot.querySelector('select');
|
|
6185
|
+
if (!nativeSelect) {
|
|
6186
|
+
return;
|
|
6187
|
+
}
|
|
6188
|
+
const [value] = this.value || [];
|
|
6189
|
+
nativeSelect.value = value || '';
|
|
6190
|
+
}
|
|
6191
|
+
|
|
6192
|
+
|
|
6134
6193
|
// When using auroElement, use the following attribute and function when hiding content from screen readers.
|
|
6135
6194
|
// aria-hidden="${this.hideAudible(this.hiddenAudible)}"
|
|
6136
6195
|
|
|
@@ -6197,6 +6256,29 @@ class AuroSelect extends LitElement {
|
|
|
6197
6256
|
}
|
|
6198
6257
|
</p>
|
|
6199
6258
|
</${this.dropdownTag}>
|
|
6259
|
+
<div class="nativeSelectWrapper">
|
|
6260
|
+
<select
|
|
6261
|
+
tabindex="-1"
|
|
6262
|
+
id="${`native-select-${this.id || this.uniqueId}`}"
|
|
6263
|
+
name="${this.name || ''}"
|
|
6264
|
+
?disabled="${this.disabled}"
|
|
6265
|
+
?required="${this.required}"
|
|
6266
|
+
aria-hidden="true"
|
|
6267
|
+
autocomplete="${ifDefined$1(this.autocomplete)}"
|
|
6268
|
+
@change="${this._handleNativeSelectChange}">
|
|
6269
|
+
<option value="" ?selected="${!this.value}"></option>
|
|
6270
|
+
${this.options.map((option) => {
|
|
6271
|
+
const optionValue = option.value || option.textContent;
|
|
6272
|
+
return html`
|
|
6273
|
+
<option
|
|
6274
|
+
value="${optionValue}"
|
|
6275
|
+
?selected="${this.value === optionValue}">
|
|
6276
|
+
${option.textContent}
|
|
6277
|
+
</option>
|
|
6278
|
+
`;
|
|
6279
|
+
})}
|
|
6280
|
+
</select>
|
|
6281
|
+
</div>
|
|
6200
6282
|
<!-- Help text and error message template -->
|
|
6201
6283
|
</div>
|
|
6202
6284
|
`;
|