@sth87/shadcn-design-system 0.2.12 → 0.3.0
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 +2 -3
- package/dist/AI_CONTEXT.md +4 -4
- package/dist/cjs/components/Calendar/Calendar.cjs +1 -1
- package/dist/cjs/components/Calendar/index.cjs +1 -1
- package/dist/cjs/components/Checkbox/Checkbox.cjs +1 -1
- package/dist/cjs/components/Checkbox/Confetti.cjs +1 -0
- package/dist/cjs/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/cjs/components/DatePicker/RangePicker.cjs +1 -1
- package/dist/cjs/components/DatePicker/TimePicker.cjs +1 -1
- package/dist/cjs/components/Slider/Slider.cjs +1 -1
- package/dist/cjs/components/Slider/SpecSliderLabel.cjs +1 -0
- package/dist/cjs/components/Table/TableFilter/data-table-filter-popover.cjs +1 -1
- package/dist/cjs/components/Tabs/Tabs.cjs +1 -1
- package/dist/cjs/components/Tooltip/SpecTooltip.cjs +1 -0
- package/dist/cjs/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/packages/ui/src/components/calendar-logic.cjs +1 -0
- package/dist/cjs/packages/ui/src/components/calendar.cjs +1 -1
- package/dist/cjs/styles/index.css +1 -1
- package/dist/cjs/utils/animations.cjs +1 -1
- package/dist/cjs/utils/date-format.cjs +1 -0
- package/dist/esm/components/Calendar/Calendar.js +23 -19
- package/dist/esm/components/Calendar/index.js +7 -3
- package/dist/esm/components/Checkbox/Checkbox.js +46 -44
- package/dist/esm/components/Checkbox/Confetti.js +28 -0
- package/dist/esm/components/DatePicker/DatePicker.js +78 -81
- package/dist/esm/components/DatePicker/RangePicker.js +121 -124
- package/dist/esm/components/DatePicker/TimePicker.js +122 -124
- package/dist/esm/components/Slider/Slider.js +140 -199
- package/dist/esm/components/Slider/SpecSliderLabel.js +60 -0
- package/dist/esm/components/Table/TableFilter/data-table-filter-popover.js +30 -26
- package/dist/esm/components/Tabs/Tabs.js +80 -91
- package/dist/esm/components/Tooltip/SpecTooltip.js +69 -0
- package/dist/esm/components/Tooltip/Tooltip.js +42 -85
- package/dist/esm/index.js +162 -158
- package/dist/esm/packages/ui/src/components/calendar-logic.js +83 -0
- package/dist/esm/packages/ui/src/components/calendar.js +459 -184
- package/dist/esm/styles/index.css +1 -1
- package/dist/esm/utils/animations.js +36 -44
- package/dist/esm/utils/date-format.js +162 -0
- package/dist/types/components/Calendar/Calendar.d.ts +5 -5
- package/dist/types/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/types/components/Calendar/index.d.ts +1 -1
- package/dist/types/components/Calendar/index.d.ts.map +1 -1
- package/dist/types/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/types/components/Checkbox/Confetti.d.ts +2 -0
- package/dist/types/components/Checkbox/Confetti.d.ts.map +1 -0
- package/dist/types/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/types/components/DatePicker/RangePicker.d.ts.map +1 -1
- package/dist/types/components/DatePicker/TimePicker.d.ts.map +1 -1
- package/dist/types/components/Marquee/Marquee.d.ts +1 -1
- package/dist/types/components/Slider/Slider.d.ts +1 -1
- package/dist/types/components/Slider/Slider.d.ts.map +1 -1
- package/dist/types/components/Slider/SpecSliderLabel.d.ts +14 -0
- package/dist/types/components/Slider/SpecSliderLabel.d.ts.map +1 -0
- package/dist/types/components/Table/TableFilter/data-table-filter-popover.d.ts.map +1 -1
- package/dist/types/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/types/components/Tooltip/SpecTooltip.d.ts +11 -0
- package/dist/types/components/Tooltip/SpecTooltip.d.ts.map +1 -0
- package/dist/types/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/components/Upload/Upload.d.ts +1 -1
- package/dist/types/packages/ui/src/components/badge.d.ts +2 -2
- package/dist/types/packages/ui/src/components/button.d.ts +1 -1
- package/dist/types/packages/ui/src/components/calendar-logic.d.ts +72 -0
- package/dist/types/packages/ui/src/components/calendar-logic.d.ts.map +1 -0
- package/dist/types/packages/ui/src/components/calendar.d.ts +95 -6
- package/dist/types/packages/ui/src/components/calendar.d.ts.map +1 -1
- package/dist/types/utils/animations.d.ts +0 -19
- package/dist/types/utils/animations.d.ts.map +1 -1
- package/dist/types/utils/date-format.d.ts +24 -0
- package/dist/types/utils/date-format.d.ts.map +1 -0
- package/package.json +2 -3
- package/dist/cjs/utils/css.cjs +0 -1
- package/dist/esm/utils/css.js +0 -24
- package/dist/types/utils/css.d.ts +0 -4
- package/dist/types/utils/css.d.ts.map +0 -1
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import { jsxs as x, jsx as l, Fragment as
|
|
1
|
+
import { jsxs as x, jsx as l, Fragment as Se } from "react/jsx-runtime";
|
|
2
2
|
import u from "react";
|
|
3
3
|
import { Tabs as ze, TabsContent as Re, TabsList as Le, TabsTrigger as Ee } from "../../packages/ui/src/components/tabs.js";
|
|
4
|
-
import { motion as Z } from "motion/react";
|
|
5
4
|
import { cn as a } from "../../packages/ui/src/lib/utils.js";
|
|
6
|
-
import { ScrollArea as K, ScrollBar as
|
|
7
|
-
import { Popover as
|
|
8
|
-
import { MoreHorizontal as
|
|
9
|
-
import { variantClasses as Oe, getColorClasses as
|
|
10
|
-
const Me = u.forwardRef((de, ne) => {
|
|
5
|
+
import { ScrollArea as K, ScrollBar as Z } from "../ScrollArea/ScrollArea.js";
|
|
6
|
+
import { Popover as ee } from "../Popover/index.js";
|
|
7
|
+
import { MoreHorizontal as se } from "lucide-react";
|
|
8
|
+
import { variantClasses as Oe, getColorClasses as Ae, getListBorderClasses as Ie, alignmentClasses as te, positionClasses as re, sizeClasses as We, getUnderlinedTriggerClasses as He, getEnclosedTriggerClasses as Ve, getEnclosedFillTriggerClasses as Be } from "./classes.js";
|
|
9
|
+
const oe = "ds:transition-[left,width,top,height] ds:duration-300 ds:ease-out motion-reduce:ds:transition-none", Me = u.forwardRef((de, ne) => {
|
|
11
10
|
const {
|
|
12
11
|
items: c,
|
|
13
12
|
defaultActiveKey: D,
|
|
14
|
-
activeKey:
|
|
13
|
+
activeKey: A,
|
|
15
14
|
onChange: le,
|
|
16
15
|
tabPosition: p = "top",
|
|
17
16
|
size: ie = "md",
|
|
18
|
-
alignment:
|
|
19
|
-
fullWidth:
|
|
17
|
+
alignment: _ = "start",
|
|
18
|
+
fullWidth: P = !1,
|
|
20
19
|
overflowMode: n = "scroll",
|
|
21
20
|
variant: e = "solid",
|
|
22
21
|
color: o = "muted",
|
|
@@ -29,14 +28,14 @@ const Me = u.forwardRef((de, ne) => {
|
|
|
29
28
|
width: 0,
|
|
30
29
|
top: 0,
|
|
31
30
|
height: 0
|
|
32
|
-
}), [he,
|
|
31
|
+
}), [he, be] = u.useState(A || D || c[0]?.key), [y, G] = u.useState(!1), [U, ge] = u.useState(c.length), [I, W] = u.useState(!1), [pe, $] = u.useState(!1), [me, J] = u.useState(!1), C = A !== void 0 ? A : he, t = p === "left" || p === "right";
|
|
33
32
|
u.useLayoutEffect(() => {
|
|
34
33
|
if (!n || n === "dropdown") return;
|
|
35
34
|
const s = () => {
|
|
36
|
-
const d = R.current,
|
|
37
|
-
if (!d || !
|
|
38
|
-
const m = t ? d.clientHeight : d.clientWidth,
|
|
39
|
-
G(
|
|
35
|
+
const d = R.current, b = E.current;
|
|
36
|
+
if (!d || !b) return;
|
|
37
|
+
const m = t ? d.clientHeight : d.clientWidth, N = (t ? b.scrollHeight : b.scrollWidth) > m;
|
|
38
|
+
G(N);
|
|
40
39
|
};
|
|
41
40
|
s();
|
|
42
41
|
const r = new ResizeObserver(s);
|
|
@@ -48,21 +47,21 @@ const Me = u.forwardRef((de, ne) => {
|
|
|
48
47
|
const s = () => {
|
|
49
48
|
const d = R.current;
|
|
50
49
|
if (!d) return;
|
|
51
|
-
const
|
|
50
|
+
const b = t ? d.clientHeight : d.clientWidth;
|
|
52
51
|
let m = 0;
|
|
53
|
-
const k = 48,
|
|
52
|
+
const k = 48, N = 6, f = e === "enclosed-fill" || e === "bordered" || e === "pills" || e === "pill-stroke" || e === "text" || e === "outline" ? 4 : 0;
|
|
54
53
|
let i = 0;
|
|
55
54
|
for (let h = 0; h < z.current.length; h++) {
|
|
56
55
|
const T = z.current[h];
|
|
57
56
|
if (!T) break;
|
|
58
|
-
const
|
|
59
|
-
if (m +
|
|
60
|
-
m +=
|
|
57
|
+
const S = t ? T.offsetHeight : T.offsetWidth, w = h > 0 ? f : 0, O = h < z.current.length - 1;
|
|
58
|
+
if (m + S + w + (O ? k : 0) + N <= b)
|
|
59
|
+
m += S + w, i++;
|
|
61
60
|
else
|
|
62
61
|
break;
|
|
63
62
|
}
|
|
64
|
-
const
|
|
65
|
-
G(
|
|
63
|
+
const g = i < c.length;
|
|
64
|
+
G(g), ge(Math.max(1, i));
|
|
66
65
|
};
|
|
67
66
|
s();
|
|
68
67
|
const r = new ResizeObserver(s);
|
|
@@ -72,22 +71,22 @@ const Me = u.forwardRef((de, ne) => {
|
|
|
72
71
|
r.disconnect();
|
|
73
72
|
};
|
|
74
73
|
}, [c, n, t, e]), u.useLayoutEffect(() => {
|
|
75
|
-
const s = c.findIndex((
|
|
74
|
+
const s = c.findIndex((b) => b.key === C), r = z.current[s], d = E.current;
|
|
76
75
|
if (r && d) {
|
|
77
|
-
const
|
|
76
|
+
const b = d.getBoundingClientRect(), m = r.getBoundingClientRect(), k = m.left - b.left, N = m.top - b.top;
|
|
78
77
|
if (Y({
|
|
79
78
|
left: k,
|
|
80
79
|
width: m.width,
|
|
81
|
-
top:
|
|
80
|
+
top: N,
|
|
82
81
|
height: m.height
|
|
83
82
|
}), n === "fade" && L.current) {
|
|
84
83
|
const f = L.current.querySelector(
|
|
85
84
|
"[data-radix-scroll-area-viewport]"
|
|
86
85
|
);
|
|
87
86
|
if (f) {
|
|
88
|
-
const i = f.getBoundingClientRect(),
|
|
87
|
+
const i = f.getBoundingClientRect(), g = r.getBoundingClientRect(), h = 96;
|
|
89
88
|
if (t) {
|
|
90
|
-
const T = f.scrollTop,
|
|
89
|
+
const T = f.scrollTop, S = f.scrollHeight, w = i.height, O = g.top - i.top + T, V = g.height;
|
|
91
90
|
if (s === 0)
|
|
92
91
|
f.scrollTo({
|
|
93
92
|
top: 0,
|
|
@@ -95,11 +94,11 @@ const Me = u.forwardRef((de, ne) => {
|
|
|
95
94
|
});
|
|
96
95
|
else if (s === c.length - 1)
|
|
97
96
|
f.scrollTo({
|
|
98
|
-
top:
|
|
97
|
+
top: S - w,
|
|
99
98
|
behavior: "smooth"
|
|
100
99
|
});
|
|
101
100
|
else {
|
|
102
|
-
const F = O - w / 2 +
|
|
101
|
+
const F = O - w / 2 + V / 2, q = S - w, j = Math.max(
|
|
103
102
|
h / 2,
|
|
104
103
|
Math.min(F, q - h / 2)
|
|
105
104
|
);
|
|
@@ -109,7 +108,7 @@ const Me = u.forwardRef((de, ne) => {
|
|
|
109
108
|
});
|
|
110
109
|
}
|
|
111
110
|
} else {
|
|
112
|
-
const T = f.scrollLeft,
|
|
111
|
+
const T = f.scrollLeft, S = f.scrollWidth, w = i.width, O = g.left - i.left + T, V = g.width;
|
|
113
112
|
if (s === 0)
|
|
114
113
|
f.scrollTo({
|
|
115
114
|
left: 0,
|
|
@@ -117,11 +116,11 @@ const Me = u.forwardRef((de, ne) => {
|
|
|
117
116
|
});
|
|
118
117
|
else if (s === c.length - 1)
|
|
119
118
|
f.scrollTo({
|
|
120
|
-
left:
|
|
119
|
+
left: S - w,
|
|
121
120
|
behavior: "smooth"
|
|
122
121
|
});
|
|
123
122
|
else {
|
|
124
|
-
const F = O - w / 2 +
|
|
123
|
+
const F = O - w / 2 + V / 2, q = S - w, j = Math.max(
|
|
125
124
|
h / 2,
|
|
126
125
|
Math.min(F, q - h / 2)
|
|
127
126
|
);
|
|
@@ -144,22 +143,22 @@ const Me = u.forwardRef((de, ne) => {
|
|
|
144
143
|
const d = () => {
|
|
145
144
|
r !== null && cancelAnimationFrame(r), r = requestAnimationFrame(() => {
|
|
146
145
|
if (t) {
|
|
147
|
-
const i = s.scrollTop,
|
|
148
|
-
$(i > 5), J(i <
|
|
146
|
+
const i = s.scrollTop, g = s.scrollHeight, h = s.clientHeight;
|
|
147
|
+
$(i > 5), J(i < g - h - 5);
|
|
149
148
|
} else {
|
|
150
|
-
const i = s.scrollLeft,
|
|
151
|
-
$(i > 5), J(i <
|
|
149
|
+
const i = s.scrollLeft, g = s.scrollWidth, h = s.clientWidth;
|
|
150
|
+
$(i > 5), J(i < g - h - 5);
|
|
152
151
|
}
|
|
153
152
|
const k = c.findIndex(
|
|
154
153
|
(i) => i.key === C
|
|
155
|
-
),
|
|
156
|
-
if (
|
|
157
|
-
const i = f.getBoundingClientRect(),
|
|
154
|
+
), N = z.current[k], f = E.current;
|
|
155
|
+
if (N && f) {
|
|
156
|
+
const i = f.getBoundingClientRect(), g = N.getBoundingClientRect(), h = g.left - i.left, T = g.top - i.top;
|
|
158
157
|
Y({
|
|
159
158
|
left: h,
|
|
160
|
-
width:
|
|
159
|
+
width: g.width,
|
|
161
160
|
top: T,
|
|
162
|
-
height:
|
|
161
|
+
height: g.height
|
|
163
162
|
});
|
|
164
163
|
}
|
|
165
164
|
r = null;
|
|
@@ -168,9 +167,9 @@ const Me = u.forwardRef((de, ne) => {
|
|
|
168
167
|
d(), s.addEventListener("scroll", d, {
|
|
169
168
|
passive: !0
|
|
170
169
|
});
|
|
171
|
-
const
|
|
172
|
-
return
|
|
173
|
-
r !== null && cancelAnimationFrame(r), s.removeEventListener("scroll", d),
|
|
170
|
+
const b = new ResizeObserver(d);
|
|
171
|
+
return b.observe(s), () => {
|
|
172
|
+
r !== null && cancelAnimationFrame(r), s.removeEventListener("scroll", d), b.disconnect();
|
|
174
173
|
};
|
|
175
174
|
}, [n, t, y, c, C]), u.useEffect(() => {
|
|
176
175
|
if (n !== "scroll" && n !== "fade" || t) return;
|
|
@@ -185,13 +184,13 @@ const Me = u.forwardRef((de, ne) => {
|
|
|
185
184
|
s.removeEventListener("wheel", r);
|
|
186
185
|
};
|
|
187
186
|
}, [n, t]);
|
|
188
|
-
const
|
|
189
|
-
|
|
187
|
+
const B = (s) => {
|
|
188
|
+
A === void 0 && be(s), le?.(s);
|
|
190
189
|
}, ve = t ? "vertical" : "horizontal", Q = Oe[e], we = Q.list[t ? "vertical" : "horizontal"];
|
|
191
|
-
let
|
|
192
|
-
e === "underlined" ?
|
|
193
|
-
const xe =
|
|
194
|
-
const m = r +
|
|
190
|
+
let H = Q.trigger[t ? "vertical" : "horizontal"];
|
|
191
|
+
e === "underlined" ? H = He(p) : e === "enclosed" ? H = Ve(p) : e === "enclosed-fill" && (H = Be(p));
|
|
192
|
+
const xe = Ae(e, o), ye = Ie(e, o, p), Te = n === "dropdown" && y ? c.slice(0, U) : c, M = n === "dropdown" && y ? c.slice(U) : n === "fade" && y ? c : [], Ce = n === "dropdown" && y && M.length > 0, X = n === "dropdown" && y && M.some((s) => s.key === C), ke = (s, r = 0) => /* @__PURE__ */ l(Se, { children: s.map((d, b) => {
|
|
193
|
+
const m = r + b;
|
|
195
194
|
return /* @__PURE__ */ x(
|
|
196
195
|
Ee,
|
|
197
196
|
{
|
|
@@ -201,7 +200,7 @@ const Me = u.forwardRef((de, ne) => {
|
|
|
201
200
|
value: d.key,
|
|
202
201
|
disabled: d.disabled,
|
|
203
202
|
className: a(
|
|
204
|
-
|
|
203
|
+
H,
|
|
205
204
|
// Apply styles based on variant
|
|
206
205
|
{
|
|
207
206
|
// For sliding indicator variants, remove default background
|
|
@@ -213,7 +212,7 @@ const Me = u.forwardRef((de, ne) => {
|
|
|
213
212
|
"ds:data-[state=active]:text-accent-foreground": (e === "bordered" || e === "pills") && o === "accent",
|
|
214
213
|
"ds:data-[state=active]:text-destructive-foreground": (e === "bordered" || e === "pills") && o === "destructive",
|
|
215
214
|
"ds:data-[state=active]:text-white": (e === "bordered" || e === "pills") && (o === "success" || o === "warning"),
|
|
216
|
-
"ds:flex-1":
|
|
215
|
+
"ds:flex-1": P && !t,
|
|
217
216
|
"ds:w-full ds:justify-start": t
|
|
218
217
|
},
|
|
219
218
|
// For other variants, apply normal color classes
|
|
@@ -228,14 +227,14 @@ const Me = u.forwardRef((de, ne) => {
|
|
|
228
227
|
},
|
|
229
228
|
d.key
|
|
230
229
|
);
|
|
231
|
-
}) }),
|
|
230
|
+
}) }), Ne = () => {
|
|
232
231
|
const s = /* @__PURE__ */ x(
|
|
233
232
|
Le,
|
|
234
233
|
{
|
|
235
234
|
ref: E,
|
|
236
235
|
className: a(
|
|
237
|
-
|
|
238
|
-
|
|
236
|
+
re[p].list,
|
|
237
|
+
We[ie][t ? "vertical" : "horizontal"],
|
|
239
238
|
we,
|
|
240
239
|
ye,
|
|
241
240
|
ce,
|
|
@@ -251,9 +250,9 @@ const Me = u.forwardRef((de, ne) => {
|
|
|
251
250
|
children: [
|
|
252
251
|
ke(Te),
|
|
253
252
|
e === "underlined" && v.width > 0 && !X && /* @__PURE__ */ l(
|
|
254
|
-
|
|
253
|
+
"div",
|
|
255
254
|
{
|
|
256
|
-
className: a("ds:absolute ds:rounded-full ds:z-10", {
|
|
255
|
+
className: a(oe, "ds:absolute ds:rounded-full ds:z-10", {
|
|
257
256
|
// Horizontal positions (top/bottom)
|
|
258
257
|
"ds:h-0.5 ds:bottom-0": p === "top",
|
|
259
258
|
"ds:h-0.5 ds:top-0": p === "bottom",
|
|
@@ -269,24 +268,19 @@ const Me = u.forwardRef((de, ne) => {
|
|
|
269
268
|
"ds:bg-success": o === "success",
|
|
270
269
|
"ds:bg-warning": o === "warning"
|
|
271
270
|
}),
|
|
272
|
-
|
|
271
|
+
style: t ? {
|
|
273
272
|
top: v.top,
|
|
274
273
|
height: v.height
|
|
275
274
|
} : {
|
|
276
275
|
left: v.left,
|
|
277
276
|
width: v.width
|
|
278
|
-
},
|
|
279
|
-
transition: {
|
|
280
|
-
type: "spring",
|
|
281
|
-
stiffness: 300,
|
|
282
|
-
damping: 30
|
|
283
277
|
}
|
|
284
278
|
}
|
|
285
279
|
),
|
|
286
280
|
(e === "solid" || e === "bordered" || e === "pills" || e === "pill-stroke") && v.width > 0 && !X && /* @__PURE__ */ l(
|
|
287
|
-
|
|
281
|
+
"div",
|
|
288
282
|
{
|
|
289
|
-
className: a("ds:absolute ds:rounded-md ds:pointer-events-none ds:z-0", {
|
|
283
|
+
className: a(oe, "ds:absolute ds:rounded-md ds:pointer-events-none ds:z-0", {
|
|
290
284
|
"ds:bg-background ds:shadow-sm": e === "solid",
|
|
291
285
|
"ds:bg-primary": (e === "bordered" || e === "pills") && o === "primary",
|
|
292
286
|
"ds:bg-secondary": (e === "bordered" || e === "pills") && o === "secondary",
|
|
@@ -303,16 +297,11 @@ const Me = u.forwardRef((de, ne) => {
|
|
|
303
297
|
"ds:border ds:rounded-full ds:border-success": e === "pill-stroke" && o === "success",
|
|
304
298
|
"ds:border ds:rounded-full ds:border-warning": e === "pill-stroke" && o === "warning"
|
|
305
299
|
}),
|
|
306
|
-
|
|
300
|
+
style: {
|
|
307
301
|
left: v.left,
|
|
308
302
|
width: v.width,
|
|
309
303
|
top: v.top,
|
|
310
304
|
height: v.height
|
|
311
|
-
},
|
|
312
|
-
transition: {
|
|
313
|
-
type: "spring",
|
|
314
|
-
stiffness: 300,
|
|
315
|
-
damping: 30
|
|
316
305
|
}
|
|
317
306
|
}
|
|
318
307
|
)
|
|
@@ -330,7 +319,7 @@ const Me = u.forwardRef((de, ne) => {
|
|
|
330
319
|
}),
|
|
331
320
|
children: [
|
|
332
321
|
s,
|
|
333
|
-
/* @__PURE__ */ l(
|
|
322
|
+
/* @__PURE__ */ l(Z, { orientation: t ? "vertical" : "horizontal" })
|
|
334
323
|
]
|
|
335
324
|
}
|
|
336
325
|
) : n === "dropdown" && Ce ? /* @__PURE__ */ x(
|
|
@@ -342,10 +331,10 @@ const Me = u.forwardRef((de, ne) => {
|
|
|
342
331
|
children: [
|
|
343
332
|
s,
|
|
344
333
|
/* @__PURE__ */ l(
|
|
345
|
-
|
|
334
|
+
ee,
|
|
346
335
|
{
|
|
347
|
-
open:
|
|
348
|
-
onOpenChange:
|
|
336
|
+
open: I,
|
|
337
|
+
onOpenChange: W,
|
|
349
338
|
trigger: /* @__PURE__ */ l(
|
|
350
339
|
"button",
|
|
351
340
|
{
|
|
@@ -356,18 +345,18 @@ const Me = u.forwardRef((de, ne) => {
|
|
|
356
345
|
"ds:hover:bg-accent ds:hover:text-accent-foreground",
|
|
357
346
|
"ds:h-9 ds:px-3 ds:shrink-0",
|
|
358
347
|
{
|
|
359
|
-
"ds:bg-accent ds:text-accent-foreground":
|
|
348
|
+
"ds:bg-accent ds:text-accent-foreground": I
|
|
360
349
|
}
|
|
361
350
|
),
|
|
362
351
|
"aria-label": "More tabs",
|
|
363
|
-
children: /* @__PURE__ */ l(
|
|
352
|
+
children: /* @__PURE__ */ l(se, { className: "ds:h-4 ds:w-4" })
|
|
364
353
|
}
|
|
365
354
|
),
|
|
366
355
|
content: /* @__PURE__ */ l("div", { className: a("ds:flex ds:flex-col ds:gap-1 ds:p-1"), children: M.map((r) => /* @__PURE__ */ x(
|
|
367
356
|
"button",
|
|
368
357
|
{
|
|
369
358
|
onClick: () => {
|
|
370
|
-
|
|
359
|
+
B(r.key), W(!1);
|
|
371
360
|
},
|
|
372
361
|
disabled: r.disabled,
|
|
373
362
|
className: a(
|
|
@@ -420,7 +409,7 @@ const Me = u.forwardRef((de, ne) => {
|
|
|
420
409
|
}),
|
|
421
410
|
children: [
|
|
422
411
|
s,
|
|
423
|
-
/* @__PURE__ */ l(
|
|
412
|
+
/* @__PURE__ */ l(Z, { orientation: t ? "vertical" : "horizontal" })
|
|
424
413
|
]
|
|
425
414
|
}
|
|
426
415
|
),
|
|
@@ -446,10 +435,10 @@ const Me = u.forwardRef((de, ne) => {
|
|
|
446
435
|
}
|
|
447
436
|
),
|
|
448
437
|
/* @__PURE__ */ l(
|
|
449
|
-
|
|
438
|
+
ee,
|
|
450
439
|
{
|
|
451
|
-
open:
|
|
452
|
-
onOpenChange:
|
|
440
|
+
open: I,
|
|
441
|
+
onOpenChange: W,
|
|
453
442
|
trigger: /* @__PURE__ */ l(
|
|
454
443
|
"button",
|
|
455
444
|
{
|
|
@@ -460,11 +449,11 @@ const Me = u.forwardRef((de, ne) => {
|
|
|
460
449
|
"ds:hover:bg-accent ds:hover:text-accent-foreground",
|
|
461
450
|
"ds:h-9 ds:px-3 ds:shrink-0",
|
|
462
451
|
{
|
|
463
|
-
"ds:bg-accent ds:text-accent-foreground":
|
|
452
|
+
"ds:bg-accent ds:text-accent-foreground": I
|
|
464
453
|
}
|
|
465
454
|
),
|
|
466
455
|
"aria-label": "More tabs",
|
|
467
|
-
children: /* @__PURE__ */ l(
|
|
456
|
+
children: /* @__PURE__ */ l(se, { className: "ds:h-4 ds:w-4" })
|
|
468
457
|
}
|
|
469
458
|
),
|
|
470
459
|
content: (
|
|
@@ -478,7 +467,7 @@ const Me = u.forwardRef((de, ne) => {
|
|
|
478
467
|
"button",
|
|
479
468
|
{
|
|
480
469
|
onClick: () => {
|
|
481
|
-
|
|
470
|
+
B(r.key), W(!1);
|
|
482
471
|
},
|
|
483
472
|
disabled: r.disabled,
|
|
484
473
|
className: a(
|
|
@@ -516,21 +505,21 @@ const Me = u.forwardRef((de, ne) => {
|
|
|
516
505
|
ref: ne,
|
|
517
506
|
defaultValue: D,
|
|
518
507
|
value: C,
|
|
519
|
-
onValueChange:
|
|
508
|
+
onValueChange: B,
|
|
520
509
|
orientation: ve,
|
|
521
|
-
className: a("ds:gap-2",
|
|
510
|
+
className: a("ds:gap-2", re[p].root, ae),
|
|
522
511
|
children: [
|
|
523
512
|
/* @__PURE__ */ l(
|
|
524
513
|
"div",
|
|
525
514
|
{
|
|
526
515
|
ref: R,
|
|
527
516
|
className: a("ds:flex", {
|
|
528
|
-
[
|
|
529
|
-
[
|
|
530
|
-
"ds:w-full": (
|
|
517
|
+
[te[_].horizontal]: !t,
|
|
518
|
+
[te[_].vertical]: t,
|
|
519
|
+
"ds:w-full": (P || n === "dropdown" || n === "fade") && !t,
|
|
531
520
|
"ds:overflow-hidden": n === "dropdown" || n === "fade"
|
|
532
521
|
}),
|
|
533
|
-
children:
|
|
522
|
+
children: Ne()
|
|
534
523
|
}
|
|
535
524
|
),
|
|
536
525
|
c.map((s) => /* @__PURE__ */ l(
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsxs as x, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as y from "react";
|
|
3
|
+
import { useMotionValue as N, useSpring as i, useTransform as n, motion as l } from "motion/react";
|
|
4
|
+
import { cn as t } from "../../packages/ui/src/lib/utils.js";
|
|
5
|
+
const d = { stiffness: 100, damping: 5 };
|
|
6
|
+
function S({
|
|
7
|
+
content: r,
|
|
8
|
+
children: a,
|
|
9
|
+
className: c,
|
|
10
|
+
childClassName: f,
|
|
11
|
+
tooltipColor: m
|
|
12
|
+
}) {
|
|
13
|
+
const s = N(0), p = i(n(s, [-100, 100], [-45, 45]), d), u = i(n(s, [-100, 100], [-50, 50]), d), v = y.useCallback(
|
|
14
|
+
(o) => {
|
|
15
|
+
const h = o.target.offsetWidth / 2;
|
|
16
|
+
s.set(o.nativeEvent.offsetX - h);
|
|
17
|
+
},
|
|
18
|
+
[s]
|
|
19
|
+
);
|
|
20
|
+
return /* @__PURE__ */ x(
|
|
21
|
+
l.div,
|
|
22
|
+
{
|
|
23
|
+
className: t("ds:relative ds:-me-2.5 ds:inline-block", c),
|
|
24
|
+
whileHover: "hover",
|
|
25
|
+
initial: "initial",
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ e(
|
|
28
|
+
l.div,
|
|
29
|
+
{
|
|
30
|
+
variants: {
|
|
31
|
+
initial: { opacity: 0, y: 20, scale: 0 },
|
|
32
|
+
hover: {
|
|
33
|
+
opacity: 1,
|
|
34
|
+
y: -5,
|
|
35
|
+
scale: 1,
|
|
36
|
+
transition: {
|
|
37
|
+
type: "tween",
|
|
38
|
+
duration: 0.2,
|
|
39
|
+
ease: "easeOut"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
style: {
|
|
44
|
+
translateX: u,
|
|
45
|
+
rotate: p,
|
|
46
|
+
whiteSpace: "nowrap"
|
|
47
|
+
},
|
|
48
|
+
className: t(
|
|
49
|
+
"ds:absolute ds:-top-2 ds:left-1/2 ds:z-50 ds:flex ds:-translate-x-1/2 ds:-translate-y-full ds:flex-col ds:items-center ds:justify-center ds:rounded-md ds:px-4 ds:py-2 ds:text-xs ds:shadow-xl",
|
|
50
|
+
m
|
|
51
|
+
),
|
|
52
|
+
children: /* @__PURE__ */ e("div", { className: "ds:relative ds:z-1", children: r })
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
a ? /* @__PURE__ */ e(
|
|
56
|
+
"span",
|
|
57
|
+
{
|
|
58
|
+
onMouseMove: v,
|
|
59
|
+
className: t("ds:inline-block", f),
|
|
60
|
+
children: a
|
|
61
|
+
}
|
|
62
|
+
) : null
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
S as default
|
|
69
|
+
};
|
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import { jsx as s,
|
|
2
|
-
import * as
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { TooltipProvider as
|
|
5
|
-
import { cn as
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
content: i,
|
|
1
|
+
import { jsx as s, jsxs as b } from "react/jsx-runtime";
|
|
2
|
+
import * as a from "react";
|
|
3
|
+
import { useMemo as g } from "react";
|
|
4
|
+
import { TooltipProvider as v, Tooltip as x, TooltipTrigger as w, TooltipContent as h } from "../../packages/ui/src/components/tooltip.js";
|
|
5
|
+
import { cn as o } from "../../packages/ui/src/lib/utils.js";
|
|
6
|
+
import { animationClass as y } from "../../utils/animations.js";
|
|
7
|
+
const k = a.lazy(() => import("./SpecTooltip.js")), A = a.memo(function({
|
|
8
|
+
content: n,
|
|
10
9
|
children: r,
|
|
11
|
-
sideOffset:
|
|
12
|
-
delayDuration:
|
|
13
|
-
className:
|
|
14
|
-
childClassName:
|
|
15
|
-
position:
|
|
16
|
-
noArrow:
|
|
17
|
-
animation:
|
|
18
|
-
...
|
|
10
|
+
sideOffset: c = 4,
|
|
11
|
+
delayDuration: p = 0,
|
|
12
|
+
className: e,
|
|
13
|
+
childClassName: i,
|
|
14
|
+
position: u = "top",
|
|
15
|
+
noArrow: f = !1,
|
|
16
|
+
animation: t,
|
|
17
|
+
...d
|
|
19
18
|
}) {
|
|
20
|
-
const
|
|
21
|
-
switch (
|
|
19
|
+
const m = g(() => y(t, e), [t, e]), l = g(() => {
|
|
20
|
+
switch (d.color) {
|
|
22
21
|
case "primary":
|
|
23
22
|
return "ds:bg-primary ds:text-primary-foreground ds:[&>span>svg]:bg-primary ds:[&>span>svg]:fill-primary";
|
|
24
23
|
case "secondary":
|
|
@@ -40,80 +39,38 @@ const B = u.memo(function({
|
|
|
40
39
|
default:
|
|
41
40
|
return "ds:bg-foreground ds:text-background ds:animate-in ds:fade-in-0 ds:zoom-in-95 ds:data-[state=closed]:animate-out ds:data-[state=closed]:fade-out-0 ds:data-[state=closed]:zoom-out-95 ds:data-[side=bottom]:slide-in-from-top-2 ds:data-[side=left]:slide-in-from-right-2 ds:data-[side=right]:slide-in-from-left-2 ds:data-[side=top]:slide-in-from-bottom-2 ds:z-50 ds:w-fit ds:origin-(--radix-tooltip-content-transform-origin) ds:rounded-md ds:px-3 ds:py-1.5 ds:text-xs ds:text-balance";
|
|
42
41
|
}
|
|
43
|
-
}, [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
), C = f(
|
|
47
|
-
m(e, [-100, 100], [-50, 50]),
|
|
48
|
-
n
|
|
49
|
-
), M = j(
|
|
50
|
-
(c) => {
|
|
51
|
-
const N = c.target.offsetWidth / 2;
|
|
52
|
-
e.set(c.nativeEvent.offsetX - N);
|
|
53
|
-
},
|
|
54
|
-
[e]
|
|
55
|
-
), z = u.memo(() => r ? /* @__PURE__ */ s(
|
|
56
|
-
"span",
|
|
42
|
+
}, [d?.color]);
|
|
43
|
+
return t === "spec" ? /* @__PURE__ */ s(
|
|
44
|
+
a.Suspense,
|
|
57
45
|
{
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
46
|
+
fallback: /* @__PURE__ */ s("div", { className: o("ds:relative ds:-me-2.5 ds:inline-block", e), children: r ? /* @__PURE__ */ s("span", { className: o("ds:inline-block", i), children: r }) : null }),
|
|
47
|
+
children: /* @__PURE__ */ s(
|
|
48
|
+
k,
|
|
49
|
+
{
|
|
50
|
+
content: n,
|
|
51
|
+
className: e,
|
|
52
|
+
childClassName: i,
|
|
53
|
+
tooltipColor: l,
|
|
54
|
+
children: r
|
|
55
|
+
}
|
|
56
|
+
)
|
|
61
57
|
}
|
|
62
|
-
) : /* @__PURE__ */ s(
|
|
63
|
-
|
|
64
|
-
v.div,
|
|
65
|
-
{
|
|
66
|
-
className: t("ds:relative ds:-me-2.5 ds:inline-block", d),
|
|
67
|
-
whileHover: "hover",
|
|
68
|
-
initial: "initial",
|
|
69
|
-
children: [
|
|
70
|
-
/* @__PURE__ */ s(
|
|
71
|
-
v.div,
|
|
72
|
-
{
|
|
73
|
-
variants: {
|
|
74
|
-
initial: { opacity: 0, y: 20, scale: 0 },
|
|
75
|
-
hover: {
|
|
76
|
-
opacity: 1,
|
|
77
|
-
y: -5,
|
|
78
|
-
scale: 1,
|
|
79
|
-
transition: {
|
|
80
|
-
type: "tween",
|
|
81
|
-
duration: 0.2,
|
|
82
|
-
ease: "easeOut"
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
style: {
|
|
87
|
-
translateX: C,
|
|
88
|
-
rotate: T,
|
|
89
|
-
whiteSpace: "nowrap"
|
|
90
|
-
},
|
|
91
|
-
className: t(
|
|
92
|
-
"ds:absolute ds:-top-2 ds:left-1/2 ds:z-50 ds:flex ds:-translate-x-1/2 ds:-translate-y-full ds:flex-col ds:items-center ds:justify-center ds:rounded-md ds:px-4 ds:py-2 ds:text-xs ds:shadow-xl",
|
|
93
|
-
l
|
|
94
|
-
),
|
|
95
|
-
children: /* @__PURE__ */ s("div", { className: "ds:relative ds:z-1", children: i })
|
|
96
|
-
}
|
|
97
|
-
),
|
|
98
|
-
/* @__PURE__ */ s(z, {})
|
|
99
|
-
]
|
|
100
|
-
}
|
|
101
|
-
) : /* @__PURE__ */ s(S, { delayDuration: h, children: /* @__PURE__ */ g(W, { children: [
|
|
102
|
-
/* @__PURE__ */ s(X, { asChild: !0, children: r }),
|
|
58
|
+
) : /* @__PURE__ */ s(v, { delayDuration: p, children: /* @__PURE__ */ b(x, { children: [
|
|
59
|
+
/* @__PURE__ */ s(w, { asChild: !0, children: r }),
|
|
103
60
|
/* @__PURE__ */ s(
|
|
104
|
-
|
|
61
|
+
h,
|
|
105
62
|
{
|
|
106
|
-
...
|
|
107
|
-
side:
|
|
108
|
-
sideOffset:
|
|
109
|
-
className:
|
|
110
|
-
"ds:[&>span>svg]:invisible":
|
|
63
|
+
...d,
|
|
64
|
+
side: u,
|
|
65
|
+
sideOffset: c,
|
|
66
|
+
className: o(m?.className, l, {
|
|
67
|
+
"ds:[&>span>svg]:invisible": f
|
|
111
68
|
}),
|
|
112
|
-
children:
|
|
69
|
+
children: n
|
|
113
70
|
}
|
|
114
71
|
)
|
|
115
72
|
] }) });
|
|
116
73
|
});
|
|
117
74
|
export {
|
|
118
|
-
|
|
75
|
+
A as Tooltip
|
|
119
76
|
};
|