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