@versini/ui-tooltip 1.1.0 → 1.1.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 +52 -51
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,61 +1,61 @@
1
- import { jsxs as T, Fragment as F, jsx as w } from "react/jsx-runtime";
2
- import { useFloating as L, autoUpdate as N, arrow as M, offset as U, flip as V, shift as D, useTransitionStyles as j, useHover as B, useFocus as H, useDismiss as W, useRole as q, useInteractions as z, FloatingPortal as G, FloatingArrow as J } from "@floating-ui/react";
3
- import { useState as _, useRef as u, cloneElement as K, useCallback as Q, useEffect as b } from "react";
1
+ import { jsxs as w, Fragment as N, jsx as b } from "react/jsx-runtime";
2
+ import { useFloating as M, autoUpdate as U, arrow as V, offset as D, flip as j, shift as B, useTransitionStyles as H, useHover as W, useFocus as q, useDismiss as z, useRole as G, useInteractions as J, FloatingPortal as K, FloatingArrow as Q } from "@floating-ui/react";
3
+ import { useState as x, useRef as u, cloneElement as X, useCallback as Y, useEffect as _ } from "react";
4
4
  import n from "clsx";
5
5
  /*!
6
- @versini/ui-tooltip v1.1.0
6
+ @versini/ui-tooltip v1.1.1
7
7
  © 2025 gizmette.com
8
8
  */
9
9
  try {
10
10
  window.__VERSINI_UI_TOOLTIP__ || (window.__VERSINI_UI_TOOLTIP__ = {
11
- version: "1.1.0",
12
- buildTime: "01/19/2025 01:35 PM EST",
11
+ version: "1.1.1",
12
+ buildTime: "01/19/2025 03:47 PM EST",
13
13
  homepage: "https://github.com/aversini/ui-components",
14
14
  license: "MIT"
15
15
  });
16
16
  } catch {
17
17
  }
