@sth87/shadcn-design-system 0.2.5 → 0.2.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.
|
@@ -2,12 +2,12 @@ import { jsxs as b, 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
|
|
5
|
+
import { cn as d } from "../../packages/ui/src/lib/utils.js";
|
|
6
6
|
import { Table as B, TableHeader as L, TableRow as i, TableHead as O, TableBody as V, TableCell as f, TableFooter as _ } from "../../packages/ui/src/components/table.js";
|
|
7
7
|
import { getCommonPinningStyles as T } from "../../utils/data-table.js";
|
|
8
8
|
import { DataTableColumnHeader as $ } from "./data-table-column-header.js";
|
|
9
9
|
function W({
|
|
10
|
-
table:
|
|
10
|
+
table: n,
|
|
11
11
|
actionBar: g,
|
|
12
12
|
children: H,
|
|
13
13
|
className: R,
|
|
@@ -18,24 +18,24 @@ function W({
|
|
|
18
18
|
loading: p,
|
|
19
19
|
loadingIndicator: I,
|
|
20
20
|
footer: h,
|
|
21
|
-
emptyState:
|
|
22
|
-
onRowClick:
|
|
23
|
-
rowClassName:
|
|
21
|
+
emptyState: j,
|
|
22
|
+
onRowClick: u,
|
|
23
|
+
rowClassName: m,
|
|
24
24
|
renderRow: w,
|
|
25
25
|
renderCell: x,
|
|
26
26
|
classNames: l,
|
|
27
|
-
showTotalCount:
|
|
27
|
+
showTotalCount: N = !0,
|
|
28
28
|
totalCount: z,
|
|
29
29
|
...M
|
|
30
30
|
}) {
|
|
31
31
|
const c = s ? {
|
|
32
32
|
offsetHeader: typeof s == "object" ? s.offsetHeader ?? 0 : 0,
|
|
33
33
|
offsetScroll: typeof s == "object" ? s.offsetScroll : void 0
|
|
34
|
-
} : null, v =
|
|
34
|
+
} : null, v = n.getVisibleLeafColumns().length;
|
|
35
35
|
return /* @__PURE__ */ b(
|
|
36
36
|
"div",
|
|
37
37
|
{
|
|
38
|
-
className:
|
|
38
|
+
className: d(
|
|
39
39
|
"ds:flex ds:w-full ds:flex-col ds:gap-2.5 ds:relative",
|
|
40
40
|
R
|
|
41
41
|
),
|
|
@@ -45,7 +45,7 @@ function W({
|
|
|
45
45
|
p && /* @__PURE__ */ e(
|
|
46
46
|
"div",
|
|
47
47
|
{
|
|
48
|
-
className:
|
|
48
|
+
className: d(
|
|
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
|
),
|
|
@@ -56,7 +56,7 @@ function W({
|
|
|
56
56
|
B,
|
|
57
57
|
{
|
|
58
58
|
className: l?.table,
|
|
59
|
-
containerClassName:
|
|
59
|
+
containerClassName: d(
|
|
60
60
|
P && "ds:rounded-md ds:border ds:border-border",
|
|
61
61
|
// Thin, unobtrusive scrollbar that darkens only when hovering the thumb itself
|
|
62
62
|
"ds:[scrollbar-width:thin] ds:[scrollbar-color:var(--border)_transparent]",
|
|
@@ -71,11 +71,11 @@ function W({
|
|
|
71
71
|
maxHeight: `calc(100vh - ${c.offsetScroll ?? 0}px)`
|
|
72
72
|
} : void 0,
|
|
73
73
|
children: [
|
|
74
|
-
/* @__PURE__ */ e(L, { children:
|
|
74
|
+
/* @__PURE__ */ e(L, { children: n.getHeaderGroups().map((t) => /* @__PURE__ */ e(i, { className: l?.headerRow, children: t.headers.map((o) => /* @__PURE__ */ e(
|
|
75
75
|
O,
|
|
76
76
|
{
|
|
77
77
|
colSpan: o.colSpan,
|
|
78
|
-
className:
|
|
78
|
+
className: d(
|
|
79
79
|
l?.headerCell,
|
|
80
80
|
o.column.getIsPinned() && "ds:bg-background"
|
|
81
81
|
),
|
|
@@ -98,22 +98,22 @@ function W({
|
|
|
98
98
|
},
|
|
99
99
|
o.id
|
|
100
100
|
)) }, t.id)) }),
|
|
101
|
-
/* @__PURE__ */ e(V, { className: l?.body, children:
|
|
102
|
-
const o = typeof
|
|
101
|
+
/* @__PURE__ */ e(V, { className: l?.body, children: n.getRowModel().rows?.length ? n.getRowModel().rows.map((t) => {
|
|
102
|
+
const o = typeof m == "function" ? m(t) : m, y = /* @__PURE__ */ e(
|
|
103
103
|
i,
|
|
104
104
|
{
|
|
105
105
|
"data-state": t.getIsSelected() && "selected",
|
|
106
|
-
className:
|
|
106
|
+
className: d(
|
|
107
107
|
l?.row,
|
|
108
108
|
o,
|
|
109
|
-
|
|
109
|
+
u && "ds:cursor-pointer"
|
|
110
110
|
),
|
|
111
|
-
onClick:
|
|
111
|
+
onClick: u ? (r) => u(t, r) : void 0,
|
|
112
112
|
children: t.getVisibleCells().map((r) => {
|
|
113
113
|
const S = /* @__PURE__ */ e(
|
|
114
114
|
f,
|
|
115
115
|
{
|
|
116
|
-
className:
|
|
116
|
+
className: d(
|
|
117
117
|
l?.cell,
|
|
118
118
|
// Static background on purpose — see the comment on
|
|
119
119
|
// getCommonPinningStyles for why pinned cells must
|
|
@@ -143,8 +143,8 @@ function W({
|
|
|
143
143
|
f,
|
|
144
144
|
{
|
|
145
145
|
colSpan: v,
|
|
146
|
-
className:
|
|
147
|
-
children:
|
|
146
|
+
className: d("ds:h-24 ds:text-center", l?.emptyCell),
|
|
147
|
+
children: j ?? "No results."
|
|
148
148
|
}
|
|
149
149
|
) }) }),
|
|
150
150
|
h && /* @__PURE__ */ e(_, { children: /* @__PURE__ */ e(i, { className: l?.footerRow, children: /* @__PURE__ */ e(
|
|
@@ -157,7 +157,7 @@ function W({
|
|
|
157
157
|
bottom: 0,
|
|
158
158
|
zIndex: 2
|
|
159
159
|
} : void 0,
|
|
160
|
-
children: h(
|
|
160
|
+
children: h(n.getRowModel().rows.map((t) => t.original))
|
|
161
161
|
}
|
|
162
162
|
) }) })
|
|
163
163
|
]
|
|
@@ -167,16 +167,15 @@ function W({
|
|
|
167
167
|
a && /* @__PURE__ */ e(
|
|
168
168
|
F,
|
|
169
169
|
{
|
|
170
|
-
showTotalCount:
|
|
170
|
+
showTotalCount: N,
|
|
171
171
|
totalCount: z,
|
|
172
172
|
showPageSizeOptions: !0,
|
|
173
173
|
showRowSelectionCount: !0,
|
|
174
|
-
|
|
175
|
-
table: d,
|
|
174
|
+
table: n,
|
|
176
175
|
...a === !0 ? {} : a
|
|
177
176
|
}
|
|
178
177
|
),
|
|
179
|
-
g &&
|
|
178
|
+
g && n.getFilteredSelectedRowModel().rows.length > 0 && g
|
|
180
179
|
] })
|
|
181
180
|
]
|
|
182
181
|
}
|