@versini/ui-tooltip 4.0.7 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +22 -18
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  /*!
2
- @versini/ui-tooltip v4.0.7
2
+ @versini/ui-tooltip v5.0.1
3
3
  © 2025 gizmette.com
4
4
  */
5
5
  try {
6
6
  if (!window.__VERSINI_UI_TOOLTIP__) {
7
7
  window.__VERSINI_UI_TOOLTIP__ = {
8
- version: "4.0.7",
9
- buildTime: "12/16/2025 01:51 PM EST",
8
+ version: "5.0.1",
9
+ buildTime: "12/24/2025 09:20 AM EST",
10
10
  homepage: "https://www.npmjs.com/package/@versini/ui-tooltip",
11
11
  license: "MIT",
12
12
  };
@@ -17,7 +17,8 @@ try {
17
17
 
18
18
  import { jsx, jsxs } from "react/jsx-runtime";
19
19
  import { arrow as dom_arrow, computePosition, flip, offset, shift } from "@floating-ui/dom";
20
- import { useClickOutside, useInterval } from "@versini/ui-hooks";
20
+ import { useClickOutside } from "@versini/ui-hooks/use-click-outside";
21
+ import { useInterval } from "@versini/ui-hooks/use-interval";
21
22
  import { useCallback, useEffect, useRef, useState } from "react";
22
23
  import clsx from "clsx";
23
24
 
@@ -29,7 +30,9 @@ const TOOLTIP_ARROW_CLASSNAME = "av-tooltip-arrow";
29
30
 
30
31
  ;// CONCATENATED MODULE: external "@floating-ui/dom"
31
32
 
32
- ;// CONCATENATED MODULE: external "@versini/ui-hooks"
33
+ ;// CONCATENATED MODULE: external "@versini/ui-hooks/use-click-outside"
34
+
35
+ ;// CONCATENATED MODULE: external "@versini/ui-hooks/use-interval"
33
36
 
34
37
  ;// CONCATENATED MODULE: external "react"
35
38
 
@@ -91,21 +94,22 @@ const getAnimationStyles = ({ animationDuration = 300 })=>{
91
94
 
92
95
 
93
96
 
97
+
94
98
  const DEFAULT_DEACTIVATION_DELAY = 5000;
95
99
  const Tooltip = ({ trigger, label, placement = "top", mode = "system", animationDuration = 300, delay = 0, className, tooltipClassName, arrowClassName })=>{
96
100
  const referenceRef = useClickOutside(()=>{
97
- /* v8 ignore next 1 */ delayedRestartTooltip.stop(), setDisabled(false);
98
- });
101
+ /* v8 ignore start */ delayedRestartTooltip.stop(), setDisabled(false);
102
+ /* v8 ignore stop */ });
99
103
  const floatingRef = useRef(null);
100
104
  const floatingArrowRef = useRef(null);
101
105
  const showTimeoutRef = useRef(null);
102
106
  const [showTooltip, setShowTooltip] = useState(false);
103
107
  const [disabled, setDisabled] = useState(false);
104
108
  const [isPositioned, setIsPositioned] = useState(false);
105
- const delayedRestartTooltip = useInterval(()=>{
109
+ /* v8 ignore start - delayed interval callback */ const delayedRestartTooltip = useInterval(()=>{
106
110
  setDisabled(false);
107
111
  }, DEFAULT_DEACTIVATION_DELAY);
108
- const tooltipClasses = getTooltipClasses({
112
+ /* v8 ignore stop */ const tooltipClasses = getTooltipClasses({
109
113
  mode,
110
114
  className,
111
115
  tooltipClassName,
@@ -114,7 +118,7 @@ const Tooltip = ({ trigger, label, placement = "top", mode = "system", animation
114
118
  const animationStyles = getAnimationStyles({
115
119
  animationDuration
116
120
  });
117
- const updatePosition = useCallback(async ()=>{
121
+ /* v8 ignore start - async floating UI positioning */ const updatePosition = useCallback(async ()=>{
118
122
  if (referenceRef.current && floatingRef.current && floatingArrowRef.current) {
119
123
  const { x, y, middlewareData, placement: newPlacement } = await computePosition(referenceRef.current, floatingRef.current, {
120
124
  placement,
@@ -161,7 +165,7 @@ const Tooltip = ({ trigger, label, placement = "top", mode = "system", animation
161
165
  animationStyles,
162
166
  referenceRef
163
167
  ]);
164
- useEffect(()=>{
168
+ /* v8 ignore stop */ /* v8 ignore start - async effect handler */ useEffect(()=>{
165
169
  (async ()=>{
166
170
  if (showTooltip) {
167
171
  await updatePosition();
@@ -173,13 +177,13 @@ const Tooltip = ({ trigger, label, placement = "top", mode = "system", animation
173
177
  updatePosition,
174
178
  showTooltip
175
179
  ]);
176
- useEffect(()=>{
177
- return ()=>{
180
+ /* v8 ignore stop */ useEffect(()=>{
181
+ /* v8 ignore start - cleanup function */ return ()=>{
178
182
  if (showTimeoutRef.current) {
179
183
  clearTimeout(showTimeoutRef.current);
180
184
  }
181
185
  };
182
- }, []);
186
+ /* v8 ignore stop */ }, []);
183
187
  const handleMouseClick = ()=>{
184
188
  if (showTimeoutRef.current) {
185
189
  clearTimeout(showTimeoutRef.current);
@@ -193,16 +197,16 @@ const Tooltip = ({ trigger, label, placement = "top", mode = "system", animation
193
197
  const handleMouseEnter = ()=>{
194
198
  if (!disabled) {
195
199
  if (delay > 0) {
196
- showTimeoutRef.current = setTimeout(()=>{
200
+ /* v8 ignore start - delayed timeout callback */ showTimeoutRef.current = setTimeout(()=>{
197
201
  setShowTooltip(true);
198
202
  showTimeoutRef.current = null;
199
203
  }, delay);
200
- } else {
204
+ /* v8 ignore stop */ } else {
201
205
  setShowTooltip(true);
202
206
  }
203
207
  }
204
208
  };
205
- const handleMouseLeave = ()=>{
209
+ /* v8 ignore start - mouse leave edge case */ const handleMouseLeave = ()=>{
206
210
  if (showTimeoutRef.current) {
207
211
  clearTimeout(showTimeoutRef.current);
208
212
  showTimeoutRef.current = null;
@@ -211,7 +215,7 @@ const Tooltip = ({ trigger, label, placement = "top", mode = "system", animation
211
215
  setShowTooltip(false);
212
216
  }
213
217
  };
214
- return /*#__PURE__*/ jsxs("div", {
218
+ /* v8 ignore stop */ return /*#__PURE__*/ jsxs("div", {
215
219
  className: tooltipClasses.wrapper,
216
220
  ref: referenceRef,
217
221
  onMouseEnter: handleMouseEnter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versini/ui-tooltip",
3
- "version": "4.0.7",
3
+ "version": "5.0.1",
4
4
  "license": "MIT",
5
5
  "author": "Arno Versini",
6
6
  "publishConfig": {
@@ -43,12 +43,12 @@
43
43
  "dependencies": {
44
44
  "@floating-ui/dom": "1.7.4",
45
45
  "@tailwindcss/typography": "0.5.19",
46
- "@versini/ui-hooks": "5.3.2",
46
+ "@versini/ui-hooks": "6.0.1",
47
47
  "clsx": "2.1.1",
48
48
  "tailwindcss": "4.1.18"
49
49
  },
50
50
  "sideEffects": [
51
51
  "**/*.css"
52
52
  ],
53
- "gitHead": "ef4323fa1f14f9f2a5471d71f063519230762aec"
53
+ "gitHead": "7b2640a0650a4c3aa6ca078888f765cb400f9f13"
54
54
  }