tembro 4.0.1 → 4.2.0
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/CHANGELOG.md +15 -0
- package/dist/components/display/chat.cjs +1 -0
- package/dist/components/display/chat.d.ts +94 -0
- package/dist/components/display/chat.js +1 -0
- package/dist/components/display/index.d.ts +1 -0
- package/dist/components/display/kanban.d.ts +33 -1
- package/dist/components/inputs/combobox.cjs +1 -0
- package/dist/components/inputs/combobox.d.ts +46 -0
- package/dist/components/inputs/combobox.js +1 -0
- package/dist/components/inputs/index.d.ts +1 -0
- package/dist/components/inputs/public.d.ts +1 -0
- package/dist/components/layout/sidebar.d.ts +24 -2
- package/dist/components/modern/rich-text-editor.d.ts +13 -1
- package/dist/components/theme-provider.d.ts +19 -6
- package/dist/components/ui/badge/index.d.ts +8 -2
- package/dist/src/components/display/activity-feed.cjs +1 -1
- package/dist/src/components/display/activity-feed.js +4 -1
- package/dist/src/components/display/chat.cjs +1 -0
- package/dist/src/components/display/chat.js +372 -0
- package/dist/src/components/display/index.cjs +1 -1
- package/dist/src/components/display/index.js +17 -16
- package/dist/src/components/display/kanban.cjs +1 -1
- package/dist/src/components/display/kanban.js +321 -176
- package/dist/src/components/display/timeline.cjs +1 -1
- package/dist/src/components/display/timeline.js +5 -5
- package/dist/src/components/inputs/combobox.cjs +1 -0
- package/dist/src/components/inputs/combobox.js +162 -0
- package/dist/src/components/inputs/index.cjs +1 -1
- package/dist/src/components/inputs/index.js +10 -9
- package/dist/src/components/inputs/public.cjs +1 -1
- package/dist/src/components/inputs/public.js +10 -9
- package/dist/src/components/inputs/tag-input.cjs +1 -1
- package/dist/src/components/inputs/tag-input.js +6 -2
- package/dist/src/components/layout/index.cjs +1 -1
- package/dist/src/components/layout/index.js +4 -4
- package/dist/src/components/layout/public.cjs +1 -1
- package/dist/src/components/layout/public.js +4 -4
- package/dist/src/components/layout/sidebar.cjs +1 -1
- package/dist/src/components/layout/sidebar.js +326 -228
- package/dist/src/components/modern/rich-text-editor.cjs +1 -1
- package/dist/src/components/modern/rich-text-editor.js +216 -89
- package/dist/src/components/theme-provider.cjs +1 -1
- package/dist/src/components/theme-provider.js +58 -36
- package/dist/src/components/ui/badge/index.cjs +1 -1
- package/dist/src/components/ui/badge/index.js +59 -47
- package/dist/src/components/ui/input/clearable.cjs +1 -1
- package/dist/src/components/ui/input/clearable.js +5 -2
- package/dist/src/components/ui/input/primitive.cjs +1 -1
- package/dist/src/components/ui/input/primitive.js +1 -1
- package/dist/src/index.cjs +1 -1
- package/dist/src/index.js +88 -86
- package/dist/src/public-component-surface.cjs +1 -1
- package/dist/src/public-component-surface.js +107 -41
- package/package.json +1 -1
- package/packages/cli/dist/index.cjs +37 -37
- package/packages/cli/vendor/src/components/display/activity-feed.tsx +1 -1
- package/packages/cli/vendor/src/components/display/chat.tsx +237 -0
- package/packages/cli/vendor/src/components/display/index.ts +1 -0
- package/packages/cli/vendor/src/components/display/kanban.tsx +219 -72
- package/packages/cli/vendor/src/components/display/timeline.tsx +10 -10
- package/packages/cli/vendor/src/components/inputs/combobox.tsx +303 -0
- package/packages/cli/vendor/src/components/inputs/index.ts +1 -0
- package/packages/cli/vendor/src/components/inputs/public.ts +1 -0
- package/packages/cli/vendor/src/components/inputs/tag-input.tsx +3 -2
- package/packages/cli/vendor/src/components/layout/sidebar.tsx +212 -51
- package/packages/cli/vendor/src/components/modern/rich-text-editor.tsx +115 -32
- package/packages/cli/vendor/src/components/theme-provider.tsx +82 -36
- package/packages/cli/vendor/src/components/ui/badge/index.tsx +29 -8
- package/packages/cli/vendor/src/components/ui/input/clearable.tsx +2 -2
- package/packages/cli/vendor/src/components/ui/input/primitive.tsx +1 -1
- package/packages/cli/vendor/src/public-component-surface.ts +36 -22
- package/packages/cli/vendor/templates/showcase/src/showcase/layout/HeroSection.tsx +2 -2
- package/packages/cli/vendor/templates/showcase/src/showcase/layout/WorkbenchSidebar.tsx +1 -1
- package/packages/cli/vendor/templates/styles/globals.css +91 -10
- package/registry.json +28 -11
|
@@ -1,39 +1,42 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../../lib/utils.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
3
|
+
import { Button as t } from "../ui/button/index.js";
|
|
4
|
+
import { Badge as n } from "../ui/badge/index.js";
|
|
5
|
+
import { Card as r, CardContent as i, CardHeader as a, CardTitle as o } from "../ui/card/index.js";
|
|
6
|
+
import { Avatar as s } from "./avatar.js";
|
|
7
|
+
import { move as c } from "../../../node_modules/@dnd-kit/helpers/dist/index.js";
|
|
8
|
+
import { DragDropProvider as l, DragOverlay as u, useDroppable as d } from "../../../node_modules/@dnd-kit/react/index.js";
|
|
9
|
+
import { isSortable as f } from "../../../node_modules/@dnd-kit/dom/sortable.js";
|
|
10
|
+
import { useSortable as p } from "../../../node_modules/@dnd-kit/react/sortable.js";
|
|
11
|
+
import * as m from "react";
|
|
12
|
+
import { CalendarDaysIcon as h, CheckIcon as g, GripVerticalIcon as _, PlusIcon as v } from "lucide-react";
|
|
13
|
+
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
11
14
|
//#region src/components/display/kanban.tsx
|
|
12
|
-
var
|
|
13
|
-
function
|
|
14
|
-
return `${
|
|
15
|
+
var x = "tembro-kanban-card:", S = "tembro-kanban-column:";
|
|
16
|
+
function C(e) {
|
|
17
|
+
return `${x}${e}`;
|
|
15
18
|
}
|
|
16
|
-
function
|
|
17
|
-
return `${
|
|
19
|
+
function w(e) {
|
|
20
|
+
return `${S}${e}`;
|
|
18
21
|
}
|
|
19
|
-
function
|
|
20
|
-
return e.startsWith(
|
|
22
|
+
function T(e) {
|
|
23
|
+
return e.startsWith(x) ? e.slice(19) : e;
|
|
21
24
|
}
|
|
22
|
-
function
|
|
25
|
+
function E(e) {
|
|
23
26
|
let t = e === void 0 ? "" : String(e);
|
|
24
|
-
return t.startsWith(
|
|
27
|
+
return t.startsWith(S) ? t.slice(21) : t;
|
|
25
28
|
}
|
|
26
|
-
function
|
|
27
|
-
return new Map(e.flatMap((e) => e.cards.map((e) => [
|
|
29
|
+
function D(e) {
|
|
30
|
+
return new Map(e.flatMap((e) => e.cards.map((e) => [C(e.key), e])));
|
|
28
31
|
}
|
|
29
|
-
function
|
|
30
|
-
let n =
|
|
32
|
+
function O(e, t) {
|
|
33
|
+
let n = D(e), r = c(Object.fromEntries(e.map((e) => [w(e.key), e.cards.map((e) => C(e.key))])), t);
|
|
31
34
|
return e.map((e) => ({
|
|
32
35
|
...e,
|
|
33
|
-
cards: (r[
|
|
36
|
+
cards: (r[w(e.key)] ?? []).map((e) => n.get(String(e))).filter((e) => !!e)
|
|
34
37
|
}));
|
|
35
38
|
}
|
|
36
|
-
function
|
|
39
|
+
function ee(e, t, n) {
|
|
37
40
|
let r = e.find((e) => e.key === t.columnKey), i = e.find((e) => e.key === n.columnKey);
|
|
38
41
|
if (!r || !i) return null;
|
|
39
42
|
let a = r.cards.find((e) => e.key === t.cardKey);
|
|
@@ -64,49 +67,116 @@ function C(e, t, n) {
|
|
|
64
67
|
}
|
|
65
68
|
};
|
|
66
69
|
}
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
function k(e, t, n) {
|
|
71
|
+
let r = e.find((e) => e.cards.some((e) => e.key === n)), i = t.find((e) => e.cards.some((e) => e.key === n)), a = r?.cards.find((e) => e.key === n);
|
|
72
|
+
return !r || !i || !a ? null : {
|
|
73
|
+
card: a,
|
|
74
|
+
fromColumn: r,
|
|
75
|
+
toColumn: i,
|
|
76
|
+
fromIndex: r.cards.findIndex((e) => e.key === n),
|
|
77
|
+
toIndex: i.cards.findIndex((e) => e.key === n)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function A(e, t, n, r, i, a) {
|
|
81
|
+
let o = k(e, t, n);
|
|
82
|
+
if (!o) return !1;
|
|
83
|
+
let s = o.fromColumn.key !== o.toColumn.key;
|
|
84
|
+
return s && !r || !s && !i || s && o.toColumn.limit !== void 0 && o.toColumn.cards.length > o.toColumn.limit ? !1 : a?.(o) ?? !0;
|
|
85
|
+
}
|
|
86
|
+
var j = m.forwardRef(function({ label: e, disabled: t }, n) {
|
|
87
|
+
return /* @__PURE__ */ y("button", {
|
|
69
88
|
ref: n,
|
|
70
89
|
type: "button",
|
|
71
90
|
className: "inline-flex size-8 shrink-0 touch-none items-center justify-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-45",
|
|
72
91
|
"aria-label": e,
|
|
73
92
|
disabled: t,
|
|
74
93
|
onClick: (e) => e.stopPropagation(),
|
|
75
|
-
children: /* @__PURE__ */
|
|
94
|
+
children: /* @__PURE__ */ y(_, {
|
|
76
95
|
className: "size-4",
|
|
77
96
|
"aria-hidden": "true"
|
|
78
97
|
})
|
|
79
98
|
});
|
|
80
99
|
});
|
|
81
|
-
function
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
100
|
+
function M({ card: e, handle: t, selectControl: c }) {
|
|
101
|
+
let l = e.priority === "urgent" ? "danger" : e.priority === "high" ? "warning" : e.priority === "medium" ? "info" : "muted";
|
|
102
|
+
return /* @__PURE__ */ b(r, {
|
|
103
|
+
className: "border-border/80 shadow-sm transition-[border-color,box-shadow,transform] hover:-translate-y-0.5 hover:border-foreground/20 hover:shadow-md",
|
|
104
|
+
children: [/* @__PURE__ */ y(a, {
|
|
105
|
+
className: "p-3.5 pb-2",
|
|
106
|
+
children: /* @__PURE__ */ b("div", {
|
|
87
107
|
className: "flex items-start justify-between gap-2",
|
|
88
|
-
children: [/* @__PURE__ */
|
|
89
|
-
className: "
|
|
90
|
-
children:
|
|
91
|
-
|
|
108
|
+
children: [/* @__PURE__ */ b("div", {
|
|
109
|
+
className: "flex min-w-0 items-start gap-2",
|
|
110
|
+
children: [c, /* @__PURE__ */ y(o, {
|
|
111
|
+
className: "min-w-0 text-sm leading-5",
|
|
112
|
+
children: e.title
|
|
113
|
+
})]
|
|
114
|
+
}), /* @__PURE__ */ b("div", {
|
|
92
115
|
className: "flex items-center gap-1",
|
|
93
|
-
children: [e.extra,
|
|
116
|
+
children: [e.extra, t]
|
|
94
117
|
})]
|
|
95
118
|
})
|
|
96
|
-
}), e.description || e.meta ? /* @__PURE__ */
|
|
97
|
-
className: "grid gap-
|
|
98
|
-
children: [
|
|
119
|
+
}), e.description || e.meta || e.labels?.length || e.priority || e.assignee || e.dueDate || e.actions ? /* @__PURE__ */ b(i, {
|
|
120
|
+
className: "grid gap-3 p-3.5 pt-0 text-xs text-muted-foreground",
|
|
121
|
+
children: [
|
|
122
|
+
e.description ? /* @__PURE__ */ y("div", {
|
|
123
|
+
className: "line-clamp-3 leading-5",
|
|
124
|
+
children: e.description
|
|
125
|
+
}) : null,
|
|
126
|
+
e.labels?.length || e.priority ? /* @__PURE__ */ b("div", {
|
|
127
|
+
className: "flex flex-wrap gap-1.5",
|
|
128
|
+
children: [e.priority ? /* @__PURE__ */ y(n, {
|
|
129
|
+
size: "sm",
|
|
130
|
+
tone: l,
|
|
131
|
+
variant: "soft",
|
|
132
|
+
label: e.priority,
|
|
133
|
+
showDot: !0
|
|
134
|
+
}) : null, e.labels?.map((e, t) => m.isValidElement(e) ? m.cloneElement(e, { key: e.key ?? t }) : typeof e == "object" && e && "key" in e ? /* @__PURE__ */ y(n, {
|
|
135
|
+
size: "sm",
|
|
136
|
+
variant: "outline",
|
|
137
|
+
tone: e.tone,
|
|
138
|
+
label: e.label
|
|
139
|
+
}, e.key) : /* @__PURE__ */ y(n, {
|
|
140
|
+
size: "sm",
|
|
141
|
+
variant: "outline",
|
|
142
|
+
label: e
|
|
143
|
+
}, t))]
|
|
144
|
+
}) : null,
|
|
145
|
+
e.meta ? /* @__PURE__ */ y("div", { children: e.meta }) : null,
|
|
146
|
+
e.assignee || e.dueDate ? /* @__PURE__ */ b("div", {
|
|
147
|
+
className: "flex items-center justify-between gap-3 border-t pt-2.5",
|
|
148
|
+
children: [e.assignee ? /* @__PURE__ */ b("div", {
|
|
149
|
+
className: "flex min-w-0 items-center gap-2",
|
|
150
|
+
children: [/* @__PURE__ */ y(s, {
|
|
151
|
+
size: "xs",
|
|
152
|
+
name: e.assignee.name,
|
|
153
|
+
src: e.assignee.src,
|
|
154
|
+
fallback: e.assignee.fallback
|
|
155
|
+
}), /* @__PURE__ */ y("span", {
|
|
156
|
+
className: "truncate",
|
|
157
|
+
children: e.assignee.name
|
|
158
|
+
})]
|
|
159
|
+
}) : /* @__PURE__ */ y("span", {}), e.dueDate ? /* @__PURE__ */ b("span", {
|
|
160
|
+
className: "inline-flex shrink-0 items-center gap-1",
|
|
161
|
+
children: [/* @__PURE__ */ y(h, { className: "size-3.5" }), e.dueDate]
|
|
162
|
+
}) : null]
|
|
163
|
+
}) : null,
|
|
164
|
+
e.actions ? /* @__PURE__ */ y("div", {
|
|
165
|
+
className: "flex flex-wrap items-center gap-2",
|
|
166
|
+
children: e.actions
|
|
167
|
+
}) : null
|
|
168
|
+
]
|
|
99
169
|
}) : null]
|
|
100
170
|
});
|
|
101
171
|
}
|
|
102
|
-
function
|
|
103
|
-
let
|
|
104
|
-
id:
|
|
172
|
+
function N({ card: t, column: n, index: r, boardDisabled: i, renderCard: a, onCardClick: o, selected: s, selectionMode: c, onSelect: l, dragHandleLabel: u, cardClassName: d, onNativeDragStart: f, onNativeDragEnd: m, onNativeDrop: h }) {
|
|
173
|
+
let _ = i || n.disabled === !0 || t.disabled === !0, { ref: v, handleRef: b, isDragging: x, isDropTarget: S } = p({
|
|
174
|
+
id: C(t.key),
|
|
105
175
|
index: r,
|
|
106
|
-
group:
|
|
176
|
+
group: w(n.key),
|
|
107
177
|
type: "tembro-kanban-card",
|
|
108
178
|
accept: "tembro-kanban-card",
|
|
109
|
-
disabled:
|
|
179
|
+
disabled: _,
|
|
110
180
|
data: {
|
|
111
181
|
cardKey: t.key,
|
|
112
182
|
columnKey: n.key
|
|
@@ -116,203 +186,278 @@ function E({ card: t, column: n, index: r, boardDisabled: i, renderCard: a, onCa
|
|
|
116
186
|
easing: "cubic-bezier(0.2, 0, 0, 1)",
|
|
117
187
|
idle: !0
|
|
118
188
|
}
|
|
119
|
-
}),
|
|
120
|
-
ref:
|
|
121
|
-
label:
|
|
122
|
-
disabled:
|
|
123
|
-
}),
|
|
189
|
+
}), T = /* @__PURE__ */ y(j, {
|
|
190
|
+
ref: b,
|
|
191
|
+
label: u?.(t, n) ?? `Move ${String(t.title)}`,
|
|
192
|
+
disabled: _
|
|
193
|
+
}), E = c === "none" ? null : /* @__PURE__ */ y("button", {
|
|
194
|
+
type: "button",
|
|
195
|
+
"aria-label": `${s ? "Deselect" : "Select"} ${String(t.title)}`,
|
|
196
|
+
"aria-pressed": s,
|
|
197
|
+
className: e("mt-0.5 grid size-4 shrink-0 place-items-center rounded border bg-background text-primary outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring", s && "border-primary bg-primary text-primary-foreground"),
|
|
198
|
+
onClick: (e) => {
|
|
199
|
+
e.stopPropagation(), l(t);
|
|
200
|
+
},
|
|
201
|
+
children: s ? /* @__PURE__ */ y(g, {
|
|
202
|
+
className: "size-3",
|
|
203
|
+
strokeWidth: 3
|
|
204
|
+
}) : null
|
|
205
|
+
}), D = {
|
|
124
206
|
index: r,
|
|
125
|
-
isDragging:
|
|
126
|
-
isDropTarget:
|
|
127
|
-
|
|
207
|
+
isDragging: x,
|
|
208
|
+
isDropTarget: S,
|
|
209
|
+
selected: s,
|
|
210
|
+
selectControl: E,
|
|
211
|
+
handle: T
|
|
128
212
|
};
|
|
129
|
-
return /* @__PURE__ */
|
|
130
|
-
ref:
|
|
213
|
+
return /* @__PURE__ */ y("article", {
|
|
214
|
+
ref: v,
|
|
131
215
|
"data-slot": "kanban-card",
|
|
132
|
-
"data-dragging":
|
|
133
|
-
"data-drop-target":
|
|
134
|
-
"data-disabled":
|
|
135
|
-
role:
|
|
136
|
-
tabIndex: o && !m ? 0 : void 0,
|
|
216
|
+
"data-dragging": x || void 0,
|
|
217
|
+
"data-drop-target": S || void 0,
|
|
218
|
+
"data-disabled": _ || void 0,
|
|
219
|
+
role: "group",
|
|
137
220
|
"aria-label": typeof t.title == "string" ? t.title : void 0,
|
|
138
|
-
draggable: !
|
|
139
|
-
className: e("rounded-lg outline-none transition-[opacity,box-shadow]", o && !
|
|
221
|
+
draggable: !_,
|
|
222
|
+
className: e("rounded-lg outline-none transition-[opacity,box-shadow]", o && !_ && "cursor-pointer focus-visible:ring-2 focus-visible:ring-ring", S && "ring-2 ring-primary/30", x && "opacity-30", s && "ring-2 ring-primary/35", _ && "opacity-55", d),
|
|
140
223
|
onClick: () => {
|
|
141
|
-
|
|
224
|
+
_ || o?.(t, n);
|
|
142
225
|
},
|
|
143
226
|
onDragStart: (e) => {
|
|
144
|
-
if (
|
|
227
|
+
if (_) return;
|
|
145
228
|
let i = {
|
|
146
229
|
cardKey: t.key,
|
|
147
230
|
columnKey: n.key,
|
|
148
231
|
index: r
|
|
149
232
|
};
|
|
150
|
-
e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", JSON.stringify(i)),
|
|
233
|
+
e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", JSON.stringify(i)), f?.(i);
|
|
151
234
|
},
|
|
152
|
-
onDragEnd:
|
|
235
|
+
onDragEnd: m,
|
|
153
236
|
onDragOver: (e) => {
|
|
154
|
-
|
|
237
|
+
_ || e.preventDefault();
|
|
155
238
|
},
|
|
156
239
|
onDrop: (e) => {
|
|
157
|
-
|
|
240
|
+
_ || (e.preventDefault(), e.stopPropagation(), h?.({
|
|
158
241
|
columnKey: n.key,
|
|
159
242
|
index: r
|
|
160
243
|
}));
|
|
161
244
|
},
|
|
162
|
-
|
|
163
|
-
e.target !== e.currentTarget || m || !o || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), o(t, n));
|
|
164
|
-
},
|
|
165
|
-
children: a?.(t, n, S) ?? /* @__PURE__ */ p(T, {
|
|
245
|
+
children: a?.(t, n, D) ?? /* @__PURE__ */ y(M, {
|
|
166
246
|
card: t,
|
|
167
|
-
handle:
|
|
247
|
+
handle: T,
|
|
248
|
+
selectControl: E
|
|
168
249
|
})
|
|
169
250
|
});
|
|
170
251
|
}
|
|
171
|
-
function
|
|
172
|
-
let { ref:
|
|
173
|
-
id:
|
|
252
|
+
function te({ column: r, boardDisabled: i, renderCard: a, onCardClick: o, selectedKeys: s, selectionMode: c, onSelect: l, onAddCard: u, renderColumnHeader: f, renderColumnFooter: p, dragHandleLabel: m, emptyColumn: h, columnClassName: g, cardClassName: _, onNativeDragStart: x, onNativeDragEnd: S, onNativeDrop: C, density: T }) {
|
|
253
|
+
let { ref: E, isDropTarget: D } = d({
|
|
254
|
+
id: w(r.key),
|
|
174
255
|
type: "tembro-kanban-column",
|
|
175
256
|
accept: "tembro-kanban-card",
|
|
176
|
-
disabled:
|
|
257
|
+
disabled: i || r.disabled === !0,
|
|
177
258
|
collisionPriority: 1,
|
|
178
|
-
data: { columnKey:
|
|
259
|
+
data: { columnKey: r.key }
|
|
179
260
|
});
|
|
180
|
-
return /* @__PURE__ */
|
|
181
|
-
ref:
|
|
261
|
+
return /* @__PURE__ */ b("section", {
|
|
262
|
+
ref: E,
|
|
182
263
|
"data-slot": "kanban-column",
|
|
183
|
-
"data-drop-target":
|
|
184
|
-
"data-disabled":
|
|
185
|
-
"
|
|
186
|
-
|
|
264
|
+
"data-drop-target": D || void 0,
|
|
265
|
+
"data-disabled": r.disabled || void 0,
|
|
266
|
+
"data-density": T,
|
|
267
|
+
"aria-label": typeof r.title == "string" ? r.title : void 0,
|
|
268
|
+
className: e("grid min-h-40 content-start gap-3 rounded-lg border bg-muted/25 p-3 transition-[border-color,background-color,box-shadow] data-[density=compact]:gap-2 data-[density=compact]:p-2.5", D && "border-primary/60 bg-primary/5 ring-2 ring-primary/15", r.disabled && "opacity-60", g),
|
|
187
269
|
onDragOver: (e) => {
|
|
188
|
-
|
|
270
|
+
i || r.disabled === !0 || e.preventDefault();
|
|
189
271
|
},
|
|
190
272
|
onDrop: (e) => {
|
|
191
|
-
|
|
192
|
-
columnKey:
|
|
193
|
-
index:
|
|
273
|
+
i || r.disabled === !0 || (e.preventDefault(), C?.({
|
|
274
|
+
columnKey: r.key,
|
|
275
|
+
index: r.cards.length
|
|
194
276
|
}));
|
|
195
277
|
},
|
|
196
|
-
children: [
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
278
|
+
children: [
|
|
279
|
+
f?.(r) ?? /* @__PURE__ */ b("div", {
|
|
280
|
+
className: "flex items-start justify-between gap-3",
|
|
281
|
+
children: [
|
|
282
|
+
r.color ? /* @__PURE__ */ y("span", {
|
|
283
|
+
className: "mt-1.5 size-2 shrink-0 rounded-full",
|
|
284
|
+
style: { backgroundColor: r.color }
|
|
285
|
+
}) : null,
|
|
286
|
+
/* @__PURE__ */ b("div", {
|
|
287
|
+
className: "grid gap-0.5",
|
|
288
|
+
children: [/* @__PURE__ */ y("h3", {
|
|
289
|
+
className: "text-sm font-semibold text-foreground",
|
|
290
|
+
children: r.title
|
|
291
|
+
}), r.description ? /* @__PURE__ */ y("p", {
|
|
292
|
+
className: "text-xs text-muted-foreground",
|
|
293
|
+
children: r.description
|
|
294
|
+
}) : null]
|
|
295
|
+
}),
|
|
296
|
+
/* @__PURE__ */ b("div", {
|
|
297
|
+
className: "ml-auto flex items-center gap-1",
|
|
298
|
+
children: [
|
|
299
|
+
r.actions,
|
|
300
|
+
u && !r.disabled ? /* @__PURE__ */ y(t, {
|
|
301
|
+
size: "icon-xs",
|
|
302
|
+
variant: "ghost",
|
|
303
|
+
iconOnly: !0,
|
|
304
|
+
"aria-label": `Add card to ${String(r.title)}`,
|
|
305
|
+
onClick: () => u(r),
|
|
306
|
+
children: /* @__PURE__ */ y(v, {})
|
|
307
|
+
}) : null,
|
|
308
|
+
/* @__PURE__ */ y(n, {
|
|
309
|
+
size: "sm",
|
|
310
|
+
variant: r.limit !== void 0 && r.cards.length >= r.limit ? "soft" : "outline",
|
|
311
|
+
tone: r.limit !== void 0 && r.cards.length >= r.limit ? "warning" : "muted",
|
|
312
|
+
label: r.count ?? (r.limit === void 0 ? r.cards.length : `${r.cards.length}/${r.limit}`)
|
|
313
|
+
})
|
|
314
|
+
]
|
|
315
|
+
})
|
|
316
|
+
]
|
|
317
|
+
}),
|
|
318
|
+
/* @__PURE__ */ y("div", {
|
|
319
|
+
className: "grid min-h-16 content-start gap-2",
|
|
320
|
+
children: r.cards.length === 0 ? /* @__PURE__ */ b("div", {
|
|
321
|
+
className: "grid min-h-20 place-items-center rounded-lg border border-dashed p-3 text-center text-xs text-muted-foreground",
|
|
322
|
+
children: [/* @__PURE__ */ y("span", { children: h }), /* @__PURE__ */ y("span", {
|
|
323
|
+
className: "sr-only",
|
|
324
|
+
children: "No cards yet."
|
|
325
|
+
})]
|
|
326
|
+
}) : r.cards.map((e, t) => /* @__PURE__ */ y(N, {
|
|
327
|
+
card: e,
|
|
328
|
+
column: r,
|
|
329
|
+
index: t,
|
|
330
|
+
boardDisabled: i,
|
|
331
|
+
renderCard: a,
|
|
332
|
+
onCardClick: o,
|
|
333
|
+
selected: s.has(e.key) || e.selected === !0,
|
|
334
|
+
selectionMode: c,
|
|
335
|
+
onSelect: l,
|
|
336
|
+
dragHandleLabel: m,
|
|
337
|
+
cardClassName: _,
|
|
338
|
+
onNativeDragStart: x,
|
|
339
|
+
onNativeDragEnd: S,
|
|
340
|
+
onNativeDrop: C
|
|
341
|
+
}, e.key))
|
|
342
|
+
}),
|
|
343
|
+
p?.(r) ?? r.footer ?? (u && !r.disabled ? /* @__PURE__ */ y(t, {
|
|
344
|
+
size: "sm",
|
|
345
|
+
variant: "ghost",
|
|
346
|
+
className: "w-full justify-start",
|
|
347
|
+
leftIcon: /* @__PURE__ */ y(v, {}),
|
|
348
|
+
onClick: () => u(r),
|
|
349
|
+
children: "Add task"
|
|
350
|
+
}) : null)
|
|
351
|
+
]
|
|
233
352
|
});
|
|
234
353
|
}
|
|
235
|
-
function
|
|
236
|
-
let [
|
|
237
|
-
function
|
|
354
|
+
function P({ columns: t, defaultColumns: n = [], onColumnsChange: r, onCardMove: i, canMoveCard: a, renderCard: o, onCardClick: s, onAddCard: c, onAddColumn: d, renderColumnHeader: p, renderColumnFooter: h, selectionMode: g = "none", selectedCardKeys: _, defaultSelectedCardKeys: x = [], onSelectionChange: S, allowCrossColumn: w = !0, allowReorder: D = !0, density: k = "comfortable", columnWidth: j = 320, disabled: N = !1, emptyColumn: P = "Drop cards here.", dragHandleLabel: ne, columnClassName: re, cardClassName: F, overlayClassName: I, className: L, "aria-label": R = "Kanban board", ...z }) {
|
|
355
|
+
let [B, V] = m.useState(() => n), [H, U] = m.useState(null), [W, G] = m.useState(null), K = m.useRef(null), q = m.useRef(null), [ie, ae] = m.useState(x), J = t ?? B, Y = H ?? J, X = t !== void 0, Z = _ ?? ie, Q = m.useMemo(() => new Set(Z), [Z]);
|
|
356
|
+
function oe(e) {
|
|
357
|
+
if (g === "none" || e.disabled) return;
|
|
358
|
+
let t = g === "single" ? Q.has(e.key) ? [] : [e.key] : Q.has(e.key) ? Z.filter((t) => t !== e.key) : [...Z, e.key];
|
|
359
|
+
_ === void 0 && ae(t);
|
|
360
|
+
let n = J.flatMap((e) => e.cards);
|
|
361
|
+
S?.(t, n.filter((e) => t.includes(e.key)));
|
|
362
|
+
}
|
|
363
|
+
function se(e) {
|
|
238
364
|
let t = e.operation.source;
|
|
239
365
|
if (!t) return;
|
|
240
366
|
let n = String(t.id);
|
|
241
|
-
|
|
367
|
+
K.current = J, U(J), G(n);
|
|
242
368
|
}
|
|
243
|
-
function
|
|
369
|
+
function ce(e) {
|
|
244
370
|
let t = e.operation.source;
|
|
245
|
-
if (!t || !
|
|
246
|
-
let n =
|
|
247
|
-
|
|
371
|
+
if (!t || !f(t)) return;
|
|
372
|
+
let n = O(K.current ?? J, e);
|
|
373
|
+
A(J, n, T(String(t.id)), w, D, a) && (K.current = n, U(n));
|
|
248
374
|
}
|
|
249
|
-
function
|
|
375
|
+
function le(e) {
|
|
250
376
|
let t = e.operation.source;
|
|
251
|
-
if (
|
|
252
|
-
|
|
377
|
+
if (G(null), e.canceled || !t || !f(t)) {
|
|
378
|
+
K.current = null, U(null);
|
|
253
379
|
return;
|
|
254
380
|
}
|
|
255
|
-
let n =
|
|
256
|
-
if (
|
|
257
|
-
let
|
|
381
|
+
let n = K.current ?? O(J, e), o = T(String(t.id)), s = E(t.initialGroup), c = E(t.group), l = J.find((e) => e.key === s), u = n.find((e) => e.key === c), d = l?.cards.find((e) => e.key === o);
|
|
382
|
+
if (K.current = null, U(null), !d || !l || !u) return;
|
|
383
|
+
let p = {
|
|
258
384
|
card: d,
|
|
259
|
-
fromColumn:
|
|
385
|
+
fromColumn: l,
|
|
260
386
|
toColumn: u,
|
|
261
387
|
fromIndex: t.initialIndex,
|
|
262
388
|
toIndex: t.index
|
|
263
389
|
};
|
|
264
|
-
|
|
390
|
+
A(J, n, d.key, w, D, a) && (X || V(n), r?.(n, p), i?.(p));
|
|
265
391
|
}
|
|
266
|
-
function
|
|
267
|
-
let t =
|
|
268
|
-
if (
|
|
269
|
-
let n =
|
|
270
|
-
n && (
|
|
392
|
+
function ue(e) {
|
|
393
|
+
let t = q.current;
|
|
394
|
+
if (q.current = null, !t) return;
|
|
395
|
+
let n = ee(J, t, e);
|
|
396
|
+
n && A(J, n.columns, n.change.card.key, w, D, a) && (X || V(n.columns), r?.(n.columns, n.change), i?.(n.change));
|
|
271
397
|
}
|
|
272
|
-
let
|
|
398
|
+
let $ = W ? Y.flatMap((e) => e.cards.map((t) => ({
|
|
273
399
|
card: t,
|
|
274
400
|
column: e
|
|
275
|
-
}))).find(({ card: e }) =>
|
|
276
|
-
return /* @__PURE__ */
|
|
277
|
-
onDragStart:
|
|
278
|
-
onDragOver:
|
|
279
|
-
onDragEnd:
|
|
280
|
-
children: [/* @__PURE__ */
|
|
281
|
-
...
|
|
401
|
+
}))).find(({ card: e }) => C(e.key) === W) : void 0;
|
|
402
|
+
return /* @__PURE__ */ b(l, {
|
|
403
|
+
onDragStart: se,
|
|
404
|
+
onDragOver: ce,
|
|
405
|
+
onDragEnd: le,
|
|
406
|
+
children: [/* @__PURE__ */ b("div", {
|
|
407
|
+
...z,
|
|
282
408
|
role: "group",
|
|
283
|
-
"aria-label":
|
|
409
|
+
"aria-label": R,
|
|
284
410
|
"data-slot": "kanban-board",
|
|
285
|
-
|
|
286
|
-
|
|
411
|
+
"data-density": k,
|
|
412
|
+
style: {
|
|
413
|
+
"--kanban-column-width": typeof j == "number" ? `${j}px` : j,
|
|
414
|
+
...z.style
|
|
415
|
+
},
|
|
416
|
+
className: e("grid gap-4 sm:auto-cols-[var(--kanban-column-width)] sm:grid-flow-col sm:overflow-x-auto sm:pb-2", L),
|
|
417
|
+
children: [Y.map((e) => /* @__PURE__ */ y(te, {
|
|
287
418
|
column: e,
|
|
288
|
-
boardDisabled:
|
|
289
|
-
renderCard:
|
|
290
|
-
onCardClick:
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
419
|
+
boardDisabled: N,
|
|
420
|
+
renderCard: o,
|
|
421
|
+
onCardClick: s,
|
|
422
|
+
selectedKeys: Q,
|
|
423
|
+
selectionMode: g,
|
|
424
|
+
onSelect: oe,
|
|
425
|
+
onAddCard: c,
|
|
426
|
+
renderColumnHeader: p,
|
|
427
|
+
renderColumnFooter: h,
|
|
428
|
+
dragHandleLabel: ne,
|
|
429
|
+
emptyColumn: P,
|
|
430
|
+
columnClassName: re,
|
|
431
|
+
cardClassName: F,
|
|
295
432
|
onNativeDragStart: (e) => {
|
|
296
|
-
|
|
433
|
+
q.current = e;
|
|
297
434
|
},
|
|
298
435
|
onNativeDragEnd: () => {
|
|
299
|
-
|
|
436
|
+
q.current = null;
|
|
300
437
|
},
|
|
301
|
-
onNativeDrop:
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
438
|
+
onNativeDrop: ue,
|
|
439
|
+
density: k
|
|
440
|
+
}, e.key)), d ? /* @__PURE__ */ b("button", {
|
|
441
|
+
type: "button",
|
|
442
|
+
className: "flex min-h-32 items-center justify-center gap-2 rounded-lg border border-dashed bg-muted/15 text-sm font-medium text-muted-foreground outline-none transition-colors hover:border-foreground/25 hover:bg-muted/35 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",
|
|
443
|
+
onClick: d,
|
|
444
|
+
children: [/* @__PURE__ */ y(v, { className: "size-4" }), "Add column"]
|
|
445
|
+
}) : null]
|
|
446
|
+
}), /* @__PURE__ */ y(u, { children: $ ? /* @__PURE__ */ y("div", {
|
|
447
|
+
className: e("min-w-64 rotate-1 opacity-95 shadow-2xl", I),
|
|
448
|
+
children: o?.($.card, $.column, {
|
|
449
|
+
index: $.column.cards.findIndex((e) => e.key === $.card.key),
|
|
307
450
|
isDragging: !0,
|
|
308
451
|
isDropTarget: !1,
|
|
309
|
-
handle: null
|
|
310
|
-
|
|
311
|
-
|
|
452
|
+
handle: null,
|
|
453
|
+
selected: Q.has($.card.key),
|
|
454
|
+
selectControl: null
|
|
455
|
+
}) ?? /* @__PURE__ */ y(M, {
|
|
456
|
+
card: $.card,
|
|
312
457
|
handle: null
|
|
313
458
|
})
|
|
314
459
|
}) : null })]
|
|
315
460
|
});
|
|
316
461
|
}
|
|
317
462
|
//#endregion
|
|
318
|
-
export {
|
|
463
|
+
export { P as KanbanBoard };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("lucide-react"),i=require("react/jsx-runtime");var a={default:`border-primary bg-primary text-primary-foreground`,success:`border-emerald-500 bg-emerald-500 text-white`,info:`border-blue-500 bg-blue-500 text-white`,warning:`border-amber-500 bg-amber-500 text-white`,danger:`border-destructive bg-destructive text-destructive-foreground`,muted:`border-muted-foreground bg-muted-foreground text-background`};function o({items:e,orientation:n=`vertical`,pending:r=!1,pendingLabel:a=`Pending`,compact:o=!1,itemClassName:s,className:u,...d}){let f=e.filter(e=>!e.hidden);return n===`horizontal`?(0,i.jsx)(`div`,{"data-slot":`timeline`,"data-orientation":`horizontal`,className:t.cn(`overflow-x-auto`,u),...d,children:(0,i.jsxs)(`div`,{className:`flex min-w-max gap-3 pb-1`,children:[f.map(e=>(0,i.jsx)(l,{item:e,compact:o,className:s},e.key)),r&&(0,i.jsx)(l,{item:{key:`pending`,title:a,tone:`muted`},compact:o,className:s})]})}):(0,i.jsxs)(`div`,{"data-slot":`timeline`,"data-orientation":`vertical`,className:t.cn(`grid gap-0`,u),...d,children:[f.map((e,t)=>(0,i.jsx)(c,{item:e,compact:o,className:s,isLast:t===f.length-1&&!r},e.key)),r&&(0,i.jsx)(c,{item:{key:`pending`,title:a,tone:`muted`},compact:o,className:s,isLast:!0})]})}function s({item:e}){let n=e.tone??`default`;return(0,i.jsx)(`span`,{"data-slot":`timeline-dot`,"data-tone":n,className:t.cn(`
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("lucide-react"),i=require("react/jsx-runtime");var a={default:`border-primary bg-primary text-primary-foreground`,success:`border-emerald-500 bg-emerald-500 text-white`,info:`border-blue-500 bg-blue-500 text-white`,warning:`border-amber-500 bg-amber-500 text-white`,danger:`border-destructive bg-destructive text-destructive-foreground`,muted:`border-muted-foreground bg-muted-foreground text-background`};function o({items:e,orientation:n=`vertical`,pending:r=!1,pendingLabel:a=`Pending`,compact:o=!1,itemClassName:s,className:u,...d}){let f=e.filter(e=>!e.hidden);return n===`horizontal`?(0,i.jsx)(`div`,{"data-slot":`timeline`,"data-orientation":`horizontal`,className:t.cn(`overflow-x-auto`,u),...d,children:(0,i.jsxs)(`div`,{className:`flex min-w-max gap-3 pb-1`,children:[f.map(e=>(0,i.jsx)(l,{item:e,compact:o,className:s},e.key)),r&&(0,i.jsx)(l,{item:{key:`pending`,title:a,tone:`muted`},compact:o,className:s})]})}):(0,i.jsxs)(`div`,{"data-slot":`timeline`,"data-orientation":`vertical`,className:t.cn(`grid gap-0`,u),...d,children:[f.map((e,t)=>(0,i.jsx)(c,{item:e,compact:o,className:s,isLast:t===f.length-1&&!r},e.key)),r&&(0,i.jsx)(c,{item:{key:`pending`,title:a,tone:`muted`},compact:o,className:s,isLast:!0})]})}function s({item:e}){let n=e.tone??`default`;return(0,i.jsx)(`span`,{"data-slot":`timeline-dot`,"data-tone":n,className:t.cn(`relative z-10 grid size-7 shrink-0 place-items-center rounded-full border-2 border-background text-[10px] shadow-[0_0_0_1px_var(--border)]`,a[n]),children:e.icon??(0,i.jsx)(r.CircleIcon,{className:`size-2 fill-current`})})}function c({item:e,compact:n,className:r,isLast:a}){return(0,i.jsxs)(`div`,{"data-slot":`timeline-item`,className:t.cn(`relative grid grid-cols-[1.75rem_minmax(0,1fr)] gap-3`,r,e.className),children:[(0,i.jsxs)(`div`,{className:`relative flex justify-center`,children:[(0,i.jsx)(s,{item:e}),!a&&(0,i.jsx)(`div`,{"data-slot":`timeline-line`,className:`absolute left-1/2 top-7 h-[calc(100%_-_1.75rem)] w-px -translate-x-1/2 bg-border`})]}),(0,i.jsxs)(`div`,{className:t.cn(`min-w-0 pb-5 pt-0.5`,n&&`pb-3`),children:[(0,i.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 sm:flex-row sm:items-start sm:justify-between`,children:[(0,i.jsxs)(`div`,{className:`min-w-0`,children:[e.title&&(0,i.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:e.title}),e.description&&(0,i.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.description})]}),e.time&&(0,i.jsx)(`div`,{className:`shrink-0 text-xs text-muted-foreground`,children:e.time})]}),e.content&&(0,i.jsx)(`div`,{className:`mt-2 text-sm text-muted-foreground`,children:e.content}),e.actions&&(0,i.jsx)(`div`,{className:`mt-2`,children:e.actions})]})]})}function l({item:e,compact:n,className:r}){return(0,i.jsxs)(`div`,{"data-slot":`timeline-item`,className:t.cn(`min-w-48 rounded-xl border bg-card p-3`,n&&`min-w-40 p-2`,r,e.className),children:[(0,i.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,i.jsx)(s,{item:e}),e.time&&(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.time})]}),e.title&&(0,i.jsx)(`div`,{className:`text-sm font-medium`,children:e.title}),e.description&&(0,i.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:e.description}),e.content&&(0,i.jsx)(`div`,{className:`mt-2 text-sm text-muted-foreground`,children:e.content}),e.actions&&(0,i.jsx)(`div`,{className:`mt-2`,children:e.actions})]})}exports.Timeline=o;
|