@versini/ui-tooltip 2.0.2 → 2.0.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/components/Tooltip/Tooltip.js +169 -163
- package/dist/index.js +3 -3
- package/package.json +6 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as bt, jsx as It } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as G, useEffect as pt, useState as ft, useCallback as ut } from "react";
|
|
3
|
-
import
|
|
4
|
-
const _t = "av-tooltip", jt = "av-tooltip-arrow", J = Math.min,
|
|
3
|
+
import Y from "clsx";
|
|
4
|
+
const _t = "av-tooltip", jt = "av-tooltip-arrow", J = Math.min, X = Math.max, ot = Math.round, D = (t) => ({
|
|
5
5
|
x: t,
|
|
6
6
|
y: t
|
|
7
7
|
}), Yt = {
|
|
@@ -14,28 +14,28 @@ const _t = "av-tooltip", jt = "av-tooltip-arrow", J = Math.min, z = Math.max, ot
|
|
|
14
14
|
end: "start"
|
|
15
15
|
};
|
|
16
16
|
function dt(t, e, o) {
|
|
17
|
-
return
|
|
17
|
+
return X(t, J(e, o));
|
|
18
18
|
}
|
|
19
19
|
function Z(t, e) {
|
|
20
20
|
return typeof t == "function" ? t(e) : t;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function z(t) {
|
|
23
23
|
return t.split("-")[0];
|
|
24
24
|
}
|
|
25
25
|
function tt(t) {
|
|
26
26
|
return t.split("-")[1];
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function Et(t) {
|
|
29
29
|
return t === "x" ? "y" : "x";
|
|
30
30
|
}
|
|
31
31
|
function gt(t) {
|
|
32
32
|
return t === "y" ? "height" : "width";
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
return ["top", "bottom"].includes(
|
|
34
|
+
function $(t) {
|
|
35
|
+
return ["top", "bottom"].includes(z(t)) ? "y" : "x";
|
|
36
36
|
}
|
|
37
37
|
function ht(t) {
|
|
38
|
-
return
|
|
38
|
+
return Et($(t));
|
|
39
39
|
}
|
|
40
40
|
function Xt(t, e, o) {
|
|
41
41
|
o === void 0 && (o = !1);
|
|
@@ -65,7 +65,7 @@ function Ut(t, e, o) {
|
|
|
65
65
|
}
|
|
66
66
|
function qt(t, e, o, n) {
|
|
67
67
|
const i = tt(t);
|
|
68
|
-
let s = Ut(
|
|
68
|
+
let s = Ut(z(t), o === "start", n);
|
|
69
69
|
return i && (s = s.map((r) => r + "-" + i), e && (s = s.concat(s.map(mt)))), s;
|
|
70
70
|
}
|
|
71
71
|
function it(t) {
|
|
@@ -111,7 +111,7 @@ function vt(t, e, o) {
|
|
|
111
111
|
reference: n,
|
|
112
112
|
floating: i
|
|
113
113
|
} = t;
|
|
114
|
-
const s =
|
|
114
|
+
const s = $(e), r = ht(e), c = gt(r), l = z(e), a = s === "y", d = n.x + n.width / 2 - i.width / 2, f = n.y + n.height / 2 - i.height / 2, p = n[c] / 2 - i[c] / 2;
|
|
115
115
|
let u;
|
|
116
116
|
switch (l) {
|
|
117
117
|
case "top":
|
|
@@ -172,13 +172,13 @@ const Jt = async (t, e, o) => {
|
|
|
172
172
|
for (let g = 0; g < c.length; g++) {
|
|
173
173
|
const {
|
|
174
174
|
name: h,
|
|
175
|
-
fn:
|
|
175
|
+
fn: x
|
|
176
176
|
} = c[g], {
|
|
177
|
-
x,
|
|
177
|
+
x: w,
|
|
178
178
|
y,
|
|
179
179
|
data: A,
|
|
180
180
|
reset: b
|
|
181
|
-
} = await
|
|
181
|
+
} = await x({
|
|
182
182
|
x: d,
|
|
183
183
|
y: f,
|
|
184
184
|
initialPlacement: n,
|
|
@@ -192,7 +192,7 @@ const Jt = async (t, e, o) => {
|
|
|
192
192
|
floating: e
|
|
193
193
|
}
|
|
194
194
|
});
|
|
195
|
-
d =
|
|
195
|
+
d = w ?? d, f = y ?? f, u = {
|
|
196
196
|
...u,
|
|
197
197
|
[h]: {
|
|
198
198
|
...u[h],
|
|
@@ -231,12 +231,12 @@ async function St(t, e) {
|
|
|
231
231
|
elementContext: f = "floating",
|
|
232
232
|
altBoundary: p = !1,
|
|
233
233
|
padding: u = 0
|
|
234
|
-
} = Z(e, t), m = kt(u), h = c[p ? f === "floating" ? "reference" : "floating" : f],
|
|
234
|
+
} = Z(e, t), m = kt(u), h = c[p ? f === "floating" ? "reference" : "floating" : f], x = st(await s.getClippingRect({
|
|
235
235
|
element: (o = await (s.isElement == null ? void 0 : s.isElement(h))) == null || o ? h : h.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(c.floating)),
|
|
236
236
|
boundary: a,
|
|
237
237
|
rootBoundary: d,
|
|
238
238
|
strategy: l
|
|
239
|
-
})),
|
|
239
|
+
})), w = f === "floating" ? {
|
|
240
240
|
x: n,
|
|
241
241
|
y: i,
|
|
242
242
|
width: r.floating.width,
|
|
@@ -249,15 +249,15 @@ async function St(t, e) {
|
|
|
249
249
|
y: 1
|
|
250
250
|
}, b = st(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
251
251
|
elements: c,
|
|
252
|
-
rect:
|
|
252
|
+
rect: w,
|
|
253
253
|
offsetParent: y,
|
|
254
254
|
strategy: l
|
|
255
|
-
}) :
|
|
255
|
+
}) : w);
|
|
256
256
|
return {
|
|
257
|
-
top: (
|
|
258
|
-
bottom: (b.bottom -
|
|
259
|
-
left: (
|
|
260
|
-
right: (b.right -
|
|
257
|
+
top: (x.top - b.top + m.top) / A.y,
|
|
258
|
+
bottom: (b.bottom - x.bottom + m.bottom) / A.y,
|
|
259
|
+
left: (x.left - b.left + m.left) / A.x,
|
|
260
|
+
right: (b.right - x.right + m.right) / A.x
|
|
261
261
|
};
|
|
262
262
|
}
|
|
263
263
|
const Qt = (t) => ({
|
|
@@ -281,20 +281,20 @@ const Qt = (t) => ({
|
|
|
281
281
|
const f = kt(d), p = {
|
|
282
282
|
x: o,
|
|
283
283
|
y: n
|
|
284
|
-
}, u = ht(i), m = gt(u), g = await r.getDimensions(a), h = u === "y",
|
|
285
|
-
let
|
|
286
|
-
(!
|
|
287
|
-
const
|
|
284
|
+
}, u = ht(i), m = gt(u), g = await r.getDimensions(a), h = u === "y", x = h ? "top" : "left", w = h ? "bottom" : "right", y = h ? "clientHeight" : "clientWidth", A = s.reference[m] + s.reference[u] - p[u] - s.floating[m], b = p[u] - s.reference[u], M = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(a));
|
|
285
|
+
let k = M ? M[y] : 0;
|
|
286
|
+
(!k || !await (r.isElement == null ? void 0 : r.isElement(M))) && (k = c.floating[y] || s.floating[m]);
|
|
287
|
+
const V = A / 2 - b / 2, S = k / 2 - g[m] / 2 - 1, T = J(f[x], S), I = J(f[w], S), P = T, _ = k - g[m] - I, v = k / 2 - g[m] / 2 + V, j = dt(P, v, _), B = !l.arrow && tt(i) != null && v !== j && s.reference[m] / 2 - (v < P ? T : I) - g[m] / 2 < 0, O = B ? v < P ? v - P : v - _ : 0;
|
|
288
288
|
return {
|
|
289
|
-
[u]: p[u] +
|
|
289
|
+
[u]: p[u] + O,
|
|
290
290
|
data: {
|
|
291
|
-
[u]:
|
|
292
|
-
centerOffset: v -
|
|
293
|
-
...
|
|
294
|
-
alignmentOffset:
|
|
291
|
+
[u]: j,
|
|
292
|
+
centerOffset: v - j - O,
|
|
293
|
+
...B && {
|
|
294
|
+
alignmentOffset: O
|
|
295
295
|
}
|
|
296
296
|
},
|
|
297
|
-
reset:
|
|
297
|
+
reset: B
|
|
298
298
|
};
|
|
299
299
|
}
|
|
300
300
|
}), Zt = function(t) {
|
|
@@ -321,55 +321,57 @@ const Qt = (t) => ({
|
|
|
321
321
|
} = Z(t, e);
|
|
322
322
|
if ((o = s.arrow) != null && o.alignmentOffset)
|
|
323
323
|
return {};
|
|
324
|
-
const
|
|
325
|
-
!p &&
|
|
326
|
-
const
|
|
327
|
-
let
|
|
328
|
-
if (d &&
|
|
324
|
+
const x = z(i), w = $(c), y = z(c) === c, A = await (l.isRTL == null ? void 0 : l.isRTL(a.floating)), b = p || (y || !g ? [it(c)] : Kt(c)), M = m !== "none";
|
|
325
|
+
!p && M && b.push(...qt(c, g, m, A));
|
|
326
|
+
const k = [c, ...b], V = await St(e, h), S = [];
|
|
327
|
+
let T = ((n = s.flip) == null ? void 0 : n.overflows) || [];
|
|
328
|
+
if (d && S.push(V[x]), f) {
|
|
329
329
|
const v = Xt(i, r, A);
|
|
330
|
-
|
|
330
|
+
S.push(V[v[0]], V[v[1]]);
|
|
331
331
|
}
|
|
332
|
-
if (
|
|
332
|
+
if (T = [...T, {
|
|
333
333
|
placement: i,
|
|
334
|
-
overflows:
|
|
335
|
-
}], !
|
|
336
|
-
var
|
|
337
|
-
const v = (((
|
|
338
|
-
if (
|
|
334
|
+
overflows: S
|
|
335
|
+
}], !S.every((v) => v <= 0)) {
|
|
336
|
+
var I, P;
|
|
337
|
+
const v = (((I = s.flip) == null ? void 0 : I.index) || 0) + 1, j = k[v];
|
|
338
|
+
if (j && (!(f === "alignment" ? w !== $(j) : !1) || // We leave the current main axis only if every placement on that axis
|
|
339
|
+
// overflows the main axis.
|
|
340
|
+
T.every((R) => R.overflows[0] > 0 && $(R.placement) === w)))
|
|
339
341
|
return {
|
|
340
342
|
data: {
|
|
341
343
|
index: v,
|
|
342
|
-
overflows:
|
|
344
|
+
overflows: T
|
|
343
345
|
},
|
|
344
346
|
reset: {
|
|
345
|
-
placement:
|
|
347
|
+
placement: j
|
|
346
348
|
}
|
|
347
349
|
};
|
|
348
|
-
let
|
|
349
|
-
if (!
|
|
350
|
+
let B = (P = T.filter((O) => O.overflows[0] <= 0).sort((O, R) => O.overflows[1] - R.overflows[1])[0]) == null ? void 0 : P.placement;
|
|
351
|
+
if (!B)
|
|
350
352
|
switch (u) {
|
|
351
353
|
case "bestFit": {
|
|
352
|
-
var
|
|
353
|
-
const
|
|
354
|
-
if (
|
|
355
|
-
const W =
|
|
356
|
-
return W ===
|
|
354
|
+
var _;
|
|
355
|
+
const O = (_ = T.filter((R) => {
|
|
356
|
+
if (M) {
|
|
357
|
+
const W = $(R.placement);
|
|
358
|
+
return W === w || // Create a bias to the `y` side axis due to horizontal
|
|
357
359
|
// reading directions favoring greater width.
|
|
358
360
|
W === "y";
|
|
359
361
|
}
|
|
360
362
|
return !0;
|
|
361
|
-
}).map((
|
|
362
|
-
|
|
363
|
+
}).map((R) => [R.placement, R.overflows.filter((W) => W > 0).reduce((W, Ht) => W + Ht, 0)]).sort((R, W) => R[1] - W[1])[0]) == null ? void 0 : _[0];
|
|
364
|
+
O && (B = O);
|
|
363
365
|
break;
|
|
364
366
|
}
|
|
365
367
|
case "initialPlacement":
|
|
366
|
-
|
|
368
|
+
B = c;
|
|
367
369
|
break;
|
|
368
370
|
}
|
|
369
|
-
if (i !==
|
|
371
|
+
if (i !== B)
|
|
370
372
|
return {
|
|
371
373
|
reset: {
|
|
372
|
-
placement:
|
|
374
|
+
placement: B
|
|
373
375
|
}
|
|
374
376
|
};
|
|
375
377
|
}
|
|
@@ -382,7 +384,7 @@ async function te(t, e) {
|
|
|
382
384
|
placement: o,
|
|
383
385
|
platform: n,
|
|
384
386
|
elements: i
|
|
385
|
-
} = t, s = await (n.isRTL == null ? void 0 : n.isRTL(i.floating)), r =
|
|
387
|
+
} = t, s = await (n.isRTL == null ? void 0 : n.isRTL(i.floating)), r = z(o), c = tt(o), l = $(o) === "y", a = ["left", "top"].includes(r) ? -1 : 1, d = s && l ? -1 : 1, f = Z(e, t);
|
|
386
388
|
let {
|
|
387
389
|
mainAxis: p,
|
|
388
390
|
crossAxis: u,
|
|
@@ -441,12 +443,12 @@ const ee = function(t) {
|
|
|
441
443
|
limiter: c = {
|
|
442
444
|
fn: (h) => {
|
|
443
445
|
let {
|
|
444
|
-
x
|
|
445
|
-
y:
|
|
446
|
+
x,
|
|
447
|
+
y: w
|
|
446
448
|
} = h;
|
|
447
449
|
return {
|
|
448
|
-
x
|
|
449
|
-
y:
|
|
450
|
+
x,
|
|
451
|
+
y: w
|
|
450
452
|
};
|
|
451
453
|
}
|
|
452
454
|
},
|
|
@@ -454,15 +456,15 @@ const ee = function(t) {
|
|
|
454
456
|
} = Z(t, e), a = {
|
|
455
457
|
x: o,
|
|
456
458
|
y: n
|
|
457
|
-
}, d = await St(e, l), f =
|
|
459
|
+
}, d = await St(e, l), f = $(z(i)), p = Et(f);
|
|
458
460
|
let u = a[p], m = a[f];
|
|
459
461
|
if (s) {
|
|
460
|
-
const h = p === "y" ? "top" : "left",
|
|
461
|
-
u = dt(
|
|
462
|
+
const h = p === "y" ? "top" : "left", x = p === "y" ? "bottom" : "right", w = u + d[h], y = u - d[x];
|
|
463
|
+
u = dt(w, u, y);
|
|
462
464
|
}
|
|
463
465
|
if (r) {
|
|
464
|
-
const h = f === "y" ? "top" : "left",
|
|
465
|
-
m = dt(
|
|
466
|
+
const h = f === "y" ? "top" : "left", x = f === "y" ? "bottom" : "right", w = m + d[h], y = m - d[x];
|
|
467
|
+
m = dt(w, m, y);
|
|
466
468
|
}
|
|
467
469
|
const g = c.fn({
|
|
468
470
|
...e,
|
|
@@ -493,17 +495,17 @@ function C(t) {
|
|
|
493
495
|
var e;
|
|
494
496
|
return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
|
|
495
497
|
}
|
|
496
|
-
function
|
|
498
|
+
function F(t) {
|
|
497
499
|
var e;
|
|
498
500
|
return (e = (Pt(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
|
|
499
501
|
}
|
|
500
502
|
function Pt(t) {
|
|
501
503
|
return rt() ? t instanceof Node || t instanceof C(t).Node : !1;
|
|
502
504
|
}
|
|
503
|
-
function
|
|
505
|
+
function L(t) {
|
|
504
506
|
return rt() ? t instanceof Element || t instanceof C(t).Element : !1;
|
|
505
507
|
}
|
|
506
|
-
function
|
|
508
|
+
function N(t) {
|
|
507
509
|
return rt() ? t instanceof HTMLElement || t instanceof C(t).HTMLElement : !1;
|
|
508
510
|
}
|
|
509
511
|
function At(t) {
|
|
@@ -515,7 +517,7 @@ function et(t) {
|
|
|
515
517
|
overflowX: o,
|
|
516
518
|
overflowY: n,
|
|
517
519
|
display: i
|
|
518
|
-
} =
|
|
520
|
+
} = E(t);
|
|
519
521
|
return /auto|scroll|overlay|hidden|clip/.test(e + n + o) && !["inline", "contents"].includes(i);
|
|
520
522
|
}
|
|
521
523
|
function oe(t) {
|
|
@@ -531,17 +533,17 @@ function ct(t) {
|
|
|
531
533
|
});
|
|
532
534
|
}
|
|
533
535
|
function wt(t) {
|
|
534
|
-
const e = xt(), o =
|
|
536
|
+
const e = xt(), o = L(t) ? E(t) : t;
|
|
535
537
|
return ["transform", "translate", "scale", "rotate", "perspective"].some((n) => o[n] ? o[n] !== "none" : !1) || (o.containerType ? o.containerType !== "normal" : !1) || !e && (o.backdropFilter ? o.backdropFilter !== "none" : !1) || !e && (o.filter ? o.filter !== "none" : !1) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((n) => (o.willChange || "").includes(n)) || ["paint", "layout", "strict", "content"].some((n) => (o.contain || "").includes(n));
|
|
536
538
|
}
|
|
537
539
|
function ie(t) {
|
|
538
|
-
let e =
|
|
539
|
-
for (;
|
|
540
|
+
let e = H(t);
|
|
541
|
+
for (; N(e) && !U(e); ) {
|
|
540
542
|
if (wt(e))
|
|
541
543
|
return e;
|
|
542
544
|
if (ct(e))
|
|
543
545
|
return null;
|
|
544
|
-
e =
|
|
546
|
+
e = H(e);
|
|
545
547
|
}
|
|
546
548
|
return null;
|
|
547
549
|
}
|
|
@@ -551,11 +553,11 @@ function xt() {
|
|
|
551
553
|
function U(t) {
|
|
552
554
|
return ["html", "body", "#document"].includes(q(t));
|
|
553
555
|
}
|
|
554
|
-
function
|
|
556
|
+
function E(t) {
|
|
555
557
|
return C(t).getComputedStyle(t);
|
|
556
558
|
}
|
|
557
559
|
function lt(t) {
|
|
558
|
-
return
|
|
560
|
+
return L(t) ? {
|
|
559
561
|
scrollLeft: t.scrollLeft,
|
|
560
562
|
scrollTop: t.scrollTop
|
|
561
563
|
} : {
|
|
@@ -563,7 +565,7 @@ function lt(t) {
|
|
|
563
565
|
scrollTop: t.scrollY
|
|
564
566
|
};
|
|
565
567
|
}
|
|
566
|
-
function
|
|
568
|
+
function H(t) {
|
|
567
569
|
if (q(t) === "html")
|
|
568
570
|
return t;
|
|
569
571
|
const e = (
|
|
@@ -571,13 +573,13 @@ function $(t) {
|
|
|
571
573
|
t.assignedSlot || // DOM Element detected.
|
|
572
574
|
t.parentNode || // ShadowRoot detected.
|
|
573
575
|
At(t) && t.host || // Fallback.
|
|
574
|
-
|
|
576
|
+
F(t)
|
|
575
577
|
);
|
|
576
578
|
return At(e) ? e.host : e;
|
|
577
579
|
}
|
|
578
580
|
function Dt(t) {
|
|
579
|
-
const e =
|
|
580
|
-
return U(e) ? t.ownerDocument ? t.ownerDocument.body : t.body :
|
|
581
|
+
const e = H(t);
|
|
582
|
+
return U(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : N(e) && et(e) ? e : Dt(e);
|
|
581
583
|
}
|
|
582
584
|
function Nt(t, e, o) {
|
|
583
585
|
var n;
|
|
@@ -589,9 +591,9 @@ function Ct(t) {
|
|
|
589
591
|
return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
|
|
590
592
|
}
|
|
591
593
|
function Mt(t) {
|
|
592
|
-
const e =
|
|
594
|
+
const e = E(t);
|
|
593
595
|
let o = parseFloat(e.width) || 0, n = parseFloat(e.height) || 0;
|
|
594
|
-
const i =
|
|
596
|
+
const i = N(t), s = i ? t.offsetWidth : o, r = i ? t.offsetHeight : n, c = ot(o) !== s || ot(n) !== r;
|
|
595
597
|
return c && (o = s, n = r), {
|
|
596
598
|
width: o,
|
|
597
599
|
height: n,
|
|
@@ -599,12 +601,12 @@ function Mt(t) {
|
|
|
599
601
|
};
|
|
600
602
|
}
|
|
601
603
|
function Bt(t) {
|
|
602
|
-
return
|
|
604
|
+
return L(t) ? t : t.contextElement;
|
|
603
605
|
}
|
|
604
|
-
function
|
|
606
|
+
function K(t) {
|
|
605
607
|
const e = Bt(t);
|
|
606
|
-
if (!
|
|
607
|
-
return
|
|
608
|
+
if (!N(e))
|
|
609
|
+
return D(1);
|
|
608
610
|
const o = e.getBoundingClientRect(), {
|
|
609
611
|
width: n,
|
|
610
612
|
height: i,
|
|
@@ -616,7 +618,7 @@ function X(t) {
|
|
|
616
618
|
y: c
|
|
617
619
|
};
|
|
618
620
|
}
|
|
619
|
-
const se = /* @__PURE__ */
|
|
621
|
+
const se = /* @__PURE__ */ D(0);
|
|
620
622
|
function Ft(t) {
|
|
621
623
|
const e = C(t);
|
|
622
624
|
return !xt() || !e.visualViewport ? se : {
|
|
@@ -630,15 +632,15 @@ function re(t, e, o) {
|
|
|
630
632
|
function Q(t, e, o, n) {
|
|
631
633
|
e === void 0 && (e = !1), o === void 0 && (o = !1);
|
|
632
634
|
const i = t.getBoundingClientRect(), s = Bt(t);
|
|
633
|
-
let r =
|
|
634
|
-
e && (n ?
|
|
635
|
-
const c = re(s, o, n) ? Ft(s) :
|
|
635
|
+
let r = D(1);
|
|
636
|
+
e && (n ? L(n) && (r = K(n)) : r = K(t));
|
|
637
|
+
const c = re(s, o, n) ? Ft(s) : D(0);
|
|
636
638
|
let l = (i.left + c.x) / r.x, a = (i.top + c.y) / r.y, d = i.width / r.x, f = i.height / r.y;
|
|
637
639
|
if (s) {
|
|
638
|
-
const p = C(s), u = n &&
|
|
640
|
+
const p = C(s), u = n && L(n) ? C(n) : n;
|
|
639
641
|
let m = p, g = Ct(m);
|
|
640
642
|
for (; g && n && u !== m; ) {
|
|
641
|
-
const h =
|
|
643
|
+
const h = K(g), x = g.getBoundingClientRect(), w = E(g), y = x.left + (g.clientLeft + parseFloat(w.paddingLeft)) * h.x, A = x.top + (g.clientTop + parseFloat(w.paddingTop)) * h.y;
|
|
642
644
|
l *= h.x, a *= h.y, d *= h.x, f *= h.y, l += y, a += A, m = C(g), g = Ct(m);
|
|
643
645
|
}
|
|
644
646
|
}
|
|
@@ -651,7 +653,7 @@ function Q(t, e, o, n) {
|
|
|
651
653
|
}
|
|
652
654
|
function yt(t, e) {
|
|
653
655
|
const o = lt(t).scrollLeft;
|
|
654
|
-
return e ? e.left + o : Q(
|
|
656
|
+
return e ? e.left + o : Q(F(t)).left + o;
|
|
655
657
|
}
|
|
656
658
|
function Vt(t, e, o) {
|
|
657
659
|
o === void 0 && (o = !1);
|
|
@@ -671,19 +673,19 @@ function ce(t) {
|
|
|
671
673
|
offsetParent: n,
|
|
672
674
|
strategy: i
|
|
673
675
|
} = t;
|
|
674
|
-
const s = i === "fixed", r =
|
|
676
|
+
const s = i === "fixed", r = F(n), c = e ? ct(e.floating) : !1;
|
|
675
677
|
if (n === r || c && s)
|
|
676
678
|
return o;
|
|
677
679
|
let l = {
|
|
678
680
|
scrollLeft: 0,
|
|
679
681
|
scrollTop: 0
|
|
680
|
-
}, a =
|
|
681
|
-
const d =
|
|
682
|
-
if ((f || !f && !s) && ((q(n) !== "body" || et(r)) && (l = lt(n)),
|
|
682
|
+
}, a = D(1);
|
|
683
|
+
const d = D(0), f = N(n);
|
|
684
|
+
if ((f || !f && !s) && ((q(n) !== "body" || et(r)) && (l = lt(n)), N(n))) {
|
|
683
685
|
const u = Q(n);
|
|
684
|
-
a =
|
|
686
|
+
a = K(n), d.x = u.x + n.clientLeft, d.y = u.y + n.clientTop;
|
|
685
687
|
}
|
|
686
|
-
const p = r && !f && !s ? Vt(r, l, !0) :
|
|
688
|
+
const p = r && !f && !s ? Vt(r, l, !0) : D(0);
|
|
687
689
|
return {
|
|
688
690
|
width: o.width * a.x,
|
|
689
691
|
height: o.height * a.y,
|
|
@@ -695,10 +697,10 @@ function le(t) {
|
|
|
695
697
|
return Array.from(t.getClientRects());
|
|
696
698
|
}
|
|
697
699
|
function ae(t) {
|
|
698
|
-
const e =
|
|
700
|
+
const e = F(t), o = lt(t), n = t.ownerDocument.body, i = X(e.scrollWidth, e.clientWidth, n.scrollWidth, n.clientWidth), s = X(e.scrollHeight, e.clientHeight, n.scrollHeight, n.clientHeight);
|
|
699
701
|
let r = -o.scrollLeft + yt(t);
|
|
700
702
|
const c = -o.scrollTop;
|
|
701
|
-
return
|
|
703
|
+
return E(n).direction === "rtl" && (r += X(e.clientWidth, n.clientWidth) - i), {
|
|
702
704
|
width: i,
|
|
703
705
|
height: s,
|
|
704
706
|
x: r,
|
|
@@ -706,7 +708,7 @@ function ae(t) {
|
|
|
706
708
|
};
|
|
707
709
|
}
|
|
708
710
|
function fe(t, e) {
|
|
709
|
-
const o = C(t), n =
|
|
711
|
+
const o = C(t), n = F(t), i = o.visualViewport;
|
|
710
712
|
let s = n.clientWidth, r = n.clientHeight, c = 0, l = 0;
|
|
711
713
|
if (i) {
|
|
712
714
|
s = i.width, r = i.height;
|
|
@@ -721,7 +723,7 @@ function fe(t, e) {
|
|
|
721
723
|
};
|
|
722
724
|
}
|
|
723
725
|
function ue(t, e) {
|
|
724
|
-
const o = Q(t, !0, e === "fixed"), n = o.top + t.clientTop, i = o.left + t.clientLeft, s =
|
|
726
|
+
const o = Q(t, !0, e === "fixed"), n = o.top + t.clientTop, i = o.left + t.clientLeft, s = N(t) ? K(t) : D(1), r = t.clientWidth * s.x, c = t.clientHeight * s.y, l = i * s.x, a = n * s.y;
|
|
725
727
|
return {
|
|
726
728
|
width: r,
|
|
727
729
|
height: c,
|
|
@@ -734,8 +736,8 @@ function Tt(t, e, o) {
|
|
|
734
736
|
if (e === "viewport")
|
|
735
737
|
n = fe(t, o);
|
|
736
738
|
else if (e === "document")
|
|
737
|
-
n = ae(
|
|
738
|
-
else if (
|
|
739
|
+
n = ae(F(t));
|
|
740
|
+
else if (L(e))
|
|
739
741
|
n = ue(e, o);
|
|
740
742
|
else {
|
|
741
743
|
const i = Ft(t);
|
|
@@ -749,19 +751,19 @@ function Tt(t, e, o) {
|
|
|
749
751
|
return st(n);
|
|
750
752
|
}
|
|
751
753
|
function Wt(t, e) {
|
|
752
|
-
const o =
|
|
753
|
-
return o === e || !
|
|
754
|
+
const o = H(t);
|
|
755
|
+
return o === e || !L(o) || U(o) ? !1 : E(o).position === "fixed" || Wt(o, e);
|
|
754
756
|
}
|
|
755
757
|
function de(t, e) {
|
|
756
758
|
const o = e.get(t);
|
|
757
759
|
if (o)
|
|
758
760
|
return o;
|
|
759
|
-
let n = Nt(t, []).filter((c) =>
|
|
760
|
-
const s =
|
|
761
|
-
let r = s ?
|
|
762
|
-
for (;
|
|
763
|
-
const c =
|
|
764
|
-
!l && c.position === "fixed" && (i = null), (s ? !l && !i : !l && c.position === "static" && !!i && ["absolute", "fixed"].includes(i.position) || et(r) && !l && Wt(t, r)) ? n = n.filter((d) => d !== r) : i = c, r =
|
|
761
|
+
let n = Nt(t, []).filter((c) => L(c) && q(c) !== "body"), i = null;
|
|
762
|
+
const s = E(t).position === "fixed";
|
|
763
|
+
let r = s ? H(t) : t;
|
|
764
|
+
for (; L(r) && !U(r); ) {
|
|
765
|
+
const c = E(r), l = wt(r);
|
|
766
|
+
!l && c.position === "fixed" && (i = null), (s ? !l && !i : !l && c.position === "static" && !!i && ["absolute", "fixed"].includes(i.position) || et(r) && !l && Wt(t, r)) ? n = n.filter((d) => d !== r) : i = c, r = H(r);
|
|
765
767
|
}
|
|
766
768
|
return e.set(t, n), n;
|
|
767
769
|
}
|
|
@@ -774,7 +776,7 @@ function me(t) {
|
|
|
774
776
|
} = t;
|
|
775
777
|
const r = [...o === "clippingAncestors" ? ct(e) ? [] : de(e, this._c) : [].concat(o), n], c = r[0], l = r.reduce((a, d) => {
|
|
776
778
|
const f = Tt(e, d, i);
|
|
777
|
-
return a.top =
|
|
779
|
+
return a.top = X(f.top, a.top), a.right = J(f.right, a.right), a.bottom = J(f.bottom, a.bottom), a.left = X(f.left, a.left), a;
|
|
778
780
|
}, Tt(e, c, i));
|
|
779
781
|
return {
|
|
780
782
|
width: l.right - l.left,
|
|
@@ -794,46 +796,50 @@ function pe(t) {
|
|
|
794
796
|
};
|
|
795
797
|
}
|
|
796
798
|
function ge(t, e, o) {
|
|
797
|
-
const n =
|
|
799
|
+
const n = N(e), i = F(e), s = o === "fixed", r = Q(t, !0, s, e);
|
|
798
800
|
let c = {
|
|
799
801
|
scrollLeft: 0,
|
|
800
802
|
scrollTop: 0
|
|
801
803
|
};
|
|
802
|
-
const l =
|
|
804
|
+
const l = D(0);
|
|
805
|
+
function a() {
|
|
806
|
+
l.x = yt(i);
|
|
807
|
+
}
|
|
803
808
|
if (n || !n && !s)
|
|
804
809
|
if ((q(e) !== "body" || et(i)) && (c = lt(e)), n) {
|
|
805
|
-
const
|
|
806
|
-
l.x =
|
|
807
|
-
} else i && (
|
|
808
|
-
|
|
810
|
+
const u = Q(e, !0, s, e);
|
|
811
|
+
l.x = u.x + e.clientLeft, l.y = u.y + e.clientTop;
|
|
812
|
+
} else i && a();
|
|
813
|
+
s && !n && i && a();
|
|
814
|
+
const d = i && !n && !s ? Vt(i, c) : D(0), f = r.left + c.scrollLeft - l.x - d.x, p = r.top + c.scrollTop - l.y - d.y;
|
|
809
815
|
return {
|
|
810
|
-
x:
|
|
811
|
-
y:
|
|
816
|
+
x: f,
|
|
817
|
+
y: p,
|
|
812
818
|
width: r.width,
|
|
813
819
|
height: r.height
|
|
814
820
|
};
|
|
815
821
|
}
|
|
816
822
|
function at(t) {
|
|
817
|
-
return
|
|
823
|
+
return E(t).position === "static";
|
|
818
824
|
}
|
|
819
825
|
function Ot(t, e) {
|
|
820
|
-
if (!
|
|
826
|
+
if (!N(t) || E(t).position === "fixed")
|
|
821
827
|
return null;
|
|
822
828
|
if (e)
|
|
823
829
|
return e(t);
|
|
824
830
|
let o = t.offsetParent;
|
|
825
|
-
return
|
|
831
|
+
return F(t) === o && (o = o.ownerDocument.body), o;
|
|
826
832
|
}
|
|
827
833
|
function $t(t, e) {
|
|
828
834
|
const o = C(t);
|
|
829
835
|
if (ct(t))
|
|
830
836
|
return o;
|
|
831
|
-
if (!
|
|
832
|
-
let i =
|
|
837
|
+
if (!N(t)) {
|
|
838
|
+
let i = H(t);
|
|
833
839
|
for (; i && !U(i); ) {
|
|
834
|
-
if (
|
|
840
|
+
if (L(i) && !at(i))
|
|
835
841
|
return i;
|
|
836
|
-
i =
|
|
842
|
+
i = H(i);
|
|
837
843
|
}
|
|
838
844
|
return o;
|
|
839
845
|
}
|
|
@@ -855,18 +861,18 @@ const he = async function(t) {
|
|
|
855
861
|
};
|
|
856
862
|
};
|
|
857
863
|
function we(t) {
|
|
858
|
-
return
|
|
864
|
+
return E(t).direction === "rtl";
|
|
859
865
|
}
|
|
860
866
|
const xe = {
|
|
861
867
|
convertOffsetParentRelativeRectToViewportRelativeRect: ce,
|
|
862
|
-
getDocumentElement:
|
|
868
|
+
getDocumentElement: F,
|
|
863
869
|
getClippingRect: me,
|
|
864
870
|
getOffsetParent: $t,
|
|
865
871
|
getElementRects: he,
|
|
866
872
|
getClientRects: le,
|
|
867
873
|
getDimensions: pe,
|
|
868
|
-
getScale:
|
|
869
|
-
isElement:
|
|
874
|
+
getScale: K,
|
|
875
|
+
isElement: L,
|
|
870
876
|
isRTL: we
|
|
871
877
|
}, ye = ee, be = ne, ve = Zt, Ae = Qt, Ce = (t, e, o) => {
|
|
872
878
|
const n = /* @__PURE__ */ new Map(), i = {
|
|
@@ -910,36 +916,36 @@ function Oe(t, e) {
|
|
|
910
916
|
}, []);
|
|
911
917
|
return pt(() => (s.current = t, o && r(), c), [t, o, r, c]), { start: r, stop: c, active: o };
|
|
912
918
|
}
|
|
913
|
-
const nt = (t, e = "px") => typeof t > "u" ? "" : `${Math.round(t)}${e}`, Re = () =>
|
|
919
|
+
const nt = (t, e = "px") => typeof t > "u" ? "" : `${Math.round(t)}${e}`, Re = () => Y("absolute top-0 left-0 w-max py-1 px-2 rounded-sm text-sm z-50"), Lt = ({
|
|
914
920
|
mode: t
|
|
915
|
-
}) =>
|
|
921
|
+
}) => Y({
|
|
916
922
|
"bg-surface-darker": t === "dark" || t === "system",
|
|
917
923
|
"bg-surface-light": t === "light" || t === "alt-system",
|
|
918
924
|
"dark:bg-surface-light": t === "system",
|
|
919
925
|
"dark:bg-surface-darker": t === "alt-system"
|
|
920
|
-
}),
|
|
926
|
+
}), Le = ({
|
|
921
927
|
mode: t
|
|
922
|
-
}) =>
|
|
928
|
+
}) => Y({
|
|
923
929
|
"text-copy-light": t === "dark" || t === "system",
|
|
924
930
|
"text-copy-dark": t === "light" || t === "alt-system",
|
|
925
931
|
"dark:text-copy-dark": t === "system",
|
|
926
932
|
"dark:text-copy-light": t === "alt-system"
|
|
927
|
-
}),
|
|
933
|
+
}), Ee = () => Y("absolute", "size-2", "transform rotate-45"), ke = ({
|
|
928
934
|
mode: t,
|
|
929
935
|
className: e,
|
|
930
936
|
tooltipClassName: o,
|
|
931
937
|
arrowClassName: n
|
|
932
938
|
}) => {
|
|
933
|
-
const i =
|
|
939
|
+
const i = Y("relative inline-block", e), s = Y(
|
|
934
940
|
_t,
|
|
935
941
|
Re(),
|
|
936
|
-
|
|
937
|
-
|
|
942
|
+
Lt({ mode: t }),
|
|
943
|
+
Le({ mode: t }),
|
|
938
944
|
o
|
|
939
|
-
), r =
|
|
945
|
+
), r = Y(
|
|
940
946
|
jt,
|
|
941
|
-
|
|
942
|
-
|
|
947
|
+
Ee(),
|
|
948
|
+
Lt({ mode: t }),
|
|
943
949
|
n
|
|
944
950
|
);
|
|
945
951
|
return { tooltip: s, arrow: r, wrapper: i };
|
|
@@ -964,14 +970,14 @@ const nt = (t, e = "px") => typeof t > "u" ? "" : `${Math.round(t)}${e}`, Re = (
|
|
|
964
970
|
className: s,
|
|
965
971
|
tooltipClassName: r,
|
|
966
972
|
arrowClassName: c
|
|
967
|
-
}),
|
|
968
|
-
var
|
|
973
|
+
}), x = Se({ delay: i }), w = ut(async () => {
|
|
974
|
+
var M, k, V, S;
|
|
969
975
|
if (l.current && a.current && d.current) {
|
|
970
976
|
const {
|
|
971
|
-
x:
|
|
972
|
-
y:
|
|
973
|
-
middlewareData:
|
|
974
|
-
placement:
|
|
977
|
+
x: T,
|
|
978
|
+
y: I,
|
|
979
|
+
middlewareData: P,
|
|
980
|
+
placement: _
|
|
975
981
|
} = await Ce(l.current, a.current, {
|
|
976
982
|
placement: o,
|
|
977
983
|
middleware: [
|
|
@@ -984,29 +990,29 @@ const nt = (t, e = "px") => typeof t > "u" ? "" : `${Math.round(t)}${e}`, Re = (
|
|
|
984
990
|
Ae({ element: d.current })
|
|
985
991
|
]
|
|
986
992
|
});
|
|
987
|
-
(
|
|
988
|
-
left: nt(
|
|
989
|
-
top: nt(
|
|
990
|
-
...
|
|
993
|
+
(M = a == null ? void 0 : a.current) != null && M.style && Object.assign(a.current.style, {
|
|
994
|
+
left: nt(T),
|
|
995
|
+
top: nt(I),
|
|
996
|
+
...x
|
|
991
997
|
});
|
|
992
998
|
const v = {
|
|
993
999
|
top: "bottom",
|
|
994
1000
|
right: "left",
|
|
995
1001
|
bottom: "top",
|
|
996
1002
|
left: "right"
|
|
997
|
-
}[
|
|
998
|
-
(
|
|
999
|
-
left: nt((
|
|
1000
|
-
top: nt((
|
|
1003
|
+
}[_.split("-")[0]];
|
|
1004
|
+
(k = d == null ? void 0 : d.current) != null && k.style && Object.assign(d.current.style, {
|
|
1005
|
+
left: nt((V = P.arrow) == null ? void 0 : V.x),
|
|
1006
|
+
top: nt((S = P.arrow) == null ? void 0 : S.y),
|
|
1001
1007
|
right: "",
|
|
1002
1008
|
bottom: "",
|
|
1003
1009
|
[v]: "-4px"
|
|
1004
1010
|
});
|
|
1005
1011
|
}
|
|
1006
|
-
}, [o,
|
|
1012
|
+
}, [o, x, l]);
|
|
1007
1013
|
pt(() => {
|
|
1008
|
-
(async () => f && await
|
|
1009
|
-
}, [
|
|
1014
|
+
(async () => f && await w())();
|
|
1015
|
+
}, [w, f]);
|
|
1010
1016
|
const y = () => {
|
|
1011
1017
|
p(!1), m(!0), g.start();
|
|
1012
1018
|
}, A = () => {
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { TOOLTIP_ARROW_CLASSNAME as T, TOOLTIP_CLASSNAME as I, Tooltip as e } from "./components/Tooltip/Tooltip.js";
|
|
2
2
|
/*!
|
|
3
|
-
@versini/ui-tooltip v2.0.
|
|
3
|
+
@versini/ui-tooltip v2.0.4
|
|
4
4
|
© 2025 gizmette.com
|
|
5
5
|
*/
|
|
6
6
|
try {
|
|
7
7
|
window.__VERSINI_UI_TOOLTIP__ || (window.__VERSINI_UI_TOOLTIP__ = {
|
|
8
|
-
version: "2.0.
|
|
9
|
-
buildTime: "
|
|
8
|
+
version: "2.0.4",
|
|
9
|
+
buildTime: "06/20/2025 05:22 PM EDT",
|
|
10
10
|
homepage: "https://github.com/aversini/ui-components",
|
|
11
11
|
license: "MIT"
|
|
12
12
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-tooltip",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -39,17 +39,17 @@
|
|
|
39
39
|
"react-dom": "^18.3.1 || ^19.0.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@versini/ui-types": "5.0.
|
|
42
|
+
"@versini/ui-types": "5.0.4"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@floating-ui/dom": "1.
|
|
45
|
+
"@floating-ui/dom": "1.7.1",
|
|
46
46
|
"@tailwindcss/typography": "0.5.16",
|
|
47
|
-
"@versini/ui-hooks": "4.7.
|
|
47
|
+
"@versini/ui-hooks": "4.7.4",
|
|
48
48
|
"clsx": "2.1.1",
|
|
49
|
-
"tailwindcss": "4.1.
|
|
49
|
+
"tailwindcss": "4.1.10"
|
|
50
50
|
},
|
|
51
51
|
"sideEffects": [
|
|
52
52
|
"**/*.css"
|
|
53
53
|
],
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "2fffae99315244f0662bdecbe45a89bc770f0f15"
|
|
55
55
|
}
|