@sth87/shadcn-design-system 0.2.11 → 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/Table/data-table.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/data-table.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/Table/data-table.js +51 -47
- 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/data-table.js +6 -0
- 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/Table/data-table.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/data-table.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,13 +1,13 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as f, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { flexRender as C } from "@tanstack/react-table";
|
|
3
3
|
import { Fragment as k } from "react";
|
|
4
4
|
import { DataTablePagination as F } from "./data-table-pagination.js";
|
|
5
|
-
import { cn as
|
|
6
|
-
import { Table as B, TableHeader as L, TableRow as
|
|
5
|
+
import { cn as n } from "../../packages/ui/src/lib/utils.js";
|
|
6
|
+
import { Table as B, TableHeader as L, TableRow as c, TableHead as O, TableBody as V, TableCell as b, TableFooter as q } from "../../packages/ui/src/components/table.js";
|
|
7
7
|
import { getCommonPinningStyles as T } from "../../utils/data-table.js";
|
|
8
|
-
import { DataTableColumnHeader as
|
|
9
|
-
function
|
|
10
|
-
table:
|
|
8
|
+
import { DataTableColumnHeader as W } from "./data-table-column-header.js";
|
|
9
|
+
function U({
|
|
10
|
+
table: d,
|
|
11
11
|
actionBar: g,
|
|
12
12
|
children: H,
|
|
13
13
|
className: R,
|
|
@@ -16,26 +16,26 @@ function W({
|
|
|
16
16
|
stickyFooter: D = !1,
|
|
17
17
|
bordered: P = !0,
|
|
18
18
|
loading: p,
|
|
19
|
-
loadingIndicator:
|
|
19
|
+
loadingIndicator: z,
|
|
20
20
|
footer: h,
|
|
21
|
-
emptyState:
|
|
22
|
-
onRowClick:
|
|
23
|
-
rowClassName:
|
|
21
|
+
emptyState: I,
|
|
22
|
+
onRowClick: m,
|
|
23
|
+
rowClassName: u,
|
|
24
24
|
renderRow: w,
|
|
25
25
|
renderCell: x,
|
|
26
26
|
classNames: l,
|
|
27
27
|
showTotalCount: N = !0,
|
|
28
|
-
totalCount:
|
|
28
|
+
totalCount: j,
|
|
29
29
|
...M
|
|
30
30
|
}) {
|
|
31
|
-
const
|
|
31
|
+
const i = s ? {
|
|
32
32
|
offsetHeader: typeof s == "object" ? s.offsetHeader ?? 0 : 0,
|
|
33
33
|
offsetScroll: typeof s == "object" ? s.offsetScroll : void 0
|
|
34
|
-
} : null, v =
|
|
35
|
-
return /* @__PURE__ */
|
|
34
|
+
} : null, v = d.getVisibleLeafColumns().length;
|
|
35
|
+
return /* @__PURE__ */ f(
|
|
36
36
|
"div",
|
|
37
37
|
{
|
|
38
|
-
className:
|
|
38
|
+
className: n(
|
|
39
39
|
"ds:flex ds:w-full ds:flex-col ds:gap-2.5 ds:relative",
|
|
40
40
|
R
|
|
41
41
|
),
|
|
@@ -45,18 +45,19 @@ function W({
|
|
|
45
45
|
p && /* @__PURE__ */ e(
|
|
46
46
|
"div",
|
|
47
47
|
{
|
|
48
|
-
className:
|
|
48
|
+
className: n(
|
|
49
49
|
"ds:absolute ds:inset-0 ds:bg-background/50 ds:flex ds:items-center ds:justify-center ds:z-20",
|
|
50
50
|
l?.loadingOverlay
|
|
51
51
|
),
|
|
52
|
-
children:
|
|
52
|
+
children: z ?? "Loading..."
|
|
53
53
|
}
|
|
54
54
|
),
|
|
55
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ f(
|
|
56
56
|
B,
|
|
57
57
|
{
|
|
58
|
-
className: l?.table,
|
|
59
|
-
|
|
58
|
+
className: n("ds:table-fixed", l?.table),
|
|
59
|
+
style: { minWidth: d.getTotalSize() },
|
|
60
|
+
containerClassName: n(
|
|
60
61
|
P && "ds:rounded-md ds:border ds:border-border",
|
|
61
62
|
// Thin, unobtrusive scrollbar that darkens only when hovering the thumb itself
|
|
62
63
|
"ds:[scrollbar-width:thin] ds:[scrollbar-color:var(--border)_transparent]",
|
|
@@ -64,18 +65,20 @@ function W({
|
|
|
64
65
|
"ds:[&::-webkit-scrollbar-track]:bg-transparent",
|
|
65
66
|
"ds:[&::-webkit-scrollbar-thumb]:rounded-full ds:[&::-webkit-scrollbar-thumb]:bg-border",
|
|
66
67
|
"ds:[&::-webkit-scrollbar-thumb:hover]:bg-muted-foreground",
|
|
68
|
+
// Size container so the footer can use `cqw` units (see footer cell)
|
|
69
|
+
"ds:[container-type:inline-size]",
|
|
67
70
|
p && "ds:blur-sm",
|
|
68
71
|
l?.container
|
|
69
72
|
),
|
|
70
|
-
containerStyle:
|
|
71
|
-
maxHeight: `calc(100vh - ${
|
|
73
|
+
containerStyle: i ? {
|
|
74
|
+
maxHeight: `calc(100vh - ${i.offsetScroll ?? 0}px)`
|
|
72
75
|
} : void 0,
|
|
73
76
|
children: [
|
|
74
|
-
/* @__PURE__ */ e(L, { children:
|
|
77
|
+
/* @__PURE__ */ e(L, { children: d.getHeaderGroups().map((t) => /* @__PURE__ */ e(c, { className: l?.headerRow, children: t.headers.map((o) => /* @__PURE__ */ e(
|
|
75
78
|
O,
|
|
76
79
|
{
|
|
77
80
|
colSpan: o.colSpan,
|
|
78
|
-
className:
|
|
81
|
+
className: n(
|
|
79
82
|
l?.headerCell,
|
|
80
83
|
o.column.getIsPinned() && "ds:bg-background"
|
|
81
84
|
),
|
|
@@ -84,9 +87,9 @@ function W({
|
|
|
84
87
|
column: o.column,
|
|
85
88
|
withBorder: !0
|
|
86
89
|
}),
|
|
87
|
-
...
|
|
90
|
+
...i && {
|
|
88
91
|
position: "sticky",
|
|
89
|
-
top:
|
|
92
|
+
top: i.offsetHeader,
|
|
90
93
|
zIndex: o.column.getIsPinned() ? 3 : 2,
|
|
91
94
|
background: "var(--background)"
|
|
92
95
|
}
|
|
@@ -94,26 +97,27 @@ function W({
|
|
|
94
97
|
children: o.isPlaceholder ? null : o.column.columnDef.header ? typeof o.column.columnDef.header == "function" ? C(
|
|
95
98
|
o.column.columnDef.header,
|
|
96
99
|
o.getContext()
|
|
97
|
-
) : /* @__PURE__ */ e(
|
|
100
|
+
) : /* @__PURE__ */ e(W, { column: o.column }) : null
|
|
98
101
|
},
|
|
99
102
|
o.id
|
|
100
103
|
)) }, t.id)) }),
|
|
101
|
-
/* @__PURE__ */ e(V, { className: l?.body, children:
|
|
102
|
-
const o = typeof
|
|
103
|
-
|
|
104
|
+
/* @__PURE__ */ e(V, { className: l?.body, children: d.getRowModel().rows?.length ? d.getRowModel().rows.map((t) => {
|
|
105
|
+
const o = typeof u == "function" ? u(t) : u, y = /* @__PURE__ */ e(
|
|
106
|
+
c,
|
|
104
107
|
{
|
|
105
108
|
"data-state": t.getIsSelected() && "selected",
|
|
106
|
-
className:
|
|
109
|
+
className: n(
|
|
107
110
|
l?.row,
|
|
108
111
|
o,
|
|
109
|
-
|
|
112
|
+
m && "ds:cursor-pointer"
|
|
110
113
|
),
|
|
111
|
-
onClick:
|
|
114
|
+
onClick: m ? (r) => m(t, r) : void 0,
|
|
112
115
|
children: t.getVisibleCells().map((r) => {
|
|
113
116
|
const S = /* @__PURE__ */ e(
|
|
114
|
-
|
|
117
|
+
b,
|
|
115
118
|
{
|
|
116
|
-
className:
|
|
119
|
+
className: n(
|
|
120
|
+
"ds:overflow-hidden ds:text-ellipsis",
|
|
117
121
|
l?.cell,
|
|
118
122
|
// Static background on purpose — see the comment on
|
|
119
123
|
// getCommonPinningStyles for why pinned cells must
|
|
@@ -139,16 +143,16 @@ function W({
|
|
|
139
143
|
t.id
|
|
140
144
|
);
|
|
141
145
|
return w ? /* @__PURE__ */ e(k, { children: w(t, y) }, t.id) : y;
|
|
142
|
-
}) : /* @__PURE__ */ e(
|
|
143
|
-
|
|
146
|
+
}) : /* @__PURE__ */ e(c, { className: l?.emptyRow, children: /* @__PURE__ */ e(
|
|
147
|
+
b,
|
|
144
148
|
{
|
|
145
149
|
colSpan: v,
|
|
146
|
-
className:
|
|
147
|
-
children:
|
|
150
|
+
className: n("ds:h-24 ds:text-center", l?.emptyCell),
|
|
151
|
+
children: I ?? "No results."
|
|
148
152
|
}
|
|
149
153
|
) }) }),
|
|
150
|
-
h && /* @__PURE__ */ e(
|
|
151
|
-
|
|
154
|
+
h && /* @__PURE__ */ e(q, { children: /* @__PURE__ */ e(c, { className: l?.footerRow, children: /* @__PURE__ */ e(
|
|
155
|
+
b,
|
|
152
156
|
{
|
|
153
157
|
colSpan: v,
|
|
154
158
|
className: l?.footerCell,
|
|
@@ -157,30 +161,30 @@ function W({
|
|
|
157
161
|
bottom: 0,
|
|
158
162
|
zIndex: 2
|
|
159
163
|
} : void 0,
|
|
160
|
-
children: h(
|
|
164
|
+
children: /* @__PURE__ */ e("div", { className: "ds:sticky ds:left-2 ds:w-[calc(100cqw-1rem)]", children: h(d.getRowModel().rows.map((t) => t.original)) })
|
|
161
165
|
}
|
|
162
166
|
) }) })
|
|
163
167
|
]
|
|
164
168
|
}
|
|
165
169
|
),
|
|
166
|
-
/* @__PURE__ */
|
|
170
|
+
/* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:gap-2.5", children: [
|
|
167
171
|
a && /* @__PURE__ */ e(
|
|
168
172
|
F,
|
|
169
173
|
{
|
|
170
174
|
showTotalCount: N,
|
|
171
|
-
totalCount:
|
|
175
|
+
totalCount: j,
|
|
172
176
|
showPageSizeOptions: !0,
|
|
173
177
|
showRowSelectionCount: !0,
|
|
174
|
-
table:
|
|
178
|
+
table: d,
|
|
175
179
|
...a === !0 ? {} : a
|
|
176
180
|
}
|
|
177
181
|
),
|
|
178
|
-
g &&
|
|
182
|
+
g && d.getFilteredSelectedRowModel().rows.length > 0 && g
|
|
179
183
|
] })
|
|
180
184
|
]
|
|
181
185
|
}
|
|
182
186
|
);
|
|
183
187
|
}
|
|
184
188
|
export {
|
|
185
|
-
|
|
189
|
+
U as DataTable
|
|
186
190
|
};
|
|
@@ -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(
|