18
- const X = "av-tooltip", Y = "av-tooltip-arrow", Z = () => n("w-max py-1 px-2 rounded text-sm"), $ = ({
18
+ const Z = "av-tooltip", $ = "av-tooltip-arrow", tt = () => n("w-max py-1 px-2 rounded text-sm"), et = ({
19
19
  mode: t
20
20
  }) => n({
21
21
  "bg-surface-darker": t === "dark" || t === "system",
22
22
  "bg-surface-light": t === "light" || t === "alt-system",
23
23
  "dark:bg-surface-light": t === "system",
24
24
  "dark:bg-surface-darker": t === "alt-system"
25
- }), tt = ({
25
+ }), st = ({
26
26
  mode: t
27
27
  }) => n({
28
28
  "text-copy-light": t === "dark" || t === "system",
29
29
  "text-copy-dark": t === "light" || t === "alt-system",
30
30
  "dark:text-copy-dark": t === "system",
31
31
  "dark:text-copy-light": t === "alt-system"
32
- }), et = ({
32
+ }), rt = ({
33
33
  mode: t
34
34
  }) => n({
35
35
  "fill-surface-darker [&>path:first-of-type]:bg-surface-darker [&>path:last-of-type]:bg-surface-darker": t === "dark" || t === "system",
36
36
  "fill-surface-light [&>path:first-of-type]:bg-surface-light [&>path:last-of-type]:bg-surface-light": t === "light" || t === "alt-system",
37
37
  "dark:fill-surface-light dark:[&>path:first-of-type]:bg-surface-light dark:[&>path:last-of-type]:bg-surface-light": t === "system",
38
38
  "dark:fill-surface-darker dark:[&>path:first-of-type]:bg-surface-darker dark:[&>path:last-of-type]:bg-surface-darker": t === "alt-system"
39
- }), st = ({
39
+ }), ot = ({
40
40
  mode: t
41
41
  }) => {
42
42
  const e = n(
43
- X,
44
- Z(),
45
- $({ mode: t }),
46
- tt({ mode: t })
43
+ Z,
44
+ tt(),
45
+ et({ mode: t }),
46
+ st({ mode: t })
47
47
  ), s = n(
48
- Y,
49
- et({ mode: t })
48
+ $,
49
+ rt({ mode: t })
50
50
  );
51
51
  return { tooltip: e, arrow: s };
52
52
  };
53
- function rt(t, e, s = { active: !0 }) {
54
- const [p, l] = _(t), o = u(!1), r = u(null), c = u(!1), a = Q(() => {
53
+ function at(t, e, s = { active: !0 }) {
54
+ const [p, l] = x(t), o = u(!1), r = u(null), c = u(!1), a = Y(() => {
55
55
  const f = r.current;
56
56
  f && window.clearTimeout(f);
57
57
  }, []);
58
- return b(() => {
58
+ return _(() => {
59
59
  if (!s.active) {
60
60
  l(t);
61
61
  return;
@@ -63,9 +63,9 @@ function rt(t, e, s = { active: !0 }) {
63
63
  o.current && (a(), r.current = window.setTimeout(() => {
64
64
  c.current = !1, l(t);
65
65
  }, e));
66
- }, [t, s, e, a]), b(() => (o.current = !0, a), [a]), [p];
66
+ }, [t, s, e, a]), _(() => (o.current = !0, a), [a]), [p];
67
67
  }
68
- const ct = ({
68
+ const ft = ({
69
69
  trigger: t,
70
70
  label: e,
71
71
  placement: s = "top",
@@ -75,65 +75,66 @@ const ct = ({
75
75
  onOpenChange: r,
76
76
  delay: c = 300
77
77
  }) => {
78
- const [a, f] = _(l), h = o !== void 0;
78
+ const [a, f] = x(l), h = o !== void 0;
79
79
  h && o === !1 && (c = 0);
80
- const [g] = rt(
80
+ const [g] = at(
81
81
  o ?? a,
82
82
  c,
83
83
  {
84
84
  active: h
85
85
  }
86
- ), x = r ?? f, y = u(null), { refs: k, floatingStyles: I, context: i } = L({
86
+ ), I = r ?? f, y = u(null), { refs: d, floatingStyles: R, context: i } = M({
87
87
  open: g,
88
- onOpenChange: (m) => {
89
- x(m), r == null || r(m);
88
+ onOpenChange: (T) => {
89
+ I(T), r == null || r(T);
90
90
  },
91
91
  placement: s,
92
92
  // Make sure the tooltip stays on the screen
93
- whileElementsMounted: N,
93
+ whileElementsMounted: U,
94
94
  middleware: [
95
- M({
95
+ V({
96
96
  element: y
97
97
  }),
98
- U(11),
99
- V({
98
+ D(11),
99
+ j({
100
100
  crossAxis: s.includes("-"),
101
101
  fallbackAxisSideDirection: "start"
102
102
  }),
103
- D()
103
+ B()
104
104
  ]
105
- }), { styles: R } = j(i), d = st({ mode: p }), S = B(i, { move: !1, delay: { open: c } }), C = H(i), v = W(i, {
105
+ }), { styles: S } = H(i), k = ot({ mode: p }), C = W(i, { move: !1, delay: { open: c } }), v = q(i), P = z(i, {
106
106
  referencePress: !0
107
- }), A = q(i, { role: "tooltip" }), { getReferenceProps: E, getFloatingProps: P } = z([
108
- S,
107
+ }), A = G(i, { role: "tooltip" }), { getReferenceProps: E, getFloatingProps: O } = J([
109
108
  C,
110
109
  v,
110
+ P,
111
111
  A
112
- ]), O = K(
113
- t,
112
+ ]), m = t, F = m.props, L = X(
113
+ m,
114
114
  {
115
115
  "aria-label": e,
116
116
  "data-open": String(g),
117
- ref: k.setReference,
118
- ...E()
117
+ ref: d.setReference,
118
+ ...E(),
119
+ ...F
119
120
  }
120
121
  );
121
- return /* @__PURE__ */ T(F, { children: [
122
- O,
123
- /* @__PURE__ */ w(G, { children: g && /* @__PURE__ */ T(
122
+ return /* @__PURE__ */ w(N, { children: [
123
+ L,
124
+ /* @__PURE__ */ b(K, { children: g && /* @__PURE__ */ w(
124
125
  "div",
125
126
  {
126
- className: d.tooltip,
127
- ref: k.setFloating,
128
- style: { ...I, ...R },
129
- ...P(),
127
+ className: k.tooltip,
128
+ ref: d.setFloating,
129
+ style: { ...R, ...S },
130
+ ...O(),
130
131
  children: [
131
- /* @__PURE__ */ w(
132
- J,
132
+ /* @__PURE__ */ b(
133
+ Q,
133
134
  {
134
135
  ref: y,
135
136
  context: i,
136
- className: d.arrow
137
+ className: k.arrow
137
138
  }
138
139
  ),
139
140
  e
@@ -143,7 +144,7 @@ const ct = ({
143
144
  ] });
144
145
  };
145
146
  export {
146
- Y as TOOLTIP_ARROW_CLASSNAME,
147
- X as TOOLTIP_CLASSNAME,
148
- ct as Tooltip
147
+ $ as TOOLTIP_ARROW_CLASSNAME,
148
+ Z as TOOLTIP_CLASSNAME,
149
+ ft as Tooltip
149
150
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versini/ui-tooltip",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "license": "MIT",
5
5
  "author": "Arno Versini",
6
6
  "publishConfig": {
@@ -49,5 +49,5 @@
49
49
  "sideEffects": [
50
50
  "**/*.css"
51
51
  ],
52
- "gitHead": "bcefcad80e918262a953b30742e66db32b2fefa5"
52
+ "gitHead": "47ca6cc4fdd05d5b5a384026188e28a254f14e57"
53
53
  }