@react-aria/interactions 3.19.0 → 3.20.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.
package/dist/import.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import {mergeProps as $bx7SL$mergeProps, useSyncRef as $bx7SL$useSyncRef, useGlobalListeners as $bx7SL$useGlobalListeners, useEffectEvent as $bx7SL$useEffectEvent, isMac as $bx7SL$isMac, openLink as $bx7SL$openLink, isVirtualClick as $bx7SL$isVirtualClick, focusWithoutScrolling as $bx7SL$focusWithoutScrolling, isVirtualPointerEvent as $bx7SL$isVirtualPointerEvent, isIOS as $bx7SL$isIOS, runAfterTransition as $bx7SL$runAfterTransition, useLayoutEffect as $bx7SL$useLayoutEffect, useEvent as $bx7SL$useEvent, useDescription as $bx7SL$useDescription} from "@react-aria/utils";
2
- import $bx7SL$react, {useRef as $bx7SL$useRef, useContext as $bx7SL$useContext, useState as $bx7SL$useState, useMemo as $bx7SL$useMemo, useEffect as $bx7SL$useEffect, useCallback as $bx7SL$useCallback} from "react";
1
+ import {useObjectRef as $bx7SL$useObjectRef, mergeProps as $bx7SL$mergeProps, useSyncRef as $bx7SL$useSyncRef, useGlobalListeners as $bx7SL$useGlobalListeners, useEffectEvent as $bx7SL$useEffectEvent, getOwnerDocument as $bx7SL$getOwnerDocument, isMac as $bx7SL$isMac, openLink as $bx7SL$openLink, isVirtualClick as $bx7SL$isVirtualClick, focusWithoutScrolling as $bx7SL$focusWithoutScrolling, isVirtualPointerEvent as $bx7SL$isVirtualPointerEvent, getOwnerWindow as $bx7SL$getOwnerWindow, isIOS as $bx7SL$isIOS, runAfterTransition as $bx7SL$runAfterTransition, useLayoutEffect as $bx7SL$useLayoutEffect, useEvent as $bx7SL$useEvent, useDescription as $bx7SL$useDescription} from "@react-aria/utils";
2
+ import $bx7SL$react, {useContext as $bx7SL$useContext, useState as $bx7SL$useState, useRef as $bx7SL$useRef, useMemo as $bx7SL$useMemo, useEffect as $bx7SL$useEffect, useCallback as $bx7SL$useCallback} from "react";
3
3
  import {_ as $bx7SL$_} from "@swc/helpers/_/_class_private_field_get";
4
4
  import {_ as $bx7SL$_1} from "@swc/helpers/_/_class_private_field_init";
5
5
  import {_ as $bx7SL$_2} from "@swc/helpers/_/_class_private_field_set";
