@aurodesignsystem-dev/auro-formkit 0.0.0-pr740.9 → 0.0.0-pr750.0

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.
Files changed (94) hide show
  1. package/components/bibtemplate/dist/auro-bibtemplate.d.ts +6 -0
  2. package/components/bibtemplate/dist/index.js +25 -1
  3. package/components/bibtemplate/dist/registered.js +25 -1
  4. package/components/checkbox/demo/api.html +16 -10
  5. package/components/checkbox/demo/api.min.js +23 -16
  6. package/components/checkbox/demo/index.html +16 -10
  7. package/components/checkbox/demo/index.min.js +23 -16
  8. package/components/checkbox/demo/readme.html +16 -9
  9. package/components/checkbox/dist/index.js +23 -16
  10. package/components/checkbox/dist/registered.js +23 -16
  11. package/components/combobox/demo/api.html +16 -10
  12. package/components/combobox/demo/api.md +12 -6
  13. package/components/combobox/demo/api.min.js +442 -148
  14. package/components/combobox/demo/index.html +16 -10
  15. package/components/combobox/demo/index.min.js +442 -148
  16. package/components/combobox/demo/readme.html +16 -9
  17. package/components/combobox/dist/index.js +405 -136
  18. package/components/combobox/dist/registered.js +405 -136
  19. package/components/counter/demo/api.html +17 -10
  20. package/components/counter/demo/api.md +140 -7
  21. package/components/counter/demo/api.min.js +1171 -1016
  22. package/components/counter/demo/index.html +17 -10
  23. package/components/counter/demo/index.md +86 -0
  24. package/components/counter/demo/index.min.js +1171 -1016
  25. package/components/counter/demo/readme.html +16 -9
  26. package/components/counter/dist/auro-counter-group.d.ts +64 -23
  27. package/components/counter/dist/auro-counter.d.ts +10 -0
  28. package/components/counter/dist/index.js +1171 -1016
  29. package/components/counter/dist/registered.js +1171 -1016
  30. package/components/datepicker/demo/api.html +16 -10
  31. package/components/datepicker/demo/api.min.js +403 -123
  32. package/components/datepicker/demo/index.html +16 -10
  33. package/components/datepicker/demo/index.min.js +403 -123
  34. package/components/datepicker/demo/readme.html +16 -9
  35. package/components/datepicker/dist/auro-datepicker.d.ts +6 -0
  36. package/components/datepicker/dist/index.js +403 -123
  37. package/components/datepicker/dist/registered.js +403 -123
  38. package/components/dropdown/demo/api.html +16 -10
  39. package/components/dropdown/demo/api.md +77 -269
  40. package/components/dropdown/demo/api.min.js +336 -96
  41. package/components/dropdown/demo/index.html +16 -10
  42. package/components/dropdown/demo/index.md +45 -363
  43. package/components/dropdown/demo/index.min.js +336 -96
  44. package/components/dropdown/demo/readme.html +16 -9
  45. package/components/dropdown/dist/auro-dropdown.d.ts +35 -67
  46. package/components/dropdown/dist/auro-dropdownBib.d.ts +0 -6
  47. package/components/dropdown/dist/index.js +336 -96
  48. package/components/dropdown/dist/registered.js +336 -96
  49. package/components/form/demo/api.html +16 -9
  50. package/components/form/demo/autocomplete.html +19 -3
  51. package/components/form/demo/index.html +16 -9
  52. package/components/form/demo/readme.html +16 -9
  53. package/components/form/demo/working.html +19 -13
  54. package/components/helptext/dist/index.js +1 -1
  55. package/components/helptext/dist/registered.js +1 -1
  56. package/components/input/demo/api.html +16 -10
  57. package/components/input/demo/api.md +1 -1
  58. package/components/input/demo/api.min.js +14 -14
  59. package/components/input/demo/index.html +16 -10
  60. package/components/input/demo/index.min.js +14 -14
  61. package/components/input/demo/readme.html +16 -9
  62. package/components/input/dist/base-input.d.ts +1 -1
  63. package/components/input/dist/index.js +14 -14
  64. package/components/input/dist/registered.js +14 -14
  65. package/components/menu/demo/api.html +16 -32
  66. package/components/menu/demo/api.md +1 -1
  67. package/components/menu/demo/api.min.js +37 -12
  68. package/components/menu/demo/index.html +16 -10
  69. package/components/menu/demo/index.min.js +37 -12
  70. package/components/menu/demo/readme.html +16 -9
  71. package/components/menu/dist/auro-menu.d.ts +13 -2
  72. package/components/menu/dist/index.js +37 -12
  73. package/components/menu/dist/registered.js +37 -12
  74. package/components/radio/demo/api.html +16 -10
  75. package/components/radio/demo/api.md +0 -1
  76. package/components/radio/demo/api.min.js +61 -76
  77. package/components/radio/demo/index.html +16 -10
  78. package/components/radio/demo/index.min.js +61 -76
  79. package/components/radio/demo/readme.html +16 -9
  80. package/components/radio/dist/auro-radio.d.ts +8 -11
  81. package/components/radio/dist/index.js +61 -76
  82. package/components/radio/dist/registered.js +61 -76
  83. package/components/select/demo/api.html +16 -10
  84. package/components/select/demo/api.js +0 -2
  85. package/components/select/demo/api.md +53 -51
  86. package/components/select/demo/api.min.js +520 -358
  87. package/components/select/demo/index.html +16 -11
  88. package/components/select/demo/index.md +6 -158
  89. package/components/select/demo/index.min.js +520 -346
  90. package/components/select/demo/readme.html +16 -9
  91. package/components/select/dist/auro-select.d.ts +33 -8
  92. package/components/select/dist/index.js +483 -334
  93. package/components/select/dist/registered.js +483 -334
  94. package/package.json +26 -25
