@aurodesignsystem-dev/auro-drawer 0.0.0-pr131.0 → 0.0.0-pr131.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,113 @@ 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
|
+
// Prevent browser scroll-to-dialog jump before showing.
|
|
2543
|
+
const { documentElement } = document;
|
|
2544
|
+
const prevOverflow = documentElement.style.overflow;
|
|
2545
|
+
documentElement.style.overflow = "hidden";
|
|
2546
|
+
this.dialog.showModal();
|
|
2547
|
+
documentElement.style.overflow = prevOverflow;
|
|
2548
|
+
|
|
2549
|
+
this._lockTouchScroll();
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
|
|
2553
|
+
/**
|
|
2554
|
+
* Closes the dialog and releases touch-scroll lock.
|
|
2555
|
+
*/
|
|
2556
|
+
hideDialog() {
|
|
2557
|
+
if (!this.dialog || !this.dialog.open) {
|
|
2558
|
+
return;
|
|
2559
|
+
}
|
|
2560
|
+
setTimeout(() => {
|
|
2561
|
+
this.dialog.close();
|
|
2562
|
+
}, 300);
|
|
2563
|
+
this._unlockTouchScroll();
|
|
2564
|
+
}
|
|
2565
|
+
|
|
2566
|
+
/**
|
|
2567
|
+
* Locks page-level touch scroll while the drawer is open.
|
|
2568
|
+
* Walks composedPath() so scrollable children inside the dialog still scroll.
|
|
2569
|
+
* @private
|
|
2570
|
+
*/
|
|
2571
|
+
_lockTouchScroll() {
|
|
2572
|
+
if (this._boundTouchMoveHandler) {
|
|
2573
|
+
return;
|
|
2574
|
+
}
|
|
2575
|
+
this._boundTouchMoveHandler = (e) => {
|
|
2576
|
+
const path = e.composedPath();
|
|
2577
|
+
const insideScrollable = path.some(
|
|
2578
|
+
(el) => el !== document && el.scrollHeight > el.clientHeight,
|
|
2579
|
+
);
|
|
2580
|
+
if (!insideScrollable) {
|
|
2581
|
+
e.preventDefault();
|
|
2582
|
+
}
|
|
2583
|
+
};
|
|
2584
|
+
document.addEventListener("touchmove", this._boundTouchMoveHandler, {
|
|
2585
|
+
passive: false,
|
|
2586
|
+
});
|
|
2587
|
+
}
|
|
2588
|
+
|
|
2589
|
+
/**
|
|
2590
|
+
* Removes the touch-scroll lock.
|
|
2591
|
+
* @private
|
|
2592
|
+
*/
|
|
2593
|
+
_unlockTouchScroll() {
|
|
2594
|
+
if (this._boundTouchMoveHandler) {
|
|
2595
|
+
document.removeEventListener("touchmove", this._boundTouchMoveHandler, {
|
|
2596
|
+
passive: false,
|
|
2597
|
+
});
|
|
2598
|
+
this._boundTouchMoveHandler = undefined;
|
|
2599
|
+
}
|
|
2485
2600
|
}
|
|
2486
2601
|
|
|
2487
2602
|
render() {
|
|
2488
2603
|
return u$2`
|
|
2489
|
-
<
|
|
2490
|
-
<
|
|
2604
|
+
<dialog class="container" aria-labelledby="dialogLabel">
|
|
2605
|
+
<span id="dialogLabel" class="util_displayHiddenVisually" aria-hidden="true">${this.bibLabel || ""}</span>
|
|
2491
2606
|
<slot></slot>
|
|
2492
|
-
</
|
|
2607
|
+
</dialog>
|
|
2493
2608
|
`;
|
|
2494
2609
|
}
|
|
2495
2610
|
}
|
|
@@ -2587,8 +2702,10 @@ class AuroFloater extends i$2 {
|
|
|
2587
2702
|
if (changedProperties.has("isPopoverVisible")) {
|
|
2588
2703
|
if (this.isPopoverVisible) {
|
|
2589
2704
|
this.floater.showBib();
|
|
2705
|
+
this.bib?.showDialog({ nested: this.nested });
|
|
2590
2706
|
} else {
|
|
2591
2707
|
this.floater.hideBib();
|
|
2708
|
+
this.bib?.hideDialog();
|
|
2592
2709
|
}
|
|
2593
2710
|
}
|
|
2594
2711
|
}
|
|
@@ -2704,85 +2821,209 @@ class p{registerComponent(t,a){customElements.get(t)||customElements.define(t,cl
|
|
|
2704
2821
|
</div>
|
|
2705
2822
|
`}}
|
|
2706
2823
|
|
|
2707
|
-
//
|
|
2824
|
+
// Selectors for focusable elements
|
|
2708
2825
|
const FOCUSABLE_SELECTORS = [
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2826
|
+
'a[href]',
|
|
2827
|
+
'button:not([disabled])',
|
|
2828
|
+
'textarea:not([disabled])',
|
|
2829
|
+
'input:not([disabled])',
|
|
2830
|
+
'select:not([disabled])',
|
|
2714
2831
|
'[role="tab"]:not([disabled])',
|
|
2715
2832
|
'[role="link"]:not([disabled])',
|
|
2716
2833
|
'[role="button"]:not([disabled])',
|
|
2717
2834
|
'[tabindex]:not([tabindex="-1"])',
|
|
2718
|
-
'[contenteditable]:not([contenteditable="false"])'
|
|
2835
|
+
'[contenteditable]:not([contenteditable="false"])'
|
|
2719
2836
|
];
|
|
2720
2837
|
|
|
2838
|
+
// List of custom components that are known to be focusable
|
|
2721
2839
|
const FOCUSABLE_COMPONENTS = [
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2840
|
+
'auro-checkbox',
|
|
2841
|
+
'auro-radio',
|
|
2842
|
+
'auro-dropdown',
|
|
2843
|
+
'auro-button',
|
|
2844
|
+
'auro-combobox',
|
|
2845
|
+
'auro-input',
|
|
2846
|
+
'auro-counter',
|
|
2847
|
+
'auro-menu',
|
|
2848
|
+
'auro-select',
|
|
2849
|
+
'auro-datepicker',
|
|
2850
|
+
'auro-hyperlink',
|
|
2851
|
+
'auro-accordion',
|
|
2734
2852
|
];
|
|
2735
2853
|
|
|
2854
|
+
/**
|
|
2855
|
+
* Determines if a given element is a custom focusable component.
|
|
2856
|
+
* Returns true if the element matches a known focusable component and is not disabled.
|
|
2857
|
+
*
|
|
2858
|
+
* @param {HTMLElement} element The element to check for focusability.
|
|
2859
|
+
* @returns {boolean} True if the element is a focusable custom component, false otherwise.
|
|
2860
|
+
*/
|
|
2861
|
+
function isFocusableComponent(element) {
|
|
2862
|
+
const componentName = element.tagName.toLowerCase();
|
|
2863
|
+
|
|
2864
|
+
// Guard Clause: Element is a focusable component
|
|
2865
|
+
if (!FOCUSABLE_COMPONENTS.some((name) => element.hasAttribute(name) || componentName === name)) return false;
|
|
2866
|
+
|
|
2867
|
+
// Guard Clause: Element is not disabled
|
|
2868
|
+
if (element.hasAttribute('disabled')) return false;
|
|
2869
|
+
|
|
2870
|
+
// Guard Clause: The element is a hyperlink and has no href attribute
|
|
2871
|
+
if (componentName.match("hyperlink") && !element.hasAttribute('href')) return false;
|
|
2872
|
+
|
|
2873
|
+
// If all guard clauses pass, the element is a focusable component
|
|
2874
|
+
return true;
|
|
2875
|
+
}
|
|
2876
|
+
|
|
2877
|
+
/**
|
|
2878
|
+
* Retrieves all focusable elements within the container in DOM order, including those in shadow DOM and slots.
|
|
2879
|
+
* Returns a unique, ordered array of elements that can receive focus.
|
|
2880
|
+
*
|
|
2881
|
+
* @param {HTMLElement} container The container to search within
|
|
2882
|
+
* @returns {Array<HTMLElement>} An array of focusable elements within the container.
|
|
2883
|
+
*/
|
|
2884
|
+
function getFocusableElements(container) {
|
|
2885
|
+
// Get elements in DOM order by walking the tree
|
|
2886
|
+
const orderedFocusableElements = [];
|
|
2887
|
+
|
|
2888
|
+
// Define a recursive function to collect focusable elements in DOM order
|
|
2889
|
+
const collectFocusableElements = (root) => {
|
|
2890
|
+
// Check if current element is focusable
|
|
2891
|
+
if (root.nodeType === Node.ELEMENT_NODE) {
|
|
2892
|
+
// Check if this is a custom component that is focusable
|
|
2893
|
+
const isComponentFocusable = isFocusableComponent(root);
|
|
2894
|
+
|
|
2895
|
+
if (isComponentFocusable) {
|
|
2896
|
+
// Add the component itself as a focusable element and don't traverse its shadow DOM
|
|
2897
|
+
orderedFocusableElements.push(root);
|
|
2898
|
+
return; // Skip traversing inside this component
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2901
|
+
// Check if the element itself matches any selector
|
|
2902
|
+
for (const selector of FOCUSABLE_SELECTORS) {
|
|
2903
|
+
if (root.matches?.(selector)) {
|
|
2904
|
+
orderedFocusableElements.push(root);
|
|
2905
|
+
break; // Once we know it's focusable, no need to check other selectors
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
2908
|
+
|
|
2909
|
+
// Process shadow DOM only for non-Auro components
|
|
2910
|
+
if (root.shadowRoot) {
|
|
2911
|
+
// Process shadow DOM children in order
|
|
2912
|
+
if (root.shadowRoot.children) {
|
|
2913
|
+
Array.from(root.shadowRoot.children).forEach(child => {
|
|
2914
|
+
collectFocusableElements(child);
|
|
2915
|
+
});
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
|
|
2919
|
+
// Process slots and their assigned nodes in order
|
|
2920
|
+
if (root.tagName === 'SLOT') {
|
|
2921
|
+
const assignedNodes = root.assignedNodes({ flatten: true });
|
|
2922
|
+
for (const node of assignedNodes) {
|
|
2923
|
+
collectFocusableElements(node);
|
|
2924
|
+
}
|
|
2925
|
+
} else {
|
|
2926
|
+
// Process light DOM children in order
|
|
2927
|
+
if (root.children) {
|
|
2928
|
+
Array.from(root.children).forEach(child => {
|
|
2929
|
+
collectFocusableElements(child);
|
|
2930
|
+
});
|
|
2931
|
+
}
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
};
|
|
2935
|
+
|
|
2936
|
+
// Start the traversal from the container
|
|
2937
|
+
collectFocusableElements(container);
|
|
2938
|
+
|
|
2939
|
+
// Remove duplicates that might have been collected through different paths
|
|
2940
|
+
// while preserving order
|
|
2941
|
+
const uniqueElements = [];
|
|
2942
|
+
const seen = new Set();
|
|
2943
|
+
|
|
2944
|
+
for (const element of orderedFocusableElements) {
|
|
2945
|
+
if (!seen.has(element)) {
|
|
2946
|
+
seen.add(element);
|
|
2947
|
+
uniqueElements.push(element);
|
|
2948
|
+
}
|
|
2949
|
+
}
|
|
2950
|
+
|
|
2951
|
+
return uniqueElements;
|
|
2952
|
+
}
|
|
2953
|
+
|
|
2954
|
+
/**
|
|
2955
|
+
* FocusTrap manages keyboard focus within a specified container element, ensuring that focus does not leave the container when tabbing.
|
|
2956
|
+
* It is commonly used for modal dialogs or overlays to improve accessibility by trapping focus within interactive UI components.
|
|
2957
|
+
*/
|
|
2736
2958
|
class FocusTrap {
|
|
2959
|
+
/**
|
|
2960
|
+
* Creates a new FocusTrap instance for the given container element.
|
|
2961
|
+
* Initializes event listeners and prepares the container for focus management.
|
|
2962
|
+
*
|
|
2963
|
+
* @param {HTMLElement} container The DOM element to trap focus within.
|
|
2964
|
+
* @throws {Error} If the provided container is not a valid HTMLElement.
|
|
2965
|
+
*/
|
|
2737
2966
|
constructor(container) {
|
|
2738
2967
|
if (!container || !(container instanceof HTMLElement)) {
|
|
2739
2968
|
throw new Error("FocusTrap requires a valid HTMLElement.");
|
|
2740
2969
|
}
|
|
2741
2970
|
|
|
2742
2971
|
this.container = container;
|
|
2743
|
-
this.tabDirection =
|
|
2972
|
+
this.tabDirection = 'forward'; // or 'backward'
|
|
2744
2973
|
|
|
2745
2974
|
this._init();
|
|
2746
2975
|
}
|
|
2747
2976
|
|
|
2977
|
+
/**
|
|
2978
|
+
* Initializes the focus trap by setting up event listeners and attributes on the container.
|
|
2979
|
+
* Prepares the container for focus management, including support for shadow DOM and inert attributes.
|
|
2980
|
+
*
|
|
2981
|
+
* @private
|
|
2982
|
+
*/
|
|
2748
2983
|
_init() {
|
|
2749
|
-
// Support for shadow DOM / web components
|
|
2750
|
-
this.container.shadowRoot || this.container;
|
|
2751
2984
|
|
|
2752
2985
|
// Add inert attribute to prevent focusing programmatically as well (if supported)
|
|
2753
|
-
if (
|
|
2986
|
+
if ('inert' in HTMLElement.prototype) {
|
|
2754
2987
|
this.container.inert = false; // Ensure the container isn't inert
|
|
2755
|
-
this.container.setAttribute(
|
|
2988
|
+
this.container.setAttribute('data-focus-trap-container', true); // Mark for identification
|
|
2756
2989
|
}
|
|
2757
2990
|
|
|
2758
2991
|
// Track tab direction
|
|
2759
|
-
this.container.addEventListener(
|
|
2992
|
+
this.container.addEventListener('keydown', this._onKeydown);
|
|
2760
2993
|
}
|
|
2761
2994
|
|
|
2995
|
+
/**
|
|
2996
|
+
* Handles keydown events to manage tab navigation within the container.
|
|
2997
|
+
* Ensures that focus wraps around when reaching the first or last focusable element.
|
|
2998
|
+
*
|
|
2999
|
+
* @param {KeyboardEvent} e The keyboard event triggered by user interaction.
|
|
3000
|
+
* @private
|
|
3001
|
+
*/
|
|
2762
3002
|
_onKeydown = (e) => {
|
|
2763
|
-
|
|
3003
|
+
|
|
3004
|
+
if (e.key === 'Tab') {
|
|
3005
|
+
|
|
2764
3006
|
// Set the tab direction based on the key pressed
|
|
2765
|
-
this.tabDirection = e.shiftKey ?
|
|
3007
|
+
this.tabDirection = e.shiftKey ? 'backward' : 'forward';
|
|
2766
3008
|
|
|
2767
3009
|
// Get the active element(s) in the document and shadow root
|
|
2768
3010
|
// This will include the active element in the shadow DOM if it exists
|
|
2769
3011
|
// Active element may be inside the shadow DOM depending on delegatesFocus, so we need to check both
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
3012
|
+
let activeElement = document.activeElement;
|
|
3013
|
+
const actives = [activeElement];
|
|
3014
|
+
while (activeElement?.shadowRoot?.activeElement) {
|
|
3015
|
+
actives.push(activeElement.shadowRoot.activeElement);
|
|
3016
|
+
activeElement = activeElement.shadowRoot.activeElement;
|
|
3017
|
+
}
|
|
2776
3018
|
|
|
2777
3019
|
// Update the focusable elements
|
|
2778
3020
|
const focusables = this._getFocusableElements();
|
|
2779
3021
|
|
|
2780
3022
|
// If we're at either end of the focusable elements, wrap around to the other end
|
|
2781
3023
|
const focusIndex =
|
|
2782
|
-
actives.includes(focusables[0]) && this.tabDirection ===
|
|
3024
|
+
(actives.includes(focusables[0]) || actives.includes(this.container)) && this.tabDirection === 'backward'
|
|
2783
3025
|
? focusables.length - 1
|
|
2784
|
-
: actives.includes(focusables[focusables.length - 1]) &&
|
|
2785
|
-
this.tabDirection === "forward"
|
|
3026
|
+
: actives.includes(focusables[focusables.length - 1]) && this.tabDirection === 'forward'
|
|
2786
3027
|
? 0
|
|
2787
3028
|
: null;
|
|
2788
3029
|
|
|
@@ -2794,100 +3035,50 @@ class FocusTrap {
|
|
|
2794
3035
|
}
|
|
2795
3036
|
};
|
|
2796
3037
|
|
|
3038
|
+
/**
|
|
3039
|
+
* Retrieves all focusable elements within the container in DOM order, including those in shadow DOM and slots.
|
|
3040
|
+
* Returns a unique, ordered array of elements that can receive focus.
|
|
3041
|
+
*
|
|
3042
|
+
* @returns {Array<HTMLElement>} An array of focusable elements within the container.
|
|
3043
|
+
* @private
|
|
3044
|
+
*/
|
|
2797
3045
|
_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;
|
|
3046
|
+
// Use the imported utility function to get focusable elements
|
|
3047
|
+
const elements = getFocusableElements(this.container);
|
|
3048
|
+
|
|
3049
|
+
// Filter out any elements with the 'focus-bookend' class
|
|
3050
|
+
return elements;
|
|
2870
3051
|
}
|
|
2871
3052
|
|
|
3053
|
+
/**
|
|
3054
|
+
* Moves focus to the first focusable element within the container.
|
|
3055
|
+
* Useful for setting initial focus when activating the focus trap.
|
|
3056
|
+
*/
|
|
2872
3057
|
focusFirstElement() {
|
|
2873
3058
|
const focusables = this._getFocusableElements();
|
|
2874
3059
|
if (focusables.length) focusables[0].focus();
|
|
2875
3060
|
}
|
|
2876
3061
|
|
|
3062
|
+
/**
|
|
3063
|
+
* Moves focus to the last focusable element within the container.
|
|
3064
|
+
* Useful for setting focus when deactivating or cycling focus in reverse.
|
|
3065
|
+
*/
|
|
2877
3066
|
focusLastElement() {
|
|
2878
3067
|
const focusables = this._getFocusableElements();
|
|
2879
3068
|
if (focusables.length) focusables[focusables.length - 1].focus();
|
|
2880
3069
|
}
|
|
2881
3070
|
|
|
3071
|
+
/**
|
|
3072
|
+
* Removes event listeners and attributes added by the focus trap.
|
|
3073
|
+
* Call this method to clean up when the focus trap is no longer needed.
|
|
3074
|
+
*/
|
|
2882
3075
|
disconnect() {
|
|
2883
|
-
// Remove the tabIndex we set
|
|
2884
|
-
this.container.removeAttribute("tabIndex");
|
|
2885
3076
|
|
|
2886
|
-
if (this.container.hasAttribute(
|
|
2887
|
-
this.container.removeAttribute(
|
|
3077
|
+
if (this.container.hasAttribute('data-focus-trap-container')) {
|
|
3078
|
+
this.container.removeAttribute('data-focus-trap-container');
|
|
2888
3079
|
}
|
|
2889
3080
|
|
|
2890
|
-
this.container.removeEventListener(
|
|
3081
|
+
this.container.removeEventListener('keydown', this._onKeydown);
|
|
2891
3082
|
}
|
|
2892
3083
|
}
|
|
2893
3084
|
|
|
@@ -2898,7 +3089,7 @@ var iconVersion = '9.1.1';
|
|
|
2898
3089
|
var colorCss = i$5`.wrapper{background:var(--ds-auro-drawer-container-color)}::slotted(*){color:var(--ds-auro-drawer-text-color)}
|
|
2899
3090
|
`;
|
|
2900
3091
|
|
|
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%}
|
|
3092
|
+
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
3093
|
`;
|
|
2903
3094
|
|
|
2904
3095
|
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 +3164,11 @@ class AuroDrawerContent extends i$2 {
|
|
|
2973
3164
|
visible: {
|
|
2974
3165
|
type: Boolean,
|
|
2975
3166
|
reflect: true
|
|
3167
|
+
},
|
|
3168
|
+
|
|
3169
|
+
closing: {
|
|
3170
|
+
type: Boolean,
|
|
3171
|
+
reflect: true
|
|
2976
3172
|
}
|
|
2977
3173
|
};
|
|
2978
3174
|
}
|
|
@@ -2985,27 +3181,33 @@ class AuroDrawerContent extends i$2 {
|
|
|
2985
3181
|
this.dispatchEvent(new CustomEvent("close-click"));
|
|
2986
3182
|
}
|
|
2987
3183
|
|
|
2988
|
-
handleWrapperTransitionEnd() {
|
|
2989
|
-
if (!this.visible) return;
|
|
2990
|
-
if (!this.focusTrap) return;
|
|
2991
|
-
this.focusTrap.focusFirstElement();
|
|
2992
|
-
}
|
|
2993
|
-
|
|
2994
3184
|
updated(changedProperties) {
|
|
2995
3185
|
if (changedProperties.has("visible")) {
|
|
2996
3186
|
if (this.visible) {
|
|
3187
|
+
// Reset CSS animation so it replays each time the drawer opens
|
|
3188
|
+
const wrapper = this.shadowRoot.querySelector('.wrapper');
|
|
3189
|
+
if (wrapper) {
|
|
3190
|
+
wrapper.style.animation = 'none';
|
|
3191
|
+
// Force reflow to restart the animation
|
|
3192
|
+
void wrapper.offsetHeight; // eslint-disable-line no-void
|
|
3193
|
+
wrapper.style.animation = '';
|
|
3194
|
+
}
|
|
3195
|
+
|
|
2997
3196
|
if (!this.focusTrap) {
|
|
2998
3197
|
this.focusTrap = new FocusTrap(this);
|
|
2999
3198
|
}
|
|
3000
|
-
this.prevActiveElement = document.activeElement;
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3199
|
+
this.prevActiveElement = this.triggerElement || document.activeElement;
|
|
3200
|
+
// Move focus to the first focusable element inside the drawer.
|
|
3201
|
+
// rAF lets showModal()'s native focus assignment settle before we override.
|
|
3202
|
+
requestAnimationFrame(() => {
|
|
3203
|
+
this.focusTrap?.focusFirstElement();
|
|
3204
|
+
});
|
|
3004
3205
|
} else {
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3206
|
+
// Native dialog.close() fires after a 300ms delay (see auro-floater-bib hideDialog).
|
|
3207
|
+
// Defer focus restoration so it runs after the dialog releases focus.
|
|
3208
|
+
const target = this.prevActiveElement;
|
|
3209
|
+
this.prevActiveElement = undefined;
|
|
3210
|
+
setTimeout(() => target?.focus(), 350);
|
|
3009
3211
|
|
|
3010
3212
|
if (this.focusTrap) {
|
|
3011
3213
|
this.focusTrap.disconnect();
|
|
@@ -3013,10 +3215,13 @@ class AuroDrawerContent extends i$2 {
|
|
|
3013
3215
|
}
|
|
3014
3216
|
}
|
|
3015
3217
|
}
|
|
3016
|
-
}
|
|
3017
3218
|
|
|
3018
|
-
|
|
3019
|
-
|
|
3219
|
+
if (changedProperties.has("closing") && this.closing) {
|
|
3220
|
+
// Reset closing state after animation completes
|
|
3221
|
+
setTimeout(() => {
|
|
3222
|
+
this.closing = false;
|
|
3223
|
+
}, 300);
|
|
3224
|
+
}
|
|
3020
3225
|
}
|
|
3021
3226
|
|
|
3022
3227
|
render() {
|
|
@@ -3024,7 +3229,7 @@ class AuroDrawerContent extends i$2 {
|
|
|
3024
3229
|
<!-- Hidden slot for close button aria-label -->
|
|
3025
3230
|
<slot name="ariaLabel.drawer.close" hidden @slotchange=${this.requestUpdate}></slot>
|
|
3026
3231
|
|
|
3027
|
-
<div class="wrapper" tabindex="-1" part="drawer-wrapper"
|
|
3232
|
+
<div class="wrapper" tabindex="-1" part="drawer-wrapper">
|
|
3028
3233
|
${
|
|
3029
3234
|
this.unformatted
|
|
3030
3235
|
? ""
|
|
@@ -3289,6 +3494,7 @@ class AuroDrawer extends AuroFloater {
|
|
|
3289
3494
|
);
|
|
3290
3495
|
|
|
3291
3496
|
this.drawerBib = document.createElement("auro-drawer-content");
|
|
3497
|
+
this.drawerBib.triggerElement = this.triggerElement;
|
|
3292
3498
|
this.drawerBib.addEventListener("close-click", () =>
|
|
3293
3499
|
this.floater.hideBib(),
|
|
3294
3500
|
);
|
|
@@ -3296,6 +3502,15 @@ class AuroDrawer extends AuroFloater {
|
|
|
3296
3502
|
|
|
3297
3503
|
this.bib.setAttribute("exportparts", "backdrop:drawer-backdrop");
|
|
3298
3504
|
|
|
3505
|
+
// Handle Escape key via native dialog cancel event.
|
|
3506
|
+
// Always preventDefault in the bib; here we decide whether to actually close.
|
|
3507
|
+
this.bib.addEventListener("dialog-cancel", () => {
|
|
3508
|
+
if (this.modal) {
|
|
3509
|
+
return; // Modal drawers ignore Escape.
|
|
3510
|
+
}
|
|
3511
|
+
this.floater.hideBib();
|
|
3512
|
+
});
|
|
3513
|
+
|
|
3299
3514
|
this.setupAria();
|
|
3300
3515
|
}
|
|
3301
3516
|
|
|
@@ -3310,12 +3525,12 @@ class AuroDrawer extends AuroFloater {
|
|
|
3310
3525
|
this.bib.getAttribute("id"),
|
|
3311
3526
|
);
|
|
3312
3527
|
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
if (this.modal) {
|
|
3317
|
-
this.bib.setAttribute("aria-modal", "true");
|
|
3528
|
+
// Use bibLabel + aria-labelledby on the <dialog> instead of aria-label
|
|
3529
|
+
// directly — iOS VoiceOver does not reliably read aria-label on <dialog>.
|
|
3530
|
+
this.bib.bibLabel = this.triggerElement.textContent.trim();
|
|
3318
3531
|
}
|
|
3532
|
+
// role="dialog" and aria-modal are provided natively by the <dialog> element;
|
|
3533
|
+
// do not set them manually here.
|
|
3319
3534
|
}
|
|
3320
3535
|
|
|
3321
3536
|
/**
|
|
@@ -3353,9 +3568,15 @@ class AuroDrawer extends AuroFloater {
|
|
|
3353
3568
|
|
|
3354
3569
|
if (changedProperties.has("isPopoverVisible")) {
|
|
3355
3570
|
this.drawerBib.visible = this.isPopoverVisible;
|
|
3571
|
+
if (!this.isPopoverVisible) {
|
|
3572
|
+
this.drawerBib.closing = true;
|
|
3573
|
+
}
|
|
3356
3574
|
}
|
|
3357
3575
|
|
|
3358
3576
|
if (changedProperties.has("triggerElement")) {
|
|
3577
|
+
if (this.drawerBib) {
|
|
3578
|
+
this.drawerBib.triggerElement = this.triggerElement;
|
|
3579
|
+
}
|
|
3359
3580
|
this.setupAria();
|
|
3360
3581
|
}
|
|
3361
3582
|
}
|