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