@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.
- package/dist/_chunks/chat-panel.js +376 -0
- package/dist/_chunks/daily-brief.js +177 -0
- package/dist/_chunks/kanban-board.js +597 -0
- package/dist/_chunks/project-card.js +121 -0
- package/dist/_chunks/render-adjustment-type.js +3596 -0
- package/dist/{tasks → _chunks}/task-constants.js +3 -3
- package/dist/_chunks/task-detail-panel.js +1305 -0
- package/dist/_chunks/use-composed-ref.js +12 -0
- package/dist/_chunks/vendor.js +11491 -0
- package/dist/admin/index.js +37 -60
- package/dist/board/index.js +3 -5
- package/dist/chat/index.js +6 -10
- package/dist/client/index.js +4 -6
- package/dist/dashboard/index.js +3 -4
- package/dist/index.js +189 -103
- package/dist/tasks/index.js +8 -14
- package/package.json +78 -80
- package/dist/admin/adjustments/approved-adjustments.js +0 -43
- package/dist/admin/break/break-admin-skeleton.js +0 -59
- package/dist/admin/break/break-admin.js +0 -373
- package/dist/admin/break/break-balance.js +0 -42
- package/dist/admin/break/breaks.js +0 -91
- package/dist/admin/break/delete-break.js +0 -55
- package/dist/admin/break/edit-break-balance.js +0 -113
- package/dist/admin/break/edit-break.js +0 -453
- package/dist/admin/break/header.js +0 -231
- package/dist/admin/break/leave-request.js +0 -162
- package/dist/admin/break/use-break-date-picker.js +0 -43
- package/dist/admin/dashboard/admin-dashboard.js +0 -337
- package/dist/admin/dashboard/associate-detail.js +0 -259
- package/dist/admin/dashboard/attendance-overview.js +0 -136
- package/dist/admin/dashboard/break-request.js +0 -176
- package/dist/admin/dashboard/calendar.js +0 -141
- package/dist/admin/dashboard/correction-list.js +0 -102
- package/dist/admin/dashboard/dashboard-header.js +0 -155
- package/dist/admin/dashboard/dashboard-skeleton.js +0 -109
- package/dist/admin/dashboard/leave-requests.js +0 -201
- package/dist/admin/dashboard/render-date.js +0 -144
- package/dist/admin/dashboard/use-calendar-navigation.js +0 -169
- package/dist/admin/dashboard/use-leave-request-interaction.js +0 -34
- package/dist/admin/utils/date-range-utils.js +0 -37
- package/dist/admin/utils/date-utils.js +0 -119
- package/dist/admin/utils/emoji-utils.js +0 -17
- package/dist/admin/utils/render-adjustment-type.js +0 -20
- package/dist/admin/utils/render-status.js +0 -22
- package/dist/board/board-column.js +0 -236
- package/dist/board/kanban-board.js +0 -218
- package/dist/board/task-card.js +0 -168
- package/dist/chat/chat-input.js +0 -54
- package/dist/chat/chat-panel.js +0 -151
- package/dist/chat/conversation-list.js +0 -99
- package/dist/chat/markdown-components.js +0 -35
- package/dist/chat/message-list.js +0 -59
- package/dist/chat/streaming-text.js +0 -17
- package/dist/client/accent-provider.js +0 -22
- package/dist/client/client-portal-header.js +0 -48
- package/dist/client/project-card.js +0 -60
- package/dist/dashboard/attendance-cta.js +0 -115
- package/dist/dashboard/daily-brief.js +0 -68
- package/dist/page-skeletons.js +0 -130
- package/dist/tasks/activity-tab.js +0 -185
- package/dist/tasks/conversation-tab.js +0 -138
- package/dist/tasks/files-tab.js +0 -186
- package/dist/tasks/review-tab.js +0 -170
- package/dist/tasks/subtasks-tab.js +0 -154
- package/dist/tasks/task-detail-panel.js +0 -210
- package/dist/tasks/task-properties.js +0 -324
- package/dist/utils/use-composed-ref.js +0 -12
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { endOfDay as S, startOfMonth as T, getDaysInMonth as p, subMonths as O, isSameDay as o, format as l, addMonths as $, startOfDay as A, startOfWeek as L, addDays as k } from "date-fns";
|
|
3
|
-
const d = "Asia/Kolkata", g = "en-IN";
|
|
4
|
-
function I(t, e) {
|
|
5
|
-
return new Date(t).toLocaleDateString(g, {
|
|
6
|
-
timeZone: d,
|
|
7
|
-
...e
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
function U(t, e) {
|
|
11
|
-
return new Date(t).toLocaleTimeString(g, {
|
|
12
|
-
timeZone: d,
|
|
13
|
-
...e
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
function w(t) {
|
|
17
|
-
return (t instanceof Date ? t : new Date(t)).toLocaleDateString(g, {
|
|
18
|
-
day: "2-digit",
|
|
19
|
-
month: "short",
|
|
20
|
-
year: "2-digit",
|
|
21
|
-
timeZone: d
|
|
22
|
-
}).replace(",", "").replace(/(\d{2})$/, "’$1");
|
|
23
|
-
}
|
|
24
|
-
function F(t) {
|
|
25
|
-
return t === "-" ? "-" : w(t);
|
|
26
|
-
}
|
|
27
|
-
function P(t) {
|
|
28
|
-
const e = t.toLocaleString(g, {
|
|
29
|
-
weekday: "long",
|
|
30
|
-
timeZone: d
|
|
31
|
-
});
|
|
32
|
-
return `${w(t)}, ${e}`;
|
|
33
|
-
}
|
|
34
|
-
function Z(t) {
|
|
35
|
-
if (t >= 11 && t <= 13) return `${t}th`;
|
|
36
|
-
switch (t % 10) {
|
|
37
|
-
case 1:
|
|
38
|
-
return `${t}st`;
|
|
39
|
-
case 2:
|
|
40
|
-
return `${t}nd`;
|
|
41
|
-
case 3:
|
|
42
|
-
return `${t}rd`;
|
|
43
|
-
default:
|
|
44
|
-
return `${t}th`;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function W(t, e) {
|
|
48
|
-
return !(t instanceof Date) || !(e instanceof Date) ? !1 : o(t, e);
|
|
49
|
-
}
|
|
50
|
-
function x(t, e) {
|
|
51
|
-
const r = L(new Date(t), { weekStartsOn: 0 }), i = /* @__PURE__ */ new Date(), c = new Date(e);
|
|
52
|
-
return Array.from({ length: 7 }, (u, y) => {
|
|
53
|
-
const s = k(r, y);
|
|
54
|
-
return {
|
|
55
|
-
day: l(s, "EEE").toUpperCase(),
|
|
56
|
-
date: s.getDate(),
|
|
57
|
-
fullDate: s,
|
|
58
|
-
isToday: o(s, i),
|
|
59
|
-
isActive: o(s, c)
|
|
60
|
-
};
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
function Y(t, e) {
|
|
64
|
-
const r = new Date(t), i = new Date(e), c = /* @__PURE__ */ new Date(), u = T(r), y = u.getDay(), s = p(r), f = [], h = O(u, 1), E = p(h);
|
|
65
|
-
for (let n = y - 1; n >= 0; n--) {
|
|
66
|
-
const a = E - n, D = new Date(h.getFullYear(), h.getMonth(), a);
|
|
67
|
-
f.push({
|
|
68
|
-
day: l(D, "EEE").toUpperCase(),
|
|
69
|
-
date: D.getDate(),
|
|
70
|
-
fullDate: D,
|
|
71
|
-
isToday: o(D, c),
|
|
72
|
-
isActive: o(D, i),
|
|
73
|
-
isPadding: !0
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
for (let n = 1; n <= s; n++) {
|
|
77
|
-
const a = new Date(r.getFullYear(), r.getMonth(), n);
|
|
78
|
-
f.push({
|
|
79
|
-
day: l(a, "EEE").toUpperCase(),
|
|
80
|
-
date: n,
|
|
81
|
-
fullDate: a,
|
|
82
|
-
isToday: o(a, c),
|
|
83
|
-
isActive: o(a, i),
|
|
84
|
-
isPadding: !1
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
const M = (7 - f.length % 7) % 7, m = $(u, 1);
|
|
88
|
-
for (let n = 1; n <= M; n++) {
|
|
89
|
-
const a = new Date(m.getFullYear(), m.getMonth(), n);
|
|
90
|
-
f.push({
|
|
91
|
-
day: l(a, "EEE").toUpperCase(),
|
|
92
|
-
date: n,
|
|
93
|
-
fullDate: a,
|
|
94
|
-
isToday: o(a, c),
|
|
95
|
-
isActive: o(a, i),
|
|
96
|
-
isPadding: !0
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
return f;
|
|
100
|
-
}
|
|
101
|
-
function _(t = /* @__PURE__ */ new Date()) {
|
|
102
|
-
return A(t);
|
|
103
|
-
}
|
|
104
|
-
function N(t = /* @__PURE__ */ new Date()) {
|
|
105
|
-
return S(t);
|
|
106
|
-
}
|
|
107
|
-
export {
|
|
108
|
-
w as formatDate,
|
|
109
|
-
I as formatDateIST,
|
|
110
|
-
P as formatDateWithWeekday,
|
|
111
|
-
F as formatOptionalDate,
|
|
112
|
-
U as formatTimeIST,
|
|
113
|
-
Z as getDaySuffix,
|
|
114
|
-
N as getEndOfDay,
|
|
115
|
-
Y as getMonthDays,
|
|
116
|
-
_ as getStartOfDay,
|
|
117
|
-
x as getWeekDays,
|
|
118
|
-
W as isSameDay
|
|
119
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
function r(e) {
|
|
3
|
-
return e.replace(
|
|
4
|
-
/^[\p{Emoji_Presentation}\p{Extended_Pictographic}\u200B-\u200D]+/gu,
|
|
5
|
-
""
|
|
6
|
-
);
|
|
7
|
-
}
|
|
8
|
-
function o(e) {
|
|
9
|
-
return (e == null ? void 0 : e.replace(
|
|
10
|
-
/[\p{Emoji_Presentation}\p{Extended_Pictographic}\u200B-\u200D]+/gu,
|
|
11
|
-
""
|
|
12
|
-
)) ?? "";
|
|
13
|
-
}
|
|
14
|
-
export {
|
|
15
|
-
o as removeAllEmojis,
|
|
16
|
-
r as removeEmojiAtStart
|
|
17
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as R } from "react/jsx-runtime";
|
|
3
|
-
const t = {
|
|
4
|
-
YEARLY_BALANCE: "YEARLY_BALANCE",
|
|
5
|
-
CARRY_FORWARD: "CARRY_FORWARD",
|
|
6
|
-
CASHOUT: "CASHOUT",
|
|
7
|
-
OTHER: "OTHER"
|
|
8
|
-
}, r = {
|
|
9
|
-
YEARLY_BALANCE: "Yearly Balance",
|
|
10
|
-
CARRY_FORWARD: "Carry Forward",
|
|
11
|
-
CASHOUT: "Cashout",
|
|
12
|
-
OTHER: "Other"
|
|
13
|
-
};
|
|
14
|
-
function E(A) {
|
|
15
|
-
return /* @__PURE__ */ R("div", { children: r[A] });
|
|
16
|
-
}
|
|
17
|
-
export {
|
|
18
|
-
t as AdjustmentType,
|
|
19
|
-
E as renderAdjustmentType
|
|
20
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as d } from "react/jsx-runtime";
|
|
3
|
-
import { Badge as l } from "@devalok/shilp-sutra/ui";
|
|
4
|
-
const e = {
|
|
5
|
-
APPROVED: { text: "Corrected", color: "accent" },
|
|
6
|
-
PENDING: { text: "Pending", color: "warning" },
|
|
7
|
-
REJECTED: { text: "Denied", color: "error" },
|
|
8
|
-
MISSING: { text: "Missed", color: "error" }
|
|
9
|
-
}, o = {
|
|
10
|
-
APPROVED: { text: "Approved", color: "success" },
|
|
11
|
-
PENDING: { text: "Pending", color: "warning" },
|
|
12
|
-
REJECTED: { text: "Denied", color: "error" },
|
|
13
|
-
CANCELLED: { text: "Redacted", color: "error" },
|
|
14
|
-
MISSING: { text: "Missed", color: "error" }
|
|
15
|
-
};
|
|
16
|
-
function D(t, r) {
|
|
17
|
-
const c = r ? e : o, n = r ? e.REJECTED : o.REJECTED, { text: E, color: s } = c[t] || n;
|
|
18
|
-
return /* @__PURE__ */ d(l, { color: s, size: "sm", children: E });
|
|
19
|
-
}
|
|
20
|
-
export {
|
|
21
|
-
D as renderStatus
|
|
22
|
-
};
|
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs as r, jsx as e, Fragment as N } from "react/jsx-runtime";
|
|
3
|
-
import * as P from "react";
|
|
4
|
-
import { useState as n, useRef as v } from "react";
|
|
5
|
-
import { useDroppable as H } from "@dnd-kit/core";
|
|
6
|
-
import { SortableContext as U, verticalListSortingStrategy as _ } from "@dnd-kit/sortable";
|
|
7
|
-
import { cn as w } from "@devalok/shilp-sutra/ui/lib/utils";
|
|
8
|
-
import { Button as m } from "@devalok/shilp-sutra/ui/button";
|
|
9
|
-
import { Input as k } from "@devalok/shilp-sutra/ui/input";
|
|
10
|
-
import { DropdownMenu as $, DropdownMenuTrigger as q, DropdownMenuContent as G, DropdownMenuItem as u, DropdownMenuSeparator as J } from "@devalok/shilp-sutra/ui/dropdown-menu";
|
|
11
|
-
import { IconEye as C, IconPlus as I, IconDots as Q, IconPencil as V, IconEyeOff as W, IconTrash as X } from "@tabler/icons-react";
|
|
12
|
-
import { TaskCard as Y } from "./task-card.js";
|
|
13
|
-
const E = [
|
|
14
|
-
"border-l-category-cyan",
|
|
15
|
-
"border-l-category-amber",
|
|
16
|
-
"border-l-category-teal",
|
|
17
|
-
"border-l-category-indigo",
|
|
18
|
-
"border-l-category-orange",
|
|
19
|
-
"border-l-category-emerald",
|
|
20
|
-
"border-l-category-slate",
|
|
21
|
-
"border-l-accent"
|
|
22
|
-
], Z = P.forwardRef(
|
|
23
|
-
function({
|
|
24
|
-
column: s,
|
|
25
|
-
index: D,
|
|
26
|
-
isOverlay: A,
|
|
27
|
-
onAddTask: S,
|
|
28
|
-
onClickTask: B,
|
|
29
|
-
onRenameColumn: h,
|
|
30
|
-
onDeleteColumn: f,
|
|
31
|
-
onToggleVisibility: p
|
|
32
|
-
}, M) {
|
|
33
|
-
const [b, a] = n(!1), [i, o] = n(""), [T, d] = n(!1), [c, l] = n(s.name), x = v(null), R = v(null), { setNodeRef: j, isOver: z } = H({
|
|
34
|
-
id: `column-${s.id}`,
|
|
35
|
-
data: {
|
|
36
|
-
type: "column",
|
|
37
|
-
column: s
|
|
38
|
-
}
|
|
39
|
-
}), K = s.tasks.map((t) => t.id), F = E[D % E.length], y = () => {
|
|
40
|
-
i.trim() && (S(s.id, i.trim()), o(""), a(!1));
|
|
41
|
-
}, O = (t) => {
|
|
42
|
-
t.key === "Enter" && y(), t.key === "Escape" && (o(""), a(!1));
|
|
43
|
-
}, g = () => {
|
|
44
|
-
c.trim() && c.trim() !== s.name && (h == null || h(s.id, c.trim())), d(!1);
|
|
45
|
-
}, L = (t) => {
|
|
46
|
-
t.key === "Enter" && g(), t.key === "Escape" && (l(s.name), d(!1));
|
|
47
|
-
};
|
|
48
|
-
return /* @__PURE__ */ r(
|
|
49
|
-
"div",
|
|
50
|
-
{
|
|
51
|
-
ref: M,
|
|
52
|
-
className: w(
|
|
53
|
-
/* intentional: board column fixed width — matches add-column button */
|
|
54
|
-
"flex h-full w-[300px] flex-shrink-0 flex-col rounded-ds-xl border-l-[3px] bg-layer-01 shadow-01",
|
|
55
|
-
F,
|
|
56
|
-
A && "shadow-04"
|
|
57
|
-
),
|
|
58
|
-
children: [
|
|
59
|
-
/* @__PURE__ */ r("div", { className: "flex items-center gap-ds-03 px-ds-04 py-ds-04", children: [
|
|
60
|
-
T ? /* @__PURE__ */ e(
|
|
61
|
-
k,
|
|
62
|
-
{
|
|
63
|
-
ref: R,
|
|
64
|
-
value: c,
|
|
65
|
-
onChange: (t) => l(t.target.value),
|
|
66
|
-
onBlur: g,
|
|
67
|
-
onKeyDown: L,
|
|
68
|
-
className: "h-ds-xs-plus text-ds-md font-semibold",
|
|
69
|
-
autoFocus: !0
|
|
70
|
-
}
|
|
71
|
-
) : /* @__PURE__ */ e(
|
|
72
|
-
"h3",
|
|
73
|
-
{
|
|
74
|
-
className: "text-ds-md font-semibold text-text-primary truncate",
|
|
75
|
-
onDoubleClick: () => {
|
|
76
|
-
l(s.name), d(!0);
|
|
77
|
-
},
|
|
78
|
-
children: s.name
|
|
79
|
-
}
|
|
80
|
-
),
|
|
81
|
-
/* @__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: s.tasks.length }),
|
|
82
|
-
s.isClientVisible && /* @__PURE__ */ e(
|
|
83
|
-
C,
|
|
84
|
-
{
|
|
85
|
-
className: "h-3 w-3 text-text-tertiary",
|
|
86
|
-
"aria-label": "Visible to client"
|
|
87
|
-
}
|
|
88
|
-
),
|
|
89
|
-
/* @__PURE__ */ e("div", { className: "flex-1" }),
|
|
90
|
-
/* @__PURE__ */ e(
|
|
91
|
-
m,
|
|
92
|
-
{
|
|
93
|
-
variant: "ghost",
|
|
94
|
-
size: "icon-md",
|
|
95
|
-
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",
|
|
96
|
-
"aria-label": "Add task",
|
|
97
|
-
onClick: () => {
|
|
98
|
-
a(!0), setTimeout(() => {
|
|
99
|
-
var t;
|
|
100
|
-
return (t = x.current) == null ? void 0 : t.focus();
|
|
101
|
-
}, 50);
|
|
102
|
-
},
|
|
103
|
-
children: /* @__PURE__ */ e(I, { className: "h-ico-sm w-ico-sm" })
|
|
104
|
-
}
|
|
105
|
-
),
|
|
106
|
-
/* @__PURE__ */ r($, { children: [
|
|
107
|
-
/* @__PURE__ */ e(q, { asChild: !0, children: /* @__PURE__ */ e(
|
|
108
|
-
m,
|
|
109
|
-
{
|
|
110
|
-
variant: "ghost",
|
|
111
|
-
size: "icon-md",
|
|
112
|
-
className: "h-ds-xs w-ds-xs opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 focus:opacity-100 transition-opacity",
|
|
113
|
-
"aria-label": "Column options",
|
|
114
|
-
children: /* @__PURE__ */ e(Q, { className: "h-ico-sm w-ico-sm" })
|
|
115
|
-
}
|
|
116
|
-
) }),
|
|
117
|
-
/* @__PURE__ */ r(G, { align: "end", className: "w-44", children: [
|
|
118
|
-
/* @__PURE__ */ r(
|
|
119
|
-
u,
|
|
120
|
-
{
|
|
121
|
-
onClick: () => {
|
|
122
|
-
l(s.name), d(!0);
|
|
123
|
-
},
|
|
124
|
-
children: [
|
|
125
|
-
/* @__PURE__ */ e(V, { className: "mr-ds-03 h-ico-sm w-ico-sm" }),
|
|
126
|
-
"Rename"
|
|
127
|
-
]
|
|
128
|
-
}
|
|
129
|
-
),
|
|
130
|
-
/* @__PURE__ */ e(
|
|
131
|
-
u,
|
|
132
|
-
{
|
|
133
|
-
onClick: () => p == null ? void 0 : p(s.id, !s.isClientVisible),
|
|
134
|
-
children: s.isClientVisible ? /* @__PURE__ */ r(N, { children: [
|
|
135
|
-
/* @__PURE__ */ e(W, { className: "mr-ds-03 h-ico-sm w-ico-sm" }),
|
|
136
|
-
"Hide from client"
|
|
137
|
-
] }) : /* @__PURE__ */ r(N, { children: [
|
|
138
|
-
/* @__PURE__ */ e(C, { className: "mr-ds-03 h-ico-sm w-ico-sm" }),
|
|
139
|
-
"Show to client"
|
|
140
|
-
] })
|
|
141
|
-
}
|
|
142
|
-
),
|
|
143
|
-
/* @__PURE__ */ e(J, {}),
|
|
144
|
-
/* @__PURE__ */ r(
|
|
145
|
-
u,
|
|
146
|
-
{
|
|
147
|
-
className: "text-error focus:text-error",
|
|
148
|
-
onClick: () => f == null ? void 0 : f(s.id),
|
|
149
|
-
children: [
|
|
150
|
-
/* @__PURE__ */ e(X, { className: "mr-ds-03 h-ico-sm w-ico-sm" }),
|
|
151
|
-
"Delete column"
|
|
152
|
-
]
|
|
153
|
-
}
|
|
154
|
-
)
|
|
155
|
-
] })
|
|
156
|
-
] })
|
|
157
|
-
] }),
|
|
158
|
-
/* @__PURE__ */ r(
|
|
159
|
-
"div",
|
|
160
|
-
{
|
|
161
|
-
ref: j,
|
|
162
|
-
className: w(
|
|
163
|
-
"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",
|
|
164
|
-
z && "bg-interactive-subtle/50"
|
|
165
|
-
),
|
|
166
|
-
children: [
|
|
167
|
-
/* @__PURE__ */ e(U, { items: K, strategy: _, children: s.tasks.map((t) => /* @__PURE__ */ e(Y, { task: t, onClickTask: B }, t.id)) }),
|
|
168
|
-
s.tasks.length === 0 && !b && /* @__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" }) })
|
|
169
|
-
]
|
|
170
|
-
}
|
|
171
|
-
),
|
|
172
|
-
b ? /* @__PURE__ */ r("div", { className: "border-t border-border-subtle p-ds-03", children: [
|
|
173
|
-
/* @__PURE__ */ e(
|
|
174
|
-
k,
|
|
175
|
-
{
|
|
176
|
-
ref: x,
|
|
177
|
-
value: i,
|
|
178
|
-
onChange: (t) => o(t.target.value),
|
|
179
|
-
onKeyDown: O,
|
|
180
|
-
onBlur: () => {
|
|
181
|
-
i.trim() || a(!1);
|
|
182
|
-
},
|
|
183
|
-
placeholder: "Task title...",
|
|
184
|
-
className: "h-ds-sm text-ds-md",
|
|
185
|
-
autoFocus: !0
|
|
186
|
-
}
|
|
187
|
-
),
|
|
188
|
-
/* @__PURE__ */ r("div", { className: "mt-ds-02b flex items-center gap-ds-02", children: [
|
|
189
|
-
/* @__PURE__ */ e(
|
|
190
|
-
m,
|
|
191
|
-
{
|
|
192
|
-
size: "sm",
|
|
193
|
-
className: "h-ds-xs-plus bg-interactive hover:bg-interactive-hover text-text-on-color text-ds-sm",
|
|
194
|
-
onClick: y,
|
|
195
|
-
disabled: !i.trim(),
|
|
196
|
-
children: "Add"
|
|
197
|
-
}
|
|
198
|
-
),
|
|
199
|
-
/* @__PURE__ */ e(
|
|
200
|
-
m,
|
|
201
|
-
{
|
|
202
|
-
variant: "ghost",
|
|
203
|
-
size: "sm",
|
|
204
|
-
className: "h-ds-xs-plus text-ds-sm",
|
|
205
|
-
onClick: () => {
|
|
206
|
-
o(""), a(!1);
|
|
207
|
-
},
|
|
208
|
-
children: "Cancel"
|
|
209
|
-
}
|
|
210
|
-
)
|
|
211
|
-
] })
|
|
212
|
-
] }) : /* @__PURE__ */ r(
|
|
213
|
-
"button",
|
|
214
|
-
{
|
|
215
|
-
onClick: () => {
|
|
216
|
-
a(!0), setTimeout(() => {
|
|
217
|
-
var t;
|
|
218
|
-
return (t = x.current) == null ? void 0 : t.focus();
|
|
219
|
-
}, 50);
|
|
220
|
-
},
|
|
221
|
-
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",
|
|
222
|
-
children: [
|
|
223
|
-
/* @__PURE__ */ e(I, { className: "h-3 w-3" }),
|
|
224
|
-
"Add task"
|
|
225
|
-
]
|
|
226
|
-
}
|
|
227
|
-
)
|
|
228
|
-
]
|
|
229
|
-
}
|
|
230
|
-
);
|
|
231
|
-
}
|
|
232
|
-
);
|
|
233
|
-
Z.displayName = "BoardColumn";
|
|
234
|
-
export {
|
|
235
|
-
Z as BoardColumn
|
|
236
|
-
};
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs as C, jsx as p } from "react/jsx-runtime";
|
|
3
|
-
import * as Y from "react";
|
|
4
|
-
import { useState as D, useRef as Z, useEffect as O, useMemo as _, useCallback as g } from "react";
|
|
5
|
-
import { useComposedRef as V } from "../utils/use-composed-ref.js";
|
|
6
|
-
import { createPortal as T } from "react-dom";
|
|
7
|
-
import { useSensors as M, useSensor as B, PointerSensor as tt, TouchSensor as et, KeyboardSensor as rt, DndContext as nt, closestCorners as st, DragOverlay as ot } from "@dnd-kit/core";
|
|
8
|
-
import { sortableKeyboardCoordinates as it, SortableContext as at, horizontalListSortingStrategy as dt } from "@dnd-kit/sortable";
|
|
9
|
-
import { BoardColumn as ct } from "./board-column.js";
|
|
10
|
-
import { TaskCardOverlay as lt } from "./task-card.js";
|
|
11
|
-
import { IconPlus as ut } from "@tabler/icons-react";
|
|
12
|
-
import { Button as ft } from "@devalok/shilp-sutra/ui/button";
|
|
13
|
-
function mt() {
|
|
14
|
-
return {
|
|
15
|
-
onDragStart({ active: h }) {
|
|
16
|
-
const c = h.data.current;
|
|
17
|
-
return (c == null ? void 0 : c.type) === "task" ? `Picked up task: ${c.task.title}` : "Picked up item";
|
|
18
|
-
},
|
|
19
|
-
onDragOver({ active: h, over: c }) {
|
|
20
|
-
if (!c) return;
|
|
21
|
-
const a = h.data.current;
|
|
22
|
-
if ((a == null ? void 0 : a.type) === "task")
|
|
23
|
-
return `Task ${a.task.title} is over ${c.id}`;
|
|
24
|
-
},
|
|
25
|
-
onDragEnd({ active: h, over: c }) {
|
|
26
|
-
if (!c) return "Dropped item";
|
|
27
|
-
const a = h.data.current;
|
|
28
|
-
return (a == null ? void 0 : a.type) === "task" ? `Dropped task: ${a.task.title}` : "Dropped item";
|
|
29
|
-
},
|
|
30
|
-
onDragCancel() {
|
|
31
|
-
return "Dragging cancelled";
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
const pt = Y.forwardRef(
|
|
36
|
-
function({
|
|
37
|
-
initialData: c,
|
|
38
|
-
onTaskMove: a,
|
|
39
|
-
onTaskAdd: b,
|
|
40
|
-
onColumnRename: I,
|
|
41
|
-
onColumnDelete: y,
|
|
42
|
-
onColumnToggleVisibility: S,
|
|
43
|
-
onClickTask: K,
|
|
44
|
-
onAddColumn: P
|
|
45
|
-
}, $) {
|
|
46
|
-
const [E, v] = D(c), [w, N] = D(null), [R, j] = D(!1), A = Z(null), W = V(A, $);
|
|
47
|
-
O(() => {
|
|
48
|
-
v(c);
|
|
49
|
-
}, [c]), O(() => {
|
|
50
|
-
j(!0);
|
|
51
|
-
}, []);
|
|
52
|
-
const z = M(
|
|
53
|
-
B(tt, {
|
|
54
|
-
activationConstraint: {
|
|
55
|
-
distance: 5
|
|
56
|
-
}
|
|
57
|
-
}),
|
|
58
|
-
B(et, {
|
|
59
|
-
activationConstraint: {
|
|
60
|
-
delay: 200,
|
|
61
|
-
tolerance: 5
|
|
62
|
-
}
|
|
63
|
-
}),
|
|
64
|
-
B(rt, {
|
|
65
|
-
coordinateGetter: it
|
|
66
|
-
})
|
|
67
|
-
), G = _(() => mt(), []), m = E.columns, L = m.map((t) => `column-${t.id}`), k = g(
|
|
68
|
-
(t) => {
|
|
69
|
-
for (const e of m)
|
|
70
|
-
if (e.tasks.some((i) => i.id === t))
|
|
71
|
-
return e.id;
|
|
72
|
-
return null;
|
|
73
|
-
},
|
|
74
|
-
[m]
|
|
75
|
-
), x = g(
|
|
76
|
-
(t, e, i, o) => {
|
|
77
|
-
v((l) => {
|
|
78
|
-
const u = l.columns.map((d) => ({
|
|
79
|
-
...d,
|
|
80
|
-
tasks: [...d.tasks]
|
|
81
|
-
})), n = u.find((d) => d.id === e), f = u.find((d) => d.id === i);
|
|
82
|
-
if (!n || !f) return l;
|
|
83
|
-
const r = n.tasks.findIndex((d) => d.id === t);
|
|
84
|
-
if (r === -1) return l;
|
|
85
|
-
const [s] = n.tasks.splice(r, 1);
|
|
86
|
-
return f.tasks.splice(o, 0, s), { columns: u };
|
|
87
|
-
});
|
|
88
|
-
},
|
|
89
|
-
[]
|
|
90
|
-
), q = g((t) => {
|
|
91
|
-
const e = t.active.data.current;
|
|
92
|
-
(e == null ? void 0 : e.type) === "task" && N(e.task);
|
|
93
|
-
}, []), F = g(
|
|
94
|
-
(t) => {
|
|
95
|
-
const { active: e, over: i } = t;
|
|
96
|
-
if (!i) return;
|
|
97
|
-
const o = e.id, l = i.id, u = k(o);
|
|
98
|
-
if (!u) return;
|
|
99
|
-
let n = null, f = 0;
|
|
100
|
-
if (l.startsWith("column-")) {
|
|
101
|
-
n = l.replace("column-", "");
|
|
102
|
-
const r = m.find((s) => s.id === n);
|
|
103
|
-
f = (r == null ? void 0 : r.tasks.length) ?? 0;
|
|
104
|
-
} else if (n = k(l), n) {
|
|
105
|
-
const r = m.find((s) => s.id === n);
|
|
106
|
-
f = (r == null ? void 0 : r.tasks.findIndex((s) => s.id === l)) ?? 0;
|
|
107
|
-
}
|
|
108
|
-
!n || u === n || x(o, u, n, f);
|
|
109
|
-
},
|
|
110
|
-
[m, k, x]
|
|
111
|
-
), H = g(
|
|
112
|
-
(t) => {
|
|
113
|
-
const { active: e, over: i } = t;
|
|
114
|
-
if (N(null), !i) return;
|
|
115
|
-
const o = e.id, l = i.id, u = k(o);
|
|
116
|
-
if (!u) return;
|
|
117
|
-
let n, f;
|
|
118
|
-
if (l.startsWith("column-")) {
|
|
119
|
-
n = l.replace("column-", "");
|
|
120
|
-
const r = m.find((s) => s.id === n);
|
|
121
|
-
if (f = (r == null ? void 0 : r.tasks.length) ?? 0, u === n) {
|
|
122
|
-
const s = r == null ? void 0 : r.tasks.findIndex((d) => d.id === o);
|
|
123
|
-
s !== void 0 && s >= 0 && (f = s);
|
|
124
|
-
}
|
|
125
|
-
} else {
|
|
126
|
-
n = k(l) ?? u;
|
|
127
|
-
const r = m.find((s) => s.id === n);
|
|
128
|
-
f = (r == null ? void 0 : r.tasks.findIndex((s) => s.id === l)) ?? 0;
|
|
129
|
-
}
|
|
130
|
-
if (u === n) {
|
|
131
|
-
const r = m.find((d) => d.id === n), s = r == null ? void 0 : r.tasks.findIndex((d) => d.id === o);
|
|
132
|
-
s !== void 0 && s !== f && x(o, u, n, f);
|
|
133
|
-
}
|
|
134
|
-
a == null || a(o, n, f);
|
|
135
|
-
},
|
|
136
|
-
[m, k, x, a]
|
|
137
|
-
), J = (t, e) => {
|
|
138
|
-
b == null || b(t, e);
|
|
139
|
-
}, Q = (t, e) => {
|
|
140
|
-
v((i) => ({
|
|
141
|
-
columns: i.columns.map(
|
|
142
|
-
(o) => o.id === t ? { ...o, name: e } : o
|
|
143
|
-
)
|
|
144
|
-
})), I == null || I(t, e);
|
|
145
|
-
}, U = (t) => {
|
|
146
|
-
v((e) => ({
|
|
147
|
-
columns: e.columns.filter((i) => i.id !== t)
|
|
148
|
-
})), y == null || y(t);
|
|
149
|
-
}, X = (t, e) => {
|
|
150
|
-
v((i) => ({
|
|
151
|
-
columns: i.columns.map(
|
|
152
|
-
(o) => o.id === t ? { ...o, isClientVisible: e } : o
|
|
153
|
-
)
|
|
154
|
-
})), S == null || S(t, e);
|
|
155
|
-
};
|
|
156
|
-
return /* @__PURE__ */ C(
|
|
157
|
-
nt,
|
|
158
|
-
{
|
|
159
|
-
sensors: z,
|
|
160
|
-
collisionDetection: st,
|
|
161
|
-
onDragStart: q,
|
|
162
|
-
onDragOver: F,
|
|
163
|
-
onDragEnd: H,
|
|
164
|
-
accessibility: { announcements: G },
|
|
165
|
-
children: [
|
|
166
|
-
/* @__PURE__ */ C(
|
|
167
|
-
"div",
|
|
168
|
-
{
|
|
169
|
-
ref: W,
|
|
170
|
-
className: "no-scrollbar flex h-full gap-ds-05 overflow-x-auto pb-ds-05",
|
|
171
|
-
children: [
|
|
172
|
-
/* @__PURE__ */ p(
|
|
173
|
-
at,
|
|
174
|
-
{
|
|
175
|
-
items: L,
|
|
176
|
-
strategy: dt,
|
|
177
|
-
children: m.map((t, e) => /* @__PURE__ */ p("div", { className: "group flex-shrink-0", children: /* @__PURE__ */ p(
|
|
178
|
-
ct,
|
|
179
|
-
{
|
|
180
|
-
column: t,
|
|
181
|
-
index: e,
|
|
182
|
-
onAddTask: J,
|
|
183
|
-
onClickTask: K,
|
|
184
|
-
onRenameColumn: Q,
|
|
185
|
-
onDeleteColumn: U,
|
|
186
|
-
onToggleVisibility: X
|
|
187
|
-
}
|
|
188
|
-
) }, t.id))
|
|
189
|
-
}
|
|
190
|
-
),
|
|
191
|
-
/* @__PURE__ */ p("div", { className: "flex-shrink-0", children: /* @__PURE__ */ C(
|
|
192
|
-
ft,
|
|
193
|
-
{
|
|
194
|
-
variant: "ghost",
|
|
195
|
-
onClick: P,
|
|
196
|
-
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",
|
|
197
|
-
children: [
|
|
198
|
-
/* @__PURE__ */ p(ut, { className: "h-ico-sm w-ico-sm" }),
|
|
199
|
-
"Add column"
|
|
200
|
-
]
|
|
201
|
-
}
|
|
202
|
-
) })
|
|
203
|
-
]
|
|
204
|
-
}
|
|
205
|
-
),
|
|
206
|
-
R && T(
|
|
207
|
-
/* @__PURE__ */ p(ot, { dropAnimation: null, children: w ? /* @__PURE__ */ p(lt, { task: w }) : null }),
|
|
208
|
-
document.body
|
|
209
|
-
)
|
|
210
|
-
]
|
|
211
|
-
}
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
);
|
|
215
|
-
pt.displayName = "KanbanBoard";
|
|
216
|
-
export {
|
|
217
|
-
pt as KanbanBoard
|
|
218
|
-
};
|