@react-aria/interactions 3.27.1 → 3.28.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 (118) hide show
  1. package/dist/import.mjs +21 -15
  2. package/dist/main.js +45 -39
  3. package/dist/main.js.map +1 -1
  4. package/dist/module.js +21 -15
  5. package/dist/module.js.map +1 -1
  6. package/dist/types/src/index.d.ts +31 -0
  7. package/package.json +16 -15
  8. package/src/index.ts +30 -34
  9. package/dist/PressResponder.main.js +0 -61
  10. package/dist/PressResponder.main.js.map +0 -1
  11. package/dist/PressResponder.mjs +0 -51
  12. package/dist/PressResponder.module.js +0 -51
  13. package/dist/PressResponder.module.js.map +0 -1
  14. package/dist/Pressable.main.js +0 -69
  15. package/dist/Pressable.main.js.map +0 -1
  16. package/dist/Pressable.mjs +0 -60
  17. package/dist/Pressable.module.js +0 -60
  18. package/dist/Pressable.module.js.map +0 -1
  19. package/dist/context.main.js +0 -30
  20. package/dist/context.main.js.map +0 -1
  21. package/dist/context.mjs +0 -21
  22. package/dist/context.module.js +0 -21
  23. package/dist/context.module.js.map +0 -1
  24. package/dist/createEventHandler.main.js +0 -46
  25. package/dist/createEventHandler.main.js.map +0 -1
  26. package/dist/createEventHandler.mjs +0 -41
  27. package/dist/createEventHandler.module.js +0 -41
  28. package/dist/createEventHandler.module.js.map +0 -1
  29. package/dist/focusSafely.main.js +0 -41
  30. package/dist/focusSafely.main.js.map +0 -1
  31. package/dist/focusSafely.mjs +0 -36
  32. package/dist/focusSafely.module.js +0 -36
  33. package/dist/focusSafely.module.js.map +0 -1
  34. package/dist/textSelection.main.js +0 -77
  35. package/dist/textSelection.main.js.map +0 -1
  36. package/dist/textSelection.mjs +0 -71
  37. package/dist/textSelection.module.js +0 -71
  38. package/dist/textSelection.module.js.map +0 -1
  39. package/dist/types.d.ts +0 -255
  40. package/dist/types.d.ts.map +0 -1
  41. package/dist/useFocus.main.js +0 -66
  42. package/dist/useFocus.main.js.map +0 -1
  43. package/dist/useFocus.mjs +0 -61
  44. package/dist/useFocus.module.js +0 -61
  45. package/dist/useFocus.module.js.map +0 -1
  46. package/dist/useFocusVisible.main.js +0 -267
  47. package/dist/useFocusVisible.main.js.map +0 -1
  48. package/dist/useFocusVisible.mjs +0 -255
  49. package/dist/useFocusVisible.module.js +0 -255
  50. package/dist/useFocusVisible.module.js.map +0 -1
  51. package/dist/useFocusWithin.main.js +0 -107
  52. package/dist/useFocusWithin.main.js.map +0 -1
  53. package/dist/useFocusWithin.mjs +0 -102
  54. package/dist/useFocusWithin.module.js +0 -102
  55. package/dist/useFocusWithin.module.js.map +0 -1
  56. package/dist/useFocusable.main.js +0 -113
  57. package/dist/useFocusable.main.js.map +0 -1
  58. package/dist/useFocusable.mjs +0 -101
  59. package/dist/useFocusable.module.js +0 -101
  60. package/dist/useFocusable.module.js.map +0 -1
  61. package/dist/useHover.main.js +0 -159
  62. package/dist/useHover.main.js.map +0 -1
  63. package/dist/useHover.mjs +0 -154
  64. package/dist/useHover.module.js +0 -154
  65. package/dist/useHover.module.js.map +0 -1
  66. package/dist/useInteractOutside.main.js +0 -107
  67. package/dist/useInteractOutside.main.js.map +0 -1
  68. package/dist/useInteractOutside.mjs +0 -102
  69. package/dist/useInteractOutside.module.js +0 -102
  70. package/dist/useInteractOutside.module.js.map +0 -1
  71. package/dist/useKeyboard.main.js +0 -30
  72. package/dist/useKeyboard.main.js.map +0 -1
  73. package/dist/useKeyboard.mjs +0 -25
  74. package/dist/useKeyboard.module.js +0 -25
  75. package/dist/useKeyboard.module.js.map +0 -1
  76. package/dist/useLongPress.main.js +0 -86
  77. package/dist/useLongPress.main.js.map +0 -1
  78. package/dist/useLongPress.mjs +0 -81
  79. package/dist/useLongPress.module.js +0 -81
  80. package/dist/useLongPress.module.js.map +0 -1
  81. package/dist/useMove.main.js +0 -272
  82. package/dist/useMove.main.js.map +0 -1
  83. package/dist/useMove.mjs +0 -267
  84. package/dist/useMove.module.js +0 -267
  85. package/dist/useMove.module.js.map +0 -1
  86. package/dist/usePress.main.js +0 -763
  87. package/dist/usePress.main.js.map +0 -1
  88. package/dist/usePress.mjs +0 -758
  89. package/dist/usePress.module.js +0 -758
  90. package/dist/usePress.module.js.map +0 -1
  91. package/dist/useScrollWheel.main.js +0 -41
  92. package/dist/useScrollWheel.main.js.map +0 -1
  93. package/dist/useScrollWheel.mjs +0 -36
  94. package/dist/useScrollWheel.module.js +0 -36
  95. package/dist/useScrollWheel.module.js.map +0 -1
  96. package/dist/utils.main.js +0 -164
  97. package/dist/utils.main.js.map +0 -1
  98. package/dist/utils.mjs +0 -155
  99. package/dist/utils.module.js +0 -155
  100. package/dist/utils.module.js.map +0 -1
  101. package/src/PressResponder.tsx +0 -67
  102. package/src/Pressable.tsx +0 -97
  103. package/src/context.ts +0 -23
  104. package/src/createEventHandler.ts +0 -55
  105. package/src/focusSafely.ts +0 -49
  106. package/src/textSelection.ts +0 -101
  107. package/src/useFocus.ts +0 -88
  108. package/src/useFocusVisible.ts +0 -359
  109. package/src/useFocusWithin.ts +0 -134
  110. package/src/useFocusable.tsx +0 -191
  111. package/src/useHover.ts +0 -222
  112. package/src/useInteractOutside.ts +0 -143
  113. package/src/useKeyboard.ts +0 -36
  114. package/src/useLongPress.ts +0 -135
  115. package/src/useMove.ts +0 -259
  116. package/src/usePress.ts +0 -1095
  117. package/src/useScrollWheel.ts +0 -41
  118. package/src/utils.ts +0 -175
