@react-aria/interactions 3.0.0-nightly-641446f65-240905

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 (109) hide show
  1. package/README.md +3 -0
  2. package/dist/PressResponder.main.js +62 -0
  3. package/dist/PressResponder.main.js.map +1 -0
  4. package/dist/PressResponder.mjs +52 -0
  5. package/dist/PressResponder.module.js +52 -0
  6. package/dist/PressResponder.module.js.map +1 -0
  7. package/dist/Pressable.main.js +43 -0
  8. package/dist/Pressable.main.js.map +1 -0
  9. package/dist/Pressable.mjs +34 -0
  10. package/dist/Pressable.module.js +34 -0
  11. package/dist/Pressable.module.js.map +1 -0
  12. package/dist/context.main.js +30 -0
  13. package/dist/context.main.js.map +1 -0
  14. package/dist/context.mjs +21 -0
  15. package/dist/context.module.js +21 -0
  16. package/dist/context.module.js.map +1 -0
  17. package/dist/createEventHandler.main.js +42 -0
  18. package/dist/createEventHandler.main.js.map +1 -0
  19. package/dist/createEventHandler.mjs +37 -0
  20. package/dist/createEventHandler.module.js +37 -0
  21. package/dist/createEventHandler.module.js.map +1 -0
  22. package/dist/import.mjs +39 -0
  23. package/dist/main.js +62 -0
  24. package/dist/main.js.map +1 -0
  25. package/dist/module.js +39 -0
  26. package/dist/module.js.map +1 -0
  27. package/dist/textSelection.main.js +77 -0
  28. package/dist/textSelection.main.js.map +1 -0
  29. package/dist/textSelection.mjs +71 -0
  30. package/dist/textSelection.module.js +71 -0
  31. package/dist/textSelection.module.js.map +1 -0
  32. package/dist/types.d.ts +218 -0
  33. package/dist/types.d.ts.map +1 -0
  34. package/dist/useFocus.main.js +64 -0
  35. package/dist/useFocus.main.js.map +1 -0
  36. package/dist/useFocus.mjs +59 -0
  37. package/dist/useFocus.module.js +59 -0
  38. package/dist/useFocus.module.js.map +1 -0
  39. package/dist/useFocusVisible.main.js +248 -0
  40. package/dist/useFocusVisible.main.js.map +1 -0
  41. package/dist/useFocusVisible.mjs +237 -0
  42. package/dist/useFocusVisible.module.js +237 -0
  43. package/dist/useFocusVisible.module.js.map +1 -0
  44. package/dist/useFocusWithin.main.js +76 -0
  45. package/dist/useFocusWithin.main.js.map +1 -0
  46. package/dist/useFocusWithin.mjs +71 -0
  47. package/dist/useFocusWithin.module.js +71 -0
  48. package/dist/useFocusWithin.module.js.map +1 -0
  49. package/dist/useHover.main.js +142 -0
  50. package/dist/useHover.main.js.map +1 -0
  51. package/dist/useHover.mjs +137 -0
  52. package/dist/useHover.module.js +137 -0
  53. package/dist/useHover.module.js.map +1 -0
  54. package/dist/useInteractOutside.main.js +101 -0
  55. package/dist/useInteractOutside.main.js.map +1 -0
  56. package/dist/useInteractOutside.mjs +96 -0
  57. package/dist/useInteractOutside.module.js +96 -0
  58. package/dist/useInteractOutside.module.js.map +1 -0
  59. package/dist/useKeyboard.main.js +30 -0
  60. package/dist/useKeyboard.main.js.map +1 -0
  61. package/dist/useKeyboard.mjs +25 -0
  62. package/dist/useKeyboard.module.js +25 -0
  63. package/dist/useKeyboard.module.js.map +1 -0
  64. package/dist/useLongPress.main.js +84 -0
  65. package/dist/useLongPress.main.js.map +1 -0
  66. package/dist/useLongPress.mjs +79 -0
  67. package/dist/useLongPress.module.js +79 -0
  68. package/dist/useLongPress.module.js.map +1 -0
  69. package/dist/useMove.main.js +236 -0
  70. package/dist/useMove.main.js.map +1 -0
  71. package/dist/useMove.mjs +231 -0
  72. package/dist/useMove.module.js +231 -0
  73. package/dist/useMove.module.js.map +1 -0
  74. package/dist/usePress.main.js +612 -0
  75. package/dist/usePress.main.js.map +1 -0
  76. package/dist/usePress.mjs +607 -0
  77. package/dist/usePress.module.js +607 -0
  78. package/dist/usePress.module.js.map +1 -0
  79. package/dist/useScrollWheel.main.js +41 -0
  80. package/dist/useScrollWheel.main.js.map +1 -0
  81. package/dist/useScrollWheel.mjs +36 -0
  82. package/dist/useScrollWheel.module.js +36 -0
  83. package/dist/useScrollWheel.module.js.map +1 -0
  84. package/dist/utils.main.js +120 -0
  85. package/dist/utils.main.js.map +1 -0
  86. package/dist/utils.mjs +115 -0
  87. package/dist/utils.module.js +115 -0
  88. package/dist/utils.module.js.map +1 -0
  89. package/package.json +37 -0
  90. package/src/DOMPropsContext.ts +39 -0
  91. package/src/DOMPropsResponder.tsx +47 -0
  92. package/src/PressResponder.tsx +64 -0
  93. package/src/Pressable.tsx +31 -0
  94. package/src/context.ts +23 -0
  95. package/src/createEventHandler.ts +48 -0
  96. package/src/index.ts +44 -0
  97. package/src/textSelection.ts +99 -0
  98. package/src/useDOMPropsResponder.ts +27 -0
  99. package/src/useFocus.ts +87 -0
  100. package/src/useFocusVisible.ts +331 -0
  101. package/src/useFocusWithin.ts +103 -0
  102. package/src/useHover.ts +206 -0
  103. package/src/useInteractOutside.ts +134 -0
  104. package/src/useKeyboard.ts +36 -0
  105. package/src/useLongPress.ts +129 -0
  106. package/src/useMove.ts +231 -0
  107. package/src/usePress.ts +955 -0
  108. package/src/useScrollWheel.ts +41 -0
  109. package/src/utils.ts +130 -0
