@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
|
@@ -1840,19 +1840,11 @@ class AuroFloatingUI {
|
|
|
1840
1840
|
* This ensures that the bib content has the same dimensions as the sizer element.
|
|
1841
1841
|
*/
|
|
1842
1842
|
mirrorSize() {
|
|
1843
|
-
const element = this.element;
|
|
1844
|
-
if (!element) {
|
|
1845
|
-
return;
|
|
1846
|
-
}
|
|
1847
|
-
|
|
1848
1843
|
// mirror the boxsize from bibSizer
|
|
1849
|
-
if (element.bibSizer && element.matchWidth
|
|
1850
|
-
const sizerStyle = window.getComputedStyle(element.bibSizer);
|
|
1851
|
-
const bibContent =
|
|
1852
|
-
|
|
1853
|
-
return;
|
|
1854
|
-
}
|
|
1855
|
-
|
|
1844
|
+
if (this.element.bibSizer && this.element.matchWidth) {
|
|
1845
|
+
const sizerStyle = window.getComputedStyle(this.element.bibSizer);
|
|
1846
|
+
const bibContent =
|
|
1847
|
+
this.element.bib.shadowRoot.querySelector(".container");
|
|
1856
1848
|
if (sizerStyle.width !== "0px") {
|
|
1857
1849
|
bibContent.style.width = sizerStyle.width;
|
|
1858
1850
|
}
|
|
@@ -1874,14 +1866,9 @@ class AuroFloatingUI {
|
|
|
1874
1866
|
* @returns {String} The positioning strategy, one of 'fullscreen', 'floating', 'cover'.
|
|
1875
1867
|
*/
|
|
1876
1868
|
getPositioningStrategy() {
|
|
1877
|
-
const element = this.element;
|
|
1878
|
-
if (!element) {
|
|
1879
|
-
return this.behavior || "floating";
|
|
1880
|
-
}
|
|
1881
|
-
|
|
1882
1869
|
const breakpoint =
|
|
1883
|
-
element.bib
|
|
1884
|
-
element.floaterConfig?.fullscreenBreakpoint;
|
|
1870
|
+
this.element.bib.mobileFullscreenBreakpoint ||
|
|
1871
|
+
this.element.floaterConfig?.fullscreenBreakpoint;
|
|
1885
1872
|
switch (this.behavior) {
|
|
1886
1873
|
case "tooltip":
|
|
1887
1874
|
return "floating";
|
|
@@ -1892,9 +1879,9 @@ class AuroFloatingUI {
|
|
|
1892
1879
|
`(max-width: ${breakpoint})`,
|
|
1893
1880
|
).matches;
|
|
1894
1881
|
|
|
1895
|
-
element.expanded = smallerThanBreakpoint;
|
|
1882
|
+
this.element.expanded = smallerThanBreakpoint;
|
|
1896
1883
|
}
|
|
1897
|
-
if (element.nested) {
|
|
1884
|
+
if (this.element.nested) {
|
|
1898
1885
|
return "cover";
|
|
1899
1886
|
}
|
|
1900
1887
|
return "fullscreen";
|
|
@@ -1924,65 +1911,42 @@ class AuroFloatingUI {
|
|
|
1924
1911
|
* and applies the calculated position to the bib's style.
|
|
1925
1912
|
*/
|
|
1926
1913
|
position() {
|
|
1927
|
-
const element = this.element;
|
|
1928
|
-
if (!element) {
|
|
1929
|
-
return;
|
|
1930
|
-
}
|
|
1931
|
-
|
|
1932
1914
|
const strategy = this.getPositioningStrategy();
|
|
1933
1915
|
this.configureBibStrategy(strategy);
|
|
1934
1916
|
|
|
1935
1917
|
if (strategy === "floating") {
|
|
1936
|
-
if (!element.trigger || !element.bib) {
|
|
1937
|
-
return;
|
|
1938
|
-
}
|
|
1939
|
-
|
|
1940
1918
|
this.mirrorSize();
|
|
1941
1919
|
// Define the middlware for the floater configuration
|
|
1942
1920
|
const middleware = [
|
|
1943
|
-
offset(element.floaterConfig?.offset || 0),
|
|
1944
|
-
...(element.floaterConfig?.shift ? [shift()] : []), // Add shift middleware if shift is enabled.
|
|
1945
|
-
...(element.floaterConfig?.flip ? [flip()] : []), // Add flip middleware if flip is enabled.
|
|
1946
|
-
...(element.floaterConfig?.autoPlacement ? [autoPlacement()] : []), // Add autoPlacement middleware if autoPlacement is enabled.
|
|
1921
|
+
offset(this.element.floaterConfig?.offset || 0),
|
|
1922
|
+
...(this.element.floaterConfig?.shift ? [shift()] : []), // Add shift middleware if shift is enabled.
|
|
1923
|
+
...(this.element.floaterConfig?.flip ? [flip()] : []), // Add flip middleware if flip is enabled.
|
|
1924
|
+
...(this.element.floaterConfig?.autoPlacement ? [autoPlacement()] : []), // Add autoPlacement middleware if autoPlacement is enabled.
|
|
1947
1925
|
];
|
|
1948
1926
|
|
|
1949
1927
|
// Compute the position of the bib
|
|
1950
|
-
computePosition(element.trigger, element.bib, {
|
|
1951
|
-
strategy: element.floaterConfig?.strategy || "fixed",
|
|
1952
|
-
placement: element.floaterConfig?.placement,
|
|
1928
|
+
computePosition(this.element.trigger, this.element.bib, {
|
|
1929
|
+
strategy: this.element.floaterConfig?.strategy || "fixed",
|
|
1930
|
+
placement: this.element.floaterConfig?.placement,
|
|
1953
1931
|
middleware: middleware || [],
|
|
1954
1932
|
}).then(({ x, y }) => {
|
|
1955
1933
|
// eslint-disable-line id-length
|
|
1956
|
-
|
|
1957
|
-
if (!currentElement?.bib) {
|
|
1958
|
-
return;
|
|
1959
|
-
}
|
|
1960
|
-
|
|
1961
|
-
Object.assign(currentElement.bib.style, {
|
|
1934
|
+
Object.assign(this.element.bib.style, {
|
|
1962
1935
|
left: `${x}px`,
|
|
1963
1936
|
top: `${y}px`,
|
|
1964
1937
|
});
|
|
1965
1938
|
});
|
|
1966
1939
|
} else if (strategy === "cover") {
|
|
1967
|
-
if (!element.parentNode || !element.bib) {
|
|
1968
|
-
return;
|
|
1969
|
-
}
|
|
1970
|
-
|
|
1971
1940
|
// Compute the position of the bib
|
|
1972
|
-
computePosition(element.parentNode, element.bib, {
|
|
1941
|
+
computePosition(this.element.parentNode, this.element.bib, {
|
|
1973
1942
|
placement: "bottom-start",
|
|
1974
1943
|
}).then(({ x, y }) => {
|
|
1975
1944
|
// eslint-disable-line id-length
|
|
1976
|
-
|
|
1977
|
-
if (!currentElement?.bib || !currentElement.parentNode) {
|
|
1978
|
-
return;
|
|
1979
|
-
}
|
|
1980
|
-
|
|
1981
|
-
Object.assign(currentElement.bib.style, {
|
|
1945
|
+
Object.assign(this.element.bib.style, {
|
|
1982
1946
|
left: `${x}px`,
|
|
1983
|
-
top: `${y -
|
|
1984
|
-
width: `${
|
|
1985
|
-
height: `${
|
|
1947
|
+
top: `${y - this.element.parentNode.offsetHeight}px`,
|
|
1948
|
+
width: `${this.element.parentNode.offsetWidth}px`,
|
|
1949
|
+
height: `${this.element.parentNode.offsetHeight}px`,
|
|
1986
1950
|
});
|
|
1987
1951
|
});
|
|
1988
1952
|
}
|
|
@@ -1994,17 +1958,11 @@ class AuroFloatingUI {
|
|
|
1994
1958
|
* @param {Boolean} lock - If true, locks the body's scrolling functionlity; otherwise, unlock.
|
|
1995
1959
|
*/
|
|
1996
1960
|
lockScroll(lock = true) {
|
|
1997
|
-
const element = this.element;
|
|
1998
|
-
|
|
1999
1961
|
if (lock) {
|
|
2000
|
-
if (!element?.bib) {
|
|
2001
|
-
return;
|
|
2002
|
-
}
|
|
2003
|
-
|
|
2004
1962
|
document.body.style.overflow = "hidden"; // hide body's scrollbar
|
|
2005
1963
|
|
|
2006
1964
|
// Move `bib` by the amount the viewport is shifted to stay aligned in fullscreen.
|
|
2007
|
-
element.bib.style.transform = `translateY(${window?.visualViewport?.offsetTop}px)`;
|
|
1965
|
+
this.element.bib.style.transform = `translateY(${window?.visualViewport?.offsetTop}px)`;
|
|
2008
1966
|
} else {
|
|
2009
1967
|
document.body.style.overflow = "";
|
|
2010
1968
|
}
|
|
@@ -2020,24 +1978,20 @@ class AuroFloatingUI {
|
|
|
2020
1978
|
* @param {string} strategy - The positioning strategy ('fullscreen' or 'floating').
|
|
2021
1979
|
*/
|
|
2022
1980
|
configureBibStrategy(value) {
|
|
2023
|
-
const element = this.element;
|
|
2024
|
-
if (!element?.bib) {
|
|
2025
|
-
return;
|
|
2026
|
-
}
|
|
2027
|
-
|
|
2028
1981
|
if (value === "fullscreen") {
|
|
2029
|
-
element.isBibFullscreen = true;
|
|
1982
|
+
this.element.isBibFullscreen = true;
|
|
2030
1983
|
// reset the prev position
|
|
2031
|
-
element.bib.setAttribute("isfullscreen", "");
|
|
2032
|
-
element.bib.style.position = "fixed";
|
|
2033
|
-
element.bib.style.top = "0px";
|
|
2034
|
-
element.bib.style.left = "0px";
|
|
2035
|
-
element.bib.style.width = "";
|
|
2036
|
-
element.bib.style.height = "";
|
|
2037
|
-
element.style.contain = "";
|
|
1984
|
+
this.element.bib.setAttribute("isfullscreen", "");
|
|
1985
|
+
this.element.bib.style.position = "fixed";
|
|
1986
|
+
this.element.bib.style.top = "0px";
|
|
1987
|
+
this.element.bib.style.left = "0px";
|
|
1988
|
+
this.element.bib.style.width = "";
|
|
1989
|
+
this.element.bib.style.height = "";
|
|
1990
|
+
this.element.style.contain = "";
|
|
2038
1991
|
|
|
2039
1992
|
// reset the size that was mirroring `size` css-part
|
|
2040
|
-
const bibContent =
|
|
1993
|
+
const bibContent =
|
|
1994
|
+
this.element.bib.shadowRoot.querySelector(".container");
|
|
2041
1995
|
if (bibContent) {
|
|
2042
1996
|
bibContent.style.width = "";
|
|
2043
1997
|
bibContent.style.height = "";
|
|
@@ -2052,14 +2006,14 @@ class AuroFloatingUI {
|
|
|
2052
2006
|
}, 0);
|
|
2053
2007
|
}
|
|
2054
2008
|
|
|
2055
|
-
if (element.isPopoverVisible) {
|
|
2009
|
+
if (this.element.isPopoverVisible) {
|
|
2056
2010
|
this.lockScroll(true);
|
|
2057
2011
|
}
|
|
2058
2012
|
} else {
|
|
2059
|
-
element.bib.style.position = "";
|
|
2060
|
-
element.bib.removeAttribute("isfullscreen");
|
|
2061
|
-
element.isBibFullscreen = false;
|
|
2062
|
-
element.style.contain = "layout";
|
|
2013
|
+
this.element.bib.style.position = "";
|
|
2014
|
+
this.element.bib.removeAttribute("isfullscreen");
|
|
2015
|
+
this.element.isBibFullscreen = false;
|
|
2016
|
+
this.element.style.contain = "layout";
|
|
2063
2017
|
}
|
|
2064
2018
|
|
|
2065
2019
|
const isChanged = this.strategy && this.strategy !== value;
|
|
@@ -2077,21 +2031,16 @@ class AuroFloatingUI {
|
|
|
2077
2031
|
},
|
|
2078
2032
|
);
|
|
2079
2033
|
|
|
2080
|
-
element.dispatchEvent(event);
|
|
2034
|
+
this.element.dispatchEvent(event);
|
|
2081
2035
|
}
|
|
2082
2036
|
}
|
|
2083
2037
|
|
|
2084
2038
|
updateState() {
|
|
2085
|
-
const
|
|
2086
|
-
if (!element) {
|
|
2087
|
-
return;
|
|
2088
|
-
}
|
|
2089
|
-
|
|
2090
|
-
const isVisible = element.isPopoverVisible;
|
|
2039
|
+
const isVisible = this.element.isPopoverVisible;
|
|
2091
2040
|
if (!isVisible) {
|
|
2092
2041
|
this.cleanupHideHandlers();
|
|
2093
2042
|
try {
|
|
2094
|
-
element.cleanup?.();
|
|
2043
|
+
this.element.cleanup?.();
|
|
2095
2044
|
} catch (error) {
|
|
2096
2045
|
// Do nothing
|
|
2097
2046
|
}
|
|
@@ -2107,30 +2056,28 @@ class AuroFloatingUI {
|
|
|
2107
2056
|
* If not, and if the bib isn't in fullscreen mode with focus lost, it hides the bib.
|
|
2108
2057
|
*/
|
|
2109
2058
|
handleFocusLoss() {
|
|
2110
|
-
const element = this.element;
|
|
2111
|
-
if (!element?.bib) {
|
|
2112
|
-
return;
|
|
2113
|
-
}
|
|
2114
|
-
|
|
2115
2059
|
// if mouse is being pressed, skip and let click event to handle the action
|
|
2116
2060
|
if (AuroFloatingUI.isMousePressed) {
|
|
2117
2061
|
return;
|
|
2118
2062
|
}
|
|
2119
2063
|
|
|
2120
2064
|
if (
|
|
2121
|
-
element.noHideOnThisFocusLoss ||
|
|
2122
|
-
element.hasAttribute("noHideOnThisFocusLoss")
|
|
2065
|
+
this.element.noHideOnThisFocusLoss ||
|
|
2066
|
+
this.element.hasAttribute("noHideOnThisFocusLoss")
|
|
2123
2067
|
) {
|
|
2124
2068
|
return;
|
|
2125
2069
|
}
|
|
2126
2070
|
|
|
2127
2071
|
// if focus is still inside of trigger or bib, do not close
|
|
2128
|
-
if (
|
|
2072
|
+
if (
|
|
2073
|
+
this.element.matches(":focus") ||
|
|
2074
|
+
this.element.matches(":focus-within")
|
|
2075
|
+
) {
|
|
2129
2076
|
return;
|
|
2130
2077
|
}
|
|
2131
2078
|
|
|
2132
2079
|
// if fullscreen bib is in fullscreen mode, do not close
|
|
2133
|
-
if (element.bib.hasAttribute("isfullscreen")) {
|
|
2080
|
+
if (this.element.bib.hasAttribute("isfullscreen")) {
|
|
2134
2081
|
return;
|
|
2135
2082
|
}
|
|
2136
2083
|
|
|
@@ -2138,32 +2085,23 @@ class AuroFloatingUI {
|
|
|
2138
2085
|
}
|
|
2139
2086
|
|
|
2140
2087
|
setupHideHandlers() {
|
|
2141
|
-
if (!this.element) {
|
|
2142
|
-
return;
|
|
2143
|
-
}
|
|
2144
|
-
|
|
2145
2088
|
// Define handlers & store references
|
|
2146
2089
|
this.focusHandler = () => this.handleFocusLoss();
|
|
2147
2090
|
|
|
2148
2091
|
this.clickHandler = (evt) => {
|
|
2149
|
-
const element = this.element;
|
|
2150
|
-
if (!element?.bib) {
|
|
2151
|
-
return;
|
|
2152
|
-
}
|
|
2153
|
-
|
|
2154
2092
|
// When the bib is fullscreen (modal dialog), don't close on outside
|
|
2155
2093
|
// clicks. VoiceOver's synthetic click events inside a top-layer modal
|
|
2156
2094
|
// <dialog> may not include the bib in composedPath(), causing false
|
|
2157
2095
|
// positives. This mirrors the fullscreen guard in handleFocusLoss().
|
|
2158
|
-
if (element.bib.hasAttribute("isfullscreen")) {
|
|
2096
|
+
if (this.element.bib && this.element.bib.hasAttribute("isfullscreen")) {
|
|
2159
2097
|
return;
|
|
2160
2098
|
}
|
|
2161
2099
|
|
|
2162
2100
|
if (
|
|
2163
|
-
(!evt.composedPath().includes(element.trigger) &&
|
|
2164
|
-
!evt.composedPath().includes(element.bib)) ||
|
|
2165
|
-
(element.bib.backdrop &&
|
|
2166
|
-
evt.composedPath().includes(element.bib.backdrop))
|
|
2101
|
+
(!evt.composedPath().includes(this.element.trigger) &&
|
|
2102
|
+
!evt.composedPath().includes(this.element.bib)) ||
|
|
2103
|
+
(this.element.bib.backdrop &&
|
|
2104
|
+
evt.composedPath().includes(this.element.bib.backdrop))
|
|
2167
2105
|
) {
|
|
2168
2106
|
const existedVisibleFloatingUI =
|
|
2169
2107
|
document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
@@ -2184,12 +2122,7 @@ class AuroFloatingUI {
|
|
|
2184
2122
|
|
|
2185
2123
|
// ESC key handler
|
|
2186
2124
|
this.keyDownHandler = (evt) => {
|
|
2187
|
-
|
|
2188
|
-
if (!element) {
|
|
2189
|
-
return;
|
|
2190
|
-
}
|
|
2191
|
-
|
|
2192
|
-
if (evt.key === "Escape" && element.isPopoverVisible) {
|
|
2125
|
+
if (evt.key === "Escape" && this.element.isPopoverVisible) {
|
|
2193
2126
|
const existedVisibleFloatingUI =
|
|
2194
2127
|
document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
2195
2128
|
if (
|
|
@@ -2246,10 +2179,6 @@ class AuroFloatingUI {
|
|
|
2246
2179
|
}
|
|
2247
2180
|
|
|
2248
2181
|
updateCurrentExpandedDropdown() {
|
|
2249
|
-
if (!this.element) {
|
|
2250
|
-
return;
|
|
2251
|
-
}
|
|
2252
|
-
|
|
2253
2182
|
// Close any other dropdown that is already open
|
|
2254
2183
|
const existedVisibleFloatingUI =
|
|
2255
2184
|
document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
@@ -2266,34 +2195,25 @@ class AuroFloatingUI {
|
|
|
2266
2195
|
}
|
|
2267
2196
|
|
|
2268
2197
|
showBib() {
|
|
2269
|
-
|
|
2270
|
-
if (!element) {
|
|
2271
|
-
return;
|
|
2272
|
-
}
|
|
2273
|
-
|
|
2274
|
-
if (!element.disabled && !this.showing) {
|
|
2198
|
+
if (!this.element.disabled && !this.showing) {
|
|
2275
2199
|
this.updateCurrentExpandedDropdown();
|
|
2276
|
-
element.triggerChevron?.setAttribute("data-expanded", true);
|
|
2200
|
+
this.element.triggerChevron?.setAttribute("data-expanded", true);
|
|
2277
2201
|
|
|
2278
2202
|
// prevent double showing: isPopovervisible gets first and showBib gets called later
|
|
2279
2203
|
if (!this.showing) {
|
|
2280
|
-
if (!element.modal) {
|
|
2204
|
+
if (!this.element.modal) {
|
|
2281
2205
|
this.setupHideHandlers();
|
|
2282
2206
|
}
|
|
2283
2207
|
this.showing = true;
|
|
2284
|
-
element.isPopoverVisible = true;
|
|
2208
|
+
this.element.isPopoverVisible = true;
|
|
2285
2209
|
this.position();
|
|
2286
2210
|
this.dispatchEventDropdownToggle();
|
|
2287
2211
|
}
|
|
2288
2212
|
|
|
2289
|
-
if (!element.bib || (!element.trigger && !element.parentNode)) {
|
|
2290
|
-
return;
|
|
2291
|
-
}
|
|
2292
|
-
|
|
2293
2213
|
// Setup auto update to handle resize and scroll
|
|
2294
|
-
element.cleanup = autoUpdate(
|
|
2295
|
-
element.trigger || element.parentNode,
|
|
2296
|
-
element.bib,
|
|
2214
|
+
this.element.cleanup = autoUpdate(
|
|
2215
|
+
this.element.trigger || this.element.parentNode,
|
|
2216
|
+
this.element.bib,
|
|
2297
2217
|
() => {
|
|
2298
2218
|
this.position();
|
|
2299
2219
|
},
|
|
@@ -2306,27 +2226,22 @@ class AuroFloatingUI {
|
|
|
2306
2226
|
* @param {String} eventType - The event type that triggered the hiding action.
|
|
2307
2227
|
*/
|
|
2308
2228
|
hideBib(eventType = "unknown") {
|
|
2309
|
-
|
|
2310
|
-
if (!element) {
|
|
2311
|
-
return;
|
|
2312
|
-
}
|
|
2313
|
-
|
|
2314
|
-
if (element.disabled) {
|
|
2229
|
+
if (this.element.disabled) {
|
|
2315
2230
|
return;
|
|
2316
2231
|
}
|
|
2317
2232
|
|
|
2318
2233
|
// noToggle dropdowns should not close when the trigger is clicked (the
|
|
2319
2234
|
// "toggle" behavior), but they CAN still close via other interactions like
|
|
2320
2235
|
// Escape key or focus loss.
|
|
2321
|
-
if (element.noToggle && eventType === "click") {
|
|
2236
|
+
if (this.element.noToggle && eventType === "click") {
|
|
2322
2237
|
return;
|
|
2323
2238
|
}
|
|
2324
2239
|
|
|
2325
2240
|
this.lockScroll(false);
|
|
2326
|
-
element.triggerChevron?.removeAttribute("data-expanded");
|
|
2241
|
+
this.element.triggerChevron?.removeAttribute("data-expanded");
|
|
2327
2242
|
|
|
2328
|
-
if (element.isPopoverVisible) {
|
|
2329
|
-
element.isPopoverVisible = false;
|
|
2243
|
+
if (this.element.isPopoverVisible) {
|
|
2244
|
+
this.element.isPopoverVisible = false;
|
|
2330
2245
|
}
|
|
2331
2246
|
if (this.showing) {
|
|
2332
2247
|
this.cleanupHideHandlers();
|
|
@@ -2346,11 +2261,6 @@ class AuroFloatingUI {
|
|
|
2346
2261
|
* @param {String} eventType - The event type that triggered the toggle action.
|
|
2347
2262
|
*/
|
|
2348
2263
|
dispatchEventDropdownToggle(eventType) {
|
|
2349
|
-
const element = this.element;
|
|
2350
|
-
if (!element) {
|
|
2351
|
-
return;
|
|
2352
|
-
}
|
|
2353
|
-
|
|
2354
2264
|
const event = new CustomEvent(
|
|
2355
2265
|
this.eventPrefix ? `${this.eventPrefix}-toggled` : "toggled",
|
|
2356
2266
|
{
|
|
@@ -2362,16 +2272,11 @@ class AuroFloatingUI {
|
|
|
2362
2272
|
},
|
|
2363
2273
|
);
|
|
2364
2274
|
|
|
2365
|
-
element.dispatchEvent(event);
|
|
2275
|
+
this.element.dispatchEvent(event);
|
|
2366
2276
|
}
|
|
2367
2277
|
|
|
2368
2278
|
handleClick() {
|
|
2369
|
-
|
|
2370
|
-
if (!element) {
|
|
2371
|
-
return;
|
|
2372
|
-
}
|
|
2373
|
-
|
|
2374
|
-
if (element.isPopoverVisible) {
|
|
2279
|
+
if (this.element.isPopoverVisible) {
|
|
2375
2280
|
this.hideBib("click");
|
|
2376
2281
|
} else {
|
|
2377
2282
|
this.showBib();
|
|
@@ -2382,66 +2287,63 @@ class AuroFloatingUI {
|
|
|
2382
2287
|
{
|
|
2383
2288
|
composed: true,
|
|
2384
2289
|
detail: {
|
|
2385
|
-
expanded: element.isPopoverVisible,
|
|
2290
|
+
expanded: this.element.isPopoverVisible,
|
|
2386
2291
|
},
|
|
2387
2292
|
},
|
|
2388
2293
|
);
|
|
2389
2294
|
|
|
2390
|
-
element.dispatchEvent(event);
|
|
2295
|
+
this.element.dispatchEvent(event);
|
|
2391
2296
|
}
|
|
2392
2297
|
|
|
2393
2298
|
handleEvent(event) {
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
event.preventDefault();
|
|
2410
|
-
this.handleClick();
|
|
2299
|
+
if (!this.element.disableEventShow) {
|
|
2300
|
+
switch (event.type) {
|
|
2301
|
+
case "keydown": {
|
|
2302
|
+
// Support both Enter and Space keys for accessibility
|
|
2303
|
+
// Space is included as it's expected behavior for interactive elements
|
|
2304
|
+
|
|
2305
|
+
const origin = event.composedPath()[0];
|
|
2306
|
+
if (
|
|
2307
|
+
event.key === "Enter" ||
|
|
2308
|
+
(event.key === " " && (!origin || origin.tagName !== "INPUT"))
|
|
2309
|
+
) {
|
|
2310
|
+
event.preventDefault();
|
|
2311
|
+
this.handleClick();
|
|
2312
|
+
}
|
|
2313
|
+
break;
|
|
2411
2314
|
}
|
|
2412
|
-
|
|
2315
|
+
case "mouseenter":
|
|
2316
|
+
if (this.element.hoverToggle) {
|
|
2317
|
+
this.showBib();
|
|
2318
|
+
}
|
|
2319
|
+
break;
|
|
2320
|
+
case "mouseleave":
|
|
2321
|
+
if (this.element.hoverToggle) {
|
|
2322
|
+
this.hideBib("mouseleave");
|
|
2323
|
+
}
|
|
2324
|
+
break;
|
|
2325
|
+
case "focus":
|
|
2326
|
+
if (this.element.focusShow) {
|
|
2327
|
+
/*
|
|
2328
|
+
This needs to better handle clicking that gives focus -
|
|
2329
|
+
currently it shows and then immediately hides the bib
|
|
2330
|
+
*/
|
|
2331
|
+
this.showBib();
|
|
2332
|
+
}
|
|
2333
|
+
break;
|
|
2334
|
+
case "blur":
|
|
2335
|
+
// send this task 100ms later queue to
|
|
2336
|
+
// wait a frame in case focus moves within the floating element/bib
|
|
2337
|
+
setTimeout(() => this.handleFocusLoss(), 0);
|
|
2338
|
+
break;
|
|
2339
|
+
case "click":
|
|
2340
|
+
if (document.activeElement === document.body) {
|
|
2341
|
+
event.currentTarget.focus();
|
|
2342
|
+
}
|
|
2343
|
+
this.handleClick();
|
|
2344
|
+
break;
|
|
2345
|
+
// Do nothing
|
|
2413
2346
|
}
|
|
2414
|
-
case "mouseenter":
|
|
2415
|
-
if (element.hoverToggle) {
|
|
2416
|
-
this.showBib();
|
|
2417
|
-
}
|
|
2418
|
-
break;
|
|
2419
|
-
case "mouseleave":
|
|
2420
|
-
if (element.hoverToggle) {
|
|
2421
|
-
this.hideBib("mouseleave");
|
|
2422
|
-
}
|
|
2423
|
-
break;
|
|
2424
|
-
case "focus":
|
|
2425
|
-
if (element.focusShow) {
|
|
2426
|
-
/*
|
|
2427
|
-
This needs to better handle clicking that gives focus -
|
|
2428
|
-
currently it shows and then immediately hides the bib
|
|
2429
|
-
*/
|
|
2430
|
-
this.showBib();
|
|
2431
|
-
}
|
|
2432
|
-
break;
|
|
2433
|
-
case "blur":
|
|
2434
|
-
// send this task 100ms later queue to
|
|
2435
|
-
// wait a frame in case focus moves within the floating element/bib
|
|
2436
|
-
setTimeout(() => this.handleFocusLoss(), 0);
|
|
2437
|
-
break;
|
|
2438
|
-
case "click":
|
|
2439
|
-
if (document.activeElement === document.body) {
|
|
2440
|
-
event.currentTarget.focus();
|
|
2441
|
-
}
|
|
2442
|
-
this.handleClick();
|
|
2443
|
-
break;
|
|
2444
|
-
// Do nothing
|
|
2445
2347
|
}
|
|
2446
2348
|
}
|
|
2447
2349
|
|
|
@@ -2452,11 +2354,6 @@ class AuroFloatingUI {
|
|
|
2452
2354
|
* This prevents the component itself from being focusable when the trigger element already handles focus.
|
|
2453
2355
|
*/
|
|
2454
2356
|
handleTriggerTabIndex() {
|
|
2455
|
-
const element = this.element;
|
|
2456
|
-
if (!element) {
|
|
2457
|
-
return;
|
|
2458
|
-
}
|
|
2459
|
-
|
|
2460
2357
|
const focusableElementSelectors = [
|
|
2461
2358
|
"a",
|
|
2462
2359
|
"button",
|
|
@@ -2469,7 +2366,7 @@ class AuroFloatingUI {
|
|
|
2469
2366
|
"auro-hyperlink",
|
|
2470
2367
|
];
|
|
2471
2368
|
|
|
2472
|
-
const triggerNode = element.querySelectorAll('[slot="trigger"]')[0];
|
|
2369
|
+
const triggerNode = this.element.querySelectorAll('[slot="trigger"]')[0];
|
|
2473
2370
|
if (!triggerNode) {
|
|
2474
2371
|
return;
|
|
2475
2372
|
}
|
|
@@ -2478,13 +2375,13 @@ class AuroFloatingUI {
|
|
|
2478
2375
|
focusableElementSelectors.forEach((selector) => {
|
|
2479
2376
|
// Check if the trigger node element is focusable
|
|
2480
2377
|
if (triggerNodeTagName === selector) {
|
|
2481
|
-
element.tabIndex = -1;
|
|
2378
|
+
this.element.tabIndex = -1;
|
|
2482
2379
|
return;
|
|
2483
2380
|
}
|
|
2484
2381
|
|
|
2485
2382
|
// Check if any child is focusable
|
|
2486
2383
|
if (triggerNode.querySelector(selector)) {
|
|
2487
|
-
element.tabIndex = -1;
|
|
2384
|
+
this.element.tabIndex = -1;
|
|
2488
2385
|
}
|
|
2489
2386
|
});
|
|
2490
2387
|
}
|
|
@@ -2494,18 +2391,13 @@ class AuroFloatingUI {
|
|
|
2494
2391
|
* @param {*} eventPrefix
|
|
2495
2392
|
*/
|
|
2496
2393
|
regenerateBibId() {
|
|
2497
|
-
|
|
2498
|
-
if (!element) {
|
|
2499
|
-
return;
|
|
2500
|
-
}
|
|
2501
|
-
|
|
2502
|
-
this.id = element.getAttribute("id");
|
|
2394
|
+
this.id = this.element.getAttribute("id");
|
|
2503
2395
|
if (!this.id) {
|
|
2504
2396
|
this.id = window.crypto.randomUUID();
|
|
2505
|
-
element.setAttribute("id", this.id);
|
|
2397
|
+
this.element.setAttribute("id", this.id);
|
|
2506
2398
|
}
|
|
2507
2399
|
|
|
2508
|
-
element.bib
|
|
2400
|
+
this.element.bib.setAttribute("id", `${this.id}-floater-bib`);
|
|
2509
2401
|
}
|
|
2510
2402
|
|
|
2511
2403
|
configure(elem, eventPrefix, enableKeyboardHandling = true) {
|
|
@@ -2517,69 +2409,67 @@ class AuroFloatingUI {
|
|
|
2517
2409
|
this.element = elem;
|
|
2518
2410
|
}
|
|
2519
2411
|
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
return;
|
|
2412
|
+
if (this.behavior !== this.element.behavior) {
|
|
2413
|
+
this.behavior = this.element.behavior;
|
|
2523
2414
|
}
|
|
2524
2415
|
|
|
2525
|
-
if (this.
|
|
2526
|
-
this.behavior = element.behavior;
|
|
2527
|
-
}
|
|
2528
|
-
|
|
2529
|
-
if (element.trigger) {
|
|
2416
|
+
if (this.element.trigger) {
|
|
2530
2417
|
this.disconnect();
|
|
2531
2418
|
}
|
|
2532
|
-
element.trigger =
|
|
2533
|
-
element.triggerElement ||
|
|
2534
|
-
element.shadowRoot
|
|
2535
|
-
element.trigger;
|
|
2536
|
-
element.bib =
|
|
2537
|
-
|
|
2538
|
-
element.
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2419
|
+
this.element.trigger =
|
|
2420
|
+
this.element.triggerElement ||
|
|
2421
|
+
this.element.shadowRoot.querySelector("#trigger") ||
|
|
2422
|
+
this.element.trigger;
|
|
2423
|
+
this.element.bib =
|
|
2424
|
+
this.element.shadowRoot.querySelector("#bib") || this.element.bib;
|
|
2425
|
+
this.element.bibSizer = this.element.shadowRoot.querySelector("#bibSizer");
|
|
2426
|
+
this.element.triggerChevron =
|
|
2427
|
+
this.element.shadowRoot.querySelector("#showStateIcon");
|
|
2428
|
+
|
|
2429
|
+
if (this.element.floaterConfig) {
|
|
2430
|
+
this.element.hoverToggle = this.element.floaterConfig.hoverToggle;
|
|
2543
2431
|
}
|
|
2544
2432
|
|
|
2545
2433
|
this.regenerateBibId();
|
|
2546
2434
|
this.handleTriggerTabIndex();
|
|
2547
2435
|
|
|
2548
2436
|
this.handleEvent = this.handleEvent.bind(this);
|
|
2549
|
-
if (element.trigger) {
|
|
2437
|
+
if (this.element.trigger) {
|
|
2550
2438
|
if (this.enableKeyboardHandling) {
|
|
2551
|
-
element.trigger.addEventListener("keydown", this.handleEvent);
|
|
2439
|
+
this.element.trigger.addEventListener("keydown", this.handleEvent);
|
|
2552
2440
|
}
|
|
2553
|
-
element.trigger.addEventListener("click", this.handleEvent);
|
|
2554
|
-
element.trigger.addEventListener("mouseenter", this.handleEvent);
|
|
2555
|
-
element.trigger.addEventListener("mouseleave", this.handleEvent);
|
|
2556
|
-
element.trigger.addEventListener("focus", this.handleEvent);
|
|
2557
|
-
element.trigger.addEventListener("blur", this.handleEvent);
|
|
2441
|
+
this.element.trigger.addEventListener("click", this.handleEvent);
|
|
2442
|
+
this.element.trigger.addEventListener("mouseenter", this.handleEvent);
|
|
2443
|
+
this.element.trigger.addEventListener("mouseleave", this.handleEvent);
|
|
2444
|
+
this.element.trigger.addEventListener("focus", this.handleEvent);
|
|
2445
|
+
this.element.trigger.addEventListener("blur", this.handleEvent);
|
|
2558
2446
|
}
|
|
2559
2447
|
}
|
|
2560
2448
|
|
|
2561
2449
|
disconnect() {
|
|
2562
2450
|
this.cleanupHideHandlers();
|
|
2451
|
+
if (this.element) {
|
|
2452
|
+
this.element.cleanup?.();
|
|
2563
2453
|
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
}
|
|
2568
|
-
|
|
2569
|
-
element.cleanup?.();
|
|
2570
|
-
|
|
2571
|
-
if (element.bib && element.shadowRoot) {
|
|
2572
|
-
element.shadowRoot.append(element.bib);
|
|
2573
|
-
}
|
|
2454
|
+
if (this.element.bib) {
|
|
2455
|
+
this.element.shadowRoot.append(this.element.bib);
|
|
2456
|
+
}
|
|
2574
2457
|
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2458
|
+
// Remove event & keyboard listeners
|
|
2459
|
+
if (this.element?.trigger) {
|
|
2460
|
+
this.element.trigger.removeEventListener("keydown", this.handleEvent);
|
|
2461
|
+
this.element.trigger.removeEventListener("click", this.handleEvent);
|
|
2462
|
+
this.element.trigger.removeEventListener(
|
|
2463
|
+
"mouseenter",
|
|
2464
|
+
this.handleEvent,
|
|
2465
|
+
);
|
|
2466
|
+
this.element.trigger.removeEventListener(
|
|
2467
|
+
"mouseleave",
|
|
2468
|
+
this.handleEvent,
|
|
2469
|
+
);
|
|
2470
|
+
this.element.trigger.removeEventListener("focus", this.handleEvent);
|
|
2471
|
+
this.element.trigger.removeEventListener("blur", this.handleEvent);
|
|
2472
|
+
}
|
|
2583
2473
|
}
|
|
2584
2474
|
}
|
|
2585
2475
|
}
|
|
@@ -3707,7 +3597,7 @@ class AuroHelpText extends LitElement {
|
|
|
3707
3597
|
}
|
|
3708
3598
|
}
|
|
3709
3599
|
|
|
3710
|
-
var formkitVersion = '
|
|
3600
|
+
var formkitVersion = '202604071525';
|
|
3711
3601
|
|
|
3712
3602
|
class AuroElement extends LitElement {
|
|
3713
3603
|
static get properties() {
|