laif-ds 0.1.29 → 0.1.31

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 +77 -69
  2. package/dist/components/ui/data-cross-table.js +145 -172
  3. package/dist/components/ui/dropdown-menu.js +131 -0
  4. package/dist/components/ui/table.js +3 -10
  5. package/dist/index.d.ts +18 -3
  6. package/dist/index.js +168 -161
  7. package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +217 -0
  8. package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-arrow/dist/index.js +25 -0
  9. package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-collection/dist/index.js +49 -0
  10. package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +128 -0
  11. package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-focus-scope/dist/index.js +138 -0
  12. package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-menu/dist/index.js +625 -0
  13. package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-popper/dist/index.js +221 -0
  14. package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-portal/dist/index.js +17 -0
  15. package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-primitive/dist/index.js +37 -0
  16. package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-roving-focus/dist/index.js +184 -0
  17. package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +55 -0
  18. package/dist/styles.v3.css +1 -1
  19. package/package.json +1 -1
@@ -1,87 +1,89 @@
1
1
  "use client";
2
- import { jsx as r, jsxs as l, Fragment as A } from "react/jsx-runtime";
2
+ import { jsx as r, jsxs as l, Fragment as R } from "react/jsx-runtime";
3
3
  import * as a from "react";
4
- import { useEffect as B } from "react";
5
- import { cn as h } from "../../lib/utils.js";
6
- import { Label as D } from "./label.js";
7
- import { Badge as F } from "./badge.js";
8
- import { Button as b } from "./button.js";
9
- import { Command as P, CommandInput as G, CommandList as V, CommandEmpty as X, CommandGroup as q, CommandItem as H } from "./command.js";
10
- import I from "../../node_modules/lucide-react/dist/esm/icons/x.js";
11
- import J from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
12
- import y from "../../node_modules/lucide-react/dist/esm/icons/check.js";
13
- const K = a.createContext({ size: "default" });
14
- function te({
15
- options: d,
4
+ import { useEffect as A } from "react";
5
+ import { cn as N } from "../../lib/utils.js";
6
+ import { Label as B } from "./label.js";
7
+ import { Badge as D } from "./badge.js";
8
+ import { Button as p } from "./button.js";
9
+ import { Command as F, CommandList as P, CommandEmpty as G, CommandGroup as X, CommandItem as q } from "./command.js";
10
+ import { Input as H } from "./input.js";
11
+ import { Checkbox as I } from "./checkbox.js";
12
+ import J from "../../node_modules/lucide-react/dist/esm/icons/x.js";
13
+ import K from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
14
+ import Q from "../../node_modules/lucide-react/dist/esm/icons/check.js";
15
+ const T = a.createContext({ size: "default" });
16
+ function ne({
17
+ options: o,
16
18
  value: t,
17
- onChange: o,
19
+ onChange: i,
18
20
  placeholder: C = "Seleziona...",
19
21
  disabled: k = !1,
20
- size: c = "default",
22
+ size: d = "default",
21
23
  label: g,
22
- labelClassName: L,
23
- emptyMessage: M = "Nessun risultato trovato",
24
- className: j,
24
+ labelClassName: y,
25
+ emptyMessage: L = "Nessun risultato trovato",
26
+ className: M,
25
27
  filterPlaceholder: z = "Cerca...",
26
28
  cancelLabel: E = "Cancella selezione",
27
29
  cancelButtonLabel: O = "Cancella",
28
30
  maxSelectedItems: s
29
31
  }) {
30
- const f = a.useId(), [i, w] = a.useState(!1), [m, x] = a.useState(""), p = a.useRef(null);
31
- B(() => {
32
+ const f = a.useId(), [c, b] = a.useState(!1), [m, v] = a.useState(""), h = a.useRef(null);
33
+ A(() => {
32
34
  const e = (n) => {
33
- p.current && !p.current.contains(n.target) && i && w(!1);
35
+ h.current && !h.current.contains(n.target) && c && b(!1);
34
36
  };
35
37
  return document.addEventListener("mousedown", e), () => {
36
38
  document.removeEventListener("mousedown", e);
37
39
  };
38
- }, [i]);
39
- const R = a.useCallback((e) => {
40
+ }, [c]);
41
+ const S = a.useCallback((e) => {
40
42
  if (t.includes(e))
41
- o(t.filter((n) => n !== e));
43
+ i(t.filter((n) => n !== e));
42
44
  else {
43
45
  if (s && t.length >= s)
44
46
  return;
45
- o([...t, e]);
47
+ i([...t, e]);
46
48
  }
47
- }, [t, o, s]), v = a.useCallback(() => {
48
- o([]), x("");
49
- }, [o]), u = a.useMemo(() => d.filter((e) => t.includes(e.value)), [d, t]), S = a.useMemo(() => m ? d.filter(
49
+ }, [t, i, s]), w = a.useCallback(() => {
50
+ i([]), v("");
51
+ }, [i]), u = a.useMemo(() => o.filter((e) => t.includes(e.value)), [o, t]), j = a.useMemo(() => m ? o.filter(
50
52
  (e) => e.label.toLowerCase().includes(m.toLowerCase())
51
- ) : d, [d, m]), N = a.useMemo(() => s ? t.length >= s : !1, [t, s]);
52
- return /* @__PURE__ */ r(K.Provider, { value: { size: c, id: f }, children: /* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
53
+ ) : o, [o, m]), x = a.useMemo(() => s ? t.length >= s : !1, [t, s]);
54
+ return /* @__PURE__ */ r(T.Provider, { value: { size: d, id: f }, children: /* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
53
55
  g && /* @__PURE__ */ r(
54
- D,
56
+ B,
55
57
  {
56
58
  htmlFor: f,
57
- className: L,
59
+ className: y,
58
60
  children: g
59
61
  }
60
62
  ),
61
- /* @__PURE__ */ l("div", { ref: p, className: "relative w-full", "data-slot": "multiple-select-dropdown", children: [
63
+ /* @__PURE__ */ l("div", { ref: h, className: "relative w-full", "data-slot": "app-multiple-select-dropdown", children: [
62
64
  /* @__PURE__ */ l(
63
- b,
65
+ p,
64
66
  {
65
67
  id: f,
66
68
  type: "button",
67
69
  variant: "outline",
68
70
  role: "combobox",
69
- "aria-expanded": i,
71
+ "aria-expanded": c,
70
72
  disabled: k,
71
- className: h(
73
+ className: N(
72
74
  "relative w-full justify-between font-normal border",
73
75
  "flex items-center whitespace-nowrap rounded-md border border-d-input bg-transparent shadow-sm ring-offset-background focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
74
76
  "aria-invalid:ring-d-destructive/20 dark:aria-invalid:ring-d-destructive/40 aria-invalid:border-d-destructive",
75
- c === "default" && "h-9 px-3 py-2 text-sm",
76
- c === "sm" && "h-8 px-2 py-1 text-xs",
77
- c === "lg" && "h-10 px-4 py-2 text-lg",
78
- j
77
+ d === "default" && "h-9 px-3 py-2 text-sm",
78
+ d === "sm" && "h-8 px-2 py-1 text-xs",
79
+ d === "lg" && "h-10 px-4 py-2 text-lg",
80
+ M
79
81
  ),
80
- onClick: () => w(!i),
82
+ onClick: () => b(!c),
81
83
  children: [
82
- /* @__PURE__ */ r("div", { className: "flex items-center gap-2 w-full overflow-hidden", children: u.length > 0 ? /* @__PURE__ */ l(A, { children: [
84
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-2 w-full overflow-hidden", children: u.length > 0 ? /* @__PURE__ */ l(R, { children: [
83
85
  /* @__PURE__ */ l(
84
- F,
86
+ D,
85
87
  {
86
88
  variant: "secondary",
87
89
  className: "flex items-center gap-1",
@@ -92,68 +94,74 @@ function te({
92
94
  }
93
95
  ),
94
96
  /* @__PURE__ */ l(
95
- b,
97
+ p,
96
98
  {
97
99
  variant: "ghost",
98
100
  size: "sm",
99
101
  className: "h-5 w-5 p-0 hover:bg-d-secondary/20 rounded-full",
100
102
  onClick: (e) => {
101
- e.stopPropagation(), v();
103
+ e.stopPropagation(), w();
102
104
  },
103
105
  children: [
104
- /* @__PURE__ */ r(I, { className: "h-3 w-3" }),
106
+ /* @__PURE__ */ r(J, { className: "h-3 w-3" }),
105
107
  /* @__PURE__ */ r("span", { className: "sr-only", children: E })
106
108
  ]
107
109
  }
108
110
  )
109
111
  ] }) : /* @__PURE__ */ r("span", { className: "text-d-muted-foreground", children: C }) }),
110
- /* @__PURE__ */ r(J, { className: "h-4 w-4 opacity-50 shrink-0 ml-1" })
112
+ /* @__PURE__ */ r(K, { className: "h-4 w-4 opacity-50 shrink-0 ml-1" })
111
113
  ]
112
114
  }
113
115
  ),
114
- i && /* @__PURE__ */ r("div", { className: "absolute z-50 w-full mt-1", children: /* @__PURE__ */ l(P, { className: "w-full border rounded-md shadow-md bg-d-popover", children: [
115
- /* @__PURE__ */ l("div", { className: "flex items-center border-b px-3", children: [
116
+ c && /* @__PURE__ */ r("div", { className: "absolute z-50 w-full mt-1", children: /* @__PURE__ */ l(F, { className: "w-full rounded-md shadow-md bg-d-popover", children: [
117
+ /* @__PURE__ */ l("div", { className: "flex items-center px-3 border-b", children: [
116
118
  /* @__PURE__ */ r(
117
- G,
119
+ H,
118
120
  {
121
+ iconLeft: "Search",
119
122
  placeholder: z,
120
123
  value: m,
121
- onValueChange: x,
122
- className: "flex h-9 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-d-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 border-0"
124
+ onChange: (e) => v(e.target.value),
125
+ className: "w-full !border-0 !border-none !outline-none focus-visible:ring-0 shadow-none"
123
126
  }
124
127
  ),
125
128
  u.length > 0 && /* @__PURE__ */ r(
126
- b,
129
+ p,
127
130
  {
128
131
  variant: "ghost",
129
132
  size: "sm",
130
133
  className: "h-6 px-2 text-xs",
131
- onClick: v,
134
+ onClick: w,
132
135
  children: O
133
136
  }
134
137
  )
135
138
  ] }),
136
- /* @__PURE__ */ l(V, { className: "w-full", children: [
137
- /* @__PURE__ */ r(X, { children: M }),
138
- /* @__PURE__ */ r(q, { children: S.map((e) => {
139
+ /* @__PURE__ */ l(P, { className: "w-full max-h-60 overflow-auto", children: [
140
+ /* @__PURE__ */ r(G, { children: L }),
141
+ /* @__PURE__ */ r(X, { children: j.map((e) => {
139
142
  const n = t.includes(e.value);
140
143
  return /* @__PURE__ */ l(
141
- H,
144
+ q,
142
145
  {
143
146
  value: e.value,
144
- disabled: e.disabled || !n && N,
145
- onSelect: () => R(e.value),
146
- className: h(
147
+ disabled: e.disabled || !n && x,
148
+ onSelect: () => S(e.value),
149
+ className: N(
147
150
  "flex items-center gap-2 px-2 py-1.5 aria-selected:bg-d-accent aria-selected:text-d-accent-foreground cursor-pointer",
148
- (e.disabled || !n && N) && "cursor-not-allowed opacity-50"
151
+ (e.disabled || !n && x) && "cursor-not-allowed opacity-50"
149
152
  ),
150
153
  children: [
151
- /* @__PURE__ */ r("div", { className: h(
152
- "flex h-4 w-4 items-center justify-center rounded-sm border border-d-primary",
153
- n ? "bg-d-primary text-d-primary-foreground" : ""
154
- ), children: n && /* @__PURE__ */ r(y, { className: "h-3 w-3" }) }),
155
- /* @__PURE__ */ r("span", { children: e.label }),
156
- n && /* @__PURE__ */ r("span", { className: "ml-auto flex h-4 w-4 items-center justify-center", children: /* @__PURE__ */ r(y, { className: "h-4 w-4" }) })
154
+ /* @__PURE__ */ r(
155
+ I,
156
+ {
157
+ checked: n,
158
+ className: "flex-shrink-0 mr-2",
159
+ onCheckedChange: () => {
160
+ }
161
+ }
162
+ ),
163
+ /* @__PURE__ */ r("span", { className: "truncate flex-1", children: e.label }),
164
+ n && /* @__PURE__ */ r(Q, { className: "h-4 w-4 flex-shrink-0 ml-auto text-d-primary" })
157
165
  ]
158
166
  },
159
167
  e.value
@@ -165,5 +173,5 @@ function te({
165
173
  ] }) });
166
174
  }
167
175
  export {
168
- te as AppMultipleSelectDropdown
176
+ ne as AppMultipleSelectDropdown
169
177
  };
@@ -1,219 +1,192 @@
1
1
  "use client";
2
- import { jsxs as d, jsx as e } from "react/jsx-runtime";
3
- import { useState as b, useMemo as T } from "react";
4
- import { useReactTable as H, flexRender as B } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
5
- import { TableSkeleton as ee } from "./table-skeleton.js";
6
- import { Button as w } from "./button.js";
7
- import { TooltipProvider as k, Tooltip as A, TooltipTrigger as j, TooltipContent as D } from "./tooltip.js";
8
- import { Icon as F } from "./icon.js";
9
- import { TableRow as z, TableCell as I, Table as te, TableHeader as re, TableHead as oe, TableBody as ne } from "./table.js";
10
- import { getSortedRowModel as le, getCoreRowModel as se } from "../../node_modules/@tanstack/table-core/build/lib/index.js";
11
- function y({ text: m, maxLength: c, className: x = "" }) {
12
- return !m || m.length <= c ? /* @__PURE__ */ e("div", { className: x, children: m }) : /* @__PURE__ */ e(k, { children: /* @__PURE__ */ d(A, { children: [
13
- /* @__PURE__ */ e(j, { asChild: !0, children: /* @__PURE__ */ d("div", { className: `truncate ${x} cursor-pointer`, children: [
14
- m.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),
15
14
  "..."
16
15
  ] }) }),
17
- /* @__PURE__ */ e(D, { children: /* @__PURE__ */ e("p", { children: m }) })
16
+ /* @__PURE__ */ o(K, { children: /* @__PURE__ */ o("p", { children: c }) })
18
17
  ] }) });
19
18
  }
20
- function ge({
21
- crossTableData: m,
22
- filterable: c = !1,
23
- loading: x = !1,
24
- emptyComponent: E,
25
- className: V,
26
- notFoundMessage: O = "Nessun risultato trovato.",
27
- cornerHeaderFrom: S = "Da",
28
- cornerHeaderTo: N = "A",
29
- maxHeaderLength: C = 15,
30
- minWidthCell: $ = 160,
31
- initialFreezeColumn: P = !0,
32
- initialFreezeRow: U = !1,
33
- showFreezeControls: q = !0
19
+ function ie({
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
34
30
  }) {
35
- const [G, J] = b([]), { headerTop: h, headerLeft: g, data: p } = m, [v, K] = b(null), [R, L] = b(!0), [a, Q] = b(P), [u, X] = b(U), Y = (n) => n && typeof n == "object" && "value" in n ? n.value : n, f = T(() => {
36
- if (!v) return h;
37
- const n = g.indexOf(v);
38
- if (n === -1) return h;
39
- const o = h.map((t, r) => {
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) => {
40
36
  var i;
41
- const l = ((i = p[n]) == null ? void 0 : i[r]) ?? null, s = Y(l);
42
- return { header: t, value: s };
37
+ const s = ((i = f[n]) == null ? void 0 : i[t]) ?? null, l = B(s);
38
+ return { header: e, value: l };
43
39
  });
44
- return o.sort((t, r) => {
45
- if (typeof t.value == "number" && typeof r.value == "number")
46
- return R ? t.value - r.value : r.value - t.value;
47
- const l = String(t.value ?? ""), s = String(r.value ?? "");
48
- return R ? l.localeCompare(s) : s.localeCompare(l);
49
- }), o.map((t) => t.header);
50
- }, [h, g, p, v, R]), Z = T(() => {
40
+ return r.sort((e, t) => {
41
+ if (typeof e.value == "number" && typeof t.value == "number")
42
+ return y ? e.value - t.value : t.value - e.value;
43
+ const s = String(e.value ?? ""), l = String(t.value ?? "");
44
+ return y ? s.localeCompare(l) : l.localeCompare(s);
45
+ }), r.map((e) => e.header);
46
+ }, [d, m, f, p, y]), F = S(() => {
51
47
  const n = [
52
48
  {
53
49
  id: "cross-header",
54
- header: () => /* @__PURE__ */ d("div", { className: "relative", children: [
55
- /* @__PURE__ */ e("div", { className: "absolute top-0 left-2 text-xs", children: S }),
56
- /* @__PURE__ */ e("div", { className: "absolute bottom-0 right-2 text-xs", children: N })
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 })
57
53
  ] }),
58
- accessorFn: (o) => o.item,
59
- cell: (o) => {
60
- const t = o.getValue();
61
- if (!c)
62
- return /* @__PURE__ */ e(y, { text: t, maxLength: C, className: "text-left" });
63
- const r = v === t;
64
- return /* @__PURE__ */ e(
65
- w,
54
+ accessorFn: (r) => r.item,
55
+ cell: (r) => {
56
+ const e = r.getValue();
57
+ if (!a)
58
+ return /* @__PURE__ */ o(v, { text: e, maxLength: g, className: "text-left" });
59
+ const t = p === e;
60
+ return /* @__PURE__ */ o(
61
+ j,
66
62
  {
67
63
  variant: "ghost",
68
64
  size: "sm",
69
65
  iconLeft: "ArrowLeftRight",
70
66
  className: "text-right",
71
67
  onClick: () => {
72
- c && (r ? L((l) => !l) : (K(t), L(!0)));
68
+ a && (t ? k((s) => !s) : (I(e), k(!0)));
73
69
  },
74
- children: /* @__PURE__ */ e(y, { text: t, maxLength: C })
70
+ children: /* @__PURE__ */ o(v, { text: e, maxLength: g })
75
71
  }
76
72
  );
77
73
  }
78
74
  }
79
75
  ];
80
- return f.forEach((o) => {
76
+ return u.forEach((r) => {
81
77
  n.push({
82
- id: o,
83
- accessorFn: (t) => t[o],
84
- header: ({ column: t }) => c ? /* @__PURE__ */ e(
85
- w,
78
+ id: r,
79
+ accessorFn: (e) => e[r],
80
+ header: ({ column: e }) => a ? /* @__PURE__ */ o(
81
+ j,
86
82
  {
87
83
  variant: "ghost",
88
84
  size: "sm",
89
85
  iconLeft: "ArrowUpDown",
90
- onClick: c ? () => t.toggleSorting(t.getIsSorted() === "asc") : void 0,
91
- children: /* @__PURE__ */ e(y, { text: o, maxLength: C })
86
+ onClick: a ? () => e.toggleSorting(e.getIsSorted() === "asc") : void 0,
87
+ children: /* @__PURE__ */ o(v, { text: r, maxLength: g })
92
88
  }
93
- ) : /* @__PURE__ */ e(y, { text: o, maxLength: C, className: "font-medium" }),
94
- sortingFn: (t, r, l) => {
95
- let s = t.getValue(l), i = r.getValue(l);
96
- return s == null && i == null ? 0 : s == null ? 1 : i == null ? -1 : (s && typeof s == "object" && "value" in s && (s = s.value), i && typeof i == "object" && "value" in i && (i = i.value), typeof s == "number" && typeof i == "number" ? s - i : String(s).localeCompare(String(i)));
89
+ ) : /* @__PURE__ */ o(v, { text: r, maxLength: g, className: "font-medium" }),
90
+ sortingFn: (e, t, s) => {
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)));
97
93
  },
98
94
  //NOTE Cell is responsible for rendering the cell of his column
99
- cell: (t) => {
100
- const r = t.getValue();
101
- return r ? r.render ? r.render(r.fromId, r.toId) : /* @__PURE__ */ e("div", { children: r.value }) : null;
95
+ cell: (e) => {
96
+ const t = e.getValue();
97
+ return t ? t.render ? t.render(t.fromId, t.toId) : /* @__PURE__ */ o("div", { children: t.value }) : null;
102
98
  }
103
99
  });
104
100
  }), n;
105
- }, [f, S, N, v, c]), _ = T(() => g.map((n, o) => {
106
- const t = { item: n };
107
- return f.forEach((r) => {
108
- var s;
109
- const l = h.indexOf(r);
110
- t[r] = l !== -1 ? ((s = p[o]) == null ? void 0 : s[l]) ?? null : null;
111
- }), t;
112
- }), [g, f, p, h]), M = H({
113
- data: _,
114
- columns: Z,
115
- state: { sorting: G },
116
- onSortingChange: J,
117
- getCoreRowModel: se(),
118
- getSortedRowModel: le()
101
+ }, [u, x, w, p, a]), E = S(() => m.map((n, r) => {
102
+ const e = { item: n };
103
+ return u.forEach((t) => {
104
+ var l;
105
+ const s = d.indexOf(t);
106
+ e[t] = s !== -1 ? ((l = f[r]) == null ? void 0 : l[s]) ?? null : null;
107
+ }), e;
108
+ }), [m, u, f, d]), z = P({
109
+ data: E,
110
+ columns: F,
111
+ state: { sorting: L },
112
+ onSortingChange: $,
113
+ getCoreRowModel: W(),
114
+ getSortedRowModel: _()
119
115
  });
120
- if (!p || p.length === 0)
121
- return /* @__PURE__ */ e(z, { children: /* @__PURE__ */ e(I, { colSpan: f.length + 1, children: E || O }) });
122
- if (x)
123
- return /* @__PURE__ */ e(
124
- ee,
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)
119
+ return /* @__PURE__ */ o(
120
+ U,
125
121
  {
126
- headerRow: f,
127
- rowCount: g.length || 5,
128
- columnCount: f.length || 5,
129
- className: V,
130
- cornerHeaderFrom: S,
131
- cornerHeaderTo: N
122
+ headerRow: u,
123
+ rowCount: m.length || 5,
124
+ columnCount: u.length || 5,
125
+ className: N,
126
+ cornerHeaderFrom: x,
127
+ cornerHeaderTo: w
132
128
  }
133
129
  );
134
- const W = (n) => {
135
- const o = n.column.id === "cross-header", t = o && u, r = ["bg-d-secondary"];
136
- o && a || r.push("border-r"), o && a && r.push("sticky left-0"), u && r.push("sticky top-0 z-20"), t ? r.push("z-40") : o && a && r.push("z-30");
137
- let l = "none";
138
- return o && a ? u ? l = "inset -1px 0 0 0 var(--d-border), 0 1px 0 0 var(--d-border)" : l = "inset -1px 0 0 0 var(--d-border)" : u && (l = "0 1px 0 0 var(--d-border)"), {
139
- className: r.join(" "),
140
- style: { boxShadow: l, width: `${$}px` }
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");
133
+ let s = "none";
134
+ return r && (s = "inset -1px 0 0 0 var(--d-border), 0 1px 0 0 var(--d-border)"), {
135
+ className: t.join(" "),
136
+ style: { boxShadow: s, width: `${R}px` }
141
137
  };
142
138
  };
143
- return /* @__PURE__ */ d("div", { className: `w-[900px] ${V || ""}`, children: [
144
- q && /* @__PURE__ */ e("div", { className: "flex items-center justify-start mb-1", children: /* @__PURE__ */ d("div", { className: "flex items-center gap-1", children: [
145
- /* @__PURE__ */ e(k, { children: /* @__PURE__ */ d(A, { children: [
146
- /* @__PURE__ */ e(j, { asChild: !0, children: /* @__PURE__ */ e(
147
- w,
148
- {
149
- variant: a ? "default" : "outline",
150
- size: "sm",
151
- className: `p-0.5 h-6 ${a ? "font-medium" : "text-d-muted-foreground"}`,
152
- onClick: () => Q(!a),
153
- children: /* @__PURE__ */ e(F, { name: "ArrowLeftRight", size: "xs" })
154
- }
155
- ) }),
156
- /* @__PURE__ */ e(D, { side: "top", align: "center", children: a ? "Sblocca colonna sinistra" : "Blocca colonna sinistra" })
157
- ] }) }),
158
- /* @__PURE__ */ e(k, { children: /* @__PURE__ */ d(A, { children: [
159
- /* @__PURE__ */ e(j, { asChild: !0, children: /* @__PURE__ */ e(
160
- w,
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,
142
+ {
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,
161
147
  {
162
- variant: u ? "default" : "outline",
163
- size: "sm",
164
- className: `p-0.5 h-6 ${u ? "font-medium" : "text-d-muted-foreground"}`,
165
- onClick: () => X(!u),
166
- children: /* @__PURE__ */ e(F, { name: "ArrowUpDown", size: "xs" })
167
- }
168
- ) }),
169
- /* @__PURE__ */ e(D, { side: "top", align: "center", children: u ? "Sblocca riga superiore" : "Blocca riga superiore" })
170
- ] }) })
171
- ] }) }),
172
- /* @__PURE__ */ e("div", { className: "rounded-md border overflow-auto max-h-[600px]", children: /* @__PURE__ */ d(te, { className: "w-full table-fixed relative border-collapse", children: [
173
- /* @__PURE__ */ e(re, { children: M.getHeaderGroups().map((n) => /* @__PURE__ */ e(
174
- z,
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";
171
+ return /* @__PURE__ */ o(
172
+ A,
175
173
  {
176
- className: a ? "sticky top-0 z-20 bg-d-secondary" : "",
177
- children: n.headers.map((o) => {
178
- const t = W(o);
179
- return /* @__PURE__ */ e(
180
- oe,
181
- {
182
- className: t.className,
183
- style: t.style,
184
- children: o.isPlaceholder ? null : B(
185
- o.column.columnDef.header,
186
- o.getContext()
187
- )
188
- },
189
- o.id
190
- );
191
- })
192
- },
193
- n.id
194
- )) }),
195
- /* @__PURE__ */ e(ne, { children: M.getRowModel().rows.map((n) => /* @__PURE__ */ e(z, { children: n.getVisibleCells().map((o, t) => {
196
- const r = t === 0, l = o.getValue(), s = r && a ? "var(--d-secondary)" : (l == null ? void 0 : l.color) || "transparent";
197
- return /* @__PURE__ */ e(
198
- I,
199
- {
200
- className: `text-center ${r && a ? "sticky left-0 z-10" : "border-r"}`,
201
- style: {
202
- boxShadow: r && a ? "inset -1px 0 0 0 var(--d-border)" : "none",
203
- backgroundColor: s,
204
- width: `${$}px`
205
- },
206
- children: B(
207
- o.column.columnDef.cell,
208
- o.getContext()
209
- )
174
+ className: `text-center ${t ? "sticky left-0 z-10" : "border-r"}`,
175
+ style: {
176
+ boxShadow: t ? "inset -1px 0 0 0 var(--d-border)" : "none",
177
+ backgroundColor: l,
178
+ width: `${R}px`
210
179
  },
211
- o.id
212
- );
213
- }) }, n.id)) })
214
- ] }) })
215
- ] });
180
+ children: V(
181
+ r.column.columnDef.cell,
182
+ r.getContext()
183
+ )
184
+ },
185
+ r.id
186
+ );
187
+ }) }, n.id)) })
188
+ ] }) }) });
216
189
  }
217
190
  export {
218
- ge as DataCrossTable
191
+ ie as DataCrossTable
219
192
  };