@react-aria/overlays 3.15.0 → 3.17.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 +18 -8
- package/dist/main.js +18 -8
- package/dist/main.js.map +1 -1
- package/dist/module.js +18 -8
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/Overlay.tsx +8 -3
- package/src/calculatePosition.ts +5 -3
- package/src/useOverlay.ts +7 -1
- package/src/useOverlayPosition.ts +3 -1
- package/src/usePreventScroll.ts +1 -1
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 = {};
|
|
@@ -107,7 +107,9 @@ function $edcf132a9284368a$var$getScroll(node) {
|
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
function $edcf132a9284368a$var$getDelta(axis, offset, size, containerDimensions, padding) {
|
|
110
|
-
let
|
|
110
|
+
let root = document.scrollingElement || document.documentElement;
|
|
111
|
+
let isScrollPrevented = window.getComputedStyle(root).overflow === "hidden";
|
|
112
|
+
let containerScroll = isScrollPrevented ? 0 : containerDimensions.scroll[axis];
|
|
111
113
|
let containerHeight = containerDimensions[$edcf132a9284368a$var$AXIS_SIZE[axis]];
|
|
112
114
|
let startEdgeOffset = offset - padding - containerScroll;
|
|
113
115
|
let endEdgeOffset = offset + padding - containerScroll + size;
|
|
@@ -236,7 +238,7 @@ function $edcf132a9284368a$export$6839422d1f33cee9(placementInput, childOffset,
|
|
|
236
238
|
};
|
|
237
239
|
}
|
|
238
240
|
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;
|
|
241
|
+
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
242
|
let container = overlayNode instanceof HTMLElement ? $edcf132a9284368a$var$getContainingBlock(overlayNode) : document.documentElement;
|
|
241
243
|
let isViewportContainer = container === document.documentElement;
|
|
242
244
|
const containerPositionStyle = window.getComputedStyle(container).position;
|
|
@@ -361,7 +363,7 @@ function $dd149f63282afbbf$export$18fc8428861184da(opts) {
|
|
|
361
363
|
|
|
362
364
|
|
|
363
365
|
// @ts-ignore
|
|
364
|
-
let $2a41e45df1593e64$var$visualViewport = typeof
|
|
366
|
+
let $2a41e45df1593e64$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
|
|
365
367
|
function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
|
|
366
368
|
let { direction: direction } = (0, $k7QOs$useLocale)();
|
|
367
369
|
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 +471,8 @@ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
|
|
|
469
471
|
},
|
|
470
472
|
placement: position.placement,
|
|
471
473
|
arrowProps: {
|
|
474
|
+
"aria-hidden": "true",
|
|
475
|
+
role: "presentation",
|
|
472
476
|
style: {
|
|
473
477
|
left: position.arrowOffsetLeft,
|
|
474
478
|
top: position.arrowOffsetTop
|
|
@@ -558,10 +562,16 @@ function $a11501f3d1d39e6c$export$ea8f71083e90600f(props, ref) {
|
|
|
558
562
|
let { focusWithinProps: focusWithinProps } = (0, $k7QOs$useFocusWithin)({
|
|
559
563
|
isDisabled: !shouldCloseOnBlur,
|
|
560
564
|
onBlurWithin: (e)=>{
|
|
565
|
+
// Do not close if relatedTarget is null, which means focus is lost to the body.
|
|
566
|
+
// That can happen when switching tabs, or due to a VoiceOver/Chrome bug with Control+Option+Arrow navigation.
|
|
567
|
+
// Clicking on the body to close the overlay should already be handled by useInteractOutside.
|
|
568
|
+
// https://github.com/adobe/react-spectrum/issues/4130
|
|
569
|
+
// https://github.com/adobe/react-spectrum/issues/4922
|
|
570
|
+
//
|
|
561
571
|
// If focus is moving into a child focus scope (e.g. menu inside a dialog),
|
|
562
572
|
// do not close the outer overlay. At this point, the active scope should
|
|
563
573
|
// still be the outer overlay, since blur events run before focus.
|
|
564
|
-
if (e.relatedTarget
|
|
574
|
+
if (!e.relatedTarget || (0, $k7QOs$isElementInChildOfActiveScope)(e.relatedTarget)) return;
|
|
565
575
|
if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.relatedTarget)) onClose();
|
|
566
576
|
}
|
|
567
577
|
});
|
|
@@ -636,7 +646,7 @@ function $628037886ba31236$export$f9d5c8beee7d008d(props, state, ref) {
|
|
|
636
646
|
* governing permissions and limitations under the License.
|
|
637
647
|
*/
|
|
638
648
|
// @ts-ignore
|
|
639
|
-
const $49c51c25361d4cd2$var$visualViewport = typeof
|
|
649
|
+
const $49c51c25361d4cd2$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
|
|
640
650
|
// HTML input types that do not cause the software keyboard to appear.
|
|
641
651
|
const $49c51c25361d4cd2$var$nonTextInputTypes = new Set([
|
|
642
652
|
"checkbox",
|
|
@@ -1396,7 +1406,7 @@ function $f2f8a6077418541e$export$542a6fd13ac93354(props, state) {
|
|
|
1396
1406
|
const $337b884510726a0d$export$a2200b96afd16271 = /*#__PURE__*/ (0, $k7QOs$react).createContext(null);
|
|
1397
1407
|
function $337b884510726a0d$export$c6fdb837b070b4ff(props) {
|
|
1398
1408
|
let isSSR = (0, $k7QOs$useIsSSR)();
|
|
1399
|
-
let { portalContainer: portalContainer = isSSR ? null : document.body } = props;
|
|
1409
|
+
let { portalContainer: portalContainer = isSSR ? null : document.body , isExiting: isExiting } = props;
|
|
1400
1410
|
let [contain, setContain] = (0, $k7QOs$useState)(false);
|
|
1401
1411
|
let contextValue = (0, $k7QOs$useMemo)(()=>({
|
|
1402
1412
|
contain: contain,
|
|
@@ -1411,7 +1421,7 @@ function $337b884510726a0d$export$c6fdb837b070b4ff(props) {
|
|
|
1411
1421
|
value: contextValue
|
|
1412
1422
|
}, /*#__PURE__*/ (0, $k7QOs$react).createElement((0, $k7QOs$FocusScope), {
|
|
1413
1423
|
restoreFocus: true,
|
|
1414
|
-
contain: contain
|
|
1424
|
+
contain: contain && !isExiting
|
|
1415
1425
|
}, props.children));
|
|
1416
1426
|
else contents = /*#__PURE__*/ (0, $k7QOs$react).createElement($337b884510726a0d$export$a2200b96afd16271.Provider, {
|
|
1417
1427
|
value: contextValue
|
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 = {};
|
|
@@ -126,7 +126,9 @@ function $5935ba4d7da2c103$var$getScroll(node) {
|
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
128
|
function $5935ba4d7da2c103$var$getDelta(axis, offset, size, containerDimensions, padding) {
|
|
129
|
-
let
|
|
129
|
+
let root = document.scrollingElement || document.documentElement;
|
|
130
|
+
let isScrollPrevented = window.getComputedStyle(root).overflow === "hidden";
|
|
131
|
+
let containerScroll = isScrollPrevented ? 0 : containerDimensions.scroll[axis];
|
|
130
132
|
let containerHeight = containerDimensions[$5935ba4d7da2c103$var$AXIS_SIZE[axis]];
|
|
131
133
|
let startEdgeOffset = offset - padding - containerScroll;
|
|
132
134
|
let endEdgeOffset = offset + padding - containerScroll + size;
|
|
@@ -255,7 +257,7 @@ function $5935ba4d7da2c103$export$6839422d1f33cee9(placementInput, childOffset,
|
|
|
255
257
|
};
|
|
256
258
|
}
|
|
257
259
|
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;
|
|
260
|
+
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
261
|
let container = overlayNode instanceof HTMLElement ? $5935ba4d7da2c103$var$getContainingBlock(overlayNode) : document.documentElement;
|
|
260
262
|
let isViewportContainer = container === document.documentElement;
|
|
261
263
|
const containerPositionStyle = window.getComputedStyle(container).position;
|
|
@@ -380,7 +382,7 @@ function $9a8aa1b0b336ea3a$export$18fc8428861184da(opts) {
|
|
|
380
382
|
|
|
381
383
|
|
|
382
384
|
// @ts-ignore
|
|
383
|
-
let $cd94b4896dd97759$var$visualViewport = typeof
|
|
385
|
+
let $cd94b4896dd97759$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
|
|
384
386
|
function $cd94b4896dd97759$export$d39e1813b3bdd0e1(props) {
|
|
385
387
|
let { direction: direction } = (0, $6Zb2x$reactariai18n.useLocale)();
|
|
386
388
|
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 +490,8 @@ function $cd94b4896dd97759$export$d39e1813b3bdd0e1(props) {
|
|
|
488
490
|
},
|
|
489
491
|
placement: position.placement,
|
|
490
492
|
arrowProps: {
|
|
493
|
+
"aria-hidden": "true",
|
|
494
|
+
role: "presentation",
|
|
491
495
|
style: {
|
|
492
496
|
left: position.arrowOffsetLeft,
|
|
493
497
|
top: position.arrowOffsetTop
|
|
@@ -577,10 +581,16 @@ function $82711f9cb668ecdb$export$ea8f71083e90600f(props, ref) {
|
|
|
577
581
|
let { focusWithinProps: focusWithinProps } = (0, $6Zb2x$reactariainteractions.useFocusWithin)({
|
|
578
582
|
isDisabled: !shouldCloseOnBlur,
|
|
579
583
|
onBlurWithin: (e)=>{
|
|
584
|
+
// Do not close if relatedTarget is null, which means focus is lost to the body.
|
|
585
|
+
// That can happen when switching tabs, or due to a VoiceOver/Chrome bug with Control+Option+Arrow navigation.
|
|
586
|
+
// Clicking on the body to close the overlay should already be handled by useInteractOutside.
|
|
587
|
+
// https://github.com/adobe/react-spectrum/issues/4130
|
|
588
|
+
// https://github.com/adobe/react-spectrum/issues/4922
|
|
589
|
+
//
|
|
580
590
|
// If focus is moving into a child focus scope (e.g. menu inside a dialog),
|
|
581
591
|
// do not close the outer overlay. At this point, the active scope should
|
|
582
592
|
// still be the outer overlay, since blur events run before focus.
|
|
583
|
-
if (e.relatedTarget
|
|
593
|
+
if (!e.relatedTarget || (0, $6Zb2x$reactariafocus.isElementInChildOfActiveScope)(e.relatedTarget)) return;
|
|
584
594
|
if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.relatedTarget)) onClose();
|
|
585
595
|
}
|
|
586
596
|
});
|
|
@@ -655,7 +665,7 @@ function $b4878eb6316f670a$export$f9d5c8beee7d008d(props, state, ref) {
|
|
|
655
665
|
* governing permissions and limitations under the License.
|
|
656
666
|
*/
|
|
657
667
|
// @ts-ignore
|
|
658
|
-
const $5c2f5cd01815d369$var$visualViewport = typeof
|
|
668
|
+
const $5c2f5cd01815d369$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
|
|
659
669
|
// HTML input types that do not cause the software keyboard to appear.
|
|
660
670
|
const $5c2f5cd01815d369$var$nonTextInputTypes = new Set([
|
|
661
671
|
"checkbox",
|
|
@@ -1415,7 +1425,7 @@ function $6c2dfcdee3e15e20$export$542a6fd13ac93354(props, state) {
|
|
|
1415
1425
|
const $745edbb83ab4296f$export$a2200b96afd16271 = /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createContext(null);
|
|
1416
1426
|
function $745edbb83ab4296f$export$c6fdb837b070b4ff(props) {
|
|
1417
1427
|
let isSSR = (0, $6Zb2x$reactariassr.useIsSSR)();
|
|
1418
|
-
let { portalContainer: portalContainer = isSSR ? null : document.body } = props;
|
|
1428
|
+
let { portalContainer: portalContainer = isSSR ? null : document.body , isExiting: isExiting } = props;
|
|
1419
1429
|
let [contain, setContain] = (0, $6Zb2x$react.useState)(false);
|
|
1420
1430
|
let contextValue = (0, $6Zb2x$react.useMemo)(()=>({
|
|
1421
1431
|
contain: contain,
|
|
@@ -1430,7 +1440,7 @@ function $745edbb83ab4296f$export$c6fdb837b070b4ff(props) {
|
|
|
1430
1440
|
value: contextValue
|
|
1431
1441
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement((0, $6Zb2x$reactariafocus.FocusScope), {
|
|
1432
1442
|
restoreFocus: true,
|
|
1433
|
-
contain: contain
|
|
1443
|
+
contain: contain && !isExiting
|
|
1434
1444
|
}, props.children));
|
|
1435
1445
|
else contents = /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement($745edbb83ab4296f$export$a2200b96afd16271.Provider, {
|
|
1436
1446
|
value: contextValue
|