@versini/ui-tooltip 2.0.4 → 2.1.1
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 +112 -996
- package/dist/index.js +3 -3
- package/package.json +7 -6
|
@@ -1,1044 +1,160 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return X(t, J(e, o));
|
|
18
|
-
}
|
|
19
|
-
function Z(t, e) {
|
|
20
|
-
return typeof t == "function" ? t(e) : t;
|
|
21
|
-
}
|
|
22
|
-
function z(t) {
|
|
23
|
-
return t.split("-")[0];
|
|
24
|
-
}
|
|
25
|
-
function tt(t) {
|
|
26
|
-
return t.split("-")[1];
|
|
27
|
-
}
|
|
28
|
-
function Et(t) {
|
|
29
|
-
return t === "x" ? "y" : "x";
|
|
30
|
-
}
|
|
31
|
-
function gt(t) {
|
|
32
|
-
return t === "y" ? "height" : "width";
|
|
33
|
-
}
|
|
34
|
-
function $(t) {
|
|
35
|
-
return ["top", "bottom"].includes(z(t)) ? "y" : "x";
|
|
36
|
-
}
|
|
37
|
-
function ht(t) {
|
|
38
|
-
return Et($(t));
|
|
39
|
-
}
|
|
40
|
-
function Xt(t, e, o) {
|
|
41
|
-
o === void 0 && (o = !1);
|
|
42
|
-
const n = tt(t), i = ht(t), s = gt(i);
|
|
43
|
-
let r = i === "x" ? n === (o ? "end" : "start") ? "right" : "left" : n === "start" ? "bottom" : "top";
|
|
44
|
-
return e.reference[s] > e.floating[s] && (r = it(r)), [r, it(r)];
|
|
45
|
-
}
|
|
46
|
-
function Kt(t) {
|
|
47
|
-
const e = it(t);
|
|
48
|
-
return [mt(t), e, mt(e)];
|
|
49
|
-
}
|
|
50
|
-
function mt(t) {
|
|
51
|
-
return t.replace(/start|end/g, (e) => zt[e]);
|
|
52
|
-
}
|
|
53
|
-
function Ut(t, e, o) {
|
|
54
|
-
const n = ["left", "right"], i = ["right", "left"], s = ["top", "bottom"], r = ["bottom", "top"];
|
|
55
|
-
switch (t) {
|
|
56
|
-
case "top":
|
|
57
|
-
case "bottom":
|
|
58
|
-
return o ? e ? i : n : e ? n : i;
|
|
59
|
-
case "left":
|
|
60
|
-
case "right":
|
|
61
|
-
return e ? s : r;
|
|
62
|
-
default:
|
|
63
|
-
return [];
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
function qt(t, e, o, n) {
|
|
67
|
-
const i = tt(t);
|
|
68
|
-
let s = Ut(z(t), o === "start", n);
|
|
69
|
-
return i && (s = s.map((r) => r + "-" + i), e && (s = s.concat(s.map(mt)))), s;
|
|
70
|
-
}
|
|
71
|
-
function it(t) {
|
|
72
|
-
return t.replace(/left|right|bottom|top/g, (e) => Yt[e]);
|
|
73
|
-
}
|
|
74
|
-
function Gt(t) {
|
|
75
|
-
return {
|
|
76
|
-
top: 0,
|
|
77
|
-
right: 0,
|
|
78
|
-
bottom: 0,
|
|
79
|
-
left: 0,
|
|
80
|
-
...t
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
function kt(t) {
|
|
84
|
-
return typeof t != "number" ? Gt(t) : {
|
|
85
|
-
top: t,
|
|
86
|
-
right: t,
|
|
87
|
-
bottom: t,
|
|
88
|
-
left: t
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
function st(t) {
|
|
92
|
-
const {
|
|
93
|
-
x: e,
|
|
94
|
-
y: o,
|
|
95
|
-
width: n,
|
|
96
|
-
height: i
|
|
97
|
-
} = t;
|
|
98
|
-
return {
|
|
99
|
-
width: n,
|
|
100
|
-
height: i,
|
|
101
|
-
top: o,
|
|
102
|
-
left: e,
|
|
103
|
-
right: e + n,
|
|
104
|
-
bottom: o + i,
|
|
105
|
-
x: e,
|
|
106
|
-
y: o
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
function vt(t, e, o) {
|
|
110
|
-
let {
|
|
111
|
-
reference: n,
|
|
112
|
-
floating: i
|
|
113
|
-
} = t;
|
|
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
|
-
let u;
|
|
116
|
-
switch (l) {
|
|
117
|
-
case "top":
|
|
118
|
-
u = {
|
|
119
|
-
x: d,
|
|
120
|
-
y: n.y - i.height
|
|
121
|
-
};
|
|
122
|
-
break;
|
|
123
|
-
case "bottom":
|
|
124
|
-
u = {
|
|
125
|
-
x: d,
|
|
126
|
-
y: n.y + n.height
|
|
127
|
-
};
|
|
128
|
-
break;
|
|
129
|
-
case "right":
|
|
130
|
-
u = {
|
|
131
|
-
x: n.x + n.width,
|
|
132
|
-
y: f
|
|
133
|
-
};
|
|
134
|
-
break;
|
|
135
|
-
case "left":
|
|
136
|
-
u = {
|
|
137
|
-
x: n.x - i.width,
|
|
138
|
-
y: f
|
|
139
|
-
};
|
|
140
|
-
break;
|
|
141
|
-
default:
|
|
142
|
-
u = {
|
|
143
|
-
x: n.x,
|
|
144
|
-
y: n.y
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
switch (tt(e)) {
|
|
148
|
-
case "start":
|
|
149
|
-
u[r] -= p * (o && a ? -1 : 1);
|
|
150
|
-
break;
|
|
151
|
-
case "end":
|
|
152
|
-
u[r] += p * (o && a ? -1 : 1);
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
return u;
|
|
156
|
-
}
|
|
157
|
-
const Jt = async (t, e, o) => {
|
|
158
|
-
const {
|
|
159
|
-
placement: n = "bottom",
|
|
160
|
-
strategy: i = "absolute",
|
|
161
|
-
middleware: s = [],
|
|
162
|
-
platform: r
|
|
163
|
-
} = o, c = s.filter(Boolean), l = await (r.isRTL == null ? void 0 : r.isRTL(e));
|
|
164
|
-
let a = await r.getElementRects({
|
|
165
|
-
reference: t,
|
|
166
|
-
floating: e,
|
|
167
|
-
strategy: i
|
|
168
|
-
}), {
|
|
169
|
-
x: d,
|
|
170
|
-
y: f
|
|
171
|
-
} = vt(a, n, l), p = n, u = {}, m = 0;
|
|
172
|
-
for (let g = 0; g < c.length; g++) {
|
|
173
|
-
const {
|
|
174
|
-
name: h,
|
|
175
|
-
fn: x
|
|
176
|
-
} = c[g], {
|
|
177
|
-
x: w,
|
|
178
|
-
y,
|
|
179
|
-
data: A,
|
|
180
|
-
reset: b
|
|
181
|
-
} = await x({
|
|
182
|
-
x: d,
|
|
183
|
-
y: f,
|
|
184
|
-
initialPlacement: n,
|
|
185
|
-
placement: p,
|
|
186
|
-
strategy: i,
|
|
187
|
-
middlewareData: u,
|
|
188
|
-
rects: a,
|
|
189
|
-
platform: r,
|
|
190
|
-
elements: {
|
|
191
|
-
reference: t,
|
|
192
|
-
floating: e
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
d = w ?? d, f = y ?? f, u = {
|
|
196
|
-
...u,
|
|
197
|
-
[h]: {
|
|
198
|
-
...u[h],
|
|
199
|
-
...A
|
|
200
|
-
}
|
|
201
|
-
}, b && m <= 50 && (m++, typeof b == "object" && (b.placement && (p = b.placement), b.rects && (a = b.rects === !0 ? await r.getElementRects({
|
|
202
|
-
reference: t,
|
|
203
|
-
floating: e,
|
|
204
|
-
strategy: i
|
|
205
|
-
}) : b.rects), {
|
|
206
|
-
x: d,
|
|
207
|
-
y: f
|
|
208
|
-
} = vt(a, p, l)), g = -1);
|
|
209
|
-
}
|
|
210
|
-
return {
|
|
211
|
-
x: d,
|
|
212
|
-
y: f,
|
|
213
|
-
placement: p,
|
|
214
|
-
strategy: i,
|
|
215
|
-
middlewareData: u
|
|
216
|
-
};
|
|
217
|
-
};
|
|
218
|
-
async function St(t, e) {
|
|
219
|
-
var o;
|
|
220
|
-
e === void 0 && (e = {});
|
|
221
|
-
const {
|
|
222
|
-
x: n,
|
|
223
|
-
y: i,
|
|
224
|
-
platform: s,
|
|
225
|
-
rects: r,
|
|
226
|
-
elements: c,
|
|
227
|
-
strategy: l
|
|
228
|
-
} = t, {
|
|
229
|
-
boundary: a = "clippingAncestors",
|
|
230
|
-
rootBoundary: d = "viewport",
|
|
231
|
-
elementContext: f = "floating",
|
|
232
|
-
altBoundary: p = !1,
|
|
233
|
-
padding: u = 0
|
|
234
|
-
} = Z(e, t), m = kt(u), h = c[p ? f === "floating" ? "reference" : "floating" : f], x = st(await s.getClippingRect({
|
|
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
|
-
boundary: a,
|
|
237
|
-
rootBoundary: d,
|
|
238
|
-
strategy: l
|
|
239
|
-
})), w = f === "floating" ? {
|
|
240
|
-
x: n,
|
|
241
|
-
y: i,
|
|
242
|
-
width: r.floating.width,
|
|
243
|
-
height: r.floating.height
|
|
244
|
-
} : r.reference, y = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(c.floating)), A = await (s.isElement == null ? void 0 : s.isElement(y)) ? await (s.getScale == null ? void 0 : s.getScale(y)) || {
|
|
245
|
-
x: 1,
|
|
246
|
-
y: 1
|
|
247
|
-
} : {
|
|
248
|
-
x: 1,
|
|
249
|
-
y: 1
|
|
250
|
-
}, b = st(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
251
|
-
elements: c,
|
|
252
|
-
rect: w,
|
|
253
|
-
offsetParent: y,
|
|
254
|
-
strategy: l
|
|
255
|
-
}) : w);
|
|
256
|
-
return {
|
|
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
|
-
};
|
|
262
|
-
}
|
|
263
|
-
const Qt = (t) => ({
|
|
264
|
-
name: "arrow",
|
|
265
|
-
options: t,
|
|
266
|
-
async fn(e) {
|
|
267
|
-
const {
|
|
268
|
-
x: o,
|
|
269
|
-
y: n,
|
|
270
|
-
placement: i,
|
|
271
|
-
rects: s,
|
|
272
|
-
platform: r,
|
|
273
|
-
elements: c,
|
|
274
|
-
middlewareData: l
|
|
275
|
-
} = e, {
|
|
276
|
-
element: a,
|
|
277
|
-
padding: d = 0
|
|
278
|
-
} = Z(t, e) || {};
|
|
279
|
-
if (a == null)
|
|
280
|
-
return {};
|
|
281
|
-
const f = kt(d), p = {
|
|
282
|
-
x: o,
|
|
283
|
-
y: n
|
|
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
|
-
return {
|
|
289
|
-
[u]: p[u] + O,
|
|
290
|
-
data: {
|
|
291
|
-
[u]: j,
|
|
292
|
-
centerOffset: v - j - O,
|
|
293
|
-
...B && {
|
|
294
|
-
alignmentOffset: O
|
|
295
|
-
}
|
|
296
|
-
},
|
|
297
|
-
reset: B
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
}), Zt = function(t) {
|
|
301
|
-
return t === void 0 && (t = {}), {
|
|
302
|
-
name: "flip",
|
|
303
|
-
options: t,
|
|
304
|
-
async fn(e) {
|
|
305
|
-
var o, n;
|
|
306
|
-
const {
|
|
307
|
-
placement: i,
|
|
308
|
-
middlewareData: s,
|
|
309
|
-
rects: r,
|
|
310
|
-
initialPlacement: c,
|
|
311
|
-
platform: l,
|
|
312
|
-
elements: a
|
|
313
|
-
} = e, {
|
|
314
|
-
mainAxis: d = !0,
|
|
315
|
-
crossAxis: f = !0,
|
|
316
|
-
fallbackPlacements: p,
|
|
317
|
-
fallbackStrategy: u = "bestFit",
|
|
318
|
-
fallbackAxisSideDirection: m = "none",
|
|
319
|
-
flipAlignment: g = !0,
|
|
320
|
-
...h
|
|
321
|
-
} = Z(t, e);
|
|
322
|
-
if ((o = s.arrow) != null && o.alignmentOffset)
|
|
323
|
-
return {};
|
|
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
|
-
const v = Xt(i, r, A);
|
|
330
|
-
S.push(V[v[0]], V[v[1]]);
|
|
331
|
-
}
|
|
332
|
-
if (T = [...T, {
|
|
333
|
-
placement: i,
|
|
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)))
|
|
341
|
-
return {
|
|
342
|
-
data: {
|
|
343
|
-
index: v,
|
|
344
|
-
overflows: T
|
|
345
|
-
},
|
|
346
|
-
reset: {
|
|
347
|
-
placement: j
|
|
348
|
-
}
|
|
349
|
-
};
|
|
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)
|
|
352
|
-
switch (u) {
|
|
353
|
-
case "bestFit": {
|
|
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
|
|
359
|
-
// reading directions favoring greater width.
|
|
360
|
-
W === "y";
|
|
361
|
-
}
|
|
362
|
-
return !0;
|
|
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);
|
|
365
|
-
break;
|
|
366
|
-
}
|
|
367
|
-
case "initialPlacement":
|
|
368
|
-
B = c;
|
|
369
|
-
break;
|
|
370
|
-
}
|
|
371
|
-
if (i !== B)
|
|
372
|
-
return {
|
|
373
|
-
reset: {
|
|
374
|
-
placement: B
|
|
375
|
-
}
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
|
-
return {};
|
|
379
|
-
}
|
|
380
|
-
};
|
|
381
|
-
};
|
|
382
|
-
async function te(t, e) {
|
|
383
|
-
const {
|
|
384
|
-
placement: o,
|
|
385
|
-
platform: n,
|
|
386
|
-
elements: i
|
|
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);
|
|
388
|
-
let {
|
|
389
|
-
mainAxis: p,
|
|
390
|
-
crossAxis: u,
|
|
391
|
-
alignmentAxis: m
|
|
392
|
-
} = typeof f == "number" ? {
|
|
393
|
-
mainAxis: f,
|
|
394
|
-
crossAxis: 0,
|
|
395
|
-
alignmentAxis: null
|
|
396
|
-
} : {
|
|
397
|
-
mainAxis: f.mainAxis || 0,
|
|
398
|
-
crossAxis: f.crossAxis || 0,
|
|
399
|
-
alignmentAxis: f.alignmentAxis
|
|
400
|
-
};
|
|
401
|
-
return c && typeof m == "number" && (u = c === "end" ? m * -1 : m), l ? {
|
|
402
|
-
x: u * d,
|
|
403
|
-
y: p * a
|
|
404
|
-
} : {
|
|
405
|
-
x: p * a,
|
|
406
|
-
y: u * d
|
|
407
|
-
};
|
|
408
|
-
}
|
|
409
|
-
const ee = function(t) {
|
|
410
|
-
return t === void 0 && (t = 0), {
|
|
411
|
-
name: "offset",
|
|
412
|
-
options: t,
|
|
413
|
-
async fn(e) {
|
|
414
|
-
var o, n;
|
|
415
|
-
const {
|
|
416
|
-
x: i,
|
|
417
|
-
y: s,
|
|
418
|
-
placement: r,
|
|
419
|
-
middlewareData: c
|
|
420
|
-
} = e, l = await te(e, t);
|
|
421
|
-
return r === ((o = c.offset) == null ? void 0 : o.placement) && (n = c.arrow) != null && n.alignmentOffset ? {} : {
|
|
422
|
-
x: i + l.x,
|
|
423
|
-
y: s + l.y,
|
|
424
|
-
data: {
|
|
425
|
-
...l,
|
|
426
|
-
placement: r
|
|
427
|
-
}
|
|
428
|
-
};
|
|
429
|
-
}
|
|
430
|
-
};
|
|
431
|
-
}, ne = function(t) {
|
|
432
|
-
return t === void 0 && (t = {}), {
|
|
433
|
-
name: "shift",
|
|
434
|
-
options: t,
|
|
435
|
-
async fn(e) {
|
|
436
|
-
const {
|
|
437
|
-
x: o,
|
|
438
|
-
y: n,
|
|
439
|
-
placement: i
|
|
440
|
-
} = e, {
|
|
441
|
-
mainAxis: s = !0,
|
|
442
|
-
crossAxis: r = !1,
|
|
443
|
-
limiter: c = {
|
|
444
|
-
fn: (h) => {
|
|
445
|
-
let {
|
|
446
|
-
x,
|
|
447
|
-
y: w
|
|
448
|
-
} = h;
|
|
449
|
-
return {
|
|
450
|
-
x,
|
|
451
|
-
y: w
|
|
452
|
-
};
|
|
453
|
-
}
|
|
454
|
-
},
|
|
455
|
-
...l
|
|
456
|
-
} = Z(t, e), a = {
|
|
457
|
-
x: o,
|
|
458
|
-
y: n
|
|
459
|
-
}, d = await St(e, l), f = $(z(i)), p = Et(f);
|
|
460
|
-
let u = a[p], m = a[f];
|
|
461
|
-
if (s) {
|
|
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);
|
|
464
|
-
}
|
|
465
|
-
if (r) {
|
|
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);
|
|
468
|
-
}
|
|
469
|
-
const g = c.fn({
|
|
470
|
-
...e,
|
|
471
|
-
[p]: u,
|
|
472
|
-
[f]: m
|
|
473
|
-
});
|
|
474
|
-
return {
|
|
475
|
-
...g,
|
|
476
|
-
data: {
|
|
477
|
-
x: g.x - o,
|
|
478
|
-
y: g.y - n,
|
|
479
|
-
enabled: {
|
|
480
|
-
[p]: s,
|
|
481
|
-
[f]: r
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
};
|
|
485
|
-
}
|
|
486
|
-
};
|
|
487
|
-
};
|
|
488
|
-
function rt() {
|
|
489
|
-
return typeof window < "u";
|
|
490
|
-
}
|
|
491
|
-
function q(t) {
|
|
492
|
-
return Pt(t) ? (t.nodeName || "").toLowerCase() : "#document";
|
|
493
|
-
}
|
|
494
|
-
function C(t) {
|
|
495
|
-
var e;
|
|
496
|
-
return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
|
|
497
|
-
}
|
|
498
|
-
function F(t) {
|
|
499
|
-
var e;
|
|
500
|
-
return (e = (Pt(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
|
|
501
|
-
}
|
|
502
|
-
function Pt(t) {
|
|
503
|
-
return rt() ? t instanceof Node || t instanceof C(t).Node : !1;
|
|
504
|
-
}
|
|
505
|
-
function L(t) {
|
|
506
|
-
return rt() ? t instanceof Element || t instanceof C(t).Element : !1;
|
|
507
|
-
}
|
|
508
|
-
function N(t) {
|
|
509
|
-
return rt() ? t instanceof HTMLElement || t instanceof C(t).HTMLElement : !1;
|
|
510
|
-
}
|
|
511
|
-
function At(t) {
|
|
512
|
-
return !rt() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof C(t).ShadowRoot;
|
|
513
|
-
}
|
|
514
|
-
function et(t) {
|
|
515
|
-
const {
|
|
516
|
-
overflow: e,
|
|
517
|
-
overflowX: o,
|
|
518
|
-
overflowY: n,
|
|
519
|
-
display: i
|
|
520
|
-
} = E(t);
|
|
521
|
-
return /auto|scroll|overlay|hidden|clip/.test(e + n + o) && !["inline", "contents"].includes(i);
|
|
522
|
-
}
|
|
523
|
-
function oe(t) {
|
|
524
|
-
return ["table", "td", "th"].includes(q(t));
|
|
525
|
-
}
|
|
526
|
-
function ct(t) {
|
|
527
|
-
return [":popover-open", ":modal"].some((e) => {
|
|
528
|
-
try {
|
|
529
|
-
return t.matches(e);
|
|
530
|
-
} catch {
|
|
531
|
-
return !1;
|
|
532
|
-
}
|
|
533
|
-
});
|
|
534
|
-
}
|
|
535
|
-
function wt(t) {
|
|
536
|
-
const e = xt(), o = L(t) ? E(t) : t;
|
|
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));
|
|
538
|
-
}
|
|
539
|
-
function ie(t) {
|
|
540
|
-
let e = H(t);
|
|
541
|
-
for (; N(e) && !U(e); ) {
|
|
542
|
-
if (wt(e))
|
|
543
|
-
return e;
|
|
544
|
-
if (ct(e))
|
|
545
|
-
return null;
|
|
546
|
-
e = H(e);
|
|
547
|
-
}
|
|
548
|
-
return null;
|
|
549
|
-
}
|
|
550
|
-
function xt() {
|
|
551
|
-
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
|
|
552
|
-
}
|
|
553
|
-
function U(t) {
|
|
554
|
-
return ["html", "body", "#document"].includes(q(t));
|
|
555
|
-
}
|
|
556
|
-
function E(t) {
|
|
557
|
-
return C(t).getComputedStyle(t);
|
|
558
|
-
}
|
|
559
|
-
function lt(t) {
|
|
560
|
-
return L(t) ? {
|
|
561
|
-
scrollLeft: t.scrollLeft,
|
|
562
|
-
scrollTop: t.scrollTop
|
|
563
|
-
} : {
|
|
564
|
-
scrollLeft: t.scrollX,
|
|
565
|
-
scrollTop: t.scrollY
|
|
566
|
-
};
|
|
567
|
-
}
|
|
568
|
-
function H(t) {
|
|
569
|
-
if (q(t) === "html")
|
|
570
|
-
return t;
|
|
571
|
-
const e = (
|
|
572
|
-
// Step into the shadow DOM of the parent of a slotted node.
|
|
573
|
-
t.assignedSlot || // DOM Element detected.
|
|
574
|
-
t.parentNode || // ShadowRoot detected.
|
|
575
|
-
At(t) && t.host || // Fallback.
|
|
576
|
-
F(t)
|
|
577
|
-
);
|
|
578
|
-
return At(e) ? e.host : e;
|
|
579
|
-
}
|
|
580
|
-
function Dt(t) {
|
|
581
|
-
const e = H(t);
|
|
582
|
-
return U(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : N(e) && et(e) ? e : Dt(e);
|
|
583
|
-
}
|
|
584
|
-
function Nt(t, e, o) {
|
|
585
|
-
var n;
|
|
586
|
-
e === void 0 && (e = []);
|
|
587
|
-
const i = Dt(t), s = i === ((n = t.ownerDocument) == null ? void 0 : n.body), r = C(i);
|
|
588
|
-
return s ? e.concat(r, r.visualViewport || [], et(i) ? i : [], []) : e.concat(i, Nt(i, []));
|
|
589
|
-
}
|
|
590
|
-
function Ct(t) {
|
|
591
|
-
return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
|
|
592
|
-
}
|
|
593
|
-
function Mt(t) {
|
|
594
|
-
const e = E(t);
|
|
595
|
-
let o = parseFloat(e.width) || 0, n = parseFloat(e.height) || 0;
|
|
596
|
-
const i = N(t), s = i ? t.offsetWidth : o, r = i ? t.offsetHeight : n, c = ot(o) !== s || ot(n) !== r;
|
|
597
|
-
return c && (o = s, n = r), {
|
|
598
|
-
width: o,
|
|
599
|
-
height: n,
|
|
600
|
-
$: c
|
|
601
|
-
};
|
|
602
|
-
}
|
|
603
|
-
function Bt(t) {
|
|
604
|
-
return L(t) ? t : t.contextElement;
|
|
605
|
-
}
|
|
606
|
-
function K(t) {
|
|
607
|
-
const e = Bt(t);
|
|
608
|
-
if (!N(e))
|
|
609
|
-
return D(1);
|
|
610
|
-
const o = e.getBoundingClientRect(), {
|
|
611
|
-
width: n,
|
|
612
|
-
height: i,
|
|
613
|
-
$: s
|
|
614
|
-
} = Mt(e);
|
|
615
|
-
let r = (s ? ot(o.width) : o.width) / n, c = (s ? ot(o.height) : o.height) / i;
|
|
616
|
-
return (!r || !Number.isFinite(r)) && (r = 1), (!c || !Number.isFinite(c)) && (c = 1), {
|
|
617
|
-
x: r,
|
|
618
|
-
y: c
|
|
619
|
-
};
|
|
620
|
-
}
|
|
621
|
-
const se = /* @__PURE__ */ D(0);
|
|
622
|
-
function Ft(t) {
|
|
623
|
-
const e = C(t);
|
|
624
|
-
return !xt() || !e.visualViewport ? se : {
|
|
625
|
-
x: e.visualViewport.offsetLeft,
|
|
626
|
-
y: e.visualViewport.offsetTop
|
|
627
|
-
};
|
|
628
|
-
}
|
|
629
|
-
function re(t, e, o) {
|
|
630
|
-
return e === void 0 && (e = !1), !o || e && o !== C(t) ? !1 : e;
|
|
631
|
-
}
|
|
632
|
-
function Q(t, e, o, n) {
|
|
633
|
-
e === void 0 && (e = !1), o === void 0 && (o = !1);
|
|
634
|
-
const i = t.getBoundingClientRect(), s = Bt(t);
|
|
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);
|
|
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;
|
|
639
|
-
if (s) {
|
|
640
|
-
const p = C(s), u = n && L(n) ? C(n) : n;
|
|
641
|
-
let m = p, g = Ct(m);
|
|
642
|
-
for (; g && n && u !== m; ) {
|
|
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;
|
|
644
|
-
l *= h.x, a *= h.y, d *= h.x, f *= h.y, l += y, a += A, m = C(g), g = Ct(m);
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
return st({
|
|
648
|
-
width: d,
|
|
649
|
-
height: f,
|
|
650
|
-
x: l,
|
|
651
|
-
y: a
|
|
652
|
-
});
|
|
653
|
-
}
|
|
654
|
-
function yt(t, e) {
|
|
655
|
-
const o = lt(t).scrollLeft;
|
|
656
|
-
return e ? e.left + o : Q(F(t)).left + o;
|
|
657
|
-
}
|
|
658
|
-
function Vt(t, e, o) {
|
|
659
|
-
o === void 0 && (o = !1);
|
|
660
|
-
const n = t.getBoundingClientRect(), i = n.left + e.scrollLeft - (o ? 0 : (
|
|
661
|
-
// RTL <body> scrollbar.
|
|
662
|
-
yt(t, n)
|
|
663
|
-
)), s = n.top + e.scrollTop;
|
|
664
|
-
return {
|
|
665
|
-
x: i,
|
|
666
|
-
y: s
|
|
667
|
-
};
|
|
668
|
-
}
|
|
669
|
-
function ce(t) {
|
|
670
|
-
let {
|
|
671
|
-
elements: e,
|
|
672
|
-
rect: o,
|
|
673
|
-
offsetParent: n,
|
|
674
|
-
strategy: i
|
|
675
|
-
} = t;
|
|
676
|
-
const s = i === "fixed", r = F(n), c = e ? ct(e.floating) : !1;
|
|
677
|
-
if (n === r || c && s)
|
|
678
|
-
return o;
|
|
679
|
-
let l = {
|
|
680
|
-
scrollLeft: 0,
|
|
681
|
-
scrollTop: 0
|
|
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))) {
|
|
685
|
-
const u = Q(n);
|
|
686
|
-
a = K(n), d.x = u.x + n.clientLeft, d.y = u.y + n.clientTop;
|
|
687
|
-
}
|
|
688
|
-
const p = r && !f && !s ? Vt(r, l, !0) : D(0);
|
|
689
|
-
return {
|
|
690
|
-
width: o.width * a.x,
|
|
691
|
-
height: o.height * a.y,
|
|
692
|
-
x: o.x * a.x - l.scrollLeft * a.x + d.x + p.x,
|
|
693
|
-
y: o.y * a.y - l.scrollTop * a.y + d.y + p.y
|
|
694
|
-
};
|
|
695
|
-
}
|
|
696
|
-
function le(t) {
|
|
697
|
-
return Array.from(t.getClientRects());
|
|
698
|
-
}
|
|
699
|
-
function ae(t) {
|
|
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);
|
|
701
|
-
let r = -o.scrollLeft + yt(t);
|
|
702
|
-
const c = -o.scrollTop;
|
|
703
|
-
return E(n).direction === "rtl" && (r += X(e.clientWidth, n.clientWidth) - i), {
|
|
704
|
-
width: i,
|
|
705
|
-
height: s,
|
|
706
|
-
x: r,
|
|
707
|
-
y: c
|
|
708
|
-
};
|
|
709
|
-
}
|
|
710
|
-
function fe(t, e) {
|
|
711
|
-
const o = C(t), n = F(t), i = o.visualViewport;
|
|
712
|
-
let s = n.clientWidth, r = n.clientHeight, c = 0, l = 0;
|
|
713
|
-
if (i) {
|
|
714
|
-
s = i.width, r = i.height;
|
|
715
|
-
const a = xt();
|
|
716
|
-
(!a || a && e === "fixed") && (c = i.offsetLeft, l = i.offsetTop);
|
|
717
|
-
}
|
|
718
|
-
return {
|
|
719
|
-
width: s,
|
|
720
|
-
height: r,
|
|
721
|
-
x: c,
|
|
722
|
-
y: l
|
|
723
|
-
};
|
|
724
|
-
}
|
|
725
|
-
function ue(t, e) {
|
|
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;
|
|
727
|
-
return {
|
|
728
|
-
width: r,
|
|
729
|
-
height: c,
|
|
730
|
-
x: l,
|
|
731
|
-
y: a
|
|
732
|
-
};
|
|
733
|
-
}
|
|
734
|
-
function Tt(t, e, o) {
|
|
735
|
-
let n;
|
|
736
|
-
if (e === "viewport")
|
|
737
|
-
n = fe(t, o);
|
|
738
|
-
else if (e === "document")
|
|
739
|
-
n = ae(F(t));
|
|
740
|
-
else if (L(e))
|
|
741
|
-
n = ue(e, o);
|
|
742
|
-
else {
|
|
743
|
-
const i = Ft(t);
|
|
744
|
-
n = {
|
|
745
|
-
x: e.x - i.x,
|
|
746
|
-
y: e.y - i.y,
|
|
747
|
-
width: e.width,
|
|
748
|
-
height: e.height
|
|
1
|
+
import { jsxs as O, jsx as z } from "react/jsx-runtime";
|
|
2
|
+
import { computePosition as F, offset as H, flip as U, shift as V, arrow as W } from "@floating-ui/react";
|
|
3
|
+
import { useRef as f, useEffect as T, useState as w, useCallback as x } from "react";
|
|
4
|
+
import p from "clsx";
|
|
5
|
+
const Y = "av-tooltip", q = "av-tooltip-arrow", I = ["mousedown", "touchstart"];
|
|
6
|
+
function G(t, n, s) {
|
|
7
|
+
const a = f(null);
|
|
8
|
+
return T(() => {
|
|
9
|
+
const r = (e) => {
|
|
10
|
+
const o = e ? e.target : void 0;
|
|
11
|
+
if (Array.isArray(s)) {
|
|
12
|
+
const l = !document.body.contains(o) && o.tagName !== "HTML";
|
|
13
|
+
s.every(
|
|
14
|
+
(c) => !!c && !e.composedPath().includes(c)
|
|
15
|
+
) && !l && t();
|
|
16
|
+
} else a.current && !a.current.contains(o) && t();
|
|
749
17
|
};
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
}
|
|
753
|
-
function Wt(t, e) {
|
|
754
|
-
const o = H(t);
|
|
755
|
-
return o === e || !L(o) || U(o) ? !1 : E(o).position === "fixed" || Wt(o, e);
|
|
756
|
-
}
|
|
757
|
-
function de(t, e) {
|
|
758
|
-
const o = e.get(t);
|
|
759
|
-
if (o)
|
|
760
|
-
return o;
|
|
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);
|
|
767
|
-
}
|
|
768
|
-
return e.set(t, n), n;
|
|
769
|
-
}
|
|
770
|
-
function me(t) {
|
|
771
|
-
let {
|
|
772
|
-
element: e,
|
|
773
|
-
boundary: o,
|
|
774
|
-
rootBoundary: n,
|
|
775
|
-
strategy: i
|
|
776
|
-
} = t;
|
|
777
|
-
const r = [...o === "clippingAncestors" ? ct(e) ? [] : de(e, this._c) : [].concat(o), n], c = r[0], l = r.reduce((a, d) => {
|
|
778
|
-
const f = Tt(e, d, i);
|
|
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;
|
|
780
|
-
}, Tt(e, c, i));
|
|
781
|
-
return {
|
|
782
|
-
width: l.right - l.left,
|
|
783
|
-
height: l.bottom - l.top,
|
|
784
|
-
x: l.left,
|
|
785
|
-
y: l.top
|
|
786
|
-
};
|
|
787
|
-
}
|
|
788
|
-
function pe(t) {
|
|
789
|
-
const {
|
|
790
|
-
width: e,
|
|
791
|
-
height: o
|
|
792
|
-
} = Mt(t);
|
|
793
|
-
return {
|
|
794
|
-
width: e,
|
|
795
|
-
height: o
|
|
796
|
-
};
|
|
797
|
-
}
|
|
798
|
-
function ge(t, e, o) {
|
|
799
|
-
const n = N(e), i = F(e), s = o === "fixed", r = Q(t, !0, s, e);
|
|
800
|
-
let c = {
|
|
801
|
-
scrollLeft: 0,
|
|
802
|
-
scrollTop: 0
|
|
803
|
-
};
|
|
804
|
-
const l = D(0);
|
|
805
|
-
function a() {
|
|
806
|
-
l.x = yt(i);
|
|
807
|
-
}
|
|
808
|
-
if (n || !n && !s)
|
|
809
|
-
if ((q(e) !== "body" || et(i)) && (c = lt(e)), n) {
|
|
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;
|
|
815
|
-
return {
|
|
816
|
-
x: f,
|
|
817
|
-
y: p,
|
|
818
|
-
width: r.width,
|
|
819
|
-
height: r.height
|
|
820
|
-
};
|
|
821
|
-
}
|
|
822
|
-
function at(t) {
|
|
823
|
-
return E(t).position === "static";
|
|
824
|
-
}
|
|
825
|
-
function Ot(t, e) {
|
|
826
|
-
if (!N(t) || E(t).position === "fixed")
|
|
827
|
-
return null;
|
|
828
|
-
if (e)
|
|
829
|
-
return e(t);
|
|
830
|
-
let o = t.offsetParent;
|
|
831
|
-
return F(t) === o && (o = o.ownerDocument.body), o;
|
|
832
|
-
}
|
|
833
|
-
function $t(t, e) {
|
|
834
|
-
const o = C(t);
|
|
835
|
-
if (ct(t))
|
|
836
|
-
return o;
|
|
837
|
-
if (!N(t)) {
|
|
838
|
-
let i = H(t);
|
|
839
|
-
for (; i && !U(i); ) {
|
|
840
|
-
if (L(i) && !at(i))
|
|
841
|
-
return i;
|
|
842
|
-
i = H(i);
|
|
843
|
-
}
|
|
844
|
-
return o;
|
|
845
|
-
}
|
|
846
|
-
let n = Ot(t, e);
|
|
847
|
-
for (; n && oe(n) && at(n); )
|
|
848
|
-
n = Ot(n, e);
|
|
849
|
-
return n && U(n) && at(n) && !wt(n) ? o : n || ie(t) || o;
|
|
850
|
-
}
|
|
851
|
-
const he = async function(t) {
|
|
852
|
-
const e = this.getOffsetParent || $t, o = this.getDimensions, n = await o(t.floating);
|
|
853
|
-
return {
|
|
854
|
-
reference: ge(t.reference, await e(t.floating), t.strategy),
|
|
855
|
-
floating: {
|
|
856
|
-
x: 0,
|
|
857
|
-
y: 0,
|
|
858
|
-
width: n.width,
|
|
859
|
-
height: n.height
|
|
860
|
-
}
|
|
861
|
-
};
|
|
862
|
-
};
|
|
863
|
-
function we(t) {
|
|
864
|
-
return E(t).direction === "rtl";
|
|
865
|
-
}
|
|
866
|
-
const xe = {
|
|
867
|
-
convertOffsetParentRelativeRectToViewportRelativeRect: ce,
|
|
868
|
-
getDocumentElement: F,
|
|
869
|
-
getClippingRect: me,
|
|
870
|
-
getOffsetParent: $t,
|
|
871
|
-
getElementRects: he,
|
|
872
|
-
getClientRects: le,
|
|
873
|
-
getDimensions: pe,
|
|
874
|
-
getScale: K,
|
|
875
|
-
isElement: L,
|
|
876
|
-
isRTL: we
|
|
877
|
-
}, ye = ee, be = ne, ve = Zt, Ae = Qt, Ce = (t, e, o) => {
|
|
878
|
-
const n = /* @__PURE__ */ new Map(), i = {
|
|
879
|
-
platform: xe,
|
|
880
|
-
...o
|
|
881
|
-
}, s = {
|
|
882
|
-
...i.platform,
|
|
883
|
-
_c: n
|
|
884
|
-
};
|
|
885
|
-
return Jt(t, e, {
|
|
886
|
-
...i,
|
|
887
|
-
platform: s
|
|
888
|
-
});
|
|
889
|
-
}, Rt = ["mousedown", "touchstart"];
|
|
890
|
-
function Te(t, e, o) {
|
|
891
|
-
const n = G(null);
|
|
892
|
-
return pt(() => {
|
|
893
|
-
const i = (s) => {
|
|
894
|
-
const r = s ? s.target : void 0;
|
|
895
|
-
if (Array.isArray(o)) {
|
|
896
|
-
const c = !document.body.contains(r) && r.tagName !== "HTML";
|
|
897
|
-
o.every(
|
|
898
|
-
(l) => !!l && !s.composedPath().includes(l)
|
|
899
|
-
) && !c && t();
|
|
900
|
-
} else n.current && !n.current.contains(r) && t();
|
|
901
|
-
};
|
|
902
|
-
return Rt.forEach(
|
|
903
|
-
(s) => document.addEventListener(s, i)
|
|
18
|
+
return I.forEach(
|
|
19
|
+
(e) => document.addEventListener(e, r)
|
|
904
20
|
), () => {
|
|
905
|
-
|
|
906
|
-
(
|
|
21
|
+
I.forEach(
|
|
22
|
+
(e) => document.removeEventListener(e, r)
|
|
907
23
|
);
|
|
908
24
|
};
|
|
909
|
-
}, [t,
|
|
25
|
+
}, [t, s, n]), a;
|
|
910
26
|
}
|
|
911
|
-
function
|
|
912
|
-
const [
|
|
913
|
-
|
|
914
|
-
}, [
|
|
915
|
-
|
|
27
|
+
function J(t, n) {
|
|
28
|
+
const [s, a] = w(!1), r = f(null), e = f(null), o = x(() => {
|
|
29
|
+
a((c) => (!c && (!r.current || r.current === -1) && (r.current = window.setInterval(e.current, n)), !0));
|
|
30
|
+
}, [n]), l = x(() => {
|
|
31
|
+
a(!1), window.clearInterval(r.current || -1), r.current = -1;
|
|
916
32
|
}, []);
|
|
917
|
-
return
|
|
33
|
+
return T(() => (e.current = t, s && o(), l), [t, s, o, l]), { start: o, stop: l, active: s };
|
|
918
34
|
}
|
|
919
|
-
const
|
|
35
|
+
const d = (t, n = "px") => typeof t > "u" ? "" : `${Math.round(t)}${n}`, K = () => p("absolute top-0 left-0 w-max py-1 px-2 rounded-sm text-sm z-50"), N = ({
|
|
920
36
|
mode: t
|
|
921
|
-
}) =>
|
|
37
|
+
}) => p({
|
|
922
38
|
"bg-surface-darker": t === "dark" || t === "system",
|
|
923
39
|
"bg-surface-light": t === "light" || t === "alt-system",
|
|
924
40
|
"dark:bg-surface-light": t === "system",
|
|
925
41
|
"dark:bg-surface-darker": t === "alt-system"
|
|
926
|
-
}),
|
|
42
|
+
}), Q = ({
|
|
927
43
|
mode: t
|
|
928
|
-
}) =>
|
|
44
|
+
}) => p({
|
|
929
45
|
"text-copy-light": t === "dark" || t === "system",
|
|
930
46
|
"text-copy-dark": t === "light" || t === "alt-system",
|
|
931
47
|
"dark:text-copy-dark": t === "system",
|
|
932
48
|
"dark:text-copy-light": t === "alt-system"
|
|
933
|
-
}),
|
|
49
|
+
}), X = () => p("absolute", "size-2", "transform rotate-45"), Z = ({
|
|
934
50
|
mode: t,
|
|
935
|
-
className:
|
|
936
|
-
tooltipClassName:
|
|
937
|
-
arrowClassName:
|
|
51
|
+
className: n,
|
|
52
|
+
tooltipClassName: s,
|
|
53
|
+
arrowClassName: a
|
|
938
54
|
}) => {
|
|
939
|
-
const
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
),
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
55
|
+
const r = p("relative inline-block", n), e = p(
|
|
56
|
+
Y,
|
|
57
|
+
K(),
|
|
58
|
+
N({ mode: t }),
|
|
59
|
+
Q({ mode: t }),
|
|
60
|
+
s
|
|
61
|
+
), o = p(
|
|
62
|
+
q,
|
|
63
|
+
X(),
|
|
64
|
+
N({ mode: t }),
|
|
65
|
+
a
|
|
950
66
|
);
|
|
951
|
-
return { tooltip:
|
|
952
|
-
},
|
|
67
|
+
return { tooltip: e, arrow: o, wrapper: r };
|
|
68
|
+
}, tt = ({ delay: t = 300 }) => ({
|
|
953
69
|
animation: `av-tooltip-fade-in ${t}ms ease-in-out`
|
|
954
|
-
}),
|
|
70
|
+
}), et = 5e3, at = ({
|
|
955
71
|
trigger: t,
|
|
956
|
-
label:
|
|
957
|
-
placement:
|
|
958
|
-
mode:
|
|
959
|
-
delay:
|
|
960
|
-
className:
|
|
961
|
-
tooltipClassName:
|
|
962
|
-
arrowClassName:
|
|
72
|
+
label: n,
|
|
73
|
+
placement: s = "top",
|
|
74
|
+
mode: a = "system",
|
|
75
|
+
delay: r = 300,
|
|
76
|
+
className: e,
|
|
77
|
+
tooltipClassName: o,
|
|
78
|
+
arrowClassName: l
|
|
963
79
|
}) => {
|
|
964
|
-
const
|
|
965
|
-
|
|
966
|
-
}),
|
|
967
|
-
|
|
968
|
-
},
|
|
969
|
-
mode:
|
|
970
|
-
className:
|
|
971
|
-
tooltipClassName:
|
|
972
|
-
arrowClassName:
|
|
973
|
-
}),
|
|
974
|
-
var
|
|
975
|
-
if (
|
|
80
|
+
const c = G(() => {
|
|
81
|
+
k.stop(), g(!1);
|
|
82
|
+
}), i = f(null), u = f(null), [y, m] = w(!1), [b, g] = w(!1), k = J(() => {
|
|
83
|
+
g(!1);
|
|
84
|
+
}, et), h = Z({
|
|
85
|
+
mode: a,
|
|
86
|
+
className: e,
|
|
87
|
+
tooltipClassName: o,
|
|
88
|
+
arrowClassName: l
|
|
89
|
+
}), v = tt({ delay: r }), C = x(async () => {
|
|
90
|
+
var A, E, L, S;
|
|
91
|
+
if (c.current && i.current && u.current) {
|
|
976
92
|
const {
|
|
977
|
-
x:
|
|
978
|
-
y:
|
|
979
|
-
middlewareData:
|
|
980
|
-
placement:
|
|
981
|
-
} = await
|
|
982
|
-
placement:
|
|
93
|
+
x: j,
|
|
94
|
+
y: B,
|
|
95
|
+
middlewareData: M,
|
|
96
|
+
placement: R
|
|
97
|
+
} = await F(c.current, i.current, {
|
|
98
|
+
placement: s,
|
|
983
99
|
middleware: [
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
crossAxis:
|
|
100
|
+
H(10),
|
|
101
|
+
U({
|
|
102
|
+
crossAxis: s.includes("-"),
|
|
987
103
|
fallbackAxisSideDirection: "start"
|
|
988
104
|
}),
|
|
989
|
-
|
|
990
|
-
|
|
105
|
+
V({ padding: 5 }),
|
|
106
|
+
W({ element: u.current })
|
|
991
107
|
]
|
|
992
108
|
});
|
|
993
|
-
(
|
|
994
|
-
left:
|
|
995
|
-
top:
|
|
996
|
-
...
|
|
109
|
+
(A = i == null ? void 0 : i.current) != null && A.style && Object.assign(i.current.style, {
|
|
110
|
+
left: d(j),
|
|
111
|
+
top: d(B),
|
|
112
|
+
...v
|
|
997
113
|
});
|
|
998
|
-
const
|
|
114
|
+
const $ = {
|
|
999
115
|
top: "bottom",
|
|
1000
116
|
right: "left",
|
|
1001
117
|
bottom: "top",
|
|
1002
118
|
left: "right"
|
|
1003
|
-
}[
|
|
1004
|
-
(
|
|
1005
|
-
left:
|
|
1006
|
-
top:
|
|
119
|
+
}[R.split("-")[0]];
|
|
120
|
+
(E = u == null ? void 0 : u.current) != null && E.style && Object.assign(u.current.style, {
|
|
121
|
+
left: d((L = M.arrow) == null ? void 0 : L.x),
|
|
122
|
+
top: d((S = M.arrow) == null ? void 0 : S.y),
|
|
1007
123
|
right: "",
|
|
1008
124
|
bottom: "",
|
|
1009
|
-
[
|
|
125
|
+
[$]: "-4px"
|
|
1010
126
|
});
|
|
1011
127
|
}
|
|
1012
|
-
}, [
|
|
1013
|
-
|
|
1014
|
-
(async () =>
|
|
1015
|
-
}, [
|
|
1016
|
-
const
|
|
1017
|
-
|
|
1018
|
-
},
|
|
1019
|
-
|
|
1020
|
-
},
|
|
1021
|
-
|
|
1022
|
-
};
|
|
1023
|
-
return /* @__PURE__ */
|
|
128
|
+
}, [s, v, c]);
|
|
129
|
+
T(() => {
|
|
130
|
+
(async () => y && await C())();
|
|
131
|
+
}, [C, y]);
|
|
132
|
+
const D = () => {
|
|
133
|
+
m(!1), g(!0), k.start();
|
|
134
|
+
}, P = () => {
|
|
135
|
+
b || m(!0);
|
|
136
|
+
}, _ = () => {
|
|
137
|
+
b || m(!1);
|
|
138
|
+
};
|
|
139
|
+
return /* @__PURE__ */ O(
|
|
1024
140
|
"div",
|
|
1025
141
|
{
|
|
1026
142
|
className: h.wrapper,
|
|
1027
|
-
ref:
|
|
1028
|
-
onMouseEnter:
|
|
1029
|
-
onMouseLeave:
|
|
1030
|
-
onClick:
|
|
143
|
+
ref: c,
|
|
144
|
+
onMouseEnter: P,
|
|
145
|
+
onMouseLeave: _,
|
|
146
|
+
onClick: D,
|
|
1031
147
|
children: [
|
|
1032
148
|
t,
|
|
1033
|
-
|
|
149
|
+
y && /* @__PURE__ */ O(
|
|
1034
150
|
"div",
|
|
1035
151
|
{
|
|
1036
152
|
role: "tooltip",
|
|
1037
|
-
ref:
|
|
153
|
+
ref: i,
|
|
1038
154
|
className: h.tooltip,
|
|
1039
155
|
children: [
|
|
1040
|
-
|
|
1041
|
-
/* @__PURE__ */
|
|
156
|
+
n,
|
|
157
|
+
/* @__PURE__ */ z("div", { ref: u, className: h.arrow })
|
|
1042
158
|
]
|
|
1043
159
|
}
|
|
1044
160
|
)
|
|
@@ -1047,7 +163,7 @@ const nt = (t, e = "px") => typeof t > "u" ? "" : `${Math.round(t)}${e}`, Re = (
|
|
|
1047
163
|
);
|
|
1048
164
|
};
|
|
1049
165
|
export {
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
166
|
+
q as TOOLTIP_ARROW_CLASSNAME,
|
|
167
|
+
Y as TOOLTIP_CLASSNAME,
|
|
168
|
+
at as Tooltip
|
|
1053
169
|
};
|
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.
|
|
3
|
+
@versini/ui-tooltip v2.1.1
|
|
4
4
|
© 2025 gizmette.com
|
|
5
5
|
*/
|
|
6
6
|
try {
|
|
7
7
|
window.__VERSINI_UI_TOOLTIP__ || (window.__VERSINI_UI_TOOLTIP__ = {
|
|
8
|
-
version: "2.
|
|
9
|
-
buildTime: "
|
|
8
|
+
version: "2.1.1",
|
|
9
|
+
buildTime: "07/14/2025 12:05 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.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -39,17 +39,18 @@
|
|
|
39
39
|
"react-dom": "^18.3.1 || ^19.0.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@
|
|
42
|
+
"@testing-library/jest-dom": "6.6.3",
|
|
43
|
+
"@versini/ui-types": "5.0.5"
|
|
43
44
|
},
|
|
44
45
|
"dependencies": {
|
|
45
|
-
"@floating-ui/
|
|
46
|
+
"@floating-ui/react": "0.27.13",
|
|
46
47
|
"@tailwindcss/typography": "0.5.16",
|
|
47
|
-
"@versini/ui-hooks": "4.7.
|
|
48
|
+
"@versini/ui-hooks": "4.7.5",
|
|
48
49
|
"clsx": "2.1.1",
|
|
49
|
-
"tailwindcss": "4.1.
|
|
50
|
+
"tailwindcss": "4.1.11"
|
|
50
51
|
},
|
|
51
52
|
"sideEffects": [
|
|
52
53
|
"**/*.css"
|
|
53
54
|
],
|
|
54
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "097e81ba959c30dc2ee37ff9050981a02420360b"
|
|
55
56
|
}
|