@react-aria/utils 3.21.1 → 3.23.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
@@ -69,6 +69,7 @@ function $8ae05eaa5c114e9c$export$7f54fc3180508a52(fn) {
69
69
  }, [
70
70
  fn
71
71
  ]);
72
+ // @ts-ignore
72
73
  return (0, $12uGp$useCallback)((...args)=>{
73
74
  const f = ref.current;
74
75
  return f(...args);
@@ -110,6 +111,8 @@ function $1dbecbe27a04f9af$export$14d238f342723f25(defaultValue) {
110
111
  }
111
112
 
112
113
 
114
+ // copied from SSRProvider.tsx to reduce exports, if needed again, consider sharing
115
+ let $bdb11010cef70236$var$canUseDOM = Boolean(typeof window !== "undefined" && window.document && window.document.createElement);
113
116
  let $bdb11010cef70236$var$idsUpdaterMap = new Map();
114
117
  function $bdb11010cef70236$export$f680877a34711e37(defaultId) {
115
118
  let [value, setValue] = (0, $12uGp$useState)(defaultId);
@@ -118,7 +121,7 @@ function $bdb11010cef70236$export$f680877a34711e37(defaultId) {
118
121
  let updateValue = (0, $12uGp$useCallback)((val)=>{
119
122
  nextId.current = val;
120
123
  }, []);
121
- $bdb11010cef70236$var$idsUpdaterMap.set(res, updateValue);
124
+ if ($bdb11010cef70236$var$canUseDOM) $bdb11010cef70236$var$idsUpdaterMap.set(res, updateValue);
122
125
  (0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
123
126
  let r = res;
124
127
  return ()=>{
@@ -192,6 +195,17 @@ function $bdb11010cef70236$export$b4cc09c592e8fdb8(depArray = []) {
192
195
  }
193
196
 
194
197
 
198
+ const $431fbd86ca7dc216$export$b204af158042fbac = (el)=>{
199
+ var _el_ownerDocument;
200
+ return (_el_ownerDocument = el === null || el === void 0 ? void 0 : el.ownerDocument) !== null && _el_ownerDocument !== void 0 ? _el_ownerDocument : document;
201
+ };
202
+ const $431fbd86ca7dc216$export$f21a1ffae260145a = (el)=>{
203
+ if (el && "window" in el && el.window === el) return el;
204
+ const doc = $431fbd86ca7dc216$export$b204af158042fbac(el);
205
+ return doc.defaultView || window;
206
+ };
207
+
208
+
195
209
  /*
196
210
  * Copyright 2020 Adobe. All rights reserved.
197
211
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -462,7 +476,7 @@ function $ea8dcbcb9ea1b556$export$efa8c9099e530235(link, modifiers) {
462
476
  !modifiers.shiftKey;
463
477
  }
464
478
  function $ea8dcbcb9ea1b556$export$95185d699e05d4d7(target, modifiers, setOpening = true) {
465
- var _window_event, _window_event_type;
479
+ var _window_event_type, _window_event;
466
480
  let { metaKey: metaKey, ctrlKey: ctrlKey, altKey: altKey, shiftKey: shiftKey } = modifiers;
467
481
  // Firefox does not recognize keyboard events as a user action by default, and the popup blocker
468
482
  // will prevent links with target="_blank" from opening. However, it does allow the event if the
@@ -933,14 +947,16 @@ function $e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, ref) {
933
947
  * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
934
948
  * OF ANY KIND, either express or implied. See the License for the specific language
935
949
  * governing permissions and limitations under the License.
936
- */ function $62d8ded9296f3872$export$cfa2225e87938781(node) {
937
- if ($62d8ded9296f3872$export$2bb74740c4e19def(node)) node = node.parentElement;
938
- while(node && !$62d8ded9296f3872$export$2bb74740c4e19def(node))node = node.parentElement;
950
+ */ function $62d8ded9296f3872$export$cfa2225e87938781(node, checkForOverflow) {
951
+ if ($62d8ded9296f3872$export$2bb74740c4e19def(node, checkForOverflow)) node = node.parentElement;
952
+ while(node && !$62d8ded9296f3872$export$2bb74740c4e19def(node, checkForOverflow))node = node.parentElement;
939
953
  return node || document.scrollingElement || document.documentElement;
940
954
  }
941
- function $62d8ded9296f3872$export$2bb74740c4e19def(node) {
955
+ function $62d8ded9296f3872$export$2bb74740c4e19def(node, checkForOverflow) {
942
956
  let style = window.getComputedStyle(node);
943
- return /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);
957
+ let isScrollable = /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);
958
+ if (isScrollable && checkForOverflow) isScrollable = node.scrollHeight !== node.clientHeight || node.scrollWidth !== node.clientWidth;
959
+ return isScrollable;
944
960
  }
945
961
 
946
962
 
@@ -1141,7 +1157,7 @@ function $2f04cbc44ee30ce0$export$c826860796309d1b(targetElement, opts) {
1141
1157
  let { left: newLeft, top: newTop } = targetElement.getBoundingClientRect();
1142
1158
  // Account for sub pixel differences from rounding
1143
1159
  if (Math.abs(originalLeft - newLeft) > 1 || Math.abs(originalTop - newTop) > 1) {
1144
- var _opts_containingElement, _opts_containingElement_scrollIntoView, _targetElement_scrollIntoView1;
1160
+ var _opts_containingElement_scrollIntoView, _opts_containingElement, _targetElement_scrollIntoView1;
1145
1161
  opts === null || opts === void 0 ? void 0 : (_opts_containingElement = opts.containingElement) === null || _opts_containingElement === void 0 ? void 0 : (_opts_containingElement_scrollIntoView = _opts_containingElement.scrollIntoView) === null || _opts_containingElement_scrollIntoView === void 0 ? void 0 : _opts_containingElement_scrollIntoView.call(_opts_containingElement, {
1146
1162
  block: "center",
1147
1163
  inline: "center"
@@ -1250,5 +1266,5 @@ function $99facab73266f662$export$5add1d006293d136(ref, initialValue, onReset) {
1250
1266
 
1251
1267
 
1252
1268
 
1253
- export {$bdb11010cef70236$export$f680877a34711e37 as useId, $bdb11010cef70236$export$cd8c9cb68f842629 as mergeIds, $bdb11010cef70236$export$b4cc09c592e8fdb8 as useSlotId, $ff5963eb1fccf552$export$e08e3b67e392101e as chain, $3ef42575df84b30b$export$9d1611c77c2fe928 as mergeProps, $5dc95899b306f630$export$c9058316764c140e as mergeRefs, $65484d02dcb7eb3e$export$457c3d6518dd4c6f as filterDOMProps, $7215afc6de606d6b$export$de79e2c695e052f3 as focusWithoutScrolling, $ab71dadb03a6fb2e$export$622cea445a1c5b7d as getOffset, $ea8dcbcb9ea1b556$export$95185d699e05d4d7 as openLink, $ea8dcbcb9ea1b556$export$51437d503373d223 as getSyntheticLinkProps, $ea8dcbcb9ea1b556$export$323e4fc2fa4753fb as RouterProvider, $ea8dcbcb9ea1b556$export$efa8c9099e530235 as shouldClientNavigate, $ea8dcbcb9ea1b556$export$9a302a45f65d0572 as useRouter, $bbed8b41f857bcc0$export$24490316f764c430 as runAfterTransition, $9cc09df9fd7676be$export$7bbed75feba39706 as useDrag1D, $03deb23ff14920c4$export$4eaf04e54aa8eed6 as useGlobalListeners, $313b98861ee5dd6c$export$d6875122194c7b44 as useLabels, $df56164dff5785e2$export$4338b53315abf666 as useObjectRef, $4f58c5f72bcf79f7$export$496315a1608d9602 as useUpdateEffect, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c as useLayoutEffect, $9daab02d461809db$export$683480f191c0e3ea as useResizeObserver, $e7801be82b4b2a53$export$4debdb1a3f0fa79e as useSyncRef, $62d8ded9296f3872$export$cfa2225e87938781 as getScrollParent, $62d8ded9296f3872$export$2bb74740c4e19def as isScrollable, $5df64b3807dc15ee$export$d699905dd57c73ca as useViewportSize, $ef06256079686ba0$export$f8aeda7b10753fa1 as useDescription, $c87311424ea30a05$export$9ac100e40613ea10 as isMac, $c87311424ea30a05$export$186c6964ca17d99 as isIPhone, $c87311424ea30a05$export$7bef049ce92e4224 as isIPad, $c87311424ea30a05$export$fedb369cb70207f1 as isIOS, $c87311424ea30a05$export$e1865c3bedcd822b as isAppleDevice, $c87311424ea30a05$export$78551043582a6a98 as isWebKit, $c87311424ea30a05$export$6446a186d09e379e as isChrome, $c87311424ea30a05$export$a11b0059900ceec8 as isAndroid, $e9faafb641e167db$export$90fc3a17d93f704c as useEvent, $1dbecbe27a04f9af$export$14d238f342723f25 as useValueEffect, $2f04cbc44ee30ce0$export$53a0910f038337bd as scrollIntoView, $2f04cbc44ee30ce0$export$c826860796309d1b as scrollIntoViewport, $4507461a1b870123$re_export$clamp as clamp, $4507461a1b870123$re_export$snapValueToStep as snapValueToStep, $6a7db85432448f7f$export$60278871457622de as isVirtualClick, $6a7db85432448f7f$export$29bf1b5f2c56cf63 as isVirtualPointerEvent, $8ae05eaa5c114e9c$export$7f54fc3180508a52 as useEffectEvent, $5a387cc49350e6db$export$722debc0e56fea39 as useDeepMemo, $99facab73266f662$export$5add1d006293d136 as useFormReset};
1269
+ export {$bdb11010cef70236$export$f680877a34711e37 as useId, $bdb11010cef70236$export$cd8c9cb68f842629 as mergeIds, $bdb11010cef70236$export$b4cc09c592e8fdb8 as useSlotId, $ff5963eb1fccf552$export$e08e3b67e392101e as chain, $431fbd86ca7dc216$export$b204af158042fbac as getOwnerDocument, $431fbd86ca7dc216$export$f21a1ffae260145a as getOwnerWindow, $3ef42575df84b30b$export$9d1611c77c2fe928 as mergeProps, $5dc95899b306f630$export$c9058316764c140e as mergeRefs, $65484d02dcb7eb3e$export$457c3d6518dd4c6f as filterDOMProps, $7215afc6de606d6b$export$de79e2c695e052f3 as focusWithoutScrolling, $ab71dadb03a6fb2e$export$622cea445a1c5b7d as getOffset, $ea8dcbcb9ea1b556$export$95185d699e05d4d7 as openLink, $ea8dcbcb9ea1b556$export$51437d503373d223 as getSyntheticLinkProps, $ea8dcbcb9ea1b556$export$323e4fc2fa4753fb as RouterProvider, $ea8dcbcb9ea1b556$export$efa8c9099e530235 as shouldClientNavigate, $ea8dcbcb9ea1b556$export$9a302a45f65d0572 as useRouter, $bbed8b41f857bcc0$export$24490316f764c430 as runAfterTransition, $9cc09df9fd7676be$export$7bbed75feba39706 as useDrag1D, $03deb23ff14920c4$export$4eaf04e54aa8eed6 as useGlobalListeners, $313b98861ee5dd6c$export$d6875122194c7b44 as useLabels, $df56164dff5785e2$export$4338b53315abf666 as useObjectRef, $4f58c5f72bcf79f7$export$496315a1608d9602 as useUpdateEffect, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c as useLayoutEffect, $9daab02d461809db$export$683480f191c0e3ea as useResizeObserver, $e7801be82b4b2a53$export$4debdb1a3f0fa79e as useSyncRef, $62d8ded9296f3872$export$cfa2225e87938781 as getScrollParent, $62d8ded9296f3872$export$2bb74740c4e19def as isScrollable, $5df64b3807dc15ee$export$d699905dd57c73ca as useViewportSize, $ef06256079686ba0$export$f8aeda7b10753fa1 as useDescription, $c87311424ea30a05$export$9ac100e40613ea10 as isMac, $c87311424ea30a05$export$186c6964ca17d99 as isIPhone, $c87311424ea30a05$export$7bef049ce92e4224 as isIPad, $c87311424ea30a05$export$fedb369cb70207f1 as isIOS, $c87311424ea30a05$export$e1865c3bedcd822b as isAppleDevice, $c87311424ea30a05$export$78551043582a6a98 as isWebKit, $c87311424ea30a05$export$6446a186d09e379e as isChrome, $c87311424ea30a05$export$a11b0059900ceec8 as isAndroid, $c87311424ea30a05$export$b7d78993b74f766d as isFirefox, $e9faafb641e167db$export$90fc3a17d93f704c as useEvent, $1dbecbe27a04f9af$export$14d238f342723f25 as useValueEffect, $2f04cbc44ee30ce0$export$53a0910f038337bd as scrollIntoView, $2f04cbc44ee30ce0$export$c826860796309d1b as scrollIntoViewport, $4507461a1b870123$re_export$clamp as clamp, $4507461a1b870123$re_export$snapValueToStep as snapValueToStep, $6a7db85432448f7f$export$60278871457622de as isVirtualClick, $6a7db85432448f7f$export$29bf1b5f2c56cf63 as isVirtualPointerEvent, $8ae05eaa5c114e9c$export$7f54fc3180508a52 as useEffectEvent, $5a387cc49350e6db$export$722debc0e56fea39 as useDeepMemo, $99facab73266f662$export$5add1d006293d136 as useFormReset};
1254
1270
  //# sourceMappingURL=module.js.map
package/dist/main.js CHANGED
@@ -3,9 +3,11 @@ var $1Yh1N$react = require("react");
3
3
  var $1Yh1N$reactariassr = require("@react-aria/ssr");
4
4
  var $1Yh1N$clsx = require("clsx");
5
5
 
6
+
6
7
  function $parcel$export(e, n, v, s) {
7
8
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
8
9
  }
10
+
9
11
  function $parcel$interopDefault(a) {
10
12
  return a && a.__esModule ? a.default : a;
11
13
  }
@@ -14,6 +16,8 @@ $parcel$export(module.exports, "useId", () => $8c61827343eed941$export$f680877a3
14
16
  $parcel$export(module.exports, "mergeIds", () => $8c61827343eed941$export$cd8c9cb68f842629);
15
17
  $parcel$export(module.exports, "useSlotId", () => $8c61827343eed941$export$b4cc09c592e8fdb8);
16
18
  $parcel$export(module.exports, "chain", () => $1e2191638e54f613$export$e08e3b67e392101e);
19
+ $parcel$export(module.exports, "getOwnerDocument", () => $aaa611146751592e$export$b204af158042fbac);
20
+ $parcel$export(module.exports, "getOwnerWindow", () => $aaa611146751592e$export$f21a1ffae260145a);
17
21
  $parcel$export(module.exports, "mergeProps", () => $f847cd1382ea7cd4$export$9d1611c77c2fe928);
18
22
  $parcel$export(module.exports, "mergeRefs", () => $f05dc24eafaeb7e2$export$c9058316764c140e);
19
23
  $parcel$export(module.exports, "filterDOMProps", () => $8d15d0e1797d4238$export$457c3d6518dd4c6f);
@@ -45,6 +49,7 @@ $parcel$export(module.exports, "isAppleDevice", () => $9e20cff0af27e8cc$export$e
45
49
  $parcel$export(module.exports, "isWebKit", () => $9e20cff0af27e8cc$export$78551043582a6a98);
46
50
  $parcel$export(module.exports, "isChrome", () => $9e20cff0af27e8cc$export$6446a186d09e379e);
47
51
  $parcel$export(module.exports, "isAndroid", () => $9e20cff0af27e8cc$export$a11b0059900ceec8);
52
+ $parcel$export(module.exports, "isFirefox", () => $9e20cff0af27e8cc$export$b7d78993b74f766d);
48
53
  $parcel$export(module.exports, "useEvent", () => $2a8c0bb1629926c8$export$90fc3a17d93f704c);
49
54
  $parcel$export(module.exports, "useValueEffect", () => $19a2307bfabafaf1$export$14d238f342723f25);
50
55
  $parcel$export(module.exports, "scrollIntoView", () => $449412113267a1fe$export$53a0910f038337bd);
@@ -122,6 +127,7 @@ function $1254e5bb94ac8761$export$7f54fc3180508a52(fn) {
122
127
  }, [
123
128
  fn
124
129
  ]);
130
+ // @ts-ignore
125
131
  return (0, $1Yh1N$react.useCallback)((...args)=>{
126
132
  const f = ref.current;
127
133
  return f(...args);
@@ -163,6 +169,8 @@ function $19a2307bfabafaf1$export$14d238f342723f25(defaultValue) {
163
169
  }
164
170
 
165
171
 
172
+ // copied from SSRProvider.tsx to reduce exports, if needed again, consider sharing
173
+ let $8c61827343eed941$var$canUseDOM = Boolean(typeof window !== "undefined" && window.document && window.document.createElement);
166
174
  let $8c61827343eed941$var$idsUpdaterMap = new Map();
167
175
  function $8c61827343eed941$export$f680877a34711e37(defaultId) {
168
176
  let [value, setValue] = (0, $1Yh1N$react.useState)(defaultId);
@@ -171,7 +179,7 @@ function $8c61827343eed941$export$f680877a34711e37(defaultId) {
171
179
  let updateValue = (0, $1Yh1N$react.useCallback)((val)=>{
172
180
  nextId.current = val;
173
181
  }, []);
174
- $8c61827343eed941$var$idsUpdaterMap.set(res, updateValue);
182
+ if ($8c61827343eed941$var$canUseDOM) $8c61827343eed941$var$idsUpdaterMap.set(res, updateValue);
175
183
  (0, $78605a5d7424e31b$export$e5c5a5f917a5871c)(()=>{
176
184
  let r = res;
177
185
  return ()=>{
@@ -245,6 +253,17 @@ function $8c61827343eed941$export$b4cc09c592e8fdb8(depArray = []) {
245
253
  }
246
254
 
247
255
 
256
+ const $aaa611146751592e$export$b204af158042fbac = (el)=>{
257
+ var _el_ownerDocument;
258
+ return (_el_ownerDocument = el === null || el === void 0 ? void 0 : el.ownerDocument) !== null && _el_ownerDocument !== void 0 ? _el_ownerDocument : document;
259
+ };
260
+ const $aaa611146751592e$export$f21a1ffae260145a = (el)=>{
261
+ if (el && "window" in el && el.window === el) return el;
262
+ const doc = $aaa611146751592e$export$b204af158042fbac(el);
263
+ return doc.defaultView || window;
264
+ };
265
+
266
+
248
267
  /*
249
268
  * Copyright 2020 Adobe. All rights reserved.
250
269
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -515,7 +534,7 @@ function $4068a0fae83b6d84$export$efa8c9099e530235(link, modifiers) {
515
534
  !modifiers.shiftKey;
516
535
  }
517
536
  function $4068a0fae83b6d84$export$95185d699e05d4d7(target, modifiers, setOpening = true) {
518
- var _window_event, _window_event_type;
537
+ var _window_event_type, _window_event;
519
538
  let { metaKey: metaKey, ctrlKey: ctrlKey, altKey: altKey, shiftKey: shiftKey } = modifiers;
520
539
  // Firefox does not recognize keyboard events as a user action by default, and the popup blocker
521
540
  // will prevent links with target="_blank" from opening. However, it does allow the event if the
@@ -986,14 +1005,16 @@ function $6fc733991a9f977c$export$4debdb1a3f0fa79e(context, ref) {
986
1005
  * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
987
1006
  * OF ANY KIND, either express or implied. See the License for the specific language
988
1007
  * governing permissions and limitations under the License.
989
- */ function $d796e7157ac96470$export$cfa2225e87938781(node) {
990
- if ($d796e7157ac96470$export$2bb74740c4e19def(node)) node = node.parentElement;
991
- while(node && !$d796e7157ac96470$export$2bb74740c4e19def(node))node = node.parentElement;
1008
+ */ function $d796e7157ac96470$export$cfa2225e87938781(node, checkForOverflow) {
1009
+ if ($d796e7157ac96470$export$2bb74740c4e19def(node, checkForOverflow)) node = node.parentElement;
1010
+ while(node && !$d796e7157ac96470$export$2bb74740c4e19def(node, checkForOverflow))node = node.parentElement;
992
1011
  return node || document.scrollingElement || document.documentElement;
993
1012
  }
994
- function $d796e7157ac96470$export$2bb74740c4e19def(node) {
1013
+ function $d796e7157ac96470$export$2bb74740c4e19def(node, checkForOverflow) {
995
1014
  let style = window.getComputedStyle(node);
996
- return /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);
1015
+ let isScrollable = /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);
1016
+ if (isScrollable && checkForOverflow) isScrollable = node.scrollHeight !== node.clientHeight || node.scrollWidth !== node.clientWidth;
1017
+ return isScrollable;
997
1018
  }
998
1019
 
999
1020
 
@@ -1194,7 +1215,7 @@ function $449412113267a1fe$export$c826860796309d1b(targetElement, opts) {
1194
1215
  let { left: newLeft, top: newTop } = targetElement.getBoundingClientRect();
1195
1216
  // Account for sub pixel differences from rounding
1196
1217
  if (Math.abs(originalLeft - newLeft) > 1 || Math.abs(originalTop - newTop) > 1) {
1197
- var _opts_containingElement, _opts_containingElement_scrollIntoView, _targetElement_scrollIntoView1;
1218
+ var _opts_containingElement_scrollIntoView, _opts_containingElement, _targetElement_scrollIntoView1;
1198
1219
  opts === null || opts === void 0 ? void 0 : (_opts_containingElement = opts.containingElement) === null || _opts_containingElement === void 0 ? void 0 : (_opts_containingElement_scrollIntoView = _opts_containingElement.scrollIntoView) === null || _opts_containingElement_scrollIntoView === void 0 ? void 0 : _opts_containingElement_scrollIntoView.call(_opts_containingElement, {
1199
1220
  block: "center",
1200
1221
  inline: "center"