@oxy.so/bloom 2.6.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 +47 -3
- package/docs/sidebar.mdx +17 -0
- package/lib/commonjs/app-shell/AppShell.js +248 -156
- 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/module/app-shell/AppShell.js +249 -157
- 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/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 +41 -11
- 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/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 +41 -11
- 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/package.json +1 -1
- package/src/app-shell/AppShell.tsx +181 -107
- 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 +42 -11
- 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/docs/app-shell.mdx
CHANGED
|
@@ -6,7 +6,7 @@ order: 83
|
|
|
6
6
|
|
|
7
7
|
# AppShell
|
|
8
8
|
|
|
9
|
-
`AppShell`, with `AppShellHeader`, `NotificationBell` and `ProOfferCard`.
|
|
9
|
+
`AppShell`, with `AppShellHeader`, `AppShellMenuButton`, `useAppShell`, `NotificationBell` and `ProOfferCard`.
|
|
10
10
|
|
|
11
11
|
```tsx
|
|
12
12
|
import { AppShell, NotificationBell, ProOfferCard } from '@oxy.so/bloom/app-shell';
|
|
@@ -32,6 +32,51 @@ import { AppShell, NotificationBell, ProOfferCard } from '@oxy.so/bloom/app-shel
|
|
|
32
32
|
- `overlay` — a drawer over the page on a 40% black backdrop (portaled through `OverlayRoot`, so it ranks with every other overlay).
|
|
33
33
|
- `reveal` — the rail waits flat beneath the page; the page slides 272 right and rounds to 32 while the rail scales in from 0.94 (325ms). Pressing the page closes it.
|
|
34
34
|
- `drawerOpen` / `onDrawerOpenChange` control it.
|
|
35
|
+
- `sidebar={{ variant: 'rail', … }}` keeps the 80px navigation rail in flow from `sm` instead of `lg`; below `sm` the menu button opens the drawer, which always shows the full panel.
|
|
36
|
+
|
|
37
|
+
## Aside
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
<AppShell sidebar={sidebar} title="Tickets" aside={<ActivityPanel />} asideWidth={320} asideFrom="xl">
|
|
41
|
+
{page}
|
|
42
|
+
</AppShell>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
A second column on the right of the page. From `asideFrom` (`xl`, 1280; or `md` / `lg`) it sits beside the content at `asideWidth` (320), pinned like the sidebar — with document scroll it is sticky and scrolls its own overflow, so give it `flex: 1` content if it should fill the height. Below the breakpoint it is stacked after the content (`asideCollapse="stack"`, the default) or dropped (`"hidden"`). Under `drawer="reveal"` it slides with the page.
|
|
46
|
+
|
|
47
|
+
## Opening the drawer without a title
|
|
48
|
+
|
|
49
|
+
The default header renders whenever it has something to show, and below `lg` the menu button counts — so `<AppShell sidebar={…}>` with no `title` still gets a hamburger, and nothing at all while the sidebar sits in flow.
|
|
50
|
+
|
|
51
|
+
A page that draws its own `header` keeps the drawer reachable with either:
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
import { AppShellMenuButton, useAppShell } from '@oxy.so/bloom/app-shell';
|
|
55
|
+
|
|
56
|
+
<AppShell sidebar={sidebar} header={<MyHeader leading={<AppShellMenuButton />} />}>…</AppShell>
|
|
57
|
+
|
|
58
|
+
function MyHeader() {
|
|
59
|
+
const { drawerAvailable, drawerOpen, openDrawer, closeDrawer, toggleDrawer } = useAppShell();
|
|
60
|
+
…
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`AppShellMenuButton` is the same button the header uses and renders nothing while the sidebar is in flow. `useAppShell()` works anywhere inside the shell (the header, the page, the aside); `drawerAvailable` says whether there is a drawer to open right now.
|
|
65
|
+
|
|
66
|
+
## A fixed screen
|
|
67
|
+
|
|
68
|
+
`scroll="fixed"` makes the shell exactly one screen tall (`100dvh` on web, its parent on native) and scrolls nothing: the header stays, and the content column fills the height left under it (`flex: 1`). The page owns its scrolling — a chat with a pinned composer, a map, a board:
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
<AppShell scroll="fixed" sidebar={sidebar} title="Chat">
|
|
72
|
+
<View style={{ flex: 1, minHeight: 0 }}>
|
|
73
|
+
<MessageList style={{ flex: 1 }} />
|
|
74
|
+
<Composer />
|
|
75
|
+
</View>
|
|
76
|
+
</AppShell>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Give the page `flex: 1` and `minHeight: 0`, or a tall child grows the column past the screen instead of scrolling inside it.
|
|
35
80
|
|
|
36
81
|
## Scrolling on web
|
|
37
82
|
|
|
@@ -41,8 +86,7 @@ The page scrolls the **document**, like a [`ContentPanel`](/docs/bloom/main/cont
|
|
|
41
86
|
- `reveal` clips the sliding page with `overflow: clip`, not `hidden`, for the same reason — and so the 272px slide never adds a horizontal scrollbar. The waiting rail is `position: fixed`.
|
|
42
87
|
- `scroll="container"` restores the old behaviour — the shell fills its parent and the page scrolls inside its own `ScrollView` — for a shell embedded in a bounded box rather than owning the page.
|
|
43
88
|
|
|
44
|
-
Native has no document:
|
|
45
|
-
- `sidebar={{ variant: 'rail', … }}` keeps the 80px navigation rail in flow from `sm` instead of `lg`; below `sm` the menu button opens the drawer, which always shows the full panel.
|
|
89
|
+
Native has no document: `document` behaves as `container` there, and `fixed` works the same as on web.
|
|
46
90
|
|
|
47
91
|
## NotificationBell
|
|
48
92
|
|
package/docs/sidebar.mdx
CHANGED
|
@@ -39,6 +39,23 @@ Give it a height (it fills `100%`); its width is its own.
|
|
|
39
39
|
| `SidebarRailItem` | one `rail` destination: icon on a 48 × 32 pill over a 10px label |
|
|
40
40
|
| `SIDEBAR_RAIL_WIDTH` | the rail's width (80) |
|
|
41
41
|
|
|
42
|
+
## Logo
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
<Sidebar
|
|
46
|
+
logo={{ icon: <OxyMark width={28} height={28} />, wordmark: 'Oxy', href: '/', onPress: () => router.push('/') }}
|
|
47
|
+
items={items}
|
|
48
|
+
account={account}
|
|
49
|
+
/>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
- `icon` — the mark, centred in a 36 × 36 box (the collapsed column), so it stays put while the sidebar collapses. Size it yourself; 24–28px reads right.
|
|
53
|
+
- `wordmark` — beside the mark, folded away while collapsed. A string renders as the product name in `headline-semibold`; pass an SVG or image for a drawn wordmark.
|
|
54
|
+
- `href` makes it a real anchor on web; `onPress` a button (with both, `onPress` wins so a router can navigate — pass it on native, where there is no anchor). With neither it is decoration, named by `accessibilityLabel` or a string `wordmark`.
|
|
55
|
+
- Give a mark, a wordmark or both. Wordmark only disappears when collapsed.
|
|
56
|
+
|
|
57
|
+
The logo leads the header beside the collapse (or close) control; `account`, if given too, moves to its own row under it. Collapsed, the mark sits above the expand control. `variant="rail"` shows the mark only, centred above the items.
|
|
58
|
+
|
|
42
59
|
## Modes
|
|
43
60
|
|
|
44
61
|
```tsx
|
|
@@ -16,13 +16,15 @@ var _breakpoints = require("../styles/breakpoints.js");
|
|
|
16
16
|
var _webViewStyle = require("../styles/web-view-style.js");
|
|
17
17
|
var _useTheme = require("../theme/use-theme.js");
|
|
18
18
|
var _AppShellHeader = require("./AppShellHeader.js");
|
|
19
|
+
var _context = require("./context.js");
|
|
19
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
21
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
21
22
|
/**
|
|
22
23
|
* The page frame: a starter shell and a dashboard shell, combined into one
|
|
23
24
|
* component.
|
|
24
25
|
*
|
|
25
|
-
* root row,
|
|
26
|
+
* root row, background-full; one screen tall at least (document
|
|
27
|
+
* scroll), exactly (`fixed`), or its parent's height (`container`)
|
|
26
28
|
* lg and up the sidebar in flow (from `sm` for `variant: 'rail'`, whose
|
|
27
29
|
* drawer below `sm` opens the panel); `overlay` pads the whole frame 12 with a
|
|
28
30
|
* 16 gap, `reveal` sits the rail 12 from the top-left
|
|
@@ -31,7 +33,10 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
31
33
|
* header (breadcrumb + title row), then the content (gap 16,
|
|
32
34
|
* 16 below). `overlay` insets the column 12 from the top at `sm`,
|
|
33
35
|
* `reveal` pads the page 12 (24 on top at `sm`)
|
|
34
|
-
*
|
|
36
|
+
* aside optional right column, `asideWidth` (320) wide from `asideFrom`
|
|
37
|
+
* (xl), pinned like the rail; below it stacked after the content
|
|
38
|
+
* below lg the header grows a hamburger (also with no title — see
|
|
39
|
+
* `useAppShell` / `AppShellMenuButton`). `overlay` opens the rail as a
|
|
35
40
|
* drawer (12 inset) over a 40% black backdrop; `reveal` slides
|
|
36
41
|
* the page 272 right and rounds it to 32 while the rail, flat
|
|
37
42
|
* beneath it, scales up from 0.94 and fades in (325ms,
|
|
@@ -42,21 +47,30 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
42
47
|
const REVEAL_EASE = _reactNativeReanimated.Easing.bezier(0.42, 0, 0.58, 1);
|
|
43
48
|
const REVEAL_MS = 325;
|
|
44
49
|
const REVEAL_OFFSET = 272;
|
|
45
|
-
|
|
46
50
|
/**
|
|
47
|
-
* The page's scroller.
|
|
48
|
-
*
|
|
51
|
+
* The page's scroller. `document`: a plain box, the page grows the document.
|
|
52
|
+
* `fixed`: a plain box that fills the frame's height and never scrolls — the
|
|
53
|
+
* page owns its scrolling. `container`: a `ScrollView` filling the frame.
|
|
49
54
|
*/
|
|
50
55
|
function Scroller({
|
|
51
|
-
|
|
56
|
+
mode,
|
|
52
57
|
style,
|
|
53
58
|
contentStyle,
|
|
54
59
|
children
|
|
55
60
|
}) {
|
|
56
|
-
if (
|
|
61
|
+
if (mode === 'document') return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
57
62
|
style: [style, contentStyle],
|
|
58
63
|
children: children
|
|
59
64
|
});
|
|
65
|
+
if (mode === 'fixed') {
|
|
66
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
67
|
+
style: [{
|
|
68
|
+
flex: 1,
|
|
69
|
+
minHeight: 0
|
|
70
|
+
}, style, contentStyle],
|
|
71
|
+
children: children
|
|
72
|
+
});
|
|
73
|
+
}
|
|
60
74
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
|
|
61
75
|
style: [{
|
|
62
76
|
flex: 1
|
|
@@ -72,6 +86,10 @@ const AppShellComponent = ({
|
|
|
72
86
|
breadcrumb,
|
|
73
87
|
actions,
|
|
74
88
|
header,
|
|
89
|
+
aside,
|
|
90
|
+
asideWidth = 320,
|
|
91
|
+
asideFrom = 'xl',
|
|
92
|
+
asideCollapse = 'stack',
|
|
75
93
|
children,
|
|
76
94
|
contentMaxWidth = 1300,
|
|
77
95
|
overlay,
|
|
@@ -85,12 +103,16 @@ const AppShellComponent = ({
|
|
|
85
103
|
const {
|
|
86
104
|
width
|
|
87
105
|
} = (0, _reactNative.useWindowDimensions)();
|
|
88
|
-
// Native has no document
|
|
89
|
-
const
|
|
106
|
+
// Native has no document: `document` falls back to `container` there.
|
|
107
|
+
const mode = scroll === 'document' && _reactNative.Platform.OS !== 'web' ? 'container' : scroll;
|
|
108
|
+
const doc = mode === 'document';
|
|
109
|
+
const fixed = mode === 'fixed';
|
|
90
110
|
const small = width >= _breakpoints.BREAKPOINTS.sm;
|
|
91
111
|
// The rail is narrow enough to stay in flow from `sm`; the panel needs `lg`.
|
|
92
112
|
const rail = sidebar?.variant === 'rail';
|
|
93
113
|
const wide = rail ? small : width >= _breakpoints.BREAKPOINTS.lg;
|
|
114
|
+
const asideBeside = aside != null && width >= _breakpoints.BREAKPOINTS[asideFrom];
|
|
115
|
+
const asideStacked = aside != null && !asideBeside && asideCollapse === 'stack';
|
|
94
116
|
// The drawer always opens the full panel, whatever the in-flow variant.
|
|
95
117
|
const drawerSidebar = sidebar ? {
|
|
96
118
|
...sidebar,
|
|
@@ -102,7 +124,15 @@ const AppShellComponent = ({
|
|
|
102
124
|
defaultValue: false,
|
|
103
125
|
onChange: onDrawerOpenChange
|
|
104
126
|
});
|
|
105
|
-
const
|
|
127
|
+
const drawerAvailable = !!sidebar && !wide;
|
|
128
|
+
const isOpen = open && drawerAvailable;
|
|
129
|
+
const shell = (0, _react.useMemo)(() => ({
|
|
130
|
+
drawerAvailable,
|
|
131
|
+
drawerOpen: isOpen,
|
|
132
|
+
openDrawer: () => setOpen(true),
|
|
133
|
+
closeDrawer: () => setOpen(false),
|
|
134
|
+
toggleDrawer: () => setOpen(!isOpen)
|
|
135
|
+
}), [drawerAvailable, isOpen, setOpen]);
|
|
106
136
|
const {
|
|
107
137
|
neutral: n
|
|
108
138
|
} = (0, _shared.resolveButtonRamps)(theme);
|
|
@@ -130,180 +160,225 @@ const AppShellComponent = ({
|
|
|
130
160
|
const veilStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
131
161
|
opacity: reveal.value
|
|
132
162
|
}), [reveal]);
|
|
133
|
-
|
|
163
|
+
|
|
164
|
+
// The default header renders whenever it has something to show — a menu
|
|
165
|
+
// button alone counts, so a page without a title can still open the drawer.
|
|
166
|
+
const headerNode = header ?? (title != null || breadcrumb != null || actions != null || drawerAvailable ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppShellHeader.AppShellHeader, {
|
|
134
167
|
title: title,
|
|
135
168
|
breadcrumb: breadcrumb,
|
|
136
169
|
actions: actions,
|
|
137
170
|
menuOpen: isOpen,
|
|
138
|
-
onMenuPress:
|
|
171
|
+
onMenuPress: drawerAvailable ? shell.toggleDrawer : undefined,
|
|
139
172
|
testID: testID ? `${testID}-header` : undefined
|
|
140
173
|
}) : null);
|
|
174
|
+
const fill = fixed ? {
|
|
175
|
+
flex: 1,
|
|
176
|
+
minHeight: 0
|
|
177
|
+
} : null;
|
|
141
178
|
const column = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
142
|
-
style: {
|
|
179
|
+
style: [{
|
|
143
180
|
width: '100%',
|
|
144
181
|
maxWidth: contentMaxWidth,
|
|
145
182
|
alignSelf: 'center',
|
|
146
183
|
gap: 10
|
|
147
|
-
},
|
|
148
|
-
children: [headerNode, /*#__PURE__*/(0, _jsxRuntime.
|
|
149
|
-
style: {
|
|
184
|
+
}, fill],
|
|
185
|
+
children: [headerNode, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
186
|
+
style: [{
|
|
150
187
|
width: '100%',
|
|
151
188
|
gap: 16,
|
|
152
189
|
paddingBottom: drawer === 'overlay' ? 16 : 0
|
|
153
|
-
},
|
|
154
|
-
children: children
|
|
190
|
+
}, fill],
|
|
191
|
+
children: [children, asideStacked ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
192
|
+
testID: testID ? `${testID}-aside` : undefined,
|
|
193
|
+
children: aside
|
|
194
|
+
}) : null]
|
|
155
195
|
})]
|
|
156
196
|
});
|
|
197
|
+
|
|
198
|
+
// Beside the content: sticky and self-scrolling with document scroll, a
|
|
199
|
+
// full-height scroller otherwise.
|
|
200
|
+
const asideColumn = inset => asideBeside ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
201
|
+
testID: testID ? `${testID}-aside` : undefined,
|
|
202
|
+
style: [{
|
|
203
|
+
width: asideWidth,
|
|
204
|
+
flexShrink: 0
|
|
205
|
+
}, doc ? {
|
|
206
|
+
...stickyRail(12),
|
|
207
|
+
width: asideWidth
|
|
208
|
+
} : {
|
|
209
|
+
alignSelf: 'stretch'
|
|
210
|
+
}, inset],
|
|
211
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
|
|
212
|
+
style: {
|
|
213
|
+
flex: 1
|
|
214
|
+
},
|
|
215
|
+
contentContainerStyle: {
|
|
216
|
+
flexGrow: 1
|
|
217
|
+
},
|
|
218
|
+
showsVerticalScrollIndicator: false,
|
|
219
|
+
children: aside
|
|
220
|
+
})
|
|
221
|
+
}) : null;
|
|
222
|
+
const frame = doc ? documentRoot : fixed ? fixedRoot : containerRoot;
|
|
157
223
|
if (drawer === 'reveal') {
|
|
158
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
backgroundColor: background
|
|
167
|
-
}, style],
|
|
168
|
-
children: [sidebar && wide ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
169
|
-
style: [{
|
|
170
|
-
paddingTop: 12,
|
|
171
|
-
paddingBottom: 12,
|
|
172
|
-
paddingLeft: 12,
|
|
173
|
-
flexShrink: 0
|
|
174
|
-
}, doc ? stickyRail(0) : null],
|
|
175
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Sidebar, {
|
|
176
|
-
...sidebar
|
|
177
|
-
})
|
|
178
|
-
}) : null, sidebar && !wide ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
179
|
-
"aria-hidden": !isOpen,
|
|
180
|
-
pointerEvents: isOpen ? 'auto' : 'none'
|
|
181
|
-
// Fixed on web in document mode: the rail waits beneath the VIEWPORT,
|
|
182
|
-
// wherever the page is scrolled to.
|
|
183
|
-
,
|
|
184
|
-
style: {
|
|
185
|
-
position: doc ? _webViewStyle.WEB_POSITION_FIXED : 'absolute',
|
|
186
|
-
top: 0,
|
|
187
|
-
bottom: 0,
|
|
188
|
-
left: 0,
|
|
189
|
-
width: 272,
|
|
190
|
-
paddingTop: 12,
|
|
191
|
-
paddingBottom: 12,
|
|
192
|
-
paddingLeft: 6
|
|
193
|
-
},
|
|
194
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
195
|
-
style: [{
|
|
196
|
-
height: '100%',
|
|
197
|
-
width: 260,
|
|
198
|
-
transformOrigin: 'left center'
|
|
199
|
-
}, railStyle],
|
|
200
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Sidebar, {
|
|
201
|
-
...drawerSidebar,
|
|
202
|
-
mobile: true,
|
|
203
|
-
flat: true,
|
|
204
|
-
onClose: () => setOpen(false)
|
|
205
|
-
})
|
|
206
|
-
})
|
|
207
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNativeReanimated.default.View, {
|
|
208
|
-
style: [{
|
|
209
|
-
flex: 1,
|
|
210
|
-
minWidth: 0,
|
|
211
|
-
overflow: doc ? _webViewStyle.WEB_OVERFLOW_CLIP : 'hidden',
|
|
224
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.AppShellProvider, {
|
|
225
|
+
value: shell,
|
|
226
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
227
|
+
testID: testID,
|
|
228
|
+
style: [frame, doc ? {
|
|
229
|
+
overflow: _webViewStyle.WEB_OVERFLOW_CLIP
|
|
230
|
+
} : null, {
|
|
231
|
+
flexDirection: 'row',
|
|
212
232
|
backgroundColor: background
|
|
213
|
-
},
|
|
214
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
215
|
-
document: doc,
|
|
216
|
-
style: {},
|
|
217
|
-
contentStyle: {
|
|
218
|
-
padding: 12,
|
|
219
|
-
paddingTop: small ? 24 : 12
|
|
220
|
-
},
|
|
221
|
-
children: column
|
|
222
|
-
}), !wide ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
223
|
-
pointerEvents: isOpen ? 'auto' : 'none',
|
|
233
|
+
}, style],
|
|
234
|
+
children: [sidebar && wide ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
224
235
|
style: [{
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
role: "button",
|
|
233
|
-
accessibilityLabel: "Close navigation",
|
|
234
|
-
focusable: isOpen,
|
|
235
|
-
onPress: () => setOpen(false),
|
|
236
|
-
style: {
|
|
237
|
-
flex: 1,
|
|
238
|
-
backgroundColor: theme.isDark ? 'rgba(255, 255, 255, 0.05)' : 'rgba(0, 0, 0, 0.1)'
|
|
239
|
-
},
|
|
240
|
-
testID: testID ? `${testID}-veil` : undefined
|
|
236
|
+
paddingTop: 12,
|
|
237
|
+
paddingBottom: 12,
|
|
238
|
+
paddingLeft: 12,
|
|
239
|
+
flexShrink: 0
|
|
240
|
+
}, doc ? stickyRail(0) : null],
|
|
241
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Sidebar, {
|
|
242
|
+
...sidebar
|
|
241
243
|
})
|
|
242
|
-
}) : null
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
style: [doc ? documentRoot : {
|
|
249
|
-
flex: 1,
|
|
250
|
-
height: '100%',
|
|
251
|
-
overflow: 'hidden'
|
|
252
|
-
}, {
|
|
253
|
-
flexDirection: 'row',
|
|
254
|
-
gap: 16,
|
|
255
|
-
padding: 12,
|
|
256
|
-
backgroundColor: background
|
|
257
|
-
}, style],
|
|
258
|
-
children: [sidebar && wide ? doc ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
259
|
-
style: stickyRail(12),
|
|
260
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Sidebar, {
|
|
261
|
-
...sidebar
|
|
262
|
-
})
|
|
263
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Sidebar, {
|
|
264
|
-
...sidebar
|
|
265
|
-
}) : null, sidebar && isOpen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_portal.Portal, {
|
|
266
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_index.OverlayRoot, {
|
|
267
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Backdrop, {
|
|
268
|
-
onPress: () => setOpen(false),
|
|
269
|
-
blurIntensity: 0,
|
|
270
|
-
dimOpacity: 0.4,
|
|
271
|
-
accessibilityLabel: "Close navigation"
|
|
272
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
273
|
-
pointerEvents: "box-none",
|
|
244
|
+
}) : null, sidebar && !wide ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
245
|
+
"aria-hidden": !isOpen,
|
|
246
|
+
pointerEvents: isOpen ? 'auto' : 'none'
|
|
247
|
+
// Fixed on web in document mode: the rail waits beneath the VIEWPORT,
|
|
248
|
+
// wherever the page is scrolled to.
|
|
249
|
+
,
|
|
274
250
|
style: {
|
|
275
|
-
position: 'absolute',
|
|
251
|
+
position: doc ? _webViewStyle.WEB_POSITION_FIXED : 'absolute',
|
|
276
252
|
top: 0,
|
|
277
253
|
bottom: 0,
|
|
278
254
|
left: 0,
|
|
279
|
-
|
|
280
|
-
|
|
255
|
+
width: 272,
|
|
256
|
+
paddingTop: 12,
|
|
257
|
+
paddingBottom: 12,
|
|
258
|
+
paddingLeft: 6
|
|
281
259
|
},
|
|
282
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
260
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
261
|
+
style: [{
|
|
262
|
+
height: '100%',
|
|
263
|
+
width: 260,
|
|
264
|
+
transformOrigin: 'left center'
|
|
265
|
+
}, railStyle],
|
|
287
266
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Sidebar, {
|
|
288
267
|
...drawerSidebar,
|
|
289
268
|
mobile: true,
|
|
269
|
+
flat: true,
|
|
290
270
|
onClose: () => setOpen(false)
|
|
291
271
|
})
|
|
292
272
|
})
|
|
293
|
-
})
|
|
273
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNativeReanimated.default.View, {
|
|
274
|
+
style: [{
|
|
275
|
+
flex: 1,
|
|
276
|
+
minWidth: 0,
|
|
277
|
+
flexDirection: 'row',
|
|
278
|
+
overflow: doc ? _webViewStyle.WEB_OVERFLOW_CLIP : 'hidden',
|
|
279
|
+
backgroundColor: background
|
|
280
|
+
}, wide ? null : pageStyle],
|
|
281
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Scroller, {
|
|
282
|
+
mode: mode,
|
|
283
|
+
style: {
|
|
284
|
+
flex: doc ? undefined : 1,
|
|
285
|
+
flexGrow: 1,
|
|
286
|
+
minWidth: 0
|
|
287
|
+
},
|
|
288
|
+
contentStyle: {
|
|
289
|
+
padding: 12,
|
|
290
|
+
paddingTop: small ? 24 : 12
|
|
291
|
+
},
|
|
292
|
+
children: column
|
|
293
|
+
}), asideColumn({
|
|
294
|
+
paddingTop: small ? 24 : 12,
|
|
295
|
+
paddingBottom: 12,
|
|
296
|
+
paddingRight: 12
|
|
297
|
+
}), !wide ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
298
|
+
pointerEvents: isOpen ? 'auto' : 'none',
|
|
299
|
+
style: [{
|
|
300
|
+
position: 'absolute',
|
|
301
|
+
top: 0,
|
|
302
|
+
left: 0,
|
|
303
|
+
right: 0,
|
|
304
|
+
bottom: 0
|
|
305
|
+
}, veilStyle],
|
|
306
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
307
|
+
role: "button",
|
|
308
|
+
accessibilityLabel: "Close navigation",
|
|
309
|
+
focusable: isOpen,
|
|
310
|
+
onPress: () => setOpen(false),
|
|
311
|
+
style: {
|
|
312
|
+
flex: 1,
|
|
313
|
+
backgroundColor: theme.isDark ? 'rgba(255, 255, 255, 0.05)' : 'rgba(0, 0, 0, 0.1)'
|
|
314
|
+
},
|
|
315
|
+
testID: testID ? `${testID}-veil` : undefined
|
|
316
|
+
})
|
|
317
|
+
}) : null]
|
|
318
|
+
}), overlay]
|
|
294
319
|
})
|
|
295
|
-
})
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.AppShellProvider, {
|
|
323
|
+
value: shell,
|
|
324
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
325
|
+
testID: testID,
|
|
326
|
+
style: [frame, {
|
|
327
|
+
flexDirection: 'row',
|
|
328
|
+
gap: 16,
|
|
329
|
+
padding: 12,
|
|
300
330
|
backgroundColor: background
|
|
301
|
-
},
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
331
|
+
}, style],
|
|
332
|
+
children: [sidebar && wide ? doc ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
333
|
+
style: stickyRail(12),
|
|
334
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Sidebar, {
|
|
335
|
+
...sidebar
|
|
336
|
+
})
|
|
337
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Sidebar, {
|
|
338
|
+
...sidebar
|
|
339
|
+
}) : null, sidebar && isOpen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_portal.Portal, {
|
|
340
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_index.OverlayRoot, {
|
|
341
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Backdrop, {
|
|
342
|
+
onPress: () => setOpen(false),
|
|
343
|
+
blurIntensity: 0,
|
|
344
|
+
dimOpacity: 0.4,
|
|
345
|
+
accessibilityLabel: "Close navigation"
|
|
346
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
347
|
+
pointerEvents: "box-none",
|
|
348
|
+
style: {
|
|
349
|
+
position: 'absolute',
|
|
350
|
+
top: 0,
|
|
351
|
+
bottom: 0,
|
|
352
|
+
left: 0,
|
|
353
|
+
flexDirection: 'row',
|
|
354
|
+
padding: 12
|
|
355
|
+
},
|
|
356
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
357
|
+
pointerEvents: "auto",
|
|
358
|
+
style: {
|
|
359
|
+
height: '100%'
|
|
360
|
+
},
|
|
361
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Sidebar, {
|
|
362
|
+
...drawerSidebar,
|
|
363
|
+
mobile: true,
|
|
364
|
+
onClose: () => setOpen(false)
|
|
365
|
+
})
|
|
366
|
+
})
|
|
367
|
+
})]
|
|
368
|
+
})
|
|
369
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(Scroller, {
|
|
370
|
+
mode: mode,
|
|
371
|
+
style: {
|
|
372
|
+
flex: 1,
|
|
373
|
+
minWidth: 0,
|
|
374
|
+
backgroundColor: background
|
|
375
|
+
},
|
|
376
|
+
contentStyle: {
|
|
377
|
+
paddingTop: small ? 12 : 0
|
|
378
|
+
},
|
|
379
|
+
children: column
|
|
380
|
+
}), asideColumn({}), overlay]
|
|
381
|
+
})
|
|
307
382
|
});
|
|
308
383
|
};
|
|
309
384
|
|
|
@@ -318,11 +393,28 @@ const documentRoot = {
|
|
|
318
393
|
flexGrow: 1,
|
|
319
394
|
minHeight: _webViewStyle.WEB_VIEWPORT_HEIGHT
|
|
320
395
|
};
|
|
321
|
-
//
|
|
322
|
-
//
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
396
|
+
// (Under `reveal` the document root also takes `overflow: clip`: the page slides
|
|
397
|
+
// 272 right, and `clip` keeps that from widening the document with a horizontal
|
|
398
|
+
// scrollbar without becoming a scroll container.)
|
|
399
|
+
|
|
400
|
+
/** Container mode: fill the parent, scroll inside. */
|
|
401
|
+
const containerRoot = {
|
|
402
|
+
flex: 1,
|
|
403
|
+
height: '100%',
|
|
404
|
+
overflow: 'hidden'
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Fixed mode: exactly one screen — `100dvh` on web, the parent on native — and
|
|
409
|
+
* nothing scrolls; the content fills the height left under the header.
|
|
410
|
+
*/
|
|
411
|
+
const fixedRoot = _reactNative.Platform.OS === 'web' ? {
|
|
412
|
+
height: _webViewStyle.WEB_VIEWPORT_HEIGHT,
|
|
413
|
+
overflow: 'hidden'
|
|
414
|
+
} : {
|
|
415
|
+
flex: 1,
|
|
416
|
+
height: '100%',
|
|
417
|
+
overflow: 'hidden'
|
|
326
418
|
};
|
|
327
419
|
|
|
328
420
|
/** The in-flow rail, pinned to the viewport while the document scrolls under it. */
|