@pittorica/tooltip-react 0.23.0 → 0.23.2
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 +29 -27
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as A, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { createPortal as
|
|
1
|
+
import { jsx as A, jsxs as P } from "react/jsx-runtime";
|
|
2
|
+
import { useState as w, useRef as N, useCallback as k } from "react";
|
|
3
|
+
import { createPortal as q } from "react-dom";
|
|
4
4
|
function B(o) {
|
|
5
5
|
var r, e, t = "";
|
|
6
6
|
if (typeof o == "string" || typeof o == "number") t += o;
|
|
@@ -10,24 +10,24 @@ function B(o) {
|
|
|
10
10
|
} else for (e in o) o[e] && (t && (t += " "), t += e);
|
|
11
11
|
return t;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function E() {
|
|
14
14
|
for (var o, r, e = 0, t = "", n = arguments.length; e < n; e++) (o = arguments[e]) && (r = B(o)) && (t && (t += " "), t += r);
|
|
15
15
|
return t;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function j(o) {
|
|
18
18
|
var r, e, t = "";
|
|
19
19
|
if (typeof o == "string" || typeof o == "number") t += o;
|
|
20
20
|
else if (typeof o == "object") if (Array.isArray(o)) {
|
|
21
21
|
var n = o.length;
|
|
22
|
-
for (r = 0; r < n; r++) o[r] && (e =
|
|
22
|
+
for (r = 0; r < n; r++) o[r] && (e = j(o[r])) && (t && (t += " "), t += e);
|
|
23
23
|
} else for (e in o) o[e] && (t && (t += " "), t += e);
|
|
24
24
|
return t;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
for (var o, r, e = 0, t = "", n = arguments.length; e < n; e++) (o = arguments[e]) && (r =
|
|
26
|
+
function I() {
|
|
27
|
+
for (var o, r, e = 0, t = "", n = arguments.length; e < n; e++) (o = arguments[e]) && (r = j(o)) && (t && (t += " "), t += r);
|
|
28
28
|
return t;
|
|
29
29
|
}
|
|
30
|
-
const
|
|
30
|
+
const C = ({
|
|
31
31
|
ref: o,
|
|
32
32
|
as: r = "div",
|
|
33
33
|
children: e,
|
|
@@ -50,14 +50,15 @@ const j = ({
|
|
|
50
50
|
href: c,
|
|
51
51
|
target: x,
|
|
52
52
|
rel: R,
|
|
53
|
-
htmlFor:
|
|
53
|
+
htmlFor: T,
|
|
54
54
|
type: F,
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
name: L,
|
|
56
|
+
disabled: O,
|
|
57
|
+
...H
|
|
57
58
|
}) => {
|
|
58
59
|
const i = {};
|
|
59
60
|
t && (i.display = t), m && (i.width = m), u && (i.height = u), a && (i.position = a), n && (i.margin = `var(--pittorica-space-${n})`), d && (i.marginTop = `var(--pittorica-space-${d})`), l && (i.marginRight = `var(--pittorica-space-${l})`), f && (i.marginBottom = `var(--pittorica-space-${f})`), g && (i.marginLeft = `var(--pittorica-space-${g})`), h && (i.padding = `var(--pittorica-space-${h})`), y && (i.paddingTop = `var(--pittorica-space-${y})`), s && (i.paddingRight = `var(--pittorica-space-${s})`), v && (i.paddingBottom = `var(--pittorica-space-${v})`), b && (i.paddingLeft = `var(--pittorica-space-${b})`);
|
|
60
|
-
const
|
|
61
|
+
const M = {
|
|
61
62
|
...p,
|
|
62
63
|
...i
|
|
63
64
|
};
|
|
@@ -65,28 +66,29 @@ const j = ({
|
|
|
65
66
|
r,
|
|
66
67
|
{
|
|
67
68
|
ref: o,
|
|
68
|
-
className:
|
|
69
|
-
style:
|
|
69
|
+
className: I("pittorica-box", $),
|
|
70
|
+
style: M,
|
|
70
71
|
href: c,
|
|
71
72
|
target: x,
|
|
72
73
|
rel: R,
|
|
73
|
-
htmlFor:
|
|
74
|
+
htmlFor: T,
|
|
74
75
|
type: F,
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
name: L,
|
|
77
|
+
disabled: O,
|
|
78
|
+
...H,
|
|
77
79
|
children: e
|
|
78
80
|
}
|
|
79
81
|
);
|
|
80
82
|
};
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
+
C.displayName = "Box";
|
|
84
|
+
const z = ({
|
|
83
85
|
children: o,
|
|
84
86
|
content: r,
|
|
85
87
|
side: e = "top",
|
|
86
88
|
className: t,
|
|
87
89
|
...n
|
|
88
90
|
}) => {
|
|
89
|
-
const [d, l] =
|
|
91
|
+
const [d, l] = w(!1), [f, g] = w({ top: 0, left: 0 }), [h, y] = w(e), s = N(null), v = N(null), b = k(() => {
|
|
90
92
|
if (!s.current) return;
|
|
91
93
|
const a = s.current.getBoundingClientRect(), p = 8, $ = 32;
|
|
92
94
|
let c = e;
|
|
@@ -96,12 +98,12 @@ const I = ({
|
|
|
96
98
|
}, [e]), m = () => {
|
|
97
99
|
b(), l(!0);
|
|
98
100
|
}, u = () => l(!1);
|
|
99
|
-
return /* @__PURE__ */
|
|
100
|
-
|
|
101
|
+
return /* @__PURE__ */ P(
|
|
102
|
+
C,
|
|
101
103
|
{
|
|
102
104
|
ref: s,
|
|
103
105
|
as: "span",
|
|
104
|
-
className:
|
|
106
|
+
className: E("pittorica-tooltip-root", t),
|
|
105
107
|
onMouseEnter: m,
|
|
106
108
|
onMouseLeave: u,
|
|
107
109
|
onFocus: m,
|
|
@@ -109,7 +111,7 @@ const I = ({
|
|
|
109
111
|
...n,
|
|
110
112
|
children: [
|
|
111
113
|
o,
|
|
112
|
-
d && typeof document < "u" &&
|
|
114
|
+
d && typeof document < "u" && q(
|
|
113
115
|
/* @__PURE__ */ A(
|
|
114
116
|
"div",
|
|
115
117
|
{
|
|
@@ -131,7 +133,7 @@ const I = ({
|
|
|
131
133
|
}
|
|
132
134
|
);
|
|
133
135
|
};
|
|
134
|
-
|
|
136
|
+
z.displayName = "Tooltip";
|
|
135
137
|
export {
|
|
136
|
-
|
|
138
|
+
z as Tooltip
|
|
137
139
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pittorica/tooltip-react",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"clsx": "^2.1.1",
|
|
13
|
-
"@pittorica/box-react": "0.23.
|
|
13
|
+
"@pittorica/box-react": "0.23.2"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@tabler/icons-react": "^3.36.1",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"typescript": "^5.0.0",
|
|
24
24
|
"vite": "^5.0.0",
|
|
25
25
|
"vitest": "^2.1.9",
|
|
26
|
-
"@pittorica/
|
|
27
|
-
"pittorica": "0.23.
|
|
28
|
-
"@pittorica/
|
|
29
|
-
"
|
|
26
|
+
"@pittorica/flex-react": "0.23.2",
|
|
27
|
+
"@pittorica/text-react": "0.23.2",
|
|
28
|
+
"@pittorica/theme-react": "0.23.2",
|
|
29
|
+
"pittorica": "0.23.2"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": ">=19",
|