@devalok/shilp-sutra-karm 0.8.2 → 0.10.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 (98) 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 +1984 -0
  4. package/dist/_chunks/project-card.js +121 -0
  5. package/dist/_chunks/render-adjustment-type.js +3596 -0
  6. package/dist/_chunks/task-detail-panel.js +1319 -0
  7. package/dist/_chunks/use-composed-ref.js +12 -0
  8. package/dist/_chunks/vendor.js +11491 -0
  9. package/dist/admin/index.js +37 -60
  10. package/dist/board/board-column.d.ts +2 -13
  11. package/dist/board/board-column.d.ts.map +1 -1
  12. package/dist/board/board-constants.d.ts +17 -0
  13. package/dist/board/board-constants.d.ts.map +1 -0
  14. package/dist/board/board-context.d.ts +65 -0
  15. package/dist/board/board-context.d.ts.map +1 -0
  16. package/dist/board/board-toolbar.d.ts +5 -0
  17. package/dist/board/board-toolbar.d.ts.map +1 -0
  18. package/dist/board/board-types.d.ts +48 -0
  19. package/dist/board/board-types.d.ts.map +1 -0
  20. package/dist/board/bulk-action-bar.d.ts +5 -0
  21. package/dist/board/bulk-action-bar.d.ts.map +1 -0
  22. package/dist/board/column-empty.d.ts +14 -0
  23. package/dist/board/column-empty.d.ts.map +1 -0
  24. package/dist/board/column-header.d.ts +10 -0
  25. package/dist/board/column-header.d.ts.map +1 -0
  26. package/dist/board/index.d.ts +13 -3
  27. package/dist/board/index.d.ts.map +1 -1
  28. package/dist/board/index.js +20 -7
  29. package/dist/board/kanban-board.d.ts +4 -13
  30. package/dist/board/kanban-board.d.ts.map +1 -1
  31. package/dist/board/task-card.d.ts +11 -16
  32. package/dist/board/task-card.d.ts.map +1 -1
  33. package/dist/board/task-context-menu.d.ts +10 -0
  34. package/dist/board/task-context-menu.d.ts.map +1 -0
  35. package/dist/board/use-board-filters.d.ts +3 -0
  36. package/dist/board/use-board-filters.d.ts.map +1 -0
  37. package/dist/board/use-board-keyboard.d.ts +14 -0
  38. package/dist/board/use-board-keyboard.d.ts.map +1 -0
  39. package/dist/chat/index.js +6 -10
  40. package/dist/client/index.js +4 -6
  41. package/dist/dashboard/index.js +3 -4
  42. package/dist/index.d.ts +1 -1
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +200 -104
  45. package/dist/tasks/index.js +8 -14
  46. package/package.json +78 -80
  47. package/dist/admin/adjustments/approved-adjustments.js +0 -43
  48. package/dist/admin/break/break-admin-skeleton.js +0 -59
  49. package/dist/admin/break/break-admin.js +0 -373
  50. package/dist/admin/break/break-balance.js +0 -42
  51. package/dist/admin/break/breaks.js +0 -91
  52. package/dist/admin/break/delete-break.js +0 -55
  53. package/dist/admin/break/edit-break-balance.js +0 -113
  54. package/dist/admin/break/edit-break.js +0 -453
  55. package/dist/admin/break/header.js +0 -231
  56. package/dist/admin/break/leave-request.js +0 -162
  57. package/dist/admin/break/use-break-date-picker.js +0 -43
  58. package/dist/admin/dashboard/admin-dashboard.js +0 -337
  59. package/dist/admin/dashboard/associate-detail.js +0 -259
  60. package/dist/admin/dashboard/attendance-overview.js +0 -136
  61. package/dist/admin/dashboard/break-request.js +0 -176
  62. package/dist/admin/dashboard/calendar.js +0 -141
  63. package/dist/admin/dashboard/correction-list.js +0 -102
  64. package/dist/admin/dashboard/dashboard-header.js +0 -155
  65. package/dist/admin/dashboard/dashboard-skeleton.js +0 -109
  66. package/dist/admin/dashboard/leave-requests.js +0 -201
  67. package/dist/admin/dashboard/render-date.js +0 -144
  68. package/dist/admin/dashboard/use-calendar-navigation.js +0 -169
  69. package/dist/admin/dashboard/use-leave-request-interaction.js +0 -34
  70. package/dist/admin/utils/date-range-utils.js +0 -37
  71. package/dist/admin/utils/date-utils.js +0 -119
  72. package/dist/admin/utils/emoji-utils.js +0 -17
  73. package/dist/admin/utils/render-adjustment-type.js +0 -20
  74. package/dist/admin/utils/render-status.js +0 -22
  75. package/dist/board/board-column.js +0 -236
  76. package/dist/board/kanban-board.js +0 -218
  77. package/dist/board/task-card.js +0 -168
  78. package/dist/chat/chat-input.js +0 -54
  79. package/dist/chat/chat-panel.js +0 -151
  80. package/dist/chat/conversation-list.js +0 -99
  81. package/dist/chat/markdown-components.js +0 -35
  82. package/dist/chat/message-list.js +0 -59
  83. package/dist/chat/streaming-text.js +0 -17
  84. package/dist/client/accent-provider.js +0 -22
  85. package/dist/client/client-portal-header.js +0 -48
  86. package/dist/client/project-card.js +0 -60
  87. package/dist/dashboard/attendance-cta.js +0 -115
  88. package/dist/dashboard/daily-brief.js +0 -68
  89. package/dist/page-skeletons.js +0 -130
  90. package/dist/tasks/activity-tab.js +0 -185
  91. package/dist/tasks/conversation-tab.js +0 -138
  92. package/dist/tasks/files-tab.js +0 -186
  93. package/dist/tasks/review-tab.js +0 -170
  94. package/dist/tasks/subtasks-tab.js +0 -154
  95. package/dist/tasks/task-constants.js +0 -22
  96. package/dist/tasks/task-detail-panel.js +0 -210
  97. package/dist/tasks/task-properties.js +0 -324
  98. package/dist/utils/use-composed-ref.js +0 -12
