laif-ds 0.2.47 → 0.2.49
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/_virtual/index2.js +2 -5
- package/dist/_virtual/index3.js +5 -2
- package/dist/agent-docs/components/AppForm.md +66 -1
- package/dist/agent-docs/components/AsyncSelect.md +94 -103
- package/dist/components/kanban.js +544 -0
- package/dist/components/ui/app-form.js +76 -44
- package/dist/components/ui/app-kanban.js +157 -0
- package/dist/components/ui/app-select.js +100 -87
- package/dist/components/ui/async-select.js +264 -278
- package/dist/index.d.ts +84 -29
- package/dist/index.js +77 -75
- package/dist/node_modules/@radix-ui/react-alert-dialog/dist/index.js +1 -1
- package/dist/node_modules/@radix-ui/react-alert-dialog/node_modules/@radix-ui/react-slot/dist/index.js +12 -0
- package/dist/node_modules/@radix-ui/react-collection/dist/index.js +1 -1
- package/dist/node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/dist/index.js +50 -0
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +1 -1
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-slot/dist/index.js +50 -0
- package/dist/node_modules/@radix-ui/react-menu/dist/index.js +1 -1
- package/dist/node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-slot/dist/index.js +50 -0
- package/dist/node_modules/@radix-ui/react-popover/dist/index.js +1 -1
- package/dist/node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-slot/dist/index.js +50 -0
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +1 -1
- package/dist/node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.js +50 -0
- package/dist/node_modules/@radix-ui/react-select/dist/index.js +1 -1
- package/dist/node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-slot/dist/index.js +50 -0
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +47 -44
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +1 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.js +12 -0
- package/dist/node_modules/eventemitter3/index.js +1 -1
- package/dist/node_modules/recharts/es6/util/Events.js +1 -1
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +536 -502
- package/dist/node_modules/use-sync-external-store/shim/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +4 -4
|
@@ -1,92 +1,124 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as l, jsx as a } from "react/jsx-runtime";
|
|
3
|
-
import { cn as
|
|
4
|
-
import { Controller as
|
|
3
|
+
import { cn as s } from "../../lib/utils.js";
|
|
4
|
+
import { Controller as w } from "../../node_modules/react-hook-form/dist/index.esm.js";
|
|
5
5
|
import { AppSelect as v } from "./app-select.js";
|
|
6
|
-
import {
|
|
6
|
+
import { AsyncSelect as O } from "./async-select.js";
|
|
7
|
+
import { Button as I } from "./button.js";
|
|
7
8
|
import { Checkbox as A } from "./checkbox.js";
|
|
8
9
|
import { DatePicker as F } from "./date-picker.js";
|
|
9
|
-
import { Input as
|
|
10
|
+
import { Input as R } from "./input.js";
|
|
10
11
|
import { Label as t } from "./label.js";
|
|
11
|
-
import { RadioGroup as
|
|
12
|
-
import { Slider as
|
|
13
|
-
import { Switch as
|
|
14
|
-
import { Textarea as
|
|
12
|
+
import { RadioGroup as j, RadioGroupItem as M } from "./radio-group.js";
|
|
13
|
+
import { Slider as B } from "./slider.js";
|
|
14
|
+
import { Switch as T } from "./switch.js";
|
|
15
|
+
import { Textarea as $ } from "./textarea.js";
|
|
15
16
|
import { Typo as i } from "./typo.js";
|
|
16
|
-
const
|
|
17
|
-
items:
|
|
18
|
-
cols:
|
|
19
|
-
form:
|
|
17
|
+
const Z = ({
|
|
18
|
+
items: u,
|
|
19
|
+
cols: b = "2",
|
|
20
|
+
form: m,
|
|
20
21
|
submitText: g = "Invia",
|
|
21
22
|
onSubmit: x,
|
|
22
|
-
isSubmitting:
|
|
23
|
+
isSubmitting: p = !1,
|
|
23
24
|
showSubmitButton: C = !1
|
|
24
25
|
}) => {
|
|
25
26
|
const {
|
|
26
27
|
control: N,
|
|
27
28
|
handleSubmit: y,
|
|
28
|
-
formState: { errors: f, isValid: S, isDirty:
|
|
29
|
-
} =
|
|
29
|
+
formState: { errors: f, isValid: S, isDirty: V }
|
|
30
|
+
} = m, k = (e) => {
|
|
30
31
|
const c = f[e.name]?.message, d = c ? String(c) : void 0;
|
|
31
32
|
return /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
|
|
32
|
-
|
|
33
|
+
w,
|
|
33
34
|
{
|
|
34
35
|
name: e.name,
|
|
35
36
|
control: N,
|
|
36
37
|
render: ({ field: r }) => {
|
|
37
|
-
const
|
|
38
|
+
const o = /* @__PURE__ */ l("div", { className: "mb-2 flex items-center justify-between", children: [
|
|
38
39
|
/* @__PURE__ */ a(t, { children: e.label }),
|
|
39
40
|
d && /* @__PURE__ */ a("span", { className: "text-d-destructive text-xs", children: d })
|
|
40
41
|
] });
|
|
41
42
|
switch (e.component) {
|
|
42
43
|
case "input":
|
|
43
44
|
return /* @__PURE__ */ l("div", { children: [
|
|
44
|
-
|
|
45
|
+
o,
|
|
45
46
|
/* @__PURE__ */ a(
|
|
46
|
-
|
|
47
|
+
R,
|
|
47
48
|
{
|
|
48
49
|
...r,
|
|
49
50
|
type: e.inputType,
|
|
50
51
|
placeholder: e.placeholder,
|
|
51
|
-
className:
|
|
52
|
+
className: s(d && "border-d-destructive"),
|
|
52
53
|
disabled: e.disabled
|
|
53
54
|
}
|
|
54
55
|
)
|
|
55
56
|
] });
|
|
57
|
+
case "async":
|
|
58
|
+
case "async-multiple": {
|
|
59
|
+
if (!e.fetcher || !e.renderOptionItem || !e.resolveOptionValue || !e.renderSelectedValue)
|
|
60
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
61
|
+
o,
|
|
62
|
+
/* @__PURE__ */ a(i, { variant: "caption", className: "text-d-destructive", children: "Async select non configurato correttamente." })
|
|
63
|
+
] });
|
|
64
|
+
const n = e.component === "async-multiple";
|
|
65
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
66
|
+
o,
|
|
67
|
+
/* @__PURE__ */ a(
|
|
68
|
+
O,
|
|
69
|
+
{
|
|
70
|
+
multiple: n,
|
|
71
|
+
fetcher: e.fetcher,
|
|
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
|
+
}
|
|
56
88
|
case "textarea":
|
|
57
89
|
return /* @__PURE__ */ l("div", { children: [
|
|
58
|
-
|
|
90
|
+
o,
|
|
59
91
|
/* @__PURE__ */ a(
|
|
60
|
-
|
|
92
|
+
$,
|
|
61
93
|
{
|
|
62
94
|
...r,
|
|
63
95
|
placeholder: e.placeholder,
|
|
64
|
-
className:
|
|
96
|
+
className: s(d && "border-d-destructive"),
|
|
65
97
|
disabled: e.disabled
|
|
66
98
|
}
|
|
67
99
|
)
|
|
68
100
|
] });
|
|
69
101
|
case "radio":
|
|
70
102
|
return /* @__PURE__ */ l("div", { children: [
|
|
71
|
-
|
|
103
|
+
o,
|
|
72
104
|
/* @__PURE__ */ a(
|
|
73
|
-
|
|
105
|
+
j,
|
|
74
106
|
{
|
|
75
107
|
value: r.value != null ? String(r.value) : "",
|
|
76
108
|
onValueChange: (n) => r.onChange(n),
|
|
77
109
|
className: "space-y-2",
|
|
78
110
|
disabled: e.disabled,
|
|
79
111
|
children: (e.options ?? []).map((n) => {
|
|
80
|
-
const
|
|
112
|
+
const h = `${e.name}-${n.value}`;
|
|
81
113
|
return /* @__PURE__ */ l(
|
|
82
114
|
"div",
|
|
83
115
|
{
|
|
84
116
|
className: "flex items-center gap-2",
|
|
85
117
|
children: [
|
|
86
118
|
/* @__PURE__ */ a(
|
|
87
|
-
|
|
119
|
+
M,
|
|
88
120
|
{
|
|
89
|
-
id:
|
|
121
|
+
id: h,
|
|
90
122
|
value: String(n.value),
|
|
91
123
|
disabled: e.disabled
|
|
92
124
|
}
|
|
@@ -94,8 +126,8 @@ const X = ({
|
|
|
94
126
|
/* @__PURE__ */ a(
|
|
95
127
|
t,
|
|
96
128
|
{
|
|
97
|
-
htmlFor:
|
|
98
|
-
className:
|
|
129
|
+
htmlFor: h,
|
|
130
|
+
className: s(
|
|
99
131
|
"cursor-pointer",
|
|
100
132
|
e.disabled && "cursor-not-allowed opacity-60"
|
|
101
133
|
),
|
|
@@ -112,7 +144,7 @@ const X = ({
|
|
|
112
144
|
] });
|
|
113
145
|
case "select":
|
|
114
146
|
return /* @__PURE__ */ l("div", { children: [
|
|
115
|
-
|
|
147
|
+
o,
|
|
116
148
|
/* @__PURE__ */ a(
|
|
117
149
|
v,
|
|
118
150
|
{
|
|
@@ -126,7 +158,7 @@ const X = ({
|
|
|
126
158
|
] });
|
|
127
159
|
case "multiselect":
|
|
128
160
|
return /* @__PURE__ */ l("div", { children: [
|
|
129
|
-
|
|
161
|
+
o,
|
|
130
162
|
/* @__PURE__ */ a(
|
|
131
163
|
v,
|
|
132
164
|
{
|
|
@@ -141,7 +173,7 @@ const X = ({
|
|
|
141
173
|
] });
|
|
142
174
|
case "datepicker":
|
|
143
175
|
return /* @__PURE__ */ l("div", { className: "relative", children: [
|
|
144
|
-
|
|
176
|
+
o,
|
|
145
177
|
/* @__PURE__ */ a(
|
|
146
178
|
F,
|
|
147
179
|
{
|
|
@@ -177,7 +209,7 @@ const X = ({
|
|
|
177
209
|
t,
|
|
178
210
|
{
|
|
179
211
|
htmlFor: e.name,
|
|
180
|
-
className:
|
|
212
|
+
className: s(
|
|
181
213
|
"cursor-pointer",
|
|
182
214
|
e.disabled && "cursor-not-allowed opacity-60"
|
|
183
215
|
),
|
|
@@ -210,7 +242,7 @@ const X = ({
|
|
|
210
242
|
)
|
|
211
243
|
] }),
|
|
212
244
|
/* @__PURE__ */ a(
|
|
213
|
-
|
|
245
|
+
T,
|
|
214
246
|
{
|
|
215
247
|
id: e.name,
|
|
216
248
|
checked: !!r.value,
|
|
@@ -223,9 +255,9 @@ const X = ({
|
|
|
223
255
|
] });
|
|
224
256
|
case "slider":
|
|
225
257
|
return /* @__PURE__ */ l("div", { children: [
|
|
226
|
-
|
|
258
|
+
o,
|
|
227
259
|
/* @__PURE__ */ a(
|
|
228
|
-
|
|
260
|
+
B,
|
|
229
261
|
{
|
|
230
262
|
value: Array.isArray(r.value) ? r.value : [r.value || e.min || 0],
|
|
231
263
|
onValueChange: (n) => r.onChange(n[0]),
|
|
@@ -251,25 +283,25 @@ const X = ({
|
|
|
251
283
|
) });
|
|
252
284
|
};
|
|
253
285
|
return /* @__PURE__ */ l("form", { onSubmit: y((e) => x?.(e)), children: [
|
|
254
|
-
/* @__PURE__ */ a("div", { className:
|
|
286
|
+
/* @__PURE__ */ a("div", { className: s("grid gap-4", `grid-cols-${b}`), children: u.map((e, c) => /* @__PURE__ */ a(
|
|
255
287
|
"div",
|
|
256
288
|
{
|
|
257
|
-
className:
|
|
258
|
-
children:
|
|
289
|
+
className: s(c === u.length - 1 && "col-span-full"),
|
|
290
|
+
children: k(e)
|
|
259
291
|
},
|
|
260
292
|
e.name
|
|
261
293
|
)) }),
|
|
262
294
|
C && /* @__PURE__ */ a("div", { className: "mt-4 flex justify-end", children: /* @__PURE__ */ a(
|
|
263
|
-
|
|
295
|
+
I,
|
|
264
296
|
{
|
|
265
297
|
type: "submit",
|
|
266
|
-
disabled: !S || !
|
|
267
|
-
isLoading:
|
|
298
|
+
disabled: !S || !V || p,
|
|
299
|
+
isLoading: p,
|
|
268
300
|
children: g
|
|
269
301
|
}
|
|
270
302
|
) })
|
|
271
303
|
] });
|
|
272
304
|
};
|
|
273
305
|
export {
|
|
274
|
-
|
|
306
|
+
Z as AppForm
|
|
275
307
|
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as o, jsxs as l, Fragment as $ } from "react/jsx-runtime";
|
|
3
|
+
import { useState as z } from "react";
|
|
4
|
+
import { KanbanBoardProvider as H, KanbanBoard as I, KanbanBoardColumn as S, KanbanBoardColumnHeader as w, KanbanBoardColumnList as A, KanbanBoardColumnListItem as F, KanbanBoardCard as J, KanbanBoardCardTitle as W, KanbanBoardCardDescription as q } from "../kanban.js";
|
|
5
|
+
import { stringToHexColor as E } from "../../lib/utils.js";
|
|
6
|
+
import { Icon as G } from "./icon.js";
|
|
7
|
+
import Q from "../../node_modules/lucide-react/dist/esm/icons/plus.js";
|
|
8
|
+
function _({
|
|
9
|
+
columns: y,
|
|
10
|
+
initialTasks: K,
|
|
11
|
+
onTaskMove: p,
|
|
12
|
+
onTaskEdit: x,
|
|
13
|
+
onTaskCreate: u,
|
|
14
|
+
taskActions: B,
|
|
15
|
+
renderTaskContent: b,
|
|
16
|
+
className: j,
|
|
17
|
+
allowTaskCreate: v = !0,
|
|
18
|
+
createTaskLabel: O = "Nuovo task"
|
|
19
|
+
}) {
|
|
20
|
+
const [h, C] = z(K), g = (r) => {
|
|
21
|
+
const n = {};
|
|
22
|
+
for (const e of Object.keys(r))
|
|
23
|
+
n[e] = [...r[e]];
|
|
24
|
+
return n;
|
|
25
|
+
}, D = (r, n) => {
|
|
26
|
+
C((e) => {
|
|
27
|
+
const t = g(e);
|
|
28
|
+
let d, i;
|
|
29
|
+
for (const s of Object.keys(t)) {
|
|
30
|
+
const c = t[s].findIndex((m) => m.id === r);
|
|
31
|
+
if (c !== -1) {
|
|
32
|
+
i = s, [d] = t[s].splice(c, 1);
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return !d || i === n ? e : (t[n] || (t[n] = []), t[n].push(d), i && p && p(r, i, n), t);
|
|
37
|
+
});
|
|
38
|
+
}, L = (r, n, e, t) => {
|
|
39
|
+
C((d) => {
|
|
40
|
+
const i = g(d), s = Object.keys(i).find(
|
|
41
|
+
(a) => i[a].some((P) => P.id === r)
|
|
42
|
+
);
|
|
43
|
+
if (!s) return d;
|
|
44
|
+
const c = i[s].findIndex(
|
|
45
|
+
(a) => a.id === r
|
|
46
|
+
);
|
|
47
|
+
if (c === -1) return d;
|
|
48
|
+
const [m] = i[s].splice(c, 1);
|
|
49
|
+
i[e] || (i[e] = []);
|
|
50
|
+
const f = i[e].findIndex(
|
|
51
|
+
(a) => a.id === n
|
|
52
|
+
);
|
|
53
|
+
if (f === -1)
|
|
54
|
+
i[e].push(m);
|
|
55
|
+
else {
|
|
56
|
+
const a = t === "top" ? f : f + 1;
|
|
57
|
+
i[e].splice(a, 0, m);
|
|
58
|
+
}
|
|
59
|
+
return s !== e && p && p(r, s, e), i;
|
|
60
|
+
});
|
|
61
|
+
}, N = (r) => JSON.parse(r);
|
|
62
|
+
return /* @__PURE__ */ o(H, { children: /* @__PURE__ */ o(I, { className: j, children: y.map((r) => {
|
|
63
|
+
const n = E(r.label);
|
|
64
|
+
return /* @__PURE__ */ l(
|
|
65
|
+
S,
|
|
66
|
+
{
|
|
67
|
+
columnId: r.id,
|
|
68
|
+
onDropOverColumn: (e) => {
|
|
69
|
+
const t = N(e);
|
|
70
|
+
D(t.id, r.id);
|
|
71
|
+
},
|
|
72
|
+
className: "group/column border-0",
|
|
73
|
+
style: {
|
|
74
|
+
backgroundColor: `${n}1d`
|
|
75
|
+
},
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ o(w, { className: "relative mb-2", children: /* @__PURE__ */ l("div", { className: "flex items-center gap-1.5", children: [
|
|
78
|
+
/* @__PURE__ */ o(
|
|
79
|
+
"span",
|
|
80
|
+
{
|
|
81
|
+
className: "inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-sm font-semibold tracking-tight",
|
|
82
|
+
style: {
|
|
83
|
+
backgroundColor: `${n}18`,
|
|
84
|
+
color: n
|
|
85
|
+
},
|
|
86
|
+
children: r.label
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ o("span", { className: "text-d-muted-foreground text-sm", children: h[r.id]?.length ?? 0 })
|
|
90
|
+
] }) }),
|
|
91
|
+
/* @__PURE__ */ o(A, { children: h[r.id]?.map((e) => /* @__PURE__ */ o(
|
|
92
|
+
F,
|
|
93
|
+
{
|
|
94
|
+
cardId: e.id,
|
|
95
|
+
onDropOverListItem: (t, d) => {
|
|
96
|
+
if (d === "none") return;
|
|
97
|
+
const i = N(t);
|
|
98
|
+
L(
|
|
99
|
+
i.id,
|
|
100
|
+
e.id,
|
|
101
|
+
r.id,
|
|
102
|
+
d
|
|
103
|
+
);
|
|
104
|
+
},
|
|
105
|
+
children: /* @__PURE__ */ o(
|
|
106
|
+
J,
|
|
107
|
+
{
|
|
108
|
+
data: e,
|
|
109
|
+
onEdit: x ? () => x(e, r.id) : void 0,
|
|
110
|
+
actions: B?.(e, r.id),
|
|
111
|
+
meta: e.meta,
|
|
112
|
+
backgroundColor: n,
|
|
113
|
+
children: b ? b(e, r.id) : /* @__PURE__ */ l($, { children: [
|
|
114
|
+
/* @__PURE__ */ l("div", { className: "flex items-start gap-2", children: [
|
|
115
|
+
e.icon && /* @__PURE__ */ o(
|
|
116
|
+
G,
|
|
117
|
+
{
|
|
118
|
+
name: e.icon,
|
|
119
|
+
size: "sm",
|
|
120
|
+
className: "text-d-foreground/80 mt-0.5"
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
/* @__PURE__ */ o(W, { className: "flex-1", children: e.title })
|
|
124
|
+
] }),
|
|
125
|
+
e.description && /* @__PURE__ */ o(q, { children: e.description })
|
|
126
|
+
] })
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
},
|
|
130
|
+
e.id
|
|
131
|
+
)) }),
|
|
132
|
+
v && u && /* @__PURE__ */ o("div", { className: "px-2 pt-1", children: /* @__PURE__ */ l(
|
|
133
|
+
"button",
|
|
134
|
+
{
|
|
135
|
+
className: "flex w-full cursor-pointer items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-sm transition-colors",
|
|
136
|
+
style: {
|
|
137
|
+
backgroundColor: `${n}1a`,
|
|
138
|
+
color: n
|
|
139
|
+
},
|
|
140
|
+
onClick: (e) => {
|
|
141
|
+
e.stopPropagation(), u(r.id);
|
|
142
|
+
},
|
|
143
|
+
children: [
|
|
144
|
+
/* @__PURE__ */ o(Q, { className: "size-4" }),
|
|
145
|
+
/* @__PURE__ */ o("span", { children: O })
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
) })
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
r.id
|
|
152
|
+
);
|
|
153
|
+
}) }) });
|
|
154
|
+
}
|
|
155
|
+
export {
|
|
156
|
+
_ as AppKanban
|
|
157
|
+
};
|