package/dist/main.js ADDED
@@ -0,0 +1,62 @@
1
+ var $e1dbec26039c051d$exports = require("./Pressable.main.js");
2
+ var $3596bae48579386f$exports = require("./PressResponder.main.js");
3
+ var $5cb73d0ce355b0dc$exports = require("./useFocus.main.js");
4
+ var $e77252a287ef94ab$exports = require("./useFocusVisible.main.js");
5
+ var $d16842bbd0359d1b$exports = require("./useFocusWithin.main.js");
6
+ var $ffbc150311c75f01$exports = require("./useHover.main.js");
7
+ var $edcfa848c42f94f4$exports = require("./useInteractOutside.main.js");
8
+ var $892d64db2a3c53b0$exports = require("./useKeyboard.main.js");
9
+ var $c09386fc48fa427d$exports = require("./useMove.main.js");
10
+ var $0294ea432cd92340$exports = require("./usePress.main.js");
11
+ var $a3dbce0aed7087e2$exports = require("./useScrollWheel.main.js");
12
+ var $3cd7b5d0eebf0ca9$exports = require("./useLongPress.main.js");
13
+
14
+
15
+ function $parcel$export(e, n, v, s) {
16
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
17
+ }
18
+
19
+ $parcel$export(module.exports, "Pressable", () => $e1dbec26039c051d$exports.Pressable);
20
+ $parcel$export(module.exports, "PressResponder", () => $3596bae48579386f$exports.PressResponder);
21
+ $parcel$export(module.exports, "ClearPressResponder", () => $3596bae48579386f$exports.ClearPressResponder);
22
+ $parcel$export(module.exports, "useFocus", () => $5cb73d0ce355b0dc$exports.useFocus);
23
+ $parcel$export(module.exports, "isFocusVisible", () => $e77252a287ef94ab$exports.isFocusVisible);
24
+ $parcel$export(module.exports, "getInteractionModality", () => $e77252a287ef94ab$exports.getInteractionModality);
25
+ $parcel$export(module.exports, "setInteractionModality", () => $e77252a287ef94ab$exports.setInteractionModality);
26
+ $parcel$export(module.exports, "addWindowFocusTracking", () => $e77252a287ef94ab$exports.addWindowFocusTracking);
27
+ $parcel$export(module.exports, "useInteractionModality", () => $e77252a287ef94ab$exports.useInteractionModality);
28
+ $parcel$export(module.exports, "useFocusVisible", () => $e77252a287ef94ab$exports.useFocusVisible);
29
+ $parcel$export(module.exports, "useFocusVisibleListener", () => $e77252a287ef94ab$exports.useFocusVisibleListener);
30
+ $parcel$export(module.exports, "useFocusWithin", () => $d16842bbd0359d1b$exports.useFocusWithin);
31
+ $parcel$export(module.exports, "useHover", () => $ffbc150311c75f01$exports.useHover);
32
+ $parcel$export(module.exports, "useInteractOutside", () => $edcfa848c42f94f4$exports.useInteractOutside);
33
+ $parcel$export(module.exports, "useKeyboard", () => $892d64db2a3c53b0$exports.useKeyboard);
34
+ $parcel$export(module.exports, "useMove", () => $c09386fc48fa427d$exports.useMove);
35
+ $parcel$export(module.exports, "usePress", () => $0294ea432cd92340$exports.usePress);
36
+ $parcel$export(module.exports, "useScrollWheel", () => $a3dbce0aed7087e2$exports.useScrollWheel);
37
+ $parcel$export(module.exports, "useLongPress", () => $3cd7b5d0eebf0ca9$exports.useLongPress);
38
+ /*
39
+ * Copyright 2020 Adobe. All rights reserved.
40
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
41
+ * you may not use this file except in compliance with the License. You may obtain a copy
42
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
43
+ *
44
+ * Unless required by applicable law or agreed to in writing, software distributed under
45
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
46
+ * OF ANY KIND, either express or implied. See the License for the specific language
47
+ * governing permissions and limitations under the License.
48
+ */
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/interactions/src/index.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\nexport {Pressable} from './Pressable';\nexport {PressResponder, ClearPressResponder} from './PressResponder';\nexport {useFocus} from './useFocus';\nexport {\n isFocusVisible,\n getInteractionModality,\n setInteractionModality,\n addWindowFocusTracking,\n useInteractionModality,\n useFocusVisible,\n useFocusVisibleListener\n} from './useFocusVisible';\nexport {useFocusWithin} from './useFocusWithin';\nexport {useHover} from './useHover';\nexport {useInteractOutside} from './useInteractOutside';\nexport {useKeyboard} from './useKeyboard';\nexport {useMove} from './useMove';\nexport {usePress} from './usePress';\nexport {useScrollWheel} from './useScrollWheel';\nexport {useLongPress} from './useLongPress';\n\nexport type {FocusProps, FocusResult} from './useFocus';\nexport type {FocusVisibleHandler, FocusVisibleProps, FocusVisibleResult, Modality} from './useFocusVisible';\nexport type {FocusWithinProps, FocusWithinResult} from './useFocusWithin';\nexport type {HoverProps, HoverResult} from './useHover';\nexport type {InteractOutsideProps} from './useInteractOutside';\nexport type {KeyboardProps, KeyboardResult} from './useKeyboard';\nexport type {PressProps, PressHookProps, PressResult} from './usePress';\nexport type {PressEvent, PressEvents, MoveStartEvent, MoveMoveEvent, MoveEndEvent, MoveEvents, HoverEvent, HoverEvents, FocusEvents, KeyboardEvents} from '@react-types/shared';\nexport type {MoveResult} from './useMove';\nexport type {LongPressProps, LongPressResult} from './useLongPress';\nexport type {ScrollWheelProps} from './useScrollWheel';\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js ADDED
@@ -0,0 +1,39 @@
1
+ import {Pressable as $3b117e43dc0ca95d$export$27c701ed9e449e99} from "./Pressable.module.js";
2
+ import {ClearPressResponder as $f1ab8c75478c6f73$export$cf75428e0b9ed1ea, PressResponder as $f1ab8c75478c6f73$export$3351871ee4b288b8} from "./PressResponder.module.js";
3
+ import {useFocus as $a1ea59d68270f0dd$export$f8168d8dd8fd66e6} from "./useFocus.module.js";
4
+ import {addWindowFocusTracking as $507fabe10e71c6fb$export$2f1888112f558a7d, getInteractionModality as $507fabe10e71c6fb$export$630ff653c5ada6a9, isFocusVisible as $507fabe10e71c6fb$export$b9b3dfddab17db27, setInteractionModality as $507fabe10e71c6fb$export$8397ddfc504fdb9a, useFocusVisible as $507fabe10e71c6fb$export$ffd9e5021c1fb2d6, useFocusVisibleListener as $507fabe10e71c6fb$export$ec71b4b83ac08ec3, useInteractionModality as $507fabe10e71c6fb$export$98e20ec92f614cfe} from "./useFocusVisible.module.js";
5
+ import {useFocusWithin as $9ab94262bd0047c7$export$420e68273165f4ec} from "./useFocusWithin.module.js";
6
+ import {useHover as $6179b936705e76d3$export$ae780daf29e6d456} from "./useHover.module.js";
7
+ import {useInteractOutside as $e0b6e0b68ec7f50f$export$872b660ac5a1ff98} from "./useInteractOutside.module.js";
8
+ import {useKeyboard as $46d819fcbaf35654$export$8f71654801c2f7cd} from "./useKeyboard.module.js";
9
+ import {useMove as $e8a7022cf87cba2a$export$36da96379f79f245} from "./useMove.module.js";
10
+ import {usePress as $f6c31cce2adf654f$export$45712eceda6fad21} from "./usePress.module.js";
11
+ import {useScrollWheel as $7d0a636d7a4dcefd$export$2123ff2b87c81ca} from "./useScrollWheel.module.js";
12
+ import {useLongPress as $8a26561d2877236e$export$c24ed0104d07eab9} from "./useLongPress.module.js";
13
+
14
+ /*
15
+ * Copyright 2020 Adobe. All rights reserved.
16
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
17
+ * you may not use this file except in compliance with the License. You may obtain a copy
18
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
19
+ *
20
+ * Unless required by applicable law or agreed to in writing, software distributed under
21
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
22
+ * OF ANY KIND, either express or implied. See the License for the specific language
23
+ * governing permissions and limitations under the License.
24
+ */
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+ 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$2f1888112f558a7d as addWindowFocusTracking, $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};
39
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/interactions/src/index.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\nexport {Pressable} from './Pressable';\nexport {PressResponder, ClearPressResponder} from './PressResponder';\nexport {useFocus} from './useFocus';\nexport {\n isFocusVisible,\n getInteractionModality,\n setInteractionModality,\n addWindowFocusTracking,\n useInteractionModality,\n useFocusVisible,\n useFocusVisibleListener\n} from './useFocusVisible';\nexport {useFocusWithin} from './useFocusWithin';\nexport {useHover} from './useHover';\nexport {useInteractOutside} from './useInteractOutside';\nexport {useKeyboard} from './useKeyboard';\nexport {useMove} from './useMove';\nexport {usePress} from './usePress';\nexport {useScrollWheel} from './useScrollWheel';\nexport {useLongPress} from './useLongPress';\n\nexport type {FocusProps, FocusResult} from './useFocus';\nexport type {FocusVisibleHandler, FocusVisibleProps, FocusVisibleResult, Modality} from './useFocusVisible';\nexport type {FocusWithinProps, FocusWithinResult} from './useFocusWithin';\nexport type {HoverProps, HoverResult} from './useHover';\nexport type {InteractOutsideProps} from './useInteractOutside';\nexport type {KeyboardProps, KeyboardResult} from './useKeyboard';\nexport type {PressProps, PressHookProps, PressResult} from './usePress';\nexport type {PressEvent, PressEvents, MoveStartEvent, MoveMoveEvent, MoveEndEvent, MoveEvents, HoverEvent, HoverEvents, FocusEvents, KeyboardEvents} from '@react-types/shared';\nexport type {MoveResult} from './useMove';\nexport type {LongPressProps, LongPressResult} from './useLongPress';\nexport type {ScrollWheelProps} from './useScrollWheel';\n"],"names":[],"version":3,"file":"module.js.map"}
@@ -0,0 +1,77 @@
1
+ var $20aJV$reactariautils = require("@react-aria/utils");
2
+
3
+
4
+ function $parcel$export(e, n, v, s) {
5
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
6
+ }
7
+
8
+ $parcel$export(module.exports, "disableTextSelection", () => $f7e14e656343df57$export$16a4697467175487);
9
+ $parcel$export(module.exports, "restoreTextSelection", () => $f7e14e656343df57$export$b0d6fa1ab32e3295);
10
+ /*
11
+ * Copyright 2020 Adobe. All rights reserved.
12
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License. You may obtain a copy
14
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software distributed under
17
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
18
+ * OF ANY KIND, either express or implied. See the License for the specific language
19
+ * governing permissions and limitations under the License.
20
+ */
21
+ // Note that state only matters here for iOS. Non-iOS gets user-select: none applied to the target element
22
+ // rather than at the document level so we just need to apply/remove user-select: none for each pressed element individually
23
+ let $f7e14e656343df57$var$state = 'default';
24
+ let $f7e14e656343df57$var$savedUserSelect = '';
25
+ let $f7e14e656343df57$var$modifiedElementMap = new WeakMap();
26
+ function $f7e14e656343df57$export$16a4697467175487(target) {
27
+ if ((0, $20aJV$reactariautils.isIOS)()) {
28
+ if ($f7e14e656343df57$var$state === 'default') {
29
+ // eslint-disable-next-line no-restricted-globals
30
+ const documentObject = (0, $20aJV$reactariautils.getOwnerDocument)(target);
31
+ $f7e14e656343df57$var$savedUserSelect = documentObject.documentElement.style.webkitUserSelect;
32
+ documentObject.documentElement.style.webkitUserSelect = 'none';
33
+ }
34
+ $f7e14e656343df57$var$state = 'disabled';
35
+ } else if (target instanceof HTMLElement || target instanceof SVGElement) {
36
+ // If not iOS, store the target's original user-select and change to user-select: none
37
+ // Ignore state since it doesn't apply for non iOS
38
+ $f7e14e656343df57$var$modifiedElementMap.set(target, target.style.userSelect);
39
+ target.style.userSelect = 'none';
40
+ }
41
+ }
42
+ function $f7e14e656343df57$export$b0d6fa1ab32e3295(target) {
43
+ if ((0, $20aJV$reactariautils.isIOS)()) {
44
+ // If the state is already default, there's nothing to do.
45
+ // If it is restoring, then there's no need to queue a second restore.
46
+ if ($f7e14e656343df57$var$state !== 'disabled') return;
47
+ $f7e14e656343df57$var$state = 'restoring';
48
+ // There appears to be a delay on iOS where selection still might occur
49
+ // after pointer up, so wait a bit before removing user-select.
50
+ setTimeout(()=>{
51
+ // Wait for any CSS transitions to complete so we don't recompute style
52
+ // for the whole page in the middle of the animation and cause jank.
53
+ (0, $20aJV$reactariautils.runAfterTransition)(()=>{
54
+ // Avoid race conditions
55
+ if ($f7e14e656343df57$var$state === 'restoring') {
56
+ // eslint-disable-next-line no-restricted-globals
57
+ const documentObject = (0, $20aJV$reactariautils.getOwnerDocument)(target);
58
+ if (documentObject.documentElement.style.webkitUserSelect === 'none') documentObject.documentElement.style.webkitUserSelect = $f7e14e656343df57$var$savedUserSelect || '';
59
+ $f7e14e656343df57$var$savedUserSelect = '';
60
+ $f7e14e656343df57$var$state = 'default';
61
+ }
62
+ });
63
+ }, 300);
64
+ } else if (target instanceof HTMLElement || target instanceof SVGElement) // If not iOS, restore the target's original user-select if any
65
+ // Ignore state since it doesn't apply for non iOS
66
+ {
67
+ if (target && $f7e14e656343df57$var$modifiedElementMap.has(target)) {
68
+ let targetOldUserSelect = $f7e14e656343df57$var$modifiedElementMap.get(target);
69
+ if (target.style.userSelect === 'none') target.style.userSelect = targetOldUserSelect;
70
+ if (target.getAttribute('style') === '') target.removeAttribute('style');
71
+ $f7e14e656343df57$var$modifiedElementMap.delete(target);
72
+ }
73
+ }
74
+ }
75
+
76
+
77
+ //# sourceMappingURL=textSelection.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;AAmBD,0GAA0G;AAC1G,4HAA4H;AAC5H,IAAI,8BAAe;AACnB,IAAI,wCAAkB;AACtB,IAAI,2CAAqB,IAAI;AAEtB,SAAS,0CAAqB,MAAgB;IACnD,IAAI,CAAA,GAAA,2BAAI,KAAK;QACX,IAAI,gCAAU,WAAW;YACvB,iDAAiD;YACjD,MAAM,iBAAiB,CAAA,GAAA,sCAAe,EAAE;YACxC,wCAAkB,eAAe,eAAe,CAAC,KAAK,CAAC,gBAAgB;YACvE,eAAe,eAAe,CAAC,KAAK,CAAC,gBAAgB,GAAG;QAC1D;QAEA,8BAAQ;IACV,OAAO,IAAI,kBAAkB,eAAe,kBAAkB,YAAY;QACxE,sFAAsF;QACtF,kDAAkD;QAClD,yCAAmB,GAAG,CAAC,QAAQ,OAAO,KAAK,CAAC,UAAU;QACtD,OAAO,KAAK,CAAC,UAAU,GAAG;IAC5B;AACF;AAEO,SAAS,0CAAqB,MAAgB;IACnD,IAAI,CAAA,GAAA,2BAAI,KAAK;QACX,0DAA0D;QAC1D,sEAAsE;QACtE,IAAI,gCAAU,YACZ;QAGF,8BAAQ;QAER,uEAAuE;QACvE,+DAA+D;QAC/D,WAAW;YACT,uEAAuE;YACvE,oEAAoE;YACpE,CAAA,GAAA,wCAAiB,EAAE;gBACjB,wBAAwB;gBACxB,IAAI,gCAAU,aAAa;oBACzB,iDAAiD;oBACjD,MAAM,iBAAiB,CAAA,GAAA,sCAAe,EAAE;oBACxC,IAAI,eAAe,eAAe,CAAC,KAAK,CAAC,gBAAgB,KAAK,QAC5D,eAAe,eAAe,CAAC,KAAK,CAAC,gBAAgB,GAAG,yCAAmB;oBAG7E,wCAAkB;oBAClB,8BAAQ;gBACV;YACF;QACF,GAAG;IACL,OAAO,IAAI,kBAAkB,eAAe,kBAAkB,YAC5D,+DAA+D;IAC/D,kDAAkD;IAClD;QAAA,IAAI,UAAU,yCAAmB,GAAG,CAAC,SAAS;YAC5C,IAAI,sBAAsB,yCAAmB,GAAG,CAAC;YAEjD,IAAI,OAAO,KAAK,CAAC,UAAU,KAAK,QAC9B,OAAO,KAAK,CAAC,UAAU,GAAG;YAG5B,IAAI,OAAO,YAAY,CAAC,aAAa,IACnC,OAAO,eAAe,CAAC;YAEzB,yCAAmB,MAAM,CAAC;QAC5B;IAAA;AAEJ","sources":["packages/@react-aria/interactions/src/textSelection.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 {getOwnerDocument, isIOS, runAfterTransition} from '@react-aria/utils';\n\n// Safari on iOS starts selecting text on long press. The only way to avoid this, it seems,\n// is to add user-select: none to the entire page. Adding it to the pressable element prevents\n// that element from being selected, but nearby elements may still receive selection. We add\n// user-select: none on touch start, and remove it again on touch end to prevent this.\n// This must be implemented using global state to avoid race conditions between multiple elements.\n\n// There are three possible states due to the delay before removing user-select: none after\n// pointer up. The 'default' state always transitions to the 'disabled' state, which transitions\n// to 'restoring'. The 'restoring' state can either transition back to 'disabled' or 'default'.\n\n// For non-iOS devices, we apply user-select: none to the pressed element instead to avoid possible\n// performance issues that arise from applying and removing user-select: none to the entire page\n// (see https://github.com/adobe/react-spectrum/issues/1609).\ntype State = 'default' | 'disabled' | 'restoring';\n\n// Note that state only matters here for iOS. Non-iOS gets user-select: none applied to the target element\n// rather than at the document level so we just need to apply/remove user-select: none for each pressed element individually\nlet state: State = 'default';\nlet savedUserSelect = '';\nlet modifiedElementMap = new WeakMap<Element, string>();\n\nexport function disableTextSelection(target?: Element) {\n if (isIOS()) {\n if (state === 'default') {\n // eslint-disable-next-line no-restricted-globals\n const documentObject = getOwnerDocument(target);\n savedUserSelect = documentObject.documentElement.style.webkitUserSelect;\n documentObject.documentElement.style.webkitUserSelect = 'none';\n }\n\n state = 'disabled';\n } else if (target instanceof HTMLElement || target instanceof SVGElement) {\n // If not iOS, store the target's original user-select and change to user-select: none\n // Ignore state since it doesn't apply for non iOS\n modifiedElementMap.set(target, target.style.userSelect);\n target.style.userSelect = 'none';\n }\n}\n\nexport function restoreTextSelection(target?: Element) {\n if (isIOS()) {\n // If the state is already default, there's nothing to do.\n // If it is restoring, then there's no need to queue a second restore.\n if (state !== 'disabled') {\n return;\n }\n\n state = 'restoring';\n\n // There appears to be a delay on iOS where selection still might occur\n // after pointer up, so wait a bit before removing user-select.\n setTimeout(() => {\n // Wait for any CSS transitions to complete so we don't recompute style\n // for the whole page in the middle of the animation and cause jank.\n runAfterTransition(() => {\n // Avoid race conditions\n if (state === 'restoring') {\n // eslint-disable-next-line no-restricted-globals\n const documentObject = getOwnerDocument(target);\n if (documentObject.documentElement.style.webkitUserSelect === 'none') {\n documentObject.documentElement.style.webkitUserSelect = savedUserSelect || '';\n }\n\n savedUserSelect = '';\n state = 'default';\n }\n });\n }, 300);\n } else if (target instanceof HTMLElement || target instanceof SVGElement) {\n // If not iOS, restore the target's original user-select if any\n // Ignore state since it doesn't apply for non iOS\n if (target && modifiedElementMap.has(target)) {\n let targetOldUserSelect = modifiedElementMap.get(target) as string;\n\n if (target.style.userSelect === 'none') {\n target.style.userSelect = targetOldUserSelect;\n }\n\n if (target.getAttribute('style') === '') {\n target.removeAttribute('style');\n }\n modifiedElementMap.delete(target);\n }\n }\n}\n"],"names":[],"version":3,"file":"textSelection.main.js.map"}
@@ -0,0 +1,71 @@
1
+ import {isIOS as $7R18e$isIOS, getOwnerDocument as $7R18e$getOwnerDocument, runAfterTransition as $7R18e$runAfterTransition} from "@react-aria/utils";
2
+
3
+ /*
4
+ * Copyright 2020 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+ // Note that state only matters here for iOS. Non-iOS gets user-select: none applied to the target element
15
+ // rather than at the document level so we just need to apply/remove user-select: none for each pressed element individually
16
+ let $14c0b72509d70225$var$state = 'default';
17
+ let $14c0b72509d70225$var$savedUserSelect = '';
18
+ let $14c0b72509d70225$var$modifiedElementMap = new WeakMap();
19
+ function $14c0b72509d70225$export$16a4697467175487(target) {
20
+ if ((0, $7R18e$isIOS)()) {
21
+ if ($14c0b72509d70225$var$state === 'default') {
22
+ // eslint-disable-next-line no-restricted-globals
23
+ const documentObject = (0, $7R18e$getOwnerDocument)(target);
24
+ $14c0b72509d70225$var$savedUserSelect = documentObject.documentElement.style.webkitUserSelect;
25
+ documentObject.documentElement.style.webkitUserSelect = 'none';
26
+ }
27
+ $14c0b72509d70225$var$state = 'disabled';
28
+ } else if (target instanceof HTMLElement || target instanceof SVGElement) {
29
+ // If not iOS, store the target's original user-select and change to user-select: none
30
+ // Ignore state since it doesn't apply for non iOS
31
+ $14c0b72509d70225$var$modifiedElementMap.set(target, target.style.userSelect);
32
+ target.style.userSelect = 'none';
33
+ }
34
+ }
35
+ function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
36
+ if ((0, $7R18e$isIOS)()) {
37
+ // If the state is already default, there's nothing to do.
38
+ // If it is restoring, then there's no need to queue a second restore.
39
+ if ($14c0b72509d70225$var$state !== 'disabled') return;
40
+ $14c0b72509d70225$var$state = 'restoring';
41
+ // There appears to be a delay on iOS where selection still might occur
42
+ // after pointer up, so wait a bit before removing user-select.
43
+ setTimeout(()=>{
44
+ // Wait for any CSS transitions to complete so we don't recompute style
45
+ // for the whole page in the middle of the animation and cause jank.
46
+ (0, $7R18e$runAfterTransition)(()=>{
47
+ // Avoid race conditions
48
+ if ($14c0b72509d70225$var$state === 'restoring') {
49
+ // eslint-disable-next-line no-restricted-globals
50
+ const documentObject = (0, $7R18e$getOwnerDocument)(target);
51
+ if (documentObject.documentElement.style.webkitUserSelect === 'none') documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect || '';
52
+ $14c0b72509d70225$var$savedUserSelect = '';
53
+ $14c0b72509d70225$var$state = 'default';
54
+ }
55
+ });
56
+ }, 300);
57
+ } else if (target instanceof HTMLElement || target instanceof SVGElement) // If not iOS, restore the target's original user-select if any
58
+ // Ignore state since it doesn't apply for non iOS
59
+ {
60
+ if (target && $14c0b72509d70225$var$modifiedElementMap.has(target)) {
61
+ let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap.get(target);
62
+ if (target.style.userSelect === 'none') target.style.userSelect = targetOldUserSelect;
63
+ if (target.getAttribute('style') === '') target.removeAttribute('style');
64
+ $14c0b72509d70225$var$modifiedElementMap.delete(target);
65
+ }
66
+ }
67
+ }
68
+
69
+
70
+ export {$14c0b72509d70225$export$16a4697467175487 as disableTextSelection, $14c0b72509d70225$export$b0d6fa1ab32e3295 as restoreTextSelection};
71
+ //# sourceMappingURL=textSelection.module.js.map
@@ -0,0 +1,71 @@
1
+ import {isIOS as $7R18e$isIOS, getOwnerDocument as $7R18e$getOwnerDocument, runAfterTransition as $7R18e$runAfterTransition} from "@react-aria/utils";
2
+
3
+ /*
4
+ * Copyright 2020 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+ // Note that state only matters here for iOS. Non-iOS gets user-select: none applied to the target element
15
+ // rather than at the document level so we just need to apply/remove user-select: none for each pressed element individually
16
+ let $14c0b72509d70225$var$state = 'default';
17
+ let $14c0b72509d70225$var$savedUserSelect = '';
18
+ let $14c0b72509d70225$var$modifiedElementMap = new WeakMap();
19
+ function $14c0b72509d70225$export$16a4697467175487(target) {
20
+ if ((0, $7R18e$isIOS)()) {
21
+ if ($14c0b72509d70225$var$state === 'default') {
22
+ // eslint-disable-next-line no-restricted-globals
23
+ const documentObject = (0, $7R18e$getOwnerDocument)(target);
24
+ $14c0b72509d70225$var$savedUserSelect = documentObject.documentElement.style.webkitUserSelect;
25
+ documentObject.documentElement.style.webkitUserSelect = 'none';
26
+ }
27
+ $14c0b72509d70225$var$state = 'disabled';
28
+ } else if (target instanceof HTMLElement || target instanceof SVGElement) {
29
+ // If not iOS, store the target's original user-select and change to user-select: none
30
+ // Ignore state since it doesn't apply for non iOS
31
+ $14c0b72509d70225$var$modifiedElementMap.set(target, target.style.userSelect);
32
+ target.style.userSelect = 'none';
33
+ }
34
+ }
35
+ function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
36
+ if ((0, $7R18e$isIOS)()) {
37
+ // If the state is already default, there's nothing to do.
38
+ // If it is restoring, then there's no need to queue a second restore.
39
+ if ($14c0b72509d70225$var$state !== 'disabled') return;
40
+ $14c0b72509d70225$var$state = 'restoring';
41
+ // There appears to be a delay on iOS where selection still might occur
42
+ // after pointer up, so wait a bit before removing user-select.
43
+ setTimeout(()=>{
44
+ // Wait for any CSS transitions to complete so we don't recompute style
45
+ // for the whole page in the middle of the animation and cause jank.
46
+ (0, $7R18e$runAfterTransition)(()=>{
47
+ // Avoid race conditions
48
+ if ($14c0b72509d70225$var$state === 'restoring') {
49
+ // eslint-disable-next-line no-restricted-globals
50
+ const documentObject = (0, $7R18e$getOwnerDocument)(target);
51
+ if (documentObject.documentElement.style.webkitUserSelect === 'none') documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect || '';
52
+ $14c0b72509d70225$var$savedUserSelect = '';
53
+ $14c0b72509d70225$var$state = 'default';
54
+ }
55
+ });
56
+ }, 300);
57
+ } else if (target instanceof HTMLElement || target instanceof SVGElement) // If not iOS, restore the target's original user-select if any
58
+ // Ignore state since it doesn't apply for non iOS
59
+ {
60
+ if (target && $14c0b72509d70225$var$modifiedElementMap.has(target)) {
61
+ let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap.get(target);
62
+ if (target.style.userSelect === 'none') target.style.userSelect = targetOldUserSelect;
63
+ if (target.getAttribute('style') === '') target.removeAttribute('style');
64
+ $14c0b72509d70225$var$modifiedElementMap.delete(target);
65
+ }
66
+ }
67
+ }
68
+
69
+
70
+ export {$14c0b72509d70225$export$16a4697467175487 as disableTextSelection, $14c0b72509d70225$export$b0d6fa1ab32e3295 as restoreTextSelection};
71
+ //# sourceMappingURL=textSelection.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;AAmBD,0GAA0G;AAC1G,4HAA4H;AAC5H,IAAI,8BAAe;AACnB,IAAI,wCAAkB;AACtB,IAAI,2CAAqB,IAAI;AAEtB,SAAS,0CAAqB,MAAgB;IACnD,IAAI,CAAA,GAAA,YAAI,KAAK;QACX,IAAI,gCAAU,WAAW;YACvB,iDAAiD;YACjD,MAAM,iBAAiB,CAAA,GAAA,uBAAe,EAAE;YACxC,wCAAkB,eAAe,eAAe,CAAC,KAAK,CAAC,gBAAgB;YACvE,eAAe,eAAe,CAAC,KAAK,CAAC,gBAAgB,GAAG;QAC1D;QAEA,8BAAQ;IACV,OAAO,IAAI,kBAAkB,eAAe,kBAAkB,YAAY;QACxE,sFAAsF;QACtF,kDAAkD;QAClD,yCAAmB,GAAG,CAAC,QAAQ,OAAO,KAAK,CAAC,UAAU;QACtD,OAAO,KAAK,CAAC,UAAU,GAAG;IAC5B;AACF;AAEO,SAAS,0CAAqB,MAAgB;IACnD,IAAI,CAAA,GAAA,YAAI,KAAK;QACX,0DAA0D;QAC1D,sEAAsE;QACtE,IAAI,gCAAU,YACZ;QAGF,8BAAQ;QAER,uEAAuE;QACvE,+DAA+D;QAC/D,WAAW;YACT,uEAAuE;YACvE,oEAAoE;YACpE,CAAA,GAAA,yBAAiB,EAAE;gBACjB,wBAAwB;gBACxB,IAAI,gCAAU,aAAa;oBACzB,iDAAiD;oBACjD,MAAM,iBAAiB,CAAA,GAAA,uBAAe,EAAE;oBACxC,IAAI,eAAe,eAAe,CAAC,KAAK,CAAC,gBAAgB,KAAK,QAC5D,eAAe,eAAe,CAAC,KAAK,CAAC,gBAAgB,GAAG,yCAAmB;oBAG7E,wCAAkB;oBAClB,8BAAQ;gBACV;YACF;QACF,GAAG;IACL,OAAO,IAAI,kBAAkB,eAAe,kBAAkB,YAC5D,+DAA+D;IAC/D,kDAAkD;IAClD;QAAA,IAAI,UAAU,yCAAmB,GAAG,CAAC,SAAS;YAC5C,IAAI,sBAAsB,yCAAmB,GAAG,CAAC;YAEjD,IAAI,OAAO,KAAK,CAAC,UAAU,KAAK,QAC9B,OAAO,KAAK,CAAC,UAAU,GAAG;YAG5B,IAAI,OAAO,YAAY,CAAC,aAAa,IACnC,OAAO,eAAe,CAAC;YAEzB,yCAAmB,MAAM,CAAC;QAC5B;IAAA;AAEJ","sources":["packages/@react-aria/interactions/src/textSelection.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 {getOwnerDocument, isIOS, runAfterTransition} from '@react-aria/utils';\n\n// Safari on iOS starts selecting text on long press. The only way to avoid this, it seems,\n// is to add user-select: none to the entire page. Adding it to the pressable element prevents\n// that element from being selected, but nearby elements may still receive selection. We add\n// user-select: none on touch start, and remove it again on touch end to prevent this.\n// This must be implemented using global state to avoid race conditions between multiple elements.\n\n// There are three possible states due to the delay before removing user-select: none after\n// pointer up. The 'default' state always transitions to the 'disabled' state, which transitions\n// to 'restoring'. The 'restoring' state can either transition back to 'disabled' or 'default'.\n\n// For non-iOS devices, we apply user-select: none to the pressed element instead to avoid possible\n// performance issues that arise from applying and removing user-select: none to the entire page\n// (see https://github.com/adobe/react-spectrum/issues/1609).\ntype State = 'default' | 'disabled' | 'restoring';\n\n// Note that state only matters here for iOS. Non-iOS gets user-select: none applied to the target element\n// rather than at the document level so we just need to apply/remove user-select: none for each pressed element individually\nlet state: State = 'default';\nlet savedUserSelect = '';\nlet modifiedElementMap = new WeakMap<Element, string>();\n\nexport function disableTextSelection(target?: Element) {\n if (isIOS()) {\n if (state === 'default') {\n // eslint-disable-next-line no-restricted-globals\n const documentObject = getOwnerDocument(target);\n savedUserSelect = documentObject.documentElement.style.webkitUserSelect;\n documentObject.documentElement.style.webkitUserSelect = 'none';\n }\n\n state = 'disabled';\n } else if (target instanceof HTMLElement || target instanceof SVGElement) {\n // If not iOS, store the target's original user-select and change to user-select: none\n // Ignore state since it doesn't apply for non iOS\n modifiedElementMap.set(target, target.style.userSelect);\n target.style.userSelect = 'none';\n }\n}\n\nexport function restoreTextSelection(target?: Element) {\n if (isIOS()) {\n // If the state is already default, there's nothing to do.\n // If it is restoring, then there's no need to queue a second restore.\n if (state !== 'disabled') {\n return;\n }\n\n state = 'restoring';\n\n // There appears to be a delay on iOS where selection still might occur\n // after pointer up, so wait a bit before removing user-select.\n setTimeout(() => {\n // Wait for any CSS transitions to complete so we don't recompute style\n // for the whole page in the middle of the animation and cause jank.\n runAfterTransition(() => {\n // Avoid race conditions\n if (state === 'restoring') {\n // eslint-disable-next-line no-restricted-globals\n const documentObject = getOwnerDocument(target);\n if (documentObject.documentElement.style.webkitUserSelect === 'none') {\n documentObject.documentElement.style.webkitUserSelect = savedUserSelect || '';\n }\n\n savedUserSelect = '';\n state = 'default';\n }\n });\n }, 300);\n } else if (target instanceof HTMLElement || target instanceof SVGElement) {\n // If not iOS, restore the target's original user-select if any\n // Ignore state since it doesn't apply for non iOS\n if (target && modifiedElementMap.has(target)) {\n let targetOldUserSelect = modifiedElementMap.get(target) as string;\n\n if (target.style.userSelect === 'none') {\n target.style.userSelect = targetOldUserSelect;\n }\n\n if (target.getAttribute('style') === '') {\n target.removeAttribute('style');\n }\n modifiedElementMap.delete(target);\n }\n }\n}\n"],"names":[],"version":3,"file":"textSelection.module.js.map"}
@@ -0,0 +1,218 @@
1
+ import { DOMAttributes, PressEvents, RefObject, FocusableElement, FocusEvents, HoverEvents, KeyboardEvents, MoveEvents, ScrollEvents, LongPressEvent } from "@react-types/shared";
2
+ import React, { ReactElement, ReactNode, FocusEvent } from "react";
3
+ export interface PressProps extends PressEvents {
4
+ /** Whether the target is in a controlled press state (e.g. an overlay it triggers is open). */
5
+ isPressed?: boolean;
6
+ /** Whether the press events should be disabled. */
7
+ isDisabled?: boolean;
8
+ /** Whether the target should not receive focus on press. */
9
+ preventFocusOnPress?: boolean;
10
+ /**
11
+ * Whether press events should be canceled when the pointer leaves the target while pressed.
12
+ * By default, this is `false`, which means if the pointer returns back over the target while
13
+ * still pressed, onPressStart will be fired again. If set to `true`, the press is canceled
14
+ * when the pointer leaves the target and onPressStart will not be fired if the pointer returns.
15
+ */
16
+ shouldCancelOnPointerExit?: boolean;
17
+ /** Whether text selection should be enabled on the pressable element. */
18
+ allowTextSelectionOnPress?: boolean;
19
+ }
20
+ export interface PressHookProps extends PressProps {
21
+ /** A ref to the target element. */
22
+ ref?: RefObject<Element | null>;
23
+ }
24
+ export interface PressResult {
25
+ /** Whether the target is currently pressed. */
26
+ isPressed: boolean;
27
+ /** Props to spread on the target element. */
28
+ pressProps: DOMAttributes;
29
+ }
30
+ /**
31
+ * Handles press interactions across mouse, touch, keyboard, and screen readers.
32
+ * It normalizes behavior across browsers and platforms, and handles many nuances
33
+ * of dealing with pointer and keyboard events.
34
+ */
35
+ export function usePress(props: PressHookProps): PressResult;
36
+ interface PressableProps extends PressProps {
37
+ children: ReactElement<DOMAttributes, string>;
38
+ }
39
+ export const Pressable: React.ForwardRefExoticComponent<PressableProps & React.RefAttributes<HTMLElement>>;
40
+ interface PressResponderProps extends PressProps {
41
+ children: ReactNode;
42
+ }
43
+ export const PressResponder: React.ForwardRefExoticComponent<PressResponderProps & React.RefAttributes<FocusableElement>>;
44
+ export function ClearPressResponder({ children }: {
45
+ children: ReactNode;
46
+ }): React.JSX.Element;
47
+ export interface FocusProps<Target = FocusableElement> extends FocusEvents<Target> {
48
+ /** Whether the focus events should be disabled. */
49
+ isDisabled?: boolean;
50
+ }
51
+ export interface FocusResult<Target = FocusableElement> {
52
+ /** Props to spread onto the target element. */
53
+ focusProps: DOMAttributes<Target>;
54
+ }
55
+ /**
56
+ * Handles focus events for the immediate target.
57
+ * Focus events on child elements will be ignored.
58
+ */
59
+ export function useFocus<Target extends FocusableElement = FocusableElement>(props: FocusProps<Target>): FocusResult<Target>;
60
+ export type Modality = 'keyboard' | 'pointer' | 'virtual';
61
+ export type FocusVisibleHandler = (isFocusVisible: boolean) => void;
62
+ export interface FocusVisibleProps {
63
+ /** Whether the element is a text input. */
64
+ isTextInput?: boolean;
65
+ /** Whether the element will be auto focused. */
66
+ autoFocus?: boolean;
67
+ }
68
+ export interface FocusVisibleResult {
69
+ /** Whether keyboard focus is visible globally. */
70
+ isFocusVisible: boolean;
71
+ }
72
+ /**
73
+ * EXPERIMENTAL
74
+ * Adds a window (i.e. iframe) to the list of windows that are being tracked for focus visible.
75
+ *
76
+ * Sometimes apps render portions of their tree into an iframe. In this case, we cannot accurately track if the focus
77
+ * is visible because we cannot see interactions inside the iframe. If you have this in your application's architecture,
78
+ * then this function will attach event listeners inside the iframe. You should call `addWindowFocusTracking` with an
79
+ * element from inside the window you wish to add. We'll retrieve the relevant elements based on that.
80
+ * Note, you do not need to call this for the default window, as we call it for you.
81
+ *
82
+ * When you are ready to stop listening, but you do not wish to unmount the iframe, you may call the cleanup function
83
+ * returned by `addWindowFocusTracking`. Otherwise, when you unmount the iframe, all listeners and state will be cleaned
84
+ * up automatically for you.
85
+ *
86
+ * @param element @default document.body - The element provided will be used to get the window to add.
87
+ * @returns A function to remove the event listeners and cleanup the state.
88
+ */
89
+ export function addWindowFocusTracking(element?: HTMLElement | null): () => void;
90
+ /**
91
+ * If true, keyboard focus is visible.
92
+ */
93
+ export function isFocusVisible(): boolean;
94
+ export function getInteractionModality(): Modality | null;
95
+ export function setInteractionModality(modality: Modality): void;
96
+ /**
97
+ * Keeps state of the current modality.
98
+ */
99
+ export function useInteractionModality(): Modality | null;
100
+ /**
101
+ * Manages focus visible state for the page, and subscribes individual components for updates.
102
+ */
103
+ export function useFocusVisible(props?: FocusVisibleProps): FocusVisibleResult;
104
+ /**
105
+ * Listens for trigger change and reports if focus is visible (i.e., modality is not pointer).
106
+ */
107
+ export function useFocusVisibleListener(fn: FocusVisibleHandler, deps: ReadonlyArray<any>, opts?: {
108
+ isTextInput?: boolean;
109
+ }): void;
110
+ export interface FocusWithinProps {
111
+ /** Whether the focus within events should be disabled. */
112
+ isDisabled?: boolean;
113
+ /** Handler that is called when the target element or a descendant receives focus. */
114
+ onFocusWithin?: (e: FocusEvent) => void;
115
+ /** Handler that is called when the target element and all descendants lose focus. */
116
+ onBlurWithin?: (e: FocusEvent) => void;
117
+ /** Handler that is called when the the focus within state changes. */
118
+ onFocusWithinChange?: (isFocusWithin: boolean) => void;
119
+ }
120
+ export interface FocusWithinResult {
121
+ /** Props to spread onto the target element. */
122
+ focusWithinProps: DOMAttributes;
123
+ }
124
+ /**
125
+ * Handles focus events for the target and its descendants.
126
+ */
127
+ export function useFocusWithin(props: FocusWithinProps): FocusWithinResult;
128
+ export interface HoverProps extends HoverEvents {
129
+ /** Whether the hover events should be disabled. */
130
+ isDisabled?: boolean;
131
+ }
132
+ export interface HoverResult {
133
+ /** Props to spread on the target element. */
134
+ hoverProps: DOMAttributes;
135
+ isHovered: boolean;
136
+ }
137
+ /**
138
+ * Handles pointer hover interactions for an element. Normalizes behavior
139
+ * across browsers and platforms, and ignores emulated mouse events on touch devices.
140
+ */
141
+ export function useHover(props: HoverProps): HoverResult;
142
+ export interface InteractOutsideProps {
143
+ ref: RefObject<Element | null>;
144
+ onInteractOutside?: (e: PointerEvent) => void;
145
+ onInteractOutsideStart?: (e: PointerEvent) => void;
146
+ /** Whether the interact outside events should be disabled. */
147
+ isDisabled?: boolean;
148
+ }
149
+ /**
150
+ * Example, used in components like Dialogs and Popovers so they can close
151
+ * when a user clicks outside them.
152
+ */
153
+ export function useInteractOutside(props: InteractOutsideProps): void;
154
+ export interface KeyboardProps extends KeyboardEvents {
155
+ /** Whether the keyboard events should be disabled. */
156
+ isDisabled?: boolean;
157
+ }
158
+ export interface KeyboardResult {
159
+ /** Props to spread onto the target element. */
160
+ keyboardProps: DOMAttributes;
161
+ }
162
+ /**
163
+ * Handles keyboard interactions for a focusable element.
164
+ */
165
+ export function useKeyboard(props: KeyboardProps): KeyboardResult;
166
+ export interface MoveResult {
167
+ /** Props to spread on the target element. */
168
+ moveProps: DOMAttributes;
169
+ }
170
+ /**
171
+ * Handles move interactions across mouse, touch, and keyboard, including dragging with
172
+ * the mouse or touch, and using the arrow keys. Normalizes behavior across browsers and
173
+ * platforms, and ignores emulated mouse events on touch devices.
174
+ */
175
+ export function useMove(props: MoveEvents): MoveResult;
176
+ export interface ScrollWheelProps extends ScrollEvents {
177
+ /** Whether the scroll listener should be disabled. */
178
+ isDisabled?: boolean;
179
+ }
180
+ export function useScrollWheel(props: ScrollWheelProps, ref: RefObject<HTMLElement | null>): void;
181
+ export interface LongPressProps {
182
+ /** Whether long press events should be disabled. */
183
+ isDisabled?: boolean;
184
+ /** Handler that is called when a long press interaction starts. */
185
+ onLongPressStart?: (e: LongPressEvent) => void;
186
+ /**
187
+ * Handler that is called when a long press interaction ends, either
188
+ * over the target or when the pointer leaves the target.
189
+ */
190
+ onLongPressEnd?: (e: LongPressEvent) => void;
191
+ /**
192
+ * Handler that is called when the threshold time is met while
193
+ * the press is over the target.
194
+ */
195
+ onLongPress?: (e: LongPressEvent) => void;
196
+ /**
197
+ * The amount of time in milliseconds to wait before triggering a long press.
198
+ * @default 500ms
199
+ */
200
+ threshold?: number;
201
+ /**
202
+ * A description for assistive techology users indicating that a long press
203
+ * action is available, e.g. "Long press to open menu".
204
+ */
205
+ accessibilityDescription?: string;
206
+ }
207
+ export interface LongPressResult {
208
+ /** Props to spread on the target element. */
209
+ longPressProps: DOMAttributes;
210
+ }
211
+ /**
212
+ * Handles long press interactions across mouse and touch devices. Supports a customizable time threshold,
213
+ * accessibility description, and normalizes behavior across browsers and devices.
214
+ */
215
+ export function useLongPress(props: LongPressProps): LongPressResult;
216
+ export type { PressEvent, PressEvents, MoveStartEvent, MoveMoveEvent, MoveEndEvent, MoveEvents, HoverEvent, HoverEvents, FocusEvents, KeyboardEvents } from '@react-types/shared';
217
+
218
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"mappings":";;AEuBA,2BAA4B,SAAQ,WAAW;IAC7C,+FAA+F;IAC/F,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mDAAmD;IACnD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4DAA4D;IAC5D,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;;OAKG;IACH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wB,CAAC,EAAE,MAAM,CAAA;CAClC;AAED;IACE,6CAA6C;IAC7C,cAAc,EAAE,aAAa,CAAA;CAC9B;AAID;;;GAGG;AACH,6BAA6B,KAAK,EAAE,cAAc,GAAG,eAAe,CAyEnE;ACxFD,YAAY,EAAC,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAC,MAAM,qBAAqB,CAAC","sources":["packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/textSelection.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/context.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/usePress.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/Pressable.tsx","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/PressResponder.tsx","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/utils.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/useFocus.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/useFocusVisible.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/useFocusWithin.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/useHover.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/useInteractOutside.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/createEventHandler.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/useKeyboard.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/useMove.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/useScrollWheel.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/useLongPress.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/index.ts","packages/@react-aria/interactions/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/*\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\nexport {Pressable} from './Pressable';\nexport {PressResponder, ClearPressResponder} from './PressResponder';\nexport {useFocus} from './useFocus';\nexport {\n isFocusVisible,\n getInteractionModality,\n setInteractionModality,\n addWindowFocusTracking,\n useInteractionModality,\n useFocusVisible,\n useFocusVisibleListener\n} from './useFocusVisible';\nexport {useFocusWithin} from './useFocusWithin';\nexport {useHover} from './useHover';\nexport {useInteractOutside} from './useInteractOutside';\nexport {useKeyboard} from './useKeyboard';\nexport {useMove} from './useMove';\nexport {usePress} from './usePress';\nexport {useScrollWheel} from './useScrollWheel';\nexport {useLongPress} from './useLongPress';\n\nexport type {FocusProps, FocusResult} from './useFocus';\nexport type {FocusVisibleHandler, FocusVisibleProps, FocusVisibleResult, Modality} from './useFocusVisible';\nexport type {FocusWithinProps, FocusWithinResult} from './useFocusWithin';\nexport type {HoverProps, HoverResult} from './useHover';\nexport type {InteractOutsideProps} from './useInteractOutside';\nexport type {KeyboardProps, KeyboardResult} from './useKeyboard';\nexport type {PressProps, PressHookProps, PressResult} from './usePress';\nexport type {PressEvent, PressEvents, MoveStartEvent, MoveMoveEvent, MoveEndEvent, MoveEvents, HoverEvent, HoverEvents, FocusEvents, KeyboardEvents} from '@react-types/shared';\nexport type {MoveResult} from './useMove';\nexport type {LongPressProps, LongPressResult} from './useLongPress';\nexport type {ScrollWheelProps} from './useScrollWheel';\n"],"names":[],"version":3,"file":"types.d.ts.map"}