@aurodesignsystem/auro-formkit 3.1.0-beta.1 → 3.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -1
- package/components/checkbox/README.md +1 -1
- package/components/checkbox/demo/api.min.js +468 -25
- package/components/checkbox/demo/index.min.js +468 -25
- package/components/checkbox/demo/readme.md +1 -1
- package/components/checkbox/dist/index.js +468 -25
- package/components/checkbox/dist/registered.js +468 -25
- package/components/combobox/README.md +1 -1
- package/components/combobox/demo/api.min.js +1125 -74
- package/components/combobox/demo/index.min.js +1125 -74
- package/components/combobox/demo/readme.md +1 -1
- package/components/combobox/dist/auro-combobox.d.ts +30 -0
- package/components/combobox/dist/index.js +1125 -74
- package/components/combobox/dist/registered.js +1125 -74
- package/components/counter/README.md +1 -1
- package/components/counter/demo/api.min.js +570 -45
- package/components/counter/demo/index.min.js +570 -45
- package/components/counter/demo/readme.md +1 -1
- package/components/counter/dist/index.js +570 -45
- package/components/counter/dist/registered.js +570 -45
- package/components/datepicker/README.md +1 -1
- package/components/datepicker/demo/api.min.js +1073 -70
- package/components/datepicker/demo/index.min.js +1073 -70
- package/components/datepicker/demo/readme.md +1 -1
- package/components/datepicker/dist/index.js +1073 -70
- package/components/datepicker/dist/registered.js +1073 -70
- package/components/dropdown/README.md +1 -1
- package/components/dropdown/demo/api.md +8 -5
- package/components/dropdown/demo/api.min.js +104 -22
- package/components/dropdown/demo/index.min.js +104 -22
- package/components/dropdown/demo/readme.md +1 -1
- package/components/dropdown/dist/auro-dropdown.d.ts +29 -0
- package/components/dropdown/dist/index.js +104 -22
- package/components/dropdown/dist/registered.js +104 -22
- package/components/form/README.md +1 -1
- package/components/form/demo/readme.md +1 -1
- package/components/input/README.md +1 -1
- package/components/input/demo/api.md +4 -1
- package/components/input/demo/api.min.js +503 -25
- package/components/input/demo/index.min.js +503 -25
- package/components/input/demo/readme.md +1 -1
- package/components/input/dist/base-input.d.ts +24 -0
- package/components/input/dist/index.js +503 -25
- package/components/input/dist/registered.js +503 -25
- package/components/menu/README.md +1 -1
- package/components/menu/demo/readme.md +1 -1
- package/components/radio/README.md +1 -1
- package/components/radio/demo/api.min.js +468 -25
- package/components/radio/demo/index.min.js +468 -25
- package/components/radio/demo/readme.md +1 -1
- package/components/radio/dist/index.js +468 -25
- package/components/radio/dist/registered.js +468 -25
- package/components/select/README.md +1 -1
- package/components/select/demo/api.min.js +570 -45
- package/components/select/demo/index.min.js +570 -45
- package/components/select/demo/readme.md +1 -1
- package/components/select/dist/index.js +570 -45
- package/components/select/dist/registered.js +570 -45
- package/package.json +2 -2
|
@@ -107,7 +107,7 @@ The use of any Auro custom element has a dependency on the [Auro Design Tokens](
|
|
|
107
107
|
In cases where the project is not able to process JS assets, there are pre-processed assets available for use. Legacy browsers such as IE11 are no longer supported.
|
|
108
108
|
|
|
109
109
|
```html
|
|
110
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.0
|
|
110
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.1.0/auro-dropdown/+esm"></script>
|
|
111
111
|
```
|
|
112
112
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
113
113
|
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
## Properties
|
|
13
13
|
|
|
14
14
|
| Property | Attribute | Type | Default | Description |
|
|
15
|
-
|-------------------------|-------------------------|-------------|----------------|--------------------------------------------------|
|
|
15
|
+
|-------------------------|-------------------------|-------------|----------------|--------------------------------------------------|
|
|
16
|
+
| `a11yAutocomplete` | | `string` | | The value for the aria-autocomplete attribute of the trigger element. |
|
|
17
|
+
| `a11yRole` | | | | The value for the role attribute of the trigger element. |
|
|
16
18
|
| [autoPlacement](#autoPlacement) | `autoPlacement` | `boolean` | "false" | If declared, bib's position will be automatically calculated where to appear. |
|
|
17
19
|
| [bordered](#bordered) | `bordered` | ` Boolean ` | | If declared, applies a border around the trigger slot. |
|
|
18
20
|
| [chevron](#chevron) | `chevron` | ` Boolean ` | | If declared, the dropdown displays a chevron on the right. |
|
|
@@ -46,10 +48,11 @@
|
|
|
46
48
|
|
|
47
49
|
## Events
|
|
48
50
|
|
|
49
|
-
| Event | Description |
|
|
50
|
-
|
|
51
|
-
| `auroDropdown-
|
|
52
|
-
| `auroDropdown-
|
|
51
|
+
| Event | Type | Description |
|
|
52
|
+
|-----------------------------|--------------------------------------|--------------------------------------------------|
|
|
53
|
+
| `auroDropdown-idAdded` | `Object<key : 'id', value: string>` | Notifies consumers that the unique ID for the dropdown bib has been generated. |
|
|
54
|
+
| `auroDropdown-toggled` | | Notifies that the visibility of the dropdown bib has changed. |
|
|
55
|
+
| `auroDropdown-triggerClick` | | Notifies that the trigger has been clicked. |
|
|
53
56
|
|
|
54
57
|
## Slots
|
|
55
58
|
|
|
@@ -1899,7 +1899,7 @@ class AuroFloatingUI {
|
|
|
1899
1899
|
/**
|
|
1900
1900
|
* @private
|
|
1901
1901
|
* getting called on 'blur' in trigger or `focusin` in document
|
|
1902
|
-
*
|
|
1902
|
+
*
|
|
1903
1903
|
* Hides the bib if focus moves outside of the trigger or bib, unless a 'noHideOnThisFocusLoss' flag is set.
|
|
1904
1904
|
* This method checks if the currently active element is still within the trigger or bib.
|
|
1905
1905
|
* If not, and if the bib isn't in fullscreen mode with focus lost, it hides the bib.
|
|
@@ -2015,7 +2015,7 @@ class AuroFloatingUI {
|
|
|
2015
2015
|
// Close any other dropdown that is already open
|
|
2016
2016
|
const existedVisibleFloatingUI = document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
2017
2017
|
if (existedVisibleFloatingUI && existedVisibleFloatingUI !== this &&
|
|
2018
|
-
existedVisibleFloatingUI.isPopoverVisible &&
|
|
2018
|
+
existedVisibleFloatingUI.element.isPopoverVisible &&
|
|
2019
2019
|
document.expandedAuroFloater.eventPrefix === this.eventPrefix) {
|
|
2020
2020
|
document.expandedAuroFloater.hideBib();
|
|
2021
2021
|
}
|
|
@@ -2191,7 +2191,7 @@ class AuroFloatingUI {
|
|
|
2191
2191
|
this.id = window.crypto.randomUUID();
|
|
2192
2192
|
this.element.setAttribute('id', this.id);
|
|
2193
2193
|
}
|
|
2194
|
-
|
|
2194
|
+
|
|
2195
2195
|
this.element.bib.setAttribute("id", `${this.id}-floater-bib`);
|
|
2196
2196
|
}
|
|
2197
2197
|
|
|
@@ -2244,7 +2244,7 @@ class AuroFloatingUI {
|
|
|
2244
2244
|
if (this.element.bib) {
|
|
2245
2245
|
this.element.shadowRoot.append(this.element.bib);
|
|
2246
2246
|
}
|
|
2247
|
-
|
|
2247
|
+
|
|
2248
2248
|
// Remove event & keyboard listeners
|
|
2249
2249
|
if (this.element?.trigger) {
|
|
2250
2250
|
this.element.trigger.removeEventListener('keydown', this.handleEvent);
|
|
@@ -2994,6 +2994,7 @@ var helpTextVersion = '1.0.0';
|
|
|
2994
2994
|
* @csspart helpText - The helpText content container.
|
|
2995
2995
|
* @event auroDropdown-triggerClick - Notifies that the trigger has been clicked.
|
|
2996
2996
|
* @event auroDropdown-toggled - Notifies that the visibility of the dropdown bib has changed.
|
|
2997
|
+
* @event auroDropdown-idAdded - Notifies consumers that the unique ID for the dropdown bib has been generated.
|
|
2997
2998
|
*/
|
|
2998
2999
|
class AuroDropdown extends r {
|
|
2999
3000
|
constructor() {
|
|
@@ -3039,7 +3040,9 @@ class AuroDropdown extends r {
|
|
|
3039
3040
|
this.rounded = false;
|
|
3040
3041
|
this.tabIndex = 0;
|
|
3041
3042
|
this.noToggle = false;
|
|
3043
|
+
this.a11yAutocomplete = 'none';
|
|
3042
3044
|
this.labeled = true;
|
|
3045
|
+
this.a11yRole = 'combobox';
|
|
3043
3046
|
this.onDark = false;
|
|
3044
3047
|
|
|
3045
3048
|
// floaterConfig
|
|
@@ -3175,6 +3178,16 @@ class AuroDropdown extends r {
|
|
|
3175
3178
|
type: Number
|
|
3176
3179
|
},
|
|
3177
3180
|
|
|
3181
|
+
/**
|
|
3182
|
+
* The unique ID for the dropdown bib element.
|
|
3183
|
+
* @private
|
|
3184
|
+
*/
|
|
3185
|
+
dropdownId: {
|
|
3186
|
+
type: String,
|
|
3187
|
+
reflect: false,
|
|
3188
|
+
attribute: false
|
|
3189
|
+
},
|
|
3190
|
+
|
|
3178
3191
|
/**
|
|
3179
3192
|
* If declared in combination with `bordered` property or `helpText` slot content, will apply red color to both.
|
|
3180
3193
|
*/
|
|
@@ -3342,6 +3355,23 @@ class AuroDropdown extends r {
|
|
|
3342
3355
|
*/
|
|
3343
3356
|
tabIndex: {
|
|
3344
3357
|
type: Number
|
|
3358
|
+
},
|
|
3359
|
+
|
|
3360
|
+
/**
|
|
3361
|
+
* The value for the role attribute of the trigger element.
|
|
3362
|
+
*/
|
|
3363
|
+
a11yRole: {
|
|
3364
|
+
type: String || undefined,
|
|
3365
|
+
attribute: false,
|
|
3366
|
+
reflect: false
|
|
3367
|
+
},
|
|
3368
|
+
|
|
3369
|
+
/**
|
|
3370
|
+
* The value for the aria-autocomplete attribute of the trigger element.
|
|
3371
|
+
*/
|
|
3372
|
+
a11yAutocomplete: {
|
|
3373
|
+
type: String,
|
|
3374
|
+
attribute: false,
|
|
3345
3375
|
}
|
|
3346
3376
|
};
|
|
3347
3377
|
}
|
|
@@ -3403,7 +3433,22 @@ class AuroDropdown extends r {
|
|
|
3403
3433
|
}
|
|
3404
3434
|
|
|
3405
3435
|
firstUpdated() {
|
|
3436
|
+
|
|
3437
|
+
// Configure the floater to, this will generate the ID for the bib
|
|
3406
3438
|
this.floater.configure(this, 'auroDropdown');
|
|
3439
|
+
|
|
3440
|
+
/**
|
|
3441
|
+
* @description Let subscribers know that the dropdown ID ha been generated and added.
|
|
3442
|
+
* @event auroDropdown-idAdded
|
|
3443
|
+
* @type {Object<key: 'id', value: string>} - The ID of the dropdown bib element.
|
|
3444
|
+
*/
|
|
3445
|
+
this.dispatchEvent(new CustomEvent('auroDropdown-idAdded', {detail: {id: this.floater.element.id}}));
|
|
3446
|
+
|
|
3447
|
+
// Set the bib ID locally if the user hasn't provided a focusable trigger
|
|
3448
|
+
if (!this.triggerContentFocusable) {
|
|
3449
|
+
this.dropdownId = this.floater.element.id;
|
|
3450
|
+
}
|
|
3451
|
+
|
|
3407
3452
|
this.bibContent = this.floater.element.bib;
|
|
3408
3453
|
|
|
3409
3454
|
// Add the tag name as an attribute if it is different than the component name
|
|
@@ -3555,6 +3600,30 @@ class AuroDropdown extends r {
|
|
|
3555
3600
|
});
|
|
3556
3601
|
}
|
|
3557
3602
|
|
|
3603
|
+
/*
|
|
3604
|
+
* Sets aria attributes for the trigger element if a custom one is passed in.
|
|
3605
|
+
* @private
|
|
3606
|
+
* @method setTriggerAriaAttributes
|
|
3607
|
+
* @param { HTMLElement } triggerElement - The custom trigger element.
|
|
3608
|
+
*/
|
|
3609
|
+
clearTriggerA11yAttributes(triggerElement) {
|
|
3610
|
+
|
|
3611
|
+
if (!triggerElement || !triggerElement.removeAttribute) {
|
|
3612
|
+
return;
|
|
3613
|
+
}
|
|
3614
|
+
|
|
3615
|
+
// Reset appropriate attributes for a11y
|
|
3616
|
+
triggerElement.removeAttribute('aria-labelledby');
|
|
3617
|
+
if (triggerElement.getAttribute('id') === `${this.id}-trigger-element`) {
|
|
3618
|
+
triggerElement.removeAttribute('id');
|
|
3619
|
+
}
|
|
3620
|
+
triggerElement.removeAttribute('role');
|
|
3621
|
+
triggerElement.removeAttribute('aria-expanded');
|
|
3622
|
+
|
|
3623
|
+
triggerElement.removeAttribute('aria-controls');
|
|
3624
|
+
triggerElement.removeAttribute('aria-autocomplete');
|
|
3625
|
+
}
|
|
3626
|
+
|
|
3558
3627
|
/**
|
|
3559
3628
|
* Handles changes to the trigger content slot and updates related properties.
|
|
3560
3629
|
*
|
|
@@ -3568,32 +3637,41 @@ class AuroDropdown extends r {
|
|
|
3568
3637
|
* @returns {void}
|
|
3569
3638
|
*/
|
|
3570
3639
|
handleTriggerContentSlotChange(event) {
|
|
3640
|
+
|
|
3571
3641
|
this.floater.handleTriggerTabIndex();
|
|
3572
3642
|
|
|
3643
|
+
// Get the trigger
|
|
3644
|
+
const trigger = this.shadowRoot.querySelector('#trigger');
|
|
3645
|
+
|
|
3646
|
+
// Get the trigger slot
|
|
3573
3647
|
const triggerSlot = this.shadowRoot.querySelector('.triggerContent slot');
|
|
3574
3648
|
|
|
3649
|
+
// If there's a trigger slot
|
|
3575
3650
|
if (triggerSlot) {
|
|
3576
3651
|
|
|
3652
|
+
// Get the content nodes to see if there are any children
|
|
3577
3653
|
const triggerContentNodes = triggerSlot.assignedNodes();
|
|
3578
3654
|
|
|
3655
|
+
// If there are children
|
|
3579
3656
|
if (triggerContentNodes) {
|
|
3580
3657
|
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
this.triggerContentFocusable = this.containsFocusableElement(node);
|
|
3584
|
-
}
|
|
3585
|
-
});
|
|
3586
|
-
}
|
|
3587
|
-
}
|
|
3658
|
+
// See if any of them are focusable elemeents
|
|
3659
|
+
this.triggerContentFocusable = triggerContentNodes.some((node) => this.containsFocusableElement(node));
|
|
3588
3660
|
|
|
3589
|
-
|
|
3661
|
+
// If any of them are focusable elements
|
|
3662
|
+
if (this.triggerContentFocusable) {
|
|
3590
3663
|
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3664
|
+
// Assume the consumer will be providing their own a11y in whatever they passed in
|
|
3665
|
+
this.clearTriggerA11yAttributes(trigger);
|
|
3666
|
+
|
|
3667
|
+
// Remove the tabindex from the trigger so it doesn't interrupt focus flow
|
|
3668
|
+
trigger.removeAttribute('tabindex');
|
|
3669
|
+
} else {
|
|
3670
|
+
|
|
3671
|
+
// Add the tabindex to the trigger so that it's in the focus flow
|
|
3672
|
+
trigger.setAttribute('tabindex', '0');
|
|
3673
|
+
}
|
|
3674
|
+
}
|
|
3597
3675
|
}
|
|
3598
3676
|
|
|
3599
3677
|
if (event) {
|
|
@@ -3603,6 +3681,7 @@ class AuroDropdown extends r {
|
|
|
3603
3681
|
|
|
3604
3682
|
if (this.triggerContentSlot) {
|
|
3605
3683
|
this.setupTriggerFocusEventBinding();
|
|
3684
|
+
|
|
3606
3685
|
this.hasTriggerContent = this.triggerContentSlot.some((slot) => {
|
|
3607
3686
|
if (slot.textContent.trim()) {
|
|
3608
3687
|
return true;
|
|
@@ -3670,10 +3749,13 @@ class AuroDropdown extends r {
|
|
|
3670
3749
|
id="trigger"
|
|
3671
3750
|
class="trigger"
|
|
3672
3751
|
part="trigger"
|
|
3673
|
-
aria-labelledby="triggerLabel"
|
|
3674
3752
|
tabindex="${this.tabIndex}"
|
|
3675
3753
|
?showBorder="${this.showTriggerBorders}"
|
|
3676
|
-
|
|
3754
|
+
role="${o(this.triggerContentFocusable ? undefined : this.a11yRole)}"
|
|
3755
|
+
aria-expanded="${o(this.triggerContentFocusable ? undefined : this.isPopoverVisible)}"
|
|
3756
|
+
aria-controls="${o(this.triggerContentFocusable ? undefined : this.dropdownId)}"
|
|
3757
|
+
aria-labelledby="${o(this.triggerContentFocusable ? undefined : 'triggerLabel')}"
|
|
3758
|
+
>
|
|
3677
3759
|
<div class="triggerContentWrapper">
|
|
3678
3760
|
<label class="label" id="triggerLabel" hasTrigger=${this.hasTriggerContent}>
|
|
3679
3761
|
<slot name="label" @slotchange="${this.handleLabelSlotChange}"></slot>
|
|
@@ -3707,12 +3789,12 @@ class AuroDropdown extends r {
|
|
|
3707
3789
|
<div id="bibSizer" part="size"></div>
|
|
3708
3790
|
<${this.dropdownBibTag}
|
|
3709
3791
|
id="bib"
|
|
3710
|
-
role="tooltip"
|
|
3711
3792
|
?data-show="${this.isPopoverVisible}"
|
|
3712
3793
|
?isfullscreen="${this.isBibFullscreen}"
|
|
3713
3794
|
?common="${this.common}"
|
|
3714
3795
|
?rounded="${this.common || this.rounded}"
|
|
3715
|
-
?inset="${this.common || this.inset}"
|
|
3796
|
+
?inset="${this.common || this.inset}"
|
|
3797
|
+
>
|
|
3716
3798
|
</${this.dropdownBibTag}>
|
|
3717
3799
|
</div>
|
|
3718
3800
|
`;
|
|
@@ -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);
|
|
@@ -2969,6 +2969,7 @@ var helpTextVersion = '1.0.0';
|
|
|
2969
2969
|
* @csspart helpText - The helpText content container.
|
|
2970
2970
|
* @event auroDropdown-triggerClick - Notifies that the trigger has been clicked.
|
|
2971
2971
|
* @event auroDropdown-toggled - Notifies that the visibility of the dropdown bib has changed.
|
|
2972
|
+
* @event auroDropdown-idAdded - Notifies consumers that the unique ID for the dropdown bib has been generated.
|
|
2972
2973
|
*/
|
|
2973
2974
|
class AuroDropdown extends r {
|
|
2974
2975
|
constructor() {
|
|
@@ -3014,7 +3015,9 @@ class AuroDropdown extends r {
|
|
|
3014
3015
|
this.rounded = false;
|
|
3015
3016
|
this.tabIndex = 0;
|
|
3016
3017
|
this.noToggle = false;
|
|
3018
|
+
this.a11yAutocomplete = 'none';
|
|
3017
3019
|
this.labeled = true;
|
|
3020
|
+
this.a11yRole = 'combobox';
|
|
3018
3021
|
this.onDark = false;
|
|
3019
3022
|
|
|
3020
3023
|
// floaterConfig
|
|
@@ -3150,6 +3153,16 @@ class AuroDropdown extends r {
|
|
|
3150
3153
|
type: Number
|
|
3151
3154
|
},
|
|
3152
3155
|
|
|
3156
|
+
/**
|
|
3157
|
+
* The unique ID for the dropdown bib element.
|
|
3158
|
+
* @private
|
|
3159
|
+
*/
|
|
3160
|
+
dropdownId: {
|
|
3161
|
+
type: String,
|
|
3162
|
+
reflect: false,
|
|
3163
|
+
attribute: false
|
|
3164
|
+
},
|
|
3165
|
+
|
|
3153
3166
|
/**
|
|
3154
3167
|
* If declared in combination with `bordered` property or `helpText` slot content, will apply red color to both.
|
|
3155
3168
|
*/
|
|
@@ -3317,6 +3330,23 @@ class AuroDropdown extends r {
|
|
|
3317
3330
|
*/
|
|
3318
3331
|
tabIndex: {
|
|
3319
3332
|
type: Number
|
|
3333
|
+
},
|
|
3334
|
+
|
|
3335
|
+
/**
|
|
3336
|
+
* The value for the role attribute of the trigger element.
|
|
3337
|
+
*/
|
|
3338
|
+
a11yRole: {
|
|
3339
|
+
type: String || undefined,
|
|
3340
|
+
attribute: false,
|
|
3341
|
+
reflect: false
|
|
3342
|
+
},
|
|
3343
|
+
|
|
3344
|
+
/**
|
|
3345
|
+
* The value for the aria-autocomplete attribute of the trigger element.
|
|
3346
|
+
*/
|
|
3347
|
+
a11yAutocomplete: {
|
|
3348
|
+
type: String,
|
|
3349
|
+
attribute: false,
|
|
3320
3350
|
}
|
|
3321
3351
|
};
|
|
3322
3352
|
}
|
|
@@ -3378,7 +3408,22 @@ class AuroDropdown extends r {
|
|
|
3378
3408
|
}
|
|
3379
3409
|
|
|
3380
3410
|
firstUpdated() {
|
|
3411
|
+
|
|
3412
|
+
// Configure the floater to, this will generate the ID for the bib
|
|
3381
3413
|
this.floater.configure(this, 'auroDropdown');
|
|
3414
|
+
|
|
3415
|
+
/**
|
|
3416
|
+
* @description Let subscribers know that the dropdown ID ha been generated and added.
|
|
3417
|
+
* @event auroDropdown-idAdded
|
|
3418
|
+
* @type {Object<key: 'id', value: string>} - The ID of the dropdown bib element.
|
|
3419
|
+
*/
|
|
3420
|
+
this.dispatchEvent(new CustomEvent('auroDropdown-idAdded', {detail: {id: this.floater.element.id}}));
|
|
3421
|
+
|
|
3422
|
+
// Set the bib ID locally if the user hasn't provided a focusable trigger
|
|
3423
|
+
if (!this.triggerContentFocusable) {
|
|
3424
|
+
this.dropdownId = this.floater.element.id;
|
|
3425
|
+
}
|
|
3426
|
+
|
|
3382
3427
|
this.bibContent = this.floater.element.bib;
|
|
3383
3428
|
|
|
3384
3429
|
// Add the tag name as an attribute if it is different than the component name
|
|
@@ -3530,6 +3575,30 @@ class AuroDropdown extends r {
|
|
|
3530
3575
|
});
|
|
3531
3576
|
}
|
|
3532
3577
|
|
|
3578
|
+
/*
|
|
3579
|
+
* Sets aria attributes for the trigger element if a custom one is passed in.
|
|
3580
|
+
* @private
|
|
3581
|
+
* @method setTriggerAriaAttributes
|
|
3582
|
+
* @param { HTMLElement } triggerElement - The custom trigger element.
|
|
3583
|
+
*/
|
|
3584
|
+
clearTriggerA11yAttributes(triggerElement) {
|
|
3585
|
+
|
|
3586
|
+
if (!triggerElement || !triggerElement.removeAttribute) {
|
|
3587
|
+
return;
|
|
3588
|
+
}
|
|
3589
|
+
|
|
3590
|
+
// Reset appropriate attributes for a11y
|
|
3591
|
+
triggerElement.removeAttribute('aria-labelledby');
|
|
3592
|
+
if (triggerElement.getAttribute('id') === `${this.id}-trigger-element`) {
|
|
3593
|
+
triggerElement.removeAttribute('id');
|
|
3594
|
+
}
|
|
3595
|
+
triggerElement.removeAttribute('role');
|
|
3596
|
+
triggerElement.removeAttribute('aria-expanded');
|
|
3597
|
+
|
|
3598
|
+
triggerElement.removeAttribute('aria-controls');
|
|
3599
|
+
triggerElement.removeAttribute('aria-autocomplete');
|
|
3600
|
+
}
|
|
3601
|
+
|
|
3533
3602
|
/**
|
|
3534
3603
|
* Handles changes to the trigger content slot and updates related properties.
|
|
3535
3604
|
*
|
|
@@ -3543,32 +3612,41 @@ class AuroDropdown extends r {
|
|
|
3543
3612
|
* @returns {void}
|
|
3544
3613
|
*/
|
|
3545
3614
|
handleTriggerContentSlotChange(event) {
|
|
3615
|
+
|
|
3546
3616
|
this.floater.handleTriggerTabIndex();
|
|
3547
3617
|
|
|
3618
|
+
// Get the trigger
|
|
3619
|
+
const trigger = this.shadowRoot.querySelector('#trigger');
|
|
3620
|
+
|
|
3621
|
+
// Get the trigger slot
|
|
3548
3622
|
const triggerSlot = this.shadowRoot.querySelector('.triggerContent slot');
|
|
3549
3623
|
|
|
3624
|
+
// If there's a trigger slot
|
|
3550
3625
|
if (triggerSlot) {
|
|
3551
3626
|
|
|
3627
|
+
// Get the content nodes to see if there are any children
|
|
3552
3628
|
const triggerContentNodes = triggerSlot.assignedNodes();
|
|
3553
3629
|
|
|
3630
|
+
// If there are children
|
|
3554
3631
|
if (triggerContentNodes) {
|
|
3555
3632
|
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
this.triggerContentFocusable = this.containsFocusableElement(node);
|
|
3559
|
-
}
|
|
3560
|
-
});
|
|
3561
|
-
}
|
|
3562
|
-
}
|
|
3633
|
+
// See if any of them are focusable elemeents
|
|
3634
|
+
this.triggerContentFocusable = triggerContentNodes.some((node) => this.containsFocusableElement(node));
|
|
3563
3635
|
|
|
3564
|
-
|
|
3636
|
+
// If any of them are focusable elements
|
|
3637
|
+
if (this.triggerContentFocusable) {
|
|
3565
3638
|
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3639
|
+
// Assume the consumer will be providing their own a11y in whatever they passed in
|
|
3640
|
+
this.clearTriggerA11yAttributes(trigger);
|
|
3641
|
+
|
|
3642
|
+
// Remove the tabindex from the trigger so it doesn't interrupt focus flow
|
|
3643
|
+
trigger.removeAttribute('tabindex');
|
|
3644
|
+
} else {
|
|
3645
|
+
|
|
3646
|
+
// Add the tabindex to the trigger so that it's in the focus flow
|
|
3647
|
+
trigger.setAttribute('tabindex', '0');
|
|
3648
|
+
}
|
|
3649
|
+
}
|
|
3572
3650
|
}
|
|
3573
3651
|
|
|
3574
3652
|
if (event) {
|
|
@@ -3578,6 +3656,7 @@ class AuroDropdown extends r {
|
|
|
3578
3656
|
|
|
3579
3657
|
if (this.triggerContentSlot) {
|
|
3580
3658
|
this.setupTriggerFocusEventBinding();
|
|
3659
|
+
|
|
3581
3660
|
this.hasTriggerContent = this.triggerContentSlot.some((slot) => {
|
|
3582
3661
|
if (slot.textContent.trim()) {
|
|
3583
3662
|
return true;
|
|
@@ -3645,10 +3724,13 @@ class AuroDropdown extends r {
|
|
|
3645
3724
|
id="trigger"
|
|
3646
3725
|
class="trigger"
|
|
3647
3726
|
part="trigger"
|
|
3648
|
-
aria-labelledby="triggerLabel"
|
|
3649
3727
|
tabindex="${this.tabIndex}"
|
|
3650
3728
|
?showBorder="${this.showTriggerBorders}"
|
|
3651
|
-
|
|
3729
|
+
role="${o(this.triggerContentFocusable ? undefined : this.a11yRole)}"
|
|
3730
|
+
aria-expanded="${o(this.triggerContentFocusable ? undefined : this.isPopoverVisible)}"
|
|
3731
|
+
aria-controls="${o(this.triggerContentFocusable ? undefined : this.dropdownId)}"
|
|
3732
|
+
aria-labelledby="${o(this.triggerContentFocusable ? undefined : 'triggerLabel')}"
|
|
3733
|
+
>
|
|
3652
3734
|
<div class="triggerContentWrapper">
|
|
3653
3735
|
<label class="label" id="triggerLabel" hasTrigger=${this.hasTriggerContent}>
|
|
3654
3736
|
<slot name="label" @slotchange="${this.handleLabelSlotChange}"></slot>
|
|
@@ -3682,12 +3764,12 @@ class AuroDropdown extends r {
|
|
|
3682
3764
|
<div id="bibSizer" part="size"></div>
|
|
3683
3765
|
<${this.dropdownBibTag}
|
|
3684
3766
|
id="bib"
|
|
3685
|
-
role="tooltip"
|
|
3686
3767
|
?data-show="${this.isPopoverVisible}"
|
|
3687
3768
|
?isfullscreen="${this.isBibFullscreen}"
|
|
3688
3769
|
?common="${this.common}"
|
|
3689
3770
|
?rounded="${this.common || this.rounded}"
|
|
3690
|
-
?inset="${this.common || this.inset}"
|
|
3771
|
+
?inset="${this.common || this.inset}"
|
|
3772
|
+
>
|
|
3691
3773
|
</${this.dropdownBibTag}>
|
|
3692
3774
|
</div>
|
|
3693
3775
|
`;
|
|
@@ -107,7 +107,7 @@ The use of any Auro custom element has a dependency on the [Auro Design Tokens](
|
|
|
107
107
|
In cases where the project is not able to process JS assets, there are pre-processed assets available for use. Legacy browsers such as IE11 are no longer supported.
|
|
108
108
|
|
|
109
109
|
```html
|
|
110
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.0
|
|
110
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.1.0/auro-dropdown/+esm"></script>
|
|
111
111
|
```
|
|
112
112
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
113
113
|
|
|
@@ -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
|
*/
|
|
@@ -204,6 +214,21 @@ export class AuroDropdown extends LitElement {
|
|
|
204
214
|
tabIndex: {
|
|
205
215
|
type: NumberConstructor;
|
|
206
216
|
};
|
|
217
|
+
/**
|
|
218
|
+
* The value for the role attribute of the trigger element.
|
|
219
|
+
*/
|
|
220
|
+
a11yRole: {
|
|
221
|
+
type: StringConstructor;
|
|
222
|
+
attribute: boolean;
|
|
223
|
+
reflect: boolean;
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* The value for the aria-autocomplete attribute of the trigger element.
|
|
227
|
+
*/
|
|
228
|
+
a11yAutocomplete: {
|
|
229
|
+
type: StringConstructor;
|
|
230
|
+
attribute: boolean;
|
|
231
|
+
};
|
|
207
232
|
};
|
|
208
233
|
static get styles(): import("lit").CSSResult[];
|
|
209
234
|
/**
|
|
@@ -239,7 +264,9 @@ export class AuroDropdown extends LitElement {
|
|
|
239
264
|
inset: boolean;
|
|
240
265
|
rounded: boolean;
|
|
241
266
|
noToggle: boolean;
|
|
267
|
+
a11yAutocomplete: string;
|
|
242
268
|
labeled: boolean;
|
|
269
|
+
a11yRole: string;
|
|
243
270
|
onDark: boolean;
|
|
244
271
|
placement: string;
|
|
245
272
|
offset: number;
|
|
@@ -306,6 +333,7 @@ export class AuroDropdown extends LitElement {
|
|
|
306
333
|
private get focusableEntityQuery();
|
|
307
334
|
updated(changedProperties: any): void;
|
|
308
335
|
firstUpdated(): void;
|
|
336
|
+
dropdownId: any;
|
|
309
337
|
bibContent: any;
|
|
310
338
|
/**
|
|
311
339
|
* Exposes CSS parts for styling from parent components.
|
|
@@ -338,6 +366,7 @@ export class AuroDropdown extends LitElement {
|
|
|
338
366
|
* @returns {void}
|
|
339
367
|
*/
|
|
340
368
|
private clearTriggerFocusEventBinding;
|
|
369
|
+
clearTriggerA11yAttributes(triggerElement: any): void;
|
|
341
370
|
/**
|
|
342
371
|
* Handles changes to the trigger content slot and updates related properties.
|
|
343
372
|
*
|