1 | import {useObjectRef as $bx7SL$useObjectRef, mergeProps as $bx7SL$mergeProps, useSyncRef as $bx7SL$useSyncRef, useGlobalListeners as $bx7SL$useGlobalListeners, useEffectEvent as $bx7SL$useEffectEvent, getOwnerDocument as $bx7SL$getOwnerDocument, isMac as $bx7SL$isMac, openLink as $bx7SL$openLink, isVirtualClick as $bx7SL$isVirtualClick, focusWithoutScrolling as $bx7SL$focusWithoutScrolling, isVirtualPointerEvent as $bx7SL$isVirtualPointerEvent, getOwnerWindow as $bx7SL$getOwnerWindow, isIOS as $bx7SL$isIOS, runAfterTransition as $bx7SL$runAfterTransition, useLayoutEffect as $bx7SL$useLayoutEffect, useEvent as $bx7SL$useEvent, useDescription as $bx7SL$useDescription} from "@react-aria/utils";
|
2 | import $bx7SL$react, {useContext as $bx7SL$useContext, useState as $bx7SL$useState, useRef as $bx7SL$useRef, useMemo as $bx7SL$useMemo, useEffect as $bx7SL$useEffect, useCallback as $bx7SL$useCallback} from "react";
|
3 | import {_ as $bx7SL$_} from "@swc/helpers/_/_class_private_field_get";
|
4 | import {_ as $bx7SL$_1} from "@swc/helpers/_/_class_private_field_init";
|
5 | import {_ as $bx7SL$_2} from "@swc/helpers/_/_class_private_field_set";
|
6 | import {useIsSSR as $bx7SL$useIsSSR} from "@react-aria/ssr";
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | |
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 | let $14c0b72509d70225$var$state = "default";
|
60 | let $14c0b72509d70225$var$savedUserSelect = "";
|
61 | let $14c0b72509d70225$var$modifiedElementMap = new WeakMap();
|
62 | function $14c0b72509d70225$export$16a4697467175487(target) {
|
63 | if ((0, $bx7SL$isIOS)()) {
|
64 | if ($14c0b72509d70225$var$state === "default") {
|
65 |
|
66 | const documentObject = (0, $bx7SL$getOwnerDocument)(target);
|
67 | $14c0b72509d70225$var$savedUserSelect = documentObject.documentElement.style.webkitUserSelect;
|
68 | documentObject.documentElement.style.webkitUserSelect = "none";
|
69 | }
|
70 | $14c0b72509d70225$var$state = "disabled";
|
71 | } else if (target instanceof HTMLElement || target instanceof SVGElement) {
|
72 |
|
73 |
|
74 | $14c0b72509d70225$var$modifiedElementMap.set(target, target.style.userSelect);
|
75 | target.style.userSelect = "none";
|
76 | }
|
77 | }
|
78 | function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
|
79 | if ((0, $bx7SL$isIOS)()) {
|
80 |
|
81 |
|
82 | if ($14c0b72509d70225$var$state !== "disabled") return;
|
83 | $14c0b72509d70225$var$state = "restoring";
|
84 |
|
85 |
|
86 | setTimeout(()=>{
|
87 |
|
88 |
|
89 | (0, $bx7SL$runAfterTransition)(()=>{
|
90 |
|
91 | if ($14c0b72509d70225$var$state === "restoring") {
|
92 |
|
93 | const documentObject = (0, $bx7SL$getOwnerDocument)(target);
|
94 | if (documentObject.documentElement.style.webkitUserSelect === "none") documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect || "";
|
95 | $14c0b72509d70225$var$savedUserSelect = "";
|
96 | $14c0b72509d70225$var$state = "default";
|
97 | }
|
98 | });
|
99 | }, 300);
|
100 | } else if (target instanceof HTMLElement || target instanceof SVGElement)
|
101 |
|
102 | {
|
103 | if (target && $14c0b72509d70225$var$modifiedElementMap.has(target)) {
|
104 | let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap.get(target);
|
105 | if (target.style.userSelect === "none" && targetOldUserSelect) target.style.userSelect = targetOldUserSelect;
|
106 | if (target.getAttribute("style") === "") target.removeAttribute("style");
|
107 | $14c0b72509d70225$var$modifiedElementMap.delete(target);
|
108 | }
|
109 | }
|
110 | }
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 | const $ae1eeba8b9eafd08$export$5165eccb35aaadb5 = (0, $bx7SL$react).createContext({
|
126 | register: ()=>{}
|
127 | });
|
128 | $ae1eeba8b9eafd08$export$5165eccb35aaadb5.displayName = "PressResponderContext";
|
129 |
|
130 |
|
131 |
|
132 | function $f6c31cce2adf654f$var$usePressResponderContext(props) {
|
133 |
|
134 | let context = (0, $bx7SL$useContext)((0, $ae1eeba8b9eafd08$export$5165eccb35aaadb5));
|
135 | if (context) {
|
136 | let { register: register, ...contextProps } = context;
|
137 | props = (0, $bx7SL$mergeProps)(contextProps, props);
|
138 | register();
|
139 | }
|
140 | (0, $bx7SL$useSyncRef)(context, props.ref);
|
141 | return props;
|
142 | }
|
143 | var $f6c31cce2adf654f$var$_shouldStopPropagation = new WeakMap();
|
144 | class $f6c31cce2adf654f$var$PressEvent {
|
145 | continuePropagation() {
|
146 | (0, $bx7SL$_2)(this, $f6c31cce2adf654f$var$_shouldStopPropagation, false);
|
147 | }
|
148 | get shouldStopPropagation() {
|
149 | return (0, $bx7SL$_)(this, $f6c31cce2adf654f$var$_shouldStopPropagation);
|
150 | }
|
151 | constructor(type, pointerType, originalEvent){
|
152 | (0, $bx7SL$_1)(this, $f6c31cce2adf654f$var$_shouldStopPropagation, {
|
153 | writable: true,
|
154 | value: void 0
|
155 | });
|
156 | (0, $bx7SL$_2)(this, $f6c31cce2adf654f$var$_shouldStopPropagation, true);
|
157 | this.type = type;
|
158 | this.pointerType = pointerType;
|
159 | this.target = originalEvent.currentTarget;
|
160 | this.shiftKey = originalEvent.shiftKey;
|
161 | this.metaKey = originalEvent.metaKey;
|
162 | this.ctrlKey = originalEvent.ctrlKey;
|
163 | this.altKey = originalEvent.altKey;
|
164 | }
|
165 | }
|
166 | const $f6c31cce2adf654f$var$LINK_CLICKED = Symbol("linkClicked");
|
167 | function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
168 | let { onPress: onPress, onPressChange: onPressChange, onPressStart: onPressStart, onPressEnd: onPressEnd, onPressUp: onPressUp, isDisabled: isDisabled, isPressed: isPressedProp, preventFocusOnPress: preventFocusOnPress, shouldCancelOnPointerExit: shouldCancelOnPointerExit, allowTextSelectionOnPress: allowTextSelectionOnPress,
|
169 | ref: _, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext(props);
|
170 | let [isPressed, setPressed] = (0, $bx7SL$useState)(false);
|
171 | let ref = (0, $bx7SL$useRef)({
|
172 | isPressed: false,
|
173 | ignoreEmulatedMouseEvents: false,
|
174 | ignoreClickAfterPress: false,
|
175 | didFirePressStart: false,
|
176 | isTriggeringEvent: false,
|
177 | activePointerId: null,
|
178 | target: null,
|
179 | isOverTarget: false,
|
180 | pointerType: null
|
181 | });
|
182 | let { addGlobalListener: addGlobalListener, removeAllGlobalListeners: removeAllGlobalListeners } = (0, $bx7SL$useGlobalListeners)();
|
183 | let triggerPressStart = (0, $bx7SL$useEffectEvent)((originalEvent, pointerType)=>{
|
184 | let state = ref.current;
|
185 | if (isDisabled || state.didFirePressStart) return false;
|
186 | let shouldStopPropagation = true;
|
187 | state.isTriggeringEvent = true;
|
188 | if (onPressStart) {
|
189 | let event = new $f6c31cce2adf654f$var$PressEvent("pressstart", pointerType, originalEvent);
|
190 | onPressStart(event);
|
191 | shouldStopPropagation = event.shouldStopPropagation;
|
192 | }
|
193 | if (onPressChange) onPressChange(true);
|
194 | state.isTriggeringEvent = false;
|
195 | state.didFirePressStart = true;
|
196 | setPressed(true);
|
197 | return shouldStopPropagation;
|
198 | });
|
199 | let triggerPressEnd = (0, $bx7SL$useEffectEvent)((originalEvent, pointerType, wasPressed = true)=>{
|
200 | let state = ref.current;
|
201 | if (!state.didFirePressStart) return false;
|
202 | state.ignoreClickAfterPress = true;
|
203 | state.didFirePressStart = false;
|
204 | state.isTriggeringEvent = true;
|
205 | let shouldStopPropagation = true;
|
206 | if (onPressEnd) {
|
207 | let event = new $f6c31cce2adf654f$var$PressEvent("pressend", pointerType, originalEvent);
|
208 | onPressEnd(event);
|
209 | shouldStopPropagation = event.shouldStopPropagation;
|
210 | }
|
211 | if (onPressChange) onPressChange(false);
|
212 | setPressed(false);
|
213 | if (onPress && wasPressed && !isDisabled) {
|
214 | let event = new $f6c31cce2adf654f$var$PressEvent("press", pointerType, originalEvent);
|
215 | onPress(event);
|
216 | shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
|
217 | }
|
218 | state.isTriggeringEvent = false;
|
219 | return shouldStopPropagation;
|
220 | });
|
221 | let triggerPressUp = (0, $bx7SL$useEffectEvent)((originalEvent, pointerType)=>{
|
222 | let state = ref.current;
|
223 | if (isDisabled) return false;
|
224 | if (onPressUp) {
|
225 | state.isTriggeringEvent = true;
|
226 | let event = new $f6c31cce2adf654f$var$PressEvent("pressup", pointerType, originalEvent);
|
227 | onPressUp(event);
|
228 | state.isTriggeringEvent = false;
|
229 | return event.shouldStopPropagation;
|
230 | }
|
231 | return true;
|
232 | });
|
233 | let cancel = (0, $bx7SL$useEffectEvent)((e)=>{
|
234 | let state = ref.current;
|
235 | if (state.isPressed && state.target) {
|
236 | if (state.isOverTarget && state.pointerType != null) triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
|
237 | state.isPressed = false;
|
238 | state.isOverTarget = false;
|
239 | state.activePointerId = null;
|
240 | state.pointerType = null;
|
241 | removeAllGlobalListeners();
|
242 | if (!allowTextSelectionOnPress) (0, $14c0b72509d70225$export$b0d6fa1ab32e3295)(state.target);
|
243 | }
|
244 | });
|
245 | let cancelOnPointerExit = (0, $bx7SL$useEffectEvent)((e)=>{
|
246 | if (shouldCancelOnPointerExit) cancel(e);
|
247 | });
|
248 | let pressProps = (0, $bx7SL$useMemo)(()=>{
|
249 | let state = ref.current;
|
250 | let pressProps = {
|
251 | onKeyDown (e) {
|
252 | if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e.nativeEvent, e.currentTarget) && e.currentTarget.contains(e.target)) {
|
253 | var _state_metaKeyEvents;
|
254 | if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(e.target, e.key)) e.preventDefault();
|
255 |
|
256 |
|
257 |
|
258 | let shouldStopPropagation = true;
|
259 | if (!state.isPressed && !e.repeat) {
|
260 | state.target = e.currentTarget;
|
261 | state.isPressed = true;
|
262 | shouldStopPropagation = triggerPressStart(e, "keyboard");
|
263 |
|
264 |
|
265 | addGlobalListener((0, $bx7SL$getOwnerDocument)(e.currentTarget), "keyup", onKeyUp, false);
|
266 | }
|
267 | if (shouldStopPropagation) e.stopPropagation();
|
268 |
|
269 |
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 | if (e.metaKey && (0, $bx7SL$isMac)()) (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e.key, e.nativeEvent);
|
276 | } else if (e.key === "Meta") state.metaKeyEvents = new Map();
|
277 | },
|
278 | onKeyUp (e) {
|
279 | if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e.nativeEvent, e.currentTarget) && !e.repeat && e.currentTarget.contains(e.target) && state.target) triggerPressUp($f6c31cce2adf654f$var$createEvent(state.target, e), "keyboard");
|
280 | },
|
281 | onClick (e) {
|
282 | if (e && !e.currentTarget.contains(e.target)) return;
|
283 | if (e && e.button === 0 && !state.isTriggeringEvent && !(0, $bx7SL$openLink).isOpening) {
|
284 | let shouldStopPropagation = true;
|
285 | if (isDisabled) e.preventDefault();
|
286 |
|
287 |
|
288 | if (!state.ignoreClickAfterPress && !state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || (0, $bx7SL$isVirtualClick)(e.nativeEvent))) {
|
289 |
|
290 | if (!isDisabled && !preventFocusOnPress) (0, $bx7SL$focusWithoutScrolling)(e.currentTarget);
|
291 | let stopPressStart = triggerPressStart(e, "virtual");
|
292 | let stopPressUp = triggerPressUp(e, "virtual");
|
293 | let stopPressEnd = triggerPressEnd(e, "virtual");
|
294 | shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
|
295 | }
|
296 | state.ignoreEmulatedMouseEvents = false;
|
297 | state.ignoreClickAfterPress = false;
|
298 | if (shouldStopPropagation) e.stopPropagation();
|
299 | }
|
300 | }
|
301 | };
|
302 | let onKeyUp = (e)=>{
|
303 | var _state_metaKeyEvents;
|
304 | if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent(e, state.target)) {
|
305 | var _state_metaKeyEvents1;
|
306 | if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(e.target, e.key)) e.preventDefault();
|
307 | let target = e.target;
|
308 | let shouldStopPropagation = triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), "keyboard", state.target.contains(target));
|
309 | removeAllGlobalListeners();
|
310 | if (shouldStopPropagation) e.stopPropagation();
|
311 |
|
312 |
|
313 |
|
314 | if (e.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink(state.target) && state.target.contains(target) && !e[$f6c31cce2adf654f$var$LINK_CLICKED]) {
|
315 |
|
316 |
|
317 | e[$f6c31cce2adf654f$var$LINK_CLICKED] = true;
|
318 | (0, $bx7SL$openLink)(state.target, e, false);
|
319 | }
|
320 | state.isPressed = false;
|
321 | (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e.key);
|
322 | } else if (e.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
|
323 | var _state_target;
|
324 |
|
325 |
|
326 |
|
327 | let events = state.metaKeyEvents;
|
328 | state.metaKeyEvents = undefined;
|
329 | for (let event of events.values())(_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
|
330 | }
|
331 | };
|
332 | if (typeof PointerEvent !== "undefined") {
|
333 | pressProps.onPointerDown = (e)=>{
|
334 |
|
335 | if (e.button !== 0 || !e.currentTarget.contains(e.target)) return;
|
336 |
|
337 |
|
338 |
|
339 |
|
340 | if ((0, $bx7SL$isVirtualPointerEvent)(e.nativeEvent)) {
|
341 | state.pointerType = "virtual";
|
342 | return;
|
343 | }
|
344 |
|
345 |
|
346 | if ($f6c31cce2adf654f$var$shouldPreventDefault(e.currentTarget)) e.preventDefault();
|
347 | state.pointerType = e.pointerType;
|
348 | let shouldStopPropagation = true;
|
349 | if (!state.isPressed) {
|
350 | state.isPressed = true;
|
351 | state.isOverTarget = true;
|
352 | state.activePointerId = e.pointerId;
|
353 | state.target = e.currentTarget;
|
354 | if (!isDisabled && !preventFocusOnPress) (0, $bx7SL$focusWithoutScrolling)(e.currentTarget);
|
355 | if (!allowTextSelectionOnPress) (0, $14c0b72509d70225$export$16a4697467175487)(state.target);
|
356 | shouldStopPropagation = triggerPressStart(e, state.pointerType);
|
357 | addGlobalListener((0, $bx7SL$getOwnerDocument)(e.currentTarget), "pointermove", onPointerMove, false);
|
358 | addGlobalListener((0, $bx7SL$getOwnerDocument)(e.currentTarget), "pointerup", onPointerUp, false);
|
359 | addGlobalListener((0, $bx7SL$getOwnerDocument)(e.currentTarget), "pointercancel", onPointerCancel, false);
|
360 | }
|
361 | if (shouldStopPropagation) e.stopPropagation();
|
362 | };
|
363 | pressProps.onMouseDown = (e)=>{
|
364 | if (!e.currentTarget.contains(e.target)) return;
|
365 | if (e.button === 0) {
|
366 |
|
367 |
|
368 |
|
369 | if ($f6c31cce2adf654f$var$shouldPreventDefault(e.currentTarget)) e.preventDefault();
|
370 | e.stopPropagation();
|
371 | }
|
372 | };
|
373 | pressProps.onPointerUp = (e)=>{
|
374 |
|
375 | if (!e.currentTarget.contains(e.target) || state.pointerType === "virtual") return;
|
376 |
|
377 |
|
378 |
|
379 | if (e.button === 0 && $f6c31cce2adf654f$var$isOverTarget(e, e.currentTarget)) triggerPressUp(e, state.pointerType || e.pointerType);
|
380 | };
|
381 |
|
382 |
|
383 |
|
384 | let onPointerMove = (e)=>{
|
385 | if (e.pointerId !== state.activePointerId) return;
|
386 | if (state.target && $f6c31cce2adf654f$var$isOverTarget(e, state.target)) {
|
387 | if (!state.isOverTarget && state.pointerType != null) {
|
388 | state.isOverTarget = true;
|
389 | triggerPressStart($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType);
|
390 | }
|
391 | } else if (state.target && state.isOverTarget && state.pointerType != null) {
|
392 | state.isOverTarget = false;
|
393 | triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
|
394 | cancelOnPointerExit(e);
|
395 | }
|
396 | };
|
397 | let onPointerUp = (e)=>{
|
398 | if (e.pointerId === state.activePointerId && state.isPressed && e.button === 0 && state.target) {
|
399 | if ($f6c31cce2adf654f$var$isOverTarget(e, state.target) && state.pointerType != null) triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType);
|
400 | else if (state.isOverTarget && state.pointerType != null) triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
|
401 | state.isPressed = false;
|
402 | state.isOverTarget = false;
|
403 | state.activePointerId = null;
|
404 | state.pointerType = null;
|
405 | removeAllGlobalListeners();
|
406 | if (!allowTextSelectionOnPress) (0, $14c0b72509d70225$export$b0d6fa1ab32e3295)(state.target);
|
407 | }
|
408 | };
|
409 | let onPointerCancel = (e)=>{
|
410 | cancel(e);
|
411 | };
|
412 | pressProps.onDragStart = (e)=>{
|
413 | if (!e.currentTarget.contains(e.target)) return;
|
414 |
|
415 | cancel(e);
|
416 | };
|
417 | } else {
|
418 | pressProps.onMouseDown = (e)=>{
|
419 |
|
420 | if (e.button !== 0 || !e.currentTarget.contains(e.target)) return;
|
421 |
|
422 |
|
423 | if ($f6c31cce2adf654f$var$shouldPreventDefault(e.currentTarget)) e.preventDefault();
|
424 | if (state.ignoreEmulatedMouseEvents) {
|
425 | e.stopPropagation();
|
426 | return;
|
427 | }
|
428 | state.isPressed = true;
|
429 | state.isOverTarget = true;
|
430 | state.target = e.currentTarget;
|
431 | state.pointerType = (0, $bx7SL$isVirtualClick)(e.nativeEvent) ? "virtual" : "mouse";
|
432 | if (!isDisabled && !preventFocusOnPress) (0, $bx7SL$focusWithoutScrolling)(e.currentTarget);
|
433 | let shouldStopPropagation = triggerPressStart(e, state.pointerType);
|
434 | if (shouldStopPropagation) e.stopPropagation();
|
435 | addGlobalListener((0, $bx7SL$getOwnerDocument)(e.currentTarget), "mouseup", onMouseUp, false);
|
436 | };
|
437 | pressProps.onMouseEnter = (e)=>{
|
438 | if (!e.currentTarget.contains(e.target)) return;
|
439 | let shouldStopPropagation = true;
|
440 | if (state.isPressed && !state.ignoreEmulatedMouseEvents && state.pointerType != null) {
|
441 | state.isOverTarget = true;
|
442 | shouldStopPropagation = triggerPressStart(e, state.pointerType);
|
443 | }
|
444 | if (shouldStopPropagation) e.stopPropagation();
|
445 | };
|
446 | pressProps.onMouseLeave = (e)=>{
|
447 | if (!e.currentTarget.contains(e.target)) return;
|
448 | let shouldStopPropagation = true;
|
449 | if (state.isPressed && !state.ignoreEmulatedMouseEvents && state.pointerType != null) {
|
450 | state.isOverTarget = false;
|
451 | shouldStopPropagation = triggerPressEnd(e, state.pointerType, false);
|
452 | cancelOnPointerExit(e);
|
453 | }
|
454 | if (shouldStopPropagation) e.stopPropagation();
|
455 | };
|
456 | pressProps.onMouseUp = (e)=>{
|
457 | if (!e.currentTarget.contains(e.target)) return;
|
458 | if (!state.ignoreEmulatedMouseEvents && e.button === 0) triggerPressUp(e, state.pointerType || "mouse");
|
459 | };
|
460 | let onMouseUp = (e)=>{
|
461 |
|
462 | if (e.button !== 0) return;
|
463 | state.isPressed = false;
|
464 | removeAllGlobalListeners();
|
465 | if (state.ignoreEmulatedMouseEvents) {
|
466 | state.ignoreEmulatedMouseEvents = false;
|
467 | return;
|
468 | }
|
469 | if (state.target && $f6c31cce2adf654f$var$isOverTarget(e, state.target) && state.pointerType != null) triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType);
|
470 | else if (state.target && state.isOverTarget && state.pointerType != null) triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
|
471 | state.isOverTarget = false;
|
472 | };
|
473 | pressProps.onTouchStart = (e)=>{
|
474 | if (!e.currentTarget.contains(e.target)) return;
|
475 | let touch = $f6c31cce2adf654f$var$getTouchFromEvent(e.nativeEvent);
|
476 | if (!touch) return;
|
477 | state.activePointerId = touch.identifier;
|
478 | state.ignoreEmulatedMouseEvents = true;
|
479 | state.isOverTarget = true;
|
480 | state.isPressed = true;
|
481 | state.target = e.currentTarget;
|
482 | state.pointerType = "touch";
|
483 |
|
484 |
|
485 | if (!isDisabled && !preventFocusOnPress) (0, $bx7SL$focusWithoutScrolling)(e.currentTarget);
|
486 | if (!allowTextSelectionOnPress) (0, $14c0b72509d70225$export$16a4697467175487)(state.target);
|
487 | let shouldStopPropagation = triggerPressStart(e, state.pointerType);
|
488 | if (shouldStopPropagation) e.stopPropagation();
|
489 | addGlobalListener((0, $bx7SL$getOwnerWindow)(e.currentTarget), "scroll", onScroll, true);
|
490 | };
|
491 | pressProps.onTouchMove = (e)=>{
|
492 | if (!e.currentTarget.contains(e.target)) return;
|
493 | if (!state.isPressed) {
|
494 | e.stopPropagation();
|
495 | return;
|
496 | }
|
497 | let touch = $f6c31cce2adf654f$var$getTouchById(e.nativeEvent, state.activePointerId);
|
498 | let shouldStopPropagation = true;
|
499 | if (touch && $f6c31cce2adf654f$var$isOverTarget(touch, e.currentTarget)) {
|
500 | if (!state.isOverTarget && state.pointerType != null) {
|
501 | state.isOverTarget = true;
|
502 | shouldStopPropagation = triggerPressStart(e, state.pointerType);
|
503 | }
|
504 | } else if (state.isOverTarget && state.pointerType != null) {
|
505 | state.isOverTarget = false;
|
506 | shouldStopPropagation = triggerPressEnd(e, state.pointerType, false);
|
507 | cancelOnPointerExit(e);
|
508 | }
|
509 | if (shouldStopPropagation) e.stopPropagation();
|
510 | };
|
511 | pressProps.onTouchEnd = (e)=>{
|
512 | if (!e.currentTarget.contains(e.target)) return;
|
513 | if (!state.isPressed) {
|
514 | e.stopPropagation();
|
515 | return;
|
516 | }
|
517 | let touch = $f6c31cce2adf654f$var$getTouchById(e.nativeEvent, state.activePointerId);
|
518 | let shouldStopPropagation = true;
|
519 | if (touch && $f6c31cce2adf654f$var$isOverTarget(touch, e.currentTarget) && state.pointerType != null) {
|
520 | triggerPressUp(e, state.pointerType);
|
521 | shouldStopPropagation = triggerPressEnd(e, state.pointerType);
|
522 | } else if (state.isOverTarget && state.pointerType != null) shouldStopPropagation = triggerPressEnd(e, state.pointerType, false);
|
523 | if (shouldStopPropagation) e.stopPropagation();
|
524 | state.isPressed = false;
|
525 | state.activePointerId = null;
|
526 | state.isOverTarget = false;
|
527 | state.ignoreEmulatedMouseEvents = true;
|
528 | if (state.target && !allowTextSelectionOnPress) (0, $14c0b72509d70225$export$b0d6fa1ab32e3295)(state.target);
|
529 | removeAllGlobalListeners();
|
530 | };
|
531 | pressProps.onTouchCancel = (e)=>{
|
532 | if (!e.currentTarget.contains(e.target)) return;
|
533 | e.stopPropagation();
|
534 | if (state.isPressed) cancel(e);
|
535 | };
|
536 | let onScroll = (e)=>{
|
537 | if (state.isPressed && e.target.contains(state.target)) cancel({
|
538 | currentTarget: state.target,
|
539 | shiftKey: false,
|
540 | ctrlKey: false,
|
541 | metaKey: false,
|
542 | altKey: false
|
543 | });
|
544 | };
|
545 | pressProps.onDragStart = (e)=>{
|
546 | if (!e.currentTarget.contains(e.target)) return;
|
547 | cancel(e);
|
548 | };
|
549 | }
|
550 | return pressProps;
|
551 | }, [
|
552 | addGlobalListener,
|
553 | isDisabled,
|
554 | preventFocusOnPress,
|
555 | removeAllGlobalListeners,
|
556 | allowTextSelectionOnPress,
|
557 | cancel,
|
558 | cancelOnPointerExit,
|
559 | triggerPressEnd,
|
560 | triggerPressStart,
|
561 | triggerPressUp
|
562 | ]);
|
563 |
|
564 |
|
565 | (0, $bx7SL$useEffect)(()=>{
|
566 | return ()=>{
|
567 | var _ref_current_target;
|
568 | if (!allowTextSelectionOnPress)
|
569 | (0, $14c0b72509d70225$export$b0d6fa1ab32e3295)((_ref_current_target = ref.current.target) !== null && _ref_current_target !== void 0 ? _ref_current_target : undefined);
|
570 | };
|
571 | }, [
|
572 | allowTextSelectionOnPress
|
573 | ]);
|
574 | return {
|
575 | isPressed: isPressedProp || isPressed,
|
576 | pressProps: (0, $bx7SL$mergeProps)(domProps, pressProps)
|
577 | };
|
578 | }
|
579 | function $f6c31cce2adf654f$var$isHTMLAnchorLink(target) {
|
580 | return target.tagName === "A" && target.hasAttribute("href");
|
581 | }
|
582 | function $f6c31cce2adf654f$var$isValidKeyboardEvent(event, currentTarget) {
|
583 | const { key: key, code: code } = event;
|
584 | const element = currentTarget;
|
585 | const role = element.getAttribute("role");
|
586 |
|
587 |
|
588 | return (key === "Enter" || key === " " || key === "Spacebar" || code === "Space") && !(element instanceof (0, $bx7SL$getOwnerWindow)(element).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey(element, key) || element instanceof (0, $bx7SL$getOwnerWindow)(element).HTMLTextAreaElement || element.isContentEditable) &&
|
589 | !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink(element)) && key !== "Enter");
|
590 | }
|
591 | function $f6c31cce2adf654f$var$getTouchFromEvent(event) {
|
592 | const { targetTouches: targetTouches } = event;
|
593 | if (targetTouches.length > 0) return targetTouches[0];
|
594 | return null;
|
595 | }
|
596 | function $f6c31cce2adf654f$var$getTouchById(event, pointerId) {
|
597 | const changedTouches = event.changedTouches;
|
598 | for(let i = 0; i < changedTouches.length; i++){
|
599 | const touch = changedTouches[i];
|
600 | if (touch.identifier === pointerId) return touch;
|
601 | }
|
602 | return null;
|
603 | }
|
604 | function $f6c31cce2adf654f$var$createEvent(target, e) {
|
605 | return {
|
606 | currentTarget: target,
|
607 | shiftKey: e.shiftKey,
|
608 | ctrlKey: e.ctrlKey,
|
609 | metaKey: e.metaKey,
|
610 | altKey: e.altKey
|
611 | };
|
612 | }
|
613 | function $f6c31cce2adf654f$var$getPointClientRect(point) {
|
614 | let offsetX = 0;
|
615 | let offsetY = 0;
|
616 | if (point.width !== undefined) offsetX = point.width / 2;
|
617 | else if (point.radiusX !== undefined) offsetX = point.radiusX;
|
618 | if (point.height !== undefined) offsetY = point.height / 2;
|
619 | else if (point.radiusY !== undefined) offsetY = point.radiusY;
|
620 | return {
|
621 | top: point.clientY - offsetY,
|
622 | right: point.clientX + offsetX,
|
623 | bottom: point.clientY + offsetY,
|
624 | left: point.clientX - offsetX
|
625 | };
|
626 | }
|
627 | function $f6c31cce2adf654f$var$areRectanglesOverlapping(a, b) {
|
628 |
|
629 | if (a.left > b.right || b.left > a.right) return false;
|
630 |
|
631 | if (a.top > b.bottom || b.top > a.bottom) return false;
|
632 | return true;
|
633 | }
|
634 | function $f6c31cce2adf654f$var$isOverTarget(point, target) {
|
635 | let rect = target.getBoundingClientRect();
|
636 | let pointRect = $f6c31cce2adf654f$var$getPointClientRect(point);
|
637 | return $f6c31cce2adf654f$var$areRectanglesOverlapping(rect, pointRect);
|
638 | }
|
639 | function $f6c31cce2adf654f$var$shouldPreventDefault(target) {
|
640 |
|
641 | return !(target instanceof HTMLElement) || !target.hasAttribute("draggable");
|
642 | }
|
643 | function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(target, key) {
|
644 | if (target instanceof HTMLInputElement) return !$f6c31cce2adf654f$var$isValidInputKey(target, key);
|
645 | if (target instanceof HTMLButtonElement) return target.type !== "submit" && target.type !== "reset";
|
646 | if ($f6c31cce2adf654f$var$isHTMLAnchorLink(target)) return false;
|
647 | return true;
|
648 | }
|
649 | const $f6c31cce2adf654f$var$nonTextInputTypes = new Set([
|
650 | "checkbox",
|
651 | "radio",
|
652 | "range",
|
653 | "color",
|
654 | "file",
|
655 | "image",
|
656 | "button",
|
657 | "submit",
|
658 | "reset"
|
659 | ]);
|
660 | function $f6c31cce2adf654f$var$isValidInputKey(target, key) {
|
661 |
|
662 | return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes.has(target.type);
|
663 | }
|
664 |
|
665 |
|
666 |
|
667 | const $3b117e43dc0ca95d$export$27c701ed9e449e99 = (0, $bx7SL$react).forwardRef(({ children: children, ...props }, ref)=>{
|
668 | ref = (0, $bx7SL$useObjectRef)(ref);
|
669 | let { pressProps: pressProps } = (0, $f6c31cce2adf654f$export$45712eceda6fad21)({
|
670 | ...props,
|
671 | ref: ref
|
672 | });
|
673 | let child = (0, $bx7SL$react).Children.only(children);
|
674 | return (0, $bx7SL$react).cloneElement(child,
|
675 | {
|
676 | ref: ref,
|
677 | ...(0, $bx7SL$mergeProps)(child.props, pressProps)
|
678 | });
|
679 | });
|
680 |
|
681 |
|
682 |
|
683 |
|
684 |
|
685 |
|
686 |
|
687 |
|
688 |
|
689 |
|
690 |
|
691 |
|
692 |
|
693 |
|
694 |
|
695 | const $f1ab8c75478c6f73$export$3351871ee4b288b8 = (0, $bx7SL$react).forwardRef(({ children: children, ...props }, ref)=>{
|
696 | let isRegistered = (0, $bx7SL$useRef)(false);
|
697 | let prevContext = (0, $bx7SL$useContext)((0, $ae1eeba8b9eafd08$export$5165eccb35aaadb5));
|
698 | ref = (0, $bx7SL$useObjectRef)(ref || (prevContext === null || prevContext === void 0 ? void 0 : prevContext.ref));
|
699 | let context = (0, $bx7SL$mergeProps)(prevContext || {}, {
|
700 | ...props,
|
701 | ref: ref,
|
702 | register () {
|
703 | isRegistered.current = true;
|
704 | if (prevContext) prevContext.register();
|
705 | }
|
706 | });
|
707 | (0, $bx7SL$useSyncRef)(prevContext, ref);
|
708 | (0, $bx7SL$useEffect)(()=>{
|
709 | if (!isRegistered.current) {
|
710 | console.warn("A PressResponder was rendered without a pressable child. Either call the usePress hook, or wrap your DOM node with <Pressable> component.");
|
711 | isRegistered.current = true;
|
712 | }
|
713 | }, []);
|
714 | return (0, $bx7SL$react).createElement((0, $ae1eeba8b9eafd08$export$5165eccb35aaadb5).Provider, {
|
715 | value: context
|
716 | }, children);
|
717 | });
|
718 | function $f1ab8c75478c6f73$export$cf75428e0b9ed1ea({ children: children }) {
|
719 | let context = (0, $bx7SL$useMemo)(()=>({
|
720 | register: ()=>{}
|
721 | }), []);
|
722 | return (0, $bx7SL$react).createElement((0, $ae1eeba8b9eafd08$export$5165eccb35aaadb5).Provider, {
|
723 | value: context
|
724 | }, children);
|
725 | }
|
726 |
|
727 |
|
728 |
|
729 |
|
730 |
|
731 |
|
732 |
|
733 |
|
734 |
|
735 |
|
736 |
|
737 |
|
738 |
|
739 |
|
740 |
|
741 |
|
742 |
|
743 |
|
744 |
|
745 |
|
746 |
|
747 |
|
748 |
|
749 |
|
750 |
|
751 |
|
752 |
|
753 |
|
754 |
|
755 | class $8a9cb279dc87e130$export$905e7fc544a71f36 {
|
756 | isDefaultPrevented() {
|
757 | return this.nativeEvent.defaultPrevented;
|
758 | }
|
759 | preventDefault() {
|
760 | this.defaultPrevented = true;
|
761 | this.nativeEvent.preventDefault();
|
762 | }
|
763 | stopPropagation() {
|
764 | this.nativeEvent.stopPropagation();
|
765 | this.isPropagationStopped = ()=>true;
|
766 | }
|
767 | isPropagationStopped() {
|
768 | return false;
|
769 | }
|
770 | persist() {}
|
771 | constructor(type, nativeEvent){
|
772 | this.nativeEvent = nativeEvent;
|
773 | this.target = nativeEvent.target;
|
774 | this.currentTarget = nativeEvent.currentTarget;
|
775 | this.relatedTarget = nativeEvent.relatedTarget;
|
776 | this.bubbles = nativeEvent.bubbles;
|
777 | this.cancelable = nativeEvent.cancelable;
|
778 | this.defaultPrevented = nativeEvent.defaultPrevented;
|
779 | this.eventPhase = nativeEvent.eventPhase;
|
780 | this.isTrusted = nativeEvent.isTrusted;
|
781 | this.timeStamp = nativeEvent.timeStamp;
|
782 | this.type = type;
|
783 | }
|
784 | }
|
785 | function $8a9cb279dc87e130$export$715c682d09d639cc(onBlur) {
|
786 | let stateRef = (0, $bx7SL$useRef)({
|
787 | isFocused: false,
|
788 | observer: null
|
789 | });
|
790 |
|
791 |
|
792 | (0, $bx7SL$useLayoutEffect)(()=>{
|
793 | const state = stateRef.current;
|
794 | return ()=>{
|
795 | if (state.observer) {
|
796 | state.observer.disconnect();
|
797 | state.observer = null;
|
798 | }
|
799 | };
|
800 | }, []);
|
801 | let dispatchBlur = (0, $bx7SL$useEffectEvent)((e)=>{
|
802 | onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
803 | });
|
804 |
|
805 | return (0, $bx7SL$useCallback)((e)=>{
|
806 |
|
807 |
|
808 |
|
809 |
|
810 | if (e.target instanceof HTMLButtonElement || e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLSelectElement) {
|
811 | stateRef.current.isFocused = true;
|
812 | let target = e.target;
|
813 | let onBlurHandler = (e)=>{
|
814 | stateRef.current.isFocused = false;
|
815 | if (target.disabled)
|
816 | dispatchBlur(new $8a9cb279dc87e130$export$905e7fc544a71f36("blur", e));
|
817 |
|
818 | if (stateRef.current.observer) {
|
819 | stateRef.current.observer.disconnect();
|
820 | stateRef.current.observer = null;
|
821 | }
|
822 | };
|
823 | target.addEventListener("focusout", onBlurHandler, {
|
824 | once: true
|
825 | });
|
826 | stateRef.current.observer = new MutationObserver(()=>{
|
827 | if (stateRef.current.isFocused && target.disabled) {
|
828 | var _stateRef_current_observer;
|
829 | (_stateRef_current_observer = stateRef.current.observer) === null || _stateRef_current_observer === void 0 ? void 0 : _stateRef_current_observer.disconnect();
|
830 | let relatedTargetEl = target === document.activeElement ? null : document.activeElement;
|
831 | target.dispatchEvent(new FocusEvent("blur", {
|
832 | relatedTarget: relatedTargetEl
|
833 | }));
|
834 | target.dispatchEvent(new FocusEvent("focusout", {
|
835 | bubbles: true,
|
836 | relatedTarget: relatedTargetEl
|
837 | }));
|
838 | }
|
839 | });
|
840 | stateRef.current.observer.observe(target, {
|
841 | attributes: true,
|
842 | attributeFilter: [
|
843 | "disabled"
|
844 | ]
|
845 | });
|
846 | }
|
847 | }, [
|
848 | dispatchBlur
|
849 | ]);
|
850 | }
|
851 |
|
852 |
|
853 | function $a1ea59d68270f0dd$export$f8168d8dd8fd66e6(props) {
|
854 | let { isDisabled: isDisabled, onFocus: onFocusProp, onBlur: onBlurProp, onFocusChange: onFocusChange } = props;
|
855 | const onBlur = (0, $bx7SL$useCallback)((e)=>{
|
856 | if (e.target === e.currentTarget) {
|
857 | if (onBlurProp) onBlurProp(e);
|
858 | if (onFocusChange) onFocusChange(false);
|
859 | return true;
|
860 | }
|
861 | }, [
|
862 | onBlurProp,
|
863 | onFocusChange
|
864 | ]);
|
865 | const onSyntheticFocus = (0, $8a9cb279dc87e130$export$715c682d09d639cc)(onBlur);
|
866 | const onFocus = (0, $bx7SL$useCallback)((e)=>{
|
867 |
|
868 |
|
869 | if (e.target === e.currentTarget && document.activeElement === e.target) {
|
870 | if (onFocusProp) onFocusProp(e);
|
871 | if (onFocusChange) onFocusChange(true);
|
872 | onSyntheticFocus(e);
|
873 | }
|
874 | }, [
|
875 | onFocusChange,
|
876 | onFocusProp,
|
877 | onSyntheticFocus
|
878 | ]);
|
879 | return {
|
880 | focusProps: {
|
881 | onFocus: !isDisabled && (onFocusProp || onFocusChange || onBlurProp) ? onFocus : undefined,
|
882 | onBlur: !isDisabled && (onBlurProp || onFocusChange) ? onBlur : undefined
|
883 | }
|
884 | };
|
885 | }
|
886 |
|
887 |
|
888 |
|
889 |
|
890 |
|
891 |
|
892 |
|
893 |
|
894 |
|
895 |
|
896 |
|
897 |
|
898 |
|
899 |
|
900 |
|
901 |
|
902 |
|
903 |
|
904 |
|
905 | let $507fabe10e71c6fb$var$currentModality = null;
|
906 | let $507fabe10e71c6fb$var$changeHandlers = new Set();
|
907 | let $507fabe10e71c6fb$var$hasSetupGlobalListeners = false;
|
908 | let $507fabe10e71c6fb$var$hasEventBeforeFocus = false;
|
909 | let $507fabe10e71c6fb$var$hasBlurredWindowRecently = false;
|
910 |
|
911 | const $507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS = {
|
912 | Tab: true,
|
913 | Escape: true
|
914 | };
|
915 | function $507fabe10e71c6fb$var$triggerChangeHandlers(modality, e) {
|
916 | for (let handler of $507fabe10e71c6fb$var$changeHandlers)handler(modality, e);
|
917 | }
|
918 |
|
919 |
|
920 | function $507fabe10e71c6fb$var$isValidKey(e) {
|
921 |
|
922 | return !(e.metaKey || !(0, $bx7SL$isMac)() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
|
923 | }
|
924 | function $507fabe10e71c6fb$var$handleKeyboardEvent(e) {
|
925 | $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
926 | if ($507fabe10e71c6fb$var$isValidKey(e)) {
|
927 | $507fabe10e71c6fb$var$currentModality = "keyboard";
|
928 | $507fabe10e71c6fb$var$triggerChangeHandlers("keyboard", e);
|
929 | }
|
930 | }
|
931 | function $507fabe10e71c6fb$var$handlePointerEvent(e) {
|
932 | $507fabe10e71c6fb$var$currentModality = "pointer";
|
933 | if (e.type === "mousedown" || e.type === "pointerdown") {
|
934 | $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
935 | $507fabe10e71c6fb$var$triggerChangeHandlers("pointer", e);
|
936 | }
|
937 | }
|
938 | function $507fabe10e71c6fb$var$handleClickEvent(e) {
|
939 | if ((0, $bx7SL$isVirtualClick)(e)) {
|
940 | $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
941 | $507fabe10e71c6fb$var$currentModality = "virtual";
|
942 | }
|
943 | }
|
944 | function $507fabe10e71c6fb$var$handleFocusEvent(e) {
|
945 |
|
946 |
|
947 |
|
948 | if (e.target === window || e.target === document) return;
|
949 |
|
950 |
|
951 | if (!$507fabe10e71c6fb$var$hasEventBeforeFocus && !$507fabe10e71c6fb$var$hasBlurredWindowRecently) {
|
952 | $507fabe10e71c6fb$var$currentModality = "virtual";
|
953 | $507fabe10e71c6fb$var$triggerChangeHandlers("virtual", e);
|
954 | }
|
955 | $507fabe10e71c6fb$var$hasEventBeforeFocus = false;
|
956 | $507fabe10e71c6fb$var$hasBlurredWindowRecently = false;
|
957 | }
|
958 | function $507fabe10e71c6fb$var$handleWindowBlur() {
|
959 |
|
960 |
|
961 | $507fabe10e71c6fb$var$hasEventBeforeFocus = false;
|
962 | $507fabe10e71c6fb$var$hasBlurredWindowRecently = true;
|
963 | }
|
964 |
|
965 |
|
966 | function $507fabe10e71c6fb$var$setupGlobalFocusEvents() {
|
967 | if (typeof window === "undefined" || $507fabe10e71c6fb$var$hasSetupGlobalListeners) return;
|
968 |
|
969 |
|
970 |
|
971 |
|
972 | let focus = HTMLElement.prototype.focus;
|
973 | HTMLElement.prototype.focus = function() {
|
974 | $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
975 | focus.apply(this, arguments);
|
976 | };
|
977 | document.addEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
|
978 | document.addEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
|
979 | document.addEventListener("click", $507fabe10e71c6fb$var$handleClickEvent, true);
|
980 |
|
981 |
|
982 | window.addEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent, true);
|
983 | window.addEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur, false);
|
984 | if (typeof PointerEvent !== "undefined") {
|
985 | document.addEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
986 | document.addEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
987 | document.addEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
988 | } else {
|
989 | document.addEventListener("mousedown", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
990 | document.addEventListener("mousemove", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
991 | document.addEventListener("mouseup", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
992 | }
|
993 | $507fabe10e71c6fb$var$hasSetupGlobalListeners = true;
|
994 | }
|
995 | if (typeof document !== "undefined") {
|
996 | if (document.readyState !== "loading") $507fabe10e71c6fb$var$setupGlobalFocusEvents();
|
997 | else document.addEventListener("DOMContentLoaded", $507fabe10e71c6fb$var$setupGlobalFocusEvents);
|
998 | }
|
999 | function $507fabe10e71c6fb$export$b9b3dfddab17db27() {
|
1000 | return $507fabe10e71c6fb$var$currentModality !== "pointer";
|
1001 | }
|
1002 | function $507fabe10e71c6fb$export$630ff653c5ada6a9() {
|
1003 | return $507fabe10e71c6fb$var$currentModality;
|
1004 | }
|
1005 | function $507fabe10e71c6fb$export$8397ddfc504fdb9a(modality) {
|
1006 | $507fabe10e71c6fb$var$currentModality = modality;
|
1007 | $507fabe10e71c6fb$var$triggerChangeHandlers(modality, null);
|
1008 | }
|
1009 | function $507fabe10e71c6fb$export$98e20ec92f614cfe() {
|
1010 | $507fabe10e71c6fb$var$setupGlobalFocusEvents();
|
1011 | let [modality, setModality] = (0, $bx7SL$useState)($507fabe10e71c6fb$var$currentModality);
|
1012 | (0, $bx7SL$useEffect)(()=>{
|
1013 | let handler = ()=>{
|
1014 | setModality($507fabe10e71c6fb$var$currentModality);
|
1015 | };
|
1016 | $507fabe10e71c6fb$var$changeHandlers.add(handler);
|
1017 | return ()=>{
|
1018 | $507fabe10e71c6fb$var$changeHandlers.delete(handler);
|
1019 | };
|
1020 | }, []);
|
1021 | return (0, $bx7SL$useIsSSR)() ? null : modality;
|
1022 | }
|
1023 | const $507fabe10e71c6fb$var$nonTextInputTypes = new Set([
|
1024 | "checkbox",
|
1025 | "radio",
|
1026 | "range",
|
1027 | "color",
|
1028 | "file",
|
1029 | "image",
|
1030 | "button",
|
1031 | "submit",
|
1032 | "reset"
|
1033 | ]);
|
1034 |
|
1035 |
|
1036 |
|
1037 | function $507fabe10e71c6fb$var$isKeyboardFocusEvent(isTextInput, modality, e) {
|
1038 | var _e_target;
|
1039 | isTextInput = isTextInput || (e === null || e === void 0 ? void 0 : e.target) instanceof HTMLInputElement && !$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 HTMLTextAreaElement || (e === null || e === void 0 ? void 0 : e.target) instanceof HTMLElement && (e === null || e === void 0 ? void 0 : e.target.isContentEditable);
|
1040 | return !(isTextInput && modality === "keyboard" && e instanceof KeyboardEvent && !$507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS[e.key]);
|
1041 | }
|
1042 | function $507fabe10e71c6fb$export$ffd9e5021c1fb2d6(props = {}) {
|
1043 | let { isTextInput: isTextInput, autoFocus: autoFocus } = props;
|
1044 | let [isFocusVisibleState, setFocusVisible] = (0, $bx7SL$useState)(autoFocus || $507fabe10e71c6fb$export$b9b3dfddab17db27());
|
1045 | $507fabe10e71c6fb$export$ec71b4b83ac08ec3((isFocusVisible)=>{
|
1046 | setFocusVisible(isFocusVisible);
|
1047 | }, [
|
1048 | isTextInput
|
1049 | ], {
|
1050 | isTextInput: isTextInput
|
1051 | });
|
1052 | return {
|
1053 | isFocusVisible: isFocusVisibleState
|
1054 | };
|
1055 | }
|
1056 | function $507fabe10e71c6fb$export$ec71b4b83ac08ec3(fn, deps, opts) {
|
1057 | $507fabe10e71c6fb$var$setupGlobalFocusEvents();
|
1058 | (0, $bx7SL$useEffect)(()=>{
|
1059 | let handler = (modality, e)=>{
|
1060 | if (!$507fabe10e71c6fb$var$isKeyboardFocusEvent(!!(opts === null || opts === void 0 ? void 0 : opts.isTextInput), modality, e)) return;
|
1061 | fn($507fabe10e71c6fb$export$b9b3dfddab17db27());
|
1062 | };
|
1063 | $507fabe10e71c6fb$var$changeHandlers.add(handler);
|
1064 | return ()=>{
|
1065 | $507fabe10e71c6fb$var$changeHandlers.delete(handler);
|
1066 | };
|
1067 |
|
1068 | }, deps);
|
1069 | }
|
1070 |
|
1071 |
|
1072 |
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 |
|
1079 |
|
1080 |
|
1081 |
|
1082 |
|
1083 |
|
1084 |
|
1085 |
|
1086 |
|
1087 |
|
1088 | function $9ab94262bd0047c7$export$420e68273165f4ec(props) {
|
1089 | let { isDisabled: isDisabled, onBlurWithin: onBlurWithin, onFocusWithin: onFocusWithin, onFocusWithinChange: onFocusWithinChange } = props;
|
1090 | let state = (0, $bx7SL$useRef)({
|
1091 | isFocusWithin: false
|
1092 | });
|
1093 | let onBlur = (0, $bx7SL$useCallback)((e)=>{
|
1094 |
|
1095 |
|
1096 |
|
1097 | if (state.current.isFocusWithin && !e.currentTarget.contains(e.relatedTarget)) {
|
1098 | state.current.isFocusWithin = false;
|
1099 | if (onBlurWithin) onBlurWithin(e);
|
1100 | if (onFocusWithinChange) onFocusWithinChange(false);
|
1101 | }
|
1102 | }, [
|
1103 | onBlurWithin,
|
1104 | onFocusWithinChange,
|
1105 | state
|
1106 | ]);
|
1107 | let onSyntheticFocus = (0, $8a9cb279dc87e130$export$715c682d09d639cc)(onBlur);
|
1108 | let onFocus = (0, $bx7SL$useCallback)((e)=>{
|
1109 |
|
1110 |
|
1111 | if (!state.current.isFocusWithin && document.activeElement === e.target) {
|
1112 | if (onFocusWithin) onFocusWithin(e);
|
1113 | if (onFocusWithinChange) onFocusWithinChange(true);
|
1114 | state.current.isFocusWithin = true;
|
1115 | onSyntheticFocus(e);
|
1116 | }
|
1117 | }, [
|
1118 | onFocusWithin,
|
1119 | onFocusWithinChange,
|
1120 | onSyntheticFocus
|
1121 | ]);
|
1122 | if (isDisabled) return {
|
1123 | focusWithinProps: {
|
1124 |
|
1125 | onFocus: undefined,
|
1126 | onBlur: undefined
|
1127 | }
|
1128 | };
|
1129 | return {
|
1130 | focusWithinProps: {
|
1131 | onFocus: onFocus,
|
1132 | onBlur: onBlur
|
1133 | }
|
1134 | };
|
1135 | }
|
1136 |
|
1137 |
|
1138 |
|
1139 |
|
1140 |
|
1141 |
|
1142 |
|
1143 |
|
1144 |
|
1145 |
|
1146 |
|
1147 |
|
1148 |
|
1149 |
|
1150 |
|
1151 |
|
1152 |
|
1153 |
|
1154 |
|
1155 |
|
1156 | let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = false;
|
1157 | let $6179b936705e76d3$var$hoverCount = 0;
|
1158 | function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents() {
|
1159 | $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = true;
|
1160 |
|
1161 |
|
1162 |
|
1163 |
|
1164 | setTimeout(()=>{
|
1165 | $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = false;
|
1166 | }, 50);
|
1167 | }
|
1168 | function $6179b936705e76d3$var$handleGlobalPointerEvent(e) {
|
1169 | if (e.pointerType === "touch") $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents();
|
1170 | }
|
1171 | function $6179b936705e76d3$var$setupGlobalTouchEvents() {
|
1172 | if (typeof document === "undefined") return;
|
1173 | if (typeof PointerEvent !== "undefined") document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent);
|
1174 | else document.addEventListener("touchend", $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents);
|
1175 | $6179b936705e76d3$var$hoverCount++;
|
1176 | return ()=>{
|
1177 | $6179b936705e76d3$var$hoverCount--;
|
1178 | if ($6179b936705e76d3$var$hoverCount > 0) return;
|
1179 | if (typeof PointerEvent !== "undefined") document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent);
|
1180 | else document.removeEventListener("touchend", $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents);
|
1181 | };
|
1182 | }
|
1183 | function $6179b936705e76d3$export$ae780daf29e6d456(props) {
|
1184 | let { onHoverStart: onHoverStart, onHoverChange: onHoverChange, onHoverEnd: onHoverEnd, isDisabled: isDisabled } = props;
|
1185 | let [isHovered, setHovered] = (0, $bx7SL$useState)(false);
|
1186 | let state = (0, $bx7SL$useRef)({
|
1187 | isHovered: false,
|
1188 | ignoreEmulatedMouseEvents: false,
|
1189 | pointerType: "",
|
1190 | target: null
|
1191 | }).current;
|
1192 | (0, $bx7SL$useEffect)($6179b936705e76d3$var$setupGlobalTouchEvents, []);
|
1193 | let { hoverProps: hoverProps, triggerHoverEnd: triggerHoverEnd } = (0, $bx7SL$useMemo)(()=>{
|
1194 | let triggerHoverStart = (event, pointerType)=>{
|
1195 | state.pointerType = pointerType;
|
1196 | if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target)) return;
|
1197 | state.isHovered = true;
|
1198 | let target = event.currentTarget;
|
1199 | state.target = target;
|
1200 | if (onHoverStart) onHoverStart({
|
1201 | type: "hoverstart",
|
1202 | target: target,
|
1203 | pointerType: pointerType
|
1204 | });
|
1205 | if (onHoverChange) onHoverChange(true);
|
1206 | setHovered(true);
|
1207 | };
|
1208 | let triggerHoverEnd = (event, pointerType)=>{
|
1209 | state.pointerType = "";
|
1210 | state.target = null;
|
1211 | if (pointerType === "touch" || !state.isHovered) return;
|
1212 | state.isHovered = false;
|
1213 | let target = event.currentTarget;
|
1214 | if (onHoverEnd) onHoverEnd({
|
1215 | type: "hoverend",
|
1216 | target: target,
|
1217 | pointerType: pointerType
|
1218 | });
|
1219 | if (onHoverChange) onHoverChange(false);
|
1220 | setHovered(false);
|
1221 | };
|
1222 | let hoverProps = {};
|
1223 | if (typeof PointerEvent !== "undefined") {
|
1224 | hoverProps.onPointerEnter = (e)=>{
|
1225 | if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents && e.pointerType === "mouse") return;
|
1226 | triggerHoverStart(e, e.pointerType);
|
1227 | };
|
1228 | hoverProps.onPointerLeave = (e)=>{
|
1229 | if (!isDisabled && e.currentTarget.contains(e.target)) triggerHoverEnd(e, e.pointerType);
|
1230 | };
|
1231 | } else {
|
1232 | hoverProps.onTouchStart = ()=>{
|
1233 | state.ignoreEmulatedMouseEvents = true;
|
1234 | };
|
1235 | hoverProps.onMouseEnter = (e)=>{
|
1236 | if (!state.ignoreEmulatedMouseEvents && !$6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents) triggerHoverStart(e, "mouse");
|
1237 | state.ignoreEmulatedMouseEvents = false;
|
1238 | };
|
1239 | hoverProps.onMouseLeave = (e)=>{
|
1240 | if (!isDisabled && e.currentTarget.contains(e.target)) triggerHoverEnd(e, "mouse");
|
1241 | };
|
1242 | }
|
1243 | return {
|
1244 | hoverProps: hoverProps,
|
1245 | triggerHoverEnd: triggerHoverEnd
|
1246 | };
|
1247 | }, [
|
1248 | onHoverStart,
|
1249 | onHoverChange,
|
1250 | onHoverEnd,
|
1251 | isDisabled,
|
1252 | state
|
1253 | ]);
|
1254 | (0, $bx7SL$useEffect)(()=>{
|
1255 |
|
1256 |
|
1257 | if (isDisabled) triggerHoverEnd({
|
1258 | currentTarget: state.target
|
1259 | }, state.pointerType);
|
1260 |
|
1261 | }, [
|
1262 | isDisabled
|
1263 | ]);
|
1264 | return {
|
1265 | hoverProps: hoverProps,
|
1266 | isHovered: isHovered
|
1267 | };
|
1268 | }
|
1269 |
|
1270 |
|
1271 |
|
1272 |
|
1273 |
|
1274 |
|
1275 |
|
1276 |
|
1277 |
|
1278 |
|
1279 |
|
1280 |
|
1281 |
|
1282 |
|
1283 |
|
1284 |
|
1285 |
|
1286 |
|
1287 | function $e0b6e0b68ec7f50f$export$872b660ac5a1ff98(props) {
|
1288 | let { ref: ref, onInteractOutside: onInteractOutside, isDisabled: isDisabled, onInteractOutsideStart: onInteractOutsideStart } = props;
|
1289 | let stateRef = (0, $bx7SL$useRef)({
|
1290 | isPointerDown: false,
|
1291 | ignoreEmulatedMouseEvents: false
|
1292 | });
|
1293 | let onPointerDown = (0, $bx7SL$useEffectEvent)((e)=>{
|
1294 | if (onInteractOutside && $e0b6e0b68ec7f50f$var$isValidEvent(e, ref)) {
|
1295 | if (onInteractOutsideStart) onInteractOutsideStart(e);
|
1296 | stateRef.current.isPointerDown = true;
|
1297 | }
|
1298 | });
|
1299 | let triggerInteractOutside = (0, $bx7SL$useEffectEvent)((e)=>{
|
1300 | if (onInteractOutside) onInteractOutside(e);
|
1301 | });
|
1302 | (0, $bx7SL$useEffect)(()=>{
|
1303 | let state = stateRef.current;
|
1304 | if (isDisabled) return;
|
1305 | const element = ref.current;
|
1306 | const documentObject = (0, $bx7SL$getOwnerDocument)(element);
|
1307 |
|
1308 | if (typeof PointerEvent !== "undefined") {
|
1309 | let onPointerUp = (e)=>{
|
1310 | if (state.isPointerDown && $e0b6e0b68ec7f50f$var$isValidEvent(e, ref)) triggerInteractOutside(e);
|
1311 | state.isPointerDown = false;
|
1312 | };
|
1313 |
|
1314 | documentObject.addEventListener("pointerdown", onPointerDown, true);
|
1315 | documentObject.addEventListener("pointerup", onPointerUp, true);
|
1316 | return ()=>{
|
1317 | documentObject.removeEventListener("pointerdown", onPointerDown, true);
|
1318 | documentObject.removeEventListener("pointerup", onPointerUp, true);
|
1319 | };
|
1320 | } else {
|
1321 | let onMouseUp = (e)=>{
|
1322 | if (state.ignoreEmulatedMouseEvents) state.ignoreEmulatedMouseEvents = false;
|
1323 | else if (state.isPointerDown && $e0b6e0b68ec7f50f$var$isValidEvent(e, ref)) triggerInteractOutside(e);
|
1324 | state.isPointerDown = false;
|
1325 | };
|
1326 | let onTouchEnd = (e)=>{
|
1327 | state.ignoreEmulatedMouseEvents = true;
|
1328 | if (state.isPointerDown && $e0b6e0b68ec7f50f$var$isValidEvent(e, ref)) triggerInteractOutside(e);
|
1329 | state.isPointerDown = false;
|
1330 | };
|
1331 | documentObject.addEventListener("mousedown", onPointerDown, true);
|
1332 | documentObject.addEventListener("mouseup", onMouseUp, true);
|
1333 | documentObject.addEventListener("touchstart", onPointerDown, true);
|
1334 | documentObject.addEventListener("touchend", onTouchEnd, true);
|
1335 | return ()=>{
|
1336 | documentObject.removeEventListener("mousedown", onPointerDown, true);
|
1337 | documentObject.removeEventListener("mouseup", onMouseUp, true);
|
1338 | documentObject.removeEventListener("touchstart", onPointerDown, true);
|
1339 | documentObject.removeEventListener("touchend", onTouchEnd, true);
|
1340 | };
|
1341 | }
|
1342 | }, [
|
1343 | ref,
|
1344 | isDisabled,
|
1345 | onPointerDown,
|
1346 | triggerInteractOutside
|
1347 | ]);
|
1348 | }
|
1349 | function $e0b6e0b68ec7f50f$var$isValidEvent(event, ref) {
|
1350 | if (event.button > 0) return false;
|
1351 | if (event.target) {
|
1352 |
|
1353 | const ownerDocument = event.target.ownerDocument;
|
1354 | if (!ownerDocument || !ownerDocument.documentElement.contains(event.target)) return false;
|
1355 |
|
1356 | if (event.target.closest("[data-react-aria-top-layer]")) return false;
|
1357 | }
|
1358 | return ref.current && !ref.current.contains(event.target);
|
1359 | }
|
1360 |
|
1361 |
|
1362 |
|
1363 |
|
1364 |
|
1365 |
|
1366 |
|
1367 |
|
1368 |
|
1369 |
|
1370 |
|
1371 |
|
1372 | |
1373 |
|
1374 |
|
1375 |
|
1376 |
|
1377 |
|
1378 |
|
1379 |
|
1380 |
|
1381 |
|
1382 | function $93925083ecbb358c$export$48d1ea6320830260(handler) {
|
1383 | if (!handler) return undefined;
|
1384 | let shouldStopPropagation = true;
|
1385 | return (e)=>{
|
1386 | let event = {
|
1387 | ...e,
|
1388 | preventDefault () {
|
1389 | e.preventDefault();
|
1390 | },
|
1391 | isDefaultPrevented () {
|
1392 | return e.isDefaultPrevented();
|
1393 | },
|
1394 | stopPropagation () {
|
1395 | console.error("stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.");
|
1396 | },
|
1397 | continuePropagation () {
|
1398 | shouldStopPropagation = false;
|
1399 | }
|
1400 | };
|
1401 | handler(event);
|
1402 | if (shouldStopPropagation) e.stopPropagation();
|
1403 | };
|
1404 | }
|
1405 |
|
1406 |
|
1407 | function $46d819fcbaf35654$export$8f71654801c2f7cd(props) {
|
1408 | return {
|
1409 | keyboardProps: props.isDisabled ? {} : {
|
1410 | onKeyDown: (0, $93925083ecbb358c$export$48d1ea6320830260)(props.onKeyDown),
|
1411 | onKeyUp: (0, $93925083ecbb358c$export$48d1ea6320830260)(props.onKeyUp)
|
1412 | }
|
1413 | };
|
1414 | }
|
1415 |
|
1416 |
|
1417 |
|
1418 |
|
1419 |
|
1420 |
|
1421 |
|
1422 |
|
1423 |
|
1424 |
|
1425 |
|
1426 |
|
1427 |
|
1428 |
|
1429 |
|
1430 | function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
|
1431 | let { onMoveStart: onMoveStart, onMove: onMove, onMoveEnd: onMoveEnd } = props;
|
1432 | let state = (0, $bx7SL$useRef)({
|
1433 | didMove: false,
|
1434 | lastPosition: null,
|
1435 | id: null
|
1436 | });
|
1437 | let { addGlobalListener: addGlobalListener, removeGlobalListener: removeGlobalListener } = (0, $bx7SL$useGlobalListeners)();
|
1438 | let move = (0, $bx7SL$useEffectEvent)((originalEvent, pointerType, deltaX, deltaY)=>{
|
1439 | if (deltaX === 0 && deltaY === 0) return;
|
1440 | if (!state.current.didMove) {
|
1441 | state.current.didMove = true;
|
1442 | onMoveStart === null || onMoveStart === void 0 ? void 0 : onMoveStart({
|
1443 | type: "movestart",
|
1444 | pointerType: pointerType,
|
1445 | shiftKey: originalEvent.shiftKey,
|
1446 | metaKey: originalEvent.metaKey,
|
1447 | ctrlKey: originalEvent.ctrlKey,
|
1448 | altKey: originalEvent.altKey
|
1449 | });
|
1450 | }
|
1451 | onMove === null || onMove === void 0 ? void 0 : onMove({
|
1452 | type: "move",
|
1453 | pointerType: pointerType,
|
1454 | deltaX: deltaX,
|
1455 | deltaY: deltaY,
|
1456 | shiftKey: originalEvent.shiftKey,
|
1457 | metaKey: originalEvent.metaKey,
|
1458 | ctrlKey: originalEvent.ctrlKey,
|
1459 | altKey: originalEvent.altKey
|
1460 | });
|
1461 | });
|
1462 | let end = (0, $bx7SL$useEffectEvent)((originalEvent, pointerType)=>{
|
1463 | (0, $14c0b72509d70225$export$b0d6fa1ab32e3295)();
|
1464 | if (state.current.didMove) onMoveEnd === null || onMoveEnd === void 0 ? void 0 : onMoveEnd({
|
1465 | type: "moveend",
|
1466 | pointerType: pointerType,
|
1467 | shiftKey: originalEvent.shiftKey,
|
1468 | metaKey: originalEvent.metaKey,
|
1469 | ctrlKey: originalEvent.ctrlKey,
|
1470 | altKey: originalEvent.altKey
|
1471 | });
|
1472 | });
|
1473 | let moveProps = (0, $bx7SL$useMemo)(()=>{
|
1474 | let moveProps = {};
|
1475 | let start = ()=>{
|
1476 | (0, $14c0b72509d70225$export$16a4697467175487)();
|
1477 | state.current.didMove = false;
|
1478 | };
|
1479 | if (typeof PointerEvent === "undefined") {
|
1480 | let onMouseMove = (e)=>{
|
1481 | if (e.button === 0) {
|
1482 | var _state_current_lastPosition, _state_current_lastPosition1;
|
1483 | var _state_current_lastPosition_pageX, _state_current_lastPosition_pageY;
|
1484 | move(e, "mouse", e.pageX - ((_state_current_lastPosition_pageX = (_state_current_lastPosition = state.current.lastPosition) === null || _state_current_lastPosition === void 0 ? void 0 : _state_current_lastPosition.pageX) !== null && _state_current_lastPosition_pageX !== void 0 ? _state_current_lastPosition_pageX : 0), e.pageY - ((_state_current_lastPosition_pageY = (_state_current_lastPosition1 = state.current.lastPosition) === null || _state_current_lastPosition1 === void 0 ? void 0 : _state_current_lastPosition1.pageY) !== null && _state_current_lastPosition_pageY !== void 0 ? _state_current_lastPosition_pageY : 0));
|
1485 | state.current.lastPosition = {
|
1486 | pageX: e.pageX,
|
1487 | pageY: e.pageY
|
1488 | };
|
1489 | }
|
1490 | };
|
1491 | let onMouseUp = (e)=>{
|
1492 | if (e.button === 0) {
|
1493 | end(e, "mouse");
|
1494 | removeGlobalListener(window, "mousemove", onMouseMove, false);
|
1495 | removeGlobalListener(window, "mouseup", onMouseUp, false);
|
1496 | }
|
1497 | };
|
1498 | moveProps.onMouseDown = (e)=>{
|
1499 | if (e.button === 0) {
|
1500 | start();
|
1501 | e.stopPropagation();
|
1502 | e.preventDefault();
|
1503 | state.current.lastPosition = {
|
1504 | pageX: e.pageX,
|
1505 | pageY: e.pageY
|
1506 | };
|
1507 | addGlobalListener(window, "mousemove", onMouseMove, false);
|
1508 | addGlobalListener(window, "mouseup", onMouseUp, false);
|
1509 | }
|
1510 | };
|
1511 | let onTouchMove = (e)=>{
|
1512 | let touch = [
|
1513 | ...e.changedTouches
|
1514 | ].findIndex(({ identifier: identifier })=>identifier === state.current.id);
|
1515 | if (touch >= 0) {
|
1516 | var _state_current_lastPosition, _state_current_lastPosition1;
|
1517 | let { pageX: pageX, pageY: pageY } = e.changedTouches[touch];
|
1518 | var _state_current_lastPosition_pageX, _state_current_lastPosition_pageY;
|
1519 | move(e, "touch", pageX - ((_state_current_lastPosition_pageX = (_state_current_lastPosition = state.current.lastPosition) === null || _state_current_lastPosition === void 0 ? void 0 : _state_current_lastPosition.pageX) !== null && _state_current_lastPosition_pageX !== void 0 ? _state_current_lastPosition_pageX : 0), pageY - ((_state_current_lastPosition_pageY = (_state_current_lastPosition1 = state.current.lastPosition) === null || _state_current_lastPosition1 === void 0 ? void 0 : _state_current_lastPosition1.pageY) !== null && _state_current_lastPosition_pageY !== void 0 ? _state_current_lastPosition_pageY : 0));
|
1520 | state.current.lastPosition = {
|
1521 | pageX: pageX,
|
1522 | pageY: pageY
|
1523 | };
|
1524 | }
|
1525 | };
|
1526 | let onTouchEnd = (e)=>{
|
1527 | let touch = [
|
1528 | ...e.changedTouches
|
1529 | ].findIndex(({ identifier: identifier })=>identifier === state.current.id);
|
1530 | if (touch >= 0) {
|
1531 | end(e, "touch");
|
1532 | state.current.id = null;
|
1533 | removeGlobalListener(window, "touchmove", onTouchMove);
|
1534 | removeGlobalListener(window, "touchend", onTouchEnd);
|
1535 | removeGlobalListener(window, "touchcancel", onTouchEnd);
|
1536 | }
|
1537 | };
|
1538 | moveProps.onTouchStart = (e)=>{
|
1539 | if (e.changedTouches.length === 0 || state.current.id != null) return;
|
1540 | let { pageX: pageX, pageY: pageY, identifier: identifier } = e.changedTouches[0];
|
1541 | start();
|
1542 | e.stopPropagation();
|
1543 | e.preventDefault();
|
1544 | state.current.lastPosition = {
|
1545 | pageX: pageX,
|
1546 | pageY: pageY
|
1547 | };
|
1548 | state.current.id = identifier;
|
1549 | addGlobalListener(window, "touchmove", onTouchMove, false);
|
1550 | addGlobalListener(window, "touchend", onTouchEnd, false);
|
1551 | addGlobalListener(window, "touchcancel", onTouchEnd, false);
|
1552 | };
|
1553 | } else {
|
1554 | let onPointerMove = (e)=>{
|
1555 | if (e.pointerId === state.current.id) {
|
1556 | var _state_current_lastPosition, _state_current_lastPosition1;
|
1557 | let pointerType = e.pointerType || "mouse";
|
1558 | var _state_current_lastPosition_pageX, _state_current_lastPosition_pageY;
|
1559 |
|
1560 |
|
1561 |
|
1562 | move(e, pointerType, e.pageX - ((_state_current_lastPosition_pageX = (_state_current_lastPosition = state.current.lastPosition) === null || _state_current_lastPosition === void 0 ? void 0 : _state_current_lastPosition.pageX) !== null && _state_current_lastPosition_pageX !== void 0 ? _state_current_lastPosition_pageX : 0), e.pageY - ((_state_current_lastPosition_pageY = (_state_current_lastPosition1 = state.current.lastPosition) === null || _state_current_lastPosition1 === void 0 ? void 0 : _state_current_lastPosition1.pageY) !== null && _state_current_lastPosition_pageY !== void 0 ? _state_current_lastPosition_pageY : 0));
|
1563 | state.current.lastPosition = {
|
1564 | pageX: e.pageX,
|
1565 | pageY: e.pageY
|
1566 | };
|
1567 | }
|
1568 | };
|
1569 | let onPointerUp = (e)=>{
|
1570 | if (e.pointerId === state.current.id) {
|
1571 | let pointerType = e.pointerType || "mouse";
|
1572 | end(e, pointerType);
|
1573 | state.current.id = null;
|
1574 | removeGlobalListener(window, "pointermove", onPointerMove, false);
|
1575 | removeGlobalListener(window, "pointerup", onPointerUp, false);
|
1576 | removeGlobalListener(window, "pointercancel", onPointerUp, false);
|
1577 | }
|
1578 | };
|
1579 | moveProps.onPointerDown = (e)=>{
|
1580 | if (e.button === 0 && state.current.id == null) {
|
1581 | start();
|
1582 | e.stopPropagation();
|
1583 | e.preventDefault();
|
1584 | state.current.lastPosition = {
|
1585 | pageX: e.pageX,
|
1586 | pageY: e.pageY
|
1587 | };
|
1588 | state.current.id = e.pointerId;
|
1589 | addGlobalListener(window, "pointermove", onPointerMove, false);
|
1590 | addGlobalListener(window, "pointerup", onPointerUp, false);
|
1591 | addGlobalListener(window, "pointercancel", onPointerUp, false);
|
1592 | }
|
1593 | };
|
1594 | }
|
1595 | let triggerKeyboardMove = (e, deltaX, deltaY)=>{
|
1596 | start();
|
1597 | move(e, "keyboard", deltaX, deltaY);
|
1598 | end(e, "keyboard");
|
1599 | };
|
1600 | moveProps.onKeyDown = (e)=>{
|
1601 | switch(e.key){
|
1602 | case "Left":
|
1603 | case "ArrowLeft":
|
1604 | e.preventDefault();
|
1605 | e.stopPropagation();
|
1606 | triggerKeyboardMove(e, -1, 0);
|
1607 | break;
|
1608 | case "Right":
|
1609 | case "ArrowRight":
|
1610 | e.preventDefault();
|
1611 | e.stopPropagation();
|
1612 | triggerKeyboardMove(e, 1, 0);
|
1613 | break;
|
1614 | case "Up":
|
1615 | case "ArrowUp":
|
1616 | e.preventDefault();
|
1617 | e.stopPropagation();
|
1618 | triggerKeyboardMove(e, 0, -1);
|
1619 | break;
|
1620 | case "Down":
|
1621 | case "ArrowDown":
|
1622 | e.preventDefault();
|
1623 | e.stopPropagation();
|
1624 | triggerKeyboardMove(e, 0, 1);
|
1625 | break;
|
1626 | }
|
1627 | };
|
1628 | return moveProps;
|
1629 | }, [
|
1630 | state,
|
1631 | addGlobalListener,
|
1632 | removeGlobalListener,
|
1633 | move,
|
1634 | end
|
1635 | ]);
|
1636 | return {
|
1637 | moveProps: moveProps
|
1638 | };
|
1639 | }
|
1640 |
|
1641 |
|
1642 |
|
1643 |
|
1644 |
|
1645 |
|
1646 |
|
1647 |
|
1648 |
|
1649 |
|
1650 |
|
1651 |
|
1652 |
|
1653 |
|
1654 |
|
1655 | function $7d0a636d7a4dcefd$export$2123ff2b87c81ca(props, ref) {
|
1656 | let { onScroll: onScroll, isDisabled: isDisabled } = props;
|
1657 | let onScrollHandler = (0, $bx7SL$useCallback)((e)=>{
|
1658 |
|
1659 | if (e.ctrlKey) return;
|
1660 |
|
1661 | e.preventDefault();
|
1662 | e.stopPropagation();
|
1663 | if (onScroll) onScroll({
|
1664 | deltaX: e.deltaX,
|
1665 | deltaY: e.deltaY
|
1666 | });
|
1667 | }, [
|
1668 | onScroll
|
1669 | ]);
|
1670 | (0, $bx7SL$useEvent)(ref, "wheel", isDisabled ? undefined : onScrollHandler);
|
1671 | }
|
1672 |
|
1673 |
|
1674 |
|
1675 |
|
1676 |
|
1677 |
|
1678 |
|
1679 |
|
1680 |
|
1681 |
|
1682 |
|
1683 |
|
1684 |
|
1685 |
|
1686 |
|
1687 | const $8a26561d2877236e$var$DEFAULT_THRESHOLD = 500;
|
1688 | function $8a26561d2877236e$export$c24ed0104d07eab9(props) {
|
1689 | let { isDisabled: isDisabled, onLongPressStart: onLongPressStart, onLongPressEnd: onLongPressEnd, onLongPress: onLongPress, threshold: threshold = $8a26561d2877236e$var$DEFAULT_THRESHOLD, accessibilityDescription: accessibilityDescription } = props;
|
1690 | const timeRef = (0, $bx7SL$useRef)();
|
1691 | let { addGlobalListener: addGlobalListener, removeGlobalListener: removeGlobalListener } = (0, $bx7SL$useGlobalListeners)();
|
1692 | let { pressProps: pressProps } = (0, $f6c31cce2adf654f$export$45712eceda6fad21)({
|
1693 | isDisabled: isDisabled,
|
1694 | onPressStart (e) {
|
1695 | e.continuePropagation();
|
1696 | if (e.pointerType === "mouse" || e.pointerType === "touch") {
|
1697 | if (onLongPressStart) onLongPressStart({
|
1698 | ...e,
|
1699 | type: "longpressstart"
|
1700 | });
|
1701 | timeRef.current = setTimeout(()=>{
|
1702 |
|
1703 | e.target.dispatchEvent(new PointerEvent("pointercancel", {
|
1704 | bubbles: true
|
1705 | }));
|
1706 | if (onLongPress) onLongPress({
|
1707 | ...e,
|
1708 | type: "longpress"
|
1709 | });
|
1710 | timeRef.current = undefined;
|
1711 | }, threshold);
|
1712 |
|
1713 | if (e.pointerType === "touch") {
|
1714 | let onContextMenu = (e)=>{
|
1715 | e.preventDefault();
|
1716 | };
|
1717 | addGlobalListener(e.target, "contextmenu", onContextMenu, {
|
1718 | once: true
|
1719 | });
|
1720 | addGlobalListener(window, "pointerup", ()=>{
|
1721 |
|
1722 |
|
1723 | setTimeout(()=>{
|
1724 | removeGlobalListener(e.target, "contextmenu", onContextMenu);
|
1725 | }, 30);
|
1726 | }, {
|
1727 | once: true
|
1728 | });
|
1729 | }
|
1730 | }
|
1731 | },
|
1732 | onPressEnd (e) {
|
1733 | if (timeRef.current) clearTimeout(timeRef.current);
|
1734 | if (onLongPressEnd && (e.pointerType === "mouse" || e.pointerType === "touch")) onLongPressEnd({
|
1735 | ...e,
|
1736 | type: "longpressend"
|
1737 | });
|
1738 | }
|
1739 | });
|
1740 | let descriptionProps = (0, $bx7SL$useDescription)(onLongPress && !isDisabled ? accessibilityDescription : undefined);
|
1741 | return {
|
1742 | longPressProps: (0, $bx7SL$mergeProps)(pressProps, descriptionProps)
|
1743 | };
|
1744 | }
|
1745 |
|
1746 |
|
1747 |
|
1748 |
|
1749 | export {$3b117e43dc0ca95d$export$27c701ed9e449e99 as Pressable, $f1ab8c75478c6f73$export$3351871ee4b288b8 as PressResponder, $f1ab8c75478c6f73$export$cf75428e0b9ed1ea as ClearPressResponder, $a1ea59d68270f0dd$export$f8168d8dd8fd66e6 as useFocus, $507fabe10e71c6fb$export$b9b3dfddab17db27 as isFocusVisible, $507fabe10e71c6fb$export$630ff653c5ada6a9 as getInteractionModality, $507fabe10e71c6fb$export$8397ddfc504fdb9a as setInteractionModality, $507fabe10e71c6fb$export$98e20ec92f614cfe as useInteractionModality, $507fabe10e71c6fb$export$ffd9e5021c1fb2d6 as useFocusVisible, $507fabe10e71c6fb$export$ec71b4b83ac08ec3 as useFocusVisibleListener, $9ab94262bd0047c7$export$420e68273165f4ec as useFocusWithin, $6179b936705e76d3$export$ae780daf29e6d456 as useHover, $e0b6e0b68ec7f50f$export$872b660ac5a1ff98 as useInteractOutside, $46d819fcbaf35654$export$8f71654801c2f7cd as useKeyboard, $e8a7022cf87cba2a$export$36da96379f79f245 as useMove, $f6c31cce2adf654f$export$45712eceda6fad21 as usePress, $7d0a636d7a4dcefd$export$2123ff2b87c81ca as useScrollWheel, $8a26561d2877236e$export$c24ed0104d07eab9 as useLongPress};
|
1750 |
|