@aurodesignsystem-dev/auro-formkit 0.0.0-pr1422.1 → 0.0.0-pr1423.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/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 -275
- package/components/combobox/demo/index.min.js +165 -275
- package/components/combobox/dist/index.js +165 -275
- package/components/combobox/dist/registered.js +165 -275
- package/components/counter/demo/api.min.js +164 -274
- package/components/counter/demo/index.min.js +164 -274
- package/components/counter/dist/index.js +164 -274
- package/components/counter/dist/registered.js +164 -274
- package/components/datepicker/demo/api.min.js +165 -275
- package/components/datepicker/demo/index.min.js +165 -275
- package/components/datepicker/dist/index.js +165 -275
- package/components/datepicker/dist/registered.js +165 -275
- package/components/dropdown/demo/api.min.js +164 -274
- package/components/dropdown/demo/index.min.js +164 -274
- package/components/dropdown/dist/index.js +164 -274
- package/components/dropdown/dist/registered.js +164 -274
- package/components/form/demo/api.min.js +661 -1101
- package/components/form/demo/index.min.js +661 -1101
- 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 -274
- package/components/select/demo/index.min.js +164 -274
- package/components/select/dist/index.js +164 -274
- package/components/select/dist/registered.js +164 -274
- package/package.json +2 -2
|
@@ -1904,19 +1904,11 @@ class AuroFloatingUI {
|
|
|
1904
1904
|
* This ensures that the bib content has the same dimensions as the sizer element.
|
|
1905
1905
|
*/
|
|
1906
1906
|
mirrorSize() {
|
|
1907
|
-
const element = this.element;
|
|
1908
|
-
if (!element) {
|
|
1909
|
-
return;
|
|
1910
|
-
}
|
|
1911
|
-
|
|
1912
1907
|
// mirror the boxsize from bibSizer
|
|
1913
|
-
if (element.bibSizer && element.matchWidth
|
|
1914
|
-
const sizerStyle = window.getComputedStyle(element.bibSizer);
|
|
1915
|
-
const bibContent =
|
|
1916
|
-
|
|
1917
|
-
return;
|
|
1918
|
-
}
|
|
1919
|
-
|
|
1908
|
+
if (this.element.bibSizer && this.element.matchWidth) {
|
|
1909
|
+
const sizerStyle = window.getComputedStyle(this.element.bibSizer);
|
|
1910
|
+
const bibContent =
|
|
1911
|
+
this.element.bib.shadowRoot.querySelector(".container");
|
|
1920
1912
|
if (sizerStyle.width !== "0px") {
|
|
1921
1913
|
bibContent.style.width = sizerStyle.width;
|
|
1922
1914
|
}
|
|
@@ -1938,14 +1930,9 @@ class AuroFloatingUI {
|
|
|
1938
1930
|
* @returns {String} The positioning strategy, one of 'fullscreen', 'floating', 'cover'.
|
|
1939
1931
|
*/
|
|
1940
1932
|
getPositioningStrategy() {
|
|
1941
|
-
const element = this.element;
|
|
1942
|
-
if (!element) {
|
|
1943
|
-
return this.behavior || "floating";
|
|
1944
|
-
}
|
|
1945
|
-
|
|
1946
1933
|
const breakpoint =
|
|
1947
|
-
element.bib
|
|
1948
|
-
element.floaterConfig?.fullscreenBreakpoint;
|
|
1934
|
+
this.element.bib.mobileFullscreenBreakpoint ||
|
|
1935
|
+
this.element.floaterConfig?.fullscreenBreakpoint;
|
|
1949
1936
|
switch (this.behavior) {
|
|
1950
1937
|
case "tooltip":
|
|
1951
1938
|
return "floating";
|
|
@@ -1956,9 +1943,9 @@ class AuroFloatingUI {
|
|
|
1956
1943
|
`(max-width: ${breakpoint})`,
|
|
1957
1944
|
).matches;
|
|
1958
1945
|
|
|
1959
|
-
element.expanded = smallerThanBreakpoint;
|
|
1946
|
+
this.element.expanded = smallerThanBreakpoint;
|
|
1960
1947
|
}
|
|
1961
|
-
if (element.nested) {
|
|
1948
|
+
if (this.element.nested) {
|
|
1962
1949
|
return "cover";
|
|
1963
1950
|
}
|
|
1964
1951
|
return "fullscreen";
|
|
@@ -1988,65 +1975,42 @@ class AuroFloatingUI {
|
|
|
1988
1975
|
* and applies the calculated position to the bib's style.
|
|
1989
1976
|
*/
|
|
1990
1977
|
position() {
|
|
1991
|
-
const element = this.element;
|
|
1992
|
-
if (!element) {
|
|
1993
|
-
return;
|
|
1994
|
-
}
|
|
1995
|
-
|
|
1996
1978
|
const strategy = this.getPositioningStrategy();
|
|
1997
1979
|
this.configureBibStrategy(strategy);
|
|
1998
1980
|
|
|
1999
1981
|
if (strategy === "floating") {
|
|
2000
|
-
if (!element.trigger || !element.bib) {
|
|
2001
|
-
return;
|
|
2002
|
-
}
|
|
2003
|
-
|
|
2004
1982
|
this.mirrorSize();
|
|
2005
1983
|
// Define the middlware for the floater configuration
|
|
2006
1984
|
const middleware = [
|
|
2007
|
-
offset(element.floaterConfig?.offset || 0),
|
|
2008
|
-
...(element.floaterConfig?.shift ? [shift()] : []), // Add shift middleware if shift is enabled.
|
|
2009
|
-
...(element.floaterConfig?.flip ? [flip()] : []), // Add flip middleware if flip is enabled.
|
|
2010
|
-
...(element.floaterConfig?.autoPlacement ? [autoPlacement()] : []), // Add autoPlacement middleware if autoPlacement is enabled.
|
|
1985
|
+
offset(this.element.floaterConfig?.offset || 0),
|
|
1986
|
+
...(this.element.floaterConfig?.shift ? [shift()] : []), // Add shift middleware if shift is enabled.
|
|
1987
|
+
...(this.element.floaterConfig?.flip ? [flip()] : []), // Add flip middleware if flip is enabled.
|
|
1988
|
+
...(this.element.floaterConfig?.autoPlacement ? [autoPlacement()] : []), // Add autoPlacement middleware if autoPlacement is enabled.
|
|
2011
1989
|
];
|
|
2012
1990
|
|
|
2013
1991
|
// Compute the position of the bib
|
|
2014
|
-
computePosition(element.trigger, element.bib, {
|
|
2015
|
-
strategy: element.floaterConfig?.strategy || "fixed",
|
|
2016
|
-
placement: element.floaterConfig?.placement,
|
|
1992
|
+
computePosition(this.element.trigger, this.element.bib, {
|
|
1993
|
+
strategy: this.element.floaterConfig?.strategy || "fixed",
|
|
1994
|
+
placement: this.element.floaterConfig?.placement,
|
|
2017
1995
|
middleware: middleware || [],
|
|
2018
1996
|
}).then(({ x, y }) => {
|
|
2019
1997
|
// eslint-disable-line id-length
|
|
2020
|
-
|
|
2021
|
-
if (!currentElement?.bib) {
|
|
2022
|
-
return;
|
|
2023
|
-
}
|
|
2024
|
-
|
|
2025
|
-
Object.assign(currentElement.bib.style, {
|
|
1998
|
+
Object.assign(this.element.bib.style, {
|
|
2026
1999
|
left: `${x}px`,
|
|
2027
2000
|
top: `${y}px`,
|
|
2028
2001
|
});
|
|
2029
2002
|
});
|
|
2030
2003
|
} else if (strategy === "cover") {
|
|
2031
|
-
if (!element.parentNode || !element.bib) {
|
|
2032
|
-
return;
|
|
2033
|
-
}
|
|
2034
|
-
|
|
2035
2004
|
// Compute the position of the bib
|
|
2036
|
-
computePosition(element.parentNode, element.bib, {
|
|
2005
|
+
computePosition(this.element.parentNode, this.element.bib, {
|
|
2037
2006
|
placement: "bottom-start",
|
|
2038
2007
|
}).then(({ x, y }) => {
|
|
2039
2008
|
// eslint-disable-line id-length
|
|
2040
|
-
|
|
2041
|
-
if (!currentElement?.bib || !currentElement.parentNode) {
|
|
2042
|
-
return;
|
|
2043
|
-
}
|
|
2044
|
-
|
|
2045
|
-
Object.assign(currentElement.bib.style, {
|
|
2009
|
+
Object.assign(this.element.bib.style, {
|
|
2046
2010
|
left: `${x}px`,
|
|
2047
|
-
top: `${y -
|
|
2048
|
-
width: `${
|
|
2049
|
-
height: `${
|
|
2011
|
+
top: `${y - this.element.parentNode.offsetHeight}px`,
|
|
2012
|
+
width: `${this.element.parentNode.offsetWidth}px`,
|
|
2013
|
+
height: `${this.element.parentNode.offsetHeight}px`,
|
|
2050
2014
|
});
|
|
2051
2015
|
});
|
|
2052
2016
|
}
|
|
@@ -2058,17 +2022,11 @@ class AuroFloatingUI {
|
|
|
2058
2022
|
* @param {Boolean} lock - If true, locks the body's scrolling functionlity; otherwise, unlock.
|
|
2059
2023
|
*/
|
|
2060
2024
|
lockScroll(lock = true) {
|
|
2061
|
-
const element = this.element;
|
|
2062
|
-
|
|
2063
2025
|
if (lock) {
|
|
2064
|
-
if (!element?.bib) {
|
|
2065
|
-
return;
|
|
2066
|
-
}
|
|
2067
|
-
|
|
2068
2026
|
document.body.style.overflow = "hidden"; // hide body's scrollbar
|
|
2069
2027
|
|
|
2070
2028
|
// Move `bib` by the amount the viewport is shifted to stay aligned in fullscreen.
|
|
2071
|
-
element.bib.style.transform = `translateY(${window?.visualViewport?.offsetTop}px)`;
|
|
2029
|
+
this.element.bib.style.transform = `translateY(${window?.visualViewport?.offsetTop}px)`;
|
|
2072
2030
|
} else {
|
|
2073
2031
|
document.body.style.overflow = "";
|
|
2074
2032
|
}
|
|
@@ -2084,24 +2042,20 @@ class AuroFloatingUI {
|
|
|
2084
2042
|
* @param {string} strategy - The positioning strategy ('fullscreen' or 'floating').
|
|
2085
2043
|
*/
|
|
2086
2044
|
configureBibStrategy(value) {
|
|
2087
|
-
const element = this.element;
|
|
2088
|
-
if (!element?.bib) {
|
|
2089
|
-
return;
|
|
2090
|
-
}
|
|
2091
|
-
|
|
2092
2045
|
if (value === "fullscreen") {
|
|
2093
|
-
element.isBibFullscreen = true;
|
|
2046
|
+
this.element.isBibFullscreen = true;
|
|
2094
2047
|
// reset the prev position
|
|
2095
|
-
element.bib.setAttribute("isfullscreen", "");
|
|
2096
|
-
element.bib.style.position = "fixed";
|
|
2097
|
-
element.bib.style.top = "0px";
|
|
2098
|
-
element.bib.style.left = "0px";
|
|
2099
|
-
element.bib.style.width = "";
|
|
2100
|
-
element.bib.style.height = "";
|
|
2101
|
-
element.style.contain = "";
|
|
2048
|
+
this.element.bib.setAttribute("isfullscreen", "");
|
|
2049
|
+
this.element.bib.style.position = "fixed";
|
|
2050
|
+
this.element.bib.style.top = "0px";
|
|
2051
|
+
this.element.bib.style.left = "0px";
|
|
2052
|
+
this.element.bib.style.width = "";
|
|
2053
|
+
this.element.bib.style.height = "";
|
|
2054
|
+
this.element.style.contain = "";
|
|
2102
2055
|
|
|
2103
2056
|
// reset the size that was mirroring `size` css-part
|
|
2104
|
-
const bibContent =
|
|
2057
|
+
const bibContent =
|
|
2058
|
+
this.element.bib.shadowRoot.querySelector(".container");
|
|
2105
2059
|
if (bibContent) {
|
|
2106
2060
|
bibContent.style.width = "";
|
|
2107
2061
|
bibContent.style.height = "";
|
|
@@ -2116,14 +2070,14 @@ class AuroFloatingUI {
|
|
|
2116
2070
|
}, 0);
|
|
2117
2071
|
}
|
|
2118
2072
|
|
|
2119
|
-
if (element.isPopoverVisible) {
|
|
2073
|
+
if (this.element.isPopoverVisible) {
|
|
2120
2074
|
this.lockScroll(true);
|
|
2121
2075
|
}
|
|
2122
2076
|
} else {
|
|
2123
|
-
element.bib.style.position = "";
|
|
2124
|
-
element.bib.removeAttribute("isfullscreen");
|
|
2125
|
-
element.isBibFullscreen = false;
|
|
2126
|
-
element.style.contain = "layout";
|
|
2077
|
+
this.element.bib.style.position = "";
|
|
2078
|
+
this.element.bib.removeAttribute("isfullscreen");
|
|
2079
|
+
this.element.isBibFullscreen = false;
|
|
2080
|
+
this.element.style.contain = "layout";
|
|
2127
2081
|
}
|
|
2128
2082
|
|
|
2129
2083
|
const isChanged = this.strategy && this.strategy !== value;
|
|
@@ -2141,21 +2095,16 @@ class AuroFloatingUI {
|
|
|
2141
2095
|
},
|
|
2142
2096
|
);
|
|
2143
2097
|
|
|
2144
|
-
element.dispatchEvent(event);
|
|
2098
|
+
this.element.dispatchEvent(event);
|
|
2145
2099
|
}
|
|
2146
2100
|
}
|
|
2147
2101
|
|
|
2148
2102
|
updateState() {
|
|
2149
|
-
const
|
|
2150
|
-
if (!element) {
|
|
2151
|
-
return;
|
|
2152
|
-
}
|
|
2153
|
-
|
|
2154
|
-
const isVisible = element.isPopoverVisible;
|
|
2103
|
+
const isVisible = this.element.isPopoverVisible;
|
|
2155
2104
|
if (!isVisible) {
|
|
2156
2105
|
this.cleanupHideHandlers();
|
|
2157
2106
|
try {
|
|
2158
|
-
element.cleanup?.();
|
|
2107
|
+
this.element.cleanup?.();
|
|
2159
2108
|
} catch (error) {
|
|
2160
2109
|
// Do nothing
|
|
2161
2110
|
}
|
|
@@ -2171,30 +2120,28 @@ class AuroFloatingUI {
|
|
|
2171
2120
|
* If not, and if the bib isn't in fullscreen mode with focus lost, it hides the bib.
|
|
2172
2121
|
*/
|
|
2173
2122
|
handleFocusLoss() {
|
|
2174
|
-
const element = this.element;
|
|
2175
|
-
if (!element?.bib) {
|
|
2176
|
-
return;
|
|
2177
|
-
}
|
|
2178
|
-
|
|
2179
2123
|
// if mouse is being pressed, skip and let click event to handle the action
|
|
2180
2124
|
if (AuroFloatingUI.isMousePressed) {
|
|
2181
2125
|
return;
|
|
2182
2126
|
}
|
|
2183
2127
|
|
|
2184
2128
|
if (
|
|
2185
|
-
element.noHideOnThisFocusLoss ||
|
|
2186
|
-
element.hasAttribute("noHideOnThisFocusLoss")
|
|
2129
|
+
this.element.noHideOnThisFocusLoss ||
|
|
2130
|
+
this.element.hasAttribute("noHideOnThisFocusLoss")
|
|
2187
2131
|
) {
|
|
2188
2132
|
return;
|
|
2189
2133
|
}
|
|
2190
2134
|
|
|
2191
2135
|
// if focus is still inside of trigger or bib, do not close
|
|
2192
|
-
if (
|
|
2136
|
+
if (
|
|
2137
|
+
this.element.matches(":focus") ||
|
|
2138
|
+
this.element.matches(":focus-within")
|
|
2139
|
+
) {
|
|
2193
2140
|
return;
|
|
2194
2141
|
}
|
|
2195
2142
|
|
|
2196
2143
|
// if fullscreen bib is in fullscreen mode, do not close
|
|
2197
|
-
if (element.bib.hasAttribute("isfullscreen")) {
|
|
2144
|
+
if (this.element.bib.hasAttribute("isfullscreen")) {
|
|
2198
2145
|
return;
|
|
2199
2146
|
}
|
|
2200
2147
|
|
|
@@ -2202,32 +2149,23 @@ class AuroFloatingUI {
|
|
|
2202
2149
|
}
|
|
2203
2150
|
|
|
2204
2151
|
setupHideHandlers() {
|
|
2205
|
-
if (!this.element) {
|
|
2206
|
-
return;
|
|
2207
|
-
}
|
|
2208
|
-
|
|
2209
2152
|
// Define handlers & store references
|
|
2210
2153
|
this.focusHandler = () => this.handleFocusLoss();
|
|
2211
2154
|
|
|
2212
2155
|
this.clickHandler = (evt) => {
|
|
2213
|
-
const element = this.element;
|
|
2214
|
-
if (!element?.bib) {
|
|
2215
|
-
return;
|
|
2216
|
-
}
|
|
2217
|
-
|
|
2218
2156
|
// When the bib is fullscreen (modal dialog), don't close on outside
|
|
2219
2157
|
// clicks. VoiceOver's synthetic click events inside a top-layer modal
|
|
2220
2158
|
// <dialog> may not include the bib in composedPath(), causing false
|
|
2221
2159
|
// positives. This mirrors the fullscreen guard in handleFocusLoss().
|
|
2222
|
-
if (element.bib.hasAttribute("isfullscreen")) {
|
|
2160
|
+
if (this.element.bib && this.element.bib.hasAttribute("isfullscreen")) {
|
|
2223
2161
|
return;
|
|
2224
2162
|
}
|
|
2225
2163
|
|
|
2226
2164
|
if (
|
|
2227
|
-
(!evt.composedPath().includes(element.trigger) &&
|
|
2228
|
-
!evt.composedPath().includes(element.bib)) ||
|
|
2229
|
-
(element.bib.backdrop &&
|
|
2230
|
-
evt.composedPath().includes(element.bib.backdrop))
|
|
2165
|
+
(!evt.composedPath().includes(this.element.trigger) &&
|
|
2166
|
+
!evt.composedPath().includes(this.element.bib)) ||
|
|
2167
|
+
(this.element.bib.backdrop &&
|
|
2168
|
+
evt.composedPath().includes(this.element.bib.backdrop))
|
|
2231
2169
|
) {
|
|
2232
2170
|
const existedVisibleFloatingUI =
|
|
2233
2171
|
document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
@@ -2248,12 +2186,7 @@ class AuroFloatingUI {
|
|
|
2248
2186
|
|
|
2249
2187
|
// ESC key handler
|
|
2250
2188
|
this.keyDownHandler = (evt) => {
|
|
2251
|
-
|
|
2252
|
-
if (!element) {
|
|
2253
|
-
return;
|
|
2254
|
-
}
|
|
2255
|
-
|
|
2256
|
-
if (evt.key === "Escape" && element.isPopoverVisible) {
|
|
2189
|
+
if (evt.key === "Escape" && this.element.isPopoverVisible) {
|
|
2257
2190
|
const existedVisibleFloatingUI =
|
|
2258
2191
|
document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
2259
2192
|
if (
|
|
@@ -2310,10 +2243,6 @@ class AuroFloatingUI {
|
|
|
2310
2243
|
}
|
|
2311
2244
|
|
|
2312
2245
|
updateCurrentExpandedDropdown() {
|
|
2313
|
-
if (!this.element) {
|
|
2314
|
-
return;
|
|
2315
|
-
}
|
|
2316
|
-
|
|
2317
2246
|
// Close any other dropdown that is already open
|
|
2318
2247
|
const existedVisibleFloatingUI =
|
|
2319
2248
|
document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
@@ -2330,34 +2259,25 @@ class AuroFloatingUI {
|
|
|
2330
2259
|
}
|
|
2331
2260
|
|
|
2332
2261
|
showBib() {
|
|
2333
|
-
|
|
2334
|
-
if (!element) {
|
|
2335
|
-
return;
|
|
2336
|
-
}
|
|
2337
|
-
|
|
2338
|
-
if (!element.disabled && !this.showing) {
|
|
2262
|
+
if (!this.element.disabled && !this.showing) {
|
|
2339
2263
|
this.updateCurrentExpandedDropdown();
|
|
2340
|
-
element.triggerChevron?.setAttribute("data-expanded", true);
|
|
2264
|
+
this.element.triggerChevron?.setAttribute("data-expanded", true);
|
|
2341
2265
|
|
|
2342
2266
|
// prevent double showing: isPopovervisible gets first and showBib gets called later
|
|
2343
2267
|
if (!this.showing) {
|
|
2344
|
-
if (!element.modal) {
|
|
2268
|
+
if (!this.element.modal) {
|
|
2345
2269
|
this.setupHideHandlers();
|
|
2346
2270
|
}
|
|
2347
2271
|
this.showing = true;
|
|
2348
|
-
element.isPopoverVisible = true;
|
|
2272
|
+
this.element.isPopoverVisible = true;
|
|
2349
2273
|
this.position();
|
|
2350
2274
|
this.dispatchEventDropdownToggle();
|
|
2351
2275
|
}
|
|
2352
2276
|
|
|
2353
|
-
if (!element.bib || (!element.trigger && !element.parentNode)) {
|
|
2354
|
-
return;
|
|
2355
|
-
}
|
|
2356
|
-
|
|
2357
2277
|
// Setup auto update to handle resize and scroll
|
|
2358
|
-
element.cleanup = autoUpdate(
|
|
2359
|
-
element.trigger || element.parentNode,
|
|
2360
|
-
element.bib,
|
|
2278
|
+
this.element.cleanup = autoUpdate(
|
|
2279
|
+
this.element.trigger || this.element.parentNode,
|
|
2280
|
+
this.element.bib,
|
|
2361
2281
|
() => {
|
|
2362
2282
|
this.position();
|
|
2363
2283
|
},
|
|
@@ -2370,27 +2290,22 @@ class AuroFloatingUI {
|
|
|
2370
2290
|
* @param {String} eventType - The event type that triggered the hiding action.
|
|
2371
2291
|
*/
|
|
2372
2292
|
hideBib(eventType = "unknown") {
|
|
2373
|
-
|
|
2374
|
-
if (!element) {
|
|
2375
|
-
return;
|
|
2376
|
-
}
|
|
2377
|
-
|
|
2378
|
-
if (element.disabled) {
|
|
2293
|
+
if (this.element.disabled) {
|
|
2379
2294
|
return;
|
|
2380
2295
|
}
|
|
2381
2296
|
|
|
2382
2297
|
// noToggle dropdowns should not close when the trigger is clicked (the
|
|
2383
2298
|
// "toggle" behavior), but they CAN still close via other interactions like
|
|
2384
2299
|
// Escape key or focus loss.
|
|
2385
|
-
if (element.noToggle && eventType === "click") {
|
|
2300
|
+
if (this.element.noToggle && eventType === "click") {
|
|
2386
2301
|
return;
|
|
2387
2302
|
}
|
|
2388
2303
|
|
|
2389
2304
|
this.lockScroll(false);
|
|
2390
|
-
element.triggerChevron?.removeAttribute("data-expanded");
|
|
2305
|
+
this.element.triggerChevron?.removeAttribute("data-expanded");
|
|
2391
2306
|
|
|
2392
|
-
if (element.isPopoverVisible) {
|
|
2393
|
-
element.isPopoverVisible = false;
|
|
2307
|
+
if (this.element.isPopoverVisible) {
|
|
2308
|
+
this.element.isPopoverVisible = false;
|
|
2394
2309
|
}
|
|
2395
2310
|
if (this.showing) {
|
|
2396
2311
|
this.cleanupHideHandlers();
|
|
@@ -2410,11 +2325,6 @@ class AuroFloatingUI {
|
|
|
2410
2325
|
* @param {String} eventType - The event type that triggered the toggle action.
|
|
2411
2326
|
*/
|
|
2412
2327
|
dispatchEventDropdownToggle(eventType) {
|
|
2413
|
-
const element = this.element;
|
|
2414
|
-
if (!element) {
|
|
2415
|
-
return;
|
|
2416
|
-
}
|
|
2417
|
-
|
|
2418
2328
|
const event = new CustomEvent(
|
|
2419
2329
|
this.eventPrefix ? `${this.eventPrefix}-toggled` : "toggled",
|
|
2420
2330
|
{
|
|
@@ -2426,16 +2336,11 @@ class AuroFloatingUI {
|
|
|
2426
2336
|
},
|
|
2427
2337
|
);
|
|
2428
2338
|
|
|
2429
|
-
element.dispatchEvent(event);
|
|
2339
|
+
this.element.dispatchEvent(event);
|
|
2430
2340
|
}
|
|
2431
2341
|
|
|
2432
2342
|
handleClick() {
|
|
2433
|
-
|
|
2434
|
-
if (!element) {
|
|
2435
|
-
return;
|
|
2436
|
-
}
|
|
2437
|
-
|
|
2438
|
-
if (element.isPopoverVisible) {
|
|
2343
|
+
if (this.element.isPopoverVisible) {
|
|
2439
2344
|
this.hideBib("click");
|
|
2440
2345
|
} else {
|
|
2441
2346
|
this.showBib();
|
|
@@ -2446,66 +2351,63 @@ class AuroFloatingUI {
|
|
|
2446
2351
|
{
|
|
2447
2352
|
composed: true,
|
|
2448
2353
|
detail: {
|
|
2449
|
-
expanded: element.isPopoverVisible,
|
|
2354
|
+
expanded: this.element.isPopoverVisible,
|
|
2450
2355
|
},
|
|
2451
2356
|
},
|
|
2452
2357
|
);
|
|
2453
2358
|
|
|
2454
|
-
element.dispatchEvent(event);
|
|
2359
|
+
this.element.dispatchEvent(event);
|
|
2455
2360
|
}
|
|
2456
2361
|
|
|
2457
2362
|
handleEvent(event) {
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
event.preventDefault();
|
|
2474
|
-
this.handleClick();
|
|
2363
|
+
if (!this.element.disableEventShow) {
|
|
2364
|
+
switch (event.type) {
|
|
2365
|
+
case "keydown": {
|
|
2366
|
+
// Support both Enter and Space keys for accessibility
|
|
2367
|
+
// Space is included as it's expected behavior for interactive elements
|
|
2368
|
+
|
|
2369
|
+
const origin = event.composedPath()[0];
|
|
2370
|
+
if (
|
|
2371
|
+
event.key === "Enter" ||
|
|
2372
|
+
(event.key === " " && (!origin || origin.tagName !== "INPUT"))
|
|
2373
|
+
) {
|
|
2374
|
+
event.preventDefault();
|
|
2375
|
+
this.handleClick();
|
|
2376
|
+
}
|
|
2377
|
+
break;
|
|
2475
2378
|
}
|
|
2476
|
-
|
|
2379
|
+
case "mouseenter":
|
|
2380
|
+
if (this.element.hoverToggle) {
|
|
2381
|
+
this.showBib();
|
|
2382
|
+
}
|
|
2383
|
+
break;
|
|
2384
|
+
case "mouseleave":
|
|
2385
|
+
if (this.element.hoverToggle) {
|
|
2386
|
+
this.hideBib("mouseleave");
|
|
2387
|
+
}
|
|
2388
|
+
break;
|
|
2389
|
+
case "focus":
|
|
2390
|
+
if (this.element.focusShow) {
|
|
2391
|
+
/*
|
|
2392
|
+
This needs to better handle clicking that gives focus -
|
|
2393
|
+
currently it shows and then immediately hides the bib
|
|
2394
|
+
*/
|
|
2395
|
+
this.showBib();
|
|
2396
|
+
}
|
|
2397
|
+
break;
|
|
2398
|
+
case "blur":
|
|
2399
|
+
// send this task 100ms later queue to
|
|
2400
|
+
// wait a frame in case focus moves within the floating element/bib
|
|
2401
|
+
setTimeout(() => this.handleFocusLoss(), 0);
|
|
2402
|
+
break;
|
|
2403
|
+
case "click":
|
|
2404
|
+
if (document.activeElement === document.body) {
|
|
2405
|
+
event.currentTarget.focus();
|
|
2406
|
+
}
|
|
2407
|
+
this.handleClick();
|
|
2408
|
+
break;
|
|
2409
|
+
// Do nothing
|
|
2477
2410
|
}
|
|
2478
|
-
case "mouseenter":
|
|
2479
|
-
if (element.hoverToggle) {
|
|
2480
|
-
this.showBib();
|
|
2481
|
-
}
|
|
2482
|
-
break;
|
|
2483
|
-
case "mouseleave":
|
|
2484
|
-
if (element.hoverToggle) {
|
|
2485
|
-
this.hideBib("mouseleave");
|
|
2486
|
-
}
|
|
2487
|
-
break;
|
|
2488
|
-
case "focus":
|
|
2489
|
-
if (element.focusShow) {
|
|
2490
|
-
/*
|
|
2491
|
-
This needs to better handle clicking that gives focus -
|
|
2492
|
-
currently it shows and then immediately hides the bib
|
|
2493
|
-
*/
|
|
2494
|
-
this.showBib();
|
|
2495
|
-
}
|
|
2496
|
-
break;
|
|
2497
|
-
case "blur":
|
|
2498
|
-
// send this task 100ms later queue to
|
|
2499
|
-
// wait a frame in case focus moves within the floating element/bib
|
|
2500
|
-
setTimeout(() => this.handleFocusLoss(), 0);
|
|
2501
|
-
break;
|
|
2502
|
-
case "click":
|
|
2503
|
-
if (document.activeElement === document.body) {
|
|
2504
|
-
event.currentTarget.focus();
|
|
2505
|
-
}
|
|
2506
|
-
this.handleClick();
|
|
2507
|
-
break;
|
|
2508
|
-
// Do nothing
|
|
2509
2411
|
}
|
|
2510
2412
|
}
|
|
2511
2413
|
|
|
@@ -2516,11 +2418,6 @@ class AuroFloatingUI {
|
|
|
2516
2418
|
* This prevents the component itself from being focusable when the trigger element already handles focus.
|
|
2517
2419
|
*/
|
|
2518
2420
|
handleTriggerTabIndex() {
|
|
2519
|
-
const element = this.element;
|
|
2520
|
-
if (!element) {
|
|
2521
|
-
return;
|
|
2522
|
-
}
|
|
2523
|
-
|
|
2524
2421
|
const focusableElementSelectors = [
|
|
2525
2422
|
"a",
|
|
2526
2423
|
"button",
|
|
@@ -2533,7 +2430,7 @@ class AuroFloatingUI {
|
|
|
2533
2430
|
"auro-hyperlink",
|
|
2534
2431
|
];
|
|
2535
2432
|
|
|
2536
|
-
const triggerNode = element.querySelectorAll('[slot="trigger"]')[0];
|
|
2433
|
+
const triggerNode = this.element.querySelectorAll('[slot="trigger"]')[0];
|
|
2537
2434
|
if (!triggerNode) {
|
|
2538
2435
|
return;
|
|
2539
2436
|
}
|
|
@@ -2542,13 +2439,13 @@ class AuroFloatingUI {
|
|
|
2542
2439
|
focusableElementSelectors.forEach((selector) => {
|
|
2543
2440
|
// Check if the trigger node element is focusable
|
|
2544
2441
|
if (triggerNodeTagName === selector) {
|
|
2545
|
-
element.tabIndex = -1;
|
|
2442
|
+
this.element.tabIndex = -1;
|
|
2546
2443
|
return;
|
|
2547
2444
|
}
|
|
2548
2445
|
|
|
2549
2446
|
// Check if any child is focusable
|
|
2550
2447
|
if (triggerNode.querySelector(selector)) {
|
|
2551
|
-
element.tabIndex = -1;
|
|
2448
|
+
this.element.tabIndex = -1;
|
|
2552
2449
|
}
|
|
2553
2450
|
});
|
|
2554
2451
|
}
|
|
@@ -2558,18 +2455,13 @@ class AuroFloatingUI {
|
|
|
2558
2455
|
* @param {*} eventPrefix
|
|
2559
2456
|
*/
|
|
2560
2457
|
regenerateBibId() {
|
|
2561
|
-
|
|
2562
|
-
if (!element) {
|
|
2563
|
-
return;
|
|
2564
|
-
}
|
|
2565
|
-
|
|
2566
|
-
this.id = element.getAttribute("id");
|
|
2458
|
+
this.id = this.element.getAttribute("id");
|
|
2567
2459
|
if (!this.id) {
|
|
2568
2460
|
this.id = window.crypto.randomUUID();
|
|
2569
|
-
element.setAttribute("id", this.id);
|
|
2461
|
+
this.element.setAttribute("id", this.id);
|
|
2570
2462
|
}
|
|
2571
2463
|
|
|
2572
|
-
element.bib
|
|
2464
|
+
this.element.bib.setAttribute("id", `${this.id}-floater-bib`);
|
|
2573
2465
|
}
|
|
2574
2466
|
|
|
2575
2467
|
configure(elem, eventPrefix, enableKeyboardHandling = true) {
|
|
@@ -2581,69 +2473,67 @@ class AuroFloatingUI {
|
|
|
2581
2473
|
this.element = elem;
|
|
2582
2474
|
}
|
|
2583
2475
|
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
return;
|
|
2476
|
+
if (this.behavior !== this.element.behavior) {
|
|
2477
|
+
this.behavior = this.element.behavior;
|
|
2587
2478
|
}
|
|
2588
2479
|
|
|
2589
|
-
if (this.
|
|
2590
|
-
this.behavior = element.behavior;
|
|
2591
|
-
}
|
|
2592
|
-
|
|
2593
|
-
if (element.trigger) {
|
|
2480
|
+
if (this.element.trigger) {
|
|
2594
2481
|
this.disconnect();
|
|
2595
2482
|
}
|
|
2596
|
-
element.trigger =
|
|
2597
|
-
element.triggerElement ||
|
|
2598
|
-
element.shadowRoot
|
|
2599
|
-
element.trigger;
|
|
2600
|
-
element.bib =
|
|
2601
|
-
|
|
2602
|
-
element.
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2483
|
+
this.element.trigger =
|
|
2484
|
+
this.element.triggerElement ||
|
|
2485
|
+
this.element.shadowRoot.querySelector("#trigger") ||
|
|
2486
|
+
this.element.trigger;
|
|
2487
|
+
this.element.bib =
|
|
2488
|
+
this.element.shadowRoot.querySelector("#bib") || this.element.bib;
|
|
2489
|
+
this.element.bibSizer = this.element.shadowRoot.querySelector("#bibSizer");
|
|
2490
|
+
this.element.triggerChevron =
|
|
2491
|
+
this.element.shadowRoot.querySelector("#showStateIcon");
|
|
2492
|
+
|
|
2493
|
+
if (this.element.floaterConfig) {
|
|
2494
|
+
this.element.hoverToggle = this.element.floaterConfig.hoverToggle;
|
|
2607
2495
|
}
|
|
2608
2496
|
|
|
2609
2497
|
this.regenerateBibId();
|
|
2610
2498
|
this.handleTriggerTabIndex();
|
|
2611
2499
|
|
|
2612
2500
|
this.handleEvent = this.handleEvent.bind(this);
|
|
2613
|
-
if (element.trigger) {
|
|
2501
|
+
if (this.element.trigger) {
|
|
2614
2502
|
if (this.enableKeyboardHandling) {
|
|
2615
|
-
element.trigger.addEventListener("keydown", this.handleEvent);
|
|
2503
|
+
this.element.trigger.addEventListener("keydown", this.handleEvent);
|
|
2616
2504
|
}
|
|
2617
|
-
element.trigger.addEventListener("click", this.handleEvent);
|
|
2618
|
-
element.trigger.addEventListener("mouseenter", this.handleEvent);
|
|
2619
|
-
element.trigger.addEventListener("mouseleave", this.handleEvent);
|
|
2620
|
-
element.trigger.addEventListener("focus", this.handleEvent);
|
|
2621
|
-
element.trigger.addEventListener("blur", this.handleEvent);
|
|
2505
|
+
this.element.trigger.addEventListener("click", this.handleEvent);
|
|
2506
|
+
this.element.trigger.addEventListener("mouseenter", this.handleEvent);
|
|
2507
|
+
this.element.trigger.addEventListener("mouseleave", this.handleEvent);
|
|
2508
|
+
this.element.trigger.addEventListener("focus", this.handleEvent);
|
|
2509
|
+
this.element.trigger.addEventListener("blur", this.handleEvent);
|
|
2622
2510
|
}
|
|
2623
2511
|
}
|
|
2624
2512
|
|
|
2625
2513
|
disconnect() {
|
|
2626
2514
|
this.cleanupHideHandlers();
|
|
2515
|
+
if (this.element) {
|
|
2516
|
+
this.element.cleanup?.();
|
|
2627
2517
|
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
}
|
|
2632
|
-
|
|
2633
|
-
element.cleanup?.();
|
|
2634
|
-
|
|
2635
|
-
if (element.bib && element.shadowRoot) {
|
|
2636
|
-
element.shadowRoot.append(element.bib);
|
|
2637
|
-
}
|
|
2518
|
+
if (this.element.bib) {
|
|
2519
|
+
this.element.shadowRoot.append(this.element.bib);
|
|
2520
|
+
}
|
|
2638
2521
|
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2522
|
+
// Remove event & keyboard listeners
|
|
2523
|
+
if (this.element?.trigger) {
|
|
2524
|
+
this.element.trigger.removeEventListener("keydown", this.handleEvent);
|
|
2525
|
+
this.element.trigger.removeEventListener("click", this.handleEvent);
|
|
2526
|
+
this.element.trigger.removeEventListener(
|
|
2527
|
+
"mouseenter",
|
|
2528
|
+
this.handleEvent,
|
|
2529
|
+
);
|
|
2530
|
+
this.element.trigger.removeEventListener(
|
|
2531
|
+
"mouseleave",
|
|
2532
|
+
this.handleEvent,
|
|
2533
|
+
);
|
|
2534
|
+
this.element.trigger.removeEventListener("focus", this.handleEvent);
|
|
2535
|
+
this.element.trigger.removeEventListener("blur", this.handleEvent);
|
|
2536
|
+
}
|
|
2647
2537
|
}
|
|
2648
2538
|
}
|
|
2649
2539
|
}
|
|
@@ -3802,7 +3692,7 @@ class AuroHelpText extends i {
|
|
|
3802
3692
|
}
|
|
3803
3693
|
}
|
|
3804
3694
|
|
|
3805
|
-
var formkitVersion = '
|
|
3695
|
+
var formkitVersion = '202604071525';
|
|
3806
3696
|
|
|
3807
3697
|
class AuroElement extends i {
|
|
3808
3698
|
static get properties() {
|