@baukit/navigation 0.18.3 → 0.19.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.
Files changed (70) hide show
  1. package/dist/index.d.ts.map +1 -1
  2. package/dist/index.js +19 -14
  3. package/dist/index.js.map +1 -1
  4. package/dist/native-menu.d.ts +22 -0
  5. package/dist/native-menu.d.ts.map +1 -0
  6. package/dist/native-menu.js +226 -0
  7. package/dist/native-menu.js.map +1 -0
  8. package/dist/native-primitives.d.ts +51 -0
  9. package/dist/native-primitives.d.ts.map +1 -0
  10. package/dist/native-primitives.js +125 -0
  11. package/dist/native-primitives.js.map +1 -0
  12. package/dist/native-profile.d.ts +34 -0
  13. package/dist/native-profile.d.ts.map +1 -0
  14. package/dist/native-profile.js +67 -0
  15. package/dist/native-profile.js.map +1 -0
  16. package/dist/native-section-picker.d.ts +14 -0
  17. package/dist/native-section-picker.d.ts.map +1 -0
  18. package/dist/native-section-picker.js +46 -0
  19. package/dist/native-section-picker.js.map +1 -0
  20. package/dist/native-styles.d.ts +106 -0
  21. package/dist/native-styles.d.ts.map +1 -0
  22. package/dist/native-styles.js +50 -0
  23. package/dist/native-styles.js.map +1 -0
  24. package/dist/native-theme.d.ts +49 -0
  25. package/dist/native-theme.d.ts.map +1 -0
  26. package/dist/native-theme.js +56 -0
  27. package/dist/native-theme.js.map +1 -0
  28. package/dist/native.d.ts +9 -52
  29. package/dist/native.d.ts.map +1 -1
  30. package/dist/native.js +148 -536
  31. package/dist/native.js.map +1 -1
  32. package/dist/use-navigation-state.d.ts +9 -8
  33. package/dist/use-navigation-state.d.ts.map +1 -1
  34. package/dist/use-navigation-state.js +3 -2
  35. package/dist/use-navigation-state.js.map +1 -1
  36. package/dist/web-link.d.ts +20 -0
  37. package/dist/web-link.d.ts.map +1 -0
  38. package/dist/web-link.js +23 -0
  39. package/dist/web-link.js.map +1 -0
  40. package/dist/web-menu.d.ts +19 -0
  41. package/dist/web-menu.d.ts.map +1 -0
  42. package/dist/web-menu.js +96 -0
  43. package/dist/web-menu.js.map +1 -0
  44. package/dist/web-profile.d.ts +16 -0
  45. package/dist/web-profile.d.ts.map +1 -0
  46. package/dist/web-profile.js +58 -0
  47. package/dist/web-profile.js.map +1 -0
  48. package/dist/web-section-picker.d.ts +13 -0
  49. package/dist/web-section-picker.d.ts.map +1 -0
  50. package/dist/web-section-picker.js +71 -0
  51. package/dist/web-section-picker.js.map +1 -0
  52. package/dist/web.d.ts +7 -25
  53. package/dist/web.d.ts.map +1 -1
  54. package/dist/web.js +113 -257
  55. package/dist/web.js.map +1 -1
  56. package/package.json +7 -7
  57. package/src/index.ts +22 -16
  58. package/src/native-menu.tsx +436 -0
  59. package/src/native-primitives.tsx +308 -0
  60. package/src/native-profile.tsx +153 -0
  61. package/src/native-section-picker.tsx +102 -0
  62. package/src/native-styles.ts +50 -0
  63. package/src/native-theme.ts +108 -0
  64. package/src/native.tsx +355 -1086
  65. package/src/use-navigation-state.ts +20 -5
  66. package/src/web-link.tsx +51 -0
  67. package/src/web-menu.tsx +220 -0
  68. package/src/web-profile.tsx +201 -0
  69. package/src/web-section-picker.tsx +128 -0
  70. package/src/web.tsx +256 -598
