laif-ds 0.1.37 → 0.1.38

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,75 +1,75 @@
1
1
  "use client";
2
- import { jsxs as O, jsx as i } from "react/jsx-runtime";
3
- import { useState as g, useEffect as Y, useMemo as B, useRef as ce } from "react";
2
+ import { jsxs as B, jsx as i } from "react/jsx-runtime";
3
+ import { useState as g, useEffect as Y, useMemo as F, useRef as ce } from "react";
4
4
  import { useReactTable as fe, flexRender as q } from "../../../../node_modules/@tanstack/react-table/build/lib/index.js";
5
5
  import { useVirtualizer as me } from "../../../../node_modules/@tanstack/react-virtual/dist/esm/index.js";
6
6
  import { TableSkeleton as pe } from "../../table-skeleton.js";
7
- import { TruncatedText as I } from "./truncated-text.js";
7
+ import { TruncatedText as N } from "./truncated-text.js";
8
8
  import { EditControls as ge } from "./edit-controls.js";
9
9
  import { EditableInput as he } from "./editable-input.js";
10
10
  import { Button as G } from "../../button.js";
11
- import { TableRow as F, TableCell as J, Table as xe, TableHeader as be, TableHead as ve, TableBody as ye } from "../../table.js";
11
+ import { TableRow as _, TableCell as J, Table as xe, TableHeader as be, TableHead as ve, TableBody as ye } from "../../table.js";
12
12
  import { getSortedRowModel as Ce, getCoreRowModel as Se } from "../../../../node_modules/@tanstack/table-core/build/lib/index.js";
