@aurodesignsystem-dev/auro-formkit 0.0.0-pr1422.2 → 0.0.0-pr1424.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -2
- package/README.md +183 -133
- package/components/checkbox/demo/api.min.js +1 -1
- package/components/checkbox/demo/index.min.js +1 -1
- package/components/checkbox/dist/index.js +1 -1
- package/components/checkbox/dist/registered.js +1 -1
- package/components/combobox/demo/api.min.js +165 -276
- package/components/combobox/demo/index.min.js +165 -276
- package/components/combobox/dist/index.js +165 -276
- package/components/combobox/dist/registered.js +165 -276
- package/components/counter/demo/api.min.js +164 -275
- package/components/counter/demo/index.min.js +164 -275
- package/components/counter/dist/index.js +164 -275
- package/components/counter/dist/registered.js +164 -275
- package/components/datepicker/demo/api.min.js +165 -276
- package/components/datepicker/demo/index.min.js +165 -276
- package/components/datepicker/dist/index.js +165 -276
- package/components/datepicker/dist/registered.js +165 -276
- package/components/dropdown/demo/api.min.js +164 -275
- package/components/dropdown/demo/index.min.js +164 -275
- package/components/dropdown/dist/index.js +164 -275
- package/components/dropdown/dist/registered.js +164 -275
- package/components/form/demo/api.md +460 -76
- package/components/form/demo/api.min.js +661 -1105
- package/components/form/demo/index.min.js +661 -1105
- package/components/input/demo/api.min.js +1 -1
- package/components/input/demo/index.min.js +1 -1
- package/components/input/dist/index.js +1 -1
- package/components/input/dist/registered.js +1 -1
- package/components/radio/demo/api.min.js +1 -1
- package/components/radio/demo/index.min.js +1 -1
- package/components/radio/dist/index.js +1 -1
- package/components/radio/dist/registered.js +1 -1
- package/components/select/demo/api.min.js +164 -275
- package/components/select/demo/index.min.js +164 -275
- package/components/select/dist/index.js +164 -275
- package/components/select/dist/registered.js +164 -275
- package/package.json +3 -3
|
@@ -1964,19 +1964,11 @@ class AuroFloatingUI {
|
|
|
1964
1964
|
* This ensures that the bib content has the same dimensions as the sizer element.
|
|
1965
1965
|
*/
|
|
1966
1966
|
mirrorSize() {
|
|
1967
|
-
const element = this.element;
|
|
1968
|
-
if (!element) {
|
|
1969
|
-
return;
|
|
1970
|
-
}
|
|
1971
|
-
|
|
1972
1967
|
// mirror the boxsize from bibSizer
|
|
1973
|
-
if (element.bibSizer && element.matchWidth
|
|
1974
|
-
const sizerStyle = window.getComputedStyle(element.bibSizer);
|
|
1975
|
-
const bibContent =
|
|
1976
|
-
|
|
1977
|
-
return;
|
|
1978
|
-
}
|
|
1979
|
-
|
|
1968
|
+
if (this.element.bibSizer && this.element.matchWidth) {
|
|
1969
|
+
const sizerStyle = window.getComputedStyle(this.element.bibSizer);
|
|
1970
|
+
const bibContent =
|
|
1971
|
+
this.element.bib.shadowRoot.querySelector(".container");
|
|
1980
1972
|
if (sizerStyle.width !== "0px") {
|
|
1981
1973
|
bibContent.style.width = sizerStyle.width;
|
|
1982
1974
|
}
|
|
@@ -1998,14 +1990,9 @@ class AuroFloatingUI {
|
|
|
1998
1990
|
* @returns {String} The positioning strategy, one of 'fullscreen', 'floating', 'cover'.
|
|
1999
1991
|
*/
|
|
2000
1992
|
getPositioningStrategy() {
|
|
2001
|
-
const element = this.element;
|
|
2002
|
-
if (!element) {
|
|
2003
|
-
return "floating";
|
|
2004
|
-
}
|
|
2005
|
-
|
|
2006
1993
|
const breakpoint =
|
|
2007
|
-
element.bib
|
|
2008
|
-
element.floaterConfig?.fullscreenBreakpoint;
|
|
1994
|
+
this.element.bib.mobileFullscreenBreakpoint ||
|
|
1995
|
+
this.element.floaterConfig?.fullscreenBreakpoint;
|
|
2009
1996
|
switch (this.behavior) {
|
|
2010
1997
|
case "tooltip":
|
|
2011
1998
|
return "floating";
|
|
@@ -2016,9 +2003,9 @@ class AuroFloatingUI {
|
|
|
2016
2003
|
`(max-width: ${breakpoint})`,
|
|
2017
2004
|
).matches;
|
|
2018
2005
|
|
|
2019
|
-
element.expanded = smallerThanBreakpoint;
|
|
2006
|
+
this.element.expanded = smallerThanBreakpoint;
|
|
2020
2007
|
}
|
|
2021
|
-
if (element.nested) {
|
|
2008
|
+
if (this.element.nested) {
|
|
2022
2009
|
return "cover";
|
|
2023
2010
|
}
|
|
2024
2011
|
return "fullscreen";
|
|
@@ -2048,65 +2035,42 @@ class AuroFloatingUI {
|
|
|
2048
2035
|
* and applies the calculated position to the bib's style.
|
|
2049
2036
|
*/
|
|
2050
2037
|
position() {
|
|
2051
|
-
const element = this.element;
|
|
2052
|
-
if (!element) {
|
|
2053
|
-
return;
|
|
2054
|
-
}
|
|
2055
|
-
|
|
2056
2038
|
const strategy = this.getPositioningStrategy();
|
|
2057
2039
|
this.configureBibStrategy(strategy);
|
|
2058
2040
|
|
|
2059
2041
|
if (strategy === "floating") {
|
|
2060
|
-
if (!element.trigger || !element.bib) {
|
|
2061
|
-
return;
|
|
2062
|
-
}
|
|
2063
|
-
|
|
2064
2042
|
this.mirrorSize();
|
|
2065
2043
|
// Define the middlware for the floater configuration
|
|
2066
2044
|
const middleware = [
|
|
2067
|
-
offset(element.floaterConfig?.offset || 0),
|
|
2068
|
-
...(element.floaterConfig?.shift ? [shift()] : []), // Add shift middleware if shift is enabled.
|
|
2069
|
-
...(element.floaterConfig?.flip ? [flip()] : []), // Add flip middleware if flip is enabled.
|
|
2070
|
-
...(element.floaterConfig?.autoPlacement ? [autoPlacement()] : []), // Add autoPlacement middleware if autoPlacement is enabled.
|
|
2045
|
+
offset(this.element.floaterConfig?.offset || 0),
|
|
2046
|
+
...(this.element.floaterConfig?.shift ? [shift()] : []), // Add shift middleware if shift is enabled.
|
|
2047
|
+
...(this.element.floaterConfig?.flip ? [flip()] : []), // Add flip middleware if flip is enabled.
|
|
2048
|
+
...(this.element.floaterConfig?.autoPlacement ? [autoPlacement()] : []), // Add autoPlacement middleware if autoPlacement is enabled.
|
|
2071
2049
|
];
|
|
2072
2050
|
|
|
2073
2051
|
// Compute the position of the bib
|
|
2074
|
-
computePosition(element.trigger, element.bib, {
|
|
2075
|
-
strategy: element.floaterConfig?.strategy || "fixed",
|
|
2076
|
-
placement: element.floaterConfig?.placement,
|
|
2052
|
+
computePosition(this.element.trigger, this.element.bib, {
|
|
2053
|
+
strategy: this.element.floaterConfig?.strategy || "fixed",
|
|
2054
|
+
placement: this.element.floaterConfig?.placement,
|
|
2077
2055
|
middleware: middleware || [],
|
|
2078
2056
|
}).then(({ x, y }) => {
|
|
2079
2057
|
// eslint-disable-line id-length
|
|
2080
|
-
|
|
2081
|
-
if (!currentElement?.bib) {
|
|
2082
|
-
return;
|
|
2083
|
-
}
|
|
2084
|
-
|
|
2085
|
-
Object.assign(currentElement.bib.style, {
|
|
2058
|
+
Object.assign(this.element.bib.style, {
|
|
2086
2059
|
left: `${x}px`,
|
|
2087
2060
|
top: `${y}px`,
|
|
2088
2061
|
});
|
|
2089
2062
|
});
|
|
2090
2063
|
} else if (strategy === "cover") {
|
|
2091
|
-
if (!element.parentNode || !element.bib) {
|
|
2092
|
-
return;
|
|
2093
|
-
}
|
|
2094
|
-
|
|
2095
2064
|
// Compute the position of the bib
|
|
2096
|
-
computePosition(element.parentNode, element.bib, {
|
|
2065
|
+
computePosition(this.element.parentNode, this.element.bib, {
|
|
2097
2066
|
placement: "bottom-start",
|
|
2098
2067
|
}).then(({ x, y }) => {
|
|
2099
2068
|
// eslint-disable-line id-length
|
|
2100
|
-
|
|
2101
|
-
if (!currentElement?.bib || !currentElement.parentNode) {
|
|
2102
|
-
return;
|
|
2103
|
-
}
|
|
2104
|
-
|
|
2105
|
-
Object.assign(currentElement.bib.style, {
|
|
2069
|
+
Object.assign(this.element.bib.style, {
|
|
2106
2070
|
left: `${x}px`,
|
|
2107
|
-
top: `${y -
|
|
2108
|
-
width: `${
|
|
2109
|
-
height: `${
|
|
2071
|
+
top: `${y - this.element.parentNode.offsetHeight}px`,
|
|
2072
|
+
width: `${this.element.parentNode.offsetWidth}px`,
|
|
2073
|
+
height: `${this.element.parentNode.offsetHeight}px`,
|
|
2110
2074
|
});
|
|
2111
2075
|
});
|
|
2112
2076
|
}
|
|
@@ -2118,17 +2082,11 @@ class AuroFloatingUI {
|
|
|
2118
2082
|
* @param {Boolean} lock - If true, locks the body's scrolling functionlity; otherwise, unlock.
|
|
2119
2083
|
*/
|
|
2120
2084
|
lockScroll(lock = true) {
|
|
2121
|
-
const element = this.element;
|
|
2122
|
-
|
|
2123
2085
|
if (lock) {
|
|
2124
|
-
if (!element?.bib) {
|
|
2125
|
-
return;
|
|
2126
|
-
}
|
|
2127
|
-
|
|
2128
2086
|
document.body.style.overflow = "hidden"; // hide body's scrollbar
|
|
2129
2087
|
|
|
2130
2088
|
// Move `bib` by the amount the viewport is shifted to stay aligned in fullscreen.
|
|
2131
|
-
element.bib.style.transform = `translateY(${window?.visualViewport?.offsetTop}px)`;
|
|
2089
|
+
this.element.bib.style.transform = `translateY(${window?.visualViewport?.offsetTop}px)`;
|
|
2132
2090
|
} else {
|
|
2133
2091
|
document.body.style.overflow = "";
|
|
2134
2092
|
}
|
|
@@ -2144,24 +2102,20 @@ class AuroFloatingUI {
|
|
|
2144
2102
|
* @param {string} strategy - The positioning strategy ('fullscreen' or 'floating').
|
|
2145
2103
|
*/
|
|
2146
2104
|
configureBibStrategy(value) {
|
|
2147
|
-
const element = this.element;
|
|
2148
|
-
if (!element?.bib) {
|
|
2149
|
-
return;
|
|
2150
|
-
}
|
|
2151
|
-
|
|
2152
2105
|
if (value === "fullscreen") {
|
|
2153
|
-
element.isBibFullscreen = true;
|
|
2106
|
+
this.element.isBibFullscreen = true;
|
|
2154
2107
|
// reset the prev position
|
|
2155
|
-
element.bib.setAttribute("isfullscreen", "");
|
|
2156
|
-
element.bib.style.position = "fixed";
|
|
2157
|
-
element.bib.style.top = "0px";
|
|
2158
|
-
element.bib.style.left = "0px";
|
|
2159
|
-
element.bib.style.width = "";
|
|
2160
|
-
element.bib.style.height = "";
|
|
2161
|
-
element.style.contain = "";
|
|
2108
|
+
this.element.bib.setAttribute("isfullscreen", "");
|
|
2109
|
+
this.element.bib.style.position = "fixed";
|
|
2110
|
+
this.element.bib.style.top = "0px";
|
|
2111
|
+
this.element.bib.style.left = "0px";
|
|
2112
|
+
this.element.bib.style.width = "";
|
|
2113
|
+
this.element.bib.style.height = "";
|
|
2114
|
+
this.element.style.contain = "";
|
|
2162
2115
|
|
|
2163
2116
|
// reset the size that was mirroring `size` css-part
|
|
2164
|
-
const bibContent =
|
|
2117
|
+
const bibContent =
|
|
2118
|
+
this.element.bib.shadowRoot.querySelector(".container");
|
|
2165
2119
|
if (bibContent) {
|
|
2166
2120
|
bibContent.style.width = "";
|
|
2167
2121
|
bibContent.style.height = "";
|
|
@@ -2176,14 +2130,14 @@ class AuroFloatingUI {
|
|
|
2176
2130
|
}, 0);
|
|
2177
2131
|
}
|
|
2178
2132
|
|
|
2179
|
-
if (element.isPopoverVisible) {
|
|
2133
|
+
if (this.element.isPopoverVisible) {
|
|
2180
2134
|
this.lockScroll(true);
|
|
2181
2135
|
}
|
|
2182
2136
|
} else {
|
|
2183
|
-
element.bib.style.position = "";
|
|
2184
|
-
element.bib.removeAttribute("isfullscreen");
|
|
2185
|
-
element.isBibFullscreen = false;
|
|
2186
|
-
element.style.contain = "layout";
|
|
2137
|
+
this.element.bib.style.position = "";
|
|
2138
|
+
this.element.bib.removeAttribute("isfullscreen");
|
|
2139
|
+
this.element.isBibFullscreen = false;
|
|
2140
|
+
this.element.style.contain = "layout";
|
|
2187
2141
|
}
|
|
2188
2142
|
|
|
2189
2143
|
const isChanged = this.strategy && this.strategy !== value;
|
|
@@ -2201,21 +2155,16 @@ class AuroFloatingUI {
|
|
|
2201
2155
|
},
|
|
2202
2156
|
);
|
|
2203
2157
|
|
|
2204
|
-
element.dispatchEvent(event);
|
|
2158
|
+
this.element.dispatchEvent(event);
|
|
2205
2159
|
}
|
|
2206
2160
|
}
|
|
2207
2161
|
|
|
2208
2162
|
updateState() {
|
|
2209
|
-
const
|
|
2210
|
-
if (!element) {
|
|
2211
|
-
return;
|
|
2212
|
-
}
|
|
2213
|
-
|
|
2214
|
-
const isVisible = element.isPopoverVisible;
|
|
2163
|
+
const isVisible = this.element.isPopoverVisible;
|
|
2215
2164
|
if (!isVisible) {
|
|
2216
2165
|
this.cleanupHideHandlers();
|
|
2217
2166
|
try {
|
|
2218
|
-
element.cleanup?.();
|
|
2167
|
+
this.element.cleanup?.();
|
|
2219
2168
|
} catch (error) {
|
|
2220
2169
|
// Do nothing
|
|
2221
2170
|
}
|
|
@@ -2231,30 +2180,28 @@ class AuroFloatingUI {
|
|
|
2231
2180
|
* If not, and if the bib isn't in fullscreen mode with focus lost, it hides the bib.
|
|
2232
2181
|
*/
|
|
2233
2182
|
handleFocusLoss() {
|
|
2234
|
-
const element = this.element;
|
|
2235
|
-
if (!element?.bib) {
|
|
2236
|
-
return;
|
|
2237
|
-
}
|
|
2238
|
-
|
|
2239
2183
|
// if mouse is being pressed, skip and let click event to handle the action
|
|
2240
2184
|
if (AuroFloatingUI.isMousePressed) {
|
|
2241
2185
|
return;
|
|
2242
2186
|
}
|
|
2243
2187
|
|
|
2244
2188
|
if (
|
|
2245
|
-
element.noHideOnThisFocusLoss ||
|
|
2246
|
-
element.hasAttribute("noHideOnThisFocusLoss")
|
|
2189
|
+
this.element.noHideOnThisFocusLoss ||
|
|
2190
|
+
this.element.hasAttribute("noHideOnThisFocusLoss")
|
|
2247
2191
|
) {
|
|
2248
2192
|
return;
|
|
2249
2193
|
}
|
|
2250
2194
|
|
|
2251
2195
|
// if focus is still inside of trigger or bib, do not close
|
|
2252
|
-
if (
|
|
2196
|
+
if (
|
|
2197
|
+
this.element.matches(":focus") ||
|
|
2198
|
+
this.element.matches(":focus-within")
|
|
2199
|
+
) {
|
|
2253
2200
|
return;
|
|
2254
2201
|
}
|
|
2255
2202
|
|
|
2256
2203
|
// if fullscreen bib is in fullscreen mode, do not close
|
|
2257
|
-
if (element.bib.hasAttribute("isfullscreen")) {
|
|
2204
|
+
if (this.element.bib.hasAttribute("isfullscreen")) {
|
|
2258
2205
|
return;
|
|
2259
2206
|
}
|
|
2260
2207
|
|
|
@@ -2262,33 +2209,23 @@ class AuroFloatingUI {
|
|
|
2262
2209
|
}
|
|
2263
2210
|
|
|
2264
2211
|
setupHideHandlers() {
|
|
2265
|
-
const element = this.element;
|
|
2266
|
-
if (!element) {
|
|
2267
|
-
return;
|
|
2268
|
-
}
|
|
2269
|
-
|
|
2270
2212
|
// Define handlers & store references
|
|
2271
2213
|
this.focusHandler = () => this.handleFocusLoss();
|
|
2272
2214
|
|
|
2273
2215
|
this.clickHandler = (evt) => {
|
|
2274
|
-
const element = this.element;
|
|
2275
|
-
if (!element?.bib) {
|
|
2276
|
-
return;
|
|
2277
|
-
}
|
|
2278
|
-
|
|
2279
2216
|
// When the bib is fullscreen (modal dialog), don't close on outside
|
|
2280
2217
|
// clicks. VoiceOver's synthetic click events inside a top-layer modal
|
|
2281
2218
|
// <dialog> may not include the bib in composedPath(), causing false
|
|
2282
2219
|
// positives. This mirrors the fullscreen guard in handleFocusLoss().
|
|
2283
|
-
if (element.bib.hasAttribute("isfullscreen")) {
|
|
2220
|
+
if (this.element.bib && this.element.bib.hasAttribute("isfullscreen")) {
|
|
2284
2221
|
return;
|
|
2285
2222
|
}
|
|
2286
2223
|
|
|
2287
2224
|
if (
|
|
2288
|
-
(!evt.composedPath().includes(element.trigger) &&
|
|
2289
|
-
!evt.composedPath().includes(element.bib)) ||
|
|
2290
|
-
(element.bib.backdrop &&
|
|
2291
|
-
evt.composedPath().includes(element.bib.backdrop))
|
|
2225
|
+
(!evt.composedPath().includes(this.element.trigger) &&
|
|
2226
|
+
!evt.composedPath().includes(this.element.bib)) ||
|
|
2227
|
+
(this.element.bib.backdrop &&
|
|
2228
|
+
evt.composedPath().includes(this.element.bib.backdrop))
|
|
2292
2229
|
) {
|
|
2293
2230
|
const existedVisibleFloatingUI =
|
|
2294
2231
|
document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
@@ -2309,12 +2246,7 @@ class AuroFloatingUI {
|
|
|
2309
2246
|
|
|
2310
2247
|
// ESC key handler
|
|
2311
2248
|
this.keyDownHandler = (evt) => {
|
|
2312
|
-
|
|
2313
|
-
if (!element) {
|
|
2314
|
-
return;
|
|
2315
|
-
}
|
|
2316
|
-
|
|
2317
|
-
if (evt.key === "Escape" && element.isPopoverVisible) {
|
|
2249
|
+
if (evt.key === "Escape" && this.element.isPopoverVisible) {
|
|
2318
2250
|
const existedVisibleFloatingUI =
|
|
2319
2251
|
document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
2320
2252
|
if (
|
|
@@ -2371,10 +2303,6 @@ class AuroFloatingUI {
|
|
|
2371
2303
|
}
|
|
2372
2304
|
|
|
2373
2305
|
updateCurrentExpandedDropdown() {
|
|
2374
|
-
if (!this.element) {
|
|
2375
|
-
return;
|
|
2376
|
-
}
|
|
2377
|
-
|
|
2378
2306
|
// Close any other dropdown that is already open
|
|
2379
2307
|
const existedVisibleFloatingUI =
|
|
2380
2308
|
document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
@@ -2391,34 +2319,25 @@ class AuroFloatingUI {
|
|
|
2391
2319
|
}
|
|
2392
2320
|
|
|
2393
2321
|
showBib() {
|
|
2394
|
-
|
|
2395
|
-
if (!element) {
|
|
2396
|
-
return;
|
|
2397
|
-
}
|
|
2398
|
-
|
|
2399
|
-
if (!element.bib || (!element.trigger && !element.parentNode)) {
|
|
2400
|
-
return;
|
|
2401
|
-
}
|
|
2402
|
-
|
|
2403
|
-
if (!element.disabled && !this.showing) {
|
|
2322
|
+
if (!this.element.disabled && !this.showing) {
|
|
2404
2323
|
this.updateCurrentExpandedDropdown();
|
|
2405
|
-
element.triggerChevron?.setAttribute("data-expanded", true);
|
|
2324
|
+
this.element.triggerChevron?.setAttribute("data-expanded", true);
|
|
2406
2325
|
|
|
2407
2326
|
// prevent double showing: isPopovervisible gets first and showBib gets called later
|
|
2408
2327
|
if (!this.showing) {
|
|
2409
|
-
if (!element.modal) {
|
|
2328
|
+
if (!this.element.modal) {
|
|
2410
2329
|
this.setupHideHandlers();
|
|
2411
2330
|
}
|
|
2412
2331
|
this.showing = true;
|
|
2413
|
-
element.isPopoverVisible = true;
|
|
2332
|
+
this.element.isPopoverVisible = true;
|
|
2414
2333
|
this.position();
|
|
2415
2334
|
this.dispatchEventDropdownToggle();
|
|
2416
2335
|
}
|
|
2417
2336
|
|
|
2418
2337
|
// Setup auto update to handle resize and scroll
|
|
2419
|
-
element.cleanup = autoUpdate(
|
|
2420
|
-
element.trigger || element.parentNode,
|
|
2421
|
-
element.bib,
|
|
2338
|
+
this.element.cleanup = autoUpdate(
|
|
2339
|
+
this.element.trigger || this.element.parentNode,
|
|
2340
|
+
this.element.bib,
|
|
2422
2341
|
() => {
|
|
2423
2342
|
this.position();
|
|
2424
2343
|
},
|
|
@@ -2431,27 +2350,22 @@ class AuroFloatingUI {
|
|
|
2431
2350
|
* @param {String} eventType - The event type that triggered the hiding action.
|
|
2432
2351
|
*/
|
|
2433
2352
|
hideBib(eventType = "unknown") {
|
|
2434
|
-
|
|
2435
|
-
if (!element) {
|
|
2436
|
-
return;
|
|
2437
|
-
}
|
|
2438
|
-
|
|
2439
|
-
if (element.disabled) {
|
|
2353
|
+
if (this.element.disabled) {
|
|
2440
2354
|
return;
|
|
2441
2355
|
}
|
|
2442
2356
|
|
|
2443
2357
|
// noToggle dropdowns should not close when the trigger is clicked (the
|
|
2444
2358
|
// "toggle" behavior), but they CAN still close via other interactions like
|
|
2445
2359
|
// Escape key or focus loss.
|
|
2446
|
-
if (element.noToggle && eventType === "click") {
|
|
2360
|
+
if (this.element.noToggle && eventType === "click") {
|
|
2447
2361
|
return;
|
|
2448
2362
|
}
|
|
2449
2363
|
|
|
2450
2364
|
this.lockScroll(false);
|
|
2451
|
-
element.triggerChevron?.removeAttribute("data-expanded");
|
|
2365
|
+
this.element.triggerChevron?.removeAttribute("data-expanded");
|
|
2452
2366
|
|
|
2453
|
-
if (element.isPopoverVisible) {
|
|
2454
|
-
element.isPopoverVisible = false;
|
|
2367
|
+
if (this.element.isPopoverVisible) {
|
|
2368
|
+
this.element.isPopoverVisible = false;
|
|
2455
2369
|
}
|
|
2456
2370
|
if (this.showing) {
|
|
2457
2371
|
this.cleanupHideHandlers();
|
|
@@ -2471,11 +2385,6 @@ class AuroFloatingUI {
|
|
|
2471
2385
|
* @param {String} eventType - The event type that triggered the toggle action.
|
|
2472
2386
|
*/
|
|
2473
2387
|
dispatchEventDropdownToggle(eventType) {
|
|
2474
|
-
const element = this.element;
|
|
2475
|
-
if (!element) {
|
|
2476
|
-
return;
|
|
2477
|
-
}
|
|
2478
|
-
|
|
2479
2388
|
const event = new CustomEvent(
|
|
2480
2389
|
this.eventPrefix ? `${this.eventPrefix}-toggled` : "toggled",
|
|
2481
2390
|
{
|
|
@@ -2487,16 +2396,11 @@ class AuroFloatingUI {
|
|
|
2487
2396
|
},
|
|
2488
2397
|
);
|
|
2489
2398
|
|
|
2490
|
-
element.dispatchEvent(event);
|
|
2399
|
+
this.element.dispatchEvent(event);
|
|
2491
2400
|
}
|
|
2492
2401
|
|
|
2493
2402
|
handleClick() {
|
|
2494
|
-
|
|
2495
|
-
if (!element) {
|
|
2496
|
-
return;
|
|
2497
|
-
}
|
|
2498
|
-
|
|
2499
|
-
if (element.isPopoverVisible) {
|
|
2403
|
+
if (this.element.isPopoverVisible) {
|
|
2500
2404
|
this.hideBib("click");
|
|
2501
2405
|
} else {
|
|
2502
2406
|
this.showBib();
|
|
@@ -2507,66 +2411,63 @@ class AuroFloatingUI {
|
|
|
2507
2411
|
{
|
|
2508
2412
|
composed: true,
|
|
2509
2413
|
detail: {
|
|
2510
|
-
expanded: element.isPopoverVisible,
|
|
2414
|
+
expanded: this.element.isPopoverVisible,
|
|
2511
2415
|
},
|
|
2512
2416
|
},
|
|
2513
2417
|
);
|
|
2514
2418
|
|
|
2515
|
-
element.dispatchEvent(event);
|
|
2419
|
+
this.element.dispatchEvent(event);
|
|
2516
2420
|
}
|
|
2517
2421
|
|
|
2518
2422
|
handleEvent(event) {
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
event.preventDefault();
|
|
2535
|
-
this.handleClick();
|
|
2423
|
+
if (!this.element.disableEventShow) {
|
|
2424
|
+
switch (event.type) {
|
|
2425
|
+
case "keydown": {
|
|
2426
|
+
// Support both Enter and Space keys for accessibility
|
|
2427
|
+
// Space is included as it's expected behavior for interactive elements
|
|
2428
|
+
|
|
2429
|
+
const origin = event.composedPath()[0];
|
|
2430
|
+
if (
|
|
2431
|
+
event.key === "Enter" ||
|
|
2432
|
+
(event.key === " " && (!origin || origin.tagName !== "INPUT"))
|
|
2433
|
+
) {
|
|
2434
|
+
event.preventDefault();
|
|
2435
|
+
this.handleClick();
|
|
2436
|
+
}
|
|
2437
|
+
break;
|
|
2536
2438
|
}
|
|
2537
|
-
|
|
2439
|
+
case "mouseenter":
|
|
2440
|
+
if (this.element.hoverToggle) {
|
|
2441
|
+
this.showBib();
|
|
2442
|
+
}
|
|
2443
|
+
break;
|
|
2444
|
+
case "mouseleave":
|
|
2445
|
+
if (this.element.hoverToggle) {
|
|
2446
|
+
this.hideBib("mouseleave");
|
|
2447
|
+
}
|
|
2448
|
+
break;
|
|
2449
|
+
case "focus":
|
|
2450
|
+
if (this.element.focusShow) {
|
|
2451
|
+
/*
|
|
2452
|
+
This needs to better handle clicking that gives focus -
|
|
2453
|
+
currently it shows and then immediately hides the bib
|
|
2454
|
+
*/
|
|
2455
|
+
this.showBib();
|
|
2456
|
+
}
|
|
2457
|
+
break;
|
|
2458
|
+
case "blur":
|
|
2459
|
+
// send this task 100ms later queue to
|
|
2460
|
+
// wait a frame in case focus moves within the floating element/bib
|
|
2461
|
+
setTimeout(() => this.handleFocusLoss(), 0);
|
|
2462
|
+
break;
|
|
2463
|
+
case "click":
|
|
2464
|
+
if (document.activeElement === document.body) {
|
|
2465
|
+
event.currentTarget.focus();
|
|
2466
|
+
}
|
|
2467
|
+
this.handleClick();
|
|
2468
|
+
break;
|
|
2469
|
+
// Do nothing
|
|
2538
2470
|
}
|
|
2539
|
-
case "mouseenter":
|
|
2540
|
-
if (element.hoverToggle) {
|
|
2541
|
-
this.showBib();
|
|
2542
|
-
}
|
|
2543
|
-
break;
|
|
2544
|
-
case "mouseleave":
|
|
2545
|
-
if (element.hoverToggle) {
|
|
2546
|
-
this.hideBib("mouseleave");
|
|
2547
|
-
}
|
|
2548
|
-
break;
|
|
2549
|
-
case "focus":
|
|
2550
|
-
if (element.focusShow) {
|
|
2551
|
-
/*
|
|
2552
|
-
This needs to better handle clicking that gives focus -
|
|
2553
|
-
currently it shows and then immediately hides the bib
|
|
2554
|
-
*/
|
|
2555
|
-
this.showBib();
|
|
2556
|
-
}
|
|
2557
|
-
break;
|
|
2558
|
-
case "blur":
|
|
2559
|
-
// send this task 100ms later queue to
|
|
2560
|
-
// wait a frame in case focus moves within the floating element/bib
|
|
2561
|
-
setTimeout(() => this.handleFocusLoss(), 0);
|
|
2562
|
-
break;
|
|
2563
|
-
case "click":
|
|
2564
|
-
if (document.activeElement === document.body) {
|
|
2565
|
-
event.currentTarget.focus();
|
|
2566
|
-
}
|
|
2567
|
-
this.handleClick();
|
|
2568
|
-
break;
|
|
2569
|
-
// Do nothing
|
|
2570
2471
|
}
|
|
2571
2472
|
}
|
|
2572
2473
|
|
|
@@ -2577,11 +2478,6 @@ class AuroFloatingUI {
|
|
|
2577
2478
|
* This prevents the component itself from being focusable when the trigger element already handles focus.
|
|
2578
2479
|
*/
|
|
2579
2480
|
handleTriggerTabIndex() {
|
|
2580
|
-
const element = this.element;
|
|
2581
|
-
if (!element) {
|
|
2582
|
-
return;
|
|
2583
|
-
}
|
|
2584
|
-
|
|
2585
2481
|
const focusableElementSelectors = [
|
|
2586
2482
|
"a",
|
|
2587
2483
|
"button",
|
|
@@ -2594,7 +2490,7 @@ class AuroFloatingUI {
|
|
|
2594
2490
|
"auro-hyperlink",
|
|
2595
2491
|
];
|
|
2596
2492
|
|
|
2597
|
-
const triggerNode = element.querySelectorAll('[slot="trigger"]')[0];
|
|
2493
|
+
const triggerNode = this.element.querySelectorAll('[slot="trigger"]')[0];
|
|
2598
2494
|
if (!triggerNode) {
|
|
2599
2495
|
return;
|
|
2600
2496
|
}
|
|
@@ -2603,13 +2499,13 @@ class AuroFloatingUI {
|
|
|
2603
2499
|
focusableElementSelectors.forEach((selector) => {
|
|
2604
2500
|
// Check if the trigger node element is focusable
|
|
2605
2501
|
if (triggerNodeTagName === selector) {
|
|
2606
|
-
element.tabIndex = -1;
|
|
2502
|
+
this.element.tabIndex = -1;
|
|
2607
2503
|
return;
|
|
2608
2504
|
}
|
|
2609
2505
|
|
|
2610
2506
|
// Check if any child is focusable
|
|
2611
2507
|
if (triggerNode.querySelector(selector)) {
|
|
2612
|
-
element.tabIndex = -1;
|
|
2508
|
+
this.element.tabIndex = -1;
|
|
2613
2509
|
}
|
|
2614
2510
|
});
|
|
2615
2511
|
}
|
|
@@ -2619,18 +2515,13 @@ class AuroFloatingUI {
|
|
|
2619
2515
|
* @param {*} eventPrefix
|
|
2620
2516
|
*/
|
|
2621
2517
|
regenerateBibId() {
|
|
2622
|
-
|
|
2623
|
-
if (!element) {
|
|
2624
|
-
return;
|
|
2625
|
-
}
|
|
2626
|
-
|
|
2627
|
-
this.id = element.getAttribute("id");
|
|
2518
|
+
this.id = this.element.getAttribute("id");
|
|
2628
2519
|
if (!this.id) {
|
|
2629
2520
|
this.id = window.crypto.randomUUID();
|
|
2630
|
-
element.setAttribute("id", this.id);
|
|
2521
|
+
this.element.setAttribute("id", this.id);
|
|
2631
2522
|
}
|
|
2632
2523
|
|
|
2633
|
-
element.bib
|
|
2524
|
+
this.element.bib.setAttribute("id", `${this.id}-floater-bib`);
|
|
2634
2525
|
}
|
|
2635
2526
|
|
|
2636
2527
|
configure(elem, eventPrefix, enableKeyboardHandling = true) {
|
|
@@ -2642,69 +2533,67 @@ class AuroFloatingUI {
|
|
|
2642
2533
|
this.element = elem;
|
|
2643
2534
|
}
|
|
2644
2535
|
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
return;
|
|
2536
|
+
if (this.behavior !== this.element.behavior) {
|
|
2537
|
+
this.behavior = this.element.behavior;
|
|
2648
2538
|
}
|
|
2649
2539
|
|
|
2650
|
-
if (this.
|
|
2651
|
-
this.behavior = element.behavior;
|
|
2652
|
-
}
|
|
2653
|
-
|
|
2654
|
-
if (element.trigger) {
|
|
2540
|
+
if (this.element.trigger) {
|
|
2655
2541
|
this.disconnect();
|
|
2656
2542
|
}
|
|
2657
|
-
element.trigger =
|
|
2658
|
-
element.triggerElement ||
|
|
2659
|
-
element.shadowRoot
|
|
2660
|
-
element.trigger;
|
|
2661
|
-
element.bib =
|
|
2662
|
-
|
|
2663
|
-
element.
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2543
|
+
this.element.trigger =
|
|
2544
|
+
this.element.triggerElement ||
|
|
2545
|
+
this.element.shadowRoot.querySelector("#trigger") ||
|
|
2546
|
+
this.element.trigger;
|
|
2547
|
+
this.element.bib =
|
|
2548
|
+
this.element.shadowRoot.querySelector("#bib") || this.element.bib;
|
|
2549
|
+
this.element.bibSizer = this.element.shadowRoot.querySelector("#bibSizer");
|
|
2550
|
+
this.element.triggerChevron =
|
|
2551
|
+
this.element.shadowRoot.querySelector("#showStateIcon");
|
|
2552
|
+
|
|
2553
|
+
if (this.element.floaterConfig) {
|
|
2554
|
+
this.element.hoverToggle = this.element.floaterConfig.hoverToggle;
|
|
2668
2555
|
}
|
|
2669
2556
|
|
|
2670
2557
|
this.regenerateBibId();
|
|
2671
2558
|
this.handleTriggerTabIndex();
|
|
2672
2559
|
|
|
2673
2560
|
this.handleEvent = this.handleEvent.bind(this);
|
|
2674
|
-
if (element.trigger) {
|
|
2561
|
+
if (this.element.trigger) {
|
|
2675
2562
|
if (this.enableKeyboardHandling) {
|
|
2676
|
-
element.trigger.addEventListener("keydown", this.handleEvent);
|
|
2563
|
+
this.element.trigger.addEventListener("keydown", this.handleEvent);
|
|
2677
2564
|
}
|
|
2678
|
-
element.trigger.addEventListener("click", this.handleEvent);
|
|
2679
|
-
element.trigger.addEventListener("mouseenter", this.handleEvent);
|
|
2680
|
-
element.trigger.addEventListener("mouseleave", this.handleEvent);
|
|
2681
|
-
element.trigger.addEventListener("focus", this.handleEvent);
|
|
2682
|
-
element.trigger.addEventListener("blur", this.handleEvent);
|
|
2565
|
+
this.element.trigger.addEventListener("click", this.handleEvent);
|
|
2566
|
+
this.element.trigger.addEventListener("mouseenter", this.handleEvent);
|
|
2567
|
+
this.element.trigger.addEventListener("mouseleave", this.handleEvent);
|
|
2568
|
+
this.element.trigger.addEventListener("focus", this.handleEvent);
|
|
2569
|
+
this.element.trigger.addEventListener("blur", this.handleEvent);
|
|
2683
2570
|
}
|
|
2684
2571
|
}
|
|
2685
2572
|
|
|
2686
2573
|
disconnect() {
|
|
2687
2574
|
this.cleanupHideHandlers();
|
|
2575
|
+
if (this.element) {
|
|
2576
|
+
this.element.cleanup?.();
|
|
2688
2577
|
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
}
|
|
2693
|
-
|
|
2694
|
-
element.cleanup?.();
|
|
2695
|
-
|
|
2696
|
-
if (element.bib && element.shadowRoot) {
|
|
2697
|
-
element.shadowRoot.append(element.bib);
|
|
2698
|
-
}
|
|
2578
|
+
if (this.element.bib) {
|
|
2579
|
+
this.element.shadowRoot.append(this.element.bib);
|
|
2580
|
+
}
|
|
2699
2581
|
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2582
|
+
// Remove event & keyboard listeners
|
|
2583
|
+
if (this.element?.trigger) {
|
|
2584
|
+
this.element.trigger.removeEventListener("keydown", this.handleEvent);
|
|
2585
|
+
this.element.trigger.removeEventListener("click", this.handleEvent);
|
|
2586
|
+
this.element.trigger.removeEventListener(
|
|
2587
|
+
"mouseenter",
|
|
2588
|
+
this.handleEvent,
|
|
2589
|
+
);
|
|
2590
|
+
this.element.trigger.removeEventListener(
|
|
2591
|
+
"mouseleave",
|
|
2592
|
+
this.handleEvent,
|
|
2593
|
+
);
|
|
2594
|
+
this.element.trigger.removeEventListener("focus", this.handleEvent);
|
|
2595
|
+
this.element.trigger.removeEventListener("blur", this.handleEvent);
|
|
2596
|
+
}
|
|
2708
2597
|
}
|
|
2709
2598
|
}
|
|
2710
2599
|
}
|
|
@@ -3863,7 +3752,7 @@ class AuroHelpText extends i {
|
|
|
3863
3752
|
}
|
|
3864
3753
|
}
|
|
3865
3754
|
|
|
3866
|
-
var formkitVersion = '
|
|
3755
|
+
var formkitVersion = '202604072118';
|
|
3867
3756
|
|
|
3868
3757
|
class AuroElement extends i {
|
|
3869
3758
|
static get properties() {
|