laif-ds 0.1.30 → 0.1.32

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 (19) hide show
  1. package/dist/components/ui/app-multiple-select-dropdown.js +14 -14
  2. package/dist/components/ui/data-cross-table.js +112 -107
  3. package/dist/components/ui/data-table.js +42 -41
  4. package/dist/components/ui/dropdown-menu.js +131 -0
  5. package/dist/components/ui/table.js +3 -10
  6. package/dist/index.d.ts +18 -3
  7. package/dist/index.js +168 -161
  8. package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +217 -0
  9. package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-arrow/dist/index.js +25 -0
  10. package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-collection/dist/index.js +49 -0
  11. package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +128 -0
  12. package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-focus-scope/dist/index.js +138 -0
  13. package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-menu/dist/index.js +625 -0
  14. package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-popper/dist/index.js +221 -0
  15. package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-portal/dist/index.js +17 -0
  16. package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-primitive/dist/index.js +37 -0
  17. package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-roving-focus/dist/index.js +184 -0
  18. package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +55 -0
  19. package/package.json +1 -1
@@ -5,7 +5,7 @@ import { useEffect as A } from "react";
5
5
  import { cn as N } from "../../lib/utils.js";
6
6
  import { Label as B } from "./label.js";
7
7
  import { Badge as D } from "./badge.js";
8
- import { Button as h } from "./button.js";
8
+ import { Button as p } from "./button.js";
9
9
  import { Command as F, CommandList as P, CommandEmpty as G, CommandGroup as X, CommandItem as q } from "./command.js";
10
10
  import { Input as H } from "./input.js";
11
11
  import { Checkbox as I } from "./checkbox.js";
