@devalok/shilp-sutra-karm 0.8.1 → 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 +9 -4
  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
@@ -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
- };
@@ -1,168 +0,0 @@
1
- "use client";
2
- import { jsx as r, jsxs as n } from "react/jsx-runtime";
3
- import * as c from "react";
4
- import { useComposedRef as x } from "../utils/use-composed-ref.js";
5
- import { useSortable as g } from "@dnd-kit/sortable";
6
- import { CSS as v } from "@dnd-kit/utilities";
7
- import { cva as y } from "class-variance-authority";
8
- import { cn as d } from "@devalok/shilp-sutra/ui/lib/utils";
9
- import { Badge as N } from "@devalok/shilp-sutra/ui";
10
- import { AvatarGroup as w } from "@devalok/shilp-sutra/composed/avatar-group";
11
- import { IconGripVertical as D, IconCalendar as R } from "@tabler/icons-react";
12
- import { PRIORITY_LABELS as I, PRIORITY_DOT_COLORS as O } from "../tasks/task-constants.js";
13
- function S(e) {
14
- const a = new Date(e), s = /* @__PURE__ */ new Date(), o = a.getTime() - s.getTime(), t = Math.ceil(o / (1e3 * 60 * 60 * 24));
15
- return t < 0 ? { label: "Overdue", className: "text-text-error" } : t === 0 ? { label: "Today", className: "text-text-warning" } : t === 1 ? { label: "Tomorrow", className: "text-text-warning" } : {
16
- label: a.toLocaleDateString("en-IN", { month: "short", day: "numeric" }),
17
- className: "text-text-tertiary"
18
- };
19
- }
20
- const T = y(
21
- "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",
22
- {
23
- variants: {
24
- state: {
25
- default: "",
26
- dragging: "opacity-[0.38]",
27
- overlay: "rotate-[2deg] shadow-03 border-border-interactive/60 ring-1 ring-interactive/40"
28
- },
29
- blocked: {
30
- true: "border-l-2 border-l-error",
31
- false: ""
32
- }
33
- },
34
- defaultVariants: {
35
- state: "default",
36
- blocked: !1
37
- }
38
- }
39
- );
40
- function m({
41
- task: e,
42
- isDragging: a,
43
- isDragOverlay: s,
44
- dragHandleProps: o,
45
- onClickTask: t
46
- }) {
47
- const l = e.dueDate ? S(e.dueDate) : null;
48
- return /* @__PURE__ */ n(
49
- "div",
50
- {
51
- role: "button",
52
- tabIndex: 0,
53
- className: T({
54
- state: s ? "overlay" : a ? "dragging" : "default",
55
- blocked: e.isBlocked
56
- }),
57
- onClick: () => t == null ? void 0 : t(e.id),
58
- onKeyDown: (i) => {
59
- (i.key === "Enter" || i.key === " ") && (i.preventDefault(), t == null || t(e.id));
60
- },
61
- children: [
62
- /* @__PURE__ */ n("div", { className: "flex items-start gap-ds-02b", children: [
63
- /* @__PURE__ */ r(
64
- "button",
65
- {
66
- className: d(
67
- "mt-ds-01 flex-shrink-0 cursor-grab rounded p-ds-01 opacity-0 transition-opacity",
68
- "group-hover/card:opacity-[0.38] hover:!opacity-100",
69
- "active:cursor-grabbing",
70
- s && "opacity-[0.38]"
71
- ),
72
- ...(o == null ? void 0 : o.attributes) ?? {},
73
- ...(o == null ? void 0 : o.listeners) ?? {},
74
- "aria-label": `Drag handle for task: ${e.title}`,
75
- "aria-roledescription": "sortable",
76
- onClick: (i) => i.stopPropagation(),
77
- children: /* @__PURE__ */ r(D, { className: "h-ico-sm w-ico-sm text-icon-secondary" })
78
- }
79
- ),
80
- /* @__PURE__ */ r("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ r("p", { className: "text-ds-md font-medium text-text-primary line-clamp-2", children: e.title }) })
81
- ] }),
82
- /* @__PURE__ */ n("div", { className: "mt-ds-03 flex items-center gap-ds-03", children: [
83
- /* @__PURE__ */ r(
84
- "div",
85
- {
86
- className: d(
87
- "h-2 w-2 rounded-ds-full flex-shrink-0",
88
- O[e.priority]
89
- ),
90
- title: I[e.priority]
91
- }
92
- ),
93
- e.labels.length > 0 && /* @__PURE__ */ n("div", { className: "flex items-center gap-ds-02 overflow-hidden", children: [
94
- e.labels.slice(0, 2).map((i) => /* @__PURE__ */ r(N, { size: "sm", className: "max-w-[80px] truncate", children: i }, i)),
95
- e.labels.length > 2 && /* @__PURE__ */ n("span", { className: "text-ds-xs text-text-tertiary", children: [
96
- "+",
97
- e.labels.length - 2
98
- ] })
99
- ] }),
100
- /* @__PURE__ */ r("div", { className: "flex-1" }),
101
- l && /* @__PURE__ */ n(
102
- "div",
103
- {
104
- className: d(
105
- "flex items-center gap-ds-01 text-ds-xs leading-tight",
106
- l.className
107
- ),
108
- children: [
109
- /* @__PURE__ */ r(R, { className: "h-2.5 w-2.5" }),
110
- /* @__PURE__ */ r("span", { children: l.label })
111
- ]
112
- }
113
- ),
114
- e.assignees.length > 0 && /* @__PURE__ */ r(
115
- w,
116
- {
117
- users: e.assignees,
118
- size: "sm",
119
- max: 2,
120
- showTooltip: !1
121
- }
122
- )
123
- ] })
124
- ]
125
- }
126
- );
127
- }
128
- const C = c.forwardRef(
129
- function({ task: a, onClickTask: s }, o) {
130
- const {
131
- attributes: t,
132
- listeners: l,
133
- setNodeRef: i,
134
- transform: f,
135
- transition: u,
136
- isDragging: p
137
- } = g({
138
- id: a.id,
139
- data: {
140
- type: "task",
141
- task: a
142
- }
143
- }), h = x(i, o), b = {
144
- transform: v.Transform.toString(f),
145
- transition: u
146
- };
147
- return /* @__PURE__ */ r("div", { ref: h, style: b, children: /* @__PURE__ */ r(
148
- m,
149
- {
150
- task: a,
151
- isDragging: p,
152
- dragHandleProps: { attributes: t, listeners: l },
153
- onClickTask: s
154
- }
155
- ) });
156
- }
157
- );
158
- C.displayName = "TaskCard";
159
- const L = c.forwardRef(
160
- function({ task: a }, s) {
161
- return /* @__PURE__ */ r("div", { ref: s, children: /* @__PURE__ */ r(m, { task: a, isDragOverlay: !0 }) });
162
- }
163
- );
164
- L.displayName = "TaskCardOverlay";
165
- export {
166
- C as TaskCard,
167
- L as TaskCardOverlay
168
- };
@@ -1,54 +0,0 @@
1
- "use client";
2
- import { jsxs as c, jsx as t } from "react/jsx-runtime";
3
- import * as b from "react";
4
- import { useState as y, useRef as g, useCallback as n } from "react";
5
- import { IconSquare as N, IconSend as w } from "@tabler/icons-react";
6
- import { Button as m } from "@devalok/shilp-sutra/ui/button";
7
- const k = b.forwardRef(
8
- function({
9
- onSubmit: l,
10
- onCancel: h,
11
- isStreaming: s = !1,
12
- placeholder: p = "Ask Karm AI...",
13
- disclaimer: d = "AI responses may be inaccurate. Verify important information."
14
- }, u) {
15
- const [r, i] = y(""), a = g(null), f = n(() => {
16
- const e = a.current;
17
- e && (e.style.height = "auto", e.style.height = Math.min(e.scrollHeight, 160) + "px");
18
- }, []), o = n(() => {
19
- const e = r.trim();
20
- !e || s || (i(""), a.current && (a.current.style.height = "auto"), l(e));
21
- }, [r, s, l]), x = n(
22
- (e) => {
23
- e.key === "Enter" && !e.shiftKey && (e.preventDefault(), o());
24
- },
25
- [o]
26
- );
27
- return /* @__PURE__ */ c("div", { ref: u, className: "border-t border-border bg-layer-01 p-ds-04", children: [
28
- /* @__PURE__ */ c("div", { className: "flex items-end gap-ds-03 rounded-ds-xl border border-border bg-field px-ds-04 py-ds-03", children: [
29
- /* @__PURE__ */ t(
30
- "textarea",
31
- {
32
- ref: a,
33
- value: r,
34
- onChange: (e) => {
35
- i(e.target.value), f();
36
- },
37
- onKeyDown: x,
38
- placeholder: p,
39
- "aria-label": "Type a message",
40
- disabled: s,
41
- rows: 1,
42
- className: "text-ds-md no-scrollbar max-h-[160px] min-h-ds-xs flex-1 resize-none bg-transparent text-text-primary placeholder:text-text-placeholder focus:outline-none disabled:opacity-[0.38]"
43
- }
44
- ),
45
- s ? /* @__PURE__ */ t(m, { variant: "solid", color: "error", size: "icon-sm", className: "h-ds-sm w-ds-sm shrink-0 rounded-ds-lg", onClick: h, "aria-label": "Stop generating", children: /* @__PURE__ */ t(N, { className: "h-ico-sm w-ico-sm" }) }) : /* @__PURE__ */ t(m, { size: "icon-sm", className: "h-ds-sm w-ds-sm shrink-0 rounded-ds-lg", onClick: o, disabled: !r.trim(), "aria-label": "Send message", children: /* @__PURE__ */ t(w, { className: "h-ico-sm w-ico-sm" }) })
46
- ] }),
47
- d && /* @__PURE__ */ t("p", { className: "text-ds-sm mt-ds-02b text-center text-text-placeholder", children: d })
48
- ] });
49
- }
50
- );
51
- k.displayName = "ChatInput";
52
- export {
53
- k as ChatInput
54
- };
@@ -1,151 +0,0 @@
1
- "use client";
2
- import { jsx as e, jsxs as d, Fragment as M } from "react/jsx-runtime";
3
- import * as P from "react";
4
- import { useState as T } from "react";
5
- import { Sheet as j, SheetContent as I, SheetTitle as C } from "@devalok/shilp-sutra/ui/sheet";
6
- import { MessageList as H } from "./message-list.js";
7
- import { ChatInput as L } from "./chat-input.js";
8
- import { ConversationList as E } from "./conversation-list.js";
9
- import { cn as F } from "@devalok/shilp-sutra/ui/lib/utils";
10
- import { IconChevronDown as G, IconMessagePlus as R, IconHistory as K, IconX as U } from "@tabler/icons-react";
11
- import { DropdownMenu as V, DropdownMenuTrigger as X, DropdownMenuContent as _, DropdownMenuItem as q } from "@devalok/shilp-sutra/ui";
12
- const z = [
13
- { id: "devadoot", name: "Devadoot", desc: "General Assistant" },
14
- { id: "prahari", name: "Prahari", desc: "Attendance & Time" },
15
- { id: "sutradhar", name: "Sutradhar", desc: "Tasks & Projects" },
16
- { id: "sahayak", name: "Sahayak", desc: "Team Helper" },
17
- { id: "vidwan", name: "Vidwan", desc: "Knowledge Expert" },
18
- { id: "sanchalak", name: "Sanchalak", desc: "Manager Advisor" },
19
- { id: "dwar-palak", name: "Dwar-Palak", desc: "Access Control" }
20
- ], A = P.forwardRef(
21
- function({
22
- isOpen: p,
23
- onOpenChange: m,
24
- messages: x,
25
- conversations: f,
26
- agents: i = z,
27
- selectedAgentId: n = "devadoot",
28
- activeConversationId: b,
29
- isStreaming: h = !1,
30
- streamingText: u = "",
31
- isLoadingMessages: y = !1,
32
- isLoadingConversations: w = !1,
33
- onSendMessage: N,
34
- onCancelStream: v,
35
- onSelectAgent: o,
36
- onStartNewChat: a,
37
- onSelectConversation: c,
38
- onArchiveConversation: k,
39
- onDeleteConversation: D
40
- }, g) {
41
- const [t, l] = T(!1), r = i.find((s) => s.id === n) ?? i[0];
42
- return /* @__PURE__ */ e(j, { open: p, onOpenChange: m, children: /* @__PURE__ */ d(
43
- I,
44
- {
45
- ref: g,
46
- side: "right",
47
- className: "flex w-full flex-col gap-0 border-l border-border bg-layer-01 p-0 sm:max-w-[480px] [&>button]:hidden",
48
- children: [
49
- /* @__PURE__ */ e(C, { className: "sr-only", children: "AI Chat" }),
50
- /* @__PURE__ */ d("div", { className: "flex items-center gap-ds-03 border-b border-border px-ds-05 py-ds-04", children: [
51
- /* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ d(V, { children: [
52
- /* @__PURE__ */ e(X, { asChild: !0, children: /* @__PURE__ */ d(
53
- "button",
54
- {
55
- className: "flex items-center gap-ds-02b rounded-ds-lg px-ds-03 py-ds-02b transition-colors hover:bg-layer-02",
56
- children: [
57
- /* @__PURE__ */ e("span", { className: "text-ds-base text-text-primary", children: r == null ? void 0 : r.name }),
58
- /* @__PURE__ */ e("span", { className: "text-ds-sm text-text-placeholder", children: r == null ? void 0 : r.desc }),
59
- /* @__PURE__ */ e(G, { className: "h-ico-sm w-ico-sm text-text-placeholder" })
60
- ]
61
- }
62
- ) }),
63
- /* @__PURE__ */ e(_, { align: "start", className: "w-64", children: i.map((s) => /* @__PURE__ */ e(
64
- q,
65
- {
66
- onClick: () => o == null ? void 0 : o(s.id),
67
- className: n === s.id ? "bg-layer-02" : "",
68
- children: /* @__PURE__ */ d("div", { className: "flex flex-col", children: [
69
- /* @__PURE__ */ e("span", { className: "text-ds-md text-text-primary", children: s.name }),
70
- /* @__PURE__ */ e("span", { className: "text-ds-sm text-text-placeholder", children: s.desc })
71
- ] })
72
- },
73
- s.id
74
- )) })
75
- ] }) }),
76
- /* @__PURE__ */ e(
77
- "button",
78
- {
79
- onClick: () => {
80
- a == null || a(), l(!1);
81
- },
82
- className: "flex h-ds-sm w-ds-sm items-center justify-center rounded-ds-lg text-text-secondary transition-colors hover:bg-layer-02",
83
- "aria-label": "New chat",
84
- children: /* @__PURE__ */ e(R, { className: "h-ico-sm w-ico-sm" })
85
- }
86
- ),
87
- /* @__PURE__ */ e(
88
- "button",
89
- {
90
- onClick: () => l(!t),
91
- className: F(
92
- "flex h-ds-sm w-ds-sm items-center justify-center rounded-ds-lg transition-colors hover:bg-layer-02",
93
- t ? "bg-layer-02 text-text-primary" : "text-text-secondary"
94
- ),
95
- "aria-label": "Conversation history",
96
- children: /* @__PURE__ */ e(K, { className: "h-ico-sm w-ico-sm" })
97
- }
98
- ),
99
- /* @__PURE__ */ e(
100
- "button",
101
- {
102
- onClick: () => m(!1),
103
- className: "flex h-ds-sm w-ds-sm items-center justify-center rounded-ds-lg text-text-secondary transition-colors hover:bg-layer-02",
104
- "aria-label": "Close chat",
105
- children: /* @__PURE__ */ e(U, { className: "h-ico-sm w-ico-sm" })
106
- }
107
- )
108
- ] }),
109
- t ? /* @__PURE__ */ e(
110
- E,
111
- {
112
- conversations: f,
113
- activeConversationId: b,
114
- isLoading: w,
115
- onSelect: (s) => {
116
- c == null || c(s), l(!1);
117
- },
118
- onNewChat: () => {
119
- a == null || a(), l(!1);
120
- },
121
- onArchive: k,
122
- onDelete: D
123
- }
124
- ) : /* @__PURE__ */ d(M, { children: [
125
- /* @__PURE__ */ e(
126
- H,
127
- {
128
- messages: x,
129
- isStreaming: h,
130
- streamingText: u,
131
- isLoadingMessages: y
132
- }
133
- ),
134
- /* @__PURE__ */ e(
135
- L,
136
- {
137
- onSubmit: N,
138
- onCancel: v,
139
- isStreaming: h
140
- }
141
- )
142
- ] })
143
- ]
144
- }
145
- ) });
146
- }
147
- );
148
- A.displayName = "ChatPanel";
149
- export {
150
- A as ChatPanel
151
- };
@@ -1,99 +0,0 @@
1
- "use client";
2
- import { jsxs as s, jsx as e } from "react/jsx-runtime";
3
- import * as x from "react";
4
- import { IconMessagePlus as h, IconMessage as p, IconArchive as u, IconTrash as b } from "@tabler/icons-react";
5
- import { cn as y } from "@devalok/shilp-sutra/ui/lib/utils";
6
- function N(d) {
7
- const o = new Date(d), l = (/* @__PURE__ */ new Date()).getTime() - o.getTime(), r = Math.floor(l / 6e4);
8
- if (r < 1) return "Just now";
9
- if (r < 60) return `${r}m ago`;
10
- const a = Math.floor(r / 60);
11
- if (a < 24) return `${a}h ago`;
12
- const i = Math.floor(a / 24);
13
- return i < 7 ? `${i}d ago` : o.toLocaleDateString("en-IN", {
14
- day: "numeric",
15
- month: "short"
16
- });
17
- }
18
- const g = x.forwardRef(
19
- function({
20
- conversations: o,
21
- activeConversationId: c,
22
- isLoading: l = !1,
23
- onSelect: r,
24
- onNewChat: a,
25
- onArchive: i,
26
- onDelete: m
27
- }, f) {
28
- return /* @__PURE__ */ s("div", { ref: f, className: "flex flex-1 flex-col overflow-hidden", children: [
29
- /* @__PURE__ */ s("div", { className: "flex items-center justify-between border-b border-border px-ds-05 py-ds-04", children: [
30
- /* @__PURE__ */ e("h3", { className: "text-ds-md font-semibold text-text-primary", children: "Conversations" }),
31
- /* @__PURE__ */ s(
32
- "button",
33
- {
34
- onClick: a,
35
- className: "flex items-center gap-ds-02b rounded-ds-lg px-ds-03 py-ds-02b text-text-secondary transition-colors hover:bg-layer-02",
36
- children: [
37
- /* @__PURE__ */ e(h, { className: "h-ico-sm w-ico-sm" }),
38
- /* @__PURE__ */ e("span", { className: "text-ds-sm", children: "New Chat" })
39
- ]
40
- }
41
- )
42
- ] }),
43
- /* @__PURE__ */ e("div", { className: "no-scrollbar flex-1 overflow-y-auto", children: l ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ e("div", { className: "h-ico-md w-ico-md animate-spin rounded-ds-full border-2 border-text-secondary border-t-transparent" }) }) : o.length === 0 ? /* @__PURE__ */ s("div", { className: "flex flex-col items-center justify-center gap-ds-03 py-12", children: [
44
- /* @__PURE__ */ e(p, { className: "h-ds-sm w-ds-sm text-text-placeholder" }),
45
- /* @__PURE__ */ e("p", { className: "text-ds-md text-text-placeholder", children: "No conversations yet" })
46
- ] }) : /* @__PURE__ */ e("div", { className: "flex flex-col", children: o.map((t) => /* @__PURE__ */ s(
47
- "div",
48
- {
49
- className: y(
50
- "group flex items-center gap-ds-04 border-b border-border-subtle px-ds-05 py-ds-04 transition-colors hover:bg-layer-02",
51
- c === t.id && "bg-layer-02"
52
- ),
53
- children: [
54
- /* @__PURE__ */ s(
55
- "button",
56
- {
57
- onClick: () => r(t.id),
58
- className: "flex min-w-0 flex-1 flex-col gap-ds-01 text-left",
59
- children: [
60
- /* @__PURE__ */ e("p", { className: "text-ds-md truncate text-text-primary", children: t.title || "Untitled conversation" }),
61
- /* @__PURE__ */ e("p", { className: "text-ds-sm text-text-placeholder", children: N(t.updatedAt) })
62
- ]
63
- }
64
- ),
65
- /* @__PURE__ */ s("div", { className: "flex shrink-0 items-center gap-ds-02 opacity-0 transition-opacity group-hover:opacity-100", children: [
66
- i && /* @__PURE__ */ e(
67
- "button",
68
- {
69
- onClick: (n) => {
70
- n.stopPropagation(), i(t.id);
71
- },
72
- className: "flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-ds-md text-text-placeholder transition-colors hover:bg-field hover:text-text-secondary",
73
- "aria-label": "Archive conversation",
74
- children: /* @__PURE__ */ e(u, { className: "h-ico-sm w-ico-sm" })
75
- }
76
- ),
77
- m && /* @__PURE__ */ e(
78
- "button",
79
- {
80
- onClick: (n) => {
81
- n.stopPropagation(), m(t.id);
82
- },
83
- className: "flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-ds-md text-text-placeholder transition-colors hover:bg-error-surface hover:text-text-error",
84
- "aria-label": "Delete conversation",
85
- children: /* @__PURE__ */ e(b, { className: "h-ico-sm w-ico-sm" })
86
- }
87
- )
88
- ] })
89
- ]
90
- },
91
- t.id
92
- )) }) })
93
- ] });
94
- }
95
- );
96
- g.displayName = "ConversationList";
97
- export {
98
- g as ConversationList
99
- };