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
|
@@ -258,7 +258,7 @@ function o(t2) {
|
|
|
258
258
|
}
|
|
259
259
|
function i(i3, r3, a3) {
|
|
260
260
|
let { reference: l3, floating: s3 } = i3;
|
|
261
|
-
const c3 = l3.x + l3.width / 2 - s3.width / 2, f3 = l3.y + l3.height / 2 - s3.height / 2,
|
|
261
|
+
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;
|
|
262
262
|
let p3;
|
|
263
263
|
switch (n(r3)) {
|
|
264
264
|
case "top":
|
|
@@ -278,21 +278,21 @@ function i(i3, r3, a3) {
|
|
|
278
278
|
}
|
|
279
279
|
switch (t(r3)) {
|
|
280
280
|
case "start":
|
|
281
|
-
p3[
|
|
281
|
+
p3[m3] -= g3 * (a3 && d3 ? -1 : 1);
|
|
282
282
|
break;
|
|
283
283
|
case "end":
|
|
284
|
-
p3[
|
|
284
|
+
p3[m3] += g3 * (a3 && d3 ? -1 : 1);
|
|
285
285
|
}
|
|
286
286
|
return p3;
|
|
287
287
|
}
|
|
288
288
|
var r = async (t2, e2, n3) => {
|
|
289
289
|
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));
|
|
290
|
-
let f3 = await l3.getElementRects({ reference: t2, floating: e2, strategy: r3 }), { x:
|
|
290
|
+
let f3 = await l3.getElementRects({ reference: t2, floating: e2, strategy: r3 }), { x: m3, y: u3 } = i(f3, o3, c3), g3 = o3, d3 = {}, p3 = 0;
|
|
291
291
|
for (let n4 = 0; n4 < s3.length; n4++) {
|
|
292
|
-
const { name: a4, fn: h3 } = s3[n4], { x: y3, y: x3, data: w3, reset: v3 } = await h3({ x:
|
|
293
|
-
|
|
292
|
+
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 } });
|
|
293
|
+
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);
|
|
294
294
|
}
|
|
295
|
-
return { x:
|
|
295
|
+
return { x: m3, y: u3, placement: g3, strategy: r3, middlewareData: d3 };
|
|
296
296
|
};
|
|
297
297
|
function a(t2) {
|
|
298
298
|
return "number" != typeof t2 ? function(t3) {
|
|
@@ -305,23 +305,23 @@ function l(t2) {
|
|
|
305
305
|
async function s(t2, e2) {
|
|
306
306
|
var n3;
|
|
307
307
|
void 0 === e2 && (e2 = {});
|
|
308
|
-
const { x: o3, y: i3, platform: r3, rects: s3, elements: c3, strategy: f3 } = t2, { boundary:
|
|
308
|
+
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);
|
|
309
309
|
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 };
|
|
310
310
|
}
|
|
311
311
|
var c = Math.min;
|
|
312
312
|
var f = Math.max;
|
|
313
|
-
function
|
|
313
|
+
function m(t2, e2, n3) {
|
|
314
314
|
return f(t2, c(e2, n3));
|
|
315
315
|
}
|
|
316
|
-
var
|
|
317
|
-
const { element: r3, padding: l3 = 0 } = n3 || {}, { x: s3, y: c3, placement: f3, rects:
|
|
316
|
+
var u = (n3) => ({ name: "arrow", options: n3, async fn(i3) {
|
|
317
|
+
const { element: r3, padding: l3 = 0 } = n3 || {}, { x: s3, y: c3, placement: f3, rects: u3, platform: g3, elements: d3 } = i3;
|
|
318
318
|
if (null == r3)
|
|
319
319
|
return {};
|
|
320
|
-
const
|
|
321
|
-
let
|
|
322
|
-
0
|
|
323
|
-
const
|
|
324
|
-
return { [
|
|
320
|
+
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));
|
|
321
|
+
let E3 = O3 ? O3[A2] : 0;
|
|
322
|
+
E3 && await (null == g3.isElement ? void 0 : g3.isElement(O3)) || (E3 = d3.floating[A2] || u3.floating[x3]);
|
|
323
|
+
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;
|
|
324
|
+
return { [y3]: h3[y3] - (H2 ? B < L3 ? L3 - B : k2 - B : 0), data: { [y3]: C2, centerOffset: B - C2 } };
|
|
325
325
|
} });
|
|
326
326
|
var g = ["top", "right", "bottom", "left"];
|
|
327
327
|
var d = g.reduce((t2, e2) => t2.concat(e2, e2 + "-start", e2 + "-end"), []);
|
|
@@ -342,7 +342,7 @@ function w(t2) {
|
|
|
342
342
|
var b = function(e2) {
|
|
343
343
|
return void 0 === e2 && (e2 = {}), { name: "flip", options: e2, async fn(o3) {
|
|
344
344
|
var i3;
|
|
345
|
-
const { placement: r3, middlewareData: a3, rects: l3, initialPlacement: c3, platform: f3, elements:
|
|
345
|
+
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) {
|
|
346
346
|
const e3 = h(t2);
|
|
347
347
|
return [w(t2), e3, w(e3)];
|
|
348
348
|
}(c3));
|
|
@@ -362,19 +362,19 @@ var b = function(e2) {
|
|
|
362
362
|
}
|
|
363
363
|
}(n(e3), "start" === i4, r4);
|
|
364
364
|
return a4 && (l4 = l4.map((t2) => t2 + "-" + a4), o4 && (l4 = l4.concat(l4.map(w)))), l4;
|
|
365
|
-
}(c3, v3, x3,
|
|
366
|
-
const O3 = [c3, ...T3],
|
|
365
|
+
}(c3, v3, x3, P2));
|
|
366
|
+
const O3 = [c3, ...T3], E3 = await s(o3, b3), D3 = [];
|
|
367
367
|
let L3 = (null == (i3 = a3.flip) ? void 0 : i3.overflows) || [];
|
|
368
|
-
if (
|
|
369
|
-
const { main: t2, cross: e3 } = y(r3, l3,
|
|
370
|
-
|
|
368
|
+
if (u3 && D3.push(E3[R2]), g3) {
|
|
369
|
+
const { main: t2, cross: e3 } = y(r3, l3, P2);
|
|
370
|
+
D3.push(E3[t2], E3[e3]);
|
|
371
371
|
}
|
|
372
|
-
if (L3 = [...L3, { placement: r3, overflows:
|
|
373
|
-
var k2,
|
|
372
|
+
if (L3 = [...L3, { placement: r3, overflows: D3 }], !D3.every((t2) => t2 <= 0)) {
|
|
373
|
+
var k2, B;
|
|
374
374
|
const t2 = ((null == (k2 = a3.flip) ? void 0 : k2.index) || 0) + 1, e3 = O3[t2];
|
|
375
375
|
if (e3)
|
|
376
376
|
return { data: { index: t2, overflows: L3 }, reset: { placement: e3 } };
|
|
377
|
-
let n3 = null == (
|
|
377
|
+
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;
|
|
378
378
|
if (!n3)
|
|
379
379
|
switch (p3) {
|
|
380
380
|
case "bestFit": {
|
|
@@ -395,30 +395,30 @@ var b = function(e2) {
|
|
|
395
395
|
var O = function(e2) {
|
|
396
396
|
return void 0 === e2 && (e2 = 0), { name: "offset", options: e2, async fn(i3) {
|
|
397
397
|
const { x: r3, y: a3 } = i3, l3 = await async function(e3, i4) {
|
|
398
|
-
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),
|
|
398
|
+
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;
|
|
399
399
|
let { mainAxis: p3, crossAxis: h3, alignmentAxis: y3 } = "number" == typeof d3 ? { mainAxis: d3, crossAxis: 0, alignmentAxis: null } : { mainAxis: 0, crossAxis: 0, alignmentAxis: null, ...d3 };
|
|
400
|
-
return f3 && "number" == typeof y3 && (h3 = "end" === f3 ? -1 * y3 : y3),
|
|
400
|
+
return f3 && "number" == typeof y3 && (h3 = "end" === f3 ? -1 * y3 : y3), m3 ? { x: h3 * g3, y: p3 * u3 } : { x: p3 * u3, y: h3 * g3 };
|
|
401
401
|
}(i3, e2);
|
|
402
402
|
return { x: r3 + l3.x, y: a3 + l3.y, data: l3 };
|
|
403
403
|
} };
|
|
404
404
|
};
|
|
405
|
-
function
|
|
405
|
+
function E(t2) {
|
|
406
406
|
return "x" === t2 ? "y" : "x";
|
|
407
407
|
}
|
|
408
|
-
var
|
|
408
|
+
var D = function(t2) {
|
|
409
409
|
return void 0 === t2 && (t2 = {}), { name: "shift", options: t2, async fn(e2) {
|
|
410
410
|
const { x: i3, y: r3, placement: a3 } = e2, { mainAxis: l3 = true, crossAxis: c3 = false, limiter: f3 = { fn: (t3) => {
|
|
411
411
|
let { x: e3, y: n3 } = t3;
|
|
412
412
|
return { x: e3, y: n3 };
|
|
413
|
-
} }, ...
|
|
413
|
+
} }, ...u3 } = t2, g3 = { x: i3, y: r3 }, d3 = await s(e2, u3), p3 = o(n(a3)), h3 = E(p3);
|
|
414
414
|
let y3 = g3[p3], x3 = g3[h3];
|
|
415
415
|
if (l3) {
|
|
416
416
|
const t3 = "y" === p3 ? "bottom" : "right";
|
|
417
|
-
y3 =
|
|
417
|
+
y3 = m(y3 + d3["y" === p3 ? "top" : "left"], y3, y3 - d3[t3]);
|
|
418
418
|
}
|
|
419
419
|
if (c3) {
|
|
420
420
|
const t3 = "y" === h3 ? "bottom" : "right";
|
|
421
|
-
x3 =
|
|
421
|
+
x3 = m(x3 + d3["y" === h3 ? "top" : "left"], x3, x3 - d3[t3]);
|
|
422
422
|
}
|
|
423
423
|
const w3 = f3.fn({ ...e2, [p3]: y3, [h3]: x3 });
|
|
424
424
|
return { ...w3, data: { x: w3.x - i3, y: w3.y - r3 } };
|
|
@@ -481,7 +481,7 @@ function y2(t2) {
|
|
|
481
481
|
});
|
|
482
482
|
}
|
|
483
483
|
function x2() {
|
|
484
|
-
return
|
|
484
|
+
return /^((?!chrome|android).)*safari/i.test(u2());
|
|
485
485
|
}
|
|
486
486
|
function w2(t2) {
|
|
487
487
|
return ["html", "body", "#document"].includes(s2(t2));
|
|
@@ -498,23 +498,23 @@ function L2(t2) {
|
|
|
498
498
|
let s3 = (r3 ? l2(n3.width) : n3.width) / o3, f3 = (r3 ? l2(n3.height) : n3.height) / i3;
|
|
499
499
|
return s3 && Number.isFinite(s3) || (s3 = 1), f3 && Number.isFinite(f3) || (f3 = 1), { x: s3, y: f3 };
|
|
500
500
|
}
|
|
501
|
-
function E2(
|
|
502
|
-
var
|
|
503
|
-
void 0 ===
|
|
504
|
-
const
|
|
505
|
-
let
|
|
506
|
-
|
|
507
|
-
const
|
|
508
|
-
let
|
|
509
|
-
if (
|
|
510
|
-
const
|
|
511
|
-
let o4 =
|
|
512
|
-
for (; o4 &&
|
|
513
|
-
const
|
|
514
|
-
e4.x += (o4.clientLeft + parseFloat(i4.paddingLeft)) *
|
|
501
|
+
function E2(e2, o3, i3, r3) {
|
|
502
|
+
var l3, c3;
|
|
503
|
+
void 0 === o3 && (o3 = false), void 0 === i3 && (i3 = false);
|
|
504
|
+
const s3 = e2.getBoundingClientRect(), f3 = v2(e2);
|
|
505
|
+
let u3 = b2;
|
|
506
|
+
o3 && (r3 ? d2(r3) && (u3 = L2(r3)) : u3 = L2(e2));
|
|
507
|
+
const a3 = f3 ? n2(f3) : window, h3 = x2() && i3;
|
|
508
|
+
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;
|
|
509
|
+
if (f3) {
|
|
510
|
+
const t2 = n2(f3), e3 = r3 && d2(r3) ? n2(r3) : r3;
|
|
511
|
+
let o4 = t2.frameElement;
|
|
512
|
+
for (; o4 && r3 && e3 !== t2; ) {
|
|
513
|
+
const t3 = L2(o4), e4 = o4.getBoundingClientRect(), i4 = getComputedStyle(o4);
|
|
514
|
+
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;
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
|
-
return { width:
|
|
517
|
+
return l({ width: m3, height: y3, x: p3, y: g3 });
|
|
518
518
|
}
|
|
519
519
|
function R(t2) {
|
|
520
520
|
return ((h2(t2) ? t2.ownerDocument : t2.document) || window.document).documentElement;
|
|
@@ -542,34 +542,52 @@ function D2(t2, e2) {
|
|
|
542
542
|
return r3 ? e2.concat(l3, l3.visualViewport || [], g2(i3) ? i3 : []) : e2.concat(i3, D2(i3));
|
|
543
543
|
}
|
|
544
544
|
function S(e2, i3, l3) {
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
l4 =
|
|
550
|
-
|
|
551
|
-
|
|
545
|
+
let c3;
|
|
546
|
+
if ("viewport" === i3)
|
|
547
|
+
c3 = function(t2, e3) {
|
|
548
|
+
const o3 = n2(t2), i4 = R(t2), r3 = o3.visualViewport;
|
|
549
|
+
let l4 = i4.clientWidth, c4 = i4.clientHeight, s4 = 0, f4 = 0;
|
|
550
|
+
if (r3) {
|
|
551
|
+
l4 = r3.width, c4 = r3.height;
|
|
552
|
+
const t3 = x2();
|
|
553
|
+
(!t3 || t3 && "fixed" === e3) && (s4 = r3.offsetLeft, f4 = r3.offsetTop);
|
|
554
|
+
}
|
|
555
|
+
return { width: l4, height: c4, x: s4, y: f4 };
|
|
556
|
+
}(e2, l3);
|
|
557
|
+
else if ("document" === i3)
|
|
558
|
+
c3 = function(t2) {
|
|
559
|
+
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);
|
|
560
|
+
let s4 = -n3.scrollLeft + C(t2);
|
|
561
|
+
const f4 = -n3.scrollTop;
|
|
562
|
+
return "rtl" === o2(i4).direction && (s4 += r2(e3.clientWidth, i4.clientWidth) - l4), { width: l4, height: c4, x: s4, y: f4 };
|
|
563
|
+
}(R(e2));
|
|
564
|
+
else if (d2(i3))
|
|
565
|
+
c3 = function(t2, e3) {
|
|
566
|
+
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 };
|
|
567
|
+
return { width: t2.clientWidth * r3.x, height: t2.clientHeight * r3.y, x: i4 * r3.x, y: o3 * r3.y };
|
|
568
|
+
}(i3, l3);
|
|
569
|
+
else {
|
|
570
|
+
const t2 = { ...i3 };
|
|
571
|
+
if (x2()) {
|
|
572
|
+
var s3, f3;
|
|
573
|
+
const o3 = n2(e2);
|
|
574
|
+
t2.x -= (null == (s3 = o3.visualViewport) ? void 0 : s3.offsetLeft) || 0, t2.y -= (null == (f3 = o3.visualViewport) ? void 0 : f3.offsetTop) || 0;
|
|
552
575
|
}
|
|
553
|
-
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
return { width: t2.clientWidth * r3.x, height: t2.clientHeight * r3.y, x: i4 * r3.x, y: o3 * r3.y };
|
|
557
|
-
}(i3, l3)) : l(function(t2) {
|
|
558
|
-
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);
|
|
559
|
-
let s3 = -n3.scrollLeft + C(t2);
|
|
560
|
-
const f3 = -n3.scrollTop;
|
|
561
|
-
return "rtl" === o2(i4).direction && (s3 += r2(e3.clientWidth, i4.clientWidth) - l4), { width: l4, height: c3, x: s3, y: f3 };
|
|
562
|
-
}(R(e2)));
|
|
576
|
+
c3 = t2;
|
|
577
|
+
}
|
|
578
|
+
return l(c3);
|
|
563
579
|
}
|
|
564
|
-
function A(t2) {
|
|
565
|
-
return a2(t2) && "fixed" !== o2(t2).position ? t2.offsetParent : null;
|
|
580
|
+
function A(t2, e2) {
|
|
581
|
+
return a2(t2) && "fixed" !== o2(t2).position ? e2 ? e2(t2) : t2.offsetParent : null;
|
|
566
582
|
}
|
|
567
|
-
function H(t2) {
|
|
568
|
-
const
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
583
|
+
function H(t2, e2) {
|
|
584
|
+
const i3 = n2(t2);
|
|
585
|
+
if (!a2(t2))
|
|
586
|
+
return i3;
|
|
587
|
+
let r3 = A(t2, e2);
|
|
588
|
+
for (; r3 && m2(r3) && "static" === o2(r3).position; )
|
|
589
|
+
r3 = A(r3, e2);
|
|
590
|
+
return r3 && ("html" === s2(r3) || "body" === s2(r3) && "static" === o2(r3).position && !y2(r3)) ? i3 : r3 || function(t3) {
|
|
573
591
|
let e3 = F(t3);
|
|
574
592
|
for (; a2(e3) && !w2(e3); ) {
|
|
575
593
|
if (y2(e3))
|
|
@@ -577,9 +595,9 @@ function H(t2) {
|
|
|
577
595
|
e3 = F(e3);
|
|
578
596
|
}
|
|
579
597
|
return null;
|
|
580
|
-
}(t2) ||
|
|
598
|
+
}(t2) || i3;
|
|
581
599
|
}
|
|
582
|
-
function
|
|
600
|
+
function V(t2, e2, n3) {
|
|
583
601
|
const o3 = a2(e2), i3 = R(e2), r3 = E2(t2, true, "fixed" === n3, e2);
|
|
584
602
|
let l3 = { scrollLeft: 0, scrollTop: 0 };
|
|
585
603
|
const c3 = { x: 0, y: 0 };
|
|
@@ -591,7 +609,7 @@ function O2(t2, e2, n3) {
|
|
|
591
609
|
i3 && (c3.x = C(i3));
|
|
592
610
|
return { x: r3.left + l3.scrollLeft - c3.x, y: r3.top + l3.scrollTop - c3.y, width: r3.width, height: r3.height };
|
|
593
611
|
}
|
|
594
|
-
var
|
|
612
|
+
var O2 = { getClippingRect: function(t2) {
|
|
595
613
|
let { element: e2, boundary: n3, rootBoundary: l3, strategy: c3 } = t2;
|
|
596
614
|
const f3 = "clippingAncestors" === n3 ? function(t3, e3) {
|
|
597
615
|
const n4 = e3.get(t3);
|
|
@@ -602,7 +620,7 @@ var P2 = { getClippingRect: function(t2) {
|
|
|
602
620
|
let c4 = l4 ? F(t3) : t3;
|
|
603
621
|
for (; d2(c4) && !w2(c4); ) {
|
|
604
622
|
const t4 = o2(c4), e4 = y2(c4);
|
|
605
|
-
(l4 ? e4 || r3 : e4 || "static" !== t4.position || !r3 || !["absolute", "fixed"].includes(r3.position)) ? r3 = t4 : i3 = i3.filter((t5) => t5 !== c4), c4 = F(c4);
|
|
623
|
+
"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);
|
|
606
624
|
}
|
|
607
625
|
return e3.set(t3, i3), i3;
|
|
608
626
|
}(e2, this._c) : [].concat(n3), u3 = [...f3, l3], a3 = u3[0], h3 = u3.reduce((t3, n4) => {
|
|
@@ -627,10 +645,10 @@ var P2 = { getClippingRect: function(t2) {
|
|
|
627
645
|
}, getOffsetParent: H, getDocumentElement: R, getScale: L2, async getElementRects(t2) {
|
|
628
646
|
let { reference: e2, floating: n3, strategy: o3 } = t2;
|
|
629
647
|
const i3 = this.getOffsetParent || H, r3 = this.getDimensions;
|
|
630
|
-
return { reference:
|
|
648
|
+
return { reference: V(e2, await i3(n3), o3), floating: { x: 0, y: 0, ...await r3(n3) } };
|
|
631
649
|
}, getClientRects: (t2) => Array.from(t2.getClientRects()), isRTL: (t2) => "rtl" === o2(t2).direction };
|
|
632
|
-
var
|
|
633
|
-
const i3 = /* @__PURE__ */ new Map(), r3 = { platform:
|
|
650
|
+
var z = (t2, n3, o3) => {
|
|
651
|
+
const i3 = /* @__PURE__ */ new Map(), r3 = { platform: O2, ...o3 }, l3 = { ...r3.platform, _c: i3 };
|
|
634
652
|
return r(t2, n3, { ...r3, platform: l3 });
|
|
635
653
|
};
|
|
636
654
|
|
|
@@ -642,18 +660,18 @@ var computeTooltipPosition = async ({
|
|
|
642
660
|
place = "top",
|
|
643
661
|
offset: offsetValue = 10,
|
|
644
662
|
strategy = "absolute",
|
|
645
|
-
middlewares = [O(Number(offsetValue)), b(),
|
|
663
|
+
middlewares = [O(Number(offsetValue)), b(), D({ padding: 5 })]
|
|
646
664
|
}) => {
|
|
647
665
|
if (!elementReference) {
|
|
648
|
-
return { tooltipStyles: {}, tooltipArrowStyles: {} };
|
|
666
|
+
return { tooltipStyles: {}, tooltipArrowStyles: {}, place };
|
|
649
667
|
}
|
|
650
668
|
if (tooltipReference === null) {
|
|
651
|
-
return { tooltipStyles: {}, tooltipArrowStyles: {} };
|
|
669
|
+
return { tooltipStyles: {}, tooltipArrowStyles: {}, place };
|
|
652
670
|
}
|
|
653
671
|
const middleware = middlewares;
|
|
654
672
|
if (tooltipArrowReference) {
|
|
655
|
-
middleware.push(
|
|
656
|
-
return
|
|
673
|
+
middleware.push(u({ element: tooltipArrowReference, padding: 5 }));
|
|
674
|
+
return z(elementReference, tooltipReference, {
|
|
657
675
|
placement: place,
|
|
658
676
|
strategy,
|
|
659
677
|
middleware
|
|
@@ -674,16 +692,16 @@ var computeTooltipPosition = async ({
|
|
|
674
692
|
bottom: "",
|
|
675
693
|
[staticSide]: "-4px"
|
|
676
694
|
};
|
|
677
|
-
return { tooltipStyles: styles, tooltipArrowStyles: arrowStyle };
|
|
695
|
+
return { tooltipStyles: styles, tooltipArrowStyles: arrowStyle, place: placement };
|
|
678
696
|
});
|
|
679
697
|
}
|
|
680
|
-
return
|
|
698
|
+
return z(elementReference, tooltipReference, {
|
|
681
699
|
placement: "bottom",
|
|
682
700
|
strategy,
|
|
683
701
|
middleware
|
|
684
|
-
}).then(({ x: x3, y: y3 }) => {
|
|
702
|
+
}).then(({ x: x3, y: y3, placement }) => {
|
|
685
703
|
const styles = { left: `${x3}px`, top: `${y3}px` };
|
|
686
|
-
return { tooltipStyles: styles, tooltipArrowStyles: {} };
|
|
704
|
+
return { tooltipStyles: styles, tooltipArrowStyles: {}, place: placement };
|
|
687
705
|
});
|
|
688
706
|
};
|
|
689
707
|
|
|
@@ -729,6 +747,7 @@ var Tooltip = ({
|
|
|
729
747
|
const tooltipArrowRef = useRef2(null);
|
|
730
748
|
const tooltipShowDelayTimerRef = useRef2(null);
|
|
731
749
|
const tooltipHideDelayTimerRef = useRef2(null);
|
|
750
|
+
const [actualPlacement, setActualPlacement] = useState2(place);
|
|
732
751
|
const [inlineStyles, setInlineStyles] = useState2({});
|
|
733
752
|
const [inlineArrowStyles, setInlineArrowStyles] = useState2({});
|
|
734
753
|
const [show, setShow] = useState2(false);
|
|
@@ -876,6 +895,7 @@ var Tooltip = ({
|
|
|
876
895
|
if (Object.keys(computedStylesData.tooltipArrowStyles).length) {
|
|
877
896
|
setInlineArrowStyles(computedStylesData.tooltipArrowStyles);
|
|
878
897
|
}
|
|
898
|
+
setActualPlacement(computedStylesData.place);
|
|
879
899
|
});
|
|
880
900
|
};
|
|
881
901
|
const handleMouseMove = (event) => {
|
|
@@ -1074,6 +1094,7 @@ var Tooltip = ({
|
|
|
1074
1094
|
if (Object.keys(computedStylesData.tooltipArrowStyles).length) {
|
|
1075
1095
|
setInlineArrowStyles(computedStylesData.tooltipArrowStyles);
|
|
1076
1096
|
}
|
|
1097
|
+
setActualPlacement(computedStylesData.place);
|
|
1077
1098
|
});
|
|
1078
1099
|
}, [show, activeAnchor, content, html, place, offset, positionStrategy, position]);
|
|
1079
1100
|
useEffect3(() => {
|
|
@@ -1119,7 +1140,11 @@ var Tooltip = ({
|
|
|
1119
1140
|
className: (0, import_classnames2.default)("react-tooltip", styles_module_default["tooltip"], styles_module_default[variant], className, {
|
|
1120
1141
|
[styles_module_default["show"]]: canShow,
|
|
1121
1142
|
[styles_module_default["fixed"]]: positionStrategy === "fixed",
|
|
1122
|
-
[styles_module_default["clickable"]]: clickable
|
|
1143
|
+
[styles_module_default["clickable"]]: clickable,
|
|
1144
|
+
"react-tooltip__place-top": actualPlacement === "top",
|
|
1145
|
+
"react-tooltip__place-right": actualPlacement === "right",
|
|
1146
|
+
"react-tooltip__place-bottom": actualPlacement === "bottom",
|
|
1147
|
+
"react-tooltip__place-left": actualPlacement === "left"
|
|
1123
1148
|
}),
|
|
1124
1149
|
style: { ...externalStyles, ...inlineStyles },
|
|
1125
1150
|
ref: tooltipRef,
|