@eightshift/ui-components 0.0.1
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/README.md +27 -0
- package/dist/Checkbox-BLcVbhiO.js +178 -0
- package/dist/ColorSwatch-Cmlex_kT.js +66 -0
- package/dist/FieldError-wtMA4667.js +42 -0
- package/dist/FocusScope-1u9yyfIN.js +725 -0
- package/dist/Form-Cq3fu75_.js +5 -0
- package/dist/GridList-BZPXp3_O.js +1256 -0
- package/dist/Group-DyqpTRPe.js +49 -0
- package/dist/Input-jsbb4ugq.js +130 -0
- package/dist/Label-BPzS-sR7.js +17 -0
- package/dist/ListBox-w9gDaJkV.js +4423 -0
- package/dist/LiveAnnouncer-IsokfWQ5.js +73 -0
- package/dist/NumberFormatter-LzoKy975.js +160 -0
- package/dist/RSPContexts-CrNYmadY.js +14 -0
- package/dist/Select-49a62830.esm-C-RFtLiD.js +2541 -0
- package/dist/SelectionManager-mefd0ThJ.js +2155 -0
- package/dist/Separator-DHn0CwdK.js +325 -0
- package/dist/Slider-Pyh2V4bY.js +885 -0
- package/dist/Text-BM136LvS.js +17 -0
- package/dist/VisuallyHidden-BYRI1Lfo.js +51 -0
- package/dist/_commonjsHelpers-CUmg6egw.js +6 -0
- package/dist/ariaHideOutside-ByKBPHmX.js +113 -0
- package/dist/assets/style.css +1 -0
- package/dist/button-BkkdyHfJ.js +307 -0
- package/dist/components/animated-visibility/animated-visibility.js +7165 -0
- package/dist/components/base-control/base-control.js +97 -0
- package/dist/components/breakpoint-preview/breakpoint-preview.js +218 -0
- package/dist/components/button/button.js +10 -0
- package/dist/components/checkbox/checkbox.js +119 -0
- package/dist/components/color-pickers/color-picker.js +242 -0
- package/dist/components/color-pickers/color-swatch.js +62 -0
- package/dist/components/color-pickers/gradient-editor.js +516 -0
- package/dist/components/color-pickers/solid-color-picker.js +1633 -0
- package/dist/components/component-toggle/component-toggle.js +71 -0
- package/dist/components/container-panel/container-panel.js +39 -0
- package/dist/components/expandable/expandable.js +144 -0
- package/dist/components/input-field/input-field.js +224 -0
- package/dist/components/link-input/link-input.js +937 -0
- package/dist/components/list-box/list-box.js +152 -0
- package/dist/components/matrix-align/matrix-align.js +185 -0
- package/dist/components/menu/menu.js +1608 -0
- package/dist/components/notice/notice.js +119 -0
- package/dist/components/number-picker/number-picker.js +277 -0
- package/dist/components/popover/popover.js +9 -0
- package/dist/components/radio/radio.js +552 -0
- package/dist/components/repeater/repeater-item.js +127 -0
- package/dist/components/repeater/repeater.js +248 -0
- package/dist/components/responsive/responsive-legacy.js +326 -0
- package/dist/components/responsive/responsive.js +499 -0
- package/dist/components/responsive-preview/responsive-preview.js +119 -0
- package/dist/components/rich-label/rich-label.js +56 -0
- package/dist/components/select/async-multi-select.js +144 -0
- package/dist/components/select/async-single-select.js +126 -0
- package/dist/components/select/custom-select-default-components.js +38 -0
- package/dist/components/select/multi-select-components.js +8 -0
- package/dist/components/select/multi-select.js +134 -0
- package/dist/components/select/react-select-component-wrappers.js +90 -0
- package/dist/components/select/shared.js +45 -0
- package/dist/components/select/single-select.js +116 -0
- package/dist/components/select/styles.js +55 -0
- package/dist/components/slider/column-config-slider.js +225 -0
- package/dist/components/slider/slider.js +362 -0
- package/dist/components/slider/utils.js +45 -0
- package/dist/components/spacer/spacer.js +93 -0
- package/dist/components/tabs/tabs.js +626 -0
- package/dist/components/toggle/switch.js +140 -0
- package/dist/components/toggle/toggle.js +58 -0
- package/dist/components/toggle-button/toggle-button.js +206 -0
- package/dist/components/tooltip/tooltip.js +10 -0
- package/dist/context-jMy6xdVq.js +98 -0
- package/dist/default-i18n-BhE-OUmt.js +873 -0
- package/dist/filterDOMProps-DG2RfOUr.js +30 -0
- package/dist/focusSafely-C3K8zAKj.js +743 -0
- package/dist/hooks/use-cell-edit-mode.js +35 -0
- package/dist/icons/block-icon.js +42 -0
- package/dist/icons/generic-color-swatch.js +21 -0
- package/dist/icons/icons.js +3636 -0
- package/dist/index-Bfb9bWcb.js +28844 -0
- package/dist/index-a301f526.esm-Bioi4cGX.js +3576 -0
- package/dist/index.js +109 -0
- package/dist/intlStrings-CUhoK9EN.js +2484 -0
- package/dist/isScrollable-PcyglExV.js +10 -0
- package/dist/modifiers.esm-BuJQPI1X.js +31 -0
- package/dist/multi-select-components-CjVpCNko.js +3677 -0
- package/dist/number-rWqELA8W.js +39 -0
- package/dist/popover-Dx3vKXUX.js +1061 -0
- package/dist/react-select-async.esm-TFb_ZX6C.js +111 -0
- package/dist/react-select.esm-BjRWqf0E.js +15 -0
- package/dist/style.js +1 -0
- package/dist/textSelection-BosCCRVE.js +89 -0
- package/dist/tooltip-CkCndvTI.js +1094 -0
- package/dist/useButton-CuG5UzUw.js +74 -0
- package/dist/useEvent-DHv-yhOH.js +24 -0
- package/dist/useFocusRing-Cc-4eouh.js +41 -0
- package/dist/useFocusable-5q1Gek1J.js +81 -0
- package/dist/useFormReset-Buc9YJcv.js +23 -0
- package/dist/useFormValidationState-BAPPNXic.js +238 -0
- package/dist/useHasTabbableChild-D3uUNhJ0.js +37 -0
- package/dist/useLabel-CGlkoFG0.js +28 -0
- package/dist/useLabels-Dg62M_3P.js +25 -0
- package/dist/useListData-BelKu4kx.js +211 -0
- package/dist/useListState-Domq0blV.js +137 -0
- package/dist/useLocalizedStringFormatter-Prmz0h0A.js +130 -0
- package/dist/useNumberFieldState-BLU3uhSR.js +1253 -0
- package/dist/useNumberFormatter-BLc2xjZn.js +13 -0
- package/dist/usePress-BQgVor4T.js +698 -0
- package/dist/useToggle-C9ETOBaZ.js +58 -0
- package/dist/useToggleState-DJ_z5E2S.js +21 -0
- package/dist/utilities/classnames.js +16 -0
- package/dist/utilities/text-helpers.js +79 -0
- package/dist/utils-BsiH7-5Y.js +488 -0
- package/package.json +71 -0
|
@@ -0,0 +1,743 @@
|
|
|
1
|
+
import { g as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, f as $8ae05eaa5c114e9c$export$7f54fc3180508a52, o as $b5e257d569688ac6$export$535bd6ca7f90a273 } from "./utils-BsiH7-5Y.js";
|
|
2
|
+
import { useState, useRef, useEffect, useCallback, useMemo } from "react";
|
|
3
|
+
const $431fbd86ca7dc216$export$b204af158042fbac = (el) => {
|
|
4
|
+
var _el_ownerDocument;
|
|
5
|
+
return (_el_ownerDocument = el === null || el === void 0 ? void 0 : el.ownerDocument) !== null && _el_ownerDocument !== void 0 ? _el_ownerDocument : document;
|
|
6
|
+
};
|
|
7
|
+
const $431fbd86ca7dc216$export$f21a1ffae260145a = (el) => {
|
|
8
|
+
if (el && "window" in el && el.window === el)
|
|
9
|
+
return el;
|
|
10
|
+
const doc = $431fbd86ca7dc216$export$b204af158042fbac(el);
|
|
11
|
+
return doc.defaultView || window;
|
|
12
|
+
};
|
|
13
|
+
function $7215afc6de606d6b$export$de79e2c695e052f3(element) {
|
|
14
|
+
if ($7215afc6de606d6b$var$supportsPreventScroll())
|
|
15
|
+
element.focus({
|
|
16
|
+
preventScroll: true
|
|
17
|
+
});
|
|
18
|
+
else {
|
|
19
|
+
let scrollableElements = $7215afc6de606d6b$var$getScrollableElements(element);
|
|
20
|
+
element.focus();
|
|
21
|
+
$7215afc6de606d6b$var$restoreScrollPosition(scrollableElements);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
let $7215afc6de606d6b$var$supportsPreventScrollCached = null;
|
|
25
|
+
function $7215afc6de606d6b$var$supportsPreventScroll() {
|
|
26
|
+
if ($7215afc6de606d6b$var$supportsPreventScrollCached == null) {
|
|
27
|
+
$7215afc6de606d6b$var$supportsPreventScrollCached = false;
|
|
28
|
+
try {
|
|
29
|
+
let focusElem = document.createElement("div");
|
|
30
|
+
focusElem.focus({
|
|
31
|
+
get preventScroll() {
|
|
32
|
+
$7215afc6de606d6b$var$supportsPreventScrollCached = true;
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
} catch (e) {
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return $7215afc6de606d6b$var$supportsPreventScrollCached;
|
|
40
|
+
}
|
|
41
|
+
function $7215afc6de606d6b$var$getScrollableElements(element) {
|
|
42
|
+
let parent = element.parentNode;
|
|
43
|
+
let scrollableElements = [];
|
|
44
|
+
let rootScrollingElement = document.scrollingElement || document.documentElement;
|
|
45
|
+
while (parent instanceof HTMLElement && parent !== rootScrollingElement) {
|
|
46
|
+
if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth)
|
|
47
|
+
scrollableElements.push({
|
|
48
|
+
element: parent,
|
|
49
|
+
scrollTop: parent.scrollTop,
|
|
50
|
+
scrollLeft: parent.scrollLeft
|
|
51
|
+
});
|
|
52
|
+
parent = parent.parentNode;
|
|
53
|
+
}
|
|
54
|
+
if (rootScrollingElement instanceof HTMLElement)
|
|
55
|
+
scrollableElements.push({
|
|
56
|
+
element: rootScrollingElement,
|
|
57
|
+
scrollTop: rootScrollingElement.scrollTop,
|
|
58
|
+
scrollLeft: rootScrollingElement.scrollLeft
|
|
59
|
+
});
|
|
60
|
+
return scrollableElements;
|
|
61
|
+
}
|
|
62
|
+
function $7215afc6de606d6b$var$restoreScrollPosition(scrollableElements) {
|
|
63
|
+
for (let { element, scrollTop, scrollLeft } of scrollableElements) {
|
|
64
|
+
element.scrollTop = scrollTop;
|
|
65
|
+
element.scrollLeft = scrollLeft;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function $c87311424ea30a05$var$testUserAgent(re) {
|
|
69
|
+
var _window_navigator_userAgentData;
|
|
70
|
+
if (typeof window === "undefined" || window.navigator == null)
|
|
71
|
+
return false;
|
|
72
|
+
return ((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands.some((brand) => re.test(brand.brand))) || re.test(window.navigator.userAgent);
|
|
73
|
+
}
|
|
74
|
+
function $c87311424ea30a05$var$testPlatform(re) {
|
|
75
|
+
var _window_navigator_userAgentData;
|
|
76
|
+
return typeof window !== "undefined" && window.navigator != null ? re.test(((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : false;
|
|
77
|
+
}
|
|
78
|
+
function $c87311424ea30a05$export$9ac100e40613ea10() {
|
|
79
|
+
return $c87311424ea30a05$var$testPlatform(/^Mac/i);
|
|
80
|
+
}
|
|
81
|
+
function $c87311424ea30a05$export$186c6964ca17d99() {
|
|
82
|
+
return $c87311424ea30a05$var$testPlatform(/^iPhone/i);
|
|
83
|
+
}
|
|
84
|
+
function $c87311424ea30a05$export$7bef049ce92e4224() {
|
|
85
|
+
return $c87311424ea30a05$var$testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
86
|
+
$c87311424ea30a05$export$9ac100e40613ea10() && navigator.maxTouchPoints > 1;
|
|
87
|
+
}
|
|
88
|
+
function $c87311424ea30a05$export$fedb369cb70207f1() {
|
|
89
|
+
return $c87311424ea30a05$export$186c6964ca17d99() || $c87311424ea30a05$export$7bef049ce92e4224();
|
|
90
|
+
}
|
|
91
|
+
function $c87311424ea30a05$export$e1865c3bedcd822b() {
|
|
92
|
+
return $c87311424ea30a05$export$9ac100e40613ea10() || $c87311424ea30a05$export$fedb369cb70207f1();
|
|
93
|
+
}
|
|
94
|
+
function $c87311424ea30a05$export$78551043582a6a98() {
|
|
95
|
+
return $c87311424ea30a05$var$testUserAgent(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e();
|
|
96
|
+
}
|
|
97
|
+
function $c87311424ea30a05$export$6446a186d09e379e() {
|
|
98
|
+
return $c87311424ea30a05$var$testUserAgent(/Chrome/i);
|
|
99
|
+
}
|
|
100
|
+
function $c87311424ea30a05$export$a11b0059900ceec8() {
|
|
101
|
+
return $c87311424ea30a05$var$testUserAgent(/Android/i);
|
|
102
|
+
}
|
|
103
|
+
function $c87311424ea30a05$export$b7d78993b74f766d() {
|
|
104
|
+
return $c87311424ea30a05$var$testUserAgent(/Firefox/i);
|
|
105
|
+
}
|
|
106
|
+
let $bbed8b41f857bcc0$var$transitionsByElement = /* @__PURE__ */ new Map();
|
|
107
|
+
let $bbed8b41f857bcc0$var$transitionCallbacks = /* @__PURE__ */ new Set();
|
|
108
|
+
function $bbed8b41f857bcc0$var$setupGlobalEvents() {
|
|
109
|
+
if (typeof window === "undefined")
|
|
110
|
+
return;
|
|
111
|
+
function isTransitionEvent(event) {
|
|
112
|
+
return "propertyName" in event;
|
|
113
|
+
}
|
|
114
|
+
let onTransitionStart = (e) => {
|
|
115
|
+
if (!isTransitionEvent(e) || !e.target)
|
|
116
|
+
return;
|
|
117
|
+
let transitions = $bbed8b41f857bcc0$var$transitionsByElement.get(e.target);
|
|
118
|
+
if (!transitions) {
|
|
119
|
+
transitions = /* @__PURE__ */ new Set();
|
|
120
|
+
$bbed8b41f857bcc0$var$transitionsByElement.set(e.target, transitions);
|
|
121
|
+
e.target.addEventListener("transitioncancel", onTransitionEnd, {
|
|
122
|
+
once: true
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
transitions.add(e.propertyName);
|
|
126
|
+
};
|
|
127
|
+
let onTransitionEnd = (e) => {
|
|
128
|
+
if (!isTransitionEvent(e) || !e.target)
|
|
129
|
+
return;
|
|
130
|
+
let properties = $bbed8b41f857bcc0$var$transitionsByElement.get(e.target);
|
|
131
|
+
if (!properties)
|
|
132
|
+
return;
|
|
133
|
+
properties.delete(e.propertyName);
|
|
134
|
+
if (properties.size === 0) {
|
|
135
|
+
e.target.removeEventListener("transitioncancel", onTransitionEnd);
|
|
136
|
+
$bbed8b41f857bcc0$var$transitionsByElement.delete(e.target);
|
|
137
|
+
}
|
|
138
|
+
if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0) {
|
|
139
|
+
for (let cb of $bbed8b41f857bcc0$var$transitionCallbacks)
|
|
140
|
+
cb();
|
|
141
|
+
$bbed8b41f857bcc0$var$transitionCallbacks.clear();
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
document.body.addEventListener("transitionrun", onTransitionStart);
|
|
145
|
+
document.body.addEventListener("transitionend", onTransitionEnd);
|
|
146
|
+
}
|
|
147
|
+
if (typeof document !== "undefined") {
|
|
148
|
+
if (document.readyState !== "loading")
|
|
149
|
+
$bbed8b41f857bcc0$var$setupGlobalEvents();
|
|
150
|
+
else
|
|
151
|
+
document.addEventListener("DOMContentLoaded", $bbed8b41f857bcc0$var$setupGlobalEvents);
|
|
152
|
+
}
|
|
153
|
+
function $bbed8b41f857bcc0$export$24490316f764c430(fn) {
|
|
154
|
+
requestAnimationFrame(() => {
|
|
155
|
+
if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0)
|
|
156
|
+
fn();
|
|
157
|
+
else
|
|
158
|
+
$bbed8b41f857bcc0$var$transitionCallbacks.add(fn);
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
function $e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, ref) {
|
|
162
|
+
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
163
|
+
if (context && context.ref && ref) {
|
|
164
|
+
context.ref.current = ref.current;
|
|
165
|
+
return () => {
|
|
166
|
+
if (context.ref)
|
|
167
|
+
context.ref.current = null;
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
function $6a7db85432448f7f$export$60278871457622de(event) {
|
|
173
|
+
if (event.mozInputSource === 0 && event.isTrusted)
|
|
174
|
+
return true;
|
|
175
|
+
if ($c87311424ea30a05$export$a11b0059900ceec8() && event.pointerType)
|
|
176
|
+
return event.type === "click" && event.buttons === 1;
|
|
177
|
+
return event.detail === 0 && !event.pointerType;
|
|
178
|
+
}
|
|
179
|
+
function $6a7db85432448f7f$export$29bf1b5f2c56cf63(event) {
|
|
180
|
+
return !$c87311424ea30a05$export$a11b0059900ceec8() && event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse";
|
|
181
|
+
}
|
|
182
|
+
function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange) {
|
|
183
|
+
let [stateValue, setStateValue] = useState(value || defaultValue);
|
|
184
|
+
let isControlledRef = useRef(value !== void 0);
|
|
185
|
+
let isControlled = value !== void 0;
|
|
186
|
+
useEffect(() => {
|
|
187
|
+
let wasControlled = isControlledRef.current;
|
|
188
|
+
if (wasControlled !== isControlled)
|
|
189
|
+
console.warn(`WARN: A component changed from ${wasControlled ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}.`);
|
|
190
|
+
isControlledRef.current = isControlled;
|
|
191
|
+
}, [
|
|
192
|
+
isControlled
|
|
193
|
+
]);
|
|
194
|
+
let currentValue = isControlled ? value : stateValue;
|
|
195
|
+
let setValue = useCallback((value2, ...args) => {
|
|
196
|
+
let onChangeCaller = (value3, ...onChangeArgs) => {
|
|
197
|
+
if (onChange) {
|
|
198
|
+
if (!Object.is(currentValue, value3))
|
|
199
|
+
onChange(value3, ...onChangeArgs);
|
|
200
|
+
}
|
|
201
|
+
if (!isControlled)
|
|
202
|
+
currentValue = value3;
|
|
203
|
+
};
|
|
204
|
+
if (typeof value2 === "function") {
|
|
205
|
+
console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320");
|
|
206
|
+
let updateFunction = (oldValue, ...functionArgs) => {
|
|
207
|
+
let interceptedValue = value2(isControlled ? currentValue : oldValue, ...functionArgs);
|
|
208
|
+
onChangeCaller(interceptedValue, ...args);
|
|
209
|
+
if (!isControlled)
|
|
210
|
+
return interceptedValue;
|
|
211
|
+
return oldValue;
|
|
212
|
+
};
|
|
213
|
+
setStateValue(updateFunction);
|
|
214
|
+
} else {
|
|
215
|
+
if (!isControlled)
|
|
216
|
+
setStateValue(value2);
|
|
217
|
+
onChangeCaller(value2, ...args);
|
|
218
|
+
}
|
|
219
|
+
}, [
|
|
220
|
+
isControlled,
|
|
221
|
+
currentValue,
|
|
222
|
+
onChange
|
|
223
|
+
]);
|
|
224
|
+
return [
|
|
225
|
+
currentValue,
|
|
226
|
+
setValue
|
|
227
|
+
];
|
|
228
|
+
}
|
|
229
|
+
class $8a9cb279dc87e130$export$905e7fc544a71f36 {
|
|
230
|
+
isDefaultPrevented() {
|
|
231
|
+
return this.nativeEvent.defaultPrevented;
|
|
232
|
+
}
|
|
233
|
+
preventDefault() {
|
|
234
|
+
this.defaultPrevented = true;
|
|
235
|
+
this.nativeEvent.preventDefault();
|
|
236
|
+
}
|
|
237
|
+
stopPropagation() {
|
|
238
|
+
this.nativeEvent.stopPropagation();
|
|
239
|
+
this.isPropagationStopped = () => true;
|
|
240
|
+
}
|
|
241
|
+
isPropagationStopped() {
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
persist() {
|
|
245
|
+
}
|
|
246
|
+
constructor(type, nativeEvent) {
|
|
247
|
+
this.nativeEvent = nativeEvent;
|
|
248
|
+
this.target = nativeEvent.target;
|
|
249
|
+
this.currentTarget = nativeEvent.currentTarget;
|
|
250
|
+
this.relatedTarget = nativeEvent.relatedTarget;
|
|
251
|
+
this.bubbles = nativeEvent.bubbles;
|
|
252
|
+
this.cancelable = nativeEvent.cancelable;
|
|
253
|
+
this.defaultPrevented = nativeEvent.defaultPrevented;
|
|
254
|
+
this.eventPhase = nativeEvent.eventPhase;
|
|
255
|
+
this.isTrusted = nativeEvent.isTrusted;
|
|
256
|
+
this.timeStamp = nativeEvent.timeStamp;
|
|
257
|
+
this.type = type;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
function $8a9cb279dc87e130$export$715c682d09d639cc(onBlur) {
|
|
261
|
+
let stateRef = useRef({
|
|
262
|
+
isFocused: false,
|
|
263
|
+
observer: null
|
|
264
|
+
});
|
|
265
|
+
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
266
|
+
const state = stateRef.current;
|
|
267
|
+
return () => {
|
|
268
|
+
if (state.observer) {
|
|
269
|
+
state.observer.disconnect();
|
|
270
|
+
state.observer = null;
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
}, []);
|
|
274
|
+
let dispatchBlur = $8ae05eaa5c114e9c$export$7f54fc3180508a52((e) => {
|
|
275
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
276
|
+
});
|
|
277
|
+
return useCallback((e) => {
|
|
278
|
+
if (e.target instanceof HTMLButtonElement || e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLSelectElement) {
|
|
279
|
+
stateRef.current.isFocused = true;
|
|
280
|
+
let target = e.target;
|
|
281
|
+
let onBlurHandler = (e2) => {
|
|
282
|
+
stateRef.current.isFocused = false;
|
|
283
|
+
if (target.disabled)
|
|
284
|
+
dispatchBlur(new $8a9cb279dc87e130$export$905e7fc544a71f36("blur", e2));
|
|
285
|
+
if (stateRef.current.observer) {
|
|
286
|
+
stateRef.current.observer.disconnect();
|
|
287
|
+
stateRef.current.observer = null;
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
target.addEventListener("focusout", onBlurHandler, {
|
|
291
|
+
once: true
|
|
292
|
+
});
|
|
293
|
+
stateRef.current.observer = new MutationObserver(() => {
|
|
294
|
+
if (stateRef.current.isFocused && target.disabled) {
|
|
295
|
+
var _stateRef_current_observer;
|
|
296
|
+
(_stateRef_current_observer = stateRef.current.observer) === null || _stateRef_current_observer === void 0 ? void 0 : _stateRef_current_observer.disconnect();
|
|
297
|
+
let relatedTargetEl = target === document.activeElement ? null : document.activeElement;
|
|
298
|
+
target.dispatchEvent(new FocusEvent("blur", {
|
|
299
|
+
relatedTarget: relatedTargetEl
|
|
300
|
+
}));
|
|
301
|
+
target.dispatchEvent(new FocusEvent("focusout", {
|
|
302
|
+
bubbles: true,
|
|
303
|
+
relatedTarget: relatedTargetEl
|
|
304
|
+
}));
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
stateRef.current.observer.observe(target, {
|
|
308
|
+
attributes: true,
|
|
309
|
+
attributeFilter: [
|
|
310
|
+
"disabled"
|
|
311
|
+
]
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
}, [
|
|
315
|
+
dispatchBlur
|
|
316
|
+
]);
|
|
317
|
+
}
|
|
318
|
+
function $a1ea59d68270f0dd$export$f8168d8dd8fd66e6(props) {
|
|
319
|
+
let { isDisabled, onFocus: onFocusProp, onBlur: onBlurProp, onFocusChange } = props;
|
|
320
|
+
const onBlur = useCallback((e) => {
|
|
321
|
+
if (e.target === e.currentTarget) {
|
|
322
|
+
if (onBlurProp)
|
|
323
|
+
onBlurProp(e);
|
|
324
|
+
if (onFocusChange)
|
|
325
|
+
onFocusChange(false);
|
|
326
|
+
return true;
|
|
327
|
+
}
|
|
328
|
+
}, [
|
|
329
|
+
onBlurProp,
|
|
330
|
+
onFocusChange
|
|
331
|
+
]);
|
|
332
|
+
const onSyntheticFocus = $8a9cb279dc87e130$export$715c682d09d639cc(onBlur);
|
|
333
|
+
const onFocus = useCallback((e) => {
|
|
334
|
+
const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac(e.target);
|
|
335
|
+
if (e.target === e.currentTarget && ownerDocument.activeElement === e.target) {
|
|
336
|
+
if (onFocusProp)
|
|
337
|
+
onFocusProp(e);
|
|
338
|
+
if (onFocusChange)
|
|
339
|
+
onFocusChange(true);
|
|
340
|
+
onSyntheticFocus(e);
|
|
341
|
+
}
|
|
342
|
+
}, [
|
|
343
|
+
onFocusChange,
|
|
344
|
+
onFocusProp,
|
|
345
|
+
onSyntheticFocus
|
|
346
|
+
]);
|
|
347
|
+
return {
|
|
348
|
+
focusProps: {
|
|
349
|
+
onFocus: !isDisabled && (onFocusProp || onFocusChange || onBlurProp) ? onFocus : void 0,
|
|
350
|
+
onBlur: !isDisabled && (onBlurProp || onFocusChange) ? onBlur : void 0
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
let $507fabe10e71c6fb$var$currentModality = null;
|
|
355
|
+
let $507fabe10e71c6fb$var$changeHandlers = /* @__PURE__ */ new Set();
|
|
356
|
+
let $507fabe10e71c6fb$export$d90243b58daecda7 = /* @__PURE__ */ new Map();
|
|
357
|
+
let $507fabe10e71c6fb$var$hasEventBeforeFocus = false;
|
|
358
|
+
let $507fabe10e71c6fb$var$hasBlurredWindowRecently = false;
|
|
359
|
+
const $507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS = {
|
|
360
|
+
Tab: true,
|
|
361
|
+
Escape: true
|
|
362
|
+
};
|
|
363
|
+
function $507fabe10e71c6fb$var$triggerChangeHandlers(modality, e) {
|
|
364
|
+
for (let handler of $507fabe10e71c6fb$var$changeHandlers)
|
|
365
|
+
handler(modality, e);
|
|
366
|
+
}
|
|
367
|
+
function $507fabe10e71c6fb$var$isValidKey(e) {
|
|
368
|
+
return !(e.metaKey || !$c87311424ea30a05$export$9ac100e40613ea10() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
|
|
369
|
+
}
|
|
370
|
+
function $507fabe10e71c6fb$var$handleKeyboardEvent(e) {
|
|
371
|
+
$507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
|
372
|
+
if ($507fabe10e71c6fb$var$isValidKey(e)) {
|
|
373
|
+
$507fabe10e71c6fb$var$currentModality = "keyboard";
|
|
374
|
+
$507fabe10e71c6fb$var$triggerChangeHandlers("keyboard", e);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
function $507fabe10e71c6fb$var$handlePointerEvent(e) {
|
|
378
|
+
$507fabe10e71c6fb$var$currentModality = "pointer";
|
|
379
|
+
if (e.type === "mousedown" || e.type === "pointerdown") {
|
|
380
|
+
$507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
|
381
|
+
$507fabe10e71c6fb$var$triggerChangeHandlers("pointer", e);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
function $507fabe10e71c6fb$var$handleClickEvent(e) {
|
|
385
|
+
if ($6a7db85432448f7f$export$60278871457622de(e)) {
|
|
386
|
+
$507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
|
387
|
+
$507fabe10e71c6fb$var$currentModality = "virtual";
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
function $507fabe10e71c6fb$var$handleFocusEvent(e) {
|
|
391
|
+
if (e.target === window || e.target === document)
|
|
392
|
+
return;
|
|
393
|
+
if (!$507fabe10e71c6fb$var$hasEventBeforeFocus && !$507fabe10e71c6fb$var$hasBlurredWindowRecently) {
|
|
394
|
+
$507fabe10e71c6fb$var$currentModality = "virtual";
|
|
395
|
+
$507fabe10e71c6fb$var$triggerChangeHandlers("virtual", e);
|
|
396
|
+
}
|
|
397
|
+
$507fabe10e71c6fb$var$hasEventBeforeFocus = false;
|
|
398
|
+
$507fabe10e71c6fb$var$hasBlurredWindowRecently = false;
|
|
399
|
+
}
|
|
400
|
+
function $507fabe10e71c6fb$var$handleWindowBlur() {
|
|
401
|
+
$507fabe10e71c6fb$var$hasEventBeforeFocus = false;
|
|
402
|
+
$507fabe10e71c6fb$var$hasBlurredWindowRecently = true;
|
|
403
|
+
}
|
|
404
|
+
function $507fabe10e71c6fb$var$setupGlobalFocusEvents(element) {
|
|
405
|
+
if (typeof window === "undefined" || $507fabe10e71c6fb$export$d90243b58daecda7.get($431fbd86ca7dc216$export$f21a1ffae260145a(element)))
|
|
406
|
+
return;
|
|
407
|
+
const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a(element);
|
|
408
|
+
const documentObject = $431fbd86ca7dc216$export$b204af158042fbac(element);
|
|
409
|
+
let focus = windowObject.HTMLElement.prototype.focus;
|
|
410
|
+
windowObject.HTMLElement.prototype.focus = function() {
|
|
411
|
+
$507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
|
412
|
+
focus.apply(this, arguments);
|
|
413
|
+
};
|
|
414
|
+
documentObject.addEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
|
|
415
|
+
documentObject.addEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
|
|
416
|
+
documentObject.addEventListener("click", $507fabe10e71c6fb$var$handleClickEvent, true);
|
|
417
|
+
windowObject.addEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent, true);
|
|
418
|
+
windowObject.addEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur, false);
|
|
419
|
+
if (typeof PointerEvent !== "undefined") {
|
|
420
|
+
documentObject.addEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
421
|
+
documentObject.addEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
422
|
+
documentObject.addEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
423
|
+
} else {
|
|
424
|
+
documentObject.addEventListener("mousedown", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
425
|
+
documentObject.addEventListener("mousemove", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
426
|
+
documentObject.addEventListener("mouseup", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
427
|
+
}
|
|
428
|
+
windowObject.addEventListener("beforeunload", () => {
|
|
429
|
+
$507fabe10e71c6fb$var$tearDownWindowFocusTracking(element);
|
|
430
|
+
}, {
|
|
431
|
+
once: true
|
|
432
|
+
});
|
|
433
|
+
$507fabe10e71c6fb$export$d90243b58daecda7.set(windowObject, {
|
|
434
|
+
focus
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
const $507fabe10e71c6fb$var$tearDownWindowFocusTracking = (element, loadListener) => {
|
|
438
|
+
const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a(element);
|
|
439
|
+
const documentObject = $431fbd86ca7dc216$export$b204af158042fbac(element);
|
|
440
|
+
if (loadListener)
|
|
441
|
+
documentObject.removeEventListener("DOMContentLoaded", loadListener);
|
|
442
|
+
if (!$507fabe10e71c6fb$export$d90243b58daecda7.has(windowObject))
|
|
443
|
+
return;
|
|
444
|
+
windowObject.HTMLElement.prototype.focus = $507fabe10e71c6fb$export$d90243b58daecda7.get(windowObject).focus;
|
|
445
|
+
documentObject.removeEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
|
|
446
|
+
documentObject.removeEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
|
|
447
|
+
documentObject.removeEventListener("click", $507fabe10e71c6fb$var$handleClickEvent, true);
|
|
448
|
+
windowObject.removeEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent, true);
|
|
449
|
+
windowObject.removeEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur, false);
|
|
450
|
+
if (typeof PointerEvent !== "undefined") {
|
|
451
|
+
documentObject.removeEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
452
|
+
documentObject.removeEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
453
|
+
documentObject.removeEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
454
|
+
} else {
|
|
455
|
+
documentObject.removeEventListener("mousedown", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
456
|
+
documentObject.removeEventListener("mousemove", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
457
|
+
documentObject.removeEventListener("mouseup", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
458
|
+
}
|
|
459
|
+
$507fabe10e71c6fb$export$d90243b58daecda7.delete(windowObject);
|
|
460
|
+
};
|
|
461
|
+
function $507fabe10e71c6fb$export$2f1888112f558a7d(element) {
|
|
462
|
+
const documentObject = $431fbd86ca7dc216$export$b204af158042fbac(element);
|
|
463
|
+
let loadListener;
|
|
464
|
+
if (documentObject.readyState !== "loading")
|
|
465
|
+
$507fabe10e71c6fb$var$setupGlobalFocusEvents(element);
|
|
466
|
+
else {
|
|
467
|
+
loadListener = () => {
|
|
468
|
+
$507fabe10e71c6fb$var$setupGlobalFocusEvents(element);
|
|
469
|
+
};
|
|
470
|
+
documentObject.addEventListener("DOMContentLoaded", loadListener);
|
|
471
|
+
}
|
|
472
|
+
return () => $507fabe10e71c6fb$var$tearDownWindowFocusTracking(element, loadListener);
|
|
473
|
+
}
|
|
474
|
+
if (typeof document !== "undefined")
|
|
475
|
+
$507fabe10e71c6fb$export$2f1888112f558a7d();
|
|
476
|
+
function $507fabe10e71c6fb$export$b9b3dfddab17db27() {
|
|
477
|
+
return $507fabe10e71c6fb$var$currentModality !== "pointer";
|
|
478
|
+
}
|
|
479
|
+
function $507fabe10e71c6fb$export$630ff653c5ada6a9() {
|
|
480
|
+
return $507fabe10e71c6fb$var$currentModality;
|
|
481
|
+
}
|
|
482
|
+
function $507fabe10e71c6fb$export$8397ddfc504fdb9a(modality) {
|
|
483
|
+
$507fabe10e71c6fb$var$currentModality = modality;
|
|
484
|
+
$507fabe10e71c6fb$var$triggerChangeHandlers(modality, null);
|
|
485
|
+
}
|
|
486
|
+
function $507fabe10e71c6fb$export$98e20ec92f614cfe() {
|
|
487
|
+
$507fabe10e71c6fb$var$setupGlobalFocusEvents();
|
|
488
|
+
let [modality, setModality] = useState($507fabe10e71c6fb$var$currentModality);
|
|
489
|
+
useEffect(() => {
|
|
490
|
+
let handler = () => {
|
|
491
|
+
setModality($507fabe10e71c6fb$var$currentModality);
|
|
492
|
+
};
|
|
493
|
+
$507fabe10e71c6fb$var$changeHandlers.add(handler);
|
|
494
|
+
return () => {
|
|
495
|
+
$507fabe10e71c6fb$var$changeHandlers.delete(handler);
|
|
496
|
+
};
|
|
497
|
+
}, []);
|
|
498
|
+
return $b5e257d569688ac6$export$535bd6ca7f90a273() ? null : modality;
|
|
499
|
+
}
|
|
500
|
+
const $507fabe10e71c6fb$var$nonTextInputTypes = /* @__PURE__ */ new Set([
|
|
501
|
+
"checkbox",
|
|
502
|
+
"radio",
|
|
503
|
+
"range",
|
|
504
|
+
"color",
|
|
505
|
+
"file",
|
|
506
|
+
"image",
|
|
507
|
+
"button",
|
|
508
|
+
"submit",
|
|
509
|
+
"reset"
|
|
510
|
+
]);
|
|
511
|
+
function $507fabe10e71c6fb$var$isKeyboardFocusEvent(isTextInput, modality, e) {
|
|
512
|
+
var _e_target;
|
|
513
|
+
const IHTMLInputElement = typeof window !== "undefined" ? $431fbd86ca7dc216$export$f21a1ffae260145a(e === null || e === void 0 ? void 0 : e.target).HTMLInputElement : HTMLInputElement;
|
|
514
|
+
const IHTMLTextAreaElement = typeof window !== "undefined" ? $431fbd86ca7dc216$export$f21a1ffae260145a(e === null || e === void 0 ? void 0 : e.target).HTMLTextAreaElement : HTMLTextAreaElement;
|
|
515
|
+
const IHTMLElement = typeof window !== "undefined" ? $431fbd86ca7dc216$export$f21a1ffae260145a(e === null || e === void 0 ? void 0 : e.target).HTMLElement : HTMLElement;
|
|
516
|
+
const IKeyboardEvent = typeof window !== "undefined" ? $431fbd86ca7dc216$export$f21a1ffae260145a(e === null || e === void 0 ? void 0 : e.target).KeyboardEvent : KeyboardEvent;
|
|
517
|
+
isTextInput = isTextInput || (e === null || e === void 0 ? void 0 : e.target) instanceof IHTMLInputElement && !$507fabe10e71c6fb$var$nonTextInputTypes.has(e === null || e === void 0 ? void 0 : (_e_target = e.target) === null || _e_target === void 0 ? void 0 : _e_target.type) || (e === null || e === void 0 ? void 0 : e.target) instanceof IHTMLTextAreaElement || (e === null || e === void 0 ? void 0 : e.target) instanceof IHTMLElement && (e === null || e === void 0 ? void 0 : e.target.isContentEditable);
|
|
518
|
+
return !(isTextInput && modality === "keyboard" && e instanceof IKeyboardEvent && !$507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS[e.key]);
|
|
519
|
+
}
|
|
520
|
+
function $507fabe10e71c6fb$export$ec71b4b83ac08ec3(fn, deps, opts) {
|
|
521
|
+
$507fabe10e71c6fb$var$setupGlobalFocusEvents();
|
|
522
|
+
useEffect(() => {
|
|
523
|
+
let handler = (modality, e) => {
|
|
524
|
+
if (!$507fabe10e71c6fb$var$isKeyboardFocusEvent(!!(opts === null || opts === void 0 ? void 0 : opts.isTextInput), modality, e))
|
|
525
|
+
return;
|
|
526
|
+
fn($507fabe10e71c6fb$export$b9b3dfddab17db27());
|
|
527
|
+
};
|
|
528
|
+
$507fabe10e71c6fb$var$changeHandlers.add(handler);
|
|
529
|
+
return () => {
|
|
530
|
+
$507fabe10e71c6fb$var$changeHandlers.delete(handler);
|
|
531
|
+
};
|
|
532
|
+
}, deps);
|
|
533
|
+
}
|
|
534
|
+
function $9ab94262bd0047c7$export$420e68273165f4ec(props) {
|
|
535
|
+
let { isDisabled, onBlurWithin, onFocusWithin, onFocusWithinChange } = props;
|
|
536
|
+
let state = useRef({
|
|
537
|
+
isFocusWithin: false
|
|
538
|
+
});
|
|
539
|
+
let onBlur = useCallback((e) => {
|
|
540
|
+
if (state.current.isFocusWithin && !e.currentTarget.contains(e.relatedTarget)) {
|
|
541
|
+
state.current.isFocusWithin = false;
|
|
542
|
+
if (onBlurWithin)
|
|
543
|
+
onBlurWithin(e);
|
|
544
|
+
if (onFocusWithinChange)
|
|
545
|
+
onFocusWithinChange(false);
|
|
546
|
+
}
|
|
547
|
+
}, [
|
|
548
|
+
onBlurWithin,
|
|
549
|
+
onFocusWithinChange,
|
|
550
|
+
state
|
|
551
|
+
]);
|
|
552
|
+
let onSyntheticFocus = $8a9cb279dc87e130$export$715c682d09d639cc(onBlur);
|
|
553
|
+
let onFocus = useCallback((e) => {
|
|
554
|
+
if (!state.current.isFocusWithin && document.activeElement === e.target) {
|
|
555
|
+
if (onFocusWithin)
|
|
556
|
+
onFocusWithin(e);
|
|
557
|
+
if (onFocusWithinChange)
|
|
558
|
+
onFocusWithinChange(true);
|
|
559
|
+
state.current.isFocusWithin = true;
|
|
560
|
+
onSyntheticFocus(e);
|
|
561
|
+
}
|
|
562
|
+
}, [
|
|
563
|
+
onFocusWithin,
|
|
564
|
+
onFocusWithinChange,
|
|
565
|
+
onSyntheticFocus
|
|
566
|
+
]);
|
|
567
|
+
if (isDisabled)
|
|
568
|
+
return {
|
|
569
|
+
focusWithinProps: {
|
|
570
|
+
// These should not have been null, that would conflict in mergeProps
|
|
571
|
+
onFocus: void 0,
|
|
572
|
+
onBlur: void 0
|
|
573
|
+
}
|
|
574
|
+
};
|
|
575
|
+
return {
|
|
576
|
+
focusWithinProps: {
|
|
577
|
+
onFocus,
|
|
578
|
+
onBlur
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = false;
|
|
583
|
+
let $6179b936705e76d3$var$hoverCount = 0;
|
|
584
|
+
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents() {
|
|
585
|
+
$6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = true;
|
|
586
|
+
setTimeout(() => {
|
|
587
|
+
$6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = false;
|
|
588
|
+
}, 50);
|
|
589
|
+
}
|
|
590
|
+
function $6179b936705e76d3$var$handleGlobalPointerEvent(e) {
|
|
591
|
+
if (e.pointerType === "touch")
|
|
592
|
+
$6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents();
|
|
593
|
+
}
|
|
594
|
+
function $6179b936705e76d3$var$setupGlobalTouchEvents() {
|
|
595
|
+
if (typeof document === "undefined")
|
|
596
|
+
return;
|
|
597
|
+
if (typeof PointerEvent !== "undefined")
|
|
598
|
+
document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent);
|
|
599
|
+
else
|
|
600
|
+
document.addEventListener("touchend", $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents);
|
|
601
|
+
$6179b936705e76d3$var$hoverCount++;
|
|
602
|
+
return () => {
|
|
603
|
+
$6179b936705e76d3$var$hoverCount--;
|
|
604
|
+
if ($6179b936705e76d3$var$hoverCount > 0)
|
|
605
|
+
return;
|
|
606
|
+
if (typeof PointerEvent !== "undefined")
|
|
607
|
+
document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent);
|
|
608
|
+
else
|
|
609
|
+
document.removeEventListener("touchend", $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents);
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
function $6179b936705e76d3$export$ae780daf29e6d456(props) {
|
|
613
|
+
let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
|
|
614
|
+
let [isHovered, setHovered] = useState(false);
|
|
615
|
+
let state = useRef({
|
|
616
|
+
isHovered: false,
|
|
617
|
+
ignoreEmulatedMouseEvents: false,
|
|
618
|
+
pointerType: "",
|
|
619
|
+
target: null
|
|
620
|
+
}).current;
|
|
621
|
+
useEffect($6179b936705e76d3$var$setupGlobalTouchEvents, []);
|
|
622
|
+
let { hoverProps, triggerHoverEnd } = useMemo(() => {
|
|
623
|
+
let triggerHoverStart = (event, pointerType) => {
|
|
624
|
+
state.pointerType = pointerType;
|
|
625
|
+
if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
|
|
626
|
+
return;
|
|
627
|
+
state.isHovered = true;
|
|
628
|
+
let target = event.currentTarget;
|
|
629
|
+
state.target = target;
|
|
630
|
+
if (onHoverStart)
|
|
631
|
+
onHoverStart({
|
|
632
|
+
type: "hoverstart",
|
|
633
|
+
target,
|
|
634
|
+
pointerType
|
|
635
|
+
});
|
|
636
|
+
if (onHoverChange)
|
|
637
|
+
onHoverChange(true);
|
|
638
|
+
setHovered(true);
|
|
639
|
+
};
|
|
640
|
+
let triggerHoverEnd2 = (event, pointerType) => {
|
|
641
|
+
state.pointerType = "";
|
|
642
|
+
state.target = null;
|
|
643
|
+
if (pointerType === "touch" || !state.isHovered)
|
|
644
|
+
return;
|
|
645
|
+
state.isHovered = false;
|
|
646
|
+
let target = event.currentTarget;
|
|
647
|
+
if (onHoverEnd)
|
|
648
|
+
onHoverEnd({
|
|
649
|
+
type: "hoverend",
|
|
650
|
+
target,
|
|
651
|
+
pointerType
|
|
652
|
+
});
|
|
653
|
+
if (onHoverChange)
|
|
654
|
+
onHoverChange(false);
|
|
655
|
+
setHovered(false);
|
|
656
|
+
};
|
|
657
|
+
let hoverProps2 = {};
|
|
658
|
+
if (typeof PointerEvent !== "undefined") {
|
|
659
|
+
hoverProps2.onPointerEnter = (e) => {
|
|
660
|
+
if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents && e.pointerType === "mouse")
|
|
661
|
+
return;
|
|
662
|
+
triggerHoverStart(e, e.pointerType);
|
|
663
|
+
};
|
|
664
|
+
hoverProps2.onPointerLeave = (e) => {
|
|
665
|
+
if (!isDisabled && e.currentTarget.contains(e.target))
|
|
666
|
+
triggerHoverEnd2(e, e.pointerType);
|
|
667
|
+
};
|
|
668
|
+
} else {
|
|
669
|
+
hoverProps2.onTouchStart = () => {
|
|
670
|
+
state.ignoreEmulatedMouseEvents = true;
|
|
671
|
+
};
|
|
672
|
+
hoverProps2.onMouseEnter = (e) => {
|
|
673
|
+
if (!state.ignoreEmulatedMouseEvents && !$6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents)
|
|
674
|
+
triggerHoverStart(e, "mouse");
|
|
675
|
+
state.ignoreEmulatedMouseEvents = false;
|
|
676
|
+
};
|
|
677
|
+
hoverProps2.onMouseLeave = (e) => {
|
|
678
|
+
if (!isDisabled && e.currentTarget.contains(e.target))
|
|
679
|
+
triggerHoverEnd2(e, "mouse");
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
return {
|
|
683
|
+
hoverProps: hoverProps2,
|
|
684
|
+
triggerHoverEnd: triggerHoverEnd2
|
|
685
|
+
};
|
|
686
|
+
}, [
|
|
687
|
+
onHoverStart,
|
|
688
|
+
onHoverChange,
|
|
689
|
+
onHoverEnd,
|
|
690
|
+
isDisabled,
|
|
691
|
+
state
|
|
692
|
+
]);
|
|
693
|
+
useEffect(() => {
|
|
694
|
+
if (isDisabled)
|
|
695
|
+
triggerHoverEnd({
|
|
696
|
+
currentTarget: state.target
|
|
697
|
+
}, state.pointerType);
|
|
698
|
+
}, [
|
|
699
|
+
isDisabled
|
|
700
|
+
]);
|
|
701
|
+
return {
|
|
702
|
+
hoverProps,
|
|
703
|
+
isHovered
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
function $6a99195332edec8b$export$80f3e147d781571c(element) {
|
|
707
|
+
const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac(element);
|
|
708
|
+
if ($507fabe10e71c6fb$export$630ff653c5ada6a9() === "virtual") {
|
|
709
|
+
let lastFocusedElement = ownerDocument.activeElement;
|
|
710
|
+
$bbed8b41f857bcc0$export$24490316f764c430(() => {
|
|
711
|
+
if (ownerDocument.activeElement === lastFocusedElement && element.isConnected)
|
|
712
|
+
$7215afc6de606d6b$export$de79e2c695e052f3(element);
|
|
713
|
+
});
|
|
714
|
+
} else
|
|
715
|
+
$7215afc6de606d6b$export$de79e2c695e052f3(element);
|
|
716
|
+
}
|
|
717
|
+
export {
|
|
718
|
+
$6179b936705e76d3$export$ae780daf29e6d456 as $,
|
|
719
|
+
$507fabe10e71c6fb$export$b9b3dfddab17db27 as a,
|
|
720
|
+
$507fabe10e71c6fb$export$ec71b4b83ac08ec3 as b,
|
|
721
|
+
$a1ea59d68270f0dd$export$f8168d8dd8fd66e6 as c,
|
|
722
|
+
$9ab94262bd0047c7$export$420e68273165f4ec as d,
|
|
723
|
+
$458b0a5536c1a7cf$export$40bfa8c7b0832715 as e,
|
|
724
|
+
$431fbd86ca7dc216$export$f21a1ffae260145a as f,
|
|
725
|
+
$431fbd86ca7dc216$export$b204af158042fbac as g,
|
|
726
|
+
$6a99195332edec8b$export$80f3e147d781571c as h,
|
|
727
|
+
$507fabe10e71c6fb$export$8397ddfc504fdb9a as i,
|
|
728
|
+
$c87311424ea30a05$export$fedb369cb70207f1 as j,
|
|
729
|
+
$bbed8b41f857bcc0$export$24490316f764c430 as k,
|
|
730
|
+
$e7801be82b4b2a53$export$4debdb1a3f0fa79e as l,
|
|
731
|
+
$7215afc6de606d6b$export$de79e2c695e052f3 as m,
|
|
732
|
+
$c87311424ea30a05$export$b7d78993b74f766d as n,
|
|
733
|
+
$c87311424ea30a05$export$9ac100e40613ea10 as o,
|
|
734
|
+
$c87311424ea30a05$export$78551043582a6a98 as p,
|
|
735
|
+
$c87311424ea30a05$export$7bef049ce92e4224 as q,
|
|
736
|
+
$6a7db85432448f7f$export$29bf1b5f2c56cf63 as r,
|
|
737
|
+
$6a7db85432448f7f$export$60278871457622de as s,
|
|
738
|
+
$507fabe10e71c6fb$export$630ff653c5ada6a9 as t,
|
|
739
|
+
$c87311424ea30a05$export$a11b0059900ceec8 as u,
|
|
740
|
+
$c87311424ea30a05$export$e1865c3bedcd822b as v,
|
|
741
|
+
$507fabe10e71c6fb$export$98e20ec92f614cfe as w,
|
|
742
|
+
$c87311424ea30a05$export$186c6964ca17d99 as x
|
|
743
|
+
};
|