@react-aria/overlays 3.16.0 → 3.18.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 +55 -42
- package/dist/main.js +54 -41
- package/dist/main.js.map +1 -1
- package/dist/module.js +55 -42
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/Overlay.tsx +13 -12
- package/src/calculatePosition.ts +16 -6
- package/src/useOverlay.ts +7 -1
package/dist/import.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import $k7QOs$react, {useState as $k7QOs$useState, useCallback as $k7QOs$useCall
|
|
|
2
2
|
import {useLayoutEffect as $k7QOs$useLayoutEffect, useResizeObserver as $k7QOs$useResizeObserver, clamp as $k7QOs$clamp, useId as $k7QOs$useId, isIOS as $k7QOs$isIOS, chain as $k7QOs$chain, getScrollParent as $k7QOs$getScrollParent, useLabels as $k7QOs$useLabels, mergeProps as $k7QOs$mergeProps} from "@react-aria/utils";
|
|
3
3
|
import {useLocale as $k7QOs$useLocale, useLocalizedStringFormatter as $k7QOs$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
4
4
|
import {isElementInChildOfActiveScope as $k7QOs$isElementInChildOfActiveScope, FocusScope as $k7QOs$FocusScope} from "@react-aria/focus";
|
|
5
|
-
import {useInteractOutside as $k7QOs$useInteractOutside, useFocusWithin as $k7QOs$useFocusWithin} from "@react-aria/interactions";
|
|
5
|
+
import {useInteractOutside as $k7QOs$useInteractOutside, useFocusWithin as $k7QOs$useFocusWithin, ClearPressResponder as $k7QOs$ClearPressResponder} from "@react-aria/interactions";
|
|
6
6
|
import $k7QOs$reactdom from "react-dom";
|
|
7
7
|
import {useIsSSR as $k7QOs$useIsSSR} from "@react-aria/ssr";
|
|
8
8
|
import {VisuallyHidden as $k7QOs$VisuallyHidden} from "@react-aria/visually-hidden";
|
|
@@ -82,7 +82,7 @@ function $edcf132a9284368a$var$getContainerDimensions(containerNode) {
|
|
|
82
82
|
scroll.top = documentElement.scrollTop || containerNode.scrollTop;
|
|
83
83
|
scroll.left = documentElement.scrollLeft || containerNode.scrollLeft;
|
|
84
84
|
} else {
|
|
85
|
-
({ width: width
|
|
85
|
+
({ width: width, height: height, top: top, left: left } = $edcf132a9284368a$var$getOffset(containerNode));
|
|
86
86
|
scroll.top = containerNode.scrollTop;
|
|
87
87
|
scroll.left = containerNode.scrollLeft;
|
|
88
88
|
totalWidth = width;
|
|
@@ -106,13 +106,20 @@ function $edcf132a9284368a$var$getScroll(node) {
|
|
|
106
106
|
height: node.scrollHeight
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
-
function $edcf132a9284368a$var$getDelta(axis, offset, size,
|
|
109
|
+
function $edcf132a9284368a$var$getDelta(axis, offset, size, // The dimensions of the boundary element that the popover is
|
|
110
|
+
// positioned within (most of the time this is the <body>).
|
|
111
|
+
boundaryDimensions, // The dimensions of the containing block element that the popover is
|
|
112
|
+
// positioned relative to (e.g. parent with position: relative).
|
|
113
|
+
// Usually this is the same as the boundary element, but if the popover
|
|
114
|
+
// is portaled somewhere other than the body and has an ancestor with
|
|
115
|
+
// position: relative/absolute, it will be different.
|
|
116
|
+
containerDimensions, padding) {
|
|
110
117
|
let containerScroll = containerDimensions.scroll[axis];
|
|
111
|
-
let
|
|
118
|
+
let boundaryHeight = boundaryDimensions[$edcf132a9284368a$var$AXIS_SIZE[axis]];
|
|
112
119
|
let startEdgeOffset = offset - padding - containerScroll;
|
|
113
120
|
let endEdgeOffset = offset + padding - containerScroll + size;
|
|
114
121
|
if (startEdgeOffset < 0) return -startEdgeOffset;
|
|
115
|
-
else if (endEdgeOffset >
|
|
122
|
+
else if (endEdgeOffset > boundaryHeight) return Math.max(boundaryHeight - endEdgeOffset, -startEdgeOffset);
|
|
116
123
|
else return 0;
|
|
117
124
|
}
|
|
118
125
|
function $edcf132a9284368a$var$getMargins(node) {
|
|
@@ -143,7 +150,7 @@ function $edcf132a9284368a$var$parsePlacement(input) {
|
|
|
143
150
|
return $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input];
|
|
144
151
|
}
|
|
145
152
|
function $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset) {
|
|
146
|
-
let { placement: placement
|
|
153
|
+
let { placement: placement, crossPlacement: crossPlacement, axis: axis, crossAxis: crossAxis, size: size, crossSize: crossSize } = placementInfo;
|
|
147
154
|
let position = {};
|
|
148
155
|
// button position
|
|
149
156
|
position[crossAxis] = childOffset[crossAxis];
|
|
@@ -184,13 +191,13 @@ function $edcf132a9284368a$var$getMaxHeight(position, boundaryDimensions, contai
|
|
|
184
191
|
));
|
|
185
192
|
}
|
|
186
193
|
function $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding, placementInfo) {
|
|
187
|
-
let { placement: placement
|
|
194
|
+
let { placement: placement, axis: axis, size: size } = placementInfo;
|
|
188
195
|
if (placement === axis) return Math.max(0, childOffset[axis] - boundaryDimensions[axis] - boundaryDimensions.scroll[axis] + containerOffsetWithBoundary[axis] - margins[axis] - margins[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] - padding);
|
|
189
196
|
return Math.max(0, boundaryDimensions[size] + boundaryDimensions[axis] + boundaryDimensions.scroll[axis] - containerOffsetWithBoundary[axis] - childOffset[axis] - childOffset[size] - margins[axis] - margins[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] - padding);
|
|
190
197
|
}
|
|
191
|
-
function $edcf132a9284368a$export$6839422d1f33cee9(placementInput, childOffset, overlaySize, scrollSize, margins, padding, flip, boundaryDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, userSetMaxHeight, arrowSize, arrowBoundaryOffset) {
|
|
198
|
+
function $edcf132a9284368a$export$6839422d1f33cee9(placementInput, childOffset, overlaySize, scrollSize, margins, padding, flip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, userSetMaxHeight, arrowSize, arrowBoundaryOffset) {
|
|
192
199
|
let placementInfo = $edcf132a9284368a$var$parsePlacement(placementInput);
|
|
193
|
-
let { size: size
|
|
200
|
+
let { size: size, crossAxis: crossAxis, crossSize: crossSize, placement: placement, crossPlacement: crossPlacement } = placementInfo;
|
|
194
201
|
let position = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
|
|
195
202
|
let normalizedOffset = offset;
|
|
196
203
|
let space = $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, placementInfo);
|
|
@@ -206,13 +213,13 @@ function $edcf132a9284368a$export$6839422d1f33cee9(placementInput, childOffset,
|
|
|
206
213
|
normalizedOffset = offset;
|
|
207
214
|
}
|
|
208
215
|
}
|
|
209
|
-
let delta = $edcf132a9284368a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, padding);
|
|
216
|
+
let delta = $edcf132a9284368a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding);
|
|
210
217
|
position[crossAxis] += delta;
|
|
211
218
|
let maxHeight = $edcf132a9284368a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding);
|
|
212
219
|
if (userSetMaxHeight && userSetMaxHeight < maxHeight) maxHeight = userSetMaxHeight;
|
|
213
220
|
overlaySize.height = Math.min(overlaySize.height, maxHeight);
|
|
214
221
|
position = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, normalizedOffset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
|
|
215
|
-
delta = $edcf132a9284368a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, padding);
|
|
222
|
+
delta = $edcf132a9284368a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding);
|
|
216
223
|
position[crossAxis] += delta;
|
|
217
224
|
let arrowPosition = {};
|
|
218
225
|
// All values are transformed so that 0 is at the top/left of the overlay depending on the orientation
|
|
@@ -236,14 +243,14 @@ function $edcf132a9284368a$export$6839422d1f33cee9(placementInput, childOffset,
|
|
|
236
243
|
};
|
|
237
244
|
}
|
|
238
245
|
function $edcf132a9284368a$export$b3ceb0cbf1056d98(opts) {
|
|
239
|
-
let { placement: placement
|
|
246
|
+
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
247
|
let container = overlayNode instanceof HTMLElement ? $edcf132a9284368a$var$getContainingBlock(overlayNode) : document.documentElement;
|
|
241
248
|
let isViewportContainer = container === document.documentElement;
|
|
242
249
|
const containerPositionStyle = window.getComputedStyle(container).position;
|
|
243
250
|
let isContainerPositioned = !!containerPositionStyle && containerPositionStyle !== "static";
|
|
244
251
|
let childOffset = isViewportContainer ? $edcf132a9284368a$var$getOffset(targetNode) : $edcf132a9284368a$var$getPosition(targetNode, container);
|
|
245
252
|
if (!isViewportContainer) {
|
|
246
|
-
let { marginTop: marginTop
|
|
253
|
+
let { marginTop: marginTop, marginLeft: marginLeft } = window.getComputedStyle(targetNode);
|
|
247
254
|
childOffset.top += parseInt(marginTop, 10) || 0;
|
|
248
255
|
childOffset.left += parseInt(marginLeft, 10) || 0;
|
|
249
256
|
}
|
|
@@ -253,12 +260,13 @@ function $edcf132a9284368a$export$b3ceb0cbf1056d98(opts) {
|
|
|
253
260
|
overlaySize.height += margins.top + margins.bottom;
|
|
254
261
|
let scrollSize = $edcf132a9284368a$var$getScroll(scrollNode);
|
|
255
262
|
let boundaryDimensions = $edcf132a9284368a$var$getContainerDimensions(boundaryElement);
|
|
263
|
+
let containerDimensions = $edcf132a9284368a$var$getContainerDimensions(container);
|
|
256
264
|
let containerOffsetWithBoundary = boundaryElement.tagName === "BODY" ? $edcf132a9284368a$var$getOffset(container) : $edcf132a9284368a$var$getPosition(container, boundaryElement);
|
|
257
|
-
return $edcf132a9284368a$export$6839422d1f33cee9(placement, childOffset, overlaySize, scrollSize, margins, padding, shouldFlip, boundaryDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, maxHeight, arrowSize, arrowBoundaryOffset);
|
|
265
|
+
return $edcf132a9284368a$export$6839422d1f33cee9(placement, childOffset, overlaySize, scrollSize, margins, padding, shouldFlip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, maxHeight, arrowSize, arrowBoundaryOffset);
|
|
258
266
|
}
|
|
259
267
|
function $edcf132a9284368a$var$getOffset(node) {
|
|
260
|
-
let { top: top
|
|
261
|
-
let { scrollTop: scrollTop
|
|
268
|
+
let { top: top, left: left, width: width, height: height } = node.getBoundingClientRect();
|
|
269
|
+
let { scrollTop: scrollTop, scrollLeft: scrollLeft, clientTop: clientTop, clientLeft: clientLeft } = document.documentElement;
|
|
262
270
|
return {
|
|
263
271
|
top: top + scrollTop - clientTop,
|
|
264
272
|
left: left + scrollLeft - clientLeft,
|
|
@@ -270,7 +278,7 @@ function $edcf132a9284368a$var$getPosition(node, parent) {
|
|
|
270
278
|
let style = window.getComputedStyle(node);
|
|
271
279
|
let offset;
|
|
272
280
|
if (style.position === "fixed") {
|
|
273
|
-
let { top: top
|
|
281
|
+
let { top: top, left: left, width: width, height: height } = node.getBoundingClientRect();
|
|
274
282
|
offset = {
|
|
275
283
|
top: top,
|
|
276
284
|
left: left,
|
|
@@ -335,7 +343,7 @@ function $edcf132a9284368a$var$isContainingBlock(node) {
|
|
|
335
343
|
*/
|
|
336
344
|
const $dd149f63282afbbf$export$f6211563215e3b37 = new WeakMap();
|
|
337
345
|
function $dd149f63282afbbf$export$18fc8428861184da(opts) {
|
|
338
|
-
let { triggerRef: triggerRef
|
|
346
|
+
let { triggerRef: triggerRef, isOpen: isOpen, onClose: onClose } = opts;
|
|
339
347
|
(0, $k7QOs$useEffect)(()=>{
|
|
340
348
|
if (!isOpen || onClose === null) return;
|
|
341
349
|
let onScroll = (e)=>{
|
|
@@ -363,8 +371,8 @@ function $dd149f63282afbbf$export$18fc8428861184da(opts) {
|
|
|
363
371
|
// @ts-ignore
|
|
364
372
|
let $2a41e45df1593e64$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
|
|
365
373
|
function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
|
|
366
|
-
let { direction: direction
|
|
367
|
-
let { arrowSize: arrowSize = 0
|
|
374
|
+
let { direction: direction } = (0, $k7QOs$useLocale)();
|
|
375
|
+
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;
|
|
368
376
|
let [position, setPosition] = (0, $k7QOs$useState)({
|
|
369
377
|
position: {},
|
|
370
378
|
arrowOffsetLeft: undefined,
|
|
@@ -510,7 +518,7 @@ function $2a41e45df1593e64$var$translateRTL(position, direction) {
|
|
|
510
518
|
|
|
511
519
|
const $a11501f3d1d39e6c$var$visibleOverlays = [];
|
|
512
520
|
function $a11501f3d1d39e6c$export$ea8f71083e90600f(props, ref) {
|
|
513
|
-
let { onClose: onClose
|
|
521
|
+
let { onClose: onClose, shouldCloseOnBlur: shouldCloseOnBlur, isOpen: isOpen, isDismissable: isDismissable = false, isKeyboardDismissDisabled: isKeyboardDismissDisabled = false, shouldCloseOnInteractOutside: shouldCloseOnInteractOutside } = props;
|
|
514
522
|
// Add the overlay ref to the stack of visible overlays on mount, and remove on unmount.
|
|
515
523
|
(0, $k7QOs$useEffect)(()=>{
|
|
516
524
|
if (isOpen) $a11501f3d1d39e6c$var$visibleOverlays.push(ref);
|
|
@@ -557,13 +565,19 @@ function $a11501f3d1d39e6c$export$ea8f71083e90600f(props, ref) {
|
|
|
557
565
|
onInteractOutside: isDismissable ? onInteractOutside : null,
|
|
558
566
|
onInteractOutsideStart: onInteractOutsideStart
|
|
559
567
|
});
|
|
560
|
-
let { focusWithinProps: focusWithinProps
|
|
568
|
+
let { focusWithinProps: focusWithinProps } = (0, $k7QOs$useFocusWithin)({
|
|
561
569
|
isDisabled: !shouldCloseOnBlur,
|
|
562
570
|
onBlurWithin: (e)=>{
|
|
571
|
+
// Do not close if relatedTarget is null, which means focus is lost to the body.
|
|
572
|
+
// That can happen when switching tabs, or due to a VoiceOver/Chrome bug with Control+Option+Arrow navigation.
|
|
573
|
+
// Clicking on the body to close the overlay should already be handled by useInteractOutside.
|
|
574
|
+
// https://github.com/adobe/react-spectrum/issues/4130
|
|
575
|
+
// https://github.com/adobe/react-spectrum/issues/4922
|
|
576
|
+
//
|
|
563
577
|
// If focus is moving into a child focus scope (e.g. menu inside a dialog),
|
|
564
578
|
// do not close the outer overlay. At this point, the active scope should
|
|
565
579
|
// still be the outer overlay, since blur events run before focus.
|
|
566
|
-
if (e.relatedTarget
|
|
580
|
+
if (!e.relatedTarget || (0, $k7QOs$isElementInChildOfActiveScope)(e.relatedTarget)) return;
|
|
567
581
|
if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.relatedTarget)) onClose();
|
|
568
582
|
}
|
|
569
583
|
});
|
|
@@ -597,8 +611,8 @@ function $a11501f3d1d39e6c$export$ea8f71083e90600f(props, ref) {
|
|
|
597
611
|
|
|
598
612
|
|
|
599
613
|
function $628037886ba31236$export$f9d5c8beee7d008d(props, state, ref) {
|
|
600
|
-
let { type: type
|
|
601
|
-
let { isOpen: isOpen
|
|
614
|
+
let { type: type } = props;
|
|
615
|
+
let { isOpen: isOpen } = state;
|
|
602
616
|
// Backward compatibility. Share state close function with useOverlayPosition so it can close on scroll
|
|
603
617
|
// without forcing users to pass onClose.
|
|
604
618
|
(0, $k7QOs$useEffect)(()=>{
|
|
@@ -655,7 +669,7 @@ const $49c51c25361d4cd2$var$nonTextInputTypes = new Set([
|
|
|
655
669
|
let $49c51c25361d4cd2$var$preventScrollCount = 0;
|
|
656
670
|
let $49c51c25361d4cd2$var$restore;
|
|
657
671
|
function $49c51c25361d4cd2$export$ee0f7cc6afcd1c18(options = {}) {
|
|
658
|
-
let { isDisabled: isDisabled
|
|
672
|
+
let { isDisabled: isDisabled } = options;
|
|
659
673
|
(0, $k7QOs$useLayoutEffect)(()=>{
|
|
660
674
|
if (isDisabled) return;
|
|
661
675
|
$49c51c25361d4cd2$var$preventScrollCount++;
|
|
@@ -848,7 +862,7 @@ function $49c51c25361d4cd2$var$willOpenKeyboard(target) {
|
|
|
848
862
|
|
|
849
863
|
const $f57aed4a881a3485$var$Context = /*#__PURE__*/ (0, $k7QOs$react).createContext(null);
|
|
850
864
|
function $f57aed4a881a3485$export$178405afcd8c5eb(props) {
|
|
851
|
-
let { children: children
|
|
865
|
+
let { children: children } = props;
|
|
852
866
|
let parent = (0, $k7QOs$useContext)($f57aed4a881a3485$var$Context);
|
|
853
867
|
let [modalCount, setModalCount] = (0, $k7QOs$useState)(0);
|
|
854
868
|
let context = (0, $k7QOs$useMemo)(()=>({
|
|
@@ -881,7 +895,7 @@ function $f57aed4a881a3485$export$d9aaed4c3ece1bc0() {
|
|
|
881
895
|
/**
|
|
882
896
|
* Creates a root node that will be aria-hidden if there are other modals open.
|
|
883
897
|
*/ function $f57aed4a881a3485$var$OverlayContainerDOM(props) {
|
|
884
|
-
let { modalProviderProps: modalProviderProps
|
|
898
|
+
let { modalProviderProps: modalProviderProps } = $f57aed4a881a3485$export$d9aaed4c3ece1bc0();
|
|
885
899
|
return /*#__PURE__*/ (0, $k7QOs$react).createElement("div", {
|
|
886
900
|
"data-overlay-container": true,
|
|
887
901
|
...props,
|
|
@@ -893,7 +907,7 @@ function $f57aed4a881a3485$export$bf688221f59024e5(props) {
|
|
|
893
907
|
}
|
|
894
908
|
function $f57aed4a881a3485$export$b47c3594eab58386(props) {
|
|
895
909
|
let isSSR = (0, $k7QOs$useIsSSR)();
|
|
896
|
-
let { portalContainer: portalContainer = isSSR ? null : document.body
|
|
910
|
+
let { portalContainer: portalContainer = isSSR ? null : document.body, ...rest } = props;
|
|
897
911
|
(0, $k7QOs$react).useEffect(()=>{
|
|
898
912
|
if (portalContainer === null || portalContainer === void 0 ? void 0 : portalContainer.closest("[data-overlay-container]")) throw new Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.");
|
|
899
913
|
}, [
|
|
@@ -1186,7 +1200,7 @@ $a2f21f5f14f60553$exports = {
|
|
|
1186
1200
|
|
|
1187
1201
|
|
|
1188
1202
|
function $86ea4cb521eb2e37$export$2317d149ed6f78c4(props) {
|
|
1189
|
-
let { onDismiss: onDismiss
|
|
1203
|
+
let { onDismiss: onDismiss, ...otherProps } = props;
|
|
1190
1204
|
let stringFormatter = (0, $k7QOs$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($a2f21f5f14f60553$exports))));
|
|
1191
1205
|
let labels = (0, $k7QOs$useLabels)(otherProps, stringFormatter.format("dismiss"));
|
|
1192
1206
|
let onClick = ()=>{
|
|
@@ -1330,15 +1344,15 @@ function $5e3802645cc19319$export$1c3ebcada18427bf(targets, root = document.body
|
|
|
1330
1344
|
|
|
1331
1345
|
|
|
1332
1346
|
function $f2f8a6077418541e$export$542a6fd13ac93354(props, state) {
|
|
1333
|
-
let { triggerRef: triggerRef
|
|
1334
|
-
let { overlayProps: overlayProps
|
|
1347
|
+
let { triggerRef: triggerRef, popoverRef: popoverRef, isNonModal: isNonModal, isKeyboardDismissDisabled: isKeyboardDismissDisabled, ...otherProps } = props;
|
|
1348
|
+
let { overlayProps: overlayProps, underlayProps: underlayProps } = (0, $a11501f3d1d39e6c$export$ea8f71083e90600f)({
|
|
1335
1349
|
isOpen: state.isOpen,
|
|
1336
1350
|
onClose: state.close,
|
|
1337
1351
|
shouldCloseOnBlur: true,
|
|
1338
1352
|
isDismissable: !isNonModal,
|
|
1339
1353
|
isKeyboardDismissDisabled: isKeyboardDismissDisabled
|
|
1340
1354
|
}, popoverRef);
|
|
1341
|
-
let { overlayProps: positionProps
|
|
1355
|
+
let { overlayProps: positionProps, arrowProps: arrowProps, placement: placement } = (0, $2a41e45df1593e64$export$d39e1813b3bdd0e1)({
|
|
1342
1356
|
...otherProps,
|
|
1343
1357
|
targetRef: triggerRef,
|
|
1344
1358
|
overlayRef: popoverRef,
|
|
@@ -1395,10 +1409,11 @@ function $f2f8a6077418541e$export$542a6fd13ac93354(props, state) {
|
|
|
1395
1409
|
|
|
1396
1410
|
|
|
1397
1411
|
|
|
1412
|
+
|
|
1398
1413
|
const $337b884510726a0d$export$a2200b96afd16271 = /*#__PURE__*/ (0, $k7QOs$react).createContext(null);
|
|
1399
1414
|
function $337b884510726a0d$export$c6fdb837b070b4ff(props) {
|
|
1400
1415
|
let isSSR = (0, $k7QOs$useIsSSR)();
|
|
1401
|
-
let { portalContainer: portalContainer = isSSR ? null : document.body
|
|
1416
|
+
let { portalContainer: portalContainer = isSSR ? null : document.body, isExiting: isExiting } = props;
|
|
1402
1417
|
let [contain, setContain] = (0, $k7QOs$useState)(false);
|
|
1403
1418
|
let contextValue = (0, $k7QOs$useMemo)(()=>({
|
|
1404
1419
|
contain: contain,
|
|
@@ -1408,16 +1423,14 @@ function $337b884510726a0d$export$c6fdb837b070b4ff(props) {
|
|
|
1408
1423
|
setContain
|
|
1409
1424
|
]);
|
|
1410
1425
|
if (!portalContainer) return null;
|
|
1411
|
-
let contents;
|
|
1412
|
-
if (!props.disableFocusManagement) contents = /*#__PURE__*/ (0, $k7QOs$react).createElement($
|
|
1413
|
-
value: contextValue
|
|
1414
|
-
}, /*#__PURE__*/ (0, $k7QOs$react).createElement((0, $k7QOs$FocusScope), {
|
|
1426
|
+
let contents = props.children;
|
|
1427
|
+
if (!props.disableFocusManagement) contents = /*#__PURE__*/ (0, $k7QOs$react).createElement((0, $k7QOs$FocusScope), {
|
|
1415
1428
|
restoreFocus: true,
|
|
1416
1429
|
contain: contain && !isExiting
|
|
1417
|
-
},
|
|
1418
|
-
|
|
1430
|
+
}, contents);
|
|
1431
|
+
contents = /*#__PURE__*/ (0, $k7QOs$react).createElement($337b884510726a0d$export$a2200b96afd16271.Provider, {
|
|
1419
1432
|
value: contextValue
|
|
1420
|
-
},
|
|
1433
|
+
}, /*#__PURE__*/ (0, $k7QOs$react).createElement((0, $k7QOs$ClearPressResponder), null, contents));
|
|
1421
1434
|
return /*#__PURE__*/ (0, $k7QOs$reactdom).createPortal(contents, portalContainer);
|
|
1422
1435
|
}
|
|
1423
1436
|
function $337b884510726a0d$export$14c98a7594375490() {
|
|
@@ -1433,7 +1446,7 @@ function $337b884510726a0d$export$14c98a7594375490() {
|
|
|
1433
1446
|
|
|
1434
1447
|
|
|
1435
1448
|
function $8ac8429251c45e4b$export$dbc0f175b25fb0fb(props, state, ref) {
|
|
1436
|
-
let { overlayProps: overlayProps
|
|
1449
|
+
let { overlayProps: overlayProps, underlayProps: underlayProps } = (0, $a11501f3d1d39e6c$export$ea8f71083e90600f)({
|
|
1437
1450
|
...props,
|
|
1438
1451
|
isOpen: state.isOpen,
|
|
1439
1452
|
onClose: state.close
|
package/dist/main.js
CHANGED
|
@@ -101,7 +101,7 @@ function $5935ba4d7da2c103$var$getContainerDimensions(containerNode) {
|
|
|
101
101
|
scroll.top = documentElement.scrollTop || containerNode.scrollTop;
|
|
102
102
|
scroll.left = documentElement.scrollLeft || containerNode.scrollLeft;
|
|
103
103
|
} else {
|
|
104
|
-
({ width: width
|
|
104
|
+
({ width: width, height: height, top: top, left: left } = $5935ba4d7da2c103$var$getOffset(containerNode));
|
|
105
105
|
scroll.top = containerNode.scrollTop;
|
|
106
106
|
scroll.left = containerNode.scrollLeft;
|
|
107
107
|
totalWidth = width;
|
|
@@ -125,13 +125,20 @@ function $5935ba4d7da2c103$var$getScroll(node) {
|
|
|
125
125
|
height: node.scrollHeight
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
|
-
function $5935ba4d7da2c103$var$getDelta(axis, offset, size,
|
|
128
|
+
function $5935ba4d7da2c103$var$getDelta(axis, offset, size, // The dimensions of the boundary element that the popover is
|
|
129
|
+
// positioned within (most of the time this is the <body>).
|
|
130
|
+
boundaryDimensions, // The dimensions of the containing block element that the popover is
|
|
131
|
+
// positioned relative to (e.g. parent with position: relative).
|
|
132
|
+
// Usually this is the same as the boundary element, but if the popover
|
|
133
|
+
// is portaled somewhere other than the body and has an ancestor with
|
|
134
|
+
// position: relative/absolute, it will be different.
|
|
135
|
+
containerDimensions, padding) {
|
|
129
136
|
let containerScroll = containerDimensions.scroll[axis];
|
|
130
|
-
let
|
|
137
|
+
let boundaryHeight = boundaryDimensions[$5935ba4d7da2c103$var$AXIS_SIZE[axis]];
|
|
131
138
|
let startEdgeOffset = offset - padding - containerScroll;
|
|
132
139
|
let endEdgeOffset = offset + padding - containerScroll + size;
|
|
133
140
|
if (startEdgeOffset < 0) return -startEdgeOffset;
|
|
134
|
-
else if (endEdgeOffset >
|
|
141
|
+
else if (endEdgeOffset > boundaryHeight) return Math.max(boundaryHeight - endEdgeOffset, -startEdgeOffset);
|
|
135
142
|
else return 0;
|
|
136
143
|
}
|
|
137
144
|
function $5935ba4d7da2c103$var$getMargins(node) {
|
|
@@ -162,7 +169,7 @@ function $5935ba4d7da2c103$var$parsePlacement(input) {
|
|
|
162
169
|
return $5935ba4d7da2c103$var$PARSED_PLACEMENT_CACHE[input];
|
|
163
170
|
}
|
|
164
171
|
function $5935ba4d7da2c103$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset) {
|
|
165
|
-
let { placement: placement
|
|
172
|
+
let { placement: placement, crossPlacement: crossPlacement, axis: axis, crossAxis: crossAxis, size: size, crossSize: crossSize } = placementInfo;
|
|
166
173
|
let position = {};
|
|
167
174
|
// button position
|
|
168
175
|
position[crossAxis] = childOffset[crossAxis];
|
|
@@ -203,13 +210,13 @@ function $5935ba4d7da2c103$var$getMaxHeight(position, boundaryDimensions, contai
|
|
|
203
210
|
));
|
|
204
211
|
}
|
|
205
212
|
function $5935ba4d7da2c103$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding, placementInfo) {
|
|
206
|
-
let { placement: placement
|
|
213
|
+
let { placement: placement, axis: axis, size: size } = placementInfo;
|
|
207
214
|
if (placement === axis) return Math.max(0, childOffset[axis] - boundaryDimensions[axis] - boundaryDimensions.scroll[axis] + containerOffsetWithBoundary[axis] - margins[axis] - margins[$5935ba4d7da2c103$var$FLIPPED_DIRECTION[axis]] - padding);
|
|
208
215
|
return Math.max(0, boundaryDimensions[size] + boundaryDimensions[axis] + boundaryDimensions.scroll[axis] - containerOffsetWithBoundary[axis] - childOffset[axis] - childOffset[size] - margins[axis] - margins[$5935ba4d7da2c103$var$FLIPPED_DIRECTION[axis]] - padding);
|
|
209
216
|
}
|
|
210
|
-
function $5935ba4d7da2c103$export$6839422d1f33cee9(placementInput, childOffset, overlaySize, scrollSize, margins, padding, flip, boundaryDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, userSetMaxHeight, arrowSize, arrowBoundaryOffset) {
|
|
217
|
+
function $5935ba4d7da2c103$export$6839422d1f33cee9(placementInput, childOffset, overlaySize, scrollSize, margins, padding, flip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, userSetMaxHeight, arrowSize, arrowBoundaryOffset) {
|
|
211
218
|
let placementInfo = $5935ba4d7da2c103$var$parsePlacement(placementInput);
|
|
212
|
-
let { size: size
|
|
219
|
+
let { size: size, crossAxis: crossAxis, crossSize: crossSize, placement: placement, crossPlacement: crossPlacement } = placementInfo;
|
|
213
220
|
let position = $5935ba4d7da2c103$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
|
|
214
221
|
let normalizedOffset = offset;
|
|
215
222
|
let space = $5935ba4d7da2c103$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, placementInfo);
|
|
@@ -225,13 +232,13 @@ function $5935ba4d7da2c103$export$6839422d1f33cee9(placementInput, childOffset,
|
|
|
225
232
|
normalizedOffset = offset;
|
|
226
233
|
}
|
|
227
234
|
}
|
|
228
|
-
let delta = $5935ba4d7da2c103$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, padding);
|
|
235
|
+
let delta = $5935ba4d7da2c103$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding);
|
|
229
236
|
position[crossAxis] += delta;
|
|
230
237
|
let maxHeight = $5935ba4d7da2c103$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding);
|
|
231
238
|
if (userSetMaxHeight && userSetMaxHeight < maxHeight) maxHeight = userSetMaxHeight;
|
|
232
239
|
overlaySize.height = Math.min(overlaySize.height, maxHeight);
|
|
233
240
|
position = $5935ba4d7da2c103$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, normalizedOffset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
|
|
234
|
-
delta = $5935ba4d7da2c103$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, padding);
|
|
241
|
+
delta = $5935ba4d7da2c103$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding);
|
|
235
242
|
position[crossAxis] += delta;
|
|
236
243
|
let arrowPosition = {};
|
|
237
244
|
// All values are transformed so that 0 is at the top/left of the overlay depending on the orientation
|
|
@@ -255,14 +262,14 @@ function $5935ba4d7da2c103$export$6839422d1f33cee9(placementInput, childOffset,
|
|
|
255
262
|
};
|
|
256
263
|
}
|
|
257
264
|
function $5935ba4d7da2c103$export$b3ceb0cbf1056d98(opts) {
|
|
258
|
-
let { placement: placement
|
|
265
|
+
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
266
|
let container = overlayNode instanceof HTMLElement ? $5935ba4d7da2c103$var$getContainingBlock(overlayNode) : document.documentElement;
|
|
260
267
|
let isViewportContainer = container === document.documentElement;
|
|
261
268
|
const containerPositionStyle = window.getComputedStyle(container).position;
|
|
262
269
|
let isContainerPositioned = !!containerPositionStyle && containerPositionStyle !== "static";
|
|
263
270
|
let childOffset = isViewportContainer ? $5935ba4d7da2c103$var$getOffset(targetNode) : $5935ba4d7da2c103$var$getPosition(targetNode, container);
|
|
264
271
|
if (!isViewportContainer) {
|
|
265
|
-
let { marginTop: marginTop
|
|
272
|
+
let { marginTop: marginTop, marginLeft: marginLeft } = window.getComputedStyle(targetNode);
|
|
266
273
|
childOffset.top += parseInt(marginTop, 10) || 0;
|
|
267
274
|
childOffset.left += parseInt(marginLeft, 10) || 0;
|
|
268
275
|
}
|
|
@@ -272,12 +279,13 @@ function $5935ba4d7da2c103$export$b3ceb0cbf1056d98(opts) {
|
|
|
272
279
|
overlaySize.height += margins.top + margins.bottom;
|
|
273
280
|
let scrollSize = $5935ba4d7da2c103$var$getScroll(scrollNode);
|
|
274
281
|
let boundaryDimensions = $5935ba4d7da2c103$var$getContainerDimensions(boundaryElement);
|
|
282
|
+
let containerDimensions = $5935ba4d7da2c103$var$getContainerDimensions(container);
|
|
275
283
|
let containerOffsetWithBoundary = boundaryElement.tagName === "BODY" ? $5935ba4d7da2c103$var$getOffset(container) : $5935ba4d7da2c103$var$getPosition(container, boundaryElement);
|
|
276
|
-
return $5935ba4d7da2c103$export$6839422d1f33cee9(placement, childOffset, overlaySize, scrollSize, margins, padding, shouldFlip, boundaryDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, maxHeight, arrowSize, arrowBoundaryOffset);
|
|
284
|
+
return $5935ba4d7da2c103$export$6839422d1f33cee9(placement, childOffset, overlaySize, scrollSize, margins, padding, shouldFlip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, maxHeight, arrowSize, arrowBoundaryOffset);
|
|
277
285
|
}
|
|
278
286
|
function $5935ba4d7da2c103$var$getOffset(node) {
|
|
279
|
-
let { top: top
|
|
280
|
-
let { scrollTop: scrollTop
|
|
287
|
+
let { top: top, left: left, width: width, height: height } = node.getBoundingClientRect();
|
|
288
|
+
let { scrollTop: scrollTop, scrollLeft: scrollLeft, clientTop: clientTop, clientLeft: clientLeft } = document.documentElement;
|
|
281
289
|
return {
|
|
282
290
|
top: top + scrollTop - clientTop,
|
|
283
291
|
left: left + scrollLeft - clientLeft,
|
|
@@ -289,7 +297,7 @@ function $5935ba4d7da2c103$var$getPosition(node, parent) {
|
|
|
289
297
|
let style = window.getComputedStyle(node);
|
|
290
298
|
let offset;
|
|
291
299
|
if (style.position === "fixed") {
|
|
292
|
-
let { top: top
|
|
300
|
+
let { top: top, left: left, width: width, height: height } = node.getBoundingClientRect();
|
|
293
301
|
offset = {
|
|
294
302
|
top: top,
|
|
295
303
|
left: left,
|
|
@@ -354,7 +362,7 @@ function $5935ba4d7da2c103$var$isContainingBlock(node) {
|
|
|
354
362
|
*/
|
|
355
363
|
const $9a8aa1b0b336ea3a$export$f6211563215e3b37 = new WeakMap();
|
|
356
364
|
function $9a8aa1b0b336ea3a$export$18fc8428861184da(opts) {
|
|
357
|
-
let { triggerRef: triggerRef
|
|
365
|
+
let { triggerRef: triggerRef, isOpen: isOpen, onClose: onClose } = opts;
|
|
358
366
|
(0, $6Zb2x$react.useEffect)(()=>{
|
|
359
367
|
if (!isOpen || onClose === null) return;
|
|
360
368
|
let onScroll = (e)=>{
|
|
@@ -382,8 +390,8 @@ function $9a8aa1b0b336ea3a$export$18fc8428861184da(opts) {
|
|
|
382
390
|
// @ts-ignore
|
|
383
391
|
let $cd94b4896dd97759$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
|
|
384
392
|
function $cd94b4896dd97759$export$d39e1813b3bdd0e1(props) {
|
|
385
|
-
let { direction: direction
|
|
386
|
-
let { arrowSize: arrowSize = 0
|
|
393
|
+
let { direction: direction } = (0, $6Zb2x$reactariai18n.useLocale)();
|
|
394
|
+
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;
|
|
387
395
|
let [position, setPosition] = (0, $6Zb2x$react.useState)({
|
|
388
396
|
position: {},
|
|
389
397
|
arrowOffsetLeft: undefined,
|
|
@@ -529,7 +537,7 @@ function $cd94b4896dd97759$var$translateRTL(position, direction) {
|
|
|
529
537
|
|
|
530
538
|
const $82711f9cb668ecdb$var$visibleOverlays = [];
|
|
531
539
|
function $82711f9cb668ecdb$export$ea8f71083e90600f(props, ref) {
|
|
532
|
-
let { onClose: onClose
|
|
540
|
+
let { onClose: onClose, shouldCloseOnBlur: shouldCloseOnBlur, isOpen: isOpen, isDismissable: isDismissable = false, isKeyboardDismissDisabled: isKeyboardDismissDisabled = false, shouldCloseOnInteractOutside: shouldCloseOnInteractOutside } = props;
|
|
533
541
|
// Add the overlay ref to the stack of visible overlays on mount, and remove on unmount.
|
|
534
542
|
(0, $6Zb2x$react.useEffect)(()=>{
|
|
535
543
|
if (isOpen) $82711f9cb668ecdb$var$visibleOverlays.push(ref);
|
|
@@ -576,13 +584,19 @@ function $82711f9cb668ecdb$export$ea8f71083e90600f(props, ref) {
|
|
|
576
584
|
onInteractOutside: isDismissable ? onInteractOutside : null,
|
|
577
585
|
onInteractOutsideStart: onInteractOutsideStart
|
|
578
586
|
});
|
|
579
|
-
let { focusWithinProps: focusWithinProps
|
|
587
|
+
let { focusWithinProps: focusWithinProps } = (0, $6Zb2x$reactariainteractions.useFocusWithin)({
|
|
580
588
|
isDisabled: !shouldCloseOnBlur,
|
|
581
589
|
onBlurWithin: (e)=>{
|
|
590
|
+
// Do not close if relatedTarget is null, which means focus is lost to the body.
|
|
591
|
+
// That can happen when switching tabs, or due to a VoiceOver/Chrome bug with Control+Option+Arrow navigation.
|
|
592
|
+
// Clicking on the body to close the overlay should already be handled by useInteractOutside.
|
|
593
|
+
// https://github.com/adobe/react-spectrum/issues/4130
|
|
594
|
+
// https://github.com/adobe/react-spectrum/issues/4922
|
|
595
|
+
//
|
|
582
596
|
// If focus is moving into a child focus scope (e.g. menu inside a dialog),
|
|
583
597
|
// do not close the outer overlay. At this point, the active scope should
|
|
584
598
|
// still be the outer overlay, since blur events run before focus.
|
|
585
|
-
if (e.relatedTarget
|
|
599
|
+
if (!e.relatedTarget || (0, $6Zb2x$reactariafocus.isElementInChildOfActiveScope)(e.relatedTarget)) return;
|
|
586
600
|
if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.relatedTarget)) onClose();
|
|
587
601
|
}
|
|
588
602
|
});
|
|
@@ -616,8 +630,8 @@ function $82711f9cb668ecdb$export$ea8f71083e90600f(props, ref) {
|
|
|
616
630
|
|
|
617
631
|
|
|
618
632
|
function $b4878eb6316f670a$export$f9d5c8beee7d008d(props, state, ref) {
|
|
619
|
-
let { type: type
|
|
620
|
-
let { isOpen: isOpen
|
|
633
|
+
let { type: type } = props;
|
|
634
|
+
let { isOpen: isOpen } = state;
|
|
621
635
|
// Backward compatibility. Share state close function with useOverlayPosition so it can close on scroll
|
|
622
636
|
// without forcing users to pass onClose.
|
|
623
637
|
(0, $6Zb2x$react.useEffect)(()=>{
|
|
@@ -674,7 +688,7 @@ const $5c2f5cd01815d369$var$nonTextInputTypes = new Set([
|
|
|
674
688
|
let $5c2f5cd01815d369$var$preventScrollCount = 0;
|
|
675
689
|
let $5c2f5cd01815d369$var$restore;
|
|
676
690
|
function $5c2f5cd01815d369$export$ee0f7cc6afcd1c18(options = {}) {
|
|
677
|
-
let { isDisabled: isDisabled
|
|
691
|
+
let { isDisabled: isDisabled } = options;
|
|
678
692
|
(0, $6Zb2x$reactariautils.useLayoutEffect)(()=>{
|
|
679
693
|
if (isDisabled) return;
|
|
680
694
|
$5c2f5cd01815d369$var$preventScrollCount++;
|
|
@@ -867,7 +881,7 @@ function $5c2f5cd01815d369$var$willOpenKeyboard(target) {
|
|
|
867
881
|
|
|
868
882
|
const $0775ea8ea6a0565e$var$Context = /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createContext(null);
|
|
869
883
|
function $0775ea8ea6a0565e$export$178405afcd8c5eb(props) {
|
|
870
|
-
let { children: children
|
|
884
|
+
let { children: children } = props;
|
|
871
885
|
let parent = (0, $6Zb2x$react.useContext)($0775ea8ea6a0565e$var$Context);
|
|
872
886
|
let [modalCount, setModalCount] = (0, $6Zb2x$react.useState)(0);
|
|
873
887
|
let context = (0, $6Zb2x$react.useMemo)(()=>({
|
|
@@ -900,7 +914,7 @@ function $0775ea8ea6a0565e$export$d9aaed4c3ece1bc0() {
|
|
|
900
914
|
/**
|
|
901
915
|
* Creates a root node that will be aria-hidden if there are other modals open.
|
|
902
916
|
*/ function $0775ea8ea6a0565e$var$OverlayContainerDOM(props) {
|
|
903
|
-
let { modalProviderProps: modalProviderProps
|
|
917
|
+
let { modalProviderProps: modalProviderProps } = $0775ea8ea6a0565e$export$d9aaed4c3ece1bc0();
|
|
904
918
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement("div", {
|
|
905
919
|
"data-overlay-container": true,
|
|
906
920
|
...props,
|
|
@@ -912,7 +926,7 @@ function $0775ea8ea6a0565e$export$bf688221f59024e5(props) {
|
|
|
912
926
|
}
|
|
913
927
|
function $0775ea8ea6a0565e$export$b47c3594eab58386(props) {
|
|
914
928
|
let isSSR = (0, $6Zb2x$reactariassr.useIsSSR)();
|
|
915
|
-
let { portalContainer: portalContainer = isSSR ? null : document.body
|
|
929
|
+
let { portalContainer: portalContainer = isSSR ? null : document.body, ...rest } = props;
|
|
916
930
|
(0, ($parcel$interopDefault($6Zb2x$react))).useEffect(()=>{
|
|
917
931
|
if (portalContainer === null || portalContainer === void 0 ? void 0 : portalContainer.closest("[data-overlay-container]")) throw new Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.");
|
|
918
932
|
}, [
|
|
@@ -1205,7 +1219,7 @@ $90f032faf016e1fb$exports = {
|
|
|
1205
1219
|
|
|
1206
1220
|
|
|
1207
1221
|
function $f69bb3e6457495cc$export$2317d149ed6f78c4(props) {
|
|
1208
|
-
let { onDismiss: onDismiss
|
|
1222
|
+
let { onDismiss: onDismiss, ...otherProps } = props;
|
|
1209
1223
|
let stringFormatter = (0, $6Zb2x$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($90f032faf016e1fb$exports))));
|
|
1210
1224
|
let labels = (0, $6Zb2x$reactariautils.useLabels)(otherProps, stringFormatter.format("dismiss"));
|
|
1211
1225
|
let onClick = ()=>{
|
|
@@ -1349,15 +1363,15 @@ function $08ef1685902b6011$export$1c3ebcada18427bf(targets, root = document.body
|
|
|
1349
1363
|
|
|
1350
1364
|
|
|
1351
1365
|
function $6c2dfcdee3e15e20$export$542a6fd13ac93354(props, state) {
|
|
1352
|
-
let { triggerRef: triggerRef
|
|
1353
|
-
let { overlayProps: overlayProps
|
|
1366
|
+
let { triggerRef: triggerRef, popoverRef: popoverRef, isNonModal: isNonModal, isKeyboardDismissDisabled: isKeyboardDismissDisabled, ...otherProps } = props;
|
|
1367
|
+
let { overlayProps: overlayProps, underlayProps: underlayProps } = (0, $82711f9cb668ecdb$export$ea8f71083e90600f)({
|
|
1354
1368
|
isOpen: state.isOpen,
|
|
1355
1369
|
onClose: state.close,
|
|
1356
1370
|
shouldCloseOnBlur: true,
|
|
1357
1371
|
isDismissable: !isNonModal,
|
|
1358
1372
|
isKeyboardDismissDisabled: isKeyboardDismissDisabled
|
|
1359
1373
|
}, popoverRef);
|
|
1360
|
-
let { overlayProps: positionProps
|
|
1374
|
+
let { overlayProps: positionProps, arrowProps: arrowProps, placement: placement } = (0, $cd94b4896dd97759$export$d39e1813b3bdd0e1)({
|
|
1361
1375
|
...otherProps,
|
|
1362
1376
|
targetRef: triggerRef,
|
|
1363
1377
|
overlayRef: popoverRef,
|
|
@@ -1414,10 +1428,11 @@ function $6c2dfcdee3e15e20$export$542a6fd13ac93354(props, state) {
|
|
|
1414
1428
|
|
|
1415
1429
|
|
|
1416
1430
|
|
|
1431
|
+
|
|
1417
1432
|
const $745edbb83ab4296f$export$a2200b96afd16271 = /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createContext(null);
|
|
1418
1433
|
function $745edbb83ab4296f$export$c6fdb837b070b4ff(props) {
|
|
1419
1434
|
let isSSR = (0, $6Zb2x$reactariassr.useIsSSR)();
|
|
1420
|
-
let { portalContainer: portalContainer = isSSR ? null : document.body
|
|
1435
|
+
let { portalContainer: portalContainer = isSSR ? null : document.body, isExiting: isExiting } = props;
|
|
1421
1436
|
let [contain, setContain] = (0, $6Zb2x$react.useState)(false);
|
|
1422
1437
|
let contextValue = (0, $6Zb2x$react.useMemo)(()=>({
|
|
1423
1438
|
contain: contain,
|
|
@@ -1427,16 +1442,14 @@ function $745edbb83ab4296f$export$c6fdb837b070b4ff(props) {
|
|
|
1427
1442
|
setContain
|
|
1428
1443
|
]);
|
|
1429
1444
|
if (!portalContainer) return null;
|
|
1430
|
-
let contents;
|
|
1431
|
-
if (!props.disableFocusManagement) contents = /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement($
|
|
1432
|
-
value: contextValue
|
|
1433
|
-
}, /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement((0, $6Zb2x$reactariafocus.FocusScope), {
|
|
1445
|
+
let contents = props.children;
|
|
1446
|
+
if (!props.disableFocusManagement) contents = /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement((0, $6Zb2x$reactariafocus.FocusScope), {
|
|
1434
1447
|
restoreFocus: true,
|
|
1435
1448
|
contain: contain && !isExiting
|
|
1436
|
-
},
|
|
1437
|
-
|
|
1449
|
+
}, contents);
|
|
1450
|
+
contents = /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement($745edbb83ab4296f$export$a2200b96afd16271.Provider, {
|
|
1438
1451
|
value: contextValue
|
|
1439
|
-
},
|
|
1452
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement((0, $6Zb2x$reactariainteractions.ClearPressResponder), null, contents));
|
|
1440
1453
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$reactdom))).createPortal(contents, portalContainer);
|
|
1441
1454
|
}
|
|
1442
1455
|
function $745edbb83ab4296f$export$14c98a7594375490() {
|
|
@@ -1452,7 +1465,7 @@ function $745edbb83ab4296f$export$14c98a7594375490() {
|
|
|
1452
1465
|
|
|
1453
1466
|
|
|
1454
1467
|
function $11b7e0b04b421e95$export$dbc0f175b25fb0fb(props, state, ref) {
|
|
1455
|
-
let { overlayProps: overlayProps
|
|
1468
|
+
let { overlayProps: overlayProps, underlayProps: underlayProps } = (0, $82711f9cb668ecdb$export$ea8f71083e90600f)({
|
|
1456
1469
|
...props,
|
|
1457
1470
|
isOpen: state.isOpen,
|
|
1458
1471
|
onClose: state.close
|