@react-aria/utils 3.23.2 → 3.24.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 (171) hide show
  1. package/dist/chain.main.js +26 -0
  2. package/dist/chain.main.js.map +1 -0
  3. package/dist/chain.mjs +21 -0
  4. package/dist/chain.module.js +21 -0
  5. package/dist/chain.module.js.map +1 -0
  6. package/dist/domHelpers.main.js +19 -0
  7. package/dist/domHelpers.main.js.map +1 -0
  8. package/dist/domHelpers.mjs +13 -0
  9. package/dist/domHelpers.module.js +13 -0
  10. package/dist/domHelpers.module.js.map +1 -0
  11. package/dist/filterDOMProps.main.js +45 -0
  12. package/dist/filterDOMProps.main.js.map +1 -0
  13. package/dist/filterDOMProps.mjs +40 -0
  14. package/dist/filterDOMProps.module.js +40 -0
  15. package/dist/filterDOMProps.module.js.map +1 -0
  16. package/dist/focusWithoutScrolling.main.js +72 -0
  17. package/dist/focusWithoutScrolling.main.js.map +1 -0
  18. package/dist/focusWithoutScrolling.mjs +67 -0
  19. package/dist/focusWithoutScrolling.module.js +67 -0
  20. package/dist/focusWithoutScrolling.module.js.map +1 -0
  21. package/dist/getOffset.main.js +24 -0
  22. package/dist/getOffset.main.js.map +1 -0
  23. package/dist/getOffset.mjs +19 -0
  24. package/dist/getOffset.module.js +19 -0
  25. package/dist/getOffset.module.js.map +1 -0
  26. package/dist/getScrollParent.main.js +28 -0
  27. package/dist/getScrollParent.main.js.map +1 -0
  28. package/dist/getScrollParent.mjs +23 -0
  29. package/dist/getScrollParent.module.js +23 -0
  30. package/dist/getScrollParent.module.js.map +1 -0
  31. package/dist/getScrollParents.main.js +30 -0
  32. package/dist/getScrollParents.main.js.map +1 -0
  33. package/dist/getScrollParents.mjs +25 -0
  34. package/dist/getScrollParents.module.js +25 -0
  35. package/dist/getScrollParents.module.js.map +1 -0
  36. package/dist/import.mjs +32 -1232
  37. package/dist/isScrollable.main.js +25 -0
  38. package/dist/isScrollable.main.js.map +1 -0
  39. package/dist/isScrollable.mjs +20 -0
  40. package/dist/isScrollable.module.js +20 -0
  41. package/dist/isScrollable.module.js.map +1 -0
  42. package/dist/isVirtualEvent.main.js +41 -0
  43. package/dist/isVirtualEvent.main.js.map +1 -0
  44. package/dist/isVirtualEvent.mjs +35 -0
  45. package/dist/isVirtualEvent.module.js +35 -0
  46. package/dist/isVirtualEvent.module.js.map +1 -0
  47. package/dist/main.js +80 -1282
  48. package/dist/main.js.map +1 -1
  49. package/dist/mergeProps.main.js +51 -0
  50. package/dist/mergeProps.main.js.map +1 -0
  51. package/dist/mergeProps.mjs +42 -0
  52. package/dist/mergeProps.module.js +42 -0
  53. package/dist/mergeProps.module.js.map +1 -0
  54. package/dist/mergeRefs.main.js +28 -0
  55. package/dist/mergeRefs.main.js.map +1 -0
  56. package/dist/mergeRefs.mjs +23 -0
  57. package/dist/mergeRefs.module.js +23 -0
  58. package/dist/mergeRefs.module.js.map +1 -0
  59. package/dist/module.js +32 -1232
  60. package/dist/module.js.map +1 -1
  61. package/dist/openLink.main.js +143 -0
  62. package/dist/openLink.main.js.map +1 -0
  63. package/dist/openLink.mjs +129 -0
  64. package/dist/openLink.module.js +129 -0
  65. package/dist/openLink.module.js.map +1 -0
  66. package/dist/platform.main.js +64 -0
  67. package/dist/platform.main.js.map +1 -0
  68. package/dist/platform.mjs +51 -0
  69. package/dist/platform.module.js +51 -0
  70. package/dist/platform.module.js.map +1 -0
  71. package/dist/runAfterTransition.main.js +82 -0
  72. package/dist/runAfterTransition.main.js.map +1 -0
  73. package/dist/runAfterTransition.mjs +77 -0
  74. package/dist/runAfterTransition.module.js +77 -0
  75. package/dist/runAfterTransition.module.js.map +1 -0
  76. package/dist/scrollIntoView.main.js +96 -0
  77. package/dist/scrollIntoView.main.js.map +1 -0
  78. package/dist/scrollIntoView.mjs +90 -0
  79. package/dist/scrollIntoView.module.js +90 -0
  80. package/dist/scrollIntoView.module.js.map +1 -0
  81. package/dist/types.d.ts +17 -6
  82. package/dist/types.d.ts.map +1 -1
  83. package/dist/useDeepMemo.main.js +30 -0
  84. package/dist/useDeepMemo.main.js.map +1 -0
  85. package/dist/useDeepMemo.mjs +25 -0
  86. package/dist/useDeepMemo.module.js +25 -0
  87. package/dist/useDeepMemo.module.js.map +1 -0
  88. package/dist/useDescription.main.js +59 -0
  89. package/dist/useDescription.main.js.map +1 -0
  90. package/dist/useDescription.mjs +54 -0
  91. package/dist/useDescription.module.js +54 -0
  92. package/dist/useDescription.module.js.map +1 -0
  93. package/dist/useDrag1D.main.js +139 -0
  94. package/dist/useDrag1D.main.js.map +1 -0
  95. package/dist/useDrag1D.mjs +134 -0
  96. package/dist/useDrag1D.module.js +134 -0
  97. package/dist/useDrag1D.module.js.map +1 -0
  98. package/dist/useEffectEvent.main.js +37 -0
  99. package/dist/useEffectEvent.main.js.map +1 -0
  100. package/dist/useEffectEvent.mjs +32 -0
  101. package/dist/useEffectEvent.module.js +32 -0
  102. package/dist/useEffectEvent.module.js.map +1 -0
  103. package/dist/useEvent.main.js +42 -0
  104. package/dist/useEvent.main.js.map +1 -0
  105. package/dist/useEvent.mjs +37 -0
  106. package/dist/useEvent.module.js +37 -0
  107. package/dist/useEvent.module.js.map +1 -0
  108. package/dist/useFormReset.main.js +41 -0
  109. package/dist/useFormReset.main.js.map +1 -0
  110. package/dist/useFormReset.mjs +36 -0
  111. package/dist/useFormReset.module.js +36 -0
  112. package/dist/useFormReset.module.js.map +1 -0
  113. package/dist/useGlobalListeners.main.js +63 -0
  114. package/dist/useGlobalListeners.main.js.map +1 -0
  115. package/dist/useGlobalListeners.mjs +58 -0
  116. package/dist/useGlobalListeners.module.js +58 -0
  117. package/dist/useGlobalListeners.module.js.map +1 -0
  118. package/dist/useId.main.js +93 -0
  119. package/dist/useId.main.js.map +1 -0
  120. package/dist/useId.mjs +86 -0
  121. package/dist/useId.module.js +86 -0
  122. package/dist/useId.module.js.map +1 -0
  123. package/dist/useLabels.main.js +44 -0
  124. package/dist/useLabels.main.js.map +1 -0
  125. package/dist/useLabels.mjs +39 -0
  126. package/dist/useLabels.module.js +39 -0
  127. package/dist/useLabels.module.js.map +1 -0
  128. package/dist/useLayoutEffect.main.js +27 -0
  129. package/dist/useLayoutEffect.main.js.map +1 -0
  130. package/dist/useLayoutEffect.mjs +18 -0
  131. package/dist/useLayoutEffect.module.js +18 -0
  132. package/dist/useLayoutEffect.module.js.map +1 -0
  133. package/dist/useObjectRef.main.js +37 -0
  134. package/dist/useObjectRef.main.js.map +1 -0
  135. package/dist/useObjectRef.mjs +32 -0
  136. package/dist/useObjectRef.module.js +32 -0
  137. package/dist/useObjectRef.module.js.map +1 -0
  138. package/dist/useResizeObserver.main.js +40 -0
  139. package/dist/useResizeObserver.main.js.map +1 -0
  140. package/dist/useResizeObserver.mjs +35 -0
  141. package/dist/useResizeObserver.module.js +35 -0
  142. package/dist/useResizeObserver.module.js.map +1 -0
  143. package/dist/useSyncRef.main.js +32 -0
  144. package/dist/useSyncRef.main.js.map +1 -0
  145. package/dist/useSyncRef.mjs +27 -0
  146. package/dist/useSyncRef.module.js +27 -0
  147. package/dist/useSyncRef.module.js.map +1 -0
  148. package/dist/useUpdateEffect.main.js +38 -0
  149. package/dist/useUpdateEffect.main.js.map +1 -0
  150. package/dist/useUpdateEffect.mjs +33 -0
  151. package/dist/useUpdateEffect.module.js +33 -0
  152. package/dist/useUpdateEffect.module.js.map +1 -0
  153. package/dist/useValueEffect.main.js +58 -0
  154. package/dist/useValueEffect.main.js.map +1 -0
  155. package/dist/useValueEffect.mjs +53 -0
  156. package/dist/useValueEffect.module.js +53 -0
  157. package/dist/useValueEffect.module.js.map +1 -0
  158. package/dist/useViewportSize.main.js +56 -0
  159. package/dist/useViewportSize.main.js.map +1 -0
  160. package/dist/useViewportSize.mjs +51 -0
  161. package/dist/useViewportSize.module.js +51 -0
  162. package/dist/useViewportSize.module.js.map +1 -0
  163. package/package.json +5 -5
  164. package/src/filterDOMProps.ts +1 -0
  165. package/src/getScrollParent.ts +2 -10
  166. package/src/getScrollParents.ts +26 -0
  167. package/src/index.ts +4 -2
  168. package/src/isScrollable.ts +22 -0
  169. package/src/mergeRefs.ts +2 -2
  170. package/src/openLink.tsx +25 -9
  171. package/src/scrollIntoView.ts +3 -5
