@xyo-network/react-webapp 2.37.4 → 2.37.5
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/dist/cjs/components/Body.d.ts +2 -1
- package/dist/cjs/components/Body.d.ts.map +1 -1
- package/dist/cjs/components/Body.js +24 -23
- package/dist/cjs/components/Body.js.map +1 -1
- package/dist/cjs/components/Page.d.ts.map +1 -1
- package/dist/cjs/components/Page.js +11 -14
- package/dist/cjs/components/Page.js.map +1 -1
- package/dist/cjs/components/lib/cssValues.d.ts +6 -0
- package/dist/cjs/components/lib/cssValues.d.ts.map +1 -0
- package/dist/cjs/components/lib/cssValues.js +15 -0
- package/dist/cjs/components/lib/cssValues.js.map +1 -0
- package/dist/cjs/components/lib/index.d.ts +2 -0
- package/dist/cjs/components/lib/index.d.ts.map +1 -0
- package/dist/cjs/components/lib/index.js +5 -0
- package/dist/cjs/components/lib/index.js.map +1 -0
- package/dist/docs.json +1950 -1915
- package/dist/esm/components/Body.d.ts +2 -1
- package/dist/esm/components/Body.d.ts.map +1 -1
- package/dist/esm/components/Body.js +29 -23
- package/dist/esm/components/Body.js.map +1 -1
- package/dist/esm/components/Page.d.ts.map +1 -1
- package/dist/esm/components/Page.js +17 -14
- package/dist/esm/components/Page.js.map +1 -1
- package/dist/esm/components/lib/cssValues.d.ts +6 -0
- package/dist/esm/components/lib/cssValues.d.ts.map +1 -0
- package/dist/esm/components/lib/cssValues.js +16 -0
- package/dist/esm/components/lib/cssValues.js.map +1 -0
- package/dist/esm/components/lib/index.d.ts +2 -0
- package/dist/esm/components/lib/index.d.ts.map +1 -0
- package/dist/esm/components/lib/index.js +2 -0
- package/dist/esm/components/lib/index.js.map +1 -0
- package/package.json +5 -5
- package/src/components/Body.tsx +30 -21
- package/src/components/Chrome.stories.tsx +3 -3
- package/src/components/Page.tsx +22 -16
- package/src/components/lib/cssValues.ts +20 -0
- package/src/components/lib/index.ts +1 -0
|
@@ -5,7 +5,8 @@ export interface WebAppBodyProps extends FlexBoxProps {
|
|
|
5
5
|
breadcrumbs?: ReactNode;
|
|
6
6
|
disableBreadcrumbGutter?: boolean;
|
|
7
7
|
spacing?: string | number;
|
|
8
|
-
|
|
8
|
+
mobileScrollingBreakpoint?: Breakpoint;
|
|
9
|
+
variant?: 'scrollable' | 'fixed';
|
|
9
10
|
}
|
|
10
11
|
export declare const WebAppBody: React.FC<WebAppBodyProps>;
|
|
11
12
|
//# sourceMappingURL=Body.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Body.d.ts","sourceRoot":"","sources":["../../../src/components/Body.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAiC,MAAM,eAAe,CAAA;AACzE,OAAO,EAAE,YAAY,EAAwB,MAAM,uBAAuB,CAAA;AAC1E,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Body.d.ts","sourceRoot":"","sources":["../../../src/components/Body.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAiC,MAAM,eAAe,CAAA;AACzE,OAAO,EAAE,YAAY,EAAwB,MAAM,uBAAuB,CAAA;AAC1E,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AA6DxC,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACnD,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,yBAAyB,CAAC,EAAE,UAAU,CAAA;IACtC,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAA;CACjC;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAuBhD,CAAA"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { experimental_sx as sx, styled } from '@mui/material';
|
|
3
3
|
import { FlexGrowCol, FlexRow } from '@xylabs/react-flexbox';
|
|
4
|
+
import { fixedContent, scrollableContent } from './lib';
|
|
4
5
|
const WebAppBodyName = 'WebAppBody';
|
|
5
|
-
const propsNotForwarded = ['
|
|
6
|
+
const propsNotForwarded = ['mobileScrollingBreakpoint', 'variant', 'spacing', 'disableBreadcrumbGutter'];
|
|
6
7
|
const defaultStyledOptions = {
|
|
7
8
|
shouldForwardProp: (prop) => !propsNotForwarded.includes(prop),
|
|
8
9
|
};
|
|
@@ -10,16 +11,19 @@ const WebAppBodyRoot = styled(FlexGrowCol, {
|
|
|
10
11
|
...defaultStyledOptions,
|
|
11
12
|
name: WebAppBodyName,
|
|
12
13
|
slot: 'Root',
|
|
13
|
-
})(({ spacing, theme,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
})(({ spacing, theme, mobileScrollingBreakpoint = 'sm', variant }) => {
|
|
15
|
+
const scrollable = variant === 'scrollable';
|
|
16
|
+
return sx({
|
|
17
|
+
alignItems: 'stretch',
|
|
18
|
+
gap: 1,
|
|
19
|
+
justifyContent: 'flex-start',
|
|
20
|
+
overflow: scrollable ? 'scroll' : 'hidden',
|
|
21
|
+
paddingY: spacing,
|
|
22
|
+
[theme.breakpoints.down(mobileScrollingBreakpoint)]: {
|
|
23
|
+
overflow: 'scroll',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
});
|
|
23
27
|
const WebAppBodyBreadcrumb = styled(FlexRow, {
|
|
24
28
|
...defaultStyledOptions,
|
|
25
29
|
name: WebAppBodyName,
|
|
@@ -36,17 +40,19 @@ const WebAppBodyScrollable = styled(FlexGrowCol, {
|
|
|
36
40
|
...defaultStyledOptions,
|
|
37
41
|
name: WebAppBodyName,
|
|
38
42
|
slot: 'Scrollable',
|
|
39
|
-
})(({ theme,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
})(({ theme, mobileScrollingBreakpoint = 'sm', variant }) => {
|
|
44
|
+
const props = variant === 'scrollable' ? scrollableContent : fixedContent;
|
|
45
|
+
return {
|
|
46
|
+
...props,
|
|
47
|
+
alignItems: 'stretch',
|
|
48
|
+
justifyContent: 'start',
|
|
49
|
+
[theme.breakpoints.down(mobileScrollingBreakpoint)]: {
|
|
50
|
+
inset: 'unset',
|
|
51
|
+
position: 'relative',
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
export const WebAppBody = ({ children, breadcrumbs, disableBreadcrumbGutter, mobileScrollingBreakpoint, spacing = 1, variant, ...props }) => {
|
|
56
|
+
return (_jsxs(WebAppBodyRoot, { mobileScrollingBreakpoint: mobileScrollingBreakpoint, spacing: spacing, variant: variant, ...props, children: [breadcrumbs ? (_jsx(WebAppBodyBreadcrumb, { disableBreadcrumbGutter: disableBreadcrumbGutter, spacing: spacing, children: breadcrumbs })) : null, _jsx(WebAppBodyScrollableWrapper, { children: _jsx(WebAppBodyScrollable, { mobileScrollingBreakpoint: mobileScrollingBreakpoint, variant: variant, children: children }) })] }));
|
|
51
57
|
};
|
|
52
58
|
//# sourceMappingURL=Body.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Body.js","sourceRoot":"","sources":["../../../src/components/Body.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAc,eAAe,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACzE,OAAO,EAAgB,WAAW,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAG1E,MAAM,cAAc,GAAG,YAAY,CAAA;AACnC,MAAM,iBAAiB,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":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K,aAChH,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,oBAAoB,IAAC,uBAAuB,EAAE,uBAAuB,EAAE,OAAO,EAAE,OAAO,YACrF,WAAW,GACS,CACxB,CAAC,CAAC,CAAC,IAAI,EACR,KAAC,2BAA2B,cAC1B,KAAC,oBAAoB,IAAC,yBAAyB,EAAE,yBAAyB,EAAE,OAAO,EAAE,OAAO,YACzF,QAAQ,GACY,GACK,IACf,CAClB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Page.d.ts","sourceRoot":"","sources":["../../../src/components/Page.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,cAAc,EAAU,MAAM,eAAe,CAAA;AACjE,OAAO,EAAE,YAAY,EAAe,MAAM,uBAAuB,CAAA;AAEjE,OAAO,EAAkB,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAInE,OAAO,EAAc,eAAe,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"Page.d.ts","sourceRoot":"","sources":["../../../src/components/Page.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,cAAc,EAAU,MAAM,eAAe,CAAA;AACjE,OAAO,EAAE,YAAY,EAAe,MAAM,uBAAuB,CAAA;AAEjE,OAAO,EAAkB,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAInE,OAAO,EAAc,eAAe,EAAE,MAAM,QAAQ,CAAA;AAqBpD,MAAM,WAAW,eAAgB,SAAQ,eAAe,EAAE,YAAY;IACpE,SAAS,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,MAAM,CAAA;IAC/C,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,eAAe,CAAC,CAuD9D,CAAA;AAED,6CAA6C;AAC7C,eAAO,MAAM,QAAQ,mDAAa,CAAA"}
|
|
@@ -6,22 +6,25 @@ import { useAsyncEffect } from '@xylabs/react-shared';
|
|
|
6
6
|
import { Helmet } from 'react-helmet';
|
|
7
7
|
import { useLocation } from 'react-router-dom';
|
|
8
8
|
import { WebAppBody } from './Body';
|
|
9
|
+
import { fixedWrap, scrollableWrap } from './lib';
|
|
9
10
|
const WebAppPageRoot = styled(FlexGrowCol, {
|
|
10
11
|
name: 'WebAppPage',
|
|
11
|
-
shouldForwardProp: (propName) => propName !== '
|
|
12
|
+
shouldForwardProp: (propName) => propName !== 'mobileScrollingBreakpoint' && propName !== 'variant',
|
|
12
13
|
slot: 'Root',
|
|
13
|
-
})(({ theme,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
14
|
+
})(({ theme, mobileScrollingBreakpoint = 'sm', variant }) => {
|
|
15
|
+
const props = variant === 'scrollable' ? scrollableWrap : fixedWrap;
|
|
16
|
+
return {
|
|
17
|
+
...props,
|
|
18
|
+
alignItems: 'stretch',
|
|
19
|
+
justifyContent: 'start',
|
|
20
|
+
maxWidth: '100vw',
|
|
21
|
+
[theme.breakpoints.down(mobileScrollingBreakpoint)]: {
|
|
22
|
+
inset: 0,
|
|
23
|
+
position: 'absolute',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
export const WebAppPage = ({ disableGutters, disableBreadcrumbGutter, title, container, children, breadcrumbs, mobileScrollingBreakpoint, variant = 'scrollable', ...props }) => {
|
|
25
28
|
const userEvents = useUserEvents();
|
|
26
29
|
const { pathname } = useLocation();
|
|
27
30
|
useAsyncEffect(
|
|
@@ -29,7 +32,7 @@ export const WebAppPage = ({ disableGutters, disableBreadcrumbGutter, title, con
|
|
|
29
32
|
async () => {
|
|
30
33
|
await userEvents?.viewContent({ name: title ?? 'NodeBasePage', path: location.pathname });
|
|
31
34
|
}, [pathname, title, userEvents]);
|
|
32
|
-
return (_jsxs(WebAppPageRoot, {
|
|
35
|
+
return (_jsxs(WebAppPageRoot, { mobileScrollingBreakpoint: mobileScrollingBreakpoint, variant: variant, ...props, children: [_jsx(Helmet, { title: title }), container && container !== 'none' ? (_jsx(Container, { disableGutters: disableGutters, style: { alignItems: 'stretch', display: 'flex', flexDirection: 'column', flexGrow: 1, justifyContent: 'flex-start' }, maxWidth: container, children: _jsx(WebAppBody, { disableBreadcrumbGutter: disableBreadcrumbGutter, breadcrumbs: breadcrumbs, mobileScrollingBreakpoint: mobileScrollingBreakpoint, variant: variant, ...props, children: children }) })) : (_jsx(WebAppBody, { disableBreadcrumbGutter: disableBreadcrumbGutter, breadcrumbs: breadcrumbs, mobileScrollingBreakpoint: mobileScrollingBreakpoint, paddingX: disableGutters ? 0 : 1, variant: variant, ...props, children: children }))] }));
|
|
33
36
|
};
|
|
34
37
|
/** @deprecated use WebAppPagePage instead */
|
|
35
38
|
export const FlexPage = WebAppPage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Page.js","sourceRoot":"","sources":["../../../src/components/Page.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,EAAE,MAAM,eAAe,CAAA;AACjE,OAAO,EAAgB,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAgB,MAAM,sBAAsB,CAAA;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,UAAU,EAAmB,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"Page.js","sourceRoot":"","sources":["../../../src/components/Page.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,EAAE,MAAM,eAAe,CAAA;AACjE,OAAO,EAAgB,WAAW,EAAE,MAA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
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
export declare const scrollableWrap: CSSProperties;
|
|
3
|
+
export declare const fixedWrap: CSSProperties;
|
|
4
|
+
export declare const scrollableContent: CSSProperties;
|
|
5
|
+
export declare const fixedContent: CSSProperties;
|
|
6
|
+
//# sourceMappingURL=cssValues.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cssValues.d.ts","sourceRoot":"","sources":["../../../../src/components/lib/cssValues.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAErC,eAAO,MAAM,cAAc,EAAE,aAGnB,CAAA;AAEV,eAAO,MAAM,SAAS,EAAE,aAGd,CAAA;AAGV,eAAO,MAAM,iBAAiB,EAAE,aAEtB,CAAA;AAEV,eAAO,MAAM,YAAY,EAAE,aAEjB,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const scrollableWrap = {
|
|
2
|
+
inset: 0,
|
|
3
|
+
position: 'absolute',
|
|
4
|
+
};
|
|
5
|
+
export const fixedWrap = {
|
|
6
|
+
inset: 'unset',
|
|
7
|
+
position: 'relative',
|
|
8
|
+
};
|
|
9
|
+
// Making a scrollable vs fixed wrapper and content is an inversion of the wrap and content styles
|
|
10
|
+
export const scrollableContent = {
|
|
11
|
+
...fixedWrap,
|
|
12
|
+
};
|
|
13
|
+
export const fixedContent = {
|
|
14
|
+
...scrollableWrap,
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=cssValues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cssValues.js","sourceRoot":"","sources":["../../../../src/components/lib/cssValues.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAkB;IAC3C,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,UAAU;CACZ,CAAA;AAEV,MAAM,CAAC,MAAM,SAAS,GAAkB;IACtC,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;CACZ,CAAA;AAEV,kGAAkG;AAClG,MAAM,CAAC,MAAM,iBAAiB,GAAkB;IAC9C,GAAG,SAAS;CACJ,CAAA;AAEV,MAAM,CAAC,MAAM,YAAY,GAAkB;IACzC,GAAG,cAAc;CACT,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
|
package/package.json
CHANGED
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"@xylabs/react-flexbox": "^2.15.1",
|
|
15
15
|
"@xylabs/react-pixel": "^2.15.1",
|
|
16
16
|
"@xylabs/react-shared": "^2.15.1",
|
|
17
|
-
"@xyo-network/react-app-settings": "^2.37.
|
|
18
|
-
"@xyo-network/react-appbar": "^2.37.
|
|
19
|
-
"@xyo-network/react-footer": "^2.37.
|
|
20
|
-
"@xyo-network/react-shared": "^2.37.
|
|
17
|
+
"@xyo-network/react-app-settings": "^2.37.5",
|
|
18
|
+
"@xyo-network/react-appbar": "^2.37.5",
|
|
19
|
+
"@xyo-network/react-footer": "^2.37.5",
|
|
20
|
+
"@xyo-network/react-shared": "^2.37.5",
|
|
21
21
|
"react-helmet": "^6.1.0",
|
|
22
22
|
"tslib": "^2.4.0"
|
|
23
23
|
},
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
},
|
|
79
79
|
"sideEffects": false,
|
|
80
80
|
"types": "dist/esm/index.d.ts",
|
|
81
|
-
"version": "2.37.
|
|
81
|
+
"version": "2.37.5"
|
|
82
82
|
}
|
package/src/components/Body.tsx
CHANGED
|
@@ -2,8 +2,10 @@ import { Breakpoint, experimental_sx as sx, styled } from '@mui/material'
|
|
|
2
2
|
import { FlexBoxProps, FlexGrowCol, FlexRow } from '@xylabs/react-flexbox'
|
|
3
3
|
import React, { ReactNode } from 'react'
|
|
4
4
|
|
|
5
|
+
import { fixedContent, scrollableContent } from './lib'
|
|
6
|
+
|
|
5
7
|
const WebAppBodyName = 'WebAppBody'
|
|
6
|
-
const propsNotForwarded = ['
|
|
8
|
+
const propsNotForwarded = ['mobileScrollingBreakpoint', 'variant', 'spacing', 'disableBreadcrumbGutter']
|
|
7
9
|
const defaultStyledOptions = {
|
|
8
10
|
shouldForwardProp: (prop: string) => !propsNotForwarded.includes(prop),
|
|
9
11
|
}
|
|
@@ -12,18 +14,19 @@ const WebAppBodyRoot = styled(FlexGrowCol, {
|
|
|
12
14
|
...defaultStyledOptions,
|
|
13
15
|
name: WebAppBodyName,
|
|
14
16
|
slot: 'Root',
|
|
15
|
-
})<WebAppBodyProps>(({ spacing, theme,
|
|
16
|
-
|
|
17
|
+
})<WebAppBodyProps>(({ spacing, theme, mobileScrollingBreakpoint = 'sm', variant }) => {
|
|
18
|
+
const scrollable = variant === 'scrollable'
|
|
19
|
+
return sx({
|
|
17
20
|
alignItems: 'stretch',
|
|
18
21
|
gap: 1,
|
|
19
22
|
justifyContent: 'flex-start',
|
|
20
|
-
overflow: 'hidden',
|
|
23
|
+
overflow: scrollable ? 'scroll' : 'hidden',
|
|
21
24
|
paddingY: spacing,
|
|
22
|
-
[theme.breakpoints.down(
|
|
25
|
+
[theme.breakpoints.down(mobileScrollingBreakpoint)]: {
|
|
23
26
|
overflow: 'scroll',
|
|
24
27
|
},
|
|
25
|
-
})
|
|
26
|
-
)
|
|
28
|
+
})
|
|
29
|
+
})
|
|
27
30
|
|
|
28
31
|
const WebAppBodyBreadcrumb = styled(FlexRow, {
|
|
29
32
|
...defaultStyledOptions,
|
|
@@ -45,41 +48,47 @@ const WebAppBodyScrollable = styled(FlexGrowCol, {
|
|
|
45
48
|
...defaultStyledOptions,
|
|
46
49
|
name: WebAppBodyName,
|
|
47
50
|
slot: 'Scrollable',
|
|
48
|
-
})<WebAppBodyProps>(({ theme,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
51
|
+
})<WebAppBodyProps>(({ theme, mobileScrollingBreakpoint = 'sm', variant }) => {
|
|
52
|
+
const props = variant === 'scrollable' ? scrollableContent : fixedContent
|
|
53
|
+
return {
|
|
54
|
+
...props,
|
|
55
|
+
alignItems: 'stretch',
|
|
56
|
+
justifyContent: 'start',
|
|
57
|
+
[theme.breakpoints.down(mobileScrollingBreakpoint)]: {
|
|
58
|
+
inset: 'unset',
|
|
59
|
+
position: 'relative',
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
})
|
|
58
63
|
|
|
59
64
|
export interface WebAppBodyProps extends FlexBoxProps {
|
|
60
65
|
breadcrumbs?: ReactNode
|
|
61
66
|
disableBreadcrumbGutter?: boolean
|
|
62
67
|
spacing?: string | number
|
|
63
|
-
|
|
68
|
+
mobileScrollingBreakpoint?: Breakpoint
|
|
69
|
+
variant?: 'scrollable' | 'fixed'
|
|
64
70
|
}
|
|
65
71
|
|
|
66
72
|
export const WebAppBody: React.FC<WebAppBodyProps> = ({
|
|
67
73
|
children,
|
|
68
74
|
breadcrumbs,
|
|
69
75
|
disableBreadcrumbGutter,
|
|
70
|
-
|
|
76
|
+
mobileScrollingBreakpoint,
|
|
71
77
|
spacing = 1,
|
|
78
|
+
variant,
|
|
72
79
|
...props
|
|
73
80
|
}) => {
|
|
74
81
|
return (
|
|
75
|
-
<WebAppBodyRoot
|
|
82
|
+
<WebAppBodyRoot mobileScrollingBreakpoint={mobileScrollingBreakpoint} spacing={spacing} variant={variant} {...props}>
|
|
76
83
|
{breadcrumbs ? (
|
|
77
84
|
<WebAppBodyBreadcrumb disableBreadcrumbGutter={disableBreadcrumbGutter} spacing={spacing}>
|
|
78
85
|
{breadcrumbs}
|
|
79
86
|
</WebAppBodyBreadcrumb>
|
|
80
87
|
) : null}
|
|
81
88
|
<WebAppBodyScrollableWrapper>
|
|
82
|
-
<WebAppBodyScrollable
|
|
89
|
+
<WebAppBodyScrollable mobileScrollingBreakpoint={mobileScrollingBreakpoint} variant={variant}>
|
|
90
|
+
{children}
|
|
91
|
+
</WebAppBodyScrollable>
|
|
83
92
|
</WebAppBodyScrollableWrapper>
|
|
84
93
|
</WebAppBodyRoot>
|
|
85
94
|
)
|
|
@@ -63,10 +63,10 @@ Default.args = {}
|
|
|
63
63
|
const DefaultSideBar = Template.bind({})
|
|
64
64
|
DefaultSideBar.args = { children: <Children />, navigationType: 'sidebar' }
|
|
65
65
|
|
|
66
|
-
const
|
|
67
|
-
|
|
66
|
+
const WithFixedSizePage = Template.bind({})
|
|
67
|
+
WithFixedSizePage.args = { children: <Children variant="fixed" />, navigationType: 'sidebar' }
|
|
68
68
|
|
|
69
|
-
export { Default,
|
|
69
|
+
export { Default, DefaultSideBar, WithFixedSizePage }
|
|
70
70
|
|
|
71
71
|
// eslint-disable-next-line import/no-default-export
|
|
72
72
|
export default StorybookEntry
|
package/src/components/Page.tsx
CHANGED
|
@@ -6,22 +6,25 @@ import { Helmet } from 'react-helmet'
|
|
|
6
6
|
import { useLocation } from 'react-router-dom'
|
|
7
7
|
|
|
8
8
|
import { WebAppBody, WebAppBodyProps } from './Body'
|
|
9
|
+
import { fixedWrap, scrollableWrap } from './lib'
|
|
9
10
|
|
|
10
11
|
const WebAppPageRoot = styled(FlexGrowCol, {
|
|
11
12
|
name: 'WebAppPage',
|
|
12
|
-
shouldForwardProp: (propName) => propName !== '
|
|
13
|
+
shouldForwardProp: (propName) => propName !== 'mobileScrollingBreakpoint' && propName !== 'variant',
|
|
13
14
|
slot: 'Root',
|
|
14
|
-
})<WebAppPageProps>(({ theme,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
15
|
+
})<WebAppPageProps>(({ theme, mobileScrollingBreakpoint = 'sm', variant }) => {
|
|
16
|
+
const props = variant === 'scrollable' ? scrollableWrap : fixedWrap
|
|
17
|
+
return {
|
|
18
|
+
...props,
|
|
19
|
+
alignItems: 'stretch',
|
|
20
|
+
justifyContent: 'start',
|
|
21
|
+
maxWidth: '100vw',
|
|
22
|
+
[theme.breakpoints.down(mobileScrollingBreakpoint)]: {
|
|
23
|
+
inset: 0,
|
|
24
|
+
position: 'absolute',
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
})
|
|
25
28
|
|
|
26
29
|
export interface WebAppPageProps extends WebAppBodyProps, FlexBoxProps {
|
|
27
30
|
container?: ContainerProps['maxWidth'] | 'none'
|
|
@@ -35,7 +38,8 @@ export const WebAppPage: React.FC<WithChildren<WebAppPageProps>> = ({
|
|
|
35
38
|
container,
|
|
36
39
|
children,
|
|
37
40
|
breadcrumbs,
|
|
38
|
-
|
|
41
|
+
mobileScrollingBreakpoint,
|
|
42
|
+
variant = 'scrollable',
|
|
39
43
|
...props
|
|
40
44
|
}) => {
|
|
41
45
|
const userEvents = useUserEvents()
|
|
@@ -50,7 +54,7 @@ export const WebAppPage: React.FC<WithChildren<WebAppPageProps>> = ({
|
|
|
50
54
|
)
|
|
51
55
|
|
|
52
56
|
return (
|
|
53
|
-
<WebAppPageRoot
|
|
57
|
+
<WebAppPageRoot mobileScrollingBreakpoint={mobileScrollingBreakpoint} variant={variant} {...props}>
|
|
54
58
|
<Helmet title={title} />
|
|
55
59
|
{container && container !== 'none' ? (
|
|
56
60
|
<Container
|
|
@@ -61,7 +65,8 @@ export const WebAppPage: React.FC<WithChildren<WebAppPageProps>> = ({
|
|
|
61
65
|
<WebAppBody
|
|
62
66
|
disableBreadcrumbGutter={disableBreadcrumbGutter}
|
|
63
67
|
breadcrumbs={breadcrumbs}
|
|
64
|
-
|
|
68
|
+
mobileScrollingBreakpoint={mobileScrollingBreakpoint}
|
|
69
|
+
variant={variant}
|
|
65
70
|
{...props}
|
|
66
71
|
>
|
|
67
72
|
{children}
|
|
@@ -71,8 +76,9 @@ export const WebAppPage: React.FC<WithChildren<WebAppPageProps>> = ({
|
|
|
71
76
|
<WebAppBody
|
|
72
77
|
disableBreadcrumbGutter={disableBreadcrumbGutter}
|
|
73
78
|
breadcrumbs={breadcrumbs}
|
|
74
|
-
|
|
79
|
+
mobileScrollingBreakpoint={mobileScrollingBreakpoint}
|
|
75
80
|
paddingX={disableGutters ? 0 : 1}
|
|
81
|
+
variant={variant}
|
|
76
82
|
{...props}
|
|
77
83
|
>
|
|
78
84
|
{children}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CSSProperties } from 'react'
|
|
2
|
+
|
|
3
|
+
export const scrollableWrap: CSSProperties = {
|
|
4
|
+
inset: 0,
|
|
5
|
+
position: 'absolute',
|
|
6
|
+
} as const
|
|
7
|
+
|
|
8
|
+
export const fixedWrap: CSSProperties = {
|
|
9
|
+
inset: 'unset',
|
|
10
|
+
position: 'relative',
|
|
11
|
+
} as const
|
|
12
|
+
|
|
13
|
+
// Making a scrollable vs fixed wrapper and content is an inversion of the wrap and content styles
|
|
14
|
+
export const scrollableContent: CSSProperties = {
|
|
15
|
+
...fixedWrap,
|
|
16
|
+
} as const
|
|
17
|
+
|
|
18
|
+
export const fixedContent: CSSProperties = {
|
|
19
|
+
...scrollableWrap,
|
|
20
|
+
} as const
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './cssValues'
|