@aurodesignsystem-dev/auro-formkit 0.0.0-pr741.0 → 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.
- package/components/bibtemplate/dist/index.js +1 -1
- package/components/bibtemplate/dist/registered.js +1 -1
- package/components/checkbox/demo/api.html +16 -10
- package/components/checkbox/demo/api.min.js +11 -11
- package/components/checkbox/demo/index.html +16 -10
- package/components/checkbox/demo/index.min.js +11 -11
- package/components/checkbox/demo/readme.html +16 -9
- package/components/checkbox/dist/index.js +11 -11
- package/components/checkbox/dist/registered.js +11 -11
- package/components/combobox/demo/api.html +16 -10
- package/components/combobox/demo/api.md +12 -6
- package/components/combobox/demo/api.min.js +411 -103
- package/components/combobox/demo/index.html +16 -10
- package/components/combobox/demo/index.min.js +411 -103
- package/components/combobox/demo/readme.html +16 -9
- package/components/combobox/dist/index.js +374 -91
- package/components/combobox/dist/registered.js +374 -91
- package/components/counter/demo/api.html +16 -10
- package/components/counter/demo/api.md +140 -7
- package/components/counter/demo/api.min.js +1145 -987
- package/components/counter/demo/index.html +16 -10
- package/components/counter/demo/index.md +82 -0
- package/components/counter/demo/index.min.js +1145 -987
- package/components/counter/demo/readme.html +16 -9
- package/components/counter/dist/auro-counter-group.d.ts +64 -23
- package/components/counter/dist/auro-counter.d.ts +10 -0
- package/components/counter/dist/index.js +1145 -987
- package/components/counter/dist/registered.js +1145 -987
- package/components/datepicker/demo/api.html +16 -10
- package/components/datepicker/demo/api.min.js +374 -91
- package/components/datepicker/demo/index.html +16 -10
- package/components/datepicker/demo/index.min.js +374 -91
- package/components/datepicker/demo/readme.html +16 -9
- package/components/datepicker/dist/auro-datepicker.d.ts +6 -0
- package/components/datepicker/dist/index.js +374 -91
- package/components/datepicker/dist/registered.js +374 -91
- package/components/dropdown/demo/api.html +16 -10
- package/components/dropdown/demo/api.md +77 -267
- package/components/dropdown/demo/api.min.js +331 -64
- package/components/dropdown/demo/index.html +16 -10
- package/components/dropdown/demo/index.md +45 -363
- package/components/dropdown/demo/index.min.js +331 -64
- package/components/dropdown/demo/readme.html +16 -9
- package/components/dropdown/dist/auro-dropdown.d.ts +35 -67
- package/components/dropdown/dist/index.js +331 -64
- package/components/dropdown/dist/registered.js +331 -64
- package/components/form/demo/api.html +16 -9
- package/components/form/demo/autocomplete.html +19 -3
- package/components/form/demo/index.html +16 -9
- package/components/form/demo/readme.html +16 -9
- package/components/form/demo/working.html +19 -13
- package/components/helptext/dist/index.js +1 -1
- package/components/helptext/dist/registered.js +1 -1
- package/components/input/demo/api.html +16 -10
- package/components/input/demo/api.md +1 -1
- package/components/input/demo/api.min.js +14 -14
- package/components/input/demo/index.html +16 -10
- package/components/input/demo/index.min.js +14 -14
- package/components/input/demo/readme.html +16 -9
- package/components/input/dist/base-input.d.ts +1 -1
- package/components/input/dist/index.js +14 -14
- package/components/input/dist/registered.js +14 -14
- package/components/menu/demo/api.html +16 -32
- package/components/menu/demo/api.md +1 -1
- package/components/menu/demo/api.min.js +37 -12
- package/components/menu/demo/index.html +16 -10
- package/components/menu/demo/index.min.js +37 -12
- package/components/menu/demo/readme.html +16 -9
- package/components/menu/dist/auro-menu.d.ts +13 -2
- package/components/menu/dist/index.js +37 -12
- package/components/menu/dist/registered.js +37 -12
- package/components/radio/demo/api.html +16 -10
- package/components/radio/demo/api.md +0 -1
- package/components/radio/demo/api.min.js +61 -76
- package/components/radio/demo/index.html +16 -10
- package/components/radio/demo/index.min.js +61 -76
- package/components/radio/demo/readme.html +16 -9
- package/components/radio/dist/auro-radio.d.ts +8 -11
- package/components/radio/dist/index.js +61 -76
- package/components/radio/dist/registered.js +61 -76
- package/components/select/demo/api.html +16 -10
- package/components/select/demo/api.js +0 -2
- package/components/select/demo/api.md +53 -51
- package/components/select/demo/api.min.js +491 -326
- package/components/select/demo/index.html +16 -11
- package/components/select/demo/index.md +6 -158
- package/components/select/demo/index.min.js +491 -314
- package/components/select/demo/readme.html +16 -9
- package/components/select/dist/auro-select.d.ts +33 -8
- package/components/select/dist/index.js +454 -302
- package/components/select/dist/registered.js +454 -302
- package/package.json +26 -25
|
@@ -689,19 +689,19 @@ class AuroFormValidation {
|
|
|
689
689
|
{
|
|
690
690
|
check: (e) => e.value?.length > 0 && e.value?.length < e.minLength,
|
|
691
691
|
validity: 'tooShort',
|
|
692
|
-
message: e => e.setCustomValidityTooShort || e.setCustomValidity || ''
|
|
692
|
+
message: e => e.getAttribute('setCustomValidityTooShort') || e.setCustomValidity || ''
|
|
693
693
|
},
|
|
694
694
|
{
|
|
695
695
|
check: (e) => e.value?.length > e.maxLength,
|
|
696
696
|
validity: 'tooLong',
|
|
697
|
-
message: e => e.setCustomValidityTooLong || e.setCustomValidity || ''
|
|
697
|
+
message: e => e.getAttribute('setCustomValidityTooLong') || e.setCustomValidity || ''
|
|
698
698
|
}
|
|
699
699
|
],
|
|
700
700
|
pattern: [
|
|
701
701
|
{
|
|
702
702
|
check: (e) => e.pattern && !new RegExp(`^${e.pattern}$`, 'u').test(e.value),
|
|
703
703
|
validity: 'patternMismatch',
|
|
704
|
-
message: e => e.setCustomValidityPatternMismatch || e.setCustomValidity || ''
|
|
704
|
+
message: e => e.getAttribute('setCustomValidityPatternMismatch') || e.setCustomValidity || ''
|
|
705
705
|
}
|
|
706
706
|
]
|
|
707
707
|
},
|
|
@@ -896,10 +896,10 @@ class AuroFormValidation {
|
|
|
896
896
|
if (!hasValue && elem.required && elem.touched) {
|
|
897
897
|
elem.validity = 'valueMissing';
|
|
898
898
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
899
|
-
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
899
|
+
} else if (hasValue && this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
900
900
|
this.validateType(elem);
|
|
901
901
|
this.validateElementAttributes(elem);
|
|
902
|
-
} else if (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group')) {
|
|
902
|
+
} else if (hasValue && (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group'))) {
|
|
903
903
|
this.validateElementAttributes(elem);
|
|
904
904
|
}
|
|
905
905
|
}
|
|
@@ -3274,6 +3274,267 @@ class AuroFloatingUI {
|
|
|
3274
3274
|
}
|
|
3275
3275
|
}
|
|
3276
3276
|
|
|
3277
|
+
// Selectors for focusable elements
|
|
3278
|
+
const FOCUSABLE_SELECTORS = [
|
|
3279
|
+
'a[href]',
|
|
3280
|
+
'button:not([disabled])',
|
|
3281
|
+
'textarea:not([disabled])',
|
|
3282
|
+
'input:not([disabled])',
|
|
3283
|
+
'select:not([disabled])',
|
|
3284
|
+
'[role="tab"]:not([disabled])',
|
|
3285
|
+
'[role="link"]:not([disabled])',
|
|
3286
|
+
'[role="button"]:not([disabled])',
|
|
3287
|
+
'[tabindex]:not([tabindex="-1"])',
|
|
3288
|
+
'[contenteditable]:not([contenteditable="false"])'
|
|
3289
|
+
];
|
|
3290
|
+
|
|
3291
|
+
// List of custom components that are known to be focusable
|
|
3292
|
+
const FOCUSABLE_COMPONENTS = [
|
|
3293
|
+
'auro-checkbox',
|
|
3294
|
+
'auro-radio',
|
|
3295
|
+
'auro-dropdown',
|
|
3296
|
+
'auro-button',
|
|
3297
|
+
'auro-combobox',
|
|
3298
|
+
'auro-input',
|
|
3299
|
+
'auro-counter',
|
|
3300
|
+
'auro-menu',
|
|
3301
|
+
'auro-select',
|
|
3302
|
+
'auro-datepicker',
|
|
3303
|
+
'auro-hyperlink',
|
|
3304
|
+
'auro-accordion',
|
|
3305
|
+
];
|
|
3306
|
+
|
|
3307
|
+
/**
|
|
3308
|
+
* Determines if a given element is a custom focusable component.
|
|
3309
|
+
* Returns true if the element matches a known focusable component and is not disabled.
|
|
3310
|
+
*
|
|
3311
|
+
* @param {HTMLElement} element The element to check for focusability.
|
|
3312
|
+
* @returns {boolean} True if the element is a focusable custom component, false otherwise.
|
|
3313
|
+
*/
|
|
3314
|
+
function isFocusableComponent(element) {
|
|
3315
|
+
const componentName = element.tagName.toLowerCase();
|
|
3316
|
+
|
|
3317
|
+
// Guard Clause: Element is a focusable component
|
|
3318
|
+
if (!FOCUSABLE_COMPONENTS.some((name) => element.hasAttribute(name) || componentName === name)) return false;
|
|
3319
|
+
|
|
3320
|
+
// Guard Clause: Element is not disabled
|
|
3321
|
+
if (element.hasAttribute('disabled')) return false;
|
|
3322
|
+
|
|
3323
|
+
// Guard Clause: The element is a hyperlink and has no href attribute
|
|
3324
|
+
if (componentName.match("hyperlink") && !element.hasAttribute('href')) return false;
|
|
3325
|
+
|
|
3326
|
+
// If all guard clauses pass, the element is a focusable component
|
|
3327
|
+
return true;
|
|
3328
|
+
}
|
|
3329
|
+
|
|
3330
|
+
/**
|
|
3331
|
+
* Retrieves all focusable elements within the container in DOM order, including those in shadow DOM and slots.
|
|
3332
|
+
* Returns a unique, ordered array of elements that can receive focus.
|
|
3333
|
+
*
|
|
3334
|
+
* @param {HTMLElement} container The container to search within
|
|
3335
|
+
* @returns {Array<HTMLElement>} An array of focusable elements within the container.
|
|
3336
|
+
*/
|
|
3337
|
+
function getFocusableElements(container) {
|
|
3338
|
+
// Get elements in DOM order by walking the tree
|
|
3339
|
+
const orderedFocusableElements = [];
|
|
3340
|
+
|
|
3341
|
+
// Define a recursive function to collect focusable elements in DOM order
|
|
3342
|
+
const collectFocusableElements = (root) => {
|
|
3343
|
+
// Check if current element is focusable
|
|
3344
|
+
if (root.nodeType === Node.ELEMENT_NODE) {
|
|
3345
|
+
// Check if this is a custom component that is focusable
|
|
3346
|
+
const isComponentFocusable = isFocusableComponent(root);
|
|
3347
|
+
|
|
3348
|
+
if (isComponentFocusable) {
|
|
3349
|
+
// Add the component itself as a focusable element and don't traverse its shadow DOM
|
|
3350
|
+
orderedFocusableElements.push(root);
|
|
3351
|
+
return; // Skip traversing inside this component
|
|
3352
|
+
}
|
|
3353
|
+
|
|
3354
|
+
// Check if the element itself matches any selector
|
|
3355
|
+
for (const selector of FOCUSABLE_SELECTORS) {
|
|
3356
|
+
if (root.matches?.(selector)) {
|
|
3357
|
+
orderedFocusableElements.push(root);
|
|
3358
|
+
break; // Once we know it's focusable, no need to check other selectors
|
|
3359
|
+
}
|
|
3360
|
+
}
|
|
3361
|
+
|
|
3362
|
+
// Process shadow DOM only for non-Auro components
|
|
3363
|
+
if (root.shadowRoot) {
|
|
3364
|
+
// Process shadow DOM children in order
|
|
3365
|
+
if (root.shadowRoot.children) {
|
|
3366
|
+
Array.from(root.shadowRoot.children).forEach(child => {
|
|
3367
|
+
collectFocusableElements(child);
|
|
3368
|
+
});
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3371
|
+
|
|
3372
|
+
// Process slots and their assigned nodes in order
|
|
3373
|
+
if (root.tagName === 'SLOT') {
|
|
3374
|
+
const assignedNodes = root.assignedNodes({ flatten: true });
|
|
3375
|
+
for (const node of assignedNodes) {
|
|
3376
|
+
collectFocusableElements(node);
|
|
3377
|
+
}
|
|
3378
|
+
} else {
|
|
3379
|
+
// Process light DOM children in order
|
|
3380
|
+
if (root.children) {
|
|
3381
|
+
Array.from(root.children).forEach(child => {
|
|
3382
|
+
collectFocusableElements(child);
|
|
3383
|
+
});
|
|
3384
|
+
}
|
|
3385
|
+
}
|
|
3386
|
+
}
|
|
3387
|
+
};
|
|
3388
|
+
|
|
3389
|
+
// Start the traversal from the container
|
|
3390
|
+
collectFocusableElements(container);
|
|
3391
|
+
|
|
3392
|
+
// Remove duplicates that might have been collected through different paths
|
|
3393
|
+
// while preserving order
|
|
3394
|
+
const uniqueElements = [];
|
|
3395
|
+
const seen = new Set();
|
|
3396
|
+
|
|
3397
|
+
for (const element of orderedFocusableElements) {
|
|
3398
|
+
if (!seen.has(element)) {
|
|
3399
|
+
seen.add(element);
|
|
3400
|
+
uniqueElements.push(element);
|
|
3401
|
+
}
|
|
3402
|
+
}
|
|
3403
|
+
|
|
3404
|
+
return uniqueElements;
|
|
3405
|
+
}
|
|
3406
|
+
|
|
3407
|
+
/**
|
|
3408
|
+
* FocusTrap manages keyboard focus within a specified container element, ensuring that focus does not leave the container when tabbing.
|
|
3409
|
+
* It is commonly used for modal dialogs or overlays to improve accessibility by trapping focus within interactive UI components.
|
|
3410
|
+
*/
|
|
3411
|
+
class FocusTrap {
|
|
3412
|
+
/**
|
|
3413
|
+
* Creates a new FocusTrap instance for the given container element.
|
|
3414
|
+
* Initializes event listeners and prepares the container for focus management.
|
|
3415
|
+
*
|
|
3416
|
+
* @param {HTMLElement} container The DOM element to trap focus within.
|
|
3417
|
+
* @throws {Error} If the provided container is not a valid HTMLElement.
|
|
3418
|
+
*/
|
|
3419
|
+
constructor(container) {
|
|
3420
|
+
if (!container || !(container instanceof HTMLElement)) {
|
|
3421
|
+
throw new Error("FocusTrap requires a valid HTMLElement.");
|
|
3422
|
+
}
|
|
3423
|
+
|
|
3424
|
+
this.container = container;
|
|
3425
|
+
this.tabDirection = 'forward'; // or 'backward'
|
|
3426
|
+
|
|
3427
|
+
this._init();
|
|
3428
|
+
}
|
|
3429
|
+
|
|
3430
|
+
/**
|
|
3431
|
+
* Initializes the focus trap by setting up event listeners and attributes on the container.
|
|
3432
|
+
* Prepares the container for focus management, including support for shadow DOM and inert attributes.
|
|
3433
|
+
*
|
|
3434
|
+
* @private
|
|
3435
|
+
*/
|
|
3436
|
+
_init() {
|
|
3437
|
+
|
|
3438
|
+
// Add inert attribute to prevent focusing programmatically as well (if supported)
|
|
3439
|
+
if ('inert' in HTMLElement.prototype) {
|
|
3440
|
+
this.container.inert = false; // Ensure the container isn't inert
|
|
3441
|
+
this.container.setAttribute('data-focus-trap-container', true); // Mark for identification
|
|
3442
|
+
}
|
|
3443
|
+
|
|
3444
|
+
// Track tab direction
|
|
3445
|
+
this.container.addEventListener('keydown', this._onKeydown);
|
|
3446
|
+
}
|
|
3447
|
+
|
|
3448
|
+
/**
|
|
3449
|
+
* Handles keydown events to manage tab navigation within the container.
|
|
3450
|
+
* Ensures that focus wraps around when reaching the first or last focusable element.
|
|
3451
|
+
*
|
|
3452
|
+
* @param {KeyboardEvent} e The keyboard event triggered by user interaction.
|
|
3453
|
+
* @private
|
|
3454
|
+
*/
|
|
3455
|
+
_onKeydown = (e) => {
|
|
3456
|
+
|
|
3457
|
+
if (e.key === 'Tab') {
|
|
3458
|
+
|
|
3459
|
+
// Set the tab direction based on the key pressed
|
|
3460
|
+
this.tabDirection = e.shiftKey ? 'backward' : 'forward';
|
|
3461
|
+
|
|
3462
|
+
// Get the active element(s) in the document and shadow root
|
|
3463
|
+
// This will include the active element in the shadow DOM if it exists
|
|
3464
|
+
// Active element may be inside the shadow DOM depending on delegatesFocus, so we need to check both
|
|
3465
|
+
let activeElement = document.activeElement;
|
|
3466
|
+
const actives = [activeElement];
|
|
3467
|
+
while (activeElement?.shadowRoot?.activeElement) {
|
|
3468
|
+
actives.push(activeElement.shadowRoot.activeElement);
|
|
3469
|
+
activeElement = activeElement.shadowRoot.activeElement;
|
|
3470
|
+
}
|
|
3471
|
+
|
|
3472
|
+
// Update the focusable elements
|
|
3473
|
+
const focusables = this._getFocusableElements();
|
|
3474
|
+
|
|
3475
|
+
// If we're at either end of the focusable elements, wrap around to the other end
|
|
3476
|
+
const focusIndex =
|
|
3477
|
+
(actives.includes(focusables[0]) || actives.includes(this.container)) && this.tabDirection === 'backward'
|
|
3478
|
+
? focusables.length - 1
|
|
3479
|
+
: actives.includes(focusables[focusables.length - 1]) && this.tabDirection === 'forward'
|
|
3480
|
+
? 0
|
|
3481
|
+
: null;
|
|
3482
|
+
|
|
3483
|
+
if (focusIndex !== null) {
|
|
3484
|
+
focusables[focusIndex].focus();
|
|
3485
|
+
e.preventDefault(); // Prevent default tab behavior
|
|
3486
|
+
e.stopPropagation(); // Stop the event from bubbling up
|
|
3487
|
+
}
|
|
3488
|
+
}
|
|
3489
|
+
};
|
|
3490
|
+
|
|
3491
|
+
/**
|
|
3492
|
+
* Retrieves all focusable elements within the container in DOM order, including those in shadow DOM and slots.
|
|
3493
|
+
* Returns a unique, ordered array of elements that can receive focus.
|
|
3494
|
+
*
|
|
3495
|
+
* @returns {Array<HTMLElement>} An array of focusable elements within the container.
|
|
3496
|
+
* @private
|
|
3497
|
+
*/
|
|
3498
|
+
_getFocusableElements() {
|
|
3499
|
+
// Use the imported utility function to get focusable elements
|
|
3500
|
+
const elements = getFocusableElements(this.container);
|
|
3501
|
+
|
|
3502
|
+
// Filter out any elements with the 'focus-bookend' class
|
|
3503
|
+
return elements;
|
|
3504
|
+
}
|
|
3505
|
+
|
|
3506
|
+
/**
|
|
3507
|
+
* Moves focus to the first focusable element within the container.
|
|
3508
|
+
* Useful for setting initial focus when activating the focus trap.
|
|
3509
|
+
*/
|
|
3510
|
+
focusFirstElement() {
|
|
3511
|
+
const focusables = this._getFocusableElements();
|
|
3512
|
+
if (focusables.length) focusables[0].focus();
|
|
3513
|
+
}
|
|
3514
|
+
|
|
3515
|
+
/**
|
|
3516
|
+
* Moves focus to the last focusable element within the container.
|
|
3517
|
+
* Useful for setting focus when deactivating or cycling focus in reverse.
|
|
3518
|
+
*/
|
|
3519
|
+
focusLastElement() {
|
|
3520
|
+
const focusables = this._getFocusableElements();
|
|
3521
|
+
if (focusables.length) focusables[focusables.length - 1].focus();
|
|
3522
|
+
}
|
|
3523
|
+
|
|
3524
|
+
/**
|
|
3525
|
+
* Removes event listeners and attributes added by the focus trap.
|
|
3526
|
+
* Call this method to clean up when the focus trap is no longer needed.
|
|
3527
|
+
*/
|
|
3528
|
+
disconnect() {
|
|
3529
|
+
|
|
3530
|
+
if (this.container.hasAttribute('data-focus-trap-container')) {
|
|
3531
|
+
this.container.removeAttribute('data-focus-trap-container');
|
|
3532
|
+
}
|
|
3533
|
+
|
|
3534
|
+
this.container.removeEventListener('keydown', this._onKeydown);
|
|
3535
|
+
}
|
|
3536
|
+
}
|
|
3537
|
+
|
|
3277
3538
|
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
3278
3539
|
// See LICENSE in the project root for license information.
|
|
3279
3540
|
|
|
@@ -3912,11 +4173,11 @@ var dropdownVersion$1 = '3.0.0';
|
|
|
3912
4173
|
|
|
3913
4174
|
var shapeSizeCss = i$5`.wrapper{overflow:hidden}.shape-classic-xl,.shape-classic-lg,.shape-classic-md,.shape-classic-sm,.shape-classic-xs{min-height:58px;max-height:58px;border-style:solid;border-width:1px;border-radius:var(--ds-border-radius, 0.375rem)}.shape-classic-xl.simple,.shape-classic-lg.simple,.shape-classic-md.simple,.shape-classic-sm.simple,.shape-classic-xs.simple{border-width:0px;min-height:60px;max-height:60px;background-color:unset;box-shadow:none}.shape-classic-xl.thin,.shape-classic-lg.thin,.shape-classic-md.thin,.shape-classic-sm.thin,.shape-classic-xs.thin{border-width:1px;min-height:58px;max-height:58px;background-color:unset}.shape-classic-xl.parentBorder,.shape-classic-lg.parentBorder,.shape-classic-md.parentBorder,.shape-classic-sm.parentBorder,.shape-classic-xs.parentBorder{border:0;box-shadow:unset;min-height:56px;max-height:56px}.shape-snowflake-xl,.shape-snowflake-lg,.shape-snowflake-md,.shape-snowflake-sm,.shape-snowflake-xs{min-height:56px;max-height:56px;border-style:solid;border-width:2px;border-color:transparent;border-radius:30px}.shape-snowflake-xl.simple,.shape-snowflake-lg.simple,.shape-snowflake-md.simple,.shape-snowflake-sm.simple,.shape-snowflake-xs.simple{border-width:0px;min-height:60px;max-height:60px;background-color:unset;box-shadow:none}.shape-snowflake-xl.thin,.shape-snowflake-lg.thin,.shape-snowflake-md.thin,.shape-snowflake-sm.thin,.shape-snowflake-xs.thin{border-width:1px;min-height:58px;max-height:58px;background-color:unset}.shape-snowflake-xl.parentBorder,.shape-snowflake-lg.parentBorder,.shape-snowflake-md.parentBorder,.shape-snowflake-sm.parentBorder,.shape-snowflake-xs.parentBorder{border:0;box-shadow:unset;min-height:56px;max-height:56px}.shape-box-xl{min-height:68px;max-height:68px;border-style:solid;border-width:2px;border-color:transparent}.shape-box-xl.simple{border-width:0px;min-height:72px;max-height:72px;background-color:unset;box-shadow:none}.shape-box-xl.thin{border-width:1px;min-height:70px;max-height:70px;background-color:unset}.shape-box-xl.parentBorder{border:0;box-shadow:unset;min-height:68px;max-height:68px}.shape-rounded-lg{min-height:56px;max-height:56px;border-style:solid;border-width:2px;border-color:transparent;border-radius:6px}.shape-rounded-lg.simple{border-width:0px;min-height:56px;max-height:56px;background-color:unset;box-shadow:none}.shape-rounded-lg.thin{border-width:1px;min-height:54px;max-height:54px;background-color:unset}.shape-rounded-lg.parentBorder{border:0;box-shadow:unset;min-height:52px;max-height:52px}.shape-pill-xl{min-height:68px;max-height:68px;border-style:solid;border-width:2px;border-color:transparent;border-radius:36px}.shape-pill-xl.simple{border-width:0px;min-height:72px;max-height:72px;background-color:unset;box-shadow:none}.shape-pill-xl.thin{border-width:1px;min-height:70px;max-height:70px;background-color:unset}.shape-pill-xl.parentBorder{border:0;box-shadow:unset;min-height:68px;max-height:68px}.shape-pill-left-xl{min-height:68px;max-height:68px;border-style:solid;border-width:2px;border-color:transparent;border-radius:36px 0 0 36px}.shape-pill-left-xl.simple{border-width:0px;min-height:72px;max-height:72px;background-color:unset;box-shadow:none}.shape-pill-left-xl.thin{border-width:1px;min-height:70px;max-height:70px;background-color:unset}.shape-pill-left-xl.parentBorder{border:0;box-shadow:unset;min-height:68px;max-height:68px}.shape-pill-right-xl{min-height:68px;max-height:68px;border-style:solid;border-width:2px;border-color:transparent;border-radius:0 36px 36px 0}.shape-pill-right-xl.simple{border-width:0px;min-height:72px;max-height:72px;background-color:unset;box-shadow:none}.shape-pill-right-xl.thin{border-width:1px;min-height:70px;max-height:70px;background-color:unset}.shape-pill-right-xl.parentBorder{border:0;box-shadow:unset;min-height:68px;max-height:68px}.shape-pill-md{min-height:44px;max-height:44px;border-style:solid;border-width:2px;border-color:transparent;border-radius:36px}.shape-pill-md.simple{border-width:0px;min-height:48px;max-height:48px;background-color:unset;box-shadow:none}.shape-pill-md.thin{border-width:1px;min-height:46px;max-height:46px;background-color:unset}.shape-pill-md.parentBorder{border:0;box-shadow:unset;min-height:44px;max-height:44px}.shape-pill-left-md{min-height:44px;max-height:44px;border-style:solid;border-width:2px;border-color:transparent;border-radius:36px 0 0 36px}.shape-pill-left-md.simple{border-width:0px;min-height:48px;max-height:48px;background-color:unset;box-shadow:none}.shape-pill-left-md.thin{border-width:1px;min-height:46px;max-height:46px;background-color:unset}.shape-pill-left-md.parentBorder{border:0;box-shadow:unset;min-height:44px;max-height:44px}.shape-pill-right-md{min-height:44px;max-height:44px;border-style:solid;border-width:2px;border-color:transparent;border-radius:0 36px 36px 0}.shape-pill-right-md.simple{border-width:0px;min-height:48px;max-height:48px;background-color:unset;box-shadow:none}.shape-pill-right-md.thin{border-width:1px;min-height:46px;max-height:46px;background-color:unset}.shape-pill-right-md.parentBorder{border:0;box-shadow:unset;min-height:44px;max-height:44px}`;
|
|
3914
4175
|
|
|
3915
|
-
var colorCss$1$2 = i$5`:host(:not([ondark])) .wrapper{border-color:var(--ds-auro-dropdown-trigger-border-color);background-color:var(--ds-auro-dropdown-trigger-background-color);color:var(--ds-auro-dropdown-trigger-text-color)}:host(:not([ondark])) .wrapper:focus-within,:host(:not([ondark])) .wrapper:active{--ds-auro-dropdown-trigger-border-color: var(--ds-advanced-color-state-focused, #01426a);--ds-auro-dropdown-trigger-outline-color: var(--ds-advanced-color-state-focused, #01426a)}:host(:not([onDark])[disabled]){--ds-auro-dropdown-trigger-text-color: var(--ds-basic-color-texticon-disabled, #d0d0d0);--ds-auro-dropdown-label-text-color: var(--ds-basic-color-texticon-disabled, #d0d0d0);--ds-auro-dropdown-trigger-border-color: var(--ds-basic-color-border-subtle, #dddddd)}:host(:not([ondark])[error]){--ds-auro-dropdown-trigger-border-color: var(--ds-basic-color-status-error, #e31f26)}:host([onDark]) .label{color:var(--ds-auro-dropdown-label-text-color)}:host([onDark]) .wrapper{border-color:var(--ds-auro-dropdown-trigger-border-color);background-color:var(--ds-auro-dropdown-trigger-background-color);color:var(--ds-auro-dropdown-trigger-text-color)}:host([onDark]) .wrapper:focus-within,:host([onDark]) .wrapper:active{--ds-auro-dropdown-trigger-border-color: var(--ds-advanced-color-state-focused-inverse, #ffffff);--ds-auro-dropdown-trigger-outline-color: var(--ds-advanced-color-state-focused-inverse, #ffffff)}:host([onDark][disabled]){--ds-auro-dropdown-trigger-text-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894);--ds-auro-dropdown-label-text-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894);--ds-auro-dropdown-trigger-container-color: var(--ds-advanced-color-shared-background-inverse-disabled, rgba(255, 255, 255, 0.1))}:host([ondark][error]){--ds-auro-dropdown-trigger-border-color: var(--ds-basic-color-status-error-subtle, #fbc6c6)}`;
|
|
4176
|
+
var colorCss$1$2 = i$5`:host(:not([layout*=classic])){--ds-auro-dropdown-trigger-border-color: transparent}:host(:not([ondark])) .wrapper{border-color:var(--ds-auro-dropdown-trigger-border-color);background-color:var(--ds-auro-dropdown-trigger-background-color);color:var(--ds-auro-dropdown-trigger-text-color)}:host(:not([ondark])) .wrapper:focus-within,:host(:not([ondark])) .wrapper:active{--ds-auro-dropdown-trigger-border-color: var(--ds-advanced-color-state-focused, #01426a);--ds-auro-dropdown-trigger-outline-color: var(--ds-advanced-color-state-focused, #01426a)}:host(:not([onDark])[disabled]){--ds-auro-dropdown-trigger-text-color: var(--ds-basic-color-texticon-disabled, #d0d0d0);--ds-auro-dropdown-label-text-color: var(--ds-basic-color-texticon-disabled, #d0d0d0);--ds-auro-dropdown-trigger-border-color: var(--ds-basic-color-border-subtle, #dddddd)}:host(:not([ondark])[error]){--ds-auro-dropdown-trigger-border-color: var(--ds-basic-color-status-error, #e31f26)}:host([onDark]) .label{color:var(--ds-auro-dropdown-label-text-color)}:host([onDark]) .wrapper{border-color:var(--ds-auro-dropdown-trigger-border-color);background-color:var(--ds-auro-dropdown-trigger-background-color);color:var(--ds-auro-dropdown-trigger-text-color)}:host([onDark]) .wrapper:focus-within,:host([onDark]) .wrapper:active{--ds-auro-dropdown-trigger-border-color: var(--ds-advanced-color-state-focused-inverse, #ffffff);--ds-auro-dropdown-trigger-outline-color: var(--ds-advanced-color-state-focused-inverse, #ffffff)}:host([onDark][disabled]){--ds-auro-dropdown-trigger-text-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894);--ds-auro-dropdown-label-text-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894);--ds-auro-dropdown-trigger-container-color: var(--ds-advanced-color-shared-background-inverse-disabled, rgba(255, 255, 255, 0.1))}:host([ondark][error]){--ds-auro-dropdown-trigger-border-color: var(--ds-basic-color-status-error-subtle, #fbc6c6)}`;
|
|
3916
4177
|
|
|
3917
4178
|
var classicColorCss = i$5``;
|
|
3918
4179
|
|
|
3919
|
-
var classicLayoutCss = i$5`:host([layout*=classic]){position:relative;max-width:100%}:host([layout*=classic]) #bibSizer{position:absolute;z-index:-1;opacity:0;pointer-events:none}:host([layout*=classic]) .label{font-size:var(--ds-text-body-size-xs, 0.75rem);line-height:var(--ds-text-body-size-default, 1rem);transition:font-size .3s cubic-bezier(0.215, 0.61, 0.355, 1);white-space:normal}:host([layout*=classic]) .label[hasTrigger=false]{font-size:var(--ds-text-body-size-default, 1rem)}:host([layout*=classic]) .wrapper{display:flex;flex-direction:row;box-shadow:inset 0 0 0 1px var(--ds-auro-dropdown-trigger-outline-color)}@media(hover: hover){:host([layout*=classic]) .wrapper:hover{cursor:pointer}}:host([layout*=classic]) .triggerContentWrapper{overflow:hidden;flex:1;justify-content:start;text-overflow:ellipsis;white-space:nowrap}:host([layout*=classic]) #showStateIcon{display:flex;overflow:hidden;height:100%;align-items:center;padding-right:var(--ds-size-150, 0.75rem)}:host([layout*=classic]) #showStateIcon [auro-icon]{height:var(--ds-size-300, 1.5rem);line-height:var(--ds-size-300, 1.5rem)}:host([layout*=classic]) #showStateIcon[data-expanded=true] [auro-icon]{transform:rotate(-180deg)}:host([
|
|
4180
|
+
var classicLayoutCss = i$5`:host([layout*=classic]){position:relative;max-width:100%}:host([layout*=classic]) #bibSizer{position:absolute;z-index:-1;opacity:0;pointer-events:none}:host([layout*=classic]) .label{font-size:var(--ds-text-body-size-xs, 0.75rem);line-height:var(--ds-text-body-size-default, 1rem);transition:font-size .3s cubic-bezier(0.215, 0.61, 0.355, 1);white-space:normal}:host([layout*=classic]) .label[hasTrigger=false]{font-size:var(--ds-text-body-size-default, 1rem)}:host([layout*=classic]) .wrapper{display:flex;flex-direction:row;box-shadow:inset 0 0 0 1px var(--ds-auro-dropdown-trigger-outline-color)}@media(hover: hover){:host([layout*=classic]) .wrapper:hover{cursor:pointer}}:host([layout*=classic]) .triggerContentWrapper{overflow:hidden;flex:1;justify-content:start;text-overflow:ellipsis;white-space:nowrap}:host([layout*=classic]) #showStateIcon{display:flex;overflow:hidden;height:100%;align-items:center;padding-right:var(--ds-size-150, 0.75rem)}:host([layout*=classic]) #showStateIcon [auro-icon]{height:var(--ds-size-300, 1.5rem);line-height:var(--ds-size-300, 1.5rem)}:host([layout*=classic]) #showStateIcon[data-expanded=true] [auro-icon]{transform:rotate(-180deg)}:host([matchwidth]) #bibSizer{width:100%}`;
|
|
3920
4181
|
|
|
3921
4182
|
var styleEmphasizedCss = i$5`:host{display:block}.layout-emphasized .chevron,.layout-emphasized-left .chevron,.layout-emphasized-right .chevron{margin-right:var(--ds-size-300, 1.5rem)}.wrapper{display:flex;flex:1;flex-direction:row;align-items:center;justify-content:center;outline:none}.triggerContentWrapper{display:flex;overflow:hidden;width:100%;flex:1;align-items:center;justify-content:center;text-overflow:ellipsis;white-space:nowrap}:host([layout*=emphasized][shape*=pill]:not([layout*=right])) .leftIndent{width:calc(100% - var(--ds-size-300, 1.5rem));margin-left:var(--ds-size-300, 1.5rem)}:host([layout*=emphasized][shape*=pill]:not([layout*=left])) .rightIndent{width:calc(100% - var(--ds-size-300, 1.5rem));margin-right:var(--ds-size-300, 1.5rem)}:host([layout*=emphasized][shape*=pill]:not([layout*=left]):not([layout*=right])) .rightIndent{width:calc(100% - var(--ds-size-600, 3rem));margin-right:var(--ds-size-300, 1.5rem)}`;
|
|
3922
4183
|
|
|
@@ -3924,7 +4185,7 @@ var styleSnowflakeCss = i$5`:host{display:block}.wrapper{display:flex;flex:1;fle
|
|
|
3924
4185
|
|
|
3925
4186
|
var colorCss$5 = 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)}`;
|
|
3926
4187
|
|
|
3927
|
-
var styleCss$6 = i$5
|
|
4188
|
+
var styleCss$6 = 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}`;
|
|
3928
4189
|
|
|
3929
4190
|
var tokensCss$4 = i$5`:host{--ds-auro-helptext-color: var(--ds-basic-color-texticon-muted, #676767)}`;
|
|
3930
4191
|
|
|
@@ -4229,10 +4490,8 @@ let AuroElement$3 = class AuroElement extends i$2 {
|
|
|
4229
4490
|
// See LICENSE in the project root for license information.
|
|
4230
4491
|
|
|
4231
4492
|
|
|
4232
|
-
|
|
4233
|
-
* @attr { Boolean } disableEventShow - If declared, the dropdown will only show by calling the API .show() public method.
|
|
4493
|
+
/*
|
|
4234
4494
|
* @slot - Default slot for the popover content.
|
|
4235
|
-
* @slot label - Defines the content of the label.
|
|
4236
4495
|
* @slot helpText - Defines the content of the helpText.
|
|
4237
4496
|
* @slot trigger - Defines the content of the trigger.
|
|
4238
4497
|
* @csspart trigger - The trigger content container.
|
|
@@ -4251,18 +4510,22 @@ class AuroDropdown extends AuroElement$3 {
|
|
|
4251
4510
|
this.matchWidth = false;
|
|
4252
4511
|
this.noHideOnThisFocusLoss = false;
|
|
4253
4512
|
|
|
4254
|
-
this.errorMessage =
|
|
4513
|
+
this.errorMessage = undefined; // TODO - check with Doug if there is still more to do here
|
|
4255
4514
|
|
|
4256
4515
|
// Layout Config
|
|
4257
|
-
this.layout =
|
|
4258
|
-
this.shape =
|
|
4259
|
-
this.size =
|
|
4516
|
+
this.layout = undefined;
|
|
4517
|
+
this.shape = undefined;
|
|
4518
|
+
this.size = undefined;
|
|
4260
4519
|
|
|
4261
4520
|
this.parentBorder = false;
|
|
4262
4521
|
|
|
4263
4522
|
this.privateDefaults();
|
|
4264
4523
|
}
|
|
4265
4524
|
|
|
4525
|
+
/**
|
|
4526
|
+
* @private
|
|
4527
|
+
* @returns {object} Class definition for the wrapper element.
|
|
4528
|
+
*/
|
|
4266
4529
|
get commonWrapperClasses() {
|
|
4267
4530
|
return {
|
|
4268
4531
|
'trigger': true,
|
|
@@ -4280,13 +4543,10 @@ class AuroDropdown extends AuroElement$3 {
|
|
|
4280
4543
|
privateDefaults() {
|
|
4281
4544
|
this.chevron = false;
|
|
4282
4545
|
this.disabled = false;
|
|
4546
|
+
this.disableFocusTrap = false;
|
|
4283
4547
|
this.error = false;
|
|
4284
|
-
this.inset = false;
|
|
4285
|
-
this.rounded = false;
|
|
4286
4548
|
this.tabIndex = 0;
|
|
4287
4549
|
this.noToggle = false;
|
|
4288
|
-
this.a11yAutocomplete = 'none';
|
|
4289
|
-
this.labeled = true;
|
|
4290
4550
|
this.a11yRole = 'button';
|
|
4291
4551
|
this.onDark = false;
|
|
4292
4552
|
this.showTriggerBorders = true;
|
|
@@ -4382,6 +4642,18 @@ class AuroDropdown extends AuroElement$3 {
|
|
|
4382
4642
|
this.floater.showBib();
|
|
4383
4643
|
}
|
|
4384
4644
|
|
|
4645
|
+
/**
|
|
4646
|
+
* When bib is open, focus on the first element inside of bib.
|
|
4647
|
+
* If not, trigger element will get focus.
|
|
4648
|
+
*/
|
|
4649
|
+
focus() {
|
|
4650
|
+
if (this.isPopoverVisible && this.focusTrap) {
|
|
4651
|
+
this.focusTrap.focusFirstElement();
|
|
4652
|
+
} else {
|
|
4653
|
+
this.trigger.focus();
|
|
4654
|
+
}
|
|
4655
|
+
}
|
|
4656
|
+
|
|
4385
4657
|
// function to define props used within the scope of this component
|
|
4386
4658
|
static get properties() {
|
|
4387
4659
|
return {
|
|
@@ -4395,6 +4667,15 @@ class AuroDropdown extends AuroElement$3 {
|
|
|
4395
4667
|
reflect: true
|
|
4396
4668
|
},
|
|
4397
4669
|
|
|
4670
|
+
/**
|
|
4671
|
+
* If declared, the dropdown will only show by calling the API .show() public method.
|
|
4672
|
+
* @default false
|
|
4673
|
+
*/
|
|
4674
|
+
disableEventShow: {
|
|
4675
|
+
type: Boolean,
|
|
4676
|
+
reflect: true
|
|
4677
|
+
},
|
|
4678
|
+
|
|
4398
4679
|
/**
|
|
4399
4680
|
* If declared, applies a border around the trigger slot.
|
|
4400
4681
|
*/
|
|
@@ -4413,17 +4694,17 @@ class AuroDropdown extends AuroElement$3 {
|
|
|
4413
4694
|
},
|
|
4414
4695
|
|
|
4415
4696
|
/**
|
|
4416
|
-
* If declared, the dropdown
|
|
4697
|
+
* If declared, the dropdown is not interactive.
|
|
4417
4698
|
*/
|
|
4418
|
-
|
|
4699
|
+
disabled: {
|
|
4419
4700
|
type: Boolean,
|
|
4420
4701
|
reflect: true
|
|
4421
4702
|
},
|
|
4422
4703
|
|
|
4423
4704
|
/**
|
|
4424
|
-
* If declared, the
|
|
4705
|
+
* If declared, the focus trap inside of bib will be turned off.
|
|
4425
4706
|
*/
|
|
4426
|
-
|
|
4707
|
+
disableFocusTrap: {
|
|
4427
4708
|
type: Boolean,
|
|
4428
4709
|
reflect: true
|
|
4429
4710
|
},
|
|
@@ -4468,22 +4749,6 @@ class AuroDropdown extends AuroElement$3 {
|
|
|
4468
4749
|
reflect: true
|
|
4469
4750
|
},
|
|
4470
4751
|
|
|
4471
|
-
/**
|
|
4472
|
-
* Makes the trigger to be full width of its parent container.
|
|
4473
|
-
*/
|
|
4474
|
-
fluid: {
|
|
4475
|
-
type: Boolean,
|
|
4476
|
-
reflect: true
|
|
4477
|
-
},
|
|
4478
|
-
|
|
4479
|
-
/**
|
|
4480
|
-
* If declared, will apply padding around trigger slot content.
|
|
4481
|
-
*/
|
|
4482
|
-
inset: {
|
|
4483
|
-
type: Boolean,
|
|
4484
|
-
reflect: true
|
|
4485
|
-
},
|
|
4486
|
-
|
|
4487
4752
|
/**
|
|
4488
4753
|
* If true, the dropdown bib is displayed.
|
|
4489
4754
|
*/
|
|
@@ -4527,15 +4792,6 @@ class AuroDropdown extends AuroElement$3 {
|
|
|
4527
4792
|
reflect: true
|
|
4528
4793
|
},
|
|
4529
4794
|
|
|
4530
|
-
/**
|
|
4531
|
-
* Defines if there is a label preset.
|
|
4532
|
-
* @private
|
|
4533
|
-
*/
|
|
4534
|
-
labeled: {
|
|
4535
|
-
type: Boolean,
|
|
4536
|
-
reflect: true
|
|
4537
|
-
},
|
|
4538
|
-
|
|
4539
4795
|
/**
|
|
4540
4796
|
* Defines if the trigger should size based on the parent element providing the border UI.
|
|
4541
4797
|
* @private
|
|
@@ -4596,6 +4852,9 @@ class AuroDropdown extends AuroElement$3 {
|
|
|
4596
4852
|
reflect: true
|
|
4597
4853
|
},
|
|
4598
4854
|
|
|
4855
|
+
/**
|
|
4856
|
+
* If declared, and a function is set, that function will execute when the slot content is updated.
|
|
4857
|
+
*/
|
|
4599
4858
|
onSlotChange: {
|
|
4600
4859
|
type: Function,
|
|
4601
4860
|
reflect: false
|
|
@@ -4610,14 +4869,6 @@ class AuroDropdown extends AuroElement$3 {
|
|
|
4610
4869
|
reflect: true
|
|
4611
4870
|
},
|
|
4612
4871
|
|
|
4613
|
-
/**
|
|
4614
|
-
* If declared, will apply border-radius to trigger and default slots.
|
|
4615
|
-
*/
|
|
4616
|
-
rounded: {
|
|
4617
|
-
type: Boolean,
|
|
4618
|
-
reflect: true
|
|
4619
|
-
},
|
|
4620
|
-
|
|
4621
4872
|
/**
|
|
4622
4873
|
* @private
|
|
4623
4874
|
*/
|
|
@@ -4632,22 +4883,14 @@ class AuroDropdown extends AuroElement$3 {
|
|
|
4632
4883
|
type: String || undefined,
|
|
4633
4884
|
attribute: false,
|
|
4634
4885
|
reflect: false
|
|
4635
|
-
},
|
|
4636
|
-
|
|
4637
|
-
/**
|
|
4638
|
-
* The value for the aria-autocomplete attribute of the trigger element.
|
|
4639
|
-
*/
|
|
4640
|
-
a11yAutocomplete: {
|
|
4641
|
-
type: String,
|
|
4642
|
-
attribute: false,
|
|
4643
4886
|
}
|
|
4644
4887
|
};
|
|
4645
4888
|
}
|
|
4646
4889
|
|
|
4647
4890
|
static get styles() {
|
|
4648
4891
|
return [
|
|
4649
|
-
colorCss$1$2,
|
|
4650
4892
|
tokensCss$1$2,
|
|
4893
|
+
colorCss$1$2,
|
|
4651
4894
|
|
|
4652
4895
|
// default layout
|
|
4653
4896
|
classicColorCss,
|
|
@@ -4710,6 +4953,12 @@ class AuroDropdown extends AuroElement$3 {
|
|
|
4710
4953
|
this.handleTriggerContentSlotChange();
|
|
4711
4954
|
}
|
|
4712
4955
|
|
|
4956
|
+
if (changedProperties.has('isPopoverVisible')) {
|
|
4957
|
+
this.updateFocusTrap();
|
|
4958
|
+
if (!this.isPopoverVisible && this.hasFocus) {
|
|
4959
|
+
this.trigger.focus();
|
|
4960
|
+
}
|
|
4961
|
+
}
|
|
4713
4962
|
}
|
|
4714
4963
|
|
|
4715
4964
|
firstUpdated() {
|
|
@@ -4775,6 +5024,27 @@ class AuroDropdown extends AuroElement$3 {
|
|
|
4775
5024
|
this.hasFocus = true;
|
|
4776
5025
|
}
|
|
4777
5026
|
|
|
5027
|
+
/**
|
|
5028
|
+
* @private
|
|
5029
|
+
*/
|
|
5030
|
+
updateFocusTrap() {
|
|
5031
|
+
// If the dropdown is open, create a focus trap and focus the first element
|
|
5032
|
+
if (this.isPopoverVisible && !this.disableFocusTrap) {
|
|
5033
|
+
this.focusTrap = new FocusTrap(this.bibContent);
|
|
5034
|
+
this.focusTrap.focusFirstElement();
|
|
5035
|
+
return;
|
|
5036
|
+
}
|
|
5037
|
+
|
|
5038
|
+
// Guard Clause: Ensure there is a focus trap currently active before continuing
|
|
5039
|
+
if (!this.focusTrap) {
|
|
5040
|
+
return;
|
|
5041
|
+
}
|
|
5042
|
+
|
|
5043
|
+
// If the dropdown is not open, disconnect the focus trap if it exists
|
|
5044
|
+
this.focusTrap.disconnect();
|
|
5045
|
+
this.focusTrap = undefined;
|
|
5046
|
+
}
|
|
5047
|
+
|
|
4778
5048
|
/**
|
|
4779
5049
|
* Function to support @focusout event.
|
|
4780
5050
|
* @private
|
|
@@ -5060,10 +5330,7 @@ class AuroDropdown extends AuroElement$3 {
|
|
|
5060
5330
|
id="bib"
|
|
5061
5331
|
shape="${this.shape}"
|
|
5062
5332
|
?data-show="${this.isPopoverVisible}"
|
|
5063
|
-
?isfullscreen="${this.isBibFullscreen}"
|
|
5064
|
-
?common="${this.common}"
|
|
5065
|
-
?rounded="${this.common || this.rounded}"
|
|
5066
|
-
?inset="${this.common || this.inset}">
|
|
5333
|
+
?isfullscreen="${this.isBibFullscreen}">
|
|
5067
5334
|
<div class="slotContent">
|
|
5068
5335
|
<slot @slotchange="${this.handleDefaultSlot}"></slot>
|
|
5069
5336
|
</div>
|
|
@@ -7044,7 +7311,7 @@ class AuroBibtemplate extends i$2 {
|
|
|
7044
7311
|
<div id="bibTemplate" part="bibtemplate">
|
|
7045
7312
|
${this.isFullscreen ? u`
|
|
7046
7313
|
<div id="headerContainer">
|
|
7047
|
-
<${this.buttonTag} id="closeButton" variant="ghost" shape="circle" size="sm" @click="${this.onCloseButtonClick}">
|
|
7314
|
+
<${this.buttonTag} id="closeButton" aria-label="Close" variant="ghost" shape="circle" size="sm" @click="${this.onCloseButtonClick}">
|
|
7048
7315
|
<${this.iconTag} category="interface" name="x-lg"></${this.iconTag}>
|
|
7049
7316
|
</${this.buttonTag}>
|
|
7050
7317
|
<${this.headerTag} display="${this.large ? 'display' : '600'}" level="3" size="none" id="header" no-margin-block>
|
|
@@ -7072,7 +7339,7 @@ var bibTemplateVersion = '1.0.0';
|
|
|
7072
7339
|
|
|
7073
7340
|
var colorCss$3 = 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)}`;
|
|
7074
7341
|
|
|
7075
|
-
var styleCss$4 = i$5
|
|
7342
|
+
var styleCss$4 = 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}`;
|
|
7076
7343
|
|
|
7077
7344
|
var tokensCss$2 = i$5`:host{--ds-auro-helptext-color: var(--ds-basic-color-texticon-muted, #676767)}`;
|
|
7078
7345
|
|
|
@@ -7278,68 +7545,7 @@ class AuroHelpText extends i$2 {
|
|
|
7278
7545
|
|
|
7279
7546
|
var helpTextVersion = '1.0.0';
|
|
7280
7547
|
|
|
7281
|
-
i$5
|
|
7282
|
-
|
|
7283
|
-
i$5`:host ::slotted(hr){border-top-color:var(--ds-auro-menu-divider-color)}[loadingplaceholder] slot[name=loadingIcon]{color:var(--ds-auro-menu-loader-color)}[loadingplaceholder] slot[name=loadingText]{color:var(--ds-auro-menu-loader-text-color)}`;
|
|
7284
|
-
|
|
7285
|
-
i$5`:host{--ds-auro-menu-divider-color: var(--ds-basic-color-border-divider, rgba(0, 0, 0, 0.15));--ds-auro-menu-loader-color: var(--ds-basic-color-brand-primary, #01426a);--ds-auro-menu-loader-text-color: var(--ds-basic-color-texticon-default, #2a2a2a);--ds-auro-menuoption-container-color: transparent;--ds-auro-menuoption-container-border-color: var(--ds-auro-menuoption-container-color);--ds-auro-menuoption-icon-color: transparent;--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}`;
|
|
7286
|
-
|
|
7287
|
-
// Copyright (c) 2021 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
7288
|
-
// See LICENSE in the project root for license information.
|
|
7289
|
-
|
|
7290
|
-
// ---------------------------------------------------------------------
|
|
7291
|
-
|
|
7292
|
-
/**
|
|
7293
|
-
* Converts value to an array.
|
|
7294
|
-
* If the value is a JSON string representing an array, it will be parsed.
|
|
7295
|
-
* If the value is already an array, it is returned.
|
|
7296
|
-
* If the value is undefined, it returns undefined.
|
|
7297
|
-
* @private
|
|
7298
|
-
* @param {any} value - The value to be converted. Can be a string, array, or undefined.
|
|
7299
|
-
* @returns {Array|undefined} - The converted array or undefined.
|
|
7300
|
-
* @throws {Error} - Throws an error if the value is not an array, undefined,
|
|
7301
|
-
* or if the value cannot be parsed into an array from a JSON string.
|
|
7302
|
-
*/
|
|
7303
|
-
function arrayConverter(value) {
|
|
7304
|
-
// Allow undefined
|
|
7305
|
-
if (value === undefined) {
|
|
7306
|
-
return undefined;
|
|
7307
|
-
}
|
|
7308
|
-
|
|
7309
|
-
// Return the value if it is already an array
|
|
7310
|
-
if (Array.isArray(value)) {
|
|
7311
|
-
return value;
|
|
7312
|
-
}
|
|
7313
|
-
|
|
7314
|
-
try {
|
|
7315
|
-
// If value is a JSON string, parse it
|
|
7316
|
-
const parsed = typeof value === 'string' ? JSON.parse(value) : value;
|
|
7317
|
-
|
|
7318
|
-
// Check if the parsed value is an array
|
|
7319
|
-
if (Array.isArray(parsed)) {
|
|
7320
|
-
return parsed;
|
|
7321
|
-
}
|
|
7322
|
-
} catch (error) {
|
|
7323
|
-
// If JSON parsing fails, continue to throw an error below
|
|
7324
|
-
/* eslint-disable no-console */
|
|
7325
|
-
console.error('JSON parsing failed:', error);
|
|
7326
|
-
}
|
|
7327
|
-
|
|
7328
|
-
// Throw error if the input is not an array or undefined
|
|
7329
|
-
throw new Error('Invalid value: Input must be an array or undefined');
|
|
7330
|
-
}
|
|
7331
|
-
|
|
7332
|
-
i$5`:host{cursor:pointer;user-select:none}:host .wrapper{display:flex;align-items:center;padding-right:var(--ds-size-200, 1rem);padding-left:calc(var(--ds-size-150, 0.75rem) + 24px + var(--ds-size-100, 0.5rem));padding-top:var(--ds-size-50, 0.25rem);padding-bottom:var(--ds-size-50, 0.25rem);-webkit-tap-highlight-color:transparent}:host .wrapper[class*=shape-box],:host .wrapper[class*=shape-snowflake]{border-radius:unset}:host .wrapper[class*=shape-pill]{border-radius:30px}:host .wrapper[class*=-lg]{font-size:var(--ds-text-body-size-lg, 1.125rem);line-height:var(--ds-text-body-height-lg, 1.625rem);padding-top:var(--ds-size-75, 0.375rem);padding-bottom:var(--ds-size-75, 0.375rem);padding-right:var(--ds-size-150, 0.75rem)}:host .wrapper[class*=-lg]:not(:last-child){margin-bottom:var(--ds-size-50, 0.25rem)}:host .wrapper[class*=-xl]{font-size:var(--ds-text-body-size-lg, 1.125rem);line-height:var(--ds-text-body-height-lg, 1.625rem);padding-top:var(--ds-size-100, 0.5rem);padding-bottom:var(--ds-size-100, 0.5rem);padding-right:var(--ds-size-200, 1rem)}:host .wrapper[class*=-xl]:not(:last-child){margin-bottom:var(--ds-size-100, 0.5rem)}:host slot{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host [auro-icon]{--ds-auro-icon-size: var(--ds-size-300, 1.5rem);margin-right:var(--ds-size-150, 0.75rem);margin-left:var(--ds-size-100, 0.5rem)}:host ::slotted(.nestingSpacer){display:inline-block;width:var(--ds-size-300, 1.5rem)}:host ::slotted(strong){font-weight:700}:host([loadingplaceholder]) .wrapper{padding-left:calc(var(--ds-size-150, 0.75rem) + 24px + var(--ds-size-100, 0.5rem))}:host([selected]) .wrapper{padding-left:0}:host([nocheckmark]) .wrapper{padding-left:var(--ds-size-150, 0.75rem)}:host([nocheckmark]) .wrapper[class*=-lg]{padding-left:var(--ds-size-150, 0.75rem)}:host([nocheckmark]) .wrapper[class*=-xl]{padding-left:var(--ds-size-200, 1rem)}:host([hidden]){display:none}:host([static]){pointer-events:none}:host([disabled]:hover){cursor:auto}:host([disabled]){user-select:none;pointer-events:none}`;
|
|
7333
|
-
|
|
7334
|
-
i$5`:host .wrapper{border:1px solid var(--ds-auro-menuoption-container-border-color);background-color:var(--ds-auro-menuoption-container-color);color:var(--ds-auro-menuoption-text-color)}:host svg{fill:var(--ds-auro-menuoption-icon-color)}:host([disabled]){--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host(:hover),:host(.active){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-neutral-subtle, #f7f7f7)}:host([selected]){--ds-auro-menuoption-container-color: var(--ds-advanced-color-state-selected, #01426a);--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-inverse, #ffffff);--ds-auro-menuoption-icon-color: var(--ds-basic-color-texticon-inverse, #ffffff)}:host([selected]):host(:hover),:host([selected]):host(.active){--ds-auro-menuoption-container-color: var(--ds-advanced-color-state-selected-hover, #00274a)}`;
|
|
7335
|
-
|
|
7336
|
-
i$5`:focus:not(:focus-visible){outline:3px solid transparent}.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock,:host{display:block}.util_displayFlex{display:flex}.util_displayHidden,:host([hidden]:not(:focus):not(:active)){display:none}.util_displayHiddenVisually,:host([hiddenVisually]:not(:focus):not(:active)){position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}.ico_squareLarge{fill:currentColor;height:var(--auro-size-lg, var(--ds-size-300, 1.5rem))}.ico_squareSmall{fill:currentColor;height:.6rem}.ico_squareMed{fill:currentColor;height:var(--auro-size-md, var(--ds-size-200, 1rem))}.ico_squareSml{fill:currentColor;height:var(--auro-size-sm, var(--ds-size-150, 0.75rem))}:host{color:currentColor;vertical-align:middle;line-height:1;display:inline-block}svg{min-width:var(--ds-auro-icon-size, 1.5rem) !important;width:var(--ds-auro-icon-size, 1.5rem) !important;height:var(--ds-auro-icon-size, 1.5rem) !important}.componentWrapper{display:flex}.svgWrapper{height:var(--ds-auro-icon-size);width:var(--ds-auro-icon-size)}.labelWrapper{margin-left:var(--ds-size-50, 0.25rem);line-height:1.8}`;
|
|
7337
|
-
|
|
7338
|
-
i$5`:host{--ds-auro-icon-color:var(--ds-basic-color-texticon-default, #2a2a2a);--ds-auro-alaska-color:#02426D;--ds-auro-icon-size:var(--ds-size-300, 1.5rem)}`;
|
|
7339
|
-
|
|
7340
|
-
i$5`:host{color:var(--ds-auro-icon-color)}:host([customColor]){color:inherit}:host(:not([onDark])[variant=accent1]){--ds-auro-icon-color:var(--ds-basic-color-texticon-accent1, #265688)}:host(:not([onDark])[variant=disabled]){--ds-auro-icon-color:var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host(:not([onDark])[variant=muted]){--ds-auro-icon-color:var(--ds-basic-color-texticon-muted, #676767)}:host(:not([onDark])[variant=statusDefault]){--ds-auro-icon-color:var(--ds-basic-color-status-default, #afb9c6)}:host(:not([onDark])[variant=statusInfo]){--ds-auro-icon-color:var(--ds-basic-color-status-info, #01426a)}:host(:not([onDark])[variant=statusSuccess]){--ds-auro-icon-color:var(--ds-basic-color-status-success, #447a1f)}:host(:not([onDark])[variant=statusWarning]){--ds-auro-icon-color:var(--ds-basic-color-status-warning, #fac200)}:host(:not([onDark])[variant=statusError]){--ds-auro-icon-color:var(--ds-basic-color-status-error, #e31f26)}:host(:not([onDark])[variant=statusInfoSubtle]){--ds-auro-icon-color:var(--ds-basic-color-status-info-subtle, #ebf3f9)}:host(:not([onDark])[variant=statusSuccessSubtle]){--ds-auro-icon-color:var(--ds-basic-color-status-success-subtle, #d6eac7)}:host(:not([onDark])[variant=statusWarningSubtle]){--ds-auro-icon-color:var(--ds-basic-color-status-warning-subtle, #fff0b2)}:host(:not([onDark])[variant=statusErrorSubtle]){--ds-auro-icon-color:var(--ds-basic-color-status-error-subtle, #fbc6c6)}:host(:not([onDark])[variant=fareBasicEconomy]){--ds-auro-icon-color:var(--ds-basic-color-fare-basiceconomy, #97eaf8)}:host(:not([onDark])[variant=fareBusiness]){--ds-auro-icon-color:var(--ds-basic-color-fare-business, #01426a)}:host(:not([onDark])[variant=fareEconomy]){--ds-auro-icon-color:var(--ds-basic-color-fare-economy, #0074ca)}:host(:not([onDark])[variant=fareFirst]){--ds-auro-icon-color:var(--ds-basic-color-fare-first, #00274a)}:host(:not([onDark])[variant=farePremiumEconomy]){--ds-auro-icon-color:var(--ds-basic-color-fare-premiumeconomy, #005154)}:host(:not([onDark])[variant=tierOneWorldEmerald]){--ds-auro-icon-color:var(--ds-basic-color-tier-program-oneworld-emerald, #139142)}:host(:not([onDark])[variant=tierOneWorldSapphire]){--ds-auro-icon-color:var(--ds-basic-color-tier-program-oneworld-sapphire, #015daa)}:host(:not([onDark])[variant=tierOneWorldRuby]){--ds-auro-icon-color:var(--ds-basic-color-tier-program-oneworld-ruby, #a41d4a)}:host([onDark]){--ds-auro-icon-color:var(--ds-basic-color-texticon-inverse, #ffffff)}:host([onDark][variant=disabled]){--ds-auro-icon-color:var(--ds-basic-color-texticon-inverse-disabled, #7e8894)}:host([onDark][variant=muted]){--ds-auro-icon-color:var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}:host([onDark][variant=statusError]){--ds-auro-icon-color:var(--ds-advanced-color-state-error-inverse, #f9a4a8)}`;
|
|
7341
|
-
|
|
7342
|
-
var styleCss$3 = i$5`.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock{display:block}.util_displayFlex{display:flex}.util_displayHidden{display:none}.util_displayHiddenVisually{position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}[auro-dropdown]{--ds-auro-dropdown-trigger-border-color: var(--ds-auro-select-border-color);--ds-auro-dropdown-trigger-background-color: var(--ds-auro-select-background-color);--ds-auro-dropdown-trigger-container-color: var(--ds-auro-select-background-color)}.mainContent{position:relative;display:flex;flex:1;flex-direction:column;align-items:center;justify-content:center}.valueContainer [slot=displayValue]{display:none}.accents{display:flex;flex-direction:row;align-items:center;justify-content:center}::slotted([slot=typeIcon]){margin-right:8px}.displayValue{display:block}.displayValue:not(.force){display:none}.displayValue:not(.force).hasContent:is(.withValue):not(.hasFocus){display:block}.triggerContent{display:flex;width:100%;align-items:center;justify-content:center}:host([layout*=emphasized]) .triggerContent,:host([layout*=snowflake]) .triggerContent{padding:0 8px 0 24px}:host([layout*=classic]) .triggerContent{padding:0 8px}:host([layout*=classic]) .mainContent{align-items:start}:host([layout*=classic]) label{cursor:text;font-size:16px;font-weight:450;letter-spacing:0;line-height:24px}:host([layout*=classic]) label.withValue{font-size:12px;font-weight:450;letter-spacing:0;line-height:16px}:host([layout*=classic]) .value{height:auto;font-size:16px;font-weight:450;letter-spacing:0;line-height:24px}:host(:is([validity]:not([validity=valid]))) [auro-dropdown]{--ds-auro-select-border-color: var(--ds-basic-color-status-error, #e31f26);--ds-auro-dropdown-helptext-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}:host([ondark]:is([validity]:not([validity=valid]))) [auro-dropdown]{--ds-auro-select-border-color: var(--ds-basic-color-status-error-subtle, #fbc6c6);--ds-auro-dropdown-helptext-text-color: var(--ds-basic-color-texticon-inverse, #ffffff)}#slotHolder{display:none}:host([disabled]) *{user-select:none}`;
|
|
7548
|
+
var styleCss$3 = i$5`.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock{display:block}.util_displayFlex{display:flex}.util_displayHidden{display:none}.util_displayHiddenVisually{position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}[auro-dropdown]{--ds-auro-dropdown-trigger-border-color: var(--ds-auro-select-border-color);--ds-auro-dropdown-trigger-background-color: var(--ds-auro-select-background-color);--ds-auro-dropdown-trigger-container-color: var(--ds-auro-select-background-color)}:host([layout*=emphasized]) [auro-dropdown],:host([layout*=snowflake]) [auro-dropdown]{--ds-auro-select-border-color: transparent}.mainContent{position:relative;display:flex;flex:1;flex-direction:column;align-items:center;justify-content:center}.valueContainer [slot=displayValue]{display:none}.accents{display:flex;flex-direction:row;align-items:center;justify-content:center}::slotted([slot=typeIcon]){margin-right:var(--ds-size-50, 0.25rem)}.displayValue{display:block}.displayValue:not(.force){display:none}.displayValue:not(.force).hasContent:is(.withValue):not(.hasFocus){display:block}.triggerContent{display:flex;width:100%;align-items:center;justify-content:center}:host([layout*=emphasized]) .triggerContent,:host([layout*=snowflake]) .triggerContent{padding:0 var(--ds-size-50, 0.25rem) 0 var(--ds-size-150, 0.75rem)}:host([layout*=snowflake]) [auro-dropdown] label.withValue{font-size:var(--ds-text-body-size-xs);line-height:20px}:host([layout*=emphasized]) [auro-dropdown] label.withValue{font-size:var(--ds-text-body-size-xs);line-height:20px}:host([layout*=classic]) .triggerContent{padding:0 var(--ds-size-50, 0.25rem)}:host([layout*=classic]) .mainContent{align-items:start}:host([layout*=classic]) label{cursor:text;font-size:16px;font-weight:450;letter-spacing:0;line-height:24px}:host([layout*=classic]) label.withValue{font-size:12px;font-weight:450;letter-spacing:0;line-height:16px}:host([layout*=classic]) .value{height:auto;font-size:16px;font-weight:450;letter-spacing:0;line-height:24px}:host(:is([validity]:not([validity=valid]))) [auro-dropdown]{--ds-auro-select-border-color: var(--ds-basic-color-status-error, #e31f26);--ds-auro-dropdown-helptext-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}:host([ondark]:is([validity]:not([validity=valid]))) [auro-dropdown]{--ds-auro-select-border-color: var(--ds-basic-color-status-error-subtle, #fbc6c6);--ds-auro-dropdown-helptext-text-color: var(--ds-basic-color-texticon-inverse, #ffffff)}#slotHolder{display:none}:host([disabled]){pointer-events:none;user-select:none}:host([disabled]:not([ondark])) [auro-dropdown]{--ds-auro-select-border-color: var(--ds-basic-color-border-subtle, #dddddd)}:host(:not([layout*=classic])[disabled][ondark]) [auro-dropdown]{--ds-auro-select-border-color: transparent}`;
|
|
7343
7549
|
|
|
7344
7550
|
// Copyright (c) 2021 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
7345
7551
|
// See LICENSE in the project root for license information.
|
|
@@ -7354,7 +7560,6 @@ var styleCss$3 = i$5`.util_displayInline{display:inline}.util_displayInlineBlock
|
|
|
7354
7560
|
* @slot label - Defines the content of the label.
|
|
7355
7561
|
* @slot {HTMLSlotElement} optionalLabel - Allows overriding the optional display text "(optional)", which appears next to the label.
|
|
7356
7562
|
* @slot helpText - Defines the content of the helpText.
|
|
7357
|
-
* @slot placeholder - Defines the content of the placeholder to be shown when there is no value
|
|
7358
7563
|
* @slot valueText - Dropdown value text display.
|
|
7359
7564
|
* @slot displayValue - Allows custom HTML content to display the selected value when select is not focused.
|
|
7360
7565
|
* @event auroSelect-valueSet - Notifies that the component has a new value set.
|
|
@@ -7624,6 +7829,14 @@ class AuroSelect extends AuroElement$4 {
|
|
|
7624
7829
|
reflect: true
|
|
7625
7830
|
},
|
|
7626
7831
|
|
|
7832
|
+
/**
|
|
7833
|
+
* Define custom placeholder text.
|
|
7834
|
+
*/
|
|
7835
|
+
placeholder: {
|
|
7836
|
+
type: String,
|
|
7837
|
+
reflect: true
|
|
7838
|
+
},
|
|
7839
|
+
|
|
7627
7840
|
/**
|
|
7628
7841
|
* Populates the `required` attribute on the element. Used for client-side validation.
|
|
7629
7842
|
*/
|
|
@@ -7670,11 +7883,12 @@ class AuroSelect extends AuroElement$4 {
|
|
|
7670
7883
|
},
|
|
7671
7884
|
|
|
7672
7885
|
/**
|
|
7673
|
-
* Value selected for the component.
|
|
7674
|
-
* @type {String|Array<String>}
|
|
7886
|
+
* Value selected for the component.
|
|
7675
7887
|
*/
|
|
7676
7888
|
value: {
|
|
7677
|
-
type:
|
|
7889
|
+
type: String,
|
|
7890
|
+
reflect: true,
|
|
7891
|
+
attribute: 'value'
|
|
7678
7892
|
},
|
|
7679
7893
|
|
|
7680
7894
|
/**
|
|
@@ -7726,6 +7940,25 @@ class AuroSelect extends AuroElement$4 {
|
|
|
7726
7940
|
];
|
|
7727
7941
|
}
|
|
7728
7942
|
|
|
7943
|
+
/**
|
|
7944
|
+
* Formatted value based on `multiSelect` state.
|
|
7945
|
+
* Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
|
|
7946
|
+
* @private
|
|
7947
|
+
* @returns {String|Array<String>}
|
|
7948
|
+
*/
|
|
7949
|
+
get formattedValue() {
|
|
7950
|
+
if (this.multiSelect) {
|
|
7951
|
+
if (!this.value) {
|
|
7952
|
+
return undefined;
|
|
7953
|
+
}
|
|
7954
|
+
if (this.value.startsWith("[")) {
|
|
7955
|
+
return JSON.parse(this.value);
|
|
7956
|
+
}
|
|
7957
|
+
return [this.value];
|
|
7958
|
+
}
|
|
7959
|
+
return this.value;
|
|
7960
|
+
}
|
|
7961
|
+
|
|
7729
7962
|
/**
|
|
7730
7963
|
* Returns classmap configuration for html5 input labels in all layouts.
|
|
7731
7964
|
* @private
|
|
@@ -7734,7 +7967,7 @@ class AuroSelect extends AuroElement$4 {
|
|
|
7734
7967
|
get commonLabelClasses() {
|
|
7735
7968
|
return {
|
|
7736
7969
|
'is-disabled': this.disabled,
|
|
7737
|
-
'withValue': this.value && this.value.length > 0,
|
|
7970
|
+
'withValue': this.placeholder || (this.value && this.value.length > 0), // eslint-disable-line no-extra-parens
|
|
7738
7971
|
'util_displayHiddenVisually': this.hasDisplayValueContent && !this.hasFocus && this.value && this.value.length > 0
|
|
7739
7972
|
};
|
|
7740
7973
|
}
|
|
@@ -7760,6 +7993,21 @@ class AuroSelect extends AuroElement$4 {
|
|
|
7760
7993
|
|
|
7761
7994
|
this.dropdown.addEventListener('auroDropdown-toggled', () => {
|
|
7762
7995
|
this.isPopoverVisible = this.dropdown.isPopoverVisible;
|
|
7996
|
+
|
|
7997
|
+
if (this.dropdown.isPopoverVisible) {
|
|
7998
|
+
// wait til the bib gets fully rendered
|
|
7999
|
+
setTimeout(() => {
|
|
8000
|
+
if (this.dropdown.isBibFullscreen) {
|
|
8001
|
+
// trigger holds the focus since menu is not a focusable element.
|
|
8002
|
+
this.dropdown.trigger.focus();
|
|
8003
|
+
|
|
8004
|
+
// default focus indicator on the first menu option
|
|
8005
|
+
if (this.menu.index < 0) {
|
|
8006
|
+
this.menu.navigateOptions('down');
|
|
8007
|
+
}
|
|
8008
|
+
}
|
|
8009
|
+
});
|
|
8010
|
+
}
|
|
7763
8011
|
});
|
|
7764
8012
|
|
|
7765
8013
|
// setting up bibtemplate
|
|
@@ -7910,46 +8158,58 @@ class AuroSelect extends AuroElement$4 {
|
|
|
7910
8158
|
configureSelect() {
|
|
7911
8159
|
|
|
7912
8160
|
this.addEventListener('keydown', (evt) => {
|
|
7913
|
-
|
|
7914
|
-
|
|
8161
|
+
// when the focus is on trigger not on close button
|
|
8162
|
+
if (this.dropdown.shadowRoot.activeElement === this.dropdown.trigger) {
|
|
8163
|
+
if (evt.key === 'ArrowUp') {
|
|
8164
|
+
evt.preventDefault();
|
|
7915
8165
|
|
|
7916
|
-
|
|
8166
|
+
this.dropdown.show();
|
|
8167
|
+
|
|
8168
|
+
if (this.dropdown.isPopoverVisible) {
|
|
8169
|
+
this.menu.navigateOptions('up');
|
|
8170
|
+
}
|
|
7917
8171
|
|
|
7918
|
-
|
|
7919
|
-
this.menu.navigateOptions('up');
|
|
8172
|
+
return;
|
|
7920
8173
|
}
|
|
7921
8174
|
|
|
7922
|
-
|
|
7923
|
-
|
|
8175
|
+
if (evt.key === 'ArrowDown') {
|
|
8176
|
+
evt.preventDefault();
|
|
7924
8177
|
|
|
7925
|
-
|
|
7926
|
-
evt.preventDefault();
|
|
8178
|
+
this.dropdown.show();
|
|
7927
8179
|
|
|
7928
|
-
|
|
8180
|
+
if (this.dropdown.isPopoverVisible) {
|
|
8181
|
+
this.menu.navigateOptions('down');
|
|
8182
|
+
}
|
|
7929
8183
|
|
|
7930
|
-
|
|
7931
|
-
this.menu.navigateOptions('down');
|
|
8184
|
+
return;
|
|
7932
8185
|
}
|
|
7933
8186
|
|
|
7934
|
-
|
|
7935
|
-
|
|
8187
|
+
if (evt.key === 'Enter') {
|
|
8188
|
+
if (!this.dropdown.isPopoverVisible) {
|
|
8189
|
+
evt.preventDefault();
|
|
8190
|
+
this.menu.makeSelection();
|
|
8191
|
+
}
|
|
7936
8192
|
|
|
7937
|
-
|
|
7938
|
-
if (!this.dropdown.isPopoverVisible) {
|
|
7939
|
-
evt.preventDefault();
|
|
7940
|
-
this.menu.makeSelection();
|
|
8193
|
+
return;
|
|
7941
8194
|
}
|
|
7942
|
-
|
|
7943
|
-
return;
|
|
7944
8195
|
}
|
|
7945
8196
|
|
|
7946
|
-
if (evt.key === 'Tab') {
|
|
8197
|
+
if (evt.key === 'Tab' && this.dropdown.isPopoverVisible) {
|
|
7947
8198
|
if (this.dropdown.isBibFullscreen) {
|
|
7948
8199
|
evt.preventDefault();
|
|
8200
|
+
|
|
8201
|
+
// when the focus is on trigger not on close button
|
|
8202
|
+
if (this.dropdown.shadowRoot.activeElement === this.dropdown.trigger) {
|
|
8203
|
+
// `dropdown.focus` will move focus to the first focusable element in bib when it's open,
|
|
8204
|
+
// when bib it not open, it will focus onto trigger.
|
|
8205
|
+
this.dropdown.focus();
|
|
8206
|
+
} else {
|
|
8207
|
+
// when close button has the focus, move focus back to the trigger
|
|
8208
|
+
this.dropdown.trigger.focus();
|
|
8209
|
+
}
|
|
7949
8210
|
} else {
|
|
7950
8211
|
this.dropdown.hide();
|
|
7951
8212
|
}
|
|
7952
|
-
|
|
7953
8213
|
return;
|
|
7954
8214
|
}
|
|
7955
8215
|
|
|
@@ -8117,38 +8377,29 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8117
8377
|
this.configureDropdown();
|
|
8118
8378
|
this.configureMenu();
|
|
8119
8379
|
this.configureSelect();
|
|
8120
|
-
|
|
8121
|
-
// Set the initial value in auro-menu if defined
|
|
8122
|
-
if (this.hasAttribute('value') && this.getAttribute('value').length > 0) {
|
|
8123
|
-
this.value = this.multiSelect ? arrayConverter(this.getAttribute('value')) : this.getAttribute('value');
|
|
8124
|
-
if (this.menu) {
|
|
8125
|
-
this.menu.value = this.value;
|
|
8126
|
-
}
|
|
8127
|
-
}
|
|
8128
8380
|
}
|
|
8129
8381
|
|
|
8130
8382
|
/**
|
|
8131
8383
|
* Update the menu value. With checks for menu existence. Awaits value update.
|
|
8132
8384
|
* @param {string} value - The value to set in the menu.
|
|
8133
|
-
* @returns void
|
|
8385
|
+
* @returns {void}
|
|
8134
8386
|
* @private
|
|
8135
8387
|
*/
|
|
8136
8388
|
async updateMenuValue(value) {
|
|
8137
8389
|
if (!this.menu) return;
|
|
8138
8390
|
|
|
8391
|
+
this.menu.setAttribute('value', value);
|
|
8139
8392
|
this.menu.value = value;
|
|
8140
8393
|
await this.menu.updateComplete;
|
|
8141
8394
|
}
|
|
8142
8395
|
|
|
8143
8396
|
async updated(changedProperties) {
|
|
8144
|
-
if (changedProperties.has('multiSelect')) {
|
|
8397
|
+
if (changedProperties.has('multiSelect') && !changedProperties.has('value')) {
|
|
8145
8398
|
this.clearSelection();
|
|
8146
8399
|
}
|
|
8147
8400
|
|
|
8148
8401
|
if (changedProperties.has('value')) {
|
|
8149
8402
|
if (this.value) {
|
|
8150
|
-
this.value = this.multiSelect ? arrayConverter(this.value) : this.value;
|
|
8151
|
-
|
|
8152
8403
|
await this.updateMenuValue(this.value);
|
|
8153
8404
|
|
|
8154
8405
|
if (this.menu) {
|
|
@@ -8174,7 +8425,7 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8174
8425
|
composed: true,
|
|
8175
8426
|
detail: {
|
|
8176
8427
|
optionSelected: this.optionSelected,
|
|
8177
|
-
value: this.
|
|
8428
|
+
value: this.formattedValue
|
|
8178
8429
|
}
|
|
8179
8430
|
}));
|
|
8180
8431
|
}
|
|
@@ -8233,13 +8484,13 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8233
8484
|
const selectedValue = selectedOption.value;
|
|
8234
8485
|
|
|
8235
8486
|
if (this.multiSelect) {
|
|
8236
|
-
const currentArray =
|
|
8487
|
+
const currentArray = this.formattedValue;
|
|
8237
8488
|
|
|
8238
8489
|
if (!currentArray.includes(selectedValue)) {
|
|
8239
|
-
this.value = [
|
|
8490
|
+
this.value = JSON.stringify([
|
|
8240
8491
|
...currentArray,
|
|
8241
8492
|
selectedValue
|
|
8242
|
-
];
|
|
8493
|
+
]);
|
|
8243
8494
|
}
|
|
8244
8495
|
} else {
|
|
8245
8496
|
const currentValue = this.value;
|
|
@@ -8262,12 +8513,17 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8262
8513
|
}
|
|
8263
8514
|
|
|
8264
8515
|
if (this.multiSelect) {
|
|
8265
|
-
nativeSelect.value = this.
|
|
8516
|
+
nativeSelect.value = this.multiSelect ? this.multiSelect[0] : '';
|
|
8266
8517
|
} else {
|
|
8267
8518
|
nativeSelect.value = this.value || '';
|
|
8268
8519
|
}
|
|
8269
8520
|
}
|
|
8270
8521
|
|
|
8522
|
+
/**
|
|
8523
|
+
* Returns HTML for the hidden a11y screen reader content.
|
|
8524
|
+
* @private
|
|
8525
|
+
* @returns {html} - Returns HTML for the hidden a11y screen reader content.
|
|
8526
|
+
*/
|
|
8271
8527
|
renderAriaHtml() {
|
|
8272
8528
|
return u`
|
|
8273
8529
|
<div aria-live="polite" class="util_displayHiddenVisually">
|
|
@@ -8288,6 +8544,11 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8288
8544
|
`;
|
|
8289
8545
|
}
|
|
8290
8546
|
|
|
8547
|
+
/**
|
|
8548
|
+
* Returns HTML for the hidden HTML5 select.
|
|
8549
|
+
* @private
|
|
8550
|
+
* @returns {html} - Returns HTML for the hidden HTML5 select.
|
|
8551
|
+
*/
|
|
8291
8552
|
renderNativeSelect() {
|
|
8292
8553
|
return u`
|
|
8293
8554
|
<div class="nativeSelectWrapper util_displayHidden">
|
|
@@ -8334,7 +8595,7 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8334
8595
|
: u`
|
|
8335
8596
|
<${this.helpTextTag} error ?onDark="${this.onDark}">
|
|
8336
8597
|
<p id="${this.uniqueId}" role="alert" aria-live="assertive" part="helpText">
|
|
8337
|
-
|
|
8598
|
+
${this.errorMessage}
|
|
8338
8599
|
</p>
|
|
8339
8600
|
</${this.helpTextTag}>
|
|
8340
8601
|
`
|
|
@@ -8349,14 +8610,14 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8349
8610
|
*/
|
|
8350
8611
|
renderLayoutEmphasized() {
|
|
8351
8612
|
const placeholderClass = {
|
|
8352
|
-
|
|
8613
|
+
'util_displayHidden': this.value
|
|
8353
8614
|
};
|
|
8354
8615
|
|
|
8355
8616
|
const displayValueClasses = {
|
|
8356
8617
|
'displayValue': true,
|
|
8357
8618
|
'hasContent': this.hasDisplayValueContent,
|
|
8358
8619
|
'hasFocus': this.isPopoverVisible,
|
|
8359
|
-
'withValue': this.value && this.value.length > 0,
|
|
8620
|
+
'withValue': this.placeholder || (this.value && this.value.length > 0), // eslint-disable-line no-extra-parens
|
|
8360
8621
|
'force': this.forceDisplayValue,
|
|
8361
8622
|
};
|
|
8362
8623
|
|
|
@@ -8383,7 +8644,6 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8383
8644
|
.offset="${this.offset}"
|
|
8384
8645
|
.placement="${this.placement}"
|
|
8385
8646
|
chevron
|
|
8386
|
-
fluid
|
|
8387
8647
|
for="selectMenu"
|
|
8388
8648
|
layout="${this.layout}"
|
|
8389
8649
|
part="dropdown"
|
|
@@ -8400,11 +8660,9 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8400
8660
|
${this.required ? undefined : u`<slot name="optionalLabel"> (optional)</slot>`}
|
|
8401
8661
|
</label>
|
|
8402
8662
|
<div class="value" id="value"></div>
|
|
8403
|
-
${
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
</div>
|
|
8407
|
-
`}
|
|
8663
|
+
<div id="placeholder" class="${e(placeholderClass)}">
|
|
8664
|
+
${this.placeholder}
|
|
8665
|
+
</div>
|
|
8408
8666
|
</div>
|
|
8409
8667
|
<div class="${e(displayValueClasses)}" aria-hidden="true" part="displayValue">
|
|
8410
8668
|
<slot name="displayValue"></slot>
|
|
@@ -8431,14 +8689,14 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8431
8689
|
*/
|
|
8432
8690
|
renderLayoutSnowflake() {
|
|
8433
8691
|
const placeholderClass = {
|
|
8434
|
-
|
|
8692
|
+
'util_displayHidden': this.value
|
|
8435
8693
|
};
|
|
8436
8694
|
|
|
8437
8695
|
const displayValueClasses = {
|
|
8438
8696
|
'displayValue': true,
|
|
8439
8697
|
'hasContent': this.hasDisplayValueContent,
|
|
8440
8698
|
'hasFocus': this.isPopoverVisible,
|
|
8441
|
-
'withValue': this.value && this.value.length > 0,
|
|
8699
|
+
'withValue': this.placeholder || (this.value && this.value.length > 0), // eslint-disable-line no-extra-parens
|
|
8442
8700
|
'force': this.forceDisplayValue,
|
|
8443
8701
|
};
|
|
8444
8702
|
|
|
@@ -8464,7 +8722,6 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8464
8722
|
.offset="${this.offset}"
|
|
8465
8723
|
.placement="${this.placement}"
|
|
8466
8724
|
chevron
|
|
8467
|
-
fluid
|
|
8468
8725
|
for="selectMenu"
|
|
8469
8726
|
layout="${this.layout}"
|
|
8470
8727
|
part="dropdown"
|
|
@@ -8481,11 +8738,9 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8481
8738
|
${this.required ? undefined : u`<slot name="optionalLabel"> (optional)</slot>`}
|
|
8482
8739
|
</label>
|
|
8483
8740
|
<div class="value" id="value"></div>
|
|
8484
|
-
${
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
</div>
|
|
8488
|
-
`}
|
|
8741
|
+
<div id="placeholder" class="${e(placeholderClass)}">
|
|
8742
|
+
${this.placeholder}
|
|
8743
|
+
</div>
|
|
8489
8744
|
</div>
|
|
8490
8745
|
<div class="${e(displayValueClasses)}" aria-hidden="true" part="displayValue">
|
|
8491
8746
|
<slot name="displayValue"></slot>
|
|
@@ -8513,14 +8768,14 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8513
8768
|
*/
|
|
8514
8769
|
renderLayoutClassic() {
|
|
8515
8770
|
const placeholderClass = {
|
|
8516
|
-
|
|
8771
|
+
'util_displayHidden': this.value
|
|
8517
8772
|
};
|
|
8518
8773
|
|
|
8519
8774
|
const displayValueClasses = {
|
|
8520
8775
|
'displayValue': true,
|
|
8521
8776
|
'hasContent': this.hasDisplayValueContent,
|
|
8522
8777
|
'hasFocus': this.isPopoverVisible,
|
|
8523
|
-
'withValue': this.value && this.value.length > 0,
|
|
8778
|
+
'withValue': this.placeholder || (this.value && this.value.length > 0), // eslint-disable-line no-extra-parens
|
|
8524
8779
|
'force': this.forceDisplayValue,
|
|
8525
8780
|
};
|
|
8526
8781
|
|
|
@@ -8546,7 +8801,6 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8546
8801
|
.offset="${this.offset}"
|
|
8547
8802
|
.placement="${this.placement}"
|
|
8548
8803
|
chevron
|
|
8549
|
-
fluid
|
|
8550
8804
|
for="selectMenu"
|
|
8551
8805
|
layout="${this.layout}"
|
|
8552
8806
|
part="dropdown"
|
|
@@ -8563,11 +8817,9 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8563
8817
|
${this.required ? undefined : u`<slot name="optionalLabel"> (optional)</slot>`}
|
|
8564
8818
|
</label>
|
|
8565
8819
|
<div class="value" id="value"></div>
|
|
8566
|
-
${
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
</div>
|
|
8570
|
-
`}
|
|
8820
|
+
<div id="placeholder" class="${e(placeholderClass)}">
|
|
8821
|
+
${this.placeholder}
|
|
8822
|
+
</div>
|
|
8571
8823
|
</div>
|
|
8572
8824
|
<div class="${e(displayValueClasses)}" aria-hidden="true" part="displayValue">
|
|
8573
8825
|
<slot name="displayValue"></slot>
|
|
@@ -8617,106 +8869,6 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8617
8869
|
|
|
8618
8870
|
// When using auroElement, use the following attribute and function when hiding content from screen readers.
|
|
8619
8871
|
// aria-hidden="${this.hideAudible(this.hiddenAudible)}"
|
|
8620
|
-
|
|
8621
|
-
// function that renders the HTML and CSS into the scope of the component
|
|
8622
|
-
renderBACKUP() {
|
|
8623
|
-
const placeholderClass = {
|
|
8624
|
-
hidden: this.value,
|
|
8625
|
-
};
|
|
8626
|
-
|
|
8627
|
-
return u`
|
|
8628
|
-
<div class="outerWrapper">
|
|
8629
|
-
<div aria-live="polite" class="util_displayHiddenVisually">
|
|
8630
|
-
${this.optionActive && this.options.length > 0
|
|
8631
|
-
? u`
|
|
8632
|
-
${`${this.optionActive.innerText}, option ${this.options.indexOf(this.optionActive) + 1} of ${this.options.length}`}
|
|
8633
|
-
`
|
|
8634
|
-
: undefined
|
|
8635
|
-
};
|
|
8636
|
-
|
|
8637
|
-
${this.optionSelected && this.options.length > 0
|
|
8638
|
-
? u`
|
|
8639
|
-
${`${this.optionSelected.innerText} selected`}
|
|
8640
|
-
`
|
|
8641
|
-
: undefined
|
|
8642
|
-
};
|
|
8643
|
-
</div>
|
|
8644
|
-
<div id="slotHolder" aria-hidden="true">
|
|
8645
|
-
<slot name="bib.fullscreen.headline" @slotchange="${this.handleSlotChange}"></slot>
|
|
8646
|
-
</div>
|
|
8647
|
-
<${this.dropdownTag}
|
|
8648
|
-
?autoPlacement="${this.autoPlacement}"
|
|
8649
|
-
?disabled="${this.disabled}"
|
|
8650
|
-
?error="${this.validity !== undefined && this.validity !== 'valid'}"
|
|
8651
|
-
?matchWidth="${this.matchWidth}"
|
|
8652
|
-
?noFlip="${this.noFlip}"
|
|
8653
|
-
?onDark="${this.onDark}"
|
|
8654
|
-
.fullscreenBreakpoint="${this.fullscreenBreakpoint}"
|
|
8655
|
-
.offset="${this.offset}"
|
|
8656
|
-
.placement="${this.placement}"
|
|
8657
|
-
chevron
|
|
8658
|
-
fluid
|
|
8659
|
-
for="selectMenu"
|
|
8660
|
-
layout="${this.layout}"
|
|
8661
|
-
part="dropdown"
|
|
8662
|
-
shape="${this.shape}"
|
|
8663
|
-
size="${this.size}">
|
|
8664
|
-
<span slot="trigger" aria-haspopup="true" id="triggerFocus">
|
|
8665
|
-
<span id="placeholder"
|
|
8666
|
-
class="${e(placeholderClass)}"
|
|
8667
|
-
?aria-hidden="${this.optionSelected && this.optionSelected.length ? 'true' : false}"
|
|
8668
|
-
>
|
|
8669
|
-
<slot name="placeholder"></slot>
|
|
8670
|
-
</span>
|
|
8671
|
-
<slot name="valueText" id="valueText"></slot>
|
|
8672
|
-
</span>
|
|
8673
|
-
|
|
8674
|
-
<${this.bibtemplateTag} ?large="${this.largeFullscreenHeadline}" @close-click="${this.hideBib}">
|
|
8675
|
-
<slot></slot>
|
|
8676
|
-
</${this.bibtemplateTag}>
|
|
8677
|
-
<slot name="label" slot="label"></slot>
|
|
8678
|
-
${this.required ? undefined : u`<slot name="optionalLabel"> (optional)</slot>`}
|
|
8679
|
-
<p slot="helpText">
|
|
8680
|
-
${!this.validity || this.validity === undefined || this.validity === 'valid'
|
|
8681
|
-
? u`
|
|
8682
|
-
<span id="${this.uniqueId}" part="helpText">
|
|
8683
|
-
<slot name="helpText"></slot>
|
|
8684
|
-
</span>`
|
|
8685
|
-
: u`
|
|
8686
|
-
<span id="${this.uniqueId}" role="alert" aria-live="assertive" part="helpText">
|
|
8687
|
-
${this.errorMessage}
|
|
8688
|
-
</span>`
|
|
8689
|
-
}
|
|
8690
|
-
</p>
|
|
8691
|
-
</${this.dropdownTag}>
|
|
8692
|
-
<div class="nativeSelectWrapper">
|
|
8693
|
-
<select
|
|
8694
|
-
tabindex="-1"
|
|
8695
|
-
id="${`native-select-${this.id || this.uniqueId}`}"
|
|
8696
|
-
name="${this.name || ''}"
|
|
8697
|
-
?disabled="${this.disabled}"
|
|
8698
|
-
?required="${this.required}"
|
|
8699
|
-
aria-hidden="true"
|
|
8700
|
-
autocomplete="${o(this.autocomplete)}"
|
|
8701
|
-
@change="${this._handleNativeSelectChange}">
|
|
8702
|
-
<option value="" ?selected="${!this.value}"></option>
|
|
8703
|
-
${this.options.map((option) => {
|
|
8704
|
-
const optionValue = option.value || option.textContent;
|
|
8705
|
-
return u`
|
|
8706
|
-
<option
|
|
8707
|
-
value="${optionValue}"
|
|
8708
|
-
?selected="${this.value === optionValue}">
|
|
8709
|
-
${option.textContent}
|
|
8710
|
-
</option>
|
|
8711
|
-
`;
|
|
8712
|
-
})}
|
|
8713
|
-
</select>
|
|
8714
|
-
</div>
|
|
8715
|
-
<!-- Help text and error message template -->
|
|
8716
|
-
${this.renderHtmlHelpText()}
|
|
8717
|
-
</div>
|
|
8718
|
-
`;
|
|
8719
|
-
}
|
|
8720
8872
|
}
|
|
8721
8873
|
|
|
8722
8874
|
var styleCss$2 = i$5`:focus:not(:focus-visible){outline:3px solid transparent}:host{display:block;vertical-align:middle}:host .wrapper{box-sizing:border-box;display:inline-block;width:100%;margin:0;padding:0}:host ::slotted(hr){box-sizing:content-box !important;height:0 !important;overflow:visible !important;margin:var(--ds-size-100, 0.5rem) 0 !important;border-width:0 !important;border-top-width:1px !important;border-top-style:solid !important}:host [loadingplaceholder].empty{opacity:0;position:absolute}:host [loadingplaceholder] slot[name=loadingIcon]{vertical-align:middle;line-height:1;display:inline-block}:host [loadingplaceholder] slot[name=loadingIcon]::slotted(*){margin-right:var(--ds-size-150, 0.75rem)}:host([root]){overflow-y:auto}:host([root]) .wrapper[class*=-lg]{padding:var(--ds-size-150, 0.75rem)}:host([root]) .wrapper[class*=-xl]{padding:var(--ds-size-200, 1rem)}`;
|
|
@@ -8776,7 +8928,6 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
8776
8928
|
* @attr {boolean} nocheckmark - When true, selected option will not show the checkmark.
|
|
8777
8929
|
* @attr {boolean} loading - When true, displays a loading state using the loadingIcon and loadingText slots if provided.
|
|
8778
8930
|
* @attr {boolean} multiselect - When true, the selected option can be multiple options.
|
|
8779
|
-
* @attr {String|Array<string>} value - Value selected for the menu, type `string` by default. In multi-select mode, `value` is an array of strings.
|
|
8780
8931
|
* @prop {boolean} hasLoadingPlaceholder - Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
|
|
8781
8932
|
* @event {CustomEvent<Element>} auroMenu-activatedOption - Notifies that a menuoption has been made `active`.
|
|
8782
8933
|
* @event {CustomEvent<any>} auroMenu-customEventFired - Notifies that a custom event has been fired.
|
|
@@ -8889,9 +9040,14 @@ class AuroMenu extends AuroElement$4 {
|
|
|
8889
9040
|
reflect: true,
|
|
8890
9041
|
attribute: 'multiselect'
|
|
8891
9042
|
},
|
|
9043
|
+
|
|
9044
|
+
/**
|
|
9045
|
+
* Value selected for the component.
|
|
9046
|
+
*/
|
|
8892
9047
|
value: {
|
|
8893
|
-
|
|
8894
|
-
|
|
9048
|
+
type: String,
|
|
9049
|
+
reflect: true,
|
|
9050
|
+
attribute: 'value'
|
|
8895
9051
|
},
|
|
8896
9052
|
|
|
8897
9053
|
/**
|
|
@@ -8926,6 +9082,25 @@ class AuroMenu extends AuroElement$4 {
|
|
|
8926
9082
|
AuroLibraryRuntimeUtils$6.prototype.registerComponent(name, AuroMenu);
|
|
8927
9083
|
}
|
|
8928
9084
|
|
|
9085
|
+
/**
|
|
9086
|
+
* Formatted value based on `multiSelect` state.
|
|
9087
|
+
* Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
|
|
9088
|
+
* @private
|
|
9089
|
+
* @returns {String|Array<String>}
|
|
9090
|
+
*/
|
|
9091
|
+
get formattedValue() {
|
|
9092
|
+
if (this.multiSelect) {
|
|
9093
|
+
if (!this.value) {
|
|
9094
|
+
return undefined;
|
|
9095
|
+
}
|
|
9096
|
+
if (this.value.startsWith("[")) {
|
|
9097
|
+
return JSON.parse(this.value);
|
|
9098
|
+
}
|
|
9099
|
+
return [this.value];
|
|
9100
|
+
}
|
|
9101
|
+
return this.value;
|
|
9102
|
+
}
|
|
9103
|
+
|
|
8929
9104
|
// Lifecycle Methods
|
|
8930
9105
|
|
|
8931
9106
|
connectedCallback() {
|
|
@@ -8968,7 +9143,7 @@ class AuroMenu extends AuroElement$4 {
|
|
|
8968
9143
|
updated(changedProperties) {
|
|
8969
9144
|
super.updated(changedProperties);
|
|
8970
9145
|
|
|
8971
|
-
if (changedProperties.has('multiSelect')) {
|
|
9146
|
+
if (changedProperties.has('multiSelect') && !changedProperties.has("value")) {
|
|
8972
9147
|
// Reset selection if multiSelect mode changes
|
|
8973
9148
|
this.clearSelection();
|
|
8974
9149
|
}
|
|
@@ -8982,7 +9157,7 @@ class AuroMenu extends AuroElement$4 {
|
|
|
8982
9157
|
} else {
|
|
8983
9158
|
if (this.multiSelect) {
|
|
8984
9159
|
// In multiselect mode, this.value should be an array of strings
|
|
8985
|
-
const valueArray =
|
|
9160
|
+
const valueArray = this.formattedValue;
|
|
8986
9161
|
const matchingOptions = this.items.filter((item) => valueArray.includes(item.value));
|
|
8987
9162
|
|
|
8988
9163
|
this.optionSelected = matchingOptions.length > 0 ? matchingOptions : undefined;
|
|
@@ -9149,14 +9324,14 @@ class AuroMenu extends AuroElement$4 {
|
|
|
9149
9324
|
*/
|
|
9150
9325
|
handleSelectState(option) {
|
|
9151
9326
|
if (this.multiSelect) {
|
|
9152
|
-
const currentValue = this.
|
|
9327
|
+
const currentValue = this.formattedValue || [];
|
|
9153
9328
|
const currentSelected = this.optionSelected || [];
|
|
9154
9329
|
|
|
9155
9330
|
if (!currentValue.includes(option.value)) {
|
|
9156
|
-
this.value = [
|
|
9331
|
+
this.value = JSON.stringify([
|
|
9157
9332
|
...currentValue,
|
|
9158
9333
|
option.value
|
|
9159
|
-
];
|
|
9334
|
+
]);
|
|
9160
9335
|
}
|
|
9161
9336
|
if (!currentSelected.includes(option)) {
|
|
9162
9337
|
this.optionSelected = [
|
|
@@ -9179,13 +9354,15 @@ class AuroMenu extends AuroElement$4 {
|
|
|
9179
9354
|
* @param {HTMLElement} option - The menuoption to be deselected.
|
|
9180
9355
|
*/
|
|
9181
9356
|
handleDeselectState(option) {
|
|
9182
|
-
if (this.multiSelect
|
|
9357
|
+
if (this.multiSelect) {
|
|
9183
9358
|
// Remove this option from array
|
|
9184
|
-
|
|
9359
|
+
const newFormattedValue = (this.formattedValue || []).filter((val) => val !== option.value);
|
|
9185
9360
|
|
|
9186
9361
|
// If array is empty after removal, set back to undefined
|
|
9187
|
-
if (
|
|
9362
|
+
if (newFormattedValue && newFormattedValue.length === 0) {
|
|
9188
9363
|
this.value = undefined;
|
|
9364
|
+
} else {
|
|
9365
|
+
this.value = JSON.stringify(newFormattedValue);
|
|
9189
9366
|
}
|
|
9190
9367
|
|
|
9191
9368
|
this.optionSelected = this.optionSelected.filter((val) => val !== option);
|
|
@@ -9536,7 +9713,7 @@ class AuroMenu extends AuroElement$4 {
|
|
|
9536
9713
|
}
|
|
9537
9714
|
}
|
|
9538
9715
|
|
|
9539
|
-
var styleCss$1 = i$5`:host{cursor:pointer;user-select:none}:host .wrapper{display:flex;align-items:center;padding-right:var(--ds-size-200, 1rem);padding-left:calc(var(--ds-size-150, 0.75rem) +
|
|
9716
|
+
var styleCss$1 = i$5`:host{cursor:pointer;user-select:none}:host .wrapper{display:flex;align-items:center;padding-right:var(--ds-size-200, 1rem);padding-left:calc(var(--ds-size-150, 0.75rem) + var(--ds-size-150, 0.75rem) + var(--ds-size-100, 0.5rem));padding-top:var(--ds-size-50, 0.25rem);padding-bottom:var(--ds-size-50, 0.25rem);-webkit-tap-highlight-color:transparent}:host .wrapper[class*=shape-box],:host .wrapper[class*=shape-snowflake]{border-radius:unset}:host .wrapper[class*=shape-pill]{border-radius:30px}:host .wrapper[class*=-lg]{font-size:var(--ds-text-body-size-lg, 1.125rem);line-height:var(--ds-text-body-height-lg, 1.625rem);padding-top:var(--ds-size-75, 0.375rem);padding-bottom:var(--ds-size-75, 0.375rem);padding-right:var(--ds-size-150, 0.75rem)}:host .wrapper[class*=-lg]:not(:last-child){margin-bottom:var(--ds-size-50, 0.25rem)}:host .wrapper[class*=-xl]{font-size:var(--ds-text-body-size-lg, 1.125rem);line-height:var(--ds-text-body-height-lg, 1.625rem);padding-top:var(--ds-size-100, 0.5rem);padding-bottom:var(--ds-size-100, 0.5rem);padding-right:var(--ds-size-200, 1rem)}:host .wrapper[class*=-xl]:not(:last-child){margin-bottom:var(--ds-size-100, 0.5rem)}:host slot{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host [auro-icon]{--ds-auro-icon-size: var(--ds-size-300, 1.5rem);margin-right:var(--ds-size-150, 0.75rem);margin-left:var(--ds-size-100, 0.5rem)}:host ::slotted(.nestingSpacer){display:inline-block;width:var(--ds-size-300, 1.5rem)}:host ::slotted(strong){font-weight:700}:host([loadingplaceholder]) .wrapper{padding-left:calc(var(--ds-size-150, 0.75rem) + var(--ds-size-150, 0.75rem) + var(--ds-size-100, 0.5rem))}:host([selected]) .wrapper{padding-left:0}:host([nocheckmark]) .wrapper{padding-left:var(--ds-size-150, 0.75rem)}:host([nocheckmark]) .wrapper[class*=-lg]{padding-left:var(--ds-size-150, 0.75rem)}:host([nocheckmark]) .wrapper[class*=-xl]{padding-left:var(--ds-size-200, 1rem)}:host([hidden]){display:none}:host([static]){pointer-events:none}:host([disabled]:hover){cursor:auto}:host([disabled]){user-select:none;pointer-events:none}`;
|
|
9540
9717
|
|
|
9541
9718
|
var colorCss$1 = i$5`:host .wrapper{border:1px solid var(--ds-auro-menuoption-container-border-color);background-color:var(--ds-auro-menuoption-container-color);color:var(--ds-auro-menuoption-text-color)}:host svg{fill:var(--ds-auro-menuoption-icon-color)}:host([disabled]){--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host(:hover),:host(.active){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-neutral-subtle, #f7f7f7)}:host([selected]){--ds-auro-menuoption-container-color: var(--ds-advanced-color-state-selected, #01426a);--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-inverse, #ffffff);--ds-auro-menuoption-icon-color: var(--ds-basic-color-texticon-inverse, #ffffff)}:host([selected]):host(:hover),:host([selected]):host(.active){--ds-auro-menuoption-container-color: var(--ds-advanced-color-state-selected-hover, #00274a)}`;
|
|
9542
9719
|
|