@aurodesignsystem-dev/auro-formkit 0.0.0-pr624.4 → 0.0.0-pr624.40
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/bibtemplate/dist/auro-bibtemplate.d.ts +13 -2
- package/components/bibtemplate/dist/buttonVersion.d.ts +2 -0
- package/components/bibtemplate/dist/iconVersion.d.ts +1 -1
- package/components/bibtemplate/dist/index.js +1292 -79
- package/components/bibtemplate/dist/registered.js +1292 -79
- package/components/checkbox/README.md +1 -1
- package/components/checkbox/demo/api.md +47 -14
- package/components/checkbox/demo/api.min.js +44 -31
- package/components/checkbox/demo/index.md +2 -2
- package/components/checkbox/demo/index.min.js +44 -31
- package/components/checkbox/demo/readme.md +1 -1
- package/components/checkbox/dist/auro-checkbox-group.d.ts +1 -1
- package/components/checkbox/dist/auro-checkbox.d.ts +3 -3
- package/components/checkbox/dist/index.js +44 -31
- package/components/checkbox/dist/registered.js +44 -31
- package/components/combobox/demo/api.md +100 -2
- package/components/combobox/demo/api.min.js +3202 -759
- package/components/combobox/demo/index.md +6 -30
- package/components/combobox/demo/index.min.js +3202 -759
- package/components/combobox/dist/auro-combobox.d.ts +37 -16
- package/components/combobox/dist/index.js +3091 -789
- package/components/combobox/dist/registered.js +3091 -789
- package/components/counter/demo/api.html +1 -0
- package/components/counter/demo/api.md +21 -19
- package/components/counter/demo/api.min.js +3324 -614
- package/components/counter/demo/index.html +1 -0
- package/components/counter/demo/index.md +103 -34
- package/components/counter/demo/index.min.js +3324 -614
- package/components/counter/dist/auro-counter-button.d.ts +2 -0
- package/components/counter/dist/auro-counter-group.d.ts +89 -6
- package/components/counter/dist/auro-counter.d.ts +6 -0
- package/components/counter/dist/helptextVersion.d.ts +2 -0
- package/components/counter/dist/iconVersion.d.ts +1 -1
- package/components/counter/dist/index.js +3324 -614
- package/components/counter/dist/registered.js +3324 -614
- package/components/datepicker/demo/api.md +36 -19
- package/components/datepicker/demo/api.min.js +11976 -8000
- package/components/datepicker/demo/index.md +80 -0
- package/components/datepicker/demo/index.min.js +11976 -8000
- package/components/datepicker/dist/auro-datepicker.d.ts +71 -3
- package/components/datepicker/dist/buttonVersion.d.ts +1 -1
- package/components/datepicker/dist/iconVersion.d.ts +2 -0
- package/components/datepicker/dist/index.js +12238 -8262
- package/components/datepicker/dist/popoverVersion.d.ts +1 -1
- package/components/datepicker/dist/registered.js +12238 -8262
- package/components/dropdown/demo/api.md +8 -9
- package/components/dropdown/demo/api.min.js +551 -147
- package/components/dropdown/demo/index.md +57 -9
- package/components/dropdown/demo/index.min.js +551 -147
- package/components/dropdown/dist/auro-dropdown.d.ts +28 -9
- package/components/dropdown/dist/auro-dropdownBib.d.ts +22 -0
- package/components/dropdown/dist/index.js +551 -147
- package/components/dropdown/dist/registered.js +551 -147
- package/components/form/demo/api.min.js +1 -1
- package/components/form/demo/index.min.js +1 -1
- package/components/form/dist/index.js +1 -1
- package/components/form/dist/registered.js +1 -1
- package/components/helptext/dist/index.js +2 -2
- package/components/helptext/dist/registered.js +2 -2
- package/components/input/README.md +5 -2
- package/components/input/demo/api.md +271 -176
- package/components/input/demo/api.min.js +956 -270
- package/components/input/demo/index.md +48 -32
- package/components/input/demo/index.min.js +955 -269
- package/components/input/demo/readme.md +5 -2
- package/components/input/dist/auro-input.d.ts +23 -15
- package/components/input/dist/base-input.d.ts +32 -8
- package/components/input/dist/buttonVersion.d.ts +1 -1
- package/components/input/dist/iconVersion.d.ts +1 -1
- package/components/input/dist/index.js +955 -269
- package/components/input/dist/registered.js +955 -269
- package/components/layoutElement/dist/index.js +13 -10
- package/components/menu/demo/api.html +38 -0
- package/components/menu/demo/api.md +68 -7
- package/components/menu/demo/api.min.js +278 -42
- package/components/menu/demo/index.min.js +278 -42
- package/components/menu/dist/auro-menu.d.ts +28 -5
- package/components/menu/dist/auro-menuoption.d.ts +15 -3
- package/components/menu/dist/iconVersion.d.ts +1 -1
- package/components/menu/dist/index.js +278 -42
- package/components/menu/dist/registered.js +278 -42
- package/components/menu/dist/styles/default/color-menuoption-css.d.ts +2 -0
- package/components/menu/dist/styles/default/style-menu-css.d.ts +2 -0
- package/components/menu/dist/styles/default/style-menuoption-css.d.ts +2 -0
- package/components/menu/dist/styles/default/tokens-css.d.ts +2 -0
- package/components/radio/demo/api.md +7 -8
- package/components/radio/demo/api.min.js +68 -80
- package/components/radio/demo/index.min.js +68 -80
- package/components/radio/dist/auro-radio-group.d.ts +1 -1
- package/components/radio/dist/auro-radio.d.ts +9 -12
- package/components/radio/dist/index.js +68 -80
- package/components/radio/dist/registered.js +68 -80
- package/components/select/demo/api.md +123 -13
- package/components/select/demo/api.min.js +3045 -456
- package/components/select/demo/index.html +1 -0
- package/components/select/demo/index.md +323 -763
- package/components/select/demo/index.min.js +3045 -456
- package/components/select/dist/auro-select.d.ts +112 -11
- package/components/select/dist/helptextVersion.d.ts +2 -0
- package/components/select/dist/index.js +2925 -477
- package/components/select/dist/registered.js +2925 -477
- package/components/select/dist/styles/shapeSize-css.d.ts +2 -0
- package/components/select/dist/styles/tokens-css.d.ts +2 -0
- package/package.json +6 -4
- /package/components/{dropdown/dist/styles/default/bibColors-css.d.ts → counter/dist/styles/shapeSize-css.d.ts} +0 -0
- /package/components/{dropdown → datepicker}/dist/styles/default/color-css.d.ts +0 -0
- /package/components/{dropdown/dist/styles/default/bibStyles-css.d.ts → datepicker/dist/styles/shapeSize-css.d.ts} +0 -0
- /package/components/{dropdown/dist/styles/default/style-css.d.ts → datepicker/dist/styles/snowflake/color-css.d.ts} +0 -0
- /package/components/{dropdown/dist/styles → datepicker/dist/styles/snowflake}/style-css.d.ts +0 -0
- /package/components/{menu/dist/styles/color-menu-css.d.ts → dropdown/dist/styles/classic/bibColors-css.d.ts} +0 -0
- /package/components/{menu/dist/styles/color-menuoption-css.d.ts → dropdown/dist/styles/classic/bibStyles-css.d.ts} +0 -0
- /package/components/{menu/dist/styles/style-menu-css.d.ts → dropdown/dist/styles/classic/color-css.d.ts} +0 -0
- /package/components/{menu/dist/styles/style-menuoption-css.d.ts → dropdown/dist/styles/classic/style-css.d.ts} +0 -0
- /package/components/menu/dist/styles/{tokens-css.d.ts → default/color-menu-css.d.ts} +0 -0
|
@@ -146,6 +146,7 @@ let AuroLibraryRuntimeUtils$1 = class AuroLibraryRuntimeUtils {
|
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
148
|
|
|
149
|
+
/* eslint-disable max-lines */
|
|
149
150
|
// Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
150
151
|
// See LICENSE in the project root for license information.
|
|
151
152
|
|
|
@@ -180,8 +181,8 @@ class AuroRadio extends i$2 {
|
|
|
180
181
|
this.required = false;
|
|
181
182
|
this.error = false;
|
|
182
183
|
this.onDark = false;
|
|
183
|
-
this.tabIndex = -1;
|
|
184
184
|
this.touched = false;
|
|
185
|
+
this.role = 'radio';
|
|
185
186
|
|
|
186
187
|
/**
|
|
187
188
|
* @private
|
|
@@ -223,10 +224,6 @@ class AuroRadio extends i$2 {
|
|
|
223
224
|
label: { type: String },
|
|
224
225
|
name: { type: String },
|
|
225
226
|
value: { type: String },
|
|
226
|
-
tabIndex: {
|
|
227
|
-
type: Number,
|
|
228
|
-
reflect: true
|
|
229
|
-
},
|
|
230
227
|
|
|
231
228
|
/**
|
|
232
229
|
* Whether or not the radio button has been touched by the user.
|
|
@@ -239,13 +236,22 @@ class AuroRadio extends i$2 {
|
|
|
239
236
|
},
|
|
240
237
|
|
|
241
238
|
/**
|
|
239
|
+
* ID for input node.
|
|
242
240
|
* @private
|
|
243
|
-
* id for input node
|
|
244
241
|
*/
|
|
245
242
|
inputId: {
|
|
246
243
|
type: String,
|
|
247
244
|
reflect: false,
|
|
248
245
|
attribute: false
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* @private
|
|
250
|
+
* not to add to api.md since changing of this can easily break a11y.
|
|
251
|
+
*/
|
|
252
|
+
role: {
|
|
253
|
+
type: String,
|
|
254
|
+
reflect: true
|
|
249
255
|
}
|
|
250
256
|
};
|
|
251
257
|
}
|
|
@@ -271,7 +277,6 @@ class AuroRadio extends i$2 {
|
|
|
271
277
|
handleChange(event) {
|
|
272
278
|
this.checked = event.target.checked;
|
|
273
279
|
const customEvent = new CustomEvent(event.type, event);
|
|
274
|
-
|
|
275
280
|
this.dispatchEvent(customEvent);
|
|
276
281
|
}
|
|
277
282
|
|
|
@@ -330,7 +335,27 @@ class AuroRadio extends i$2 {
|
|
|
330
335
|
}
|
|
331
336
|
|
|
332
337
|
updated(changedProperties) {
|
|
338
|
+
if (changedProperties.has('error') || changedProperties.has('validity')) {
|
|
339
|
+
this.setAttribute('aria-invalid', this.error || this.validity !== 'valid' ? 'true' : 'false');
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
if (changedProperties.has('required')) {
|
|
343
|
+
this.setAttribute('aria-required', this.isRequired(this.required));
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
if (changedProperties.has('disabled')) {
|
|
347
|
+
if (this.disabled) {
|
|
348
|
+
this.setAttribute('aria-disabled', '');
|
|
349
|
+
} else {
|
|
350
|
+
this.removeAttribute('aria-disabled');
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
333
354
|
if (changedProperties.has('checked')) {
|
|
355
|
+
this.setAttribute('aria-checked', this.checked ? 'true' : 'false');
|
|
356
|
+
// eslint-disable-next-line no-magic-numbers
|
|
357
|
+
this.setAttribute('tabindex', this.checked ? 0 : -1);
|
|
358
|
+
|
|
334
359
|
this.dispatchEvent(new CustomEvent('resetRadio', {
|
|
335
360
|
bubbles: true,
|
|
336
361
|
composed: true
|
|
@@ -345,20 +370,6 @@ class AuroRadio extends i$2 {
|
|
|
345
370
|
}
|
|
346
371
|
}
|
|
347
372
|
|
|
348
|
-
/**
|
|
349
|
-
* Method for handling content when it is invalid accessibility wise.
|
|
350
|
-
* @private
|
|
351
|
-
* @param {Boolean} error - The element's error attribute.
|
|
352
|
-
* @returns {void}
|
|
353
|
-
*/
|
|
354
|
-
invalid(error) {
|
|
355
|
-
if (error) {
|
|
356
|
-
return 'true';
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
return 'false';
|
|
360
|
-
}
|
|
361
|
-
|
|
362
373
|
/**
|
|
363
374
|
* Method for handling passing the required status to aria.
|
|
364
375
|
* @private
|
|
@@ -377,6 +388,7 @@ class AuroRadio extends i$2 {
|
|
|
377
388
|
// Add the tag name as an attribute if it is different than the component name
|
|
378
389
|
this.runtimeUtils.handleComponentTagRename(this, 'auro-radio');
|
|
379
390
|
|
|
391
|
+
this.addEventListener('focus', this.handleFocus);
|
|
380
392
|
this.addEventListener('blur', this.handleBlur);
|
|
381
393
|
|
|
382
394
|
this.input = this.shadowRoot.querySelector('input');
|
|
@@ -401,27 +413,21 @@ class AuroRadio extends i$2 {
|
|
|
401
413
|
return x`
|
|
402
414
|
<div class="ods-inputGroup rdoGroup" part="radio">
|
|
403
415
|
<input
|
|
404
|
-
class="
|
|
416
|
+
class="util_displayHidden ods-inputOption rdo--input"
|
|
405
417
|
part="radio-input"
|
|
406
|
-
@focus="${this.handleFocus}"
|
|
407
418
|
@input="${this.handleInput}"
|
|
408
419
|
@change="${this.handleChange}"
|
|
409
420
|
?disabled="${this.disabled}"
|
|
410
|
-
aria-invalid="${this.invalid(this.error)}"
|
|
411
|
-
aria-required="${this.isRequired(this.required)}"
|
|
412
421
|
.checked="${this.checked}"
|
|
413
422
|
id="${this.inputId}"
|
|
414
423
|
name="${o$1(this.name)}"
|
|
415
424
|
type="radio"
|
|
416
425
|
.value="${this.value}"
|
|
426
|
+
aria-hidden="true"
|
|
417
427
|
tabindex="-1"
|
|
418
428
|
/>
|
|
419
429
|
|
|
420
|
-
<label
|
|
421
|
-
for="${this.inputId}"
|
|
422
|
-
class="${e(labelClasses)}"
|
|
423
|
-
part="radio-label"
|
|
424
|
-
>
|
|
430
|
+
<label for="${this.inputId}" class="${e(labelClasses)}" part="radio-label">
|
|
425
431
|
<slot>${this.label}</slot>
|
|
426
432
|
</label>
|
|
427
433
|
</div>
|
|
@@ -497,9 +503,10 @@ class DateFormatter {
|
|
|
497
503
|
/**
|
|
498
504
|
* Convert a date object to string format.
|
|
499
505
|
* @param {Object} date - Date to convert to string.
|
|
500
|
-
* @
|
|
506
|
+
* @param {String} locale - Optional locale to use for the date string. Defaults to user's locale.
|
|
507
|
+
* @returns {String} Returns the date as a string.
|
|
501
508
|
*/
|
|
502
|
-
this.getDateAsString = (date) => date.toLocaleDateString(
|
|
509
|
+
this.getDateAsString = (date, locale = undefined) => date.toLocaleDateString(locale, {
|
|
503
510
|
year: "numeric",
|
|
504
511
|
month: "2-digit",
|
|
505
512
|
day: "2-digit",
|
|
@@ -691,7 +698,7 @@ class AuroDateUtilities extends AuroDateUtilitiesBase {
|
|
|
691
698
|
const dateObj = new Date(this.getFourDigitYear(dateParts.year), dateParts.month - 1, dateParts.day || 1);
|
|
692
699
|
|
|
693
700
|
// Get the date string of the date object we created from the string date
|
|
694
|
-
const actualDateStr = dateFormatter.getDateAsString(dateObj);
|
|
701
|
+
const actualDateStr = dateFormatter.getDateAsString(dateObj, "en-US");
|
|
695
702
|
|
|
696
703
|
// Guard Clause: Generated date matches date string input
|
|
697
704
|
if (expectedDateStr !== actualDateStr) {
|
|
@@ -1135,7 +1142,9 @@ class AuroFormValidation {
|
|
|
1135
1142
|
elem.validity = this.auroInputElements[0].validity;
|
|
1136
1143
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
1137
1144
|
|
|
1138
|
-
|
|
1145
|
+
// combobox has 2 inputs but no need to check validity on the 2nd one which is in fullscreen bib.
|
|
1146
|
+
// combobox's 2nd input will have noValidate set true.
|
|
1147
|
+
if (elem.validity === 'valid' && this.auroInputElements.length > 1 && !this.auroInputElements[1].noValidate) {
|
|
1139
1148
|
elem.validity = this.auroInputElements[1].validity;
|
|
1140
1149
|
elem.errorMessage = this.auroInputElements[1].errorMessage;
|
|
1141
1150
|
}
|
|
@@ -1255,9 +1264,9 @@ class AuroDependencyVersioning {
|
|
|
1255
1264
|
}
|
|
1256
1265
|
}
|
|
1257
1266
|
|
|
1258
|
-
var colorCss = i$5`:host([error]){--ds-auro-helptext-color: var(--ds-basic-color-status-error, #e31f26)}:host([onDark]){--ds-auro-helptext-color: var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}:host([onDark][error]){--ds-auro-helptext-color: var(--ds-
|
|
1267
|
+
var colorCss = i$5`:host([error]){--ds-auro-helptext-color: var(--ds-basic-color-status-error, #e31f26)}:host([onDark]){--ds-auro-helptext-color: var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}:host([onDark][error]){--ds-auro-helptext-color: var(--ds-basic-color-status-error-subtle, #fbc6c6)}.helptext-wrapper{color:var(--ds-auro-helptext-color)}`;
|
|
1259
1268
|
|
|
1260
|
-
var styleCss = i$5`.helptext-wrapper{display:none;font-size:
|
|
1269
|
+
var styleCss = i$5`.helptext-wrapper{display:none;font-size:12px;font-weight:450;letter-spacing:0;line-height:16px}:host([large]) .helptext-wrapper{font-size:16px;font-weight:450;letter-spacing:0;line-height:24px}.helptext-wrapper[visible]{display:block}::slotted(*:not(:empty)){margin-top:var(--ds-size-50, 0.25rem);margin-bottom:0}::slotted(p){margin-block:0}`;
|
|
1261
1270
|
|
|
1262
1271
|
var tokensCss = i$5`:host{--ds-auro-helptext-color: var(--ds-basic-color-texticon-muted, #676767)}`;
|
|
1263
1272
|
|
|
@@ -1483,7 +1492,7 @@ var helpTextVersion = '1.0.0';
|
|
|
1483
1492
|
* @attr {Object} optionSelected - Specifies the current selected radio button.
|
|
1484
1493
|
* @csspart radio-group - Apply css to the fieldset element in the shadow DOM
|
|
1485
1494
|
* @slot {HTMLSlotElement} legend - Allows for the legend to be overridden.
|
|
1486
|
-
* @slot {HTMLSlotElement} optionalLabel - Allows
|
|
1495
|
+
* @slot {HTMLSlotElement} optionalLabel - Allows overriding the optional display text "(optional)", which appears next to the label.
|
|
1487
1496
|
* @slot {HTMLSlotElement} helpText - Allows for the helper text to be overridden.
|
|
1488
1497
|
* @event auroFormElement-validated - Notifies that the element has been validated.
|
|
1489
1498
|
* @event input - Notifies every time the value prop of the element is changed.
|
|
@@ -1639,7 +1648,7 @@ class AuroRadioGroup extends i$2 {
|
|
|
1639
1648
|
|
|
1640
1649
|
this.optionSelected = event.target;
|
|
1641
1650
|
|
|
1642
|
-
this.validation.validate(this);
|
|
1651
|
+
this.validation.validate(this, this.optionSelected !== undefined);
|
|
1643
1652
|
}
|
|
1644
1653
|
|
|
1645
1654
|
/**
|
|
@@ -1738,15 +1747,6 @@ class AuroRadioGroup extends i$2 {
|
|
|
1738
1747
|
if (this.items.length === 0) {
|
|
1739
1748
|
this.handleItems();
|
|
1740
1749
|
}
|
|
1741
|
-
|
|
1742
|
-
// handle tab index
|
|
1743
|
-
this.items.forEach((item) => {
|
|
1744
|
-
item.tabIndex = -1;
|
|
1745
|
-
});
|
|
1746
|
-
|
|
1747
|
-
if (!this.disabled) {
|
|
1748
|
-
this.items[this.index].tabIndex = 0;
|
|
1749
|
-
}
|
|
1750
1750
|
}
|
|
1751
1751
|
|
|
1752
1752
|
/**
|
|
@@ -1790,10 +1790,7 @@ class AuroRadioGroup extends i$2 {
|
|
|
1790
1790
|
const nextEnabledIndex = this.items.findIndex((item) => !item.hasAttribute('disabled'));
|
|
1791
1791
|
|
|
1792
1792
|
this.index = index >= 0 ? index : nextEnabledIndex;
|
|
1793
|
-
|
|
1794
|
-
if (this.index >= 0) {
|
|
1795
|
-
this.items[this.index].tabIndex = 0;
|
|
1796
|
-
}
|
|
1793
|
+
this.items[this.index].setAttribute('tabindex', 0);
|
|
1797
1794
|
}
|
|
1798
1795
|
}
|
|
1799
1796
|
|
|
@@ -1807,20 +1804,10 @@ class AuroRadioGroup extends i$2 {
|
|
|
1807
1804
|
this.index = this.items.indexOf(event.target);
|
|
1808
1805
|
|
|
1809
1806
|
this.items.forEach((item) => {
|
|
1810
|
-
|
|
1811
|
-
item.tabIndex = 0;
|
|
1812
|
-
if (event.target.value) {
|
|
1813
|
-
this.value = event.target.value;
|
|
1814
|
-
}
|
|
1815
|
-
} else {
|
|
1816
|
-
const sdInput = item.shadowRoot.querySelector('input');
|
|
1817
|
-
|
|
1818
|
-
sdInput.checked = false;
|
|
1819
|
-
item.checked = false;
|
|
1820
|
-
item.tabIndex = -1;
|
|
1821
|
-
}
|
|
1807
|
+
item.checked = item === event.target;
|
|
1822
1808
|
});
|
|
1823
1809
|
|
|
1810
|
+
this.value = event.target.value;
|
|
1824
1811
|
this.optionSelected = event.target;
|
|
1825
1812
|
|
|
1826
1813
|
this.validation.validate(this);
|
|
@@ -1833,7 +1820,7 @@ class AuroRadioGroup extends i$2 {
|
|
|
1833
1820
|
* @returns {void}
|
|
1834
1821
|
*/
|
|
1835
1822
|
selectItem(index) {
|
|
1836
|
-
const sdItem = this.items[index]
|
|
1823
|
+
const sdItem = this.items[index];
|
|
1837
1824
|
|
|
1838
1825
|
sdItem.click();
|
|
1839
1826
|
sdItem.focus();
|
|
@@ -1852,17 +1839,18 @@ class AuroRadioGroup extends i$2 {
|
|
|
1852
1839
|
|
|
1853
1840
|
for (currIndex; currIndex < this.items.length; moveDirection === "Down" ? currIndex += 1 : currIndex -= 1) {
|
|
1854
1841
|
currIndex = currIndex === -1 ? this.items.length - 1 : currIndex;
|
|
1855
|
-
const sdItem = this.items[currIndex]
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1842
|
+
const sdItem = this.items[currIndex];
|
|
1843
|
+
if (sdItem) {
|
|
1844
|
+
if (this.disabled || this.items.every((item) => item.disabled === true)) {
|
|
1845
|
+
sdItem.focus();
|
|
1846
|
+
break;
|
|
1847
|
+
}
|
|
1848
|
+
if (!sdItem.disabled) {
|
|
1849
|
+
sdItem.click();
|
|
1850
|
+
sdItem.focus();
|
|
1851
|
+
this.index = currIndex;
|
|
1852
|
+
break;
|
|
1853
|
+
}
|
|
1866
1854
|
}
|
|
1867
1855
|
}
|
|
1868
1856
|
}
|
|
@@ -1905,11 +1893,11 @@ class AuroRadioGroup extends i$2 {
|
|
|
1905
1893
|
};
|
|
1906
1894
|
|
|
1907
1895
|
return u`
|
|
1908
|
-
<fieldset class="${e(groupClasses)}" part="radio-group">
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1896
|
+
<fieldset class="${e(groupClasses)}" part="radio-group" role="radiogroup">
|
|
1897
|
+
<legend>
|
|
1898
|
+
<slot name="legend"></slot>
|
|
1899
|
+
${this.required ? undefined : u`<slot name="optionalLabel"> (optional)</slot>`}
|
|
1900
|
+
</legend>
|
|
1913
1901
|
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
1914
1902
|
</fieldset>
|
|
1915
1903
|
|
|
@@ -121,6 +121,7 @@ let AuroLibraryRuntimeUtils$1 = class AuroLibraryRuntimeUtils {
|
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
123
|
|
|
124
|
+
/* eslint-disable max-lines */
|
|
124
125
|
// Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
125
126
|
// See LICENSE in the project root for license information.
|
|
126
127
|
|
|
@@ -155,8 +156,8 @@ class AuroRadio extends i$2 {
|
|
|
155
156
|
this.required = false;
|
|
156
157
|
this.error = false;
|
|
157
158
|
this.onDark = false;
|
|
158
|
-
this.tabIndex = -1;
|
|
159
159
|
this.touched = false;
|
|
160
|
+
this.role = 'radio';
|
|
160
161
|
|
|
161
162
|
/**
|
|
162
163
|
* @private
|
|
@@ -198,10 +199,6 @@ class AuroRadio extends i$2 {
|
|
|
198
199
|
label: { type: String },
|
|
199
200
|
name: { type: String },
|
|
200
201
|
value: { type: String },
|
|
201
|
-
tabIndex: {
|
|
202
|
-
type: Number,
|
|
203
|
-
reflect: true
|
|
204
|
-
},
|
|
205
202
|
|
|
206
203
|
/**
|
|
207
204
|
* Whether or not the radio button has been touched by the user.
|
|
@@ -214,13 +211,22 @@ class AuroRadio extends i$2 {
|
|
|
214
211
|
},
|
|
215
212
|
|
|
216
213
|
/**
|
|
214
|
+
* ID for input node.
|
|
217
215
|
* @private
|
|
218
|
-
* id for input node
|
|
219
216
|
*/
|
|
220
217
|
inputId: {
|
|
221
218
|
type: String,
|
|
222
219
|
reflect: false,
|
|
223
220
|
attribute: false
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* @private
|
|
225
|
+
* not to add to api.md since changing of this can easily break a11y.
|
|
226
|
+
*/
|
|
227
|
+
role: {
|
|
228
|
+
type: String,
|
|
229
|
+
reflect: true
|
|
224
230
|
}
|
|
225
231
|
};
|
|
226
232
|
}
|
|
@@ -246,7 +252,6 @@ class AuroRadio extends i$2 {
|
|
|
246
252
|
handleChange(event) {
|
|
247
253
|
this.checked = event.target.checked;
|
|
248
254
|
const customEvent = new CustomEvent(event.type, event);
|
|
249
|
-
|
|
250
255
|
this.dispatchEvent(customEvent);
|
|
251
256
|
}
|
|
252
257
|
|
|
@@ -305,7 +310,27 @@ class AuroRadio extends i$2 {
|
|
|
305
310
|
}
|
|
306
311
|
|
|
307
312
|
updated(changedProperties) {
|
|
313
|
+
if (changedProperties.has('error') || changedProperties.has('validity')) {
|
|
314
|
+
this.setAttribute('aria-invalid', this.error || this.validity !== 'valid' ? 'true' : 'false');
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
if (changedProperties.has('required')) {
|
|
318
|
+
this.setAttribute('aria-required', this.isRequired(this.required));
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
if (changedProperties.has('disabled')) {
|
|
322
|
+
if (this.disabled) {
|
|
323
|
+
this.setAttribute('aria-disabled', '');
|
|
324
|
+
} else {
|
|
325
|
+
this.removeAttribute('aria-disabled');
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
308
329
|
if (changedProperties.has('checked')) {
|
|
330
|
+
this.setAttribute('aria-checked', this.checked ? 'true' : 'false');
|
|
331
|
+
// eslint-disable-next-line no-magic-numbers
|
|
332
|
+
this.setAttribute('tabindex', this.checked ? 0 : -1);
|
|
333
|
+
|
|
309
334
|
this.dispatchEvent(new CustomEvent('resetRadio', {
|
|
310
335
|
bubbles: true,
|
|
311
336
|
composed: true
|
|
@@ -320,20 +345,6 @@ class AuroRadio extends i$2 {
|
|
|
320
345
|
}
|
|
321
346
|
}
|
|
322
347
|
|
|
323
|
-
/**
|
|
324
|
-
* Method for handling content when it is invalid accessibility wise.
|
|
325
|
-
* @private
|
|
326
|
-
* @param {Boolean} error - The element's error attribute.
|
|
327
|
-
* @returns {void}
|
|
328
|
-
*/
|
|
329
|
-
invalid(error) {
|
|
330
|
-
if (error) {
|
|
331
|
-
return 'true';
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
return 'false';
|
|
335
|
-
}
|
|
336
|
-
|
|
337
348
|
/**
|
|
338
349
|
* Method for handling passing the required status to aria.
|
|
339
350
|
* @private
|
|
@@ -352,6 +363,7 @@ class AuroRadio extends i$2 {
|
|
|
352
363
|
// Add the tag name as an attribute if it is different than the component name
|
|
353
364
|
this.runtimeUtils.handleComponentTagRename(this, 'auro-radio');
|
|
354
365
|
|
|
366
|
+
this.addEventListener('focus', this.handleFocus);
|
|
355
367
|
this.addEventListener('blur', this.handleBlur);
|
|
356
368
|
|
|
357
369
|
this.input = this.shadowRoot.querySelector('input');
|
|
@@ -376,27 +388,21 @@ class AuroRadio extends i$2 {
|
|
|
376
388
|
return x`
|
|
377
389
|
<div class="ods-inputGroup rdoGroup" part="radio">
|
|
378
390
|
<input
|
|
379
|
-
class="
|
|
391
|
+
class="util_displayHidden ods-inputOption rdo--input"
|
|
380
392
|
part="radio-input"
|
|
381
|
-
@focus="${this.handleFocus}"
|
|
382
393
|
@input="${this.handleInput}"
|
|
383
394
|
@change="${this.handleChange}"
|
|
384
395
|
?disabled="${this.disabled}"
|
|
385
|
-
aria-invalid="${this.invalid(this.error)}"
|
|
386
|
-
aria-required="${this.isRequired(this.required)}"
|
|
387
396
|
.checked="${this.checked}"
|
|
388
397
|
id="${this.inputId}"
|
|
389
398
|
name="${o$1(this.name)}"
|
|
390
399
|
type="radio"
|
|
391
400
|
.value="${this.value}"
|
|
401
|
+
aria-hidden="true"
|
|
392
402
|
tabindex="-1"
|
|
393
403
|
/>
|
|
394
404
|
|
|
395
|
-
<label
|
|
396
|
-
for="${this.inputId}"
|
|
397
|
-
class="${e(labelClasses)}"
|
|
398
|
-
part="radio-label"
|
|
399
|
-
>
|
|
405
|
+
<label for="${this.inputId}" class="${e(labelClasses)}" part="radio-label">
|
|
400
406
|
<slot>${this.label}</slot>
|
|
401
407
|
</label>
|
|
402
408
|
</div>
|
|
@@ -472,9 +478,10 @@ class DateFormatter {
|
|
|
472
478
|
/**
|
|
473
479
|
* Convert a date object to string format.
|
|
474
480
|
* @param {Object} date - Date to convert to string.
|
|
475
|
-
* @
|
|
481
|
+
* @param {String} locale - Optional locale to use for the date string. Defaults to user's locale.
|
|
482
|
+
* @returns {String} Returns the date as a string.
|
|
476
483
|
*/
|
|
477
|
-
this.getDateAsString = (date) => date.toLocaleDateString(
|
|
484
|
+
this.getDateAsString = (date, locale = undefined) => date.toLocaleDateString(locale, {
|
|
478
485
|
year: "numeric",
|
|
479
486
|
month: "2-digit",
|
|
480
487
|
day: "2-digit",
|
|
@@ -666,7 +673,7 @@ class AuroDateUtilities extends AuroDateUtilitiesBase {
|
|
|
666
673
|
const dateObj = new Date(this.getFourDigitYear(dateParts.year), dateParts.month - 1, dateParts.day || 1);
|
|
667
674
|
|
|
668
675
|
// Get the date string of the date object we created from the string date
|
|
669
|
-
const actualDateStr = dateFormatter.getDateAsString(dateObj);
|
|
676
|
+
const actualDateStr = dateFormatter.getDateAsString(dateObj, "en-US");
|
|
670
677
|
|
|
671
678
|
// Guard Clause: Generated date matches date string input
|
|
672
679
|
if (expectedDateStr !== actualDateStr) {
|
|
@@ -1110,7 +1117,9 @@ class AuroFormValidation {
|
|
|
1110
1117
|
elem.validity = this.auroInputElements[0].validity;
|
|
1111
1118
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
1112
1119
|
|
|
1113
|
-
|
|
1120
|
+
// combobox has 2 inputs but no need to check validity on the 2nd one which is in fullscreen bib.
|
|
1121
|
+
// combobox's 2nd input will have noValidate set true.
|
|
1122
|
+
if (elem.validity === 'valid' && this.auroInputElements.length > 1 && !this.auroInputElements[1].noValidate) {
|
|
1114
1123
|
elem.validity = this.auroInputElements[1].validity;
|
|
1115
1124
|
elem.errorMessage = this.auroInputElements[1].errorMessage;
|
|
1116
1125
|
}
|
|
@@ -1230,9 +1239,9 @@ class AuroDependencyVersioning {
|
|
|
1230
1239
|
}
|
|
1231
1240
|
}
|
|
1232
1241
|
|
|
1233
|
-
var colorCss = i$5`:host([error]){--ds-auro-helptext-color: var(--ds-basic-color-status-error, #e31f26)}:host([onDark]){--ds-auro-helptext-color: var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}:host([onDark][error]){--ds-auro-helptext-color: var(--ds-
|
|
1242
|
+
var colorCss = i$5`:host([error]){--ds-auro-helptext-color: var(--ds-basic-color-status-error, #e31f26)}:host([onDark]){--ds-auro-helptext-color: var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}:host([onDark][error]){--ds-auro-helptext-color: var(--ds-basic-color-status-error-subtle, #fbc6c6)}.helptext-wrapper{color:var(--ds-auro-helptext-color)}`;
|
|
1234
1243
|
|
|
1235
|
-
var styleCss = i$5`.helptext-wrapper{display:none;font-size:
|
|
1244
|
+
var styleCss = i$5`.helptext-wrapper{display:none;font-size:12px;font-weight:450;letter-spacing:0;line-height:16px}:host([large]) .helptext-wrapper{font-size:16px;font-weight:450;letter-spacing:0;line-height:24px}.helptext-wrapper[visible]{display:block}::slotted(*:not(:empty)){margin-top:var(--ds-size-50, 0.25rem);margin-bottom:0}::slotted(p){margin-block:0}`;
|
|
1236
1245
|
|
|
1237
1246
|
var tokensCss = i$5`:host{--ds-auro-helptext-color: var(--ds-basic-color-texticon-muted, #676767)}`;
|
|
1238
1247
|
|
|
@@ -1458,7 +1467,7 @@ var helpTextVersion = '1.0.0';
|
|
|
1458
1467
|
* @attr {Object} optionSelected - Specifies the current selected radio button.
|
|
1459
1468
|
* @csspart radio-group - Apply css to the fieldset element in the shadow DOM
|
|
1460
1469
|
* @slot {HTMLSlotElement} legend - Allows for the legend to be overridden.
|
|
1461
|
-
* @slot {HTMLSlotElement} optionalLabel - Allows
|
|
1470
|
+
* @slot {HTMLSlotElement} optionalLabel - Allows overriding the optional display text "(optional)", which appears next to the label.
|
|
1462
1471
|
* @slot {HTMLSlotElement} helpText - Allows for the helper text to be overridden.
|
|
1463
1472
|
* @event auroFormElement-validated - Notifies that the element has been validated.
|
|
1464
1473
|
* @event input - Notifies every time the value prop of the element is changed.
|
|
@@ -1614,7 +1623,7 @@ class AuroRadioGroup extends i$2 {
|
|
|
1614
1623
|
|
|
1615
1624
|
this.optionSelected = event.target;
|
|
1616
1625
|
|
|
1617
|
-
this.validation.validate(this);
|
|
1626
|
+
this.validation.validate(this, this.optionSelected !== undefined);
|
|
1618
1627
|
}
|
|
1619
1628
|
|
|
1620
1629
|
/**
|
|
@@ -1713,15 +1722,6 @@ class AuroRadioGroup extends i$2 {
|
|
|
1713
1722
|
if (this.items.length === 0) {
|
|
1714
1723
|
this.handleItems();
|
|
1715
1724
|
}
|
|
1716
|
-
|
|
1717
|
-
// handle tab index
|
|
1718
|
-
this.items.forEach((item) => {
|
|
1719
|
-
item.tabIndex = -1;
|
|
1720
|
-
});
|
|
1721
|
-
|
|
1722
|
-
if (!this.disabled) {
|
|
1723
|
-
this.items[this.index].tabIndex = 0;
|
|
1724
|
-
}
|
|
1725
1725
|
}
|
|
1726
1726
|
|
|
1727
1727
|
/**
|
|
@@ -1765,10 +1765,7 @@ class AuroRadioGroup extends i$2 {
|
|
|
1765
1765
|
const nextEnabledIndex = this.items.findIndex((item) => !item.hasAttribute('disabled'));
|
|
1766
1766
|
|
|
1767
1767
|
this.index = index >= 0 ? index : nextEnabledIndex;
|
|
1768
|
-
|
|
1769
|
-
if (this.index >= 0) {
|
|
1770
|
-
this.items[this.index].tabIndex = 0;
|
|
1771
|
-
}
|
|
1768
|
+
this.items[this.index].setAttribute('tabindex', 0);
|
|
1772
1769
|
}
|
|
1773
1770
|
}
|
|
1774
1771
|
|
|
@@ -1782,20 +1779,10 @@ class AuroRadioGroup extends i$2 {
|
|
|
1782
1779
|
this.index = this.items.indexOf(event.target);
|
|
1783
1780
|
|
|
1784
1781
|
this.items.forEach((item) => {
|
|
1785
|
-
|
|
1786
|
-
item.tabIndex = 0;
|
|
1787
|
-
if (event.target.value) {
|
|
1788
|
-
this.value = event.target.value;
|
|
1789
|
-
}
|
|
1790
|
-
} else {
|
|
1791
|
-
const sdInput = item.shadowRoot.querySelector('input');
|
|
1792
|
-
|
|
1793
|
-
sdInput.checked = false;
|
|
1794
|
-
item.checked = false;
|
|
1795
|
-
item.tabIndex = -1;
|
|
1796
|
-
}
|
|
1782
|
+
item.checked = item === event.target;
|
|
1797
1783
|
});
|
|
1798
1784
|
|
|
1785
|
+
this.value = event.target.value;
|
|
1799
1786
|
this.optionSelected = event.target;
|
|
1800
1787
|
|
|
1801
1788
|
this.validation.validate(this);
|
|
@@ -1808,7 +1795,7 @@ class AuroRadioGroup extends i$2 {
|
|
|
1808
1795
|
* @returns {void}
|
|
1809
1796
|
*/
|
|
1810
1797
|
selectItem(index) {
|
|
1811
|
-
const sdItem = this.items[index]
|
|
1798
|
+
const sdItem = this.items[index];
|
|
1812
1799
|
|
|
1813
1800
|
sdItem.click();
|
|
1814
1801
|
sdItem.focus();
|
|
@@ -1827,17 +1814,18 @@ class AuroRadioGroup extends i$2 {
|
|
|
1827
1814
|
|
|
1828
1815
|
for (currIndex; currIndex < this.items.length; moveDirection === "Down" ? currIndex += 1 : currIndex -= 1) {
|
|
1829
1816
|
currIndex = currIndex === -1 ? this.items.length - 1 : currIndex;
|
|
1830
|
-
const sdItem = this.items[currIndex]
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1817
|
+
const sdItem = this.items[currIndex];
|
|
1818
|
+
if (sdItem) {
|
|
1819
|
+
if (this.disabled || this.items.every((item) => item.disabled === true)) {
|
|
1820
|
+
sdItem.focus();
|
|
1821
|
+
break;
|
|
1822
|
+
}
|
|
1823
|
+
if (!sdItem.disabled) {
|
|
1824
|
+
sdItem.click();
|
|
1825
|
+
sdItem.focus();
|
|
1826
|
+
this.index = currIndex;
|
|
1827
|
+
break;
|
|
1828
|
+
}
|
|
1841
1829
|
}
|
|
1842
1830
|
}
|
|
1843
1831
|
}
|
|
@@ -1880,11 +1868,11 @@ class AuroRadioGroup extends i$2 {
|
|
|
1880
1868
|
};
|
|
1881
1869
|
|
|
1882
1870
|
return u`
|
|
1883
|
-
<fieldset class="${e(groupClasses)}" part="radio-group">
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1871
|
+
<fieldset class="${e(groupClasses)}" part="radio-group" role="radiogroup">
|
|
1872
|
+
<legend>
|
|
1873
|
+
<slot name="legend"></slot>
|
|
1874
|
+
${this.required ? undefined : u`<slot name="optionalLabel"> (optional)</slot>`}
|
|
1875
|
+
</legend>
|
|
1888
1876
|
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
1889
1877
|
</fieldset>
|
|
1890
1878
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @attr {Object} optionSelected - Specifies the current selected radio button.
|
|
11
11
|
* @csspart radio-group - Apply css to the fieldset element in the shadow DOM
|
|
12
12
|
* @slot {HTMLSlotElement} legend - Allows for the legend to be overridden.
|
|
13
|
-
* @slot {HTMLSlotElement} optionalLabel - Allows
|
|
13
|
+
* @slot {HTMLSlotElement} optionalLabel - Allows overriding the optional display text "(optional)", which appears next to the label.
|
|
14
14
|
* @slot {HTMLSlotElement} helpText - Allows for the helper text to be overridden.
|
|
15
15
|
* @event auroFormElement-validated - Notifies that the element has been validated.
|
|
16
16
|
* @event input - Notifies every time the value prop of the element is changed.
|
|
@@ -50,10 +50,6 @@ export class AuroRadio extends LitElement {
|
|
|
50
50
|
value: {
|
|
51
51
|
type: StringConstructor;
|
|
52
52
|
};
|
|
53
|
-
tabIndex: {
|
|
54
|
-
type: NumberConstructor;
|
|
55
|
-
reflect: boolean;
|
|
56
|
-
};
|
|
57
53
|
/**
|
|
58
54
|
* Whether or not the radio button has been touched by the user.
|
|
59
55
|
* @private
|
|
@@ -64,14 +60,22 @@ export class AuroRadio extends LitElement {
|
|
|
64
60
|
attribute: boolean;
|
|
65
61
|
};
|
|
66
62
|
/**
|
|
63
|
+
* ID for input node.
|
|
67
64
|
* @private
|
|
68
|
-
* id for input node
|
|
69
65
|
*/
|
|
70
66
|
inputId: {
|
|
71
67
|
type: StringConstructor;
|
|
72
68
|
reflect: boolean;
|
|
73
69
|
attribute: boolean;
|
|
74
70
|
};
|
|
71
|
+
/**
|
|
72
|
+
* @private
|
|
73
|
+
* not to add to api.md since changing of this can easily break a11y.
|
|
74
|
+
*/
|
|
75
|
+
role: {
|
|
76
|
+
type: StringConstructor;
|
|
77
|
+
reflect: boolean;
|
|
78
|
+
};
|
|
75
79
|
};
|
|
76
80
|
/**
|
|
77
81
|
* This will register this element with the browser.
|
|
@@ -126,13 +130,6 @@ export class AuroRadio extends LitElement {
|
|
|
126
130
|
*/
|
|
127
131
|
reset(): void;
|
|
128
132
|
updated(changedProperties: any): void;
|
|
129
|
-
/**
|
|
130
|
-
* Method for handling content when it is invalid accessibility wise.
|
|
131
|
-
* @private
|
|
132
|
-
* @param {Boolean} error - The element's error attribute.
|
|
133
|
-
* @returns {void}
|
|
134
|
-
*/
|
|
135
|
-
private invalid;
|
|
136
133
|
/**
|
|
137
134
|
* Method for handling passing the required status to aria.
|
|
138
135
|
* @private
|