@react-aria/interactions 3.21.1 → 3.21.2

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 (88) hide show
  1. package/dist/PressResponder.main.js +62 -0
  2. package/dist/PressResponder.main.js.map +1 -0
  3. package/dist/PressResponder.mjs +52 -0
  4. package/dist/PressResponder.module.js +52 -0
  5. package/dist/PressResponder.module.js.map +1 -0
  6. package/dist/Pressable.main.js +43 -0
  7. package/dist/Pressable.main.js.map +1 -0
  8. package/dist/Pressable.mjs +34 -0
  9. package/dist/Pressable.module.js +34 -0
  10. package/dist/Pressable.module.js.map +1 -0
  11. package/dist/context.main.js +30 -0
  12. package/dist/context.main.js.map +1 -0
  13. package/dist/context.mjs +21 -0
  14. package/dist/context.module.js +21 -0
  15. package/dist/context.module.js.map +1 -0
  16. package/dist/createEventHandler.main.js +42 -0
  17. package/dist/createEventHandler.main.js.map +1 -0
  18. package/dist/createEventHandler.mjs +37 -0
  19. package/dist/createEventHandler.module.js +37 -0
  20. package/dist/createEventHandler.module.js.map +1 -0
  21. package/dist/import.mjs +12 -1771
  22. package/dist/main.js +31 -1794
  23. package/dist/main.js.map +1 -1
  24. package/dist/module.js +12 -1771
  25. package/dist/module.js.map +1 -1
  26. package/dist/textSelection.main.js +77 -0
  27. package/dist/textSelection.main.js.map +1 -0
  28. package/dist/textSelection.mjs +71 -0
  29. package/dist/textSelection.module.js +71 -0
  30. package/dist/textSelection.module.js.map +1 -0
  31. package/dist/types.d.ts.map +1 -1
  32. package/dist/useFocus.main.js +64 -0
  33. package/dist/useFocus.main.js.map +1 -0
  34. package/dist/useFocus.mjs +59 -0
  35. package/dist/useFocus.module.js +59 -0
  36. package/dist/useFocus.module.js.map +1 -0
  37. package/dist/useFocusVisible.main.js +248 -0
  38. package/dist/useFocusVisible.main.js.map +1 -0
  39. package/dist/useFocusVisible.mjs +237 -0
  40. package/dist/useFocusVisible.module.js +237 -0
  41. package/dist/useFocusVisible.module.js.map +1 -0
  42. package/dist/useFocusWithin.main.js +76 -0
  43. package/dist/useFocusWithin.main.js.map +1 -0
  44. package/dist/useFocusWithin.mjs +71 -0
  45. package/dist/useFocusWithin.module.js +71 -0
  46. package/dist/useFocusWithin.module.js.map +1 -0
  47. package/dist/useHover.main.js +142 -0
  48. package/dist/useHover.main.js.map +1 -0
  49. package/dist/useHover.mjs +137 -0
  50. package/dist/useHover.module.js +137 -0
  51. package/dist/useHover.module.js.map +1 -0
  52. package/dist/useInteractOutside.main.js +101 -0
  53. package/dist/useInteractOutside.main.js.map +1 -0
  54. package/dist/useInteractOutside.mjs +96 -0
  55. package/dist/useInteractOutside.module.js +96 -0
  56. package/dist/useInteractOutside.module.js.map +1 -0
  57. package/dist/useKeyboard.main.js +30 -0
  58. package/dist/useKeyboard.main.js.map +1 -0
  59. package/dist/useKeyboard.mjs +25 -0
  60. package/dist/useKeyboard.module.js +25 -0
  61. package/dist/useKeyboard.module.js.map +1 -0
  62. package/dist/useLongPress.main.js +84 -0
  63. package/dist/useLongPress.main.js.map +1 -0
  64. package/dist/useLongPress.mjs +79 -0
  65. package/dist/useLongPress.module.js +79 -0
  66. package/dist/useLongPress.module.js.map +1 -0
  67. package/dist/useMove.main.js +236 -0
  68. package/dist/useMove.main.js.map +1 -0
  69. package/dist/useMove.mjs +231 -0
  70. package/dist/useMove.module.js +231 -0
  71. package/dist/useMove.module.js.map +1 -0
  72. package/dist/usePress.main.js +571 -0
  73. package/dist/usePress.main.js.map +1 -0
  74. package/dist/usePress.mjs +566 -0
  75. package/dist/usePress.module.js +566 -0
  76. package/dist/usePress.module.js.map +1 -0
  77. package/dist/useScrollWheel.main.js +41 -0
  78. package/dist/useScrollWheel.main.js.map +1 -0
  79. package/dist/useScrollWheel.mjs +36 -0
  80. package/dist/useScrollWheel.module.js +36 -0
  81. package/dist/useScrollWheel.module.js.map +1 -0
  82. package/dist/utils.main.js +120 -0
  83. package/dist/utils.main.js.map +1 -0
  84. package/dist/utils.mjs +115 -0
  85. package/dist/utils.module.js +115 -0
  86. package/dist/utils.module.js.map +1 -0
  87. package/package.json +5 -5
  88. package/src/useFocus.ts +5 -1
