@sth87/shadcn-design-system 0.2.0 → 0.2.2
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 +4 -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 +138 -115
- 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 +57 -43
- package/dist/esm/packages/ui/src/components/select.js +163 -148
- 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 +8 -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 +5 -1
- package/dist/types/packages/ui/src/components/combobox.d.ts.map +1 -1
- package/dist/types/packages/ui/src/components/select.d.ts +4 -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,217 +1,240 @@
|
|
|
1
|
-
import { jsx as s, jsxs as m, Fragment as
|
|
2
|
-
import
|
|
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
|
|
1
|
+
import { jsx as s, jsxs as m, Fragment as B } from "react/jsx-runtime";
|
|
2
|
+
import a from "react";
|
|
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
|
-
label:
|
|
13
|
+
label: x,
|
|
14
14
|
helperText: w,
|
|
15
|
-
state:
|
|
16
|
-
size:
|
|
15
|
+
state: u = "default",
|
|
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
|
-
tagRender:
|
|
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
|
-
search:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
search: p,
|
|
31
|
+
onSearchChange: k,
|
|
32
|
+
shouldFilter: C,
|
|
33
|
+
loading: E = !1,
|
|
34
|
+
loadingText: V,
|
|
35
|
+
clickToRemove: T = !0,
|
|
36
|
+
overflowBehavior: U = "wrap-when-open",
|
|
37
|
+
disabled: _,
|
|
38
|
+
onChange: h,
|
|
39
|
+
onFocus: G,
|
|
40
|
+
onBlur: H,
|
|
37
41
|
required: M
|
|
38
|
-
},
|
|
39
|
-
const i =
|
|
40
|
-
c ??
|
|
42
|
+
}, W) => {
|
|
43
|
+
const i = a.useId(), [O, A] = a.useState(
|
|
44
|
+
c ?? P ?? ""
|
|
41
45
|
);
|
|
42
|
-
|
|
43
|
-
!S && c !== void 0 &&
|
|
46
|
+
a.useEffect(() => {
|
|
47
|
+
!S && c !== void 0 && A(c);
|
|
44
48
|
}, [S, c]);
|
|
45
|
-
const
|
|
46
|
-
(
|
|
47
|
-
const l =
|
|
48
|
-
c === void 0 &&
|
|
49
|
+
const X = a.useCallback(
|
|
50
|
+
(r) => {
|
|
51
|
+
const l = r || "";
|
|
52
|
+
c === void 0 && A(l), I?.(l), h?.(l);
|
|
49
53
|
},
|
|
50
|
-
[I,
|
|
51
|
-
),
|
|
52
|
-
(
|
|
53
|
-
j?.(
|
|
54
|
+
[I, h, c]
|
|
55
|
+
), Y = a.useCallback(
|
|
56
|
+
(r) => {
|
|
57
|
+
j?.(r), h?.(r);
|
|
54
58
|
},
|
|
55
|
-
[j,
|
|
56
|
-
),
|
|
59
|
+
[j, h]
|
|
60
|
+
), Z = {
|
|
57
61
|
default: "ds:text-muted-foreground",
|
|
58
62
|
success: "ds:text-success",
|
|
59
63
|
warning: "ds:text-warning",
|
|
60
64
|
error: "ds:text-error"
|
|
61
|
-
},
|
|
62
|
-
const
|
|
65
|
+
}, D = t ? d === "xl" || d === "lg" ? d : "xl" : d, $ = a.useMemo(() => {
|
|
66
|
+
const r = /* @__PURE__ */ new Map();
|
|
63
67
|
return g.forEach((l) => {
|
|
64
68
|
const e = l.group;
|
|
65
|
-
|
|
66
|
-
}),
|
|
69
|
+
r.has(e) || r.set(e, []), r.get(e).push(l);
|
|
70
|
+
}), r;
|
|
67
71
|
}, [g]);
|
|
68
72
|
return /* @__PURE__ */ s("div", { className: N, children: /* @__PURE__ */ m(
|
|
69
73
|
"div",
|
|
70
74
|
{
|
|
71
|
-
ref:
|
|
72
|
-
className:
|
|
75
|
+
ref: W,
|
|
76
|
+
className: f("ds:flex ds:flex-col ds:gap-1.5 ds:relative", {
|
|
73
77
|
"ds:floating-label ds:relative": t
|
|
74
78
|
}),
|
|
75
79
|
children: [
|
|
76
|
-
!t &&
|
|
77
|
-
|
|
80
|
+
!t && x && /* @__PURE__ */ m(
|
|
81
|
+
le,
|
|
78
82
|
{
|
|
79
83
|
htmlFor: i,
|
|
80
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",
|
|
81
85
|
children: [
|
|
82
86
|
/* @__PURE__ */ m("span", { children: [
|
|
83
|
-
|
|
87
|
+
x,
|
|
84
88
|
M && /* @__PURE__ */ s("span", { className: "ds:text-error ds:ml-0.5", children: "*" })
|
|
85
89
|
] }),
|
|
86
|
-
|
|
90
|
+
o && /* @__PURE__ */ s(de, { content: o, children: /* @__PURE__ */ s(re, { className: "ds:size-3.5 ds:min-w-3.5" }) })
|
|
87
91
|
]
|
|
88
92
|
}
|
|
89
93
|
),
|
|
90
94
|
/* @__PURE__ */ s("div", { className: "ds:relative", children: S ? (
|
|
91
95
|
// Multi Mode
|
|
92
96
|
/* @__PURE__ */ m(
|
|
93
|
-
|
|
97
|
+
R,
|
|
94
98
|
{
|
|
95
|
-
values:
|
|
99
|
+
values: Q,
|
|
96
100
|
defaultValues: typeof v == "string" ? [v] : v,
|
|
97
|
-
onValuesChange:
|
|
101
|
+
onValuesChange: Y,
|
|
98
102
|
children: [
|
|
99
103
|
/* @__PURE__ */ s(
|
|
100
|
-
|
|
104
|
+
q,
|
|
101
105
|
{
|
|
102
106
|
id: i,
|
|
103
|
-
disabled:
|
|
104
|
-
className:
|
|
107
|
+
disabled: _,
|
|
108
|
+
className: f(
|
|
105
109
|
"ds:peer ds:w-full",
|
|
106
110
|
{
|
|
107
|
-
"ds:pt-5 ds:pb-1": t &&
|
|
111
|
+
"ds:pt-5 ds:pb-1": t && d !== "lg"
|
|
108
112
|
},
|
|
109
113
|
N
|
|
110
114
|
),
|
|
111
|
-
size:
|
|
112
|
-
state:
|
|
113
|
-
onFocus:
|
|
114
|
-
onBlur:
|
|
115
|
+
size: D,
|
|
116
|
+
state: u,
|
|
117
|
+
onFocus: G,
|
|
118
|
+
onBlur: H,
|
|
115
119
|
children: /* @__PURE__ */ s(
|
|
116
|
-
|
|
120
|
+
F,
|
|
117
121
|
{
|
|
118
122
|
placeholder: b,
|
|
119
|
-
clickToRemove:
|
|
120
|
-
overflowBehavior:
|
|
123
|
+
clickToRemove: T && y,
|
|
124
|
+
overflowBehavior: U
|
|
121
125
|
}
|
|
122
126
|
)
|
|
123
127
|
}
|
|
124
128
|
),
|
|
125
129
|
t && /* @__PURE__ */ s(
|
|
126
|
-
|
|
130
|
+
K,
|
|
127
131
|
{
|
|
128
132
|
htmlFor: i,
|
|
129
|
-
size:
|
|
130
|
-
infoTooltip:
|
|
131
|
-
required: M
|
|
132
|
-
children: u
|
|
133
|
+
size: d,
|
|
134
|
+
infoTooltip: o,
|
|
135
|
+
required: M
|
|
133
136
|
}
|
|
134
137
|
),
|
|
135
|
-
/* @__PURE__ */ s(
|
|
136
|
-
|
|
137
|
-
H,
|
|
138
|
-
{
|
|
139
|
-
value: e.value,
|
|
140
|
-
disabled: e?.disabled,
|
|
141
|
-
icon: e?.icon,
|
|
142
|
-
tagRender: !!a,
|
|
143
|
-
children: a ? a(e) : e.label
|
|
144
|
-
},
|
|
145
|
-
e.value
|
|
146
|
-
)) }),
|
|
147
|
-
/* @__PURE__ */ s(R, {})
|
|
148
|
-
] }, d) : l.map((e) => /* @__PURE__ */ s(
|
|
149
|
-
H,
|
|
138
|
+
/* @__PURE__ */ s(
|
|
139
|
+
z,
|
|
150
140
|
{
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
141
|
+
search: p,
|
|
142
|
+
onSearchChange: k,
|
|
143
|
+
shouldFilter: C,
|
|
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,
|
|
149
|
+
{
|
|
150
|
+
value: e.value,
|
|
151
|
+
disabled: e?.disabled,
|
|
152
|
+
icon: e?.icon,
|
|
153
|
+
tagRender: !!n,
|
|
154
|
+
children: n ? n(e) : e.label
|
|
155
|
+
},
|
|
156
|
+
e.value
|
|
157
|
+
)) }),
|
|
158
|
+
/* @__PURE__ */ s(ee, {})
|
|
159
|
+
] }, r) : l.map((e) => /* @__PURE__ */ s(
|
|
160
|
+
J,
|
|
161
|
+
{
|
|
162
|
+
value: e.value,
|
|
163
|
+
disabled: e?.disabled,
|
|
164
|
+
icon: e?.icon,
|
|
165
|
+
tagRender: !!n,
|
|
166
|
+
children: n ? n(e) : e.label
|
|
167
|
+
},
|
|
168
|
+
e.value
|
|
169
|
+
)))
|
|
170
|
+
}
|
|
171
|
+
)
|
|
159
172
|
]
|
|
160
173
|
}
|
|
161
174
|
)
|
|
162
175
|
) : (
|
|
163
176
|
// Single Mode
|
|
164
|
-
/* @__PURE__ */ m(
|
|
177
|
+
/* @__PURE__ */ m(B, { children: [
|
|
165
178
|
/* @__PURE__ */ s(
|
|
166
|
-
|
|
179
|
+
se,
|
|
167
180
|
{
|
|
168
|
-
value: c ??
|
|
181
|
+
value: c ?? O,
|
|
169
182
|
options: g,
|
|
170
183
|
placeHolder: b,
|
|
171
|
-
emptyText: typeof
|
|
172
|
-
onChange:
|
|
184
|
+
emptyText: typeof p == "object" ? p.emptyMessage : "No results found",
|
|
185
|
+
onChange: X,
|
|
173
186
|
clearable: y,
|
|
174
|
-
disabled:
|
|
187
|
+
disabled: _,
|
|
175
188
|
id: i,
|
|
176
|
-
className:
|
|
189
|
+
className: f(
|
|
177
190
|
"ds:peer ds:w-full ds:justify-start",
|
|
178
191
|
{
|
|
179
|
-
"ds:pt-5 ds:pb-1": t &&
|
|
192
|
+
"ds:pt-5 ds:pb-1": t && d !== "lg"
|
|
180
193
|
}
|
|
181
194
|
// className,
|
|
182
195
|
),
|
|
183
|
-
size:
|
|
184
|
-
state:
|
|
185
|
-
dropdownClassName:
|
|
186
|
-
"ds:translate-y-[-8px]": t &&
|
|
196
|
+
size: D,
|
|
197
|
+
state: u,
|
|
198
|
+
dropdownClassName: f("ds:opacity-40", {
|
|
199
|
+
"ds:translate-y-[-8px]": t && d !== "lg"
|
|
187
200
|
}),
|
|
188
|
-
searchable: !!
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
201
|
+
searchable: !!p,
|
|
202
|
+
onSearchChange: k,
|
|
203
|
+
shouldFilter: C,
|
|
204
|
+
loading: E,
|
|
205
|
+
loadingText: V,
|
|
206
|
+
tagRender: n,
|
|
207
|
+
onFocus: G,
|
|
208
|
+
onBlur: H
|
|
192
209
|
}
|
|
193
210
|
),
|
|
194
211
|
t && /* @__PURE__ */ s(
|
|
195
|
-
|
|
212
|
+
K,
|
|
196
213
|
{
|
|
197
214
|
htmlFor: i,
|
|
198
|
-
size:
|
|
199
|
-
infoTooltip:
|
|
215
|
+
size: d,
|
|
216
|
+
infoTooltip: o,
|
|
200
217
|
required: M,
|
|
201
|
-
shouldFloat: !!(c ??
|
|
218
|
+
shouldFloat: !!(c ?? O),
|
|
202
219
|
className: "ds:pointer-events-none",
|
|
203
|
-
children:
|
|
220
|
+
children: x
|
|
204
221
|
}
|
|
205
222
|
)
|
|
206
223
|
] })
|
|
207
224
|
) }),
|
|
208
|
-
w && /* @__PURE__ */ s(
|
|
225
|
+
w && /* @__PURE__ */ s(
|
|
226
|
+
"p",
|
|
227
|
+
{
|
|
228
|
+
className: f("ds:text-xs", u ? Z[u] : ""),
|
|
229
|
+
children: w
|
|
230
|
+
}
|
|
231
|
+
)
|
|
209
232
|
]
|
|
210
233
|
}
|
|
211
234
|
) });
|
|
212
235
|
}
|
|
213
236
|
);
|
|
214
|
-
|
|
237
|
+
te.displayName = "Select";
|
|
215
238
|
export {
|
|
216
|
-
|
|
239
|
+
te as default
|
|
217
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
|
};
|