@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
|
@@ -10,6 +10,7 @@ var _reactNative = require("react-native");
|
|
|
10
10
|
var _index = require("../badge/index.js");
|
|
11
11
|
var _palette = require("./palette.js");
|
|
12
12
|
var _parts = require("./parts.js");
|
|
13
|
+
var _SidebarLogoView = require("./SidebarLogoView.js");
|
|
13
14
|
var _SidebarRailItem = require("./SidebarRailItem.js");
|
|
14
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -22,12 +23,14 @@ const SIDEBAR_RAIL_WIDTH = exports.SIDEBAR_RAIL_WIDTH = 80;
|
|
|
22
23
|
* panel 80 wide, full height, background-full, no chrome
|
|
23
24
|
* items centred vertically in a scroller (px 8, py 24, gap 8), one
|
|
24
25
|
* `SidebarRailItem` per row
|
|
26
|
+
* logo the mark only, centred at the top (pt 24), when `logo` is given
|
|
25
27
|
* secondary pinned to the foot (px 8, pb 24, gap 8)
|
|
26
28
|
*
|
|
27
|
-
* The rail carries navigation only: account, team, plan, tree, quick search and
|
|
29
|
+
* The rail carries navigation and the logo's mark only: account, team, plan, tree, quick search and
|
|
28
30
|
* the theme toggle belong to the panel variant and are not rendered here.
|
|
29
31
|
*/
|
|
30
32
|
function SidebarRail({
|
|
33
|
+
logo,
|
|
31
34
|
items = [],
|
|
32
35
|
secondaryItems = [],
|
|
33
36
|
selected,
|
|
@@ -69,7 +72,18 @@ function SidebarRail({
|
|
|
69
72
|
flexDirection: 'column',
|
|
70
73
|
backgroundColor: palette.flat
|
|
71
74
|
}, style],
|
|
72
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.
|
|
75
|
+
children: [logo ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
76
|
+
style: {
|
|
77
|
+
flexShrink: 0,
|
|
78
|
+
alignItems: 'center',
|
|
79
|
+
paddingTop: 24
|
|
80
|
+
},
|
|
81
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SidebarLogoView.SidebarLogoView, {
|
|
82
|
+
logo: logo,
|
|
83
|
+
showWordmark: false,
|
|
84
|
+
testID: "sidebar-logo"
|
|
85
|
+
})
|
|
86
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
|
|
73
87
|
...(_parts.IS_WEB ? {
|
|
74
88
|
dataSet: {
|
|
75
89
|
bloomSidebarScroll: 'none'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_index","_palette","_parts","_SidebarRailItem","_jsxRuntime","e","__esModule","default","SIDEBAR_RAIL_WIDTH","exports","SidebarRail","items","secondaryItems","selected","onNavigate","style","testID","palette","useSidebarPalette","renderItem","item","isSelected","key","onPress","href","undefined","jsx","SidebarRailItem","icon","activeIcon","label","badge","Badge","content","backgroundColor","badgePrimary","badgeNeutral","textStyle","color","textSecondary","jsxs","View","role","accessibilityLabel","width","height","flexShrink","flexDirection","flat","children","ScrollView","IS_WEB","dataSet","bloomSidebarScroll","flex","contentContainerStyle","flexGrow","justifyContent","paddingLeft","paddingRight","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_index","_palette","_parts","_SidebarLogoView","_SidebarRailItem","_jsxRuntime","e","__esModule","default","SIDEBAR_RAIL_WIDTH","exports","SidebarRail","logo","items","secondaryItems","selected","onNavigate","style","testID","palette","useSidebarPalette","renderItem","item","isSelected","key","onPress","href","undefined","jsx","SidebarRailItem","icon","activeIcon","label","badge","Badge","content","backgroundColor","badgePrimary","badgeNeutral","textStyle","color","textSecondary","jsxs","View","role","accessibilityLabel","width","height","flexShrink","flexDirection","flat","children","alignItems","paddingTop","SidebarLogoView","showWordmark","ScrollView","IS_WEB","dataSet","bloomSidebarScroll","flex","contentContainerStyle","flexGrow","justifyContent","paddingLeft","paddingRight","paddingBottom","gap","showsVerticalScrollIndicator","map","length"],"sourceRoot":"../../../src","sources":["sidebar/SidebarRail.tsx"],"mappings":"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","ignoreList":[]}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WEB_POSITION_STICKY = exports.WEB_POSITION_FIXED = void 0;
|
|
6
|
+
exports.WEB_VIEWPORT_HEIGHT = exports.WEB_POSITION_STICKY = exports.WEB_POSITION_FIXED = exports.WEB_OVERFLOW_CLIP = void 0;
|
|
7
|
+
exports.webViewportHeightMinus = webViewportHeightMinus;
|
|
7
8
|
/**
|
|
8
9
|
* `position: fixed`, typed for React Native's `ViewStyle`.
|
|
9
10
|
*
|
|
@@ -34,6 +35,29 @@ const WEB_POSITION_FIXED = exports.WEB_POSITION_FIXED = 'fixed';
|
|
|
34
35
|
*/
|
|
35
36
|
const WEB_POSITION_STICKY = exports.WEB_POSITION_STICKY = 'sticky';
|
|
36
37
|
|
|
38
|
+
/**
|
|
39
|
+
* One viewport of height (`100dvh`), and one viewport minus a vertical inset,
|
|
40
|
+
* typed for React Native's `ViewStyle`. Same kind of gap as
|
|
41
|
+
* {@link WEB_POSITION_FIXED}: RN types lengths as a number or a percentage,
|
|
42
|
+
* while react-native-web passes any CSS length through. A percentage cannot say
|
|
43
|
+
* this in a page that scrolls the DOCUMENT — a percentage height needs a
|
|
44
|
+
* definite ancestor height, and an auto-height document-flow ancestor never has
|
|
45
|
+
* one. `dvh` rather than `vh` so a mobile browser's collapsing toolbar is not
|
|
46
|
+
* counted as viewport.
|
|
47
|
+
*/
|
|
48
|
+
const WEB_VIEWPORT_HEIGHT = exports.WEB_VIEWPORT_HEIGHT = '100dvh';
|
|
49
|
+
function webViewportHeightMinus(px) {
|
|
50
|
+
return `calc(100dvh - ${px}px)`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* `overflow: clip`, typed for React Native's `ViewStyle`. Clips like `hidden`
|
|
55
|
+
* without making the element a SCROLL CONTAINER — so a `position: sticky`
|
|
56
|
+
* descendant still sticks to the document instead of to a box that never
|
|
57
|
+
* scrolls.
|
|
58
|
+
*/
|
|
59
|
+
const WEB_OVERFLOW_CLIP = exports.WEB_OVERFLOW_CLIP = 'clip';
|
|
60
|
+
|
|
37
61
|
/**
|
|
38
62
|
* A `ViewStyle` that may ALSO carry CSS react-native-web forwards straight to the
|
|
39
63
|
* DOM node but React Native does not model at all.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["WEB_POSITION_FIXED","exports","WEB_POSITION_STICKY"],"sourceRoot":"../../../src","sources":["styles/web-view-style.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["WEB_POSITION_FIXED","exports","WEB_POSITION_STICKY","WEB_VIEWPORT_HEIGHT","webViewportHeightMinus","px","WEB_OVERFLOW_CLIP"],"sourceRoot":"../../../src","sources":["styles/web-view-style.ts"],"mappings":";;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,OAAgC;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,mBAAmB,GAAAD,OAAA,CAAAC,mBAAA,GAAG,QAAiC;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,mBAAmB,GAAAF,OAAA,CAAAE,mBAAA,GAAG,QAA+B;AAC3D,SAASC,sBAAsBA,CAACC,EAAU,EAAuB;EACtE,OAAO,iBAAiBA,EAAE,KAAK;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,iBAAiB,GAAAL,OAAA,CAAAK,iBAAA,GAAG,MAA+B;;AAEhE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import React, { memo, useEffect } from 'react';
|
|
4
|
-
import { Pressable, ScrollView, View, useWindowDimensions } from 'react-native';
|
|
3
|
+
import React, { memo, useEffect, useMemo } from 'react';
|
|
4
|
+
import { Platform, Pressable, ScrollView, View, useWindowDimensions } from 'react-native';
|
|
5
5
|
import Animated, { Easing, useAnimatedStyle, useReducedMotion, useSharedValue, withTiming } from 'react-native-reanimated';
|
|
6
6
|
import { resolveButtonRamps, mixColor } from "../button/shared.js";
|
|
7
7
|
import { useControllableState } from "../hooks/use-controllable-state.js";
|
|
@@ -9,22 +9,29 @@ import { Backdrop, OverlayRoot } from "../overlay/index.js";
|
|
|
9
9
|
import { Portal } from '../portal';
|
|
10
10
|
import { Sidebar } from "../sidebar/index.js";
|
|
11
11
|
import { BREAKPOINTS } from "../styles/breakpoints.js";
|
|
12
|
+
import { WEB_OVERFLOW_CLIP, WEB_POSITION_FIXED, WEB_POSITION_STICKY, WEB_VIEWPORT_HEIGHT, webViewportHeightMinus } from "../styles/web-view-style.js";
|
|
12
13
|
import { useTheme } from "../theme/use-theme.js";
|
|
13
14
|
import { AppShellHeader } from "./AppShellHeader.js";
|
|
15
|
+
import { AppShellProvider } from "./context.js";
|
|
14
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
17
|
/**
|
|
16
18
|
* The page frame: a starter shell and a dashboard shell, combined into one
|
|
17
19
|
* component.
|
|
18
20
|
*
|
|
19
|
-
* root row,
|
|
21
|
+
* root row, background-full; one screen tall at least (document
|
|
22
|
+
* scroll), exactly (`fixed`), or its parent's height (`container`)
|
|
20
23
|
* lg and up the sidebar in flow (from `sm` for `variant: 'rail'`, whose
|
|
21
24
|
* drawer below `sm` opens the panel); `overlay` pads the whole frame 12 with a
|
|
22
25
|
* 16 gap, `reveal` sits the rail 12 from the top-left
|
|
23
|
-
* main scrolls
|
|
26
|
+
* main scrolls — on web the DOCUMENT (see `scroll`), elsewhere its own
|
|
27
|
+
* ScrollView; the content column is centred, max 1300, gap 10:
|
|
24
28
|
* header (breadcrumb + title row), then the content (gap 16,
|
|
25
29
|
* 16 below). `overlay` insets the column 12 from the top at `sm`,
|
|
26
30
|
* `reveal` pads the page 12 (24 on top at `sm`)
|
|
27
|
-
*
|
|
31
|
+
* aside optional right column, `asideWidth` (320) wide from `asideFrom`
|
|
32
|
+
* (xl), pinned like the rail; below it stacked after the content
|
|
33
|
+
* below lg the header grows a hamburger (also with no title — see
|
|
34
|
+
* `useAppShell` / `AppShellMenuButton`). `overlay` opens the rail as a
|
|
28
35
|
* drawer (12 inset) over a 40% black backdrop; `reveal` slides
|
|
29
36
|
* the page 272 right and rounds it to 32 while the rail, flat
|
|
30
37
|
* beneath it, scales up from 0.94 and fades in (325ms,
|
|
@@ -35,6 +42,38 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
35
42
|
const REVEAL_EASE = Easing.bezier(0.42, 0, 0.58, 1);
|
|
36
43
|
const REVEAL_MS = 325;
|
|
37
44
|
const REVEAL_OFFSET = 272;
|
|
45
|
+
/**
|
|
46
|
+
* The page's scroller. `document`: a plain box, the page grows the document.
|
|
47
|
+
* `fixed`: a plain box that fills the frame's height and never scrolls — the
|
|
48
|
+
* page owns its scrolling. `container`: a `ScrollView` filling the frame.
|
|
49
|
+
*/
|
|
50
|
+
function Scroller({
|
|
51
|
+
mode,
|
|
52
|
+
style,
|
|
53
|
+
contentStyle,
|
|
54
|
+
children
|
|
55
|
+
}) {
|
|
56
|
+
if (mode === 'document') return /*#__PURE__*/_jsx(View, {
|
|
57
|
+
style: [style, contentStyle],
|
|
58
|
+
children: children
|
|
59
|
+
});
|
|
60
|
+
if (mode === 'fixed') {
|
|
61
|
+
return /*#__PURE__*/_jsx(View, {
|
|
62
|
+
style: [{
|
|
63
|
+
flex: 1,
|
|
64
|
+
minHeight: 0
|
|
65
|
+
}, style, contentStyle],
|
|
66
|
+
children: children
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return /*#__PURE__*/_jsx(ScrollView, {
|
|
70
|
+
style: [{
|
|
71
|
+
flex: 1
|
|
72
|
+
}, style],
|
|
73
|
+
contentContainerStyle: contentStyle,
|
|
74
|
+
children: children
|
|
75
|
+
});
|
|
76
|
+
}
|
|
38
77
|
const AppShellComponent = ({
|
|
39
78
|
sidebar,
|
|
40
79
|
drawer = 'overlay',
|
|
@@ -42,11 +81,16 @@ const AppShellComponent = ({
|
|
|
42
81
|
breadcrumb,
|
|
43
82
|
actions,
|
|
44
83
|
header,
|
|
84
|
+
aside,
|
|
85
|
+
asideWidth = 320,
|
|
86
|
+
asideFrom = 'xl',
|
|
87
|
+
asideCollapse = 'stack',
|
|
45
88
|
children,
|
|
46
89
|
contentMaxWidth = 1300,
|
|
47
90
|
overlay,
|
|
48
91
|
drawerOpen,
|
|
49
92
|
onDrawerOpenChange,
|
|
93
|
+
scroll = 'document',
|
|
50
94
|
style,
|
|
51
95
|
testID
|
|
52
96
|
}) => {
|
|
@@ -54,10 +98,16 @@ const AppShellComponent = ({
|
|
|
54
98
|
const {
|
|
55
99
|
width
|
|
56
100
|
} = useWindowDimensions();
|
|
101
|
+
// Native has no document: `document` falls back to `container` there.
|
|
102
|
+
const mode = scroll === 'document' && Platform.OS !== 'web' ? 'container' : scroll;
|
|
103
|
+
const doc = mode === 'document';
|
|
104
|
+
const fixed = mode === 'fixed';
|
|
57
105
|
const small = width >= BREAKPOINTS.sm;
|
|
58
106
|
// The rail is narrow enough to stay in flow from `sm`; the panel needs `lg`.
|
|
59
107
|
const rail = sidebar?.variant === 'rail';
|
|
60
108
|
const wide = rail ? small : width >= BREAKPOINTS.lg;
|
|
109
|
+
const asideBeside = aside != null && width >= BREAKPOINTS[asideFrom];
|
|
110
|
+
const asideStacked = aside != null && !asideBeside && asideCollapse === 'stack';
|
|
61
111
|
// The drawer always opens the full panel, whatever the in-flow variant.
|
|
62
112
|
const drawerSidebar = sidebar ? {
|
|
63
113
|
...sidebar,
|
|
@@ -69,7 +119,15 @@ const AppShellComponent = ({
|
|
|
69
119
|
defaultValue: false,
|
|
70
120
|
onChange: onDrawerOpenChange
|
|
71
121
|
});
|
|
72
|
-
const
|
|
122
|
+
const drawerAvailable = !!sidebar && !wide;
|
|
123
|
+
const isOpen = open && drawerAvailable;
|
|
124
|
+
const shell = useMemo(() => ({
|
|
125
|
+
drawerAvailable,
|
|
126
|
+
drawerOpen: isOpen,
|
|
127
|
+
openDrawer: () => setOpen(true),
|
|
128
|
+
closeDrawer: () => setOpen(false),
|
|
129
|
+
toggleDrawer: () => setOpen(!isOpen)
|
|
130
|
+
}), [drawerAvailable, isOpen, setOpen]);
|
|
73
131
|
const {
|
|
74
132
|
neutral: n
|
|
75
133
|
} = resolveButtonRamps(theme);
|
|
@@ -97,172 +155,273 @@ const AppShellComponent = ({
|
|
|
97
155
|
const veilStyle = useAnimatedStyle(() => ({
|
|
98
156
|
opacity: reveal.value
|
|
99
157
|
}), [reveal]);
|
|
100
|
-
|
|
158
|
+
|
|
159
|
+
// The default header renders whenever it has something to show — a menu
|
|
160
|
+
// button alone counts, so a page without a title can still open the drawer.
|
|
161
|
+
const headerNode = header ?? (title != null || breadcrumb != null || actions != null || drawerAvailable ? /*#__PURE__*/_jsx(AppShellHeader, {
|
|
101
162
|
title: title,
|
|
102
163
|
breadcrumb: breadcrumb,
|
|
103
164
|
actions: actions,
|
|
104
165
|
menuOpen: isOpen,
|
|
105
|
-
onMenuPress:
|
|
166
|
+
onMenuPress: drawerAvailable ? shell.toggleDrawer : undefined,
|
|
106
167
|
testID: testID ? `${testID}-header` : undefined
|
|
107
168
|
}) : null);
|
|
169
|
+
const fill = fixed ? {
|
|
170
|
+
flex: 1,
|
|
171
|
+
minHeight: 0
|
|
172
|
+
} : null;
|
|
108
173
|
const column = /*#__PURE__*/_jsxs(View, {
|
|
109
|
-
style: {
|
|
174
|
+
style: [{
|
|
110
175
|
width: '100%',
|
|
111
176
|
maxWidth: contentMaxWidth,
|
|
112
177
|
alignSelf: 'center',
|
|
113
178
|
gap: 10
|
|
114
|
-
},
|
|
115
|
-
children: [headerNode, /*#__PURE__*/
|
|
116
|
-
style: {
|
|
179
|
+
}, fill],
|
|
180
|
+
children: [headerNode, /*#__PURE__*/_jsxs(View, {
|
|
181
|
+
style: [{
|
|
117
182
|
width: '100%',
|
|
118
183
|
gap: 16,
|
|
119
184
|
paddingBottom: drawer === 'overlay' ? 16 : 0
|
|
120
|
-
},
|
|
121
|
-
children: children
|
|
185
|
+
}, fill],
|
|
186
|
+
children: [children, asideStacked ? /*#__PURE__*/_jsx(View, {
|
|
187
|
+
testID: testID ? `${testID}-aside` : undefined,
|
|
188
|
+
children: aside
|
|
189
|
+
}) : null]
|
|
122
190
|
})]
|
|
123
191
|
});
|
|
192
|
+
|
|
193
|
+
// Beside the content: sticky and self-scrolling with document scroll, a
|
|
194
|
+
// full-height scroller otherwise.
|
|
195
|
+
const asideColumn = inset => asideBeside ? /*#__PURE__*/_jsx(View, {
|
|
196
|
+
testID: testID ? `${testID}-aside` : undefined,
|
|
197
|
+
style: [{
|
|
198
|
+
width: asideWidth,
|
|
199
|
+
flexShrink: 0
|
|
200
|
+
}, doc ? {
|
|
201
|
+
...stickyRail(12),
|
|
202
|
+
width: asideWidth
|
|
203
|
+
} : {
|
|
204
|
+
alignSelf: 'stretch'
|
|
205
|
+
}, inset],
|
|
206
|
+
children: /*#__PURE__*/_jsx(ScrollView, {
|
|
207
|
+
style: {
|
|
208
|
+
flex: 1
|
|
209
|
+
},
|
|
210
|
+
contentContainerStyle: {
|
|
211
|
+
flexGrow: 1
|
|
212
|
+
},
|
|
213
|
+
showsVerticalScrollIndicator: false,
|
|
214
|
+
children: aside
|
|
215
|
+
})
|
|
216
|
+
}) : null;
|
|
217
|
+
const frame = doc ? documentRoot : fixed ? fixedRoot : containerRoot;
|
|
124
218
|
if (drawer === 'reveal') {
|
|
125
|
-
return /*#__PURE__*/
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}, style],
|
|
134
|
-
children: [sidebar && wide ? /*#__PURE__*/_jsx(View, {
|
|
135
|
-
style: {
|
|
136
|
-
paddingTop: 12,
|
|
137
|
-
paddingBottom: 12,
|
|
138
|
-
paddingLeft: 12,
|
|
139
|
-
flexShrink: 0
|
|
140
|
-
},
|
|
141
|
-
children: /*#__PURE__*/_jsx(Sidebar, {
|
|
142
|
-
...sidebar
|
|
143
|
-
})
|
|
144
|
-
}) : null, sidebar && !wide ? /*#__PURE__*/_jsx(View, {
|
|
145
|
-
"aria-hidden": !isOpen,
|
|
146
|
-
pointerEvents: isOpen ? 'auto' : 'none',
|
|
147
|
-
style: {
|
|
148
|
-
position: 'absolute',
|
|
149
|
-
top: 0,
|
|
150
|
-
bottom: 0,
|
|
151
|
-
left: 0,
|
|
152
|
-
width: 272,
|
|
153
|
-
paddingTop: 12,
|
|
154
|
-
paddingBottom: 12,
|
|
155
|
-
paddingLeft: 6
|
|
156
|
-
},
|
|
157
|
-
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
158
|
-
style: [{
|
|
159
|
-
height: '100%',
|
|
160
|
-
width: 260,
|
|
161
|
-
transformOrigin: 'left center'
|
|
162
|
-
}, railStyle],
|
|
163
|
-
children: /*#__PURE__*/_jsx(Sidebar, {
|
|
164
|
-
...drawerSidebar,
|
|
165
|
-
mobile: true,
|
|
166
|
-
flat: true,
|
|
167
|
-
onClose: () => setOpen(false)
|
|
168
|
-
})
|
|
169
|
-
})
|
|
170
|
-
}) : null, /*#__PURE__*/_jsxs(Animated.View, {
|
|
171
|
-
style: [{
|
|
172
|
-
flex: 1,
|
|
173
|
-
minWidth: 0,
|
|
174
|
-
overflow: 'hidden',
|
|
219
|
+
return /*#__PURE__*/_jsx(AppShellProvider, {
|
|
220
|
+
value: shell,
|
|
221
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
222
|
+
testID: testID,
|
|
223
|
+
style: [frame, doc ? {
|
|
224
|
+
overflow: WEB_OVERFLOW_CLIP
|
|
225
|
+
} : null, {
|
|
226
|
+
flexDirection: 'row',
|
|
175
227
|
backgroundColor: background
|
|
176
|
-
},
|
|
177
|
-
children: [/*#__PURE__*/_jsx(
|
|
178
|
-
style: {
|
|
179
|
-
flex: 1
|
|
180
|
-
},
|
|
181
|
-
contentContainerStyle: {
|
|
182
|
-
padding: 12,
|
|
183
|
-
paddingTop: small ? 24 : 12
|
|
184
|
-
},
|
|
185
|
-
children: column
|
|
186
|
-
}), !wide ? /*#__PURE__*/_jsx(Animated.View, {
|
|
187
|
-
pointerEvents: isOpen ? 'auto' : 'none',
|
|
228
|
+
}, style],
|
|
229
|
+
children: [sidebar && wide ? /*#__PURE__*/_jsx(View, {
|
|
188
230
|
style: [{
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
role: "button",
|
|
197
|
-
accessibilityLabel: "Close navigation",
|
|
198
|
-
focusable: isOpen,
|
|
199
|
-
onPress: () => setOpen(false),
|
|
200
|
-
style: {
|
|
201
|
-
flex: 1,
|
|
202
|
-
backgroundColor: theme.isDark ? 'rgba(255, 255, 255, 0.05)' : 'rgba(0, 0, 0, 0.1)'
|
|
203
|
-
},
|
|
204
|
-
testID: testID ? `${testID}-veil` : undefined
|
|
231
|
+
paddingTop: 12,
|
|
232
|
+
paddingBottom: 12,
|
|
233
|
+
paddingLeft: 12,
|
|
234
|
+
flexShrink: 0
|
|
235
|
+
}, doc ? stickyRail(0) : null],
|
|
236
|
+
children: /*#__PURE__*/_jsx(Sidebar, {
|
|
237
|
+
...sidebar
|
|
205
238
|
})
|
|
206
|
-
}) : null
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
style: [{
|
|
213
|
-
flex: 1,
|
|
214
|
-
height: '100%',
|
|
215
|
-
flexDirection: 'row',
|
|
216
|
-
gap: 16,
|
|
217
|
-
overflow: 'hidden',
|
|
218
|
-
padding: 12,
|
|
219
|
-
backgroundColor: background
|
|
220
|
-
}, style],
|
|
221
|
-
children: [sidebar && wide ? /*#__PURE__*/_jsx(Sidebar, {
|
|
222
|
-
...sidebar
|
|
223
|
-
}) : null, sidebar && isOpen ? /*#__PURE__*/_jsx(Portal, {
|
|
224
|
-
children: /*#__PURE__*/_jsxs(OverlayRoot, {
|
|
225
|
-
children: [/*#__PURE__*/_jsx(Backdrop, {
|
|
226
|
-
onPress: () => setOpen(false),
|
|
227
|
-
blurIntensity: 0,
|
|
228
|
-
dimOpacity: 0.4,
|
|
229
|
-
accessibilityLabel: "Close navigation"
|
|
230
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
231
|
-
pointerEvents: "box-none",
|
|
239
|
+
}) : null, sidebar && !wide ? /*#__PURE__*/_jsx(View, {
|
|
240
|
+
"aria-hidden": !isOpen,
|
|
241
|
+
pointerEvents: isOpen ? 'auto' : 'none'
|
|
242
|
+
// Fixed on web in document mode: the rail waits beneath the VIEWPORT,
|
|
243
|
+
// wherever the page is scrolled to.
|
|
244
|
+
,
|
|
232
245
|
style: {
|
|
233
|
-
position: 'absolute',
|
|
246
|
+
position: doc ? WEB_POSITION_FIXED : 'absolute',
|
|
234
247
|
top: 0,
|
|
235
248
|
bottom: 0,
|
|
236
249
|
left: 0,
|
|
237
|
-
|
|
238
|
-
|
|
250
|
+
width: 272,
|
|
251
|
+
paddingTop: 12,
|
|
252
|
+
paddingBottom: 12,
|
|
253
|
+
paddingLeft: 6
|
|
239
254
|
},
|
|
240
|
-
children: /*#__PURE__*/_jsx(View, {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
255
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
256
|
+
style: [{
|
|
257
|
+
height: '100%',
|
|
258
|
+
width: 260,
|
|
259
|
+
transformOrigin: 'left center'
|
|
260
|
+
}, railStyle],
|
|
245
261
|
children: /*#__PURE__*/_jsx(Sidebar, {
|
|
246
262
|
...drawerSidebar,
|
|
247
263
|
mobile: true,
|
|
264
|
+
flat: true,
|
|
248
265
|
onClose: () => setOpen(false)
|
|
249
266
|
})
|
|
250
267
|
})
|
|
251
|
-
})
|
|
268
|
+
}) : null, /*#__PURE__*/_jsxs(Animated.View, {
|
|
269
|
+
style: [{
|
|
270
|
+
flex: 1,
|
|
271
|
+
minWidth: 0,
|
|
272
|
+
flexDirection: 'row',
|
|
273
|
+
overflow: doc ? WEB_OVERFLOW_CLIP : 'hidden',
|
|
274
|
+
backgroundColor: background
|
|
275
|
+
}, wide ? null : pageStyle],
|
|
276
|
+
children: [/*#__PURE__*/_jsx(Scroller, {
|
|
277
|
+
mode: mode,
|
|
278
|
+
style: {
|
|
279
|
+
flex: doc ? undefined : 1,
|
|
280
|
+
flexGrow: 1,
|
|
281
|
+
minWidth: 0
|
|
282
|
+
},
|
|
283
|
+
contentStyle: {
|
|
284
|
+
padding: 12,
|
|
285
|
+
paddingTop: small ? 24 : 12
|
|
286
|
+
},
|
|
287
|
+
children: column
|
|
288
|
+
}), asideColumn({
|
|
289
|
+
paddingTop: small ? 24 : 12,
|
|
290
|
+
paddingBottom: 12,
|
|
291
|
+
paddingRight: 12
|
|
292
|
+
}), !wide ? /*#__PURE__*/_jsx(Animated.View, {
|
|
293
|
+
pointerEvents: isOpen ? 'auto' : 'none',
|
|
294
|
+
style: [{
|
|
295
|
+
position: 'absolute',
|
|
296
|
+
top: 0,
|
|
297
|
+
left: 0,
|
|
298
|
+
right: 0,
|
|
299
|
+
bottom: 0
|
|
300
|
+
}, veilStyle],
|
|
301
|
+
children: /*#__PURE__*/_jsx(Pressable, {
|
|
302
|
+
role: "button",
|
|
303
|
+
accessibilityLabel: "Close navigation",
|
|
304
|
+
focusable: isOpen,
|
|
305
|
+
onPress: () => setOpen(false),
|
|
306
|
+
style: {
|
|
307
|
+
flex: 1,
|
|
308
|
+
backgroundColor: theme.isDark ? 'rgba(255, 255, 255, 0.05)' : 'rgba(0, 0, 0, 0.1)'
|
|
309
|
+
},
|
|
310
|
+
testID: testID ? `${testID}-veil` : undefined
|
|
311
|
+
})
|
|
312
|
+
}) : null]
|
|
313
|
+
}), overlay]
|
|
252
314
|
})
|
|
253
|
-
})
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
return /*#__PURE__*/_jsx(AppShellProvider, {
|
|
318
|
+
value: shell,
|
|
319
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
320
|
+
testID: testID,
|
|
321
|
+
style: [frame, {
|
|
322
|
+
flexDirection: 'row',
|
|
323
|
+
gap: 16,
|
|
324
|
+
padding: 12,
|
|
257
325
|
backgroundColor: background
|
|
258
|
-
},
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
326
|
+
}, style],
|
|
327
|
+
children: [sidebar && wide ? doc ? /*#__PURE__*/_jsx(View, {
|
|
328
|
+
style: stickyRail(12),
|
|
329
|
+
children: /*#__PURE__*/_jsx(Sidebar, {
|
|
330
|
+
...sidebar
|
|
331
|
+
})
|
|
332
|
+
}) : /*#__PURE__*/_jsx(Sidebar, {
|
|
333
|
+
...sidebar
|
|
334
|
+
}) : null, sidebar && isOpen ? /*#__PURE__*/_jsx(Portal, {
|
|
335
|
+
children: /*#__PURE__*/_jsxs(OverlayRoot, {
|
|
336
|
+
children: [/*#__PURE__*/_jsx(Backdrop, {
|
|
337
|
+
onPress: () => setOpen(false),
|
|
338
|
+
blurIntensity: 0,
|
|
339
|
+
dimOpacity: 0.4,
|
|
340
|
+
accessibilityLabel: "Close navigation"
|
|
341
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
342
|
+
pointerEvents: "box-none",
|
|
343
|
+
style: {
|
|
344
|
+
position: 'absolute',
|
|
345
|
+
top: 0,
|
|
346
|
+
bottom: 0,
|
|
347
|
+
left: 0,
|
|
348
|
+
flexDirection: 'row',
|
|
349
|
+
padding: 12
|
|
350
|
+
},
|
|
351
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
352
|
+
pointerEvents: "auto",
|
|
353
|
+
style: {
|
|
354
|
+
height: '100%'
|
|
355
|
+
},
|
|
356
|
+
children: /*#__PURE__*/_jsx(Sidebar, {
|
|
357
|
+
...drawerSidebar,
|
|
358
|
+
mobile: true,
|
|
359
|
+
onClose: () => setOpen(false)
|
|
360
|
+
})
|
|
361
|
+
})
|
|
362
|
+
})]
|
|
363
|
+
})
|
|
364
|
+
}) : null, /*#__PURE__*/_jsx(Scroller, {
|
|
365
|
+
mode: mode,
|
|
366
|
+
style: {
|
|
367
|
+
flex: 1,
|
|
368
|
+
minWidth: 0,
|
|
369
|
+
backgroundColor: background
|
|
370
|
+
},
|
|
371
|
+
contentStyle: {
|
|
372
|
+
paddingTop: small ? 12 : 0
|
|
373
|
+
},
|
|
374
|
+
children: column
|
|
375
|
+
}), asideColumn({}), overlay]
|
|
376
|
+
})
|
|
264
377
|
});
|
|
265
378
|
};
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Document mode: the frame is at least one viewport tall and grows with the
|
|
382
|
+
* page, so the browser scrolls the document (scroll restoration, the address
|
|
383
|
+
* bar collapsing, anchor links, `window.scrollTo`) exactly as it does for a
|
|
384
|
+
* `ContentPanel` page. Nothing here may be a scroll container — no `hidden`
|
|
385
|
+
* overflow — or the sticky rail would stick to a box that never scrolls.
|
|
386
|
+
*/
|
|
387
|
+
const documentRoot = {
|
|
388
|
+
flexGrow: 1,
|
|
389
|
+
minHeight: WEB_VIEWPORT_HEIGHT
|
|
390
|
+
};
|
|
391
|
+
// (Under `reveal` the document root also takes `overflow: clip`: the page slides
|
|
392
|
+
// 272 right, and `clip` keeps that from widening the document with a horizontal
|
|
393
|
+
// scrollbar without becoming a scroll container.)
|
|
394
|
+
|
|
395
|
+
/** Container mode: fill the parent, scroll inside. */
|
|
396
|
+
const containerRoot = {
|
|
397
|
+
flex: 1,
|
|
398
|
+
height: '100%',
|
|
399
|
+
overflow: 'hidden'
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Fixed mode: exactly one screen — `100dvh` on web, the parent on native — and
|
|
404
|
+
* nothing scrolls; the content fills the height left under the header.
|
|
405
|
+
*/
|
|
406
|
+
const fixedRoot = Platform.OS === 'web' ? {
|
|
407
|
+
height: WEB_VIEWPORT_HEIGHT,
|
|
408
|
+
overflow: 'hidden'
|
|
409
|
+
} : {
|
|
410
|
+
flex: 1,
|
|
411
|
+
height: '100%',
|
|
412
|
+
overflow: 'hidden'
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
/** The in-flow rail, pinned to the viewport while the document scrolls under it. */
|
|
416
|
+
function stickyRail(inset) {
|
|
417
|
+
return {
|
|
418
|
+
position: WEB_POSITION_STICKY,
|
|
419
|
+
top: inset,
|
|
420
|
+
height: webViewportHeightMinus(inset * 2),
|
|
421
|
+
alignSelf: 'flex-start',
|
|
422
|
+
flexShrink: 0
|
|
423
|
+
};
|
|
424
|
+
}
|
|
266
425
|
export const AppShell = /*#__PURE__*/memo(AppShellComponent);
|
|
267
426
|
AppShell.displayName = 'AppShell';
|
|
268
427
|
//# sourceMappingURL=AppShell.js.map
|