@devalok/shilp-sutra-karm 0.8.2 → 0.9.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/dist/_chunks/chat-panel.js +376 -0
  2. package/dist/_chunks/daily-brief.js +177 -0
  3. package/dist/_chunks/kanban-board.js +597 -0
  4. package/dist/_chunks/project-card.js +121 -0
  5. package/dist/_chunks/render-adjustment-type.js +3596 -0
  6. package/dist/{tasks → _chunks}/task-constants.js +3 -3
  7. package/dist/_chunks/task-detail-panel.js +1305 -0
  8. package/dist/_chunks/use-composed-ref.js +12 -0
  9. package/dist/_chunks/vendor.js +11491 -0
  10. package/dist/admin/index.js +37 -60
  11. package/dist/board/index.js +3 -5
  12. package/dist/chat/index.js +6 -10
  13. package/dist/client/index.js +4 -6
  14. package/dist/dashboard/index.js +3 -4
  15. package/dist/index.js +189 -103
  16. package/dist/tasks/index.js +8 -14
  17. package/package.json +78 -80
  18. package/dist/admin/adjustments/approved-adjustments.js +0 -43
  19. package/dist/admin/break/break-admin-skeleton.js +0 -59
  20. package/dist/admin/break/break-admin.js +0 -373
  21. package/dist/admin/break/break-balance.js +0 -42
  22. package/dist/admin/break/breaks.js +0 -91
  23. package/dist/admin/break/delete-break.js +0 -55
  24. package/dist/admin/break/edit-break-balance.js +0 -113
  25. package/dist/admin/break/edit-break.js +0 -453
  26. package/dist/admin/break/header.js +0 -231
  27. package/dist/admin/break/leave-request.js +0 -162
  28. package/dist/admin/break/use-break-date-picker.js +0 -43
  29. package/dist/admin/dashboard/admin-dashboard.js +0 -337
  30. package/dist/admin/dashboard/associate-detail.js +0 -259
  31. package/dist/admin/dashboard/attendance-overview.js +0 -136
  32. package/dist/admin/dashboard/break-request.js +0 -176
  33. package/dist/admin/dashboard/calendar.js +0 -141
  34. package/dist/admin/dashboard/correction-list.js +0 -102
  35. package/dist/admin/dashboard/dashboard-header.js +0 -155
  36. package/dist/admin/dashboard/dashboard-skeleton.js +0 -109
  37. package/dist/admin/dashboard/leave-requests.js +0 -201
  38. package/dist/admin/dashboard/render-date.js +0 -144
  39. package/dist/admin/dashboard/use-calendar-navigation.js +0 -169
  40. package/dist/admin/dashboard/use-leave-request-interaction.js +0 -34
  41. package/dist/admin/utils/date-range-utils.js +0 -37
  42. package/dist/admin/utils/date-utils.js +0 -119
  43. package/dist/admin/utils/emoji-utils.js +0 -17
  44. package/dist/admin/utils/render-adjustment-type.js +0 -20
  45. package/dist/admin/utils/render-status.js +0 -22
  46. package/dist/board/board-column.js +0 -236
  47. package/dist/board/kanban-board.js +0 -218
  48. package/dist/board/task-card.js +0 -168
  49. package/dist/chat/chat-input.js +0 -54
  50. package/dist/chat/chat-panel.js +0 -151
  51. package/dist/chat/conversation-list.js +0 -99
  52. package/dist/chat/markdown-components.js +0 -35
  53. package/dist/chat/message-list.js +0 -59
  54. package/dist/chat/streaming-text.js +0 -17
  55. package/dist/client/accent-provider.js +0 -22
  56. package/dist/client/client-portal-header.js +0 -48
  57. package/dist/client/project-card.js +0 -60
  58. package/dist/dashboard/attendance-cta.js +0 -115
  59. package/dist/dashboard/daily-brief.js +0 -68
  60. package/dist/page-skeletons.js +0 -130
  61. package/dist/tasks/activity-tab.js +0 -185
  62. package/dist/tasks/conversation-tab.js +0 -138
  63. package/dist/tasks/files-tab.js +0 -186
  64. package/dist/tasks/review-tab.js +0 -170
  65. package/dist/tasks/subtasks-tab.js +0 -154
  66. package/dist/tasks/task-detail-panel.js +0 -210
  67. package/dist/tasks/task-properties.js +0 -324
  68. package/dist/utils/use-composed-ref.js +0 -12
