laif-ds 0.2.52 → 0.2.53
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.
- package/dist/components/ui/app-select.js +84 -82
- package/dist/components/ui/async-select.js +54 -53
- package/dist/components/ui/date-picker.js +96 -86
- package/dist/components/ui/input.js +28 -29
- package/dist/index.d.ts +3 -1
- package/dist/lib/design-tokens.js +3 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +1 -1
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as s, jsx as l, Fragment as
|
|
3
|
-
import { Badge as
|
|
4
|
-
import { Command as
|
|
2
|
+
import { jsxs as s, jsx as l, Fragment as ae } from "react/jsx-runtime";
|
|
3
|
+
import { Badge as re } from "./badge.js";
|
|
4
|
+
import { Command as ne, CommandInput as te, CommandList as se, CommandEmpty as ie, CommandGroup as R, CommandItem as A } from "./command.js";
|
|
5
5
|
import { Label as oe } from "./label.js";
|
|
6
|
-
import { designTokens as
|
|
7
|
-
import { cn as
|
|
8
|
-
import { useState as h, useRef as de, useMemo as
|
|
6
|
+
import { designTokens as d } from "../../lib/design-tokens.js";
|
|
7
|
+
import { cn as y } from "../../lib/utils.js";
|
|
8
|
+
import { useState as h, useRef as de, useMemo as S, useCallback as ce, useEffect as ue } from "react";
|
|
9
9
|
import { Checkbox as me } from "./checkbox.js";
|
|
10
|
-
import { Icon as
|
|
10
|
+
import { Icon as z } from "./icon.js";
|
|
11
11
|
import { Popover as fe, PopoverTrigger as pe, PopoverContent as he } from "./popover.js";
|
|
12
12
|
import ge from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
|
|
13
13
|
const ve = {
|
|
14
|
-
sm:
|
|
15
|
-
default:
|
|
16
|
-
lg:
|
|
14
|
+
sm: d.sizes.sm,
|
|
15
|
+
default: d.sizes.default,
|
|
16
|
+
lg: d.sizes.lg
|
|
17
17
|
};
|
|
18
|
-
function Ve(
|
|
18
|
+
function Ve(P) {
|
|
19
19
|
const {
|
|
20
|
-
multiple:
|
|
21
|
-
options:
|
|
22
|
-
value:
|
|
20
|
+
multiple: r = !1,
|
|
21
|
+
options: c,
|
|
22
|
+
value: B,
|
|
23
23
|
defaultValue: T,
|
|
24
|
-
onValueChange:
|
|
24
|
+
onValueChange: W,
|
|
25
25
|
onClear: g,
|
|
26
|
-
placeholder:
|
|
27
|
-
emptyPlaceholder:
|
|
28
|
-
searchPlaceholder:
|
|
29
|
-
addItemPlaceholder:
|
|
26
|
+
placeholder: X = "Seleziona...",
|
|
27
|
+
emptyPlaceholder: E = "Nessun risultato",
|
|
28
|
+
searchPlaceholder: F = "Cerca...",
|
|
29
|
+
addItemPlaceholder: L = "Aggiungi",
|
|
30
30
|
itemCountMessage: $ = (e) => `${e} elementi selezionati`,
|
|
31
31
|
maxSelectedMessage: G = (e) => `Puoi selezionare fino a ${e} elementi`,
|
|
32
|
-
label:
|
|
32
|
+
label: D,
|
|
33
33
|
className: q = "",
|
|
34
34
|
wrpClassName: H = "",
|
|
35
|
-
searchable:
|
|
35
|
+
searchable: O = !1,
|
|
36
36
|
creatable: J = !1,
|
|
37
37
|
groupBy: v = "group",
|
|
38
38
|
maxSelected: o,
|
|
@@ -40,63 +40,65 @@ function Ve(z) {
|
|
|
40
40
|
disabled: b,
|
|
41
41
|
size: Q = "default",
|
|
42
42
|
isSingleSelectClearable: U = !1
|
|
43
|
-
} =
|
|
44
|
-
k || _(e),
|
|
45
|
-
},
|
|
46
|
-
const e =
|
|
47
|
-
if (
|
|
48
|
-
const t =
|
|
43
|
+
} = P, [x, C] = h(!1), [u, w] = h(""), N = de(null), [V, Y] = h(0), k = P.hasOwnProperty("value"), [Z, _] = h(T), i = k ? B : Z, m = (e) => {
|
|
44
|
+
k || _(e), W?.(e);
|
|
45
|
+
}, n = S(() => r ? Array.isArray(i) ? i : [] : i != null ? [i] : [], [i, r]), f = S(() => {
|
|
46
|
+
const e = c.filter((t) => n.includes(t.value));
|
|
47
|
+
if (r) {
|
|
48
|
+
const t = n.filter((a) => !e.find((p) => p.value === a)).map((a) => ({ value: a, label: a }));
|
|
49
49
|
return [...e, ...t];
|
|
50
|
-
} else if (
|
|
51
|
-
return [{ value:
|
|
50
|
+
} else if (n.length && !e.length)
|
|
51
|
+
return [{ value: n[0], label: n[0] }];
|
|
52
52
|
return e;
|
|
53
|
-
}, [
|
|
53
|
+
}, [c, n, r]), I = (e) => {
|
|
54
54
|
if (!e.disabled)
|
|
55
|
-
if (
|
|
56
|
-
const t =
|
|
57
|
-
if (!t && o !== void 0 &&
|
|
55
|
+
if (r) {
|
|
56
|
+
const t = n.includes(e.value);
|
|
57
|
+
if (!t && o !== void 0 && n.length >= o)
|
|
58
58
|
return;
|
|
59
|
-
|
|
60
|
-
t ?
|
|
59
|
+
m(
|
|
60
|
+
t ? n.filter((a) => a !== e.value) : [...n, e.value]
|
|
61
61
|
);
|
|
62
62
|
} else
|
|
63
|
-
|
|
63
|
+
m(e.value), C(!1);
|
|
64
64
|
}, j = ce(() => {
|
|
65
|
-
|
|
66
|
-
}, [
|
|
65
|
+
m(r ? [] : void 0), w(""), g && g();
|
|
66
|
+
}, [m, g, r]), ee = S(() => v ? c.reduce(
|
|
67
67
|
(e, t) => {
|
|
68
|
-
const
|
|
69
|
-
return e[
|
|
68
|
+
const a = t[v] || "";
|
|
69
|
+
return e[a] = e[a] || [], e[a].push(t), e;
|
|
70
70
|
},
|
|
71
71
|
{}
|
|
72
|
-
) : { "":
|
|
72
|
+
) : { "": c }, [c, v]);
|
|
73
73
|
return ue(() => {
|
|
74
|
-
|
|
75
|
-
}, [
|
|
76
|
-
|
|
74
|
+
N.current && Y(N.current.getBoundingClientRect().width);
|
|
75
|
+
}, [x, n, c]), /* @__PURE__ */ s("div", { className: y("flex flex-col gap-1.5", H), children: [
|
|
76
|
+
D && /* @__PURE__ */ l(oe, { children: D }),
|
|
77
77
|
/* @__PURE__ */ s(
|
|
78
78
|
fe,
|
|
79
79
|
{
|
|
80
|
-
open: b ? !1 :
|
|
81
|
-
onOpenChange: (e) => !b &&
|
|
80
|
+
open: b ? !1 : x,
|
|
81
|
+
onOpenChange: (e) => !b && C(e),
|
|
82
82
|
modal: !0,
|
|
83
83
|
children: [
|
|
84
84
|
/* @__PURE__ */ l(pe, { asChild: !0, children: /* @__PURE__ */ s(
|
|
85
85
|
"div",
|
|
86
86
|
{
|
|
87
|
-
ref:
|
|
88
|
-
className:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
ref: N,
|
|
88
|
+
className: y(
|
|
89
|
+
d.input.base,
|
|
90
|
+
d.radius.default,
|
|
91
|
+
d.focusRingWithin,
|
|
92
|
+
"flex w-full min-w-[100px] cursor-pointer items-center justify-between gap-2",
|
|
93
|
+
x && d.activeRing,
|
|
92
94
|
ve[Q],
|
|
93
95
|
b && "cursor-not-allowed opacity-50",
|
|
94
96
|
q
|
|
95
97
|
),
|
|
96
98
|
children: [
|
|
97
|
-
|
|
98
|
-
/* @__PURE__ */ l("div", { className: "flex min-w-0 flex-nowrap gap-1 overflow-auto", children: K ? /* @__PURE__ */ l(
|
|
99
|
-
|
|
99
|
+
f.length === 0 ? /* @__PURE__ */ l("span", { className: "text-d-muted-foreground", children: X }) : r ? /* @__PURE__ */ s("div", { className: "flex h-full w-full min-w-0 items-center justify-between gap-2", children: [
|
|
100
|
+
/* @__PURE__ */ l("div", { className: "flex min-w-0 flex-nowrap gap-1 overflow-auto", children: K ? /* @__PURE__ */ l(ae, { children: f.map((e) => /* @__PURE__ */ s(
|
|
101
|
+
re,
|
|
100
102
|
{
|
|
101
103
|
variant: "secondary",
|
|
102
104
|
className: "hover:bg-d-secondary/100 bg-d-secondary/50 border-d-border flex cursor-pointer items-center gap-1 border",
|
|
@@ -105,12 +107,12 @@ function Ve(z) {
|
|
|
105
107
|
},
|
|
106
108
|
children: [
|
|
107
109
|
e.label,
|
|
108
|
-
!e.fixed && /* @__PURE__ */ l(
|
|
110
|
+
!e.fixed && /* @__PURE__ */ l(z, { name: "X", size: "xs" })
|
|
109
111
|
]
|
|
110
112
|
},
|
|
111
113
|
e.value
|
|
112
|
-
)) }) : /* @__PURE__ */ l("div", { children: $(
|
|
113
|
-
|
|
114
|
+
)) }) : /* @__PURE__ */ l("div", { children: $(f.length) }) }),
|
|
115
|
+
r && /* @__PURE__ */ l(
|
|
114
116
|
"div",
|
|
115
117
|
{
|
|
116
118
|
className: "border-d-input bg-d-accent cursor-pointer rounded-full p-1",
|
|
@@ -120,7 +122,7 @@ function Ve(z) {
|
|
|
120
122
|
onMouseDown: (e) => e.preventDefault(),
|
|
121
123
|
"aria-label": "Clear selection",
|
|
122
124
|
children: /* @__PURE__ */ l(
|
|
123
|
-
|
|
125
|
+
z,
|
|
124
126
|
{
|
|
125
127
|
name: "X",
|
|
126
128
|
size: "xs",
|
|
@@ -130,7 +132,7 @@ function Ve(z) {
|
|
|
130
132
|
}
|
|
131
133
|
)
|
|
132
134
|
] }) : /* @__PURE__ */ s("div", { className: "flex h-full w-full min-w-0 items-center justify-between gap-2", children: [
|
|
133
|
-
/* @__PURE__ */ l("div", { className: "min-w-0 flex-1 truncate", children: typeof
|
|
135
|
+
/* @__PURE__ */ l("div", { className: "min-w-0 flex-1 truncate", children: typeof f[0]?.label == "string" ? /* @__PURE__ */ l("span", { children: f[0]?.label }) : f[0]?.label }),
|
|
134
136
|
U && i !== void 0 && i !== null && /* @__PURE__ */ l(
|
|
135
137
|
"div",
|
|
136
138
|
{
|
|
@@ -141,7 +143,7 @@ function Ve(z) {
|
|
|
141
143
|
onMouseDown: (e) => e.preventDefault(),
|
|
142
144
|
"aria-label": "Clear selection",
|
|
143
145
|
children: /* @__PURE__ */ l(
|
|
144
|
-
|
|
146
|
+
z,
|
|
145
147
|
{
|
|
146
148
|
name: "X",
|
|
147
149
|
size: "xs",
|
|
@@ -162,55 +164,55 @@ function Ve(z) {
|
|
|
162
164
|
style: { width: V > 0 ? V : "auto" },
|
|
163
165
|
align: "start",
|
|
164
166
|
sideOffset: 4,
|
|
165
|
-
children: /* @__PURE__ */ s(
|
|
166
|
-
|
|
167
|
+
children: /* @__PURE__ */ s(ne, { shouldFilter: !!O, className: "w-full", children: [
|
|
168
|
+
O && /* @__PURE__ */ l(
|
|
167
169
|
te,
|
|
168
170
|
{
|
|
169
|
-
placeholder:
|
|
171
|
+
placeholder: F,
|
|
170
172
|
className: "placeholder:text-d-muted-foreground",
|
|
171
|
-
value:
|
|
172
|
-
onValueChange:
|
|
173
|
+
value: u,
|
|
174
|
+
onValueChange: w
|
|
173
175
|
}
|
|
174
176
|
),
|
|
175
177
|
/* @__PURE__ */ s(se, { className: "max-h-60 overflow-auto overscroll-contain", children: [
|
|
176
|
-
/* @__PURE__ */ l(ie, { children:
|
|
177
|
-
J &&
|
|
178
|
-
|
|
178
|
+
/* @__PURE__ */ l(ie, { children: E }),
|
|
179
|
+
J && u && /* @__PURE__ */ l(R, { children: /* @__PURE__ */ l(
|
|
180
|
+
A,
|
|
179
181
|
{
|
|
180
182
|
className: "cursor-pointer",
|
|
181
183
|
onSelect: () => {
|
|
182
|
-
|
|
184
|
+
u && (m(r ? [...n, u] : u), w(""), !r && C(!1));
|
|
183
185
|
},
|
|
184
186
|
children: /* @__PURE__ */ s("div", { className: "text-d-foreground text-xs", children: [
|
|
185
|
-
|
|
187
|
+
L,
|
|
186
188
|
" “",
|
|
187
|
-
|
|
189
|
+
u,
|
|
188
190
|
"”"
|
|
189
191
|
] })
|
|
190
192
|
}
|
|
191
193
|
) }),
|
|
192
|
-
Object.entries(ee).map(([e, t]) => /* @__PURE__ */ l(
|
|
193
|
-
const
|
|
194
|
+
Object.entries(ee).map(([e, t]) => /* @__PURE__ */ l(R, { heading: e || void 0, children: t.map((a) => {
|
|
195
|
+
const p = n.includes(a.value), le = r && o !== void 0 && !p && n.length >= o, M = a.disabled || le;
|
|
194
196
|
return /* @__PURE__ */ s(
|
|
195
|
-
|
|
197
|
+
A,
|
|
196
198
|
{
|
|
197
|
-
value: typeof
|
|
198
|
-
onSelect: () => !M && I(
|
|
199
|
-
className:
|
|
199
|
+
value: typeof a.label == "string" ? a.label : String(a.value),
|
|
200
|
+
onSelect: () => !M && I(a),
|
|
201
|
+
className: y(
|
|
200
202
|
"cursor-pointer",
|
|
201
203
|
M && "cursor-not-allowed opacity-50",
|
|
202
|
-
!
|
|
204
|
+
!r && p && "bg-d-accent/75 text-d-accent-foreground"
|
|
203
205
|
),
|
|
204
206
|
children: [
|
|
205
|
-
|
|
206
|
-
typeof
|
|
207
|
+
r && /* @__PURE__ */ l(me, { checked: p, className: "mr-1" }),
|
|
208
|
+
typeof a.label == "string" ? /* @__PURE__ */ l("span", { children: a.label }) : a.label
|
|
207
209
|
]
|
|
208
210
|
},
|
|
209
|
-
|
|
211
|
+
a.value
|
|
210
212
|
);
|
|
211
213
|
}) }, e))
|
|
212
214
|
] }),
|
|
213
|
-
|
|
215
|
+
r && o !== void 0 && n.length >= o && /* @__PURE__ */ l("div", { className: "border-d-border text-d-muted-foreground border-t px-2 py-1 text-xs", children: G(o) })
|
|
214
216
|
] })
|
|
215
217
|
}
|
|
216
218
|
)
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { jsxs as u, jsx as r } from "react/jsx-runtime";
|
|
3
3
|
import { useDebounce as de } from "../../hooks/use-debounce.js";
|
|
4
4
|
import { cva as ie } from "../../node_modules/class-variance-authority/dist/index.js";
|
|
5
|
-
import * as
|
|
6
|
-
import { useState as p, useEffect as
|
|
7
|
-
import { designTokens as
|
|
8
|
-
import { cn as
|
|
5
|
+
import * as R from "react";
|
|
6
|
+
import { useState as p, useEffect as b, useCallback as j } from "react";
|
|
7
|
+
import { designTokens as x } from "../../lib/design-tokens.js";
|
|
8
|
+
import { cn as M } from "../../lib/utils.js";
|
|
9
9
|
import { Checkbox as fe } from "./checkbox.js";
|
|
10
10
|
import { Command as me, CommandInput as ue, CommandList as he, CommandEmpty as ge, CommandGroup as O, CommandItem as V } from "./command.js";
|
|
11
11
|
import { Icon as _ } from "./icon.js";
|
|
@@ -14,10 +14,10 @@ import { Popover as xe, PopoverTrigger as we, PopoverContent as ye } from "./pop
|
|
|
14
14
|
import Ne from "../../node_modules/lucide-react/dist/esm/icons/loader-circle.js";
|
|
15
15
|
import be from "../../node_modules/lucide-react/dist/esm/icons/check.js";
|
|
16
16
|
const Ce = ie(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
M(
|
|
18
|
+
x.input.base,
|
|
19
|
+
x.radius.default,
|
|
20
|
+
x.interaction.disabled,
|
|
21
21
|
"flex items-center justify-between whitespace-nowrap transition-all [&>span]:line-clamp-1",
|
|
22
22
|
"data-[placeholder]:text-d-muted-foreground",
|
|
23
23
|
"focus:outline-none"
|
|
@@ -25,9 +25,9 @@ const Ce = ie(
|
|
|
25
25
|
{
|
|
26
26
|
variants: {
|
|
27
27
|
size: {
|
|
28
|
-
default:
|
|
29
|
-
sm:
|
|
30
|
-
lg:
|
|
28
|
+
default: x.sizes.default,
|
|
29
|
+
sm: x.sizes.sm,
|
|
30
|
+
lg: x.sizes.lg
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
defaultVariants: {
|
|
@@ -38,27 +38,27 @@ const Ce = ie(
|
|
|
38
38
|
function Be({
|
|
39
39
|
fetcher: i,
|
|
40
40
|
initialOptions: t,
|
|
41
|
-
debounce:
|
|
41
|
+
debounce: w = 300,
|
|
42
42
|
renderOptionItem: C,
|
|
43
43
|
resolveOptionValue: a,
|
|
44
44
|
renderSelectedValue: s,
|
|
45
45
|
notFound: h,
|
|
46
|
-
label:
|
|
46
|
+
label: N,
|
|
47
47
|
placeholder: f = "Select...",
|
|
48
48
|
value: n,
|
|
49
49
|
onChange: g,
|
|
50
50
|
disabled: A = !1,
|
|
51
|
-
className:
|
|
52
|
-
wrpClassName:
|
|
51
|
+
className: D,
|
|
52
|
+
wrpClassName: v,
|
|
53
53
|
noResultsMessage: E,
|
|
54
54
|
clearable: S = !0,
|
|
55
55
|
multiple: l = !1,
|
|
56
56
|
size: ee
|
|
57
57
|
}) {
|
|
58
|
-
const [m, L] = p(!1), P =
|
|
58
|
+
const [m, L] = p(!1), P = R.useRef(null), F = R.useRef(null), re = R.useRef(null), [ne, I] = p({ loading: !1, error: null }), [X, te] = p(""), W = de(X, w), [B, q] = p(/* @__PURE__ */ new Map()), [$, G] = p([]), [H, se] = p(0), [J, Q] = p(() => t?.length ? new Map(
|
|
59
59
|
t.map((e) => [a(e), e])
|
|
60
60
|
) : /* @__PURE__ */ new Map());
|
|
61
|
-
|
|
61
|
+
b(() => {
|
|
62
62
|
t?.length && (q((e) => {
|
|
63
63
|
const o = new Map(e);
|
|
64
64
|
return o.has("") || o.set("", t), o;
|
|
@@ -67,15 +67,15 @@ function Be({
|
|
|
67
67
|
return t.forEach((c) => o.set(a(c), c)), o;
|
|
68
68
|
}));
|
|
69
69
|
}, [t, a]);
|
|
70
|
-
const [
|
|
70
|
+
const [k, Y] = p([]), z = j(
|
|
71
71
|
(e) => {
|
|
72
72
|
if (!e) {
|
|
73
73
|
Y([]);
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
const c = (Array.isArray(e) ? e : [e]).map((d) => {
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
77
|
+
const y = J.get(d);
|
|
78
|
+
if (y) return y;
|
|
79
79
|
if (t?.length) {
|
|
80
80
|
const T = t.find(
|
|
81
81
|
(le) => a(le) === d
|
|
@@ -90,11 +90,11 @@ function Be({
|
|
|
90
90
|
},
|
|
91
91
|
[J, a, t, $]
|
|
92
92
|
);
|
|
93
|
-
|
|
93
|
+
b(() => {
|
|
94
94
|
z(n);
|
|
95
95
|
}, [n, z]);
|
|
96
|
-
const K =
|
|
97
|
-
|
|
96
|
+
const K = R.useMemo(() => l ? null : k[0] ?? null, [l, k]);
|
|
97
|
+
b(() => {
|
|
98
98
|
if (!m) return;
|
|
99
99
|
const e = W || "";
|
|
100
100
|
if (B.has(e)) {
|
|
@@ -106,8 +106,8 @@ function Be({
|
|
|
106
106
|
I({ loading: !0, error: null });
|
|
107
107
|
const c = await i(W);
|
|
108
108
|
q((d) => new Map(d).set(e, c)), G(c), Q((d) => {
|
|
109
|
-
const
|
|
110
|
-
return c.forEach((U) =>
|
|
109
|
+
const y = new Map(d);
|
|
110
|
+
return c.forEach((U) => y.set(a(U), U)), y;
|
|
111
111
|
});
|
|
112
112
|
} catch (c) {
|
|
113
113
|
I({
|
|
@@ -118,11 +118,11 @@ function Be({
|
|
|
118
118
|
I((c) => ({ ...c, loading: !1 }));
|
|
119
119
|
}
|
|
120
120
|
})();
|
|
121
|
-
}, [m, W, B, i, a]),
|
|
121
|
+
}, [m, W, B, i, a]), b(() => {
|
|
122
122
|
m && z(n);
|
|
123
|
-
}, [m, z, n]),
|
|
123
|
+
}, [m, z, n]), b(() => {
|
|
124
124
|
m && P.current && P.current.focus();
|
|
125
|
-
}, [m]),
|
|
125
|
+
}, [m]), b(() => {
|
|
126
126
|
if (!m || !F.current) return;
|
|
127
127
|
const e = F.current.getBoundingClientRect();
|
|
128
128
|
se(e.width);
|
|
@@ -137,7 +137,7 @@ function Be({
|
|
|
137
137
|
if (!l) return;
|
|
138
138
|
const o = Array.isArray(n) ? n : [], c = o.includes(e);
|
|
139
139
|
let d;
|
|
140
|
-
c ? d = o.filter((
|
|
140
|
+
c ? d = o.filter((y) => y !== e) : d = [...o, e], g?.(d);
|
|
141
141
|
},
|
|
142
142
|
[n, g, l]
|
|
143
143
|
), oe = j(
|
|
@@ -145,9 +145,9 @@ function Be({
|
|
|
145
145
|
e.stopPropagation(), e.preventDefault(), g?.(l ? [] : ""), L(!1);
|
|
146
146
|
},
|
|
147
147
|
[g]
|
|
148
|
-
), Z =
|
|
149
|
-
return /* @__PURE__ */ u("div", { className:
|
|
150
|
-
|
|
148
|
+
), Z = R.useId();
|
|
149
|
+
return /* @__PURE__ */ u("div", { className: M("flex flex-col gap-1.5", v), children: [
|
|
150
|
+
N && /* @__PURE__ */ r(pe, { htmlFor: Z, children: N }),
|
|
151
151
|
/* @__PURE__ */ u(xe, { open: m, onOpenChange: L, children: [
|
|
152
152
|
/* @__PURE__ */ r(we, { asChild: !0, children: /* @__PURE__ */ r(
|
|
153
153
|
"button",
|
|
@@ -156,18 +156,19 @@ function Be({
|
|
|
156
156
|
ref: F,
|
|
157
157
|
type: "button",
|
|
158
158
|
disabled: A,
|
|
159
|
-
className:
|
|
159
|
+
className: M(
|
|
160
160
|
Ce({ size: ee }),
|
|
161
161
|
"!border-d-border/50 border !shadow-none",
|
|
162
162
|
A && "cursor-not-allowed opacity-50",
|
|
163
163
|
"font-normal",
|
|
164
164
|
"w-full",
|
|
165
|
-
"
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
"w-full",
|
|
166
|
+
x.focusRing,
|
|
167
|
+
m && x.activeRing,
|
|
168
|
+
D
|
|
168
169
|
),
|
|
169
170
|
children: /* @__PURE__ */ u("div", { className: "flex w-full flex-1 items-center justify-between overflow-hidden", children: [
|
|
170
|
-
l ? Array.isArray(n) && n.length > 0 ? /* @__PURE__ */ r("div", { className: "min-w-0 flex-1 truncate text-left", children: n.length === 1 ?
|
|
171
|
+
l ? Array.isArray(n) && n.length > 0 ? /* @__PURE__ */ r("div", { className: "min-w-0 flex-1 truncate text-left", children: n.length === 1 ? k[0] && s(k[0]) : `${n.length} elementi selezionati` }) : /* @__PURE__ */ r("span", { className: "text-d-muted-foreground truncate text-left", children: f }) : K ? /* @__PURE__ */ r("div", { className: "min-w-0 flex-1 truncate text-left", children: s(K) }) : /* @__PURE__ */ r("span", { className: "text-d-muted-foreground truncate text-left", children: f }),
|
|
171
172
|
/* @__PURE__ */ u("div", { className: "flex flex-shrink-0 items-center justify-end gap-1", children: [
|
|
172
173
|
S && (l && Array.isArray(n) && n.length > 0 || !l && K) && /* @__PURE__ */ r(
|
|
173
174
|
"div",
|
|
@@ -201,7 +202,7 @@ function Be({
|
|
|
201
202
|
/* @__PURE__ */ r(
|
|
202
203
|
ye,
|
|
203
204
|
{
|
|
204
|
-
className:
|
|
205
|
+
className: M("p-0"),
|
|
205
206
|
style: { width: H ? `${H}px` : void 0 },
|
|
206
207
|
align: "start",
|
|
207
208
|
side: "bottom",
|
|
@@ -237,20 +238,20 @@ function Be({
|
|
|
237
238
|
function Ae({
|
|
238
239
|
option: i,
|
|
239
240
|
multiple: t,
|
|
240
|
-
value:
|
|
241
|
+
value: w,
|
|
241
242
|
resolveOptionValue: C,
|
|
242
243
|
renderSelectedValue: a,
|
|
243
244
|
renderOptionItem: s,
|
|
244
245
|
onSelect: h,
|
|
245
|
-
onSelectMultiple:
|
|
246
|
+
onSelectMultiple: N
|
|
246
247
|
}) {
|
|
247
248
|
const f = C(i);
|
|
248
249
|
let n = !1;
|
|
249
|
-
return t ? n = Array.isArray(
|
|
250
|
+
return t ? n = Array.isArray(w) && w.includes(f) : n = w === f, /* @__PURE__ */ r(
|
|
250
251
|
V,
|
|
251
252
|
{
|
|
252
253
|
value: f,
|
|
253
|
-
onSelect: t ?
|
|
254
|
+
onSelect: t ? N : h,
|
|
254
255
|
className: "cursor-pointer",
|
|
255
256
|
children: /* @__PURE__ */ u("div", { className: "flex w-full items-center justify-between overflow-hidden", children: [
|
|
256
257
|
/* @__PURE__ */ u("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
|
|
@@ -260,7 +261,7 @@ function Ae({
|
|
|
260
261
|
/* @__PURE__ */ r(
|
|
261
262
|
be,
|
|
262
263
|
{
|
|
263
|
-
className:
|
|
264
|
+
className: M(
|
|
264
265
|
"ml-2 h-4 w-4 flex-shrink-0",
|
|
265
266
|
n ? "opacity-100" : "opacity-0"
|
|
266
267
|
)
|
|
@@ -274,18 +275,18 @@ function Ae({
|
|
|
274
275
|
function Se({
|
|
275
276
|
inputRef: i,
|
|
276
277
|
commandListRef: t,
|
|
277
|
-
placeholder:
|
|
278
|
+
placeholder: w,
|
|
278
279
|
searchTerm: C,
|
|
279
280
|
onSearchTermChange: a,
|
|
280
281
|
fetchState: s,
|
|
281
282
|
options: h,
|
|
282
|
-
notFound:
|
|
283
|
+
notFound: N,
|
|
283
284
|
noResultsMessage: f,
|
|
284
285
|
multiple: n,
|
|
285
286
|
value: g,
|
|
286
287
|
resolveOptionValue: A,
|
|
287
|
-
renderSelectedValue:
|
|
288
|
-
renderOptionItem:
|
|
288
|
+
renderSelectedValue: D,
|
|
289
|
+
renderOptionItem: v,
|
|
289
290
|
onSelect: E,
|
|
290
291
|
onSelectMultiple: S
|
|
291
292
|
}) {
|
|
@@ -294,7 +295,7 @@ function Se({
|
|
|
294
295
|
ue,
|
|
295
296
|
{
|
|
296
297
|
ref: i,
|
|
297
|
-
placeholder:
|
|
298
|
+
placeholder: w,
|
|
298
299
|
className: "placeholder:text-d-muted-foreground",
|
|
299
300
|
value: C,
|
|
300
301
|
onValueChange: a
|
|
@@ -303,8 +304,8 @@ function Se({
|
|
|
303
304
|
s.loading && h.length > 0 && /* @__PURE__ */ r("div", { className: "flex items-center justify-center p-2", children: /* @__PURE__ */ r(Ne, { className: "h-4 w-4 animate-spin" }) }),
|
|
304
305
|
/* @__PURE__ */ u(he, { ref: t, children: [
|
|
305
306
|
s.error && /* @__PURE__ */ r("div", { className: "text-d-destructive p-3 text-center", children: s.error }),
|
|
306
|
-
s.loading && h.length === 0 && /* @__PURE__ */ r(
|
|
307
|
-
!s.loading && !s.error && h.length === 0 && (
|
|
307
|
+
s.loading && h.length === 0 && /* @__PURE__ */ r(Re, {}),
|
|
308
|
+
!s.loading && !s.error && h.length === 0 && (N || /* @__PURE__ */ r(ge, { children: f || "No results found." })),
|
|
308
309
|
!s.loading && !s.error && h.length > 0 && /* @__PURE__ */ r(O, { children: h.map((l) => /* @__PURE__ */ r(
|
|
309
310
|
Ae,
|
|
310
311
|
{
|
|
@@ -312,8 +313,8 @@ function Se({
|
|
|
312
313
|
multiple: n,
|
|
313
314
|
value: g,
|
|
314
315
|
resolveOptionValue: A,
|
|
315
|
-
renderSelectedValue:
|
|
316
|
-
renderOptionItem:
|
|
316
|
+
renderSelectedValue: D,
|
|
317
|
+
renderOptionItem: v,
|
|
317
318
|
onSelect: E,
|
|
318
319
|
onSelectMultiple: S
|
|
319
320
|
},
|
|
@@ -322,7 +323,7 @@ function Se({
|
|
|
322
323
|
] })
|
|
323
324
|
] });
|
|
324
325
|
}
|
|
325
|
-
function
|
|
326
|
+
function Re() {
|
|
326
327
|
return /* @__PURE__ */ r(O, { children: [1, 2, 3].map((i) => /* @__PURE__ */ r(V, { disabled: !0, children: /* @__PURE__ */ u("div", { className: "flex w-full items-center gap-2", children: [
|
|
327
328
|
/* @__PURE__ */ r("div", { className: "bg-d-secondary h-6 w-6 animate-pulse rounded-full" }),
|
|
328
329
|
/* @__PURE__ */ u("div", { className: "flex flex-1 flex-col gap-1", children: [
|