@@ -1 +0,0 @@
1
- {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAYM,MAAM,0DAEb,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,CAAC,YAAC,QAAQ,EAAE,GAAG,OAA2B,EAAE;IAC3D,IAAI,eAAe,CAAA,GAAA,aAAK,EAAE;IAC1B,IAAI,cAAc,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAoB;IACjD,IAAI,UAAe,CAAA,GAAA,iBAAS,EAAE,eAAe,CAAC,GAAG;QAC/C,GAAG,KAAK;QACR;YACE,aAAa,OAAO,GAAG;YACvB,IAAI,aACF,YAAY,QAAQ;QAExB;IACF;IAEA,QAAQ,GAAG,GAAG,CAAA,GAAA,mBAAW,EAAE,QAAO,wBAAA,kCAAA,YAAa,GAAG;IAClD,CAAA,GAAA,iBAAS,EAAE,aAAa,QAAQ,GAAG;IAEnC,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,CAAC,aAAa,OAAO,EAAE;YACzB,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAC3B,QAAQ,IAAI,CACV;YAIJ,aAAa,OAAO,GAAG,MAAM,iCAAiC;QAChE;IACF,GAAG,EAAE;IAEL,qBACE,gCAAC,CAAA,GAAA,yCAAoB,EAAE,QAAQ;QAAC,OAAO;OACpC;AAGP;AAEO,SAAS,0CAAoB,YAAC,QAAQ,EAAwB;IACnE,IAAI,UAAU,CAAA,GAAA,cAAM,EAAE,IAAO,CAAA;YAAC,UAAU,KAAO;QAAC,CAAA,GAAI,EAAE;IACtD,qBACE,gCAAC,CAAA,GAAA,yCAAoB,EAAE,QAAQ;QAAC,OAAO;OACpC;AAGP","sources":["packages/@react-aria/interactions/src/PressResponder.tsx"],"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 {FocusableElement} from '@react-types/shared';\nimport {mergeProps, useObjectRef, useSyncRef} from '@react-aria/utils';\nimport {PressProps} from './usePress';\nimport {PressResponderContext} from './context';\nimport React, {ForwardedRef, JSX, ReactNode, useContext, useEffect, useMemo, useRef} from 'react';\n\ninterface PressResponderProps extends PressProps {\n children: ReactNode\n}\n\nexport const PressResponder:\n React.ForwardRefExoticComponent<PressResponderProps & React.RefAttributes<FocusableElement>> =\nReact.forwardRef(({children, ...props}: PressResponderProps, ref: ForwardedRef<FocusableElement>) => {\n let isRegistered = useRef(false);\n let prevContext = useContext(PressResponderContext);\n let context: any = mergeProps(prevContext || {}, {\n ...props,\n register() {\n isRegistered.current = true;\n if (prevContext) {\n prevContext.register();\n }\n }\n });\n\n context.ref = useObjectRef(ref || prevContext?.ref);\n useSyncRef(prevContext, context.ref);\n\n useEffect(() => {\n if (!isRegistered.current) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'A PressResponder was rendered without a pressable child. ' +\n 'Either call the usePress hook, or wrap your DOM node with <Pressable> component.'\n );\n }\n isRegistered.current = true; // only warn once in strict mode.\n }\n }, []);\n\n return (\n <PressResponderContext.Provider value={context}>\n {children}\n </PressResponderContext.Provider>\n );\n});\n\nexport function ClearPressResponder({children}: {children: ReactNode}): JSX.Element {\n let context = useMemo(() => ({register: () => {}}), []);\n return (\n <PressResponderContext.Provider value={context}>\n {children}\n </PressResponderContext.Provider>\n );\n}\n"],"names":[],"version":3,"file":"PressResponder.module.js.map"}
@@ -1,69 +0,0 @@
1
- var $0294ea432cd92340$exports = require("./usePress.main.js");
2
- var $15f8fd80892557ff$exports = require("./useFocusable.main.js");
3
- var $ev4bP$reactariautils = require("@react-aria/utils");
4
- var $ev4bP$react = require("react");
5
-
6
-
7
- function $parcel$interopDefault(a) {
8
- return a && a.__esModule ? a.default : a;
9
- }
10
-
11
- function $parcel$export(e, n, v, s) {
12
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
13
- }
14
-
15
- $parcel$export(module.exports, "Pressable", () => $e1dbec26039c051d$export$27c701ed9e449e99);
16
- /*
17
- * Copyright 2020 Adobe. All rights reserved.
18
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
19
- * you may not use this file except in compliance with the License. You may obtain a copy
20
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
21
- *
22
- * Unless required by applicable law or agreed to in writing, software distributed under
23
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
24
- * OF ANY KIND, either express or implied. See the License for the specific language
25
- * governing permissions and limitations under the License.
26
- */
27
-
28
-
29
-
30
- const $e1dbec26039c051d$export$27c701ed9e449e99 = /*#__PURE__*/ (0, ($parcel$interopDefault($ev4bP$react))).forwardRef(({ children: children, ...props }, ref)=>{
31
- ref = (0, $ev4bP$reactariautils.useObjectRef)(ref);
32
- let { pressProps: pressProps } = (0, $0294ea432cd92340$exports.usePress)({
33
- ...props,
34
- ref: ref
35
- });
36
- let { focusableProps: focusableProps } = (0, $15f8fd80892557ff$exports.useFocusable)(props, ref);
37
- let child = (0, ($parcel$interopDefault($ev4bP$react))).Children.only(children);
38
- (0, $ev4bP$react.useEffect)(()=>{
39
- if (process.env.NODE_ENV === 'production') return;
40
- let el = ref.current;
41
- if (!el || !(el instanceof (0, $ev4bP$reactariautils.getOwnerWindow)(el).Element)) {
42
- console.error('<Pressable> child must forward its ref to a DOM element.');
43
- return;
44
- }
45
- if (!props.isDisabled && !(0, $ev4bP$reactariautils.isFocusable)(el)) {
46
- console.warn('<Pressable> child must be focusable. Please ensure the tabIndex prop is passed through.');
47
- return;
48
- }
49
- if (el.localName !== 'button' && el.localName !== 'input' && el.localName !== 'select' && el.localName !== 'textarea' && el.localName !== 'a' && el.localName !== 'area' && el.localName !== 'summary') {
50
- let role = el.getAttribute('role');
51
- if (!role) console.warn('<Pressable> child must have an interactive ARIA role.');
52
- else if (// https://w3c.github.io/aria/#widget_roles
53
- role !== 'application' && role !== 'button' && role !== 'checkbox' && role !== 'combobox' && role !== 'gridcell' && role !== 'link' && role !== 'menuitem' && role !== 'menuitemcheckbox' && role !== 'menuitemradio' && role !== 'option' && role !== 'radio' && role !== 'searchbox' && role !== 'separator' && role !== 'slider' && role !== 'spinbutton' && role !== 'switch' && role !== 'tab' && role !== 'textbox' && role !== 'treeitem') console.warn(`<Pressable> child must have an interactive ARIA role. Got "${role}".`);
54
- }
55
- }, [
56
- ref,
57
- props.isDisabled
58
- ]);
59
- // @ts-ignore
60
- let childRef = parseInt((0, ($parcel$interopDefault($ev4bP$react))).version, 10) < 19 ? child.ref : child.props.ref;
61
- return /*#__PURE__*/ (0, ($parcel$interopDefault($ev4bP$react))).cloneElement(child, {
62
- ...(0, $ev4bP$reactariautils.mergeProps)(pressProps, focusableProps, child.props),
63
- // @ts-ignore
64
- ref: (0, $ev4bP$reactariautils.mergeRefs)(childRef, ref)
65
- });
66
- });
67
-
68
-
69
- //# sourceMappingURL=Pressable.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAYM,MAAM,0DAEb,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,CAAC,YAAC,QAAQ,EAAE,GAAG,OAAsB,EAAE;IACtD,MAAM,CAAA,GAAA,kCAAW,EAAE;IACnB,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,kCAAO,EAAE;QAAC,GAAG,KAAK;aAAE;IAAG;IAC1C,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,sCAAW,EAAE,OAAO;IAC3C,IAAI,QAAQ,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IAEhC,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAC3B;QAGF,IAAI,KAAK,IAAI,OAAO;QACpB,IAAI,CAAC,MAAM,CAAE,CAAA,cAAc,CAAA,GAAA,oCAAa,EAAE,IAAI,OAAO,AAAD,GAAI;YACtD,QAAQ,KAAK,CAAC;YACd;QACF;QAEA,IAAI,CAAC,MAAM,UAAU,IAAI,CAAC,CAAA,GAAA,iCAAU,EAAE,KAAK;YACzC,QAAQ,IAAI,CAAC;YACb;QACF;QAEA,IACE,GAAG,SAAS,KAAK,YACjB,GAAG,SAAS,KAAK,WACjB,GAAG,SAAS,KAAK,YACjB,GAAG,SAAS,KAAK,cACjB,GAAG,SAAS,KAAK,OACjB,GAAG,SAAS,KAAK,UACjB,GAAG,SAAS,KAAK,WACjB;YACA,IAAI,OAAO,GAAG,YAAY,CAAC;YAC3B,IAAI,CAAC,MACH,QAAQ,IAAI,CAAC;iBACR,IACL,2CAA2C;YAC3C,SAAS,iBACT,SAAS,YACT,SAAS,cACT,SAAS,cACT,SAAS,cACT,SAAS,UACT,SAAS,cACT,SAAS,sBACT,SAAS,mBACT,SAAS,YACT,SAAS,WACT,SAAS,eACT,SAAS,eACT,SAAS,YACT,SAAS,gBACT,SAAS,YACT,SAAS,SACT,SAAS,aACT,SAAS,YAET,QAAQ,IAAI,CAAC,CAAC,2DAA2D,EAAE,KAAK,EAAE,CAAC;QAEvF;IACF,GAAG;QAAC;QAAK,MAAM,UAAU;KAAC;IAE1B,aAAa;IACb,IAAI,WAAW,SAAS,CAAA,GAAA,sCAAI,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG;IAE7E,qBAAO,CAAA,GAAA,sCAAI,EAAE,YAAY,CACvB,OACA;QACE,GAAG,CAAA,GAAA,gCAAS,EAAE,YAAY,gBAAgB,MAAM,KAAK,CAAC;QACtD,aAAa;QACb,KAAK,CAAA,GAAA,+BAAQ,EAAE,UAAU;IAC3B;AAEJ","sources":["packages/@react-aria/interactions/src/Pressable.tsx"],"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, FocusableElement} from '@react-types/shared';\nimport {getOwnerWindow, isFocusable, mergeProps, mergeRefs, useObjectRef} from '@react-aria/utils';\nimport {PressProps, usePress} from './usePress';\nimport React, {ForwardedRef, ReactElement, useEffect} from 'react';\nimport {useFocusable} from './useFocusable';\n\ninterface PressableProps extends PressProps {\n children: ReactElement<DOMAttributes, string>\n}\n\nexport const Pressable:\n React.ForwardRefExoticComponent<PressableProps & React.RefAttributes<FocusableElement>> =\nReact.forwardRef(({children, ...props}: PressableProps, ref: ForwardedRef<FocusableElement>) => {\n ref = useObjectRef(ref);\n let {pressProps} = usePress({...props, ref});\n let {focusableProps} = useFocusable(props, ref);\n let child = React.Children.only(children);\n\n useEffect(() => {\n if (process.env.NODE_ENV === 'production') {\n return;\n }\n\n let el = ref.current;\n if (!el || !(el instanceof getOwnerWindow(el).Element)) {\n console.error('<Pressable> child must forward its ref to a DOM element.');\n return;\n }\n\n if (!props.isDisabled && !isFocusable(el)) {\n console.warn('<Pressable> child must be focusable. Please ensure the tabIndex prop is passed through.');\n return;\n }\n\n if (\n el.localName !== 'button' &&\n el.localName !== 'input' &&\n el.localName !== 'select' &&\n el.localName !== 'textarea' &&\n el.localName !== 'a' &&\n el.localName !== 'area' &&\n el.localName !== 'summary'\n ) {\n let role = el.getAttribute('role');\n if (!role) {\n console.warn('<Pressable> child must have an interactive ARIA role.');\n } else if (\n // https://w3c.github.io/aria/#widget_roles\n role !== 'application' &&\n role !== 'button' &&\n role !== 'checkbox' &&\n role !== 'combobox' &&\n role !== 'gridcell' &&\n role !== 'link' &&\n role !== 'menuitem' &&\n role !== 'menuitemcheckbox' &&\n role !== 'menuitemradio' &&\n role !== 'option' &&\n role !== 'radio' &&\n role !== 'searchbox' &&\n role !== 'separator' &&\n role !== 'slider' &&\n role !== 'spinbutton' &&\n role !== 'switch' &&\n role !== 'tab' &&\n role !== 'textbox' &&\n role !== 'treeitem'\n ) {\n console.warn(`<Pressable> child must have an interactive ARIA role. Got \"${role}\".`);\n }\n }\n }, [ref, props.isDisabled]);\n\n // @ts-ignore\n let childRef = parseInt(React.version, 10) < 19 ? child.ref : child.props.ref;\n\n return React.cloneElement(\n child,\n {\n ...mergeProps(pressProps, focusableProps, child.props),\n // @ts-ignore\n ref: mergeRefs(childRef, ref)\n }\n );\n});\n"],"names":[],"version":3,"file":"Pressable.main.js.map"}
@@ -1,60 +0,0 @@
1
- import {usePress as $f6c31cce2adf654f$export$45712eceda6fad21} from "./usePress.mjs";
2
- import {useFocusable as $f645667febf57a63$export$4c014de7c8940b4c} from "./useFocusable.mjs";
3
- import {useObjectRef as $hhDyF$useObjectRef, getOwnerWindow as $hhDyF$getOwnerWindow, isFocusable as $hhDyF$isFocusable, mergeProps as $hhDyF$mergeProps, mergeRefs as $hhDyF$mergeRefs} from "@react-aria/utils";
4
- import $hhDyF$react, {useEffect as $hhDyF$useEffect} from "react";
5
-
6
- /*
7
- * Copyright 2020 Adobe. All rights reserved.
8
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
9
- * you may not use this file except in compliance with the License. You may obtain a copy
10
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software distributed under
13
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14
- * OF ANY KIND, either express or implied. See the License for the specific language
15
- * governing permissions and limitations under the License.
16
- */
17
-
18
-
19
-
20
- const $3b117e43dc0ca95d$export$27c701ed9e449e99 = /*#__PURE__*/ (0, $hhDyF$react).forwardRef(({ children: children, ...props }, ref)=>{
21
- ref = (0, $hhDyF$useObjectRef)(ref);
22
- let { pressProps: pressProps } = (0, $f6c31cce2adf654f$export$45712eceda6fad21)({
23
- ...props,
24
- ref: ref
25
- });
26
- let { focusableProps: focusableProps } = (0, $f645667febf57a63$export$4c014de7c8940b4c)(props, ref);
27
- let child = (0, $hhDyF$react).Children.only(children);
28
- (0, $hhDyF$useEffect)(()=>{
29
- if (process.env.NODE_ENV === 'production') return;
30
- let el = ref.current;
31
- if (!el || !(el instanceof (0, $hhDyF$getOwnerWindow)(el).Element)) {
32
- console.error('<Pressable> child must forward its ref to a DOM element.');
33
- return;
34
- }
35
- if (!props.isDisabled && !(0, $hhDyF$isFocusable)(el)) {
36
- console.warn('<Pressable> child must be focusable. Please ensure the tabIndex prop is passed through.');
37
- return;
38
- }
39
- if (el.localName !== 'button' && el.localName !== 'input' && el.localName !== 'select' && el.localName !== 'textarea' && el.localName !== 'a' && el.localName !== 'area' && el.localName !== 'summary') {
40
- let role = el.getAttribute('role');
41
- if (!role) console.warn('<Pressable> child must have an interactive ARIA role.');
42
- else if (// https://w3c.github.io/aria/#widget_roles
43
- role !== 'application' && role !== 'button' && role !== 'checkbox' && role !== 'combobox' && role !== 'gridcell' && role !== 'link' && role !== 'menuitem' && role !== 'menuitemcheckbox' && role !== 'menuitemradio' && role !== 'option' && role !== 'radio' && role !== 'searchbox' && role !== 'separator' && role !== 'slider' && role !== 'spinbutton' && role !== 'switch' && role !== 'tab' && role !== 'textbox' && role !== 'treeitem') console.warn(`<Pressable> child must have an interactive ARIA role. Got "${role}".`);
44
- }
45
- }, [
46
- ref,
47
- props.isDisabled
48
- ]);
49
- // @ts-ignore
50
- let childRef = parseInt((0, $hhDyF$react).version, 10) < 19 ? child.ref : child.props.ref;
51
- return /*#__PURE__*/ (0, $hhDyF$react).cloneElement(child, {
52
- ...(0, $hhDyF$mergeProps)(pressProps, focusableProps, child.props),
53
- // @ts-ignore
54
- ref: (0, $hhDyF$mergeRefs)(childRef, ref)
55
- });
56
- });
57
-
58
-
59
- export {$3b117e43dc0ca95d$export$27c701ed9e449e99 as Pressable};
60
- //# sourceMappingURL=Pressable.module.js.map
@@ -1,60 +0,0 @@
1
- import {usePress as $f6c31cce2adf654f$export$45712eceda6fad21} from "./usePress.module.js";
2
- import {useFocusable as $f645667febf57a63$export$4c014de7c8940b4c} from "./useFocusable.module.js";
3
- import {useObjectRef as $hhDyF$useObjectRef, getOwnerWindow as $hhDyF$getOwnerWindow, isFocusable as $hhDyF$isFocusable, mergeProps as $hhDyF$mergeProps, mergeRefs as $hhDyF$mergeRefs} from "@react-aria/utils";
4
- import $hhDyF$react, {useEffect as $hhDyF$useEffect} from "react";
5
-
6
- /*
7
- * Copyright 2020 Adobe. All rights reserved.
8
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
9
- * you may not use this file except in compliance with the License. You may obtain a copy
10
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software distributed under
13
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14
- * OF ANY KIND, either express or implied. See the License for the specific language
15
- * governing permissions and limitations under the License.
16
- */
17
-
18
-
19
-
20
- const $3b117e43dc0ca95d$export$27c701ed9e449e99 = /*#__PURE__*/ (0, $hhDyF$react).forwardRef(({ children: children, ...props }, ref)=>{
21
- ref = (0, $hhDyF$useObjectRef)(ref);
22
- let { pressProps: pressProps } = (0, $f6c31cce2adf654f$export$45712eceda6fad21)({
23
- ...props,
24
- ref: ref
25
- });
26
- let { focusableProps: focusableProps } = (0, $f645667febf57a63$export$4c014de7c8940b4c)(props, ref);
27
- let child = (0, $hhDyF$react).Children.only(children);
28
- (0, $hhDyF$useEffect)(()=>{
29
- if (process.env.NODE_ENV === 'production') return;
30
- let el = ref.current;
31
- if (!el || !(el instanceof (0, $hhDyF$getOwnerWindow)(el).Element)) {
32
- console.error('<Pressable> child must forward its ref to a DOM element.');
33
- return;
34
- }
35
- if (!props.isDisabled && !(0, $hhDyF$isFocusable)(el)) {
36
- console.warn('<Pressable> child must be focusable. Please ensure the tabIndex prop is passed through.');
37
- return;
38
- }
39
- if (el.localName !== 'button' && el.localName !== 'input' && el.localName !== 'select' && el.localName !== 'textarea' && el.localName !== 'a' && el.localName !== 'area' && el.localName !== 'summary') {
40
- let role = el.getAttribute('role');
41
- if (!role) console.warn('<Pressable> child must have an interactive ARIA role.');
42
- else if (// https://w3c.github.io/aria/#widget_roles
43
- role !== 'application' && role !== 'button' && role !== 'checkbox' && role !== 'combobox' && role !== 'gridcell' && role !== 'link' && role !== 'menuitem' && role !== 'menuitemcheckbox' && role !== 'menuitemradio' && role !== 'option' && role !== 'radio' && role !== 'searchbox' && role !== 'separator' && role !== 'slider' && role !== 'spinbutton' && role !== 'switch' && role !== 'tab' && role !== 'textbox' && role !== 'treeitem') console.warn(`<Pressable> child must have an interactive ARIA role. Got "${role}".`);
44
- }
45
- }, [
46
- ref,
47
- props.isDisabled
48
- ]);
49
- // @ts-ignore
50
- let childRef = parseInt((0, $hhDyF$react).version, 10) < 19 ? child.ref : child.props.ref;
51
- return /*#__PURE__*/ (0, $hhDyF$react).cloneElement(child, {
52
- ...(0, $hhDyF$mergeProps)(pressProps, focusableProps, child.props),
53
- // @ts-ignore
54
- ref: (0, $hhDyF$mergeRefs)(childRef, ref)
55
- });
56
- });
57
-
58
-
59
- export {$3b117e43dc0ca95d$export$27c701ed9e449e99 as Pressable};
60
- //# sourceMappingURL=Pressable.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AAYM,MAAM,0DAEb,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,CAAC,YAAC,QAAQ,EAAE,GAAG,OAAsB,EAAE;IACtD,MAAM,CAAA,GAAA,mBAAW,EAAE;IACnB,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,yCAAO,EAAE;QAAC,GAAG,KAAK;aAAE;IAAG;IAC1C,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,yCAAW,EAAE,OAAO;IAC3C,IAAI,QAAQ,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IAEhC,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAC3B;QAGF,IAAI,KAAK,IAAI,OAAO;QACpB,IAAI,CAAC,MAAM,CAAE,CAAA,cAAc,CAAA,GAAA,qBAAa,EAAE,IAAI,OAAO,AAAD,GAAI;YACtD,QAAQ,KAAK,CAAC;YACd;QACF;QAEA,IAAI,CAAC,MAAM,UAAU,IAAI,CAAC,CAAA,GAAA,kBAAU,EAAE,KAAK;YACzC,QAAQ,IAAI,CAAC;YACb;QACF;QAEA,IACE,GAAG,SAAS,KAAK,YACjB,GAAG,SAAS,KAAK,WACjB,GAAG,SAAS,KAAK,YACjB,GAAG,SAAS,KAAK,cACjB,GAAG,SAAS,KAAK,OACjB,GAAG,SAAS,KAAK,UACjB,GAAG,SAAS,KAAK,WACjB;YACA,IAAI,OAAO,GAAG,YAAY,CAAC;YAC3B,IAAI,CAAC,MACH,QAAQ,IAAI,CAAC;iBACR,IACL,2CAA2C;YAC3C,SAAS,iBACT,SAAS,YACT,SAAS,cACT,SAAS,cACT,SAAS,cACT,SAAS,UACT,SAAS,cACT,SAAS,sBACT,SAAS,mBACT,SAAS,YACT,SAAS,WACT,SAAS,eACT,SAAS,eACT,SAAS,YACT,SAAS,gBACT,SAAS,YACT,SAAS,SACT,SAAS,aACT,SAAS,YAET,QAAQ,IAAI,CAAC,CAAC,2DAA2D,EAAE,KAAK,EAAE,CAAC;QAEvF;IACF,GAAG;QAAC;QAAK,MAAM,UAAU;KAAC;IAE1B,aAAa;IACb,IAAI,WAAW,SAAS,CAAA,GAAA,YAAI,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG;IAE7E,qBAAO,CAAA,GAAA,YAAI,EAAE,YAAY,CACvB,OACA;QACE,GAAG,CAAA,GAAA,iBAAS,EAAE,YAAY,gBAAgB,MAAM,KAAK,CAAC;QACtD,aAAa;QACb,KAAK,CAAA,GAAA,gBAAQ,EAAE,UAAU;IAC3B;AAEJ","sources":["packages/@react-aria/interactions/src/Pressable.tsx"],"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, FocusableElement} from '@react-types/shared';\nimport {getOwnerWindow, isFocusable, mergeProps, mergeRefs, useObjectRef} from '@react-aria/utils';\nimport {PressProps, usePress} from './usePress';\nimport React, {ForwardedRef, ReactElement, useEffect} from 'react';\nimport {useFocusable} from './useFocusable';\n\ninterface PressableProps extends PressProps {\n children: ReactElement<DOMAttributes, string>\n}\n\nexport const Pressable:\n React.ForwardRefExoticComponent<PressableProps & React.RefAttributes<FocusableElement>> =\nReact.forwardRef(({children, ...props}: PressableProps, ref: ForwardedRef<FocusableElement>) => {\n ref = useObjectRef(ref);\n let {pressProps} = usePress({...props, ref});\n let {focusableProps} = useFocusable(props, ref);\n let child = React.Children.only(children);\n\n useEffect(() => {\n if (process.env.NODE_ENV === 'production') {\n return;\n }\n\n let el = ref.current;\n if (!el || !(el instanceof getOwnerWindow(el).Element)) {\n console.error('<Pressable> child must forward its ref to a DOM element.');\n return;\n }\n\n if (!props.isDisabled && !isFocusable(el)) {\n console.warn('<Pressable> child must be focusable. Please ensure the tabIndex prop is passed through.');\n return;\n }\n\n if (\n el.localName !== 'button' &&\n el.localName !== 'input' &&\n el.localName !== 'select' &&\n el.localName !== 'textarea' &&\n el.localName !== 'a' &&\n el.localName !== 'area' &&\n el.localName !== 'summary'\n ) {\n let role = el.getAttribute('role');\n if (!role) {\n console.warn('<Pressable> child must have an interactive ARIA role.');\n } else if (\n // https://w3c.github.io/aria/#widget_roles\n role !== 'application' &&\n role !== 'button' &&\n role !== 'checkbox' &&\n role !== 'combobox' &&\n role !== 'gridcell' &&\n role !== 'link' &&\n role !== 'menuitem' &&\n role !== 'menuitemcheckbox' &&\n role !== 'menuitemradio' &&\n role !== 'option' &&\n role !== 'radio' &&\n role !== 'searchbox' &&\n role !== 'separator' &&\n role !== 'slider' &&\n role !== 'spinbutton' &&\n role !== 'switch' &&\n role !== 'tab' &&\n role !== 'textbox' &&\n role !== 'treeitem'\n ) {\n console.warn(`<Pressable> child must have an interactive ARIA role. Got \"${role}\".`);\n }\n }\n }, [ref, props.isDisabled]);\n\n // @ts-ignore\n let childRef = parseInt(React.version, 10) < 19 ? child.ref : child.props.ref;\n\n return React.cloneElement(\n child,\n {\n ...mergeProps(pressProps, focusableProps, child.props),\n // @ts-ignore\n ref: mergeRefs(childRef, ref)\n }\n );\n});\n"],"names":[],"version":3,"file":"Pressable.module.js.map"}
@@ -1,30 +0,0 @@
1
- var $bNpOp$react = require("react");
2
-
3
-
4
- function $parcel$interopDefault(a) {
5
- return a && a.__esModule ? a.default : a;
6
- }
7
-
8
- function $parcel$export(e, n, v, s) {
9
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
10
- }
11
-
12
- $parcel$export(module.exports, "PressResponderContext", () => $01d3f539e91688c8$export$5165eccb35aaadb5);
13
- /*
14
- * Copyright 2020 Adobe. All rights reserved.
15
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
16
- * you may not use this file except in compliance with the License. You may obtain a copy
17
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
18
- *
19
- * Unless required by applicable law or agreed to in writing, software distributed under
20
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
21
- * OF ANY KIND, either express or implied. See the License for the specific language
22
- * governing permissions and limitations under the License.
23
- */
24
- const $01d3f539e91688c8$export$5165eccb35aaadb5 = (0, ($parcel$interopDefault($bNpOp$react))).createContext({
25
- register: ()=>{}
26
- });
27
- $01d3f539e91688c8$export$5165eccb35aaadb5.displayName = 'PressResponderContext';
28
-
29
-
30
- //# sourceMappingURL=context.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAWM,MAAM,4CAA+D,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAyB;IAAC,UAAU,KAAO;AAAC;AAC3I,0CAAsB,WAAW,GAAG","sources":["packages/@react-aria/interactions/src/context.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 {FocusableElement} from '@react-types/shared';\nimport {PressProps} from './usePress';\nimport React, {MutableRefObject} from 'react';\n\ninterface IPressResponderContext extends PressProps {\n register(): void,\n ref?: MutableRefObject<FocusableElement>\n}\n\nexport const PressResponderContext: React.Context<IPressResponderContext> = React.createContext<IPressResponderContext>({register: () => {}});\nPressResponderContext.displayName = 'PressResponderContext';\n"],"names":[],"version":3,"file":"context.main.js.map"}
package/dist/context.mjs DELETED
@@ -1,21 +0,0 @@
1
- import $3aeG1$react from "react";
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
- const $ae1eeba8b9eafd08$export$5165eccb35aaadb5 = (0, $3aeG1$react).createContext({
15
- register: ()=>{}
16
- });
17
- $ae1eeba8b9eafd08$export$5165eccb35aaadb5.displayName = 'PressResponderContext';
18
-
19
-
20
- export {$ae1eeba8b9eafd08$export$5165eccb35aaadb5 as PressResponderContext};
21
- //# sourceMappingURL=context.module.js.map
@@ -1,21 +0,0 @@
1
- import $3aeG1$react from "react";
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
- const $ae1eeba8b9eafd08$export$5165eccb35aaadb5 = (0, $3aeG1$react).createContext({
15
- register: ()=>{}
16
- });
17
- $ae1eeba8b9eafd08$export$5165eccb35aaadb5.displayName = 'PressResponderContext';
18
-
19
-
20
- export {$ae1eeba8b9eafd08$export$5165eccb35aaadb5 as PressResponderContext};
21
- //# sourceMappingURL=context.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;AAAA;;;;;;;;;;CAUC;AAWM,MAAM,4CAA+D,CAAA,GAAA,YAAI,EAAE,aAAa,CAAyB;IAAC,UAAU,KAAO;AAAC;AAC3I,0CAAsB,WAAW,GAAG","sources":["packages/@react-aria/interactions/src/context.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 {FocusableElement} from '@react-types/shared';\nimport {PressProps} from './usePress';\nimport React, {MutableRefObject} from 'react';\n\ninterface IPressResponderContext extends PressProps {\n register(): void,\n ref?: MutableRefObject<FocusableElement>\n}\n\nexport const PressResponderContext: React.Context<IPressResponderContext> = React.createContext<IPressResponderContext>({register: () => {}});\nPressResponderContext.displayName = 'PressResponderContext';\n"],"names":[],"version":3,"file":"context.module.js.map"}
@@ -1,46 +0,0 @@
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, "createEventHandler", () => $951fbcbbca8db6ce$export$48d1ea6320830260);
7
- /*
8
- * Copyright 2020 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 $951fbcbbca8db6ce$export$48d1ea6320830260(handler) {
18
- if (!handler) return undefined;
19
- let shouldStopPropagation = true;
20
- return (e)=>{
21
- let event = {
22
- ...e,
23
- preventDefault () {
24
- e.preventDefault();
25
- },
26
- isDefaultPrevented () {
27
- return e.isDefaultPrevented();
28
- },
29
- stopPropagation () {
30
- if (shouldStopPropagation && process.env.NODE_ENV !== 'production') console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');
31
- else shouldStopPropagation = true;
32
- },
33
- continuePropagation () {
34
- shouldStopPropagation = false;
35
- },
36
- isPropagationStopped () {
37
- return shouldStopPropagation;
38
- }
39
- };
40
- handler(event);
41
- if (shouldStopPropagation) e.stopPropagation();
42
- };
43
- }
44
-
45
-
46
- //# sourceMappingURL=createEventHandler.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAQM,SAAS,0CAA6C,OAAmC;IAC9F,IAAI,CAAC,SACH,OAAO;IAGT,IAAI,wBAAwB;IAC5B,OAAO,CAAC;QACN,IAAI,QAAsB;YACxB,GAAG,CAAC;YACJ;gBACE,EAAE,cAAc;YAClB;YACA;gBACE,OAAO,EAAE,kBAAkB;YAC7B;YACA;gBACE,IAAI,yBAAyB,QAAQ,GAAG,CAAC,QAAQ,KAAK,cACpD,QAAQ,KAAK,CAAC;qBAEd,wBAAwB;YAE5B;YACA;gBACE,wBAAwB;YAC1B;YACA;gBACE,OAAO;YACT;QACF;QAEA,QAAQ;QAER,IAAI,uBACF,EAAE,eAAe;IAErB;AACF","sources":["packages/@react-aria/interactions/src/createEventHandler.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 {BaseEvent} from '@react-types/shared';\nimport {SyntheticEvent} from 'react';\n\n/**\n * This function wraps a React event handler to make stopPropagation the default, and support continuePropagation instead.\n */\nexport function createEventHandler<T extends SyntheticEvent>(handler?: (e: BaseEvent<T>) => void): ((e: T) => void) | undefined {\n if (!handler) {\n return undefined;\n }\n\n let shouldStopPropagation = true;\n return (e: T) => {\n let event: BaseEvent<T> = {\n ...e,\n preventDefault() {\n e.preventDefault();\n },\n isDefaultPrevented() {\n return e.isDefaultPrevented();\n },\n stopPropagation() {\n if (shouldStopPropagation && process.env.NODE_ENV !== 'production') {\n console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');\n } else {\n shouldStopPropagation = true;\n }\n },\n continuePropagation() {\n shouldStopPropagation = false;\n },\n isPropagationStopped() {\n return shouldStopPropagation;\n }\n };\n\n handler(event);\n\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n };\n}\n"],"names":[],"version":3,"file":"createEventHandler.main.js.map"}
@@ -1,41 +0,0 @@
1
- /*
2
- * Copyright 2020 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 $93925083ecbb358c$export$48d1ea6320830260(handler) {
12
- if (!handler) return undefined;
13
- let shouldStopPropagation = true;
14
- return (e)=>{
15
- let event = {
16
- ...e,
17
- preventDefault () {
18
- e.preventDefault();
19
- },
20
- isDefaultPrevented () {
21
- return e.isDefaultPrevented();
22
- },
23
- stopPropagation () {
24
- if (shouldStopPropagation && process.env.NODE_ENV !== 'production') console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');
25
- else shouldStopPropagation = true;
26
- },
27
- continuePropagation () {
28
- shouldStopPropagation = false;
29
- },
30
- isPropagationStopped () {
31
- return shouldStopPropagation;
32
- }
33
- };
34
- handler(event);
35
- if (shouldStopPropagation) e.stopPropagation();
36
- };
37
- }
38
-
39
-
40
- export {$93925083ecbb358c$export$48d1ea6320830260 as createEventHandler};
41
- //# sourceMappingURL=createEventHandler.module.js.map
@@ -1,41 +0,0 @@
1
- /*
2
- * Copyright 2020 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 $93925083ecbb358c$export$48d1ea6320830260(handler) {
12
- if (!handler) return undefined;
13
- let shouldStopPropagation = true;
14
- return (e)=>{
15
- let event = {
16
- ...e,
17
- preventDefault () {
18
- e.preventDefault();
19
- },
20
- isDefaultPrevented () {
21
- return e.isDefaultPrevented();
22
- },
23
- stopPropagation () {
24
- if (shouldStopPropagation && process.env.NODE_ENV !== 'production') console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');
25
- else shouldStopPropagation = true;
26
- },
27
- continuePropagation () {
28
- shouldStopPropagation = false;
29
- },
30
- isPropagationStopped () {
31
- return shouldStopPropagation;
32
- }
33
- };
34
- handler(event);
35
- if (shouldStopPropagation) e.stopPropagation();
36
- };
37
- }
38
-
39
-
40
- export {$93925083ecbb358c$export$48d1ea6320830260 as createEventHandler};
41
- //# sourceMappingURL=createEventHandler.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":"AAAA;;;;;;;;;;CAUC,GAQM,SAAS,0CAA6C,OAAmC;IAC9F,IAAI,CAAC,SACH,OAAO;IAGT,IAAI,wBAAwB;IAC5B,OAAO,CAAC;QACN,IAAI,QAAsB;YACxB,GAAG,CAAC;YACJ;gBACE,EAAE,cAAc;YAClB;YACA;gBACE,OAAO,EAAE,kBAAkB;YAC7B;YACA;gBACE,IAAI,yBAAyB,QAAQ,GAAG,CAAC,QAAQ,KAAK,cACpD,QAAQ,KAAK,CAAC;qBAEd,wBAAwB;YAE5B;YACA;gBACE,wBAAwB;YAC1B;YACA;gBACE,OAAO;YACT;QACF;QAEA,QAAQ;QAER,IAAI,uBACF,EAAE,eAAe;IAErB;AACF","sources":["packages/@react-aria/interactions/src/createEventHandler.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 {BaseEvent} from '@react-types/shared';\nimport {SyntheticEvent} from 'react';\n\n/**\n * This function wraps a React event handler to make stopPropagation the default, and support continuePropagation instead.\n */\nexport function createEventHandler<T extends SyntheticEvent>(handler?: (e: BaseEvent<T>) => void): ((e: T) => void) | undefined {\n if (!handler) {\n return undefined;\n }\n\n let shouldStopPropagation = true;\n return (e: T) => {\n let event: BaseEvent<T> = {\n ...e,\n preventDefault() {\n e.preventDefault();\n },\n isDefaultPrevented() {\n return e.isDefaultPrevented();\n },\n stopPropagation() {\n if (shouldStopPropagation && process.env.NODE_ENV !== 'production') {\n console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');\n } else {\n shouldStopPropagation = true;\n }\n },\n continuePropagation() {\n shouldStopPropagation = false;\n },\n isPropagationStopped() {\n return shouldStopPropagation;\n }\n };\n\n handler(event);\n\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n };\n}\n"],"names":[],"version":3,"file":"createEventHandler.module.js.map"}
@@ -1,41 +0,0 @@
1
- var $e77252a287ef94ab$exports = require("./useFocusVisible.main.js");
2
- var $fCG8z$reactariautils = require("@react-aria/utils");
3
-
4
-
5
- function $parcel$export(e, n, v, s) {
6
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
- }
8
-
9
- $parcel$export(module.exports, "focusSafely", () => $2833058fcd3993f5$export$80f3e147d781571c);
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
-
22
- function $2833058fcd3993f5$export$80f3e147d781571c(element) {
23
- if (!element.isConnected) return;
24
- // If the user is interacting with a virtual cursor, e.g. screen reader, then
25
- // wait until after any animated transitions that are currently occurring on
26
- // the page before shifting focus. This avoids issues with VoiceOver on iOS
27
- // causing the page to scroll when moving focus if the element is transitioning
28
- // from off the screen.
29
- const ownerDocument = (0, $fCG8z$reactariautils.getOwnerDocument)(element);
30
- if ((0, $e77252a287ef94ab$exports.getInteractionModality)() === 'virtual') {
31
- let lastFocusedElement = (0, $fCG8z$reactariautils.getActiveElement)(ownerDocument);
32
- (0, $fCG8z$reactariautils.runAfterTransition)(()=>{
33
- const activeElement = (0, $fCG8z$reactariautils.getActiveElement)(ownerDocument);
34
- // If focus did not move or focus was lost to the body, and the element is still in the document, focus it.
35
- if ((activeElement === lastFocusedElement || activeElement === ownerDocument.body) && element.isConnected) (0, $fCG8z$reactariautils.focusWithoutScrolling)(element);
36
- });
37
- } else (0, $fCG8z$reactariautils.focusWithoutScrolling)(element);
38
- }
39
-
40
-
41
- //# sourceMappingURL=focusSafely.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAeM,SAAS,0CAAY,OAAyB;IACnD,IAAI,CAAC,QAAQ,WAAW,EACtB;IAGF,6EAA6E;IAC7E,4EAA4E;IAC5E,2EAA2E;IAC3E,+EAA+E;IAC/E,uBAAuB;IACvB,MAAM,gBAAgB,CAAA,GAAA,sCAAe,EAAE;IACvC,IAAI,CAAA,GAAA,gDAAqB,QAAQ,WAAW;QAC1C,IAAI,qBAAqB,CAAA,GAAA,sCAAe,EAAE;QAC1C,CAAA,GAAA,wCAAiB,EAAE;YACjB,MAAM,gBAAgB,CAAA,GAAA,sCAAe,EAAE;YACvC,2GAA2G;YAC3G,IAAI,AAAC,CAAA,kBAAkB,sBAAsB,kBAAkB,cAAc,IAAI,AAAD,KAAM,QAAQ,WAAW,EACvG,CAAA,GAAA,2CAAoB,EAAE;QAE1B;IACF,OACE,CAAA,GAAA,2CAAoB,EAAE;AAE1B","sources":["packages/@react-aria/interactions/src/focusSafely.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 {FocusableElement} from '@react-types/shared';\nimport {\n focusWithoutScrolling,\n getActiveElement,\n getOwnerDocument,\n runAfterTransition\n} from '@react-aria/utils';\nimport {getInteractionModality} from './useFocusVisible';\n\n/**\n * A utility function that focuses an element while avoiding undesired side effects such\n * as page scrolling and screen reader issues with CSS transitions.\n */\nexport function focusSafely(element: FocusableElement): void {\n if (!element.isConnected) {\n return;\n }\n\n // If the user is interacting with a virtual cursor, e.g. screen reader, then\n // wait until after any animated transitions that are currently occurring on\n // the page before shifting focus. This avoids issues with VoiceOver on iOS\n // causing the page to scroll when moving focus if the element is transitioning\n // from off the screen.\n const ownerDocument = getOwnerDocument(element);\n if (getInteractionModality() === 'virtual') {\n let lastFocusedElement = getActiveElement(ownerDocument);\n runAfterTransition(() => {\n const activeElement = getActiveElement(ownerDocument);\n // If focus did not move or focus was lost to the body, and the element is still in the document, focus it.\n if ((activeElement === lastFocusedElement || activeElement === ownerDocument.body) && element.isConnected) {\n focusWithoutScrolling(element);\n }\n });\n } else {\n focusWithoutScrolling(element);\n }\n}\n"],"names":[],"version":3,"file":"focusSafely.main.js.map"}
@@ -1,36 +0,0 @@
1
- import {getInteractionModality as $507fabe10e71c6fb$export$630ff653c5ada6a9} from "./useFocusVisible.mjs";
2
- import {getOwnerDocument as $k50bp$getOwnerDocument, getActiveElement as $k50bp$getActiveElement, runAfterTransition as $k50bp$runAfterTransition, focusWithoutScrolling as $k50bp$focusWithoutScrolling} from "@react-aria/utils";
3
-
4
- /*
5
- * Copyright 2020 Adobe. All rights reserved.
6
- * This file is licensed to you under the Apache License, Version 2.0 (the 'License');
7
- * you may not use this file except in compliance with the License. You may obtain a copy
8
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software distributed under
11
- * the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
- * OF ANY KIND, either express or implied. See the License for the specific language
13
- * governing permissions and limitations under the License.
14
- */
15
-
16
- function $3ad3f6e1647bc98d$export$80f3e147d781571c(element) {
17
- if (!element.isConnected) return;
18
- // If the user is interacting with a virtual cursor, e.g. screen reader, then
19
- // wait until after any animated transitions that are currently occurring on
20
- // the page before shifting focus. This avoids issues with VoiceOver on iOS
21
- // causing the page to scroll when moving focus if the element is transitioning
22
- // from off the screen.
23
- const ownerDocument = (0, $k50bp$getOwnerDocument)(element);
24
- if ((0, $507fabe10e71c6fb$export$630ff653c5ada6a9)() === 'virtual') {
25
- let lastFocusedElement = (0, $k50bp$getActiveElement)(ownerDocument);
26
- (0, $k50bp$runAfterTransition)(()=>{
27
- const activeElement = (0, $k50bp$getActiveElement)(ownerDocument);
28
- // If focus did not move or focus was lost to the body, and the element is still in the document, focus it.
29
- if ((activeElement === lastFocusedElement || activeElement === ownerDocument.body) && element.isConnected) (0, $k50bp$focusWithoutScrolling)(element);
30
- });
31
- } else (0, $k50bp$focusWithoutScrolling)(element);
32
- }
33
-
34
-
35
- export {$3ad3f6e1647bc98d$export$80f3e147d781571c as focusSafely};
36
- //# sourceMappingURL=focusSafely.module.js.map
@@ -1,36 +0,0 @@
1
- import {getInteractionModality as $507fabe10e71c6fb$export$630ff653c5ada6a9} from "./useFocusVisible.module.js";
2
- import {getOwnerDocument as $k50bp$getOwnerDocument, getActiveElement as $k50bp$getActiveElement, runAfterTransition as $k50bp$runAfterTransition, focusWithoutScrolling as $k50bp$focusWithoutScrolling} from "@react-aria/utils";
3
-
4
- /*
5
- * Copyright 2020 Adobe. All rights reserved.
6
- * This file is licensed to you under the Apache License, Version 2.0 (the 'License');
7
- * you may not use this file except in compliance with the License. You may obtain a copy
8
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software distributed under
11
- * the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
- * OF ANY KIND, either express or implied. See the License for the specific language
13
- * governing permissions and limitations under the License.
14
- */
15
-
16
- function $3ad3f6e1647bc98d$export$80f3e147d781571c(element) {
17
- if (!element.isConnected) return;
18
- // If the user is interacting with a virtual cursor, e.g. screen reader, then
19
- // wait until after any animated transitions that are currently occurring on
20
- // the page before shifting focus. This avoids issues with VoiceOver on iOS
21
- // causing the page to scroll when moving focus if the element is transitioning
22
- // from off the screen.
23
- const ownerDocument = (0, $k50bp$getOwnerDocument)(element);
24
- if ((0, $507fabe10e71c6fb$export$630ff653c5ada6a9)() === 'virtual') {
25
- let lastFocusedElement = (0, $k50bp$getActiveElement)(ownerDocument);
26
- (0, $k50bp$runAfterTransition)(()=>{
27
- const activeElement = (0, $k50bp$getActiveElement)(ownerDocument);
28
- // If focus did not move or focus was lost to the body, and the element is still in the document, focus it.
29
- if ((activeElement === lastFocusedElement || activeElement === ownerDocument.body) && element.isConnected) (0, $k50bp$focusWithoutScrolling)(element);
30
- });
31
- } else (0, $k50bp$focusWithoutScrolling)(element);
32
- }
33
-
34
-
35
- export {$3ad3f6e1647bc98d$export$80f3e147d781571c as focusSafely};
36
- //# sourceMappingURL=focusSafely.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAeM,SAAS,0CAAY,OAAyB;IACnD,IAAI,CAAC,QAAQ,WAAW,EACtB;IAGF,6EAA6E;IAC7E,4EAA4E;IAC5E,2EAA2E;IAC3E,+EAA+E;IAC/E,uBAAuB;IACvB,MAAM,gBAAgB,CAAA,GAAA,uBAAe,EAAE;IACvC,IAAI,CAAA,GAAA,yCAAqB,QAAQ,WAAW;QAC1C,IAAI,qBAAqB,CAAA,GAAA,uBAAe,EAAE;QAC1C,CAAA,GAAA,yBAAiB,EAAE;YACjB,MAAM,gBAAgB,CAAA,GAAA,uBAAe,EAAE;YACvC,2GAA2G;YAC3G,IAAI,AAAC,CAAA,kBAAkB,sBAAsB,kBAAkB,cAAc,IAAI,AAAD,KAAM,QAAQ,WAAW,EACvG,CAAA,GAAA,4BAAoB,EAAE;QAE1B;IACF,OACE,CAAA,GAAA,4BAAoB,EAAE;AAE1B","sources":["packages/@react-aria/interactions/src/focusSafely.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 {FocusableElement} from '@react-types/shared';\nimport {\n focusWithoutScrolling,\n getActiveElement,\n getOwnerDocument,\n runAfterTransition\n} from '@react-aria/utils';\nimport {getInteractionModality} from './useFocusVisible';\n\n/**\n * A utility function that focuses an element while avoiding undesired side effects such\n * as page scrolling and screen reader issues with CSS transitions.\n */\nexport function focusSafely(element: FocusableElement): void {\n if (!element.isConnected) {\n return;\n }\n\n // If the user is interacting with a virtual cursor, e.g. screen reader, then\n // wait until after any animated transitions that are currently occurring on\n // the page before shifting focus. This avoids issues with VoiceOver on iOS\n // causing the page to scroll when moving focus if the element is transitioning\n // from off the screen.\n const ownerDocument = getOwnerDocument(element);\n if (getInteractionModality() === 'virtual') {\n let lastFocusedElement = getActiveElement(ownerDocument);\n runAfterTransition(() => {\n const activeElement = getActiveElement(ownerDocument);\n // If focus did not move or focus was lost to the body, and the element is still in the document, focus it.\n if ((activeElement === lastFocusedElement || activeElement === ownerDocument.body) && element.isConnected) {\n focusWithoutScrolling(element);\n }\n });\n } else {\n focusWithoutScrolling(element);\n }\n}\n"],"names":[],"version":3,"file":"focusSafely.module.js.map"}