@@ -29,10 +29,10 @@ function ne({
29
29
  cancelButtonLabel: O = "Cancella",
30
30
  maxSelectedItems: s
31
31
  }) {
32
- const f = a.useId(), [c, b] = a.useState(!1), [m, v] = a.useState(""), p = a.useRef(null);
32
+ const f = a.useId(), [c, b] = a.useState(!1), [m, v] = a.useState(""), h = a.useRef(null);
33
33
  A(() => {
34
34
  const e = (n) => {
35
- p.current && !p.current.contains(n.target) && c && b(!1);
35
+ h.current && !h.current.contains(n.target) && c && b(!1);
36
36
  };
37
37
  return document.addEventListener("mousedown", e), () => {
38
38
  document.removeEventListener("mousedown", e);
@@ -46,11 +46,11 @@ function ne({
46
46
  return;
47
47
  i([...t, e]);
48
48
  }
49
- }, [t, i, s]), x = a.useCallback(() => {
49
+ }, [t, i, s]), w = a.useCallback(() => {
50
50
  i([]), v("");
51
51
  }, [i]), u = a.useMemo(() => o.filter((e) => t.includes(e.value)), [o, t]), j = a.useMemo(() => m ? o.filter(
52
52
  (e) => e.label.toLowerCase().includes(m.toLowerCase())
53
- ) : o, [o, m]), w = a.useMemo(() => s ? t.length >= s : !1, [t, s]);
53
+ ) : o, [o, m]), x = a.useMemo(() => s ? t.length >= s : !1, [t, s]);
54
54
  return /* @__PURE__ */ r(T.Provider, { value: { size: d, id: f }, children: /* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
55
55
  g && /* @__PURE__ */ r(
56
56
  B,
@@ -60,9 +60,9 @@ function ne({
60
60
  children: g
61
61
  }
62
62
  ),
63
- /* @__PURE__ */ l("div", { ref: p, className: "relative w-full", "data-slot": "app-multiple-select-dropdown", children: [
63
+ /* @__PURE__ */ l("div", { ref: h, className: "relative w-full", "data-slot": "app-multiple-select-dropdown", children: [
64
64
  /* @__PURE__ */ l(
65
- h,
65
+ p,
66
66
  {
67
67
  id: f,
68
68
  type: "button",
@@ -94,13 +94,13 @@ function ne({
94
94
  }
95
95
  ),
96
96
  /* @__PURE__ */ l(
97
- h,
97
+ p,
98
98
  {
99
99
  variant: "ghost",
100
100
  size: "sm",
101
101
  className: "h-5 w-5 p-0 hover:bg-d-secondary/20 rounded-full",
102
102
  onClick: (e) => {
103
- e.stopPropagation(), x();
103
+ e.stopPropagation(), w();
104
104
  },
105
105
  children: [
106
106
  /* @__PURE__ */ r(J, { className: "h-3 w-3" }),
@@ -122,16 +122,16 @@ function ne({
122
122
  placeholder: z,
123
123
  value: m,
124
124
  onChange: (e) => v(e.target.value),
125
- className: "w-full !border-0 !border-none !outline-none focus-visible:ring-0"
125
+ className: "w-full !border-0 !border-none !outline-none focus-visible:ring-0 shadow-none"
126
126
  }
127
127
  ),
128
128
  u.length > 0 && /* @__PURE__ */ r(
129
- h,
129
+ p,
130
130
  {
131
131
  variant: "ghost",
132
132
  size: "sm",
133
133
  className: "h-6 px-2 text-xs",
134
- onClick: x,
134
+ onClick: w,
135
135
  children: O
136
136
  }
137
137
  )
@@ -144,11 +144,11 @@ function ne({
144
144
  q,
145
145
  {
146
146
  value: e.value,
147
- disabled: e.disabled || !n && w,
147
+ disabled: e.disabled || !n && x,
148
148
  onSelect: () => S(e.value),
149
149
  className: N(
150
150
  "flex items-center gap-2 px-2 py-1.5 aria-selected:bg-d-accent aria-selected:text-d-accent-foreground cursor-pointer",
151
- (e.disabled || !n && w) && "cursor-not-allowed opacity-50"
151
+ (e.disabled || !n && x) && "cursor-not-allowed opacity-50"
152
152
  ),
153
153
  children: [
154
154
  /* @__PURE__ */ r(
@@ -1,97 +1,95 @@
1
1
  "use client";
2
- import { jsxs as y, jsx as o } from "react/jsx-runtime";
3
- import { useState as T, useMemo as N } from "react";
4
- import { useReactTable as J, flexRender as D } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
5
- import { TableSkeleton as K } from "./table-skeleton.js";
6
- import { Button as M } from "./button.js";
7
- import { TooltipProvider as Q, Tooltip as X, TooltipTrigger as Y, TooltipContent as Z } from "./tooltip.js";
8
- import { TableRow as R, TableCell as L, Table as _, TableHeader as W, TableHead as H, TableBody as z } from "./table.js";
9
- import { getSortedRowModel as F, getCoreRowModel as ee } from "../../node_modules/@tanstack/table-core/build/lib/index.js";
10
- function x({ text: u, maxLength: c, className: g = "" }) {
11
- return !u || u.length <= c ? /* @__PURE__ */ o("div", { className: g, children: u }) : /* @__PURE__ */ o(Q, { children: /* @__PURE__ */ y(X, { children: [
12
- /* @__PURE__ */ o(Y, { asChild: !0, children: /* @__PURE__ */ y("div", { className: `truncate ${g} cursor-pointer`, children: [
13
- u.substring(0, c),
2
+ import { jsxs as b, jsx as o } from "react/jsx-runtime";
3
+ import { useState as C, useMemo as S } from "react";
4
+ import { useReactTable as P, flexRender as V } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
5
+ import { TableSkeleton as U } from "./table-skeleton.js";
6
+ import { Button as j } from "./button.js";
7
+ import { TooltipProvider as q, Tooltip as G, TooltipTrigger as J, TooltipContent as K } from "./tooltip.js";
8
+ import { TableRow as T, TableCell as A, Table as Q, TableHeader as X, TableHead as Y, TableBody as Z } from "./table.js";
9
+ import { getSortedRowModel as _, getCoreRowModel as W } from "../../node_modules/@tanstack/table-core/build/lib/index.js";
10
+ function v({ text: c, maxLength: a, className: h = "" }) {
11
+ return !c || c.length <= a ? /* @__PURE__ */ o("div", { className: h, children: c }) : /* @__PURE__ */ o(q, { children: /* @__PURE__ */ b(G, { children: [
12
+ /* @__PURE__ */ o(J, { asChild: !0, children: /* @__PURE__ */ b("div", { className: `truncate ${h} cursor-pointer`, children: [
13
+ c.substring(0, a),
14
14
  "..."
15
15
  ] }) }),
16
- /* @__PURE__ */ o(Z, { children: /* @__PURE__ */ o("p", { children: u }) })
16
+ /* @__PURE__ */ o(K, { children: /* @__PURE__ */ o("p", { children: c }) })
17
17
  ] }) });
18
18
  }
19
19
  function ie({
20
- crossTableData: u,
21
- filterable: c = !1,
22
- loading: g = !1,
23
- emptyComponent: $,
24
- className: k,
25
- notFoundMessage: I = "Nessun risultato trovato.",
26
- cornerHeaderFrom: w = "Da",
27
- cornerHeaderTo: S = "A",
28
- maxHeaderLength: v = 15,
29
- minWidthCell: V = 160,
30
- initialFreezeColumn: i = !0,
31
- initialFreezeRow: b = !1
20
+ crossTableData: c,
21
+ filterable: a = !1,
22
+ loading: h = !1,
23
+ emptyComponent: D,
24
+ className: N,
25
+ notFoundMessage: M = "Nessun risultato trovato.",
26
+ cornerHeaderFrom: x = "Da",
27
+ cornerHeaderTo: w = "A",
28
+ maxHeaderLength: g = 15,
29
+ minWidthCell: R = 160
32
30
  }) {
33
- const [B, E] = T([]), { headerTop: f, headerLeft: h, data: p } = u, [m, O] = T(null), [C, j] = T(!0), P = (n) => n && typeof n == "object" && "value" in n ? n.value : n, d = N(() => {
34
- if (!m) return f;
35
- const n = h.indexOf(m);
36
- if (n === -1) return f;
37
- const r = f.map((e, t) => {
38
- var a;
39
- const s = ((a = p[n]) == null ? void 0 : a[t]) ?? null, l = P(s);
31
+ const [L, $] = C([]), { headerTop: d, headerLeft: m, data: f } = c, [p, I] = C(null), [y, k] = C(!0), B = (n) => n && typeof n == "object" && "value" in n ? n.value : n, u = S(() => {
32
+ if (!p) return d;
33
+ const n = m.indexOf(p);
34
+ if (n === -1) return d;
35
+ const r = d.map((e, t) => {
36
+ var i;
37
+ const s = ((i = f[n]) == null ? void 0 : i[t]) ?? null, l = B(s);
40
38
  return { header: e, value: l };
41
39
  });
42
40
  return r.sort((e, t) => {
43
41
  if (typeof e.value == "number" && typeof t.value == "number")
44
- return C ? e.value - t.value : t.value - e.value;
42
+ return y ? e.value - t.value : t.value - e.value;
45
43
  const s = String(e.value ?? ""), l = String(t.value ?? "");
46
- return C ? s.localeCompare(l) : l.localeCompare(s);
44
+ return y ? s.localeCompare(l) : l.localeCompare(s);
47
45
  }), r.map((e) => e.header);
48
- }, [f, h, p, m, C]), U = N(() => {
46
+ }, [d, m, f, p, y]), F = S(() => {
49
47
  const n = [
50
48
  {
51
49
  id: "cross-header",
52
- header: () => /* @__PURE__ */ y("div", { className: "relative", children: [
53
- /* @__PURE__ */ o("div", { className: "absolute top-0 left-2 text-xs", children: w }),
54
- /* @__PURE__ */ o("div", { className: "absolute bottom-0 right-2 text-xs", children: S })
50
+ header: () => /* @__PURE__ */ b("div", { className: "relative", children: [
51
+ /* @__PURE__ */ o("div", { className: "absolute top-0 left-2 text-xs", children: x }),
52
+ /* @__PURE__ */ o("div", { className: "absolute bottom-0 right-2 text-xs", children: w })
55
53
  ] }),
56
54
  accessorFn: (r) => r.item,
57
55
  cell: (r) => {
58
56
  const e = r.getValue();
59
- if (!c)
60
- return /* @__PURE__ */ o(x, { text: e, maxLength: v, className: "text-left" });
61
- const t = m === e;
57
+ if (!a)
58
+ return /* @__PURE__ */ o(v, { text: e, maxLength: g, className: "text-left" });
59
+ const t = p === e;
62
60
  return /* @__PURE__ */ o(
63
- M,
61
+ j,
64
62
  {
65
63
  variant: "ghost",
66
64
  size: "sm",
67
65
  iconLeft: "ArrowLeftRight",
68
66
  className: "text-right",
69
67
  onClick: () => {
70
- c && (t ? j((s) => !s) : (O(e), j(!0)));
68
+ a && (t ? k((s) => !s) : (I(e), k(!0)));
71
69
  },
72
- children: /* @__PURE__ */ o(x, { text: e, maxLength: v })
70
+ children: /* @__PURE__ */ o(v, { text: e, maxLength: g })
73
71
  }
74
72
  );
75
73
  }
76
74
  }
77
75
  ];
78
- return d.forEach((r) => {
76
+ return u.forEach((r) => {
79
77
  n.push({
80
78
  id: r,
81
79
  accessorFn: (e) => e[r],
82
- header: ({ column: e }) => c ? /* @__PURE__ */ o(
83
- M,
80
+ header: ({ column: e }) => a ? /* @__PURE__ */ o(
81
+ j,
84
82
  {
85
83
  variant: "ghost",
86
84
  size: "sm",
87
85
  iconLeft: "ArrowUpDown",
88
- onClick: c ? () => e.toggleSorting(e.getIsSorted() === "asc") : void 0,
89
- children: /* @__PURE__ */ o(x, { text: r, maxLength: v })
86
+ onClick: a ? () => e.toggleSorting(e.getIsSorted() === "asc") : void 0,
87
+ children: /* @__PURE__ */ o(v, { text: r, maxLength: g })
90
88
  }
91
- ) : /* @__PURE__ */ o(x, { text: r, maxLength: v, className: "font-medium" }),
89
+ ) : /* @__PURE__ */ o(v, { text: r, maxLength: g, className: "font-medium" }),
92
90
  sortingFn: (e, t, s) => {
93
- let l = e.getValue(s), a = t.getValue(s);
94
- return l == null && a == null ? 0 : l == null ? 1 : a == null ? -1 : (l && typeof l == "object" && "value" in l && (l = l.value), a && typeof a == "object" && "value" in a && (a = a.value), typeof l == "number" && typeof a == "number" ? l - a : String(l).localeCompare(String(a)));
91
+ let l = e.getValue(s), i = t.getValue(s);
92
+ return l == null && i == null ? 0 : l == null ? 1 : i == null ? -1 : (l && typeof l == "object" && "value" in l && (l = l.value), i && typeof i == "object" && "value" in i && (i = i.value), typeof l == "number" && typeof i == "number" ? l - i : String(l).localeCompare(String(i)));
95
93
  },
96
94
  //NOTE Cell is responsible for rendering the cell of his column
97
95
  cell: (e) => {
@@ -100,79 +98,86 @@ function ie({
100
98
  }
101
99
  });
102
100
  }), n;
103
- }, [d, w, S, m, c]), q = N(() => h.map((n, r) => {
101
+ }, [u, x, w, p, a]), E = S(() => m.map((n, r) => {
104
102
  const e = { item: n };
105
- return d.forEach((t) => {
103
+ return u.forEach((t) => {
106
104
  var l;
107
- const s = f.indexOf(t);
108
- e[t] = s !== -1 ? ((l = p[r]) == null ? void 0 : l[s]) ?? null : null;
105
+ const s = d.indexOf(t);
106
+ e[t] = s !== -1 ? ((l = f[r]) == null ? void 0 : l[s]) ?? null : null;
109
107
  }), e;
110
- }), [h, d, p, f]), A = J({
111
- data: q,
112
- columns: U,
113
- state: { sorting: B },
114
- onSortingChange: E,
115
- getCoreRowModel: ee(),
116
- getSortedRowModel: F()
108
+ }), [m, u, f, d]), z = P({
109
+ data: E,
110
+ columns: F,
111
+ state: { sorting: L },
112
+ onSortingChange: $,
113
+ getCoreRowModel: W(),
114
+ getSortedRowModel: _()
117
115
  });
118
- if (!p || p.length === 0)
119
- return /* @__PURE__ */ o(R, { children: /* @__PURE__ */ o(L, { colSpan: d.length + 1, children: $ || I }) });
120
- if (g)
116
+ if (!f || f.length === 0)
117
+ return /* @__PURE__ */ o(T, { children: /* @__PURE__ */ o(A, { colSpan: u.length + 1, children: D || M }) });
118
+ if (h)
121
119
  return /* @__PURE__ */ o(
122
- K,
120
+ U,
123
121
  {
124
- headerRow: d,
125
- rowCount: h.length || 5,
126
- columnCount: d.length || 5,
127
- className: k,
128
- cornerHeaderFrom: w,
129
- cornerHeaderTo: S
122
+ headerRow: u,
123
+ rowCount: m.length || 5,
124
+ columnCount: u.length || 5,
125
+ className: N,
126
+ cornerHeaderFrom: x,
127
+ cornerHeaderTo: w
130
128
  }
131
129
  );
132
- const G = (n) => {
133
- const r = n.column.id === "cross-header", e = r && b, t = ["bg-d-secondary"];
134
- r && i || t.push("border-r"), r && i && t.push("sticky left-0"), b && t.push("sticky top-0 z-20"), e ? t.push("z-40") : r && i && t.push("z-30");
130
+ const O = (n) => {
131
+ const r = n.column.id === "cross-header", e = r, t = ["bg-d-secondary"];
132
+ r || t.push("border-r"), r && t.push("sticky left-0"), t.push("sticky top-0 z-20"), e ? t.push("z-40") : r && t.push("z-30");
135
133
  let s = "none";
136
- return r && i ? b ? s = "inset -1px 0 0 0 var(--d-border), 0 1px 0 0 var(--d-border)" : s = "inset -1px 0 0 0 var(--d-border)" : b && (s = "0 1px 0 0 var(--d-border)"), {
134
+ return r && (s = "inset -1px 0 0 0 var(--d-border), 0 1px 0 0 var(--d-border)"), {
137
135
  className: t.join(" "),
138
- style: { boxShadow: s, width: `${V}px` }
136
+ style: { boxShadow: s, width: `${R}px` }
139
137
  };
140
138
  };
141
- return /* @__PURE__ */ o("div", { className: `w-[900px] ${k || ""}`, children: /* @__PURE__ */ o("div", { className: "rounded-md border overflow-auto max-h-[600px]", children: /* @__PURE__ */ y(_, { className: "w-full table-fixed relative border-collapse", children: [
142
- /* @__PURE__ */ o(W, { children: A.getHeaderGroups().map((n) => /* @__PURE__ */ o(
143
- R,
139
+ return /* @__PURE__ */ o("div", { className: `w-[900px] ${N || ""}`, children: /* @__PURE__ */ o("div", { className: "rounded-md border overflow-auto max-h-[600px]", children: /* @__PURE__ */ b(Q, { className: "w-full table-fixed relative border-collapse", children: [
140
+ /* @__PURE__ */ o(
141
+ X,
144
142
  {
145
- className: i ? "sticky top-0 z-20 bg-d-secondary" : "",
146
- children: n.headers.map((r) => {
147
- const e = G(r);
148
- return /* @__PURE__ */ o(
149
- H,
150
- {
151
- className: e.className,
152
- style: e.style,
153
- children: r.isPlaceholder ? null : D(
154
- r.column.columnDef.header,
155
- r.getContext()
156
- )
157
- },
158
- r.id
159
- );
160
- })
161
- },
162
- n.id
163
- )) }),
164
- /* @__PURE__ */ o(z, { children: A.getRowModel().rows.map((n) => /* @__PURE__ */ o(R, { children: n.getVisibleCells().map((r, e) => {
165
- const t = e === 0, s = r.getValue(), l = t && i ? "var(--d-secondary)" : (s == null ? void 0 : s.color) || "transparent";
143
+ className: "sticky top-0 z-20 bg-d-secondary",
144
+ style: { boxShadow: "0 1px 0 0 var(--d-border)" },
145
+ children: z.getHeaderGroups().map((n) => /* @__PURE__ */ o(
146
+ T,
147
+ {
148
+ className: "sticky top-0 z-20 bg-d-secondary",
149
+ children: n.headers.map((r) => {
150
+ const e = O(r);
151
+ return /* @__PURE__ */ o(
152
+ Y,
153
+ {
154
+ className: e.className,
155
+ style: e.style,
156
+ children: r.isPlaceholder ? null : V(
157
+ r.column.columnDef.header,
158
+ r.getContext()
159
+ )
160
+ },
161
+ r.id
162
+ );
163
+ })
164
+ },
165
+ n.id
166
+ ))
167
+ }
168
+ ),
169
+ /* @__PURE__ */ o(Z, { children: z.getRowModel().rows.map((n) => /* @__PURE__ */ o(T, { children: n.getVisibleCells().map((r, e) => {
170
+ const t = e === 0, s = r.getValue(), l = t ? "var(--d-secondary)" : (s == null ? void 0 : s.color) || "transparent";
166
171
  return /* @__PURE__ */ o(
167
- L,
172
+ A,
168
173
  {
169
- className: `text-center ${t && i ? "sticky left-0 z-10" : "border-r"}`,
174
+ className: `text-center ${t ? "sticky left-0 z-10" : "border-r"}`,
170
175
  style: {
171
- boxShadow: t && i ? "inset -1px 0 0 0 var(--d-border)" : "none",
176
+ boxShadow: t ? "inset -1px 0 0 0 var(--d-border)" : "none",
172
177
  backgroundColor: l,
173
- width: `${V}px`
178
+ width: `${R}px`
174
179
  },
175
- children: D(
180
+ children: V(
176
181
  r.column.columnDef.cell,
177
182
  r.getContext()
178
183
  )
@@ -2,32 +2,33 @@
2
2
  import { jsx as l, jsxs as d } from "react/jsx-runtime";
3
3
  import { useReactTable as _, flexRender as b } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
4
4
  import j, { useState as i, useEffect as B } from "react";
5
- import { Checkbox as w } from "./checkbox.js";
6
- import { Input as L } from "./input.js";
7
- import { ScrollArea as E, ScrollBar as p } from "./scroll-area.js";
8
- import { Table as G, TableHeader as W, TableRow as r, TableHead as q, TableBody as J, TableCell as m } from "./table.js";
9
- import { Skeleton as K } from "./skeleton.js";
10
- import { getFilteredRowModel as O, getSortedRowModel as Q, getPaginationRowModel as U, getCoreRowModel as X } from "../../node_modules/@tanstack/table-core/build/lib/index.js";
11
- function re({
12
- columns: a,
5
+ import { cn as L } from "../../lib/utils.js";
6
+ import { Checkbox as p } from "./checkbox.js";
7
+ import { Input as E } from "./input.js";
8
+ import { ScrollArea as G, ScrollBar as w } from "./scroll-area.js";
9
+ import { Table as W, TableHeader as q, TableRow as r, TableHead as J, TableBody as K, TableCell as m } from "./table.js";
10
+ import { Skeleton as O } from "./skeleton.js";
11
+ import { getFilteredRowModel as Q, getSortedRowModel as U, getPaginationRowModel as X, getCoreRowModel as Y } from "../../node_modules/@tanstack/table-core/build/lib/index.js";
12
+ function se({
13
+ columns: n,
13
14
  data: g,
14
15
  loading: C = !1,
15
16
  emptyComponent: R,
16
17
  className: k,
17
- rowSelection: N = {},
18
+ rowSelection: x = {},
18
19
  onRowSelectionChange: u,
19
- checkable: n = !1,
20
+ checkable: a = !1,
20
21
  onCheckedRowsChange: c,
21
- notFoundMessage: x = "Nessun risultato trovato.",
22
+ notFoundMessage: y = "Nessun risultato trovato.",
22
23
  clientFilter: s = null,
23
- clientFilterPlaceholder: y = "Cerca..."
24
+ clientFilterPlaceholder: M = "Cerca..."
24
25
  }) {
25
26
  var h, S;
26
- const [M, v] = i([]), [T, $] = i([]), [z, D] = i({}), [F, V] = i({}), f = u ? N : F, A = u || V, H = j.useMemo(() => n ? [
27
+ const [N, v] = i([]), [T, z] = i([]), [D, F] = i({}), [V, $] = i({}), f = u ? x : V, A = u || $, H = j.useMemo(() => a ? [
27
28
  {
28
29
  id: "select",
29
30
  header: ({ table: t }) => /* @__PURE__ */ l("div", { className: "text-center", children: /* @__PURE__ */ l(
30
- w,
31
+ p,
31
32
  {
32
33
  checked: t.getIsAllPageRowsSelected(),
33
34
  onCheckedChange: (e) => t.toggleAllPageRowsSelected(!!e),
@@ -35,7 +36,7 @@ function re({
35
36
  }
36
37
  ) }),
37
38
  cell: ({ row: t }) => /* @__PURE__ */ l("div", { className: "text-center", children: /* @__PURE__ */ l(
38
- w,
39
+ p,
39
40
  {
40
41
  checked: t.getIsSelected(),
41
42
  onCheckedChange: (e) => t.toggleSelected(!!e),
@@ -45,36 +46,36 @@ function re({
45
46
  enableSorting: !1,
46
47
  enableHiding: !1
47
48
  },
48
- ...a
49
- ] : a, [a, n]), o = _({
49
+ ...n
50
+ ] : n, [n, a]), o = _({
50
51
  data: g,
51
52
  columns: H,
52
- getCoreRowModel: X(),
53
- getPaginationRowModel: U(),
53
+ getCoreRowModel: Y(),
54
+ getPaginationRowModel: X(),
54
55
  onSortingChange: v,
55
- getSortedRowModel: Q(),
56
- onColumnFiltersChange: $,
57
- getFilteredRowModel: O(),
58
- onColumnVisibilityChange: D,
56
+ getSortedRowModel: U(),
57
+ onColumnFiltersChange: z,
58
+ getFilteredRowModel: Q(),
59
+ onColumnVisibilityChange: F,
59
60
  onRowSelectionChange: A,
60
61
  state: {
61
- sorting: M,
62
+ sorting: N,
62
63
  columnFilters: T,
63
- columnVisibility: z,
64
+ columnVisibility: D,
64
65
  rowSelection: f
65
66
  }
66
67
  });
67
68
  return B(() => {
68
- if (c && n) {
69
+ if (c && a) {
69
70
  const t = o.getFilteredSelectedRowModel().rows.map((e) => e.original);
70
71
  c(t);
71
72
  }
72
- }, [o, c, n, f]), /* @__PURE__ */ d("div", { className: `w-full ${k}`, children: [
73
+ }, [o, c, a, f]), /* @__PURE__ */ d("div", { className: L("w-full h-full", k), children: [
73
74
  s && /* @__PURE__ */ l("div", { className: "flex items-center py-4", children: /* @__PURE__ */ l(
74
- L,
75
+ E,
75
76
  {
76
77
  iconLeft: "Search",
77
- placeholder: y ?? "Cerca...",
78
+ placeholder: M ?? "Cerca...",
78
79
  value: (h = o.getColumn(s)) == null ? void 0 : h.getFilterValue(),
79
80
  onChange: (t) => {
80
81
  var e;
@@ -83,12 +84,12 @@ function re({
83
84
  className: "max-w-sm"
84
85
  }
85
86
  ) }),
86
- /* @__PURE__ */ l("div", { className: "rounded-md border", children: /* @__PURE__ */ d(E, { className: "h-full w-full", children: [
87
- /* @__PURE__ */ l(p, { orientation: "horizontal" }),
88
- /* @__PURE__ */ l(p, { orientation: "vertical" }),
89
- /* @__PURE__ */ d(G, { children: [
90
- /* @__PURE__ */ l(W, { children: o.getHeaderGroups().map((t) => /* @__PURE__ */ l(r, { children: t.headers.map((e) => /* @__PURE__ */ l(
91
- q,
87
+ /* @__PURE__ */ d(G, { className: "h-full w-full rounded-md border", children: [
88
+ /* @__PURE__ */ l(w, { orientation: "horizontal" }),
89
+ /* @__PURE__ */ l(w, { orientation: "vertical" }),
90
+ /* @__PURE__ */ d(W, { children: [
91
+ /* @__PURE__ */ l(q, { children: o.getHeaderGroups().map((t) => /* @__PURE__ */ l(r, { children: t.headers.map((e) => /* @__PURE__ */ l(
92
+ J,
92
93
  {
93
94
  className: `${e.column.columnDef.sticky ? "sticky left-0 z-10 bg-d-background" : ""}`,
94
95
  children: e.isPlaceholder ? null : b(
@@ -98,11 +99,11 @@ function re({
98
99
  },
99
100
  e.id
100
101
  )) }, t.id)) }),
101
- /* @__PURE__ */ l(J, { children: C ? Array.from({ length: g.length || 8 }).map((t, e) => /* @__PURE__ */ l(r, { children: o.getHeaderGroups()[0].headers.map((P, I) => /* @__PURE__ */ l(
102
+ /* @__PURE__ */ l(K, { children: C ? Array.from({ length: g.length || 8 }).map((t, e) => /* @__PURE__ */ l(r, { children: o.getHeaderGroups()[0].headers.map((P, I) => /* @__PURE__ */ l(
102
103
  m,
103
104
  {
104
105
  className: `w-full ${P.column.columnDef.sticky ? "sticky left-0 z-10 bg-d-background" : ""}`,
105
- children: /* @__PURE__ */ l(K, { className: "h-6 w-full" })
106
+ children: /* @__PURE__ */ l(O, { className: "h-6 w-full" })
106
107
  },
107
108
  `skeleton-cell-${e}-${I}`
108
109
  )) }, `skeleton-row-${e}`)) : (S = o.getRowModel().rows) != null && S.length ? o.getRowModel().rows.map((t) => /* @__PURE__ */ l(
@@ -125,15 +126,15 @@ function re({
125
126
  )) : /* @__PURE__ */ l(r, { children: /* @__PURE__ */ l(
126
127
  m,
127
128
  {
128
- colSpan: a.length,
129
+ colSpan: n.length,
129
130
  className: "h-24 text-center",
130
- children: R || x
131
+ children: R || y
131
132
  }
132
133
  ) }) })
133
134
  ] })
134
- ] }) })
135
+ ] })
135
136
  ] });
136
137
  }
137
138
  export {
138
- re as DataTable
139
+ se as DataTable
139
140
  };