@@ -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.
@@ -221,6 +218,15 @@ class AuroRadio extends i$2 {
221
218
  type: String,
222
219
  reflect: false,
223
220
  attribute: false
221
+ },
222
+
223
+ /**
224
+ * Do not add to api doc since changing of this can easily break a11y.
225
+ * @private
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="util_displayHiddenVisually ods-inputOption rdo--input"
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>
@@ -412,7 +418,7 @@ class AuroRadio extends i$2 {
412
418
  */
413
419
  const a=Symbol.for(""),o=t=>{if(t?.r===a)return t?._$litStatic$},s=t=>({_$litStatic$:t,r:a}),i=(t,...r)=>({_$litStatic$:r.reduce(((r,e,a)=>r+(t=>{if(void 0!==t._$litStatic$)return t._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${t}. Use 'unsafeStatic' to pass non-literal values, but\n take care to ensure page security.`)})(e)+t[a+1]),t[0]),r:a}),l=new Map,n=t=>(r,...e)=>{const a=e.length;let s,i;const n=[],u=[];let c,$=0,f=false;for(;$<a;){for(c=r[$];$<a&&void 0!==(i=e[$],s=o(i));)c+=s+r[++$],f=true;$!==a&&u.push(i),n.push(c),$++;}if($===a&&n.push(r[a]),f){const t=n.join("$$lit$$");void 0===(r=l.get(t))&&(n.raw=n,l.set(t,r=n)),e=u;}return t(r,...e)},u=n(x);
414
420
 
415
- var styleCss$1 = i$5`:host{display:block;padding-bottom:var(--ds-size-150, 0.75rem)}fieldset{all:unset}.displayFlex legend+slot{display:flex;white-space:nowrap}legend{margin-bottom:var(--ds-size-150, 0.75rem)}`;
421
+ var styleCss$1 = i$5`:host{display:block;padding-bottom:var(--ds-size-150, 0.75rem)}fieldset{all:unset}.displayFlex legend+slot{display:flex;white-space:nowrap}legend{margin-bottom:var(--ds-size-150, 0.75rem)}[auro-helptext]{margin-top:var(--ds-size-150, 0.75rem)}`;
416
422
 
417
423
  var colorCss$1 = i$5`:host legend{color:var(--ds-auro-radio-group-label-color)}:host([disabled]){--ds-auro-radio-group-label-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host([onDark]){--ds-auro-radio-group-label-color: var(--ds-basic-color-texticon-inverse, #ffffff)}:host([onDark][disabled]){--ds-auro-radio-group-label-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894)}`;
418
424
 
@@ -892,19 +898,19 @@ class AuroFormValidation {
892
898
  {
893
899
  check: (e) => e.value?.length > 0 && e.value?.length < e.minLength,
894
900
  validity: 'tooShort',
895
- message: e => e.setCustomValidityTooShort || e.setCustomValidity || ''
901
+ message: e => e.getAttribute('setCustomValidityTooShort') || e.setCustomValidity || ''
896
902
  },
897
903
  {
898
904
  check: (e) => e.value?.length > e.maxLength,
899
905
  validity: 'tooLong',
900
- message: e => e.setCustomValidityTooLong || e.setCustomValidity || ''
906
+ message: e => e.getAttribute('setCustomValidityTooLong') || e.setCustomValidity || ''
901
907
  }
902
908
  ],
903
909
  pattern: [
904
910
  {
905
911
  check: (e) => e.pattern && !new RegExp(`^${e.pattern}$`, 'u').test(e.value),
906
912
  validity: 'patternMismatch',
907
- message: e => e.setCustomValidityPatternMismatch || e.setCustomValidity || ''
913
+ message: e => e.getAttribute('setCustomValidityPatternMismatch') || e.setCustomValidity || ''
908
914
  }
909
915
  ]
910
916
  },
@@ -1099,10 +1105,10 @@ class AuroFormValidation {
1099
1105
  if (!hasValue && elem.required && elem.touched) {
1100
1106
  elem.validity = 'valueMissing';
1101
1107
  elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
1102
- } else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
1108
+ } else if (hasValue && this.runtimeUtils.elementMatch(elem, 'auro-input')) {
1103
1109
  this.validateType(elem);
1104
1110
  this.validateElementAttributes(elem);
1105
- } else if (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group')) {
1111
+ } else if (hasValue && (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group'))) {
1106
1112
  this.validateElementAttributes(elem);
1107
1113
  }
1108
1114
  }
@@ -1235,7 +1241,7 @@ class AuroDependencyVersioning {
1235
1241
 
1236
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)}`;
1237
1243
 
1238
- 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}`;
1244
+ var styleCss = i$5`:host{position:relative;display:block}.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}`;
1239
1245
 
1240
1246
  var tokensCss = i$5`:host{--ds-auro-helptext-color: var(--ds-basic-color-texticon-muted, #676767)}`;
1241
1247
 
@@ -1716,15 +1722,6 @@ class AuroRadioGroup extends i$2 {
1716
1722
  if (this.items.length === 0) {
1717
1723
  this.handleItems();
1718
1724
  }
1719
-
1720
- // handle tab index
1721
- this.items.forEach((item) => {
1722
- item.tabIndex = -1;
1723
- });
1724
-
1725
- if (!this.disabled) {
1726
- this.items[this.index].tabIndex = 0;
1727
- }
1728
1725
  }
1729
1726
 
1730
1727
  /**
@@ -1768,10 +1765,7 @@ class AuroRadioGroup extends i$2 {
1768
1765
  const nextEnabledIndex = this.items.findIndex((item) => !item.hasAttribute('disabled'));
1769
1766
 
1770
1767
  this.index = index >= 0 ? index : nextEnabledIndex;
1771
-
1772
- if (this.index >= 0) {
1773
- this.items[this.index].tabIndex = 0;
1774
- }
1768
+ this.items[this.index].setAttribute('tabindex', 0);
1775
1769
  }
1776
1770
  }
1777
1771
 
@@ -1785,20 +1779,10 @@ class AuroRadioGroup extends i$2 {
1785
1779
  this.index = this.items.indexOf(event.target);
1786
1780
 
1787
1781
  this.items.forEach((item) => {
1788
- if (item === event.target) {
1789
- item.tabIndex = 0;
1790
- if (event.target.value) {
1791
- this.value = event.target.value;
1792
- }
1793
- } else {
1794
- const sdInput = item.shadowRoot.querySelector('input');
1795
-
1796
- sdInput.checked = false;
1797
- item.checked = false;
1798
- item.tabIndex = -1;
1799
- }
1782
+ item.checked = item === event.target;
1800
1783
  });
1801
1784
 
1785
+ this.value = event.target.value;
1802
1786
  this.optionSelected = event.target;
1803
1787
 
1804
1788
  this.validation.validate(this);
@@ -1811,7 +1795,7 @@ class AuroRadioGroup extends i$2 {
1811
1795
  * @returns {void}
1812
1796
  */
1813
1797
  selectItem(index) {
1814
- const sdItem = this.items[index].shadowRoot.querySelector('input');
1798
+ const sdItem = this.items[index];
1815
1799
 
1816
1800
  sdItem.click();
1817
1801
  sdItem.focus();
@@ -1830,17 +1814,18 @@ class AuroRadioGroup extends i$2 {
1830
1814
 
1831
1815
  for (currIndex; currIndex < this.items.length; moveDirection === "Down" ? currIndex += 1 : currIndex -= 1) {
1832
1816
  currIndex = currIndex === -1 ? this.items.length - 1 : currIndex;
1833
- const sdItem = this.items[currIndex].shadowRoot.querySelector('input');
1834
-
1835
- if (this.disabled || this.items.every((item) => item.disabled === true)) {
1836
- sdItem.focus();
1837
- break;
1838
- }
1839
- if (!sdItem.disabled) {
1840
- sdItem.click();
1841
- sdItem.focus();
1842
- this.index = currIndex;
1843
- break;
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
+ }
1844
1829
  }
1845
1830
  }
1846
1831
  }
@@ -1883,7 +1868,7 @@ class AuroRadioGroup extends i$2 {
1883
1868
  };
1884
1869
 
1885
1870
  return u`
1886
- <fieldset class="${e(groupClasses)}" part="radio-group">
1871
+ <fieldset class="${e(groupClasses)}" part="radio-group" role="radiogroup">
1887
1872
  <legend>
1888
1873
  <slot name="legend"></slot>
1889
1874
  ${this.required ? undefined : u`<slot name="optionalLabel"> (optional)</slot>`}
@@ -1893,11 +1878,11 @@ class AuroRadioGroup extends i$2 {
1893
1878
 
1894
1879
  ${!this.validity || this.validity === undefined || this.validity === 'valid'
1895
1880
  ? u`
1896
- <${this.helpTextTag} large ?onDark="${this.onDark}" part="helpText">
1881
+ <${this.helpTextTag} ?onDark="${this.onDark}" part="helpText">
1897
1882
  <slot name="helpText"></slot>
1898
1883
  </${this.helpTextTag}>`
1899
1884
  : u`
1900
- <${this.helpTextTag} large ?onDark="${this.onDark}" role="alert" error aria-live="assertive" part="helpText">
1885
+ <${this.helpTextTag} ?onDark="${this.onDark}" role="alert" error aria-live="assertive" part="helpText">
1901
1886
  ${this.errorMessage}
1902
1887
  </${this.helpTextTag}>`
1903
1888
  }
@@ -16,17 +16,24 @@
16
16
  <head>
17
17
  <meta charset="UTF-8" />
18
18
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
19
- <title>Auro Web Component Generator | auro-radio custom element</title>
20
- <link
21
- rel="stylesheet"
22
- type="text/css"
23
- href="https://cdn.jsdelivr.net/npm/prismjs@1.24.1/themes/prism.css"
24
- />
25
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/auro-classic/CSSCustomProperties.css">
26
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/alaska/CSSCustomProperties--alaska.css">
19
+ <title>Auro Web Component Demo | auro-radio</title>
20
+
21
+ <!-- Prism.js Stylesheet -->
22
+ <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/prismjs@1.24.1/themes/prism.css"/>
23
+
24
+ <!-- Legacy reference is still needed to support auro-radio's use of legacy token values at this time -->
25
+ <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/legacy/auro-classic/CSSCustomProperties.css"/>
26
+
27
+ <!-- Design Token Alaska Theme -->
28
+ <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/themes/alaska/CSSCustomProperties--alaska.min.css"/>
29
+
30
+ <!-- Webcore Stylesheet Alaska Theme -->
31
+ <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/bundled/themes/alaska.global.min.css" />
32
+
33
+ <!-- Demo Specific Styles -->
27
34
  <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/demoWrapper.css" />
28
35
  <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/elementDemoStyles.css" />
29
- </head>
36
+ </head>
30
37
  <body class="auro-markdown">
31
38
  <main></main>
32
39
 
@@ -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
@@ -72,6 +68,14 @@ export class AuroRadio extends LitElement {
72
68
  reflect: boolean;
73
69
  attribute: boolean;
74
70
  };
71
+ /**
72
+ * Do not add to api doc since changing of this can easily break a11y.
73
+ * @private
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
@@ -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.
@@ -181,6 +178,15 @@ class AuroRadio extends LitElement {
181
178
  type: String,
182
179
  reflect: false,
183
180
  attribute: false
181
+ },
182
+
183
+ /**
184
+ * Do not add to api doc since changing of this can easily break a11y.
185
+ * @private
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="util_displayHiddenVisually ods-inputOption rdo--input"
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>
@@ -365,7 +371,7 @@ class AuroRadio extends LitElement {
365
371
  }
366
372
  }
367
373
 
368
- var styleCss$1 = css`:host{display:block;padding-bottom:var(--ds-size-150, 0.75rem)}fieldset{all:unset}.displayFlex legend+slot{display:flex;white-space:nowrap}legend{margin-bottom:var(--ds-size-150, 0.75rem)}`;
374
+ var styleCss$1 = css`:host{display:block;padding-bottom:var(--ds-size-150, 0.75rem)}fieldset{all:unset}.displayFlex legend+slot{display:flex;white-space:nowrap}legend{margin-bottom:var(--ds-size-150, 0.75rem)}[auro-helptext]{margin-top:var(--ds-size-150, 0.75rem)}`;
369
375
 
370
376
  var colorCss$1 = css`:host legend{color:var(--ds-auro-radio-group-label-color)}:host([disabled]){--ds-auro-radio-group-label-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host([onDark]){--ds-auro-radio-group-label-color: var(--ds-basic-color-texticon-inverse, #ffffff)}:host([onDark][disabled]){--ds-auro-radio-group-label-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894)}`;
371
377
 
@@ -845,19 +851,19 @@ class AuroFormValidation {
845
851
  {
846
852
  check: (e) => e.value?.length > 0 && e.value?.length < e.minLength,
847
853
  validity: 'tooShort',
848
- message: e => e.setCustomValidityTooShort || e.setCustomValidity || ''
854
+ message: e => e.getAttribute('setCustomValidityTooShort') || e.setCustomValidity || ''
849
855
  },
850
856
  {
851
857
  check: (e) => e.value?.length > e.maxLength,
852
858
  validity: 'tooLong',
853
- message: e => e.setCustomValidityTooLong || e.setCustomValidity || ''
859
+ message: e => e.getAttribute('setCustomValidityTooLong') || e.setCustomValidity || ''
854
860
  }
855
861
  ],
856
862
  pattern: [
857
863
  {
858
864
  check: (e) => e.pattern && !new RegExp(`^${e.pattern}$`, 'u').test(e.value),
859
865
  validity: 'patternMismatch',
860
- message: e => e.setCustomValidityPatternMismatch || e.setCustomValidity || ''
866
+ message: e => e.getAttribute('setCustomValidityPatternMismatch') || e.setCustomValidity || ''
861
867
  }
862
868
  ]
863
869
  },
@@ -1052,10 +1058,10 @@ class AuroFormValidation {
1052
1058
  if (!hasValue && elem.required && elem.touched) {
1053
1059
  elem.validity = 'valueMissing';
1054
1060
  elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
1055
- } else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
1061
+ } else if (hasValue && this.runtimeUtils.elementMatch(elem, 'auro-input')) {
1056
1062
  this.validateType(elem);
1057
1063
  this.validateElementAttributes(elem);
1058
- } else if (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group')) {
1064
+ } else if (hasValue && (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group'))) {
1059
1065
  this.validateElementAttributes(elem);
1060
1066
  }
1061
1067
  }
@@ -1188,7 +1194,7 @@ class AuroDependencyVersioning {
1188
1194
 
1189
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)}`;
1190
1196
 
1191
- 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}`;
1197
+ var styleCss = css`:host{position:relative;display:block}.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}`;
1192
1198
 
1193
1199
  var tokensCss = css`:host{--ds-auro-helptext-color: var(--ds-basic-color-texticon-muted, #676767)}`;
1194
1200
 
@@ -1669,15 +1675,6 @@ class AuroRadioGroup extends LitElement {
1669
1675
  if (this.items.length === 0) {
1670
1676
  this.handleItems();
1671
1677
  }
1672
-
1673
- // handle tab index
1674
- this.items.forEach((item) => {
1675
- item.tabIndex = -1;
1676
- });
1677
-
1678
- if (!this.disabled) {
1679
- this.items[this.index].tabIndex = 0;
1680
- }
1681
1678
  }
1682
1679
 
1683
1680
  /**
@@ -1721,10 +1718,7 @@ class AuroRadioGroup extends LitElement {
1721
1718
  const nextEnabledIndex = this.items.findIndex((item) => !item.hasAttribute('disabled'));
1722
1719
 
1723
1720
  this.index = index >= 0 ? index : nextEnabledIndex;
1724
-
1725
- if (this.index >= 0) {
1726
- this.items[this.index].tabIndex = 0;
1727
- }
1721
+ this.items[this.index].setAttribute('tabindex', 0);
1728
1722
  }
1729
1723
  }
1730
1724
 
@@ -1738,20 +1732,10 @@ class AuroRadioGroup extends LitElement {
1738
1732
  this.index = this.items.indexOf(event.target);
1739
1733
 
1740
1734
  this.items.forEach((item) => {
1741
- if (item === event.target) {
1742
- item.tabIndex = 0;
1743
- if (event.target.value) {
1744
- this.value = event.target.value;
1745
- }
1746
- } else {
1747
- const sdInput = item.shadowRoot.querySelector('input');
1748
-
1749
- sdInput.checked = false;
1750
- item.checked = false;
1751
- item.tabIndex = -1;
1752
- }
1735
+ item.checked = item === event.target;
1753
1736
  });
1754
1737
 
1738
+ this.value = event.target.value;
1755
1739
  this.optionSelected = event.target;
1756
1740
 
1757
1741
  this.validation.validate(this);
@@ -1764,7 +1748,7 @@ class AuroRadioGroup extends LitElement {
1764
1748
  * @returns {void}
1765
1749
  */
1766
1750
  selectItem(index) {
1767
- const sdItem = this.items[index].shadowRoot.querySelector('input');
1751
+ const sdItem = this.items[index];
1768
1752
 
1769
1753
  sdItem.click();
1770
1754
  sdItem.focus();
@@ -1783,17 +1767,18 @@ class AuroRadioGroup extends LitElement {
1783
1767
 
1784
1768
  for (currIndex; currIndex < this.items.length; moveDirection === "Down" ? currIndex += 1 : currIndex -= 1) {
1785
1769
  currIndex = currIndex === -1 ? this.items.length - 1 : currIndex;
1786
- const sdItem = this.items[currIndex].shadowRoot.querySelector('input');
1787
-
1788
- if (this.disabled || this.items.every((item) => item.disabled === true)) {
1789
- sdItem.focus();
1790
- break;
1791
- }
1792
- if (!sdItem.disabled) {
1793
- sdItem.click();
1794
- sdItem.focus();
1795
- this.index = currIndex;
1796
- break;
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
+ }
1797
1782
  }
1798
1783
  }
1799
1784
  }
@@ -1836,7 +1821,7 @@ class AuroRadioGroup extends LitElement {
1836
1821
  };
1837
1822
 
1838
1823
  return html$1`
1839
- <fieldset class="${classMap(groupClasses)}" part="radio-group">
1824
+ <fieldset class="${classMap(groupClasses)}" part="radio-group" role="radiogroup">
1840
1825
  <legend>
1841
1826
  <slot name="legend"></slot>
1842
1827
  ${this.required ? undefined : html$1`<slot name="optionalLabel"> (optional)</slot>`}
@@ -1846,11 +1831,11 @@ class AuroRadioGroup extends LitElement {
1846
1831
 
1847
1832
  ${!this.validity || this.validity === undefined || this.validity === 'valid'
1848
1833
  ? html$1`
1849
- <${this.helpTextTag} large ?onDark="${this.onDark}" part="helpText">
1834
+ <${this.helpTextTag} ?onDark="${this.onDark}" part="helpText">
1850
1835
  <slot name="helpText"></slot>
1851
1836
  </${this.helpTextTag}>`
1852
1837
  : html$1`
1853
- <${this.helpTextTag} large ?onDark="${this.onDark}" role="alert" error aria-live="assertive" part="helpText">
1838
+ <${this.helpTextTag} ?onDark="${this.onDark}" role="alert" error aria-live="assertive" part="helpText">
1854
1839
  ${this.errorMessage}
1855
1840
  </${this.helpTextTag}>`
1856
1841
  }