@baukit/navigation 0.0.0-stage → 0.7.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Patrick Koss
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,132 @@
1
- # Temporary Holding Version
1
+ # @baukit/navigation
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Collapsible navigation for React DOM and React Native. Products supply routes,
4
+ copy, icon renderers and tokens. The package imports no router, icon library or
5
+ Tailwind code.
6
+
7
+ ## Entries
8
+
9
+ - `@baukit/navigation` contains the TypeScript model, validation, active-route
10
+ resolution, section rotation, disclosure reducer and layout selection. It has
11
+ no React import.
12
+ - `@baukit/navigation/web` contains `AppNavigation` and `SectionPicker` for DOM.
13
+ It never imports React Native, including through `a11y-core`.
14
+ - `@baukit/navigation/native` contains those components for React Native and
15
+ React Native Web. Use `AppNavigation` as an Expo Router custom `tabBar`.
16
+ - `@baukit/navigation/web.css` styles the DOM entry with `--bk-*` variables.
17
+
18
+ ```tsx
19
+ import { AppNavigation, SectionPicker } from '@baukit/navigation/web';
20
+ import '@baukit/navigation/web.css';
21
+
22
+ const progress = {
23
+ id: 'progress',
24
+ label: 'Progress',
25
+ href: '/progress',
26
+ icon: ({ active, size }) => <ChartIcon filled={active} size={size} />,
27
+ children: [
28
+ { id: 'overview', label: 'Overview', href: '/progress' },
29
+ { id: 'history', label: 'History', href: '/progress/history' },
30
+ ],
31
+ };
32
+
33
+ <AppNavigation
34
+ items={[progress]}
35
+ pathname={pathname}
36
+ onNavigate={(href) => router.navigate(href)}
37
+ profile={{ label: 'Account', initials: 'AB', href: '/profile' }}
38
+ />;
39
+ <SectionPicker item={progress} pathname={pathname} onNavigate={navigate} />;
40
+ ```
41
+
42
+ Declare `items` as `readonly NavigationItem<NavigationIcon>[]` to type icon
43
+ parameters. Web and native entries each export `NavigationIcon`. Renderers
44
+ receive `{ active, size }`. The wrapper hides decorative icons from assistive
45
+ technology. Include section roots in `children` when they belong in the cycle.
46
+
47
+ The default route match is an exact href or a slash-delimited descendant.
48
+ `matches(pathname)` replaces it. Children win over parents, and the longest
49
+ matching href wins among children. Pass a custom matcher for route aliases,
50
+ search parameters or hashes. A missing match selects nothing. `nextSectionHref`
51
+ returns the first child for a missing match and wraps at the last child.
52
+
53
+ Below 1024 pixels the component renders a bottom bar with icons above labels.
54
+ It supports five main items plus an optional profile. Keep labels short enough
55
+ for the compact bar. At 1024 pixels it renders a 280-pixel rail. Collapse reduces
56
+ it to 76 pixels. The active section starts open. Clicking a collapsed disclosure
57
+ expands the rail and opens that section.
58
+
59
+ `collapsed`, `defaultCollapsed`, and `onCollapsedChange` support controlled and
60
+ uncontrolled state. Persist the controlled value in the product's preference
61
+ store. Use `collapseLabel`, `expandLabel`, and `label` for translated copy.
62
+
63
+ Web uses real anchors. `onNavigate` intercepts only an unmodified primary click.
64
+ Without it the browser follows the href. `renderLink(props)` can return a router
65
+ Link. Forward every supplied prop, especially href, ref, onKeyDown, onClick and
66
+ ARIA attributes. Keep modified clicks in the browser. TanStack Router products
67
+ can map `href` to `to`, or use `onNavigate` with their router instance.
68
+
69
+ A profile accepts either `href` or a nonempty `menu`. Menu entries have unique
70
+ ids, labels and either `href` or synchronous `onSelect`. A product owns async
71
+ action errors. Start an async sign-out in `onSelect` and handle its rejection in
72
+ the product. `imageUrl` renders an avatar, with initials after an image failure.
73
+ The profile stays last in the bar and at the bottom of the rail.
74
+
75
+ Active leaves use a muted accent background with an accent icon and bold label.
76
+ In the expanded rail, the parent of an active child has accent text and icon
77
+ without a fill. The active icon renderer receives `active: true` for both rows.
78
+ In the bar and collapsed rail, the parent gets the fill. Web rows expose
79
+ `data-active="page"` or `data-active="ancestor"`; inactive rows omit the attribute.
80
+ Override `--bk-navigation-active-background`, `--bk-navigation-active-text` and
81
+ `--bk-navigation-ancestor-text` on `.bk-navigation` to match a product palette.
82
+ The default background mixes 14% accent over the navigation background.
83
+
84
+ ## Native tokens and shell
85
+
86
+ Supply a `NavigationTheme` from the product's compiled ui-tokens. Do not use
87
+ raw brand colors in the navigation component.
88
+
89
+ | NavigationTheme field | Semantic token |
90
+ | --------------------- | ---------------------------------------------------- |
91
+ | background | color.background.primary or surface |
92
+ | text | color.text.primary |
93
+ | muted | color.text.muted |
94
+ | activeBackground | blendColors(accent, background, 0.14) from ui-tokens |
95
+ | activeText | color.background.accent |
96
+ | ancestorText | color.background.accent |
97
+ | border | color.border.primary |
98
+ | focus | color.focus.ring |
99
+ | spacing | space.small |
100
+ | radius | radius.small |
101
+
102
+ Use a tested contrast pair for `activeText` and the muted `activeBackground`.
103
+ Check `ancestorText` against `background` too. `blendColors` and `contrastRatio`
104
+ from ui-tokens check these pairs in both themes. Native
105
+ changes are immediate. Web width transitions run only after reduced motion
106
+ resolves and only if motion is allowed.
107
+
108
+ Set Expo Tabs' `tabBarPosition` to `left` in rail mode and `bottom` otherwise.
109
+ Pass the safe-area insets and pathname to the custom tab bar. The component
110
+ occupies layout space on native. The DOM component is fixed; reserve its width
111
+ or bottom height in the content shell. `NAVIGATION_DIMENSIONS` exports those
112
+ numbers. Match the shell's margin and width transitions to the rail, or reserve
113
+ the expanded width. Enable transitions only for `data-motion="standard"`.
114
+ Include the bottom safe-area inset. The section picker belongs inside
115
+ the current section's content.
116
+
117
+ Keep route-heading focus in the product. Use
118
+ `createRouteFocusController` from `@baukit/a11y-core/web` for DOM route changes,
119
+ and the product's screen-transition adapter on native. Navigation does not know
120
+ which heading has mounted.
121
+
122
+ The DOM stylesheet uses stable `bk-navigation*` classes and `data-layout`,
123
+ `data-collapsed`, `data-active`, `data-open`, and `data-motion` attributes.
124
+ Products can override these selectors in plain CSS or Tailwind.
125
+
126
+ ## Verification
127
+
128
+ `pnpm test` runs model and DOM tests, native tests with React Native Testing
129
+ Library and the React Native Jest preset, and checks the packed exports. Expo
130
+ is not needed for these tests. `pnpm test:browser` runs Playwright through
131
+ Vitest in Chromium and WebKit at 320, 1023 and 1024 pixels, with short and normal
132
+ heights. It checks geometry, 44-pixel targets, browser warnings and axe.
@@ -0,0 +1,65 @@
1
+ export interface NavigationSubItem<Icon = unknown> {
2
+ readonly id: string;
3
+ readonly label: string;
4
+ readonly href: string;
5
+ readonly icon?: Icon;
6
+ readonly matches?: (pathname: string) => boolean;
7
+ }
8
+ export interface NavigationItem<Icon = unknown> extends NavigationSubItem<Icon> {
9
+ readonly icon: Icon;
10
+ readonly children?: readonly NavigationSubItem<Icon>[];
11
+ }
12
+ export type NavigationProfileMenuEntry = {
13
+ readonly id: string;
14
+ readonly label: string;
15
+ readonly disabled?: boolean;
16
+ } & ({
17
+ readonly href: string;
18
+ readonly onSelect?: never;
19
+ } | {
20
+ readonly onSelect: () => void;
21
+ readonly href?: never;
22
+ });
23
+ export type NavigationProfile = {
24
+ readonly label: string;
25
+ readonly initials: string;
26
+ readonly imageUrl?: string;
27
+ } & ({
28
+ readonly href: string;
29
+ readonly menu?: never;
30
+ } | {
31
+ readonly menu: readonly NavigationProfileMenuEntry[];
32
+ readonly href?: never;
33
+ });
34
+ export interface ActiveNavigation<Icon = unknown> {
35
+ readonly item: NavigationItem<Icon> | null;
36
+ readonly subItem: NavigationSubItem<Icon> | null;
37
+ }
38
+ export declare const NAVIGATION_DIMENSIONS: {
39
+ readonly rail: 280;
40
+ readonly collapsedRail: 76;
41
+ readonly bar: 64;
42
+ readonly target: 44;
43
+ };
44
+ export declare function getNavigationLayout(width: number): 'bar' | 'rail';
45
+ export declare function navigationMatches(item: NavigationSubItem, pathname: string): boolean;
46
+ export declare function resolveActiveNavigation<Icon>(items: readonly NavigationItem<Icon>[], pathname: string): ActiveNavigation<Icon>;
47
+ export declare function nextSectionHref(item: NavigationItem, pathname: string): string;
48
+ export interface NavigationState {
49
+ readonly collapsed: boolean;
50
+ readonly openIds: readonly string[];
51
+ }
52
+ export type NavigationAction = {
53
+ readonly type: 'set-collapsed';
54
+ readonly collapsed: boolean;
55
+ } | {
56
+ readonly type: 'toggle-group';
57
+ readonly id: string;
58
+ readonly collapsed?: boolean;
59
+ } | {
60
+ readonly type: 'enter-section';
61
+ readonly id: string | null;
62
+ };
63
+ export declare function navigationReducer(state: NavigationState, action: NavigationAction): NavigationState;
64
+ export declare function validateNavigation(items: readonly NavigationItem[], profile?: NavigationProfile): void;
65
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB,CAAC,IAAI,GAAG,OAAO;IAC/C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC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kBAAkB,CAChC,KAAK,EAAE,SAAS,cAAc,EAAE,EAChC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,IAAI,CAyBN"}
package/dist/index.js ADDED
@@ -0,0 +1,88 @@
1
+ import { getLayoutMode } from '@baukit/ui-tokens';
2
+ export const NAVIGATION_DIMENSIONS = {
3
+ rail: 280,
4
+ collapsedRail: 76,
5
+ bar: 64,
6
+ target: 44,
7
+ };
8
+ export function getNavigationLayout(width) {
9
+ return getLayoutMode(width, { medium: 600, expanded: 1024 }) === 'expanded' ? 'rail' : 'bar';
10
+ }
11
+ export function navigationMatches(item, pathname) {
12
+ if (item.matches !== undefined)
13
+ return item.matches(pathname);
14
+ return pathname === item.href || (item.href !== '/' && pathname.startsWith(`${item.href}/`));
15
+ }
16
+ function bestMatch(items, pathname) {
17
+ return items.reduce((best, item) => {
18
+ if (!navigationMatches(item, pathname))
19
+ return best;
20
+ return best === null || item.href.length > best.href.length ? item : best;
21
+ }, null);
22
+ }
23
+ export function resolveActiveNavigation(items, pathname) {
24
+ const subItem = bestMatch(items.flatMap((item) => item.children ?? []), pathname);
25
+ const item = subItem === null
26
+ ? bestMatch(items, pathname)
27
+ : (items.find((parent) => parent.children?.includes(subItem)) ?? null);
28
+ return { item, subItem };
29
+ }
30
+ export function nextSectionHref(item, pathname) {
31
+ const routes = item.children ?? [];
32
+ if (routes.length === 0)
33
+ return item.href;
34
+ const current = bestMatch(routes, pathname);
35
+ const index = current === null ? -1 : routes.indexOf(current);
36
+ return routes[(index + 1) % routes.length]?.href ?? item.href;
37
+ }
38
+ export function navigationReducer(state, action) {
39
+ if (action.type === 'set-collapsed')
40
+ return { ...state, collapsed: action.collapsed };
41
+ if (action.type === 'enter-section') {
42
+ return action.id === null || state.openIds.includes(action.id)
43
+ ? state
44
+ : { ...state, openIds: [...state.openIds, action.id] };
45
+ }
46
+ const open = state.openIds.includes(action.id);
47
+ const collapsed = action.collapsed ?? state.collapsed;
48
+ return {
49
+ collapsed: false,
50
+ openIds: open && !collapsed
51
+ ? state.openIds.filter((id) => id !== action.id)
52
+ : open
53
+ ? state.openIds
54
+ : [...state.openIds, action.id],
55
+ };
56
+ }
57
+ export function validateNavigation(items, profile) {
58
+ if (items.length > 5)
59
+ throw new RangeError('Navigation supports at most five main items plus profile.');
60
+ const ids = new Set();
61
+ for (const item of items.flatMap((parent) => [parent, ...(parent.children ?? [])])) {
62
+ if (item.id.trim() === '' || ids.has(item.id))
63
+ throw new Error(`Duplicate or empty navigation id: ${item.id}`);
64
+ ids.add(item.id);
65
+ if (item.label.trim() === '')
66
+ throw new Error(`Navigation label is empty: ${item.id}`);
67
+ if (item.href.trim() === '')
68
+ throw new Error(`Navigation href is empty: ${item.id}`);
69
+ }
70
+ if (profile === undefined)
71
+ return;
72
+ if (profile.label.trim() === '' || profile.initials.trim() === '')
73
+ throw new Error('Profile needs a label and initials.');
74
+ if (profile.href?.trim() === '')
75
+ throw new Error('Profile href is empty.');
76
+ if (profile.menu !== undefined) {
77
+ if (profile.menu.length === 0)
78
+ throw new Error('Profile menu is empty.');
79
+ for (const entry of profile.menu) {
80
+ if (entry.id.trim() === '' || ids.has(entry.id))
81
+ throw new Error(`Duplicate or empty navigation id: ${entry.id}`);
82
+ ids.add(entry.id);
83
+ if (entry.label.trim() === '' || entry.href?.trim() === '')
84
+ throw new Error(`Profile entry is empty: ${entry.id}`);
85
+ }
86
+ }
87
+ }
88
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAsClD,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,GAAG;IACT,aAAa,EAAE,EAAE;IACjB,GAAG,EAAE,EAAE;IACP,MAAM,EAAE,EAAE;CACF,CAAC;AAEX,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,OAAO,aAAa,CAAC,KA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 import { type ViewStyle } from 'react-native';
3
+ import { type NavigationItem, type NavigationProfile } from './index.js';
4
+ import { type CollapseProps } from './use-navigation-state.js';
5
+ export interface NavigationIconState {
6
+ readonly active: boolean;
7
+ readonly size: number;
8
+ }
9
+ export type NavigationIcon = (state: NavigationIconState) => ReactNode;
10
+ export interface NavigationTheme {
11
+ readonly background: string;
12
+ readonly text: string;
13
+ readonly muted: string;
14
+ readonly activeBackground: string;
15
+ readonly activeText: string;
16
+ readonly ancestorText: string;
17
+ readonly border: string;
18
+ readonly focus: string;
19
+ readonly radius: number;
20
+ readonly spacing: number;
21
+ }
22
+ export interface NavigationInsets {
23
+ readonly top?: number;
24
+ readonly bottom?: number;
25
+ readonly left?: number;
26
+ readonly right?: number;
27
+ }
28
+ export type Navigate = (href: string) => void;
29
+ export interface AppNavigationProps extends CollapseProps {
30
+ readonly items: readonly NavigationItem<NavigationIcon>[];
31
+ readonly profile?: NavigationProfile;
32
+ readonly pathname: string;
33
+ readonly onNavigate: Navigate;
34
+ readonly theme: NavigationTheme;
35
+ readonly width?: number;
36
+ readonly insets?: NavigationInsets;
37
+ readonly label?: string;
38
+ readonly collapseLabel?: string;
39
+ readonly expandLabel?: string;
40
+ readonly style?: ViewStyle;
41
+ }
42
+ export declare function AppNavigation(props: AppNavigationProps): import("react").JSX.Element;
43
+ export interface SectionPickerProps {
44
+ readonly item: NavigationItem<NavigationIcon>;
45
+ readonly pathname: string;
46
+ readonly onNavigate: Navigate;
47
+ readonly theme: NavigationTheme;
48
+ }
49
+ export declare function SectionPicker({ item, pathname, onNavigate, theme }: SectionPickerProps): import("react").JSX.Element | null;
50
+ //# sourceMappingURL=native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAYL,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAWtB,OAA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