@baukit/navigation 0.7.3 → 0.8.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/README.md +37 -3
- package/dist/index.d.ts +30 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -4
- package/dist/index.js.map +1 -1
- package/dist/native.d.ts +4 -3
- package/dist/native.d.ts.map +1 -1
- package/dist/native.js +168 -38
- package/dist/native.js.map +1 -1
- package/dist/web.css +72 -8
- package/dist/web.d.ts +5 -3
- package/dist/web.d.ts.map +1 -1
- package/dist/web.js +63 -37
- package/dist/web.js.map +1 -1
- package/package.json +3 -3
- package/src/index.test.ts +49 -3
- package/src/index.ts +66 -5
- package/src/native.browser.test.tsx +45 -0
- package/src/native.test.tsx +407 -7
- package/src/native.tsx +234 -33
- package/src/web.browser.test.tsx +246 -11
- package/src/web.css +72 -8
- package/src/web.test.tsx +106 -1
- package/src/web.tsx +122 -61
package/README.md
CHANGED
|
@@ -34,12 +34,13 @@ const progress = {
|
|
|
34
34
|
label={copy.primary}
|
|
35
35
|
collapseLabel={copy.collapse}
|
|
36
36
|
expandLabel={copy.expand}
|
|
37
|
+
closeLabel={copy.close}
|
|
37
38
|
items={[progress]}
|
|
38
39
|
pathname={pathname}
|
|
39
40
|
onNavigate={(href) => router.navigate(href)}
|
|
40
41
|
profile={{ label: 'Account', initials: 'AB', href: '/profile' }}
|
|
41
42
|
/>;
|
|
42
|
-
<SectionPicker item={progress} pathname={pathname} onNavigate={navigate} />;
|
|
43
|
+
<SectionPicker closeLabel={copy.close} item={progress} pathname={pathname} onNavigate={navigate} />;
|
|
43
44
|
```
|
|
44
45
|
|
|
45
46
|
Declare `items` as `readonly NavigationItem<NavigationIcon>[]` to type icon
|
|
@@ -61,7 +62,7 @@ expands the rail and opens that section.
|
|
|
61
62
|
|
|
62
63
|
`collapsed`, `defaultCollapsed`, and `onCollapsedChange` support controlled and
|
|
63
64
|
uncontrolled state. Persist the controlled value in the product's preference
|
|
64
|
-
store. Supply `collapseLabel`, `expandLabel`, and `label` from the product's catalog.
|
|
65
|
+
store. Supply `collapseLabel`, `expandLabel`, and `label` from the product's catalog. Web and native `AppNavigation` and `SectionPicker` also require `closeLabel` for the visible and accessible menu Close control. Components have no English defaults.
|
|
65
66
|
|
|
66
67
|
Web uses real anchors. `onNavigate` intercepts only an unmodified primary click.
|
|
67
68
|
Without it the browser follows the href. `renderLink(props)` can return a router
|
|
@@ -70,7 +71,12 @@ ARIA attributes. Keep modified clicks in the browser. TanStack Router products
|
|
|
70
71
|
can map `href` to `to`, or use `onNavigate` with their router instance.
|
|
71
72
|
|
|
72
73
|
A profile accepts either `href` or a nonempty `menu`. Menu entries have unique
|
|
73
|
-
ids, labels and either `href` or synchronous `onSelect`.
|
|
74
|
+
ids, labels and either `href` or synchronous `onSelect`. Set `tone: 'danger'`
|
|
75
|
+
for destructive actions. Web uses `color.status.danger`; native uses the
|
|
76
|
+
`NavigationTheme.danger` token against `background`. Check that pair at 4.5:1
|
|
77
|
+
in both themes. Native invokes callbacks after the menu closes, using iOS
|
|
78
|
+
`onDismiss` or the first frame after unanimated Modal removal on Android/web.
|
|
79
|
+
Link entries accept `matches(pathname)`. Only the most-specific matching path is selected in a menu. A product owns async
|
|
74
80
|
action errors. Start an async sign-out in `onSelect` and handle its rejection in
|
|
75
81
|
the product. `imageUrl` renders an avatar, with initials after an image failure.
|
|
76
82
|
`renderAvatar({ active, size })` replaces the image or initials with a product
|
|
@@ -98,6 +104,7 @@ raw brand colors in the navigation component.
|
|
|
98
104
|
| --------------------- | ---------------------------------------------------- |
|
|
99
105
|
| background | color.background.primary or surface |
|
|
100
106
|
| text | color.text.primary |
|
|
107
|
+
| danger | color.status.danger |
|
|
101
108
|
| muted | color.text.muted |
|
|
102
109
|
| activeBackground | blendColors(accent, background, 0.14) from ui-tokens |
|
|
103
110
|
| activeText | color.background.accent |
|
|
@@ -125,6 +132,14 @@ trigger and above the compact bottom bar. Long sections scroll inside that
|
|
|
125
132
|
space. It updates the limit when the viewport, content layout, or scroll
|
|
126
133
|
position changes.
|
|
127
134
|
|
|
135
|
+
For compact native content, `useNavigationBarHeight(bottomInset, theme)` reserves
|
|
136
|
+
space using the current font scale and the bar's typography and spacing. Pass the
|
|
137
|
+
same theme as `AppNavigation` when you customize it. The default height is 75 dp
|
|
138
|
+
before the bottom inset. `getNavigationBarHeight(fontScale, bottomInset, metrics)`
|
|
139
|
+
provides the same calculation without a hook. Its optional metrics are `spacing`,
|
|
140
|
+
`fontSize` and `lineHeight`. `NAVIGATION_DIMENSIONS.nativeBar` is the default native
|
|
141
|
+
height; `bar` remains the 64-pixel DOM height.
|
|
142
|
+
|
|
128
143
|
Keep route-heading focus in the product. Use
|
|
129
144
|
`createRouteFocusController` from `@baukit/a11y-core/web` for DOM route changes,
|
|
130
145
|
and the product's screen-transition adapter on native. Navigation does not know
|
|
@@ -151,3 +166,22 @@ Native `NavigationTheme.typography` can set `fontFamily`, `fontSize`,
|
|
|
151
166
|
and `letterSpacing`. Sizes and line height use React Native units. Omitted fields
|
|
152
167
|
keep the default sizes and weights. The font family also applies to menu entries,
|
|
153
168
|
initials and section pickers, as the web navigation inherits its CSS font family.
|
|
169
|
+
|
|
170
|
+
## Brand and accessory slots
|
|
171
|
+
|
|
172
|
+
Pass `renderBrand(state)` for a wordmark or logo and `renderAccessory(state)`
|
|
173
|
+
for status or a product control. Both receive `{ layout: 'bar' | 'rail', collapsed }`.
|
|
174
|
+
Return a small logo and compact status in a collapsed rail. Supply accessible
|
|
175
|
+
names for logos and controls. Slot content keeps its own semantics.
|
|
176
|
+
|
|
177
|
+
The rail puts both slots above its controls. The compact bar puts them above
|
|
178
|
+
the stacked icon and label targets. Web wraps the slot row when its content does
|
|
179
|
+
not fit. Native measures the slot row and includes it in `getNavigationBarHeight`
|
|
180
|
+
through `NavigationBarMetrics.slotHeight`.
|
|
181
|
+
`useNavigationBarHeight(bottomInset, theme, slotHeight)` accepts the same height.
|
|
182
|
+
|
|
183
|
+
On both platforms, `onBarHeightChange(height)` reports the full compact bar
|
|
184
|
+
height, including slots and safe areas. Store it in the content shell to reserve
|
|
185
|
+
bottom space. Web reports rendered height with a ResizeObserver, including font
|
|
186
|
+
changes. Native reports the height from the same calculation it uses to size
|
|
187
|
+
the bar. Use this callback when slots can change size.
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export type NavigationProfileMenuEntry = {
|
|
|
14
14
|
readonly id: string;
|
|
15
15
|
readonly label: string;
|
|
16
16
|
readonly disabled?: boolean;
|
|
17
|
+
readonly tone?: 'default' | 'danger';
|
|
17
18
|
} & ({
|
|
18
19
|
readonly href: string;
|
|
19
20
|
readonly matches?: (pathname: string) => boolean;
|
|
@@ -44,15 +45,43 @@ export interface ActiveNavigation<Icon = unknown> {
|
|
|
44
45
|
readonly item: NavigationItem<Icon> | null;
|
|
45
46
|
readonly subItem: NavigationSubItem<Icon> | null;
|
|
46
47
|
}
|
|
48
|
+
export declare const NAVIGATION_BAR_DIMENSIONS: {
|
|
49
|
+
readonly avatar: 28;
|
|
50
|
+
readonly icon: 24;
|
|
51
|
+
readonly border: 1;
|
|
52
|
+
readonly targetBorder: 3;
|
|
53
|
+
readonly targetPadding: 8;
|
|
54
|
+
readonly labelFontSize: 11;
|
|
55
|
+
readonly labelLineHeight: 16;
|
|
56
|
+
readonly spacing: 8;
|
|
57
|
+
};
|
|
58
|
+
export interface NavigationSlotState {
|
|
59
|
+
readonly layout: 'bar' | 'rail';
|
|
60
|
+
readonly collapsed: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface NavigationSlots {
|
|
63
|
+
readonly renderBrand?: (state: NavigationSlotState) => ReactNode;
|
|
64
|
+
readonly renderAccessory?: (state: NavigationSlotState) => ReactNode;
|
|
65
|
+
readonly onBarHeightChange?: (height: number) => void;
|
|
66
|
+
}
|
|
67
|
+
export interface NavigationBarMetrics {
|
|
68
|
+
readonly slotHeight?: number;
|
|
69
|
+
readonly spacing?: number;
|
|
70
|
+
readonly fontSize?: number;
|
|
71
|
+
readonly lineHeight?: number;
|
|
72
|
+
}
|
|
73
|
+
export declare function getNavigationBarLineHeight(metrics?: NavigationBarMetrics): number;
|
|
74
|
+
export declare function getNavigationBarVisualHeight(fontScale?: number): number;
|
|
75
|
+
export declare function getNavigationBarHeight(fontScale?: number, bottomInset?: number, metrics?: NavigationBarMetrics): number;
|
|
47
76
|
export declare const NAVIGATION_DIMENSIONS: {
|
|
48
77
|
readonly avatar: 28;
|
|
49
78
|
readonly rail: 280;
|
|
50
79
|
readonly collapsedRail: 76;
|
|
51
80
|
readonly bar: 64;
|
|
81
|
+
readonly nativeBar: number;
|
|
52
82
|
readonly target: 44;
|
|
53
83
|
readonly androidTarget: 48;
|
|
54
84
|
};
|
|
55
|
-
export declare function getNavigationBarHeight(fontScale?: number, bottomInset?: number): number;
|
|
56
85
|
export declare function getNavigationLayout(width: number): 'bar' | 'rail';
|
|
57
86
|
export declare function navigationMatches(item: NavigationSubItem, pathname: string): boolean;
|
|
58
87
|
export declare function resolveActiveMenuEntry(entries: readonly NavigationProfileMenuEntry[], pathname: string): NavigationProfileMenuEntry | null;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,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,IAAI,CAAC,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;CAClD;AAED,MAAM,WAAW,cAAc,CAAC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O,EAAE,SAAS,0BAA0B,EAAE,EAC9C,QAAQ,EAAE,MAAM,GACf,0BAA0B,GAAG,IAAI,CAKnC;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAC1C,KAAK,EAAE,SAAS,cAAc,CAAC,IAAI,CAAC,EAAE,EACtC,QAAQ,EAAE,MAAM,GACf,gBAAgB,CAAC,IAAI,CAAC,CAUxB;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM9E;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED,MAAM,MAAM,gBAAgB,GACxB;IAAE,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAAE,GAC/D;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GACpF;IAAE,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAEnE,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,gBAAgB,GACvB,eAAe,CAkBjB;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,SAAS,cAAc,EAAE,EAChC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,IAAI,CAyBN"}
|
package/dist/index.js
CHANGED
|
@@ -4,17 +4,43 @@ export function getNavigationProfileLabel(profile) {
|
|
|
4
4
|
? profile.label
|
|
5
5
|
: `${profile.label}, ${profile.subtitle}`;
|
|
6
6
|
}
|
|
7
|
-
export const
|
|
7
|
+
export const NAVIGATION_BAR_DIMENSIONS = {
|
|
8
8
|
avatar: 28,
|
|
9
|
+
icon: 24,
|
|
10
|
+
border: 1,
|
|
11
|
+
targetBorder: 3,
|
|
12
|
+
targetPadding: 8,
|
|
13
|
+
labelFontSize: 11,
|
|
14
|
+
labelLineHeight: 16,
|
|
15
|
+
spacing: 8,
|
|
16
|
+
};
|
|
17
|
+
export function getNavigationBarLineHeight(metrics = {}) {
|
|
18
|
+
return (metrics.lineHeight ??
|
|
19
|
+
Math.ceil((metrics.fontSize ?? NAVIGATION_BAR_DIMENSIONS.labelFontSize) *
|
|
20
|
+
(NAVIGATION_BAR_DIMENSIONS.labelLineHeight / NAVIGATION_BAR_DIMENSIONS.labelFontSize)));
|
|
21
|
+
}
|
|
22
|
+
export function getNavigationBarVisualHeight(fontScale = 1) {
|
|
23
|
+
return Math.max(NAVIGATION_BAR_DIMENSIONS.avatar, NAVIGATION_BAR_DIMENSIONS.icon * Math.max(1, fontScale));
|
|
24
|
+
}
|
|
25
|
+
export function getNavigationBarHeight(fontScale = 1, bottomInset = 0, metrics = {}) {
|
|
26
|
+
const scale = Math.max(1, fontScale);
|
|
27
|
+
return (NAVIGATION_BAR_DIMENSIONS.border +
|
|
28
|
+
2 * (NAVIGATION_BAR_DIMENSIONS.targetBorder + NAVIGATION_BAR_DIMENSIONS.targetPadding) +
|
|
29
|
+
getNavigationBarVisualHeight(scale) +
|
|
30
|
+
(metrics.spacing ?? NAVIGATION_BAR_DIMENSIONS.spacing) +
|
|
31
|
+
getNavigationBarLineHeight(metrics) * scale +
|
|
32
|
+
bottomInset +
|
|
33
|
+
(metrics.slotHeight ?? 0));
|
|
34
|
+
}
|
|
35
|
+
export const NAVIGATION_DIMENSIONS = {
|
|
36
|
+
avatar: NAVIGATION_BAR_DIMENSIONS.avatar,
|
|
9
37
|
rail: 280,
|
|
10
38
|
collapsedRail: 76,
|
|
11
39
|
bar: 64,
|
|
40
|
+
nativeBar: getNavigationBarHeight(),
|
|
12
41
|
target: 44,
|
|
13
42
|
androidTarget: 48,
|
|
14
43
|
};
|
|
15
|
-
export function getNavigationBarHeight(fontScale = 1, bottomInset = 0) {
|
|
16
|
-
return NAVIGATION_DIMENSIONS.bar * Math.max(1, fontScale) + bottomInset;
|
|
17
|
-
}
|
|
18
44
|
export function getNavigationLayout(width) {
|
|
19
45
|
return getLayoutMode(width, { medium: 600, expanded: 1024 }) === 'expanded' ? 'rail' : 'bar';
|
|
20
46
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AA8ClD,MAAM,UAAU,yBAAyB,CAAC,OAA0B;IAClE,OAAO,OAAO,CAAC,QAAQ,KAAK,SAAS,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE;QACrE,CAAC,CAAC,OAAO,CAAC,KAAK;QACf,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,KAAK,OAAO,CAAC,QAAQ,EAAE,CAAC;AAC9C,CAAC;AAOD,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,MAAM,EAAE,EAAE;IACV,IAAI,EAAE,EAAE;IACR,MAAM,EAAE,CAAC;IACT,YAAY,EAAE,CAAC;IACf,aAAa,EAAE,CAAC;IAChB,aAAa,EAAE,EAAE;IACjB,eAAe,EAAE,EAAE;IACnB,OAAO,EAAE,CAAC;CACF,CAAC;AAoBX,MAAM,UAAU,0BAA0B,CAAC,UAAgC,EAAE;IAC3E,OAAO,CACL,OAAO,CAAC,UAAU;QAClB,IAAI,CAAC,IAAI,CACP,CAAC,OAAO,CAAC,QAAQ,IAAI,yBAAyB,CAAC,aAAa,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E,CAAC,CAAC;YACnE,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAClB,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE;gBACxD,MAAM,IAAI,KAAK,CAAC,2BAA2B,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/native.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type ViewStyle, type TextStyle } from 'react-native';
|
|
3
|
-
import { type NavigationItem, type NavigationProfile } from './index.js';
|
|
3
|
+
import { type NavigationSlots, type NavigationItem, type NavigationProfile } from './index.js';
|
|
4
4
|
import { type CollapseProps } from './use-navigation-state.js';
|
|
5
5
|
export interface NavigationIconState {
|
|
6
6
|
readonly active: boolean;
|
|
@@ -21,6 +21,7 @@ export interface NavigationTheme {
|
|
|
21
21
|
readonly background: string;
|
|
22
22
|
readonly text: string;
|
|
23
23
|
readonly muted: string;
|
|
24
|
+
readonly danger: string;
|
|
24
25
|
readonly activeBackground: string;
|
|
25
26
|
readonly activeText: string;
|
|
26
27
|
readonly ancestorText: string;
|
|
@@ -37,8 +38,8 @@ export interface NavigationInsets {
|
|
|
37
38
|
readonly right?: number;
|
|
38
39
|
}
|
|
39
40
|
export type Navigate = (href: string) => void;
|
|
40
|
-
export declare function useNavigationBarHeight(bottomInset?: number): number;
|
|
41
|
-
export interface AppNavigationProps extends CollapseProps {
|
|
41
|
+
export declare function useNavigationBarHeight(bottomInset?: number, theme?: NavigationTheme, slotHeight?: number): number;
|
|
42
|
+
export interface AppNavigationProps extends CollapseProps, NavigationSlots {
|
|
42
43
|
readonly items: readonly NavigationItem<NavigationIcon>[];
|
|
43
44
|
readonly profile?: NavigationProfile;
|
|
44
45
|
readonly pathname: string;
|
package/dist/native.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,
|
|
1
|
+
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAeL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAYtB,OAAO,EAOL,KAAK,eAAe,EAOpB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EAEvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAEnF,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AACD,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,mBAAmB,KAAK,SAAS,CAAC;AACvE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;IAC9C,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;IACpD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,C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K,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;CAC5B;AACD,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,+BA0QtD;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;CACjC;AACD,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,KAAK,EACL,UAAU,GACX,EAAE,kBAAkB,sCAiEpB"}
|
package/dist/native.js
CHANGED
|
@@ -3,17 +3,30 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { useEffect, useCallback, useLayoutEffect, useId, useRef, useState, } from 'react';
|
|
4
4
|
import { Image, Modal, Platform, Pressable, ScrollView, StyleSheet, Text, View, useWindowDimensions, } from 'react-native';
|
|
5
5
|
import { announce, asFocusTarget, hostElement, useAriaHiddenInert, useOverlayA11y, useReducedMotionPreference, useRovingMenu, } from '@baukit/a11y-core';
|
|
6
|
-
import { getNavigationLayout, getNavigationBarHeight, NAVIGATION_DIMENSIONS, navigationMatches, nextSectionHref, resolveActiveNavigation, resolveActiveMenuEntry, validateNavigation, } from './index.js';
|
|
6
|
+
import { getNavigationLayout, getNavigationBarHeight, getNavigationBarVisualHeight, getNavigationBarLineHeight, NAVIGATION_BAR_DIMENSIONS, NAVIGATION_DIMENSIONS, navigationMatches, nextSectionHref, resolveActiveNavigation, resolveActiveMenuEntry, validateNavigation, } from './index.js';
|
|
7
7
|
import { useNavigationState } from './use-navigation-state.js';
|
|
8
|
+
function barMetrics(theme) {
|
|
9
|
+
return {
|
|
10
|
+
...(theme === undefined ? {} : { spacing: theme.spacing }),
|
|
11
|
+
...(theme?.typography?.barFontSize === undefined
|
|
12
|
+
? {}
|
|
13
|
+
: { fontSize: theme.typography.barFontSize }),
|
|
14
|
+
...(theme?.typography?.lineHeight === undefined
|
|
15
|
+
? {}
|
|
16
|
+
: { lineHeight: theme.typography.lineHeight }),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
8
19
|
function textStyle(theme, selected = false, bar = false) {
|
|
9
20
|
const typography = theme.typography;
|
|
10
21
|
return {
|
|
11
22
|
fontFamily: typography?.fontFamily,
|
|
12
|
-
fontSize: bar
|
|
23
|
+
fontSize: bar
|
|
24
|
+
? (typography?.barFontSize ?? NAVIGATION_BAR_DIMENSIONS.labelFontSize)
|
|
25
|
+
: (typography?.fontSize ?? 14),
|
|
13
26
|
fontWeight: selected
|
|
14
27
|
? (typography?.activeFontWeight ?? '700')
|
|
15
28
|
: (typography?.fontWeight ?? '400'),
|
|
16
|
-
lineHeight: typography?.lineHeight,
|
|
29
|
+
lineHeight: bar ? getNavigationBarLineHeight(barMetrics(theme)) : typography?.lineHeight,
|
|
17
30
|
letterSpacing: typography?.letterSpacing,
|
|
18
31
|
};
|
|
19
32
|
}
|
|
@@ -34,7 +47,7 @@ function FocusablePressable({ theme, selected = false, unfocusedBorderColor, sty
|
|
|
34
47
|
minWidth: Platform.OS === 'android'
|
|
35
48
|
? NAVIGATION_DIMENSIONS.androidTarget
|
|
36
49
|
: NAVIGATION_DIMENSIONS.target,
|
|
37
|
-
borderWidth:
|
|
50
|
+
borderWidth: NAVIGATION_BAR_DIMENSIONS.targetBorder,
|
|
38
51
|
borderColor: focused
|
|
39
52
|
? selected
|
|
40
53
|
? theme.activeText
|
|
@@ -93,8 +106,8 @@ function Target({ label, subtitle, selected = false, ancestor = false, expanded,
|
|
|
93
106
|
fontSize: theme.typography?.subtitleFontSize ?? 12,
|
|
94
107
|
}, children: subtitle })) : null] })) : null] }));
|
|
95
108
|
}
|
|
96
|
-
function Decorative({ children }) {
|
|
97
|
-
return (_jsx(View, { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", "aria-hidden": true, children: children }));
|
|
109
|
+
function Decorative({ children, style, }) {
|
|
110
|
+
return (_jsx(View, { style: style, accessible: false, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", "aria-hidden": true, children: children }));
|
|
98
111
|
}
|
|
99
112
|
const MENU_WIDTH = 280;
|
|
100
113
|
const MENU_EDGE = 8;
|
|
@@ -104,6 +117,28 @@ function Menu({ subtitle, renderBackground, entries, label, closeLabel, pathname
|
|
|
104
117
|
const closeRef = useRef(null);
|
|
105
118
|
const pendingFocus = useRef(null);
|
|
106
119
|
const presented = useRef(false);
|
|
120
|
+
const pendingSelection = useRef(null);
|
|
121
|
+
const finishSelection = useCallback(() => {
|
|
122
|
+
const selection = pendingSelection.current;
|
|
123
|
+
pendingSelection.current = null;
|
|
124
|
+
selection?.();
|
|
125
|
+
}, []);
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
if (visible) {
|
|
128
|
+
pendingSelection.current = null;
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (Platform.OS === 'ios' || pendingSelection.current === null)
|
|
132
|
+
return;
|
|
133
|
+
// Android removes an unanimated Modal in the close commit and has no onDismiss event.
|
|
134
|
+
const frame = requestAnimationFrame(finishSelection);
|
|
135
|
+
return () => {
|
|
136
|
+
cancelAnimationFrame(frame);
|
|
137
|
+
};
|
|
138
|
+
}, [visible, finishSelection]);
|
|
139
|
+
useEffect(() => () => {
|
|
140
|
+
pendingSelection.current = null;
|
|
141
|
+
}, []);
|
|
107
142
|
const [webPresented, setWebPresented] = useState(false);
|
|
108
143
|
const [webPosition, setWebPosition] = useState();
|
|
109
144
|
const deferFocus = useCallback((task) => {
|
|
@@ -211,29 +246,41 @@ function Menu({ subtitle, renderBackground, entries, label, closeLabel, pathname
|
|
|
211
246
|
...textStyle(theme),
|
|
212
247
|
color: theme.muted,
|
|
213
248
|
fontSize: theme.typography?.subtitleFontSize ?? 12,
|
|
214
|
-
}, children: subtitle })] }) })), _jsx(ScrollView, { children: entries.map((entry, index) => (_createElement(FocusablePressable, { theme: theme, selected: entry === activeEntry, dataSet: { active: entry === activeEntry ? 'page' : 'false' }, ...roving.itemProps(index), key: entry.id, accessibilityRole: "menuitem", accessibilityLabel: entry.label, accessibilityState: {
|
|
249
|
+
}, children: subtitle })] }) })), _jsx(ScrollView, { children: entries.map((entry, index) => (_createElement(FocusablePressable, { theme: theme, selected: entry === activeEntry, dataSet: { active: entry === activeEntry ? 'page' : 'false', tone: entry.tone }, ...roving.itemProps(index), key: entry.id, accessibilityRole: "menuitem", accessibilityLabel: entry.label, accessibilityState: {
|
|
215
250
|
disabled: entry.disabled === true,
|
|
216
251
|
selected: entry === activeEntry,
|
|
217
252
|
}, disabled: entry.disabled, ...(entry.href === undefined ? {} : webLink(entry.href, entry === activeEntry)), onPress: (event) => {
|
|
218
|
-
if (isModifiedPress(event))
|
|
253
|
+
if (isModifiedPress(event) || pendingSelection.current !== null)
|
|
219
254
|
return;
|
|
255
|
+
event.preventDefault();
|
|
256
|
+
pendingSelection.current =
|
|
257
|
+
entry.href !== undefined
|
|
258
|
+
? () => {
|
|
259
|
+
onNavigate(entry.href);
|
|
260
|
+
}
|
|
261
|
+
: entry.onSelect;
|
|
220
262
|
closeAndRestore();
|
|
221
|
-
if (entry.href !== undefined)
|
|
222
|
-
follow(entry.href, event, onNavigate);
|
|
223
|
-
else
|
|
224
|
-
entry.onSelect();
|
|
225
263
|
}, style: [
|
|
226
264
|
styles.menuItem,
|
|
227
265
|
{
|
|
228
266
|
paddingHorizontal: theme.spacing,
|
|
229
|
-
backgroundColor: entry === activeEntry
|
|
267
|
+
backgroundColor: entry === activeEntry && entry.tone !== 'danger'
|
|
268
|
+
? theme.activeBackground
|
|
269
|
+
: theme.background,
|
|
230
270
|
},
|
|
231
271
|
] },
|
|
232
272
|
_jsx(Text, { style: {
|
|
233
|
-
color: entry ===
|
|
273
|
+
color: entry.tone === 'danger'
|
|
274
|
+
? theme.danger
|
|
275
|
+
: entry === activeEntry
|
|
276
|
+
? theme.activeText
|
|
277
|
+
: theme.text,
|
|
234
278
|
...textStyle(theme, entry === activeEntry),
|
|
235
279
|
}, children: entry.label })))) }), _jsx(FocusablePressable, { theme: theme, ref: closeRef, accessibilityRole: "button", accessibilityLabel: closeLabel, onPress: closeAndRestore, style: styles.menuItem, children: _jsx(Text, { style: { ...textStyle(theme), color: theme.text }, children: closeLabel }) })] }));
|
|
236
|
-
return (_jsxs(_Fragment, { children: [renderBackground(backgroundProps), _jsx(Modal, { visible: visible, transparent: true, animationType: "none", onRequestClose: onClose,
|
|
280
|
+
return (_jsxs(_Fragment, { children: [renderBackground(backgroundProps), _jsx(Modal, { visible: visible, transparent: true, animationType: "none", onRequestClose: onClose, onDismiss: () => {
|
|
281
|
+
if (!visible)
|
|
282
|
+
finishSelection();
|
|
283
|
+
}, onShow: () => {
|
|
237
284
|
if (!visible)
|
|
238
285
|
return;
|
|
239
286
|
presented.current = true;
|
|
@@ -244,34 +291,80 @@ function Menu({ subtitle, renderBackground, entries, label, closeLabel, pathname
|
|
|
244
291
|
setWebPresented(true);
|
|
245
292
|
}, children: _jsx(View, { style: styles.modal, children: menu }) })] }));
|
|
246
293
|
}
|
|
247
|
-
function
|
|
294
|
+
function compactVisualStyle(fontScale) {
|
|
295
|
+
return { height: getNavigationBarVisualHeight(fontScale), justifyContent: 'center' };
|
|
296
|
+
}
|
|
297
|
+
function Avatar({ profile, active, theme, style, }) {
|
|
248
298
|
const [failedUrl, setFailedUrl] = useState();
|
|
249
299
|
if (profile.renderAvatar !== undefined) {
|
|
250
|
-
return (_jsx(Decorative, { children: profile.renderAvatar({ active, size: NAVIGATION_DIMENSIONS.avatar }) }));
|
|
300
|
+
return (_jsx(Decorative, { style: style, children: profile.renderAvatar({ active, size: NAVIGATION_DIMENSIONS.avatar }) }));
|
|
251
301
|
}
|
|
252
|
-
return (_jsx(Decorative, { children: profile.imageUrl !== undefined && failedUrl !== profile.imageUrl ? (_jsx(Image, { source: { uri: profile.imageUrl }, onError: () => {
|
|
302
|
+
return (_jsx(Decorative, { style: style, children: profile.imageUrl !== undefined && failedUrl !== profile.imageUrl ? (_jsx(Image, { source: { uri: profile.imageUrl }, onError: () => {
|
|
253
303
|
setFailedUrl(profile.imageUrl);
|
|
254
|
-
}, style: styles.avatar })) : (_jsx(View, { style: [styles.avatar, { backgroundColor: theme.activeBackground }], children: _jsx(Text, { style: { ...textStyle(theme), color: theme.activeText }, children: profile.initials }) })) }));
|
|
304
|
+
}, style: styles.avatar })) : (_jsx(View, { style: [styles.avatar, { backgroundColor: theme.activeBackground }], children: _jsx(Text, { allowFontScaling: false, style: { ...textStyle(theme), color: theme.activeText }, children: profile.initials }) })) }));
|
|
255
305
|
}
|
|
256
|
-
function
|
|
257
|
-
|
|
306
|
+
function profileIsActive(profile, pathname) {
|
|
307
|
+
return profile.href !== undefined
|
|
258
308
|
? navigationMatches({ id: 'profile', label: profile.label, href: profile.href }, pathname)
|
|
259
309
|
: resolveActiveMenuEntry(profile.menu, pathname) !== null;
|
|
260
|
-
|
|
310
|
+
}
|
|
311
|
+
function Profile({ profile, open, onOpen, triggerRef, id, theme, bar, collapsed, pathname, onNavigate, roving, onLayout, }) {
|
|
312
|
+
const { fontScale } = useWindowDimensions();
|
|
313
|
+
const active = profileIsActive(profile, pathname);
|
|
314
|
+
return (_jsx(View, { style: bar ? styles.barSection : styles.profile, testID: "navigation-profile", onLayout: onLayout, children: _jsx(Target, { label: profile.label, subtitle: profile.subtitle, selected: active, theme: theme, bar: bar, collapsed: collapsed, roving: roving, triggerRef: triggerRef, ...(profile.href === undefined
|
|
261
315
|
? { expanded: open, controls: id, menu: true }
|
|
262
316
|
: { href: profile.href }), onPress: (event) => {
|
|
263
317
|
if (profile.href !== undefined)
|
|
264
318
|
follow(profile.href, event, onNavigate);
|
|
265
319
|
else
|
|
266
320
|
onOpen();
|
|
267
|
-
}, children: _jsx(Avatar, { profile: profile, active: active, theme: theme }) }) }));
|
|
321
|
+
}, children: _jsx(Avatar, { profile: profile, active: active, theme: theme, style: bar ? compactVisualStyle(fontScale) : undefined }) }) }));
|
|
268
322
|
}
|
|
269
|
-
export function useNavigationBarHeight(bottomInset = 0) {
|
|
323
|
+
export function useNavigationBarHeight(bottomInset = 0, theme, slotHeight = 0) {
|
|
270
324
|
const { fontScale } = useWindowDimensions();
|
|
271
|
-
return getNavigationBarHeight(fontScale, bottomInset);
|
|
325
|
+
return getNavigationBarHeight(fontScale, bottomInset, { ...barMetrics(theme), slotHeight });
|
|
326
|
+
}
|
|
327
|
+
function useCompactBarScroll(selectedIndex) {
|
|
328
|
+
const ref = useRef(null);
|
|
329
|
+
const viewport = useRef(0);
|
|
330
|
+
const content = useRef(0);
|
|
331
|
+
const offset = useRef(0);
|
|
332
|
+
const frames = useRef(new Map());
|
|
333
|
+
const revealSelected = useCallback(() => {
|
|
334
|
+
const frame = frames.current.get(selectedIndex);
|
|
335
|
+
if (frame === undefined || viewport.current === 0 || content.current === 0)
|
|
336
|
+
return;
|
|
337
|
+
if (frame.x >= offset.current && frame.x + frame.width <= offset.current + viewport.current)
|
|
338
|
+
return;
|
|
339
|
+
const x = Math.max(0, Math.min(frame.x + (frame.width - viewport.current) / 2, content.current - viewport.current));
|
|
340
|
+
ref.current?.scrollTo({ x, animated: false });
|
|
341
|
+
offset.current = x;
|
|
342
|
+
}, [selectedIndex]);
|
|
343
|
+
useEffect(revealSelected, [revealSelected]);
|
|
344
|
+
return {
|
|
345
|
+
scrollProps: {
|
|
346
|
+
ref,
|
|
347
|
+
onLayout: (event) => {
|
|
348
|
+
viewport.current = event.nativeEvent.layout.width;
|
|
349
|
+
revealSelected();
|
|
350
|
+
},
|
|
351
|
+
onContentSizeChange: (width) => {
|
|
352
|
+
content.current = width;
|
|
353
|
+
revealSelected();
|
|
354
|
+
},
|
|
355
|
+
onScroll: (event) => {
|
|
356
|
+
offset.current = event.nativeEvent.contentOffset.x;
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
itemLayout: (index) => (event) => {
|
|
360
|
+
frames.current.set(index, event.nativeEvent.layout);
|
|
361
|
+
revealSelected();
|
|
362
|
+
},
|
|
363
|
+
};
|
|
272
364
|
}
|
|
273
365
|
export function AppNavigation(props) {
|
|
274
366
|
const { items, profile, pathname, onNavigate, theme, insets = {}, label, closeLabel, collapseLabel, expandLabel, } = props;
|
|
367
|
+
const [slotHeight, setSlotHeight] = useState(0);
|
|
275
368
|
const [profileOpen, setProfileOpen] = useState(false);
|
|
276
369
|
const profileTriggerRef = useRef(null);
|
|
277
370
|
const profileMenuId = useId();
|
|
@@ -281,6 +374,20 @@ export function AppNavigation(props) {
|
|
|
281
374
|
const bar = getNavigationLayout(props.width ?? dimensions.width) === 'bar';
|
|
282
375
|
const state = useNavigationState(items, pathname, props);
|
|
283
376
|
const collapsed = !bar && state.collapsed;
|
|
377
|
+
const slotState = { layout: bar ? 'bar' : 'rail', collapsed };
|
|
378
|
+
const brand = props.renderBrand?.(slotState);
|
|
379
|
+
const accessory = props.renderAccessory?.(slotState);
|
|
380
|
+
const hasBrand = brand != null && typeof brand !== 'boolean';
|
|
381
|
+
const hasAccessory = accessory != null && typeof accessory !== 'boolean';
|
|
382
|
+
const hasSlots = hasBrand || hasAccessory;
|
|
383
|
+
const barHeight = getNavigationBarHeight(dimensions.fontScale, insets.bottom, {
|
|
384
|
+
...barMetrics(theme),
|
|
385
|
+
slotHeight: hasSlots ? slotHeight : 0,
|
|
386
|
+
});
|
|
387
|
+
useEffect(() => {
|
|
388
|
+
if (bar)
|
|
389
|
+
props.onBarHeightChange?.(barHeight);
|
|
390
|
+
}, [bar, barHeight, props.onBarHeightChange]);
|
|
284
391
|
const id = useId();
|
|
285
392
|
const visible = items.flatMap((item) => !bar && !collapsed && state.openIds.includes(item.id)
|
|
286
393
|
? [item, ...(item.children ?? [])]
|
|
@@ -288,13 +395,15 @@ export function AppNavigation(props) {
|
|
|
288
395
|
const activeId = visible.some((item) => item.id === state.active.subItem?.id)
|
|
289
396
|
? state.active.subItem?.id
|
|
290
397
|
: state.active.item?.id;
|
|
398
|
+
const profileActive = profile !== undefined && profileIsActive(profile, pathname);
|
|
399
|
+
const compactScroll = useCompactBarScroll(bar ? (profileActive ? items.length : items.findIndex((item) => item.id === activeId)) : -1);
|
|
291
400
|
const roving = useRovingMenu({
|
|
292
401
|
active: true,
|
|
293
402
|
options: [
|
|
294
403
|
...visible.map((item) => ({
|
|
295
404
|
selected: item.id === activeId,
|
|
296
405
|
})),
|
|
297
|
-
...(profile === undefined ? [] : [{}]),
|
|
406
|
+
...(profile === undefined ? [] : [{ selected: profileActive }]),
|
|
298
407
|
],
|
|
299
408
|
});
|
|
300
409
|
const renderBackground = (backgroundProps = {}) => (_jsxs(View, { ...backgroundProps, role: "navigation", accessibilityLabel: label, testID: "primary-navigation", dataSet: { layout: bar ? 'bar' : 'rail', collapsed: String(collapsed) }, style: [
|
|
@@ -304,7 +413,9 @@ export function AppNavigation(props) {
|
|
|
304
413
|
borderColor: theme.border,
|
|
305
414
|
paddingBottom: insets.bottom ?? 0,
|
|
306
415
|
...(bar
|
|
307
|
-
? {
|
|
416
|
+
? {
|
|
417
|
+
minHeight: barHeight,
|
|
418
|
+
}
|
|
308
419
|
: {}),
|
|
309
420
|
paddingLeft: insets.left ?? 0,
|
|
310
421
|
paddingRight: insets.right ?? 0,
|
|
@@ -314,21 +425,36 @@ export function AppNavigation(props) {
|
|
|
314
425
|
paddingTop: insets.top ?? 0,
|
|
315
426
|
},
|
|
316
427
|
props.style,
|
|
317
|
-
], children: [
|
|
428
|
+
], children: [hasSlots ? (_jsxs(View, { testID: "navigation-slots", style: [
|
|
429
|
+
styles.slots,
|
|
430
|
+
bar && styles.barSlots,
|
|
431
|
+
{ padding: theme.spacing, gap: theme.spacing },
|
|
432
|
+
], onLayout: (event) => {
|
|
433
|
+
if (bar)
|
|
434
|
+
setSlotHeight(event.nativeEvent.layout.height);
|
|
435
|
+
}, children: [!hasBrand ? null : (_jsx(View, { testID: "navigation-brand", style: [styles.slot, bar && styles.barBrand], children: brand })), !hasAccessory ? null : (_jsx(View, { testID: "navigation-accessory", style: styles.slot, children: accessory }))] })) : null, !bar ? (_jsx(Target, { label: collapsed ? expandLabel : collapseLabel, expanded: !collapsed, collapsed: true, theme: theme, onPress: () => {
|
|
318
436
|
state.setCollapsed(!collapsed);
|
|
319
|
-
}, children: _jsx(Decorative, { children: _jsx(Text, { style: { ...textStyle(theme), color: theme.text }, children: collapsed ? '›' : '‹' }) }) })) : null, _jsxs(ScrollView, {
|
|
437
|
+
}, children: _jsx(Decorative, { children: _jsx(Text, { style: { ...textStyle(theme), color: theme.text }, children: collapsed ? '›' : '‹' }) }) })) : null, _jsxs(ScrollView, { ...(bar ? compactScroll.scrollProps : {}), testID: "navigation-items", horizontal: bar, scrollEnabled: true, showsHorizontalScrollIndicator: false, style: bar
|
|
438
|
+
? [
|
|
439
|
+
styles.barItems,
|
|
440
|
+
{
|
|
441
|
+
height: getNavigationBarHeight(dimensions.fontScale, 0, barMetrics(theme)) -
|
|
442
|
+
NAVIGATION_BAR_DIMENSIONS.border,
|
|
443
|
+
},
|
|
444
|
+
]
|
|
445
|
+
: styles.railItems, contentContainerStyle: bar ? styles.barContent : undefined, children: [items.map((item, index) => {
|
|
320
446
|
const active = state.active.item?.id === item.id;
|
|
321
447
|
const children = item.children ?? [];
|
|
322
448
|
const open = !collapsed && state.openIds.includes(item.id);
|
|
323
449
|
const href = bar && active ? nextSectionHref(item, pathname) : item.href;
|
|
324
|
-
return (_jsxs(View, { style: bar ? styles.barSection : undefined, testID: `navigation-section-${item.id}`, children: [_jsx(Target, { label: item.label, selected: active, ancestor: active && !bar && !collapsed && state.active.subItem !== null, theme: theme, bar: bar, collapsed: collapsed, roving: roving.itemProps(visible.indexOf(item)), ...(!bar && children.length > 0
|
|
450
|
+
return (_jsxs(View, { style: bar ? styles.barSection : undefined, testID: `navigation-section-${item.id}`, onLayout: bar ? compactScroll.itemLayout(index) : undefined, children: [_jsx(Target, { label: item.label, selected: active, ancestor: active && !bar && !collapsed && state.active.subItem !== null, theme: theme, bar: bar, collapsed: collapsed, roving: roving.itemProps(visible.indexOf(item)), ...(!bar && children.length > 0
|
|
325
451
|
? { expanded: open, controls: `${id}-${String(index)}` }
|
|
326
452
|
: { href }), onPress: (event) => {
|
|
327
453
|
if (!bar && children.length > 0)
|
|
328
454
|
state.toggleGroup(item.id);
|
|
329
455
|
else
|
|
330
456
|
follow(href, event, onNavigate);
|
|
331
|
-
}, children: _jsx(Decorative, { children: item.icon({ active, size:
|
|
457
|
+
}, children: _jsx(Decorative, { style: bar ? compactVisualStyle(dimensions.fontScale) : undefined, children: item.icon({ active, size: NAVIGATION_BAR_DIMENSIONS.icon }) }) }), !bar && open && children.length > 0 ? (_jsx(View, { nativeID: `${id}-${String(index)}`, role: "group", accessibilityLabel: item.label, style: [styles.children, { borderColor: theme.border }], children: children.map((child) => {
|
|
332
458
|
const selected = state.active.subItem?.id === child.id;
|
|
333
459
|
return (_jsx(Target, { label: child.label, selected: selected, href: child.href, theme: theme, roving: roving.itemProps(visible.indexOf(child)), onPress: (event) => {
|
|
334
460
|
follow(child.href, event, onNavigate);
|
|
@@ -336,7 +462,7 @@ export function AppNavigation(props) {
|
|
|
336
462
|
}) })) : null] }, item.id));
|
|
337
463
|
}), bar && profile !== undefined ? (_jsx(Profile, { profile: profile, open: profileOpen, onOpen: () => {
|
|
338
464
|
setProfileOpen(true);
|
|
339
|
-
}, triggerRef: profileTriggerRef, id: profileMenuId, theme: theme, bar: true, collapsed: false, pathname: pathname, onNavigate: onNavigate, roving: roving.itemProps(visible.length) })) : null] }), !bar && profile !== undefined ? (_jsx(Profile, { profile: profile, open: profileOpen, onOpen: () => {
|
|
465
|
+
}, triggerRef: profileTriggerRef, id: profileMenuId, theme: theme, bar: true, collapsed: false, pathname: pathname, onNavigate: onNavigate, roving: roving.itemProps(visible.length), onLayout: compactScroll.itemLayout(items.length) })) : null] }), !bar && profile !== undefined ? (_jsx(Profile, { profile: profile, open: profileOpen, onOpen: () => {
|
|
340
466
|
setProfileOpen(true);
|
|
341
467
|
}, triggerRef: profileTriggerRef, id: profileMenuId, theme: theme, bar: false, collapsed: collapsed, pathname: pathname, onNavigate: onNavigate, roving: roving.itemProps(visible.length) })) : null] }));
|
|
342
468
|
if (profile?.menu === undefined)
|
|
@@ -380,21 +506,25 @@ const styles = StyleSheet.create({
|
|
|
380
506
|
labelGroup: { minWidth: 0, flexShrink: 1 },
|
|
381
507
|
menuProfile: { padding: 8 },
|
|
382
508
|
target: {
|
|
383
|
-
padding:
|
|
509
|
+
padding: NAVIGATION_BAR_DIMENSIONS.targetPadding,
|
|
384
510
|
},
|
|
385
511
|
railTarget: { flexDirection: 'row', alignItems: 'center' },
|
|
386
512
|
collapsedTarget: { justifyContent: 'center' },
|
|
387
513
|
barTarget: { flexDirection: 'column', alignItems: 'center', justifyContent: 'center', flex: 1 },
|
|
388
514
|
bar: {
|
|
389
|
-
flexDirection: '
|
|
390
|
-
minHeight: NAVIGATION_DIMENSIONS.
|
|
391
|
-
borderTopWidth:
|
|
515
|
+
flexDirection: 'column',
|
|
516
|
+
minHeight: NAVIGATION_DIMENSIONS.nativeBar,
|
|
517
|
+
borderTopWidth: NAVIGATION_BAR_DIMENSIONS.border,
|
|
392
518
|
width: '100%',
|
|
393
519
|
},
|
|
394
520
|
rail: { borderRightWidth: 1, height: '100%' },
|
|
521
|
+
slots: { flexShrink: 0 },
|
|
522
|
+
barSlots: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' },
|
|
523
|
+
slot: { minWidth: 0, flexShrink: 1 },
|
|
524
|
+
barBrand: { flexShrink: 0 },
|
|
395
525
|
railItems: { flex: 1 },
|
|
396
|
-
barItems: { width: '100%' },
|
|
397
|
-
barContent: { flexDirection: 'row', flexGrow: 1 },
|
|
526
|
+
barItems: { width: '100%', flexGrow: 0, flexShrink: 0 },
|
|
527
|
+
barContent: { flexDirection: 'row', flexGrow: 1, minWidth: '100%' },
|
|
398
528
|
barSection: { flex: 1, minWidth: NAVIGATION_DIMENSIONS.target },
|
|
399
529
|
children: { marginLeft: 20, paddingLeft: 8, borderLeftWidth: 1 },
|
|
400
530
|
profile: { position: 'relative', marginTop: 'auto', paddingTop: 8, borderTopWidth: 1 },
|