@react-aria/interactions 3.21.2 → 3.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/PressResponder.mjs +1 -1
  2. package/dist/Pressable.mjs +1 -1
  3. package/dist/context.main.js +1 -1
  4. package/dist/context.mjs +2 -2
  5. package/dist/context.module.js +1 -1
  6. package/dist/createEventHandler.main.js +1 -1
  7. package/dist/createEventHandler.mjs +2 -2
  8. package/dist/createEventHandler.module.js +1 -1
  9. package/dist/textSelection.main.js +14 -14
  10. package/dist/textSelection.mjs +15 -15
  11. package/dist/textSelection.module.js +14 -14
  12. package/dist/types.d.ts +5 -5
  13. package/dist/types.d.ts.map +1 -1
  14. package/dist/useFocus.mjs +1 -1
  15. package/dist/useFocusVisible.main.js +54 -54
  16. package/dist/useFocusVisible.mjs +55 -55
  17. package/dist/useFocusVisible.module.js +54 -54
  18. package/dist/useFocusWithin.mjs +1 -1
  19. package/dist/useHover.main.js +16 -16
  20. package/dist/useHover.main.js.map +1 -1
  21. package/dist/useHover.mjs +17 -17
  22. package/dist/useHover.module.js +16 -16
  23. package/dist/useHover.module.js.map +1 -1
  24. package/dist/useInteractOutside.main.js +14 -14
  25. package/dist/useInteractOutside.main.js.map +1 -1
  26. package/dist/useInteractOutside.mjs +15 -15
  27. package/dist/useInteractOutside.module.js +14 -14
  28. package/dist/useInteractOutside.module.js.map +1 -1
  29. package/dist/useKeyboard.mjs +1 -1
  30. package/dist/useLongPress.main.js +11 -11
  31. package/dist/useLongPress.main.js.map +1 -1
  32. package/dist/useLongPress.mjs +12 -12
  33. package/dist/useLongPress.module.js +11 -11
  34. package/dist/useLongPress.module.js.map +1 -1
  35. package/dist/useMove.main.js +36 -36
  36. package/dist/useMove.mjs +37 -37
  37. package/dist/useMove.module.js +36 -36
  38. package/dist/usePress.main.js +95 -54
  39. package/dist/usePress.main.js.map +1 -1
  40. package/dist/usePress.mjs +96 -55
  41. package/dist/usePress.module.js +95 -54
  42. package/dist/usePress.module.js.map +1 -1
  43. package/dist/useScrollWheel.main.js +1 -1
  44. package/dist/useScrollWheel.main.js.map +1 -1
  45. package/dist/useScrollWheel.mjs +2 -2
  46. package/dist/useScrollWheel.module.js +1 -1
  47. package/dist/useScrollWheel.module.js.map +1 -1
  48. package/dist/utils.main.js +5 -5
  49. package/dist/utils.mjs +6 -6
  50. package/dist/utils.module.js +5 -5
  51. package/package.json +6 -6
  52. package/src/DOMPropsContext.ts +3 -3
  53. package/src/useDOMPropsResponder.ts +2 -2
  54. package/src/useHover.ts +0 -1
  55. package/src/useInteractOutside.ts +3 -2
  56. package/src/useLongPress.ts +1 -1
  57. package/src/usePress.ts +60 -14
  58. package/src/useScrollWheel.ts +3 -3