@@ -1 +1 @@
1
- {"mappings":";;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC;ACVD;;;;;;;;;;CAUC,GAED,kEAAkE;AAClE,2DAA2D;AAC3D,yDAAyD;AACzD,kHAAkH;;;;;ACflH;;;;;;;;;;CAUC;AAmBD,0GAA0G;AAC1G,4HAA4H;AAC5H,IAAI,8BAAe;AACnB,IAAI,wCAAkB;AACtB,IAAI,2CAAqB,IAAI;AAEtB,SAAS,0CAAqB,MAAgB;IACnD,IAAI,CAAA,GAAA,YAAI,KAAK;QACX,IAAI,gCAAU,WAAW;YACvB,iDAAiD;YACjD,MAAM,iBAAiB,CAAA,GAAA,uBAAe,EAAE;YACxC,wCAAkB,eAAe,eAAe,CAAC,KAAK,CAAC,gBAAgB;YACvE,eAAe,eAAe,CAAC,KAAK,CAAC,gBAAgB,GAAG;QAC1D;QAEA,8BAAQ;IACV,OAAO,IAAI,kBAAkB,eAAe,kBAAkB,YAAY;QACxE,sFAAsF;QACtF,kDAAkD;QAClD,yCAAmB,GAAG,CAAC,QAAQ,OAAO,KAAK,CAAC,UAAU;QACtD,OAAO,KAAK,CAAC,UAAU,GAAG;IAC5B;AACF;AAEO,SAAS,0CAAqB,MAAgB;IACnD,IAAI,CAAA,GAAA,YAAI,KAAK;QACX,0DAA0D;QAC1D,sEAAsE;QACtE,IAAI,gCAAU,YACZ;QAGF,8BAAQ;QAER,uEAAuE;QACvE,+DAA+D;QAC/D,WAAW;YACT,uEAAuE;YACvE,oEAAoE;YACpE,CAAA,GAAA,yBAAiB,EAAE;gBACjB,wBAAwB;gBACxB,IAAI,gCAAU,aAAa;oBACzB,iDAAiD;oBACjD,MAAM,iBAAiB,CAAA,GAAA,uBAAe,EAAE;oBACxC,IAAI,eAAe,eAAe,CAAC,KAAK,CAAC,gBAAgB,KAAK,QAC5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AAQ,OAAO,GAAG,WAAW;oBAC3B,iEAAiE;oBACjE,EAAE,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,iBAAiB;wBAAC,SAAS;oBAAI;oBACvE,IAAI,aACF,YAAY;wBACV,GAAG,CAAC;wBACJ,MAAM;oBACR;oBAEF,QAAQ,OAAO,GAAG;gBACpB,GAAG;gBAEH,2EAA2E;gBAC3E,IAAI,EAAE,WAAW,KAAK,SAAS;oBAC7B,IAAI,gBAAgB,CAAA;wBAClB,EAAE,cAAc;oBAClB;oBAEA,kBAAkB,EAAE,MAAM,EAAE,eAAe,eAAe;wBAAC,MAAM;oBAAI;oBACrE,kBAAkB,QAAQ,aAAa;wBACrC,+EAA+E;wBAC/E,wEAAwE;wBACxE,WAAW;4BACT,qBAAqB,EAAE,MAAM,EAAE,eAAe;wBAChD,GAAG;oBACL,GAAG;wBAAC,MAAM;oBAAI;gBAChB;YACF;QACF;QACA,YAAW,CAAC;YACV,IAAI,QAAQ,OAAO,EACjB,aAAa,QAAQ,OAAO;YAG9B,IAAI,kBAAmB,CAAA,EAAE,WAAW,KAAK,WAAW,EAAE,WAAW,KAAK,OAAM,GAC1E,eAAe;gBACb,GAAG,CAAC;gBACJ,MAAM;YACR;QAEJ;IACF;IAEA,IAAI,mBAAmB,CAAA,GAAA,qBAAa,EAAE,eAAe,CAAC,aAAa,2BAA2B;IAE9F,OAAO;QACL,gBAAgB,CAAA,GAAA,iBAAS,EAAE,YAAY;IACzC;AACF;","sources":["packages/@react-aria/interactions/src/index.ts","packages/@react-aria/interactions/src/Pressable.tsx","packages/@react-aria/interactions/src/usePress.ts","packages/@react-aria/interactions/src/textSelection.ts","packages/@react-aria/interactions/src/context.ts","packages/@react-aria/interactions/src/PressResponder.tsx","packages/@react-aria/interactions/src/useFocus.ts","packages/@react-aria/interactions/src/utils.ts","packages/@react-aria/interactions/src/useFocusVisible.ts","packages/@react-aria/interactions/src/useFocusWithin.ts","packages/@react-aria/interactions/src/useHover.ts","packages/@react-aria/interactions/src/useInteractOutside.ts","packages/@react-aria/interactions/src/useKeyboard.ts","packages/@react-aria/interactions/src/createEventHandler.ts","packages/@react-aria/interactions/src/useMove.ts","packages/@react-aria/interactions/src/useScrollWheel.ts","packages/@react-aria/interactions/src/useLongPress.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {Pressable} from './Pressable';\nexport {PressResponder, ClearPressResponder} from './PressResponder';\nexport {useFocus} from './useFocus';\nexport {\n isFocusVisible,\n getInteractionModality,\n setInteractionModality,\n addWindowFocusTracking,\n useInteractionModality,\n useFocusVisible,\n useFocusVisibleListener\n} from './useFocusVisible';\nexport {useFocusWithin} from './useFocusWithin';\nexport {useHover} from './useHover';\nexport {useInteractOutside} from './useInteractOutside';\nexport {useKeyboard} from './useKeyboard';\nexport {useMove} from './useMove';\nexport {usePress} from './usePress';\nexport {useScrollWheel} from './useScrollWheel';\nexport {useLongPress} from './useLongPress';\n\nexport type {FocusProps, FocusResult} from './useFocus';\nexport type {FocusVisibleHandler, FocusVisibleProps, FocusVisibleResult, Modality} from './useFocusVisible';\nexport type {FocusWithinProps, FocusWithinResult} from './useFocusWithin';\nexport type {HoverProps, HoverResult} from './useHover';\nexport type {InteractOutsideProps} from './useInteractOutside';\nexport type {KeyboardProps, KeyboardResult} from './useKeyboard';\nexport type {PressProps, PressHookProps, PressResult} from './usePress';\nexport type {PressEvent, PressEvents, MoveStartEvent, MoveMoveEvent, MoveEndEvent, MoveEvents, HoverEvent, HoverEvents, FocusEvents, KeyboardEvents} from '@react-types/shared';\nexport type {MoveResult} from './useMove';\nexport type {LongPressProps, LongPressResult} from './useLongPress';\nexport type {ScrollWheelProps} from './useScrollWheel';\n","/*\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} from '@react-types/shared';\nimport {mergeProps, useObjectRef} from '@react-aria/utils';\nimport {PressProps, usePress} from './usePress';\nimport React, {ForwardedRef, ReactElement} from 'react';\n\ninterface PressableProps extends PressProps {\n children: ReactElement<DOMAttributes, string>\n}\n\nexport const Pressable = React.forwardRef(({children, ...props}: PressableProps, ref: ForwardedRef<HTMLElement>) => {\n ref = useObjectRef(ref);\n let {pressProps} = usePress({...props, ref});\n let child = React.Children.only(children);\n return React.cloneElement(\n child,\n // @ts-ignore\n {ref, ...mergeProps(child.props, pressProps)}\n );\n});\n","/*\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 {chain, focusWithoutScrolling, getOwnerDocument, getOwnerWindow, isMac, isVirtualClick, isVirtualPointerEvent, mergeProps, openLink, useEffectEvent, useGlobalListeners, useSyncRef} from '@react-aria/utils';\nimport {disableTextSelection, restoreTextSelection} from './textSelection';\nimport {DOMAttributes, FocusableElement, PressEvent as IPressEvent, PointerType, PressEvents} from '@react-types/shared';\nimport {PressResponderContext} from './context';\nimport {RefObject, useContext, useEffect, useMemo, useRef, useState} from 'react';\n\nexport interface PressProps extends PressEvents {\n /** Whether the target is in a controlled press state (e.g. an overlay it triggers is open). */\n isPressed?: boolean,\n /** Whether the press events should be disabled. */\n isDisabled?: boolean,\n /** Whether the target should not receive focus on press. */\n preventFocusOnPress?: boolean,\n /**\n * Whether press events should be canceled when the pointer leaves the target while pressed.\n * By default, this is `false`, which means if the pointer returns back over the target while\n * still pressed, onPressStart will be fired again. If set to `true`, the press is canceled\n * when the pointer leaves the target and onPressStart will not be fired if the pointer returns.\n */\n shouldCancelOnPointerExit?: boolean,\n /** Whether text selection should be enabled on the pressable element. */\n allowTextSelectionOnPress?: boolean\n}\n\nexport interface PressHookProps extends PressProps {\n /** A ref to the target element. */\n ref?: RefObject<Element>\n}\n\ninterface PressState {\n isPressed: boolean,\n ignoreEmulatedMouseEvents: boolean,\n ignoreClickAfterPress: boolean,\n didFirePressStart: boolean,\n isTriggeringEvent: boolean,\n activePointerId: any,\n target: FocusableElement | null,\n isOverTarget: boolean,\n pointerType: PointerType | null,\n userSelect?: string,\n metaKeyEvents?: Map<string, KeyboardEvent>\n}\n\ninterface EventBase {\n currentTarget: EventTarget | null,\n shiftKey: boolean,\n ctrlKey: boolean,\n metaKey: boolean,\n altKey: boolean\n}\n\nexport interface PressResult {\n /** Whether the target is currently pressed. */\n isPressed: boolean,\n /** Props to spread on the target element. */\n pressProps: DOMAttributes\n}\n\nfunction usePressResponderContext(props: PressHookProps): PressHookProps {\n // Consume context from <PressResponder> and merge with props.\n let context = useContext(PressResponderContext);\n if (context) {\n let {register, ...contextProps} = context;\n props = mergeProps(contextProps, props) as PressHookProps;\n register();\n }\n useSyncRef(context, props.ref);\n\n return props;\n}\n\nclass PressEvent implements IPressEvent {\n type: IPressEvent['type'];\n pointerType: PointerType;\n target: Element;\n shiftKey: boolean;\n ctrlKey: boolean;\n metaKey: boolean;\n altKey: boolean;\n #shouldStopPropagation = true;\n\n constructor(type: IPressEvent['type'], pointerType: PointerType, originalEvent: EventBase) {\n this.type = type;\n this.pointerType = pointerType;\n this.target = originalEvent.currentTarget as Element;\n this.shiftKey = originalEvent.shiftKey;\n this.metaKey = originalEvent.metaKey;\n this.ctrlKey = originalEvent.ctrlKey;\n this.altKey = originalEvent.altKey;\n }\n\n continuePropagation() {\n this.#shouldStopPropagation = false;\n }\n\n get shouldStopPropagation() {\n return this.#shouldStopPropagation;\n }\n}\n\nconst LINK_CLICKED = Symbol('linkClicked');\n\n/**\n * Handles press interactions across mouse, touch, keyboard, and screen readers.\n * It normalizes behavior across browsers and platforms, and handles many nuances\n * of dealing with pointer and keyboard events.\n */\nexport function usePress(props: PressHookProps): PressResult {\n let {\n onPress,\n onPressChange,\n onPressStart,\n onPressEnd,\n onPressUp,\n isDisabled,\n isPressed: isPressedProp,\n preventFocusOnPress,\n shouldCancelOnPointerExit,\n allowTextSelectionOnPress,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ref: _, // Removing `ref` from `domProps` because TypeScript is dumb\n ...domProps\n } = usePressResponderContext(props);\n\n let [isPressed, setPressed] = useState(false);\n let ref = useRef<PressState>({\n isPressed: false,\n ignoreEmulatedMouseEvents: false,\n ignoreClickAfterPress: false,\n didFirePressStart: false,\n isTriggeringEvent: false,\n activePointerId: null,\n target: null,\n isOverTarget: false,\n pointerType: null\n });\n\n let {addGlobalListener, removeAllGlobalListeners} = useGlobalListeners();\n\n let triggerPressStart = useEffectEvent((originalEvent: EventBase, pointerType: PointerType) => {\n let state = ref.current;\n if (isDisabled || state.didFirePressStart) {\n return false;\n }\n\n let shouldStopPropagation = true;\n state.isTriggeringEvent = true;\n if (onPressStart) {\n let event = new PressEvent('pressstart', pointerType, originalEvent);\n onPressStart(event);\n shouldStopPropagation = event.shouldStopPropagation;\n }\n\n if (onPressChange) {\n onPressChange(true);\n }\n\n state.isTriggeringEvent = false;\n state.didFirePressStart = true;\n setPressed(true);\n return shouldStopPropagation;\n });\n\n let triggerPressEnd = useEffectEvent((originalEvent: EventBase, pointerType: PointerType, wasPressed = true) => {\n let state = ref.current;\n if (!state.didFirePressStart) {\n return false;\n }\n\n state.ignoreClickAfterPress = true;\n state.didFirePressStart = false;\n state.isTriggeringEvent = true;\n\n let shouldStopPropagation = true;\n if (onPressEnd) {\n let event = new PressEvent('pressend', pointerType, originalEvent);\n onPressEnd(event);\n shouldStopPropagation = event.shouldStopPropagation;\n }\n\n if (onPressChange) {\n onPressChange(false);\n }\n\n setPressed(false);\n\n if (onPress && wasPressed && !isDisabled) {\n let event = new PressEvent('press', pointerType, originalEvent);\n onPress(event);\n shouldStopPropagation &&= event.shouldStopPropagation;\n }\n\n state.isTriggeringEvent = false;\n return shouldStopPropagation;\n });\n\n let triggerPressUp = useEffectEvent((originalEvent: EventBase, pointerType: PointerType) => {\n let state = ref.current;\n if (isDisabled) {\n return false;\n }\n\n if (onPressUp) {\n state.isTriggeringEvent = true;\n let event = new PressEvent('pressup', pointerType, originalEvent);\n onPressUp(event);\n state.isTriggeringEvent = false;\n return event.shouldStopPropagation;\n }\n\n return true;\n });\n\n let cancel = useEffectEvent((e: EventBase) => {\n let state = ref.current;\n if (state.isPressed && state.target) {\n if (state.isOverTarget && state.pointerType != null) {\n triggerPressEnd(createEvent(state.target, e), state.pointerType, false);\n }\n state.isPressed = false;\n state.isOverTarget = false;\n state.activePointerId = null;\n state.pointerType = null;\n removeAllGlobalListeners();\n if (!allowTextSelectionOnPress) {\n restoreTextSelection(state.target);\n }\n }\n });\n\n let cancelOnPointerExit = useEffectEvent((e: EventBase) => {\n if (shouldCancelOnPointerExit) {\n cancel(e);\n }\n });\n\n let pressProps = useMemo(() => {\n let state = ref.current;\n let pressProps: DOMAttributes = {\n onKeyDown(e) {\n if (isValidKeyboardEvent(e.nativeEvent, e.currentTarget) && e.currentTarget.contains(e.target as Element)) {\n if (shouldPreventDefaultKeyboard(e.target as Element, e.key)) {\n e.preventDefault();\n }\n\n // If the event is repeating, it may have started on a different element\n // after which focus moved to the current element. Ignore these events and\n // only handle the first key down event.\n let shouldStopPropagation = true;\n if (!state.isPressed && !e.repeat) {\n state.target = e.currentTarget;\n state.isPressed = true;\n shouldStopPropagation = triggerPressStart(e, 'keyboard');\n\n // Focus may move before the key up event, so register the event on the document\n // instead of the same element where the key down event occurred. Make it capturing so that it will trigger\n // before stopPropagation from useKeyboard on a child element may happen and thus we can still call triggerPress for the parent element.\n let originalTarget = e.currentTarget;\n let pressUp = (e) => {\n if (isValidKeyboardEvent(e, originalTarget) && !e.repeat && originalTarget.contains(e.target as Element) && state.target) {\n triggerPressUp(createEvent(state.target, e), 'keyboard');\n }\n };\n\n addGlobalListener(getOwnerDocument(e.currentTarget), 'keyup', chain(pressUp, onKeyUp), true);\n }\n\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n\n // Keep track of the keydown events that occur while the Meta (e.g. Command) key is held.\n // macOS has a bug where keyup events are not fired while the Meta key is down.\n // When the Meta key itself is released we will get an event for that, and we'll act as if\n // all of these other keys were released as well.\n // https://bugs.chromium.org/p/chromium/issues/detail?id=1393524\n // https://bugs.webkit.org/show_bug.cgi?id=55291\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1299553\n if (e.metaKey && isMac()) {\n state.metaKeyEvents?.set(e.key, e.nativeEvent);\n }\n } else if (e.key === 'Meta') {\n state.metaKeyEvents = new Map();\n }\n },\n onClick(e) {\n if (e && !e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n if (e && e.button === 0 && !state.isTriggeringEvent && !(openLink as any).isOpening) {\n let shouldStopPropagation = true;\n if (isDisabled) {\n e.preventDefault();\n }\n\n // If triggered from a screen reader or by using element.click(),\n // trigger as if it were a keyboard click.\n if (!state.ignoreClickAfterPress && !state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === 'virtual' || isVirtualClick(e.nativeEvent))) {\n // Ensure the element receives focus (VoiceOver on iOS does not do this)\n if (!isDisabled && !preventFocusOnPress) {\n focusWithoutScrolling(e.currentTarget);\n }\n\n let stopPressStart = triggerPressStart(e, 'virtual');\n let stopPressUp = triggerPressUp(e, 'virtual');\n let stopPressEnd = triggerPressEnd(e, 'virtual');\n shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;\n }\n\n state.ignoreEmulatedMouseEvents = false;\n state.ignoreClickAfterPress = false;\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n }\n }\n };\n\n let onKeyUp = (e: KeyboardEvent) => {\n if (state.isPressed && state.target && isValidKeyboardEvent(e, state.target)) {\n if (shouldPreventDefaultKeyboard(e.target as Element, e.key)) {\n e.preventDefault();\n }\n\n let target = e.target as Element;\n triggerPressEnd(createEvent(state.target, e), 'keyboard', state.target.contains(target));\n removeAllGlobalListeners();\n\n // If a link was triggered with a key other than Enter, open the URL ourselves.\n // This means the link has a role override, and the default browser behavior\n // only applies when using the Enter key.\n if (e.key !== 'Enter' && isHTMLAnchorLink(state.target) && state.target.contains(target) && !e[LINK_CLICKED]) {\n // Store a hidden property on the event so we only trigger link click once,\n // even if there are multiple usePress instances attached to the element.\n e[LINK_CLICKED] = true;\n openLink(state.target, e, false);\n }\n\n state.isPressed = false;\n state.metaKeyEvents?.delete(e.key);\n } else if (e.key === 'Meta' && state.metaKeyEvents?.size) {\n // If we recorded keydown events that occurred while the Meta key was pressed,\n // and those haven't received keyup events already, fire keyup events ourselves.\n // See comment above for more info about the macOS bug causing this.\n let events = state.metaKeyEvents;\n state.metaKeyEvents = undefined;\n for (let event of events.values()) {\n state.target?.dispatchEvent(new KeyboardEvent('keyup', event));\n }\n }\n };\n\n if (typeof PointerEvent !== 'undefined') {\n pressProps.onPointerDown = (e) => {\n // Only handle left clicks, and ignore events that bubbled through portals.\n if (e.button !== 0 || !e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n // iOS safari fires pointer events from VoiceOver with incorrect coordinates/target.\n // Ignore and let the onClick handler take care of it instead.\n // https://bugs.webkit.org/show_bug.cgi?id=222627\n // https://bugs.webkit.org/show_bug.cgi?id=223202\n if (isVirtualPointerEvent(e.nativeEvent)) {\n state.pointerType = 'virtual';\n return;\n }\n\n // Due to browser inconsistencies, especially on mobile browsers, we prevent\n // default on pointer down and handle focusing the pressable element ourselves.\n if (shouldPreventDefault(e.currentTarget as Element)) {\n e.preventDefault();\n }\n\n state.pointerType = e.pointerType;\n\n let shouldStopPropagation = true;\n if (!state.isPressed) {\n state.isPressed = true;\n state.isOverTarget = true;\n state.activePointerId = e.pointerId;\n state.target = e.currentTarget;\n\n if (!isDisabled && !preventFocusOnPress) {\n focusWithoutScrolling(e.currentTarget);\n }\n\n if (!allowTextSelectionOnPress) {\n disableTextSelection(state.target);\n }\n\n shouldStopPropagation = triggerPressStart(e, state.pointerType);\n\n addGlobalListener(getOwnerDocument(e.currentTarget), 'pointermove', onPointerMove, false);\n addGlobalListener(getOwnerDocument(e.currentTarget), 'pointerup', onPointerUp, false);\n addGlobalListener(getOwnerDocument(e.currentTarget), 'pointercancel', onPointerCancel, false);\n }\n\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n };\n\n pressProps.onMouseDown = (e) => {\n if (!e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n if (e.button === 0) {\n // Chrome and Firefox on touch Windows devices require mouse down events\n // to be canceled in addition to pointer events, or an extra asynchronous\n // focus event will be fired.\n if (shouldPreventDefault(e.currentTarget as Element)) {\n e.preventDefault();\n }\n\n e.stopPropagation();\n }\n };\n\n pressProps.onPointerUp = (e) => {\n // iOS fires pointerup with zero width and height, so check the pointerType recorded during pointerdown.\n if (!e.currentTarget.contains(e.target as Element) || state.pointerType === 'virtual') {\n return;\n }\n\n // Only handle left clicks\n // Safari on iOS sometimes fires pointerup events, even\n // when the touch isn't over the target, so double check.\n if (e.button === 0 && isOverTarget(e, e.currentTarget)) {\n triggerPressUp(e, state.pointerType || e.pointerType);\n }\n };\n\n // Safari on iOS < 13.2 does not implement pointerenter/pointerleave events correctly.\n // Use pointer move events instead to implement our own hit testing.\n // See https://bugs.webkit.org/show_bug.cgi?id=199803\n let onPointerMove = (e: PointerEvent) => {\n if (e.pointerId !== state.activePointerId) {\n return;\n }\n\n if (state.target && isOverTarget(e, state.target)) {\n if (!state.isOverTarget && state.pointerType != null) {\n state.isOverTarget = true;\n triggerPressStart(createEvent(state.target, e), state.pointerType);\n }\n } else if (state.target && state.isOverTarget && state.pointerType != null) {\n state.isOverTarget = false;\n triggerPressEnd(createEvent(state.target, e), state.pointerType, false);\n cancelOnPointerExit(e);\n }\n };\n\n let onPointerUp = (e: PointerEvent) => {\n if (e.pointerId === state.activePointerId && state.isPressed && e.button === 0 && state.target) {\n if (isOverTarget(e, state.target) && state.pointerType != null) {\n triggerPressEnd(createEvent(state.target, e), state.pointerType);\n } else if (state.isOverTarget && state.pointerType != null) {\n triggerPressEnd(createEvent(state.target, e), state.pointerType, false);\n }\n\n state.isPressed = false;\n state.isOverTarget = false;\n state.activePointerId = null;\n state.pointerType = null;\n removeAllGlobalListeners();\n if (!allowTextSelectionOnPress) {\n restoreTextSelection(state.target);\n }\n }\n };\n\n let onPointerCancel = (e: PointerEvent) => {\n cancel(e);\n };\n\n pressProps.onDragStart = (e) => {\n if (!e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n // Safari does not call onPointerCancel when a drag starts, whereas Chrome and Firefox do.\n cancel(e);\n };\n } else {\n pressProps.onMouseDown = (e) => {\n // Only handle left clicks\n if (e.button !== 0 || !e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n // Due to browser inconsistencies, especially on mobile browsers, we prevent\n // default on mouse down and handle focusing the pressable element ourselves.\n if (shouldPreventDefault(e.currentTarget)) {\n e.preventDefault();\n }\n\n if (state.ignoreEmulatedMouseEvents) {\n e.stopPropagation();\n return;\n }\n\n state.isPressed = true;\n state.isOverTarget = true;\n state.target = e.currentTarget;\n state.pointerType = isVirtualClick(e.nativeEvent) ? 'virtual' : 'mouse';\n\n if (!isDisabled && !preventFocusOnPress) {\n focusWithoutScrolling(e.currentTarget);\n }\n\n let shouldStopPropagation = triggerPressStart(e, state.pointerType);\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n\n addGlobalListener(getOwnerDocument(e.currentTarget), 'mouseup', onMouseUp, false);\n };\n\n pressProps.onMouseEnter = (e) => {\n if (!e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n let shouldStopPropagation = true;\n if (state.isPressed && !state.ignoreEmulatedMouseEvents && state.pointerType != null) {\n state.isOverTarget = true;\n shouldStopPropagation = triggerPressStart(e, state.pointerType);\n }\n\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n };\n\n pressProps.onMouseLeave = (e) => {\n if (!e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n let shouldStopPropagation = true;\n if (state.isPressed && !state.ignoreEmulatedMouseEvents && state.pointerType != null) {\n state.isOverTarget = false;\n shouldStopPropagation = triggerPressEnd(e, state.pointerType, false);\n cancelOnPointerExit(e);\n }\n\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n };\n\n pressProps.onMouseUp = (e) => {\n if (!e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n if (!state.ignoreEmulatedMouseEvents && e.button === 0) {\n triggerPressUp(e, state.pointerType || 'mouse');\n }\n };\n\n let onMouseUp = (e: MouseEvent) => {\n // Only handle left clicks\n if (e.button !== 0) {\n return;\n }\n\n state.isPressed = false;\n removeAllGlobalListeners();\n\n if (state.ignoreEmulatedMouseEvents) {\n state.ignoreEmulatedMouseEvents = false;\n return;\n }\n\n if (state.target && isOverTarget(e, state.target) && state.pointerType != null) {\n triggerPressEnd(createEvent(state.target, e), state.pointerType);\n } else if (state.target && state.isOverTarget && state.pointerType != null) {\n triggerPressEnd(createEvent(state.target, e), state.pointerType, false);\n }\n\n state.isOverTarget = false;\n };\n\n pressProps.onTouchStart = (e) => {\n if (!e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n let touch = getTouchFromEvent(e.nativeEvent);\n if (!touch) {\n return;\n }\n state.activePointerId = touch.identifier;\n state.ignoreEmulatedMouseEvents = true;\n state.isOverTarget = true;\n state.isPressed = true;\n state.target = e.currentTarget;\n state.pointerType = 'touch';\n\n // Due to browser inconsistencies, especially on mobile browsers, we prevent default\n // on the emulated mouse event and handle focusing the pressable element ourselves.\n if (!isDisabled && !preventFocusOnPress) {\n focusWithoutScrolling(e.currentTarget);\n }\n\n if (!allowTextSelectionOnPress) {\n disableTextSelection(state.target);\n }\n\n let shouldStopPropagation = triggerPressStart(e, state.pointerType);\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n\n addGlobalListener(getOwnerWindow(e.currentTarget), 'scroll', onScroll, true);\n };\n\n pressProps.onTouchMove = (e) => {\n if (!e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n if (!state.isPressed) {\n e.stopPropagation();\n return;\n }\n\n let touch = getTouchById(e.nativeEvent, state.activePointerId);\n let shouldStopPropagation = true;\n if (touch && isOverTarget(touch, e.currentTarget)) {\n if (!state.isOverTarget && state.pointerType != null) {\n state.isOverTarget = true;\n shouldStopPropagation = triggerPressStart(e, state.pointerType);\n }\n } else if (state.isOverTarget && state.pointerType != null) {\n state.isOverTarget = false;\n shouldStopPropagation = triggerPressEnd(e, state.pointerType, false);\n cancelOnPointerExit(e);\n }\n\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n };\n\n pressProps.onTouchEnd = (e) => {\n if (!e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n if (!state.isPressed) {\n e.stopPropagation();\n return;\n }\n\n let touch = getTouchById(e.nativeEvent, state.activePointerId);\n let shouldStopPropagation = true;\n if (touch && isOverTarget(touch, e.currentTarget) && state.pointerType != null) {\n triggerPressUp(e, state.pointerType);\n shouldStopPropagation = triggerPressEnd(e, state.pointerType);\n } else if (state.isOverTarget && state.pointerType != null) {\n shouldStopPropagation = triggerPressEnd(e, state.pointerType, false);\n }\n\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n\n state.isPressed = false;\n state.activePointerId = null;\n state.isOverTarget = false;\n state.ignoreEmulatedMouseEvents = true;\n if (state.target && !allowTextSelectionOnPress) {\n restoreTextSelection(state.target);\n }\n removeAllGlobalListeners();\n };\n\n pressProps.onTouchCancel = (e) => {\n if (!e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n e.stopPropagation();\n if (state.isPressed) {\n cancel(e);\n }\n };\n\n let onScroll = (e: Event) => {\n if (state.isPressed && (e.target as Element).contains(state.target)) {\n cancel({\n currentTarget: state.target,\n shiftKey: false,\n ctrlKey: false,\n metaKey: false,\n altKey: false\n });\n }\n };\n\n pressProps.onDragStart = (e) => {\n if (!e.currentTarget.contains(e.target as Element)) {\n return;\n }\n\n cancel(e);\n };\n }\n\n return pressProps;\n }, [\n addGlobalListener,\n isDisabled,\n preventFocusOnPress,\n removeAllGlobalListeners,\n allowTextSelectionOnPress,\n cancel,\n cancelOnPointerExit,\n triggerPressEnd,\n triggerPressStart,\n triggerPressUp\n ]);\n\n // Remove user-select: none in case component unmounts immediately after pressStart\n // eslint-disable-next-line arrow-body-style\n useEffect(() => {\n return () => {\n if (!allowTextSelectionOnPress) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n restoreTextSelection(ref.current.target ?? undefined);\n }\n };\n }, [allowTextSelectionOnPress]);\n\n return {\n isPressed: isPressedProp || isPressed,\n pressProps: mergeProps(domProps, pressProps)\n };\n}\n\nfunction isHTMLAnchorLink(target: Element): target is HTMLAnchorElement {\n return target.tagName === 'A' && target.hasAttribute('href');\n}\n\nfunction isValidKeyboardEvent(event: KeyboardEvent, currentTarget: Element): boolean {\n const {key, code} = event;\n const element = currentTarget as HTMLElement;\n const role = element.getAttribute('role');\n // Accessibility for keyboards. Space and Enter only.\n // \"Spacebar\" is for IE 11\n return (\n (key === 'Enter' || key === ' ' || key === 'Spacebar' || code === 'Space') &&\n !((element instanceof getOwnerWindow(element).HTMLInputElement && !isValidInputKey(element, key)) ||\n element instanceof getOwnerWindow(element).HTMLTextAreaElement ||\n element.isContentEditable) &&\n // Links should only trigger with Enter key\n !((role === 'link' || (!role && isHTMLAnchorLink(element))) && key !== 'Enter')\n );\n}\n\nfunction getTouchFromEvent(event: TouchEvent): Touch | null {\n const {targetTouches} = event;\n if (targetTouches.length > 0) {\n return targetTouches[0];\n }\n return null;\n}\n\nfunction getTouchById(\n event: TouchEvent,\n pointerId: null | number\n): null | Touch {\n const changedTouches = event.changedTouches;\n for (let i = 0; i < changedTouches.length; i++) {\n const touch = changedTouches[i];\n if (touch.identifier === pointerId) {\n return touch;\n }\n }\n return null;\n}\n\nfunction createEvent(target: FocusableElement, e: EventBase): EventBase {\n return {\n currentTarget: target,\n shiftKey: e.shiftKey,\n ctrlKey: e.ctrlKey,\n metaKey: e.metaKey,\n altKey: e.altKey\n };\n}\n\ninterface Rect {\n top: number,\n right: number,\n bottom: number,\n left: number\n}\n\ninterface EventPoint {\n clientX: number,\n clientY: number,\n width?: number,\n height?: number,\n radiusX?: number,\n radiusY?: number\n}\n\nfunction getPointClientRect(point: EventPoint): Rect {\n let offsetX = 0;\n let offsetY = 0;\n if (point.width !== undefined) {\n offsetX = (point.width / 2);\n } else if (point.radiusX !== undefined) {\n offsetX = point.radiusX;\n }\n if (point.height !== undefined) {\n offsetY = (point.height / 2);\n } else if (point.radiusY !== undefined) {\n offsetY = point.radiusY;\n }\n\n return {\n top: point.clientY - offsetY,\n right: point.clientX + offsetX,\n bottom: point.clientY + offsetY,\n left: point.clientX - offsetX\n };\n}\n\nfunction areRectanglesOverlapping(a: Rect, b: Rect) {\n // check if they cannot overlap on x axis\n if (a.left > b.right || b.left > a.right) {\n return false;\n }\n // check if they cannot overlap on y axis\n if (a.top > b.bottom || b.top > a.bottom) {\n return false;\n }\n return true;\n}\n\nfunction isOverTarget(point: EventPoint, target: Element) {\n let rect = target.getBoundingClientRect();\n let pointRect = getPointClientRect(point);\n return areRectanglesOverlapping(rect, pointRect);\n}\n\nfunction shouldPreventDefault(target: Element) {\n // We cannot prevent default if the target is a draggable element.\n return !(target instanceof HTMLElement) || !target.hasAttribute('draggable');\n}\n\nfunction shouldPreventDefaultKeyboard(target: Element, key: string) {\n if (target instanceof HTMLInputElement) {\n return !isValidInputKey(target, key);\n }\n\n if (target instanceof HTMLButtonElement) {\n return target.type !== 'submit' && target.type !== 'reset';\n }\n\n if (isHTMLAnchorLink(target)) {\n return false;\n }\n\n return true;\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\nfunction isValidInputKey(target: HTMLInputElement, key: string) {\n // Only space should toggle checkboxes and radios, not enter.\n return target.type === 'checkbox' || target.type === 'radio'\n ? key === ' '\n : nonTextInputTypes.has(target.type);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {getOwnerDocument, isIOS, runAfterTransition} from '@react-aria/utils';\n\n// Safari on iOS starts selecting text on long press. The only way to avoid this, it seems,\n// is to add user-select: none to the entire page. Adding it to the pressable element prevents\n// that element from being selected, but nearby elements may still receive selection. We add\n// user-select: none on touch start, and remove it again on touch end to prevent this.\n// This must be implemented using global state to avoid race conditions between multiple elements.\n\n// There are three possible states due to the delay before removing user-select: none after\n// pointer up. The 'default' state always transitions to the 'disabled' state, which transitions\n// to 'restoring'. The 'restoring' state can either transition back to 'disabled' or 'default'.\n\n// For non-iOS devices, we apply user-select: none to the pressed element instead to avoid possible\n// performance issues that arise from applying and removing user-select: none to the entire page\n// (see https://github.com/adobe/react-spectrum/issues/1609).\ntype State = 'default' | 'disabled' | 'restoring';\n\n// Note that state only matters here for iOS. Non-iOS gets user-select: none applied to the target element\n// rather than at the document level so we just need to apply/remove user-select: none for each pressed element individually\nlet state: State = 'default';\nlet savedUserSelect = '';\nlet modifiedElementMap = new WeakMap<Element, string>();\n\nexport function disableTextSelection(target?: Element) {\n if (isIOS()) {\n if (state === 'default') {\n // eslint-disable-next-line no-restricted-globals\n const documentObject = getOwnerDocument(target);\n savedUserSelect = documentObject.documentElement.style.webkitUserSelect;\n documentObject.documentElement.style.webkitUserSelect = 'none';\n }\n\n state = 'disabled';\n } else if (target instanceof HTMLElement || target instanceof SVGElement) {\n // If not iOS, store the target's original user-select and change to user-select: none\n // Ignore state since it doesn't apply for non iOS\n modifiedElementMap.set(target, target.style.userSelect);\n target.style.userSelect = 'none';\n }\n}\n\nexport function restoreTextSelection(target?: Element) {\n if (isIOS()) {\n // If the state is already default, there's nothing to do.\n // If it is restoring, then there's no need to queue a second restore.\n if (state !== 'disabled') {\n return;\n }\n\n state = 'restoring';\n\n // There appears to be a delay on iOS where selection still might occur\n // after pointer up, so wait a bit before removing user-select.\n setTimeout(() => {\n // Wait for any CSS transitions to complete so we don't recompute style\n // for the whole page in the middle of the animation and cause jank.\n runAfterTransition(() => {\n // Avoid race conditions\n if (state === 'restoring') {\n // eslint-disable-next-line no-restricted-globals\n const documentObject = getOwnerDocument(target);\n if (documentObject.documentElement.style.webkitUserSelect === 'none') {\n documentObject.documentElement.style.webkitUserSelect = savedUserSelect || '';\n }\n\n savedUserSelect = '';\n state = 'default';\n }\n });\n }, 300);\n } else if (target instanceof HTMLElement || target instanceof SVGElement) {\n // If not iOS, restore the target's original user-select if any\n // Ignore state since it doesn't apply for non iOS\n if (target && modifiedElementMap.has(target)) {\n let targetOldUserSelect = modifiedElementMap.get(target) as string;\n\n if (target.style.userSelect === 'none') {\n target.style.userSelect = targetOldUserSelect;\n }\n\n if (target.getAttribute('style') === '') {\n target.removeAttribute('style');\n }\n modifiedElementMap.delete(target);\n }\n }\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {FocusableElement} from '@react-types/shared';\nimport {PressProps} from './usePress';\nimport React, {MutableRefObject} from 'react';\n\ninterface IPressResponderContext extends PressProps {\n register(): void,\n ref?: MutableRefObject<FocusableElement>\n}\n\nexport const PressResponderContext = React.createContext<IPressResponderContext>({register: () => {}});\nPressResponderContext.displayName = 'PressResponderContext';\n","/*\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","/*\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 {DOMAttributes, FocusableElement, FocusEvents} from '@react-types/shared';\nimport {FocusEvent, useCallback} from 'react';\nimport {useSyntheticBlurEvent} from './utils';\n\nexport interface FocusProps<Target = FocusableElement> extends FocusEvents<Target> {\n /** Whether the focus events should be disabled. */\n isDisabled?: boolean\n}\n\nexport interface FocusResult<Target = FocusableElement> {\n /** Props to spread onto the target element. */\n focusProps: DOMAttributes<Target>\n}\n\n/**\n * Handles focus events for the immediate target.\n * Focus events on child elements will be ignored.\n */\nexport function useFocus<Target extends FocusableElement = FocusableElement>(props: FocusProps<Target>): FocusResult<Target> {\n let {\n isDisabled,\n onFocus: onFocusProp,\n onBlur: onBlurProp,\n onFocusChange\n } = props;\n\n const onBlur: FocusProps<Target>['onBlur'] = useCallback((e: FocusEvent<Target>) => {\n if (e.target === e.currentTarget) {\n if (onBlurProp) {\n onBlurProp(e);\n }\n\n if (onFocusChange) {\n onFocusChange(false);\n }\n\n return true;\n }\n }, [onBlurProp, onFocusChange]);\n\n\n const onSyntheticFocus = useSyntheticBlurEvent<Target>(onBlur);\n\n const onFocus: FocusProps<Target>['onFocus'] = useCallback((e: FocusEvent<Target>) => {\n // Double check that document.activeElement actually matches e.target in case a previously chained\n // focus handler already moved focus somewhere else.\n if (e.target === e.currentTarget && document.activeElement === e.target) {\n if (onFocusProp) {\n onFocusProp(e);\n }\n\n if (onFocusChange) {\n onFocusChange(true);\n }\n\n onSyntheticFocus(e);\n }\n }, [onFocusChange, onFocusProp, onSyntheticFocus]);\n\n return {\n focusProps: {\n onFocus: (!isDisabled && (onFocusProp || onFocusChange || onBlurProp)) ? onFocus : undefined,\n onBlur: (!isDisabled && (onBlurProp || onFocusChange)) ? onBlur : undefined\n }\n };\n}\n","/*\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 {FocusEvent as ReactFocusEvent, useCallback, useRef} from 'react';\nimport {useEffectEvent, useLayoutEffect} from '@react-aria/utils';\n\nexport class SyntheticFocusEvent<Target = Element> implements ReactFocusEvent<Target> {\n nativeEvent: FocusEvent;\n target: EventTarget & Target;\n currentTarget: EventTarget & Target;\n relatedTarget: Element;\n bubbles: boolean;\n cancelable: boolean;\n defaultPrevented: boolean;\n eventPhase: number;\n isTrusted: boolean;\n timeStamp: number;\n type: string;\n\n constructor(type: string, nativeEvent: FocusEvent) {\n this.nativeEvent = nativeEvent;\n this.target = nativeEvent.target as EventTarget & Target;\n this.currentTarget = nativeEvent.currentTarget as EventTarget & Target;\n this.relatedTarget = nativeEvent.relatedTarget as Element;\n this.bubbles = nativeEvent.bubbles;\n this.cancelable = nativeEvent.cancelable;\n this.defaultPrevented = nativeEvent.defaultPrevented;\n this.eventPhase = nativeEvent.eventPhase;\n this.isTrusted = nativeEvent.isTrusted;\n this.timeStamp = nativeEvent.timeStamp;\n this.type = type;\n }\n\n isDefaultPrevented(): boolean {\n return this.nativeEvent.defaultPrevented;\n }\n\n preventDefault(): void {\n this.defaultPrevented = true;\n this.nativeEvent.preventDefault();\n }\n\n stopPropagation(): void {\n this.nativeEvent.stopPropagation();\n this.isPropagationStopped = () => true;\n }\n\n isPropagationStopped(): boolean {\n return false;\n }\n\n persist() {}\n}\n\nexport function useSyntheticBlurEvent<Target = Element>(onBlur: (e: ReactFocusEvent<Target>) => void) {\n let stateRef = useRef({\n isFocused: false,\n observer: null as MutationObserver | null\n });\n\n // Clean up MutationObserver on unmount. See below.\n // eslint-disable-next-line arrow-body-style\n useLayoutEffect(() => {\n const state = stateRef.current;\n return () => {\n if (state.observer) {\n state.observer.disconnect();\n state.observer = null;\n }\n };\n }, []);\n\n let dispatchBlur = useEffectEvent((e: SyntheticFocusEvent<Target>) => {\n onBlur?.(e);\n });\n\n // This function is called during a React onFocus event.\n return useCallback((e: ReactFocusEvent<Target>) => {\n // React does not fire onBlur when an element is disabled. https://github.com/facebook/react/issues/9142\n // Most browsers fire a native focusout event in this case, except for Firefox. In that case, we use a\n // MutationObserver to watch for the disabled attribute, and dispatch these events ourselves.\n // For browsers that do, focusout fires before the MutationObserver, so onBlur should not fire twice.\n if (\n e.target instanceof HTMLButtonElement ||\n e.target instanceof HTMLInputElement ||\n e.target instanceof HTMLTextAreaElement ||\n e.target instanceof HTMLSelectElement\n ) {\n stateRef.current.isFocused = true;\n\n let target = e.target;\n let onBlurHandler: EventListenerOrEventListenerObject | null = (e) => {\n stateRef.current.isFocused = false;\n\n if (target.disabled) {\n // For backward compatibility, dispatch a (fake) React synthetic event.\n dispatchBlur(new SyntheticFocusEvent('blur', e as FocusEvent));\n }\n\n // We no longer need the MutationObserver once the target is blurred.\n if (stateRef.current.observer) {\n stateRef.current.observer.disconnect();\n stateRef.current.observer = null;\n }\n };\n\n target.addEventListener('focusout', onBlurHandler, {once: true});\n\n stateRef.current.observer = new MutationObserver(() => {\n if (stateRef.current.isFocused && target.disabled) {\n stateRef.current.observer?.disconnect();\n let relatedTargetEl = target === document.activeElement ? null : document.activeElement;\n target.dispatchEvent(new FocusEvent('blur', {relatedTarget: relatedTargetEl}));\n target.dispatchEvent(new FocusEvent('focusout', {bubbles: true, relatedTarget: relatedTargetEl}));\n }\n });\n\n stateRef.current.observer.observe(target, {attributes: true, attributeFilter: ['disabled']});\n }\n }, [dispatchBlur]);\n}\n","/*\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 {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) {\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 // 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 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 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 isTextInput = isTextInput ||\n (e?.target instanceof IHTMLInputElement && !nonTextInputTypes.has(e?.target?.type)) ||\n e?.target instanceof IHTMLTextAreaElement ||\n (e?.target instanceof IHTMLElement && e?.target.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 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","/*\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 {DOMAttributes} from '@react-types/shared';\nimport {FocusEvent, useCallback, useRef} from 'react';\nimport {useSyntheticBlurEvent} from './utils';\n\nexport interface FocusWithinProps {\n /** Whether the focus within events should be disabled. */\n isDisabled?: boolean,\n /** Handler that is called when the target element or a descendant receives focus. */\n onFocusWithin?: (e: FocusEvent) => void,\n /** Handler that is called when the target element and all descendants lose focus. */\n onBlurWithin?: (e: FocusEvent) => void,\n /** Handler that is called when the the focus within state changes. */\n onFocusWithinChange?: (isFocusWithin: boolean) => void\n}\n\nexport interface FocusWithinResult {\n /** Props to spread onto the target element. */\n focusWithinProps: DOMAttributes\n}\n\n/**\n * Handles focus events for the target and its descendants.\n */\nexport function useFocusWithin(props: FocusWithinProps): FocusWithinResult {\n let {\n isDisabled,\n onBlurWithin,\n onFocusWithin,\n onFocusWithinChange\n } = props;\n let state = useRef({\n isFocusWithin: false\n });\n\n let onBlur = useCallback((e: FocusEvent) => {\n // We don't want to trigger onBlurWithin and then immediately onFocusWithin again\n // when moving focus inside the element. Only trigger if the currentTarget doesn't\n // include the relatedTarget (where focus is moving).\n if (state.current.isFocusWithin && !(e.currentTarget as Element).contains(e.relatedTarget as Element)) {\n state.current.isFocusWithin = false;\n\n if (onBlurWithin) {\n onBlurWithin(e);\n }\n\n if (onFocusWithinChange) {\n onFocusWithinChange(false);\n }\n }\n }, [onBlurWithin, onFocusWithinChange, state]);\n\n let onSyntheticFocus = useSyntheticBlurEvent(onBlur);\n let onFocus = useCallback((e: FocusEvent) => {\n // Double check that document.activeElement actually matches e.target in case a previously chained\n // focus handler already moved focus somewhere else.\n if (!state.current.isFocusWithin && document.activeElement === e.target) {\n if (onFocusWithin) {\n onFocusWithin(e);\n }\n\n if (onFocusWithinChange) {\n onFocusWithinChange(true);\n }\n\n state.current.isFocusWithin = true;\n onSyntheticFocus(e);\n }\n }, [onFocusWithin, onFocusWithinChange, onSyntheticFocus]);\n\n if (isDisabled) {\n return {\n focusWithinProps: {\n // These should not have been null, that would conflict in mergeProps\n onFocus: undefined,\n onBlur: undefined\n }\n };\n }\n\n return {\n focusWithinProps: {\n onFocus,\n onBlur\n }\n };\n}\n","/*\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 {DOMAttributes, HoverEvents} from '@react-types/shared';\nimport {useEffect, useMemo, useRef, useState} from 'react';\n\nexport interface HoverProps extends HoverEvents {\n /** Whether the hover events should be disabled. */\n isDisabled?: boolean\n}\n\nexport interface HoverResult {\n /** Props to spread on the target element. */\n hoverProps: DOMAttributes,\n isHovered: boolean\n}\n\n// iOS fires onPointerEnter twice: once with pointerType=\"touch\" and again with pointerType=\"mouse\".\n// We want to ignore these emulated events so they do not trigger hover behavior.\n// See https://bugs.webkit.org/show_bug.cgi?id=214609.\nlet globalIgnoreEmulatedMouseEvents = false;\nlet hoverCount = 0;\n\nfunction setGlobalIgnoreEmulatedMouseEvents() {\n globalIgnoreEmulatedMouseEvents = true;\n\n // Clear globalIgnoreEmulatedMouseEvents after a short timeout. iOS fires onPointerEnter\n // with pointerType=\"mouse\" immediately after onPointerUp and before onFocus. On other\n // devices that don't have this quirk, we don't want to ignore a mouse hover sometime in\n // the distant future because a user previously touched the element.\n setTimeout(() => {\n globalIgnoreEmulatedMouseEvents = false;\n }, 50);\n}\n\nfunction handleGlobalPointerEvent(e) {\n if (e.pointerType === 'touch') {\n setGlobalIgnoreEmulatedMouseEvents();\n }\n}\n\nfunction setupGlobalTouchEvents() {\n if (typeof document === 'undefined') {\n return;\n }\n\n if (typeof PointerEvent !== 'undefined') {\n document.addEventListener('pointerup', handleGlobalPointerEvent);\n } else {\n document.addEventListener('touchend', setGlobalIgnoreEmulatedMouseEvents);\n }\n\n hoverCount++;\n return () => {\n hoverCount--;\n if (hoverCount > 0) {\n return;\n }\n\n if (typeof PointerEvent !== 'undefined') {\n document.removeEventListener('pointerup', handleGlobalPointerEvent);\n } else {\n document.removeEventListener('touchend', setGlobalIgnoreEmulatedMouseEvents);\n }\n };\n}\n\n/**\n * Handles pointer hover interactions for an element. Normalizes behavior\n * across browsers and platforms, and ignores emulated mouse events on touch devices.\n */\nexport function useHover(props: HoverProps): HoverResult {\n let {\n onHoverStart,\n onHoverChange,\n onHoverEnd,\n isDisabled\n } = props;\n\n let [isHovered, setHovered] = useState(false);\n let state = useRef({\n isHovered: false,\n ignoreEmulatedMouseEvents: false,\n pointerType: '',\n target: null\n }).current;\n\n useEffect(setupGlobalTouchEvents, []);\n\n let {hoverProps, triggerHoverEnd} = useMemo(() => {\n let triggerHoverStart = (event, pointerType) => {\n state.pointerType = pointerType;\n if (isDisabled || pointerType === 'touch' || state.isHovered || !event.currentTarget.contains(event.target)) {\n return;\n }\n\n state.isHovered = true;\n let target = event.currentTarget;\n state.target = target;\n\n if (onHoverStart) {\n onHoverStart({\n type: 'hoverstart',\n target,\n pointerType\n });\n }\n\n if (onHoverChange) {\n onHoverChange(true);\n }\n\n setHovered(true);\n };\n\n let triggerHoverEnd = (event, pointerType) => {\n state.pointerType = '';\n state.target = null;\n\n if (pointerType === 'touch' || !state.isHovered) {\n return;\n }\n\n state.isHovered = false;\n let target = event.currentTarget;\n if (onHoverEnd) {\n onHoverEnd({\n type: 'hoverend',\n target,\n pointerType\n });\n }\n\n if (onHoverChange) {\n onHoverChange(false);\n }\n\n setHovered(false);\n };\n\n let hoverProps: DOMAttributes = {};\n\n if (typeof PointerEvent !== 'undefined') {\n hoverProps.onPointerEnter = (e) => {\n if (globalIgnoreEmulatedMouseEvents && e.pointerType === 'mouse') {\n return;\n }\n\n triggerHoverStart(e, e.pointerType);\n };\n\n hoverProps.onPointerLeave = (e) => {\n if (!isDisabled && e.currentTarget.contains(e.target as Element)) {\n triggerHoverEnd(e, e.pointerType);\n }\n };\n } else {\n hoverProps.onTouchStart = () => {\n state.ignoreEmulatedMouseEvents = true;\n };\n\n hoverProps.onMouseEnter = (e) => {\n if (!state.ignoreEmulatedMouseEvents && !globalIgnoreEmulatedMouseEvents) {\n triggerHoverStart(e, 'mouse');\n }\n\n state.ignoreEmulatedMouseEvents = false;\n };\n\n hoverProps.onMouseLeave = (e) => {\n if (!isDisabled && e.currentTarget.contains(e.target as Element)) {\n triggerHoverEnd(e, 'mouse');\n }\n };\n }\n return {hoverProps, triggerHoverEnd};\n }, [onHoverStart, onHoverChange, onHoverEnd, isDisabled, state]);\n\n useEffect(() => {\n // Call the triggerHoverEnd as soon as isDisabled changes to true\n // Safe to call triggerHoverEnd, it will early return if we aren't currently hovering\n if (isDisabled) {\n triggerHoverEnd({currentTarget: state.target}, state.pointerType);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isDisabled]);\n\n return {\n hoverProps,\n isHovered\n };\n}\n\n","/*\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, useEffectEvent} from '@react-aria/utils';\nimport {RefObject, useEffect, useRef} from 'react';\n\nexport interface InteractOutsideProps {\n ref: RefObject<Element>,\n onInteractOutside?: (e: PointerEvent) => void,\n onInteractOutsideStart?: (e: PointerEvent) => void,\n /** Whether the interact outside events should be disabled. */\n isDisabled?: boolean\n}\n\n/**\n * Example, used in components like Dialogs and Popovers so they can close\n * when a user clicks outside them.\n */\nexport function useInteractOutside(props: InteractOutsideProps) {\n let {ref, onInteractOutside, isDisabled, onInteractOutsideStart} = props;\n let stateRef = useRef({\n isPointerDown: false,\n ignoreEmulatedMouseEvents: false\n });\n\n let onPointerDown = useEffectEvent((e) => {\n if (onInteractOutside && isValidEvent(e, ref)) {\n if (onInteractOutsideStart) {\n onInteractOutsideStart(e);\n }\n stateRef.current.isPointerDown = true;\n }\n });\n\n let triggerInteractOutside = useEffectEvent((e: PointerEvent) => {\n if (onInteractOutside) {\n onInteractOutside(e);\n }\n });\n\n useEffect(() => {\n let state = stateRef.current;\n if (isDisabled) {\n return;\n }\n\n const element = ref.current;\n const documentObject = getOwnerDocument(element);\n\n // Use pointer events if available. Otherwise, fall back to mouse and touch events.\n if (typeof PointerEvent !== 'undefined') {\n let onPointerUp = (e) => {\n if (state.isPointerDown && isValidEvent(e, ref)) {\n triggerInteractOutside(e);\n }\n state.isPointerDown = false;\n };\n\n // changing these to capture phase fixed combobox\n documentObject.addEventListener('pointerdown', onPointerDown, true);\n documentObject.addEventListener('pointerup', onPointerUp, true);\n\n return () => {\n documentObject.removeEventListener('pointerdown', onPointerDown, true);\n documentObject.removeEventListener('pointerup', onPointerUp, true);\n };\n } else {\n let onMouseUp = (e) => {\n if (state.ignoreEmulatedMouseEvents) {\n state.ignoreEmulatedMouseEvents = false;\n } else if (state.isPointerDown && isValidEvent(e, ref)) {\n triggerInteractOutside(e);\n }\n state.isPointerDown = false;\n };\n\n let onTouchEnd = (e) => {\n state.ignoreEmulatedMouseEvents = true;\n if (state.isPointerDown && isValidEvent(e, ref)) {\n triggerInteractOutside(e);\n }\n state.isPointerDown = false;\n };\n\n documentObject.addEventListener('mousedown', onPointerDown, true);\n documentObject.addEventListener('mouseup', onMouseUp, true);\n documentObject.addEventListener('touchstart', onPointerDown, true);\n documentObject.addEventListener('touchend', onTouchEnd, true);\n\n return () => {\n documentObject.removeEventListener('mousedown', onPointerDown, true);\n documentObject.removeEventListener('mouseup', onMouseUp, true);\n documentObject.removeEventListener('touchstart', onPointerDown, true);\n documentObject.removeEventListener('touchend', onTouchEnd, true);\n };\n }\n }, [ref, isDisabled, onPointerDown, triggerInteractOutside]);\n}\n\nfunction isValidEvent(event, ref) {\n if (event.button > 0) {\n return false;\n }\n\n if (event.target) {\n // if the event target is no longer in the document, ignore\n const ownerDocument = event.target.ownerDocument;\n if (!ownerDocument || !ownerDocument.documentElement.contains(event.target)) {\n return false;\n }\n\n // If the target is within a top layer element (e.g. toasts), ignore.\n if (event.target.closest('[data-react-aria-top-layer]')) {\n return false;\n }\n }\n\n return ref.current && !ref.current.contains(event.target);\n}\n","/*\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 {createEventHandler} from './createEventHandler';\nimport {DOMAttributes, KeyboardEvents} from '@react-types/shared';\n\nexport interface KeyboardProps extends KeyboardEvents {\n /** Whether the keyboard events should be disabled. */\n isDisabled?: boolean\n}\n\nexport interface KeyboardResult {\n /** Props to spread onto the target element. */\n keyboardProps: DOMAttributes\n}\n\n/**\n * Handles keyboard interactions for a focusable element.\n */\nexport function useKeyboard(props: KeyboardProps): KeyboardResult {\n return {\n keyboardProps: props.isDisabled ? {} : {\n onKeyDown: createEventHandler(props.onKeyDown),\n onKeyUp: createEventHandler(props.onKeyUp)\n }\n };\n}\n","/*\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 console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');\n },\n continuePropagation() {\n shouldStopPropagation = false;\n }\n };\n\n handler(event);\n\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n };\n}\n","/*\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 {disableTextSelection, restoreTextSelection} from './textSelection';\nimport {DOMAttributes, MoveEvents, PointerType} from '@react-types/shared';\nimport React, {useMemo, useRef} from 'react';\nimport {useEffectEvent, useGlobalListeners} from '@react-aria/utils';\n\nexport interface MoveResult {\n /** Props to spread on the target element. */\n moveProps: DOMAttributes\n}\n\ninterface EventBase {\n shiftKey: boolean,\n ctrlKey: boolean,\n metaKey: boolean,\n altKey: boolean\n}\n\n/**\n * Handles move interactions across mouse, touch, and keyboard, including dragging with\n * the mouse or touch, and using the arrow keys. Normalizes behavior across browsers and\n * platforms, and ignores emulated mouse events on touch devices.\n */\nexport function useMove(props: MoveEvents): MoveResult {\n let {onMoveStart, onMove, onMoveEnd} = props;\n\n let state = useRef<{\n didMove: boolean,\n lastPosition: {pageX: number, pageY: number} | null,\n id: number | null\n }>({didMove: false, lastPosition: null, id: null});\n\n let {addGlobalListener, removeGlobalListener} = useGlobalListeners();\n\n let move = useEffectEvent((originalEvent: EventBase, pointerType: PointerType, deltaX: number, deltaY: number) => {\n if (deltaX === 0 && deltaY === 0) {\n return;\n }\n\n if (!state.current.didMove) {\n state.current.didMove = true;\n onMoveStart?.({\n type: 'movestart',\n pointerType,\n shiftKey: originalEvent.shiftKey,\n metaKey: originalEvent.metaKey,\n ctrlKey: originalEvent.ctrlKey,\n altKey: originalEvent.altKey\n });\n }\n onMove?.({\n type: 'move',\n pointerType,\n deltaX: deltaX,\n deltaY: deltaY,\n shiftKey: originalEvent.shiftKey,\n metaKey: originalEvent.metaKey,\n ctrlKey: originalEvent.ctrlKey,\n altKey: originalEvent.altKey\n });\n });\n\n let end = useEffectEvent((originalEvent: EventBase, pointerType: PointerType) => {\n restoreTextSelection();\n if (state.current.didMove) {\n onMoveEnd?.({\n type: 'moveend',\n pointerType,\n shiftKey: originalEvent.shiftKey,\n metaKey: originalEvent.metaKey,\n ctrlKey: originalEvent.ctrlKey,\n altKey: originalEvent.altKey\n });\n }\n });\n\n let moveProps = useMemo(() => {\n let moveProps: DOMAttributes = {};\n\n let start = () => {\n disableTextSelection();\n state.current.didMove = false;\n };\n\n if (typeof PointerEvent === 'undefined') {\n let onMouseMove = (e: MouseEvent) => {\n if (e.button === 0) {\n move(e, 'mouse', e.pageX - (state.current.lastPosition?.pageX ?? 0), e.pageY - (state.current.lastPosition?.pageY ?? 0));\n state.current.lastPosition = {pageX: e.pageX, pageY: e.pageY};\n }\n };\n let onMouseUp = (e: MouseEvent) => {\n if (e.button === 0) {\n end(e, 'mouse');\n removeGlobalListener(window, 'mousemove', onMouseMove, false);\n removeGlobalListener(window, 'mouseup', onMouseUp, false);\n }\n };\n moveProps.onMouseDown = (e: React.MouseEvent) => {\n if (e.button === 0) {\n start();\n e.stopPropagation();\n e.preventDefault();\n state.current.lastPosition = {pageX: e.pageX, pageY: e.pageY};\n addGlobalListener(window, 'mousemove', onMouseMove, false);\n addGlobalListener(window, 'mouseup', onMouseUp, false);\n }\n };\n\n let onTouchMove = (e: TouchEvent) => {\n let touch = [...e.changedTouches].findIndex(({identifier}) => identifier === state.current.id);\n if (touch >= 0) {\n let {pageX, pageY} = e.changedTouches[touch];\n move(e, 'touch', pageX - (state.current.lastPosition?.pageX ?? 0), pageY - (state.current.lastPosition?.pageY ?? 0));\n state.current.lastPosition = {pageX, pageY};\n }\n };\n let onTouchEnd = (e: TouchEvent) => {\n let touch = [...e.changedTouches].findIndex(({identifier}) => identifier === state.current.id);\n if (touch >= 0) {\n end(e, 'touch');\n state.current.id = null;\n removeGlobalListener(window, 'touchmove', onTouchMove);\n removeGlobalListener(window, 'touchend', onTouchEnd);\n removeGlobalListener(window, 'touchcancel', onTouchEnd);\n }\n };\n moveProps.onTouchStart = (e: React.TouchEvent) => {\n if (e.changedTouches.length === 0 || state.current.id != null) {\n return;\n }\n\n let {pageX, pageY, identifier} = e.changedTouches[0];\n start();\n e.stopPropagation();\n e.preventDefault();\n state.current.lastPosition = {pageX, pageY};\n state.current.id = identifier;\n addGlobalListener(window, 'touchmove', onTouchMove, false);\n addGlobalListener(window, 'touchend', onTouchEnd, false);\n addGlobalListener(window, 'touchcancel', onTouchEnd, false);\n };\n } else {\n let onPointerMove = (e: PointerEvent) => {\n if (e.pointerId === state.current.id) {\n let pointerType = (e.pointerType || 'mouse') as PointerType;\n\n // Problems with PointerEvent#movementX/movementY:\n // 1. it is always 0 on macOS Safari.\n // 2. On Chrome Android, it's scaled by devicePixelRatio, but not on Chrome macOS\n move(e, pointerType, e.pageX - (state.current.lastPosition?.pageX ?? 0), e.pageY - (state.current.lastPosition?.pageY ?? 0));\n state.current.lastPosition = {pageX: e.pageX, pageY: e.pageY};\n }\n };\n\n let onPointerUp = (e: PointerEvent) => {\n if (e.pointerId === state.current.id) {\n let pointerType = (e.pointerType || 'mouse') as PointerType;\n end(e, pointerType);\n state.current.id = null;\n removeGlobalListener(window, 'pointermove', onPointerMove, false);\n removeGlobalListener(window, 'pointerup', onPointerUp, false);\n removeGlobalListener(window, 'pointercancel', onPointerUp, false);\n }\n };\n\n moveProps.onPointerDown = (e: React.PointerEvent) => {\n if (e.button === 0 && state.current.id == null) {\n start();\n e.stopPropagation();\n e.preventDefault();\n state.current.lastPosition = {pageX: e.pageX, pageY: e.pageY};\n state.current.id = e.pointerId;\n addGlobalListener(window, 'pointermove', onPointerMove, false);\n addGlobalListener(window, 'pointerup', onPointerUp, false);\n addGlobalListener(window, 'pointercancel', onPointerUp, false);\n }\n };\n }\n\n let triggerKeyboardMove = (e: EventBase, deltaX: number, deltaY: number) => {\n start();\n move(e, 'keyboard', deltaX, deltaY);\n end(e, 'keyboard');\n };\n\n moveProps.onKeyDown = (e) => {\n switch (e.key) {\n case 'Left':\n case 'ArrowLeft':\n e.preventDefault();\n e.stopPropagation();\n triggerKeyboardMove(e, -1, 0);\n break;\n case 'Right':\n case 'ArrowRight':\n e.preventDefault();\n e.stopPropagation();\n triggerKeyboardMove(e, 1, 0);\n break;\n case 'Up':\n case 'ArrowUp':\n e.preventDefault();\n e.stopPropagation();\n triggerKeyboardMove(e, 0, -1);\n break;\n case 'Down':\n case 'ArrowDown':\n e.preventDefault();\n e.stopPropagation();\n triggerKeyboardMove(e, 0, 1);\n break;\n }\n };\n\n return moveProps;\n }, [state, addGlobalListener, removeGlobalListener, move, end]);\n\n return {moveProps};\n}\n","/*\n * Copyright 2021 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 {RefObject, useCallback} from 'react';\nimport {ScrollEvents} from '@react-types/shared';\nimport {useEvent} from '@react-aria/utils';\n\nexport interface ScrollWheelProps extends ScrollEvents {\n /** Whether the scroll listener should be disabled. */\n isDisabled?: boolean\n}\n\n// scroll wheel needs to be added not passively so it's cancelable, small helper hook to remember that\nexport function useScrollWheel(props: ScrollWheelProps, ref: RefObject<HTMLElement>): void {\n let {onScroll, isDisabled} = props;\n let onScrollHandler = useCallback((e) => {\n // If the ctrlKey is pressed, this is a zoom event, do nothing.\n if (e.ctrlKey) {\n return;\n }\n\n // stop scrolling the page\n e.preventDefault();\n e.stopPropagation();\n\n if (onScroll) {\n onScroll({deltaX: e.deltaX, deltaY: e.deltaY});\n }\n }, [onScroll]);\n\n useEvent(ref, 'wheel', isDisabled ? undefined : onScrollHandler);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMAttributes, LongPressEvent} from '@react-types/shared';\nimport {mergeProps, useDescription, useGlobalListeners} from '@react-aria/utils';\nimport {usePress} from './usePress';\nimport {useRef} from 'react';\n\nexport interface LongPressProps {\n /** Whether long press events should be disabled. */\n isDisabled?: boolean,\n /** Handler that is called when a long press interaction starts. */\n onLongPressStart?: (e: LongPressEvent) => void,\n /**\n * Handler that is called when a long press interaction ends, either\n * over the target or when the pointer leaves the target.\n */\n onLongPressEnd?: (e: LongPressEvent) => void,\n /**\n * Handler that is called when the threshold time is met while\n * the press is over the target.\n */\n onLongPress?: (e: LongPressEvent) => void,\n /**\n * The amount of time in milliseconds to wait before triggering a long press.\n * @default 500ms\n */\n threshold?: number,\n /**\n * A description for assistive techology users indicating that a long press\n * action is available, e.g. \"Long press to open menu\".\n */\n accessibilityDescription?: string\n}\n\nexport interface LongPressResult {\n /** Props to spread on the target element. */\n longPressProps: DOMAttributes\n}\n\nconst DEFAULT_THRESHOLD = 500;\n\n/**\n * Handles long press interactions across mouse and touch devices. Supports a customizable time threshold,\n * accessibility description, and normalizes behavior across browsers and devices.\n */\nexport function useLongPress(props: LongPressProps): LongPressResult {\n let {\n isDisabled,\n onLongPressStart,\n onLongPressEnd,\n onLongPress,\n threshold = DEFAULT_THRESHOLD,\n accessibilityDescription\n } = props;\n\n const timeRef = useRef<ReturnType<typeof setTimeout> | undefined>();\n let {addGlobalListener, removeGlobalListener} = useGlobalListeners();\n\n let {pressProps} = usePress({\n isDisabled,\n onPressStart(e) {\n e.continuePropagation();\n if (e.pointerType === 'mouse' || e.pointerType === 'touch') {\n if (onLongPressStart) {\n onLongPressStart({\n ...e,\n type: 'longpressstart'\n });\n }\n\n timeRef.current = setTimeout(() => {\n // Prevent other usePress handlers from also handling this event.\n e.target.dispatchEvent(new PointerEvent('pointercancel', {bubbles: true}));\n if (onLongPress) {\n onLongPress({\n ...e,\n type: 'longpress'\n });\n }\n timeRef.current = undefined;\n }, threshold);\n\n // Prevent context menu, which may be opened on long press on touch devices\n if (e.pointerType === 'touch') {\n let onContextMenu = e => {\n e.preventDefault();\n };\n\n addGlobalListener(e.target, 'contextmenu', onContextMenu, {once: true});\n addGlobalListener(window, 'pointerup', () => {\n // If no contextmenu event is fired quickly after pointerup, remove the handler\n // so future context menu events outside a long press are not prevented.\n setTimeout(() => {\n removeGlobalListener(e.target, 'contextmenu', onContextMenu);\n }, 30);\n }, {once: true});\n }\n }\n },\n onPressEnd(e) {\n if (timeRef.current) {\n clearTimeout(timeRef.current);\n }\n\n if (onLongPressEnd && (e.pointerType === 'mouse' || e.pointerType === 'touch')) {\n onLongPressEnd({\n ...e,\n type: 'longpressend'\n });\n }\n }\n });\n\n let descriptionProps = useDescription(onLongPress && !isDisabled ? accessibilityDescription : undefined);\n\n return {\n longPressProps: mergeProps(pressProps, descriptionProps)\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/interactions/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {Pressable} from './Pressable';\nexport {PressResponder, ClearPressResponder} from './PressResponder';\nexport {useFocus} from './useFocus';\nexport {\n isFocusVisible,\n getInteractionModality,\n setInteractionModality,\n addWindowFocusTracking,\n useInteractionModality,\n useFocusVisible,\n useFocusVisibleListener\n} from './useFocusVisible';\nexport {useFocusWithin} from './useFocusWithin';\nexport {useHover} from './useHover';\nexport {useInteractOutside} from './useInteractOutside';\nexport {useKeyboard} from './useKeyboard';\nexport {useMove} from './useMove';\nexport {usePress} from './usePress';\nexport {useScrollWheel} from './useScrollWheel';\nexport {useLongPress} from './useLongPress';\n\nexport type {FocusProps, FocusResult} from './useFocus';\nexport type {FocusVisibleHandler, FocusVisibleProps, FocusVisibleResult, Modality} from './useFocusVisible';\nexport type {FocusWithinProps, FocusWithinResult} from './useFocusWithin';\nexport type {HoverProps, HoverResult} from './useHover';\nexport type {InteractOutsideProps} from './useInteractOutside';\nexport type {KeyboardProps, KeyboardResult} from './useKeyboard';\nexport type {PressProps, PressHookProps, PressResult} from './usePress';\nexport type {PressEvent, PressEvents, MoveStartEvent, MoveMoveEvent, MoveEndEvent, MoveEvents, HoverEvent, HoverEvents, FocusEvents, KeyboardEvents} from '@react-types/shared';\nexport type {MoveResult} from './useMove';\nexport type {LongPressProps, LongPressResult} from './useLongPress';\nexport type {ScrollWheelProps} from './useScrollWheel';\n"],"names":[],"version":3,"file":"module.js.map"}
@@ -0,0 +1,77 @@
1
+ var $20aJV$reactariautils = require("@react-aria/utils");
2
+
3
+
4
+ function $parcel$export(e, n, v, s) {
5
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
6
+ }
7
+
8
+ $parcel$export(module.exports, "disableTextSelection", () => $f7e14e656343df57$export$16a4697467175487);
9
+ $parcel$export(module.exports, "restoreTextSelection", () => $f7e14e656343df57$export$b0d6fa1ab32e3295);
10
+ /*
11
+ * Copyright 2020 Adobe. All rights reserved.
12
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License. You may obtain a copy
14
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software distributed under
17
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
18
+ * OF ANY KIND, either express or implied. See the License for the specific language
19
+ * governing permissions and limitations under the License.
20
+ */
21
+ // Note that state only matters here for iOS. Non-iOS gets user-select: none applied to the target element
22
+ // rather than at the document level so we just need to apply/remove user-select: none for each pressed element individually
23
+ let $f7e14e656343df57$var$state = "default";
24
+ let $f7e14e656343df57$var$savedUserSelect = "";
25
+ let $f7e14e656343df57$var$modifiedElementMap = new WeakMap();
26
+ function $f7e14e656343df57$export$16a4697467175487(target) {
27
+ if ((0, $20aJV$reactariautils.isIOS)()) {
28
+ if ($f7e14e656343df57$var$state === "default") {
29
+ // eslint-disable-next-line no-restricted-globals
30
+ const documentObject = (0, $20aJV$reactariautils.getOwnerDocument)(target);
31
+ $f7e14e656343df57$var$savedUserSelect = documentObject.documentElement.style.webkitUserSelect;
32
+ documentObject.documentElement.style.webkitUserSelect = "none";
33
+ }
34
+ $f7e14e656343df57$var$state = "disabled";
35
+ } else if (target instanceof HTMLElement || target instanceof SVGElement) {
36
+ // If not iOS, store the target's original user-select and change to user-select: none
37
+ // Ignore state since it doesn't apply for non iOS
38
+ $f7e14e656343df57$var$modifiedElementMap.set(target, target.style.userSelect);
39
+ target.style.userSelect = "none";
40
+ }
41
+ }
42
+ function $f7e14e656343df57$export$b0d6fa1ab32e3295(target) {
43
+ if ((0, $20aJV$reactariautils.isIOS)()) {
44
+ // If the state is already default, there's nothing to do.
45
+ // If it is restoring, then there's no need to queue a second restore.
46
+ if ($f7e14e656343df57$var$state !== "disabled") return;
47
+ $f7e14e656343df57$var$state = "restoring";
48
+ // There appears to be a delay on iOS where selection still might occur
49
+ // after pointer up, so wait a bit before removing user-select.
50
+ setTimeout(()=>{
51
+ // Wait for any CSS transitions to complete so we don't recompute style
52
+ // for the whole page in the middle of the animation and cause jank.
53
+ (0, $20aJV$reactariautils.runAfterTransition)(()=>{
54
+ // Avoid race conditions
55
+ if ($f7e14e656343df57$var$state === "restoring") {
56
+ // eslint-disable-next-line no-restricted-globals
57
+ const documentObject = (0, $20aJV$reactariautils.getOwnerDocument)(target);
58
+ if (documentObject.documentElement.style.webkitUserSelect === "none") documentObject.documentElement.style.webkitUserSelect = $f7e14e656343df57$var$savedUserSelect || "";
59
+ $f7e14e656343df57$var$savedUserSelect = "";
60
+ $f7e14e656343df57$var$state = "default";
61
+ }
62
+ });
63
+ }, 300);
64
+ } else if (target instanceof HTMLElement || target instanceof SVGElement) // If not iOS, restore the target's original user-select if any
65
+ // Ignore state since it doesn't apply for non iOS
66
+ {
67
+ if (target && $f7e14e656343df57$var$modifiedElementMap.has(target)) {
68
+ let targetOldUserSelect = $f7e14e656343df57$var$modifiedElementMap.get(target);
69
+ if (target.style.userSelect === "none") target.style.userSelect = targetOldUserSelect;
70
+ if (target.getAttribute("style") === "") target.removeAttribute("style");
71
+ $f7e14e656343df57$var$modifiedElementMap.delete(target);
72
+ }
73
+ }
74
+ }
75
+
76
+
77
+ //# sourceMappingURL=textSelection.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;AAmBD,0GAA0G;AAC1G,4HAA4H;AAC5H,IAAI,8BAAe;AACnB,IAAI,wCAAkB;AACtB,IAAI,2CAAqB,IAAI;AAEtB,SAAS,0CAAqB,MAAgB;IACnD,IAAI,CAAA,GAAA,2BAAI,KAAK;QACX,IAAI,gCAAU,WAAW;YACvB,iDAAiD;YACjD,MAAM,iBAAiB,CAAA,GAAA,sCAAe,EAAE;YACxC,wCAAkB,eAAe,eAAe,CAAC,KAAK,CAAC,gBAAgB;YACvE,eAAe,eAAe,CAAC,KAAK,CAAC,gBAAgB,GAAG;QAC1D;QAEA,8BAAQ;IACV,OAAO,IAAI,kBAAkB,eAAe,kBAAkB,YAAY;QACxE,sFAAsF;QACtF,kDAAkD;QAClD,yCAAmB,GAAG,CAAC,QAAQ,OAAO,KAAK,CAAC,UAAU;QACtD,OAAO,KAAK,CAAC,UAAU,GAAG;IAC5B;AACF;AAEO,SAAS,0CAAqB,MAAgB;IACnD,IAAI,CAAA,GAAA,2BAAI,KAAK;QACX,0DAA0D;QAC1D,sEAAsE;QACtE,IAAI,gCAAU,YACZ;QAGF,8BAAQ;QAER,uEAAuE;QACvE,+DAA+D;QAC/D,WAAW;YACT,uEAAuE;YACvE,oEAAoE;YACpE,CAAA,GAAA,wCAAiB,EAAE;gBACjB,wBAAwB;gBACxB,IAAI,gCAAU,aAAa;oBACzB,iDAAiD;oBACjD,MAAM,iBAAiB,CAAA,GAAA,sCAAe,EAAE;oBACxC,IAAI,eAAe,eAAe,CAAC,KAAK,CAAC,gBAAgB,KAAK,QAC5D,eAAe,eAAe,CAAC,KAAK,CAAC,gBAAgB,GAAG,yCAAmB;oBAG7E,wCAAkB;oBAClB,8BAAQ;gBACV;YACF;QACF,GAAG;IACL,OAAO,IAAI,kBAAkB,eAAe,kBAAkB,YAC5D,+DAA+D;IAC/D,kDAAkD;IAClD;QAAA,IAAI,UAAU,yCAAmB,GAAG,CAAC,SAAS;YAC5C,IAAI,sBAAsB,yCAAmB,GAAG,CAAC;YAEjD,IAAI,OAAO,KAAK,CAAC,UAAU,KAAK,QAC9B,OAAO,KAAK,CAAC,UAAU,GAAG;YAG5B,IAAI,OAAO,YAAY,CAAC,aAAa,IACnC,OAAO,eAAe,CAAC;YAEzB,yCAAmB,MAAM,CAAC;QAC5B;IAAA;AAEJ","sources":["packages/@react-aria/interactions/src/textSelection.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {getOwnerDocument, isIOS, runAfterTransition} from '@react-aria/utils';\n\n// Safari on iOS starts selecting text on long press. The only way to avoid this, it seems,\n// is to add user-select: none to the entire page. Adding it to the pressable element prevents\n// that element from being selected, but nearby elements may still receive selection. We add\n// user-select: none on touch start, and remove it again on touch end to prevent this.\n// This must be implemented using global state to avoid race conditions between multiple elements.\n\n// There are three possible states due to the delay before removing user-select: none after\n// pointer up. The 'default' state always transitions to the 'disabled' state, which transitions\n// to 'restoring'. The 'restoring' state can either transition back to 'disabled' or 'default'.\n\n// For non-iOS devices, we apply user-select: none to the pressed element instead to avoid possible\n// performance issues that arise from applying and removing user-select: none to the entire page\n// (see https://github.com/adobe/react-spectrum/issues/1609).\ntype State = 'default' | 'disabled' | 'restoring';\n\n// Note that state only matters here for iOS. Non-iOS gets user-select: none applied to the target element\n// rather than at the document level so we just need to apply/remove user-select: none for each pressed element individually\nlet state: State = 'default';\nlet savedUserSelect = '';\nlet modifiedElementMap = new WeakMap<Element, string>();\n\nexport function disableTextSelection(target?: Element) {\n if (isIOS()) {\n if (state === 'default') {\n // eslint-disable-next-line no-restricted-globals\n const documentObject = getOwnerDocument(target);\n savedUserSelect = documentObject.documentElement.style.webkitUserSelect;\n documentObject.documentElement.style.webkitUserSelect = 'none';\n }\n\n state = 'disabled';\n } else if (target instanceof HTMLElement || target instanceof SVGElement) {\n // If not iOS, store the target's original user-select and change to user-select: none\n // Ignore state since it doesn't apply for non iOS\n modifiedElementMap.set(target, target.style.userSelect);\n target.style.userSelect = 'none';\n }\n}\n\nexport function restoreTextSelection(target?: Element) {\n if (isIOS()) {\n // If the state is already default, there's nothing to do.\n // If it is restoring, then there's no need to queue a second restore.\n if (state !== 'disabled') {\n return;\n }\n\n state = 'restoring';\n\n // There appears to be a delay on iOS where selection still might occur\n // after pointer up, so wait a bit before removing user-select.\n setTimeout(() => {\n // Wait for any CSS transitions to complete so we don't recompute style\n // for the whole page in the middle of the animation and cause jank.\n runAfterTransition(() => {\n // Avoid race conditions\n if (state === 'restoring') {\n // eslint-disable-next-line no-restricted-globals\n const documentObject = getOwnerDocument(target);\n if (documentObject.documentElement.style.webkitUserSelect === 'none') {\n documentObject.documentElement.style.webkitUserSelect = savedUserSelect || '';\n }\n\n savedUserSelect = '';\n state = 'default';\n }\n });\n }, 300);\n } else if (target instanceof HTMLElement || target instanceof SVGElement) {\n // If not iOS, restore the target's original user-select if any\n // Ignore state since it doesn't apply for non iOS\n if (target && modifiedElementMap.has(target)) {\n let targetOldUserSelect = modifiedElementMap.get(target) as string;\n\n if (target.style.userSelect === 'none') {\n target.style.userSelect = targetOldUserSelect;\n }\n\n if (target.getAttribute('style') === '') {\n target.removeAttribute('style');\n }\n modifiedElementMap.delete(target);\n }\n }\n}\n"],"names":[],"version":3,"file":"textSelection.main.js.map"}
@@ -0,0 +1,71 @@
1
+ import {isIOS as $7R18e$isIOS, getOwnerDocument as $7R18e$getOwnerDocument, runAfterTransition as $7R18e$runAfterTransition} from "@react-aria/utils";
2
+
3
+ /*
4
+ * Copyright 2020 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+ // Note that state only matters here for iOS. Non-iOS gets user-select: none applied to the target element
15
+ // rather than at the document level so we just need to apply/remove user-select: none for each pressed element individually
16
+ let $14c0b72509d70225$var$state = "default";
17
+ let $14c0b72509d70225$var$savedUserSelect = "";
18
+ let $14c0b72509d70225$var$modifiedElementMap = new WeakMap();
19
+ function $14c0b72509d70225$export$16a4697467175487(target) {
20
+ if ((0, $7R18e$isIOS)()) {
21
+ if ($14c0b72509d70225$var$state === "default") {
22
+ // eslint-disable-next-line no-restricted-globals
23
+ const documentObject = (0, $7R18e$getOwnerDocument)(target);
24
+ $14c0b72509d70225$var$savedUserSelect = documentObject.documentElement.style.webkitUserSelect;
25
+ documentObject.documentElement.style.webkitUserSelect = "none";
26
+ }
27
+ $14c0b72509d70225$var$state = "disabled";
28
+ } else if (target instanceof HTMLElement || target instanceof SVGElement) {
29
+ // If not iOS, store the target's original user-select and change to user-select: none
30
+ // Ignore state since it doesn't apply for non iOS
31
+ $14c0b72509d70225$var$modifiedElementMap.set(target, target.style.userSelect);
32
+ target.style.userSelect = "none";
33
+ }
34
+ }
35
+ function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
36
+ if ((0, $7R18e$isIOS)()) {
37
+ // If the state is already default, there's nothing to do.
38
+ // If it is restoring, then there's no need to queue a second restore.
39
+ if ($14c0b72509d70225$var$state !== "disabled") return;
40
+ $14c0b72509d70225$var$state = "restoring";
41
+ // There appears to be a delay on iOS where selection still might occur
42
+ // after pointer up, so wait a bit before removing user-select.
43
+ setTimeout(()=>{
44
+ // Wait for any CSS transitions to complete so we don't recompute style
45
+ // for the whole page in the middle of the animation and cause jank.
46
+ (0, $7R18e$runAfterTransition)(()=>{
47
+ // Avoid race conditions
48
+ if ($14c0b72509d70225$var$state === "restoring") {
49
+ // eslint-disable-next-line no-restricted-globals
50
+ const documentObject = (0, $7R18e$getOwnerDocument)(target);
51
+ if (documentObject.documentElement.style.webkitUserSelect === "none") documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect || "";
52
+ $14c0b72509d70225$var$savedUserSelect = "";
53
+ $14c0b72509d70225$var$state = "default";
54
+ }
55
+ });
56
+ }, 300);
57
+ } else if (target instanceof HTMLElement || target instanceof SVGElement) // If not iOS, restore the target's original user-select if any
58
+ // Ignore state since it doesn't apply for non iOS
59
+ {
60
+ if (target && $14c0b72509d70225$var$modifiedElementMap.has(target)) {
61
+ let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap.get(target);
62
+ if (target.style.userSelect === "none") target.style.userSelect = targetOldUserSelect;
63
+ if (target.getAttribute("style") === "") target.removeAttribute("style");
64
+ $14c0b72509d70225$var$modifiedElementMap.delete(target);
65
+ }
66
+ }
67
+ }
68
+
69
+
70
+ export {$14c0b72509d70225$export$16a4697467175487 as disableTextSelection, $14c0b72509d70225$export$b0d6fa1ab32e3295 as restoreTextSelection};
71
+ //# sourceMappingURL=textSelection.mjs.map
@@ -0,0 +1,71 @@
1
+ import {isIOS as $7R18e$isIOS, getOwnerDocument as $7R18e$getOwnerDocument, runAfterTransition as $7R18e$runAfterTransition} from "@react-aria/utils";
2
+
3
+ /*
4
+ * Copyright 2020 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+ // Note that state only matters here for iOS. Non-iOS gets user-select: none applied to the target element
15
+ // rather than at the document level so we just need to apply/remove user-select: none for each pressed element individually
16
+ let $14c0b72509d70225$var$state = "default";
17
+ let $14c0b72509d70225$var$savedUserSelect = "";
18
+ let $14c0b72509d70225$var$modifiedElementMap = new WeakMap();
19
+ function $14c0b72509d70225$export$16a4697467175487(target) {
20
+ if ((0, $7R18e$isIOS)()) {
21
+ if ($14c0b72509d70225$var$state === "default") {
22
+ // eslint-disable-next-line no-restricted-globals
23
+ const documentObject = (0, $7R18e$getOwnerDocument)(target);
24
+ $14c0b72509d70225$var$savedUserSelect = documentObject.documentElement.style.webkitUserSelect;
25
+ documentObject.documentElement.style.webkitUserSelect = "none";
26
+ }
27
+ $14c0b72509d70225$var$state = "disabled";
28
+ } else if (target instanceof HTMLElement || target instanceof SVGElement) {
29
+ // If not iOS, store the target's original user-select and change to user-select: none
30
+ // Ignore state since it doesn't apply for non iOS
31
+ $14c0b72509d70225$var$modifiedElementMap.set(target, target.style.userSelect);
32
+ target.style.userSelect = "none";
33
+ }
34
+ }
35
+ function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
36
+ if ((0, $7R18e$isIOS)()) {
37
+ // If the state is already default, there's nothing to do.
38
+ // If it is restoring, then there's no need to queue a second restore.
39
+ if ($14c0b72509d70225$var$state !== "disabled") return;
40
+ $14c0b72509d70225$var$state = "restoring";
41
+ // There appears to be a delay on iOS where selection still might occur
42
+ // after pointer up, so wait a bit before removing user-select.
43
+ setTimeout(()=>{
44
+ // Wait for any CSS transitions to complete so we don't recompute style
45
+ // for the whole page in the middle of the animation and cause jank.
46
+ (0, $7R18e$runAfterTransition)(()=>{
47
+ // Avoid race conditions
48
+ if ($14c0b72509d70225$var$state === "restoring") {
49
+ // eslint-disable-next-line no-restricted-globals
50
+ const documentObject = (0, $7R18e$getOwnerDocument)(target);
51
+ if (documentObject.documentElement.style.webkitUserSelect === "none") documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect || "";
52
+ $14c0b72509d70225$var$savedUserSelect = "";
53
+ $14c0b72509d70225$var$state = "default";
54
+ }
55
+ });
56
+ }, 300);
57
+ } else if (target instanceof HTMLElement || target instanceof SVGElement) // If not iOS, restore the target's original user-select if any
58
+ // Ignore state since it doesn't apply for non iOS
59
+ {
60
+ if (target && $14c0b72509d70225$var$modifiedElementMap.has(target)) {
61
+ let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap.get(target);
62
+ if (target.style.userSelect === "none") target.style.userSelect = targetOldUserSelect;
63
+ if (target.getAttribute("style") === "") target.removeAttribute("style");
64
+ $14c0b72509d70225$var$modifiedElementMap.delete(target);
65
+ }
66
+ }
67
+ }
68
+
69
+
70
+ export {$14c0b72509d70225$export$16a4697467175487 as disableTextSelection, $14c0b72509d70225$export$b0d6fa1ab32e3295 as restoreTextSelection};
71
+ //# sourceMappingURL=textSelection.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;AAmBD,0GAA0G;AAC1G,4HAA4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AU,KAAK,QAC9B,OAAO,KAAK,CAAC,UAAU,GAAG;YAG5B,IAAI,OAAO,YAAY,CAAC,aAAa,IACnC,OAAO,eAAe,CAAC;YAEzB,yCAAmB,MAAM,CAAC;QAC5B;IAAA;AAEJ","sources":["packages/@react-aria/interactions/src/textSelection.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {getOwnerDocument, isIOS, runAfterTransition} from '@react-aria/utils';\n\n// Safari on iOS starts selecting text on long press. The only way to avoid this, it seems,\n// is to add user-select: none to the entire page. Adding it to the pressable element prevents\n// that element from being selected, but nearby elements may still receive selection. We add\n// user-select: none on touch start, and remove it again on touch end to prevent this.\n// This must be implemented using global state to avoid race conditions between multiple elements.\n\n// There are three possible states due to the delay before removing user-select: none after\n// pointer up. The 'default' state always transitions to the 'disabled' state, which transitions\n// to 'restoring'. The 'restoring' state can either transition back to 'disabled' or 'default'.\n\n// For non-iOS devices, we apply user-select: none to the pressed element instead to avoid possible\n// performance issues that arise from applying and removing user-select: none to the entire page\n// (see https://github.com/adobe/react-spectrum/issues/1609).\ntype State = 'default' | 'disabled' | 'restoring';\n\n// Note that state only matters here for iOS. Non-iOS gets user-select: none applied to the target element\n// rather than at the document level so we just need to apply/remove user-select: none for each pressed element individually\nlet state: State = 'default';\nlet savedUserSelect = '';\nlet modifiedElementMap = new WeakMap<Element, string>();\n\nexport function disableTextSelection(target?: Element) {\n if (isIOS()) {\n if (state === 'default') {\n // eslint-disable-next-line no-restricted-globals\n const documentObject = getOwnerDocument(target);\n savedUserSelect = documentObject.documentElement.style.webkitUserSelect;\n documentObject.documentElement.style.webkitUserSelect = 'none';\n }\n\n state = 'disabled';\n } else if (target instanceof HTMLElement || target instanceof SVGElement) {\n // If not iOS, store the target's original user-select and change to user-select: none\n // Ignore state since it doesn't apply for non iOS\n modifiedElementMap.set(target, target.style.userSelect);\n target.style.userSelect = 'none';\n }\n}\n\nexport function restoreTextSelection(target?: Element) {\n if (isIOS()) {\n // If the state is already default, there's nothing to do.\n // If it is restoring, then there's no need to queue a second restore.\n if (state !== 'disabled') {\n return;\n }\n\n state = 'restoring';\n\n // There appears to be a delay on iOS where selection still might occur\n // after pointer up, so wait a bit before removing user-select.\n setTimeout(() => {\n // Wait for any CSS transitions to complete so we don't recompute style\n // for the whole page in the middle of the animation and cause jank.\n runAfterTransition(() => {\n // Avoid race conditions\n if (state === 'restoring') {\n // eslint-disable-next-line no-restricted-globals\n const documentObject = getOwnerDocument(target);\n if (documentObject.documentElement.style.webkitUserSelect === 'none') {\n documentObject.documentElement.style.webkitUserSelect = savedUserSelect || '';\n }\n\n savedUserSelect = '';\n state = 'default';\n }\n });\n }, 300);\n } else if (target instanceof HTMLElement || target instanceof SVGElement) {\n // If not iOS, restore the target's original user-select if any\n // Ignore state since it doesn't apply for non iOS\n if (target && modifiedElementMap.has(target)) {\n let targetOldUserSelect = modifiedElementMap.get(target) as string;\n\n if (target.style.userSelect === 'none') {\n target.style.userSelect = targetOldUserSelect;\n }\n\n if (target.getAttribute('style') === '') {\n target.removeAttribute('style');\n }\n modifiedElementMap.delete(target);\n }\n }\n}\n"],"names":[],"version":3,"file":"textSelection.module.js.map"}