@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
|
@@ -81,6 +81,7 @@ let AuroLibraryRuntimeUtils$1 = class AuroLibraryRuntimeUtils {
|
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
+
/* eslint-disable max-lines */
|
|
84
85
|
// Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
85
86
|
// See LICENSE in the project root for license information.
|
|
86
87
|
|
|
@@ -115,8 +116,8 @@ class AuroRadio extends LitElement {
|
|
|
115
116
|
this.required = false;
|
|
116
117
|
this.error = false;
|
|
117
118
|
this.onDark = false;
|
|
118
|
-
this.tabIndex = -1;
|
|
119
119
|
this.touched = false;
|
|
120
|
+
this.role = 'radio';
|
|
120
121
|
|
|
121
122
|
/**
|
|
122
123
|
* @private
|
|
@@ -158,10 +159,6 @@ class AuroRadio extends LitElement {
|
|
|
158
159
|
label: { type: String },
|
|
159
160
|
name: { type: String },
|
|
160
161
|
value: { type: String },
|
|
161
|
-
tabIndex: {
|
|
162
|
-
type: Number,
|
|
163
|
-
reflect: true
|
|
164
|
-
},
|
|
165
162
|
|
|
166
163
|
/**
|
|
167
164
|
* Whether or not the radio button has been touched by the user.
|
|
@@ -174,13 +171,22 @@ class AuroRadio extends LitElement {
|
|
|
174
171
|
},
|
|
175
172
|
|
|
176
173
|
/**
|
|
174
|
+
* ID for input node.
|
|
177
175
|
* @private
|
|
178
|
-
* id for input node
|
|
179
176
|
*/
|
|
180
177
|
inputId: {
|
|
181
178
|
type: String,
|
|
182
179
|
reflect: false,
|
|
183
180
|
attribute: false
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* @private
|
|
185
|
+
* not to add to api.md since changing of this can easily break a11y.
|
|
186
|
+
*/
|
|
187
|
+
role: {
|
|
188
|
+
type: String,
|
|
189
|
+
reflect: true
|
|
184
190
|
}
|
|
185
191
|
};
|
|
186
192
|
}
|
|
@@ -206,7 +212,6 @@ class AuroRadio extends LitElement {
|
|
|
206
212
|
handleChange(event) {
|
|
207
213
|
this.checked = event.target.checked;
|
|
208
214
|
const customEvent = new CustomEvent(event.type, event);
|
|
209
|
-
|
|
210
215
|
this.dispatchEvent(customEvent);
|
|
211
216
|
}
|
|
212
217
|
|
|
@@ -265,7 +270,27 @@ class AuroRadio extends LitElement {
|
|
|
265
270
|
}
|
|
266
271
|
|
|
267
272
|
updated(changedProperties) {
|
|
273
|
+
if (changedProperties.has('error') || changedProperties.has('validity')) {
|
|
274
|
+
this.setAttribute('aria-invalid', this.error || this.validity !== 'valid' ? 'true' : 'false');
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (changedProperties.has('required')) {
|
|
278
|
+
this.setAttribute('aria-required', this.isRequired(this.required));
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (changedProperties.has('disabled')) {
|
|
282
|
+
if (this.disabled) {
|
|
283
|
+
this.setAttribute('aria-disabled', '');
|
|
284
|
+
} else {
|
|
285
|
+
this.removeAttribute('aria-disabled');
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
268
289
|
if (changedProperties.has('checked')) {
|
|
290
|
+
this.setAttribute('aria-checked', this.checked ? 'true' : 'false');
|
|
291
|
+
// eslint-disable-next-line no-magic-numbers
|
|
292
|
+
this.setAttribute('tabindex', this.checked ? 0 : -1);
|
|
293
|
+
|
|
269
294
|
this.dispatchEvent(new CustomEvent('resetRadio', {
|
|
270
295
|
bubbles: true,
|
|
271
296
|
composed: true
|
|
@@ -280,20 +305,6 @@ class AuroRadio extends LitElement {
|
|
|
280
305
|
}
|
|
281
306
|
}
|
|
282
307
|
|
|
283
|
-
/**
|
|
284
|
-
* Method for handling content when it is invalid accessibility wise.
|
|
285
|
-
* @private
|
|
286
|
-
* @param {Boolean} error - The element's error attribute.
|
|
287
|
-
* @returns {void}
|
|
288
|
-
*/
|
|
289
|
-
invalid(error) {
|
|
290
|
-
if (error) {
|
|
291
|
-
return 'true';
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
return 'false';
|
|
295
|
-
}
|
|
296
|
-
|
|
297
308
|
/**
|
|
298
309
|
* Method for handling passing the required status to aria.
|
|
299
310
|
* @private
|
|
@@ -312,6 +323,7 @@ class AuroRadio extends LitElement {
|
|
|
312
323
|
// Add the tag name as an attribute if it is different than the component name
|
|
313
324
|
this.runtimeUtils.handleComponentTagRename(this, 'auro-radio');
|
|
314
325
|
|
|
326
|
+
this.addEventListener('focus', this.handleFocus);
|
|
315
327
|
this.addEventListener('blur', this.handleBlur);
|
|
316
328
|
|
|
317
329
|
this.input = this.shadowRoot.querySelector('input');
|
|
@@ -336,27 +348,21 @@ class AuroRadio extends LitElement {
|
|
|
336
348
|
return html`
|
|
337
349
|
<div class="ods-inputGroup rdoGroup" part="radio">
|
|
338
350
|
<input
|
|
339
|
-
class="
|
|
351
|
+
class="util_displayHidden ods-inputOption rdo--input"
|
|
340
352
|
part="radio-input"
|
|
341
|
-
@focus="${this.handleFocus}"
|
|
342
353
|
@input="${this.handleInput}"
|
|
343
354
|
@change="${this.handleChange}"
|
|
344
355
|
?disabled="${this.disabled}"
|
|
345
|
-
aria-invalid="${this.invalid(this.error)}"
|
|
346
|
-
aria-required="${this.isRequired(this.required)}"
|
|
347
356
|
.checked="${this.checked}"
|
|
348
357
|
id="${this.inputId}"
|
|
349
358
|
name="${ifDefined(this.name)}"
|
|
350
359
|
type="radio"
|
|
351
360
|
.value="${this.value}"
|
|
361
|
+
aria-hidden="true"
|
|
352
362
|
tabindex="-1"
|
|
353
363
|
/>
|
|
354
364
|
|
|
355
|
-
<label
|
|
356
|
-
for="${this.inputId}"
|
|
357
|
-
class="${classMap(labelClasses)}"
|
|
358
|
-
part="radio-label"
|
|
359
|
-
>
|
|
365
|
+
<label for="${this.inputId}" class="${classMap(labelClasses)}" part="radio-label">
|
|
360
366
|
<slot>${this.label}</slot>
|
|
361
367
|
</label>
|
|
362
368
|
</div>
|
|
@@ -425,9 +431,10 @@ class DateFormatter {
|
|
|
425
431
|
/**
|
|
426
432
|
* Convert a date object to string format.
|
|
427
433
|
* @param {Object} date - Date to convert to string.
|
|
428
|
-
* @
|
|
434
|
+
* @param {String} locale - Optional locale to use for the date string. Defaults to user's locale.
|
|
435
|
+
* @returns {String} Returns the date as a string.
|
|
429
436
|
*/
|
|
430
|
-
this.getDateAsString = (date) => date.toLocaleDateString(
|
|
437
|
+
this.getDateAsString = (date, locale = undefined) => date.toLocaleDateString(locale, {
|
|
431
438
|
year: "numeric",
|
|
432
439
|
month: "2-digit",
|
|
433
440
|
day: "2-digit",
|
|
@@ -619,7 +626,7 @@ class AuroDateUtilities extends AuroDateUtilitiesBase {
|
|
|
619
626
|
const dateObj = new Date(this.getFourDigitYear(dateParts.year), dateParts.month - 1, dateParts.day || 1);
|
|
620
627
|
|
|
621
628
|
// Get the date string of the date object we created from the string date
|
|
622
|
-
const actualDateStr = dateFormatter.getDateAsString(dateObj);
|
|
629
|
+
const actualDateStr = dateFormatter.getDateAsString(dateObj, "en-US");
|
|
623
630
|
|
|
624
631
|
// Guard Clause: Generated date matches date string input
|
|
625
632
|
if (expectedDateStr !== actualDateStr) {
|
|
@@ -1063,7 +1070,9 @@ class AuroFormValidation {
|
|
|
1063
1070
|
elem.validity = this.auroInputElements[0].validity;
|
|
1064
1071
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
1065
1072
|
|
|
1066
|
-
|
|
1073
|
+
// combobox has 2 inputs but no need to check validity on the 2nd one which is in fullscreen bib.
|
|
1074
|
+
// combobox's 2nd input will have noValidate set true.
|
|
1075
|
+
if (elem.validity === 'valid' && this.auroInputElements.length > 1 && !this.auroInputElements[1].noValidate) {
|
|
1067
1076
|
elem.validity = this.auroInputElements[1].validity;
|
|
1068
1077
|
elem.errorMessage = this.auroInputElements[1].errorMessage;
|
|
1069
1078
|
}
|
|
@@ -1183,9 +1192,9 @@ class AuroDependencyVersioning {
|
|
|
1183
1192
|
}
|
|
1184
1193
|
}
|
|
1185
1194
|
|
|
1186
|
-
var colorCss = css`: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-
|
|
1195
|
+
var colorCss = css`: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)}`;
|
|
1187
1196
|
|
|
1188
|
-
var styleCss = css`.helptext-wrapper{display:none;font-size:
|
|
1197
|
+
var styleCss = css`.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}`;
|
|
1189
1198
|
|
|
1190
1199
|
var tokensCss = css`:host{--ds-auro-helptext-color: var(--ds-basic-color-texticon-muted, #676767)}`;
|
|
1191
1200
|
|
|
@@ -1411,7 +1420,7 @@ var helpTextVersion = '1.0.0';
|
|
|
1411
1420
|
* @attr {Object} optionSelected - Specifies the current selected radio button.
|
|
1412
1421
|
* @csspart radio-group - Apply css to the fieldset element in the shadow DOM
|
|
1413
1422
|
* @slot {HTMLSlotElement} legend - Allows for the legend to be overridden.
|
|
1414
|
-
* @slot {HTMLSlotElement} optionalLabel - Allows
|
|
1423
|
+
* @slot {HTMLSlotElement} optionalLabel - Allows overriding the optional display text "(optional)", which appears next to the label.
|
|
1415
1424
|
* @slot {HTMLSlotElement} helpText - Allows for the helper text to be overridden.
|
|
1416
1425
|
* @event auroFormElement-validated - Notifies that the element has been validated.
|
|
1417
1426
|
* @event input - Notifies every time the value prop of the element is changed.
|
|
@@ -1567,7 +1576,7 @@ class AuroRadioGroup extends LitElement {
|
|
|
1567
1576
|
|
|
1568
1577
|
this.optionSelected = event.target;
|
|
1569
1578
|
|
|
1570
|
-
this.validation.validate(this);
|
|
1579
|
+
this.validation.validate(this, this.optionSelected !== undefined);
|
|
1571
1580
|
}
|
|
1572
1581
|
|
|
1573
1582
|
/**
|
|
@@ -1666,15 +1675,6 @@ class AuroRadioGroup extends LitElement {
|
|
|
1666
1675
|
if (this.items.length === 0) {
|
|
1667
1676
|
this.handleItems();
|
|
1668
1677
|
}
|
|
1669
|
-
|
|
1670
|
-
// handle tab index
|
|
1671
|
-
this.items.forEach((item) => {
|
|
1672
|
-
item.tabIndex = -1;
|
|
1673
|
-
});
|
|
1674
|
-
|
|
1675
|
-
if (!this.disabled) {
|
|
1676
|
-
this.items[this.index].tabIndex = 0;
|
|
1677
|
-
}
|
|
1678
1678
|
}
|
|
1679
1679
|
|
|
1680
1680
|
/**
|
|
@@ -1718,10 +1718,7 @@ class AuroRadioGroup extends LitElement {
|
|
|
1718
1718
|
const nextEnabledIndex = this.items.findIndex((item) => !item.hasAttribute('disabled'));
|
|
1719
1719
|
|
|
1720
1720
|
this.index = index >= 0 ? index : nextEnabledIndex;
|
|
1721
|
-
|
|
1722
|
-
if (this.index >= 0) {
|
|
1723
|
-
this.items[this.index].tabIndex = 0;
|
|
1724
|
-
}
|
|
1721
|
+
this.items[this.index].setAttribute('tabindex', 0);
|
|
1725
1722
|
}
|
|
1726
1723
|
}
|
|
1727
1724
|
|
|
@@ -1735,20 +1732,10 @@ class AuroRadioGroup extends LitElement {
|
|
|
1735
1732
|
this.index = this.items.indexOf(event.target);
|
|
1736
1733
|
|
|
1737
1734
|
this.items.forEach((item) => {
|
|
1738
|
-
|
|
1739
|
-
item.tabIndex = 0;
|
|
1740
|
-
if (event.target.value) {
|
|
1741
|
-
this.value = event.target.value;
|
|
1742
|
-
}
|
|
1743
|
-
} else {
|
|
1744
|
-
const sdInput = item.shadowRoot.querySelector('input');
|
|
1745
|
-
|
|
1746
|
-
sdInput.checked = false;
|
|
1747
|
-
item.checked = false;
|
|
1748
|
-
item.tabIndex = -1;
|
|
1749
|
-
}
|
|
1735
|
+
item.checked = item === event.target;
|
|
1750
1736
|
});
|
|
1751
1737
|
|
|
1738
|
+
this.value = event.target.value;
|
|
1752
1739
|
this.optionSelected = event.target;
|
|
1753
1740
|
|
|
1754
1741
|
this.validation.validate(this);
|
|
@@ -1761,7 +1748,7 @@ class AuroRadioGroup extends LitElement {
|
|
|
1761
1748
|
* @returns {void}
|
|
1762
1749
|
*/
|
|
1763
1750
|
selectItem(index) {
|
|
1764
|
-
const sdItem = this.items[index]
|
|
1751
|
+
const sdItem = this.items[index];
|
|
1765
1752
|
|
|
1766
1753
|
sdItem.click();
|
|
1767
1754
|
sdItem.focus();
|
|
@@ -1780,17 +1767,18 @@ class AuroRadioGroup extends LitElement {
|
|
|
1780
1767
|
|
|
1781
1768
|
for (currIndex; currIndex < this.items.length; moveDirection === "Down" ? currIndex += 1 : currIndex -= 1) {
|
|
1782
1769
|
currIndex = currIndex === -1 ? this.items.length - 1 : currIndex;
|
|
1783
|
-
const sdItem = this.items[currIndex]
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1770
|
+
const sdItem = this.items[currIndex];
|
|
1771
|
+
if (sdItem) {
|
|
1772
|
+
if (this.disabled || this.items.every((item) => item.disabled === true)) {
|
|
1773
|
+
sdItem.focus();
|
|
1774
|
+
break;
|
|
1775
|
+
}
|
|
1776
|
+
if (!sdItem.disabled) {
|
|
1777
|
+
sdItem.click();
|
|
1778
|
+
sdItem.focus();
|
|
1779
|
+
this.index = currIndex;
|
|
1780
|
+
break;
|
|
1781
|
+
}
|
|
1794
1782
|
}
|
|
1795
1783
|
}
|
|
1796
1784
|
}
|
|
@@ -1833,11 +1821,11 @@ class AuroRadioGroup extends LitElement {
|
|
|
1833
1821
|
};
|
|
1834
1822
|
|
|
1835
1823
|
return html$1`
|
|
1836
|
-
<fieldset class="${classMap(groupClasses)}" part="radio-group">
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1824
|
+
<fieldset class="${classMap(groupClasses)}" part="radio-group" role="radiogroup">
|
|
1825
|
+
<legend>
|
|
1826
|
+
<slot name="legend"></slot>
|
|
1827
|
+
${this.required ? undefined : html$1`<slot name="optionalLabel"> (optional)</slot>`}
|
|
1828
|
+
</legend>
|
|
1841
1829
|
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
1842
1830
|
</fieldset>
|
|
1843
1831
|
|
|
@@ -81,6 +81,7 @@ let AuroLibraryRuntimeUtils$1 = class AuroLibraryRuntimeUtils {
|
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
+
/* eslint-disable max-lines */
|
|
84
85
|
// Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
85
86
|
// See LICENSE in the project root for license information.
|
|
86
87
|
|
|
@@ -115,8 +116,8 @@ class AuroRadio extends LitElement {
|
|
|
115
116
|
this.required = false;
|
|
116
117
|
this.error = false;
|
|
117
118
|
this.onDark = false;
|
|
118
|
-
this.tabIndex = -1;
|
|
119
119
|
this.touched = false;
|
|
120
|
+
this.role = 'radio';
|
|
120
121
|
|
|
121
122
|
/**
|
|
122
123
|
* @private
|
|
@@ -158,10 +159,6 @@ class AuroRadio extends LitElement {
|
|
|
158
159
|
label: { type: String },
|
|
159
160
|
name: { type: String },
|
|
160
161
|
value: { type: String },
|
|
161
|
-
tabIndex: {
|
|
162
|
-
type: Number,
|
|
163
|
-
reflect: true
|
|
164
|
-
},
|
|
165
162
|
|
|
166
163
|
/**
|
|
167
164
|
* Whether or not the radio button has been touched by the user.
|
|
@@ -174,13 +171,22 @@ class AuroRadio extends LitElement {
|
|
|
174
171
|
},
|
|
175
172
|
|
|
176
173
|
/**
|
|
174
|
+
* ID for input node.
|
|
177
175
|
* @private
|
|
178
|
-
* id for input node
|
|
179
176
|
*/
|
|
180
177
|
inputId: {
|
|
181
178
|
type: String,
|
|
182
179
|
reflect: false,
|
|
183
180
|
attribute: false
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* @private
|
|
185
|
+
* not to add to api.md since changing of this can easily break a11y.
|
|
186
|
+
*/
|
|
187
|
+
role: {
|
|
188
|
+
type: String,
|
|
189
|
+
reflect: true
|
|
184
190
|
}
|
|
185
191
|
};
|
|
186
192
|
}
|
|
@@ -206,7 +212,6 @@ class AuroRadio extends LitElement {
|
|
|
206
212
|
handleChange(event) {
|
|
207
213
|
this.checked = event.target.checked;
|
|
208
214
|
const customEvent = new CustomEvent(event.type, event);
|
|
209
|
-
|
|
210
215
|
this.dispatchEvent(customEvent);
|
|
211
216
|
}
|
|
212
217
|
|
|
@@ -265,7 +270,27 @@ class AuroRadio extends LitElement {
|
|
|
265
270
|
}
|
|
266
271
|
|
|
267
272
|
updated(changedProperties) {
|
|
273
|
+
if (changedProperties.has('error') || changedProperties.has('validity')) {
|
|
274
|
+
this.setAttribute('aria-invalid', this.error || this.validity !== 'valid' ? 'true' : 'false');
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (changedProperties.has('required')) {
|
|
278
|
+
this.setAttribute('aria-required', this.isRequired(this.required));
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (changedProperties.has('disabled')) {
|
|
282
|
+
if (this.disabled) {
|
|
283
|
+
this.setAttribute('aria-disabled', '');
|
|
284
|
+
} else {
|
|
285
|
+
this.removeAttribute('aria-disabled');
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
268
289
|
if (changedProperties.has('checked')) {
|
|
290
|
+
this.setAttribute('aria-checked', this.checked ? 'true' : 'false');
|
|
291
|
+
// eslint-disable-next-line no-magic-numbers
|
|
292
|
+
this.setAttribute('tabindex', this.checked ? 0 : -1);
|
|
293
|
+
|
|
269
294
|
this.dispatchEvent(new CustomEvent('resetRadio', {
|
|
270
295
|
bubbles: true,
|
|
271
296
|
composed: true
|
|
@@ -280,20 +305,6 @@ class AuroRadio extends LitElement {
|
|
|
280
305
|
}
|
|
281
306
|
}
|
|
282
307
|
|
|
283
|
-
/**
|
|
284
|
-
* Method for handling content when it is invalid accessibility wise.
|
|
285
|
-
* @private
|
|
286
|
-
* @param {Boolean} error - The element's error attribute.
|
|
287
|
-
* @returns {void}
|
|
288
|
-
*/
|
|
289
|
-
invalid(error) {
|
|
290
|
-
if (error) {
|
|
291
|
-
return 'true';
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
return 'false';
|
|
295
|
-
}
|
|
296
|
-
|
|
297
308
|
/**
|
|
298
309
|
* Method for handling passing the required status to aria.
|
|
299
310
|
* @private
|
|
@@ -312,6 +323,7 @@ class AuroRadio extends LitElement {
|
|
|
312
323
|
// Add the tag name as an attribute if it is different than the component name
|
|
313
324
|
this.runtimeUtils.handleComponentTagRename(this, 'auro-radio');
|
|
314
325
|
|
|
326
|
+
this.addEventListener('focus', this.handleFocus);
|
|
315
327
|
this.addEventListener('blur', this.handleBlur);
|
|
316
328
|
|
|
317
329
|
this.input = this.shadowRoot.querySelector('input');
|
|
@@ -336,27 +348,21 @@ class AuroRadio extends LitElement {
|
|
|
336
348
|
return html`
|
|
337
349
|
<div class="ods-inputGroup rdoGroup" part="radio">
|
|
338
350
|
<input
|
|
339
|
-
class="
|
|
351
|
+
class="util_displayHidden ods-inputOption rdo--input"
|
|
340
352
|
part="radio-input"
|
|
341
|
-
@focus="${this.handleFocus}"
|
|
342
353
|
@input="${this.handleInput}"
|
|
343
354
|
@change="${this.handleChange}"
|
|
344
355
|
?disabled="${this.disabled}"
|
|
345
|
-
aria-invalid="${this.invalid(this.error)}"
|
|
346
|
-
aria-required="${this.isRequired(this.required)}"
|
|
347
356
|
.checked="${this.checked}"
|
|
348
357
|
id="${this.inputId}"
|
|
349
358
|
name="${ifDefined(this.name)}"
|
|
350
359
|
type="radio"
|
|
351
360
|
.value="${this.value}"
|
|
361
|
+
aria-hidden="true"
|
|
352
362
|
tabindex="-1"
|
|
353
363
|
/>
|
|
354
364
|
|
|
355
|
-
<label
|
|
356
|
-
for="${this.inputId}"
|
|
357
|
-
class="${classMap(labelClasses)}"
|
|
358
|
-
part="radio-label"
|
|
359
|
-
>
|
|
365
|
+
<label for="${this.inputId}" class="${classMap(labelClasses)}" part="radio-label">
|
|
360
366
|
<slot>${this.label}</slot>
|
|
361
367
|
</label>
|
|
362
368
|
</div>
|
|
@@ -425,9 +431,10 @@ class DateFormatter {
|
|
|
425
431
|
/**
|
|
426
432
|
* Convert a date object to string format.
|
|
427
433
|
* @param {Object} date - Date to convert to string.
|
|
428
|
-
* @
|
|
434
|
+
* @param {String} locale - Optional locale to use for the date string. Defaults to user's locale.
|
|
435
|
+
* @returns {String} Returns the date as a string.
|
|
429
436
|
*/
|
|
430
|
-
this.getDateAsString = (date) => date.toLocaleDateString(
|
|
437
|
+
this.getDateAsString = (date, locale = undefined) => date.toLocaleDateString(locale, {
|
|
431
438
|
year: "numeric",
|
|
432
439
|
month: "2-digit",
|
|
433
440
|
day: "2-digit",
|
|
@@ -619,7 +626,7 @@ class AuroDateUtilities extends AuroDateUtilitiesBase {
|
|
|
619
626
|
const dateObj = new Date(this.getFourDigitYear(dateParts.year), dateParts.month - 1, dateParts.day || 1);
|
|
620
627
|
|
|
621
628
|
// Get the date string of the date object we created from the string date
|
|
622
|
-
const actualDateStr = dateFormatter.getDateAsString(dateObj);
|
|
629
|
+
const actualDateStr = dateFormatter.getDateAsString(dateObj, "en-US");
|
|
623
630
|
|
|
624
631
|
// Guard Clause: Generated date matches date string input
|
|
625
632
|
if (expectedDateStr !== actualDateStr) {
|
|
@@ -1063,7 +1070,9 @@ class AuroFormValidation {
|
|
|
1063
1070
|
elem.validity = this.auroInputElements[0].validity;
|
|
1064
1071
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
1065
1072
|
|
|
1066
|
-
|
|
1073
|
+
// combobox has 2 inputs but no need to check validity on the 2nd one which is in fullscreen bib.
|
|
1074
|
+
// combobox's 2nd input will have noValidate set true.
|
|
1075
|
+
if (elem.validity === 'valid' && this.auroInputElements.length > 1 && !this.auroInputElements[1].noValidate) {
|
|
1067
1076
|
elem.validity = this.auroInputElements[1].validity;
|
|
1068
1077
|
elem.errorMessage = this.auroInputElements[1].errorMessage;
|
|
1069
1078
|
}
|
|
@@ -1183,9 +1192,9 @@ class AuroDependencyVersioning {
|
|
|
1183
1192
|
}
|
|
1184
1193
|
}
|
|
1185
1194
|
|
|
1186
|
-
var colorCss = css`: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-
|
|
1195
|
+
var colorCss = css`: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)}`;
|
|
1187
1196
|
|
|
1188
|
-
var styleCss = css`.helptext-wrapper{display:none;font-size:
|
|
1197
|
+
var styleCss = css`.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}`;
|
|
1189
1198
|
|
|
1190
1199
|
var tokensCss = css`:host{--ds-auro-helptext-color: var(--ds-basic-color-texticon-muted, #676767)}`;
|
|
1191
1200
|
|
|
@@ -1411,7 +1420,7 @@ var helpTextVersion = '1.0.0';
|
|
|
1411
1420
|
* @attr {Object} optionSelected - Specifies the current selected radio button.
|
|
1412
1421
|
* @csspart radio-group - Apply css to the fieldset element in the shadow DOM
|
|
1413
1422
|
* @slot {HTMLSlotElement} legend - Allows for the legend to be overridden.
|
|
1414
|
-
* @slot {HTMLSlotElement} optionalLabel - Allows
|
|
1423
|
+
* @slot {HTMLSlotElement} optionalLabel - Allows overriding the optional display text "(optional)", which appears next to the label.
|
|
1415
1424
|
* @slot {HTMLSlotElement} helpText - Allows for the helper text to be overridden.
|
|
1416
1425
|
* @event auroFormElement-validated - Notifies that the element has been validated.
|
|
1417
1426
|
* @event input - Notifies every time the value prop of the element is changed.
|
|
@@ -1567,7 +1576,7 @@ class AuroRadioGroup extends LitElement {
|
|
|
1567
1576
|
|
|
1568
1577
|
this.optionSelected = event.target;
|
|
1569
1578
|
|
|
1570
|
-
this.validation.validate(this);
|
|
1579
|
+
this.validation.validate(this, this.optionSelected !== undefined);
|
|
1571
1580
|
}
|
|
1572
1581
|
|
|
1573
1582
|
/**
|
|
@@ -1666,15 +1675,6 @@ class AuroRadioGroup extends LitElement {
|
|
|
1666
1675
|
if (this.items.length === 0) {
|
|
1667
1676
|
this.handleItems();
|
|
1668
1677
|
}
|
|
1669
|
-
|
|
1670
|
-
// handle tab index
|
|
1671
|
-
this.items.forEach((item) => {
|
|
1672
|
-
item.tabIndex = -1;
|
|
1673
|
-
});
|
|
1674
|
-
|
|
1675
|
-
if (!this.disabled) {
|
|
1676
|
-
this.items[this.index].tabIndex = 0;
|
|
1677
|
-
}
|
|
1678
1678
|
}
|
|
1679
1679
|
|
|
1680
1680
|
/**
|
|
@@ -1718,10 +1718,7 @@ class AuroRadioGroup extends LitElement {
|
|
|
1718
1718
|
const nextEnabledIndex = this.items.findIndex((item) => !item.hasAttribute('disabled'));
|
|
1719
1719
|
|
|
1720
1720
|
this.index = index >= 0 ? index : nextEnabledIndex;
|
|
1721
|
-
|
|
1722
|
-
if (this.index >= 0) {
|
|
1723
|
-
this.items[this.index].tabIndex = 0;
|
|
1724
|
-
}
|
|
1721
|
+
this.items[this.index].setAttribute('tabindex', 0);
|
|
1725
1722
|
}
|
|
1726
1723
|
}
|
|
1727
1724
|
|
|
@@ -1735,20 +1732,10 @@ class AuroRadioGroup extends LitElement {
|
|
|
1735
1732
|
this.index = this.items.indexOf(event.target);
|
|
1736
1733
|
|
|
1737
1734
|
this.items.forEach((item) => {
|
|
1738
|
-
|
|
1739
|
-
item.tabIndex = 0;
|
|
1740
|
-
if (event.target.value) {
|
|
1741
|
-
this.value = event.target.value;
|
|
1742
|
-
}
|
|
1743
|
-
} else {
|
|
1744
|
-
const sdInput = item.shadowRoot.querySelector('input');
|
|
1745
|
-
|
|
1746
|
-
sdInput.checked = false;
|
|
1747
|
-
item.checked = false;
|
|
1748
|
-
item.tabIndex = -1;
|
|
1749
|
-
}
|
|
1735
|
+
item.checked = item === event.target;
|
|
1750
1736
|
});
|
|
1751
1737
|
|
|
1738
|
+
this.value = event.target.value;
|
|
1752
1739
|
this.optionSelected = event.target;
|
|
1753
1740
|
|
|
1754
1741
|
this.validation.validate(this);
|
|
@@ -1761,7 +1748,7 @@ class AuroRadioGroup extends LitElement {
|
|
|
1761
1748
|
* @returns {void}
|
|
1762
1749
|
*/
|
|
1763
1750
|
selectItem(index) {
|
|
1764
|
-
const sdItem = this.items[index]
|
|
1751
|
+
const sdItem = this.items[index];
|
|
1765
1752
|
|
|
1766
1753
|
sdItem.click();
|
|
1767
1754
|
sdItem.focus();
|
|
@@ -1780,17 +1767,18 @@ class AuroRadioGroup extends LitElement {
|
|
|
1780
1767
|
|
|
1781
1768
|
for (currIndex; currIndex < this.items.length; moveDirection === "Down" ? currIndex += 1 : currIndex -= 1) {
|
|
1782
1769
|
currIndex = currIndex === -1 ? this.items.length - 1 : currIndex;
|
|
1783
|
-
const sdItem = this.items[currIndex]
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1770
|
+
const sdItem = this.items[currIndex];
|
|
1771
|
+
if (sdItem) {
|
|
1772
|
+
if (this.disabled || this.items.every((item) => item.disabled === true)) {
|
|
1773
|
+
sdItem.focus();
|
|
1774
|
+
break;
|
|
1775
|
+
}
|
|
1776
|
+
if (!sdItem.disabled) {
|
|
1777
|
+
sdItem.click();
|
|
1778
|
+
sdItem.focus();
|
|
1779
|
+
this.index = currIndex;
|
|
1780
|
+
break;
|
|
1781
|
+
}
|
|
1794
1782
|
}
|
|
1795
1783
|
}
|
|
1796
1784
|
}
|
|
@@ -1833,11 +1821,11 @@ class AuroRadioGroup extends LitElement {
|
|
|
1833
1821
|
};
|
|
1834
1822
|
|
|
1835
1823
|
return html$1`
|
|
1836
|
-
<fieldset class="${classMap(groupClasses)}" part="radio-group">
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1824
|
+
<fieldset class="${classMap(groupClasses)}" part="radio-group" role="radiogroup">
|
|
1825
|
+
<legend>
|
|
1826
|
+
<slot name="legend"></slot>
|
|
1827
|
+
${this.required ? undefined : html$1`<slot name="optionalLabel"> (optional)</slot>`}
|
|
1828
|
+
</legend>
|
|
1841
1829
|
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
1842
1830
|
</fieldset>
|
|
1843
1831
|
|