gov-layout 1.2.13 → 1.2.15
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.js +85 -82
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +86 -83
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createContext, useState, useEffect, useRef, useCallback, useContext } from 'react';
|
|
1
|
+
import { createContext, useState, useEffect, useRef, useCallback, useContext, useId } from 'react';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
4
|
// src/sidebar/StaffSidebar.tsx
|
|
@@ -306,6 +306,12 @@ function TrashIcon({ size = 20, className, style } = {}) {
|
|
|
306
306
|
/* @__PURE__ */ jsx("line", { x1: "14", y1: "11", x2: "14", y2: "17" })
|
|
307
307
|
] });
|
|
308
308
|
}
|
|
309
|
+
var safeCssEscape = (value) => {
|
|
310
|
+
if (typeof CSS !== "undefined" && CSS.escape) {
|
|
311
|
+
return CSS.escape(value);
|
|
312
|
+
}
|
|
313
|
+
return value.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
314
|
+
};
|
|
309
315
|
var ICON_MAP = {
|
|
310
316
|
home: HomeIcon,
|
|
311
317
|
dashboard: HomeIcon,
|
|
@@ -439,6 +445,7 @@ function MenuItemComponent({
|
|
|
439
445
|
const [userToggled, setUserToggled] = useState(false);
|
|
440
446
|
const [isOpen, setIsOpen] = useState(isChildActive);
|
|
441
447
|
const expanded = userToggled ? isOpen : isOpen || isChildActive;
|
|
448
|
+
const btnId = useId();
|
|
442
449
|
const handleClick = () => {
|
|
443
450
|
if (hasChildren) {
|
|
444
451
|
if (collapsed) {
|
|
@@ -457,17 +464,14 @@ function MenuItemComponent({
|
|
|
457
464
|
const hoverBg = isDark ? "#334155" : "var(--color-foundations-fuji-pallet-light, #ebedf5)";
|
|
458
465
|
if (collapsed && depth === 0) {
|
|
459
466
|
return /* @__PURE__ */ jsxs("li", { children: [
|
|
467
|
+
/* @__PURE__ */ jsx("style", { children: `@media(hover:hover){.sidebar-btn-${safeCssEscape(btnId)}:not([data-active='true']):hover{background-color:${hoverBg}!important}}` }),
|
|
460
468
|
/* @__PURE__ */ jsx(
|
|
461
469
|
"button",
|
|
462
470
|
{
|
|
471
|
+
className: `sidebar-btn-${safeCssEscape(btnId)}`,
|
|
472
|
+
"data-active": isActive || isChildActive,
|
|
463
473
|
onClick: handleClick,
|
|
464
474
|
title: item.title,
|
|
465
|
-
onMouseEnter: (e) => {
|
|
466
|
-
if (!isActive) e.currentTarget.style.backgroundColor = hoverBg;
|
|
467
|
-
},
|
|
468
|
-
onMouseLeave: (e) => {
|
|
469
|
-
if (!isActive) e.currentTarget.style.backgroundColor = "transparent";
|
|
470
|
-
},
|
|
471
475
|
style: {
|
|
472
476
|
width: "100%",
|
|
473
477
|
display: "flex",
|
|
@@ -479,7 +483,8 @@ function MenuItemComponent({
|
|
|
479
483
|
background: isActive || isChildActive ? `color-mix(in srgb, ${activeColor} 10%, transparent)` : "transparent",
|
|
480
484
|
color: isActive || isChildActive ? activeColor : isDark ? "#ffffff" : "var(--color-alias-text-colors-tertiary, #475272)",
|
|
481
485
|
cursor: "pointer",
|
|
482
|
-
transition: "background-color 0.15s ease"
|
|
486
|
+
transition: "background-color 0.15s ease",
|
|
487
|
+
WebkitTapHighlightColor: "transparent"
|
|
483
488
|
},
|
|
484
489
|
children: /* @__PURE__ */ jsx("span", { style: {
|
|
485
490
|
width: "24px",
|
|
@@ -498,48 +503,48 @@ function MenuItemComponent({
|
|
|
498
503
|
] });
|
|
499
504
|
}
|
|
500
505
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
501
|
-
/* @__PURE__ */
|
|
502
|
-
"
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
style: {
|
|
512
|
-
width: "100%",
|
|
513
|
-
display: "flex",
|
|
514
|
-
alignItems: "center",
|
|
515
|
-
gap: "12px",
|
|
516
|
-
padding: depth > 0 ? "10px 16px 10px 52px" : "12px 16px",
|
|
517
|
-
borderRadius: "8px",
|
|
518
|
-
border: "none",
|
|
519
|
-
background: isActive ? `color-mix(in srgb, ${activeColor} 10%, transparent)` : "transparent",
|
|
520
|
-
color: isActive ? activeColor : isDark ? "#ffffff" : "var(--color-alias-text-colors-primary, #060d26)",
|
|
521
|
-
cursor: "pointer",
|
|
522
|
-
transition: "background-color 0.15s ease",
|
|
523
|
-
textAlign: "left",
|
|
524
|
-
fontSize: "15px",
|
|
525
|
-
fontWeight: isActive ? 600 : 400,
|
|
526
|
-
lineHeight: "22px"
|
|
527
|
-
},
|
|
528
|
-
children: [
|
|
529
|
-
/* @__PURE__ */ jsx("span", { style: {
|
|
530
|
-
width: "24px",
|
|
531
|
-
height: "24px",
|
|
506
|
+
/* @__PURE__ */ jsxs("li", { children: [
|
|
507
|
+
/* @__PURE__ */ jsx("style", { children: `@media(hover:hover){.sidebar-btn-${safeCssEscape(btnId)}:not([data-active='true']):hover{background-color:${hoverBg}!important}}` }),
|
|
508
|
+
/* @__PURE__ */ jsxs(
|
|
509
|
+
"button",
|
|
510
|
+
{
|
|
511
|
+
className: `sidebar-btn-${safeCssEscape(btnId)}`,
|
|
512
|
+
"data-active": isActive,
|
|
513
|
+
onClick: handleClick,
|
|
514
|
+
style: {
|
|
515
|
+
width: "100%",
|
|
532
516
|
display: "flex",
|
|
533
517
|
alignItems: "center",
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
518
|
+
gap: "12px",
|
|
519
|
+
padding: depth > 0 ? "10px 16px 10px 52px" : "12px 16px",
|
|
520
|
+
borderRadius: "8px",
|
|
521
|
+
border: "none",
|
|
522
|
+
background: isActive ? `color-mix(in srgb, ${activeColor} 10%, transparent)` : "transparent",
|
|
523
|
+
color: isActive ? activeColor : isDark ? "#ffffff" : "var(--color-alias-text-colors-primary, #060d26)",
|
|
524
|
+
cursor: "pointer",
|
|
525
|
+
transition: "background-color 0.15s ease",
|
|
526
|
+
textAlign: "left",
|
|
527
|
+
fontSize: "15px",
|
|
528
|
+
fontWeight: isActive ? 600 : 400,
|
|
529
|
+
lineHeight: "22px",
|
|
530
|
+
WebkitTapHighlightColor: "transparent"
|
|
531
|
+
},
|
|
532
|
+
children: [
|
|
533
|
+
/* @__PURE__ */ jsx("span", { style: {
|
|
534
|
+
width: "24px",
|
|
535
|
+
height: "24px",
|
|
536
|
+
display: "flex",
|
|
537
|
+
alignItems: "center",
|
|
538
|
+
justifyContent: "center",
|
|
539
|
+
flexShrink: 0,
|
|
540
|
+
color: isActive ? activeColor : isDark ? "#e2e8f0" : "var(--color-alias-text-colors-tertiary, #475272)"
|
|
541
|
+
}, children: resolvedIcon }),
|
|
542
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1 }, children: item.title }),
|
|
543
|
+
hasChildren && /* @__PURE__ */ jsx(ChevronDownIcon, { isOpen: expanded })
|
|
544
|
+
]
|
|
545
|
+
}
|
|
546
|
+
)
|
|
547
|
+
] }),
|
|
543
548
|
hasChildren && expanded && /* @__PURE__ */ jsx("ul", { style: { listStyle: "none", margin: 0, padding: 0 }, children: item.children.map((child) => /* @__PURE__ */ jsx(
|
|
544
549
|
MenuItemComponent,
|
|
545
550
|
{
|
|
@@ -559,8 +564,7 @@ function MenuItemComponent({
|
|
|
559
564
|
}
|
|
560
565
|
function SidebarMenu({ menuItems, onItemClick, currentPath, collapsed, onExpandRequest }) {
|
|
561
566
|
return /* @__PURE__ */ jsx("nav", { style: {
|
|
562
|
-
padding: collapsed ? "8px 8px" : "8px 12px"
|
|
563
|
-
overflowY: "auto"
|
|
567
|
+
padding: collapsed ? "8px 8px" : "8px 12px"
|
|
564
568
|
}, children: /* @__PURE__ */ jsx("ul", { style: {
|
|
565
569
|
listStyle: "none",
|
|
566
570
|
margin: 0,
|
|
@@ -1039,39 +1043,38 @@ function StaffSidebar({
|
|
|
1039
1043
|
]
|
|
1040
1044
|
}
|
|
1041
1045
|
),
|
|
1042
|
-
collapsible && /* @__PURE__ */
|
|
1043
|
-
"
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
)
|
|
1046
|
+
collapsible && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1047
|
+
/* @__PURE__ */ jsx("style", { children: `@media(hover:hover){.sidebar-toggle-btn:hover{background-color:${isDark ? "#374151" : "#f3f4f6"}!important}}` }),
|
|
1048
|
+
/* @__PURE__ */ jsx(
|
|
1049
|
+
"button",
|
|
1050
|
+
{
|
|
1051
|
+
className: "sidebar-toggle-btn",
|
|
1052
|
+
onClick: handleToggle,
|
|
1053
|
+
title: sidebarOpen ? "\u0E22\u0E48\u0E2D Sidebar" : "\u0E02\u0E22\u0E32\u0E22 Sidebar",
|
|
1054
|
+
style: {
|
|
1055
|
+
position: "fixed",
|
|
1056
|
+
top: "10%",
|
|
1057
|
+
left: currentWidth,
|
|
1058
|
+
zIndex: 41,
|
|
1059
|
+
width: "24px",
|
|
1060
|
+
height: "40px",
|
|
1061
|
+
borderRadius: "0 6px 6px 0",
|
|
1062
|
+
border: `1px solid ${isDark ? "#374151" : "var(--color-border-colors-neutral, #c8cedd)"}`,
|
|
1063
|
+
borderLeft: "none",
|
|
1064
|
+
background: isDark ? "#1e293b" : "#fff",
|
|
1065
|
+
cursor: "pointer",
|
|
1066
|
+
display: "flex",
|
|
1067
|
+
alignItems: "center",
|
|
1068
|
+
justifyContent: "center",
|
|
1069
|
+
boxShadow: isDark ? "2px 0 8px rgba(0,0,0,0.3)" : "2px 0 8px rgba(0,0,0,0.06)",
|
|
1070
|
+
transition: "left 0.3s ease",
|
|
1071
|
+
color: isDark ? "#ffffff" : "var(--color-alias-text-colors-tertiary, #475272)",
|
|
1072
|
+
WebkitTapHighlightColor: "transparent"
|
|
1073
|
+
},
|
|
1074
|
+
children: /* @__PURE__ */ jsx(ToggleIcon, { isOpen: sidebarOpen })
|
|
1075
|
+
}
|
|
1076
|
+
)
|
|
1077
|
+
] })
|
|
1075
1078
|
] });
|
|
1076
1079
|
}
|
|
1077
1080
|
function BellIcon2() {
|