@oxy.so/bloom 2.5.0 → 2.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/docs/app-shell.mdx +55 -1
- package/docs/sidebar.mdx +17 -0
- package/lib/commonjs/app-shell/AppShell.js +294 -135
- package/lib/commonjs/app-shell/AppShell.js.map +1 -1
- package/lib/commonjs/app-shell/AppShellHeader.js +2 -2
- package/lib/commonjs/app-shell/AppShellHeader.js.map +1 -1
- package/lib/commonjs/app-shell/AppShellMenuButton.js +40 -0
- package/lib/commonjs/app-shell/AppShellMenuButton.js.map +1 -0
- package/lib/commonjs/app-shell/context.js +30 -0
- package/lib/commonjs/app-shell/context.js.map +1 -0
- package/lib/commonjs/app-shell/index.js +14 -0
- package/lib/commonjs/app-shell/index.js.map +1 -1
- package/lib/commonjs/sidebar/Sidebar.js +51 -17
- package/lib/commonjs/sidebar/Sidebar.js.map +1 -1
- package/lib/commonjs/sidebar/SidebarLogoView.js +124 -0
- package/lib/commonjs/sidebar/SidebarLogoView.js.map +1 -0
- package/lib/commonjs/sidebar/SidebarRail.js +16 -2
- package/lib/commonjs/sidebar/SidebarRail.js.map +1 -1
- package/lib/commonjs/styles/web-view-style.js +25 -1
- package/lib/commonjs/styles/web-view-style.js.map +1 -1
- package/lib/module/app-shell/AppShell.js +296 -137
- package/lib/module/app-shell/AppShell.js.map +1 -1
- package/lib/module/app-shell/AppShellHeader.js +2 -2
- package/lib/module/app-shell/AppShellHeader.js.map +1 -1
- package/lib/module/app-shell/AppShellMenuButton.js +35 -0
- package/lib/module/app-shell/AppShellMenuButton.js.map +1 -0
- package/lib/module/app-shell/context.js +23 -0
- package/lib/module/app-shell/context.js.map +1 -0
- package/lib/module/app-shell/index.js +2 -0
- package/lib/module/app-shell/index.js.map +1 -1
- package/lib/module/sidebar/Sidebar.js +51 -17
- package/lib/module/sidebar/Sidebar.js.map +1 -1
- package/lib/module/sidebar/SidebarLogoView.js +119 -0
- package/lib/module/sidebar/SidebarLogoView.js.map +1 -0
- package/lib/module/sidebar/SidebarRail.js +16 -2
- package/lib/module/sidebar/SidebarRail.js.map +1 -1
- package/lib/module/styles/web-view-style.js +23 -0
- package/lib/module/styles/web-view-style.js.map +1 -1
- package/lib/typescript/commonjs/app-shell/AppShell.d.ts.map +1 -1
- package/lib/typescript/commonjs/app-shell/AppShellHeader.d.ts.map +1 -1
- package/lib/typescript/commonjs/app-shell/AppShellMenuButton.d.ts +4 -0
- package/lib/typescript/commonjs/app-shell/AppShellMenuButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/app-shell/context.d.ts +18 -0
- package/lib/typescript/commonjs/app-shell/context.d.ts.map +1 -0
- package/lib/typescript/commonjs/app-shell/index.d.ts +4 -1
- package/lib/typescript/commonjs/app-shell/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/app-shell/types.d.ts +47 -3
- package/lib/typescript/commonjs/app-shell/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/sidebar/Sidebar.d.ts.map +1 -1
- package/lib/typescript/commonjs/sidebar/SidebarLogoView.d.ts +6 -0
- package/lib/typescript/commonjs/sidebar/SidebarLogoView.d.ts.map +1 -0
- package/lib/typescript/commonjs/sidebar/SidebarRail.d.ts +3 -2
- package/lib/typescript/commonjs/sidebar/SidebarRail.d.ts.map +1 -1
- package/lib/typescript/commonjs/sidebar/index.d.ts +1 -1
- package/lib/typescript/commonjs/sidebar/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/sidebar/types.d.ts +36 -0
- package/lib/typescript/commonjs/sidebar/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/styles/web-view-style.d.ts +19 -0
- package/lib/typescript/commonjs/styles/web-view-style.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/AppShell.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/AppShellHeader.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/AppShellMenuButton.d.ts +4 -0
- package/lib/typescript/module/app-shell/AppShellMenuButton.d.ts.map +1 -0
- package/lib/typescript/module/app-shell/context.d.ts +18 -0
- package/lib/typescript/module/app-shell/context.d.ts.map +1 -0
- package/lib/typescript/module/app-shell/index.d.ts +4 -1
- package/lib/typescript/module/app-shell/index.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/types.d.ts +47 -3
- package/lib/typescript/module/app-shell/types.d.ts.map +1 -1
- package/lib/typescript/module/sidebar/Sidebar.d.ts.map +1 -1
- package/lib/typescript/module/sidebar/SidebarLogoView.d.ts +6 -0
- package/lib/typescript/module/sidebar/SidebarLogoView.d.ts.map +1 -0
- package/lib/typescript/module/sidebar/SidebarRail.d.ts +3 -2
- package/lib/typescript/module/sidebar/SidebarRail.d.ts.map +1 -1
- package/lib/typescript/module/sidebar/index.d.ts +1 -1
- package/lib/typescript/module/sidebar/index.d.ts.map +1 -1
- package/lib/typescript/module/sidebar/types.d.ts +36 -0
- package/lib/typescript/module/sidebar/types.d.ts.map +1 -1
- package/lib/typescript/module/styles/web-view-style.d.ts +19 -0
- package/lib/typescript/module/styles/web-view-style.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/app-shell/AppShell.tsx +231 -90
- package/src/app-shell/AppShellHeader.tsx +11 -9
- package/src/app-shell/AppShellMenuButton.tsx +37 -0
- package/src/app-shell/context.ts +35 -0
- package/src/app-shell/index.ts +4 -0
- package/src/app-shell/types.ts +48 -3
- package/src/sidebar/Sidebar.tsx +42 -22
- package/src/sidebar/SidebarLogoView.tsx +92 -0
- package/src/sidebar/SidebarRail.tsx +9 -1
- package/src/sidebar/index.ts +1 -0
- package/src/sidebar/types.ts +38 -0
- package/src/styles/web-view-style.ts +23 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/sidebar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,M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AAC;CACvB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,WAAW,CAAC;IAClB,sDAAsD;IACtD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,wEAAwE;IACxE,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -27,6 +27,25 @@ export declare const WEB_POSITION_FIXED: ViewStyle["position"];
|
|
|
27
27
|
* which is what `'fixed'` is for.
|
|
28
28
|
*/
|
|
29
29
|
export declare const WEB_POSITION_STICKY: ViewStyle["position"];
|
|
30
|
+
/**
|
|
31
|
+
* One viewport of height (`100dvh`), and one viewport minus a vertical inset,
|
|
32
|
+
* typed for React Native's `ViewStyle`. Same kind of gap as
|
|
33
|
+
* {@link WEB_POSITION_FIXED}: RN types lengths as a number or a percentage,
|
|
34
|
+
* while react-native-web passes any CSS length through. A percentage cannot say
|
|
35
|
+
* this in a page that scrolls the DOCUMENT — a percentage height needs a
|
|
36
|
+
* definite ancestor height, and an auto-height document-flow ancestor never has
|
|
37
|
+
* one. `dvh` rather than `vh` so a mobile browser's collapsing toolbar is not
|
|
38
|
+
* counted as viewport.
|
|
39
|
+
*/
|
|
40
|
+
export declare const WEB_VIEWPORT_HEIGHT: ViewStyle["height"];
|
|
41
|
+
export declare function webViewportHeightMinus(px: number): ViewStyle['height'];
|
|
42
|
+
/**
|
|
43
|
+
* `overflow: clip`, typed for React Native's `ViewStyle`. Clips like `hidden`
|
|
44
|
+
* without making the element a SCROLL CONTAINER — so a `position: sticky`
|
|
45
|
+
* descendant still sticks to the document instead of to a box that never
|
|
46
|
+
* scrolls.
|
|
47
|
+
*/
|
|
48
|
+
export declare const WEB_OVERFLOW_CLIP: ViewStyle["overflow"];
|
|
30
49
|
/**
|
|
31
50
|
* A `ViewStyle` that may ALSO carry CSS react-native-web forwards straight to the
|
|
32
51
|
* DOM node but React Native does not model at all.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-view-style.d.ts","sourceRoot":"","sources":["../../../../src/styles/web-view-style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,kBAAkB,EAAc,SAAS,CAAC,UAAU,CAAC,CAAC;AAEnE;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,EAAe,SAAS,CAAC,UAAU,CAAC,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAC1C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+EAA+E;IAC/E,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;IACjD,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,CAAC;IAC1D;;;;;;;;;OASG;IACH,CAAC,cAAc,EAAE,KAAK,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAAC;CACrD"}
|
|
1
|
+
{"version":3,"file":"web-view-style.d.ts","sourceRoot":"","sources":["../../../../src/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SAAS,GAAG,KAAK,CAAC;IAC1D;;;;;;;;;OASG;IACH,CAAC,cAAc,EAAE,KAAK,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAAC;CACrD"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { memo, useEffect } from 'react';
|
|
2
|
-
import { Pressable, ScrollView, View, useWindowDimensions } from 'react-native';
|
|
1
|
+
import React, { memo, useEffect, useMemo } from 'react';
|
|
2
|
+
import { Platform, Pressable, ScrollView, View, useWindowDimensions } from 'react-native';
|
|
3
3
|
import Animated, {
|
|
4
4
|
Easing,
|
|
5
5
|
useAnimatedStyle,
|
|
@@ -14,23 +14,37 @@ import { Backdrop, OverlayRoot } from '../overlay';
|
|
|
14
14
|
import { Portal } from '../portal';
|
|
15
15
|
import { Sidebar } from '../sidebar';
|
|
16
16
|
import { BREAKPOINTS } from '../styles/breakpoints';
|
|
17
|
+
import {
|
|
18
|
+
WEB_OVERFLOW_CLIP,
|
|
19
|
+
WEB_POSITION_FIXED,
|
|
20
|
+
WEB_POSITION_STICKY,
|
|
21
|
+
WEB_VIEWPORT_HEIGHT,
|
|
22
|
+
webViewportHeightMinus,
|
|
23
|
+
type WebCssStyle,
|
|
24
|
+
} from '../styles/web-view-style';
|
|
17
25
|
import { useTheme } from '../theme/use-theme';
|
|
18
26
|
import { AppShellHeader } from './AppShellHeader';
|
|
27
|
+
import { AppShellProvider } from './context';
|
|
19
28
|
import type { AppShellProps } from './types';
|
|
20
29
|
|
|
21
30
|
/**
|
|
22
31
|
* The page frame: a starter shell and a dashboard shell, combined into one
|
|
23
32
|
* component.
|
|
24
33
|
*
|
|
25
|
-
* root row,
|
|
34
|
+
* root row, background-full; one screen tall at least (document
|
|
35
|
+
* scroll), exactly (`fixed`), or its parent's height (`container`)
|
|
26
36
|
* lg and up the sidebar in flow (from `sm` for `variant: 'rail'`, whose
|
|
27
37
|
* drawer below `sm` opens the panel); `overlay` pads the whole frame 12 with a
|
|
28
38
|
* 16 gap, `reveal` sits the rail 12 from the top-left
|
|
29
|
-
* main scrolls
|
|
39
|
+
* main scrolls — on web the DOCUMENT (see `scroll`), elsewhere its own
|
|
40
|
+
* ScrollView; the content column is centred, max 1300, gap 10:
|
|
30
41
|
* header (breadcrumb + title row), then the content (gap 16,
|
|
31
42
|
* 16 below). `overlay` insets the column 12 from the top at `sm`,
|
|
32
43
|
* `reveal` pads the page 12 (24 on top at `sm`)
|
|
33
|
-
*
|
|
44
|
+
* aside optional right column, `asideWidth` (320) wide from `asideFrom`
|
|
45
|
+
* (xl), pinned like the rail; below it stacked after the content
|
|
46
|
+
* below lg the header grows a hamburger (also with no title — see
|
|
47
|
+
* `useAppShell` / `AppShellMenuButton`). `overlay` opens the rail as a
|
|
34
48
|
* drawer (12 inset) over a 40% black backdrop; `reveal` slides
|
|
35
49
|
* the page 272 right and rounds it to 32 while the rail, flat
|
|
36
50
|
* beneath it, scales up from 0.94 and fades in (325ms,
|
|
@@ -42,6 +56,35 @@ const REVEAL_EASE = Easing.bezier(0.42, 0, 0.58, 1);
|
|
|
42
56
|
const REVEAL_MS = 325;
|
|
43
57
|
const REVEAL_OFFSET = 272;
|
|
44
58
|
|
|
59
|
+
type ScrollMode = 'document' | 'container' | 'fixed';
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The page's scroller. `document`: a plain box, the page grows the document.
|
|
63
|
+
* `fixed`: a plain box that fills the frame's height and never scrolls — the
|
|
64
|
+
* page owns its scrolling. `container`: a `ScrollView` filling the frame.
|
|
65
|
+
*/
|
|
66
|
+
function Scroller({
|
|
67
|
+
mode,
|
|
68
|
+
style,
|
|
69
|
+
contentStyle,
|
|
70
|
+
children,
|
|
71
|
+
}: {
|
|
72
|
+
mode: ScrollMode;
|
|
73
|
+
style: WebCssStyle;
|
|
74
|
+
contentStyle: WebCssStyle;
|
|
75
|
+
children: React.ReactNode;
|
|
76
|
+
}) {
|
|
77
|
+
if (mode === 'document') return <View style={[style, contentStyle]}>{children}</View>;
|
|
78
|
+
if (mode === 'fixed') {
|
|
79
|
+
return <View style={[{ flex: 1, minHeight: 0 }, style, contentStyle]}>{children}</View>;
|
|
80
|
+
}
|
|
81
|
+
return (
|
|
82
|
+
<ScrollView style={[{ flex: 1 }, style]} contentContainerStyle={contentStyle}>
|
|
83
|
+
{children}
|
|
84
|
+
</ScrollView>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
45
88
|
const AppShellComponent: React.FC<AppShellProps> = ({
|
|
46
89
|
sidebar,
|
|
47
90
|
drawer = 'overlay',
|
|
@@ -49,20 +92,31 @@ const AppShellComponent: React.FC<AppShellProps> = ({
|
|
|
49
92
|
breadcrumb,
|
|
50
93
|
actions,
|
|
51
94
|
header,
|
|
95
|
+
aside,
|
|
96
|
+
asideWidth = 320,
|
|
97
|
+
asideFrom = 'xl',
|
|
98
|
+
asideCollapse = 'stack',
|
|
52
99
|
children,
|
|
53
100
|
contentMaxWidth = 1300,
|
|
54
101
|
overlay,
|
|
55
102
|
drawerOpen,
|
|
56
103
|
onDrawerOpenChange,
|
|
104
|
+
scroll = 'document',
|
|
57
105
|
style,
|
|
58
106
|
testID,
|
|
59
107
|
}) => {
|
|
60
108
|
const theme = useTheme();
|
|
61
109
|
const { width } = useWindowDimensions();
|
|
110
|
+
// Native has no document: `document` falls back to `container` there.
|
|
111
|
+
const mode: ScrollMode = scroll === 'document' && Platform.OS !== 'web' ? 'container' : scroll;
|
|
112
|
+
const doc = mode === 'document';
|
|
113
|
+
const fixed = mode === 'fixed';
|
|
62
114
|
const small = width >= BREAKPOINTS.sm;
|
|
63
115
|
// The rail is narrow enough to stay in flow from `sm`; the panel needs `lg`.
|
|
64
116
|
const rail = sidebar?.variant === 'rail';
|
|
65
117
|
const wide = rail ? small : width >= BREAKPOINTS.lg;
|
|
118
|
+
const asideBeside = aside != null && width >= BREAKPOINTS[asideFrom];
|
|
119
|
+
const asideStacked = aside != null && !asideBeside && asideCollapse === 'stack';
|
|
66
120
|
// The drawer always opens the full panel, whatever the in-flow variant.
|
|
67
121
|
const drawerSidebar = sidebar ? { ...sidebar, variant: 'panel' as const } : undefined;
|
|
68
122
|
const reducedMotion = useReducedMotion();
|
|
@@ -71,7 +125,19 @@ const AppShellComponent: React.FC<AppShellProps> = ({
|
|
|
71
125
|
defaultValue: false,
|
|
72
126
|
onChange: onDrawerOpenChange,
|
|
73
127
|
});
|
|
74
|
-
const
|
|
128
|
+
const drawerAvailable = !!sidebar && !wide;
|
|
129
|
+
const isOpen = open && drawerAvailable;
|
|
130
|
+
|
|
131
|
+
const shell = useMemo(
|
|
132
|
+
() => ({
|
|
133
|
+
drawerAvailable,
|
|
134
|
+
drawerOpen: isOpen,
|
|
135
|
+
openDrawer: () => setOpen(true),
|
|
136
|
+
closeDrawer: () => setOpen(false),
|
|
137
|
+
toggleDrawer: () => setOpen(!isOpen),
|
|
138
|
+
}),
|
|
139
|
+
[drawerAvailable, isOpen, setOpen],
|
|
140
|
+
);
|
|
75
141
|
|
|
76
142
|
const { neutral: n } = resolveButtonRamps(theme);
|
|
77
143
|
const background = theme.isDark ? mixColor(n[900], n[950], 0.4) : theme.colors.card;
|
|
@@ -91,120 +157,195 @@ const AppShellComponent: React.FC<AppShellProps> = ({
|
|
|
91
157
|
);
|
|
92
158
|
const veilStyle = useAnimatedStyle(() => ({ opacity: reveal.value }), [reveal]);
|
|
93
159
|
|
|
160
|
+
// The default header renders whenever it has something to show — a menu
|
|
161
|
+
// button alone counts, so a page without a title can still open the drawer.
|
|
94
162
|
const headerNode =
|
|
95
163
|
header ??
|
|
96
|
-
(title != null ? (
|
|
164
|
+
(title != null || breadcrumb != null || actions != null || drawerAvailable ? (
|
|
97
165
|
<AppShellHeader
|
|
98
166
|
title={title}
|
|
99
167
|
breadcrumb={breadcrumb}
|
|
100
168
|
actions={actions}
|
|
101
169
|
menuOpen={isOpen}
|
|
102
|
-
onMenuPress={
|
|
170
|
+
onMenuPress={drawerAvailable ? shell.toggleDrawer : undefined}
|
|
103
171
|
testID={testID ? `${testID}-header` : undefined}
|
|
104
172
|
/>
|
|
105
173
|
) : null);
|
|
106
174
|
|
|
175
|
+
const fill = fixed ? { flex: 1, minHeight: 0 } : null;
|
|
107
176
|
const column = (
|
|
108
|
-
<View style={{ width: '100%', maxWidth: contentMaxWidth, alignSelf: 'center', gap: 10 }}>
|
|
177
|
+
<View style={[{ width: '100%', maxWidth: contentMaxWidth, alignSelf: 'center', gap: 10 }, fill]}>
|
|
109
178
|
{headerNode}
|
|
110
|
-
<View style={{ width: '100%', gap: 16, paddingBottom: drawer === 'overlay' ? 16 : 0 }}>
|
|
179
|
+
<View style={[{ width: '100%', gap: 16, paddingBottom: drawer === 'overlay' ? 16 : 0 }, fill]}>
|
|
180
|
+
{children}
|
|
181
|
+
{asideStacked ? <View testID={testID ? `${testID}-aside` : undefined}>{aside}</View> : null}
|
|
182
|
+
</View>
|
|
111
183
|
</View>
|
|
112
184
|
);
|
|
113
185
|
|
|
186
|
+
// Beside the content: sticky and self-scrolling with document scroll, a
|
|
187
|
+
// full-height scroller otherwise.
|
|
188
|
+
const asideColumn = (inset: WebCssStyle) =>
|
|
189
|
+
asideBeside ? (
|
|
190
|
+
<View
|
|
191
|
+
testID={testID ? `${testID}-aside` : undefined}
|
|
192
|
+
style={[
|
|
193
|
+
{ width: asideWidth, flexShrink: 0 },
|
|
194
|
+
doc ? { ...stickyRail(12), width: asideWidth } : { alignSelf: 'stretch' },
|
|
195
|
+
inset,
|
|
196
|
+
]}
|
|
197
|
+
>
|
|
198
|
+
<ScrollView style={{ flex: 1 }} contentContainerStyle={{ flexGrow: 1 }} showsVerticalScrollIndicator={false}>
|
|
199
|
+
{aside}
|
|
200
|
+
</ScrollView>
|
|
201
|
+
</View>
|
|
202
|
+
) : null;
|
|
203
|
+
|
|
204
|
+
const frame = doc ? documentRoot : fixed ? fixedRoot : containerRoot;
|
|
205
|
+
|
|
114
206
|
if (drawer === 'reveal') {
|
|
115
207
|
return (
|
|
208
|
+
<AppShellProvider value={shell}>
|
|
209
|
+
<View
|
|
210
|
+
testID={testID}
|
|
211
|
+
style={[frame, doc ? { overflow: WEB_OVERFLOW_CLIP } : null, { flexDirection: 'row', backgroundColor: background }, style]}
|
|
212
|
+
>
|
|
213
|
+
{sidebar && wide ? (
|
|
214
|
+
<View style={[{ paddingTop: 12, paddingBottom: 12, paddingLeft: 12, flexShrink: 0 }, doc ? stickyRail(0) : null]}>
|
|
215
|
+
<Sidebar {...sidebar} />
|
|
216
|
+
</View>
|
|
217
|
+
) : null}
|
|
218
|
+
{sidebar && !wide ? (
|
|
219
|
+
<View
|
|
220
|
+
aria-hidden={!isOpen}
|
|
221
|
+
pointerEvents={isOpen ? 'auto' : 'none'}
|
|
222
|
+
// Fixed on web in document mode: the rail waits beneath the VIEWPORT,
|
|
223
|
+
// wherever the page is scrolled to.
|
|
224
|
+
style={{ position: doc ? WEB_POSITION_FIXED : 'absolute', top: 0, bottom: 0, left: 0, width: 272, paddingTop: 12, paddingBottom: 12, paddingLeft: 6 }}
|
|
225
|
+
>
|
|
226
|
+
<Animated.View style={[{ height: '100%', width: 260, transformOrigin: 'left center' }, railStyle]}>
|
|
227
|
+
<Sidebar {...drawerSidebar} mobile flat onClose={() => setOpen(false)} />
|
|
228
|
+
</Animated.View>
|
|
229
|
+
</View>
|
|
230
|
+
) : null}
|
|
231
|
+
<Animated.View
|
|
232
|
+
style={[
|
|
233
|
+
{ flex: 1, minWidth: 0, flexDirection: 'row', overflow: doc ? WEB_OVERFLOW_CLIP : 'hidden', backgroundColor: background },
|
|
234
|
+
wide ? null : pageStyle,
|
|
235
|
+
]}
|
|
236
|
+
>
|
|
237
|
+
<Scroller mode={mode} style={{ flex: doc ? undefined : 1, flexGrow: 1, minWidth: 0 }} contentStyle={{ padding: 12, paddingTop: small ? 24 : 12 }}>
|
|
238
|
+
{column}
|
|
239
|
+
</Scroller>
|
|
240
|
+
{asideColumn({ paddingTop: small ? 24 : 12, paddingBottom: 12, paddingRight: 12 })}
|
|
241
|
+
{!wide ? (
|
|
242
|
+
<Animated.View
|
|
243
|
+
pointerEvents={isOpen ? 'auto' : 'none'}
|
|
244
|
+
style={[{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }, veilStyle]}
|
|
245
|
+
>
|
|
246
|
+
<Pressable
|
|
247
|
+
role="button"
|
|
248
|
+
accessibilityLabel="Close navigation"
|
|
249
|
+
focusable={isOpen}
|
|
250
|
+
onPress={() => setOpen(false)}
|
|
251
|
+
style={{
|
|
252
|
+
flex: 1,
|
|
253
|
+
backgroundColor: theme.isDark ? 'rgba(255, 255, 255, 0.05)' : 'rgba(0, 0, 0, 0.1)',
|
|
254
|
+
}}
|
|
255
|
+
testID={testID ? `${testID}-veil` : undefined}
|
|
256
|
+
/>
|
|
257
|
+
</Animated.View>
|
|
258
|
+
) : null}
|
|
259
|
+
</Animated.View>
|
|
260
|
+
{overlay}
|
|
261
|
+
</View>
|
|
262
|
+
</AppShellProvider>
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
return (
|
|
267
|
+
<AppShellProvider value={shell}>
|
|
116
268
|
<View
|
|
117
269
|
testID={testID}
|
|
118
|
-
style={[{
|
|
270
|
+
style={[frame, { flexDirection: 'row', gap: 16, padding: 12, backgroundColor: background }, style]}
|
|
119
271
|
>
|
|
120
272
|
{sidebar && wide ? (
|
|
121
|
-
|
|
273
|
+
doc ? (
|
|
274
|
+
<View style={stickyRail(12)}>
|
|
275
|
+
<Sidebar {...sidebar} />
|
|
276
|
+
</View>
|
|
277
|
+
) : (
|
|
122
278
|
<Sidebar {...sidebar} />
|
|
123
|
-
|
|
279
|
+
)
|
|
124
280
|
) : null}
|
|
125
|
-
{sidebar &&
|
|
126
|
-
<
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
style={{ position: 'absolute', top: 0, bottom: 0, left: 0, width: 272, paddingTop: 12, paddingBottom: 12, paddingLeft: 6 }}
|
|
130
|
-
>
|
|
131
|
-
<Animated.View style={[{ height: '100%', width: 260, transformOrigin: 'left center' }, railStyle]}>
|
|
132
|
-
<Sidebar {...drawerSidebar} mobile flat onClose={() => setOpen(false)} />
|
|
133
|
-
</Animated.View>
|
|
134
|
-
</View>
|
|
135
|
-
) : null}
|
|
136
|
-
<Animated.View
|
|
137
|
-
style={[{ flex: 1, minWidth: 0, overflow: 'hidden', backgroundColor: background }, wide ? null : pageStyle]}
|
|
138
|
-
>
|
|
139
|
-
<ScrollView
|
|
140
|
-
style={{ flex: 1 }}
|
|
141
|
-
contentContainerStyle={{ padding: 12, paddingTop: small ? 24 : 12 }}
|
|
142
|
-
>
|
|
143
|
-
{column}
|
|
144
|
-
</ScrollView>
|
|
145
|
-
{!wide ? (
|
|
146
|
-
<Animated.View
|
|
147
|
-
pointerEvents={isOpen ? 'auto' : 'none'}
|
|
148
|
-
style={[{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }, veilStyle]}
|
|
149
|
-
>
|
|
150
|
-
<Pressable
|
|
151
|
-
role="button"
|
|
152
|
-
accessibilityLabel="Close navigation"
|
|
153
|
-
focusable={isOpen}
|
|
281
|
+
{sidebar && isOpen ? (
|
|
282
|
+
<Portal>
|
|
283
|
+
<OverlayRoot>
|
|
284
|
+
<Backdrop
|
|
154
285
|
onPress={() => setOpen(false)}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}}
|
|
159
|
-
testID={testID ? `${testID}-veil` : undefined}
|
|
286
|
+
blurIntensity={0}
|
|
287
|
+
dimOpacity={0.4}
|
|
288
|
+
accessibilityLabel="Close navigation"
|
|
160
289
|
/>
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
290
|
+
<View
|
|
291
|
+
pointerEvents="box-none"
|
|
292
|
+
style={{ position: 'absolute', top: 0, bottom: 0, left: 0, flexDirection: 'row', padding: 12 }}
|
|
293
|
+
>
|
|
294
|
+
<View pointerEvents="auto" style={{ height: '100%' }}>
|
|
295
|
+
<Sidebar {...drawerSidebar} mobile onClose={() => setOpen(false)} />
|
|
296
|
+
</View>
|
|
297
|
+
</View>
|
|
298
|
+
</OverlayRoot>
|
|
299
|
+
</Portal>
|
|
300
|
+
) : null}
|
|
301
|
+
<Scroller
|
|
302
|
+
mode={mode}
|
|
303
|
+
style={{ flex: 1, minWidth: 0, backgroundColor: background }}
|
|
304
|
+
contentStyle={{ paddingTop: small ? 12 : 0 }}
|
|
305
|
+
>
|
|
306
|
+
{column}
|
|
307
|
+
</Scroller>
|
|
308
|
+
{asideColumn({})}
|
|
164
309
|
{overlay}
|
|
165
310
|
</View>
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
return (
|
|
170
|
-
<View
|
|
171
|
-
testID={testID}
|
|
172
|
-
style={[
|
|
173
|
-
{ flex: 1, height: '100%', flexDirection: 'row', gap: 16, overflow: 'hidden', padding: 12, backgroundColor: background },
|
|
174
|
-
style,
|
|
175
|
-
]}
|
|
176
|
-
>
|
|
177
|
-
{sidebar && wide ? <Sidebar {...sidebar} /> : null}
|
|
178
|
-
{sidebar && isOpen ? (
|
|
179
|
-
<Portal>
|
|
180
|
-
<OverlayRoot>
|
|
181
|
-
<Backdrop
|
|
182
|
-
onPress={() => setOpen(false)}
|
|
183
|
-
blurIntensity={0}
|
|
184
|
-
dimOpacity={0.4}
|
|
185
|
-
accessibilityLabel="Close navigation"
|
|
186
|
-
/>
|
|
187
|
-
<View
|
|
188
|
-
pointerEvents="box-none"
|
|
189
|
-
style={{ position: 'absolute', top: 0, bottom: 0, left: 0, flexDirection: 'row', padding: 12 }}
|
|
190
|
-
>
|
|
191
|
-
<View pointerEvents="auto" style={{ height: '100%' }}>
|
|
192
|
-
<Sidebar {...drawerSidebar} mobile onClose={() => setOpen(false)} />
|
|
193
|
-
</View>
|
|
194
|
-
</View>
|
|
195
|
-
</OverlayRoot>
|
|
196
|
-
</Portal>
|
|
197
|
-
) : null}
|
|
198
|
-
<ScrollView
|
|
199
|
-
style={{ flex: 1, minWidth: 0, backgroundColor: background }}
|
|
200
|
-
contentContainerStyle={{ paddingTop: small ? 12 : 0 }}
|
|
201
|
-
>
|
|
202
|
-
{column}
|
|
203
|
-
</ScrollView>
|
|
204
|
-
{overlay}
|
|
205
|
-
</View>
|
|
311
|
+
</AppShellProvider>
|
|
206
312
|
);
|
|
207
313
|
};
|
|
208
314
|
|
|
315
|
+
/**
|
|
316
|
+
* Document mode: the frame is at least one viewport tall and grows with the
|
|
317
|
+
* page, so the browser scrolls the document (scroll restoration, the address
|
|
318
|
+
* bar collapsing, anchor links, `window.scrollTo`) exactly as it does for a
|
|
319
|
+
* `ContentPanel` page. Nothing here may be a scroll container — no `hidden`
|
|
320
|
+
* overflow — or the sticky rail would stick to a box that never scrolls.
|
|
321
|
+
*/
|
|
322
|
+
const documentRoot: WebCssStyle = { flexGrow: 1, minHeight: WEB_VIEWPORT_HEIGHT };
|
|
323
|
+
// (Under `reveal` the document root also takes `overflow: clip`: the page slides
|
|
324
|
+
// 272 right, and `clip` keeps that from widening the document with a horizontal
|
|
325
|
+
// scrollbar without becoming a scroll container.)
|
|
326
|
+
|
|
327
|
+
/** Container mode: fill the parent, scroll inside. */
|
|
328
|
+
const containerRoot: WebCssStyle = { flex: 1, height: '100%', overflow: 'hidden' };
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Fixed mode: exactly one screen — `100dvh` on web, the parent on native — and
|
|
332
|
+
* nothing scrolls; the content fills the height left under the header.
|
|
333
|
+
*/
|
|
334
|
+
const fixedRoot: WebCssStyle =
|
|
335
|
+
Platform.OS === 'web'
|
|
336
|
+
? { height: WEB_VIEWPORT_HEIGHT, overflow: 'hidden' }
|
|
337
|
+
: { flex: 1, height: '100%', overflow: 'hidden' };
|
|
338
|
+
|
|
339
|
+
/** The in-flow rail, pinned to the viewport while the document scrolls under it. */
|
|
340
|
+
function stickyRail(inset: number): WebCssStyle {
|
|
341
|
+
return {
|
|
342
|
+
position: WEB_POSITION_STICKY,
|
|
343
|
+
top: inset,
|
|
344
|
+
height: webViewportHeightMinus(inset * 2),
|
|
345
|
+
alignSelf: 'flex-start',
|
|
346
|
+
flexShrink: 0,
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
|
|
209
350
|
export const AppShell = memo(AppShellComponent);
|
|
210
351
|
AppShell.displayName = 'AppShell';
|
|
@@ -57,15 +57,17 @@ const AppShellHeaderComponent: React.FC<AppShellHeaderProps> = ({
|
|
|
57
57
|
testID={testID ? `${testID}-menu` : undefined}
|
|
58
58
|
/>
|
|
59
59
|
) : null}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
{title != null ? (
|
|
61
|
+
<Text
|
|
62
|
+
role="heading"
|
|
63
|
+
aria-level={1}
|
|
64
|
+
variant="title-2-medium"
|
|
65
|
+
numberOfLines={1}
|
|
66
|
+
style={{ paddingLeft: 4, paddingRight: 4, color: theme.colors.text }}
|
|
67
|
+
>
|
|
68
|
+
{title}
|
|
69
|
+
</Text>
|
|
70
|
+
) : null}
|
|
69
71
|
</View>
|
|
70
72
|
{actions ? (
|
|
71
73
|
<View
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Button } from '../button';
|
|
4
|
+
import { RiCloseLine, RiMenuLine } from '../icons/remix';
|
|
5
|
+
import { useAppShell } from './context';
|
|
6
|
+
import type { AppShellMenuButtonProps } from './types';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The hamburger that opens `AppShell`'s drawer, for a page that draws its own
|
|
10
|
+
* header. Renders nothing while the sidebar sits in flow, so it can stay in the
|
|
11
|
+
* markup at every width. A medium secondary icon button — the same one
|
|
12
|
+
* `AppShellHeader` shows — swapping to a close glyph while the drawer is open.
|
|
13
|
+
*/
|
|
14
|
+
const AppShellMenuButtonComponent: React.FC<AppShellMenuButtonProps> = ({
|
|
15
|
+
accessibilityLabel = 'Open navigation',
|
|
16
|
+
style,
|
|
17
|
+
testID,
|
|
18
|
+
}) => {
|
|
19
|
+
const shell = useAppShell();
|
|
20
|
+
if (!shell.drawerAvailable) return null;
|
|
21
|
+
return (
|
|
22
|
+
<Button
|
|
23
|
+
variant="secondary"
|
|
24
|
+
size="medium"
|
|
25
|
+
iconOnly
|
|
26
|
+
leadingIcon={shell.drawerOpen ? RiCloseLine : RiMenuLine}
|
|
27
|
+
accessibilityLabel={accessibilityLabel}
|
|
28
|
+
aria-expanded={shell.drawerOpen}
|
|
29
|
+
onPress={shell.toggleDrawer}
|
|
30
|
+
style={style}
|
|
31
|
+
testID={testID}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const AppShellMenuButton = memo(AppShellMenuButtonComponent);
|
|
37
|
+
AppShellMenuButton.displayName = 'AppShellMenuButton';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `AppShell` tells the page inside it about its navigation drawer, so a
|
|
3
|
+
* page without a `title` — or with its own `header` — can still open it.
|
|
4
|
+
*/
|
|
5
|
+
import { createContext, useContext } from 'react';
|
|
6
|
+
|
|
7
|
+
export interface AppShellContextValue {
|
|
8
|
+
/**
|
|
9
|
+
* Whether the sidebar is a drawer right now (below `lg`, or below `sm` for
|
|
10
|
+
* `variant: 'rail'`). `false` when it sits in flow or there is no sidebar —
|
|
11
|
+
* a menu button has nothing to open then.
|
|
12
|
+
*/
|
|
13
|
+
drawerAvailable: boolean;
|
|
14
|
+
drawerOpen: boolean;
|
|
15
|
+
openDrawer: () => void;
|
|
16
|
+
closeDrawer: () => void;
|
|
17
|
+
toggleDrawer: () => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const AppShellContext = createContext<AppShellContextValue | null>(null);
|
|
21
|
+
AppShellContext.displayName = 'BloomAppShellContext';
|
|
22
|
+
|
|
23
|
+
export const AppShellProvider = AppShellContext.Provider;
|
|
24
|
+
|
|
25
|
+
/** The enclosing `AppShell`'s drawer. Throws outside one. */
|
|
26
|
+
export function useAppShell(): AppShellContextValue {
|
|
27
|
+
const value = useContext(AppShellContext);
|
|
28
|
+
if (!value) throw new Error('useAppShell must be used inside an <AppShell>.');
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** The enclosing `AppShell`'s drawer, or `null` outside one. */
|
|
33
|
+
export function useOptionalAppShell(): AppShellContextValue | null {
|
|
34
|
+
return useContext(AppShellContext);
|
|
35
|
+
}
|
package/src/app-shell/index.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
export { AppShell } from './AppShell';
|
|
2
2
|
export { AppShellHeader } from './AppShellHeader';
|
|
3
|
+
export { AppShellMenuButton } from './AppShellMenuButton';
|
|
4
|
+
export { useAppShell } from './context';
|
|
5
|
+
export type { AppShellContextValue } from './context';
|
|
3
6
|
export { NotificationBell } from './NotificationBell';
|
|
4
7
|
export { ProOfferCard } from './ProOfferCard';
|
|
5
8
|
|
|
6
9
|
export type {
|
|
7
10
|
AppShellDrawer,
|
|
8
11
|
AppShellHeaderProps,
|
|
12
|
+
AppShellMenuButtonProps,
|
|
9
13
|
AppShellProps,
|
|
10
14
|
NotificationBellProps,
|
|
11
15
|
ProOfferCardProps,
|