@react-aria/overlays 3.7.3 → 3.8.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/module.js CHANGED
@@ -1,633 +1,515 @@
1
- import { VisuallyHidden } from "@react-aria/visually-hidden";
2
- import _babelRuntimeHelpersEsmInteropRequireDefault from "@babel/runtime/helpers/esm/interopRequireDefault";
3
- import _reactDom from "react-dom";
4
- import _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- import { useFocusWithin, useInteractOutside } from "@react-aria/interactions";
6
- import { useLocale, useMessageFormatter } from "@react-aria/i18n";
7
- import { useLayoutEffect, useId, chain, getScrollParent, isIOS } from "@react-aria/utils";
8
- import _react, { useCallback, useRef, useState, useEffect, useContext, useMemo } from "react";
9
- import _domHelpersOwnerDocument from "dom-helpers/ownerDocument";
10
- import _domHelpersQueryScrollTop from "dom-helpers/query/scrollTop";
11
- import _domHelpersQueryScrollLeft from "dom-helpers/query/scrollLeft";
12
- import _domHelpersQueryPosition from "dom-helpers/query/position";
13
- import _domHelpersQueryOffset from "dom-helpers/query/offset";
14
- import _domHelpersStyle from "dom-helpers/style";
15
- import _babelRuntimeHelpersEsmExtends from "@babel/runtime/helpers/esm/extends";
16
- const $d45e305fb90d49e7c81f49bb4afe323b$var$AXIS = {
17
- top: 'top',
18
- bottom: 'top',
19
- left: 'left',
20
- right: 'left'
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} from "@react-aria/utils";
3
+ import {useLocale as $k7QOs$useLocale, useMessageFormatter as $k7QOs$useMessageFormatter} from "@react-aria/i18n";
4
+ import $k7QOs$domhelpersstyle from "dom-helpers/style";
5
+ import $k7QOs$domhelpersqueryoffset from "dom-helpers/query/offset";
6
+ import $k7QOs$domhelpersqueryposition from "dom-helpers/query/position";
7
+ import $k7QOs$domhelpersqueryscrollLeft from "dom-helpers/query/scrollLeft";
8
+ import $k7QOs$domhelpersqueryscrollTop from "dom-helpers/query/scrollTop";
9
+ import $k7QOs$domhelpersownerDocument from "dom-helpers/ownerDocument";
10
+ import {useInteractOutside as $k7QOs$useInteractOutside, useFocusWithin as $k7QOs$useFocusWithin} from "@react-aria/interactions";
11
+ import $k7QOs$reactdom from "react-dom";
12
+ import {VisuallyHidden as $k7QOs$VisuallyHidden} from "@react-aria/visually-hidden";
13
+
14
+ function $parcel$export(e, n, v, s) {
15
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
16
+ }
17
+ function $parcel$interopDefault(a) {
18
+ return a && a.__esModule ? a.default : a;
19
+ }
20
+ var $2a41e45df1593e64$exports = {};
21
+
22
+ $parcel$export($2a41e45df1593e64$exports, "useOverlayPosition", () => $2a41e45df1593e64$export$d39e1813b3bdd0e1);
23
+
24
+
25
+
26
+
27
+
28
+
29
+ const $edcf132a9284368a$var$AXIS = {
30
+ top: 'top',
31
+ bottom: 'top',
32
+ left: 'left',
33
+ right: 'left'
34
+ };
35
+ const $edcf132a9284368a$var$FLIPPED_DIRECTION = {
36
+ top: 'bottom',
37
+ bottom: 'top',
38
+ left: 'right',
39
+ right: 'left'
21
40
  };
22
- const $d45e305fb90d49e7c81f49bb4afe323b$var$FLIPPED_DIRECTION = {
23
- top: 'bottom',
24
- bottom: 'top',
25
- left: 'right',
26
- right: 'left'
41
+ const $edcf132a9284368a$var$CROSS_AXIS = {
42
+ top: 'left',
43
+ left: 'top'
27
44
  };
28
- const $d45e305fb90d49e7c81f49bb4afe323b$var$CROSS_AXIS = {
29
- top: 'left',
30
- left: 'top'
45
+ const $edcf132a9284368a$var$AXIS_SIZE = {
46
+ top: 'height',
47
+ left: 'width'
31
48
  };
32
- const $d45e305fb90d49e7c81f49bb4afe323b$var$AXIS_SIZE = {
33
- top: 'height',
34
- left: 'width'
49
+ const $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE = {
35
50
  };
36
- const $d45e305fb90d49e7c81f49bb4afe323b$var$PARSED_PLACEMENT_CACHE = {}; // @ts-ignore
37
-
38
- let $d45e305fb90d49e7c81f49bb4afe323b$var$visualViewport = typeof window !== 'undefined' && window.visualViewport;
39
-
40
- function $d45e305fb90d49e7c81f49bb4afe323b$var$getContainerDimensions(containerNode) {
41
- let width = 0,
42
- height = 0,
43
- top = 0,
44
- left = 0;
45
- let scroll = {};
46
-
47
- if (containerNode.tagName === 'BODY') {
48
- var _visualViewport$width, _visualViewport$heigh;
49
-
50
- width = (_visualViewport$width = $d45e305fb90d49e7c81f49bb4afe323b$var$visualViewport == null ? void 0 : $d45e305fb90d49e7c81f49bb4afe323b$var$visualViewport.width) != null ? _visualViewport$width : document.documentElement.clientWidth;
51
- height = (_visualViewport$heigh = $d45e305fb90d49e7c81f49bb4afe323b$var$visualViewport == null ? void 0 : $d45e305fb90d49e7c81f49bb4afe323b$var$visualViewport.height) != null ? _visualViewport$heigh : document.documentElement.clientHeight;
52
- scroll.top = _domHelpersQueryScrollTop(_domHelpersOwnerDocument(containerNode).documentElement) || _domHelpersQueryScrollTop(containerNode);
53
- scroll.left = _domHelpersQueryScrollLeft(_domHelpersOwnerDocument(containerNode).documentElement) || _domHelpersQueryScrollLeft(containerNode);
54
- } else {
55
- ({
56
- width,
57
- height,
58
- top,
59
- left
60
- } = _domHelpersQueryOffset(containerNode));
61
- scroll.top = _domHelpersQueryScrollTop(containerNode);
62
- scroll.left = _domHelpersQueryScrollLeft(containerNode);
63
- }
64
-
65
- return {
66
- width,
67
- height,
68
- scroll,
69
- top,
70
- left
71
- };
51
+ // @ts-ignore
52
+ let $edcf132a9284368a$var$visualViewport = typeof window !== 'undefined' && window.visualViewport;
53
+ function $edcf132a9284368a$var$getContainerDimensions(containerNode) {
54
+ let width = 0, height = 0, top = 0, left = 0;
55
+ let scroll = {
56
+ };
57
+ if (containerNode.tagName === 'BODY') {
58
+ var ref;
59
+ width = (ref = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.width) !== null && ref !== void 0 ? ref : document.documentElement.clientWidth;
60
+ var ref1;
61
+ height = (ref1 = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.height) !== null && ref1 !== void 0 ? ref1 : document.documentElement.clientHeight;
62
+ scroll.top = $k7QOs$domhelpersqueryscrollTop($k7QOs$domhelpersownerDocument(containerNode).documentElement) || $k7QOs$domhelpersqueryscrollTop(containerNode);
63
+ scroll.left = $k7QOs$domhelpersqueryscrollLeft($k7QOs$domhelpersownerDocument(containerNode).documentElement) || $k7QOs$domhelpersqueryscrollLeft(containerNode);
64
+ } else {
65
+ ({ width: width , height: height , top: top , left: left } = $k7QOs$domhelpersqueryoffset(containerNode));
66
+ scroll.top = $k7QOs$domhelpersqueryscrollTop(containerNode);
67
+ scroll.left = $k7QOs$domhelpersqueryscrollLeft(containerNode);
68
+ }
69
+ return {
70
+ width: width,
71
+ height: height,
72
+ scroll: scroll,
73
+ top: top,
74
+ left: left
75
+ };
72
76
  }
73
-
74
- function $d45e305fb90d49e7c81f49bb4afe323b$var$getScroll(node) {
75
- return {
76
- top: node.scrollTop,
77
- left: node.scrollLeft,
78
- width: node.scrollWidth,
79
- height: node.scrollHeight
80
- };
77
+ function $edcf132a9284368a$var$getScroll(node) {
78
+ return {
79
+ top: node.scrollTop,
80
+ left: node.scrollLeft,
81
+ width: node.scrollWidth,
82
+ height: node.scrollHeight
83
+ };
81
84
  }
82
-
83
- function $d45e305fb90d49e7c81f49bb4afe323b$var$getDelta(axis, offset, size, containerDimensions, padding) {
84
- let containerScroll = containerDimensions.scroll[axis];
85
- let containerHeight = containerDimensions[$d45e305fb90d49e7c81f49bb4afe323b$var$AXIS_SIZE[axis]];
86
- let startEdgeOffset = offset - padding - containerScroll;
87
- let endEdgeOffset = offset + padding - containerScroll + size;
88
-
89
- if (startEdgeOffset < 0) {
90
- return -startEdgeOffset;
91
- } else if (endEdgeOffset > containerHeight) {
92
- return Math.max(containerHeight - endEdgeOffset, -startEdgeOffset);
93
- } else {
94
- return 0;
95
- }
85
+ function $edcf132a9284368a$var$getDelta(axis, offset, size, containerDimensions, padding) {
86
+ let containerScroll = containerDimensions.scroll[axis];
87
+ let containerHeight = containerDimensions[$edcf132a9284368a$var$AXIS_SIZE[axis]];
88
+ let startEdgeOffset = offset - padding - containerScroll;
89
+ let endEdgeOffset = offset + padding - containerScroll + size;
90
+ if (startEdgeOffset < 0) return -startEdgeOffset;
91
+ else if (endEdgeOffset > containerHeight) return Math.max(containerHeight - endEdgeOffset, -startEdgeOffset);
92
+ else return 0;
96
93
  }
97
-
98
- function $d45e305fb90d49e7c81f49bb4afe323b$var$getMargins(node) {
99
- let style = window.getComputedStyle(node);
100
- return {
101
- top: parseInt(style.marginTop, 10) || 0,
102
- bottom: parseInt(style.marginBottom, 10) || 0,
103
- left: parseInt(style.marginLeft, 10) || 0,
104
- right: parseInt(style.marginRight, 10) || 0
105
- };
94
+ function $edcf132a9284368a$var$getMargins(node) {
95
+ let style = window.getComputedStyle(node);
96
+ return {
97
+ top: parseInt(style.marginTop, 10) || 0,
98
+ bottom: parseInt(style.marginBottom, 10) || 0,
99
+ left: parseInt(style.marginLeft, 10) || 0,
100
+ right: parseInt(style.marginRight, 10) || 0
101
+ };
106
102
  }
107
-
108
- function $d45e305fb90d49e7c81f49bb4afe323b$var$parsePlacement(input) {
109
- if ($d45e305fb90d49e7c81f49bb4afe323b$var$PARSED_PLACEMENT_CACHE[input]) {
110
- return $d45e305fb90d49e7c81f49bb4afe323b$var$PARSED_PLACEMENT_CACHE[input];
111
- }
112
-
113
- let [placement, crossPlacement] = input.split(' ');
114
- let axis = $d45e305fb90d49e7c81f49bb4afe323b$var$AXIS[placement] || 'right';
115
- let crossAxis = $d45e305fb90d49e7c81f49bb4afe323b$var$CROSS_AXIS[axis];
116
-
117
- if (!$d45e305fb90d49e7c81f49bb4afe323b$var$AXIS[crossPlacement]) {
118
- crossPlacement = 'center';
119
- }
120
-
121
- let size = $d45e305fb90d49e7c81f49bb4afe323b$var$AXIS_SIZE[axis];
122
- let crossSize = $d45e305fb90d49e7c81f49bb4afe323b$var$AXIS_SIZE[crossAxis];
123
- $d45e305fb90d49e7c81f49bb4afe323b$var$PARSED_PLACEMENT_CACHE[input] = {
124
- placement,
125
- crossPlacement,
126
- axis,
127
- crossAxis,
128
- size,
129
- crossSize
130
- };
131
- return $d45e305fb90d49e7c81f49bb4afe323b$var$PARSED_PLACEMENT_CACHE[input];
103
+ function $edcf132a9284368a$var$parsePlacement(input) {
104
+ if ($edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input]) return $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input];
105
+ let [placement, crossPlacement] = input.split(' ');
106
+ let axis = $edcf132a9284368a$var$AXIS[placement] || 'right';
107
+ let crossAxis = $edcf132a9284368a$var$CROSS_AXIS[axis];
108
+ if (!$edcf132a9284368a$var$AXIS[crossPlacement]) crossPlacement = 'center';
109
+ let size = $edcf132a9284368a$var$AXIS_SIZE[axis];
110
+ let crossSize = $edcf132a9284368a$var$AXIS_SIZE[crossAxis];
111
+ $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input] = {
112
+ placement: placement,
113
+ crossPlacement: crossPlacement,
114
+ axis: axis,
115
+ crossAxis: crossAxis,
116
+ size: size,
117
+ crossSize: crossSize
118
+ };
119
+ return $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input];
132
120
  }
133
-
134
- function $d45e305fb90d49e7c81f49bb4afe323b$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned) {
135
- let {
136
- placement,
137
- crossPlacement,
138
- axis,
139
- crossAxis,
140
- size,
141
- crossSize
142
- } = placementInfo;
143
- let position = {}; // button position
144
-
145
- position[crossAxis] = childOffset[crossAxis];
146
-
147
- if (crossPlacement === 'center') {
148
- // + (button size / 2) - (overlay size / 2)
121
+ function $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned) {
122
+ let { placement: placement , crossPlacement: crossPlacement , axis: axis , crossAxis: crossAxis , size: size , crossSize: crossSize } = placementInfo;
123
+ let position = {
124
+ };
125
+ // button position
126
+ position[crossAxis] = childOffset[crossAxis];
127
+ if (crossPlacement === 'center') // + (button size / 2) - (overlay size / 2)
149
128
  // at this point the overlay center should match the button center
150
129
  position[crossAxis] += (childOffset[crossSize] - overlaySize[crossSize]) / 2;
151
- } else if (crossPlacement !== crossAxis) {
152
- // + (button size) - (overlay size)
130
+ else if (crossPlacement !== crossAxis) // + (button size) - (overlay size)
153
131
  // at this point the overlay bottom should match the button bottom
154
132
  position[crossAxis] += childOffset[crossSize] - overlaySize[crossSize];
155
- }
156
- /* else {
157
- the overlay top should match the button top
158
- } */
159
- // add the crossOffset from props
160
-
161
-
162
- position[crossAxis] += crossOffset; // this is button center position - the overlay size + half of the button to align bottom of overlay with button center
163
-
164
- let minViablePosition = childOffset[crossAxis] + childOffset[crossSize] / 2 - overlaySize[crossSize]; // this is button position of center, aligns top of overlay with button center
165
-
166
- let maxViablePosition = childOffset[crossAxis] + childOffset[crossSize] / 2; // clamp it into the range of the min/max positions
167
-
168
- position[crossAxis] = Math.min(Math.max(minViablePosition, position[crossAxis]), maxViablePosition); // Floor these so the position isn't placed on a partial pixel, only whole pixels. Shouldn't matter if it was floored or ceiled, so chose one.
169
-
170
- if (placement === axis) {
171
- // If the container is positioned (non-static), then we use the container's actual
172
- // height, as `bottom` will be relative to this height. But if the container is static,
173
- // then it can only be the `document.body`, and `bottom` will be relative to _its_
174
- // container, which should be as large as boundaryDimensions.
175
- const containerHeight = isContainerPositioned ? containerOffsetWithBoundary[size] : boundaryDimensions[size];
176
- position[$d45e305fb90d49e7c81f49bb4afe323b$var$FLIPPED_DIRECTION[axis]] = Math.floor(containerHeight - childOffset[axis] + offset);
177
- } else {
178
- position[axis] = Math.floor(childOffset[axis] + childOffset[size] + offset);
179
- }
180
-
181
- return position;
133
+ /* else {
134
+ the overlay top should match the button top
135
+ } */
136
+ // add the crossOffset from props
137
+ position[crossAxis] += crossOffset;
138
+ // this is button center position - the overlay size + half of the button to align bottom of overlay with button center
139
+ let minViablePosition = childOffset[crossAxis] + childOffset[crossSize] / 2 - overlaySize[crossSize];
140
+ // this is button position of center, aligns top of overlay with button center
141
+ let maxViablePosition = childOffset[crossAxis] + childOffset[crossSize] / 2;
142
+ // clamp it into the range of the min/max positions
143
+ position[crossAxis] = Math.min(Math.max(minViablePosition, position[crossAxis]), maxViablePosition);
144
+ // Floor these so the position isn't placed on a partial pixel, only whole pixels. Shouldn't matter if it was floored or ceiled, so chose one.
145
+ if (placement === axis) {
146
+ // If the container is positioned (non-static), then we use the container's actual
147
+ // height, as `bottom` will be relative to this height. But if the container is static,
148
+ // then it can only be the `document.body`, and `bottom` will be relative to _its_
149
+ // container, which should be as large as boundaryDimensions.
150
+ const containerHeight = isContainerPositioned ? containerOffsetWithBoundary[size] : boundaryDimensions[size];
151
+ position[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] = Math.floor(containerHeight - childOffset[axis] + offset);
152
+ } else position[axis] = Math.floor(childOffset[axis] + childOffset[size] + offset);
153
+ return position;
182
154
  }
183
-
184
- function $d45e305fb90d49e7c81f49bb4afe323b$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding) {
185
- return position.top != null // We want the distance between the top of the overlay to the bottom of the boundary
186
- ? Math.max(0, boundaryDimensions.height + boundaryDimensions.top + boundaryDimensions.scroll.top - ( // this is the bottom of the boundary
187
- containerOffsetWithBoundary.top + position.top) // this is the top of the overlay
188
- - (margins.top + margins.bottom + padding) // save additional space for margin and padding
189
- ) // We want the distance between the top of the trigger to the top of the boundary
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
- );
155
+ function $edcf132a9284368a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding) {
156
+ 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
157
+ ) : Math.max(0, childOffset.top + containerOffsetWithBoundary.top - (boundaryDimensions.top + boundaryDimensions.scroll.top) - (margins.top + margins.bottom + padding) // save additional space for margin and padding
158
+ );
194
159
  }
