@react-aria/interactions 3.21.2 → 3.22.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.
Files changed (58) hide show
  1. package/dist/PressResponder.mjs +1 -1
  2. package/dist/Pressable.mjs +1 -1
  3. package/dist/context.main.js +1 -1
  4. package/dist/context.mjs +2 -2
  5. package/dist/context.module.js +1 -1
  6. package/dist/createEventHandler.main.js +1 -1
  7. package/dist/createEventHandler.mjs +2 -2
  8. package/dist/createEventHandler.module.js +1 -1
  9. package/dist/textSelection.main.js +14 -14
  10. package/dist/textSelection.mjs +15 -15
  11. package/dist/textSelection.module.js +14 -14
  12. package/dist/types.d.ts +5 -5
  13. package/dist/types.d.ts.map +1 -1
  14. package/dist/useFocus.mjs +1 -1
  15. package/dist/useFocusVisible.main.js +54 -54
  16. package/dist/useFocusVisible.mjs +55 -55
  17. package/dist/useFocusVisible.module.js +54 -54
  18. package/dist/useFocusWithin.mjs +1 -1
  19. package/dist/useHover.main.js +16 -16
  20. package/dist/useHover.main.js.map +1 -1
  21. package/dist/useHover.mjs +17 -17
  22. package/dist/useHover.module.js +16 -16
  23. package/dist/useHover.module.js.map +1 -1
  24. package/dist/useInteractOutside.main.js +14 -14
  25. package/dist/useInteractOutside.main.js.map +1 -1
  26. package/dist/useInteractOutside.mjs +15 -15
  27. package/dist/useInteractOutside.module.js +14 -14
  28. package/dist/useInteractOutside.module.js.map +1 -1
  29. package/dist/useKeyboard.mjs +1 -1
  30. package/dist/useLongPress.main.js +11 -11
  31. package/dist/useLongPress.main.js.map +1 -1
  32. package/dist/useLongPress.mjs +12 -12
  33. package/dist/useLongPress.module.js +11 -11
  34. package/dist/useLongPress.module.js.map +1 -1
  35. package/dist/useMove.main.js +36 -36
  36. package/dist/useMove.mjs +37 -37
  37. package/dist/useMove.module.js +36 -36
  38. package/dist/usePress.main.js +95 -54
  39. package/dist/usePress.main.js.map +1 -1
  40. package/dist/usePress.mjs +96 -55
  41. package/dist/usePress.module.js +95 -54
  42. package/dist/usePress.module.js.map +1 -1
  43. package/dist/useScrollWheel.main.js +1 -1
  44. package/dist/useScrollWheel.main.js.map +1 -1
  45. package/dist/useScrollWheel.mjs +2 -2
  46. package/dist/useScrollWheel.module.js +1 -1
  47. package/dist/useScrollWheel.module.js.map +1 -1
  48. package/dist/utils.main.js +5 -5
  49. package/dist/utils.mjs +6 -6
  50. package/dist/utils.module.js +5 -5
  51. package/package.json +6 -6
  52. package/src/DOMPropsContext.ts +3 -3
  53. package/src/useDOMPropsResponder.ts +2 -2
  54. package/src/useHover.ts +0 -1
  55. package/src/useInteractOutside.ts +3 -2
  56. package/src/useLongPress.ts +1 -1
  57. package/src/usePress.ts +60 -14
  58. package/src/useScrollWheel.ts +3 -3
@@ -18,41 +18,41 @@ import {useRef as $4k2kv$useRef} from "react";
18
18
  const $8a26561d2877236e$var$DEFAULT_THRESHOLD = 500;
