@react-aria/interactions 3.15.1 → 3.16.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 +152 -145
- package/dist/main.js +151 -144
- package/dist/main.js.map +1 -1
- package/dist/module.js +152 -145
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/PressResponder.tsx +1 -0
- package/src/useHover.ts +1 -2
- package/src/useInteractOutside.ts +25 -22
- package/src/useMove.ts +43 -41
- package/src/usePress.ts +112 -103
- package/src/utils.ts +10 -7
package/dist/main.js
CHANGED
|
@@ -155,16 +155,6 @@ function $0294ea432cd92340$var$usePressResponderContext(props) {
|
|
|
155
155
|
function $0294ea432cd92340$export$45712eceda6fad21(props) {
|
|
156
156
|
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
|
|
157
157
|
ref: _ , ...domProps } = $0294ea432cd92340$var$usePressResponderContext(props);
|
|
158
|
-
let propsRef = (0, $goTMa$react.useRef)(null);
|
|
159
|
-
propsRef.current = {
|
|
160
|
-
onPress: onPress,
|
|
161
|
-
onPressChange: onPressChange,
|
|
162
|
-
onPressStart: onPressStart,
|
|
163
|
-
onPressEnd: onPressEnd,
|
|
164
|
-
onPressUp: onPressUp,
|
|
165
|
-
isDisabled: isDisabled,
|
|
166
|
-
shouldCancelOnPointerExit: shouldCancelOnPointerExit
|
|
167
|
-
};
|
|
168
158
|
let [isPressed, setPressed] = (0, $goTMa$react.useState)(false);
|
|
169
159
|
let ref = (0, $goTMa$react.useRef)({
|
|
170
160
|
isPressed: false,
|
|
@@ -177,74 +167,77 @@ function $0294ea432cd92340$export$45712eceda6fad21(props) {
|
|
|
177
167
|
pointerType: null
|
|
178
168
|
});
|
|
179
169
|
let { addGlobalListener: addGlobalListener , removeAllGlobalListeners: removeAllGlobalListeners } = (0, $goTMa$reactariautils.useGlobalListeners)();
|
|
170
|
+
let triggerPressStart = (0, $goTMa$reactariautils.useEffectEvent)((originalEvent, pointerType)=>{
|
|
171
|
+
let state = ref.current;
|
|
172
|
+
if (isDisabled || state.didFirePressStart) return;
|
|
173
|
+
if (onPressStart) onPressStart({
|
|
174
|
+
type: "pressstart",
|
|
175
|
+
pointerType: pointerType,
|
|
176
|
+
target: originalEvent.currentTarget,
|
|
177
|
+
shiftKey: originalEvent.shiftKey,
|
|
178
|
+
metaKey: originalEvent.metaKey,
|
|
179
|
+
ctrlKey: originalEvent.ctrlKey,
|
|
180
|
+
altKey: originalEvent.altKey
|
|
181
|
+
});
|
|
182
|
+
if (onPressChange) onPressChange(true);
|
|
183
|
+
state.didFirePressStart = true;
|
|
184
|
+
setPressed(true);
|
|
185
|
+
});
|
|
186
|
+
let triggerPressEnd = (0, $goTMa$reactariautils.useEffectEvent)((originalEvent, pointerType, wasPressed = true)=>{
|
|
187
|
+
let state = ref.current;
|
|
188
|
+
if (!state.didFirePressStart) return;
|
|
189
|
+
state.ignoreClickAfterPress = true;
|
|
190
|
+
state.didFirePressStart = false;
|
|
191
|
+
if (onPressEnd) onPressEnd({
|
|
192
|
+
type: "pressend",
|
|
193
|
+
pointerType: pointerType,
|
|
194
|
+
target: originalEvent.currentTarget,
|
|
195
|
+
shiftKey: originalEvent.shiftKey,
|
|
196
|
+
metaKey: originalEvent.metaKey,
|
|
197
|
+
ctrlKey: originalEvent.ctrlKey,
|
|
198
|
+
altKey: originalEvent.altKey
|
|
199
|
+
});
|
|
200
|
+
if (onPressChange) onPressChange(false);
|
|
201
|
+
setPressed(false);
|
|
202
|
+
if (onPress && wasPressed && !isDisabled) onPress({
|
|
203
|
+
type: "press",
|
|
204
|
+
pointerType: pointerType,
|
|
205
|
+
target: originalEvent.currentTarget,
|
|
206
|
+
shiftKey: originalEvent.shiftKey,
|
|
207
|
+
metaKey: originalEvent.metaKey,
|
|
208
|
+
ctrlKey: originalEvent.ctrlKey,
|
|
209
|
+
altKey: originalEvent.altKey
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
let triggerPressUp = (0, $goTMa$reactariautils.useEffectEvent)((originalEvent, pointerType)=>{
|
|
213
|
+
if (isDisabled) return;
|
|
214
|
+
if (onPressUp) onPressUp({
|
|
215
|
+
type: "pressup",
|
|
216
|
+
pointerType: pointerType,
|
|
217
|
+
target: originalEvent.currentTarget,
|
|
218
|
+
shiftKey: originalEvent.shiftKey,
|
|
219
|
+
metaKey: originalEvent.metaKey,
|
|
220
|
+
ctrlKey: originalEvent.ctrlKey,
|
|
221
|
+
altKey: originalEvent.altKey
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
let cancel = (0, $goTMa$reactariautils.useEffectEvent)((e)=>{
|
|
225
|
+
let state = ref.current;
|
|
226
|
+
if (state.isPressed) {
|
|
227
|
+
if (state.isOverTarget) triggerPressEnd($0294ea432cd92340$var$createEvent(state.target, e), state.pointerType, false);
|
|
228
|
+
state.isPressed = false;
|
|
229
|
+
state.isOverTarget = false;
|
|
230
|
+
state.activePointerId = null;
|
|
231
|
+
state.pointerType = null;
|
|
232
|
+
removeAllGlobalListeners();
|
|
233
|
+
if (!allowTextSelectionOnPress) (0, $f7e14e656343df57$export$b0d6fa1ab32e3295)(state.target);
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
let cancelOnPointerExit = (0, $goTMa$reactariautils.useEffectEvent)((e)=>{
|
|
237
|
+
if (shouldCancelOnPointerExit) cancel(e);
|
|
238
|
+
});
|
|
180
239
|
let pressProps = (0, $goTMa$react.useMemo)(()=>{
|
|
181
240
|
let state = ref.current;
|
|
182
|
-
let triggerPressStart = (originalEvent, pointerType)=>{
|
|
183
|
-
let { onPressStart: onPressStart , onPressChange: onPressChange , isDisabled: isDisabled } = propsRef.current;
|
|
184
|
-
if (isDisabled || state.didFirePressStart) return;
|
|
185
|
-
if (onPressStart) onPressStart({
|
|
186
|
-
type: "pressstart",
|
|
187
|
-
pointerType: pointerType,
|
|
188
|
-
target: originalEvent.currentTarget,
|
|
189
|
-
shiftKey: originalEvent.shiftKey,
|
|
190
|
-
metaKey: originalEvent.metaKey,
|
|
191
|
-
ctrlKey: originalEvent.ctrlKey,
|
|
192
|
-
altKey: originalEvent.altKey
|
|
193
|
-
});
|
|
194
|
-
if (onPressChange) onPressChange(true);
|
|
195
|
-
state.didFirePressStart = true;
|
|
196
|
-
setPressed(true);
|
|
197
|
-
};
|
|
198
|
-
let triggerPressEnd = (originalEvent, pointerType, wasPressed = true)=>{
|
|
199
|
-
let { onPressEnd: onPressEnd , onPressChange: onPressChange , onPress: onPress , isDisabled: isDisabled } = propsRef.current;
|
|
200
|
-
if (!state.didFirePressStart) return;
|
|
201
|
-
state.ignoreClickAfterPress = true;
|
|
202
|
-
state.didFirePressStart = false;
|
|
203
|
-
if (onPressEnd) onPressEnd({
|
|
204
|
-
type: "pressend",
|
|
205
|
-
pointerType: pointerType,
|
|
206
|
-
target: originalEvent.currentTarget,
|
|
207
|
-
shiftKey: originalEvent.shiftKey,
|
|
208
|
-
metaKey: originalEvent.metaKey,
|
|
209
|
-
ctrlKey: originalEvent.ctrlKey,
|
|
210
|
-
altKey: originalEvent.altKey
|
|
211
|
-
});
|
|
212
|
-
if (onPressChange) onPressChange(false);
|
|
213
|
-
setPressed(false);
|
|
214
|
-
if (onPress && wasPressed && !isDisabled) onPress({
|
|
215
|
-
type: "press",
|
|
216
|
-
pointerType: pointerType,
|
|
217
|
-
target: originalEvent.currentTarget,
|
|
218
|
-
shiftKey: originalEvent.shiftKey,
|
|
219
|
-
metaKey: originalEvent.metaKey,
|
|
220
|
-
ctrlKey: originalEvent.ctrlKey,
|
|
221
|
-
altKey: originalEvent.altKey
|
|
222
|
-
});
|
|
223
|
-
};
|
|
224
|
-
let triggerPressUp = (originalEvent, pointerType)=>{
|
|
225
|
-
let { onPressUp: onPressUp , isDisabled: isDisabled } = propsRef.current;
|
|
226
|
-
if (isDisabled) return;
|
|
227
|
-
if (onPressUp) onPressUp({
|
|
228
|
-
type: "pressup",
|
|
229
|
-
pointerType: pointerType,
|
|
230
|
-
target: originalEvent.currentTarget,
|
|
231
|
-
shiftKey: originalEvent.shiftKey,
|
|
232
|
-
metaKey: originalEvent.metaKey,
|
|
233
|
-
ctrlKey: originalEvent.ctrlKey,
|
|
234
|
-
altKey: originalEvent.altKey
|
|
235
|
-
});
|
|
236
|
-
};
|
|
237
|
-
let cancel = (e)=>{
|
|
238
|
-
if (state.isPressed) {
|
|
239
|
-
if (state.isOverTarget) triggerPressEnd($0294ea432cd92340$var$createEvent(state.target, e), state.pointerType, false);
|
|
240
|
-
state.isPressed = false;
|
|
241
|
-
state.isOverTarget = false;
|
|
242
|
-
state.activePointerId = null;
|
|
243
|
-
state.pointerType = null;
|
|
244
|
-
removeAllGlobalListeners();
|
|
245
|
-
if (!allowTextSelectionOnPress) (0, $f7e14e656343df57$export$b0d6fa1ab32e3295)(state.target);
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
241
|
let pressProps = {
|
|
249
242
|
onKeyDown (e) {
|
|
250
243
|
if ($0294ea432cd92340$var$isValidKeyboardEvent(e.nativeEvent, e.currentTarget) && e.currentTarget.contains(e.target)) {
|
|
@@ -362,7 +355,7 @@ function $0294ea432cd92340$export$45712eceda6fad21(props) {
|
|
|
362
355
|
} else if (state.isOverTarget) {
|
|
363
356
|
state.isOverTarget = false;
|
|
364
357
|
triggerPressEnd($0294ea432cd92340$var$createEvent(state.target, e), state.pointerType, false);
|
|
365
|
-
|
|
358
|
+
cancelOnPointerExit(e);
|
|
366
359
|
}
|
|
367
360
|
};
|
|
368
361
|
let onPointerUp = (e)=>{
|
|
@@ -416,7 +409,7 @@ function $0294ea432cd92340$export$45712eceda6fad21(props) {
|
|
|
416
409
|
if (state.isPressed && !state.ignoreEmulatedMouseEvents) {
|
|
417
410
|
state.isOverTarget = false;
|
|
418
411
|
triggerPressEnd(e, state.pointerType, false);
|
|
419
|
-
|
|
412
|
+
cancelOnPointerExit(e);
|
|
420
413
|
}
|
|
421
414
|
};
|
|
422
415
|
pressProps.onMouseUp = (e)=>{
|
|
@@ -467,7 +460,7 @@ function $0294ea432cd92340$export$45712eceda6fad21(props) {
|
|
|
467
460
|
} else if (state.isOverTarget) {
|
|
468
461
|
state.isOverTarget = false;
|
|
469
462
|
triggerPressEnd(e, state.pointerType, false);
|
|
470
|
-
|
|
463
|
+
cancelOnPointerExit(e);
|
|
471
464
|
}
|
|
472
465
|
};
|
|
473
466
|
pressProps.onTouchEnd = (e)=>{
|
|
@@ -511,7 +504,12 @@ function $0294ea432cd92340$export$45712eceda6fad21(props) {
|
|
|
511
504
|
isDisabled,
|
|
512
505
|
preventFocusOnPress,
|
|
513
506
|
removeAllGlobalListeners,
|
|
514
|
-
allowTextSelectionOnPress
|
|
507
|
+
allowTextSelectionOnPress,
|
|
508
|
+
cancel,
|
|
509
|
+
cancelOnPointerExit,
|
|
510
|
+
triggerPressEnd,
|
|
511
|
+
triggerPressStart,
|
|
512
|
+
triggerPressUp
|
|
515
513
|
]);
|
|
516
514
|
// Remove user-select: none in case component unmounts immediately after pressStart
|
|
517
515
|
// eslint-disable-next-line arrow-body-style
|
|
@@ -655,7 +653,10 @@ const $3596bae48579386f$export$3351871ee4b288b8 = /*#__PURE__*/ (0, ($parcel$int
|
|
|
655
653
|
});
|
|
656
654
|
(0, $goTMa$reactariautils.useSyncRef)(prevContext, ref);
|
|
657
655
|
(0, $goTMa$react.useEffect)(()=>{
|
|
658
|
-
if (!isRegistered.current)
|
|
656
|
+
if (!isRegistered.current) {
|
|
657
|
+
console.warn("A PressResponder was rendered without a pressable child. Either call the usePress hook, or wrap your DOM node with <Pressable> component.");
|
|
658
|
+
isRegistered.current = true; // only warn once in strict mode.
|
|
659
|
+
}
|
|
659
660
|
}, []);
|
|
660
661
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($goTMa$react))).createElement((0, $01d3f539e91688c8$export$5165eccb35aaadb5).Provider, {
|
|
661
662
|
value: context
|
|
@@ -723,10 +724,8 @@ class $625cf83917e112ad$export$905e7fc544a71f36 {
|
|
|
723
724
|
function $625cf83917e112ad$export$715c682d09d639cc(onBlur) {
|
|
724
725
|
let stateRef = (0, $goTMa$react.useRef)({
|
|
725
726
|
isFocused: false,
|
|
726
|
-
onBlur: onBlur,
|
|
727
727
|
observer: null
|
|
728
728
|
});
|
|
729
|
-
stateRef.current.onBlur = onBlur;
|
|
730
729
|
// Clean up MutationObserver on unmount. See below.
|
|
731
730
|
// eslint-disable-next-line arrow-body-style
|
|
732
731
|
(0, $goTMa$reactariautils.useLayoutEffect)(()=>{
|
|
@@ -738,6 +737,9 @@ function $625cf83917e112ad$export$715c682d09d639cc(onBlur) {
|
|
|
738
737
|
}
|
|
739
738
|
};
|
|
740
739
|
}, []);
|
|
740
|
+
let dispatchBlur = (0, $goTMa$reactariautils.useEffectEvent)((e)=>{
|
|
741
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
742
|
+
});
|
|
741
743
|
// This function is called during a React onFocus event.
|
|
742
744
|
return (0, $goTMa$react.useCallback)((e)=>{
|
|
743
745
|
// React does not fire onBlur when an element is disabled. https://github.com/facebook/react/issues/9142
|
|
@@ -748,10 +750,9 @@ function $625cf83917e112ad$export$715c682d09d639cc(onBlur) {
|
|
|
748
750
|
stateRef.current.isFocused = true;
|
|
749
751
|
let target = e.target;
|
|
750
752
|
let onBlurHandler = (e)=>{
|
|
751
|
-
var // For backward compatibility, dispatch a (fake) React synthetic event.
|
|
752
|
-
_stateRef_current, _stateRef_current_onBlur;
|
|
753
753
|
stateRef.current.isFocused = false;
|
|
754
|
-
if (target.disabled)
|
|
754
|
+
if (target.disabled) // For backward compatibility, dispatch a (fake) React synthetic event.
|
|
755
|
+
dispatchBlur(new $625cf83917e112ad$export$905e7fc544a71f36("blur", e));
|
|
755
756
|
// We no longer need the MutationObserver once the target is blurred.
|
|
756
757
|
if (stateRef.current.observer) {
|
|
757
758
|
stateRef.current.observer.disconnect();
|
|
@@ -764,9 +765,13 @@ function $625cf83917e112ad$export$715c682d09d639cc(onBlur) {
|
|
|
764
765
|
stateRef.current.observer = new MutationObserver(()=>{
|
|
765
766
|
if (stateRef.current.isFocused && target.disabled) {
|
|
766
767
|
stateRef.current.observer.disconnect();
|
|
767
|
-
target.
|
|
768
|
+
let relatedTargetEl = target === document.activeElement ? null : document.activeElement;
|
|
769
|
+
target.dispatchEvent(new FocusEvent("blur", {
|
|
770
|
+
relatedTarget: relatedTargetEl
|
|
771
|
+
}));
|
|
768
772
|
target.dispatchEvent(new FocusEvent("focusout", {
|
|
769
|
-
bubbles: true
|
|
773
|
+
bubbles: true,
|
|
774
|
+
relatedTarget: relatedTargetEl
|
|
770
775
|
}));
|
|
771
776
|
}
|
|
772
777
|
});
|
|
@@ -777,7 +782,9 @@ function $625cf83917e112ad$export$715c682d09d639cc(onBlur) {
|
|
|
777
782
|
]
|
|
778
783
|
});
|
|
779
784
|
}
|
|
780
|
-
}, [
|
|
785
|
+
}, [
|
|
786
|
+
dispatchBlur
|
|
787
|
+
]);
|
|
781
788
|
}
|
|
782
789
|
|
|
783
790
|
|
|
@@ -1200,29 +1207,29 @@ function $ffbc150311c75f01$export$ae780daf29e6d456(props) {
|
|
|
1200
1207
|
// NOTICE file in the root directory of this source tree.
|
|
1201
1208
|
// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions
|
|
1202
1209
|
|
|
1210
|
+
|
|
1203
1211
|
function $edcfa848c42f94f4$export$872b660ac5a1ff98(props) {
|
|
1204
1212
|
let { ref: ref , onInteractOutside: onInteractOutside , isDisabled: isDisabled , onInteractOutsideStart: onInteractOutsideStart } = props;
|
|
1205
1213
|
let stateRef = (0, $goTMa$react.useRef)({
|
|
1206
1214
|
isPointerDown: false,
|
|
1207
|
-
ignoreEmulatedMouseEvents: false
|
|
1208
|
-
|
|
1209
|
-
|
|
1215
|
+
ignoreEmulatedMouseEvents: false
|
|
1216
|
+
});
|
|
1217
|
+
let onPointerDown = (0, $goTMa$reactariautils.useEffectEvent)((e)=>{
|
|
1218
|
+
if (onInteractOutside && $edcfa848c42f94f4$var$isValidEvent(e, ref)) {
|
|
1219
|
+
if (onInteractOutsideStart) onInteractOutsideStart(e);
|
|
1220
|
+
stateRef.current.isPointerDown = true;
|
|
1221
|
+
}
|
|
1222
|
+
});
|
|
1223
|
+
let triggerInteractOutside = (0, $goTMa$reactariautils.useEffectEvent)((e)=>{
|
|
1224
|
+
if (onInteractOutside) onInteractOutside(e);
|
|
1210
1225
|
});
|
|
1211
|
-
let state = stateRef.current;
|
|
1212
|
-
state.onInteractOutside = onInteractOutside;
|
|
1213
|
-
state.onInteractOutsideStart = onInteractOutsideStart;
|
|
1214
1226
|
(0, $goTMa$react.useEffect)(()=>{
|
|
1227
|
+
let state = stateRef.current;
|
|
1215
1228
|
if (isDisabled) return;
|
|
1216
|
-
let onPointerDown = (e)=>{
|
|
1217
|
-
if ($edcfa848c42f94f4$var$isValidEvent(e, ref) && state.onInteractOutside) {
|
|
1218
|
-
if (state.onInteractOutsideStart) state.onInteractOutsideStart(e);
|
|
1219
|
-
state.isPointerDown = true;
|
|
1220
|
-
}
|
|
1221
|
-
};
|
|
1222
1229
|
// Use pointer events if available. Otherwise, fall back to mouse and touch events.
|
|
1223
1230
|
if (typeof PointerEvent !== "undefined") {
|
|
1224
1231
|
let onPointerUp = (e)=>{
|
|
1225
|
-
if (state.isPointerDown &&
|
|
1232
|
+
if (state.isPointerDown && $edcfa848c42f94f4$var$isValidEvent(e, ref)) triggerInteractOutside(e);
|
|
1226
1233
|
state.isPointerDown = false;
|
|
1227
1234
|
};
|
|
1228
1235
|
// changing these to capture phase fixed combobox
|
|
@@ -1235,12 +1242,12 @@ function $edcfa848c42f94f4$export$872b660ac5a1ff98(props) {
|
|
|
1235
1242
|
} else {
|
|
1236
1243
|
let onMouseUp = (e)=>{
|
|
1237
1244
|
if (state.ignoreEmulatedMouseEvents) state.ignoreEmulatedMouseEvents = false;
|
|
1238
|
-
else if (state.isPointerDown &&
|
|
1245
|
+
else if (state.isPointerDown && $edcfa848c42f94f4$var$isValidEvent(e, ref)) triggerInteractOutside(e);
|
|
1239
1246
|
state.isPointerDown = false;
|
|
1240
1247
|
};
|
|
1241
1248
|
let onTouchEnd = (e)=>{
|
|
1242
1249
|
state.ignoreEmulatedMouseEvents = true;
|
|
1243
|
-
if (state.
|
|
1250
|
+
if (state.isPointerDown && $edcfa848c42f94f4$var$isValidEvent(e, ref)) triggerInteractOutside(e);
|
|
1244
1251
|
state.isPointerDown = false;
|
|
1245
1252
|
};
|
|
1246
1253
|
document.addEventListener("mousedown", onPointerDown, true);
|
|
@@ -1256,8 +1263,9 @@ function $edcfa848c42f94f4$export$872b660ac5a1ff98(props) {
|
|
|
1256
1263
|
}
|
|
1257
1264
|
}, [
|
|
1258
1265
|
ref,
|
|
1259
|
-
|
|
1260
|
-
|
|
1266
|
+
isDisabled,
|
|
1267
|
+
onPointerDown,
|
|
1268
|
+
triggerInteractOutside
|
|
1261
1269
|
]);
|
|
1262
1270
|
}
|
|
1263
1271
|
function $edcfa848c42f94f4$var$isValidEvent(event, ref) {
|
|
@@ -1349,46 +1357,46 @@ function $c09386fc48fa427d$export$36da96379f79f245(props) {
|
|
|
1349
1357
|
id: null
|
|
1350
1358
|
});
|
|
1351
1359
|
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = (0, $goTMa$reactariautils.useGlobalListeners)();
|
|
1352
|
-
let
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
let move = (originalEvent, pointerType, deltaX, deltaY)=>{
|
|
1359
|
-
if (deltaX === 0 && deltaY === 0) return;
|
|
1360
|
-
if (!state.current.didMove) {
|
|
1361
|
-
state.current.didMove = true;
|
|
1362
|
-
onMoveStart === null || onMoveStart === void 0 ? void 0 : onMoveStart({
|
|
1363
|
-
type: "movestart",
|
|
1364
|
-
pointerType: pointerType,
|
|
1365
|
-
shiftKey: originalEvent.shiftKey,
|
|
1366
|
-
metaKey: originalEvent.metaKey,
|
|
1367
|
-
ctrlKey: originalEvent.ctrlKey,
|
|
1368
|
-
altKey: originalEvent.altKey
|
|
1369
|
-
});
|
|
1370
|
-
}
|
|
1371
|
-
onMove({
|
|
1372
|
-
type: "move",
|
|
1373
|
-
pointerType: pointerType,
|
|
1374
|
-
deltaX: deltaX,
|
|
1375
|
-
deltaY: deltaY,
|
|
1376
|
-
shiftKey: originalEvent.shiftKey,
|
|
1377
|
-
metaKey: originalEvent.metaKey,
|
|
1378
|
-
ctrlKey: originalEvent.ctrlKey,
|
|
1379
|
-
altKey: originalEvent.altKey
|
|
1380
|
-
});
|
|
1381
|
-
};
|
|
1382
|
-
let end = (originalEvent, pointerType)=>{
|
|
1383
|
-
(0, $f7e14e656343df57$export$b0d6fa1ab32e3295)();
|
|
1384
|
-
if (state.current.didMove) onMoveEnd === null || onMoveEnd === void 0 ? void 0 : onMoveEnd({
|
|
1385
|
-
type: "moveend",
|
|
1360
|
+
let move = (0, $goTMa$reactariautils.useEffectEvent)((originalEvent, pointerType, deltaX, deltaY)=>{
|
|
1361
|
+
if (deltaX === 0 && deltaY === 0) return;
|
|
1362
|
+
if (!state.current.didMove) {
|
|
1363
|
+
state.current.didMove = true;
|
|
1364
|
+
onMoveStart === null || onMoveStart === void 0 ? void 0 : onMoveStart({
|
|
1365
|
+
type: "movestart",
|
|
1386
1366
|
pointerType: pointerType,
|
|
1387
1367
|
shiftKey: originalEvent.shiftKey,
|
|
1388
1368
|
metaKey: originalEvent.metaKey,
|
|
1389
1369
|
ctrlKey: originalEvent.ctrlKey,
|
|
1390
1370
|
altKey: originalEvent.altKey
|
|
1391
1371
|
});
|
|
1372
|
+
}
|
|
1373
|
+
onMove({
|
|
1374
|
+
type: "move",
|
|
1375
|
+
pointerType: pointerType,
|
|
1376
|
+
deltaX: deltaX,
|
|
1377
|
+
deltaY: deltaY,
|
|
1378
|
+
shiftKey: originalEvent.shiftKey,
|
|
1379
|
+
metaKey: originalEvent.metaKey,
|
|
1380
|
+
ctrlKey: originalEvent.ctrlKey,
|
|
1381
|
+
altKey: originalEvent.altKey
|
|
1382
|
+
});
|
|
1383
|
+
});
|
|
1384
|
+
let end = (0, $goTMa$reactariautils.useEffectEvent)((originalEvent, pointerType)=>{
|
|
1385
|
+
(0, $f7e14e656343df57$export$b0d6fa1ab32e3295)();
|
|
1386
|
+
if (state.current.didMove) onMoveEnd === null || onMoveEnd === void 0 ? void 0 : onMoveEnd({
|
|
1387
|
+
type: "moveend",
|
|
1388
|
+
pointerType: pointerType,
|
|
1389
|
+
shiftKey: originalEvent.shiftKey,
|
|
1390
|
+
metaKey: originalEvent.metaKey,
|
|
1391
|
+
ctrlKey: originalEvent.ctrlKey,
|
|
1392
|
+
altKey: originalEvent.altKey
|
|
1393
|
+
});
|
|
1394
|
+
});
|
|
1395
|
+
let moveProps = (0, $goTMa$react.useMemo)(()=>{
|
|
1396
|
+
let moveProps = {};
|
|
1397
|
+
let start = ()=>{
|
|
1398
|
+
(0, $f7e14e656343df57$export$16a4697467175487)();
|
|
1399
|
+
state.current.didMove = false;
|
|
1392
1400
|
};
|
|
1393
1401
|
if (typeof PointerEvent === "undefined") {
|
|
1394
1402
|
let onMouseMove = (e)=>{
|
|
@@ -1536,11 +1544,10 @@ function $c09386fc48fa427d$export$36da96379f79f245(props) {
|
|
|
1536
1544
|
return moveProps;
|
|
1537
1545
|
}, [
|
|
1538
1546
|
state,
|
|
1539
|
-
onMoveStart,
|
|
1540
|
-
onMove,
|
|
1541
|
-
onMoveEnd,
|
|
1542
1547
|
addGlobalListener,
|
|
1543
|
-
removeGlobalListener
|
|
1548
|
+
removeGlobalListener,
|
|
1549
|
+
move,
|
|
1550
|
+
end
|
|
1544
1551
|
]);
|
|
1545
1552
|
return {
|
|
1546
1553
|
moveProps: moveProps
|