@react-aria/interactions 3.17.0 → 3.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/import.mjs +77 -43
- package/dist/main.js +76 -41
- package/dist/main.js.map +1 -1
- package/dist/module.js +77 -43
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +4 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/PressResponder.tsx +8 -0
- package/src/index.ts +2 -2
- package/src/usePress.ts +58 -22
package/dist/module.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {mergeProps as $bx7SL$mergeProps, useSyncRef as $bx7SL$useSyncRef, useGlobalListeners as $bx7SL$useGlobalListeners, useEffectEvent as $bx7SL$useEffectEvent, isVirtualClick as $bx7SL$isVirtualClick, focusWithoutScrolling as $bx7SL$focusWithoutScrolling, isVirtualPointerEvent as $bx7SL$isVirtualPointerEvent, isIOS as $bx7SL$isIOS, runAfterTransition as $bx7SL$runAfterTransition, useLayoutEffect as $bx7SL$useLayoutEffect,
|
|
1
|
+
import {mergeProps as $bx7SL$mergeProps, useSyncRef as $bx7SL$useSyncRef, useGlobalListeners as $bx7SL$useGlobalListeners, useEffectEvent as $bx7SL$useEffectEvent, isMac as $bx7SL$isMac, openLink as $bx7SL$openLink, isVirtualClick as $bx7SL$isVirtualClick, focusWithoutScrolling as $bx7SL$focusWithoutScrolling, isVirtualPointerEvent as $bx7SL$isVirtualPointerEvent, 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
2
|
import $bx7SL$react, {useRef as $bx7SL$useRef, useContext as $bx7SL$useContext, useState as $bx7SL$useState, useMemo as $bx7SL$useMemo, useEffect as $bx7SL$useEffect, useCallback as $bx7SL$useCallback} from "react";
|
|
3
3
|
import {_ as $bx7SL$_} from "@swc/helpers/_/_class_private_field_get";
|
|
4
4
|
import {_ as $bx7SL$_1} from "@swc/helpers/_/_class_private_field_init";
|
|
@@ -127,7 +127,7 @@ function $f6c31cce2adf654f$var$usePressResponderContext(props) {
|
|
|
127
127
|
// Consume context from <PressResponder> and merge with props.
|
|
128
128
|
let context = (0, $bx7SL$useContext)((0, $ae1eeba8b9eafd08$export$5165eccb35aaadb5));
|
|
129
129
|
if (context) {
|
|
130
|
-
let { register: register
|
|
130
|
+
let { register: register, ...contextProps } = context;
|
|
131
131
|
props = (0, $bx7SL$mergeProps)(contextProps, props);
|
|
132
132
|
register();
|
|
133
133
|
}
|
|
@@ -157,31 +157,35 @@ class $f6c31cce2adf654f$var$PressEvent {
|
|
|
157
157
|
this.altKey = originalEvent.altKey;
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
+
const $f6c31cce2adf654f$var$LINK_CLICKED = Symbol("linkClicked");
|
|
160
161
|
function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
161
|
-
let { onPress: onPress
|
|
162
|
-
ref: _
|
|
162
|
+
let { onPress: onPress, onPressChange: onPressChange, onPressStart: onPressStart, onPressEnd: onPressEnd, onPressUp: onPressUp, isDisabled: isDisabled, isPressed: isPressedProp, preventFocusOnPress: preventFocusOnPress, shouldCancelOnPointerExit: shouldCancelOnPointerExit, allowTextSelectionOnPress: allowTextSelectionOnPress, // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
163
|
+
ref: _, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext(props);
|
|
163
164
|
let [isPressed, setPressed] = (0, $bx7SL$useState)(false);
|
|
164
165
|
let ref = (0, $bx7SL$useRef)({
|
|
165
166
|
isPressed: false,
|
|
166
167
|
ignoreEmulatedMouseEvents: false,
|
|
167
168
|
ignoreClickAfterPress: false,
|
|
168
169
|
didFirePressStart: false,
|
|
170
|
+
isTriggeringEvent: false,
|
|
169
171
|
activePointerId: null,
|
|
170
172
|
target: null,
|
|
171
173
|
isOverTarget: false,
|
|
172
174
|
pointerType: null
|
|
173
175
|
});
|
|
174
|
-
let { addGlobalListener: addGlobalListener
|
|
176
|
+
let { addGlobalListener: addGlobalListener, removeAllGlobalListeners: removeAllGlobalListeners } = (0, $bx7SL$useGlobalListeners)();
|
|
175
177
|
let triggerPressStart = (0, $bx7SL$useEffectEvent)((originalEvent, pointerType)=>{
|
|
176
178
|
let state = ref.current;
|
|
177
179
|
if (isDisabled || state.didFirePressStart) return;
|
|
178
180
|
let shouldStopPropagation = true;
|
|
181
|
+
state.isTriggeringEvent = true;
|
|
179
182
|
if (onPressStart) {
|
|
180
183
|
let event = new $f6c31cce2adf654f$var$PressEvent("pressstart", pointerType, originalEvent);
|
|
181
184
|
onPressStart(event);
|
|
182
185
|
shouldStopPropagation = event.shouldStopPropagation;
|
|
183
186
|
}
|
|
184
187
|
if (onPressChange) onPressChange(true);
|
|
188
|
+
state.isTriggeringEvent = false;
|
|
185
189
|
state.didFirePressStart = true;
|
|
186
190
|
setPressed(true);
|
|
187
191
|
return shouldStopPropagation;
|
|
@@ -191,6 +195,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
191
195
|
if (!state.didFirePressStart) return;
|
|
192
196
|
state.ignoreClickAfterPress = true;
|
|
193
197
|
state.didFirePressStart = false;
|
|
198
|
+
state.isTriggeringEvent = true;
|
|
194
199
|
let shouldStopPropagation = true;
|
|
195
200
|
if (onPressEnd) {
|
|
196
201
|
let event = new $f6c31cce2adf654f$var$PressEvent("pressend", pointerType, originalEvent);
|
|
@@ -204,13 +209,17 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
204
209
|
onPress(event);
|
|
205
210
|
shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
|
|
206
211
|
}
|
|
212
|
+
state.isTriggeringEvent = false;
|
|
207
213
|
return shouldStopPropagation;
|
|
208
214
|
});
|
|
209
215
|
let triggerPressUp = (0, $bx7SL$useEffectEvent)((originalEvent, pointerType)=>{
|
|
216
|
+
let state = ref.current;
|
|
210
217
|
if (isDisabled) return;
|
|
211
218
|
if (onPressUp) {
|
|
219
|
+
state.isTriggeringEvent = true;
|
|
212
220
|
let event = new $f6c31cce2adf654f$var$PressEvent("pressup", pointerType, originalEvent);
|
|
213
221
|
onPressUp(event);
|
|
222
|
+
state.isTriggeringEvent = false;
|
|
214
223
|
return event.shouldStopPropagation;
|
|
215
224
|
}
|
|
216
225
|
return true;
|
|
@@ -249,22 +258,27 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
249
258
|
addGlobalListener(document, "keyup", onKeyUp, false);
|
|
250
259
|
}
|
|
251
260
|
if (shouldStopPropagation) e.stopPropagation();
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
261
|
+
// Keep track of the keydown events that occur while the Meta (e.g. Command) key is held.
|
|
262
|
+
// macOS has a bug where keyup events are not fired while the Meta key is down.
|
|
263
|
+
// When the Meta key itself is released we will get an event for that, and we'll act as if
|
|
264
|
+
// all of these other keys were released as well.
|
|
265
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=1393524
|
|
266
|
+
// https://bugs.webkit.org/show_bug.cgi?id=55291
|
|
267
|
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=1299553
|
|
268
|
+
if (e.metaKey && (0, $bx7SL$isMac)()) state.metaKeyEvents.set(e.key, e.nativeEvent);
|
|
269
|
+
} else if (e.key === "Meta") state.metaKeyEvents = new Map();
|
|
256
270
|
},
|
|
257
271
|
onKeyUp (e) {
|
|
258
272
|
if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e.nativeEvent, e.currentTarget) && !e.repeat && e.currentTarget.contains(e.target)) triggerPressUp($f6c31cce2adf654f$var$createEvent(state.target, e), "keyboard");
|
|
259
273
|
},
|
|
260
274
|
onClick (e) {
|
|
261
275
|
if (e && !e.currentTarget.contains(e.target)) return;
|
|
262
|
-
if (e && e.button === 0) {
|
|
276
|
+
if (e && e.button === 0 && !state.isTriggeringEvent && !(0, $bx7SL$openLink).isOpening) {
|
|
263
277
|
let shouldStopPropagation = true;
|
|
264
278
|
if (isDisabled) e.preventDefault();
|
|
265
279
|
// If triggered from a screen reader or by using element.click(),
|
|
266
280
|
// trigger as if it were a keyboard click.
|
|
267
|
-
if (!state.ignoreClickAfterPress && !state.ignoreEmulatedMouseEvents && (state.pointerType === "virtual" || (0, $bx7SL$isVirtualClick)(e.nativeEvent))) {
|
|
281
|
+
if (!state.ignoreClickAfterPress && !state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || (0, $bx7SL$isVirtualClick)(e.nativeEvent))) {
|
|
268
282
|
// Ensure the element receives focus (VoiceOver on iOS does not do this)
|
|
269
283
|
if (!isDisabled && !preventFocusOnPress) (0, $bx7SL$focusWithoutScrolling)(e.currentTarget);
|
|
270
284
|
let stopPressStart = triggerPressStart(e, "virtual");
|
|
@@ -279,16 +293,32 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
279
293
|
}
|
|
280
294
|
};
|
|
281
295
|
let onKeyUp = (e)=>{
|
|
296
|
+
var _state_metaKeyEvents;
|
|
282
297
|
if (state.isPressed && $f6c31cce2adf654f$var$isValidKeyboardEvent(e, state.target)) {
|
|
298
|
+
var _state_metaKeyEvents1;
|
|
283
299
|
if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(e.target, e.key)) e.preventDefault();
|
|
284
|
-
state.isPressed = false;
|
|
285
300
|
let target = e.target;
|
|
286
301
|
let shouldStopPropagation = triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), "keyboard", state.target.contains(target));
|
|
287
302
|
removeAllGlobalListeners();
|
|
288
303
|
if (shouldStopPropagation) e.stopPropagation();
|
|
289
|
-
// If
|
|
290
|
-
//
|
|
291
|
-
|
|
304
|
+
// If a link was triggered with a key other than Enter, open the URL ourselves.
|
|
305
|
+
// This means the link has a role override, and the default browser behavior
|
|
306
|
+
// only applies when using the Enter key.
|
|
307
|
+
if (e.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink(state.target) && state.target.contains(target) && !e[$f6c31cce2adf654f$var$LINK_CLICKED]) {
|
|
308
|
+
// Store a hidden property on the event so we only trigger link click once,
|
|
309
|
+
// even if there are multiple usePress instances attached to the element.
|
|
310
|
+
e[$f6c31cce2adf654f$var$LINK_CLICKED] = true;
|
|
311
|
+
(0, $bx7SL$openLink)(state.target, e, false);
|
|
312
|
+
}
|
|
313
|
+
state.isPressed = false;
|
|
314
|
+
(_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e.key);
|
|
315
|
+
} else if (e.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
|
|
316
|
+
// If we recorded keydown events that occurred while the Meta key was pressed,
|
|
317
|
+
// and those haven't received keyup events already, fire keyup events ourselves.
|
|
318
|
+
// See comment above for more info about the macOS bug causing this.
|
|
319
|
+
let events = state.metaKeyEvents;
|
|
320
|
+
state.metaKeyEvents = null;
|
|
321
|
+
for (let event of events.values())state.target.dispatchEvent(new KeyboardEvent("keyup", event));
|
|
292
322
|
}
|
|
293
323
|
};
|
|
294
324
|
if (typeof PointerEvent !== "undefined") {
|
|
@@ -417,7 +447,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
417
447
|
};
|
|
418
448
|
pressProps.onMouseUp = (e)=>{
|
|
419
449
|
if (!e.currentTarget.contains(e.target)) return;
|
|
420
|
-
if (!state.ignoreEmulatedMouseEvents && e.button === 0) triggerPressUp(e, state.pointerType);
|
|
450
|
+
if (!state.ignoreEmulatedMouseEvents && e.button === 0) triggerPressUp(e, state.pointerType || "mouse");
|
|
421
451
|
};
|
|
422
452
|
let onMouseUp = (e)=>{
|
|
423
453
|
// Only handle left clicks
|
|
@@ -541,18 +571,16 @@ function $f6c31cce2adf654f$var$isHTMLAnchorLink(target) {
|
|
|
541
571
|
return target.tagName === "A" && target.hasAttribute("href");
|
|
542
572
|
}
|
|
543
573
|
function $f6c31cce2adf654f$var$isValidKeyboardEvent(event, currentTarget) {
|
|
544
|
-
const { key: key
|
|
574
|
+
const { key: key, code: code } = event;
|
|
545
575
|
const element = currentTarget;
|
|
546
576
|
const role = element.getAttribute("role");
|
|
547
577
|
// Accessibility for keyboards. Space and Enter only.
|
|
548
578
|
// "Spacebar" is for IE 11
|
|
549
|
-
return (key === "Enter" || key === " " || key === "Spacebar" || code === "Space") && !(element instanceof HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey(element, key) || element instanceof HTMLTextAreaElement || element.isContentEditable) && //
|
|
550
|
-
|
|
551
|
-
(!$f6c31cce2adf654f$var$isHTMLAnchorLink(element) || role === "button" && key !== "Enter") && // An element with role='link' should only trigger with Enter key
|
|
552
|
-
!(role === "link" && key !== "Enter");
|
|
579
|
+
return (key === "Enter" || key === " " || key === "Spacebar" || code === "Space") && !(element instanceof HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey(element, key) || element instanceof HTMLTextAreaElement || element.isContentEditable) && // Links should only trigger with Enter key
|
|
580
|
+
!((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink(element)) && key !== "Enter");
|
|
553
581
|
}
|
|
554
582
|
function $f6c31cce2adf654f$var$getTouchFromEvent(event) {
|
|
555
|
-
const { targetTouches: targetTouches
|
|
583
|
+
const { targetTouches: targetTouches } = event;
|
|
556
584
|
if (targetTouches.length > 0) return targetTouches[0];
|
|
557
585
|
return null;
|
|
558
586
|
}
|
|
@@ -597,11 +625,12 @@ function $f6c31cce2adf654f$var$isOverTarget(point, target) {
|
|
|
597
625
|
}
|
|
598
626
|
function $f6c31cce2adf654f$var$shouldPreventDefault(target) {
|
|
599
627
|
// We cannot prevent default if the target is a draggable element.
|
|
600
|
-
return !(target instanceof HTMLElement) || !target.draggable;
|
|
628
|
+
return !(target instanceof HTMLElement) || !target.hasAttribute("draggable");
|
|
601
629
|
}
|
|
602
630
|
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(target, key) {
|
|
603
631
|
if (target instanceof HTMLInputElement) return !$f6c31cce2adf654f$var$isValidInputKey(target, key);
|
|
604
632
|
if (target instanceof HTMLButtonElement) return target.type !== "submit" && target.type !== "reset";
|
|
633
|
+
if ($f6c31cce2adf654f$var$isHTMLAnchorLink(target)) return false;
|
|
605
634
|
return true;
|
|
606
635
|
}
|
|
607
636
|
const $f6c31cce2adf654f$var$nonTextInputTypes = new Set([
|
|
@@ -622,10 +651,10 @@ function $f6c31cce2adf654f$var$isValidInputKey(target, key) {
|
|
|
622
651
|
|
|
623
652
|
|
|
624
653
|
|
|
625
|
-
const $3b117e43dc0ca95d$export$27c701ed9e449e99 = /*#__PURE__*/ (0, $bx7SL$react).forwardRef(({ children: children
|
|
654
|
+
const $3b117e43dc0ca95d$export$27c701ed9e449e99 = /*#__PURE__*/ (0, $bx7SL$react).forwardRef(({ children: children, ...props }, ref)=>{
|
|
626
655
|
let newRef = (0, $bx7SL$useRef)();
|
|
627
656
|
ref = ref !== null && ref !== void 0 ? ref : newRef;
|
|
628
|
-
let { pressProps: pressProps
|
|
657
|
+
let { pressProps: pressProps } = (0, $f6c31cce2adf654f$export$45712eceda6fad21)({
|
|
629
658
|
...props,
|
|
630
659
|
ref: ref
|
|
631
660
|
});
|
|
@@ -651,7 +680,7 @@ const $3b117e43dc0ca95d$export$27c701ed9e449e99 = /*#__PURE__*/ (0, $bx7SL$react
|
|
|
651
680
|
*/
|
|
652
681
|
|
|
653
682
|
|
|
654
|
-
const $f1ab8c75478c6f73$export$3351871ee4b288b8 = /*#__PURE__*/ (0, $bx7SL$react).forwardRef(({ children: children
|
|
683
|
+
const $f1ab8c75478c6f73$export$3351871ee4b288b8 = /*#__PURE__*/ (0, $bx7SL$react).forwardRef(({ children: children, ...props }, ref)=>{
|
|
655
684
|
let isRegistered = (0, $bx7SL$useRef)(false);
|
|
656
685
|
let prevContext = (0, $bx7SL$useContext)((0, $ae1eeba8b9eafd08$export$5165eccb35aaadb5));
|
|
657
686
|
let context = (0, $bx7SL$mergeProps)(prevContext || {}, {
|
|
@@ -673,6 +702,11 @@ const $f1ab8c75478c6f73$export$3351871ee4b288b8 = /*#__PURE__*/ (0, $bx7SL$react
|
|
|
673
702
|
value: context
|
|
674
703
|
}, children);
|
|
675
704
|
});
|
|
705
|
+
function $f1ab8c75478c6f73$export$cf75428e0b9ed1ea({ children: children }) {
|
|
706
|
+
return /*#__PURE__*/ (0, $bx7SL$react).createElement((0, $ae1eeba8b9eafd08$export$5165eccb35aaadb5).Provider, {
|
|
707
|
+
value: undefined
|
|
708
|
+
}, children);
|
|
709
|
+
}
|
|
676
710
|
|
|
677
711
|
|
|
678
712
|
/*
|
|
@@ -800,7 +834,7 @@ function $8a9cb279dc87e130$export$715c682d09d639cc(onBlur) {
|
|
|
800
834
|
|
|
801
835
|
|
|
802
836
|
function $a1ea59d68270f0dd$export$f8168d8dd8fd66e6(props) {
|
|
803
|
-
let { isDisabled: isDisabled
|
|
837
|
+
let { isDisabled: isDisabled, onFocus: onFocusProp, onBlur: onBlurProp, onFocusChange: onFocusChange } = props;
|
|
804
838
|
const onBlur = (0, $bx7SL$useCallback)((e)=>{
|
|
805
839
|
if (e.target === e.currentTarget) {
|
|
806
840
|
if (onBlurProp) onBlurProp(e);
|
|
@@ -976,7 +1010,7 @@ function $507fabe10e71c6fb$export$98e20ec92f614cfe() {
|
|
|
976
1010
|
return !(isTextInput && modality === "keyboard" && e instanceof KeyboardEvent && !$507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS[e.key]);
|
|
977
1011
|
}
|
|
978
1012
|
function $507fabe10e71c6fb$export$ffd9e5021c1fb2d6(props = {}) {
|
|
979
|
-
let { isTextInput: isTextInput
|
|
1013
|
+
let { isTextInput: isTextInput, autoFocus: autoFocus } = props;
|
|
980
1014
|
let [isFocusVisibleState, setFocusVisible] = (0, $bx7SL$useState)(autoFocus || $507fabe10e71c6fb$export$b9b3dfddab17db27());
|
|
981
1015
|
$507fabe10e71c6fb$export$ec71b4b83ac08ec3((isFocusVisible)=>{
|
|
982
1016
|
setFocusVisible(isFocusVisible);
|
|
@@ -1022,7 +1056,7 @@ function $507fabe10e71c6fb$export$ec71b4b83ac08ec3(fn, deps, opts) {
|
|
|
1022
1056
|
|
|
1023
1057
|
|
|
1024
1058
|
function $9ab94262bd0047c7$export$420e68273165f4ec(props) {
|
|
1025
|
-
let { isDisabled: isDisabled
|
|
1059
|
+
let { isDisabled: isDisabled, onBlurWithin: onBlurWithin, onFocusWithin: onFocusWithin, onFocusWithinChange: onFocusWithinChange } = props;
|
|
1026
1060
|
let state = (0, $bx7SL$useRef)({
|
|
1027
1061
|
isFocusWithin: false
|
|
1028
1062
|
});
|
|
@@ -1116,7 +1150,7 @@ function $6179b936705e76d3$var$setupGlobalTouchEvents() {
|
|
|
1116
1150
|
};
|
|
1117
1151
|
}
|
|
1118
1152
|
function $6179b936705e76d3$export$ae780daf29e6d456(props) {
|
|
1119
|
-
let { onHoverStart: onHoverStart
|
|
1153
|
+
let { onHoverStart: onHoverStart, onHoverChange: onHoverChange, onHoverEnd: onHoverEnd, isDisabled: isDisabled } = props;
|
|
1120
1154
|
let [isHovered, setHovered] = (0, $bx7SL$useState)(false);
|
|
1121
1155
|
let state = (0, $bx7SL$useRef)({
|
|
1122
1156
|
isHovered: false,
|
|
@@ -1125,7 +1159,7 @@ function $6179b936705e76d3$export$ae780daf29e6d456(props) {
|
|
|
1125
1159
|
target: null
|
|
1126
1160
|
}).current;
|
|
1127
1161
|
(0, $bx7SL$useEffect)($6179b936705e76d3$var$setupGlobalTouchEvents, []);
|
|
1128
|
-
let { hoverProps: hoverProps
|
|
1162
|
+
let { hoverProps: hoverProps, triggerHoverEnd: triggerHoverEnd } = (0, $bx7SL$useMemo)(()=>{
|
|
1129
1163
|
let triggerHoverStart = (event, pointerType)=>{
|
|
1130
1164
|
state.pointerType = pointerType;
|
|
1131
1165
|
if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target)) return;
|
|
@@ -1220,7 +1254,7 @@ function $6179b936705e76d3$export$ae780daf29e6d456(props) {
|
|
|
1220
1254
|
|
|
1221
1255
|
|
|
1222
1256
|
function $e0b6e0b68ec7f50f$export$872b660ac5a1ff98(props) {
|
|
1223
|
-
let { ref: ref
|
|
1257
|
+
let { ref: ref, onInteractOutside: onInteractOutside, isDisabled: isDisabled, onInteractOutsideStart: onInteractOutsideStart } = props;
|
|
1224
1258
|
let stateRef = (0, $bx7SL$useRef)({
|
|
1225
1259
|
isPointerDown: false,
|
|
1226
1260
|
ignoreEmulatedMouseEvents: false
|
|
@@ -1361,13 +1395,13 @@ function $46d819fcbaf35654$export$8f71654801c2f7cd(props) {
|
|
|
1361
1395
|
|
|
1362
1396
|
|
|
1363
1397
|
function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
|
|
1364
|
-
let { onMoveStart: onMoveStart
|
|
1398
|
+
let { onMoveStart: onMoveStart, onMove: onMove, onMoveEnd: onMoveEnd } = props;
|
|
1365
1399
|
let state = (0, $bx7SL$useRef)({
|
|
1366
1400
|
didMove: false,
|
|
1367
1401
|
lastPosition: null,
|
|
1368
1402
|
id: null
|
|
1369
1403
|
});
|
|
1370
|
-
let { addGlobalListener: addGlobalListener
|
|
1404
|
+
let { addGlobalListener: addGlobalListener, removeGlobalListener: removeGlobalListener } = (0, $bx7SL$useGlobalListeners)();
|
|
1371
1405
|
let move = (0, $bx7SL$useEffectEvent)((originalEvent, pointerType, deltaX, deltaY)=>{
|
|
1372
1406
|
if (deltaX === 0 && deltaY === 0) return;
|
|
1373
1407
|
if (!state.current.didMove) {
|
|
@@ -1442,9 +1476,9 @@ function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
|
|
|
1442
1476
|
let onTouchMove = (e)=>{
|
|
1443
1477
|
let touch = [
|
|
1444
1478
|
...e.changedTouches
|
|
1445
|
-
].findIndex(({ identifier: identifier
|
|
1479
|
+
].findIndex(({ identifier: identifier })=>identifier === state.current.id);
|
|
1446
1480
|
if (touch >= 0) {
|
|
1447
|
-
let { pageX: pageX
|
|
1481
|
+
let { pageX: pageX, pageY: pageY } = e.changedTouches[touch];
|
|
1448
1482
|
move(e, "touch", pageX - state.current.lastPosition.pageX, pageY - state.current.lastPosition.pageY);
|
|
1449
1483
|
state.current.lastPosition = {
|
|
1450
1484
|
pageX: pageX,
|
|
@@ -1455,7 +1489,7 @@ function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
|
|
|
1455
1489
|
let onTouchEnd = (e)=>{
|
|
1456
1490
|
let touch = [
|
|
1457
1491
|
...e.changedTouches
|
|
1458
|
-
].findIndex(({ identifier: identifier
|
|
1492
|
+
].findIndex(({ identifier: identifier })=>identifier === state.current.id);
|
|
1459
1493
|
if (touch >= 0) {
|
|
1460
1494
|
end(e, "touch");
|
|
1461
1495
|
state.current.id = null;
|
|
@@ -1466,7 +1500,7 @@ function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
|
|
|
1466
1500
|
};
|
|
1467
1501
|
moveProps.onTouchStart = (e)=>{
|
|
1468
1502
|
if (e.changedTouches.length === 0 || state.current.id != null) return;
|
|
1469
|
-
let { pageX: pageX
|
|
1503
|
+
let { pageX: pageX, pageY: pageY, identifier: identifier } = e.changedTouches[0];
|
|
1470
1504
|
start();
|
|
1471
1505
|
e.stopPropagation();
|
|
1472
1506
|
e.preventDefault();
|
|
@@ -1580,7 +1614,7 @@ function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
|
|
|
1580
1614
|
*/
|
|
1581
1615
|
|
|
1582
1616
|
function $7d0a636d7a4dcefd$export$2123ff2b87c81ca(props, ref) {
|
|
1583
|
-
let { onScroll: onScroll
|
|
1617
|
+
let { onScroll: onScroll, isDisabled: isDisabled } = props;
|
|
1584
1618
|
let onScrollHandler = (0, $bx7SL$useCallback)((e)=>{
|
|
1585
1619
|
// If the ctrlKey is pressed, this is a zoom event, do nothing.
|
|
1586
1620
|
if (e.ctrlKey) return;
|
|
@@ -1613,10 +1647,10 @@ function $7d0a636d7a4dcefd$export$2123ff2b87c81ca(props, ref) {
|
|
|
1613
1647
|
|
|
1614
1648
|
const $8a26561d2877236e$var$DEFAULT_THRESHOLD = 500;
|
|
1615
1649
|
function $8a26561d2877236e$export$c24ed0104d07eab9(props) {
|
|
1616
|
-
let { isDisabled: isDisabled
|
|
1650
|
+
let { isDisabled: isDisabled, onLongPressStart: onLongPressStart, onLongPressEnd: onLongPressEnd, onLongPress: onLongPress, threshold: threshold = $8a26561d2877236e$var$DEFAULT_THRESHOLD, accessibilityDescription: accessibilityDescription } = props;
|
|
1617
1651
|
const timeRef = (0, $bx7SL$useRef)(null);
|
|
1618
|
-
let { addGlobalListener: addGlobalListener
|
|
1619
|
-
let { pressProps: pressProps
|
|
1652
|
+
let { addGlobalListener: addGlobalListener, removeGlobalListener: removeGlobalListener } = (0, $bx7SL$useGlobalListeners)();
|
|
1653
|
+
let { pressProps: pressProps } = (0, $f6c31cce2adf654f$export$45712eceda6fad21)({
|
|
1620
1654
|
isDisabled: isDisabled,
|
|
1621
1655
|
onPressStart (e) {
|
|
1622
1656
|
e.continuePropagation();
|
|
@@ -1673,5 +1707,5 @@ function $8a26561d2877236e$export$c24ed0104d07eab9(props) {
|
|
|
1673
1707
|
|
|
1674
1708
|
|
|
1675
1709
|
|
|
1676
|
-
export {$3b117e43dc0ca95d$export$27c701ed9e449e99 as Pressable, $f1ab8c75478c6f73$export$3351871ee4b288b8 as PressResponder, $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};
|
|
1710
|
+
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};
|
|
1677
1711
|
//# sourceMappingURL=module.js.map
|