195
-
196
- function $d45e305fb90d49e7c81f49bb4afe323b$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding, placementInfo) {
197
- let {
198
- placement,
199
- axis,
200
- size
201
- } = placementInfo;
202
-
203
- if (placement === axis) {
204
- return Math.max(0, childOffset[axis] - boundaryDimensions[axis] - boundaryDimensions.scroll[axis] + containerOffsetWithBoundary[axis] - margins[axis] - margins[$d45e305fb90d49e7c81f49bb4afe323b$var$FLIPPED_DIRECTION[axis]] - padding);
205
- }
206
-
207
- return Math.max(0, boundaryDimensions[size] + boundaryDimensions[axis] + boundaryDimensions.scroll[axis] - containerOffsetWithBoundary[axis] - childOffset[axis] - childOffset[size] - margins[axis] - margins[$d45e305fb90d49e7c81f49bb4afe323b$var$FLIPPED_DIRECTION[axis]] - padding);
160
+ function $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding, placementInfo) {
161
+ let { placement: placement , axis: axis , size: size } = placementInfo;
162
+ if (placement === axis) return Math.max(0, childOffset[axis] - boundaryDimensions[axis] - boundaryDimensions.scroll[axis] + containerOffsetWithBoundary[axis] - margins[axis] - margins[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] - padding);
163
+ return Math.max(0, boundaryDimensions[size] + boundaryDimensions[axis] + boundaryDimensions.scroll[axis] - containerOffsetWithBoundary[axis] - childOffset[axis] - childOffset[size] - margins[axis] - margins[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] - padding);
208
164
  }
209
-
210
- function $d45e305fb90d49e7c81f49bb4afe323b$export$calculatePositionInternal(placementInput, childOffset, overlaySize, scrollSize, margins, padding, flip, boundaryDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned) {
211
- let placementInfo = $d45e305fb90d49e7c81f49bb4afe323b$var$parsePlacement(placementInput);
212
- let {
213
- size,
214
- crossAxis,
215
- crossSize,
216
- placement,
217
- crossPlacement
218
- } = placementInfo;
219
- let position = $d45e305fb90d49e7c81f49bb4afe323b$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned);
220
- let normalizedOffset = offset;
221
- let space = $d45e305fb90d49e7c81f49bb4afe323b$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, placementInfo); // Check if the scroll size of the overlay is greater than the available space to determine if we need to flip
222
-
223
- if (flip && scrollSize[size] > space) {
224
- let flippedPlacementInfo = $d45e305fb90d49e7c81f49bb4afe323b$var$parsePlacement($d45e305fb90d49e7c81f49bb4afe323b$var$FLIPPED_DIRECTION[placement] + " " + crossPlacement);
225
- let flippedPosition = $d45e305fb90d49e7c81f49bb4afe323b$var$computePosition(childOffset, boundaryDimensions, overlaySize, flippedPlacementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned);
226
- let flippedSpace = $d45e305fb90d49e7c81f49bb4afe323b$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, flippedPlacementInfo); // If the available space for the flipped position is greater than the original available space, flip.
227
-
228
- if (flippedSpace > space) {
229
- placementInfo = flippedPlacementInfo;
230
- position = flippedPosition;
231
- normalizedOffset = offset;
165
+ function $edcf132a9284368a$export$6839422d1f33cee9(placementInput, childOffset, overlaySize, scrollSize, margins, padding, flip, boundaryDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, userSetMaxHeight) {
166
+ let placementInfo = $edcf132a9284368a$var$parsePlacement(placementInput);
167
+ let { size: size , crossAxis: crossAxis , crossSize: crossSize , placement: placement , crossPlacement: crossPlacement } = placementInfo;
168
+ let position = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned);
169
+ let normalizedOffset = offset;
170
+ let space = $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, placementInfo);
171
+ // Check if the scroll size of the overlay is greater than the available space to determine if we need to flip
172
+ if (flip && scrollSize[size] > space) {
173
+ let flippedPlacementInfo = $edcf132a9284368a$var$parsePlacement(`${$edcf132a9284368a$var$FLIPPED_DIRECTION[placement]} ${crossPlacement}`);
174
+ let flippedPosition = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, flippedPlacementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned);
175
+ let flippedSpace = $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, flippedPlacementInfo);
176
+ // If the available space for the flipped position is greater than the original available space, flip.
177
+ if (flippedSpace > space) {
178
+ placementInfo = flippedPlacementInfo;
179
+ position = flippedPosition;
180
+ normalizedOffset = offset;
181
+ }
232
182
  }
233
- }
234
-
235
- let delta = $d45e305fb90d49e7c81f49bb4afe323b$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, padding);
236
- position[crossAxis] += delta;
237
- let maxHeight = $d45e305fb90d49e7c81f49bb4afe323b$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding);
238
- overlaySize.height = Math.min(overlaySize.height, maxHeight);
239
- position = $d45e305fb90d49e7c81f49bb4afe323b$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, normalizedOffset, crossOffset, containerOffsetWithBoundary, isContainerPositioned);
240
- delta = $d45e305fb90d49e7c81f49bb4afe323b$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, padding);
241
- position[crossAxis] += delta;
242
- let arrowPosition = {};
243
- arrowPosition[crossAxis] = childOffset[crossAxis] - position[crossAxis] + childOffset[crossSize] / 2;
244
- return {
245
- position,
246
- maxHeight: maxHeight,
247
- arrowOffsetLeft: arrowPosition.left,
248
- arrowOffsetTop: arrowPosition.top,
249
- placement: placementInfo.placement
250
- };
251
- }
252
- /**
253
- * Determines where to place the overlay with regards to the target and the position of an optional indicator.
254
- */
255
-
256
-
257
- function $d45e305fb90d49e7c81f49bb4afe323b$export$calculatePosition(opts) {
258
- let {
259
- placement,
260
- targetNode,
261
- overlayNode,
262
- scrollNode,
263
- padding,
264
- shouldFlip,
265
- boundaryElement,
266
- offset,
267
- crossOffset
268
- } = opts;
269
- let container = overlayNode.offsetParent || document.body;
270
- let isBodyContainer = container.tagName === 'BODY';
271
- const containerPositionStyle = window.getComputedStyle(container).position;
272
- let isContainerPositioned = !!containerPositionStyle && containerPositionStyle !== 'static';
273
- let childOffset = isBodyContainer ? _domHelpersQueryOffset(targetNode) : _domHelpersQueryPosition(targetNode, container);
274
-
275
- if (!isBodyContainer) {
276
- childOffset.top += parseInt(_domHelpersStyle(targetNode, 'marginTop'), 10) || 0;
277
- childOffset.left += parseInt(_domHelpersStyle(targetNode, 'marginLeft'), 10) || 0;
278
- }
279
-
280
- let overlaySize = _domHelpersQueryOffset(overlayNode);
281
-
282
- let margins = $d45e305fb90d49e7c81f49bb4afe323b$var$getMargins(overlayNode);
283
- overlaySize.width += margins.left + margins.right;
284
- overlaySize.height += margins.top + margins.bottom;
285
- let scrollSize = $d45e305fb90d49e7c81f49bb4afe323b$var$getScroll(scrollNode);
286
- let boundaryDimensions = $d45e305fb90d49e7c81f49bb4afe323b$var$getContainerDimensions(boundaryElement);
287
- let containerOffsetWithBoundary = boundaryElement.tagName === 'BODY' ? _domHelpersQueryOffset(container) : _domHelpersQueryPosition(container, boundaryElement);
288
- return $d45e305fb90d49e7c81f49bb4afe323b$export$calculatePositionInternal(placement, childOffset, overlaySize, scrollSize, margins, padding, shouldFlip, boundaryDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned);
183
+ let delta = $edcf132a9284368a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, padding);
184
+ position[crossAxis] += delta;
185
+ let maxHeight = $edcf132a9284368a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding);
186
+ if (userSetMaxHeight && userSetMaxHeight < maxHeight) maxHeight = userSetMaxHeight;
187
+ overlaySize.height = Math.min(overlaySize.height, maxHeight);
188
+ position = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, normalizedOffset, crossOffset, containerOffsetWithBoundary, isContainerPositioned);
189
+ delta = $edcf132a9284368a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, padding);
190
+ position[crossAxis] += delta;
191
+ let arrowPosition = {
192
+ };
193
+ arrowPosition[crossAxis] = childOffset[crossAxis] - position[crossAxis] + childOffset[crossSize] / 2;
194
+ return {
195
+ position: position,
196
+ maxHeight: maxHeight,
197
+ arrowOffsetLeft: arrowPosition.left,
198
+ arrowOffsetTop: arrowPosition.top,
199
+ placement: placementInfo.placement
200
+ };
289
201
  }
