react-tooltip 5.5.2 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/react-tooltip.cjs.js +2251 -1925
- package/dist/react-tooltip.cjs.min.js +3 -3
- package/dist/react-tooltip.d.ts +6 -1
- package/dist/react-tooltip.esm.js +2246 -1926
- package/dist/react-tooltip.esm.min.js +3 -3
- package/dist/react-tooltip.umd.js +2251 -1925
- package/dist/react-tooltip.umd.min.js +3 -3
- package/package.json +1 -1
|
@@ -8,2290 +8,2592 @@
|
|
|
8
8
|
|
|
9
9
|
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
function getSide(placement) {
|
|
12
|
+
return placement.split('-')[0];
|
|
13
|
+
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
19
|
-
*
|
|
20
|
-
* This source code is licensed under the MIT license found in the
|
|
21
|
-
* LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/
|
|
15
|
+
function getAlignment(placement) {
|
|
16
|
+
return placement.split('-')[1];
|
|
17
|
+
}
|
|
23
18
|
|
|
24
|
-
|
|
19
|
+
function getMainAxisFromPlacement(placement) {
|
|
20
|
+
return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
|
|
21
|
+
}
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
function getLengthFromAxis(axis) {
|
|
24
|
+
return axis === 'y' ? 'height' : 'width';
|
|
25
|
+
}
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
28
|
+
let {
|
|
29
|
+
reference,
|
|
30
|
+
floating
|
|
31
|
+
} = _ref;
|
|
32
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
33
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
34
|
+
const mainAxis = getMainAxisFromPlacement(placement);
|
|
35
|
+
const length = getLengthFromAxis(mainAxis);
|
|
36
|
+
const commonAlign = reference[length] / 2 - floating[length] / 2;
|
|
37
|
+
const side = getSide(placement);
|
|
38
|
+
const isVertical = mainAxis === 'x';
|
|
39
|
+
let coords;
|
|
30
40
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
exports.Fragment = 0xeacb;
|
|
39
|
-
var REACT_STRICT_MODE_TYPE = 0xeacc;
|
|
40
|
-
var REACT_PROFILER_TYPE = 0xead2;
|
|
41
|
-
var REACT_PROVIDER_TYPE = 0xeacd;
|
|
42
|
-
var REACT_CONTEXT_TYPE = 0xeace;
|
|
43
|
-
var REACT_FORWARD_REF_TYPE = 0xead0;
|
|
44
|
-
var REACT_SUSPENSE_TYPE = 0xead1;
|
|
45
|
-
var REACT_SUSPENSE_LIST_TYPE = 0xead8;
|
|
46
|
-
var REACT_MEMO_TYPE = 0xead3;
|
|
47
|
-
var REACT_LAZY_TYPE = 0xead4;
|
|
48
|
-
var REACT_BLOCK_TYPE = 0xead9;
|
|
49
|
-
var REACT_SERVER_BLOCK_TYPE = 0xeada;
|
|
50
|
-
var REACT_FUNDAMENTAL_TYPE = 0xead5;
|
|
51
|
-
var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
|
|
52
|
-
var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
|
|
41
|
+
switch (side) {
|
|
42
|
+
case 'top':
|
|
43
|
+
coords = {
|
|
44
|
+
x: commonX,
|
|
45
|
+
y: reference.y - floating.height
|
|
46
|
+
};
|
|
47
|
+
break;
|
|
53
48
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
REACT_PROFILER_TYPE = symbolFor('react.profiler');
|
|
61
|
-
REACT_PROVIDER_TYPE = symbolFor('react.provider');
|
|
62
|
-
REACT_CONTEXT_TYPE = symbolFor('react.context');
|
|
63
|
-
REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
|
|
64
|
-
REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
|
|
65
|
-
REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
|
|
66
|
-
REACT_MEMO_TYPE = symbolFor('react.memo');
|
|
67
|
-
REACT_LAZY_TYPE = symbolFor('react.lazy');
|
|
68
|
-
REACT_BLOCK_TYPE = symbolFor('react.block');
|
|
69
|
-
REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
|
|
70
|
-
REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
|
|
71
|
-
symbolFor('react.scope');
|
|
72
|
-
symbolFor('react.opaque.id');
|
|
73
|
-
REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
|
|
74
|
-
symbolFor('react.offscreen');
|
|
75
|
-
REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
|
|
76
|
-
}
|
|
49
|
+
case 'bottom':
|
|
50
|
+
coords = {
|
|
51
|
+
x: commonX,
|
|
52
|
+
y: reference.y + reference.height
|
|
53
|
+
};
|
|
54
|
+
break;
|
|
77
55
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
56
|
+
case 'right':
|
|
57
|
+
coords = {
|
|
58
|
+
x: reference.x + reference.width,
|
|
59
|
+
y: commonY
|
|
60
|
+
};
|
|
61
|
+
break;
|
|
84
62
|
|
|
85
|
-
|
|
63
|
+
case 'left':
|
|
64
|
+
coords = {
|
|
65
|
+
x: reference.x - floating.width,
|
|
66
|
+
y: commonY
|
|
67
|
+
};
|
|
68
|
+
break;
|
|
86
69
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
70
|
+
default:
|
|
71
|
+
coords = {
|
|
72
|
+
x: reference.x,
|
|
73
|
+
y: reference.y
|
|
74
|
+
};
|
|
75
|
+
}
|
|
90
76
|
|
|
91
|
-
|
|
92
|
-
|
|
77
|
+
switch (getAlignment(placement)) {
|
|
78
|
+
case 'start':
|
|
79
|
+
coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
80
|
+
break;
|
|
93
81
|
|
|
94
|
-
|
|
82
|
+
case 'end':
|
|
83
|
+
coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
95
86
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
99
|
-
args[_key2 - 1] = arguments[_key2];
|
|
100
|
-
}
|
|
87
|
+
return coords;
|
|
88
|
+
}
|
|
101
89
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
90
|
+
/**
|
|
91
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
92
|
+
* next to a reference element when it is given a certain positioning strategy.
|
|
93
|
+
*
|
|
94
|
+
* This export does not have any `platform` interface logic. You will need to
|
|
95
|
+
* write one for the platform you are using Floating UI with.
|
|
96
|
+
*/
|
|
105
97
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
98
|
+
const computePosition$1 = async (reference, floating, config) => {
|
|
99
|
+
const {
|
|
100
|
+
placement = 'bottom',
|
|
101
|
+
strategy = 'absolute',
|
|
102
|
+
middleware = [],
|
|
103
|
+
platform
|
|
104
|
+
} = config;
|
|
105
|
+
const validMiddleware = middleware.filter(Boolean);
|
|
106
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
112
107
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
108
|
+
{
|
|
109
|
+
if (platform == null) {
|
|
110
|
+
console.error(['Floating UI: `platform` property was not passed to config. If you', 'want to use Floating UI on the web, install @floating-ui/dom', 'instead of the /core package. Otherwise, you can create your own', '`platform`: https://floating-ui.com/docs/platform'].join(' '));
|
|
111
|
+
}
|
|
118
112
|
|
|
119
|
-
|
|
113
|
+
if (validMiddleware.filter(_ref => {
|
|
114
|
+
let {
|
|
115
|
+
name
|
|
116
|
+
} = _ref;
|
|
117
|
+
return name === 'autoPlacement' || name === 'flip';
|
|
118
|
+
}).length > 1) {
|
|
119
|
+
throw new Error(['Floating UI: duplicate `flip` and/or `autoPlacement` middleware', 'detected. This will lead to an infinite loop. Ensure only one of', 'either has been passed to the `middleware` array.'].join(' '));
|
|
120
|
+
}
|
|
120
121
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
if (!reference || !floating) {
|
|
123
|
+
console.error(['Floating UI: The reference and/or floating element was not defined', 'when `computePosition()` was called. Ensure that both elements have', 'been created and can be measured.'].join(' '));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
125
126
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
let rects = await platform.getElementRects({
|
|
128
|
+
reference,
|
|
129
|
+
floating,
|
|
130
|
+
strategy
|
|
131
|
+
});
|
|
132
|
+
let {
|
|
133
|
+
x,
|
|
134
|
+
y
|
|
135
|
+
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
136
|
+
let statefulPlacement = placement;
|
|
137
|
+
let middlewareData = {};
|
|
138
|
+
let resetCount = 0;
|
|
129
139
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
140
|
+
for (let i = 0; i < validMiddleware.length; i++) {
|
|
141
|
+
const {
|
|
142
|
+
name,
|
|
143
|
+
fn
|
|
144
|
+
} = validMiddleware[i];
|
|
145
|
+
const {
|
|
146
|
+
x: nextX,
|
|
147
|
+
y: nextY,
|
|
148
|
+
data,
|
|
149
|
+
reset
|
|
150
|
+
} = await fn({
|
|
151
|
+
x,
|
|
152
|
+
y,
|
|
153
|
+
initialPlacement: placement,
|
|
154
|
+
placement: statefulPlacement,
|
|
155
|
+
strategy,
|
|
156
|
+
middlewareData,
|
|
157
|
+
rects,
|
|
158
|
+
platform,
|
|
159
|
+
elements: {
|
|
160
|
+
reference,
|
|
161
|
+
floating
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
x = nextX != null ? nextX : x;
|
|
165
|
+
y = nextY != null ? nextY : y;
|
|
166
|
+
middlewareData = { ...middlewareData,
|
|
167
|
+
[name]: { ...middlewareData[name],
|
|
168
|
+
...data
|
|
169
|
+
}
|
|
170
|
+
};
|
|
133
171
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
172
|
+
{
|
|
173
|
+
if (resetCount > 50) {
|
|
174
|
+
console.warn(['Floating UI: The middleware lifecycle appears to be running in an', 'infinite loop. This is usually caused by a `reset` continually', 'being returned without a break condition.'].join(' '));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
137
177
|
|
|
138
|
-
|
|
178
|
+
if (reset && resetCount <= 50) {
|
|
179
|
+
resetCount++;
|
|
139
180
|
|
|
140
|
-
|
|
181
|
+
if (typeof reset === 'object') {
|
|
182
|
+
if (reset.placement) {
|
|
183
|
+
statefulPlacement = reset.placement;
|
|
184
|
+
}
|
|
141
185
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
186
|
+
if (reset.rects) {
|
|
187
|
+
rects = reset.rects === true ? await platform.getElementRects({
|
|
188
|
+
reference,
|
|
189
|
+
floating,
|
|
190
|
+
strategy
|
|
191
|
+
}) : reset.rects;
|
|
192
|
+
}
|
|
146
193
|
|
|
194
|
+
({
|
|
195
|
+
x,
|
|
196
|
+
y
|
|
197
|
+
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
198
|
+
}
|
|
147
199
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
200
|
+
i = -1;
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
151
204
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
205
|
+
return {
|
|
206
|
+
x,
|
|
207
|
+
y,
|
|
208
|
+
placement: statefulPlacement,
|
|
209
|
+
strategy,
|
|
210
|
+
middlewareData
|
|
211
|
+
};
|
|
212
|
+
};
|
|
157
213
|
|
|
158
|
-
|
|
159
|
-
|
|
214
|
+
function expandPaddingObject(padding) {
|
|
215
|
+
return {
|
|
216
|
+
top: 0,
|
|
217
|
+
right: 0,
|
|
218
|
+
bottom: 0,
|
|
219
|
+
left: 0,
|
|
220
|
+
...padding
|
|
221
|
+
};
|
|
222
|
+
}
|
|
160
223
|
|
|
224
|
+
function getSideObjectFromPadding(padding) {
|
|
225
|
+
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
|
|
226
|
+
top: padding,
|
|
227
|
+
right: padding,
|
|
228
|
+
bottom: padding,
|
|
229
|
+
left: padding
|
|
230
|
+
};
|
|
231
|
+
}
|
|
161
232
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
233
|
+
function rectToClientRect(rect) {
|
|
234
|
+
return { ...rect,
|
|
235
|
+
top: rect.y,
|
|
236
|
+
left: rect.x,
|
|
237
|
+
right: rect.x + rect.width,
|
|
238
|
+
bottom: rect.y + rect.height
|
|
239
|
+
};
|
|
240
|
+
}
|
|
165
241
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
242
|
+
/**
|
|
243
|
+
* Resolves with an object of overflow side offsets that determine how much the
|
|
244
|
+
* element is overflowing a given clipping boundary.
|
|
245
|
+
* - positive = overflowing the boundary by that number of pixels
|
|
246
|
+
* - negative = how many pixels left before it will overflow
|
|
247
|
+
* - 0 = lies flush with the boundary
|
|
248
|
+
* @see https://floating-ui.com/docs/detectOverflow
|
|
249
|
+
*/
|
|
250
|
+
async function detectOverflow(middlewareArguments, options) {
|
|
251
|
+
var _await$platform$isEle;
|
|
169
252
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
if (/^index\./.test(fileName)) {
|
|
174
|
-
var match = path.match(BEFORE_SLASH_RE);
|
|
253
|
+
if (options === void 0) {
|
|
254
|
+
options = {};
|
|
255
|
+
}
|
|
175
256
|
|
|
176
|
-
|
|
177
|
-
|
|
257
|
+
const {
|
|
258
|
+
x,
|
|
259
|
+
y,
|
|
260
|
+
platform,
|
|
261
|
+
rects,
|
|
262
|
+
elements,
|
|
263
|
+
strategy
|
|
264
|
+
} = middlewareArguments;
|
|
265
|
+
const {
|
|
266
|
+
boundary = 'clippingAncestors',
|
|
267
|
+
rootBoundary = 'viewport',
|
|
268
|
+
elementContext = 'floating',
|
|
269
|
+
altBoundary = false,
|
|
270
|
+
padding = 0
|
|
271
|
+
} = options;
|
|
272
|
+
const paddingObject = getSideObjectFromPadding(padding);
|
|
273
|
+
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
|
|
274
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
275
|
+
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
276
|
+
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
|
|
277
|
+
boundary,
|
|
278
|
+
rootBoundary,
|
|
279
|
+
strategy
|
|
280
|
+
}));
|
|
281
|
+
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
282
|
+
rect: elementContext === 'floating' ? { ...rects.floating,
|
|
283
|
+
x,
|
|
284
|
+
y
|
|
285
|
+
} : rects.reference,
|
|
286
|
+
offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
|
|
287
|
+
strategy
|
|
288
|
+
}) : rects[elementContext]);
|
|
289
|
+
return {
|
|
290
|
+
top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
|
|
291
|
+
bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
|
|
292
|
+
left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
|
|
293
|
+
right: elementClientRect.right - clippingClientRect.right + paddingObject.right
|
|
294
|
+
};
|
|
295
|
+
}
|
|
178
296
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
fileName = folderName + '/' + fileName;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
297
|
+
const min$1 = Math.min;
|
|
298
|
+
const max$1 = Math.max;
|
|
186
299
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
300
|
+
function within(min$1$1, value, max$1$1) {
|
|
301
|
+
return max$1(min$1$1, min$1(value, max$1$1));
|
|
302
|
+
}
|
|
191
303
|
|
|
192
|
-
|
|
193
|
-
|
|
304
|
+
/**
|
|
305
|
+
* Positions an inner element of the floating element such that it is centered
|
|
306
|
+
* to the reference element.
|
|
307
|
+
* @see https://floating-ui.com/docs/arrow
|
|
308
|
+
*/
|
|
309
|
+
const arrow = options => ({
|
|
310
|
+
name: 'arrow',
|
|
311
|
+
options,
|
|
194
312
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
313
|
+
async fn(middlewareArguments) {
|
|
314
|
+
// Since `element` is required, we don't Partial<> the type
|
|
315
|
+
const {
|
|
316
|
+
element,
|
|
317
|
+
padding = 0
|
|
318
|
+
} = options != null ? options : {};
|
|
319
|
+
const {
|
|
320
|
+
x,
|
|
321
|
+
y,
|
|
322
|
+
placement,
|
|
323
|
+
rects,
|
|
324
|
+
platform
|
|
325
|
+
} = middlewareArguments;
|
|
199
326
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
327
|
+
if (element == null) {
|
|
328
|
+
{
|
|
329
|
+
console.warn('Floating UI: No `element` was passed to the `arrow` middleware.');
|
|
330
|
+
}
|
|
204
331
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
// Host root, text node or just invalid type.
|
|
208
|
-
return null;
|
|
209
|
-
}
|
|
332
|
+
return {};
|
|
333
|
+
}
|
|
210
334
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
335
|
+
const paddingObject = getSideObjectFromPadding(padding);
|
|
336
|
+
const coords = {
|
|
337
|
+
x,
|
|
338
|
+
y
|
|
339
|
+
};
|
|
340
|
+
const axis = getMainAxisFromPlacement(placement);
|
|
341
|
+
const alignment = getAlignment(placement);
|
|
342
|
+
const length = getLengthFromAxis(axis);
|
|
343
|
+
const arrowDimensions = await platform.getDimensions(element);
|
|
344
|
+
const minProp = axis === 'y' ? 'top' : 'left';
|
|
345
|
+
const maxProp = axis === 'y' ? 'bottom' : 'right';
|
|
346
|
+
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
|
|
347
|
+
const startDiff = coords[axis] - rects.reference[axis];
|
|
348
|
+
const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
|
|
349
|
+
let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
|
|
216
350
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
351
|
+
if (clientSize === 0) {
|
|
352
|
+
clientSize = rects.floating[length];
|
|
353
|
+
}
|
|
220
354
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
355
|
+
const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
|
|
356
|
+
// point is outside the floating element's bounds
|
|
224
357
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
358
|
+
const min = paddingObject[minProp];
|
|
359
|
+
const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
|
|
360
|
+
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
361
|
+
const offset = within(min, center, max); // Make sure that arrow points at the reference
|
|
228
362
|
|
|
229
|
-
|
|
230
|
-
|
|
363
|
+
const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp];
|
|
364
|
+
const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length];
|
|
365
|
+
const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
|
|
366
|
+
return {
|
|
367
|
+
[axis]: coords[axis] - alignmentOffset,
|
|
368
|
+
data: {
|
|
369
|
+
[axis]: offset,
|
|
370
|
+
centerOffset: center - offset
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
}
|
|
231
374
|
|
|
232
|
-
|
|
233
|
-
return "Profiler";
|
|
375
|
+
});
|
|
234
376
|
|
|
235
|
-
|
|
236
|
-
|
|
377
|
+
const hash$1 = {
|
|
378
|
+
left: 'right',
|
|
379
|
+
right: 'left',
|
|
380
|
+
bottom: 'top',
|
|
381
|
+
top: 'bottom'
|
|
382
|
+
};
|
|
383
|
+
function getOppositePlacement(placement) {
|
|
384
|
+
return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
|
|
385
|
+
}
|
|
237
386
|
|
|
238
|
-
|
|
239
|
-
|
|
387
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
388
|
+
if (rtl === void 0) {
|
|
389
|
+
rtl = false;
|
|
390
|
+
}
|
|
240
391
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
392
|
+
const alignment = getAlignment(placement);
|
|
393
|
+
const mainAxis = getMainAxisFromPlacement(placement);
|
|
394
|
+
const length = getLengthFromAxis(mainAxis);
|
|
395
|
+
let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
|
|
244
396
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
return 'Context.Consumer';
|
|
397
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
398
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
399
|
+
}
|
|
249
400
|
|
|
250
|
-
|
|
251
|
-
|
|
401
|
+
return {
|
|
402
|
+
main: mainAlignmentSide,
|
|
403
|
+
cross: getOppositePlacement(mainAlignmentSide)
|
|
404
|
+
};
|
|
405
|
+
}
|
|
252
406
|
|
|
253
|
-
|
|
254
|
-
|
|
407
|
+
const hash = {
|
|
408
|
+
start: 'end',
|
|
409
|
+
end: 'start'
|
|
410
|
+
};
|
|
411
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
412
|
+
return placement.replace(/start|end/g, matched => hash[matched]);
|
|
413
|
+
}
|
|
255
414
|
|
|
256
|
-
|
|
257
|
-
|
|
415
|
+
const sides = ['top', 'right', 'bottom', 'left'];
|
|
416
|
+
const allPlacements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-start", side + "-end"), []);
|
|
258
417
|
|
|
259
|
-
|
|
260
|
-
|
|
418
|
+
function getPlacementList(alignment, autoAlignment, allowedPlacements) {
|
|
419
|
+
const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
|
|
420
|
+
return allowedPlacementsSortedByAlignment.filter(placement => {
|
|
421
|
+
if (alignment) {
|
|
422
|
+
return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
|
|
423
|
+
}
|
|
261
424
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
425
|
+
return true;
|
|
426
|
+
});
|
|
427
|
+
}
|
|
266
428
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
429
|
+
/**
|
|
430
|
+
* Automatically chooses the `placement` which has the most space available.
|
|
431
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
432
|
+
*/
|
|
433
|
+
const autoPlacement = function (options) {
|
|
434
|
+
if (options === void 0) {
|
|
435
|
+
options = {};
|
|
436
|
+
}
|
|
270
437
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}
|
|
438
|
+
return {
|
|
439
|
+
name: 'autoPlacement',
|
|
440
|
+
options,
|
|
275
441
|
|
|
276
|
-
|
|
277
|
-
|
|
442
|
+
async fn(middlewareArguments) {
|
|
443
|
+
var _middlewareData$autoP, _middlewareData$autoP2, _middlewareData$autoP3, _middlewareData$autoP4, _placementsSortedByLe;
|
|
278
444
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
445
|
+
const {
|
|
446
|
+
x,
|
|
447
|
+
y,
|
|
448
|
+
rects,
|
|
449
|
+
middlewareData,
|
|
450
|
+
placement,
|
|
451
|
+
platform,
|
|
452
|
+
elements
|
|
453
|
+
} = middlewareArguments;
|
|
454
|
+
const {
|
|
455
|
+
alignment = null,
|
|
456
|
+
allowedPlacements = allPlacements,
|
|
457
|
+
autoAlignment = true,
|
|
458
|
+
...detectOverflowOptions
|
|
459
|
+
} = options;
|
|
460
|
+
const placements = getPlacementList(alignment, autoAlignment, allowedPlacements);
|
|
461
|
+
const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
|
|
462
|
+
const currentIndex = (_middlewareData$autoP = (_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.index) != null ? _middlewareData$autoP : 0;
|
|
463
|
+
const currentPlacement = placements[currentIndex];
|
|
282
464
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}
|
|
287
|
-
}
|
|
465
|
+
if (currentPlacement == null) {
|
|
466
|
+
return {};
|
|
467
|
+
}
|
|
288
468
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
469
|
+
const {
|
|
470
|
+
main,
|
|
471
|
+
cross
|
|
472
|
+
} = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))); // Make `computeCoords` start from the right place
|
|
293
473
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
474
|
+
if (placement !== currentPlacement) {
|
|
475
|
+
return {
|
|
476
|
+
x,
|
|
477
|
+
y,
|
|
478
|
+
reset: {
|
|
479
|
+
placement: placements[0]
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
}
|
|
299
483
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
throw err;
|
|
307
|
-
}
|
|
484
|
+
const currentOverflows = [overflow[getSide(currentPlacement)], overflow[main], overflow[cross]];
|
|
485
|
+
const allOverflows = [...((_middlewareData$autoP3 = (_middlewareData$autoP4 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP4.overflows) != null ? _middlewareData$autoP3 : []), {
|
|
486
|
+
placement: currentPlacement,
|
|
487
|
+
overflows: currentOverflows
|
|
488
|
+
}];
|
|
489
|
+
const nextPlacement = placements[currentIndex + 1]; // There are more placements to check
|
|
308
490
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
491
|
+
if (nextPlacement) {
|
|
492
|
+
return {
|
|
493
|
+
data: {
|
|
494
|
+
index: currentIndex + 1,
|
|
495
|
+
overflows: allOverflows
|
|
496
|
+
},
|
|
497
|
+
reset: {
|
|
498
|
+
placement: nextPlacement
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
}
|
|
313
502
|
|
|
314
|
-
|
|
315
|
-
|
|
503
|
+
const placementsSortedByLeastOverflow = allOverflows.slice().sort((a, b) => a.overflows[0] - b.overflows[0]);
|
|
504
|
+
const placementThatFitsOnAllSides = (_placementsSortedByLe = placementsSortedByLeastOverflow.find(_ref => {
|
|
505
|
+
let {
|
|
506
|
+
overflows
|
|
507
|
+
} = _ref;
|
|
508
|
+
return overflows.every(overflow => overflow <= 0);
|
|
509
|
+
})) == null ? void 0 : _placementsSortedByLe.placement;
|
|
510
|
+
const resetPlacement = placementThatFitsOnAllSides != null ? placementThatFitsOnAllSides : placementsSortedByLeastOverflow[0].placement;
|
|
316
511
|
|
|
317
|
-
|
|
512
|
+
if (resetPlacement !== placement) {
|
|
513
|
+
return {
|
|
514
|
+
data: {
|
|
515
|
+
index: currentIndex + 1,
|
|
516
|
+
overflows: allOverflows
|
|
517
|
+
},
|
|
518
|
+
reset: {
|
|
519
|
+
placement: resetPlacement
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
}
|
|
318
523
|
|
|
319
|
-
|
|
320
|
-
|
|
524
|
+
return {};
|
|
525
|
+
}
|
|
321
526
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
// same error.
|
|
325
|
-
loggedTypeFailures[error$1.message] = true;
|
|
326
|
-
setCurrentlyValidatingElement(element);
|
|
527
|
+
};
|
|
528
|
+
};
|
|
327
529
|
|
|
328
|
-
|
|
530
|
+
function getExpandedPlacements(placement) {
|
|
531
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
532
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
533
|
+
}
|
|
329
534
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
535
|
+
/**
|
|
536
|
+
* Changes the placement of the floating element to one that will fit if the
|
|
537
|
+
* initially specified `placement` does not.
|
|
538
|
+
* @see https://floating-ui.com/docs/flip
|
|
539
|
+
*/
|
|
540
|
+
const flip = function (options) {
|
|
541
|
+
if (options === void 0) {
|
|
542
|
+
options = {};
|
|
543
|
+
}
|
|
336
544
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
key: true,
|
|
341
|
-
ref: true,
|
|
342
|
-
__self: true,
|
|
343
|
-
__source: true
|
|
344
|
-
};
|
|
345
|
-
var specialPropKeyWarningShown;
|
|
346
|
-
var specialPropRefWarningShown;
|
|
347
|
-
var didWarnAboutStringRefs;
|
|
545
|
+
return {
|
|
546
|
+
name: 'flip',
|
|
547
|
+
options,
|
|
348
548
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
}
|
|
549
|
+
async fn(middlewareArguments) {
|
|
550
|
+
var _middlewareData$flip;
|
|
352
551
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
552
|
+
const {
|
|
553
|
+
placement,
|
|
554
|
+
middlewareData,
|
|
555
|
+
rects,
|
|
556
|
+
initialPlacement,
|
|
557
|
+
platform,
|
|
558
|
+
elements
|
|
559
|
+
} = middlewareArguments;
|
|
560
|
+
const {
|
|
561
|
+
mainAxis: checkMainAxis = true,
|
|
562
|
+
crossAxis: checkCrossAxis = true,
|
|
563
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
564
|
+
fallbackStrategy = 'bestFit',
|
|
565
|
+
flipAlignment = true,
|
|
566
|
+
...detectOverflowOptions
|
|
567
|
+
} = options;
|
|
568
|
+
const side = getSide(placement);
|
|
569
|
+
const isBasePlacement = side === initialPlacement;
|
|
570
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
571
|
+
const placements = [initialPlacement, ...fallbackPlacements];
|
|
572
|
+
const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
|
|
573
|
+
const overflows = [];
|
|
574
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
357
575
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
}
|
|
362
|
-
}
|
|
576
|
+
if (checkMainAxis) {
|
|
577
|
+
overflows.push(overflow[side]);
|
|
578
|
+
}
|
|
363
579
|
|
|
364
|
-
|
|
365
|
-
|
|
580
|
+
if (checkCrossAxis) {
|
|
581
|
+
const {
|
|
582
|
+
main,
|
|
583
|
+
cross
|
|
584
|
+
} = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
|
|
585
|
+
overflows.push(overflow[main], overflow[cross]);
|
|
586
|
+
}
|
|
366
587
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
588
|
+
overflowsData = [...overflowsData, {
|
|
589
|
+
placement,
|
|
590
|
+
overflows
|
|
591
|
+
}]; // One or more sides is overflowing
|
|
371
592
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}
|
|
593
|
+
if (!overflows.every(side => side <= 0)) {
|
|
594
|
+
var _middlewareData$flip$, _middlewareData$flip2;
|
|
377
595
|
|
|
378
|
-
|
|
379
|
-
|
|
596
|
+
const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
|
|
597
|
+
const nextPlacement = placements[nextIndex];
|
|
380
598
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
599
|
+
if (nextPlacement) {
|
|
600
|
+
// Try next placement and re-run the lifecycle
|
|
601
|
+
return {
|
|
602
|
+
data: {
|
|
603
|
+
index: nextIndex,
|
|
604
|
+
overflows: overflowsData
|
|
605
|
+
},
|
|
606
|
+
reset: {
|
|
607
|
+
placement: nextPlacement
|
|
608
|
+
}
|
|
609
|
+
};
|
|
610
|
+
}
|
|
385
611
|
|
|
386
|
-
|
|
387
|
-
error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref);
|
|
612
|
+
let resetPlacement = 'bottom';
|
|
388
613
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
}
|
|
614
|
+
switch (fallbackStrategy) {
|
|
615
|
+
case 'bestFit':
|
|
616
|
+
{
|
|
617
|
+
var _overflowsData$map$so;
|
|
394
618
|
|
|
395
|
-
|
|
396
|
-
{
|
|
397
|
-
var warnAboutAccessingKey = function () {
|
|
398
|
-
if (!specialPropKeyWarningShown) {
|
|
399
|
-
specialPropKeyWarningShown = true;
|
|
619
|
+
const placement = (_overflowsData$map$so = overflowsData.map(d => [d, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0].placement;
|
|
400
620
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
621
|
+
if (placement) {
|
|
622
|
+
resetPlacement = placement;
|
|
623
|
+
}
|
|
404
624
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
get: warnAboutAccessingKey,
|
|
408
|
-
configurable: true
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
}
|
|
625
|
+
break;
|
|
626
|
+
}
|
|
412
627
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
specialPropRefWarningShown = true;
|
|
628
|
+
case 'initialPlacement':
|
|
629
|
+
resetPlacement = initialPlacement;
|
|
630
|
+
break;
|
|
631
|
+
}
|
|
418
632
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
633
|
+
if (placement !== resetPlacement) {
|
|
634
|
+
return {
|
|
635
|
+
reset: {
|
|
636
|
+
placement: resetPlacement
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
}
|
|
422
641
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
get: warnAboutAccessingRef,
|
|
426
|
-
configurable: true
|
|
427
|
-
});
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* Factory method to create a new React element. This no longer adheres to
|
|
432
|
-
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
433
|
-
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
434
|
-
* if something is a React Element.
|
|
435
|
-
*
|
|
436
|
-
* @param {*} type
|
|
437
|
-
* @param {*} props
|
|
438
|
-
* @param {*} key
|
|
439
|
-
* @param {string|object} ref
|
|
440
|
-
* @param {*} owner
|
|
441
|
-
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
442
|
-
* different from the `owner` when React.createElement is called, so that we
|
|
443
|
-
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
444
|
-
* functions, and as long as `this` and owner are the same, there will be no
|
|
445
|
-
* change in behavior.
|
|
446
|
-
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
447
|
-
* indicating filename, line number, and/or other information.
|
|
448
|
-
* @internal
|
|
449
|
-
*/
|
|
642
|
+
return {};
|
|
643
|
+
}
|
|
450
644
|
|
|
645
|
+
};
|
|
646
|
+
};
|
|
451
647
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
648
|
+
async function convertValueToCoords(middlewareArguments, value) {
|
|
649
|
+
const {
|
|
650
|
+
placement,
|
|
651
|
+
platform,
|
|
652
|
+
elements
|
|
653
|
+
} = middlewareArguments;
|
|
654
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
655
|
+
const side = getSide(placement);
|
|
656
|
+
const alignment = getAlignment(placement);
|
|
657
|
+
const isVertical = getMainAxisFromPlacement(placement) === 'x';
|
|
658
|
+
const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
|
|
659
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
660
|
+
const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
|
|
464
661
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
662
|
+
let {
|
|
663
|
+
mainAxis,
|
|
664
|
+
crossAxis,
|
|
665
|
+
alignmentAxis
|
|
666
|
+
} = typeof rawValue === 'number' ? {
|
|
667
|
+
mainAxis: rawValue,
|
|
668
|
+
crossAxis: 0,
|
|
669
|
+
alignmentAxis: null
|
|
670
|
+
} : {
|
|
671
|
+
mainAxis: 0,
|
|
672
|
+
crossAxis: 0,
|
|
673
|
+
alignmentAxis: null,
|
|
674
|
+
...rawValue
|
|
675
|
+
};
|
|
474
676
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
writable: true,
|
|
479
|
-
value: false
|
|
480
|
-
}); // self and source are DEV only properties.
|
|
677
|
+
if (alignment && typeof alignmentAxis === 'number') {
|
|
678
|
+
crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
|
|
679
|
+
}
|
|
481
680
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
681
|
+
return isVertical ? {
|
|
682
|
+
x: crossAxis * crossAxisMulti,
|
|
683
|
+
y: mainAxis * mainAxisMulti
|
|
684
|
+
} : {
|
|
685
|
+
x: mainAxis * mainAxisMulti,
|
|
686
|
+
y: crossAxis * crossAxisMulti
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Displaces the floating element from its reference element.
|
|
691
|
+
* @see https://floating-ui.com/docs/offset
|
|
692
|
+
*/
|
|
489
693
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
value: source
|
|
495
|
-
});
|
|
694
|
+
const offset = function (value) {
|
|
695
|
+
if (value === void 0) {
|
|
696
|
+
value = 0;
|
|
697
|
+
}
|
|
496
698
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
}
|
|
501
|
-
}
|
|
699
|
+
return {
|
|
700
|
+
name: 'offset',
|
|
701
|
+
options: value,
|
|
502
702
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
703
|
+
async fn(middlewareArguments) {
|
|
704
|
+
const {
|
|
705
|
+
x,
|
|
706
|
+
y
|
|
707
|
+
} = middlewareArguments;
|
|
708
|
+
const diffCoords = await convertValueToCoords(middlewareArguments, value);
|
|
709
|
+
return {
|
|
710
|
+
x: x + diffCoords.x,
|
|
711
|
+
y: y + diffCoords.y,
|
|
712
|
+
data: diffCoords
|
|
713
|
+
};
|
|
714
|
+
}
|
|
511
715
|
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
var propName; // Reserved names are extracted
|
|
716
|
+
};
|
|
717
|
+
};
|
|
515
718
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
|
|
520
|
-
// or <div key="Hi" {...props} /> ). We want to deprecate key spread,
|
|
521
|
-
// but as an intermediary step, we will use jsxDEV for everything except
|
|
522
|
-
// <div {...props} key="Hi" />, because we aren't currently able to tell if
|
|
523
|
-
// key is explicitly declared to be undefined or not.
|
|
719
|
+
function getCrossAxis(axis) {
|
|
720
|
+
return axis === 'x' ? 'y' : 'x';
|
|
721
|
+
}
|
|
524
722
|
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
723
|
+
/**
|
|
724
|
+
* Shifts the floating element in order to keep it in view when it will overflow
|
|
725
|
+
* a clipping boundary.
|
|
726
|
+
* @see https://floating-ui.com/docs/shift
|
|
727
|
+
*/
|
|
728
|
+
const shift = function (options) {
|
|
729
|
+
if (options === void 0) {
|
|
730
|
+
options = {};
|
|
731
|
+
}
|
|
528
732
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
733
|
+
return {
|
|
734
|
+
name: 'shift',
|
|
735
|
+
options,
|
|
532
736
|
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
737
|
+
async fn(middlewareArguments) {
|
|
738
|
+
const {
|
|
739
|
+
x,
|
|
740
|
+
y,
|
|
741
|
+
placement
|
|
742
|
+
} = middlewareArguments;
|
|
743
|
+
const {
|
|
744
|
+
mainAxis: checkMainAxis = true,
|
|
745
|
+
crossAxis: checkCrossAxis = false,
|
|
746
|
+
limiter = {
|
|
747
|
+
fn: _ref => {
|
|
748
|
+
let {
|
|
749
|
+
x,
|
|
750
|
+
y
|
|
751
|
+
} = _ref;
|
|
752
|
+
return {
|
|
753
|
+
x,
|
|
754
|
+
y
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
},
|
|
758
|
+
...detectOverflowOptions
|
|
759
|
+
} = options;
|
|
760
|
+
const coords = {
|
|
761
|
+
x,
|
|
762
|
+
y
|
|
763
|
+
};
|
|
764
|
+
const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
|
|
765
|
+
const mainAxis = getMainAxisFromPlacement(getSide(placement));
|
|
766
|
+
const crossAxis = getCrossAxis(mainAxis);
|
|
767
|
+
let mainAxisCoord = coords[mainAxis];
|
|
768
|
+
let crossAxisCoord = coords[crossAxis];
|
|
537
769
|
|
|
770
|
+
if (checkMainAxis) {
|
|
771
|
+
const minSide = mainAxis === 'y' ? 'top' : 'left';
|
|
772
|
+
const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
|
|
773
|
+
const min = mainAxisCoord + overflow[minSide];
|
|
774
|
+
const max = mainAxisCoord - overflow[maxSide];
|
|
775
|
+
mainAxisCoord = within(min, mainAxisCoord, max);
|
|
776
|
+
}
|
|
538
777
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
778
|
+
if (checkCrossAxis) {
|
|
779
|
+
const minSide = crossAxis === 'y' ? 'top' : 'left';
|
|
780
|
+
const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
|
|
781
|
+
const min = crossAxisCoord + overflow[minSide];
|
|
782
|
+
const max = crossAxisCoord - overflow[maxSide];
|
|
783
|
+
crossAxisCoord = within(min, crossAxisCoord, max);
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
const limitedCoords = limiter.fn({ ...middlewareArguments,
|
|
787
|
+
[mainAxis]: mainAxisCoord,
|
|
788
|
+
[crossAxis]: crossAxisCoord
|
|
789
|
+
});
|
|
790
|
+
return { ...limitedCoords,
|
|
791
|
+
data: {
|
|
792
|
+
x: limitedCoords.x - x,
|
|
793
|
+
y: limitedCoords.y - y
|
|
794
|
+
}
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
};
|
|
799
|
+
};
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* Provides data to change the size of the floating element. For instance,
|
|
803
|
+
* prevent it from overflowing its clipping boundary or match the width of the
|
|
804
|
+
* reference element.
|
|
805
|
+
* @see https://floating-ui.com/docs/size
|
|
806
|
+
*/
|
|
807
|
+
const size = function (options) {
|
|
808
|
+
if (options === void 0) {
|
|
809
|
+
options = {};
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
return {
|
|
813
|
+
name: 'size',
|
|
814
|
+
options,
|
|
815
|
+
|
|
816
|
+
async fn(middlewareArguments) {
|
|
817
|
+
const {
|
|
818
|
+
placement,
|
|
819
|
+
rects,
|
|
820
|
+
platform,
|
|
821
|
+
elements
|
|
822
|
+
} = middlewareArguments;
|
|
823
|
+
const {
|
|
824
|
+
apply = () => {},
|
|
825
|
+
...detectOverflowOptions
|
|
826
|
+
} = options;
|
|
827
|
+
const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
|
|
828
|
+
const side = getSide(placement);
|
|
829
|
+
const alignment = getAlignment(placement);
|
|
830
|
+
let heightSide;
|
|
831
|
+
let widthSide;
|
|
832
|
+
|
|
833
|
+
if (side === 'top' || side === 'bottom') {
|
|
834
|
+
heightSide = side;
|
|
835
|
+
widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
|
|
836
|
+
} else {
|
|
837
|
+
widthSide = side;
|
|
838
|
+
heightSide = alignment === 'end' ? 'top' : 'bottom';
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
const xMin = max$1(overflow.left, 0);
|
|
842
|
+
const xMax = max$1(overflow.right, 0);
|
|
843
|
+
const yMin = max$1(overflow.top, 0);
|
|
844
|
+
const yMax = max$1(overflow.bottom, 0);
|
|
845
|
+
const dimensions = {
|
|
846
|
+
availableHeight: rects.floating.height - (['left', 'right'].includes(placement) ? 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max$1(overflow.top, overflow.bottom)) : overflow[heightSide]),
|
|
847
|
+
availableWidth: rects.floating.width - (['top', 'bottom'].includes(placement) ? 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max$1(overflow.left, overflow.right)) : overflow[widthSide])
|
|
848
|
+
};
|
|
849
|
+
await apply({ ...middlewareArguments,
|
|
850
|
+
...dimensions
|
|
851
|
+
});
|
|
852
|
+
const nextDimensions = await platform.getDimensions(elements.floating);
|
|
853
|
+
|
|
854
|
+
if (rects.floating.width !== nextDimensions.width || rects.floating.height !== nextDimensions.height) {
|
|
855
|
+
return {
|
|
856
|
+
reset: {
|
|
857
|
+
rects: true
|
|
858
|
+
}
|
|
859
|
+
};
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
return {};
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
};
|
|
866
|
+
};
|
|
867
|
+
|
|
868
|
+
/**
|
|
869
|
+
* Provides improved positioning for inline reference elements that can span
|
|
870
|
+
* over multiple lines, such as hyperlinks or range selections.
|
|
871
|
+
* @see https://floating-ui.com/docs/inline
|
|
872
|
+
*/
|
|
873
|
+
const inline = function (options) {
|
|
874
|
+
if (options === void 0) {
|
|
875
|
+
options = {};
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
return {
|
|
879
|
+
name: 'inline',
|
|
880
|
+
options,
|
|
881
|
+
|
|
882
|
+
async fn(middlewareArguments) {
|
|
883
|
+
var _await$platform$getCl;
|
|
884
|
+
|
|
885
|
+
const {
|
|
886
|
+
placement,
|
|
887
|
+
elements,
|
|
888
|
+
rects,
|
|
889
|
+
platform,
|
|
890
|
+
strategy
|
|
891
|
+
} = middlewareArguments; // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
|
|
892
|
+
// ClientRect's bounds, despite the event listener being triggered. A
|
|
893
|
+
// padding of 2 seems to handle this issue.
|
|
894
|
+
|
|
895
|
+
const {
|
|
896
|
+
padding = 2,
|
|
897
|
+
x,
|
|
898
|
+
y
|
|
899
|
+
} = options;
|
|
900
|
+
const fallback = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
901
|
+
rect: rects.reference,
|
|
902
|
+
offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
|
|
903
|
+
strategy
|
|
904
|
+
}) : rects.reference);
|
|
905
|
+
const clientRects = (_await$platform$getCl = await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) != null ? _await$platform$getCl : [];
|
|
906
|
+
const paddingObject = getSideObjectFromPadding(padding);
|
|
907
|
+
|
|
908
|
+
function getBoundingClientRect() {
|
|
909
|
+
// There are two rects and they are disjoined
|
|
910
|
+
if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
|
|
911
|
+
var _clientRects$find;
|
|
912
|
+
|
|
913
|
+
// Find the first rect in which the point is fully inside
|
|
914
|
+
return (_clientRects$find = clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom)) != null ? _clientRects$find : fallback;
|
|
915
|
+
} // There are 2 or more connected rects
|
|
916
|
+
|
|
917
|
+
|
|
918
|
+
if (clientRects.length >= 2) {
|
|
919
|
+
if (getMainAxisFromPlacement(placement) === 'x') {
|
|
920
|
+
const firstRect = clientRects[0];
|
|
921
|
+
const lastRect = clientRects[clientRects.length - 1];
|
|
922
|
+
const isTop = getSide(placement) === 'top';
|
|
923
|
+
const top = firstRect.top;
|
|
924
|
+
const bottom = lastRect.bottom;
|
|
925
|
+
const left = isTop ? firstRect.left : lastRect.left;
|
|
926
|
+
const right = isTop ? firstRect.right : lastRect.right;
|
|
927
|
+
const width = right - left;
|
|
928
|
+
const height = bottom - top;
|
|
929
|
+
return {
|
|
930
|
+
top,
|
|
931
|
+
bottom,
|
|
932
|
+
left,
|
|
933
|
+
right,
|
|
934
|
+
width,
|
|
935
|
+
height,
|
|
936
|
+
x: left,
|
|
937
|
+
y: top
|
|
938
|
+
};
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
const isLeftSide = getSide(placement) === 'left';
|
|
942
|
+
const maxRight = max$1(...clientRects.map(rect => rect.right));
|
|
943
|
+
const minLeft = min$1(...clientRects.map(rect => rect.left));
|
|
944
|
+
const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
|
|
945
|
+
const top = measureRects[0].top;
|
|
946
|
+
const bottom = measureRects[measureRects.length - 1].bottom;
|
|
947
|
+
const left = minLeft;
|
|
948
|
+
const right = maxRight;
|
|
949
|
+
const width = right - left;
|
|
950
|
+
const height = bottom - top;
|
|
951
|
+
return {
|
|
952
|
+
top,
|
|
953
|
+
bottom,
|
|
954
|
+
left,
|
|
955
|
+
right,
|
|
956
|
+
width,
|
|
957
|
+
height,
|
|
958
|
+
x: left,
|
|
959
|
+
y: top
|
|
960
|
+
};
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
return fallback;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
const resetRects = await platform.getElementRects({
|
|
967
|
+
reference: {
|
|
968
|
+
getBoundingClientRect
|
|
969
|
+
},
|
|
970
|
+
floating: elements.floating,
|
|
971
|
+
strategy
|
|
972
|
+
});
|
|
973
|
+
|
|
974
|
+
if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {
|
|
975
|
+
return {
|
|
976
|
+
reset: {
|
|
977
|
+
rects: resetRects
|
|
978
|
+
}
|
|
979
|
+
};
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
return {};
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
};
|
|
986
|
+
};
|
|
987
|
+
|
|
988
|
+
function isWindow(value) {
|
|
989
|
+
return value && value.document && value.location && value.alert && value.setInterval;
|
|
990
|
+
}
|
|
991
|
+
function getWindow(node) {
|
|
992
|
+
if (node == null) {
|
|
993
|
+
return window;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
if (!isWindow(node)) {
|
|
997
|
+
const ownerDocument = node.ownerDocument;
|
|
998
|
+
return ownerDocument ? ownerDocument.defaultView || window : window;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
return node;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
function getComputedStyle(element) {
|
|
1005
|
+
return getWindow(element).getComputedStyle(element);
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
function getNodeName(node) {
|
|
1009
|
+
return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
|
|
1010
|
+
}
|
|
544
1011
|
|
|
1012
|
+
function getUAString() {
|
|
1013
|
+
const uaData = navigator.userAgentData;
|
|
545
1014
|
|
|
546
|
-
|
|
547
|
-
|
|
1015
|
+
if (uaData != null && uaData.brands) {
|
|
1016
|
+
return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
|
|
1017
|
+
}
|
|
548
1018
|
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
props[propName] = defaultProps[propName];
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
}
|
|
1019
|
+
return navigator.userAgent;
|
|
1020
|
+
}
|
|
555
1021
|
|
|
556
|
-
|
|
557
|
-
|
|
1022
|
+
function isHTMLElement(value) {
|
|
1023
|
+
return value instanceof getWindow(value).HTMLElement;
|
|
1024
|
+
}
|
|
1025
|
+
function isElement(value) {
|
|
1026
|
+
return value instanceof getWindow(value).Element;
|
|
1027
|
+
}
|
|
1028
|
+
function isNode(value) {
|
|
1029
|
+
return value instanceof getWindow(value).Node;
|
|
1030
|
+
}
|
|
1031
|
+
function isShadowRoot(node) {
|
|
1032
|
+
// Browsers without `ShadowRoot` support
|
|
1033
|
+
if (typeof ShadowRoot === 'undefined') {
|
|
1034
|
+
return false;
|
|
1035
|
+
}
|
|
558
1036
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
1037
|
+
const OwnElement = getWindow(node).ShadowRoot;
|
|
1038
|
+
return node instanceof OwnElement || node instanceof ShadowRoot;
|
|
1039
|
+
}
|
|
1040
|
+
function isOverflowElement(element) {
|
|
1041
|
+
// Firefox wants us to check `-x` and `-y` variations as well
|
|
1042
|
+
const {
|
|
1043
|
+
overflow,
|
|
1044
|
+
overflowX,
|
|
1045
|
+
overflowY,
|
|
1046
|
+
display
|
|
1047
|
+
} = getComputedStyle(element);
|
|
1048
|
+
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
|
|
1049
|
+
}
|
|
1050
|
+
function isTableElement(element) {
|
|
1051
|
+
return ['table', 'td', 'th'].includes(getNodeName(element));
|
|
1052
|
+
}
|
|
1053
|
+
function isContainingBlock(element) {
|
|
1054
|
+
// TODO: Try and use feature detection here instead
|
|
1055
|
+
const isFirefox = /firefox/i.test(getUAString());
|
|
1056
|
+
const css = getComputedStyle(element);
|
|
1057
|
+
const backdropFilter = css.backdropFilter || css.WebkitBackdropFilter; // This is non-exhaustive but covers the most common CSS properties that
|
|
1058
|
+
// create a containing block.
|
|
1059
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
562
1060
|
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
1061
|
+
return css.transform !== 'none' || css.perspective !== 'none' || (backdropFilter ? backdropFilter !== 'none' : false) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective'].some(value => css.willChange.includes(value)) || ['paint', 'layout', 'strict', 'content'].some( // TS 4.1 compat
|
|
1062
|
+
value => {
|
|
1063
|
+
const contain = css.contain;
|
|
1064
|
+
return contain != null ? contain.includes(value) : false;
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
function isLayoutViewport() {
|
|
1068
|
+
// Not Safari
|
|
1069
|
+
return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
|
|
1070
|
+
// • Always-visible scrollbar or not
|
|
1071
|
+
// • Width of <html>, etc.
|
|
1072
|
+
// const vV = win.visualViewport;
|
|
1073
|
+
// return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
|
|
1074
|
+
}
|
|
1075
|
+
function isLastTraversableNode(node) {
|
|
1076
|
+
return ['html', 'body', '#document'].includes(getNodeName(node));
|
|
1077
|
+
}
|
|
567
1078
|
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
1079
|
+
const min = Math.min;
|
|
1080
|
+
const max = Math.max;
|
|
1081
|
+
const round = Math.round;
|
|
571
1082
|
|
|
572
|
-
|
|
573
|
-
|
|
1083
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
|
1084
|
+
var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
|
|
574
1085
|
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
1086
|
+
if (includeScale === void 0) {
|
|
1087
|
+
includeScale = false;
|
|
1088
|
+
}
|
|
578
1089
|
|
|
579
|
-
|
|
1090
|
+
if (isFixedStrategy === void 0) {
|
|
1091
|
+
isFixedStrategy = false;
|
|
1092
|
+
}
|
|
580
1093
|
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
/**
|
|
585
|
-
* Verifies the object is a ReactElement.
|
|
586
|
-
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
587
|
-
* @param {?object} object
|
|
588
|
-
* @return {boolean} True if `object` is a ReactElement.
|
|
589
|
-
* @final
|
|
590
|
-
*/
|
|
1094
|
+
const clientRect = element.getBoundingClientRect();
|
|
1095
|
+
let scaleX = 1;
|
|
1096
|
+
let scaleY = 1;
|
|
591
1097
|
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
}
|
|
1098
|
+
if (includeScale && isHTMLElement(element)) {
|
|
1099
|
+
scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
|
|
1100
|
+
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
|
|
1101
|
+
}
|
|
597
1102
|
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
1103
|
+
const win = isElement(element) ? getWindow(element) : window;
|
|
1104
|
+
const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
|
1105
|
+
const x = (clientRect.left + (addVisualOffsets ? (_win$visualViewport$o = (_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) != null ? _win$visualViewport$o : 0 : 0)) / scaleX;
|
|
1106
|
+
const y = (clientRect.top + (addVisualOffsets ? (_win$visualViewport$o2 = (_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) != null ? _win$visualViewport$o2 : 0 : 0)) / scaleY;
|
|
1107
|
+
const width = clientRect.width / scaleX;
|
|
1108
|
+
const height = clientRect.height / scaleY;
|
|
1109
|
+
return {
|
|
1110
|
+
width,
|
|
1111
|
+
height,
|
|
1112
|
+
top: y,
|
|
1113
|
+
right: x + width,
|
|
1114
|
+
bottom: y + height,
|
|
1115
|
+
left: x,
|
|
1116
|
+
x,
|
|
1117
|
+
y
|
|
1118
|
+
};
|
|
1119
|
+
}
|
|
602
1120
|
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
}
|
|
1121
|
+
function getDocumentElement(node) {
|
|
1122
|
+
return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
|
|
1123
|
+
}
|
|
607
1124
|
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
1125
|
+
function getNodeScroll(element) {
|
|
1126
|
+
if (isElement(element)) {
|
|
1127
|
+
return {
|
|
1128
|
+
scrollLeft: element.scrollLeft,
|
|
1129
|
+
scrollTop: element.scrollTop
|
|
1130
|
+
};
|
|
1131
|
+
}
|
|
611
1132
|
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
618
|
-
}
|
|
1133
|
+
return {
|
|
1134
|
+
scrollLeft: element.pageXOffset,
|
|
1135
|
+
scrollTop: element.pageYOffset
|
|
1136
|
+
};
|
|
1137
|
+
}
|
|
619
1138
|
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
* object keys are not valid. This allows us to keep track of children between
|
|
626
|
-
* updates.
|
|
627
|
-
*/
|
|
1139
|
+
function getWindowScrollBarX(element) {
|
|
1140
|
+
// If <html> has a CSS width greater than the viewport, then this will be
|
|
1141
|
+
// incorrect for RTL.
|
|
1142
|
+
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
|
1143
|
+
}
|
|
628
1144
|
|
|
1145
|
+
function isScaled(element) {
|
|
1146
|
+
const rect = getBoundingClientRect(element);
|
|
1147
|
+
return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
|
|
1148
|
+
}
|
|
629
1149
|
|
|
630
|
-
|
|
1150
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
1151
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1152
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
1153
|
+
const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
|
|
1154
|
+
isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
|
|
1155
|
+
let scroll = {
|
|
1156
|
+
scrollLeft: 0,
|
|
1157
|
+
scrollTop: 0
|
|
1158
|
+
};
|
|
1159
|
+
const offsets = {
|
|
1160
|
+
x: 0,
|
|
1161
|
+
y: 0
|
|
1162
|
+
};
|
|
631
1163
|
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
1164
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
|
|
1165
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
1166
|
+
scroll = getNodeScroll(offsetParent);
|
|
1167
|
+
}
|
|
635
1168
|
|
|
636
|
-
|
|
637
|
-
|
|
1169
|
+
if (isHTMLElement(offsetParent)) {
|
|
1170
|
+
const offsetRect = getBoundingClientRect(offsetParent, true);
|
|
1171
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1172
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1173
|
+
} else if (documentElement) {
|
|
1174
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
638
1177
|
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
1178
|
+
return {
|
|
1179
|
+
x: rect.left + scroll.scrollLeft - offsets.x,
|
|
1180
|
+
y: rect.top + scroll.scrollTop - offsets.y,
|
|
1181
|
+
width: rect.width,
|
|
1182
|
+
height: rect.height
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
643
1185
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
* @param {*} parentType element's parent's type.
|
|
657
|
-
*/
|
|
1186
|
+
function getParentNode(node) {
|
|
1187
|
+
if (getNodeName(node) === 'html') {
|
|
1188
|
+
return node;
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
const result = // Step into the shadow DOM of the parent of a slotted node
|
|
1192
|
+
node.assignedSlot || // DOM Element detected
|
|
1193
|
+
node.parentNode || ( // ShadowRoot detected
|
|
1194
|
+
isShadowRoot(node) ? node.host : null) || // Fallback
|
|
1195
|
+
getDocumentElement(node);
|
|
1196
|
+
return isShadowRoot(result) ? result.host : result;
|
|
1197
|
+
}
|
|
658
1198
|
|
|
1199
|
+
function getTrueOffsetParent(element) {
|
|
1200
|
+
if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
|
|
1201
|
+
return null;
|
|
1202
|
+
}
|
|
659
1203
|
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
if (!element._store || element._store.validated || element.key != null) {
|
|
663
|
-
return;
|
|
664
|
-
}
|
|
1204
|
+
return element.offsetParent;
|
|
1205
|
+
}
|
|
665
1206
|
|
|
666
|
-
|
|
667
|
-
|
|
1207
|
+
function getContainingBlock(element) {
|
|
1208
|
+
let currentNode = getParentNode(element);
|
|
668
1209
|
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
1210
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1211
|
+
if (isContainingBlock(currentNode)) {
|
|
1212
|
+
return currentNode;
|
|
1213
|
+
} else {
|
|
1214
|
+
currentNode = getParentNode(currentNode);
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
672
1217
|
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
1218
|
+
return null;
|
|
1219
|
+
} // Gets the closest ancestor positioned element. Handles some edge cases,
|
|
1220
|
+
// such as table ancestors and cross browser bugs.
|
|
676
1221
|
|
|
677
|
-
var childOwner = '';
|
|
678
1222
|
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
}
|
|
1223
|
+
function getOffsetParent(element) {
|
|
1224
|
+
const window = getWindow(element);
|
|
1225
|
+
let offsetParent = getTrueOffsetParent(element);
|
|
683
1226
|
|
|
684
|
-
|
|
1227
|
+
while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
|
|
1228
|
+
offsetParent = getTrueOffsetParent(offsetParent);
|
|
1229
|
+
}
|
|
685
1230
|
|
|
686
|
-
|
|
1231
|
+
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
|
|
1232
|
+
return window;
|
|
1233
|
+
}
|
|
687
1234
|
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
}
|
|
691
|
-
/**
|
|
692
|
-
* Ensure that every element either is passed in a static location, in an
|
|
693
|
-
* array with an explicit keys property defined, or in an object literal
|
|
694
|
-
* with valid key property.
|
|
695
|
-
*
|
|
696
|
-
* @internal
|
|
697
|
-
* @param {ReactNode} node Statically passed child of any type.
|
|
698
|
-
* @param {*} parentType node's parent's type.
|
|
699
|
-
*/
|
|
1235
|
+
return offsetParent || getContainingBlock(element) || window;
|
|
1236
|
+
}
|
|
700
1237
|
|
|
1238
|
+
function getDimensions(element) {
|
|
1239
|
+
if (isHTMLElement(element)) {
|
|
1240
|
+
return {
|
|
1241
|
+
width: element.offsetWidth,
|
|
1242
|
+
height: element.offsetHeight
|
|
1243
|
+
};
|
|
1244
|
+
}
|
|
701
1245
|
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
1246
|
+
const rect = getBoundingClientRect(element);
|
|
1247
|
+
return {
|
|
1248
|
+
width: rect.width,
|
|
1249
|
+
height: rect.height
|
|
1250
|
+
};
|
|
1251
|
+
}
|
|
707
1252
|
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
1253
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
1254
|
+
let {
|
|
1255
|
+
rect,
|
|
1256
|
+
offsetParent,
|
|
1257
|
+
strategy
|
|
1258
|
+
} = _ref;
|
|
1259
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1260
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
711
1261
|
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
}
|
|
716
|
-
} else if (isValidElement(node)) {
|
|
717
|
-
// This element was passed in a valid location.
|
|
718
|
-
if (node._store) {
|
|
719
|
-
node._store.validated = true;
|
|
720
|
-
}
|
|
721
|
-
} else if (node) {
|
|
722
|
-
var iteratorFn = getIteratorFn(node);
|
|
1262
|
+
if (offsetParent === documentElement) {
|
|
1263
|
+
return rect;
|
|
1264
|
+
}
|
|
723
1265
|
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
1266
|
+
let scroll = {
|
|
1267
|
+
scrollLeft: 0,
|
|
1268
|
+
scrollTop: 0
|
|
1269
|
+
};
|
|
1270
|
+
const offsets = {
|
|
1271
|
+
x: 0,
|
|
1272
|
+
y: 0
|
|
1273
|
+
};
|
|
730
1274
|
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
/**
|
|
742
|
-
* Given an element, validate that its props follow the propTypes definition,
|
|
743
|
-
* provided by the type.
|
|
744
|
-
*
|
|
745
|
-
* @param {ReactElement} element
|
|
746
|
-
*/
|
|
1275
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
|
|
1276
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
1277
|
+
scroll = getNodeScroll(offsetParent);
|
|
1278
|
+
}
|
|
747
1279
|
|
|
1280
|
+
if (isHTMLElement(offsetParent)) {
|
|
1281
|
+
const offsetRect = getBoundingClientRect(offsetParent, true);
|
|
1282
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1283
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1284
|
+
} // This doesn't appear to be need to be negated.
|
|
1285
|
+
// else if (documentElement) {
|
|
1286
|
+
// offsets.x = getWindowScrollBarX(documentElement);
|
|
1287
|
+
// }
|
|
748
1288
|
|
|
749
|
-
|
|
750
|
-
{
|
|
751
|
-
var type = element.type;
|
|
1289
|
+
}
|
|
752
1290
|
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
1291
|
+
return { ...rect,
|
|
1292
|
+
x: rect.x - scroll.scrollLeft + offsets.x,
|
|
1293
|
+
y: rect.y - scroll.scrollTop + offsets.y
|
|
1294
|
+
};
|
|
1295
|
+
}
|
|
756
1296
|
|
|
757
|
-
|
|
1297
|
+
function getViewportRect(element, strategy) {
|
|
1298
|
+
const win = getWindow(element);
|
|
1299
|
+
const html = getDocumentElement(element);
|
|
1300
|
+
const visualViewport = win.visualViewport;
|
|
1301
|
+
let width = html.clientWidth;
|
|
1302
|
+
let height = html.clientHeight;
|
|
1303
|
+
let x = 0;
|
|
1304
|
+
let y = 0;
|
|
758
1305
|
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
764
|
-
propTypes = type.propTypes;
|
|
765
|
-
} else {
|
|
766
|
-
return;
|
|
767
|
-
}
|
|
1306
|
+
if (visualViewport) {
|
|
1307
|
+
width = visualViewport.width;
|
|
1308
|
+
height = visualViewport.height;
|
|
1309
|
+
const layoutViewport = isLayoutViewport();
|
|
768
1310
|
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
1311
|
+
if (layoutViewport || !layoutViewport && strategy === 'fixed') {
|
|
1312
|
+
x = visualViewport.offsetLeft;
|
|
1313
|
+
y = visualViewport.offsetTop;
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
775
1316
|
|
|
776
|
-
|
|
1317
|
+
return {
|
|
1318
|
+
width,
|
|
1319
|
+
height,
|
|
1320
|
+
x,
|
|
1321
|
+
y
|
|
1322
|
+
};
|
|
1323
|
+
}
|
|
777
1324
|
|
|
778
|
-
|
|
779
|
-
}
|
|
1325
|
+
// of the `<html>` and `<body>` rect bounds if horizontally scrollable
|
|
780
1326
|
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
/**
|
|
787
|
-
* Given a fragment, validate that it can only be provided with fragment props
|
|
788
|
-
* @param {ReactElement} fragment
|
|
789
|
-
*/
|
|
1327
|
+
function getDocumentRect(element) {
|
|
1328
|
+
var _element$ownerDocumen;
|
|
790
1329
|
|
|
1330
|
+
const html = getDocumentElement(element);
|
|
1331
|
+
const scroll = getNodeScroll(element);
|
|
1332
|
+
const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
|
1333
|
+
const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
|
1334
|
+
const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
|
1335
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
1336
|
+
const y = -scroll.scrollTop;
|
|
791
1337
|
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
1338
|
+
if (getComputedStyle(body || html).direction === 'rtl') {
|
|
1339
|
+
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
|
1340
|
+
}
|
|
795
1341
|
|
|
796
|
-
|
|
797
|
-
|
|
1342
|
+
return {
|
|
1343
|
+
width,
|
|
1344
|
+
height,
|
|
1345
|
+
x,
|
|
1346
|
+
y
|
|
1347
|
+
};
|
|
1348
|
+
}
|
|
798
1349
|
|
|
799
|
-
|
|
800
|
-
|
|
1350
|
+
function getNearestOverflowAncestor(node) {
|
|
1351
|
+
const parentNode = getParentNode(node);
|
|
801
1352
|
|
|
802
|
-
|
|
1353
|
+
if (isLastTraversableNode(parentNode)) {
|
|
1354
|
+
// @ts-ignore assume body is always available
|
|
1355
|
+
return node.ownerDocument.body;
|
|
1356
|
+
}
|
|
803
1357
|
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
1358
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
1359
|
+
return parentNode;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
return getNearestOverflowAncestor(parentNode);
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
function getOverflowAncestors(node, list) {
|
|
1366
|
+
var _node$ownerDocument;
|
|
808
1367
|
|
|
809
|
-
|
|
810
|
-
|
|
1368
|
+
if (list === void 0) {
|
|
1369
|
+
list = [];
|
|
1370
|
+
}
|
|
811
1371
|
|
|
812
|
-
|
|
1372
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
1373
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
|
|
1374
|
+
const win = getWindow(scrollableAncestor);
|
|
1375
|
+
const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
|
|
1376
|
+
const updatedList = list.concat(target);
|
|
1377
|
+
return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
|
|
1378
|
+
updatedList.concat(getOverflowAncestors(target));
|
|
1379
|
+
}
|
|
813
1380
|
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
1381
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
1382
|
+
const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
|
|
1383
|
+
const top = clientRect.top + element.clientTop;
|
|
1384
|
+
const left = clientRect.left + element.clientLeft;
|
|
1385
|
+
return {
|
|
1386
|
+
top,
|
|
1387
|
+
left,
|
|
1388
|
+
x: left,
|
|
1389
|
+
y: top,
|
|
1390
|
+
right: left + element.clientWidth,
|
|
1391
|
+
bottom: top + element.clientHeight,
|
|
1392
|
+
width: element.clientWidth,
|
|
1393
|
+
height: element.clientHeight
|
|
1394
|
+
};
|
|
1395
|
+
}
|
|
818
1396
|
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
1397
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
1398
|
+
if (clippingAncestor === 'viewport') {
|
|
1399
|
+
return rectToClientRect(getViewportRect(element, strategy));
|
|
1400
|
+
}
|
|
823
1401
|
|
|
824
|
-
|
|
825
|
-
|
|
1402
|
+
if (isElement(clippingAncestor)) {
|
|
1403
|
+
return getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
1404
|
+
}
|
|
826
1405
|
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
1406
|
+
return rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
|
1407
|
+
} // A "clipping ancestor" is an overflowable container with the characteristic of
|
|
1408
|
+
// clipping (or hiding) overflowing elements with a position different from
|
|
1409
|
+
// `initial`
|
|
830
1410
|
|
|
831
|
-
var sourceInfo = getSourceInfoErrorAddendum(source);
|
|
832
1411
|
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
}
|
|
1412
|
+
function getClippingElementAncestors(element) {
|
|
1413
|
+
let result = getOverflowAncestors(element).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
1414
|
+
let currentNode = element;
|
|
1415
|
+
let currentContainingBlockComputedStyle = null; // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
838
1416
|
|
|
839
|
-
|
|
1417
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1418
|
+
const computedStyle = getComputedStyle(currentNode);
|
|
840
1419
|
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
} else {
|
|
849
|
-
typeString = typeof type;
|
|
850
|
-
}
|
|
1420
|
+
if (computedStyle.position === 'static' && currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) && !isContainingBlock(currentNode)) {
|
|
1421
|
+
// Drop non-containing blocks
|
|
1422
|
+
result = result.filter(ancestor => ancestor !== currentNode);
|
|
1423
|
+
} else {
|
|
1424
|
+
// Record last containing block for next iteration
|
|
1425
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
1426
|
+
}
|
|
851
1427
|
|
|
852
|
-
|
|
853
|
-
|
|
1428
|
+
currentNode = getParentNode(currentNode);
|
|
1429
|
+
}
|
|
854
1430
|
|
|
855
|
-
|
|
856
|
-
|
|
1431
|
+
return result;
|
|
1432
|
+
} // Gets the maximum area that the element is visible in due to any number of
|
|
1433
|
+
// clipping ancestors
|
|
857
1434
|
|
|
858
|
-
if (element == null) {
|
|
859
|
-
return element;
|
|
860
|
-
} // Skip key warning if the type isn't valid since our key validation logic
|
|
861
|
-
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
862
|
-
// We don't want exception behavior to differ between dev and prod.
|
|
863
|
-
// (Rendering will throw with a helpful message and as soon as the type is
|
|
864
|
-
// fixed, the key warnings will appear.)
|
|
865
1435
|
|
|
1436
|
+
function getClippingRect(_ref) {
|
|
1437
|
+
let {
|
|
1438
|
+
element,
|
|
1439
|
+
boundary,
|
|
1440
|
+
rootBoundary,
|
|
1441
|
+
strategy
|
|
1442
|
+
} = _ref;
|
|
1443
|
+
const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element) : [].concat(boundary);
|
|
1444
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
1445
|
+
const firstClippingAncestor = clippingAncestors[0];
|
|
1446
|
+
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
1447
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
1448
|
+
accRect.top = max(rect.top, accRect.top);
|
|
1449
|
+
accRect.right = min(rect.right, accRect.right);
|
|
1450
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
1451
|
+
accRect.left = max(rect.left, accRect.left);
|
|
1452
|
+
return accRect;
|
|
1453
|
+
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
1454
|
+
return {
|
|
1455
|
+
width: clippingRect.right - clippingRect.left,
|
|
1456
|
+
height: clippingRect.bottom - clippingRect.top,
|
|
1457
|
+
x: clippingRect.left,
|
|
1458
|
+
y: clippingRect.top
|
|
1459
|
+
};
|
|
1460
|
+
}
|
|
866
1461
|
|
|
867
|
-
|
|
868
|
-
|
|
1462
|
+
const platform = {
|
|
1463
|
+
getClippingRect,
|
|
1464
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
1465
|
+
isElement,
|
|
1466
|
+
getDimensions,
|
|
1467
|
+
getOffsetParent,
|
|
1468
|
+
getDocumentElement,
|
|
1469
|
+
getElementRects: _ref => {
|
|
1470
|
+
let {
|
|
1471
|
+
reference,
|
|
1472
|
+
floating,
|
|
1473
|
+
strategy
|
|
1474
|
+
} = _ref;
|
|
1475
|
+
return {
|
|
1476
|
+
reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
|
|
1477
|
+
floating: { ...getDimensions(floating),
|
|
1478
|
+
x: 0,
|
|
1479
|
+
y: 0
|
|
1480
|
+
}
|
|
1481
|
+
};
|
|
1482
|
+
},
|
|
1483
|
+
getClientRects: element => Array.from(element.getClientRects()),
|
|
1484
|
+
isRTL: element => getComputedStyle(element).direction === 'rtl'
|
|
1485
|
+
};
|
|
869
1486
|
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
}
|
|
1487
|
+
/**
|
|
1488
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
1489
|
+
* next to a reference element when it is given a certain CSS positioning
|
|
1490
|
+
* strategy.
|
|
1491
|
+
*/
|
|
876
1492
|
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
|
|
882
|
-
}
|
|
883
|
-
} else {
|
|
884
|
-
validateChildKeys(children, type);
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
}
|
|
1493
|
+
const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
|
|
1494
|
+
platform,
|
|
1495
|
+
...options
|
|
1496
|
+
});
|
|
888
1497
|
|
|
889
|
-
|
|
890
|
-
validateFragmentProps(element);
|
|
891
|
-
} else {
|
|
892
|
-
validatePropTypes(element);
|
|
893
|
-
}
|
|
1498
|
+
var jsxRuntime = {exports: {}};
|
|
894
1499
|
|
|
895
|
-
|
|
896
|
-
}
|
|
897
|
-
} // These two functions exist to still get child warnings in dev
|
|
898
|
-
// even with the prod transform. This means that jsxDEV is purely
|
|
899
|
-
// opt-in behavior for better messages but that we won't stop
|
|
900
|
-
// giving you warnings if you use production apis.
|
|
1500
|
+
var reactJsxRuntime_development = {};
|
|
901
1501
|
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
}
|
|
911
|
-
}
|
|
1502
|
+
/** @license React v16.14.0
|
|
1503
|
+
* react-jsx-runtime.development.js
|
|
1504
|
+
*
|
|
1505
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
1506
|
+
*
|
|
1507
|
+
* This source code is licensed under the MIT license found in the
|
|
1508
|
+
* LICENSE file in the root directory of this source tree.
|
|
1509
|
+
*/
|
|
912
1510
|
|
|
913
|
-
|
|
914
|
-
// for now we can ship identical prod functions
|
|
1511
|
+
(function (exports) {
|
|
915
1512
|
|
|
916
|
-
|
|
1513
|
+
{
|
|
1514
|
+
(function() {
|
|
917
1515
|
|
|
918
|
-
|
|
919
|
-
exports.jsxs = jsxs;
|
|
920
|
-
})();
|
|
921
|
-
}
|
|
922
|
-
} (reactJsxRuntime_development));
|
|
1516
|
+
var React = require$$0__default["default"];
|
|
923
1517
|
|
|
924
|
-
|
|
1518
|
+
// ATTENTION
|
|
1519
|
+
// When adding new symbols to this file,
|
|
1520
|
+
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
1521
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
1522
|
+
// nor polyfill, then a plain number is used for performance.
|
|
1523
|
+
var REACT_ELEMENT_TYPE = 0xeac7;
|
|
1524
|
+
var REACT_PORTAL_TYPE = 0xeaca;
|
|
1525
|
+
exports.Fragment = 0xeacb;
|
|
1526
|
+
var REACT_STRICT_MODE_TYPE = 0xeacc;
|
|
1527
|
+
var REACT_PROFILER_TYPE = 0xead2;
|
|
1528
|
+
var REACT_PROVIDER_TYPE = 0xeacd;
|
|
1529
|
+
var REACT_CONTEXT_TYPE = 0xeace;
|
|
1530
|
+
var REACT_FORWARD_REF_TYPE = 0xead0;
|
|
1531
|
+
var REACT_SUSPENSE_TYPE = 0xead1;
|
|
1532
|
+
var REACT_SUSPENSE_LIST_TYPE = 0xead8;
|
|
1533
|
+
var REACT_MEMO_TYPE = 0xead3;
|
|
1534
|
+
var REACT_LAZY_TYPE = 0xead4;
|
|
1535
|
+
var REACT_BLOCK_TYPE = 0xead9;
|
|
1536
|
+
var REACT_SERVER_BLOCK_TYPE = 0xeada;
|
|
1537
|
+
var REACT_FUNDAMENTAL_TYPE = 0xead5;
|
|
1538
|
+
var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
|
|
1539
|
+
var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
|
|
925
1540
|
|
|
926
|
-
{
|
|
927
|
-
|
|
1541
|
+
if (typeof Symbol === 'function' && Symbol.for) {
|
|
1542
|
+
var symbolFor = Symbol.for;
|
|
1543
|
+
REACT_ELEMENT_TYPE = symbolFor('react.element');
|
|
1544
|
+
REACT_PORTAL_TYPE = symbolFor('react.portal');
|
|
1545
|
+
exports.Fragment = symbolFor('react.fragment');
|
|
1546
|
+
REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
|
|
1547
|
+
REACT_PROFILER_TYPE = symbolFor('react.profiler');
|
|
1548
|
+
REACT_PROVIDER_TYPE = symbolFor('react.provider');
|
|
1549
|
+
REACT_CONTEXT_TYPE = symbolFor('react.context');
|
|
1550
|
+
REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
|
|
1551
|
+
REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
|
|
1552
|
+
REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
|
|
1553
|
+
REACT_MEMO_TYPE = symbolFor('react.memo');
|
|
1554
|
+
REACT_LAZY_TYPE = symbolFor('react.lazy');
|
|
1555
|
+
REACT_BLOCK_TYPE = symbolFor('react.block');
|
|
1556
|
+
REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
|
|
1557
|
+
REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
|
|
1558
|
+
symbolFor('react.scope');
|
|
1559
|
+
symbolFor('react.opaque.id');
|
|
1560
|
+
REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
|
|
1561
|
+
symbolFor('react.offscreen');
|
|
1562
|
+
REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
|
|
928
1563
|
}
|
|
929
|
-
} (jsxRuntime));
|
|
930
|
-
|
|
931
|
-
var classnames = {exports: {}};
|
|
932
|
-
|
|
933
|
-
/*!
|
|
934
|
-
Copyright (c) 2018 Jed Watson.
|
|
935
|
-
Licensed under the MIT License (MIT), see
|
|
936
|
-
http://jedwatson.github.io/classnames
|
|
937
|
-
*/
|
|
938
1564
|
|
|
939
|
-
|
|
940
|
-
|
|
1565
|
+
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
1566
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
1567
|
+
function getIteratorFn(maybeIterable) {
|
|
1568
|
+
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
1569
|
+
return null;
|
|
1570
|
+
}
|
|
941
1571
|
|
|
942
|
-
|
|
1572
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
943
1573
|
|
|
944
|
-
|
|
1574
|
+
if (typeof maybeIterator === 'function') {
|
|
1575
|
+
return maybeIterator;
|
|
1576
|
+
}
|
|
945
1577
|
|
|
946
|
-
|
|
947
|
-
|
|
1578
|
+
return null;
|
|
1579
|
+
}
|
|
948
1580
|
|
|
949
|
-
|
|
950
|
-
var arg = arguments[i];
|
|
951
|
-
if (!arg) continue;
|
|
1581
|
+
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
952
1582
|
|
|
953
|
-
|
|
1583
|
+
function error(format) {
|
|
1584
|
+
{
|
|
1585
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
1586
|
+
args[_key2 - 1] = arguments[_key2];
|
|
1587
|
+
}
|
|
954
1588
|
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
if (arg.length) {
|
|
959
|
-
var inner = classNames.apply(null, arg);
|
|
960
|
-
if (inner) {
|
|
961
|
-
classes.push(inner);
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
} else if (argType === 'object') {
|
|
965
|
-
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
966
|
-
classes.push(arg.toString());
|
|
967
|
-
continue;
|
|
968
|
-
}
|
|
1589
|
+
printWarning('error', format, args);
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
969
1592
|
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
}
|
|
1593
|
+
function printWarning(level, format, args) {
|
|
1594
|
+
// When changing this logic, you might want to also
|
|
1595
|
+
// update consoleWithStackDev.www.js as well.
|
|
1596
|
+
{
|
|
1597
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1598
|
+
var stack = '';
|
|
977
1599
|
|
|
978
|
-
|
|
979
|
-
|
|
1600
|
+
if (currentlyValidatingElement) {
|
|
1601
|
+
var name = getComponentName(currentlyValidatingElement.type);
|
|
1602
|
+
var owner = currentlyValidatingElement._owner;
|
|
1603
|
+
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
|
|
1604
|
+
}
|
|
980
1605
|
|
|
981
|
-
|
|
982
|
-
classNames.default = classNames;
|
|
983
|
-
module.exports = classNames;
|
|
984
|
-
} else {
|
|
985
|
-
window.classNames = classNames;
|
|
986
|
-
}
|
|
987
|
-
}());
|
|
988
|
-
} (classnames));
|
|
1606
|
+
stack += ReactDebugCurrentFrame.getStackAddendum();
|
|
989
1607
|
|
|
990
|
-
|
|
1608
|
+
if (stack !== '') {
|
|
1609
|
+
format += '%s';
|
|
1610
|
+
args = args.concat([stack]);
|
|
1611
|
+
}
|
|
991
1612
|
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
* @param { function } func Function to be debounced
|
|
996
|
-
* @param { number } wait Time to wait before execut the function
|
|
997
|
-
* @param { boolean } immediate Param to define if the function will be executed immediately
|
|
998
|
-
*/
|
|
999
|
-
const debounce = (func, wait, immediate) => {
|
|
1000
|
-
let timeout = null;
|
|
1001
|
-
return function debounced(...args) {
|
|
1002
|
-
const later = () => {
|
|
1003
|
-
timeout = null;
|
|
1004
|
-
if (!immediate) {
|
|
1005
|
-
func.apply(this, args);
|
|
1006
|
-
}
|
|
1007
|
-
};
|
|
1008
|
-
if (timeout) {
|
|
1009
|
-
clearTimeout(timeout);
|
|
1010
|
-
}
|
|
1011
|
-
timeout = setTimeout(later, wait);
|
|
1012
|
-
};
|
|
1013
|
-
};
|
|
1613
|
+
var argsWithFormat = args.map(function (item) {
|
|
1614
|
+
return '' + item;
|
|
1615
|
+
}); // Careful: RN currently depends on this prefix
|
|
1014
1616
|
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1617
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
1618
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
1619
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
|
1018
1620
|
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
activeAnchor: { current: null },
|
|
1023
|
-
attach: () => {
|
|
1024
|
-
/* attach anchor element */
|
|
1025
|
-
},
|
|
1026
|
-
detach: () => {
|
|
1027
|
-
/* detach anchor element */
|
|
1028
|
-
},
|
|
1029
|
-
setActiveAnchor: () => {
|
|
1030
|
-
/* set active anchor */
|
|
1031
|
-
},
|
|
1032
|
-
};
|
|
1033
|
-
const DEFAULT_CONTEXT_DATA_WRAPPER = {
|
|
1034
|
-
getTooltipData: () => DEFAULT_CONTEXT_DATA,
|
|
1035
|
-
};
|
|
1036
|
-
const TooltipContext = require$$0.createContext(DEFAULT_CONTEXT_DATA_WRAPPER);
|
|
1037
|
-
const TooltipProvider = ({ children }) => {
|
|
1038
|
-
const [anchorRefMap, setAnchorRefMap] = require$$0.useState({
|
|
1039
|
-
[DEFAULT_TOOLTIP_ID]: new Set(),
|
|
1040
|
-
});
|
|
1041
|
-
const [activeAnchorMap, setActiveAnchorMap] = require$$0.useState({
|
|
1042
|
-
[DEFAULT_TOOLTIP_ID]: { current: null },
|
|
1043
|
-
});
|
|
1044
|
-
const attach = (tooltipId, ...refs) => {
|
|
1045
|
-
setAnchorRefMap((oldMap) => {
|
|
1046
|
-
var _a;
|
|
1047
|
-
const tooltipRefs = (_a = oldMap[tooltipId]) !== null && _a !== void 0 ? _a : new Set();
|
|
1048
|
-
refs.forEach((ref) => tooltipRefs.add(ref));
|
|
1049
|
-
// create new object to trigger re-render
|
|
1050
|
-
return { ...oldMap, [tooltipId]: new Set(tooltipRefs) };
|
|
1051
|
-
});
|
|
1052
|
-
};
|
|
1053
|
-
const detach = (tooltipId, ...refs) => {
|
|
1054
|
-
setAnchorRefMap((oldMap) => {
|
|
1055
|
-
const tooltipRefs = oldMap[tooltipId];
|
|
1056
|
-
if (!tooltipRefs) {
|
|
1057
|
-
// tooltip not found
|
|
1058
|
-
// maybe thow error?
|
|
1059
|
-
return oldMap;
|
|
1060
|
-
}
|
|
1061
|
-
refs.forEach((ref) => tooltipRefs.delete(ref));
|
|
1062
|
-
// create new object to trigger re-render
|
|
1063
|
-
return { ...oldMap };
|
|
1064
|
-
});
|
|
1065
|
-
};
|
|
1066
|
-
const setActiveAnchor = (tooltipId, ref) => {
|
|
1067
|
-
setActiveAnchorMap((oldMap) => {
|
|
1068
|
-
var _a;
|
|
1069
|
-
if (((_a = oldMap[tooltipId]) === null || _a === void 0 ? void 0 : _a.current) === ref.current) {
|
|
1070
|
-
return oldMap;
|
|
1071
|
-
}
|
|
1072
|
-
// create new object to trigger re-render
|
|
1073
|
-
return { ...oldMap, [tooltipId]: ref };
|
|
1074
|
-
});
|
|
1075
|
-
};
|
|
1076
|
-
const getTooltipData = require$$0.useCallback((tooltipId = DEFAULT_TOOLTIP_ID) => {
|
|
1077
|
-
var _a, _b;
|
|
1078
|
-
return ({
|
|
1079
|
-
anchorRefs: (_a = anchorRefMap[tooltipId]) !== null && _a !== void 0 ? _a : new Set(),
|
|
1080
|
-
activeAnchor: (_b = activeAnchorMap[tooltipId]) !== null && _b !== void 0 ? _b : { current: null },
|
|
1081
|
-
attach: (...refs) => attach(tooltipId, ...refs),
|
|
1082
|
-
detach: (...refs) => detach(tooltipId, ...refs),
|
|
1083
|
-
setActiveAnchor: (ref) => setActiveAnchor(tooltipId, ref),
|
|
1084
|
-
});
|
|
1085
|
-
}, [anchorRefMap, activeAnchorMap, attach, detach]);
|
|
1086
|
-
const context = require$$0.useMemo(() => {
|
|
1087
|
-
return {
|
|
1088
|
-
getTooltipData,
|
|
1089
|
-
};
|
|
1090
|
-
}, [getTooltipData]);
|
|
1091
|
-
return jsxRuntime.exports.jsx(TooltipContext.Provider, { value: context, children: children });
|
|
1092
|
-
};
|
|
1093
|
-
function useTooltip(tooltipId = DEFAULT_TOOLTIP_ID) {
|
|
1094
|
-
return require$$0.useContext(TooltipContext).getTooltipData(tooltipId);
|
|
1095
|
-
}
|
|
1621
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1096
1624
|
|
|
1097
|
-
|
|
1098
|
-
const { attach, detach } = useTooltip(tooltipId);
|
|
1099
|
-
const anchorRef = require$$0.useRef(null);
|
|
1100
|
-
require$$0.useEffect(() => {
|
|
1101
|
-
attach(anchorRef);
|
|
1102
|
-
return () => {
|
|
1103
|
-
detach(anchorRef);
|
|
1104
|
-
};
|
|
1105
|
-
}, []);
|
|
1106
|
-
return (jsxRuntime.exports.jsx("span", { ref: anchorRef, className: classNames('react-tooltip-wrapper', className), "data-tooltip-place": place, "data-tooltip-content": content, "data-tooltip-html": html, "data-tooltip-variant": variant, "data-tooltip-offset": offset, "data-tooltip-wrapper": wrapper, "data-tooltip-events": events, "data-tooltip-position-strategy": positionStrategy, "data-tooltip-delay-show": delayShow, "data-tooltip-delay-hide": delayHide, children: children }));
|
|
1107
|
-
};
|
|
1625
|
+
// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
|
|
1108
1626
|
|
|
1109
|
-
|
|
1110
|
-
return placement.split('-')[0];
|
|
1111
|
-
}
|
|
1627
|
+
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
1112
1628
|
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1629
|
+
function isValidElementType(type) {
|
|
1630
|
+
if (typeof type === 'string' || typeof type === 'function') {
|
|
1631
|
+
return true;
|
|
1632
|
+
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
1116
1633
|
|
|
1117
|
-
function getMainAxisFromPlacement(placement) {
|
|
1118
|
-
return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
|
|
1119
|
-
}
|
|
1120
1634
|
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1635
|
+
if (type === exports.Fragment || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
|
|
1636
|
+
return true;
|
|
1637
|
+
}
|
|
1124
1638
|
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
1131
|
-
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
1132
|
-
const mainAxis = getMainAxisFromPlacement(placement);
|
|
1133
|
-
const length = getLengthFromAxis(mainAxis);
|
|
1134
|
-
const commonAlign = reference[length] / 2 - floating[length] / 2;
|
|
1135
|
-
const side = getSide(placement);
|
|
1136
|
-
const isVertical = mainAxis === 'x';
|
|
1137
|
-
let coords;
|
|
1639
|
+
if (typeof type === 'object' && type !== null) {
|
|
1640
|
+
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
|
|
1641
|
+
return true;
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1138
1644
|
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
coords = {
|
|
1142
|
-
x: commonX,
|
|
1143
|
-
y: reference.y - floating.height
|
|
1144
|
-
};
|
|
1145
|
-
break;
|
|
1645
|
+
return false;
|
|
1646
|
+
}
|
|
1146
1647
|
|
|
1147
|
-
case 'bottom':
|
|
1148
|
-
coords = {
|
|
1149
|
-
x: commonX,
|
|
1150
|
-
y: reference.y + reference.height
|
|
1151
|
-
};
|
|
1152
|
-
break;
|
|
1153
1648
|
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
y: commonY
|
|
1158
|
-
};
|
|
1159
|
-
break;
|
|
1649
|
+
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
1650
|
+
function describeComponentFrame (name, source, ownerName) {
|
|
1651
|
+
var sourceInfo = '';
|
|
1160
1652
|
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
y: commonY
|
|
1165
|
-
};
|
|
1166
|
-
break;
|
|
1653
|
+
if (source) {
|
|
1654
|
+
var path = source.fileName;
|
|
1655
|
+
var fileName = path.replace(BEFORE_SLASH_RE, '');
|
|
1167
1656
|
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
}
|
|
1657
|
+
{
|
|
1658
|
+
// In DEV, include code for a common special case:
|
|
1659
|
+
// prefer "folder/index.js" instead of just "index.js".
|
|
1660
|
+
if (/^index\./.test(fileName)) {
|
|
1661
|
+
var match = path.match(BEFORE_SLASH_RE);
|
|
1174
1662
|
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
1178
|
-
break;
|
|
1663
|
+
if (match) {
|
|
1664
|
+
var pathBeforeSlash = match[1];
|
|
1179
1665
|
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1666
|
+
if (pathBeforeSlash) {
|
|
1667
|
+
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
|
1668
|
+
fileName = folderName + '/' + fileName;
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1184
1673
|
|
|
1185
|
-
|
|
1186
|
-
|
|
1674
|
+
sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
|
1675
|
+
} else if (ownerName) {
|
|
1676
|
+
sourceInfo = ' (created by ' + ownerName + ')';
|
|
1677
|
+
}
|
|
1187
1678
|
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
* next to a reference element when it is given a certain positioning strategy.
|
|
1191
|
-
*
|
|
1192
|
-
* This export does not have any `platform` interface logic. You will need to
|
|
1193
|
-
* write one for the platform you are using Floating UI with.
|
|
1194
|
-
*/
|
|
1679
|
+
return '\n in ' + (name || 'Unknown') + sourceInfo;
|
|
1680
|
+
}
|
|
1195
1681
|
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
middleware = [],
|
|
1201
|
-
platform
|
|
1202
|
-
} = config;
|
|
1203
|
-
const validMiddleware = middleware.filter(Boolean);
|
|
1204
|
-
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
1682
|
+
var Resolved = 1;
|
|
1683
|
+
function refineResolvedLazyComponent(lazyComponent) {
|
|
1684
|
+
return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
|
1685
|
+
}
|
|
1205
1686
|
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1687
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
1688
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
1689
|
+
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
|
|
1690
|
+
}
|
|
1210
1691
|
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
}).length > 1) {
|
|
1217
|
-
throw new Error(['Floating UI: duplicate `flip` and/or `autoPlacement` middleware', 'detected. This will lead to an infinite loop. Ensure only one of', 'either has been passed to the `middleware` array.'].join(' '));
|
|
1218
|
-
}
|
|
1692
|
+
function getComponentName(type) {
|
|
1693
|
+
if (type == null) {
|
|
1694
|
+
// Host root, text node or just invalid type.
|
|
1695
|
+
return null;
|
|
1696
|
+
}
|
|
1219
1697
|
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1698
|
+
{
|
|
1699
|
+
if (typeof type.tag === 'number') {
|
|
1700
|
+
error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1224
1703
|
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
strategy
|
|
1229
|
-
});
|
|
1230
|
-
let {
|
|
1231
|
-
x,
|
|
1232
|
-
y
|
|
1233
|
-
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
1234
|
-
let statefulPlacement = placement;
|
|
1235
|
-
let middlewareData = {};
|
|
1236
|
-
let resetCount = 0;
|
|
1704
|
+
if (typeof type === 'function') {
|
|
1705
|
+
return type.displayName || type.name || null;
|
|
1706
|
+
}
|
|
1237
1707
|
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
fn
|
|
1242
|
-
} = validMiddleware[i];
|
|
1243
|
-
const {
|
|
1244
|
-
x: nextX,
|
|
1245
|
-
y: nextY,
|
|
1246
|
-
data,
|
|
1247
|
-
reset
|
|
1248
|
-
} = await fn({
|
|
1249
|
-
x,
|
|
1250
|
-
y,
|
|
1251
|
-
initialPlacement: placement,
|
|
1252
|
-
placement: statefulPlacement,
|
|
1253
|
-
strategy,
|
|
1254
|
-
middlewareData,
|
|
1255
|
-
rects,
|
|
1256
|
-
platform,
|
|
1257
|
-
elements: {
|
|
1258
|
-
reference,
|
|
1259
|
-
floating
|
|
1260
|
-
}
|
|
1261
|
-
});
|
|
1262
|
-
x = nextX != null ? nextX : x;
|
|
1263
|
-
y = nextY != null ? nextY : y;
|
|
1264
|
-
middlewareData = { ...middlewareData,
|
|
1265
|
-
[name]: { ...middlewareData[name],
|
|
1266
|
-
...data
|
|
1267
|
-
}
|
|
1268
|
-
};
|
|
1708
|
+
if (typeof type === 'string') {
|
|
1709
|
+
return type;
|
|
1710
|
+
}
|
|
1269
1711
|
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1712
|
+
switch (type) {
|
|
1713
|
+
case exports.Fragment:
|
|
1714
|
+
return 'Fragment';
|
|
1275
1715
|
|
|
1276
|
-
|
|
1277
|
-
|
|
1716
|
+
case REACT_PORTAL_TYPE:
|
|
1717
|
+
return 'Portal';
|
|
1278
1718
|
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
statefulPlacement = reset.placement;
|
|
1282
|
-
}
|
|
1719
|
+
case REACT_PROFILER_TYPE:
|
|
1720
|
+
return "Profiler";
|
|
1283
1721
|
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
reference,
|
|
1287
|
-
floating,
|
|
1288
|
-
strategy
|
|
1289
|
-
}) : reset.rects;
|
|
1290
|
-
}
|
|
1722
|
+
case REACT_STRICT_MODE_TYPE:
|
|
1723
|
+
return 'StrictMode';
|
|
1291
1724
|
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
y
|
|
1295
|
-
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
1296
|
-
}
|
|
1725
|
+
case REACT_SUSPENSE_TYPE:
|
|
1726
|
+
return 'Suspense';
|
|
1297
1727
|
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
}
|
|
1728
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
1729
|
+
return 'SuspenseList';
|
|
1730
|
+
}
|
|
1302
1731
|
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
strategy,
|
|
1308
|
-
middlewareData
|
|
1309
|
-
};
|
|
1310
|
-
};
|
|
1732
|
+
if (typeof type === 'object') {
|
|
1733
|
+
switch (type.$$typeof) {
|
|
1734
|
+
case REACT_CONTEXT_TYPE:
|
|
1735
|
+
return 'Context.Consumer';
|
|
1311
1736
|
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
top: 0,
|
|
1315
|
-
right: 0,
|
|
1316
|
-
bottom: 0,
|
|
1317
|
-
left: 0,
|
|
1318
|
-
...padding
|
|
1319
|
-
};
|
|
1320
|
-
}
|
|
1737
|
+
case REACT_PROVIDER_TYPE:
|
|
1738
|
+
return 'Context.Provider';
|
|
1321
1739
|
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1740
|
+
case REACT_FORWARD_REF_TYPE:
|
|
1741
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
|
1742
|
+
|
|
1743
|
+
case REACT_MEMO_TYPE:
|
|
1744
|
+
return getComponentName(type.type);
|
|
1745
|
+
|
|
1746
|
+
case REACT_BLOCK_TYPE:
|
|
1747
|
+
return getComponentName(type.render);
|
|
1748
|
+
|
|
1749
|
+
case REACT_LAZY_TYPE:
|
|
1750
|
+
{
|
|
1751
|
+
var thenable = type;
|
|
1752
|
+
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
1330
1753
|
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
left: rect.x,
|
|
1335
|
-
right: rect.x + rect.width,
|
|
1336
|
-
bottom: rect.y + rect.height
|
|
1337
|
-
};
|
|
1338
|
-
}
|
|
1754
|
+
if (resolvedThenable) {
|
|
1755
|
+
return getComponentName(resolvedThenable);
|
|
1756
|
+
}
|
|
1339
1757
|
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
* - negative = how many pixels left before it will overflow
|
|
1345
|
-
* - 0 = lies flush with the boundary
|
|
1346
|
-
* @see https://floating-ui.com/docs/detectOverflow
|
|
1347
|
-
*/
|
|
1348
|
-
async function detectOverflow(middlewareArguments, options) {
|
|
1349
|
-
var _await$platform$isEle;
|
|
1758
|
+
break;
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1350
1762
|
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
}
|
|
1763
|
+
return null;
|
|
1764
|
+
}
|
|
1354
1765
|
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
platform,
|
|
1359
|
-
rects,
|
|
1360
|
-
elements,
|
|
1361
|
-
strategy
|
|
1362
|
-
} = middlewareArguments;
|
|
1363
|
-
const {
|
|
1364
|
-
boundary = 'clippingAncestors',
|
|
1365
|
-
rootBoundary = 'viewport',
|
|
1366
|
-
elementContext = 'floating',
|
|
1367
|
-
altBoundary = false,
|
|
1368
|
-
padding = 0
|
|
1369
|
-
} = options;
|
|
1370
|
-
const paddingObject = getSideObjectFromPadding(padding);
|
|
1371
|
-
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
|
|
1372
|
-
const element = elements[altBoundary ? altContext : elementContext];
|
|
1373
|
-
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
1374
|
-
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
|
|
1375
|
-
boundary,
|
|
1376
|
-
rootBoundary,
|
|
1377
|
-
strategy
|
|
1378
|
-
}));
|
|
1379
|
-
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
1380
|
-
rect: elementContext === 'floating' ? { ...rects.floating,
|
|
1381
|
-
x,
|
|
1382
|
-
y
|
|
1383
|
-
} : rects.reference,
|
|
1384
|
-
offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
|
|
1385
|
-
strategy
|
|
1386
|
-
}) : rects[elementContext]);
|
|
1387
|
-
return {
|
|
1388
|
-
top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
|
|
1389
|
-
bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
|
|
1390
|
-
left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
|
|
1391
|
-
right: elementClientRect.right - clippingClientRect.right + paddingObject.right
|
|
1392
|
-
};
|
|
1393
|
-
}
|
|
1766
|
+
var loggedTypeFailures = {};
|
|
1767
|
+
ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1768
|
+
var currentlyValidatingElement = null;
|
|
1394
1769
|
|
|
1395
|
-
|
|
1396
|
-
|
|
1770
|
+
function setCurrentlyValidatingElement(element) {
|
|
1771
|
+
{
|
|
1772
|
+
currentlyValidatingElement = element;
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1397
1775
|
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1776
|
+
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
1777
|
+
{
|
|
1778
|
+
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
1779
|
+
var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
1401
1780
|
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
const arrow = options => ({
|
|
1408
|
-
name: 'arrow',
|
|
1409
|
-
options,
|
|
1781
|
+
for (var typeSpecName in typeSpecs) {
|
|
1782
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
1783
|
+
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
|
1784
|
+
// fail the render phase where it didn't fail before. So we log it.
|
|
1785
|
+
// After these have been cleaned up, we'll let them throw.
|
|
1410
1786
|
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
y,
|
|
1420
|
-
placement,
|
|
1421
|
-
rects,
|
|
1422
|
-
platform
|
|
1423
|
-
} = middlewareArguments;
|
|
1787
|
+
try {
|
|
1788
|
+
// This is intentionally an invariant that gets caught. It's the same
|
|
1789
|
+
// behavior as without this statement except with a better message.
|
|
1790
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
1791
|
+
var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
|
|
1792
|
+
err.name = 'Invariant Violation';
|
|
1793
|
+
throw err;
|
|
1794
|
+
}
|
|
1424
1795
|
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1796
|
+
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
|
1797
|
+
} catch (ex) {
|
|
1798
|
+
error$1 = ex;
|
|
1799
|
+
}
|
|
1429
1800
|
|
|
1430
|
-
|
|
1431
|
-
|
|
1801
|
+
if (error$1 && !(error$1 instanceof Error)) {
|
|
1802
|
+
setCurrentlyValidatingElement(element);
|
|
1432
1803
|
|
|
1433
|
-
|
|
1434
|
-
const coords = {
|
|
1435
|
-
x,
|
|
1436
|
-
y
|
|
1437
|
-
};
|
|
1438
|
-
const axis = getMainAxisFromPlacement(placement);
|
|
1439
|
-
const alignment = getAlignment(placement);
|
|
1440
|
-
const length = getLengthFromAxis(axis);
|
|
1441
|
-
const arrowDimensions = await platform.getDimensions(element);
|
|
1442
|
-
const minProp = axis === 'y' ? 'top' : 'left';
|
|
1443
|
-
const maxProp = axis === 'y' ? 'bottom' : 'right';
|
|
1444
|
-
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
|
|
1445
|
-
const startDiff = coords[axis] - rects.reference[axis];
|
|
1446
|
-
const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
|
|
1447
|
-
let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
|
|
1804
|
+
error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
|
|
1448
1805
|
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
}
|
|
1806
|
+
setCurrentlyValidatingElement(null);
|
|
1807
|
+
}
|
|
1452
1808
|
|
|
1453
|
-
|
|
1454
|
-
|
|
1809
|
+
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
1810
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
1811
|
+
// same error.
|
|
1812
|
+
loggedTypeFailures[error$1.message] = true;
|
|
1813
|
+
setCurrentlyValidatingElement(element);
|
|
1455
1814
|
|
|
1456
|
-
|
|
1457
|
-
const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
|
|
1458
|
-
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
1459
|
-
const offset = within(min, center, max); // Make sure that arrow points at the reference
|
|
1815
|
+
error('Failed %s type: %s', location, error$1.message);
|
|
1460
1816
|
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
[axis]: offset,
|
|
1468
|
-
centerOffset: center - offset
|
|
1469
|
-
}
|
|
1470
|
-
};
|
|
1471
|
-
}
|
|
1817
|
+
setCurrentlyValidatingElement(null);
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1472
1823
|
|
|
1473
|
-
|
|
1824
|
+
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
1825
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1826
|
+
var RESERVED_PROPS = {
|
|
1827
|
+
key: true,
|
|
1828
|
+
ref: true,
|
|
1829
|
+
__self: true,
|
|
1830
|
+
__source: true
|
|
1831
|
+
};
|
|
1832
|
+
var specialPropKeyWarningShown;
|
|
1833
|
+
var specialPropRefWarningShown;
|
|
1834
|
+
var didWarnAboutStringRefs;
|
|
1474
1835
|
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
bottom: 'top',
|
|
1479
|
-
top: 'bottom'
|
|
1480
|
-
};
|
|
1481
|
-
function getOppositePlacement(placement) {
|
|
1482
|
-
return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
|
|
1483
|
-
}
|
|
1836
|
+
{
|
|
1837
|
+
didWarnAboutStringRefs = {};
|
|
1838
|
+
}
|
|
1484
1839
|
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1840
|
+
function hasValidRef(config) {
|
|
1841
|
+
{
|
|
1842
|
+
if (hasOwnProperty.call(config, 'ref')) {
|
|
1843
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
1489
1844
|
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1845
|
+
if (getter && getter.isReactWarning) {
|
|
1846
|
+
return false;
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1494
1850
|
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
}
|
|
1851
|
+
return config.ref !== undefined;
|
|
1852
|
+
}
|
|
1498
1853
|
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
}
|
|
1854
|
+
function hasValidKey(config) {
|
|
1855
|
+
{
|
|
1856
|
+
if (hasOwnProperty.call(config, 'key')) {
|
|
1857
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
1504
1858
|
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
return placement.replace(/start|end/g, matched => hash[matched]);
|
|
1511
|
-
}
|
|
1859
|
+
if (getter && getter.isReactWarning) {
|
|
1860
|
+
return false;
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1512
1864
|
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
1516
|
-
}
|
|
1865
|
+
return config.key !== undefined;
|
|
1866
|
+
}
|
|
1517
1867
|
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
*/
|
|
1523
|
-
const flip = function (options) {
|
|
1524
|
-
if (options === void 0) {
|
|
1525
|
-
options = {};
|
|
1526
|
-
}
|
|
1868
|
+
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
|
1869
|
+
{
|
|
1870
|
+
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
|
|
1871
|
+
var componentName = getComponentName(ReactCurrentOwner.current.type);
|
|
1527
1872
|
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
options,
|
|
1873
|
+
if (!didWarnAboutStringRefs[componentName]) {
|
|
1874
|
+
error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref);
|
|
1531
1875
|
|
|
1532
|
-
|
|
1533
|
-
|
|
1876
|
+
didWarnAboutStringRefs[componentName] = true;
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1534
1881
|
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
platform,
|
|
1541
|
-
elements
|
|
1542
|
-
} = middlewareArguments;
|
|
1543
|
-
const {
|
|
1544
|
-
mainAxis: checkMainAxis = true,
|
|
1545
|
-
crossAxis: checkCrossAxis = true,
|
|
1546
|
-
fallbackPlacements: specifiedFallbackPlacements,
|
|
1547
|
-
fallbackStrategy = 'bestFit',
|
|
1548
|
-
flipAlignment = true,
|
|
1549
|
-
...detectOverflowOptions
|
|
1550
|
-
} = options;
|
|
1551
|
-
const side = getSide(placement);
|
|
1552
|
-
const isBasePlacement = side === initialPlacement;
|
|
1553
|
-
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
1554
|
-
const placements = [initialPlacement, ...fallbackPlacements];
|
|
1555
|
-
const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
|
|
1556
|
-
const overflows = [];
|
|
1557
|
-
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
1882
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
1883
|
+
{
|
|
1884
|
+
var warnAboutAccessingKey = function () {
|
|
1885
|
+
if (!specialPropKeyWarningShown) {
|
|
1886
|
+
specialPropKeyWarningShown = true;
|
|
1558
1887
|
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1888
|
+
error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
|
|
1889
|
+
}
|
|
1890
|
+
};
|
|
1562
1891
|
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1892
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
1893
|
+
Object.defineProperty(props, 'key', {
|
|
1894
|
+
get: warnAboutAccessingKey,
|
|
1895
|
+
configurable: true
|
|
1896
|
+
});
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1570
1899
|
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1900
|
+
function defineRefPropWarningGetter(props, displayName) {
|
|
1901
|
+
{
|
|
1902
|
+
var warnAboutAccessingRef = function () {
|
|
1903
|
+
if (!specialPropRefWarningShown) {
|
|
1904
|
+
specialPropRefWarningShown = true;
|
|
1575
1905
|
|
|
1576
|
-
|
|
1577
|
-
|
|
1906
|
+
error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
|
|
1907
|
+
}
|
|
1908
|
+
};
|
|
1578
1909
|
|
|
1579
|
-
|
|
1580
|
-
|
|
1910
|
+
warnAboutAccessingRef.isReactWarning = true;
|
|
1911
|
+
Object.defineProperty(props, 'ref', {
|
|
1912
|
+
get: warnAboutAccessingRef,
|
|
1913
|
+
configurable: true
|
|
1914
|
+
});
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
/**
|
|
1918
|
+
* Factory method to create a new React element. This no longer adheres to
|
|
1919
|
+
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
1920
|
+
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
1921
|
+
* if something is a React Element.
|
|
1922
|
+
*
|
|
1923
|
+
* @param {*} type
|
|
1924
|
+
* @param {*} props
|
|
1925
|
+
* @param {*} key
|
|
1926
|
+
* @param {string|object} ref
|
|
1927
|
+
* @param {*} owner
|
|
1928
|
+
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
1929
|
+
* different from the `owner` when React.createElement is called, so that we
|
|
1930
|
+
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
1931
|
+
* functions, and as long as `this` and owner are the same, there will be no
|
|
1932
|
+
* change in behavior.
|
|
1933
|
+
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
1934
|
+
* indicating filename, line number, and/or other information.
|
|
1935
|
+
* @internal
|
|
1936
|
+
*/
|
|
1581
1937
|
|
|
1582
|
-
if (nextPlacement) {
|
|
1583
|
-
// Try next placement and re-run the lifecycle
|
|
1584
|
-
return {
|
|
1585
|
-
data: {
|
|
1586
|
-
index: nextIndex,
|
|
1587
|
-
overflows: overflowsData
|
|
1588
|
-
},
|
|
1589
|
-
reset: {
|
|
1590
|
-
placement: nextPlacement
|
|
1591
|
-
}
|
|
1592
|
-
};
|
|
1593
|
-
}
|
|
1594
1938
|
|
|
1595
|
-
|
|
1939
|
+
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
1940
|
+
var element = {
|
|
1941
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
1942
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
1943
|
+
// Built-in properties that belong on the element
|
|
1944
|
+
type: type,
|
|
1945
|
+
key: key,
|
|
1946
|
+
ref: ref,
|
|
1947
|
+
props: props,
|
|
1948
|
+
// Record the component responsible for creating this element.
|
|
1949
|
+
_owner: owner
|
|
1950
|
+
};
|
|
1596
1951
|
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1952
|
+
{
|
|
1953
|
+
// The validation flag is currently mutative. We put it on
|
|
1954
|
+
// an external backing store so that we can freeze the whole object.
|
|
1955
|
+
// This can be replaced with a WeakMap once they are implemented in
|
|
1956
|
+
// commonly used development environments.
|
|
1957
|
+
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
1958
|
+
// the validation flag non-enumerable (where possible, which should
|
|
1959
|
+
// include every environment we run tests in), so the test framework
|
|
1960
|
+
// ignores it.
|
|
1601
1961
|
|
|
1602
|
-
|
|
1962
|
+
Object.defineProperty(element._store, 'validated', {
|
|
1963
|
+
configurable: false,
|
|
1964
|
+
enumerable: false,
|
|
1965
|
+
writable: true,
|
|
1966
|
+
value: false
|
|
1967
|
+
}); // self and source are DEV only properties.
|
|
1603
1968
|
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1969
|
+
Object.defineProperty(element, '_self', {
|
|
1970
|
+
configurable: false,
|
|
1971
|
+
enumerable: false,
|
|
1972
|
+
writable: false,
|
|
1973
|
+
value: self
|
|
1974
|
+
}); // Two elements created in two different places should be considered
|
|
1975
|
+
// equal for testing purposes and therefore we hide it from enumeration.
|
|
1607
1976
|
|
|
1608
|
-
|
|
1609
|
-
|
|
1977
|
+
Object.defineProperty(element, '_source', {
|
|
1978
|
+
configurable: false,
|
|
1979
|
+
enumerable: false,
|
|
1980
|
+
writable: false,
|
|
1981
|
+
value: source
|
|
1982
|
+
});
|
|
1610
1983
|
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1984
|
+
if (Object.freeze) {
|
|
1985
|
+
Object.freeze(element.props);
|
|
1986
|
+
Object.freeze(element);
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1615
1989
|
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1990
|
+
return element;
|
|
1991
|
+
};
|
|
1992
|
+
/**
|
|
1993
|
+
* https://github.com/reactjs/rfcs/pull/107
|
|
1994
|
+
* @param {*} type
|
|
1995
|
+
* @param {object} props
|
|
1996
|
+
* @param {string} key
|
|
1997
|
+
*/
|
|
1624
1998
|
|
|
1625
|
-
|
|
1626
|
-
|
|
1999
|
+
function jsxDEV(type, config, maybeKey, source, self) {
|
|
2000
|
+
{
|
|
2001
|
+
var propName; // Reserved names are extracted
|
|
1627
2002
|
|
|
1628
|
-
|
|
1629
|
-
|
|
2003
|
+
var props = {};
|
|
2004
|
+
var key = null;
|
|
2005
|
+
var ref = null; // Currently, key can be spread in as a prop. This causes a potential
|
|
2006
|
+
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
|
|
2007
|
+
// or <div key="Hi" {...props} /> ). We want to deprecate key spread,
|
|
2008
|
+
// but as an intermediary step, we will use jsxDEV for everything except
|
|
2009
|
+
// <div {...props} key="Hi" />, because we aren't currently able to tell if
|
|
2010
|
+
// key is explicitly declared to be undefined or not.
|
|
1630
2011
|
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
platform,
|
|
1635
|
-
elements
|
|
1636
|
-
} = middlewareArguments;
|
|
1637
|
-
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
1638
|
-
const side = getSide(placement);
|
|
1639
|
-
const alignment = getAlignment(placement);
|
|
1640
|
-
const isVertical = getMainAxisFromPlacement(placement) === 'x';
|
|
1641
|
-
const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
|
|
1642
|
-
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
1643
|
-
const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
|
|
2012
|
+
if (maybeKey !== undefined) {
|
|
2013
|
+
key = '' + maybeKey;
|
|
2014
|
+
}
|
|
1644
2015
|
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
} : {
|
|
1654
|
-
mainAxis: 0,
|
|
1655
|
-
crossAxis: 0,
|
|
1656
|
-
alignmentAxis: null,
|
|
1657
|
-
...rawValue
|
|
1658
|
-
};
|
|
2016
|
+
if (hasValidKey(config)) {
|
|
2017
|
+
key = '' + config.key;
|
|
2018
|
+
}
|
|
2019
|
+
|
|
2020
|
+
if (hasValidRef(config)) {
|
|
2021
|
+
ref = config.ref;
|
|
2022
|
+
warnIfStringRefCannotBeAutoConverted(config, self);
|
|
2023
|
+
} // Remaining properties are added to a new props object
|
|
1659
2024
|
|
|
1660
|
-
if (alignment && typeof alignmentAxis === 'number') {
|
|
1661
|
-
crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
|
|
1662
|
-
}
|
|
1663
2025
|
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
y: crossAxis * crossAxisMulti
|
|
1670
|
-
};
|
|
1671
|
-
}
|
|
1672
|
-
/**
|
|
1673
|
-
* Displaces the floating element from its reference element.
|
|
1674
|
-
* @see https://floating-ui.com/docs/offset
|
|
1675
|
-
*/
|
|
2026
|
+
for (propName in config) {
|
|
2027
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
2028
|
+
props[propName] = config[propName];
|
|
2029
|
+
}
|
|
2030
|
+
} // Resolve default props
|
|
1676
2031
|
|
|
1677
|
-
const offset = function (value) {
|
|
1678
|
-
if (value === void 0) {
|
|
1679
|
-
value = 0;
|
|
1680
|
-
}
|
|
1681
2032
|
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
options: value,
|
|
2033
|
+
if (type && type.defaultProps) {
|
|
2034
|
+
var defaultProps = type.defaultProps;
|
|
1685
2035
|
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
return {
|
|
1693
|
-
x: x + diffCoords.x,
|
|
1694
|
-
y: y + diffCoords.y,
|
|
1695
|
-
data: diffCoords
|
|
1696
|
-
};
|
|
1697
|
-
}
|
|
2036
|
+
for (propName in defaultProps) {
|
|
2037
|
+
if (props[propName] === undefined) {
|
|
2038
|
+
props[propName] = defaultProps[propName];
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
1698
2042
|
|
|
1699
|
-
|
|
1700
|
-
|
|
2043
|
+
if (key || ref) {
|
|
2044
|
+
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
1701
2045
|
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
2046
|
+
if (key) {
|
|
2047
|
+
defineKeyPropWarningGetter(props, displayName);
|
|
2048
|
+
}
|
|
1705
2049
|
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
*/
|
|
1711
|
-
const shift = function (options) {
|
|
1712
|
-
if (options === void 0) {
|
|
1713
|
-
options = {};
|
|
1714
|
-
}
|
|
2050
|
+
if (ref) {
|
|
2051
|
+
defineRefPropWarningGetter(props, displayName);
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
1715
2054
|
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
2055
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
1719
2058
|
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
x,
|
|
1723
|
-
y,
|
|
1724
|
-
placement
|
|
1725
|
-
} = middlewareArguments;
|
|
1726
|
-
const {
|
|
1727
|
-
mainAxis: checkMainAxis = true,
|
|
1728
|
-
crossAxis: checkCrossAxis = false,
|
|
1729
|
-
limiter = {
|
|
1730
|
-
fn: _ref => {
|
|
1731
|
-
let {
|
|
1732
|
-
x,
|
|
1733
|
-
y
|
|
1734
|
-
} = _ref;
|
|
1735
|
-
return {
|
|
1736
|
-
x,
|
|
1737
|
-
y
|
|
1738
|
-
};
|
|
1739
|
-
}
|
|
1740
|
-
},
|
|
1741
|
-
...detectOverflowOptions
|
|
1742
|
-
} = options;
|
|
1743
|
-
const coords = {
|
|
1744
|
-
x,
|
|
1745
|
-
y
|
|
1746
|
-
};
|
|
1747
|
-
const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
|
|
1748
|
-
const mainAxis = getMainAxisFromPlacement(getSide(placement));
|
|
1749
|
-
const crossAxis = getCrossAxis(mainAxis);
|
|
1750
|
-
let mainAxisCoord = coords[mainAxis];
|
|
1751
|
-
let crossAxisCoord = coords[crossAxis];
|
|
2059
|
+
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
2060
|
+
ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1752
2061
|
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
const min = mainAxisCoord + overflow[minSide];
|
|
1757
|
-
const max = mainAxisCoord - overflow[maxSide];
|
|
1758
|
-
mainAxisCoord = within(min, mainAxisCoord, max);
|
|
1759
|
-
}
|
|
2062
|
+
function setCurrentlyValidatingElement$1(element) {
|
|
2063
|
+
currentlyValidatingElement = element;
|
|
2064
|
+
}
|
|
1760
2065
|
|
|
1761
|
-
|
|
1762
|
-
const minSide = crossAxis === 'y' ? 'top' : 'left';
|
|
1763
|
-
const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
|
|
1764
|
-
const min = crossAxisCoord + overflow[minSide];
|
|
1765
|
-
const max = crossAxisCoord - overflow[maxSide];
|
|
1766
|
-
crossAxisCoord = within(min, crossAxisCoord, max);
|
|
1767
|
-
}
|
|
2066
|
+
var propTypesMisspellWarningShown;
|
|
1768
2067
|
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
}
|
|
2068
|
+
{
|
|
2069
|
+
propTypesMisspellWarningShown = false;
|
|
2070
|
+
}
|
|
2071
|
+
/**
|
|
2072
|
+
* Verifies the object is a ReactElement.
|
|
2073
|
+
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
2074
|
+
* @param {?object} object
|
|
2075
|
+
* @return {boolean} True if `object` is a ReactElement.
|
|
2076
|
+
* @final
|
|
2077
|
+
*/
|
|
1780
2078
|
|
|
1781
|
-
|
|
1782
|
-
|
|
2079
|
+
function isValidElement(object) {
|
|
2080
|
+
{
|
|
2081
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
1783
2084
|
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
if (node == null) {
|
|
1789
|
-
return window;
|
|
1790
|
-
}
|
|
2085
|
+
function getDeclarationErrorAddendum() {
|
|
2086
|
+
{
|
|
2087
|
+
if (ReactCurrentOwner$1.current) {
|
|
2088
|
+
var name = getComponentName(ReactCurrentOwner$1.current.type);
|
|
1791
2089
|
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
2090
|
+
if (name) {
|
|
2091
|
+
return '\n\nCheck the render method of `' + name + '`.';
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
1796
2094
|
|
|
1797
|
-
|
|
1798
|
-
|
|
2095
|
+
return '';
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
1799
2098
|
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
2099
|
+
function getSourceInfoErrorAddendum(source) {
|
|
2100
|
+
{
|
|
2101
|
+
if (source !== undefined) {
|
|
2102
|
+
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
|
2103
|
+
var lineNumber = source.lineNumber;
|
|
2104
|
+
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
2105
|
+
}
|
|
1803
2106
|
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
2107
|
+
return '';
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
/**
|
|
2111
|
+
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
2112
|
+
* object keys are not valid. This allows us to keep track of children between
|
|
2113
|
+
* updates.
|
|
2114
|
+
*/
|
|
1807
2115
|
|
|
1808
|
-
function getUAString() {
|
|
1809
|
-
const uaData = navigator.userAgentData;
|
|
1810
2116
|
|
|
1811
|
-
|
|
1812
|
-
return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
|
|
1813
|
-
}
|
|
2117
|
+
var ownerHasKeyUseWarning = {};
|
|
1814
2118
|
|
|
1815
|
-
|
|
1816
|
-
|
|
2119
|
+
function getCurrentComponentErrorInfo(parentType) {
|
|
2120
|
+
{
|
|
2121
|
+
var info = getDeclarationErrorAddendum();
|
|
1817
2122
|
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
}
|
|
1821
|
-
function isElement(value) {
|
|
1822
|
-
return value instanceof getWindow(value).Element;
|
|
1823
|
-
}
|
|
1824
|
-
function isNode(value) {
|
|
1825
|
-
return value instanceof getWindow(value).Node;
|
|
1826
|
-
}
|
|
1827
|
-
function isShadowRoot(node) {
|
|
1828
|
-
// Browsers without `ShadowRoot` support
|
|
1829
|
-
if (typeof ShadowRoot === 'undefined') {
|
|
1830
|
-
return false;
|
|
1831
|
-
}
|
|
2123
|
+
if (!info) {
|
|
2124
|
+
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
1832
2125
|
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
// Firefox wants us to check `-x` and `-y` variations as well
|
|
1838
|
-
const {
|
|
1839
|
-
overflow,
|
|
1840
|
-
overflowX,
|
|
1841
|
-
overflowY,
|
|
1842
|
-
display
|
|
1843
|
-
} = getComputedStyle(element);
|
|
1844
|
-
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
|
|
1845
|
-
}
|
|
1846
|
-
function isTableElement(element) {
|
|
1847
|
-
return ['table', 'td', 'th'].includes(getNodeName(element));
|
|
1848
|
-
}
|
|
1849
|
-
function isContainingBlock(element) {
|
|
1850
|
-
// TODO: Try and use feature detection here instead
|
|
1851
|
-
const isFirefox = /firefox/i.test(getUAString());
|
|
1852
|
-
const css = getComputedStyle(element);
|
|
1853
|
-
const backdropFilter = css.backdropFilter || css.WebkitBackdropFilter; // This is non-exhaustive but covers the most common CSS properties that
|
|
1854
|
-
// create a containing block.
|
|
1855
|
-
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
2126
|
+
if (parentName) {
|
|
2127
|
+
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
1856
2130
|
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
function isLastTraversableNode(node) {
|
|
1872
|
-
return ['html', 'body', '#document'].includes(getNodeName(node));
|
|
1873
|
-
}
|
|
2131
|
+
return info;
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
/**
|
|
2135
|
+
* Warn if the element doesn't have an explicit key assigned to it.
|
|
2136
|
+
* This element is in an array. The array could grow and shrink or be
|
|
2137
|
+
* reordered. All children that haven't already been validated are required to
|
|
2138
|
+
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
2139
|
+
* will only be shown once.
|
|
2140
|
+
*
|
|
2141
|
+
* @internal
|
|
2142
|
+
* @param {ReactElement} element Element that requires a key.
|
|
2143
|
+
* @param {*} parentType element's parent's type.
|
|
2144
|
+
*/
|
|
1874
2145
|
|
|
1875
|
-
const min = Math.min;
|
|
1876
|
-
const max = Math.max;
|
|
1877
|
-
const round = Math.round;
|
|
1878
2146
|
|
|
1879
|
-
|
|
1880
|
-
|
|
2147
|
+
function validateExplicitKey(element, parentType) {
|
|
2148
|
+
{
|
|
2149
|
+
if (!element._store || element._store.validated || element.key != null) {
|
|
2150
|
+
return;
|
|
2151
|
+
}
|
|
1881
2152
|
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
}
|
|
2153
|
+
element._store.validated = true;
|
|
2154
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
1885
2155
|
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
2156
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
2157
|
+
return;
|
|
2158
|
+
}
|
|
1889
2159
|
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
2160
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
|
2161
|
+
// property, it may be the creator of the child that's responsible for
|
|
2162
|
+
// assigning it a key.
|
|
1893
2163
|
|
|
1894
|
-
|
|
1895
|
-
scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
|
|
1896
|
-
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
|
|
1897
|
-
}
|
|
2164
|
+
var childOwner = '';
|
|
1898
2165
|
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
const width = clientRect.width / scaleX;
|
|
1904
|
-
const height = clientRect.height / scaleY;
|
|
1905
|
-
return {
|
|
1906
|
-
width,
|
|
1907
|
-
height,
|
|
1908
|
-
top: y,
|
|
1909
|
-
right: x + width,
|
|
1910
|
-
bottom: y + height,
|
|
1911
|
-
left: x,
|
|
1912
|
-
x,
|
|
1913
|
-
y
|
|
1914
|
-
};
|
|
1915
|
-
}
|
|
2166
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
|
2167
|
+
// Give the component that originally created this child.
|
|
2168
|
+
childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
|
|
2169
|
+
}
|
|
1916
2170
|
|
|
1917
|
-
|
|
1918
|
-
return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
|
|
1919
|
-
}
|
|
2171
|
+
setCurrentlyValidatingElement$1(element);
|
|
1920
2172
|
|
|
1921
|
-
|
|
1922
|
-
if (isElement(element)) {
|
|
1923
|
-
return {
|
|
1924
|
-
scrollLeft: element.scrollLeft,
|
|
1925
|
-
scrollTop: element.scrollTop
|
|
1926
|
-
};
|
|
1927
|
-
}
|
|
2173
|
+
error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
1928
2174
|
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
2175
|
+
setCurrentlyValidatingElement$1(null);
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
2178
|
+
/**
|
|
2179
|
+
* Ensure that every element either is passed in a static location, in an
|
|
2180
|
+
* array with an explicit keys property defined, or in an object literal
|
|
2181
|
+
* with valid key property.
|
|
2182
|
+
*
|
|
2183
|
+
* @internal
|
|
2184
|
+
* @param {ReactNode} node Statically passed child of any type.
|
|
2185
|
+
* @param {*} parentType node's parent's type.
|
|
2186
|
+
*/
|
|
1934
2187
|
|
|
1935
|
-
function getWindowScrollBarX(element) {
|
|
1936
|
-
// If <html> has a CSS width greater than the viewport, then this will be
|
|
1937
|
-
// incorrect for RTL.
|
|
1938
|
-
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
|
1939
|
-
}
|
|
1940
2188
|
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
2189
|
+
function validateChildKeys(node, parentType) {
|
|
2190
|
+
{
|
|
2191
|
+
if (typeof node !== 'object') {
|
|
2192
|
+
return;
|
|
2193
|
+
}
|
|
1945
2194
|
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
|
|
1950
|
-
isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
|
|
1951
|
-
let scroll = {
|
|
1952
|
-
scrollLeft: 0,
|
|
1953
|
-
scrollTop: 0
|
|
1954
|
-
};
|
|
1955
|
-
const offsets = {
|
|
1956
|
-
x: 0,
|
|
1957
|
-
y: 0
|
|
1958
|
-
};
|
|
2195
|
+
if (Array.isArray(node)) {
|
|
2196
|
+
for (var i = 0; i < node.length; i++) {
|
|
2197
|
+
var child = node[i];
|
|
1959
2198
|
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
2199
|
+
if (isValidElement(child)) {
|
|
2200
|
+
validateExplicitKey(child, parentType);
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
} else if (isValidElement(node)) {
|
|
2204
|
+
// This element was passed in a valid location.
|
|
2205
|
+
if (node._store) {
|
|
2206
|
+
node._store.validated = true;
|
|
2207
|
+
}
|
|
2208
|
+
} else if (node) {
|
|
2209
|
+
var iteratorFn = getIteratorFn(node);
|
|
1964
2210
|
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
}
|
|
1972
|
-
}
|
|
2211
|
+
if (typeof iteratorFn === 'function') {
|
|
2212
|
+
// Entry iterators used to provide implicit keys,
|
|
2213
|
+
// but now we print a separate warning for them later.
|
|
2214
|
+
if (iteratorFn !== node.entries) {
|
|
2215
|
+
var iterator = iteratorFn.call(node);
|
|
2216
|
+
var step;
|
|
1973
2217
|
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
2218
|
+
while (!(step = iterator.next()).done) {
|
|
2219
|
+
if (isValidElement(step.value)) {
|
|
2220
|
+
validateExplicitKey(step.value, parentType);
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
}
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
/**
|
|
2229
|
+
* Given an element, validate that its props follow the propTypes definition,
|
|
2230
|
+
* provided by the type.
|
|
2231
|
+
*
|
|
2232
|
+
* @param {ReactElement} element
|
|
2233
|
+
*/
|
|
1981
2234
|
|
|
1982
|
-
function getParentNode(node) {
|
|
1983
|
-
if (getNodeName(node) === 'html') {
|
|
1984
|
-
return node;
|
|
1985
|
-
}
|
|
1986
2235
|
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
isShadowRoot(node) ? node.host : null) || // Fallback
|
|
1991
|
-
getDocumentElement(node);
|
|
1992
|
-
return isShadowRoot(result) ? result.host : result;
|
|
1993
|
-
}
|
|
2236
|
+
function validatePropTypes(element) {
|
|
2237
|
+
{
|
|
2238
|
+
var type = element.type;
|
|
1994
2239
|
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
}
|
|
2240
|
+
if (type === null || type === undefined || typeof type === 'string') {
|
|
2241
|
+
return;
|
|
2242
|
+
}
|
|
1999
2243
|
|
|
2000
|
-
|
|
2001
|
-
}
|
|
2244
|
+
var propTypes;
|
|
2002
2245
|
|
|
2003
|
-
|
|
2004
|
-
|
|
2246
|
+
if (typeof type === 'function') {
|
|
2247
|
+
propTypes = type.propTypes;
|
|
2248
|
+
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
2249
|
+
// Inner props are checked in the reconciler.
|
|
2250
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
2251
|
+
propTypes = type.propTypes;
|
|
2252
|
+
} else {
|
|
2253
|
+
return;
|
|
2254
|
+
}
|
|
2005
2255
|
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
}
|
|
2256
|
+
if (propTypes) {
|
|
2257
|
+
// Intentionally inside to avoid triggering lazy initializers:
|
|
2258
|
+
var name = getComponentName(type);
|
|
2259
|
+
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
2260
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
2261
|
+
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
2013
2262
|
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2263
|
+
var _name = getComponentName(type);
|
|
2264
|
+
|
|
2265
|
+
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
2266
|
+
}
|
|
2267
|
+
|
|
2268
|
+
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
2269
|
+
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
/**
|
|
2274
|
+
* Given a fragment, validate that it can only be provided with fragment props
|
|
2275
|
+
* @param {ReactElement} fragment
|
|
2276
|
+
*/
|
|
2017
2277
|
|
|
2018
2278
|
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2279
|
+
function validateFragmentProps(fragment) {
|
|
2280
|
+
{
|
|
2281
|
+
var keys = Object.keys(fragment.props);
|
|
2022
2282
|
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
}
|
|
2283
|
+
for (var i = 0; i < keys.length; i++) {
|
|
2284
|
+
var key = keys[i];
|
|
2026
2285
|
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
}
|
|
2286
|
+
if (key !== 'children' && key !== 'key') {
|
|
2287
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
2030
2288
|
|
|
2031
|
-
|
|
2032
|
-
}
|
|
2289
|
+
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
2033
2290
|
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
height: element.offsetHeight
|
|
2039
|
-
};
|
|
2040
|
-
}
|
|
2291
|
+
setCurrentlyValidatingElement$1(null);
|
|
2292
|
+
break;
|
|
2293
|
+
}
|
|
2294
|
+
}
|
|
2041
2295
|
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
width: rect.width,
|
|
2045
|
-
height: rect.height
|
|
2046
|
-
};
|
|
2047
|
-
}
|
|
2296
|
+
if (fragment.ref !== null) {
|
|
2297
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
2048
2298
|
|
|
2049
|
-
|
|
2050
|
-
let {
|
|
2051
|
-
rect,
|
|
2052
|
-
offsetParent,
|
|
2053
|
-
strategy
|
|
2054
|
-
} = _ref;
|
|
2055
|
-
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
2056
|
-
const documentElement = getDocumentElement(offsetParent);
|
|
2299
|
+
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
2057
2300
|
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2301
|
+
setCurrentlyValidatingElement$1(null);
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
}
|
|
2061
2305
|
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
const offsets = {
|
|
2067
|
-
x: 0,
|
|
2068
|
-
y: 0
|
|
2069
|
-
};
|
|
2306
|
+
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
2307
|
+
{
|
|
2308
|
+
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
2309
|
+
// succeed and there will likely be errors in render.
|
|
2070
2310
|
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
scroll = getNodeScroll(offsetParent);
|
|
2074
|
-
}
|
|
2311
|
+
if (!validType) {
|
|
2312
|
+
var info = '';
|
|
2075
2313
|
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
2080
|
-
} // This doesn't appear to be need to be negated.
|
|
2081
|
-
// else if (documentElement) {
|
|
2082
|
-
// offsets.x = getWindowScrollBarX(documentElement);
|
|
2083
|
-
// }
|
|
2314
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
2315
|
+
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
|
|
2316
|
+
}
|
|
2084
2317
|
|
|
2085
|
-
|
|
2318
|
+
var sourceInfo = getSourceInfoErrorAddendum(source);
|
|
2086
2319
|
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2320
|
+
if (sourceInfo) {
|
|
2321
|
+
info += sourceInfo;
|
|
2322
|
+
} else {
|
|
2323
|
+
info += getDeclarationErrorAddendum();
|
|
2324
|
+
}
|
|
2092
2325
|
|
|
2093
|
-
|
|
2094
|
-
const win = getWindow(element);
|
|
2095
|
-
const html = getDocumentElement(element);
|
|
2096
|
-
const visualViewport = win.visualViewport;
|
|
2097
|
-
let width = html.clientWidth;
|
|
2098
|
-
let height = html.clientHeight;
|
|
2099
|
-
let x = 0;
|
|
2100
|
-
let y = 0;
|
|
2326
|
+
var typeString;
|
|
2101
2327
|
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2328
|
+
if (type === null) {
|
|
2329
|
+
typeString = 'null';
|
|
2330
|
+
} else if (Array.isArray(type)) {
|
|
2331
|
+
typeString = 'array';
|
|
2332
|
+
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
2333
|
+
typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
|
|
2334
|
+
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
2335
|
+
} else {
|
|
2336
|
+
typeString = typeof type;
|
|
2337
|
+
}
|
|
2106
2338
|
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
y = visualViewport.offsetTop;
|
|
2110
|
-
}
|
|
2111
|
-
}
|
|
2339
|
+
error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
2340
|
+
}
|
|
2112
2341
|
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
height,
|
|
2116
|
-
x,
|
|
2117
|
-
y
|
|
2118
|
-
};
|
|
2119
|
-
}
|
|
2342
|
+
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
|
|
2343
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
2120
2344
|
|
|
2121
|
-
|
|
2345
|
+
if (element == null) {
|
|
2346
|
+
return element;
|
|
2347
|
+
} // Skip key warning if the type isn't valid since our key validation logic
|
|
2348
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
2349
|
+
// We don't want exception behavior to differ between dev and prod.
|
|
2350
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
|
2351
|
+
// fixed, the key warnings will appear.)
|
|
2122
2352
|
|
|
2123
|
-
function getDocumentRect(element) {
|
|
2124
|
-
var _element$ownerDocumen;
|
|
2125
2353
|
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
|
2129
|
-
const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
|
2130
|
-
const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
|
2131
|
-
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
2132
|
-
const y = -scroll.scrollTop;
|
|
2354
|
+
if (validType) {
|
|
2355
|
+
var children = props.children;
|
|
2133
2356
|
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2357
|
+
if (children !== undefined) {
|
|
2358
|
+
if (isStaticChildren) {
|
|
2359
|
+
if (Array.isArray(children)) {
|
|
2360
|
+
for (var i = 0; i < children.length; i++) {
|
|
2361
|
+
validateChildKeys(children[i], type);
|
|
2362
|
+
}
|
|
2137
2363
|
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2364
|
+
if (Object.freeze) {
|
|
2365
|
+
Object.freeze(children);
|
|
2366
|
+
}
|
|
2367
|
+
} else {
|
|
2368
|
+
error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
|
|
2369
|
+
}
|
|
2370
|
+
} else {
|
|
2371
|
+
validateChildKeys(children, type);
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2145
2375
|
|
|
2146
|
-
|
|
2147
|
-
|
|
2376
|
+
if (type === exports.Fragment) {
|
|
2377
|
+
validateFragmentProps(element);
|
|
2378
|
+
} else {
|
|
2379
|
+
validatePropTypes(element);
|
|
2380
|
+
}
|
|
2148
2381
|
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2382
|
+
return element;
|
|
2383
|
+
}
|
|
2384
|
+
} // These two functions exist to still get child warnings in dev
|
|
2385
|
+
// even with the prod transform. This means that jsxDEV is purely
|
|
2386
|
+
// opt-in behavior for better messages but that we won't stop
|
|
2387
|
+
// giving you warnings if you use production apis.
|
|
2153
2388
|
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2389
|
+
function jsxWithValidationStatic(type, props, key) {
|
|
2390
|
+
{
|
|
2391
|
+
return jsxWithValidation(type, props, key, true);
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
function jsxWithValidationDynamic(type, props, key) {
|
|
2395
|
+
{
|
|
2396
|
+
return jsxWithValidation(type, props, key, false);
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2157
2399
|
|
|
2158
|
-
|
|
2159
|
-
|
|
2400
|
+
var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
|
|
2401
|
+
// for now we can ship identical prod functions
|
|
2160
2402
|
|
|
2161
|
-
|
|
2162
|
-
var _node$ownerDocument;
|
|
2403
|
+
var jsxs = jsxWithValidationStatic ;
|
|
2163
2404
|
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2405
|
+
exports.jsx = jsx;
|
|
2406
|
+
exports.jsxs = jsxs;
|
|
2407
|
+
})();
|
|
2408
|
+
}
|
|
2409
|
+
} (reactJsxRuntime_development));
|
|
2167
2410
|
|
|
2168
|
-
|
|
2169
|
-
const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
|
|
2170
|
-
const win = getWindow(scrollableAncestor);
|
|
2171
|
-
const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
|
|
2172
|
-
const updatedList = list.concat(target);
|
|
2173
|
-
return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
|
|
2174
|
-
updatedList.concat(getOverflowAncestors(target));
|
|
2175
|
-
}
|
|
2411
|
+
(function (module) {
|
|
2176
2412
|
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
return {
|
|
2182
|
-
top,
|
|
2183
|
-
left,
|
|
2184
|
-
x: left,
|
|
2185
|
-
y: top,
|
|
2186
|
-
right: left + element.clientWidth,
|
|
2187
|
-
bottom: top + element.clientHeight,
|
|
2188
|
-
width: element.clientWidth,
|
|
2189
|
-
height: element.clientHeight
|
|
2190
|
-
};
|
|
2191
|
-
}
|
|
2413
|
+
{
|
|
2414
|
+
module.exports = reactJsxRuntime_development;
|
|
2415
|
+
}
|
|
2416
|
+
} (jsxRuntime));
|
|
2192
2417
|
|
|
2193
|
-
|
|
2194
|
-
if (clippingAncestor === 'viewport') {
|
|
2195
|
-
return rectToClientRect(getViewportRect(element, strategy));
|
|
2196
|
-
}
|
|
2418
|
+
var classnames = {exports: {}};
|
|
2197
2419
|
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2420
|
+
/*!
|
|
2421
|
+
Copyright (c) 2018 Jed Watson.
|
|
2422
|
+
Licensed under the MIT License (MIT), see
|
|
2423
|
+
http://jedwatson.github.io/classnames
|
|
2424
|
+
*/
|
|
2201
2425
|
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
// clipping (or hiding) overflowing elements with a position different from
|
|
2205
|
-
// `initial`
|
|
2426
|
+
(function (module) {
|
|
2427
|
+
/* global define */
|
|
2206
2428
|
|
|
2429
|
+
(function () {
|
|
2207
2430
|
|
|
2208
|
-
|
|
2209
|
-
let result = getOverflowAncestors(element).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
2210
|
-
let currentNode = element;
|
|
2211
|
-
let currentContainingBlockComputedStyle = null; // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
2431
|
+
var hasOwn = {}.hasOwnProperty;
|
|
2212
2432
|
|
|
2213
|
-
|
|
2214
|
-
|
|
2433
|
+
function classNames() {
|
|
2434
|
+
var classes = [];
|
|
2215
2435
|
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
} else {
|
|
2220
|
-
// Record last containing block for next iteration
|
|
2221
|
-
currentContainingBlockComputedStyle = computedStyle;
|
|
2222
|
-
}
|
|
2436
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
2437
|
+
var arg = arguments[i];
|
|
2438
|
+
if (!arg) continue;
|
|
2223
2439
|
|
|
2224
|
-
|
|
2225
|
-
}
|
|
2440
|
+
var argType = typeof arg;
|
|
2226
2441
|
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2442
|
+
if (argType === 'string' || argType === 'number') {
|
|
2443
|
+
classes.push(arg);
|
|
2444
|
+
} else if (Array.isArray(arg)) {
|
|
2445
|
+
if (arg.length) {
|
|
2446
|
+
var inner = classNames.apply(null, arg);
|
|
2447
|
+
if (inner) {
|
|
2448
|
+
classes.push(inner);
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
} else if (argType === 'object') {
|
|
2452
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
2453
|
+
classes.push(arg.toString());
|
|
2454
|
+
continue;
|
|
2455
|
+
}
|
|
2456
|
+
|
|
2457
|
+
for (var key in arg) {
|
|
2458
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
2459
|
+
classes.push(key);
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2230
2464
|
|
|
2465
|
+
return classes.join(' ');
|
|
2466
|
+
}
|
|
2231
2467
|
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
2241
|
-
const firstClippingAncestor = clippingAncestors[0];
|
|
2242
|
-
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
2243
|
-
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
2244
|
-
accRect.top = max(rect.top, accRect.top);
|
|
2245
|
-
accRect.right = min(rect.right, accRect.right);
|
|
2246
|
-
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
2247
|
-
accRect.left = max(rect.left, accRect.left);
|
|
2248
|
-
return accRect;
|
|
2249
|
-
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
2250
|
-
return {
|
|
2251
|
-
width: clippingRect.right - clippingRect.left,
|
|
2252
|
-
height: clippingRect.bottom - clippingRect.top,
|
|
2253
|
-
x: clippingRect.left,
|
|
2254
|
-
y: clippingRect.top
|
|
2255
|
-
};
|
|
2256
|
-
}
|
|
2468
|
+
if (module.exports) {
|
|
2469
|
+
classNames.default = classNames;
|
|
2470
|
+
module.exports = classNames;
|
|
2471
|
+
} else {
|
|
2472
|
+
window.classNames = classNames;
|
|
2473
|
+
}
|
|
2474
|
+
}());
|
|
2475
|
+
} (classnames));
|
|
2257
2476
|
|
|
2258
|
-
|
|
2259
|
-
getClippingRect,
|
|
2260
|
-
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
2261
|
-
isElement,
|
|
2262
|
-
getDimensions,
|
|
2263
|
-
getOffsetParent,
|
|
2264
|
-
getDocumentElement,
|
|
2265
|
-
getElementRects: _ref => {
|
|
2266
|
-
let {
|
|
2267
|
-
reference,
|
|
2268
|
-
floating,
|
|
2269
|
-
strategy
|
|
2270
|
-
} = _ref;
|
|
2271
|
-
return {
|
|
2272
|
-
reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
|
|
2273
|
-
floating: { ...getDimensions(floating),
|
|
2274
|
-
x: 0,
|
|
2275
|
-
y: 0
|
|
2276
|
-
}
|
|
2277
|
-
};
|
|
2278
|
-
},
|
|
2279
|
-
getClientRects: element => Array.from(element.getClientRects()),
|
|
2280
|
-
isRTL: element => getComputedStyle(element).direction === 'rtl'
|
|
2281
|
-
};
|
|
2477
|
+
var classNames = classnames.exports;
|
|
2282
2478
|
|
|
2479
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2283
2480
|
/**
|
|
2284
|
-
*
|
|
2285
|
-
*
|
|
2286
|
-
*
|
|
2481
|
+
* This function debounce the received function
|
|
2482
|
+
* @param { function } func Function to be debounced
|
|
2483
|
+
* @param { number } wait Time to wait before execut the function
|
|
2484
|
+
* @param { boolean } immediate Param to define if the function will be executed immediately
|
|
2287
2485
|
*/
|
|
2486
|
+
const debounce = (func, wait, immediate) => {
|
|
2487
|
+
let timeout = null;
|
|
2488
|
+
return function debounced(...args) {
|
|
2489
|
+
const later = () => {
|
|
2490
|
+
timeout = null;
|
|
2491
|
+
if (!immediate) {
|
|
2492
|
+
func.apply(this, args);
|
|
2493
|
+
}
|
|
2494
|
+
};
|
|
2495
|
+
if (timeout) {
|
|
2496
|
+
clearTimeout(timeout);
|
|
2497
|
+
}
|
|
2498
|
+
timeout = setTimeout(later, wait);
|
|
2499
|
+
};
|
|
2500
|
+
};
|
|
2288
2501
|
|
|
2289
|
-
const
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2502
|
+
const TooltipContent = ({ content }) => {
|
|
2503
|
+
return jsxRuntime.exports.jsx("span", { dangerouslySetInnerHTML: { __html: content } });
|
|
2504
|
+
};
|
|
2505
|
+
|
|
2506
|
+
const DEFAULT_TOOLTIP_ID = 'DEFAULT_TOOLTIP_ID';
|
|
2507
|
+
const DEFAULT_CONTEXT_DATA = {
|
|
2508
|
+
anchorRefs: new Set(),
|
|
2509
|
+
activeAnchor: { current: null },
|
|
2510
|
+
attach: () => {
|
|
2511
|
+
/* attach anchor element */
|
|
2512
|
+
},
|
|
2513
|
+
detach: () => {
|
|
2514
|
+
/* detach anchor element */
|
|
2515
|
+
},
|
|
2516
|
+
setActiveAnchor: () => {
|
|
2517
|
+
/* set active anchor */
|
|
2518
|
+
},
|
|
2519
|
+
};
|
|
2520
|
+
const DEFAULT_CONTEXT_DATA_WRAPPER = {
|
|
2521
|
+
getTooltipData: () => DEFAULT_CONTEXT_DATA,
|
|
2522
|
+
};
|
|
2523
|
+
const TooltipContext = require$$0.createContext(DEFAULT_CONTEXT_DATA_WRAPPER);
|
|
2524
|
+
const TooltipProvider = ({ children }) => {
|
|
2525
|
+
const [anchorRefMap, setAnchorRefMap] = require$$0.useState({
|
|
2526
|
+
[DEFAULT_TOOLTIP_ID]: new Set(),
|
|
2527
|
+
});
|
|
2528
|
+
const [activeAnchorMap, setActiveAnchorMap] = require$$0.useState({
|
|
2529
|
+
[DEFAULT_TOOLTIP_ID]: { current: null },
|
|
2530
|
+
});
|
|
2531
|
+
const attach = (tooltipId, ...refs) => {
|
|
2532
|
+
setAnchorRefMap((oldMap) => {
|
|
2533
|
+
var _a;
|
|
2534
|
+
const tooltipRefs = (_a = oldMap[tooltipId]) !== null && _a !== void 0 ? _a : new Set();
|
|
2535
|
+
refs.forEach((ref) => tooltipRefs.add(ref));
|
|
2536
|
+
// create new object to trigger re-render
|
|
2537
|
+
return { ...oldMap, [tooltipId]: new Set(tooltipRefs) };
|
|
2538
|
+
});
|
|
2539
|
+
};
|
|
2540
|
+
const detach = (tooltipId, ...refs) => {
|
|
2541
|
+
setAnchorRefMap((oldMap) => {
|
|
2542
|
+
const tooltipRefs = oldMap[tooltipId];
|
|
2543
|
+
if (!tooltipRefs) {
|
|
2544
|
+
// tooltip not found
|
|
2545
|
+
// maybe thow error?
|
|
2546
|
+
return oldMap;
|
|
2547
|
+
}
|
|
2548
|
+
refs.forEach((ref) => tooltipRefs.delete(ref));
|
|
2549
|
+
// create new object to trigger re-render
|
|
2550
|
+
return { ...oldMap };
|
|
2551
|
+
});
|
|
2552
|
+
};
|
|
2553
|
+
const setActiveAnchor = (tooltipId, ref) => {
|
|
2554
|
+
setActiveAnchorMap((oldMap) => {
|
|
2555
|
+
var _a;
|
|
2556
|
+
if (((_a = oldMap[tooltipId]) === null || _a === void 0 ? void 0 : _a.current) === ref.current) {
|
|
2557
|
+
return oldMap;
|
|
2558
|
+
}
|
|
2559
|
+
// create new object to trigger re-render
|
|
2560
|
+
return { ...oldMap, [tooltipId]: ref };
|
|
2561
|
+
});
|
|
2562
|
+
};
|
|
2563
|
+
const getTooltipData = require$$0.useCallback((tooltipId = DEFAULT_TOOLTIP_ID) => {
|
|
2564
|
+
var _a, _b;
|
|
2565
|
+
return ({
|
|
2566
|
+
anchorRefs: (_a = anchorRefMap[tooltipId]) !== null && _a !== void 0 ? _a : new Set(),
|
|
2567
|
+
activeAnchor: (_b = activeAnchorMap[tooltipId]) !== null && _b !== void 0 ? _b : { current: null },
|
|
2568
|
+
attach: (...refs) => attach(tooltipId, ...refs),
|
|
2569
|
+
detach: (...refs) => detach(tooltipId, ...refs),
|
|
2570
|
+
setActiveAnchor: (ref) => setActiveAnchor(tooltipId, ref),
|
|
2571
|
+
});
|
|
2572
|
+
}, [anchorRefMap, activeAnchorMap, attach, detach]);
|
|
2573
|
+
const context = require$$0.useMemo(() => {
|
|
2574
|
+
return {
|
|
2575
|
+
getTooltipData,
|
|
2576
|
+
};
|
|
2577
|
+
}, [getTooltipData]);
|
|
2578
|
+
return jsxRuntime.exports.jsx(TooltipContext.Provider, { value: context, children: children });
|
|
2579
|
+
};
|
|
2580
|
+
function useTooltip(tooltipId = DEFAULT_TOOLTIP_ID) {
|
|
2581
|
+
return require$$0.useContext(TooltipContext).getTooltipData(tooltipId);
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2584
|
+
const TooltipWrapper = ({ tooltipId, children, className, place, content, html, variant, offset, wrapper, events, positionStrategy, delayShow, delayHide, }) => {
|
|
2585
|
+
const { attach, detach } = useTooltip(tooltipId);
|
|
2586
|
+
const anchorRef = require$$0.useRef(null);
|
|
2587
|
+
require$$0.useEffect(() => {
|
|
2588
|
+
attach(anchorRef);
|
|
2589
|
+
return () => {
|
|
2590
|
+
detach(anchorRef);
|
|
2591
|
+
};
|
|
2592
|
+
}, []);
|
|
2593
|
+
return (jsxRuntime.exports.jsx("span", { ref: anchorRef, className: classNames('react-tooltip-wrapper', className), "data-tooltip-place": place, "data-tooltip-content": content, "data-tooltip-html": html, "data-tooltip-variant": variant, "data-tooltip-offset": offset, "data-tooltip-wrapper": wrapper, "data-tooltip-events": events, "data-tooltip-position-strategy": positionStrategy, "data-tooltip-delay-show": delayShow, "data-tooltip-delay-hide": delayHide, children: children }));
|
|
2594
|
+
};
|
|
2293
2595
|
|
|
2294
|
-
const computeTooltipPosition = async ({ elementReference = null, tooltipReference = null, tooltipArrowReference = null, place = 'top', offset: offsetValue = 10, strategy = 'absolute', }) => {
|
|
2596
|
+
const computeTooltipPosition = async ({ elementReference = null, tooltipReference = null, tooltipArrowReference = null, place = 'top', offset: offsetValue = 10, strategy = 'absolute', middlewares = [offset(Number(offsetValue)), flip(), shift({ padding: 5 })], }) => {
|
|
2295
2597
|
if (!elementReference) {
|
|
2296
2598
|
// elementReference can be null or undefined and we will not compute the position
|
|
2297
2599
|
// eslint-disable-next-line no-console
|
|
@@ -2301,7 +2603,7 @@
|
|
|
2301
2603
|
if (tooltipReference === null) {
|
|
2302
2604
|
return { tooltipStyles: {}, tooltipArrowStyles: {} };
|
|
2303
2605
|
}
|
|
2304
|
-
const middleware =
|
|
2606
|
+
const middleware = middlewares;
|
|
2305
2607
|
if (tooltipArrowReference) {
|
|
2306
2608
|
middleware.push(arrow({ element: tooltipArrowReference, padding: 5 }));
|
|
2307
2609
|
return computePosition(elementReference, tooltipReference, {
|
|
@@ -2342,7 +2644,7 @@
|
|
|
2342
2644
|
|
|
2343
2645
|
const Tooltip = ({
|
|
2344
2646
|
// props
|
|
2345
|
-
id, className, classNameArrow, variant = 'dark', anchorId, place = 'top', offset = 10, events = ['hover'], positionStrategy = 'absolute', wrapper: WrapperElement = 'div', children = null, delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, style: externalStyles, position, afterShow, afterHide,
|
|
2647
|
+
id, className, classNameArrow, variant = 'dark', anchorId, place = 'top', offset = 10, events = ['hover'], positionStrategy = 'absolute', middlewares, wrapper: WrapperElement = 'div', children = null, delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, closeOnEsc = false, style: externalStyles, position, afterShow, afterHide,
|
|
2346
2648
|
// props handled by controller
|
|
2347
2649
|
content, html, isOpen, setIsOpen, }) => {
|
|
2348
2650
|
const tooltipRef = require$$0.useRef(null);
|
|
@@ -2453,6 +2755,7 @@
|
|
|
2453
2755
|
tooltipReference: tooltipRef.current,
|
|
2454
2756
|
tooltipArrowReference: tooltipArrowRef.current,
|
|
2455
2757
|
strategy: positionStrategy,
|
|
2758
|
+
middlewares,
|
|
2456
2759
|
}).then((computedStylesData) => {
|
|
2457
2760
|
setCalculatingPosition(false);
|
|
2458
2761
|
if (Object.keys(computedStylesData.tooltipStyles).length) {
|
|
@@ -2488,6 +2791,12 @@
|
|
|
2488
2791
|
}
|
|
2489
2792
|
handleShow(false);
|
|
2490
2793
|
};
|
|
2794
|
+
const handleEsc = (event) => {
|
|
2795
|
+
if (event.key !== 'Escape') {
|
|
2796
|
+
return;
|
|
2797
|
+
}
|
|
2798
|
+
handleShow(false);
|
|
2799
|
+
};
|
|
2491
2800
|
// debounce handler to prevent call twice when
|
|
2492
2801
|
// mouse enter and focus events being triggered toggether
|
|
2493
2802
|
const debouncedHandleShowTooltip = debounce(handleShowTooltip, 50);
|
|
@@ -2503,6 +2812,9 @@
|
|
|
2503
2812
|
if (!elementRefs.size) {
|
|
2504
2813
|
return () => null;
|
|
2505
2814
|
}
|
|
2815
|
+
if (closeOnEsc) {
|
|
2816
|
+
window.addEventListener('keydown', handleEsc);
|
|
2817
|
+
}
|
|
2506
2818
|
const enabledEvents = [];
|
|
2507
2819
|
if (events.find((event) => event === 'click')) {
|
|
2508
2820
|
window.addEventListener('click', handleClickOutsideAnchor);
|
|
@@ -2536,7 +2848,12 @@
|
|
|
2536
2848
|
});
|
|
2537
2849
|
return () => {
|
|
2538
2850
|
var _a, _b;
|
|
2539
|
-
|
|
2851
|
+
if (events.find((event) => event === 'click')) {
|
|
2852
|
+
window.removeEventListener('click', handleClickOutsideAnchor);
|
|
2853
|
+
}
|
|
2854
|
+
if (closeOnEsc) {
|
|
2855
|
+
window.removeEventListener('keydown', handleEsc);
|
|
2856
|
+
}
|
|
2540
2857
|
if (clickable) {
|
|
2541
2858
|
(_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseenter', handleMouseEnterTooltip);
|
|
2542
2859
|
(_b = tooltipRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseleave', handleMouseLeaveTooltip);
|
|
@@ -2548,7 +2865,7 @@
|
|
|
2548
2865
|
});
|
|
2549
2866
|
});
|
|
2550
2867
|
};
|
|
2551
|
-
}, [anchorRefs, activeAnchor, anchorId, events, delayHide, delayShow]);
|
|
2868
|
+
}, [anchorRefs, activeAnchor, closeOnEsc, anchorId, events, delayHide, delayShow]);
|
|
2552
2869
|
require$$0.useEffect(() => {
|
|
2553
2870
|
if (position) {
|
|
2554
2871
|
// if `position` is set, override regular and `float` positioning
|
|
@@ -2583,6 +2900,7 @@
|
|
|
2583
2900
|
tooltipReference: tooltipRef.current,
|
|
2584
2901
|
tooltipArrowReference: tooltipArrowRef.current,
|
|
2585
2902
|
strategy: positionStrategy,
|
|
2903
|
+
middlewares,
|
|
2586
2904
|
}).then((computedStylesData) => {
|
|
2587
2905
|
if (!mounted) {
|
|
2588
2906
|
// invalidate computed positions after remount
|
|
@@ -2631,7 +2949,7 @@
|
|
|
2631
2949
|
}), style: inlineArrowStyles, ref: tooltipArrowRef })] }));
|
|
2632
2950
|
};
|
|
2633
2951
|
|
|
2634
|
-
const TooltipController = ({ id, anchorId, content, html, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], positionStrategy = 'absolute', delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, style, position, isOpen, setIsOpen, afterShow, afterHide, }) => {
|
|
2952
|
+
const TooltipController = ({ id, anchorId, content, html, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], positionStrategy = 'absolute', middlewares, delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, closeOnEsc = false, style, position, isOpen, setIsOpen, afterShow, afterHide, }) => {
|
|
2635
2953
|
const [tooltipContent, setTooltipContent] = require$$0.useState(content);
|
|
2636
2954
|
const [tooltipHtml, setTooltipHtml] = require$$0.useState(html);
|
|
2637
2955
|
const [tooltipPlace, setTooltipPlace] = require$$0.useState(place);
|
|
@@ -2763,11 +3081,13 @@
|
|
|
2763
3081
|
wrapper: tooltipWrapper,
|
|
2764
3082
|
events: tooltipEvents,
|
|
2765
3083
|
positionStrategy: tooltipPositionStrategy,
|
|
3084
|
+
middlewares,
|
|
2766
3085
|
delayShow: tooltipDelayShow,
|
|
2767
3086
|
delayHide: tooltipDelayHide,
|
|
2768
3087
|
float: tooltipFloat,
|
|
2769
3088
|
noArrow,
|
|
2770
3089
|
clickable,
|
|
3090
|
+
closeOnEsc,
|
|
2771
3091
|
style,
|
|
2772
3092
|
position,
|
|
2773
3093
|
isOpen,
|
|
@@ -2781,6 +3101,12 @@
|
|
|
2781
3101
|
exports.Tooltip = TooltipController;
|
|
2782
3102
|
exports.TooltipProvider = TooltipProvider;
|
|
2783
3103
|
exports.TooltipWrapper = TooltipWrapper;
|
|
3104
|
+
exports.autoPlacement = autoPlacement;
|
|
3105
|
+
exports.flip = flip;
|
|
3106
|
+
exports.inline = inline;
|
|
3107
|
+
exports.offset = offset;
|
|
3108
|
+
exports.shift = shift;
|
|
3109
|
+
exports.size = size;
|
|
2784
3110
|
|
|
2785
3111
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2786
3112
|
|