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