react-tooltip 5.10.1-beta.5 → 5.10.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.
@@ -1,86 +1,9 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
- // If the importer is in node compatibility mode or this is not an ESM
20
- // file that has been converted to a CommonJS file using a Babel-
21
- // compatible transform (i.e. "__esModule" has not been set), then set
22
- // "default" to the CommonJS "module.exports" for node compatibility.
23
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
- mod
25
- ));
26
-
27
- // node_modules/classnames/index.js
28
- var require_classnames = __commonJS({
29
- "node_modules/classnames/index.js"(exports, module) {
30
- (function() {
31
- "use strict";
32
- var hasOwn = {}.hasOwnProperty;
33
- var nativeCodeString = "[native code]";
34
- function classNames3() {
35
- var classes = [];
36
- for (var i3 = 0; i3 < arguments.length; i3++) {
37
- var arg = arguments[i3];
38
- if (!arg)
39
- continue;
40
- var argType = typeof arg;
41
- if (argType === "string" || argType === "number") {
42
- classes.push(arg);
43
- } else if (Array.isArray(arg)) {
44
- if (arg.length) {
45
- var inner = classNames3.apply(null, arg);
46
- if (inner) {
47
- classes.push(inner);
48
- }
49
- }
50
- } else if (argType === "object") {
51
- if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
52
- classes.push(arg.toString());
53
- continue;
54
- }
55
- for (var key in arg) {
56
- if (hasOwn.call(arg, key) && arg[key]) {
57
- classes.push(key);
58
- }
59
- }
60
- }
61
- }
62
- return classes.join(" ");
63
- }
64
- if (typeof module !== "undefined" && module.exports) {
65
- classNames3.default = classNames3;
66
- module.exports = classNames3;
67
- } else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
68
- define("classnames", [], function() {
69
- return classNames3;
70
- });
71
- } else {
72
- window.classNames = classNames3;
73
- }
74
- })();
75
- }
76
- });
77
-
78
1
  // src/components/TooltipController/TooltipController.tsx
79
2
  import { useEffect as useEffect4, useState as useState3 } from "react";
80
3
 
81
4
  // src/components/Tooltip/Tooltip.tsx
82
- var import_classnames2 = __toESM(require_classnames());
83
5
  import { useEffect as useEffect3, useState as useState2, useRef as useRef2 } from "react";
6
+ import classNames2 from "classnames";
84
7
 
85
8
  // src/utils/debounce.ts
