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