@helloimjolopez-pathway/pathway-components 0.8.1 → 0.9.0

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.
@@ -13,7 +13,7 @@
13
13
  import React, { useState, useEffect, useCallback } from "react";
14
14
  import TopNav, { DEFAULT_MODULES } from "../top-nav/top-nav.jsx";
15
15
  import { SideNav } from "../sidenav/sidenav.jsx";
16
- import { ModuleMark } from "../module-icon/module-icon.jsx";
16
+ import { moduleHeader } from "../sidenav/accounting-side-nav.jsx";
17
17
 
18
18
  // ─── CONSTANTS ────────────────────────────────────────────────────────────────
19
19
  const TOPNAV_H = 60; // px — spec §9.3 rule 1
@@ -292,7 +292,7 @@ export function NavShell({
292
292
  hideCollapseButton={isTablet || isMobile}
293
293
  headerEnd={navHeaderEnd}
294
294
  footer={navFooter}
295
- headerStart={appSwitcher && appSwitcher.moduleMark ? <ModuleMark {...appSwitcher.moduleMark} /> : null}
295
+ headerStart={moduleHeader(appSwitcher)}
296
296
  appSwitcher={appSwitcher ? { ...appSwitcher, activeId: appActive, onSelect: handleAppSelect,
297
297
  // Mobile opens the menu as a BottomSheet (Figma 40016737:141824).
298
298
  presentation: isMobile ? "sheet" : "popover" } : null}
@@ -29,7 +29,8 @@
29
29
  */
30
30
  import React, { useEffect, useState } from "react";
31
31
  import { SideNav } from "./sidenav.jsx";
32
- import { ModuleMark } from "../module-icon/module-icon.jsx";
32
+ import { SideNavHeaderLabel } from "./sidenav.jsx";
33
+ import { ModuleIcon } from "../module-icon/module-icon.jsx";
33
34
 
34
35
  // The Accounting module's applications, each with its own side nav. NavShell's
35
36
  // `app-switcher` and <pathway-accounting-sidenav> fall back to this when no
@@ -49,7 +50,8 @@ const APP_NAV_STANDARD = ["Dashboard", "Enter", "Manage", "View", "Reports", "Mo
49
50
  export const ACCOUNTING_APP_SWITCHER = {
50
51
  label: "Financials Home",
51
52
  icon: "apps",
52
- // The module's mark in the SideNav header (Figma Module.Mark, Accounting).
53
+ // The module's label in the SideNav header: Figma SideNav.Header.Label with
54
+ // the Accounting icon chip (40016737:141726, 2026-11-12).
53
55
  moduleMark: { module: "accounting", label: "Financials" },
54
56
  // The Accounting TopNav is TopNav.Global with Search and Actions hidden
55
57
  // (Figma 40007879:18072): module switcher, org switcher and profile only.
@@ -66,6 +68,15 @@ export const ACCOUNTING_APP_SWITCHER = {
66
68
  { id: "purchasing-management", label: "Purchasing Management", navItems: accountingNav("pm", ["Dashboard", "Enter", "Manage", "Reports", "Modify", "Help"]) },
67
69
  ],
68
70
  };
71
+ // The nav header's start slot for a module: SideNav.Header.Label with the
72
+ // module's icon chip. NavShell uses the same, so the two headers never differ.
73
+ export function moduleHeader(appSwitcher) {
74
+ const m = appSwitcher && appSwitcher.moduleMark;
75
+ if (!m) return null;
76
+ return <SideNavHeaderLabel label={m.label}
77
+ icon={m.module ? <ModuleIcon module={m.module} size={14} color="mono" /> : null} />;
78
+ }
79
+
69
80
  const MOBILE_MAX = 767; // below 768, as NavShell's breakpoint
70
81
 
71
82
  function useIsMobile() {
@@ -107,7 +118,7 @@ export function AccountingSideNav({
107
118
 
108
119
  return (
109
120
  <SideNav key={current && current.id} items={items} activeId={active} onNavigate={navigate}
110
- headerStart={appSwitcher.moduleMark ? <ModuleMark {...appSwitcher.moduleMark} /> : null}
121
+ headerStart={moduleHeader(appSwitcher)}
111
122
  appSwitcher={{ ...appSwitcher, activeId: current && current.id, onSelect: selectApp, presentation: mode }}
112
123
  {...rest} />
113
124
  );
@@ -747,6 +747,38 @@ export function AppSwitcher({ label: fallbackLabel, icon = "apps", home, apps =
747
747
  );
748
748
  }
749
749
 
750
+ // ─── SideNavHeaderLabel ───────────────────────────────────────────────────────
751
+ // Figma SideNav.Header.Label (40018260:4928), read 2026-11-12 from the
752
+ // Accounting Module Nav Shell (40016737:141726). The label at the start of the
753
+ // nav header, beside the collapse control. Text only for a pillar rail; with
754
+ // `icon`, the module's icon chip sits before the name (a module rail, such as
755
+ // Accounting's Financials).
756
+ // IconChip 28, CornerRadius/Base, Fill/Static/Brand/Strong, clips
757
+ // icon the module glyph at 14, Fill/Static/Neutral/Mono
758
+ // label Heading/Local/Base/Semibold: 14 / 600 / 18 / 0.3,
759
+ // Foreground/Static/Neutral/Strong, truncates; gap Gap/XXTight
760
+ // width 160 in Figma: here it fills the row up to the collapse control
761
+ export function SideNavHeaderLabel({ label, icon = null }) {
762
+ return (
763
+ <span style={{ display: "flex", alignItems: "center", minWidth: 0, flex: 1,
764
+ gap: "var(--semantic-layout-units-gap-xxtight)" }}>
765
+ {icon && (
766
+ <span aria-hidden="true" style={{ width: 28, height: 28, flexShrink: 0, overflow: "hidden",
767
+ display: "inline-flex", alignItems: "center", justifyContent: "center",
768
+ borderRadius: "var(--semantic-layout-units-cornerradius-base)",
769
+ background: c("fill-static-brand-strong"), color: c("fill-static-neutral-mono") }}>
770
+ {icon}
771
+ </span>
772
+ )}
773
+ <span style={{ flex: 1, minWidth: 0, fontFamily: "var(--semantic-type-family-brand)",
774
+ fontWeight: "var(--semantic-type-weight-semibold)", fontSize: "var(--semantic-type-font-size-s)",
775
+ lineHeight: "var(--semantic-type-line-height-s-tight)", letterSpacing: "var(--semantic-type-letter-spacing-spacious)",
776
+ color: c("foreground-static-neutral-strong"),
777
+ whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }}>{label}</span>
778
+ </span>
779
+ );
780
+ }
781
+
750
782
  // ─── CollapseButton ───────────────────────────────────────────────────────────
751
783
  // Redesigned in Figma (2026-05-12): now uses Slot.RowStart (Module.Mark icon)
752
784
  // + Slot.RowEnd (Action Icon). The action icon uses Foreground/Action/Secondary/Rest