290
-
291
- // This behavior moved from useOverlayTrigger to useOverlayPosition.
292
- // For backward compatibility, where useOverlayTrigger handled hiding the popover on close,
293
- // it sets a close function here mapped from the trigger element. This way we can avoid
294
- // forcing users to pass an onClose function to useOverlayPosition which could be considered
295
- // a breaking change.
296
- const $df1b2f080f58bf9e74aeb666b8c96ba$export$onCloseMap = new WeakMap();
297
-
298
- /** @private */
299
- function $df1b2f080f58bf9e74aeb666b8c96ba$export$useCloseOnScroll(opts) {
300
- let {
301
- triggerRef,
302
- isOpen,
303
- onClose
304
- } = opts;
305
- useEffect(() => {
306
- if (!isOpen) {
307
- return;
202
+ function $edcf132a9284368a$export$b3ceb0cbf1056d98(opts) {
203
+ let { placement: placement , targetNode: targetNode , overlayNode: overlayNode , scrollNode: scrollNode , padding: padding , shouldFlip: shouldFlip , boundaryElement: boundaryElement , offset: offset , crossOffset: crossOffset , maxHeight: maxHeight } = opts;
204
+ let container = overlayNode.offsetParent || document.body;
205
+ let isBodyContainer = container.tagName === 'BODY';
206
+ const containerPositionStyle = window.getComputedStyle(container).position;
207
+ let isContainerPositioned = !!containerPositionStyle && containerPositionStyle !== 'static';
208
+ let childOffset = isBodyContainer ? $k7QOs$domhelpersqueryoffset(targetNode) : $k7QOs$domhelpersqueryposition(targetNode, container);
209
+ if (!isBodyContainer) {
210
+ childOffset.top += parseInt($k7QOs$domhelpersstyle(targetNode, 'marginTop'), 10) || 0;
211
+ childOffset.left += parseInt($k7QOs$domhelpersstyle(targetNode, 'marginLeft'), 10) || 0;
308
212
  }
213
+ let overlaySize = $k7QOs$domhelpersqueryoffset(overlayNode);
214
+ let margins = $edcf132a9284368a$var$getMargins(overlayNode);
215
+ overlaySize.width += margins.left + margins.right;
216
+ overlaySize.height += margins.top + margins.bottom;
217
+ let scrollSize = $edcf132a9284368a$var$getScroll(scrollNode);
218
+ let boundaryDimensions = $edcf132a9284368a$var$getContainerDimensions(boundaryElement);
219
+ let containerOffsetWithBoundary = boundaryElement.tagName === 'BODY' ? $k7QOs$domhelpersqueryoffset(container) : $k7QOs$domhelpersqueryposition(container, boundaryElement);
220
+ return $edcf132a9284368a$export$6839422d1f33cee9(placement, childOffset, overlaySize, scrollSize, margins, padding, shouldFlip, boundaryDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, maxHeight);
221
+ }
309
222
 
310
- let onScroll = e => {
311
- // Ignore if scrolling an scrollable region outside the trigger's tree.
312
- let target = e.target; // window is not a Node and doesn't have contain, but window contains everything
313
-
314
- if (!triggerRef.current || target instanceof Node && !target.contains(triggerRef.current)) {
315
- return;
316
- }
317
223
 
318
- let onCloseHandler = onClose || $df1b2f080f58bf9e74aeb666b8c96ba$export$onCloseMap.get(triggerRef.current);
319
224
 
320
- if (onCloseHandler) {
321
- onCloseHandler();
322
- }
323
- };
324
225
 
325
- window.addEventListener('scroll', onScroll, true);
326
- return () => {
327
- window.removeEventListener('scroll', onScroll, true);
328
- };
329
- }, [isOpen, onClose, triggerRef]);
226
+ const $dd149f63282afbbf$export$f6211563215e3b37 = new WeakMap();
227
+ function $dd149f63282afbbf$export$18fc8428861184da(opts) {
228
+ let { triggerRef: triggerRef , isOpen: isOpen , onClose: onClose } = opts;
229
+ $k7QOs$useEffect(()=>{
230
+ if (!isOpen) return;
231
+ let onScroll = (e)=>{
232
+ // Ignore if scrolling an scrollable region outside the trigger's tree.
233
+ let target = e.target;
234
+ // window is not a Node and doesn't have contain, but window contains everything
235
+ if (!triggerRef.current || target instanceof Node && !target.contains(triggerRef.current)) return;
236
+ let onCloseHandler = onClose || $dd149f63282afbbf$export$f6211563215e3b37.get(triggerRef.current);
237
+ if (onCloseHandler) onCloseHandler();
238
+ };
239
+ window.addEventListener('scroll', onScroll, true);
240
+ return ()=>{
241
+ window.removeEventListener('scroll', onScroll, true);
242
+ };
243
+ }, [
244
+ isOpen,
245
+ onClose,
246
+ triggerRef
247
+ ]);
330
248
  }
331
249
 
332
- // @ts-ignore
333
- let $ae841ee9d3f76b31663cf0594adb0fc$var$visualViewport = typeof window !== 'undefined' && window.visualViewport;
334
- /**
335
- * Handles positioning overlays like popovers and menus relative to a trigger
336
- * element, and updating the position when the window resizes.
337
- */
338
-
339
- export function useOverlayPosition(props) {
340
- let {
341
- direction
342
- } = useLocale();
343
- let {
344
- targetRef,
345
- overlayRef,
346
- scrollRef = overlayRef,
347
- placement = 'bottom',
348
- containerPadding = 12,
349
- shouldFlip = true,
350
- boundaryElement = typeof document !== 'undefined' ? document.body : null,
351
- offset = 0,
352
- crossOffset = 0,
353
- shouldUpdatePosition = true,
354
- isOpen = true,
355
- onClose
356
- } = props;
357
- let [position, setPosition] = useState({
358
- position: {},
359
- arrowOffsetLeft: undefined,
360
- arrowOffsetTop: undefined,
361
- maxHeight: undefined,
362
- placement: undefined
363
- });
364
- let deps = [shouldUpdatePosition, placement, overlayRef.current, targetRef.current, scrollRef.current, containerPadding, shouldFlip, boundaryElement, offset, crossOffset, isOpen, direction];
365
- let updatePosition = useCallback(() => {
366
- if (shouldUpdatePosition === false || !isOpen || !overlayRef.current || !targetRef.current || !scrollRef.current || !boundaryElement) {
367
- return;
368
- }
369
-
370
- setPosition($d45e305fb90d49e7c81f49bb4afe323b$export$calculatePosition({
371
- placement: $ae841ee9d3f76b31663cf0594adb0fc$var$translateRTL(placement, direction),
372
- overlayNode: overlayRef.current,
373
- targetNode: targetRef.current,
374
- scrollNode: scrollRef.current,
375
- padding: containerPadding,
376
- shouldFlip,
377
- boundaryElement,
378
- offset,
379
- crossOffset
380
- }));
381
- }, deps); // Update position when anything changes
382
-
383
- useLayoutEffect(updatePosition, deps); // Update position on window resize
384
250
 
385
- $ae841ee9d3f76b31663cf0594adb0fc$var$useResize(updatePosition); // Reposition the overlay and do not close on scroll while the visual viewport is resizing.
386
- // This will ensure that overlays adjust their positioning when the iOS virtual keyboard appears.
387
251
 
388
- let isResizing = useRef(false);
389
- useLayoutEffect(() => {
390
- let timeout;
391
-
392
- let onResize = () => {
393
- isResizing.current = true;
394
- clearTimeout(timeout);
395
- timeout = setTimeout(() => {
396
- isResizing.current = false;
397
- }, 500);
398
- updatePosition();
399
- };
400
252
 
401
- $ae841ee9d3f76b31663cf0594adb0fc$var$visualViewport == null ? void 0 : $ae841ee9d3f76b31663cf0594adb0fc$var$visualViewport.addEventListener('resize', onResize);
402
- return () => {
403
- $ae841ee9d3f76b31663cf0594adb0fc$var$visualViewport == null ? void 0 : $ae841ee9d3f76b31663cf0594adb0fc$var$visualViewport.removeEventListener('resize', onResize);
253
+ // @ts-ignore
254
+ let $2a41e45df1593e64$var$visualViewport = typeof window !== 'undefined' && window.visualViewport;
255
+ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
256
+ let { direction: direction } = $k7QOs$useLocale();
257
+ 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;
258
+ let [position, setPosition] = $k7QOs$useState({
259
+ position: {
260
+ },
261
+ arrowOffsetLeft: undefined,
262
+ arrowOffsetTop: undefined,
263
+ maxHeight: undefined,
264
+ placement: undefined
265
+ });
266
+ let deps = [
267
+ shouldUpdatePosition,
268
+ placement,
269
+ overlayRef.current,
270
+ targetRef.current,
271
+ scrollRef.current,
272
+ containerPadding,
273
+ shouldFlip,
274
+ boundaryElement,
275
+ offset,
276
+ crossOffset,
277
+ isOpen,
278
+ direction,
279
+ maxHeight
280
+ ];
281
+ let updatePosition = $k7QOs$useCallback(()=>{
282
+ if (shouldUpdatePosition === false || !isOpen || !overlayRef.current || !targetRef.current || !scrollRef.current || !boundaryElement) return;
283
+ setPosition($edcf132a9284368a$export$b3ceb0cbf1056d98({
284
+ placement: $2a41e45df1593e64$var$translateRTL(placement, direction),
285
+ overlayNode: overlayRef.current,
286
+ targetNode: targetRef.current,
287
+ scrollNode: scrollRef.current,
288
+ padding: containerPadding,
289
+ shouldFlip: shouldFlip,
290
+ boundaryElement: boundaryElement,
291
+ offset: offset,
292
+ crossOffset: crossOffset,
293
+ maxHeight: maxHeight
294
+ }));
295
+ }, deps);
296
+ // Update position when anything changes
297
+ $k7QOs$useLayoutEffect(updatePosition, deps);
298
+ // Update position on window resize
299
+ $2a41e45df1593e64$var$useResize(updatePosition);
300
+ // Reposition the overlay and do not close on scroll while the visual viewport is resizing.
301
+ // This will ensure that overlays adjust their positioning when the iOS virtual keyboard appears.
302
+ let isResizing = $k7QOs$useRef(false);
303
+ $k7QOs$useLayoutEffect(()=>{
304
+ let timeout;
305
+ let onResize = ()=>{
306
+ isResizing.current = true;
307
+ clearTimeout(timeout);
308
+ timeout = setTimeout(()=>{
309
+ isResizing.current = false;
310
+ }, 500);
311
+ updatePosition();
312
+ };
313
+ $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.addEventListener('resize', onResize);
314
+ return ()=>{
315
+ $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.removeEventListener('resize', onResize);
316
+ };
317
+ }, [
318
+ updatePosition
319
+ ]);
320
+ let close = $k7QOs$useCallback(()=>{
321
+ if (!isResizing.current) onClose();
322
+ }, [
323
+ onClose,
324
+ isResizing
325
+ ]);
326
+ // When scrolling a parent scrollable region of the trigger (other than the body),
327
+ // we hide the popover. Otherwise, its position would be incorrect.
328
+ $dd149f63282afbbf$export$18fc8428861184da({
329
+ triggerRef: targetRef,
330
+ isOpen: isOpen,
331
+ onClose: onClose ? close : undefined
332
+ });
333
+ return {
334
+ overlayProps: {
335
+ style: {
336
+ position: 'absolute',
337
+ zIndex: 100000,
338
+ ...position.position,
339
+ maxHeight: position.maxHeight
340
+ }
341
+ },
342
+ placement: position.placement,
343
+ arrowProps: {
344
+ style: {
345
+ left: position.arrowOffsetLeft,
346
+ top: position.arrowOffsetTop
347
+ }
348
+ },
349
+ updatePosition: updatePosition
404
350
  };
405
- }, [updatePosition]);
406
- let close = useCallback(() => {
407
- if (!isResizing.current) {
408
- onClose();
409
- }
410
- }, [onClose, isResizing]); // When scrolling a parent scrollable region of the trigger (other than the body),
411
- // we hide the popover. Otherwise, its position would be incorrect.
412
-
413
- $df1b2f080f58bf9e74aeb666b8c96ba$export$useCloseOnScroll({
414
- triggerRef: targetRef,
415
- isOpen,
416
- onClose: onClose ? close : undefined
417
- });
418
- return {
419
- overlayProps: {
420
- style: _babelRuntimeHelpersEsmExtends({
421
- position: 'absolute',
422
- zIndex: 100000
423
- }, position.position, {
424
- maxHeight: position.maxHeight
425
- })
426
- },
427
- placement: position.placement,
428
- arrowProps: {
429
- style: {
430
- left: position.arrowOffsetLeft,
431
- top: position.arrowOffsetTop
432
- }
433
- },
434
- updatePosition
435
- };
436
351
  }
437
-
438
- function $ae841ee9d3f76b31663cf0594adb0fc$var$useResize(onResize) {
439
- useLayoutEffect(() => {
440
- window.addEventListener('resize', onResize, false);
441
- return () => {
442
- window.removeEventListener('resize', onResize, false);
443
- };
444
- }, [onResize]);
352
+ function $2a41e45df1593e64$var$useResize(onResize) {
353
+ $k7QOs$useLayoutEffect(()=>{
354
+ window.addEventListener('resize', onResize, false);
355
+ return ()=>{
356
+ window.removeEventListener('resize', onResize, false);
357
+ };
358
+ }, [
359
+ onResize
360
+ ]);
445
361
  }
446
-
447
- function $ae841ee9d3f76b31663cf0594adb0fc$var$translateRTL(position, direction) {
448
- if (direction === 'rtl') {
449
- return position.replace('start', 'right').replace('end', 'left');
450
- }
451
-
452
- return position.replace('start', 'left').replace('end', 'right');
362
+ function $2a41e45df1593e64$var$translateRTL(position, direction) {
363
+ if (direction === 'rtl') return position.replace('start', 'right').replace('end', 'left');
364
+ return position.replace('start', 'left').replace('end', 'right');
453
365
  }
454
366
 
455
- const $e4d5b842fe0e1058e95712442330b88c$var$visibleOverlays = [];
456
- /**
457
- * Provides the behavior for overlays such as dialogs, popovers, and menus.
458
- * Hides the overlay when the user interacts outside it, when the Escape key is pressed,
459
- * or optionally, on blur. Only the top-most overlay will close at once.
460
- */
461
-
462
- export function useOverlay(props, ref) {
463
- let {
464
- onClose,
465
- shouldCloseOnBlur,
466
- isOpen,
467
- isDismissable = false,
468
- isKeyboardDismissDisabled = false,
469
- shouldCloseOnInteractOutside
470
- } = props; // Add the overlay ref to the stack of visible overlays on mount, and remove on unmount.
471
-
472
- useEffect(() => {
473
- if (isOpen) {
474
- $e4d5b842fe0e1058e95712442330b88c$var$visibleOverlays.push(ref);
475
- }
476
-
477
- return () => {
478
- let index = $e4d5b842fe0e1058e95712442330b88c$var$visibleOverlays.indexOf(ref);
479
367
 
480
- if (index >= 0) {
481
- $e4d5b842fe0e1058e95712442330b88c$var$visibleOverlays.splice(index, 1);
482
- }
368
+ var $a11501f3d1d39e6c$exports = {};
369
+
370
+ $parcel$export($a11501f3d1d39e6c$exports, "useOverlay", () => $a11501f3d1d39e6c$export$ea8f71083e90600f);
371
+
372
+
373
+ const $a11501f3d1d39e6c$var$visibleOverlays = [];
374
+ function $a11501f3d1d39e6c$export$ea8f71083e90600f(props, ref) {
375
+ let { onClose: onClose , shouldCloseOnBlur: shouldCloseOnBlur , isOpen: isOpen , isDismissable: isDismissable = false , isKeyboardDismissDisabled: isKeyboardDismissDisabled = false , shouldCloseOnInteractOutside: shouldCloseOnInteractOutside } = props;
376
+ // Add the overlay ref to the stack of visible overlays on mount, and remove on unmount.
377
+ $k7QOs$useEffect(()=>{
378
+ if (isOpen) $a11501f3d1d39e6c$var$visibleOverlays.push(ref);
379
+ return ()=>{
380
+ let index = $a11501f3d1d39e6c$var$visibleOverlays.indexOf(ref);
381
+ if (index >= 0) $a11501f3d1d39e6c$var$visibleOverlays.splice(index, 1);
382
+ };
383
+ }, [
384
+ isOpen,
385
+ ref
386
+ ]);
387
+ // Only hide the overlay when it is the topmost visible overlay in the stack.
388
+ let onHide = ()=>{
389
+ if ($a11501f3d1d39e6c$var$visibleOverlays[$a11501f3d1d39e6c$var$visibleOverlays.length - 1] === ref && onClose) onClose();
483
390
  };
484
- }, [isOpen, ref]); // Only hide the overlay when it is the topmost visible overlay in the stack.
485
-
486
- let onHide = () => {
487
- if ($e4d5b842fe0e1058e95712442330b88c$var$visibleOverlays[$e4d5b842fe0e1058e95712442330b88c$var$visibleOverlays.length - 1] === ref && onClose) {
488
- onClose();
489
- }
490
- };
491
-
492
- let onInteractOutsideStart = e => {
493
- if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.target)) {
494
- if ($e4d5b842fe0e1058e95712442330b88c$var$visibleOverlays[$e4d5b842fe0e1058e95712442330b88c$var$visibleOverlays.length - 1] === ref) {
495
- e.stopPropagation();
496
- e.preventDefault();
497
- }
498
- }
499
- };
391
+ let onInteractOutsideStart = (e)=>{
392
+ if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.target)) {
393
+ if ($a11501f3d1d39e6c$var$visibleOverlays[$a11501f3d1d39e6c$var$visibleOverlays.length - 1] === ref) {
394
+ e.stopPropagation();
395
+ e.preventDefault();
396
+ }
397
+ }
398
+ };
399
+ let onInteractOutside = (e)=>{
400
+ if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.target)) {
401
+ if ($a11501f3d1d39e6c$var$visibleOverlays[$a11501f3d1d39e6c$var$visibleOverlays.length - 1] === ref) {
402
+ e.stopPropagation();
403
+ e.preventDefault();
404
+ }
405
+ onHide();
406
+ }
407
+ };
408
+ // Handle the escape key
409
+ let onKeyDown = (e)=>{
410
+ if (e.key === 'Escape' && !isKeyboardDismissDisabled) {
411
+ e.preventDefault();
412
+ onHide();
413
+ }
414
+ };
415
+ // Handle clicking outside the overlay to close it
416
+ $k7QOs$useInteractOutside({
417
+ ref: ref,
418
+ onInteractOutside: isDismissable ? onInteractOutside : null,
419
+ onInteractOutsideStart: onInteractOutsideStart
420
+ });
421
+ let { focusWithinProps: focusWithinProps } = $k7QOs$useFocusWithin({
422
+ isDisabled: !shouldCloseOnBlur,
423
+ onBlurWithin: (e)=>{
424
+ if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.relatedTarget)) onClose();
425
+ }
426
+ });
427
+ let onPointerDownUnderlay = (e)=>{
428
+ // fixes a firefox issue that starts text selection https://bugzilla.mozilla.org/show_bug.cgi?id=1675846
429
+ if (e.target === e.currentTarget) e.preventDefault();
430
+ };
431
+ return {
432
+ overlayProps: {
433
+ onKeyDown: onKeyDown,
434
+ ...focusWithinProps
435
+ },
436
+ underlayProps: {
437
+ onPointerDown: onPointerDownUnderlay
438
+ }
439
+ };
440
+ }
500
441
 
