laif-ds 0.2.75 → 0.2.77
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/CHANGELOG.md +27 -0
- package/dist/_virtual/index6.js +2 -2
- package/dist/_virtual/index7.js +2 -2
- package/dist/agent-docs/adoption-report.json +43 -39
- package/dist/agent-docs/components/AppCard.md +308 -0
- package/dist/agent-docs/components/AppForm.md +169 -358
- package/dist/agent-docs/components/DataTable.md +3 -0
- package/dist/agent-docs/components/FileUploader.md +7 -1
- package/dist/agent-docs/components-list.md +2 -0
- package/dist/agent-docs/manifest.json +110 -27
- package/dist/agent-docs/truncated-cell.md +342 -0
- package/dist/components/ui/app-card.js +115 -0
- package/dist/components/ui/app-form.js +322 -289
- package/dist/components/ui/card.js +20 -6
- package/dist/components/ui/file-uploader.js +86 -78
- package/dist/components/ui/tables/data-table/components/data-table-body.js +123 -115
- package/dist/components/ui/tables/data-table/components/data-table-header.js +6 -5
- package/dist/components/ui/tables/data-table/data-table.js +71 -69
- package/dist/components/ui/tables/data-table/data-table.utils.js +23 -15
- package/dist/components/ui/truncated-cell.js +100 -0
- package/dist/index.d.ts +212 -11
- package/dist/index.js +377 -373
- package/dist/node_modules/eventemitter3/index2.js +1 -1
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +1 -1
|
@@ -1,313 +1,346 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { Controller as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { AppSelect as
|
|
6
|
-
import { AsyncSelect as
|
|
7
|
-
import { Button as
|
|
8
|
-
import { Checkbox as
|
|
9
|
-
import { DatePicker as
|
|
10
|
-
import { Input as
|
|
11
|
-
import { Label as
|
|
12
|
-
import { RadioGroup as
|
|
13
|
-
import { Slider as
|
|
14
|
-
import { Switch as
|
|
15
|
-
import { Textarea as
|
|
16
|
-
import { Typo as
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
submitText: x = "Invia",
|
|
22
|
-
onSubmit: C,
|
|
23
|
-
isSubmitting: p = !1,
|
|
24
|
-
showSubmitButton: N = !1
|
|
2
|
+
import { jsxs as r, jsx as a, Fragment as f } from "react/jsx-runtime";
|
|
3
|
+
import { Controller as S } from "../../node_modules/react-hook-form/dist/index.esm.js";
|
|
4
|
+
import { cn as t } from "../../lib/utils.js";
|
|
5
|
+
import { AppSelect as h } from "./app-select.js";
|
|
6
|
+
import { AsyncSelect as P } from "./async-select.js";
|
|
7
|
+
import { Button as V } from "./button.js";
|
|
8
|
+
import { Checkbox as R } from "./checkbox.js";
|
|
9
|
+
import { DatePicker as v } from "./date-picker.js";
|
|
10
|
+
import { Input as k } from "./input.js";
|
|
11
|
+
import { Label as u } from "./label.js";
|
|
12
|
+
import { RadioGroup as w, RadioGroupItem as I } from "./radio-group.js";
|
|
13
|
+
import { Slider as O } from "./slider.js";
|
|
14
|
+
import { Switch as F } from "./switch.js";
|
|
15
|
+
import { Textarea as A } from "./textarea.js";
|
|
16
|
+
import { Typo as p } from "./typo.js";
|
|
17
|
+
const j = ({
|
|
18
|
+
item: e,
|
|
19
|
+
errors: n,
|
|
20
|
+
control: c
|
|
25
21
|
}) => {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
22
|
+
const l = n[e.name]?.message, o = l ? String(l) : void 0;
|
|
23
|
+
return /* @__PURE__ */ a("div", { className: t(e.className), children: /* @__PURE__ */ a(
|
|
24
|
+
S,
|
|
25
|
+
{
|
|
26
|
+
name: e.name,
|
|
27
|
+
control: c,
|
|
28
|
+
render: ({ field: s }) => {
|
|
29
|
+
const i = !e.hideLabel && /* @__PURE__ */ r("div", { className: "mb-2 flex items-center justify-between", children: [
|
|
30
|
+
/* @__PURE__ */ a(u, { children: e.label }),
|
|
31
|
+
o && /* @__PURE__ */ a("span", { className: "text-d-destructive text-xs", children: o })
|
|
32
|
+
] });
|
|
33
|
+
return /* @__PURE__ */ a(
|
|
34
|
+
L,
|
|
35
|
+
{
|
|
36
|
+
item: e,
|
|
37
|
+
field: s,
|
|
38
|
+
errorMessage: o,
|
|
39
|
+
labelWithError: i
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
) });
|
|
45
|
+
}, L = ({
|
|
46
|
+
item: e,
|
|
47
|
+
field: n,
|
|
48
|
+
errorMessage: c,
|
|
49
|
+
labelWithError: l
|
|
50
|
+
}) => {
|
|
51
|
+
switch (e.component) {
|
|
52
|
+
case "input":
|
|
53
|
+
return /* @__PURE__ */ r("div", { children: [
|
|
54
|
+
l,
|
|
55
|
+
/* @__PURE__ */ a(
|
|
56
|
+
k,
|
|
57
|
+
{
|
|
58
|
+
...n,
|
|
59
|
+
type: e.inputType,
|
|
60
|
+
placeholder: e.placeholder,
|
|
61
|
+
className: t(c && "border-d-destructive"),
|
|
62
|
+
disabled: e.disabled,
|
|
63
|
+
iconLeft: e.iconLeft,
|
|
64
|
+
iconRight: e.iconRight,
|
|
65
|
+
...e.componentProps
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
] });
|
|
69
|
+
case "async":
|
|
70
|
+
case "async-multiple": {
|
|
71
|
+
if (!e.fetcher || !e.renderOptionItem || !e.resolveOptionValue || !e.renderSelectedValue)
|
|
72
|
+
return /* @__PURE__ */ r("div", { children: [
|
|
73
|
+
l,
|
|
74
|
+
/* @__PURE__ */ a(p, { variant: "caption", className: "text-d-destructive", children: "Async select non configurato correttamente." })
|
|
75
|
+
] });
|
|
76
|
+
const o = e.component === "async-multiple";
|
|
77
|
+
return /* @__PURE__ */ r("div", { children: [
|
|
78
|
+
l,
|
|
79
|
+
/* @__PURE__ */ a(
|
|
80
|
+
P,
|
|
81
|
+
{
|
|
82
|
+
multiple: o,
|
|
83
|
+
fetcher: e.fetcher,
|
|
84
|
+
initialOptions: e.initialOptions,
|
|
85
|
+
renderOptionItem: e.renderOptionItem,
|
|
86
|
+
resolveOptionValue: e.resolveOptionValue,
|
|
87
|
+
renderSelectedValue: e.renderSelectedValue,
|
|
88
|
+
value: n.value,
|
|
89
|
+
onChange: n.onChange,
|
|
90
|
+
placeholder: e.placeholder,
|
|
91
|
+
disabled: e.disabled,
|
|
92
|
+
notFound: e.notFound,
|
|
93
|
+
noResultsMessage: e.noResultsMessage,
|
|
94
|
+
debounce: e.debounce,
|
|
95
|
+
clearable: e.clearable,
|
|
96
|
+
...e.componentProps
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
] });
|
|
100
|
+
}
|
|
101
|
+
case "textarea":
|
|
102
|
+
return /* @__PURE__ */ r("div", { children: [
|
|
103
|
+
l,
|
|
104
|
+
/* @__PURE__ */ a(
|
|
105
|
+
A,
|
|
106
|
+
{
|
|
107
|
+
...n,
|
|
108
|
+
placeholder: e.placeholder,
|
|
109
|
+
className: t(c && "border-d-destructive"),
|
|
110
|
+
disabled: e.disabled,
|
|
111
|
+
...e.componentProps
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
] });
|
|
115
|
+
case "radio":
|
|
116
|
+
return /* @__PURE__ */ r("div", { children: [
|
|
117
|
+
l,
|
|
118
|
+
/* @__PURE__ */ a(
|
|
119
|
+
w,
|
|
120
|
+
{
|
|
121
|
+
value: n.value != null ? String(n.value) : "",
|
|
122
|
+
onValueChange: (o) => n.onChange(o),
|
|
123
|
+
className: "space-y-2",
|
|
124
|
+
disabled: e.disabled,
|
|
125
|
+
...e.componentProps,
|
|
126
|
+
children: (e.options ?? []).map((o) => {
|
|
127
|
+
const s = `${e.name}-${o.value}`;
|
|
128
|
+
return /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
67
129
|
/* @__PURE__ */ a(
|
|
68
130
|
I,
|
|
69
131
|
{
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
initialOptions: e.initialOptions,
|
|
73
|
-
renderOptionItem: e.renderOptionItem,
|
|
74
|
-
resolveOptionValue: e.resolveOptionValue,
|
|
75
|
-
renderSelectedValue: e.renderSelectedValue,
|
|
76
|
-
value: r.value,
|
|
77
|
-
onChange: r.onChange,
|
|
78
|
-
placeholder: e.placeholder,
|
|
79
|
-
disabled: e.disabled,
|
|
80
|
-
notFound: e.notFound,
|
|
81
|
-
noResultsMessage: e.noResultsMessage,
|
|
82
|
-
debounce: e.debounce,
|
|
83
|
-
clearable: e.clearable
|
|
84
|
-
}
|
|
85
|
-
)
|
|
86
|
-
] });
|
|
87
|
-
}
|
|
88
|
-
case "textarea":
|
|
89
|
-
return /* @__PURE__ */ l("div", { children: [
|
|
90
|
-
d,
|
|
91
|
-
/* @__PURE__ */ a(
|
|
92
|
-
$,
|
|
93
|
-
{
|
|
94
|
-
...r,
|
|
95
|
-
placeholder: e.placeholder,
|
|
96
|
-
className: s(o && "border-d-destructive"),
|
|
97
|
-
disabled: e.disabled
|
|
98
|
-
}
|
|
99
|
-
)
|
|
100
|
-
] });
|
|
101
|
-
case "radio":
|
|
102
|
-
return /* @__PURE__ */ l("div", { children: [
|
|
103
|
-
d,
|
|
104
|
-
/* @__PURE__ */ a(
|
|
105
|
-
R,
|
|
106
|
-
{
|
|
107
|
-
value: r.value != null ? String(r.value) : "",
|
|
108
|
-
onValueChange: (n) => r.onChange(n),
|
|
109
|
-
className: "space-y-2",
|
|
110
|
-
disabled: e.disabled,
|
|
111
|
-
children: (e.options ?? []).map((n) => {
|
|
112
|
-
const h = `${e.name}-${n.value}`;
|
|
113
|
-
return /* @__PURE__ */ l(
|
|
114
|
-
"div",
|
|
115
|
-
{
|
|
116
|
-
className: "flex items-center gap-2",
|
|
117
|
-
children: [
|
|
118
|
-
/* @__PURE__ */ a(
|
|
119
|
-
M,
|
|
120
|
-
{
|
|
121
|
-
id: h,
|
|
122
|
-
value: String(n.value),
|
|
123
|
-
disabled: e.disabled
|
|
124
|
-
}
|
|
125
|
-
),
|
|
126
|
-
/* @__PURE__ */ a(
|
|
127
|
-
t,
|
|
128
|
-
{
|
|
129
|
-
htmlFor: h,
|
|
130
|
-
className: s(
|
|
131
|
-
"cursor-pointer",
|
|
132
|
-
e.disabled && "cursor-not-allowed opacity-60"
|
|
133
|
-
),
|
|
134
|
-
children: n.label
|
|
135
|
-
}
|
|
136
|
-
)
|
|
137
|
-
]
|
|
138
|
-
},
|
|
139
|
-
n.value
|
|
140
|
-
);
|
|
141
|
-
})
|
|
142
|
-
}
|
|
143
|
-
)
|
|
144
|
-
] });
|
|
145
|
-
case "select":
|
|
146
|
-
return /* @__PURE__ */ l("div", { children: [
|
|
147
|
-
d,
|
|
148
|
-
/* @__PURE__ */ a(
|
|
149
|
-
v,
|
|
150
|
-
{
|
|
151
|
-
...r,
|
|
152
|
-
onValueChange: (n) => r.onChange(n),
|
|
153
|
-
options: e.options ?? [],
|
|
154
|
-
placeholder: e.placeholder,
|
|
155
|
-
disabled: e.disabled
|
|
156
|
-
}
|
|
157
|
-
)
|
|
158
|
-
] });
|
|
159
|
-
case "multiselect":
|
|
160
|
-
return /* @__PURE__ */ l("div", { children: [
|
|
161
|
-
d,
|
|
162
|
-
/* @__PURE__ */ a(
|
|
163
|
-
v,
|
|
164
|
-
{
|
|
165
|
-
...r,
|
|
166
|
-
multiple: !0,
|
|
167
|
-
onValueChange: (n) => r.onChange(n),
|
|
168
|
-
options: e.options ?? [],
|
|
169
|
-
placeholder: e.placeholder,
|
|
170
|
-
disabled: e.disabled
|
|
171
|
-
}
|
|
172
|
-
)
|
|
173
|
-
] });
|
|
174
|
-
case "datepicker":
|
|
175
|
-
return /* @__PURE__ */ l("div", { className: "relative", children: [
|
|
176
|
-
d,
|
|
177
|
-
e.calendarRange ? /* @__PURE__ */ a(
|
|
178
|
-
b,
|
|
179
|
-
{
|
|
180
|
-
mode: "range",
|
|
181
|
-
value: r.value,
|
|
182
|
-
onChange: e.disabled ? void 0 : (n) => r.onChange(n),
|
|
183
|
-
placeholder: e.placeholder,
|
|
132
|
+
id: s,
|
|
133
|
+
value: String(o.value),
|
|
184
134
|
disabled: e.disabled
|
|
185
135
|
}
|
|
186
|
-
) : /* @__PURE__ */ a(
|
|
187
|
-
b,
|
|
188
|
-
{
|
|
189
|
-
mode: "single",
|
|
190
|
-
value: r.value,
|
|
191
|
-
onChange: e.disabled ? void 0 : (n) => r.onChange(n),
|
|
192
|
-
placeholder: e.placeholder,
|
|
193
|
-
disabled: e.disabled,
|
|
194
|
-
customCalendarProps: e.disabled ? {
|
|
195
|
-
disabled: !0,
|
|
196
|
-
mode: "single"
|
|
197
|
-
} : void 0
|
|
198
|
-
}
|
|
199
|
-
)
|
|
200
|
-
] });
|
|
201
|
-
case "checkbox":
|
|
202
|
-
return /* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
|
|
203
|
-
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
204
|
-
/* @__PURE__ */ a(
|
|
205
|
-
F,
|
|
206
|
-
{
|
|
207
|
-
...r,
|
|
208
|
-
id: e.name,
|
|
209
|
-
onCheckedChange: (n) => r.onChange(n),
|
|
210
|
-
defaultChecked: !!e.defaultValue,
|
|
211
|
-
disabled: e.disabled
|
|
212
|
-
}
|
|
213
|
-
),
|
|
214
|
-
/* @__PURE__ */ a(
|
|
215
|
-
t,
|
|
216
|
-
{
|
|
217
|
-
htmlFor: e.name,
|
|
218
|
-
className: s(
|
|
219
|
-
"cursor-pointer",
|
|
220
|
-
e.disabled && "cursor-not-allowed opacity-60"
|
|
221
|
-
),
|
|
222
|
-
children: e.label
|
|
223
|
-
}
|
|
224
|
-
),
|
|
225
|
-
o && /* @__PURE__ */ a("span", { className: "text-d-destructive text-xs", children: o })
|
|
226
|
-
] }),
|
|
227
|
-
e.caption && /* @__PURE__ */ a(
|
|
228
|
-
i,
|
|
229
|
-
{
|
|
230
|
-
variant: "caption",
|
|
231
|
-
className: "text-d-muted-foreground",
|
|
232
|
-
children: e.caption
|
|
233
|
-
}
|
|
234
|
-
)
|
|
235
|
-
] });
|
|
236
|
-
case "switch":
|
|
237
|
-
return /* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
|
|
238
|
-
/* @__PURE__ */ l("div", { className: "flex items-center justify-between", children: [
|
|
239
|
-
/* @__PURE__ */ l("div", { children: [
|
|
240
|
-
/* @__PURE__ */ a(t, { htmlFor: e.name, children: e.label }),
|
|
241
|
-
e.caption && /* @__PURE__ */ a(
|
|
242
|
-
i,
|
|
243
|
-
{
|
|
244
|
-
variant: "caption",
|
|
245
|
-
className: "text-d-muted-foreground mt-0.5",
|
|
246
|
-
children: e.caption
|
|
247
|
-
}
|
|
248
|
-
)
|
|
249
|
-
] }),
|
|
250
|
-
/* @__PURE__ */ a(
|
|
251
|
-
T,
|
|
252
|
-
{
|
|
253
|
-
id: e.name,
|
|
254
|
-
checked: !!r.value,
|
|
255
|
-
onCheckedChange: (n) => r.onChange(n),
|
|
256
|
-
disabled: e.disabled
|
|
257
|
-
}
|
|
258
|
-
)
|
|
259
|
-
] }),
|
|
260
|
-
o && /* @__PURE__ */ a("span", { className: "text-d-destructive text-xs", children: o })
|
|
261
|
-
] });
|
|
262
|
-
case "slider":
|
|
263
|
-
return /* @__PURE__ */ l("div", { children: [
|
|
264
|
-
d,
|
|
265
|
-
/* @__PURE__ */ a(
|
|
266
|
-
B,
|
|
267
|
-
{
|
|
268
|
-
value: Array.isArray(r.value) ? r.value : [r.value || e.min || 0],
|
|
269
|
-
onValueChange: (n) => r.onChange(n[0]),
|
|
270
|
-
min: e.min ?? 0,
|
|
271
|
-
max: e.max ?? 100,
|
|
272
|
-
step: e.step ?? 1,
|
|
273
|
-
disabled: e.disabled,
|
|
274
|
-
showValues: !0
|
|
275
|
-
}
|
|
276
136
|
),
|
|
277
|
-
|
|
278
|
-
|
|
137
|
+
/* @__PURE__ */ a(
|
|
138
|
+
u,
|
|
279
139
|
{
|
|
280
|
-
|
|
281
|
-
className:
|
|
282
|
-
|
|
140
|
+
htmlFor: s,
|
|
141
|
+
className: t(
|
|
142
|
+
"cursor-pointer",
|
|
143
|
+
e.disabled && "cursor-not-allowed opacity-60"
|
|
144
|
+
),
|
|
145
|
+
children: o.label
|
|
283
146
|
}
|
|
284
147
|
)
|
|
285
|
-
] });
|
|
148
|
+
] }, o.value);
|
|
149
|
+
})
|
|
286
150
|
}
|
|
287
|
-
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
151
|
+
)
|
|
152
|
+
] });
|
|
153
|
+
case "select":
|
|
154
|
+
return /* @__PURE__ */ r("div", { children: [
|
|
155
|
+
l,
|
|
156
|
+
/* @__PURE__ */ a(
|
|
157
|
+
h,
|
|
158
|
+
{
|
|
159
|
+
...n,
|
|
160
|
+
onValueChange: (o) => n.onChange(o),
|
|
161
|
+
options: e.options ?? [],
|
|
162
|
+
placeholder: e.placeholder,
|
|
163
|
+
disabled: e.disabled,
|
|
164
|
+
searchable: e.searchable ?? !0,
|
|
165
|
+
...e.componentProps
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
] });
|
|
169
|
+
case "multiselect":
|
|
170
|
+
return /* @__PURE__ */ r("div", { children: [
|
|
171
|
+
l,
|
|
172
|
+
/* @__PURE__ */ a(
|
|
173
|
+
h,
|
|
174
|
+
{
|
|
175
|
+
...n,
|
|
176
|
+
multiple: !0,
|
|
177
|
+
onValueChange: (o) => n.onChange(o),
|
|
178
|
+
options: e.options ?? [],
|
|
179
|
+
placeholder: e.placeholder,
|
|
180
|
+
disabled: e.disabled,
|
|
181
|
+
searchable: e.searchable ?? !0,
|
|
182
|
+
...e.componentProps
|
|
183
|
+
}
|
|
184
|
+
)
|
|
185
|
+
] });
|
|
186
|
+
case "datepicker":
|
|
187
|
+
return /* @__PURE__ */ r("div", { className: "relative", children: [
|
|
188
|
+
l,
|
|
189
|
+
e.calendarRange ? /* @__PURE__ */ a(
|
|
190
|
+
v,
|
|
191
|
+
{
|
|
192
|
+
mode: "range",
|
|
193
|
+
value: n.value,
|
|
194
|
+
onChange: e.disabled ? void 0 : (o) => n.onChange(o),
|
|
195
|
+
placeholder: e.placeholder,
|
|
196
|
+
disabled: e.disabled,
|
|
197
|
+
...e.componentProps
|
|
198
|
+
}
|
|
199
|
+
) : /* @__PURE__ */ a(
|
|
200
|
+
v,
|
|
201
|
+
{
|
|
202
|
+
mode: "single",
|
|
203
|
+
value: n.value,
|
|
204
|
+
onChange: e.disabled ? void 0 : (o) => n.onChange(o),
|
|
205
|
+
placeholder: e.placeholder,
|
|
206
|
+
disabled: e.disabled,
|
|
207
|
+
customCalendarProps: e.disabled ? {
|
|
208
|
+
disabled: !0,
|
|
209
|
+
mode: "single"
|
|
210
|
+
} : void 0,
|
|
211
|
+
...e.componentProps
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
] });
|
|
215
|
+
case "checkbox":
|
|
216
|
+
return /* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
217
|
+
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
218
|
+
/* @__PURE__ */ a(
|
|
219
|
+
R,
|
|
220
|
+
{
|
|
221
|
+
...n,
|
|
222
|
+
id: e.name,
|
|
223
|
+
onCheckedChange: (o) => n.onChange(o),
|
|
224
|
+
defaultChecked: !!e.defaultValue,
|
|
225
|
+
disabled: e.disabled,
|
|
226
|
+
...e.componentProps
|
|
227
|
+
}
|
|
228
|
+
),
|
|
229
|
+
/* @__PURE__ */ a(
|
|
230
|
+
u,
|
|
231
|
+
{
|
|
232
|
+
htmlFor: e.name,
|
|
233
|
+
className: t(
|
|
234
|
+
"cursor-pointer",
|
|
235
|
+
e.disabled && "cursor-not-allowed opacity-60"
|
|
236
|
+
),
|
|
237
|
+
children: e.label
|
|
238
|
+
}
|
|
239
|
+
),
|
|
240
|
+
c && /* @__PURE__ */ a("span", { className: "text-d-destructive text-xs", children: c })
|
|
241
|
+
] }),
|
|
242
|
+
e.caption && /* @__PURE__ */ a(p, { variant: "caption", className: "text-d-muted-foreground", children: e.caption })
|
|
243
|
+
] });
|
|
244
|
+
case "switch":
|
|
245
|
+
return /* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
246
|
+
/* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
247
|
+
/* @__PURE__ */ r("div", { children: [
|
|
248
|
+
/* @__PURE__ */ a(u, { htmlFor: e.name, children: e.label }),
|
|
249
|
+
e.caption && /* @__PURE__ */ a(
|
|
250
|
+
p,
|
|
251
|
+
{
|
|
252
|
+
variant: "caption",
|
|
253
|
+
className: "text-d-muted-foreground mt-0.5",
|
|
254
|
+
children: e.caption
|
|
255
|
+
}
|
|
256
|
+
)
|
|
257
|
+
] }),
|
|
258
|
+
/* @__PURE__ */ a(
|
|
259
|
+
F,
|
|
260
|
+
{
|
|
261
|
+
id: e.name,
|
|
262
|
+
checked: !!n.value,
|
|
263
|
+
onCheckedChange: (o) => n.onChange(o),
|
|
264
|
+
disabled: e.disabled,
|
|
265
|
+
...e.componentProps
|
|
266
|
+
}
|
|
267
|
+
)
|
|
268
|
+
] }),
|
|
269
|
+
c && /* @__PURE__ */ a("span", { className: "text-d-destructive text-xs", children: c })
|
|
270
|
+
] });
|
|
271
|
+
case "slider":
|
|
272
|
+
return /* @__PURE__ */ r("div", { children: [
|
|
273
|
+
l,
|
|
274
|
+
/* @__PURE__ */ a(
|
|
275
|
+
O,
|
|
276
|
+
{
|
|
277
|
+
value: Array.isArray(n.value) ? n.value : [n.value || e.min || 0],
|
|
278
|
+
onValueChange: (o) => n.onChange(o[0]),
|
|
279
|
+
min: e.min ?? 0,
|
|
280
|
+
max: e.max ?? 100,
|
|
281
|
+
step: e.step ?? 1,
|
|
282
|
+
disabled: e.disabled,
|
|
283
|
+
showValues: !0,
|
|
284
|
+
...e.componentProps
|
|
285
|
+
}
|
|
286
|
+
),
|
|
287
|
+
e.caption && /* @__PURE__ */ a(p, { variant: "caption", className: "text-d-muted-foreground mt-1", children: e.caption })
|
|
288
|
+
] });
|
|
289
|
+
case "custom":
|
|
290
|
+
return e.render ? /* @__PURE__ */ a(f, { children: e.render({
|
|
291
|
+
field: n,
|
|
292
|
+
error: c,
|
|
293
|
+
label: l
|
|
294
|
+
}) }) : /* @__PURE__ */ r("div", { children: [
|
|
295
|
+
l,
|
|
296
|
+
/* @__PURE__ */ a(p, { variant: "caption", className: "text-d-destructive", children: "Custom component richiede prop 'render'." })
|
|
297
|
+
] });
|
|
298
|
+
default:
|
|
299
|
+
return /* @__PURE__ */ a("div", {});
|
|
300
|
+
}
|
|
301
|
+
}, _ = ({
|
|
302
|
+
items: e,
|
|
303
|
+
cols: n = "2",
|
|
304
|
+
form: c,
|
|
305
|
+
submitText: l = "Invia",
|
|
306
|
+
onSubmit: o,
|
|
307
|
+
isSubmitting: s = !1,
|
|
308
|
+
showSubmitButton: i = !1
|
|
309
|
+
}) => {
|
|
310
|
+
const {
|
|
311
|
+
control: b,
|
|
312
|
+
handleSubmit: g,
|
|
313
|
+
formState: { errors: m, isValid: x, isDirty: C }
|
|
314
|
+
} = c, N = (d) => d.colSpan ? `col-span-${d.colSpan}` : "";
|
|
315
|
+
return /* @__PURE__ */ r("form", { onSubmit: g((d) => o?.(d)), children: [
|
|
316
|
+
/* @__PURE__ */ a("div", { className: t("grid gap-4", `grid-cols-${n}`), children: e.map((d, y) => /* @__PURE__ */ a(
|
|
293
317
|
"div",
|
|
294
318
|
{
|
|
295
|
-
className:
|
|
296
|
-
|
|
319
|
+
className: t(
|
|
320
|
+
N(d) || y === e.length - 1 && "col-span-full"
|
|
321
|
+
),
|
|
322
|
+
children: /* @__PURE__ */ a(
|
|
323
|
+
j,
|
|
324
|
+
{
|
|
325
|
+
item: d,
|
|
326
|
+
errors: m,
|
|
327
|
+
control: b
|
|
328
|
+
}
|
|
329
|
+
)
|
|
297
330
|
},
|
|
298
|
-
|
|
331
|
+
d.name
|
|
299
332
|
)) }),
|
|
300
|
-
|
|
301
|
-
|
|
333
|
+
i && /* @__PURE__ */ a("div", { className: "mt-4 flex justify-end", children: /* @__PURE__ */ a(
|
|
334
|
+
V,
|
|
302
335
|
{
|
|
303
336
|
type: "submit",
|
|
304
|
-
disabled: !
|
|
305
|
-
isLoading:
|
|
306
|
-
children:
|
|
337
|
+
disabled: !x || !C || s,
|
|
338
|
+
isLoading: s,
|
|
339
|
+
children: l
|
|
307
340
|
}
|
|
308
341
|
) })
|
|
309
342
|
] });
|
|
310
343
|
};
|
|
311
344
|
export {
|
|
312
|
-
|
|
345
|
+
_ as AppForm
|
|
313
346
|
};
|