@@ -36,26 +36,26 @@ function $507fabe10e71c6fb$var$triggerChangeHandlers(modality, e) {
36
36
  * Helper function to determine if a KeyboardEvent is unmodified and could make keyboard focus styles visible.
37
37
  */ function $507fabe10e71c6fb$var$isValidKey(e) {
38
38
  // Control and Shift keys trigger when navigating back to the tab with keyboard.
39
- return !(e.metaKey || !(0, $28AnR$isMac)() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
39
+ return !(e.metaKey || !(0, $28AnR$isMac)() && e.altKey || e.ctrlKey || e.key === 'Control' || e.key === 'Shift' || e.key === 'Meta');
40
40
  }
41
41
  function $507fabe10e71c6fb$var$handleKeyboardEvent(e) {
42
42
  $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
43
43
  if ($507fabe10e71c6fb$var$isValidKey(e)) {
44
- $507fabe10e71c6fb$var$currentModality = "keyboard";
45
- $507fabe10e71c6fb$var$triggerChangeHandlers("keyboard", e);
44
+ $507fabe10e71c6fb$var$currentModality = 'keyboard';
45
+ $507fabe10e71c6fb$var$triggerChangeHandlers('keyboard', e);
46
46
  }
47
47
  }
48
48
  function $507fabe10e71c6fb$var$handlePointerEvent(e) {
49
- $507fabe10e71c6fb$var$currentModality = "pointer";
50
- if (e.type === "mousedown" || e.type === "pointerdown") {
49
+ $507fabe10e71c6fb$var$currentModality = 'pointer';
50
+ if (e.type === 'mousedown' || e.type === 'pointerdown') {
51
51
  $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
52
- $507fabe10e71c6fb$var$triggerChangeHandlers("pointer", e);
52
+ $507fabe10e71c6fb$var$triggerChangeHandlers('pointer', e);
53
53
  }
54
54
  }
55
55
  function $507fabe10e71c6fb$var$handleClickEvent(e) {
56
56
  if ((0, $28AnR$isVirtualClick)(e)) {
57
57
  $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
58
- $507fabe10e71c6fb$var$currentModality = "virtual";
58
+ $507fabe10e71c6fb$var$currentModality = 'virtual';
59
59
  }
60
60
  }
61
61
  function $507fabe10e71c6fb$var$handleFocusEvent(e) {
@@ -66,8 +66,8 @@ function $507fabe10e71c6fb$var$handleFocusEvent(e) {
66
66
  // If a focus event occurs without a preceding keyboard or pointer event, switch to virtual modality.
67
67
  // This occurs, for example, when navigating a form with the next/previous buttons on iOS.
68
68
  if (!$507fabe10e71c6fb$var$hasEventBeforeFocus && !$507fabe10e71c6fb$var$hasBlurredWindowRecently) {
69
- $507fabe10e71c6fb$var$currentModality = "virtual";
70
- $507fabe10e71c6fb$var$triggerChangeHandlers("virtual", e);
69
+ $507fabe10e71c6fb$var$currentModality = 'virtual';
70
+ $507fabe10e71c6fb$var$triggerChangeHandlers('virtual', e);
71
71
  }
72
72
  $507fabe10e71c6fb$var$hasEventBeforeFocus = false;
73
73
  $507fabe10e71c6fb$var$hasBlurredWindowRecently = false;
@@ -81,7 +81,7 @@ function $507fabe10e71c6fb$var$handleWindowBlur() {
81
81
  /**
82
82
  * Setup global event listeners to control when keyboard focus style should be visible.
83
83
  */ function $507fabe10e71c6fb$var$setupGlobalFocusEvents(element) {
84
- if (typeof window === "undefined" || $507fabe10e71c6fb$export$d90243b58daecda7.get((0, $28AnR$getOwnerWindow)(element))) return;
84
+ if (typeof window === 'undefined' || $507fabe10e71c6fb$export$d90243b58daecda7.get((0, $28AnR$getOwnerWindow)(element))) return;
85
85
  const windowObject = (0, $28AnR$getOwnerWindow)(element);
86
86
  const documentObject = (0, $28AnR$getOwnerDocument)(element);
87
87
  // Programmatic focus() calls shouldn't affect the current input modality.
@@ -93,24 +93,24 @@ function $507fabe10e71c6fb$var$handleWindowBlur() {
93
93
  $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
94
94
  focus.apply(this, arguments);
95
95
  };
96
- documentObject.addEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
97
- documentObject.addEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
98
- documentObject.addEventListener("click", $507fabe10e71c6fb$var$handleClickEvent, true);
96
+ documentObject.addEventListener('keydown', $507fabe10e71c6fb$var$handleKeyboardEvent, true);
97
+ documentObject.addEventListener('keyup', $507fabe10e71c6fb$var$handleKeyboardEvent, true);
98
+ documentObject.addEventListener('click', $507fabe10e71c6fb$var$handleClickEvent, true);
99
99
  // Register focus events on the window so they are sure to happen
100
100
  // before React's event listeners (registered on the document).
101
- windowObject.addEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent, true);
102
- windowObject.addEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur, false);
103
- if (typeof PointerEvent !== "undefined") {
104
- documentObject.addEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent, true);
105
- documentObject.addEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent, true);
106
- documentObject.addEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent, true);
101
+ windowObject.addEventListener('focus', $507fabe10e71c6fb$var$handleFocusEvent, true);
102
+ windowObject.addEventListener('blur', $507fabe10e71c6fb$var$handleWindowBlur, false);
103
+ if (typeof PointerEvent !== 'undefined') {
104
+ documentObject.addEventListener('pointerdown', $507fabe10e71c6fb$var$handlePointerEvent, true);
105
+ documentObject.addEventListener('pointermove', $507fabe10e71c6fb$var$handlePointerEvent, true);
106
+ documentObject.addEventListener('pointerup', $507fabe10e71c6fb$var$handlePointerEvent, true);
107
107
  } else {
108
- documentObject.addEventListener("mousedown", $507fabe10e71c6fb$var$handlePointerEvent, true);
109
- documentObject.addEventListener("mousemove", $507fabe10e71c6fb$var$handlePointerEvent, true);
110
- documentObject.addEventListener("mouseup", $507fabe10e71c6fb$var$handlePointerEvent, true);
108
+ documentObject.addEventListener('mousedown', $507fabe10e71c6fb$var$handlePointerEvent, true);
109
+ documentObject.addEventListener('mousemove', $507fabe10e71c6fb$var$handlePointerEvent, true);
110
+ documentObject.addEventListener('mouseup', $507fabe10e71c6fb$var$handlePointerEvent, true);
111
111
  }
112
112
  // Add unmount handler
113
- windowObject.addEventListener("beforeunload", ()=>{
113
+ windowObject.addEventListener('beforeunload', ()=>{
114
114
  $507fabe10e71c6fb$var$tearDownWindowFocusTracking(element);
115
115
  }, {
116
116
  once: true
@@ -122,42 +122,42 @@ function $507fabe10e71c6fb$var$handleWindowBlur() {
122
122
  const $507fabe10e71c6fb$var$tearDownWindowFocusTracking = (element, loadListener)=>{
123
123
  const windowObject = (0, $28AnR$getOwnerWindow)(element);
124
124
  const documentObject = (0, $28AnR$getOwnerDocument)(element);
125
- if (loadListener) documentObject.removeEventListener("DOMContentLoaded", loadListener);
125
+ if (loadListener) documentObject.removeEventListener('DOMContentLoaded', loadListener);
126
126
  if (!$507fabe10e71c6fb$export$d90243b58daecda7.has(windowObject)) return;
127
127
  windowObject.HTMLElement.prototype.focus = $507fabe10e71c6fb$export$d90243b58daecda7.get(windowObject).focus;
128
- documentObject.removeEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
129
- documentObject.removeEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
130
- documentObject.removeEventListener("click", $507fabe10e71c6fb$var$handleClickEvent, true);
131
- windowObject.removeEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent, true);
132
- windowObject.removeEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur, false);
133
- if (typeof PointerEvent !== "undefined") {
134
- documentObject.removeEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent, true);
135
- documentObject.removeEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent, true);
136
- documentObject.removeEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent, true);
128
+ documentObject.removeEventListener('keydown', $507fabe10e71c6fb$var$handleKeyboardEvent, true);
129
+ documentObject.removeEventListener('keyup', $507fabe10e71c6fb$var$handleKeyboardEvent, true);
130
+ documentObject.removeEventListener('click', $507fabe10e71c6fb$var$handleClickEvent, true);
131
+ windowObject.removeEventListener('focus', $507fabe10e71c6fb$var$handleFocusEvent, true);
132
+ windowObject.removeEventListener('blur', $507fabe10e71c6fb$var$handleWindowBlur, false);
133
+ if (typeof PointerEvent !== 'undefined') {
134
+ documentObject.removeEventListener('pointerdown', $507fabe10e71c6fb$var$handlePointerEvent, true);
135
+ documentObject.removeEventListener('pointermove', $507fabe10e71c6fb$var$handlePointerEvent, true);
136
+ documentObject.removeEventListener('pointerup', $507fabe10e71c6fb$var$handlePointerEvent, true);
137
137
  } else {
138
- documentObject.removeEventListener("mousedown", $507fabe10e71c6fb$var$handlePointerEvent, true);
139
- documentObject.removeEventListener("mousemove", $507fabe10e71c6fb$var$handlePointerEvent, true);
140
- documentObject.removeEventListener("mouseup", $507fabe10e71c6fb$var$handlePointerEvent, true);
138
+ documentObject.removeEventListener('mousedown', $507fabe10e71c6fb$var$handlePointerEvent, true);
139
+ documentObject.removeEventListener('mousemove', $507fabe10e71c6fb$var$handlePointerEvent, true);
140
+ documentObject.removeEventListener('mouseup', $507fabe10e71c6fb$var$handlePointerEvent, true);
141
141
  }
142
142
  $507fabe10e71c6fb$export$d90243b58daecda7.delete(windowObject);
143
143
  };
144
144
  function $507fabe10e71c6fb$export$2f1888112f558a7d(element) {
145
145
  const documentObject = (0, $28AnR$getOwnerDocument)(element);
146
146
  let loadListener;
147
- if (documentObject.readyState !== "loading") $507fabe10e71c6fb$var$setupGlobalFocusEvents(element);
147
+ if (documentObject.readyState !== 'loading') $507fabe10e71c6fb$var$setupGlobalFocusEvents(element);
148
148
  else {
149
149
  loadListener = ()=>{
150
150
  $507fabe10e71c6fb$var$setupGlobalFocusEvents(element);
151
151
  };
152
- documentObject.addEventListener("DOMContentLoaded", loadListener);
152
+ documentObject.addEventListener('DOMContentLoaded', loadListener);
153
153
  }
154
154
  return ()=>$507fabe10e71c6fb$var$tearDownWindowFocusTracking(element, loadListener);
155
155
  }
156
156
  // Server-side rendering does not have the document object defined
157
157
  // eslint-disable-next-line no-restricted-globals
158
- if (typeof document !== "undefined") $507fabe10e71c6fb$export$2f1888112f558a7d();
158
+ if (typeof document !== 'undefined') $507fabe10e71c6fb$export$2f1888112f558a7d();
159
159
  function $507fabe10e71c6fb$export$b9b3dfddab17db27() {
160
- return $507fabe10e71c6fb$var$currentModality !== "pointer";
160
+ return $507fabe10e71c6fb$var$currentModality !== 'pointer';
161
161
  }
162
162
  function $507fabe10e71c6fb$export$630ff653c5ada6a9() {
163
163
  return $507fabe10e71c6fb$var$currentModality;
@@ -181,27 +181,27 @@ function $507fabe10e71c6fb$export$98e20ec92f614cfe() {
181
181
  return (0, $28AnR$useIsSSR)() ? null : modality;
182
182
  }
183
183
  const $507fabe10e71c6fb$var$nonTextInputTypes = new Set([
184
- "checkbox",
185
- "radio",
186
- "range",
187
- "color",
188
- "file",
189
- "image",
190
- "button",
191
- "submit",
192
- "reset"
184
+ 'checkbox',
185
+ 'radio',
186
+ 'range',
187
+ 'color',
188
+ 'file',
189
+ 'image',
190
+ 'button',
191
+ 'submit',
192
+ 'reset'
193
193
  ]);
194
194
  /**
195
195
  * If this is attached to text input component, return if the event is a focus event (Tab/Escape keys pressed) so that
196
196
  * focus visible style can be properly set.
197
197
  */ function $507fabe10e71c6fb$var$isKeyboardFocusEvent(isTextInput, modality, e) {
198
198
  var _e_target;
199
- const IHTMLInputElement = typeof window !== "undefined" ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLInputElement : HTMLInputElement;
200
- const IHTMLTextAreaElement = typeof window !== "undefined" ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLTextAreaElement : HTMLTextAreaElement;
201
- const IHTMLElement = typeof window !== "undefined" ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLElement : HTMLElement;
202
- const IKeyboardEvent = typeof window !== "undefined" ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).KeyboardEvent : KeyboardEvent;
199
+ const IHTMLInputElement = typeof window !== 'undefined' ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLInputElement : HTMLInputElement;
200
+ const IHTMLTextAreaElement = typeof window !== 'undefined' ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLTextAreaElement : HTMLTextAreaElement;
201
+ const IHTMLElement = typeof window !== 'undefined' ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLElement : HTMLElement;
202
+ const IKeyboardEvent = typeof window !== 'undefined' ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).KeyboardEvent : KeyboardEvent;
203
203
  isTextInput = isTextInput || (e === null || e === void 0 ? void 0 : e.target) instanceof IHTMLInputElement && !$507fabe10e71c6fb$var$nonTextInputTypes.has(e === null || e === void 0 ? void 0 : (_e_target = e.target) === null || _e_target === void 0 ? void 0 : _e_target.type) || (e === null || e === void 0 ? void 0 : e.target) instanceof IHTMLTextAreaElement || (e === null || e === void 0 ? void 0 : e.target) instanceof IHTMLElement && (e === null || e === void 0 ? void 0 : e.target.isContentEditable);
204
- return !(isTextInput && modality === "keyboard" && e instanceof IKeyboardEvent && !$507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS[e.key]);
204
+ return !(isTextInput && modality === 'keyboard' && e instanceof IKeyboardEvent && !$507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS[e.key]);
205
205
  }
206
206
  function $507fabe10e71c6fb$export$ffd9e5021c1fb2d6(props = {}) {
207
207
  let { isTextInput: isTextInput, autoFocus: autoFocus } = props;
@@ -234,4 +234,4 @@ function $507fabe10e71c6fb$export$ec71b4b83ac08ec3(fn, deps, opts) {
234
234
 
235
235
 
236
236
  export {$507fabe10e71c6fb$export$d90243b58daecda7 as hasSetupGlobalListeners, $507fabe10e71c6fb$export$2f1888112f558a7d as addWindowFocusTracking, $507fabe10e71c6fb$export$b9b3dfddab17db27 as isFocusVisible, $507fabe10e71c6fb$export$630ff653c5ada6a9 as getInteractionModality, $507fabe10e71c6fb$export$8397ddfc504fdb9a as setInteractionModality, $507fabe10e71c6fb$export$98e20ec92f614cfe as useInteractionModality, $507fabe10e71c6fb$export$ffd9e5021c1fb2d6 as useFocusVisible, $507fabe10e71c6fb$export$ec71b4b83ac08ec3 as useFocusVisibleListener};
237
- //# sourceMappingURL=useFocusVisible.mjs.map
237
+ //# sourceMappingURL=useFocusVisible.module.js.map
@@ -36,26 +36,26 @@ function $507fabe10e71c6fb$var$triggerChangeHandlers(modality, e) {
36
36
  * Helper function to determine if a KeyboardEvent is unmodified and could make keyboard focus styles visible.
37
37
  */ function $507fabe10e71c6fb$var$isValidKey(e) {
38
38
  // Control and Shift keys trigger when navigating back to the tab with keyboard.
39
- return !(e.metaKey || !(0, $28AnR$isMac)() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
39
+ return !(e.metaKey || !(0, $28AnR$isMac)() && e.altKey || e.ctrlKey || e.key === 'Control' || e.key === 'Shift' || e.key === 'Meta');
40
40
  }
41
41
  function $507fabe10e71c6fb$var$handleKeyboardEvent(e) {
42
42
  $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
43
43
  if ($507fabe10e71c6fb$var$isValidKey(e)) {
44
- $507fabe10e71c6fb$var$currentModality = "keyboard";
45
- $507fabe10e71c6fb$var$triggerChangeHandlers("keyboard", e);
44
+ $507fabe10e71c6fb$var$currentModality = 'keyboard';
45
+ $507fabe10e71c6fb$var$triggerChangeHandlers('keyboard', e);
46
46
  }
47
47
  }
48
48
  function $507fabe10e71c6fb$var$handlePointerEvent(e) {
49
- $507fabe10e71c6fb$var$currentModality = "pointer";
50
- if (e.type === "mousedown" || e.type === "pointerdown") {
49
+ $507fabe10e71c6fb$var$currentModality = 'pointer';
50
+ if (e.type === 'mousedown' || e.type === 'pointerdown') {
51
51
  $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
52
- $507fabe10e71c6fb$var$triggerChangeHandlers("pointer", e);
52
+ $507fabe10e71c6fb$var$triggerChangeHandlers('pointer', e);
53
53
  }
54
54
  }
55
55
  function $507fabe10e71c6fb$var$handleClickEvent(e) {
56
56
  if ((0, $28AnR$isVirtualClick)(e)) {
57
57
  $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
58
- $507fabe10e71c6fb$var$currentModality = "virtual";
58
+ $507fabe10e71c6fb$var$currentModality = 'virtual';
59
59
  }
60
60
  }
61
61
  function $507fabe10e71c6fb$var$handleFocusEvent(e) {
@@ -66,8 +66,8 @@ function $507fabe10e71c6fb$var$handleFocusEvent(e) {
66
66
  // If a focus event occurs without a preceding keyboard or pointer event, switch to virtual modality.
67
67
  // This occurs, for example, when navigating a form with the next/previous buttons on iOS.
68
68
  if (!$507fabe10e71c6fb$var$hasEventBeforeFocus && !$507fabe10e71c6fb$var$hasBlurredWindowRecently) {
69
- $507fabe10e71c6fb$var$currentModality = "virtual";
70
- $507fabe10e71c6fb$var$triggerChangeHandlers("virtual", e);
69
+ $507fabe10e71c6fb$var$currentModality = 'virtual';
70
+ $507fabe10e71c6fb$var$triggerChangeHandlers('virtual', e);
71
71
  }
72
72
  $507fabe10e71c6fb$var$hasEventBeforeFocus = false;
73
73
  $507fabe10e71c6fb$var$hasBlurredWindowRecently = false;
@@ -81,7 +81,7 @@ function $507fabe10e71c6fb$var$handleWindowBlur() {
81
81
  /**
82
82
  * Setup global event listeners to control when keyboard focus style should be visible.
83
83
  */ function $507fabe10e71c6fb$var$setupGlobalFocusEvents(element) {
84
- if (typeof window === "undefined" || $507fabe10e71c6fb$export$d90243b58daecda7.get((0, $28AnR$getOwnerWindow)(element))) return;
84
+ if (typeof window === 'undefined' || $507fabe10e71c6fb$export$d90243b58daecda7.get((0, $28AnR$getOwnerWindow)(element))) return;
85
85
  const windowObject = (0, $28AnR$getOwnerWindow)(element);
86
86
  const documentObject = (0, $28AnR$getOwnerDocument)(element);
87
87
  // Programmatic focus() calls shouldn't affect the current input modality.
@@ -93,24 +93,24 @@ function $507fabe10e71c6fb$var$handleWindowBlur() {
93
93
  $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
94
94
  focus.apply(this, arguments);
95
95
  };
96
- documentObject.addEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
97
- documentObject.addEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
98
- documentObject.addEventListener("click", $507fabe10e71c6fb$var$handleClickEvent, true);
96
+ documentObject.addEventListener('keydown', $507fabe10e71c6fb$var$handleKeyboardEvent, true);
97
+ documentObject.addEventListener('keyup', $507fabe10e71c6fb$var$handleKeyboardEvent, true);
98
+ documentObject.addEventListener('click', $507fabe10e71c6fb$var$handleClickEvent, true);
99
99
  // Register focus events on the window so they are sure to happen
100
100
  // before React's event listeners (registered on the document).
101
- windowObject.addEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent, true);
102
- windowObject.addEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur, false);
103
- if (typeof PointerEvent !== "undefined") {
104
- documentObject.addEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent, true);
105
- documentObject.addEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent, true);
106
- documentObject.addEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent, true);
101
+ windowObject.addEventListener('focus', $507fabe10e71c6fb$var$handleFocusEvent, true);
102
+ windowObject.addEventListener('blur', $507fabe10e71c6fb$var$handleWindowBlur, false);
103
+ if (typeof PointerEvent !== 'undefined') {
104
+ documentObject.addEventListener('pointerdown', $507fabe10e71c6fb$var$handlePointerEvent, true);
105
+ documentObject.addEventListener('pointermove', $507fabe10e71c6fb$var$handlePointerEvent, true);
106
+ documentObject.addEventListener('pointerup', $507fabe10e71c6fb$var$handlePointerEvent, true);
107
107
  } else {
108
- documentObject.addEventListener("mousedown", $507fabe10e71c6fb$var$handlePointerEvent, true);
109
- documentObject.addEventListener("mousemove", $507fabe10e71c6fb$var$handlePointerEvent, true);
110
- documentObject.addEventListener("mouseup", $507fabe10e71c6fb$var$handlePointerEvent, true);
108
+ documentObject.addEventListener('mousedown', $507fabe10e71c6fb$var$handlePointerEvent, true);
109
+ documentObject.addEventListener('mousemove', $507fabe10e71c6fb$var$handlePointerEvent, true);
110
+ documentObject.addEventListener('mouseup', $507fabe10e71c6fb$var$handlePointerEvent, true);
111
111
  }
112
112
  // Add unmount handler
113
- windowObject.addEventListener("beforeunload", ()=>{
113
+ windowObject.addEventListener('beforeunload', ()=>{
114
114
  $507fabe10e71c6fb$var$tearDownWindowFocusTracking(element);
115
115
  }, {
116
116
  once: true
@@ -122,42 +122,42 @@ function $507fabe10e71c6fb$var$handleWindowBlur() {
122
122
  const $507fabe10e71c6fb$var$tearDownWindowFocusTracking = (element, loadListener)=>{
123
123
  const windowObject = (0, $28AnR$getOwnerWindow)(element);
124
124
  const documentObject = (0, $28AnR$getOwnerDocument)(element);
125
- if (loadListener) documentObject.removeEventListener("DOMContentLoaded", loadListener);
125
+ if (loadListener) documentObject.removeEventListener('DOMContentLoaded', loadListener);
126
126
  if (!$507fabe10e71c6fb$export$d90243b58daecda7.has(windowObject)) return;
127
127
  windowObject.HTMLElement.prototype.focus = $507fabe10e71c6fb$export$d90243b58daecda7.get(windowObject).focus;
128
- documentObject.removeEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
129
- documentObject.removeEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
130
- documentObject.removeEventListener("click", $507fabe10e71c6fb$var$handleClickEvent, true);
131
- windowObject.removeEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent, true);
132
- windowObject.removeEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur, false);
133
- if (typeof PointerEvent !== "undefined") {
134
- documentObject.removeEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent, true);
135
- documentObject.removeEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent, true);
136
- documentObject.removeEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent, true);
128
+ documentObject.removeEventListener('keydown', $507fabe10e71c6fb$var$handleKeyboardEvent, true);
129
+ documentObject.removeEventListener('keyup', $507fabe10e71c6fb$var$handleKeyboardEvent, true);
130
+ documentObject.removeEventListener('click', $507fabe10e71c6fb$var$handleClickEvent, true);
131
+ windowObject.removeEventListener('focus', $507fabe10e71c6fb$var$handleFocusEvent, true);
132
+ windowObject.removeEventListener('blur', $507fabe10e71c6fb$var$handleWindowBlur, false);
133
+ if (typeof PointerEvent !== 'undefined') {
134
+ documentObject.removeEventListener('pointerdown', $507fabe10e71c6fb$var$handlePointerEvent, true);
135
+ documentObject.removeEventListener('pointermove', $507fabe10e71c6fb$var$handlePointerEvent, true);
136
+ documentObject.removeEventListener('pointerup', $507fabe10e71c6fb$var$handlePointerEvent, true);
137
137
  } else {
138
- documentObject.removeEventListener("mousedown", $507fabe10e71c6fb$var$handlePointerEvent, true);
139
- documentObject.removeEventListener("mousemove", $507fabe10e71c6fb$var$handlePointerEvent, true);
140
- documentObject.removeEventListener("mouseup", $507fabe10e71c6fb$var$handlePointerEvent, true);
138
+ documentObject.removeEventListener('mousedown', $507fabe10e71c6fb$var$handlePointerEvent, true);
139
+ documentObject.removeEventListener('mousemove', $507fabe10e71c6fb$var$handlePointerEvent, true);
140
+ documentObject.removeEventListener('mouseup', $507fabe10e71c6fb$var$handlePointerEvent, true);
141
141
  }
142
142
  $507fabe10e71c6fb$export$d90243b58daecda7.delete(windowObject);
143
143
  };
144
144
  function $507fabe10e71c6fb$export$2f1888112f558a7d(element) {
145
145
  const documentObject = (0, $28AnR$getOwnerDocument)(element);
146
146
  let loadListener;
147
- if (documentObject.readyState !== "loading") $507fabe10e71c6fb$var$setupGlobalFocusEvents(element);
147
+ if (documentObject.readyState !== 'loading') $507fabe10e71c6fb$var$setupGlobalFocusEvents(element);
148
148
  else {
149
149
  loadListener = ()=>{
150
150
  $507fabe10e71c6fb$var$setupGlobalFocusEvents(element);
151
151
  };
152
- documentObject.addEventListener("DOMContentLoaded", loadListener);
152
+ documentObject.addEventListener('DOMContentLoaded', loadListener);
153
153
  }
154
154
  return ()=>$507fabe10e71c6fb$var$tearDownWindowFocusTracking(element, loadListener);
155
155
  }
156
156
  // Server-side rendering does not have the document object defined
157
157
  // eslint-disable-next-line no-restricted-globals
158
- if (typeof document !== "undefined") $507fabe10e71c6fb$export$2f1888112f558a7d();
158
+ if (typeof document !== 'undefined') $507fabe10e71c6fb$export$2f1888112f558a7d();
159
159
  function $507fabe10e71c6fb$export$b9b3dfddab17db27() {
160
- return $507fabe10e71c6fb$var$currentModality !== "pointer";
160
+ return $507fabe10e71c6fb$var$currentModality !== 'pointer';
161
161
  }
162
162
  function $507fabe10e71c6fb$export$630ff653c5ada6a9() {
163
163
  return $507fabe10e71c6fb$var$currentModality;
@@ -181,27 +181,27 @@ function $507fabe10e71c6fb$export$98e20ec92f614cfe() {
181
181
  return (0, $28AnR$useIsSSR)() ? null : modality;
182
182
  }
183
183
  const $507fabe10e71c6fb$var$nonTextInputTypes = new Set([
184
- "checkbox",
185
- "radio",
186
- "range",
187
- "color",
188
- "file",
189
- "image",
190
- "button",
191
- "submit",
192
- "reset"
184
+ 'checkbox',
185
+ 'radio',
186
+ 'range',
187
+ 'color',
188
+ 'file',
189
+ 'image',
190
+ 'button',
191
+ 'submit',
192
+ 'reset'
193
193
  ]);
194
194
  /**
195
195
  * If this is attached to text input component, return if the event is a focus event (Tab/Escape keys pressed) so that
196
196
  * focus visible style can be properly set.
197
197
  */ function $507fabe10e71c6fb$var$isKeyboardFocusEvent(isTextInput, modality, e) {
198
198
  var _e_target;
199
- const IHTMLInputElement = typeof window !== "undefined" ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLInputElement : HTMLInputElement;
200
- const IHTMLTextAreaElement = typeof window !== "undefined" ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLTextAreaElement : HTMLTextAreaElement;
201
- const IHTMLElement = typeof window !== "undefined" ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLElement : HTMLElement;
202
- const IKeyboardEvent = typeof window !== "undefined" ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).KeyboardEvent : KeyboardEvent;
199
+ const IHTMLInputElement = typeof window !== 'undefined' ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLInputElement : HTMLInputElement;
200
+ const IHTMLTextAreaElement = typeof window !== 'undefined' ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLTextAreaElement : HTMLTextAreaElement;
201
+ const IHTMLElement = typeof window !== 'undefined' ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLElement : HTMLElement;
202
+ const IKeyboardEvent = typeof window !== 'undefined' ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).KeyboardEvent : KeyboardEvent;
203
203
  isTextInput = isTextInput || (e === null || e === void 0 ? void 0 : e.target) instanceof IHTMLInputElement && !$507fabe10e71c6fb$var$nonTextInputTypes.has(e === null || e === void 0 ? void 0 : (_e_target = e.target) === null || _e_target === void 0 ? void 0 : _e_target.type) || (e === null || e === void 0 ? void 0 : e.target) instanceof IHTMLTextAreaElement || (e === null || e === void 0 ? void 0 : e.target) instanceof IHTMLElement && (e === null || e === void 0 ? void 0 : e.target.isContentEditable);
204
- return !(isTextInput && modality === "keyboard" && e instanceof IKeyboardEvent && !$507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS[e.key]);
204
+ return !(isTextInput && modality === 'keyboard' && e instanceof IKeyboardEvent && !$507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS[e.key]);
205
205
  }
206
206
  function $507fabe10e71c6fb$export$ffd9e5021c1fb2d6(props = {}) {
207
207
  let { isTextInput: isTextInput, autoFocus: autoFocus } = props;
@@ -68,4 +68,4 @@ function $9ab94262bd0047c7$export$420e68273165f4ec(props) {
68
68
 
69
69
 
70
70
  export {$9ab94262bd0047c7$export$420e68273165f4ec as useFocusWithin};
71
- //# sourceMappingURL=useFocusWithin.mjs.map
71
+ //# sourceMappingURL=useFocusWithin.module.js.map
@@ -37,18 +37,18 @@ function $ffbc150311c75f01$var$setGlobalIgnoreEmulatedMouseEvents() {
37
37
  }, 50);
38
38
  }
39
39
  function $ffbc150311c75f01$var$handleGlobalPointerEvent(e) {
40
- if (e.pointerType === "touch") $ffbc150311c75f01$var$setGlobalIgnoreEmulatedMouseEvents();
40
+ if (e.pointerType === 'touch') $ffbc150311c75f01$var$setGlobalIgnoreEmulatedMouseEvents();
41
41
  }
42
42
  function $ffbc150311c75f01$var$setupGlobalTouchEvents() {
43
- if (typeof document === "undefined") return;
44
- if (typeof PointerEvent !== "undefined") document.addEventListener("pointerup", $ffbc150311c75f01$var$handleGlobalPointerEvent);
45
- else document.addEventListener("touchend", $ffbc150311c75f01$var$setGlobalIgnoreEmulatedMouseEvents);
43
+ if (typeof document === 'undefined') return;
44
+ if (typeof PointerEvent !== 'undefined') document.addEventListener('pointerup', $ffbc150311c75f01$var$handleGlobalPointerEvent);
45
+ else document.addEventListener('touchend', $ffbc150311c75f01$var$setGlobalIgnoreEmulatedMouseEvents);
46
46
  $ffbc150311c75f01$var$hoverCount++;
47
47
  return ()=>{
48
48
  $ffbc150311c75f01$var$hoverCount--;
49
49
  if ($ffbc150311c75f01$var$hoverCount > 0) return;
50
- if (typeof PointerEvent !== "undefined") document.removeEventListener("pointerup", $ffbc150311c75f01$var$handleGlobalPointerEvent);
51
- else document.removeEventListener("touchend", $ffbc150311c75f01$var$setGlobalIgnoreEmulatedMouseEvents);
50
+ if (typeof PointerEvent !== 'undefined') document.removeEventListener('pointerup', $ffbc150311c75f01$var$handleGlobalPointerEvent);
51
+ else document.removeEventListener('touchend', $ffbc150311c75f01$var$setGlobalIgnoreEmulatedMouseEvents);
52
52
  };
53
53
  }
54
54
  function $ffbc150311c75f01$export$ae780daf29e6d456(props) {
@@ -57,19 +57,19 @@ function $ffbc150311c75f01$export$ae780daf29e6d456(props) {
57
57
  let state = (0, $82z6W$react.useRef)({
58
58
  isHovered: false,
59
59
  ignoreEmulatedMouseEvents: false,
60
- pointerType: "",
60
+ pointerType: '',
61
61
  target: null
62
62
  }).current;
63
63
  (0, $82z6W$react.useEffect)($ffbc150311c75f01$var$setupGlobalTouchEvents, []);
64
64
  let { hoverProps: hoverProps, triggerHoverEnd: triggerHoverEnd } = (0, $82z6W$react.useMemo)(()=>{
65
65
  let triggerHoverStart = (event, pointerType)=>{
66
66
  state.pointerType = pointerType;
67
- if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target)) return;
67
+ if (isDisabled || pointerType === 'touch' || state.isHovered || !event.currentTarget.contains(event.target)) return;
68
68
  state.isHovered = true;
69
69
  let target = event.currentTarget;
70
70
  state.target = target;
71
71
  if (onHoverStart) onHoverStart({
72
- type: "hoverstart",
72
+ type: 'hoverstart',
73
73
  target: target,
74
74
  pointerType: pointerType
75
75
  });
@@ -77,13 +77,13 @@ function $ffbc150311c75f01$export$ae780daf29e6d456(props) {
77
77
  setHovered(true);
78
78
  };
79
79
  let triggerHoverEnd = (event, pointerType)=>{
80
- state.pointerType = "";
80
+ state.pointerType = '';
81
81
  state.target = null;
82
- if (pointerType === "touch" || !state.isHovered) return;
82
+ if (pointerType === 'touch' || !state.isHovered) return;
83
83
  state.isHovered = false;
84
84
  let target = event.currentTarget;
85
85
  if (onHoverEnd) onHoverEnd({
86
- type: "hoverend",
86
+ type: 'hoverend',
87
87
  target: target,
88
88
  pointerType: pointerType
89
89
  });
@@ -91,9 +91,9 @@ function $ffbc150311c75f01$export$ae780daf29e6d456(props) {
91
91
  setHovered(false);
92
92
  };
93
93
  let hoverProps = {};
94
- if (typeof PointerEvent !== "undefined") {
94
+ if (typeof PointerEvent !== 'undefined') {
95
95
  hoverProps.onPointerEnter = (e)=>{
96
- if ($ffbc150311c75f01$var$globalIgnoreEmulatedMouseEvents && e.pointerType === "mouse") return;
96
+ if ($ffbc150311c75f01$var$globalIgnoreEmulatedMouseEvents && e.pointerType === 'mouse') return;
97
97
  triggerHoverStart(e, e.pointerType);
98
98
  };
99
99
  hoverProps.onPointerLeave = (e)=>{
@@ -104,11 +104,11 @@ function $ffbc150311c75f01$export$ae780daf29e6d456(props) {
104
104
  state.ignoreEmulatedMouseEvents = true;
105
105
  };
106
106
  hoverProps.onMouseEnter = (e)=>{
107
- if (!state.ignoreEmulatedMouseEvents && !$ffbc150311c75f01$var$globalIgnoreEmulatedMouseEvents) triggerHoverStart(e, "mouse");
107
+ if (!state.ignoreEmulatedMouseEvents && !$ffbc150311c75f01$var$globalIgnoreEmulatedMouseEvents) triggerHoverStart(e, 'mouse');
108
108
  state.ignoreEmulatedMouseEvents = false;
109
109
  };
110
110
  hoverProps.onMouseLeave = (e)=>{
111
- if (!isDisabled && e.currentTarget.contains(e.target)) triggerHoverEnd(e, "mouse");
111
+ if (!isDisabled && e.currentTarget.contains(e.target)) triggerHoverEnd(e, 'mouse');
112
112
  };
113
113
  }
114
114
  return {
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,kEAAkE;AAClE,2DAA2D;AAC3D,yDAAyD;AACzD,kHAAkH;;AAgB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C;KAAW;IAEf,OAAO;oBACL;mBACA;IACF;AACF","sources":["packages/@react-aria/interactions/src/useHover.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from react.\n// Original licensing for the following can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions\n\nimport {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"],"names":[],"version":3,"file":"useHover.main.js.map"}
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,kEAAkE;AAClE,2DAA2D;AAC3D,yDAAyD;AACzD,kHAAkH;;AAgBlH,oGAAoG;AACpG,iFAAiF;AACjF,sDAAsD;AACtD,IAAI,wDAAkC;AACtC,IAAI,mCAAa;AAEjB,SAAS;IACP,wDAAkC;IAElC,wFAAwF;IACxF,sFAAsF;IACtF,wFAAwF;IACxF,oEAAoE;IACpE,WAAW;QACT,wDAAkC;IACpC,GAAG;AACL;AAEA,SAAS,+CAAyB,CAAC;IACjC,IAAI,EAAE,WAAW,KAAK,SACpB;AAEJ;AAEA,SAAS;IACP,IAAI,O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AGF,IAAI,eACF,cAAc;YAGhB,WAAW;QACb;QAEA,IAAI,aAA4B,CAAC;QAEjC,IAAI,OAAO,iBAAiB,aAAa;YACvC,WAAW,cAAc,GAAG,CAAC;gBAC3B,IAAI,yDAAmC,EAAE,WAAW,KAAK,SACvD;gBAGF,kBAAkB,GAAG,EAAE,WAAW;YACpC;YAEA,WAAW,cAAc,GAAG,CAAC;gBAC3B,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,GAClD,gBAAgB,GAAG,EAAE,WAAW;YAEpC;QACF,OAAO;YACL,WAAW,YAAY,GAAG;gBACxB,MAAM,yBAAyB,GAAG;YACpC;YAEA,WAAW,YAAY,GAAG,CAAC;gBACzB,IAAI,CAAC,MAAM,yBAAyB,IAAI,CAAC,uDACvC,kBAAkB,GAAG;gBAGvB,MAAM,yBAAyB,GAAG;YACpC;YAEA,WAAW,YAAY,GAAG,CAAC;gBACzB,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,GAClD,gBAAgB,GAAG;YAEvB;QACF;QACA,OAAO;wBAAC;6BAAY;QAAe;IACrC,GAAG;QAAC;QAAc;QAAe;QAAY;QAAY;KAAM;IAE/D,CAAA,GAAA,sBAAQ,EAAE;QACR,iEAAiE;QACjE,qFAAqF;QACrF,IAAI,YACF,gBAAgB;YAAC,eAAe,MAAM,MAAM;QAAA,GAAG,MAAM,WAAW;IAEpE,uDAAuD;IACvD,GAAG;QAAC;KAAW;IAEf,OAAO;oBACL;mBACA;IACF;AACF","sources":["packages/@react-aria/interactions/src/useHover.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from react.\n// Original licensing for the following can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions\n\nimport {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"],"names":[],"version":3,"file":"useHover.main.js.map"}