@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.
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
@@ -2282,6 +2282,267 @@ class AuroFloatingUI {
2282
2282
  }
2283
2283
  }
2284
2284
 
2285
+ // Selectors for focusable elements
2286
+ const FOCUSABLE_SELECTORS = [
2287
+ 'a[href]',
2288
+ 'button:not([disabled])',
2289
+ 'textarea:not([disabled])',
2290
+ 'input:not([disabled])',
2291
+ 'select:not([disabled])',
2292
+ '[role="tab"]:not([disabled])',
2293
+ '[role="link"]:not([disabled])',
2294
+ '[role="button"]:not([disabled])',
2295
+ '[tabindex]:not([tabindex="-1"])',
2296
+ '[contenteditable]:not([contenteditable="false"])'
2297
+ ];
2298
+
2299
+ // List of custom components that are known to be focusable
2300
+ const FOCUSABLE_COMPONENTS = [
2301
+ 'auro-checkbox',
2302
+ 'auro-radio',
2303
+ 'auro-dropdown',
2304
+ 'auro-button',
2305
+ 'auro-combobox',
2306
+ 'auro-input',
2307
+ 'auro-counter',
2308
+ 'auro-menu',
2309
+ 'auro-select',
2310
+ 'auro-datepicker',
2311
+ 'auro-hyperlink',
2312
+ 'auro-accordion',
2313
+ ];
2314
+
2315
+ /**
2316
+ * Determines if a given element is a custom focusable component.
2317
+ * Returns true if the element matches a known focusable component and is not disabled.
2318
+ *
2319
+ * @param {HTMLElement} element The element to check for focusability.
2320
+ * @returns {boolean} True if the element is a focusable custom component, false otherwise.
2321
+ */
2322
+ function isFocusableComponent(element) {
2323
+ const componentName = element.tagName.toLowerCase();
2324
+
2325
+ // Guard Clause: Element is a focusable component
2326
+ if (!FOCUSABLE_COMPONENTS.some((name) => element.hasAttribute(name) || componentName === name)) return false;
2327
+
2328
+ // Guard Clause: Element is not disabled
2329
+ if (element.hasAttribute('disabled')) return false;
2330
+
2331
+ // Guard Clause: The element is a hyperlink and has no href attribute
2332
+ if (componentName.match("hyperlink") && !element.hasAttribute('href')) return false;
2333
+
2334
+ // If all guard clauses pass, the element is a focusable component
2335
+ return true;
2336
+ }
2337
+
2338
+ /**
2339
+ * Retrieves all focusable elements within the container in DOM order, including those in shadow DOM and slots.
2340
+ * Returns a unique, ordered array of elements that can receive focus.
2341
+ *
2342
+ * @param {HTMLElement} container The container to search within
2343
+ * @returns {Array<HTMLElement>} An array of focusable elements within the container.
2344
+ */
2345
+ function getFocusableElements(container) {
2346
+ // Get elements in DOM order by walking the tree
2347
+ const orderedFocusableElements = [];
2348
+
2349
+ // Define a recursive function to collect focusable elements in DOM order
2350
+ const collectFocusableElements = (root) => {
2351
+ // Check if current element is focusable
2352
+ if (root.nodeType === Node.ELEMENT_NODE) {
2353
+ // Check if this is a custom component that is focusable
2354
+ const isComponentFocusable = isFocusableComponent(root);
2355
+
2356
+ if (isComponentFocusable) {
2357
+ // Add the component itself as a focusable element and don't traverse its shadow DOM
2358
+ orderedFocusableElements.push(root);
2359
+ return; // Skip traversing inside this component
2360
+ }
2361
+
2362
+ // Check if the element itself matches any selector
2363
+ for (const selector of FOCUSABLE_SELECTORS) {
2364
+ if (root.matches?.(selector)) {
2365
+ orderedFocusableElements.push(root);
2366
+ break; // Once we know it's focusable, no need to check other selectors
2367
+ }
2368
+ }
2369
+
2370
+ // Process shadow DOM only for non-Auro components
2371
+ if (root.shadowRoot) {
2372
+ // Process shadow DOM children in order
2373
+ if (root.shadowRoot.children) {
2374
+ Array.from(root.shadowRoot.children).forEach(child => {
2375
+ collectFocusableElements(child);
2376
+ });
2377
+ }
2378
+ }
2379
+
2380
+ // Process slots and their assigned nodes in order
2381
+ if (root.tagName === 'SLOT') {
2382
+ const assignedNodes = root.assignedNodes({ flatten: true });
2383
+ for (const node of assignedNodes) {
2384
+ collectFocusableElements(node);
2385
+ }
2386
+ } else {
2387
+ // Process light DOM children in order
2388
+ if (root.children) {
2389
+ Array.from(root.children).forEach(child => {
2390
+ collectFocusableElements(child);
2391
+ });
2392
+ }
2393
+ }
2394
+ }
2395
+ };
2396
+
2397
+ // Start the traversal from the container
2398
+ collectFocusableElements(container);
2399
+
2400
+ // Remove duplicates that might have been collected through different paths
2401
+ // while preserving order
2402
+ const uniqueElements = [];
2403
+ const seen = new Set();
2404
+
2405
+ for (const element of orderedFocusableElements) {
2406
+ if (!seen.has(element)) {
2407
+ seen.add(element);
2408
+ uniqueElements.push(element);
2409
+ }
2410
+ }
2411
+
2412
+ return uniqueElements;
2413
+ }
2414
+
2415
+ /**
2416
+ * FocusTrap manages keyboard focus within a specified container element, ensuring that focus does not leave the container when tabbing.
2417
+ * It is commonly used for modal dialogs or overlays to improve accessibility by trapping focus within interactive UI components.
2418
+ */
2419
+ class FocusTrap {
2420
+ /**
2421
+ * Creates a new FocusTrap instance for the given container element.
2422
+ * Initializes event listeners and prepares the container for focus management.
2423
+ *
2424
+ * @param {HTMLElement} container The DOM element to trap focus within.
2425
+ * @throws {Error} If the provided container is not a valid HTMLElement.
2426
+ */
2427
+ constructor(container) {
2428
+ if (!container || !(container instanceof HTMLElement)) {
2429
+ throw new Error("FocusTrap requires a valid HTMLElement.");
2430
+ }
2431
+
2432
+ this.container = container;
2433
+ this.tabDirection = 'forward'; // or 'backward'
2434
+
2435
+ this._init();
2436
+ }
2437
+
2438
+ /**
2439
+ * Initializes the focus trap by setting up event listeners and attributes on the container.
2440
+ * Prepares the container for focus management, including support for shadow DOM and inert attributes.
2441
+ *
2442
+ * @private
2443
+ */
2444
+ _init() {
2445
+
2446
+ // Add inert attribute to prevent focusing programmatically as well (if supported)
2447
+ if ('inert' in HTMLElement.prototype) {
2448
+ this.container.inert = false; // Ensure the container isn't inert
2449
+ this.container.setAttribute('data-focus-trap-container', true); // Mark for identification
2450
+ }
2451
+
2452
+ // Track tab direction
2453
+ this.container.addEventListener('keydown', this._onKeydown);
2454
+ }
2455
+
2456
+ /**
2457
+ * Handles keydown events to manage tab navigation within the container.
2458
+ * Ensures that focus wraps around when reaching the first or last focusable element.
2459
+ *
2460
+ * @param {KeyboardEvent} e The keyboard event triggered by user interaction.
2461
+ * @private
2462
+ */
2463
+ _onKeydown = (e) => {
2464
+
2465
+ if (e.key === 'Tab') {
2466
+
2467
+ // Set the tab direction based on the key pressed
2468
+ this.tabDirection = e.shiftKey ? 'backward' : 'forward';
2469
+
2470
+ // Get the active element(s) in the document and shadow root
2471
+ // This will include the active element in the shadow DOM if it exists
2472
+ // Active element may be inside the shadow DOM depending on delegatesFocus, so we need to check both
2473
+ let activeElement = document.activeElement;
2474
+ const actives = [activeElement];
2475
+ while (activeElement?.shadowRoot?.activeElement) {
2476
+ actives.push(activeElement.shadowRoot.activeElement);
2477
+ activeElement = activeElement.shadowRoot.activeElement;
2478
+ }
2479
+
2480
+ // Update the focusable elements
2481
+ const focusables = this._getFocusableElements();
2482
+
2483
+ // If we're at either end of the focusable elements, wrap around to the other end
2484
+ const focusIndex =
2485
+ (actives.includes(focusables[0]) || actives.includes(this.container)) && this.tabDirection === 'backward'
2486
+ ? focusables.length - 1
2487
+ : actives.includes(focusables[focusables.length - 1]) && this.tabDirection === 'forward'
2488
+ ? 0
2489
+ : null;
2490
+
2491
+ if (focusIndex !== null) {
2492
+ focusables[focusIndex].focus();
2493
+ e.preventDefault(); // Prevent default tab behavior
2494
+ e.stopPropagation(); // Stop the event from bubbling up
2495
+ }
2496
+ }
2497
+ };
2498
+
2499
+ /**
2500
+ * Retrieves all focusable elements within the container in DOM order, including those in shadow DOM and slots.
2501
+ * Returns a unique, ordered array of elements that can receive focus.
2502
+ *
2503
+ * @returns {Array<HTMLElement>} An array of focusable elements within the container.
2504
+ * @private
2505
+ */
2506
+ _getFocusableElements() {
2507
+ // Use the imported utility function to get focusable elements
2508
+ const elements = getFocusableElements(this.container);
2509
+
2510
+ // Filter out any elements with the 'focus-bookend' class
2511
+ return elements;
2512
+ }
2513
+
2514
+ /**
2515
+ * Moves focus to the first focusable element within the container.
2516
+ * Useful for setting initial focus when activating the focus trap.
2517
+ */
2518
+ focusFirstElement() {
2519
+ const focusables = this._getFocusableElements();
2520
+ if (focusables.length) focusables[0].focus();
2521
+ }
2522
+
2523
+ /**
2524
+ * Moves focus to the last focusable element within the container.
2525
+ * Useful for setting focus when deactivating or cycling focus in reverse.
2526
+ */
2527
+ focusLastElement() {
2528
+ const focusables = this._getFocusableElements();
2529
+ if (focusables.length) focusables[focusables.length - 1].focus();
2530
+ }
2531
+
2532
+ /**
2533
+ * Removes event listeners and attributes added by the focus trap.
2534
+ * Call this method to clean up when the focus trap is no longer needed.
2535
+ */
2536
+ disconnect() {
2537
+
2538
+ if (this.container.hasAttribute('data-focus-trap-container')) {
2539
+ this.container.removeAttribute('data-focus-trap-container');
2540
+ }
2541
+
2542
+ this.container.removeEventListener('keydown', this._onKeydown);
2543
+ }
2544
+ }
2545
+
2285
2546
  // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
