@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.
Files changed (27) hide show
  1. package/dist/AI_CONTEXT.md +4 -0
  2. package/dist/cjs/components/Select/Select.cjs +1 -1
  3. package/dist/cjs/components/Table/data-table-column-header.cjs +1 -1
  4. package/dist/cjs/components/Table/data-table.cjs +1 -1
  5. package/dist/cjs/packages/ui/src/components/combobox.cjs +1 -1
  6. package/dist/cjs/packages/ui/src/components/select.cjs +1 -1
  7. package/dist/cjs/packages/ui/src/components/table.cjs +1 -1
  8. package/dist/cjs/styles/index.css +1 -1
  9. package/dist/esm/components/Select/Select.js +138 -115
  10. package/dist/esm/components/Table/data-table-column-header.js +50 -25
  11. package/dist/esm/components/Table/data-table.js +77 -55
  12. package/dist/esm/packages/ui/src/components/combobox.js +57 -43
  13. package/dist/esm/packages/ui/src/components/select.js +163 -148
  14. package/dist/esm/packages/ui/src/components/table.js +23 -14
  15. package/dist/esm/styles/index.css +1 -1
  16. package/dist/types/components/Select/Select.d.ts +8 -0
  17. package/dist/types/components/Select/Select.d.ts.map +1 -1
  18. package/dist/types/components/Table/data-table-column-header.d.ts.map +1 -1
  19. package/dist/types/components/Table/data-table.d.ts +5 -0
  20. package/dist/types/components/Table/data-table.d.ts.map +1 -1
  21. package/dist/types/packages/ui/src/components/combobox.d.ts +5 -1
  22. package/dist/types/packages/ui/src/components/combobox.d.ts.map +1 -1
  23. package/dist/types/packages/ui/src/components/select.d.ts +4 -1
  24. package/dist/types/packages/ui/src/components/select.d.ts.map +1 -1
  25. package/dist/types/packages/ui/src/components/table.d.ts +4 -1
  26. package/dist/types/packages/ui/src/components/table.d.ts.map +1 -1
  27. package/package.json +1 -1
