@react-aria/overlays 3.12.0 → 3.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -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
- const $5935ba4d7da2c103$var$AXIS = {
33
- top: 'top',
34
- bottom: 'top',
35
- left: 'left',
36
- right: 'left'
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: 'bottom',
40
- bottom: 'top',
41
- left: 'right',
42
- right: 'left'
69
+ top: "bottom",
70
+ bottom: "top",
71
+ left: "right",
72
+ right: "left"
43
73
  };
44
74
  const $5935ba4d7da2c103$var$CROSS_AXIS = {
45
- top: 'left',
46
- left: 'top'
75
+ top: "left",
76
+ left: "top"
47
77
  };
48
78
  const $5935ba4d7da2c103$var$AXIS_SIZE = {
49
- top: 'height',
50
- left: 'width'
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 !== 'undefined' && window.visualViewport;
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 ref;
63
- width = (ref = $5935ba4d7da2c103$var$visualViewport === null || $5935ba4d7da2c103$var$visualViewport === void 0 ? void 0 : $5935ba4d7da2c103$var$visualViewport.width) !== null && ref !== void 0 ? ref : documentElement.clientWidth;
64
- var ref1;
65
- height = (ref1 = $5935ba4d7da2c103$var$visualViewport === null || $5935ba4d7da2c103$var$visualViewport === void 0 ? void 0 : $5935ba4d7da2c103$var$visualViewport.height) !== null && ref1 !== void 0 ? ref1 : documentElement.clientHeight;
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] || 'right';
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 = 'center';
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 === 'center') // + (button size / 2) - (overlay size / 2)
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 - (containerOffsetWithBoundary.top + position.top) - (margins.top + margins.bottom + padding) // save additional space for margin and padding
161
- ) : Math.max(0, childOffset.top + containerOffsetWithBoundary.top - (boundaryDimensions.top + boundaryDimensions.scroll.top) - (margins.top + margins.bottom + padding) // save additional space for margin and padding
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 === 'BODY';
239
+ let isBodyContainer = container.tagName === "BODY";
210
240
  const containerPositionStyle = window.getComputedStyle(container).position;
211
- let isContainerPositioned = !!containerPositionStyle && containerPositionStyle !== 'static';
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 === 'BODY' ? $5935ba4d7da2c103$var$getOffset(container) : $5935ba4d7da2c103$var$getPosition(container, boundaryElement);
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 === 'fixed') {
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,11 +291,21 @@ 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(()=>{
308
+ (0, $6Zb2x$react.useEffect)(()=>{
269
309
  if (!isOpen || onClose === null) return;
270
310
  let onScroll = (e)=>{
271
311
  // Ignore if scrolling an scrollable region outside the trigger's tree.
@@ -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('scroll', onScroll, true);
318
+ window.addEventListener("scroll", onScroll, true);
279
319
  return ()=>{
280
- window.removeEventListener('scroll', onScroll, true);
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 !== 'undefined' && window.visualViewport;
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 = '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;
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
+ let position = (0, $5935ba4d7da2c103$export$b3ceb0cbf1056d98)({
323
362
  placement: $cd94b4896dd97759$var$translateRTL(placement, direction),
324
363
  overlayNode: overlayRef.current,
325
364
  targetNode: targetRef.current,
@@ -330,23 +369,29 @@ function $cd94b4896dd97759$export$d39e1813b3bdd0e1(props) {
330
369
  offset: offset,
331
370
  crossOffset: crossOffset,
332
371
  maxHeight: maxHeight
333
- }));
372
+ });
373
+ // Modify overlay styles directly so positioning happens immediately without the need of a second render
374
+ // This is so we don't have to delay autoFocus scrolling or delay applying preventScroll for popovers
375
+ Object.keys(position.position).forEach((key)=>overlayRef.current.style[key] = position.position[key] + "px");
376
+ overlayRef.current.style.maxHeight = position.maxHeight != null ? position.maxHeight + "px" : undefined;
377
+ // Trigger a set state for a second render anyway for arrow positioning
378
+ setPosition(position);
334
379
  // eslint-disable-next-line react-hooks/exhaustive-deps
335
380
  }, deps);
336
381
  // Update position when anything changes
337
382
  // eslint-disable-next-line react-hooks/exhaustive-deps
338
- $6Zb2x$reactariautils.useLayoutEffect(updatePosition, deps);
383
+ (0, $6Zb2x$reactariautils.useLayoutEffect)(updatePosition, deps);
339
384
  // Update position on window resize
340
385
  $cd94b4896dd97759$var$useResize(updatePosition);
341
386
  // Update position when the overlay changes size (might need to flip).
342
- $6Zb2x$reactariautils.useResizeObserver({
387
+ (0, $6Zb2x$reactariautils.useResizeObserver)({
343
388
  ref: overlayRef,
344
389
  onResize: updatePosition
345
390
  });
346
391
  // Reposition the overlay and do not close on scroll while the visual viewport is resizing.
347
392
  // This will ensure that overlays adjust their positioning when the iOS virtual keyboard appears.
348
- let isResizing = $6Zb2x$react.useRef(false);
349
- $6Zb2x$reactariautils.useLayoutEffect(()=>{
393
+ let isResizing = (0, $6Zb2x$react.useRef)(false);
394
+ (0, $6Zb2x$reactariautils.useLayoutEffect)(()=>{
350
395
  let timeout;
351
396
  let onResize = ()=>{
352
397
  isResizing.current = true;
@@ -356,14 +401,14 @@ function $cd94b4896dd97759$export$d39e1813b3bdd0e1(props) {
356
401
  }, 500);
357
402
  updatePosition();
358
403
  };
359
- $cd94b4896dd97759$var$visualViewport === null || $cd94b4896dd97759$var$visualViewport === void 0 ? void 0 : $cd94b4896dd97759$var$visualViewport.addEventListener('resize', onResize);
404
+ $cd94b4896dd97759$var$visualViewport === null || $cd94b4896dd97759$var$visualViewport === void 0 ? void 0 : $cd94b4896dd97759$var$visualViewport.addEventListener("resize", onResize);
360
405
  return ()=>{
361
- $cd94b4896dd97759$var$visualViewport === null || $cd94b4896dd97759$var$visualViewport === void 0 ? void 0 : $cd94b4896dd97759$var$visualViewport.removeEventListener('resize', onResize);
406
+ $cd94b4896dd97759$var$visualViewport === null || $cd94b4896dd97759$var$visualViewport === void 0 ? void 0 : $cd94b4896dd97759$var$visualViewport.removeEventListener("resize", onResize);
362
407
  };
363
408
  }, [
364
409
  updatePosition
365
410
  ]);
366
- let close = $6Zb2x$react.useCallback(()=>{
411
+ let close = (0, $6Zb2x$react.useCallback)(()=>{
367
412
  if (!isResizing.current) onClose();
368
413
  }, [
369
414
  onClose,
@@ -371,7 +416,7 @@ function $cd94b4896dd97759$export$d39e1813b3bdd0e1(props) {
371
416
  ]);
372
417
  // When scrolling a parent scrollable region of the trigger (other than the body),
373
418
  // we hide the popover. Otherwise, its position would be incorrect.
374
- $9a8aa1b0b336ea3a$export$18fc8428861184da({
419
+ (0, $9a8aa1b0b336ea3a$export$18fc8428861184da)({
375
420
  triggerRef: targetRef,
376
421
  isOpen: isOpen,
377
422
  onClose: onClose && close
@@ -379,7 +424,7 @@ function $cd94b4896dd97759$export$d39e1813b3bdd0e1(props) {
379
424
  return {
380
425
  overlayProps: {
381
426
  style: {
382
- position: 'absolute',
427
+ position: "absolute",
383
428
  zIndex: 100000,
384
429
  ...position.position,
385
430
  maxHeight: position.maxHeight
@@ -396,29 +441,39 @@ function $cd94b4896dd97759$export$d39e1813b3bdd0e1(props) {
396
441
  };
397
442
  }
398
443
  function $cd94b4896dd97759$var$useResize(onResize) {
399
- $6Zb2x$reactariautils.useLayoutEffect(()=>{
400
- window.addEventListener('resize', onResize, false);
444
+ (0, $6Zb2x$reactariautils.useLayoutEffect)(()=>{
445
+ window.addEventListener("resize", onResize, false);
401
446
  return ()=>{
402
- window.removeEventListener('resize', onResize, false);
447
+ window.removeEventListener("resize", onResize, false);
403
448
  };
404
449
  }, [
405
450
  onResize
406
451
  ]);
407
452
  }
408
453
  function $cd94b4896dd97759$var$translateRTL(position, direction) {
409
- if (direction === 'rtl') return position.replace('start', 'right').replace('end', 'left');
410
- return position.replace('start', 'left').replace('end', 'right');
454
+ if (direction === "rtl") return position.replace("start", "right").replace("end", "left");
455
+ return position.replace("start", "left").replace("end", "right");
411
456
  }
412
457
 
413
458
 
414
-
459
+ /*
460
+ * Copyright 2020 Adobe. All rights reserved.
461
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
462
+ * you may not use this file except in compliance with the License. You may obtain a copy
463
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
464
+ *
465
+ * Unless required by applicable law or agreed to in writing, software distributed under
466
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
467
+ * OF ANY KIND, either express or implied. See the License for the specific language
468
+ * governing permissions and limitations under the License.
469
+ */
415
470
 
416
471
 
417
472
  const $82711f9cb668ecdb$var$visibleOverlays = [];
418
473
  function $82711f9cb668ecdb$export$ea8f71083e90600f(props, ref) {
419
474
  let { onClose: onClose , shouldCloseOnBlur: shouldCloseOnBlur , isOpen: isOpen , isDismissable: isDismissable = false , isKeyboardDismissDisabled: isKeyboardDismissDisabled = false , shouldCloseOnInteractOutside: shouldCloseOnInteractOutside } = props;
420
475
  // Add the overlay ref to the stack of visible overlays on mount, and remove on unmount.
421
- $6Zb2x$react.useEffect(()=>{
476
+ (0, $6Zb2x$react.useEffect)(()=>{
422
477
  if (isOpen) $82711f9cb668ecdb$var$visibleOverlays.push(ref);
423
478
  return ()=>{
424
479
  let index = $82711f9cb668ecdb$var$visibleOverlays.indexOf(ref);
@@ -451,25 +506,25 @@ function $82711f9cb668ecdb$export$ea8f71083e90600f(props, ref) {
451
506
  };
452
507
  // Handle the escape key
453
508
  let onKeyDown = (e)=>{
454
- if (e.key === 'Escape' && !isKeyboardDismissDisabled) {
509
+ if (e.key === "Escape" && !isKeyboardDismissDisabled) {
455
510
  e.stopPropagation();
456
511
  e.preventDefault();
457
512
  onHide();
458
513
  }
459
514
  };
460
515
  // Handle clicking outside the overlay to close it
461
- $6Zb2x$reactariainteractions.useInteractOutside({
516
+ (0, $6Zb2x$reactariainteractions.useInteractOutside)({
462
517
  ref: ref,
463
518
  onInteractOutside: isDismissable ? onInteractOutside : null,
464
519
  onInteractOutsideStart: onInteractOutsideStart
465
520
  });
466
- let { focusWithinProps: focusWithinProps } = $6Zb2x$reactariainteractions.useFocusWithin({
521
+ let { focusWithinProps: focusWithinProps } = (0, $6Zb2x$reactariainteractions.useFocusWithin)({
467
522
  isDisabled: !shouldCloseOnBlur,
468
523
  onBlurWithin: (e)=>{
469
524
  // If focus is moving into a child focus scope (e.g. menu inside a dialog),
470
525
  // do not close the outer overlay. At this point, the active scope should
471
526
  // still be the outer overlay, since blur events run before focus.
472
- if (e.relatedTarget && $6Zb2x$reactariafocus.isElementInChildOfActiveScope(e.relatedTarget)) return;
527
+ if (e.relatedTarget && (0, $6Zb2x$reactariafocus.isElementInChildOfActiveScope)(e.relatedTarget)) return;
473
528
  if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.relatedTarget)) onClose();
474
529
  }
475
530
  });
@@ -489,7 +544,17 @@ function $82711f9cb668ecdb$export$ea8f71083e90600f(props, ref) {
489
544
  }
490
545
 
491
546
 
492
-
547
+ /*
548
+ * Copyright 2020 Adobe. All rights reserved.
549
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
550
+ * you may not use this file except in compliance with the License. You may obtain a copy
551
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
552
+ *
553
+ * Unless required by applicable law or agreed to in writing, software distributed under
554
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
555
+ * OF ANY KIND, either express or implied. See the License for the specific language
556
+ * governing permissions and limitations under the License.
557
+ */
493
558
 
494
559
 
495
560
  function $b4878eb6316f670a$export$f9d5c8beee7d008d(props, state, ref) {
@@ -497,22 +562,22 @@ function $b4878eb6316f670a$export$f9d5c8beee7d008d(props, state, ref) {
497
562
  let { isOpen: isOpen } = state;
498
563
  // Backward compatibility. Share state close function with useOverlayPosition so it can close on scroll
499
564
  // without forcing users to pass onClose.
500
- $6Zb2x$react.useEffect(()=>{
501
- if (ref && ref.current) $9a8aa1b0b336ea3a$export$f6211563215e3b37.set(ref.current, state.close);
565
+ (0, $6Zb2x$react.useEffect)(()=>{
566
+ if (ref && ref.current) (0, $9a8aa1b0b336ea3a$export$f6211563215e3b37).set(ref.current, state.close);
502
567
  });
503
568
  // Aria 1.1 supports multiple values for aria-haspopup other than just menus.
504
569
  // https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup
505
570
  // However, we only add it for menus for now because screen readers often
506
571
  // announce it as a menu even for other values.
507
572
  let ariaHasPopup = undefined;
508
- if (type === 'menu') ariaHasPopup = true;
509
- else if (type === 'listbox') ariaHasPopup = 'listbox';
510
- let overlayId = $6Zb2x$reactariautils.useId();
573
+ if (type === "menu") ariaHasPopup = true;
574
+ else if (type === "listbox") ariaHasPopup = "listbox";
575
+ let overlayId = (0, $6Zb2x$reactariautils.useId)();
511
576
  return {
512
577
  triggerProps: {
513
- 'aria-haspopup': ariaHasPopup,
514
- 'aria-expanded': isOpen,
515
- 'aria-controls': isOpen ? overlayId : null,
578
+ "aria-haspopup": ariaHasPopup,
579
+ "aria-expanded": isOpen,
580
+ "aria-controls": isOpen ? overlayId : null,
516
581
  onPress: state.toggle
517
582
  },
518
583
  overlayProps: {
@@ -522,28 +587,47 @@ function $b4878eb6316f670a$export$f9d5c8beee7d008d(props, state, ref) {
522
587
  }
523
588
 
524
589
 
525
-
590
+ /*
591
+ * Copyright 2020 Adobe. All rights reserved.
592
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
593
+ * you may not use this file except in compliance with the License. You may obtain a copy
594
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
595
+ *
596
+ * Unless required by applicable law or agreed to in writing, software distributed under
597
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
598
+ * OF ANY KIND, either express or implied. See the License for the specific language
599
+ * governing permissions and limitations under the License.
600
+ */
526
601
  // @ts-ignore
527
- const $5c2f5cd01815d369$var$visualViewport = typeof window !== 'undefined' && window.visualViewport;
602
+ const $5c2f5cd01815d369$var$visualViewport = typeof window !== "undefined" && window.visualViewport;
528
603
  // HTML input types that do not cause the software keyboard to appear.
529
604
  const $5c2f5cd01815d369$var$nonTextInputTypes = new Set([
530
- 'checkbox',
531
- 'radio',
532
- 'range',
533
- 'color',
534
- 'file',
535
- 'image',
536
- 'button',
537
- 'submit',
538
- 'reset'
605
+ "checkbox",
606
+ "radio",
607
+ "range",
608
+ "color",
609
+ "file",
610
+ "image",
611
+ "button",
612
+ "submit",
613
+ "reset"
539
614
  ]);
540
- function $5c2f5cd01815d369$export$ee0f7cc6afcd1c18(options = {
541
- }) {
615
+ // The number of active usePreventScroll calls. Used to determine whether to revert back to the original page style/scroll position
616
+ let $5c2f5cd01815d369$var$preventScrollCount = 0;
617
+ let $5c2f5cd01815d369$var$restore;
618
+ function $5c2f5cd01815d369$export$ee0f7cc6afcd1c18(options = {}) {
542
619
  let { isDisabled: isDisabled } = options;
543
- $6Zb2x$reactariautils.useLayoutEffect(()=>{
620
+ (0, $6Zb2x$reactariautils.useLayoutEffect)(()=>{
544
621
  if (isDisabled) return;
545
- if ($6Zb2x$reactariautils.isIOS()) return $5c2f5cd01815d369$var$preventScrollMobileSafari();
546
- else return $5c2f5cd01815d369$var$preventScrollStandard();
622
+ $5c2f5cd01815d369$var$preventScrollCount++;
623
+ if ($5c2f5cd01815d369$var$preventScrollCount === 1) {
624
+ if ((0, $6Zb2x$reactariautils.isIOS)()) $5c2f5cd01815d369$var$restore = $5c2f5cd01815d369$var$preventScrollMobileSafari();
625
+ else $5c2f5cd01815d369$var$restore = $5c2f5cd01815d369$var$preventScrollStandard();
626
+ }
627
+ return ()=>{
628
+ $5c2f5cd01815d369$var$preventScrollCount--;
629
+ if ($5c2f5cd01815d369$var$preventScrollCount === 0) $5c2f5cd01815d369$var$restore();
630
+ };
547
631
  }, [
548
632
  isDisabled
549
633
  ]);
@@ -551,7 +635,7 @@ function $5c2f5cd01815d369$export$ee0f7cc6afcd1c18(options = {
551
635
  // For most browsers, all we need to do is set `overflow: hidden` on the root element, and
552
636
  // add some padding to prevent the page from shifting when the scrollbar is hidden.
553
637
  function $5c2f5cd01815d369$var$preventScrollStandard() {
554
- return $6Zb2x$reactariautils.chain($5c2f5cd01815d369$var$setStyle(document.documentElement, 'paddingRight', `${window.innerWidth - document.documentElement.clientWidth}px`), $5c2f5cd01815d369$var$setStyle(document.documentElement, 'overflow', 'hidden'));
638
+ return (0, $6Zb2x$reactariautils.chain)($5c2f5cd01815d369$var$setStyle(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), $5c2f5cd01815d369$var$setStyle(document.documentElement, "overflow", "hidden"));
555
639
  }
556
640
  // Mobile Safari is a whole different beast. Even with overflow: hidden,
557
641
  // it still scrolls the page in many situations:
@@ -584,7 +668,7 @@ function $5c2f5cd01815d369$var$preventScrollMobileSafari() {
584
668
  let lastY = 0;
585
669
  let onTouchStart = (e)=>{
586
670
  // Store the nearest scrollable parent element from the element that the user touched.
587
- scrollable = $6Zb2x$reactariautils.getScrollParent(e.target);
671
+ scrollable = (0, $6Zb2x$reactariautils.getScrollParent)(e.target);
588
672
  if (scrollable === document.documentElement && scrollable === document.body) return;
589
673
  lastY = e.changedTouches[0].pageY;
590
674
  };
@@ -612,10 +696,10 @@ function $5c2f5cd01815d369$var$preventScrollMobileSafari() {
612
696
  // Apply a transform to trick Safari into thinking the input is at the top of the page
613
697
  // so it doesn't try to scroll it into view. When tapping on an input, this needs to
614
698
  // be done before the "focus" event, so we have to focus the element ourselves.
615
- target.style.transform = 'translateY(-2000px)';
699
+ target.style.transform = "translateY(-2000px)";
616
700
  target.focus();
617
701
  requestAnimationFrame(()=>{
618
- target.style.transform = '';
702
+ target.style.transform = "";
619
703
  });
620
704
  }
621
705
  };
@@ -626,9 +710,9 @@ function $5c2f5cd01815d369$var$preventScrollMobileSafari() {
626
710
  // other than tapping on an input directly, e.g. the next/previous buttons in the
627
711
  // software keyboard. In these cases, it seems applying the transform in the focus event
628
712
  // is good enough, whereas when tapping an input, it must be done before the focus event. 🤷‍♂️
629
- target.style.transform = 'translateY(-2000px)';
713
+ target.style.transform = "translateY(-2000px)";
630
714
  requestAnimationFrame(()=>{
631
- target.style.transform = '';
715
+ target.style.transform = "";
632
716
  // This will have prevented the browser from scrolling the focused element into view,
633
717
  // so we need to do this ourselves in a way that doesn't cause the whole page to scroll.
634
718
  if ($5c2f5cd01815d369$var$visualViewport) {
@@ -639,8 +723,7 @@ function $5c2f5cd01815d369$var$preventScrollMobileSafari() {
639
723
  });
640
724
  else // Otherwise, wait for the visual viewport to resize before scrolling so we can
641
725
  // measure the correct position to scroll to.
642
- $5c2f5cd01815d369$var$visualViewport.addEventListener('resize', ()=>$5c2f5cd01815d369$var$scrollIntoView(target)
643
- , {
726
+ $5c2f5cd01815d369$var$visualViewport.addEventListener("resize", ()=>$5c2f5cd01815d369$var$scrollIntoView(target), {
644
727
  once: true
645
728
  });
646
729
  }
@@ -657,19 +740,19 @@ function $5c2f5cd01815d369$var$preventScrollMobileSafari() {
657
740
  // enable us to scroll the window to the top, which is required for the rest of this to work.
658
741
  let scrollX = window.pageXOffset;
659
742
  let scrollY = window.pageYOffset;
660
- let restoreStyles = $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`));
743
+ 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`));
661
744
  // Scroll to the top. The negative margin on the body will make this appear the same.
662
745
  window.scrollTo(0, 0);
663
- let removeEvents = $6Zb2x$reactariautils.chain($5c2f5cd01815d369$var$addEvent(document, 'touchstart', onTouchStart, {
746
+ let removeEvents = (0, $6Zb2x$reactariautils.chain)($5c2f5cd01815d369$var$addEvent(document, "touchstart", onTouchStart, {
664
747
  passive: false,
665
748
  capture: true
666
- }), $5c2f5cd01815d369$var$addEvent(document, 'touchmove', onTouchMove, {
749
+ }), $5c2f5cd01815d369$var$addEvent(document, "touchmove", onTouchMove, {
667
750
  passive: false,
668
751
  capture: true
669
- }), $5c2f5cd01815d369$var$addEvent(document, 'touchend', onTouchEnd, {
752
+ }), $5c2f5cd01815d369$var$addEvent(document, "touchend", onTouchEnd, {
670
753
  passive: false,
671
754
  capture: true
672
- }), $5c2f5cd01815d369$var$addEvent(document, 'focus', onFocus, true), $5c2f5cd01815d369$var$addEvent(window, 'scroll', onWindowScroll));
755
+ }), $5c2f5cd01815d369$var$addEvent(document, "focus", onFocus, true), $5c2f5cd01815d369$var$addEvent(window, "scroll", onWindowScroll));
673
756
  return ()=>{
674
757
  // Restore styles and scroll the page back to where it was.
675
758
  restoreStyles();
@@ -696,7 +779,7 @@ function $5c2f5cd01815d369$var$scrollIntoView(target) {
696
779
  let root = document.scrollingElement || document.documentElement;
697
780
  while(target && target !== root){
698
781
  // Find the parent scrollable element and adjust the scroll position if the target is not already in view.
699
- let scrollable = $6Zb2x$reactariautils.getScrollParent(target);
782
+ let scrollable = (0, $6Zb2x$reactariautils.getScrollParent)(target);
700
783
  if (scrollable !== document.documentElement && scrollable !== document.body && scrollable !== target) {
701
784
  let scrollableTop = scrollable.getBoundingClientRect().top;
702
785
  let targetTop = target.getBoundingClientRect().top;
@@ -710,41 +793,48 @@ function $5c2f5cd01815d369$var$willOpenKeyboard(target) {
710
793
  }
711
794
 
712
795
 
796
+ /*
797
+ * Copyright 2020 Adobe. All rights reserved.
798
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
799
+ * you may not use this file except in compliance with the License. You may obtain a copy
800
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
801
+ *
802
+ * Unless required by applicable law or agreed to in writing, software distributed under
803
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
804
+ * OF ANY KIND, either express or implied. See the License for the specific language
805
+ * governing permissions and limitations under the License.
806
+ */
713
807
 
714
808
 
715
-
716
- const $0775ea8ea6a0565e$var$Context = /*#__PURE__*/ ($parcel$interopDefault($6Zb2x$react)).createContext(null);
809
+ const $0775ea8ea6a0565e$var$Context = /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createContext(null);
717
810
  function $0775ea8ea6a0565e$export$178405afcd8c5eb(props) {
718
811
  let { children: children } = props;
719
- let parent = $6Zb2x$react.useContext($0775ea8ea6a0565e$var$Context);
720
- let [modalCount, setModalCount] = $6Zb2x$react.useState(0);
721
- let context = $6Zb2x$react.useMemo(()=>({
812
+ let parent = (0, $6Zb2x$react.useContext)($0775ea8ea6a0565e$var$Context);
813
+ let [modalCount, setModalCount] = (0, $6Zb2x$react.useState)(0);
814
+ let context = (0, $6Zb2x$react.useMemo)(()=>({
722
815
  parent: parent,
723
816
  modalCount: modalCount,
724
817
  addModal () {
725
- setModalCount((count)=>count + 1
726
- );
818
+ setModalCount((count)=>count + 1);
727
819
  if (parent) parent.addModal();
728
820
  },
729
821
  removeModal () {
730
- setModalCount((count)=>count - 1
731
- );
822
+ setModalCount((count)=>count - 1);
732
823
  if (parent) parent.removeModal();
733
824
  }
734
- })
735
- , [
825
+ }), [
736
826
  parent,
737
827
  modalCount
738
828
  ]);
739
- return(/*#__PURE__*/ ($parcel$interopDefault($6Zb2x$react)).createElement($0775ea8ea6a0565e$var$Context.Provider, {
829
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement($0775ea8ea6a0565e$var$Context.Provider, {
740
830
  value: context
741
- }, children));
831
+ }, children);
742
832
  }
743
833
  function $0775ea8ea6a0565e$export$d9aaed4c3ece1bc0() {
744
- let context = $6Zb2x$react.useContext($0775ea8ea6a0565e$var$Context);
834
+ let context = (0, $6Zb2x$react.useContext)($0775ea8ea6a0565e$var$Context);
745
835
  return {
746
836
  modalProviderProps: {
747
- 'aria-hidden': context && context.modalCount > 0 ? true : null
837
+ "aria-hidden": context && context.modalCount > 0 ? true : null
748
838
  }
749
839
  };
750
840
  }
@@ -752,32 +842,32 @@ function $0775ea8ea6a0565e$export$d9aaed4c3ece1bc0() {
752
842
  * Creates a root node that will be aria-hidden if there are other modals open.
753
843
  */ function $0775ea8ea6a0565e$var$OverlayContainerDOM(props) {
754
844
  let { modalProviderProps: modalProviderProps } = $0775ea8ea6a0565e$export$d9aaed4c3ece1bc0();
755
- return(/*#__PURE__*/ ($parcel$interopDefault($6Zb2x$react)).createElement("div", {
845
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement("div", {
756
846
  "data-overlay-container": true,
757
847
  ...props,
758
848
  ...modalProviderProps
759
- }));
849
+ });
760
850
  }
761
851
  function $0775ea8ea6a0565e$export$bf688221f59024e5(props) {
762
- return(/*#__PURE__*/ ($parcel$interopDefault($6Zb2x$react)).createElement($0775ea8ea6a0565e$export$178405afcd8c5eb, null, /*#__PURE__*/ ($parcel$interopDefault($6Zb2x$react)).createElement($0775ea8ea6a0565e$var$OverlayContainerDOM, props)));
852
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement($0775ea8ea6a0565e$export$178405afcd8c5eb, null, /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement($0775ea8ea6a0565e$var$OverlayContainerDOM, props));
763
853
  }
764
854
  function $0775ea8ea6a0565e$export$b47c3594eab58386(props) {
765
- let isSSR = $6Zb2x$reactariassr.useIsSSR();
855
+ let isSSR = (0, $6Zb2x$reactariassr.useIsSSR)();
766
856
  let { portalContainer: portalContainer = isSSR ? null : document.body , ...rest } = props;
767
- ($parcel$interopDefault($6Zb2x$react)).useEffect(()=>{
768
- 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.');
857
+ (0, ($parcel$interopDefault($6Zb2x$react))).useEffect(()=>{
858
+ 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.");
769
859
  }, [
770
860
  portalContainer
771
861
  ]);
772
862
  if (!portalContainer) return null;
773
- let contents = /*#__PURE__*/ ($parcel$interopDefault($6Zb2x$react)).createElement($0775ea8ea6a0565e$export$bf688221f59024e5, rest);
774
- return(/*#__PURE__*/ ($parcel$interopDefault($6Zb2x$reactdom)).createPortal(contents, portalContainer));
863
+ let contents = /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement($0775ea8ea6a0565e$export$bf688221f59024e5, rest);
864
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$reactdom))).createPortal(contents, portalContainer);
775
865
  }
776
866
  function $0775ea8ea6a0565e$export$33ffd74ebf07f060(options) {
777
867
  // Add aria-hidden to all parent providers on mount, and restore on unmount.
778
- let context = $6Zb2x$react.useContext($0775ea8ea6a0565e$var$Context);
779
- if (!context) throw new Error('Modal is not contained within a provider');
780
- $6Zb2x$react.useEffect(()=>{
868
+ let context = (0, $6Zb2x$react.useContext)($0775ea8ea6a0565e$var$Context);
869
+ if (!context) throw new Error("Modal is not contained within a provider");
870
+ (0, $6Zb2x$react.useEffect)(()=>{
781
871
  if ((options === null || options === void 0 ? void 0 : options.isDisabled) || !context || !context.parent) return;
782
872
  // The immediate context is from the provider containing this modal, so we only
783
873
  // want to trigger aria-hidden on its parents not on the modal provider itself.
@@ -792,13 +882,23 @@ function $0775ea8ea6a0565e$export$33ffd74ebf07f060(options) {
792
882
  ]);
793
883
  return {
794
884
  modalProps: {
795
- 'data-ismodal': !(options === null || options === void 0 ? void 0 : options.isDisabled)
885
+ "data-ismodal": !(options === null || options === void 0 ? void 0 : options.isDisabled)
796
886
  }
797
887
  };
798
888
  }
799
889
 
800
890
 
801
- var $18d014414048a7ba$exports = {};
891
+ /*
892
+ * Copyright 2020 Adobe. All rights reserved.
893
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
894
+ * you may not use this file except in compliance with the License. You may obtain a copy
895
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
896
+ *
897
+ * Unless required by applicable law or agreed to in writing, software distributed under
898
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
899
+ * OF ANY KIND, either express or implied. See the License for the specific language
900
+ * governing permissions and limitations under the License.
901
+ */ var $18d014414048a7ba$exports = {};
802
902
  var $4393d9b86d3ad278$exports = {};
803
903
  $4393d9b86d3ad278$exports = {
804
904
  "dismiss": `تجاهل`
@@ -1047,16 +1147,16 @@ $18d014414048a7ba$exports = {
1047
1147
 
1048
1148
  function $f69bb3e6457495cc$export$2317d149ed6f78c4(props) {
1049
1149
  let { onDismiss: onDismiss , ...otherProps } = props;
1050
- let stringFormatter = $6Zb2x$reactariai18n.useLocalizedStringFormatter((/*@__PURE__*/$parcel$interopDefault($18d014414048a7ba$exports)));
1051
- let labels = $6Zb2x$reactariautils.useLabels(otherProps, stringFormatter.format('dismiss'));
1150
+ let stringFormatter = (0, $6Zb2x$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($18d014414048a7ba$exports))));
1151
+ let labels = (0, $6Zb2x$reactariautils.useLabels)(otherProps, stringFormatter.format("dismiss"));
1052
1152
  let onClick = ()=>{
1053
1153
  if (onDismiss) onDismiss();
1054
1154
  };
1055
- return(/*#__PURE__*/ ($parcel$interopDefault($6Zb2x$react)).createElement($6Zb2x$reactariavisuallyhidden.VisuallyHidden, null, /*#__PURE__*/ ($parcel$interopDefault($6Zb2x$react)).createElement("button", {
1155
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement((0, $6Zb2x$reactariavisuallyhidden.VisuallyHidden), null, /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement("button", {
1056
1156
  ...labels,
1057
1157
  tabIndex: -1,
1058
1158
  onClick: onClick
1059
- })));
1159
+ }));
1060
1160
  }
1061
1161
 
1062
1162
 
@@ -1077,51 +1177,66 @@ let $08ef1685902b6011$var$observerStack = [];
1077
1177
  function $08ef1685902b6011$export$1c3ebcada18427bf(targets, root = document.body) {
1078
1178
  let visibleNodes = new Set(targets);
1079
1179
  let hiddenNodes = new Set();
1080
- let walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
1081
- acceptNode (node) {
1082
- // If this node is a live announcer, add it to the set of nodes to keep visible.
1083
- if ((node instanceof HTMLElement || node instanceof SVGElement) && node.dataset.liveAnnouncer === 'true') visibleNodes.add(node);
1180
+ let walk = (root)=>{
1181
+ // Keep live announcer and top layer elements (e.g. toasts) visible.
1182
+ for (let element of root.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))visibleNodes.add(element);
1183
+ let acceptNode = (node)=>{
1084
1184
  // Skip this node and its children if it is one of the target nodes, or a live announcer.
1085
1185
  // Also skip children of already hidden nodes, as aria-hidden is recursive. An exception is
1086
1186
  // made for elements with role="row" since VoiceOver on iOS has issues hiding elements with role="row".
1087
1187
  // For that case we want to hide the cells inside as well (https://bugs.webkit.org/show_bug.cgi?id=222623).
1088
- if (visibleNodes.has(node) || hiddenNodes.has(node.parentElement) && node.parentElement.getAttribute('role') !== 'row') return NodeFilter.FILTER_REJECT;
1188
+ if (visibleNodes.has(node) || hiddenNodes.has(node.parentElement) && node.parentElement.getAttribute("role") !== "row") return NodeFilter.FILTER_REJECT;
1089
1189
  // Skip this node but continue to children if one of the targets is inside the node.
1090
- if (targets.some((target)=>node.contains(target)
1091
- )) return NodeFilter.FILTER_SKIP;
1190
+ for (let target of visibleNodes){
1191
+ if (node.contains(target)) return NodeFilter.FILTER_SKIP;
1192
+ }
1092
1193
  return NodeFilter.FILTER_ACCEPT;
1194
+ };
1195
+ let walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
1196
+ acceptNode: acceptNode
1197
+ });
1198
+ // TreeWalker does not include the root.
1199
+ let acceptRoot = acceptNode(root);
1200
+ if (acceptRoot === NodeFilter.FILTER_ACCEPT) hide(root);
1201
+ if (acceptRoot !== NodeFilter.FILTER_REJECT) {
1202
+ let node = walker.nextNode();
1203
+ while(node != null){
1204
+ hide(node);
1205
+ node = walker.nextNode();
1206
+ }
1093
1207
  }
1094
- });
1208
+ };
1095
1209
  let hide = (node)=>{
1096
- var ref;
1097
- let refCount = (ref = $08ef1685902b6011$var$refCountMap.get(node)) !== null && ref !== void 0 ? ref : 0;
1210
+ var _refCountMap_get;
1211
+ let refCount = (_refCountMap_get = $08ef1685902b6011$var$refCountMap.get(node)) !== null && _refCountMap_get !== void 0 ? _refCountMap_get : 0;
1098
1212
  // If already aria-hidden, and the ref count is zero, then this element
1099
1213
  // was already hidden and there's nothing for us to do.
1100
- if (node.getAttribute('aria-hidden') === 'true' && refCount === 0) return;
1101
- if (refCount === 0) node.setAttribute('aria-hidden', 'true');
1214
+ if (node.getAttribute("aria-hidden") === "true" && refCount === 0) return;
1215
+ if (refCount === 0) node.setAttribute("aria-hidden", "true");
1102
1216
  hiddenNodes.add(node);
1103
1217
  $08ef1685902b6011$var$refCountMap.set(node, refCount + 1);
1104
1218
  };
1105
1219
  // If there is already a MutationObserver listening from a previous call,
1106
1220
  // disconnect it so the new on takes over.
1107
1221
  if ($08ef1685902b6011$var$observerStack.length) $08ef1685902b6011$var$observerStack[$08ef1685902b6011$var$observerStack.length - 1].disconnect();
1108
- let node1 = walker.nextNode();
1109
- while(node1 != null){
1110
- hide(node1);
1111
- node1 = walker.nextNode();
1112
- }
1222
+ walk(root);
1113
1223
  let observer = new MutationObserver((changes)=>{
1114
1224
  for (let change of changes){
1115
- if (change.type !== 'childList' || change.addedNodes.length === 0) continue;
1225
+ if (change.type !== "childList" || change.addedNodes.length === 0) continue;
1116
1226
  // If the parent element of the added nodes is not within one of the targets,
1117
1227
  // and not already inside a hidden node, hide all of the new children.
1118
1228
  if (![
1119
1229
  ...visibleNodes,
1120
1230
  ...hiddenNodes
1121
- ].some((node)=>node.contains(change.target)
1122
- )) for (let node2 of change.addedNodes){
1123
- if ((node2 instanceof HTMLElement || node2 instanceof SVGElement) && node2.dataset.liveAnnouncer === 'true') visibleNodes.add(node2);
1124
- else if (node2 instanceof Element) hide(node2);
1231
+ ].some((node)=>node.contains(change.target))) {
1232
+ for (let node of change.removedNodes)if (node instanceof Element) {
1233
+ visibleNodes.delete(node);
1234
+ hiddenNodes.delete(node);
1235
+ }
1236
+ for (let node1 of change.addedNodes){
1237
+ if ((node1 instanceof HTMLElement || node1 instanceof SVGElement) && (node1.dataset.liveAnnouncer === "true" || node1.dataset.reactAriaTopLayer === "true")) visibleNodes.add(node1);
1238
+ else if (node1 instanceof Element) walk(node1);
1239
+ }
1125
1240
  }
1126
1241
  }
1127
1242
  });
@@ -1146,7 +1261,7 @@ function $08ef1685902b6011$export$1c3ebcada18427bf(targets, root = document.body
1146
1261
  for (let node of hiddenNodes){
1147
1262
  let count = $08ef1685902b6011$var$refCountMap.get(node);
1148
1263
  if (count === 1) {
1149
- node.removeAttribute('aria-hidden');
1264
+ node.removeAttribute("aria-hidden");
1150
1265
  $08ef1685902b6011$var$refCountMap.delete(node);
1151
1266
  } else $08ef1685902b6011$var$refCountMap.set(node, count - 1);
1152
1267
  }
@@ -1159,43 +1274,42 @@ function $08ef1685902b6011$export$1c3ebcada18427bf(targets, root = document.body
1159
1274
  }
1160
1275
 
1161
1276
 
1162
-
1163
-
1277
+ /*
1278
+ * Copyright 2022 Adobe. All rights reserved.
1279
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
1280
+ * you may not use this file except in compliance with the License. You may obtain a copy
1281
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
1282
+ *
1283
+ * Unless required by applicable law or agreed to in writing, software distributed under
1284
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1285
+ * OF ANY KIND, either express or implied. See the License for the specific language
1286
+ * governing permissions and limitations under the License.
1287
+ */
1164
1288
 
1165
1289
 
1166
1290
 
1167
1291
 
1168
1292
  function $6c2dfcdee3e15e20$export$542a6fd13ac93354(props, state) {
1169
1293
  let { triggerRef: triggerRef , popoverRef: popoverRef , isNonModal: isNonModal , isKeyboardDismissDisabled: isKeyboardDismissDisabled , ...otherProps } = props;
1170
- let { overlayProps: overlayProps , underlayProps: underlayProps } = $82711f9cb668ecdb$export$ea8f71083e90600f({
1294
+ let { overlayProps: overlayProps , underlayProps: underlayProps } = (0, $82711f9cb668ecdb$export$ea8f71083e90600f)({
1171
1295
  isOpen: state.isOpen,
1172
1296
  onClose: state.close,
1173
1297
  shouldCloseOnBlur: true,
1174
1298
  isDismissable: !isNonModal,
1175
1299
  isKeyboardDismissDisabled: isKeyboardDismissDisabled
1176
1300
  }, popoverRef);
1177
- let { overlayProps: positionProps , arrowProps: arrowProps , placement: placement } = $cd94b4896dd97759$export$d39e1813b3bdd0e1({
1301
+ let { overlayProps: positionProps , arrowProps: arrowProps , placement: placement } = (0, $cd94b4896dd97759$export$d39e1813b3bdd0e1)({
1178
1302
  ...otherProps,
1179
1303
  targetRef: triggerRef,
1180
1304
  overlayRef: popoverRef,
1181
1305
  isOpen: state.isOpen,
1182
1306
  onClose: null
1183
1307
  });
1184
- // Delay preventing scroll until popover is positioned to avoid extra scroll padding.
1185
- // This requires a layout effect so that positioning has been committed to the DOM
1186
- // by the time usePreventScroll measures the element.
1187
- let [isPositioned, setPositioned] = $6Zb2x$react.useState(false);
1188
- $6Zb2x$reactariautils.useLayoutEffect(()=>{
1189
- if (!isNonModal && placement) setPositioned(true);
1190
- }, [
1191
- isNonModal,
1192
- placement
1193
- ]);
1194
- $5c2f5cd01815d369$export$ee0f7cc6afcd1c18({
1195
- isDisabled: isNonModal || !isPositioned
1308
+ (0, $5c2f5cd01815d369$export$ee0f7cc6afcd1c18)({
1309
+ isDisabled: isNonModal
1196
1310
  });
1197
- $6Zb2x$reactariautils.useLayoutEffect(()=>{
1198
- if (state.isOpen && !isNonModal && popoverRef.current) return $08ef1685902b6011$export$1c3ebcada18427bf([
1311
+ (0, $6Zb2x$reactariautils.useLayoutEffect)(()=>{
1312
+ if (state.isOpen && !isNonModal && popoverRef.current) return (0, $08ef1685902b6011$export$1c3ebcada18427bf)([
1199
1313
  popoverRef.current
1200
1314
  ]);
1201
1315
  }, [
@@ -1204,7 +1318,7 @@ function $6c2dfcdee3e15e20$export$542a6fd13ac93354(props, state) {
1204
1318
  popoverRef
1205
1319
  ]);
1206
1320
  return {
1207
- popoverProps: $6Zb2x$reactariautils.mergeProps(overlayProps, positionProps),
1321
+ popoverProps: (0, $6Zb2x$reactariautils.mergeProps)(overlayProps, positionProps),
1208
1322
  arrowProps: arrowProps,
1209
1323
  underlayProps: underlayProps,
1210
1324
  placement: placement
@@ -1212,41 +1326,60 @@ function $6c2dfcdee3e15e20$export$542a6fd13ac93354(props, state) {
1212
1326
  }
1213
1327
 
1214
1328
 
1329
+ /*
1330
+ * Copyright 2022 Adobe. All rights reserved.
1331
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
1332
+ * you may not use this file except in compliance with the License. You may obtain a copy
1333
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
1334
+ *
1335
+ * Unless required by applicable law or agreed to in writing, software distributed under
1336
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1337
+ * OF ANY KIND, either express or implied. See the License for the specific language
1338
+ * governing permissions and limitations under the License.
1339
+ */
1215
1340
 
1216
1341
 
1217
1342
 
1343
+ /*
1344
+ * Copyright 2022 Adobe. All rights reserved.
1345
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
1346
+ * you may not use this file except in compliance with the License. You may obtain a copy
1347
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
1348
+ *
1349
+ * Unless required by applicable law or agreed to in writing, software distributed under
1350
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1351
+ * OF ANY KIND, either express or implied. See the License for the specific language
1352
+ * governing permissions and limitations under the License.
1353
+ */
1218
1354
 
1219
1355
 
1220
1356
 
1221
1357
 
1222
-
1223
-
1224
- const $745edbb83ab4296f$export$a2200b96afd16271 = /*#__PURE__*/ ($parcel$interopDefault($6Zb2x$react)).createContext(null);
1358
+ const $745edbb83ab4296f$export$a2200b96afd16271 = /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createContext(null);
1225
1359
  function $745edbb83ab4296f$export$c6fdb837b070b4ff(props) {
1226
- let isSSR = $6Zb2x$reactariassr.useIsSSR();
1360
+ let isSSR = (0, $6Zb2x$reactariassr.useIsSSR)();
1227
1361
  let { portalContainer: portalContainer = isSSR ? null : document.body } = props;
1228
- let [contain, setContain] = $6Zb2x$react.useState(false);
1229
- let contextValue = $6Zb2x$react.useMemo(()=>({
1362
+ let [contain, setContain] = (0, $6Zb2x$react.useState)(false);
1363
+ let contextValue = (0, $6Zb2x$react.useMemo)(()=>({
1230
1364
  contain: contain,
1231
1365
  setContain: setContain
1232
- })
1233
- , [
1366
+ }), [
1234
1367
  contain,
1235
1368
  setContain
1236
1369
  ]);
1237
1370
  if (!portalContainer) return null;
1238
- let contents = /*#__PURE__*/ ($parcel$interopDefault($6Zb2x$react)).createElement($745edbb83ab4296f$export$a2200b96afd16271.Provider, {
1371
+ let contents = /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement($745edbb83ab4296f$export$a2200b96afd16271.Provider, {
1239
1372
  value: contextValue
1240
- }, /*#__PURE__*/ ($parcel$interopDefault($6Zb2x$react)).createElement($6Zb2x$reactariafocus.FocusScope, {
1373
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement((0, $6Zb2x$reactariafocus.FocusScope), {
1241
1374
  restoreFocus: true,
1242
1375
  contain: contain
1243
1376
  }, props.children));
1244
- return(/*#__PURE__*/ ($parcel$interopDefault($6Zb2x$reactdom)).createPortal(contents, portalContainer));
1377
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$reactdom))).createPortal(contents, portalContainer);
1245
1378
  }
1246
1379
  function $745edbb83ab4296f$export$14c98a7594375490() {
1247
- let ctx = $6Zb2x$react.useContext($745edbb83ab4296f$export$a2200b96afd16271);
1380
+ let ctx = (0, $6Zb2x$react.useContext)($745edbb83ab4296f$export$a2200b96afd16271);
1248
1381
  let setContain = ctx === null || ctx === void 0 ? void 0 : ctx.setContain;
1249
- $6Zb2x$reactariautils.useLayoutEffect(()=>{
1382
+ (0, $6Zb2x$reactariautils.useLayoutEffect)(()=>{
1250
1383
  setContain === null || setContain === void 0 ? void 0 : setContain(true);
1251
1384
  }, [
1252
1385
  setContain
@@ -1256,17 +1389,17 @@ function $745edbb83ab4296f$export$14c98a7594375490() {
1256
1389
 
1257
1390
 
1258
1391
  function $11b7e0b04b421e95$export$dbc0f175b25fb0fb(props, state, ref) {
1259
- let { overlayProps: overlayProps , underlayProps: underlayProps } = $82711f9cb668ecdb$export$ea8f71083e90600f({
1392
+ let { overlayProps: overlayProps , underlayProps: underlayProps } = (0, $82711f9cb668ecdb$export$ea8f71083e90600f)({
1260
1393
  ...props,
1261
1394
  isOpen: state.isOpen,
1262
1395
  onClose: state.close
1263
1396
  }, ref);
1264
- $5c2f5cd01815d369$export$ee0f7cc6afcd1c18({
1397
+ (0, $5c2f5cd01815d369$export$ee0f7cc6afcd1c18)({
1265
1398
  isDisabled: !state.isOpen
1266
1399
  });
1267
- $745edbb83ab4296f$export$14c98a7594375490();
1268
- $6Zb2x$react.useEffect(()=>{
1269
- if (state.isOpen) return $08ef1685902b6011$export$1c3ebcada18427bf([
1400
+ (0, $745edbb83ab4296f$export$14c98a7594375490)();
1401
+ (0, $6Zb2x$react.useEffect)(()=>{
1402
+ if (state.isOpen) return (0, $08ef1685902b6011$export$1c3ebcada18427bf)([
1270
1403
  ref.current
1271
1404
  ]);
1272
1405
  }, [
@@ -1274,7 +1407,7 @@ function $11b7e0b04b421e95$export$dbc0f175b25fb0fb(props, state, ref) {
1274
1407
  ref
1275
1408
  ]);
1276
1409
  return {
1277
- modalProps: $6Zb2x$reactariautils.mergeProps(overlayProps),
1410
+ modalProps: (0, $6Zb2x$reactariautils.mergeProps)(overlayProps),
1278
1411
  underlayProps: underlayProps
1279
1412
  };
1280
1413
  }