86
9
  var debounce = (func, wait, immediate) => {
@@ -184,8 +107,8 @@ function useTooltip(tooltipId = DEFAULT_TOOLTIP_ID) {
184
107
  var TooltipProvider_default = TooltipProvider;
185
108
 
186
109
  // src/components/TooltipProvider/TooltipWrapper.tsx
187
- var import_classnames = __toESM(require_classnames());
188
110
  import { useEffect, useRef } from "react";
111
+ import classNames from "classnames";
189
112
  import { jsx as jsx2 } from "react/jsx-runtime";
190
113
  var TooltipWrapper = ({
191
114
  tooltipId,
@@ -195,7 +118,7 @@ var TooltipWrapper = ({
195
118
  content,
196
119
  html,
197
120
  variant,
198
- offset,
121
+ offset: offset2,
199
122
  wrapper,
200
123
  events,
201
124
  positionStrategy,
@@ -214,12 +137,12 @@ var TooltipWrapper = ({
214
137
  "span",
215
138
  {
216
139
  ref: anchorRef,
217
- className: (0, import_classnames.default)("react-tooltip-wrapper", className),
140
+ className: classNames("react-tooltip-wrapper", className),
218
141
  "data-tooltip-place": place,
219
142
  "data-tooltip-content": content,
220
143
  "data-tooltip-html": html,
221
144
  "data-tooltip-variant": variant,
222
- "data-tooltip-offset": offset,
145
+ "data-tooltip-offset": offset2,
223
146
  "data-tooltip-wrapper": wrapper,
224
147
  "data-tooltip-events": events,
225
148
  "data-tooltip-position-strategy": positionStrategy,
@@ -236,416 +159,8 @@ import { useLayoutEffect, useEffect as useEffect2 } from "react";
236
159
  var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect2;
237
160
  var use_isomorphic_layout_effect_default = useIsomorphicLayoutEffect;
238
161
 
239
- // node_modules/@floating-ui/core/dist/floating-ui.core.browser.min.mjs
240
- function t(t2) {
241
- return t2.split("-")[1];
242
- }
243
- function e(t2) {
244
- return "y" === t2 ? "height" : "width";
245
- }
246
- function n(t2) {
247
- return t2.split("-")[0];
248
- }
249
- function o(t2) {
250
- return ["top", "bottom"].includes(n(t2)) ? "x" : "y";
251
- }
252
- function i(i3, r3, a3) {
253
- let { reference: l3, floating: s3 } = i3;
254
- 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;
255
- let p3;
256
- switch (n(r3)) {
257
- case "top":
258
- p3 = { x: c3, y: l3.y - s3.height };
259
- break;
260
- case "bottom":
261
- p3 = { x: c3, y: l3.y + l3.height };
262
- break;
263
- case "right":
264
- p3 = { x: l3.x + l3.width, y: f3 };
265
- break;
266
- case "left":
267
- p3 = { x: l3.x - s3.width, y: f3 };
268
- break;
269
- default:
270
- p3 = { x: l3.x, y: l3.y };
271
- }
272
- switch (t(r3)) {
273
- case "start":
274
- p3[m3] -= g3 * (a3 && d3 ? -1 : 1);
275
- break;
276
- case "end":
277
- p3[m3] += g3 * (a3 && d3 ? -1 : 1);
278
- }
279
- return p3;
280
- }
281
- var r = async (t2, e2, n3) => {
282
- 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));
283
- let f3 = await l3.getElementRects({ reference: t2, floating: e2, strategy: r3 }), { x: m3, y: u3 } = i(f3, o3, c3), g3 = o3, d3 = {}, p3 = 0;
284
- for (let n4 = 0; n4 < s3.length; n4++) {
285
- 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 } });
286
- 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);
287
- }
288
- return { x: m3, y: u3, placement: g3, strategy: r3, middlewareData: d3 };
289
- };
290
- function a(t2) {
291
- return "number" != typeof t2 ? function(t3) {
292
- return { top: 0, right: 0, bottom: 0, left: 0, ...t3 };
293
- }(t2) : { top: t2, right: t2, bottom: t2, left: t2 };
294
- }
295
- function l(t2) {
296
- return { ...t2, top: t2.y, left: t2.x, right: t2.x + t2.width, bottom: t2.y + t2.height };
297
- }
298
- async function s(t2, e2) {
299
- var n3;
300
- void 0 === e2 && (e2 = {});
301
- 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);
302
- 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 };
303
- }
304
- var c = Math.min;
305
- var f = Math.max;
306
- function m(t2, e2, n3) {
307
- return f(t2, c(e2, n3));
308
- }
309
- var u = (n3) => ({ name: "arrow", options: n3, async fn(i3) {
310
- const { element: r3, padding: l3 = 0 } = n3 || {}, { x: s3, y: c3, placement: f3, rects: u3, platform: g3, elements: d3 } = i3;
311
- if (null == r3)
312
- return {};
313
- 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));
314
- let E3 = O3 ? O3[A2] : 0;
315
- E3 && await (null == g3.isElement ? void 0 : g3.isElement(O3)) || (E3 = d3.floating[A2] || u3.floating[x3]);
316
- 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;
317
- return { [y3]: h3[y3] - (H2 ? B < L3 ? L3 - B : k2 - B : 0), data: { [y3]: C2, centerOffset: B - C2 } };
318
- } });
319
- var g = ["top", "right", "bottom", "left"];
320
- var d = g.reduce((t2, e2) => t2.concat(e2, e2 + "-start", e2 + "-end"), []);
321
- var p = { left: "right", right: "left", bottom: "top", top: "bottom" };
322
- function h(t2) {
323
- return t2.replace(/left|right|bottom|top/g, (t3) => p[t3]);
324
- }
325
- function y(n3, i3, r3) {
326
- void 0 === r3 && (r3 = false);
327
- const a3 = t(n3), l3 = o(n3), s3 = e(l3);
328
- let c3 = "x" === l3 ? a3 === (r3 ? "end" : "start") ? "right" : "left" : "start" === a3 ? "bottom" : "top";
329
- return i3.reference[s3] > i3.floating[s3] && (c3 = h(c3)), { main: c3, cross: h(c3) };
330
- }
331
- var x = { start: "end", end: "start" };
332
- function w(t2) {
333
- return t2.replace(/start|end/g, (t3) => x[t3]);
334
- }
335
- var b = function(e2) {
336
- return void 0 === e2 && (e2 = {}), { name: "flip", options: e2, async fn(o3) {
337
- var i3;
338
- 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) {
339
- const e3 = h(t2);
340
- return [w(t2), e3, w(e3)];
341
- }(c3));
342
- d3 || "none" === x3 || T3.push(...function(e3, o4, i4, r4) {
343
- const a4 = t(e3);
344
- let l4 = function(t2, e4, n3) {
345
- const o5 = ["left", "right"], i5 = ["right", "left"], r5 = ["top", "bottom"], a5 = ["bottom", "top"];
346
- switch (t2) {
347
- case "top":
348
- case "bottom":
349
- return n3 ? e4 ? i5 : o5 : e4 ? o5 : i5;
350
- case "left":
351
- case "right":
352
- return e4 ? r5 : a5;
353
- default:
354
- return [];
355
- }
356
- }(n(e3), "start" === i4, r4);
357
- return a4 && (l4 = l4.map((t2) => t2 + "-" + a4), o4 && (l4 = l4.concat(l4.map(w)))), l4;
358
- }(c3, v3, x3, P2));
359
- const O3 = [c3, ...T3], E3 = await s(o3, b3), D3 = [];
360
- let L3 = (null == (i3 = a3.flip) ? void 0 : i3.overflows) || [];
361
- if (u3 && D3.push(E3[R2]), g3) {
362
- const { main: t2, cross: e3 } = y(r3, l3, P2);
363
- D3.push(E3[t2], E3[e3]);
364
- }
365
- if (L3 = [...L3, { placement: r3, overflows: D3 }], !D3.every((t2) => t2 <= 0)) {
366
- var k2, B;
367
- const t2 = ((null == (k2 = a3.flip) ? void 0 : k2.index) || 0) + 1, e3 = O3[t2];
368
- if (e3)
369
- return { data: { index: t2, overflows: L3 }, reset: { placement: e3 } };
370
- 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;
371
- if (!n3)
372
- switch (p3) {
373
- case "bestFit": {
374
- var C2;
375
- const t3 = null == (C2 = L3.map((t4) => [t4.placement, t4.overflows.filter((t5) => t5 > 0).reduce((t5, e4) => t5 + e4, 0)]).sort((t4, e4) => t4[1] - e4[1])[0]) ? void 0 : C2[0];
376
- t3 && (n3 = t3);
377
- break;
378
- }
379
- case "initialPlacement":
380
- n3 = c3;
381
- }
382
- if (r3 !== n3)
383
- return { reset: { placement: n3 } };
384
- }
385
- return {};
386
- } };
387
- };
388
- var O = function(e2) {
389
- return void 0 === e2 && (e2 = 0), { name: "offset", options: e2, async fn(i3) {
390
- const { x: r3, y: a3 } = i3, l3 = await async function(e3, i4) {
391
- 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;
392
- let { mainAxis: p3, crossAxis: h3, alignmentAxis: y3 } = "number" == typeof d3 ? { mainAxis: d3, crossAxis: 0, alignmentAxis: null } : { mainAxis: 0, crossAxis: 0, alignmentAxis: null, ...d3 };
393
- return f3 && "number" == typeof y3 && (h3 = "end" === f3 ? -1 * y3 : y3), m3 ? { x: h3 * g3, y: p3 * u3 } : { x: p3 * u3, y: h3 * g3 };
394
- }(i3, e2);
395
- return { x: r3 + l3.x, y: a3 + l3.y, data: l3 };
396
- } };
397
- };
398
- function E(t2) {
399
- return "x" === t2 ? "y" : "x";
400
- }
401
- var D = function(t2) {
402
- return void 0 === t2 && (t2 = {}), { name: "shift", options: t2, async fn(e2) {
403
- const { x: i3, y: r3, placement: a3 } = e2, { mainAxis: l3 = true, crossAxis: c3 = false, limiter: f3 = { fn: (t3) => {
404
- let { x: e3, y: n3 } = t3;
405
- return { x: e3, y: n3 };
406
- } }, ...u3 } = t2, g3 = { x: i3, y: r3 }, d3 = await s(e2, u3), p3 = o(n(a3)), h3 = E(p3);
407
- let y3 = g3[p3], x3 = g3[h3];
408
- if (l3) {
409
- const t3 = "y" === p3 ? "bottom" : "right";
410
- y3 = m(y3 + d3["y" === p3 ? "top" : "left"], y3, y3 - d3[t3]);
411
- }
412
- if (c3) {
413
- const t3 = "y" === h3 ? "bottom" : "right";
414
- x3 = m(x3 + d3["y" === h3 ? "top" : "left"], x3, x3 - d3[t3]);
415
- }
416
- const w3 = f3.fn({ ...e2, [p3]: y3, [h3]: x3 });
417
- return { ...w3, data: { x: w3.x - i3, y: w3.y - r3 } };
418
- } };
419
- };
420
-
421
- // node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.min.mjs
422
- function n2(t2) {
423
- var e2;
424
- return (null == (e2 = t2.ownerDocument) ? void 0 : e2.defaultView) || window;
425
- }
426
- function o2(t2) {
427
- return n2(t2).getComputedStyle(t2);
428
- }
429
- var i2 = Math.min;
430
- var r2 = Math.max;
431
- var l2 = Math.round;
432
- function c2(t2) {
433
- const e2 = o2(t2);
434
- let n3 = parseFloat(e2.width), i3 = parseFloat(e2.height);
435
- const r3 = t2.offsetWidth, c3 = t2.offsetHeight, s3 = l2(n3) !== r3 || l2(i3) !== c3;
436
- return s3 && (n3 = r3, i3 = c3), { width: n3, height: i3, fallback: s3 };
437
- }
438
- function s2(t2) {
439
- return h2(t2) ? (t2.nodeName || "").toLowerCase() : "";
440
- }
441
- var f2;
442
- function u2() {
443
- if (f2)
444
- return f2;
445
- const t2 = navigator.userAgentData;
446
- return t2 && Array.isArray(t2.brands) ? (f2 = t2.brands.map((t3) => t3.brand + "/" + t3.version).join(" "), f2) : navigator.userAgent;
447
- }
448
- function a2(t2) {
449
- return t2 instanceof n2(t2).HTMLElement;
450
- }
451
- function d2(t2) {
452
- return t2 instanceof n2(t2).Element;
453
- }
454
- function h2(t2) {
455
- return t2 instanceof n2(t2).Node;
456
- }
457
- function p2(t2) {
458
- if ("undefined" == typeof ShadowRoot)
459
- return false;
460
- return t2 instanceof n2(t2).ShadowRoot || t2 instanceof ShadowRoot;
461
- }
462
- function g2(t2) {
463
- const { overflow: e2, overflowX: n3, overflowY: i3, display: r3 } = o2(t2);
464
- return /auto|scroll|overlay|hidden|clip/.test(e2 + i3 + n3) && !["inline", "contents"].includes(r3);
465
- }
466
- function m2(t2) {
467
- return ["table", "td", "th"].includes(s2(t2));
468
- }
469
- function y2(t2) {
470
- const e2 = /firefox/i.test(u2()), n3 = o2(t2), i3 = n3.backdropFilter || n3.WebkitBackdropFilter;
471
- return "none" !== n3.transform || "none" !== n3.perspective || !!i3 && "none" !== i3 || e2 && "filter" === n3.willChange || e2 && !!n3.filter && "none" !== n3.filter || ["transform", "perspective"].some((t3) => n3.willChange.includes(t3)) || ["paint", "layout", "strict", "content"].some((t3) => {
472
- const e3 = n3.contain;
473
- return null != e3 && e3.includes(t3);
474
- });
475
- }
476
- function x2() {
477
- return /^((?!chrome|android).)*safari/i.test(u2());
478
- }
479
- function w2(t2) {
480
- return ["html", "body", "#document"].includes(s2(t2));
481
- }
482
- function v2(t2) {
483
- return d2(t2) ? t2 : t2.contextElement;
484
- }
485
- var b2 = { x: 1, y: 1 };
486
- function L2(t2) {
487
- const e2 = v2(t2);
488
- if (!a2(e2))
489
- return b2;
490
- const n3 = e2.getBoundingClientRect(), { width: o3, height: i3, fallback: r3 } = c2(e2);
491
- let s3 = (r3 ? l2(n3.width) : n3.width) / o3, f3 = (r3 ? l2(n3.height) : n3.height) / i3;
492
- return s3 && Number.isFinite(s3) || (s3 = 1), f3 && Number.isFinite(f3) || (f3 = 1), { x: s3, y: f3 };
493
- }
494
- function E2(e2, o3, i3, r3) {
495
- var l3, c3;
496
- void 0 === o3 && (o3 = false), void 0 === i3 && (i3 = false);
497
- const s3 = e2.getBoundingClientRect(), f3 = v2(e2);
498
- let u3 = b2;
499
- o3 && (r3 ? d2(r3) && (u3 = L2(r3)) : u3 = L2(e2));
500
- const a3 = f3 ? n2(f3) : window, h3 = x2() && i3;
501
- 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;
502
- if (f3) {
503
- const t2 = n2(f3), e3 = r3 && d2(r3) ? n2(r3) : r3;
504
- let o4 = t2.frameElement;
505
- for (; o4 && r3 && e3 !== t2; ) {
506
- const t3 = L2(o4), e4 = o4.getBoundingClientRect(), i4 = getComputedStyle(o4);
507
- 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;
508
- }
509
- }
510
- return l({ width: m3, height: y3, x: p3, y: g3 });
511
- }
512
- function R(t2) {
513
- return ((h2(t2) ? t2.ownerDocument : t2.document) || window.document).documentElement;
514
- }
515
- function T2(t2) {
516
- return d2(t2) ? { scrollLeft: t2.scrollLeft, scrollTop: t2.scrollTop } : { scrollLeft: t2.pageXOffset, scrollTop: t2.pageYOffset };
517
- }
518
- function C(t2) {
519
- return E2(R(t2)).left + T2(t2).scrollLeft;
520
- }
521
- function F(t2) {
522
- if ("html" === s2(t2))
523
- return t2;
524
- const e2 = t2.assignedSlot || t2.parentNode || p2(t2) && t2.host || R(t2);
525
- return p2(e2) ? e2.host : e2;
526
- }
527
- function W(t2) {
528
- const e2 = F(t2);
529
- return w2(e2) ? e2.ownerDocument.body : a2(e2) && g2(e2) ? e2 : W(e2);
530
- }
531
- function D2(t2, e2) {
532
- var o3;
533
- void 0 === e2 && (e2 = []);
534
- const i3 = W(t2), r3 = i3 === (null == (o3 = t2.ownerDocument) ? void 0 : o3.body), l3 = n2(i3);
535
- return r3 ? e2.concat(l3, l3.visualViewport || [], g2(i3) ? i3 : []) : e2.concat(i3, D2(i3));
536
- }
537
- function S(e2, i3, l3) {
538
- let c3;
539
- if ("viewport" === i3)
540
- c3 = function(t2, e3) {
541
- const o3 = n2(t2), i4 = R(t2), r3 = o3.visualViewport;
542
- let l4 = i4.clientWidth, c4 = i4.clientHeight, s4 = 0, f4 = 0;
543
- if (r3) {
544
- l4 = r3.width, c4 = r3.height;
545
- const t3 = x2();
546
- (!t3 || t3 && "fixed" === e3) && (s4 = r3.offsetLeft, f4 = r3.offsetTop);
547
- }
548
- return { width: l4, height: c4, x: s4, y: f4 };
549
- }(e2, l3);
550
- else if ("document" === i3)
551
- c3 = function(t2) {
552
- 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);
553
- let s4 = -n3.scrollLeft + C(t2);
554
- const f4 = -n3.scrollTop;
555
- return "rtl" === o2(i4).direction && (s4 += r2(e3.clientWidth, i4.clientWidth) - l4), { width: l4, height: c4, x: s4, y: f4 };
556
- }(R(e2));
557
- else if (d2(i3))
558
- c3 = function(t2, e3) {
559
- 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 };
560
- return { width: t2.clientWidth * r3.x, height: t2.clientHeight * r3.y, x: i4 * r3.x, y: o3 * r3.y };
561
- }(i3, l3);
562
- else {
563
- const t2 = { ...i3 };
564
- if (x2()) {
565
- var s3, f3;
566
- const o3 = n2(e2);
567
- t2.x -= (null == (s3 = o3.visualViewport) ? void 0 : s3.offsetLeft) || 0, t2.y -= (null == (f3 = o3.visualViewport) ? void 0 : f3.offsetTop) || 0;
568
- }
569
- c3 = t2;
570
- }
571
- return l(c3);
572
- }
573
- function A(t2, e2) {
574
- return a2(t2) && "fixed" !== o2(t2).position ? e2 ? e2(t2) : t2.offsetParent : null;
575
- }
576
- function H(t2, e2) {
577
- const i3 = n2(t2);
578
- if (!a2(t2))
579
- return i3;
580
- let r3 = A(t2, e2);
581
- for (; r3 && m2(r3) && "static" === o2(r3).position; )
582
- r3 = A(r3, e2);
583
- return r3 && ("html" === s2(r3) || "body" === s2(r3) && "static" === o2(r3).position && !y2(r3)) ? i3 : r3 || function(t3) {
584
- let e3 = F(t3);
585
- for (; a2(e3) && !w2(e3); ) {
586
- if (y2(e3))
587
- return e3;
588
- e3 = F(e3);
589
- }
590
- return null;
591
- }(t2) || i3;
592
- }
593
- function V(t2, e2, n3) {
594
- const o3 = a2(e2), i3 = R(e2), r3 = E2(t2, true, "fixed" === n3, e2);
595
- let l3 = { scrollLeft: 0, scrollTop: 0 };
596
- const c3 = { x: 0, y: 0 };
597
- if (o3 || !o3 && "fixed" !== n3)
598
- if (("body" !== s2(e2) || g2(i3)) && (l3 = T2(e2)), a2(e2)) {
599
- const t3 = E2(e2, true);
600
- c3.x = t3.x + e2.clientLeft, c3.y = t3.y + e2.clientTop;
601
- } else
602
- i3 && (c3.x = C(i3));
603
- return { x: r3.left + l3.scrollLeft - c3.x, y: r3.top + l3.scrollTop - c3.y, width: r3.width, height: r3.height };
604
- }
605
- var O2 = { getClippingRect: function(t2) {
606
- let { element: e2, boundary: n3, rootBoundary: l3, strategy: c3 } = t2;
607
- const f3 = "clippingAncestors" === n3 ? function(t3, e3) {
608
- const n4 = e3.get(t3);
609
- if (n4)
610
- return n4;
611
- let i3 = D2(t3).filter((t4) => d2(t4) && "body" !== s2(t4)), r3 = null;
612
- const l4 = "fixed" === o2(t3).position;
613
- let c4 = l4 ? F(t3) : t3;
614
- for (; d2(c4) && !w2(c4); ) {
615
- const t4 = o2(c4), e4 = y2(c4);
616
- "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);
617
- }
618
- return e3.set(t3, i3), i3;
619
- }(e2, this._c) : [].concat(n3), u3 = [...f3, l3], a3 = u3[0], h3 = u3.reduce((t3, n4) => {
620
- const o3 = S(e2, n4, c3);
621
- return t3.top = r2(o3.top, t3.top), t3.right = i2(o3.right, t3.right), t3.bottom = i2(o3.bottom, t3.bottom), t3.left = r2(o3.left, t3.left), t3;
622
- }, S(e2, a3, c3));
623
- return { width: h3.right - h3.left, height: h3.bottom - h3.top, x: h3.left, y: h3.top };
624
- }, convertOffsetParentRelativeRectToViewportRelativeRect: function(t2) {
625
- let { rect: e2, offsetParent: n3, strategy: o3 } = t2;
626
- const i3 = a2(n3), r3 = R(n3);
627
- if (n3 === r3)
628
- return e2;
629
- let l3 = { scrollLeft: 0, scrollTop: 0 }, c3 = { x: 1, y: 1 };
630
- const f3 = { x: 0, y: 0 };
631
- if ((i3 || !i3 && "fixed" !== o3) && (("body" !== s2(n3) || g2(r3)) && (l3 = T2(n3)), a2(n3))) {
632
- const t3 = E2(n3);
633
- c3 = L2(n3), f3.x = t3.x + n3.clientLeft, f3.y = t3.y + n3.clientTop;
634
- }
635
- return { width: e2.width * c3.x, height: e2.height * c3.y, x: e2.x * c3.x - l3.scrollLeft * c3.x + f3.x, y: e2.y * c3.y - l3.scrollTop * c3.y + f3.y };
636
- }, isElement: d2, getDimensions: function(t2) {
637
- return a2(t2) ? c2(t2) : t2.getBoundingClientRect();
638
- }, getOffsetParent: H, getDocumentElement: R, getScale: L2, async getElementRects(t2) {
639
- let { reference: e2, floating: n3, strategy: o3 } = t2;
640
- const i3 = this.getOffsetParent || H, r3 = this.getDimensions;
641
- return { reference: V(e2, await i3(n3), o3), floating: { x: 0, y: 0, ...await r3(n3) } };
642
- }, getClientRects: (t2) => Array.from(t2.getClientRects()), isRTL: (t2) => "rtl" === o2(t2).direction };
643
- var z = (t2, n3, o3) => {
644
- const i3 = /* @__PURE__ */ new Map(), r3 = { platform: O2, ...o3 }, l3 = { ...r3.platform, _c: i3 };
645
- return r(t2, n3, { ...r3, platform: l3 });
646
- };
647
-
648
162
  // src/utils/compute-positions.ts
