tembro 4.0.0 → 4.1.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.
Files changed (68) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/components/charts/charts.d.ts +16 -5
  3. package/dist/components/display/chat.cjs +1 -0
  4. package/dist/components/display/chat.d.ts +94 -0
  5. package/dist/components/display/chat.js +1 -0
  6. package/dist/components/display/index.d.ts +1 -0
  7. package/dist/components/display/kanban.d.ts +33 -1
  8. package/dist/components/layout/sidebar.d.ts +24 -2
  9. package/dist/components/modern/rich-text-editor.d.ts +13 -1
  10. package/dist/components/theme-provider.d.ts +19 -6
  11. package/dist/components/ui/badge/index.d.ts +8 -2
  12. package/dist/src/components/charts/charts.cjs +1 -1
  13. package/dist/src/components/charts/charts.js +343 -252
  14. package/dist/src/components/display/activity-feed.cjs +1 -1
  15. package/dist/src/components/display/activity-feed.js +4 -1
  16. package/dist/src/components/display/chat.cjs +1 -0
  17. package/dist/src/components/display/chat.js +372 -0
  18. package/dist/src/components/display/index.cjs +1 -1
  19. package/dist/src/components/display/index.js +17 -16
  20. package/dist/src/components/display/kanban.cjs +1 -1
  21. package/dist/src/components/display/kanban.js +321 -176
  22. package/dist/src/components/display/timeline.cjs +1 -1
  23. package/dist/src/components/display/timeline.js +5 -5
  24. package/dist/src/components/inputs/tag-input.cjs +1 -1
  25. package/dist/src/components/inputs/tag-input.js +6 -2
  26. package/dist/src/components/layout/index.cjs +1 -1
  27. package/dist/src/components/layout/index.js +4 -4
  28. package/dist/src/components/layout/public.cjs +1 -1
  29. package/dist/src/components/layout/public.js +4 -4
  30. package/dist/src/components/layout/sidebar.cjs +1 -1
  31. package/dist/src/components/layout/sidebar.js +326 -228
  32. package/dist/src/components/layout/workspace-layout.cjs +1 -1
  33. package/dist/src/components/layout/workspace-layout.js +3 -3
  34. package/dist/src/components/modern/rich-text-editor.cjs +1 -1
  35. package/dist/src/components/modern/rich-text-editor.js +216 -89
  36. package/dist/src/components/theme-provider.cjs +1 -1
  37. package/dist/src/components/theme-provider.js +58 -36
  38. package/dist/src/components/ui/badge/index.cjs +1 -1
  39. package/dist/src/components/ui/badge/index.js +59 -47
  40. package/dist/src/components/ui/input/clearable.cjs +1 -1
  41. package/dist/src/components/ui/input/clearable.js +5 -2
  42. package/dist/src/components/ui/input/primitive.cjs +1 -1
  43. package/dist/src/components/ui/input/primitive.js +1 -1
  44. package/dist/src/index.cjs +1 -1
  45. package/dist/src/index.js +87 -86
  46. package/dist/src/public-component-surface.cjs +1 -1
  47. package/dist/src/public-component-surface.js +5 -0
  48. package/package.json +1 -1
  49. package/packages/cli/dist/index.cjs +3 -3
  50. package/packages/cli/vendor/src/components/charts/charts.tsx +55 -15
  51. package/packages/cli/vendor/src/components/display/activity-feed.tsx +1 -1
  52. package/packages/cli/vendor/src/components/display/chat.tsx +237 -0
  53. package/packages/cli/vendor/src/components/display/index.ts +1 -0
  54. package/packages/cli/vendor/src/components/display/kanban.tsx +219 -72
  55. package/packages/cli/vendor/src/components/display/timeline.tsx +10 -10
  56. package/packages/cli/vendor/src/components/inputs/tag-input.tsx +3 -2
  57. package/packages/cli/vendor/src/components/layout/sidebar.tsx +212 -51
  58. package/packages/cli/vendor/src/components/layout/workspace-layout.tsx +3 -3
  59. package/packages/cli/vendor/src/components/modern/rich-text-editor.tsx +115 -32
  60. package/packages/cli/vendor/src/components/theme-provider.tsx +82 -36
  61. package/packages/cli/vendor/src/components/ui/badge/index.tsx +29 -8
  62. package/packages/cli/vendor/src/components/ui/input/clearable.tsx +2 -2
  63. package/packages/cli/vendor/src/components/ui/input/primitive.tsx +1 -1
  64. package/packages/cli/vendor/src/public-component-surface.ts +1 -0
  65. package/packages/cli/vendor/templates/showcase/src/showcase/layout/HeroSection.tsx +2 -2
  66. package/packages/cli/vendor/templates/showcase/src/showcase/layout/WorkbenchSidebar.tsx +1 -1
  67. package/packages/cli/vendor/templates/styles/globals.css +136 -33
  68. package/registry.json +3 -1
