@molecule/app-top-nav-layout-react 4.0.2 → 4.0.3

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/README.md CHANGED
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-11-16T01:08:42.137Z
6
+ Generated: 2026-11-21T12:47:38.585Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-top-nav-layout-react
@@ -79,7 +79,10 @@ interface TopNavLayoutProps {
79
79
  navItems: ReadonlyArray<TopNavItem>
80
80
  /** Slot rendered at the right of the header (typically a `<UserMenu />`). */
81
81
  userMenu?: ReactNode
82
- /** Aria-label for the primary <nav>. */
82
+ /**
83
+ * Aria-label for the primary `<nav>`. Overrides the translated /
84
+ * `defaultValue` `'Primary navigation'` (prop > `t()` > default).
85
+ */
83
86
  navAriaLabel?: string
84
87
  /** Extra classes on the outer wrapper. */
85
88
  className?: string
@@ -100,7 +103,7 @@ function TopNavLayout({
100
103
  logoTo = '/',
101
104
  navItems,
102
105
  userMenu,
103
- navAriaLabel = 'Primary navigation',
106
+ navAriaLabel,
104
107
  className,
105
108
  dataMolId,
106
109
  }: TopNavLayoutProps): JSX.Element
@@ -137,3 +140,7 @@ calls with raw Tailwind + Material-3 tokens (`bg-surface`,
137
140
  source-scans this package's dist and a theme defining those tokens are
138
141
  prerequisites — under a non-Tailwind ClassMap bond the header renders
139
142
  unstyled. `label` is rendered as-is: pass an already-translated string.
143
+
144
+ ## Translations
145
+
146
+ Translation strings are provided by `@molecule/app-locales-top-nav-layout`.
@@ -20,7 +20,10 @@ export interface TopNavLayoutProps {
20
20
  navItems: ReadonlyArray<TopNavItem>;
21
21
  /** Slot rendered at the right of the header (typically a `<UserMenu />`). */
22
22
  userMenu?: ReactNode;
23
- /** Aria-label for the primary <nav>. */
23
+ /**
24
+ * Aria-label for the primary `<nav>`. Overrides the translated /
25
+ * `defaultValue` `'Primary navigation'` (prop > `t()` > default).
26
+ */
24
27
  navAriaLabel?: string;
25
28
  /** Extra classes on the outer wrapper. */
26
29
  className?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"TopNavLayout.d.ts","sourceRoot":"","sources":["../src/TopNavLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAK3C,4DAA4D;AAC5D,MAAM,WAAW,UAAU;IACzB,mCAAmC;IACnC,EAAE,EAAE,MAAM,CAAA;IACV,4DAA4D;IAC5D,GAAG,EAAE,MAAM,CAAA;IACX,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,4FAA4F;IAC5F,KAAK,EAAE,MAAM,CAAA;CACd;AAED,0DAA0D;AAC1D,MAAM,WAAW,iBAAiB;IAChC,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAA;IACf,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,mDAAmD;IACnD,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,CAAA;IACnC,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,MAAY,EACZ,QAAQ,EACR,QAAQ,EACR,YAAmC,EACnC,SAAS,EACT,SAAS,GACV,EAAE,iBAAiB,GAAG,GAAG,CAAC,OAAO,CA4DjC"}
1
+ {"version":3,"file":"TopNavLayout.d.ts","sourceRoot":"","sources":["../src/TopNavLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAM3C,4DAA4D;AAC5D,MAAM,WAAW,UAAU;IACzB,mCAAmC;IACnC,EAAE,EAAE,MAAM,CAAA;IACV,4DAA4D;IAC5D,GAAG,EAAE,MAAM,CAAA;IACX,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,4FAA4F;IAC5F,KAAK,EAAE,MAAM,CAAA;CACd;AAED,0DAA0D;AAC1D,MAAM,WAAW,iBAAiB;IAChC,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAA;IACf,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,mDAAmD;IACnD,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,CAAA;IACnC,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,MAAY,EACZ,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,SAAS,GACV,EAAE,iBAAiB,GAAG,GAAG,CAAC,OAAO,CAgEjC"}
@@ -1,14 +1,18 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Link, NavLink, Outlet } from 'react-router';
3
+ import { useTranslation } from '@molecule/app-react';
3
4
  import { getClassMap } from '@molecule/app-ui';
4
5
  /**
5
6
  * Sticky top-nav shell with brand + horizontal nav + user-menu slot.
6
7
  *
7
8
  * @param props - Component props (see {@link TopNavLayoutProps}).
8
9
  */
9
- export function TopNavLayout({ appName, logoTo = '/', navItems, userMenu, navAriaLabel = 'Primary navigation', className, dataMolId, }) {
10
+ export function TopNavLayout({ appName, logoTo = '/', navItems, userMenu, navAriaLabel, className, dataMolId, }) {
11
+ const { t } = useTranslation();
10
12
  const cm = getClassMap();
11
- return (_jsxs("div", { className: cm.cn(cm.minH('screen'), cm.topNavLayoutRoot, className), "data-mol-id": dataMolId, children: [_jsx("header", { className: cm.cn(cm.topNavLayoutHeader), children: _jsxs("div", { className: cm.cn(cm.maxW('7xl'), cm.mxAuto, cm.sp('px', 6), cm.sp('py', 3), cm.flex({ align: 'center', justify: 'between', gap: 'lg' })), children: [_jsx(Link, { to: logoTo, className: cm.cn(cm.textSize('2xl'), cm.fontWeight('bold')), children: appName }), _jsx("nav", { className: cm.flex({ align: 'center', gap: 'md' }), "aria-label": navAriaLabel, children: navItems.map((item) => (_jsxs(NavLink, { to: item.to, "aria-label": item.label, className: ({ isActive }) => cm.cn(cm.flex({ align: 'center', gap: 'xs' }), cm.sp('px', 3), cm.sp('py', 2), cm.textSize('sm'), cm.fontWeight('medium'), cm.topNavLayoutNavItem, isActive
13
+ const navLabel = navAriaLabel ??
14
+ t('topNavLayout.aria.primaryNavigation', undefined, { defaultValue: 'Primary navigation' });
15
+ return (_jsxs("div", { className: cm.cn(cm.minH('screen'), cm.topNavLayoutRoot, className), "data-mol-id": dataMolId, children: [_jsx("header", { className: cm.cn(cm.topNavLayoutHeader), children: _jsxs("div", { className: cm.cn(cm.maxW('7xl'), cm.mxAuto, cm.sp('px', 6), cm.sp('py', 3), cm.flex({ align: 'center', justify: 'between', gap: 'lg' })), children: [_jsx(Link, { to: logoTo, className: cm.cn(cm.textSize('2xl'), cm.fontWeight('bold')), children: appName }), _jsx("nav", { className: cm.flex({ align: 'center', gap: 'md' }), "aria-label": navLabel, children: navItems.map((item) => (_jsxs(NavLink, { to: item.to, "aria-label": item.label, className: ({ isActive }) => cm.cn(cm.flex({ align: 'center', gap: 'xs' }), cm.sp('px', 3), cm.sp('py', 2), cm.textSize('sm'), cm.fontWeight('medium'), cm.topNavLayoutNavItem, isActive
12
16
  ? cm.cn(cm.bgPrimaryContainer, cm.textPrimary)
13
17
  : cm.cn(cm.textMuted, cm.topNavLayoutNavItemIdle)), children: [item.icon ? (_jsx("span", { className: cm.iconGlyphFont, "aria-hidden": "true", children: item.icon })) : null, _jsx("span", { className: cm.topNavLayoutNavItemLabel, children: item.label })] }, item.key))) }), userMenu] }) }), _jsx("main", { children: _jsx(Outlet, {}) })] }));
14
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-top-nav-layout-react",
3
- "version": "4.0.2",
3
+ "version": "4.0.3",
4
4
  "description": "Sticky top-nav app shell: brand link + horizontal NavLinks + user-menu slot, with React Router <Outlet /> for nested routes",
5
5
  "homepage": "https://www.molecule.dev/packages/app-top-nav-layout-react",
6
6
  "type": "module",
@@ -40,8 +40,8 @@
40
40
  "react-router": "^7.0.0 || ^8.0.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@molecule/app-react": "4.7.1",
44
- "@molecule/app-ui": "1.4.0",
43
+ "@molecule/app-react": "4.10.1",
44
+ "@molecule/app-ui": "1.5.0",
45
45
  "@types/node": "26.6.5",
46
46
  "@types/react": "19.3.0",
47
47
  "@types/react-dom": "19.3.0",