@aurodesignsystem/auro-formkit 3.1.0-beta.1 → 3.1.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 (49) hide show
  1. package/CHANGELOG.md +9 -3
  2. package/components/checkbox/demo/api.min.js +468 -25
  3. package/components/checkbox/demo/index.min.js +468 -25
  4. package/components/checkbox/dist/index.js +468 -25
  5. package/components/checkbox/dist/registered.js +468 -25
  6. package/components/combobox/demo/api.md +1 -1
  7. package/components/combobox/demo/api.min.js +1265 -235
  8. package/components/combobox/demo/index.min.js +1265 -235
  9. package/components/combobox/dist/auro-combobox.d.ts +32 -5
  10. package/components/combobox/dist/index.js +1130 -100
  11. package/components/combobox/dist/registered.js +1130 -100
  12. package/components/counter/demo/api.md +1 -1
  13. package/components/counter/demo/api.min.js +575 -71
  14. package/components/counter/demo/index.min.js +575 -71
  15. package/components/counter/dist/auro-counter-group.d.ts +2 -5
  16. package/components/counter/dist/index.js +575 -71
  17. package/components/counter/dist/registered.js +575 -71
  18. package/components/datepicker/demo/api.md +0 -1
  19. package/components/datepicker/demo/api.min.js +1077 -106
  20. package/components/datepicker/demo/index.min.js +1077 -106
  21. package/components/datepicker/dist/auro-datepicker.d.ts +0 -13
  22. package/components/datepicker/dist/index.js +1077 -106
  23. package/components/datepicker/dist/registered.js +1077 -106
  24. package/components/dropdown/demo/api.md +9 -6
  25. package/components/dropdown/demo/api.min.js +107 -43
  26. package/components/dropdown/demo/index.md +0 -83
  27. package/components/dropdown/demo/index.min.js +107 -43
  28. package/components/dropdown/dist/auro-dropdown.d.ts +30 -12
  29. package/components/dropdown/dist/index.js +107 -43
  30. package/components/dropdown/dist/registered.js +107 -43
  31. package/components/input/demo/api.md +4 -1
  32. package/components/input/demo/api.min.js +503 -25
  33. package/components/input/demo/index.min.js +503 -25
  34. package/components/input/dist/base-input.d.ts +24 -0
  35. package/components/input/dist/index.js +503 -25
  36. package/components/input/dist/registered.js +503 -25
  37. package/components/radio/demo/api.min.js +468 -25
  38. package/components/radio/demo/index.min.js +468 -25
  39. package/components/radio/dist/index.js +468 -25
  40. package/components/radio/dist/registered.js +468 -25
  41. package/components/select/demo/api.md +1 -1
  42. package/components/select/demo/api.min.js +575 -71
  43. package/components/select/demo/index.md +1 -46
  44. package/components/select/demo/index.min.js +575 -71
  45. package/components/select/dist/auro-select.d.ts +2 -5
  46. package/components/select/dist/index.js +575 -71
  47. package/components/select/dist/registered.js +575 -71
  48. package/package.json +2 -2
  49. package/components/form/demo/autocomplete.html +0 -15