@@ -0,0 +1,67 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useRef } from 'react';
3
+ import { ScrollView, View, useWindowDimensions, } from 'react-native';
4
+ import { getNavigationBarHeight, navigationMatches, resolveActiveMenuEntry, } from './index.js';
5
+ import { Avatar, compactVisualStyle, follow, Target, } from './native-primitives.js';
6
+ import { styles } from './native-styles.js';
7
+ import { barMetrics } from './native-theme.js';
8
+ export function profileIsActive(profile, pathname) {
9
+ return profile.href !== undefined
10
+ ? navigationMatches({ id: 'profile', label: profile.label, href: profile.href }, pathname)
11
+ : resolveActiveMenuEntry(profile.menu, pathname) !== null;
12
+ }
13
+ export function Profile({ profile, open, onOpen, triggerRef, id, theme, bar, collapsed, pathname, onNavigate, roving, onLayout, }) {
14
+ const { fontScale } = useWindowDimensions();
15
+ const active = profileIsActive(profile, pathname);
16
+ 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
17
+ ? { expanded: open, controls: id, menu: true }
18
+ : { href: profile.href }), onPress: (event) => {
19
+ if (profile.href !== undefined)
20
+ follow(profile.href, event, onNavigate);
21
+ else
22
+ onOpen();
23
+ }, children: _jsx(Avatar, { profile: profile, active: active, theme: theme, style: bar ? compactVisualStyle(fontScale) : undefined }) }) }));
24
+ }
25
+ export function useNavigationBarHeight(bottomInset = 0, theme, slotHeight = 0) {
26
+ const { fontScale } = useWindowDimensions();
27
+ return getNavigationBarHeight(fontScale, bottomInset, { ...barMetrics(theme), slotHeight });
28
+ }
29
+ export function useCompactBarScroll(selectedIndex) {
30
+ const ref = useRef(null);
31
+ const viewport = useRef(0);
32
+ const content = useRef(0);
33
+ const offset = useRef(0);
34
+ const frames = useRef(new Map());
35
+ const revealSelected = useCallback(() => {
36
+ const frame = frames.current.get(selectedIndex);
37
+ if (frame === undefined || viewport.current === 0 || content.current === 0)
38
+ return;
39
+ if (frame.x >= offset.current && frame.x + frame.width <= offset.current + viewport.current)
40
+ return;
41
+ const x = Math.max(0, Math.min(frame.x + (frame.width - viewport.current) / 2, content.current - viewport.current));
42
+ ref.current?.scrollTo({ x, animated: false });
43
+ offset.current = x;
44
+ }, [selectedIndex]);
45
+ useEffect(revealSelected, [revealSelected]);
46
+ return {
47
+ scrollProps: {
48
+ ref,
49
+ onLayout: (event) => {
50
+ viewport.current = event.nativeEvent.layout.width;
51
+ revealSelected();
52
+ },
53
+ onContentSizeChange: (width) => {
54
+ content.current = width;
55
+ revealSelected();
56
+ },
57
+ onScroll: (event) => {
58
+ offset.current = event.nativeEvent.contentOffset.x;
59
+ },
60
+ },
61
+ itemLayout: (index) => (event) => {
62
+ frames.current.set(index, event.nativeEvent.layout);
63
+ revealSelected();
64
+ },
65
+ };
66
+ }
67
+ //# sourceMappingURL=native-profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-profile.js","sourceRoot":"","sources":["../src/native-profile.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAkC,MAAM,OAAO,CAAC;AACvF,OAAO,EACL,UAAU,EACV,IAAI,EACJ,mBAAmB,GAIpB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,sBAAsB,GAEvB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,MAAM,EACN,MAAM,GAEP,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAuC,MAAM,mBAAmB,CAAC;AA0BpF,MAAM,UAAU,eAAe,CAAC,OAA0B,EAAE,QAAgB;IAC1E,OAAO,OAAO,CAAC,IAAI,KAAK,SAAS;QAC/B,CAAC,CAAC,iBAAiB,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,QAAQ,CAAC;QAC1F,CAAC,CAAC,sBAAsB,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,KAAK,IAAI,CAAC;AAC9D,CAAC;AACD,MAAM,UAAU,OAAO,CAAC,EACtB,OAAO,EACP,IAAI,EACJ,MAAM,EACN,UAAU,EACV,EAAE,EACF,KAAK,EACL,GAAG,EACH,SAAS,EACT,QAAQ,EACR,UAAU,EACV,MAAM,EACN,QAAQ,GACK;IACb,MAAM,EAAE,SAAS,EAAE,GAAG,mBAAmB,EAAE,CAAC;IAC5C,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,EAAE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EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IACpB,SAAS,CAAC,cAAc,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;IAC5C,OAAO;QACL,WAAW,EAAE;YACX,GAAG;YACH,QAAQ,EAAE,CAAC,KAAwB,EAAE,EAAE;gBACrC,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC;gBAClD,cAAc,EAAE,CAAC;YACnB,CAAC;YACD,mBAAmB,EAAE,CAAC,KAAa,EAAE,EAAE;gBACrC,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;gBACxB,cAAc,EAAE,CAAC;YACnB,CAAC;YACD,QAAQ,EAAE,CAAC,KAA8C,EAAE,EAAE;gBAC3D,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC;YACrD,CAAC;SACF;QACD,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,KAAwB,EAAE,EAAE;YAC1D,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YACpD,cAAc,EAAE,CAAC;QACnB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type NavigationItem } from './index.js';
3
+ import { type Navigate, type NavigationIcon, type NavigationInsets, type NavigationTheme } from './native-theme.js';
4
+ export interface SectionPickerProps {
5
+ readonly replace?: boolean;
6
+ readonly closeLabel: string;
7
+ readonly item: NavigationItem<NavigationIcon>;
8
+ readonly pathname: string;
9
+ readonly onNavigate: Navigate;
10
+ readonly theme: NavigationTheme;
11
+ readonly insets?: NavigationInsets;
12
+ }
13
+ export declare function SectionPicker({ replace, item, pathname, onNavigate, theme, closeLabel, insets, }: SectionPickerProps): ReactNode;
14
+ //# sourceMappingURL=native-section-picker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-section-picker.d.ts","sourceRoot":"","sources":["../src/native-section-picker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGhE,OAAO,EAA2B,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAI1E,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,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;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC;CACpC;AACD,wBAAgB,aAAa,CAAC,EAC5B,OAAe,EACf,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,KAAK,EACL,UAAU,EACV,MAAM,GACP,EAAE,kBAAkB,GAAG,SAAS,CAqEhC"}
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId, useRef, useState } from 'react';
3
+ import { Platform, Text, View } from 'react-native';
4
+ import { announce } from '@baukit/a11y-core';
5
+ import { resolveActiveNavigation } from './index.js';
6
+ import { Menu } from './native-menu.js';
7
+ import { Decorative, FocusablePressable } from './native-primitives.js';
8
+ import { styles } from './native-styles.js';
9
+ import { textStyle, } from './native-theme.js';
10
+ export function SectionPicker({ replace = false, item, pathname, onNavigate, theme, closeLabel, insets, }) {
11
+ const [open, setOpen] = useState(false);
12
+ const [openedAt, setOpenedAt] = useState(pathname);
13
+ if (openedAt !== pathname) {
14
+ setOpenedAt(pathname);
15
+ setOpen(false);
16
+ }
17
+ const triggerRef = useRef(null);
18
+ const id = useId();
19
+ const active = resolveActiveNavigation([item], pathname).subItem ?? item.children?.[0];
20
+ const entries = item.children ?? [];
21
+ if (entries.length === 0)
22
+ return null;
23
+ const renderBackground = (backgroundProps) => (_jsx(View, { ...backgroundProps, role: "navigation", accessibilityLabel: item.label, children: _jsxs(FocusablePressable, { theme: theme, unfocusedBorderColor: theme.border, ref: triggerRef, ...(Platform.OS === 'web'
24
+ ? { 'aria-controls': id, 'aria-haspopup': 'menu' }
25
+ : {}), accessibilityRole: "button", accessibilityLabel: `${item.label}, ${active?.label ?? ''}`, accessibilityState: { expanded: open }, onPress: () => {
26
+ setOpen(true);
27
+ }, style: [
28
+ styles.picker,
29
+ {
30
+ backgroundColor: theme.background,
31
+ borderColor: theme.border,
32
+ borderRadius: theme.radius,
33
+ padding: theme.spacing,
34
+ },
35
+ ], children: [_jsxs(View, { children: [_jsx(Text, { style: { ...textStyle(theme), color: theme.muted }, children: item.label }), _jsx(Text, { style: { ...textStyle(theme), color: theme.text }, children: active?.label })] }), _jsx(Decorative, { children: _jsx(Text, { style: { ...textStyle(theme), color: theme.text }, children: "\u2304" }) })] }) }));
36
+ return (_jsx(Menu, { renderBackground: renderBackground, entries: entries, closeLabel: closeLabel, pathname: pathname, label: item.label, visible: open, id: id, triggerRef: triggerRef, theme: theme, insets: insets, onClose: () => {
37
+ setOpen(false);
38
+ }, onNavigate: (href) => {
39
+ announce(entries.find((entry) => entry.href === href)?.label ?? item.label);
40
+ if (replace)
41
+ onNavigate(href, { replace: true });
42
+ else
43
+ onNavigate(href);
44
+ } }));
45
+ }
46
+ //# sourceMappingURL=native-section-picker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-section-picker.js","sourceRoot":"","sources":["../src/native-section-picker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,E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,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,uBAAU,GACtD,IACM,GAChB,CACR,CAAC;IACF,OAAO,CACL,KAAC,IAAI,IACH,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,IAAI,EACb,EAAE,EAAE,EAAE,EACN,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,GAAG,EAAE;YACZ,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC,EACD,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE;YACnB,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;YAC5E,IAAI,OAAO;gBAAE,UAAU,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;;gBAC5C,UAAU,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC,GACD,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,106 @@
1
+ export declare const styles: {
2
+ labelGroup: {
3
+ minWidth: number;
4
+ flexShrink: number;
5
+ };
6
+ menuProfile: {
7
+ padding: number;
8
+ };
9
+ target: {
10
+ padding: 8;
11
+ };
12
+ railTarget: {
13
+ flexDirection: "row";
14
+ alignItems: "center";
15
+ };
16
+ collapsedTarget: {
17
+ justifyContent: "center";
18
+ };
19
+ barTarget: {
20
+ flexDirection: "column";
21
+ alignItems: "center";
22
+ justifyContent: "center";
23
+ flex: number;
24
+ };
25
+ bar: {
26
+ flexDirection: "column";
27
+ minHeight: number;
28
+ borderTopWidth: 1;
29
+ width: "100%";
30
+ };
31
+ rail: {
32
+ borderRightWidth: number;
33
+ height: "100%";
34
+ };
35
+ slots: {
36
+ flexShrink: number;
37
+ };
38
+ barSlots: {
39
+ flexDirection: "row";
40
+ alignItems: "center";
41
+ justifyContent: "space-between";
42
+ };
43
+ slot: {
44
+ minWidth: number;
45
+ flexShrink: number;
46
+ };
47
+ barBrand: {
48
+ flexShrink: number;
49
+ };
50
+ railItems: {
51
+ flex: number;
52
+ };
53
+ barItems: {
54
+ width: "100%";
55
+ flexGrow: number;
56
+ flexShrink: number;
57
+ };
58
+ barContent: {
59
+ flexDirection: "row";
60
+ flexGrow: number;
61
+ minWidth: "100%";
62
+ };
63
+ barSection: {
64
+ flex: number;
65
+ minWidth: 44;
66
+ };
67
+ children: {
68
+ marginLeft: number;
69
+ paddingLeft: number;
70
+ borderLeftWidth: number;
71
+ };
72
+ profile: {
73
+ position: "relative";
74
+ marginTop: "auto";
75
+ paddingTop: number;
76
+ borderTopWidth: number;
77
+ };
78
+ avatar: {
79
+ width: 28;
80
+ height: 28;
81
+ borderRadius: number;
82
+ alignItems: "center";
83
+ justifyContent: "center";
84
+ };
85
+ modal: {
86
+ flex: number;
87
+ justifyContent: "flex-end";
88
+ };
89
+ menu: {
90
+ borderWidth: number;
91
+ padding: number;
92
+ maxHeight: "80%";
93
+ };
94
+ menuItem: {
95
+ justifyContent: "center";
96
+ padding: number;
97
+ };
98
+ picker: {
99
+ flexDirection: "row";
100
+ alignItems: "center";
101
+ justifyContent: "space-between";
102
+ borderWidth: number;
103
+ width: "100%";
104
+ };
105
+ };
106
+ //# sourceMappingURL=native-styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-styles.d.ts","sourceRoot":"","sources":["../src/native-styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CjB,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { StyleSheet } from 'react-native';
2
+ import { NAVIGATION_BAR_DIMENSIONS, NAVIGATION_DIMENSIONS } from './index.js';
3
+ export const styles = StyleSheet.create({
4
+ labelGroup: { minWidth: 0, flexShrink: 1 },
5
+ menuProfile: { padding: 8 },
6
+ target: {
7
+ padding: NAVIGATION_BAR_DIMENSIONS.targetPadding,
8
+ },
9
+ railTarget: { flexDirection: 'row', alignItems: 'center' },
10
+ collapsedTarget: { justifyContent: 'center' },
11
+ barTarget: { flexDirection: 'column', alignItems: 'center', justifyContent: 'center', flex: 1 },
12
+ bar: {
13
+ flexDirection: 'column',
14
+ minHeight: NAVIGATION_DIMENSIONS.nativeBar,
15
+ borderTopWidth: NAVIGATION_BAR_DIMENSIONS.border,
16
+ width: '100%',
17
+ },
18
+ rail: { borderRightWidth: 1, height: '100%' },
19
+ slots: { flexShrink: 0 },
20
+ barSlots: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' },
21
+ slot: { minWidth: 0, flexShrink: 1 },
22
+ barBrand: { flexShrink: 0 },
23
+ railItems: { flex: 1 },
24
+ barItems: { width: '100%', flexGrow: 0, flexShrink: 0 },
25
+ barContent: { flexDirection: 'row', flexGrow: 1, minWidth: '100%' },
26
+ barSection: { flex: 1, minWidth: NAVIGATION_DIMENSIONS.target },
27
+ children: { marginLeft: 20, paddingLeft: 8, borderLeftWidth: 1 },
28
+ profile: { position: 'relative', marginTop: 'auto', paddingTop: 8, borderTopWidth: 1 },
29
+ avatar: {
30
+ width: NAVIGATION_DIMENSIONS.avatar,
31
+ height: NAVIGATION_DIMENSIONS.avatar,
32
+ borderRadius: NAVIGATION_DIMENSIONS.avatar / 2,
33
+ alignItems: 'center',
34
+ justifyContent: 'center',
35
+ },
36
+ modal: { flex: 1, justifyContent: 'flex-end' },
37
+ menu: { borderWidth: 1, padding: 8, maxHeight: '80%' },
38
+ menuItem: {
39
+ justifyContent: 'center',
40
+ padding: 8,
41
+ },
42
+ picker: {
43
+ flexDirection: 'row',
44
+ alignItems: 'center',
45
+ justifyContent: 'space-between',
46
+ borderWidth: 1,
47
+ width: '100%',
48
+ },
49
+ });
50
+ //# sourceMappingURL=native-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-styles.js","sourceRoot":"","sources":["../src/native-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAE9E,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IACtC,UAAU,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE;IAC1C,WAAW,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE;IAC3B,MAAM,EAAE;QACN,OAAO,EAAE,yBAAyB,CAAC,aAAa;KACjD;IACD,UAAU,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE;IAC1D,eAAe,EAAE,EAAE,cAAc,EAAE,QAAQ,EAAE;IAC7C,SAAS,EAAE,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE;IAC/F,GAAG,EAAE;QACH,aAAa,EAAE,QAAQ;QACvB,SAAS,EAAE,qBAAqB,CAAC,SAAS;QAC1C,cAAc,EAAE,yBAAyB,CAAC,MAAM;QAChD,KAAK,EAAE,MAAM;KACd;IACD,IAAI,EAAE,EAAE,gBAAgB,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE;IAC7C,KAAK,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE;IACxB,QAAQ,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE;IACzF,IAAI,EAAE,EAAE,QA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ACd;CACF,CAAC,CAAC"}
@@ -0,0 +1,49 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type TextStyle, type ViewStyle } from 'react-native';
3
+ import { type NavigationBarMetrics } from './index.js';
4
+ export interface NavigationIconState {
5
+ readonly active: boolean;
6
+ readonly size: number;
7
+ }
8
+ export type NavigationIcon = (state: NavigationIconState) => ReactNode;
9
+ export interface NavigationTypography {
10
+ readonly fontFamily?: string;
11
+ readonly activeFontFamily?: string;
12
+ readonly fontSize?: number;
13
+ readonly barFontSize?: number;
14
+ readonly subtitleFontSize?: number;
15
+ readonly fontWeight?: TextStyle['fontWeight'];
16
+ readonly activeFontWeight?: TextStyle['fontWeight'];
17
+ readonly lineHeight?: number;
18
+ readonly letterSpacing?: number;
19
+ }
20
+ export interface NavigationTheme {
21
+ readonly background: string;
22
+ readonly text: string;
23
+ readonly muted: string;
24
+ readonly danger: string;
25
+ readonly activeBackground: string;
26
+ readonly activeText: string;
27
+ readonly ancestorText: string;
28
+ readonly border: string;
29
+ readonly focus: string;
30
+ readonly radius: number;
31
+ readonly spacing: number;
32
+ readonly typography?: NavigationTypography;
33
+ }
34
+ export interface NavigationInsets {
35
+ readonly top?: number;
36
+ readonly bottom?: number;
37
+ readonly left?: number;
38
+ readonly right?: number;
39
+ }
40
+ export type Navigate = (href: string, options?: {
41
+ readonly replace: boolean;
42
+ }) => void;
43
+ export declare const MENU_WIDTH = 280;
44
+ export declare const MENU_EDGE = 8;
45
+ export declare function barMetrics(theme?: NavigationTheme): NavigationBarMetrics;
46
+ export declare function textStyle(theme: NavigationTheme, selected?: boolean, bar?: boolean): TextStyle;
47
+ export declare function subtitleTextStyle(theme: NavigationTheme): TextStyle;
48
+ export declare function menuModalPadding(insets?: NavigationInsets): ViewStyle;
49
+ //# sourceMappingURL=native-theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-theme.d.ts","sourceRoot":"","sources":["../src/native-theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA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AC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,oBAAoB,CAAC;CAC5C;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AACD,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,KAAK,IAAI,CAAC;AAIvF,eAAO,MAAM,UAAU,MAAM,CAAC;AAC9B,eAAO,MAAM,SAAS,IAAI,CAAC;AAE3B,wBAAgB,UAAU,CAAC,KAAK,CAAC,EAAE,eAAe,GAAG,oBAAoB,CAUxE;AAgBD,wBAAgB,SAAS,CAAC,KAAK,EAAE,eAAe,EAAE,QAAQ,UAAQ,EAAE,GAAG,UAAQ,GAAG,SAAS,CAS1F;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,CAMnE;AAED,wBAAgB,gBAAgB,CAAC,MAAM,GAAE,gBAAqB,GAAG,SAAS,CASzE"}
@@ -0,0 +1,56 @@
1
+ import { Platform } from 'react-native';
2
+ import { getNavigationBarLineHeight, NAVIGATION_BAR_DIMENSIONS, } from './index.js';
3
+ const DEFAULT_FONT_SIZE = 14;
4
+ const DEFAULT_SUBTITLE_FONT_SIZE = 12;
5
+ export const MENU_WIDTH = 280;
6
+ export const MENU_EDGE = 8;
7
+ export function barMetrics(theme) {
8
+ return {
9
+ ...(theme === undefined ? {} : { spacing: theme.spacing }),
10
+ ...(theme?.typography?.barFontSize === undefined
11
+ ? {}
12
+ : { fontSize: theme.typography.barFontSize }),
13
+ ...(theme?.typography?.lineHeight === undefined
14
+ ? {}
15
+ : { lineHeight: theme.typography.lineHeight }),
16
+ };
17
+ }
18
+ function fontFamily(typography, selected) {
19
+ return selected ? (typography.activeFontFamily ?? typography.fontFamily) : typography.fontFamily;
20
+ }
21
+ function fontSize(typography, bar) {
22
+ return bar
23
+ ? (typography.barFontSize ?? NAVIGATION_BAR_DIMENSIONS.labelFontSize)
24
+ : (typography.fontSize ?? DEFAULT_FONT_SIZE);
25
+ }
26
+ function fontWeight(typography, selected) {
27
+ return selected ? (typography.activeFontWeight ?? '700') : (typography.fontWeight ?? '400');
28
+ }
29
+ export function textStyle(theme, selected = false, bar = false) {
30
+ const typography = theme.typography ?? {};
31
+ return {
32
+ fontFamily: fontFamily(typography, selected),
33
+ fontSize: fontSize(typography, bar),
34
+ fontWeight: fontWeight(typography, selected),
35
+ lineHeight: bar ? getNavigationBarLineHeight(barMetrics(theme)) : typography.lineHeight,
36
+ letterSpacing: typography.letterSpacing,
37
+ };
38
+ }
39
+ export function subtitleTextStyle(theme) {
40
+ return {
41
+ ...textStyle(theme),
42
+ color: theme.muted,
43
+ fontSize: theme.typography?.subtitleFontSize ?? DEFAULT_SUBTITLE_FONT_SIZE,
44
+ };
45
+ }
46
+ export function menuModalPadding(insets = {}) {
47
+ const native = Platform.OS !== 'web';
48
+ const edge = (inset) => MENU_EDGE + (native ? (inset ?? 0) : 0);
49
+ return {
50
+ paddingTop: edge(insets.top),
51
+ paddingBottom: edge(insets.bottom),
52
+ paddingLeft: edge(insets.left),
53
+ paddingRight: edge(insets.right),
54
+ };
55
+ }
56
+ //# sourceMappingURL=native-theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-theme.js","sourceRoot":"","sources":["../src/native-theme.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAk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CAAC;QAC5B,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QAClC,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;QAC9B,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;KACjC,CAAC;AACJ,CAAC"}
package/dist/native.d.ts CHANGED
@@ -1,47 +1,12 @@
1
1
  import { type ReactNode } from 'react';
