@eintrek/erp-shell 0.1.44 → 0.1.46

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.
@@ -1,4 +1,5 @@
1
1
  import * as React from "react";
2
+ import { type ShellChrome } from "./chrome";
2
3
  /**
3
4
  * Shape the shell needs from an organization to wire the URL `[code]` segment
4
5
  * back to the active org id. Hosts already keep richer types around — this is
@@ -43,6 +44,18 @@ export interface AppLayoutShellProps {
43
44
  signInUrl: string;
44
45
  /** Absolute path to redirect to when the URL has no `[code]` segment. */
45
46
  selectOrganizationUrl: string;
47
+ /** Which look the chrome takes — see `ShellChrome`. Default "brand". */
48
+ chrome?: ShellChrome;
49
+ /**
50
+ * Right-hand end of the top bar (workspace chrome): typically the
51
+ * organisation switcher and a help button.
52
+ */
53
+ headerEnd?: React.ReactNode;
54
+ /**
55
+ * Product mark for the top bar when the sidebar is a drawer (workspace
56
+ * chrome, ≤1024px), so the app is still named with the sidebar closed.
57
+ */
58
+ mobileBrand?: React.ReactNode;
46
59
  }
47
60
  /**
48
61
  * Top-level app chrome: sticky header, sidebar slot, content gutter and the
@@ -56,4 +69,4 @@ export interface AppLayoutShellProps {
56
69
  * an erp-shell bump — domain components must NOT add their own root padding
57
70
  * or content gets indented twice.
58
71
  */
