@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.
- package/CHANGELOG.md +9 -3
- package/components/checkbox/demo/api.min.js +468 -25
- package/components/checkbox/demo/index.min.js +468 -25
- package/components/checkbox/dist/index.js +468 -25
- package/components/checkbox/dist/registered.js +468 -25
- package/components/combobox/demo/api.md +1 -1
- package/components/combobox/demo/api.min.js +1265 -235
- package/components/combobox/demo/index.min.js +1265 -235
- package/components/combobox/dist/auro-combobox.d.ts +32 -5
- package/components/combobox/dist/index.js +1130 -100
- package/components/combobox/dist/registered.js +1130 -100
- package/components/counter/demo/api.md +1 -1
- package/components/counter/demo/api.min.js +575 -71
- package/components/counter/demo/index.min.js +575 -71
- package/components/counter/dist/auro-counter-group.d.ts +2 -5
- package/components/counter/dist/index.js +575 -71
- package/components/counter/dist/registered.js +575 -71
- package/components/datepicker/demo/api.md +0 -1
- package/components/datepicker/demo/api.min.js +1077 -106
- package/components/datepicker/demo/index.min.js +1077 -106
- package/components/datepicker/dist/auro-datepicker.d.ts +0 -13
- package/components/datepicker/dist/index.js +1077 -106
- package/components/datepicker/dist/registered.js +1077 -106
- package/components/dropdown/demo/api.md +9 -6
- package/components/dropdown/demo/api.min.js +107 -43
- package/components/dropdown/demo/index.md +0 -83
- package/components/dropdown/demo/index.min.js +107 -43
- package/components/dropdown/dist/auro-dropdown.d.ts +30 -12
- package/components/dropdown/dist/index.js +107 -43
- package/components/dropdown/dist/registered.js +107 -43
- 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/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/radio/demo/api.min.js +468 -25
- package/components/radio/demo/index.min.js +468 -25
- package/components/radio/dist/index.js +468 -25
- package/components/radio/dist/registered.js +468 -25
- package/components/select/demo/api.md +1 -1
- package/components/select/demo/api.min.js +575 -71
- package/components/select/demo/index.md +1 -46
- package/components/select/demo/index.min.js +575 -71
- package/components/select/dist/auro-select.d.ts +2 -5
- package/components/select/dist/index.js +575 -71
- package/components/select/dist/registered.js +575 -71
- package/package.json +2 -2
- package/components/form/demo/autocomplete.html +0 -15
|
@@ -1846,7 +1846,7 @@ class AuroFloatingUI {
|
|
|
1846
1846
|
/**
|
|
1847
1847
|
* @private
|
|
1848
1848
|
* getting called on 'blur' in trigger or `focusin` in document
|
|
1849
|
-
*
|
|
1849
|
+
*
|
|
1850
1850
|
* Hides the bib if focus moves outside of the trigger or bib, unless a 'noHideOnThisFocusLoss' flag is set.
|
|
1851
1851
|
* This method checks if the currently active element is still within the trigger or bib.
|
|
1852
1852
|
* If not, and if the bib isn't in fullscreen mode with focus lost, it hides the bib.
|
|
@@ -1962,7 +1962,7 @@ class AuroFloatingUI {
|
|
|
1962
1962
|
// Close any other dropdown that is already open
|
|
1963
1963
|
const existedVisibleFloatingUI = document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
1964
1964
|
if (existedVisibleFloatingUI && existedVisibleFloatingUI !== this &&
|
|
1965
|
-
existedVisibleFloatingUI.isPopoverVisible &&
|
|
1965
|
+
existedVisibleFloatingUI.element.isPopoverVisible &&
|
|
1966
1966
|
document.expandedAuroFloater.eventPrefix === this.eventPrefix) {
|
|
1967
1967
|
document.expandedAuroFloater.hideBib();
|
|
1968
1968
|
}
|
|
@@ -2138,7 +2138,7 @@ class AuroFloatingUI {
|
|
|
2138
2138
|
this.id = window.crypto.randomUUID();
|
|
2139
2139
|
this.element.setAttribute('id', this.id);
|
|
2140
2140
|
}
|
|
2141
|
-
|
|
2141
|
+
|
|
2142
2142
|
this.element.bib.setAttribute("id", `${this.id}-floater-bib`);
|
|
2143
2143
|
}
|
|
2144
2144
|
|
|
@@ -2191,7 +2191,7 @@ class AuroFloatingUI {
|
|
|
2191
2191
|
if (this.element.bib) {
|
|
2192
2192
|
this.element.shadowRoot.append(this.element.bib);
|
|
2193
2193
|
}
|
|
2194
|
-
|
|
2194
|
+
|
|
2195
2195
|
// Remove event & keyboard listeners
|
|
2196
2196
|
if (this.element?.trigger) {
|
|
2197
2197
|
this.element.trigger.removeEventListener('keydown', this.handleEvent);
|
|
@@ -2581,7 +2581,6 @@ var tokensCss$1 = css`:host{--ds-auro-dropdown-label-text-color: var(--ds-basic-
|
|
|
2581
2581
|
|
|
2582
2582
|
const DESIGN_TOKEN_BREAKPOINT_PREFIX = '--ds-grid-breakpoint-';
|
|
2583
2583
|
const DESIGN_TOKEN_BREAKPOINT_OPTIONS = [
|
|
2584
|
-
'xl',
|
|
2585
2584
|
'lg',
|
|
2586
2585
|
'md',
|
|
2587
2586
|
'sm',
|
|
@@ -2653,7 +2652,6 @@ class AuroDropdownBib extends LitElement {
|
|
|
2653
2652
|
|
|
2654
2653
|
set mobileFullscreenBreakpoint(value) {
|
|
2655
2654
|
// verify the defined breakpoint is valid and exit out if not
|
|
2656
|
-
// 'disabled' is a design token breakpoint so it acts as our "undefined" value
|
|
2657
2655
|
const validatedValue = DESIGN_TOKEN_BREAKPOINT_OPTIONS.includes(value) ? value : undefined;
|
|
2658
2656
|
if (!validatedValue) {
|
|
2659
2657
|
this._mobileBreakpointValue = undefined;
|
|
@@ -2922,6 +2920,7 @@ var helpTextVersion = '1.0.0';
|
|
|
2922
2920
|
* @csspart helpText - The helpText content container.
|
|
2923
2921
|
* @event auroDropdown-triggerClick - Notifies that the trigger has been clicked.
|
|
2924
2922
|
* @event auroDropdown-toggled - Notifies that the visibility of the dropdown bib has changed.
|
|
2923
|
+
* @event auroDropdown-idAdded - Notifies consumers that the unique ID for the dropdown bib has been generated.
|
|
2925
2924
|
*/
|
|
2926
2925
|
class AuroDropdown extends LitElement {
|
|
2927
2926
|
constructor() {
|
|
@@ -2967,7 +2966,9 @@ class AuroDropdown extends LitElement {
|
|
|
2967
2966
|
this.rounded = false;
|
|
2968
2967
|
this.tabIndex = 0;
|
|
2969
2968
|
this.noToggle = false;
|
|
2969
|
+
this.a11yAutocomplete = 'none';
|
|
2970
2970
|
this.labeled = true;
|
|
2971
|
+
this.a11yRole = 'combobox';
|
|
2971
2972
|
this.onDark = false;
|
|
2972
2973
|
|
|
2973
2974
|
// floaterConfig
|
|
@@ -3103,6 +3104,16 @@ class AuroDropdown extends LitElement {
|
|
|
3103
3104
|
type: Number
|
|
3104
3105
|
},
|
|
3105
3106
|
|
|
3107
|
+
/**
|
|
3108
|
+
* The unique ID for the dropdown bib element.
|
|
3109
|
+
* @private
|
|
3110
|
+
*/
|
|
3111
|
+
dropdownId: {
|
|
3112
|
+
type: String,
|
|
3113
|
+
reflect: false,
|
|
3114
|
+
attribute: false
|
|
3115
|
+
},
|
|
3116
|
+
|
|
3106
3117
|
/**
|
|
3107
3118
|
* If declared in combination with `bordered` property or `helpText` slot content, will apply red color to both.
|
|
3108
3119
|
*/
|
|
@@ -3166,12 +3177,7 @@ class AuroDropdown extends LitElement {
|
|
|
3166
3177
|
},
|
|
3167
3178
|
|
|
3168
3179
|
/**
|
|
3169
|
-
* Defines the screen size breakpoint (`
|
|
3170
|
-
* at which the dropdown switches to fullscreen mode on mobile. `disabled` indicates a dropdown should _never_ enter fullscreen.
|
|
3171
|
-
*
|
|
3172
|
-
* When expanded, the dropdown will automatically display in fullscreen mode
|
|
3173
|
-
* if the screen size is equal to or smaller than the selected breakpoint.
|
|
3174
|
-
* @default sm
|
|
3180
|
+
* 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.
|
|
3175
3181
|
*/
|
|
3176
3182
|
fullscreenBreakpoint: {
|
|
3177
3183
|
type: String,
|
|
@@ -3270,6 +3276,23 @@ class AuroDropdown extends LitElement {
|
|
|
3270
3276
|
*/
|
|
3271
3277
|
tabIndex: {
|
|
3272
3278
|
type: Number
|
|
3279
|
+
},
|
|
3280
|
+
|
|
3281
|
+
/**
|
|
3282
|
+
* The value for the role attribute of the trigger element.
|
|
3283
|
+
*/
|
|
3284
|
+
a11yRole: {
|
|
3285
|
+
type: String || undefined,
|
|
3286
|
+
attribute: false,
|
|
3287
|
+
reflect: false
|
|
3288
|
+
},
|
|
3289
|
+
|
|
3290
|
+
/**
|
|
3291
|
+
* The value for the aria-autocomplete attribute of the trigger element.
|
|
3292
|
+
*/
|
|
3293
|
+
a11yAutocomplete: {
|
|
3294
|
+
type: String,
|
|
3295
|
+
attribute: false,
|
|
3273
3296
|
}
|
|
3274
3297
|
};
|
|
3275
3298
|
}
|
|
@@ -3294,15 +3317,6 @@ class AuroDropdown extends LitElement {
|
|
|
3294
3317
|
AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroDropdown);
|
|
3295
3318
|
}
|
|
3296
3319
|
|
|
3297
|
-
/**
|
|
3298
|
-
* Accessor for reusing the focusable entity query string.
|
|
3299
|
-
* @private
|
|
3300
|
-
* @returns {string}
|
|
3301
|
-
*/
|
|
3302
|
-
get focusableEntityQuery () {
|
|
3303
|
-
return 'auro-input, [auro-input], auro-button, [auro-button], button, input';
|
|
3304
|
-
}
|
|
3305
|
-
|
|
3306
3320
|
connectedCallback() {
|
|
3307
3321
|
super.connectedCallback();
|
|
3308
3322
|
}
|
|
@@ -3316,8 +3330,6 @@ class AuroDropdown extends LitElement {
|
|
|
3316
3330
|
updated(changedProperties) {
|
|
3317
3331
|
this.floater.handleUpdate(changedProperties);
|
|
3318
3332
|
|
|
3319
|
-
// Note: `disabled` is not a breakpoint (it is not a screen size),
|
|
3320
|
-
// so it looks like we never consume this - however, dropdownBib handles this in the setter as "undefined"
|
|
3321
3333
|
if (changedProperties.has('fullscreenBreakpoint')) {
|
|
3322
3334
|
this.bibContent.mobileFullscreenBreakpoint = this.fullscreenBreakpoint;
|
|
3323
3335
|
}
|
|
@@ -3331,7 +3343,22 @@ class AuroDropdown extends LitElement {
|
|
|
3331
3343
|
}
|
|
3332
3344
|
|
|
3333
3345
|
firstUpdated() {
|
|
3346
|
+
|
|
3347
|
+
// Configure the floater to, this will generate the ID for the bib
|
|
3334
3348
|
this.floater.configure(this, 'auroDropdown');
|
|
3349
|
+
|
|
3350
|
+
/**
|
|
3351
|
+
* @description Let subscribers know that the dropdown ID ha been generated and added.
|
|
3352
|
+
* @event auroDropdown-idAdded
|
|
3353
|
+
* @type {Object<key: 'id', value: string>} - The ID of the dropdown bib element.
|
|
3354
|
+
*/
|
|
3355
|
+
this.dispatchEvent(new CustomEvent('auroDropdown-idAdded', {detail: {id: this.floater.element.id}}));
|
|
3356
|
+
|
|
3357
|
+
// Set the bib ID locally if the user hasn't provided a focusable trigger
|
|
3358
|
+
if (!this.triggerContentFocusable) {
|
|
3359
|
+
this.dropdownId = this.floater.element.id;
|
|
3360
|
+
}
|
|
3361
|
+
|
|
3335
3362
|
this.bibContent = this.floater.element.bib;
|
|
3336
3363
|
|
|
3337
3364
|
// Add the tag name as an attribute if it is different than the component name
|
|
@@ -3453,7 +3480,7 @@ class AuroDropdown extends LitElement {
|
|
|
3453
3480
|
|
|
3454
3481
|
this.triggerContentSlot.forEach((node) => {
|
|
3455
3482
|
if (node.querySelectorAll) {
|
|
3456
|
-
const auroElements = node.querySelectorAll(
|
|
3483
|
+
const auroElements = node.querySelectorAll('auro-input, [auro-input], auro-button, [auro-button], button, input');
|
|
3457
3484
|
auroElements.forEach((auroEl) => {
|
|
3458
3485
|
auroEl.addEventListener('focus', this.bindFocusEventToTrigger);
|
|
3459
3486
|
auroEl.addEventListener('blur', this.bindFocusEventToTrigger);
|
|
@@ -3474,7 +3501,7 @@ class AuroDropdown extends LitElement {
|
|
|
3474
3501
|
|
|
3475
3502
|
this.triggerContentSlot.forEach((node) => {
|
|
3476
3503
|
if (node.querySelectorAll) {
|
|
3477
|
-
const auroElements = node.querySelectorAll(
|
|
3504
|
+
const auroElements = node.querySelectorAll('auro-input, [auro-input], auro-button, [auro-button], button, input');
|
|
3478
3505
|
auroElements.forEach((auroEl) => {
|
|
3479
3506
|
auroEl.removeEventListener('focus', this.bindFocusEventToTrigger);
|
|
3480
3507
|
auroEl.removeEventListener('blur', this.bindFocusEventToTrigger);
|
|
@@ -3483,6 +3510,30 @@ class AuroDropdown extends LitElement {
|
|
|
3483
3510
|
});
|
|
3484
3511
|
}
|
|
3485
3512
|
|
|
3513
|
+
/*
|
|
3514
|
+
* Sets aria attributes for the trigger element if a custom one is passed in.
|
|
3515
|
+
* @private
|
|
3516
|
+
* @method setTriggerAriaAttributes
|
|
3517
|
+
* @param { HTMLElement } triggerElement - The custom trigger element.
|
|
3518
|
+
*/
|
|
3519
|
+
clearTriggerA11yAttributes(triggerElement) {
|
|
3520
|
+
|
|
3521
|
+
if (!triggerElement || !triggerElement.removeAttribute) {
|
|
3522
|
+
return;
|
|
3523
|
+
}
|
|
3524
|
+
|
|
3525
|
+
// Reset appropriate attributes for a11y
|
|
3526
|
+
triggerElement.removeAttribute('aria-labelledby');
|
|
3527
|
+
if (triggerElement.getAttribute('id') === `${this.id}-trigger-element`) {
|
|
3528
|
+
triggerElement.removeAttribute('id');
|
|
3529
|
+
}
|
|
3530
|
+
triggerElement.removeAttribute('role');
|
|
3531
|
+
triggerElement.removeAttribute('aria-expanded');
|
|
3532
|
+
|
|
3533
|
+
triggerElement.removeAttribute('aria-controls');
|
|
3534
|
+
triggerElement.removeAttribute('aria-autocomplete');
|
|
3535
|
+
}
|
|
3536
|
+
|
|
3486
3537
|
/**
|
|
3487
3538
|
* Handles changes to the trigger content slot and updates related properties.
|
|
3488
3539
|
*
|
|
@@ -3496,32 +3547,41 @@ class AuroDropdown extends LitElement {
|
|
|
3496
3547
|
* @returns {void}
|
|
3497
3548
|
*/
|
|
3498
3549
|
handleTriggerContentSlotChange(event) {
|
|
3550
|
+
|
|
3499
3551
|
this.floater.handleTriggerTabIndex();
|
|
3500
3552
|
|
|
3553
|
+
// Get the trigger
|
|
3554
|
+
const trigger = this.shadowRoot.querySelector('#trigger');
|
|
3555
|
+
|
|
3556
|
+
// Get the trigger slot
|
|
3501
3557
|
const triggerSlot = this.shadowRoot.querySelector('.triggerContent slot');
|
|
3502
3558
|
|
|
3559
|
+
// If there's a trigger slot
|
|
3503
3560
|
if (triggerSlot) {
|
|
3504
3561
|
|
|
3562
|
+
// Get the content nodes to see if there are any children
|
|
3505
3563
|
const triggerContentNodes = triggerSlot.assignedNodes();
|
|
3506
3564
|
|
|
3565
|
+
// If there are children
|
|
3507
3566
|
if (triggerContentNodes) {
|
|
3508
3567
|
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
this.triggerContentFocusable = this.containsFocusableElement(node);
|
|
3512
|
-
}
|
|
3513
|
-
});
|
|
3514
|
-
}
|
|
3515
|
-
}
|
|
3568
|
+
// See if any of them are focusable elemeents
|
|
3569
|
+
this.triggerContentFocusable = triggerContentNodes.some((node) => this.containsFocusableElement(node));
|
|
3516
3570
|
|
|
3517
|
-
|
|
3571
|
+
// If any of them are focusable elements
|
|
3572
|
+
if (this.triggerContentFocusable) {
|
|
3518
3573
|
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3574
|
+
// Assume the consumer will be providing their own a11y in whatever they passed in
|
|
3575
|
+
this.clearTriggerA11yAttributes(trigger);
|
|
3576
|
+
|
|
3577
|
+
// Remove the tabindex from the trigger so it doesn't interrupt focus flow
|
|
3578
|
+
trigger.removeAttribute('tabindex');
|
|
3579
|
+
} else {
|
|
3580
|
+
|
|
3581
|
+
// Add the tabindex to the trigger so that it's in the focus flow
|
|
3582
|
+
trigger.setAttribute('tabindex', '0');
|
|
3583
|
+
}
|
|
3584
|
+
}
|
|
3525
3585
|
}
|
|
3526
3586
|
|
|
3527
3587
|
if (event) {
|
|
@@ -3531,6 +3591,7 @@ class AuroDropdown extends LitElement {
|
|
|
3531
3591
|
|
|
3532
3592
|
if (this.triggerContentSlot) {
|
|
3533
3593
|
this.setupTriggerFocusEventBinding();
|
|
3594
|
+
|
|
3534
3595
|
this.hasTriggerContent = this.triggerContentSlot.some((slot) => {
|
|
3535
3596
|
if (slot.textContent.trim()) {
|
|
3536
3597
|
return true;
|
|
@@ -3598,10 +3659,13 @@ class AuroDropdown extends LitElement {
|
|
|
3598
3659
|
id="trigger"
|
|
3599
3660
|
class="trigger"
|
|
3600
3661
|
part="trigger"
|
|
3601
|
-
aria-labelledby="triggerLabel"
|
|
3602
3662
|
tabindex="${this.tabIndex}"
|
|
3603
3663
|
?showBorder="${this.showTriggerBorders}"
|
|
3604
|
-
|
|
3664
|
+
role="${ifDefined(this.triggerContentFocusable ? undefined : this.a11yRole)}"
|
|
3665
|
+
aria-expanded="${ifDefined(this.triggerContentFocusable ? undefined : this.isPopoverVisible)}"
|
|
3666
|
+
aria-controls="${ifDefined(this.triggerContentFocusable ? undefined : this.dropdownId)}"
|
|
3667
|
+
aria-labelledby="${ifDefined(this.triggerContentFocusable ? undefined : 'triggerLabel')}"
|
|
3668
|
+
>
|
|
3605
3669
|
<div class="triggerContentWrapper">
|
|
3606
3670
|
<label class="label" id="triggerLabel" hasTrigger=${this.hasTriggerContent}>
|
|
3607
3671
|
<slot name="label" @slotchange="${this.handleLabelSlotChange}"></slot>
|
|
@@ -3635,12 +3699,12 @@ class AuroDropdown extends LitElement {
|
|
|
3635
3699
|
<div id="bibSizer" part="size"></div>
|
|
3636
3700
|
<${this.dropdownBibTag}
|
|
3637
3701
|
id="bib"
|
|
3638
|
-
role="tooltip"
|
|
3639
3702
|
?data-show="${this.isPopoverVisible}"
|
|
3640
3703
|
?isfullscreen="${this.isBibFullscreen}"
|
|
3641
3704
|
?common="${this.common}"
|
|
3642
3705
|
?rounded="${this.common || this.rounded}"
|
|
3643
|
-
?inset="${this.common || this.inset}"
|
|
3706
|
+
?inset="${this.common || this.inset}"
|
|
3707
|
+
>
|
|
3644
3708
|
</${this.dropdownBibTag}>
|
|
3645
3709
|
</div>
|
|
3646
3710
|
`;
|
|
@@ -1846,7 +1846,7 @@ class AuroFloatingUI {
|
|
|
1846
1846
|
/**
|
|
1847
1847
|
* @private
|
|
1848
1848
|
* getting called on 'blur' in trigger or `focusin` in document
|
|
1849
|
-
*
|
|
1849
|
+
*
|
|
1850
1850
|
* Hides the bib if focus moves outside of the trigger or bib, unless a 'noHideOnThisFocusLoss' flag is set.
|
|
1851
1851
|
* This method checks if the currently active element is still within the trigger or bib.
|
|
1852
1852
|
* If not, and if the bib isn't in fullscreen mode with focus lost, it hides the bib.
|
|
@@ -1962,7 +1962,7 @@ class AuroFloatingUI {
|
|
|
1962
1962
|
// Close any other dropdown that is already open
|
|
1963
1963
|
const existedVisibleFloatingUI = document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
1964
1964
|
if (existedVisibleFloatingUI && existedVisibleFloatingUI !== this &&
|
|
1965
|
-
existedVisibleFloatingUI.isPopoverVisible &&
|
|
1965
|
+
existedVisibleFloatingUI.element.isPopoverVisible &&
|
|
1966
1966
|
document.expandedAuroFloater.eventPrefix === this.eventPrefix) {
|
|
1967
1967
|
document.expandedAuroFloater.hideBib();
|
|
1968
1968
|
}
|
|
@@ -2138,7 +2138,7 @@ class AuroFloatingUI {
|
|
|
2138
2138
|
this.id = window.crypto.randomUUID();
|
|
2139
2139
|
this.element.setAttribute('id', this.id);
|
|
2140
2140
|
}
|
|
2141
|
-
|
|
2141
|
+
|
|
2142
2142
|
this.element.bib.setAttribute("id", `${this.id}-floater-bib`);
|
|
2143
2143
|
}
|
|
2144
2144
|
|
|
@@ -2191,7 +2191,7 @@ class AuroFloatingUI {
|
|
|
2191
2191
|
if (this.element.bib) {
|
|
2192
2192
|
this.element.shadowRoot.append(this.element.bib);
|
|
2193
2193
|
}
|
|
2194
|
-
|
|
2194
|
+
|
|
2195
2195
|
// Remove event & keyboard listeners
|
|
2196
2196
|
if (this.element?.trigger) {
|
|
2197
2197
|
this.element.trigger.removeEventListener('keydown', this.handleEvent);
|
|
@@ -2581,7 +2581,6 @@ var tokensCss$1 = css`:host{--ds-auro-dropdown-label-text-color: var(--ds-basic-
|
|
|
2581
2581
|
|
|
2582
2582
|
const DESIGN_TOKEN_BREAKPOINT_PREFIX = '--ds-grid-breakpoint-';
|
|
2583
2583
|
const DESIGN_TOKEN_BREAKPOINT_OPTIONS = [
|
|
2584
|
-
'xl',
|
|
2585
2584
|
'lg',
|
|
2586
2585
|
'md',
|
|
2587
2586
|
'sm',
|
|
@@ -2653,7 +2652,6 @@ class AuroDropdownBib extends LitElement {
|
|
|
2653
2652
|
|
|
2654
2653
|
set mobileFullscreenBreakpoint(value) {
|
|
2655
2654
|
// verify the defined breakpoint is valid and exit out if not
|
|
2656
|
-
// 'disabled' is a design token breakpoint so it acts as our "undefined" value
|
|
2657
2655
|
const validatedValue = DESIGN_TOKEN_BREAKPOINT_OPTIONS.includes(value) ? value : undefined;
|
|
2658
2656
|
if (!validatedValue) {
|
|
2659
2657
|
this._mobileBreakpointValue = undefined;
|
|
@@ -2922,6 +2920,7 @@ var helpTextVersion = '1.0.0';
|
|
|
2922
2920
|
* @csspart helpText - The helpText content container.
|
|
2923
2921
|
* @event auroDropdown-triggerClick - Notifies that the trigger has been clicked.
|
|
2924
2922
|
* @event auroDropdown-toggled - Notifies that the visibility of the dropdown bib has changed.
|
|
2923
|
+
* @event auroDropdown-idAdded - Notifies consumers that the unique ID for the dropdown bib has been generated.
|
|
2925
2924
|
*/
|
|
2926
2925
|
class AuroDropdown extends LitElement {
|
|
2927
2926
|
constructor() {
|
|
@@ -2967,7 +2966,9 @@ class AuroDropdown extends LitElement {
|
|
|
2967
2966
|
this.rounded = false;
|
|
2968
2967
|
this.tabIndex = 0;
|
|
2969
2968
|
this.noToggle = false;
|
|
2969
|
+
this.a11yAutocomplete = 'none';
|
|
2970
2970
|
this.labeled = true;
|
|
2971
|
+
this.a11yRole = 'combobox';
|
|
2971
2972
|
this.onDark = false;
|
|
2972
2973
|
|
|
2973
2974
|
// floaterConfig
|
|
@@ -3103,6 +3104,16 @@ class AuroDropdown extends LitElement {
|
|
|
3103
3104
|
type: Number
|
|
3104
3105
|
},
|
|
3105
3106
|
|
|
3107
|
+
/**
|
|
3108
|
+
* The unique ID for the dropdown bib element.
|
|
3109
|
+
* @private
|
|
3110
|
+
*/
|
|
3111
|
+
dropdownId: {
|
|
3112
|
+
type: String,
|
|
3113
|
+
reflect: false,
|
|
3114
|
+
attribute: false
|
|
3115
|
+
},
|
|
3116
|
+
|
|
3106
3117
|
/**
|
|
3107
3118
|
* If declared in combination with `bordered` property or `helpText` slot content, will apply red color to both.
|
|
3108
3119
|
*/
|
|
@@ -3166,12 +3177,7 @@ class AuroDropdown extends LitElement {
|
|
|
3166
3177
|
},
|
|
3167
3178
|
|
|
3168
3179
|
/**
|
|
3169
|
-
* Defines the screen size breakpoint (`
|
|
3170
|
-
* at which the dropdown switches to fullscreen mode on mobile. `disabled` indicates a dropdown should _never_ enter fullscreen.
|
|
3171
|
-
*
|
|
3172
|
-
* When expanded, the dropdown will automatically display in fullscreen mode
|
|
3173
|
-
* if the screen size is equal to or smaller than the selected breakpoint.
|
|
3174
|
-
* @default sm
|
|
3180
|
+
* 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.
|
|
3175
3181
|
*/
|
|
3176
3182
|
fullscreenBreakpoint: {
|
|
3177
3183
|
type: String,
|
|
@@ -3270,6 +3276,23 @@ class AuroDropdown extends LitElement {
|
|
|
3270
3276
|
*/
|
|
3271
3277
|
tabIndex: {
|
|
3272
3278
|
type: Number
|
|
3279
|
+
},
|
|
3280
|
+
|
|
3281
|
+
/**
|
|
3282
|
+
* The value for the role attribute of the trigger element.
|
|
3283
|
+
*/
|
|
3284
|
+
a11yRole: {
|
|
3285
|
+
type: String || undefined,
|
|
3286
|
+
attribute: false,
|
|
3287
|
+
reflect: false
|
|
3288
|
+
},
|
|
3289
|
+
|
|
3290
|
+
/**
|
|
3291
|
+
* The value for the aria-autocomplete attribute of the trigger element.
|
|
3292
|
+
*/
|
|
3293
|
+
a11yAutocomplete: {
|
|
3294
|
+
type: String,
|
|
3295
|
+
attribute: false,
|
|
3273
3296
|
}
|
|
3274
3297
|
};
|
|
3275
3298
|
}
|
|
@@ -3294,15 +3317,6 @@ class AuroDropdown extends LitElement {
|
|
|
3294
3317
|
AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroDropdown);
|
|
3295
3318
|
}
|
|
3296
3319
|
|
|
3297
|
-
/**
|
|
3298
|
-
* Accessor for reusing the focusable entity query string.
|
|
3299
|
-
* @private
|
|
3300
|
-
* @returns {string}
|
|
3301
|
-
*/
|
|
3302
|
-
get focusableEntityQuery () {
|
|
3303
|
-
return 'auro-input, [auro-input], auro-button, [auro-button], button, input';
|
|
3304
|
-
}
|
|
3305
|
-
|
|
3306
3320
|
connectedCallback() {
|
|
3307
3321
|
super.connectedCallback();
|
|
3308
3322
|
}
|
|
@@ -3316,8 +3330,6 @@ class AuroDropdown extends LitElement {
|
|
|
3316
3330
|
updated(changedProperties) {
|
|
3317
3331
|
this.floater.handleUpdate(changedProperties);
|
|
3318
3332
|
|
|
3319
|
-
// Note: `disabled` is not a breakpoint (it is not a screen size),
|
|
3320
|
-
// so it looks like we never consume this - however, dropdownBib handles this in the setter as "undefined"
|
|
3321
3333
|
if (changedProperties.has('fullscreenBreakpoint')) {
|
|
3322
3334
|
this.bibContent.mobileFullscreenBreakpoint = this.fullscreenBreakpoint;
|
|
3323
3335
|
}
|
|
@@ -3331,7 +3343,22 @@ class AuroDropdown extends LitElement {
|
|
|
3331
3343
|
}
|
|
3332
3344
|
|
|
3333
3345
|
firstUpdated() {
|
|
3346
|
+
|
|
3347
|
+
// Configure the floater to, this will generate the ID for the bib
|
|
3334
3348
|
this.floater.configure(this, 'auroDropdown');
|
|
3349
|
+
|
|
3350
|
+
/**
|
|
3351
|
+
* @description Let subscribers know that the dropdown ID ha been generated and added.
|
|
3352
|
+
* @event auroDropdown-idAdded
|
|
3353
|
+
* @type {Object<key: 'id', value: string>} - The ID of the dropdown bib element.
|
|
3354
|
+
*/
|
|
3355
|
+
this.dispatchEvent(new CustomEvent('auroDropdown-idAdded', {detail: {id: this.floater.element.id}}));
|
|
3356
|
+
|
|
3357
|
+
// Set the bib ID locally if the user hasn't provided a focusable trigger
|
|
3358
|
+
if (!this.triggerContentFocusable) {
|
|
3359
|
+
this.dropdownId = this.floater.element.id;
|
|
3360
|
+
}
|
|
3361
|
+
|
|
3335
3362
|
this.bibContent = this.floater.element.bib;
|
|
3336
3363
|
|
|
3337
3364
|
// Add the tag name as an attribute if it is different than the component name
|
|
@@ -3453,7 +3480,7 @@ class AuroDropdown extends LitElement {
|
|
|
3453
3480
|
|
|
3454
3481
|
this.triggerContentSlot.forEach((node) => {
|
|
3455
3482
|
if (node.querySelectorAll) {
|
|
3456
|
-
const auroElements = node.querySelectorAll(
|
|
3483
|
+
const auroElements = node.querySelectorAll('auro-input, [auro-input], auro-button, [auro-button], button, input');
|
|
3457
3484
|
auroElements.forEach((auroEl) => {
|
|
3458
3485
|
auroEl.addEventListener('focus', this.bindFocusEventToTrigger);
|
|
3459
3486
|
auroEl.addEventListener('blur', this.bindFocusEventToTrigger);
|
|
@@ -3474,7 +3501,7 @@ class AuroDropdown extends LitElement {
|
|
|
3474
3501
|
|
|
3475
3502
|
this.triggerContentSlot.forEach((node) => {
|
|
3476
3503
|
if (node.querySelectorAll) {
|
|
3477
|
-
const auroElements = node.querySelectorAll(
|
|
3504
|
+
const auroElements = node.querySelectorAll('auro-input, [auro-input], auro-button, [auro-button], button, input');
|
|
3478
3505
|
auroElements.forEach((auroEl) => {
|
|
3479
3506
|
auroEl.removeEventListener('focus', this.bindFocusEventToTrigger);
|
|
3480
3507
|
auroEl.removeEventListener('blur', this.bindFocusEventToTrigger);
|
|
@@ -3483,6 +3510,30 @@ class AuroDropdown extends LitElement {
|
|
|
3483
3510
|
});
|
|
3484
3511
|
}
|
|
3485
3512
|
|
|
3513
|
+
/*
|
|
3514
|
+
* Sets aria attributes for the trigger element if a custom one is passed in.
|
|
3515
|
+
* @private
|
|
3516
|
+
* @method setTriggerAriaAttributes
|
|
3517
|
+
* @param { HTMLElement } triggerElement - The custom trigger element.
|
|
3518
|
+
*/
|
|
3519
|
+
clearTriggerA11yAttributes(triggerElement) {
|
|
3520
|
+
|
|
3521
|
+
if (!triggerElement || !triggerElement.removeAttribute) {
|
|
3522
|
+
return;
|
|
3523
|
+
}
|
|
3524
|
+
|
|
3525
|
+
// Reset appropriate attributes for a11y
|
|
3526
|
+
triggerElement.removeAttribute('aria-labelledby');
|
|
3527
|
+
if (triggerElement.getAttribute('id') === `${this.id}-trigger-element`) {
|
|
3528
|
+
triggerElement.removeAttribute('id');
|
|
3529
|
+
}
|
|
3530
|
+
triggerElement.removeAttribute('role');
|
|
3531
|
+
triggerElement.removeAttribute('aria-expanded');
|
|
3532
|
+
|
|
3533
|
+
triggerElement.removeAttribute('aria-controls');
|
|
3534
|
+
triggerElement.removeAttribute('aria-autocomplete');
|
|
3535
|
+
}
|
|
3536
|
+
|
|
3486
3537
|
/**
|
|
3487
3538
|
* Handles changes to the trigger content slot and updates related properties.
|
|
3488
3539
|
*
|
|
@@ -3496,32 +3547,41 @@ class AuroDropdown extends LitElement {
|
|
|
3496
3547
|
* @returns {void}
|
|
3497
3548
|
*/
|
|
3498
3549
|
handleTriggerContentSlotChange(event) {
|
|
3550
|
+
|
|
3499
3551
|
this.floater.handleTriggerTabIndex();
|
|
3500
3552
|
|
|
3553
|
+
// Get the trigger
|
|
3554
|
+
const trigger = this.shadowRoot.querySelector('#trigger');
|
|
3555
|
+
|
|
3556
|
+
// Get the trigger slot
|
|
3501
3557
|
const triggerSlot = this.shadowRoot.querySelector('.triggerContent slot');
|
|
3502
3558
|
|
|
3559
|
+
// If there's a trigger slot
|
|
3503
3560
|
if (triggerSlot) {
|
|
3504
3561
|
|
|
3562
|
+
// Get the content nodes to see if there are any children
|
|
3505
3563
|
const triggerContentNodes = triggerSlot.assignedNodes();
|
|
3506
3564
|
|
|
3565
|
+
// If there are children
|
|
3507
3566
|
if (triggerContentNodes) {
|
|
3508
3567
|
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
this.triggerContentFocusable = this.containsFocusableElement(node);
|
|
3512
|
-
}
|
|
3513
|
-
});
|
|
3514
|
-
}
|
|
3515
|
-
}
|
|
3568
|
+
// See if any of them are focusable elemeents
|
|
3569
|
+
this.triggerContentFocusable = triggerContentNodes.some((node) => this.containsFocusableElement(node));
|
|
3516
3570
|
|
|
3517
|
-
|
|
3571
|
+
// If any of them are focusable elements
|
|
3572
|
+
if (this.triggerContentFocusable) {
|
|
3518
3573
|
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3574
|
+
// Assume the consumer will be providing their own a11y in whatever they passed in
|
|
3575
|
+
this.clearTriggerA11yAttributes(trigger);
|
|
3576
|
+
|
|
3577
|
+
// Remove the tabindex from the trigger so it doesn't interrupt focus flow
|
|
3578
|
+
trigger.removeAttribute('tabindex');
|
|
3579
|
+
} else {
|
|
3580
|
+
|
|
3581
|
+
// Add the tabindex to the trigger so that it's in the focus flow
|
|
3582
|
+
trigger.setAttribute('tabindex', '0');
|
|
3583
|
+
}
|
|
3584
|
+
}
|
|
3525
3585
|
}
|
|
3526
3586
|
|
|
3527
3587
|
if (event) {
|
|
@@ -3531,6 +3591,7 @@ class AuroDropdown extends LitElement {
|
|
|
3531
3591
|
|
|
3532
3592
|
if (this.triggerContentSlot) {
|
|
3533
3593
|
this.setupTriggerFocusEventBinding();
|
|
3594
|
+
|
|
3534
3595
|
this.hasTriggerContent = this.triggerContentSlot.some((slot) => {
|
|
3535
3596
|
if (slot.textContent.trim()) {
|
|
3536
3597
|
return true;
|
|
@@ -3598,10 +3659,13 @@ class AuroDropdown extends LitElement {
|
|
|
3598
3659
|
id="trigger"
|
|
3599
3660
|
class="trigger"
|
|
3600
3661
|
part="trigger"
|
|
3601
|
-
aria-labelledby="triggerLabel"
|
|
3602
3662
|
tabindex="${this.tabIndex}"
|
|
3603
3663
|
?showBorder="${this.showTriggerBorders}"
|
|
3604
|
-
|
|
3664
|
+
role="${ifDefined(this.triggerContentFocusable ? undefined : this.a11yRole)}"
|
|
3665
|
+
aria-expanded="${ifDefined(this.triggerContentFocusable ? undefined : this.isPopoverVisible)}"
|
|
3666
|
+
aria-controls="${ifDefined(this.triggerContentFocusable ? undefined : this.dropdownId)}"
|
|
3667
|
+
aria-labelledby="${ifDefined(this.triggerContentFocusable ? undefined : 'triggerLabel')}"
|
|
3668
|
+
>
|
|
3605
3669
|
<div class="triggerContentWrapper">
|
|
3606
3670
|
<label class="label" id="triggerLabel" hasTrigger=${this.hasTriggerContent}>
|
|
3607
3671
|
<slot name="label" @slotchange="${this.handleLabelSlotChange}"></slot>
|
|
@@ -3635,12 +3699,12 @@ class AuroDropdown extends LitElement {
|
|
|
3635
3699
|
<div id="bibSizer" part="size"></div>
|
|
3636
3700
|
<${this.dropdownBibTag}
|
|
3637
3701
|
id="bib"
|
|
3638
|
-
role="tooltip"
|
|
3639
3702
|
?data-show="${this.isPopoverVisible}"
|
|
3640
3703
|
?isfullscreen="${this.isBibFullscreen}"
|
|
3641
3704
|
?common="${this.common}"
|
|
3642
3705
|
?rounded="${this.common || this.rounded}"
|
|
3643
|
-
?inset="${this.common || this.inset}"
|
|
3706
|
+
?inset="${this.common || this.inset}"
|
|
3707
|
+
>
|
|
3644
3708
|
</${this.dropdownBibTag}>
|
|
3645
3709
|
</div>
|
|
3646
3710
|
`;
|
|
@@ -15,7 +15,10 @@ Generate unique names for dependency components.
|
|
|
15
15
|
## Properties
|
|
16
16
|
|
|
17
17
|
| Property | Attribute | Type | Default | Description |
|
|
18
|
-
|-----------------------------------|-----------------------------------|-----------|-------------|--------------------------------------------------|
|
|
18
|
+
|-----------------------------------|-----------------------------------|-----------|-------------|--------------------------------------------------|
|
|
19
|
+
| `a11yControls` | `a11yControls` | `string` | | The value for the aria-controls attribute. |
|
|
20
|
+
| `a11yExpanded` | `a11yExpanded` | `boolean` | | The value for the aria-expanded attribute. |
|
|
21
|
+
| `a11yRole` | `a11yRole` | `string` | | The value for the role attribute. |
|
|
19
22
|
| [activeLabel](#activeLabel) | `activeLabel` | `boolean` | false | If set, the label will remain fixed in the active position. |
|
|
20
23
|
| [autocapitalize](#autocapitalize) | `autocapitalize` | `string` | | An enumerated attribute that controls whether and how text input is automatically capitalized as it is entered/edited by the user. [off/none, on/sentences, words, characters]. |
|
|
21
24
|
| [autocomplete](#autocomplete) | `autocomplete` | `string` | | An enumerated attribute that defines what the user agent can suggest for autofill. At this time, only `autocomplete="off"` is supported. |
|