163
+ import { computePosition, offset, shift, arrow, flip } from "@floating-ui/dom";
649
164
  var computeTooltipPosition = async ({
650
165
  elementReference = null,
651
166
  tooltipReference = null,
@@ -653,7 +168,7 @@ var computeTooltipPosition = async ({
653
168
  place = "top",
654
169
  offset: offsetValue = 10,
655
170
  strategy = "absolute",
656
- middlewares = [O(Number(offsetValue)), b(), D({ padding: 5 })]
171
+ middlewares = [offset(Number(offsetValue)), flip(), shift({ padding: 5 })]
657
172
  }) => {
658
173
  if (!elementReference) {
659
174
  return { tooltipStyles: {}, tooltipArrowStyles: {}, place };
@@ -663,14 +178,14 @@ var computeTooltipPosition = async ({
663
178
  }
664
179
  const middleware = middlewares;
665
180
  if (tooltipArrowReference) {
666
- middleware.push(u({ element: tooltipArrowReference, padding: 5 }));
667
- return z(elementReference, tooltipReference, {
181
+ middleware.push(arrow({ element: tooltipArrowReference, padding: 5 }));
182
+ return computePosition(elementReference, tooltipReference, {
668
183
  placement: place,
669
184
  strategy,
670
185
  middleware
671
- }).then(({ x: x3, y: y3, placement, middlewareData }) => {
186
+ }).then(({ x, y, placement, middlewareData }) => {
672
187
  var _a, _b;
673
- const styles = { left: `${x3}px`, top: `${y3}px` };
188
+ const styles = { left: `${x}px`, top: `${y}px` };
674
189
  const { x: arrowX, y: arrowY } = (_a = middlewareData.arrow) != null ? _a : { x: 0, y: 0 };
675
190
  const staticSide = (_b = {
676
191
  top: "bottom",
@@ -688,12 +203,12 @@ var computeTooltipPosition = async ({
688
203
  return { tooltipStyles: styles, tooltipArrowStyles: arrowStyle, place: placement };
689
204
  });
690
205
  }
691
- return z(elementReference, tooltipReference, {
206
+ return computePosition(elementReference, tooltipReference, {
692
207
  placement: "bottom",
693
208
  strategy,
694
209
  middleware
695
- }).then(({ x: x3, y: y3, placement }) => {
696
- const styles = { left: `${x3}px`, top: `${y3}px` };
210
+ }).then(({ x, y, placement }) => {
211
+ const styles = { left: `${x}px`, top: `${y}px` };
697
212
  return { tooltipStyles: styles, tooltipArrowStyles: {}, place: placement };
698
213
  });
699
214
  };
@@ -712,7 +227,7 @@ var Tooltip = ({
712
227
  anchorId,
713
228
  anchorSelect,
714
229
  place = "top",
715
- offset = 10,
230
+ offset: offset2 = 10,
716
231
  events = ["hover"],
717
232
  openOnClick = false,
718
233
  positionStrategy = "absolute",
@@ -858,24 +373,24 @@ var Tooltip = ({
858
373
  clearTimeout(tooltipShowDelayTimerRef.current);
859
374
  }
860
375
  };
861
- const handleTooltipPosition = ({ x: x3, y: y3 }) => {
376
+ const handleTooltipPosition = ({ x, y }) => {
862
377
  const virtualElement = {
863
378
  getBoundingClientRect() {
864
379
  return {
865
- x: x3,
866
- y: y3,
380
+ x,
381
+ y,
867
382
  width: 0,
868
383
  height: 0,
869
- top: y3,
870
- left: x3,
871
- right: x3,
872
- bottom: y3
384
+ top: y,
385
+ left: x,
386
+ right: x,
387
+ bottom: y
873
388
  };
874
389
  }
875
390
  };
876
391
  computeTooltipPosition({
877
392
  place,
878
- offset,
393
+ offset: offset2,
879
394
  elementReference: virtualElement,
880
395
  tooltipReference: tooltipRef.current,
881
396
  tooltipArrowReference: tooltipArrowRef.current,
@@ -1017,7 +532,8 @@ var Tooltip = ({
1017
532
  if (activeAnchor) {
1018
533
  ;
1019
534
  [...mutation.removedNodes].some((node) => {
1020
- if (node.contains(activeAnchor)) {
535
+ var _a;
536
+ if ((_a = node == null ? void 0 : node.contains) == null ? void 0 : _a.call(node, activeAnchor)) {
1021
537
  setRendered(false);
1022
538
  handleShow(false);
1023
539
  setActiveAnchor(null);
@@ -1041,7 +557,7 @@ var Tooltip = ({
1041
557
  (element) => [...element.querySelectorAll(selector)]
1042
558
  )
1043
559
  );
1044
- } catch (e2) {
560
+ } catch (e) {
1045
561
  }
1046
562
  });
1047
563
  if (newAnchors.length) {
@@ -1072,7 +588,7 @@ var Tooltip = ({
1072
588
  }
1073
589
  computeTooltipPosition({
1074
590
  place,
1075
- offset,
591
+ offset: offset2,
1076
592
  elementReference: activeAnchor,
1077
593
  tooltipReference: tooltipRef.current,
1078
594
  tooltipArrowReference: tooltipArrowRef.current,
@@ -1090,7 +606,7 @@ var Tooltip = ({
1090
606
  }
1091
607
  setActualPlacement(computedStylesData.place);
1092
608
  });
1093
- }, [show, activeAnchor, content, place, offset, positionStrategy, position]);
609
+ }, [show, activeAnchor, content, place, offset2, positionStrategy, position]);
1094
610
  useEffect3(() => {
1095
611
  var _a;
1096
612
  const anchorById = document.querySelector(`[id='${anchorId}']`);
@@ -1120,7 +636,7 @@ var Tooltip = ({
1120
636
  try {
1121
637
  const anchors = Array.from(document.querySelectorAll(selector));
1122
638
  setAnchorsBySelect(anchors);
1123
- } catch (e2) {
639
+ } catch (e) {
1124
640
  setAnchorsBySelect([]);
1125
641
  }
1126
642
  }, [id, anchorSelect]);
@@ -1130,7 +646,7 @@ var Tooltip = ({
1130
646
  {
1131
647
  id,
1132
648
  role: "tooltip",
1133
- className: (0, import_classnames2.default)(
649
+ className: classNames2(
1134
650
  "react-tooltip",
1135
651
  styles_module_default["tooltip"],
1136
652
  styles_module_default[variant],
@@ -1149,7 +665,7 @@ var Tooltip = ({
1149
665
  /* @__PURE__ */ jsx3(
1150
666
  WrapperElement,
1151
667
  {
1152
- className: (0, import_classnames2.default)("react-tooltip-arrow", styles_module_default["arrow"], classNameArrow, {
668
+ className: classNames2("react-tooltip-arrow", styles_module_default["arrow"], classNameArrow, {
1153
669
  /**
1154
670
  * changed from dash `no-arrow` to camelcase because of:
1155
671
  * https://github.com/indooorsman/esbuild-css-modules-plugin/issues/42
@@ -1186,7 +702,7 @@ var TooltipController = ({
1186
702
  classNameArrow,
1187
703
  variant = "dark",
1188
704
  place = "top",
1189
- offset = 10,
705
+ offset: offset2 = 10,
1190
706
  wrapper = "div",
1191
707
  children = null,
1192
708
  events = ["hover"],
@@ -1210,7 +726,7 @@ var TooltipController = ({
1210
726
  const [tooltipHtml, setTooltipHtml] = useState3(html);
1211
727
  const [tooltipPlace, setTooltipPlace] = useState3(place);
1212
728
  const [tooltipVariant, setTooltipVariant] = useState3(variant);
1213
- const [tooltipOffset, setTooltipOffset] = useState3(offset);
729
+ const [tooltipOffset, setTooltipOffset] = useState3(offset2);
1214
730
  const [tooltipDelayShow, setTooltipDelayShow] = useState3(delayShow);
1215
731
  const [tooltipDelayHide, setTooltipDelayHide] = useState3(delayHide);
1216
732
  const [tooltipFloat, setTooltipFloat] = useState3(float);
@@ -1245,7 +761,7 @@ var TooltipController = ({
1245
761
  setTooltipVariant(value != null ? value : variant);
1246
762
  },
1247
763
  offset: (value) => {
1248
- setTooltipOffset(value === null ? offset : Number(value));
764
+ setTooltipOffset(value === null ? offset2 : Number(value));
1249
765
  },
1250
766
  wrapper: (value) => {
1251
767
  setTooltipWrapper(value != null ? value : wrapper);
@@ -1295,7 +811,7 @@ var TooltipController = ({
1295
811
  anchorsBySelect.forEach((anchor) => {
1296
812
  elementRefs.add({ current: anchor });
1297
813
  });
1298
- } catch (e2) {
814
+ } catch (e) {
1299
815
  if (true) {
1300
816
  console.warn(`[react-tooltip] "${anchorSelect}" is not a valid CSS selector`);
1301
817
  }
@@ -1377,13 +893,4 @@ export {
1377
893
  TooltipProvider_default as TooltipProvider,
1378
894
  TooltipWrapper_default as TooltipWrapper
1379
895
  };
1380
- /*! Bundled license information:
1381
-
1382
- classnames/index.js:
1383
- (*!
1384
- Copyright (c) 2018 Jed Watson.
1385
- Licensed under the MIT License (MIT), see
1386
- http://jedwatson.github.io/classnames
1387
- *)
1388
- */
1389
896
  //# sourceMappingURL=react-tooltip.esm.js.map