@aurodesignsystem-dev/auro-formkit 0.0.0-pr624.8 → 0.0.0-pr624.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/bibtemplate/dist/auro-bibtemplate.d.ts +12 -2
- package/components/bibtemplate/dist/buttonVersion.d.ts +2 -0
- package/components/bibtemplate/dist/iconVersion.d.ts +1 -1
- package/components/bibtemplate/dist/index.js +1262 -81
- package/components/bibtemplate/dist/registered.js +1262 -81
- package/components/checkbox/README.md +1 -1
- package/components/checkbox/demo/api.html +16 -10
- package/components/checkbox/demo/api.md +49 -15
- package/components/checkbox/demo/api.min.js +73 -43
- package/components/checkbox/demo/index.html +16 -10
- package/components/checkbox/demo/index.md +2 -2
- package/components/checkbox/demo/index.min.js +73 -43
- package/components/checkbox/demo/readme.html +16 -9
- package/components/checkbox/demo/readme.md +1 -1
- package/components/checkbox/dist/auro-checkbox-group.d.ts +1 -1
- package/components/checkbox/dist/auro-checkbox.d.ts +3 -3
- package/components/checkbox/dist/index.js +72 -42
- package/components/checkbox/dist/registered.js +72 -42
- package/components/combobox/demo/api.html +16 -10
- package/components/combobox/demo/api.md +115 -8
- package/components/combobox/demo/api.min.js +3102 -921
- package/components/combobox/demo/index.html +16 -10
- package/components/combobox/demo/index.md +6 -30
- package/components/combobox/demo/index.min.js +3102 -921
- package/components/combobox/demo/readme.html +16 -9
- package/components/combobox/dist/auro-combobox.d.ts +44 -12
- package/components/combobox/dist/index.js +3080 -995
- package/components/combobox/dist/registered.js +3080 -995
- package/components/counter/demo/api.html +17 -10
- package/components/counter/demo/api.md +158 -21
- package/components/counter/demo/api.min.js +3416 -728
- package/components/counter/demo/index.html +17 -10
- package/components/counter/demo/index.md +185 -34
- package/components/counter/demo/index.min.js +3416 -728
- package/components/counter/demo/readme.html +16 -9
- package/components/counter/dist/auro-counter-button.d.ts +2 -0
- package/components/counter/dist/auro-counter-group.d.ts +161 -11
- package/components/counter/dist/auro-counter.d.ts +16 -0
- package/components/counter/dist/helptextVersion.d.ts +2 -0
- package/components/counter/dist/iconVersion.d.ts +1 -1
- package/components/counter/dist/index.js +3416 -728
- package/components/counter/dist/registered.js +3416 -728
- package/components/datepicker/README.md +1 -1
- package/components/datepicker/demo/api.html +16 -10
- package/components/datepicker/demo/api.md +59 -28
- package/components/datepicker/demo/api.min.js +8486 -4644
- package/components/datepicker/demo/index.html +16 -10
- package/components/datepicker/demo/index.md +75 -8
- package/components/datepicker/demo/index.min.js +8486 -4644
- package/components/datepicker/demo/readme.html +16 -9
- package/components/datepicker/demo/readme.md +1 -1
- package/components/datepicker/dist/auro-datepicker.d.ts +151 -12
- package/components/datepicker/dist/buttonVersion.d.ts +1 -1
- package/components/datepicker/dist/iconVersion.d.ts +2 -0
- package/components/datepicker/dist/index.js +7033 -3191
- package/components/datepicker/dist/popoverVersion.d.ts +1 -1
- package/components/datepicker/dist/registered.js +7033 -3191
- package/components/dropdown/demo/api.html +16 -10
- package/components/dropdown/demo/api.md +82 -275
- package/components/dropdown/demo/api.min.js +451 -260
- package/components/dropdown/demo/index.html +16 -10
- package/components/dropdown/demo/index.md +92 -362
- package/components/dropdown/demo/index.min.js +451 -260
- package/components/dropdown/demo/readme.html +16 -9
- package/components/dropdown/dist/auro-dropdown.d.ts +43 -83
- package/components/dropdown/dist/auro-dropdownBib.d.ts +14 -0
- package/components/dropdown/dist/index.js +450 -259
- package/components/dropdown/dist/registered.js +450 -259
- package/components/form/demo/api.html +16 -9
- package/components/form/demo/api.min.js +2 -2
- package/components/form/demo/autocomplete.html +19 -3
- package/components/form/demo/index.html +16 -9
- package/components/form/demo/index.min.js +2 -2
- package/components/form/demo/readme.html +16 -9
- package/components/form/demo/working.html +19 -13
- package/components/form/dist/index.js +1 -1
- package/components/form/dist/registered.js +1 -1
- package/components/helptext/dist/index.js +2 -2
- package/components/helptext/dist/registered.js +2 -2
- package/components/input/README.md +5 -2
- package/components/input/demo/api.html +16 -10
- package/components/input/demo/api.md +228 -130
- package/components/input/demo/api.min.js +909 -247
- package/components/input/demo/index.html +16 -10
- package/components/input/demo/index.md +48 -32
- package/components/input/demo/index.min.js +909 -247
- package/components/input/demo/readme.html +16 -9
- package/components/input/demo/readme.md +5 -2
- package/components/input/dist/auro-input.d.ts +3 -3
- package/components/input/dist/base-input.d.ts +38 -10
- package/components/input/dist/buttonVersion.d.ts +1 -1
- package/components/input/dist/iconVersion.d.ts +1 -1
- package/components/input/dist/index.js +908 -246
- package/components/input/dist/registered.js +908 -246
- package/components/layoutElement/dist/index.js +13 -10
- package/components/menu/demo/api.html +32 -10
- package/components/menu/demo/api.md +69 -8
- package/components/menu/demo/api.min.js +239 -48
- package/components/menu/demo/index.html +16 -10
- package/components/menu/demo/index.min.js +239 -48
- package/components/menu/demo/readme.html +16 -9
- package/components/menu/dist/auro-menu.d.ts +41 -7
- package/components/menu/dist/auro-menuoption.d.ts +15 -3
- package/components/menu/dist/iconVersion.d.ts +1 -1
- package/components/menu/dist/index.js +238 -47
- package/components/menu/dist/registered.js +238 -47
- package/components/menu/dist/styles/default/color-menuoption-css.d.ts +2 -0
- package/components/menu/dist/styles/default/style-menu-css.d.ts +2 -0
- package/components/menu/dist/styles/default/style-menuoption-css.d.ts +2 -0
- package/components/menu/dist/styles/default/tokens-css.d.ts +2 -0
- package/components/radio/demo/api.html +16 -10
- package/components/radio/demo/api.md +39 -9
- package/components/radio/demo/api.min.js +91 -93
- package/components/radio/demo/index.html +16 -10
- package/components/radio/demo/index.min.js +91 -93
- package/components/radio/demo/readme.html +16 -9
- package/components/radio/dist/auro-radio-group.d.ts +1 -1
- package/components/radio/dist/auro-radio.d.ts +9 -12
- package/components/radio/dist/index.js +90 -92
- package/components/radio/dist/registered.js +90 -92
- package/components/select/demo/api.html +16 -10
- package/components/select/demo/api.js +0 -2
- package/components/select/demo/api.md +150 -121
- package/components/select/demo/api.min.js +2184 -704
- package/components/select/demo/index.html +17 -11
- package/components/select/demo/index.md +1066 -259
- package/components/select/demo/index.min.js +2186 -694
- package/components/select/demo/readme.html +16 -9
- package/components/select/dist/auro-select.d.ts +59 -21
- package/components/select/dist/index.js +2107 -711
- package/components/select/dist/registered.js +2107 -711
- package/package.json +31 -28
- /package/components/{datepicker/dist/styles/default/color-css.d.ts → counter/dist/styles/shapeSize-css.d.ts} +0 -0
- /package/components/{dropdown/dist/styles/default → datepicker/dist/styles/classic}/color-css.d.ts +0 -0
- /package/components/datepicker/dist/styles/{emphasized → classic}/style-css.d.ts +0 -0
- /package/components/{dropdown/dist/styles/default/bibColors-css.d.ts → datepicker/dist/styles/snowflake/color-css.d.ts} +0 -0
- /package/components/{dropdown/dist/styles/default → datepicker/dist/styles/snowflake}/style-css.d.ts +0 -0
- /package/components/dropdown/dist/styles/{default/bibStyles-css.d.ts → classic/bibColors-css.d.ts} +0 -0
- /package/components/{menu/dist/styles/color-menu-css.d.ts → dropdown/dist/styles/classic/bibStyles-css.d.ts} +0 -0
- /package/components/{menu/dist/styles/color-menuoption-css.d.ts → dropdown/dist/styles/classic/color-css.d.ts} +0 -0
- /package/components/{menu/dist/styles/style-menu-css.d.ts → dropdown/dist/styles/classic/style-css.d.ts} +0 -0
- /package/components/{menu/dist/styles/style-menuoption-css.d.ts → dropdown/dist/styles/style-css.d.ts} +0 -0
- /package/components/menu/dist/styles/{tokens-css.d.ts → default/color-menu-css.d.ts} +0 -0
|
@@ -1689,7 +1689,7 @@ class AuroFloatingUI {
|
|
|
1689
1689
|
*/
|
|
1690
1690
|
mirrorSize() {
|
|
1691
1691
|
// mirror the boxsize from bibSizer
|
|
1692
|
-
if (this.element.bibSizer) {
|
|
1692
|
+
if (this.element.bibSizer && this.element.matchWidth) {
|
|
1693
1693
|
const sizerStyle = window.getComputedStyle(this.element.bibSizer);
|
|
1694
1694
|
const bibContent = this.element.bib.shadowRoot.querySelector(".container");
|
|
1695
1695
|
if (sizerStyle.width !== '0px') {
|
|
@@ -1825,6 +1825,7 @@ class AuroFloatingUI {
|
|
|
1825
1825
|
this.element.bib.style.left = "0px";
|
|
1826
1826
|
this.element.bib.style.width = '';
|
|
1827
1827
|
this.element.bib.style.height = '';
|
|
1828
|
+
this.element.style.contain = '';
|
|
1828
1829
|
|
|
1829
1830
|
// reset the size that was mirroring `size` css-part
|
|
1830
1831
|
const bibContent = this.element.bib.shadowRoot.querySelector(".container");
|
|
@@ -1849,6 +1850,7 @@ class AuroFloatingUI {
|
|
|
1849
1850
|
this.element.bib.style.position = '';
|
|
1850
1851
|
this.element.bib.removeAttribute('isfullscreen');
|
|
1851
1852
|
this.element.isBibFullscreen = false;
|
|
1853
|
+
this.element.style.contain = 'layout';
|
|
1852
1854
|
}
|
|
1853
1855
|
|
|
1854
1856
|
const isChanged = this.strategy && this.strategy !== value;
|
|
@@ -1901,13 +1903,13 @@ class AuroFloatingUI {
|
|
|
1901
1903
|
if (this.element.contains(activeElement) || this.element.bib?.contains(activeElement)) {
|
|
1902
1904
|
return;
|
|
1903
1905
|
}
|
|
1904
|
-
|
|
1906
|
+
|
|
1905
1907
|
// if fullscreen bib is in fullscreen mode, do not close
|
|
1906
1908
|
if (this.element.bib.hasAttribute('isfullscreen')) {
|
|
1907
1909
|
return;
|
|
1908
1910
|
}
|
|
1909
1911
|
|
|
1910
|
-
this.hideBib();
|
|
1912
|
+
this.hideBib("keydown");
|
|
1911
1913
|
}
|
|
1912
1914
|
|
|
1913
1915
|
setupHideHandlers() {
|
|
@@ -1932,7 +1934,7 @@ class AuroFloatingUI {
|
|
|
1932
1934
|
document.expandedAuroFormkitDropdown = null;
|
|
1933
1935
|
document.expandedAuroFloater = this;
|
|
1934
1936
|
} else {
|
|
1935
|
-
this.hideBib();
|
|
1937
|
+
this.hideBib("click");
|
|
1936
1938
|
}
|
|
1937
1939
|
}
|
|
1938
1940
|
};
|
|
@@ -1945,7 +1947,7 @@ class AuroFloatingUI {
|
|
|
1945
1947
|
// if something else is open, let it handle itself
|
|
1946
1948
|
return;
|
|
1947
1949
|
}
|
|
1948
|
-
this.hideBib();
|
|
1950
|
+
this.hideBib("keydown");
|
|
1949
1951
|
}
|
|
1950
1952
|
};
|
|
1951
1953
|
|
|
@@ -2028,7 +2030,11 @@ class AuroFloatingUI {
|
|
|
2028
2030
|
}
|
|
2029
2031
|
}
|
|
2030
2032
|
|
|
2031
|
-
|
|
2033
|
+
/**
|
|
2034
|
+
* Hides the floating UI element.
|
|
2035
|
+
* @param {String} eventType - The event type that triggered the hiding action.
|
|
2036
|
+
*/
|
|
2037
|
+
hideBib(eventType = "unknown") {
|
|
2032
2038
|
if (!this.element.disabled && !this.element.noToggle) {
|
|
2033
2039
|
this.lockScroll(false);
|
|
2034
2040
|
this.element.triggerChevron?.removeAttribute('data-expanded');
|
|
@@ -2039,7 +2045,7 @@ class AuroFloatingUI {
|
|
|
2039
2045
|
if (this.showing) {
|
|
2040
2046
|
this.cleanupHideHandlers();
|
|
2041
2047
|
this.showing = false;
|
|
2042
|
-
this.dispatchEventDropdownToggle();
|
|
2048
|
+
this.dispatchEventDropdownToggle(eventType);
|
|
2043
2049
|
}
|
|
2044
2050
|
}
|
|
2045
2051
|
document.expandedAuroFloater = null;
|
|
@@ -2048,11 +2054,13 @@ class AuroFloatingUI {
|
|
|
2048
2054
|
/**
|
|
2049
2055
|
* @private
|
|
2050
2056
|
* @returns {void} Dispatches event with an object showing the state of the dropdown.
|
|
2057
|
+
* @param {String} eventType - The event type that triggered the toggle action.
|
|
2051
2058
|
*/
|
|
2052
|
-
dispatchEventDropdownToggle() {
|
|
2059
|
+
dispatchEventDropdownToggle(eventType) {
|
|
2053
2060
|
const event = new CustomEvent(this.eventPrefix ? `${this.eventPrefix}-toggled` : 'toggled', {
|
|
2054
2061
|
detail: {
|
|
2055
2062
|
expanded: this.showing,
|
|
2063
|
+
eventType: eventType || "unknown",
|
|
2056
2064
|
},
|
|
2057
2065
|
composed: true
|
|
2058
2066
|
});
|
|
@@ -2062,7 +2070,7 @@ class AuroFloatingUI {
|
|
|
2062
2070
|
|
|
2063
2071
|
handleClick() {
|
|
2064
2072
|
if (this.element.isPopoverVisible) {
|
|
2065
|
-
this.hideBib();
|
|
2073
|
+
this.hideBib("click");
|
|
2066
2074
|
} else {
|
|
2067
2075
|
this.showBib();
|
|
2068
2076
|
}
|
|
@@ -2085,8 +2093,9 @@ class AuroFloatingUI {
|
|
|
2085
2093
|
// Space is included as it's expected behavior for interactive elements
|
|
2086
2094
|
|
|
2087
2095
|
const origin = event.composedPath()[0];
|
|
2088
|
-
if (event.key === 'Enter' || (
|
|
2089
|
-
|
|
2096
|
+
if (event.key === 'Enter' || event.key === ' ' && (!origin || origin.tagName !== "INPUT")) {
|
|
2097
|
+
|
|
2098
|
+
event.preventDefault();
|
|
2090
2099
|
this.handleClick();
|
|
2091
2100
|
}
|
|
2092
2101
|
break;
|
|
@@ -2097,7 +2106,7 @@ class AuroFloatingUI {
|
|
|
2097
2106
|
break;
|
|
2098
2107
|
case 'mouseleave':
|
|
2099
2108
|
if (this.element.hoverToggle) {
|
|
2100
|
-
this.hideBib();
|
|
2109
|
+
this.hideBib("mouseleave");
|
|
2101
2110
|
}
|
|
2102
2111
|
break;
|
|
2103
2112
|
case 'focus':
|
|
@@ -2240,6 +2249,267 @@ class AuroFloatingUI {
|
|
|
2240
2249
|
}
|
|
2241
2250
|
}
|
|
2242
2251
|
|
|
2252
|
+
// Selectors for focusable elements
|
|
2253
|
+
const FOCUSABLE_SELECTORS = [
|
|
2254
|
+
'a[href]',
|
|
2255
|
+
'button:not([disabled])',
|
|
2256
|
+
'textarea:not([disabled])',
|
|
2257
|
+
'input:not([disabled])',
|
|
2258
|
+
'select:not([disabled])',
|
|
2259
|
+
'[role="tab"]:not([disabled])',
|
|
2260
|
+
'[role="link"]:not([disabled])',
|
|
2261
|
+
'[role="button"]:not([disabled])',
|
|
2262
|
+
'[tabindex]:not([tabindex="-1"])',
|
|
2263
|
+
'[contenteditable]:not([contenteditable="false"])'
|
|
2264
|
+
];
|
|
2265
|
+
|
|
2266
|
+
// List of custom components that are known to be focusable
|
|
2267
|
+
const FOCUSABLE_COMPONENTS = [
|
|
2268
|
+
'auro-checkbox',
|
|
2269
|
+
'auro-radio',
|
|
2270
|
+
'auro-dropdown',
|
|
2271
|
+
'auro-button',
|
|
2272
|
+
'auro-combobox',
|
|
2273
|
+
'auro-input',
|
|
2274
|
+
'auro-counter',
|
|
2275
|
+
'auro-menu',
|
|
2276
|
+
'auro-select',
|
|
2277
|
+
'auro-datepicker',
|
|
2278
|
+
'auro-hyperlink',
|
|
2279
|
+
'auro-accordion',
|
|
2280
|
+
];
|
|
2281
|
+
|
|
2282
|
+
/**
|
|
2283
|
+
* Determines if a given element is a custom focusable component.
|
|
2284
|
+
* Returns true if the element matches a known focusable component and is not disabled.
|
|
2285
|
+
*
|
|
2286
|
+
* @param {HTMLElement} element The element to check for focusability.
|
|
2287
|
+
* @returns {boolean} True if the element is a focusable custom component, false otherwise.
|
|
2288
|
+
*/
|
|
2289
|
+
function isFocusableComponent(element) {
|
|
2290
|
+
const componentName = element.tagName.toLowerCase();
|
|
2291
|
+
|
|
2292
|
+
// Guard Clause: Element is a focusable component
|
|
2293
|
+
if (!FOCUSABLE_COMPONENTS.some((name) => element.hasAttribute(name) || componentName === name)) return false;
|
|
2294
|
+
|
|
2295
|
+
// Guard Clause: Element is not disabled
|
|
2296
|
+
if (element.hasAttribute('disabled')) return false;
|
|
2297
|
+
|
|
2298
|
+
// Guard Clause: The element is a hyperlink and has no href attribute
|
|
2299
|
+
if (componentName.match("hyperlink") && !element.hasAttribute('href')) return false;
|
|
2300
|
+
|
|
2301
|
+
// If all guard clauses pass, the element is a focusable component
|
|
2302
|
+
return true;
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2305
|
+
/**
|
|
2306
|
+
* Retrieves all focusable elements within the container in DOM order, including those in shadow DOM and slots.
|
|
2307
|
+
* Returns a unique, ordered array of elements that can receive focus.
|
|
2308
|
+
*
|
|
2309
|
+
* @param {HTMLElement} container The container to search within
|
|
2310
|
+
* @returns {Array<HTMLElement>} An array of focusable elements within the container.
|
|
2311
|
+
*/
|
|
2312
|
+
function getFocusableElements(container) {
|
|
2313
|
+
// Get elements in DOM order by walking the tree
|
|
2314
|
+
const orderedFocusableElements = [];
|
|
2315
|
+
|
|
2316
|
+
// Define a recursive function to collect focusable elements in DOM order
|
|
2317
|
+
const collectFocusableElements = (root) => {
|
|
2318
|
+
// Check if current element is focusable
|
|
2319
|
+
if (root.nodeType === Node.ELEMENT_NODE) {
|
|
2320
|
+
// Check if this is a custom component that is focusable
|
|
2321
|
+
const isComponentFocusable = isFocusableComponent(root);
|
|
2322
|
+
|
|
2323
|
+
if (isComponentFocusable) {
|
|
2324
|
+
// Add the component itself as a focusable element and don't traverse its shadow DOM
|
|
2325
|
+
orderedFocusableElements.push(root);
|
|
2326
|
+
return; // Skip traversing inside this component
|
|
2327
|
+
}
|
|
2328
|
+
|
|
2329
|
+
// Check if the element itself matches any selector
|
|
2330
|
+
for (const selector of FOCUSABLE_SELECTORS) {
|
|
2331
|
+
if (root.matches?.(selector)) {
|
|
2332
|
+
orderedFocusableElements.push(root);
|
|
2333
|
+
break; // Once we know it's focusable, no need to check other selectors
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
// Process shadow DOM only for non-Auro components
|
|
2338
|
+
if (root.shadowRoot) {
|
|
2339
|
+
// Process shadow DOM children in order
|
|
2340
|
+
if (root.shadowRoot.children) {
|
|
2341
|
+
Array.from(root.shadowRoot.children).forEach(child => {
|
|
2342
|
+
collectFocusableElements(child);
|
|
2343
|
+
});
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
|
|
2347
|
+
// Process slots and their assigned nodes in order
|
|
2348
|
+
if (root.tagName === 'SLOT') {
|
|
2349
|
+
const assignedNodes = root.assignedNodes({ flatten: true });
|
|
2350
|
+
for (const node of assignedNodes) {
|
|
2351
|
+
collectFocusableElements(node);
|
|
2352
|
+
}
|
|
2353
|
+
} else {
|
|
2354
|
+
// Process light DOM children in order
|
|
2355
|
+
if (root.children) {
|
|
2356
|
+
Array.from(root.children).forEach(child => {
|
|
2357
|
+
collectFocusableElements(child);
|
|
2358
|
+
});
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
};
|
|
2363
|
+
|
|
2364
|
+
// Start the traversal from the container
|
|
2365
|
+
collectFocusableElements(container);
|
|
2366
|
+
|
|
2367
|
+
// Remove duplicates that might have been collected through different paths
|
|
2368
|
+
// while preserving order
|
|
2369
|
+
const uniqueElements = [];
|
|
2370
|
+
const seen = new Set();
|
|
2371
|
+
|
|
2372
|
+
for (const element of orderedFocusableElements) {
|
|
2373
|
+
if (!seen.has(element)) {
|
|
2374
|
+
seen.add(element);
|
|
2375
|
+
uniqueElements.push(element);
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
|
|
2379
|
+
return uniqueElements;
|
|
2380
|
+
}
|
|
2381
|
+
|
|
2382
|
+
/**
|
|
2383
|
+
* FocusTrap manages keyboard focus within a specified container element, ensuring that focus does not leave the container when tabbing.
|
|
2384
|
+
* It is commonly used for modal dialogs or overlays to improve accessibility by trapping focus within interactive UI components.
|
|
2385
|
+
*/
|
|
2386
|
+
class FocusTrap {
|
|
2387
|
+
/**
|
|
2388
|
+
* Creates a new FocusTrap instance for the given container element.
|
|
2389
|
+
* Initializes event listeners and prepares the container for focus management.
|
|
2390
|
+
*
|
|
2391
|
+
* @param {HTMLElement} container The DOM element to trap focus within.
|
|
2392
|
+
* @throws {Error} If the provided container is not a valid HTMLElement.
|
|
2393
|
+
*/
|
|
2394
|
+
constructor(container) {
|
|
2395
|
+
if (!container || !(container instanceof HTMLElement)) {
|
|
2396
|
+
throw new Error("FocusTrap requires a valid HTMLElement.");
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2399
|
+
this.container = container;
|
|
2400
|
+
this.tabDirection = 'forward'; // or 'backward'
|
|
2401
|
+
|
|
2402
|
+
this._init();
|
|
2403
|
+
}
|
|
2404
|
+
|
|
2405
|
+
/**
|
|
2406
|
+
* Initializes the focus trap by setting up event listeners and attributes on the container.
|
|
2407
|
+
* Prepares the container for focus management, including support for shadow DOM and inert attributes.
|
|
2408
|
+
*
|
|
2409
|
+
* @private
|
|
2410
|
+
*/
|
|
2411
|
+
_init() {
|
|
2412
|
+
|
|
2413
|
+
// Add inert attribute to prevent focusing programmatically as well (if supported)
|
|
2414
|
+
if ('inert' in HTMLElement.prototype) {
|
|
2415
|
+
this.container.inert = false; // Ensure the container isn't inert
|
|
2416
|
+
this.container.setAttribute('data-focus-trap-container', true); // Mark for identification
|
|
2417
|
+
}
|
|
2418
|
+
|
|
2419
|
+
// Track tab direction
|
|
2420
|
+
this.container.addEventListener('keydown', this._onKeydown);
|
|
2421
|
+
}
|
|
2422
|
+
|
|
2423
|
+
/**
|
|
2424
|
+
* Handles keydown events to manage tab navigation within the container.
|
|
2425
|
+
* Ensures that focus wraps around when reaching the first or last focusable element.
|
|
2426
|
+
*
|
|
2427
|
+
* @param {KeyboardEvent} e The keyboard event triggered by user interaction.
|
|
2428
|
+
* @private
|
|
2429
|
+
*/
|
|
2430
|
+
_onKeydown = (e) => {
|
|
2431
|
+
|
|
2432
|
+
if (e.key === 'Tab') {
|
|
2433
|
+
|
|
2434
|
+
// Set the tab direction based on the key pressed
|
|
2435
|
+
this.tabDirection = e.shiftKey ? 'backward' : 'forward';
|
|
2436
|
+
|
|
2437
|
+
// Get the active element(s) in the document and shadow root
|
|
2438
|
+
// This will include the active element in the shadow DOM if it exists
|
|
2439
|
+
// Active element may be inside the shadow DOM depending on delegatesFocus, so we need to check both
|
|
2440
|
+
let activeElement = document.activeElement;
|
|
2441
|
+
const actives = [activeElement];
|
|
2442
|
+
while (activeElement?.shadowRoot?.activeElement) {
|
|
2443
|
+
actives.push(activeElement.shadowRoot.activeElement);
|
|
2444
|
+
activeElement = activeElement.shadowRoot.activeElement;
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
// Update the focusable elements
|
|
2448
|
+
const focusables = this._getFocusableElements();
|
|
2449
|
+
|
|
2450
|
+
// If we're at either end of the focusable elements, wrap around to the other end
|
|
2451
|
+
const focusIndex =
|
|
2452
|
+
(actives.includes(focusables[0]) || actives.includes(this.container)) && this.tabDirection === 'backward'
|
|
2453
|
+
? focusables.length - 1
|
|
2454
|
+
: actives.includes(focusables[focusables.length - 1]) && this.tabDirection === 'forward'
|
|
2455
|
+
? 0
|
|
2456
|
+
: null;
|
|
2457
|
+
|
|
2458
|
+
if (focusIndex !== null) {
|
|
2459
|
+
focusables[focusIndex].focus();
|
|
2460
|
+
e.preventDefault(); // Prevent default tab behavior
|
|
2461
|
+
e.stopPropagation(); // Stop the event from bubbling up
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
};
|
|
2465
|
+
|
|
2466
|
+
/**
|
|
2467
|
+
* Retrieves all focusable elements within the container in DOM order, including those in shadow DOM and slots.
|
|
2468
|
+
* Returns a unique, ordered array of elements that can receive focus.
|
|
2469
|
+
*
|
|
2470
|
+
* @returns {Array<HTMLElement>} An array of focusable elements within the container.
|
|
2471
|
+
* @private
|
|
2472
|
+
*/
|
|
2473
|
+
_getFocusableElements() {
|
|
2474
|
+
// Use the imported utility function to get focusable elements
|
|
2475
|
+
const elements = getFocusableElements(this.container);
|
|
2476
|
+
|
|
2477
|
+
// Filter out any elements with the 'focus-bookend' class
|
|
2478
|
+
return elements;
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
/**
|
|
2482
|
+
* Moves focus to the first focusable element within the container.
|
|
2483
|
+
* Useful for setting initial focus when activating the focus trap.
|
|
2484
|
+
*/
|
|
2485
|
+
focusFirstElement() {
|
|
2486
|
+
const focusables = this._getFocusableElements();
|
|
2487
|
+
if (focusables.length) focusables[0].focus();
|
|
2488
|
+
}
|
|
2489
|
+
|
|
2490
|
+
/**
|
|
2491
|
+
* Moves focus to the last focusable element within the container.
|
|
2492
|
+
* Useful for setting focus when deactivating or cycling focus in reverse.
|
|
2493
|
+
*/
|
|
2494
|
+
focusLastElement() {
|
|
2495
|
+
const focusables = this._getFocusableElements();
|
|
2496
|
+
if (focusables.length) focusables[focusables.length - 1].focus();
|
|
2497
|
+
}
|
|
2498
|
+
|
|
2499
|
+
/**
|
|
2500
|
+
* Removes event listeners and attributes added by the focus trap.
|
|
2501
|
+
* Call this method to clean up when the focus trap is no longer needed.
|
|
2502
|
+
*/
|
|
2503
|
+
disconnect() {
|
|
2504
|
+
|
|
2505
|
+
if (this.container.hasAttribute('data-focus-trap-container')) {
|
|
2506
|
+
this.container.removeAttribute('data-focus-trap-container');
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2509
|
+
this.container.removeEventListener('keydown', this._onKeydown);
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
|
|
2243
2513
|
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
2244
2514
|
// See LICENSE in the project root for license information.
|
|
2245
2515
|
|
|
@@ -2346,7 +2616,7 @@ const cacheFetch = (uri, options = {}) => {
|
|
|
2346
2616
|
return _fetchMap.get(uri);
|
|
2347
2617
|
};
|
|
2348
2618
|
|
|
2349
|
-
var styleCss$
|
|
2619
|
+
var styleCss$3 = css`:focus:not(:focus-visible){outline:3px solid transparent}.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock,:host{display:block}.util_displayFlex{display:flex}.util_displayHidden,:host([hidden]:not(:focus):not(:active)){display:none}.util_displayHiddenVisually,:host([hiddenVisually]:not(:focus):not(:active)){position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}.ico_squareLarge{fill:currentColor;height:var(--auro-size-lg, var(--ds-size-300, 1.5rem))}.ico_squareSmall{fill:currentColor;height:.6rem}.ico_squareMed{fill:currentColor;height:var(--auro-size-md, var(--ds-size-200, 1rem))}.ico_squareSml{fill:currentColor;height:var(--auro-size-sm, var(--ds-size-150, 0.75rem))}:host{color:currentColor;vertical-align:middle;line-height:1;display:inline-block}svg{min-width:var(--ds-auro-icon-size, 1.5rem) !important;width:var(--ds-auro-icon-size, 1.5rem) !important;height:var(--ds-auro-icon-size, 1.5rem) !important}.componentWrapper{display:flex}.svgWrapper{height:var(--ds-auro-icon-size);width:var(--ds-auro-icon-size)}.labelWrapper{margin-left:var(--ds-size-50, 0.25rem);line-height:1.8}`;
|
|
2350
2620
|
|
|
2351
2621
|
// Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
2352
2622
|
// See LICENSE in the project root for license information.
|
|
@@ -2389,7 +2659,7 @@ class BaseIcon extends AuroElement$1 {
|
|
|
2389
2659
|
|
|
2390
2660
|
static get styles() {
|
|
2391
2661
|
return css`
|
|
2392
|
-
${styleCss$
|
|
2662
|
+
${styleCss$3}
|
|
2393
2663
|
`;
|
|
2394
2664
|
}
|
|
2395
2665
|
|
|
@@ -2591,7 +2861,7 @@ class AuroIcon extends BaseIcon {
|
|
|
2591
2861
|
return [
|
|
2592
2862
|
super.styles,
|
|
2593
2863
|
css`${tokensCss$2}`,
|
|
2594
|
-
css`${styleCss$
|
|
2864
|
+
css`${styleCss$3}`,
|
|
2595
2865
|
css`${colorCss$3}`
|
|
2596
2866
|
];
|
|
2597
2867
|
}
|
|
@@ -2626,8 +2896,12 @@ class AuroIcon extends BaseIcon {
|
|
|
2626
2896
|
async firstUpdated() {
|
|
2627
2897
|
await super.firstUpdated();
|
|
2628
2898
|
|
|
2629
|
-
|
|
2630
|
-
|
|
2899
|
+
/**
|
|
2900
|
+
* icons provide a description for screen readers. Icon only instances Auro-button
|
|
2901
|
+
* depend on this description to provide context for the user using a screen reader.
|
|
2902
|
+
* Removes the SVG description for screen reader if ariaHidden is set to true.
|
|
2903
|
+
*/
|
|
2904
|
+
if (this.hasAttribute('ariaHidden') && this.svg) {
|
|
2631
2905
|
const svgDesc = this.svg.querySelector('desc');
|
|
2632
2906
|
|
|
2633
2907
|
if (svgDesc) {
|
|
@@ -2673,11 +2947,11 @@ class AuroIcon extends BaseIcon {
|
|
|
2673
2947
|
|
|
2674
2948
|
var iconVersion = '6.1.2';
|
|
2675
2949
|
|
|
2676
|
-
var styleCss$
|
|
2950
|
+
var styleCss$2 = css`:host{position:fixed;z-index:var(--depth-tooltip, 400);display:none;isolation:isolate}:host(:not([matchWidth])) .container{min-width:fit-content}:host([isfullscreen]){position:fixed;top:0;left:0}:host([isfullscreen]) .container{width:100dvw;max-width:none;height:100dvh;max-height:none;border-radius:unset;margin-top:0;box-shadow:unset;overscroll-behavior:contain}:host([data-show]){display:flex}:host([common]:not([isfullscreen])) .container,:host([rounded]:not([isfullscreen])) .container{border-radius:var(--ds-border-radius, 0.375rem)}:host([common][isfullscreen]) .container,:host([rounded][isfullscreen]) .container{border-radius:unset;box-shadow:unset}:host(:not([isfullscreen])) .container.shape-box{border-radius:unset}:host(:not([isfullscreen])) .container[class*=shape-pill],:host(:not([isfullscreen])) .container[class*=shape-snowflake]{border-radius:30px}.container{display:inline-block;overflow:auto;box-sizing:border-box;border-radius:var(--ds-border-radius, 0.375rem);margin:var(--ds-size-50, 0.25rem) 0}`;
|
|
2677
2951
|
|
|
2678
2952
|
var colorCss$2 = css`.container{background-color:var(--ds-auro-dropdownbib-container-color);box-shadow:var(--ds-auro-dropdownbib-boxshadow-color);color:var(--ds-auro-dropdownbib-text-color)}`;
|
|
2679
2953
|
|
|
2680
|
-
var tokensCss$1 = css`:host(:not([ondark])){--ds-auro-dropdown-label-text-color: var(--ds-basic-color-texticon-muted, #676767);--ds-auro-dropdown-trigger-background-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-dropdown-trigger-container-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-dropdown-trigger-border-color:
|
|
2954
|
+
var tokensCss$1 = css`:host(:not([ondark])){--ds-auro-dropdown-label-text-color: var(--ds-basic-color-texticon-muted, #676767);--ds-auro-dropdown-trigger-background-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-dropdown-trigger-container-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-dropdown-trigger-border-color: var(--ds-basic-color-border-bold, #585e67);--ds-auro-dropdown-trigger-outline-color: transparent;--ds-auro-dropdown-trigger-text-color: var(--ds-basic-color-texticon-default, #2a2a2a);--ds-auro-dropdownbib-boxshadow-color: var(--ds-elevation-200, 0px 0px 10px rgba(0, 0, 0, 0.15));--ds-auro-dropdownbib-background-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-dropdownbib-container-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-dropdownbib-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}:host([ondark]){--ds-auro-dropdown-label-text-color: var(--ds-basic-color-texticon-inverse-muted, #ccd2db);--ds-auro-dropdown-trigger-background-color: var(--ds-advanced-color-shared-background-inverse, rgba(255, 255, 255, 0.15));--ds-auro-dropdown-trigger-container-color: var(--ds-advanced-color-shared-background-inverse, rgba(255, 255, 255, 0.15));--ds-auro-dropdown-trigger-border-color: var(--ds-basic-color-border-inverse, #ffffff);--ds-auro-dropdown-trigger-outline-color: transparent;--ds-auro-dropdown-trigger-text-color: var(--ds-basic-color-texticon-inverse, #ffffff);--ds-auro-dropdownbib-boxshadow-color: var(--ds-elevation-200, 0px 0px 10px rgba(0, 0, 0, 0.15));--ds-auro-dropdownbib-background-color: var(--ds-advanced-color-shared-background-inverse, rgba(255, 255, 255, 0.15));--ds-auro-dropdownbib-container-color: var(--ds-advanced-color-shared-background-inverse, rgba(255, 255, 255, 0.15));--ds-auro-dropdownbib-text-color: var(--ds-basic-color-texticon-inverse, #ffffff)}`;
|
|
2681
2955
|
|
|
2682
2956
|
// Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
2683
2957
|
// See LICENSE in the project root for license information.
|
|
@@ -2698,7 +2972,7 @@ const DESIGN_TOKEN_BREAKPOINT_OPTIONS = [
|
|
|
2698
2972
|
*/
|
|
2699
2973
|
|
|
2700
2974
|
class AuroDropdownBib extends LitElement {
|
|
2701
|
-
|
|
2975
|
+
// not extending AuroElement because Bib needs only `shape` prop
|
|
2702
2976
|
constructor() {
|
|
2703
2977
|
super();
|
|
2704
2978
|
|
|
@@ -2708,11 +2982,14 @@ class AuroDropdownBib extends LitElement {
|
|
|
2708
2982
|
this._mobileBreakpointValue = undefined;
|
|
2709
2983
|
|
|
2710
2984
|
AuroLibraryRuntimeUtils$2.prototype.handleComponentTagRename(this, 'auro-dropdownbib');
|
|
2985
|
+
|
|
2986
|
+
this.shape = "rounded";
|
|
2987
|
+
this.matchWidth = false;
|
|
2711
2988
|
}
|
|
2712
2989
|
|
|
2713
2990
|
static get styles() {
|
|
2714
2991
|
return [
|
|
2715
|
-
styleCss$
|
|
2992
|
+
styleCss$2,
|
|
2716
2993
|
colorCss$2,
|
|
2717
2994
|
tokensCss$1
|
|
2718
2995
|
];
|
|
@@ -2745,6 +3022,15 @@ class AuroDropdownBib extends LitElement {
|
|
|
2745
3022
|
reflect: true
|
|
2746
3023
|
},
|
|
2747
3024
|
|
|
3025
|
+
/**
|
|
3026
|
+
* If declared, the bib width will match the trigger width.
|
|
3027
|
+
* @private
|
|
3028
|
+
*/
|
|
3029
|
+
matchWidth: {
|
|
3030
|
+
type: Boolean,
|
|
3031
|
+
reflect: true
|
|
3032
|
+
},
|
|
3033
|
+
|
|
2748
3034
|
/**
|
|
2749
3035
|
* If declared, will apply border-radius to the bib.
|
|
2750
3036
|
*/
|
|
@@ -2758,6 +3044,11 @@ class AuroDropdownBib extends LitElement {
|
|
|
2758
3044
|
*/
|
|
2759
3045
|
bibTemplate: {
|
|
2760
3046
|
type: Object
|
|
3047
|
+
},
|
|
3048
|
+
|
|
3049
|
+
shape: {
|
|
3050
|
+
type: String,
|
|
3051
|
+
reflect: true
|
|
2761
3052
|
}
|
|
2762
3053
|
};
|
|
2763
3054
|
}
|
|
@@ -2837,8 +3128,16 @@ class AuroDropdownBib extends LitElement {
|
|
|
2837
3128
|
|
|
2838
3129
|
// function that renders the HTML and CSS into the scope of the component
|
|
2839
3130
|
render() {
|
|
3131
|
+
const classes = {
|
|
3132
|
+
container: true
|
|
3133
|
+
};
|
|
3134
|
+
|
|
3135
|
+
// Since this class does not inherit from AuroElement, we apply the shape-related class within the `render` function,
|
|
3136
|
+
// mimicking the class naming convention used in AuroElement.resetShapeClasses.
|
|
3137
|
+
classes[`shape-${this.shape}`] = true;
|
|
3138
|
+
|
|
2840
3139
|
return html$1`
|
|
2841
|
-
<div class="
|
|
3140
|
+
<div class="${classMap(classes)}" part="bibContainer">
|
|
2842
3141
|
<slot></slot>
|
|
2843
3142
|
</div>
|
|
2844
3143
|
`;
|
|
@@ -2847,21 +3146,23 @@ class AuroDropdownBib extends LitElement {
|
|
|
2847
3146
|
|
|
2848
3147
|
var dropdownVersion = '3.0.0';
|
|
2849
3148
|
|
|
2850
|
-
var shapeSizeCss = css`.wrapper{overflow:hidden}.shape-classic-xl,.shape-classic-lg,.shape-classic-md,.shape-classic-sm,.shape-classic-xs{min-height:58px;max-height:58px;border-style:solid;border-width:1px;border-radius:var(--ds-border-radius, 0.375rem)}.shape-classic-xl.simple,.shape-classic-lg.simple,.shape-classic-md.simple,.shape-classic-sm.simple,.shape-classic-xs.simple{border-width:0px;min-height:60px;max-height:60px;background-color:unset}.shape-classic-xl.thin,.shape-classic-lg.thin,.shape-classic-md.thin,.shape-classic-sm.thin,.shape-classic-xs.thin{border-width:1px;min-height:58px;max-height:58px;background-color:unset}.shape-classic-xl.parentBorder,.shape-classic-lg.parentBorder,.shape-classic-md.parentBorder,.shape-classic-sm.parentBorder,.shape-classic-xs.parentBorder{border:0;min-height:56px;max-height:56px}.shape-snowflake-xl,.shape-snowflake-lg,.shape-snowflake-md,.shape-snowflake-sm,.shape-snowflake-xs{min-height:56px;max-height:56px;border-style:solid;border-width:2px;border-color:transparent;border-radius:30px}.shape-snowflake-xl.simple,.shape-snowflake-lg.simple,.shape-snowflake-md.simple,.shape-snowflake-sm.simple,.shape-snowflake-xs.simple{border-width:0px;min-height:60px;max-height:60px;background-color:unset}.shape-snowflake-xl.thin,.shape-snowflake-lg.thin,.shape-snowflake-md.thin,.shape-snowflake-sm.thin,.shape-snowflake-xs.thin{border-width:1px;min-height:58px;max-height:58px;background-color:unset}.shape-snowflake-xl.parentBorder,.shape-snowflake-lg.parentBorder,.shape-snowflake-md.parentBorder,.shape-snowflake-sm.parentBorder,.shape-snowflake-xs.parentBorder{border:0;min-height:56px;max-height:56px}.shape-box-xl{min-height:68px;max-height:68px;border-style:solid;border-width:2px;border-color:transparent}.shape-box-xl.simple{border-width:0px;min-height:72px;max-height:72px;background-color:unset}.shape-box-xl.thin{border-width:1px;min-height:70px;max-height:70px;background-color:unset}.shape-box-xl.parentBorder{border:0;min-height:68px;max-height:68px}.shape-rounded-lg{min-height:56px;max-height:56px;border-style:solid;border-width:2px;border-color:transparent;border-radius:6px}.shape-rounded-lg.simple{border-width:0px;min-height:56px;max-height:56px;background-color:unset}.shape-rounded-lg.thin{border-width:1px;min-height:54px;max-height:54px;background-color:unset}.shape-rounded-lg.parentBorder{border:0;min-height:52px;max-height:52px}.shape-pill-xl{min-height:68px;max-height:68px;border-style:solid;border-width:2px;border-color:transparent;border-radius:36px}.shape-pill-xl.simple{border-width:0px;min-height:72px;max-height:72px;background-color:unset}.shape-pill-xl.thin{border-width:1px;min-height:70px;max-height:70px;background-color:unset}.shape-pill-xl.parentBorder{border:0;min-height:68px;max-height:68px}.shape-pill-left-xl{min-height:
|
|
3149
|
+
var shapeSizeCss = css`.wrapper{overflow:hidden}.shape-classic-xl,.shape-classic-lg,.shape-classic-md,.shape-classic-sm,.shape-classic-xs{min-height:58px;max-height:58px;border-style:solid;border-width:1px;border-radius:var(--ds-border-radius, 0.375rem)}.shape-classic-xl.simple,.shape-classic-lg.simple,.shape-classic-md.simple,.shape-classic-sm.simple,.shape-classic-xs.simple{border-width:0px;min-height:60px;max-height:60px;background-color:unset;box-shadow:none}.shape-classic-xl.thin,.shape-classic-lg.thin,.shape-classic-md.thin,.shape-classic-sm.thin,.shape-classic-xs.thin{border-width:1px;min-height:58px;max-height:58px;background-color:unset}.shape-classic-xl.parentBorder,.shape-classic-lg.parentBorder,.shape-classic-md.parentBorder,.shape-classic-sm.parentBorder,.shape-classic-xs.parentBorder{border:0;box-shadow:unset;min-height:56px;max-height:56px}.shape-snowflake-xl,.shape-snowflake-lg,.shape-snowflake-md,.shape-snowflake-sm,.shape-snowflake-xs{min-height:56px;max-height:56px;border-style:solid;border-width:2px;border-color:transparent;border-radius:30px}.shape-snowflake-xl.simple,.shape-snowflake-lg.simple,.shape-snowflake-md.simple,.shape-snowflake-sm.simple,.shape-snowflake-xs.simple{border-width:0px;min-height:60px;max-height:60px;background-color:unset;box-shadow:none}.shape-snowflake-xl.thin,.shape-snowflake-lg.thin,.shape-snowflake-md.thin,.shape-snowflake-sm.thin,.shape-snowflake-xs.thin{border-width:1px;min-height:58px;max-height:58px;background-color:unset}.shape-snowflake-xl.parentBorder,.shape-snowflake-lg.parentBorder,.shape-snowflake-md.parentBorder,.shape-snowflake-sm.parentBorder,.shape-snowflake-xs.parentBorder{border:0;box-shadow:unset;min-height:56px;max-height:56px}.shape-box-xl{min-height:68px;max-height:68px;border-style:solid;border-width:2px;border-color:transparent}.shape-box-xl.simple{border-width:0px;min-height:72px;max-height:72px;background-color:unset;box-shadow:none}.shape-box-xl.thin{border-width:1px;min-height:70px;max-height:70px;background-color:unset}.shape-box-xl.parentBorder{border:0;box-shadow:unset;min-height:68px;max-height:68px}.shape-rounded-lg{min-height:56px;max-height:56px;border-style:solid;border-width:2px;border-color:transparent;border-radius:6px}.shape-rounded-lg.simple{border-width:0px;min-height:56px;max-height:56px;background-color:unset;box-shadow:none}.shape-rounded-lg.thin{border-width:1px;min-height:54px;max-height:54px;background-color:unset}.shape-rounded-lg.parentBorder{border:0;box-shadow:unset;min-height:52px;max-height:52px}.shape-pill-xl{min-height:68px;max-height:68px;border-style:solid;border-width:2px;border-color:transparent;border-radius:36px}.shape-pill-xl.simple{border-width:0px;min-height:72px;max-height:72px;background-color:unset;box-shadow:none}.shape-pill-xl.thin{border-width:1px;min-height:70px;max-height:70px;background-color:unset}.shape-pill-xl.parentBorder{border:0;box-shadow:unset;min-height:68px;max-height:68px}.shape-pill-left-xl{min-height:68px;max-height:68px;border-style:solid;border-width:2px;border-color:transparent;border-radius:36px 0 0 36px}.shape-pill-left-xl.simple{border-width:0px;min-height:72px;max-height:72px;background-color:unset;box-shadow:none}.shape-pill-left-xl.thin{border-width:1px;min-height:70px;max-height:70px;background-color:unset}.shape-pill-left-xl.parentBorder{border:0;box-shadow:unset;min-height:68px;max-height:68px}.shape-pill-right-xl{min-height:68px;max-height:68px;border-style:solid;border-width:2px;border-color:transparent;border-radius:0 36px 36px 0}.shape-pill-right-xl.simple{border-width:0px;min-height:72px;max-height:72px;background-color:unset;box-shadow:none}.shape-pill-right-xl.thin{border-width:1px;min-height:70px;max-height:70px;background-color:unset}.shape-pill-right-xl.parentBorder{border:0;box-shadow:unset;min-height:68px;max-height:68px}.shape-pill-md{min-height:44px;max-height:44px;border-style:solid;border-width:2px;border-color:transparent;border-radius:36px}.shape-pill-md.simple{border-width:0px;min-height:48px;max-height:48px;background-color:unset;box-shadow:none}.shape-pill-md.thin{border-width:1px;min-height:46px;max-height:46px;background-color:unset}.shape-pill-md.parentBorder{border:0;box-shadow:unset;min-height:44px;max-height:44px}.shape-pill-left-md{min-height:44px;max-height:44px;border-style:solid;border-width:2px;border-color:transparent;border-radius:36px 0 0 36px}.shape-pill-left-md.simple{border-width:0px;min-height:48px;max-height:48px;background-color:unset;box-shadow:none}.shape-pill-left-md.thin{border-width:1px;min-height:46px;max-height:46px;background-color:unset}.shape-pill-left-md.parentBorder{border:0;box-shadow:unset;min-height:44px;max-height:44px}.shape-pill-right-md{min-height:44px;max-height:44px;border-style:solid;border-width:2px;border-color:transparent;border-radius:0 36px 36px 0}.shape-pill-right-md.simple{border-width:0px;min-height:48px;max-height:48px;background-color:unset;box-shadow:none}.shape-pill-right-md.thin{border-width:1px;min-height:46px;max-height:46px;background-color:unset}.shape-pill-right-md.parentBorder{border:0;box-shadow:unset;min-height:44px;max-height:44px}`;
|
|
2851
3150
|
|
|
2852
|
-
var colorCss$1 = css`:host .wrapper{border-color:var(--ds-auro-dropdown-trigger-border-color);background-color:var(--ds-auro-dropdown-trigger-background-color);color:var(--ds-auro-dropdown-trigger-text-color)}:host(:not([ondark])) .wrapper:focus,:host(:not([ondark])) .wrapper:
|
|
3151
|
+
var colorCss$1 = css`:host(:not([layout*=classic])){--ds-auro-dropdown-trigger-border-color: transparent}:host(:not([ondark])) .wrapper{border-color:var(--ds-auro-dropdown-trigger-border-color);background-color:var(--ds-auro-dropdown-trigger-background-color);color:var(--ds-auro-dropdown-trigger-text-color)}:host(:not([ondark])) .wrapper:focus-within,:host(:not([ondark])) .wrapper:active{--ds-auro-dropdown-trigger-border-color: var(--ds-advanced-color-state-focused, #01426a);--ds-auro-dropdown-trigger-outline-color: var(--ds-advanced-color-state-focused, #01426a)}:host(:not([onDark])[disabled]){--ds-auro-dropdown-trigger-text-color: var(--ds-basic-color-texticon-disabled, #d0d0d0);--ds-auro-dropdown-label-text-color: var(--ds-basic-color-texticon-disabled, #d0d0d0);--ds-auro-dropdown-trigger-border-color: var(--ds-basic-color-border-subtle, #dddddd)}:host(:not([ondark])[error]){--ds-auro-dropdown-trigger-border-color: var(--ds-basic-color-status-error, #e31f26)}:host([onDark]) .label{color:var(--ds-auro-dropdown-label-text-color)}:host([onDark]) .wrapper{border-color:var(--ds-auro-dropdown-trigger-border-color);background-color:var(--ds-auro-dropdown-trigger-background-color);color:var(--ds-auro-dropdown-trigger-text-color)}:host([onDark]) .wrapper:focus-within,:host([onDark]) .wrapper:active{--ds-auro-dropdown-trigger-border-color: var(--ds-advanced-color-state-focused-inverse, #ffffff);--ds-auro-dropdown-trigger-outline-color: var(--ds-advanced-color-state-focused-inverse, #ffffff)}:host([onDark][disabled]){--ds-auro-dropdown-trigger-text-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894);--ds-auro-dropdown-label-text-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894);--ds-auro-dropdown-trigger-container-color: var(--ds-advanced-color-shared-background-inverse-disabled, rgba(255, 255, 255, 0.1))}:host([ondark][error]){--ds-auro-dropdown-trigger-border-color: var(--ds-basic-color-status-error-subtle, #fbc6c6)}`;
|
|
2853
3152
|
|
|
2854
|
-
var
|
|
3153
|
+
var styleCss$1 = css`:host{display:block;position:relative}:host([open]){z-index:var(--depth-tooltip, 400)}.wrapper{display:flex;flex:1;flex-direction:row;align-items:center;justify-content:center;outline:none}.triggerContentWrapper{display:flex;overflow:hidden;width:100%;flex:1;align-items:center;justify-content:center;text-overflow:ellipsis;white-space:nowrap}:host([matchwidth]) #bibSizer{width:100%}`;
|
|
2855
3154
|
|
|
2856
|
-
var
|
|
3155
|
+
var classicColorCss = css``;
|
|
2857
3156
|
|
|
2858
|
-
var
|
|
3157
|
+
var classicLayoutCss = css`:host([layout*=classic]){position:relative;max-width:100%}:host([layout*=classic]) #bibSizer{position:absolute;z-index:-1;opacity:0;pointer-events:none}:host([layout*=classic]) .label{font-size:var(--ds-text-body-size-xs, 0.75rem);line-height:var(--ds-text-body-size-default, 1rem);transition:font-size .3s cubic-bezier(0.215, 0.61, 0.355, 1);white-space:normal}:host([layout*=classic]) .label[hasTrigger=false]{font-size:var(--ds-text-body-size-default, 1rem)}:host([layout*=classic]) .wrapper{display:flex;flex-direction:row;box-shadow:inset 0 0 0 1px var(--ds-auro-dropdown-trigger-outline-color)}@media(hover: hover){:host([layout*=classic]) .wrapper:hover{cursor:pointer}}:host([layout*=classic]) .triggerContentWrapper{overflow:hidden;flex:1;justify-content:start;text-overflow:ellipsis;white-space:nowrap}:host([layout*=classic]) #showStateIcon{display:flex;overflow:hidden;height:100%;align-items:center;padding-right:var(--ds-size-150, 0.75rem)}:host([layout*=classic]) #showStateIcon [auro-icon]{height:var(--ds-size-300, 1.5rem);line-height:var(--ds-size-300, 1.5rem)}:host([layout*=classic]) #showStateIcon[data-expanded=true] [auro-icon]{transform:rotate(-180deg)}`;
|
|
2859
3158
|
|
|
2860
|
-
var
|
|
3159
|
+
var styleEmphasizedCss = css`.layout-emphasized .chevron,.layout-emphasized-left .chevron,.layout-emphasized-right .chevron{margin-right:var(--ds-size-300, 1.5rem)}:host([layout*=emphasized][shape*=pill]:not([layout*=right])) .leftIndent{width:calc(100% - var(--ds-size-300, 1.5rem));margin-left:var(--ds-size-300, 1.5rem)}:host([layout*=emphasized][shape*=pill]:not([layout*=left])) .rightIndent{width:calc(100% - var(--ds-size-300, 1.5rem));margin-right:var(--ds-size-300, 1.5rem)}:host([layout*=emphasized][shape*=pill]:not([layout*=left]):not([layout*=right])) .rightIndent{width:calc(100% - var(--ds-size-600, 3rem));margin-right:var(--ds-size-300, 1.5rem)}`;
|
|
2861
3160
|
|
|
2862
|
-
var
|
|
3161
|
+
var styleSnowflakeCss = css`:host([layout*=snowflake]) .leftIndent{width:calc(100% - var(--ds-size-600, 3rem));margin-left:var(--ds-size-300, 1.5rem)}:host([layout*=snowflake]) .rightIndent{width:calc(100% - var(--ds-size-600, 3rem));margin-right:var(--ds-size-300, 1.5rem)}.layout-snowflake .chevron,.layout-snowflake-left .chevron,.layout-snowflake-right .chevron{margin-right:var(--ds-size-300, 1.5rem)}`;
|
|
2863
3162
|
|
|
2864
|
-
var
|
|
3163
|
+
var colorCss = css`:host([error]){--ds-auro-helptext-color: var(--ds-basic-color-status-error, #e31f26)}:host([onDark]){--ds-auro-helptext-color: var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}:host([onDark][error]){--ds-auro-helptext-color: var(--ds-basic-color-status-error-subtle, #fbc6c6)}.helptext-wrapper{color:var(--ds-auro-helptext-color)}`;
|
|
3164
|
+
|
|
3165
|
+
var styleCss = css`:host{position:relative;display:block}.helptext-wrapper{display:none;font-size:12px;font-weight:450;letter-spacing:0;line-height:16px}:host([large]) .helptext-wrapper{font-size:16px;font-weight:450;letter-spacing:0;line-height:24px}.helptext-wrapper[visible]{display:block}::slotted(*:not(:empty)){margin-top:var(--ds-size-50, 0.25rem);margin-bottom:0}::slotted(p){margin-block:0}`;
|
|
2865
3166
|
|
|
2866
3167
|
var tokensCss = css`:host{--ds-auro-helptext-color: var(--ds-basic-color-texticon-muted, #676767)}`;
|
|
2867
3168
|
|
|
@@ -3102,18 +3403,21 @@ class AuroElement extends LitElement {
|
|
|
3102
3403
|
}
|
|
3103
3404
|
|
|
3104
3405
|
resetShapeClasses() {
|
|
3105
|
-
|
|
3106
|
-
const wrapper = this.shadowRoot.querySelector('.wrapper');
|
|
3406
|
+
const wrapper = this.shadowRoot.querySelector('.wrapper');
|
|
3107
3407
|
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3408
|
+
if (wrapper) {
|
|
3409
|
+
wrapper.classList.forEach((className) => {
|
|
3410
|
+
if (className.startsWith('shape-')) {
|
|
3411
|
+
wrapper.classList.remove(className);
|
|
3412
|
+
}
|
|
3413
|
+
});
|
|
3114
3414
|
|
|
3115
|
-
|
|
3116
|
-
|
|
3415
|
+
}
|
|
3416
|
+
|
|
3417
|
+
if (this.shape && this.size) {
|
|
3418
|
+
wrapper.classList.add(`shape-${this.shape.toLowerCase()}-${this.size.toLowerCase()}`);
|
|
3419
|
+
} else {
|
|
3420
|
+
wrapper.classList.add('shape-none');
|
|
3117
3421
|
}
|
|
3118
3422
|
}
|
|
3119
3423
|
|
|
@@ -3163,10 +3467,9 @@ class AuroElement extends LitElement {
|
|
|
3163
3467
|
// See LICENSE in the project root for license information.
|
|
3164
3468
|
|
|
3165
3469
|
|
|
3166
|
-
|
|
3167
|
-
|
|
3470
|
+
|
|
3471
|
+
/*
|
|
3168
3472
|
* @slot - Default slot for the popover content.
|
|
3169
|
-
* @slot label - Defines the content of the label.
|
|
3170
3473
|
* @slot helpText - Defines the content of the helpText.
|
|
3171
3474
|
* @slot trigger - Defines the content of the trigger.
|
|
3172
3475
|
* @csspart trigger - The trigger content container.
|
|
@@ -3185,23 +3488,25 @@ class AuroDropdown extends AuroElement {
|
|
|
3185
3488
|
this.matchWidth = false;
|
|
3186
3489
|
this.noHideOnThisFocusLoss = false;
|
|
3187
3490
|
|
|
3188
|
-
this.errorMessage =
|
|
3491
|
+
this.errorMessage = undefined; // TODO - check with Doug if there is still more to do here
|
|
3189
3492
|
|
|
3190
3493
|
// Layout Config
|
|
3191
|
-
this.layout =
|
|
3192
|
-
this.shape =
|
|
3193
|
-
this.size =
|
|
3494
|
+
this.layout = undefined;
|
|
3495
|
+
this.shape = undefined;
|
|
3496
|
+
this.size = undefined;
|
|
3497
|
+
|
|
3194
3498
|
this.parentBorder = false;
|
|
3195
3499
|
|
|
3196
|
-
|
|
3197
|
-
|
|
3500
|
+
/** @private */
|
|
3501
|
+
this.handleDropdownToggle = this.handleDropdownToggle.bind(this);
|
|
3198
3502
|
|
|
3199
|
-
|
|
3200
|
-
return {
|
|
3201
|
-
// 'withValue': this.value && this.value.length > 0
|
|
3202
|
-
};
|
|
3503
|
+
this.privateDefaults();
|
|
3203
3504
|
}
|
|
3204
3505
|
|
|
3506
|
+
/**
|
|
3507
|
+
* @private
|
|
3508
|
+
* @returns {object} Class definition for the wrapper element.
|
|
3509
|
+
*/
|
|
3205
3510
|
get commonWrapperClasses() {
|
|
3206
3511
|
return {
|
|
3207
3512
|
'trigger': true,
|
|
@@ -3219,13 +3524,10 @@ class AuroDropdown extends AuroElement {
|
|
|
3219
3524
|
privateDefaults() {
|
|
3220
3525
|
this.chevron = false;
|
|
3221
3526
|
this.disabled = false;
|
|
3527
|
+
this.disableFocusTrap = false;
|
|
3222
3528
|
this.error = false;
|
|
3223
|
-
this.inset = false;
|
|
3224
|
-
this.rounded = false;
|
|
3225
3529
|
this.tabIndex = 0;
|
|
3226
3530
|
this.noToggle = false;
|
|
3227
|
-
this.a11yAutocomplete = 'none';
|
|
3228
|
-
this.labeled = true;
|
|
3229
3531
|
this.a11yRole = 'button';
|
|
3230
3532
|
this.onDark = false;
|
|
3231
3533
|
this.showTriggerBorders = true;
|
|
@@ -3321,6 +3623,18 @@ class AuroDropdown extends AuroElement {
|
|
|
3321
3623
|
this.floater.showBib();
|
|
3322
3624
|
}
|
|
3323
3625
|
|
|
3626
|
+
/**
|
|
3627
|
+
* When bib is open, focus on the first element inside of bib.
|
|
3628
|
+
* If not, trigger element will get focus.
|
|
3629
|
+
*/
|
|
3630
|
+
focus() {
|
|
3631
|
+
if (this.isPopoverVisible && this.focusTrap) {
|
|
3632
|
+
this.focusTrap.focusFirstElement();
|
|
3633
|
+
} else {
|
|
3634
|
+
this.trigger.focus();
|
|
3635
|
+
}
|
|
3636
|
+
}
|
|
3637
|
+
|
|
3324
3638
|
// function to define props used within the scope of this component
|
|
3325
3639
|
static get properties() {
|
|
3326
3640
|
return {
|
|
@@ -3334,6 +3648,15 @@ class AuroDropdown extends AuroElement {
|
|
|
3334
3648
|
reflect: true
|
|
3335
3649
|
},
|
|
3336
3650
|
|
|
3651
|
+
/**
|
|
3652
|
+
* If declared, the dropdown will only show by calling the API .show() public method.
|
|
3653
|
+
* @default false
|
|
3654
|
+
*/
|
|
3655
|
+
disableEventShow: {
|
|
3656
|
+
type: Boolean,
|
|
3657
|
+
reflect: true
|
|
3658
|
+
},
|
|
3659
|
+
|
|
3337
3660
|
/**
|
|
3338
3661
|
* If declared, applies a border around the trigger slot.
|
|
3339
3662
|
*/
|
|
@@ -3352,17 +3675,17 @@ class AuroDropdown extends AuroElement {
|
|
|
3352
3675
|
},
|
|
3353
3676
|
|
|
3354
3677
|
/**
|
|
3355
|
-
* If declared, the dropdown
|
|
3678
|
+
* If declared, the dropdown is not interactive.
|
|
3356
3679
|
*/
|
|
3357
|
-
|
|
3680
|
+
disabled: {
|
|
3358
3681
|
type: Boolean,
|
|
3359
3682
|
reflect: true
|
|
3360
3683
|
},
|
|
3361
3684
|
|
|
3362
3685
|
/**
|
|
3363
|
-
* If declared, the
|
|
3686
|
+
* If declared, the focus trap inside of bib will be turned off.
|
|
3364
3687
|
*/
|
|
3365
|
-
|
|
3688
|
+
disableFocusTrap: {
|
|
3366
3689
|
type: Boolean,
|
|
3367
3690
|
reflect: true
|
|
3368
3691
|
},
|
|
@@ -3407,27 +3730,13 @@ class AuroDropdown extends AuroElement {
|
|
|
3407
3730
|
reflect: true
|
|
3408
3731
|
},
|
|
3409
3732
|
|
|
3410
|
-
/**
|
|
3411
|
-
* Makes the trigger to be full width of its parent container.
|
|
3412
|
-
*/
|
|
3413
|
-
fluid: {
|
|
3414
|
-
type: Boolean,
|
|
3415
|
-
reflect: true
|
|
3416
|
-
},
|
|
3417
|
-
|
|
3418
|
-
/**
|
|
3419
|
-
* If declared, will apply padding around trigger slot content.
|
|
3420
|
-
*/
|
|
3421
|
-
inset: {
|
|
3422
|
-
type: Boolean,
|
|
3423
|
-
reflect: true
|
|
3424
|
-
},
|
|
3425
|
-
|
|
3426
3733
|
/**
|
|
3427
3734
|
* If true, the dropdown bib is displayed.
|
|
3428
3735
|
*/
|
|
3429
3736
|
isPopoverVisible: {
|
|
3430
|
-
type: Boolean
|
|
3737
|
+
type: Boolean,
|
|
3738
|
+
reflect: true,
|
|
3739
|
+
attribute: 'open'
|
|
3431
3740
|
},
|
|
3432
3741
|
|
|
3433
3742
|
/**
|
|
@@ -3466,15 +3775,6 @@ class AuroDropdown extends AuroElement {
|
|
|
3466
3775
|
reflect: true
|
|
3467
3776
|
},
|
|
3468
3777
|
|
|
3469
|
-
/**
|
|
3470
|
-
* Defines if there is a label preset.
|
|
3471
|
-
* @private
|
|
3472
|
-
*/
|
|
3473
|
-
labeled: {
|
|
3474
|
-
type: Boolean,
|
|
3475
|
-
reflect: true
|
|
3476
|
-
},
|
|
3477
|
-
|
|
3478
3778
|
/**
|
|
3479
3779
|
* Defines if the trigger should size based on the parent element providing the border UI.
|
|
3480
3780
|
* @private
|
|
@@ -3535,6 +3835,9 @@ class AuroDropdown extends AuroElement {
|
|
|
3535
3835
|
reflect: true
|
|
3536
3836
|
},
|
|
3537
3837
|
|
|
3838
|
+
/**
|
|
3839
|
+
* If declared, and a function is set, that function will execute when the slot content is updated.
|
|
3840
|
+
*/
|
|
3538
3841
|
onSlotChange: {
|
|
3539
3842
|
type: Function,
|
|
3540
3843
|
reflect: false
|
|
@@ -3549,14 +3852,6 @@ class AuroDropdown extends AuroElement {
|
|
|
3549
3852
|
reflect: true
|
|
3550
3853
|
},
|
|
3551
3854
|
|
|
3552
|
-
/**
|
|
3553
|
-
* If declared, will apply border-radius to trigger and default slots.
|
|
3554
|
-
*/
|
|
3555
|
-
rounded: {
|
|
3556
|
-
type: Boolean,
|
|
3557
|
-
reflect: true
|
|
3558
|
-
},
|
|
3559
|
-
|
|
3560
3855
|
/**
|
|
3561
3856
|
* @private
|
|
3562
3857
|
*/
|
|
@@ -3571,22 +3866,15 @@ class AuroDropdown extends AuroElement {
|
|
|
3571
3866
|
type: String || undefined,
|
|
3572
3867
|
attribute: false,
|
|
3573
3868
|
reflect: false
|
|
3574
|
-
},
|
|
3575
|
-
|
|
3576
|
-
/**
|
|
3577
|
-
* The value for the aria-autocomplete attribute of the trigger element.
|
|
3578
|
-
*/
|
|
3579
|
-
a11yAutocomplete: {
|
|
3580
|
-
type: String,
|
|
3581
|
-
attribute: false,
|
|
3582
3869
|
}
|
|
3583
3870
|
};
|
|
3584
3871
|
}
|
|
3585
3872
|
|
|
3586
3873
|
static get styles() {
|
|
3587
3874
|
return [
|
|
3588
|
-
|
|
3875
|
+
styleCss$1,
|
|
3589
3876
|
tokensCss$1,
|
|
3877
|
+
colorCss$1,
|
|
3590
3878
|
|
|
3591
3879
|
// default layout
|
|
3592
3880
|
classicColorCss,
|
|
@@ -3648,13 +3936,27 @@ class AuroDropdown extends AuroElement {
|
|
|
3648
3936
|
if (changedProperties.size === 0 || changedProperties.has('isPopoverVisible')) {
|
|
3649
3937
|
this.handleTriggerContentSlotChange();
|
|
3650
3938
|
}
|
|
3939
|
+
}
|
|
3651
3940
|
|
|
3941
|
+
/**
|
|
3942
|
+
* Handles the custom event `auroDropdown-toggled` to update the visibility of the dropdown bib.
|
|
3943
|
+
* @private
|
|
3944
|
+
* @param {CustomEvent} event - The custom event that contains the dropdown toggle information.
|
|
3945
|
+
*/
|
|
3946
|
+
handleDropdownToggle(event) {
|
|
3947
|
+
this.updateFocusTrap();
|
|
3948
|
+
this.isPopoverVisible = event.detail.expanded;
|
|
3949
|
+
const eventType = event.detail.eventType || "unknown";
|
|
3950
|
+
if (!this.isPopoverVisible && this.hasFocus && eventType === "keydown") {
|
|
3951
|
+
this.trigger.focus();
|
|
3952
|
+
}
|
|
3652
3953
|
}
|
|
3653
3954
|
|
|
3654
3955
|
firstUpdated() {
|
|
3655
3956
|
|
|
3656
3957
|
// Configure the floater to, this will generate the ID for the bib
|
|
3657
3958
|
this.floater.configure(this, 'auroDropdown');
|
|
3959
|
+
this.addEventListener('auroDropdown-toggled', this.handleDropdownToggle);
|
|
3658
3960
|
|
|
3659
3961
|
/**
|
|
3660
3962
|
* @description Let subscribers know that the dropdown ID ha been generated and added.
|
|
@@ -3672,6 +3974,13 @@ class AuroDropdown extends AuroElement {
|
|
|
3672
3974
|
|
|
3673
3975
|
// Add the tag name as an attribute if it is different than the component name
|
|
3674
3976
|
this.runtimeUtils.handleComponentTagRename(this, 'auro-dropdown');
|
|
3977
|
+
|
|
3978
|
+
this.trigger.addEventListener('click', () => {
|
|
3979
|
+
this.dispatchEvent(new CustomEvent('auroDropdown-triggerClick', {
|
|
3980
|
+
bubbles: true,
|
|
3981
|
+
composed: true
|
|
3982
|
+
}));
|
|
3983
|
+
});
|
|
3675
3984
|
}
|
|
3676
3985
|
|
|
3677
3986
|
/**
|
|
@@ -3715,70 +4024,33 @@ class AuroDropdown extends AuroElement {
|
|
|
3715
4024
|
}
|
|
3716
4025
|
|
|
3717
4026
|
/**
|
|
3718
|
-
* Function to support @focusout event.
|
|
3719
4027
|
* @private
|
|
3720
|
-
* @return {void}
|
|
3721
4028
|
*/
|
|
3722
|
-
|
|
3723
|
-
|
|
4029
|
+
updateFocusTrap() {
|
|
4030
|
+
// If the dropdown is open, create a focus trap and focus the first element
|
|
4031
|
+
if (this.isPopoverVisible && !this.disableFocusTrap) {
|
|
4032
|
+
this.focusTrap = new FocusTrap(this.bibContent);
|
|
4033
|
+
this.focusTrap.focusFirstElement();
|
|
4034
|
+
return;
|
|
4035
|
+
}
|
|
4036
|
+
|
|
4037
|
+
// Guard Clause: Ensure there is a focus trap currently active before continuing
|
|
4038
|
+
if (!this.focusTrap) {
|
|
4039
|
+
return;
|
|
4040
|
+
}
|
|
4041
|
+
|
|
4042
|
+
// If the dropdown is not open, disconnect the focus trap if it exists
|
|
4043
|
+
this.focusTrap.disconnect();
|
|
4044
|
+
this.focusTrap = undefined;
|
|
3724
4045
|
}
|
|
3725
4046
|
|
|
3726
4047
|
/**
|
|
3727
|
-
*
|
|
4048
|
+
* Function to support @focusout event.
|
|
3728
4049
|
* @private
|
|
3729
|
-
* @
|
|
3730
|
-
* @returns {Boolean} - True if the element or any children are focusable.
|
|
4050
|
+
* @return {void}
|
|
3731
4051
|
*/
|
|
3732
|
-
|
|
3733
|
-
this.
|
|
3734
|
-
|
|
3735
|
-
const nodes = [
|
|
3736
|
-
element,
|
|
3737
|
-
...element.children
|
|
3738
|
-
];
|
|
3739
|
-
|
|
3740
|
-
const focusableElements = [
|
|
3741
|
-
'a',
|
|
3742
|
-
'auro-hyperlink',
|
|
3743
|
-
'button',
|
|
3744
|
-
'auro-button',
|
|
3745
|
-
'input',
|
|
3746
|
-
'auro-input',
|
|
3747
|
-
];
|
|
3748
|
-
|
|
3749
|
-
const focusableElementsThatNeedBorders = ['auro-input'];
|
|
3750
|
-
|
|
3751
|
-
const result = nodes.some((node) => {
|
|
3752
|
-
const tagName = node.tagName.toLowerCase();
|
|
3753
|
-
|
|
3754
|
-
if (node.tabIndex > -1) {
|
|
3755
|
-
return true;
|
|
3756
|
-
}
|
|
3757
|
-
|
|
3758
|
-
if (focusableElements.includes(tagName)) {
|
|
3759
|
-
if ((tagName === 'a' || tagName === 'auro-hyperlink' || node.hasAttribute('auro-hyperlink')) && node.hasAttribute('href')) {
|
|
3760
|
-
return true;
|
|
3761
|
-
}
|
|
3762
|
-
if (!node.hasAttribute('disabled')) {
|
|
3763
|
-
return true;
|
|
3764
|
-
}
|
|
3765
|
-
}
|
|
3766
|
-
|
|
3767
|
-
if (focusableElements.some((focusableElement) => focusableElement.startsWith('auro-') && (focusableElement === tagName || node.hasAttribute(focusableElement)))) {
|
|
3768
|
-
return true;
|
|
3769
|
-
}
|
|
3770
|
-
|
|
3771
|
-
return false;
|
|
3772
|
-
});
|
|
3773
|
-
|
|
3774
|
-
if (result) {
|
|
3775
|
-
this.showTriggerBorders = !nodes.some((node) => {
|
|
3776
|
-
const tagName = node.tagName.toLowerCase();
|
|
3777
|
-
return focusableElements.includes(tagName) && !focusableElementsThatNeedBorders.includes(tagName);
|
|
3778
|
-
});
|
|
3779
|
-
}
|
|
3780
|
-
|
|
3781
|
-
return result;
|
|
4052
|
+
handleFocusout() {
|
|
4053
|
+
this.hasFocus = false;
|
|
3782
4054
|
}
|
|
3783
4055
|
|
|
3784
4056
|
/**
|
|
@@ -3874,14 +4146,13 @@ class AuroDropdown extends AuroElement {
|
|
|
3874
4146
|
* @returns {void}
|
|
3875
4147
|
*/
|
|
3876
4148
|
handleTriggerContentSlotChange(event) {
|
|
3877
|
-
|
|
3878
4149
|
this.floater.handleTriggerTabIndex();
|
|
3879
4150
|
|
|
3880
4151
|
// Get the trigger
|
|
3881
4152
|
const trigger = this.shadowRoot.querySelector('#trigger');
|
|
3882
4153
|
|
|
3883
4154
|
// Get the trigger slot
|
|
3884
|
-
const triggerSlot = this.shadowRoot.querySelector('.
|
|
4155
|
+
const triggerSlot = this.shadowRoot.querySelector('.triggerContentWrapper slot');
|
|
3885
4156
|
|
|
3886
4157
|
// If there's a trigger slot
|
|
3887
4158
|
if (triggerSlot) {
|
|
@@ -3893,7 +4164,7 @@ class AuroDropdown extends AuroElement {
|
|
|
3893
4164
|
if (triggerContentNodes) {
|
|
3894
4165
|
|
|
3895
4166
|
// See if any of them are focusable elements
|
|
3896
|
-
this.triggerContentFocusable = triggerContentNodes.some((node) =>
|
|
4167
|
+
this.triggerContentFocusable = triggerContentNodes.some((node) => getFocusableElements(node).length > 0);
|
|
3897
4168
|
|
|
3898
4169
|
// If any of them are focusable elements
|
|
3899
4170
|
if (this.triggerContentFocusable) {
|
|
@@ -3944,7 +4215,6 @@ class AuroDropdown extends AuroElement {
|
|
|
3944
4215
|
*
|
|
3945
4216
|
* @private
|
|
3946
4217
|
* @method handleDefaultSlot
|
|
3947
|
-
* @param {Event} event - The event object representing the slot change.
|
|
3948
4218
|
* @fires Function#onSlotChange - Optional callback invoked when the slot content changes.
|
|
3949
4219
|
*/
|
|
3950
4220
|
handleDefaultSlot() {
|
|
@@ -3954,29 +4224,6 @@ class AuroDropdown extends AuroElement {
|
|
|
3954
4224
|
}
|
|
3955
4225
|
}
|
|
3956
4226
|
|
|
3957
|
-
/**
|
|
3958
|
-
* @private
|
|
3959
|
-
* @method handleLabelSlotChange
|
|
3960
|
-
* @param {event} event - The event object representing the slot change.
|
|
3961
|
-
* @description Handles the slot change event for the label slot.
|
|
3962
|
-
*/
|
|
3963
|
-
handleLabelSlotChange (event) {
|
|
3964
|
-
|
|
3965
|
-
// Get the nodes from the event
|
|
3966
|
-
const nodes = event.target.assignedNodes();
|
|
3967
|
-
|
|
3968
|
-
// Guard clause for no nodes
|
|
3969
|
-
if (!nodes) {
|
|
3970
|
-
return;
|
|
3971
|
-
}
|
|
3972
|
-
|
|
3973
|
-
// Convert the nodes to a measurable array so we can get the length
|
|
3974
|
-
const nodesArr = Array.from(nodes);
|
|
3975
|
-
|
|
3976
|
-
// If the nodes array has a length, the dropdown is labeled
|
|
3977
|
-
this.labeled = nodesArr.length > 0;
|
|
3978
|
-
}
|
|
3979
|
-
|
|
3980
4227
|
/**
|
|
3981
4228
|
* Returns HTML for the common portion of the layouts.
|
|
3982
4229
|
* @private
|
|
@@ -3989,24 +4236,19 @@ class AuroDropdown extends AuroElement {
|
|
|
3989
4236
|
<div
|
|
3990
4237
|
id="trigger"
|
|
3991
4238
|
class="${classMap(this.commonWrapperClasses)}" part="wrapper"
|
|
3992
|
-
tabindex="${this.tabIndex}"
|
|
4239
|
+
tabindex="${ifDefined(this.triggerContentFocusable ? undefined : this.tabIndex)}"
|
|
3993
4240
|
role="${ifDefined(this.triggerContentFocusable ? undefined : this.a11yRole)}"
|
|
3994
|
-
aria-expanded="${ifDefined(this.triggerContentFocusable ? undefined : this.isPopoverVisible)}"
|
|
3995
|
-
aria-controls="${ifDefined(this.triggerContentFocusable ? undefined : this.dropdownId)}"
|
|
4241
|
+
aria-expanded="${ifDefined(this.a11yRole === 'button' || this.triggerContentFocusable ? undefined : this.isPopoverVisible)}"
|
|
4242
|
+
aria-controls="${ifDefined(this.a11yRole === 'button' || this.triggerContentFocusable ? undefined : this.dropdownId)}"
|
|
3996
4243
|
aria-labelledby="${ifDefined(this.triggerContentFocusable ? undefined : 'triggerLabel')}"
|
|
3997
4244
|
@focusin="${this.handleFocusin}"
|
|
3998
4245
|
@blur="${this.handleFocusOut}">
|
|
3999
|
-
<div class="triggerContentWrapper">
|
|
4000
|
-
<
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
<div class="triggerContent">
|
|
4004
|
-
<slot
|
|
4005
|
-
name="trigger"
|
|
4006
|
-
@slotchange="${this.handleTriggerContentSlotChange}"></slot>
|
|
4007
|
-
</div>
|
|
4246
|
+
<div class="triggerContentWrapper" id="triggerLabel">
|
|
4247
|
+
<slot
|
|
4248
|
+
name="trigger"
|
|
4249
|
+
@slotchange="${this.handleTriggerContentSlotChange}"></slot>
|
|
4008
4250
|
</div>
|
|
4009
|
-
${this.chevron
|
|
4251
|
+
${this.chevron ? html$1`
|
|
4010
4252
|
<div
|
|
4011
4253
|
id="showStateIcon"
|
|
4012
4254
|
class="chevron"
|
|
@@ -4027,11 +4269,9 @@ class AuroDropdown extends AuroElement {
|
|
|
4027
4269
|
<div id="bibSizer" part="size"></div>
|
|
4028
4270
|
<${this.dropdownBibTag}
|
|
4029
4271
|
id="bib"
|
|
4272
|
+
shape="${this.shape}"
|
|
4030
4273
|
?data-show="${this.isPopoverVisible}"
|
|
4031
|
-
?isfullscreen="${this.isBibFullscreen}"
|
|
4032
|
-
?common="${this.common}"
|
|
4033
|
-
?rounded="${this.common || this.rounded}"
|
|
4034
|
-
?inset="${this.common || this.inset}">
|
|
4274
|
+
?isfullscreen="${this.isBibFullscreen}">
|
|
4035
4275
|
<div class="slotContent">
|
|
4036
4276
|
<slot @slotchange="${this.handleDefaultSlot}"></slot>
|
|
4037
4277
|
</div>
|
|
@@ -4046,62 +4286,13 @@ class AuroDropdown extends AuroElement {
|
|
|
4046
4286
|
* @returns {html} - Returns HTML for the classic layout.
|
|
4047
4287
|
*/
|
|
4048
4288
|
renderLayoutClassic() {
|
|
4289
|
+
// TODO: check with Doug why this was never used?
|
|
4290
|
+
const helpTextClasses = {
|
|
4291
|
+
'helpText': true
|
|
4292
|
+
};
|
|
4049
4293
|
|
|
4050
4294
|
return html$1`
|
|
4051
|
-
|
|
4052
|
-
<div
|
|
4053
|
-
id="trigger"
|
|
4054
|
-
class="trigger"
|
|
4055
|
-
part="trigger"
|
|
4056
|
-
tabindex="${this.tabIndex}"
|
|
4057
|
-
?showBorder="${this.showTriggerBorders}"
|
|
4058
|
-
role="${ifDefined(this.triggerContentFocusable ? undefined : this.a11yRole)}"
|
|
4059
|
-
aria-expanded="${ifDefined(this.triggerContentFocusable ? undefined : this.isPopoverVisible)}"
|
|
4060
|
-
aria-controls="${ifDefined(this.triggerContentFocusable ? undefined : this.dropdownId)}"
|
|
4061
|
-
aria-labelledby="${ifDefined(this.triggerContentFocusable ? undefined : 'triggerLabel')}"
|
|
4062
|
-
>
|
|
4063
|
-
<div class="triggerContentWrapper">
|
|
4064
|
-
<label class="label" id="triggerLabel" hasTrigger=${this.hasTriggerContent}>
|
|
4065
|
-
<slot name="label" @slotchange="${this.handleLabelSlotChange}"></slot>
|
|
4066
|
-
</label>
|
|
4067
|
-
<div class="triggerContent">
|
|
4068
|
-
<slot
|
|
4069
|
-
name="trigger"
|
|
4070
|
-
@slotchange="${this.handleTriggerContentSlotChange}"></slot>
|
|
4071
|
-
</div>
|
|
4072
|
-
</div>
|
|
4073
|
-
${this.chevron || this.common ? html$1`
|
|
4074
|
-
<div
|
|
4075
|
-
id="showStateIcon"
|
|
4076
|
-
part="chevron">
|
|
4077
|
-
<${this.iconTag}
|
|
4078
|
-
category="interface"
|
|
4079
|
-
name="chevron-down"
|
|
4080
|
-
?onDark="${this.onDark}"
|
|
4081
|
-
variant="${this.disabled ? 'disabled' : 'muted'}">
|
|
4082
|
-
>
|
|
4083
|
-
</${this.iconTag}>
|
|
4084
|
-
</div>
|
|
4085
|
-
` : undefined }
|
|
4086
|
-
</div>
|
|
4087
|
-
<${this.helpTextTag} part="helpText" ?onDark=${this.onDark} ?error="${this.error}">
|
|
4088
|
-
<slot name="helpText"></slot>
|
|
4089
|
-
</${this.helpTextTag}>
|
|
4090
|
-
|
|
4091
|
-
<div id="bibSizer" part="size"></div>
|
|
4092
|
-
<${this.dropdownBibTag}
|
|
4093
|
-
id="bib"
|
|
4094
|
-
?data-show="${this.isPopoverVisible}"
|
|
4095
|
-
?isfullscreen="${this.isBibFullscreen}"
|
|
4096
|
-
?common="${this.common}"
|
|
4097
|
-
?rounded="${this.common || this.rounded}"
|
|
4098
|
-
?inset="${this.common || this.inset}"
|
|
4099
|
-
>
|
|
4100
|
-
<div class="slotContent">
|
|
4101
|
-
<slot @slotchange="${this.handleDefaultSlot}"></slot>
|
|
4102
|
-
</div>
|
|
4103
|
-
</${this.dropdownBibTag}>
|
|
4104
|
-
</div>
|
|
4295
|
+
${this.renderBasicHtml(helpTextClasses)}
|
|
4105
4296
|
`;
|
|
4106
4297
|
}
|
|
4107
4298
|
|