@@ -0,0 +1,25 @@
1
+
2
+ function $parcel$export(e, n, v, s) {
3
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
+ }
5
+
6
+ $parcel$export(module.exports, "isScrollable", () => $9a54e9cd5db23b5d$export$2bb74740c4e19def);
7
+ /*
8
+ * Copyright 2024 Adobe. All rights reserved.
9
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License. You may obtain a copy
11
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software distributed under
14
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
+ * OF ANY KIND, either express or implied. See the License for the specific language
16
+ * governing permissions and limitations under the License.
17
+ */ function $9a54e9cd5db23b5d$export$2bb74740c4e19def(node, checkForOverflow) {
18
+ let style = window.getComputedStyle(node);
19
+ let isScrollable = /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);
20
+ if (isScrollable && checkForOverflow) isScrollable = node.scrollHeight !== node.clientHeight || node.scrollWidth !== node.clientWidth;
21
+ return isScrollable;
22
+ }
23
+
24
+
25
+ //# sourceMappingURL=isScrollable.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAEM,SAAS,0CAAa,IAAa,EAAE,gBAA0B;IACpE,IAAI,QAAQ,OAAO,gBAAgB,CAAC;IACpC,IAAI,eAAe,gBAAgB,IAAI,CAAC,MAAM,QAAQ,GAAG,MAAM,SAAS,GAAG,MAAM,SAAS;IAE1F,IAAI,gBAAgB,kBAClB,eAAe,KAAK,YAAY,KAAK,KAAK,YAAY,IAAI,KAAK,WAAW,KAAK,KAAK,WAAW;IAGjG,OAAO;AACT","sources":["packages/@react-aria/utils/src/isScrollable.ts"],"sourcesContent":["/*\n * Copyright 2024 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 function isScrollable(node: Element, checkForOverflow?: boolean): boolean {\n let style = window.getComputedStyle(node);\n let isScrollable = /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);\n\n if (isScrollable && checkForOverflow) {\n isScrollable = node.scrollHeight !== node.clientHeight || node.scrollWidth !== node.clientWidth;\n }\n\n return isScrollable;\n}\n"],"names":[],"version":3,"file":"isScrollable.main.js.map"}
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Copyright 2024 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */ function $cc38e7bd3fc7b213$export$2bb74740c4e19def(node, checkForOverflow) {
12
+ let style = window.getComputedStyle(node);
13
+ let isScrollable = /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);
14
+ if (isScrollable && checkForOverflow) isScrollable = node.scrollHeight !== node.clientHeight || node.scrollWidth !== node.clientWidth;
15
+ return isScrollable;
16
+ }
17
+
18
+
19
+ export {$cc38e7bd3fc7b213$export$2bb74740c4e19def as isScrollable};
20
+ //# sourceMappingURL=isScrollable.mjs.map
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Copyright 2024 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */ function $cc38e7bd3fc7b213$export$2bb74740c4e19def(node, checkForOverflow) {
12
+ let style = window.getComputedStyle(node);
13
+ let isScrollable = /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);
14
+ if (isScrollable && checkForOverflow) isScrollable = node.scrollHeight !== node.clientHeight || node.scrollWidth !== node.clientWidth;
15
+ return isScrollable;
16
+ }
17
+
18
+
19
+ export {$cc38e7bd3fc7b213$export$2bb74740c4e19def as isScrollable};
20
+ //# sourceMappingURL=isScrollable.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"AAAA;;;;;;;;;;CAUC,GAEM,SAAS,0CAAa,IAAa,EAAE,gBAA0B;IACpE,IAAI,QAAQ,OAAO,gBAAgB,CAAC;IACpC,IAAI,eAAe,gBAAgB,IAAI,CAAC,MAAM,QAAQ,GAAG,MAAM,SAAS,GAAG,MAAM,SAAS;IAE1F,IAAI,gBAAgB,kBAClB,eAAe,KAAK,YAAY,KAAK,KAAK,YAAY,IAAI,KAAK,WAAW,KAAK,KAAK,WAAW;IAGjG,OAAO;AACT","sources":["packages/@react-aria/utils/src/isScrollable.ts"],"sourcesContent":["/*\n * Copyright 2024 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 function isScrollable(node: Element, checkForOverflow?: boolean): boolean {\n let style = window.getComputedStyle(node);\n let isScrollable = /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);\n\n if (isScrollable && checkForOverflow) {\n isScrollable = node.scrollHeight !== node.clientHeight || node.scrollWidth !== node.clientWidth;\n }\n\n return isScrollable;\n}\n"],"names":[],"version":3,"file":"isScrollable.module.js.map"}
@@ -0,0 +1,41 @@
1
+ var $9e20cff0af27e8cc$exports = require("./platform.main.js");
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, "isVirtualClick", () => $577e795361f19be9$export$60278871457622de);
9
+ $parcel$export(module.exports, "isVirtualPointerEvent", () => $577e795361f19be9$export$29bf1b5f2c56cf63);
10
+ /*
11
+ * Copyright 2022 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
+ function $577e795361f19be9$export$60278871457622de(event) {
22
+ // JAWS/NVDA with Firefox.
23
+ if (event.mozInputSource === 0 && event.isTrusted) return true;
24
+ // Android TalkBack's detail value varies depending on the event listener providing the event so we have specific logic here instead
25
+ // If pointerType is defined, event is from a click listener. For events from mousedown listener, detail === 0 is a sufficient check
26
+ // to detect TalkBack virtual clicks.
27
+ if ((0, $9e20cff0af27e8cc$exports.isAndroid)() && event.pointerType) return event.type === "click" && event.buttons === 1;
28
+ return event.detail === 0 && !event.pointerType;
29
+ }
30
+ function $577e795361f19be9$export$29bf1b5f2c56cf63(event) {
31
+ // If the pointer size is zero, then we assume it's from a screen reader.
32
+ // Android TalkBack double tap will sometimes return a event with width and height of 1
33
+ // and pointerType === 'mouse' so we need to check for a specific combination of event attributes.
34
+ // Cannot use "event.pressure === 0" as the sole check due to Safari pointer events always returning pressure === 0
35
+ // instead of .5, see https://bugs.webkit.org/show_bug.cgi?id=206216. event.pointerType === 'mouse' is to distingush
36
+ // Talkback double tap from Windows Firefox touch screen press
37
+ return !(0, $9e20cff0af27e8cc$exports.isAndroid)() && event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse";
38
+ }
39
+
40
+
41
+ //# sourceMappingURL=isVirtualEvent.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;AAeM,SAAS,0CAAe,KAAgC;IAC7D,0BAA0B;IAC1B,IAAI,AAAC,MAAc,cAAc,KAAK,KAAK,MAAM,SAAS,EACxD,OAAO;IAGT,oIAAoI;IACpI,oIAAoI;IACpI,qCAAqC;IACrC,IAAI,CAAA,GAAA,mCAAQ,OAAO,AAAC,MAAuB,WAAW,EACpD,OAAO,MAAM,IAAI,KAAK,WAAW,MAAM,OAAO,KAAK;IAGrD,OAAO,MAAM,MAAM,KAAK,KAAK,CAAC,AAAC,MAAuB,WAAW;AACnE;AAEO,SAAS,0CAAsB,KAAmB;IACvD,yEAAyE;IACzE,uFAAuF;IACvF,kGAAkG;IAClG,mHAAmH;IACnH,oHAAoH;IACpH,8DAA8D;IAC9D,OACE,AAAC,CAAC,CAAA,GAAA,mCAAQ,OAAO,MAAM,KAAK,KAAK,KAAK,MAAM,MAAM,KAAK,KACtD,MAAM,KAAK,KAAK,KACf,MAAM,MAAM,KAAK,KACjB,MAAM,QAAQ,KAAK,KACnB,MAAM,MAAM,KAAK,KACjB,MAAM,WAAW,KAAK;AAG5B","sources":["packages/@react-aria/utils/src/isVirtualEvent.ts"],"sourcesContent":["/*\n * Copyright 2022 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 {isAndroid} from './platform';\n\n// Original licensing for the following method can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/facebook/react/blob/3c713d513195a53788b3f8bb4b70279d68b15bcc/packages/react-interactions/events/src/dom/shared/index.js#L74-L87\n\n// Keyboards, Assistive Technologies, and element.click() all produce a \"virtual\"\n// click event. This is a method of inferring such clicks. Every browser except\n// IE 11 only sets a zero value of \"detail\" for click events that are \"virtual\".\n// However, IE 11 uses a zero value for all click events. For IE 11 we rely on\n// the quirk that it produces click events that are of type PointerEvent, and\n// where only the \"virtual\" click lacks a pointerType field.\n\nexport function isVirtualClick(event: MouseEvent | PointerEvent): boolean {\n // JAWS/NVDA with Firefox.\n if ((event as any).mozInputSource === 0 && event.isTrusted) {\n return true;\n }\n\n // Android TalkBack's detail value varies depending on the event listener providing the event so we have specific logic here instead\n // If pointerType is defined, event is from a click listener. For events from mousedown listener, detail === 0 is a sufficient check\n // to detect TalkBack virtual clicks.\n if (isAndroid() && (event as PointerEvent).pointerType) {\n return event.type === 'click' && event.buttons === 1;\n }\n\n return event.detail === 0 && !(event as PointerEvent).pointerType;\n}\n\nexport function isVirtualPointerEvent(event: PointerEvent) {\n // If the pointer size is zero, then we assume it's from a screen reader.\n // Android TalkBack double tap will sometimes return a event with width and height of 1\n // and pointerType === 'mouse' so we need to check for a specific combination of event attributes.\n // Cannot use \"event.pressure === 0\" as the sole check due to Safari pointer events always returning pressure === 0\n // instead of .5, see https://bugs.webkit.org/show_bug.cgi?id=206216. event.pointerType === 'mouse' is to distingush\n // Talkback double tap from Windows Firefox touch screen press\n return (\n (!isAndroid() && event.width === 0 && event.height === 0) ||\n (event.width === 1 &&\n event.height === 1 &&\n event.pressure === 0 &&\n event.detail === 0 &&\n event.pointerType === 'mouse'\n )\n );\n}\n"],"names":[],"version":3,"file":"isVirtualEvent.main.js.map"}
@@ -0,0 +1,35 @@
1
+ import {isAndroid as $c87311424ea30a05$export$a11b0059900ceec8} from "./platform.mjs";
2
+
3
+ /*
4
+ * Copyright 2022 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
+ function $6a7db85432448f7f$export$60278871457622de(event) {
15
+ // JAWS/NVDA with Firefox.
16
+ if (event.mozInputSource === 0 && event.isTrusted) return true;
17
+ // Android TalkBack's detail value varies depending on the event listener providing the event so we have specific logic here instead
18
+ // If pointerType is defined, event is from a click listener. For events from mousedown listener, detail === 0 is a sufficient check
19
+ // to detect TalkBack virtual clicks.
20
+ if ((0, $c87311424ea30a05$export$a11b0059900ceec8)() && event.pointerType) return event.type === "click" && event.buttons === 1;
21
+ return event.detail === 0 && !event.pointerType;
22
+ }
23
+ function $6a7db85432448f7f$export$29bf1b5f2c56cf63(event) {
24
+ // If the pointer size is zero, then we assume it's from a screen reader.
25
+ // Android TalkBack double tap will sometimes return a event with width and height of 1
26
+ // and pointerType === 'mouse' so we need to check for a specific combination of event attributes.
27
+ // Cannot use "event.pressure === 0" as the sole check due to Safari pointer events always returning pressure === 0
28
+ // instead of .5, see https://bugs.webkit.org/show_bug.cgi?id=206216. event.pointerType === 'mouse' is to distingush
29
+ // Talkback double tap from Windows Firefox touch screen press
30
+ return !(0, $c87311424ea30a05$export$a11b0059900ceec8)() && event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse";
31
+ }
32
+
33
+
34
+ export {$6a7db85432448f7f$export$60278871457622de as isVirtualClick, $6a7db85432448f7f$export$29bf1b5f2c56cf63 as isVirtualPointerEvent};
35
+ //# sourceMappingURL=isVirtualEvent.mjs.map
@@ -0,0 +1,35 @@
1
+ import {isAndroid as $c87311424ea30a05$export$a11b0059900ceec8} from "./platform.module.js";
2
+
3
+ /*
4
+ * Copyright 2022 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
+ function $6a7db85432448f7f$export$60278871457622de(event) {
15
+ // JAWS/NVDA with Firefox.
16
+ if (event.mozInputSource === 0 && event.isTrusted) return true;
17
+ // Android TalkBack's detail value varies depending on the event listener providing the event so we have specific logic here instead
18
+ // If pointerType is defined, event is from a click listener. For events from mousedown listener, detail === 0 is a sufficient check
19
+ // to detect TalkBack virtual clicks.
20
+ if ((0, $c87311424ea30a05$export$a11b0059900ceec8)() && event.pointerType) return event.type === "click" && event.buttons === 1;
21
+ return event.detail === 0 && !event.pointerType;
22
+ }
23
+ function $6a7db85432448f7f$export$29bf1b5f2c56cf63(event) {
24
+ // If the pointer size is zero, then we assume it's from a screen reader.
25
+ // Android TalkBack double tap will sometimes return a event with width and height of 1
26
+ // and pointerType === 'mouse' so we need to check for a specific combination of event attributes.
27
+ // Cannot use "event.pressure === 0" as the sole check due to Safari pointer events always returning pressure === 0
28
+ // instead of .5, see https://bugs.webkit.org/show_bug.cgi?id=206216. event.pointerType === 'mouse' is to distingush
29
+ // Talkback double tap from Windows Firefox touch screen press
30
+ return !(0, $c87311424ea30a05$export$a11b0059900ceec8)() && event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse";
31
+ }
32
+
33
+
34
+ export {$6a7db85432448f7f$export$60278871457622de as isVirtualClick, $6a7db85432448f7f$export$29bf1b5f2c56cf63 as isVirtualPointerEvent};
35
+ //# sourceMappingURL=isVirtualEvent.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;AAeM,SAAS,0CAAe,KAAgC;IAC7D,0BAA0B;IAC1B,IAAI,AAAC,MAAc,cAAc,KAAK,KAAK,MAAM,SAAS,EACxD,OAAO;IAGT,oIAAoI;IACpI,oIAAoI;IACpI,qCAAqC;IACrC,IAAI,CAAA,GAAA,yCAAQ,OAAO,AAAC,MAAuB,WAAW,EACpD,OAAO,MAAM,IAAI,KAAK,WAAW,MAAM,OAAO,KAAK;IAGrD,OAAO,MAAM,MAAM,KAAK,KAAK,CAAC,AAAC,MAAuB,WAAW;AACnE;AAEO,SAAS,0CAAsB,KAAmB;IACvD,yEAAyE;IACzE,uFAAuF;IACvF,kGAAkG;IAClG,mHAAmH;IACnH,oHAAoH;IACpH,8DAA8D;IAC9D,OACE,AAAC,CAAC,CAAA,GAAA,yCAAQ,OAAO,MAAM,KAAK,KAAK,KAAK,MAAM,MAAM,KAAK,KACtD,MAAM,KAAK,KAAK,KACf,MAAM,MAAM,KAAK,KACjB,MAAM,QAAQ,KAAK,KACnB,MAAM,MAAM,KAAK,KACjB,MAAM,WAAW,KAAK;AAG5B","sources":["packages/@react-aria/utils/src/isVirtualEvent.ts"],"sourcesContent":["/*\n * Copyright 2022 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 {isAndroid} from './platform';\n\n// Original licensing for the following method can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/facebook/react/blob/3c713d513195a53788b3f8bb4b70279d68b15bcc/packages/react-interactions/events/src/dom/shared/index.js#L74-L87\n\n// Keyboards, Assistive Technologies, and element.click() all produce a \"virtual\"\n// click event. This is a method of inferring such clicks. Every browser except\n// IE 11 only sets a zero value of \"detail\" for click events that are \"virtual\".\n// However, IE 11 uses a zero value for all click events. For IE 11 we rely on\n// the quirk that it produces click events that are of type PointerEvent, and\n// where only the \"virtual\" click lacks a pointerType field.\n\nexport function isVirtualClick(event: MouseEvent | PointerEvent): boolean {\n // JAWS/NVDA with Firefox.\n if ((event as any).mozInputSource === 0 && event.isTrusted) {\n return true;\n }\n\n // Android TalkBack's detail value varies depending on the event listener providing the event so we have specific logic here instead\n // If pointerType is defined, event is from a click listener. For events from mousedown listener, detail === 0 is a sufficient check\n // to detect TalkBack virtual clicks.\n if (isAndroid() && (event as PointerEvent).pointerType) {\n return event.type === 'click' && event.buttons === 1;\n }\n\n return event.detail === 0 && !(event as PointerEvent).pointerType;\n}\n\nexport function isVirtualPointerEvent(event: PointerEvent) {\n // If the pointer size is zero, then we assume it's from a screen reader.\n // Android TalkBack double tap will sometimes return a event with width and height of 1\n // and pointerType === 'mouse' so we need to check for a specific combination of event attributes.\n // Cannot use \"event.pressure === 0\" as the sole check due to Safari pointer events always returning pressure === 0\n // instead of .5, see https://bugs.webkit.org/show_bug.cgi?id=206216. event.pointerType === 'mouse' is to distingush\n // Talkback double tap from Windows Firefox touch screen press\n return (\n (!isAndroid() && event.width === 0 && event.height === 0) ||\n (event.width === 1 &&\n event.height === 1 &&\n event.pressure === 0 &&\n event.detail === 0 &&\n event.pointerType === 'mouse'\n )\n );\n}\n"],"names":[],"version":3,"file":"isVirtualEvent.module.js.map"}