@aurodesignsystem-dev/auro-formkit 0.0.0-pr740.9 → 0.0.0-pr750.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/bibtemplate/dist/auro-bibtemplate.d.ts +6 -0
- package/components/bibtemplate/dist/index.js +25 -1
- package/components/bibtemplate/dist/registered.js +25 -1
- package/components/checkbox/demo/api.html +16 -10
- package/components/checkbox/demo/api.min.js +23 -16
- package/components/checkbox/demo/index.html +16 -10
- package/components/checkbox/demo/index.min.js +23 -16
- package/components/checkbox/demo/readme.html +16 -9
- package/components/checkbox/dist/index.js +23 -16
- package/components/checkbox/dist/registered.js +23 -16
- package/components/combobox/demo/api.html +16 -10
- package/components/combobox/demo/api.md +12 -6
- package/components/combobox/demo/api.min.js +442 -148
- package/components/combobox/demo/index.html +16 -10
- package/components/combobox/demo/index.min.js +442 -148
- package/components/combobox/demo/readme.html +16 -9
- package/components/combobox/dist/index.js +405 -136
- package/components/combobox/dist/registered.js +405 -136
- package/components/counter/demo/api.html +17 -10
- package/components/counter/demo/api.md +140 -7
- package/components/counter/demo/api.min.js +1171 -1016
- package/components/counter/demo/index.html +17 -10
- package/components/counter/demo/index.md +86 -0
- package/components/counter/demo/index.min.js +1171 -1016
- 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 +1171 -1016
- package/components/counter/dist/registered.js +1171 -1016
- package/components/datepicker/demo/api.html +16 -10
- package/components/datepicker/demo/api.min.js +403 -123
- package/components/datepicker/demo/index.html +16 -10
- package/components/datepicker/demo/index.min.js +403 -123
- package/components/datepicker/demo/readme.html +16 -9
- package/components/datepicker/dist/auro-datepicker.d.ts +6 -0
- package/components/datepicker/dist/index.js +403 -123
- package/components/datepicker/dist/registered.js +403 -123
- package/components/dropdown/demo/api.html +16 -10
- package/components/dropdown/demo/api.md +77 -269
- package/components/dropdown/demo/api.min.js +336 -96
- package/components/dropdown/demo/index.html +16 -10
- package/components/dropdown/demo/index.md +45 -363
- package/components/dropdown/demo/index.min.js +336 -96
- package/components/dropdown/demo/readme.html +16 -9
- package/components/dropdown/dist/auro-dropdown.d.ts +35 -67
- package/components/dropdown/dist/auro-dropdownBib.d.ts +0 -6
- package/components/dropdown/dist/index.js +336 -96
- package/components/dropdown/dist/registered.js +336 -96
- 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 +520 -358
- package/components/select/demo/index.html +16 -11
- package/components/select/demo/index.md +6 -158
- package/components/select/demo/index.min.js +520 -346
- package/components/select/demo/readme.html +16 -9
- package/components/select/dist/auro-select.d.ts +33 -8
- package/components/select/dist/index.js +483 -334
- package/components/select/dist/registered.js +483 -334
- package/package.json +26 -25
|
@@ -2307,6 +2307,267 @@ class AuroFloatingUI {
|
|
|
2307
2307
|
}
|
|
2308
2308
|
}
|
|
2309
2309
|
|
|
2310
|
+
// Selectors for focusable elements
|
|
2311
|
+
const FOCUSABLE_SELECTORS = [
|
|
2312
|
+
'a[href]',
|
|
2313
|
+
'button:not([disabled])',
|
|
2314
|
+
'textarea:not([disabled])',
|
|
2315
|
+
'input:not([disabled])',
|
|
2316
|
+
'select:not([disabled])',
|
|
2317
|
+
'[role="tab"]:not([disabled])',
|
|
2318
|
+
'[role="link"]:not([disabled])',
|
|
2319
|
+
'[role="button"]:not([disabled])',
|
|
2320
|
+
'[tabindex]:not([tabindex="-1"])',
|
|
2321
|
+
'[contenteditable]:not([contenteditable="false"])'
|
|
2322
|
+
];
|
|
2323
|
+
|
|
2324
|
+
// List of custom components that are known to be focusable
|
|
2325
|
+
const FOCUSABLE_COMPONENTS = [
|
|
2326
|
+
'auro-checkbox',
|
|
2327
|
+
'auro-radio',
|
|
2328
|
+
'auro-dropdown',
|
|
2329
|
+
'auro-button',
|
|
2330
|
+
'auro-combobox',
|
|
2331
|
+
'auro-input',
|
|
2332
|
+
'auro-counter',
|
|
2333
|
+
'auro-menu',
|
|
2334
|
+
'auro-select',
|
|
2335
|
+
'auro-datepicker',
|
|
2336
|
+
'auro-hyperlink',
|
|
2337
|
+
'auro-accordion',
|
|
2338
|
+
];
|
|
2339
|
+
|
|
2340
|
+
/**
|
|
2341
|
+
* Determines if a given element is a custom focusable component.
|
|
2342
|
+
* Returns true if the element matches a known focusable component and is not disabled.
|
|
2343
|
+
*
|
|
2344
|
+
* @param {HTMLElement} element The element to check for focusability.
|
|
2345
|
+
* @returns {boolean} True if the element is a focusable custom component, false otherwise.
|
|
2346
|
+
*/
|
|
2347
|
+
function isFocusableComponent(element) {
|
|
2348
|
+
const componentName = element.tagName.toLowerCase();
|
|
2349
|
+
|
|
2350
|
+
// Guard Clause: Element is a focusable component
|
|
2351
|
+
if (!FOCUSABLE_COMPONENTS.some((name) => element.hasAttribute(name) || componentName === name)) return false;
|
|
2352
|
+
|
|
2353
|
+
// Guard Clause: Element is not disabled
|
|
2354
|
+
if (element.hasAttribute('disabled')) return false;
|
|
2355
|
+
|
|
2356
|
+
// Guard Clause: The element is a hyperlink and has no href attribute
|
|
2357
|
+
if (componentName.match("hyperlink") && !element.hasAttribute('href')) return false;
|
|
2358
|
+
|
|
2359
|
+
// If all guard clauses pass, the element is a focusable component
|
|
2360
|
+
return true;
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
/**
|
|
2364
|
+
* Retrieves all focusable elements within the container in DOM order, including those in shadow DOM and slots.
|
|
2365
|
+
* Returns a unique, ordered array of elements that can receive focus.
|
|
2366
|
+
*
|
|
2367
|
+
* @param {HTMLElement} container The container to search within
|
|
2368
|
+
* @returns {Array<HTMLElement>} An array of focusable elements within the container.
|
|
2369
|
+
*/
|
|
2370
|
+
function getFocusableElements(container) {
|
|
2371
|
+
// Get elements in DOM order by walking the tree
|
|
2372
|
+
const orderedFocusableElements = [];
|
|
2373
|
+
|
|
2374
|
+
// Define a recursive function to collect focusable elements in DOM order
|
|
2375
|
+
const collectFocusableElements = (root) => {
|
|
2376
|
+
// Check if current element is focusable
|
|
2377
|
+
if (root.nodeType === Node.ELEMENT_NODE) {
|
|
2378
|
+
// Check if this is a custom component that is focusable
|
|
2379
|
+
const isComponentFocusable = isFocusableComponent(root);
|
|
2380
|
+
|
|
2381
|
+
if (isComponentFocusable) {
|
|
2382
|
+
// Add the component itself as a focusable element and don't traverse its shadow DOM
|
|
2383
|
+
orderedFocusableElements.push(root);
|
|
2384
|
+
return; // Skip traversing inside this component
|
|
2385
|
+
}
|
|
2386
|
+
|
|
2387
|
+
// Check if the element itself matches any selector
|
|
2388
|
+
for (const selector of FOCUSABLE_SELECTORS) {
|
|
2389
|
+
if (root.matches?.(selector)) {
|
|
2390
|
+
orderedFocusableElements.push(root);
|
|
2391
|
+
break; // Once we know it's focusable, no need to check other selectors
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
|
|
2395
|
+
// Process shadow DOM only for non-Auro components
|
|
2396
|
+
if (root.shadowRoot) {
|
|
2397
|
+
// Process shadow DOM children in order
|
|
2398
|
+
if (root.shadowRoot.children) {
|
|
2399
|
+
Array.from(root.shadowRoot.children).forEach(child => {
|
|
2400
|
+
collectFocusableElements(child);
|
|
2401
|
+
});
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
|
|
2405
|
+
// Process slots and their assigned nodes in order
|
|
2406
|
+
if (root.tagName === 'SLOT') {
|
|
2407
|
+
const assignedNodes = root.assignedNodes({ flatten: true });
|
|
2408
|
+
for (const node of assignedNodes) {
|
|
2409
|
+
collectFocusableElements(node);
|
|
2410
|
+
}
|
|
2411
|
+
} else {
|
|
2412
|
+
// Process light DOM children in order
|
|
2413
|
+
if (root.children) {
|
|
2414
|
+
Array.from(root.children).forEach(child => {
|
|
2415
|
+
collectFocusableElements(child);
|
|
2416
|
+
});
|
|
2417
|
+
}
|
|
2418
|
+
}
|
|
2419
|
+
}
|
|
2420
|
+
};
|
|
2421
|
+
|
|
2422
|
+
// Start the traversal from the container
|
|
2423
|
+
collectFocusableElements(container);
|
|
2424
|
+
|
|
2425
|
+
// Remove duplicates that might have been collected through different paths
|
|
2426
|
+
// while preserving order
|
|
2427
|
+
const uniqueElements = [];
|
|
2428
|
+
const seen = new Set();
|
|
2429
|
+
|
|
2430
|
+
for (const element of orderedFocusableElements) {
|
|
2431
|
+
if (!seen.has(element)) {
|
|
2432
|
+
seen.add(element);
|
|
2433
|
+
uniqueElements.push(element);
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
|
|
2437
|
+
return uniqueElements;
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2440
|
+
/**
|
|
2441
|
+
* FocusTrap manages keyboard focus within a specified container element, ensuring that focus does not leave the container when tabbing.
|
|
2442
|
+
* It is commonly used for modal dialogs or overlays to improve accessibility by trapping focus within interactive UI components.
|
|
2443
|
+
*/
|
|
2444
|
+
class FocusTrap {
|
|
2445
|
+
/**
|
|
2446
|
+
* Creates a new FocusTrap instance for the given container element.
|
|
2447
|
+
* Initializes event listeners and prepares the container for focus management.
|
|
2448
|
+
*
|
|
2449
|
+
* @param {HTMLElement} container The DOM element to trap focus within.
|
|
2450
|
+
* @throws {Error} If the provided container is not a valid HTMLElement.
|
|
2451
|
+
*/
|
|
2452
|
+
constructor(container) {
|
|
2453
|
+
if (!container || !(container instanceof HTMLElement)) {
|
|
2454
|
+
throw new Error("FocusTrap requires a valid HTMLElement.");
|
|
2455
|
+
}
|
|
2456
|
+
|
|
2457
|
+
this.container = container;
|
|
2458
|
+
this.tabDirection = 'forward'; // or 'backward'
|
|
2459
|
+
|
|
2460
|
+
this._init();
|
|
2461
|
+
}
|
|
2462
|
+
|
|
2463
|
+
/**
|
|
2464
|
+
* Initializes the focus trap by setting up event listeners and attributes on the container.
|
|
2465
|
+
* Prepares the container for focus management, including support for shadow DOM and inert attributes.
|
|
2466
|
+
*
|
|
2467
|
+
* @private
|
|
2468
|
+
*/
|
|
2469
|
+
_init() {
|
|
2470
|
+
|
|
2471
|
+
// Add inert attribute to prevent focusing programmatically as well (if supported)
|
|
2472
|
+
if ('inert' in HTMLElement.prototype) {
|
|
2473
|
+
this.container.inert = false; // Ensure the container isn't inert
|
|
2474
|
+
this.container.setAttribute('data-focus-trap-container', true); // Mark for identification
|
|
2475
|
+
}
|
|
2476
|
+
|
|
2477
|
+
// Track tab direction
|
|
2478
|
+
this.container.addEventListener('keydown', this._onKeydown);
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
/**
|
|
2482
|
+
* Handles keydown events to manage tab navigation within the container.
|
|
2483
|
+
* Ensures that focus wraps around when reaching the first or last focusable element.
|
|
2484
|
+
*
|
|
2485
|
+
* @param {KeyboardEvent} e The keyboard event triggered by user interaction.
|
|
2486
|
+
* @private
|
|
2487
|
+
*/
|
|
2488
|
+
_onKeydown = (e) => {
|
|
2489
|
+
|
|
2490
|
+
if (e.key === 'Tab') {
|
|
2491
|
+
|
|
2492
|
+
// Set the tab direction based on the key pressed
|
|
2493
|
+
this.tabDirection = e.shiftKey ? 'backward' : 'forward';
|
|
2494
|
+
|
|
2495
|
+
// Get the active element(s) in the document and shadow root
|
|
2496
|
+
// This will include the active element in the shadow DOM if it exists
|
|
2497
|
+
// Active element may be inside the shadow DOM depending on delegatesFocus, so we need to check both
|
|
2498
|
+
let activeElement = document.activeElement;
|
|
2499
|
+
const actives = [activeElement];
|
|
2500
|
+
while (activeElement?.shadowRoot?.activeElement) {
|
|
2501
|
+
actives.push(activeElement.shadowRoot.activeElement);
|
|
2502
|
+
activeElement = activeElement.shadowRoot.activeElement;
|
|
2503
|
+
}
|
|
2504
|
+
|
|
2505
|
+
// Update the focusable elements
|
|
2506
|
+
const focusables = this._getFocusableElements();
|
|
2507
|
+
|
|
2508
|
+
// If we're at either end of the focusable elements, wrap around to the other end
|
|
2509
|
+
const focusIndex =
|
|
2510
|
+
(actives.includes(focusables[0]) || actives.includes(this.container)) && this.tabDirection === 'backward'
|
|
2511
|
+
? focusables.length - 1
|
|
2512
|
+
: actives.includes(focusables[focusables.length - 1]) && this.tabDirection === 'forward'
|
|
2513
|
+
? 0
|
|
2514
|
+
: null;
|
|
2515
|
+
|
|
2516
|
+
if (focusIndex !== null) {
|
|
2517
|
+
focusables[focusIndex].focus();
|
|
2518
|
+
e.preventDefault(); // Prevent default tab behavior
|
|
2519
|
+
e.stopPropagation(); // Stop the event from bubbling up
|
|
2520
|
+
}
|
|
2521
|
+
}
|
|
2522
|
+
};
|
|
2523
|
+
|
|
2524
|
+
/**
|
|
2525
|
+
* Retrieves all focusable elements within the container in DOM order, including those in shadow DOM and slots.
|
|
2526
|
+
* Returns a unique, ordered array of elements that can receive focus.
|
|
2527
|
+
*
|
|
2528
|
+
* @returns {Array<HTMLElement>} An array of focusable elements within the container.
|
|
2529
|
+
* @private
|
|
2530
|
+
*/
|
|
2531
|
+
_getFocusableElements() {
|
|
2532
|
+
// Use the imported utility function to get focusable elements
|
|
2533
|
+
const elements = getFocusableElements(this.container);
|
|
2534
|
+
|
|
2535
|
+
// Filter out any elements with the 'focus-bookend' class
|
|
2536
|
+
return elements;
|
|
2537
|
+
}
|
|
2538
|
+
|
|
2539
|
+
/**
|
|
2540
|
+
* Moves focus to the first focusable element within the container.
|
|
2541
|
+
* Useful for setting initial focus when activating the focus trap.
|
|
2542
|
+
*/
|
|
2543
|
+
focusFirstElement() {
|
|
2544
|
+
const focusables = this._getFocusableElements();
|
|
2545
|
+
if (focusables.length) focusables[0].focus();
|
|
2546
|
+
}
|
|
2547
|
+
|
|
2548
|
+
/**
|
|
2549
|
+
* Moves focus to the last focusable element within the container.
|
|
2550
|
+
* Useful for setting focus when deactivating or cycling focus in reverse.
|
|
2551
|
+
*/
|
|
2552
|
+
focusLastElement() {
|
|
2553
|
+
const focusables = this._getFocusableElements();
|
|
2554
|
+
if (focusables.length) focusables[focusables.length - 1].focus();
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
/**
|
|
2558
|
+
* Removes event listeners and attributes added by the focus trap.
|
|
2559
|
+
* Call this method to clean up when the focus trap is no longer needed.
|
|
2560
|
+
*/
|
|
2561
|
+
disconnect() {
|
|
2562
|
+
|
|
2563
|
+
if (this.container.hasAttribute('data-focus-trap-container')) {
|
|
2564
|
+
this.container.removeAttribute('data-focus-trap-container');
|
|
2565
|
+
}
|
|
2566
|
+
|
|
2567
|
+
this.container.removeEventListener('keydown', this._onKeydown);
|
|
2568
|
+
}
|
|
2569
|
+
}
|
|
2570
|
+
|
|
2310
2571
|
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
2311
2572
|
// See LICENSE in the project root for license information.
|
|
2312
2573
|
|
|
@@ -2750,11 +3011,11 @@ class AuroIcon extends BaseIcon {
|
|
|
2750
3011
|
|
|
2751
3012
|
var iconVersion = '6.1.2';
|
|
2752
3013
|
|
|
2753
|
-
var styleCss$1 = i$2`:host{position:fixed;z-index:var(--depth-tooltip, 400);display:none}:host(:not([matchWidth])) .container{min-width:fit-content}:host([isfullscreen]){top:0;left:0
|
|
3014
|
+
var styleCss$1 = i$2`:host{position:fixed;z-index:var(--depth-tooltip, 400);display:none;isolation:isolate}:host(:not([matchWidth])) .container{min-width:fit-content}:host([isfullscreen]){position:fixed;top:0;left:0}:host([isfullscreen]) .container{width:100dvw;max-width:none;height:100dvh;max-height:none;border-radius:unset;margin-top:0;box-shadow:unset;overscroll-behavior:contain}:host([data-show]){display:flex}:host([common]:not([isfullscreen])) .container,:host([rounded]:not([isfullscreen])) .container{border-radius:var(--ds-border-radius, 0.375rem)}:host([common][isfullscreen]) .container,:host([rounded][isfullscreen]) .container{border-radius:unset;box-shadow:unset}:host(:not([isfullscreen])) .container.shape-box{border-radius:unset}:host(:not([isfullscreen])) .container[class*=shape-pill],:host(:not([isfullscreen])) .container[class*=shape-snowflake]{border-radius:30px}.container{display:inline-block;overflow:auto;box-sizing:border-box;border-radius:var(--ds-border-radius, 0.375rem);margin:var(--ds-size-50, 0.25rem) 0}`;
|
|
2754
3015
|
|
|
2755
3016
|
var colorCss$2 = i$2`.container{background-color:var(--ds-auro-dropdownbib-container-color);box-shadow:var(--ds-auro-dropdownbib-boxshadow-color);color:var(--ds-auro-dropdownbib-text-color)}`;
|
|
2756
3017
|
|
|
2757
|
-
var tokensCss$1 = i$2`:host(:not([ondark])){--ds-auro-dropdown-label-text-color: var(--ds-basic-color-texticon-muted, #676767);--ds-auro-dropdown-trigger-background-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-dropdown-trigger-container-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-dropdown-trigger-border-color: var(--ds-basic-color-border-bold, #585e67);--ds-auro-dropdown-trigger-outline-color: transparent;--ds-auro-dropdown-trigger-text-color: var(--ds-basic-color-texticon-default, #2a2a2a);--ds-auro-
|
|
3018
|
+
var tokensCss$1 = i$2`:host(:not([ondark])){--ds-auro-dropdown-label-text-color: var(--ds-basic-color-texticon-muted, #676767);--ds-auro-dropdown-trigger-background-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-dropdown-trigger-container-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-dropdown-trigger-border-color: var(--ds-basic-color-border-bold, #585e67);--ds-auro-dropdown-trigger-outline-color: transparent;--ds-auro-dropdown-trigger-text-color: var(--ds-basic-color-texticon-default, #2a2a2a);--ds-auro-dropdownbib-boxshadow-color: var(--ds-elevation-200, 0px 0px 10px rgba(0, 0, 0, 0.15));--ds-auro-dropdownbib-background-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-dropdownbib-container-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-dropdownbib-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}:host([ondark]){--ds-auro-dropdown-label-text-color: var(--ds-basic-color-texticon-inverse-muted, #ccd2db);--ds-auro-dropdown-trigger-background-color: var(--ds-advanced-color-shared-background-inverse, rgba(255, 255, 255, 0.15));--ds-auro-dropdown-trigger-container-color: var(--ds-advanced-color-shared-background-inverse, rgba(255, 255, 255, 0.15));--ds-auro-dropdown-trigger-border-color: var(--ds-basic-color-border-inverse, #ffffff);--ds-auro-dropdown-trigger-outline-color: transparent;--ds-auro-dropdown-trigger-text-color: var(--ds-basic-color-texticon-inverse, #ffffff);--ds-auro-dropdownbib-boxshadow-color: var(--ds-elevation-200, 0px 0px 10px rgba(0, 0, 0, 0.15));--ds-auro-dropdownbib-background-color: var(--ds-advanced-color-shared-background-inverse, rgba(255, 255, 255, 0.15));--ds-auro-dropdownbib-container-color: var(--ds-advanced-color-shared-background-inverse, rgba(255, 255, 255, 0.15));--ds-auro-dropdownbib-text-color: var(--ds-basic-color-texticon-inverse, #ffffff)}`;
|
|
2758
3019
|
|
|
2759
3020
|
// Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
2760
3021
|
// See LICENSE in the project root for license information.
|
|
@@ -2914,17 +3175,6 @@ class AuroDropdownBib extends i {
|
|
|
2914
3175
|
}
|
|
2915
3176
|
}
|
|
2916
3177
|
});
|
|
2917
|
-
|
|
2918
|
-
this.preventBodyScroll = this.preventBodyScroll.bind(this);
|
|
2919
|
-
this.addEventListener('touchmove', this.preventBodyScroll, { passive: false });
|
|
2920
|
-
this.addEventListener('touchstart', this.preventBodyScroll, { passive: false });
|
|
2921
|
-
}
|
|
2922
|
-
|
|
2923
|
-
disconnectedCallback() {
|
|
2924
|
-
super.disconnectedCallback();
|
|
2925
|
-
|
|
2926
|
-
this.removeEventListener('touchmove', this.preventBodyScroll, { passive: false });
|
|
2927
|
-
this.removeEventListener('touchstart', this.preventBodyScroll, { passive: false });
|
|
2928
3178
|
}
|
|
2929
3179
|
|
|
2930
3180
|
firstUpdated(changedProperties) {
|
|
@@ -2940,19 +3190,6 @@ class AuroDropdownBib extends i {
|
|
|
2940
3190
|
}));
|
|
2941
3191
|
}
|
|
2942
3192
|
|
|
2943
|
-
/**
|
|
2944
|
-
* Prevents scrolling of the body when touching empty areas of the component.
|
|
2945
|
-
* @param {Event} event - The touchmove event.
|
|
2946
|
-
* @returns {void}
|
|
2947
|
-
*/
|
|
2948
|
-
preventBodyScroll(event) {
|
|
2949
|
-
// when touchmove/touchstart on empty space
|
|
2950
|
-
if (event.target === this) {
|
|
2951
|
-
event.preventDefault();
|
|
2952
|
-
event.stopImmediatePropagation();
|
|
2953
|
-
}
|
|
2954
|
-
}
|
|
2955
|
-
|
|
2956
3193
|
// function that renders the HTML and CSS into the scope of the component
|
|
2957
3194
|
render() {
|
|
2958
3195
|
const classes = {
|
|
@@ -2975,19 +3212,19 @@ var dropdownVersion = '3.0.0';
|
|
|
2975
3212
|
|
|
2976
3213
|
var shapeSizeCss = i$2`.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}`;
|
|
2977
3214
|
|
|
2978
|
-
var colorCss$1 = i$2`:host .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,:host(:not([ondark])) .wrapper:
|
|
3215
|
+
var colorCss$1 = i$2`: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)}`;
|
|
2979
3216
|
|
|
2980
|
-
var classicColorCss = i$2
|
|
3217
|
+
var classicColorCss = i$2``;
|
|
2981
3218
|
|
|
2982
|
-
var classicLayoutCss = i$2`: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]) .
|
|
3219
|
+
var classicLayoutCss = i$2`: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%}`;
|
|
2983
3220
|
|
|
2984
|
-
var styleEmphasizedCss = i$2`: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-direction:row
|
|
3221
|
+
var styleEmphasizedCss = i$2`: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)}`;
|
|
2985
3222
|
|
|
2986
|
-
var styleSnowflakeCss = i$2`:host{display:block}.wrapper{display:flex;flex-direction:row
|
|
3223
|
+
var styleSnowflakeCss = i$2`:host{display:block}.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*=snowflake]) .leftIndent{width:calc(100% - var(--ds-size-600, 3rem));margin-left:var(--ds-size-300, 1.5rem)}:host([layout*=snowflake]) .rightIndent{width:calc(100% - var(--ds-size-600, 3rem));margin-right:var(--ds-size-300, 1.5rem)}.layout-snowflake .chevron,.layout-snowflake-left .chevron,.layout-snowflake-right .chevron{margin-right:var(--ds-size-300, 1.5rem)}`;
|
|
2987
3224
|
|
|
2988
3225
|
var colorCss = i$2`: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)}`;
|
|
2989
3226
|
|
|
2990
|
-
var styleCss = i$2
|
|
3227
|
+
var styleCss = i$2`: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}`;
|
|
2991
3228
|
|
|
2992
3229
|
var tokensCss = i$2`:host{--ds-auro-helptext-color: var(--ds-basic-color-texticon-muted, #676767)}`;
|
|
2993
3230
|
|
|
@@ -3292,10 +3529,8 @@ class AuroElement extends i {
|
|
|
3292
3529
|
// See LICENSE in the project root for license information.
|
|
3293
3530
|
|
|
3294
3531
|
|
|
3295
|
-
|
|
3296
|
-
* @attr { Boolean } disableEventShow - If declared, the dropdown will only show by calling the API .show() public method.
|
|
3532
|
+
/*
|
|
3297
3533
|
* @slot - Default slot for the popover content.
|
|
3298
|
-
* @slot label - Defines the content of the label.
|
|
3299
3534
|
* @slot helpText - Defines the content of the helpText.
|
|
3300
3535
|
* @slot trigger - Defines the content of the trigger.
|
|
3301
3536
|
* @csspart trigger - The trigger content container.
|
|
@@ -3314,18 +3549,22 @@ class AuroDropdown extends AuroElement {
|
|
|
3314
3549
|
this.matchWidth = false;
|
|
3315
3550
|
this.noHideOnThisFocusLoss = false;
|
|
3316
3551
|
|
|
3317
|
-
this.errorMessage =
|
|
3552
|
+
this.errorMessage = undefined; // TODO - check with Doug if there is still more to do here
|
|
3318
3553
|
|
|
3319
3554
|
// Layout Config
|
|
3320
|
-
this.layout =
|
|
3321
|
-
this.shape =
|
|
3322
|
-
this.size =
|
|
3555
|
+
this.layout = undefined;
|
|
3556
|
+
this.shape = undefined;
|
|
3557
|
+
this.size = undefined;
|
|
3323
3558
|
|
|
3324
3559
|
this.parentBorder = false;
|
|
3325
3560
|
|
|
3326
3561
|
this.privateDefaults();
|
|
3327
3562
|
}
|
|
3328
3563
|
|
|
3564
|
+
/**
|
|
3565
|
+
* @private
|
|
3566
|
+
* @returns {object} Class definition for the wrapper element.
|
|
3567
|
+
*/
|
|
3329
3568
|
get commonWrapperClasses() {
|
|
3330
3569
|
return {
|
|
3331
3570
|
'trigger': true,
|
|
@@ -3343,13 +3582,10 @@ class AuroDropdown extends AuroElement {
|
|
|
3343
3582
|
privateDefaults() {
|
|
3344
3583
|
this.chevron = false;
|
|
3345
3584
|
this.disabled = false;
|
|
3585
|
+
this.disableFocusTrap = false;
|
|
3346
3586
|
this.error = false;
|
|
3347
|
-
this.inset = false;
|
|
3348
|
-
this.rounded = false;
|
|
3349
3587
|
this.tabIndex = 0;
|
|
3350
3588
|
this.noToggle = false;
|
|
3351
|
-
this.a11yAutocomplete = 'none';
|
|
3352
|
-
this.labeled = true;
|
|
3353
3589
|
this.a11yRole = 'button';
|
|
3354
3590
|
this.onDark = false;
|
|
3355
3591
|
this.showTriggerBorders = true;
|
|
@@ -3445,6 +3681,18 @@ class AuroDropdown extends AuroElement {
|
|
|
3445
3681
|
this.floater.showBib();
|
|
3446
3682
|
}
|
|
3447
3683
|
|
|
3684
|
+
/**
|
|
3685
|
+
* When bib is open, focus on the first element inside of bib.
|
|
3686
|
+
* If not, trigger element will get focus.
|
|
3687
|
+
*/
|
|
3688
|
+
focus() {
|
|
3689
|
+
if (this.isPopoverVisible && this.focusTrap) {
|
|
3690
|
+
this.focusTrap.focusFirstElement();
|
|
3691
|
+
} else {
|
|
3692
|
+
this.trigger.focus();
|
|
3693
|
+
}
|
|
3694
|
+
}
|
|
3695
|
+
|
|
3448
3696
|
// function to define props used within the scope of this component
|
|
3449
3697
|
static get properties() {
|
|
3450
3698
|
return {
|
|
@@ -3458,6 +3706,15 @@ class AuroDropdown extends AuroElement {
|
|
|
3458
3706
|
reflect: true
|
|
3459
3707
|
},
|
|
3460
3708
|
|
|
3709
|
+
/**
|
|
3710
|
+
* If declared, the dropdown will only show by calling the API .show() public method.
|
|
3711
|
+
* @default false
|
|
3712
|
+
*/
|
|
3713
|
+
disableEventShow: {
|
|
3714
|
+
type: Boolean,
|
|
3715
|
+
reflect: true
|
|
3716
|
+
},
|
|
3717
|
+
|
|
3461
3718
|
/**
|
|
3462
3719
|
* If declared, applies a border around the trigger slot.
|
|
3463
3720
|
*/
|
|
@@ -3476,17 +3733,17 @@ class AuroDropdown extends AuroElement {
|
|
|
3476
3733
|
},
|
|
3477
3734
|
|
|
3478
3735
|
/**
|
|
3479
|
-
* If declared, the dropdown
|
|
3736
|
+
* If declared, the dropdown is not interactive.
|
|
3480
3737
|
*/
|
|
3481
|
-
|
|
3738
|
+
disabled: {
|
|
3482
3739
|
type: Boolean,
|
|
3483
3740
|
reflect: true
|
|
3484
3741
|
},
|
|
3485
3742
|
|
|
3486
3743
|
/**
|
|
3487
|
-
* If declared, the
|
|
3744
|
+
* If declared, the focus trap inside of bib will be turned off.
|
|
3488
3745
|
*/
|
|
3489
|
-
|
|
3746
|
+
disableFocusTrap: {
|
|
3490
3747
|
type: Boolean,
|
|
3491
3748
|
reflect: true
|
|
3492
3749
|
},
|
|
@@ -3531,22 +3788,6 @@ class AuroDropdown extends AuroElement {
|
|
|
3531
3788
|
reflect: true
|
|
3532
3789
|
},
|
|
3533
3790
|
|
|
3534
|
-
/**
|
|
3535
|
-
* Makes the trigger to be full width of its parent container.
|
|
3536
|
-
*/
|
|
3537
|
-
fluid: {
|
|
3538
|
-
type: Boolean,
|
|
3539
|
-
reflect: true
|
|
3540
|
-
},
|
|
3541
|
-
|
|
3542
|
-
/**
|
|
3543
|
-
* If declared, will apply padding around trigger slot content.
|
|
3544
|
-
*/
|
|
3545
|
-
inset: {
|
|
3546
|
-
type: Boolean,
|
|
3547
|
-
reflect: true
|
|
3548
|
-
},
|
|
3549
|
-
|
|
3550
3791
|
/**
|
|
3551
3792
|
* If true, the dropdown bib is displayed.
|
|
3552
3793
|
*/
|
|
@@ -3590,15 +3831,6 @@ class AuroDropdown extends AuroElement {
|
|
|
3590
3831
|
reflect: true
|
|
3591
3832
|
},
|
|
3592
3833
|
|
|
3593
|
-
/**
|
|
3594
|
-
* Defines if there is a label preset.
|
|
3595
|
-
* @private
|
|
3596
|
-
*/
|
|
3597
|
-
labeled: {
|
|
3598
|
-
type: Boolean,
|
|
3599
|
-
reflect: true
|
|
3600
|
-
},
|
|
3601
|
-
|
|
3602
3834
|
/**
|
|
3603
3835
|
* Defines if the trigger should size based on the parent element providing the border UI.
|
|
3604
3836
|
* @private
|
|
@@ -3659,6 +3891,9 @@ class AuroDropdown extends AuroElement {
|
|
|
3659
3891
|
reflect: true
|
|
3660
3892
|
},
|
|
3661
3893
|
|
|
3894
|
+
/**
|
|
3895
|
+
* If declared, and a function is set, that function will execute when the slot content is updated.
|
|
3896
|
+
*/
|
|
3662
3897
|
onSlotChange: {
|
|
3663
3898
|
type: Function,
|
|
3664
3899
|
reflect: false
|
|
@@ -3673,14 +3908,6 @@ class AuroDropdown extends AuroElement {
|
|
|
3673
3908
|
reflect: true
|
|
3674
3909
|
},
|
|
3675
3910
|
|
|
3676
|
-
/**
|
|
3677
|
-
* If declared, will apply border-radius to trigger and default slots.
|
|
3678
|
-
*/
|
|
3679
|
-
rounded: {
|
|
3680
|
-
type: Boolean,
|
|
3681
|
-
reflect: true
|
|
3682
|
-
},
|
|
3683
|
-
|
|
3684
3911
|
/**
|
|
3685
3912
|
* @private
|
|
3686
3913
|
*/
|
|
@@ -3695,22 +3922,14 @@ class AuroDropdown extends AuroElement {
|
|
|
3695
3922
|
type: String || undefined,
|
|
3696
3923
|
attribute: false,
|
|
3697
3924
|
reflect: false
|
|
3698
|
-
},
|
|
3699
|
-
|
|
3700
|
-
/**
|
|
3701
|
-
* The value for the aria-autocomplete attribute of the trigger element.
|
|
3702
|
-
*/
|
|
3703
|
-
a11yAutocomplete: {
|
|
3704
|
-
type: String,
|
|
3705
|
-
attribute: false,
|
|
3706
3925
|
}
|
|
3707
3926
|
};
|
|
3708
3927
|
}
|
|
3709
3928
|
|
|
3710
3929
|
static get styles() {
|
|
3711
3930
|
return [
|
|
3712
|
-
colorCss$1,
|
|
3713
3931
|
tokensCss$1,
|
|
3932
|
+
colorCss$1,
|
|
3714
3933
|
|
|
3715
3934
|
// default layout
|
|
3716
3935
|
classicColorCss,
|
|
@@ -3773,6 +3992,12 @@ class AuroDropdown extends AuroElement {
|
|
|
3773
3992
|
this.handleTriggerContentSlotChange();
|
|
3774
3993
|
}
|
|
3775
3994
|
|
|
3995
|
+
if (changedProperties.has('isPopoverVisible')) {
|
|
3996
|
+
this.updateFocusTrap();
|
|
3997
|
+
if (!this.isPopoverVisible && this.hasFocus) {
|
|
3998
|
+
this.trigger.focus();
|
|
3999
|
+
}
|
|
4000
|
+
}
|
|
3776
4001
|
}
|
|
3777
4002
|
|
|
3778
4003
|
firstUpdated() {
|
|
@@ -3793,9 +4018,6 @@ class AuroDropdown extends AuroElement {
|
|
|
3793
4018
|
}
|
|
3794
4019
|
|
|
3795
4020
|
this.bibContent = this.floater.element.bib;
|
|
3796
|
-
this.bibContent.setAttribute('role', 'dialog');
|
|
3797
|
-
this.bibContent.setAttribute('aria-modal', 'true');
|
|
3798
|
-
this.bibContent.setAttribute('aria-labelledby', 'triggerLabel');
|
|
3799
4021
|
|
|
3800
4022
|
// Add the tag name as an attribute if it is different than the component name
|
|
3801
4023
|
this.runtimeUtils.handleComponentTagRename(this, 'auro-dropdown');
|
|
@@ -3841,6 +4063,27 @@ class AuroDropdown extends AuroElement {
|
|
|
3841
4063
|
this.hasFocus = true;
|
|
3842
4064
|
}
|
|
3843
4065
|
|
|
4066
|
+
/**
|
|
4067
|
+
* @private
|
|
4068
|
+
*/
|
|
4069
|
+
updateFocusTrap() {
|
|
4070
|
+
// If the dropdown is open, create a focus trap and focus the first element
|
|
4071
|
+
if (this.isPopoverVisible && !this.disableFocusTrap) {
|
|
4072
|
+
this.focusTrap = new FocusTrap(this.bibContent);
|
|
4073
|
+
this.focusTrap.focusFirstElement();
|
|
4074
|
+
return;
|
|
4075
|
+
}
|
|
4076
|
+
|
|
4077
|
+
// Guard Clause: Ensure there is a focus trap currently active before continuing
|
|
4078
|
+
if (!this.focusTrap) {
|
|
4079
|
+
return;
|
|
4080
|
+
}
|
|
4081
|
+
|
|
4082
|
+
// If the dropdown is not open, disconnect the focus trap if it exists
|
|
4083
|
+
this.focusTrap.disconnect();
|
|
4084
|
+
this.focusTrap = undefined;
|
|
4085
|
+
}
|
|
4086
|
+
|
|
3844
4087
|
/**
|
|
3845
4088
|
* Function to support @focusout event.
|
|
3846
4089
|
* @private
|
|
@@ -4126,10 +4369,7 @@ class AuroDropdown extends AuroElement {
|
|
|
4126
4369
|
id="bib"
|
|
4127
4370
|
shape="${this.shape}"
|
|
4128
4371
|
?data-show="${this.isPopoverVisible}"
|
|
4129
|
-
?isfullscreen="${this.isBibFullscreen}"
|
|
4130
|
-
?common="${this.common}"
|
|
4131
|
-
?rounded="${this.common || this.rounded}"
|
|
4132
|
-
?inset="${this.common || this.inset}">
|
|
4372
|
+
?isfullscreen="${this.isBibFullscreen}">
|
|
4133
4373
|
<div class="slotContent">
|
|
4134
4374
|
<slot @slotchange="${this.handleDefaultSlot}"></slot>
|
|
4135
4375
|
</div>
|
|
@@ -16,18 +16,24 @@
|
|
|
16
16
|
<head>
|
|
17
17
|
<meta charset="UTF-8" />
|
|
18
18
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
19
|
-
<title>Auro Web Component
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/auro-classic/CSSCustomProperties.css"
|
|
26
|
-
|
|
19
|
+
<title>Auro Web Component Demo | auro-dropdown</title>
|
|
20
|
+
|
|
21
|
+
<!-- Prism.js Stylesheet -->
|
|
22
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/prismjs@1.24.1/themes/prism.css"/>
|
|
23
|
+
|
|
24
|
+
<!-- Legacy reference is still needed to support auro-dropdown's use of legacy token values at this time -->
|
|
25
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/legacy/auro-classic/CSSCustomProperties.css"/>
|
|
26
|
+
|
|
27
|
+
<!-- Design Token Alaska Theme -->
|
|
28
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/themes/alaska/CSSCustomProperties--alaska.min.css"/>
|
|
29
|
+
|
|
30
|
+
<!-- Webcore Stylesheet Alaska Theme -->
|
|
31
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/bundled/themes/alaska.global.min.css" />
|
|
32
|
+
|
|
33
|
+
<!-- Demo Specific Styles -->
|
|
27
34
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/demoWrapper.css" />
|
|
28
35
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/elementDemoStyles.css" />
|
|
29
|
-
|
|
30
|
-
</head>
|
|
36
|
+
</head>
|
|
31
37
|
<body class="auro-markdown">
|
|
32
38
|
<main></main>
|
|
33
39
|
|