@aurodesignsystem-dev/auro-formkit 0.0.0-pr741.0 → 0.0.0-pr750.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/components/bibtemplate/dist/index.js +1 -1
  2. package/components/bibtemplate/dist/registered.js +1 -1
  3. package/components/checkbox/demo/api.html +16 -10
  4. package/components/checkbox/demo/api.min.js +11 -11
  5. package/components/checkbox/demo/index.html +16 -10
  6. package/components/checkbox/demo/index.min.js +11 -11
  7. package/components/checkbox/demo/readme.html +16 -9
  8. package/components/checkbox/dist/index.js +11 -11
  9. package/components/checkbox/dist/registered.js +11 -11
  10. package/components/combobox/demo/api.html +16 -10
  11. package/components/combobox/demo/api.md +12 -6
  12. package/components/combobox/demo/api.min.js +411 -103
  13. package/components/combobox/demo/index.html +16 -10
  14. package/components/combobox/demo/index.min.js +411 -103
  15. package/components/combobox/demo/readme.html +16 -9
  16. package/components/combobox/dist/index.js +374 -91
  17. package/components/combobox/dist/registered.js +374 -91
  18. package/components/counter/demo/api.html +16 -10
  19. package/components/counter/demo/api.md +140 -7
  20. package/components/counter/demo/api.min.js +1145 -987
  21. package/components/counter/demo/index.html +16 -10
  22. package/components/counter/demo/index.md +82 -0
  23. package/components/counter/demo/index.min.js +1145 -987
  24. package/components/counter/demo/readme.html +16 -9
  25. package/components/counter/dist/auro-counter-group.d.ts +64 -23
  26. package/components/counter/dist/auro-counter.d.ts +10 -0
  27. package/components/counter/dist/index.js +1145 -987
  28. package/components/counter/dist/registered.js +1145 -987
  29. package/components/datepicker/demo/api.html +16 -10
  30. package/components/datepicker/demo/api.min.js +374 -91
  31. package/components/datepicker/demo/index.html +16 -10
  32. package/components/datepicker/demo/index.min.js +374 -91
  33. package/components/datepicker/demo/readme.html +16 -9
  34. package/components/datepicker/dist/auro-datepicker.d.ts +6 -0
  35. package/components/datepicker/dist/index.js +374 -91
  36. package/components/datepicker/dist/registered.js +374 -91
  37. package/components/dropdown/demo/api.html +16 -10
  38. package/components/dropdown/demo/api.md +77 -267
  39. package/components/dropdown/demo/api.min.js +331 -64
  40. package/components/dropdown/demo/index.html +16 -10
  41. package/components/dropdown/demo/index.md +45 -363
  42. package/components/dropdown/demo/index.min.js +331 -64
  43. package/components/dropdown/demo/readme.html +16 -9
  44. package/components/dropdown/dist/auro-dropdown.d.ts +35 -67
  45. package/components/dropdown/dist/index.js +331 -64
  46. package/components/dropdown/dist/registered.js +331 -64
  47. package/components/form/demo/api.html +16 -9
  48. package/components/form/demo/autocomplete.html +19 -3
  49. package/components/form/demo/index.html +16 -9
  50. package/components/form/demo/readme.html +16 -9
  51. package/components/form/demo/working.html +19 -13
  52. package/components/helptext/dist/index.js +1 -1
  53. package/components/helptext/dist/registered.js +1 -1
  54. package/components/input/demo/api.html +16 -10
  55. package/components/input/demo/api.md +1 -1
  56. package/components/input/demo/api.min.js +14 -14
  57. package/components/input/demo/index.html +16 -10
  58. package/components/input/demo/index.min.js +14 -14
  59. package/components/input/demo/readme.html +16 -9
  60. package/components/input/dist/base-input.d.ts +1 -1
  61. package/components/input/dist/index.js +14 -14
  62. package/components/input/dist/registered.js +14 -14
  63. package/components/menu/demo/api.html +16 -32
  64. package/components/menu/demo/api.md +1 -1
  65. package/components/menu/demo/api.min.js +37 -12
  66. package/components/menu/demo/index.html +16 -10
  67. package/components/menu/demo/index.min.js +37 -12
  68. package/components/menu/demo/readme.html +16 -9
  69. package/components/menu/dist/auro-menu.d.ts +13 -2
  70. package/components/menu/dist/index.js +37 -12
  71. package/components/menu/dist/registered.js +37 -12
  72. package/components/radio/demo/api.html +16 -10
  73. package/components/radio/demo/api.md +0 -1
  74. package/components/radio/demo/api.min.js +61 -76
  75. package/components/radio/demo/index.html +16 -10
  76. package/components/radio/demo/index.min.js +61 -76
  77. package/components/radio/demo/readme.html +16 -9
  78. package/components/radio/dist/auro-radio.d.ts +8 -11
  79. package/components/radio/dist/index.js +61 -76
  80. package/components/radio/dist/registered.js +61 -76
  81. package/components/select/demo/api.html +16 -10
  82. package/components/select/demo/api.js +0 -2
  83. package/components/select/demo/api.md +53 -51
  84. package/components/select/demo/api.min.js +491 -326
  85. package/components/select/demo/index.html +16 -11
  86. package/components/select/demo/index.md +6 -158
  87. package/components/select/demo/index.min.js +491 -314
  88. package/components/select/demo/readme.html +16 -9
  89. package/components/select/dist/auro-select.d.ts +33 -8
  90. package/components/select/dist/index.js +454 -302
  91. package/components/select/dist/registered.js +454 -302
  92. 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
 