@@ -62,8 +62,10 @@ let $14c0b72509d70225$var$modifiedElementMap = new WeakMap();
62
62
  function $14c0b72509d70225$export$16a4697467175487(target) {
63
63
  if ((0, $bx7SL$isIOS)()) {
64
64
  if ($14c0b72509d70225$var$state === "default") {
65
- $14c0b72509d70225$var$savedUserSelect = document.documentElement.style.webkitUserSelect;
66
- document.documentElement.style.webkitUserSelect = "none";
65
+ // eslint-disable-next-line no-restricted-globals
66
+ const documentObject = (0, $bx7SL$getOwnerDocument)(target);
67
+ $14c0b72509d70225$var$savedUserSelect = documentObject.documentElement.style.webkitUserSelect;
68
+ documentObject.documentElement.style.webkitUserSelect = "none";
67
69
  }
68
70
  $14c0b72509d70225$var$state = "disabled";
69
71
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
@@ -87,7 +89,9 @@ function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
87
89
  (0, $bx7SL$runAfterTransition)(()=>{
88
90
  // Avoid race conditions
89
91
  if ($14c0b72509d70225$var$state === "restoring") {
90
- if (document.documentElement.style.webkitUserSelect === "none") document.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect || "";
92
+ // eslint-disable-next-line no-restricted-globals
93
+ const documentObject = (0, $bx7SL$getOwnerDocument)(target);
94
+ if (documentObject.documentElement.style.webkitUserSelect === "none") documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect || "";
91
95
  $14c0b72509d70225$var$savedUserSelect = "";
92
96
  $14c0b72509d70225$var$state = "default";
93
97
  }
@@ -98,7 +102,7 @@ function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
98
102
  {
99
103
  if (target && $14c0b72509d70225$var$modifiedElementMap.has(target)) {
100
104
  let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap.get(target);
101
- if (target.style.userSelect === "none") target.style.userSelect = targetOldUserSelect;
105
+ if (target.style.userSelect === "none" && targetOldUserSelect) target.style.userSelect = targetOldUserSelect;
102
106
  if (target.getAttribute("style") === "") target.removeAttribute("style");
103
107
  $14c0b72509d70225$var$modifiedElementMap.delete(target);
104
108
  }
@@ -118,7 +122,9 @@ function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
118
122
  * OF ANY KIND, either express or implied. See the License for the specific language
119
123
  * governing permissions and limitations under the License.
120
124
  */
121
- const $ae1eeba8b9eafd08$export$5165eccb35aaadb5 = (0, $bx7SL$react).createContext(null);
125
+ const $ae1eeba8b9eafd08$export$5165eccb35aaadb5 = (0, $bx7SL$react).createContext({
126
+ register: ()=>{}
127
+ });
122
128
  $ae1eeba8b9eafd08$export$5165eccb35aaadb5.displayName = "PressResponderContext";
123
129
 
124
130
 
@@ -176,7 +182,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
176
182
  let { addGlobalListener: addGlobalListener, removeAllGlobalListeners: removeAllGlobalListeners } = (0, $bx7SL$useGlobalListeners)();
177
183
  let triggerPressStart = (0, $bx7SL$useEffectEvent)((originalEvent, pointerType)=>{
178
184
  let state = ref.current;
179
- if (isDisabled || state.didFirePressStart) return;
185
+ if (isDisabled || state.didFirePressStart) return false;
180
186
  let shouldStopPropagation = true;
181
187
  state.isTriggeringEvent = true;
182
188
  if (onPressStart) {
@@ -192,7 +198,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
192
198
  });
193
199
  let triggerPressEnd = (0, $bx7SL$useEffectEvent)((originalEvent, pointerType, wasPressed = true)=>{
194
200
  let state = ref.current;
195
- if (!state.didFirePressStart) return;
201
+ if (!state.didFirePressStart) return false;
196
202
  state.ignoreClickAfterPress = true;
197
203
  state.didFirePressStart = false;
198
204
  state.isTriggeringEvent = true;
@@ -214,7 +220,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
214
220
  });
215
221
  let triggerPressUp = (0, $bx7SL$useEffectEvent)((originalEvent, pointerType)=>{
216
222
  let state = ref.current;
217
- if (isDisabled) return;
223
+ if (isDisabled) return false;
218
224
  if (onPressUp) {
219
225
  state.isTriggeringEvent = true;
220
226
  let event = new $f6c31cce2adf654f$var$PressEvent("pressup", pointerType, originalEvent);
@@ -226,8 +232,8 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
226
232
  });
227
233
  let cancel = (0, $bx7SL$useEffectEvent)((e)=>{
228
234
  let state = ref.current;
229
- if (state.isPressed) {
230
- if (state.isOverTarget) triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
235
+ if (state.isPressed && state.target) {
236
+ if (state.isOverTarget && state.pointerType != null) triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
231
237
  state.isPressed = false;
232
238
  state.isOverTarget = false;
233
239
  state.activePointerId = null;
@@ -244,6 +250,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
244
250
  let pressProps = {
245
251
  onKeyDown (e) {
246
252
  if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e.nativeEvent, e.currentTarget) && e.currentTarget.contains(e.target)) {
253
+ var _state_metaKeyEvents;
247
254
  if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(e.target, e.key)) e.preventDefault();
248
255
  // If the event is repeating, it may have started on a different element
249
256
  // after which focus moved to the current element. Ignore these events and
@@ -255,7 +262,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
255
262
  shouldStopPropagation = triggerPressStart(e, "keyboard");
256
263
  // Focus may move before the key up event, so register the event on the document
257
264
  // instead of the same element where the key down event occurred.
258
- addGlobalListener(document, "keyup", onKeyUp, false);
265
+ addGlobalListener((0, $bx7SL$getOwnerDocument)(e.currentTarget), "keyup", onKeyUp, false);
259
266
  }
260
267
  if (shouldStopPropagation) e.stopPropagation();
261
268
  // Keep track of the keydown events that occur while the Meta (e.g. Command) key is held.
@@ -265,11 +272,11 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
265
272
  // https://bugs.chromium.org/p/chromium/issues/detail?id=1393524
266
273
  // https://bugs.webkit.org/show_bug.cgi?id=55291
267
274
  // https://bugzilla.mozilla.org/show_bug.cgi?id=1299553
268
- if (e.metaKey && (0, $bx7SL$isMac)()) state.metaKeyEvents.set(e.key, e.nativeEvent);
275
+ if (e.metaKey && (0, $bx7SL$isMac)()) (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e.key, e.nativeEvent);
269
276
  } else if (e.key === "Meta") state.metaKeyEvents = new Map();
270
277
  },
271
278
  onKeyUp (e) {
272
- if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e.nativeEvent, e.currentTarget) && !e.repeat && e.currentTarget.contains(e.target)) triggerPressUp($f6c31cce2adf654f$var$createEvent(state.target, e), "keyboard");
279
+ if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e.nativeEvent, e.currentTarget) && !e.repeat && e.currentTarget.contains(e.target) && state.target) triggerPressUp($f6c31cce2adf654f$var$createEvent(state.target, e), "keyboard");
273
280
  },
274
281
  onClick (e) {
275
282
  if (e && !e.currentTarget.contains(e.target)) return;
@@ -294,7 +301,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
294
301
  };
295
302
  let onKeyUp = (e)=>{
296
303
  var _state_metaKeyEvents;
297
- if (state.isPressed && $f6c31cce2adf654f$var$isValidKeyboardEvent(e, state.target)) {
304
+ if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent(e, state.target)) {
298
305
  var _state_metaKeyEvents1;
299
306
  if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(e.target, e.key)) e.preventDefault();
300
307
  let target = e.target;
@@ -313,12 +320,13 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
313
320
  state.isPressed = false;
314
321
  (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e.key);
315
322
  } else if (e.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
323
+ var _state_target;
316
324
  // If we recorded keydown events that occurred while the Meta key was pressed,
317
325
  // and those haven't received keyup events already, fire keyup events ourselves.
318
326
  // See comment above for more info about the macOS bug causing this.
319
327
  let events = state.metaKeyEvents;
320
- state.metaKeyEvents = null;
321
- for (let event of events.values())state.target.dispatchEvent(new KeyboardEvent("keyup", event));
328
+ state.metaKeyEvents = undefined;
329
+ for (let event of events.values())(_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
322
330
  }
323
331
  };
324
332
  if (typeof PointerEvent !== "undefined") {
@@ -346,9 +354,9 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
346
354
  if (!isDisabled && !preventFocusOnPress) (0, $bx7SL$focusWithoutScrolling)(e.currentTarget);
347
355
  if (!allowTextSelectionOnPress) (0, $14c0b72509d70225$export$16a4697467175487)(state.target);
348
356
  shouldStopPropagation = triggerPressStart(e, state.pointerType);
349
- addGlobalListener(document, "pointermove", onPointerMove, false);
350
- addGlobalListener(document, "pointerup", onPointerUp, false);
351
- addGlobalListener(document, "pointercancel", onPointerCancel, false);
357
+ addGlobalListener((0, $bx7SL$getOwnerDocument)(e.currentTarget), "pointermove", onPointerMove, false);
358
+ addGlobalListener((0, $bx7SL$getOwnerDocument)(e.currentTarget), "pointerup", onPointerUp, false);
359
+ addGlobalListener((0, $bx7SL$getOwnerDocument)(e.currentTarget), "pointercancel", onPointerCancel, false);
352
360
  }
353
361
  if (shouldStopPropagation) e.stopPropagation();
354
362
  };
@@ -375,21 +383,21 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
375
383
  // See https://bugs.webkit.org/show_bug.cgi?id=199803
376
384
  let onPointerMove = (e)=>{
377
385
  if (e.pointerId !== state.activePointerId) return;
378
- if ($f6c31cce2adf654f$var$isOverTarget(e, state.target)) {
379
- if (!state.isOverTarget) {
386
+ if (state.target && $f6c31cce2adf654f$var$isOverTarget(e, state.target)) {
387
+ if (!state.isOverTarget && state.pointerType != null) {
380
388
  state.isOverTarget = true;
381
389
  triggerPressStart($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType);
382
390
  }
383
- } else if (state.isOverTarget) {
391
+ } else if (state.target && state.isOverTarget && state.pointerType != null) {
384
392
  state.isOverTarget = false;
385
393
  triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
386
394
  cancelOnPointerExit(e);
387
395
  }
388
396
  };
389
397
  let onPointerUp = (e)=>{
390
- if (e.pointerId === state.activePointerId && state.isPressed && e.button === 0) {
391
- if ($f6c31cce2adf654f$var$isOverTarget(e, state.target)) triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType);
392
- else if (state.isOverTarget) triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
398
+ if (e.pointerId === state.activePointerId && state.isPressed && e.button === 0 && state.target) {
399
+ if ($f6c31cce2adf654f$var$isOverTarget(e, state.target) && state.pointerType != null) triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType);
400
+ else if (state.isOverTarget && state.pointerType != null) triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
393
401
  state.isPressed = false;
394
402
  state.isOverTarget = false;
395
403
  state.activePointerId = null;
@@ -424,12 +432,12 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
424
432
  if (!isDisabled && !preventFocusOnPress) (0, $bx7SL$focusWithoutScrolling)(e.currentTarget);
425
433
  let shouldStopPropagation = triggerPressStart(e, state.pointerType);
426
434
  if (shouldStopPropagation) e.stopPropagation();
427
- addGlobalListener(document, "mouseup", onMouseUp, false);
435
+ addGlobalListener((0, $bx7SL$getOwnerDocument)(e.currentTarget), "mouseup", onMouseUp, false);
428
436
  };
429
437
  pressProps.onMouseEnter = (e)=>{
430
438
  if (!e.currentTarget.contains(e.target)) return;
431
439
  let shouldStopPropagation = true;
432
- if (state.isPressed && !state.ignoreEmulatedMouseEvents) {
440
+ if (state.isPressed && !state.ignoreEmulatedMouseEvents && state.pointerType != null) {
433
441
  state.isOverTarget = true;
434
442
  shouldStopPropagation = triggerPressStart(e, state.pointerType);
435
443
  }
@@ -438,7 +446,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
438
446
  pressProps.onMouseLeave = (e)=>{
439
447
  if (!e.currentTarget.contains(e.target)) return;
440
448
  let shouldStopPropagation = true;
441
- if (state.isPressed && !state.ignoreEmulatedMouseEvents) {
449
+ if (state.isPressed && !state.ignoreEmulatedMouseEvents && state.pointerType != null) {
442
450
  state.isOverTarget = false;
443
451
  shouldStopPropagation = triggerPressEnd(e, state.pointerType, false);
444
452
  cancelOnPointerExit(e);
@@ -458,8 +466,8 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
458
466
  state.ignoreEmulatedMouseEvents = false;
459
467
  return;
460
468
  }
461
- if ($f6c31cce2adf654f$var$isOverTarget(e, state.target)) triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType);
462
- else if (state.isOverTarget) triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
469
+ if (state.target && $f6c31cce2adf654f$var$isOverTarget(e, state.target) && state.pointerType != null) triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType);
470
+ else if (state.target && state.isOverTarget && state.pointerType != null) triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
463
471
  state.isOverTarget = false;
464
472
  };
465
473
  pressProps.onTouchStart = (e)=>{
@@ -478,7 +486,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
478
486
  if (!allowTextSelectionOnPress) (0, $14c0b72509d70225$export$16a4697467175487)(state.target);
479
487
  let shouldStopPropagation = triggerPressStart(e, state.pointerType);
480
488
  if (shouldStopPropagation) e.stopPropagation();
481
- addGlobalListener(window, "scroll", onScroll, true);
489
+ addGlobalListener((0, $bx7SL$getOwnerWindow)(e.currentTarget), "scroll", onScroll, true);
482
490
  };
483
491
  pressProps.onTouchMove = (e)=>{
484
492
  if (!e.currentTarget.contains(e.target)) return;
@@ -489,11 +497,11 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
489
497
  let touch = $f6c31cce2adf654f$var$getTouchById(e.nativeEvent, state.activePointerId);
490
498
  let shouldStopPropagation = true;
491
499
  if (touch && $f6c31cce2adf654f$var$isOverTarget(touch, e.currentTarget)) {
492
- if (!state.isOverTarget) {
500
+ if (!state.isOverTarget && state.pointerType != null) {
493
501
  state.isOverTarget = true;
494
502
  shouldStopPropagation = triggerPressStart(e, state.pointerType);
495
503
  }
496
- } else if (state.isOverTarget) {
504
+ } else if (state.isOverTarget && state.pointerType != null) {
497
505
  state.isOverTarget = false;
498
506
  shouldStopPropagation = triggerPressEnd(e, state.pointerType, false);
499
507
  cancelOnPointerExit(e);
@@ -508,16 +516,16 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
508
516
  }
509
517
  let touch = $f6c31cce2adf654f$var$getTouchById(e.nativeEvent, state.activePointerId);
510
518
  let shouldStopPropagation = true;
511
- if (touch && $f6c31cce2adf654f$var$isOverTarget(touch, e.currentTarget)) {
519
+ if (touch && $f6c31cce2adf654f$var$isOverTarget(touch, e.currentTarget) && state.pointerType != null) {
512
520
  triggerPressUp(e, state.pointerType);
513
521
  shouldStopPropagation = triggerPressEnd(e, state.pointerType);
514
- } else if (state.isOverTarget) shouldStopPropagation = triggerPressEnd(e, state.pointerType, false);
522
+ } else if (state.isOverTarget && state.pointerType != null) shouldStopPropagation = triggerPressEnd(e, state.pointerType, false);
515
523
  if (shouldStopPropagation) e.stopPropagation();
516
524
  state.isPressed = false;
517
525
  state.activePointerId = null;
518
526
  state.isOverTarget = false;
519
527
  state.ignoreEmulatedMouseEvents = true;
520
- if (!allowTextSelectionOnPress) (0, $14c0b72509d70225$export$b0d6fa1ab32e3295)(state.target);
528
+ if (state.target && !allowTextSelectionOnPress) (0, $14c0b72509d70225$export$b0d6fa1ab32e3295)(state.target);
521
529
  removeAllGlobalListeners();
522
530
  };
523
531
  pressProps.onTouchCancel = (e)=>{
@@ -556,8 +564,9 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
556
564
  // eslint-disable-next-line arrow-body-style
557
565
  (0, $bx7SL$useEffect)(()=>{
558
566
  return ()=>{
567
+ var _ref_current_target;
559
568
  if (!allowTextSelectionOnPress) // eslint-disable-next-line react-hooks/exhaustive-deps
560
- (0, $14c0b72509d70225$export$b0d6fa1ab32e3295)(ref.current.target);
569
+ (0, $14c0b72509d70225$export$b0d6fa1ab32e3295)((_ref_current_target = ref.current.target) !== null && _ref_current_target !== void 0 ? _ref_current_target : undefined);
561
570
  };
562
571
  }, [
563
572
  allowTextSelectionOnPress
@@ -576,7 +585,7 @@ function $f6c31cce2adf654f$var$isValidKeyboardEvent(event, currentTarget) {
576
585
  const role = element.getAttribute("role");
577
586
  // Accessibility for keyboards. Space and Enter only.
578
587
  // "Spacebar" is for IE 11
579
- return (key === "Enter" || key === " " || key === "Spacebar" || code === "Space") && !(element instanceof HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey(element, key) || element instanceof HTMLTextAreaElement || element.isContentEditable) && // Links should only trigger with Enter key
588
+ return (key === "Enter" || key === " " || key === "Spacebar" || code === "Space") && !(element instanceof (0, $bx7SL$getOwnerWindow)(element).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey(element, key) || element instanceof (0, $bx7SL$getOwnerWindow)(element).HTMLTextAreaElement || element.isContentEditable) && // Links should only trigger with Enter key
580
589
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink(element)) && key !== "Enter");
581
590
  }
582
591
  function $f6c31cce2adf654f$var$getTouchFromEvent(event) {
@@ -602,8 +611,12 @@ function $f6c31cce2adf654f$var$createEvent(target, e) {
602
611
  };
603
612
  }
604
613
  function $f6c31cce2adf654f$var$getPointClientRect(point) {
605
- let offsetX = point.width / 2 || point.radiusX || 0;
606
- let offsetY = point.height / 2 || point.radiusY || 0;
614
+ let offsetX = 0;
615
+ let offsetY = 0;
616
+ if (point.width !== undefined) offsetX = point.width / 2;
617
+ else if (point.radiusX !== undefined) offsetX = point.radiusX;
618
+ if (point.height !== undefined) offsetY = point.height / 2;
619
+ else if (point.radiusY !== undefined) offsetY = point.radiusY;
607
620
  return {
608
621
  top: point.clientY - offsetY,
609
622
  right: point.clientX + offsetX,
@@ -652,8 +665,7 @@ function $f6c31cce2adf654f$var$isValidInputKey(target, key) {
652
665
 
653
666
 
654
667
  const $3b117e43dc0ca95d$export$27c701ed9e449e99 = /*#__PURE__*/ (0, $bx7SL$react).forwardRef(({ children: children, ...props }, ref)=>{
655
- let newRef = (0, $bx7SL$useRef)();
656
- ref = ref !== null && ref !== void 0 ? ref : newRef;
668
+ ref = (0, $bx7SL$useObjectRef)(ref);
657
669
  let { pressProps: pressProps } = (0, $f6c31cce2adf654f$export$45712eceda6fad21)({
658
670
  ...props,
659
671
  ref: ref
@@ -683,9 +695,10 @@ const $3b117e43dc0ca95d$export$27c701ed9e449e99 = /*#__PURE__*/ (0, $bx7SL$react
683
695
  const $f1ab8c75478c6f73$export$3351871ee4b288b8 = /*#__PURE__*/ (0, $bx7SL$react).forwardRef(({ children: children, ...props }, ref)=>{
684
696
  let isRegistered = (0, $bx7SL$useRef)(false);
685
697
  let prevContext = (0, $bx7SL$useContext)((0, $ae1eeba8b9eafd08$export$5165eccb35aaadb5));
698
+ ref = (0, $bx7SL$useObjectRef)(ref || (prevContext === null || prevContext === void 0 ? void 0 : prevContext.ref));
686
699
  let context = (0, $bx7SL$mergeProps)(prevContext || {}, {
687
700
  ...props,
688
- ref: ref || (prevContext === null || prevContext === void 0 ? void 0 : prevContext.ref),
701
+ ref: ref,
689
702
  register () {
690
703
  isRegistered.current = true;
691
704
  if (prevContext) prevContext.register();
@@ -703,8 +716,11 @@ const $f1ab8c75478c6f73$export$3351871ee4b288b8 = /*#__PURE__*/ (0, $bx7SL$react
703
716
  }, children);
704
717
  });
705
718
  function $f1ab8c75478c6f73$export$cf75428e0b9ed1ea({ children: children }) {
719
+ let context = (0, $bx7SL$useMemo)(()=>({
720
+ register: ()=>{}
721
+ }), []);
706
722
  return /*#__PURE__*/ (0, $bx7SL$react).createElement((0, $ae1eeba8b9eafd08$export$5165eccb35aaadb5).Provider, {
707
- value: undefined
723
+ value: context
708
724
  }, children);
709
725
  }
710
726
 
@@ -809,7 +825,8 @@ function $8a9cb279dc87e130$export$715c682d09d639cc(onBlur) {
809
825
  });
810
826
  stateRef.current.observer = new MutationObserver(()=>{
811
827
  if (stateRef.current.isFocused && target.disabled) {
812
- stateRef.current.observer.disconnect();
828
+ var _stateRef_current_observer;
829
+ (_stateRef_current_observer = stateRef.current.observer) === null || _stateRef_current_observer === void 0 ? void 0 : _stateRef_current_observer.disconnect();
813
830
  let relatedTargetEl = target === document.activeElement ? null : document.activeElement;
814
831
  target.dispatchEvent(new FocusEvent("blur", {
815
832
  relatedTarget: relatedTargetEl
@@ -1003,10 +1020,23 @@ function $507fabe10e71c6fb$export$98e20ec92f614cfe() {
1003
1020
  }, []);
1004
1021
  return (0, $bx7SL$useIsSSR)() ? null : modality;
1005
1022
  }
1023
+ const $507fabe10e71c6fb$var$nonTextInputTypes = new Set([
1024
+ "checkbox",
1025
+ "radio",
1026
+ "range",
1027
+ "color",
1028
+ "file",
1029
+ "image",
1030
+ "button",
1031
+ "submit",
1032
+ "reset"
1033
+ ]);
1006
1034
  /**
1007
1035
  * If this is attached to text input component, return if the event is a focus event (Tab/Escape keys pressed) so that
1008
1036
  * focus visible style can be properly set.
1009
1037
  */ function $507fabe10e71c6fb$var$isKeyboardFocusEvent(isTextInput, modality, e) {
1038
+ var _e_target;
1039
+ isTextInput = isTextInput || (e === null || e === void 0 ? void 0 : e.target) instanceof HTMLInputElement && !$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 HTMLTextAreaElement || (e === null || e === void 0 ? void 0 : e.target) instanceof HTMLElement && (e === null || e === void 0 ? void 0 : e.target.isContentEditable);
1010
1040
  return !(isTextInput && modality === "keyboard" && e instanceof KeyboardEvent && !$507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS[e.key]);
1011
1041
  }
1012
1042
  function $507fabe10e71c6fb$export$ffd9e5021c1fb2d6(props = {}) {
@@ -1027,7 +1057,7 @@ function $507fabe10e71c6fb$export$ec71b4b83ac08ec3(fn, deps, opts) {
1027
1057
  $507fabe10e71c6fb$var$setupGlobalFocusEvents();
1028
1058
  (0, $bx7SL$useEffect)(()=>{
1029
1059
  let handler = (modality, e)=>{
1030
- if (!$507fabe10e71c6fb$var$isKeyboardFocusEvent(opts === null || opts === void 0 ? void 0 : opts.isTextInput, modality, e)) return;
1060
+ if (!$507fabe10e71c6fb$var$isKeyboardFocusEvent(!!(opts === null || opts === void 0 ? void 0 : opts.isTextInput), modality, e)) return;
1031
1061
  fn($507fabe10e71c6fb$export$b9b3dfddab17db27());
1032
1062
  };
1033
1063
  $507fabe10e71c6fb$var$changeHandlers.add(handler);
@@ -1091,8 +1121,9 @@ function $9ab94262bd0047c7$export$420e68273165f4ec(props) {
1091
1121
  ]);
1092
1122
  if (isDisabled) return {
1093
1123
  focusWithinProps: {
1094
- onFocus: null,
1095
- onBlur: null
1124
+ // These should not have been null, that would conflict in mergeProps
1125
+ onFocus: undefined,
1126
+ onBlur: undefined
1096
1127
  }
1097
1128
  };
1098
1129
  return {
@@ -1271,6 +1302,8 @@ function $e0b6e0b68ec7f50f$export$872b660ac5a1ff98(props) {
1271
1302
  (0, $bx7SL$useEffect)(()=>{
1272
1303
  let state = stateRef.current;
1273
1304
  if (isDisabled) return;
1305
+ const element = ref.current;
1306
+ const documentObject = (0, $bx7SL$getOwnerDocument)(element);
1274
1307
  // Use pointer events if available. Otherwise, fall back to mouse and touch events.
1275
1308
  if (typeof PointerEvent !== "undefined") {
1276
1309
  let onPointerUp = (e)=>{
@@ -1278,11 +1311,11 @@ function $e0b6e0b68ec7f50f$export$872b660ac5a1ff98(props) {
1278
1311
  state.isPointerDown = false;
1279
1312
  };
1280
1313
  // changing these to capture phase fixed combobox
1281
- document.addEventListener("pointerdown", onPointerDown, true);
1282
- document.addEventListener("pointerup", onPointerUp, true);
1314
+ documentObject.addEventListener("pointerdown", onPointerDown, true);
1315
+ documentObject.addEventListener("pointerup", onPointerUp, true);
1283
1316
  return ()=>{
1284
- document.removeEventListener("pointerdown", onPointerDown, true);
1285
- document.removeEventListener("pointerup", onPointerUp, true);
1317
+ documentObject.removeEventListener("pointerdown", onPointerDown, true);
1318
+ documentObject.removeEventListener("pointerup", onPointerUp, true);
1286
1319
  };
1287
1320
  } else {
1288
1321
  let onMouseUp = (e)=>{
@@ -1295,15 +1328,15 @@ function $e0b6e0b68ec7f50f$export$872b660ac5a1ff98(props) {
1295
1328
  if (state.isPointerDown && $e0b6e0b68ec7f50f$var$isValidEvent(e, ref)) triggerInteractOutside(e);
1296
1329
  state.isPointerDown = false;
1297
1330
  };
1298
- document.addEventListener("mousedown", onPointerDown, true);
1299
- document.addEventListener("mouseup", onMouseUp, true);
1300
- document.addEventListener("touchstart", onPointerDown, true);
1301
- document.addEventListener("touchend", onTouchEnd, true);
1331
+ documentObject.addEventListener("mousedown", onPointerDown, true);
1332
+ documentObject.addEventListener("mouseup", onMouseUp, true);
1333
+ documentObject.addEventListener("touchstart", onPointerDown, true);
1334
+ documentObject.addEventListener("touchend", onTouchEnd, true);
1302
1335
  return ()=>{
1303
- document.removeEventListener("mousedown", onPointerDown, true);
1304
- document.removeEventListener("mouseup", onMouseUp, true);
1305
- document.removeEventListener("touchstart", onPointerDown, true);
1306
- document.removeEventListener("touchend", onTouchEnd, true);
1336
+ documentObject.removeEventListener("mousedown", onPointerDown, true);
1337
+ documentObject.removeEventListener("mouseup", onMouseUp, true);
1338
+ documentObject.removeEventListener("touchstart", onPointerDown, true);
1339
+ documentObject.removeEventListener("touchend", onTouchEnd, true);
1307
1340
  };
1308
1341
  }
1309
1342
  }, [
@@ -1347,7 +1380,7 @@ function $e0b6e0b68ec7f50f$var$isValidEvent(event, ref) {
1347
1380
  * OF ANY KIND, either express or implied. See the License for the specific language
1348
1381
  * governing permissions and limitations under the License.
1349
1382
  */ function $93925083ecbb358c$export$48d1ea6320830260(handler) {
1350
- if (!handler) return;
1383
+ if (!handler) return undefined;
1351
1384
  let shouldStopPropagation = true;
1352
1385
  return (e)=>{
1353
1386
  let event = {
@@ -1415,7 +1448,7 @@ function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
1415
1448
  altKey: originalEvent.altKey
1416
1449
  });
1417
1450
  }
1418
- onMove({
1451
+ onMove === null || onMove === void 0 ? void 0 : onMove({
1419
1452
  type: "move",
1420
1453
  pointerType: pointerType,
1421
1454
  deltaX: deltaX,
@@ -1446,7 +1479,9 @@ function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
1446
1479
  if (typeof PointerEvent === "undefined") {
1447
1480
  let onMouseMove = (e)=>{
1448
1481
  if (e.button === 0) {
1449
- move(e, "mouse", e.pageX - state.current.lastPosition.pageX, e.pageY - state.current.lastPosition.pageY);
1482
+ var _state_current_lastPosition, _state_current_lastPosition1;
1483
+ var _state_current_lastPosition_pageX, _state_current_lastPosition_pageY;
1484
+ move(e, "mouse", e.pageX - ((_state_current_lastPosition_pageX = (_state_current_lastPosition = state.current.lastPosition) === null || _state_current_lastPosition === void 0 ? void 0 : _state_current_lastPosition.pageX) !== null && _state_current_lastPosition_pageX !== void 0 ? _state_current_lastPosition_pageX : 0), e.pageY - ((_state_current_lastPosition_pageY = (_state_current_lastPosition1 = state.current.lastPosition) === null || _state_current_lastPosition1 === void 0 ? void 0 : _state_current_lastPosition1.pageY) !== null && _state_current_lastPosition_pageY !== void 0 ? _state_current_lastPosition_pageY : 0));
1450
1485
  state.current.lastPosition = {
1451
1486
  pageX: e.pageX,
1452
1487
  pageY: e.pageY
@@ -1478,8 +1513,10 @@ function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
1478
1513
  ...e.changedTouches
1479
1514
  ].findIndex(({ identifier: identifier })=>identifier === state.current.id);
1480
1515
  if (touch >= 0) {
1516
+ var _state_current_lastPosition, _state_current_lastPosition1;
1481
1517
  let { pageX: pageX, pageY: pageY } = e.changedTouches[touch];
1482
- move(e, "touch", pageX - state.current.lastPosition.pageX, pageY - state.current.lastPosition.pageY);
1518
+ var _state_current_lastPosition_pageX, _state_current_lastPosition_pageY;
1519
+ move(e, "touch", pageX - ((_state_current_lastPosition_pageX = (_state_current_lastPosition = state.current.lastPosition) === null || _state_current_lastPosition === void 0 ? void 0 : _state_current_lastPosition.pageX) !== null && _state_current_lastPosition_pageX !== void 0 ? _state_current_lastPosition_pageX : 0), pageY - ((_state_current_lastPosition_pageY = (_state_current_lastPosition1 = state.current.lastPosition) === null || _state_current_lastPosition1 === void 0 ? void 0 : _state_current_lastPosition1.pageY) !== null && _state_current_lastPosition_pageY !== void 0 ? _state_current_lastPosition_pageY : 0));
1483
1520
  state.current.lastPosition = {
1484
1521
  pageX: pageX,
1485
1522
  pageY: pageY
@@ -1516,11 +1553,13 @@ function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
1516
1553
  } else {
1517
1554
  let onPointerMove = (e)=>{
1518
1555
  if (e.pointerId === state.current.id) {
1556
+ var _state_current_lastPosition, _state_current_lastPosition1;
1519
1557
  let pointerType = e.pointerType || "mouse";
1558
+ var _state_current_lastPosition_pageX, _state_current_lastPosition_pageY;
1520
1559
  // Problems with PointerEvent#movementX/movementY:
1521
1560
  // 1. it is always 0 on macOS Safari.
1522
1561
  // 2. On Chrome Android, it's scaled by devicePixelRatio, but not on Chrome macOS
1523
- move(e, pointerType, e.pageX - state.current.lastPosition.pageX, e.pageY - state.current.lastPosition.pageY);
1562
+ move(e, pointerType, e.pageX - ((_state_current_lastPosition_pageX = (_state_current_lastPosition = state.current.lastPosition) === null || _state_current_lastPosition === void 0 ? void 0 : _state_current_lastPosition.pageX) !== null && _state_current_lastPosition_pageX !== void 0 ? _state_current_lastPosition_pageX : 0), e.pageY - ((_state_current_lastPosition_pageY = (_state_current_lastPosition1 = state.current.lastPosition) === null || _state_current_lastPosition1 === void 0 ? void 0 : _state_current_lastPosition1.pageY) !== null && _state_current_lastPosition_pageY !== void 0 ? _state_current_lastPosition_pageY : 0));
1524
1563
  state.current.lastPosition = {
1525
1564
  pageX: e.pageX,
1526
1565
  pageY: e.pageY
@@ -1628,7 +1667,7 @@ function $7d0a636d7a4dcefd$export$2123ff2b87c81ca(props, ref) {
1628
1667
  }, [
1629
1668
  onScroll
1630
1669
  ]);
1631
- (0, $bx7SL$useEvent)(ref, "wheel", isDisabled ? null : onScrollHandler);
1670
+ (0, $bx7SL$useEvent)(ref, "wheel", isDisabled ? undefined : onScrollHandler);
1632
1671
  }
1633
1672
 
1634
1673
 
@@ -1648,7 +1687,7 @@ function $7d0a636d7a4dcefd$export$2123ff2b87c81ca(props, ref) {
1648
1687
  const $8a26561d2877236e$var$DEFAULT_THRESHOLD = 500;
1649
1688
  function $8a26561d2877236e$export$c24ed0104d07eab9(props) {
1650
1689
  let { isDisabled: isDisabled, onLongPressStart: onLongPressStart, onLongPressEnd: onLongPressEnd, onLongPress: onLongPress, threshold: threshold = $8a26561d2877236e$var$DEFAULT_THRESHOLD, accessibilityDescription: accessibilityDescription } = props;
1651
- const timeRef = (0, $bx7SL$useRef)(null);
1690
+ const timeRef = (0, $bx7SL$useRef)();
1652
1691
  let { addGlobalListener: addGlobalListener, removeGlobalListener: removeGlobalListener } = (0, $bx7SL$useGlobalListeners)();
1653
1692
  let { pressProps: pressProps } = (0, $f6c31cce2adf654f$export$45712eceda6fad21)({
1654
1693
  isDisabled: isDisabled,
@@ -1668,7 +1707,7 @@ function $8a26561d2877236e$export$c24ed0104d07eab9(props) {
1668
1707
  ...e,
1669
1708
  type: "longpress"
1670
1709
  });
1671
- timeRef.current = null;
1710
+ timeRef.current = undefined;
1672
1711
  }, threshold);
1673
1712
  // Prevent context menu, which may be opened on long press on touch devices
1674
1713
  if (e.pointerType === "touch") {
@@ -1698,7 +1737,7 @@ function $8a26561d2877236e$export$c24ed0104d07eab9(props) {
1698
1737
  });
1699
1738
  }
1700
1739
  });
1701
- let descriptionProps = (0, $bx7SL$useDescription)(onLongPress && !isDisabled ? accessibilityDescription : null);
1740
+ let descriptionProps = (0, $bx7SL$useDescription)(onLongPress && !isDisabled ? accessibilityDescription : undefined);
1702
1741
  return {
1703
1742
  longPressProps: (0, $bx7SL$mergeProps)(pressProps, descriptionProps)
1704
1743
  };