asheeui 0.6.6 → 0.6.7
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/components/tooltip/Tooltip.d.ts +0 -19
- package/dist/components/tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/Tooltip.js +121 -129
- package/dist/components/tooltip/tooltip-config.d.ts +3 -7
- package/dist/components/tooltip/tooltip-config.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip-config.js +4 -5
- package/package.json +1 -1
|
@@ -22,18 +22,6 @@ export interface TooltipProps extends BaseTooltipProps {
|
|
|
22
22
|
* @default false
|
|
23
23
|
*/
|
|
24
24
|
isDisabled?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Extra classes applied to every tooltip instance.
|
|
27
|
-
*
|
|
28
|
-
* @default ""
|
|
29
|
-
*/
|
|
30
|
-
className?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Whether to render the tooltip in a Floating UI portal.
|
|
33
|
-
* When true, the tooltip is rendered at the document body level,
|
|
34
|
-
* escaping any parent DOM hierarchy. Defaults to true.
|
|
35
|
-
*/
|
|
36
|
-
portal?: boolean;
|
|
37
25
|
}
|
|
38
26
|
/**
|
|
39
27
|
* A floating tooltip that appears on hover or focus of a child element.
|
|
@@ -47,12 +35,6 @@ export interface TooltipProps extends BaseTooltipProps {
|
|
|
47
35
|
* automatically handles viewport edge detection and flipping. It is fully
|
|
48
36
|
* accessible with keyboard focus support.
|
|
49
37
|
*
|
|
50
|
-
* By default, the tooltip uses FloatingPortal to render at the document body
|
|
51
|
-
* level. This ensures the tooltip escapes CSS containment, overflow clipping,
|
|
52
|
-
* and stacking context issues. The portal can be disabled via the `portal` prop
|
|
53
|
-
* or `components.tooltip.portal` in the config if the tooltip needs to stay
|
|
54
|
-
* within a specific parent container.
|
|
55
|
-
*
|
|
56
38
|
* @param props - Tooltip configuration options.
|
|
57
39
|
* @param props.content - The content to display inside the tooltip.
|
|
58
40
|
* @param props.children - The child element that triggers the tooltip.
|
|
@@ -65,7 +47,6 @@ export interface TooltipProps extends BaseTooltipProps {
|
|
|
65
47
|
* @param props.offset - Offset from the trigger. Defaults to 8.
|
|
66
48
|
* @param props.radius - Corner rounding. Defaults to "md".
|
|
67
49
|
* @param props.showArrow - Whether to show a pointer arrow. Defaults to false.
|
|
68
|
-
* @param props.portal - Whether to render the tooltip in a portal. Defaults to true.
|
|
69
50
|
* @param props.className - Extra classes for the tooltip.
|
|
70
51
|
*
|
|
71
52
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/Tooltip.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAcf,OAAO,EAEL,KAAK,aAAa,EAGnB,MAAM,kBAAkB,CAAC;AAO1B,KAAK,gBAAgB,GAAG,aAAa,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD;;;OAGG;IACH,OAAO,EAAE,SAAS,CAAC;IAEnB;;;OAGG;IACH,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAC;IAEnC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/Tooltip.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAcf,OAAO,EAEL,KAAK,aAAa,EAGnB,MAAM,kBAAkB,CAAC;AAO1B,KAAK,gBAAgB,GAAG,aAAa,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD;;;OAGG;IACH,OAAO,EAAE,SAAS,CAAC;IAEnB;;;OAGG;IACH,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAC;IAEnC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,eAAO,MAAM,OAAO,yGAyMnB,CAAC"}
|
|
@@ -1,167 +1,159 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as a, Fragment as S, jsxs as h } from "react/jsx-runtime";
|
|
3
|
-
import { offset as
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import { useAsheeConfig as
|
|
6
|
-
import { resolveCascade as
|
|
7
|
-
import { FALLBACK_TOOLTIP_CONFIG as
|
|
8
|
-
import { TOOLTIP_PADDING_X_CLASS as
|
|
9
|
-
import { RADIUS_CLASS as
|
|
10
|
-
import { cn as
|
|
11
|
-
import { resolveVariantClass as
|
|
12
|
-
const
|
|
3
|
+
import { offset as J, flip as Q, shift as W, arrow as Z, useFloating as $, autoUpdate as ee, useHover as se, useFocus as oe, useDismiss as re, useRole as te, useInteractions as ae, FloatingPortal as le, FloatingArrow as ne } from "@floating-ui/react";
|
|
4
|
+
import { forwardRef as de, useRef as ie, useState as me, isValidElement as pe, cloneElement as ce } from "react";
|
|
5
|
+
import { useAsheeConfig as ue } from "../../libs/context.js";
|
|
6
|
+
import { resolveCascade as o, resolveRadiusKey as fe, resolveClassKey as i } from "../../utils/resolve-token.js";
|
|
7
|
+
import { FALLBACK_TOOLTIP_CONFIG as s } from "./tooltip-config.js";
|
|
8
|
+
import { TOOLTIP_PADDING_X_CLASS as ve, TOOLTIP_PADDING_Y_CLASS as we, TOOLTIP_FONT_CLASS as ye } from "./tooltip-styles.js";
|
|
9
|
+
import { RADIUS_CLASS as Ae } from "../../shared/radius.js";
|
|
10
|
+
import { cn as Oe } from "../../utils/cn.js";
|
|
11
|
+
import { resolveVariantClass as Se } from "../../shared/variant.js";
|
|
12
|
+
const he = de(
|
|
13
13
|
({
|
|
14
14
|
content: u,
|
|
15
|
-
children:
|
|
16
|
-
variant:
|
|
17
|
-
color:
|
|
18
|
-
size:
|
|
19
|
-
placement:
|
|
20
|
-
delay:
|
|
21
|
-
offset:
|
|
22
|
-
radius:
|
|
23
|
-
showArrow:
|
|
15
|
+
children: r,
|
|
16
|
+
variant: R,
|
|
17
|
+
color: T,
|
|
18
|
+
size: _,
|
|
19
|
+
placement: F,
|
|
20
|
+
delay: I,
|
|
21
|
+
offset: L,
|
|
22
|
+
radius: N,
|
|
23
|
+
showArrow: P,
|
|
24
24
|
isDisabled: l = !1,
|
|
25
|
-
className: z
|
|
26
|
-
portal: K
|
|
25
|
+
className: z
|
|
27
26
|
}, n) => {
|
|
28
27
|
var O;
|
|
29
|
-
const d =
|
|
30
|
-
|
|
28
|
+
const d = ue(), e = (O = d.components) == null ? void 0 : O.tooltip, f = ie(null), [v, K] = me(!1), m = o(
|
|
29
|
+
_,
|
|
31
30
|
e == null ? void 0 : e.size,
|
|
32
31
|
void 0,
|
|
33
|
-
|
|
34
|
-
),
|
|
35
|
-
|
|
32
|
+
s.size
|
|
33
|
+
), x = o(
|
|
34
|
+
F,
|
|
36
35
|
e == null ? void 0 : e.placement,
|
|
37
36
|
void 0,
|
|
38
|
-
|
|
39
|
-
),
|
|
40
|
-
|
|
37
|
+
s.placement
|
|
38
|
+
), D = o(
|
|
39
|
+
R,
|
|
41
40
|
e == null ? void 0 : e.variant,
|
|
42
41
|
d.defaultVariant,
|
|
43
|
-
|
|
44
|
-
),
|
|
45
|
-
|
|
42
|
+
s.variant
|
|
43
|
+
), V = o(
|
|
44
|
+
T,
|
|
46
45
|
e == null ? void 0 : e.color,
|
|
47
46
|
d.defaultColor,
|
|
48
|
-
|
|
49
|
-
),
|
|
50
|
-
|
|
47
|
+
s.color
|
|
48
|
+
), b = o(I, e == null ? void 0 : e.delay, void 0, s.delay), g = o(
|
|
49
|
+
L,
|
|
51
50
|
e == null ? void 0 : e.offset,
|
|
52
51
|
void 0,
|
|
53
|
-
|
|
54
|
-
),
|
|
55
|
-
|
|
52
|
+
s.offset
|
|
53
|
+
), w = o(
|
|
54
|
+
P,
|
|
56
55
|
e == null ? void 0 : e.showArrow,
|
|
57
56
|
void 0,
|
|
58
|
-
|
|
59
|
-
),
|
|
60
|
-
|
|
57
|
+
s.showArrow
|
|
58
|
+
), E = fe(
|
|
59
|
+
N,
|
|
61
60
|
e == null ? void 0 : e.radius,
|
|
62
61
|
d.defaultRadius,
|
|
63
|
-
|
|
64
|
-
),
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
s.radius
|
|
63
|
+
), G = i(
|
|
64
|
+
m,
|
|
65
|
+
ve,
|
|
66
|
+
s.size
|
|
67
|
+
), j = i(
|
|
68
|
+
m,
|
|
69
|
+
we,
|
|
70
|
+
s.size
|
|
71
|
+
), U = i(
|
|
72
|
+
m,
|
|
73
|
+
ye,
|
|
74
|
+
s.size
|
|
69
75
|
), X = i(
|
|
70
|
-
|
|
76
|
+
E,
|
|
71
77
|
Ae,
|
|
72
|
-
|
|
73
|
-
),
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
), k = i(
|
|
78
|
-
p,
|
|
79
|
-
Se,
|
|
80
|
-
o.size
|
|
81
|
-
), B = i(
|
|
82
|
-
j,
|
|
83
|
-
he,
|
|
84
|
-
o.radius
|
|
85
|
-
), w = [
|
|
86
|
-
Z(G),
|
|
87
|
-
$({ padding: 8 }),
|
|
88
|
-
ee({ padding: 8 })
|
|
78
|
+
s.radius
|
|
79
|
+
), y = [
|
|
80
|
+
J(g),
|
|
81
|
+
Q({ padding: 8 }),
|
|
82
|
+
W({ padding: 8 })
|
|
89
83
|
];
|
|
90
|
-
|
|
91
|
-
const { refs:
|
|
92
|
-
open:
|
|
93
|
-
onOpenChange:
|
|
94
|
-
placement:
|
|
95
|
-
whileElementsMounted:
|
|
96
|
-
middleware:
|
|
97
|
-
}),
|
|
98
|
-
delay:
|
|
84
|
+
w && y.push(Z({ element: f }));
|
|
85
|
+
const { refs: p, floatingStyles: Y, context: t } = $({
|
|
86
|
+
open: v && !l,
|
|
87
|
+
onOpenChange: K,
|
|
88
|
+
placement: x,
|
|
89
|
+
whileElementsMounted: ee,
|
|
90
|
+
middleware: y
|
|
91
|
+
}), k = se(t, {
|
|
92
|
+
delay: b,
|
|
99
93
|
enabled: !l
|
|
100
|
-
}),
|
|
94
|
+
}), B = oe(t, { enabled: !l }), H = re(t), M = te(t, { role: "tooltip" }), { getReferenceProps: A, getFloatingProps: q } = ae([
|
|
95
|
+
k,
|
|
96
|
+
B,
|
|
101
97
|
H,
|
|
102
|
-
M
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
ref: m.setReference,
|
|
109
|
-
...t.props
|
|
98
|
+
M
|
|
99
|
+
]), C = pe(r) ? ce(
|
|
100
|
+
r,
|
|
101
|
+
A({
|
|
102
|
+
ref: p.setReference,
|
|
103
|
+
...r.props
|
|
110
104
|
})
|
|
111
105
|
) : /* @__PURE__ */ a(
|
|
112
106
|
"span",
|
|
113
107
|
{
|
|
114
|
-
ref:
|
|
115
|
-
...
|
|
108
|
+
ref: p.setReference,
|
|
109
|
+
...A(),
|
|
116
110
|
className: "inline-flex",
|
|
117
|
-
children:
|
|
118
|
-
}
|
|
119
|
-
);
|
|
120
|
-
if (!u || l)
|
|
121
|
-
return /* @__PURE__ */ a(S, { children: t });
|
|
122
|
-
const A = /* @__PURE__ */ a(
|
|
123
|
-
"div",
|
|
124
|
-
{
|
|
125
|
-
ref: (c) => {
|
|
126
|
-
m.setFloating(c), typeof n == "function" ? n(c) : n && (n.current = c);
|
|
127
|
-
},
|
|
128
|
-
style: C,
|
|
129
|
-
className: "z-50 pointer-events-none",
|
|
130
|
-
...Q(),
|
|
131
|
-
children: /* @__PURE__ */ h(
|
|
132
|
-
"div",
|
|
133
|
-
{
|
|
134
|
-
className: Pe(
|
|
135
|
-
"font-medium border whitespace-nowrap select-none bg-background shadow-md transition-all duration-150 ease-out animate-in fade-in-0 zoom-in-95",
|
|
136
|
-
X,
|
|
137
|
-
Y,
|
|
138
|
-
k,
|
|
139
|
-
B,
|
|
140
|
-
Re(b, g),
|
|
141
|
-
z
|
|
142
|
-
),
|
|
143
|
-
children: [
|
|
144
|
-
u,
|
|
145
|
-
v && /* @__PURE__ */ a(
|
|
146
|
-
ie,
|
|
147
|
-
{
|
|
148
|
-
ref: f,
|
|
149
|
-
context: r,
|
|
150
|
-
className: "fill-current text-border"
|
|
151
|
-
}
|
|
152
|
-
)
|
|
153
|
-
]
|
|
154
|
-
}
|
|
155
|
-
)
|
|
111
|
+
children: r
|
|
156
112
|
}
|
|
157
113
|
);
|
|
158
|
-
return /* @__PURE__ */ h(S, { children: [
|
|
159
|
-
|
|
160
|
-
|
|
114
|
+
return !u || l ? /* @__PURE__ */ a(S, { children: r }) : /* @__PURE__ */ h(S, { children: [
|
|
115
|
+
C,
|
|
116
|
+
/* @__PURE__ */ a(le, { children: v && /* @__PURE__ */ a(
|
|
117
|
+
"div",
|
|
118
|
+
{
|
|
119
|
+
ref: (c) => {
|
|
120
|
+
p.setFloating(c), typeof n == "function" ? n(c) : n && (n.current = c);
|
|
121
|
+
},
|
|
122
|
+
style: Y,
|
|
123
|
+
className: "z-50 pointer-events-none",
|
|
124
|
+
...q(),
|
|
125
|
+
children: /* @__PURE__ */ h(
|
|
126
|
+
"div",
|
|
127
|
+
{
|
|
128
|
+
className: Oe(
|
|
129
|
+
"font-medium border whitespace-nowrap select-none bg-background shadow-md transition-all duration-150 ease-out animate-in fade-in-0 zoom-in-95",
|
|
130
|
+
G,
|
|
131
|
+
j,
|
|
132
|
+
U,
|
|
133
|
+
X,
|
|
134
|
+
Se(D, V),
|
|
135
|
+
e == null ? void 0 : e.className,
|
|
136
|
+
z
|
|
137
|
+
),
|
|
138
|
+
children: [
|
|
139
|
+
u,
|
|
140
|
+
w && /* @__PURE__ */ a(
|
|
141
|
+
ne,
|
|
142
|
+
{
|
|
143
|
+
ref: f,
|
|
144
|
+
context: t,
|
|
145
|
+
className: "fill-current text-border"
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
) })
|
|
161
153
|
] });
|
|
162
154
|
}
|
|
163
155
|
);
|
|
164
|
-
|
|
156
|
+
he.displayName = "Tooltip";
|
|
165
157
|
export {
|
|
166
|
-
|
|
158
|
+
he as Tooltip
|
|
167
159
|
};
|
|
@@ -73,15 +73,11 @@ export interface TooltipConfig {
|
|
|
73
73
|
*/
|
|
74
74
|
showArrow?: boolean;
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
77
|
-
* When true, the tooltip is rendered at the document body level,
|
|
78
|
-
* escaping any parent DOM hierarchy. This prevents CSS containment,
|
|
79
|
-
* overflow clipping, and stacking context issues. Defaults to true
|
|
80
|
-
* because tooltips should always appear above other content.
|
|
76
|
+
* Extra classes applied to every tooltip instance.
|
|
81
77
|
*
|
|
82
|
-
* @default
|
|
78
|
+
* @default ""
|
|
83
79
|
*/
|
|
84
|
-
|
|
80
|
+
className?: string;
|
|
85
81
|
}
|
|
86
82
|
/**
|
|
87
83
|
* Default config values registered for the Tooltip component.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip-config.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip-config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEjE;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GACxB,KAAK,GACL,WAAW,GACX,SAAS,GACT,QAAQ,GACR,cAAc,GACd,YAAY,GACZ,MAAM,GACN,YAAY,GACZ,UAAU,GACV,OAAO,GACP,aAAa,GACb,WAAW,CAAC;AAEhB;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC;AAElC;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;;;;OAKG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;IAEtB;;;;OAIG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAE7B;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAEnD;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB
|
|
1
|
+
{"version":3,"file":"tooltip-config.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip-config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEjE;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GACxB,KAAK,GACL,WAAW,GACX,SAAS,GACT,QAAQ,GACR,cAAc,GACd,YAAY,GACZ,MAAM,GACN,YAAY,GACZ,UAAU,GACV,OAAO,GACP,aAAa,GACb,WAAW,CAAC;AAEhB;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC;AAElC;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;;;;OAKG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;IAEtB;;;;OAIG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAE7B;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAEnD;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAMlC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,aAAa,CAUlD,CAAC;AAEX,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,2BAA2B;QACnC,OAAO,EAAE,aAAa,CAAC;KACxB;CACF"}
|
|
@@ -5,9 +5,8 @@ const e = {
|
|
|
5
5
|
placement: "top",
|
|
6
6
|
delay: 200,
|
|
7
7
|
offset: 8,
|
|
8
|
-
showArrow: !1
|
|
9
|
-
|
|
10
|
-
}, r = {
|
|
8
|
+
showArrow: !1
|
|
9
|
+
}, s = {
|
|
11
10
|
size: "md",
|
|
12
11
|
placement: "top",
|
|
13
12
|
variant: "solid",
|
|
@@ -16,10 +15,10 @@ const e = {
|
|
|
16
15
|
offset: 8,
|
|
17
16
|
radius: "md",
|
|
18
17
|
showArrow: !1,
|
|
19
|
-
|
|
18
|
+
className: ""
|
|
20
19
|
};
|
|
21
20
|
o("tooltip", e);
|
|
22
21
|
export {
|
|
23
|
-
|
|
22
|
+
s as FALLBACK_TOOLTIP_CONFIG,
|
|
24
23
|
e as defaultTooltipConfig
|
|
25
24
|
};
|