@eintrek/erp-shell 0.1.43 → 0.1.45
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.esm.js +21 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +21 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1106,7 +1106,7 @@ function NavMain({ items, orgCode, closeOnNavigation = false, approvalCounts, })
|
|
|
1106
1106
|
// is active (so parent+child don't both light up).
|
|
1107
1107
|
const isItemActive = pathname === itemUrl && !hasActiveSubItem;
|
|
1108
1108
|
item.icon;
|
|
1109
|
-
return (jsxRuntime.jsx(erpTheme.Collapsible, { asChild: true, defaultOpen: isItemActive || hasActiveSubItem, className: "group/collapsible", children: jsxRuntime.jsxs(SidebarMenuItem, { children: [jsxRuntime.jsx(erpTheme.CollapsibleTrigger, { asChild: true, children: jsxRuntime.jsx(SidebarMenuButton, { asChild: !item.subModules || item.subModules.length === 0, isActive: isItemActive, className: " data-[state=open]:text-sidebar-accent-foreground", children: item.subModules && item.subModules.length > 0 ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { id: item.id, children: item.titleTh }), jsxRuntime.jsx(lucideReact.ChevronRight, { className: "ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" })] })) : (jsxRuntime.jsx(Link, { href: itemUrl, className: "flex items-center gap-2 w-full min-w-0 flex-1", onClick: handleNavLinkClick, children: jsxRuntime.jsx("span", { id: item.id, className: "flex-1 truncate", title: item.titleTh, children: item.titleTh }) })) }) }), item.subModules && item.subModules.length > 0 && (jsxRuntime.jsx(erpTheme.CollapsibleContent, { children: jsxRuntime.jsx(SidebarMenuSub, { children: item.subModules.map(subItem => {
|
|
1109
|
+
return (jsxRuntime.jsx(erpTheme.Collapsible, { asChild: true, defaultOpen: isItemActive || hasActiveSubItem, className: "group/collapsible", children: jsxRuntime.jsxs(SidebarMenuItem, { children: [jsxRuntime.jsx(erpTheme.CollapsibleTrigger, { asChild: true, children: jsxRuntime.jsx(SidebarMenuButton, { asChild: !item.subModules || item.subModules.length === 0, isActive: isItemActive, className: " data-[state=open]:text-sidebar-accent-foreground", children: item.subModules && item.subModules.length > 0 ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { id: item.id, children: item.titleTh }), jsxRuntime.jsx(lucideReact.ChevronRight, { className: "ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" })] })) : (jsxRuntime.jsx(Link, { href: itemUrl, prefetch: false, className: "flex items-center gap-2 w-full min-w-0 flex-1", onClick: handleNavLinkClick, children: jsxRuntime.jsx("span", { id: item.id, className: "flex-1 truncate", title: item.titleTh, children: item.titleTh }) })) }) }), item.subModules && item.subModules.length > 0 && (jsxRuntime.jsx(erpTheme.CollapsibleContent, { children: jsxRuntime.jsx(SidebarMenuSub, { children: item.subModules.map(subItem => {
|
|
1110
1110
|
const subItemUrl = buildUrlWithCode(code, subItem.url);
|
|
1111
1111
|
const isSubItemActive = subItemUrl === activeSubItemUrl;
|
|
1112
1112
|
const SubIcon = subItem.icon;
|
|
@@ -1123,10 +1123,10 @@ function NavMain({ items, orgCode, closeOnNavigation = false, approvalCounts, })
|
|
|
1123
1123
|
const SubPageIcon = subPage.icon;
|
|
1124
1124
|
return (jsxRuntime.jsx(SidebarMenuSubItem, { children: jsxRuntime.jsx(SidebarMenuSubButton, { asChild: true, className: `font-thai w-full text-sm ${isSubPageActive
|
|
1125
1125
|
? "text-sidebar-accent-foreground font-medium"
|
|
1126
|
-
: "text-sidebar-foreground"}`, isActive: false, children: jsxRuntime.jsxs(Link, { href: subPageUrl, className: "w-full flex items-center", onClick: handleNavLinkClick, children: [SubPageIcon && (jsxRuntime.jsx(SubPageIcon, { className: "sidebar-subpage-icon flex-shrink-0" })), jsxRuntime.jsx("span", { className: "flex-1 truncate", title: subPage.titleTh, children: subPage.titleTh })] }) }) }, subPage.id));
|
|
1126
|
+
: "text-sidebar-foreground"}`, isActive: false, children: jsxRuntime.jsxs(Link, { href: subPageUrl, prefetch: false, className: "w-full flex items-center", onClick: handleNavLinkClick, children: [SubPageIcon && (jsxRuntime.jsx(SubPageIcon, { className: "sidebar-subpage-icon flex-shrink-0" })), jsxRuntime.jsx("span", { className: "flex-1 truncate", title: subPage.titleTh, children: subPage.titleTh })] }) }) }, subPage.id));
|
|
1127
1127
|
}) }) })] }) }, subItem.id));
|
|
1128
1128
|
}
|
|
1129
|
-
return (jsxRuntime.jsx(SidebarMenuSubItem, { children: jsxRuntime.jsx(SidebarMenuSubButton, { asChild: true, className: "w-full", isActive: isSubItemActive, children: jsxRuntime.jsxs(Link, { href: subItemUrl, className: "w-full flex items-center", onClick: handleNavLinkClick, children: [SubIcon && (jsxRuntime.jsx(SubIcon, { className: "sidebar-submodule-icon flex-shrink-0" })), jsxRuntime.jsx("span", { className: "flex-1 truncate", title: subItem.titleTh, children: subItem.titleTh }), approvalCount > 0 && (jsxRuntime.jsx(erpTheme.Badge, { variant: "destructive", className: "ml-auto h-5 min-w-5 px-1.5 text-xs font-medium tabular-nums", children: approvalCount > 99 ? "99+" : approvalCount }))] }) }) }, subItem.id));
|
|
1129
|
+
return (jsxRuntime.jsx(SidebarMenuSubItem, { children: jsxRuntime.jsx(SidebarMenuSubButton, { asChild: true, className: "w-full", isActive: isSubItemActive, children: jsxRuntime.jsxs(Link, { href: subItemUrl, prefetch: false, className: "w-full flex items-center", onClick: handleNavLinkClick, children: [SubIcon && (jsxRuntime.jsx(SubIcon, { className: "sidebar-submodule-icon flex-shrink-0" })), jsxRuntime.jsx("span", { className: "flex-1 truncate", title: subItem.titleTh, children: subItem.titleTh }), approvalCount > 0 && (jsxRuntime.jsx(erpTheme.Badge, { variant: "destructive", className: "ml-auto h-5 min-w-5 px-1.5 text-xs font-medium tabular-nums", children: approvalCount > 99 ? "99+" : approvalCount }))] }) }) }, subItem.id));
|
|
1130
1130
|
}) }) }))] }) }, item.id));
|
|
1131
1131
|
}) }) }));
|
|
1132
1132
|
}
|
|
@@ -1669,27 +1669,40 @@ function writeThemeCookie(value) {
|
|
|
1669
1669
|
/**
|
|
1670
1670
|
* Bridges next-themes (per-origin localStorage) with a cookie scoped to the
|
|
1671
1671
|
* parent domain, so the light/dark/system choice is shared across the
|
|
1672
|
-
* accounting / HR / platform subdomains.
|
|
1673
|
-
*
|
|
1672
|
+
* accounting / HR / platform subdomains.
|
|
1673
|
+
*
|
|
1674
|
+
* Local storage wins when it already has a value (H57): adopting the shared
|
|
1675
|
+
* cookie first used to overwrite an explicit choice — including one set via
|
|
1676
|
+
* DevTools — and write `theme=light` back on every load whenever the cookie
|
|
1677
|
+
* still said light. Push the local value into the cookie instead so sibling
|
|
1678
|
+
* apps catch up.
|
|
1674
1679
|
*/
|
|
1675
1680
|
function ThemeCookieSync() {
|
|
1676
1681
|
const { theme, setTheme } = nextThemes.useTheme();
|
|
1677
1682
|
const skipFirstWrite = React__namespace.useRef(true);
|
|
1678
1683
|
React__namespace.useEffect(() => {
|
|
1684
|
+
const local = typeof window !== "undefined"
|
|
1685
|
+
? window.localStorage.getItem("theme")
|
|
1686
|
+
: null;
|
|
1679
1687
|
const cookie = readThemeCookie();
|
|
1680
|
-
if (
|
|
1688
|
+
if (local) {
|
|
1689
|
+
if (local !== theme)
|
|
1690
|
+
setTheme(local);
|
|
1691
|
+
writeThemeCookie(local);
|
|
1692
|
+
}
|
|
1693
|
+
else if (cookie) {
|
|
1681
1694
|
if (cookie !== theme)
|
|
1682
1695
|
setTheme(cookie);
|
|
1683
1696
|
}
|
|
1684
1697
|
else if (theme) {
|
|
1685
|
-
writeThemeCookie(theme);
|
|
1698
|
+
writeThemeCookie(theme);
|
|
1686
1699
|
}
|
|
1687
1700
|
// Run once on mount — `theme` is intentionally not a dependency here.
|
|
1688
1701
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1689
1702
|
}, []);
|
|
1690
1703
|
React__namespace.useEffect(() => {
|
|
1691
1704
|
// Skip the initial render; only persist genuine changes (incl. the
|
|
1692
|
-
// setTheme() triggered by adopting
|
|
1705
|
+
// setTheme() triggered by adopting storage above — harmless re-write).
|
|
1693
1706
|
if (skipFirstWrite.current) {
|
|
1694
1707
|
skipFirstWrite.current = false;
|
|
1695
1708
|
return;
|