@devalok/shilp-sutra-karm 0.8.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/chat-panel.js +376 -0
- package/dist/_chunks/daily-brief.js +177 -0
- package/dist/_chunks/kanban-board.js +597 -0
- package/dist/_chunks/project-card.js +121 -0
- package/dist/_chunks/render-adjustment-type.js +3596 -0
- package/dist/{tasks → _chunks}/task-constants.js +3 -3
- package/dist/_chunks/task-detail-panel.js +1305 -0
- package/dist/_chunks/use-composed-ref.js +12 -0
- package/dist/_chunks/vendor.js +11491 -0
- package/dist/admin/index.js +37 -60
- package/dist/board/index.js +3 -5
- package/dist/chat/index.js +6 -10
- package/dist/client/index.js +4 -6
- package/dist/dashboard/index.js +3 -4
- package/dist/index.js +189 -103
- package/dist/tasks/index.js +8 -14
- package/package.json +78 -80
- package/dist/admin/adjustments/approved-adjustments.js +0 -43
- package/dist/admin/break/break-admin-skeleton.js +0 -59
- package/dist/admin/break/break-admin.js +0 -373
- package/dist/admin/break/break-balance.js +0 -42
- package/dist/admin/break/breaks.js +0 -91
- package/dist/admin/break/delete-break.js +0 -55
- package/dist/admin/break/edit-break-balance.js +0 -113
- package/dist/admin/break/edit-break.js +0 -453
- package/dist/admin/break/header.js +0 -231
- package/dist/admin/break/leave-request.js +0 -162
- package/dist/admin/break/use-break-date-picker.js +0 -43
- package/dist/admin/dashboard/admin-dashboard.js +0 -337
- package/dist/admin/dashboard/associate-detail.js +0 -259
- package/dist/admin/dashboard/attendance-overview.js +0 -136
- package/dist/admin/dashboard/break-request.js +0 -176
- package/dist/admin/dashboard/calendar.js +0 -141
- package/dist/admin/dashboard/correction-list.js +0 -102
- package/dist/admin/dashboard/dashboard-header.js +0 -155
- package/dist/admin/dashboard/dashboard-skeleton.js +0 -109
- package/dist/admin/dashboard/leave-requests.js +0 -201
- package/dist/admin/dashboard/render-date.js +0 -144
- package/dist/admin/dashboard/use-calendar-navigation.js +0 -169
- package/dist/admin/dashboard/use-leave-request-interaction.js +0 -34
- package/dist/admin/utils/date-range-utils.js +0 -37
- package/dist/admin/utils/date-utils.js +0 -119
- package/dist/admin/utils/emoji-utils.js +0 -17
- package/dist/admin/utils/render-adjustment-type.js +0 -20
- package/dist/admin/utils/render-status.js +0 -22
- package/dist/board/board-column.js +0 -236
- package/dist/board/kanban-board.js +0 -218
- package/dist/board/task-card.js +0 -168
- package/dist/chat/chat-input.js +0 -54
- package/dist/chat/chat-panel.js +0 -151
- package/dist/chat/conversation-list.js +0 -99
- package/dist/chat/markdown-components.js +0 -35
- package/dist/chat/message-list.js +0 -59
- package/dist/chat/streaming-text.js +0 -17
- package/dist/client/accent-provider.js +0 -22
- package/dist/client/client-portal-header.js +0 -48
- package/dist/client/project-card.js +0 -60
- package/dist/dashboard/attendance-cta.js +0 -115
- package/dist/dashboard/daily-brief.js +0 -68
- package/dist/page-skeletons.js +0 -130
- package/dist/tasks/activity-tab.js +0 -185
- package/dist/tasks/conversation-tab.js +0 -138
- package/dist/tasks/files-tab.js +0 -186
- package/dist/tasks/review-tab.js +0 -170
- package/dist/tasks/subtasks-tab.js +0 -154
- package/dist/tasks/task-detail-panel.js +0 -210
- package/dist/tasks/task-properties.js +0 -324
- package/dist/utils/use-composed-ref.js +0 -12
|
@@ -1,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
|
-
};
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useReducer as v, useCallback as D } from "react";
|
|
3
|
-
import { format as f } from "date-fns";
|
|
4
|
-
import { isSameDay as T, getStartOfDay as M, getWeekDays as p, getMonthDays as _ } from "../utils/date-utils.js";
|
|
5
|
-
const y = (e) => f(e, "yyyy-MM-dd'T'HH:mm:ssxxx"), l = (e, a, s) => e === "weekly" ? p(a, s) : _(a, s), i = (e) => `${f(e, "MMMM")} ${f(e, "yyyy")}`;
|
|
6
|
-
function I(e, a) {
|
|
7
|
-
const s = /* @__PURE__ */ new Date();
|
|
8
|
-
switch (a.type) {
|
|
9
|
-
case "SET_TIME_FRAME": {
|
|
10
|
-
const t = l(
|
|
11
|
-
a.payload,
|
|
12
|
-
e.currentDate,
|
|
13
|
-
e.selectedDate
|
|
14
|
-
);
|
|
15
|
-
return {
|
|
16
|
-
...e,
|
|
17
|
-
activeTimeFrame: a.payload,
|
|
18
|
-
days: t
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
case "SELECT_DATE": {
|
|
22
|
-
const { index: t, date: n } = a.payload, o = y(n), c = M(n) > M(s), r = i(n);
|
|
23
|
-
return {
|
|
24
|
-
...e,
|
|
25
|
-
activeIndex: t,
|
|
26
|
-
selectedDate: o,
|
|
27
|
-
isFutureDate: c,
|
|
28
|
-
selectedMonth: r
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
case "SELECT_DAY_MONTHLY": {
|
|
32
|
-
const { date: t } = a.payload, n = y(t), o = M(t) > M(s), c = i(t), r = l(
|
|
33
|
-
e.activeTimeFrame,
|
|
34
|
-
e.currentDate,
|
|
35
|
-
n
|
|
36
|
-
);
|
|
37
|
-
return {
|
|
38
|
-
...e,
|
|
39
|
-
selectedDate: n,
|
|
40
|
-
isFutureDate: o,
|
|
41
|
-
selectedMonth: c,
|
|
42
|
-
days: r
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
case "NAVIGATE_DATE": {
|
|
46
|
-
const t = new Date(e.currentDate);
|
|
47
|
-
if (e.activeTimeFrame === "weekly") {
|
|
48
|
-
const r = a.payload === "prev" ? -7 : 7;
|
|
49
|
-
t.setDate(t.getDate() + r);
|
|
50
|
-
} else {
|
|
51
|
-
const r = a.payload === "prev" ? -1 : 1;
|
|
52
|
-
t.setMonth(t.getMonth() + r), t.setDate(1);
|
|
53
|
-
}
|
|
54
|
-
const n = y(t), o = i(t), c = l(e.activeTimeFrame, n, n);
|
|
55
|
-
return {
|
|
56
|
-
...e,
|
|
57
|
-
currentDate: n,
|
|
58
|
-
selectedDate: n,
|
|
59
|
-
dateOffset: e.dateOffset + (a.payload === "prev" ? -1 : 1),
|
|
60
|
-
selectedMonth: o,
|
|
61
|
-
days: c
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
case "SELECT_MONTH": {
|
|
65
|
-
const [t, n] = a.payload.split(" "), o = new Date(e.selectedDate);
|
|
66
|
-
o.setMonth((/* @__PURE__ */ new Date(`${t} 1, 2024`)).getMonth()), o.setFullYear(parseInt(n));
|
|
67
|
-
const c = y(o), r = Math.floor(
|
|
68
|
-
(o.getTime() - s.getTime()) / (7 * 24 * 60 * 60 * 1e3)
|
|
69
|
-
), u = l(e.activeTimeFrame, c, c);
|
|
70
|
-
return {
|
|
71
|
-
...e,
|
|
72
|
-
currentDate: c,
|
|
73
|
-
selectedDate: c,
|
|
74
|
-
selectedMonth: a.payload,
|
|
75
|
-
dateOffset: r,
|
|
76
|
-
days: u
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
case "GO_TODAY": {
|
|
80
|
-
const t = y(s), n = i(s), o = Math.floor(
|
|
81
|
-
(s.getTime() - (/* @__PURE__ */ new Date()).getTime()) / (7 * 24 * 60 * 60 * 1e3)
|
|
82
|
-
), c = l(e.activeTimeFrame, t, t), r = c.findIndex(
|
|
83
|
-
(u) => T(u.fullDate, s)
|
|
84
|
-
);
|
|
85
|
-
return {
|
|
86
|
-
...e,
|
|
87
|
-
currentDate: t,
|
|
88
|
-
selectedDate: t,
|
|
89
|
-
selectedMonth: n,
|
|
90
|
-
dateOffset: o,
|
|
91
|
-
isFutureDate: !1,
|
|
92
|
-
days: c,
|
|
93
|
-
activeIndex: r !== -1 ? r : e.activeIndex
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
case "UPDATE_DAYS": {
|
|
97
|
-
const t = l(
|
|
98
|
-
e.activeTimeFrame,
|
|
99
|
-
e.currentDate,
|
|
100
|
-
e.selectedDate
|
|
101
|
-
);
|
|
102
|
-
return { ...e, days: t };
|
|
103
|
-
}
|
|
104
|
-
default:
|
|
105
|
-
return e;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
function O() {
|
|
109
|
-
const e = /* @__PURE__ */ new Date(), a = y(e), s = p(a, a), t = s.findIndex(
|
|
110
|
-
(n) => T(n.fullDate, e)
|
|
111
|
-
);
|
|
112
|
-
return {
|
|
113
|
-
currentDate: a,
|
|
114
|
-
selectedDate: a,
|
|
115
|
-
isFutureDate: !1,
|
|
116
|
-
activeTimeFrame: "weekly",
|
|
117
|
-
days: s,
|
|
118
|
-
selectedMonth: i(e),
|
|
119
|
-
activeIndex: t !== -1 ? t : 0,
|
|
120
|
-
dateOffset: 0
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
function C() {
|
|
124
|
-
const [e, a] = v(I, null, O), s = D((d) => {
|
|
125
|
-
a({ type: "SET_TIME_FRAME", payload: d });
|
|
126
|
-
}, []), t = D((d, m) => {
|
|
127
|
-
a({ type: "SELECT_DATE", payload: { index: d, date: m } });
|
|
128
|
-
}, []), n = D((d) => {
|
|
129
|
-
a({ type: "SELECT_DAY_MONTHLY", payload: { date: d } });
|
|
130
|
-
}, []), o = D((d) => {
|
|
131
|
-
a({ type: "NAVIGATE_DATE", payload: d });
|
|
132
|
-
}, []), c = D((d) => {
|
|
133
|
-
a({ type: "SELECT_MONTH", payload: d });
|
|
134
|
-
}, []), r = D(() => {
|
|
135
|
-
a({ type: "GO_TODAY" });
|
|
136
|
-
}, []), u = D(() => {
|
|
137
|
-
a({ type: "UPDATE_DAYS" });
|
|
138
|
-
}, []), h = D(() => T(new Date(e.selectedDate), /* @__PURE__ */ new Date()), [e.selectedDate]), E = D(() => {
|
|
139
|
-
const d = [], m = (/* @__PURE__ */ new Date()).getFullYear(), F = f(new Date(e.selectedDate), "MMMM");
|
|
140
|
-
for (let w = -2; w < 1; w++) {
|
|
141
|
-
const g = new Date(m + w, 0);
|
|
142
|
-
d.push(`${F} ${g.getFullYear()}`);
|
|
143
|
-
}
|
|
144
|
-
return d;
|
|
145
|
-
}, [e.selectedDate]), S = D(() => e.days.length > 0 && !!e.days[0].fullDate && T(e.days[0].fullDate, new Date(e.selectedDate)), [e.days, e.selectedDate]), A = D(() => e.days.length > 0 && !!e.days[e.days.length - 1].fullDate && T(
|
|
146
|
-
e.days[e.days.length - 1].fullDate,
|
|
147
|
-
new Date(e.selectedDate)
|
|
148
|
-
), [e.days, e.selectedDate]);
|
|
149
|
-
return {
|
|
150
|
-
...e,
|
|
151
|
-
dispatch: a,
|
|
152
|
-
// Action creators
|
|
153
|
-
setActiveTimeFrame: s,
|
|
154
|
-
selectDate: t,
|
|
155
|
-
selectDayMonthly: n,
|
|
156
|
-
navigateDate: o,
|
|
157
|
-
selectMonth: c,
|
|
158
|
-
goToday: r,
|
|
159
|
-
updateDays: u,
|
|
160
|
-
// Computed
|
|
161
|
-
isTodaySelected: h,
|
|
162
|
-
getYearsList: E,
|
|
163
|
-
isFirstDate: S,
|
|
164
|
-
isLastDate: A
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
export {
|
|
168
|
-
C as useCalendarNavigation
|
|
169
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useState as e, useCallback as R } from "react";
|
|
3
|
-
function g() {
|
|
4
|
-
const [a, s] = e(!1), [i, t] = e(null), [m, n] = e(null), [v, o] = e(""), [f, l] = e(!1), [p, c] = e(
|
|
5
|
-
null
|
|
6
|
-
), [A, u] = e(!1), [q, r] = e(null), C = R(() => {
|
|
7
|
-
s(!1), t(null), n(null), o(""), l(!1), c(null), u(!1), r(null);
|
|
8
|
-
}, []);
|
|
9
|
-
return {
|
|
10
|
-
// State
|
|
11
|
-
isProcessing: a,
|
|
12
|
-
activeRequest: i,
|
|
13
|
-
activeAction: m,
|
|
14
|
-
message: v,
|
|
15
|
-
openComment: f,
|
|
16
|
-
hoveredRequest: p,
|
|
17
|
-
isCtrlPressed: A,
|
|
18
|
-
hoverActionTemp: q,
|
|
19
|
-
// Setters
|
|
20
|
-
setIsProcessing: s,
|
|
21
|
-
setActiveRequest: t,
|
|
22
|
-
setActiveAction: n,
|
|
23
|
-
setMessage: o,
|
|
24
|
-
setOpenComment: l,
|
|
25
|
-
setHoveredRequest: c,
|
|
26
|
-
setIsCtrlPressed: u,
|
|
27
|
-
setHoverActionTemp: r,
|
|
28
|
-
// Helpers
|
|
29
|
-
reset: C
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
export {
|
|
33
|
-
g as useLeaveRequestInteraction
|
|
34
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { format as c, parseISO as s, isWithinInterval as l, isAfter as y, isEqual as u, isBefore as m } from "date-fns";
|
|
3
|
-
function d(e, n, r) {
|
|
4
|
-
const t = s(e), o = s(n), a = s(r);
|
|
5
|
-
return l(t, { start: o, end: a });
|
|
6
|
-
}
|
|
7
|
-
function p(e, n) {
|
|
8
|
-
const r = s(e), t = s(n);
|
|
9
|
-
return m(r, t) || u(r, t);
|
|
10
|
-
}
|
|
11
|
-
function O(e, n) {
|
|
12
|
-
const r = s(e), t = s(n);
|
|
13
|
-
return y(r, t) || u(r, t);
|
|
14
|
-
}
|
|
15
|
-
function b(e, n) {
|
|
16
|
-
return y(s(e), s(n));
|
|
17
|
-
}
|
|
18
|
-
function S(e, n, r, t) {
|
|
19
|
-
return r.some((o) => {
|
|
20
|
-
const a = c(new Date(o.startDate), "yyyy-MM-dd"), i = c(new Date(o.endDate), "yyyy-MM-dd"), f = d(e, a, i), D = d(n, a, i), M = p(e, a) && O(n, i);
|
|
21
|
-
return o.id !== t && (f || D || M);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
function A(e, n, r) {
|
|
25
|
-
return n.some((t) => {
|
|
26
|
-
const o = c(new Date(t.startDate), "yyyy-MM-dd"), a = c(new Date(t.endDate), "yyyy-MM-dd");
|
|
27
|
-
return t.id !== r && d(e, o, a);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
export {
|
|
31
|
-
S as checkDateOverlap,
|
|
32
|
-
A as isBreakDay,
|
|
33
|
-
b as isDateAfter,
|
|
34
|
-
d as isDateInRange,
|
|
35
|
-
O as isDateSameOrAfter,
|
|
36
|
-
p as isDateSameOrBefore
|
|
37
|
-
};
|