59
- export declare function AppLayoutShell({ children, sidebar, loadingComponent, breadcrumb, permissionProvider, organizationId, setOrganizationId, organizations, signInUrl, selectOrganizationUrl, }: AppLayoutShellProps): import("react/jsx-runtime").JSX.Element;
72
+ export declare function AppLayoutShell({ children, sidebar, loadingComponent, breadcrumb, permissionProvider, organizationId, setOrganizationId, organizations, signInUrl, selectOrganizationUrl, chrome, headerEnd, mobileBrand, }: AppLayoutShellProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
2
  import type { Module, Tool } from "./navigation-types";
3
+ import type { ShellChrome } from "./chrome";
3
4
  export interface AppSidebarProps {
4
5
  /** Visible modules (already permission-filtered by the app). */
5
6
  modules: Module[];
@@ -20,6 +21,14 @@ export interface AppSidebarProps {
20
21
  header?: React.ReactNode;
21
22
  /** Footer content — typically the app's `<NavUser>`. */
22
23
  footer?: React.ReactNode;
24
+ /**
25
+ * Between the navigation and the footer (workspace chrome): a help card,
26
+ * a link to the manual — whatever should sit at the bottom above the
27
+ * profile row.
28
+ */
29
+ bottom?: React.ReactNode;
30
+ /** Which look — match the `chrome` given to AppLayoutShell. */
31
+ chrome?: ShellChrome;
23
32
  className?: string;
24
33
  }
25
- export declare function AppSidebar({ modules, tools, activeModule, orgCode, approvalCounts, closeOnNavigation, header, footer, className, }: AppSidebarProps): import("react/jsx-runtime").JSX.Element | null;
34
+ export declare function AppSidebar({ modules, tools, activeModule, orgCode, approvalCounts, closeOnNavigation, header, footer, bottom, chrome, className, }: AppSidebarProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,24 @@
1
+ import type * as React from "react";
2
+ /**
3
+ * The two looks the app chrome comes in.
4
+ *
5
+ * - "brand": the original — a header painted in the app's --primary
6
+ * gradient with white text, and a floating rounded sidebar. Every app
7
+ * uses it until it opts in to the other.
8
+ * - "workspace": the layout of the Platform app hub design (11 Oct 2026) —
9
+ * one top-bar row with the trail and page title on the left and room on
10
+ * the right for the organisation and help, and a full-height sidebar with
11
+ * the product mark, grouped navigation, a help card and the profile row.
12
+ * The top bar keeps the app's gradient: the colour is how people tell the
13
+ * apps apart, so only the layout follows the design.
14
+ *
15
+ * Opt-in per app, so bumping the shell for some other fix never restyles
16
+ * an app by accident.
17
+ */
18
+ export type ShellChrome = "brand" | "workspace";
19
+ /**
20
+ * Header ink as CSS variables. Header-borne pieces — breadcrumb, sidebar
21
+ * trigger, the org switcher, the app's own page title — read these, with
22
+ * white as the fallback, so the brand chrome looks exactly as before.
23
+ */
24
+ export declare const WORKSPACE_HEADER_VARS: React.CSSProperties;
@@ -1,4 +1,5 @@
1
1
  import type { Module } from "./navigation-types";
2
+ import type { ShellChrome } from "./chrome";
2
3
  export interface NavMainProps {
3
4
  items: Module[];
4
5
  /**
@@ -14,5 +15,7 @@ export interface NavMainProps {
14
15
  * sub-modules whose count is > 0 (e.g. HR pending approvals).
15
16
  */
16
17
  approvalCounts?: Record<string, number>;
18
+ /** Workspace chrome draws icons, group headings and badges. */
19
+ chrome?: ShellChrome;
17
20
  }
18
- export declare function NavMain({ items, orgCode, closeOnNavigation, approvalCounts, }: NavMainProps): import("react/jsx-runtime").JSX.Element;
21
+ export declare function NavMain({ items, orgCode, closeOnNavigation, approvalCounts, chrome, }: NavMainProps): import("react/jsx-runtime").JSX.Element;
@@ -50,5 +50,10 @@ export interface NavUserProps {
50
50
  * Show the "เปลี่ยนภาษา" language switch. Default: true.
51
51
  */
52
52
  showLanguageSwitch?: boolean;
53
+ /**
54
+ * "workspace" draws the trigger as the workspace sidebar's profile row: a
55
+ * rule above, a round avatar, and up/down chevrons. Default "brand".
56
+ */
57
+ variant?: "brand" | "workspace";
53
58
  }
54
- export declare function NavUser({ organization, avatarSrc, profileHref, selectOrganizationHref, signInRedirectHref, systemLinks, showSelectOrganization, showLanguageSwitch, }?: NavUserProps): import("react/jsx-runtime").JSX.Element | null;
59
+ export declare function NavUser({ organization, avatarSrc, profileHref, selectOrganizationHref, signInRedirectHref, systemLinks, showSelectOrganization, showLanguageSwitch, variant, }?: NavUserProps): import("react/jsx-runtime").JSX.Element | null;
@@ -12,6 +12,14 @@ export interface Module {
12
12
  /** Hide unless user matches ui_route_permissions for this key. */
13
13
  permissionRouteKey?: string;
14
14
  subModules?: SubModule[];
15
+ /**
16
+ * Section heading this item sits under (workspace chrome). Consecutive
17
+ * items with the same group share one heading; items without a group get
18
+ * none.
19
+ */
20
+ group?: string;
21
+ /** Small count or label at the end of the row (workspace chrome). */
22
+ badge?: string | number;
15
23
  }
16
24
  export interface SubPage {
17
25
  id: string;
@@ -25,6 +25,12 @@ export interface OrganizationSwitcherProps {
25
25
  setOrganizationCookie: (id: string | number) => Promise<unknown>;
26
26
  /** Where to navigate on "เพิ่มองค์กร". Default: "/register-organization". */
27
27
  registerOrganizationHref?: string;
28
+ /**
29
+ * "sidebar" (default) is the row at the top of the sidebar. "header" is
30
+ * the workspace top bar's: an outlined mark, "องค์กรที่กำลังใช้งาน" over
31
+ * the name, and the list opening downwards from the right.
32
+ */
33
+ placement?: "sidebar" | "header";
28
34
  className?: string;
29
35
  }
30
- export declare function OrganizationSwitcher({ activeOrganization, isContextLoading, organizations, isLoadingOrgs, setOrganizationCookie, registerOrganizationHref, className, }: OrganizationSwitcherProps): import("react/jsx-runtime").JSX.Element;
36
+ export declare function OrganizationSwitcher({ activeOrganization, isContextLoading, organizations, isLoadingOrgs, setOrganizationCookie, registerOrganizationHref, placement, className, }: OrganizationSwitcherProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,22 @@
1
+ import * as React from "react";
2
+ export interface SidebarHelpCardProps {
3
+ title: string;
4
+ description?: string;
5
+ actionLabel: string;
6
+ href: string;
7
+ icon?: React.ReactNode;
8
+ className?: string;
9
+ }
10
+ /**
11
+ * The card at the foot of the workspace sidebar that points someone who
12
+ * does not know where to start at the place that will tell them.
13
+ */
14
+ export declare function SidebarHelpCard({ title, description, actionLabel, href, icon, className, }: SidebarHelpCardProps): import("react/jsx-runtime").JSX.Element;
15
+ export interface SidebarHelpLinkProps {
16
+ label: string;
17
+ href: string;
18
+ icon?: React.ReactNode;
19
+ className?: string;
20
+ }
21
+ /** A quiet row under the help card — the manual, the support chat. */
22
+ export declare function SidebarHelpLink({ label, href, icon, className }: SidebarHelpLinkProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ export interface WorkspaceBrandProps {
3
+ /** Product name, e.g. "AntNiti" or "Peoplx". */
4
+ name: string;
5
+ /** Small spaced caption under the name, e.g. "WORKSPACE" or "งานบุคคล". */
6
+ caption?: string;
7
+ /** The mark — an <img> of the app icon, or any node 44px square. */
8
+ mark: React.ReactNode;
9
+ /** Where the brand links to — the app's home for the organisation. */
10
+ href?: string;
11
+ /** Mark only, for the top bar when the sidebar is a drawer. */
12
+ compact?: boolean;
13
+ className?: string;
14
+ }
15
+ /**
16
+ * The product mark at the top of the workspace sidebar: the app icon, the
17
+ * name, and a spaced caption beneath it.
18
+ */
19
+ export declare function WorkspaceBrand({ name, caption, mark, href, compact, className, }: WorkspaceBrandProps): import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eintrek/erp-shell",
3
- "version": "0.1.44",
3
+ "version": "0.1.46",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Shared frontend platform for ERP apps — HTTP client, providers, navigation, hooks.",