laif-ds 0.2.48 → 0.2.50
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 +90 -85
- package/dist/components/ui/app-kanban.js +128 -114
- package/dist/components/ui/app-radio-group.js +62 -48
- package/dist/components/ui/app-select.js +93 -90
- package/dist/components/ui/async-select.js +134 -126
- package/dist/components/ui/badge.js +38 -31
- package/dist/components/ui/button.js +49 -40
- package/dist/components/ui/card.js +36 -28
- package/dist/components/ui/checkbox.js +23 -20
- package/dist/components/ui/date-picker.js +64 -59
- package/dist/components/ui/dialog.js +54 -42
- package/dist/components/ui/input.js +116 -111
- package/dist/components/ui/popover.js +15 -13
- package/dist/components/ui/radio-group.js +29 -27
- package/dist/components/ui/select.js +74 -67
- package/dist/components/ui/sheet.js +39 -28
- package/dist/components/ui/slider.js +34 -28
- package/dist/components/ui/switch.js +16 -13
- package/dist/components/ui/tabs.js +35 -26
- package/dist/components/ui/textarea.js +26 -17
- package/dist/index.d.ts +4 -1
- package/dist/lib/design-tokens.js +43 -0
- package/dist/styles.v3.css +1 -1
- package/package.json +1 -1
|
@@ -1,137 +1,151 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { KanbanBoardProvider as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
import { jsx as i, jsxs as l, Fragment as z } from "react/jsx-runtime";
|
|
3
|
+
import { useState as L } from "react";
|
|
4
|
+
import { KanbanBoardProvider as H, KanbanBoard as I, KanbanBoardColumn as P, KanbanBoardColumnHeader as S, KanbanBoardColumnList as A, KanbanBoardColumnListItem as F, KanbanBoardCard as J, KanbanBoardCardTitle as R, KanbanBoardCardDescription as W } from "../kanban.js";
|
|
5
|
+
import { stringToHexColor as q, hexToRgba as E } from "../../lib/utils.js";
|
|
6
|
+
import { Button as G } from "./button.js";
|
|
7
|
+
import { Icon as Q } from "./icon.js";
|
|
8
|
+
import U from "../../node_modules/lucide-react/dist/esm/icons/plus.js";
|
|
9
|
+
function M({
|
|
10
|
+
columns: v,
|
|
11
|
+
initialTasks: K,
|
|
12
|
+
onTaskMove: m,
|
|
13
|
+
onTaskEdit: x,
|
|
14
|
+
onTaskCreate: u,
|
|
15
|
+
taskActions: B,
|
|
16
|
+
renderTaskContent: b,
|
|
17
|
+
className: y,
|
|
18
|
+
allowTaskCreate: j = !0
|
|
18
19
|
}) {
|
|
19
|
-
const [
|
|
20
|
-
const
|
|
21
|
-
for (const
|
|
22
|
-
|
|
23
|
-
return
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
const o =
|
|
20
|
+
const [h, N] = L(K), g = (r) => {
|
|
21
|
+
const d = {};
|
|
22
|
+
for (const e of Object.keys(r))
|
|
23
|
+
d[e] = [...r[e]];
|
|
24
|
+
return d;
|
|
25
|
+
}, w = (r, d) => {
|
|
26
|
+
N((e) => {
|
|
27
|
+
const o = g(e);
|
|
27
28
|
let t, n;
|
|
28
|
-
for (const
|
|
29
|
-
const c = o[
|
|
29
|
+
for (const s of Object.keys(o)) {
|
|
30
|
+
const c = o[s].findIndex((p) => p.id === r);
|
|
30
31
|
if (c !== -1) {
|
|
31
|
-
n =
|
|
32
|
+
n = s, [t] = o[s].splice(c, 1);
|
|
32
33
|
break;
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
return !t || n ===
|
|
36
|
+
return !t || n === d ? e : (o[d] || (o[d] = []), o[d].push(t), n && m && m(r, n, d), o);
|
|
36
37
|
});
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
const n =
|
|
40
|
-
(
|
|
38
|
+
}, O = (r, d, e, o) => {
|
|
39
|
+
N((t) => {
|
|
40
|
+
const n = g(t), s = Object.keys(n).find(
|
|
41
|
+
(a) => n[a].some((D) => D.id === r)
|
|
41
42
|
);
|
|
42
|
-
if (!
|
|
43
|
-
const c = n[
|
|
44
|
-
(
|
|
43
|
+
if (!s) return t;
|
|
44
|
+
const c = n[s].findIndex(
|
|
45
|
+
(a) => a.id === r
|
|
45
46
|
);
|
|
46
47
|
if (c === -1) return t;
|
|
47
|
-
const [p] = n[
|
|
48
|
-
n[
|
|
49
|
-
const
|
|
50
|
-
(
|
|
48
|
+
const [p] = n[s].splice(c, 1);
|
|
49
|
+
n[e] || (n[e] = []);
|
|
50
|
+
const f = n[e].findIndex(
|
|
51
|
+
(a) => a.id === d
|
|
51
52
|
);
|
|
52
|
-
if (
|
|
53
|
-
n[
|
|
53
|
+
if (f === -1)
|
|
54
|
+
n[e].push(p);
|
|
54
55
|
else {
|
|
55
|
-
const
|
|
56
|
-
n[
|
|
56
|
+
const a = o === "top" ? f : f + 1;
|
|
57
|
+
n[e].splice(a, 0, p);
|
|
57
58
|
}
|
|
58
|
-
return
|
|
59
|
+
return s !== e && m && m(r, s, e), n;
|
|
59
60
|
});
|
|
60
|
-
},
|
|
61
|
-
return /* @__PURE__ */
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
61
|
+
}, C = (r) => JSON.parse(r);
|
|
62
|
+
return /* @__PURE__ */ i(H, { children: /* @__PURE__ */ i(I, { className: y, children: v.map((r) => {
|
|
63
|
+
const d = q(r.label);
|
|
64
|
+
return /* @__PURE__ */ l(
|
|
65
|
+
P,
|
|
66
|
+
{
|
|
67
|
+
columnId: r.id,
|
|
68
|
+
onDropOverColumn: (e) => {
|
|
69
|
+
const o = C(e);
|
|
70
|
+
w(o.id, r.id);
|
|
71
|
+
},
|
|
72
|
+
className: "group/column rounded-xl backdrop-blur-sm transition-colors",
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ i(S, { className: "relative mb-1.5 px-1.5 pt-1.5", children: /* @__PURE__ */ l("div", { className: "flex w-full items-center justify-between", children: [
|
|
75
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
76
|
+
/* @__PURE__ */ i(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
className: "flex items-center gap-1.5 rounded-md px-2 py-0.5 text-xs font-semibold",
|
|
80
|
+
style: {
|
|
81
|
+
backgroundColor: E(d, 0.15),
|
|
82
|
+
color: d
|
|
83
|
+
},
|
|
84
|
+
children: /* @__PURE__ */ i("span", { className: "max-w-[150px] truncate", children: r.label })
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ i("span", { className: "text-d-muted-foreground text-xs", children: h[r.id]?.length ?? 0 })
|
|
88
|
+
] }),
|
|
89
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-1", children: j && u && /* @__PURE__ */ i(
|
|
90
|
+
G,
|
|
75
91
|
{
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
children: e.label
|
|
92
|
+
variant: "ghost",
|
|
93
|
+
size: "icon",
|
|
94
|
+
className: "text-d-muted-foreground hover:text-d-foreground h-6 w-6",
|
|
95
|
+
onClick: () => u(r.id),
|
|
96
|
+
children: /* @__PURE__ */ i(U, { className: "size-3.5" })
|
|
82
97
|
}
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
]
|
|
86
|
-
|
|
87
|
-
E,
|
|
98
|
+
) })
|
|
99
|
+
] }) }),
|
|
100
|
+
/* @__PURE__ */ i(A, { className: "px-1 pb-2", children: h[r.id]?.map((e) => /* @__PURE__ */ i(
|
|
101
|
+
F,
|
|
88
102
|
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
103
|
+
cardId: e.id,
|
|
104
|
+
className: "mb-1.5 border-0 last:mb-0",
|
|
105
|
+
onDropOverListItem: (o, t) => {
|
|
106
|
+
if (t === "none") return;
|
|
107
|
+
const n = C(o);
|
|
108
|
+
O(
|
|
109
|
+
n.id,
|
|
110
|
+
e.id,
|
|
111
|
+
r.id,
|
|
112
|
+
t
|
|
113
|
+
);
|
|
94
114
|
},
|
|
95
|
-
children: /* @__PURE__ */
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
115
|
+
children: /* @__PURE__ */ i(
|
|
116
|
+
J,
|
|
117
|
+
{
|
|
118
|
+
data: e,
|
|
119
|
+
className: "group/card hover:border-d-border/40 relative rounded-md border border-transparent shadow-sm transition-all duration-200 hover:shadow-md",
|
|
120
|
+
backgroundColor: d,
|
|
121
|
+
onEdit: x ? () => x(e, r.id) : void 0,
|
|
122
|
+
actions: B?.(e, r.id),
|
|
123
|
+
meta: e.meta,
|
|
124
|
+
children: b ? b(e, r.id) : /* @__PURE__ */ l(z, { children: [
|
|
125
|
+
/* @__PURE__ */ l("div", { className: "mb-1 flex items-start gap-2", children: [
|
|
126
|
+
e.icon && /* @__PURE__ */ i(
|
|
127
|
+
Q,
|
|
128
|
+
{
|
|
129
|
+
name: e.icon,
|
|
130
|
+
size: "sm",
|
|
131
|
+
className: "text-d-muted-foreground mt-0.5 shrink-0"
|
|
132
|
+
}
|
|
133
|
+
),
|
|
134
|
+
/* @__PURE__ */ i(R, { className: "flex-1 text-sm leading-snug font-medium", children: e.title })
|
|
135
|
+
] }),
|
|
136
|
+
e.description && /* @__PURE__ */ i(W, { className: "text-d-muted-foreground mt-1.5 line-clamp-2 text-xs", children: e.description })
|
|
137
|
+
] })
|
|
138
|
+
}
|
|
139
|
+
)
|
|
112
140
|
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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
|
-
)) }) });
|
|
141
|
+
e.id
|
|
142
|
+
)) })
|
|
143
|
+
]
|
|
144
|
+
},
|
|
145
|
+
r.id
|
|
146
|
+
);
|
|
147
|
+
}) }) });
|
|
134
148
|
}
|
|
135
149
|
export {
|
|
136
|
-
|
|
150
|
+
M as AppKanban
|
|
137
151
|
};
|
|
@@ -1,50 +1,64 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as r, jsx as t, Fragment as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
import { jsxs as r, jsx as t, Fragment as O } from "react/jsx-runtime";
|
|
3
|
+
import { designTokens as h } from "../../lib/design-tokens.js";
|
|
4
|
+
import { cn as o } from "../../lib/utils.js";
|
|
5
|
+
import { Icon as j } from "./icon.js";
|
|
6
|
+
import { Label as C } from "./label.js";
|
|
7
|
+
import { RadioGroup as F, RadioGroupItem as I } from "./radio-group.js";
|
|
8
|
+
const d = ({ content: e }) => typeof e == "string" ? /* @__PURE__ */ t("span", { children: e }) : e, P = ({ option: e }) => /* @__PURE__ */ r(O, { children: [
|
|
9
|
+
/* @__PURE__ */ r(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
className: o(
|
|
13
|
+
"text-d-foreground flex flex-row items-center gap-1.5",
|
|
14
|
+
h.text.base
|
|
15
|
+
),
|
|
16
|
+
children: [
|
|
17
|
+
e.icon && /* @__PURE__ */ t(j, { size: "xs", className: "min-h-4 min-w-4", name: e.icon }),
|
|
18
|
+
/* @__PURE__ */ t(d, { content: e.label })
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
),
|
|
22
|
+
e.description && /* @__PURE__ */ t("div", { className: "text-d-foreground text-xs font-light", children: /* @__PURE__ */ t(d, { content: e.description }) })
|
|
23
|
+
] }), T = ({
|
|
14
24
|
option: e,
|
|
15
25
|
optionId: c,
|
|
16
|
-
isDisabled:
|
|
26
|
+
isDisabled: s,
|
|
17
27
|
isCard: n,
|
|
18
28
|
optionClassName: l
|
|
19
29
|
}) => /* @__PURE__ */ r(
|
|
20
|
-
|
|
30
|
+
C,
|
|
21
31
|
{
|
|
22
32
|
htmlFor: c,
|
|
23
|
-
className:
|
|
33
|
+
className: o(
|
|
24
34
|
"flex items-center gap-2",
|
|
25
|
-
|
|
26
|
-
n &&
|
|
35
|
+
s ? "cursor-not-allowed opacity-50" : "cursor-pointer",
|
|
36
|
+
n && o(
|
|
37
|
+
"bg-d-card border-d-border border p-2 shadow",
|
|
38
|
+
h.radius.lg
|
|
39
|
+
// Card layout uses lg radius
|
|
40
|
+
),
|
|
27
41
|
l
|
|
28
42
|
),
|
|
29
43
|
children: [
|
|
30
|
-
/* @__PURE__ */ t(
|
|
44
|
+
/* @__PURE__ */ t(I, { value: e.value, id: c, disabled: s }),
|
|
31
45
|
/* @__PURE__ */ t(
|
|
32
46
|
"div",
|
|
33
47
|
{
|
|
34
|
-
className:
|
|
48
|
+
className: o(
|
|
35
49
|
"flex flex-1 flex-col items-start gap-1",
|
|
36
|
-
|
|
50
|
+
s ? "cursor-not-allowed" : "cursor-pointer"
|
|
37
51
|
),
|
|
38
|
-
children: /* @__PURE__ */ t(
|
|
52
|
+
children: /* @__PURE__ */ t(P, { option: e })
|
|
39
53
|
}
|
|
40
54
|
)
|
|
41
55
|
]
|
|
42
56
|
}
|
|
43
57
|
);
|
|
44
|
-
function
|
|
58
|
+
function E({
|
|
45
59
|
options: e,
|
|
46
60
|
value: c,
|
|
47
|
-
defaultValue:
|
|
61
|
+
defaultValue: s,
|
|
48
62
|
onValueChange: n,
|
|
49
63
|
label: l,
|
|
50
64
|
description: i,
|
|
@@ -52,55 +66,55 @@ function k({
|
|
|
52
66
|
required: f = !1,
|
|
53
67
|
name: u,
|
|
54
68
|
orientation: p = "vertical",
|
|
55
|
-
loop:
|
|
56
|
-
className:
|
|
57
|
-
wrpClassName:
|
|
58
|
-
optionClassName:
|
|
59
|
-
layout:
|
|
69
|
+
loop: g = !0,
|
|
70
|
+
className: v = "",
|
|
71
|
+
wrpClassName: N = "",
|
|
72
|
+
optionClassName: w = "",
|
|
73
|
+
layout: b = "default",
|
|
60
74
|
error: m
|
|
61
75
|
}) {
|
|
62
|
-
const
|
|
63
|
-
return /* @__PURE__ */ r("div", { className:
|
|
76
|
+
const y = p === "horizontal", R = b === "card";
|
|
77
|
+
return /* @__PURE__ */ r("div", { className: o("flex w-full flex-col gap-2", N), children: [
|
|
64
78
|
(l || i) && /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
|
|
65
79
|
l && /* @__PURE__ */ r(
|
|
66
80
|
"div",
|
|
67
81
|
{
|
|
68
|
-
className:
|
|
82
|
+
className: o(
|
|
69
83
|
"flex items-center gap-1 text-sm font-medium",
|
|
70
84
|
m ? "text-d-destructive" : "text-d-foreground"
|
|
71
85
|
),
|
|
72
86
|
children: [
|
|
73
|
-
/* @__PURE__ */ t(
|
|
87
|
+
/* @__PURE__ */ t(d, { content: l }),
|
|
74
88
|
f && /* @__PURE__ */ t("span", { children: "*" })
|
|
75
89
|
]
|
|
76
90
|
}
|
|
77
91
|
),
|
|
78
|
-
i && /* @__PURE__ */ t("div", { className: "text-bodySecondary text-xs", children: /* @__PURE__ */ t(
|
|
92
|
+
i && /* @__PURE__ */ t("div", { className: "text-bodySecondary text-xs", children: /* @__PURE__ */ t(d, { content: i }) })
|
|
79
93
|
] }),
|
|
80
94
|
/* @__PURE__ */ t(
|
|
81
|
-
|
|
95
|
+
F,
|
|
82
96
|
{
|
|
83
97
|
value: c,
|
|
84
|
-
defaultValue:
|
|
98
|
+
defaultValue: s,
|
|
85
99
|
onValueChange: n,
|
|
86
100
|
disabled: x,
|
|
87
101
|
required: f,
|
|
88
102
|
name: u,
|
|
89
103
|
orientation: p,
|
|
90
|
-
loop:
|
|
91
|
-
className:
|
|
104
|
+
loop: g,
|
|
105
|
+
className: o(
|
|
92
106
|
"flex gap-2",
|
|
93
|
-
|
|
94
|
-
|
|
107
|
+
y ? "flex-row" : "flex-col",
|
|
108
|
+
v
|
|
95
109
|
),
|
|
96
|
-
children: e.map((
|
|
97
|
-
const
|
|
98
|
-
return /* @__PURE__ */ t(
|
|
99
|
-
option:
|
|
100
|
-
optionId:
|
|
101
|
-
isDisabled:
|
|
102
|
-
optionClassName:
|
|
103
|
-
} },
|
|
110
|
+
children: e.map((a) => {
|
|
111
|
+
const z = `${u || "radio"}-${a.value}`, G = x || !!a.disabled;
|
|
112
|
+
return /* @__PURE__ */ t(T, { isCard: R, ...{
|
|
113
|
+
option: a,
|
|
114
|
+
optionId: z,
|
|
115
|
+
isDisabled: G,
|
|
116
|
+
optionClassName: w
|
|
117
|
+
} }, a.value);
|
|
104
118
|
})
|
|
105
119
|
}
|
|
106
120
|
),
|
|
@@ -111,5 +125,5 @@ function k({
|
|
|
111
125
|
] });
|
|
112
126
|
}
|
|
113
127
|
export {
|
|
114
|
-
|
|
128
|
+
E as AppRadioGroup
|
|
115
129
|
};
|