19
19
  function $8a26561d2877236e$export$c24ed0104d07eab9(props) {
20
20
  let { isDisabled: isDisabled, onLongPressStart: onLongPressStart, onLongPressEnd: onLongPressEnd, onLongPress: onLongPress, threshold: threshold = $8a26561d2877236e$var$DEFAULT_THRESHOLD, accessibilityDescription: accessibilityDescription } = props;
21
- const timeRef = (0, $4k2kv$useRef)();
21
+ const timeRef = (0, $4k2kv$useRef)(undefined);
22
22
  let { addGlobalListener: addGlobalListener, removeGlobalListener: removeGlobalListener } = (0, $4k2kv$useGlobalListeners)();
23
23
  let { pressProps: pressProps } = (0, $f6c31cce2adf654f$export$45712eceda6fad21)({
24
24
  isDisabled: isDisabled,
25
25
  onPressStart (e) {
26
26
  e.continuePropagation();
27
- if (e.pointerType === "mouse" || e.pointerType === "touch") {
27
+ if (e.pointerType === 'mouse' || e.pointerType === 'touch') {
28
28
  if (onLongPressStart) onLongPressStart({
29
29
  ...e,
30
- type: "longpressstart"
30
+ type: 'longpressstart'
31
31
  });
32
32
  timeRef.current = setTimeout(()=>{
33
33
  // Prevent other usePress handlers from also handling this event.
34
- e.target.dispatchEvent(new PointerEvent("pointercancel", {
34
+ e.target.dispatchEvent(new PointerEvent('pointercancel', {
35
35
  bubbles: true
36
36
  }));
37
37
  if (onLongPress) onLongPress({
38
38
  ...e,
39
- type: "longpress"
39
+ type: 'longpress'
40
40
  });
41
41
  timeRef.current = undefined;
42
42
  }, threshold);
43
43
  // Prevent context menu, which may be opened on long press on touch devices
44
- if (e.pointerType === "touch") {
44
+ if (e.pointerType === 'touch') {
45
45
  let onContextMenu = (e)=>{
46
46
  e.preventDefault();
47
47
  };
48
- addGlobalListener(e.target, "contextmenu", onContextMenu, {
48
+ addGlobalListener(e.target, 'contextmenu', onContextMenu, {
49
49
  once: true
50
50
  });
51
- addGlobalListener(window, "pointerup", ()=>{
51
+ addGlobalListener(window, 'pointerup', ()=>{
52
52
  // If no contextmenu event is fired quickly after pointerup, remove the handler
53
53
  // so future context menu events outside a long press are not prevented.
54
54
  setTimeout(()=>{
55
- removeGlobalListener(e.target, "contextmenu", onContextMenu);
55
+ removeGlobalListener(e.target, 'contextmenu', onContextMenu);
56
56
  }, 30);
57
57
  }, {
58
58
  once: true
@@ -62,9 +62,9 @@ function $8a26561d2877236e$export$c24ed0104d07eab9(props) {
62
62
  },
63
63
  onPressEnd (e) {
64
64
  if (timeRef.current) clearTimeout(timeRef.current);
65
- if (onLongPressEnd && (e.pointerType === "mouse" || e.pointerType === "touch")) onLongPressEnd({
65
+ if (onLongPressEnd && (e.pointerType === 'mouse' || e.pointerType === 'touch')) onLongPressEnd({
66
66
  ...e,
67
- type: "longpressend"
67
+ type: 'longpressend'
68
68
  });
69
69
  }
70
70
  });
@@ -76,4 +76,4 @@ function $8a26561d2877236e$export$c24ed0104d07eab9(props) {
76
76
 
77
77
 
78
78
  export {$8a26561d2877236e$export$c24ed0104d07eab9 as useLongPress};
79
- //# sourceMappingURL=useLongPress.mjs.map
79
+ //# sourceMappingURL=useLongPress.module.js.map
@@ -18,41 +18,41 @@ import {useRef as $4k2kv$useRef} from "react";
18
18
  const $8a26561d2877236e$var$DEFAULT_THRESHOLD = 500;
19
19
  function $8a26561d2877236e$export$c24ed0104d07eab9(props) {
20
20
  let { isDisabled: isDisabled, onLongPressStart: onLongPressStart, onLongPressEnd: onLongPressEnd, onLongPress: onLongPress, threshold: threshold = $8a26561d2877236e$var$DEFAULT_THRESHOLD, accessibilityDescription: accessibilityDescription } = props;
21
- const timeRef = (0, $4k2kv$useRef)();
21
+ const timeRef = (0, $4k2kv$useRef)(undefined);
22
22
  let { addGlobalListener: addGlobalListener, removeGlobalListener: removeGlobalListener } = (0, $4k2kv$useGlobalListeners)();
23
23
  let { pressProps: pressProps } = (0, $f6c31cce2adf654f$export$45712eceda6fad21)({
24
24
  isDisabled: isDisabled,
25
25
  onPressStart (e) {
26
26
  e.continuePropagation();
27
- if (e.pointerType === "mouse" || e.pointerType === "touch") {
27
+ if (e.pointerType === 'mouse' || e.pointerType === 'touch') {
28
28
  if (onLongPressStart) onLongPressStart({
29
29
  ...e,
30
- type: "longpressstart"
30
+ type: 'longpressstart'
31
31
  });
32
32
  timeRef.current = setTimeout(()=>{
33
33
  // Prevent other usePress handlers from also handling this event.
34
- e.target.dispatchEvent(new PointerEvent("pointercancel", {
34
+ e.target.dispatchEvent(new PointerEvent('pointercancel', {
35
35
  bubbles: true
36
36
  }));
37
37
  if (onLongPress) onLongPress({
38
38
  ...e,
39
- type: "longpress"
39
+ type: 'longpress'
40
40
  });
41
41
  timeRef.current = undefined;
42
42
  }, threshold);
43
43
  // Prevent context menu, which may be opened on long press on touch devices
44
- if (e.pointerType === "touch") {
44
+ if (e.pointerType === 'touch') {
45
45
  let onContextMenu = (e)=>{
46
46
  e.preventDefault();
47
47
  };
48
- addGlobalListener(e.target, "contextmenu", onContextMenu, {
48
+ addGlobalListener(e.target, 'contextmenu', onContextMenu, {
49
49
  once: true
50
50
  });
51
- addGlobalListener(window, "pointerup", ()=>{
51
+ addGlobalListener(window, 'pointerup', ()=>{
52
52
  // If no contextmenu event is fired quickly after pointerup, remove the handler
53
53
  // so future context menu events outside a long press are not prevented.
54
54
  setTimeout(()=>{
55
- removeGlobalListener(e.target, "contextmenu", onContextMenu);
55
+ removeGlobalListener(e.target, 'contextmenu', onContextMenu);
56
56
  }, 30);
57
57
  }, {
58
58
  once: true
@@ -62,9 +62,9 @@ function $8a26561d2877236e$export$c24ed0104d07eab9(props) {
62
62
  },
63
63
  onPressEnd (e) {
64
64
  if (timeRef.current) clearTimeout(timeRef.current);
65
- if (onLongPressEnd && (e.pointerType === "mouse" || e.pointerType === "touch")) onLongPressEnd({
65
+ if (onLongPressEnd && (e.pointerType === 'mouse' || e.pointerType === 'touch')) onLongPressEnd({
66
66
  ...e,
67
- type: "longpressend"
67
+ type: 'longpressend'
68
68
  });
69
69
  }
70
70
  });
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAuCD,MAAM,0CAAoB;AAMnB,SAAS,0CAAa,KAAqB;IAChD,IAAI,cACF,UAAU,oBACV,gBAAgB,kBAChB,cAAc,eACd,WAAW,aACX,YAAY,mEACZ,wBAAwB,EACzB,GAAG;IAEJ,MAAM,UAAU,CAAA,GAAA,aAAK;IACrB,IAAI,qBAAC,iBAAiB,wBAAE,oBAAoB,EAAC,GAAG,CAAA,GAAA,yBAAiB;IAEjE,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,yCAAO,EAAE;oBAC1B;QACA,cAAa,CAAC;YACZ,EAAE,mBAAmB;YACrB,IAAI,EAAE,WAAW,KAAK,WAAW,EAAE,WAAW,KAAK,SAAS;gBAC1D,IAAI,kBACF,iBAAiB;oBACf,GAAG,CAAC;oBACJ,MAAM;gBACR;gBAGF,QAAQ,OAAO,GAAG,WAAW;oBAC3B,iEAAiE;oBACjE,EAAE,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,iBAAiB;wBAAC,SAAS;oBAAI;oBACvE,IAAI,aACF,YAAY;wBACV,GAAG,CAAC;wBACJ,MAAM;oBACR;oBAEF,QAAQ,OAAO,GAAG;gBACpB,GAAG;gBAEH,2EAA2E;gBAC3E,IAAI,EAAE,WAAW,KAAK,SAAS;oBAC7B,IAAI,gBAAgB,CAAA;wBAClB,EAAE,cAAc;oBAClB;oBAEA,kBAAkB,EAAE,MAAM,EAAE,eAAe,eAAe;wBAAC,MAAM;oBAAI;oBACrE,kBAAkB,QAAQ,aAAa;wBACrC,+EAA+E;wBAC/E,wEAAwE;wBACxE,WAAW;4BACT,qBAAqB,EAAE,MAAM,EAAE,eAAe;wBAChD,GAAG;oBACL,GAAG;wBAAC,MAAM;oBAAI;gBAChB;YACF;QACF;QACA,YAAW,CAAC;YACV,IAAI,QAAQ,OAAO,EACjB,aAAa,QAAQ,OAAO;YAG9B,IAAI,kBAAmB,CAAA,EAAE,WAAW,KAAK,WAAW,EAAE,WAAW,KAAK,OAAM,GAC1E,eAAe;gBACb,GAAG,CAAC;gBACJ,MAAM;YACR;QAEJ;IACF;IAEA,IAAI,mBAAmB,CAAA,GAAA,qBAAa,EAAE,eAAe,CAAC,aAAa,2BAA2B;IAE9F,OAAO;QACL,gBAAgB,CAAA,GAAA,iBAAS,EAAE,YAAY;IACzC;AACF","sources":["packages/@react-aria/interactions/src/useLongPress.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMAttributes, LongPressEvent} from '@react-types/shared';\nimport {mergeProps, useDescription, useGlobalListeners} from '@react-aria/utils';\nimport {usePress} from './usePress';\nimport {useRef} from 'react';\n\nexport interface LongPressProps {\n /** Whether long press events should be disabled. */\n isDisabled?: boolean,\n /** Handler that is called when a long press interaction starts. */\n onLongPressStart?: (e: LongPressEvent) => void,\n /**\n * Handler that is called when a long press interaction ends, either\n * over the target or when the pointer leaves the target.\n */\n onLongPressEnd?: (e: LongPressEvent) => void,\n /**\n * Handler that is called when the threshold time is met while\n * the press is over the target.\n */\n onLongPress?: (e: LongPressEvent) => void,\n /**\n * The amount of time in milliseconds to wait before triggering a long press.\n * @default 500ms\n */\n threshold?: number,\n /**\n * A description for assistive techology users indicating that a long press\n * action is available, e.g. \"Long press to open menu\".\n */\n accessibilityDescription?: string\n}\n\nexport interface LongPressResult {\n /** Props to spread on the target element. */\n longPressProps: DOMAttributes\n}\n\nconst DEFAULT_THRESHOLD = 500;\n\n/**\n * Handles long press interactions across mouse and touch devices. Supports a customizable time threshold,\n * accessibility description, and normalizes behavior across browsers and devices.\n */\nexport function useLongPress(props: LongPressProps): LongPressResult {\n let {\n isDisabled,\n onLongPressStart,\n onLongPressEnd,\n onLongPress,\n threshold = DEFAULT_THRESHOLD,\n accessibilityDescription\n } = props;\n\n const timeRef = useRef<ReturnType<typeof setTimeout> | undefined>();\n let {addGlobalListener, removeGlobalListener} = useGlobalListeners();\n\n let {pressProps} = usePress({\n isDisabled,\n onPressStart(e) {\n e.continuePropagation();\n if (e.pointerType === 'mouse' || e.pointerType === 'touch') {\n if (onLongPressStart) {\n onLongPressStart({\n ...e,\n type: 'longpressstart'\n });\n }\n\n timeRef.current = setTimeout(() => {\n // Prevent other usePress handlers from also handling this event.\n e.target.dispatchEvent(new PointerEvent('pointercancel', {bubbles: true}));\n if (onLongPress) {\n onLongPress({\n ...e,\n type: 'longpress'\n });\n }\n timeRef.current = undefined;\n }, threshold);\n\n // Prevent context menu, which may be opened on long press on touch devices\n if (e.pointerType === 'touch') {\n let onContextMenu = e => {\n e.preventDefault();\n };\n\n addGlobalListener(e.target, 'contextmenu', onContextMenu, {once: true});\n addGlobalListener(window, 'pointerup', () => {\n // If no contextmenu event is fired quickly after pointerup, remove the handler\n // so future context menu events outside a long press are not prevented.\n setTimeout(() => {\n removeGlobalListener(e.target, 'contextmenu', onContextMenu);\n }, 30);\n }, {once: true});\n }\n }\n },\n onPressEnd(e) {\n if (timeRef.current) {\n clearTimeout(timeRef.current);\n }\n\n if (onLongPressEnd && (e.pointerType === 'mouse' || e.pointerType === 'touch')) {\n onLongPressEnd({\n ...e,\n type: 'longpressend'\n });\n }\n }\n });\n\n let descriptionProps = useDescription(onLongPress && !isDisabled ? accessibilityDescription : undefined);\n\n return {\n longPressProps: mergeProps(pressProps, descriptionProps)\n };\n}\n"],"names":[],"version":3,"file":"useLongPress.module.js.map"}
1
+ {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAuCD,MAAM,0CAAoB;AAMnB,SAAS,0CAAa,KAAqB;IAChD,IAAI,cACF,UAAU,oBACV,gBAAgB,kBAChB,cAAc,eACd,WAAW,aACX,YAAY,mEACZ,wBAAwB,EACzB,GAAG;IAEJ,MAAM,UAAU,CAAA,GAAA,aAAK,EAA6C;IAClE,IAAI,qBAAC,iBAAiB,wBAAE,oBAAoB,EAAC,GAAG,CAAA,GAAA,yBAAiB;IAEjE,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,yCAAO,EAAE;oBAC1B;QACA,cAAa,CAAC;YACZ,EAAE,mBAAmB;YACrB,IAAI,EAAE,WAAW,KAAK,WAAW,EAAE,WAAW,KAAK,SAAS;gBAC1D,IAAI,kBACF,iBAAiB;oBACf,GAAG,CAAC;oBACJ,MAAM;gBACR;gBAGF,QAAQ,OAAO,GAAG,WAAW;oBAC3B,iEAAiE;oBACjE,EAAE,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,iBAAiB;wBAAC,SAAS;oBAAI;oBACvE,IAAI,aACF,YAAY;wBACV,GAAG,CAAC;wBACJ,MAAM;oBACR;oBAEF,QAAQ,OAAO,GAAG;gBACpB,GAAG;gBAEH,2EAA2E;gBAC3E,IAAI,EAAE,WAAW,KAAK,SAAS;oBAC7B,IAAI,gBAAgB,CAAA;wBAClB,EAAE,cAAc;oBAClB;oBAEA,kBAAkB,EAAE,MAAM,EAAE,eAAe,eAAe;wBAAC,MAAM;oBAAI;oBACrE,kBAAkB,QAAQ,aAAa;wBACrC,+EAA+E;wBAC/E,wEAAwE;wBACxE,WAAW;4BACT,qBAAqB,EAAE,MAAM,EAAE,eAAe;wBAChD,GAAG;oBACL,GAAG;wBAAC,MAAM;oBAAI;gBAChB;YACF;QACF;QACA,YAAW,CAAC;YACV,IAAI,QAAQ,OAAO,EACjB,aAAa,QAAQ,OAAO;YAG9B,IAAI,kBAAmB,CAAA,EAAE,WAAW,KAAK,WAAW,EAAE,WAAW,KAAK,OAAM,GAC1E,eAAe;gBACb,GAAG,CAAC;gBACJ,MAAM;YACR;QAEJ;IACF;IAEA,IAAI,mBAAmB,CAAA,GAAA,qBAAa,EAAE,eAAe,CAAC,aAAa,2BAA2B;IAE9F,OAAO;QACL,gBAAgB,CAAA,GAAA,iBAAS,EAAE,YAAY;IACzC;AACF","sources":["packages/@react-aria/interactions/src/useLongPress.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMAttributes, LongPressEvent} from '@react-types/shared';\nimport {mergeProps, useDescription, useGlobalListeners} from '@react-aria/utils';\nimport {usePress} from './usePress';\nimport {useRef} from 'react';\n\nexport interface LongPressProps {\n /** Whether long press events should be disabled. */\n isDisabled?: boolean,\n /** Handler that is called when a long press interaction starts. */\n onLongPressStart?: (e: LongPressEvent) => void,\n /**\n * Handler that is called when a long press interaction ends, either\n * over the target or when the pointer leaves the target.\n */\n onLongPressEnd?: (e: LongPressEvent) => void,\n /**\n * Handler that is called when the threshold time is met while\n * the press is over the target.\n */\n onLongPress?: (e: LongPressEvent) => void,\n /**\n * The amount of time in milliseconds to wait before triggering a long press.\n * @default 500ms\n */\n threshold?: number,\n /**\n * A description for assistive techology users indicating that a long press\n * action is available, e.g. \"Long press to open menu\".\n */\n accessibilityDescription?: string\n}\n\nexport interface LongPressResult {\n /** Props to spread on the target element. */\n longPressProps: DOMAttributes\n}\n\nconst DEFAULT_THRESHOLD = 500;\n\n/**\n * Handles long press interactions across mouse and touch devices. Supports a customizable time threshold,\n * accessibility description, and normalizes behavior across browsers and devices.\n */\nexport function useLongPress(props: LongPressProps): LongPressResult {\n let {\n isDisabled,\n onLongPressStart,\n onLongPressEnd,\n onLongPress,\n threshold = DEFAULT_THRESHOLD,\n accessibilityDescription\n } = props;\n\n const timeRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n let {addGlobalListener, removeGlobalListener} = useGlobalListeners();\n\n let {pressProps} = usePress({\n isDisabled,\n onPressStart(e) {\n e.continuePropagation();\n if (e.pointerType === 'mouse' || e.pointerType === 'touch') {\n if (onLongPressStart) {\n onLongPressStart({\n ...e,\n type: 'longpressstart'\n });\n }\n\n timeRef.current = setTimeout(() => {\n // Prevent other usePress handlers from also handling this event.\n e.target.dispatchEvent(new PointerEvent('pointercancel', {bubbles: true}));\n if (onLongPress) {\n onLongPress({\n ...e,\n type: 'longpress'\n });\n }\n timeRef.current = undefined;\n }, threshold);\n\n // Prevent context menu, which may be opened on long press on touch devices\n if (e.pointerType === 'touch') {\n let onContextMenu = e => {\n e.preventDefault();\n };\n\n addGlobalListener(e.target, 'contextmenu', onContextMenu, {once: true});\n addGlobalListener(window, 'pointerup', () => {\n // If no contextmenu event is fired quickly after pointerup, remove the handler\n // so future context menu events outside a long press are not prevented.\n setTimeout(() => {\n removeGlobalListener(e.target, 'contextmenu', onContextMenu);\n }, 30);\n }, {once: true});\n }\n }\n },\n onPressEnd(e) {\n if (timeRef.current) {\n clearTimeout(timeRef.current);\n }\n\n if (onLongPressEnd && (e.pointerType === 'mouse' || e.pointerType === 'touch')) {\n onLongPressEnd({\n ...e,\n type: 'longpressend'\n });\n }\n }\n });\n\n let descriptionProps = useDescription(onLongPress && !isDisabled ? accessibilityDescription : undefined);\n\n return {\n longPressProps: mergeProps(pressProps, descriptionProps)\n };\n}\n"],"names":[],"version":3,"file":"useLongPress.module.js.map"}
@@ -34,7 +34,7 @@ function $c09386fc48fa427d$export$36da96379f79f245(props) {
34
34
  if (!state.current.didMove) {
35
35
  state.current.didMove = true;
36
36
  onMoveStart === null || onMoveStart === void 0 ? void 0 : onMoveStart({
37
- type: "movestart",
37
+ type: 'movestart',
38
38
  pointerType: pointerType,
39
39
  shiftKey: originalEvent.shiftKey,
40
40
  metaKey: originalEvent.metaKey,
@@ -43,7 +43,7 @@ function $c09386fc48fa427d$export$36da96379f79f245(props) {
43
43
  });
44
44
  }
45
45
  onMove === null || onMove === void 0 ? void 0 : onMove({
46
- type: "move",
46
+ type: 'move',
47
47
  pointerType: pointerType,
48
48
  deltaX: deltaX,
49
49
  deltaY: deltaY,
@@ -56,7 +56,7 @@ function $c09386fc48fa427d$export$36da96379f79f245(props) {
56
56
  let end = (0, $cvDGj$reactariautils.useEffectEvent)((originalEvent, pointerType)=>{
57
57
  (0, $f7e14e656343df57$exports.restoreTextSelection)();
58
58
  if (state.current.didMove) onMoveEnd === null || onMoveEnd === void 0 ? void 0 : onMoveEnd({
59
- type: "moveend",
59
+ type: 'moveend',
60
60
  pointerType: pointerType,
61
61
  shiftKey: originalEvent.shiftKey,
62
62
  metaKey: originalEvent.metaKey,
@@ -70,12 +70,12 @@ function $c09386fc48fa427d$export$36da96379f79f245(props) {
70
70
  (0, $f7e14e656343df57$exports.disableTextSelection)();
71
71
  state.current.didMove = false;
72
72
  };
73
- if (typeof PointerEvent === "undefined") {
73
+ if (typeof PointerEvent === 'undefined') {
74
74
  let onMouseMove = (e)=>{
75
75
  if (e.button === 0) {
76
76
  var _state_current_lastPosition, _state_current_lastPosition1;
77
77
  var _state_current_lastPosition_pageX, _state_current_lastPosition_pageY;
78
- 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));
78
+ 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));
79
79
  state.current.lastPosition = {
80
80
  pageX: e.pageX,
81
81
  pageY: e.pageY
@@ -84,9 +84,9 @@ function $c09386fc48fa427d$export$36da96379f79f245(props) {
84
84
  };
85
85
  let onMouseUp = (e)=>{
86
86
  if (e.button === 0) {
87
- end(e, "mouse");
88
- removeGlobalListener(window, "mousemove", onMouseMove, false);
89
- removeGlobalListener(window, "mouseup", onMouseUp, false);
87
+ end(e, 'mouse');
88
+ removeGlobalListener(window, 'mousemove', onMouseMove, false);
89
+ removeGlobalListener(window, 'mouseup', onMouseUp, false);
90
90
  }
91
91
  };
92
92
  moveProps.onMouseDown = (e)=>{
@@ -98,8 +98,8 @@ function $c09386fc48fa427d$export$36da96379f79f245(props) {
98
98
  pageX: e.pageX,
99
99
  pageY: e.pageY
100
100
  };
101
- addGlobalListener(window, "mousemove", onMouseMove, false);
102
- addGlobalListener(window, "mouseup", onMouseUp, false);
101
+ addGlobalListener(window, 'mousemove', onMouseMove, false);
102
+ addGlobalListener(window, 'mouseup', onMouseUp, false);
103
103
  }
104
104
  };
105
105
  let onTouchMove = (e)=>{
@@ -110,7 +110,7 @@ function $c09386fc48fa427d$export$36da96379f79f245(props) {
110
110
  var _state_current_lastPosition, _state_current_lastPosition1;
111
111
  let { pageX: pageX, pageY: pageY } = e.changedTouches[touch];
112
112
  var _state_current_lastPosition_pageX, _state_current_lastPosition_pageY;
113
- 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));
113
+ 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));
114
114
  state.current.lastPosition = {
115
115
  pageX: pageX,
116
116
  pageY: pageY
@@ -122,11 +122,11 @@ function $c09386fc48fa427d$export$36da96379f79f245(props) {
122
122
  ...e.changedTouches
123
123
  ].findIndex(({ identifier: identifier })=>identifier === state.current.id);
124
124
  if (touch >= 0) {
125
- end(e, "touch");
125
+ end(e, 'touch');
126
126
  state.current.id = null;
127
- removeGlobalListener(window, "touchmove", onTouchMove);
128
- removeGlobalListener(window, "touchend", onTouchEnd);
129
- removeGlobalListener(window, "touchcancel", onTouchEnd);
127
+ removeGlobalListener(window, 'touchmove', onTouchMove);
128
+ removeGlobalListener(window, 'touchend', onTouchEnd);
129
+ removeGlobalListener(window, 'touchcancel', onTouchEnd);
130
130
  }
131
131
  };
132
132
  moveProps.onTouchStart = (e)=>{
@@ -140,15 +140,15 @@ function $c09386fc48fa427d$export$36da96379f79f245(props) {
140
140
  pageY: pageY
141
141
  };
142
142
  state.current.id = identifier;
143
- addGlobalListener(window, "touchmove", onTouchMove, false);
144
- addGlobalListener(window, "touchend", onTouchEnd, false);
145
- addGlobalListener(window, "touchcancel", onTouchEnd, false);
143
+ addGlobalListener(window, 'touchmove', onTouchMove, false);
144
+ addGlobalListener(window, 'touchend', onTouchEnd, false);
145
+ addGlobalListener(window, 'touchcancel', onTouchEnd, false);
146
146
  };
147
147
  } else {
148
148
  let onPointerMove = (e)=>{
149
149
  if (e.pointerId === state.current.id) {
150
150
  var _state_current_lastPosition, _state_current_lastPosition1;
151
- let pointerType = e.pointerType || "mouse";
151
+ let pointerType = e.pointerType || 'mouse';
152
152
  var _state_current_lastPosition_pageX, _state_current_lastPosition_pageY;
153
153
  // Problems with PointerEvent#movementX/movementY:
154
154
  // 1. it is always 0 on macOS Safari.
@@ -162,12 +162,12 @@ function $c09386fc48fa427d$export$36da96379f79f245(props) {
162
162
  };
163
163
  let onPointerUp = (e)=>{
164
164
  if (e.pointerId === state.current.id) {
165
- let pointerType = e.pointerType || "mouse";
165
+ let pointerType = e.pointerType || 'mouse';
166
166
  end(e, pointerType);
167
167
  state.current.id = null;
168
- removeGlobalListener(window, "pointermove", onPointerMove, false);
169
- removeGlobalListener(window, "pointerup", onPointerUp, false);
170
- removeGlobalListener(window, "pointercancel", onPointerUp, false);
168
+ removeGlobalListener(window, 'pointermove', onPointerMove, false);
169
+ removeGlobalListener(window, 'pointerup', onPointerUp, false);
170
+ removeGlobalListener(window, 'pointercancel', onPointerUp, false);
171
171
  }
172
172
  };
173
173
  moveProps.onPointerDown = (e)=>{
@@ -180,39 +180,39 @@ function $c09386fc48fa427d$export$36da96379f79f245(props) {
180
180
  pageY: e.pageY
181
181
  };
182
182
  state.current.id = e.pointerId;
183
- addGlobalListener(window, "pointermove", onPointerMove, false);
184
- addGlobalListener(window, "pointerup", onPointerUp, false);
185
- addGlobalListener(window, "pointercancel", onPointerUp, false);
183
+ addGlobalListener(window, 'pointermove', onPointerMove, false);
184
+ addGlobalListener(window, 'pointerup', onPointerUp, false);
185
+ addGlobalListener(window, 'pointercancel', onPointerUp, false);
186
186
  }
187
187
  };
188
188
  }
189
189
  let triggerKeyboardMove = (e, deltaX, deltaY)=>{
190
190
  start();
191
- move(e, "keyboard", deltaX, deltaY);
192
- end(e, "keyboard");
191
+ move(e, 'keyboard', deltaX, deltaY);
192
+ end(e, 'keyboard');
193
193
  };
194
194
  moveProps.onKeyDown = (e)=>{
195
195
  switch(e.key){
196
- case "Left":
197
- case "ArrowLeft":
196
+ case 'Left':
197
+ case 'ArrowLeft':
198
198
  e.preventDefault();
199
199
  e.stopPropagation();
200
200
  triggerKeyboardMove(e, -1, 0);
201
201
  break;
202
- case "Right":
203
- case "ArrowRight":
202
+ case 'Right':
203
+ case 'ArrowRight':
204
204
  e.preventDefault();
205
205
  e.stopPropagation();
206
206
  triggerKeyboardMove(e, 1, 0);
207
207
  break;
208
- case "Up":
209
- case "ArrowUp":
208
+ case 'Up':
209
+ case 'ArrowUp':
210
210
  e.preventDefault();
211
211
  e.stopPropagation();
212
212
  triggerKeyboardMove(e, 0, -1);
213
213
  break;
214
- case "Down":
215
- case "ArrowDown":
214
+ case 'Down':
215
+ case 'ArrowDown':
216
216
  e.preventDefault();
217
217
  e.stopPropagation();
218
218
  triggerKeyboardMove(e, 0, 1);
package/dist/useMove.mjs CHANGED
@@ -28,7 +28,7 @@ function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
28
28
  if (!state.current.didMove) {
29
29
  state.current.didMove = true;
30
30
  onMoveStart === null || onMoveStart === void 0 ? void 0 : onMoveStart({
31
- type: "movestart",
31
+ type: 'movestart',
32
32
  pointerType: pointerType,
33
33
  shiftKey: originalEvent.shiftKey,
34
34
  metaKey: originalEvent.metaKey,
@@ -37,7 +37,7 @@ function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
37
37
  });
38
38
  }
39
39
  onMove === null || onMove === void 0 ? void 0 : onMove({
40
- type: "move",
40
+ type: 'move',
41
41
  pointerType: pointerType,
42
42
  deltaX: deltaX,
43
43
  deltaY: deltaY,
@@ -50,7 +50,7 @@ function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
50
50
  let end = (0, $5GN7j$useEffectEvent)((originalEvent, pointerType)=>{
51
51
  (0, $14c0b72509d70225$export$b0d6fa1ab32e3295)();
52
52
  if (state.current.didMove) onMoveEnd === null || onMoveEnd === void 0 ? void 0 : onMoveEnd({
53
- type: "moveend",
53
+ type: 'moveend',
54
54
  pointerType: pointerType,
55
55
  shiftKey: originalEvent.shiftKey,
56
56
  metaKey: originalEvent.metaKey,
@@ -64,12 +64,12 @@ function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
64
64
  (0, $14c0b72509d70225$export$16a4697467175487)();
65
65
  state.current.didMove = false;
66
66
  };
67
- if (typeof PointerEvent === "undefined") {
67
+ if (typeof PointerEvent === 'undefined') {
68
68
  let onMouseMove = (e)=>{
69
69
  if (e.button === 0) {
70
70
  var _state_current_lastPosition, _state_current_lastPosition1;
71
71
  var _state_current_lastPosition_pageX, _state_current_lastPosition_pageY;
72
- 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));
72
+ 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));
73
73
  state.current.lastPosition = {
74
74
  pageX: e.pageX,
75
75
  pageY: e.pageY
@@ -78,9 +78,9 @@ function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
78
78
  };
79
79
  let onMouseUp = (e)=>{
80
80
  if (e.button === 0) {
81
- end(e, "mouse");
82
- removeGlobalListener(window, "mousemove", onMouseMove, false);
83
- removeGlobalListener(window, "mouseup", onMouseUp, false);
81
+ end(e, 'mouse');
82
+ removeGlobalListener(window, 'mousemove', onMouseMove, false);
83
+ removeGlobalListener(window, 'mouseup', onMouseUp, false);
84
84
  }
85
85
  };
86
86
  moveProps.onMouseDown = (e)=>{
@@ -92,8 +92,8 @@ function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
92
92
  pageX: e.pageX,
93
93
  pageY: e.pageY
94
94
  };
95
- addGlobalListener(window, "mousemove", onMouseMove, false);
96
- addGlobalListener(window, "mouseup", onMouseUp, false);
95
+ addGlobalListener(window, 'mousemove', onMouseMove, false);
96
+ addGlobalListener(window, 'mouseup', onMouseUp, false);
97
97
  }
98
98
  };
99
99
  let onTouchMove = (e)=>{
@@ -104,7 +104,7 @@ function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
104
104
  var _state_current_lastPosition, _state_current_lastPosition1;
105
105
  let { pageX: pageX, pageY: pageY } = e.changedTouches[touch];
106
106
  var _state_current_lastPosition_pageX, _state_current_lastPosition_pageY;
107
- 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));
107
+ 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));
108
108
  state.current.lastPosition = {
109
109
  pageX: pageX,
110
110
  pageY: pageY
@@ -116,11 +116,11 @@ function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
116
116
  ...e.changedTouches
117
117
  ].findIndex(({ identifier: identifier })=>identifier === state.current.id);
118
118
  if (touch >= 0) {
119
- end(e, "touch");
119
+ end(e, 'touch');
120
120
  state.current.id = null;
121
- removeGlobalListener(window, "touchmove", onTouchMove);
122
- removeGlobalListener(window, "touchend", onTouchEnd);
123
- removeGlobalListener(window, "touchcancel", onTouchEnd);
121
+ removeGlobalListener(window, 'touchmove', onTouchMove);
122
+ removeGlobalListener(window, 'touchend', onTouchEnd);
123
+ removeGlobalListener(window, 'touchcancel', onTouchEnd);
124
124
  }
125
125
  };
126
126
  moveProps.onTouchStart = (e)=>{
@@ -134,15 +134,15 @@ function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
134
134
  pageY: pageY
135
135
  };
136
136
  state.current.id = identifier;
137
- addGlobalListener(window, "touchmove", onTouchMove, false);
138
- addGlobalListener(window, "touchend", onTouchEnd, false);
139
- addGlobalListener(window, "touchcancel", onTouchEnd, false);
137
+ addGlobalListener(window, 'touchmove', onTouchMove, false);
138
+ addGlobalListener(window, 'touchend', onTouchEnd, false);
139
+ addGlobalListener(window, 'touchcancel', onTouchEnd, false);
140
140
  };
141
141
  } else {
142
142
  let onPointerMove = (e)=>{
143
143
  if (e.pointerId === state.current.id) {
144
144
  var _state_current_lastPosition, _state_current_lastPosition1;
145
- let pointerType = e.pointerType || "mouse";
145
+ let pointerType = e.pointerType || 'mouse';
146
146
  var _state_current_lastPosition_pageX, _state_current_lastPosition_pageY;
147
147
  // Problems with PointerEvent#movementX/movementY:
148
148
  // 1. it is always 0 on macOS Safari.
@@ -156,12 +156,12 @@ function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
156
156
  };
157
157
  let onPointerUp = (e)=>{
158
158
  if (e.pointerId === state.current.id) {
159
- let pointerType = e.pointerType || "mouse";
159
+ let pointerType = e.pointerType || 'mouse';
160
160
  end(e, pointerType);
161
161
  state.current.id = null;
162
- removeGlobalListener(window, "pointermove", onPointerMove, false);
163
- removeGlobalListener(window, "pointerup", onPointerUp, false);
164
- removeGlobalListener(window, "pointercancel", onPointerUp, false);
162
+ removeGlobalListener(window, 'pointermove', onPointerMove, false);
163
+ removeGlobalListener(window, 'pointerup', onPointerUp, false);
164
+ removeGlobalListener(window, 'pointercancel', onPointerUp, false);
165
165
  }
166
166
  };
167
167
  moveProps.onPointerDown = (e)=>{
@@ -174,39 +174,39 @@ function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
174
174
  pageY: e.pageY
175
175
  };
176
176
  state.current.id = e.pointerId;
177
- addGlobalListener(window, "pointermove", onPointerMove, false);
178
- addGlobalListener(window, "pointerup", onPointerUp, false);
179
- addGlobalListener(window, "pointercancel", onPointerUp, false);
177
+ addGlobalListener(window, 'pointermove', onPointerMove, false);
178
+ addGlobalListener(window, 'pointerup', onPointerUp, false);
179
+ addGlobalListener(window, 'pointercancel', onPointerUp, false);
180
180
  }
181
181
  };
182
182
  }
183
183
  let triggerKeyboardMove = (e, deltaX, deltaY)=>{
184
184
  start();
185
- move(e, "keyboard", deltaX, deltaY);
186
- end(e, "keyboard");
185
+ move(e, 'keyboard', deltaX, deltaY);
186
+ end(e, 'keyboard');
187
187
  };
188
188
  moveProps.onKeyDown = (e)=>{
189
189
  switch(e.key){
190
- case "Left":
191
- case "ArrowLeft":
190
+ case 'Left':
191
+ case 'ArrowLeft':
192
192
  e.preventDefault();
193
193
  e.stopPropagation();
194
194
  triggerKeyboardMove(e, -1, 0);
195
195
  break;
196
- case "Right":
197
- case "ArrowRight":
196
+ case 'Right':
197
+ case 'ArrowRight':
198
198
  e.preventDefault();
199
199
  e.stopPropagation();
200
200
  triggerKeyboardMove(e, 1, 0);
201
201
  break;
202
- case "Up":
203
- case "ArrowUp":
202
+ case 'Up':
203
+ case 'ArrowUp':
204
204
  e.preventDefault();
205
205
  e.stopPropagation();
206
206
  triggerKeyboardMove(e, 0, -1);
207
207
  break;
208
- case "Down":
209
- case "ArrowDown":
208
+ case 'Down':
209
+ case 'ArrowDown':
210
210
  e.preventDefault();
211
211
  e.stopPropagation();
212
212
  triggerKeyboardMove(e, 0, 1);
@@ -228,4 +228,4 @@ function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
228
228
 
229
229
 
230
230
  export {$e8a7022cf87cba2a$export$36da96379f79f245 as useMove};
231
- //# sourceMappingURL=useMove.mjs.map
231
+ //# sourceMappingURL=useMove.module.js.map