laif-ds 0.2.48 → 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/components/kanban.js +87 -83
- package/dist/components/ui/app-kanban.js +131 -111
- package/dist/index.d.ts +4 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +1 -1
|
@@ -1,137 +1,157 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { KanbanBoardProvider as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
function
|
|
9
|
-
columns:
|
|
10
|
-
initialTasks:
|
|
11
|
-
onTaskMove:
|
|
12
|
-
onTaskEdit:
|
|
13
|
-
onTaskCreate:
|
|
14
|
-
taskActions:
|
|
15
|
-
renderTaskContent:
|
|
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
16
|
className: j,
|
|
17
|
-
allowTaskCreate: v = !0
|
|
17
|
+
allowTaskCreate: v = !0,
|
|
18
|
+
createTaskLabel: O = "Nuovo task"
|
|
18
19
|
}) {
|
|
19
|
-
const [
|
|
20
|
-
const
|
|
21
|
-
for (const
|
|
22
|
-
|
|
23
|
-
return
|
|
24
|
-
}, D = (
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
let
|
|
28
|
-
for (const
|
|
29
|
-
const c =
|
|
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);
|
|
30
31
|
if (c !== -1) {
|
|
31
|
-
|
|
32
|
+
i = s, [d] = t[s].splice(c, 1);
|
|
32
33
|
break;
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
return !
|
|
36
|
+
return !d || i === n ? e : (t[n] || (t[n] = []), t[n].push(d), i && p && p(r, i, n), t);
|
|
36
37
|
});
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
(
|
|
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)
|
|
41
42
|
);
|
|
42
|
-
if (!
|
|
43
|
-
const c =
|
|
44
|
-
(
|
|
43
|
+
if (!s) return d;
|
|
44
|
+
const c = i[s].findIndex(
|
|
45
|
+
(a) => a.id === r
|
|
45
46
|
);
|
|
46
|
-
if (c === -1) return
|
|
47
|
-
const [
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
(
|
|
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
|
|
51
52
|
);
|
|
52
|
-
if (
|
|
53
|
-
|
|
53
|
+
if (f === -1)
|
|
54
|
+
i[e].push(m);
|
|
54
55
|
else {
|
|
55
|
-
const
|
|
56
|
-
|
|
56
|
+
const a = t === "top" ? f : f + 1;
|
|
57
|
+
i[e].splice(a, 0, m);
|
|
57
58
|
}
|
|
58
|
-
return
|
|
59
|
+
return s !== e && p && p(r, s, e), i;
|
|
59
60
|
});
|
|
60
|
-
},
|
|
61
|
-
return /* @__PURE__ */
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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(
|
|
74
79
|
"span",
|
|
75
80
|
{
|
|
76
|
-
className: "inline-flex items-center gap-1
|
|
81
|
+
className: "inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-sm font-semibold tracking-tight",
|
|
77
82
|
style: {
|
|
78
|
-
backgroundColor: `${
|
|
79
|
-
color:
|
|
83
|
+
backgroundColor: `${n}18`,
|
|
84
|
+
color: n
|
|
80
85
|
},
|
|
81
|
-
children:
|
|
86
|
+
children: r.label
|
|
82
87
|
}
|
|
83
88
|
),
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
] }),
|
|
86
|
-
|
|
87
|
-
|
|
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,
|
|
88
93
|
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
+
);
|
|
94
104
|
},
|
|
95
|
-
children: /* @__PURE__ */
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
+
)
|
|
112
129
|
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
backgroundColor:
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
+
}) }) });
|
|
134
154
|
}
|
|
135
155
|
export {
|
|
136
|
-
|
|
156
|
+
_ as AppKanban
|
|
137
157
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -184,7 +184,7 @@ declare interface AppFormProps {
|
|
|
184
184
|
showSubmitButton?: boolean;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
export declare function AppKanban<T = any>({ columns, initialTasks, onTaskMove, onTaskEdit, onTaskCreate, taskActions, renderTaskContent, className, allowTaskCreate, }: AppKanbanConfig<T>): JSX.Element;
|
|
187
|
+
export declare function AppKanban<T = any>({ columns, initialTasks, onTaskMove, onTaskEdit, onTaskCreate, taskActions, renderTaskContent, className, allowTaskCreate, createTaskLabel, }: AppKanbanConfig<T>): JSX.Element;
|
|
188
188
|
|
|
189
189
|
export declare type AppKanbanColumn = {
|
|
190
190
|
id: string;
|
|
@@ -201,6 +201,7 @@ export declare type AppKanbanConfig<T = any> = {
|
|
|
201
201
|
renderTaskContent?: (task: AppKanbanTask<T>, columnId: string) => ReactNode;
|
|
202
202
|
className?: string;
|
|
203
203
|
allowTaskCreate?: boolean;
|
|
204
|
+
createTaskLabel?: string;
|
|
204
205
|
};
|
|
205
206
|
|
|
206
207
|
export declare type AppKanbanTask<T = any> = {
|
|
@@ -209,6 +210,8 @@ export declare type AppKanbanTask<T = any> = {
|
|
|
209
210
|
description?: string;
|
|
210
211
|
data?: T;
|
|
211
212
|
meta?: KanbanBoardCardMetaItem[];
|
|
213
|
+
icon?: IconName;
|
|
214
|
+
createTaskLabel?: string;
|
|
212
215
|
};
|
|
213
216
|
|
|
214
217
|
/**
|