laif-ds 0.2.47 → 0.2.48
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 +540 -0
- package/dist/components/ui/app-form.js +76 -44
- package/dist/components/ui/app-kanban.js +137 -0
- package/dist/components/ui/app-select.js +100 -87
- package/dist/components/ui/async-select.js +264 -278
- package/dist/index.d.ts +81 -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,137 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as d, jsxs as f, Fragment as P } from "react/jsx-runtime";
|
|
3
|
+
import { useState as H } from "react";
|
|
4
|
+
import { KanbanBoardProvider as S, KanbanBoard as A, KanbanBoardColumn as F, KanbanBoardColumnHeader as I, KanbanBoardColumnList as J, KanbanBoardColumnListItem as W, KanbanBoardCard as $, KanbanBoardCardTitle as q, KanbanBoardCardDescription as w } from "../kanban.js";
|
|
5
|
+
import { Button as E } from "./button.js";
|
|
6
|
+
import { stringToHexColor as x } from "../../lib/utils.js";
|
|
7
|
+
import G from "../../node_modules/lucide-react/dist/esm/icons/plus.js";
|
|
8
|
+
function Z({
|
|
9
|
+
columns: g,
|
|
10
|
+
initialTasks: N,
|
|
11
|
+
onTaskMove: l,
|
|
12
|
+
onTaskEdit: b,
|
|
13
|
+
onTaskCreate: h,
|
|
14
|
+
taskActions: O,
|
|
15
|
+
renderTaskContent: u,
|
|
16
|
+
className: j,
|
|
17
|
+
allowTaskCreate: v = !0
|
|
18
|
+
}) {
|
|
19
|
+
const [C, K] = H(N), y = (e) => {
|
|
20
|
+
const i = {};
|
|
21
|
+
for (const r of Object.keys(e))
|
|
22
|
+
i[r] = [...e[r]];
|
|
23
|
+
return i;
|
|
24
|
+
}, D = (e, i) => {
|
|
25
|
+
K((r) => {
|
|
26
|
+
const o = y(r);
|
|
27
|
+
let t, n;
|
|
28
|
+
for (const a of Object.keys(o)) {
|
|
29
|
+
const c = o[a].findIndex((p) => p.id === e);
|
|
30
|
+
if (c !== -1) {
|
|
31
|
+
n = a, [t] = o[a].splice(c, 1);
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return !t || n === i ? r : (o[i] || (o[i] = []), o[i].push(t), n && l && l(e, n, i), o);
|
|
36
|
+
});
|
|
37
|
+
}, z = (e, i, r, o) => {
|
|
38
|
+
K((t) => {
|
|
39
|
+
const n = y(t), a = Object.keys(n).find(
|
|
40
|
+
(s) => n[s].some((L) => L.id === e)
|
|
41
|
+
);
|
|
42
|
+
if (!a) return t;
|
|
43
|
+
const c = n[a].findIndex(
|
|
44
|
+
(s) => s.id === e
|
|
45
|
+
);
|
|
46
|
+
if (c === -1) return t;
|
|
47
|
+
const [p] = n[a].splice(c, 1);
|
|
48
|
+
n[r] || (n[r] = []);
|
|
49
|
+
const m = n[r].findIndex(
|
|
50
|
+
(s) => s.id === i
|
|
51
|
+
);
|
|
52
|
+
if (m === -1)
|
|
53
|
+
n[r].push(p);
|
|
54
|
+
else {
|
|
55
|
+
const s = o === "top" ? m : m + 1;
|
|
56
|
+
n[r].splice(s, 0, p);
|
|
57
|
+
}
|
|
58
|
+
return a !== r && l && l(e, a, r), n;
|
|
59
|
+
});
|
|
60
|
+
}, B = (e) => JSON.parse(e);
|
|
61
|
+
return /* @__PURE__ */ d(S, { children: /* @__PURE__ */ d(A, { className: j, children: g.map((e) => /* @__PURE__ */ f(
|
|
62
|
+
F,
|
|
63
|
+
{
|
|
64
|
+
columnId: e.id,
|
|
65
|
+
onDropOverColumn: (i) => {
|
|
66
|
+
const r = B(i);
|
|
67
|
+
D(r.id, e.id);
|
|
68
|
+
},
|
|
69
|
+
className: "group/column",
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ f(I, { className: "relative", children: [
|
|
72
|
+
/* @__PURE__ */ f("div", { className: "flex items-center gap-2", children: [
|
|
73
|
+
/* @__PURE__ */ d(
|
|
74
|
+
"span",
|
|
75
|
+
{
|
|
76
|
+
className: "inline-flex items-center gap-1.5 rounded-md px-2 py-0.5 text-xs font-medium",
|
|
77
|
+
style: {
|
|
78
|
+
backgroundColor: `${x(e.label)}20`,
|
|
79
|
+
color: x(e.label)
|
|
80
|
+
},
|
|
81
|
+
children: e.label
|
|
82
|
+
}
|
|
83
|
+
),
|
|
84
|
+
/* @__PURE__ */ d("span", { className: "text-d-muted-foreground text-xs", children: C[e.id]?.length ?? 0 })
|
|
85
|
+
] }),
|
|
86
|
+
v && h && /* @__PURE__ */ d(
|
|
87
|
+
E,
|
|
88
|
+
{
|
|
89
|
+
variant: "ghost",
|
|
90
|
+
size: "icon",
|
|
91
|
+
className: "size-6 opacity-0 transition-opacity group-hover/column:opacity-100",
|
|
92
|
+
onClick: (i) => {
|
|
93
|
+
i.stopPropagation(), h(e.id);
|
|
94
|
+
},
|
|
95
|
+
children: /* @__PURE__ */ d(G, { className: "size-4" })
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
] }),
|
|
99
|
+
/* @__PURE__ */ d(J, { children: C[e.id]?.map((i) => /* @__PURE__ */ d(
|
|
100
|
+
W,
|
|
101
|
+
{
|
|
102
|
+
cardId: i.id,
|
|
103
|
+
onDropOverListItem: (r, o) => {
|
|
104
|
+
if (o === "none") return;
|
|
105
|
+
const t = B(r);
|
|
106
|
+
z(
|
|
107
|
+
t.id,
|
|
108
|
+
i.id,
|
|
109
|
+
e.id,
|
|
110
|
+
o
|
|
111
|
+
);
|
|
112
|
+
},
|
|
113
|
+
children: /* @__PURE__ */ d(
|
|
114
|
+
$,
|
|
115
|
+
{
|
|
116
|
+
data: i,
|
|
117
|
+
onEdit: b ? () => b(i, e.id) : void 0,
|
|
118
|
+
actions: O?.(i, e.id),
|
|
119
|
+
meta: i.meta,
|
|
120
|
+
backgroundColor: x(e.label),
|
|
121
|
+
children: u ? u(i, e.id) : /* @__PURE__ */ f(P, { children: [
|
|
122
|
+
/* @__PURE__ */ d(q, { children: i.title }),
|
|
123
|
+
i.description && /* @__PURE__ */ d(w, { children: i.description })
|
|
124
|
+
] })
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
},
|
|
128
|
+
i.id
|
|
129
|
+
)) })
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
e.id
|
|
133
|
+
)) }) });
|
|
134
|
+
}
|
|
135
|
+
export {
|
|
136
|
+
Z as AppKanban
|
|
137
|
+
};
|