@@ -2951,11 +3212,11 @@ var dropdownVersion = '3.0.0';
2951
3212
 
2952
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}`;
2953
3214
 
2954
- var colorCss$1 = i$2`: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)}`;
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)}`;
2955
3216
 
2956
3217
  var classicColorCss = i$2``;
2957
3218
 
2958
- 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([layout*=classic]:not([simple])) .triggerContentWrapper{padding-left:var(--ds-size-150, 0.75rem)}:host([layout*=classic][matchwidth]) #bibSizer{width:100%}:host([layout*=classic][disabled]){pointer-events:none}`;
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%}`;
2959
3220
 
2960
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)}`;
2961
3222
 
@@ -2963,7 +3224,7 @@ var styleSnowflakeCss = i$2`:host{display:block}.wrapper{display:flex;flex:1;fle
2963
3224
 
2964
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)}`;
2965
3226
 
2966
- var styleCss = i$2`.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}`;
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}`;
2967
3228
 
2968
3229
  var tokensCss = i$2`:host{--ds-auro-helptext-color: var(--ds-basic-color-texticon-muted, #676767)}`;
2969
3230
 
@@ -3268,10 +3529,8 @@ class AuroElement extends i {
3268
3529
  // See LICENSE in the project root for license information.
3269
3530
 
3270
3531
 
3271
- /**
3272
- * @attr { Boolean } disableEventShow - If declared, the dropdown will only show by calling the API .show() public method.
3532
+ /*
3273
3533
  * @slot - Default slot for the popover content.
3274
- * @slot label - Defines the content of the label.
3275
3534
  * @slot helpText - Defines the content of the helpText.
3276
3535
  * @slot trigger - Defines the content of the trigger.
3277
3536
  * @csspart trigger - The trigger content container.
@@ -3290,18 +3549,22 @@ class AuroDropdown extends AuroElement {
3290
3549
  this.matchWidth = false;
3291
3550
  this.noHideOnThisFocusLoss = false;
3292
3551
 
3293
- this.errorMessage = ''; // TODO - check with Doug if there is still more to do here
3552
+ this.errorMessage = undefined; // TODO - check with Doug if there is still more to do here
3294
3553
 
3295
3554
  // Layout Config
3296
- this.layout = 'classic';
3297
- this.shape = 'classic';
3298
- this.size = 'xl';
3555
+ this.layout = undefined;
3556
+ this.shape = undefined;
3557
+ this.size = undefined;
3299
3558
 
3300
3559
  this.parentBorder = false;
3301
3560
 
3302
3561
  this.privateDefaults();
3303
3562
  }
3304
3563
 
3564
+ /**
3565
+ * @private
3566
+ * @returns {object} Class definition for the wrapper element.
3567
+ */
3305
3568
  get commonWrapperClasses() {
3306
3569
  return {
3307
3570
  'trigger': true,
@@ -3319,13 +3582,10 @@ class AuroDropdown extends AuroElement {
3319
3582
  privateDefaults() {
3320
3583
  this.chevron = false;
3321
3584
  this.disabled = false;
3585
+ this.disableFocusTrap = false;
3322
3586
  this.error = false;
3323
- this.inset = false;
3324
- this.rounded = false;
3325
3587
  this.tabIndex = 0;
3326
3588
  this.noToggle = false;
3327
- this.a11yAutocomplete = 'none';
3328
- this.labeled = true;
3329
3589
  this.a11yRole = 'button';
3330
3590
  this.onDark = false;
3331
3591
  this.showTriggerBorders = true;
@@ -3421,6 +3681,18 @@ class AuroDropdown extends AuroElement {
3421
3681
  this.floater.showBib();
3422
3682
  }
3423
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
+
3424
3696
  // function to define props used within the scope of this component
3425
3697
  static get properties() {
3426
3698
  return {
@@ -3434,6 +3706,15 @@ class AuroDropdown extends AuroElement {
3434
3706
  reflect: true
3435
3707
  },
3436
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
+
3437
3718
  /**
3438
3719
  * If declared, applies a border around the trigger slot.
3439
3720
  */
@@ -3452,17 +3733,17 @@ class AuroDropdown extends AuroElement {
3452
3733
  },
3453
3734
 
3454
3735
  /**
3455
- * If declared, the dropdown will be styled with the common theme.
3736
+ * If declared, the dropdown is not interactive.
3456
3737
  */
3457
- common: {
3738
+ disabled: {
3458
3739
  type: Boolean,
3459
3740
  reflect: true
3460
3741
  },
3461
3742
 
3462
3743
  /**
3463
- * If declared, the dropdown is not interactive.
3744
+ * If declared, the focus trap inside of bib will be turned off.
3464
3745
  */
3465
- disabled: {
3746
+ disableFocusTrap: {
3466
3747
  type: Boolean,
3467
3748
  reflect: true
3468
3749
  },
@@ -3507,22 +3788,6 @@ class AuroDropdown extends AuroElement {
3507
3788
  reflect: true
3508
3789
  },
3509
3790
 
3510
- /**
3511
- * Makes the trigger to be full width of its parent container.
3512
- */
3513
- fluid: {
3514
- type: Boolean,
3515
- reflect: true
3516
- },
3517
-
3518
- /**
3519
- * If declared, will apply padding around trigger slot content.
3520
- */
3521
- inset: {
3522
- type: Boolean,
3523
- reflect: true
3524
- },
3525
-
3526
3791
  /**
3527
3792
  * If true, the dropdown bib is displayed.
3528
3793
  */
@@ -3566,15 +3831,6 @@ class AuroDropdown extends AuroElement {
3566
3831
  reflect: true
3567
3832
  },
3568
3833
 
3569
- /**
3570
- * Defines if there is a label preset.
3571
- * @private
3572
- */
3573
- labeled: {
3574
- type: Boolean,
3575
- reflect: true
3576
- },
3577
-
3578
3834
  /**
3579
3835
  * Defines if the trigger should size based on the parent element providing the border UI.
3580
3836
  * @private
@@ -3635,6 +3891,9 @@ class AuroDropdown extends AuroElement {
3635
3891
  reflect: true
3636
3892
  },
3637
3893
 
3894
+ /**
3895
+ * If declared, and a function is set, that function will execute when the slot content is updated.
3896
+ */
3638
3897
  onSlotChange: {
3639
3898
  type: Function,
3640
3899
  reflect: false
@@ -3649,14 +3908,6 @@ class AuroDropdown extends AuroElement {
3649
3908
  reflect: true
3650
3909
  },
3651
3910
 
3652
- /**
3653
- * If declared, will apply border-radius to trigger and default slots.
3654
- */
3655
- rounded: {
3656
- type: Boolean,
3657
- reflect: true
3658
- },
3659
-
3660
3911
  /**
3661
3912
  * @private
3662
3913
  */
@@ -3671,22 +3922,14 @@ class AuroDropdown extends AuroElement {
3671
3922
  type: String || undefined,
3672
3923
  attribute: false,
3673
3924
  reflect: false
3674
- },
3675
-
3676
- /**
3677
- * The value for the aria-autocomplete attribute of the trigger element.
3678
- */
3679
- a11yAutocomplete: {
3680
- type: String,
3681
- attribute: false,
3682
3925
  }
3683
3926
  };
3684
3927
  }
3685
3928
 
3686
3929
  static get styles() {
3687
3930
  return [
3688
- colorCss$1,
3689
3931
  tokensCss$1,
3932
+ colorCss$1,
3690
3933
 
3691
3934
  // default layout
3692
3935
  classicColorCss,
@@ -3749,6 +3992,12 @@ class AuroDropdown extends AuroElement {
3749
3992
  this.handleTriggerContentSlotChange();
3750
3993
  }
3751
3994
 
3995
+ if (changedProperties.has('isPopoverVisible')) {
3996
+ this.updateFocusTrap();
3997
+ if (!this.isPopoverVisible && this.hasFocus) {
3998
+ this.trigger.focus();
3999
+ }
4000
+ }
3752
4001
  }
3753
4002
 
3754
4003
  firstUpdated() {
@@ -3814,6 +4063,27 @@ class AuroDropdown extends AuroElement {
3814
4063
  this.hasFocus = true;
3815
4064
  }
3816
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
+
3817
4087
  /**
3818
4088
  * Function to support @focusout event.
3819
4089
  * @private
@@ -4099,10 +4369,7 @@ class AuroDropdown extends AuroElement {
4099
4369
  id="bib"
4100
4370
  shape="${this.shape}"
4101
4371
  ?data-show="${this.isPopoverVisible}"
4102
- ?isfullscreen="${this.isBibFullscreen}"
4103
- ?common="${this.common}"
4104
- ?rounded="${this.common || this.rounded}"
4105
- ?inset="${this.common || this.inset}">
4372
+ ?isfullscreen="${this.isBibFullscreen}">
4106
4373
  <div class="slotContent">
4107
4374
  <slot @slotchange="${this.handleDefaultSlot}"></slot>
4108
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 Generator | auro-dropdown custom element</title>
20
- <link
21
- rel="stylesheet"
22
- type="text/css"
23
- href="https://cdn.jsdelivr.net/npm/prismjs@1.24.1/themes/prism.css"
24
- />
25
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/auro-classic/CSSCustomProperties.css">
26
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/alaska/CSSCustomProperties--alaska.css">
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
- <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/bundled/essentials-as.css" />
30
- </head>
36
+ </head>
31
37
  <body class="auro-markdown">
32
38
  <main></main>
33
39