2286
2547
  // See LICENSE in the project root for license information.
2287
2548
 
@@ -2926,11 +3187,11 @@ var dropdownVersion = '3.0.0';
2926
3187
 
2927
3188
  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}`;
2928
3189
 
2929
- 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)}`;
3190
+ 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)}`;
2930
3191
 
2931
3192
  var classicColorCss = i$2``;
2932
3193
 
2933
- 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}`;
3194
+ 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%}`;
2934
3195
 
2935
3196
  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)}`;
2936
3197
 
@@ -2938,7 +3199,7 @@ var styleSnowflakeCss = i$2`:host{display:block}.wrapper{display:flex;flex:1;fle
2938
3199
 
2939
3200
  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)}`;
2940
3201
 
2941
- 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}`;
3202
+ 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}`;
2942
3203
 
2943
3204
  var tokensCss = i$2`:host{--ds-auro-helptext-color: var(--ds-basic-color-texticon-muted, #676767)}`;
2944
3205
 
@@ -3243,10 +3504,8 @@ class AuroElement extends i {
3243
3504
  // See LICENSE in the project root for license information.
3244
3505
 
3245
3506
 
3246
- /**
3247
- * @attr { Boolean } disableEventShow - If declared, the dropdown will only show by calling the API .show() public method.
3507
+ /*
3248
3508
  * @slot - Default slot for the popover content.
3249
- * @slot label - Defines the content of the label.
3250
3509
  * @slot helpText - Defines the content of the helpText.
3251
3510
  * @slot trigger - Defines the content of the trigger.
3252
3511
  * @csspart trigger - The trigger content container.
@@ -3265,18 +3524,22 @@ class AuroDropdown extends AuroElement {
3265
3524
  this.matchWidth = false;
3266
3525
  this.noHideOnThisFocusLoss = false;
3267
3526
 
3268
- this.errorMessage = ''; // TODO - check with Doug if there is still more to do here
3527
+ this.errorMessage = undefined; // TODO - check with Doug if there is still more to do here
3269
3528
 
3270
3529
  // Layout Config
3271
- this.layout = 'classic';
3272
- this.shape = 'classic';
3273
- this.size = 'xl';
3530
+ this.layout = undefined;
3531
+ this.shape = undefined;
3532
+ this.size = undefined;
3274
3533
 
3275
3534
  this.parentBorder = false;
3276
3535
 
3277
3536
  this.privateDefaults();
3278
3537
  }
3279
3538
 
3539
+ /**
3540
+ * @private
3541
+ * @returns {object} Class definition for the wrapper element.
3542
+ */
3280
3543
  get commonWrapperClasses() {
3281
3544
  return {
3282
3545
  'trigger': true,
@@ -3294,13 +3557,10 @@ class AuroDropdown extends AuroElement {
3294
3557
  privateDefaults() {
3295
3558
  this.chevron = false;
3296
3559
  this.disabled = false;
3560
+ this.disableFocusTrap = false;
3297
3561
  this.error = false;
3298
- this.inset = false;
3299
- this.rounded = false;
3300
3562
  this.tabIndex = 0;
3301
3563
  this.noToggle = false;
3302
- this.a11yAutocomplete = 'none';
3303
- this.labeled = true;
3304
3564
  this.a11yRole = 'button';
3305
3565
  this.onDark = false;
3306
3566
  this.showTriggerBorders = true;
@@ -3396,6 +3656,18 @@ class AuroDropdown extends AuroElement {
3396
3656
  this.floater.showBib();
3397
3657
  }
3398
3658
 
3659
+ /**
3660
+ * When bib is open, focus on the first element inside of bib.
3661
+ * If not, trigger element will get focus.
3662
+ */
3663
+ focus() {
3664
+ if (this.isPopoverVisible && this.focusTrap) {
3665
+ this.focusTrap.focusFirstElement();
3666
+ } else {
3667
+ this.trigger.focus();
3668
+ }
3669
+ }
3670
+
3399
3671
  // function to define props used within the scope of this component
3400
3672
  static get properties() {
3401
3673
  return {
@@ -3409,6 +3681,15 @@ class AuroDropdown extends AuroElement {
3409
3681
  reflect: true
3410
3682
  },
3411
3683
 
3684
+ /**
3685
+ * If declared, the dropdown will only show by calling the API .show() public method.
3686
+ * @default false
3687
+ */
3688
+ disableEventShow: {
3689
+ type: Boolean,
3690
+ reflect: true
3691
+ },
3692
+
3412
3693
  /**
3413
3694
  * If declared, applies a border around the trigger slot.
3414
3695
  */
@@ -3427,17 +3708,17 @@ class AuroDropdown extends AuroElement {
3427
3708
  },
3428
3709
 
3429
3710
  /**
3430
- * If declared, the dropdown will be styled with the common theme.
3711
+ * If declared, the dropdown is not interactive.
3431
3712
  */
3432
- common: {
3713
+ disabled: {
3433
3714
  type: Boolean,
3434
3715
  reflect: true
3435
3716
  },
3436
3717
 
3437
3718
  /**
3438
- * If declared, the dropdown is not interactive.
3719
+ * If declared, the focus trap inside of bib will be turned off.
3439
3720
  */
3440
- disabled: {
3721
+ disableFocusTrap: {
3441
3722
  type: Boolean,
3442
3723
  reflect: true
3443
3724
  },
@@ -3482,22 +3763,6 @@ class AuroDropdown extends AuroElement {
3482
3763
  reflect: true
3483
3764
  },
3484
3765
 
3485
- /**
3486
- * Makes the trigger to be full width of its parent container.
3487
- */
3488
- fluid: {
3489
- type: Boolean,
3490
- reflect: true
3491
- },
3492
-
3493
- /**
3494
- * If declared, will apply padding around trigger slot content.
3495
- */
3496
- inset: {
3497
- type: Boolean,
3498
- reflect: true
3499
- },
3500
-
3501
3766
  /**
3502
3767
  * If true, the dropdown bib is displayed.
3503
3768
  */
@@ -3541,15 +3806,6 @@ class AuroDropdown extends AuroElement {
3541
3806
  reflect: true
3542
3807
  },
3543
3808
 
3544
- /**
3545
- * Defines if there is a label preset.
3546
- * @private
3547
- */
3548
- labeled: {
3549
- type: Boolean,
3550
- reflect: true
3551
- },
3552
-
3553
3809
  /**
3554
3810
  * Defines if the trigger should size based on the parent element providing the border UI.
3555
3811
  * @private
@@ -3610,6 +3866,9 @@ class AuroDropdown extends AuroElement {
3610
3866
  reflect: true
3611
3867
  },
3612
3868
 
3869
+ /**
3870
+ * If declared, and a function is set, that function will execute when the slot content is updated.
3871
+ */
3613
3872
  onSlotChange: {
3614
3873
  type: Function,
3615
3874
  reflect: false
@@ -3624,14 +3883,6 @@ class AuroDropdown extends AuroElement {
3624
3883
  reflect: true
3625
3884
  },
3626
3885
 
3627
- /**
3628
- * If declared, will apply border-radius to trigger and default slots.
3629
- */
3630
- rounded: {
3631
- type: Boolean,
3632
- reflect: true
3633
- },
3634
-
3635
3886
  /**
3636
3887
  * @private
3637
3888
  */
@@ -3646,22 +3897,14 @@ class AuroDropdown extends AuroElement {
3646
3897
  type: String || undefined,
3647
3898
  attribute: false,
3648
3899
  reflect: false
3649
- },
3650
-
3651
- /**
3652
- * The value for the aria-autocomplete attribute of the trigger element.
3653
- */
3654
- a11yAutocomplete: {
3655
- type: String,
3656
- attribute: false,
3657
3900
  }
3658
3901
  };
3659
3902
  }
3660
3903
 
3661
3904
  static get styles() {
3662
3905
  return [
3663
- colorCss$1,
3664
3906
  tokensCss$1,
3907
+ colorCss$1,
3665
3908
 
3666
3909
  // default layout
3667
3910
  classicColorCss,
@@ -3724,6 +3967,12 @@ class AuroDropdown extends AuroElement {
3724
3967
  this.handleTriggerContentSlotChange();
3725
3968
  }
3726
3969
 
3970
+ if (changedProperties.has('isPopoverVisible')) {
3971
+ this.updateFocusTrap();
3972
+ if (!this.isPopoverVisible && this.hasFocus) {
3973
+ this.trigger.focus();
3974
+ }
3975
+ }
3727
3976
  }
3728
3977
 
3729
3978
  firstUpdated() {
@@ -3789,6 +4038,27 @@ class AuroDropdown extends AuroElement {
3789
4038
  this.hasFocus = true;
3790
4039
  }
3791
4040
 
4041
+ /**
4042
+ * @private
4043
+ */
4044
+ updateFocusTrap() {
4045
+ // If the dropdown is open, create a focus trap and focus the first element
4046
+ if (this.isPopoverVisible && !this.disableFocusTrap) {
4047
+ this.focusTrap = new FocusTrap(this.bibContent);
4048
+ this.focusTrap.focusFirstElement();
4049
+ return;
4050
+ }
4051
+
4052
+ // Guard Clause: Ensure there is a focus trap currently active before continuing
4053
+ if (!this.focusTrap) {
4054
+ return;
4055
+ }
4056
+
4057
+ // If the dropdown is not open, disconnect the focus trap if it exists
4058
+ this.focusTrap.disconnect();
4059
+ this.focusTrap = undefined;
4060
+ }
4061
+
3792
4062
  /**
3793
4063
  * Function to support @focusout event.
3794
4064
  * @private
@@ -4074,10 +4344,7 @@ class AuroDropdown extends AuroElement {
4074
4344
  id="bib"
4075
4345
  shape="${this.shape}"
4076
4346
  ?data-show="${this.isPopoverVisible}"
4077
- ?isfullscreen="${this.isBibFullscreen}"
4078
- ?common="${this.common}"
4079
- ?rounded="${this.common || this.rounded}"
4080
- ?inset="${this.common || this.inset}">
4347
+ ?isfullscreen="${this.isBibFullscreen}">
4081
4348
  <div class="slotContent">
4082
4349
  <slot @slotchange="${this.handleDefaultSlot}"></slot>
4083
4350
  </div>
@@ -16,17 +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
- </head>
36
+ </head>
30
37
  <body class="auro-markdown">
31
38
  <main></main>
32
39