react-tooltip 5.9.1-beta.0 → 5.9.1-beta.2

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) => {
@@ -191,8 +114,8 @@ function useTooltip(tooltipId = DEFAULT_TOOLTIP_ID) {
191
114
  var TooltipProvider_default = TooltipProvider;
192
115
 
193
116
  // src/components/TooltipProvider/TooltipWrapper.tsx
194
- var import_classnames = __toESM(require_classnames());
195
117
  import { useEffect, useRef } from "react";
118
+ import classNames from "classnames";
196
119
  import { jsx as jsx3 } from "react/jsx-runtime";
197
120
  var TooltipWrapper = ({
198
121
  tooltipId,
@@ -202,7 +125,7 @@ var TooltipWrapper = ({
202
125
  content,
203
126
  html,
204
127
  variant,
205
- offset,
128
+ offset: offset2,
206
129
  wrapper,
207
130
  events,
208
131
  positionStrategy,
@@ -221,12 +144,12 @@ var TooltipWrapper = ({
221
144
  "span",
222
145
  {
223
146
  ref: anchorRef,
224
- className: (0, import_classnames.default)("react-tooltip-wrapper", className),
147
+ className: classNames("react-tooltip-wrapper", className),
225
148
  "data-tooltip-place": place,
226
149
  "data-tooltip-content": content,
227
150
  "data-tooltip-html": html,
228
151
  "data-tooltip-variant": variant,
229
- "data-tooltip-offset": offset,
152
+ "data-tooltip-offset": offset2,
230
153
  "data-tooltip-wrapper": wrapper,
231
154
  "data-tooltip-events": events,
232
155
  "data-tooltip-position-strategy": positionStrategy,
@@ -243,416 +166,8 @@ import { useLayoutEffect, useEffect as useEffect2 } from "react";
243
166
  var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect2;
244
167
  var use_isomorphic_layout_effect_default = useIsomorphicLayoutEffect;
245
168
 
246
- // node_modules/@floating-ui/core/dist/floating-ui.core.browser.min.mjs
247
- function t(t2) {
248
- return t2.split("-")[1];
249
- }
250
- function e(t2) {
251
- return "y" === t2 ? "height" : "width";
252
- }
253
- function n(t2) {
254
- return t2.split("-")[0];
255
- }
256
- function o(t2) {
257
- return ["top", "bottom"].includes(n(t2)) ? "x" : "y";
258
- }
259
- function i(i3, r3, a3) {
260
- let { reference: l3, floating: s3 } = i3;
261
- const c3 = l3.x + l3.width / 2 - s3.width / 2, f3 = l3.y + l3.height / 2 - s3.height / 2, m3 = o(r3), u3 = e(m3), g3 = l3[u3] / 2 - s3[u3] / 2, d3 = "x" === m3;
262
- let p3;
263
- switch (n(r3)) {
264
- case "top":
265
- p3 = { x: c3, y: l3.y - s3.height };
266
- break;
267
- case "bottom":
268
- p3 = { x: c3, y: l3.y + l3.height };
269
- break;
270
- case "right":
271
- p3 = { x: l3.x + l3.width, y: f3 };
272
- break;
273
- case "left":
274
- p3 = { x: l3.x - s3.width, y: f3 };
275
- break;
276
- default:
277
- p3 = { x: l3.x, y: l3.y };
278
- }
279
- switch (t(r3)) {
280
- case "start":
281
- p3[m3] -= g3 * (a3 && d3 ? -1 : 1);
282
- break;
283
- case "end":
284
- p3[m3] += g3 * (a3 && d3 ? -1 : 1);
285
- }
286
- return p3;
287
- }
288
- var r = async (t2, e2, n3) => {
289
- const { placement: o3 = "bottom", strategy: r3 = "absolute", middleware: a3 = [], platform: l3 } = n3, s3 = a3.filter(Boolean), c3 = await (null == l3.isRTL ? void 0 : l3.isRTL(e2));
290
- let f3 = await l3.getElementRects({ reference: t2, floating: e2, strategy: r3 }), { x: m3, y: u3 } = i(f3, o3, c3), g3 = o3, d3 = {}, p3 = 0;
291
- for (let n4 = 0; n4 < s3.length; n4++) {
292
- const { name: a4, fn: h3 } = s3[n4], { x: y3, y: x3, data: w3, reset: v3 } = await h3({ x: m3, y: u3, initialPlacement: o3, placement: g3, strategy: r3, middlewareData: d3, rects: f3, platform: l3, elements: { reference: t2, floating: e2 } });
293
- m3 = null != y3 ? y3 : m3, u3 = null != x3 ? x3 : u3, d3 = { ...d3, [a4]: { ...d3[a4], ...w3 } }, v3 && p3 <= 50 && (p3++, "object" == typeof v3 && (v3.placement && (g3 = v3.placement), v3.rects && (f3 = true === v3.rects ? await l3.getElementRects({ reference: t2, floating: e2, strategy: r3 }) : v3.rects), { x: m3, y: u3 } = i(f3, g3, c3)), n4 = -1);
294
- }
295
- return { x: m3, y: u3, placement: g3, strategy: r3, middlewareData: d3 };
296
- };
297
- function a(t2) {
298
- return "number" != typeof t2 ? function(t3) {
299
- return { top: 0, right: 0, bottom: 0, left: 0, ...t3 };
300
- }(t2) : { top: t2, right: t2, bottom: t2, left: t2 };
301
- }
302
- function l(t2) {
303
- return { ...t2, top: t2.y, left: t2.x, right: t2.x + t2.width, bottom: t2.y + t2.height };
304
- }
305
- async function s(t2, e2) {
306
- var n3;
307
- void 0 === e2 && (e2 = {});
308
- const { x: o3, y: i3, platform: r3, rects: s3, elements: c3, strategy: f3 } = t2, { boundary: m3 = "clippingAncestors", rootBoundary: u3 = "viewport", elementContext: g3 = "floating", altBoundary: d3 = false, padding: p3 = 0 } = e2, h3 = a(p3), y3 = c3[d3 ? "floating" === g3 ? "reference" : "floating" : g3], x3 = l(await r3.getClippingRect({ element: null == (n3 = await (null == r3.isElement ? void 0 : r3.isElement(y3))) || n3 ? y3 : y3.contextElement || await (null == r3.getDocumentElement ? void 0 : r3.getDocumentElement(c3.floating)), boundary: m3, rootBoundary: u3, strategy: f3 })), w3 = "floating" === g3 ? { ...s3.floating, x: o3, y: i3 } : s3.reference, v3 = await (null == r3.getOffsetParent ? void 0 : r3.getOffsetParent(c3.floating)), b3 = await (null == r3.isElement ? void 0 : r3.isElement(v3)) && await (null == r3.getScale ? void 0 : r3.getScale(v3)) || { x: 1, y: 1 }, R2 = l(r3.convertOffsetParentRelativeRectToViewportRelativeRect ? await r3.convertOffsetParentRelativeRectToViewportRelativeRect({ rect: w3, offsetParent: v3, strategy: f3 }) : w3);
309
- return { top: (x3.top - R2.top + h3.top) / b3.y, bottom: (R2.bottom - x3.bottom + h3.bottom) / b3.y, left: (x3.left - R2.left + h3.left) / b3.x, right: (R2.right - x3.right + h3.right) / b3.x };
310
- }
311
- var c = Math.min;
312
- var f = Math.max;
313
- function m(t2, e2, n3) {
314
- return f(t2, c(e2, n3));
315
- }
316
- var u = (n3) => ({ name: "arrow", options: n3, async fn(i3) {
317
- const { element: r3, padding: l3 = 0 } = n3 || {}, { x: s3, y: c3, placement: f3, rects: u3, platform: g3, elements: d3 } = i3;
318
- if (null == r3)
319
- return {};
320
- const p3 = a(l3), h3 = { x: s3, y: c3 }, y3 = o(f3), x3 = e(y3), w3 = await g3.getDimensions(r3), v3 = "y" === y3, b3 = v3 ? "top" : "left", R2 = v3 ? "bottom" : "right", A2 = v3 ? "clientHeight" : "clientWidth", P2 = u3.reference[x3] + u3.reference[y3] - h3[y3] - u3.floating[x3], T3 = h3[y3] - u3.reference[y3], O3 = await (null == g3.getOffsetParent ? void 0 : g3.getOffsetParent(r3));
321
- let E3 = O3 ? O3[A2] : 0;
322
- E3 && await (null == g3.isElement ? void 0 : g3.isElement(O3)) || (E3 = d3.floating[A2] || u3.floating[x3]);
323
- const D3 = P2 / 2 - T3 / 2, L3 = p3[b3], k2 = E3 - w3[x3] - p3[R2], B = E3 / 2 - w3[x3] / 2 + D3, C2 = m(L3, B, k2), H2 = null != t(f3) && B != C2 && u3.reference[x3] / 2 - (B < L3 ? p3[b3] : p3[R2]) - w3[x3] / 2 < 0;
324
- return { [y3]: h3[y3] - (H2 ? B < L3 ? L3 - B : k2 - B : 0), data: { [y3]: C2, centerOffset: B - C2 } };
325
- } });
326
- var g = ["top", "right", "bottom", "left"];
327
- var d = g.reduce((t2, e2) => t2.concat(e2, e2 + "-start", e2 + "-end"), []);
328
- var p = { left: "right", right: "left", bottom: "top", top: "bottom" };
329
- function h(t2) {
330
- return t2.replace(/left|right|bottom|top/g, (t3) => p[t3]);
331
- }
332
- function y(n3, i3, r3) {
333
- void 0 === r3 && (r3 = false);
334
- const a3 = t(n3), l3 = o(n3), s3 = e(l3);
335
- let c3 = "x" === l3 ? a3 === (r3 ? "end" : "start") ? "right" : "left" : "start" === a3 ? "bottom" : "top";
336
- return i3.reference[s3] > i3.floating[s3] && (c3 = h(c3)), { main: c3, cross: h(c3) };
337
- }
338
- var x = { start: "end", end: "start" };
339
- function w(t2) {
340
- return t2.replace(/start|end/g, (t3) => x[t3]);
341
- }
342
- var b = function(e2) {
343
- return void 0 === e2 && (e2 = {}), { name: "flip", options: e2, async fn(o3) {
344
- var i3;
345
- const { placement: r3, middlewareData: a3, rects: l3, initialPlacement: c3, platform: f3, elements: m3 } = o3, { mainAxis: u3 = true, crossAxis: g3 = true, fallbackPlacements: d3, fallbackStrategy: p3 = "bestFit", fallbackAxisSideDirection: x3 = "none", flipAlignment: v3 = true, ...b3 } = e2, R2 = n(r3), A2 = n(c3) === c3, P2 = await (null == f3.isRTL ? void 0 : f3.isRTL(m3.floating)), T3 = d3 || (A2 || !v3 ? [h(c3)] : function(t2) {
346
- const e3 = h(t2);
347
- return [w(t2), e3, w(e3)];
348
- }(c3));
349
- d3 || "none" === x3 || T3.push(...function(e3, o4, i4, r4) {
350
- const a4 = t(e3);
351
- let l4 = function(t2, e4, n3) {
352
- const o5 = ["left", "right"], i5 = ["right", "left"], r5 = ["top", "bottom"], a5 = ["bottom", "top"];
353
- switch (t2) {
354
- case "top":
355
- case "bottom":
356
- return n3 ? e4 ? i5 : o5 : e4 ? o5 : i5;
357
- case "left":
358
- case "right":
359
- return e4 ? r5 : a5;
360
- default:
361
- return [];
362
- }
363
- }(n(e3), "start" === i4, r4);
364
- return a4 && (l4 = l4.map((t2) => t2 + "-" + a4), o4 && (l4 = l4.concat(l4.map(w)))), l4;
365
- }(c3, v3, x3, P2));
366
- const O3 = [c3, ...T3], E3 = await s(o3, b3), D3 = [];
367
- let L3 = (null == (i3 = a3.flip) ? void 0 : i3.overflows) || [];
368
- if (u3 && D3.push(E3[R2]), g3) {
369
- const { main: t2, cross: e3 } = y(r3, l3, P2);
370
- D3.push(E3[t2], E3[e3]);
371
- }
372
- if (L3 = [...L3, { placement: r3, overflows: D3 }], !D3.every((t2) => t2 <= 0)) {
373
- var k2, B;
374
- const t2 = ((null == (k2 = a3.flip) ? void 0 : k2.index) || 0) + 1, e3 = O3[t2];
375
- if (e3)
376
- return { data: { index: t2, overflows: L3 }, reset: { placement: e3 } };
377
- let n3 = null == (B = L3.filter((t3) => t3.overflows[0] <= 0).sort((t3, e4) => t3.overflows[1] - e4.overflows[1])[0]) ? void 0 : B.placement;
378
- if (!n3)
379
- switch (p3) {
380
- case "bestFit": {
381
- var C2;
382
- 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];
383
- t3 && (n3 = t3);
384
- break;
385
- }
386
- case "initialPlacement":
387
- n3 = c3;
388
- }
389
- if (r3 !== n3)
390
- return { reset: { placement: n3 } };
391
- }
392
- return {};
393
- } };
394
- };
395
- var O = function(e2) {
396
- return void 0 === e2 && (e2 = 0), { name: "offset", options: e2, async fn(i3) {
397
- const { x: r3, y: a3 } = i3, l3 = await async function(e3, i4) {
398
- const { placement: r4, platform: a4, elements: l4 } = e3, s3 = await (null == a4.isRTL ? void 0 : a4.isRTL(l4.floating)), c3 = n(r4), f3 = t(r4), m3 = "x" === o(r4), u3 = ["left", "top"].includes(c3) ? -1 : 1, g3 = s3 && m3 ? -1 : 1, d3 = "function" == typeof i4 ? i4(e3) : i4;
399
- let { mainAxis: p3, crossAxis: h3, alignmentAxis: y3 } = "number" == typeof d3 ? { mainAxis: d3, crossAxis: 0, alignmentAxis: null } : { mainAxis: 0, crossAxis: 0, alignmentAxis: null, ...d3 };
400
- return f3 && "number" == typeof y3 && (h3 = "end" === f3 ? -1 * y3 : y3), m3 ? { x: h3 * g3, y: p3 * u3 } : { x: p3 * u3, y: h3 * g3 };
401
- }(i3, e2);
402
- return { x: r3 + l3.x, y: a3 + l3.y, data: l3 };
403
- } };
404
- };
405
- function E(t2) {
406
- return "x" === t2 ? "y" : "x";
407
- }
408
- var D = function(t2) {
409
- return void 0 === t2 && (t2 = {}), { name: "shift", options: t2, async fn(e2) {
410
- const { x: i3, y: r3, placement: a3 } = e2, { mainAxis: l3 = true, crossAxis: c3 = false, limiter: f3 = { fn: (t3) => {
411
- let { x: e3, y: n3 } = t3;
412
- return { x: e3, y: n3 };
413
- } }, ...u3 } = t2, g3 = { x: i3, y: r3 }, d3 = await s(e2, u3), p3 = o(n(a3)), h3 = E(p3);
414
- let y3 = g3[p3], x3 = g3[h3];
415
- if (l3) {
416
- const t3 = "y" === p3 ? "bottom" : "right";
417
- y3 = m(y3 + d3["y" === p3 ? "top" : "left"], y3, y3 - d3[t3]);
418
- }
419
- if (c3) {
420
- const t3 = "y" === h3 ? "bottom" : "right";
421
- x3 = m(x3 + d3["y" === h3 ? "top" : "left"], x3, x3 - d3[t3]);
422
- }
423
- const w3 = f3.fn({ ...e2, [p3]: y3, [h3]: x3 });
424
- return { ...w3, data: { x: w3.x - i3, y: w3.y - r3 } };
425
- } };
426
- };
427
-
428
- // node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.min.mjs
429
- function n2(t2) {
430
- var e2;
431
- return (null == (e2 = t2.ownerDocument) ? void 0 : e2.defaultView) || window;
432
- }
433
- function o2(t2) {
434
- return n2(t2).getComputedStyle(t2);
435
- }
436
- var i2 = Math.min;
437
- var r2 = Math.max;
438
- var l2 = Math.round;
439
- function c2(t2) {
440
- const e2 = o2(t2);
441
- let n3 = parseFloat(e2.width), i3 = parseFloat(e2.height);
442
- const r3 = t2.offsetWidth, c3 = t2.offsetHeight, s3 = l2(n3) !== r3 || l2(i3) !== c3;
443
- return s3 && (n3 = r3, i3 = c3), { width: n3, height: i3, fallback: s3 };
444
- }
445
- function s2(t2) {
446
- return h2(t2) ? (t2.nodeName || "").toLowerCase() : "";
447
- }
448
- var f2;
449
- function u2() {
450
- if (f2)
451
- return f2;
452
- const t2 = navigator.userAgentData;
453
- return t2 && Array.isArray(t2.brands) ? (f2 = t2.brands.map((t3) => t3.brand + "/" + t3.version).join(" "), f2) : navigator.userAgent;
454
- }
455
- function a2(t2) {
456
- return t2 instanceof n2(t2).HTMLElement;
457
- }
458
- function d2(t2) {
459
- return t2 instanceof n2(t2).Element;
460
- }
461
- function h2(t2) {
462
- return t2 instanceof n2(t2).Node;
463
- }
464
- function p2(t2) {
465
- if ("undefined" == typeof ShadowRoot)
466
- return false;
467
- return t2 instanceof n2(t2).ShadowRoot || t2 instanceof ShadowRoot;
468
- }
469
- function g2(t2) {
470
- const { overflow: e2, overflowX: n3, overflowY: i3, display: r3 } = o2(t2);
471
- return /auto|scroll|overlay|hidden|clip/.test(e2 + i3 + n3) && !["inline", "contents"].includes(r3);
472
- }
473
- function m2(t2) {
474
- return ["table", "td", "th"].includes(s2(t2));
475
- }
476
- function y2(t2) {
477
- const e2 = /firefox/i.test(u2()), n3 = o2(t2), i3 = n3.backdropFilter || n3.WebkitBackdropFilter;
478
- 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) => {
479
- const e3 = n3.contain;
480
- return null != e3 && e3.includes(t3);
481
- });
482
- }
483
- function x2() {
484
- return /^((?!chrome|android).)*safari/i.test(u2());
485
- }
486
- function w2(t2) {
487
- return ["html", "body", "#document"].includes(s2(t2));
488
- }
489
- function v2(t2) {
490
- return d2(t2) ? t2 : t2.contextElement;
491
- }
492
- var b2 = { x: 1, y: 1 };
493
- function L2(t2) {
494
- const e2 = v2(t2);
495
- if (!a2(e2))
496
- return b2;
497
- const n3 = e2.getBoundingClientRect(), { width: o3, height: i3, fallback: r3 } = c2(e2);
498
- let s3 = (r3 ? l2(n3.width) : n3.width) / o3, f3 = (r3 ? l2(n3.height) : n3.height) / i3;
499
- return s3 && Number.isFinite(s3) || (s3 = 1), f3 && Number.isFinite(f3) || (f3 = 1), { x: s3, y: f3 };
500
- }
501
- function E2(e2, o3, i3, r3) {
502
- var l3, c3;
503
- void 0 === o3 && (o3 = false), void 0 === i3 && (i3 = false);
504
- const s3 = e2.getBoundingClientRect(), f3 = v2(e2);
505
- let u3 = b2;
506
- o3 && (r3 ? d2(r3) && (u3 = L2(r3)) : u3 = L2(e2));
507
- const a3 = f3 ? n2(f3) : window, h3 = x2() && i3;
508
- let p3 = (s3.left + (h3 && (null == (l3 = a3.visualViewport) ? void 0 : l3.offsetLeft) || 0)) / u3.x, g3 = (s3.top + (h3 && (null == (c3 = a3.visualViewport) ? void 0 : c3.offsetTop) || 0)) / u3.y, m3 = s3.width / u3.x, y3 = s3.height / u3.y;
509
- if (f3) {
510
- const t2 = n2(f3), e3 = r3 && d2(r3) ? n2(r3) : r3;
511
- let o4 = t2.frameElement;
512
- for (; o4 && r3 && e3 !== t2; ) {
513
- const t3 = L2(o4), e4 = o4.getBoundingClientRect(), i4 = getComputedStyle(o4);
514
- e4.x += (o4.clientLeft + parseFloat(i4.paddingLeft)) * t3.x, e4.y += (o4.clientTop + parseFloat(i4.paddingTop)) * t3.y, p3 *= t3.x, g3 *= t3.y, m3 *= t3.x, y3 *= t3.y, p3 += e4.x, g3 += e4.y, o4 = n2(o4).frameElement;
515
- }
516
- }
517
- return l({ width: m3, height: y3, x: p3, y: g3 });
518
- }
519
- function R(t2) {
520
- return ((h2(t2) ? t2.ownerDocument : t2.document) || window.document).documentElement;
521
- }
522
- function T2(t2) {
523
- return d2(t2) ? { scrollLeft: t2.scrollLeft, scrollTop: t2.scrollTop } : { scrollLeft: t2.pageXOffset, scrollTop: t2.pageYOffset };
524
- }
525
- function C(t2) {
526
- return E2(R(t2)).left + T2(t2).scrollLeft;
527
- }
528
- function F(t2) {
529
- if ("html" === s2(t2))
530
- return t2;
531
- const e2 = t2.assignedSlot || t2.parentNode || p2(t2) && t2.host || R(t2);
532
- return p2(e2) ? e2.host : e2;
533
- }
534
- function W(t2) {
535
- const e2 = F(t2);
536
- return w2(e2) ? e2.ownerDocument.body : a2(e2) && g2(e2) ? e2 : W(e2);
537
- }
538
- function D2(t2, e2) {
539
- var o3;
540
- void 0 === e2 && (e2 = []);
541
- const i3 = W(t2), r3 = i3 === (null == (o3 = t2.ownerDocument) ? void 0 : o3.body), l3 = n2(i3);
542
- return r3 ? e2.concat(l3, l3.visualViewport || [], g2(i3) ? i3 : []) : e2.concat(i3, D2(i3));
543
- }
544
- function S(e2, i3, l3) {
545
- let c3;
546
- if ("viewport" === i3)
547
- c3 = function(t2, e3) {
548
- const o3 = n2(t2), i4 = R(t2), r3 = o3.visualViewport;
549
- let l4 = i4.clientWidth, c4 = i4.clientHeight, s4 = 0, f4 = 0;
550
- if (r3) {
551
- l4 = r3.width, c4 = r3.height;
552
- const t3 = x2();
553
- (!t3 || t3 && "fixed" === e3) && (s4 = r3.offsetLeft, f4 = r3.offsetTop);
554
- }
555
- return { width: l4, height: c4, x: s4, y: f4 };
556
- }(e2, l3);
557
- else if ("document" === i3)
558
- c3 = function(t2) {
559
- const e3 = R(t2), n3 = T2(t2), i4 = t2.ownerDocument.body, l4 = r2(e3.scrollWidth, e3.clientWidth, i4.scrollWidth, i4.clientWidth), c4 = r2(e3.scrollHeight, e3.clientHeight, i4.scrollHeight, i4.clientHeight);
560
- let s4 = -n3.scrollLeft + C(t2);
561
- const f4 = -n3.scrollTop;
562
- return "rtl" === o2(i4).direction && (s4 += r2(e3.clientWidth, i4.clientWidth) - l4), { width: l4, height: c4, x: s4, y: f4 };
563
- }(R(e2));
564
- else if (d2(i3))
565
- c3 = function(t2, e3) {
566
- const n3 = E2(t2, true, "fixed" === e3), o3 = n3.top + t2.clientTop, i4 = n3.left + t2.clientLeft, r3 = a2(t2) ? L2(t2) : { x: 1, y: 1 };
567
- return { width: t2.clientWidth * r3.x, height: t2.clientHeight * r3.y, x: i4 * r3.x, y: o3 * r3.y };
568
- }(i3, l3);
569
- else {
570
- const t2 = { ...i3 };
571
- if (x2()) {
572
- var s3, f3;
573
- const o3 = n2(e2);
574
- t2.x -= (null == (s3 = o3.visualViewport) ? void 0 : s3.offsetLeft) || 0, t2.y -= (null == (f3 = o3.visualViewport) ? void 0 : f3.offsetTop) || 0;
575
- }
576
- c3 = t2;
577
- }
578
- return l(c3);
579
- }
580
- function A(t2, e2) {
581
- return a2(t2) && "fixed" !== o2(t2).position ? e2 ? e2(t2) : t2.offsetParent : null;
582
- }
583
- function H(t2, e2) {
584
- const i3 = n2(t2);
585
- if (!a2(t2))
586
- return i3;
587
- let r3 = A(t2, e2);
588
- for (; r3 && m2(r3) && "static" === o2(r3).position; )
589
- r3 = A(r3, e2);
590
- return r3 && ("html" === s2(r3) || "body" === s2(r3) && "static" === o2(r3).position && !y2(r3)) ? i3 : r3 || function(t3) {
591
- let e3 = F(t3);
592
- for (; a2(e3) && !w2(e3); ) {
593
- if (y2(e3))
594
- return e3;
595
- e3 = F(e3);
596
- }
597
- return null;
598
- }(t2) || i3;
599
- }
600
- function V(t2, e2, n3) {
601
- const o3 = a2(e2), i3 = R(e2), r3 = E2(t2, true, "fixed" === n3, e2);
602
- let l3 = { scrollLeft: 0, scrollTop: 0 };
603
- const c3 = { x: 0, y: 0 };
604
- if (o3 || !o3 && "fixed" !== n3)
605
- if (("body" !== s2(e2) || g2(i3)) && (l3 = T2(e2)), a2(e2)) {
606
- const t3 = E2(e2, true);
607
- c3.x = t3.x + e2.clientLeft, c3.y = t3.y + e2.clientTop;
608
- } else
609
- i3 && (c3.x = C(i3));
610
- return { x: r3.left + l3.scrollLeft - c3.x, y: r3.top + l3.scrollTop - c3.y, width: r3.width, height: r3.height };
611
- }
612
- var O2 = { getClippingRect: function(t2) {
613
- let { element: e2, boundary: n3, rootBoundary: l3, strategy: c3 } = t2;
614
- const f3 = "clippingAncestors" === n3 ? function(t3, e3) {
615
- const n4 = e3.get(t3);
616
- if (n4)
617
- return n4;
618
- let i3 = D2(t3).filter((t4) => d2(t4) && "body" !== s2(t4)), r3 = null;
619
- const l4 = "fixed" === o2(t3).position;
620
- let c4 = l4 ? F(t3) : t3;
621
- for (; d2(c4) && !w2(c4); ) {
622
- const t4 = o2(c4), e4 = y2(c4);
623
- "fixed" === t4.position ? r3 = null : (l4 ? e4 || r3 : e4 || "static" !== t4.position || !r3 || !["absolute", "fixed"].includes(r3.position)) ? r3 = t4 : i3 = i3.filter((t5) => t5 !== c4), c4 = F(c4);
624
- }
625
- return e3.set(t3, i3), i3;
626
- }(e2, this._c) : [].concat(n3), u3 = [...f3, l3], a3 = u3[0], h3 = u3.reduce((t3, n4) => {
627
- const o3 = S(e2, n4, c3);
628
- 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;
629
- }, S(e2, a3, c3));
630
- return { width: h3.right - h3.left, height: h3.bottom - h3.top, x: h3.left, y: h3.top };
631
- }, convertOffsetParentRelativeRectToViewportRelativeRect: function(t2) {
632
- let { rect: e2, offsetParent: n3, strategy: o3 } = t2;
633
- const i3 = a2(n3), r3 = R(n3);
634
- if (n3 === r3)
635
- return e2;
636
- let l3 = { scrollLeft: 0, scrollTop: 0 }, c3 = { x: 1, y: 1 };
637
- const f3 = { x: 0, y: 0 };
638
- if ((i3 || !i3 && "fixed" !== o3) && (("body" !== s2(n3) || g2(r3)) && (l3 = T2(n3)), a2(n3))) {
639
- const t3 = E2(n3);
640
- c3 = L2(n3), f3.x = t3.x + n3.clientLeft, f3.y = t3.y + n3.clientTop;
641
- }
642
- 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 };
643
- }, isElement: d2, getDimensions: function(t2) {
644
- return a2(t2) ? c2(t2) : t2.getBoundingClientRect();
645
- }, getOffsetParent: H, getDocumentElement: R, getScale: L2, async getElementRects(t2) {
646
- let { reference: e2, floating: n3, strategy: o3 } = t2;
647
- const i3 = this.getOffsetParent || H, r3 = this.getDimensions;
648
- return { reference: V(e2, await i3(n3), o3), floating: { x: 0, y: 0, ...await r3(n3) } };
649
- }, getClientRects: (t2) => Array.from(t2.getClientRects()), isRTL: (t2) => "rtl" === o2(t2).direction };
650
- var z = (t2, n3, o3) => {
651
- const i3 = /* @__PURE__ */ new Map(), r3 = { platform: O2, ...o3 }, l3 = { ...r3.platform, _c: i3 };
652
- return r(t2, n3, { ...r3, platform: l3 });
653
- };
654
-
655
169
  // src/utils/compute-positions.ts
170
+ import { computePosition, offset, shift, arrow, flip } from "@floating-ui/dom";
656
171
  var computeTooltipPosition = async ({
657
172
  elementReference = null,
658
173
  tooltipReference = null,
@@ -660,7 +175,7 @@ var computeTooltipPosition = async ({
660
175
  place = "top",
661
176
  offset: offsetValue = 10,
662
177
  strategy = "absolute",
663
- middlewares = [O(Number(offsetValue)), b(), D({ padding: 5 })]
178
+ middlewares = [offset(Number(offsetValue)), flip(), shift({ padding: 5 })]
664
179
  }) => {
665
180
  if (!elementReference) {
666
181
  return { tooltipStyles: {}, tooltipArrowStyles: {}, place };
@@ -670,14 +185,14 @@ var computeTooltipPosition = async ({
670
185
  }
671
186
  const middleware = middlewares;
672
187
  if (tooltipArrowReference) {
673
- middleware.push(u({ element: tooltipArrowReference, padding: 5 }));
674
- return z(elementReference, tooltipReference, {
188
+ middleware.push(arrow({ element: tooltipArrowReference, padding: 5 }));
189
+ return computePosition(elementReference, tooltipReference, {
675
190
  placement: place,
676
191
  strategy,
677
192
  middleware
678
- }).then(({ x: x3, y: y3, placement, middlewareData }) => {
193
+ }).then(({ x, y, placement, middlewareData }) => {
679
194
  var _a, _b;
680
- const styles = { left: `${x3}px`, top: `${y3}px` };
195
+ const styles = { left: `${x}px`, top: `${y}px` };
681
196
  const { x: arrowX, y: arrowY } = (_a = middlewareData.arrow) != null ? _a : { x: 0, y: 0 };
682
197
  const staticSide = (_b = {
683
198
  top: "bottom",
@@ -695,12 +210,12 @@ var computeTooltipPosition = async ({
695
210
  return { tooltipStyles: styles, tooltipArrowStyles: arrowStyle, place: placement };
696
211
  });
697
212
  }
698
- return z(elementReference, tooltipReference, {
213
+ return computePosition(elementReference, tooltipReference, {
699
214
  placement: "bottom",
700
215
  strategy,
701
216
  middleware
702
- }).then(({ x: x3, y: y3, placement }) => {
703
- const styles = { left: `${x3}px`, top: `${y3}px` };
217
+ }).then(({ x, y, placement }) => {
218
+ const styles = { left: `${x}px`, top: `${y}px` };
704
219
  return { tooltipStyles: styles, tooltipArrowStyles: {}, place: placement };
705
220
  });
706
221
  };
@@ -719,7 +234,7 @@ var Tooltip = ({
719
234
  anchorId,
720
235
  anchorSelect,
721
236
  place = "top",
722
- offset = 10,
237
+ offset: offset2 = 10,
723
238
  events = ["hover"],
724
239
  positionStrategy = "absolute",
725
240
  middlewares,
@@ -865,24 +380,24 @@ var Tooltip = ({
865
380
  clearTimeout(tooltipShowDelayTimerRef.current);
866
381
  }
867
382
  };
868
- const handleTooltipPosition = ({ x: x3, y: y3 }) => {
383
+ const handleTooltipPosition = ({ x, y }) => {
869
384
  const virtualElement = {
870
385
  getBoundingClientRect() {
871
386
  return {
872
- x: x3,
873
- y: y3,
387
+ x,
388
+ y,
874
389
  width: 0,
875
390
  height: 0,
876
- top: y3,
877
- left: x3,
878
- right: x3,
879
- bottom: y3
391
+ top: y,
392
+ left: x,
393
+ right: x,
394
+ bottom: y
880
395
  };
881
396
  }
882
397
  };
883
398
  computeTooltipPosition({
884
399
  place,
885
- offset,
400
+ offset: offset2,
886
401
  elementReference: virtualElement,
887
402
  tooltipReference: tooltipRef.current,
888
403
  tooltipArrowReference: tooltipArrowRef.current,
@@ -1047,7 +562,7 @@ var Tooltip = ({
1047
562
  (element) => [...element.querySelectorAll(selector)]
1048
563
  )
1049
564
  );
1050
- } catch (e2) {
565
+ } catch (e) {
1051
566
  }
1052
567
  });
1053
568
  if (newAnchors.length) {
@@ -1078,7 +593,7 @@ var Tooltip = ({
1078
593
  }
1079
594
  computeTooltipPosition({
1080
595
  place,
1081
- offset,
596
+ offset: offset2,
1082
597
  elementReference: activeAnchor,
1083
598
  tooltipReference: tooltipRef.current,
1084
599
  tooltipArrowReference: tooltipArrowRef.current,
@@ -1096,7 +611,7 @@ var Tooltip = ({
1096
611
  }
1097
612
  setActualPlacement(computedStylesData.place);
1098
613
  });
1099
- }, [show, activeAnchor, content, html, place, offset, positionStrategy, position]);
614
+ }, [show, activeAnchor, content, html, place, offset2, positionStrategy, position]);
1100
615
  useEffect3(() => {
1101
616
  var _a;
1102
617
  const anchorById = document.querySelector(`[id='${anchorId}']`);
@@ -1126,7 +641,7 @@ var Tooltip = ({
1126
641
  try {
1127
642
  const anchors = Array.from(document.querySelectorAll(selector));
1128
643
  setAnchorsBySelect(anchors);
1129
- } catch (e2) {
644
+ } catch (e) {
1130
645
  setAnchorsBySelect([]);
1131
646
  }
1132
647
  }, [id, anchorSelect]);
@@ -1137,15 +652,18 @@ var Tooltip = ({
1137
652
  {
1138
653
  id,
1139
654
  role: "tooltip",
1140
- className: (0, import_classnames2.default)("react-tooltip", styles_module_default["tooltip"], styles_module_default[variant], className, {
1141
- [styles_module_default["show"]]: canShow,
1142
- [styles_module_default["fixed"]]: positionStrategy === "fixed",
1143
- [styles_module_default["clickable"]]: clickable,
1144
- "react-tooltip__place-top": actualPlacement === "top",
1145
- "react-tooltip__place-right": actualPlacement === "right",
1146
- "react-tooltip__place-bottom": actualPlacement === "bottom",
1147
- "react-tooltip__place-left": actualPlacement === "left"
1148
- }),
655
+ className: classNames2(
656
+ "react-tooltip",
657
+ styles_module_default["tooltip"],
658
+ styles_module_default[variant],
659
+ className,
660
+ `react-tooltip__place-${actualPlacement}`,
661
+ {
662
+ [styles_module_default["show"]]: canShow,
663
+ [styles_module_default["fixed"]]: positionStrategy === "fixed",
664
+ [styles_module_default["clickable"]]: clickable
665
+ }
666
+ ),
1149
667
  style: { ...externalStyles, ...inlineStyles },
1150
668
  ref: tooltipRef,
1151
669
  children: [
@@ -1153,7 +671,7 @@ var Tooltip = ({
1153
671
  /* @__PURE__ */ jsx4(
1154
672
  WrapperElement,
1155
673
  {
1156
- className: (0, import_classnames2.default)("react-tooltip-arrow", styles_module_default["arrow"], classNameArrow, {
674
+ className: classNames2("react-tooltip-arrow", styles_module_default["arrow"], classNameArrow, {
1157
675
  /**
1158
676
  * changed from dash `no-arrow` to camelcase because of:
1159
677
  * https://github.com/indooorsman/esbuild-css-modules-plugin/issues/42
@@ -1182,7 +700,7 @@ var TooltipController = ({
1182
700
  classNameArrow,
1183
701
  variant = "dark",
1184
702
  place = "top",
1185
- offset = 10,
703
+ offset: offset2 = 10,
1186
704
  wrapper = "div",
1187
705
  children = null,
1188
706
  events = ["hover"],
@@ -1205,7 +723,7 @@ var TooltipController = ({
1205
723
  const [tooltipHtml, setTooltipHtml] = useState3(html);
1206
724
  const [tooltipPlace, setTooltipPlace] = useState3(place);
1207
725
  const [tooltipVariant, setTooltipVariant] = useState3(variant);
1208
- const [tooltipOffset, setTooltipOffset] = useState3(offset);
726
+ const [tooltipOffset, setTooltipOffset] = useState3(offset2);
1209
727
  const [tooltipDelayShow, setTooltipDelayShow] = useState3(delayShow);
1210
728
  const [tooltipDelayHide, setTooltipDelayHide] = useState3(delayHide);
1211
729
  const [tooltipFloat, setTooltipFloat] = useState3(float);
@@ -1240,7 +758,7 @@ var TooltipController = ({
1240
758
  setTooltipVariant(value != null ? value : variant);
1241
759
  },
1242
760
  offset: (value) => {
1243
- setTooltipOffset(value === null ? offset : Number(value));
761
+ setTooltipOffset(value === null ? offset2 : Number(value));
1244
762
  },
1245
763
  wrapper: (value) => {
1246
764
  setTooltipWrapper(value != null ? value : wrapper);
@@ -1290,7 +808,7 @@ var TooltipController = ({
1290
808
  anchorsBySelect.forEach((anchor) => {
1291
809
  elementRefs.add({ current: anchor });
1292
810
  });
1293
- } catch (e2) {
811
+ } catch (e) {
1294
812
  if (true) {
1295
813
  console.warn(`[react-tooltip] "${anchorSelect}" is not a valid CSS selector`);
1296
814
  }
@@ -1363,13 +881,4 @@ export {
1363
881
  TooltipProvider_default as TooltipProvider,
1364
882
  TooltipWrapper_default as TooltipWrapper
1365
883
  };
1366
- /*! Bundled license information:
1367
-
1368
- classnames/index.js:
1369
- (*!
1370
- Copyright (c) 2018 Jed Watson.
1371
- Licensed under the MIT License (MIT), see
1372
- http://jedwatson.github.io/classnames
1373
- *)
1374
- */
1375
884
  //# sourceMappingURL=react-tooltip.esm.js.map