gov-layout 1.0.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/index.mjs ADDED
@@ -0,0 +1,1065 @@
1
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
+ import { useState, useRef, useEffect } from 'react';
3
+
4
+ // src/sidebar/SidebarHeader.tsx
5
+ function SidebarHeader({ orgLogo, orgName, orgSubtitle }) {
6
+ return /* @__PURE__ */ jsxs("div", { style: {
7
+ display: "flex",
8
+ alignItems: "center",
9
+ gap: "12px",
10
+ padding: "24px 20px"
11
+ }, children: [
12
+ orgLogo && /* @__PURE__ */ jsx(
13
+ "img",
14
+ {
15
+ src: orgLogo,
16
+ alt: orgName,
17
+ style: {
18
+ width: "48px",
19
+ height: "48px",
20
+ borderRadius: "50%",
21
+ objectFit: "cover",
22
+ flexShrink: 0
23
+ }
24
+ }
25
+ ),
26
+ /* @__PURE__ */ jsxs("div", { style: { minWidth: 0 }, children: [
27
+ /* @__PURE__ */ jsx("p", { style: {
28
+ fontWeight: 700,
29
+ fontSize: "16px",
30
+ lineHeight: "22px",
31
+ color: "var(--color-alias-color-brand-text-dark, #05010e)",
32
+ margin: 0,
33
+ overflow: "hidden",
34
+ textOverflow: "ellipsis",
35
+ whiteSpace: "nowrap"
36
+ }, children: orgName }),
37
+ orgSubtitle && /* @__PURE__ */ jsx("p", { style: {
38
+ fontSize: "14px",
39
+ lineHeight: "20px",
40
+ color: "var(--color-alias-text-colors-tertiary, #475272)",
41
+ margin: 0,
42
+ overflow: "hidden",
43
+ textOverflow: "ellipsis",
44
+ whiteSpace: "nowrap"
45
+ }, children: orgSubtitle })
46
+ ] })
47
+ ] });
48
+ }
49
+ function ChevronDownIcon({ isOpen }) {
50
+ return /* @__PURE__ */ jsx(
51
+ "svg",
52
+ {
53
+ width: "20",
54
+ height: "20",
55
+ viewBox: "0 0 20 20",
56
+ fill: "none",
57
+ stroke: "currentColor",
58
+ strokeWidth: "2",
59
+ strokeLinecap: "round",
60
+ strokeLinejoin: "round",
61
+ style: {
62
+ transition: "transform 0.2s ease",
63
+ transform: isOpen ? "rotate(180deg)" : "rotate(0deg)",
64
+ flexShrink: 0
65
+ },
66
+ children: /* @__PURE__ */ jsx("path", { d: "M5 7.5L10 12.5L15 7.5" })
67
+ }
68
+ );
69
+ }
70
+ function MenuItemComponent({
71
+ item,
72
+ onItemClick,
73
+ currentPath,
74
+ depth = 0
75
+ }) {
76
+ const [isOpen, setIsOpen] = useState(false);
77
+ const hasChildren = item.children && item.children.length > 0;
78
+ const isActive = item.path ? currentPath === item.path : false;
79
+ const isChildActive = hasChildren ? item.children.some((child) => child.path === currentPath) : false;
80
+ const expanded = isOpen || isChildActive;
81
+ const handleClick = () => {
82
+ if (hasChildren) {
83
+ setIsOpen(!isOpen);
84
+ } else if (item.path) {
85
+ onItemClick(item.path);
86
+ }
87
+ };
88
+ const activeColor = "var(--color-alias-color-brand-primary, #1e7d55)";
89
+ const hoverBg = "var(--color-foundations-fuji-pallet-light, #ebedf5)";
90
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
91
+ /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
92
+ "button",
93
+ {
94
+ onClick: handleClick,
95
+ onMouseEnter: (e) => {
96
+ if (!isActive) {
97
+ e.currentTarget.style.backgroundColor = hoverBg;
98
+ }
99
+ },
100
+ onMouseLeave: (e) => {
101
+ if (!isActive) {
102
+ e.currentTarget.style.backgroundColor = "transparent";
103
+ }
104
+ },
105
+ style: {
106
+ width: "100%",
107
+ display: "flex",
108
+ alignItems: "center",
109
+ gap: "12px",
110
+ padding: depth > 0 ? "10px 16px 10px 52px" : "12px 16px",
111
+ borderRadius: "8px",
112
+ border: "none",
113
+ background: isActive ? `color-mix(in srgb, ${activeColor} 10%, transparent)` : "transparent",
114
+ color: isActive ? activeColor : "var(--color-alias-text-colors-primary, #060d26)",
115
+ cursor: "pointer",
116
+ transition: "background-color 0.15s ease",
117
+ textAlign: "left",
118
+ fontSize: "15px",
119
+ fontWeight: isActive ? 600 : 400,
120
+ lineHeight: "22px"
121
+ },
122
+ children: [
123
+ item.icon && /* @__PURE__ */ jsx(
124
+ "span",
125
+ {
126
+ style: {
127
+ width: "24px",
128
+ height: "24px",
129
+ display: "flex",
130
+ alignItems: "center",
131
+ justifyContent: "center",
132
+ flexShrink: 0,
133
+ color: isActive ? activeColor : "var(--color-alias-text-colors-tertiary, #475272)"
134
+ },
135
+ children: item.icon
136
+ }
137
+ ),
138
+ /* @__PURE__ */ jsx("span", { style: { flex: 1 }, children: item.title }),
139
+ hasChildren && /* @__PURE__ */ jsx(ChevronDownIcon, { isOpen: expanded })
140
+ ]
141
+ }
142
+ ) }),
143
+ hasChildren && expanded && /* @__PURE__ */ jsx("ul", { style: { listStyle: "none", margin: 0, padding: 0 }, children: item.children.map((child) => /* @__PURE__ */ jsx(
144
+ MenuItemComponent,
145
+ {
146
+ item: child,
147
+ onItemClick,
148
+ currentPath,
149
+ depth: depth + 1
150
+ },
151
+ child.id
152
+ )) }),
153
+ item.dividerAfter && /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
154
+ "hr",
155
+ {
156
+ style: {
157
+ border: "none",
158
+ borderTop: "1px solid var(--color-border-colors-neutral, #c8cedd)",
159
+ margin: "8px 0"
160
+ }
161
+ }
162
+ ) })
163
+ ] });
164
+ }
165
+ function SidebarMenu({ menuItems, onItemClick, currentPath }) {
166
+ return /* @__PURE__ */ jsx("nav", { style: { flex: 1, padding: "8px 12px", overflowY: "auto" }, children: /* @__PURE__ */ jsx("ul", { style: { listStyle: "none", margin: 0, padding: 0, display: "flex", flexDirection: "column", gap: "2px" }, children: menuItems.map((item) => /* @__PURE__ */ jsx(
167
+ MenuItemComponent,
168
+ {
169
+ item,
170
+ onItemClick,
171
+ currentPath
172
+ },
173
+ item.id
174
+ )) }) });
175
+ }
176
+ function LogoutIcon() {
177
+ return /* @__PURE__ */ jsxs(
178
+ "svg",
179
+ {
180
+ width: "20",
181
+ height: "20",
182
+ viewBox: "0 0 24 24",
183
+ fill: "none",
184
+ stroke: "currentColor",
185
+ strokeWidth: "2",
186
+ strokeLinecap: "round",
187
+ strokeLinejoin: "round",
188
+ children: [
189
+ /* @__PURE__ */ jsx("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }),
190
+ /* @__PURE__ */ jsx("polyline", { points: "16 17 21 12 16 7" }),
191
+ /* @__PURE__ */ jsx("line", { x1: "21", y1: "12", x2: "9", y2: "12" })
192
+ ]
193
+ }
194
+ );
195
+ }
196
+ function SidebarUserProfile({
197
+ user,
198
+ roleLabel,
199
+ onLogout
200
+ }) {
201
+ if (!user) return null;
202
+ const getFullName = () => {
203
+ if (user.firstName && user.lastName) {
204
+ return `${user.firstName} ${user.lastName}`;
205
+ }
206
+ return user.firstName || user.lastName || "\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49";
207
+ };
208
+ const getInitial = () => {
209
+ return user.firstName?.charAt(0) || user.lastName?.charAt(0) || "?";
210
+ };
211
+ return /* @__PURE__ */ jsxs(
212
+ "div",
213
+ {
214
+ style: {
215
+ padding: "16px 20px",
216
+ borderTop: "1px solid var(--color-border-colors-neutral, #c8cedd)",
217
+ display: "flex",
218
+ alignItems: "center",
219
+ gap: "12px"
220
+ },
221
+ children: [
222
+ user.pictureUrl ? /* @__PURE__ */ jsx(
223
+ "img",
224
+ {
225
+ src: user.pictureUrl,
226
+ alt: getFullName(),
227
+ style: {
228
+ width: "40px",
229
+ height: "40px",
230
+ borderRadius: "50%",
231
+ objectFit: "cover",
232
+ flexShrink: 0
233
+ }
234
+ }
235
+ ) : /* @__PURE__ */ jsx(
236
+ "div",
237
+ {
238
+ style: {
239
+ width: "40px",
240
+ height: "40px",
241
+ borderRadius: "50%",
242
+ background: "var(--color-alias-color-brand-primary, #1e7d55)",
243
+ display: "flex",
244
+ alignItems: "center",
245
+ justifyContent: "center",
246
+ color: "#fff",
247
+ fontWeight: 700,
248
+ fontSize: "16px",
249
+ flexShrink: 0
250
+ },
251
+ children: getInitial()
252
+ }
253
+ ),
254
+ /* @__PURE__ */ jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
255
+ /* @__PURE__ */ jsx(
256
+ "p",
257
+ {
258
+ style: {
259
+ fontWeight: 600,
260
+ fontSize: "14px",
261
+ lineHeight: "20px",
262
+ color: "var(--color-alias-text-colors-primary, #060d26)",
263
+ margin: 0,
264
+ overflow: "hidden",
265
+ textOverflow: "ellipsis",
266
+ whiteSpace: "nowrap"
267
+ },
268
+ children: getFullName()
269
+ }
270
+ ),
271
+ /* @__PURE__ */ jsx(
272
+ "p",
273
+ {
274
+ style: {
275
+ fontSize: "12px",
276
+ lineHeight: "16px",
277
+ color: "var(--color-alias-text-colors-tertiary, #475272)",
278
+ margin: 0
279
+ },
280
+ children: roleLabel
281
+ }
282
+ )
283
+ ] }),
284
+ /* @__PURE__ */ jsx(
285
+ "button",
286
+ {
287
+ onClick: onLogout,
288
+ title: "\u0E2D\u0E2D\u0E01\u0E08\u0E32\u0E01\u0E23\u0E30\u0E1A\u0E1A",
289
+ onMouseEnter: (e) => {
290
+ e.currentTarget.style.backgroundColor = "var(--color-foundations-fuan-pallet-light, #ffd2d2)";
291
+ e.currentTarget.style.color = "var(--color-alias-semantic-critical, #f21515)";
292
+ },
293
+ onMouseLeave: (e) => {
294
+ e.currentTarget.style.backgroundColor = "transparent";
295
+ e.currentTarget.style.color = "var(--color-alias-semantic-critical, #f21515)";
296
+ },
297
+ style: {
298
+ width: "36px",
299
+ height: "36px",
300
+ borderRadius: "8px",
301
+ border: "none",
302
+ background: "transparent",
303
+ color: "var(--color-alias-semantic-critical, #f21515)",
304
+ cursor: "pointer",
305
+ display: "flex",
306
+ alignItems: "center",
307
+ justifyContent: "center",
308
+ transition: "background-color 0.15s ease",
309
+ flexShrink: 0
310
+ },
311
+ children: /* @__PURE__ */ jsx(LogoutIcon, {})
312
+ }
313
+ )
314
+ ]
315
+ }
316
+ );
317
+ }
318
+ function StaffSidebar({
319
+ orgLogo,
320
+ orgName,
321
+ orgSubtitle,
322
+ menuItems,
323
+ bottomMenuItems,
324
+ user,
325
+ roleLabel,
326
+ onNavigate,
327
+ onLogout,
328
+ currentPath,
329
+ width = "280px",
330
+ className
331
+ }) {
332
+ return /* @__PURE__ */ jsxs(
333
+ "aside",
334
+ {
335
+ className,
336
+ style: {
337
+ position: "fixed",
338
+ top: 0,
339
+ left: 0,
340
+ height: "100vh",
341
+ width,
342
+ background: "#fff",
343
+ borderRight: "1px solid var(--color-border-colors-neutral, #c8cedd)",
344
+ display: "flex",
345
+ flexDirection: "column",
346
+ zIndex: 40,
347
+ overflow: "hidden"
348
+ },
349
+ children: [
350
+ /* @__PURE__ */ jsx(
351
+ SidebarHeader,
352
+ {
353
+ orgLogo,
354
+ orgName,
355
+ orgSubtitle
356
+ }
357
+ ),
358
+ /* @__PURE__ */ jsx(
359
+ SidebarMenu,
360
+ {
361
+ menuItems,
362
+ onItemClick: onNavigate,
363
+ currentPath
364
+ }
365
+ ),
366
+ bottomMenuItems && bottomMenuItems.length > 0 && /* @__PURE__ */ jsx(
367
+ SidebarMenu,
368
+ {
369
+ menuItems: bottomMenuItems,
370
+ onItemClick: onNavigate,
371
+ currentPath
372
+ }
373
+ ),
374
+ /* @__PURE__ */ jsx(
375
+ SidebarUserProfile,
376
+ {
377
+ user,
378
+ roleLabel,
379
+ onLogout
380
+ }
381
+ )
382
+ ]
383
+ }
384
+ );
385
+ }
386
+ function BellIcon() {
387
+ return /* @__PURE__ */ jsx("svg", { width: "22", height: "24", viewBox: "0 0 22 24", fill: "none", children: /* @__PURE__ */ jsx(
388
+ "path",
389
+ {
390
+ d: "M21.2321 13.4463L19.3618 6.71712C18.8136 4.74574 17.6222 3.01418 15.9769 1.79767C14.3316 0.581165 12.3269 -0.0504751 10.2814 0.00315377C8.23593 0.0567826 6.26708 0.792603 4.6878 2.09365C3.10852 3.3947 2.00945 5.18632 1.5653 7.18371L0.11728 13.6954C-0.0426654 14.4149 -0.0389674 15.1611 0.128101 15.879C0.29517 16.5969 0.621344 17.2681 1.08254 17.8431C1.54374 18.418 2.12818 18.8821 2.79272 19.2009C3.45727 19.5198 4.18494 19.6853 4.92202 19.6853H6.01861C6.24454 20.7979 6.84817 21.7982 7.72723 22.5167C8.60629 23.2352 9.70671 23.6277 10.842 23.6277C11.9774 23.6277 13.0778 23.2352 13.9569 22.5167C14.8359 21.7982 15.4396 20.7979 15.6655 19.6853H16.4904C17.2492 19.6853 17.9977 19.5099 18.6774 19.1728C19.3572 18.8357 19.9498 18.346 20.409 17.742C20.8682 17.1379 21.1815 16.4359 21.3245 15.6907C21.4674 14.9455 21.4352 14.1774 21.2321 13.4463ZM10.842 21.654C10.2334 21.6515 9.64049 21.461 9.1443 21.1086C8.6481 20.7562 8.27291 20.2591 8.07005 19.6853H13.614C13.4112 20.2591 13.036 20.7562 12.5398 21.1086C12.0436 21.461 11.4506 21.6515 10.842 21.654ZM18.8411 16.55C18.5668 16.9139 18.2114 17.2088 17.8032 17.4113C17.3949 17.6138 16.9451 17.7183 16.4894 17.7165H4.92202C4.47982 17.7164 4.04328 17.6171 3.64463 17.4257C3.24598 17.2344 2.89539 16.9559 2.61874 16.611C2.34208 16.266 2.14643 15.8633 2.04622 15.4326C1.94602 15.0019 1.94381 14.5542 2.03977 14.1226L3.4868 7.60994C3.83561 6.04105 4.69886 4.63379 5.93932 3.61186C7.17978 2.58992 8.72625 2.01197 10.3329 1.96988C11.9395 1.92779 13.5142 2.42398 14.8064 3.37956C16.0987 4.33515 17.0344 5.69528 17.4649 7.24376L19.3352 13.9729C19.4588 14.4114 19.4785 14.8725 19.3927 15.3199C19.3069 15.7672 19.1181 16.1884 18.8411 16.55Z",
391
+ fill: "var(--color-alias-color-brand-text-dark, #05010e)"
392
+ }
393
+ ) });
394
+ }
395
+ function HamburgerIcon() {
396
+ return /* @__PURE__ */ jsx("svg", { width: "24", height: "18", viewBox: "0 0 27 18", fill: "none", children: /* @__PURE__ */ jsx(
397
+ "path",
398
+ {
399
+ d: "M1.1875 17.8426C0.851042 17.8426 0.569077 17.7287 0.341604 17.501C0.113868 17.2735 0 16.9914 0 16.6547C0 16.3182 0.113868 16.0363 0.341604 15.8088C0.569077 15.5816 0.851042 15.468 1.1875 15.468H25.7292C26.0656 15.468 26.3476 15.5817 26.5751 15.8092C26.8028 16.0369 26.9167 16.3192 26.9167 16.6559C26.9167 16.9923 26.8028 17.2743 26.5751 17.5018C26.3476 17.729 26.0656 17.8426 25.7292 17.8426H1.1875ZM1.1875 10.1088C0.851042 10.1088 0.569077 9.99492 0.341604 9.76719C0.113868 9.53945 0 9.25735 0 8.9209C0 8.58417 0.113868 8.30221 0.341604 8.075C0.569077 7.84753 0.851042 7.73379 1.1875 7.73379H25.7292C26.0656 7.73379 26.3476 7.84766 26.5751 8.0754C26.8028 8.30313 26.9167 8.58523 26.9167 8.92169C26.9167 9.25841 26.8028 9.54037 26.5751 9.76758C26.3476 9.99506 26.0656 10.1088 25.7292 10.1088H1.1875ZM1.1875 2.3746C0.851042 2.3746 0.569077 2.26087 0.341604 2.0334C0.113868 1.80566 0 1.52343 0 1.18671C0 0.850249 0.113868 0.568284 0.341604 0.340812C0.569077 0.113604 0.851042 0 1.1875 0H25.7292C26.0656 0 26.3476 0.113868 26.5751 0.341604C26.8028 0.569077 26.9167 0.851174 26.9167 1.1879C26.9167 1.52435 26.8028 1.80632 26.5751 2.03379C26.3476 2.261 26.0656 2.3746 25.7292 2.3746H1.1875Z",
400
+ fill: "var(--color-alias-color-brand-text-dark, #05010e)"
401
+ }
402
+ ) });
403
+ }
404
+ function getNotifBg(type) {
405
+ const map = {
406
+ success: "#dcfce7",
407
+ warning: "#fef9c3",
408
+ error: "#fee2e2",
409
+ reminder: "#f3e8ff",
410
+ info: "#dbeafe"
411
+ };
412
+ return map[type] || map.info;
413
+ }
414
+ function getNotifIcon(type) {
415
+ const map = {
416
+ success: "\u2713",
417
+ warning: "!",
418
+ error: "\u2715",
419
+ reminder: "\u23F0",
420
+ info: "i"
421
+ };
422
+ return map[type] || map.info;
423
+ }
424
+ function UserHeader({
425
+ user,
426
+ notifications = [],
427
+ onToggleSidebar,
428
+ notificationBell,
429
+ onMarkAllRead,
430
+ onViewAll,
431
+ className
432
+ }) {
433
+ const displayName = `${user?.firstName || ""} ${user?.lastName || ""}`.trim() || "\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49";
434
+ const firstChar = user?.firstName?.charAt(0) || "\u0E1C";
435
+ const [isNotifOpen, setIsNotifOpen] = useState(false);
436
+ const notifRef = useRef(null);
437
+ useEffect(() => {
438
+ const handleClickOutside = (e) => {
439
+ if (notifRef.current && !notifRef.current.contains(e.target)) {
440
+ setIsNotifOpen(false);
441
+ }
442
+ };
443
+ document.addEventListener("mousedown", handleClickOutside);
444
+ return () => document.removeEventListener("mousedown", handleClickOutside);
445
+ }, []);
446
+ const unreadCount = notifications.filter((n) => !n.isRead).length;
447
+ return /* @__PURE__ */ jsx(
448
+ "header",
449
+ {
450
+ className,
451
+ style: {
452
+ background: "#fff",
453
+ boxShadow: "0 1px 3px rgba(0,0,0,0.08)",
454
+ position: "sticky",
455
+ top: 0,
456
+ zIndex: 10
457
+ },
458
+ children: /* @__PURE__ */ jsxs(
459
+ "div",
460
+ {
461
+ style: {
462
+ display: "flex",
463
+ alignItems: "center",
464
+ justifyContent: "space-between",
465
+ padding: "14px 20px"
466
+ },
467
+ children: [
468
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
469
+ user?.pictureUrl ? /* @__PURE__ */ jsx(
470
+ "img",
471
+ {
472
+ src: user.pictureUrl,
473
+ alt: displayName,
474
+ style: {
475
+ width: "44px",
476
+ height: "44px",
477
+ borderRadius: "50%",
478
+ objectFit: "cover",
479
+ border: "2px solid var(--color-alias-color-brand-surface, #faf9e5)"
480
+ }
481
+ }
482
+ ) : /* @__PURE__ */ jsx(
483
+ "div",
484
+ {
485
+ style: {
486
+ width: "44px",
487
+ height: "44px",
488
+ borderRadius: "50%",
489
+ background: "linear-gradient(135deg, var(--color-alias-color-brand-secondary, #80d897), var(--color-alias-color-brand-primary, #1e7d55))",
490
+ display: "flex",
491
+ alignItems: "center",
492
+ justifyContent: "center",
493
+ boxShadow: "0 1px 3px rgba(0,0,0,0.1)"
494
+ },
495
+ children: /* @__PURE__ */ jsx(
496
+ "span",
497
+ {
498
+ style: { color: "#fff", fontSize: "18px", fontWeight: 600 },
499
+ children: firstChar
500
+ }
501
+ )
502
+ }
503
+ ),
504
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
505
+ "p",
506
+ {
507
+ style: {
508
+ fontSize: "14px",
509
+ fontWeight: 600,
510
+ color: "var(--color-alias-color-brand-text-dark, #05010e)",
511
+ margin: 0
512
+ },
513
+ children: [
514
+ "\u0E2A\u0E27\u0E31\u0E2A\u0E14\u0E35,",
515
+ " ",
516
+ /* @__PURE__ */ jsx(
517
+ "span",
518
+ {
519
+ style: {
520
+ color: "var(--color-alias-color-brand-primary, #1e7d55)"
521
+ },
522
+ children: displayName
523
+ }
524
+ )
525
+ ]
526
+ }
527
+ ) })
528
+ ] }),
529
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
530
+ /* @__PURE__ */ jsxs("div", { style: { position: "relative" }, ref: notifRef, children: [
531
+ notificationBell || /* @__PURE__ */ jsxs(
532
+ "button",
533
+ {
534
+ onClick: () => setIsNotifOpen(!isNotifOpen),
535
+ style: {
536
+ padding: "10px",
537
+ borderRadius: "8px",
538
+ border: "none",
539
+ background: "transparent",
540
+ cursor: "pointer",
541
+ position: "relative",
542
+ display: "flex",
543
+ alignItems: "center",
544
+ justifyContent: "center"
545
+ },
546
+ onMouseEnter: (e) => {
547
+ e.currentTarget.style.backgroundColor = "#f3f4f6";
548
+ },
549
+ onMouseLeave: (e) => {
550
+ e.currentTarget.style.backgroundColor = "transparent";
551
+ },
552
+ children: [
553
+ /* @__PURE__ */ jsx(BellIcon, {}),
554
+ unreadCount > 0 && /* @__PURE__ */ jsx(
555
+ "span",
556
+ {
557
+ style: {
558
+ position: "absolute",
559
+ top: "6px",
560
+ right: "6px",
561
+ minWidth: "18px",
562
+ height: "18px",
563
+ background: "var(--color-alias-semantic-critical, #f21515)",
564
+ borderRadius: "50%",
565
+ display: "flex",
566
+ alignItems: "center",
567
+ justifyContent: "center",
568
+ fontSize: "10px",
569
+ fontWeight: 700,
570
+ color: "#fff",
571
+ padding: "0 4px",
572
+ border: "2px solid #fff"
573
+ },
574
+ children: unreadCount
575
+ }
576
+ )
577
+ ]
578
+ }
579
+ ),
580
+ isNotifOpen && /* @__PURE__ */ jsxs(
581
+ "div",
582
+ {
583
+ style: {
584
+ position: "absolute",
585
+ right: 0,
586
+ marginTop: "8px",
587
+ width: "360px",
588
+ background: "#fff",
589
+ borderRadius: "12px",
590
+ boxShadow: "0 10px 40px rgba(0,0,0,0.12)",
591
+ zIndex: 50,
592
+ overflow: "hidden",
593
+ border: "1px solid #e5e7eb"
594
+ },
595
+ children: [
596
+ /* @__PURE__ */ jsxs(
597
+ "div",
598
+ {
599
+ style: {
600
+ padding: "16px",
601
+ borderBottom: "1px solid #f3f4f6",
602
+ display: "flex",
603
+ alignItems: "center",
604
+ justifyContent: "space-between",
605
+ background: "#fafafa"
606
+ },
607
+ children: [
608
+ /* @__PURE__ */ jsx("span", { style: { fontWeight: 600, fontSize: "14px", color: "#111" }, children: "\u0E01\u0E32\u0E23\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19" }),
609
+ onMarkAllRead && /* @__PURE__ */ jsx(
610
+ "button",
611
+ {
612
+ onClick: onMarkAllRead,
613
+ style: {
614
+ fontSize: "12px",
615
+ color: "var(--color-alias-color-brand-primary, #1e7d55)",
616
+ background: "none",
617
+ border: "none",
618
+ cursor: "pointer",
619
+ fontWeight: 500
620
+ },
621
+ children: "\u0E2D\u0E48\u0E32\u0E19\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14"
622
+ }
623
+ )
624
+ ]
625
+ }
626
+ ),
627
+ /* @__PURE__ */ jsx("div", { style: { maxHeight: "60vh", overflowY: "auto" }, children: notifications.length === 0 ? /* @__PURE__ */ jsx(
628
+ "div",
629
+ {
630
+ style: {
631
+ padding: "32px",
632
+ textAlign: "center",
633
+ color: "#9ca3af",
634
+ fontSize: "14px"
635
+ },
636
+ children: "\u{1F514} \u0E44\u0E21\u0E48\u0E21\u0E35\u0E01\u0E32\u0E23\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19\u0E43\u0E2B\u0E21\u0E48"
637
+ }
638
+ ) : notifications.map((item) => /* @__PURE__ */ jsxs(
639
+ "div",
640
+ {
641
+ style: {
642
+ padding: "12px 16px",
643
+ borderBottom: "1px solid #f9fafb",
644
+ cursor: "pointer",
645
+ background: !item.isRead ? "rgba(219,234,254,0.3)" : "transparent",
646
+ position: "relative",
647
+ display: "flex",
648
+ gap: "12px",
649
+ alignItems: "flex-start"
650
+ },
651
+ onMouseEnter: (e) => {
652
+ e.currentTarget.style.backgroundColor = "#f9fafb";
653
+ },
654
+ onMouseLeave: (e) => {
655
+ e.currentTarget.style.backgroundColor = !item.isRead ? "rgba(219,234,254,0.3)" : "transparent";
656
+ },
657
+ children: [
658
+ !item.isRead && /* @__PURE__ */ jsx(
659
+ "span",
660
+ {
661
+ style: {
662
+ position: "absolute",
663
+ top: "12px",
664
+ right: "12px",
665
+ width: "8px",
666
+ height: "8px",
667
+ background: "#ef4444",
668
+ borderRadius: "50%"
669
+ }
670
+ }
671
+ ),
672
+ /* @__PURE__ */ jsx(
673
+ "div",
674
+ {
675
+ style: {
676
+ width: "32px",
677
+ height: "32px",
678
+ borderRadius: "50%",
679
+ background: getNotifBg(item.type),
680
+ display: "flex",
681
+ alignItems: "center",
682
+ justifyContent: "center",
683
+ fontSize: "13px",
684
+ flexShrink: 0,
685
+ marginTop: "2px"
686
+ },
687
+ children: getNotifIcon(item.type)
688
+ }
689
+ ),
690
+ /* @__PURE__ */ jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
691
+ /* @__PURE__ */ jsx(
692
+ "p",
693
+ {
694
+ style: {
695
+ fontSize: "13px",
696
+ fontWeight: !item.isRead ? 600 : 500,
697
+ color: "#111",
698
+ margin: "0 0 2px"
699
+ },
700
+ children: item.title
701
+ }
702
+ ),
703
+ /* @__PURE__ */ jsx(
704
+ "p",
705
+ {
706
+ style: {
707
+ fontSize: "12px",
708
+ color: "#6b7280",
709
+ margin: "0 0 4px",
710
+ lineHeight: "18px"
711
+ },
712
+ children: item.description
713
+ }
714
+ ),
715
+ /* @__PURE__ */ jsx(
716
+ "p",
717
+ {
718
+ style: {
719
+ fontSize: "10px",
720
+ color: "#9ca3af",
721
+ margin: 0,
722
+ fontWeight: 500
723
+ },
724
+ children: item.date
725
+ }
726
+ )
727
+ ] })
728
+ ]
729
+ },
730
+ item.id
731
+ )) }),
732
+ onViewAll && /* @__PURE__ */ jsx(
733
+ "div",
734
+ {
735
+ style: {
736
+ padding: "10px",
737
+ borderTop: "1px solid #f3f4f6",
738
+ textAlign: "center",
739
+ background: "#fafafa"
740
+ },
741
+ children: /* @__PURE__ */ jsx(
742
+ "button",
743
+ {
744
+ onClick: onViewAll,
745
+ style: {
746
+ fontSize: "13px",
747
+ color: "#6b7280",
748
+ background: "none",
749
+ border: "none",
750
+ cursor: "pointer",
751
+ fontWeight: 500,
752
+ width: "100%",
753
+ padding: "4px"
754
+ },
755
+ children: "\u0E14\u0E39\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14"
756
+ }
757
+ )
758
+ }
759
+ )
760
+ ]
761
+ }
762
+ )
763
+ ] }),
764
+ onToggleSidebar && /* @__PURE__ */ jsx(
765
+ "button",
766
+ {
767
+ onClick: onToggleSidebar,
768
+ style: {
769
+ padding: "10px",
770
+ borderRadius: "8px",
771
+ border: "none",
772
+ background: "transparent",
773
+ cursor: "pointer",
774
+ display: "flex",
775
+ alignItems: "center",
776
+ justifyContent: "center"
777
+ },
778
+ onMouseEnter: (e) => {
779
+ e.currentTarget.style.backgroundColor = "#f3f4f6";
780
+ },
781
+ onMouseLeave: (e) => {
782
+ e.currentTarget.style.backgroundColor = "transparent";
783
+ },
784
+ children: /* @__PURE__ */ jsx(HamburgerIcon, {})
785
+ }
786
+ )
787
+ ] })
788
+ ]
789
+ }
790
+ )
791
+ }
792
+ );
793
+ }
794
+ function LogoutIcon2() {
795
+ return /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
796
+ /* @__PURE__ */ jsx("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }),
797
+ /* @__PURE__ */ jsx("polyline", { points: "16 17 21 12 16 7" }),
798
+ /* @__PURE__ */ jsx("line", { x1: "21", y1: "12", x2: "9", y2: "12" })
799
+ ] });
800
+ }
801
+ function UserSidebar({
802
+ user,
803
+ roleLabel,
804
+ menuItems,
805
+ onNavigate,
806
+ onLogout,
807
+ isOpen,
808
+ onClose,
809
+ roleColor = "var(--color-alias-semantic-warning, orange)"
810
+ }) {
811
+ useEffect(() => {
812
+ if (isOpen) {
813
+ document.body.style.overflow = "hidden";
814
+ } else {
815
+ document.body.style.overflow = "";
816
+ }
817
+ return () => {
818
+ document.body.style.overflow = "";
819
+ };
820
+ }, [isOpen]);
821
+ const getFullName = () => {
822
+ if (!user) return "\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49";
823
+ if (user.firstName && user.lastName) return `${user.firstName} ${user.lastName}`;
824
+ return user.firstName || user.lastName || "\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49";
825
+ };
826
+ const getInitial = () => {
827
+ if (!user) return "?";
828
+ return user.firstName?.charAt(0) || user.lastName?.charAt(0) || "?";
829
+ };
830
+ const handleMenuClick = (path) => {
831
+ onNavigate(path);
832
+ onClose();
833
+ };
834
+ const handleLogout = () => {
835
+ onClose();
836
+ onLogout();
837
+ };
838
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
839
+ isOpen && /* @__PURE__ */ jsx(
840
+ "div",
841
+ {
842
+ onClick: onClose,
843
+ style: {
844
+ position: "fixed",
845
+ inset: 0,
846
+ background: "rgba(0,0,0,0.5)",
847
+ zIndex: 40,
848
+ transition: "opacity 0.3s ease"
849
+ }
850
+ }
851
+ ),
852
+ /* @__PURE__ */ jsxs(
853
+ "aside",
854
+ {
855
+ style: {
856
+ position: "fixed",
857
+ top: 0,
858
+ right: 0,
859
+ height: "100%",
860
+ width: "80vw",
861
+ maxWidth: "320px",
862
+ background: "#fff",
863
+ boxShadow: "-4px 0 24px rgba(0,0,0,0.12)",
864
+ zIndex: 50,
865
+ transform: isOpen ? "translateX(0)" : "translateX(100%)",
866
+ transition: "transform 0.3s ease",
867
+ display: "flex",
868
+ flexDirection: "column"
869
+ },
870
+ children: [
871
+ user && /* @__PURE__ */ jsx(
872
+ "div",
873
+ {
874
+ style: {
875
+ padding: "20px",
876
+ borderBottom: "1px solid var(--color-border-colors-neutral, #e5e7eb)"
877
+ },
878
+ children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
879
+ user.pictureUrl ? /* @__PURE__ */ jsx(
880
+ "img",
881
+ {
882
+ src: user.pictureUrl,
883
+ alt: getFullName(),
884
+ style: {
885
+ width: "56px",
886
+ height: "56px",
887
+ borderRadius: "50%",
888
+ objectFit: "cover",
889
+ boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
890
+ }
891
+ }
892
+ ) : /* @__PURE__ */ jsx(
893
+ "div",
894
+ {
895
+ style: {
896
+ width: "56px",
897
+ height: "56px",
898
+ borderRadius: "50%",
899
+ background: "linear-gradient(135deg, var(--color-alias-color-brand-secondary, #80d897), var(--color-alias-color-brand-primary, #1e7d55))",
900
+ display: "flex",
901
+ alignItems: "center",
902
+ justifyContent: "center",
903
+ color: "#fff",
904
+ fontWeight: 700,
905
+ fontSize: "20px",
906
+ boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
907
+ },
908
+ children: getInitial()
909
+ }
910
+ ),
911
+ /* @__PURE__ */ jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
912
+ /* @__PURE__ */ jsx(
913
+ "p",
914
+ {
915
+ style: {
916
+ fontWeight: 700,
917
+ fontSize: "16px",
918
+ color: "var(--color-alias-text-colors-primary, #060d26)",
919
+ margin: 0,
920
+ overflow: "hidden",
921
+ textOverflow: "ellipsis",
922
+ whiteSpace: "nowrap"
923
+ },
924
+ children: getFullName()
925
+ }
926
+ ),
927
+ /* @__PURE__ */ jsxs(
928
+ "p",
929
+ {
930
+ style: {
931
+ fontSize: "13px",
932
+ color: "var(--color-alias-text-colors-tertiary, #6b7280)",
933
+ margin: "2px 0 0",
934
+ display: "flex",
935
+ alignItems: "center",
936
+ gap: "6px"
937
+ },
938
+ children: [
939
+ /* @__PURE__ */ jsx(
940
+ "span",
941
+ {
942
+ style: {
943
+ width: "8px",
944
+ height: "8px",
945
+ borderRadius: "50%",
946
+ background: roleColor,
947
+ display: "inline-block"
948
+ }
949
+ }
950
+ ),
951
+ roleLabel
952
+ ]
953
+ }
954
+ )
955
+ ] })
956
+ ] })
957
+ }
958
+ ),
959
+ /* @__PURE__ */ jsx("nav", { style: { flex: 1, padding: "20px", overflowY: "auto" }, children: /* @__PURE__ */ jsx("ul", { style: { listStyle: "none", margin: 0, padding: 0, display: "flex", flexDirection: "column", gap: "4px" }, children: menuItems.map((item) => /* @__PURE__ */ jsxs("li", { children: [
960
+ /* @__PURE__ */ jsxs(
961
+ "button",
962
+ {
963
+ onClick: () => item.path && handleMenuClick(item.path),
964
+ onMouseEnter: (e) => {
965
+ e.currentTarget.style.backgroundColor = "#f9fafb";
966
+ },
967
+ onMouseLeave: (e) => {
968
+ e.currentTarget.style.backgroundColor = "transparent";
969
+ },
970
+ style: {
971
+ width: "100%",
972
+ display: "flex",
973
+ alignItems: "center",
974
+ gap: "16px",
975
+ padding: "14px 16px",
976
+ borderRadius: "8px",
977
+ border: "none",
978
+ background: "transparent",
979
+ color: "var(--color-alias-text-colors-primary, #374151)",
980
+ cursor: "pointer",
981
+ transition: "background-color 0.15s ease",
982
+ fontSize: "15px",
983
+ fontWeight: 500,
984
+ textAlign: "left"
985
+ },
986
+ children: [
987
+ item.icon && /* @__PURE__ */ jsx(
988
+ "span",
989
+ {
990
+ style: {
991
+ width: "28px",
992
+ height: "28px",
993
+ display: "flex",
994
+ alignItems: "center",
995
+ justifyContent: "center",
996
+ color: "var(--color-alias-text-colors-tertiary, #6b7280)",
997
+ flexShrink: 0
998
+ },
999
+ children: item.icon
1000
+ }
1001
+ ),
1002
+ /* @__PURE__ */ jsx("span", { style: { flex: 1 }, children: item.title })
1003
+ ]
1004
+ }
1005
+ ),
1006
+ item.dividerAfter && /* @__PURE__ */ jsx(
1007
+ "hr",
1008
+ {
1009
+ style: {
1010
+ border: "none",
1011
+ borderTop: "1px solid var(--color-border-colors-neutral, #e5e7eb)",
1012
+ margin: "8px 0"
1013
+ }
1014
+ }
1015
+ )
1016
+ ] }, item.id)) }) }),
1017
+ /* @__PURE__ */ jsx(
1018
+ "div",
1019
+ {
1020
+ style: {
1021
+ padding: "20px",
1022
+ borderTop: "1px solid var(--color-border-colors-neutral, #e5e7eb)"
1023
+ },
1024
+ children: /* @__PURE__ */ jsxs(
1025
+ "button",
1026
+ {
1027
+ onClick: handleLogout,
1028
+ onMouseEnter: (e) => {
1029
+ e.currentTarget.style.backgroundColor = "#fef2f2";
1030
+ },
1031
+ onMouseLeave: (e) => {
1032
+ e.currentTarget.style.backgroundColor = "transparent";
1033
+ },
1034
+ style: {
1035
+ width: "100%",
1036
+ display: "flex",
1037
+ alignItems: "center",
1038
+ gap: "16px",
1039
+ padding: "14px 16px",
1040
+ borderRadius: "8px",
1041
+ border: "none",
1042
+ background: "transparent",
1043
+ color: "var(--color-alias-semantic-critical, #ef4444)",
1044
+ cursor: "pointer",
1045
+ transition: "background-color 0.15s ease",
1046
+ fontSize: "15px",
1047
+ fontWeight: 500
1048
+ },
1049
+ children: [
1050
+ /* @__PURE__ */ jsx(LogoutIcon2, {}),
1051
+ /* @__PURE__ */ jsx("span", { children: "\u0E2D\u0E2D\u0E01\u0E08\u0E32\u0E01\u0E23\u0E30\u0E1A\u0E1A" })
1052
+ ]
1053
+ }
1054
+ )
1055
+ }
1056
+ )
1057
+ ]
1058
+ }
1059
+ )
1060
+ ] });
1061
+ }
1062
+
1063
+ export { SidebarHeader, SidebarMenu, SidebarUserProfile, StaffSidebar, UserHeader, UserSidebar };
1064
+ //# sourceMappingURL=index.mjs.map
1065
+ //# sourceMappingURL=index.mjs.map