@react-aria/overlays 3.11.0 → 3.12.1
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/main.js +366 -185
- package/dist/main.js.map +1 -1
- package/dist/module.js +367 -186
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +14 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/Overlay.tsx +6 -4
- package/src/ariaHideOutside.ts +28 -0
- package/src/useCloseOnScroll.ts +1 -1
- package/src/useOverlay.ts +8 -0
- package/src/useOverlayPosition.ts +10 -2
- package/src/usePopover.ts +47 -14
- package/src/usePreventScroll.ts +20 -4
package/dist/main.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
var $6Zb2x$react = require("react");
|
|
2
2
|
var $6Zb2x$reactariautils = require("@react-aria/utils");
|
|
3
3
|
var $6Zb2x$reactariai18n = require("@react-aria/i18n");
|
|
4
|
+
var $6Zb2x$reactariafocus = require("@react-aria/focus");
|
|
4
5
|
var $6Zb2x$reactariainteractions = require("@react-aria/interactions");
|
|
5
6
|
var $6Zb2x$reactdom = require("react-dom");
|
|
6
7
|
var $6Zb2x$reactariassr = require("@react-aria/ssr");
|
|
7
8
|
var $6Zb2x$reactariavisuallyhidden = require("@react-aria/visually-hidden");
|
|
8
|
-
var $6Zb2x$reactariafocus = require("@react-aria/focus");
|
|
9
9
|
|
|
10
10
|
function $parcel$export(e, n, v, s) {
|
|
11
11
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
@@ -29,40 +29,68 @@ $parcel$export(module.exports, "usePopover", () => $6c2dfcdee3e15e20$export$542a
|
|
|
29
29
|
$parcel$export(module.exports, "useModalOverlay", () => $11b7e0b04b421e95$export$dbc0f175b25fb0fb);
|
|
30
30
|
$parcel$export(module.exports, "Overlay", () => $745edbb83ab4296f$export$c6fdb837b070b4ff);
|
|
31
31
|
$parcel$export(module.exports, "useOverlayFocusContain", () => $745edbb83ab4296f$export$14c98a7594375490);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
/*
|
|
33
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
34
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
35
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
36
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
37
|
+
*
|
|
38
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
39
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
40
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
41
|
+
* governing permissions and limitations under the License.
|
|
42
|
+
*/ /*
|
|
43
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
44
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
45
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
46
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
47
|
+
*
|
|
48
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
49
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
50
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
51
|
+
* governing permissions and limitations under the License.
|
|
52
|
+
*/ /*
|
|
53
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
54
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
55
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
56
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
57
|
+
*
|
|
58
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
59
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
60
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
61
|
+
* governing permissions and limitations under the License.
|
|
62
|
+
*/ const $5935ba4d7da2c103$var$AXIS = {
|
|
63
|
+
top: "top",
|
|
64
|
+
bottom: "top",
|
|
65
|
+
left: "left",
|
|
66
|
+
right: "left"
|
|
37
67
|
};
|
|
38
68
|
const $5935ba4d7da2c103$var$FLIPPED_DIRECTION = {
|
|
39
|
-
top:
|
|
40
|
-
bottom:
|
|
41
|
-
left:
|
|
42
|
-
right:
|
|
69
|
+
top: "bottom",
|
|
70
|
+
bottom: "top",
|
|
71
|
+
left: "right",
|
|
72
|
+
right: "left"
|
|
43
73
|
};
|
|
44
74
|
const $5935ba4d7da2c103$var$CROSS_AXIS = {
|
|
45
|
-
top:
|
|
46
|
-
left:
|
|
75
|
+
top: "left",
|
|
76
|
+
left: "top"
|
|
47
77
|
};
|
|
48
78
|
const $5935ba4d7da2c103$var$AXIS_SIZE = {
|
|
49
|
-
top:
|
|
50
|
-
left:
|
|
51
|
-
};
|
|
52
|
-
const $5935ba4d7da2c103$var$PARSED_PLACEMENT_CACHE = {
|
|
79
|
+
top: "height",
|
|
80
|
+
left: "width"
|
|
53
81
|
};
|
|
82
|
+
const $5935ba4d7da2c103$var$PARSED_PLACEMENT_CACHE = {};
|
|
54
83
|
// @ts-ignore
|
|
55
|
-
let $5935ba4d7da2c103$var$visualViewport = typeof window !==
|
|
84
|
+
let $5935ba4d7da2c103$var$visualViewport = typeof window !== "undefined" && window.visualViewport;
|
|
56
85
|
function $5935ba4d7da2c103$var$getContainerDimensions(containerNode) {
|
|
57
86
|
let width = 0, height = 0, top = 0, left = 0;
|
|
58
|
-
let scroll = {
|
|
59
|
-
|
|
60
|
-
if (containerNode.tagName === 'BODY') {
|
|
87
|
+
let scroll = {};
|
|
88
|
+
if (containerNode.tagName === "BODY") {
|
|
61
89
|
let documentElement = document.documentElement;
|
|
62
|
-
var
|
|
63
|
-
width = (
|
|
64
|
-
var
|
|
65
|
-
height = (
|
|
90
|
+
var _visualViewport_width;
|
|
91
|
+
width = (_visualViewport_width = $5935ba4d7da2c103$var$visualViewport === null || $5935ba4d7da2c103$var$visualViewport === void 0 ? void 0 : $5935ba4d7da2c103$var$visualViewport.width) !== null && _visualViewport_width !== void 0 ? _visualViewport_width : documentElement.clientWidth;
|
|
92
|
+
var _visualViewport_height;
|
|
93
|
+
height = (_visualViewport_height = $5935ba4d7da2c103$var$visualViewport === null || $5935ba4d7da2c103$var$visualViewport === void 0 ? void 0 : $5935ba4d7da2c103$var$visualViewport.height) !== null && _visualViewport_height !== void 0 ? _visualViewport_height : documentElement.clientHeight;
|
|
66
94
|
scroll.top = documentElement.scrollTop || containerNode.scrollTop;
|
|
67
95
|
scroll.left = documentElement.scrollLeft || containerNode.scrollLeft;
|
|
68
96
|
} else {
|
|
@@ -106,10 +134,10 @@ function $5935ba4d7da2c103$var$getMargins(node) {
|
|
|
106
134
|
}
|
|
107
135
|
function $5935ba4d7da2c103$var$parsePlacement(input) {
|
|
108
136
|
if ($5935ba4d7da2c103$var$PARSED_PLACEMENT_CACHE[input]) return $5935ba4d7da2c103$var$PARSED_PLACEMENT_CACHE[input];
|
|
109
|
-
let [placement, crossPlacement] = input.split(
|
|
110
|
-
let axis = $5935ba4d7da2c103$var$AXIS[placement] ||
|
|
137
|
+
let [placement, crossPlacement] = input.split(" ");
|
|
138
|
+
let axis = $5935ba4d7da2c103$var$AXIS[placement] || "right";
|
|
111
139
|
let crossAxis = $5935ba4d7da2c103$var$CROSS_AXIS[axis];
|
|
112
|
-
if (!$5935ba4d7da2c103$var$AXIS[crossPlacement]) crossPlacement =
|
|
140
|
+
if (!$5935ba4d7da2c103$var$AXIS[crossPlacement]) crossPlacement = "center";
|
|
113
141
|
let size = $5935ba4d7da2c103$var$AXIS_SIZE[axis];
|
|
114
142
|
let crossSize = $5935ba4d7da2c103$var$AXIS_SIZE[crossAxis];
|
|
115
143
|
$5935ba4d7da2c103$var$PARSED_PLACEMENT_CACHE[input] = {
|
|
@@ -124,11 +152,10 @@ function $5935ba4d7da2c103$var$parsePlacement(input) {
|
|
|
124
152
|
}
|
|
125
153
|
function $5935ba4d7da2c103$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned) {
|
|
126
154
|
let { placement: placement , crossPlacement: crossPlacement , axis: axis , crossAxis: crossAxis , size: size , crossSize: crossSize } = placementInfo;
|
|
127
|
-
let position = {
|
|
128
|
-
};
|
|
155
|
+
let position = {};
|
|
129
156
|
// button position
|
|
130
157
|
position[crossAxis] = childOffset[crossAxis];
|
|
131
|
-
if (crossPlacement ===
|
|
158
|
+
if (crossPlacement === "center") // + (button size / 2) - (overlay size / 2)
|
|
132
159
|
// at this point the overlay center should match the button center
|
|
133
160
|
position[crossAxis] += (childOffset[crossSize] - overlaySize[crossSize]) / 2;
|
|
134
161
|
else if (crossPlacement !== crossAxis) // + (button size) - (overlay size)
|
|
@@ -157,9 +184,13 @@ function $5935ba4d7da2c103$var$computePosition(childOffset, boundaryDimensions,
|
|
|
157
184
|
return position;
|
|
158
185
|
}
|
|
159
186
|
function $5935ba4d7da2c103$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding) {
|
|
160
|
-
return position.top != null ? Math.max(0, boundaryDimensions.height + boundaryDimensions.top + boundaryDimensions.scroll.top
|
|
161
|
-
|
|
162
|
-
)
|
|
187
|
+
return position.top != null ? Math.max(0, boundaryDimensions.height + boundaryDimensions.top + boundaryDimensions.scroll.top // this is the bottom of the boundary
|
|
188
|
+
- (containerOffsetWithBoundary.top + position.top // this is the top of the overlay
|
|
189
|
+
) - (margins.top + margins.bottom + padding // save additional space for margin and padding
|
|
190
|
+
)) : Math.max(0, childOffset.top + containerOffsetWithBoundary.top // this is the top of the trigger
|
|
191
|
+
- (boundaryDimensions.top + boundaryDimensions.scroll.top // this is the top of the boundary
|
|
192
|
+
) - (margins.top + margins.bottom + padding // save additional space for margin and padding
|
|
193
|
+
));
|
|
163
194
|
}
|
|
164
195
|
function $5935ba4d7da2c103$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding, placementInfo) {
|
|
165
196
|
let { placement: placement , axis: axis , size: size } = placementInfo;
|
|
@@ -192,8 +223,7 @@ function $5935ba4d7da2c103$export$6839422d1f33cee9(placementInput, childOffset,
|
|
|
192
223
|
position = $5935ba4d7da2c103$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, normalizedOffset, crossOffset, containerOffsetWithBoundary, isContainerPositioned);
|
|
193
224
|
delta = $5935ba4d7da2c103$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, padding);
|
|
194
225
|
position[crossAxis] += delta;
|
|
195
|
-
let arrowPosition = {
|
|
196
|
-
};
|
|
226
|
+
let arrowPosition = {};
|
|
197
227
|
arrowPosition[crossAxis] = childOffset[crossAxis] - position[crossAxis] + childOffset[crossSize] / 2;
|
|
198
228
|
return {
|
|
199
229
|
position: position,
|
|
@@ -206,9 +236,9 @@ function $5935ba4d7da2c103$export$6839422d1f33cee9(placementInput, childOffset,
|
|
|
206
236
|
function $5935ba4d7da2c103$export$b3ceb0cbf1056d98(opts) {
|
|
207
237
|
let { placement: placement , targetNode: targetNode , overlayNode: overlayNode , scrollNode: scrollNode , padding: padding , shouldFlip: shouldFlip , boundaryElement: boundaryElement , offset: offset , crossOffset: crossOffset , maxHeight: maxHeight } = opts;
|
|
208
238
|
let container = overlayNode instanceof HTMLElement && overlayNode.offsetParent || document.body;
|
|
209
|
-
let isBodyContainer = container.tagName ===
|
|
239
|
+
let isBodyContainer = container.tagName === "BODY";
|
|
210
240
|
const containerPositionStyle = window.getComputedStyle(container).position;
|
|
211
|
-
let isContainerPositioned = !!containerPositionStyle && containerPositionStyle !==
|
|
241
|
+
let isContainerPositioned = !!containerPositionStyle && containerPositionStyle !== "static";
|
|
212
242
|
let childOffset = isBodyContainer ? $5935ba4d7da2c103$var$getOffset(targetNode) : $5935ba4d7da2c103$var$getPosition(targetNode, container);
|
|
213
243
|
if (!isBodyContainer) {
|
|
214
244
|
let { marginTop: marginTop , marginLeft: marginLeft } = window.getComputedStyle(targetNode);
|
|
@@ -221,7 +251,7 @@ function $5935ba4d7da2c103$export$b3ceb0cbf1056d98(opts) {
|
|
|
221
251
|
overlaySize.height += margins.top + margins.bottom;
|
|
222
252
|
let scrollSize = $5935ba4d7da2c103$var$getScroll(scrollNode);
|
|
223
253
|
let boundaryDimensions = $5935ba4d7da2c103$var$getContainerDimensions(boundaryElement);
|
|
224
|
-
let containerOffsetWithBoundary = boundaryElement.tagName ===
|
|
254
|
+
let containerOffsetWithBoundary = boundaryElement.tagName === "BODY" ? $5935ba4d7da2c103$var$getOffset(container) : $5935ba4d7da2c103$var$getPosition(container, boundaryElement);
|
|
225
255
|
return $5935ba4d7da2c103$export$6839422d1f33cee9(placement, childOffset, overlaySize, scrollSize, margins, padding, shouldFlip, boundaryDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, maxHeight);
|
|
226
256
|
}
|
|
227
257
|
function $5935ba4d7da2c103$var$getOffset(node) {
|
|
@@ -237,7 +267,7 @@ function $5935ba4d7da2c103$var$getOffset(node) {
|
|
|
237
267
|
function $5935ba4d7da2c103$var$getPosition(node, parent) {
|
|
238
268
|
let style = window.getComputedStyle(node);
|
|
239
269
|
let offset;
|
|
240
|
-
if (style.position ===
|
|
270
|
+
if (style.position === "fixed") {
|
|
241
271
|
let { top: top , left: left , width: width , height: height } = node.getBoundingClientRect();
|
|
242
272
|
offset = {
|
|
243
273
|
top: top,
|
|
@@ -261,12 +291,22 @@ function $5935ba4d7da2c103$var$getPosition(node, parent) {
|
|
|
261
291
|
|
|
262
292
|
|
|
263
293
|
|
|
264
|
-
|
|
294
|
+
/*
|
|
295
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
296
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
297
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
298
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
299
|
+
*
|
|
300
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
301
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
302
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
303
|
+
* governing permissions and limitations under the License.
|
|
304
|
+
*/
|
|
265
305
|
const $9a8aa1b0b336ea3a$export$f6211563215e3b37 = new WeakMap();
|
|
266
306
|
function $9a8aa1b0b336ea3a$export$18fc8428861184da(opts) {
|
|
267
307
|
let { triggerRef: triggerRef , isOpen: isOpen , onClose: onClose } = opts;
|
|
268
|
-
$6Zb2x$react.useEffect(()=>{
|
|
269
|
-
if (!isOpen) return;
|
|
308
|
+
(0, $6Zb2x$react.useEffect)(()=>{
|
|
309
|
+
if (!isOpen || onClose === null) return;
|
|
270
310
|
let onScroll = (e)=>{
|
|
271
311
|
// Ignore if scrolling an scrollable region outside the trigger's tree.
|
|
272
312
|
let target = e.target;
|
|
@@ -275,9 +315,9 @@ function $9a8aa1b0b336ea3a$export$18fc8428861184da(opts) {
|
|
|
275
315
|
let onCloseHandler = onClose || $9a8aa1b0b336ea3a$export$f6211563215e3b37.get(triggerRef.current);
|
|
276
316
|
if (onCloseHandler) onCloseHandler();
|
|
277
317
|
};
|
|
278
|
-
window.addEventListener(
|
|
318
|
+
window.addEventListener("scroll", onScroll, true);
|
|
279
319
|
return ()=>{
|
|
280
|
-
window.removeEventListener(
|
|
320
|
+
window.removeEventListener("scroll", onScroll, true);
|
|
281
321
|
};
|
|
282
322
|
}, [
|
|
283
323
|
isOpen,
|
|
@@ -290,13 +330,12 @@ function $9a8aa1b0b336ea3a$export$18fc8428861184da(opts) {
|
|
|
290
330
|
|
|
291
331
|
|
|
292
332
|
// @ts-ignore
|
|
293
|
-
let $cd94b4896dd97759$var$visualViewport = typeof window !==
|
|
333
|
+
let $cd94b4896dd97759$var$visualViewport = typeof window !== "undefined" && window.visualViewport;
|
|
294
334
|
function $cd94b4896dd97759$export$d39e1813b3bdd0e1(props) {
|
|
295
|
-
let { direction: direction } = $6Zb2x$reactariai18n.useLocale();
|
|
296
|
-
let { targetRef: targetRef , overlayRef: overlayRef , scrollRef: scrollRef = overlayRef , placement: placement =
|
|
297
|
-
let [position, setPosition] = $6Zb2x$react.useState({
|
|
298
|
-
position: {
|
|
299
|
-
},
|
|
335
|
+
let { direction: direction } = (0, $6Zb2x$reactariai18n.useLocale)();
|
|
336
|
+
let { 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 } = props;
|
|
337
|
+
let [position, setPosition] = (0, $6Zb2x$react.useState)({
|
|
338
|
+
position: {},
|
|
300
339
|
arrowOffsetLeft: undefined,
|
|
301
340
|
arrowOffsetTop: undefined,
|
|
302
341
|
maxHeight: undefined,
|
|
@@ -317,9 +356,9 @@ function $cd94b4896dd97759$export$d39e1813b3bdd0e1(props) {
|
|
|
317
356
|
direction,
|
|
318
357
|
maxHeight
|
|
319
358
|
];
|
|
320
|
-
let updatePosition = $6Zb2x$react.useCallback(()=>{
|
|
359
|
+
let updatePosition = (0, $6Zb2x$react.useCallback)(()=>{
|
|
321
360
|
if (shouldUpdatePosition === false || !isOpen || !overlayRef.current || !targetRef.current || !scrollRef.current || !boundaryElement) return;
|
|
322
|
-
setPosition($5935ba4d7da2c103$export$b3ceb0cbf1056d98({
|
|
361
|
+
setPosition((0, $5935ba4d7da2c103$export$b3ceb0cbf1056d98)({
|
|
323
362
|
placement: $cd94b4896dd97759$var$translateRTL(placement, direction),
|
|
324
363
|
overlayNode: overlayRef.current,
|
|
325
364
|
targetNode: targetRef.current,
|
|
@@ -331,15 +370,22 @@ function $cd94b4896dd97759$export$d39e1813b3bdd0e1(props) {
|
|
|
331
370
|
crossOffset: crossOffset,
|
|
332
371
|
maxHeight: maxHeight
|
|
333
372
|
}));
|
|
373
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
334
374
|
}, deps);
|
|
335
375
|
// Update position when anything changes
|
|
336
|
-
|
|
376
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
377
|
+
(0, $6Zb2x$reactariautils.useLayoutEffect)(updatePosition, deps);
|
|
337
378
|
// Update position on window resize
|
|
338
379
|
$cd94b4896dd97759$var$useResize(updatePosition);
|
|
380
|
+
// Update position when the overlay changes size (might need to flip).
|
|
381
|
+
(0, $6Zb2x$reactariautils.useResizeObserver)({
|
|
382
|
+
ref: overlayRef,
|
|
383
|
+
onResize: updatePosition
|
|
384
|
+
});
|
|
339
385
|
// Reposition the overlay and do not close on scroll while the visual viewport is resizing.
|
|
340
386
|
// This will ensure that overlays adjust their positioning when the iOS virtual keyboard appears.
|
|
341
|
-
let isResizing = $6Zb2x$react.useRef(false);
|
|
342
|
-
$6Zb2x$reactariautils.useLayoutEffect(()=>{
|
|
387
|
+
let isResizing = (0, $6Zb2x$react.useRef)(false);
|
|
388
|
+
(0, $6Zb2x$reactariautils.useLayoutEffect)(()=>{
|
|
343
389
|
let timeout;
|
|
344
390
|
let onResize = ()=>{
|
|
345
391
|
isResizing.current = true;
|
|
@@ -349,14 +395,14 @@ function $cd94b4896dd97759$export$d39e1813b3bdd0e1(props) {
|
|
|
349
395
|
}, 500);
|
|
350
396
|
updatePosition();
|
|
351
397
|
};
|
|
352
|
-
$cd94b4896dd97759$var$visualViewport === null || $cd94b4896dd97759$var$visualViewport === void 0 ? void 0 : $cd94b4896dd97759$var$visualViewport.addEventListener(
|
|
398
|
+
$cd94b4896dd97759$var$visualViewport === null || $cd94b4896dd97759$var$visualViewport === void 0 ? void 0 : $cd94b4896dd97759$var$visualViewport.addEventListener("resize", onResize);
|
|
353
399
|
return ()=>{
|
|
354
|
-
$cd94b4896dd97759$var$visualViewport === null || $cd94b4896dd97759$var$visualViewport === void 0 ? void 0 : $cd94b4896dd97759$var$visualViewport.removeEventListener(
|
|
400
|
+
$cd94b4896dd97759$var$visualViewport === null || $cd94b4896dd97759$var$visualViewport === void 0 ? void 0 : $cd94b4896dd97759$var$visualViewport.removeEventListener("resize", onResize);
|
|
355
401
|
};
|
|
356
402
|
}, [
|
|
357
403
|
updatePosition
|
|
358
404
|
]);
|
|
359
|
-
let close = $6Zb2x$react.useCallback(()=>{
|
|
405
|
+
let close = (0, $6Zb2x$react.useCallback)(()=>{
|
|
360
406
|
if (!isResizing.current) onClose();
|
|
361
407
|
}, [
|
|
362
408
|
onClose,
|
|
@@ -364,15 +410,15 @@ function $cd94b4896dd97759$export$d39e1813b3bdd0e1(props) {
|
|
|
364
410
|
]);
|
|
365
411
|
// When scrolling a parent scrollable region of the trigger (other than the body),
|
|
366
412
|
// we hide the popover. Otherwise, its position would be incorrect.
|
|
367
|
-
$9a8aa1b0b336ea3a$export$18fc8428861184da({
|
|
413
|
+
(0, $9a8aa1b0b336ea3a$export$18fc8428861184da)({
|
|
368
414
|
triggerRef: targetRef,
|
|
369
415
|
isOpen: isOpen,
|
|
370
|
-
onClose: onClose
|
|
416
|
+
onClose: onClose && close
|
|
371
417
|
});
|
|
372
418
|
return {
|
|
373
419
|
overlayProps: {
|
|
374
420
|
style: {
|
|
375
|
-
position:
|
|
421
|
+
position: "absolute",
|
|
376
422
|
zIndex: 100000,
|
|
377
423
|
...position.position,
|
|
378
424
|
maxHeight: position.maxHeight
|
|
@@ -389,28 +435,39 @@ function $cd94b4896dd97759$export$d39e1813b3bdd0e1(props) {
|
|
|
389
435
|
};
|
|
390
436
|
}
|
|
391
437
|
function $cd94b4896dd97759$var$useResize(onResize) {
|
|
392
|
-
$6Zb2x$reactariautils.useLayoutEffect(()=>{
|
|
393
|
-
window.addEventListener(
|
|
438
|
+
(0, $6Zb2x$reactariautils.useLayoutEffect)(()=>{
|
|
439
|
+
window.addEventListener("resize", onResize, false);
|
|
394
440
|
return ()=>{
|
|
395
|
-
window.removeEventListener(
|
|
441
|
+
window.removeEventListener("resize", onResize, false);
|
|
396
442
|
};
|
|
397
443
|
}, [
|
|
398
444
|
onResize
|
|
399
445
|
]);
|
|
400
446
|
}
|
|
401
447
|
function $cd94b4896dd97759$var$translateRTL(position, direction) {
|
|
402
|
-
if (direction ===
|
|
403
|
-
return position.replace(
|
|
448
|
+
if (direction === "rtl") return position.replace("start", "right").replace("end", "left");
|
|
449
|
+
return position.replace("start", "left").replace("end", "right");
|
|
404
450
|
}
|
|
405
451
|
|
|
406
452
|
|
|
453
|
+
/*
|
|
454
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
455
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
456
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
457
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
458
|
+
*
|
|
459
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
460
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
461
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
462
|
+
* governing permissions and limitations under the License.
|
|
463
|
+
*/
|
|
407
464
|
|
|
408
465
|
|
|
409
466
|
const $82711f9cb668ecdb$var$visibleOverlays = [];
|
|
410
467
|
function $82711f9cb668ecdb$export$ea8f71083e90600f(props, ref) {
|
|
411
468
|
let { onClose: onClose , shouldCloseOnBlur: shouldCloseOnBlur , isOpen: isOpen , isDismissable: isDismissable = false , isKeyboardDismissDisabled: isKeyboardDismissDisabled = false , shouldCloseOnInteractOutside: shouldCloseOnInteractOutside } = props;
|
|
412
469
|
// Add the overlay ref to the stack of visible overlays on mount, and remove on unmount.
|
|
413
|
-
$6Zb2x$react.useEffect(()=>{
|
|
470
|
+
(0, $6Zb2x$react.useEffect)(()=>{
|
|
414
471
|
if (isOpen) $82711f9cb668ecdb$var$visibleOverlays.push(ref);
|
|
415
472
|
return ()=>{
|
|
416
473
|
let index = $82711f9cb668ecdb$var$visibleOverlays.indexOf(ref);
|
|
@@ -443,21 +500,25 @@ function $82711f9cb668ecdb$export$ea8f71083e90600f(props, ref) {
|
|
|
443
500
|
};
|
|
444
501
|
// Handle the escape key
|
|
445
502
|
let onKeyDown = (e)=>{
|
|
446
|
-
if (e.key ===
|
|
503
|
+
if (e.key === "Escape" && !isKeyboardDismissDisabled) {
|
|
447
504
|
e.stopPropagation();
|
|
448
505
|
e.preventDefault();
|
|
449
506
|
onHide();
|
|
450
507
|
}
|
|
451
508
|
};
|
|
452
509
|
// Handle clicking outside the overlay to close it
|
|
453
|
-
$6Zb2x$reactariainteractions.useInteractOutside({
|
|
510
|
+
(0, $6Zb2x$reactariainteractions.useInteractOutside)({
|
|
454
511
|
ref: ref,
|
|
455
512
|
onInteractOutside: isDismissable ? onInteractOutside : null,
|
|
456
513
|
onInteractOutsideStart: onInteractOutsideStart
|
|
457
514
|
});
|
|
458
|
-
let { focusWithinProps: focusWithinProps } = $6Zb2x$reactariainteractions.useFocusWithin({
|
|
515
|
+
let { focusWithinProps: focusWithinProps } = (0, $6Zb2x$reactariainteractions.useFocusWithin)({
|
|
459
516
|
isDisabled: !shouldCloseOnBlur,
|
|
460
517
|
onBlurWithin: (e)=>{
|
|
518
|
+
// If focus is moving into a child focus scope (e.g. menu inside a dialog),
|
|
519
|
+
// do not close the outer overlay. At this point, the active scope should
|
|
520
|
+
// still be the outer overlay, since blur events run before focus.
|
|
521
|
+
if (e.relatedTarget && (0, $6Zb2x$reactariafocus.isElementInChildOfActiveScope)(e.relatedTarget)) return;
|
|
461
522
|
if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.relatedTarget)) onClose();
|
|
462
523
|
}
|
|
463
524
|
});
|
|
@@ -477,7 +538,17 @@ function $82711f9cb668ecdb$export$ea8f71083e90600f(props, ref) {
|
|
|
477
538
|
}
|
|
478
539
|
|
|
479
540
|
|
|
480
|
-
|
|
541
|
+
/*
|
|
542
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
543
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
544
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
545
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
546
|
+
*
|
|
547
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
548
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
549
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
550
|
+
* governing permissions and limitations under the License.
|
|
551
|
+
*/
|
|
481
552
|
|
|
482
553
|
|
|
483
554
|
function $b4878eb6316f670a$export$f9d5c8beee7d008d(props, state, ref) {
|
|
@@ -485,22 +556,22 @@ function $b4878eb6316f670a$export$f9d5c8beee7d008d(props, state, ref) {
|
|
|
485
556
|
let { isOpen: isOpen } = state;
|
|
486
557
|
// Backward compatibility. Share state close function with useOverlayPosition so it can close on scroll
|
|
487
558
|
// without forcing users to pass onClose.
|
|
488
|
-
$6Zb2x$react.useEffect(()=>{
|
|
489
|
-
if (ref && ref.current) $9a8aa1b0b336ea3a$export$f6211563215e3b37.set(ref.current, state.close);
|
|
559
|
+
(0, $6Zb2x$react.useEffect)(()=>{
|
|
560
|
+
if (ref && ref.current) (0, $9a8aa1b0b336ea3a$export$f6211563215e3b37).set(ref.current, state.close);
|
|
490
561
|
});
|
|
491
562
|
// Aria 1.1 supports multiple values for aria-haspopup other than just menus.
|
|
492
563
|
// https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup
|
|
493
564
|
// However, we only add it for menus for now because screen readers often
|
|
494
565
|
// announce it as a menu even for other values.
|
|
495
566
|
let ariaHasPopup = undefined;
|
|
496
|
-
if (type ===
|
|
497
|
-
else if (type ===
|
|
498
|
-
let overlayId = $6Zb2x$reactariautils.useId();
|
|
567
|
+
if (type === "menu") ariaHasPopup = true;
|
|
568
|
+
else if (type === "listbox") ariaHasPopup = "listbox";
|
|
569
|
+
let overlayId = (0, $6Zb2x$reactariautils.useId)();
|
|
499
570
|
return {
|
|
500
571
|
triggerProps: {
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
572
|
+
"aria-haspopup": ariaHasPopup,
|
|
573
|
+
"aria-expanded": isOpen,
|
|
574
|
+
"aria-controls": isOpen ? overlayId : null,
|
|
504
575
|
onPress: state.toggle
|
|
505
576
|
},
|
|
506
577
|
overlayProps: {
|
|
@@ -510,28 +581,47 @@ function $b4878eb6316f670a$export$f9d5c8beee7d008d(props, state, ref) {
|
|
|
510
581
|
}
|
|
511
582
|
|
|
512
583
|
|
|
513
|
-
|
|
584
|
+
/*
|
|
585
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
586
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
587
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
588
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
589
|
+
*
|
|
590
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
591
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
592
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
593
|
+
* governing permissions and limitations under the License.
|
|
594
|
+
*/
|
|
514
595
|
// @ts-ignore
|
|
515
|
-
const $5c2f5cd01815d369$var$visualViewport = typeof window !==
|
|
596
|
+
const $5c2f5cd01815d369$var$visualViewport = typeof window !== "undefined" && window.visualViewport;
|
|
516
597
|
// HTML input types that do not cause the software keyboard to appear.
|
|
517
598
|
const $5c2f5cd01815d369$var$nonTextInputTypes = new Set([
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
599
|
+
"checkbox",
|
|
600
|
+
"radio",
|
|
601
|
+
"range",
|
|
602
|
+
"color",
|
|
603
|
+
"file",
|
|
604
|
+
"image",
|
|
605
|
+
"button",
|
|
606
|
+
"submit",
|
|
607
|
+
"reset"
|
|
527
608
|
]);
|
|
528
|
-
|
|
529
|
-
|
|
609
|
+
// The number of active usePreventScroll calls. Used to determine whether to revert back to the original page style/scroll position
|
|
610
|
+
let $5c2f5cd01815d369$var$preventScrollCount = 0;
|
|
611
|
+
let $5c2f5cd01815d369$var$restore;
|
|
612
|
+
function $5c2f5cd01815d369$export$ee0f7cc6afcd1c18(options = {}) {
|
|
530
613
|
let { isDisabled: isDisabled } = options;
|
|
531
|
-
$6Zb2x$reactariautils.useLayoutEffect(()=>{
|
|
614
|
+
(0, $6Zb2x$reactariautils.useLayoutEffect)(()=>{
|
|
532
615
|
if (isDisabled) return;
|
|
533
|
-
|
|
534
|
-
|
|
616
|
+
$5c2f5cd01815d369$var$preventScrollCount++;
|
|
617
|
+
if ($5c2f5cd01815d369$var$preventScrollCount === 1) {
|
|
618
|
+
if ((0, $6Zb2x$reactariautils.isIOS)()) $5c2f5cd01815d369$var$restore = $5c2f5cd01815d369$var$preventScrollMobileSafari();
|
|
619
|
+
else $5c2f5cd01815d369$var$restore = $5c2f5cd01815d369$var$preventScrollStandard();
|
|
620
|
+
}
|
|
621
|
+
return ()=>{
|
|
622
|
+
$5c2f5cd01815d369$var$preventScrollCount--;
|
|
623
|
+
if ($5c2f5cd01815d369$var$preventScrollCount === 0) $5c2f5cd01815d369$var$restore();
|
|
624
|
+
};
|
|
535
625
|
}, [
|
|
536
626
|
isDisabled
|
|
537
627
|
]);
|
|
@@ -539,7 +629,7 @@ function $5c2f5cd01815d369$export$ee0f7cc6afcd1c18(options = {
|
|
|
539
629
|
// For most browsers, all we need to do is set `overflow: hidden` on the root element, and
|
|
540
630
|
// add some padding to prevent the page from shifting when the scrollbar is hidden.
|
|
541
631
|
function $5c2f5cd01815d369$var$preventScrollStandard() {
|
|
542
|
-
return $6Zb2x$reactariautils.chain($5c2f5cd01815d369$var$setStyle(document.documentElement,
|
|
632
|
+
return (0, $6Zb2x$reactariautils.chain)($5c2f5cd01815d369$var$setStyle(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), $5c2f5cd01815d369$var$setStyle(document.documentElement, "overflow", "hidden"));
|
|
543
633
|
}
|
|
544
634
|
// Mobile Safari is a whole different beast. Even with overflow: hidden,
|
|
545
635
|
// it still scrolls the page in many situations:
|
|
@@ -572,7 +662,7 @@ function $5c2f5cd01815d369$var$preventScrollMobileSafari() {
|
|
|
572
662
|
let lastY = 0;
|
|
573
663
|
let onTouchStart = (e)=>{
|
|
574
664
|
// Store the nearest scrollable parent element from the element that the user touched.
|
|
575
|
-
scrollable = $6Zb2x$reactariautils.getScrollParent(e.target);
|
|
665
|
+
scrollable = (0, $6Zb2x$reactariautils.getScrollParent)(e.target);
|
|
576
666
|
if (scrollable === document.documentElement && scrollable === document.body) return;
|
|
577
667
|
lastY = e.changedTouches[0].pageY;
|
|
578
668
|
};
|
|
@@ -600,10 +690,10 @@ function $5c2f5cd01815d369$var$preventScrollMobileSafari() {
|
|
|
600
690
|
// Apply a transform to trick Safari into thinking the input is at the top of the page
|
|
601
691
|
// so it doesn't try to scroll it into view. When tapping on an input, this needs to
|
|
602
692
|
// be done before the "focus" event, so we have to focus the element ourselves.
|
|
603
|
-
target.style.transform =
|
|
693
|
+
target.style.transform = "translateY(-2000px)";
|
|
604
694
|
target.focus();
|
|
605
695
|
requestAnimationFrame(()=>{
|
|
606
|
-
target.style.transform =
|
|
696
|
+
target.style.transform = "";
|
|
607
697
|
});
|
|
608
698
|
}
|
|
609
699
|
};
|
|
@@ -614,9 +704,9 @@ function $5c2f5cd01815d369$var$preventScrollMobileSafari() {
|
|
|
614
704
|
// other than tapping on an input directly, e.g. the next/previous buttons in the
|
|
615
705
|
// software keyboard. In these cases, it seems applying the transform in the focus event
|
|
616
706
|
// is good enough, whereas when tapping an input, it must be done before the focus event. 🤷♂️
|
|
617
|
-
target.style.transform =
|
|
707
|
+
target.style.transform = "translateY(-2000px)";
|
|
618
708
|
requestAnimationFrame(()=>{
|
|
619
|
-
target.style.transform =
|
|
709
|
+
target.style.transform = "";
|
|
620
710
|
// This will have prevented the browser from scrolling the focused element into view,
|
|
621
711
|
// so we need to do this ourselves in a way that doesn't cause the whole page to scroll.
|
|
622
712
|
if ($5c2f5cd01815d369$var$visualViewport) {
|
|
@@ -627,8 +717,7 @@ function $5c2f5cd01815d369$var$preventScrollMobileSafari() {
|
|
|
627
717
|
});
|
|
628
718
|
else // Otherwise, wait for the visual viewport to resize before scrolling so we can
|
|
629
719
|
// measure the correct position to scroll to.
|
|
630
|
-
$5c2f5cd01815d369$var$visualViewport.addEventListener(
|
|
631
|
-
, {
|
|
720
|
+
$5c2f5cd01815d369$var$visualViewport.addEventListener("resize", ()=>$5c2f5cd01815d369$var$scrollIntoView(target), {
|
|
632
721
|
once: true
|
|
633
722
|
});
|
|
634
723
|
}
|
|
@@ -645,19 +734,19 @@ function $5c2f5cd01815d369$var$preventScrollMobileSafari() {
|
|
|
645
734
|
// enable us to scroll the window to the top, which is required for the rest of this to work.
|
|
646
735
|
let scrollX = window.pageXOffset;
|
|
647
736
|
let scrollY = window.pageYOffset;
|
|
648
|
-
let restoreStyles = $6Zb2x$reactariautils.chain($5c2f5cd01815d369$var$setStyle(document.documentElement,
|
|
737
|
+
let restoreStyles = (0, $6Zb2x$reactariautils.chain)($5c2f5cd01815d369$var$setStyle(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), $5c2f5cd01815d369$var$setStyle(document.documentElement, "overflow", "hidden"), $5c2f5cd01815d369$var$setStyle(document.body, "marginTop", `-${scrollY}px`));
|
|
649
738
|
// Scroll to the top. The negative margin on the body will make this appear the same.
|
|
650
739
|
window.scrollTo(0, 0);
|
|
651
|
-
let removeEvents = $6Zb2x$reactariautils.chain($5c2f5cd01815d369$var$addEvent(document,
|
|
740
|
+
let removeEvents = (0, $6Zb2x$reactariautils.chain)($5c2f5cd01815d369$var$addEvent(document, "touchstart", onTouchStart, {
|
|
652
741
|
passive: false,
|
|
653
742
|
capture: true
|
|
654
|
-
}), $5c2f5cd01815d369$var$addEvent(document,
|
|
743
|
+
}), $5c2f5cd01815d369$var$addEvent(document, "touchmove", onTouchMove, {
|
|
655
744
|
passive: false,
|
|
656
745
|
capture: true
|
|
657
|
-
}), $5c2f5cd01815d369$var$addEvent(document,
|
|
746
|
+
}), $5c2f5cd01815d369$var$addEvent(document, "touchend", onTouchEnd, {
|
|
658
747
|
passive: false,
|
|
659
748
|
capture: true
|
|
660
|
-
}), $5c2f5cd01815d369$var$addEvent(document,
|
|
749
|
+
}), $5c2f5cd01815d369$var$addEvent(document, "focus", onFocus, true), $5c2f5cd01815d369$var$addEvent(window, "scroll", onWindowScroll));
|
|
661
750
|
return ()=>{
|
|
662
751
|
// Restore styles and scroll the page back to where it was.
|
|
663
752
|
restoreStyles();
|
|
@@ -684,7 +773,7 @@ function $5c2f5cd01815d369$var$scrollIntoView(target) {
|
|
|
684
773
|
let root = document.scrollingElement || document.documentElement;
|
|
685
774
|
while(target && target !== root){
|
|
686
775
|
// Find the parent scrollable element and adjust the scroll position if the target is not already in view.
|
|
687
|
-
let scrollable = $6Zb2x$reactariautils.getScrollParent(target);
|
|
776
|
+
let scrollable = (0, $6Zb2x$reactariautils.getScrollParent)(target);
|
|
688
777
|
if (scrollable !== document.documentElement && scrollable !== document.body && scrollable !== target) {
|
|
689
778
|
let scrollableTop = scrollable.getBoundingClientRect().top;
|
|
690
779
|
let targetTop = target.getBoundingClientRect().top;
|
|
@@ -698,41 +787,48 @@ function $5c2f5cd01815d369$var$willOpenKeyboard(target) {
|
|
|
698
787
|
}
|
|
699
788
|
|
|
700
789
|
|
|
790
|
+
/*
|
|
791
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
792
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
793
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
794
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
795
|
+
*
|
|
796
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
797
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
798
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
799
|
+
* governing permissions and limitations under the License.
|
|
800
|
+
*/
|
|
701
801
|
|
|
702
802
|
|
|
703
|
-
|
|
704
|
-
const $0775ea8ea6a0565e$var$Context = /*#__PURE__*/ ($parcel$interopDefault($6Zb2x$react)).createContext(null);
|
|
803
|
+
const $0775ea8ea6a0565e$var$Context = /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createContext(null);
|
|
705
804
|
function $0775ea8ea6a0565e$export$178405afcd8c5eb(props) {
|
|
706
805
|
let { children: children } = props;
|
|
707
|
-
let parent = $6Zb2x$react.useContext($0775ea8ea6a0565e$var$Context);
|
|
708
|
-
let [modalCount, setModalCount] = $6Zb2x$react.useState(0);
|
|
709
|
-
let context = $6Zb2x$react.useMemo(()=>({
|
|
806
|
+
let parent = (0, $6Zb2x$react.useContext)($0775ea8ea6a0565e$var$Context);
|
|
807
|
+
let [modalCount, setModalCount] = (0, $6Zb2x$react.useState)(0);
|
|
808
|
+
let context = (0, $6Zb2x$react.useMemo)(()=>({
|
|
710
809
|
parent: parent,
|
|
711
810
|
modalCount: modalCount,
|
|
712
811
|
addModal () {
|
|
713
|
-
setModalCount((count)=>count + 1
|
|
714
|
-
);
|
|
812
|
+
setModalCount((count)=>count + 1);
|
|
715
813
|
if (parent) parent.addModal();
|
|
716
814
|
},
|
|
717
815
|
removeModal () {
|
|
718
|
-
setModalCount((count)=>count - 1
|
|
719
|
-
);
|
|
816
|
+
setModalCount((count)=>count - 1);
|
|
720
817
|
if (parent) parent.removeModal();
|
|
721
818
|
}
|
|
722
|
-
})
|
|
723
|
-
, [
|
|
819
|
+
}), [
|
|
724
820
|
parent,
|
|
725
821
|
modalCount
|
|
726
822
|
]);
|
|
727
|
-
return
|
|
823
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement($0775ea8ea6a0565e$var$Context.Provider, {
|
|
728
824
|
value: context
|
|
729
|
-
}, children)
|
|
825
|
+
}, children);
|
|
730
826
|
}
|
|
731
827
|
function $0775ea8ea6a0565e$export$d9aaed4c3ece1bc0() {
|
|
732
|
-
let context = $6Zb2x$react.useContext($0775ea8ea6a0565e$var$Context);
|
|
828
|
+
let context = (0, $6Zb2x$react.useContext)($0775ea8ea6a0565e$var$Context);
|
|
733
829
|
return {
|
|
734
830
|
modalProviderProps: {
|
|
735
|
-
|
|
831
|
+
"aria-hidden": context && context.modalCount > 0 ? true : null
|
|
736
832
|
}
|
|
737
833
|
};
|
|
738
834
|
}
|
|
@@ -740,32 +836,32 @@ function $0775ea8ea6a0565e$export$d9aaed4c3ece1bc0() {
|
|
|
740
836
|
* Creates a root node that will be aria-hidden if there are other modals open.
|
|
741
837
|
*/ function $0775ea8ea6a0565e$var$OverlayContainerDOM(props) {
|
|
742
838
|
let { modalProviderProps: modalProviderProps } = $0775ea8ea6a0565e$export$d9aaed4c3ece1bc0();
|
|
743
|
-
return
|
|
839
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement("div", {
|
|
744
840
|
"data-overlay-container": true,
|
|
745
841
|
...props,
|
|
746
842
|
...modalProviderProps
|
|
747
|
-
})
|
|
843
|
+
});
|
|
748
844
|
}
|
|
749
845
|
function $0775ea8ea6a0565e$export$bf688221f59024e5(props) {
|
|
750
|
-
return
|
|
846
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement($0775ea8ea6a0565e$export$178405afcd8c5eb, null, /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement($0775ea8ea6a0565e$var$OverlayContainerDOM, props));
|
|
751
847
|
}
|
|
752
848
|
function $0775ea8ea6a0565e$export$b47c3594eab58386(props) {
|
|
753
|
-
let isSSR = $6Zb2x$reactariassr.useIsSSR();
|
|
849
|
+
let isSSR = (0, $6Zb2x$reactariassr.useIsSSR)();
|
|
754
850
|
let { portalContainer: portalContainer = isSSR ? null : document.body , ...rest } = props;
|
|
755
|
-
($parcel$interopDefault($6Zb2x$react)).useEffect(()=>{
|
|
756
|
-
if (portalContainer === null || portalContainer === void 0 ? void 0 : portalContainer.closest(
|
|
851
|
+
(0, ($parcel$interopDefault($6Zb2x$react))).useEffect(()=>{
|
|
852
|
+
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.");
|
|
757
853
|
}, [
|
|
758
854
|
portalContainer
|
|
759
855
|
]);
|
|
760
856
|
if (!portalContainer) return null;
|
|
761
|
-
let contents = /*#__PURE__*/ ($parcel$interopDefault($6Zb2x$react)).createElement($0775ea8ea6a0565e$export$bf688221f59024e5, rest);
|
|
762
|
-
return
|
|
857
|
+
let contents = /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement($0775ea8ea6a0565e$export$bf688221f59024e5, rest);
|
|
858
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$reactdom))).createPortal(contents, portalContainer);
|
|
763
859
|
}
|
|
764
860
|
function $0775ea8ea6a0565e$export$33ffd74ebf07f060(options) {
|
|
765
861
|
// Add aria-hidden to all parent providers on mount, and restore on unmount.
|
|
766
|
-
let context = $6Zb2x$react.useContext($0775ea8ea6a0565e$var$Context);
|
|
767
|
-
if (!context) throw new Error(
|
|
768
|
-
$6Zb2x$react.useEffect(()=>{
|
|
862
|
+
let context = (0, $6Zb2x$react.useContext)($0775ea8ea6a0565e$var$Context);
|
|
863
|
+
if (!context) throw new Error("Modal is not contained within a provider");
|
|
864
|
+
(0, $6Zb2x$react.useEffect)(()=>{
|
|
769
865
|
if ((options === null || options === void 0 ? void 0 : options.isDisabled) || !context || !context.parent) return;
|
|
770
866
|
// The immediate context is from the provider containing this modal, so we only
|
|
771
867
|
// want to trigger aria-hidden on its parents not on the modal provider itself.
|
|
@@ -780,13 +876,23 @@ function $0775ea8ea6a0565e$export$33ffd74ebf07f060(options) {
|
|
|
780
876
|
]);
|
|
781
877
|
return {
|
|
782
878
|
modalProps: {
|
|
783
|
-
|
|
879
|
+
"data-ismodal": !(options === null || options === void 0 ? void 0 : options.isDisabled)
|
|
784
880
|
}
|
|
785
881
|
};
|
|
786
882
|
}
|
|
787
883
|
|
|
788
884
|
|
|
789
|
-
|
|
885
|
+
/*
|
|
886
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
887
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
888
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
889
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
890
|
+
*
|
|
891
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
892
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
893
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
894
|
+
* governing permissions and limitations under the License.
|
|
895
|
+
*/ var $18d014414048a7ba$exports = {};
|
|
790
896
|
var $4393d9b86d3ad278$exports = {};
|
|
791
897
|
$4393d9b86d3ad278$exports = {
|
|
792
898
|
"dismiss": `تجاهل`
|
|
@@ -1035,16 +1141,16 @@ $18d014414048a7ba$exports = {
|
|
|
1035
1141
|
|
|
1036
1142
|
function $f69bb3e6457495cc$export$2317d149ed6f78c4(props) {
|
|
1037
1143
|
let { onDismiss: onDismiss , ...otherProps } = props;
|
|
1038
|
-
let stringFormatter = $6Zb2x$reactariai18n.useLocalizedStringFormatter((/*@__PURE__*/$parcel$interopDefault($18d014414048a7ba$exports)));
|
|
1039
|
-
let labels = $6Zb2x$reactariautils.useLabels(otherProps, stringFormatter.format(
|
|
1144
|
+
let stringFormatter = (0, $6Zb2x$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($18d014414048a7ba$exports))));
|
|
1145
|
+
let labels = (0, $6Zb2x$reactariautils.useLabels)(otherProps, stringFormatter.format("dismiss"));
|
|
1040
1146
|
let onClick = ()=>{
|
|
1041
1147
|
if (onDismiss) onDismiss();
|
|
1042
1148
|
};
|
|
1043
|
-
return
|
|
1149
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement((0, $6Zb2x$reactariavisuallyhidden.VisuallyHidden), null, /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement("button", {
|
|
1044
1150
|
...labels,
|
|
1045
1151
|
tabIndex: -1,
|
|
1046
1152
|
onClick: onClick
|
|
1047
|
-
}))
|
|
1153
|
+
}));
|
|
1048
1154
|
}
|
|
1049
1155
|
|
|
1050
1156
|
|
|
@@ -1061,51 +1167,53 @@ function $f69bb3e6457495cc$export$2317d149ed6f78c4(props) {
|
|
|
1061
1167
|
*/ // Keeps a ref count of all hidden elements. Added to when hiding an element, and
|
|
1062
1168
|
// subtracted from when showing it again. When it reaches zero, aria-hidden is removed.
|
|
1063
1169
|
let $08ef1685902b6011$var$refCountMap = new WeakMap();
|
|
1170
|
+
let $08ef1685902b6011$var$observerStack = [];
|
|
1064
1171
|
function $08ef1685902b6011$export$1c3ebcada18427bf(targets, root = document.body) {
|
|
1065
1172
|
let visibleNodes = new Set(targets);
|
|
1066
1173
|
let hiddenNodes = new Set();
|
|
1067
1174
|
let walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
|
|
1068
1175
|
acceptNode (node) {
|
|
1069
1176
|
// If this node is a live announcer, add it to the set of nodes to keep visible.
|
|
1070
|
-
if ((node instanceof HTMLElement || node instanceof SVGElement) && node.dataset.liveAnnouncer ===
|
|
1177
|
+
if ((node instanceof HTMLElement || node instanceof SVGElement) && node.dataset.liveAnnouncer === "true") visibleNodes.add(node);
|
|
1071
1178
|
// Skip this node and its children if it is one of the target nodes, or a live announcer.
|
|
1072
1179
|
// Also skip children of already hidden nodes, as aria-hidden is recursive. An exception is
|
|
1073
1180
|
// made for elements with role="row" since VoiceOver on iOS has issues hiding elements with role="row".
|
|
1074
1181
|
// For that case we want to hide the cells inside as well (https://bugs.webkit.org/show_bug.cgi?id=222623).
|
|
1075
|
-
if (visibleNodes.has(node) || hiddenNodes.has(node.parentElement) && node.parentElement.getAttribute(
|
|
1182
|
+
if (visibleNodes.has(node) || hiddenNodes.has(node.parentElement) && node.parentElement.getAttribute("role") !== "row") return NodeFilter.FILTER_REJECT;
|
|
1076
1183
|
// Skip this node but continue to children if one of the targets is inside the node.
|
|
1077
|
-
if (targets.some((target)=>node.contains(target)
|
|
1078
|
-
)) return NodeFilter.FILTER_SKIP;
|
|
1184
|
+
if (targets.some((target)=>node.contains(target))) return NodeFilter.FILTER_SKIP;
|
|
1079
1185
|
return NodeFilter.FILTER_ACCEPT;
|
|
1080
1186
|
}
|
|
1081
1187
|
});
|
|
1082
1188
|
let hide = (node)=>{
|
|
1083
|
-
var
|
|
1084
|
-
let refCount = (
|
|
1189
|
+
var _refCountMap_get;
|
|
1190
|
+
let refCount = (_refCountMap_get = $08ef1685902b6011$var$refCountMap.get(node)) !== null && _refCountMap_get !== void 0 ? _refCountMap_get : 0;
|
|
1085
1191
|
// If already aria-hidden, and the ref count is zero, then this element
|
|
1086
1192
|
// was already hidden and there's nothing for us to do.
|
|
1087
|
-
if (node.getAttribute(
|
|
1088
|
-
if (refCount === 0) node.setAttribute(
|
|
1193
|
+
if (node.getAttribute("aria-hidden") === "true" && refCount === 0) return;
|
|
1194
|
+
if (refCount === 0) node.setAttribute("aria-hidden", "true");
|
|
1089
1195
|
hiddenNodes.add(node);
|
|
1090
1196
|
$08ef1685902b6011$var$refCountMap.set(node, refCount + 1);
|
|
1091
1197
|
};
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1198
|
+
// If there is already a MutationObserver listening from a previous call,
|
|
1199
|
+
// disconnect it so the new on takes over.
|
|
1200
|
+
if ($08ef1685902b6011$var$observerStack.length) $08ef1685902b6011$var$observerStack[$08ef1685902b6011$var$observerStack.length - 1].disconnect();
|
|
1201
|
+
let node = walker.nextNode();
|
|
1202
|
+
while(node != null){
|
|
1203
|
+
hide(node);
|
|
1204
|
+
node = walker.nextNode();
|
|
1096
1205
|
}
|
|
1097
1206
|
let observer = new MutationObserver((changes)=>{
|
|
1098
1207
|
for (let change of changes){
|
|
1099
|
-
if (change.type !==
|
|
1208
|
+
if (change.type !== "childList" || change.addedNodes.length === 0) continue;
|
|
1100
1209
|
// If the parent element of the added nodes is not within one of the targets,
|
|
1101
1210
|
// and not already inside a hidden node, hide all of the new children.
|
|
1102
1211
|
if (![
|
|
1103
1212
|
...visibleNodes,
|
|
1104
1213
|
...hiddenNodes
|
|
1105
|
-
].some((node)=>node.contains(change.target)
|
|
1106
|
-
|
|
1107
|
-
if (
|
|
1108
|
-
else if (node2 instanceof Element) hide(node2);
|
|
1214
|
+
].some((node)=>node.contains(change.target))) for (let node of change.addedNodes){
|
|
1215
|
+
if ((node instanceof HTMLElement || node instanceof SVGElement) && node.dataset.liveAnnouncer === "true") visibleNodes.add(node);
|
|
1216
|
+
else if (node instanceof Element) hide(node);
|
|
1109
1217
|
}
|
|
1110
1218
|
}
|
|
1111
1219
|
});
|
|
@@ -1113,40 +1221,83 @@ function $08ef1685902b6011$export$1c3ebcada18427bf(targets, root = document.body
|
|
|
1113
1221
|
childList: true,
|
|
1114
1222
|
subtree: true
|
|
1115
1223
|
});
|
|
1224
|
+
let observerWrapper = {
|
|
1225
|
+
observe () {
|
|
1226
|
+
observer.observe(root, {
|
|
1227
|
+
childList: true,
|
|
1228
|
+
subtree: true
|
|
1229
|
+
});
|
|
1230
|
+
},
|
|
1231
|
+
disconnect () {
|
|
1232
|
+
observer.disconnect();
|
|
1233
|
+
}
|
|
1234
|
+
};
|
|
1235
|
+
$08ef1685902b6011$var$observerStack.push(observerWrapper);
|
|
1116
1236
|
return ()=>{
|
|
1117
1237
|
observer.disconnect();
|
|
1118
1238
|
for (let node of hiddenNodes){
|
|
1119
1239
|
let count = $08ef1685902b6011$var$refCountMap.get(node);
|
|
1120
1240
|
if (count === 1) {
|
|
1121
|
-
node.removeAttribute(
|
|
1241
|
+
node.removeAttribute("aria-hidden");
|
|
1122
1242
|
$08ef1685902b6011$var$refCountMap.delete(node);
|
|
1123
1243
|
} else $08ef1685902b6011$var$refCountMap.set(node, count - 1);
|
|
1124
1244
|
}
|
|
1245
|
+
// Remove this observer from the stack, and start the previous one.
|
|
1246
|
+
if (observerWrapper === $08ef1685902b6011$var$observerStack[$08ef1685902b6011$var$observerStack.length - 1]) {
|
|
1247
|
+
$08ef1685902b6011$var$observerStack.pop();
|
|
1248
|
+
if ($08ef1685902b6011$var$observerStack.length) $08ef1685902b6011$var$observerStack[$08ef1685902b6011$var$observerStack.length - 1].observe();
|
|
1249
|
+
} else $08ef1685902b6011$var$observerStack.splice($08ef1685902b6011$var$observerStack.indexOf(observerWrapper), 1);
|
|
1125
1250
|
};
|
|
1126
1251
|
}
|
|
1127
1252
|
|
|
1128
1253
|
|
|
1254
|
+
/*
|
|
1255
|
+
* Copyright 2022 Adobe. All rights reserved.
|
|
1256
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
1257
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
1258
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
1259
|
+
*
|
|
1260
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
1261
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
1262
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
1263
|
+
* governing permissions and limitations under the License.
|
|
1264
|
+
*/
|
|
1129
1265
|
|
|
1130
1266
|
|
|
1131
1267
|
|
|
1132
1268
|
|
|
1133
1269
|
|
|
1134
1270
|
function $6c2dfcdee3e15e20$export$542a6fd13ac93354(props, state) {
|
|
1135
|
-
let { triggerRef: triggerRef , popoverRef: popoverRef , isNonModal: isNonModal , ...otherProps } = props;
|
|
1136
|
-
let { overlayProps: overlayProps } = $82711f9cb668ecdb$export$ea8f71083e90600f({
|
|
1271
|
+
let { triggerRef: triggerRef , popoverRef: popoverRef , isNonModal: isNonModal , isKeyboardDismissDisabled: isKeyboardDismissDisabled , ...otherProps } = props;
|
|
1272
|
+
let { overlayProps: overlayProps , underlayProps: underlayProps } = (0, $82711f9cb668ecdb$export$ea8f71083e90600f)({
|
|
1137
1273
|
isOpen: state.isOpen,
|
|
1138
1274
|
onClose: state.close,
|
|
1139
1275
|
shouldCloseOnBlur: true,
|
|
1140
|
-
isDismissable:
|
|
1276
|
+
isDismissable: !isNonModal,
|
|
1277
|
+
isKeyboardDismissDisabled: isKeyboardDismissDisabled
|
|
1141
1278
|
}, popoverRef);
|
|
1142
|
-
let { overlayProps: positionProps , arrowProps: arrowProps } = $cd94b4896dd97759$export$d39e1813b3bdd0e1({
|
|
1279
|
+
let { overlayProps: positionProps , arrowProps: arrowProps , placement: placement } = (0, $cd94b4896dd97759$export$d39e1813b3bdd0e1)({
|
|
1143
1280
|
...otherProps,
|
|
1144
1281
|
targetRef: triggerRef,
|
|
1145
1282
|
overlayRef: popoverRef,
|
|
1146
|
-
isOpen: state.isOpen
|
|
1283
|
+
isOpen: state.isOpen,
|
|
1284
|
+
onClose: null
|
|
1285
|
+
});
|
|
1286
|
+
// Delay preventing scroll until popover is positioned to avoid extra scroll padding.
|
|
1287
|
+
// This requires a layout effect so that positioning has been committed to the DOM
|
|
1288
|
+
// by the time usePreventScroll measures the element.
|
|
1289
|
+
let [isPositioned, setPositioned] = (0, $6Zb2x$react.useState)(false);
|
|
1290
|
+
(0, $6Zb2x$reactariautils.useLayoutEffect)(()=>{
|
|
1291
|
+
if (!isNonModal && placement) setPositioned(true);
|
|
1292
|
+
}, [
|
|
1293
|
+
isNonModal,
|
|
1294
|
+
placement
|
|
1295
|
+
]);
|
|
1296
|
+
(0, $5c2f5cd01815d369$export$ee0f7cc6afcd1c18)({
|
|
1297
|
+
isDisabled: isNonModal || !isPositioned
|
|
1147
1298
|
});
|
|
1148
|
-
$6Zb2x$
|
|
1149
|
-
if (state.isOpen && !isNonModal) return $08ef1685902b6011$export$1c3ebcada18427bf([
|
|
1299
|
+
(0, $6Zb2x$reactariautils.useLayoutEffect)(()=>{
|
|
1300
|
+
if (state.isOpen && !isNonModal && popoverRef.current) return (0, $08ef1685902b6011$export$1c3ebcada18427bf)([
|
|
1150
1301
|
popoverRef.current
|
|
1151
1302
|
]);
|
|
1152
1303
|
}, [
|
|
@@ -1155,38 +1306,68 @@ function $6c2dfcdee3e15e20$export$542a6fd13ac93354(props, state) {
|
|
|
1155
1306
|
popoverRef
|
|
1156
1307
|
]);
|
|
1157
1308
|
return {
|
|
1158
|
-
popoverProps: $6Zb2x$reactariautils.mergeProps(overlayProps, positionProps),
|
|
1159
|
-
arrowProps: arrowProps
|
|
1309
|
+
popoverProps: (0, $6Zb2x$reactariautils.mergeProps)(overlayProps, positionProps),
|
|
1310
|
+
arrowProps: arrowProps,
|
|
1311
|
+
underlayProps: underlayProps,
|
|
1312
|
+
placement: placement
|
|
1160
1313
|
};
|
|
1161
1314
|
}
|
|
1162
1315
|
|
|
1163
1316
|
|
|
1317
|
+
/*
|
|
1318
|
+
* Copyright 2022 Adobe. All rights reserved.
|
|
1319
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
1320
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
1321
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
1322
|
+
*
|
|
1323
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
1324
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
1325
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
1326
|
+
* governing permissions and limitations under the License.
|
|
1327
|
+
*/
|
|
1164
1328
|
|
|
1165
1329
|
|
|
1166
1330
|
|
|
1331
|
+
/*
|
|
1332
|
+
* Copyright 2022 Adobe. All rights reserved.
|
|
1333
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
1334
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
1335
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
1336
|
+
*
|
|
1337
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
1338
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
1339
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
1340
|
+
* governing permissions and limitations under the License.
|
|
1341
|
+
*/
|
|
1167
1342
|
|
|
1168
1343
|
|
|
1169
1344
|
|
|
1170
1345
|
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
const $745edbb83ab4296f$var$OverlayContext = /*#__PURE__*/ ($parcel$interopDefault($6Zb2x$react)).createContext(null);
|
|
1346
|
+
const $745edbb83ab4296f$export$a2200b96afd16271 = /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createContext(null);
|
|
1174
1347
|
function $745edbb83ab4296f$export$c6fdb837b070b4ff(props) {
|
|
1175
|
-
let isSSR = $6Zb2x$reactariassr.useIsSSR();
|
|
1348
|
+
let isSSR = (0, $6Zb2x$reactariassr.useIsSSR)();
|
|
1176
1349
|
let { portalContainer: portalContainer = isSSR ? null : document.body } = props;
|
|
1177
|
-
let [contain, setContain] = $6Zb2x$react.useState(false);
|
|
1350
|
+
let [contain, setContain] = (0, $6Zb2x$react.useState)(false);
|
|
1351
|
+
let contextValue = (0, $6Zb2x$react.useMemo)(()=>({
|
|
1352
|
+
contain: contain,
|
|
1353
|
+
setContain: setContain
|
|
1354
|
+
}), [
|
|
1355
|
+
contain,
|
|
1356
|
+
setContain
|
|
1357
|
+
]);
|
|
1178
1358
|
if (!portalContainer) return null;
|
|
1179
|
-
let contents = /*#__PURE__*/ ($parcel$interopDefault($6Zb2x$react)).createElement($745edbb83ab4296f$
|
|
1180
|
-
value:
|
|
1181
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($6Zb2x$react)).createElement($6Zb2x$reactariafocus.FocusScope, {
|
|
1359
|
+
let contents = /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement($745edbb83ab4296f$export$a2200b96afd16271.Provider, {
|
|
1360
|
+
value: contextValue
|
|
1361
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement((0, $6Zb2x$reactariafocus.FocusScope), {
|
|
1182
1362
|
restoreFocus: true,
|
|
1183
1363
|
contain: contain
|
|
1184
1364
|
}, props.children));
|
|
1185
|
-
return
|
|
1365
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$reactdom))).createPortal(contents, portalContainer);
|
|
1186
1366
|
}
|
|
1187
1367
|
function $745edbb83ab4296f$export$14c98a7594375490() {
|
|
1188
|
-
let
|
|
1189
|
-
|
|
1368
|
+
let ctx = (0, $6Zb2x$react.useContext)($745edbb83ab4296f$export$a2200b96afd16271);
|
|
1369
|
+
let setContain = ctx === null || ctx === void 0 ? void 0 : ctx.setContain;
|
|
1370
|
+
(0, $6Zb2x$reactariautils.useLayoutEffect)(()=>{
|
|
1190
1371
|
setContain === null || setContain === void 0 ? void 0 : setContain(true);
|
|
1191
1372
|
}, [
|
|
1192
1373
|
setContain
|
|
@@ -1196,17 +1377,17 @@ function $745edbb83ab4296f$export$14c98a7594375490() {
|
|
|
1196
1377
|
|
|
1197
1378
|
|
|
1198
1379
|
function $11b7e0b04b421e95$export$dbc0f175b25fb0fb(props, state, ref) {
|
|
1199
|
-
let { overlayProps: overlayProps , underlayProps: underlayProps } = $82711f9cb668ecdb$export$ea8f71083e90600f({
|
|
1380
|
+
let { overlayProps: overlayProps , underlayProps: underlayProps } = (0, $82711f9cb668ecdb$export$ea8f71083e90600f)({
|
|
1200
1381
|
...props,
|
|
1201
1382
|
isOpen: state.isOpen,
|
|
1202
1383
|
onClose: state.close
|
|
1203
1384
|
}, ref);
|
|
1204
|
-
$5c2f5cd01815d369$export$ee0f7cc6afcd1c18({
|
|
1385
|
+
(0, $5c2f5cd01815d369$export$ee0f7cc6afcd1c18)({
|
|
1205
1386
|
isDisabled: !state.isOpen
|
|
1206
1387
|
});
|
|
1207
|
-
$745edbb83ab4296f$export$14c98a7594375490();
|
|
1208
|
-
$6Zb2x$react.useEffect(()=>{
|
|
1209
|
-
if (state.isOpen) return $08ef1685902b6011$export$1c3ebcada18427bf([
|
|
1388
|
+
(0, $745edbb83ab4296f$export$14c98a7594375490)();
|
|
1389
|
+
(0, $6Zb2x$react.useEffect)(()=>{
|
|
1390
|
+
if (state.isOpen) return (0, $08ef1685902b6011$export$1c3ebcada18427bf)([
|
|
1210
1391
|
ref.current
|
|
1211
1392
|
]);
|
|
1212
1393
|
}, [
|
|
@@ -1214,7 +1395,7 @@ function $11b7e0b04b421e95$export$dbc0f175b25fb0fb(props, state, ref) {
|
|
|
1214
1395
|
ref
|
|
1215
1396
|
]);
|
|
1216
1397
|
return {
|
|
1217
|
-
modalProps: $6Zb2x$reactariautils.mergeProps(overlayProps),
|
|
1398
|
+
modalProps: (0, $6Zb2x$reactariautils.mergeProps)(overlayProps),
|
|
1218
1399
|
underlayProps: underlayProps
|
|
1219
1400
|
};
|
|
1220
1401
|
}
|