@@ -1,39 +1,42 @@
1
1
  "use client";
2
2
  import { cn as e } from "../../lib/utils.js";
3
- import { Card as t, CardContent as n, CardHeader as r, CardTitle as i } from "../ui/card/index.js";
4
- import { move as a } from "../../../node_modules/@dnd-kit/helpers/dist/index.js";
5
- import { DragDropProvider as o, DragOverlay as s, useDroppable as c } from "../../../node_modules/@dnd-kit/react/index.js";
6
- import { isSortable as l } from "../../../node_modules/@dnd-kit/dom/sortable.js";
7
- import { useSortable as u } from "../../../node_modules/@dnd-kit/react/sortable.js";
8
- import * as d from "react";
9
- import { GripVerticalIcon as f } from "lucide-react";
10
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
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 h = "tembro-kanban-card:", g = "tembro-kanban-column:";
13
- function _(e) {
14
- return `${h}${e}`;
15
+ var x = "tembro-kanban-card:", S = "tembro-kanban-column:";
16
+ function C(e) {
17
+ return `${x}${e}`;
15
18
  }
16
- function v(e) {
17
- return `${g}${e}`;
19
+ function w(e) {
20
+ return `${S}${e}`;
18
21
  }
19
- function y(e) {
20
- return e.startsWith(h) ? e.slice(19) : e;
22
+ function T(e) {
23
+ return e.startsWith(x) ? e.slice(19) : e;
21
24
  }
22
- function b(e) {
25
+ function E(e) {
23
26
  let t = e === void 0 ? "" : String(e);
24
- return t.startsWith(g) ? t.slice(21) : t;
27
+ return t.startsWith(S) ? t.slice(21) : t;
25
28
  }
26
- function x(e) {
27
- return new Map(e.flatMap((e) => e.cards.map((e) => [_(e.key), e])));
29
+ function D(e) {
30
+ return new Map(e.flatMap((e) => e.cards.map((e) => [C(e.key), e])));
28
31
  }
29
- function S(e, t) {
30
- let n = x(e), r = a(Object.fromEntries(e.map((e) => [v(e.key), e.cards.map((e) => _(e.key))])), t);
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[v(e.key)] ?? []).map((e) => n.get(String(e))).filter((e) => !!e)
36
+ cards: (r[w(e.key)] ?? []).map((e) => n.get(String(e))).filter((e) => !!e)
34
37
  }));
35
38
  }
36
- function C(e, t, n) {
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
- var w = d.forwardRef(function({ label: e, disabled: t }, n) {
68
- return /* @__PURE__ */ p("button", {
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__ */ p(f, {
94
+ children: /* @__PURE__ */ y(_, {
76
95
  className: "size-4",
77
96
  "aria-hidden": "true"
78
97
  })
79
98
  });
80
99
  });
81
- function T({ card: e, handle: a }) {
82
- return /* @__PURE__ */ m(t, {
83
- className: "transition-colors hover:bg-muted/40",
84
- children: [/* @__PURE__ */ p(r, {
85
- className: "p-3 pb-1",
86
- children: /* @__PURE__ */ m("div", {
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__ */ p(i, {
89
- className: "text-sm",
90
- children: e.title
91
- }), /* @__PURE__ */ m("div", {
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, a]
116
+ children: [e.extra, t]
94
117
  })]
95
118
  })
96
- }), e.description || e.meta ? /* @__PURE__ */ m(n, {
97
- className: "grid gap-2 p-3 pt-0 text-xs text-muted-foreground",
98
- children: [e.description, e.meta ? /* @__PURE__ */ p("div", { children: e.meta }) : null]
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 E({ card: t, column: n, index: r, boardDisabled: i, renderCard: a, onCardClick: o, dragHandleLabel: s, cardClassName: c, onNativeDragStart: l, onNativeDragEnd: d, onNativeDrop: f }) {
103
- let m = i || n.disabled === !0 || t.disabled === !0, { ref: h, handleRef: g, isDragging: y, isDropTarget: b } = u({
104
- id: _(t.key),
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: v(n.key),
176
+ group: w(n.key),
107
177
  type: "tembro-kanban-card",
108
178
  accept: "tembro-kanban-card",
109
- disabled: m,
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
- }), x = /* @__PURE__ */ p(w, {
120
- ref: g,
121
- label: s?.(t, n) ?? `Move ${String(t.title)}`,
122
- disabled: m
123
- }), S = {
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: y,
126
- isDropTarget: b,
127
- handle: x
207
+ isDragging: x,
208
+ isDropTarget: S,
209
+ selected: s,
210
+ selectControl: E,
211
+ handle: T
128
212
  };
129
- return /* @__PURE__ */ p("article", {
130
- ref: h,
213
+ return /* @__PURE__ */ y("article", {
214
+ ref: v,
131
215
  "data-slot": "kanban-card",
132
- "data-dragging": y || void 0,
133
- "data-drop-target": b || void 0,
134
- "data-disabled": m || void 0,
135
- role: o && !m ? "button" : void 0,
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: !m,
139
- className: e("rounded-lg outline-none transition-[opacity,box-shadow]", o && !m && "cursor-pointer focus-visible:ring-2 focus-visible:ring-ring", b && "ring-2 ring-primary/30", y && "opacity-30", m && "opacity-55", c),
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
- m || o?.(t, n);
224
+ _ || o?.(t, n);
142
225
  },
143
226
  onDragStart: (e) => {
144
- if (m) return;
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)), l?.(i);
233
+ e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", JSON.stringify(i)), f?.(i);
151
234
  },
152
- onDragEnd: d,
235
+ onDragEnd: m,
153
236
  onDragOver: (e) => {
154
- m || e.preventDefault();
237
+ _ || e.preventDefault();
155
238
  },
156
239
  onDrop: (e) => {
157
- m || (e.preventDefault(), e.stopPropagation(), f?.({
240
+ _ || (e.preventDefault(), e.stopPropagation(), h?.({
158
241
  columnKey: n.key,
159
242
  index: r
160
243
  }));
161
244
  },
162
- onKeyDown: (e) => {
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: x
247
+ handle: T,
248
+ selectControl: E
168
249
  })
169
250
  });
170
251
  }
171
- function D({ column: t, boardDisabled: n, renderCard: r, onCardClick: i, dragHandleLabel: a, emptyColumn: o, columnClassName: s, cardClassName: l, onNativeDragStart: u, onNativeDragEnd: d, onNativeDrop: f }) {
172
- let { ref: h, isDropTarget: g } = c({
173
- id: v(t.key),
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: n || t.disabled === !0,
257
+ disabled: i || r.disabled === !0,
177
258
  collisionPriority: 1,
178
- data: { columnKey: t.key }
259
+ data: { columnKey: r.key }
179
260
  });
180
- return /* @__PURE__ */ m("section", {
181
- ref: h,
261
+ return /* @__PURE__ */ b("section", {
262
+ ref: E,
182
263
  "data-slot": "kanban-column",
183
- "data-drop-target": g || void 0,
184
- "data-disabled": t.disabled || void 0,
185
- "aria-label": typeof t.title == "string" ? t.title : void 0,
186
- className: e("grid min-h-40 content-start gap-3 rounded-lg border bg-muted/35 p-3 transition-[border-color,background-color,box-shadow]", g && "border-primary/60 bg-primary/5 ring-2 ring-primary/15", t.disabled && "opacity-60", s),
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
- n || t.disabled === !0 || e.preventDefault();
270
+ i || r.disabled === !0 || e.preventDefault();
189
271
  },
190
272
  onDrop: (e) => {
191
- n || t.disabled === !0 || (e.preventDefault(), f?.({
192
- columnKey: t.key,
193
- index: t.cards.length
273
+ i || r.disabled === !0 || (e.preventDefault(), C?.({
274
+ columnKey: r.key,
275
+ index: r.cards.length
194
276
  }));
195
277
  },
196
- children: [/* @__PURE__ */ m("div", {
197
- className: "flex items-start justify-between gap-3",
198
- children: [/* @__PURE__ */ m("div", {
199
- className: "grid gap-0.5",
200
- children: [/* @__PURE__ */ p("h3", {
201
- className: "text-sm font-semibold text-foreground",
202
- children: t.title
203
- }), t.description ? /* @__PURE__ */ p("p", {
204
- className: "text-xs text-muted-foreground",
205
- children: t.description
206
- }) : null]
207
- }), /* @__PURE__ */ p("div", {
208
- className: "rounded-full bg-background px-2 py-0.5 text-xs text-muted-foreground",
209
- children: t.count ?? t.cards.length
210
- })]
211
- }), /* @__PURE__ */ p("div", {
212
- className: "grid min-h-16 content-start gap-2",
213
- children: t.cards.length === 0 ? /* @__PURE__ */ m("div", {
214
- className: "grid min-h-20 place-items-center rounded-lg border border-dashed p-3 text-center text-xs text-muted-foreground",
215
- children: [/* @__PURE__ */ p("span", { children: o }), /* @__PURE__ */ p("span", {
216
- className: "sr-only",
217
- children: "No cards yet."
218
- })]
219
- }) : t.cards.map((e, o) => /* @__PURE__ */ p(E, {
220
- card: e,
221
- column: t,
222
- index: o,
223
- boardDisabled: n,
224
- renderCard: r,
225
- onCardClick: i,
226
- dragHandleLabel: a,
227
- cardClassName: l,
228
- onNativeDragStart: u,
229
- onNativeDragEnd: d,
230
- onNativeDrop: f
231
- }, e.key))
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 O({ columns: t, defaultColumns: n = [], onColumnsChange: r, onCardMove: i, renderCard: a, onCardClick: c, disabled: u = !1, emptyColumn: f = "Drop cards here.", dragHandleLabel: h, columnClassName: g, cardClassName: v, overlayClassName: x, className: w, "aria-label": E = "Kanban board", ...O }) {
236
- let [k, A] = d.useState(() => n), [j, M] = d.useState(null), [N, P] = d.useState(null), F = d.useRef(null), I = d.useRef(null), L = t ?? k, R = j ?? L, z = t !== void 0;
237
- function B(e) {
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
- F.current = L, M(L), P(n);
367
+ K.current = J, U(J), G(n);
242
368
  }
243
- function V(e) {
369
+ function ce(e) {
244
370
  let t = e.operation.source;
245
- if (!t || !l(t)) return;
246
- let n = S(F.current ?? L, e);
247
- F.current = n, M(n);
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 H(e) {
375
+ function le(e) {
250
376
  let t = e.operation.source;
251
- if (P(null), e.canceled || !t || !l(t)) {
252
- F.current = null, M(null);
377
+ if (G(null), e.canceled || !t || !f(t)) {
378
+ K.current = null, U(null);
253
379
  return;
254
380
  }
255
- let n = F.current ?? S(L, e), a = y(String(t.id)), o = b(t.initialGroup), s = b(t.group), c = L.find((e) => e.key === o), u = n.find((e) => e.key === s), d = c?.cards.find((e) => e.key === a);
256
- if (F.current = null, M(null), !d || !c || !u) return;
257
- let f = {
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: c,
385
+ fromColumn: l,
260
386
  toColumn: u,
261
387
  fromIndex: t.initialIndex,
262
388
  toIndex: t.index
263
389
  };
264
- z || A(n), r?.(n, f), i?.(f);
390
+ A(J, n, d.key, w, D, a) && (X || V(n), r?.(n, p), i?.(p));
265
391
  }
266
- function U(e) {
267
- let t = I.current;
268
- if (I.current = null, !t) return;
269
- let n = C(L, t, e);
270
- n && (z || A(n.columns), r?.(n.columns, n.change), i?.(n.change));
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 W = N ? R.flatMap((e) => e.cards.map((t) => ({
398
+ let $ = W ? Y.flatMap((e) => e.cards.map((t) => ({
273
399
  card: t,
274
400
  column: e
275
- }))).find(({ card: e }) => _(e.key) === N) : void 0;
276
- return /* @__PURE__ */ m(o, {
277
- onDragStart: B,
278
- onDragOver: V,
279
- onDragEnd: H,
280
- children: [/* @__PURE__ */ p("div", {
281
- ...O,
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": E,
409
+ "aria-label": R,
284
410
  "data-slot": "kanban-board",
285
- className: e("grid gap-4 sm:auto-cols-[minmax(280px,1fr)] sm:grid-flow-col sm:overflow-x-auto sm:pb-2", w),
286
- children: R.map((e) => /* @__PURE__ */ p(D, {
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: u,
289
- renderCard: a,
290
- onCardClick: c,
291
- dragHandleLabel: h,
292
- emptyColumn: f,
293
- columnClassName: g,
294
- cardClassName: v,
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
- I.current = e;
433
+ q.current = e;
297
434
  },
298
435
  onNativeDragEnd: () => {
299
- I.current = null;
436
+ q.current = null;
300
437
  },
301
- onNativeDrop: U
302
- }, e.key))
303
- }), /* @__PURE__ */ p(s, { children: W ? /* @__PURE__ */ p("div", {
304
- className: e("min-w-64 rotate-1 opacity-95 shadow-2xl", x),
305
- children: a?.(W.card, W.column, {
306
- index: W.column.cards.findIndex((e) => e.key === W.card.key),
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
- }) ?? /* @__PURE__ */ p(T, {
311
- card: W.card,
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 { O as KanbanBoard };
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(`flex size-7 shrink-0 items-center justify-center rounded-full border text-[10px]`,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(`grid grid-cols-[auto_1fr] gap-3`,r,e.className),children:[(0,i.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,i.jsx)(s,{item:e}),!a&&(0,i.jsx)(`div`,{"data-slot":`timeline-line`,className:`w-px flex-1 bg-border`})]}),(0,i.jsxs)(`div`,{className:t.cn(`min-w-0 pb-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;
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;