woby-tooltip 1.0.5 → 1.0.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 +99 -212
- package/build/index.es.js +2756 -0
- package/build/index.html +21 -0
- package/{dist → build}/style.css +246 -691
- package/dist/index.es.js +211 -389
- package/dist/index.es.js.map +1 -1
- package/dist/output.css +246 -691
- package/dist/types/Tooltip.d.ts +8 -47
- package/dist/types/Tooltip.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +14 -13
- package/tsconfig.json +1 -1
- package/tsconfig.tsbuildinfo +1 -0
- package/vite.config.web.mts +2 -2
- package/dist/types/Arrow.d.ts +0 -8
- package/dist/types/Arrow.d.ts.map +0 -1
- package/dist/types/AutoTooltip.d.ts +0 -7
- package/dist/types/AutoTooltip.d.ts.map +0 -1
- package/dist/types/TextBox.d.ts +0 -49
- package/dist/types/TextBox.d.ts.map +0 -1
- package/dist/types/assets/arrow-down.d.ts +0 -4
- package/dist/types/assets/arrow-down.d.ts.map +0 -1
- package/dist/types/assets/arrow-up.d.ts +0 -4
- package/dist/types/assets/arrow-up.d.ts.map +0 -1
- package/dist/types/assets/logo.d.ts +0 -4
- package/dist/types/assets/logo.d.ts.map +0 -1
package/dist/index.es.js
CHANGED
@@ -1,409 +1,231 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
1
|
+
import { jsx, jsxs } from "woby/jsx-runtime";
|
2
|
+
import { useEffect, $$, createContext, $, useMemo } from "woby";
|
3
|
+
let nanoid = (size = 21) => crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {
|
4
|
+
byte &= 63;
|
5
|
+
if (byte < 36) {
|
6
|
+
id += byte.toString(36);
|
7
|
+
} else if (byte < 62) {
|
8
|
+
id += (byte - 26).toString(36).toUpperCase();
|
9
|
+
} else if (byte > 62) {
|
10
|
+
id += "-";
|
11
|
+
} else {
|
12
|
+
id += "_";
|
13
|
+
}
|
14
|
+
return id;
|
15
|
+
}, "");
|
16
|
+
const isTemp = (s) => !!s.raw;
|
17
|
+
const extract = (C, props, classNames) => {
|
18
|
+
const { className, ...p } = props;
|
19
|
+
const cls = p.class;
|
20
|
+
delete p.class;
|
21
|
+
return /* @__PURE__ */ jsx(C, { class: [classNames, cls, className], ...p });
|
22
|
+
};
|
23
|
+
const append = (child, parent) => {
|
24
|
+
return useEffect(() => {
|
25
|
+
const [c, p] = [$$($$(child)), $$($$(parent))];
|
26
|
+
p.appendChild(c);
|
27
|
+
const um = () => p.removeChild(c);
|
28
|
+
return um;
|
20
29
|
});
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
+
};
|
31
|
+
function Styled(comp) {
|
32
|
+
function styled2(strings, ...values) {
|
33
|
+
if (isTemp(strings)) {
|
34
|
+
const C = comp;
|
35
|
+
const N = "_" + nanoid(10);
|
36
|
+
useEffect(() => {
|
37
|
+
const r = `.${N} {
|
38
|
+
${strings.map((str, i) => i < values.length ? str + $$(values[i]) : str).join("")}
|
39
|
+
}`;
|
40
|
+
return append(/* @__PURE__ */ jsx("style", { id: N, children: r }), document.head);
|
41
|
+
});
|
42
|
+
return C ? (props) => extract(C, props, N) : N;
|
30
43
|
}
|
31
|
-
return
|
32
|
-
}
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
} = props;
|
54
|
-
const numberChildren = Array.isArray(children) ? children.length : 1;
|
55
|
-
const lastIndex = numberChildren - 1;
|
56
|
-
const adjChildren = [children].flat().map((child, index) => {
|
57
|
-
const hover = useMemo(() => !tpStatic && $$(hoverIndex) === index);
|
58
|
-
const nhover = useMemo(() => !$$(hover));
|
59
|
-
const childProps = {
|
60
|
-
// ...child.props,
|
61
|
-
ref: (span) => spanHeightsRef[`span${index + 1}`] = span,
|
62
|
-
class: [padding, {
|
63
|
-
"whitespace-nowrap": () => $$(width) === "auto",
|
64
|
-
[$$(hoverColor)]: hover,
|
65
|
-
[$$(hoverBackground)]: hover,
|
66
|
-
[$$(color)]: nhover,
|
67
|
-
[$$(backgroundColor)]: nhover,
|
68
|
-
[$$(lineSeparated)]: () => $$(lineSeparated) && lastIndex !== index
|
69
|
-
}],
|
70
|
-
// style,
|
71
|
-
onMouseOver: () => onSpanHover(index, lastIndex, numberChildren)
|
44
|
+
return Styled(strings).styled;
|
45
|
+
}
|
46
|
+
return { comp, styled: styled2 };
|
47
|
+
}
|
48
|
+
const styled = Styled().styled;
|
49
|
+
createContext();
|
50
|
+
function useComputedStyle(target, patterns = []) {
|
51
|
+
const styles = $({});
|
52
|
+
useEffect(() => {
|
53
|
+
if (!$$(target)) return () => {
|
54
|
+
};
|
55
|
+
const getMatchingStyles = () => {
|
56
|
+
const computedStyle = window.getComputedStyle($$(target));
|
57
|
+
const matchedStyles = {};
|
58
|
+
for (const property of computedStyle) {
|
59
|
+
if (patterns.some(
|
60
|
+
(pattern) => typeof pattern === "string" ? property === pattern : pattern.test(property)
|
61
|
+
)) {
|
62
|
+
matchedStyles[property] = computedStyle.getPropertyValue(property);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
return matchedStyles;
|
72
66
|
};
|
73
|
-
|
67
|
+
styles(getMatchingStyles());
|
68
|
+
const observer = new MutationObserver(() => {
|
69
|
+
const updatedStyles = getMatchingStyles();
|
70
|
+
styles((prevStyles) => {
|
71
|
+
const hasChanges = Object.keys(updatedStyles).some(
|
72
|
+
(key) => updatedStyles[key] !== prevStyles[key]
|
73
|
+
);
|
74
|
+
return hasChanges ? updatedStyles : prevStyles;
|
75
|
+
});
|
76
|
+
});
|
77
|
+
observer.observe($$(target), {
|
78
|
+
attributes: true,
|
79
|
+
attributeFilter: ["style", "class"],
|
80
|
+
subtree: false
|
81
|
+
});
|
82
|
+
return () => observer.disconnect();
|
74
83
|
});
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
84
|
+
return styles;
|
85
|
+
}
|
86
|
+
const tooltipDef = `text-left border-b-[#666] border-b border-dotted
|
87
|
+
[&:hover_.tpcontents]:visible [&:hover_.tpcontents]:opacity-100
|
88
|
+
`;
|
89
|
+
const tooltip = `inline-block relative
|
90
|
+
[&:hover_.tpcontents]:visible [&:hover_.tpcontents]:opacity-100
|
91
|
+
`;
|
92
|
+
const topDef = `bg-[#eeeeee] min-w-max box-border border shadow-[0_1px_8px_#000000] transition-opacity duration-[0.8s] px-5 py-2.5 rounded-lg border-solid border-[#000000] `;
|
93
|
+
const top = `absolute z-[99999999] left-2/4 -top-5 `;
|
94
|
+
const top_i = `absolute overflow-hidden top-full after:content-[''] after:absolute after:-translate-x-2/4 after:-translate-y-2/4 after:rotate-45 after:left-2/4 `;
|
95
|
+
const rightDef = `bg-[#eeeeee] min-w-max box-border border shadow-[0_1px_8px_#000000] transition-opacity duration-[0.8s] px-5 py-2.5 rounded-lg border-solid border-[#000000] `;
|
96
|
+
const right = `absolute z-[99999999] ml-5 left-full top-2/4 `;
|
97
|
+
const right_i = `absolute overflow-hidden right-full after:content-[''] after:absolute after:translate-x-2/4 after:-translate-y-2/4 after:-rotate-45 after:left-0 after:top-2/4 `;
|
98
|
+
const bottomDef = `bg-[#eeeeee] min-w-max box-border border shadow-[0_1px_8px_#000000] transition-opacity duration-[0.8s] px-5 py-2.5 rounded-lg border-solid border-[#000000] `;
|
99
|
+
const bottom = `absolute z-[99999999] left-2/4 top-10 `;
|
100
|
+
const bottom_i = `absolute overflow-hidden bottom-full after:content-[''] after:absolute after:-translate-x-2/4 after:translate-y-2/4 after:rotate-45 after:left-2/4 `;
|
101
|
+
const leftDef = `bg-[#eeeeee] min-w-max box-border border shadow-[0_1px_8px_#000000] transition-opacity duration-[0.8s] px-5 py-2.5 rounded-lg border-solid border-[#000000] `;
|
102
|
+
const left = `absolute z-[99999999] mr-5 right-full top-2/4 `;
|
103
|
+
const left_i = `absolute overflow-hidden left-full after:content-[''] after:absolute after:-translate-x-2/4 after:-translate-y-2/4 after:-rotate-45 after:left-0 after:top-2/4 `;
|
104
|
+
const Tooltip = ({ children, class: cls = tooltipDef, className, ...props }) => {
|
105
|
+
return /* @__PURE__ */ jsx("div", { class: [tooltip, cls, className], children });
|
106
|
+
};
|
107
|
+
function cssMultiply(value, multiplier) {
|
108
|
+
const match = ($$(value) + "").match(/^(-?\d*\.?\d+)([a-z%]*)$/);
|
109
|
+
if (!match)
|
110
|
+
throw new Error(`Invalid CSS unit: ${$$(value)}`);
|
111
|
+
const [, numericValue, unit] = match;
|
112
|
+
const result = +numericValue * multiplier;
|
113
|
+
return `${result}${unit}`;
|
114
|
+
}
|
115
|
+
const x2 = (value) => cssMultiply(value, 2);
|
116
|
+
const translate = (x, y) => `translate(${$$(x)}, ${$$(y)})`;
|
117
|
+
const TooltipContent = ({ children, style, class: cls = $(), className, static: st, position = "top", arrowLocation = "50%", arrowSize = "12px", ...props }) => {
|
118
|
+
const setDef = () => {
|
119
|
+
if (!$$(cls))
|
120
|
+
switch ($$(position)) {
|
121
|
+
case "top":
|
122
|
+
cls(topDef);
|
123
|
+
case "left":
|
124
|
+
cls(leftDef);
|
125
|
+
case "right":
|
126
|
+
cls(rightDef);
|
127
|
+
case "bottom":
|
128
|
+
cls(bottomDef);
|
129
|
+
}
|
89
130
|
};
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
case "
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
right(`calc(${$$(hLeftPos)})`);
|
103
|
-
break;
|
104
|
-
case "v-start":
|
105
|
-
top(calcTopPos(align, $$(firstH), null));
|
106
|
-
break;
|
107
|
-
case "v-end":
|
108
|
-
top(calcTopPos(align, $$(lineSeparated) ? -$$(lastH) + 1 : -$$(lastH), $$(totH)));
|
109
|
-
break;
|
110
|
-
case "v-center":
|
111
|
-
top(`calc(0% - ${$$(totH)}px/2 + 11px)`);
|
112
|
-
if (isAlign(align, "center")) {
|
113
|
-
top(`calc(50% - ${$$(totH)}px/2)`);
|
114
|
-
}
|
115
|
-
if (isAlign(align, "bottom")) {
|
116
|
-
top(`calc(100% - ${$$(totH)}px/2 - 11px)`);
|
117
|
-
}
|
118
|
-
break;
|
131
|
+
useEffect(setDef);
|
132
|
+
setDef();
|
133
|
+
const pos = useMemo(() => {
|
134
|
+
switch ($$(position)) {
|
135
|
+
case "top":
|
136
|
+
return top;
|
137
|
+
case "right":
|
138
|
+
return right;
|
139
|
+
case "bottom":
|
140
|
+
return bottom;
|
141
|
+
case "left":
|
142
|
+
return left;
|
119
143
|
}
|
120
|
-
|
144
|
+
});
|
145
|
+
const transform = useMemo(() => {
|
146
|
+
switch ($$(position)) {
|
121
147
|
case "top":
|
122
|
-
|
123
|
-
break;
|
148
|
+
return translate("-" + $$(arrowLocation), "-100%");
|
124
149
|
case "left":
|
125
|
-
right("8px");
|
126
|
-
break;
|
127
150
|
case "right":
|
128
|
-
|
129
|
-
|
151
|
+
return translate("0", "-" + $$(arrowLocation));
|
152
|
+
case "bottom":
|
153
|
+
return translate("-" + $$(arrowLocation), "0");
|
130
154
|
}
|
131
155
|
});
|
132
|
-
const
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
156
|
+
const ali = useMemo(() => {
|
157
|
+
switch ($$(position)) {
|
158
|
+
case "bottom":
|
159
|
+
case "top":
|
160
|
+
return { left: arrowLocation };
|
161
|
+
case "left":
|
162
|
+
case "right":
|
163
|
+
return { top: arrowLocation };
|
140
164
|
}
|
141
|
-
return textBoxWidthValue2;
|
142
165
|
});
|
143
|
-
const
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
)
|
190
|
-
}
|
191
|
-
)
|
192
|
-
]
|
166
|
+
const ii = useMemo(() => {
|
167
|
+
switch ($$(position)) {
|
168
|
+
case "top":
|
169
|
+
return top_i + styled`
|
170
|
+
margin-left:-${$$(arrowSize)};
|
171
|
+
width:${x2(arrowSize)};
|
172
|
+
height:${$$(arrowSize)};
|
173
|
+
|
174
|
+
&::after{
|
175
|
+
width:${$$(arrowSize)};
|
176
|
+
height:${$$(arrowSize)};
|
177
|
+
}
|
178
|
+
`;
|
179
|
+
case "right":
|
180
|
+
return right_i + styled`
|
181
|
+
margin-top:-${$$(arrowSize)};
|
182
|
+
width:${$$(arrowSize)};
|
183
|
+
height:${x2(arrowSize)};
|
184
|
+
|
185
|
+
&::after{
|
186
|
+
width:${$$(arrowSize)};
|
187
|
+
height:${$$(arrowSize)};
|
188
|
+
}
|
189
|
+
`;
|
190
|
+
case "bottom":
|
191
|
+
return bottom_i + styled`
|
192
|
+
margin-left:-${$$(arrowSize)};
|
193
|
+
width:${x2(arrowSize)};
|
194
|
+
height:${$$(arrowSize)};
|
195
|
+
|
196
|
+
&::after{
|
197
|
+
width:${$$(arrowSize)};
|
198
|
+
height:${$$(arrowSize)};
|
199
|
+
}
|
200
|
+
`;
|
201
|
+
case "left":
|
202
|
+
return left_i + styled`
|
203
|
+
margin-top:-${$$(arrowSize)};
|
204
|
+
width:${$$(arrowSize)};
|
205
|
+
height:${x2(arrowSize)};
|
206
|
+
|
207
|
+
&::after{
|
208
|
+
width:${$$(arrowSize)};
|
209
|
+
height:${$$(arrowSize)};
|
210
|
+
}
|
211
|
+
`;
|
193
212
|
}
|
194
|
-
);
|
195
|
-
};
|
196
|
-
const Arrow = ({ isHovered, hovBkg, bkgCol, flat }) => {
|
197
|
-
const backgroundColor = useMemo(() => $$(isHovered) ? $$(hovBkg) : $$(bkgCol));
|
198
|
-
const boxShadow = useMemo(() => $$(flat) ? null : "[box-shadow:rgba(0,0,0,0.18)0px_0px_0px_1px]");
|
199
|
-
return /* @__PURE__ */ jsx$1("div", { class: [`rotate-45 w-[14px] h-[14px] m-[3px] z-[1]`, backgroundColor, boxShadow] });
|
200
|
-
};
|
201
|
-
const Tooltip = (properties = {}) => {
|
202
|
-
const props = {
|
203
|
-
/** tailwind */
|
204
|
-
hoverBackground: "bg-[#ececec]",
|
205
|
-
/** tailwind */
|
206
|
-
hoverColor: "text-[black]",
|
207
|
-
/** tailwind */
|
208
|
-
backgroundColor: "bg-[white]",
|
209
|
-
/** not tailwind */
|
210
|
-
textboxWidth: "150px",
|
211
|
-
/** tailwind */
|
212
|
-
fontSize: "[font-size:inherit]",
|
213
|
-
/** tailwind */
|
214
|
-
color: "text-inherit",
|
215
|
-
borderRadius: "rounded-[5px]",
|
216
|
-
shadowColor: "rgba(0,0,0,0.251)",
|
217
|
-
shadowShape: "0 8px 15px",
|
218
|
-
moveDown: "0px",
|
219
|
-
moveRight: "0px",
|
220
|
-
moveLeft: "0px",
|
221
|
-
moveUp: "0px",
|
222
|
-
position: "bottom center",
|
223
|
-
arrowAlign: $("start"),
|
224
|
-
textAlign: "left",
|
225
|
-
fontFamily: "inherit",
|
226
|
-
fontWeight: "bold",
|
227
|
-
zIndex: "100",
|
228
|
-
animation: "",
|
229
|
-
show: false,
|
230
|
-
...properties
|
231
|
-
};
|
232
|
-
const {
|
233
|
-
position: pos,
|
234
|
-
lineSeparated: lines,
|
235
|
-
arrowAlign: arwAlign,
|
236
|
-
hoverBackground,
|
237
|
-
backgroundColor,
|
238
|
-
moveDown,
|
239
|
-
moveRight,
|
240
|
-
moveLeft,
|
241
|
-
moveUp,
|
242
|
-
textAlign,
|
243
|
-
fontFamily,
|
244
|
-
fontWeight,
|
245
|
-
fontSize,
|
246
|
-
color,
|
247
|
-
zIndex,
|
248
|
-
animation,
|
249
|
-
flat,
|
250
|
-
parentRef: pf,
|
251
|
-
parent: Parent,
|
252
|
-
// shadowColor, shadowShape, textboxWidth, padding, borderRadius, hoverColor,
|
253
|
-
containerClass
|
254
|
-
} = props;
|
255
|
-
const show = (
|
256
|
-
/* $$(parent) ? props.show : */
|
257
|
-
isObservable(props.show) ? props.show : $(props.show)
|
258
|
-
);
|
259
|
-
const parentRef = isObservable(pf) ? pf : $(pf);
|
260
|
-
useEffect(() => {
|
261
|
-
const p = $$(parentRef);
|
262
|
-
if (!p)
|
263
|
-
return;
|
264
|
-
const on = () => show(true);
|
265
|
-
const off = () => show(false);
|
266
|
-
p.addEventListener("mouseenter", on);
|
267
|
-
p.addEventListener("mouseleave", off);
|
268
|
-
return () => {
|
269
|
-
p.removeEventListener("mouseenter", on);
|
270
|
-
p.removeEventListener("mouseleave", off);
|
271
|
-
};
|
272
|
-
});
|
273
|
-
const hoverArrow = $(false);
|
274
|
-
const mount = $(true);
|
275
|
-
useEffect(() => {
|
276
|
-
if ($$(show))
|
277
|
-
mount(true);
|
278
|
-
if (!$$(animation))
|
279
|
-
mount(false);
|
280
213
|
});
|
281
|
-
const
|
282
|
-
const
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
classes.push("top-full left-0 w-full justify-center");
|
294
|
-
break;
|
295
|
-
case "top":
|
296
|
-
classes.push("left-0 w-full justify-center");
|
297
|
-
bottom = "100%";
|
298
|
-
break;
|
299
|
-
case "right":
|
300
|
-
classes.push("top-0 left-full h-full justify-start");
|
301
|
-
break;
|
302
|
-
default:
|
303
|
-
classes.push("top-0 right-full h-full justify-end");
|
304
|
-
break;
|
305
|
-
}
|
306
|
-
const onAxis = {
|
307
|
-
y: isSide(position.side, "top") || isSide(position.side, "bottom"),
|
308
|
-
x: isSide(position.side, "left") || isSide(position.side, "right")
|
309
|
-
};
|
310
|
-
arrow(onAxis.y ? `h-${$$(arrow)}` : `v-${$$(arrow)}`);
|
311
|
-
const num = (str) => Number(str.slice(0, -2));
|
312
|
-
const move = {
|
313
|
-
down: num(moveDown),
|
314
|
-
up: num(moveUp),
|
315
|
-
left: num(moveLeft),
|
316
|
-
right: num(moveRight)
|
317
|
-
};
|
318
|
-
const oneMovePropIsNeg = move.down < 0 || move.up < 0 || move.left < 0 || move.right < 0;
|
319
|
-
switch (align) {
|
320
|
-
case "left":
|
321
|
-
if (onAxis.y)
|
322
|
-
classes.push("!justify-start");
|
323
|
-
break;
|
324
|
-
case "right":
|
325
|
-
if (onAxis.y)
|
326
|
-
classes.push("!justify-end");
|
327
|
-
break;
|
328
|
-
case "bottom":
|
329
|
-
if (onAxis.x)
|
330
|
-
classes.push("items-end");
|
331
|
-
break;
|
332
|
-
case "top":
|
333
|
-
break;
|
334
|
-
default:
|
335
|
-
if (onAxis.x) {
|
336
|
-
classes.push("items-center");
|
337
|
-
if (!oneMovePropIsNeg) {
|
338
|
-
move.down *= 2;
|
339
|
-
move.up *= 2;
|
340
|
-
}
|
341
|
-
}
|
342
|
-
if (onAxis.y && !oneMovePropIsNeg) {
|
343
|
-
move.right *= 2;
|
344
|
-
move.left *= 2;
|
345
|
-
}
|
346
|
-
break;
|
347
|
-
}
|
348
|
-
const adjustment = `${move.down}px ${move.left}px ${move.up}px ${move.right}px`;
|
349
|
-
tooltipStyle = {
|
350
|
-
...tooltipStyle,
|
351
|
-
zIndex,
|
352
|
-
color,
|
353
|
-
bottom,
|
354
|
-
fontSize,
|
355
|
-
textAlign,
|
356
|
-
fontFamily,
|
357
|
-
fontWeight,
|
358
|
-
padding: oneMovePropIsNeg ? null : adjustment,
|
359
|
-
margin: oneMovePropIsNeg ? adjustment : null,
|
360
|
-
animation: () => $$(show) ? `rpt-${$$(animation)} 0.2s` : `rpt-${$$(animation)}-out 0.15s`
|
361
|
-
};
|
362
|
-
const e = useMemo(
|
363
|
-
() => !$$(animation) && $$(show) && $$(props.children) || $$(show) && $$(mount) && $$(props.children) ? /* @__PURE__ */ jsx$1(
|
364
|
-
"div",
|
365
|
-
{
|
366
|
-
className: classes,
|
367
|
-
style: tooltipStyle,
|
368
|
-
onAnimationEnd: () => {
|
369
|
-
if (!$$(show) && $$(animation))
|
370
|
-
mount(false);
|
371
|
-
},
|
372
|
-
children: /* @__PURE__ */ jsxs("div", { class: "flex justify-center", children: [
|
373
|
-
/* @__PURE__ */ jsx$1(
|
374
|
-
Arrow,
|
375
|
-
{
|
376
|
-
isHovered: hoverArrow,
|
377
|
-
hovBkg: hoverBackground,
|
378
|
-
bkgCol: backgroundColor,
|
379
|
-
flat
|
380
|
-
}
|
381
|
-
),
|
382
|
-
/* @__PURE__ */ jsx$1(
|
383
|
-
TextBox,
|
384
|
-
{
|
385
|
-
...props,
|
386
|
-
hoverArrow,
|
387
|
-
lines: lineSeparated,
|
388
|
-
pos: position,
|
389
|
-
arw: arrow,
|
390
|
-
move
|
391
|
-
}
|
392
|
-
)
|
393
|
-
] })
|
394
|
-
}
|
395
|
-
) : null
|
396
|
-
);
|
397
|
-
return useMemo(() => $$(Parent) ? /* @__PURE__ */ jsxs("div", { class: [containerClass ?? "relative"], ref: parentRef, children: [
|
398
|
-
Parent,
|
399
|
-
e
|
400
|
-
] }) : e);
|
214
|
+
const tp = $();
|
215
|
+
const ir = $();
|
216
|
+
const sty = useComputedStyle(tp, ["background-color", /^border-(?!.*-radius$)/, "box-shadow"]);
|
217
|
+
return /* @__PURE__ */ jsxs("div", { ref: tp, class: [pos, cls, () => $$(st) ? "" : "invisible opacity-0", className, "tpcontents"], style: [style, { transform }], ...props, children: [
|
218
|
+
children,
|
219
|
+
() => /* @__PURE__ */ jsx("i", { ref: ir, class: [ii, styled`
|
220
|
+
&::after{
|
221
|
+
${Object.keys($$(sty)).map((k) => `${k}:${$$(sty)[k]};
|
222
|
+
`).join("")}
|
223
|
+
}
|
224
|
+
`], style: ali })
|
225
|
+
] });
|
401
226
|
};
|
402
227
|
export {
|
403
|
-
TextBox,
|
404
228
|
Tooltip,
|
405
|
-
|
406
|
-
isAlignA,
|
407
|
-
isSide
|
229
|
+
TooltipContent
|
408
230
|
};
|
409
231
|
//# sourceMappingURL=index.es.js.map
|