501
- let onInteractOutside = e => {
502
- if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.target)) {
503
- if ($e4d5b842fe0e1058e95712442330b88c$var$visibleOverlays[$e4d5b842fe0e1058e95712442330b88c$var$visibleOverlays.length - 1] === ref) {
504
- e.stopPropagation();
505
- e.preventDefault();
506
- }
507
442
 
508
- onHide();
509
- }
510
- }; // Handle the escape key
443
+ var $628037886ba31236$exports = {};
444
+
445
+ $parcel$export($628037886ba31236$exports, "useOverlayTrigger", () => $628037886ba31236$export$f9d5c8beee7d008d);
446
+
447
+
448
+
449
+ function $628037886ba31236$export$f9d5c8beee7d008d(props, state, ref) {
450
+ let { type: type } = props;
451
+ let { isOpen: isOpen } = state;
452
+ // Backward compatibility. Share state close function with useOverlayPosition so it can close on scroll
453
+ // without forcing users to pass onClose.
454
+ $k7QOs$useEffect(()=>{
455
+ if (ref && ref.current) $dd149f63282afbbf$export$f6211563215e3b37.set(ref.current, state.close);
456
+ });
457
+ // Aria 1.1 supports multiple values for aria-haspopup other than just menus.
458
+ // https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup
459
+ // However, we only add it for menus for now because screen readers often
460
+ // announce it as a menu even for other values.
461
+ let ariaHasPopup = undefined;
462
+ if (type === 'menu') ariaHasPopup = true;
463
+ else if (type === 'listbox') ariaHasPopup = 'listbox';
464
+ let overlayId = $k7QOs$useId();
465
+ return {
466
+ triggerProps: {
467
+ 'aria-haspopup': ariaHasPopup,
468
+ 'aria-expanded': isOpen,
469
+ 'aria-controls': isOpen ? overlayId : null
470
+ },
471
+ overlayProps: {
472
+ id: overlayId
473
+ }
474
+ };
475
+ }
511
476
 
512
477
 
513
- let onKeyDown = e => {
514
- if (e.key === 'Escape' && !isKeyboardDismissDisabled) {
515
- e.preventDefault();
516
- onHide();
517
- }
518
- }; // Handle clicking outside the overlay to close it
519
-
520
-
521
- useInteractOutside({
522
- ref,
523
- onInteractOutside: isDismissable ? onInteractOutside : null,
524
- onInteractOutsideStart
525
- });
526
- let {
527
- focusWithinProps
528
- } = useFocusWithin({
529
- isDisabled: !shouldCloseOnBlur,
530
- onBlurWithin: e => {
531
- if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.relatedTarget)) {
532
- onClose();
533
- }
534
- }
535
- });
478
+ var $49c51c25361d4cd2$exports = {};
536
479
 
537
- let onPointerDownUnderlay = e => {
538
- // fixes a firefox issue that starts text selection https://bugzilla.mozilla.org/show_bug.cgi?id=1675846
539
- if (e.target === e.currentTarget) {
540
- e.preventDefault();
541
- }
542
- };
543
-
544
- return {
545
- overlayProps: _babelRuntimeHelpersEsmExtends({
546
- onKeyDown
547
- }, focusWithinProps),
548
- underlayProps: {
549
- onPointerDown: onPointerDownUnderlay
550
- }
551
- };
552
- }
480
+ $parcel$export($49c51c25361d4cd2$exports, "usePreventScroll", () => $49c51c25361d4cd2$export$ee0f7cc6afcd1c18);
553
481
 
554
- /**
555
- * Handles the behavior and accessibility for an overlay trigger, e.g. a button
556
- * that opens a popover, menu, or other overlay that is positioned relative to the trigger.
557
- */
558
- export function useOverlayTrigger(props, state, ref) {
559
- let {
560
- type
561
- } = props;
562
- let {
563
- isOpen
564
- } = state; // Backward compatibility. Share state close function with useOverlayPosition so it can close on scroll
565
- // without forcing users to pass onClose.
566
-
567
- useEffect(() => {
568
- if (ref && ref.current) {
569
- $df1b2f080f58bf9e74aeb666b8c96ba$export$onCloseMap.set(ref.current, state.close);
570
- }
571
- }); // Aria 1.1 supports multiple values for aria-haspopup other than just menus.
572
- // https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup
573
- // However, we only add it for menus for now because screen readers often
574
- // announce it as a menu even for other values.
575
-
576
- let ariaHasPopup = undefined;
577
-
578
- if (type === 'menu') {
579
- ariaHasPopup = true;
580
- } else if (type === 'listbox') {
581
- ariaHasPopup = 'listbox';
582
- }
583
-
584
- let overlayId = useId();
585
- return {
586
- triggerProps: {
587
- 'aria-haspopup': ariaHasPopup,
588
- 'aria-expanded': isOpen,
589
- 'aria-controls': isOpen ? overlayId : null
590
- },
591
- overlayProps: {
592
- id: overlayId
593
- }
594
- };
595
- }
596
482
  // @ts-ignore
597
- const $ece0076f06e8a828c60ba0c94f22f89$var$visualViewport = typeof window !== 'undefined' && window.visualViewport; // HTML input types that do not cause the software keyboard to appear.
598
-
599
- const $ece0076f06e8a828c60ba0c94f22f89$var$nonTextInputTypes = new Set(['checkbox', 'radio', 'range', 'color', 'file', 'image', 'button', 'submit', 'reset']);
600
- /**
601
- * Prevents scrolling on the document body on mount, and
602
- * restores it on unmount. Also ensures that content does not
603
- * shift due to the scrollbars disappearing.
604
- */
605
-
606
- export function usePreventScroll(options) {
607
- if (options === void 0) {
608
- options = {};
609
- }
610
-
611
- let {
612
- isDisabled
613
- } = options;
614
- useLayoutEffect(() => {
615
- if (isDisabled) {
616
- return;
617
- }
618
-
619
- if (isIOS()) {
620
- return $ece0076f06e8a828c60ba0c94f22f89$var$preventScrollMobileSafari();
621
- } else {
622
- return $ece0076f06e8a828c60ba0c94f22f89$var$preventScrollStandard();
623
- }
624
- }, [isDisabled]);
625
- } // For most browsers, all we need to do is set `overflow: hidden` on the root element, and
483
+ const $49c51c25361d4cd2$var$visualViewport = typeof window !== 'undefined' && window.visualViewport;
484
+ // HTML input types that do not cause the software keyboard to appear.
485
+ const $49c51c25361d4cd2$var$nonTextInputTypes = new Set([
486
+ 'checkbox',
487
+ 'radio',
488
+ 'range',
489
+ 'color',
490
+ 'file',
491
+ 'image',
492
+ 'button',
493
+ 'submit',
494
+ 'reset'
495
+ ]);
496
+ function $49c51c25361d4cd2$export$ee0f7cc6afcd1c18(options = {
497
+ }) {
498
+ let { isDisabled: isDisabled } = options;
499
+ $k7QOs$useLayoutEffect(()=>{
500
+ if (isDisabled) return;
501
+ if ($k7QOs$isIOS()) return $49c51c25361d4cd2$var$preventScrollMobileSafari();
502
+ else return $49c51c25361d4cd2$var$preventScrollStandard();
503
+ }, [
504
+ isDisabled
505
+ ]);
506
+ }
507
+ // For most browsers, all we need to do is set `overflow: hidden` on the root element, and
626
508
  // add some padding to prevent the page from shifting when the scrollbar is hidden.
627
-
628
- function $ece0076f06e8a828c60ba0c94f22f89$var$preventScrollStandard() {
629
- return chain($ece0076f06e8a828c60ba0c94f22f89$var$setStyle(document.documentElement, 'paddingRight', window.innerWidth - document.documentElement.clientWidth + "px"), $ece0076f06e8a828c60ba0c94f22f89$var$setStyle(document.documentElement, 'overflow', 'hidden'));
630
- } // Mobile Safari is a whole different beast. Even with overflow: hidden,
509
+ function $49c51c25361d4cd2$var$preventScrollStandard() {
510
+ return $k7QOs$chain($49c51c25361d4cd2$var$setStyle(document.documentElement, 'paddingRight', `${window.innerWidth - document.documentElement.clientWidth}px`), $49c51c25361d4cd2$var$setStyle(document.documentElement, 'overflow', 'hidden'));
511
+ }
512
+ // Mobile Safari is a whole different beast. Even with overflow: hidden,
631
513
  // it still scrolls the page in many situations:
632
514
  //
633
515
  // 1. When the bottom toolbar and address bar are collapsed, page scrolling is always allowed.