13
- function De({
14
- crossTableData: N,
13
+ function Ae({
14
+ crossTableData: z,
15
15
  filterable: h = !1,
16
16
  loading: Q = !1,
17
17
  emptyComponent: X,
18
- className: z,
18
+ className: T,
19
19
  notFoundMessage: Z = "Nessun risultato trovato.",
20
- cornerHeaderFrom: T = "Da",
21
- cornerHeaderTo: j = "A",
20
+ cornerHeaderFrom: D = "Da",
21
+ cornerHeaderTo: V = "A",
22
22
  maxHeaderLength: x = 15,
23
- minWidthCell: k = 160,
24
- editable: V = !1,
23
+ minWidthCell: E = 160,
24
+ editable: M = !1,
25
25
  editMode: H = !1,
26
26
  editConfirmLabel: W = "Conferma",
27
27
  editCancelLabel: ee = "Annulla",
28
- onConfirmedCells: R,
29
- onEditModeChange: E,
30
- onSelectedRow: _,
28
+ onConfirmedCells: w,
29
+ onEditModeChange: $,
30
+ onSelectedRow: K,
31
31
  selectedRow: a,
32
32
  rowSortAsc: te = !0
33
33
  }) {
34
- const [re, oe] = g([]), u = N.headerTop, d = N.headerLeft, f = N.data, [b, $] = g(
34
+ const [re, oe] = g([]), u = z.headerTop, d = z.headerLeft, m = z.data, [b, A] = g(
35
35
  (a == null ? void 0 : a.id) ?? null
36
- ), [A, M] = g(te), [S, ne] = g(V && H);
36
+ ), [L, O] = g(te), [I, ne] = g(M && H);
37
37
  Y(() => {
38
- E && E(!!S);
39
- }, [S, E]), Y(() => {
40
- a != null && a.id && $(a.id);
38
+ $ && $(!!I);
39
+ }, [I, $]), Y(() => {
40
+ a != null && a.id && A(a.id);
41
41
  }, [a]);
42
- const [v, w] = g({}), [K, D] = g({}), le = (l) => l && typeof l == "object" && "value" in l ? l.value : l, c = B(() => {
42
+ const [v, j] = g({}), [y, k] = g({}), le = (l) => l && typeof l == "object" && "value" in l ? l.value : l, c = F(() => {
43
43
  if (!b || !d.find((e) => e.id === b)) return u;
44
44
  const t = d.findIndex(
45
45
  (e) => e.id === b
46
46
  );
47
47
  if (t === -1) return u;
48
- const r = u.map((e, s) => {
49
- var m;
50
- const o = ((m = f[t]) == null ? void 0 : m[s]) ?? null, n = le(o);
51
- return { header: e, value: n };
48
+ const r = u.map((e, n) => {
49
+ var f;
50
+ const o = ((f = m[t]) == null ? void 0 : f[n]) ?? null, s = le(o);
51
+ return { header: e, value: s };
52
52
  });
53
- return r.sort((e, s) => {
54
- if (typeof e.value == "number" && typeof s.value == "number")
55
- return A ? e.value - s.value : s.value - e.value;
56
- const o = String(e.value ?? ""), n = String(s.value ?? "");
57
- return A ? o.localeCompare(n) : n.localeCompare(o);
53
+ return r.sort((e, n) => {
54
+ if (typeof e.value == "number" && typeof n.value == "number")
55
+ return L ? e.value - n.value : n.value - e.value;
56
+ const o = String(e.value ?? ""), s = String(n.value ?? "");
57
+ return L ? o.localeCompare(s) : s.localeCompare(o);
58
58
  }), r.map((e) => e.header);
59
- }, [u, d, f, b, A]), se = B(() => {
59
+ }, [u, d, m, b, L]), se = F(() => {
60
60
  const l = [
61
61
  {
62
62
  id: "cross-header",
63
- header: () => /* @__PURE__ */ O("div", { className: "relative", children: [
64
- /* @__PURE__ */ i("div", { className: "absolute top-0 left-2 text-xs", children: T }),
65
- /* @__PURE__ */ i("div", { className: "absolute right-2 bottom-0 text-xs", children: j })
63
+ header: () => /* @__PURE__ */ B("div", { className: "relative", children: [
64
+ /* @__PURE__ */ i("div", { className: "absolute top-0 left-2 text-xs", children: D }),
65
+ /* @__PURE__ */ i("div", { className: "absolute right-2 bottom-0 text-xs", children: V })
66
66
  ] }),
67
67
  accessorFn: (t) => t.item,
68
68
  cell: (t) => {
69
69
  const r = t.getValue();
70
70
  if (!h)
71
71
  return /* @__PURE__ */ i(
72
- I,
72
+ N,
73
73
  {
74
74
  text: r.label,
75
75
  maxLength: x,
@@ -85,9 +85,9 @@ function De({
85
85
  iconLeft: "ArrowLeftRight",
86
86
  className: "text-right",
87
87
  onClick: () => {
88
- h && (e ? M((s) => !s) : ($(d[t.row.index].id), M(!0), _ && _(d[t.row.index])));
88
+ h && (e ? O((n) => !n) : (A(d[t.row.index].id), O(!0), K && K(d[t.row.index])));
89
89
  },
90
- children: /* @__PURE__ */ i(I, { text: r.label, maxLength: x })
90
+ children: /* @__PURE__ */ i(N, { text: r.label, maxLength: x })
91
91
  }
92
92
  );
93
93
  }
@@ -104,19 +104,19 @@ function De({
104
104
  size: "sm",
105
105
  iconLeft: "ArrowUpDown",
106
106
  onClick: h ? () => r.toggleSorting(r.getIsSorted() === "asc") : void 0,
107
- children: /* @__PURE__ */ i(I, { text: t.label, maxLength: x })
107
+ children: /* @__PURE__ */ i(N, { text: t.label, maxLength: x })
108
108
  }
109
109
  ) : /* @__PURE__ */ i(
110
- I,
110
+ N,
111
111
  {
112
112
  text: t.label,
113
113
  maxLength: x,
114
114
  className: "font-medium"
115
115
  }
116
116
  ),
117
- sortingFn: (r, e, s) => {
118
- let o = r.getValue(s), n = e.getValue(s);
119
- return o == null && n == null ? 0 : o == null ? 1 : n == null ? -1 : (o && typeof o == "object" && "value" in o && (o = o.value), n && typeof n == "object" && "value" in n && (n = n.value), typeof o == "number" && typeof n == "number" ? o - n : String(o).localeCompare(String(n)));
117
+ sortingFn: (r, e, n) => {
118
+ let o = r.getValue(n), s = e.getValue(n);
119
+ return o == null && s == null ? 0 : o == null ? 1 : s == null ? -1 : (o && typeof o == "object" && "value" in o && (o = o.value), s && typeof s == "object" && "value" in s && (s = s.value), typeof o == "number" && typeof s == "number" ? o - s : String(o).localeCompare(String(s)));
120
120
  },
121
121
  cell: (r) => {
122
122
  const e = r.getValue();
@@ -126,21 +126,21 @@ function De({
126
126
  }), l;
127
127
  }, [
128
128
  c,
129
- T,
130
- j,
129
+ D,
130
+ V,
131
131
  a,
132
132
  h,
133
133
  x,
134
- $,
135
- M
136
- ]), ie = B(() => d.map((l, t) => {
134
+ A,
135
+ O
136
+ ]), ie = F(() => d.map((l, t) => {
137
137
  const r = { item: l };
138
138
  return c.forEach((e) => {
139
139
  var o;
140
- const s = u.findIndex((n) => n.id === e.id);
141
- r[e.id] = s !== -1 ? ((o = f[t]) == null ? void 0 : o[s]) ?? null : null;
140
+ const n = u.findIndex((s) => s.id === e.id);
141
+ r[e.id] = n !== -1 ? ((o = m[t]) == null ? void 0 : o[n]) ?? null : null;
142
142
  }), r;
143
- }), [d, c, f, u]), L = fe({
143
+ }), [d, c, m, u]), R = fe({
144
144
  data: ie,
145
145
  columns: se,
146
146
  state: { sorting: re },
@@ -148,8 +148,8 @@ function De({
148
148
  getCoreRowModel: Se(),
149
149
  getSortedRowModel: Ce()
150
150
  });
151
- if (!f || f.length === 0)
152
- return /* @__PURE__ */ i("div", { className: z, children: /* @__PURE__ */ i(F, { children: /* @__PURE__ */ i(J, { colSpan: c.length + 1, children: X || Z }) }) });
151
+ if (!m || m.length === 0)
152
+ return /* @__PURE__ */ i("div", { className: T, children: /* @__PURE__ */ i(_, { children: /* @__PURE__ */ i(J, { colSpan: c.length + 1, children: X || Z }) }) });
153
153
  if (Q)
154
154
  return /* @__PURE__ */ i(
155
155
  pe,
@@ -157,62 +157,81 @@ function De({
157
157
  headerRow: c.map((l) => l.label),
158
158
  rowCount: d.length || 5,
159
159
  columnCount: c.length || 5,
160
- className: z,
161
- cornerHeaderFrom: T,
162
- cornerHeaderTo: j
160
+ className: T,
161
+ cornerHeaderFrom: D,
162
+ cornerHeaderTo: V
163
163
  }
164
164
  );
165
165
  const ae = (l) => {
166
166
  const t = l.column.id === "cross-header", r = t, e = ["bg-d-secondary"];
167
167
  t || e.push("border-r"), t && e.push("sticky left-0"), e.push("sticky top-0 z-20"), r ? e.push("z-40") : t && e.push("z-30");
168
- let s = "none";
169
- return t && (s = "inset -1px 0 0 0 var(--d-border), 0 1px 0 0 var(--d-border)"), {
168
+ let n = "none";
169
+ return t && (n = "inset -1px 0 0 0 var(--d-border), 0 1px 0 0 var(--d-border)"), {
170
170
  className: e.join(" "),
171
- style: { boxShadow: s, width: `${k}px` }
171
+ style: { boxShadow: n, width: `${E}px` }
172
172
  };
173
173
  }, P = ce(null), U = me({
174
- count: L.getRowModel().rows.length,
174
+ count: R.getRowModel().rows.length,
175
175
  getScrollElement: () => P.current,
176
176
  estimateSize: () => 40,
177
177
  overscan: 5,
178
178
  measureElement: typeof window < "u" ? (l) => l.getBoundingClientRect().height : void 0
179
179
  });
180
- return /* @__PURE__ */ O("div", { className: `w-[900px] ${z || ""}`, children: [
181
- V && /* @__PURE__ */ i(
180
+ return /* @__PURE__ */ B("div", { className: `w-[900px] ${T || ""}`, children: [
181
+ M && /* @__PURE__ */ i(
182
182
  ge,
183
183
  {
184
- editable: V,
184
+ editable: M,
185
185
  editConfirmLabel: W,
186
186
  editCancelLabel: ee,
187
- editMode: S,
187
+ editRestoreDefaultLabel: "Ripristina Default",
188
+ editMode: I,
188
189
  setEditMode: ne,
189
190
  editedCount: Object.keys(v).length,
190
- confirmAll: () => {
191
- if (R && (Object.keys(v).length > 0 || Object.keys(K).length > 0)) {
192
- const t = Object.entries(v).map(
193
- ([s, { value: o, cell: n }]) => ({
191
+ defaultCount: Object.keys(y).length,
192
+ restoreDefault: () => {
193
+ if (w) {
194
+ const l = Object.entries(y).map(
195
+ ([r, { value: e, cell: n }]) => ({
194
196
  fromId: n.fromId,
195
197
  toId: n.toId,
196
198
  id: n.id,
199
+ value: e
200
+ })
201
+ );
202
+ w({
203
+ editedCells: [],
204
+ toDefaultCells: l
205
+ });
206
+ }
207
+ k({});
208
+ },
209
+ confirmAll: () => {
210
+ if (w && (Object.keys(v).length > 0 || Object.keys(y).length > 0)) {
211
+ const t = Object.entries(v).map(
212
+ ([n, { value: o, cell: s }]) => ({
213
+ fromId: s.fromId,
214
+ toId: s.toId,
215
+ id: s.id,
197
216
  value: o
198
217
  })
199
- ), r = Object.entries(K).map(
200
- ([s, { value: o, cell: n }]) => ({
201
- fromId: n.fromId,
202
- toId: n.toId,
203
- id: n.id,
218
+ ), r = Object.entries(y).map(
219
+ ([n, { value: o, cell: s }]) => ({
220
+ fromId: s.fromId,
221
+ toId: s.toId,
222
+ id: s.id,
204
223
  value: o
205
224
  })
206
225
  );
207
- R({
226
+ w({
208
227
  editedCells: t,
209
228
  toDefaultCells: r
210
229
  });
211
230
  }
212
- w({}), D({});
231
+ j({}), k({});
213
232
  },
214
233
  cancelAll: () => {
215
- w({}), D({});
234
+ j({}), k({});
216
235
  }
217
236
  }
218
237
  ),
@@ -221,14 +240,14 @@ function De({
221
240
  {
222
241
  ref: P,
223
242
  className: "max-h-[600px] overflow-auto rounded-md border",
224
- children: /* @__PURE__ */ O(xe, { className: "relative w-full table-fixed border-collapse", children: [
243
+ children: /* @__PURE__ */ B(xe, { className: "relative w-full table-fixed border-collapse", children: [
225
244
  /* @__PURE__ */ i(
226
245
  be,
227
246
  {
228
247
  className: "bg-d-secondary sticky top-0 z-20",
229
248
  style: { boxShadow: "0 1px 0 0 var(--d-border)" },
230
- children: L.getHeaderGroups().map((l) => /* @__PURE__ */ i(
231
- F,
249
+ children: R.getHeaderGroups().map((l) => /* @__PURE__ */ i(
250
+ _,
232
251
  {
233
252
  className: "bg-d-secondary sticky top-0 z-20",
234
253
  children: l.headers.map((t) => {
@@ -260,9 +279,9 @@ function De({
260
279
  width: "100%"
261
280
  },
262
281
  children: U.getVirtualItems().map((l) => {
263
- const t = L.getRowModel().rows[l.index];
282
+ const t = R.getRowModel().rows[l.index];
264
283
  return /* @__PURE__ */ i(
265
- F,
284
+ _,
266
285
  {
267
286
  "data-index": l.index,
268
287
  style: {
@@ -275,21 +294,21 @@ function De({
275
294
  display: "flex"
276
295
  },
277
296
  children: t.getVisibleCells().map((r, e) => {
278
- const s = e === 0, o = r.getValue(), n = s ? "var(--d-secondary)" : (o == null ? void 0 : o.color) || "transparent";
297
+ const n = e === 0, o = r.getValue(), s = n ? "var(--d-secondary)" : (o == null ? void 0 : o.color) || "transparent";
279
298
  return /* @__PURE__ */ i(
280
299
  J,
281
300
  {
282
- className: `text-center ${s ? "sticky left-0 z-10" : "border-r"}`,
301
+ className: `text-center ${n ? "sticky left-0 z-10" : "border-r"}`,
283
302
  style: {
284
- boxShadow: s ? "inset -1px 0 0 0 var(--d-border)" : "none",
285
- backgroundColor: n,
286
- width: `${k}px`,
287
- flex: s ? "0 0 auto" : `1 0 ${k}px`,
303
+ boxShadow: n ? "inset -1px 0 0 0 var(--d-border)" : "none",
304
+ backgroundColor: s,
305
+ width: `${E}px`,
306
+ flex: n ? "0 0 auto" : `1 0 ${E}px`,
288
307
  display: "flex",
289
308
  alignItems: "center",
290
309
  justifyContent: "center"
291
310
  },
292
- children: s || !S || !o ? (
311
+ children: n || !I || !o ? (
293
312
  // Rendering normale per la prima colonna o quando non siamo in modalità edit
294
313
  q(
295
314
  r.column.columnDef.cell,
@@ -298,30 +317,31 @@ function De({
298
317
  ) : (
299
318
  // Rendering con EditableInput per le celle modificabili
300
319
  (() => {
301
- const m = `${t.index}-${r.column.id}`, de = m in v ? v[m].value : o.value || "";
320
+ const f = `${t.index}-${r.column.id}`, de = f in v ? v[f].value : o.value || "";
302
321
  return /* @__PURE__ */ i(
303
322
  he,
304
323
  {
305
324
  value: de,
306
325
  originalValue: o.value || "",
307
- cellKey: m,
326
+ cellKey: f,
308
327
  cellData: o,
309
- onChange: (y, C) => {
310
- w((p) => ({
328
+ isMarkedForReset: f in y,
329
+ onChange: (C, S) => {
330
+ j((p) => ({
311
331
  ...p,
312
- [y]: { value: C, cell: o }
332
+ [C]: { value: S, cell: o }
313
333
  }));
314
334
  },
315
- resetCell: (y) => {
316
- w((C) => {
317
- const p = { ...C };
318
- return delete p[y], p;
335
+ resetCell: (C) => {
336
+ j((S) => {
337
+ const p = { ...S };
338
+ return delete p[C], p;
319
339
  });
320
340
  },
321
- resetToDefault: (y, C, p) => {
322
- D((ue) => ({
341
+ resetToDefault: (C, S, p) => {
342
+ k((ue) => ({
323
343
  ...ue,
324
- [y]: { value: C, cell: p }
344
+ [C]: { value: S, cell: p }
325
345
  }));
326
346
  }
327
347
  }
@@ -344,5 +364,5 @@ function De({
344
364
  ] });
345
365
  }
346
366
  export {
347
- De as DataCrossTable
367
+ Ae as DataCrossTable
348
368
  };
@@ -1,47 +1,38 @@
1
1
  "use client";
2
- import { jsxs as o, jsx as r, Fragment as h } from "react/jsx-runtime";
3
- import { memo as l } from "react";
4
- import { Switch as u } from "../../switch.js";
5
- import { Button as m } from "../../button.js";
6
- const f = l(
7
- ({
8
- onClick: e,
9
- label: t,
10
- count: n
11
- }) => /* @__PURE__ */ o(m, { size: "sm", onClick: e, children: [
12
- t,
13
- " ",
14
- n > 0 && `(${n})`
15
- ] })
16
- ), p = l(
17
- ({ onClick: e, label: t }) => /* @__PURE__ */ r(m, { variant: "ghost", size: "sm", onClick: e, children: t })
18
- );
19
- function k({
20
- editConfirmLabel: e,
21
- editCancelLabel: t,
22
- editMode: n,
23
- setEditMode: c,
24
- editedCount: i,
25
- confirmAll: s,
26
- cancelAll: a,
27
- editable: d
2
+ import { jsxs as r, jsx as c, Fragment as l } from "react/jsx-runtime";
3
+ import { Switch as x } from "../../switch.js";
4
+ import { Button as n } from "../../button.js";
5
+ function z({
6
+ editConfirmLabel: t,
7
+ editCancelLabel: o,
8
+ editRestoreDefaultLabel: h = "Restore Default",
9
+ editMode: s,
10
+ setEditMode: a,
11
+ editedCount: e,
12
+ defaultCount: i = 0,
13
+ confirmAll: d,
14
+ cancelAll: k,
15
+ restoreDefault: m,
16
+ editable: p
28
17
  }) {
29
- return d ? /* @__PURE__ */ o("div", { className: "mb-2 flex items-center gap-2", children: [
30
- /* @__PURE__ */ r(u, { id: "edit-mode", checked: n, onCheckedChange: c }),
31
- /* @__PURE__ */ r("label", { htmlFor: "edit-mode", className: "text-sm select-none", children: "Edit mode" }),
32
- n && i > 0 && /* @__PURE__ */ o(h, { children: [
33
- /* @__PURE__ */ r(
34
- f,
35
- {
36
- onClick: s,
37
- label: e,
38
- count: i
39
- }
40
- ),
41
- /* @__PURE__ */ r(p, { onClick: a, label: t })
18
+ return p ? /* @__PURE__ */ r("div", { className: "mb-2 flex items-center gap-2", children: [
19
+ /* @__PURE__ */ c(x, { id: "edit-mode", checked: s, onCheckedChange: a }),
20
+ /* @__PURE__ */ c("label", { htmlFor: "edit-mode", className: "text-sm select-none", children: "Edit mode" }),
21
+ s && /* @__PURE__ */ r(l, { children: [
22
+ e > 0 && /* @__PURE__ */ c(l, { children: /* @__PURE__ */ r(n, { size: "sm", onClick: d, children: [
23
+ t,
24
+ " ",
25
+ e > 0 && `(${e})`
26
+ ] }) }),
27
+ i > 0 && m && /* @__PURE__ */ r(n, { size: "sm", onClick: m, variant: "destructive", children: [
28
+ h,
29
+ " ",
30
+ i > 0 && `(${i})`
31
+ ] }),
32
+ (e > 0 || i > 0) && /* @__PURE__ */ c(n, { size: "sm", variant: "ghost", onClick: k, children: o })
42
33
  ] })
43
34
  ] }) : null;
44
35
  }
45
36
  export {
46
- k as EditControls
37
+ z as EditControls
47
38
  };
@@ -1,51 +1,53 @@
1
1
  "use client";
2
2
  import { jsxs as t, jsx as e } from "react/jsx-runtime";
3
- import { memo as k, useState as v, useCallback as o } from "react";
4
- import { Popover as z, PopoverTrigger as I, PopoverContent as P } from "../../popover.js";
5
- import { Icon as h } from "../../icon.js";
3
+ import { memo as z, useState as N, useCallback as o } from "react";
4
+ import { Popover as I, PopoverTrigger as P, PopoverContent as R } from "../../popover.js";
5
+ import { Icon as f } from "../../icon.js";
6
6
  import { Button as p } from "../../button.js";
7
- const E = k(
7
+ const S = z(
8
8
  ({
9
- value: i,
9
+ value: n,
10
10
  onChange: u,
11
11
  resetCell: a,
12
12
  resetToDefault: l,
13
- cellKey: n,
14
- originalValue: s,
15
- cellData: m
13
+ cellKey: s,
14
+ originalValue: i,
15
+ cellData: d,
16
+ isMarkedForReset: x = !1
16
17
  }) => {
17
- const [N, r] = v(!1), [d, f] = v(i), C = (c) => {
18
- c && f(i), r(c);
19
- }, g = o(
18
+ const [C, r] = N(!1), [m, h] = N(n), g = (c) => {
19
+ c && h(n), r(c);
20
+ }, b = o(
20
21
  (c) => {
21
- f(c.target.value);
22
+ h(c.target.value);
22
23
  },
23
24
  []
24
25
  ), w = o(() => {
25
- u(n, d), r(!1);
26
- }, [u, n, d]), b = o(() => {
27
- f(s ?? null), a(n), r(!1);
28
- }, [s, a, n]), j = o(() => {
29
- a(n), m && l && l(n, s, m), r(!1);
30
- }, [l, a, n, s, m]), x = i !== s;
31
- return /* @__PURE__ */ t(z, { open: N, onOpenChange: C, children: [
32
- /* @__PURE__ */ e(I, { asChild: !0, children: /* @__PURE__ */ e("div", { className: "flex w-full cursor-pointer items-center justify-center", children: /* @__PURE__ */ t("div", { className: "relative w-full flex-1 items-center justify-center text-center", children: [
33
- i || "",
34
- x && /* @__PURE__ */ e("div", { className: "bg-d-primary text-d-primary-foreground absolute top-0 left-0 rounded p-1" }),
35
- /* @__PURE__ */ e("span", { className: "text-d-muted-foreground ml-1 inline-flex items-center", children: /* @__PURE__ */ e(h, { name: "Pencil", size: "sm", className: "h-3 w-3" }) })
26
+ u(s, m), r(!1);
27
+ }, [u, s, m]), j = o(() => {
28
+ h(i ?? null), a(s), r(!1);
29
+ }, [i, a, s]), k = o(() => {
30
+ a(s), d && l && l(s, i, d), r(!1);
31
+ }, [l, a, s, i, d]), v = n !== i;
32
+ return /* @__PURE__ */ t(I, { open: C, onOpenChange: g, children: [
33
+ /* @__PURE__ */ e(P, { asChild: !0, children: /* @__PURE__ */ e("div", { className: "flex w-full cursor-pointer items-center justify-center", children: /* @__PURE__ */ t("div", { className: "relative w-full flex-1 items-center justify-center text-center", children: [
34
+ n || "",
35
+ v && !x && /* @__PURE__ */ e("div", { className: "bg-d-primary absolute top-0 left-0 rounded p-1", title: "Valore modificato" }),
36
+ x && /* @__PURE__ */ e("div", { className: "bg-d-destructive absolute top-0 right-0 rounded p-1", title: "Ripristino richiesto" }),
37
+ /* @__PURE__ */ e("span", { className: "text-d-muted-foreground ml-1 inline-flex items-center", children: /* @__PURE__ */ e(f, { name: "Pencil", size: "sm", className: "h-3 w-3" }) })
36
38
  ] }) }) }),
37
- /* @__PURE__ */ e(P, { className: "w-[400px] p-4", children: /* @__PURE__ */ t("div", { className: "space-y-4", children: [
39
+ /* @__PURE__ */ e(R, { className: "w-[400px] p-4", children: /* @__PURE__ */ t("div", { className: "space-y-4", children: [
38
40
  /* @__PURE__ */ t("div", { className: "flex items-center justify-between", children: [
39
41
  /* @__PURE__ */ e("div", { className: "font-medium", children: "Modifica valore" }),
40
- x && /* @__PURE__ */ e("div", { className: "text-d-muted-foreground text-xs", children: "Valore modificato" })
42
+ v && /* @__PURE__ */ e("div", { className: "text-d-muted-foreground text-xs", children: "Valore modificato" })
41
43
  ] }),
42
44
  /* @__PURE__ */ e(
43
45
  "input",
44
46
  {
45
47
  type: "text",
46
48
  className: "bg-d-secondary w-full rounded border p-2",
47
- value: d || "",
48
- onChange: g,
49
+ value: m || "",
50
+ onChange: b,
49
51
  autoFocus: !0
50
52
  }
51
53
  ),
@@ -55,11 +57,11 @@ const E = k(
55
57
  {
56
58
  variant: "destructive",
57
59
  size: "sm",
58
- onClick: j,
60
+ onClick: k,
59
61
  className: "text-xs",
60
62
  title: "Ripristina il valore originale e segna la cella come da ripristinare",
61
63
  children: [
62
- /* @__PURE__ */ e(h, { name: "RotateCcw", className: "mr-1 h-3 w-3" }),
64
+ /* @__PURE__ */ e(f, { name: "RotateCcw", className: "mr-1 h-3 w-3" }),
63
65
  "Ripristina"
64
66
  ]
65
67
  }
@@ -70,7 +72,7 @@ const E = k(
70
72
  {
71
73
  variant: "ghost",
72
74
  size: "sm",
73
- onClick: b,
75
+ onClick: j,
74
76
  className: "text-xs",
75
77
  title: "Annulla le modifiche correnti e chiudi",
76
78
  children: "Annulla"
@@ -84,7 +86,7 @@ const E = k(
84
86
  className: "text-xs",
85
87
  title: "Conferma le modifiche e salva",
86
88
  children: [
87
- /* @__PURE__ */ e(h, { name: "Check", className: "mr-1 h-3 w-3" }),
89
+ /* @__PURE__ */ e(f, { name: "Check", className: "mr-1 h-3 w-3" }),
88
90
  "Conferma"
89
91
  ]
90
92
  }
@@ -96,5 +98,5 @@ const E = k(
96
98
  }
97
99
  );
98
100
  export {
99
- E as EditableInput
101
+ S as EditableInput
100
102
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "laif-ds",
3
3
  "private": false,
4
- "version": "0.1.37",
4
+ "version": "0.1.38",
5
5
  "type": "module",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",