react-tooltip 5.8.3 → 5.8.4-beta.0-esbuild
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/cra-app/README.md +70 -0
- package/cra-app/package.json +39 -0
- package/cra-app/public/favicon.ico +0 -0
- package/cra-app/public/index.html +43 -0
- package/cra-app/public/logo192.png +0 -0
- package/cra-app/public/logo512.png +0 -0
- package/cra-app/public/manifest.json +25 -0
- package/cra-app/public/robots.txt +3 -0
- package/cra-app/src/App.css +38 -0
- package/cra-app/src/App.js +30 -0
- package/cra-app/src/App.test.js +8 -0
- package/cra-app/src/index.css +13 -0
- package/cra-app/src/index.js +17 -0
- package/cra-app/src/logo.svg +1 -0
- package/cra-app/src/reportWebVitals.js +13 -0
- package/cra-app/src/setupTests.js +5 -0
- package/cra-app/yarn.lock +9270 -0
- package/dist/react-tooltip.cjs.js +1255 -2934
- package/dist/react-tooltip.cjs.js.map +7 -0
- package/dist/react-tooltip.cjs.min.js +11 -15
- package/dist/react-tooltip.cjs.min.js.map +7 -0
- package/dist/react-tooltip.css +23 -32
- package/dist/react-tooltip.css.map +7 -0
- package/dist/react-tooltip.d.ts +1 -1
- package/dist/react-tooltip.esm.js +1255 -2928
- package/dist/react-tooltip.esm.js.map +7 -0
- package/dist/react-tooltip.esm.min.js +11 -15
- package/dist/react-tooltip.esm.min.js.map +7 -0
- package/dist/react-tooltip.iife.js +1349 -0
- package/dist/react-tooltip.iife.js.map +7 -0
- package/dist/react-tooltip.iife.min.js +11 -0
- package/dist/react-tooltip.iife.min.js.map +7 -0
- package/dist/react-tooltip.min.css +2 -1
- package/dist/react-tooltip.min.css.map +7 -0
- package/esbuild.config.dev.mjs +32 -0
- package/esbuild.config.prod.mjs +92 -0
- package/package.json +12 -6
- package/tsconfig.json +1 -2
- package/dist/react-tooltip.umd.js +0 -3037
- package/dist/react-tooltip.umd.min.js +0 -15
|
@@ -0,0 +1,1349 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(() => {
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __require = /* @__PURE__ */ ((x3) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x3, {
|
|
10
|
+
get: (a3, b3) => (typeof require !== "undefined" ? require : a3)[b3]
|
|
11
|
+
}) : x3)(function(x3) {
|
|
12
|
+
if (typeof require !== "undefined")
|
|
13
|
+
return require.apply(this, arguments);
|
|
14
|
+
throw new Error('Dynamic require of "' + x3 + '" is not supported');
|
|
15
|
+
});
|
|
16
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
17
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
18
|
+
};
|
|
19
|
+
var __copyProps = (to, from, except, desc) => {
|
|
20
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
21
|
+
for (let key of __getOwnPropNames(from))
|
|
22
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
23
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
24
|
+
}
|
|
25
|
+
return to;
|
|
26
|
+
};
|
|
27
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
28
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
29
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
30
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
31
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
32
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
33
|
+
mod
|
|
34
|
+
));
|
|
35
|
+
|
|
36
|
+
// node_modules/classnames/index.js
|
|
37
|
+
var require_classnames = __commonJS({
|
|
38
|
+
"node_modules/classnames/index.js"(exports, module) {
|
|
39
|
+
(function() {
|
|
40
|
+
"use strict";
|
|
41
|
+
var hasOwn = {}.hasOwnProperty;
|
|
42
|
+
var nativeCodeString = "[native code]";
|
|
43
|
+
function classNames3() {
|
|
44
|
+
var classes = [];
|
|
45
|
+
for (var i3 = 0; i3 < arguments.length; i3++) {
|
|
46
|
+
var arg = arguments[i3];
|
|
47
|
+
if (!arg)
|
|
48
|
+
continue;
|
|
49
|
+
var argType = typeof arg;
|
|
50
|
+
if (argType === "string" || argType === "number") {
|
|
51
|
+
classes.push(arg);
|
|
52
|
+
} else if (Array.isArray(arg)) {
|
|
53
|
+
if (arg.length) {
|
|
54
|
+
var inner = classNames3.apply(null, arg);
|
|
55
|
+
if (inner) {
|
|
56
|
+
classes.push(inner);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
} else if (argType === "object") {
|
|
60
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
|
|
61
|
+
classes.push(arg.toString());
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
for (var key in arg) {
|
|
65
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
66
|
+
classes.push(key);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return classes.join(" ");
|
|
72
|
+
}
|
|
73
|
+
if (typeof module !== "undefined" && module.exports) {
|
|
74
|
+
classNames3.default = classNames3;
|
|
75
|
+
module.exports = classNames3;
|
|
76
|
+
} else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
|
|
77
|
+
define("classnames", [], function() {
|
|
78
|
+
return classNames3;
|
|
79
|
+
});
|
|
80
|
+
} else {
|
|
81
|
+
window.classNames = classNames3;
|
|
82
|
+
}
|
|
83
|
+
})();
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// src/components/TooltipController/TooltipController.tsx
|
|
88
|
+
var import_react5 = __require("react");
|
|
89
|
+
|
|
90
|
+
// src/components/Tooltip/Tooltip.tsx
|
|
91
|
+
var import_react4 = __require("react");
|
|
92
|
+
var import_classnames2 = __toESM(require_classnames());
|
|
93
|
+
|
|
94
|
+
// src/utils/debounce.ts
|
|
95
|
+
var debounce = (func, wait, immediate) => {
|
|
96
|
+
let timeout = null;
|
|
97
|
+
return function debounced(...args) {
|
|
98
|
+
const later = () => {
|
|
99
|
+
timeout = null;
|
|
100
|
+
if (!immediate) {
|
|
101
|
+
func.apply(this, args);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
if (timeout) {
|
|
105
|
+
clearTimeout(timeout);
|
|
106
|
+
}
|
|
107
|
+
timeout = setTimeout(later, wait);
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
var debounce_default = debounce;
|
|
111
|
+
|
|
112
|
+
// src/components/TooltipContent/TooltipContent.tsx
|
|
113
|
+
var import_jsx_runtime = __require("react/jsx-runtime");
|
|
114
|
+
var TooltipContent = ({ content }) => {
|
|
115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { dangerouslySetInnerHTML: { __html: content } });
|
|
116
|
+
};
|
|
117
|
+
var TooltipContent_default = TooltipContent;
|
|
118
|
+
|
|
119
|
+
// src/components/TooltipProvider/TooltipProvider.tsx
|
|
120
|
+
var import_react = __require("react");
|
|
121
|
+
var import_jsx_runtime2 = __require("react/jsx-runtime");
|
|
122
|
+
var DEFAULT_TOOLTIP_ID = "DEFAULT_TOOLTIP_ID";
|
|
123
|
+
var DEFAULT_CONTEXT_DATA = {
|
|
124
|
+
anchorRefs: /* @__PURE__ */ new Set(),
|
|
125
|
+
activeAnchor: { current: null },
|
|
126
|
+
attach: () => {
|
|
127
|
+
},
|
|
128
|
+
detach: () => {
|
|
129
|
+
},
|
|
130
|
+
setActiveAnchor: () => {
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
var DEFAULT_CONTEXT_DATA_WRAPPER = {
|
|
134
|
+
getTooltipData: () => DEFAULT_CONTEXT_DATA
|
|
135
|
+
};
|
|
136
|
+
var TooltipContext = (0, import_react.createContext)(DEFAULT_CONTEXT_DATA_WRAPPER);
|
|
137
|
+
var TooltipProvider = ({ children }) => {
|
|
138
|
+
const [anchorRefMap, setAnchorRefMap] = (0, import_react.useState)({
|
|
139
|
+
[DEFAULT_TOOLTIP_ID]: /* @__PURE__ */ new Set()
|
|
140
|
+
});
|
|
141
|
+
const [activeAnchorMap, setActiveAnchorMap] = (0, import_react.useState)({
|
|
142
|
+
[DEFAULT_TOOLTIP_ID]: { current: null }
|
|
143
|
+
});
|
|
144
|
+
const attach = (tooltipId, ...refs) => {
|
|
145
|
+
setAnchorRefMap((oldMap) => {
|
|
146
|
+
var _a;
|
|
147
|
+
const tooltipRefs = (_a = oldMap[tooltipId]) != null ? _a : /* @__PURE__ */ new Set();
|
|
148
|
+
refs.forEach((ref) => tooltipRefs.add(ref));
|
|
149
|
+
return { ...oldMap, [tooltipId]: new Set(tooltipRefs) };
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
const detach = (tooltipId, ...refs) => {
|
|
153
|
+
setAnchorRefMap((oldMap) => {
|
|
154
|
+
const tooltipRefs = oldMap[tooltipId];
|
|
155
|
+
if (!tooltipRefs) {
|
|
156
|
+
return oldMap;
|
|
157
|
+
}
|
|
158
|
+
refs.forEach((ref) => tooltipRefs.delete(ref));
|
|
159
|
+
return { ...oldMap };
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
const setActiveAnchor = (tooltipId, ref) => {
|
|
163
|
+
setActiveAnchorMap((oldMap) => {
|
|
164
|
+
var _a;
|
|
165
|
+
if (((_a = oldMap[tooltipId]) == null ? void 0 : _a.current) === ref.current) {
|
|
166
|
+
return oldMap;
|
|
167
|
+
}
|
|
168
|
+
return { ...oldMap, [tooltipId]: ref };
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
const getTooltipData = (0, import_react.useCallback)(
|
|
172
|
+
(tooltipId = DEFAULT_TOOLTIP_ID) => {
|
|
173
|
+
var _a, _b;
|
|
174
|
+
return {
|
|
175
|
+
anchorRefs: (_a = anchorRefMap[tooltipId]) != null ? _a : /* @__PURE__ */ new Set(),
|
|
176
|
+
activeAnchor: (_b = activeAnchorMap[tooltipId]) != null ? _b : { current: null },
|
|
177
|
+
attach: (...refs) => attach(tooltipId, ...refs),
|
|
178
|
+
detach: (...refs) => detach(tooltipId, ...refs),
|
|
179
|
+
setActiveAnchor: (ref) => setActiveAnchor(tooltipId, ref)
|
|
180
|
+
};
|
|
181
|
+
},
|
|
182
|
+
[anchorRefMap, activeAnchorMap, attach, detach]
|
|
183
|
+
);
|
|
184
|
+
const context = (0, import_react.useMemo)(() => {
|
|
185
|
+
return {
|
|
186
|
+
getTooltipData
|
|
187
|
+
};
|
|
188
|
+
}, [getTooltipData]);
|
|
189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TooltipContext.Provider, { value: context, children });
|
|
190
|
+
};
|
|
191
|
+
function useTooltip(tooltipId = DEFAULT_TOOLTIP_ID) {
|
|
192
|
+
return (0, import_react.useContext)(TooltipContext).getTooltipData(tooltipId);
|
|
193
|
+
}
|
|
194
|
+
var TooltipProvider_default = TooltipProvider;
|
|
195
|
+
|
|
196
|
+
// src/components/TooltipProvider/TooltipWrapper.tsx
|
|
197
|
+
var import_react2 = __require("react");
|
|
198
|
+
var import_classnames = __toESM(require_classnames());
|
|
199
|
+
var import_jsx_runtime3 = __require("react/jsx-runtime");
|
|
200
|
+
var TooltipWrapper = ({
|
|
201
|
+
tooltipId,
|
|
202
|
+
children,
|
|
203
|
+
className,
|
|
204
|
+
place,
|
|
205
|
+
content,
|
|
206
|
+
html,
|
|
207
|
+
variant,
|
|
208
|
+
offset,
|
|
209
|
+
wrapper,
|
|
210
|
+
events,
|
|
211
|
+
positionStrategy,
|
|
212
|
+
delayShow,
|
|
213
|
+
delayHide
|
|
214
|
+
}) => {
|
|
215
|
+
const { attach, detach } = useTooltip(tooltipId);
|
|
216
|
+
const anchorRef = (0, import_react2.useRef)(null);
|
|
217
|
+
(0, import_react2.useEffect)(() => {
|
|
218
|
+
attach(anchorRef);
|
|
219
|
+
return () => {
|
|
220
|
+
detach(anchorRef);
|
|
221
|
+
};
|
|
222
|
+
}, []);
|
|
223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
224
|
+
"span",
|
|
225
|
+
{
|
|
226
|
+
ref: anchorRef,
|
|
227
|
+
className: (0, import_classnames.default)("react-tooltip-wrapper", className),
|
|
228
|
+
"data-tooltip-place": place,
|
|
229
|
+
"data-tooltip-content": content,
|
|
230
|
+
"data-tooltip-html": html,
|
|
231
|
+
"data-tooltip-variant": variant,
|
|
232
|
+
"data-tooltip-offset": offset,
|
|
233
|
+
"data-tooltip-wrapper": wrapper,
|
|
234
|
+
"data-tooltip-events": events,
|
|
235
|
+
"data-tooltip-position-strategy": positionStrategy,
|
|
236
|
+
"data-tooltip-delay-show": delayShow,
|
|
237
|
+
"data-tooltip-delay-hide": delayHide,
|
|
238
|
+
children
|
|
239
|
+
}
|
|
240
|
+
);
|
|
241
|
+
};
|
|
242
|
+
var TooltipWrapper_default = TooltipWrapper;
|
|
243
|
+
|
|
244
|
+
// src/utils/use-isomorphic-layout-effect.ts
|
|
245
|
+
var import_react3 = __require("react");
|
|
246
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react3.useLayoutEffect : import_react3.useEffect;
|
|
247
|
+
var use_isomorphic_layout_effect_default = useIsomorphicLayoutEffect;
|
|
248
|
+
|
|
249
|
+
// node_modules/@floating-ui/core/dist/floating-ui.core.browser.min.mjs
|
|
250
|
+
function t(t2) {
|
|
251
|
+
return t2.split("-")[1];
|
|
252
|
+
}
|
|
253
|
+
function e(t2) {
|
|
254
|
+
return "y" === t2 ? "height" : "width";
|
|
255
|
+
}
|
|
256
|
+
function n(t2) {
|
|
257
|
+
return t2.split("-")[0];
|
|
258
|
+
}
|
|
259
|
+
function o(t2) {
|
|
260
|
+
return ["top", "bottom"].includes(n(t2)) ? "x" : "y";
|
|
261
|
+
}
|
|
262
|
+
function i(i3, r3, a3) {
|
|
263
|
+
let { reference: l3, floating: s3 } = i3;
|
|
264
|
+
const c3 = l3.x + l3.width / 2 - s3.width / 2, f3 = l3.y + l3.height / 2 - s3.height / 2, u3 = o(r3), m3 = e(u3), g3 = l3[m3] / 2 - s3[m3] / 2, d3 = "x" === u3;
|
|
265
|
+
let p3;
|
|
266
|
+
switch (n(r3)) {
|
|
267
|
+
case "top":
|
|
268
|
+
p3 = { x: c3, y: l3.y - s3.height };
|
|
269
|
+
break;
|
|
270
|
+
case "bottom":
|
|
271
|
+
p3 = { x: c3, y: l3.y + l3.height };
|
|
272
|
+
break;
|
|
273
|
+
case "right":
|
|
274
|
+
p3 = { x: l3.x + l3.width, y: f3 };
|
|
275
|
+
break;
|
|
276
|
+
case "left":
|
|
277
|
+
p3 = { x: l3.x - s3.width, y: f3 };
|
|
278
|
+
break;
|
|
279
|
+
default:
|
|
280
|
+
p3 = { x: l3.x, y: l3.y };
|
|
281
|
+
}
|
|
282
|
+
switch (t(r3)) {
|
|
283
|
+
case "start":
|
|
284
|
+
p3[u3] -= g3 * (a3 && d3 ? -1 : 1);
|
|
285
|
+
break;
|
|
286
|
+
case "end":
|
|
287
|
+
p3[u3] += g3 * (a3 && d3 ? -1 : 1);
|
|
288
|
+
}
|
|
289
|
+
return p3;
|
|
290
|
+
}
|
|
291
|
+
var r = async (t2, e2, n3) => {
|
|
292
|
+
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));
|
|
293
|
+
let f3 = await l3.getElementRects({ reference: t2, floating: e2, strategy: r3 }), { x: u3, y: m3 } = i(f3, o3, c3), g3 = o3, d3 = {}, p3 = 0;
|
|
294
|
+
for (let n4 = 0; n4 < s3.length; n4++) {
|
|
295
|
+
const { name: a4, fn: h3 } = s3[n4], { x: y3, y: x3, data: w3, reset: v3 } = await h3({ x: u3, y: m3, initialPlacement: o3, placement: g3, strategy: r3, middlewareData: d3, rects: f3, platform: l3, elements: { reference: t2, floating: e2 } });
|
|
296
|
+
u3 = null != y3 ? y3 : u3, m3 = null != x3 ? x3 : m3, 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: u3, y: m3 } = i(f3, g3, c3)), n4 = -1);
|
|
297
|
+
}
|
|
298
|
+
return { x: u3, y: m3, placement: g3, strategy: r3, middlewareData: d3 };
|
|
299
|
+
};
|
|
300
|
+
function a(t2) {
|
|
301
|
+
return "number" != typeof t2 ? function(t3) {
|
|
302
|
+
return { top: 0, right: 0, bottom: 0, left: 0, ...t3 };
|
|
303
|
+
}(t2) : { top: t2, right: t2, bottom: t2, left: t2 };
|
|
304
|
+
}
|
|
305
|
+
function l(t2) {
|
|
306
|
+
return { ...t2, top: t2.y, left: t2.x, right: t2.x + t2.width, bottom: t2.y + t2.height };
|
|
307
|
+
}
|
|
308
|
+
async function s(t2, e2) {
|
|
309
|
+
var n3;
|
|
310
|
+
void 0 === e2 && (e2 = {});
|
|
311
|
+
const { x: o3, y: i3, platform: r3, rects: s3, elements: c3, strategy: f3 } = t2, { boundary: u3 = "clippingAncestors", rootBoundary: m3 = "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: u3, rootBoundary: m3, 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);
|
|
312
|
+
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 };
|
|
313
|
+
}
|
|
314
|
+
var c = Math.min;
|
|
315
|
+
var f = Math.max;
|
|
316
|
+
function u(t2, e2, n3) {
|
|
317
|
+
return f(t2, c(e2, n3));
|
|
318
|
+
}
|
|
319
|
+
var m = (n3) => ({ name: "arrow", options: n3, async fn(i3) {
|
|
320
|
+
const { element: r3, padding: l3 = 0 } = n3 || {}, { x: s3, y: c3, placement: f3, rects: m3, platform: g3 } = i3;
|
|
321
|
+
if (null == r3)
|
|
322
|
+
return {};
|
|
323
|
+
const d3 = a(l3), p3 = { x: s3, y: c3 }, h3 = o(f3), y3 = e(h3), x3 = await g3.getDimensions(r3), w3 = "y" === h3 ? "top" : "left", v3 = "y" === h3 ? "bottom" : "right", b3 = m3.reference[y3] + m3.reference[h3] - p3[h3] - m3.floating[y3], R2 = p3[h3] - m3.reference[h3], A2 = await (null == g3.getOffsetParent ? void 0 : g3.getOffsetParent(r3));
|
|
324
|
+
let P3 = A2 ? "y" === h3 ? A2.clientHeight || 0 : A2.clientWidth || 0 : 0;
|
|
325
|
+
0 === P3 && (P3 = m3.floating[y3]);
|
|
326
|
+
const T3 = b3 / 2 - R2 / 2, O3 = d3[w3], D3 = P3 - x3[y3] - d3[v3], E3 = P3 / 2 - x3[y3] / 2 + T3, L3 = u(O3, E3, D3), k2 = null != t(f3) && E3 != L3 && m3.reference[y3] / 2 - (E3 < O3 ? d3[w3] : d3[v3]) - x3[y3] / 2 < 0;
|
|
327
|
+
return { [h3]: p3[h3] - (k2 ? E3 < O3 ? O3 - E3 : D3 - E3 : 0), data: { [h3]: L3, centerOffset: E3 - L3 } };
|
|
328
|
+
} });
|
|
329
|
+
var g = ["top", "right", "bottom", "left"];
|
|
330
|
+
var d = g.reduce((t2, e2) => t2.concat(e2, e2 + "-start", e2 + "-end"), []);
|
|
331
|
+
var p = { left: "right", right: "left", bottom: "top", top: "bottom" };
|
|
332
|
+
function h(t2) {
|
|
333
|
+
return t2.replace(/left|right|bottom|top/g, (t3) => p[t3]);
|
|
334
|
+
}
|
|
335
|
+
function y(n3, i3, r3) {
|
|
336
|
+
void 0 === r3 && (r3 = false);
|
|
337
|
+
const a3 = t(n3), l3 = o(n3), s3 = e(l3);
|
|
338
|
+
let c3 = "x" === l3 ? a3 === (r3 ? "end" : "start") ? "right" : "left" : "start" === a3 ? "bottom" : "top";
|
|
339
|
+
return i3.reference[s3] > i3.floating[s3] && (c3 = h(c3)), { main: c3, cross: h(c3) };
|
|
340
|
+
}
|
|
341
|
+
var x = { start: "end", end: "start" };
|
|
342
|
+
function w(t2) {
|
|
343
|
+
return t2.replace(/start|end/g, (t3) => x[t3]);
|
|
344
|
+
}
|
|
345
|
+
var b = function(e2) {
|
|
346
|
+
return void 0 === e2 && (e2 = {}), { name: "flip", options: e2, async fn(o3) {
|
|
347
|
+
var i3;
|
|
348
|
+
const { placement: r3, middlewareData: a3, rects: l3, initialPlacement: c3, platform: f3, elements: u3 } = o3, { mainAxis: m3 = true, crossAxis: g3 = true, fallbackPlacements: d3, fallbackStrategy: p3 = "bestFit", fallbackAxisSideDirection: x3 = "none", flipAlignment: v3 = true, ...b3 } = e2, R2 = n(r3), A2 = n(c3) === c3, P3 = await (null == f3.isRTL ? void 0 : f3.isRTL(u3.floating)), T3 = d3 || (A2 || !v3 ? [h(c3)] : function(t2) {
|
|
349
|
+
const e3 = h(t2);
|
|
350
|
+
return [w(t2), e3, w(e3)];
|
|
351
|
+
}(c3));
|
|
352
|
+
d3 || "none" === x3 || T3.push(...function(e3, o4, i4, r4) {
|
|
353
|
+
const a4 = t(e3);
|
|
354
|
+
let l4 = function(t2, e4, n3) {
|
|
355
|
+
const o5 = ["left", "right"], i5 = ["right", "left"], r5 = ["top", "bottom"], a5 = ["bottom", "top"];
|
|
356
|
+
switch (t2) {
|
|
357
|
+
case "top":
|
|
358
|
+
case "bottom":
|
|
359
|
+
return n3 ? e4 ? i5 : o5 : e4 ? o5 : i5;
|
|
360
|
+
case "left":
|
|
361
|
+
case "right":
|
|
362
|
+
return e4 ? r5 : a5;
|
|
363
|
+
default:
|
|
364
|
+
return [];
|
|
365
|
+
}
|
|
366
|
+
}(n(e3), "start" === i4, r4);
|
|
367
|
+
return a4 && (l4 = l4.map((t2) => t2 + "-" + a4), o4 && (l4 = l4.concat(l4.map(w)))), l4;
|
|
368
|
+
}(c3, v3, x3, P3));
|
|
369
|
+
const O3 = [c3, ...T3], D3 = await s(o3, b3), E3 = [];
|
|
370
|
+
let L3 = (null == (i3 = a3.flip) ? void 0 : i3.overflows) || [];
|
|
371
|
+
if (m3 && E3.push(D3[R2]), g3) {
|
|
372
|
+
const { main: t2, cross: e3 } = y(r3, l3, P3);
|
|
373
|
+
E3.push(D3[t2], D3[e3]);
|
|
374
|
+
}
|
|
375
|
+
if (L3 = [...L3, { placement: r3, overflows: E3 }], !E3.every((t2) => t2 <= 0)) {
|
|
376
|
+
var k2, B2;
|
|
377
|
+
const t2 = ((null == (k2 = a3.flip) ? void 0 : k2.index) || 0) + 1, e3 = O3[t2];
|
|
378
|
+
if (e3)
|
|
379
|
+
return { data: { index: t2, overflows: L3 }, reset: { placement: e3 } };
|
|
380
|
+
let n3 = null == (B2 = L3.find((t3) => t3.overflows[0] <= 0)) ? void 0 : B2.placement;
|
|
381
|
+
if (!n3)
|
|
382
|
+
switch (p3) {
|
|
383
|
+
case "bestFit": {
|
|
384
|
+
var C2;
|
|
385
|
+
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];
|
|
386
|
+
t3 && (n3 = t3);
|
|
387
|
+
break;
|
|
388
|
+
}
|
|
389
|
+
case "initialPlacement":
|
|
390
|
+
n3 = c3;
|
|
391
|
+
}
|
|
392
|
+
if (r3 !== n3)
|
|
393
|
+
return { reset: { placement: n3 } };
|
|
394
|
+
}
|
|
395
|
+
return {};
|
|
396
|
+
} };
|
|
397
|
+
};
|
|
398
|
+
var O = function(e2) {
|
|
399
|
+
return void 0 === e2 && (e2 = 0), { name: "offset", options: e2, async fn(i3) {
|
|
400
|
+
const { x: r3, y: a3 } = i3, l3 = await async function(e3, i4) {
|
|
401
|
+
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), u3 = "x" === o(r4), m3 = ["left", "top"].includes(c3) ? -1 : 1, g3 = s3 && u3 ? -1 : 1, d3 = "function" == typeof i4 ? i4(e3) : i4;
|
|
402
|
+
let { mainAxis: p3, crossAxis: h3, alignmentAxis: y3 } = "number" == typeof d3 ? { mainAxis: d3, crossAxis: 0, alignmentAxis: null } : { mainAxis: 0, crossAxis: 0, alignmentAxis: null, ...d3 };
|
|
403
|
+
return f3 && "number" == typeof y3 && (h3 = "end" === f3 ? -1 * y3 : y3), u3 ? { x: h3 * g3, y: p3 * m3 } : { x: p3 * m3, y: h3 * g3 };
|
|
404
|
+
}(i3, e2);
|
|
405
|
+
return { x: r3 + l3.x, y: a3 + l3.y, data: l3 };
|
|
406
|
+
} };
|
|
407
|
+
};
|
|
408
|
+
function D(t2) {
|
|
409
|
+
return "x" === t2 ? "y" : "x";
|
|
410
|
+
}
|
|
411
|
+
var E = function(t2) {
|
|
412
|
+
return void 0 === t2 && (t2 = {}), { name: "shift", options: t2, async fn(e2) {
|
|
413
|
+
const { x: i3, y: r3, placement: a3 } = e2, { mainAxis: l3 = true, crossAxis: c3 = false, limiter: f3 = { fn: (t3) => {
|
|
414
|
+
let { x: e3, y: n3 } = t3;
|
|
415
|
+
return { x: e3, y: n3 };
|
|
416
|
+
} }, ...m3 } = t2, g3 = { x: i3, y: r3 }, d3 = await s(e2, m3), p3 = o(n(a3)), h3 = D(p3);
|
|
417
|
+
let y3 = g3[p3], x3 = g3[h3];
|
|
418
|
+
if (l3) {
|
|
419
|
+
const t3 = "y" === p3 ? "bottom" : "right";
|
|
420
|
+
y3 = u(y3 + d3["y" === p3 ? "top" : "left"], y3, y3 - d3[t3]);
|
|
421
|
+
}
|
|
422
|
+
if (c3) {
|
|
423
|
+
const t3 = "y" === h3 ? "bottom" : "right";
|
|
424
|
+
x3 = u(x3 + d3["y" === h3 ? "top" : "left"], x3, x3 - d3[t3]);
|
|
425
|
+
}
|
|
426
|
+
const w3 = f3.fn({ ...e2, [p3]: y3, [h3]: x3 });
|
|
427
|
+
return { ...w3, data: { x: w3.x - i3, y: w3.y - r3 } };
|
|
428
|
+
} };
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
// node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.min.mjs
|
|
432
|
+
function n2(t2) {
|
|
433
|
+
var e2;
|
|
434
|
+
return (null == (e2 = t2.ownerDocument) ? void 0 : e2.defaultView) || window;
|
|
435
|
+
}
|
|
436
|
+
function o2(t2) {
|
|
437
|
+
return n2(t2).getComputedStyle(t2);
|
|
438
|
+
}
|
|
439
|
+
var i2 = Math.min;
|
|
440
|
+
var r2 = Math.max;
|
|
441
|
+
var l2 = Math.round;
|
|
442
|
+
function c2(t2) {
|
|
443
|
+
const e2 = o2(t2);
|
|
444
|
+
let n3 = parseFloat(e2.width), i3 = parseFloat(e2.height);
|
|
445
|
+
const r3 = t2.offsetWidth, c3 = t2.offsetHeight, s3 = l2(n3) !== r3 || l2(i3) !== c3;
|
|
446
|
+
return s3 && (n3 = r3, i3 = c3), { width: n3, height: i3, fallback: s3 };
|
|
447
|
+
}
|
|
448
|
+
function s2(t2) {
|
|
449
|
+
return h2(t2) ? (t2.nodeName || "").toLowerCase() : "";
|
|
450
|
+
}
|
|
451
|
+
var f2;
|
|
452
|
+
function u2() {
|
|
453
|
+
if (f2)
|
|
454
|
+
return f2;
|
|
455
|
+
const t2 = navigator.userAgentData;
|
|
456
|
+
return t2 && Array.isArray(t2.brands) ? (f2 = t2.brands.map((t3) => t3.brand + "/" + t3.version).join(" "), f2) : navigator.userAgent;
|
|
457
|
+
}
|
|
458
|
+
function a2(t2) {
|
|
459
|
+
return t2 instanceof n2(t2).HTMLElement;
|
|
460
|
+
}
|
|
461
|
+
function d2(t2) {
|
|
462
|
+
return t2 instanceof n2(t2).Element;
|
|
463
|
+
}
|
|
464
|
+
function h2(t2) {
|
|
465
|
+
return t2 instanceof n2(t2).Node;
|
|
466
|
+
}
|
|
467
|
+
function p2(t2) {
|
|
468
|
+
if ("undefined" == typeof ShadowRoot)
|
|
469
|
+
return false;
|
|
470
|
+
return t2 instanceof n2(t2).ShadowRoot || t2 instanceof ShadowRoot;
|
|
471
|
+
}
|
|
472
|
+
function g2(t2) {
|
|
473
|
+
const { overflow: e2, overflowX: n3, overflowY: i3, display: r3 } = o2(t2);
|
|
474
|
+
return /auto|scroll|overlay|hidden|clip/.test(e2 + i3 + n3) && !["inline", "contents"].includes(r3);
|
|
475
|
+
}
|
|
476
|
+
function m2(t2) {
|
|
477
|
+
return ["table", "td", "th"].includes(s2(t2));
|
|
478
|
+
}
|
|
479
|
+
function y2(t2) {
|
|
480
|
+
const e2 = /firefox/i.test(u2()), n3 = o2(t2), i3 = n3.backdropFilter || n3.WebkitBackdropFilter;
|
|
481
|
+
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) => {
|
|
482
|
+
const e3 = n3.contain;
|
|
483
|
+
return null != e3 && e3.includes(t3);
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
function x2() {
|
|
487
|
+
return !/^((?!chrome|android).)*safari/i.test(u2());
|
|
488
|
+
}
|
|
489
|
+
function w2(t2) {
|
|
490
|
+
return ["html", "body", "#document"].includes(s2(t2));
|
|
491
|
+
}
|
|
492
|
+
function v2(t2) {
|
|
493
|
+
return d2(t2) ? t2 : t2.contextElement;
|
|
494
|
+
}
|
|
495
|
+
var b2 = { x: 1, y: 1 };
|
|
496
|
+
function L2(t2) {
|
|
497
|
+
const e2 = v2(t2);
|
|
498
|
+
if (!a2(e2))
|
|
499
|
+
return b2;
|
|
500
|
+
const n3 = e2.getBoundingClientRect(), { width: o3, height: i3, fallback: r3 } = c2(e2);
|
|
501
|
+
let s3 = (r3 ? l2(n3.width) : n3.width) / o3, f3 = (r3 ? l2(n3.height) : n3.height) / i3;
|
|
502
|
+
return s3 && Number.isFinite(s3) || (s3 = 1), f3 && Number.isFinite(f3) || (f3 = 1), { x: s3, y: f3 };
|
|
503
|
+
}
|
|
504
|
+
function E2(t2, e2, o3, i3) {
|
|
505
|
+
var r3, l3;
|
|
506
|
+
void 0 === e2 && (e2 = false), void 0 === o3 && (o3 = false);
|
|
507
|
+
const c3 = t2.getBoundingClientRect(), s3 = v2(t2);
|
|
508
|
+
let f3 = b2;
|
|
509
|
+
e2 && (i3 ? d2(i3) && (f3 = L2(i3)) : f3 = L2(t2));
|
|
510
|
+
const u3 = s3 ? n2(s3) : window, a3 = !x2() && o3;
|
|
511
|
+
let h3 = (c3.left + (a3 && (null == (r3 = u3.visualViewport) ? void 0 : r3.offsetLeft) || 0)) / f3.x, p3 = (c3.top + (a3 && (null == (l3 = u3.visualViewport) ? void 0 : l3.offsetTop) || 0)) / f3.y, g3 = c3.width / f3.x, m3 = c3.height / f3.y;
|
|
512
|
+
if (s3) {
|
|
513
|
+
const t3 = n2(s3), e3 = i3 && d2(i3) ? n2(i3) : i3;
|
|
514
|
+
let o4 = t3.frameElement;
|
|
515
|
+
for (; o4 && i3 && e3 !== t3; ) {
|
|
516
|
+
const t4 = L2(o4), e4 = o4.getBoundingClientRect(), i4 = getComputedStyle(o4);
|
|
517
|
+
e4.x += (o4.clientLeft + parseFloat(i4.paddingLeft)) * t4.x, e4.y += (o4.clientTop + parseFloat(i4.paddingTop)) * t4.y, h3 *= t4.x, p3 *= t4.y, g3 *= t4.x, m3 *= t4.y, h3 += e4.x, p3 += e4.y, o4 = n2(o4).frameElement;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
return { width: g3, height: m3, top: p3, right: h3 + g3, bottom: p3 + m3, left: h3, x: h3, y: p3 };
|
|
521
|
+
}
|
|
522
|
+
function R(t2) {
|
|
523
|
+
return ((h2(t2) ? t2.ownerDocument : t2.document) || window.document).documentElement;
|
|
524
|
+
}
|
|
525
|
+
function T2(t2) {
|
|
526
|
+
return d2(t2) ? { scrollLeft: t2.scrollLeft, scrollTop: t2.scrollTop } : { scrollLeft: t2.pageXOffset, scrollTop: t2.pageYOffset };
|
|
527
|
+
}
|
|
528
|
+
function C(t2) {
|
|
529
|
+
return E2(R(t2)).left + T2(t2).scrollLeft;
|
|
530
|
+
}
|
|
531
|
+
function F(t2) {
|
|
532
|
+
if ("html" === s2(t2))
|
|
533
|
+
return t2;
|
|
534
|
+
const e2 = t2.assignedSlot || t2.parentNode || p2(t2) && t2.host || R(t2);
|
|
535
|
+
return p2(e2) ? e2.host : e2;
|
|
536
|
+
}
|
|
537
|
+
function W(t2) {
|
|
538
|
+
const e2 = F(t2);
|
|
539
|
+
return w2(e2) ? e2.ownerDocument.body : a2(e2) && g2(e2) ? e2 : W(e2);
|
|
540
|
+
}
|
|
541
|
+
function D2(t2, e2) {
|
|
542
|
+
var o3;
|
|
543
|
+
void 0 === e2 && (e2 = []);
|
|
544
|
+
const i3 = W(t2), r3 = i3 === (null == (o3 = t2.ownerDocument) ? void 0 : o3.body), l3 = n2(i3);
|
|
545
|
+
return r3 ? e2.concat(l3, l3.visualViewport || [], g2(i3) ? i3 : []) : e2.concat(i3, D2(i3));
|
|
546
|
+
}
|
|
547
|
+
function S(e2, i3, l3) {
|
|
548
|
+
return "viewport" === i3 ? l(function(t2, e3) {
|
|
549
|
+
const o3 = n2(t2), i4 = R(t2), r3 = o3.visualViewport;
|
|
550
|
+
let l4 = i4.clientWidth, c3 = i4.clientHeight, s3 = 0, f3 = 0;
|
|
551
|
+
if (r3) {
|
|
552
|
+
l4 = r3.width, c3 = r3.height;
|
|
553
|
+
const t3 = x2();
|
|
554
|
+
(t3 || !t3 && "fixed" === e3) && (s3 = r3.offsetLeft, f3 = r3.offsetTop);
|
|
555
|
+
}
|
|
556
|
+
return { width: l4, height: c3, x: s3, y: f3 };
|
|
557
|
+
}(e2, l3)) : d2(i3) ? l(function(t2, e3) {
|
|
558
|
+
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 };
|
|
559
|
+
return { width: t2.clientWidth * r3.x, height: t2.clientHeight * r3.y, x: i4 * r3.x, y: o3 * r3.y };
|
|
560
|
+
}(i3, l3)) : l(function(t2) {
|
|
561
|
+
const e3 = R(t2), n3 = T2(t2), i4 = t2.ownerDocument.body, l4 = r2(e3.scrollWidth, e3.clientWidth, i4.scrollWidth, i4.clientWidth), c3 = r2(e3.scrollHeight, e3.clientHeight, i4.scrollHeight, i4.clientHeight);
|
|
562
|
+
let s3 = -n3.scrollLeft + C(t2);
|
|
563
|
+
const f3 = -n3.scrollTop;
|
|
564
|
+
return "rtl" === o2(i4).direction && (s3 += r2(e3.clientWidth, i4.clientWidth) - l4), { width: l4, height: c3, x: s3, y: f3 };
|
|
565
|
+
}(R(e2)));
|
|
566
|
+
}
|
|
567
|
+
function A(t2) {
|
|
568
|
+
return a2(t2) && "fixed" !== o2(t2).position ? t2.offsetParent : null;
|
|
569
|
+
}
|
|
570
|
+
function H(t2) {
|
|
571
|
+
const e2 = n2(t2);
|
|
572
|
+
let i3 = A(t2);
|
|
573
|
+
for (; i3 && m2(i3) && "static" === o2(i3).position; )
|
|
574
|
+
i3 = A(i3);
|
|
575
|
+
return i3 && ("html" === s2(i3) || "body" === s2(i3) && "static" === o2(i3).position && !y2(i3)) ? e2 : i3 || function(t3) {
|
|
576
|
+
let e3 = F(t3);
|
|
577
|
+
for (; a2(e3) && !w2(e3); ) {
|
|
578
|
+
if (y2(e3))
|
|
579
|
+
return e3;
|
|
580
|
+
e3 = F(e3);
|
|
581
|
+
}
|
|
582
|
+
return null;
|
|
583
|
+
}(t2) || e2;
|
|
584
|
+
}
|
|
585
|
+
function O2(t2, e2, n3) {
|
|
586
|
+
const o3 = a2(e2), i3 = R(e2), r3 = E2(t2, true, "fixed" === n3, e2);
|
|
587
|
+
let l3 = { scrollLeft: 0, scrollTop: 0 };
|
|
588
|
+
const c3 = { x: 0, y: 0 };
|
|
589
|
+
if (o3 || !o3 && "fixed" !== n3)
|
|
590
|
+
if (("body" !== s2(e2) || g2(i3)) && (l3 = T2(e2)), a2(e2)) {
|
|
591
|
+
const t3 = E2(e2, true);
|
|
592
|
+
c3.x = t3.x + e2.clientLeft, c3.y = t3.y + e2.clientTop;
|
|
593
|
+
} else
|
|
594
|
+
i3 && (c3.x = C(i3));
|
|
595
|
+
return { x: r3.left + l3.scrollLeft - c3.x, y: r3.top + l3.scrollTop - c3.y, width: r3.width, height: r3.height };
|
|
596
|
+
}
|
|
597
|
+
var P2 = { getClippingRect: function(t2) {
|
|
598
|
+
let { element: e2, boundary: n3, rootBoundary: l3, strategy: c3 } = t2;
|
|
599
|
+
const f3 = "clippingAncestors" === n3 ? function(t3, e3) {
|
|
600
|
+
const n4 = e3.get(t3);
|
|
601
|
+
if (n4)
|
|
602
|
+
return n4;
|
|
603
|
+
let i3 = D2(t3).filter((t4) => d2(t4) && "body" !== s2(t4)), r3 = null;
|
|
604
|
+
const l4 = "fixed" === o2(t3).position;
|
|
605
|
+
let c4 = l4 ? F(t3) : t3;
|
|
606
|
+
for (; d2(c4) && !w2(c4); ) {
|
|
607
|
+
const t4 = o2(c4), e4 = y2(c4);
|
|
608
|
+
(l4 ? e4 || r3 : e4 || "static" !== t4.position || !r3 || !["absolute", "fixed"].includes(r3.position)) ? r3 = t4 : i3 = i3.filter((t5) => t5 !== c4), c4 = F(c4);
|
|
609
|
+
}
|
|
610
|
+
return e3.set(t3, i3), i3;
|
|
611
|
+
}(e2, this._c) : [].concat(n3), u3 = [...f3, l3], a3 = u3[0], h3 = u3.reduce((t3, n4) => {
|
|
612
|
+
const o3 = S(e2, n4, c3);
|
|
613
|
+
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;
|
|
614
|
+
}, S(e2, a3, c3));
|
|
615
|
+
return { width: h3.right - h3.left, height: h3.bottom - h3.top, x: h3.left, y: h3.top };
|
|
616
|
+
}, convertOffsetParentRelativeRectToViewportRelativeRect: function(t2) {
|
|
617
|
+
let { rect: e2, offsetParent: n3, strategy: o3 } = t2;
|
|
618
|
+
const i3 = a2(n3), r3 = R(n3);
|
|
619
|
+
if (n3 === r3)
|
|
620
|
+
return e2;
|
|
621
|
+
let l3 = { scrollLeft: 0, scrollTop: 0 }, c3 = { x: 1, y: 1 };
|
|
622
|
+
const f3 = { x: 0, y: 0 };
|
|
623
|
+
if ((i3 || !i3 && "fixed" !== o3) && (("body" !== s2(n3) || g2(r3)) && (l3 = T2(n3)), a2(n3))) {
|
|
624
|
+
const t3 = E2(n3);
|
|
625
|
+
c3 = L2(n3), f3.x = t3.x + n3.clientLeft, f3.y = t3.y + n3.clientTop;
|
|
626
|
+
}
|
|
627
|
+
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 };
|
|
628
|
+
}, isElement: d2, getDimensions: function(t2) {
|
|
629
|
+
return a2(t2) ? c2(t2) : t2.getBoundingClientRect();
|
|
630
|
+
}, getOffsetParent: H, getDocumentElement: R, getScale: L2, async getElementRects(t2) {
|
|
631
|
+
let { reference: e2, floating: n3, strategy: o3 } = t2;
|
|
632
|
+
const i3 = this.getOffsetParent || H, r3 = this.getDimensions;
|
|
633
|
+
return { reference: O2(e2, await i3(n3), o3), floating: { x: 0, y: 0, ...await r3(n3) } };
|
|
634
|
+
}, getClientRects: (t2) => Array.from(t2.getClientRects()), isRTL: (t2) => "rtl" === o2(t2).direction };
|
|
635
|
+
var B = (t2, n3, o3) => {
|
|
636
|
+
const i3 = /* @__PURE__ */ new Map(), r3 = { platform: P2, ...o3 }, l3 = { ...r3.platform, _c: i3 };
|
|
637
|
+
return r(t2, n3, { ...r3, platform: l3 });
|
|
638
|
+
};
|
|
639
|
+
|
|
640
|
+
// src/utils/compute-positions.ts
|
|
641
|
+
var computeTooltipPosition = async ({
|
|
642
|
+
elementReference = null,
|
|
643
|
+
tooltipReference = null,
|
|
644
|
+
tooltipArrowReference = null,
|
|
645
|
+
place = "top",
|
|
646
|
+
offset: offsetValue = 10,
|
|
647
|
+
strategy = "absolute",
|
|
648
|
+
middlewares = [O(Number(offsetValue)), b(), E({ padding: 5 })]
|
|
649
|
+
}) => {
|
|
650
|
+
if (!elementReference) {
|
|
651
|
+
return { tooltipStyles: {}, tooltipArrowStyles: {} };
|
|
652
|
+
}
|
|
653
|
+
if (tooltipReference === null) {
|
|
654
|
+
return { tooltipStyles: {}, tooltipArrowStyles: {} };
|
|
655
|
+
}
|
|
656
|
+
const middleware = middlewares;
|
|
657
|
+
if (tooltipArrowReference) {
|
|
658
|
+
middleware.push(m({ element: tooltipArrowReference, padding: 5 }));
|
|
659
|
+
return B(elementReference, tooltipReference, {
|
|
660
|
+
placement: place,
|
|
661
|
+
strategy,
|
|
662
|
+
middleware
|
|
663
|
+
}).then(({ x: x3, y: y3, placement, middlewareData }) => {
|
|
664
|
+
var _a, _b;
|
|
665
|
+
const styles = { left: `${x3}px`, top: `${y3}px` };
|
|
666
|
+
const { x: arrowX, y: arrowY } = (_a = middlewareData.arrow) != null ? _a : { x: 0, y: 0 };
|
|
667
|
+
const staticSide = (_b = {
|
|
668
|
+
top: "bottom",
|
|
669
|
+
right: "left",
|
|
670
|
+
bottom: "top",
|
|
671
|
+
left: "right"
|
|
672
|
+
}[placement.split("-")[0]]) != null ? _b : "bottom";
|
|
673
|
+
const arrowStyle = {
|
|
674
|
+
left: arrowX != null ? `${arrowX}px` : "",
|
|
675
|
+
top: arrowY != null ? `${arrowY}px` : "",
|
|
676
|
+
right: "",
|
|
677
|
+
bottom: "",
|
|
678
|
+
[staticSide]: "-4px"
|
|
679
|
+
};
|
|
680
|
+
return { tooltipStyles: styles, tooltipArrowStyles: arrowStyle };
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
return B(elementReference, tooltipReference, {
|
|
684
|
+
placement: "bottom",
|
|
685
|
+
strategy,
|
|
686
|
+
middleware
|
|
687
|
+
}).then(({ x: x3, y: y3 }) => {
|
|
688
|
+
const styles = { left: `${x3}px`, top: `${y3}px` };
|
|
689
|
+
return { tooltipStyles: styles, tooltipArrowStyles: {} };
|
|
690
|
+
});
|
|
691
|
+
};
|
|
692
|
+
|
|
693
|
+
// esbuild-css-modules-plugin-namespace:./src/components/Tooltip/styles.module.css?esbuild-css-modules-plugin-building
|
|
694
|
+
var styles_module_default = { "arrow": "react-tooltip__arrow_KtSkBq", "clickable": "react-tooltip__clickable_KtSkBq", "dark": "react-tooltip__dark_KtSkBq", "error": "react-tooltip__error_KtSkBq", "fixed": "react-tooltip__fixed_KtSkBq", "info": "react-tooltip__info_KtSkBq", "light": "react-tooltip__light_KtSkBq", "noArrow": "react-tooltip__no-arrow_KtSkBq", "show": "react-tooltip__show_KtSkBq", "success": "react-tooltip__success_KtSkBq", "tooltip": "react-tooltip__tooltip_KtSkBq", "warning": "react-tooltip__warning_KtSkBq" };
|
|
695
|
+
|
|
696
|
+
// src/components/Tooltip/Tooltip.tsx
|
|
697
|
+
var import_jsx_runtime4 = __require("react/jsx-runtime");
|
|
698
|
+
var Tooltip = ({
|
|
699
|
+
// props
|
|
700
|
+
id,
|
|
701
|
+
className,
|
|
702
|
+
classNameArrow,
|
|
703
|
+
variant = "dark",
|
|
704
|
+
anchorId,
|
|
705
|
+
anchorSelect,
|
|
706
|
+
place = "top",
|
|
707
|
+
offset = 10,
|
|
708
|
+
events = ["hover"],
|
|
709
|
+
positionStrategy = "absolute",
|
|
710
|
+
middlewares,
|
|
711
|
+
wrapper: WrapperElement,
|
|
712
|
+
children = null,
|
|
713
|
+
delayShow = 0,
|
|
714
|
+
delayHide = 0,
|
|
715
|
+
float = false,
|
|
716
|
+
noArrow = false,
|
|
717
|
+
clickable = false,
|
|
718
|
+
closeOnEsc = false,
|
|
719
|
+
style: externalStyles,
|
|
720
|
+
position,
|
|
721
|
+
afterShow,
|
|
722
|
+
afterHide,
|
|
723
|
+
// props handled by controller
|
|
724
|
+
content,
|
|
725
|
+
html,
|
|
726
|
+
isOpen,
|
|
727
|
+
setIsOpen,
|
|
728
|
+
activeAnchor,
|
|
729
|
+
setActiveAnchor
|
|
730
|
+
}) => {
|
|
731
|
+
const tooltipRef = (0, import_react4.useRef)(null);
|
|
732
|
+
const tooltipArrowRef = (0, import_react4.useRef)(null);
|
|
733
|
+
const tooltipShowDelayTimerRef = (0, import_react4.useRef)(null);
|
|
734
|
+
const tooltipHideDelayTimerRef = (0, import_react4.useRef)(null);
|
|
735
|
+
const [inlineStyles, setInlineStyles] = (0, import_react4.useState)({});
|
|
736
|
+
const [inlineArrowStyles, setInlineArrowStyles] = (0, import_react4.useState)({});
|
|
737
|
+
const [show, setShow] = (0, import_react4.useState)(false);
|
|
738
|
+
const [rendered, setRendered] = (0, import_react4.useState)(false);
|
|
739
|
+
const wasShowing = (0, import_react4.useRef)(false);
|
|
740
|
+
const lastFloatPosition = (0, import_react4.useRef)(null);
|
|
741
|
+
const { anchorRefs, setActiveAnchor: setProviderActiveAnchor } = useTooltip(id);
|
|
742
|
+
const hoveringTooltip = (0, import_react4.useRef)(false);
|
|
743
|
+
const [anchorsBySelect, setAnchorsBySelect] = (0, import_react4.useState)([]);
|
|
744
|
+
const mounted = (0, import_react4.useRef)(false);
|
|
745
|
+
use_isomorphic_layout_effect_default(() => {
|
|
746
|
+
mounted.current = true;
|
|
747
|
+
return () => {
|
|
748
|
+
mounted.current = false;
|
|
749
|
+
};
|
|
750
|
+
}, []);
|
|
751
|
+
(0, import_react4.useEffect)(() => {
|
|
752
|
+
if (!show) {
|
|
753
|
+
const timeout = setTimeout(() => {
|
|
754
|
+
setRendered(false);
|
|
755
|
+
}, 150);
|
|
756
|
+
return () => {
|
|
757
|
+
clearTimeout(timeout);
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
return () => null;
|
|
761
|
+
}, [show]);
|
|
762
|
+
const handleShow = (value) => {
|
|
763
|
+
if (!mounted.current) {
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
if (value) {
|
|
767
|
+
setRendered(true);
|
|
768
|
+
}
|
|
769
|
+
setTimeout(() => {
|
|
770
|
+
if (!mounted.current) {
|
|
771
|
+
return;
|
|
772
|
+
}
|
|
773
|
+
setIsOpen == null ? void 0 : setIsOpen(value);
|
|
774
|
+
if (isOpen === void 0) {
|
|
775
|
+
setShow(value);
|
|
776
|
+
}
|
|
777
|
+
}, 10);
|
|
778
|
+
};
|
|
779
|
+
(0, import_react4.useEffect)(() => {
|
|
780
|
+
if (isOpen === void 0) {
|
|
781
|
+
return () => null;
|
|
782
|
+
}
|
|
783
|
+
if (isOpen) {
|
|
784
|
+
setRendered(true);
|
|
785
|
+
}
|
|
786
|
+
const timeout = setTimeout(() => {
|
|
787
|
+
setShow(isOpen);
|
|
788
|
+
}, 10);
|
|
789
|
+
return () => {
|
|
790
|
+
clearTimeout(timeout);
|
|
791
|
+
};
|
|
792
|
+
}, [isOpen]);
|
|
793
|
+
(0, import_react4.useEffect)(() => {
|
|
794
|
+
if (show === wasShowing.current) {
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
wasShowing.current = show;
|
|
798
|
+
if (show) {
|
|
799
|
+
afterShow == null ? void 0 : afterShow();
|
|
800
|
+
} else {
|
|
801
|
+
afterHide == null ? void 0 : afterHide();
|
|
802
|
+
}
|
|
803
|
+
}, [show]);
|
|
804
|
+
const handleShowTooltipDelayed = () => {
|
|
805
|
+
if (tooltipShowDelayTimerRef.current) {
|
|
806
|
+
clearTimeout(tooltipShowDelayTimerRef.current);
|
|
807
|
+
}
|
|
808
|
+
tooltipShowDelayTimerRef.current = setTimeout(() => {
|
|
809
|
+
handleShow(true);
|
|
810
|
+
}, delayShow);
|
|
811
|
+
};
|
|
812
|
+
const handleHideTooltipDelayed = (delay = delayHide) => {
|
|
813
|
+
if (tooltipHideDelayTimerRef.current) {
|
|
814
|
+
clearTimeout(tooltipHideDelayTimerRef.current);
|
|
815
|
+
}
|
|
816
|
+
tooltipHideDelayTimerRef.current = setTimeout(() => {
|
|
817
|
+
if (hoveringTooltip.current) {
|
|
818
|
+
return;
|
|
819
|
+
}
|
|
820
|
+
handleShow(false);
|
|
821
|
+
}, delay);
|
|
822
|
+
};
|
|
823
|
+
const handleShowTooltip = (event) => {
|
|
824
|
+
var _a;
|
|
825
|
+
if (!event) {
|
|
826
|
+
return;
|
|
827
|
+
}
|
|
828
|
+
if (delayShow) {
|
|
829
|
+
handleShowTooltipDelayed();
|
|
830
|
+
} else {
|
|
831
|
+
handleShow(true);
|
|
832
|
+
}
|
|
833
|
+
const target = (_a = event.currentTarget) != null ? _a : event.target;
|
|
834
|
+
setActiveAnchor(target);
|
|
835
|
+
setProviderActiveAnchor({ current: target });
|
|
836
|
+
if (tooltipHideDelayTimerRef.current) {
|
|
837
|
+
clearTimeout(tooltipHideDelayTimerRef.current);
|
|
838
|
+
}
|
|
839
|
+
};
|
|
840
|
+
const handleHideTooltip = () => {
|
|
841
|
+
if (clickable) {
|
|
842
|
+
handleHideTooltipDelayed(delayHide || 100);
|
|
843
|
+
} else if (delayHide) {
|
|
844
|
+
handleHideTooltipDelayed();
|
|
845
|
+
} else {
|
|
846
|
+
handleShow(false);
|
|
847
|
+
}
|
|
848
|
+
if (tooltipShowDelayTimerRef.current) {
|
|
849
|
+
clearTimeout(tooltipShowDelayTimerRef.current);
|
|
850
|
+
}
|
|
851
|
+
};
|
|
852
|
+
const handleTooltipPosition = ({ x: x3, y: y3 }) => {
|
|
853
|
+
const virtualElement = {
|
|
854
|
+
getBoundingClientRect() {
|
|
855
|
+
return {
|
|
856
|
+
x: x3,
|
|
857
|
+
y: y3,
|
|
858
|
+
width: 0,
|
|
859
|
+
height: 0,
|
|
860
|
+
top: y3,
|
|
861
|
+
left: x3,
|
|
862
|
+
right: x3,
|
|
863
|
+
bottom: y3
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
};
|
|
867
|
+
computeTooltipPosition({
|
|
868
|
+
place,
|
|
869
|
+
offset,
|
|
870
|
+
elementReference: virtualElement,
|
|
871
|
+
tooltipReference: tooltipRef.current,
|
|
872
|
+
tooltipArrowReference: tooltipArrowRef.current,
|
|
873
|
+
strategy: positionStrategy,
|
|
874
|
+
middlewares
|
|
875
|
+
}).then((computedStylesData) => {
|
|
876
|
+
if (Object.keys(computedStylesData.tooltipStyles).length) {
|
|
877
|
+
setInlineStyles(computedStylesData.tooltipStyles);
|
|
878
|
+
}
|
|
879
|
+
if (Object.keys(computedStylesData.tooltipArrowStyles).length) {
|
|
880
|
+
setInlineArrowStyles(computedStylesData.tooltipArrowStyles);
|
|
881
|
+
}
|
|
882
|
+
});
|
|
883
|
+
};
|
|
884
|
+
const handleMouseMove = (event) => {
|
|
885
|
+
if (!event) {
|
|
886
|
+
return;
|
|
887
|
+
}
|
|
888
|
+
const mouseEvent = event;
|
|
889
|
+
const mousePosition = {
|
|
890
|
+
x: mouseEvent.clientX,
|
|
891
|
+
y: mouseEvent.clientY
|
|
892
|
+
};
|
|
893
|
+
handleTooltipPosition(mousePosition);
|
|
894
|
+
lastFloatPosition.current = mousePosition;
|
|
895
|
+
};
|
|
896
|
+
const handleClickTooltipAnchor = (event) => {
|
|
897
|
+
handleShowTooltip(event);
|
|
898
|
+
if (delayHide) {
|
|
899
|
+
handleHideTooltipDelayed();
|
|
900
|
+
}
|
|
901
|
+
};
|
|
902
|
+
const handleClickOutsideAnchors = (event) => {
|
|
903
|
+
const anchorById = document.querySelector(`[id='${anchorId}']`);
|
|
904
|
+
if (anchorById == null ? void 0 : anchorById.contains(event.target)) {
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
if (anchorsBySelect.some((anchor) => anchor.contains(event.target))) {
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
910
|
+
handleShow(false);
|
|
911
|
+
};
|
|
912
|
+
const handleEsc = (event) => {
|
|
913
|
+
if (event.key !== "Escape") {
|
|
914
|
+
return;
|
|
915
|
+
}
|
|
916
|
+
handleShow(false);
|
|
917
|
+
};
|
|
918
|
+
const debouncedHandleShowTooltip = debounce_default(handleShowTooltip, 50);
|
|
919
|
+
const debouncedHandleHideTooltip = debounce_default(handleHideTooltip, 50);
|
|
920
|
+
(0, import_react4.useEffect)(() => {
|
|
921
|
+
var _a, _b;
|
|
922
|
+
const elementRefs = new Set(anchorRefs);
|
|
923
|
+
anchorsBySelect.forEach((anchor) => {
|
|
924
|
+
elementRefs.add({ current: anchor });
|
|
925
|
+
});
|
|
926
|
+
const anchorById = document.querySelector(`[id='${anchorId}']`);
|
|
927
|
+
if (anchorById) {
|
|
928
|
+
elementRefs.add({ current: anchorById });
|
|
929
|
+
}
|
|
930
|
+
if (closeOnEsc) {
|
|
931
|
+
window.addEventListener("keydown", handleEsc);
|
|
932
|
+
}
|
|
933
|
+
const enabledEvents = [];
|
|
934
|
+
if (events.find((event) => event === "click")) {
|
|
935
|
+
window.addEventListener("click", handleClickOutsideAnchors);
|
|
936
|
+
enabledEvents.push({ event: "click", listener: handleClickTooltipAnchor });
|
|
937
|
+
}
|
|
938
|
+
if (events.find((event) => event === "hover")) {
|
|
939
|
+
enabledEvents.push(
|
|
940
|
+
{ event: "mouseenter", listener: debouncedHandleShowTooltip },
|
|
941
|
+
{ event: "mouseleave", listener: debouncedHandleHideTooltip },
|
|
942
|
+
{ event: "focus", listener: debouncedHandleShowTooltip },
|
|
943
|
+
{ event: "blur", listener: debouncedHandleHideTooltip }
|
|
944
|
+
);
|
|
945
|
+
if (float) {
|
|
946
|
+
enabledEvents.push({
|
|
947
|
+
event: "mousemove",
|
|
948
|
+
listener: handleMouseMove
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
const handleMouseEnterTooltip = () => {
|
|
953
|
+
hoveringTooltip.current = true;
|
|
954
|
+
};
|
|
955
|
+
const handleMouseLeaveTooltip = () => {
|
|
956
|
+
hoveringTooltip.current = false;
|
|
957
|
+
handleHideTooltip();
|
|
958
|
+
};
|
|
959
|
+
if (clickable) {
|
|
960
|
+
(_a = tooltipRef.current) == null ? void 0 : _a.addEventListener("mouseenter", handleMouseEnterTooltip);
|
|
961
|
+
(_b = tooltipRef.current) == null ? void 0 : _b.addEventListener("mouseleave", handleMouseLeaveTooltip);
|
|
962
|
+
}
|
|
963
|
+
enabledEvents.forEach(({ event, listener }) => {
|
|
964
|
+
elementRefs.forEach((ref) => {
|
|
965
|
+
var _a2;
|
|
966
|
+
(_a2 = ref.current) == null ? void 0 : _a2.addEventListener(event, listener);
|
|
967
|
+
});
|
|
968
|
+
});
|
|
969
|
+
return () => {
|
|
970
|
+
var _a2, _b2;
|
|
971
|
+
if (events.find((event) => event === "click")) {
|
|
972
|
+
window.removeEventListener("click", handleClickOutsideAnchors);
|
|
973
|
+
}
|
|
974
|
+
if (closeOnEsc) {
|
|
975
|
+
window.removeEventListener("keydown", handleEsc);
|
|
976
|
+
}
|
|
977
|
+
if (clickable) {
|
|
978
|
+
(_a2 = tooltipRef.current) == null ? void 0 : _a2.removeEventListener("mouseenter", handleMouseEnterTooltip);
|
|
979
|
+
(_b2 = tooltipRef.current) == null ? void 0 : _b2.removeEventListener("mouseleave", handleMouseLeaveTooltip);
|
|
980
|
+
}
|
|
981
|
+
enabledEvents.forEach(({ event, listener }) => {
|
|
982
|
+
elementRefs.forEach((ref) => {
|
|
983
|
+
var _a3;
|
|
984
|
+
(_a3 = ref.current) == null ? void 0 : _a3.removeEventListener(event, listener);
|
|
985
|
+
});
|
|
986
|
+
});
|
|
987
|
+
};
|
|
988
|
+
}, [rendered, anchorRefs, anchorsBySelect, closeOnEsc, events]);
|
|
989
|
+
(0, import_react4.useEffect)(() => {
|
|
990
|
+
let selector = anchorSelect != null ? anchorSelect : "";
|
|
991
|
+
if (!selector && id) {
|
|
992
|
+
selector = `[data-tooltip-id='${id}']`;
|
|
993
|
+
}
|
|
994
|
+
const documentObserverCallback = (mutationList) => {
|
|
995
|
+
const newAnchors = [];
|
|
996
|
+
mutationList.forEach((mutation) => {
|
|
997
|
+
if (mutation.type === "attributes" && mutation.attributeName === "data-tooltip-id") {
|
|
998
|
+
const newId = mutation.target.getAttribute("data-tooltip-id");
|
|
999
|
+
if (newId === id) {
|
|
1000
|
+
newAnchors.push(mutation.target);
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
if (mutation.type !== "childList") {
|
|
1004
|
+
return;
|
|
1005
|
+
}
|
|
1006
|
+
if (activeAnchor) {
|
|
1007
|
+
;
|
|
1008
|
+
[...mutation.removedNodes].some((node) => {
|
|
1009
|
+
if (node.contains(activeAnchor)) {
|
|
1010
|
+
setRendered(false);
|
|
1011
|
+
handleShow(false);
|
|
1012
|
+
setActiveAnchor(null);
|
|
1013
|
+
return true;
|
|
1014
|
+
}
|
|
1015
|
+
return false;
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
if (!selector) {
|
|
1019
|
+
return;
|
|
1020
|
+
}
|
|
1021
|
+
try {
|
|
1022
|
+
const elements = [...mutation.addedNodes].filter((node) => node.nodeType === 1);
|
|
1023
|
+
newAnchors.push(
|
|
1024
|
+
...elements.filter(
|
|
1025
|
+
(element) => element.matches(selector)
|
|
1026
|
+
)
|
|
1027
|
+
);
|
|
1028
|
+
newAnchors.push(
|
|
1029
|
+
...elements.flatMap(
|
|
1030
|
+
(element) => [...element.querySelectorAll(selector)]
|
|
1031
|
+
)
|
|
1032
|
+
);
|
|
1033
|
+
} catch (e2) {
|
|
1034
|
+
}
|
|
1035
|
+
});
|
|
1036
|
+
if (newAnchors.length) {
|
|
1037
|
+
setAnchorsBySelect((anchors) => [...anchors, ...newAnchors]);
|
|
1038
|
+
}
|
|
1039
|
+
};
|
|
1040
|
+
const documentObserver = new MutationObserver(documentObserverCallback);
|
|
1041
|
+
documentObserver.observe(document.body, {
|
|
1042
|
+
childList: true,
|
|
1043
|
+
subtree: true,
|
|
1044
|
+
attributes: true,
|
|
1045
|
+
attributeFilter: ["data-tooltip-id"]
|
|
1046
|
+
});
|
|
1047
|
+
return () => {
|
|
1048
|
+
documentObserver.disconnect();
|
|
1049
|
+
};
|
|
1050
|
+
}, [id, anchorSelect, activeAnchor]);
|
|
1051
|
+
(0, import_react4.useEffect)(() => {
|
|
1052
|
+
if (position) {
|
|
1053
|
+
handleTooltipPosition(position);
|
|
1054
|
+
return;
|
|
1055
|
+
}
|
|
1056
|
+
if (float) {
|
|
1057
|
+
if (lastFloatPosition.current) {
|
|
1058
|
+
handleTooltipPosition(lastFloatPosition.current);
|
|
1059
|
+
}
|
|
1060
|
+
return;
|
|
1061
|
+
}
|
|
1062
|
+
computeTooltipPosition({
|
|
1063
|
+
place,
|
|
1064
|
+
offset,
|
|
1065
|
+
elementReference: activeAnchor,
|
|
1066
|
+
tooltipReference: tooltipRef.current,
|
|
1067
|
+
tooltipArrowReference: tooltipArrowRef.current,
|
|
1068
|
+
strategy: positionStrategy,
|
|
1069
|
+
middlewares
|
|
1070
|
+
}).then((computedStylesData) => {
|
|
1071
|
+
if (!mounted.current) {
|
|
1072
|
+
return;
|
|
1073
|
+
}
|
|
1074
|
+
if (Object.keys(computedStylesData.tooltipStyles).length) {
|
|
1075
|
+
setInlineStyles(computedStylesData.tooltipStyles);
|
|
1076
|
+
}
|
|
1077
|
+
if (Object.keys(computedStylesData.tooltipArrowStyles).length) {
|
|
1078
|
+
setInlineArrowStyles(computedStylesData.tooltipArrowStyles);
|
|
1079
|
+
}
|
|
1080
|
+
});
|
|
1081
|
+
}, [show, activeAnchor, content, html, place, offset, positionStrategy, position]);
|
|
1082
|
+
(0, import_react4.useEffect)(() => {
|
|
1083
|
+
var _a;
|
|
1084
|
+
const anchorById = document.querySelector(`[id='${anchorId}']`);
|
|
1085
|
+
const anchors = [...anchorsBySelect, anchorById];
|
|
1086
|
+
if (!activeAnchor || !anchors.includes(activeAnchor)) {
|
|
1087
|
+
setActiveAnchor((_a = anchorsBySelect[0]) != null ? _a : anchorById);
|
|
1088
|
+
}
|
|
1089
|
+
}, [anchorId, anchorsBySelect, activeAnchor]);
|
|
1090
|
+
(0, import_react4.useEffect)(() => {
|
|
1091
|
+
return () => {
|
|
1092
|
+
if (tooltipShowDelayTimerRef.current) {
|
|
1093
|
+
clearTimeout(tooltipShowDelayTimerRef.current);
|
|
1094
|
+
}
|
|
1095
|
+
if (tooltipHideDelayTimerRef.current) {
|
|
1096
|
+
clearTimeout(tooltipHideDelayTimerRef.current);
|
|
1097
|
+
}
|
|
1098
|
+
};
|
|
1099
|
+
}, []);
|
|
1100
|
+
(0, import_react4.useEffect)(() => {
|
|
1101
|
+
let selector = anchorSelect;
|
|
1102
|
+
if (!selector && id) {
|
|
1103
|
+
selector = `[data-tooltip-id='${id}']`;
|
|
1104
|
+
}
|
|
1105
|
+
if (!selector) {
|
|
1106
|
+
return;
|
|
1107
|
+
}
|
|
1108
|
+
try {
|
|
1109
|
+
const anchors = Array.from(document.querySelectorAll(selector));
|
|
1110
|
+
setAnchorsBySelect(anchors);
|
|
1111
|
+
} catch (e2) {
|
|
1112
|
+
setAnchorsBySelect([]);
|
|
1113
|
+
}
|
|
1114
|
+
}, [id, anchorSelect]);
|
|
1115
|
+
const hasContentOrChildren = Boolean(html || content || children);
|
|
1116
|
+
const canShow = hasContentOrChildren && show && Object.keys(inlineStyles).length > 0;
|
|
1117
|
+
return rendered ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1118
|
+
WrapperElement,
|
|
1119
|
+
{
|
|
1120
|
+
id,
|
|
1121
|
+
role: "tooltip",
|
|
1122
|
+
className: (0, import_classnames2.default)("react-tooltip", styles_module_default["tooltip"], styles_module_default[variant], className, {
|
|
1123
|
+
[styles_module_default["show"]]: canShow,
|
|
1124
|
+
[styles_module_default["fixed"]]: positionStrategy === "fixed",
|
|
1125
|
+
[styles_module_default["clickable"]]: clickable
|
|
1126
|
+
}),
|
|
1127
|
+
style: { ...externalStyles, ...inlineStyles },
|
|
1128
|
+
ref: tooltipRef,
|
|
1129
|
+
children: [
|
|
1130
|
+
html && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TooltipContent_default, { content: html }) || content || children,
|
|
1131
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1132
|
+
WrapperElement,
|
|
1133
|
+
{
|
|
1134
|
+
className: (0, import_classnames2.default)("react-tooltip-arrow", styles_module_default["arrow"], classNameArrow, {
|
|
1135
|
+
/**
|
|
1136
|
+
* changed from dash `no-arrow` to camelcase because of:
|
|
1137
|
+
* https://github.com/indooorsman/esbuild-css-modules-plugin/issues/42
|
|
1138
|
+
*/
|
|
1139
|
+
[styles_module_default["noArrow"]]: noArrow
|
|
1140
|
+
}),
|
|
1141
|
+
style: inlineArrowStyles,
|
|
1142
|
+
ref: tooltipArrowRef
|
|
1143
|
+
}
|
|
1144
|
+
)
|
|
1145
|
+
]
|
|
1146
|
+
}
|
|
1147
|
+
) : null;
|
|
1148
|
+
};
|
|
1149
|
+
var Tooltip_default = Tooltip;
|
|
1150
|
+
|
|
1151
|
+
// src/components/TooltipController/TooltipController.tsx
|
|
1152
|
+
var import_jsx_runtime5 = __require("react/jsx-runtime");
|
|
1153
|
+
var TooltipController = ({
|
|
1154
|
+
id,
|
|
1155
|
+
anchorId,
|
|
1156
|
+
anchorSelect,
|
|
1157
|
+
content,
|
|
1158
|
+
html,
|
|
1159
|
+
className,
|
|
1160
|
+
classNameArrow,
|
|
1161
|
+
variant = "dark",
|
|
1162
|
+
place = "top",
|
|
1163
|
+
offset = 10,
|
|
1164
|
+
wrapper = "div",
|
|
1165
|
+
children = null,
|
|
1166
|
+
events = ["hover"],
|
|
1167
|
+
positionStrategy = "absolute",
|
|
1168
|
+
middlewares,
|
|
1169
|
+
delayShow = 0,
|
|
1170
|
+
delayHide = 0,
|
|
1171
|
+
float = false,
|
|
1172
|
+
noArrow = false,
|
|
1173
|
+
clickable = false,
|
|
1174
|
+
closeOnEsc = false,
|
|
1175
|
+
style,
|
|
1176
|
+
position,
|
|
1177
|
+
isOpen,
|
|
1178
|
+
setIsOpen,
|
|
1179
|
+
afterShow,
|
|
1180
|
+
afterHide
|
|
1181
|
+
}) => {
|
|
1182
|
+
const [tooltipContent, setTooltipContent] = (0, import_react5.useState)(content);
|
|
1183
|
+
const [tooltipHtml, setTooltipHtml] = (0, import_react5.useState)(html);
|
|
1184
|
+
const [tooltipPlace, setTooltipPlace] = (0, import_react5.useState)(place);
|
|
1185
|
+
const [tooltipVariant, setTooltipVariant] = (0, import_react5.useState)(variant);
|
|
1186
|
+
const [tooltipOffset, setTooltipOffset] = (0, import_react5.useState)(offset);
|
|
1187
|
+
const [tooltipDelayShow, setTooltipDelayShow] = (0, import_react5.useState)(delayShow);
|
|
1188
|
+
const [tooltipDelayHide, setTooltipDelayHide] = (0, import_react5.useState)(delayHide);
|
|
1189
|
+
const [tooltipFloat, setTooltipFloat] = (0, import_react5.useState)(float);
|
|
1190
|
+
const [tooltipWrapper, setTooltipWrapper] = (0, import_react5.useState)(wrapper);
|
|
1191
|
+
const [tooltipEvents, setTooltipEvents] = (0, import_react5.useState)(events);
|
|
1192
|
+
const [tooltipPositionStrategy, setTooltipPositionStrategy] = (0, import_react5.useState)(positionStrategy);
|
|
1193
|
+
const [activeAnchor, setActiveAnchor] = (0, import_react5.useState)(null);
|
|
1194
|
+
const { anchorRefs, activeAnchor: providerActiveAnchor } = useTooltip(id);
|
|
1195
|
+
const getDataAttributesFromAnchorElement = (elementReference) => {
|
|
1196
|
+
const dataAttributes = elementReference == null ? void 0 : elementReference.getAttributeNames().reduce((acc, name) => {
|
|
1197
|
+
var _a;
|
|
1198
|
+
if (name.startsWith("data-tooltip-")) {
|
|
1199
|
+
const parsedAttribute = name.replace(/^data-tooltip-/, "");
|
|
1200
|
+
acc[parsedAttribute] = (_a = elementReference == null ? void 0 : elementReference.getAttribute(name)) != null ? _a : null;
|
|
1201
|
+
}
|
|
1202
|
+
return acc;
|
|
1203
|
+
}, {});
|
|
1204
|
+
return dataAttributes;
|
|
1205
|
+
};
|
|
1206
|
+
const applyAllDataAttributesFromAnchorElement = (dataAttributes) => {
|
|
1207
|
+
const handleDataAttributes = {
|
|
1208
|
+
place: (value) => {
|
|
1209
|
+
setTooltipPlace(value != null ? value : place);
|
|
1210
|
+
},
|
|
1211
|
+
content: (value) => {
|
|
1212
|
+
setTooltipContent(value != null ? value : content);
|
|
1213
|
+
},
|
|
1214
|
+
html: (value) => {
|
|
1215
|
+
setTooltipHtml(value != null ? value : html);
|
|
1216
|
+
},
|
|
1217
|
+
variant: (value) => {
|
|
1218
|
+
setTooltipVariant(value != null ? value : variant);
|
|
1219
|
+
},
|
|
1220
|
+
offset: (value) => {
|
|
1221
|
+
setTooltipOffset(value === null ? offset : Number(value));
|
|
1222
|
+
},
|
|
1223
|
+
wrapper: (value) => {
|
|
1224
|
+
setTooltipWrapper(value != null ? value : wrapper);
|
|
1225
|
+
},
|
|
1226
|
+
events: (value) => {
|
|
1227
|
+
const parsed = value == null ? void 0 : value.split(" ");
|
|
1228
|
+
setTooltipEvents(parsed != null ? parsed : events);
|
|
1229
|
+
},
|
|
1230
|
+
"position-strategy": (value) => {
|
|
1231
|
+
setTooltipPositionStrategy(value != null ? value : positionStrategy);
|
|
1232
|
+
},
|
|
1233
|
+
"delay-show": (value) => {
|
|
1234
|
+
setTooltipDelayShow(value === null ? delayShow : Number(value));
|
|
1235
|
+
},
|
|
1236
|
+
"delay-hide": (value) => {
|
|
1237
|
+
setTooltipDelayHide(value === null ? delayHide : Number(value));
|
|
1238
|
+
},
|
|
1239
|
+
float: (value) => {
|
|
1240
|
+
setTooltipFloat(value === null ? float : value === "true");
|
|
1241
|
+
}
|
|
1242
|
+
};
|
|
1243
|
+
Object.values(handleDataAttributes).forEach((handler) => handler(null));
|
|
1244
|
+
Object.entries(dataAttributes).forEach(([key, value]) => {
|
|
1245
|
+
var _a;
|
|
1246
|
+
(_a = handleDataAttributes[key]) == null ? void 0 : _a.call(handleDataAttributes, value);
|
|
1247
|
+
});
|
|
1248
|
+
};
|
|
1249
|
+
(0, import_react5.useEffect)(() => {
|
|
1250
|
+
setTooltipContent(content);
|
|
1251
|
+
}, [content]);
|
|
1252
|
+
(0, import_react5.useEffect)(() => {
|
|
1253
|
+
setTooltipHtml(html);
|
|
1254
|
+
}, [html]);
|
|
1255
|
+
(0, import_react5.useEffect)(() => {
|
|
1256
|
+
setTooltipPlace(place);
|
|
1257
|
+
}, [place]);
|
|
1258
|
+
(0, import_react5.useEffect)(() => {
|
|
1259
|
+
var _a;
|
|
1260
|
+
const elementRefs = new Set(anchorRefs);
|
|
1261
|
+
let selector = anchorSelect;
|
|
1262
|
+
if (!selector && id) {
|
|
1263
|
+
selector = `[data-tooltip-id='${id}']`;
|
|
1264
|
+
}
|
|
1265
|
+
if (selector) {
|
|
1266
|
+
try {
|
|
1267
|
+
const anchorsBySelect = document.querySelectorAll(selector);
|
|
1268
|
+
anchorsBySelect.forEach((anchor) => {
|
|
1269
|
+
elementRefs.add({ current: anchor });
|
|
1270
|
+
});
|
|
1271
|
+
} catch (e2) {
|
|
1272
|
+
if (true) {
|
|
1273
|
+
console.warn(`[react-tooltip] "${anchorSelect}" is not a valid CSS selector`);
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
const anchorById = document.querySelector(`[id='${anchorId}']`);
|
|
1278
|
+
if (anchorById) {
|
|
1279
|
+
elementRefs.add({ current: anchorById });
|
|
1280
|
+
}
|
|
1281
|
+
if (!elementRefs.size) {
|
|
1282
|
+
return () => null;
|
|
1283
|
+
}
|
|
1284
|
+
const anchorElement = (_a = activeAnchor != null ? activeAnchor : anchorById) != null ? _a : providerActiveAnchor.current;
|
|
1285
|
+
const observerCallback = (mutationList) => {
|
|
1286
|
+
mutationList.forEach((mutation) => {
|
|
1287
|
+
var _a2;
|
|
1288
|
+
if (!anchorElement || mutation.type !== "attributes" || !((_a2 = mutation.attributeName) == null ? void 0 : _a2.startsWith("data-tooltip-"))) {
|
|
1289
|
+
return;
|
|
1290
|
+
}
|
|
1291
|
+
const dataAttributes = getDataAttributesFromAnchorElement(anchorElement);
|
|
1292
|
+
applyAllDataAttributesFromAnchorElement(dataAttributes);
|
|
1293
|
+
});
|
|
1294
|
+
};
|
|
1295
|
+
const observer = new MutationObserver(observerCallback);
|
|
1296
|
+
const observerConfig = { attributes: true, childList: false, subtree: false };
|
|
1297
|
+
if (anchorElement) {
|
|
1298
|
+
const dataAttributes = getDataAttributesFromAnchorElement(anchorElement);
|
|
1299
|
+
applyAllDataAttributesFromAnchorElement(dataAttributes);
|
|
1300
|
+
observer.observe(anchorElement, observerConfig);
|
|
1301
|
+
}
|
|
1302
|
+
return () => {
|
|
1303
|
+
observer.disconnect();
|
|
1304
|
+
};
|
|
1305
|
+
}, [anchorRefs, providerActiveAnchor, activeAnchor, anchorId, anchorSelect]);
|
|
1306
|
+
const props = {
|
|
1307
|
+
id,
|
|
1308
|
+
anchorId,
|
|
1309
|
+
anchorSelect,
|
|
1310
|
+
className,
|
|
1311
|
+
classNameArrow,
|
|
1312
|
+
content: tooltipContent,
|
|
1313
|
+
html: tooltipHtml,
|
|
1314
|
+
place: tooltipPlace,
|
|
1315
|
+
variant: tooltipVariant,
|
|
1316
|
+
offset: tooltipOffset,
|
|
1317
|
+
wrapper: tooltipWrapper,
|
|
1318
|
+
events: tooltipEvents,
|
|
1319
|
+
positionStrategy: tooltipPositionStrategy,
|
|
1320
|
+
middlewares,
|
|
1321
|
+
delayShow: tooltipDelayShow,
|
|
1322
|
+
delayHide: tooltipDelayHide,
|
|
1323
|
+
float: tooltipFloat,
|
|
1324
|
+
noArrow,
|
|
1325
|
+
clickable,
|
|
1326
|
+
closeOnEsc,
|
|
1327
|
+
style,
|
|
1328
|
+
position,
|
|
1329
|
+
isOpen,
|
|
1330
|
+
setIsOpen,
|
|
1331
|
+
afterShow,
|
|
1332
|
+
afterHide,
|
|
1333
|
+
activeAnchor,
|
|
1334
|
+
setActiveAnchor: (anchor) => setActiveAnchor(anchor)
|
|
1335
|
+
};
|
|
1336
|
+
return children ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Tooltip_default, { ...props, children }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Tooltip_default, { ...props });
|
|
1337
|
+
};
|
|
1338
|
+
var TooltipController_default = TooltipController;
|
|
1339
|
+
})();
|
|
1340
|
+
/*! Bundled license information:
|
|
1341
|
+
|
|
1342
|
+
classnames/index.js:
|
|
1343
|
+
(*!
|
|
1344
|
+
Copyright (c) 2018 Jed Watson.
|
|
1345
|
+
Licensed under the MIT License (MIT), see
|
|
1346
|
+
http://jedwatson.github.io/classnames
|
|
1347
|
+
*)
|
|
1348
|
+
*/
|
|
1349
|
+
//# sourceMappingURL=react-tooltip.iife.js.map
|