@@ -653,397 +535,421 @@ function $ece0076f06e8a828c60ba0c94f22f89$var$preventScrollStandard() {
653
535
  // above work or Safari will still try to scroll the page when focusing an input.
654
536
  // 6. As a last resort, handle window scroll events, and scroll back to the top. This can happen when attempting
655
537
  // to navigate to an input with the next/previous buttons that's outside a modal.
538
+ function $49c51c25361d4cd2$var$preventScrollMobileSafari() {
539
+ let scrollable;
540
+ let lastY = 0;
541
+ let onTouchStart = (e)=>{
542
+ // Store the nearest scrollable parent element from the element that the user touched.
543
+ scrollable = $k7QOs$getScrollParent(e.target);
544
+ if (scrollable === document.documentElement && scrollable === document.body) return;
545
+ lastY = e.changedTouches[0].pageY;
546
+ };
547
+ let onTouchMove = (e)=>{
548
+ // Prevent scrolling the window.
549
+ if (scrollable === document.documentElement || scrollable === document.body) {
550
+ e.preventDefault();
551
+ return;
552
+ }
553
+ // Prevent scrolling up when at the top and scrolling down when at the bottom
554
+ // of a nested scrollable area, otherwise mobile Safari will start scrolling
555
+ // the window instead. Unfortunately, this disables bounce scrolling when at
556
+ // the top but it's the best we can do.
557
+ let y = e.changedTouches[0].pageY;
558
+ let scrollTop = scrollable.scrollTop;
559
+ let bottom = scrollable.scrollHeight - scrollable.clientHeight;
560
+ if (scrollTop <= 0 && y > lastY || scrollTop >= bottom && y < lastY) e.preventDefault();
561
+ lastY = y;
562
+ };
563
+ let onTouchEnd = (e)=>{
564
+ let target = e.target;
565
+ if (target instanceof HTMLInputElement && !$49c51c25361d4cd2$var$nonTextInputTypes.has(target.type)) {
566
+ e.preventDefault();
567
+ // Apply a transform to trick Safari into thinking the input is at the top of the page
568
+ // so it doesn't try to scroll it into view. When tapping on an input, this needs to
569
+ // be done before the "focus" event, so we have to focus the element ourselves.
570
+ target.style.transform = 'translateY(-2000px)';
571
+ target.focus();
572
+ requestAnimationFrame(()=>{
573
+ target.style.transform = '';
574
+ });
575
+ }
576
+ };
577
+ let onFocus = (e)=>{
578
+ let target = e.target;
579
+ if (target instanceof HTMLInputElement && !$49c51c25361d4cd2$var$nonTextInputTypes.has(target.type)) {
580
+ // Transform also needs to be applied in the focus event in cases where focus moves
581
+ // other than tapping on an input directly, e.g. the next/previous buttons in the
582
+ // software keyboard. In these cases, it seems applying the transform in the focus event
583
+ // is good enough, whereas when tapping an input, it must be done before the focus event. 🤷‍♂️
584
+ target.style.transform = 'translateY(-2000px)';
585
+ requestAnimationFrame(()=>{
586
+ target.style.transform = '';
587
+ // This will have prevented the browser from scrolling the focused element into view,
588
+ // so we need to do this ourselves in a way that doesn't cause the whole page to scroll.
589
+ if ($49c51c25361d4cd2$var$visualViewport) {
590
+ if ($49c51c25361d4cd2$var$visualViewport.height < window.innerHeight) // If the keyboard is already visible, do this after one additional frame
591
+ // to wait for the transform to be removed.
592
+ requestAnimationFrame(()=>{
593
+ $49c51c25361d4cd2$var$scrollIntoView(target);
594
+ });
595
+ else // Otherwise, wait for the visual viewport to resize before scrolling so we can
596
+ // measure the correct position to scroll to.
597
+ $49c51c25361d4cd2$var$visualViewport.addEventListener('resize', ()=>$49c51c25361d4cd2$var$scrollIntoView(target)
598
+ , {
599
+ once: true
600
+ });
601
+ }
602
+ });
603
+ }
604
+ };
605
+ let onWindowScroll = ()=>{
606
+ // Last resort. If the window scrolled, scroll it back to the top.
607
+ // It should always be at the top because the body will have a negative margin (see below).
608
+ window.scrollTo(0, 0);
609
+ };
610
+ // Record the original scroll position so we can restore it.
611
+ // Then apply a negative margin to the body to offset it by the scroll position. This will
612
+ // enable us to scroll the window to the top, which is required for the rest of this to work.
613
+ let scrollX = window.pageXOffset;
614
+ let scrollY = window.pageYOffset;
615
+ 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`));
616
+ // Scroll to the top. The negative margin on the body will make this appear the same.
617
+ window.scrollTo(0, 0);
618
+ let removeEvents = $k7QOs$chain($49c51c25361d4cd2$var$addEvent(document, 'touchstart', onTouchStart, {
619
+ passive: false,
620
+ capture: true
621
+ }), $49c51c25361d4cd2$var$addEvent(document, 'touchmove', onTouchMove, {
622
+ passive: false,
623
+ capture: true
624
+ }), $49c51c25361d4cd2$var$addEvent(document, 'touchend', onTouchEnd, {
625
+ passive: false,
626
+ capture: true
627
+ }), $49c51c25361d4cd2$var$addEvent(document, 'focus', onFocus, true), $49c51c25361d4cd2$var$addEvent(window, 'scroll', onWindowScroll));
628
+ return ()=>{
629
+ // Restore styles and scroll the page back to where it was.
630
+ restoreStyles();
631
+ removeEvents();
632
+ window.scrollTo(scrollX, scrollY);
633
+ };
634
+ }
635
+ // Sets a CSS property on an element, and returns a function to revert it to the previous value.
636
+ function $49c51c25361d4cd2$var$setStyle(element, style, value) {
637
+ let cur = element.style[style];
638
+ element.style[style] = value;
639
+ return ()=>{
640
+ element.style[style] = cur;
641
+ };
642
+ }
643
+ // Adds an event listener to an element, and returns a function to remove it.
644
+ function $49c51c25361d4cd2$var$addEvent(target, event, handler, options) {
645
+ target.addEventListener(event, handler, options);
646
+ return ()=>{
647
+ target.removeEventListener(event, handler, options);
648
+ };
649
+ }
650
+ function $49c51c25361d4cd2$var$scrollIntoView(target) {
651
+ // Find the parent scrollable element and adjust the scroll position if the target is not already in view.
652
+ let scrollable = $k7QOs$getScrollParent(target);
653
+ if (scrollable !== document.documentElement && scrollable !== document.body) {
654
+ let scrollableTop = scrollable.getBoundingClientRect().top;
655
+ let targetTop = target.getBoundingClientRect().top;
656
+ if (targetTop > scrollableTop + target.clientHeight) scrollable.scrollTop += targetTop - scrollableTop;
657
+ }
658
+ }
656
659
 
657
660
 
658
- function $ece0076f06e8a828c60ba0c94f22f89$var$preventScrollMobileSafari() {
659
- let scrollable;
660
- let lastY = 0;
661
+ var $f57aed4a881a3485$exports = {};
662
+
663
+ $parcel$export($f57aed4a881a3485$exports, "ModalProvider", () => $f57aed4a881a3485$export$178405afcd8c5eb);
664
+ $parcel$export($f57aed4a881a3485$exports, "useModalProvider", () => $f57aed4a881a3485$export$d9aaed4c3ece1bc0);
665
+ $parcel$export($f57aed4a881a3485$exports, "OverlayProvider", () => $f57aed4a881a3485$export$bf688221f59024e5);
666
+ $parcel$export($f57aed4a881a3485$exports, "OverlayContainer", () => $f57aed4a881a3485$export$b47c3594eab58386);
667
+ $parcel$export($f57aed4a881a3485$exports, "useModal", () => $f57aed4a881a3485$export$33ffd74ebf07f060);
668
+
669
+
670
+ const $f57aed4a881a3485$var$Context = /*#__PURE__*/ $k7QOs$react.createContext(null);
671
+ function $f57aed4a881a3485$export$178405afcd8c5eb(props) {
672
+ let { children: children } = props;
673
+ let parent = $k7QOs$useContext($f57aed4a881a3485$var$Context);
674
+ let [modalCount, setModalCount] = $k7QOs$useState(0);
675
+ let context = $k7QOs$useMemo(()=>({
676
+ parent: parent,
677
+ modalCount: modalCount,
678
+ addModal () {
679
+ setModalCount((count)=>count + 1
680
+ );
681
+ if (parent) parent.addModal();
682
+ },
683
+ removeModal () {
684
+ setModalCount((count)=>count - 1
685
+ );
686
+ if (parent) parent.removeModal();
687
+ }
688
+ })
689
+ , [
690
+ parent,
691
+ modalCount
692
+ ]);
693
+ return(/*#__PURE__*/ $k7QOs$react.createElement($f57aed4a881a3485$var$Context.Provider, {
694
+ value: context
695
+ }, children));
696
+ }
697
+ function $f57aed4a881a3485$export$d9aaed4c3ece1bc0() {
698
+ let context = $k7QOs$useContext($f57aed4a881a3485$var$Context);
699
+ return {
700
+ modalProviderProps: {
701
+ 'aria-hidden': context && context.modalCount > 0 ? true : null
702
+ }
703
+ };
704
+ }
705
+ /**
706
+ * Creates a root node that will be aria-hidden if there are other modals open.
707
+ */ function $f57aed4a881a3485$var$OverlayContainerDOM(props) {
708
+ let { modalProviderProps: modalProviderProps } = $f57aed4a881a3485$export$d9aaed4c3ece1bc0();
709
+ return(/*#__PURE__*/ $k7QOs$react.createElement("div", {
710
+ "data-overlay-container": true,
711
+ ...props,
712
+ ...modalProviderProps
713
+ }));
714
+ }
715
+ function $f57aed4a881a3485$export$bf688221f59024e5(props) {
716
+ return(/*#__PURE__*/ $k7QOs$react.createElement($f57aed4a881a3485$export$178405afcd8c5eb, null, /*#__PURE__*/ $k7QOs$react.createElement($f57aed4a881a3485$var$OverlayContainerDOM, props)));
717
+ }
718
+ function $f57aed4a881a3485$export$b47c3594eab58386(props) {
719
+ let { portalContainer: portalContainer = document.body , ...rest } = props;
720
+ $k7QOs$react.useEffect(()=>{
721
+ if (portalContainer.closest('[data-overlay-container]')) throw new Error('An OverlayContainer must not be inside another container. Please change the portalContainer prop.');
722
+ }, [
723
+ portalContainer
724
+ ]);
725
+ let contents = /*#__PURE__*/ $k7QOs$react.createElement($f57aed4a881a3485$export$bf688221f59024e5, rest);
726
+ return(/*#__PURE__*/ $k7QOs$reactdom.createPortal(contents, portalContainer));
727
+ }
728
+ function $f57aed4a881a3485$export$33ffd74ebf07f060(options) {
729
+ // Add aria-hidden to all parent providers on mount, and restore on unmount.
730
+ let context = $k7QOs$useContext($f57aed4a881a3485$var$Context);
731
+ if (!context) throw new Error('Modal is not contained within a provider');
732
+ $k7QOs$useEffect(()=>{
733
+ if ((options === null || options === void 0 ? void 0 : options.isDisabled) || !context || !context.parent) return;
734
+ // The immediate context is from the provider containing this modal, so we only
735
+ // want to trigger aria-hidden on its parents not on the modal provider itself.
736
+ context.parent.addModal();
737
+ return ()=>{
738
+ if (context && context.parent) context.parent.removeModal();
739
+ };
740
+ }, [
741
+ context,
742
+ context.parent,
743
+ options === null || options === void 0 ? void 0 : options.isDisabled
744
+ ]);
745
+ return {
746
+ modalProps: {
747
+ 'data-ismodal': !(options === null || options === void 0 ? void 0 : options.isDisabled)
748
+ }
749
+ };
750
+ }
661
751
 
662
- let onTouchStart = e => {
663
- // Store the nearest scrollable parent element from the element that the user touched.
664
- scrollable = getScrollParent(e.target);
665
752
 
666
- if (scrollable === document.documentElement && scrollable === document.body) {
667
- return;
668
- }
753
+ var $86ea4cb521eb2e37$exports = {};
669
754
 
670
- lastY = e.changedTouches[0].pageY;
671
- };
755
+ $parcel$export($86ea4cb521eb2e37$exports, "DismissButton", () => $86ea4cb521eb2e37$export$2317d149ed6f78c4);
756
+ var $61fe14465afefc5e$exports = {};
757
+ var $773d5888b972f1cf$exports = {};
758
+ $773d5888b972f1cf$exports = JSON.parse("{\"dismiss\":\"تجاهل\"}");
672
759
 
673
- let onTouchMove = e => {
674
- // Prevent scrolling the window.
675
- if (scrollable === document.documentElement || scrollable === document.body) {
676
- e.preventDefault();
677
- return;
678
- } // Prevent scrolling up when at the top and scrolling down when at the bottom
679
- // of a nested scrollable area, otherwise mobile Safari will start scrolling
680
- // the window instead. Unfortunately, this disables bounce scrolling when at
681
- // the top but it's the best we can do.
682
760
 
761
+ var $d11f19852b941573$exports = {};
762
+ $d11f19852b941573$exports = JSON.parse("{\"dismiss\":\"Отхвърляне\"}");
683
763
 
684
- let y = e.changedTouches[0].pageY;
685
- let scrollTop = scrollable.scrollTop;
686
- let bottom = scrollable.scrollHeight - scrollable.clientHeight;
687
764
 
688
- if (scrollTop <= 0 && y > lastY || scrollTop >= bottom && y < lastY) {
689
- e.preventDefault();
690
- }
765
+ var $b983974c2ee1efb3$exports = {};
766
+ $b983974c2ee1efb3$exports = JSON.parse("{\"dismiss\":\"Odstranit\"}");
691
767
 
692
- lastY = y;
693
- };
694
768
 
695
- let onTouchEnd = e => {
696
- let target = e.target;
769
+ var $5809cc9d4e92de73$exports = {};
770
+ $5809cc9d4e92de73$exports = JSON.parse("{\"dismiss\":\"Luk\"}");
697
771
 
698
- if (target instanceof HTMLInputElement && !$ece0076f06e8a828c60ba0c94f22f89$var$nonTextInputTypes.has(target.type)) {
699
- e.preventDefault(); // Apply a transform to trick Safari into thinking the input is at the top of the page
700
- // so it doesn't try to scroll it into view. When tapping on an input, this needs to
701
- // be done before the "focus" event, so we have to focus the element ourselves.
702
772
 
703
- target.style.transform = 'translateY(-2000px)';
704
- target.focus();
705
- requestAnimationFrame(() => {
706
- target.style.transform = '';
707
- });
708
- }
709
- };
710
-
711
- let onFocus = e => {
712
- let target = e.target;
713
-
714
- if (target instanceof HTMLInputElement && !$ece0076f06e8a828c60ba0c94f22f89$var$nonTextInputTypes.has(target.type)) {
715
- // Transform also needs to be applied in the focus event in cases where focus moves
716
- // software keyboard. In these cases, it seems applying the transform in the focus event
717
- // is good enough, whereas when tapping an input, it must be done before the focus event. 🤷‍♂️
718
- target.style.transform = 'translateY(-2000px)';
719
- requestAnimationFrame(() => {
720
- target.style.transform = ''; // This will have prevented the browser from scrolling the focused element into view,
721
- // so we need to do this ourselves in a way that doesn't cause the whole page to scroll.
722
-
723
- if ($ece0076f06e8a828c60ba0c94f22f89$var$visualViewport) {
724
- if ($ece0076f06e8a828c60ba0c94f22f89$var$visualViewport.height < window.innerHeight) {
725
- // If the keyboard is already visible, do this after one additional frame
726
- // to wait for the transform to be removed.
727
- requestAnimationFrame(() => {
728
- $ece0076f06e8a828c60ba0c94f22f89$var$scrollIntoView(target);
729
- });
730
- } else {
731
- // Otherwise, wait for the visual viewport to resize before scrolling so we can
732
- // measure the correct position to scroll to.
733
- $ece0076f06e8a828c60ba0c94f22f89$var$visualViewport.addEventListener('resize', () => $ece0076f06e8a828c60ba0c94f22f89$var$scrollIntoView(target), {
734
- once: true
735
- });
736
- }
737
- }
738
- });
739
- }
740
- };
773
+ var $c68c2e4fc74398d1$exports = {};
774
+ $c68c2e4fc74398d1$exports = JSON.parse("{\"dismiss\":\"Schließen\"}");
741
775
 
742
- let onWindowScroll = () => {
743
- // Last resort. If the window scrolled, scroll it back to the top.
744
- // It should always be at the top because the body will have a negative margin (see below).
745
- window.scrollTo(0, 0);
746
- }; // Record the original scroll position so we can restore it.
747
- // Then apply a negative margin to the body to offset it by the scroll position. This will
748
- // enable us to scroll the window to the top, which is required for the rest of this to work.
749
-
750
-
751
- let scrollX = window.pageXOffset;
752
- let scrollY = window.pageYOffset;
753
- let restoreStyles = chain($ece0076f06e8a828c60ba0c94f22f89$var$setStyle(document.documentElement, 'paddingRight', window.innerWidth - document.documentElement.clientWidth + "px"), $ece0076f06e8a828c60ba0c94f22f89$var$setStyle(document.documentElement, 'overflow', 'hidden'), $ece0076f06e8a828c60ba0c94f22f89$var$setStyle(document.body, 'marginTop', "-" + scrollY + "px")); // Scroll to the top. The negative margin on the body will make this appear the same.
754
-
755
- window.scrollTo(0, 0);
756
- let removeEvents = chain($ece0076f06e8a828c60ba0c94f22f89$var$addEvent(document, 'touchstart', onTouchStart, {
757
- passive: false,
758
- capture: true
759
- }), $ece0076f06e8a828c60ba0c94f22f89$var$addEvent(document, 'touchmove', onTouchMove, {
760
- passive: false,
761
- capture: true
762
- }), $ece0076f06e8a828c60ba0c94f22f89$var$addEvent(document, 'touchend', onTouchEnd, {
763
- passive: false,
764
- capture: true
765
- }), $ece0076f06e8a828c60ba0c94f22f89$var$addEvent(document, 'focus', onFocus, true), $ece0076f06e8a828c60ba0c94f22f89$var$addEvent(window, 'scroll', onWindowScroll));
766
- return () => {
767
- // Restore styles and scroll the page back to where it was.
768
- restoreStyles();
769
- removeEvents();
770
- window.scrollTo(scrollX, scrollY);
771
- };
772
- } // Sets a CSS property on an element, and returns a function to revert it to the previous value.
773
-
774
-
775
- function $ece0076f06e8a828c60ba0c94f22f89$var$setStyle(element, style, value) {
776
- let cur = element.style[style];
777
- element.style[style] = value;
778
- return () => {
779
- element.style[style] = cur;
780
- };
781
- } // Adds an event listener to an element, and returns a function to remove it.
782
-
783
-
784
- function $ece0076f06e8a828c60ba0c94f22f89$var$addEvent(target, event, handler, options) {
785
- target.addEventListener(event, handler, options);
786
- return () => {
787
- target.removeEventListener(event, handler, options);
788
- };
789
- }
790
776
 
791
- function $ece0076f06e8a828c60ba0c94f22f89$var$scrollIntoView(target) {
792
- // Find the parent scrollable element and adjust the scroll position if the target is not already in view.
793
- let scrollable = getScrollParent(target);
777
+ var $0898b4c153db2b77$exports = {};
778
+ $0898b4c153db2b77$exports = JSON.parse("{\"dismiss\":\"Απόρριψη\"}");
794
779
 
795
- if (scrollable !== document.documentElement && scrollable !== document.body) {
796
- let scrollableTop = scrollable.getBoundingClientRect().top;
797
- let targetTop = target.getBoundingClientRect().top;
798
780
 
799
- if (targetTop > scrollableTop + target.clientHeight) {
800
- scrollable.scrollTop += targetTop - scrollableTop;
801
- }
802
- }
803
- }
781
+ var $6d74810286a15183$exports = {};
782
+ $6d74810286a15183$exports = JSON.parse("{\"dismiss\":\"Dismiss\"}");
804
783
 
805
- const $b876e5ac9c98db373bf726bce3d604e$var$Context = /*#__PURE__*/_react.createContext(null);
806
- /**
807
- * Each ModalProvider tracks how many modals are open in its subtree. On mount, the modals
808
- * trigger `addModal` to increment the count, and trigger `removeModal` on unmount to decrement it.
809
- * This is done recursively so that all parent providers are incremented and decremented.
810
- * If the modal count is greater than zero, we add `aria-hidden` to this provider to hide its
811
- * subtree from screen readers. This is done using React context in order to account for things
812
- * like portals, which can cause the React tree and the DOM tree to differ significantly in structure.
813
- */
814
-
815
-
816
- export function ModalProvider(props) {
817
- let {
818
- children
819
- } = props;
820
- let parent = useContext($b876e5ac9c98db373bf726bce3d604e$var$Context);
821
- let [modalCount, setModalCount] = useState(0);
822
- let context = useMemo(() => ({
823
- parent,
824
- modalCount,
825
-
826
- addModal() {
827
- setModalCount(count => count + 1);
828
-
829
- if (parent) {
830
- parent.addModal();
831
- }
832
- },
833
-
834
- removeModal() {
835
- setModalCount(count => count - 1);
836
-
837
- if (parent) {
838
- parent.removeModal();
839
- }
840
- }
841
784
 
842
- }), [parent, modalCount]);
843
- return /*#__PURE__*/_react.createElement($b876e5ac9c98db373bf726bce3d604e$var$Context.Provider, {
844
- value: context
845
- }, children);
846
- }
785
+ var $309d73dc65f78055$exports = {};
786
+ $309d73dc65f78055$exports = JSON.parse("{\"dismiss\":\"Descartar\"}");
847
787
 
848
- /**
849
- * Used to determine if the tree should be aria-hidden based on how many
850
- * modals are open.
851
- */
852
- export function useModalProvider() {
853
- let context = useContext($b876e5ac9c98db373bf726bce3d604e$var$Context);
854
- return {
855
- modalProviderProps: {
856
- 'aria-hidden': context && context.modalCount > 0 ? true : null
857
- }
858
- };
859
- }
860
- /**
861
- * Creates a root node that will be aria-hidden if there are other modals open.
862
- */
863
-
864
- function $b876e5ac9c98db373bf726bce3d604e$var$OverlayContainerDOM(props) {
865
- let {
866
- modalProviderProps
867
- } = useModalProvider();
868
- return /*#__PURE__*/_react.createElement("div", _babelRuntimeHelpersEsmExtends({
869
- "data-overlay-container": true
870
- }, props, modalProviderProps));
871
- }
872
- /**
873
- * An OverlayProvider acts as a container for the top-level application.
874
- * Any application that uses modal dialogs or other overlays should
875
- * be wrapped in a `<OverlayProvider>`. This is used to ensure that
876
- * the main content of the application is hidden from screen readers
877
- * if a modal or other overlay is opened. Only the top-most modal or
878
- * overlay should be accessible at once.
879
- */
880
788
 
789
+ var $44ad94f7205cf593$exports = {};
790
+ $44ad94f7205cf593$exports = JSON.parse("{\"dismiss\":\"Lõpeta\"}");
881
791
 
882
- export function OverlayProvider(props) {
883
- return /*#__PURE__*/_react.createElement(ModalProvider, null, /*#__PURE__*/_react.createElement($b876e5ac9c98db373bf726bce3d604e$var$OverlayContainerDOM, props));
884
- }
885
792
 
886
- /**
887
- * A container for overlays like modals and popovers. Renders the overlay
888
- * into a Portal which is placed at the end of the document body.
889
- * Also ensures that the overlay is hidden from screen readers if a
890
- * nested modal is opened. Only the top-most modal or overlay should
891
- * be accessible at once.
892
- */
893
- export function OverlayContainer(props) {
894
- let {
895
- portalContainer = document.body
896
- } = props,
897
- rest = _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose(props, ["portalContainer"]);
898
-
899
- _react.useEffect(() => {
900
- if (portalContainer.closest('[data-overlay-container]')) {
901
- throw new Error('An OverlayContainer must not be inside another container. Please change the portalContainer prop.');
902
- }
903
- }, [portalContainer]);
793
+ var $7c28f5687f0779a9$exports = {};
794
+ $7c28f5687f0779a9$exports = JSON.parse("{\"dismiss\":\"Hylkää\"}");
904
795
 
905
- let contents = /*#__PURE__*/_react.createElement(OverlayProvider, rest);
906
796
 
907
- return /*#__PURE__*/_reactDom.createPortal(contents, portalContainer);
908
- }
797
+ var $e6d75df4b68bd73a$exports = {};
798
+ $e6d75df4b68bd73a$exports = JSON.parse("{\"dismiss\":\"Rejeter\"}");
909
799
 
910
- /**
911
- * Hides content outside the current `<OverlayContainer>` from screen readers
912
- * on mount and restores it on unmount. Typically used by modal dialogs and
913
- * other types of overlays to ensure that only the top-most modal is
914
- * accessible at once.
915
- */
916
- export function useModal(options) {
917
- // Add aria-hidden to all parent providers on mount, and restore on unmount.
918
- let context = useContext($b876e5ac9c98db373bf726bce3d604e$var$Context);
919
-
920
- if (!context) {
921
- throw new Error('Modal is not contained within a provider');
922
- }
923
-
924
- useEffect(() => {
925
- if (options != null && options.isDisabled || !context || !context.parent) {
926
- return;
927
- } // The immediate context is from the provider containing this modal, so we only
928
- // want to trigger aria-hidden on its parents not on the modal provider itself.
929
-
930
-
931
- context.parent.addModal();
932
- return () => {
933
- if (context && context.parent) {
934
- context.parent.removeModal();
935
- }
800
+
801
+ var $87505c9dab186d0f$exports = {};
802
+ $87505c9dab186d0f$exports = JSON.parse("{\"dismiss\":\"התעלם\"}");
803
+
804
+
805
+ var $553439c3ffb3e492$exports = {};
806
+ $553439c3ffb3e492$exports = JSON.parse("{\"dismiss\":\"Odbaci\"}");
807
+
808
+
809
+ var $74cf411061b983a2$exports = {};
810
+ $74cf411061b983a2$exports = JSON.parse("{\"dismiss\":\"Elutasítás\"}");
811
+
812
+
813
+ var $e933f298574dc435$exports = {};
814
+ $e933f298574dc435$exports = JSON.parse("{\"dismiss\":\"Ignora\"}");
815
+
816
+
817
+ var $ac91fc9fe02f71f6$exports = {};
818
+ $ac91fc9fe02f71f6$exports = JSON.parse("{\"dismiss\":\"閉じる\"}");
819
+
820
+
821
+ var $52b96f86422025af$exports = {};
822
+ $52b96f86422025af$exports = JSON.parse("{\"dismiss\":\"무시\"}");
823
+
824
+
825
+ var $c0d724c3e51dafa6$exports = {};
826
+ $c0d724c3e51dafa6$exports = JSON.parse("{\"dismiss\":\"Atmesti\"}");
827
+
828
+
829
+ var $c92899672a3fe72e$exports = {};
830
+ $c92899672a3fe72e$exports = JSON.parse("{\"dismiss\":\"Nerādīt\"}");
831
+
832
+
833
+ var $9f576b39d8e7a9d6$exports = {};
834
+ $9f576b39d8e7a9d6$exports = JSON.parse("{\"dismiss\":\"Lukk\"}");
835
+
836
+
837
+ var $9d025808aeec81a7$exports = {};
838
+ $9d025808aeec81a7$exports = JSON.parse("{\"dismiss\":\"Negeren\"}");
839
+
840
+
841
+ var $fce709921e2c0fa6$exports = {};
842
+ $fce709921e2c0fa6$exports = JSON.parse("{\"dismiss\":\"Zignoruj\"}");
843
+
844
+
845
+ var $2599cf0c4ab37f59$exports = {};
846
+ $2599cf0c4ab37f59$exports = JSON.parse("{\"dismiss\":\"Descartar\"}");
847
+
848
+
849
+ var $3c220ae7ef8a35fd$exports = {};
850
+ $3c220ae7ef8a35fd$exports = JSON.parse("{\"dismiss\":\"Dispensar\"}");
851
+
852
+
853
+ var $93562b5094072f54$exports = {};
854
+ $93562b5094072f54$exports = JSON.parse("{\"dismiss\":\"Revocare\"}");
855
+
856
+
857
+ var $cd9e2abd0d06c7b4$exports = {};
858
+ $cd9e2abd0d06c7b4$exports = JSON.parse("{\"dismiss\":\"Пропустить\"}");
859
+
860
+
861
+ var $45375701f409adf1$exports = {};
862
+ $45375701f409adf1$exports = JSON.parse("{\"dismiss\":\"Zrušiť\"}");
863
+
864
+
865
+ var $27fab53a576de9dd$exports = {};
866
+ $27fab53a576de9dd$exports = JSON.parse("{\"dismiss\":\"Opusti\"}");
867
+
868
+
869
+ var $4438748d9952e7c7$exports = {};
870
+ $4438748d9952e7c7$exports = JSON.parse("{\"dismiss\":\"Odbaci\"}");
871
+
872
+
873
+ var $0936d7347ef4da4c$exports = {};
874
+ $0936d7347ef4da4c$exports = JSON.parse("{\"dismiss\":\"Avvisa\"}");
875
+
876
+
877
+ var $29700c92185d38f8$exports = {};
878
+ $29700c92185d38f8$exports = JSON.parse("{\"dismiss\":\"Kapat\"}");
879
+
880
+
881
+ var $662ccaf2be4c25b3$exports = {};
882
+ $662ccaf2be4c25b3$exports = JSON.parse("{\"dismiss\":\"Скасувати\"}");
883
+
884
+
885
+ var $d80a27deda7cdb3c$exports = {};
886
+ $d80a27deda7cdb3c$exports = JSON.parse("{\"dismiss\":\"取消\"}");
887
+
888
+
889
+ var $2b2734393847c884$exports = {};
890
+ $2b2734393847c884$exports = JSON.parse("{\"dismiss\":\"關閉\"}");
891
+
892
+
893
+ $61fe14465afefc5e$exports = {
894
+ "ar-AE": $773d5888b972f1cf$exports,
895
+ "bg-BG": $d11f19852b941573$exports,
896
+ "cs-CZ": $b983974c2ee1efb3$exports,
897
+ "da-DK": $5809cc9d4e92de73$exports,
898
+ "de-DE": $c68c2e4fc74398d1$exports,
899
+ "el-GR": $0898b4c153db2b77$exports,
900
+ "en-US": $6d74810286a15183$exports,
901
+ "es-ES": $309d73dc65f78055$exports,
902
+ "et-EE": $44ad94f7205cf593$exports,
903
+ "fi-FI": $7c28f5687f0779a9$exports,
904
+ "fr-FR": $e6d75df4b68bd73a$exports,
905
+ "he-IL": $87505c9dab186d0f$exports,
906
+ "hr-HR": $553439c3ffb3e492$exports,
907
+ "hu-HU": $74cf411061b983a2$exports,
908
+ "it-IT": $e933f298574dc435$exports,
909
+ "ja-JP": $ac91fc9fe02f71f6$exports,
910
+ "ko-KR": $52b96f86422025af$exports,
911
+ "lt-LT": $c0d724c3e51dafa6$exports,
912
+ "lv-LV": $c92899672a3fe72e$exports,
913
+ "nb-NO": $9f576b39d8e7a9d6$exports,
914
+ "nl-NL": $9d025808aeec81a7$exports,
915
+ "pl-PL": $fce709921e2c0fa6$exports,
916
+ "pt-BR": $2599cf0c4ab37f59$exports,
917
+ "pt-PT": $3c220ae7ef8a35fd$exports,
918
+ "ro-RO": $93562b5094072f54$exports,
919
+ "ru-RU": $cd9e2abd0d06c7b4$exports,
920
+ "sk-SK": $45375701f409adf1$exports,
921
+ "sl-SI": $27fab53a576de9dd$exports,
922
+ "sr-SP": $4438748d9952e7c7$exports,
923
+ "sv-SE": $0936d7347ef4da4c$exports,
924
+ "tr-TR": $29700c92185d38f8$exports,
925
+ "uk-UA": $662ccaf2be4c25b3$exports,
926
+ "zh-CN": $d80a27deda7cdb3c$exports,
927
+ "zh-TW": $2b2734393847c884$exports
928
+ };
929
+
930
+
931
+
932
+
933
+
934
+
935
+ function $86ea4cb521eb2e37$export$2317d149ed6f78c4(props) {
936
+ let { onDismiss: onDismiss , ...otherProps } = props;
937
+ let formatMessage = $k7QOs$useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($61fe14465afefc5e$exports)));
938
+ let labels = $k7QOs$useLabels(otherProps, formatMessage('dismiss'));
939
+ let onClick = ()=>{
940
+ if (onDismiss) onDismiss();
936
941
  };
937
- }, [context, context.parent, options == null ? void 0 : options.isDisabled]);
938
- return {
939
- modalProps: {
940
- 'data-ismodal': !(options != null && options.isDisabled)
941
- }
942
- };
942
+ return(/*#__PURE__*/ $k7QOs$react.createElement($k7QOs$VisuallyHidden, null, /*#__PURE__*/ $k7QOs$react.createElement("button", {
943
+ ...labels,
944
+ tabIndex: -1,
945
+ onClick: onClick
946
+ })));
943
947
  }
944
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/ar-AE.json
945
- var $e325a364098e05bf51160d06dcffdbe$exports = {};
946
- $e325a364098e05bf51160d06dcffdbe$exports = JSON.parse("{\"dismiss\":\"تجاهل\"}");
947
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/bg-BG.json
948
- var $ab088cc547d59c1be83369f8351a064$exports = {};
949
- $ab088cc547d59c1be83369f8351a064$exports = JSON.parse("{\"dismiss\":\"Отхвърляне\"}");
950
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/cs-CZ.json
951
- var $cec67ea16ca47059e10ca5e77187d8c2$exports = {};
952
- $cec67ea16ca47059e10ca5e77187d8c2$exports = JSON.parse("{\"dismiss\":\"Odstranit\"}");
953
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/da-DK.json
954
- var $d962fe1ed718c5ca37da1414136036f8$exports = {};
955
- $d962fe1ed718c5ca37da1414136036f8$exports = JSON.parse("{\"dismiss\":\"Luk\"}");
956
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/de-DE.json
957
- var $c5167dda40dde69038848f007e5$exports = {};
958
- $c5167dda40dde69038848f007e5$exports = JSON.parse("{\"dismiss\":\"Schließen\"}");
959
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/el-GR.json
960
- var $ecdd1ac0020e47f58a9ed51b5fb$exports = {};
961
- $ecdd1ac0020e47f58a9ed51b5fb$exports = JSON.parse("{\"dismiss\":\"Απόρριψη\"}");
962
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/en-US.json
963
- var $f33e30a89f4dff807f90ebe8c$exports = {};
964
- $f33e30a89f4dff807f90ebe8c$exports = JSON.parse("{\"dismiss\":\"Dismiss\"}");
965
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/es-ES.json
966
- var $ba353e2c61dcc5141af4537eeb3ef85c$exports = {};
967
- $ba353e2c61dcc5141af4537eeb3ef85c$exports = JSON.parse("{\"dismiss\":\"Descartar\"}");
968
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/et-EE.json
969
- var $dd3e8aaecbf1f2c2c0f9d51aacfd$exports = {};
970
- $dd3e8aaecbf1f2c2c0f9d51aacfd$exports = JSON.parse("{\"dismiss\":\"Lõpeta\"}");
971
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/fi-FI.json
972
- var $f730aaed9f4652842b2a8f94a4a$exports = {};
973
- $f730aaed9f4652842b2a8f94a4a$exports = JSON.parse("{\"dismiss\":\"Hylkää\"}");
974
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/fr-FR.json
975
- var $e76b22aab4e46b7806205b4af9ca3$exports = {};
976
- $e76b22aab4e46b7806205b4af9ca3$exports = JSON.parse("{\"dismiss\":\"Rejeter\"}");
977
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/he-IL.json
978
- var $c33ffdd5a9931bfc82c1c9b55e98de2f$exports = {};
979
- $c33ffdd5a9931bfc82c1c9b55e98de2f$exports = JSON.parse("{\"dismiss\":\"התעלם\"}");
980
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/hr-HR.json
981
- var $d64cb70d4ce170f599f4df5adf4e9898$exports = {};
982
- $d64cb70d4ce170f599f4df5adf4e9898$exports = JSON.parse("{\"dismiss\":\"Odbaci\"}");
983
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/hu-HU.json
984
- var $c05270a6513a8b6d8a6552a35a162$exports = {};
985
- $c05270a6513a8b6d8a6552a35a162$exports = JSON.parse("{\"dismiss\":\"Elutasítás\"}");
986
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/it-IT.json
987
- var $df915df637af1f3c14c8376c69dfd$exports = {};
988
- $df915df637af1f3c14c8376c69dfd$exports = JSON.parse("{\"dismiss\":\"Ignora\"}");
989
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/ja-JP.json
990
- var $e8bf1e6480d2c65d558c3537ec0d59ce$exports = {};
991
- $e8bf1e6480d2c65d558c3537ec0d59ce$exports = JSON.parse("{\"dismiss\":\"閉じる\"}");
992
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/ko-KR.json
993
- var $e06e93e1c9472a7e2fc5b26a87ea7$exports = {};
994
- $e06e93e1c9472a7e2fc5b26a87ea7$exports = JSON.parse("{\"dismiss\":\"무시\"}");
995
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/lt-LT.json
996
- var $fef82498418eab30c69349263b64e050$exports = {};
997
- $fef82498418eab30c69349263b64e050$exports = JSON.parse("{\"dismiss\":\"Atmesti\"}");
998
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/lv-LV.json
999
- var $c4df2502cb7b65c6578bcb8a165f6fc$exports = {};
1000
- $c4df2502cb7b65c6578bcb8a165f6fc$exports = JSON.parse("{\"dismiss\":\"Nerādīt\"}");
1001
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/nb-NO.json
1002
- var $b50f4e499c19f4d55113139bba$exports = {};
1003
- $b50f4e499c19f4d55113139bba$exports = JSON.parse("{\"dismiss\":\"Lukk\"}");
1004
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/nl-NL.json
1005
- var $e45d2f0079f29e4f5c6469cca7c$exports = {};
1006
- $e45d2f0079f29e4f5c6469cca7c$exports = JSON.parse("{\"dismiss\":\"Negeren\"}");
1007
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/pl-PL.json
1008
- var $fcb5bfa87b2378a249bd7fb591ec22c2$exports = {};
1009
- $fcb5bfa87b2378a249bd7fb591ec22c2$exports = JSON.parse("{\"dismiss\":\"Zignoruj\"}");
1010
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/pt-BR.json
1011
- var $edae5c6f18c937cf0015f2aa266d9fea$exports = {};
1012
- $edae5c6f18c937cf0015f2aa266d9fea$exports = JSON.parse("{\"dismiss\":\"Descartar\"}");
1013
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/pt-PT.json
1014
- var $c016edcd88f37a017208da7518133d$exports = {};
1015
- $c016edcd88f37a017208da7518133d$exports = JSON.parse("{\"dismiss\":\"Dispensar\"}");
1016
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/ro-RO.json
1017
- var $df1162b231d383d942e0fdb2bbf$exports = {};
1018
- $df1162b231d383d942e0fdb2bbf$exports = JSON.parse("{\"dismiss\":\"Revocare\"}");
1019
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/ru-RU.json
1020
- var $fa17537bfd201c57fa41fd31dbd9f074$exports = {};
1021
- $fa17537bfd201c57fa41fd31dbd9f074$exports = JSON.parse("{\"dismiss\":\"Пропустить\"}");
1022
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/sk-SK.json
1023
- var $c30db5bcff54a9e266ee7379a6cb8$exports = {};
1024
- $c30db5bcff54a9e266ee7379a6cb8$exports = JSON.parse("{\"dismiss\":\"Zrušiť\"}");
1025
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/sl-SI.json
1026
- var $c86d8cad7c0045ad51a1fea185411a61$exports = {};
1027
- $c86d8cad7c0045ad51a1fea185411a61$exports = JSON.parse("{\"dismiss\":\"Opusti\"}");
1028
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/sr-SP.json
1029
- var $c610b0b50ebc0061e6c42c420a2e1be$exports = {};
1030
- $c610b0b50ebc0061e6c42c420a2e1be$exports = JSON.parse("{\"dismiss\":\"Odbaci\"}");
1031
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/sv-SE.json
1032
- var $c298c5c92c55ce8d8289d8cc18ea512$exports = {};
1033
- $c298c5c92c55ce8d8289d8cc18ea512$exports = JSON.parse("{\"dismiss\":\"Avvisa\"}");
1034
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/tr-TR.json
1035
- var $f438196d9674b9d180ea6e74d7$exports = {};
1036
- $f438196d9674b9d180ea6e74d7$exports = JSON.parse("{\"dismiss\":\"Kapat\"}");
1037
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/uk-UA.json
1038
- var $fa842ebaf07187d5bc74e0fa6c4679b$exports = {};
1039
- $fa842ebaf07187d5bc74e0fa6c4679b$exports = JSON.parse("{\"dismiss\":\"Скасувати\"}");
1040
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/zh-CN.json
1041
- var $cdcbe39f22ae1814551e7f30dcfc8$exports = {};
1042
- $cdcbe39f22ae1814551e7f30dcfc8$exports = JSON.parse("{\"dismiss\":\"取消\"}");
1043
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/overlays/intl/zh-TW.json
1044
- var $a8c729d90cde82a4eb34bebfb46a6$exports = {};
1045
- $a8c729d90cde82a4eb34bebfb46a6$exports = JSON.parse("{\"dismiss\":\"關閉\"}");
1046
948
 
949
+
950
+ var $5e3802645cc19319$exports = {};
951
+
952
+ $parcel$export($5e3802645cc19319$exports, "ariaHideOutside", () => $5e3802645cc19319$export$1c3ebcada18427bf);
1047
953
  /*
1048
954
  * Copyright 2020 Adobe. All rights reserved.
1049
955
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -1054,176 +960,76 @@ $a8c729d90cde82a4eb34bebfb46a6$exports = JSON.parse("{\"dismiss\":\"關閉\"}");
1054
960
  * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1055
961
  * OF ANY KIND, either express or implied. See the License for the specific language
1056
962
  * governing permissions and limitations under the License.
1057
- */
1058
- // @ts-ignore
1059
- const $c94f95b3263b356bb2e58a3832a84$var$intlMessages = {
1060
- "ar-AE": _babelRuntimeHelpersEsmInteropRequireDefault($e325a364098e05bf51160d06dcffdbe$exports).default,
1061
- "bg-BG": _babelRuntimeHelpersEsmInteropRequireDefault($ab088cc547d59c1be83369f8351a064$exports).default,
1062
- "cs-CZ": _babelRuntimeHelpersEsmInteropRequireDefault($cec67ea16ca47059e10ca5e77187d8c2$exports).default,
1063
- "da-DK": _babelRuntimeHelpersEsmInteropRequireDefault($d962fe1ed718c5ca37da1414136036f8$exports).default,
1064
- "de-DE": _babelRuntimeHelpersEsmInteropRequireDefault($c5167dda40dde69038848f007e5$exports).default,
1065
- "el-GR": _babelRuntimeHelpersEsmInteropRequireDefault($ecdd1ac0020e47f58a9ed51b5fb$exports).default,
1066
- "en-US": _babelRuntimeHelpersEsmInteropRequireDefault($f33e30a89f4dff807f90ebe8c$exports).default,
1067
- "es-ES": _babelRuntimeHelpersEsmInteropRequireDefault($ba353e2c61dcc5141af4537eeb3ef85c$exports).default,
1068
- "et-EE": _babelRuntimeHelpersEsmInteropRequireDefault($dd3e8aaecbf1f2c2c0f9d51aacfd$exports).default,
1069
- "fi-FI": _babelRuntimeHelpersEsmInteropRequireDefault($f730aaed9f4652842b2a8f94a4a$exports).default,
1070
- "fr-FR": _babelRuntimeHelpersEsmInteropRequireDefault($e76b22aab4e46b7806205b4af9ca3$exports).default,
1071
- "he-IL": _babelRuntimeHelpersEsmInteropRequireDefault($c33ffdd5a9931bfc82c1c9b55e98de2f$exports).default,
1072
- "hr-HR": _babelRuntimeHelpersEsmInteropRequireDefault($d64cb70d4ce170f599f4df5adf4e9898$exports).default,
1073
- "hu-HU": _babelRuntimeHelpersEsmInteropRequireDefault($c05270a6513a8b6d8a6552a35a162$exports).default,
1074
- "it-IT": _babelRuntimeHelpersEsmInteropRequireDefault($df915df637af1f3c14c8376c69dfd$exports).default,
1075
- "ja-JP": _babelRuntimeHelpersEsmInteropRequireDefault($e8bf1e6480d2c65d558c3537ec0d59ce$exports).default,
1076
- "ko-KR": _babelRuntimeHelpersEsmInteropRequireDefault($e06e93e1c9472a7e2fc5b26a87ea7$exports).default,
1077
- "lt-LT": _babelRuntimeHelpersEsmInteropRequireDefault($fef82498418eab30c69349263b64e050$exports).default,
1078
- "lv-LV": _babelRuntimeHelpersEsmInteropRequireDefault($c4df2502cb7b65c6578bcb8a165f6fc$exports).default,
1079
- "nb-NO": _babelRuntimeHelpersEsmInteropRequireDefault($b50f4e499c19f4d55113139bba$exports).default,
1080
- "nl-NL": _babelRuntimeHelpersEsmInteropRequireDefault($e45d2f0079f29e4f5c6469cca7c$exports).default,
1081
- "pl-PL": _babelRuntimeHelpersEsmInteropRequireDefault($fcb5bfa87b2378a249bd7fb591ec22c2$exports).default,
1082
- "pt-BR": _babelRuntimeHelpersEsmInteropRequireDefault($edae5c6f18c937cf0015f2aa266d9fea$exports).default,
1083
- "pt-PT": _babelRuntimeHelpersEsmInteropRequireDefault($c016edcd88f37a017208da7518133d$exports).default,
1084
- "ro-RO": _babelRuntimeHelpersEsmInteropRequireDefault($df1162b231d383d942e0fdb2bbf$exports).default,
1085
- "ru-RU": _babelRuntimeHelpersEsmInteropRequireDefault($fa17537bfd201c57fa41fd31dbd9f074$exports).default,
1086
- "sk-SK": _babelRuntimeHelpersEsmInteropRequireDefault($c30db5bcff54a9e266ee7379a6cb8$exports).default,
1087
- "sl-SI": _babelRuntimeHelpersEsmInteropRequireDefault($c86d8cad7c0045ad51a1fea185411a61$exports).default,
1088
- "sr-SP": _babelRuntimeHelpersEsmInteropRequireDefault($c610b0b50ebc0061e6c42c420a2e1be$exports).default,
1089
- "sv-SE": _babelRuntimeHelpersEsmInteropRequireDefault($c298c5c92c55ce8d8289d8cc18ea512$exports).default,
1090
- "tr-TR": _babelRuntimeHelpersEsmInteropRequireDefault($f438196d9674b9d180ea6e74d7$exports).default,
1091
- "uk-UA": _babelRuntimeHelpersEsmInteropRequireDefault($fa842ebaf07187d5bc74e0fa6c4679b$exports).default,
1092
- "zh-CN": _babelRuntimeHelpersEsmInteropRequireDefault($cdcbe39f22ae1814551e7f30dcfc8$exports).default,
1093
- "zh-TW": _babelRuntimeHelpersEsmInteropRequireDefault($a8c729d90cde82a4eb34bebfb46a6$exports).default
1094
- };
1095
-
1096
- /**
1097
- * A visually hidden button that can be used to allow screen reader
1098
- * users to dismiss a modal or popup when there is no visual
1099
- * affordance to do so.
1100
- */
1101
- export function DismissButton(props) {
1102
- let {
1103
- onDismiss
1104
- } = props;
1105
- let formatMessage = useMessageFormatter($c94f95b3263b356bb2e58a3832a84$var$intlMessages);
1106
-
1107
- let onClick = () => {
1108
- if (onDismiss) {
1109
- onDismiss();
1110
- }
1111
- };
1112
-
1113
- return /*#__PURE__*/_react.createElement(VisuallyHidden, null, /*#__PURE__*/_react.createElement("button", {
1114
- tabIndex: -1,
1115
- "aria-label": formatMessage('dismiss'),
1116
- onClick: onClick
1117
- }));
1118
- }
963
+ */ // Keeps a ref count of all hidden elements. Added to when hiding an element, and
1119
964
  // subtracted from when showing it again. When it reaches zero, aria-hidden is removed.
1120
- let $d006cf2ec48f5151923b9435b3d$var$refCountMap = new WeakMap();
1121
- /**
1122
- * Hides all elements in the DOM outside the given targets from screen readers using aria-hidden,
1123
- * and returns a function to revert these changes. In addition, changes to the DOM are watched
1124
- * and new elements outside the targets are automatically hidden.
1125
- * @param targets - The elements that should remain visible.
1126
- * @param root - Nothing will be hidden above this element.
1127
- * @returns - A function to restore all hidden elements.
1128
- */
1129
-
1130
- export function ariaHideOutside(targets, root) {
1131
- if (root === void 0) {
1132
- root = document.body;
1133
- }
1134
-
1135
- let visibleNodes = new Set(targets);
1136
- let hiddenNodes = new Set();
1137
- let walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
1138
- acceptNode(node) {
1139
- // If this node is a live announcer, add it to the set of nodes to keep visible.
1140
- if (node instanceof HTMLElement && node.dataset.liveAnnouncer === 'true') {
1141
- visibleNodes.add(node);
1142
- } // Skip this node and its children if it is one of the target nodes, or a live announcer.
1143
- // Also skip children of already hidden nodes, as aria-hidden is recursive.
1144
-
1145
-
1146
- if (visibleNodes.has(node) || hiddenNodes.has(node.parentElement)) {
1147
- return NodeFilter.FILTER_REJECT;
1148
- } // VoiceOver on iOS has issues hiding elements with role="row". Hide the cells inside instead.
1149
- // https://bugs.webkit.org/show_bug.cgi?id=222623
1150
-
1151
-
1152
- if (node instanceof HTMLElement && node.getAttribute('role') === 'row') {
1153
- return NodeFilter.FILTER_SKIP;
1154
- } // Skip this node but continue to children if one of the targets is inside the node.
1155
-
1156
-
1157
- if (targets.some(target => node.contains(target))) {
1158
- return NodeFilter.FILTER_SKIP;
1159
- }
1160
-
1161
- return NodeFilter.FILTER_ACCEPT;
1162
- }
1163
-
1164
- });
1165
-
1166
- let hide = node => {
1167
- var _refCountMap$get;
1168
-
1169
- let refCount = (_refCountMap$get = $d006cf2ec48f5151923b9435b3d$var$refCountMap.get(node)) != null ? _refCountMap$get : 0; // If already aria-hidden, and the ref count is zero, then this element
1170
- // was already hidden and there's nothing for us to do.
1171
-
1172
- if (node.getAttribute('aria-hidden') === 'true' && refCount === 0) {
1173
- return;
1174
- }
1175
-
1176
- if (refCount === 0) {
1177
- node.setAttribute('aria-hidden', 'true');
965
+ let $5e3802645cc19319$var$refCountMap = new WeakMap();
966
+ function $5e3802645cc19319$export$1c3ebcada18427bf(targets, root = document.body) {
967
+ let visibleNodes = new Set(targets);
968
+ let hiddenNodes = new Set();
969
+ let walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
970
+ acceptNode (node) {
971
+ // If this node is a live announcer, add it to the set of nodes to keep visible.
972
+ if (node instanceof HTMLElement && node.dataset.liveAnnouncer === 'true') visibleNodes.add(node);
973
+ // Skip this node and its children if it is one of the target nodes, or a live announcer.
974
+ // Also skip children of already hidden nodes, as aria-hidden is recursive.
975
+ if (visibleNodes.has(node) || hiddenNodes.has(node.parentElement)) return NodeFilter.FILTER_REJECT;
976
+ // VoiceOver on iOS has issues hiding elements with role="row". Hide the cells inside instead.
977
+ // https://bugs.webkit.org/show_bug.cgi?id=222623
978
+ if (node instanceof HTMLElement && node.getAttribute('role') === 'row') return NodeFilter.FILTER_SKIP;
979
+ // Skip this node but continue to children if one of the targets is inside the node.
980
+ if (targets.some((target)=>node.contains(target)
981
+ )) return NodeFilter.FILTER_SKIP;
982
+ return NodeFilter.FILTER_ACCEPT;
983
+ }
984
+ });
985
+ let hide = (node)=>{
986
+ var ref;
987
+ let refCount = (ref = $5e3802645cc19319$var$refCountMap.get(node)) !== null && ref !== void 0 ? ref : 0;
988
+ // If already aria-hidden, and the ref count is zero, then this element
989
+ // was already hidden and there's nothing for us to do.
990
+ if (node.getAttribute('aria-hidden') === 'true' && refCount === 0) return;
991
+ if (refCount === 0) node.setAttribute('aria-hidden', 'true');
992
+ hiddenNodes.add(node);
993
+ $5e3802645cc19319$var$refCountMap.set(node, refCount + 1);
994
+ };
995
+ let node1 = walker.nextNode();
996
+ while(node1 != null){
997
+ hide(node1);
998
+ node1 = walker.nextNode();
1178
999
  }
1000
+ let observer = new MutationObserver((changes)=>{
1001
+ for (let change of changes){
1002
+ if (change.type !== 'childList' || change.addedNodes.length === 0) continue;
1003
+ // If the parent element of the added nodes is not within one of the targets,
1004
+ // and not already inside a hidden node, hide all of the new children.
1005
+ if (![
1006
+ ...visibleNodes,
1007
+ ...hiddenNodes
1008
+ ].some((node)=>node.contains(change.target)
1009
+ )) for (let node2 of change.addedNodes){
1010
+ if (node2 instanceof HTMLElement && node2.dataset.liveAnnouncer === 'true') visibleNodes.add(node2);
1011
+ else if (node2 instanceof Element) hide(node2);
1012
+ }
1013
+ }
1014
+ });
1015
+ observer.observe(root, {
1016
+ childList: true,
1017
+ subtree: true
1018
+ });
1019
+ return ()=>{
1020
+ observer.disconnect();
1021
+ for (let node of hiddenNodes){
1022
+ let count = $5e3802645cc19319$var$refCountMap.get(node);
1023
+ if (count === 1) {
1024
+ node.removeAttribute('aria-hidden');
1025
+ $5e3802645cc19319$var$refCountMap.delete(node);
1026
+ } else $5e3802645cc19319$var$refCountMap.set(node, count - 1);
1027
+ }
1028
+ };
1029
+ }
1179
1030
 
1180
- hiddenNodes.add(node);
1181
- $d006cf2ec48f5151923b9435b3d$var$refCountMap.set(node, refCount + 1);
1182
- };
1183
-
1184
- let node = walker.nextNode();
1185
-
1186
- while (node != null) {
1187
- hide(node);
1188
- node = walker.nextNode();
1189
- }
1190
1031
 
1191
- let observer = new MutationObserver(changes => {
1192
- for (let change of changes) {
1193
- if (change.type !== 'childList' || change.addedNodes.length === 0) {
1194
- continue;
1195
- } // If the parent element of the added nodes is not within one of the targets,
1196
- // and not already inside a hidden node, hide all of the new children.
1197
1032
 
1198
1033
 
1199
- if (![...visibleNodes, ...hiddenNodes].some(node => node.contains(change.target))) {
1200
- for (let node of change.addedNodes) {
1201
- if (node instanceof HTMLElement && node.dataset.liveAnnouncer === 'true') {
1202
- visibleNodes.add(node);
1203
- } else if (node instanceof Element) {
1204
- hide(node);
1205
- }
1206
- }
1207
- }
1208
- }
1209
- });
1210
- observer.observe(root, {
1211
- childList: true,
1212
- subtree: true
1213
- });
1214
- return () => {
1215
- observer.disconnect();
1216
-
1217
- for (let node of hiddenNodes) {
1218
- let count = $d006cf2ec48f5151923b9435b3d$var$refCountMap.get(node);
1219
-
1220
- if (count === 1) {
1221
- node.removeAttribute('aria-hidden');
1222
- $d006cf2ec48f5151923b9435b3d$var$refCountMap.delete(node);
1223
- } else {
1224
- $d006cf2ec48f5151923b9435b3d$var$refCountMap.set(node, count - 1);
1225
- }
1226
- }
1227
- };
1228
- }
1034
+ export {$2a41e45df1593e64$export$d39e1813b3bdd0e1 as useOverlayPosition, $a11501f3d1d39e6c$export$ea8f71083e90600f as useOverlay, $628037886ba31236$export$f9d5c8beee7d008d as useOverlayTrigger, $49c51c25361d4cd2$export$ee0f7cc6afcd1c18 as usePreventScroll, $f57aed4a881a3485$export$178405afcd8c5eb as ModalProvider, $f57aed4a881a3485$export$d9aaed4c3ece1bc0 as useModalProvider, $f57aed4a881a3485$export$bf688221f59024e5 as OverlayProvider, $f57aed4a881a3485$export$b47c3594eab58386 as OverlayContainer, $f57aed4a881a3485$export$33ffd74ebf07f060 as useModal, $86ea4cb521eb2e37$export$2317d149ed6f78c4 as DismissButton, $5e3802645cc19319$export$1c3ebcada18427bf as ariaHideOutside};
1229
1035
  //# sourceMappingURL=module.js.map