@eintrek/erp-shell 0.1.48 → 0.1.50
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.d.ts +1 -1
- package/dist/index.esm.js +25 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +25 -8
- package/dist/index.js.map +1 -1
- package/dist/navigation/app-layout-shell.d.ts +7 -2
- package/dist/navigation/app-sidebar.d.ts +3 -1
- package/dist/navigation/chrome.d.ts +10 -0
- package/dist/navigation/nav-main.d.ts +7 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1090,7 +1090,7 @@ function samePage(pathname, url) {
|
|
|
1090
1090
|
const strip = (p) => (p.length > 1 ? p.replace(/\/+$/, "") : p);
|
|
1091
1091
|
return strip(pathname) === strip(url);
|
|
1092
1092
|
}
|
|
1093
|
-
function NavMain({ items, orgCode, closeOnNavigation = false, approvalCounts, chrome = "brand", }) {
|
|
1093
|
+
function NavMain({ items, orgCode, closeOnNavigation = false, approvalCounts, chrome = "brand", highlightActiveModule = false, }) {
|
|
1094
1094
|
const workspace = chrome === "workspace";
|
|
1095
1095
|
const params = navigation.useParams();
|
|
1096
1096
|
const pathname = navigation.usePathname();
|
|
@@ -1122,8 +1122,9 @@ function NavMain({ items, orgCode, closeOnNavigation = false, approvalCounts, ch
|
|
|
1122
1122
|
isPathActive(pathname, subPage.url)));
|
|
1123
1123
|
// Parent only active when path matches its URL exactly AND no child
|
|
1124
1124
|
// is active (so parent+child don't both light up).
|
|
1125
|
-
const isItemActive = (
|
|
1126
|
-
|
|
1125
|
+
const isItemActive = (highlightActiveModule && !item.subModules?.length && !!item.isActive) ||
|
|
1126
|
+
((workspace ? samePage(pathname, itemUrl) : pathname === itemUrl) &&
|
|
1127
|
+
!hasActiveSubItem);
|
|
1127
1128
|
return { itemUrl, activeSubItemUrl, hasActiveSubItem, isItemActive };
|
|
1128
1129
|
});
|
|
1129
1130
|
// A group opens when its page becomes current and otherwise stays as the
|
|
@@ -1211,7 +1212,7 @@ function OrgMark({ logoUrl, size = "md", }) {
|
|
|
1211
1212
|
const box = size === "sm"
|
|
1212
1213
|
? "flex size-6 items-center justify-center rounded-md border overflow-hidden bg-background"
|
|
1213
1214
|
: size === "header"
|
|
1214
|
-
? "flex aspect-square size-8 shrink-0 items-center justify-center rounded-[9px] border border-[color:color-mix(in_oklab,var(--header-fg,currentColor)_28%,transparent)] bg-[color-mix(in_oklab,var(--header-fg,currentColor)_10%,transparent)] text-[var(--header-fg,currentColor)] overflow-hidden max-sm:size-7"
|
|
1215
|
+
? "flex aspect-square size-8 shrink-0 items-center justify-center rounded-[9px] border border-[color:var(--header-mark-border,color-mix(in_oklab,var(--header-fg,currentColor)_28%,transparent))] bg-[var(--header-mark-bg,color-mix(in_oklab,var(--header-fg,currentColor)_10%,transparent))] text-[var(--header-mark-fg,var(--header-fg,currentColor))] overflow-hidden max-sm:size-7"
|
|
1215
1216
|
: "flex aspect-square size-8 shrink-0 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground overflow-hidden";
|
|
1216
1217
|
const icon = size === "sm" ? "size-3.5 shrink-0" : "size-4";
|
|
1217
1218
|
if (logoUrl && !failed) {
|
|
@@ -1282,7 +1283,7 @@ function SidebarHeader({ children, className }) {
|
|
|
1282
1283
|
return jsxRuntime.jsx("div", { className: erpTheme.cn("px-2 py-3", className), children: children });
|
|
1283
1284
|
}
|
|
1284
1285
|
|
|
1285
|
-
function AppSidebar({ modules, tools, activeModule, orgCode, approvalCounts, closeOnNavigation = false, header, footer, bottom, chrome = "brand", className, }) {
|
|
1286
|
+
function AppSidebar({ modules, tools, activeModule, orgCode, approvalCounts, closeOnNavigation = false, highlightActiveModule = false, header, footer, bottom, chrome = "brand", className, }) {
|
|
1286
1287
|
const { open } = useSidebar();
|
|
1287
1288
|
const modulesWithActiveState = React__namespace.useMemo(() => modules.map(m => ({
|
|
1288
1289
|
...m,
|
|
@@ -1293,7 +1294,7 @@ function AppSidebar({ modules, tools, activeModule, orgCode, approvalCounts, clo
|
|
|
1293
1294
|
if (chrome === "workspace") {
|
|
1294
1295
|
return (jsxRuntime.jsxs("div", { className: erpTheme.cn("flex h-screen w-[244px] shrink-0 flex-col overflow-hidden border-r border-sidebar-border bg-sidebar text-sidebar-foreground",
|
|
1295
1296
|
// As a drawer (≤1024px) it floats over the page and needs the lift.
|
|
1296
|
-
"max-[1024px]:shadow-2xl", className), children: [header ? jsxRuntime.jsx("div", { className: "shrink-0 px-[18px] pt-8 pb-6", children: header }) : null, jsxRuntime.jsxs(SidebarContent, { className: "flex-1 overflow-y-auto px-[18px]", children: [jsxRuntime.jsx(NavMain, { items: modulesWithActiveState, orgCode: orgCode, approvalCounts: approvalCounts, closeOnNavigation: closeOnNavigation, chrome: "workspace" }), jsxRuntime.jsx(NavTools, { tools: tools, closeOnNavigation: closeOnNavigation })] }), bottom ? jsxRuntime.jsx("div", { className: "shrink-0 px-[18px] pt-6", children: bottom }) : null, jsxRuntime.jsx("div", { className: "shrink-0 px-[18px] pb-3", children: footer })] }));
|
|
1297
|
+
"max-[1024px]:shadow-2xl", className), children: [header ? jsxRuntime.jsx("div", { className: "shrink-0 px-[18px] pt-8 pb-6", children: header }) : null, jsxRuntime.jsxs(SidebarContent, { className: "flex-1 overflow-y-auto px-[18px]", children: [jsxRuntime.jsx(NavMain, { items: modulesWithActiveState, orgCode: orgCode, approvalCounts: approvalCounts, closeOnNavigation: closeOnNavigation, chrome: "workspace", highlightActiveModule: highlightActiveModule }), jsxRuntime.jsx(NavTools, { tools: tools, closeOnNavigation: closeOnNavigation })] }), bottom ? jsxRuntime.jsx("div", { className: "shrink-0 px-[18px] pt-6", children: bottom }) : null, jsxRuntime.jsx("div", { className: "shrink-0 px-[18px] pb-3", children: footer })] }));
|
|
1297
1298
|
}
|
|
1298
1299
|
return (jsxRuntime.jsxs("div", { className: erpTheme.cn("bg-sidebar shrink-0 flex flex-col overflow-hidden shadow-2xl h-screen w-[var(--sidebar-width-mobile)]", "!w-76 xl:rounded-b-4xl xl:rounded-tl-4xl xl:m-5 xl:h-[calc(100vh-2.5rem)]", className), children: [jsxRuntime.jsx(SidebarHeader, { children: header }), jsxRuntime.jsxs(SidebarContent, { className: "pl-2 pr-2 flex-1 overflow-y-auto", children: [jsxRuntime.jsx(NavMain, { items: modulesWithActiveState, orgCode: orgCode, approvalCounts: approvalCounts, closeOnNavigation: closeOnNavigation }), jsxRuntime.jsx(NavTools, { tools: tools, closeOnNavigation: closeOnNavigation })] }), jsxRuntime.jsx(SidebarFooter, { className: "pl-2 pr-2", children: footer })] }));
|
|
1299
1300
|
}
|
|
@@ -1310,6 +1311,16 @@ const WORKSPACE_HEADER_VARS = {
|
|
|
1310
1311
|
"--header-title-px": "0px",
|
|
1311
1312
|
"--header-title-py": "0px",
|
|
1312
1313
|
};
|
|
1314
|
+
const WORKSPACE_LIGHT_HEADER_VARS = {
|
|
1315
|
+
"--header-fg": "var(--foreground)",
|
|
1316
|
+
"--header-fg-muted": "var(--muted-foreground)",
|
|
1317
|
+
"--header-hover": "var(--accent)",
|
|
1318
|
+
"--header-mark-bg": "var(--accent)",
|
|
1319
|
+
"--header-mark-fg": "var(--primary)",
|
|
1320
|
+
"--header-mark-border": "transparent",
|
|
1321
|
+
"--header-title-px": "0px",
|
|
1322
|
+
"--header-title-py": "0px",
|
|
1323
|
+
};
|
|
1313
1324
|
|
|
1314
1325
|
/**
|
|
1315
1326
|
* Top-level app chrome: sticky header, sidebar slot, content gutter and the
|
|
@@ -1323,7 +1334,7 @@ const WORKSPACE_HEADER_VARS = {
|
|
|
1323
1334
|
* an erp-shell bump — domain components must NOT add their own root padding
|
|
1324
1335
|
* or content gets indented twice.
|
|
1325
1336
|
*/
|
|
1326
|
-
function AppLayoutShell({ children, sidebar, loadingComponent, breadcrumb, permissionProvider, organizationId, setOrganizationId, organizations, signInUrl, selectOrganizationUrl, chrome = "brand", headerEnd, mobileBrand, }) {
|
|
1337
|
+
function AppLayoutShell({ children, sidebar, loadingComponent, breadcrumb, permissionProvider, organizationId, setOrganizationId, organizations, signInUrl, selectOrganizationUrl, chrome = "brand", workspaceHeader = "brand", headerEnd, mobileBrand, }) {
|
|
1327
1338
|
const { data: session, status } = react.useSession();
|
|
1328
1339
|
const { open, setOpen } = useSidebar();
|
|
1329
1340
|
const router = navigation.useRouter();
|
|
@@ -1454,7 +1465,12 @@ function AppLayoutShell({ children, sidebar, loadingComponent, breadcrumb, permi
|
|
|
1454
1465
|
: "";
|
|
1455
1466
|
const needsLeftGutter = workspace || !(open && !isSidebarModalLayout);
|
|
1456
1467
|
const wrap = permissionProvider ?? ((c) => c);
|
|
1457
|
-
return (jsxRuntime.jsxs("div", { className: "flex min-h-screen w-full bg-background", children: [open && (jsxRuntime.jsx("div", { className: "fixed left-0 top-0 z-50 h-screen", children: sidebar })), open && isSidebarModalLayout && (jsxRuntime.jsx("button", { type: "button", "aria-label": "\u0E1B\u0E34\u0E14\u0E40\u0E21\u0E19\u0E39", className: "fixed inset-0 z-40 bg-black/50", onClick: () => setOpen(false) })), jsxRuntime.jsx("div", { className: cx("relative flex min-w-0 flex-1 flex-col transition-all", contentMargin), children: jsxRuntime.jsxs("main", { className: cx("flex flex-1 flex-col min-h-screen", workspace ? "gap-0" : "gap-4"), children: [workspace ? (jsxRuntime.jsxs("div", { className: "sticky top-0 z-30 shrink-0 w-full",
|
|
1468
|
+
return (jsxRuntime.jsxs("div", { className: "flex min-h-screen w-full bg-background", children: [open && (jsxRuntime.jsx("div", { className: "fixed left-0 top-0 z-50 h-screen", children: sidebar })), open && isSidebarModalLayout && (jsxRuntime.jsx("button", { type: "button", "aria-label": "\u0E1B\u0E34\u0E14\u0E40\u0E21\u0E19\u0E39", className: "fixed inset-0 z-40 bg-black/50", onClick: () => setOpen(false) })), jsxRuntime.jsx("div", { className: cx("relative flex min-w-0 flex-1 flex-col transition-all", contentMargin), children: jsxRuntime.jsxs("main", { className: cx("flex flex-1 flex-col min-h-screen", workspace ? "gap-0" : "gap-4"), children: [workspace ? (jsxRuntime.jsxs("div", { className: cx("sticky top-0 z-30 shrink-0 w-full", workspaceHeader === "light" &&
|
|
1469
|
+
"border-b border-border bg-card/85 backdrop-blur-sm"), style: workspaceHeader === "light"
|
|
1470
|
+
? WORKSPACE_LIGHT_HEADER_VARS
|
|
1471
|
+
: WORKSPACE_HEADER_VARS, children: [workspaceHeader === "light" ? null : (jsxRuntime.jsx(HeaderBackground, { className: "rounded-none" })), jsxRuntime.jsxs("header", { className: cx("relative z-10 flex w-full items-center gap-3 text-[var(--header-fg)]", workspaceHeader === "light"
|
|
1472
|
+
? "min-h-[66px] px-3 py-2 sm:min-h-[72px] sm:px-[22px] lg:min-h-[82px] lg:px-8"
|
|
1473
|
+
: "min-h-[72px] px-[18px] py-3 sm:px-6 lg:min-h-[88px] lg:px-10"), children: [isSidebarModalLayout ? (
|
|
1458
1474
|
// As in the design: the mark, then a menu button, and the
|
|
1459
1475
|
// organisation on the right — no trail, no title, so the
|
|
1460
1476
|
// organisation's name has the room it needs on a phone.
|
|
@@ -2345,6 +2361,7 @@ exports.SidebarTrigger = SidebarTrigger;
|
|
|
2345
2361
|
exports.TapMenu = TapMenu;
|
|
2346
2362
|
exports.ThemeProvider = ThemeProvider;
|
|
2347
2363
|
exports.WORKSPACE_HEADER_VARS = WORKSPACE_HEADER_VARS;
|
|
2364
|
+
exports.WORKSPACE_LIGHT_HEADER_VARS = WORKSPACE_LIGHT_HEADER_VARS;
|
|
2348
2365
|
exports.WorkspaceBrand = WorkspaceBrand;
|
|
2349
2366
|
exports.axiosInstance = instance;
|
|
2350
2367
|
exports.buildSystemLinks = buildSystemLinks;
|