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