react-tooltip 5.7.3 → 5.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react-tooltip.cjs.js +564 -542
- package/dist/react-tooltip.cjs.min.js +3 -3
- package/dist/react-tooltip.esm.js +564 -542
- package/dist/react-tooltip.esm.min.js +3 -3
- package/dist/react-tooltip.umd.js +564 -542
- package/dist/react-tooltip.umd.min.js +3 -3
- package/package.json +1 -1
- package/bundlesize.config.json +0 -16
- package/rollup.config.dev.js +0 -88
- package/rollup.config.prod.js +0 -104
- package/rollup.config.types.js +0 -21
|
@@ -8,22 +8,22 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
8
8
|
|
|
9
9
|
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
|
|
10
10
|
|
|
11
|
-
function getSide(placement) {
|
|
12
|
-
return placement.split('-')[0];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
11
|
function getAlignment(placement) {
|
|
16
12
|
return placement.split('-')[1];
|
|
17
13
|
}
|
|
18
14
|
|
|
19
|
-
function getMainAxisFromPlacement(placement) {
|
|
20
|
-
return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
|
|
21
|
-
}
|
|
22
|
-
|
|
23
15
|
function getLengthFromAxis(axis) {
|
|
24
16
|
return axis === 'y' ? 'height' : 'width';
|
|
25
17
|
}
|
|
26
18
|
|
|
19
|
+
function getSide(placement) {
|
|
20
|
+
return placement.split('-')[0];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function getMainAxisFromPlacement(placement) {
|
|
24
|
+
return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
27
|
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
28
28
|
let {
|
|
29
29
|
reference,
|
|
@@ -37,7 +37,6 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
|
37
37
|
const side = getSide(placement);
|
|
38
38
|
const isVertical = mainAxis === 'x';
|
|
39
39
|
let coords;
|
|
40
|
-
|
|
41
40
|
switch (side) {
|
|
42
41
|
case 'top':
|
|
43
42
|
coords = {
|
|
@@ -45,45 +44,38 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
|
45
44
|
y: reference.y - floating.height
|
|
46
45
|
};
|
|
47
46
|
break;
|
|
48
|
-
|
|
49
47
|
case 'bottom':
|
|
50
48
|
coords = {
|
|
51
49
|
x: commonX,
|
|
52
50
|
y: reference.y + reference.height
|
|
53
51
|
};
|
|
54
52
|
break;
|
|
55
|
-
|
|
56
53
|
case 'right':
|
|
57
54
|
coords = {
|
|
58
55
|
x: reference.x + reference.width,
|
|
59
56
|
y: commonY
|
|
60
57
|
};
|
|
61
58
|
break;
|
|
62
|
-
|
|
63
59
|
case 'left':
|
|
64
60
|
coords = {
|
|
65
61
|
x: reference.x - floating.width,
|
|
66
62
|
y: commonY
|
|
67
63
|
};
|
|
68
64
|
break;
|
|
69
|
-
|
|
70
65
|
default:
|
|
71
66
|
coords = {
|
|
72
67
|
x: reference.x,
|
|
73
68
|
y: reference.y
|
|
74
69
|
};
|
|
75
70
|
}
|
|
76
|
-
|
|
77
71
|
switch (getAlignment(placement)) {
|
|
78
72
|
case 'start':
|
|
79
73
|
coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
80
74
|
break;
|
|
81
|
-
|
|
82
75
|
case 'end':
|
|
83
76
|
coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
84
77
|
break;
|
|
85
78
|
}
|
|
86
|
-
|
|
87
79
|
return coords;
|
|
88
80
|
}
|
|
89
81
|
|
|
@@ -94,7 +86,6 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
|
94
86
|
* This export does not have any `platform` interface logic. You will need to
|
|
95
87
|
* write one for the platform you are using Floating UI with.
|
|
96
88
|
*/
|
|
97
|
-
|
|
98
89
|
const computePosition$1 = async (reference, floating, config) => {
|
|
99
90
|
const {
|
|
100
91
|
placement = 'bottom',
|
|
@@ -104,12 +95,10 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
104
95
|
} = config;
|
|
105
96
|
const validMiddleware = middleware.filter(Boolean);
|
|
106
97
|
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
107
|
-
|
|
108
98
|
{
|
|
109
99
|
if (platform == null) {
|
|
110
100
|
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
101
|
}
|
|
112
|
-
|
|
113
102
|
if (validMiddleware.filter(_ref => {
|
|
114
103
|
let {
|
|
115
104
|
name
|
|
@@ -118,12 +107,10 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
118
107
|
}).length > 1) {
|
|
119
108
|
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
109
|
}
|
|
121
|
-
|
|
122
110
|
if (!reference || !floating) {
|
|
123
111
|
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
112
|
}
|
|
125
113
|
}
|
|
126
|
-
|
|
127
114
|
let rects = await platform.getElementRects({
|
|
128
115
|
reference,
|
|
129
116
|
floating,
|
|
@@ -136,7 +123,6 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
136
123
|
let statefulPlacement = placement;
|
|
137
124
|
let middlewareData = {};
|
|
138
125
|
let resetCount = 0;
|
|
139
|
-
|
|
140
126
|
for (let i = 0; i < validMiddleware.length; i++) {
|
|
141
127
|
const {
|
|
142
128
|
name,
|
|
@@ -163,26 +149,24 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
163
149
|
});
|
|
164
150
|
x = nextX != null ? nextX : x;
|
|
165
151
|
y = nextY != null ? nextY : y;
|
|
166
|
-
middlewareData = {
|
|
167
|
-
|
|
152
|
+
middlewareData = {
|
|
153
|
+
...middlewareData,
|
|
154
|
+
[name]: {
|
|
155
|
+
...middlewareData[name],
|
|
168
156
|
...data
|
|
169
157
|
}
|
|
170
158
|
};
|
|
171
|
-
|
|
172
159
|
{
|
|
173
160
|
if (resetCount > 50) {
|
|
174
161
|
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
162
|
}
|
|
176
163
|
}
|
|
177
|
-
|
|
178
164
|
if (reset && resetCount <= 50) {
|
|
179
165
|
resetCount++;
|
|
180
|
-
|
|
181
166
|
if (typeof reset === 'object') {
|
|
182
167
|
if (reset.placement) {
|
|
183
168
|
statefulPlacement = reset.placement;
|
|
184
169
|
}
|
|
185
|
-
|
|
186
170
|
if (reset.rects) {
|
|
187
171
|
rects = reset.rects === true ? await platform.getElementRects({
|
|
188
172
|
reference,
|
|
@@ -190,18 +174,15 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
190
174
|
strategy
|
|
191
175
|
}) : reset.rects;
|
|
192
176
|
}
|
|
193
|
-
|
|
194
177
|
({
|
|
195
178
|
x,
|
|
196
179
|
y
|
|
197
180
|
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
198
181
|
}
|
|
199
|
-
|
|
200
182
|
i = -1;
|
|
201
183
|
continue;
|
|
202
184
|
}
|
|
203
185
|
}
|
|
204
|
-
|
|
205
186
|
return {
|
|
206
187
|
x,
|
|
207
188
|
y,
|
|
@@ -231,7 +212,8 @@ function getSideObjectFromPadding(padding) {
|
|
|
231
212
|
}
|
|
232
213
|
|
|
233
214
|
function rectToClientRect(rect) {
|
|
234
|
-
return {
|
|
215
|
+
return {
|
|
216
|
+
...rect,
|
|
235
217
|
top: rect.y,
|
|
236
218
|
left: rect.x,
|
|
237
219
|
right: rect.x + rect.width,
|
|
@@ -249,11 +231,9 @@ function rectToClientRect(rect) {
|
|
|
249
231
|
*/
|
|
250
232
|
async function detectOverflow(middlewareArguments, options) {
|
|
251
233
|
var _await$platform$isEle;
|
|
252
|
-
|
|
253
234
|
if (options === void 0) {
|
|
254
235
|
options = {};
|
|
255
236
|
}
|
|
256
|
-
|
|
257
237
|
const {
|
|
258
238
|
x,
|
|
259
239
|
y,
|
|
@@ -278,19 +258,29 @@ async function detectOverflow(middlewareArguments, options) {
|
|
|
278
258
|
rootBoundary,
|
|
279
259
|
strategy
|
|
280
260
|
}));
|
|
261
|
+
const rect = elementContext === 'floating' ? {
|
|
262
|
+
...rects.floating,
|
|
263
|
+
x,
|
|
264
|
+
y
|
|
265
|
+
} : rects.reference;
|
|
266
|
+
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
267
|
+
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
|
|
268
|
+
x: 1,
|
|
269
|
+
y: 1
|
|
270
|
+
} : {
|
|
271
|
+
x: 1,
|
|
272
|
+
y: 1
|
|
273
|
+
};
|
|
281
274
|
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
282
|
-
rect
|
|
283
|
-
|
|
284
|
-
y
|
|
285
|
-
} : rects.reference,
|
|
286
|
-
offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
|
|
275
|
+
rect,
|
|
276
|
+
offsetParent,
|
|
287
277
|
strategy
|
|
288
|
-
}) :
|
|
278
|
+
}) : rect);
|
|
289
279
|
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
|
|
280
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
281
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
282
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
283
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
294
284
|
};
|
|
295
285
|
}
|
|
296
286
|
|
|
@@ -309,13 +299,12 @@ function within(min$1$1, value, max$1$1) {
|
|
|
309
299
|
const arrow = options => ({
|
|
310
300
|
name: 'arrow',
|
|
311
301
|
options,
|
|
312
|
-
|
|
313
302
|
async fn(middlewareArguments) {
|
|
314
|
-
// Since `element` is required, we don't Partial<> the type
|
|
303
|
+
// Since `element` is required, we don't Partial<> the type.
|
|
315
304
|
const {
|
|
316
305
|
element,
|
|
317
306
|
padding = 0
|
|
318
|
-
} = options
|
|
307
|
+
} = options || {};
|
|
319
308
|
const {
|
|
320
309
|
x,
|
|
321
310
|
y,
|
|
@@ -323,22 +312,18 @@ const arrow = options => ({
|
|
|
323
312
|
rects,
|
|
324
313
|
platform
|
|
325
314
|
} = middlewareArguments;
|
|
326
|
-
|
|
327
315
|
if (element == null) {
|
|
328
316
|
{
|
|
329
317
|
console.warn('Floating UI: No `element` was passed to the `arrow` middleware.');
|
|
330
318
|
}
|
|
331
|
-
|
|
332
319
|
return {};
|
|
333
320
|
}
|
|
334
|
-
|
|
335
321
|
const paddingObject = getSideObjectFromPadding(padding);
|
|
336
322
|
const coords = {
|
|
337
323
|
x,
|
|
338
324
|
y
|
|
339
325
|
};
|
|
340
326
|
const axis = getMainAxisFromPlacement(placement);
|
|
341
|
-
const alignment = getAlignment(placement);
|
|
342
327
|
const length = getLengthFromAxis(axis);
|
|
343
328
|
const arrowDimensions = await platform.getDimensions(element);
|
|
344
329
|
const minProp = axis === 'y' ? 'top' : 'left';
|
|
@@ -347,21 +332,23 @@ const arrow = options => ({
|
|
|
347
332
|
const startDiff = coords[axis] - rects.reference[axis];
|
|
348
333
|
const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
|
|
349
334
|
let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
|
|
350
|
-
|
|
351
335
|
if (clientSize === 0) {
|
|
352
336
|
clientSize = rects.floating[length];
|
|
353
337
|
}
|
|
338
|
+
const centerToReference = endDiff / 2 - startDiff / 2;
|
|
354
339
|
|
|
355
|
-
|
|
356
|
-
// point is outside the floating element's bounds
|
|
357
|
-
|
|
340
|
+
// Make sure the arrow doesn't overflow the floating element if the center
|
|
341
|
+
// point is outside the floating element's bounds.
|
|
358
342
|
const min = paddingObject[minProp];
|
|
359
343
|
const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
|
|
360
344
|
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
361
|
-
const offset = within(min, center, max);
|
|
345
|
+
const offset = within(min, center, max);
|
|
362
346
|
|
|
363
|
-
|
|
364
|
-
|
|
347
|
+
// If the reference is small enough that the arrow's padding causes it to
|
|
348
|
+
// to point to nothing for an aligned placement, adjust the offset of the
|
|
349
|
+
// floating element itself. This stops `shift()` from taking action, but can
|
|
350
|
+
// be worked around by calling it again after the `arrow()` if desired.
|
|
351
|
+
const shouldAddOffset = getAlignment(placement) != null && center != offset && rects.reference[length] / 2 - (center < min ? paddingObject[minProp] : paddingObject[maxProp]) - arrowDimensions[length] / 2 < 0;
|
|
365
352
|
const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
|
|
366
353
|
return {
|
|
367
354
|
[axis]: coords[axis] - alignmentOffset,
|
|
@@ -371,61 +358,55 @@ const arrow = options => ({
|
|
|
371
358
|
}
|
|
372
359
|
};
|
|
373
360
|
}
|
|
374
|
-
|
|
375
361
|
});
|
|
376
362
|
|
|
377
|
-
const
|
|
363
|
+
const sides = ['top', 'right', 'bottom', 'left'];
|
|
364
|
+
const allPlacements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-start", side + "-end"), []);
|
|
365
|
+
|
|
366
|
+
const oppositeSideMap = {
|
|
378
367
|
left: 'right',
|
|
379
368
|
right: 'left',
|
|
380
369
|
bottom: 'top',
|
|
381
370
|
top: 'bottom'
|
|
382
371
|
};
|
|
383
372
|
function getOppositePlacement(placement) {
|
|
384
|
-
return placement.replace(/left|right|bottom|top/g,
|
|
373
|
+
return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
|
|
385
374
|
}
|
|
386
375
|
|
|
387
376
|
function getAlignmentSides(placement, rects, rtl) {
|
|
388
377
|
if (rtl === void 0) {
|
|
389
378
|
rtl = false;
|
|
390
379
|
}
|
|
391
|
-
|
|
392
380
|
const alignment = getAlignment(placement);
|
|
393
381
|
const mainAxis = getMainAxisFromPlacement(placement);
|
|
394
382
|
const length = getLengthFromAxis(mainAxis);
|
|
395
383
|
let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
|
|
396
|
-
|
|
397
384
|
if (rects.reference[length] > rects.floating[length]) {
|
|
398
385
|
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
399
386
|
}
|
|
400
|
-
|
|
401
387
|
return {
|
|
402
388
|
main: mainAlignmentSide,
|
|
403
389
|
cross: getOppositePlacement(mainAlignmentSide)
|
|
404
390
|
};
|
|
405
391
|
}
|
|
406
392
|
|
|
407
|
-
const
|
|
393
|
+
const oppositeAlignmentMap = {
|
|
408
394
|
start: 'end',
|
|
409
395
|
end: 'start'
|
|
410
396
|
};
|
|
411
397
|
function getOppositeAlignmentPlacement(placement) {
|
|
412
|
-
return placement.replace(/start|end/g,
|
|
398
|
+
return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
|
|
413
399
|
}
|
|
414
400
|
|
|
415
|
-
const sides = ['top', 'right', 'bottom', 'left'];
|
|
416
|
-
const allPlacements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-start", side + "-end"), []);
|
|
417
|
-
|
|
418
401
|
function getPlacementList(alignment, autoAlignment, allowedPlacements) {
|
|
419
402
|
const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
|
|
420
403
|
return allowedPlacementsSortedByAlignment.filter(placement => {
|
|
421
404
|
if (alignment) {
|
|
422
405
|
return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
|
|
423
406
|
}
|
|
424
|
-
|
|
425
407
|
return true;
|
|
426
408
|
});
|
|
427
409
|
}
|
|
428
|
-
|
|
429
410
|
/**
|
|
430
411
|
* Automatically chooses the `placement` which has the most space available.
|
|
431
412
|
* @see https://floating-ui.com/docs/autoPlacement
|
|
@@ -434,17 +415,12 @@ const autoPlacement = function (options) {
|
|
|
434
415
|
if (options === void 0) {
|
|
435
416
|
options = {};
|
|
436
417
|
}
|
|
437
|
-
|
|
438
418
|
return {
|
|
439
419
|
name: 'autoPlacement',
|
|
440
420
|
options,
|
|
441
|
-
|
|
442
421
|
async fn(middlewareArguments) {
|
|
443
|
-
var _middlewareData$autoP, _middlewareData$autoP2,
|
|
444
|
-
|
|
422
|
+
var _middlewareData$autoP, _middlewareData$autoP2, _placementsSortedByLe;
|
|
445
423
|
const {
|
|
446
|
-
x,
|
|
447
|
-
y,
|
|
448
424
|
rects,
|
|
449
425
|
middlewareData,
|
|
450
426
|
placement,
|
|
@@ -452,42 +428,39 @@ const autoPlacement = function (options) {
|
|
|
452
428
|
elements
|
|
453
429
|
} = middlewareArguments;
|
|
454
430
|
const {
|
|
455
|
-
alignment
|
|
431
|
+
alignment,
|
|
456
432
|
allowedPlacements = allPlacements,
|
|
457
433
|
autoAlignment = true,
|
|
458
434
|
...detectOverflowOptions
|
|
459
435
|
} = options;
|
|
460
|
-
const placements = getPlacementList(alignment, autoAlignment, allowedPlacements);
|
|
436
|
+
const placements = alignment !== undefined || allowedPlacements === allPlacements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
|
|
461
437
|
const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
|
|
462
|
-
const currentIndex = (_middlewareData$autoP =
|
|
438
|
+
const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
|
|
463
439
|
const currentPlacement = placements[currentIndex];
|
|
464
|
-
|
|
465
440
|
if (currentPlacement == null) {
|
|
466
441
|
return {};
|
|
467
442
|
}
|
|
468
|
-
|
|
469
443
|
const {
|
|
470
444
|
main,
|
|
471
445
|
cross
|
|
472
|
-
} = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
|
|
446
|
+
} = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
|
|
473
447
|
|
|
448
|
+
// Make `computeCoords` start from the right place.
|
|
474
449
|
if (placement !== currentPlacement) {
|
|
475
450
|
return {
|
|
476
|
-
x,
|
|
477
|
-
y,
|
|
478
451
|
reset: {
|
|
479
452
|
placement: placements[0]
|
|
480
453
|
}
|
|
481
454
|
};
|
|
482
455
|
}
|
|
483
|
-
|
|
484
456
|
const currentOverflows = [overflow[getSide(currentPlacement)], overflow[main], overflow[cross]];
|
|
485
|
-
const allOverflows = [...((
|
|
457
|
+
const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
|
|
486
458
|
placement: currentPlacement,
|
|
487
459
|
overflows: currentOverflows
|
|
488
460
|
}];
|
|
489
|
-
const nextPlacement = placements[currentIndex + 1];
|
|
461
|
+
const nextPlacement = placements[currentIndex + 1];
|
|
490
462
|
|
|
463
|
+
// There are more placements to check.
|
|
491
464
|
if (nextPlacement) {
|
|
492
465
|
return {
|
|
493
466
|
data: {
|
|
@@ -499,7 +472,6 @@ const autoPlacement = function (options) {
|
|
|
499
472
|
}
|
|
500
473
|
};
|
|
501
474
|
}
|
|
502
|
-
|
|
503
475
|
const placementsSortedByLeastOverflow = allOverflows.slice().sort((a, b) => a.overflows[0] - b.overflows[0]);
|
|
504
476
|
const placementThatFitsOnAllSides = (_placementsSortedByLe = placementsSortedByLeastOverflow.find(_ref => {
|
|
505
477
|
let {
|
|
@@ -507,8 +479,7 @@ const autoPlacement = function (options) {
|
|
|
507
479
|
} = _ref;
|
|
508
480
|
return overflows.every(overflow => overflow <= 0);
|
|
509
481
|
})) == null ? void 0 : _placementsSortedByLe.placement;
|
|
510
|
-
const resetPlacement = placementThatFitsOnAllSides
|
|
511
|
-
|
|
482
|
+
const resetPlacement = placementThatFitsOnAllSides || placementsSortedByLeastOverflow[0].placement;
|
|
512
483
|
if (resetPlacement !== placement) {
|
|
513
484
|
return {
|
|
514
485
|
data: {
|
|
@@ -520,10 +491,8 @@ const autoPlacement = function (options) {
|
|
|
520
491
|
}
|
|
521
492
|
};
|
|
522
493
|
}
|
|
523
|
-
|
|
524
494
|
return {};
|
|
525
495
|
}
|
|
526
|
-
|
|
527
496
|
};
|
|
528
497
|
};
|
|
529
498
|
|
|
@@ -532,6 +501,35 @@ function getExpandedPlacements(placement) {
|
|
|
532
501
|
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
533
502
|
}
|
|
534
503
|
|
|
504
|
+
function getSideList(side, isStart, rtl) {
|
|
505
|
+
const lr = ['left', 'right'];
|
|
506
|
+
const rl = ['right', 'left'];
|
|
507
|
+
const tb = ['top', 'bottom'];
|
|
508
|
+
const bt = ['bottom', 'top'];
|
|
509
|
+
switch (side) {
|
|
510
|
+
case 'top':
|
|
511
|
+
case 'bottom':
|
|
512
|
+
if (rtl) return isStart ? rl : lr;
|
|
513
|
+
return isStart ? lr : rl;
|
|
514
|
+
case 'left':
|
|
515
|
+
case 'right':
|
|
516
|
+
return isStart ? tb : bt;
|
|
517
|
+
default:
|
|
518
|
+
return [];
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
522
|
+
const alignment = getAlignment(placement);
|
|
523
|
+
let list = getSideList(getSide(placement), direction === 'start', rtl);
|
|
524
|
+
if (alignment) {
|
|
525
|
+
list = list.map(side => side + "-" + alignment);
|
|
526
|
+
if (flipAlignment) {
|
|
527
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
return list;
|
|
531
|
+
}
|
|
532
|
+
|
|
535
533
|
/**
|
|
536
534
|
* Changes the placement of the floating element to one that will fit if the
|
|
537
535
|
* initially specified `placement` does not.
|
|
@@ -541,14 +539,11 @@ const flip = function (options) {
|
|
|
541
539
|
if (options === void 0) {
|
|
542
540
|
options = {};
|
|
543
541
|
}
|
|
544
|
-
|
|
545
542
|
return {
|
|
546
543
|
name: 'flip',
|
|
547
544
|
options,
|
|
548
|
-
|
|
549
545
|
async fn(middlewareArguments) {
|
|
550
546
|
var _middlewareData$flip;
|
|
551
|
-
|
|
552
547
|
const {
|
|
553
548
|
placement,
|
|
554
549
|
middlewareData,
|
|
@@ -562,42 +557,43 @@ const flip = function (options) {
|
|
|
562
557
|
crossAxis: checkCrossAxis = true,
|
|
563
558
|
fallbackPlacements: specifiedFallbackPlacements,
|
|
564
559
|
fallbackStrategy = 'bestFit',
|
|
560
|
+
fallbackAxisSideDirection = 'none',
|
|
565
561
|
flipAlignment = true,
|
|
566
562
|
...detectOverflowOptions
|
|
567
563
|
} = options;
|
|
568
564
|
const side = getSide(placement);
|
|
569
|
-
const isBasePlacement =
|
|
565
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
566
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
570
567
|
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
568
|
+
if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') {
|
|
569
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
570
|
+
}
|
|
571
571
|
const placements = [initialPlacement, ...fallbackPlacements];
|
|
572
572
|
const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
|
|
573
573
|
const overflows = [];
|
|
574
574
|
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
575
|
-
|
|
576
575
|
if (checkMainAxis) {
|
|
577
576
|
overflows.push(overflow[side]);
|
|
578
577
|
}
|
|
579
|
-
|
|
580
578
|
if (checkCrossAxis) {
|
|
581
579
|
const {
|
|
582
580
|
main,
|
|
583
581
|
cross
|
|
584
|
-
} = getAlignmentSides(placement, rects,
|
|
582
|
+
} = getAlignmentSides(placement, rects, rtl);
|
|
585
583
|
overflows.push(overflow[main], overflow[cross]);
|
|
586
584
|
}
|
|
587
|
-
|
|
588
585
|
overflowsData = [...overflowsData, {
|
|
589
586
|
placement,
|
|
590
587
|
overflows
|
|
591
|
-
}];
|
|
588
|
+
}];
|
|
592
589
|
|
|
590
|
+
// One or more sides is overflowing.
|
|
593
591
|
if (!overflows.every(side => side <= 0)) {
|
|
594
|
-
var _middlewareData$
|
|
595
|
-
|
|
596
|
-
const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
|
|
592
|
+
var _middlewareData$flip2, _overflowsData$find;
|
|
593
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
597
594
|
const nextPlacement = placements[nextIndex];
|
|
598
|
-
|
|
599
595
|
if (nextPlacement) {
|
|
600
|
-
// Try next placement and re-run the lifecycle
|
|
596
|
+
// Try next placement and re-run the lifecycle.
|
|
601
597
|
return {
|
|
602
598
|
data: {
|
|
603
599
|
index: nextIndex,
|
|
@@ -609,27 +605,26 @@ const flip = function (options) {
|
|
|
609
605
|
};
|
|
610
606
|
}
|
|
611
607
|
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
608
|
+
// First, try to use the one that fits on mainAxis side of overflow.
|
|
609
|
+
let resetPlacement = (_overflowsData$find = overflowsData.find(d => d.overflows[0] <= 0)) == null ? void 0 : _overflowsData$find.placement;
|
|
610
|
+
|
|
611
|
+
// Otherwise fallback.
|
|
612
|
+
if (!resetPlacement) {
|
|
613
|
+
switch (fallbackStrategy) {
|
|
614
|
+
case 'bestFit':
|
|
615
|
+
{
|
|
616
|
+
var _overflowsData$map$so;
|
|
617
|
+
const placement = (_overflowsData$map$so = overflowsData.map(d => [d.placement, 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];
|
|
618
|
+
if (placement) {
|
|
619
|
+
resetPlacement = placement;
|
|
620
|
+
}
|
|
621
|
+
break;
|
|
623
622
|
}
|
|
624
|
-
|
|
623
|
+
case 'initialPlacement':
|
|
624
|
+
resetPlacement = initialPlacement;
|
|
625
625
|
break;
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
case 'initialPlacement':
|
|
629
|
-
resetPlacement = initialPlacement;
|
|
630
|
-
break;
|
|
626
|
+
}
|
|
631
627
|
}
|
|
632
|
-
|
|
633
628
|
if (placement !== resetPlacement) {
|
|
634
629
|
return {
|
|
635
630
|
reset: {
|
|
@@ -638,10 +633,115 @@ const flip = function (options) {
|
|
|
638
633
|
};
|
|
639
634
|
}
|
|
640
635
|
}
|
|
641
|
-
|
|
642
636
|
return {};
|
|
643
637
|
}
|
|
638
|
+
};
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* Provides improved positioning for inline reference elements that can span
|
|
643
|
+
* over multiple lines, such as hyperlinks or range selections.
|
|
644
|
+
* @see https://floating-ui.com/docs/inline
|
|
645
|
+
*/
|
|
646
|
+
const inline = function (options) {
|
|
647
|
+
if (options === void 0) {
|
|
648
|
+
options = {};
|
|
649
|
+
}
|
|
650
|
+
return {
|
|
651
|
+
name: 'inline',
|
|
652
|
+
options,
|
|
653
|
+
async fn(middlewareArguments) {
|
|
654
|
+
const {
|
|
655
|
+
placement,
|
|
656
|
+
elements,
|
|
657
|
+
rects,
|
|
658
|
+
platform,
|
|
659
|
+
strategy
|
|
660
|
+
} = middlewareArguments;
|
|
661
|
+
// A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
|
|
662
|
+
// ClientRect's bounds, despite the event listener being triggered. A
|
|
663
|
+
// padding of 2 seems to handle this issue.
|
|
664
|
+
const {
|
|
665
|
+
padding = 2,
|
|
666
|
+
x,
|
|
667
|
+
y
|
|
668
|
+
} = options;
|
|
669
|
+
const fallback = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
670
|
+
rect: rects.reference,
|
|
671
|
+
offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
|
|
672
|
+
strategy
|
|
673
|
+
}) : rects.reference);
|
|
674
|
+
const clientRects = (await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || [];
|
|
675
|
+
const paddingObject = getSideObjectFromPadding(padding);
|
|
676
|
+
function getBoundingClientRect() {
|
|
677
|
+
// There are two rects and they are disjoined.
|
|
678
|
+
if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
|
|
679
|
+
// Find the first rect in which the point is fully inside.
|
|
680
|
+
return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;
|
|
681
|
+
}
|
|
644
682
|
|
|
683
|
+
// There are 2 or more connected rects.
|
|
684
|
+
if (clientRects.length >= 2) {
|
|
685
|
+
if (getMainAxisFromPlacement(placement) === 'x') {
|
|
686
|
+
const firstRect = clientRects[0];
|
|
687
|
+
const lastRect = clientRects[clientRects.length - 1];
|
|
688
|
+
const isTop = getSide(placement) === 'top';
|
|
689
|
+
const top = firstRect.top;
|
|
690
|
+
const bottom = lastRect.bottom;
|
|
691
|
+
const left = isTop ? firstRect.left : lastRect.left;
|
|
692
|
+
const right = isTop ? firstRect.right : lastRect.right;
|
|
693
|
+
const width = right - left;
|
|
694
|
+
const height = bottom - top;
|
|
695
|
+
return {
|
|
696
|
+
top,
|
|
697
|
+
bottom,
|
|
698
|
+
left,
|
|
699
|
+
right,
|
|
700
|
+
width,
|
|
701
|
+
height,
|
|
702
|
+
x: left,
|
|
703
|
+
y: top
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
const isLeftSide = getSide(placement) === 'left';
|
|
707
|
+
const maxRight = max$1(...clientRects.map(rect => rect.right));
|
|
708
|
+
const minLeft = min$1(...clientRects.map(rect => rect.left));
|
|
709
|
+
const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
|
|
710
|
+
const top = measureRects[0].top;
|
|
711
|
+
const bottom = measureRects[measureRects.length - 1].bottom;
|
|
712
|
+
const left = minLeft;
|
|
713
|
+
const right = maxRight;
|
|
714
|
+
const width = right - left;
|
|
715
|
+
const height = bottom - top;
|
|
716
|
+
return {
|
|
717
|
+
top,
|
|
718
|
+
bottom,
|
|
719
|
+
left,
|
|
720
|
+
right,
|
|
721
|
+
width,
|
|
722
|
+
height,
|
|
723
|
+
x: left,
|
|
724
|
+
y: top
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
return fallback;
|
|
728
|
+
}
|
|
729
|
+
const resetRects = await platform.getElementRects({
|
|
730
|
+
reference: {
|
|
731
|
+
getBoundingClientRect
|
|
732
|
+
},
|
|
733
|
+
floating: elements.floating,
|
|
734
|
+
strategy
|
|
735
|
+
});
|
|
736
|
+
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) {
|
|
737
|
+
return {
|
|
738
|
+
reset: {
|
|
739
|
+
rects: resetRects
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
return {};
|
|
744
|
+
}
|
|
645
745
|
};
|
|
646
746
|
};
|
|
647
747
|
|
|
@@ -657,8 +757,9 @@ async function convertValueToCoords(middlewareArguments, value) {
|
|
|
657
757
|
const isVertical = getMainAxisFromPlacement(placement) === 'x';
|
|
658
758
|
const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
|
|
659
759
|
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
660
|
-
const rawValue = typeof value === 'function' ? value(middlewareArguments) : value;
|
|
760
|
+
const rawValue = typeof value === 'function' ? value(middlewareArguments) : value;
|
|
661
761
|
|
|
762
|
+
// eslint-disable-next-line prefer-const
|
|
662
763
|
let {
|
|
663
764
|
mainAxis,
|
|
664
765
|
crossAxis,
|
|
@@ -673,11 +774,9 @@ async function convertValueToCoords(middlewareArguments, value) {
|
|
|
673
774
|
alignmentAxis: null,
|
|
674
775
|
...rawValue
|
|
675
776
|
};
|
|
676
|
-
|
|
677
777
|
if (alignment && typeof alignmentAxis === 'number') {
|
|
678
778
|
crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
|
|
679
779
|
}
|
|
680
|
-
|
|
681
780
|
return isVertical ? {
|
|
682
781
|
x: crossAxis * crossAxisMulti,
|
|
683
782
|
y: mainAxis * mainAxisMulti
|
|
@@ -686,20 +785,18 @@ async function convertValueToCoords(middlewareArguments, value) {
|
|
|
686
785
|
y: crossAxis * crossAxisMulti
|
|
687
786
|
};
|
|
688
787
|
}
|
|
788
|
+
|
|
689
789
|
/**
|
|
690
790
|
* Displaces the floating element from its reference element.
|
|
691
791
|
* @see https://floating-ui.com/docs/offset
|
|
692
792
|
*/
|
|
693
|
-
|
|
694
793
|
const offset = function (value) {
|
|
695
794
|
if (value === void 0) {
|
|
696
795
|
value = 0;
|
|
697
796
|
}
|
|
698
|
-
|
|
699
797
|
return {
|
|
700
798
|
name: 'offset',
|
|
701
799
|
options: value,
|
|
702
|
-
|
|
703
800
|
async fn(middlewareArguments) {
|
|
704
801
|
const {
|
|
705
802
|
x,
|
|
@@ -712,7 +809,6 @@ const offset = function (value) {
|
|
|
712
809
|
data: diffCoords
|
|
713
810
|
};
|
|
714
811
|
}
|
|
715
|
-
|
|
716
812
|
};
|
|
717
813
|
};
|
|
718
814
|
|
|
@@ -729,11 +825,9 @@ const shift = function (options) {
|
|
|
729
825
|
if (options === void 0) {
|
|
730
826
|
options = {};
|
|
731
827
|
}
|
|
732
|
-
|
|
733
828
|
return {
|
|
734
829
|
name: 'shift',
|
|
735
830
|
options,
|
|
736
|
-
|
|
737
831
|
async fn(middlewareArguments) {
|
|
738
832
|
const {
|
|
739
833
|
x,
|
|
@@ -766,7 +860,6 @@ const shift = function (options) {
|
|
|
766
860
|
const crossAxis = getCrossAxis(mainAxis);
|
|
767
861
|
let mainAxisCoord = coords[mainAxis];
|
|
768
862
|
let crossAxisCoord = coords[crossAxis];
|
|
769
|
-
|
|
770
863
|
if (checkMainAxis) {
|
|
771
864
|
const minSide = mainAxis === 'y' ? 'top' : 'left';
|
|
772
865
|
const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
|
|
@@ -774,7 +867,6 @@ const shift = function (options) {
|
|
|
774
867
|
const max = mainAxisCoord - overflow[maxSide];
|
|
775
868
|
mainAxisCoord = within(min, mainAxisCoord, max);
|
|
776
869
|
}
|
|
777
|
-
|
|
778
870
|
if (checkCrossAxis) {
|
|
779
871
|
const minSide = crossAxis === 'y' ? 'top' : 'left';
|
|
780
872
|
const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
|
|
@@ -782,19 +874,19 @@ const shift = function (options) {
|
|
|
782
874
|
const max = crossAxisCoord - overflow[maxSide];
|
|
783
875
|
crossAxisCoord = within(min, crossAxisCoord, max);
|
|
784
876
|
}
|
|
785
|
-
|
|
786
|
-
|
|
877
|
+
const limitedCoords = limiter.fn({
|
|
878
|
+
...middlewareArguments,
|
|
787
879
|
[mainAxis]: mainAxisCoord,
|
|
788
880
|
[crossAxis]: crossAxisCoord
|
|
789
881
|
});
|
|
790
|
-
return {
|
|
882
|
+
return {
|
|
883
|
+
...limitedCoords,
|
|
791
884
|
data: {
|
|
792
885
|
x: limitedCoords.x - x,
|
|
793
886
|
y: limitedCoords.y - y
|
|
794
887
|
}
|
|
795
888
|
};
|
|
796
889
|
}
|
|
797
|
-
|
|
798
890
|
};
|
|
799
891
|
};
|
|
800
892
|
|
|
@@ -808,11 +900,9 @@ const size = function (options) {
|
|
|
808
900
|
if (options === void 0) {
|
|
809
901
|
options = {};
|
|
810
902
|
}
|
|
811
|
-
|
|
812
903
|
return {
|
|
813
904
|
name: 'size',
|
|
814
905
|
options,
|
|
815
|
-
|
|
816
906
|
async fn(middlewareArguments) {
|
|
817
907
|
const {
|
|
818
908
|
placement,
|
|
@@ -829,7 +919,6 @@ const size = function (options) {
|
|
|
829
919
|
const alignment = getAlignment(placement);
|
|
830
920
|
let heightSide;
|
|
831
921
|
let widthSide;
|
|
832
|
-
|
|
833
922
|
if (side === 'top' || side === 'bottom') {
|
|
834
923
|
heightSide = side;
|
|
835
924
|
widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
|
|
@@ -837,7 +926,6 @@ const size = function (options) {
|
|
|
837
926
|
widthSide = side;
|
|
838
927
|
heightSide = alignment === 'end' ? 'top' : 'bottom';
|
|
839
928
|
}
|
|
840
|
-
|
|
841
929
|
const xMin = max$1(overflow.left, 0);
|
|
842
930
|
const xMax = max$1(overflow.right, 0);
|
|
843
931
|
const yMin = max$1(overflow.top, 0);
|
|
@@ -846,11 +934,11 @@ const size = function (options) {
|
|
|
846
934
|
availableHeight: rects.floating.height - (['left', 'right'].includes(placement) ? 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max$1(overflow.top, overflow.bottom)) : overflow[heightSide]),
|
|
847
935
|
availableWidth: rects.floating.width - (['top', 'bottom'].includes(placement) ? 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max$1(overflow.left, overflow.right)) : overflow[widthSide])
|
|
848
936
|
};
|
|
849
|
-
await apply({
|
|
937
|
+
await apply({
|
|
938
|
+
...middlewareArguments,
|
|
850
939
|
...dimensions
|
|
851
940
|
});
|
|
852
941
|
const nextDimensions = await platform.getDimensions(elements.floating);
|
|
853
|
-
|
|
854
942
|
if (rects.floating.width !== nextDimensions.width || rects.floating.height !== nextDimensions.height) {
|
|
855
943
|
return {
|
|
856
944
|
reset: {
|
|
@@ -858,164 +946,56 @@ const size = function (options) {
|
|
|
858
946
|
}
|
|
859
947
|
};
|
|
860
948
|
}
|
|
861
|
-
|
|
862
949
|
return {};
|
|
863
950
|
}
|
|
864
|
-
|
|
865
951
|
};
|
|
866
952
|
};
|
|
867
953
|
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
*/
|
|
873
|
-
const inline = function (options) {
|
|
874
|
-
if (options === void 0) {
|
|
875
|
-
options = {};
|
|
876
|
-
}
|
|
954
|
+
function getWindow(node) {
|
|
955
|
+
var _node$ownerDocument;
|
|
956
|
+
return ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
957
|
+
}
|
|
877
958
|
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
959
|
+
function getComputedStyle$1(element) {
|
|
960
|
+
return getWindow(element).getComputedStyle(element);
|
|
961
|
+
}
|
|
881
962
|
|
|
882
|
-
|
|
883
|
-
|
|
963
|
+
const min = Math.min;
|
|
964
|
+
const max = Math.max;
|
|
965
|
+
const round = Math.round;
|
|
884
966
|
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
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;
|
|
967
|
+
function getCssDimensions(element) {
|
|
968
|
+
const css = getComputedStyle$1(element);
|
|
969
|
+
let width = parseFloat(css.width);
|
|
970
|
+
let height = parseFloat(css.height);
|
|
971
|
+
const offsetWidth = element.offsetWidth;
|
|
972
|
+
const offsetHeight = element.offsetHeight;
|
|
973
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
974
|
+
if (shouldFallback) {
|
|
975
|
+
width = offsetWidth;
|
|
976
|
+
height = offsetHeight;
|
|
994
977
|
}
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
return node;
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
function getComputedStyle(element) {
|
|
1005
|
-
return getWindow(element).getComputedStyle(element);
|
|
978
|
+
return {
|
|
979
|
+
width,
|
|
980
|
+
height,
|
|
981
|
+
fallback: shouldFallback
|
|
982
|
+
};
|
|
1006
983
|
}
|
|
1007
984
|
|
|
1008
985
|
function getNodeName(node) {
|
|
1009
|
-
return
|
|
986
|
+
return isNode(node) ? (node.nodeName || '').toLowerCase() : '';
|
|
1010
987
|
}
|
|
1011
988
|
|
|
989
|
+
let uaString;
|
|
1012
990
|
function getUAString() {
|
|
991
|
+
if (uaString) {
|
|
992
|
+
return uaString;
|
|
993
|
+
}
|
|
1013
994
|
const uaData = navigator.userAgentData;
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
return
|
|
995
|
+
if (uaData && Array.isArray(uaData.brands)) {
|
|
996
|
+
uaString = uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
|
|
997
|
+
return uaString;
|
|
1017
998
|
}
|
|
1018
|
-
|
|
1019
999
|
return navigator.userAgent;
|
|
1020
1000
|
}
|
|
1021
1001
|
|
|
@@ -1029,83 +1009,135 @@ function isNode(value) {
|
|
|
1029
1009
|
return value instanceof getWindow(value).Node;
|
|
1030
1010
|
}
|
|
1031
1011
|
function isShadowRoot(node) {
|
|
1032
|
-
// Browsers without `ShadowRoot` support
|
|
1012
|
+
// Browsers without `ShadowRoot` support.
|
|
1033
1013
|
if (typeof ShadowRoot === 'undefined') {
|
|
1034
1014
|
return false;
|
|
1035
1015
|
}
|
|
1036
|
-
|
|
1037
1016
|
const OwnElement = getWindow(node).ShadowRoot;
|
|
1038
1017
|
return node instanceof OwnElement || node instanceof ShadowRoot;
|
|
1039
1018
|
}
|
|
1040
1019
|
function isOverflowElement(element) {
|
|
1041
|
-
// Firefox wants us to check `-x` and `-y` variations as well
|
|
1042
1020
|
const {
|
|
1043
1021
|
overflow,
|
|
1044
1022
|
overflowX,
|
|
1045
1023
|
overflowY,
|
|
1046
1024
|
display
|
|
1047
|
-
} = getComputedStyle(element);
|
|
1048
|
-
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
|
|
1025
|
+
} = getComputedStyle$1(element);
|
|
1026
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
|
|
1049
1027
|
}
|
|
1050
1028
|
function isTableElement(element) {
|
|
1051
1029
|
return ['table', 'td', 'th'].includes(getNodeName(element));
|
|
1052
1030
|
}
|
|
1053
1031
|
function isContainingBlock(element) {
|
|
1054
|
-
// TODO: Try
|
|
1032
|
+
// TODO: Try to use feature detection here instead.
|
|
1055
1033
|
const isFirefox = /firefox/i.test(getUAString());
|
|
1056
|
-
const css = getComputedStyle(element);
|
|
1057
|
-
const backdropFilter = css.backdropFilter || css.WebkitBackdropFilter;
|
|
1034
|
+
const css = getComputedStyle$1(element);
|
|
1035
|
+
const backdropFilter = css.backdropFilter || css.WebkitBackdropFilter;
|
|
1036
|
+
|
|
1037
|
+
// This is non-exhaustive but covers the most common CSS properties that
|
|
1058
1038
|
// create a containing block.
|
|
1059
1039
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
value => {
|
|
1040
|
+
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(value => {
|
|
1041
|
+
// Add type check for old browsers.
|
|
1063
1042
|
const contain = css.contain;
|
|
1064
1043
|
return contain != null ? contain.includes(value) : false;
|
|
1065
1044
|
});
|
|
1066
1045
|
}
|
|
1067
1046
|
function isLayoutViewport() {
|
|
1068
|
-
//
|
|
1069
|
-
|
|
1047
|
+
// TODO: Try to use feature detection here instead. Feature detection for
|
|
1048
|
+
// this can fail in various ways, making the userAgent check the most:
|
|
1049
|
+
// reliable:
|
|
1070
1050
|
// • Always-visible scrollbar or not
|
|
1071
|
-
// • Width of <html
|
|
1072
|
-
|
|
1073
|
-
//
|
|
1051
|
+
// • Width of <html>
|
|
1052
|
+
|
|
1053
|
+
// Not Safari.
|
|
1054
|
+
return !/^((?!chrome|android).)*safari/i.test(getUAString());
|
|
1074
1055
|
}
|
|
1075
1056
|
function isLastTraversableNode(node) {
|
|
1076
1057
|
return ['html', 'body', '#document'].includes(getNodeName(node));
|
|
1077
1058
|
}
|
|
1078
1059
|
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1060
|
+
function unwrapElement(element) {
|
|
1061
|
+
return !isElement(element) ? element.contextElement : element;
|
|
1062
|
+
}
|
|
1082
1063
|
|
|
1083
|
-
|
|
1084
|
-
|
|
1064
|
+
const FALLBACK_SCALE = {
|
|
1065
|
+
x: 1,
|
|
1066
|
+
y: 1
|
|
1067
|
+
};
|
|
1068
|
+
function getScale(element) {
|
|
1069
|
+
const domElement = unwrapElement(element);
|
|
1070
|
+
if (!isHTMLElement(domElement)) {
|
|
1071
|
+
return FALLBACK_SCALE;
|
|
1072
|
+
}
|
|
1073
|
+
const rect = domElement.getBoundingClientRect();
|
|
1074
|
+
const {
|
|
1075
|
+
width,
|
|
1076
|
+
height,
|
|
1077
|
+
fallback
|
|
1078
|
+
} = getCssDimensions(domElement);
|
|
1079
|
+
let x = (fallback ? round(rect.width) : rect.width) / width;
|
|
1080
|
+
let y = (fallback ? round(rect.height) : rect.height) / height;
|
|
1085
1081
|
|
|
1082
|
+
// 0, NaN, or Infinity should always fallback to 1.
|
|
1083
|
+
|
|
1084
|
+
if (!x || !Number.isFinite(x)) {
|
|
1085
|
+
x = 1;
|
|
1086
|
+
}
|
|
1087
|
+
if (!y || !Number.isFinite(y)) {
|
|
1088
|
+
y = 1;
|
|
1089
|
+
}
|
|
1090
|
+
return {
|
|
1091
|
+
x,
|
|
1092
|
+
y
|
|
1093
|
+
};
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
1097
|
+
var _win$visualViewport, _win$visualViewport2;
|
|
1086
1098
|
if (includeScale === void 0) {
|
|
1087
1099
|
includeScale = false;
|
|
1088
1100
|
}
|
|
1089
|
-
|
|
1090
1101
|
if (isFixedStrategy === void 0) {
|
|
1091
1102
|
isFixedStrategy = false;
|
|
1092
1103
|
}
|
|
1093
|
-
|
|
1094
1104
|
const clientRect = element.getBoundingClientRect();
|
|
1095
|
-
|
|
1096
|
-
let
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1105
|
+
const domElement = unwrapElement(element);
|
|
1106
|
+
let scale = FALLBACK_SCALE;
|
|
1107
|
+
if (includeScale) {
|
|
1108
|
+
if (offsetParent) {
|
|
1109
|
+
if (isElement(offsetParent)) {
|
|
1110
|
+
scale = getScale(offsetParent);
|
|
1111
|
+
}
|
|
1112
|
+
} else {
|
|
1113
|
+
scale = getScale(element);
|
|
1114
|
+
}
|
|
1101
1115
|
}
|
|
1102
|
-
|
|
1103
|
-
const win = isElement(element) ? getWindow(element) : window;
|
|
1116
|
+
const win = domElement ? getWindow(domElement) : window;
|
|
1104
1117
|
const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1118
|
+
let x = (clientRect.left + (addVisualOffsets ? ((_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) || 0 : 0)) / scale.x;
|
|
1119
|
+
let y = (clientRect.top + (addVisualOffsets ? ((_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) || 0 : 0)) / scale.y;
|
|
1120
|
+
let width = clientRect.width / scale.x;
|
|
1121
|
+
let height = clientRect.height / scale.y;
|
|
1122
|
+
if (domElement) {
|
|
1123
|
+
const win = getWindow(domElement);
|
|
1124
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
1125
|
+
let currentIFrame = win.frameElement;
|
|
1126
|
+
while (currentIFrame && offsetParent && offsetWin !== win) {
|
|
1127
|
+
const iframeScale = getScale(currentIFrame);
|
|
1128
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
1129
|
+
const css = getComputedStyle(currentIFrame);
|
|
1130
|
+
iframeRect.x += (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
1131
|
+
iframeRect.y += (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
1132
|
+
x *= iframeScale.x;
|
|
1133
|
+
y *= iframeScale.y;
|
|
1134
|
+
width *= iframeScale.x;
|
|
1135
|
+
height *= iframeScale.y;
|
|
1136
|
+
x += iframeRect.x;
|
|
1137
|
+
y += iframeRect.y;
|
|
1138
|
+
currentIFrame = getWindow(currentIFrame).frameElement;
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1109
1141
|
return {
|
|
1110
1142
|
width,
|
|
1111
1143
|
height,
|
|
@@ -1129,127 +1161,12 @@ function getNodeScroll(element) {
|
|
|
1129
1161
|
scrollTop: element.scrollTop
|
|
1130
1162
|
};
|
|
1131
1163
|
}
|
|
1132
|
-
|
|
1133
1164
|
return {
|
|
1134
1165
|
scrollLeft: element.pageXOffset,
|
|
1135
1166
|
scrollTop: element.pageYOffset
|
|
1136
1167
|
};
|
|
1137
1168
|
}
|
|
1138
1169
|
|
|
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
|
-
}
|
|
1144
|
-
|
|
1145
|
-
function isScaled(element) {
|
|
1146
|
-
const rect = getBoundingClientRect(element);
|
|
1147
|
-
return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
|
|
1148
|
-
}
|
|
1149
|
-
|
|
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
|
-
};
|
|
1163
|
-
|
|
1164
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
|
|
1165
|
-
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
1166
|
-
scroll = getNodeScroll(offsetParent);
|
|
1167
|
-
}
|
|
1168
|
-
|
|
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
|
-
}
|
|
1177
|
-
|
|
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
|
-
}
|
|
1185
|
-
|
|
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
|
-
}
|
|
1198
|
-
|
|
1199
|
-
function getTrueOffsetParent(element) {
|
|
1200
|
-
if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
|
|
1201
|
-
return null;
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
return element.offsetParent;
|
|
1205
|
-
}
|
|
1206
|
-
|
|
1207
|
-
function getContainingBlock(element) {
|
|
1208
|
-
let currentNode = getParentNode(element);
|
|
1209
|
-
|
|
1210
|
-
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1211
|
-
if (isContainingBlock(currentNode)) {
|
|
1212
|
-
return currentNode;
|
|
1213
|
-
} else {
|
|
1214
|
-
currentNode = getParentNode(currentNode);
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
return null;
|
|
1219
|
-
} // Gets the closest ancestor positioned element. Handles some edge cases,
|
|
1220
|
-
// such as table ancestors and cross browser bugs.
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
function getOffsetParent(element) {
|
|
1224
|
-
const window = getWindow(element);
|
|
1225
|
-
let offsetParent = getTrueOffsetParent(element);
|
|
1226
|
-
|
|
1227
|
-
while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
|
|
1228
|
-
offsetParent = getTrueOffsetParent(offsetParent);
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1231
|
-
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
|
|
1232
|
-
return window;
|
|
1233
|
-
}
|
|
1234
|
-
|
|
1235
|
-
return offsetParent || getContainingBlock(element) || window;
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
function getDimensions(element) {
|
|
1239
|
-
if (isHTMLElement(element)) {
|
|
1240
|
-
return {
|
|
1241
|
-
width: element.offsetWidth,
|
|
1242
|
-
height: element.offsetHeight
|
|
1243
|
-
};
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
const rect = getBoundingClientRect(element);
|
|
1247
|
-
return {
|
|
1248
|
-
width: rect.width,
|
|
1249
|
-
height: rect.height
|
|
1250
|
-
};
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
1170
|
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
1254
1171
|
let {
|
|
1255
1172
|
rect,
|
|
@@ -1258,87 +1175,59 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
1258
1175
|
} = _ref;
|
|
1259
1176
|
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1260
1177
|
const documentElement = getDocumentElement(offsetParent);
|
|
1261
|
-
|
|
1262
1178
|
if (offsetParent === documentElement) {
|
|
1263
1179
|
return rect;
|
|
1264
1180
|
}
|
|
1265
|
-
|
|
1266
1181
|
let scroll = {
|
|
1267
1182
|
scrollLeft: 0,
|
|
1268
1183
|
scrollTop: 0
|
|
1269
1184
|
};
|
|
1185
|
+
let scale = {
|
|
1186
|
+
x: 1,
|
|
1187
|
+
y: 1
|
|
1188
|
+
};
|
|
1270
1189
|
const offsets = {
|
|
1271
1190
|
x: 0,
|
|
1272
1191
|
y: 0
|
|
1273
1192
|
};
|
|
1274
|
-
|
|
1275
1193
|
if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
|
|
1276
1194
|
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
1277
1195
|
scroll = getNodeScroll(offsetParent);
|
|
1278
1196
|
}
|
|
1279
|
-
|
|
1280
1197
|
if (isHTMLElement(offsetParent)) {
|
|
1281
|
-
const offsetRect = getBoundingClientRect(offsetParent
|
|
1198
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
1199
|
+
scale = getScale(offsetParent);
|
|
1282
1200
|
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1283
1201
|
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
|
-
// }
|
|
1288
|
-
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
return { ...rect,
|
|
1292
|
-
x: rect.x - scroll.scrollLeft + offsets.x,
|
|
1293
|
-
y: rect.y - scroll.scrollTop + offsets.y
|
|
1294
|
-
};
|
|
1295
|
-
}
|
|
1296
|
-
|
|
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;
|
|
1305
|
-
|
|
1306
|
-
if (visualViewport) {
|
|
1307
|
-
width = visualViewport.width;
|
|
1308
|
-
height = visualViewport.height;
|
|
1309
|
-
const layoutViewport = isLayoutViewport();
|
|
1310
|
-
|
|
1311
|
-
if (layoutViewport || !layoutViewport && strategy === 'fixed') {
|
|
1312
|
-
x = visualViewport.offsetLeft;
|
|
1313
|
-
y = visualViewport.offsetTop;
|
|
1314
1202
|
}
|
|
1315
1203
|
}
|
|
1316
|
-
|
|
1317
1204
|
return {
|
|
1318
|
-
width,
|
|
1319
|
-
height,
|
|
1320
|
-
x,
|
|
1321
|
-
y
|
|
1205
|
+
width: rect.width * scale.x,
|
|
1206
|
+
height: rect.height * scale.y,
|
|
1207
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
|
|
1208
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
|
|
1322
1209
|
};
|
|
1323
1210
|
}
|
|
1324
1211
|
|
|
1325
|
-
|
|
1212
|
+
function getWindowScrollBarX(element) {
|
|
1213
|
+
// If <html> has a CSS width greater than the viewport, then this will be
|
|
1214
|
+
// incorrect for RTL.
|
|
1215
|
+
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
|
1216
|
+
}
|
|
1326
1217
|
|
|
1218
|
+
// Gets the entire size of the scrollable document area, even extending outside
|
|
1219
|
+
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
|
1327
1220
|
function getDocumentRect(element) {
|
|
1328
|
-
var _element$ownerDocumen;
|
|
1329
|
-
|
|
1330
1221
|
const html = getDocumentElement(element);
|
|
1331
1222
|
const scroll = getNodeScroll(element);
|
|
1332
|
-
const body =
|
|
1333
|
-
const width = max(html.scrollWidth, html.clientWidth, body
|
|
1334
|
-
const height = max(html.scrollHeight, html.clientHeight, body
|
|
1223
|
+
const body = element.ownerDocument.body;
|
|
1224
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
1225
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
1335
1226
|
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
1336
1227
|
const y = -scroll.scrollTop;
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
|
1228
|
+
if (getComputedStyle$1(body).direction === 'rtl') {
|
|
1229
|
+
x += max(html.clientWidth, body.clientWidth) - width;
|
|
1340
1230
|
}
|
|
1341
|
-
|
|
1342
1231
|
return {
|
|
1343
1232
|
width,
|
|
1344
1233
|
height,
|
|
@@ -1347,92 +1236,137 @@ function getDocumentRect(element) {
|
|
|
1347
1236
|
};
|
|
1348
1237
|
}
|
|
1349
1238
|
|
|
1239
|
+
function getParentNode(node) {
|
|
1240
|
+
if (getNodeName(node) === 'html') {
|
|
1241
|
+
return node;
|
|
1242
|
+
}
|
|
1243
|
+
const result =
|
|
1244
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
1245
|
+
node.assignedSlot ||
|
|
1246
|
+
// DOM Element detected.
|
|
1247
|
+
node.parentNode ||
|
|
1248
|
+
// ShadowRoot detected.
|
|
1249
|
+
isShadowRoot(node) && node.host ||
|
|
1250
|
+
// Fallback.
|
|
1251
|
+
getDocumentElement(node);
|
|
1252
|
+
return isShadowRoot(result) ? result.host : result;
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1350
1255
|
function getNearestOverflowAncestor(node) {
|
|
1351
1256
|
const parentNode = getParentNode(node);
|
|
1352
|
-
|
|
1353
1257
|
if (isLastTraversableNode(parentNode)) {
|
|
1354
|
-
//
|
|
1355
|
-
|
|
1258
|
+
// `getParentNode` will never return a `Document` due to the fallback
|
|
1259
|
+
// check, so it's either the <html> or <body> element.
|
|
1260
|
+
return parentNode.ownerDocument.body;
|
|
1356
1261
|
}
|
|
1357
|
-
|
|
1358
1262
|
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
1359
1263
|
return parentNode;
|
|
1360
1264
|
}
|
|
1361
|
-
|
|
1362
1265
|
return getNearestOverflowAncestor(parentNode);
|
|
1363
1266
|
}
|
|
1364
1267
|
|
|
1365
1268
|
function getOverflowAncestors(node, list) {
|
|
1366
1269
|
var _node$ownerDocument;
|
|
1367
|
-
|
|
1368
1270
|
if (list === void 0) {
|
|
1369
1271
|
list = [];
|
|
1370
1272
|
}
|
|
1371
|
-
|
|
1372
1273
|
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
1373
1274
|
const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
|
|
1374
1275
|
const win = getWindow(scrollableAncestor);
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1276
|
+
if (isBody) {
|
|
1277
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []);
|
|
1278
|
+
}
|
|
1279
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor));
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
function getViewportRect(element, strategy) {
|
|
1283
|
+
const win = getWindow(element);
|
|
1284
|
+
const html = getDocumentElement(element);
|
|
1285
|
+
const visualViewport = win.visualViewport;
|
|
1286
|
+
let width = html.clientWidth;
|
|
1287
|
+
let height = html.clientHeight;
|
|
1288
|
+
let x = 0;
|
|
1289
|
+
let y = 0;
|
|
1290
|
+
if (visualViewport) {
|
|
1291
|
+
width = visualViewport.width;
|
|
1292
|
+
height = visualViewport.height;
|
|
1293
|
+
const layoutViewport = isLayoutViewport();
|
|
1294
|
+
if (layoutViewport || !layoutViewport && strategy === 'fixed') {
|
|
1295
|
+
x = visualViewport.offsetLeft;
|
|
1296
|
+
y = visualViewport.offsetTop;
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
return {
|
|
1300
|
+
width,
|
|
1301
|
+
height,
|
|
1302
|
+
x,
|
|
1303
|
+
y
|
|
1304
|
+
};
|
|
1379
1305
|
}
|
|
1380
1306
|
|
|
1307
|
+
// Returns the inner client rect, subtracting scrollbars if present.
|
|
1381
1308
|
function getInnerBoundingClientRect(element, strategy) {
|
|
1382
|
-
const clientRect = getBoundingClientRect(element,
|
|
1309
|
+
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
1383
1310
|
const top = clientRect.top + element.clientTop;
|
|
1384
1311
|
const left = clientRect.left + element.clientLeft;
|
|
1312
|
+
const scale = isHTMLElement(element) ? getScale(element) : {
|
|
1313
|
+
x: 1,
|
|
1314
|
+
y: 1
|
|
1315
|
+
};
|
|
1316
|
+
const width = element.clientWidth * scale.x;
|
|
1317
|
+
const height = element.clientHeight * scale.y;
|
|
1318
|
+
const x = left * scale.x;
|
|
1319
|
+
const y = top * scale.y;
|
|
1385
1320
|
return {
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
x
|
|
1389
|
-
y
|
|
1390
|
-
right: left + element.clientWidth,
|
|
1391
|
-
bottom: top + element.clientHeight,
|
|
1392
|
-
width: element.clientWidth,
|
|
1393
|
-
height: element.clientHeight
|
|
1321
|
+
width,
|
|
1322
|
+
height,
|
|
1323
|
+
x,
|
|
1324
|
+
y
|
|
1394
1325
|
};
|
|
1395
1326
|
}
|
|
1396
|
-
|
|
1397
1327
|
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
1398
1328
|
if (clippingAncestor === 'viewport') {
|
|
1399
1329
|
return rectToClientRect(getViewportRect(element, strategy));
|
|
1400
1330
|
}
|
|
1401
|
-
|
|
1402
1331
|
if (isElement(clippingAncestor)) {
|
|
1403
|
-
return getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
1332
|
+
return rectToClientRect(getInnerBoundingClientRect(clippingAncestor, strategy));
|
|
1404
1333
|
}
|
|
1405
|
-
|
|
1406
1334
|
return rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
|
1407
|
-
}
|
|
1408
|
-
// clipping (or hiding) overflowing elements with a position different from
|
|
1409
|
-
// `initial`
|
|
1410
|
-
|
|
1335
|
+
}
|
|
1411
1336
|
|
|
1412
|
-
|
|
1337
|
+
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
1338
|
+
// clipping (or hiding) child elements. This returns all clipping ancestors
|
|
1339
|
+
// of the given element up the tree.
|
|
1340
|
+
function getClippingElementAncestors(element, cache) {
|
|
1341
|
+
const cachedResult = cache.get(element);
|
|
1342
|
+
if (cachedResult) {
|
|
1343
|
+
return cachedResult;
|
|
1344
|
+
}
|
|
1413
1345
|
let result = getOverflowAncestors(element).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
1414
|
-
let
|
|
1415
|
-
|
|
1346
|
+
let currentContainingBlockComputedStyle = null;
|
|
1347
|
+
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
|
1348
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
1416
1349
|
|
|
1350
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
1417
1351
|
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1418
|
-
const computedStyle = getComputedStyle(currentNode);
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1352
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
1353
|
+
const containingBlock = isContainingBlock(currentNode);
|
|
1354
|
+
const shouldDropCurrentNode = elementIsFixed ? !containingBlock && !currentContainingBlockComputedStyle : !containingBlock && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position);
|
|
1355
|
+
if (shouldDropCurrentNode) {
|
|
1356
|
+
// Drop non-containing blocks.
|
|
1422
1357
|
result = result.filter(ancestor => ancestor !== currentNode);
|
|
1423
1358
|
} else {
|
|
1424
|
-
// Record last containing block for next iteration
|
|
1359
|
+
// Record last containing block for next iteration.
|
|
1425
1360
|
currentContainingBlockComputedStyle = computedStyle;
|
|
1426
1361
|
}
|
|
1427
|
-
|
|
1428
1362
|
currentNode = getParentNode(currentNode);
|
|
1429
1363
|
}
|
|
1430
|
-
|
|
1364
|
+
cache.set(element, result);
|
|
1431
1365
|
return result;
|
|
1432
|
-
}
|
|
1433
|
-
// clipping ancestors
|
|
1434
|
-
|
|
1366
|
+
}
|
|
1435
1367
|
|
|
1368
|
+
// Gets the maximum area that the element is visible in due to any number of
|
|
1369
|
+
// clipping ancestors.
|
|
1436
1370
|
function getClippingRect(_ref) {
|
|
1437
1371
|
let {
|
|
1438
1372
|
element,
|
|
@@ -1440,7 +1374,7 @@ function getClippingRect(_ref) {
|
|
|
1440
1374
|
rootBoundary,
|
|
1441
1375
|
strategy
|
|
1442
1376
|
} = _ref;
|
|
1443
|
-
const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element) : [].concat(boundary);
|
|
1377
|
+
const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
1444
1378
|
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
1445
1379
|
const firstClippingAncestor = clippingAncestors[0];
|
|
1446
1380
|
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
@@ -1459,6 +1393,77 @@ function getClippingRect(_ref) {
|
|
|
1459
1393
|
};
|
|
1460
1394
|
}
|
|
1461
1395
|
|
|
1396
|
+
function getDimensions(element) {
|
|
1397
|
+
if (isHTMLElement(element)) {
|
|
1398
|
+
return getCssDimensions(element);
|
|
1399
|
+
}
|
|
1400
|
+
return element.getBoundingClientRect();
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
function getTrueOffsetParent(element) {
|
|
1404
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
1405
|
+
return null;
|
|
1406
|
+
}
|
|
1407
|
+
return element.offsetParent;
|
|
1408
|
+
}
|
|
1409
|
+
function getContainingBlock(element) {
|
|
1410
|
+
let currentNode = getParentNode(element);
|
|
1411
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1412
|
+
if (isContainingBlock(currentNode)) {
|
|
1413
|
+
return currentNode;
|
|
1414
|
+
} else {
|
|
1415
|
+
currentNode = getParentNode(currentNode);
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
return null;
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
1422
|
+
// such as table ancestors and cross browser bugs.
|
|
1423
|
+
function getOffsetParent(element) {
|
|
1424
|
+
const window = getWindow(element);
|
|
1425
|
+
let offsetParent = getTrueOffsetParent(element);
|
|
1426
|
+
while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
|
|
1427
|
+
offsetParent = getTrueOffsetParent(offsetParent);
|
|
1428
|
+
}
|
|
1429
|
+
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
|
|
1430
|
+
return window;
|
|
1431
|
+
}
|
|
1432
|
+
return offsetParent || getContainingBlock(element) || window;
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
1436
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1437
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
1438
|
+
const rect = getBoundingClientRect(element, true, strategy === 'fixed', offsetParent);
|
|
1439
|
+
let scroll = {
|
|
1440
|
+
scrollLeft: 0,
|
|
1441
|
+
scrollTop: 0
|
|
1442
|
+
};
|
|
1443
|
+
const offsets = {
|
|
1444
|
+
x: 0,
|
|
1445
|
+
y: 0
|
|
1446
|
+
};
|
|
1447
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
|
|
1448
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
1449
|
+
scroll = getNodeScroll(offsetParent);
|
|
1450
|
+
}
|
|
1451
|
+
if (isHTMLElement(offsetParent)) {
|
|
1452
|
+
const offsetRect = getBoundingClientRect(offsetParent, true);
|
|
1453
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1454
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1455
|
+
} else if (documentElement) {
|
|
1456
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
return {
|
|
1460
|
+
x: rect.left + scroll.scrollLeft - offsets.x,
|
|
1461
|
+
y: rect.top + scroll.scrollTop - offsets.y,
|
|
1462
|
+
width: rect.width,
|
|
1463
|
+
height: rect.height
|
|
1464
|
+
};
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1462
1467
|
const platform = {
|
|
1463
1468
|
getClippingRect,
|
|
1464
1469
|
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
@@ -1466,22 +1471,26 @@ const platform = {
|
|
|
1466
1471
|
getDimensions,
|
|
1467
1472
|
getOffsetParent,
|
|
1468
1473
|
getDocumentElement,
|
|
1469
|
-
|
|
1474
|
+
getScale,
|
|
1475
|
+
async getElementRects(_ref) {
|
|
1470
1476
|
let {
|
|
1471
1477
|
reference,
|
|
1472
1478
|
floating,
|
|
1473
1479
|
strategy
|
|
1474
1480
|
} = _ref;
|
|
1481
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
1482
|
+
const getDimensionsFn = this.getDimensions;
|
|
1475
1483
|
return {
|
|
1476
|
-
reference: getRectRelativeToOffsetParent(reference,
|
|
1477
|
-
floating: {
|
|
1484
|
+
reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
|
|
1485
|
+
floating: {
|
|
1478
1486
|
x: 0,
|
|
1479
|
-
y: 0
|
|
1487
|
+
y: 0,
|
|
1488
|
+
...(await getDimensionsFn(floating))
|
|
1480
1489
|
}
|
|
1481
1490
|
};
|
|
1482
1491
|
},
|
|
1483
1492
|
getClientRects: element => Array.from(element.getClientRects()),
|
|
1484
|
-
isRTL: element => getComputedStyle(element).direction === 'rtl'
|
|
1493
|
+
isRTL: element => getComputedStyle$1(element).direction === 'rtl'
|
|
1485
1494
|
};
|
|
1486
1495
|
|
|
1487
1496
|
/**
|
|
@@ -1489,11 +1498,24 @@ const platform = {
|
|
|
1489
1498
|
* next to a reference element when it is given a certain CSS positioning
|
|
1490
1499
|
* strategy.
|
|
1491
1500
|
*/
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1501
|
+
const computePosition = (reference, floating, options) => {
|
|
1502
|
+
// This caches the expensive `getClippingElementAncestors` function so that
|
|
1503
|
+
// multiple lifecycle resets re-use the same result. It only lives for a
|
|
1504
|
+
// single call. If other functions become expensive, we can add them as well.
|
|
1505
|
+
const cache = new Map();
|
|
1506
|
+
const mergedOptions = {
|
|
1507
|
+
platform,
|
|
1508
|
+
...options
|
|
1509
|
+
};
|
|
1510
|
+
const platformWithCache = {
|
|
1511
|
+
...mergedOptions.platform,
|
|
1512
|
+
_c: cache
|
|
1513
|
+
};
|
|
1514
|
+
return computePosition$1(reference, floating, {
|
|
1515
|
+
...mergedOptions,
|
|
1516
|
+
platform: platformWithCache
|
|
1517
|
+
});
|
|
1518
|
+
};
|
|
1497
1519
|
|
|
1498
1520
|
var jsxRuntime = {exports: {}};
|
|
1499
1521
|
|
|
@@ -2644,7 +2666,7 @@ var styles = {"tooltip":"styles-module_tooltip__mnnfp","fixed":"styles-module_fi
|
|
|
2644
2666
|
|
|
2645
2667
|
const Tooltip = ({
|
|
2646
2668
|
// props
|
|
2647
|
-
id, className, classNameArrow, variant = 'dark', anchorId, place = 'top', offset = 10, events = ['hover'], positionStrategy = 'absolute', middlewares, wrapper: WrapperElement
|
|
2669
|
+
id, className, classNameArrow, variant = 'dark', anchorId, place = 'top', offset = 10, events = ['hover'], positionStrategy = 'absolute', middlewares, wrapper: WrapperElement, children = null, delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, closeOnEsc = false, style: externalStyles, position, afterShow, afterHide,
|
|
2648
2670
|
// props handled by controller
|
|
2649
2671
|
content, html, isOpen, setIsOpen, }) => {
|
|
2650
2672
|
const tooltipRef = require$$0.useRef(null);
|
|
@@ -3016,7 +3038,7 @@ const TooltipController = ({ id, anchorId, content, html, className, classNameAr
|
|
|
3016
3038
|
},
|
|
3017
3039
|
wrapper: (value) => {
|
|
3018
3040
|
var _a;
|
|
3019
|
-
setTooltipWrapper((_a = value) !== null && _a !== void 0 ? _a :
|
|
3041
|
+
setTooltipWrapper((_a = value) !== null && _a !== void 0 ? _a : wrapper);
|
|
3020
3042
|
},
|
|
3021
3043
|
events: (value) => {
|
|
3022
3044
|
const parsed = value === null || value === void 0 ? void 0 : value.split(' ');
|