react-tooltip 5.8.4-beta.2 → 5.9.1-beta.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 +12 -3
- package/dist/react-tooltip.cjs.js +115 -90
- package/dist/react-tooltip.cjs.js.map +3 -3
- package/dist/react-tooltip.cjs.min.js +1 -1
- package/dist/react-tooltip.cjs.min.js.map +3 -3
- package/dist/react-tooltip.esm.js +115 -90
- package/dist/react-tooltip.esm.js.map +3 -3
- package/dist/react-tooltip.esm.min.js +1 -1
- package/dist/react-tooltip.esm.min.js.map +3 -3
- package/dist/react-tooltip.iife.js +115 -90
- package/dist/react-tooltip.iife.js.map +3 -3
- package/dist/react-tooltip.iife.min.js +1 -1
- package/dist/react-tooltip.iife.min.js.map +3 -3
- package/dist/react-tooltip.min.js +11 -0
- package/dist/react-tooltip.min.js.map +7 -0
- package/esbuild.config.dev.mjs +2 -4
- package/esbuild.config.prod.mjs +28 -23
- package/package.json +25 -39
- package/{cli.js → prebuild.js} +5 -2
- package/dist/react-tooltip.min.css +0 -2
- package/dist/react-tooltip.min.css.map +0 -7
package/README.md
CHANGED
|
@@ -27,10 +27,19 @@ Documentation for V4 - [Github Page](https://reacttooltip.github.io/react-toolti
|
|
|
27
27
|
|
|
28
28
|
Documentation for V5 - [ReactTooltip](https://react-tooltip.com/docs/getting-started).
|
|
29
29
|
|
|
30
|
-
[Bundle size
|
|
31
|
-
|
|
32
|
-
[](https://bundlephobia.com/package/react-tooltip@5.0.0)
|
|
30
|
+
## [Bundle size comparison V4 -> V5](https://bundlephobia.com/package/react-tooltip)
|
|
33
31
|
|
|
32
|
+
<p align="center">
|
|
33
|
+
<a href="https://bundlephobia.com/package/react-tooltip@4.5.1">
|
|
34
|
+
<img alt="Bundlephobia v4.5.1" style="height: 250px" src="https://user-images.githubusercontent.com/21102974/222977995-a5ae7c12-e945-454e-ad96-5c73b76a88a0.png" />
|
|
35
|
+
</a>
|
|
36
|
+
<a href="https://bundlephobia.com/package/react-tooltip@5.9.0">
|
|
37
|
+
<img alt="Bundlephobia v5.9.0" style="height: 250px" src="https://user-images.githubusercontent.com/21102974/222977970-8574434d-77de-4aa3-b8ad-a2b8924d75a4.png" />
|
|
38
|
+
</a>
|
|
39
|
+
<a href="https://bundlephobia.com/package/react-tooltip@4.5.1">
|
|
40
|
+
<img alt="Bundlezise timeline" style="height: 250px" src="https://user-images.githubusercontent.com/21102974/222978188-f6db8679-da69-4da7-9c0d-b6fde8bd9517.png" />
|
|
41
|
+
</a>
|
|
42
|
+
</p>
|
|
34
43
|
|
|
35
44
|
## Installation
|
|
36
45
|
|
|
@@ -267,7 +267,7 @@ function o(t2) {
|
|
|
267
267
|
}
|
|
268
268
|
function i(i3, r3, a3) {
|
|
269
269
|
let { reference: l3, floating: s3 } = i3;
|
|
270
|
-
const c3 = l3.x + l3.width / 2 - s3.width / 2, f3 = l3.y + l3.height / 2 - s3.height / 2,
|
|
270
|
+
const c3 = l3.x + l3.width / 2 - s3.width / 2, f3 = l3.y + l3.height / 2 - s3.height / 2, m3 = o(r3), u3 = e(m3), g3 = l3[u3] / 2 - s3[u3] / 2, d3 = "x" === m3;
|
|
271
271
|
let p3;
|
|
272
272
|
switch (n(r3)) {
|
|
273
273
|
case "top":
|
|
@@ -287,21 +287,21 @@ function i(i3, r3, a3) {
|
|
|
287
287
|
}
|
|
288
288
|
switch (t(r3)) {
|
|
289
289
|
case "start":
|
|
290
|
-
p3[
|
|
290
|
+
p3[m3] -= g3 * (a3 && d3 ? -1 : 1);
|
|
291
291
|
break;
|
|
292
292
|
case "end":
|
|
293
|
-
p3[
|
|
293
|
+
p3[m3] += g3 * (a3 && d3 ? -1 : 1);
|
|
294
294
|
}
|
|
295
295
|
return p3;
|
|
296
296
|
}
|
|
297
297
|
var r = async (t2, e2, n3) => {
|
|
298
298
|
const { placement: o3 = "bottom", strategy: r3 = "absolute", middleware: a3 = [], platform: l3 } = n3, s3 = a3.filter(Boolean), c3 = await (null == l3.isRTL ? void 0 : l3.isRTL(e2));
|
|
299
|
-
let f3 = await l3.getElementRects({ reference: t2, floating: e2, strategy: r3 }), { x:
|
|
299
|
+
let f3 = await l3.getElementRects({ reference: t2, floating: e2, strategy: r3 }), { x: m3, y: u3 } = i(f3, o3, c3), g3 = o3, d3 = {}, p3 = 0;
|
|
300
300
|
for (let n4 = 0; n4 < s3.length; n4++) {
|
|
301
|
-
const { name: a4, fn: h3 } = s3[n4], { x: y3, y: x3, data: w3, reset: v3 } = await h3({ x:
|
|
302
|
-
|
|
301
|
+
const { name: a4, fn: h3 } = s3[n4], { x: y3, y: x3, data: w3, reset: v3 } = await h3({ x: m3, y: u3, initialPlacement: o3, placement: g3, strategy: r3, middlewareData: d3, rects: f3, platform: l3, elements: { reference: t2, floating: e2 } });
|
|
302
|
+
m3 = null != y3 ? y3 : m3, u3 = null != x3 ? x3 : u3, d3 = { ...d3, [a4]: { ...d3[a4], ...w3 } }, v3 && p3 <= 50 && (p3++, "object" == typeof v3 && (v3.placement && (g3 = v3.placement), v3.rects && (f3 = true === v3.rects ? await l3.getElementRects({ reference: t2, floating: e2, strategy: r3 }) : v3.rects), { x: m3, y: u3 } = i(f3, g3, c3)), n4 = -1);
|
|
303
303
|
}
|
|
304
|
-
return { x:
|
|
304
|
+
return { x: m3, y: u3, placement: g3, strategy: r3, middlewareData: d3 };
|
|
305
305
|
};
|
|
306
306
|
function a(t2) {
|
|
307
307
|
return "number" != typeof t2 ? function(t3) {
|
|
@@ -314,23 +314,23 @@ function l(t2) {
|
|
|
314
314
|
async function s(t2, e2) {
|
|
315
315
|
var n3;
|
|
316
316
|
void 0 === e2 && (e2 = {});
|
|
317
|
-
const { x: o3, y: i3, platform: r3, rects: s3, elements: c3, strategy: f3 } = t2, { boundary:
|
|
317
|
+
const { x: o3, y: i3, platform: r3, rects: s3, elements: c3, strategy: f3 } = t2, { boundary: m3 = "clippingAncestors", rootBoundary: u3 = "viewport", elementContext: g3 = "floating", altBoundary: d3 = false, padding: p3 = 0 } = e2, h3 = a(p3), y3 = c3[d3 ? "floating" === g3 ? "reference" : "floating" : g3], x3 = l(await r3.getClippingRect({ element: null == (n3 = await (null == r3.isElement ? void 0 : r3.isElement(y3))) || n3 ? y3 : y3.contextElement || await (null == r3.getDocumentElement ? void 0 : r3.getDocumentElement(c3.floating)), boundary: m3, rootBoundary: u3, strategy: f3 })), w3 = "floating" === g3 ? { ...s3.floating, x: o3, y: i3 } : s3.reference, v3 = await (null == r3.getOffsetParent ? void 0 : r3.getOffsetParent(c3.floating)), b3 = await (null == r3.isElement ? void 0 : r3.isElement(v3)) && await (null == r3.getScale ? void 0 : r3.getScale(v3)) || { x: 1, y: 1 }, R2 = l(r3.convertOffsetParentRelativeRectToViewportRelativeRect ? await r3.convertOffsetParentRelativeRectToViewportRelativeRect({ rect: w3, offsetParent: v3, strategy: f3 }) : w3);
|
|
318
318
|
return { top: (x3.top - R2.top + h3.top) / b3.y, bottom: (R2.bottom - x3.bottom + h3.bottom) / b3.y, left: (x3.left - R2.left + h3.left) / b3.x, right: (R2.right - x3.right + h3.right) / b3.x };
|
|
319
319
|
}
|
|
320
320
|
var c = Math.min;
|
|
321
321
|
var f = Math.max;
|
|
322
|
-
function
|
|
322
|
+
function m(t2, e2, n3) {
|
|
323
323
|
return f(t2, c(e2, n3));
|
|
324
324
|
}
|
|
325
|
-
var
|
|
326
|
-
const { element: r3, padding: l3 = 0 } = n3 || {}, { x: s3, y: c3, placement: f3, rects:
|
|
325
|
+
var u = (n3) => ({ name: "arrow", options: n3, async fn(i3) {
|
|
326
|
+
const { element: r3, padding: l3 = 0 } = n3 || {}, { x: s3, y: c3, placement: f3, rects: u3, platform: g3, elements: d3 } = i3;
|
|
327
327
|
if (null == r3)
|
|
328
328
|
return {};
|
|
329
|
-
const
|
|
330
|
-
let
|
|
331
|
-
0
|
|
332
|
-
const
|
|
333
|
-
return { [
|
|
329
|
+
const p3 = a(l3), h3 = { x: s3, y: c3 }, y3 = o(f3), x3 = e(y3), w3 = await g3.getDimensions(r3), v3 = "y" === y3, b3 = v3 ? "top" : "left", R2 = v3 ? "bottom" : "right", A2 = v3 ? "clientHeight" : "clientWidth", P2 = u3.reference[x3] + u3.reference[y3] - h3[y3] - u3.floating[x3], T3 = h3[y3] - u3.reference[y3], O3 = await (null == g3.getOffsetParent ? void 0 : g3.getOffsetParent(r3));
|
|
330
|
+
let E3 = O3 ? O3[A2] : 0;
|
|
331
|
+
E3 && await (null == g3.isElement ? void 0 : g3.isElement(O3)) || (E3 = d3.floating[A2] || u3.floating[x3]);
|
|
332
|
+
const D3 = P2 / 2 - T3 / 2, L3 = p3[b3], k2 = E3 - w3[x3] - p3[R2], B = E3 / 2 - w3[x3] / 2 + D3, C2 = m(L3, B, k2), H2 = null != t(f3) && B != C2 && u3.reference[x3] / 2 - (B < L3 ? p3[b3] : p3[R2]) - w3[x3] / 2 < 0;
|
|
333
|
+
return { [y3]: h3[y3] - (H2 ? B < L3 ? L3 - B : k2 - B : 0), data: { [y3]: C2, centerOffset: B - C2 } };
|
|
334
334
|
} });
|
|
335
335
|
var g = ["top", "right", "bottom", "left"];
|
|
336
336
|
var d = g.reduce((t2, e2) => t2.concat(e2, e2 + "-start", e2 + "-end"), []);
|
|
@@ -351,7 +351,7 @@ function w(t2) {
|
|
|
351
351
|
var b = function(e2) {
|
|
352
352
|
return void 0 === e2 && (e2 = {}), { name: "flip", options: e2, async fn(o3) {
|
|
353
353
|
var i3;
|
|
354
|
-
const { placement: r3, middlewareData: a3, rects: l3, initialPlacement: c3, platform: f3, elements:
|
|
354
|
+
const { placement: r3, middlewareData: a3, rects: l3, initialPlacement: c3, platform: f3, elements: m3 } = o3, { mainAxis: u3 = true, crossAxis: g3 = true, fallbackPlacements: d3, fallbackStrategy: p3 = "bestFit", fallbackAxisSideDirection: x3 = "none", flipAlignment: v3 = true, ...b3 } = e2, R2 = n(r3), A2 = n(c3) === c3, P2 = await (null == f3.isRTL ? void 0 : f3.isRTL(m3.floating)), T3 = d3 || (A2 || !v3 ? [h(c3)] : function(t2) {
|
|
355
355
|
const e3 = h(t2);
|
|
356
356
|
return [w(t2), e3, w(e3)];
|
|
357
357
|
}(c3));
|
|
@@ -371,19 +371,19 @@ var b = function(e2) {
|
|
|
371
371
|
}
|
|
372
372
|
}(n(e3), "start" === i4, r4);
|
|
373
373
|
return a4 && (l4 = l4.map((t2) => t2 + "-" + a4), o4 && (l4 = l4.concat(l4.map(w)))), l4;
|
|
374
|
-
}(c3, v3, x3,
|
|
375
|
-
const O3 = [c3, ...T3],
|
|
374
|
+
}(c3, v3, x3, P2));
|
|
375
|
+
const O3 = [c3, ...T3], E3 = await s(o3, b3), D3 = [];
|
|
376
376
|
let L3 = (null == (i3 = a3.flip) ? void 0 : i3.overflows) || [];
|
|
377
|
-
if (
|
|
378
|
-
const { main: t2, cross: e3 } = y(r3, l3,
|
|
379
|
-
|
|
377
|
+
if (u3 && D3.push(E3[R2]), g3) {
|
|
378
|
+
const { main: t2, cross: e3 } = y(r3, l3, P2);
|
|
379
|
+
D3.push(E3[t2], E3[e3]);
|
|
380
380
|
}
|
|
381
|
-
if (L3 = [...L3, { placement: r3, overflows:
|
|
382
|
-
var k2,
|
|
381
|
+
if (L3 = [...L3, { placement: r3, overflows: D3 }], !D3.every((t2) => t2 <= 0)) {
|
|
382
|
+
var k2, B;
|
|
383
383
|
const t2 = ((null == (k2 = a3.flip) ? void 0 : k2.index) || 0) + 1, e3 = O3[t2];
|
|
384
384
|
if (e3)
|
|
385
385
|
return { data: { index: t2, overflows: L3 }, reset: { placement: e3 } };
|
|
386
|
-
let n3 = null == (
|
|
386
|
+
let n3 = null == (B = L3.filter((t3) => t3.overflows[0] <= 0).sort((t3, e4) => t3.overflows[1] - e4.overflows[1])[0]) ? void 0 : B.placement;
|
|
387
387
|
if (!n3)
|
|
388
388
|
switch (p3) {
|
|
389
389
|
case "bestFit": {
|
|
@@ -404,30 +404,30 @@ var b = function(e2) {
|
|
|
404
404
|
var O = function(e2) {
|
|
405
405
|
return void 0 === e2 && (e2 = 0), { name: "offset", options: e2, async fn(i3) {
|
|
406
406
|
const { x: r3, y: a3 } = i3, l3 = await async function(e3, i4) {
|
|
407
|
-
const { placement: r4, platform: a4, elements: l4 } = e3, s3 = await (null == a4.isRTL ? void 0 : a4.isRTL(l4.floating)), c3 = n(r4), f3 = t(r4),
|
|
407
|
+
const { placement: r4, platform: a4, elements: l4 } = e3, s3 = await (null == a4.isRTL ? void 0 : a4.isRTL(l4.floating)), c3 = n(r4), f3 = t(r4), m3 = "x" === o(r4), u3 = ["left", "top"].includes(c3) ? -1 : 1, g3 = s3 && m3 ? -1 : 1, d3 = "function" == typeof i4 ? i4(e3) : i4;
|
|
408
408
|
let { mainAxis: p3, crossAxis: h3, alignmentAxis: y3 } = "number" == typeof d3 ? { mainAxis: d3, crossAxis: 0, alignmentAxis: null } : { mainAxis: 0, crossAxis: 0, alignmentAxis: null, ...d3 };
|
|
409
|
-
return f3 && "number" == typeof y3 && (h3 = "end" === f3 ? -1 * y3 : y3),
|
|
409
|
+
return f3 && "number" == typeof y3 && (h3 = "end" === f3 ? -1 * y3 : y3), m3 ? { x: h3 * g3, y: p3 * u3 } : { x: p3 * u3, y: h3 * g3 };
|
|
410
410
|
}(i3, e2);
|
|
411
411
|
return { x: r3 + l3.x, y: a3 + l3.y, data: l3 };
|
|
412
412
|
} };
|
|
413
413
|
};
|
|
414
|
-
function
|
|
414
|
+
function E(t2) {
|
|
415
415
|
return "x" === t2 ? "y" : "x";
|
|
416
416
|
}
|
|
417
|
-
var
|
|
417
|
+
var D = function(t2) {
|
|
418
418
|
return void 0 === t2 && (t2 = {}), { name: "shift", options: t2, async fn(e2) {
|
|
419
419
|
const { x: i3, y: r3, placement: a3 } = e2, { mainAxis: l3 = true, crossAxis: c3 = false, limiter: f3 = { fn: (t3) => {
|
|
420
420
|
let { x: e3, y: n3 } = t3;
|
|
421
421
|
return { x: e3, y: n3 };
|
|
422
|
-
} }, ...
|
|
422
|
+
} }, ...u3 } = t2, g3 = { x: i3, y: r3 }, d3 = await s(e2, u3), p3 = o(n(a3)), h3 = E(p3);
|
|
423
423
|
let y3 = g3[p3], x3 = g3[h3];
|
|
424
424
|
if (l3) {
|
|
425
425
|
const t3 = "y" === p3 ? "bottom" : "right";
|
|
426
|
-
y3 =
|
|
426
|
+
y3 = m(y3 + d3["y" === p3 ? "top" : "left"], y3, y3 - d3[t3]);
|
|
427
427
|
}
|
|
428
428
|
if (c3) {
|
|
429
429
|
const t3 = "y" === h3 ? "bottom" : "right";
|
|
430
|
-
x3 =
|
|
430
|
+
x3 = m(x3 + d3["y" === h3 ? "top" : "left"], x3, x3 - d3[t3]);
|
|
431
431
|
}
|
|
432
432
|
const w3 = f3.fn({ ...e2, [p3]: y3, [h3]: x3 });
|
|
433
433
|
return { ...w3, data: { x: w3.x - i3, y: w3.y - r3 } };
|
|
@@ -490,7 +490,7 @@ function y2(t2) {
|
|
|
490
490
|
});
|
|
491
491
|
}
|
|
492
492
|
function x2() {
|
|
493
|
-
return
|
|
493
|
+
return /^((?!chrome|android).)*safari/i.test(u2());
|
|
494
494
|
}
|
|
495
495
|
function w2(t2) {
|
|
496
496
|
return ["html", "body", "#document"].includes(s2(t2));
|
|
@@ -507,23 +507,23 @@ function L2(t2) {
|
|
|
507
507
|
let s3 = (r3 ? l2(n3.width) : n3.width) / o3, f3 = (r3 ? l2(n3.height) : n3.height) / i3;
|
|
508
508
|
return s3 && Number.isFinite(s3) || (s3 = 1), f3 && Number.isFinite(f3) || (f3 = 1), { x: s3, y: f3 };
|
|
509
509
|
}
|
|
510
|
-
function E2(
|
|
511
|
-
var
|
|
512
|
-
void 0 ===
|
|
513
|
-
const
|
|
514
|
-
let
|
|
515
|
-
|
|
516
|
-
const
|
|
517
|
-
let
|
|
518
|
-
if (
|
|
519
|
-
const
|
|
520
|
-
let o4 =
|
|
521
|
-
for (; o4 &&
|
|
522
|
-
const
|
|
523
|
-
e4.x += (o4.clientLeft + parseFloat(i4.paddingLeft)) *
|
|
510
|
+
function E2(e2, o3, i3, r3) {
|
|
511
|
+
var l3, c3;
|
|
512
|
+
void 0 === o3 && (o3 = false), void 0 === i3 && (i3 = false);
|
|
513
|
+
const s3 = e2.getBoundingClientRect(), f3 = v2(e2);
|
|
514
|
+
let u3 = b2;
|
|
515
|
+
o3 && (r3 ? d2(r3) && (u3 = L2(r3)) : u3 = L2(e2));
|
|
516
|
+
const a3 = f3 ? n2(f3) : window, h3 = x2() && i3;
|
|
517
|
+
let p3 = (s3.left + (h3 && (null == (l3 = a3.visualViewport) ? void 0 : l3.offsetLeft) || 0)) / u3.x, g3 = (s3.top + (h3 && (null == (c3 = a3.visualViewport) ? void 0 : c3.offsetTop) || 0)) / u3.y, m3 = s3.width / u3.x, y3 = s3.height / u3.y;
|
|
518
|
+
if (f3) {
|
|
519
|
+
const t2 = n2(f3), e3 = r3 && d2(r3) ? n2(r3) : r3;
|
|
520
|
+
let o4 = t2.frameElement;
|
|
521
|
+
for (; o4 && r3 && e3 !== t2; ) {
|
|
522
|
+
const t3 = L2(o4), e4 = o4.getBoundingClientRect(), i4 = getComputedStyle(o4);
|
|
523
|
+
e4.x += (o4.clientLeft + parseFloat(i4.paddingLeft)) * t3.x, e4.y += (o4.clientTop + parseFloat(i4.paddingTop)) * t3.y, p3 *= t3.x, g3 *= t3.y, m3 *= t3.x, y3 *= t3.y, p3 += e4.x, g3 += e4.y, o4 = n2(o4).frameElement;
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
|
-
return { width:
|
|
526
|
+
return l({ width: m3, height: y3, x: p3, y: g3 });
|
|
527
527
|
}
|
|
528
528
|
function R(t2) {
|
|
529
529
|
return ((h2(t2) ? t2.ownerDocument : t2.document) || window.document).documentElement;
|
|
@@ -551,34 +551,52 @@ function D2(t2, e2) {
|
|
|
551
551
|
return r3 ? e2.concat(l3, l3.visualViewport || [], g2(i3) ? i3 : []) : e2.concat(i3, D2(i3));
|
|
552
552
|
}
|
|
553
553
|
function S(e2, i3, l3) {
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
l4 =
|
|
559
|
-
|
|
560
|
-
|
|
554
|
+
let c3;
|
|
555
|
+
if ("viewport" === i3)
|
|
556
|
+
c3 = function(t2, e3) {
|
|
557
|
+
const o3 = n2(t2), i4 = R(t2), r3 = o3.visualViewport;
|
|
558
|
+
let l4 = i4.clientWidth, c4 = i4.clientHeight, s4 = 0, f4 = 0;
|
|
559
|
+
if (r3) {
|
|
560
|
+
l4 = r3.width, c4 = r3.height;
|
|
561
|
+
const t3 = x2();
|
|
562
|
+
(!t3 || t3 && "fixed" === e3) && (s4 = r3.offsetLeft, f4 = r3.offsetTop);
|
|
563
|
+
}
|
|
564
|
+
return { width: l4, height: c4, x: s4, y: f4 };
|
|
565
|
+
}(e2, l3);
|
|
566
|
+
else if ("document" === i3)
|
|
567
|
+
c3 = function(t2) {
|
|
568
|
+
const e3 = R(t2), n3 = T2(t2), i4 = t2.ownerDocument.body, l4 = r2(e3.scrollWidth, e3.clientWidth, i4.scrollWidth, i4.clientWidth), c4 = r2(e3.scrollHeight, e3.clientHeight, i4.scrollHeight, i4.clientHeight);
|
|
569
|
+
let s4 = -n3.scrollLeft + C(t2);
|
|
570
|
+
const f4 = -n3.scrollTop;
|
|
571
|
+
return "rtl" === o2(i4).direction && (s4 += r2(e3.clientWidth, i4.clientWidth) - l4), { width: l4, height: c4, x: s4, y: f4 };
|
|
572
|
+
}(R(e2));
|
|
573
|
+
else if (d2(i3))
|
|
574
|
+
c3 = function(t2, e3) {
|
|
575
|
+
const n3 = E2(t2, true, "fixed" === e3), o3 = n3.top + t2.clientTop, i4 = n3.left + t2.clientLeft, r3 = a2(t2) ? L2(t2) : { x: 1, y: 1 };
|
|
576
|
+
return { width: t2.clientWidth * r3.x, height: t2.clientHeight * r3.y, x: i4 * r3.x, y: o3 * r3.y };
|
|
577
|
+
}(i3, l3);
|
|
578
|
+
else {
|
|
579
|
+
const t2 = { ...i3 };
|
|
580
|
+
if (x2()) {
|
|
581
|
+
var s3, f3;
|
|
582
|
+
const o3 = n2(e2);
|
|
583
|
+
t2.x -= (null == (s3 = o3.visualViewport) ? void 0 : s3.offsetLeft) || 0, t2.y -= (null == (f3 = o3.visualViewport) ? void 0 : f3.offsetTop) || 0;
|
|
561
584
|
}
|
|
562
|
-
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
return { width: t2.clientWidth * r3.x, height: t2.clientHeight * r3.y, x: i4 * r3.x, y: o3 * r3.y };
|
|
566
|
-
}(i3, l3)) : l(function(t2) {
|
|
567
|
-
const e3 = R(t2), n3 = T2(t2), i4 = t2.ownerDocument.body, l4 = r2(e3.scrollWidth, e3.clientWidth, i4.scrollWidth, i4.clientWidth), c3 = r2(e3.scrollHeight, e3.clientHeight, i4.scrollHeight, i4.clientHeight);
|
|
568
|
-
let s3 = -n3.scrollLeft + C(t2);
|
|
569
|
-
const f3 = -n3.scrollTop;
|
|
570
|
-
return "rtl" === o2(i4).direction && (s3 += r2(e3.clientWidth, i4.clientWidth) - l4), { width: l4, height: c3, x: s3, y: f3 };
|
|
571
|
-
}(R(e2)));
|
|
585
|
+
c3 = t2;
|
|
586
|
+
}
|
|
587
|
+
return l(c3);
|
|
572
588
|
}
|
|
573
|
-
function A(t2) {
|
|
574
|
-
return a2(t2) && "fixed" !== o2(t2).position ? t2.offsetParent : null;
|
|
589
|
+
function A(t2, e2) {
|
|
590
|
+
return a2(t2) && "fixed" !== o2(t2).position ? e2 ? e2(t2) : t2.offsetParent : null;
|
|
575
591
|
}
|
|
576
|
-
function H(t2) {
|
|
577
|
-
const
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
592
|
+
function H(t2, e2) {
|
|
593
|
+
const i3 = n2(t2);
|
|
594
|
+
if (!a2(t2))
|
|
595
|
+
return i3;
|
|
596
|
+
let r3 = A(t2, e2);
|
|
597
|
+
for (; r3 && m2(r3) && "static" === o2(r3).position; )
|
|
598
|
+
r3 = A(r3, e2);
|
|
599
|
+
return r3 && ("html" === s2(r3) || "body" === s2(r3) && "static" === o2(r3).position && !y2(r3)) ? i3 : r3 || function(t3) {
|
|
582
600
|
let e3 = F(t3);
|
|
583
601
|
for (; a2(e3) && !w2(e3); ) {
|
|
584
602
|
if (y2(e3))
|
|
@@ -586,9 +604,9 @@ function H(t2) {
|
|
|
586
604
|
e3 = F(e3);
|
|
587
605
|
}
|
|
588
606
|
return null;
|
|
589
|
-
}(t2) ||
|
|
607
|
+
}(t2) || i3;
|
|
590
608
|
}
|
|
591
|
-
function
|
|
609
|
+
function V(t2, e2, n3) {
|
|
592
610
|
const o3 = a2(e2), i3 = R(e2), r3 = E2(t2, true, "fixed" === n3, e2);
|
|
593
611
|
let l3 = { scrollLeft: 0, scrollTop: 0 };
|
|
594
612
|
const c3 = { x: 0, y: 0 };
|
|
@@ -600,7 +618,7 @@ function O2(t2, e2, n3) {
|
|
|
600
618
|
i3 && (c3.x = C(i3));
|
|
601
619
|
return { x: r3.left + l3.scrollLeft - c3.x, y: r3.top + l3.scrollTop - c3.y, width: r3.width, height: r3.height };
|
|
602
620
|
}
|
|
603
|
-
var
|
|
621
|
+
var O2 = { getClippingRect: function(t2) {
|
|
604
622
|
let { element: e2, boundary: n3, rootBoundary: l3, strategy: c3 } = t2;
|
|
605
623
|
const f3 = "clippingAncestors" === n3 ? function(t3, e3) {
|
|
606
624
|
const n4 = e3.get(t3);
|
|
@@ -611,7 +629,7 @@ var P2 = { getClippingRect: function(t2) {
|
|
|
611
629
|
let c4 = l4 ? F(t3) : t3;
|
|
612
630
|
for (; d2(c4) && !w2(c4); ) {
|
|
613
631
|
const t4 = o2(c4), e4 = y2(c4);
|
|
614
|
-
(l4 ? e4 || r3 : e4 || "static" !== t4.position || !r3 || !["absolute", "fixed"].includes(r3.position)) ? r3 = t4 : i3 = i3.filter((t5) => t5 !== c4), c4 = F(c4);
|
|
632
|
+
"fixed" === t4.position ? r3 = null : (l4 ? e4 || r3 : e4 || "static" !== t4.position || !r3 || !["absolute", "fixed"].includes(r3.position)) ? r3 = t4 : i3 = i3.filter((t5) => t5 !== c4), c4 = F(c4);
|
|
615
633
|
}
|
|
616
634
|
return e3.set(t3, i3), i3;
|
|
617
635
|
}(e2, this._c) : [].concat(n3), u3 = [...f3, l3], a3 = u3[0], h3 = u3.reduce((t3, n4) => {
|
|
@@ -636,10 +654,10 @@ var P2 = { getClippingRect: function(t2) {
|
|
|
636
654
|
}, getOffsetParent: H, getDocumentElement: R, getScale: L2, async getElementRects(t2) {
|
|
637
655
|
let { reference: e2, floating: n3, strategy: o3 } = t2;
|
|
638
656
|
const i3 = this.getOffsetParent || H, r3 = this.getDimensions;
|
|
639
|
-
return { reference:
|
|
657
|
+
return { reference: V(e2, await i3(n3), o3), floating: { x: 0, y: 0, ...await r3(n3) } };
|
|
640
658
|
}, getClientRects: (t2) => Array.from(t2.getClientRects()), isRTL: (t2) => "rtl" === o2(t2).direction };
|
|
641
|
-
var
|
|
642
|
-
const i3 = /* @__PURE__ */ new Map(), r3 = { platform:
|
|
659
|
+
var z = (t2, n3, o3) => {
|
|
660
|
+
const i3 = /* @__PURE__ */ new Map(), r3 = { platform: O2, ...o3 }, l3 = { ...r3.platform, _c: i3 };
|
|
643
661
|
return r(t2, n3, { ...r3, platform: l3 });
|
|
644
662
|
};
|
|
645
663
|
|
|
@@ -651,18 +669,18 @@ var computeTooltipPosition = async ({
|
|
|
651
669
|
place = "top",
|
|
652
670
|
offset: offsetValue = 10,
|
|
653
671
|
strategy = "absolute",
|
|
654
|
-
middlewares = [O(Number(offsetValue)), b(),
|
|
672
|
+
middlewares = [O(Number(offsetValue)), b(), D({ padding: 5 })]
|
|
655
673
|
}) => {
|
|
656
674
|
if (!elementReference) {
|
|
657
|
-
return { tooltipStyles: {}, tooltipArrowStyles: {} };
|
|
675
|
+
return { tooltipStyles: {}, tooltipArrowStyles: {}, place };
|
|
658
676
|
}
|
|
659
677
|
if (tooltipReference === null) {
|
|
660
|
-
return { tooltipStyles: {}, tooltipArrowStyles: {} };
|
|
678
|
+
return { tooltipStyles: {}, tooltipArrowStyles: {}, place };
|
|
661
679
|
}
|
|
662
680
|
const middleware = middlewares;
|
|
663
681
|
if (tooltipArrowReference) {
|
|
664
|
-
middleware.push(
|
|
665
|
-
return
|
|
682
|
+
middleware.push(u({ element: tooltipArrowReference, padding: 5 }));
|
|
683
|
+
return z(elementReference, tooltipReference, {
|
|
666
684
|
placement: place,
|
|
667
685
|
strategy,
|
|
668
686
|
middleware
|
|
@@ -683,16 +701,16 @@ var computeTooltipPosition = async ({
|
|
|
683
701
|
bottom: "",
|
|
684
702
|
[staticSide]: "-4px"
|
|
685
703
|
};
|
|
686
|
-
return { tooltipStyles: styles, tooltipArrowStyles: arrowStyle };
|
|
704
|
+
return { tooltipStyles: styles, tooltipArrowStyles: arrowStyle, place: placement };
|
|
687
705
|
});
|
|
688
706
|
}
|
|
689
|
-
return
|
|
707
|
+
return z(elementReference, tooltipReference, {
|
|
690
708
|
placement: "bottom",
|
|
691
709
|
strategy,
|
|
692
710
|
middleware
|
|
693
|
-
}).then(({ x: x3, y: y3 }) => {
|
|
711
|
+
}).then(({ x: x3, y: y3, placement }) => {
|
|
694
712
|
const styles = { left: `${x3}px`, top: `${y3}px` };
|
|
695
|
-
return { tooltipStyles: styles, tooltipArrowStyles: {} };
|
|
713
|
+
return { tooltipStyles: styles, tooltipArrowStyles: {}, place: placement };
|
|
696
714
|
});
|
|
697
715
|
};
|
|
698
716
|
|
|
@@ -738,6 +756,7 @@ var Tooltip = ({
|
|
|
738
756
|
const tooltipArrowRef = (0, import_react4.useRef)(null);
|
|
739
757
|
const tooltipShowDelayTimerRef = (0, import_react4.useRef)(null);
|
|
740
758
|
const tooltipHideDelayTimerRef = (0, import_react4.useRef)(null);
|
|
759
|
+
const [actualPlacement, setActualPlacement] = (0, import_react4.useState)(place);
|
|
741
760
|
const [inlineStyles, setInlineStyles] = (0, import_react4.useState)({});
|
|
742
761
|
const [inlineArrowStyles, setInlineArrowStyles] = (0, import_react4.useState)({});
|
|
743
762
|
const [show, setShow] = (0, import_react4.useState)(false);
|
|
@@ -885,6 +904,7 @@ var Tooltip = ({
|
|
|
885
904
|
if (Object.keys(computedStylesData.tooltipArrowStyles).length) {
|
|
886
905
|
setInlineArrowStyles(computedStylesData.tooltipArrowStyles);
|
|
887
906
|
}
|
|
907
|
+
setActualPlacement(computedStylesData.place);
|
|
888
908
|
});
|
|
889
909
|
};
|
|
890
910
|
const handleMouseMove = (event) => {
|
|
@@ -1083,6 +1103,7 @@ var Tooltip = ({
|
|
|
1083
1103
|
if (Object.keys(computedStylesData.tooltipArrowStyles).length) {
|
|
1084
1104
|
setInlineArrowStyles(computedStylesData.tooltipArrowStyles);
|
|
1085
1105
|
}
|
|
1106
|
+
setActualPlacement(computedStylesData.place);
|
|
1086
1107
|
});
|
|
1087
1108
|
}, [show, activeAnchor, content, html, place, offset, positionStrategy, position]);
|
|
1088
1109
|
(0, import_react4.useEffect)(() => {
|
|
@@ -1128,7 +1149,11 @@ var Tooltip = ({
|
|
|
1128
1149
|
className: (0, import_classnames2.default)("react-tooltip", styles_module_default["tooltip"], styles_module_default[variant], className, {
|
|
1129
1150
|
[styles_module_default["show"]]: canShow,
|
|
1130
1151
|
[styles_module_default["fixed"]]: positionStrategy === "fixed",
|
|
1131
|
-
[styles_module_default["clickable"]]: clickable
|
|
1152
|
+
[styles_module_default["clickable"]]: clickable,
|
|
1153
|
+
"react-tooltip__place-top": actualPlacement === "top",
|
|
1154
|
+
"react-tooltip__place-right": actualPlacement === "right",
|
|
1155
|
+
"react-tooltip__place-bottom": actualPlacement === "bottom",
|
|
1156
|
+
"react-tooltip__place-left": actualPlacement === "left"
|
|
1132
1157
|
}),
|
|
1133
1158
|
style: { ...externalStyles, ...inlineStyles },
|
|
1134
1159
|
ref: tooltipRef,
|