laif-ds 0.1.96 → 0.1.98

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,8 +1,5 @@
1
1
  "use client";
2
- import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
3
- import { __require as t } from "../node_modules/eventemitter3/index2.js";
4
- var r = t();
5
- const m = /* @__PURE__ */ e(r);
2
+ var e = { exports: {} };
6
3
  export {
7
- m as default
4
+ e as __module
8
5
  };
@@ -1,5 +1,8 @@
1
1
  "use client";
2
- var e = { exports: {} };
2
+ import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
3
+ import { __require as t } from "../node_modules/eventemitter3/index2.js";
4
+ var r = t();
5
+ const m = /* @__PURE__ */ e(r);
3
6
  export {
4
- e as __module
7
+ m as default
5
8
  };
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- var e = { exports: {} };
2
+ var e = {};
3
3
  export {
4
- e as __module
4
+ e as __exports
5
5
  };
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- var e = {};
2
+ var e = { exports: {} };
3
3
  export {
4
- e as __exports
4
+ e as __module
5
5
  };
@@ -1,17 +1,18 @@
1
1
  "use client";
2
- import { jsxs as s, jsx as t } from "react/jsx-runtime";
3
- import * as h from "react";
4
- import { useState as p, useEffect as C, useCallback as O } from "react";
5
- import { useDebounce as te } from "../../hooks/use-debounce.js";
6
- import { cva as ne } from "../../node_modules/class-variance-authority/dist/index.js";
7
- import { cn as v } from "../../lib/utils.js";
8
- import { Label as re } from "./label.js";
9
- import { Popover as se, PopoverTrigger as ae, PopoverContent as oe } from "./popover.js";
10
- import { Command as le, CommandInput as ie, CommandList as ce, CommandEmpty as de, CommandGroup as $, CommandItem as A } from "./command.js";
11
- import { Icon as K } from "./icon.js";
12
- import fe from "../../node_modules/lucide-react/dist/esm/icons/loader-circle.js";
13
- import me from "../../node_modules/lucide-react/dist/esm/icons/check.js";
14
- const ue = ne(
2
+ import { jsxs as d, jsx as e } from "react/jsx-runtime";
3
+ import * as A from "react";
4
+ import { useState as N, useEffect as j, useCallback as $ } from "react";
5
+ import { useDebounce as ae } from "../../hooks/use-debounce.js";
6
+ import { cva as ce } from "../../node_modules/class-variance-authority/dist/index.js";
7
+ import { cn as L } from "../../lib/utils.js";
8
+ import { Label as le } from "./label.js";
9
+ import { Popover as ie, PopoverTrigger as de, PopoverContent as fe } from "./popover.js";
10
+ import { Command as me, CommandInput as ue, CommandList as he, CommandEmpty as pe, CommandGroup as q, CommandItem as H } from "./command.js";
11
+ import { Icon as X } from "./icon.js";
12
+ import { Checkbox as ge } from "./checkbox.js";
13
+ import xe from "../../node_modules/lucide-react/dist/esm/icons/loader-circle.js";
14
+ import we from "../../node_modules/lucide-react/dist/esm/icons/check.js";
15
+ const ye = ce(
15
16
  "flex items-center justify-between whitespace-nowrap rounded-md border border-d-input bg-d-input px-3 py-2 data-[placeholder]:text-muted-foreground focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1 ",
16
17
  {
17
18
  variants: {
@@ -26,141 +27,157 @@ const ue = ne(
26
27
  }
27
28
  }
28
29
  );
29
- function _e({
30
- fetcher: i,
31
- preload: g,
32
- filterFn: S,
33
- renderOption: M,
34
- getOptionValue: x,
35
- getDisplayValue: N,
36
- notFound: B,
37
- loadingSkeleton: G,
38
- label: T,
39
- labelClassName: U,
40
- placeholder: P = "Select...",
41
- value: c = "",
42
- onChange: y,
43
- disabled: z = !1,
44
- width: w = "200px",
45
- triggerClassName: X,
46
- noResultsMessage: q,
47
- clearable: R = !0,
48
- size: H
30
+ function De({
31
+ fetcher: a,
32
+ preload: c,
33
+ filterFn: f,
34
+ renderOption: k,
35
+ getOptionValue: m,
36
+ getDisplayValue: s,
37
+ notFound: u,
38
+ loadingSkeleton: M,
39
+ label: h,
40
+ labelClassName: p,
41
+ placeholder: _ = "Select...",
42
+ value: r,
43
+ onChange: i,
44
+ disabled: T = !1,
45
+ width: x = "200px",
46
+ triggerClassName: z,
47
+ noResultsMessage: D,
48
+ clearable: b = !0,
49
+ multiple: l = !1,
50
+ size: J
49
51
  }) {
50
- const [a, _] = p(!1), d = w === "auto", j = h.useRef(null), L = h.useRef(null), J = h.useRef(null), Q = h.useRef(null), [o, f] = p({ loading: !1, error: null }), [E, Y] = p(""), m = te(E, g ? 0 : 300), [b, k] = p(/* @__PURE__ */ new Map()), [l, u] = p([]), [F, Z] = p(
52
+ const [g, O] = N(!1), C = x === "auto", P = A.useRef(null), E = A.useRef(null), Q = A.useRef(null), Y = A.useRef(null), [Z, v] = N({ loading: !1, error: null }), [K, V] = N(""), S = ae(K, c ? 0 : 300), [I, F] = N(/* @__PURE__ */ new Map()), [w, R] = N([]), [B, ee] = N(
51
53
  void 0
52
- ), D = h.useMemo(() => !c || l.length === 0 ? null : l.find((e) => x(e) === c) || null, [c, l, x]);
53
- C(() => ((async () => {
54
+ ), [G, ne] = N([]), W = A.useMemo(() => l || !r || w.length === 0 ? null : w.find((n) => m(n) === r) || null, [r, w, m, l]);
55
+ j(() => {
56
+ if (l && Array.isArray(r) && w.length > 0) {
57
+ const n = w.filter(
58
+ (t) => r.includes(m(t))
59
+ );
60
+ ne(n);
61
+ }
62
+ }, [r, w, m, l]), j(() => ((async () => {
54
63
  try {
55
- f({ loading: !0, error: null });
56
- const r = g ? "__preload__" : "", n = await i("");
57
- k((I) => new Map(I).set(r, n)), u(n);
58
- } catch (r) {
59
- f({
64
+ v({ loading: !0, error: null });
65
+ const t = c ? "__preload__" : "", o = await a("");
66
+ F((y) => new Map(y).set(t, o)), R(o);
67
+ } catch (t) {
68
+ v({
60
69
  loading: !1,
61
- error: r instanceof Error ? r.message : "Failed to fetch options"
70
+ error: t instanceof Error ? t.message : "Failed to fetch options"
62
71
  });
63
72
  } finally {
64
- f((r) => ({ ...r, loading: !1 }));
73
+ v((t) => ({ ...t, loading: !1 }));
65
74
  }
66
75
  })(), () => {
67
- u([]), k(/* @__PURE__ */ new Map());
68
- }), [i, g]), C(() => {
69
- if (a)
70
- if (g) {
71
- const e = b.get("__preload__") || [];
72
- if (m) {
73
- const r = e.filter(
74
- (n) => S ? S(n, m) : String(N(n)).toLowerCase().includes(m.toLowerCase())
76
+ R([]), F(/* @__PURE__ */ new Map());
77
+ }), [a, c]), j(() => {
78
+ if (g)
79
+ if (c) {
80
+ const n = I.get("__preload__") || [];
81
+ if (S) {
82
+ const t = n.filter(
83
+ (o) => f ? f(o, S) : String(s(o)).toLowerCase().includes(S.toLowerCase())
75
84
  );
76
- u(r);
85
+ R(t);
77
86
  } else
78
- u(e);
87
+ R(n);
79
88
  } else {
80
- const e = m || "";
81
- if (b.has(e)) {
82
- const r = b.get(e);
83
- u(r);
89
+ const n = S || "";
90
+ if (I.has(n)) {
91
+ const t = I.get(n);
92
+ R(t);
84
93
  } else
85
94
  (async () => {
86
95
  try {
87
- f({ loading: !0, error: null });
88
- const n = await i(m);
89
- k((I) => new Map(I).set(e, n)), u(n);
90
- } catch (n) {
91
- f({
96
+ v({ loading: !0, error: null });
97
+ const o = await a(S);
98
+ F((y) => new Map(y).set(n, o)), R(o);
99
+ } catch (o) {
100
+ v({
92
101
  loading: !1,
93
- error: n instanceof Error ? n.message : "Failed to fetch options"
102
+ error: o instanceof Error ? o.message : "Failed to fetch options"
94
103
  });
95
104
  } finally {
96
- f((n) => ({ ...n, loading: !1 }));
105
+ v((o) => ({ ...o, loading: !1 }));
97
106
  }
98
107
  })();
99
108
  }
100
109
  }, [
101
- a,
102
- m,
103
110
  g,
104
111
  S,
105
- b,
106
- N,
107
- i
108
- ]), C(() => {
109
- a && j.current && j.current.focus();
110
- }, [a]), C(() => {
111
- if (a && L.current && d) {
112
- const e = L.current.getBoundingClientRect();
113
- Z(e.width);
112
+ c,
113
+ f,
114
+ I,
115
+ s,
116
+ a
117
+ ]), j(() => {
118
+ g && P.current && P.current.focus();
119
+ }, [g]), j(() => {
120
+ if (g && E.current && C) {
121
+ const n = E.current.getBoundingClientRect();
122
+ ee(n.width);
114
123
  }
115
- }, [a, d]);
116
- const V = O(
117
- (e) => {
118
- y?.(R && e === c ? "" : e), _(!1);
124
+ }, [g, C]);
125
+ const re = $(
126
+ (n) => {
127
+ i?.(b && n === r ? "" : n), O(!1);
128
+ },
129
+ [r, i, b]
130
+ ), te = $(
131
+ (n) => {
132
+ if (!l) return;
133
+ const t = r, o = t.includes(n);
134
+ let y;
135
+ o ? y = t.filter((oe) => oe !== n) : y = [...t, n], i?.(y);
119
136
  },
120
- [c, y, R]
121
- ), ee = O(
122
- (e) => {
123
- e.stopPropagation(), e.preventDefault(), y?.(""), _(!1);
137
+ [r, i, l]
138
+ ), se = $(
139
+ (n) => {
140
+ n.stopPropagation(), n.preventDefault(), i?.(l ? [] : ""), O(!1);
124
141
  },
125
- [y]
126
- ), W = h.useId();
127
- return /* @__PURE__ */ s(
142
+ [i]
143
+ ), U = A.useId();
144
+ return /* @__PURE__ */ d(
128
145
  "div",
129
146
  {
130
- className: v("grid grid-cols-1 space-y-1.5", d && "w-full"),
147
+ className: L("grid grid-cols-1 space-y-1.5", C && "w-full"),
131
148
  children: [
132
- T && /* @__PURE__ */ t(re, { htmlFor: W, className: v(U, "w-fit"), children: T }),
133
- /* @__PURE__ */ t("div", { ref: J, className: "relative", "data-slot": "async-select", children: /* @__PURE__ */ s(se, { open: a, onOpenChange: _, children: [
134
- /* @__PURE__ */ t(ae, { asChild: !0, children: /* @__PURE__ */ t(
149
+ h && /* @__PURE__ */ e(le, { htmlFor: U, className: L(p, "w-fit"), children: h }),
150
+ /* @__PURE__ */ e("div", { ref: Q, className: "relative", "data-slot": "async-select", children: /* @__PURE__ */ d(ie, { open: g, onOpenChange: O, children: [
151
+ /* @__PURE__ */ e(de, { asChild: !0, children: /* @__PURE__ */ e(
135
152
  "button",
136
153
  {
137
- id: W,
138
- ref: L,
154
+ id: U,
155
+ ref: E,
139
156
  type: "button",
140
- disabled: z,
141
- className: v(
142
- ue({ size: H }),
157
+ disabled: T,
158
+ className: L(
159
+ ye({ size: J }),
143
160
  "!border-d-border/50 border !shadow-none",
144
- z && "cursor-not-allowed opacity-50",
145
- X,
161
+ T && "cursor-not-allowed opacity-50",
162
+ z,
146
163
  "font-normal",
147
- d && "w-full",
164
+ C && "w-full",
148
165
  "focus-visible:ring-d-ring focus-visible:ring-1",
149
- a && "ring-d-ring ring-1"
166
+ g && "ring-d-ring ring-1"
150
167
  ),
151
- style: d ? void 0 : { width: w },
152
- children: /* @__PURE__ */ s("div", { className: "flex w-full flex-1 items-center justify-between overflow-hidden", children: [
153
- D ? /* @__PURE__ */ t("div", { className: "min-w-0 flex-1 truncate text-left", children: N(D) }) : /* @__PURE__ */ t("span", { className: "text-d-muted-foreground truncate text-left", children: P }),
154
- /* @__PURE__ */ s("div", { className: "flex flex-shrink-0 items-center justify-end gap-1", children: [
155
- R && D && /* @__PURE__ */ t(
168
+ style: C ? void 0 : { width: x },
169
+ children: /* @__PURE__ */ d("div", { className: "flex w-full flex-1 items-center justify-between overflow-hidden", children: [
170
+ l ? Array.isArray(r) && r.length > 0 ? /* @__PURE__ */ e("div", { className: "min-w-0 flex-1 truncate text-left", children: r.length === 1 ? G[0] && s(G[0]) : `${r.length} elementi selezionati` }) : /* @__PURE__ */ e("span", { className: "text-d-muted-foreground truncate text-left", children: _ }) : W ? /* @__PURE__ */ e("div", { className: "min-w-0 flex-1 truncate text-left", children: s(W) }) : /* @__PURE__ */ e("span", { className: "text-d-muted-foreground truncate text-left", children: _ }),
171
+ /* @__PURE__ */ d("div", { className: "flex flex-shrink-0 items-center justify-end gap-1", children: [
172
+ b && (l && Array.isArray(r) && r.length > 0 || !l && W) && /* @__PURE__ */ e(
156
173
  "div",
157
174
  {
158
175
  className: "border-d-input bg-d-accent cursor-pointer rounded-full p-1",
159
- onClick: ee,
160
- onMouseDown: (e) => e.preventDefault(),
176
+ onClick: se,
177
+ onMouseDown: (n) => n.preventDefault(),
161
178
  "aria-label": "Clear selection",
162
- children: /* @__PURE__ */ t(
163
- K,
179
+ children: /* @__PURE__ */ e(
180
+ X,
164
181
  {
165
182
  name: "X",
166
183
  size: "xs",
@@ -169,8 +186,8 @@ function _e({
169
186
  )
170
187
  }
171
188
  ),
172
- /* @__PURE__ */ t(
173
- K,
189
+ /* @__PURE__ */ e(
190
+ X,
174
191
  {
175
192
  name: "ChevronsUpDown",
176
193
  size: "xs",
@@ -181,62 +198,38 @@ function _e({
181
198
  ] })
182
199
  }
183
200
  ) }),
184
- /* @__PURE__ */ t(
185
- oe,
201
+ /* @__PURE__ */ e(
202
+ fe,
186
203
  {
187
- className: v("p-0"),
204
+ className: L("p-0"),
188
205
  style: {
189
- width: d ? F ? `${F}px` : void 0 : typeof w == "number" ? `${w}px` : w
206
+ width: C ? B ? `${B}px` : void 0 : typeof x == "number" ? `${x}px` : x
190
207
  },
191
208
  align: "start",
192
209
  side: "bottom",
193
210
  sideOffset: 4,
194
- onWheel: (e) => e.stopPropagation(),
211
+ onWheel: (n) => n.stopPropagation(),
195
212
  avoidCollisions: !1,
196
- children: /* @__PURE__ */ s(
197
- le,
213
+ children: /* @__PURE__ */ e(
214
+ be,
198
215
  {
199
- shouldFilter: !1,
200
- className: "w-full border-none shadow-sm",
201
- children: [
202
- /* @__PURE__ */ t(
203
- ie,
204
- {
205
- ref: j,
206
- placeholder: P,
207
- className: "placeholder:text-d-muted-foreground",
208
- value: E,
209
- onValueChange: Y
210
- }
211
- ),
212
- o.loading && l.length > 0 && /* @__PURE__ */ t("div", { className: "flex items-center justify-center p-2", children: /* @__PURE__ */ t(fe, { className: "h-4 w-4 animate-spin" }) }),
213
- /* @__PURE__ */ s(ce, { ref: Q, children: [
214
- o.error && /* @__PURE__ */ t("div", { className: "text-d-destructive p-3 text-center", children: o.error }),
215
- o.loading && l.length === 0 && (G || /* @__PURE__ */ t(he, {})),
216
- !o.loading && !o.error && l.length === 0 && (B || /* @__PURE__ */ t(de, { children: q || "No results found." })),
217
- !o.loading && !o.error && l.length > 0 && /* @__PURE__ */ t($, { children: l.map((e) => /* @__PURE__ */ t(
218
- A,
219
- {
220
- value: x(e),
221
- onSelect: V,
222
- className: "cursor-pointer",
223
- children: /* @__PURE__ */ s("div", { className: "flex w-full items-center justify-between overflow-hidden", children: [
224
- /* @__PURE__ */ t("div", { className: "min-w-0 flex-1", children: M ? /* @__PURE__ */ t("div", { className: "truncate", children: M(e) }) : /* @__PURE__ */ t("span", { className: "truncate", children: N(e) }) }),
225
- /* @__PURE__ */ t(
226
- me,
227
- {
228
- className: v(
229
- "ml-2 h-4 w-4 flex-shrink-0",
230
- c === x(e) ? "opacity-100" : "opacity-0"
231
- )
232
- }
233
- )
234
- ] })
235
- },
236
- x(e)
237
- )) })
238
- ] })
239
- ]
216
+ inputRef: P,
217
+ commandListRef: Y,
218
+ placeholder: _,
219
+ searchTerm: K,
220
+ onSearchTermChange: V,
221
+ fetchState: Z,
222
+ options: w,
223
+ loadingSkeleton: M,
224
+ notFound: u,
225
+ noResultsMessage: D,
226
+ multiple: l,
227
+ value: r,
228
+ getOptionValue: m,
229
+ getDisplayValue: s,
230
+ renderOption: k,
231
+ onSelect: re,
232
+ onSelectMultiple: te
240
233
  }
241
234
  )
242
235
  }
@@ -246,16 +239,105 @@ function _e({
246
239
  }
247
240
  );
248
241
  }
249
- function he() {
250
- return /* @__PURE__ */ t($, { children: [1, 2, 3].map((i) => /* @__PURE__ */ t(A, { disabled: !0, children: /* @__PURE__ */ s("div", { className: "flex w-full items-center gap-2", children: [
251
- /* @__PURE__ */ t("div", { className: "bg-d-secondary h-6 w-6 animate-pulse rounded-full" }),
252
- /* @__PURE__ */ s("div", { className: "flex flex-1 flex-col gap-1", children: [
253
- /* @__PURE__ */ t("div", { className: "bg-d-secondary h-4 w-24 animate-pulse rounded" }),
254
- /* @__PURE__ */ t("div", { className: "bg-d-secondary h-3 w-16 animate-pulse rounded" })
242
+ function Ne({
243
+ option: a,
244
+ multiple: c,
245
+ value: f,
246
+ getOptionValue: k,
247
+ getDisplayValue: m,
248
+ renderOption: s,
249
+ onSelect: u,
250
+ onSelectMultiple: M
251
+ }) {
252
+ const h = k(a);
253
+ let p = !1;
254
+ return c ? p = Array.isArray(f) && f.includes(h) : p = f === h, /* @__PURE__ */ e(
255
+ H,
256
+ {
257
+ value: h,
258
+ onSelect: c ? M : u,
259
+ className: "cursor-pointer",
260
+ children: /* @__PURE__ */ d("div", { className: "flex w-full items-center justify-between overflow-hidden", children: [
261
+ /* @__PURE__ */ d("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
262
+ c && /* @__PURE__ */ e(ge, { checked: p }),
263
+ s ? /* @__PURE__ */ e("div", { className: "truncate", children: s(a) }) : /* @__PURE__ */ e("span", { className: "truncate", children: m(a) })
264
+ ] }),
265
+ /* @__PURE__ */ e(
266
+ we,
267
+ {
268
+ className: L(
269
+ "ml-2 h-4 w-4 flex-shrink-0",
270
+ p ? "opacity-100" : "opacity-0"
271
+ )
272
+ }
273
+ )
274
+ ] })
275
+ },
276
+ h
277
+ );
278
+ }
279
+ function be({
280
+ inputRef: a,
281
+ commandListRef: c,
282
+ placeholder: f,
283
+ searchTerm: k,
284
+ onSearchTermChange: m,
285
+ fetchState: s,
286
+ options: u,
287
+ loadingSkeleton: M,
288
+ notFound: h,
289
+ noResultsMessage: p,
290
+ multiple: _,
291
+ value: r,
292
+ getOptionValue: i,
293
+ getDisplayValue: T,
294
+ renderOption: x,
295
+ onSelect: z,
296
+ onSelectMultiple: D
297
+ }) {
298
+ return /* @__PURE__ */ d(me, { shouldFilter: !1, className: "w-full border-none shadow-sm", children: [
299
+ /* @__PURE__ */ e(
300
+ ue,
301
+ {
302
+ ref: a,
303
+ placeholder: f,
304
+ className: "placeholder:text-d-muted-foreground",
305
+ value: k,
306
+ onValueChange: m
307
+ }
308
+ ),
309
+ s.loading && u.length > 0 && /* @__PURE__ */ e("div", { className: "flex items-center justify-center p-2", children: /* @__PURE__ */ e(xe, { className: "h-4 w-4 animate-spin" }) }),
310
+ /* @__PURE__ */ d(he, { ref: c, children: [
311
+ s.error && /* @__PURE__ */ e("div", { className: "text-d-destructive p-3 text-center", children: s.error }),
312
+ s.loading && u.length === 0 && (M || /* @__PURE__ */ e(Ce, {})),
313
+ !s.loading && !s.error && u.length === 0 && (h || /* @__PURE__ */ e(pe, { children: p || "No results found." })),
314
+ !s.loading && !s.error && u.length > 0 && /* @__PURE__ */ e(q, { children: u.map((b) => /* @__PURE__ */ e(
315
+ Ne,
316
+ {
317
+ option: b,
318
+ multiple: _,
319
+ value: r,
320
+ getOptionValue: i,
321
+ getDisplayValue: T,
322
+ renderOption: x,
323
+ onSelect: z,
324
+ onSelectMultiple: D
325
+ },
326
+ i(b)
327
+ )) })
328
+ ] })
329
+ ] });
330
+ }
331
+ function Ce() {
332
+ return /* @__PURE__ */ e(q, { children: [1, 2, 3].map((a) => /* @__PURE__ */ e(H, { disabled: !0, children: /* @__PURE__ */ d("div", { className: "flex w-full items-center gap-2", children: [
333
+ /* @__PURE__ */ e("div", { className: "bg-d-secondary h-6 w-6 animate-pulse rounded-full" }),
334
+ /* @__PURE__ */ d("div", { className: "flex flex-1 flex-col gap-1", children: [
335
+ /* @__PURE__ */ e("div", { className: "bg-d-secondary h-4 w-24 animate-pulse rounded" }),
336
+ /* @__PURE__ */ e("div", { className: "bg-d-secondary h-3 w-16 animate-pulse rounded" })
255
337
  ] })
256
- ] }) }, i)) });
338
+ ] }) }, a)) });
257
339
  }
258
340
  export {
259
- _e as AsyncSelect,
260
- ue as selectTriggerVariants
341
+ De as AsyncSelect,
342
+ ye as selectTriggerVariants
261
343
  };
@@ -1,31 +1,31 @@
1
1
  "use client";
2
2
  import { jsx as n, jsxs as h } from "react/jsx-runtime";
3
- import { useReactTable as ce, flexRender as $ } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
4
- import { useRef as G, useState as m, useMemo as se, useEffect as R } from "react";
5
- import { cn as re } from "../../lib/utils.js";
6
- import { createCustomFilterFns as de, ELogicalFilterOperator as me, debounce as ue, createMultiValueFilterFn as fe, updatePageSizeFromContainer as he } from "./data-table.service.js";
7
- import { Pagination as pe, PaginationContent as xe, PaginationItem as b, PaginationFirst as we, PaginationPrevious as Ce, PaginationLink as be, PaginationNext as Pe, PaginationLast as Se } from "./pagination.js";
3
+ import { useReactTable as ce, flexRender as G } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
4
+ import { useRef as v, useState as u, useMemo as se, useEffect as z } from "react";
5
+ import { cn as de } from "../../lib/utils.js";
6
+ import { createCustomFilterFns as re, ELogicalFilterOperator as ue, debounce as me, createMultiValueFilterFn as fe, updatePageSizeFromContainer as he } from "./data-table.service.js";
7
+ import { Pagination as pe, PaginationContent as xe, PaginationItem as w, PaginationFirst as be, PaginationPrevious as Ce, PaginationLink as we, PaginationNext as Pe, PaginationLast as Se } from "./pagination.js";
8
8
  import { Checkbox as E } from "./checkbox.js";
9
9
  import { Input as Ie } from "./input.js";
10
10
  import { ScrollArea as W, ScrollBar as F } from "./scroll-area.js";
11
- import { AppMultipleSelectDropdown as Re } from "./app-multiple-select-dropdown.js";
12
- import { Table as Ne, TableHeader as Me, TableRow as N, TableHead as ze, TableBody as ye, TableCell as H } from "./table.js";
11
+ import { AppMultipleSelectDropdown as ze } from "./app-multiple-select-dropdown.js";
12
+ import { Table as Re, TableHeader as Ne, TableRow as R, TableHead as Me, TableBody as ye, TableCell as H } from "./table.js";
13
13
  import { Skeleton as ke } from "./skeleton.js";
14
14
  import { getPaginationRowModel as Fe, getFilteredRowModel as He, getSortedRowModel as De, getCoreRowModel as Ve } from "../../node_modules/@tanstack/table-core/build/lib/index.js";
15
15
  function Ue({
16
16
  columns: P,
17
17
  data: D,
18
- loading: _ = !1,
19
- emptyComponent: J,
18
+ loading: J = !1,
19
+ emptyComponent: _,
20
20
  className: K,
21
21
  rowSelection: q = {},
22
22
  onRowSelectionChange: V,
23
23
  checkable: S = !1,
24
- onCheckedRowsChange: M,
24
+ onCheckedRowsChange: N,
25
25
  notFoundMessage: Q = "Nessun risultato trovato.",
26
- searchBar: u = void 0,
27
- dropdownFilters: d = void 0,
28
- totalItems: z = void 0,
26
+ searchBar: m = void 0,
27
+ dropdownFilters: r = void 0,
28
+ totalItems: M = void 0,
29
29
  datatableSizes: p = {
30
30
  rowHeight: 32.5,
31
31
  // default table row height in pixels
@@ -35,13 +35,13 @@ function Ue({
35
35
  // default container height in pixels
36
36
  },
37
37
  paginationPlaceholders: x = void 0,
38
- serverOptions: r = void 0,
39
- setServerOptions: g = void 0
38
+ serverOptions: g = void 0,
39
+ setServerOptions: c = void 0
40
40
  }) {
41
- const y = G(null), v = G(void 0), [U, X] = m([]), [Y, Z] = m([]), [B, O] = m({}), [C, ee] = m(""), [w, k] = m({
41
+ const y = v(null), A = v(void 0), [U, X] = u([]), [Y, Z] = u([]), [B, O] = u({}), [C, ee] = u(""), [b, k] = u({
42
42
  pageIndex: 0,
43
43
  pageSize: 10
44
- }), [te, j] = m(0), [ne, ie] = m({}), L = V ? q : ne, le = V || ie, [I, ae] = m({}), c = !!r, oe = se(() => S ? [
44
+ }), [te, j] = u(0), [ne, ie] = u({}), L = V ? q : ne, ae = V || ie, [I, le] = u({}), s = !!g, oe = se(() => S ? [
45
45
  {
46
46
  id: "select",
47
47
  header: ({ table: e }) => /* @__PURE__ */ n(
@@ -65,8 +65,8 @@ function Ue({
65
65
  },
66
66
  ...P
67
67
  ] : P, [P, S]).map((e) => {
68
- const t = d?.find(
69
- (l) => l.column === e?.accessorKey
68
+ const t = r?.find(
69
+ (i) => i.column === e?.accessorKey
70
70
  );
71
71
  return {
72
72
  ...e,
@@ -79,33 +79,37 @@ function Ue({
79
79
  onSortingChange: X,
80
80
  getSortedRowModel: De(),
81
81
  onColumnVisibilityChange: O,
82
- onRowSelectionChange: le,
82
+ onRowSelectionChange: ae,
83
83
  getFilteredRowModel: He(),
84
- globalFilterFn: (e, t, l) => c || !l ? !0 : u?.columns.some((o) => {
85
- const a = e.getValue(o);
86
- return String(a).toLowerCase().includes(l.toLowerCase());
84
+ globalFilterFn: (e, t, i) => s || !i ? !0 : m?.columns.some((o) => {
85
+ const l = e.getValue(o);
86
+ return String(l).toLowerCase().includes(i.toLowerCase());
87
87
  }) ?? !1,
88
88
  filterFns: {
89
- multiValue: (e, t, l) => fe(
89
+ multiValue: (e, t, i) => fe(
90
90
  e,
91
91
  t,
92
- l,
93
- d,
94
- r
92
+ i,
93
+ r,
94
+ g
95
95
  ),
96
- ...de(d ?? [], r)
96
+ ...re(r ?? [], g)
97
97
  },
98
98
  onPaginationChange: (e) => {
99
- c ? typeof e == "object" && g && g?.((t) => ({
99
+ s ? typeof e == "object" && c && c?.((t) => ({
100
100
  ...t,
101
- pagination: {
101
+ pagination: g.disableAutoPageSize ? {
102
102
  ...t.pagination,
103
103
  pageIndex: e.pageIndex
104
+ } : {
105
+ ...t.pagination,
106
+ pageIndex: e.pageIndex,
107
+ pageSize: e.pageSize
104
108
  }
105
109
  })) : k(e);
106
110
  },
107
111
  getPaginationRowModel: Fe(),
108
- manualPagination: c,
112
+ manualPagination: s,
109
113
  pageCount: te,
110
114
  state: {
111
115
  sorting: U,
@@ -113,88 +117,96 @@ function Ue({
113
117
  columnVisibility: B,
114
118
  rowSelection: L,
115
119
  globalFilter: C,
116
- pagination: r?.pagination ?? w
120
+ pagination: g?.pagination ?? b
117
121
  }
118
- }, i = ce(ge);
119
- R(() => {
122
+ }, a = ce(ge);
123
+ z(() => {
120
124
  let e;
121
- if (u && C && (e || (e = {}), e.searchbarFilters = {
125
+ if (m && C && (e || (e = {}), e.searchbarFilters = {
122
126
  value: C,
123
- columns: u.columns
124
- }), d && Object.keys(I).length > 0) {
125
- const a = {};
126
- for (const s of d) {
127
- const f = I[s.column];
128
- f && f.length > 0 && (a[s.column] = {
129
- column: s.column,
127
+ columns: m.columns
128
+ }), r && Object.keys(I).length > 0) {
129
+ const l = {};
130
+ for (const d of r) {
131
+ const f = I[d.column];
132
+ f && f.length > 0 && (l[d.column] = {
133
+ column: d.column,
130
134
  value: f,
131
- logic: s.innerFiltersMode || me.OR
135
+ logic: d.innerFiltersMode || ue.OR
132
136
  });
133
137
  }
134
- Object.keys(a).length > 0 && (e || (e = {}), e.dropdownFilters = a);
138
+ Object.keys(l).length > 0 && (e || (e = {}), e.dropdownFilters = l);
135
139
  }
136
- const t = v.current, l = e;
137
- JSON.stringify(t ?? {}) !== JSON.stringify(l ?? {}) && g && (v.current = l, g((a) => ({
138
- ...a,
140
+ const t = A.current, i = e;
141
+ JSON.stringify(t ?? {}) !== JSON.stringify(i ?? {}) && c && (A.current = i, c((l) => ({
142
+ ...l,
139
143
  pagination: {
140
144
  pageIndex: 0,
141
- pageSize: r?.pagination.pageSize ?? 10
145
+ pageSize: g?.pagination.pageSize ?? 10
142
146
  },
143
- filters: l
147
+ filters: i
144
148
  })));
145
149
  }, [
146
- d,
150
+ r,
147
151
  I,
148
- u,
152
+ m,
149
153
  C,
150
- r,
151
- g
154
+ g,
155
+ c
152
156
  ]);
153
- const T = i.getFilteredRowModel();
154
- return R(() => {
155
- if (c)
157
+ const T = a.getFilteredRowModel();
158
+ return z(() => {
159
+ if (s)
156
160
  j(
157
161
  Math.ceil(
158
- (z ?? 0) / (r.pagination?.pageSize || w.pageSize || 10)
162
+ (M ?? 0) / (g.pagination?.pageSize || b.pageSize || 10)
159
163
  )
160
164
  );
161
165
  else {
162
166
  const e = T.rows.length;
163
- j(Math.ceil(e / w.pageSize));
167
+ j(Math.ceil(e / b.pageSize));
164
168
  }
165
169
  }, [
166
- c,
167
- z,
168
- r?.pagination.pageSize,
169
- r?.pagination.pageIndex,
170
- i,
170
+ s,
171
+ M,
172
+ g?.pagination.pageSize,
173
+ g?.pagination.pageIndex,
174
+ a,
171
175
  T,
172
- w.pageSize
173
- ]), R(() => {
174
- const e = ue(() => {
176
+ b.pageSize
177
+ ]), z(() => {
178
+ const e = me(() => {
175
179
  const t = y.current;
176
180
  t && he(t, {
177
181
  rowHeight: p.rowHeight,
178
182
  headerHeight: p.headerHeight,
179
183
  containerHeight: p.containerHeight,
180
- onPageChange: c ? (l, o) => {
181
- g?.((a) => ({
182
- ...a,
183
- pagination: {
184
- ...a.pagination,
185
- pageIndex: l
184
+ onPageChange: s ? (i, o) => {
185
+ c?.((l) => ({
186
+ ...l,
187
+ pagination: g.disableAutoPageSize ? {
188
+ ...l.pagination,
189
+ pageIndex: i
190
+ } : {
191
+ ...l.pagination,
192
+ pageIndex: i,
193
+ pageSize: o
186
194
  }
187
195
  }));
188
- } : (l, o) => {
189
- k({ pageIndex: l, pageSize: o });
196
+ } : (i, o) => {
197
+ k({ pageIndex: i, pageSize: o });
190
198
  },
191
- setPagination: (l) => {
192
- const o = typeof l == "function" ? l({ pageIndex: 0, pageSize: 10 }) : l;
193
- c ? g?.((a) => ({
194
- ...a,
195
- pagination: {
196
- ...a.pagination,
199
+ setPagination: (i) => {
200
+ const o = typeof i == "function" ? i({ pageIndex: 0, pageSize: 10 }) : i;
201
+ s ? c?.((l) => ({
202
+ ...l,
203
+ pagination: g.disableAutoPageSize ? {
204
+ ...l.pagination,
197
205
  pageIndex: o.pageIndex
206
+ } : {
207
+ ...l.pagination,
208
+ pageIndex: o.pageIndex,
209
+ pageSize: o.pageSize
198
210
  }
199
211
  })) : k({
200
212
  pageIndex: o.pageIndex,
@@ -207,32 +219,32 @@ function Ue({
207
219
  window.removeEventListener("resize", e);
208
220
  };
209
221
  }, [
210
- c,
222
+ s,
211
223
  p.containerHeight,
212
224
  p.headerHeight,
213
225
  p.rowHeight,
214
226
  y,
215
- g
227
+ c
216
228
  // should be stable, but include for clarity
217
- ]), R(() => {
218
- if (M && S) {
219
- const e = i.getFilteredSelectedRowModel().rows.map((t) => t.original);
220
- M(e);
229
+ ]), z(() => {
230
+ if (N && S) {
231
+ const e = a.getFilteredSelectedRowModel().rows.map((t) => t.original);
232
+ N(e);
221
233
  }
222
- }, [i, M, S, L]), /* @__PURE__ */ h(
234
+ }, [a, N, S, L]), /* @__PURE__ */ h(
223
235
  "div",
224
236
  {
225
- className: re(
237
+ className: de(
226
238
  "flex h-full max-h-full min-h-0 w-full max-w-full flex-col gap-2",
227
239
  K
228
240
  ),
229
241
  children: [
230
- (u || d?.length) && /* @__PURE__ */ h("div", { className: "flex flex-col items-start justify-between gap-2 sm:flex-row sm:items-end", children: [
231
- u && /* @__PURE__ */ n(
242
+ (m || r?.length) && /* @__PURE__ */ h("div", { className: "flex flex-col items-start justify-between gap-2 sm:flex-row sm:items-end", children: [
243
+ m && /* @__PURE__ */ n(
232
244
  Ie,
233
245
  {
234
246
  iconLeft: "Search",
235
- placeholder: u.placeholder ?? "Cerca...",
247
+ placeholder: m.placeholder ?? "Cerca...",
236
248
  value: C,
237
249
  onChange: (e) => {
238
250
  ee(e.target.value);
@@ -240,28 +252,28 @@ function Ue({
240
252
  className: "w-60"
241
253
  }
242
254
  ),
243
- /* @__PURE__ */ n("div", { className: "flex h-full max-w-full min-w-0 flex-1 items-center", children: d && d.length > 0 && /* @__PURE__ */ h(W, { className: "h-full w-full", children: [
255
+ /* @__PURE__ */ n("div", { className: "flex h-full max-w-full min-w-0 flex-1 items-center", children: r && r.length > 0 && /* @__PURE__ */ h(W, { className: "h-full w-full", children: [
244
256
  /* @__PURE__ */ n(F, { orientation: "horizontal" }),
245
- /* @__PURE__ */ n("div", { className: "flex w-full max-w-full min-w-0 items-center justify-start gap-2 p-0.5 sm:justify-end", children: d.map((e, t) => {
246
- const l = I[e.column] ?? [];
257
+ /* @__PURE__ */ n("div", { className: "flex w-full max-w-full min-w-0 items-center justify-start gap-2 p-0.5 sm:justify-end", children: r.map((e, t) => {
258
+ const i = I[e.column] ?? [];
247
259
  return /* @__PURE__ */ n(
248
- Re,
260
+ ze,
249
261
  {
250
262
  className: "w-60",
251
263
  options: e.items,
252
- value: l,
264
+ value: i,
253
265
  placeholder: e.placeholder,
254
266
  label: e.label,
255
267
  onChange: (o) => {
256
- ae((a) => ({
257
- ...a,
268
+ le((l) => ({
269
+ ...l,
258
270
  [e.column]: o
259
- })), Z((a) => {
260
- const s = a.filter(
271
+ })), Z((l) => {
272
+ const d = l.filter(
261
273
  (f) => f.id !== e.column
262
274
  );
263
- return o.length === 0 ? s : [
264
- ...s,
275
+ return o.length === 0 ? d : [
276
+ ...d,
265
277
  { id: e.column, value: o }
266
278
  ];
267
279
  });
@@ -280,34 +292,34 @@ function Ue({
280
292
  children: /* @__PURE__ */ h(W, { className: "border-d-border h-full min-h-0 w-full rounded-md border", children: [
281
293
  /* @__PURE__ */ n(F, { orientation: "horizontal" }),
282
294
  /* @__PURE__ */ n(F, { orientation: "vertical" }),
283
- /* @__PURE__ */ h(Ne, { children: [
284
- /* @__PURE__ */ n(Me, { children: i.getHeaderGroups().map((e) => /* @__PURE__ */ n(N, { children: e.headers.map((t) => /* @__PURE__ */ n(
285
- ze,
295
+ /* @__PURE__ */ h(Re, { children: [
296
+ /* @__PURE__ */ n(Ne, { children: a.getHeaderGroups().map((e) => /* @__PURE__ */ n(R, { children: e.headers.map((t) => /* @__PURE__ */ n(
297
+ Me,
286
298
  {
287
299
  className: `bg-d-secondary sticky top-0 z-10 ${t.column.columnDef.sticky ? "left-0" : ""}`,
288
- children: t.isPlaceholder ? null : $(
300
+ children: t.isPlaceholder ? null : G(
289
301
  t.column.columnDef.header,
290
302
  t.getContext()
291
303
  )
292
304
  },
293
305
  t.id
294
306
  )) }, e.id)) }),
295
- /* @__PURE__ */ n(ye, { children: _ ? Array.from({ length: D.length || 8 }).map((e, t) => /* @__PURE__ */ n(N, { children: i.getHeaderGroups()[0].headers.map((l, o) => /* @__PURE__ */ n(
307
+ /* @__PURE__ */ n(ye, { children: J ? Array.from({ length: D.length || 8 }).map((e, t) => /* @__PURE__ */ n(R, { children: a.getHeaderGroups()[0].headers.map((i, o) => /* @__PURE__ */ n(
296
308
  H,
297
309
  {
298
- className: `w-full ${l.column.columnDef.sticky ? "bg-d-background sticky left-0 z-10" : ""}`,
310
+ className: `w-full ${i.column.columnDef.sticky ? "bg-d-background sticky left-0 z-10" : ""}`,
299
311
  children: /* @__PURE__ */ n(ke, { className: "h-6 w-full" })
300
312
  },
301
313
  `skeleton-cell-${t}-${o}`
302
- )) }, `skeleton-row-${t}`)) : i.getRowModel().rows?.length ? i.getRowModel().rows.map((e) => /* @__PURE__ */ n(
303
- N,
314
+ )) }, `skeleton-row-${t}`)) : a.getRowModel().rows?.length ? a.getRowModel().rows.map((e) => /* @__PURE__ */ n(
315
+ R,
304
316
  {
305
317
  "data-state": e.getIsSelected() && "selected",
306
318
  children: e.getVisibleCells().map((t) => /* @__PURE__ */ n(
307
319
  H,
308
320
  {
309
321
  className: `${t.column.columnDef.sticky ? "bg-d-background sticky left-0 z-10" : ""}`,
310
- children: $(
322
+ children: G(
311
323
  t.column.columnDef.cell,
312
324
  t.getContext()
313
325
  )
@@ -316,12 +328,12 @@ function Ue({
316
328
  ))
317
329
  },
318
330
  e.id
319
- )) : /* @__PURE__ */ n(N, { children: /* @__PURE__ */ n(
331
+ )) : /* @__PURE__ */ n(R, { children: /* @__PURE__ */ n(
320
332
  H,
321
333
  {
322
334
  colSpan: P.length,
323
335
  className: "pt-4 text-center",
324
- children: J || Q
336
+ children: _ || Q
325
337
  }
326
338
  ) }) })
327
339
  ] })
@@ -330,115 +342,115 @@ function Ue({
330
342
  ),
331
343
  /* @__PURE__ */ h(pe, { className: "h-9", children: [
332
344
  /* @__PURE__ */ n("div", { className: "flex h-full flex-1 items-center align-middle", children: /* @__PURE__ */ n("div", { className: "text-d-foreground hidden text-sm md:flex", children: Math.min(
333
- r?.pagination?.pageSize ?? w.pageSize,
334
- i.getFilteredRowModel().rows.length ?? 9999
335
- ) + " / " + (r ? z ?? "missing totalItems" : i.getFilteredRowModel().rows.length) + " " + (x?.rows ?? "Righe") }) }),
345
+ g?.pagination?.pageSize ?? b.pageSize,
346
+ a.getFilteredRowModel().rows.length ?? 9999
347
+ ) + " / " + (g ? M ?? "missing totalItems" : a.getFilteredRowModel().rows.length) + " " + (x?.rows ?? "Righe") }) }),
336
348
  /* @__PURE__ */ h(xe, { children: [
337
- /* @__PURE__ */ n(b, { children: /* @__PURE__ */ n(
338
- we,
349
+ /* @__PURE__ */ n(w, { children: /* @__PURE__ */ n(
350
+ be,
339
351
  {
340
352
  size: "sm",
341
- isDisabled: !i.getCanPreviousPage(),
353
+ isDisabled: !a.getCanPreviousPage(),
342
354
  label: x?.first,
343
355
  onClick: () => {
344
- c ? g?.((e) => ({
356
+ s ? c?.((e) => ({
345
357
  ...e,
346
358
  pagination: {
347
359
  ...e.pagination,
348
360
  pageIndex: 0
349
361
  }
350
- })) : i.setPageIndex(0);
362
+ })) : a.setPageIndex(0);
351
363
  },
352
364
  "aria-label": "Go to first page"
353
365
  }
354
366
  ) }),
355
- /* @__PURE__ */ n(b, { children: /* @__PURE__ */ n(
367
+ /* @__PURE__ */ n(w, { children: /* @__PURE__ */ n(
356
368
  Ce,
357
369
  {
358
370
  size: "sm",
359
- isDisabled: !i.getCanPreviousPage(),
371
+ isDisabled: !a.getCanPreviousPage(),
360
372
  label: x?.previous,
361
373
  onClick: () => {
362
- if (i.getCanPreviousPage())
363
- if (c) {
364
- const e = r?.pagination.pageIndex ?? w.pageIndex, t = Math.max(e - 1, 0);
365
- g?.((l) => ({
366
- ...l,
374
+ if (a.getCanPreviousPage())
375
+ if (s) {
376
+ const e = g?.pagination.pageIndex ?? b.pageIndex, t = Math.max(e - 1, 0);
377
+ c?.((i) => ({
378
+ ...i,
367
379
  pagination: {
368
- ...l.pagination,
380
+ ...i.pagination,
369
381
  pageIndex: t
370
382
  }
371
383
  }));
372
384
  } else
373
- i.previousPage();
385
+ a.previousPage();
374
386
  }
375
387
  }
376
388
  ) }),
377
389
  (() => {
378
- const e = i.getState().pagination.pageIndex, t = i.getPageCount(), l = 5;
390
+ const e = a.getState().pagination.pageIndex, t = a.getPageCount(), i = 5;
379
391
  let o = Math.max(
380
392
  0,
381
- e - Math.floor(l / 2)
382
- ), a = o + l;
383
- return a > t && (a = t, o = Math.max(0, a - l)), i.getPageOptions().slice(o, a).map((s, f) => /* @__PURE__ */ n(b, { children: /* @__PURE__ */ n(
384
- be,
393
+ e - Math.floor(i / 2)
394
+ ), l = o + i;
395
+ return l > t && (l = t, o = Math.max(0, l - i)), a.getPageOptions().slice(o, l).map((d, f) => /* @__PURE__ */ n(w, { children: /* @__PURE__ */ n(
396
+ we,
385
397
  {
386
398
  size: "icon",
387
- isActive: e === s,
399
+ isActive: e === d,
388
400
  onClick: () => {
389
- if (c) {
390
- if (e === s) return;
391
- g?.((A) => ({
392
- ...A,
401
+ if (s) {
402
+ if (e === d) return;
403
+ c?.(($) => ({
404
+ ...$,
393
405
  pagination: {
394
- ...A.pagination,
395
- pageIndex: s
406
+ ...$.pagination,
407
+ pageIndex: d
396
408
  }
397
409
  }));
398
410
  } else
399
- i.setPageIndex(s);
411
+ a.setPageIndex(d);
400
412
  },
401
- children: s + 1
413
+ children: d + 1
402
414
  }
403
415
  ) }, f));
404
416
  })(),
405
- /* @__PURE__ */ n(b, { children: /* @__PURE__ */ n(
417
+ /* @__PURE__ */ n(w, { children: /* @__PURE__ */ n(
406
418
  Pe,
407
419
  {
408
420
  size: "sm",
409
- isDisabled: !i.getCanNextPage(),
421
+ isDisabled: !a.getCanNextPage(),
410
422
  label: x?.next,
411
423
  onClick: () => {
412
- i.getCanNextPage() && (c ? g?.((e) => ({
424
+ a.getCanNextPage() && (s ? c?.((e) => ({
413
425
  ...e,
414
426
  pagination: {
415
427
  ...e.pagination,
416
428
  pageIndex: e.pagination.pageIndex + 1
417
429
  }
418
- })) : i.nextPage());
430
+ })) : a.nextPage());
419
431
  }
420
432
  }
421
433
  ) }),
422
- /* @__PURE__ */ n(b, { children: /* @__PURE__ */ n(
434
+ /* @__PURE__ */ n(w, { children: /* @__PURE__ */ n(
423
435
  Se,
424
436
  {
425
437
  size: "sm",
426
- isDisabled: !i.getCanNextPage(),
438
+ isDisabled: !a.getCanNextPage(),
427
439
  label: x?.last,
428
440
  onClick: () => {
429
- c ? g?.((e) => ({
441
+ s ? c?.((e) => ({
430
442
  ...e,
431
443
  pagination: {
432
444
  ...e.pagination,
433
- pageIndex: i.getPageCount() - 1
445
+ pageIndex: a.getPageCount() - 1
434
446
  }
435
- })) : i.setPageIndex(i.getPageCount() - 1);
447
+ })) : a.setPageIndex(a.getPageCount() - 1);
436
448
  },
437
449
  "aria-label": "Go to last page"
438
450
  }
439
451
  ) })
440
452
  ] }),
441
- /* @__PURE__ */ n("div", { className: "flex h-full flex-1 items-center justify-end align-middle", children: /* @__PURE__ */ n("div", { className: "text-d-foreground hidden text-sm md:flex", children: (i.getPageCount() ? i.getState().pagination.pageIndex + 1 : 0) + " / " + i.getPageCount() + " " + (x?.pages ?? "Pagine") }) })
453
+ /* @__PURE__ */ n("div", { className: "flex h-full flex-1 items-center justify-end align-middle", children: /* @__PURE__ */ n("div", { className: "text-d-foreground hidden text-sm md:flex", children: (a.getPageCount() ? a.getState().pagination.pageIndex + 1 : 0) + " / " + a.getPageCount() + " " + (x?.pages ?? "Pagine") }) })
442
454
  ] })
443
455
  ]
444
456
  }
package/dist/index.d.ts CHANGED
@@ -189,9 +189,34 @@ export declare function AspectRatio({ ...props }: AspectRatioProps): JSX.Element
189
189
 
190
190
  declare type AspectRatioProps = React.ComponentProps<typeof AspectRatioPrimitive.Root>;
191
191
 
192
- export declare function AsyncSelect<T>({ fetcher, preload, filterFn, renderOption, getOptionValue, getDisplayValue, notFound, loadingSkeleton, label, labelClassName, placeholder, value, onChange, disabled, width, triggerClassName, noResultsMessage, clearable, size, }: AsyncSelectProps<T>): JSX.Element;
192
+ export declare function AsyncSelect<T>({ fetcher, preload, filterFn, renderOption, getOptionValue, getDisplayValue, notFound, loadingSkeleton, label, labelClassName, placeholder, value, onChange, disabled, width, triggerClassName, noResultsMessage, clearable, multiple, size, }: AsyncSelectProps<T>): JSX.Element;
193
193
 
194
- declare interface AsyncSelectProps<T> extends VariantProps<typeof selectTriggerVariants> {
194
+ declare interface AsyncSelectMultipleProps<T> extends VariantProps<typeof selectTriggerVariants> {
195
+ multiple: true;
196
+ fetcher: (query?: string) => Promise<T[]>;
197
+ preload?: boolean;
198
+ filterFn?: (option: T, query: string) => boolean;
199
+ renderOption: (option: T) => React_2.ReactNode;
200
+ getOptionValue: (option: T) => string;
201
+ getDisplayValue: (option: T) => React_2.ReactNode;
202
+ notFound?: React_2.ReactNode;
203
+ loadingSkeleton?: React_2.ReactNode;
204
+ value?: string[];
205
+ onChange?: (value: string[]) => void;
206
+ label?: string | React_2.ReactNode;
207
+ labelClassName?: string;
208
+ placeholder?: string;
209
+ disabled?: boolean;
210
+ width?: string | number | "auto";
211
+ triggerClassName?: string;
212
+ noResultsMessage?: string;
213
+ clearable?: boolean;
214
+ }
215
+
216
+ declare type AsyncSelectProps<T> = AsyncSelectSingleProps<T> | AsyncSelectMultipleProps<T>;
217
+
218
+ declare interface AsyncSelectSingleProps<T> extends VariantProps<typeof selectTriggerVariants> {
219
+ multiple?: false;
195
220
  fetcher: (query?: string) => Promise<T[]>;
196
221
  preload?: boolean;
197
222
  filterFn?: (option: T, query: string) => boolean;
@@ -1059,6 +1084,7 @@ export declare interface IServerFilterProps {
1059
1084
  export declare interface IServerOptionsProps {
1060
1085
  pagination: IPaginationProps;
1061
1086
  filters?: IServerFilterProps;
1087
+ disableAutoPageSize?: boolean;
1062
1088
  }
1063
1089
 
1064
1090
  export declare function Label({ className, ...props }: React_2.ComponentProps<typeof LabelPrimitive.Root>): JSX.Element;
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import e from "../../_virtual/index2.js";
2
+ import e from "../../_virtual/index3.js";
3
3
  export {
4
4
  e as EventEmitter,
5
5
  e as default
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { __module as x } from "../../_virtual/index6.js";
2
+ import { __module as x } from "../../_virtual/index7.js";
3
3
  var w;
4
4
  function O() {
5
5
  return w ? x.exports : (w = 1, function(d) {
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import e from "../../../../_virtual/index2.js";
2
+ import e from "../../../../_virtual/index3.js";
3
3
  var r = new e(), n = "recharts.syncEvent.tooltip";
4
4
  export {
5
5
  n as TOOLTIP_SYNC_EVENT,
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { __exports as r } from "../../../_virtual/index7.js";
2
+ import { __exports as r } from "../../../_virtual/index6.js";
3
3
  import { __require as c } from "../../inline-style-parser/index.js";
4
4
  var f;
5
5
  function j() {
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { __module as e } from "../../../_virtual/index3.js";
2
+ import { __module as e } from "../../../_virtual/index2.js";
3
3
  import { __require as i } from "../cjs/use-sync-external-store-shim.production.js";
4
4
  import { __require as o } from "../cjs/use-sync-external-store-shim.development.js";
5
5
  var r;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "laif-ds",
3
3
  "private": false,
4
- "version": "0.1.96",
4
+ "version": "0.1.98",
5
5
  "type": "module",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",