@react-aria/interactions 3.24.1 → 3.25.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 (75) hide show
  1. package/dist/PressResponder.main.js +1 -1
  2. package/dist/PressResponder.main.js.map +1 -1
  3. package/dist/PressResponder.mjs +1 -1
  4. package/dist/PressResponder.module.js +1 -1
  5. package/dist/PressResponder.module.js.map +1 -1
  6. package/dist/Pressable.main.js +1 -0
  7. package/dist/Pressable.main.js.map +1 -1
  8. package/dist/Pressable.mjs +1 -0
  9. package/dist/Pressable.module.js +1 -0
  10. package/dist/Pressable.module.js.map +1 -1
  11. package/dist/createEventHandler.main.js +1 -1
  12. package/dist/createEventHandler.main.js.map +1 -1
  13. package/dist/createEventHandler.mjs +1 -1
  14. package/dist/createEventHandler.module.js +1 -1
  15. package/dist/createEventHandler.module.js.map +1 -1
  16. package/dist/focusSafely.main.js.map +1 -1
  17. package/dist/focusSafely.module.js.map +1 -1
  18. package/dist/textSelection.main.js.map +1 -1
  19. package/dist/textSelection.module.js.map +1 -1
  20. package/dist/types.d.ts +1 -1
  21. package/dist/types.d.ts.map +1 -1
  22. package/dist/useFocusVisible.main.js +2 -2
  23. package/dist/useFocusVisible.main.js.map +1 -1
  24. package/dist/useFocusVisible.mjs +2 -2
  25. package/dist/useFocusVisible.module.js +2 -2
  26. package/dist/useFocusVisible.module.js.map +1 -1
  27. package/dist/useFocusWithin.main.js +4 -4
  28. package/dist/useFocusWithin.main.js.map +1 -1
  29. package/dist/useFocusWithin.mjs +5 -5
  30. package/dist/useFocusWithin.module.js +5 -5
  31. package/dist/useFocusWithin.module.js.map +1 -1
  32. package/dist/useFocusable.main.js +1 -0
  33. package/dist/useFocusable.main.js.map +1 -1
  34. package/dist/useFocusable.mjs +1 -0
  35. package/dist/useFocusable.module.js +1 -0
  36. package/dist/useFocusable.module.js.map +1 -1
  37. package/dist/useHover.main.js +3 -3
  38. package/dist/useHover.main.js.map +1 -1
  39. package/dist/useHover.mjs +3 -3
  40. package/dist/useHover.module.js +3 -3
  41. package/dist/useHover.module.js.map +1 -1
  42. package/dist/useInteractOutside.main.js +1 -1
  43. package/dist/useInteractOutside.main.js.map +1 -1
  44. package/dist/useInteractOutside.mjs +1 -1
  45. package/dist/useInteractOutside.module.js +1 -1
  46. package/dist/useInteractOutside.module.js.map +1 -1
  47. package/dist/useMove.main.js +1 -1
  48. package/dist/useMove.main.js.map +1 -1
  49. package/dist/useMove.mjs +1 -1
  50. package/dist/useMove.module.js +1 -1
  51. package/dist/useMove.module.js.map +1 -1
  52. package/dist/usePress.main.js +42 -7
  53. package/dist/usePress.main.js.map +1 -1
  54. package/dist/usePress.mjs +42 -7
  55. package/dist/usePress.module.js +42 -7
  56. package/dist/usePress.module.js.map +1 -1
  57. package/dist/utils.main.js +23 -32
  58. package/dist/utils.main.js.map +1 -1
  59. package/dist/utils.mjs +22 -32
  60. package/dist/utils.module.js +22 -32
  61. package/dist/utils.module.js.map +1 -1
  62. package/package.json +6 -6
  63. package/src/PressResponder.tsx +7 -5
  64. package/src/Pressable.tsx +4 -0
  65. package/src/createEventHandler.ts +1 -1
  66. package/src/focusSafely.ts +1 -1
  67. package/src/textSelection.ts +4 -4
  68. package/src/useFocusVisible.ts +3 -3
  69. package/src/useFocusWithin.ts +4 -4
  70. package/src/useFocusable.tsx +4 -0
  71. package/src/useHover.ts +3 -3
  72. package/src/useInteractOutside.ts +2 -2
  73. package/src/useMove.ts +1 -1
  74. package/src/usePress.ts +49 -10
  75. package/src/utils.ts +23 -54
