@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,155 +0,0 @@
1
- "use client";
2
- import { jsxs as d, jsx as e } from "react/jsx-runtime";
3
- import * as C from "react";
4
- import { DropdownMenu as x, DropdownMenuTrigger as h, DropdownMenuContent as f, DropdownMenuItem as o } from "@devalok/shilp-sutra/ui/dropdown-menu";
5
- import { Button as D } from "@devalok/shilp-sutra/ui/button";
6
- import { IconButton as p } from "@devalok/shilp-sutra/ui/icon-button";
7
- import { SegmentedControl as k } from "@devalok/shilp-sutra/ui/segmented-control";
8
- import { cn as b } from "@devalok/shilp-sutra/ui/lib/utils";
9
- import { IconChevronDown as N, IconX as I, IconUser as M, IconChevronLeft as z, IconChevronRight as H } from "@tabler/icons-react";
10
- const R = C.forwardRef(
11
- function({
12
- selectedMonth: m,
13
- yearsList: s,
14
- isTodaySelected: u,
15
- selectedAssociate: a,
16
- users: l,
17
- userImages: n,
18
- activeTimeFrame: w,
19
- onMonthSelection: v,
20
- onTodayClick: y,
21
- onSelectAssociate: i,
22
- onTimeFrameChange: g,
23
- onDateChange: c
24
- }, j) {
25
- return /* @__PURE__ */ d("div", { ref: j, className: "mb-ds-06 flex w-full flex-col items-start justify-between md:flex-row md:items-center", children: [
26
- /* @__PURE__ */ d("div", { className: "flex w-full items-center justify-between gap-ds-05 md:w-auto md:justify-start", children: [
27
- /* @__PURE__ */ d(x, { children: [
28
- /* @__PURE__ */ d(h, { className: "text-ds-xl flex items-center gap-ds-03 text-text-secondary", children: [
29
- m,
30
- /* @__PURE__ */ e(N, {})
31
- ] }),
32
- /* @__PURE__ */ e(f, { className: "custom-scrollbar absolute ml-ds-08 max-h-[300px] overflow-y-auto rounded-ds-md border border-0 border-border p-0 shadow-brand", children: s.map((t, r) => /* @__PURE__ */ e(
33
- o,
34
- {
35
- onSelect: () => {
36
- v(t);
37
- },
38
- className: b("p-0", r !== s.length - 1 ? "border-b border-b-border" : ""),
39
- children: /* @__PURE__ */ e(
40
- "span",
41
- {
42
- className: b("w-full py-ds-04 pl-ds-05 pr-ds-06", m === t ? "text-ds-md font-semibold bg-interactive text-text-on-color" : "text-ds-md text-text-secondary hover:bg-layer-02", r === 0 ? "rounded-t-[7px]" : r === s.length - 1 ? "rounded-b-[7px]" : ""),
43
- children: t.split(" ")[1]
44
- }
45
- )
46
- },
47
- t
48
- )) })
49
- ] }),
50
- !u && /* @__PURE__ */ e(
51
- D,
52
- {
53
- variant: "outline",
54
- onClick: y,
55
- children: "Today"
56
- }
57
- )
58
- ] }),
59
- /* @__PURE__ */ d("div", { className: "flex w-full items-center justify-between gap-ds-05 md:mt-0 md:w-auto md:justify-start max-md:mt-[17px] max-lg:gap-[0.5rem]", children: [
60
- /* @__PURE__ */ e("div", { className: "hidden md:flex", children: a ? /* @__PURE__ */ d("div", { className: "text-ds-md flex items-center justify-start rounded-ds-md bg-interactive px-ds-03 py-ds-02b text-text-on-color", children: [
61
- /* @__PURE__ */ d("div", { className: "flex items-center justify-start gap-0", children: [
62
- n[a.id] ? /* @__PURE__ */ e(
63
- "img",
64
- {
65
- src: n[a.id],
66
- alt: `${a.name}'s avatar`,
67
- className: "h-ico-md w-ico-md rounded-ds-full"
68
- }
69
- ) : /* @__PURE__ */ e("div", { className: "flex h-ico-md w-ico-md flex-shrink-0 items-center justify-center rounded-ds-full bg-layer-03", children: /* @__PURE__ */ e("span", { className: "text-interactive", children: a.name.charAt(0) }) }),
70
- /* @__PURE__ */ e("span", { className: "text-ds-md ml-ds-01 mr-ds-02 text-text-on-color", children: a.name })
71
- ] }),
72
- /* @__PURE__ */ e(
73
- "button",
74
- {
75
- "aria-label": "Clear filter",
76
- onClick: () => i(null),
77
- className: "border-0 bg-transparent p-0",
78
- children: /* @__PURE__ */ e(I, { className: "h-ico-sm w-ico-sm text-text-on-color" })
79
- }
80
- )
81
- ] }) : /* @__PURE__ */ d(x, { children: [
82
- /* @__PURE__ */ d(h, { className: "text-ds-md hidden items-center justify-between rounded-ds-md border border-border-subtle bg-layer-01 px-ds-03 py-ds-02b md:flex", children: [
83
- /* @__PURE__ */ d("div", { className: "flex items-center", children: [
84
- /* @__PURE__ */ e(M, { className: "h-ico-md w-ico-md" }),
85
- /* @__PURE__ */ e("span", { className: "text-ds-md ml-ds-01 mr-ds-02 text-text-secondary max-lg:mx-0 max-lg:text-ds-sm", children: "Associate" })
86
- ] }),
87
- /* @__PURE__ */ e(N, { className: "h-ico-sm w-ico-sm" })
88
- ] }),
89
- /* @__PURE__ */ e(f, { className: "custom-scrollbar max-h-[400px] w-64 overflow-y-auto p-ds-03", children: (l == null ? void 0 : l.length) === 0 ? /* @__PURE__ */ e(o, { disabled: !0, children: "No users available" }) : l == null ? void 0 : l.map((t) => /* @__PURE__ */ d(
90
- o,
91
- {
92
- onSelect: () => {
93
- const r = {
94
- ...t,
95
- createdAt: new Date(t.createdAt)
96
- };
97
- i(r);
98
- },
99
- className: "flex items-center gap-ds-03 p-ds-03",
100
- children: [
101
- n[t.id] ? /* @__PURE__ */ e(
102
- "img",
103
- {
104
- src: n[t.id],
105
- alt: `${t.name}'s avatar`,
106
- className: "h-ds-xs w-ds-xs rounded-ds-full"
107
- }
108
- ) : /* @__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) }) }),
109
- /* @__PURE__ */ e("span", { className: "text-ds-md text-text-secondary", children: t.name })
110
- ]
111
- },
112
- t.id
113
- )) })
114
- ] }) }),
115
- /* @__PURE__ */ e(
116
- k,
117
- {
118
- size: "md",
119
- variant: "tonal",
120
- options: [
121
- { id: "weekly", text: "Weekly" },
122
- { id: "monthly", text: "Monthly" }
123
- ],
124
- selectedId: w,
125
- onSelect: g
126
- }
127
- ),
128
- /* @__PURE__ */ d("div", { className: "flex gap-0", children: [
129
- /* @__PURE__ */ e(
130
- p,
131
- {
132
- icon: /* @__PURE__ */ e(z, {}),
133
- size: "sm",
134
- "aria-label": "Previous",
135
- onClick: () => c("prev")
136
- }
137
- ),
138
- /* @__PURE__ */ e(
139
- p,
140
- {
141
- icon: /* @__PURE__ */ e(H, {}),
142
- size: "sm",
143
- "aria-label": "Next",
144
- onClick: () => c("next")
145
- }
146
- )
147
- ] })
148
- ] })
149
- ] });
150
- }
151
- );
152
- R.displayName = "DashboardHeader";
153
- export {
154
- R as DashboardHeader
155
- };
@@ -1,109 +0,0 @@
1
- "use client";
2
- import { jsx as e, jsxs as d } from "react/jsx-runtime";
3
- import * as o from "react";
4
- import { cn as m } from "@devalok/shilp-sutra/ui/lib/utils";
5
- import { Skeleton as s } from "@devalok/shilp-sutra/ui/skeleton";
6
- import { DropdownMenu as n, DropdownMenuTrigger as c } from "@devalok/shilp-sutra/ui/dropdown-menu";
7
- import { IconButton as t } from "@devalok/shilp-sutra/ui/icon-button";
8
- import { IconChevronDown as x, IconChevronLeft as f, IconChevronRight as p } from "@tabler/icons-react";
9
- const b = o.forwardRef(
10
- function(h, i) {
11
- return /* @__PURE__ */ e("div", { ref: i, className: "flex w-full max-w-layout flex-col items-center justify-center max-md:h-[100%] max-md:justify-start", children: /* @__PURE__ */ d("div", { className: "z-raised flex w-full flex-col items-start justify-start rounded-ds-lg border border-border bg-layer-02 p-ds-05 shadow-05 max-md:flex-1 max-md:min-h-0 max-md:overflow-y-auto max-md:border-0 max-md:px-ds-05 max-md:pb-0 max-md:pt-ds-06", children: [
12
- /* @__PURE__ */ d("div", { className: "mb-ds-06 flex w-full flex-col items-start justify-between md:flex-row md:items-center", children: [
13
- /* @__PURE__ */ e(n, { children: /* @__PURE__ */ d(c, { className: "text-ds-xl flex items-center gap-ds-03 text-text-secondary", "aria-label": "Select period", children: [
14
- /* @__PURE__ */ d("div", { className: "flex items-center gap-ds-03", children: [
15
- /* @__PURE__ */ e(s, { className: "h-[25px] w-[50px] rounded-ds-md bg-field" }),
16
- /* @__PURE__ */ e(s, { className: "h-[25px] w-[50px] rounded-ds-md bg-field" })
17
- ] }),
18
- /* @__PURE__ */ e(x, {})
19
- ] }) }),
20
- /* @__PURE__ */ d("div", { className: "flex w-full items-center justify-between gap-ds-05 md:mt-0 md:w-auto md:justify-start max-md:mt-[17px] max-lg:gap-[0.5rem]", children: [
21
- /* @__PURE__ */ e("div", { className: "hidden md:flex", children: /* @__PURE__ */ e(s, { className: "h-ds-sm w-[180px] rounded-ds-md" }) }),
22
- /* @__PURE__ */ d("div", { className: "flex w-[200px] items-center justify-between overflow-clip rounded-ds-full border border-layer-03", children: [
23
- /* @__PURE__ */ e("div", { className: "flex h-ds-sm w-[100px] items-center justify-center rounded-r-none bg-field", children: /* @__PURE__ */ e(s, { className: "h-[20px] w-[40px] rounded-r-none bg-layer-03" }) }),
24
- /* @__PURE__ */ e("div", { className: "flex h-ds-sm w-[100px] items-center justify-center", children: /* @__PURE__ */ e(s, { className: "h-[20px] w-[40px] bg-layer-03" }) })
25
- ] }),
26
- /* @__PURE__ */ d("div", { className: "flex gap-0", children: [
27
- /* @__PURE__ */ e(t, { icon: /* @__PURE__ */ e(f, {}), size: "sm", "aria-label": "Previous" }),
28
- /* @__PURE__ */ e(
29
- t,
30
- {
31
- icon: /* @__PURE__ */ e(p, {}),
32
- size: "sm",
33
- "aria-label": "Next",
34
- onClick: () => {
35
- }
36
- }
37
- )
38
- ] })
39
- ] })
40
- ] }),
41
- /* @__PURE__ */ e("div", { className: "flex w-full items-center", children: Array.from({ length: 7 }).map((l, r) => /* @__PURE__ */ d(
42
- "div",
43
- {
44
- className: "flex w-full flex-col items-center rounded-t-ds-lg pb-ds-04 pt-ds-05 max-md:rounded-ds-lg",
45
- children: [
46
- /* @__PURE__ */ e(s, { className: "mb-ds-03 h-[10px] w-[10px] rounded-ds-lg bg-field" }),
47
- /* @__PURE__ */ e("div", { className: "mx-ds-02 my-ds-02 flex items-center justify-center", children: /* @__PURE__ */ e(s, { className: "h-ds-md w-ds-md rounded-ds-full bg-field" }) })
48
- ]
49
- },
50
- r
51
- )) }),
52
- /* @__PURE__ */ d("div", { className: "flex w-full flex-col rounded-ds-lg bg-layer-02 md:p-ds-06 max-md:bg-transparent", children: [
53
- /* @__PURE__ */ e("div", { className: "no-scrollbar w-full cursor-grab overflow-x-auto active:cursor-grabbing max-md:pb-ds-05", children: /* @__PURE__ */ e(
54
- "div",
55
- {
56
- className: "flex items-start justify-start gap-ds-04 px-0 pt-ds-03 md:gap-0 md:px-ds-06 min-w-max",
57
- children: Array.from({ length: 3 }).map((l, r) => /* @__PURE__ */ d(
58
- "div",
59
- {
60
- className: m("flex w-full flex-col gap-ds-04 rounded-ds-md bg-layer-02 p-ds-06 md:rounded-ds-lg md:p-ds-05", r !== 2 ? "border-r border-border" : "", "max-md:border-0 max-md:p-ds-05", "min-w-[200px]"),
61
- children: [
62
- /* @__PURE__ */ e(s, { className: "h-[20px] w-[120px] rounded-ds-md bg-field" }),
63
- /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-ds-03", children: Array.from({ length: 4 }).map((w, a) => /* @__PURE__ */ e(
64
- s,
65
- {
66
- className: m("h-ds-md w-ds-md rounded-ds-full bg-field", a > 0 ? "ml-[-5px]" : "")
67
- },
68
- a
69
- )) })
70
- ]
71
- },
72
- r
73
- ))
74
- }
75
- ) }),
76
- /* @__PURE__ */ e("div", { className: "w-full p-0 md:p-ds-06", children: /* @__PURE__ */ d("div", { className: "max-md:pt-[16px] flex flex-col items-start overflow-hidden rounded-ds-lg border-0 border-border-subtle bg-layer-01 shadow-01 pt-ds-03 md:border max-md:pb-0", children: [
77
- /* @__PURE__ */ d("div", { className: "flex w-full items-start border-b-[1px] border-b-border px-ds-06 md:border-b max-md:border-0 max-md:px-0", children: [
78
- /* @__PURE__ */ e("div", { className: "text-ds-sm font-semibold uppercase tracking-wider cursor-pointer border-b-[1.5px] border-b-interactive-hover px-ds-03 py-ds-04 font-semibold text-text-primary", children: "REQUESTS(1)" }),
79
- /* @__PURE__ */ e("div", { className: "text-ds-sm font-semibold uppercase tracking-wider cursor-pointer px-ds-03 py-ds-04 text-text-tertiary", children: "ATTENDANCE CORRECTION(1)" })
80
- ] }),
81
- /* @__PURE__ */ e("div", { className: "flex max-h-[200px] w-full flex-col overflow-y-auto bg-layer-01 px-ds-06 max-md:flex-1 max-md:max-h-none max-md:min-h-[372px] max-md:p-0", children: Array.from({ length: 2 }).map((l, r) => /* @__PURE__ */ d(
82
- "div",
83
- {
84
- className: "flex items-center justify-between px-ds-03 py-ds-04",
85
- children: [
86
- /* @__PURE__ */ d("div", { className: "flex items-center gap-ds-04", children: [
87
- /* @__PURE__ */ e(s, { className: "h-ds-md w-ds-md rounded-ds-full bg-field" }),
88
- /* @__PURE__ */ d("div", { className: "flex flex-col gap-ds-02", children: [
89
- /* @__PURE__ */ e(s, { className: "h-[20px] w-[120px] rounded-ds-md bg-field" }),
90
- /* @__PURE__ */ e(s, { className: "h-[20px] w-[200px] rounded-ds-md bg-field" })
91
- ] })
92
- ] }),
93
- /* @__PURE__ */ d("div", { className: "flex items-center gap-ds-04", children: [
94
- /* @__PURE__ */ e(s, { className: "h-ds-sm w-ds-sm rounded-ds-full bg-field" }),
95
- /* @__PURE__ */ e(s, { className: "h-ds-sm w-ds-sm rounded-ds-full bg-field" })
96
- ] })
97
- ]
98
- },
99
- r
100
- )) })
101
- ] }) })
102
- ] })
103
- ] }) });
104
- }
105
- );
106
- b.displayName = "DashboardSkeleton";
107
- export {
108
- b as DashboardSkeleton
109
- };
@@ -1,201 +0,0 @@
1
- "use client";
2
- import { jsx as a, jsxs as i } from "react/jsx-runtime";
3
- import * as S from "react";
4
- import { useEffect as O } from "react";
5
- import { Tooltip as k, TooltipTrigger as E, TooltipContent as M } from "@devalok/shilp-sutra/ui/tooltip";
6
- import { cn as p } from "@devalok/shilp-sutra/ui/lib/utils";
7
- import { useIsMobile as B } from "@devalok/shilp-sutra/hooks/use-mobile";
8
- import { formatDate as x } from "../utils/date-utils.js";
9
- import { removeAllEmojis as T } from "../utils/emoji-utils.js";
10
- import { isSameDay as I } from "date-fns";
11
- import { useLeaveRequestInteraction as F } from "./use-leave-request-interaction.js";
12
- import { IconX as Y, IconCheck as X, IconSend as _ } from "@tabler/icons-react";
13
- const z = S.forwardRef(
14
- function({
15
- requests: n,
16
- currentUserId: l,
17
- userImages: L = {},
18
- activeTimeFrame: J,
19
- onApproveBreak: c,
20
- onRejectBreak: m
21
- }, P) {
22
- const t = F(), H = B();
23
- O(() => {
24
- const e = (s) => {
25
- (s.ctrlKey || s.metaKey) && (t.setIsCtrlPressed(!0), t.hoveredRequest ? (t.setActiveAction(t.hoverActionTemp), t.setOpenComment(!0), t.setActiveRequest(t.hoveredRequest)) : (t.setOpenComment(!1), t.setActiveAction(null), t.setActiveRequest(null)));
26
- }, d = (s) => {
27
- !s.ctrlKey && !s.metaKey && t.setIsCtrlPressed(!1);
28
- };
29
- return window.addEventListener("keydown", e), window.addEventListener("keyup", d), () => {
30
- window.removeEventListener("keydown", e), window.removeEventListener("keyup", d);
31
- };
32
- }, [t.hoveredRequest, t.isCtrlPressed, t.openComment, t.hoverActionTemp]);
33
- const v = (e, d) => {
34
- t.setHoverActionTemp(d), t.setHoveredRequest(e);
35
- }, f = async (e, d) => {
36
- if (!(!e || !d)) {
37
- t.setIsProcessing(!0), t.setOpenComment(!1);
38
- try {
39
- const s = {
40
- requestId: e.id,
41
- adminComment: t.message,
42
- userId: l
43
- };
44
- d === "approveBreak" ? await (c == null ? void 0 : c(s)) : d === "rejectBreak" && await (m == null ? void 0 : m(s)), t.setActiveRequest(null), t.setActiveAction(null), t.setMessage("");
45
- } catch (s) {
46
- console.error("Error processing break request:", s);
47
- } finally {
48
- t.setIsProcessing(!1);
49
- }
50
- }
51
- }, K = (e) => I(new Date(e.startDate), new Date(e.endDate));
52
- return /* @__PURE__ */ a(
53
- "div",
54
- {
55
- ref: P,
56
- className: "no-scrollbar max-h-[230px] w-full overflow-y-auto px-0 md:px-ds-06 max-md:flex-1 max-md:max-h-none max-md:min-h-[407.2px]",
57
- children: /* @__PURE__ */ a("div", { className: "flex h-full flex-col gap-ds-03 py-ds-03 max-md:h-[max-content] max-md:gap-ds-05 max-md:py-0 max-md:pb-ds-05", children: n == null ? void 0 : n.map((e) => {
58
- var d, s, b, h, u, w, y, g, N, R, A, j, C, D;
59
- return /* @__PURE__ */ i(
60
- "div",
61
- {
62
- className: "flex flex-col justify-start rounded-ds-lg border-b border-border md:gap-ds-05 md:border-b-0 max-md:border-none",
63
- children: [
64
- /* @__PURE__ */ i("div", { className: "flex flex-col justify-between rounded-t-ds-lg border border-border md:flex-row md:border-0 md:px-ds-03 md:py-ds-04 max-md:border-b-0", children: [
65
- /* @__PURE__ */ i("div", { className: "flex items-center gap-ds-04 border-b border-border p-ds-05 md:border-none md:p-0 max-md:items-start", children: [
66
- /* @__PURE__ */ a(
67
- "img",
68
- {
69
- src: L[((d = e.user) == null ? void 0 : d.id) || ""],
70
- className: "h-ds-md w-ds-md overflow-hidden rounded-ds-full bg-interactive-subtle",
71
- alt: ((b = (s = e.user) == null ? void 0 : s.name) == null ? void 0 : b[0]) || "U"
72
- }
73
- ),
74
- /* @__PURE__ */ i("div", { className: "flex max-w-[277px] flex-col items-start gap-ds-02 sm:max-w-none", children: [
75
- /* @__PURE__ */ a("div", { className: "flex flex-row gap-ds-02b", children: /* @__PURE__ */ a("div", { className: "flex items-center gap-ds-03", children: /* @__PURE__ */ a("p", { className: "text-ds-sm text-text-secondary", children: (h = e.user) == null ? void 0 : h.name }) }) }),
76
- K(e) ? /* @__PURE__ */ i("div", { className: "flex w-full flex-col items-center gap-ds-03 md:flex-row md:flex-wrap max-md:items-start", children: [
77
- /* @__PURE__ */ a("p", { className: "text-ds-base font-semibold text-text-primary", children: T(e.reason) }),
78
- /* @__PURE__ */ a("p", { className: "text-ds-base hidden font-semibold text-text-tertiary md:block", children: "•" }),
79
- /* @__PURE__ */ a("p", { className: "text-ds-base text-text-tertiary", children: x(new Date(e.startDate)) })
80
- ] }) : /* @__PURE__ */ i("div", { className: "flex flex-col items-start justify-start gap-ds-03", children: [
81
- /* @__PURE__ */ a("p", { className: "text-ds-base font-semibold text-text-primary", children: T(e.reason) }),
82
- /* @__PURE__ */ i("p", { className: "text-ds-base text-text-tertiary", children: [
83
- x(new Date(e.startDate)),
84
- " to",
85
- " ",
86
- x(new Date(e.endDate)),
87
- /* @__PURE__ */ i("span", { className: "text-interactive-hover", children: [
88
- ", ",
89
- e.numberOfDays,
90
- " days"
91
- ] })
92
- ] })
93
- ] })
94
- ] })
95
- ] }),
96
- /* @__PURE__ */ i("div", { className: "flex h-full w-full items-center justify-between self-stretch sm:w-auto sm:justify-start", children: [
97
- /* @__PURE__ */ a("div", { className: "flex w-1/2 justify-center border-r border-border p-ds-02 md:border-r-0", children: /* @__PURE__ */ i(k, { delayDuration: 0, children: [
98
- /* @__PURE__ */ a(E, { asChild: !0, children: /* @__PURE__ */ a(
99
- "button",
100
- {
101
- "aria-label": "Reject request",
102
- onMouseEnter: () => {
103
- v(e, "rejectBreak");
104
- },
105
- onMouseLeave: () => {
106
- t.setHoverActionTemp(null), t.setHoveredRequest(null);
107
- },
108
- onClick: () => {
109
- var o, r;
110
- ((o = e == null ? void 0 : e.user) == null ? void 0 : o.id) !== l && (t.setActiveRequest(e), t.setActiveAction("rejectBreak"), ((r = t.activeRequest) == null ? void 0 : r.id) !== e.id && t.setMessage(""), f(e, "rejectBreak"));
111
- },
112
- disabled: t.isProcessing || ((u = e == null ? void 0 : e.user) == null ? void 0 : u.id) === l,
113
- className: p(
114
- "rounded-ds-full p-ds-03",
115
- ((w = t.activeRequest) == null ? void 0 : w.id) === e.id && t.activeAction === "rejectBreak" && "bg-error-surface",
116
- ((y = e == null ? void 0 : e.user) == null ? void 0 : y.id) === l && "cursor-not-allowed opacity-[0.38]",
117
- "max-md:flex max-md:w-full max-md:justify-center"
118
- ),
119
- children: /* @__PURE__ */ a(
120
- Y,
121
- {
122
- className: p(
123
- "h-ico-lg w-ico-lg",
124
- ((g = t.activeRequest) == null ? void 0 : g.id) === e.id && t.activeAction === "rejectBreak" && "text-text-error"
125
- )
126
- }
127
- )
128
- }
129
- ) }),
130
- ((N = e == null ? void 0 : e.user) == null ? void 0 : N.id) === l && /* @__PURE__ */ a(M, { children: /* @__PURE__ */ a("p", { children: "You cannot approve/reject your own break request" }) })
131
- ] }) }),
132
- /* @__PURE__ */ a("div", { className: "flex w-1/2 justify-center bg-success-surface p-ds-02 md:bg-transparent", children: /* @__PURE__ */ i(k, { delayDuration: 0, children: [
133
- /* @__PURE__ */ a(E, { asChild: !0, children: /* @__PURE__ */ a(
134
- "button",
135
- {
136
- "aria-label": "Approve request",
137
- onMouseEnter: () => {
138
- v(e, "approveBreak");
139
- },
140
- onMouseLeave: () => {
141
- t.setHoverActionTemp(null), t.setHoveredRequest(null);
142
- },
143
- onClick: () => {
144
- var o, r;
145
- ((o = e == null ? void 0 : e.user) == null ? void 0 : o.id) !== l && (t.setActiveRequest(e), t.setActiveAction("approveBreak"), ((r = t.activeRequest) == null ? void 0 : r.id) !== e.id && t.setMessage(""), f(e, "approveBreak"));
146
- },
147
- disabled: t.isProcessing || ((R = e == null ? void 0 : e.user) == null ? void 0 : R.id) === l,
148
- className: p(
149
- "rounded-ds-full p-ds-03",
150
- ((A = t.activeRequest) == null ? void 0 : A.id) === e.id && t.activeAction === "approveBreak" && "bg-success-surface",
151
- ((j = e == null ? void 0 : e.user) == null ? void 0 : j.id) === l && "cursor-not-allowed opacity-[0.38]",
152
- "max-md:flex max-md:w-full max-md:justify-center"
153
- ),
154
- children: /* @__PURE__ */ a(X, { className: "h-ico-lg w-ico-lg" })
155
- }
156
- ) }),
157
- ((C = e == null ? void 0 : e.user) == null ? void 0 : C.id) === l && /* @__PURE__ */ a(M, { children: /* @__PURE__ */ a("p", { children: "You cannot approve/reject your own break request" }) })
158
- ] }) })
159
- ] })
160
- ] }),
161
- (t.openComment && t.activeRequest && ((D = t.activeRequest) == null ? void 0 : D.id) === e.id || H) && /* @__PURE__ */ i("div", { className: "flex flex-row items-start justify-between rounded-ds-lg border-[1px] border-border py-ds-02 max-md:rounded-t-none", children: [
162
- /* @__PURE__ */ i("div", { className: "flex w-full flex-col items-start justify-start gap-ds-02 px-ds-05 pb-ds-02 pt-[10px]", children: [
163
- /* @__PURE__ */ a("div", { className: "text-ds-xs font-semibold uppercase tracking-wider text-text-placeholder", children: "comment" }),
164
- /* @__PURE__ */ a(
165
- "input",
166
- {
167
- type: "text",
168
- value: t.message,
169
- onChange: (o) => {
170
- var r;
171
- return t.setMessage((r = o == null ? void 0 : o.target) == null ? void 0 : r.value);
172
- },
173
- placeholder: "Enter a Comment",
174
- className: "text-ds-md w-full text-text-primary outline-none"
175
- }
176
- )
177
- ] }),
178
- /* @__PURE__ */ a(
179
- "button",
180
- {
181
- "aria-label": "Send comment",
182
- disabled: t.isProcessing,
183
- onClick: () => f(e, t.activeAction),
184
- className: "my-auto flex items-center justify-center rounded-ds-full p-ds-03",
185
- children: /* @__PURE__ */ a(_, { className: "h-ico-lg w-ico-lg" })
186
- }
187
- )
188
- ] })
189
- ]
190
- },
191
- e.id
192
- );
193
- }) })
194
- }
195
- );
196
- }
197
- );
198
- z.displayName = "LeaveRequests";
199
- export {
200
- z as LeaveRequests
201
- };
@@ -1,144 +0,0 @@
1
- "use client";
2
- import { jsx as R, jsxs as H } from "react/jsx-runtime";
3
- import * as J from "react";
4
- import { useState as Q, useEffect as V } from "react";
5
- import { cn as j } from "@devalok/shilp-sutra/ui/lib/utils";
6
- import { isSameDay as X, getStartOfDay as O } from "../utils/date-utils.js";
7
- import { format as d } from "date-fns";
8
- const Y = J.forwardRef(
9
- function({
10
- day: i,
11
- isAdmin: C,
12
- dateAttendanceMap: s,
13
- selectedDate: k,
14
- activeTimeFrame: D
15
- }, K) {
16
- const [e, l] = Q({
17
- today: i.isToday,
18
- isPresent: null,
19
- isDefault: null,
20
- isBreak: null,
21
- isAbsent: null,
22
- breakStart: null,
23
- breakMid: null,
24
- breakEnd: null,
25
- disabled: null,
26
- disabledState: !1,
27
- hover: !1,
28
- focus: !1,
29
- pressed: !1,
30
- selected: i.isActive
31
- }), T = (r) => {
32
- const o = /* @__PURE__ */ new Date();
33
- return O(r) < O(o);
34
- }, F = (r) => {
35
- const o = d(r, "yyyy-MM-dd"), t = s == null ? void 0 : s.get(o);
36
- return (t == null ? void 0 : t.status) === "BREAK";
37
- }, W = (r) => {
38
- const o = d(r, "yyyy-MM-dd"), t = s == null ? void 0 : s.get(o);
39
- return T(r) && t && !t.hasCorrectionOrApproval && (t == null ? void 0 : t.status) === "ABSENT";
40
- }, L = (r) => {
41
- const o = d(r, "yyyy-MM-dd"), t = s == null ? void 0 : s.get(o);
42
- return (t == null ? void 0 : t.status) === "PRESENT";
43
- };
44
- V(() => {
45
- var h, S, w, E;
46
- const r = L(i.fullDate) ?? !1, o = F(i.fullDate) ?? !1, t = W(i.fullDate) ?? !1, B = i.isDisabled || !1, z = !i.isToday && !o && !t && !B;
47
- let x = !1, y = !1, c = !1;
48
- if (o) {
49
- const a = new Date(i.fullDate);
50
- a.setDate(a.getDate() - 1);
51
- const P = d(a, "yyyy-MM-dd"), g = new Date(i.fullDate);
52
- g.setDate(g.getDate() + 1);
53
- const N = d(g, "yyyy-MM-dd"), b = ((h = s == null ? void 0 : s.get(P)) == null ? void 0 : h.status) === "BREAK" && ((S = s == null ? void 0 : s.get(P)) == null ? void 0 : S.isBreakApproved), u = ((w = s == null ? void 0 : s.get(N)) == null ? void 0 : w.status) === "BREAK" && ((E = s == null ? void 0 : s.get(N)) == null ? void 0 : E.isBreakApproved);
54
- x = o && !b && !!u, y = o && !!b && !!u, c = o && !!b && !u, o && !b && !u && (x = !0, c = !0, y = !1);
55
- }
56
- const G = X(new Date(k), i.fullDate);
57
- l((a) => ({
58
- ...a,
59
- isPresent: r,
60
- isBreak: o,
61
- isAbsent: t,
62
- disabled: B,
63
- isDefault: z,
64
- breakStart: x,
65
- breakMid: y,
66
- breakEnd: c,
67
- selected: G
68
- }));
69
- }, [i, s, k, C]);
70
- const f = e.isBreak && D !== "weekly", m = f && e.breakStart && !e.breakEnd, v = f && e.breakEnd && !e.breakStart, n = f && e.breakMid, U = j(
71
- "flex w-full items-center justify-center p-ds-02",
72
- m && "rounded-l-ds-2xl",
73
- v && "rounded-r-ds-2xl",
74
- n && "bg-interactive-subtle"
75
- ), q = j(
76
- // Base layout & transitions
77
- "flex h-ds-md w-ds-md items-center justify-center rounded-ds-full text-ds-base relative overflow-hidden",
78
- "transition-[background-color,color,border] duration-200",
79
- "outline-border-strong outline-solid outline-0",
80
- // Cursor
81
- e.disabled ? "cursor-default" : "cursor-pointer",
82
- // ── Base states (mutually exclusive in original if/else) ──
83
- // Disabled
84
- e.disabled && "bg-transparent text-text-disabled",
85
- // Today (not break, not disabled)
86
- !e.disabled && e.today && !e.isBreak && "bg-interactive text-text-on-color ring-2 ring-inset ring-interactive",
87
- // Break (not disabled, not today-only)
88
- !e.disabled && e.isBreak && !n && "bg-interactive-selected text-text-secondary ring-2 ring-inset ring-interactive",
89
- // Break mid in non-weekly view overrides break base
90
- !e.disabled && e.isBreak && n && "rounded-ds-none bg-interactive-subtle text-text-secondary shadow-none",
91
- // Break border-radius overrides for non-weekly
92
- !e.disabled && e.isBreak && m && "rounded-l-ds-2xl rounded-r-none",
93
- !e.disabled && e.isBreak && v && "rounded-l-none rounded-r-ds-2xl",
94
- // Absent (not disabled, not today, not break)
95
- !e.disabled && !e.today && !e.isBreak && e.isAbsent && "bg-transparent text-error",
96
- // Present (not disabled, not today, not break, not absent)
97
- !e.disabled && !e.today && !e.isBreak && !e.isAbsent && e.isPresent && "bg-transparent text-text-primary",
98
- // Default (not disabled, not today, not break, not absent, not present)
99
- !e.disabled && e.isDefault && "bg-transparent text-text-secondary",
100
- // ── Hover overrides ──
101
- // Hover on today (not break)
102
- e.hover && !e.disabled && e.today && !e.isBreak && "bg-interactive text-text-on-color ring-2 ring-inset ring-interactive",
103
- // Hover on present (not today, not break)
104
- e.hover && !e.disabled && !e.today && !e.isBreak && e.isPresent && "bg-field text-text-primary",
105
- // Hover on default (not today, not break, not present)
106
- e.hover && !e.disabled && !e.today && !e.isBreak && !e.isPresent && e.isDefault && "bg-field text-text-secondary",
107
- // Hover on break (same visual as base break, but re-assert to match original)
108
- e.hover && !e.disabled && e.isBreak && !n && "bg-interactive-selected text-text-secondary ring-2 ring-inset ring-interactive",
109
- e.hover && !e.disabled && e.isBreak && n && "rounded-ds-none bg-interactive-subtle text-text-secondary shadow-none",
110
- // Hover on absent (not today, not break)
111
- e.hover && !e.disabled && !e.today && !e.isBreak && e.isAbsent && "bg-field text-error",
112
- // ── Focus ──
113
- e.focus && !e.pressed && "outline-2",
114
- // ── Pressed ──
115
- e.pressed && (e.isPresent || e.isAbsent || e.isDefault || e.disabled) && "bg-error-surface",
116
- // ── Selected ──
117
- e.selected && "font-semibold",
118
- e.selected && D === "monthly" && "text-text-primary",
119
- // ── DisabledState (visual-only disabled, different from functional disabled) ──
120
- e.disabledState && "text-text-disabled",
121
- e.disabledState && e.today && "bg-text-disabled text-text-on-color"
122
- );
123
- return /* @__PURE__ */ R("div", { ref: K, className: U, children: /* @__PURE__ */ H(
124
- "div",
125
- {
126
- className: q,
127
- onMouseEnter: () => l((r) => ({ ...r, hover: !0 })),
128
- onMouseLeave: () => l((r) => ({ ...r, hover: !1 })),
129
- onFocus: () => l((r) => ({ ...r, focus: !0 })),
130
- onBlur: () => l((r) => ({ ...r, focus: !1 })),
131
- onMouseDown: () => l((r) => ({ ...r, pressed: !0 })),
132
- onMouseUp: () => l((r) => ({ ...r, pressed: !1 })),
133
- children: [
134
- i.date,
135
- e.isAbsent && /* @__PURE__ */ R("span", { className: "absolute bottom-0 left-1/2 h-ds-02b w-ds-02b -translate-x-1/2 rounded-ds-full bg-error" })
136
- ]
137
- }
138
- ) });
139
- }
140
- );
141
- Y.displayName = "RenderDate";
142
- export {
143
- Y as RenderDate
144
- };