@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
|
@@ -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 "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,33 +2085,23 @@ class AuroFloatingUI {
|
|
|
2138
2085
|
}
|
|
2139
2086
|
|
|
2140
2087
|
setupHideHandlers() {
|
|
2141
|
-
const element = this.element;
|
|
2142
|
-
if (!element) {
|
|
2143
|
-
return;
|
|
2144
|
-
}
|
|
2145
|
-
|
|
2146
2088
|
// Define handlers & store references
|
|
2147
2089
|
this.focusHandler = () => this.handleFocusLoss();
|
|
2148
2090
|
|
|
2149
2091
|
this.clickHandler = (evt) => {
|
|
2150
|
-
const element = this.element;
|
|
2151
|
-
if (!element?.bib) {
|
|
2152
|
-
return;
|
|
2153
|
-
}
|
|
2154
|
-
|
|
2155
2092
|
// When the bib is fullscreen (modal dialog), don't close on outside
|
|
2156
2093
|
// clicks. VoiceOver's synthetic click events inside a top-layer modal
|
|
2157
2094
|
// <dialog> may not include the bib in composedPath(), causing false
|
|
2158
2095
|
// positives. This mirrors the fullscreen guard in handleFocusLoss().
|
|
2159
|
-
if (element.bib.hasAttribute("isfullscreen")) {
|
|
2096
|
+
if (this.element.bib && this.element.bib.hasAttribute("isfullscreen")) {
|
|
2160
2097
|
return;
|
|
2161
2098
|
}
|
|
2162
2099
|
|
|
2163
2100
|
if (
|
|
2164
|
-
(!evt.composedPath().includes(element.trigger) &&
|
|
2165
|
-
!evt.composedPath().includes(element.bib)) ||
|
|
2166
|
-
(element.bib.backdrop &&
|
|
2167
|
-
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))
|
|
2168
2105
|
) {
|
|
2169
2106
|
const existedVisibleFloatingUI =
|
|
2170
2107
|
document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
@@ -2185,12 +2122,7 @@ class AuroFloatingUI {
|
|
|
2185
2122
|
|
|
2186
2123
|
// ESC key handler
|
|
2187
2124
|
this.keyDownHandler = (evt) => {
|
|
2188
|
-
|
|
2189
|
-
if (!element) {
|
|
2190
|
-
return;
|
|
2191
|
-
}
|
|
2192
|
-
|
|
2193
|
-
if (evt.key === "Escape" && element.isPopoverVisible) {
|
|
2125
|
+
if (evt.key === "Escape" && this.element.isPopoverVisible) {
|
|
2194
2126
|
const existedVisibleFloatingUI =
|
|
2195
2127
|
document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
2196
2128
|
if (
|
|
@@ -2247,10 +2179,6 @@ class AuroFloatingUI {
|
|
|
2247
2179
|
}
|
|
2248
2180
|
|
|
2249
2181
|
updateCurrentExpandedDropdown() {
|
|
2250
|
-
if (!this.element) {
|
|
2251
|
-
return;
|
|
2252
|
-
}
|
|
2253
|
-
|
|
2254
2182
|
// Close any other dropdown that is already open
|
|
2255
2183
|
const existedVisibleFloatingUI =
|
|
2256
2184
|
document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
@@ -2267,34 +2195,25 @@ class AuroFloatingUI {
|
|
|
2267
2195
|
}
|
|
2268
2196
|
|
|
2269
2197
|
showBib() {
|
|
2270
|
-
|
|
2271
|
-
if (!element) {
|
|
2272
|
-
return;
|
|
2273
|
-
}
|
|
2274
|
-
|
|
2275
|
-
if (!element.bib || (!element.trigger && !element.parentNode)) {
|
|
2276
|
-
return;
|
|
2277
|
-
}
|
|
2278
|
-
|
|
2279
|
-
if (!element.disabled && !this.showing) {
|
|
2198
|
+
if (!this.element.disabled && !this.showing) {
|
|
2280
2199
|
this.updateCurrentExpandedDropdown();
|
|
2281
|
-
element.triggerChevron?.setAttribute("data-expanded", true);
|
|
2200
|
+
this.element.triggerChevron?.setAttribute("data-expanded", true);
|
|
2282
2201
|
|
|
2283
2202
|
// prevent double showing: isPopovervisible gets first and showBib gets called later
|
|
2284
2203
|
if (!this.showing) {
|
|
2285
|
-
if (!element.modal) {
|
|
2204
|
+
if (!this.element.modal) {
|
|
2286
2205
|
this.setupHideHandlers();
|
|
2287
2206
|
}
|
|
2288
2207
|
this.showing = true;
|
|
2289
|
-
element.isPopoverVisible = true;
|
|
2208
|
+
this.element.isPopoverVisible = true;
|
|
2290
2209
|
this.position();
|
|
2291
2210
|
this.dispatchEventDropdownToggle();
|
|
2292
2211
|
}
|
|
2293
2212
|
|
|
2294
2213
|
// Setup auto update to handle resize and scroll
|
|
2295
|
-
element.cleanup = autoUpdate(
|
|
2296
|
-
element.trigger || element.parentNode,
|
|
2297
|
-
element.bib,
|
|
2214
|
+
this.element.cleanup = autoUpdate(
|
|
2215
|
+
this.element.trigger || this.element.parentNode,
|
|
2216
|
+
this.element.bib,
|
|
2298
2217
|
() => {
|
|
2299
2218
|
this.position();
|
|
2300
2219
|
},
|
|
@@ -2307,27 +2226,22 @@ class AuroFloatingUI {
|
|
|
2307
2226
|
* @param {String} eventType - The event type that triggered the hiding action.
|
|
2308
2227
|
*/
|
|
2309
2228
|
hideBib(eventType = "unknown") {
|
|
2310
|
-
|
|
2311
|
-
if (!element) {
|
|
2312
|
-
return;
|
|
2313
|
-
}
|
|
2314
|
-
|
|
2315
|
-
if (element.disabled) {
|
|
2229
|
+
if (this.element.disabled) {
|
|
2316
2230
|
return;
|
|
2317
2231
|
}
|
|
2318
2232
|
|
|
2319
2233
|
// noToggle dropdowns should not close when the trigger is clicked (the
|
|
2320
2234
|
// "toggle" behavior), but they CAN still close via other interactions like
|
|
2321
2235
|
// Escape key or focus loss.
|
|
2322
|
-
if (element.noToggle && eventType === "click") {
|
|
2236
|
+
if (this.element.noToggle && eventType === "click") {
|
|
2323
2237
|
return;
|
|
2324
2238
|
}
|
|
2325
2239
|
|
|
2326
2240
|
this.lockScroll(false);
|
|
2327
|
-
element.triggerChevron?.removeAttribute("data-expanded");
|
|
2241
|
+
this.element.triggerChevron?.removeAttribute("data-expanded");
|
|
2328
2242
|
|
|
2329
|
-
if (element.isPopoverVisible) {
|
|
2330
|
-
element.isPopoverVisible = false;
|
|
2243
|
+
if (this.element.isPopoverVisible) {
|
|
2244
|
+
this.element.isPopoverVisible = false;
|
|
2331
2245
|
}
|
|
2332
2246
|
if (this.showing) {
|
|
2333
2247
|
this.cleanupHideHandlers();
|
|
@@ -2347,11 +2261,6 @@ class AuroFloatingUI {
|
|
|
2347
2261
|
* @param {String} eventType - The event type that triggered the toggle action.
|
|
2348
2262
|
*/
|
|
2349
2263
|
dispatchEventDropdownToggle(eventType) {
|
|
2350
|
-
const element = this.element;
|
|
2351
|
-
if (!element) {
|
|
2352
|
-
return;
|
|
2353
|
-
}
|
|
2354
|
-
|
|
2355
2264
|
const event = new CustomEvent(
|
|
2356
2265
|
this.eventPrefix ? `${this.eventPrefix}-toggled` : "toggled",
|
|
2357
2266
|
{
|
|
@@ -2363,16 +2272,11 @@ class AuroFloatingUI {
|
|
|
2363
2272
|
},
|
|
2364
2273
|
);
|
|
2365
2274
|
|
|
2366
|
-
element.dispatchEvent(event);
|
|
2275
|
+
this.element.dispatchEvent(event);
|
|
2367
2276
|
}
|
|
2368
2277
|
|
|
2369
2278
|
handleClick() {
|
|
2370
|
-
|
|
2371
|
-
if (!element) {
|
|
2372
|
-
return;
|
|
2373
|
-
}
|
|
2374
|
-
|
|
2375
|
-
if (element.isPopoverVisible) {
|
|
2279
|
+
if (this.element.isPopoverVisible) {
|
|
2376
2280
|
this.hideBib("click");
|
|
2377
2281
|
} else {
|
|
2378
2282
|
this.showBib();
|
|
@@ -2383,66 +2287,63 @@ class AuroFloatingUI {
|
|
|
2383
2287
|
{
|
|
2384
2288
|
composed: true,
|
|
2385
2289
|
detail: {
|
|
2386
|
-
expanded: element.isPopoverVisible,
|
|
2290
|
+
expanded: this.element.isPopoverVisible,
|
|
2387
2291
|
},
|
|
2388
2292
|
},
|
|
2389
2293
|
);
|
|
2390
2294
|
|
|
2391
|
-
element.dispatchEvent(event);
|
|
2295
|
+
this.element.dispatchEvent(event);
|
|
2392
2296
|
}
|
|
2393
2297
|
|
|
2394
2298
|
handleEvent(event) {
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
event.preventDefault();
|
|
2411
|
-
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;
|
|
2412
2314
|
}
|
|
2413
|
-
|
|
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
|
|
2414
2346
|
}
|
|
2415
|
-
case "mouseenter":
|
|
2416
|
-
if (element.hoverToggle) {
|
|
2417
|
-
this.showBib();
|
|
2418
|
-
}
|
|
2419
|
-
break;
|
|
2420
|
-
case "mouseleave":
|
|
2421
|
-
if (element.hoverToggle) {
|
|
2422
|
-
this.hideBib("mouseleave");
|
|
2423
|
-
}
|
|
2424
|
-
break;
|
|
2425
|
-
case "focus":
|
|
2426
|
-
if (element.focusShow) {
|
|
2427
|
-
/*
|
|
2428
|
-
This needs to better handle clicking that gives focus -
|
|
2429
|
-
currently it shows and then immediately hides the bib
|
|
2430
|
-
*/
|
|
2431
|
-
this.showBib();
|
|
2432
|
-
}
|
|
2433
|
-
break;
|
|
2434
|
-
case "blur":
|
|
2435
|
-
// send this task 100ms later queue to
|
|
2436
|
-
// wait a frame in case focus moves within the floating element/bib
|
|
2437
|
-
setTimeout(() => this.handleFocusLoss(), 0);
|
|
2438
|
-
break;
|
|
2439
|
-
case "click":
|
|
2440
|
-
if (document.activeElement === document.body) {
|
|
2441
|
-
event.currentTarget.focus();
|
|
2442
|
-
}
|
|
2443
|
-
this.handleClick();
|
|
2444
|
-
break;
|
|
2445
|
-
// Do nothing
|
|
2446
2347
|
}
|
|
2447
2348
|
}
|
|
2448
2349
|
|
|
@@ -2453,11 +2354,6 @@ class AuroFloatingUI {
|
|
|
2453
2354
|
* This prevents the component itself from being focusable when the trigger element already handles focus.
|
|
2454
2355
|
*/
|
|
2455
2356
|
handleTriggerTabIndex() {
|
|
2456
|
-
const element = this.element;
|
|
2457
|
-
if (!element) {
|
|
2458
|
-
return;
|
|
2459
|
-
}
|
|
2460
|
-
|
|
2461
2357
|
const focusableElementSelectors = [
|
|
2462
2358
|
"a",
|
|
2463
2359
|
"button",
|
|
@@ -2470,7 +2366,7 @@ class AuroFloatingUI {
|
|
|
2470
2366
|
"auro-hyperlink",
|
|
2471
2367
|
];
|
|
2472
2368
|
|
|
2473
|
-
const triggerNode = element.querySelectorAll('[slot="trigger"]')[0];
|
|
2369
|
+
const triggerNode = this.element.querySelectorAll('[slot="trigger"]')[0];
|
|
2474
2370
|
if (!triggerNode) {
|
|
2475
2371
|
return;
|
|
2476
2372
|
}
|
|
@@ -2479,13 +2375,13 @@ class AuroFloatingUI {
|
|
|
2479
2375
|
focusableElementSelectors.forEach((selector) => {
|
|
2480
2376
|
// Check if the trigger node element is focusable
|
|
2481
2377
|
if (triggerNodeTagName === selector) {
|
|
2482
|
-
element.tabIndex = -1;
|
|
2378
|
+
this.element.tabIndex = -1;
|
|
2483
2379
|
return;
|
|
2484
2380
|
}
|
|
2485
2381
|
|
|
2486
2382
|
// Check if any child is focusable
|
|
2487
2383
|
if (triggerNode.querySelector(selector)) {
|
|
2488
|
-
element.tabIndex = -1;
|
|
2384
|
+
this.element.tabIndex = -1;
|
|
2489
2385
|
}
|
|
2490
2386
|
});
|
|
2491
2387
|
}
|
|
@@ -2495,18 +2391,13 @@ class AuroFloatingUI {
|
|
|
2495
2391
|
* @param {*} eventPrefix
|
|
2496
2392
|
*/
|
|
2497
2393
|
regenerateBibId() {
|
|
2498
|
-
|
|
2499
|
-
if (!element) {
|
|
2500
|
-
return;
|
|
2501
|
-
}
|
|
2502
|
-
|
|
2503
|
-
this.id = element.getAttribute("id");
|
|
2394
|
+
this.id = this.element.getAttribute("id");
|
|
2504
2395
|
if (!this.id) {
|
|
2505
2396
|
this.id = window.crypto.randomUUID();
|
|
2506
|
-
element.setAttribute("id", this.id);
|
|
2397
|
+
this.element.setAttribute("id", this.id);
|
|
2507
2398
|
}
|
|
2508
2399
|
|
|
2509
|
-
element.bib
|
|
2400
|
+
this.element.bib.setAttribute("id", `${this.id}-floater-bib`);
|
|
2510
2401
|
}
|
|
2511
2402
|
|
|
2512
2403
|
configure(elem, eventPrefix, enableKeyboardHandling = true) {
|
|
@@ -2518,69 +2409,67 @@ class AuroFloatingUI {
|
|
|
2518
2409
|
this.element = elem;
|
|
2519
2410
|
}
|
|
2520
2411
|
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
return;
|
|
2412
|
+
if (this.behavior !== this.element.behavior) {
|
|
2413
|
+
this.behavior = this.element.behavior;
|
|
2524
2414
|
}
|
|
2525
2415
|
|
|
2526
|
-
if (this.
|
|
2527
|
-
this.behavior = element.behavior;
|
|
2528
|
-
}
|
|
2529
|
-
|
|
2530
|
-
if (element.trigger) {
|
|
2416
|
+
if (this.element.trigger) {
|
|
2531
2417
|
this.disconnect();
|
|
2532
2418
|
}
|
|
2533
|
-
element.trigger =
|
|
2534
|
-
element.triggerElement ||
|
|
2535
|
-
element.shadowRoot
|
|
2536
|
-
element.trigger;
|
|
2537
|
-
element.bib =
|
|
2538
|
-
|
|
2539
|
-
element.
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
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;
|
|
2544
2431
|
}
|
|
2545
2432
|
|
|
2546
2433
|
this.regenerateBibId();
|
|
2547
2434
|
this.handleTriggerTabIndex();
|
|
2548
2435
|
|
|
2549
2436
|
this.handleEvent = this.handleEvent.bind(this);
|
|
2550
|
-
if (element.trigger) {
|
|
2437
|
+
if (this.element.trigger) {
|
|
2551
2438
|
if (this.enableKeyboardHandling) {
|
|
2552
|
-
element.trigger.addEventListener("keydown", this.handleEvent);
|
|
2439
|
+
this.element.trigger.addEventListener("keydown", this.handleEvent);
|
|
2553
2440
|
}
|
|
2554
|
-
element.trigger.addEventListener("click", this.handleEvent);
|
|
2555
|
-
element.trigger.addEventListener("mouseenter", this.handleEvent);
|
|
2556
|
-
element.trigger.addEventListener("mouseleave", this.handleEvent);
|
|
2557
|
-
element.trigger.addEventListener("focus", this.handleEvent);
|
|
2558
|
-
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);
|
|
2559
2446
|
}
|
|
2560
2447
|
}
|
|
2561
2448
|
|
|
2562
2449
|
disconnect() {
|
|
2563
2450
|
this.cleanupHideHandlers();
|
|
2451
|
+
if (this.element) {
|
|
2452
|
+
this.element.cleanup?.();
|
|
2564
2453
|
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
}
|
|
2569
|
-
|
|
2570
|
-
element.cleanup?.();
|
|
2571
|
-
|
|
2572
|
-
if (element.bib && element.shadowRoot) {
|
|
2573
|
-
element.shadowRoot.append(element.bib);
|
|
2574
|
-
}
|
|
2454
|
+
if (this.element.bib) {
|
|
2455
|
+
this.element.shadowRoot.append(this.element.bib);
|
|
2456
|
+
}
|
|
2575
2457
|
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
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
|
+
}
|
|
2584
2473
|
}
|
|
2585
2474
|
}
|
|
2586
2475
|
}
|
|
@@ -3708,7 +3597,7 @@ class AuroHelpText extends LitElement {
|
|
|
3708
3597
|
}
|
|
3709
3598
|
}
|
|
3710
3599
|
|
|
3711
|
-
var formkitVersion = '
|
|
3600
|
+
var formkitVersion = '202604072118';
|
|
3712
3601
|
|
|
3713
3602
|
class AuroElement extends LitElement {
|
|
3714
3603
|
static get properties() {
|