@molecule/app-top-nav-layout-react 4.1.0 → 4.2.1
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 +6 -4
- package/dist/TopNavLayout.d.ts +1 -1
- package/dist/TopNavLayout.d.ts.map +1 -1
- package/dist/TopNavLayout.js +8 -6
- package/package.json +7 -5
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-
|
|
6
|
+
Generated: 2026-11-25T00:25:48.316Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-top-nav-layout-react
|
|
@@ -40,7 +40,7 @@ const userMenu = <button type="button">Account</button>
|
|
|
40
40
|
## Installation
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
|
-
npm install @molecule/app-top-nav-layout-react @molecule/app-react @molecule/app-ui react
|
|
43
|
+
npm install @molecule/app-top-nav-layout-react @molecule/app-react @molecule/app-ui @molecule/app-ui-react react
|
|
44
44
|
npm install -D @types/react
|
|
45
45
|
```
|
|
46
46
|
|
|
@@ -113,7 +113,7 @@ function TopNavLayout({
|
|
|
113
113
|
navAriaLabel,
|
|
114
114
|
className,
|
|
115
115
|
dataMolId,
|
|
116
|
-
children,
|
|
116
|
+
children: childrenProp,
|
|
117
117
|
}: TopNavLayoutProps): JSX.Element
|
|
118
118
|
```
|
|
119
119
|
|
|
@@ -125,14 +125,16 @@ function TopNavLayout({
|
|
|
125
125
|
|
|
126
126
|
Peer dependencies:
|
|
127
127
|
|
|
128
|
-
- `@molecule/app-react` ^4.
|
|
128
|
+
- `@molecule/app-react` ^4.13.0
|
|
129
129
|
- `@molecule/app-ui` ^1.3.11
|
|
130
|
+
- `@molecule/app-ui-react` ^4.4.0
|
|
130
131
|
- `react` ^18.0.0 || ^19.0.0
|
|
131
132
|
|
|
132
133
|
### Runtime Dependencies
|
|
133
134
|
|
|
134
135
|
- `@molecule/app-react`
|
|
135
136
|
- `@molecule/app-ui`
|
|
137
|
+
- `@molecule/app-ui-react`
|
|
136
138
|
- `react`
|
|
137
139
|
|
|
138
140
|
Requires React Router: render it as a LAYOUT ROUTE element
|
package/dist/TopNavLayout.d.ts
CHANGED
|
@@ -42,5 +42,5 @@ export interface TopNavLayoutProps {
|
|
|
42
42
|
*
|
|
43
43
|
* @param props - Component props (see {@link TopNavLayoutProps}).
|
|
44
44
|
*/
|
|
45
|
-
export declare function TopNavLayout({ appName, logoTo, navItems, userMenu, navAriaLabel, className, dataMolId, children, }: TopNavLayoutProps): JSX.Element;
|
|
45
|
+
export declare function TopNavLayout({ appName, logoTo, navItems, userMenu, navAriaLabel, className, dataMolId, children: childrenProp, }: TopNavLayoutProps): JSX.Element;
|
|
46
46
|
//# sourceMappingURL=TopNavLayout.d.ts.map
|
|
@@ -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;
|
|
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;AAS3C,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;IAClB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,MAAY,EACZ,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,SAAS,EACT,QAAQ,EAAE,YAAY,GACvB,EAAE,iBAAiB,GAAG,GAAG,CAAC,OAAO,CAkEjC"}
|
package/dist/TopNavLayout.js
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { RoutedView, useLocation, useTranslation } from '@molecule/app-react';
|
|
3
|
-
import {
|
|
3
|
+
import { slot } from '@molecule/app-react/render';
|
|
4
4
|
import { getClassMap } from '@molecule/app-ui';
|
|
5
|
+
import { Box, GlyphIcon, Link, Text } from '@molecule/app-ui-react/elements';
|
|
5
6
|
import { navItemActive } from './nav-item-active.js';
|
|
6
7
|
/**
|
|
7
8
|
* Sticky top-nav shell with brand + horizontal nav + user-menu slot.
|
|
8
9
|
*
|
|
9
10
|
* @param props - Component props (see {@link TopNavLayoutProps}).
|
|
10
11
|
*/
|
|
11
|
-
export function TopNavLayout({ appName, logoTo = '/', navItems, userMenu, navAriaLabel, className, dataMolId, children, }) {
|
|
12
|
+
export function TopNavLayout({ appName, logoTo = '/', navItems, userMenu, navAriaLabel, className, dataMolId, children: childrenProp, }) {
|
|
13
|
+
const children = slot(childrenProp);
|
|
12
14
|
const { t } = useTranslation();
|
|
13
15
|
const { pathname } = useLocation();
|
|
14
16
|
const cm = getClassMap();
|
|
15
17
|
const navLabel = navAriaLabel ??
|
|
16
18
|
t('topNavLayout.aria.primaryNavigation', undefined, { defaultValue: 'Primary navigation' });
|
|
17
|
-
return (_jsxs("div",
|
|
19
|
+
return (_jsxs(Box, { as: "div", className: cm.cn(cm.minH('screen'), cm.topNavLayoutRoot, className), "data-mol-id": dataMolId, children: [_jsx(Box, { as: "header", className: cm.cn(cm.topNavLayoutHeader), children: _jsxs(Box, { as: "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, { className: cm.cn(cm.textSize('2xl'), cm.fontWeight('bold')), to: logoTo, children: appName }), _jsx(Box, { as: "nav", className: cm.flex({ align: 'center', gap: 'md' }), "aria-label": navLabel, children: navItems.map((item) => {
|
|
18
20
|
const isActive = navItemActive(pathname, item.to);
|
|
19
|
-
return (_jsxs(Link, {
|
|
21
|
+
return (_jsxs(Link, { "aria-label": item.label, "aria-current": isActive ? 'page' : undefined, className: 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
|
|
20
22
|
? cm.cn(cm.bgPrimaryContainer, cm.textPrimary)
|
|
21
|
-
: cm.cn(cm.textMuted, cm.topNavLayoutNavItemIdle)), children: [item.icon ?
|
|
22
|
-
}) }), userMenu] }) }), _jsx("main",
|
|
23
|
+
: cm.cn(cm.textMuted, cm.topNavLayoutNavItemIdle)), to: item.to, children: [item.icon ? _jsx(GlyphIcon, { name: item.icon, "aria-hidden": true }) : null, _jsx(Text, { as: "span", className: cm.topNavLayoutNavItemLabel, children: item.label })] }, item.key));
|
|
24
|
+
}) }), userMenu] }) }), _jsx(Box, { as: "main", children: children ?? _jsx(RoutedView, {}) })] }));
|
|
23
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-top-nav-layout-react",
|
|
3
|
-
"version": "4.1
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"description": "Sticky top-nav app shell: brand link + horizontal NavLinks + user-menu slot, with a router outlet for nested routes",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/app-top-nav-layout-react",
|
|
6
6
|
"type": "module",
|
|
@@ -34,13 +34,15 @@
|
|
|
34
34
|
"directory": "packages/app/features/top-nav-layout-react"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@molecule/app-react": "^4.
|
|
37
|
+
"@molecule/app-react": "^4.13.0",
|
|
38
38
|
"@molecule/app-ui": "^1.3.11",
|
|
39
|
+
"@molecule/app-ui-react": "^4.4.0",
|
|
39
40
|
"react": "^18.0.0 || ^19.0.0"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
|
-
"@molecule/app-react": "4.
|
|
43
|
-
"@molecule/app-ui": "1.
|
|
43
|
+
"@molecule/app-react": "4.17.0",
|
|
44
|
+
"@molecule/app-ui": "1.13.0",
|
|
45
|
+
"@molecule/app-ui-react": "4.11.0",
|
|
44
46
|
"@types/node": "26.6.5",
|
|
45
47
|
"@types/react": "19.3.0",
|
|
46
48
|
"@types/react-dom": "19.3.0",
|
|
@@ -48,6 +50,6 @@
|
|
|
48
50
|
"react-dom": "19.3.1",
|
|
49
51
|
"typescript": "6.0.3",
|
|
50
52
|
"vitest": "4.1.12",
|
|
51
|
-
"@molecule/app-routing": "1.5.
|
|
53
|
+
"@molecule/app-routing": "1.5.3"
|
|
52
54
|
}
|
|
53
55
|
}
|