2
- import { type ViewStyle, type TextStyle } from 'react-native';
2
+ import { type ViewStyle } from 'react-native';
3
3
  import { type NavigationSlots, type NavigationItem, type NavigationProfile } from './index.js';
4
+ import { type Navigate, type NavigationIcon, type NavigationInsets, type NavigationTheme } from './native-theme.js';
4
5
  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 NavigationTypography {
11
- readonly fontFamily?: string;
12
- readonly activeFontFamily?: string;
13
- readonly fontSize?: number;
14
- readonly barFontSize?: number;
15
- readonly subtitleFontSize?: number;
16
- readonly fontWeight?: TextStyle['fontWeight'];
17
- readonly activeFontWeight?: TextStyle['fontWeight'];
18
- readonly lineHeight?: number;
19
- readonly letterSpacing?: number;
20
- }
21
- export interface NavigationTheme {
22
- readonly background: string;
23
- readonly text: string;
24
- readonly muted: string;
25
- readonly danger: string;
26
- readonly activeBackground: string;
27
- readonly activeText: string;
28
- readonly ancestorText: string;
29
- readonly border: string;
30
- readonly focus: string;
31
- readonly radius: number;
32
- readonly spacing: number;
33
- readonly typography?: NavigationTypography;
34
- }
35
- export interface NavigationInsets {
36
- readonly top?: number;
37
- readonly bottom?: number;
38
- readonly left?: number;
39
- readonly right?: number;
40
- }
41
- export type Navigate = (href: string, options?: {
42
- readonly replace: boolean;
43
- }) => void;
44
- export declare function useNavigationBarHeight(bottomInset?: number, theme?: NavigationTheme, slotHeight?: number): number;
6
+ import { useNavigationBarHeight as profileBarHeight } from './native-profile.js';
7
+ import { SectionPicker as Picker } from './native-section-picker.js';
8
+ export type { Navigate, NavigationIcon, NavigationIconState, NavigationInsets, NavigationTheme, NavigationTypography, } from './native-theme.js';
9
+ export declare const useNavigationBarHeight: typeof profileBarHeight;
45
10
  export interface AppNavigationProps extends CollapseProps, NavigationSlots {
46
11
  readonly items: readonly NavigationItem<NavigationIcon>[];
47
12
  readonly profile?: NavigationProfile;
@@ -56,15 +21,7 @@ export interface AppNavigationProps extends CollapseProps, NavigationSlots {
56
21
  readonly closeLabel: string;
57
22
  readonly style?: ViewStyle;
58
23
  }
59
- export declare function AppNavigation(props: AppNavigationProps): import("react").JSX.Element;
60
- export interface SectionPickerProps {
61
- readonly replace?: boolean;
62
- readonly closeLabel: string;
63
- readonly item: NavigationItem<NavigationIcon>;
64
- readonly pathname: string;
65
- readonly onNavigate: Navigate;
66
- readonly theme: NavigationTheme;
67
- readonly insets?: NavigationInsets;
68
- }
69
- export declare function SectionPicker({ replace, item, pathname, onNavigate, theme, closeLabel, insets, }: SectionPickerProps): import("react").JSX.Element | null;
24
+ export declare function AppNavigation(props: AppNavigationProps): ReactNode;
25
+ export type { SectionPickerProps } from './native-section-picker.js';
26
+ export declare const SectionPicker: typeof Picker;
70
27
  //# sourceMappingURL=native.d.ts.map
@@ -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,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,C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