@@ -1,217 +1,240 @@
1
- import { jsx as s, jsxs as m, Fragment as X } from "react/jsx-runtime";
2
- import n from "react";
3
- import { MultiSelect as Y, MultiSelectTrigger as Z, MultiSelectValue as $, MultiSelectContent as B, MultiSelectGroup as F, MultiSelectItem as H, MultiSelectSeparator as R } from "../../packages/ui/src/components/select.js";
4
- import { Combobox as q } from "../../packages/ui/src/components/combobox.js";
5
- import { cn as o } from "../../packages/ui/src/lib/utils.js";
6
- import { FloatingLabel as O } from "../FloatLabel.js";
7
- import { Info as z } from "lucide-react";
8
- import { Tooltip as L } from "../Tooltip/Tooltip.js";
9
- import { Label as ee } from "../../packages/ui/src/components/label.js";
10
- const se = n.forwardRef(
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: u,
13
+ label: x,
14
14
  helperText: w,
15
- state: f = "default",
16
- size: r = "normal",
15
+ state: u = "default",
16
+ size: d = "normal",
17
17
  isFloatLabel: t,
18
- infoTooltip: p,
18
+ infoTooltip: o,
19
19
  clearable: y = !1,
20
20
  placeholder: b = "",
21
21
  options: g = [],
22
- tagRender: a,
22
+ tagRender: n,
23
23
  multiple: S = !1,
24
24
  value: c,
25
- defaultValue: T,
25
+ defaultValue: P,
26
26
  onValueChange: I,
27
- values: A,
27
+ values: Q,
28
28
  defaultValues: v,
29
29
  onValuesChange: j,
30
- search: h,
31
- clickToRemove: D = !0,
32
- overflowBehavior: J = "wrap-when-open",
33
- disabled: C,
34
- onChange: x,
35
- onFocus: k,
36
- onBlur: E,
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
- }, K) => {
39
- const i = n.useId(), [V, _] = n.useState(
40
- c ?? T ?? ""
42
+ }, W) => {
43
+ const i = a.useId(), [O, A] = a.useState(
44
+ c ?? P ?? ""
41
45
  );
42
- n.useEffect(() => {
43
- !S && c !== void 0 && _(c);
46
+ a.useEffect(() => {
47
+ !S && c !== void 0 && A(c);
44
48
  }, [S, c]);
45
- const P = n.useCallback(
46
- (d) => {
47
- const l = d || "";
48
- c === void 0 && _(l), I?.(l), x?.(l);
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, x, c]
51
- ), Q = n.useCallback(
52
- (d) => {
53
- j?.(d), x?.(d);
54
+ [I, h, c]
55
+ ), Y = a.useCallback(
56
+ (r) => {
57
+ j?.(r), h?.(r);
54
58
  },
55
- [j, x]
56
- ), U = {
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
- }, G = t ? r === "xl" || r === "lg" ? r : "xl" : r, W = n.useMemo(() => {
62
- const d = /* @__PURE__ */ new Map();
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
- d.has(e) || d.set(e, []), d.get(e).push(l);
66
- }), d;
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: K,
72
- className: o("ds:flex ds:flex-col ds:gap-1.5 ds:relative", {
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 && u && /* @__PURE__ */ m(
77
- ee,
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
- u,
87
+ x,
84
88
  M && /* @__PURE__ */ s("span", { className: "ds:text-error ds:ml-0.5", children: "*" })
85
89
  ] }),
86
- p && /* @__PURE__ */ s(L, { content: p, children: /* @__PURE__ */ s(z, { className: "ds:size-3.5 ds:min-w-3.5" }) })
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
- Y,
97
+ R,
94
98
  {
95
- values: A,
99
+ values: Q,
96
100
  defaultValues: typeof v == "string" ? [v] : v,
97
- onValuesChange: Q,
101
+ onValuesChange: Y,
98
102
  children: [
99
103
  /* @__PURE__ */ s(
100
- Z,
104
+ q,
101
105
  {
102
106
  id: i,
103
- disabled: C,
104
- className: o(
107
+ disabled: _,
108
+ className: f(
105
109
  "ds:peer ds:w-full",
106
110
  {
107
- "ds:pt-5 ds:pb-1": t && r !== "lg"
111
+ "ds:pt-5 ds:pb-1": t && d !== "lg"
108
112
  },
109
113
  N
110
114
  ),
111
- size: G,
112
- state: f,
113
- onFocus: k,
114
- onBlur: E,
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: D && y,
120
- overflowBehavior: J
123
+ clickToRemove: T && y,
124
+ overflowBehavior: U
121
125
  }
122
126
  )
123
127
  }
124
128
  ),
125
129
  t && /* @__PURE__ */ s(
126
- O,
130
+ K,
127
131
  {
128
132
  htmlFor: i,
129
- size: r,
130
- infoTooltip: p,
131
- required: M,
132
- children: u
133
+ size: d,
134
+ infoTooltip: o,
135
+ required: M
133
136
  }
134
137
  ),
135
- /* @__PURE__ */ s(B, { search: h, children: [...W.entries()].map(([d, l]) => d ? /* @__PURE__ */ m(n.Fragment, { children: [
136
- /* @__PURE__ */ s(F, { heading: d, children: l.map((e) => /* @__PURE__ */ s(
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
- value: e.value,
152
- disabled: e?.disabled,
153
- icon: e?.icon,
154
- tagRender: !!a,
155
- children: a ? a(e) : e.label
156
- },
157
- e.value
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(X, { children: [
177
+ /* @__PURE__ */ m(B, { children: [
165
178
  /* @__PURE__ */ s(
166
- q,
179
+ se,
167
180
  {
168
- value: c ?? V,
181
+ value: c ?? O,
169
182
  options: g,
170
183
  placeHolder: b,
171
- emptyText: typeof h == "object" ? h.emptyMessage : "No results found",
172
- onChange: P,
184
+ emptyText: typeof p == "object" ? p.emptyMessage : "No results found",
185
+ onChange: X,
173
186
  clearable: y,
174
- disabled: C,
187
+ disabled: _,
175
188
  id: i,
176
- className: o(
189
+ className: f(
177
190
  "ds:peer ds:w-full ds:justify-start",
178
191
  {
179
- "ds:pt-5 ds:pb-1": t && r !== "lg"
192
+ "ds:pt-5 ds:pb-1": t && d !== "lg"
180
193
  }
181
194
  // className,
182
195
  ),
183
- size: G,
184
- state: f,
185
- dropdownClassName: o("ds:opacity-40", {
186
- "ds:translate-y-[-8px]": t && r !== "lg"
196
+ size: D,
197
+ state: u,
198
+ dropdownClassName: f("ds:opacity-40", {
199
+ "ds:translate-y-[-8px]": t && d !== "lg"
187
200
  }),
188
- searchable: !!h,
189
- tagRender: a,
190
- onFocus: k,
191
- onBlur: E
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
- O,
212
+ K,
196
213
  {
197
214
  htmlFor: i,
198
- size: r,
199
- infoTooltip: p,
215
+ size: d,
216
+ infoTooltip: o,
200
217
  required: M,
201
- shouldFloat: !!(c ?? V),
218
+ shouldFloat: !!(c ?? O),
202
219
  className: "ds:pointer-events-none",
203
- children: u
220
+ children: x
204
221
  }
205
222
  )
206
223
  ] })
207
224
  ) }),
208
- w && /* @__PURE__ */ s("p", { className: o("ds:text-xs", f ? U[f] : ""), children: w })
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
- se.displayName = "Select";
237
+ te.displayName = "Select";
215
238
  export {
216
- se as default
239
+ te as default
217
240
  };
@@ -1,22 +1,22 @@
1
- import { jsx as s, jsxs as a } from "react/jsx-runtime";
2
- import { ChevronDown as o, ChevronUp as n, ChevronsUpDown as p, Filter as f, X as h, EyeOff as v } from "lucide-react";
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 m from "../DropdownMenu/DropdownMenu.js";
5
- import { DataTableFilterPopover as u } from "./TableFilter/data-table-filter-popover.js";
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: g,
9
+ label: p,
10
10
  className: d
11
11
  }) {
12
- const i = g || (typeof e.columnDef.header == "string" ? e.columnDef.header : null);
13
- if (!(e.getCanSort() || e.getCanHide() || e.getCanFilter()))
14
- return /* @__PURE__ */ s("div", { className: r(d), children: i });
15
- const l = /* @__PURE__ */ a("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
- i,
17
- e.getCanSort() && (e.getIsSorted() === "desc" ? /* @__PURE__ */ s(o, {}) : e.getIsSorted() === "asc" ? /* @__PURE__ */ s(n, {}) : /* @__PURE__ */ s(p, {}))
18
- ] }), c = e.getCanFilter() && e.columnDef.meta?.variant ? /* @__PURE__ */ s(
19
- u,
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(f, { className: "ds:size-4" })
30
+ children: /* @__PURE__ */ s(v, { className: "ds:size-4" })
31
31
  }
32
32
  )
33
33
  }
34
34
  ) : null, t = [];
35
- return e.getCanSort() && (t.push({
35
+ if (e.getCanSort() && (t.push({
36
36
  key: "asc",
37
37
  type: "checkbox",
38
38
  label: "Asc",
39
- icon: /* @__PURE__ */ s(n, {}),
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(h, {}),
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(v, {}),
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
- }), /* @__PURE__ */ a("div", { className: r("ds:flex ds:items-center ds:gap-1.5", d), children: [
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
- m,
93
+ C,
69
94
  {
70
- trigger: l,
95
+ trigger: c,
71
96
  items: t,
72
97
  align: "start",
73
- contentClassName: "ds:w-28"
98
+ contentClassName: "ds:w-36"
74
99
  }
75
100
  ),
76
- c
101
+ f
77
102
  ] });
78
103
  }
79
104
  export {
80
- _ as DataTableColumnHeader
105
+ F as DataTableColumnHeader
81
106
  };
@@ -1,100 +1,122 @@
1
- import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
- import { flexRender as a } from "@tanstack/react-table";
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 u } from "../../packages/ui/src/lib/utils.js";
5
- import { Table as b, TableHeader as w, TableRow as n, TableHead as T, TableBody as C, TableCell as t } from "../../packages/ui/src/components/table.js";
6
- import { getCommonPinningStyles as f } from "../../utils/data-table.js";
7
- import { DataTableColumnHeader as y } from "./data-table-column-header.js";
8
- function k({
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: c,
11
- children: g,
10
+ actionBar: a,
11
+ children: h,
12
12
  className: p,
13
- pagination: s = !0,
14
- sticky: D,
15
- bordered: S,
13
+ pagination: n = !0,
14
+ sticky: d = !0,
15
+ bordered: H,
16
16
  loading: m,
17
- footer: i,
18
- ...h
17
+ footer: u,
18
+ ...w
19
19
  }) {
20
- return /* @__PURE__ */ r(
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: u(
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
- ...h,
31
+ ...w,
28
32
  children: [
29
- g,
30
- m && /* @__PURE__ */ e("div", { className: "ds:absolute ds:inset-0 ds:bg-background/50 ds:flex ds:items-center ds:justify-center ds:z-20", children: "Loading..." }),
31
- /* @__PURE__ */ e(
32
- "div",
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
- className: u(
35
- "ds:overflow-auto ds:rounded-md ds:border ds:border-border",
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
- children: /* @__PURE__ */ r(b, { children: [
39
- /* @__PURE__ */ e(w, { children: o.getHeaderGroups().map((d) => /* @__PURE__ */ e(n, { children: d.headers.map((l) => /* @__PURE__ */ e(
40
- T,
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: l.colSpan,
55
+ colSpan: e.colSpan,
43
56
  style: {
44
- ...f({ column: l.column })
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: l.isPlaceholder ? null : l.column.columnDef.header ? typeof l.column.columnDef.header == "function" ? a(
47
- l.column.columnDef.header,
48
- l.getContext()
49
- ) : /* @__PURE__ */ e(y, { column: l.column }) : null
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
- l.id
52
- )) }, d.id)) }),
53
- /* @__PURE__ */ e(C, { children: o.getRowModel().rows?.length ? o.getRowModel().rows.map((d) => /* @__PURE__ */ e(
54
- n,
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": d.getIsSelected() && "selected",
57
- children: d.getVisibleCells().map((l) => /* @__PURE__ */ e(
58
- t,
78
+ "data-state": r.getIsSelected() && "selected",
79
+ children: r.getVisibleCells().map((e) => /* @__PURE__ */ l(
80
+ i,
59
81
  {
60
82
  style: {
61
- ...f({ column: l.column })
83
+ ...g({
84
+ column: e.column,
85
+ withBorder: !0
86
+ })
62
87
  },
63
- children: a(
64
- l.column.columnDef.cell,
65
- l.getContext()
66
- )
88
+ children: f(e.column.columnDef.cell, e.getContext())
67
89
  },
68
- l.id
90
+ e.id
69
91
  ))
70
92
  },
71
- d.id
72
- )) : /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(
73
- t,
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
- i && /* @__PURE__ */ e("tfoot", { children: /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(t, { colSpan: o.getAllColumns().length, children: i(o.getRowModel().rows.map((d) => d.original)) }) }) })
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__ */ r("div", { className: "ds:flex ds:flex-col ds:gap-2.5", children: [
85
- s && /* @__PURE__ */ e(
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
- ...s === !0 ? {} : s
111
+ ...n === !0 ? {} : n
90
112
  }
91
113
  ),
92
- c && o.getFilteredSelectedRowModel().rows.length > 0 && c
114
+ a && o.getFilteredSelectedRowModel().rows.length > 0 && a
93
115
  ] })
94
116
  ]
95
117
  }
96
118
  );
97
119
  }
98
120
  export {
99
- k as DataTable
121
+ I as DataTable
100
122
  };