@versini/ui-tooltip 5.0.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +15 -26
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-tooltip v5.
|
|
2
|
+
@versini/ui-tooltip v5.1.0
|
|
3
3
|
© 2025 gizmette.com
|
|
4
4
|
*/
|
|
5
|
-
try {
|
|
6
|
-
if (!window.__VERSINI_UI_TOOLTIP__) {
|
|
7
|
-
window.__VERSINI_UI_TOOLTIP__ = {
|
|
8
|
-
version: "5.0.0",
|
|
9
|
-
buildTime: "12/16/2025 06:23 PM EST",
|
|
10
|
-
homepage: "https://www.npmjs.com/package/@versini/ui-tooltip",
|
|
11
|
-
license: "MIT",
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
} catch (error) {
|
|
15
|
-
// nothing to declare officer
|
|
16
|
-
}
|
|
17
5
|
|
|
18
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
7
|
import { arrow as dom_arrow, computePosition, flip, offset, shift } from "@floating-ui/dom";
|
|
@@ -98,18 +86,18 @@ const getAnimationStyles = ({ animationDuration = 300 })=>{
|
|
|
98
86
|
const DEFAULT_DEACTIVATION_DELAY = 5000;
|
|
99
87
|
const Tooltip = ({ trigger, label, placement = "top", mode = "system", animationDuration = 300, delay = 0, className, tooltipClassName, arrowClassName })=>{
|
|
100
88
|
const referenceRef = useClickOutside(()=>{
|
|
101
|
-
/* v8 ignore
|
|
102
|
-
});
|
|
89
|
+
/* v8 ignore start */ delayedRestartTooltip.stop(), setDisabled(false);
|
|
90
|
+
/* v8 ignore stop */ });
|
|
103
91
|
const floatingRef = useRef(null);
|
|
104
92
|
const floatingArrowRef = useRef(null);
|
|
105
93
|
const showTimeoutRef = useRef(null);
|
|
106
94
|
const [showTooltip, setShowTooltip] = useState(false);
|
|
107
95
|
const [disabled, setDisabled] = useState(false);
|
|
108
96
|
const [isPositioned, setIsPositioned] = useState(false);
|
|
109
|
-
const delayedRestartTooltip = useInterval(()=>{
|
|
97
|
+
/* v8 ignore start - delayed interval callback */ const delayedRestartTooltip = useInterval(()=>{
|
|
110
98
|
setDisabled(false);
|
|
111
99
|
}, DEFAULT_DEACTIVATION_DELAY);
|
|
112
|
-
const tooltipClasses = getTooltipClasses({
|
|
100
|
+
/* v8 ignore stop */ const tooltipClasses = getTooltipClasses({
|
|
113
101
|
mode,
|
|
114
102
|
className,
|
|
115
103
|
tooltipClassName,
|
|
@@ -118,7 +106,7 @@ const Tooltip = ({ trigger, label, placement = "top", mode = "system", animation
|
|
|
118
106
|
const animationStyles = getAnimationStyles({
|
|
119
107
|
animationDuration
|
|
120
108
|
});
|
|
121
|
-
const updatePosition = useCallback(async ()=>{
|
|
109
|
+
/* v8 ignore start - async floating UI positioning */ const updatePosition = useCallback(async ()=>{
|
|
122
110
|
if (referenceRef.current && floatingRef.current && floatingArrowRef.current) {
|
|
123
111
|
const { x, y, middlewareData, placement: newPlacement } = await computePosition(referenceRef.current, floatingRef.current, {
|
|
124
112
|
placement,
|
|
@@ -165,7 +153,7 @@ const Tooltip = ({ trigger, label, placement = "top", mode = "system", animation
|
|
|
165
153
|
animationStyles,
|
|
166
154
|
referenceRef
|
|
167
155
|
]);
|
|
168
|
-
useEffect(()=>{
|
|
156
|
+
/* v8 ignore stop */ /* v8 ignore start - async effect handler */ useEffect(()=>{
|
|
169
157
|
(async ()=>{
|
|
170
158
|
if (showTooltip) {
|
|
171
159
|
await updatePosition();
|
|
@@ -177,13 +165,13 @@ const Tooltip = ({ trigger, label, placement = "top", mode = "system", animation
|
|
|
177
165
|
updatePosition,
|
|
178
166
|
showTooltip
|
|
179
167
|
]);
|
|
180
|
-
useEffect(()=>{
|
|
181
|
-
return ()=>{
|
|
168
|
+
/* v8 ignore stop */ useEffect(()=>{
|
|
169
|
+
/* v8 ignore start - cleanup function */ return ()=>{
|
|
182
170
|
if (showTimeoutRef.current) {
|
|
183
171
|
clearTimeout(showTimeoutRef.current);
|
|
184
172
|
}
|
|
185
173
|
};
|
|
186
|
-
}, []);
|
|
174
|
+
/* v8 ignore stop */ }, []);
|
|
187
175
|
const handleMouseClick = ()=>{
|
|
188
176
|
if (showTimeoutRef.current) {
|
|
189
177
|
clearTimeout(showTimeoutRef.current);
|
|
@@ -197,16 +185,16 @@ const Tooltip = ({ trigger, label, placement = "top", mode = "system", animation
|
|
|
197
185
|
const handleMouseEnter = ()=>{
|
|
198
186
|
if (!disabled) {
|
|
199
187
|
if (delay > 0) {
|
|
200
|
-
showTimeoutRef.current = setTimeout(()=>{
|
|
188
|
+
/* v8 ignore start - delayed timeout callback */ showTimeoutRef.current = setTimeout(()=>{
|
|
201
189
|
setShowTooltip(true);
|
|
202
190
|
showTimeoutRef.current = null;
|
|
203
191
|
}, delay);
|
|
204
|
-
} else {
|
|
192
|
+
/* v8 ignore stop */ } else {
|
|
205
193
|
setShowTooltip(true);
|
|
206
194
|
}
|
|
207
195
|
}
|
|
208
196
|
};
|
|
209
|
-
const handleMouseLeave = ()=>{
|
|
197
|
+
/* v8 ignore start - mouse leave edge case */ const handleMouseLeave = ()=>{
|
|
210
198
|
if (showTimeoutRef.current) {
|
|
211
199
|
clearTimeout(showTimeoutRef.current);
|
|
212
200
|
showTimeoutRef.current = null;
|
|
@@ -215,7 +203,7 @@ const Tooltip = ({ trigger, label, placement = "top", mode = "system", animation
|
|
|
215
203
|
setShowTooltip(false);
|
|
216
204
|
}
|
|
217
205
|
};
|
|
218
|
-
return /*#__PURE__*/ jsxs("div", {
|
|
206
|
+
/* v8 ignore stop */ return /*#__PURE__*/ jsxs("div", {
|
|
219
207
|
className: tooltipClasses.wrapper,
|
|
220
208
|
ref: referenceRef,
|
|
221
209
|
onMouseEnter: handleMouseEnter,
|
|
@@ -243,6 +231,7 @@ const Tooltip = ({ trigger, label, placement = "top", mode = "system", animation
|
|
|
243
231
|
};
|
|
244
232
|
|
|
245
233
|
;// CONCATENATED MODULE: ./src/components/index.ts
|
|
234
|
+
// force new release
|
|
246
235
|
|
|
247
236
|
|
|
248
237
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-tooltip",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -38,17 +38,17 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@testing-library/jest-dom": "6.9.1",
|
|
41
|
-
"@versini/ui-types": "8.
|
|
41
|
+
"@versini/ui-types": "8.1.0"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@floating-ui/dom": "1.7.4",
|
|
45
45
|
"@tailwindcss/typography": "0.5.19",
|
|
46
|
-
"@versini/ui-hooks": "6.
|
|
46
|
+
"@versini/ui-hooks": "6.1.0",
|
|
47
47
|
"clsx": "2.1.1",
|
|
48
48
|
"tailwindcss": "4.1.18"
|
|
49
49
|
},
|
|
50
50
|
"sideEffects": [
|
|
51
51
|
"**/*.css"
|
|
52
52
|
],
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "b2ee2e328ecadfbedcb26d14afa896a30f0ab54b"
|
|
54
54
|
}
|