@sth87/shadcn-design-system 0.2.1 → 0.2.3
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/AI_CONTEXT.md +2 -0
- package/dist/cjs/components/Select/Select.cjs +1 -1
- package/dist/cjs/components/Table/data-table-column-header.cjs +1 -1
- package/dist/cjs/components/Table/data-table.cjs +1 -1
- package/dist/cjs/packages/ui/src/components/combobox.cjs +1 -1
- package/dist/cjs/packages/ui/src/components/select.cjs +1 -1
- package/dist/cjs/packages/ui/src/components/table.cjs +1 -1
- package/dist/cjs/styles/index.css +1 -1
- package/dist/esm/components/Select/Select.js +86 -80
- package/dist/esm/components/Table/data-table-column-header.js +50 -25
- package/dist/esm/components/Table/data-table.js +77 -55
- package/dist/esm/packages/ui/src/components/combobox.js +52 -47
- package/dist/esm/packages/ui/src/components/select.js +121 -116
- package/dist/esm/packages/ui/src/components/table.js +23 -14
- package/dist/esm/styles/index.css +1 -1
- package/dist/types/components/Select/Select.d.ts +4 -0
- package/dist/types/components/Select/Select.d.ts.map +1 -1
- package/dist/types/components/Table/data-table-column-header.d.ts.map +1 -1
- package/dist/types/components/Table/data-table.d.ts +5 -0
- package/dist/types/components/Table/data-table.d.ts.map +1 -1
- package/dist/types/packages/ui/src/components/combobox.d.ts +3 -1
- package/dist/types/packages/ui/src/components/combobox.d.ts.map +1 -1
- package/dist/types/packages/ui/src/components/select.d.ts +3 -1
- package/dist/types/packages/ui/src/components/select.d.ts.map +1 -1
- package/dist/types/packages/ui/src/components/table.d.ts +4 -1
- package/dist/types/packages/ui/src/components/table.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,82 +1,84 @@
|
|
|
1
|
-
import { jsx as s, jsxs as m, Fragment as
|
|
1
|
+
import { jsx as s, jsxs as m, Fragment as B } from "react/jsx-runtime";
|
|
2
2
|
import a from "react";
|
|
3
|
-
import { MultiSelect as
|
|
4
|
-
import { Combobox as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { FloatingLabel as
|
|
7
|
-
import { Info as
|
|
8
|
-
import { Tooltip as
|
|
9
|
-
import { Label as
|
|
10
|
-
const
|
|
3
|
+
import { MultiSelect as R, MultiSelectTrigger as q, MultiSelectValue as F, MultiSelectContent as z, MultiSelectGroup as L, MultiSelectItem as J, MultiSelectSeparator as ee } from "../../packages/ui/src/components/select.js";
|
|
4
|
+
import { Combobox as se } from "../../packages/ui/src/components/combobox.js";
|
|
5
|
+
import { cn as f } from "../../packages/ui/src/lib/utils.js";
|
|
6
|
+
import { FloatingLabel as K } from "../FloatLabel.js";
|
|
7
|
+
import { Info as re } from "lucide-react";
|
|
8
|
+
import { Tooltip as de } from "../Tooltip/Tooltip.js";
|
|
9
|
+
import { Label as le } from "../../packages/ui/src/components/label.js";
|
|
10
|
+
const te = a.forwardRef(
|
|
11
11
|
({
|
|
12
12
|
className: N,
|
|
13
13
|
label: x,
|
|
14
14
|
helperText: w,
|
|
15
15
|
state: u = "default",
|
|
16
|
-
size:
|
|
16
|
+
size: d = "normal",
|
|
17
17
|
isFloatLabel: t,
|
|
18
|
-
infoTooltip:
|
|
18
|
+
infoTooltip: o,
|
|
19
19
|
clearable: y = !1,
|
|
20
20
|
placeholder: b = "",
|
|
21
21
|
options: g = [],
|
|
22
22
|
tagRender: n,
|
|
23
23
|
multiple: S = !1,
|
|
24
24
|
value: c,
|
|
25
|
-
defaultValue:
|
|
25
|
+
defaultValue: P,
|
|
26
26
|
onValueChange: I,
|
|
27
|
-
values:
|
|
27
|
+
values: Q,
|
|
28
28
|
defaultValues: v,
|
|
29
29
|
onValuesChange: j,
|
|
30
30
|
search: p,
|
|
31
31
|
onSearchChange: k,
|
|
32
32
|
shouldFilter: C,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
loading: E = !1,
|
|
34
|
+
loadingText: V,
|
|
35
|
+
clickToRemove: T = !0,
|
|
36
|
+
overflowBehavior: U = "wrap-when-open",
|
|
37
|
+
disabled: _,
|
|
36
38
|
onChange: h,
|
|
37
|
-
onFocus:
|
|
38
|
-
onBlur:
|
|
39
|
+
onFocus: G,
|
|
40
|
+
onBlur: H,
|
|
39
41
|
required: M
|
|
40
|
-
},
|
|
41
|
-
const i = a.useId(), [
|
|
42
|
-
c ??
|
|
42
|
+
}, W) => {
|
|
43
|
+
const i = a.useId(), [O, A] = a.useState(
|
|
44
|
+
c ?? P ?? ""
|
|
43
45
|
);
|
|
44
46
|
a.useEffect(() => {
|
|
45
|
-
!S && c !== void 0 &&
|
|
47
|
+
!S && c !== void 0 && A(c);
|
|
46
48
|
}, [S, c]);
|
|
47
|
-
const
|
|
48
|
-
(
|
|
49
|
-
const l =
|
|
50
|
-
c === void 0 &&
|
|
49
|
+
const X = a.useCallback(
|
|
50
|
+
(r) => {
|
|
51
|
+
const l = r || "";
|
|
52
|
+
c === void 0 && A(l), I?.(l), h?.(l);
|
|
51
53
|
},
|
|
52
54
|
[I, h, c]
|
|
53
|
-
),
|
|
54
|
-
(
|
|
55
|
-
j?.(
|
|
55
|
+
), Y = a.useCallback(
|
|
56
|
+
(r) => {
|
|
57
|
+
j?.(r), h?.(r);
|
|
56
58
|
},
|
|
57
59
|
[j, h]
|
|
58
|
-
),
|
|
60
|
+
), Z = {
|
|
59
61
|
default: "ds:text-muted-foreground",
|
|
60
62
|
success: "ds:text-success",
|
|
61
63
|
warning: "ds:text-warning",
|
|
62
64
|
error: "ds:text-error"
|
|
63
|
-
},
|
|
64
|
-
const
|
|
65
|
+
}, D = t ? d === "xl" || d === "lg" ? d : "xl" : d, $ = a.useMemo(() => {
|
|
66
|
+
const r = /* @__PURE__ */ new Map();
|
|
65
67
|
return g.forEach((l) => {
|
|
66
68
|
const e = l.group;
|
|
67
|
-
|
|
68
|
-
}),
|
|
69
|
+
r.has(e) || r.set(e, []), r.get(e).push(l);
|
|
70
|
+
}), r;
|
|
69
71
|
}, [g]);
|
|
70
72
|
return /* @__PURE__ */ s("div", { className: N, children: /* @__PURE__ */ m(
|
|
71
73
|
"div",
|
|
72
74
|
{
|
|
73
|
-
ref:
|
|
74
|
-
className:
|
|
75
|
+
ref: W,
|
|
76
|
+
className: f("ds:flex ds:flex-col ds:gap-1.5 ds:relative", {
|
|
75
77
|
"ds:floating-label ds:relative": t
|
|
76
78
|
}),
|
|
77
79
|
children: [
|
|
78
80
|
!t && x && /* @__PURE__ */ m(
|
|
79
|
-
|
|
81
|
+
le,
|
|
80
82
|
{
|
|
81
83
|
htmlFor: i,
|
|
82
84
|
className: "ds:flex ds:gap-2 ds:text-sm ds:font-medium ds:leading-none ds:peer-disabled:cursor-not-allowed ds:peer-disabled:opacity-70",
|
|
@@ -85,63 +87,65 @@ const re = a.forwardRef(
|
|
|
85
87
|
x,
|
|
86
88
|
M && /* @__PURE__ */ s("span", { className: "ds:text-error ds:ml-0.5", children: "*" })
|
|
87
89
|
] }),
|
|
88
|
-
|
|
90
|
+
o && /* @__PURE__ */ s(de, { content: o, children: /* @__PURE__ */ s(re, { className: "ds:size-3.5 ds:min-w-3.5" }) })
|
|
89
91
|
]
|
|
90
92
|
}
|
|
91
93
|
),
|
|
92
94
|
/* @__PURE__ */ s("div", { className: "ds:relative", children: S ? (
|
|
93
95
|
// Multi Mode
|
|
94
96
|
/* @__PURE__ */ m(
|
|
95
|
-
|
|
97
|
+
R,
|
|
96
98
|
{
|
|
97
|
-
values:
|
|
99
|
+
values: Q,
|
|
98
100
|
defaultValues: typeof v == "string" ? [v] : v,
|
|
99
|
-
onValuesChange:
|
|
101
|
+
onValuesChange: Y,
|
|
100
102
|
children: [
|
|
101
103
|
/* @__PURE__ */ s(
|
|
102
|
-
|
|
104
|
+
q,
|
|
103
105
|
{
|
|
104
106
|
id: i,
|
|
105
|
-
disabled:
|
|
106
|
-
className:
|
|
107
|
+
disabled: _,
|
|
108
|
+
className: f(
|
|
107
109
|
"ds:peer ds:w-full",
|
|
108
110
|
{
|
|
109
|
-
"ds:pt-5 ds:pb-1": t &&
|
|
111
|
+
"ds:pt-5 ds:pb-1": t && d !== "lg"
|
|
110
112
|
},
|
|
111
113
|
N
|
|
112
114
|
),
|
|
113
|
-
size:
|
|
115
|
+
size: D,
|
|
114
116
|
state: u,
|
|
115
|
-
onFocus:
|
|
116
|
-
onBlur:
|
|
117
|
+
onFocus: G,
|
|
118
|
+
onBlur: H,
|
|
117
119
|
children: /* @__PURE__ */ s(
|
|
118
|
-
|
|
120
|
+
F,
|
|
119
121
|
{
|
|
120
122
|
placeholder: b,
|
|
121
|
-
clickToRemove:
|
|
122
|
-
overflowBehavior:
|
|
123
|
+
clickToRemove: T && y,
|
|
124
|
+
overflowBehavior: U
|
|
123
125
|
}
|
|
124
126
|
)
|
|
125
127
|
}
|
|
126
128
|
),
|
|
127
129
|
t && /* @__PURE__ */ s(
|
|
128
|
-
|
|
130
|
+
K,
|
|
129
131
|
{
|
|
130
132
|
htmlFor: i,
|
|
131
|
-
size:
|
|
132
|
-
infoTooltip:
|
|
133
|
+
size: d,
|
|
134
|
+
infoTooltip: o,
|
|
133
135
|
required: M
|
|
134
136
|
}
|
|
135
137
|
),
|
|
136
138
|
/* @__PURE__ */ s(
|
|
137
|
-
|
|
139
|
+
z,
|
|
138
140
|
{
|
|
139
141
|
search: p,
|
|
140
142
|
onSearchChange: k,
|
|
141
143
|
shouldFilter: C,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
loading: E,
|
|
145
|
+
loadingText: V,
|
|
146
|
+
children: [...$.entries()].map(([r, l]) => r ? /* @__PURE__ */ m(a.Fragment, { children: [
|
|
147
|
+
/* @__PURE__ */ s(L, { heading: r, children: l.map((e) => /* @__PURE__ */ s(
|
|
148
|
+
J,
|
|
145
149
|
{
|
|
146
150
|
value: e.value,
|
|
147
151
|
disabled: e?.disabled,
|
|
@@ -151,9 +155,9 @@ const re = a.forwardRef(
|
|
|
151
155
|
},
|
|
152
156
|
e.value
|
|
153
157
|
)) }),
|
|
154
|
-
/* @__PURE__ */ s(
|
|
155
|
-
] },
|
|
156
|
-
|
|
158
|
+
/* @__PURE__ */ s(ee, {})
|
|
159
|
+
] }, r) : l.map((e) => /* @__PURE__ */ s(
|
|
160
|
+
J,
|
|
157
161
|
{
|
|
158
162
|
value: e.value,
|
|
159
163
|
disabled: e?.disabled,
|
|
@@ -170,46 +174,48 @@ const re = a.forwardRef(
|
|
|
170
174
|
)
|
|
171
175
|
) : (
|
|
172
176
|
// Single Mode
|
|
173
|
-
/* @__PURE__ */ m(
|
|
177
|
+
/* @__PURE__ */ m(B, { children: [
|
|
174
178
|
/* @__PURE__ */ s(
|
|
175
|
-
|
|
179
|
+
se,
|
|
176
180
|
{
|
|
177
|
-
value: c ??
|
|
181
|
+
value: c ?? O,
|
|
178
182
|
options: g,
|
|
179
183
|
placeHolder: b,
|
|
180
184
|
emptyText: typeof p == "object" ? p.emptyMessage : "No results found",
|
|
181
|
-
onChange:
|
|
185
|
+
onChange: X,
|
|
182
186
|
clearable: y,
|
|
183
|
-
disabled:
|
|
187
|
+
disabled: _,
|
|
184
188
|
id: i,
|
|
185
|
-
className:
|
|
189
|
+
className: f(
|
|
186
190
|
"ds:peer ds:w-full ds:justify-start",
|
|
187
191
|
{
|
|
188
|
-
"ds:pt-5 ds:pb-1": t &&
|
|
192
|
+
"ds:pt-5 ds:pb-1": t && d !== "lg"
|
|
189
193
|
}
|
|
190
194
|
// className,
|
|
191
195
|
),
|
|
192
|
-
size:
|
|
196
|
+
size: D,
|
|
193
197
|
state: u,
|
|
194
|
-
dropdownClassName:
|
|
195
|
-
"ds:translate-y-[-8px]": t &&
|
|
198
|
+
dropdownClassName: f("ds:opacity-40", {
|
|
199
|
+
"ds:translate-y-[-8px]": t && d !== "lg"
|
|
196
200
|
}),
|
|
197
201
|
searchable: !!p,
|
|
198
202
|
onSearchChange: k,
|
|
199
203
|
shouldFilter: C,
|
|
204
|
+
loading: E,
|
|
205
|
+
loadingText: V,
|
|
200
206
|
tagRender: n,
|
|
201
|
-
onFocus:
|
|
202
|
-
onBlur:
|
|
207
|
+
onFocus: G,
|
|
208
|
+
onBlur: H
|
|
203
209
|
}
|
|
204
210
|
),
|
|
205
211
|
t && /* @__PURE__ */ s(
|
|
206
|
-
|
|
212
|
+
K,
|
|
207
213
|
{
|
|
208
214
|
htmlFor: i,
|
|
209
|
-
size:
|
|
210
|
-
infoTooltip:
|
|
215
|
+
size: d,
|
|
216
|
+
infoTooltip: o,
|
|
211
217
|
required: M,
|
|
212
|
-
shouldFloat: !!(c ??
|
|
218
|
+
shouldFloat: !!(c ?? O),
|
|
213
219
|
className: "ds:pointer-events-none",
|
|
214
220
|
children: x
|
|
215
221
|
}
|
|
@@ -219,7 +225,7 @@ const re = a.forwardRef(
|
|
|
219
225
|
w && /* @__PURE__ */ s(
|
|
220
226
|
"p",
|
|
221
227
|
{
|
|
222
|
-
className:
|
|
228
|
+
className: f("ds:text-xs", u ? Z[u] : ""),
|
|
223
229
|
children: w
|
|
224
230
|
}
|
|
225
231
|
)
|
|
@@ -228,7 +234,7 @@ const re = a.forwardRef(
|
|
|
228
234
|
) });
|
|
229
235
|
}
|
|
230
236
|
);
|
|
231
|
-
|
|
237
|
+
te.displayName = "Select";
|
|
232
238
|
export {
|
|
233
|
-
|
|
239
|
+
te as default
|
|
234
240
|
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
2
|
-
import { ChevronDown as o, ChevronUp as
|
|
1
|
+
import { jsx as s, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronDown as o, ChevronUp as g, ChevronsUpDown as h, Filter as v, X as k, EyeOff as u, Pin as l, PinOff as y } from "lucide-react";
|
|
3
3
|
import { cn as r } from "../../packages/ui/src/lib/utils.js";
|
|
4
|
-
import
|
|
5
|
-
import { DataTableFilterPopover as
|
|
4
|
+
import C from "../DropdownMenu/DropdownMenu.js";
|
|
5
|
+
import { DataTableFilterPopover as m } from "./TableFilter/data-table-filter-popover.js";
|
|
6
6
|
import b from "../Button/Button.js";
|
|
7
|
-
function
|
|
7
|
+
function F({
|
|
8
8
|
column: e,
|
|
9
|
-
label:
|
|
9
|
+
label: p,
|
|
10
10
|
className: d
|
|
11
11
|
}) {
|
|
12
|
-
const
|
|
13
|
-
if (!(e.getCanSort() || e.getCanHide() || e.getCanFilter()))
|
|
14
|
-
return /* @__PURE__ */ s("div", { className: r(d), children:
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
e.getCanSort() && (e.getIsSorted() === "desc" ? /* @__PURE__ */ s(o, {}) : e.getIsSorted() === "asc" ? /* @__PURE__ */ s(
|
|
18
|
-
] }),
|
|
19
|
-
|
|
12
|
+
const a = p || (typeof e.columnDef.header == "string" ? e.columnDef.header : null);
|
|
13
|
+
if (!(e.getCanSort() || e.getCanHide() || e.getCanFilter() || e.getCanPin()))
|
|
14
|
+
return /* @__PURE__ */ s("div", { className: r(d), children: a });
|
|
15
|
+
const c = /* @__PURE__ */ n("button", { className: "ds:-ml-1.5 ds:flex ds:h-8 ds:items-center ds:gap-1.5 ds:rounded-md ds:px-2 ds:py-1.5 ds:hover:bg-accent ds:focus:outline-none ds:focus:ring-1 ds:focus:ring-ring ds:data-[state=open]:bg-accent ds:[&_svg]:size-4 ds:[&_svg]:shrink-0 ds:[&_svg]:text-muted-foreground", children: [
|
|
16
|
+
a,
|
|
17
|
+
e.getCanSort() && (e.getIsSorted() === "desc" ? /* @__PURE__ */ s(o, {}) : e.getIsSorted() === "asc" ? /* @__PURE__ */ s(g, {}) : /* @__PURE__ */ s(h, {}))
|
|
18
|
+
] }), f = e.getCanFilter() && e.columnDef.meta?.variant ? /* @__PURE__ */ s(
|
|
19
|
+
m,
|
|
20
20
|
{
|
|
21
21
|
column: e,
|
|
22
22
|
trigger: /* @__PURE__ */ s(
|
|
@@ -27,16 +27,16 @@ function _({
|
|
|
27
27
|
"ds:hover:bg-accent ds:rounded ds:p-1",
|
|
28
28
|
e.getFilterValue() ? "ds:text-primary" : ""
|
|
29
29
|
),
|
|
30
|
-
children: /* @__PURE__ */ s(
|
|
30
|
+
children: /* @__PURE__ */ s(v, { className: "ds:size-4" })
|
|
31
31
|
}
|
|
32
32
|
)
|
|
33
33
|
}
|
|
34
34
|
) : null, t = [];
|
|
35
|
-
|
|
35
|
+
if (e.getCanSort() && (t.push({
|
|
36
36
|
key: "asc",
|
|
37
37
|
type: "checkbox",
|
|
38
38
|
label: "Asc",
|
|
39
|
-
icon: /* @__PURE__ */ s(
|
|
39
|
+
icon: /* @__PURE__ */ s(g, {}),
|
|
40
40
|
checked: e.getIsSorted() === "asc",
|
|
41
41
|
onClick: () => e.toggleSorting(!1),
|
|
42
42
|
className: "ds:relative ds:pr-8 ds:pl-2 ds:[&>span:first-child]:right-2 ds:[&>span:first-child]:left-auto ds:[&_svg]:text-muted-foreground"
|
|
@@ -52,30 +52,55 @@ function _({
|
|
|
52
52
|
key: "reset",
|
|
53
53
|
type: "item",
|
|
54
54
|
label: "Reset",
|
|
55
|
-
icon: /* @__PURE__ */ s(
|
|
55
|
+
icon: /* @__PURE__ */ s(k, {}),
|
|
56
56
|
onClick: () => e.clearSorting(),
|
|
57
57
|
className: "ds:pl-2 ds:[&_svg]:text-muted-foreground"
|
|
58
58
|
})), e.getCanHide() && t.push({
|
|
59
59
|
key: "hide",
|
|
60
60
|
type: "checkbox",
|
|
61
61
|
label: "Hide",
|
|
62
|
-
icon: /* @__PURE__ */ s(
|
|
62
|
+
icon: /* @__PURE__ */ s(u, {}),
|
|
63
63
|
checked: !e.getIsVisible(),
|
|
64
64
|
onClick: () => e.toggleVisibility(!1),
|
|
65
65
|
className: "ds:relative ds:pr-8 ds:pl-2 ds:[&>span:first-child]:right-2 ds:[&>span:first-child]:left-auto ds:[&_svg]:text-muted-foreground"
|
|
66
|
-
}),
|
|
66
|
+
}), e.getCanPin()) {
|
|
67
|
+
const i = e.getIsPinned();
|
|
68
|
+
t.length > 0 && t.push({ key: "pin-separator", type: "separator" }), i !== "left" && t.push({
|
|
69
|
+
key: "pin-left",
|
|
70
|
+
type: "item",
|
|
71
|
+
label: "Pin left",
|
|
72
|
+
icon: /* @__PURE__ */ s(l, {}),
|
|
73
|
+
onClick: () => e.pin("left"),
|
|
74
|
+
className: "ds:pl-2 ds:[&_svg]:text-muted-foreground"
|
|
75
|
+
}), i !== "right" && t.push({
|
|
76
|
+
key: "pin-right",
|
|
77
|
+
type: "item",
|
|
78
|
+
label: "Pin right",
|
|
79
|
+
icon: /* @__PURE__ */ s(l, {}),
|
|
80
|
+
onClick: () => e.pin("right"),
|
|
81
|
+
className: "ds:pl-2 ds:[&_svg]:text-muted-foreground"
|
|
82
|
+
}), i && t.push({
|
|
83
|
+
key: "unpin",
|
|
84
|
+
type: "item",
|
|
85
|
+
label: "Unpin",
|
|
86
|
+
icon: /* @__PURE__ */ s(y, {}),
|
|
87
|
+
onClick: () => e.pin(!1),
|
|
88
|
+
className: "ds:pl-2 ds:[&_svg]:text-muted-foreground"
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return /* @__PURE__ */ n("div", { className: r("ds:flex ds:items-center ds:gap-1.5", d), children: [
|
|
67
92
|
/* @__PURE__ */ s(
|
|
68
|
-
|
|
93
|
+
C,
|
|
69
94
|
{
|
|
70
|
-
trigger:
|
|
95
|
+
trigger: c,
|
|
71
96
|
items: t,
|
|
72
97
|
align: "start",
|
|
73
|
-
contentClassName: "ds:w-
|
|
98
|
+
contentClassName: "ds:w-36"
|
|
74
99
|
}
|
|
75
100
|
),
|
|
76
|
-
|
|
101
|
+
f
|
|
77
102
|
] });
|
|
78
103
|
}
|
|
79
104
|
export {
|
|
80
|
-
|
|
105
|
+
F as DataTableColumnHeader
|
|
81
106
|
};
|
|
@@ -1,100 +1,122 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { flexRender as
|
|
1
|
+
import { jsxs as c, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { flexRender as f } from "@tanstack/react-table";
|
|
3
3
|
import { DataTablePagination as x } from "./data-table-pagination.js";
|
|
4
|
-
import { cn as
|
|
5
|
-
import { Table as
|
|
6
|
-
import { getCommonPinningStyles as
|
|
7
|
-
import { DataTableColumnHeader as
|
|
8
|
-
function
|
|
4
|
+
import { cn as b } from "../../packages/ui/src/lib/utils.js";
|
|
5
|
+
import { Table as S, TableHeader as v, TableRow as s, TableHead as C, TableBody as T, TableCell as i } from "../../packages/ui/src/components/table.js";
|
|
6
|
+
import { getCommonPinningStyles as g } from "../../utils/data-table.js";
|
|
7
|
+
import { DataTableColumnHeader as k } from "./data-table-column-header.js";
|
|
8
|
+
function I({
|
|
9
9
|
table: o,
|
|
10
|
-
actionBar:
|
|
11
|
-
children:
|
|
10
|
+
actionBar: a,
|
|
11
|
+
children: h,
|
|
12
12
|
className: p,
|
|
13
|
-
pagination:
|
|
14
|
-
sticky:
|
|
15
|
-
bordered:
|
|
13
|
+
pagination: n = !0,
|
|
14
|
+
sticky: d = !0,
|
|
15
|
+
bordered: H,
|
|
16
16
|
loading: m,
|
|
17
|
-
footer:
|
|
18
|
-
...
|
|
17
|
+
footer: u,
|
|
18
|
+
...w
|
|
19
19
|
}) {
|
|
20
|
-
|
|
20
|
+
const t = d ? {
|
|
21
|
+
offsetHeader: typeof d == "object" ? d.offsetHeader ?? 0 : 0,
|
|
22
|
+
offsetScroll: typeof d == "object" ? d.offsetScroll : void 0
|
|
23
|
+
} : null;
|
|
24
|
+
return /* @__PURE__ */ c(
|
|
21
25
|
"div",
|
|
22
26
|
{
|
|
23
|
-
className:
|
|
27
|
+
className: b(
|
|
24
28
|
"ds:flex ds:w-full ds:flex-col ds:gap-2.5 ds:relative",
|
|
25
29
|
p
|
|
26
30
|
),
|
|
27
|
-
...
|
|
31
|
+
...w,
|
|
28
32
|
children: [
|
|
29
|
-
|
|
30
|
-
m && /* @__PURE__ */
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
|
|
33
|
+
h,
|
|
34
|
+
m && /* @__PURE__ */ l("div", { className: "ds:absolute ds:inset-0 ds:bg-background/50 ds:flex ds:items-center ds:justify-center ds:z-20", children: "Loading..." }),
|
|
35
|
+
/* @__PURE__ */ c(
|
|
36
|
+
S,
|
|
33
37
|
{
|
|
34
|
-
|
|
35
|
-
"ds:
|
|
38
|
+
containerClassName: b(
|
|
39
|
+
"ds:rounded-md ds:border ds:border-border",
|
|
40
|
+
// Thin, unobtrusive scrollbar that darkens only when hovering the thumb itself
|
|
41
|
+
"ds:[scrollbar-width:thin] ds:[scrollbar-color:var(--border)_transparent]",
|
|
42
|
+
"ds:[&::-webkit-scrollbar]:h-1.5 ds:[&::-webkit-scrollbar]:w-1.5",
|
|
43
|
+
"ds:[&::-webkit-scrollbar-track]:bg-transparent",
|
|
44
|
+
"ds:[&::-webkit-scrollbar-thumb]:rounded-full ds:[&::-webkit-scrollbar-thumb]:bg-border",
|
|
45
|
+
"ds:[&::-webkit-scrollbar-thumb:hover]:bg-muted-foreground",
|
|
36
46
|
m && "ds:blur-sm"
|
|
37
47
|
),
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
48
|
+
containerStyle: t ? {
|
|
49
|
+
maxHeight: `calc(100vh - ${t.offsetScroll ?? 0}px)`
|
|
50
|
+
} : void 0,
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ l(v, { children: o.getHeaderGroups().map((r) => /* @__PURE__ */ l(s, { children: r.headers.map((e) => /* @__PURE__ */ l(
|
|
53
|
+
C,
|
|
41
54
|
{
|
|
42
|
-
colSpan:
|
|
55
|
+
colSpan: e.colSpan,
|
|
43
56
|
style: {
|
|
44
|
-
...
|
|
57
|
+
...g({
|
|
58
|
+
column: e.column,
|
|
59
|
+
withBorder: !0
|
|
60
|
+
}),
|
|
61
|
+
...t && {
|
|
62
|
+
position: "sticky",
|
|
63
|
+
top: t.offsetHeader,
|
|
64
|
+
zIndex: e.column.getIsPinned() ? 3 : 2,
|
|
65
|
+
background: "var(--background)"
|
|
66
|
+
}
|
|
45
67
|
},
|
|
46
|
-
children:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
) : /* @__PURE__ */
|
|
68
|
+
children: e.isPlaceholder ? null : e.column.columnDef.header ? typeof e.column.columnDef.header == "function" ? f(
|
|
69
|
+
e.column.columnDef.header,
|
|
70
|
+
e.getContext()
|
|
71
|
+
) : /* @__PURE__ */ l(k, { column: e.column }) : null
|
|
50
72
|
},
|
|
51
|
-
|
|
52
|
-
)) },
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
|
|
73
|
+
e.id
|
|
74
|
+
)) }, r.id)) }),
|
|
75
|
+
/* @__PURE__ */ l(T, { children: o.getRowModel().rows?.length ? o.getRowModel().rows.map((r) => /* @__PURE__ */ l(
|
|
76
|
+
s,
|
|
55
77
|
{
|
|
56
|
-
"data-state":
|
|
57
|
-
children:
|
|
58
|
-
|
|
78
|
+
"data-state": r.getIsSelected() && "selected",
|
|
79
|
+
children: r.getVisibleCells().map((e) => /* @__PURE__ */ l(
|
|
80
|
+
i,
|
|
59
81
|
{
|
|
60
82
|
style: {
|
|
61
|
-
...
|
|
83
|
+
...g({
|
|
84
|
+
column: e.column,
|
|
85
|
+
withBorder: !0
|
|
86
|
+
})
|
|
62
87
|
},
|
|
63
|
-
children:
|
|
64
|
-
l.column.columnDef.cell,
|
|
65
|
-
l.getContext()
|
|
66
|
-
)
|
|
88
|
+
children: f(e.column.columnDef.cell, e.getContext())
|
|
67
89
|
},
|
|
68
|
-
|
|
90
|
+
e.id
|
|
69
91
|
))
|
|
70
92
|
},
|
|
71
|
-
|
|
72
|
-
)) : /* @__PURE__ */
|
|
73
|
-
|
|
93
|
+
r.id
|
|
94
|
+
)) : /* @__PURE__ */ l(s, { children: /* @__PURE__ */ l(
|
|
95
|
+
i,
|
|
74
96
|
{
|
|
75
97
|
colSpan: o.getAllColumns().length,
|
|
76
98
|
className: "ds:h-24 ds:text-center",
|
|
77
99
|
children: "No results."
|
|
78
100
|
}
|
|
79
101
|
) }) }),
|
|
80
|
-
|
|
81
|
-
]
|
|
102
|
+
u && /* @__PURE__ */ l("tfoot", { children: /* @__PURE__ */ l(s, { children: /* @__PURE__ */ l(i, { colSpan: o.getAllColumns().length, children: u(o.getRowModel().rows.map((r) => r.original)) }) }) })
|
|
103
|
+
]
|
|
82
104
|
}
|
|
83
105
|
),
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
|
|
106
|
+
/* @__PURE__ */ c("div", { className: "ds:flex ds:flex-col ds:gap-2.5", children: [
|
|
107
|
+
n && /* @__PURE__ */ l(
|
|
86
108
|
x,
|
|
87
109
|
{
|
|
88
110
|
table: o,
|
|
89
|
-
...
|
|
111
|
+
...n === !0 ? {} : n
|
|
90
112
|
}
|
|
91
113
|
),
|
|
92
|
-
|
|
114
|
+
a && o.getFilteredSelectedRowModel().rows.length > 0 && a
|
|
93
115
|
] })
|
|
94
116
|
]
|
|
95
117
|
}
|
|
96
118
|
);
|
|
97
119
|
}
|
|
98
120
|
export {
|
|
99
|
-
|
|
121
|
+
I as DataTable
|
|
100
122
|
};
|