@@ -1,453 +0,0 @@
1
- "use client";
2
- import { jsxs as n, jsx as s } from "react/jsx-runtime";
3
- import * as X from "react";
4
- import { useState as g, useRef as Z, useEffect as j } from "react";
5
- import { IconPencil as $, IconArrowRight as v, IconChevronLeft as L, IconChevronRight as tt, IconChevronDown as et } from "@tabler/icons-react";
6
- import { useToast as rt } from "@devalok/shilp-sutra/hooks/use-toast";
7
- import { Dialog as at, DialogTrigger as st, DialogContent as nt, DialogHeader as ot, DialogDescription as dt } from "@devalok/shilp-sutra/ui/dialog";
8
- import { Button as q } from "@devalok/shilp-sutra/ui/button";
9
- import { DeleteBreak as it } from "./delete-break.js";
10
- import { removeAllEmojis as lt } from "../utils/emoji-utils.js";
11
- import { cn as f } from "@devalok/shilp-sutra/ui/lib/utils";
12
- import { isBreakDay as Y, checkDateOverlap as B, isDateAfter as ct, isDateSameOrAfter as ut, isDateInRange as mt } from "../utils/date-range-utils.js";
13
- import { isSameDay as S } from "../utils/date-utils.js";
14
- import { useBreakDatePicker as ft } from "./use-break-date-picker.js";
15
- import { format as D, endOfMonth as Dt, getDay as J, subDays as pt, getDaysInMonth as xt, addDays as ht } from "date-fns";
16
- const bt = X.forwardRef(function({
17
- selectedLeave: r,
18
- existingBreaks: p,
19
- onFetchMonthBreaks: y,
20
- onSave: C,
21
- onDelete: V
22
- }, yt) {
23
- var T;
24
- const [w, k] = g(!1), [x, M] = g(
25
- p || []
26
- ), [F, I] = g(!1), [o, u] = g({
27
- status: (r == null ? void 0 : r.status) || "",
28
- comment: (r == null ? void 0 : r.adminComment) || "",
29
- startDate: (r == null ? void 0 : r.startDate) || "",
30
- endDate: (r == null ? void 0 : r.endDate) || ""
31
- }), e = ft(), P = Z(null), { toast: m } = rt();
32
- j(() => {
33
- if (r) {
34
- const t = (a) => a ? D(new Date(a), "yyyy-MM-dd") : "";
35
- u({
36
- status: (r == null ? void 0 : r.status) || "",
37
- comment: (r == null ? void 0 : r.adminComment) || "",
38
- startDate: t(r == null ? void 0 : r.startDate),
39
- endDate: t(r == null ? void 0 : r.endDate)
40
- }), e.setSelectedStartDate(t(r == null ? void 0 : r.startDate)), e.setSelectedEndDate(t(r == null ? void 0 : r.endDate));
41
- }
42
- }, [r]), j(() => {
43
- if (p) {
44
- M(p);
45
- return;
46
- }
47
- y && y(e.currentMonth, e.currentYear).then((t) => {
48
- t && M(
49
- t.map((a) => ({
50
- ...a,
51
- startDate: new Date(a.startDate).toISOString(),
52
- endDate: new Date(a.endDate).toISOString()
53
- }))
54
- );
55
- }).catch((t) => {
56
- console.error("Error fetching breaks:", t);
57
- });
58
- }, [e.currentMonth, e.currentYear, p, y]);
59
- const U = (t) => {
60
- const { name: a, value: i } = t.target;
61
- u((d) => ({
62
- ...d,
63
- [a]: i
64
- }));
65
- }, h = (t) => {
66
- u((a) => ({
67
- ...a,
68
- status: t
69
- })), k(!1);
70
- }, R = (t) => {
71
- if (e.setActiveDate(t), t === "start" && o.startDate) {
72
- const a = new Date(o.startDate);
73
- e.setCurrentMonth(a.getMonth()), e.setCurrentYear(a.getFullYear());
74
- } else if (t === "end" && o.endDate) {
75
- const a = new Date(o.endDate);
76
- e.setCurrentMonth(a.getMonth()), e.setCurrentYear(a.getFullYear());
77
- }
78
- e.setShowCalendar(!0);
79
- }, W = async (t) => {
80
- if (t.preventDefault(), o.status === "PENDING") {
81
- m({
82
- title: "Action Required",
83
- description: "Please update the status",
84
- color: "neutral"
85
- });
86
- return;
87
- }
88
- I(!0);
89
- try {
90
- C && C({
91
- requestId: r.id,
92
- userId: r.userId,
93
- status: o.status,
94
- adminComment: o.comment,
95
- startDate: new Date(o.startDate).toISOString(),
96
- endDate: new Date(o.endDate).toISOString(),
97
- isEditing: !0
98
- }), m({
99
- description: "Break request updated successfully",
100
- color: "neutral"
101
- });
102
- } catch (a) {
103
- console.error("Error updating break request:", a), m({
104
- title: "Error",
105
- description: "Failed to update break request",
106
- color: "error"
107
- });
108
- } finally {
109
- I(!1);
110
- }
111
- }, E = (t) => {
112
- const a = {
113
- APPROVED: {
114
- text: "Approved",
115
- className: "bg-success-surface text-text-success"
116
- },
117
- PENDING: {
118
- text: "Pending",
119
- className: "bg-warning-surface text-text-warning"
120
- },
121
- REJECTED: {
122
- text: "Deny",
123
- className: "bg-error-surface text-text-error"
124
- },
125
- CANCELLED: {
126
- text: "Redacted",
127
- className: "bg-error-surface text-text-error"
128
- }
129
- }, { text: i, className: d } = a[t] || a.REJECTED;
130
- return /* @__PURE__ */ s(
131
- "div",
132
- {
133
- className: f("text-ds-sm w-fit rounded-ds-2xl px-ds-02b py-ds-02 capitalize", d),
134
- children: i
135
- }
136
- );
137
- }, O = (t) => t ? D(new Date(t), "EEEE, MMMM d") : "", G = (t, a) => {
138
- const i = [], d = new Date(a, t, 1), A = Dt(d), K = J(d), _ = 6 - J(A), N = /* @__PURE__ */ new Date();
139
- for (let l = K - 1; l >= 0; l--) {
140
- const c = pt(d, l + 1);
141
- i.push({
142
- date: c.getDate(),
143
- fullDate: D(c, "yyyy-MM-dd"),
144
- isPadding: !0,
145
- isToday: S(c, N),
146
- isWeekend: !1
147
- });
148
- }
149
- const Q = xt(d);
150
- for (let l = 1; l <= Q; l++) {
151
- const c = new Date(a, t, l);
152
- i.push({
153
- date: l,
154
- fullDate: D(c, "yyyy-MM-dd"),
155
- isPadding: !1,
156
- isToday: S(c, N),
157
- isWeekend: !1
158
- });
159
- }
160
- for (let l = 1; l <= _; l++) {
161
- const c = ht(A, l);
162
- i.push({
163
- date: c.getDate(),
164
- fullDate: D(c, "yyyy-MM-dd"),
165
- isPadding: !0,
166
- isToday: S(c, N),
167
- isWeekend: !1
168
- });
169
- }
170
- return i;
171
- }, z = (t) => {
172
- if (Y(t.fullDate, x, r.id)) {
173
- m({
174
- title: "Error",
175
- description: "This date is already part of another break request.",
176
- color: "error"
177
- });
178
- return;
179
- }
180
- if (!t.isPadding) {
181
- if (e.activeDate === "start") {
182
- const a = t.fullDate, i = e.selectedEndDate || a;
183
- if (B(a, i, x, r.id)) {
184
- m({
185
- title: "Error",
186
- description: "The selected date range overlaps with an existing break request.",
187
- color: "error"
188
- });
189
- return;
190
- }
191
- e.setSelectedStartDate(a), u((d) => ({
192
- ...d,
193
- startDate: a
194
- })), e.selectedEndDate && ct(a, e.selectedEndDate) && (e.setSelectedEndDate(a), u((d) => ({
195
- ...d,
196
- endDate: a
197
- })));
198
- } else if (e.activeDate === "end") {
199
- const a = t.fullDate, i = e.selectedStartDate || a;
200
- if (B(i, a, x, r.id)) {
201
- m({
202
- title: "Error",
203
- description: "The selected date range overlaps with an existing break request.",
204
- color: "error"
205
- });
206
- return;
207
- }
208
- e.selectedStartDate && ut(a, e.selectedStartDate) ? (e.setSelectedEndDate(a), u((d) => ({
209
- ...d,
210
- endDate: a
211
- }))) : e.selectedStartDate || (e.setSelectedStartDate(a), e.setSelectedEndDate(a), u((d) => ({
212
- ...d,
213
- startDate: a,
214
- endDate: a
215
- })));
216
- }
217
- e.setShowCalendar(!1);
218
- }
219
- }, b = (t) => !e.selectedStartDate || !e.selectedEndDate ? !!(e.showCalendar && (e.activeDate === "start" && o.startDate === t || e.activeDate === "end" && o.endDate === t)) : mt(t, e.selectedStartDate, e.selectedEndDate), H = G(e.currentMonth, e.currentYear);
220
- return /* @__PURE__ */ n(at, { children: [
221
- /* @__PURE__ */ s(st, { asChild: !0, children: /* @__PURE__ */ n(
222
- q,
223
- {
224
- variant: "outline",
225
- className: "text-ds-base border-border bg-layer-01 px-ds-05 py-ds-04 pr-ds-06 text-text-secondary shadow-02",
226
- children: [
227
- /* @__PURE__ */ s($, {}),
228
- /* @__PURE__ */ s("span", { children: "Edit" })
229
- ]
230
- }
231
- ) }),
232
- /* @__PURE__ */ s(nt, { className: "w-[440px] p-ds-06 max-md:w-[90%] max-md:rounded-ds-lg", children: /* @__PURE__ */ s(ot, { children: /* @__PURE__ */ s(dt, { children: /* @__PURE__ */ n("div", { className: "flex w-full flex-col items-center gap-ds-05", children: [
233
- /* @__PURE__ */ n("p", { className: "text-ds-md w-full text-left text-text-tertiary", children: [
234
- "Edit break details of",
235
- " ",
236
- /* @__PURE__ */ s("span", { className: "font-semibold text-interactive", children: (T = r == null ? void 0 : r.user) == null ? void 0 : T.name })
237
- ] }),
238
- /* @__PURE__ */ n(
239
- "form",
240
- {
241
- ref: P,
242
- onSubmit: W,
243
- id: "updateleaveform",
244
- className: "flex w-full flex-col gap-ds-05",
245
- children: [
246
- /* @__PURE__ */ n("div", { className: "flex w-full flex-col gap-ds-02 rounded-ds-lg border border-border-subtle px-ds-05 pb-ds-03 pt-ds-04", children: [
247
- /* @__PURE__ */ s("h2", { className: "text-ds-xs font-semibold uppercase tracking-wider text-text-placeholder", children: "Reason" }),
248
- /* @__PURE__ */ s("p", { className: "text-ds-md text-text-primary", children: lt(r == null ? void 0 : r.reason) })
249
- ] }),
250
- /* @__PURE__ */ n("div", { className: "flex w-full items-center justify-center gap-ds-02", children: [
251
- /* @__PURE__ */ s(
252
- "button",
253
- {
254
- type: "button",
255
- onClick: () => R("start"),
256
- className: f(
257
- "text-ds-md flex w-full items-center justify-center gap-ds-03 rounded-ds-full border bg-layer-02 px-ds-03 py-ds-03 text-text-secondary max-md:text-ds-sm",
258
- e.showCalendar && e.activeDate === "start" ? "border-border-strong" : "border-border"
259
- ),
260
- children: O(o.startDate)
261
- }
262
- ),
263
- /* @__PURE__ */ s("div", { className: "flex h-ico-sm w-ico-sm items-center", children: /* @__PURE__ */ s(v, { className: "h-ico-sm w-ico-sm text-icon-secondary" }) }),
264
- /* @__PURE__ */ s(
265
- "button",
266
- {
267
- type: "button",
268
- onClick: () => R("end"),
269
- className: f(
270
- "text-ds-md flex w-full items-center justify-center gap-ds-03 rounded-ds-full border bg-layer-02 px-ds-03 py-ds-03 text-text-secondary max-md:text-ds-sm",
271
- e.showCalendar && e.activeDate === "end" ? "border-border-strong" : "border-border"
272
- ),
273
- children: O(o.endDate)
274
- }
275
- )
276
- ] }),
277
- e.showCalendar && /* @__PURE__ */ n("div", { className: "", children: [
278
- /* @__PURE__ */ n("div", { className: "flex items-center justify-between", children: [
279
- /* @__PURE__ */ s(
280
- "button",
281
- {
282
- type: "button",
283
- className: "rounded-ds-full p-ds-03 hover:bg-field-hover",
284
- onClick: () => e.navigateMonth("prev"),
285
- children: /* @__PURE__ */ s(L, { className: "h-ico-md w-ico-md" })
286
- }
287
- ),
288
- /* @__PURE__ */ n("div", { className: "text-ds-md font-semibold uppercase", children: [
289
- new Date(e.currentYear, e.currentMonth).toLocaleString(
290
- "default",
291
- {
292
- month: "long"
293
- }
294
- ),
295
- " ",
296
- e.currentYear
297
- ] }),
298
- /* @__PURE__ */ s(
299
- "button",
300
- {
301
- type: "button",
302
- className: "rounded-ds-full p-ds-03 hover:bg-field-hover",
303
- onClick: () => e.navigateMonth("next"),
304
- children: /* @__PURE__ */ s(tt, { className: "h-ico-md w-ico-md" })
305
- }
306
- )
307
- ] }),
308
- /* @__PURE__ */ n("div", { className: "calendar grid w-full grid-cols-7 items-center gap-0 overflow-hidden", children: [
309
- ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"].map(
310
- (t) => /* @__PURE__ */ s("div", { className: "pb-ds-03 pt-ds-05 text-center", children: /* @__PURE__ */ s("span", { className: "text-ds-sm font-semibold uppercase tracking-wider text-text-tertiary", children: t }) }, t)
311
- ),
312
- H.map((t, a) => /* @__PURE__ */ s(
313
- "button",
314
- {
315
- type: "button",
316
- tabIndex: t.isPadding ? -1 : 0,
317
- "aria-label": t.isPadding ? void 0 : D(new Date(t.fullDate), "MMMM d, yyyy"),
318
- className: f(
319
- "flex cursor-pointer flex-col items-center pb-0 pt-0 text-center",
320
- b(t.fullDate) && t.fullDate !== e.selectedStartDate && t.fullDate !== e.selectedEndDate && "bg-layer-accent-subtle",
321
- t.isPadding && "opacity-[0.5]",
322
- t.fullDate === e.selectedStartDate && b(t.fullDate) && "start-date mini",
323
- t.fullDate === e.selectedEndDate && b(t.fullDate) && "end-date mini",
324
- b(t.fullDate) && t.fullDate !== e.selectedStartDate && t.fullDate !== e.selectedEndDate && "in-range-date",
325
- e.selectedStartDate === e.selectedEndDate && "same-date"
326
- ),
327
- onClick: () => z(t),
328
- children: /* @__PURE__ */ s(
329
- "div",
330
- {
331
- className: f(
332
- "mx-ds-02 my-ds-02",
333
- t.isPadding && "opacity-[0.5]"
334
- ),
335
- children: /* @__PURE__ */ s(
336
- "span",
337
- {
338
- className: f(
339
- "text-ds-base flex h-ds-md w-ds-md items-center justify-center rounded-ds-full",
340
- (t.fullDate === e.selectedStartDate || t.fullDate === e.selectedEndDate || Y(t.fullDate, x, r.id)) && "bg-accent ring-2 ring-inset ring-accent",
341
- t.isToday ? "bg-interactive-hover p-ds-03 text-text-on-color" : "text-text-secondary"
342
- ),
343
- children: t.date
344
- }
345
- )
346
- }
347
- )
348
- },
349
- a
350
- ))
351
- ] })
352
- ] }),
353
- /* @__PURE__ */ n("div", { className: "flex w-full items-center justify-between rounded-ds-lg border border-border px-ds-05 py-ds-04", children: [
354
- /* @__PURE__ */ s("p", { className: "text-ds-xs font-semibold uppercase tracking-wider text-text-placeholder", children: "No of Days" }),
355
- /* @__PURE__ */ s("p", { className: "text-ds-xl font-semibold text-text-primary", children: r.numberOfDays })
356
- ] }),
357
- /* @__PURE__ */ n("div", { className: "flex w-full items-center justify-between rounded-ds-lg border border-border px-ds-05 py-ds-04", children: [
358
- /* @__PURE__ */ s("p", { className: "text-ds-xs font-semibold uppercase tracking-wider text-text-placeholder", children: "Status" }),
359
- /* @__PURE__ */ n("div", { className: "relative flex items-center gap-ds-02", children: [
360
- /* @__PURE__ */ n(
361
- "button",
362
- {
363
- type: "button",
364
- className: "flex cursor-pointer items-center gap-ds-02",
365
- "aria-label": "Change status",
366
- "aria-haspopup": "listbox",
367
- "aria-expanded": w,
368
- onClick: () => k(!w),
369
- children: [
370
- E(o.status),
371
- /* @__PURE__ */ s(et, {})
372
- ]
373
- }
374
- ),
375
- w && /* @__PURE__ */ n("div", { className: "text-ds-base absolute left-[10px] top-[25px] z-raised flex flex-col overflow-hidden rounded-ds-md border border-border bg-layer-01 shadow-02", role: "listbox", children: [
376
- /* @__PURE__ */ s(
377
- "div",
378
- {
379
- className: "cursor-pointer border-b border-b-border bg-layer-01 px-ds-04 py-ds-03 text-left",
380
- role: "option",
381
- tabIndex: 0,
382
- "aria-selected": o.status === "APPROVED",
383
- onClick: () => h("APPROVED"),
384
- onKeyDown: (t) => {
385
- (t.key === "Enter" || t.key === " ") && (t.preventDefault(), h("APPROVED"));
386
- },
387
- children: E("APPROVED")
388
- }
389
- ),
390
- /* @__PURE__ */ s(
391
- "div",
392
- {
393
- className: "cursor-pointer bg-layer-01 px-ds-04 py-ds-03 text-left",
394
- role: "option",
395
- tabIndex: 0,
396
- "aria-selected": o.status === "REJECTED",
397
- onClick: () => h("REJECTED"),
398
- onKeyDown: (t) => {
399
- (t.key === "Enter" || t.key === " ") && (t.preventDefault(), h("REJECTED"));
400
- },
401
- children: E("REJECTED")
402
- }
403
- )
404
- ] })
405
- ] })
406
- ] }),
407
- /* @__PURE__ */ n("div", { className: "flex w-full flex-col gap-ds-02 rounded-ds-lg border border-border-subtle px-ds-05 pb-ds-03 pt-ds-04", children: [
408
- /* @__PURE__ */ s("h2", { className: "text-ds-xs font-semibold uppercase tracking-wider text-text-placeholder", children: "Comment" }),
409
- /* @__PURE__ */ s(
410
- "input",
411
- {
412
- type: "text",
413
- name: "comment",
414
- className: "text-ds-md text-text-primary outline-none",
415
- placeholder: "Enjoy your break, TC",
416
- value: o.comment,
417
- onChange: U
418
- }
419
- )
420
- ] }),
421
- /* @__PURE__ */ n("div", { className: "flex w-full justify-between", children: [
422
- /* @__PURE__ */ s("div", { className: "flex h-ds-md w-ds-md items-center justify-center", children: /* @__PURE__ */ s(
423
- it,
424
- {
425
- id: r.id,
426
- userId: r.userId,
427
- onDelete: V
428
- }
429
- ) }),
430
- /* @__PURE__ */ s(
431
- q,
432
- {
433
- className: "w-fit",
434
- variant: "outline",
435
- disabled: F,
436
- onClick: () => {
437
- var t;
438
- return (t = P.current) == null ? void 0 : t.requestSubmit();
439
- },
440
- children: "Update"
441
- }
442
- )
443
- ] })
444
- ]
445
- }
446
- )
447
- ] }) }) }) })
448
- ] });
449
- });
450
- bt.displayName = "EditBreak";
451
- export {
452
- bt as EditBreak
453
- };
@@ -1,231 +0,0 @@
1
- "use client";
2
- import { jsxs as a, jsx as e, Fragment as M } from "react/jsx-runtime";
3
- import * as C from "react";
4
- import { Fragment as F } from "react";
5
- import { DropdownMenu as m, DropdownMenuTrigger as o, DropdownMenuContent as x, DropdownMenuItem as h } from "@devalok/shilp-sutra/ui/dropdown-menu";
6
- import { Button as j } from "@devalok/shilp-sutra/ui/button";
7
- import { IconButton as l } from "@devalok/shilp-sutra/ui/icon-button";
8
- import { IconX as u, IconUser as D, IconChevronDown as p, IconCalendar as Y, IconCalendarEvent as I, IconChevronLeft as N, IconChevronRight as f } from "@tabler/icons-react";
9
- const b = [
10
- { id: 1, name: "January" },
11
- { id: 2, name: "February" },
12
- { id: 3, name: "March" },
13
- { id: 4, name: "April" },
14
- { id: 5, name: "May" },
15
- { id: 6, name: "June" },
16
- { id: 7, name: "July" },
17
- { id: 8, name: "August" },
18
- { id: 9, name: "September" },
19
- { id: 10, name: "October" },
20
- { id: 11, name: "November" },
21
- { id: 12, name: "December" }
22
- ], S = C.forwardRef(
23
- function({
24
- filters: s,
25
- onFilterChange: w,
26
- breakBalance: n,
27
- userImages: c,
28
- users: r
29
- }, y) {
30
- const d = (t) => {
31
- w(t(s));
32
- }, g = () => {
33
- d((t) => ({
34
- ...t,
35
- currMonth: t.currMonth === 0 ? 11 : t.currMonth - 1
36
- }));
37
- }, v = () => {
38
- d((t) => ({
39
- ...t,
40
- currMonth: t.currMonth === 11 ? 0 : t.currMonth + 1
41
- }));
42
- }, A = () => {
43
- d((t) => ({
44
- ...t,
45
- dateFilterStart: new Date(t.currYear, t.currMonth, 1),
46
- dateFilterEnd: new Date(t.currYear, t.currMonth + 1, 0),
47
- isOpen: !1
48
- }));
49
- };
50
- return /* @__PURE__ */ a("div", { ref: y, className: "flex min-w-[800px] items-center justify-between bg-field px-ds-06 py-ds-05b max-md:justify-start max-md:gap-ds-05b max-lg:min-w-[100%]", children: [
51
- /* @__PURE__ */ e("div", { className: "flex flex-col gap-ds-05", children: s.selectedAssociate && /* @__PURE__ */ a(M, { children: [
52
- /* @__PURE__ */ e("p", { className: "text-ds-sm font-semibold uppercase tracking-wider text-text-tertiary", children: "Break Balance" }),
53
- /* @__PURE__ */ a("div", { className: "flex items-end", children: [
54
- /* @__PURE__ */ e("p", { className: "text-ds-5xl font-semibold mr-ds-02 text-interactive", children: (n == null ? void 0 : n.remainingDays) || 0 }),
55
- /* @__PURE__ */ a("p", { className: "text-ds-2xl translate-y-[-5px] text-text-placeholder", children: [
56
- "/ ",
57
- (n == null ? void 0 : n.breakBalance) || 0
58
- ] })
59
- ] })
60
- ] }) }),
61
- /* @__PURE__ */ a("header", { className: "flex items-center gap-ds-04", children: [
62
- s.selectedAssociate ? /* @__PURE__ */ a("div", { className: "text-ds-md flex flex-row items-center justify-start gap-ds-02 rounded-ds-md bg-interactive p-ds-02b text-text-on-color", children: [
63
- /* @__PURE__ */ a("div", { className: "flex items-center justify-start gap-ds-01", children: [
64
- c[s.selectedAssociate.id] ? /* @__PURE__ */ e(
65
- "img",
66
- {
67
- src: c[s.selectedAssociate.id],
68
- alt: `${s.selectedAssociate.name}'s avatar`,
69
- className: "h-ico-md w-ico-md rounded-ds-full"
70
- }
71
- ) : /* @__PURE__ */ e("div", { className: "flex h-ico-md w-ico-md items-center justify-center rounded-ds-full bg-layer-02", children: /* @__PURE__ */ e("span", { className: "text-interactive", children: s.selectedAssociate.name.charAt(0) }) }),
72
- /* @__PURE__ */ e("span", { className: "text-ds-md mx-ds-01 text-text-on-color", children: s.selectedAssociate.name })
73
- ] }),
74
- /* @__PURE__ */ e(
75
- "button",
76
- {
77
- "aria-label": "Clear filter",
78
- onClick: () => d((t) => ({
79
- ...t,
80
- selectedAssociate: null
81
- })),
82
- className: "border-0 p-0",
83
- children: /* @__PURE__ */ e(u, { className: "h-ico-sm w-ico-sm text-text-on-color" })
84
- }
85
- )
86
- ] }) : /* @__PURE__ */ a(m, { children: [
87
- /* @__PURE__ */ a(o, { className: "text-ds-md flex flex-row items-center justify-between rounded-ds-md border border-border-subtle bg-layer-01 px-ds-03 py-ds-02b", children: [
88
- /* @__PURE__ */ a("div", { className: "flex items-center", children: [
89
- /* @__PURE__ */ e(D, { className: "h-ico-sm w-ico-sm" }),
90
- /* @__PURE__ */ e("span", { className: "text-ds-md mx-ds-03 text-text-secondary max-lg:mx-0 max-lg:text-ds-sm", children: "Associate" })
91
- ] }),
92
- /* @__PURE__ */ e(p, { className: "h-ico-sm w-ico-sm" })
93
- ] }),
94
- /* @__PURE__ */ e(x, { className: "custom-scrollbar max-h-[400px] w-64 overflow-y-auto p-ds-03", children: (r == null ? void 0 : r.length) === 0 ? /* @__PURE__ */ e(h, { disabled: !0, children: "No users available" }) : r == null ? void 0 : r.map((t) => /* @__PURE__ */ e(F, { children: /* @__PURE__ */ a(
95
- h,
96
- {
97
- onSelect: () => d((i) => ({
98
- ...i,
99
- selectedAssociate: t
100
- })),
101
- className: "flex items-center gap-ds-03 p-ds-03",
102
- children: [
103
- c[t.id] ? /* @__PURE__ */ e(
104
- "img",
105
- {
106
- src: c[t.id],
107
- alt: `${t.name}'s avatar`,
108
- className: "h-ds-xs w-ds-xs rounded-ds-full"
109
- }
110
- ) : /* @__PURE__ */ e("div", { className: "flex h-ds-xs w-ds-xs items-center justify-center rounded-ds-full bg-layer-03", children: /* @__PURE__ */ e("span", { className: "text-ds-md text-interactive", children: t.name.charAt(0) }) }),
111
- /* @__PURE__ */ e("span", { className: "text-ds-md text-text-secondary", children: t.name })
112
- ]
113
- },
114
- t.id
115
- ) }, t.id)) })
116
- ] }),
117
- s.dateFilterEnd && /* @__PURE__ */ a("div", { className: "text-ds-md flex items-center justify-between rounded-ds-md bg-interactive px-ds-03 py-ds-02b text-text-on-color", children: [
118
- /* @__PURE__ */ a("div", { className: "flex items-center", children: [
119
- /* @__PURE__ */ e(Y, {}),
120
- /* @__PURE__ */ a("span", { className: "ml-ds-01 mr-ds-02", children: [
121
- b[new Date(s.dateFilterStart).getMonth()].name,
122
- ","
123
- ] }),
124
- /* @__PURE__ */ e("span", { className: "mr-ds-02", children: new Date(s.dateFilterStart).getFullYear() })
125
- ] }),
126
- /* @__PURE__ */ e(
127
- "button",
128
- {
129
- "aria-label": "Clear filter",
130
- onClick: () => {
131
- d((t) => ({
132
- ...t,
133
- dateFilterStart: null,
134
- dateFilterEnd: null
135
- }));
136
- },
137
- className: "border-0 bg-transparent p-0",
138
- children: /* @__PURE__ */ e(u, { className: "h-ico-sm w-ico-sm" })
139
- }
140
- )
141
- ] }),
142
- /* @__PURE__ */ a(
143
- m,
144
- {
145
- open: s.isOpen,
146
- onOpenChange: (t) => {
147
- d((i) => ({ ...i, isOpen: t }));
148
- },
149
- children: [
150
- /* @__PURE__ */ a(o, { className: "text-ds-md flex items-center justify-between rounded-ds-md border border-border-subtle bg-layer-01 p-ds-02b", children: [
151
- /* @__PURE__ */ a("div", { className: "flex items-center", children: [
152
- /* @__PURE__ */ e(I, {}),
153
- /* @__PURE__ */ e("span", { className: "mx-ds-03 text-text-secondary", children: "Date" })
154
- ] }),
155
- /* @__PURE__ */ e(p, { className: "h-ico-sm w-ico-sm" })
156
- ] }),
157
- /* @__PURE__ */ e(x, { className: "mr-32 p-ds-04", children: /* @__PURE__ */ a("div", { className: "flex w-[140px] flex-col items-center justify-start", children: [
158
- /* @__PURE__ */ a("div", { className: "flex w-full items-center justify-between", children: [
159
- /* @__PURE__ */ e(
160
- l,
161
- {
162
- size: "sm",
163
- icon: /* @__PURE__ */ e(N, {}),
164
- "aria-label": "Previous month",
165
- onClick: g
166
- }
167
- ),
168
- /* @__PURE__ */ e("span", { className: "text-ds-md text-text-secondary", children: b[s.currMonth].name }),
169
- /* @__PURE__ */ e(
170
- l,
171
- {
172
- size: "sm",
173
- icon: /* @__PURE__ */ e(f, {}),
174
- "aria-label": "Next month",
175
- onClick: v
176
- }
177
- )
178
- ] }),
179
- /* @__PURE__ */ a("div", { className: "mt-ds-04 flex w-full items-center justify-between", children: [
180
- /* @__PURE__ */ e(
181
- l,
182
- {
183
- size: "sm",
184
- icon: /* @__PURE__ */ e(N, {}),
185
- "aria-label": "Previous year",
186
- onClick: () => {
187
- d((t) => ({
188
- ...t,
189
- currYear: t.currYear - 1
190
- }));
191
- }
192
- }
193
- ),
194
- /* @__PURE__ */ e("span", { className: "text-ds-md text-text-secondary", children: s.currYear }),
195
- /* @__PURE__ */ e(
196
- l,
197
- {
198
- size: "sm",
199
- icon: /* @__PURE__ */ e(f, {}),
200
- "aria-label": "Next year",
201
- onClick: () => {
202
- d((t) => ({
203
- ...t,
204
- currYear: t.currYear + 1
205
- }));
206
- }
207
- }
208
- )
209
- ] }),
210
- /* @__PURE__ */ e(
211
- j,
212
- {
213
- className: "mt-ds-05",
214
- variant: "outline",
215
- fullWidth: !0,
216
- onClick: A,
217
- children: "Filter"
218
- }
219
- )
220
- ] }) })
221
- ]
222
- }
223
- )
224
- ] })
225
- ] });
226
- }
227
- );
228
- S.displayName = "BreakAdminHeader";
229
- export {
230
- S as BreakAdminHeader
231
- };