@@ -41,7 +41,7 @@ const $3596bae48579386f$export$3351871ee4b288b8 = /*#__PURE__*/ (0, ($parcel$int
41
41
  (0, $3maub$reactariautils.useSyncRef)(prevContext, ref);
42
42
  (0, $3maub$react.useEffect)(()=>{
43
43
  if (!isRegistered.current) {
44
- console.warn("A PressResponder was rendered without a pressable child. Either call the usePress hook, or wrap your DOM node with <Pressable> component.");
44
+ if (process.env.NODE_ENV !== 'production') console.warn("A PressResponder was rendered without a pressable child. Either call the usePress hook, or wrap your DOM node with <Pressable> component.");
45
45
  isRegistered.current = true; // only warn once in strict mode.
46
46
  }
47
47
  }, []);
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAYM,MAAM,0DAAiB,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,CAAC,YAAC,QAAQ,EAAE,GAAG,OAA2B,EAAE;IACzF,IAAI,eAAe,CAAA,GAAA,mBAAK,EAAE;IAC1B,IAAI,cAAc,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,+CAAoB;IACjD,MAAM,CAAA,GAAA,kCAAW,EAAE,QAAO,wBAAA,kCAAA,YAAa,GAAG;IAC1C,IAAI,UAAU,CAAA,GAAA,gCAAS,EAAE,eAAe,CAAC,GAAG;QAC1C,GAAG,KAAK;aACR;QACA;YACE,aAAa,OAAO,GAAG;YACvB,IAAI,aACF,YAAY,QAAQ;QAExB;IACF;IAEA,CAAA,GAAA,gCAAS,EAAE,aAAa;IAExB,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,CAAC,aAAa,OAAO,EAAE;YACzB,QAAQ,IAAI,CACV;YAGF,aAAa,OAAO,GAAG,MAAM,iCAAiC;QAChE;IACF,GAAG,EAAE;IAEL,qBACE,0DAAC,CAAA,GAAA,+CAAoB,EAAE,QAAQ;QAAC,OAAO;OACpC;AAGP;AAEO,SAAS,0CAAoB,YAAC,QAAQ,EAAwB;IACnE,IAAI,UAAU,CAAA,GAAA,oBAAM,EAAE,IAAO,CAAA;YAAC,UAAU,KAAO;QAAC,CAAA,GAAI,EAAE;IACtD,qBACE,0DAAC,CAAA,GAAA,+CAAoB,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, ReactNode, useContext, useEffect, useMemo, useRef} from 'react';\n\ninterface PressResponderProps extends PressProps {\n children: ReactNode\n}\n\nexport const PressResponder = React.forwardRef(({children, ...props}: PressResponderProps, ref: ForwardedRef<FocusableElement>) => {\n let isRegistered = useRef(false);\n let prevContext = useContext(PressResponderContext);\n ref = useObjectRef(ref || prevContext?.ref);\n let context = mergeProps(prevContext || {}, {\n ...props,\n ref,\n register() {\n isRegistered.current = true;\n if (prevContext) {\n prevContext.register();\n }\n }\n });\n\n useSyncRef(prevContext, ref);\n\n useEffect(() => {\n if (!isRegistered.current) {\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 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}) {\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.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAYM,MAAM,0DAAiB,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,CAAC,YAAC,QAAQ,EAAE,GAAG,OAA2B,EAAE;IACzF,IAAI,eAAe,CAAA,GAAA,mBAAK,EAAE;IAC1B,IAAI,cAAc,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,+CAAoB;IACjD,MAAM,CAAA,GAAA,kCAAW,EAAE,QAAO,wBAAA,kCAAA,YAAa,GAAG;IAC1C,IAAI,UAAU,CAAA,GAAA,gCAAS,EAAE,eAAe,CAAC,GAAG;QAC1C,GAAG,KAAK;aACR;QACA;YACE,aAAa,OAAO,GAAG;YACvB,IAAI,aACF,YAAY,QAAQ;QAExB;IACF;IAEA,CAAA,GAAA,gCAAS,EAAE,aAAa;IAExB,CAAA,GAAA,sBAAQ,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,0DAAC,CAAA,GAAA,+CAAoB,EAAE,QAAQ;QAAC,OAAO;OACpC;AAGP;AAEO,SAAS,0CAAoB,YAAC,QAAQ,EAAwB;IACnE,IAAI,UAAU,CAAA,GAAA,oBAAM,EAAE,IAAO,CAAA;YAAC,UAAU,KAAO;QAAC,CAAA,GAAI,EAAE;IACtD,qBACE,0DAAC,CAAA,GAAA,+CAAoB,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, ReactNode, useContext, useEffect, useMemo, useRef} from 'react';\n\ninterface PressResponderProps extends PressProps {\n children: ReactNode\n}\n\nexport const PressResponder = React.forwardRef(({children, ...props}: PressResponderProps, ref: ForwardedRef<FocusableElement>) => {\n let isRegistered = useRef(false);\n let prevContext = useContext(PressResponderContext);\n ref = useObjectRef(ref || prevContext?.ref);\n let context = mergeProps(prevContext || {}, {\n ...props,\n ref,\n register() {\n isRegistered.current = true;\n if (prevContext) {\n prevContext.register();\n }\n }\n });\n\n useSyncRef(prevContext, 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}): ReactNode {\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.main.js.map"}
@@ -30,7 +30,7 @@ const $f1ab8c75478c6f73$export$3351871ee4b288b8 = /*#__PURE__*/ (0, $87RPk$react
30
30
  (0, $87RPk$useSyncRef)(prevContext, ref);
31
31
  (0, $87RPk$useEffect)(()=>{
32
32
  if (!isRegistered.current) {
33
- console.warn("A PressResponder was rendered without a pressable child. Either call the usePress hook, or wrap your DOM node with <Pressable> component.");
33
+ if (process.env.NODE_ENV !== 'production') console.warn("A PressResponder was rendered without a pressable child. Either call the usePress hook, or wrap your DOM node with <Pressable> component.");
34
34
  isRegistered.current = true; // only warn once in strict mode.
35
35
  }
36
36
  }, []);
@@ -30,7 +30,7 @@ const $f1ab8c75478c6f73$export$3351871ee4b288b8 = /*#__PURE__*/ (0, $87RPk$react
30
30
  (0, $87RPk$useSyncRef)(prevContext, ref);
31
31
  (0, $87RPk$useEffect)(()=>{
32
32
  if (!isRegistered.current) {
33
- console.warn("A PressResponder was rendered without a pressable child. Either call the usePress hook, or wrap your DOM node with <Pressable> component.");
33
+ if (process.env.NODE_ENV !== 'production') console.warn("A PressResponder was rendered without a pressable child. Either call the usePress hook, or wrap your DOM node with <Pressable> component.");
34
34
  isRegistered.current = true; // only warn once in strict mode.
35
35
  }
36
36
  }, []);
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAYM,MAAM,0DAAiB,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,CAAC,YAAC,QAAQ,EAAE,GAAG,OAA2B,EAAE;IACzF,IAAI,eAAe,CAAA,GAAA,aAAK,EAAE;IAC1B,IAAI,cAAc,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAoB;IACjD,MAAM,CAAA,GAAA,mBAAW,EAAE,QAAO,wBAAA,kCAAA,YAAa,GAAG;IAC1C,IAAI,UAAU,CAAA,GAAA,iBAAS,EAAE,eAAe,CAAC,GAAG;QAC1C,GAAG,KAAK;aACR;QACA;YACE,aAAa,OAAO,GAAG;YACvB,IAAI,aACF,YAAY,QAAQ;QAExB;IACF;IAEA,CAAA,GAAA,iBAAS,EAAE,aAAa;IAExB,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,CAAC,aAAa,OAAO,EAAE;YACzB,QAAQ,IAAI,CACV;YAGF,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, ReactNode, useContext, useEffect, useMemo, useRef} from 'react';\n\ninterface PressResponderProps extends PressProps {\n children: ReactNode\n}\n\nexport const PressResponder = React.forwardRef(({children, ...props}: PressResponderProps, ref: ForwardedRef<FocusableElement>) => {\n let isRegistered = useRef(false);\n let prevContext = useContext(PressResponderContext);\n ref = useObjectRef(ref || prevContext?.ref);\n let context = mergeProps(prevContext || {}, {\n ...props,\n ref,\n register() {\n isRegistered.current = true;\n if (prevContext) {\n prevContext.register();\n }\n }\n });\n\n useSyncRef(prevContext, ref);\n\n useEffect(() => {\n if (!isRegistered.current) {\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 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}) {\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
+ {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAYM,MAAM,0DAAiB,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,CAAC,YAAC,QAAQ,EAAE,GAAG,OAA2B,EAAE;IACzF,IAAI,eAAe,CAAA,GAAA,aAAK,EAAE;IAC1B,IAAI,cAAc,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAoB;IACjD,MAAM,CAAA,GAAA,mBAAW,EAAE,QAAO,wBAAA,kCAAA,YAAa,GAAG;IAC1C,IAAI,UAAU,CAAA,GAAA,iBAAS,EAAE,eAAe,CAAC,GAAG;QAC1C,GAAG,KAAK;aACR;QACA;YACE,aAAa,OAAO,GAAG;YACvB,IAAI,aACF,YAAY,QAAQ;QAExB;IACF;IAEA,CAAA,GAAA,iBAAS,EAAE,aAAa;IAExB,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, ReactNode, useContext, useEffect, useMemo, useRef} from 'react';\n\ninterface PressResponderProps extends PressProps {\n children: ReactNode\n}\n\nexport const PressResponder = React.forwardRef(({children, ...props}: PressResponderProps, ref: ForwardedRef<FocusableElement>) => {\n let isRegistered = useRef(false);\n let prevContext = useContext(PressResponderContext);\n ref = useObjectRef(ref || prevContext?.ref);\n let context = mergeProps(prevContext || {}, {\n ...props,\n ref,\n register() {\n isRegistered.current = true;\n if (prevContext) {\n prevContext.register();\n }\n }\n });\n\n useSyncRef(prevContext, 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}): ReactNode {\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"}
@@ -36,6 +36,7 @@ const $e1dbec26039c051d$export$27c701ed9e449e99 = /*#__PURE__*/ (0, ($parcel$int
36
36
  let { focusableProps: focusableProps } = (0, $15f8fd80892557ff$exports.useFocusable)(props, ref);
37
37
  let child = (0, ($parcel$interopDefault($ev4bP$react))).Children.only(children);
38
38
  (0, $ev4bP$react.useEffect)(()=>{
39
+ if (process.env.NODE_ENV === 'production') return;
39
40
  let el = ref.current;
40
41
  if (!el || !(el instanceof (0, $ev4bP$reactariautils.getOwnerWindow)(el).Element)) {
41
42
  console.error('<Pressable> child must forward its ref to a DOM element.');
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAYM,MAAM,0DAAY,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,CAAC,YAAC,QAAQ,EAAE,GAAG,OAAsB,EAAE;IAC/E,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,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,CAAA,GAAA,iCAAU,EAAE,KAAK;YACpB,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;KAAI;IAER,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 = React.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 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 (!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]);\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
+ {"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAYM,MAAM,0DAAY,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,CAAC,YAAC,QAAQ,EAAE,GAAG,OAAsB,EAAE;IAC/E,MAAM,CAAA,GAAA,kCAAW,EAAE;IACnB,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,kCAAO,EAAE;QAAC,GAAG,KAAK;aAAE;IAAG;IAC1C,IAAI,kBAAC,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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 = React.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 (!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]);\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"}
@@ -26,6 +26,7 @@ const $3b117e43dc0ca95d$export$27c701ed9e449e99 = /*#__PURE__*/ (0, $hhDyF$react
26
26
  let { focusableProps: focusableProps } = (0, $f645667febf57a63$export$4c014de7c8940b4c)(props, ref);
27
27
  let child = (0, $hhDyF$react).Children.only(children);
28
28
  (0, $hhDyF$useEffect)(()=>{
29
+ if (process.env.NODE_ENV === 'production') return;
29
30
  let el = ref.current;
30
31
  if (!el || !(el instanceof (0, $hhDyF$getOwnerWindow)(el).Element)) {
31
32
  console.error('<Pressable> child must forward its ref to a DOM element.');
@@ -26,6 +26,7 @@ const $3b117e43dc0ca95d$export$27c701ed9e449e99 = /*#__PURE__*/ (0, $hhDyF$react
26
26
  let { focusableProps: focusableProps } = (0, $f645667febf57a63$export$4c014de7c8940b4c)(props, ref);
27
27
  let child = (0, $hhDyF$react).Children.only(children);
28
28
  (0, $hhDyF$useEffect)(()=>{
29
+ if (process.env.NODE_ENV === 'production') return;
29
30
  let el = ref.current;
30
31
  if (!el || !(el instanceof (0, $hhDyF$getOwnerWindow)(el).Element)) {
31
32
  console.error('<Pressable> child must forward its ref to a DOM element.');
@@ -1 +1 @@
1
- {"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AAYM,MAAM,0DAAY,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,CAAC,YAAC,QAAQ,EAAE,GAAG,OAAsB,EAAE;IAC/E,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,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,CAAA,GAAA,kBAAU,EAAE,KAAK;YACpB,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;KAAI;IAER,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 = React.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 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 (!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]);\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
+ {"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AAYM,MAAM,0DAAY,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,CAAC,YAAC,QAAQ,EAAE,GAAG,OAAsB,EAAE;IAC/E,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,O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tD,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 = React.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 (!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]);\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"}
@@ -27,7 +27,7 @@ $parcel$export(module.exports, "createEventHandler", () => $951fbcbbca8db6ce$exp
27
27
  return e.isDefaultPrevented();
28
28
  },
29
29
  stopPropagation () {
30
- if (shouldStopPropagation) console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');
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
31
  else shouldStopPropagation = true;
32
32
  },
33
33
  continuePropagation () {
@@ -1 +1 @@
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,uBACF,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) {\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
+ {"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"}
@@ -21,7 +21,7 @@
21
21
  return e.isDefaultPrevented();
22
22
  },
23
23
  stopPropagation () {
24
- if (shouldStopPropagation) console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');
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
25
  else shouldStopPropagation = true;
26
26
  },
27
27
  continuePropagation () {
@@ -21,7 +21,7 @@
21
21
  return e.isDefaultPrevented();
22
22
  },
23
23
  stopPropagation () {
24
- if (shouldStopPropagation) console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');
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
25
  else shouldStopPropagation = true;
26
26
  },
27
27
  continuePropagation () {
@@ -1 +1 @@
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,uBACF,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) {\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
+ {"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 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAeM,SAAS,0CAAY,OAAyB;IACnD,6EAA6E;IAC7E,4EAA4E;IAC5E,2EAA2E;IAC3E,+EAA+E;IAC/E,uBAAuB;IACvB,MAAM,gBAAgB,CAAA,GAAA,sCAAe,EAAE;IACvC,MAAM,gBAAgB,CAAA,GAAA,sCAAe,EAAE;IACvC,IAAI,CAAA,GAAA,gDAAqB,QAAQ,WAAW;QAC1C,IAAI,qBAAqB;QACzB,CAAA,GAAA,wCAAiB,EAAE;YACjB,4EAA4E;YAC5E,IAAI,CAAA,GAAA,sCAAe,EAAE,mBAAmB,sBAAsB,QAAQ,WAAW,EAC/E,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) {\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 const activeElement = getActiveElement(ownerDocument);\n if (getInteractionModality() === 'virtual') {\n let lastFocusedElement = activeElement;\n runAfterTransition(() => {\n // If focus did not move and the element is still in the document, focus it.\n if (getActiveElement(ownerDocument) === lastFocusedElement && element.isConnected) {\n focusWithoutScrolling(element);\n }\n });\n } else {\n focusWithoutScrolling(element);\n }\n}\n"],"names":[],"version":3,"file":"focusSafely.main.js.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAeM,SAAS,0CAAY,OAAyB;IACnD,6EAA6E;IAC7E,4EAA4E;IAC5E,2EAA2E;IAC3E,+EAA+E;IAC/E,uBAAuB;IACvB,MAAM,gBAAgB,CAAA,GAAA,sCAAe,EAAE;IACvC,MAAM,gBAAgB,CAAA,GAAA,sCAAe,EAAE;IACvC,IAAI,CAAA,GAAA,gDAAqB,QAAQ,WAAW;QAC1C,IAAI,qBAAqB;QACzB,CAAA,GAAA,wCAAiB,EAAE;YACjB,4EAA4E;YAC5E,IAAI,CAAA,GAAA,sCAAe,EAAE,mBAAmB,sBAAsB,QAAQ,WAAW,EAC/E,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 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 const activeElement = getActiveElement(ownerDocument);\n if (getInteractionModality() === 'virtual') {\n let lastFocusedElement = activeElement;\n runAfterTransition(() => {\n // If focus did not move and the element is still in the document, focus it.\n if (getActiveElement(ownerDocument) === lastFocusedElement && element.isConnected) {\n focusWithoutScrolling(element);\n }\n });\n } else {\n focusWithoutScrolling(element);\n }\n}\n"],"names":[],"version":3,"file":"focusSafely.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAeM,SAAS,0CAAY,OAAyB;IACnD,6EAA6E;IAC7E,4EAA4E;IAC5E,2EAA2E;IAC3E,+EAA+E;IAC/E,uBAAuB;IACvB,MAAM,gBAAgB,CAAA,GAAA,uBAAe,EAAE;IACvC,MAAM,gBAAgB,CAAA,GAAA,uBAAe,EAAE;IACvC,IAAI,CAAA,GAAA,yCAAqB,QAAQ,WAAW;QAC1C,IAAI,qBAAqB;QACzB,CAAA,GAAA,yBAAiB,EAAE;YACjB,4EAA4E;YAC5E,IAAI,CAAA,GAAA,uBAAe,EAAE,mBAAmB,sBAAsB,QAAQ,WAAW,EAC/E,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) {\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 const activeElement = getActiveElement(ownerDocument);\n if (getInteractionModality() === 'virtual') {\n let lastFocusedElement = activeElement;\n runAfterTransition(() => {\n // If focus did not move and the element is still in the document, focus it.\n if (getActiveElement(ownerDocument) === lastFocusedElement && element.isConnected) {\n focusWithoutScrolling(element);\n }\n });\n } else {\n focusWithoutScrolling(element);\n }\n}\n"],"names":[],"version":3,"file":"focusSafely.module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAeM,SAAS,0CAAY,OAAyB;IACnD,6EAA6E;IAC7E,4EAA4E;IAC5E,2EAA2E;IAC3E,+EAA+E;IAC/E,uBAAuB;IACvB,MAAM,gBAAgB,CAAA,GAAA,uBAAe,EAAE;IACvC,MAAM,gBAAgB,CAAA,GAAA,uBAAe,EAAE;IACvC,IAAI,CAAA,GAAA,yCAAqB,QAAQ,WAAW;QAC1C,IAAI,qBAAqB;QACzB,CAAA,GAAA,yBAAiB,EAAE;YACjB,4EAA4E;YAC5E,IAAI,CAAA,GAAA,uBAAe,EAAE,mBAAmB,sBAAsB,QAAQ,WAAW,EAC/E,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 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 const activeElement = getActiveElement(ownerDocument);\n if (getInteractionModality() === 'virtual') {\n let lastFocusedElement = activeElement;\n runAfterTransition(() => {\n // If focus did not move and the element is still in the document, focus it.\n if (getActiveElement(ownerDocument) === lastFocusedElement && element.isConnected) {\n focusWithoutScrolling(element);\n }\n });\n } else {\n focusWithoutScrolling(element);\n }\n}\n"],"names":[],"version":3,"file":"focusSafely.module.js.map"}
@@ -1 +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;YAEvB,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,IAAI,WAAW,gBAAgB,OAAO,KAAK,GAAG,eAAe;QAC7D,yCAAmB,GAAG,CAAC,QAAQ,OAAO,KAAK,CAAC,SAAS;QACrD,OAAO,KAAK,CAAC,SAAS,GAAG;IAC3B;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;oBAEzB,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;YACjD,IAAI,WAAW,gBAAgB,OAAO,KAAK,GAAG,eAAe;YAE7D,IAAI,OAAO,KAAK,CAAC,SAAS,KAAK,QAC7B,OAAO,KAAK,CAAC,SAAS,GAAG;YAG3B,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 \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 let property = 'userSelect' in target.style ? 'userSelect' : 'webkitUserSelect';\n modifiedElementMap.set(target, target.style[property]);\n target.style[property] = '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 \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 let property = 'userSelect' in target.style ? 'userSelect' : 'webkitUserSelect';\n\n if (target.style[property] === 'none') {\n target.style[property] = 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"}
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;YAEvB,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,IAAI,WAAW,gBAAgB,OAAO,KAAK,GAAG,eAAe;QAC7D,yCAAmB,GAAG,CAAC,QAAQ,OAAO,KAAK,CAAC,SAAS;QACrD,OAAO,KAAK,CAAC,SAAS,GAAG;IAC3B;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;oBAEzB,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;YACjD,IAAI,WAAW,gBAAgB,OAAO,KAAK,GAAG,eAAe;YAE7D,IAAI,OAAO,KAAK,CAAC,SAAS,KAAK,QAC7B,OAAO,KAAK,CAAC,SAAS,GAAG;YAG3B,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): void {\n if (isIOS()) {\n if (state === 'default') {\n\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 let property = 'userSelect' in target.style ? 'userSelect' : 'webkitUserSelect';\n modifiedElementMap.set(target, target.style[property]);\n target.style[property] = 'none';\n }\n}\n\nexport function restoreTextSelection(target?: Element): void {\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\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 let property = 'userSelect' in target.style ? 'userSelect' : 'webkitUserSelect';\n\n if (target.style[property] === 'none') {\n target.style[property] = 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"}
@@ -1 +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;YAEvB,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,IAAI,WAAW,gBAAgB,OAAO,KAAK,GAAG,eAAe;QAC7D,yCAAmB,GAAG,CAAC,QAAQ,OAAO,KAAK,CAAC,SAAS;QACrD,OAAO,KAAK,CAAC,SAAS,GAAG;IAC3B;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;oBAEzB,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;YACjD,IAAI,WAAW,gBAAgB,OAAO,KAAK,GAAG,eAAe;YAE7D,IAAI,OAAO,KAAK,CAAC,SAAS,KAAK,QAC7B,OAAO,KAAK,CAAC,SAAS,GAAG;YAG3B,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 \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 let property = 'userSelect' in target.style ? 'userSelect' : 'webkitUserSelect';\n modifiedElementMap.set(target, target.style[property]);\n target.style[property] = '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 \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 let property = 'userSelect' in target.style ? 'userSelect' : 'webkitUserSelect';\n\n if (target.style[property] === 'none') {\n target.style[property] = 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"}
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;YAEvB,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,IAAI,WAAW,gBAAgB,OAAO,KAAK,GAAG,eAAe;QAC7D,yCAAmB,GAAG,CAAC,QAAQ,OAAO,KAAK,CAAC,SAAS;QACrD,OAAO,KAAK,CAAC,SAAS,GAAG;IAC3B;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;oBAEzB,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;YACjD,IAAI,WAAW,gBAAgB,OAAO,KAAK,GAAG,eAAe;YAE7D,IAAI,OAAO,KAAK,CAAC,SAAS,KAAK,QAC7B,OAAO,KAAK,CAAC,SAAS,GAAG;YAG3B,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): void {\n if (isIOS()) {\n if (state === 'default') {\n\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 let property = 'userSelect' in target.style ? 'userSelect' : 'webkitUserSelect';\n modifiedElementMap.set(target, target.style[property]);\n target.style[property] = 'none';\n }\n}\n\nexport function restoreTextSelection(target?: Element): void {\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\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 let property = 'userSelect' in target.style ? 'userSelect' : 'webkitUserSelect';\n\n if (target.style[property] === 'none') {\n target.style[property] = 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"}
package/dist/types.d.ts CHANGED
@@ -97,7 +97,7 @@ interface PressResponderProps extends PressProps {
97
97
  export const PressResponder: React.ForwardRefExoticComponent<PressResponderProps & React.RefAttributes<FocusableElement>>;
98
98
  export function ClearPressResponder({ children }: {
99
99
  children: ReactNode;
100
- }): React.JSX.Element;
100
+ }): ReactNode;
101
101
  export type Modality = 'keyboard' | 'pointer' | 'virtual';
102
102
  export type FocusVisibleHandler = (isFocusVisible: boolean) => void;
103
103
  export interface FocusVisibleProps {
@@ -1 +1 @@
1
- {"mappings":";;AGwCA,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,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,yEAAyE;IACzE,yBAAyB,CAAC,EAAE,OAAO,CAAA;CACpC;AAED,+BAAgC,SAAQ,UAAU;IAChD,mCAAmC;IACnC,GAAG,CAAC,EAAE,UAAU,OAAO,GAAG,IAAI,CAAC,CAAA;CAChC;AA2BD;IACE,+CAA+C;IAC/C,SAAS,EAAE,OAAO,CAAC;IACnB,6CAA6C;IAC7C,UAAU,EAAE,aAAa,CAAA;CAC1B;AAmED;;;;GAIG;AACH,yBAAyB,KAAK,EAAE,cAAc,GAA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AG,IAAI,CAAC,GAAG,IAAI,CAkBhG;ACvBD;IACE,oDAAoD;IACpD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mEAAmE;IACnE,gBAAgB,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IAC/C;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IAC7C;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IAC1C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAA;CAClC;AAED;IACE,6CAA6C;IAC7C,cAAc,EAAE,aAAa,CAAA;CAC9B;AAID;;;GAGG;AACH,6BAA6B,KAAK,EAAE,cAAc,GAAG,eAAe,CA+EnE;ACjHD;;;GAGG;AACH,4BAA4B,OAAO,EAAE,gBAAgB,QAmBpD;ACFD,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/utils.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/usePress.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/useFocus.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/useFocusable.tsx","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/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/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/focusSafely.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,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';\nexport {useFocusable, FocusableProvider, Focusable, FocusableContext} from './useFocusable';\nexport {focusSafely} from './focusSafely';\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';\nexport type {FocusableAria, FocusableOptions, FocusableProviderProps} from './useFocusable';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;AGwCA,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,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,yEAAyE;IACzE,yBAAyB,CAAC,EAAE,OAAO,CAAA;CACpC;AAED,+BAAgC,SAAQ,UAAU;IAChD,mCAAmC;IACnC,GAAG,CAAC,EAAE,UAAU,OAAO,GAAG,IAAI,CAAC,CAAA;CAChC;AA2BD;IACE,+CAA+C;IAC/C,SAAS,EAAE,OAAO,CAAC;IACnB,6CAA6C;IAC7C,UAAU,EAAE,aAAa,CAAA;CAC1B;AAmED;;;;GAIG;AACH,yBAAyB,KAAK,EAAE,cAAc,GAAG,WAAW,CA2qB3D;AC1zBD,4BAA4B,MAAM,GAAG,gBAAgB,CAAE,SAAQ,YAAY,MAAM,CAAC;IACh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D;IACpD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mEAAmE;IACnE,gBAAgB,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IAC/C;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IAC7C;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IAC1C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAA;CAClC;AAED;IACE,6CAA6C;IAC7C,cAAc,EAAE,aAAa,CAAA;CAC9B;AAID;;;GAGG;AACH,6BAA6B,KAAK,EAAE,cAAc,GAAG,eAAe,CA+EnE;ACjHD;;;GAGG;AACH,4BAA4B,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAmB3D;ACFD,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/utils.ts","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/useFocus.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/useFocusable.tsx","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/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/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/focusSafely.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,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';\nexport {useFocusable, FocusableProvider, Focusable, FocusableContext} from './useFocusable';\nexport {focusSafely} from './focusSafely';\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';\nexport type {FocusableAria, FocusableOptions, FocusableProviderProps} from './useFocusable';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
@@ -119,7 +119,7 @@ function $e77252a287ef94ab$var$handleWindowBlur() {
119
119
  documentObject.addEventListener('pointerdown', $e77252a287ef94ab$var$handlePointerEvent, true);
120
120
  documentObject.addEventListener('pointermove', $e77252a287ef94ab$var$handlePointerEvent, true);
121
121
  documentObject.addEventListener('pointerup', $e77252a287ef94ab$var$handlePointerEvent, true);
122
- } else {
122
+ } else if (process.env.NODE_ENV === 'test') {
123
123
  documentObject.addEventListener('mousedown', $e77252a287ef94ab$var$handlePointerEvent, true);
124
124
  documentObject.addEventListener('mousemove', $e77252a287ef94ab$var$handlePointerEvent, true);
125
125
  documentObject.addEventListener('mouseup', $e77252a287ef94ab$var$handlePointerEvent, true);
@@ -149,7 +149,7 @@ const $e77252a287ef94ab$var$tearDownWindowFocusTracking = (element, loadListener
149
149
  documentObject.removeEventListener('pointerdown', $e77252a287ef94ab$var$handlePointerEvent, true);
150
150
  documentObject.removeEventListener('pointermove', $e77252a287ef94ab$var$handlePointerEvent, true);
151
151
  documentObject.removeEventListener('pointerup', $e77252a287ef94ab$var$handlePointerEvent, true);
152
- } else {
152
+ } else if (process.env.NODE_ENV === 'test') {
153
153
  documentObject.removeEventListener('mousedown', $e77252a287ef94ab$var$handlePointerEvent, true);
154
154
  documentObject.removeEventListener('mousemove', $e77252a287ef94ab$var$handlePointerEvent, true);
155
155
  documentObject.removeEventListener('mouseup', $e77252a287ef94ab$var$handlePointerEvent, true);
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,kEAAkE;AAClE,2DAA2D;AAC3D,yDAAyD;AACzD,kHAAkH;;;;;AAuBlH,IAAI,wCAAmC;AACvC,IAAI,uCAAiB,IAAI;AAIlB,IAAI,4CAA0B,IAAI,OAAmC,yFAAyF;AACrK,IAAI,4CAAsB;AAC1B,IAAI,iDAA2B;AAE/B,sEAAsE;AACtE,MAAM,iDAA2B;IAC/B,KAAK;IACL,QAAQ;AACV;AAEA,SAAS,4CAAsB,QAAkB,EAAE,CAAe;IAChE,KAAK,IAAI,WAAW,qCAClB,QAAQ,UAAU;AAEtB;AAEA;;CAEC,GACD,SAAS,iCAAW,CAAgB;IAClC,gFAAgF;IAChF,OAAO,CAAE,CAAA,EAAE,OAAO,IAAK,CAAC,CAAA,GAAA,2BAAI,OAAO,EAAE,MAAM,IAAK,EAAE,OAAO,IAAI,EAAE,GAAG,KAAK,aAAa,EAAE,GAAG,KAAK,WAAW,EAAE,GAAG,KAAK,MAAK;AAC1H;AAGA,SAAS,0CAAoB,CAAgB;IAC3C,4CAAsB;IACtB,IAAI,iCAAW,IAAI;QACjB,wCAAkB;QAClB,4CAAsB,YAAY;IACpC;AACF;AAEA,SAAS,yCAAmB,CAA4B;IACtD,wCAAkB;IAClB,IAAI,EAAE,IAAI,KAAK,eAAe,EAAE,IAAI,KAAK,eAAe;QACtD,4CAAsB;QACtB,4CAAsB,WAAW;IACnC;AACF;AAEA,SAAS,uCAAiB,CAAa;IACrC,IAAI,CAAA,GAAA,oCAAa,EAAE,IAAI;QACrB,4CAAsB;QACtB,wCAAkB;IACpB;AACF;AAEA,SAAS,uCAAiB,CA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MAAM,EAAa,aAAa,GAAG;IAE5G,qKAAqK;IACrK,kIAAkI;IAClI,cAAc,eACX,UAAS,aAAa,YAAY,qBAAqB,CAAC,wCAAkB,GAAG,CAAC,UAAS,aAAa,CAAC,IAAI,KAC1G,UAAS,aAAa,YAAY,wBACjC,UAAS,aAAa,YAAY,gBAAgB,UAAS,aAAa,CAAC,iBAAiB;IAC7F,OAAO,CAAE,CAAA,eAAe,aAAa,cAAc,aAAa,kBAAkB,CAAC,8CAAwB,CAAC,EAAE,GAAG,CAAC,AAAD;AACnH;AAKO,SAAS,0CAAgB,QAA2B,CAAC,CAAC;IAC3D,IAAI,eAAC,WAAW,aAAE,SAAS,EAAC,GAAG;IAC/B,IAAI,CAAC,qBAAqB,gBAAgB,GAAG,CAAA,GAAA,qBAAO,EAAE,aAAa;IACnE,0CAAwB,CAAC;QACvB,gBAAgB;IAClB,GAAG;QAAC;KAAY,EAAE;qBAAC;IAAW;IAE9B,OAAO;QAAC,gBAAgB;IAAmB;AAC7C;AAKO,SAAS,0CAAwB,EAAuB,EAAE,IAAwB,EAAE,IAA8B;IACvH;IAEA,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,UAAU,CAAC,UAAoB;YACjC,0GAA0G;YAC1G,IAAI,CAAC,2CAAqB,CAAC,EAAE,iBAAA,2BAAA,KAAM,WAAW,GAAG,UAAU,IACzD;YAEF,GAAG;QACL;QACA,qCAAe,GAAG,CAAC;QACnB,OAAO;YACL,qCAAe,MAAM,CAAC;QACxB;IACF,uDAAuD;IACvD,GAAG;AACL","sources":["packages/@react-aria/interactions/src/useFocusVisible.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\n// Portions of the code in this file are based on code from react.\n// Original licensing for the following can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions\n\nimport {getOwnerDocument, getOwnerWindow, isMac, isVirtualClick} from '@react-aria/utils';\nimport {ignoreFocusEvent} from './utils';\nimport {useEffect, useState} from 'react';\nimport {useIsSSR} from '@react-aria/ssr';\n\nexport type Modality = 'keyboard' | 'pointer' | 'virtual';\ntype HandlerEvent = PointerEvent | MouseEvent | KeyboardEvent | FocusEvent | null;\ntype Handler = (modality: Modality, e: HandlerEvent) => void;\nexport type FocusVisibleHandler = (isFocusVisible: boolean) => void;\nexport interface FocusVisibleProps {\n /** Whether the element is a text input. */\n isTextInput?: boolean,\n /** Whether the element will be auto focused. */\n autoFocus?: boolean\n}\n\nexport interface FocusVisibleResult {\n /** Whether keyboard focus is visible globally. */\n isFocusVisible: boolean\n}\n\nlet currentModality: null | Modality = null;\nlet changeHandlers = new Set<Handler>();\ninterface GlobalListenerData {\n focus: () => void\n}\nexport let hasSetupGlobalListeners = new Map<Window, GlobalListenerData>(); // We use a map here to support setting event listeners across multiple document objects.\nlet hasEventBeforeFocus = false;\nlet hasBlurredWindowRecently = false;\n\n// Only Tab or Esc keys will make focus visible on text input elements\nconst FOCUS_VISIBLE_INPUT_KEYS = {\n Tab: true,\n Escape: true\n};\n\nfunction triggerChangeHandlers(modality: Modality, e: HandlerEvent) {\n for (let handler of changeHandlers) {\n handler(modality, e);\n }\n}\n\n/**\n * Helper function to determine if a KeyboardEvent is unmodified and could make keyboard focus styles visible.\n */\nfunction isValidKey(e: KeyboardEvent) {\n // Control and Shift keys trigger when navigating back to the tab with keyboard.\n return !(e.metaKey || (!isMac() && e.altKey) || e.ctrlKey || e.key === 'Control' || e.key === 'Shift' || e.key === 'Meta');\n}\n\n\nfunction handleKeyboardEvent(e: KeyboardEvent) {\n hasEventBeforeFocus = true;\n if (isValidKey(e)) {\n currentModality = 'keyboard';\n triggerChangeHandlers('keyboard', e);\n }\n}\n\nfunction handlePointerEvent(e: PointerEvent | MouseEvent) {\n currentModality = 'pointer';\n if (e.type === 'mousedown' || e.type === 'pointerdown') {\n hasEventBeforeFocus = true;\n triggerChangeHandlers('pointer', e);\n }\n}\n\nfunction handleClickEvent(e: MouseEvent) {\n if (isVirtualClick(e)) {\n hasEventBeforeFocus = true;\n currentModality = 'virtual';\n }\n}\n\nfunction handleFocusEvent(e: FocusEvent) {\n // Firefox fires two extra focus events when the user first clicks into an iframe:\n // first on the window, then on the document. We ignore these events so they don't\n // cause keyboard focus rings to appear.\n if (e.target === window || e.target === document || ignoreFocusEvent || !e.isTrusted) {\n return;\n }\n\n // If a focus event occurs without a preceding keyboard or pointer event, switch to virtual modality.\n // This occurs, for example, when navigating a form with the next/previous buttons on iOS.\n if (!hasEventBeforeFocus && !hasBlurredWindowRecently) {\n currentModality = 'virtual';\n triggerChangeHandlers('virtual', e);\n }\n\n hasEventBeforeFocus = false;\n hasBlurredWindowRecently = false;\n}\n\nfunction handleWindowBlur() {\n if (ignoreFocusEvent) {\n return;\n }\n\n // When the window is blurred, reset state. This is necessary when tabbing out of the window,\n // for example, since a subsequent focus event won't be fired.\n hasEventBeforeFocus = false;\n hasBlurredWindowRecently = true;\n}\n\n/**\n * Setup global event listeners to control when keyboard focus style should be visible.\n */\nfunction setupGlobalFocusEvents(element?: HTMLElement | null) {\n if (typeof window === 'undefined' || hasSetupGlobalListeners.get(getOwnerWindow(element))) {\n return;\n }\n\n const windowObject = getOwnerWindow(element);\n const documentObject = getOwnerDocument(element);\n\n // Programmatic focus() calls shouldn't affect the current input modality.\n // However, we need to detect other cases when a focus event occurs without\n // a preceding user event (e.g. screen reader focus). Overriding the focus\n // method on HTMLElement.prototype is a bit hacky, but works.\n let focus = windowObject.HTMLElement.prototype.focus;\n windowObject.HTMLElement.prototype.focus = function () {\n hasEventBeforeFocus = true;\n focus.apply(this, arguments as unknown as [options?: FocusOptions | undefined]);\n };\n\n documentObject.addEventListener('keydown', handleKeyboardEvent, true);\n documentObject.addEventListener('keyup', handleKeyboardEvent, true);\n documentObject.addEventListener('click', handleClickEvent, true);\n\n // Register focus events on the window so they are sure to happen\n // before React's event listeners (registered on the document).\n windowObject.addEventListener('focus', handleFocusEvent, true);\n windowObject.addEventListener('blur', handleWindowBlur, false);\n\n if (typeof PointerEvent !== 'undefined') {\n documentObject.addEventListener('pointerdown', handlePointerEvent, true);\n documentObject.addEventListener('pointermove', handlePointerEvent, true);\n documentObject.addEventListener('pointerup', handlePointerEvent, true);\n } else {\n documentObject.addEventListener('mousedown', handlePointerEvent, true);\n documentObject.addEventListener('mousemove', handlePointerEvent, true);\n documentObject.addEventListener('mouseup', handlePointerEvent, true);\n }\n\n // Add unmount handler\n windowObject.addEventListener('beforeunload', () => {\n tearDownWindowFocusTracking(element);\n }, {once: true});\n\n hasSetupGlobalListeners.set(windowObject, {focus});\n}\n\nconst tearDownWindowFocusTracking = (element, loadListener?: () => void) => {\n const windowObject = getOwnerWindow(element);\n const documentObject = getOwnerDocument(element);\n if (loadListener) {\n documentObject.removeEventListener('DOMContentLoaded', loadListener);\n }\n if (!hasSetupGlobalListeners.has(windowObject)) {\n return;\n }\n windowObject.HTMLElement.prototype.focus = hasSetupGlobalListeners.get(windowObject)!.focus;\n\n documentObject.removeEventListener('keydown', handleKeyboardEvent, true);\n documentObject.removeEventListener('keyup', handleKeyboardEvent, true);\n documentObject.removeEventListener('click', handleClickEvent, true);\n\n windowObject.removeEventListener('focus', handleFocusEvent, true);\n windowObject.removeEventListener('blur', handleWindowBlur, false);\n\n if (typeof PointerEvent !== 'undefined') {\n documentObject.removeEventListener('pointerdown', handlePointerEvent, true);\n documentObject.removeEventListener('pointermove', handlePointerEvent, true);\n documentObject.removeEventListener('pointerup', handlePointerEvent, true);\n } else {\n documentObject.removeEventListener('mousedown', handlePointerEvent, true);\n documentObject.removeEventListener('mousemove', handlePointerEvent, true);\n documentObject.removeEventListener('mouseup', handlePointerEvent, true);\n }\n\n hasSetupGlobalListeners.delete(windowObject);\n};\n\n/**\n * EXPERIMENTAL\n * Adds a window (i.e. iframe) to the list of windows that are being tracked for focus visible.\n *\n * Sometimes apps render portions of their tree into an iframe. In this case, we cannot accurately track if the focus\n * is visible because we cannot see interactions inside the iframe. If you have this in your application's architecture,\n * then this function will attach event listeners inside the iframe. You should call `addWindowFocusTracking` with an\n * element from inside the window you wish to add. We'll retrieve the relevant elements based on that.\n * Note, you do not need to call this for the default window, as we call it for you.\n *\n * When you are ready to stop listening, but you do not wish to unmount the iframe, you may call the cleanup function\n * returned by `addWindowFocusTracking`. Otherwise, when you unmount the iframe, all listeners and state will be cleaned\n * up automatically for you.\n *\n * @param element @default document.body - The element provided will be used to get the window to add.\n * @returns A function to remove the event listeners and cleanup the state.\n */\nexport function addWindowFocusTracking(element?: HTMLElement | null): () => void {\n const documentObject = getOwnerDocument(element);\n let loadListener;\n if (documentObject.readyState !== 'loading') {\n setupGlobalFocusEvents(element);\n } else {\n loadListener = () => {\n setupGlobalFocusEvents(element);\n };\n documentObject.addEventListener('DOMContentLoaded', loadListener);\n }\n\n return () => tearDownWindowFocusTracking(element, loadListener);\n}\n\n// Server-side rendering does not have the document object defined\n// eslint-disable-next-line no-restricted-globals\nif (typeof document !== 'undefined') {\n addWindowFocusTracking();\n}\n\n/**\n * If true, keyboard focus is visible.\n */\nexport function isFocusVisible(): boolean {\n return currentModality !== 'pointer';\n}\n\nexport function getInteractionModality(): Modality | null {\n return currentModality;\n}\n\nexport function setInteractionModality(modality: Modality) {\n currentModality = modality;\n triggerChangeHandlers(modality, null);\n}\n\n/**\n * Keeps state of the current modality.\n */\nexport function useInteractionModality(): Modality | null {\n setupGlobalFocusEvents();\n\n let [modality, setModality] = useState(currentModality);\n useEffect(() => {\n let handler = () => {\n setModality(currentModality);\n };\n\n changeHandlers.add(handler);\n return () => {\n changeHandlers.delete(handler);\n };\n }, []);\n\n return useIsSSR() ? null : modality;\n}\n\nconst nonTextInputTypes = new Set([\n 'checkbox',\n 'radio',\n 'range',\n 'color',\n 'file',\n 'image',\n 'button',\n 'submit',\n 'reset'\n]);\n\n/**\n * If this is attached to text input component, return if the event is a focus event (Tab/Escape keys pressed) so that\n * focus visible style can be properly set.\n */\nfunction isKeyboardFocusEvent(isTextInput: boolean, modality: Modality, e: HandlerEvent) {\n let document = getOwnerDocument(e?.target as Element);\n const IHTMLInputElement = typeof window !== 'undefined' ? getOwnerWindow(e?.target as Element).HTMLInputElement : HTMLInputElement;\n const IHTMLTextAreaElement = typeof window !== 'undefined' ? getOwnerWindow(e?.target as Element).HTMLTextAreaElement : HTMLTextAreaElement;\n const IHTMLElement = typeof window !== 'undefined' ? getOwnerWindow(e?.target as Element).HTMLElement : HTMLElement;\n const IKeyboardEvent = typeof window !== 'undefined' ? getOwnerWindow(e?.target as Element).KeyboardEvent : KeyboardEvent;\n\n // For keyboard events that occur on a non-input element that will move focus into input element (aka ArrowLeft going from Datepicker button to the main input group)\n // we need to rely on the user passing isTextInput into here. This way we can skip toggling focus visiblity for said input element\n isTextInput = isTextInput ||\n (document.activeElement instanceof IHTMLInputElement && !nonTextInputTypes.has(document.activeElement.type)) ||\n document.activeElement instanceof IHTMLTextAreaElement ||\n (document.activeElement instanceof IHTMLElement && document.activeElement.isContentEditable);\n return !(isTextInput && modality === 'keyboard' && e instanceof IKeyboardEvent && !FOCUS_VISIBLE_INPUT_KEYS[e.key]);\n}\n\n/**\n * Manages focus visible state for the page, and subscribes individual components for updates.\n */\nexport function useFocusVisible(props: FocusVisibleProps = {}): FocusVisibleResult {\n let {isTextInput, autoFocus} = props;\n let [isFocusVisibleState, setFocusVisible] = useState(autoFocus || isFocusVisible());\n useFocusVisibleListener((isFocusVisible) => {\n setFocusVisible(isFocusVisible);\n }, [isTextInput], {isTextInput});\n\n return {isFocusVisible: isFocusVisibleState};\n}\n\n/**\n * Listens for trigger change and reports if focus is visible (i.e., modality is not pointer).\n */\nexport function useFocusVisibleListener(fn: FocusVisibleHandler, deps: ReadonlyArray<any>, opts?: {isTextInput?: boolean}): void {\n setupGlobalFocusEvents();\n\n useEffect(() => {\n let handler = (modality: Modality, e: HandlerEvent) => {\n // We want to early return for any keyboard events that occur inside text inputs EXCEPT for Tab and Escape\n if (!isKeyboardFocusEvent(!!(opts?.isTextInput), modality, e)) {\n return;\n }\n fn(isFocusVisible());\n };\n changeHandlers.add(handler);\n return () => {\n changeHandlers.delete(handler);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n}\n"],"names":[],"version":3,"file":"useFocusVisible.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,kEAAkE;AAClE,2DAA2D;AAC3D,yDAAyD;AACzD,kHAAkH;;;;;AAuBlH,IAAI,wCAAmC;AACvC,IAAI,uCAAiB,IAAI;AAIlB,IAAI,4CAA0B,IAAI,OAAmC,yFAAyF;AACrK,IAAI,4CAAsB;AAC1B,IAAI,iDAA2B;AAE/B,sEAAsE;AACtE,MAAM,iDAA2B;IAC/B,KAAK;IACL,QAAQ;AACV;AAEA,SAAS,4CAAsB,QAAkB,EAAE,CAAe;IAChE,KAAK,IAAI,WAAW,qCAClB,QAAQ,UAAU;AAEtB;AAEA;;CAEC,GACD,SAAS,iCAAW,CAAgB;IAClC,gFAAgF;IAChF,OAAO,CAAE,CAAA,EAAE,OAAO,IAAK,CAAC,CAAA,GAAA,2BAAI,OAAO,EAAE,MAAM,IAAK,EAAE,OAAO,IAAI,EAAE,GAAG,KAAK,aAAa,EAAE,GAAG,KAAK,WAAW,EAAE,GAAG,KAAK,MAAK;AAC1H;AAGA,SAAS,0CAAoB,CAAgB;IAC3C,4CAAsB;IACtB,IAAI,iCAAW,IAAI;QACjB,wCAAkB;QAClB,4CAAsB,YAAY;IACpC;AACF;AAEA,SAAS,yCAAmB,CAA4B;IACtD,wC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,OAAO;YACL,qCAAe,MAAM,CAAC;QACxB;IACF,uDAAuD;IACvD,GAAG;AACL","sources":["packages/@react-aria/interactions/src/useFocusVisible.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\n// Portions of the code in this file are based on code from react.\n// Original licensing for the following can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions\n\nimport {getOwnerDocument, getOwnerWindow, isMac, isVirtualClick} from '@react-aria/utils';\nimport {ignoreFocusEvent} from './utils';\nimport {useEffect, useState} from 'react';\nimport {useIsSSR} from '@react-aria/ssr';\n\nexport type Modality = 'keyboard' | 'pointer' | 'virtual';\ntype HandlerEvent = PointerEvent | MouseEvent | KeyboardEvent | FocusEvent | null;\ntype Handler = (modality: Modality, e: HandlerEvent) => void;\nexport type FocusVisibleHandler = (isFocusVisible: boolean) => void;\nexport interface FocusVisibleProps {\n /** Whether the element is a text input. */\n isTextInput?: boolean,\n /** Whether the element will be auto focused. */\n autoFocus?: boolean\n}\n\nexport interface FocusVisibleResult {\n /** Whether keyboard focus is visible globally. */\n isFocusVisible: boolean\n}\n\nlet currentModality: null | Modality = null;\nlet changeHandlers = new Set<Handler>();\ninterface GlobalListenerData {\n focus: () => void\n}\nexport let hasSetupGlobalListeners = new Map<Window, GlobalListenerData>(); // We use a map here to support setting event listeners across multiple document objects.\nlet hasEventBeforeFocus = false;\nlet hasBlurredWindowRecently = false;\n\n// Only Tab or Esc keys will make focus visible on text input elements\nconst FOCUS_VISIBLE_INPUT_KEYS = {\n Tab: true,\n Escape: true\n};\n\nfunction triggerChangeHandlers(modality: Modality, e: HandlerEvent) {\n for (let handler of changeHandlers) {\n handler(modality, e);\n }\n}\n\n/**\n * Helper function to determine if a KeyboardEvent is unmodified and could make keyboard focus styles visible.\n */\nfunction isValidKey(e: KeyboardEvent) {\n // Control and Shift keys trigger when navigating back to the tab with keyboard.\n return !(e.metaKey || (!isMac() && e.altKey) || e.ctrlKey || e.key === 'Control' || e.key === 'Shift' || e.key === 'Meta');\n}\n\n\nfunction handleKeyboardEvent(e: KeyboardEvent) {\n hasEventBeforeFocus = true;\n if (isValidKey(e)) {\n currentModality = 'keyboard';\n triggerChangeHandlers('keyboard', e);\n }\n}\n\nfunction handlePointerEvent(e: PointerEvent | MouseEvent) {\n currentModality = 'pointer';\n if (e.type === 'mousedown' || e.type === 'pointerdown') {\n hasEventBeforeFocus = true;\n triggerChangeHandlers('pointer', e);\n }\n}\n\nfunction handleClickEvent(e: MouseEvent) {\n if (isVirtualClick(e)) {\n hasEventBeforeFocus = true;\n currentModality = 'virtual';\n }\n}\n\nfunction handleFocusEvent(e: FocusEvent) {\n // Firefox fires two extra focus events when the user first clicks into an iframe:\n // first on the window, then on the document. We ignore these events so they don't\n // cause keyboard focus rings to appear.\n if (e.target === window || e.target === document || ignoreFocusEvent || !e.isTrusted) {\n return;\n }\n\n // If a focus event occurs without a preceding keyboard or pointer event, switch to virtual modality.\n // This occurs, for example, when navigating a form with the next/previous buttons on iOS.\n if (!hasEventBeforeFocus && !hasBlurredWindowRecently) {\n currentModality = 'virtual';\n triggerChangeHandlers('virtual', e);\n }\n\n hasEventBeforeFocus = false;\n hasBlurredWindowRecently = false;\n}\n\nfunction handleWindowBlur() {\n if (ignoreFocusEvent) {\n return;\n }\n\n // When the window is blurred, reset state. This is necessary when tabbing out of the window,\n // for example, since a subsequent focus event won't be fired.\n hasEventBeforeFocus = false;\n hasBlurredWindowRecently = true;\n}\n\n/**\n * Setup global event listeners to control when keyboard focus style should be visible.\n */\nfunction setupGlobalFocusEvents(element?: HTMLElement | null) {\n if (typeof window === 'undefined' || hasSetupGlobalListeners.get(getOwnerWindow(element))) {\n return;\n }\n\n const windowObject = getOwnerWindow(element);\n const documentObject = getOwnerDocument(element);\n\n // Programmatic focus() calls shouldn't affect the current input modality.\n // However, we need to detect other cases when a focus event occurs without\n // a preceding user event (e.g. screen reader focus). Overriding the focus\n // method on HTMLElement.prototype is a bit hacky, but works.\n let focus = windowObject.HTMLElement.prototype.focus;\n windowObject.HTMLElement.prototype.focus = function () {\n hasEventBeforeFocus = true;\n focus.apply(this, arguments as unknown as [options?: FocusOptions | undefined]);\n };\n\n documentObject.addEventListener('keydown', handleKeyboardEvent, true);\n documentObject.addEventListener('keyup', handleKeyboardEvent, true);\n documentObject.addEventListener('click', handleClickEvent, true);\n\n // Register focus events on the window so they are sure to happen\n // before React's event listeners (registered on the document).\n windowObject.addEventListener('focus', handleFocusEvent, true);\n windowObject.addEventListener('blur', handleWindowBlur, false);\n\n if (typeof PointerEvent !== 'undefined') {\n documentObject.addEventListener('pointerdown', handlePointerEvent, true);\n documentObject.addEventListener('pointermove', handlePointerEvent, true);\n documentObject.addEventListener('pointerup', handlePointerEvent, true);\n } else if (process.env.NODE_ENV === 'test') {\n documentObject.addEventListener('mousedown', handlePointerEvent, true);\n documentObject.addEventListener('mousemove', handlePointerEvent, true);\n documentObject.addEventListener('mouseup', handlePointerEvent, true);\n }\n\n // Add unmount handler\n windowObject.addEventListener('beforeunload', () => {\n tearDownWindowFocusTracking(element);\n }, {once: true});\n\n hasSetupGlobalListeners.set(windowObject, {focus});\n}\n\nconst tearDownWindowFocusTracking = (element, loadListener?: () => void) => {\n const windowObject = getOwnerWindow(element);\n const documentObject = getOwnerDocument(element);\n if (loadListener) {\n documentObject.removeEventListener('DOMContentLoaded', loadListener);\n }\n if (!hasSetupGlobalListeners.has(windowObject)) {\n return;\n }\n windowObject.HTMLElement.prototype.focus = hasSetupGlobalListeners.get(windowObject)!.focus;\n\n documentObject.removeEventListener('keydown', handleKeyboardEvent, true);\n documentObject.removeEventListener('keyup', handleKeyboardEvent, true);\n documentObject.removeEventListener('click', handleClickEvent, true);\n\n windowObject.removeEventListener('focus', handleFocusEvent, true);\n windowObject.removeEventListener('blur', handleWindowBlur, false);\n\n if (typeof PointerEvent !== 'undefined') {\n documentObject.removeEventListener('pointerdown', handlePointerEvent, true);\n documentObject.removeEventListener('pointermove', handlePointerEvent, true);\n documentObject.removeEventListener('pointerup', handlePointerEvent, true);\n } else if (process.env.NODE_ENV === 'test') {\n documentObject.removeEventListener('mousedown', handlePointerEvent, true);\n documentObject.removeEventListener('mousemove', handlePointerEvent, true);\n documentObject.removeEventListener('mouseup', handlePointerEvent, true);\n }\n\n hasSetupGlobalListeners.delete(windowObject);\n};\n\n/**\n * EXPERIMENTAL\n * Adds a window (i.e. iframe) to the list of windows that are being tracked for focus visible.\n *\n * Sometimes apps render portions of their tree into an iframe. In this case, we cannot accurately track if the focus\n * is visible because we cannot see interactions inside the iframe. If you have this in your application's architecture,\n * then this function will attach event listeners inside the iframe. You should call `addWindowFocusTracking` with an\n * element from inside the window you wish to add. We'll retrieve the relevant elements based on that.\n * Note, you do not need to call this for the default window, as we call it for you.\n *\n * When you are ready to stop listening, but you do not wish to unmount the iframe, you may call the cleanup function\n * returned by `addWindowFocusTracking`. Otherwise, when you unmount the iframe, all listeners and state will be cleaned\n * up automatically for you.\n *\n * @param element @default document.body - The element provided will be used to get the window to add.\n * @returns A function to remove the event listeners and cleanup the state.\n */\nexport function addWindowFocusTracking(element?: HTMLElement | null): () => void {\n const documentObject = getOwnerDocument(element);\n let loadListener;\n if (documentObject.readyState !== 'loading') {\n setupGlobalFocusEvents(element);\n } else {\n loadListener = () => {\n setupGlobalFocusEvents(element);\n };\n documentObject.addEventListener('DOMContentLoaded', loadListener);\n }\n\n return () => tearDownWindowFocusTracking(element, loadListener);\n}\n\n// Server-side rendering does not have the document object defined\n// eslint-disable-next-line no-restricted-globals\nif (typeof document !== 'undefined') {\n addWindowFocusTracking();\n}\n\n/**\n * If true, keyboard focus is visible.\n */\nexport function isFocusVisible(): boolean {\n return currentModality !== 'pointer';\n}\n\nexport function getInteractionModality(): Modality | null {\n return currentModality;\n}\n\nexport function setInteractionModality(modality: Modality): void {\n currentModality = modality;\n triggerChangeHandlers(modality, null);\n}\n\n/**\n * Keeps state of the current modality.\n */\nexport function useInteractionModality(): Modality | null {\n setupGlobalFocusEvents();\n\n let [modality, setModality] = useState(currentModality);\n useEffect(() => {\n let handler = () => {\n setModality(currentModality);\n };\n\n changeHandlers.add(handler);\n return () => {\n changeHandlers.delete(handler);\n };\n }, []);\n\n return useIsSSR() ? null : modality;\n}\n\nconst nonTextInputTypes = new Set([\n 'checkbox',\n 'radio',\n 'range',\n 'color',\n 'file',\n 'image',\n 'button',\n 'submit',\n 'reset'\n]);\n\n/**\n * If this is attached to text input component, return if the event is a focus event (Tab/Escape keys pressed) so that\n * focus visible style can be properly set.\n */\nfunction isKeyboardFocusEvent(isTextInput: boolean, modality: Modality, e: HandlerEvent) {\n let document = getOwnerDocument(e?.target as Element);\n const IHTMLInputElement = typeof window !== 'undefined' ? getOwnerWindow(e?.target as Element).HTMLInputElement : HTMLInputElement;\n const IHTMLTextAreaElement = typeof window !== 'undefined' ? getOwnerWindow(e?.target as Element).HTMLTextAreaElement : HTMLTextAreaElement;\n const IHTMLElement = typeof window !== 'undefined' ? getOwnerWindow(e?.target as Element).HTMLElement : HTMLElement;\n const IKeyboardEvent = typeof window !== 'undefined' ? getOwnerWindow(e?.target as Element).KeyboardEvent : KeyboardEvent;\n\n // For keyboard events that occur on a non-input element that will move focus into input element (aka ArrowLeft going from Datepicker button to the main input group)\n // we need to rely on the user passing isTextInput into here. This way we can skip toggling focus visiblity for said input element\n isTextInput = isTextInput ||\n (document.activeElement instanceof IHTMLInputElement && !nonTextInputTypes.has(document.activeElement.type)) ||\n document.activeElement instanceof IHTMLTextAreaElement ||\n (document.activeElement instanceof IHTMLElement && document.activeElement.isContentEditable);\n return !(isTextInput && modality === 'keyboard' && e instanceof IKeyboardEvent && !FOCUS_VISIBLE_INPUT_KEYS[e.key]);\n}\n\n/**\n * Manages focus visible state for the page, and subscribes individual components for updates.\n */\nexport function useFocusVisible(props: FocusVisibleProps = {}): FocusVisibleResult {\n let {isTextInput, autoFocus} = props;\n let [isFocusVisibleState, setFocusVisible] = useState(autoFocus || isFocusVisible());\n useFocusVisibleListener((isFocusVisible) => {\n setFocusVisible(isFocusVisible);\n }, [isTextInput], {isTextInput});\n\n return {isFocusVisible: isFocusVisibleState};\n}\n\n/**\n * Listens for trigger change and reports if focus is visible (i.e., modality is not pointer).\n */\nexport function useFocusVisibleListener(fn: FocusVisibleHandler, deps: ReadonlyArray<any>, opts?: {isTextInput?: boolean}): void {\n setupGlobalFocusEvents();\n\n useEffect(() => {\n let handler = (modality: Modality, e: HandlerEvent) => {\n // We want to early return for any keyboard events that occur inside text inputs EXCEPT for Tab and Escape\n if (!isKeyboardFocusEvent(!!(opts?.isTextInput), modality, e)) {\n return;\n }\n fn(isFocusVisible());\n };\n changeHandlers.add(handler);\n return () => {\n changeHandlers.delete(handler);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n}\n"],"names":[],"version":3,"file":"useFocusVisible.main.js.map"}
@@ -107,7 +107,7 @@ function $507fabe10e71c6fb$var$handleWindowBlur() {
107
107
  documentObject.addEventListener('pointerdown', $507fabe10e71c6fb$var$handlePointerEvent, true);
108
108
  documentObject.addEventListener('pointermove', $507fabe10e71c6fb$var$handlePointerEvent, true);
109
109
  documentObject.addEventListener('pointerup', $507fabe10e71c6fb$var$handlePointerEvent, true);
110
- } else {
110
+ } else if (process.env.NODE_ENV === 'test') {
111
111
  documentObject.addEventListener('mousedown', $507fabe10e71c6fb$var$handlePointerEvent, true);
112
112
  documentObject.addEventListener('mousemove', $507fabe10e71c6fb$var$handlePointerEvent, true);
113
113
  documentObject.addEventListener('mouseup', $507fabe10e71c6fb$var$handlePointerEvent, true);
@@ -137,7 +137,7 @@ const $507fabe10e71c6fb$var$tearDownWindowFocusTracking = (element, loadListener
137
137
  documentObject.removeEventListener('pointerdown', $507fabe10e71c6fb$var$handlePointerEvent, true);
138
138
  documentObject.removeEventListener('pointermove', $507fabe10e71c6fb$var$handlePointerEvent, true);
139
139
  documentObject.removeEventListener('pointerup', $507fabe10e71c6fb$var$handlePointerEvent, true);
140
- } else {
140
+ } else if (process.env.NODE_ENV === 'test') {
141
141
  documentObject.removeEventListener('mousedown', $507fabe10e71c6fb$var$handlePointerEvent, true);
142
142
  documentObject.removeEventListener('mousemove', $507fabe10e71c6fb$var$handlePointerEvent, true);
143
143
  documentObject.removeEventListener('mouseup', $507fabe10e71c6fb$var$handlePointerEvent, true);
@@ -107,7 +107,7 @@ function $507fabe10e71c6fb$var$handleWindowBlur() {
107
107
  documentObject.addEventListener('pointerdown', $507fabe10e71c6fb$var$handlePointerEvent, true);
108
108
  documentObject.addEventListener('pointermove', $507fabe10e71c6fb$var$handlePointerEvent, true);
109
109
  documentObject.addEventListener('pointerup', $507fabe10e71c6fb$var$handlePointerEvent, true);
110
- } else {
110
+ } else if (process.env.NODE_ENV === 'test') {
111
111
  documentObject.addEventListener('mousedown', $507fabe10e71c6fb$var$handlePointerEvent, true);
112
112
  documentObject.addEventListener('mousemove', $507fabe10e71c6fb$var$handlePointerEvent, true);
113
113
  documentObject.addEventListener('mouseup', $507fabe10e71c6fb$var$handlePointerEvent, true);
@@ -137,7 +137,7 @@ const $507fabe10e71c6fb$var$tearDownWindowFocusTracking = (element, loadListener
137
137
  documentObject.removeEventListener('pointerdown', $507fabe10e71c6fb$var$handlePointerEvent, true);
138
138
  documentObject.removeEventListener('pointermove', $507fabe10e71c6fb$var$handlePointerEvent, true);
139
139
  documentObject.removeEventListener('pointerup', $507fabe10e71c6fb$var$handlePointerEvent, true);
140
- } else {
140
+ } else if (process.env.NODE_ENV === 'test') {
141
141
  documentObject.removeEventListener('mousedown', $507fabe10e71c6fb$var$handlePointerEvent, true);
142
142
  documentObject.removeEventListener('mousemove', $507fabe10e71c6fb$var$handlePointerEvent, true);
143
143
  documentObject.removeEventListener('mouseup', $507fabe10e71c6fb$var$handlePointerEvent, true);