@@ -1874,7 +1874,7 @@ class AuroFloatingUI {
1874
1874
  /**
1875
1875
  * @private
1876
1876
  * getting called on 'blur' in trigger or `focusin` in document
1877
- *
1877
+ *
1878
1878
  * Hides the bib if focus moves outside of the trigger or bib, unless a 'noHideOnThisFocusLoss' flag is set.
1879
1879
  * This method checks if the currently active element is still within the trigger or bib.
1880
1880
  * If not, and if the bib isn't in fullscreen mode with focus lost, it hides the bib.
@@ -1990,7 +1990,7 @@ class AuroFloatingUI {
1990
1990
  // Close any other dropdown that is already open
1991
1991
  const existedVisibleFloatingUI = document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
1992
1992
  if (existedVisibleFloatingUI && existedVisibleFloatingUI !== this &&
1993
- existedVisibleFloatingUI.isPopoverVisible &&
1993
+ existedVisibleFloatingUI.element.isPopoverVisible &&
1994
1994
  document.expandedAuroFloater.eventPrefix === this.eventPrefix) {
1995
1995
  document.expandedAuroFloater.hideBib();
1996
1996
  }
@@ -2166,7 +2166,7 @@ class AuroFloatingUI {
2166
2166
  this.id = window.crypto.randomUUID();
2167
2167
  this.element.setAttribute('id', this.id);
2168
2168
  }
2169
-
2169
+
2170
2170
  this.element.bib.setAttribute("id", `${this.id}-floater-bib`);
2171
2171
  }
2172
2172
 
@@ -2219,7 +2219,7 @@ class AuroFloatingUI {
2219
2219
  if (this.element.bib) {
2220
2220
  this.element.shadowRoot.append(this.element.bib);
2221
2221
  }
2222
-
2222
+
2223
2223
  // Remove event & keyboard listeners
2224
2224
  if (this.element?.trigger) {
2225
2225
  this.element.trigger.removeEventListener('keydown', this.handleEvent);
@@ -2628,7 +2628,6 @@ var tokensCss$1 = i$3`:host{--ds-auro-dropdown-label-text-color: var(--ds-basic-
2628
2628
 
2629
2629
  const DESIGN_TOKEN_BREAKPOINT_PREFIX = '--ds-grid-breakpoint-';
2630
2630
  const DESIGN_TOKEN_BREAKPOINT_OPTIONS = [
2631
- 'xl',
2632
2631
  'lg',
2633
2632
  'md',
2634
2633
  'sm',
@@ -2700,7 +2699,6 @@ class AuroDropdownBib extends r {
2700
2699
 
2701
2700
  set mobileFullscreenBreakpoint(value) {
2702
2701
  // verify the defined breakpoint is valid and exit out if not
2703
- // 'disabled' is a design token breakpoint so it acts as our "undefined" value
2704
2702
  const validatedValue = DESIGN_TOKEN_BREAKPOINT_OPTIONS.includes(value) ? value : undefined;
2705
2703
  if (!validatedValue) {
2706
2704
  this._mobileBreakpointValue = undefined;
@@ -2969,6 +2967,7 @@ var helpTextVersion = '1.0.0';
2969
2967
  * @csspart helpText - The helpText content container.
2970
2968
  * @event auroDropdown-triggerClick - Notifies that the trigger has been clicked.
2971
2969
  * @event auroDropdown-toggled - Notifies that the visibility of the dropdown bib has changed.
2970
+ * @event auroDropdown-idAdded - Notifies consumers that the unique ID for the dropdown bib has been generated.
2972
2971
  */
2973
2972
  class AuroDropdown extends r {
2974
2973
  constructor() {
@@ -3014,7 +3013,9 @@ class AuroDropdown extends r {
3014
3013
  this.rounded = false;
3015
3014
  this.tabIndex = 0;
3016
3015
  this.noToggle = false;
3016
+ this.a11yAutocomplete = 'none';
3017
3017
  this.labeled = true;
3018
+ this.a11yRole = 'combobox';
3018
3019
  this.onDark = false;
3019
3020
 
3020
3021
  // floaterConfig
@@ -3150,6 +3151,16 @@ class AuroDropdown extends r {
3150
3151
  type: Number
3151
3152
  },
3152
3153
 
3154
+ /**
3155
+ * The unique ID for the dropdown bib element.
3156
+ * @private
3157
+ */
3158
+ dropdownId: {
3159
+ type: String,
3160
+ reflect: false,
3161
+ attribute: false
3162
+ },
3163
+
3153
3164
  /**
3154
3165
  * If declared in combination with `bordered` property or `helpText` slot content, will apply red color to both.
3155
3166
  */
@@ -3213,12 +3224,7 @@ class AuroDropdown extends r {
3213
3224
  },
3214
3225
 
3215
3226
  /**
3216
- * Defines the screen size breakpoint (`xs`, `sm`, `md`, `lg`, `xl`, `disabled`)
3217
- * at which the dropdown switches to fullscreen mode on mobile. `disabled` indicates a dropdown should _never_ enter fullscreen.
3218
- *
3219
- * When expanded, the dropdown will automatically display in fullscreen mode
3220
- * if the screen size is equal to or smaller than the selected breakpoint.
3221
- * @default sm
3227
+ * Defines the screen size breakpoint (`lg`, `md`, `sm`, or `xs`) at which the dropdown switches to fullscreen mode on mobile. When expanded, the dropdown will automatically display in fullscreen mode if the screen size is equal to or smaller than the selected breakpoint.
3222
3228
  */
3223
3229
  fullscreenBreakpoint: {
3224
3230
  type: String,
@@ -3317,6 +3323,23 @@ class AuroDropdown extends r {
3317
3323
  */
3318
3324
  tabIndex: {
3319
3325
  type: Number
3326
+ },
3327
+
3328
+ /**
3329
+ * The value for the role attribute of the trigger element.
3330
+ */
3331
+ a11yRole: {
3332
+ type: String || undefined,
3333
+ attribute: false,
3334
+ reflect: false
3335
+ },
3336
+
3337
+ /**
3338
+ * The value for the aria-autocomplete attribute of the trigger element.
3339
+ */
3340
+ a11yAutocomplete: {
3341
+ type: String,
3342
+ attribute: false,
3320
3343
  }
3321
3344
  };
3322
3345
  }
@@ -3341,15 +3364,6 @@ class AuroDropdown extends r {
3341
3364
  AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroDropdown);
3342
3365
  }
3343
3366
 
3344
- /**
3345
- * Accessor for reusing the focusable entity query string.
3346
- * @private
3347
- * @returns {string}
3348
- */
3349
- get focusableEntityQuery () {
3350
- return 'auro-input, [auro-input], auro-button, [auro-button], button, input';
3351
- }
3352
-
3353
3367
  connectedCallback() {
3354
3368
  super.connectedCallback();
3355
3369
  }
@@ -3363,8 +3377,6 @@ class AuroDropdown extends r {
3363
3377
  updated(changedProperties) {
3364
3378
  this.floater.handleUpdate(changedProperties);
3365
3379
 
3366
- // Note: `disabled` is not a breakpoint (it is not a screen size),
3367
- // so it looks like we never consume this - however, dropdownBib handles this in the setter as "undefined"
3368
3380
  if (changedProperties.has('fullscreenBreakpoint')) {
3369
3381
  this.bibContent.mobileFullscreenBreakpoint = this.fullscreenBreakpoint;
3370
3382
  }
@@ -3378,7 +3390,22 @@ class AuroDropdown extends r {
3378
3390
  }
3379
3391
 
3380
3392
  firstUpdated() {
3393
+
3394
+ // Configure the floater to, this will generate the ID for the bib
3381
3395
  this.floater.configure(this, 'auroDropdown');
3396
+
3397
+ /**
3398
+ * @description Let subscribers know that the dropdown ID ha been generated and added.
3399
+ * @event auroDropdown-idAdded
3400
+ * @type {Object<key: 'id', value: string>} - The ID of the dropdown bib element.
3401
+ */
3402
+ this.dispatchEvent(new CustomEvent('auroDropdown-idAdded', {detail: {id: this.floater.element.id}}));
3403
+
3404
+ // Set the bib ID locally if the user hasn't provided a focusable trigger
3405
+ if (!this.triggerContentFocusable) {
3406
+ this.dropdownId = this.floater.element.id;
3407
+ }
3408
+
3382
3409
  this.bibContent = this.floater.element.bib;
3383
3410
 
3384
3411
  // Add the tag name as an attribute if it is different than the component name
@@ -3500,7 +3527,7 @@ class AuroDropdown extends r {
3500
3527
 
3501
3528
  this.triggerContentSlot.forEach((node) => {
3502
3529
  if (node.querySelectorAll) {
3503
- const auroElements = node.querySelectorAll(this.focusableEntityQuery);
3530
+ const auroElements = node.querySelectorAll('auro-input, [auro-input], auro-button, [auro-button], button, input');
3504
3531
  auroElements.forEach((auroEl) => {
3505
3532
  auroEl.addEventListener('focus', this.bindFocusEventToTrigger);
3506
3533
  auroEl.addEventListener('blur', this.bindFocusEventToTrigger);
@@ -3521,7 +3548,7 @@ class AuroDropdown extends r {
3521
3548
 
3522
3549
  this.triggerContentSlot.forEach((node) => {
3523
3550
  if (node.querySelectorAll) {
3524
- const auroElements = node.querySelectorAll(this.focusableEntityQuery);
3551
+ const auroElements = node.querySelectorAll('auro-input, [auro-input], auro-button, [auro-button], button, input');
3525
3552
  auroElements.forEach((auroEl) => {
3526
3553
  auroEl.removeEventListener('focus', this.bindFocusEventToTrigger);
3527
3554
  auroEl.removeEventListener('blur', this.bindFocusEventToTrigger);
@@ -3530,6 +3557,30 @@ class AuroDropdown extends r {
3530
3557
  });
3531
3558
  }
3532
3559
 
3560
+ /*
3561
+ * Sets aria attributes for the trigger element if a custom one is passed in.
3562
+ * @private
3563
+ * @method setTriggerAriaAttributes
3564
+ * @param { HTMLElement } triggerElement - The custom trigger element.
3565
+ */
3566
+ clearTriggerA11yAttributes(triggerElement) {
3567
+
3568
+ if (!triggerElement || !triggerElement.removeAttribute) {
3569
+ return;
3570
+ }
3571
+
3572
+ // Reset appropriate attributes for a11y
3573
+ triggerElement.removeAttribute('aria-labelledby');
3574
+ if (triggerElement.getAttribute('id') === `${this.id}-trigger-element`) {
3575
+ triggerElement.removeAttribute('id');
3576
+ }
3577
+ triggerElement.removeAttribute('role');
3578
+ triggerElement.removeAttribute('aria-expanded');
3579
+
3580
+ triggerElement.removeAttribute('aria-controls');
3581
+ triggerElement.removeAttribute('aria-autocomplete');
3582
+ }
3583
+
3533
3584
  /**
3534
3585
  * Handles changes to the trigger content slot and updates related properties.
3535
3586
  *
@@ -3543,32 +3594,41 @@ class AuroDropdown extends r {
3543
3594
  * @returns {void}
3544
3595
  */
3545
3596
  handleTriggerContentSlotChange(event) {
3597
+
3546
3598
  this.floater.handleTriggerTabIndex();
3547
3599
 
3600
+ // Get the trigger
3601
+ const trigger = this.shadowRoot.querySelector('#trigger');
3602
+
3603
+ // Get the trigger slot
3548
3604
  const triggerSlot = this.shadowRoot.querySelector('.triggerContent slot');
3549
3605
 
3606
+ // If there's a trigger slot
3550
3607
  if (triggerSlot) {
3551
3608
 
3609
+ // Get the content nodes to see if there are any children
3552
3610
  const triggerContentNodes = triggerSlot.assignedNodes();
3553
3611
 
3612
+ // If there are children
3554
3613
  if (triggerContentNodes) {
3555
3614
 
3556
- triggerContentNodes.forEach((node) => {
3557
- if (!this.triggerContentFocusable) {
3558
- this.triggerContentFocusable = this.containsFocusableElement(node);
3559
- }
3560
- });
3561
- }
3562
- }
3615
+ // See if any of them are focusable elemeents
3616
+ this.triggerContentFocusable = triggerContentNodes.some((node) => this.containsFocusableElement(node));
3563
3617
 
3564
- const trigger = this.shadowRoot.querySelector('#trigger');
3618
+ // If any of them are focusable elements
3619
+ if (this.triggerContentFocusable) {
3565
3620
 
3566
- if (!this.triggerContentFocusable) {
3567
- trigger.setAttribute('tabindex', '0');
3568
- trigger.setAttribute('role', 'button');
3569
- } else {
3570
- trigger.removeAttribute('tabindex');
3571
- trigger.removeAttribute('role');
3621
+ // Assume the consumer will be providing their own a11y in whatever they passed in
3622
+ this.clearTriggerA11yAttributes(trigger);
3623
+
3624
+ // Remove the tabindex from the trigger so it doesn't interrupt focus flow
3625
+ trigger.removeAttribute('tabindex');
3626
+ } else {
3627
+
3628
+ // Add the tabindex to the trigger so that it's in the focus flow
3629
+ trigger.setAttribute('tabindex', '0');
3630
+ }
3631
+ }
3572
3632
  }
3573
3633
 
3574
3634
  if (event) {
@@ -3578,6 +3638,7 @@ class AuroDropdown extends r {
3578
3638
 
3579
3639
  if (this.triggerContentSlot) {
3580
3640
  this.setupTriggerFocusEventBinding();
3641
+
3581
3642
  this.hasTriggerContent = this.triggerContentSlot.some((slot) => {
3582
3643
  if (slot.textContent.trim()) {
3583
3644
  return true;
@@ -3645,10 +3706,13 @@ class AuroDropdown extends r {
3645
3706
  id="trigger"
3646
3707
  class="trigger"
3647
3708
  part="trigger"
3648
- aria-labelledby="triggerLabel"
3649
3709
  tabindex="${this.tabIndex}"
3650
3710
  ?showBorder="${this.showTriggerBorders}"
3651
- >
3711
+ role="${o(this.triggerContentFocusable ? undefined : this.a11yRole)}"
3712
+ aria-expanded="${o(this.triggerContentFocusable ? undefined : this.isPopoverVisible)}"
3713
+ aria-controls="${o(this.triggerContentFocusable ? undefined : this.dropdownId)}"
3714
+ aria-labelledby="${o(this.triggerContentFocusable ? undefined : 'triggerLabel')}"
3715
+ >
3652
3716
  <div class="triggerContentWrapper">
3653
3717
  <label class="label" id="triggerLabel" hasTrigger=${this.hasTriggerContent}>
3654
3718
  <slot name="label" @slotchange="${this.handleLabelSlotChange}"></slot>
@@ -3682,12 +3746,12 @@ class AuroDropdown extends r {
3682
3746
  <div id="bibSizer" part="size"></div>
3683
3747
  <${this.dropdownBibTag}
3684
3748
  id="bib"
3685
- role="tooltip"
3686
3749
  ?data-show="${this.isPopoverVisible}"
3687
3750
  ?isfullscreen="${this.isBibFullscreen}"
3688
3751
  ?common="${this.common}"
3689
3752
  ?rounded="${this.common || this.rounded}"
3690
- ?inset="${this.common || this.inset}">
3753
+ ?inset="${this.common || this.inset}"
3754
+ >
3691
3755
  </${this.dropdownBibTag}>
3692
3756
  </div>
3693
3757
  `;
@@ -9,6 +9,7 @@
9
9
  * @csspart helpText - The helpText content container.
10
10
  * @event auroDropdown-triggerClick - Notifies that the trigger has been clicked.
11
11
  * @event auroDropdown-toggled - Notifies that the visibility of the dropdown bib has changed.
12
+ * @event auroDropdown-idAdded - Notifies consumers that the unique ID for the dropdown bib has been generated.
12
13
  */
13
14
  export class AuroDropdown extends LitElement {
14
15
  static get properties(): {
@@ -55,6 +56,15 @@ export class AuroDropdown extends LitElement {
55
56
  dropdownWidth: {
56
57
  type: NumberConstructor;
57
58
  };
59
+ /**
60
+ * The unique ID for the dropdown bib element.
61
+ * @private
62
+ */
63
+ dropdownId: {
64
+ type: StringConstructor;
65
+ reflect: boolean;
66
+ attribute: boolean;
67
+ };
58
68
  /**
59
69
  * If declared in combination with `bordered` property or `helpText` slot content, will apply red color to both.
60
70
  */
@@ -110,12 +120,7 @@ export class AuroDropdown extends LitElement {
110
120
  type: BooleanConstructor;
111
121
  };
112
122
  /**
113
- * Defines the screen size breakpoint (`xs`, `sm`, `md`, `lg`, `xl`, `disabled`)
114
- * at which the dropdown switches to fullscreen mode on mobile. `disabled` indicates a dropdown should _never_ enter fullscreen.
115
- *
116
- * When expanded, the dropdown will automatically display in fullscreen mode
117
- * if the screen size is equal to or smaller than the selected breakpoint.
118
- * @default sm
123
+ * Defines the screen size breakpoint (`lg`, `md`, `sm`, or `xs`) at which the dropdown switches to fullscreen mode on mobile. When expanded, the dropdown will automatically display in fullscreen mode if the screen size is equal to or smaller than the selected breakpoint.
119
124
  */
120
125
  fullscreenBreakpoint: {
121
126
  type: StringConstructor;
@@ -204,6 +209,21 @@ export class AuroDropdown extends LitElement {
204
209
  tabIndex: {
205
210
  type: NumberConstructor;
206
211
  };
212
+ /**
213
+ * The value for the role attribute of the trigger element.
214
+ */
215
+ a11yRole: {
216
+ type: StringConstructor;
217
+ attribute: boolean;
218
+ reflect: boolean;
219
+ };
220
+ /**
221
+ * The value for the aria-autocomplete attribute of the trigger element.
222
+ */
223
+ a11yAutocomplete: {
224
+ type: StringConstructor;
225
+ attribute: boolean;
226
+ };
207
227
  };
208
228
  static get styles(): import("lit").CSSResult[];
209
229
  /**
@@ -239,7 +259,9 @@ export class AuroDropdown extends LitElement {
239
259
  inset: boolean;
240
260
  rounded: boolean;
241
261
  noToggle: boolean;
262
+ a11yAutocomplete: string;
242
263
  labeled: boolean;
264
+ a11yRole: string;
243
265
  onDark: boolean;
244
266
  placement: string;
245
267
  offset: number;
@@ -298,14 +320,9 @@ export class AuroDropdown extends LitElement {
298
320
  * @returns {void}
299
321
  */
300
322
  show(): void;
301
- /**
302
- * Accessor for reusing the focusable entity query string.
303
- * @private
304
- * @returns {string}
305
- */
306
- private get focusableEntityQuery();
307
323
  updated(changedProperties: any): void;
308
324
  firstUpdated(): void;
325
+ dropdownId: any;
309
326
  bibContent: any;
310
327
  /**
311
328
  * Exposes CSS parts for styling from parent components.
@@ -338,6 +355,7 @@ export class AuroDropdown extends LitElement {
338
355
  * @returns {void}
339
356
  */
340
357
  private clearTriggerFocusEventBinding;
358
+ clearTriggerA11yAttributes(triggerElement: any): void;
341
359
  /**
342
360
  * Handles changes to the trigger content slot and updates related properties.
343
361
  *