gov-layout 1.2.13 → 1.2.14
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 +79 -82
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +80 -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
|
|
@@ -439,6 +439,7 @@ function MenuItemComponent({
|
|
|
439
439
|
const [userToggled, setUserToggled] = useState(false);
|
|
440
440
|
const [isOpen, setIsOpen] = useState(isChildActive);
|
|
441
441
|
const expanded = userToggled ? isOpen : isOpen || isChildActive;
|
|
442
|
+
const btnId = useId();
|
|
442
443
|
const handleClick = () => {
|
|
443
444
|
if (hasChildren) {
|
|
444
445
|
if (collapsed) {
|
|
@@ -457,17 +458,14 @@ function MenuItemComponent({
|
|
|
457
458
|
const hoverBg = isDark ? "#334155" : "var(--color-foundations-fuji-pallet-light, #ebedf5)";
|
|
458
459
|
if (collapsed && depth === 0) {
|
|
459
460
|
return /* @__PURE__ */ jsxs("li", { children: [
|
|
461
|
+
/* @__PURE__ */ jsx("style", { children: `@media(hover:hover){.sidebar-btn-${CSS.escape(btnId)}:not([data-active='true']):hover{background-color:${hoverBg}!important}}` }),
|
|
460
462
|
/* @__PURE__ */ jsx(
|
|
461
463
|
"button",
|
|
462
464
|
{
|
|
465
|
+
className: `sidebar-btn-${CSS.escape(btnId)}`,
|
|
466
|
+
"data-active": isActive || isChildActive,
|
|
463
467
|
onClick: handleClick,
|
|
464
468
|
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
469
|
style: {
|
|
472
470
|
width: "100%",
|
|
473
471
|
display: "flex",
|
|
@@ -479,7 +477,8 @@ function MenuItemComponent({
|
|
|
479
477
|
background: isActive || isChildActive ? `color-mix(in srgb, ${activeColor} 10%, transparent)` : "transparent",
|
|
480
478
|
color: isActive || isChildActive ? activeColor : isDark ? "#ffffff" : "var(--color-alias-text-colors-tertiary, #475272)",
|
|
481
479
|
cursor: "pointer",
|
|
482
|
-
transition: "background-color 0.15s ease"
|
|
480
|
+
transition: "background-color 0.15s ease",
|
|
481
|
+
WebkitTapHighlightColor: "transparent"
|
|
483
482
|
},
|
|
484
483
|
children: /* @__PURE__ */ jsx("span", { style: {
|
|
485
484
|
width: "24px",
|
|
@@ -498,48 +497,48 @@ function MenuItemComponent({
|
|
|
498
497
|
] });
|
|
499
498
|
}
|
|
500
499
|
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",
|
|
500
|
+
/* @__PURE__ */ jsxs("li", { children: [
|
|
501
|
+
/* @__PURE__ */ jsx("style", { children: `@media(hover:hover){.sidebar-btn-${CSS.escape(btnId)}:not([data-active='true']):hover{background-color:${hoverBg}!important}}` }),
|
|
502
|
+
/* @__PURE__ */ jsxs(
|
|
503
|
+
"button",
|
|
504
|
+
{
|
|
505
|
+
className: `sidebar-btn-${CSS.escape(btnId)}`,
|
|
506
|
+
"data-active": isActive,
|
|
507
|
+
onClick: handleClick,
|
|
508
|
+
style: {
|
|
509
|
+
width: "100%",
|
|
532
510
|
display: "flex",
|
|
533
511
|
alignItems: "center",
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
512
|
+
gap: "12px",
|
|
513
|
+
padding: depth > 0 ? "10px 16px 10px 52px" : "12px 16px",
|
|
514
|
+
borderRadius: "8px",
|
|
515
|
+
border: "none",
|
|
516
|
+
background: isActive ? `color-mix(in srgb, ${activeColor} 10%, transparent)` : "transparent",
|
|
517
|
+
color: isActive ? activeColor : isDark ? "#ffffff" : "var(--color-alias-text-colors-primary, #060d26)",
|
|
518
|
+
cursor: "pointer",
|
|
519
|
+
transition: "background-color 0.15s ease",
|
|
520
|
+
textAlign: "left",
|
|
521
|
+
fontSize: "15px",
|
|
522
|
+
fontWeight: isActive ? 600 : 400,
|
|
523
|
+
lineHeight: "22px",
|
|
524
|
+
WebkitTapHighlightColor: "transparent"
|
|
525
|
+
},
|
|
526
|
+
children: [
|
|
527
|
+
/* @__PURE__ */ jsx("span", { style: {
|
|
528
|
+
width: "24px",
|
|
529
|
+
height: "24px",
|
|
530
|
+
display: "flex",
|
|
531
|
+
alignItems: "center",
|
|
532
|
+
justifyContent: "center",
|
|
533
|
+
flexShrink: 0,
|
|
534
|
+
color: isActive ? activeColor : isDark ? "#e2e8f0" : "var(--color-alias-text-colors-tertiary, #475272)"
|
|
535
|
+
}, children: resolvedIcon }),
|
|
536
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1 }, children: item.title }),
|
|
537
|
+
hasChildren && /* @__PURE__ */ jsx(ChevronDownIcon, { isOpen: expanded })
|
|
538
|
+
]
|
|
539
|
+
}
|
|
540
|
+
)
|
|
541
|
+
] }),
|
|
543
542
|
hasChildren && expanded && /* @__PURE__ */ jsx("ul", { style: { listStyle: "none", margin: 0, padding: 0 }, children: item.children.map((child) => /* @__PURE__ */ jsx(
|
|
544
543
|
MenuItemComponent,
|
|
545
544
|
{
|
|
@@ -559,8 +558,7 @@ function MenuItemComponent({
|
|
|
559
558
|
}
|
|
560
559
|
function SidebarMenu({ menuItems, onItemClick, currentPath, collapsed, onExpandRequest }) {
|
|
561
560
|
return /* @__PURE__ */ jsx("nav", { style: {
|
|
562
|
-
padding: collapsed ? "8px 8px" : "8px 12px"
|
|
563
|
-
overflowY: "auto"
|
|
561
|
+
padding: collapsed ? "8px 8px" : "8px 12px"
|
|
564
562
|
}, children: /* @__PURE__ */ jsx("ul", { style: {
|
|
565
563
|
listStyle: "none",
|
|
566
564
|
margin: 0,
|
|
@@ -1039,39 +1037,38 @@ function StaffSidebar({
|
|
|
1039
1037
|
]
|
|
1040
1038
|
}
|
|
1041
1039
|
),
|
|
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
|
-
)
|
|
1040
|
+
collapsible && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1041
|
+
/* @__PURE__ */ jsx("style", { children: `@media(hover:hover){.sidebar-toggle-btn:hover{background-color:${isDark ? "#374151" : "#f3f4f6"}!important}}` }),
|
|
1042
|
+
/* @__PURE__ */ jsx(
|
|
1043
|
+
"button",
|
|
1044
|
+
{
|
|
1045
|
+
className: "sidebar-toggle-btn",
|
|
1046
|
+
onClick: handleToggle,
|
|
1047
|
+
title: sidebarOpen ? "\u0E22\u0E48\u0E2D Sidebar" : "\u0E02\u0E22\u0E32\u0E22 Sidebar",
|
|
1048
|
+
style: {
|
|
1049
|
+
position: "fixed",
|
|
1050
|
+
top: "10%",
|
|
1051
|
+
left: currentWidth,
|
|
1052
|
+
zIndex: 41,
|
|
1053
|
+
width: "24px",
|
|
1054
|
+
height: "40px",
|
|
1055
|
+
borderRadius: "0 6px 6px 0",
|
|
1056
|
+
border: `1px solid ${isDark ? "#374151" : "var(--color-border-colors-neutral, #c8cedd)"}`,
|
|
1057
|
+
borderLeft: "none",
|
|
1058
|
+
background: isDark ? "#1e293b" : "#fff",
|
|
1059
|
+
cursor: "pointer",
|
|
1060
|
+
display: "flex",
|
|
1061
|
+
alignItems: "center",
|
|
1062
|
+
justifyContent: "center",
|
|
1063
|
+
boxShadow: isDark ? "2px 0 8px rgba(0,0,0,0.3)" : "2px 0 8px rgba(0,0,0,0.06)",
|
|
1064
|
+
transition: "left 0.3s ease",
|
|
1065
|
+
color: isDark ? "#ffffff" : "var(--color-alias-text-colors-tertiary, #475272)",
|
|
1066
|
+
WebkitTapHighlightColor: "transparent"
|
|
1067
|
+
},
|
|
1068
|
+
children: /* @__PURE__ */ jsx(ToggleIcon, { isOpen: sidebarOpen })
|
|
1069
|
+
}
|
|
1070
|
+
)
|
|
1071
|
+
] })
|
|
1075
1072
|
] });
|
|
1076
1073
|
}
|
|
1077
1074
|
function BellIcon2() {
|