laif-ds 0.1.49 → 0.1.51

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.
@@ -1,5 +1,8 @@
1
1
  "use client";
2
- var e = { exports: {} };
2
+ import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
3
+ import { __require as e } from "../node_modules/style-to-js/cjs/index.js";
4
+ var t = e();
5
+ const a = /* @__PURE__ */ r(t);
3
6
  export {
4
- e as __module
7
+ a as default
5
8
  };
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
3
- import { __require as e } from "../node_modules/style-to-js/cjs/index.js";
4
- var t = e();
5
- const a = /* @__PURE__ */ r(t);
2
+ import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
3
+ import { __require as r } from "../node_modules/extend/index.js";
4
+ var t = r();
5
+ const x = /* @__PURE__ */ e(t);
6
6
  export {
7
- a as default
7
+ x as default
8
8
  };
@@ -1,8 +1,5 @@
1
1
  "use client";
2
- import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
3
- import { __require as r } from "../node_modules/extend/index.js";
4
- var t = r();
5
- const x = /* @__PURE__ */ e(t);
2
+ var e = { exports: {} };
6
3
  export {
7
- x as default
4
+ e as __module
8
5
  };
@@ -1,19 +1,19 @@
1
1
  "use client";
2
- import { jsxs as n, jsx as e } from "react/jsx-runtime";
3
- import * as V from "react";
4
- import { useState as r, useEffect as y, useCallback as F } from "react";
5
- import { useDebounce as ee } from "../../hooks/use-debounce.js";
6
- import { cva as te } from "../../node_modules/class-variance-authority/dist/index.js";
7
- import { cn as D } from "../../lib/utils.js";
8
- import { Button as se } from "./button.js";
9
- import { Label as ne } from "./label.js";
10
- import { Command as oe, CommandInput as re, CommandList as ae, CommandEmpty as ie, CommandGroup as M, CommandItem as $ } from "./command.js";
11
- import { Popover as le, PopoverTrigger as ce, PopoverContent as de } from "./popover.js";
12
- import me from "../../node_modules/lucide-react/dist/esm/icons/x.js";
13
- import fe from "../../node_modules/lucide-react/dist/esm/icons/chevrons-up-down.js";
14
- import pe from "../../node_modules/lucide-react/dist/esm/icons/loader-circle.js";
15
- import ue from "../../node_modules/lucide-react/dist/esm/icons/check.js";
16
- const he = te(
2
+ import { jsxs as s, jsx as e } from "react/jsx-runtime";
3
+ import * as Y from "react";
4
+ import { useState as c, useEffect as j, useCallback as D } from "react";
5
+ import { useDebounce as Z } from "../../hooks/use-debounce.js";
6
+ import { cva as _ } from "../../node_modules/class-variance-authority/dist/index.js";
7
+ import { cn as k } from "../../lib/utils.js";
8
+ import { Button as V } from "./button.js";
9
+ import { Label as ee } from "./label.js";
10
+ import { Command as te, CommandInput as oe, CommandList as se, CommandEmpty as ne, CommandGroup as O, CommandItem as R } from "./command.js";
11
+ import { Popover as re, PopoverTrigger as ae, PopoverContent as ce } from "./popover.js";
12
+ import ie from "../../node_modules/lucide-react/dist/esm/icons/x.js";
13
+ import le from "../../node_modules/lucide-react/dist/esm/icons/chevrons-up-down.js";
14
+ import de from "../../node_modules/lucide-react/dist/esm/icons/loader-circle.js";
15
+ import me from "../../node_modules/lucide-react/dist/esm/icons/check.js";
16
+ const fe = _(
17
17
  "flex items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
18
18
  {
19
19
  variants: {
@@ -28,162 +28,178 @@ const he = te(
28
28
  }
29
29
  }
30
30
  );
31
- function Ee({
32
- fetcher: l,
33
- preload: d,
31
+ function ke({
32
+ fetcher: i,
33
+ preload: m,
34
34
  filterFn: x,
35
35
  renderOption: A,
36
- getOptionValue: i,
37
- getDisplayValue: B,
38
- notFound: G,
39
- loadingSkeleton: R,
40
- label: c,
41
- labelClassName: U,
42
- placeholder: X = "Select...",
43
- value: a,
44
- onChange: m,
45
- disabled: j = !1,
46
- width: k = "200px",
47
- className: q,
48
- triggerClassName: H,
49
- noResultsMessage: J,
36
+ getOptionValue: a,
37
+ getDisplayValue: w,
38
+ notFound: F,
39
+ loadingSkeleton: $,
40
+ label: l,
41
+ labelClassName: B,
42
+ placeholder: G = "Select...",
43
+ value: n,
44
+ onChange: p,
45
+ disabled: z = !1,
46
+ width: E = "200px",
47
+ className: M,
48
+ triggerClassName: U,
49
+ noResultsMessage: X,
50
50
  clearable: v = !0,
51
- size: K
51
+ size: q
52
52
  }) {
53
- const [f, Q] = r(!1), [E, N] = r(!1), [o, p] = r([]), [w, u] = r(!1), [b, h] = r(null), [C, S] = r(a), [z, L] = r(null), [O, W] = r(""), g = ee(O, d ? 0 : 300), [T, P] = r([]);
54
- y(() => {
55
- Q(!0), S(a);
56
- }, [a]), y(() => {
57
- if (a && o.length > 0) {
58
- const t = o.find((s) => i(s) === a);
59
- t && L(t);
60
- }
61
- }, [a, o, i]), y(() => {
62
- f || (async () => {
63
- try {
64
- u(!0), h(null);
65
- const s = await l(a);
66
- P(s), p(s);
67
- } catch (s) {
68
- h(
69
- s instanceof Error ? s.message : "Failed to fetch options"
70
- );
71
- } finally {
72
- u(!1);
73
- }
74
- })();
75
- }, [f, l, a]), y(() => {
76
- const t = async () => {
77
- try {
78
- u(!0), h(null);
79
- const s = await l(g);
80
- P(s), p(s);
81
- } catch (s) {
82
- h(
83
- s instanceof Error ? s.message : "Failed to fetch options"
53
+ const [u, N] = c(!1), [r, d] = c([]), [C, h] = c(!1), [b, g] = c(null), [S, y] = c(null), [I, H] = c(""), f = Z(I, m ? 0 : 300), [L, P] = c([]);
54
+ j(() => ((async () => {
55
+ try {
56
+ if (h(!0), g(null), m) {
57
+ console.log(
58
+ "[AsyncSelect] Preload attivo: caricamento completo dei dati"
84
59
  );
85
- } finally {
86
- u(!1);
60
+ const o = await i("");
61
+ P(o), d(o);
62
+ } else {
63
+ const o = await i(n);
64
+ d(o);
87
65
  }
88
- };
89
- f && d ? d && p(
90
- g ? T.filter(
91
- (s) => x ? x(s, g) : !0
92
- ) : T
93
- ) : t();
94
- }, [l, g, f, d, x]);
95
- const Y = F(
66
+ } catch (o) {
67
+ g(
68
+ o instanceof Error ? o.message : "Failed to fetch options"
69
+ );
70
+ } finally {
71
+ h(!1);
72
+ }
73
+ })(), () => {
74
+ d([]), P([]);
75
+ }), [i, n, m]), j(() => {
76
+ if (u)
77
+ if (m)
78
+ if (f) {
79
+ const t = L.filter(
80
+ (o) => x ? x(o, f) : String(w(o)).toLowerCase().includes(f.toLowerCase())
81
+ );
82
+ d(t);
83
+ } else
84
+ d(L);
85
+ else
86
+ (async () => {
87
+ try {
88
+ h(!0), g(null);
89
+ const o = await i(f);
90
+ d(o);
91
+ } catch (o) {
92
+ g(
93
+ o instanceof Error ? o.message : "Failed to fetch options"
94
+ );
95
+ } finally {
96
+ h(!1);
97
+ }
98
+ })();
99
+ }, [
100
+ u,
101
+ f,
102
+ m,
103
+ x,
104
+ L,
105
+ w
106
+ ]), j(() => {
107
+ if (n && r.length > 0) {
108
+ const t = r.find((o) => a(o) === n);
109
+ y(t || null);
110
+ } else n || y(null);
111
+ }, [n, r, a]);
112
+ const J = D(
96
113
  (t) => {
97
- const s = v && t === C ? "" : t;
98
- S(s), L(
99
- o.find((_) => i(_) === s) || null
100
- ), m(s), N(!1);
114
+ const o = v && t === n ? "" : t, Q = r.find((W) => a(W) === o) || null;
115
+ y(Q), p(o), N(!1);
101
116
  },
102
- [C, m, v, o, i]
103
- ), Z = F(
117
+ [n, p, v, r, a]
118
+ ), K = D(
104
119
  (t) => {
105
- t.stopPropagation(), t.preventDefault(), S(""), L(null), m(""), N(!1);
120
+ t.stopPropagation(), t.preventDefault(), y(null), p(""), N(!1);
106
121
  },
107
- [m]
108
- ), I = V.useId();
109
- return /* @__PURE__ */ n("div", { className: "space-y-1.5", children: [
110
- c && /* @__PURE__ */ e(ne, { htmlFor: I, className: U, children: c }),
111
- /* @__PURE__ */ n(le, { open: E, onOpenChange: N, children: [
112
- /* @__PURE__ */ e(ce, { asChild: !0, children: /* @__PURE__ */ e(
113
- se,
122
+ [p]
123
+ ), T = Y.useId();
124
+ return /* @__PURE__ */ s("div", { className: "space-y-1.5", children: [
125
+ l && /* @__PURE__ */ e(ee, { htmlFor: T, className: B, children: l }),
126
+ /* @__PURE__ */ s(re, { open: u, onOpenChange: N, children: [
127
+ /* @__PURE__ */ e(ae, { asChild: !0, children: /* @__PURE__ */ e(
128
+ V,
114
129
  {
115
- id: I,
130
+ id: T,
131
+ type: "button",
116
132
  variant: "ghost",
117
133
  role: "combobox",
118
- "aria-expanded": E,
119
- className: D(
120
- he({ size: K }),
121
- j && "cursor-not-allowed opacity-50",
122
- H,
134
+ "aria-expanded": u,
135
+ className: k(
136
+ fe({ size: q }),
137
+ z && "cursor-not-allowed opacity-50",
138
+ U,
123
139
  "font-normal"
124
140
  ),
125
- style: { width: k },
126
- disabled: j,
127
- children: /* @__PURE__ */ n("div", { className: "flex flex-1 items-center justify-between overflow-hidden", children: [
128
- z ? /* @__PURE__ */ e("div", { className: "truncate", children: B(z) }) : /* @__PURE__ */ e("span", { className: "text-d-muted-foreground hover:text-d-foreground", children: X }),
129
- /* @__PURE__ */ n("div", { className: "flex items-center gap-1", children: [
130
- v && z && /* @__PURE__ */ e(
141
+ style: { width: E },
142
+ disabled: z,
143
+ children: /* @__PURE__ */ s("div", { className: "flex flex-1 items-center justify-between overflow-hidden", children: [
144
+ S ? /* @__PURE__ */ e("div", { className: "truncate", children: w(S) }) : /* @__PURE__ */ e("span", { className: "text-d-muted-foreground hover:text-d-foreground", children: G }),
145
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
146
+ v && S && /* @__PURE__ */ e(
131
147
  "div",
132
148
  {
133
149
  className: "bg-d-secondary/20 hover:bg-d-secondary/30 z-20 flex cursor-pointer items-center justify-center rounded-full border p-1",
134
- onClick: Z,
150
+ onClick: K,
135
151
  onMouseDown: (t) => t.preventDefault(),
136
152
  "aria-label": "Clear selection",
137
- children: /* @__PURE__ */ e(me, { size: 8, className: "text-d-foreground" })
153
+ children: /* @__PURE__ */ e(ie, { size: 8, className: "text-d-foreground" })
138
154
  }
139
155
  ),
140
- /* @__PURE__ */ e(fe, { className: "opacity-50", size: 10 })
156
+ /* @__PURE__ */ e(le, { className: "opacity-50", size: 10 })
141
157
  ] })
142
158
  ] })
143
159
  }
144
160
  ) }),
145
161
  /* @__PURE__ */ e(
146
- de,
162
+ ce,
147
163
  {
148
- style: { width: k },
149
- className: D("p-0", q),
150
- children: /* @__PURE__ */ n(oe, { shouldFilter: !1, children: [
151
- /* @__PURE__ */ n("div", { className: "relative w-full border-b", children: [
164
+ style: { width: E },
165
+ className: k("p-0", M),
166
+ children: /* @__PURE__ */ s(te, { shouldFilter: !1, children: [
167
+ /* @__PURE__ */ s("div", { className: "relative w-full border-b", children: [
152
168
  /* @__PURE__ */ e(
153
- re,
169
+ oe,
154
170
  {
155
- placeholder: `Search ${typeof c == "string" ? c.toLowerCase() : "options"}...`,
156
- value: O,
171
+ placeholder: `Search ${typeof l == "string" ? l.toLowerCase() : "options"}...`,
172
+ value: I,
157
173
  onValueChange: (t) => {
158
- W(t);
174
+ H(t);
159
175
  }
160
176
  }
161
177
  ),
162
- w && o.length > 0 && /* @__PURE__ */ e("div", { className: "absolute top-1/2 right-2 flex -translate-y-1/2 transform items-center", children: /* @__PURE__ */ e(pe, { className: "h-4 w-4 animate-spin" }) })
178
+ C && r.length > 0 && /* @__PURE__ */ e("div", { className: "absolute top-1/2 right-2 flex -translate-y-1/2 transform items-center", children: /* @__PURE__ */ e(de, { className: "h-4 w-4 animate-spin" }) })
163
179
  ] }),
164
- /* @__PURE__ */ n(ae, { children: [
180
+ /* @__PURE__ */ s(se, { children: [
165
181
  b && /* @__PURE__ */ e("div", { className: "text-d-destructive p-3 text-center", children: b }),
166
- w && o.length === 0 && (R || /* @__PURE__ */ e(ge, {})),
167
- !w && !b && o.length === 0 && (G || /* @__PURE__ */ e(ie, { children: J ?? `No ${typeof c == "string" ? c.toLowerCase() : "options"} found.` })),
168
- /* @__PURE__ */ e(M, { children: o.map((t) => /* @__PURE__ */ n(
169
- $,
182
+ C && r.length === 0 && ($ || /* @__PURE__ */ e(pe, {})),
183
+ !C && !b && r.length === 0 && (F || /* @__PURE__ */ e(ne, { children: X ?? `No ${typeof l == "string" ? l.toLowerCase() : "options"} found.` })),
184
+ /* @__PURE__ */ e(O, { children: r.map((t) => /* @__PURE__ */ s(
185
+ R,
170
186
  {
171
- value: i(t),
172
- onSelect: Y,
187
+ value: a(t),
188
+ onSelect: J,
173
189
  children: [
174
190
  A(t),
175
191
  /* @__PURE__ */ e(
176
- ue,
192
+ me,
177
193
  {
178
- className: D(
194
+ className: k(
179
195
  "ml-auto h-3 w-3",
180
- C === i(t) ? "opacity-100" : "opacity-0"
196
+ n === a(t) ? "opacity-100" : "opacity-0"
181
197
  )
182
198
  }
183
199
  )
184
200
  ]
185
201
  },
186
- i(t)
202
+ a(t)
187
203
  )) })
188
204
  ] })
189
205
  ] })
@@ -192,15 +208,15 @@ function Ee({
192
208
  ] })
193
209
  ] });
194
210
  }
195
- function ge() {
196
- return /* @__PURE__ */ e(M, { children: [1, 2, 3].map((l) => /* @__PURE__ */ e($, { disabled: !0, children: /* @__PURE__ */ n("div", { className: "flex w-full items-center gap-2", children: [
211
+ function pe() {
212
+ return /* @__PURE__ */ e(O, { children: [1, 2, 3].map((i) => /* @__PURE__ */ e(R, { disabled: !0, children: /* @__PURE__ */ s("div", { className: "flex w-full items-center gap-2", children: [
197
213
  /* @__PURE__ */ e("div", { className: "bg-d-secondary h-6 w-6 animate-pulse rounded-full" }),
198
- /* @__PURE__ */ n("div", { className: "flex flex-1 flex-col gap-1", children: [
214
+ /* @__PURE__ */ s("div", { className: "flex flex-1 flex-col gap-1", children: [
199
215
  /* @__PURE__ */ e("div", { className: "bg-d-secondary h-4 w-24 animate-pulse rounded" }),
200
216
  /* @__PURE__ */ e("div", { className: "bg-d-secondary h-3 w-16 animate-pulse rounded" })
201
217
  ] })
202
- ] }) }, l)) });
218
+ ] }) }, i)) });
203
219
  }
204
220
  export {
205
- Ee as AsyncSelect
221
+ ke as AsyncSelect
206
222
  };
@@ -1,68 +1,67 @@
1
1
  "use client";
2
- import { jsx as t, jsxs as C } from "react/jsx-runtime";
3
- import { useReactTable as q, flexRender as z } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
4
- import J, { useState as S, useEffect as Q } from "react";
5
- import { Checkbox as A } from "./checkbox.js";
6
- import { cn as U } from "../../lib/utils.js";
7
- import { Input as X } from "./input.js";
8
- import { ScrollArea as D, ScrollBar as y } from "./scroll-area.js";
9
- import { AppMultipleSelectDropdown as Y } from "./app-multiple-select-dropdown.js";
10
- import { Table as Z, TableHeader as B, TableRow as w, TableHead as ee, TableBody as te, TableCell as N } from "./table.js";
2
+ import { jsx as t, jsxs as w } from "react/jsx-runtime";
3
+ import { useReactTable as K, flexRender as k } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
4
+ import q, { useState as b, useEffect as J } from "react";
5
+ import { Checkbox as D } from "./checkbox.js";
6
+ import { cn as Q } from "../../lib/utils.js";
7
+ import { Input as U } from "./input.js";
8
+ import { ScrollArea as A, ScrollBar as C } from "./scroll-area.js";
9
+ import { AppMultipleSelectDropdown as X } from "./app-multiple-select-dropdown.js";
10
+ import { Table as Y, TableHeader as Z, TableRow as x, TableHead as B, TableBody as ee, TableCell as p } from "./table.js";
11
11
  import { Skeleton as le } from "./skeleton.js";
12
- import { Pagination as ne, PaginationContent as oe, PaginationItem as p, PaginationFirst as ae, PaginationPrevious as ie, PaginationLink as ce, PaginationNext as se, PaginationLast as re } from "./pagination.js";
13
- import { getFilteredRowModel as me, getPaginationRowModel as ue, getSortedRowModel as ge, getCoreRowModel as de } from "../../node_modules/@tanstack/table-core/build/lib/index.js";
14
- function fe(u, g, i, h) {
15
- const r = u.getValue(g), d = h == null ? void 0 : h.find((o) => o.column === g), f = (d == null ? void 0 : d.innerFiltersMode) ?? "OR";
16
- if (Array.isArray(r))
17
- return f === "AND" ? i.every((o) => r.includes(o)) : i.some((o) => r.includes(o));
18
- switch (f) {
12
+ import { getFilteredRowModel as te, getSortedRowModel as oe, getPaginationRowModel as ne, getCoreRowModel as ae } from "../../node_modules/@tanstack/table-core/build/lib/index.js";
13
+ function ce(s, r, n, d) {
14
+ const i = s.getValue(r), u = d == null ? void 0 : d.find((o) => o.column === r), m = (u == null ? void 0 : u.innerFiltersMode) ?? "OR";
15
+ if (Array.isArray(i))
16
+ return m === "AND" ? n.every((o) => i.includes(o)) : n.some((o) => i.includes(o));
17
+ switch (m) {
19
18
  case "AND":
20
- return i.every((o) => String(r) === o);
19
+ return n.every((o) => String(i) === o);
21
20
  case "OR":
22
21
  default:
23
- return i.some((o) => String(r) === o);
22
+ return n.some((o) => String(i) === o);
24
23
  }
25
24
  }
26
- function he(u) {
27
- return u.reduce(
28
- (g, i) => (i.filterFn && (g[i.column] = (h, r, d) => {
29
- const f = h.getValue(r);
30
- switch (i.innerFiltersMode ?? "OR") {
25
+ function ie(s) {
26
+ return s.reduce(
27
+ (r, n) => (n.filterFn && (r[n.column] = (d, i, u) => {
28
+ const m = d.getValue(i);
29
+ switch (n.innerFiltersMode ?? "OR") {
31
30
  case "AND":
32
- return d.every(
33
- (b) => i.filterFn(f, [b])
31
+ return u.every(
32
+ (g) => n.filterFn(m, [g])
34
33
  );
35
34
  case "OR":
36
35
  default:
37
- return d.some(
38
- (b) => i.filterFn(f, [b])
36
+ return u.some(
37
+ (g) => n.filterFn(m, [g])
39
38
  );
40
39
  }
41
- }), g),
40
+ }), r),
42
41
  {}
43
42
  ) || {};
44
43
  }
45
- function ze({
46
- columns: u,
47
- data: g,
48
- loading: i = !1,
49
- emptyComponent: h,
50
- className: r,
51
- rowSelection: d = {},
52
- onRowSelectionChange: f,
44
+ function xe({
45
+ columns: s,
46
+ data: r,
47
+ loading: n = !1,
48
+ emptyComponent: d,
49
+ className: i,
50
+ rowSelection: u = {},
51
+ onRowSelectionChange: m,
53
52
  checkable: o = !1,
54
- onCheckedRowsChange: b,
53
+ onCheckedRowsChange: g,
55
54
  notFoundMessage: V = "Nessun risultato trovato.",
56
- searchBar: x = void 0,
57
- dropdownFilters: c = void 0
55
+ searchBar: f = void 0,
56
+ dropdownFilters: a = void 0
58
57
  // outerFiltersMode = EFiltersMode.AND,
59
58
  }) {
60
- var M;
61
- const [I, T] = S([]), [L, $] = S([]), [j, F] = S({}), [k, G] = S(""), [H, O] = S({}), v = f ? d : H, _ = f || O, W = J.useMemo(() => o ? [
59
+ var v;
60
+ const [T, z] = b([]), [$, j] = b([]), [H, P] = b({}), [y, F] = b(""), [L, O] = b({}), N = m ? u : L, _ = m || O, G = q.useMemo(() => o ? [
62
61
  {
63
62
  id: "select",
64
63
  header: ({ table: e }) => /* @__PURE__ */ t("div", { className: "text-center", children: /* @__PURE__ */ t(
65
- A,
64
+ D,
66
65
  {
67
66
  checked: e.getIsAllPageRowsSelected(),
68
67
  onCheckedChange: (l) => e.toggleAllPageRowsSelected(!!l),
@@ -70,7 +69,7 @@ function ze({
70
69
  }
71
70
  ) }),
72
71
  cell: ({ row: e }) => /* @__PURE__ */ t("div", { className: "text-center", children: /* @__PURE__ */ t(
73
- A,
72
+ D,
74
73
  {
75
74
  checked: e.getIsSelected(),
76
75
  onCheckedChange: (l) => e.toggleSelected(!!l),
@@ -80,80 +79,80 @@ function ze({
80
79
  enableSorting: !1,
81
80
  enableHiding: !1
82
81
  },
83
- ...u
84
- ] : u, [u, o]).map((e) => {
85
- const l = c == null ? void 0 : c.find(
86
- (a) => a.column === (e == null ? void 0 : e.accessorKey)
82
+ ...s
83
+ ] : s, [s, o]).map((e) => {
84
+ const l = a == null ? void 0 : a.find(
85
+ (c) => c.column === (e == null ? void 0 : e.accessorKey)
87
86
  );
88
87
  return {
89
88
  ...e,
90
89
  filterFn: l != null && l.filterFn ? l.column : "multiValue"
91
90
  };
92
- }), E = {
93
- data: g,
94
- columns: W,
95
- getCoreRowModel: de(),
96
- onSortingChange: T,
97
- getSortedRowModel: ge(),
98
- onColumnVisibilityChange: F,
91
+ }), I = {
92
+ data: r,
93
+ columns: G,
94
+ getCoreRowModel: ae(),
95
+ getPaginationRowModel: ne(),
96
+ onSortingChange: z,
97
+ getSortedRowModel: oe(),
98
+ onColumnVisibilityChange: P,
99
99
  onRowSelectionChange: _,
100
- getPaginationRowModel: ue(),
101
- getFilteredRowModel: me(),
102
- globalFilterFn: (e, l, a) => a ? (x == null ? void 0 : x.columns.some((m) => {
103
- const s = e.getValue(m);
104
- return String(s).toLowerCase().includes(a.toLowerCase());
100
+ getFilteredRowModel: te(),
101
+ globalFilterFn: (e, l, c) => c ? (f == null ? void 0 : f.columns.some((S) => {
102
+ const R = e.getValue(S);
103
+ return String(R).toLowerCase().includes(c.toLowerCase());
105
104
  })) ?? !1 : !0,
106
105
  filterFns: {
107
- multiValue: (e, l, a) => fe(e, l, a, c),
108
- ...he(c ?? [])
106
+ multiValue: (e, l, c) => ce(e, l, c, a),
107
+ ...ie(a ?? [])
109
108
  },
110
109
  state: {
111
- sorting: I,
112
- columnFilters: L,
113
- columnVisibility: j,
114
- rowSelection: v,
115
- globalFilter: k
110
+ sorting: T,
111
+ columnFilters: $,
112
+ columnVisibility: H,
113
+ rowSelection: N,
114
+ globalFilter: y
116
115
  }
117
- }, n = q(E);
118
- return Q(() => {
119
- if (b && o) {
120
- const e = n.getFilteredSelectedRowModel().rows.map((l) => l.original);
121
- b(e);
116
+ }, h = K(I);
117
+ return J(() => {
118
+ if (g && o) {
119
+ const e = h.getFilteredSelectedRowModel().rows.map((l) => l.original);
120
+ g(e);
122
121
  }
123
- }, [n, b, o, v]), /* @__PURE__ */ C("div", { className: U("flex h-full w-full flex-col gap-2", r), children: [
124
- (x || (c == null ? void 0 : c.length)) && /* @__PURE__ */ C("div", { className: "flex flex-col items-start justify-between gap-2 sm:flex-row sm:items-end", children: [
125
- x && /* @__PURE__ */ t(
126
- X,
122
+ }, [h, g, o, N]), /* @__PURE__ */ w("div", { className: Q("flex h-full w-full flex-col gap-2", i), children: [
123
+ (f || (a == null ? void 0 : a.length)) && /* @__PURE__ */ w("div", { className: "flex flex-col items-start justify-between gap-2 sm:flex-row sm:items-end", children: [
124
+ f && /* @__PURE__ */ t(
125
+ U,
127
126
  {
128
127
  iconLeft: "Search",
129
- placeholder: x.placeholder ?? "Cerca...",
130
- value: k,
128
+ placeholder: f.placeholder ?? "Cerca...",
129
+ value: y,
131
130
  onChange: (e) => {
132
- G(e.target.value || "");
131
+ F(e.target.value || "");
133
132
  },
134
133
  className: "w-60"
135
134
  }
136
135
  ),
137
- /* @__PURE__ */ t("div", { className: "flex h-full max-w-full min-w-0 flex-1 items-center", children: c && c.length > 0 && /* @__PURE__ */ C(D, { className: "h-full w-full", children: [
138
- /* @__PURE__ */ t(y, { orientation: "horizontal" }),
139
- /* @__PURE__ */ t("div", { className: "flex w-full max-w-full min-w-0 items-center justify-start gap-2 sm:justify-end", children: c.map((e, l) => {
140
- const [a, m] = S([]);
136
+ /* @__PURE__ */ t("div", { className: "flex h-full max-w-full min-w-0 flex-1 items-center", children: a && a.length > 0 && /* @__PURE__ */ w(A, { className: "h-full w-full", children: [
137
+ /* @__PURE__ */ t(C, { orientation: "horizontal" }),
138
+ /* @__PURE__ */ t("div", { className: "flex w-full max-w-full min-w-0 items-center justify-start gap-2 sm:justify-end", children: a.map((e, l) => {
139
+ const [c, S] = b([]);
141
140
  return /* @__PURE__ */ t(
142
- Y,
141
+ X,
143
142
  {
144
143
  className: "w-60",
145
144
  options: e.items,
146
- value: a,
145
+ value: c,
147
146
  placeholder: e.placeholder,
148
147
  label: e.label,
149
- onChange: (s) => {
150
- m(s), $((P) => {
151
- const R = P.filter(
152
- (K) => K.id !== e.column
148
+ onChange: (R) => {
149
+ S(R), j((W) => {
150
+ const M = W.filter(
151
+ (E) => E.id !== e.column
153
152
  );
154
- return s.length === 0 ? R : [
155
- ...R,
156
- { id: e.column, value: s }
153
+ return R.length === 0 ? M : [
154
+ ...M,
155
+ { id: e.column, value: R }
157
156
  ];
158
157
  });
159
158
  }
@@ -163,37 +162,37 @@ function ze({
163
162
  }) })
164
163
  ] }) })
165
164
  ] }),
166
- /* @__PURE__ */ C(D, { className: "border-d-border h-full min-h-0 w-full rounded-md border", children: [
167
- /* @__PURE__ */ t(y, { orientation: "horizontal" }),
168
- /* @__PURE__ */ t(y, { orientation: "vertical" }),
169
- /* @__PURE__ */ C(Z, { children: [
170
- /* @__PURE__ */ t(B, { children: n.getHeaderGroups().map((e) => /* @__PURE__ */ t(w, { children: e.headers.map((l) => /* @__PURE__ */ t(
171
- ee,
165
+ /* @__PURE__ */ w(A, { className: "border-d-border h-full min-h-0 w-full rounded-md border", children: [
166
+ /* @__PURE__ */ t(C, { orientation: "horizontal" }),
167
+ /* @__PURE__ */ t(C, { orientation: "vertical" }),
168
+ /* @__PURE__ */ w(Y, { children: [
169
+ /* @__PURE__ */ t(Z, { children: h.getHeaderGroups().map((e) => /* @__PURE__ */ t(x, { children: e.headers.map((l) => /* @__PURE__ */ t(
170
+ B,
172
171
  {
173
172
  className: `bg-d-secondary sticky top-0 z-10 ${l.column.columnDef.sticky ? "left-0" : ""}`,
174
- children: l.isPlaceholder ? null : z(
173
+ children: l.isPlaceholder ? null : k(
175
174
  l.column.columnDef.header,
176
175
  l.getContext()
177
176
  )
178
177
  },
179
178
  l.id
180
179
  )) }, e.id)) }),
181
- /* @__PURE__ */ t(te, { children: i ? Array.from({ length: g.length || 8 }).map((e, l) => /* @__PURE__ */ t(w, { children: n.getHeaderGroups()[0].headers.map((a, m) => /* @__PURE__ */ t(
182
- N,
180
+ /* @__PURE__ */ t(ee, { children: n ? Array.from({ length: r.length || 8 }).map((e, l) => /* @__PURE__ */ t(x, { children: h.getHeaderGroups()[0].headers.map((c, S) => /* @__PURE__ */ t(
181
+ p,
183
182
  {
184
- className: `w-full ${a.column.columnDef.sticky ? "bg-d-background sticky left-0 z-10" : ""}`,
183
+ className: `w-full ${c.column.columnDef.sticky ? "bg-d-background sticky left-0 z-10" : ""}`,
185
184
  children: /* @__PURE__ */ t(le, { className: "h-6 w-full" })
186
185
  },
187
- `skeleton-cell-${l}-${m}`
188
- )) }, `skeleton-row-${l}`)) : (M = n.getRowModel().rows) != null && M.length ? n.getRowModel().rows.map((e) => /* @__PURE__ */ t(
189
- w,
186
+ `skeleton-cell-${l}-${S}`
187
+ )) }, `skeleton-row-${l}`)) : (v = h.getRowModel().rows) != null && v.length ? h.getRowModel().rows.map((e) => /* @__PURE__ */ t(
188
+ x,
190
189
  {
191
190
  "data-state": e.getIsSelected() && "selected",
192
191
  children: e.getVisibleCells().map((l) => /* @__PURE__ */ t(
193
- N,
192
+ p,
194
193
  {
195
194
  className: `${l.column.columnDef.sticky ? "bg-d-background sticky left-0 z-10" : ""}`,
196
- children: z(
195
+ children: k(
197
196
  l.column.columnDef.cell,
198
197
  l.getContext()
199
198
  )
@@ -202,72 +201,18 @@ function ze({
202
201
  ))
203
202
  },
204
203
  e.id
205
- )) : /* @__PURE__ */ t(w, { children: /* @__PURE__ */ t(
206
- N,
204
+ )) : /* @__PURE__ */ t(x, { children: /* @__PURE__ */ t(
205
+ p,
207
206
  {
208
- colSpan: u.length,
207
+ colSpan: s.length,
209
208
  className: "pt-4 text-center",
210
- children: h || V
209
+ children: d || V
211
210
  }
212
211
  ) }) })
213
212
  ] })
214
- ] }),
215
- /* @__PURE__ */ t(ne, { children: /* @__PURE__ */ C(oe, { children: [
216
- /* @__PURE__ */ t(p, { children: /* @__PURE__ */ t(
217
- ae,
218
- {
219
- size: "sm",
220
- onClick: () => n.setPageIndex(0),
221
- "aria-label": "Go to first page",
222
- children: "«"
223
- }
224
- ) }),
225
- /* @__PURE__ */ t(p, { children: /* @__PURE__ */ t(
226
- ie,
227
- {
228
- size: "sm",
229
- onClick: () => {
230
- n.getCanPreviousPage() && n.previousPage();
231
- }
232
- }
233
- ) }),
234
- (() => {
235
- const e = n.getState().pagination.pageIndex, l = n.getPageCount(), a = 5;
236
- let m = Math.max(
237
- 0,
238
- e - Math.floor(a / 2)
239
- ), s = m + a;
240
- return s > l && (s = l, m = Math.max(0, s - a)), n.getPageOptions().slice(m, s).map((P, R) => /* @__PURE__ */ t(p, { children: /* @__PURE__ */ t(
241
- ce,
242
- {
243
- size: "icon",
244
- isActive: e === P,
245
- onClick: () => n.setPageIndex(P),
246
- children: P + 1
247
- }
248
- ) }, R));
249
- })(),
250
- /* @__PURE__ */ t(p, { children: /* @__PURE__ */ t(
251
- se,
252
- {
253
- size: "sm",
254
- onClick: () => {
255
- n.getCanNextPage() && n.nextPage();
256
- }
257
- }
258
- ) }),
259
- /* @__PURE__ */ t(p, { children: /* @__PURE__ */ t(
260
- re,
261
- {
262
- size: "sm",
263
- onClick: () => n.setPageIndex(n.getPageCount() - 1),
264
- "aria-label": "Go to last page",
265
- children: "»"
266
- }
267
- ) })
268
- ] }) })
213
+ ] })
269
214
  ] });
270
215
  }
271
216
  export {
272
- ze as DataTable
217
+ xe as DataTable
273
218
  };
@@ -1,25 +1,23 @@
1
1
  "use client";
2
- import { jsx as i, jsxs as t } from "react/jsx-runtime";
3
- import { cn as e } from "../../lib/utils.js";
2
+ import { jsx as i, jsxs as e } from "react/jsx-runtime";
3
+ import { cn as t } from "../../lib/utils.js";
4
4
  import { buttonVariants as l } from "./button.js";
5
5
  import c from "../../node_modules/lucide-react/dist/esm/icons/ellipsis.js";
6
6
  import p from "../../node_modules/lucide-react/dist/esm/icons/chevron-right.js";
7
7
  import m from "../../node_modules/lucide-react/dist/esm/icons/chevron-left.js";
8
- import u from "../../node_modules/lucide-react/dist/esm/icons/chevron-first.js";
9
- import d from "../../node_modules/lucide-react/dist/esm/icons/chevron-last.js";
10
- function k({ className: a, ...n }) {
8
+ function N({ className: a, ...n }) {
11
9
  return /* @__PURE__ */ i(
12
10
  "nav",
13
11
  {
14
12
  role: "navigation",
15
13
  "aria-label": "pagination",
16
14
  "data-slot": "pagination",
17
- className: e("mx-auto flex w-full justify-center", a),
15
+ className: t("mx-auto flex w-full justify-center", a),
18
16
  ...n
19
17
  }
20
18
  );
21
19
  }
22
- function z({
20
+ function P({
23
21
  className: a,
24
22
  ...n
25
23
  }) {
@@ -27,19 +25,19 @@ function z({
27
25
  "ul",
28
26
  {
29
27
  "data-slot": "pagination-content",
30
- className: e("flex flex-row items-center gap-1", a),
28
+ className: t("flex flex-row items-center gap-1", a),
31
29
  ...n
32
30
  }
33
31
  );
34
32
  }
35
- function C({ ...a }) {
33
+ function v({ ...a }) {
36
34
  return /* @__PURE__ */ i("li", { "data-slot": "pagination-item", ...a });
37
35
  }
38
36
  function o({
39
37
  className: a,
40
38
  isActive: n,
41
- size: s = "icon",
42
- ...r
39
+ size: r = "icon",
40
+ ...s
43
41
  }) {
44
42
  return /* @__PURE__ */ i(
45
43
  "a",
@@ -47,45 +45,27 @@ function o({
47
45
  "aria-current": n ? "page" : void 0,
48
46
  "data-slot": "pagination-link",
49
47
  "data-active": n,
50
- className: e(
48
+ className: t(
51
49
  l({
52
50
  variant: n ? "outline" : "ghost",
53
- size: s
51
+ size: r
54
52
  }),
55
53
  a
56
54
  ),
57
- ...r
55
+ ...s
58
56
  }
59
57
  );
60
58
  }
61
- function L({
59
+ function b({
62
60
  className: a,
63
61
  ...n
64
62
  }) {
65
- return /* @__PURE__ */ t(
63
+ return /* @__PURE__ */ e(
66
64
  o,
67
65
  {
68
66
  "aria-label": "Go to previous page",
69
67
  size: "default",
70
- className: e("gap-1 px-2.5 sm:pl-2.5", a),
71
- ...n,
72
- children: [
73
- /* @__PURE__ */ i(u, {}),
74
- /* @__PURE__ */ i("span", { className: "hidden sm:block", children: "First" })
75
- ]
76
- }
77
- );
78
- }
79
- function j({
80
- className: a,
81
- ...n
82
- }) {
83
- return /* @__PURE__ */ t(
84
- o,
85
- {
86
- "aria-label": "Go to previous page",
87
- size: "default",
88
- className: e("gap-1 px-2.5 sm:pl-2.5", a),
68
+ className: t("gap-1 px-2.5 sm:pl-2.5", a),
89
69
  ...n,
90
70
  children: [
91
71
  /* @__PURE__ */ i(m, {}),
@@ -94,16 +74,16 @@ function j({
94
74
  }
95
75
  );
96
76
  }
97
- function G({
77
+ function j({
98
78
  className: a,
99
79
  ...n
100
80
  }) {
101
- return /* @__PURE__ */ t(
81
+ return /* @__PURE__ */ e(
102
82
  o,
103
83
  {
104
84
  "aria-label": "Go to next page",
105
85
  size: "default",
106
- className: e("gap-1 px-2.5 sm:pr-2.5", a),
86
+ className: t("gap-1 px-2.5 sm:pr-2.5", a),
107
87
  ...n,
108
88
  children: [
109
89
  /* @__PURE__ */ i("span", { className: "hidden sm:block", children: "Next" }),
@@ -112,34 +92,16 @@ function G({
112
92
  }
113
93
  );
114
94
  }
115
- function y({
116
- className: a,
117
- ...n
118
- }) {
119
- return /* @__PURE__ */ t(
120
- o,
121
- {
122
- "aria-label": "Go to next page",
123
- size: "default",
124
- className: e("gap-1 px-2.5 sm:pr-2.5", a),
125
- ...n,
126
- children: [
127
- /* @__PURE__ */ i("span", { className: "hidden sm:block", children: "Last" }),
128
- /* @__PURE__ */ i(d, {})
129
- ]
130
- }
131
- );
132
- }
133
- function F({
95
+ function k({
134
96
  className: a,
135
97
  ...n
136
98
  }) {
137
- return /* @__PURE__ */ t(
99
+ return /* @__PURE__ */ e(
138
100
  "span",
139
101
  {
140
102
  "aria-hidden": !0,
141
103
  "data-slot": "pagination-ellipsis",
142
- className: e("flex size-9 items-center justify-center", a),
104
+ className: t("flex size-9 items-center justify-center", a),
143
105
  ...n,
144
106
  children: [
145
107
  /* @__PURE__ */ i(c, { className: "size-4" }),
@@ -149,13 +111,11 @@ function F({
149
111
  );
150
112
  }
151
113
  export {
152
- k as Pagination,
153
- z as PaginationContent,
154
- F as PaginationEllipsis,
155
- L as PaginationFirst,
156
- C as PaginationItem,
157
- y as PaginationLast,
114
+ N as Pagination,
115
+ P as PaginationContent,
116
+ k as PaginationEllipsis,
117
+ v as PaginationItem,
158
118
  o as PaginationLink,
159
- G as PaginationNext,
160
- j as PaginationPrevious
119
+ j as PaginationNext,
120
+ b as PaginationPrevious
161
121
  };
package/dist/index.d.ts CHANGED
@@ -167,43 +167,24 @@ declare type AspectRatioProps = React.ComponentProps<typeof AspectRatioPrimitive
167
167
  export declare function AsyncSelect<T>({ fetcher, preload, filterFn, renderOption, getOptionValue, getDisplayValue, notFound, loadingSkeleton, label, labelClassName, placeholder, value, onChange, disabled, width, className, triggerClassName, noResultsMessage, clearable, size, }: AsyncSelectProps<T>): JSX.Element;
168
168
 
169
169
  declare interface AsyncSelectProps<T> extends VariantProps<typeof asyncSelectTriggerVariants> {
170
- /** Async function to fetch options */
171
170
  fetcher: (query?: string) => Promise<T[]>;
172
- /** Preload all data ahead of time */
173
171
  preload?: boolean;
174
- /** Function to filter options */
175
172
  filterFn?: (option: T, query: string) => boolean;
176
- /** Function to render each option */
177
173
  renderOption: (option: T) => React_2.ReactNode;
178
- /** Function to get the value from an option */
179
174
  getOptionValue: (option: T) => string;
180
- /** Function to get the display value for the selected option */
181
175
  getDisplayValue: (option: T) => React_2.ReactNode;
182
- /** Custom not found message */
183
176
  notFound?: React_2.ReactNode;
184
- /** Custom loading skeleton */
185
177
  loadingSkeleton?: React_2.ReactNode;
186
- /** Currently selected value */
187
178
  value: string;
188
- /** Callback when selection changes */
189
179
  onChange: (value: string) => void;
190
- /** Label for the select field */
191
180
  label?: string | React_2.ReactNode;
192
- /** Custom class name for the label */
193
181
  labelClassName?: string;
194
- /** Placeholder text when no selection */
195
182
  placeholder?: string;
196
- /** Disable the entire select */
197
183
  disabled?: boolean;
198
- /** Custom width for the popover */
199
184
  width?: string | number;
200
- /** Custom class names */
201
185
  className?: string;
202
- /** Custom trigger button class names */
203
186
  triggerClassName?: string;
204
- /** Custom no results message */
205
187
  noResultsMessage?: string;
206
- /** Allow clearing the selection */
207
188
  clearable?: boolean;
208
189
  }
209
190
 
@@ -3,7 +3,7 @@ import { stringify as w } from "../../comma-separated-tokens/index.js";
3
3
  import { ok as u } from "../../devlop/lib/default.js";
4
4
  import { svg as m, html as C } from "../../property-information/index.js";
5
5
  import { stringify as N } from "../../space-separated-tokens/index.js";
6
- import S from "../../../_virtual/index5.js";
6
+ import S from "../../../_virtual/index4.js";
7
7
  import { whitespace as j } from "../../hast-util-whitespace/lib/index.js";
8
8
  import { name as x } from "../../estree-util-is-identifier-name/lib/index.js";
9
9
  import { VFileMessage as h } from "../../vfile-message/lib/index.js";
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { __module as e } from "../../_virtual/index4.js";
2
+ import { __module as e } from "../../_virtual/index6.js";
3
3
  import { __require as t } from "./cjs/react-is.production.min.js";
4
4
  import { __require as o } from "./cjs/react-is.development.js";
5
5
  var r;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { bail as P } from "../../bail/index.js";
3
- import y from "../../../_virtual/index6.js";
3
+ import y from "../../../_virtual/index5.js";
4
4
  import z from "../../is-plain-obj/index.js";
5
5
  import { CallableInstance as C } from "./callable-instance.js";
6
6
  import { trough as A } from "../../trough/lib/index.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "laif-ds",
3
3
  "private": false,
4
- "version": "0.1.49",
4
+ "version": "0.1.51",
5
5
  "type": "module",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",