@react-aria/overlays 3.14.1 → 3.16.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 +21 -14
- package/dist/main.js +21 -14
- package/dist/main.js.map +1 -1
- package/dist/module.js +21 -14
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +14 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/Overlay.tsx +28 -8
- package/src/calculatePosition.ts +2 -2
- package/src/useOverlayPosition.ts +3 -1
- package/src/usePreventScroll.ts +6 -2
package/dist/import.mjs
CHANGED
|
@@ -67,7 +67,7 @@ const $edcf132a9284368a$var$TOTAL_SIZE = {
|
|
|
67
67
|
};
|
|
68
68
|
const $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE = {};
|
|
69
69
|
// @ts-ignore
|
|
70
|
-
let $edcf132a9284368a$var$visualViewport = typeof
|
|
70
|
+
let $edcf132a9284368a$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
|
|
71
71
|
function $edcf132a9284368a$var$getContainerDimensions(containerNode) {
|
|
72
72
|
let width = 0, height = 0, totalWidth = 0, totalHeight = 0, top = 0, left = 0;
|
|
73
73
|
let scroll = {};
|
|
@@ -236,7 +236,7 @@ function $edcf132a9284368a$export$6839422d1f33cee9(placementInput, childOffset,
|
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
238
|
function $edcf132a9284368a$export$b3ceb0cbf1056d98(opts) {
|
|
239
|
-
let { placement: placement , targetNode: targetNode , overlayNode: overlayNode , scrollNode: scrollNode , padding: padding , shouldFlip: shouldFlip , boundaryElement: boundaryElement , offset: offset , crossOffset: crossOffset , maxHeight: maxHeight , arrowSize: arrowSize , arrowBoundaryOffset: arrowBoundaryOffset = 0 } = opts;
|
|
239
|
+
let { placement: placement , targetNode: targetNode , overlayNode: overlayNode , scrollNode: scrollNode , padding: padding , shouldFlip: shouldFlip , boundaryElement: boundaryElement , offset: offset , crossOffset: crossOffset , maxHeight: maxHeight , arrowSize: arrowSize = 0 , arrowBoundaryOffset: arrowBoundaryOffset = 0 } = opts;
|
|
240
240
|
let container = overlayNode instanceof HTMLElement ? $edcf132a9284368a$var$getContainingBlock(overlayNode) : document.documentElement;
|
|
241
241
|
let isViewportContainer = container === document.documentElement;
|
|
242
242
|
const containerPositionStyle = window.getComputedStyle(container).position;
|
|
@@ -361,7 +361,7 @@ function $dd149f63282afbbf$export$18fc8428861184da(opts) {
|
|
|
361
361
|
|
|
362
362
|
|
|
363
363
|
// @ts-ignore
|
|
364
|
-
let $2a41e45df1593e64$var$visualViewport = typeof
|
|
364
|
+
let $2a41e45df1593e64$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
|
|
365
365
|
function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
|
|
366
366
|
let { direction: direction } = (0, $k7QOs$useLocale)();
|
|
367
367
|
let { arrowSize: arrowSize = 0 , targetRef: targetRef , overlayRef: overlayRef , scrollRef: scrollRef = overlayRef , placement: placement = "bottom" , containerPadding: containerPadding = 12 , shouldFlip: shouldFlip = true , boundaryElement: boundaryElement = typeof document !== "undefined" ? document.body : null , offset: offset = 0 , crossOffset: crossOffset = 0 , shouldUpdatePosition: shouldUpdatePosition = true , isOpen: isOpen = true , onClose: onClose , maxHeight: maxHeight , arrowBoundaryOffset: arrowBoundaryOffset = 0 } = props;
|
|
@@ -469,6 +469,8 @@ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
|
|
|
469
469
|
},
|
|
470
470
|
placement: position.placement,
|
|
471
471
|
arrowProps: {
|
|
472
|
+
"aria-hidden": "true",
|
|
473
|
+
role: "presentation",
|
|
472
474
|
style: {
|
|
473
475
|
left: position.arrowOffsetLeft,
|
|
474
476
|
top: position.arrowOffsetTop
|
|
@@ -636,7 +638,7 @@ function $628037886ba31236$export$f9d5c8beee7d008d(props, state, ref) {
|
|
|
636
638
|
* governing permissions and limitations under the License.
|
|
637
639
|
*/
|
|
638
640
|
// @ts-ignore
|
|
639
|
-
const $49c51c25361d4cd2$var$visualViewport = typeof
|
|
641
|
+
const $49c51c25361d4cd2$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
|
|
640
642
|
// HTML input types that do not cause the software keyboard to appear.
|
|
641
643
|
const $49c51c25361d4cd2$var$nonTextInputTypes = new Set([
|
|
642
644
|
"checkbox",
|
|
@@ -711,7 +713,7 @@ function $49c51c25361d4cd2$var$preventScrollMobileSafari() {
|
|
|
711
713
|
};
|
|
712
714
|
let onTouchMove = (e)=>{
|
|
713
715
|
// Prevent scrolling the window.
|
|
714
|
-
if (scrollable === document.documentElement || scrollable === document.body) {
|
|
716
|
+
if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {
|
|
715
717
|
e.preventDefault();
|
|
716
718
|
return;
|
|
717
719
|
}
|
|
@@ -722,6 +724,7 @@ function $49c51c25361d4cd2$var$preventScrollMobileSafari() {
|
|
|
722
724
|
let y = e.changedTouches[0].pageY;
|
|
723
725
|
let scrollTop = scrollable.scrollTop;
|
|
724
726
|
let bottom = scrollable.scrollHeight - scrollable.clientHeight;
|
|
727
|
+
if (bottom === 0) return;
|
|
725
728
|
if (scrollTop <= 0 && y > lastY || scrollTop >= bottom && y < lastY) e.preventDefault();
|
|
726
729
|
lastY = y;
|
|
727
730
|
};
|
|
@@ -935,7 +938,7 @@ function $f57aed4a881a3485$export$33ffd74ebf07f060(options) {
|
|
|
935
938
|
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
936
939
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
937
940
|
* governing permissions and limitations under the License.
|
|
938
|
-
*/ var $
|
|
941
|
+
*/ var $a2f21f5f14f60553$exports = {};
|
|
939
942
|
var $773d5888b972f1cf$exports = {};
|
|
940
943
|
$773d5888b972f1cf$exports = {
|
|
941
944
|
"dismiss": `تجاهل`
|
|
@@ -1140,7 +1143,7 @@ $2b2734393847c884$exports = {
|
|
|
1140
1143
|
};
|
|
1141
1144
|
|
|
1142
1145
|
|
|
1143
|
-
$
|
|
1146
|
+
$a2f21f5f14f60553$exports = {
|
|
1144
1147
|
"ar-AE": $773d5888b972f1cf$exports,
|
|
1145
1148
|
"bg-BG": $d11f19852b941573$exports,
|
|
1146
1149
|
"cs-CZ": $b983974c2ee1efb3$exports,
|
|
@@ -1184,7 +1187,7 @@ $61fe14465afefc5e$exports = {
|
|
|
1184
1187
|
|
|
1185
1188
|
function $86ea4cb521eb2e37$export$2317d149ed6f78c4(props) {
|
|
1186
1189
|
let { onDismiss: onDismiss , ...otherProps } = props;
|
|
1187
|
-
let stringFormatter = (0, $k7QOs$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($
|
|
1190
|
+
let stringFormatter = (0, $k7QOs$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($a2f21f5f14f60553$exports))));
|
|
1188
1191
|
let labels = (0, $k7QOs$useLabels)(otherProps, stringFormatter.format("dismiss"));
|
|
1189
1192
|
let onClick = ()=>{
|
|
1190
1193
|
if (onDismiss) onDismiss();
|
|
@@ -1270,9 +1273,9 @@ function $5e3802645cc19319$export$1c3ebcada18427bf(targets, root = document.body
|
|
|
1270
1273
|
visibleNodes.delete(node);
|
|
1271
1274
|
hiddenNodes.delete(node);
|
|
1272
1275
|
}
|
|
1273
|
-
for (let
|
|
1274
|
-
if ((
|
|
1275
|
-
else if (
|
|
1276
|
+
for (let node of change.addedNodes){
|
|
1277
|
+
if ((node instanceof HTMLElement || node instanceof SVGElement) && (node.dataset.liveAnnouncer === "true" || node.dataset.reactAriaTopLayer === "true")) visibleNodes.add(node);
|
|
1278
|
+
else if (node instanceof Element) walk(node);
|
|
1276
1279
|
}
|
|
1277
1280
|
}
|
|
1278
1281
|
}
|
|
@@ -1395,7 +1398,7 @@ function $f2f8a6077418541e$export$542a6fd13ac93354(props, state) {
|
|
|
1395
1398
|
const $337b884510726a0d$export$a2200b96afd16271 = /*#__PURE__*/ (0, $k7QOs$react).createContext(null);
|
|
1396
1399
|
function $337b884510726a0d$export$c6fdb837b070b4ff(props) {
|
|
1397
1400
|
let isSSR = (0, $k7QOs$useIsSSR)();
|
|
1398
|
-
let { portalContainer: portalContainer = isSSR ? null : document.body } = props;
|
|
1401
|
+
let { portalContainer: portalContainer = isSSR ? null : document.body , isExiting: isExiting } = props;
|
|
1399
1402
|
let [contain, setContain] = (0, $k7QOs$useState)(false);
|
|
1400
1403
|
let contextValue = (0, $k7QOs$useMemo)(()=>({
|
|
1401
1404
|
contain: contain,
|
|
@@ -1405,12 +1408,16 @@ function $337b884510726a0d$export$c6fdb837b070b4ff(props) {
|
|
|
1405
1408
|
setContain
|
|
1406
1409
|
]);
|
|
1407
1410
|
if (!portalContainer) return null;
|
|
1408
|
-
let contents
|
|
1411
|
+
let contents;
|
|
1412
|
+
if (!props.disableFocusManagement) contents = /*#__PURE__*/ (0, $k7QOs$react).createElement($337b884510726a0d$export$a2200b96afd16271.Provider, {
|
|
1409
1413
|
value: contextValue
|
|
1410
1414
|
}, /*#__PURE__*/ (0, $k7QOs$react).createElement((0, $k7QOs$FocusScope), {
|
|
1411
1415
|
restoreFocus: true,
|
|
1412
|
-
contain: contain
|
|
1416
|
+
contain: contain && !isExiting
|
|
1413
1417
|
}, props.children));
|
|
1418
|
+
else contents = /*#__PURE__*/ (0, $k7QOs$react).createElement($337b884510726a0d$export$a2200b96afd16271.Provider, {
|
|
1419
|
+
value: contextValue
|
|
1420
|
+
}, props.children);
|
|
1414
1421
|
return /*#__PURE__*/ (0, $k7QOs$reactdom).createPortal(contents, portalContainer);
|
|
1415
1422
|
}
|
|
1416
1423
|
function $337b884510726a0d$export$14c98a7594375490() {
|
package/dist/main.js
CHANGED
|
@@ -86,7 +86,7 @@ const $5935ba4d7da2c103$var$TOTAL_SIZE = {
|
|
|
86
86
|
};
|
|
87
87
|
const $5935ba4d7da2c103$var$PARSED_PLACEMENT_CACHE = {};
|
|
88
88
|
// @ts-ignore
|
|
89
|
-
let $5935ba4d7da2c103$var$visualViewport = typeof
|
|
89
|
+
let $5935ba4d7da2c103$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
|
|
90
90
|
function $5935ba4d7da2c103$var$getContainerDimensions(containerNode) {
|
|
91
91
|
let width = 0, height = 0, totalWidth = 0, totalHeight = 0, top = 0, left = 0;
|
|
92
92
|
let scroll = {};
|
|
@@ -255,7 +255,7 @@ function $5935ba4d7da2c103$export$6839422d1f33cee9(placementInput, childOffset,
|
|
|
255
255
|
};
|
|
256
256
|
}
|
|
257
257
|
function $5935ba4d7da2c103$export$b3ceb0cbf1056d98(opts) {
|
|
258
|
-
let { placement: placement , targetNode: targetNode , overlayNode: overlayNode , scrollNode: scrollNode , padding: padding , shouldFlip: shouldFlip , boundaryElement: boundaryElement , offset: offset , crossOffset: crossOffset , maxHeight: maxHeight , arrowSize: arrowSize , arrowBoundaryOffset: arrowBoundaryOffset = 0 } = opts;
|
|
258
|
+
let { placement: placement , targetNode: targetNode , overlayNode: overlayNode , scrollNode: scrollNode , padding: padding , shouldFlip: shouldFlip , boundaryElement: boundaryElement , offset: offset , crossOffset: crossOffset , maxHeight: maxHeight , arrowSize: arrowSize = 0 , arrowBoundaryOffset: arrowBoundaryOffset = 0 } = opts;
|
|
259
259
|
let container = overlayNode instanceof HTMLElement ? $5935ba4d7da2c103$var$getContainingBlock(overlayNode) : document.documentElement;
|
|
260
260
|
let isViewportContainer = container === document.documentElement;
|
|
261
261
|
const containerPositionStyle = window.getComputedStyle(container).position;
|
|
@@ -380,7 +380,7 @@ function $9a8aa1b0b336ea3a$export$18fc8428861184da(opts) {
|
|
|
380
380
|
|
|
381
381
|
|
|
382
382
|
// @ts-ignore
|
|
383
|
-
let $cd94b4896dd97759$var$visualViewport = typeof
|
|
383
|
+
let $cd94b4896dd97759$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
|
|
384
384
|
function $cd94b4896dd97759$export$d39e1813b3bdd0e1(props) {
|
|
385
385
|
let { direction: direction } = (0, $6Zb2x$reactariai18n.useLocale)();
|
|
386
386
|
let { arrowSize: arrowSize = 0 , targetRef: targetRef , overlayRef: overlayRef , scrollRef: scrollRef = overlayRef , placement: placement = "bottom" , containerPadding: containerPadding = 12 , shouldFlip: shouldFlip = true , boundaryElement: boundaryElement = typeof document !== "undefined" ? document.body : null , offset: offset = 0 , crossOffset: crossOffset = 0 , shouldUpdatePosition: shouldUpdatePosition = true , isOpen: isOpen = true , onClose: onClose , maxHeight: maxHeight , arrowBoundaryOffset: arrowBoundaryOffset = 0 } = props;
|
|
@@ -488,6 +488,8 @@ function $cd94b4896dd97759$export$d39e1813b3bdd0e1(props) {
|
|
|
488
488
|
},
|
|
489
489
|
placement: position.placement,
|
|
490
490
|
arrowProps: {
|
|
491
|
+
"aria-hidden": "true",
|
|
492
|
+
role: "presentation",
|
|
491
493
|
style: {
|
|
492
494
|
left: position.arrowOffsetLeft,
|
|
493
495
|
top: position.arrowOffsetTop
|
|
@@ -655,7 +657,7 @@ function $b4878eb6316f670a$export$f9d5c8beee7d008d(props, state, ref) {
|
|
|
655
657
|
* governing permissions and limitations under the License.
|
|
656
658
|
*/
|
|
657
659
|
// @ts-ignore
|
|
658
|
-
const $5c2f5cd01815d369$var$visualViewport = typeof
|
|
660
|
+
const $5c2f5cd01815d369$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
|
|
659
661
|
// HTML input types that do not cause the software keyboard to appear.
|
|
660
662
|
const $5c2f5cd01815d369$var$nonTextInputTypes = new Set([
|
|
661
663
|
"checkbox",
|
|
@@ -730,7 +732,7 @@ function $5c2f5cd01815d369$var$preventScrollMobileSafari() {
|
|
|
730
732
|
};
|
|
731
733
|
let onTouchMove = (e)=>{
|
|
732
734
|
// Prevent scrolling the window.
|
|
733
|
-
if (scrollable === document.documentElement || scrollable === document.body) {
|
|
735
|
+
if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {
|
|
734
736
|
e.preventDefault();
|
|
735
737
|
return;
|
|
736
738
|
}
|
|
@@ -741,6 +743,7 @@ function $5c2f5cd01815d369$var$preventScrollMobileSafari() {
|
|
|
741
743
|
let y = e.changedTouches[0].pageY;
|
|
742
744
|
let scrollTop = scrollable.scrollTop;
|
|
743
745
|
let bottom = scrollable.scrollHeight - scrollable.clientHeight;
|
|
746
|
+
if (bottom === 0) return;
|
|
744
747
|
if (scrollTop <= 0 && y > lastY || scrollTop >= bottom && y < lastY) e.preventDefault();
|
|
745
748
|
lastY = y;
|
|
746
749
|
};
|
|
@@ -954,7 +957,7 @@ function $0775ea8ea6a0565e$export$33ffd74ebf07f060(options) {
|
|
|
954
957
|
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
955
958
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
956
959
|
* governing permissions and limitations under the License.
|
|
957
|
-
*/ var $
|
|
960
|
+
*/ var $90f032faf016e1fb$exports = {};
|
|
958
961
|
var $4393d9b86d3ad278$exports = {};
|
|
959
962
|
$4393d9b86d3ad278$exports = {
|
|
960
963
|
"dismiss": `تجاهل`
|
|
@@ -1159,7 +1162,7 @@ $3f3b5d798a5abdbc$exports = {
|
|
|
1159
1162
|
};
|
|
1160
1163
|
|
|
1161
1164
|
|
|
1162
|
-
$
|
|
1165
|
+
$90f032faf016e1fb$exports = {
|
|
1163
1166
|
"ar-AE": $4393d9b86d3ad278$exports,
|
|
1164
1167
|
"bg-BG": $254224013ae06959$exports,
|
|
1165
1168
|
"cs-CZ": $55d3567b59d09782$exports,
|
|
@@ -1203,7 +1206,7 @@ $18d014414048a7ba$exports = {
|
|
|
1203
1206
|
|
|
1204
1207
|
function $f69bb3e6457495cc$export$2317d149ed6f78c4(props) {
|
|
1205
1208
|
let { onDismiss: onDismiss , ...otherProps } = props;
|
|
1206
|
-
let stringFormatter = (0, $6Zb2x$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($
|
|
1209
|
+
let stringFormatter = (0, $6Zb2x$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($90f032faf016e1fb$exports))));
|
|
1207
1210
|
let labels = (0, $6Zb2x$reactariautils.useLabels)(otherProps, stringFormatter.format("dismiss"));
|
|
1208
1211
|
let onClick = ()=>{
|
|
1209
1212
|
if (onDismiss) onDismiss();
|
|
@@ -1289,9 +1292,9 @@ function $08ef1685902b6011$export$1c3ebcada18427bf(targets, root = document.body
|
|
|
1289
1292
|
visibleNodes.delete(node);
|
|
1290
1293
|
hiddenNodes.delete(node);
|
|
1291
1294
|
}
|
|
1292
|
-
for (let
|
|
1293
|
-
if ((
|
|
1294
|
-
else if (
|
|
1295
|
+
for (let node of change.addedNodes){
|
|
1296
|
+
if ((node instanceof HTMLElement || node instanceof SVGElement) && (node.dataset.liveAnnouncer === "true" || node.dataset.reactAriaTopLayer === "true")) visibleNodes.add(node);
|
|
1297
|
+
else if (node instanceof Element) walk(node);
|
|
1295
1298
|
}
|
|
1296
1299
|
}
|
|
1297
1300
|
}
|
|
@@ -1414,7 +1417,7 @@ function $6c2dfcdee3e15e20$export$542a6fd13ac93354(props, state) {
|
|
|
1414
1417
|
const $745edbb83ab4296f$export$a2200b96afd16271 = /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createContext(null);
|
|
1415
1418
|
function $745edbb83ab4296f$export$c6fdb837b070b4ff(props) {
|
|
1416
1419
|
let isSSR = (0, $6Zb2x$reactariassr.useIsSSR)();
|
|
1417
|
-
let { portalContainer: portalContainer = isSSR ? null : document.body } = props;
|
|
1420
|
+
let { portalContainer: portalContainer = isSSR ? null : document.body , isExiting: isExiting } = props;
|
|
1418
1421
|
let [contain, setContain] = (0, $6Zb2x$react.useState)(false);
|
|
1419
1422
|
let contextValue = (0, $6Zb2x$react.useMemo)(()=>({
|
|
1420
1423
|
contain: contain,
|
|
@@ -1424,12 +1427,16 @@ function $745edbb83ab4296f$export$c6fdb837b070b4ff(props) {
|
|
|
1424
1427
|
setContain
|
|
1425
1428
|
]);
|
|
1426
1429
|
if (!portalContainer) return null;
|
|
1427
|
-
let contents
|
|
1430
|
+
let contents;
|
|
1431
|
+
if (!props.disableFocusManagement) contents = /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement($745edbb83ab4296f$export$a2200b96afd16271.Provider, {
|
|
1428
1432
|
value: contextValue
|
|
1429
1433
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement((0, $6Zb2x$reactariafocus.FocusScope), {
|
|
1430
1434
|
restoreFocus: true,
|
|
1431
|
-
contain: contain
|
|
1435
|
+
contain: contain && !isExiting
|
|
1432
1436
|
}, props.children));
|
|
1437
|
+
else contents = /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement($745edbb83ab4296f$export$a2200b96afd16271.Provider, {
|
|
1438
|
+
value: contextValue
|
|
1439
|
+
}, props.children);
|
|
1433
1440
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$reactdom))).createPortal(contents, portalContainer);
|
|
1434
1441
|
}
|
|
1435
1442
|
function $745edbb83ab4296f$export$14c98a7594375490() {
|