@aurodesignsystem-dev/auro-drawer 0.0.0-pr131.0 → 0.0.0-pr131.2
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/demo/auro-drawer.min.js
CHANGED
|
@@ -2449,10 +2449,10 @@ class AuroFloatingUI {
|
|
|
2449
2449
|
}
|
|
2450
2450
|
}
|
|
2451
2451
|
|
|
2452
|
-
var colorCss$1 = i$5`:host([onbackdrop]) .backdrop{background:var(--ds-auro-floater-backdrop-modal-background-color)}::slotted(*){background:var(--ds-auro-floater-container-background-color);color:var(--ds-auro-floater-container-text-color)}
|
|
2452
|
+
var colorCss$1 = i$5`:host([onbackdrop]) dialog.container::backdrop{background:var(--ds-auro-floater-backdrop-modal-background-color)}::slotted(*){background:var(--ds-auro-floater-container-background-color);color:var(--ds-auro-floater-container-text-color)}
|
|
2453
2453
|
`;
|
|
2454
2454
|
|
|
2455
|
-
var styleCss$1 = i$5`:host{position:absolute;z-index:var(--ds-depth-overlay, 200);display:none;flex-direction:column;opacity:0;transition:opacity .3s ease-in-out,display .3s;transition-behavior:allow-discrete;will-change:opacity}.container{display:inline-block;width:100%;height:100%}.container ::slotted(:only-child){z-index:var(--ds-depth-modal, 300);box-shadow:var(--ds-elevation-200, 0px 0px 10px rgba(0, 0, 0, .15))}:host([
|
|
2455
|
+
var styleCss$1 = i$5`:host{position:absolute;z-index:var(--ds-depth-overlay, 200);display:none;flex-direction:column;opacity:0;transition:opacity .3s ease-in-out,display .3s;transition-behavior:allow-discrete;will-change:opacity}.util_displayHiddenVisually{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}dialog.container{background-color:transparent;max-width:none;max-height:none;padding:0;border:none;margin:0;outline:none;transform:translateZ(0);display:inline-block;width:100%;height:100%}dialog.container::backdrop{background:transparent}dialog.container ::slotted(:only-child){z-index:var(--ds-depth-modal, 300);box-shadow:var(--ds-elevation-200, 0px 0px 10px rgba(0, 0, 0, .15))}:host([data-show]){display:block;opacity:1}@starting-style{:host([data-show]){opacity:0}}:host([data-show][modal]){pointer-events:initial}:host([isfullscreen]){width:100%;height:100%}:host([isfullscreen]) dialog.container{overflow:auto;width:100%;height:100%}
|
|
2456
2456
|
`;
|
|
2457
2457
|
|
|
2458
2458
|
var tokensCss$1 = i$5`:host{--ds-auro-floater-backdrop-modal-background-color: var(--ds-advanced-color-shared-scrim, rgba(0, 0, 0, .5));--ds-auro-floater-container-background-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-floater-container-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}
|
|
@@ -2469,6 +2469,23 @@ class AuroFloaterBib extends i$2 {
|
|
|
2469
2469
|
* @private
|
|
2470
2470
|
*/
|
|
2471
2471
|
this._mobileBreakpointValue = undefined;
|
|
2472
|
+
|
|
2473
|
+
/**
|
|
2474
|
+
* @private
|
|
2475
|
+
* Bound reference to the touchmove handler so it can be removed later.
|
|
2476
|
+
*/
|
|
2477
|
+
this._boundTouchMoveHandler = undefined;
|
|
2478
|
+
}
|
|
2479
|
+
|
|
2480
|
+
static get properties() {
|
|
2481
|
+
return {
|
|
2482
|
+
/**
|
|
2483
|
+
* Text used to label the dialog for screen readers via aria-labelledby.
|
|
2484
|
+
*/
|
|
2485
|
+
bibLabel: {
|
|
2486
|
+
type: String,
|
|
2487
|
+
},
|
|
2488
|
+
};
|
|
2472
2489
|
}
|
|
2473
2490
|
|
|
2474
2491
|
static get styles() {
|
|
@@ -2481,15 +2498,141 @@ class AuroFloaterBib extends i$2 {
|
|
|
2481
2498
|
"auro-floater-bib",
|
|
2482
2499
|
);
|
|
2483
2500
|
|
|
2484
|
-
this.
|
|
2501
|
+
this.dialog = this.shadowRoot.querySelector("dialog");
|
|
2502
|
+
|
|
2503
|
+
// Always prevent native dialog close on Escape; re-dispatch as a composed
|
|
2504
|
+
// event so AuroDrawer can decide whether to honour it based on `modal`.
|
|
2505
|
+
this.dialog.addEventListener("cancel", (e) => {
|
|
2506
|
+
e.preventDefault();
|
|
2507
|
+
this.dispatchEvent(
|
|
2508
|
+
new Event("dialog-cancel", { bubbles: true, composed: true }),
|
|
2509
|
+
);
|
|
2510
|
+
});
|
|
2511
|
+
|
|
2512
|
+
// Re-dispatch keydown events that stopped at the dialog boundary so that
|
|
2513
|
+
// slotted consumer keyboard handlers outside the shadow DOM still receive them.
|
|
2514
|
+
this.dialog.addEventListener("keydown", (e) => {
|
|
2515
|
+
if (e.target !== this.dialog) {
|
|
2516
|
+
return;
|
|
2517
|
+
}
|
|
2518
|
+
this.dialog.dispatchEvent(
|
|
2519
|
+
new KeyboardEvent(e.type, { ...e, bubbles: true, composed: true }),
|
|
2520
|
+
);
|
|
2521
|
+
});
|
|
2522
|
+
}
|
|
2523
|
+
|
|
2524
|
+
/**
|
|
2525
|
+
* Opens the dialog.
|
|
2526
|
+
* Uses showModal() for standard/modal drawers (native focus containment, top-layer).
|
|
2527
|
+
* Uses setAttribute('open') for nested drawers to keep positional CSS intact.
|
|
2528
|
+
* @param {{ nested?: boolean }} [options]
|
|
2529
|
+
*/
|
|
2530
|
+
async showDialog({ nested = false } = {}) {
|
|
2531
|
+
// firstUpdated() may not have run yet on initial render — wait for it.
|
|
2532
|
+
if (!this.dialog) {
|
|
2533
|
+
await this.updateComplete;
|
|
2534
|
+
}
|
|
2535
|
+
if (!this.dialog) {
|
|
2536
|
+
return;
|
|
2537
|
+
}
|
|
2538
|
+
|
|
2539
|
+
if (nested) {
|
|
2540
|
+
this.dialog.setAttribute("open", "");
|
|
2541
|
+
} else {
|
|
2542
|
+
// Lock page scroll for the entire duration the dialog is open.
|
|
2543
|
+
// Using position:fixed on <body> is the only reliable way to prevent
|
|
2544
|
+
// ALL scroll vectors — including VoiceOver three-finger swipe, which
|
|
2545
|
+
// bypasses both overflow:hidden and touchmove preventDefault.
|
|
2546
|
+
// We capture the current scrollY so we can restore position on close.
|
|
2547
|
+
this._savedScrollY = window.scrollY;
|
|
2548
|
+
document.body.style.position = 'fixed';
|
|
2549
|
+
document.body.style.top = `-${this._savedScrollY}px`;
|
|
2550
|
+
document.body.style.width = '100%';
|
|
2551
|
+
document.body.style.overflow = 'hidden';
|
|
2552
|
+
document.documentElement.style.overflow = 'hidden';
|
|
2553
|
+
this._scrollLocked = true;
|
|
2554
|
+
|
|
2555
|
+
this.dialog.showModal();
|
|
2556
|
+
|
|
2557
|
+
this._lockTouchScroll();
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2560
|
+
|
|
2561
|
+
/**
|
|
2562
|
+
* Closes the dialog and releases touch-scroll lock.
|
|
2563
|
+
*/
|
|
2564
|
+
hideDialog() {
|
|
2565
|
+
// Restore scroll immediately — don't wait for dialog.close().
|
|
2566
|
+
this._restorePageScroll();
|
|
2567
|
+
this._unlockTouchScroll();
|
|
2568
|
+
|
|
2569
|
+
if (this.dialog?.open) {
|
|
2570
|
+
setTimeout(() => {
|
|
2571
|
+
this.dialog.close();
|
|
2572
|
+
}, 300);
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
/**
|
|
2577
|
+
* Restores page scroll that was locked during showDialog().
|
|
2578
|
+
* Safe to call multiple times — only acts when a lock is active.
|
|
2579
|
+
* @private
|
|
2580
|
+
*/
|
|
2581
|
+
_restorePageScroll() {
|
|
2582
|
+
if (this._scrollLocked) {
|
|
2583
|
+
document.body.style.position = '';
|
|
2584
|
+
document.body.style.top = '';
|
|
2585
|
+
document.body.style.width = '';
|
|
2586
|
+
document.body.style.overflow = '';
|
|
2587
|
+
document.documentElement.style.overflow = '';
|
|
2588
|
+
window.scrollTo(0, this._savedScrollY || 0);
|
|
2589
|
+
this._savedScrollY = undefined;
|
|
2590
|
+
this._scrollLocked = false;
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2593
|
+
|
|
2594
|
+
/**
|
|
2595
|
+
* Locks page-level touch scroll while the drawer is open.
|
|
2596
|
+
* Walks composedPath() so scrollable children inside the dialog still scroll.
|
|
2597
|
+
* @private
|
|
2598
|
+
*/
|
|
2599
|
+
_lockTouchScroll() {
|
|
2600
|
+
if (this._boundTouchMoveHandler) {
|
|
2601
|
+
return;
|
|
2602
|
+
}
|
|
2603
|
+
this._boundTouchMoveHandler = (e) => {
|
|
2604
|
+
const path = e.composedPath();
|
|
2605
|
+
const insideScrollable = path.some(
|
|
2606
|
+
(el) => el !== document && el.scrollHeight > el.clientHeight,
|
|
2607
|
+
);
|
|
2608
|
+
if (!insideScrollable) {
|
|
2609
|
+
e.preventDefault();
|
|
2610
|
+
}
|
|
2611
|
+
};
|
|
2612
|
+
document.addEventListener("touchmove", this._boundTouchMoveHandler, {
|
|
2613
|
+
passive: false,
|
|
2614
|
+
});
|
|
2615
|
+
}
|
|
2616
|
+
|
|
2617
|
+
/**
|
|
2618
|
+
* Removes the touch-scroll lock.
|
|
2619
|
+
* @private
|
|
2620
|
+
*/
|
|
2621
|
+
_unlockTouchScroll() {
|
|
2622
|
+
if (this._boundTouchMoveHandler) {
|
|
2623
|
+
document.removeEventListener("touchmove", this._boundTouchMoveHandler, {
|
|
2624
|
+
passive: false,
|
|
2625
|
+
});
|
|
2626
|
+
this._boundTouchMoveHandler = undefined;
|
|
2627
|
+
}
|
|
2485
2628
|
}
|
|
2486
2629
|
|
|
2487
2630
|
render() {
|
|
2488
2631
|
return u$2`
|
|
2489
|
-
<
|
|
2490
|
-
<
|
|
2632
|
+
<dialog class="container" aria-labelledby="dialogLabel">
|
|
2633
|
+
<span id="dialogLabel" class="util_displayHiddenVisually" aria-hidden="true">${this.bibLabel || ""}</span>
|
|
2491
2634
|
<slot></slot>
|
|
2492
|
-
</
|
|
2635
|
+
</dialog>
|
|
2493
2636
|
`;
|
|
2494
2637
|
}
|
|
2495
2638
|
}
|
|
@@ -2587,8 +2730,10 @@ class AuroFloater extends i$2 {
|
|
|
2587
2730
|
if (changedProperties.has("isPopoverVisible")) {
|
|
2588
2731
|
if (this.isPopoverVisible) {
|
|
2589
2732
|
this.floater.showBib();
|
|
2733
|
+
this.bib?.showDialog({ nested: this.nested });
|
|
2590
2734
|
} else {
|
|
2591
2735
|
this.floater.hideBib();
|
|
2736
|
+
this.bib?.hideDialog();
|
|
2592
2737
|
}
|
|
2593
2738
|
}
|
|
2594
2739
|
}
|
|
@@ -2704,85 +2849,209 @@ class p{registerComponent(t,a){customElements.get(t)||customElements.define(t,cl
|
|
|
2704
2849
|
</div>
|
|
2705
2850
|
`}}
|
|
2706
2851
|
|
|
2707
|
-
//
|
|
2852
|
+
// Selectors for focusable elements
|
|
2708
2853
|
const FOCUSABLE_SELECTORS = [
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2854
|
+
'a[href]',
|
|
2855
|
+
'button:not([disabled])',
|
|
2856
|
+
'textarea:not([disabled])',
|
|
2857
|
+
'input:not([disabled])',
|
|
2858
|
+
'select:not([disabled])',
|
|
2714
2859
|
'[role="tab"]:not([disabled])',
|
|
2715
2860
|
'[role="link"]:not([disabled])',
|
|
2716
2861
|
'[role="button"]:not([disabled])',
|
|
2717
2862
|
'[tabindex]:not([tabindex="-1"])',
|
|
2718
|
-
'[contenteditable]:not([contenteditable="false"])'
|
|
2863
|
+
'[contenteditable]:not([contenteditable="false"])'
|
|
2719
2864
|
];
|
|
2720
2865
|
|
|
2866
|
+
// List of custom components that are known to be focusable
|
|
2721
2867
|
const FOCUSABLE_COMPONENTS = [
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2868
|
+
'auro-checkbox',
|
|
2869
|
+
'auro-radio',
|
|
2870
|
+
'auro-dropdown',
|
|
2871
|
+
'auro-button',
|
|
2872
|
+
'auro-combobox',
|
|
2873
|
+
'auro-input',
|
|
2874
|
+
'auro-counter',
|
|
2875
|
+
'auro-menu',
|
|
2876
|
+
'auro-select',
|
|
2877
|
+
'auro-datepicker',
|
|
2878
|
+
'auro-hyperlink',
|
|
2879
|
+
'auro-accordion',
|
|
2734
2880
|
];
|
|
2735
2881
|
|
|
2882
|
+
/**
|
|
2883
|
+
* Determines if a given element is a custom focusable component.
|
|
2884
|
+
* Returns true if the element matches a known focusable component and is not disabled.
|
|
2885
|
+
*
|
|
2886
|
+
* @param {HTMLElement} element The element to check for focusability.
|
|
2887
|
+
* @returns {boolean} True if the element is a focusable custom component, false otherwise.
|
|
2888
|
+
*/
|
|
2889
|
+
function isFocusableComponent(element) {
|
|
2890
|
+
const componentName = element.tagName.toLowerCase();
|
|
2891
|
+
|
|
2892
|
+
// Guard Clause: Element is a focusable component
|
|
2893
|
+
if (!FOCUSABLE_COMPONENTS.some((name) => element.hasAttribute(name) || componentName === name)) return false;
|
|
2894
|
+
|
|
2895
|
+
// Guard Clause: Element is not disabled
|
|
2896
|
+
if (element.hasAttribute('disabled')) return false;
|
|
2897
|
+
|
|
2898
|
+
// Guard Clause: The element is a hyperlink and has no href attribute
|
|
2899
|
+
if (componentName.match("hyperlink") && !element.hasAttribute('href')) return false;
|
|
2900
|
+
|
|
2901
|
+
// If all guard clauses pass, the element is a focusable component
|
|
2902
|
+
return true;
|
|
2903
|
+
}
|
|
2904
|
+
|
|
2905
|
+
/**
|
|
2906
|
+
* Retrieves all focusable elements within the container in DOM order, including those in shadow DOM and slots.
|
|
2907
|
+
* Returns a unique, ordered array of elements that can receive focus.
|
|
2908
|
+
*
|
|
2909
|
+
* @param {HTMLElement} container The container to search within
|
|
2910
|
+
* @returns {Array<HTMLElement>} An array of focusable elements within the container.
|
|
2911
|
+
*/
|
|
2912
|
+
function getFocusableElements(container) {
|
|
2913
|
+
// Get elements in DOM order by walking the tree
|
|
2914
|
+
const orderedFocusableElements = [];
|
|
2915
|
+
|
|
2916
|
+
// Define a recursive function to collect focusable elements in DOM order
|
|
2917
|
+
const collectFocusableElements = (root) => {
|
|
2918
|
+
// Check if current element is focusable
|
|
2919
|
+
if (root.nodeType === Node.ELEMENT_NODE) {
|
|
2920
|
+
// Check if this is a custom component that is focusable
|
|
2921
|
+
const isComponentFocusable = isFocusableComponent(root);
|
|
2922
|
+
|
|
2923
|
+
if (isComponentFocusable) {
|
|
2924
|
+
// Add the component itself as a focusable element and don't traverse its shadow DOM
|
|
2925
|
+
orderedFocusableElements.push(root);
|
|
2926
|
+
return; // Skip traversing inside this component
|
|
2927
|
+
}
|
|
2928
|
+
|
|
2929
|
+
// Check if the element itself matches any selector
|
|
2930
|
+
for (const selector of FOCUSABLE_SELECTORS) {
|
|
2931
|
+
if (root.matches?.(selector)) {
|
|
2932
|
+
orderedFocusableElements.push(root);
|
|
2933
|
+
break; // Once we know it's focusable, no need to check other selectors
|
|
2934
|
+
}
|
|
2935
|
+
}
|
|
2936
|
+
|
|
2937
|
+
// Process shadow DOM only for non-Auro components
|
|
2938
|
+
if (root.shadowRoot) {
|
|
2939
|
+
// Process shadow DOM children in order
|
|
2940
|
+
if (root.shadowRoot.children) {
|
|
2941
|
+
Array.from(root.shadowRoot.children).forEach(child => {
|
|
2942
|
+
collectFocusableElements(child);
|
|
2943
|
+
});
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
2946
|
+
|
|
2947
|
+
// Process slots and their assigned nodes in order
|
|
2948
|
+
if (root.tagName === 'SLOT') {
|
|
2949
|
+
const assignedNodes = root.assignedNodes({ flatten: true });
|
|
2950
|
+
for (const node of assignedNodes) {
|
|
2951
|
+
collectFocusableElements(node);
|
|
2952
|
+
}
|
|
2953
|
+
} else {
|
|
2954
|
+
// Process light DOM children in order
|
|
2955
|
+
if (root.children) {
|
|
2956
|
+
Array.from(root.children).forEach(child => {
|
|
2957
|
+
collectFocusableElements(child);
|
|
2958
|
+
});
|
|
2959
|
+
}
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2962
|
+
};
|
|
2963
|
+
|
|
2964
|
+
// Start the traversal from the container
|
|
2965
|
+
collectFocusableElements(container);
|
|
2966
|
+
|
|
2967
|
+
// Remove duplicates that might have been collected through different paths
|
|
2968
|
+
// while preserving order
|
|
2969
|
+
const uniqueElements = [];
|
|
2970
|
+
const seen = new Set();
|
|
2971
|
+
|
|
2972
|
+
for (const element of orderedFocusableElements) {
|
|
2973
|
+
if (!seen.has(element)) {
|
|
2974
|
+
seen.add(element);
|
|
2975
|
+
uniqueElements.push(element);
|
|
2976
|
+
}
|
|
2977
|
+
}
|
|
2978
|
+
|
|
2979
|
+
return uniqueElements;
|
|
2980
|
+
}
|
|
2981
|
+
|
|
2982
|
+
/**
|
|
2983
|
+
* FocusTrap manages keyboard focus within a specified container element, ensuring that focus does not leave the container when tabbing.
|
|
2984
|
+
* It is commonly used for modal dialogs or overlays to improve accessibility by trapping focus within interactive UI components.
|
|
2985
|
+
*/
|
|
2736
2986
|
class FocusTrap {
|
|
2987
|
+
/**
|
|
2988
|
+
* Creates a new FocusTrap instance for the given container element.
|
|
2989
|
+
* Initializes event listeners and prepares the container for focus management.
|
|
2990
|
+
*
|
|
2991
|
+
* @param {HTMLElement} container The DOM element to trap focus within.
|
|
2992
|
+
* @throws {Error} If the provided container is not a valid HTMLElement.
|
|
2993
|
+
*/
|
|
2737
2994
|
constructor(container) {
|
|
2738
2995
|
if (!container || !(container instanceof HTMLElement)) {
|
|
2739
2996
|
throw new Error("FocusTrap requires a valid HTMLElement.");
|
|
2740
2997
|
}
|
|
2741
2998
|
|
|
2742
2999
|
this.container = container;
|
|
2743
|
-
this.tabDirection =
|
|
3000
|
+
this.tabDirection = 'forward'; // or 'backward'
|
|
2744
3001
|
|
|
2745
3002
|
this._init();
|
|
2746
3003
|
}
|
|
2747
3004
|
|
|
3005
|
+
/**
|
|
3006
|
+
* Initializes the focus trap by setting up event listeners and attributes on the container.
|
|
3007
|
+
* Prepares the container for focus management, including support for shadow DOM and inert attributes.
|
|
3008
|
+
*
|
|
3009
|
+
* @private
|
|
3010
|
+
*/
|
|
2748
3011
|
_init() {
|
|
2749
|
-
// Support for shadow DOM / web components
|
|
2750
|
-
this.container.shadowRoot || this.container;
|
|
2751
3012
|
|
|
2752
3013
|
// Add inert attribute to prevent focusing programmatically as well (if supported)
|
|
2753
|
-
if (
|
|
3014
|
+
if ('inert' in HTMLElement.prototype) {
|
|
2754
3015
|
this.container.inert = false; // Ensure the container isn't inert
|
|
2755
|
-
this.container.setAttribute(
|
|
3016
|
+
this.container.setAttribute('data-focus-trap-container', true); // Mark for identification
|
|
2756
3017
|
}
|
|
2757
3018
|
|
|
2758
3019
|
// Track tab direction
|
|
2759
|
-
this.container.addEventListener(
|
|
3020
|
+
this.container.addEventListener('keydown', this._onKeydown);
|
|
2760
3021
|
}
|
|
2761
3022
|
|
|
3023
|
+
/**
|
|
3024
|
+
* Handles keydown events to manage tab navigation within the container.
|
|
3025
|
+
* Ensures that focus wraps around when reaching the first or last focusable element.
|
|
3026
|
+
*
|
|
3027
|
+
* @param {KeyboardEvent} e The keyboard event triggered by user interaction.
|
|
3028
|
+
* @private
|
|
3029
|
+
*/
|
|
2762
3030
|
_onKeydown = (e) => {
|
|
2763
|
-
|
|
3031
|
+
|
|
3032
|
+
if (e.key === 'Tab') {
|
|
3033
|
+
|
|
2764
3034
|
// Set the tab direction based on the key pressed
|
|
2765
|
-
this.tabDirection = e.shiftKey ?
|
|
3035
|
+
this.tabDirection = e.shiftKey ? 'backward' : 'forward';
|
|
2766
3036
|
|
|
2767
3037
|
// Get the active element(s) in the document and shadow root
|
|
2768
3038
|
// This will include the active element in the shadow DOM if it exists
|
|
2769
3039
|
// Active element may be inside the shadow DOM depending on delegatesFocus, so we need to check both
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
3040
|
+
let activeElement = document.activeElement;
|
|
3041
|
+
const actives = [activeElement];
|
|
3042
|
+
while (activeElement?.shadowRoot?.activeElement) {
|
|
3043
|
+
actives.push(activeElement.shadowRoot.activeElement);
|
|
3044
|
+
activeElement = activeElement.shadowRoot.activeElement;
|
|
3045
|
+
}
|
|
2776
3046
|
|
|
2777
3047
|
// Update the focusable elements
|
|
2778
3048
|
const focusables = this._getFocusableElements();
|
|
2779
3049
|
|
|
2780
3050
|
// If we're at either end of the focusable elements, wrap around to the other end
|
|
2781
3051
|
const focusIndex =
|
|
2782
|
-
actives.includes(focusables[0]) && this.tabDirection ===
|
|
3052
|
+
(actives.includes(focusables[0]) || actives.includes(this.container)) && this.tabDirection === 'backward'
|
|
2783
3053
|
? focusables.length - 1
|
|
2784
|
-
: actives.includes(focusables[focusables.length - 1]) &&
|
|
2785
|
-
this.tabDirection === "forward"
|
|
3054
|
+
: actives.includes(focusables[focusables.length - 1]) && this.tabDirection === 'forward'
|
|
2786
3055
|
? 0
|
|
2787
3056
|
: null;
|
|
2788
3057
|
|
|
@@ -2794,100 +3063,50 @@ class FocusTrap {
|
|
|
2794
3063
|
}
|
|
2795
3064
|
};
|
|
2796
3065
|
|
|
3066
|
+
/**
|
|
3067
|
+
* Retrieves all focusable elements within the container in DOM order, including those in shadow DOM and slots.
|
|
3068
|
+
* Returns a unique, ordered array of elements that can receive focus.
|
|
3069
|
+
*
|
|
3070
|
+
* @returns {Array<HTMLElement>} An array of focusable elements within the container.
|
|
3071
|
+
* @private
|
|
3072
|
+
*/
|
|
2797
3073
|
_getFocusableElements() {
|
|
2798
|
-
//
|
|
2799
|
-
const
|
|
2800
|
-
|
|
2801
|
-
//
|
|
2802
|
-
|
|
2803
|
-
// Check if current element is focusable
|
|
2804
|
-
if (root.nodeType === Node.ELEMENT_NODE) {
|
|
2805
|
-
// Check if this is one of our special Auro components
|
|
2806
|
-
const isAuroComponent = FOCUSABLE_COMPONENTS.some((component) =>
|
|
2807
|
-
root.tagName.toLowerCase()?.match(component),
|
|
2808
|
-
);
|
|
2809
|
-
|
|
2810
|
-
if (isAuroComponent) {
|
|
2811
|
-
// Add the component itself as a focusable element and don't traverse its shadow DOM
|
|
2812
|
-
orderedFocusableElements.push(root);
|
|
2813
|
-
return; // Skip traversing inside this component
|
|
2814
|
-
}
|
|
2815
|
-
|
|
2816
|
-
// Check if the element itself matches any selector
|
|
2817
|
-
for (const selector of FOCUSABLE_SELECTORS) {
|
|
2818
|
-
if (
|
|
2819
|
-
root.matches?.(selector) &&
|
|
2820
|
-
!root.classList.contains("focus-bookend")
|
|
2821
|
-
) {
|
|
2822
|
-
orderedFocusableElements.push(root);
|
|
2823
|
-
break; // Once we know it's focusable, no need to check other selectors
|
|
2824
|
-
}
|
|
2825
|
-
}
|
|
2826
|
-
|
|
2827
|
-
// Process shadow DOM only for non-Auro components
|
|
2828
|
-
if (root.shadowRoot) {
|
|
2829
|
-
// Process shadow DOM children in order
|
|
2830
|
-
if (root.shadowRoot.children) {
|
|
2831
|
-
Array.from(root.shadowRoot.children).forEach((child) => {
|
|
2832
|
-
collectFocusableElements(child);
|
|
2833
|
-
});
|
|
2834
|
-
}
|
|
2835
|
-
}
|
|
2836
|
-
|
|
2837
|
-
// Process slots and their assigned nodes in order
|
|
2838
|
-
if (root.tagName === "SLOT") {
|
|
2839
|
-
const assignedNodes = root.assignedNodes({ flatten: true });
|
|
2840
|
-
for (const node of assignedNodes) {
|
|
2841
|
-
collectFocusableElements(node);
|
|
2842
|
-
}
|
|
2843
|
-
} else {
|
|
2844
|
-
// Process light DOM children in order
|
|
2845
|
-
if (root.children) {
|
|
2846
|
-
Array.from(root.children).forEach((child) => {
|
|
2847
|
-
collectFocusableElements(child);
|
|
2848
|
-
});
|
|
2849
|
-
}
|
|
2850
|
-
}
|
|
2851
|
-
}
|
|
2852
|
-
};
|
|
2853
|
-
|
|
2854
|
-
// Start the traversal from the container
|
|
2855
|
-
collectFocusableElements(this.container);
|
|
2856
|
-
|
|
2857
|
-
// Remove duplicates that might have been collected through different paths
|
|
2858
|
-
// while preserving order
|
|
2859
|
-
const uniqueElements = [];
|
|
2860
|
-
const seen = new Set();
|
|
2861
|
-
|
|
2862
|
-
for (const element of orderedFocusableElements) {
|
|
2863
|
-
if (!seen.has(element)) {
|
|
2864
|
-
seen.add(element);
|
|
2865
|
-
uniqueElements.push(element);
|
|
2866
|
-
}
|
|
2867
|
-
}
|
|
2868
|
-
|
|
2869
|
-
return uniqueElements;
|
|
3074
|
+
// Use the imported utility function to get focusable elements
|
|
3075
|
+
const elements = getFocusableElements(this.container);
|
|
3076
|
+
|
|
3077
|
+
// Filter out any elements with the 'focus-bookend' class
|
|
3078
|
+
return elements;
|
|
2870
3079
|
}
|
|
2871
3080
|
|
|
3081
|
+
/**
|
|
3082
|
+
* Moves focus to the first focusable element within the container.
|
|
3083
|
+
* Useful for setting initial focus when activating the focus trap.
|
|
3084
|
+
*/
|
|
2872
3085
|
focusFirstElement() {
|
|
2873
3086
|
const focusables = this._getFocusableElements();
|
|
2874
3087
|
if (focusables.length) focusables[0].focus();
|
|
2875
3088
|
}
|
|
2876
3089
|
|
|
3090
|
+
/**
|
|
3091
|
+
* Moves focus to the last focusable element within the container.
|
|
3092
|
+
* Useful for setting focus when deactivating or cycling focus in reverse.
|
|
3093
|
+
*/
|
|
2877
3094
|
focusLastElement() {
|
|
2878
3095
|
const focusables = this._getFocusableElements();
|
|
2879
3096
|
if (focusables.length) focusables[focusables.length - 1].focus();
|
|
2880
3097
|
}
|
|
2881
3098
|
|
|
3099
|
+
/**
|
|
3100
|
+
* Removes event listeners and attributes added by the focus trap.
|
|
3101
|
+
* Call this method to clean up when the focus trap is no longer needed.
|
|
3102
|
+
*/
|
|
2882
3103
|
disconnect() {
|
|
2883
|
-
// Remove the tabIndex we set
|
|
2884
|
-
this.container.removeAttribute("tabIndex");
|
|
2885
3104
|
|
|
2886
|
-
if (this.container.hasAttribute(
|
|
2887
|
-
this.container.removeAttribute(
|
|
3105
|
+
if (this.container.hasAttribute('data-focus-trap-container')) {
|
|
3106
|
+
this.container.removeAttribute('data-focus-trap-container');
|
|
2888
3107
|
}
|
|
2889
3108
|
|
|
2890
|
-
this.container.removeEventListener(
|
|
3109
|
+
this.container.removeEventListener('keydown', this._onKeydown);
|
|
2891
3110
|
}
|
|
2892
3111
|
}
|
|
2893
3112
|
|
|
@@ -2898,7 +3117,7 @@ var iconVersion = '9.1.1';
|
|
|
2898
3117
|
var colorCss = i$5`.wrapper{background:var(--ds-auro-drawer-container-color)}::slotted(*){color:var(--ds-auro-drawer-text-color)}
|
|
2899
3118
|
`;
|
|
2900
3119
|
|
|
2901
|
-
var styleCss = i$5`.body-default{font-size:var(--wcss-body-default-font-size, 1rem);line-height:var(--wcss-body-default-line-height, 1.5rem)}.body-default,.body-lg{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0)}.body-lg{font-size:var(--wcss-body-lg-font-size, 1.125rem);line-height:var(--wcss-body-lg-line-height, 1.625rem)}.body-sm{font-size:var(--wcss-body-sm-font-size, .875rem);line-height:var(--wcss-body-sm-line-height, 1.25rem)}.body-sm,.body-xs{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0)}.body-xs{font-size:var(--wcss-body-xs-font-size, .75rem);line-height:var(--wcss-body-xs-line-height, 1rem)}.body-2xs{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-size:var(--wcss-body-2xs-font-size, .625rem);font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0);line-height:var(--wcss-body-2xs-line-height, .875rem)}.display-2xl{font-family:var(--wcss-display-2xl-family, "AS Circular"),var(--wcss-display-2xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-2xl-font-size, clamp(3.5rem, 6vw, 5.375rem));font-weight:var(--wcss-display-2xl-weight, 300);letter-spacing:var(--wcss-display-2xl-letter-spacing, 0);line-height:var(--wcss-display-2xl-line-height, 1.3)}.display-xl{font-family:var(--wcss-display-xl-family, "AS Circular"),var(--wcss-display-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-xl-font-size, clamp(3rem, 5.3333333333vw, 4.5rem));font-weight:var(--wcss-display-xl-weight, 300);letter-spacing:var(--wcss-display-xl-letter-spacing, 0);line-height:var(--wcss-display-xl-line-height, 1.3)}.display-lg{font-family:var(--wcss-display-lg-family, "AS Circular"),var(--wcss-display-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-lg-font-size, clamp(2.75rem, 4.6666666667vw, 4rem));font-weight:var(--wcss-display-lg-weight, 300);letter-spacing:var(--wcss-display-lg-letter-spacing, 0);line-height:var(--wcss-display-lg-line-height, 1.3)}.display-md{font-family:var(--wcss-display-md-family, "AS Circular"),var(--wcss-display-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-md-font-size, clamp(2.5rem, 4vw, 3.5rem));font-weight:var(--wcss-display-md-weight, 300);letter-spacing:var(--wcss-display-md-letter-spacing, 0);line-height:var(--wcss-display-md-line-height, 1.3)}.display-sm{font-family:var(--wcss-display-sm-family, "AS Circular"),var(--wcss-display-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-sm-font-size, clamp(2rem, 3.6666666667vw, 3rem));font-weight:var(--wcss-display-sm-weight, 300);letter-spacing:var(--wcss-display-sm-letter-spacing, 0);line-height:var(--wcss-display-sm-line-height, 1.3)}.display-xs{font-family:var(--wcss-display-xs-family, "AS Circular"),var(--wcss-display-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-xs-font-size, clamp(1.75rem, 3vw, 2.375rem));font-weight:var(--wcss-display-xs-weight, 300);letter-spacing:var(--wcss-display-xs-letter-spacing, 0);line-height:var(--wcss-display-xs-line-height, 1.3)}.heading-xl{font-family:var(--wcss-heading-xl-family, "AS Circular"),var(--wcss-heading-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-xl-font-size, clamp(2rem, 3vw, 2.5rem));font-weight:var(--wcss-heading-xl-weight, 300);letter-spacing:var(--wcss-heading-xl-letter-spacing, 0);line-height:var(--wcss-heading-xl-line-height, 1.3)}.heading-lg{font-family:var(--wcss-heading-lg-family, "AS Circular"),var(--wcss-heading-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-lg-font-size, clamp(1.75rem, 2.6666666667vw, 2.25rem));font-weight:var(--wcss-heading-lg-weight, 300);letter-spacing:var(--wcss-heading-lg-letter-spacing, 0);line-height:var(--wcss-heading-lg-line-height, 1.3)}.heading-md{font-family:var(--wcss-heading-md-family, "AS Circular"),var(--wcss-heading-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-md-font-size, clamp(1.625rem, 2.3333333333vw, 1.75rem));font-weight:var(--wcss-heading-md-weight, 300);letter-spacing:var(--wcss-heading-md-letter-spacing, 0);line-height:var(--wcss-heading-md-line-height, 1.3)}.heading-sm{font-family:var(--wcss-heading-sm-family, "AS Circular"),var(--wcss-heading-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-sm-font-size, clamp(1.375rem, 2vw, 1.5rem));font-weight:var(--wcss-heading-sm-weight, 300);letter-spacing:var(--wcss-heading-sm-letter-spacing, 0);line-height:var(--wcss-heading-sm-line-height, 1.3)}.heading-xs{font-family:var(--wcss-heading-xs-family, "AS Circular"),var(--wcss-heading-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-xs-font-size, clamp(1.25rem, 1.6666666667vw, 1.25rem));font-weight:var(--wcss-heading-xs-weight, 450);letter-spacing:var(--wcss-heading-xs-letter-spacing, 0);line-height:var(--wcss-heading-xs-line-height, 1.3)}.heading-2xs{font-family:var(--wcss-heading-2xs-family, "AS Circular"),var(--wcss-heading-2xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-2xs-font-size, clamp(1.125rem, 1.5vw, 1.125rem));font-weight:var(--wcss-heading-2xs-weight, 450);letter-spacing:var(--wcss-heading-2xs-letter-spacing, 0);line-height:var(--wcss-heading-2xs-line-height, 1.3)}.accent-2xl{font-family:var(--wcss-accent-2xl-family, "Good OT"),var(--wcss-accent-2xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-2xl-font-size, clamp(2rem, 3.1666666667vw, 2.375rem));font-weight:var(--wcss-accent-2xl-weight, 450);letter-spacing:var(--wcss-accent-2xl-letter-spacing, .05em);line-height:var(--wcss-accent-2xl-line-height, 1)}.accent-2xl,.accent-xl{text-transform:uppercase}.accent-xl{font-family:var(--wcss-accent-xl-family, "Good OT"),var(--wcss-accent-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-xl-font-size, clamp(1.625rem, 2.3333333333vw, 2rem));font-weight:var(--wcss-accent-xl-weight, 450);letter-spacing:var(--wcss-accent-xl-letter-spacing, .05em);line-height:var(--wcss-accent-xl-line-height, 1.3)}.accent-lg{font-family:var(--wcss-accent-lg-family, "Good OT"),var(--wcss-accent-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-lg-font-size, clamp(1.5rem, 2.1666666667vw, 1.75rem));font-weight:var(--wcss-accent-lg-weight, 450);letter-spacing:var(--wcss-accent-lg-letter-spacing, .05em);line-height:var(--wcss-accent-lg-line-height, 1.3)}.accent-lg,.accent-md{text-transform:uppercase}.accent-md{font-family:var(--wcss-accent-md-family, "Good OT"),var(--wcss-accent-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-md-font-size, clamp(1.375rem, 1.8333333333vw, 1.5rem));font-weight:var(--wcss-accent-md-weight, 500);letter-spacing:var(--wcss-accent-md-letter-spacing, .05em);line-height:var(--wcss-accent-md-line-height, 1.3)}.accent-sm{font-family:var(--wcss-accent-sm-family, "Good OT"),var(--wcss-accent-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-sm-font-size, clamp(1.125rem, 1.5vw, 1.25rem));font-weight:var(--wcss-accent-sm-weight, 500);letter-spacing:var(--wcss-accent-sm-letter-spacing, .05em);line-height:var(--wcss-accent-sm-line-height, 1.3)}.accent-sm,.accent-xs{text-transform:uppercase}.accent-xs{font-family:var(--wcss-accent-xs-family, "Good OT"),var(--wcss-accent-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-xs-font-size, clamp(1rem, 1.3333333333vw, 1rem));font-weight:var(--wcss-accent-xs-weight, 500);letter-spacing:var(--wcss-accent-xs-letter-spacing, .1em);line-height:var(--wcss-accent-xs-line-height, 1.3)}.accent-2xs{font-family:var(--wcss-accent-2xs-family, "Good OT"),var(--wcss-accent-2xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-2xs-font-size, clamp(.875rem, 1.1666666667vw, .875rem));font-weight:var(--wcss-accent-2xs-weight, 450);letter-spacing:var(--wcss-accent-2xs-letter-spacing, .1em);line-height:var(--wcss-accent-2xs-line-height, 1.3);text-transform:uppercase}:host{display:contents;--insetPaddingXl: var(--ds-size-400, 2rem);--insetPaddingXxl: var(--ds-size-600, 3rem);--insetPaddingXxxl: var(--ds-size-800, 4rem)}:host .wrapper{position:absolute;overflow:auto;width:100%;height:100%;box-sizing:border-box;box-shadow:var(--ds-elevation-200, 0px 0px 10px rgba(0, 0, 0, .15));transition:transform .3s ease-in-out,display .3s;transition-behavior:allow-discrete;will-change:transform}:host .header-row{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--ds-size-200, 1rem)}:host .footer{display:flex;align-items:flex-start;justify-content:flex-end;margin-top:var(--insetPaddingXl)}:host .heading{margin-block-start:0}:host(:not([unformatted])) .wrapper{padding:var(--insetPaddingXl)}@media screen and (min-width: 1024px){:host(:not([unformatted])) .wrapper{padding:var(--insetPaddingXxxl)}}#closeButton{margin-left:auto}#closeButton:hover{cursor:pointer}#closeButton .util_displayHiddenVisually{position:absolute;overflow:hidden;width:1px;height:1px;padding:0;border:0;clip:rect(1px,1px,1px,1px)}:host([placement=right]) .wrapper,:host([placement=left]) .wrapper{max-width:90%}:host([placement=right]),:host([placement=left]){overflow-x:hidden}:host([placement=top]),:host([placement=bottom]){width:100%}:host([placement=top]) .wrapper,:host([placement=bottom]) .wrapper{max-height:90%}:host([placement=right]) .wrapper{right:0;transform:translate3d(100%,0,0)}:host([placement=left]) .wrapper{transform:translate(-100%)}:host([placement=top]) .wrapper{transform:translateY(-100%)}:host([placement=bottom]) .wrapper{bottom:0;transform:translate3d(0,100%,0)}:host([visible]) .wrapper{transform:translateZ(0)}@starting-style{:host([visible][placement=right]) .wrapper{transform:translate(100%)}:host([visible][placement=left]) .wrapper{transform:translate(-100%)}:host([visible][placement=top]) .wrapper{transform:translateY(-100%)}:host([visible][placement=bottom]) .wrapper{transform:translate3d(0,100%,0)}}@media screen and (min-width: 768px){:host([size=sm][placement=left]) .wrapper,:host([size=sm][placement=right]) .wrapper{max-width:40%}}@media screen and (min-width: 1024px){:host([size=sm][placement=left]) .drawer,:host([size=sm][placement=right]) .drawer{max-width:740px}}@media screen and (min-width: 768px){:host([size=md][placement=left]) .wrapper,:host([size=md][placement=right]) .wrapper{max-width:70%}}@media screen and (min-width: 1024px){:host([size=md][placement=left]) .wrapper,:host([size=md][placement=right]) .wrapper{max-width:986px}}:host([size=sm][placement=top]:not([stretch])) .wrapper,:host([size=sm][placement=bottom]:not([stretch])) .wrapper{max-height:30%}:host([size=md][placement=top]:not([stretch])) .wrapper,:host([size=md][placement=bottom]:not([stretch])) .wrapper{max-height:50%}:host([stretch]) .wrapper{max-width:100%;max-height:100%}
|
|
3120
|
+
var styleCss = i$5`.body-default{font-size:var(--wcss-body-default-font-size, 1rem);line-height:var(--wcss-body-default-line-height, 1.5rem)}.body-default,.body-lg{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0)}.body-lg{font-size:var(--wcss-body-lg-font-size, 1.125rem);line-height:var(--wcss-body-lg-line-height, 1.625rem)}.body-sm{font-size:var(--wcss-body-sm-font-size, .875rem);line-height:var(--wcss-body-sm-line-height, 1.25rem)}.body-sm,.body-xs{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0)}.body-xs{font-size:var(--wcss-body-xs-font-size, .75rem);line-height:var(--wcss-body-xs-line-height, 1rem)}.body-2xs{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-size:var(--wcss-body-2xs-font-size, .625rem);font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0);line-height:var(--wcss-body-2xs-line-height, .875rem)}.display-2xl{font-family:var(--wcss-display-2xl-family, "AS Circular"),var(--wcss-display-2xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-2xl-font-size, clamp(3.5rem, 6vw, 5.375rem));font-weight:var(--wcss-display-2xl-weight, 300);letter-spacing:var(--wcss-display-2xl-letter-spacing, 0);line-height:var(--wcss-display-2xl-line-height, 1.3)}.display-xl{font-family:var(--wcss-display-xl-family, "AS Circular"),var(--wcss-display-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-xl-font-size, clamp(3rem, 5.3333333333vw, 4.5rem));font-weight:var(--wcss-display-xl-weight, 300);letter-spacing:var(--wcss-display-xl-letter-spacing, 0);line-height:var(--wcss-display-xl-line-height, 1.3)}.display-lg{font-family:var(--wcss-display-lg-family, "AS Circular"),var(--wcss-display-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-lg-font-size, clamp(2.75rem, 4.6666666667vw, 4rem));font-weight:var(--wcss-display-lg-weight, 300);letter-spacing:var(--wcss-display-lg-letter-spacing, 0);line-height:var(--wcss-display-lg-line-height, 1.3)}.display-md{font-family:var(--wcss-display-md-family, "AS Circular"),var(--wcss-display-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-md-font-size, clamp(2.5rem, 4vw, 3.5rem));font-weight:var(--wcss-display-md-weight, 300);letter-spacing:var(--wcss-display-md-letter-spacing, 0);line-height:var(--wcss-display-md-line-height, 1.3)}.display-sm{font-family:var(--wcss-display-sm-family, "AS Circular"),var(--wcss-display-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-sm-font-size, clamp(2rem, 3.6666666667vw, 3rem));font-weight:var(--wcss-display-sm-weight, 300);letter-spacing:var(--wcss-display-sm-letter-spacing, 0);line-height:var(--wcss-display-sm-line-height, 1.3)}.display-xs{font-family:var(--wcss-display-xs-family, "AS Circular"),var(--wcss-display-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-xs-font-size, clamp(1.75rem, 3vw, 2.375rem));font-weight:var(--wcss-display-xs-weight, 300);letter-spacing:var(--wcss-display-xs-letter-spacing, 0);line-height:var(--wcss-display-xs-line-height, 1.3)}.heading-xl{font-family:var(--wcss-heading-xl-family, "AS Circular"),var(--wcss-heading-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-xl-font-size, clamp(2rem, 3vw, 2.5rem));font-weight:var(--wcss-heading-xl-weight, 300);letter-spacing:var(--wcss-heading-xl-letter-spacing, 0);line-height:var(--wcss-heading-xl-line-height, 1.3)}.heading-lg{font-family:var(--wcss-heading-lg-family, "AS Circular"),var(--wcss-heading-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-lg-font-size, clamp(1.75rem, 2.6666666667vw, 2.25rem));font-weight:var(--wcss-heading-lg-weight, 300);letter-spacing:var(--wcss-heading-lg-letter-spacing, 0);line-height:var(--wcss-heading-lg-line-height, 1.3)}.heading-md{font-family:var(--wcss-heading-md-family, "AS Circular"),var(--wcss-heading-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-md-font-size, clamp(1.625rem, 2.3333333333vw, 1.75rem));font-weight:var(--wcss-heading-md-weight, 300);letter-spacing:var(--wcss-heading-md-letter-spacing, 0);line-height:var(--wcss-heading-md-line-height, 1.3)}.heading-sm{font-family:var(--wcss-heading-sm-family, "AS Circular"),var(--wcss-heading-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-sm-font-size, clamp(1.375rem, 2vw, 1.5rem));font-weight:var(--wcss-heading-sm-weight, 300);letter-spacing:var(--wcss-heading-sm-letter-spacing, 0);line-height:var(--wcss-heading-sm-line-height, 1.3)}.heading-xs{font-family:var(--wcss-heading-xs-family, "AS Circular"),var(--wcss-heading-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-xs-font-size, clamp(1.25rem, 1.6666666667vw, 1.25rem));font-weight:var(--wcss-heading-xs-weight, 450);letter-spacing:var(--wcss-heading-xs-letter-spacing, 0);line-height:var(--wcss-heading-xs-line-height, 1.3)}.heading-2xs{font-family:var(--wcss-heading-2xs-family, "AS Circular"),var(--wcss-heading-2xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-2xs-font-size, clamp(1.125rem, 1.5vw, 1.125rem));font-weight:var(--wcss-heading-2xs-weight, 450);letter-spacing:var(--wcss-heading-2xs-letter-spacing, 0);line-height:var(--wcss-heading-2xs-line-height, 1.3)}.accent-2xl{font-family:var(--wcss-accent-2xl-family, "Good OT"),var(--wcss-accent-2xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-2xl-font-size, clamp(2rem, 3.1666666667vw, 2.375rem));font-weight:var(--wcss-accent-2xl-weight, 450);letter-spacing:var(--wcss-accent-2xl-letter-spacing, .05em);line-height:var(--wcss-accent-2xl-line-height, 1)}.accent-2xl,.accent-xl{text-transform:uppercase}.accent-xl{font-family:var(--wcss-accent-xl-family, "Good OT"),var(--wcss-accent-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-xl-font-size, clamp(1.625rem, 2.3333333333vw, 2rem));font-weight:var(--wcss-accent-xl-weight, 450);letter-spacing:var(--wcss-accent-xl-letter-spacing, .05em);line-height:var(--wcss-accent-xl-line-height, 1.3)}.accent-lg{font-family:var(--wcss-accent-lg-family, "Good OT"),var(--wcss-accent-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-lg-font-size, clamp(1.5rem, 2.1666666667vw, 1.75rem));font-weight:var(--wcss-accent-lg-weight, 450);letter-spacing:var(--wcss-accent-lg-letter-spacing, .05em);line-height:var(--wcss-accent-lg-line-height, 1.3)}.accent-lg,.accent-md{text-transform:uppercase}.accent-md{font-family:var(--wcss-accent-md-family, "Good OT"),var(--wcss-accent-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-md-font-size, clamp(1.375rem, 1.8333333333vw, 1.5rem));font-weight:var(--wcss-accent-md-weight, 500);letter-spacing:var(--wcss-accent-md-letter-spacing, .05em);line-height:var(--wcss-accent-md-line-height, 1.3)}.accent-sm{font-family:var(--wcss-accent-sm-family, "Good OT"),var(--wcss-accent-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-sm-font-size, clamp(1.125rem, 1.5vw, 1.25rem));font-weight:var(--wcss-accent-sm-weight, 500);letter-spacing:var(--wcss-accent-sm-letter-spacing, .05em);line-height:var(--wcss-accent-sm-line-height, 1.3)}.accent-sm,.accent-xs{text-transform:uppercase}.accent-xs{font-family:var(--wcss-accent-xs-family, "Good OT"),var(--wcss-accent-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-xs-font-size, clamp(1rem, 1.3333333333vw, 1rem));font-weight:var(--wcss-accent-xs-weight, 500);letter-spacing:var(--wcss-accent-xs-letter-spacing, .1em);line-height:var(--wcss-accent-xs-line-height, 1.3)}.accent-2xs{font-family:var(--wcss-accent-2xs-family, "Good OT"),var(--wcss-accent-2xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-2xs-font-size, clamp(.875rem, 1.1666666667vw, .875rem));font-weight:var(--wcss-accent-2xs-weight, 450);letter-spacing:var(--wcss-accent-2xs-letter-spacing, .1em);line-height:var(--wcss-accent-2xs-line-height, 1.3);text-transform:uppercase}:host{display:contents;--insetPaddingXl: var(--ds-size-400, 2rem);--insetPaddingXxl: var(--ds-size-600, 3rem);--insetPaddingXxxl: var(--ds-size-800, 4rem)}:host .wrapper{position:absolute;overflow:auto;width:100%;height:100%;box-sizing:border-box;transition:transform;box-shadow:var(--ds-elevation-200, 0px 0px 10px rgba(0, 0, 0, .15));will-change:transform}:host .header-row{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--ds-size-200, 1rem)}:host .footer{display:flex;align-items:flex-start;justify-content:flex-end;margin-top:var(--insetPaddingXl)}:host .heading{margin-block-start:0}:host(:not([unformatted])) .wrapper{padding:var(--insetPaddingXl)}@media screen and (min-width: 1024px){:host(:not([unformatted])) .wrapper{padding:var(--insetPaddingXxxl)}}#closeButton{margin-left:auto}#closeButton:hover{cursor:pointer}#closeButton .util_displayHiddenVisually{position:absolute;overflow:hidden;width:1px;height:1px;padding:0;border:0;clip:rect(1px,1px,1px,1px)}:host([placement=right]) .wrapper,:host([placement=left]) .wrapper{max-width:90%}:host([placement=right]),:host([placement=left]){overflow-x:hidden}:host([placement=top]),:host([placement=bottom]){width:100%}:host([placement=top]) .wrapper,:host([placement=bottom]) .wrapper{max-height:90%}:host([placement=right]) .wrapper{right:100%}:host([visible][placement=right]) .wrapper{animation:slideInFromRight .3s forwards;animation-delay:.05s}:host([closing][placement=right]) .wrapper{animation:slideOutToRight .3s forwards}@keyframes slideInFromRight{0%{transform:translate(100%);right:0}to{transform:translateZ(0);right:0}}@keyframes slideOutToRight{0%{transform:translateZ(0);right:0}to{transform:translate(100%);right:0}}:host([placement=left]) .wrapper{left:-100%}:host([visible][placement=left]) .wrapper{animation:slideInFromLeft .3s forwards;animation-delay:.05s}:host([closing][placement=left]) .wrapper{animation:slideOutToLeft .3s forwards}@keyframes slideInFromLeft{0%{transform:translate(-100%);left:0}to{transform:translateZ(0);left:0}}@keyframes slideOutToLeft{0%{transform:translateZ(0);left:0}to{transform:translate(-100%);left:0}}:host([placement=top]) .wrapper{top:-100%}:host([visible][placement=top]) .wrapper{animation:slideInFromTop .3s forwards;animation-delay:.05s}:host([closing][placement=top]) .wrapper{animation:slideOutToTop .3s forwards}@keyframes slideInFromTop{0%{transform:translateY(-100%);top:0}to{transform:translateZ(0);top:0}}@keyframes slideOutToTop{0%{transform:translateZ(0);top:0}to{transform:translateY(-100%);top:0}}:host([placement=bottom]) .wrapper{bottom:100%}:host([visible][placement=bottom]) .wrapper{animation:slideInFromBottom .3s forwards;animation-delay:.05s}:host([closing][placement=bottom]) .wrapper{animation:slideOutToBottom .3s forwards}@keyframes slideInFromBottom{0%{transform:translateY(100%);bottom:0}to{transform:translateZ(0);bottom:0}}@keyframes slideOutToBottom{0%{transform:translateZ(0);bottom:0}to{transform:translateY(100%);bottom:0}}@media screen and (min-width: 768px){:host([size=sm][placement=left]) .wrapper,:host([size=sm][placement=right]) .wrapper{max-width:40%}}@media screen and (min-width: 1024px){:host([size=sm][placement=left]) .drawer,:host([size=sm][placement=right]) .drawer{max-width:740px}}@media screen and (min-width: 768px){:host([size=md][placement=left]) .wrapper,:host([size=md][placement=right]) .wrapper{max-width:70%}}@media screen and (min-width: 1024px){:host([size=md][placement=left]) .wrapper,:host([size=md][placement=right]) .wrapper{max-width:986px}}:host([size=sm][placement=top]:not([stretch])) .wrapper,:host([size=sm][placement=bottom]:not([stretch])) .wrapper{max-height:30%}:host([size=md][placement=top]:not([stretch])) .wrapper,:host([size=md][placement=bottom]:not([stretch])) .wrapper{max-height:50%}:host([stretch]) .wrapper{max-width:100%;max-height:100%}
|
|
2902
3121
|
`;
|
|
2903
3122
|
|
|
2904
3123
|
var tokensCss = i$5`:host{--ds-auro-drawer-container-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-drawer-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}
|
|
@@ -2973,6 +3192,11 @@ class AuroDrawerContent extends i$2 {
|
|
|
2973
3192
|
visible: {
|
|
2974
3193
|
type: Boolean,
|
|
2975
3194
|
reflect: true
|
|
3195
|
+
},
|
|
3196
|
+
|
|
3197
|
+
closing: {
|
|
3198
|
+
type: Boolean,
|
|
3199
|
+
reflect: true
|
|
2976
3200
|
}
|
|
2977
3201
|
};
|
|
2978
3202
|
}
|
|
@@ -2985,27 +3209,33 @@ class AuroDrawerContent extends i$2 {
|
|
|
2985
3209
|
this.dispatchEvent(new CustomEvent("close-click"));
|
|
2986
3210
|
}
|
|
2987
3211
|
|
|
2988
|
-
handleWrapperTransitionEnd() {
|
|
2989
|
-
if (!this.visible) return;
|
|
2990
|
-
if (!this.focusTrap) return;
|
|
2991
|
-
this.focusTrap.focusFirstElement();
|
|
2992
|
-
}
|
|
2993
|
-
|
|
2994
3212
|
updated(changedProperties) {
|
|
2995
3213
|
if (changedProperties.has("visible")) {
|
|
2996
3214
|
if (this.visible) {
|
|
3215
|
+
// Reset CSS animation so it replays each time the drawer opens
|
|
3216
|
+
const wrapper = this.shadowRoot.querySelector('.wrapper');
|
|
3217
|
+
if (wrapper) {
|
|
3218
|
+
wrapper.style.animation = 'none';
|
|
3219
|
+
// Force reflow to restart the animation
|
|
3220
|
+
void wrapper.offsetHeight; // eslint-disable-line no-void
|
|
3221
|
+
wrapper.style.animation = '';
|
|
3222
|
+
}
|
|
3223
|
+
|
|
2997
3224
|
if (!this.focusTrap) {
|
|
2998
3225
|
this.focusTrap = new FocusTrap(this);
|
|
2999
3226
|
}
|
|
3000
|
-
this.prevActiveElement = document.activeElement;
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3227
|
+
this.prevActiveElement = this.triggerElement || document.activeElement;
|
|
3228
|
+
// Move focus to the first focusable element inside the drawer.
|
|
3229
|
+
// rAF lets showModal()'s native focus assignment settle before we override.
|
|
3230
|
+
requestAnimationFrame(() => {
|
|
3231
|
+
this.focusTrap?.focusFirstElement();
|
|
3232
|
+
});
|
|
3004
3233
|
} else {
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3234
|
+
// Native dialog.close() fires after a 300ms delay (see auro-floater-bib hideDialog).
|
|
3235
|
+
// Defer focus restoration so it runs after the dialog releases focus.
|
|
3236
|
+
const target = this.prevActiveElement;
|
|
3237
|
+
this.prevActiveElement = undefined;
|
|
3238
|
+
setTimeout(() => target?.focus(), 350);
|
|
3009
3239
|
|
|
3010
3240
|
if (this.focusTrap) {
|
|
3011
3241
|
this.focusTrap.disconnect();
|
|
@@ -3013,10 +3243,13 @@ class AuroDrawerContent extends i$2 {
|
|
|
3013
3243
|
}
|
|
3014
3244
|
}
|
|
3015
3245
|
}
|
|
3016
|
-
}
|
|
3017
3246
|
|
|
3018
|
-
|
|
3019
|
-
|
|
3247
|
+
if (changedProperties.has("closing") && this.closing) {
|
|
3248
|
+
// Reset closing state after animation completes
|
|
3249
|
+
setTimeout(() => {
|
|
3250
|
+
this.closing = false;
|
|
3251
|
+
}, 300);
|
|
3252
|
+
}
|
|
3020
3253
|
}
|
|
3021
3254
|
|
|
3022
3255
|
render() {
|
|
@@ -3024,7 +3257,7 @@ class AuroDrawerContent extends i$2 {
|
|
|
3024
3257
|
<!-- Hidden slot for close button aria-label -->
|
|
3025
3258
|
<slot name="ariaLabel.drawer.close" hidden @slotchange=${this.requestUpdate}></slot>
|
|
3026
3259
|
|
|
3027
|
-
<div class="wrapper" tabindex="-1" part="drawer-wrapper"
|
|
3260
|
+
<div class="wrapper" tabindex="-1" part="drawer-wrapper">
|
|
3028
3261
|
${
|
|
3029
3262
|
this.unformatted
|
|
3030
3263
|
? ""
|
|
@@ -3289,13 +3522,24 @@ class AuroDrawer extends AuroFloater {
|
|
|
3289
3522
|
);
|
|
3290
3523
|
|
|
3291
3524
|
this.drawerBib = document.createElement("auro-drawer-content");
|
|
3292
|
-
this.drawerBib.
|
|
3293
|
-
|
|
3294
|
-
|
|
3525
|
+
this.drawerBib.triggerElement = this.triggerElement;
|
|
3526
|
+
this.drawerBib.addEventListener("close-click", () => {
|
|
3527
|
+
this.bib?.hideDialog();
|
|
3528
|
+
this.floater.hideBib();
|
|
3529
|
+
});
|
|
3295
3530
|
this.append(this.drawerBib);
|
|
3296
3531
|
|
|
3297
3532
|
this.bib.setAttribute("exportparts", "backdrop:drawer-backdrop");
|
|
3298
3533
|
|
|
3534
|
+
// Handle Escape key via native dialog cancel event.
|
|
3535
|
+
// Always preventDefault in the bib; here we decide whether to actually close.
|
|
3536
|
+
this.bib.addEventListener("dialog-cancel", () => {
|
|
3537
|
+
if (this.modal) {
|
|
3538
|
+
return; // Modal drawers ignore Escape.
|
|
3539
|
+
}
|
|
3540
|
+
this.floater.hideBib();
|
|
3541
|
+
});
|
|
3542
|
+
|
|
3299
3543
|
this.setupAria();
|
|
3300
3544
|
}
|
|
3301
3545
|
|
|
@@ -3310,12 +3554,12 @@ class AuroDrawer extends AuroFloater {
|
|
|
3310
3554
|
this.bib.getAttribute("id"),
|
|
3311
3555
|
);
|
|
3312
3556
|
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
if (this.modal) {
|
|
3317
|
-
this.bib.setAttribute("aria-modal", "true");
|
|
3557
|
+
// Use bibLabel + aria-labelledby on the <dialog> instead of aria-label
|
|
3558
|
+
// directly — iOS VoiceOver does not reliably read aria-label on <dialog>.
|
|
3559
|
+
this.bib.bibLabel = this.triggerElement.textContent.trim();
|
|
3318
3560
|
}
|
|
3561
|
+
// role="dialog" and aria-modal are provided natively by the <dialog> element;
|
|
3562
|
+
// do not set them manually here.
|
|
3319
3563
|
}
|
|
3320
3564
|
|
|
3321
3565
|
/**
|
|
@@ -3353,9 +3597,15 @@ class AuroDrawer extends AuroFloater {
|
|
|
3353
3597
|
|
|
3354
3598
|
if (changedProperties.has("isPopoverVisible")) {
|
|
3355
3599
|
this.drawerBib.visible = this.isPopoverVisible;
|
|
3600
|
+
if (!this.isPopoverVisible) {
|
|
3601
|
+
this.drawerBib.closing = true;
|
|
3602
|
+
}
|
|
3356
3603
|
}
|
|
3357
3604
|
|
|
3358
3605
|
if (changedProperties.has("triggerElement")) {
|
|
3606
|
+
if (this.drawerBib) {
|
|
3607
|
+
this.drawerBib.triggerElement = this.triggerElement;
|
|
3608
|
+
}
|
|
3359
3609
|
this.setupAria();
|
|
3360
3610
|
}
|
|
3361
3611
|
}
|