@scripso-homepad/ui 0.4.25 → 0.4.26
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/web/index.cjs +127 -53
- package/dist/web/index.cjs.map +1 -1
- package/dist/web/index.js +127 -53
- package/dist/web/index.js.map +1 -1
- package/package.json +1 -1
- package/src/web/layout/Sidebar.tsx +20 -21
- package/src/web/layout/SidebarNavItem.tsx +2 -2
- package/src/web/layout/SidebarUserCard.tsx +99 -20
package/dist/web/index.cjs
CHANGED
|
@@ -7408,7 +7408,7 @@ var require_react_dom_development = __commonJS({
|
|
|
7408
7408
|
var HostPortal = 4;
|
|
7409
7409
|
var HostComponent = 5;
|
|
7410
7410
|
var HostText = 6;
|
|
7411
|
-
var
|
|
7411
|
+
var Fragment3 = 7;
|
|
7412
7412
|
var Mode = 8;
|
|
7413
7413
|
var ContextConsumer = 9;
|
|
7414
7414
|
var ContextProvider = 10;
|
|
@@ -8563,7 +8563,7 @@ var require_react_dom_development = __commonJS({
|
|
|
8563
8563
|
return "DehydratedFragment";
|
|
8564
8564
|
case ForwardRef:
|
|
8565
8565
|
return getWrappedName$1(type, type.render, "ForwardRef");
|
|
8566
|
-
case
|
|
8566
|
+
case Fragment3:
|
|
8567
8567
|
return "Fragment";
|
|
8568
8568
|
case HostComponent:
|
|
8569
8569
|
return type;
|
|
@@ -16988,7 +16988,7 @@ var require_react_dom_development = __commonJS({
|
|
|
16988
16988
|
}
|
|
16989
16989
|
}
|
|
16990
16990
|
function updateFragment2(returnFiber, current2, fragment, lanes, key) {
|
|
16991
|
-
if (current2 === null || current2.tag !==
|
|
16991
|
+
if (current2 === null || current2.tag !== Fragment3) {
|
|
16992
16992
|
var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
|
|
16993
16993
|
created.return = returnFiber;
|
|
16994
16994
|
return created;
|
|
@@ -17391,7 +17391,7 @@ var require_react_dom_development = __commonJS({
|
|
|
17391
17391
|
if (child.key === key) {
|
|
17392
17392
|
var elementType = element.type;
|
|
17393
17393
|
if (elementType === REACT_FRAGMENT_TYPE) {
|
|
17394
|
-
if (child.tag ===
|
|
17394
|
+
if (child.tag === Fragment3) {
|
|
17395
17395
|
deleteRemainingChildren(returnFiber, child.sibling);
|
|
17396
17396
|
var existing = useFiber(child, element.props.children);
|
|
17397
17397
|
existing.return = returnFiber;
|
|
@@ -22865,7 +22865,7 @@ var require_react_dom_development = __commonJS({
|
|
|
22865
22865
|
var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
|
|
22866
22866
|
return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
|
|
22867
22867
|
}
|
|
22868
|
-
case
|
|
22868
|
+
case Fragment3:
|
|
22869
22869
|
return updateFragment(current2, workInProgress2, renderLanes2);
|
|
22870
22870
|
case Mode:
|
|
22871
22871
|
return updateMode(current2, workInProgress2, renderLanes2);
|
|
@@ -23137,7 +23137,7 @@ var require_react_dom_development = __commonJS({
|
|
|
23137
23137
|
case SimpleMemoComponent:
|
|
23138
23138
|
case FunctionComponent:
|
|
23139
23139
|
case ForwardRef:
|
|
23140
|
-
case
|
|
23140
|
+
case Fragment3:
|
|
23141
23141
|
case Mode:
|
|
23142
23142
|
case Profiler:
|
|
23143
23143
|
case ContextConsumer:
|
|
@@ -27389,7 +27389,7 @@ var require_react_dom_development = __commonJS({
|
|
|
27389
27389
|
return fiber;
|
|
27390
27390
|
}
|
|
27391
27391
|
function createFiberFromFragment(elements, mode, lanes, key) {
|
|
27392
|
-
var fiber = createFiber(
|
|
27392
|
+
var fiber = createFiber(Fragment3, elements, key, mode);
|
|
27393
27393
|
fiber.lanes = lanes;
|
|
27394
27394
|
return fiber;
|
|
27395
27395
|
}
|
|
@@ -29545,9 +29545,9 @@ function SidebarNavItem({ item, isOpen, isActive, onNavigate }) {
|
|
|
29545
29545
|
tabIndex: item.disabled ? -1 : void 0,
|
|
29546
29546
|
className: cn(
|
|
29547
29547
|
"relative flex items-center rounded-xl px-4 py-3 transition-[background-color,color,gap,padding] duration-300 ease-in-out",
|
|
29548
|
-
isOpen ? "w-full gap-4" : "justify-center gap-0 px-3",
|
|
29548
|
+
isOpen ? "w-full gap-4" : "w-full justify-center gap-0 px-3",
|
|
29549
29549
|
item.disabled && "pointer-events-none opacity-50",
|
|
29550
|
-
isActive ? "bg-black/12 text-white" : "text-navy-100 hover:bg-white/5"
|
|
29550
|
+
isActive ? "bg-black/12 text-white shadow-none" : "text-navy-100 shadow-none hover:bg-white/5"
|
|
29551
29551
|
),
|
|
29552
29552
|
children: [
|
|
29553
29553
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -29582,6 +29582,7 @@ function getInitials(fullName, email) {
|
|
|
29582
29582
|
}
|
|
29583
29583
|
return email.slice(0, 2).toUpperCase();
|
|
29584
29584
|
}
|
|
29585
|
+
var avatarCircleClassName = "flex size-11 shrink-0 items-center justify-center rounded-full bg-white/5";
|
|
29585
29586
|
function SidebarUserCard({
|
|
29586
29587
|
user,
|
|
29587
29588
|
isOpen,
|
|
@@ -29590,39 +29591,110 @@ function SidebarUserCard({
|
|
|
29590
29591
|
className
|
|
29591
29592
|
}) {
|
|
29592
29593
|
const initials = user.initials ?? getInitials(user.fullName, user.email);
|
|
29594
|
+
const [logoutOpen, setLogoutOpen] = react.useState(false);
|
|
29595
|
+
const rootRef = react.useRef(null);
|
|
29596
|
+
const logoutMenuId = react.useId();
|
|
29597
|
+
react.useEffect(() => {
|
|
29598
|
+
if (isOpen) {
|
|
29599
|
+
setLogoutOpen(false);
|
|
29600
|
+
}
|
|
29601
|
+
}, [isOpen]);
|
|
29602
|
+
react.useEffect(() => {
|
|
29603
|
+
if (isOpen || !logoutOpen) {
|
|
29604
|
+
return;
|
|
29605
|
+
}
|
|
29606
|
+
function handlePointerDown(event) {
|
|
29607
|
+
if (rootRef.current && !rootRef.current.contains(event.target)) {
|
|
29608
|
+
setLogoutOpen(false);
|
|
29609
|
+
}
|
|
29610
|
+
}
|
|
29611
|
+
function handleKeyDown(event) {
|
|
29612
|
+
if (event.key === "Escape") {
|
|
29613
|
+
setLogoutOpen(false);
|
|
29614
|
+
}
|
|
29615
|
+
}
|
|
29616
|
+
document.addEventListener("mousedown", handlePointerDown);
|
|
29617
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
29618
|
+
return () => {
|
|
29619
|
+
document.removeEventListener("mousedown", handlePointerDown);
|
|
29620
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
29621
|
+
};
|
|
29622
|
+
}, [isOpen, logoutOpen]);
|
|
29623
|
+
const avatar = /* @__PURE__ */ jsxRuntime.jsx(
|
|
29624
|
+
"div",
|
|
29625
|
+
{
|
|
29626
|
+
className: cn(avatarCircleClassName, "typography-14 font-bold text-white"),
|
|
29627
|
+
"aria-hidden": true,
|
|
29628
|
+
children: initials
|
|
29629
|
+
}
|
|
29630
|
+
);
|
|
29631
|
+
if (!isOpen) {
|
|
29632
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
29633
|
+
"div",
|
|
29634
|
+
{
|
|
29635
|
+
ref: rootRef,
|
|
29636
|
+
className: cn("flex w-full flex-col items-center gap-2", className),
|
|
29637
|
+
children: [
|
|
29638
|
+
logoutOpen ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
29639
|
+
"button",
|
|
29640
|
+
{
|
|
29641
|
+
type: "button",
|
|
29642
|
+
id: logoutMenuId,
|
|
29643
|
+
onClick: () => {
|
|
29644
|
+
setLogoutOpen(false);
|
|
29645
|
+
onLogout?.();
|
|
29646
|
+
},
|
|
29647
|
+
className: cn(
|
|
29648
|
+
avatarCircleClassName,
|
|
29649
|
+
"cursor-pointer bg-black/20 text-white",
|
|
29650
|
+
"transition-[background-color,transform] duration-300 ease-in-out",
|
|
29651
|
+
"hover:bg-white/10 active:scale-95"
|
|
29652
|
+
),
|
|
29653
|
+
"aria-label": logoutLabel,
|
|
29654
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LogOut, { size: 20, strokeWidth: 1.75 })
|
|
29655
|
+
}
|
|
29656
|
+
) : null,
|
|
29657
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
29658
|
+
"button",
|
|
29659
|
+
{
|
|
29660
|
+
type: "button",
|
|
29661
|
+
onClick: () => setLogoutOpen((open) => !open),
|
|
29662
|
+
className: "flex cursor-pointer items-center justify-center transition-transform duration-300 ease-in-out active:scale-95",
|
|
29663
|
+
"aria-expanded": logoutOpen,
|
|
29664
|
+
"aria-haspopup": "true",
|
|
29665
|
+
"aria-controls": logoutOpen ? logoutMenuId : void 0,
|
|
29666
|
+
"aria-label": user.fullName,
|
|
29667
|
+
children: avatar
|
|
29668
|
+
}
|
|
29669
|
+
)
|
|
29670
|
+
]
|
|
29671
|
+
}
|
|
29672
|
+
);
|
|
29673
|
+
}
|
|
29593
29674
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
29594
29675
|
"div",
|
|
29595
29676
|
{
|
|
29596
29677
|
className: cn(
|
|
29597
|
-
"flex w-full items-center
|
|
29598
|
-
|
|
29678
|
+
"flex w-full items-center justify-between gap-3 rounded-xl bg-black/12 p-3",
|
|
29679
|
+
"transition-[background-color,justify-content,gap,padding] duration-300 ease-in-out",
|
|
29599
29680
|
className
|
|
29600
29681
|
),
|
|
29601
29682
|
children: [
|
|
29683
|
+
avatar,
|
|
29684
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-1 flex-col overflow-hidden", children: [
|
|
29685
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate typography-14 font-bold text-white", children: user.fullName }),
|
|
29686
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate typography-12 text-storm-gray-100", children: user.email })
|
|
29687
|
+
] }),
|
|
29602
29688
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
29603
|
-
"
|
|
29689
|
+
"button",
|
|
29604
29690
|
{
|
|
29605
|
-
|
|
29606
|
-
|
|
29607
|
-
|
|
29691
|
+
type: "button",
|
|
29692
|
+
onClick: () => onLogout?.(),
|
|
29693
|
+
className: "shrink-0 cursor-pointer text-navy-150 transition-[opacity,transform] duration-300 ease-in-out hover:opacity-80 active:scale-95",
|
|
29694
|
+
"aria-label": logoutLabel,
|
|
29695
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LogOut, { size: 20, strokeWidth: 1.75 })
|
|
29608
29696
|
}
|
|
29609
|
-
)
|
|
29610
|
-
isOpen ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
29611
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-1 flex-col overflow-hidden", children: [
|
|
29612
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate typography-14 font-bold text-white", children: user.fullName }),
|
|
29613
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate typography-12 text-storm-gray-100", children: user.email })
|
|
29614
|
-
] }),
|
|
29615
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
29616
|
-
"button",
|
|
29617
|
-
{
|
|
29618
|
-
type: "button",
|
|
29619
|
-
onClick: () => onLogout?.(),
|
|
29620
|
-
className: "shrink-0 cursor-pointer text-navy-150 transition-[opacity,transform] duration-300 ease-in-out hover:opacity-80 active:scale-95",
|
|
29621
|
-
"aria-label": logoutLabel,
|
|
29622
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LogOut, { size: 20, strokeWidth: 1.75 })
|
|
29623
|
-
}
|
|
29624
|
-
)
|
|
29625
|
-
] }) : null
|
|
29697
|
+
)
|
|
29626
29698
|
]
|
|
29627
29699
|
}
|
|
29628
29700
|
);
|
|
@@ -29780,18 +29852,8 @@ function Sidebar({
|
|
|
29780
29852
|
]
|
|
29781
29853
|
}
|
|
29782
29854
|
),
|
|
29783
|
-
/* @__PURE__ */ jsxRuntime.
|
|
29784
|
-
|
|
29785
|
-
{
|
|
29786
|
-
item,
|
|
29787
|
-
isOpen: isExpanded,
|
|
29788
|
-
isActive: isNavItemActive(pathname, item),
|
|
29789
|
-
onNavigate: handleNavItemNavigate
|
|
29790
|
-
},
|
|
29791
|
-
item.to
|
|
29792
|
-
)) }),
|
|
29793
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full flex-col gap-4", children: [
|
|
29794
|
-
visibleFooterNavItems.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
29855
|
+
/* @__PURE__ */ jsxRuntime.jsxs("nav", { className: "flex w-full min-h-0 flex-1 flex-col gap-2 overflow-x-hidden overflow-y-auto", children: [
|
|
29856
|
+
visibleNavItems.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
29795
29857
|
SidebarNavItem,
|
|
29796
29858
|
{
|
|
29797
29859
|
item,
|
|
@@ -29801,15 +29863,27 @@ function Sidebar({
|
|
|
29801
29863
|
},
|
|
29802
29864
|
item.to
|
|
29803
29865
|
)),
|
|
29804
|
-
|
|
29805
|
-
|
|
29806
|
-
|
|
29807
|
-
|
|
29808
|
-
|
|
29809
|
-
|
|
29810
|
-
|
|
29811
|
-
|
|
29812
|
-
|
|
29866
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-auto flex w-full flex-col gap-2", children: [
|
|
29867
|
+
visibleFooterNavItems.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
29868
|
+
SidebarNavItem,
|
|
29869
|
+
{
|
|
29870
|
+
item,
|
|
29871
|
+
isOpen: isExpanded,
|
|
29872
|
+
isActive: isNavItemActive(pathname, item),
|
|
29873
|
+
onNavigate: handleNavItemNavigate
|
|
29874
|
+
},
|
|
29875
|
+
item.to
|
|
29876
|
+
)),
|
|
29877
|
+
user ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
29878
|
+
SidebarUserCard,
|
|
29879
|
+
{
|
|
29880
|
+
user,
|
|
29881
|
+
isOpen: isExpanded,
|
|
29882
|
+
logoutLabel: labels.logout,
|
|
29883
|
+
onLogout
|
|
29884
|
+
}
|
|
29885
|
+
) : null
|
|
29886
|
+
] })
|
|
29813
29887
|
] })
|
|
29814
29888
|
]
|
|
29815
29889
|
}
|