@react-aria/utils 3.0.0-nightly.2839 → 3.0.0-nightly.2843
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 +44 -14
- package/dist/main.js +45 -14
- package/dist/main.js.map +1 -1
- package/dist/module.js +44 -14
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +2 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/getScrollParent.ts +2 -10
- package/src/getScrollParents.ts +26 -0
- package/src/index.ts +3 -1
- package/src/isScrollable.ts +22 -0
- package/src/scrollIntoView.ts +3 -5
package/dist/import.mjs
CHANGED
|
@@ -970,13 +970,17 @@ function $e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, ref) {
|
|
|
970
970
|
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
971
971
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
972
972
|
* governing permissions and limitations under the License.
|
|
973
|
-
*/
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
973
|
+
*/ /*
|
|
974
|
+
* Copyright 2024 Adobe. All rights reserved.
|
|
975
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
976
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
977
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
978
|
+
*
|
|
979
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
980
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
981
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
982
|
+
* governing permissions and limitations under the License.
|
|
983
|
+
*/ function $cc38e7bd3fc7b213$export$2bb74740c4e19def(node, checkForOverflow) {
|
|
980
984
|
let style = window.getComputedStyle(node);
|
|
981
985
|
let isScrollable = /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);
|
|
982
986
|
if (isScrollable && checkForOverflow) isScrollable = node.scrollHeight !== node.clientHeight || node.scrollWidth !== node.clientWidth;
|
|
@@ -984,6 +988,36 @@ function $62d8ded9296f3872$export$2bb74740c4e19def(node, checkForOverflow) {
|
|
|
984
988
|
}
|
|
985
989
|
|
|
986
990
|
|
|
991
|
+
function $62d8ded9296f3872$export$cfa2225e87938781(node, checkForOverflow) {
|
|
992
|
+
let scrollableNode = node;
|
|
993
|
+
if ((0, $cc38e7bd3fc7b213$export$2bb74740c4e19def)(scrollableNode, checkForOverflow)) scrollableNode = scrollableNode.parentElement;
|
|
994
|
+
while(scrollableNode && !(0, $cc38e7bd3fc7b213$export$2bb74740c4e19def)(scrollableNode, checkForOverflow))scrollableNode = scrollableNode.parentElement;
|
|
995
|
+
return scrollableNode || document.scrollingElement || document.documentElement;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
|
|
999
|
+
/*
|
|
1000
|
+
* Copyright 2024 Adobe. All rights reserved.
|
|
1001
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
1002
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
1003
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
1004
|
+
*
|
|
1005
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
1006
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
1007
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
1008
|
+
* governing permissions and limitations under the License.
|
|
1009
|
+
*/
|
|
1010
|
+
function $a40c673dc9f6d9c7$export$94ed1c92c7beeb22(node, checkForOverflow) {
|
|
1011
|
+
const scrollParents = [];
|
|
1012
|
+
while(node && node !== document.documentElement){
|
|
1013
|
+
if ((0, $cc38e7bd3fc7b213$export$2bb74740c4e19def)(node, checkForOverflow)) scrollParents.push(node);
|
|
1014
|
+
node = node.parentElement;
|
|
1015
|
+
}
|
|
1016
|
+
return scrollParents;
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
|
|
1020
|
+
|
|
987
1021
|
/*
|
|
988
1022
|
* Copyright 2020 Adobe. All rights reserved.
|
|
989
1023
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -1191,13 +1225,9 @@ function $2f04cbc44ee30ce0$export$c826860796309d1b(targetElement, opts) {
|
|
|
1191
1225
|
});
|
|
1192
1226
|
}
|
|
1193
1227
|
} else {
|
|
1194
|
-
let
|
|
1228
|
+
let scrollParents = (0, $a40c673dc9f6d9c7$export$94ed1c92c7beeb22)(targetElement);
|
|
1195
1229
|
// If scrolling is prevented, we don't want to scroll the body since it might move the overlay partially offscreen and the user can't scroll it back into view.
|
|
1196
|
-
|
|
1197
|
-
$2f04cbc44ee30ce0$export$53a0910f038337bd(scrollParent, targetElement);
|
|
1198
|
-
targetElement = scrollParent;
|
|
1199
|
-
scrollParent = (0, $62d8ded9296f3872$export$cfa2225e87938781)(targetElement);
|
|
1200
|
-
}
|
|
1230
|
+
for (let scrollParent of scrollParents)$2f04cbc44ee30ce0$export$53a0910f038337bd(scrollParent, targetElement);
|
|
1201
1231
|
}
|
|
1202
1232
|
}
|
|
1203
1233
|
}
|
|
@@ -1290,5 +1320,5 @@ function $99facab73266f662$export$5add1d006293d136(ref, initialValue, onReset) {
|
|
|
1290
1320
|
|
|
1291
1321
|
|
|
1292
1322
|
|
|
1293
|
-
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, $ea8dcbcb9ea1b556$export$7e924b3091a3bd18 as useLinkProps, $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, $
|
|
1323
|
+
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, $ea8dcbcb9ea1b556$export$7e924b3091a3bd18 as useLinkProps, $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, $a40c673dc9f6d9c7$export$94ed1c92c7beeb22 as getScrollParents, $cc38e7bd3fc7b213$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};
|
|
1294
1324
|
//# sourceMappingURL=module.js.map
|
package/dist/main.js
CHANGED
|
@@ -39,7 +39,8 @@ $parcel$export(module.exports, "useLayoutEffect", () => $78605a5d7424e31b$export
|
|
|
39
39
|
$parcel$export(module.exports, "useResizeObserver", () => $37733e1652f47193$export$683480f191c0e3ea);
|
|
40
40
|
$parcel$export(module.exports, "useSyncRef", () => $6fc733991a9f977c$export$4debdb1a3f0fa79e);
|
|
41
41
|
$parcel$export(module.exports, "getScrollParent", () => $d796e7157ac96470$export$cfa2225e87938781);
|
|
42
|
-
$parcel$export(module.exports, "
|
|
42
|
+
$parcel$export(module.exports, "getScrollParents", () => $49f0d9486c2408aa$export$94ed1c92c7beeb22);
|
|
43
|
+
$parcel$export(module.exports, "isScrollable", () => $9a54e9cd5db23b5d$export$2bb74740c4e19def);
|
|
43
44
|
$parcel$export(module.exports, "useViewportSize", () => $8b24bab62f5c65ad$export$d699905dd57c73ca);
|
|
44
45
|
$parcel$export(module.exports, "useDescription", () => $34da4502ea8120db$export$f8aeda7b10753fa1);
|
|
45
46
|
$parcel$export(module.exports, "isMac", () => $9e20cff0af27e8cc$export$9ac100e40613ea10);
|
|
@@ -1029,13 +1030,17 @@ function $6fc733991a9f977c$export$4debdb1a3f0fa79e(context, ref) {
|
|
|
1029
1030
|
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
1030
1031
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
1031
1032
|
* governing permissions and limitations under the License.
|
|
1032
|
-
*/
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1033
|
+
*/ /*
|
|
1034
|
+
* Copyright 2024 Adobe. All rights reserved.
|
|
1035
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
1036
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
1037
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
1038
|
+
*
|
|
1039
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
1040
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
1041
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
1042
|
+
* governing permissions and limitations under the License.
|
|
1043
|
+
*/ function $9a54e9cd5db23b5d$export$2bb74740c4e19def(node, checkForOverflow) {
|
|
1039
1044
|
let style = window.getComputedStyle(node);
|
|
1040
1045
|
let isScrollable = /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);
|
|
1041
1046
|
if (isScrollable && checkForOverflow) isScrollable = node.scrollHeight !== node.clientHeight || node.scrollWidth !== node.clientWidth;
|
|
@@ -1043,6 +1048,36 @@ function $d796e7157ac96470$export$2bb74740c4e19def(node, checkForOverflow) {
|
|
|
1043
1048
|
}
|
|
1044
1049
|
|
|
1045
1050
|
|
|
1051
|
+
function $d796e7157ac96470$export$cfa2225e87938781(node, checkForOverflow) {
|
|
1052
|
+
let scrollableNode = node;
|
|
1053
|
+
if ((0, $9a54e9cd5db23b5d$export$2bb74740c4e19def)(scrollableNode, checkForOverflow)) scrollableNode = scrollableNode.parentElement;
|
|
1054
|
+
while(scrollableNode && !(0, $9a54e9cd5db23b5d$export$2bb74740c4e19def)(scrollableNode, checkForOverflow))scrollableNode = scrollableNode.parentElement;
|
|
1055
|
+
return scrollableNode || document.scrollingElement || document.documentElement;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
|
|
1059
|
+
/*
|
|
1060
|
+
* Copyright 2024 Adobe. All rights reserved.
|
|
1061
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
1062
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
1063
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
1064
|
+
*
|
|
1065
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
1066
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
1067
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
1068
|
+
* governing permissions and limitations under the License.
|
|
1069
|
+
*/
|
|
1070
|
+
function $49f0d9486c2408aa$export$94ed1c92c7beeb22(node, checkForOverflow) {
|
|
1071
|
+
const scrollParents = [];
|
|
1072
|
+
while(node && node !== document.documentElement){
|
|
1073
|
+
if ((0, $9a54e9cd5db23b5d$export$2bb74740c4e19def)(node, checkForOverflow)) scrollParents.push(node);
|
|
1074
|
+
node = node.parentElement;
|
|
1075
|
+
}
|
|
1076
|
+
return scrollParents;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
|
|
1080
|
+
|
|
1046
1081
|
/*
|
|
1047
1082
|
* Copyright 2020 Adobe. All rights reserved.
|
|
1048
1083
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -1250,13 +1285,9 @@ function $449412113267a1fe$export$c826860796309d1b(targetElement, opts) {
|
|
|
1250
1285
|
});
|
|
1251
1286
|
}
|
|
1252
1287
|
} else {
|
|
1253
|
-
let
|
|
1288
|
+
let scrollParents = (0, $49f0d9486c2408aa$export$94ed1c92c7beeb22)(targetElement);
|
|
1254
1289
|
// If scrolling is prevented, we don't want to scroll the body since it might move the overlay partially offscreen and the user can't scroll it back into view.
|
|
1255
|
-
|
|
1256
|
-
$449412113267a1fe$export$53a0910f038337bd(scrollParent, targetElement);
|
|
1257
|
-
targetElement = scrollParent;
|
|
1258
|
-
scrollParent = (0, $d796e7157ac96470$export$cfa2225e87938781)(targetElement);
|
|
1259
|
-
}
|
|
1290
|
+
for (let scrollParent of scrollParents)$449412113267a1fe$export$53a0910f038337bd(scrollParent, targetElement);
|
|
1260
1291
|
}
|
|
1261
1292
|
}
|
|
1262
1293
|
}
|