@@ -0,0 +1,597 @@
1
+ "use client";
2
+ import { jsx as e, jsxs as c, Fragment as X } from "react/jsx-runtime";
3
+ import * as F from "react";
4
+ import { useState as O, useRef as J, useEffect as Z, useMemo as le, useCallback as L } from "react";
5
+ import { u as se } from "./use-composed-ref.js";
6
+ import { createPortal as me } from "react-dom";
7
+ import { u as fe, C as ue, c as he, a as pe, S as re, v as xe, b as be, d as U, D as ge, e as ve, h as ye, f as Ne, s as we, K as ke, T as Ie, P as De } from "./vendor.js";
8
+ import { cn as j } from "@devalok/shilp-sutra/ui/lib/utils";
9
+ import { Button as $ } from "@devalok/shilp-sutra/ui/button";
10
+ import { Input as H } from "@devalok/shilp-sutra/ui/input";
11
+ import { DropdownMenu as Ce, DropdownMenuTrigger as Se, DropdownMenuContent as Oe, DropdownMenuItem as q, DropdownMenuSeparator as Ee } from "@devalok/shilp-sutra/ui/dropdown-menu";
12
+ import { IconGripVertical as Re, IconCalendar as Be, IconEye as ee, IconPlus as Q, IconDots as Ke, IconPencil as Ae, IconEyeOff as Te, IconTrash as ze } from "@tabler/icons-react";
13
+ import { Badge as Le } from "@devalok/shilp-sutra/ui";
14
+ import { AvatarGroup as $e } from "@devalok/shilp-sutra/composed/avatar-group";
15
+ import { P as je, a as Me } from "./task-constants.js";
16
+ function _e(s) {
17
+ const t = new Date(s), r = /* @__PURE__ */ new Date(), h = t.getTime() - r.getTime(), m = Math.ceil(h / (1e3 * 60 * 60 * 24));
18
+ return m < 0 ? { label: "Overdue", className: "text-text-error" } : m === 0 ? { label: "Today", className: "text-text-warning" } : m === 1 ? { label: "Tomorrow", className: "text-text-warning" } : {
19
+ label: t.toLocaleDateString("en-IN", { month: "short", day: "numeric" }),
20
+ className: "text-text-tertiary"
21
+ };
22
+ }
23
+ const Fe = he(
24
+ "group/card relative rounded-ds-lg border border-border/60 bg-layer-01 p-ds-04 shadow-01 transition-[color,background-color,border-color,box-shadow] duration-fast-02 ease-productive-standard hover:shadow-02 hover:border-border cursor-pointer",
25
+ {
26
+ variants: {
27
+ state: {
28
+ default: "",
29
+ dragging: "opacity-[0.38]",
30
+ overlay: "rotate-[2deg] shadow-03 border-border-interactive/60 ring-1 ring-interactive/40"
31
+ },
32
+ blocked: {
33
+ true: "border-l-2 border-l-error",
34
+ false: ""
35
+ }
36
+ },
37
+ defaultVariants: {
38
+ state: "default",
39
+ blocked: !1
40
+ }
41
+ }
42
+ );
43
+ function ae({
44
+ task: s,
45
+ isDragging: t,
46
+ isDragOverlay: r,
47
+ dragHandleProps: h,
48
+ onClickTask: m
49
+ }) {
50
+ const w = s.dueDate ? _e(s.dueDate) : null;
51
+ return /* @__PURE__ */ c(
52
+ "div",
53
+ {
54
+ role: "button",
55
+ tabIndex: 0,
56
+ className: Fe({
57
+ state: r ? "overlay" : t ? "dragging" : "default",
58
+ blocked: s.isBlocked
59
+ }),
60
+ onClick: () => m == null ? void 0 : m(s.id),
61
+ onKeyDown: (f) => {
62
+ (f.key === "Enter" || f.key === " ") && (f.preventDefault(), m == null || m(s.id));
63
+ },
64
+ children: [
65
+ /* @__PURE__ */ c("div", { className: "flex items-start gap-ds-02b", children: [
66
+ /* @__PURE__ */ e(
67
+ "button",
68
+ {
69
+ className: j(
70
+ "mt-ds-01 flex-shrink-0 cursor-grab rounded p-ds-01 opacity-0 transition-opacity",
71
+ "group-hover/card:opacity-[0.38] hover:!opacity-100",
72
+ "active:cursor-grabbing",
73
+ r && "opacity-[0.38]"
74
+ ),
75
+ ...(h == null ? void 0 : h.attributes) ?? {},
76
+ ...(h == null ? void 0 : h.listeners) ?? {},
77
+ "aria-label": `Drag handle for task: ${s.title}`,
78
+ "aria-roledescription": "sortable",
79
+ onClick: (f) => f.stopPropagation(),
80
+ children: /* @__PURE__ */ e(Re, { className: "h-ico-sm w-ico-sm text-icon-secondary" })
81
+ }
82
+ ),
83
+ /* @__PURE__ */ e("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ e("p", { className: "text-ds-md font-medium text-text-primary line-clamp-2", children: s.title }) })
84
+ ] }),
85
+ /* @__PURE__ */ c("div", { className: "mt-ds-03 flex items-center gap-ds-03", children: [
86
+ /* @__PURE__ */ e(
87
+ "div",
88
+ {
89
+ className: j(
90
+ "h-2 w-2 rounded-ds-full flex-shrink-0",
91
+ Me[s.priority]
92
+ ),
93
+ title: je[s.priority]
94
+ }
95
+ ),
96
+ s.labels.length > 0 && /* @__PURE__ */ c("div", { className: "flex items-center gap-ds-02 overflow-hidden", children: [
97
+ s.labels.slice(0, 2).map((f) => /* @__PURE__ */ e(Le, { size: "sm", className: "max-w-[80px] truncate", children: f }, f)),
98
+ s.labels.length > 2 && /* @__PURE__ */ c("span", { className: "text-ds-xs text-text-tertiary", children: [
99
+ "+",
100
+ s.labels.length - 2
101
+ ] })
102
+ ] }),
103
+ /* @__PURE__ */ e("div", { className: "flex-1" }),
104
+ w && /* @__PURE__ */ c(
105
+ "div",
106
+ {
107
+ className: j(
108
+ "flex items-center gap-ds-01 text-ds-xs leading-tight",
109
+ w.className
110
+ ),
111
+ children: [
112
+ /* @__PURE__ */ e(Be, { className: "h-2.5 w-2.5" }),
113
+ /* @__PURE__ */ e("span", { children: w.label })
114
+ ]
115
+ }
116
+ ),
117
+ s.assignees.length > 0 && /* @__PURE__ */ e(
118
+ $e,
119
+ {
120
+ users: s.assignees,
121
+ size: "sm",
122
+ max: 2,
123
+ showTooltip: !1
124
+ }
125
+ )
126
+ ] })
127
+ ]
128
+ }
129
+ );
130
+ }
131
+ const ie = F.forwardRef(
132
+ function({ task: t, onClickTask: r }, h) {
133
+ const {
134
+ attributes: m,
135
+ listeners: w,
136
+ setNodeRef: f,
137
+ transform: D,
138
+ transition: C,
139
+ isDragging: T
140
+ } = fe({
141
+ id: t.id,
142
+ data: {
143
+ type: "task",
144
+ task: t
145
+ }
146
+ }), E = se(f, h), x = {
147
+ transform: ue.Transform.toString(D),
148
+ transition: C
149
+ };
150
+ return /* @__PURE__ */ e("div", { ref: E, style: x, children: /* @__PURE__ */ e(
151
+ ae,
152
+ {
153
+ task: t,
154
+ isDragging: T,
155
+ dragHandleProps: { attributes: m, listeners: w },
156
+ onClickTask: r
157
+ }
158
+ ) });
159
+ }
160
+ );
161
+ ie.displayName = "TaskCard";
162
+ const ne = F.forwardRef(
163
+ function({ task: t }, r) {
164
+ return /* @__PURE__ */ e("div", { ref: r, children: /* @__PURE__ */ e(ae, { task: t, isDragOverlay: !0 }) });
165
+ }
166
+ );
167
+ ne.displayName = "TaskCardOverlay";
168
+ const te = [
169
+ "border-l-category-cyan",
170
+ "border-l-category-amber",
171
+ "border-l-category-teal",
172
+ "border-l-category-indigo",
173
+ "border-l-category-orange",
174
+ "border-l-category-emerald",
175
+ "border-l-category-slate",
176
+ "border-l-accent"
177
+ ], oe = F.forwardRef(
178
+ function({
179
+ column: t,
180
+ index: r,
181
+ isOverlay: h,
182
+ onAddTask: m,
183
+ onClickTask: w,
184
+ onRenameColumn: f,
185
+ onDeleteColumn: D,
186
+ onToggleVisibility: C
187
+ }, T) {
188
+ const [E, x] = O(!1), [k, S] = O(""), [G, R] = O(!1), [B, K] = O(t.name), z = J(null), P = J(null), { setNodeRef: g, isOver: V } = pe({
189
+ id: `column-${t.id}`,
190
+ data: {
191
+ type: "column",
192
+ column: t
193
+ }
194
+ }), I = t.tasks.map((o) => o.id), A = te[r % te.length], M = () => {
195
+ k.trim() && (m(t.id, k.trim()), S(""), x(!1));
196
+ }, W = (o) => {
197
+ o.key === "Enter" && M(), o.key === "Escape" && (S(""), x(!1));
198
+ }, _ = () => {
199
+ B.trim() && B.trim() !== t.name && (f == null || f(t.id, B.trim())), R(!1);
200
+ }, Y = (o) => {
201
+ o.key === "Enter" && _(), o.key === "Escape" && (K(t.name), R(!1));
202
+ };
203
+ return /* @__PURE__ */ c(
204
+ "div",
205
+ {
206
+ ref: T,
207
+ className: j(
208
+ /* intentional: board column fixed width — matches add-column button */
209
+ "flex h-full w-[300px] flex-shrink-0 flex-col rounded-ds-xl border-l-[3px] bg-layer-01 shadow-01",
210
+ A,
211
+ h && "shadow-04"
212
+ ),
213
+ children: [
214
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-ds-03 px-ds-04 py-ds-04", children: [
215
+ G ? /* @__PURE__ */ e(
216
+ H,
217
+ {
218
+ ref: P,
219
+ value: B,
220
+ onChange: (o) => K(o.target.value),
221
+ onBlur: _,
222
+ onKeyDown: Y,
223
+ className: "h-ds-xs-plus text-ds-md font-semibold",
224
+ autoFocus: !0
225
+ }
226
+ ) : /* @__PURE__ */ e(
227
+ "h3",
228
+ {
229
+ className: "text-ds-md font-semibold text-text-primary truncate",
230
+ onDoubleClick: () => {
231
+ K(t.name), R(!0);
232
+ },
233
+ children: t.name
234
+ }
235
+ ),
236
+ /* @__PURE__ */ e("span", { className: "flex h-5 min-w-[20px] items-center justify-center rounded-ds-full bg-field px-ds-02b text-ds-sm font-medium text-text-tertiary", children: t.tasks.length }),
237
+ t.isClientVisible && /* @__PURE__ */ e(
238
+ ee,
239
+ {
240
+ className: "h-3 w-3 text-text-tertiary",
241
+ "aria-label": "Visible to client"
242
+ }
243
+ ),
244
+ /* @__PURE__ */ e("div", { className: "flex-1" }),
245
+ /* @__PURE__ */ e(
246
+ $,
247
+ {
248
+ variant: "ghost",
249
+ size: "icon-md",
250
+ className: "h-ds-xs w-ds-xs opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 focus:opacity-100 hover:bg-interactive-subtle hover:text-interactive transition-opacity",
251
+ "aria-label": "Add task",
252
+ onClick: () => {
253
+ x(!0), setTimeout(() => {
254
+ var o;
255
+ return (o = z.current) == null ? void 0 : o.focus();
256
+ }, 50);
257
+ },
258
+ children: /* @__PURE__ */ e(Q, { className: "h-ico-sm w-ico-sm" })
259
+ }
260
+ ),
261
+ /* @__PURE__ */ c(Ce, { children: [
262
+ /* @__PURE__ */ e(Se, { asChild: !0, children: /* @__PURE__ */ e(
263
+ $,
264
+ {
265
+ variant: "ghost",
266
+ size: "icon-md",
267
+ className: "h-ds-xs w-ds-xs opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 focus:opacity-100 transition-opacity",
268
+ "aria-label": "Column options",
269
+ children: /* @__PURE__ */ e(Ke, { className: "h-ico-sm w-ico-sm" })
270
+ }
271
+ ) }),
272
+ /* @__PURE__ */ c(Oe, { align: "end", className: "w-44", children: [
273
+ /* @__PURE__ */ c(
274
+ q,
275
+ {
276
+ onClick: () => {
277
+ K(t.name), R(!0);
278
+ },
279
+ children: [
280
+ /* @__PURE__ */ e(Ae, { className: "mr-ds-03 h-ico-sm w-ico-sm" }),
281
+ "Rename"
282
+ ]
283
+ }
284
+ ),
285
+ /* @__PURE__ */ e(
286
+ q,
287
+ {
288
+ onClick: () => C == null ? void 0 : C(t.id, !t.isClientVisible),
289
+ children: t.isClientVisible ? /* @__PURE__ */ c(X, { children: [
290
+ /* @__PURE__ */ e(Te, { className: "mr-ds-03 h-ico-sm w-ico-sm" }),
291
+ "Hide from client"
292
+ ] }) : /* @__PURE__ */ c(X, { children: [
293
+ /* @__PURE__ */ e(ee, { className: "mr-ds-03 h-ico-sm w-ico-sm" }),
294
+ "Show to client"
295
+ ] })
296
+ }
297
+ ),
298
+ /* @__PURE__ */ e(Ee, {}),
299
+ /* @__PURE__ */ c(
300
+ q,
301
+ {
302
+ className: "text-error focus:text-error",
303
+ onClick: () => D == null ? void 0 : D(t.id),
304
+ children: [
305
+ /* @__PURE__ */ e(ze, { className: "mr-ds-03 h-ico-sm w-ico-sm" }),
306
+ "Delete column"
307
+ ]
308
+ }
309
+ )
310
+ ] })
311
+ ] })
312
+ ] }),
313
+ /* @__PURE__ */ c(
314
+ "div",
315
+ {
316
+ ref: g,
317
+ className: j(
318
+ "no-scrollbar flex flex-1 flex-col gap-ds-03 overflow-y-auto px-ds-03 pb-ds-03 transition-colors duration-fast-02 ease-productive-standard",
319
+ V && "bg-interactive-subtle/50"
320
+ ),
321
+ children: [
322
+ /* @__PURE__ */ e(re, { items: I, strategy: xe, children: t.tasks.map((o) => /* @__PURE__ */ e(ie, { task: o, onClickTask: w }, o.id)) }),
323
+ t.tasks.length === 0 && !E && /* @__PURE__ */ e("div", { className: "flex flex-1 items-center justify-center py-ds-07", children: /* @__PURE__ */ e("p", { className: "text-ds-sm text-text-placeholder", children: "No tasks" }) })
324
+ ]
325
+ }
326
+ ),
327
+ E ? /* @__PURE__ */ c("div", { className: "border-t border-border-subtle p-ds-03", children: [
328
+ /* @__PURE__ */ e(
329
+ H,
330
+ {
331
+ ref: z,
332
+ value: k,
333
+ onChange: (o) => S(o.target.value),
334
+ onKeyDown: W,
335
+ onBlur: () => {
336
+ k.trim() || x(!1);
337
+ },
338
+ placeholder: "Task title...",
339
+ className: "h-ds-sm text-ds-md",
340
+ autoFocus: !0
341
+ }
342
+ ),
343
+ /* @__PURE__ */ c("div", { className: "mt-ds-02b flex items-center gap-ds-02", children: [
344
+ /* @__PURE__ */ e(
345
+ $,
346
+ {
347
+ size: "sm",
348
+ className: "h-ds-xs-plus bg-interactive hover:bg-interactive-hover text-text-on-color text-ds-sm",
349
+ onClick: M,
350
+ disabled: !k.trim(),
351
+ children: "Add"
352
+ }
353
+ ),
354
+ /* @__PURE__ */ e(
355
+ $,
356
+ {
357
+ variant: "ghost",
358
+ size: "sm",
359
+ className: "h-ds-xs-plus text-ds-sm",
360
+ onClick: () => {
361
+ S(""), x(!1);
362
+ },
363
+ children: "Cancel"
364
+ }
365
+ )
366
+ ] })
367
+ ] }) : /* @__PURE__ */ c(
368
+ "button",
369
+ {
370
+ onClick: () => {
371
+ x(!0), setTimeout(() => {
372
+ var o;
373
+ return (o = z.current) == null ? void 0 : o.focus();
374
+ }, 50);
375
+ },
376
+ className: "flex items-center gap-ds-02b border-t border-border-subtle px-ds-04 py-ds-03 text-ds-sm text-text-placeholder transition-colors hover:bg-field hover:text-text-tertiary",
377
+ children: [
378
+ /* @__PURE__ */ e(Q, { className: "h-3 w-3" }),
379
+ "Add task"
380
+ ]
381
+ }
382
+ )
383
+ ]
384
+ }
385
+ );
386
+ }
387
+ );
388
+ oe.displayName = "BoardColumn";
389
+ function Ge() {
390
+ return {
391
+ onDragStart({ active: s }) {
392
+ const t = s.data.current;
393
+ return (t == null ? void 0 : t.type) === "task" ? `Picked up task: ${t.task.title}` : "Picked up item";
394
+ },
395
+ onDragOver({ active: s, over: t }) {
396
+ if (!t) return;
397
+ const r = s.data.current;
398
+ if ((r == null ? void 0 : r.type) === "task")
399
+ return `Task ${r.task.title} is over ${t.id}`;
400
+ },
401
+ onDragEnd({ active: s, over: t }) {
402
+ if (!t) return "Dropped item";
403
+ const r = s.data.current;
404
+ return (r == null ? void 0 : r.type) === "task" ? `Dropped task: ${r.task.title}` : "Dropped item";
405
+ },
406
+ onDragCancel() {
407
+ return "Dragging cancelled";
408
+ }
409
+ };
410
+ }
411
+ const Pe = F.forwardRef(
412
+ function({
413
+ initialData: t,
414
+ onTaskMove: r,
415
+ onTaskAdd: h,
416
+ onColumnRename: m,
417
+ onColumnDelete: w,
418
+ onColumnToggleVisibility: f,
419
+ onClickTask: D,
420
+ onAddColumn: C
421
+ }, T) {
422
+ const [E, x] = O(t), [k, S] = O(null), [G, R] = O(!1), B = J(null), K = se(B, T);
423
+ Z(() => {
424
+ x(t);
425
+ }, [t]), Z(() => {
426
+ R(!0);
427
+ }, []);
428
+ const z = be(
429
+ U(De, {
430
+ activationConstraint: {
431
+ distance: 5
432
+ }
433
+ }),
434
+ U(Ie, {
435
+ activationConstraint: {
436
+ delay: 200,
437
+ tolerance: 5
438
+ }
439
+ }),
440
+ U(ke, {
441
+ coordinateGetter: we
442
+ })
443
+ ), P = le(() => Ge(), []), g = E.columns, V = g.map((a) => `column-${a.id}`), I = L(
444
+ (a) => {
445
+ for (const i of g)
446
+ if (i.tasks.some((p) => p.id === a))
447
+ return i.id;
448
+ return null;
449
+ },
450
+ [g]
451
+ ), A = L(
452
+ (a, i, p, u) => {
453
+ x((v) => {
454
+ const y = v.columns.map((b) => ({
455
+ ...b,
456
+ tasks: [...b.tasks]
457
+ })), d = y.find((b) => b.id === i), N = y.find((b) => b.id === p);
458
+ if (!d || !N) return v;
459
+ const n = d.tasks.findIndex((b) => b.id === a);
460
+ if (n === -1) return v;
461
+ const [l] = d.tasks.splice(n, 1);
462
+ return N.tasks.splice(u, 0, l), { columns: y };
463
+ });
464
+ },
465
+ []
466
+ ), M = L((a) => {
467
+ const i = a.active.data.current;
468
+ (i == null ? void 0 : i.type) === "task" && S(i.task);
469
+ }, []), W = L(
470
+ (a) => {
471
+ const { active: i, over: p } = a;
472
+ if (!p) return;
473
+ const u = i.id, v = p.id, y = I(u);
474
+ if (!y) return;
475
+ let d = null, N = 0;
476
+ if (v.startsWith("column-")) {
477
+ d = v.replace("column-", "");
478
+ const n = g.find((l) => l.id === d);
479
+ N = (n == null ? void 0 : n.tasks.length) ?? 0;
480
+ } else if (d = I(v), d) {
481
+ const n = g.find((l) => l.id === d);
482
+ N = (n == null ? void 0 : n.tasks.findIndex((l) => l.id === v)) ?? 0;
483
+ }
484
+ !d || y === d || A(u, y, d, N);
485
+ },
486
+ [g, I, A]
487
+ ), _ = L(
488
+ (a) => {
489
+ const { active: i, over: p } = a;
490
+ if (S(null), !p) return;
491
+ const u = i.id, v = p.id, y = I(u);
492
+ if (!y) return;
493
+ let d, N;
494
+ if (v.startsWith("column-")) {
495
+ d = v.replace("column-", "");
496
+ const n = g.find((l) => l.id === d);
497
+ if (N = (n == null ? void 0 : n.tasks.length) ?? 0, y === d) {
498
+ const l = n == null ? void 0 : n.tasks.findIndex((b) => b.id === u);
499
+ l !== void 0 && l >= 0 && (N = l);
500
+ }
501
+ } else {
502
+ d = I(v) ?? y;
503
+ const n = g.find((l) => l.id === d);
504
+ N = (n == null ? void 0 : n.tasks.findIndex((l) => l.id === v)) ?? 0;
505
+ }
506
+ if (y === d) {
507
+ const n = g.find((b) => b.id === d), l = n == null ? void 0 : n.tasks.findIndex((b) => b.id === u);
508
+ l !== void 0 && l !== N && A(u, y, d, N);
509
+ }
510
+ r == null || r(u, d, N);
511
+ },
512
+ [g, I, A, r]
513
+ ), Y = (a, i) => {
514
+ h == null || h(a, i);
515
+ }, o = (a, i) => {
516
+ x((p) => ({
517
+ columns: p.columns.map(
518
+ (u) => u.id === a ? { ...u, name: i } : u
519
+ )
520
+ })), m == null || m(a, i);
521
+ }, de = (a) => {
522
+ x((i) => ({
523
+ columns: i.columns.filter((p) => p.id !== a)
524
+ })), w == null || w(a);
525
+ }, ce = (a, i) => {
526
+ x((p) => ({
527
+ columns: p.columns.map(
528
+ (u) => u.id === a ? { ...u, isClientVisible: i } : u
529
+ )
530
+ })), f == null || f(a, i);
531
+ };
532
+ return /* @__PURE__ */ c(
533
+ ge,
534
+ {
535
+ sensors: z,
536
+ collisionDetection: ve,
537
+ onDragStart: M,
538
+ onDragOver: W,
539
+ onDragEnd: _,
540
+ accessibility: { announcements: P },
541
+ children: [
542
+ /* @__PURE__ */ c(
543
+ "div",
544
+ {
545
+ ref: K,
546
+ className: "no-scrollbar flex h-full gap-ds-05 overflow-x-auto pb-ds-05",
547
+ children: [
548
+ /* @__PURE__ */ e(
549
+ re,
550
+ {
551
+ items: V,
552
+ strategy: ye,
553
+ children: g.map((a, i) => /* @__PURE__ */ e("div", { className: "group flex-shrink-0", children: /* @__PURE__ */ e(
554
+ oe,
555
+ {
556
+ column: a,
557
+ index: i,
558
+ onAddTask: Y,
559
+ onClickTask: D,
560
+ onRenameColumn: o,
561
+ onDeleteColumn: de,
562
+ onToggleVisibility: ce
563
+ }
564
+ ) }, a.id))
565
+ }
566
+ ),
567
+ /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: /* @__PURE__ */ c(
568
+ $,
569
+ {
570
+ variant: "ghost",
571
+ onClick: C,
572
+ className: "h-ds-md w-[300px] justify-start gap-ds-03 rounded-ds-xl border border-dashed border-border/60 bg-layer-02 text-text-tertiary hover:border-border-interactive hover:bg-interactive-subtle/50 hover:text-interactive",
573
+ children: [
574
+ /* @__PURE__ */ e(Q, { className: "h-ico-sm w-ico-sm" }),
575
+ "Add column"
576
+ ]
577
+ }
578
+ ) })
579
+ ]
580
+ }
581
+ ),
582
+ G && me(
583
+ /* @__PURE__ */ e(Ne, { dropAnimation: null, children: k ? /* @__PURE__ */ e(ne, { task: k }) : null }),
584
+ document.body
585
+ )
586
+ ]
587
+ }
588
+ );
589
+ }
590
+ );
591
+ Pe.displayName = "KanbanBoard";
592
+ export {
593
+ oe as B,
594
+ Pe as K,
595
+ ie as T,
596
+ ne as a
597
+ };