@xyo-network/react-webapp 2.35.11 → 2.35.13

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.
@@ -0,0 +1,12 @@
1
+ import { Breakpoint } from '@mui/material';
2
+ import { FlexBoxProps } from '@xylabs/react-flexbox';
3
+ import React, { ReactNode } from 'react';
4
+ export interface WebAppBodyProps extends FlexBoxProps {
5
+ breadcrumbs?: ReactNode;
6
+ disableBreadcrumbGutter?: boolean;
7
+ spacing?: string | number;
8
+ scrollingBreakpoint?: Breakpoint;
9
+ devMode?: boolean;
10
+ }
11
+ export declare const WebAppBody: React.FC<WebAppBodyProps>;
12
+ //# sourceMappingURL=Body.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Body.d.ts","sourceRoot":"","sources":["../../../src/components/Body.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAU,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,YAAY,EAAwB,MAAM,uBAAuB,CAAA;AAC1E,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AA6CxC,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,mBAAmB,CAAC,EAAE,UAAU,CAAA;IAChC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA8BhD,CAAA"}
@@ -0,0 +1,50 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { styled } from '@mui/material';
3
+ import { FlexGrowCol, FlexRow } from '@xylabs/react-flexbox';
4
+ const WebAppBodyName = 'WebAppBody';
5
+ const WebAppBodyRoot = styled(FlexGrowCol, {
6
+ name: WebAppBodyName,
7
+ slot: 'Root',
8
+ })(({ spacing, theme, scrollingBreakpoint = 'sm' }) => ({
9
+ alignItems: 'stretch',
10
+ gap: 1,
11
+ justifyContent: 'flex-start',
12
+ overflow: 'hidden',
13
+ paddingY: spacing,
14
+ [theme.breakpoints.down(scrollingBreakpoint)]: {
15
+ overflow: 'scroll',
16
+ },
17
+ }));
18
+ const WebAppBodyBreadcrumb = styled(FlexRow, {
19
+ name: WebAppBodyName,
20
+ slot: 'Breadcrumb',
21
+ })(({ disableBreadcrumbGutter, spacing }) => ({
22
+ justifyContent: 'start',
23
+ marginX: disableBreadcrumbGutter ? 0 : spacing,
24
+ }));
25
+ const WebAppBodyScrollableWrapper = styled(FlexGrowCol, {
26
+ name: WebAppBodyName,
27
+ slot: 'ScrollableWrapper',
28
+ })(() => ({}));
29
+ const WebAppBodyScrollable = styled(FlexGrowCol, {
30
+ name: WebAppBodyName,
31
+ slot: 'Scrollable',
32
+ })(({ theme, scrollingBreakpoint = 'sm' }) => ({
33
+ alignItems: 'stretch',
34
+ inset: 0,
35
+ justifyContent: 'start',
36
+ position: 'absolute',
37
+ [theme.breakpoints.down(scrollingBreakpoint)]: {
38
+ inset: 'unset',
39
+ position: 'relative',
40
+ },
41
+ }));
42
+ export const WebAppBody = ({ devMode, children, breadcrumbs, disableBreadcrumbGutter, scrollingBreakpoint, spacing, ...props }) => {
43
+ if (devMode) {
44
+ return (_jsxs(WebAppBodyRoot, { scrollingBreakpoint: scrollingBreakpoint, spacing: spacing, ...props, children: [_jsx(WebAppBodyBreadcrumb, { disableBreadcrumbGutter: disableBreadcrumbGutter, spacing: spacing, children: breadcrumbs }), _jsx(WebAppBodyScrollableWrapper, { children: _jsx(WebAppBodyScrollable, { scrollingBreakpoint: scrollingBreakpoint, children: children }) })] }));
45
+ }
46
+ else {
47
+ return (_jsxs(FlexGrowCol, { gap: 1, paddingY: spacing, justifyContent: "flex-start", alignItems: "stretch", ...props, children: [_jsx(FlexRow, { justifyContent: "flex-start", marginX: disableBreadcrumbGutter ? 0 : spacing, children: breadcrumbs }), children] }));
48
+ }
49
+ };
50
+ //# sourceMappingURL=Body.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Body.js","sourceRoot":"","sources":["../../../src/components/Body.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAc,MAAM,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAgB,WAAW,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAG1E,MAAM,cAAc,GAAG,YAAY,CAAA;AAEnC,MAAM,cAAc,GAAG,MAAM,CAAC,WAAW,EAAE;IACzC,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,MAAM;CACb,CAAC,CAAkB,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,mBAAmB,GAAG,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IACvE,UAAU,EAAE,SAAS;IACrB,GAAG,EAAE,CAAC;IACN,cAAc,EAAE,YAAY;IAC5B,QAAQ,EAAE,QAAQ;IAClB,QAAQ,EAAE,OAAO;IACjB,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,EAAE;QAC7C,QAAQ,EAAE,QAAQ;KACnB;CACF,CAAC,CAAC,CAAA;AAEH,MAAM,oBAAoB,GAAG,MAAM,CAAC,OAAO,EAAE;IAC3C,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,YAAY;CACnB,CAAC,CAAkB,CAAC,EAAE,uBAAuB,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7D,cAAc,EAAE,OAAO;IACvB,OAAO,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO;CAC/C,CAAC,CAAC,CAAA;AAEH,MAAM,2BAA2B,GAAG,MAAM,CAAC,WAAW,EAAE;IACtD,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,mBAAmB;CAC1B,CAAC,CAAkB,GAAG,EAAE,CAAC,CAAC,E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,IACG,CACf,CAAA;KACF;AACH,CAAC,CAAA"}
@@ -7,6 +7,6 @@ import { ErrorBoundary } from '@xyo-network/react-shared';
7
7
  import { Helmet } from 'react-helmet';
8
8
  import { WebAppErrorPage } from './ErrorPage';
9
9
  export const WebAppChrome = ({ menuItems, navigationType = 'menu', footerElevation = 4, errorPage, appbar, footer, children, appName, ...props }) => {
10
- return (_jsxs(FlexCol, { alignItems: "stretch", overflow: "hidden", height: "100vh", ...props, children: [_jsx(Helmet, { defaultTitle: appName, titleTemplate: `%s | ${appName}`, children: _jsx("meta", { content: "website", property: "og:type" }) }), appbar ?? _jsx(ApplicationAppBar, { systemToolbar: _jsx(SystemToolbar, { menuItems: navigationType === 'menu' ? menuItems : undefined }) }), _jsxs(FlexGrowRow, { overflow: "hidden", alignItems: "stretch", children: [navigationType !== 'menu' ? (_jsxs(_Fragment, { children: [menuItems, _jsx(Divider, { orientation: "vertical" })] })) : null, _jsx(FlexGrowCol, { justifyContent: "flex-start", alignItems: "stretch", children: _jsx(ErrorBoundary, { fallback: errorPage ?? _jsx(WebAppErrorPage, {}), children: children }) })] }), _jsx(FlexCol, { alignItems: "stretch", children: _jsx(Paper, { elevation: footerElevation, square: true, children: footer ?? _jsx(Footer, { dynamicHeight: true }) }) })] }));
10
+ return (_jsxs(FlexCol, { id: "web-chrome-flex", alignItems: "stretch", overflow: "hidden", height: "100vh", ...props, children: [_jsx(Helmet, { defaultTitle: appName, titleTemplate: `%s | ${appName}`, children: _jsx("meta", { content: "website", property: "og:type" }) }), appbar ?? _jsx(ApplicationAppBar, { systemToolbar: _jsx(SystemToolbar, { menuItems: navigationType === 'menu' ? menuItems : undefined }) }), _jsxs(FlexGrowRow, { id: "sidebar-nav-flex", overflow: "hidden", alignItems: "stretch", children: [navigationType !== 'menu' ? (_jsxs(_Fragment, { children: [menuItems, _jsx(Divider, { orientation: "vertical" })] })) : null, _jsx(FlexGrowCol, { id: "main-flex", justifyContent: "flex-start", alignItems: "stretch", children: _jsx(ErrorBoundary, { fallback: errorPage ?? _jsx(WebAppErrorPage, {}), children: children }) })] }), _jsx(FlexCol, { id: "footer-flex", alignItems: "stretch", children: _jsx(Paper, { elevation: footerElevation, square: true, children: footer ?? _jsx(Footer, { dynamicHeight: true }) }) })] }));
11
11
  };
12
12
  //# sourceMappingURL=Chrome.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Chrome.js","sourceRoot":"","sources":["../../../src/components/Chrome.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAgB,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEvF,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEzD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAY7C,MAAM,CAAC,MAAM,YAAY,GAAgC,CAAC,EACxD,SAAS,EACT,cAAc,GAAG,MAAM,EACvB,eAAe,GAAG,CAAC,EACnB,SAAS,EACT,MAAM,EACN,MAAM,EACN,QAAQ,EACR,OAAO,EACP,GAAG,KAAK,EACT,EAAE,EAAE;IACH,OAAO,CACL,MAAC,OAAO,IAAC,UAAU,EAAC,SAAS,EAAC,QAAQ,EAAC,QAAQ,EAAC,MAAM,EAAC,OAAO,KAAK,KAAK,aACtE,KAAC,MAAM,IAAC,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,OAAO,EAAE,YAC7D,eAAM,OAAO,EAAC,SAAS,EAAC,QAAQ,EAAC,SAAS,GAAG,GACtC,EACR,MAAM,IAAI,KAAC,iBAAiB,IAAC,aAAa,EAAE,KAAC,aAAa,IAAC,SAAS,EAAE,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ps } from '@mui/material';
2
3
  import { FlexBoxProps } from '@xylabs/react-flexbox';
3
- import { ReactNode } from 'react';
4
- export interface WebAppPageProps extends FlexBoxProps {
4
+ import { WithChildren } from '@xylabs/react-shared';
5
+ import { WebAppBodyProps } from './Body';
6
+ export interface WebAppPageProps extends WebAppBodyProps, FlexBoxProps {
5
7
  container?: ContainerProps['maxWidth'] | 'none';
6
8
  disableGutters?: boolean;
7
- breadcrumbs?: ReactNode;
8
- disableBreadcrumbGutter?: boolean;
9
- spacing?: string | number;
10
9
  }
11
- export declare const WebAppPage: React.FC<WebAppPageProps>;
10
+ export declare const WebAppPage: React.FC<WithChildren<WebAppPageProps>>;
12
11
  /** @deprecated use WebAppPagePage instead */
13
- export declare const FlexPage: import("react").FC<WebAppPageProps>;
12
+ export declare const FlexPage: import("react").FC<WithChildren<WebAppPageProps>>;
14
13
  //# sourceMappingURL=Page.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Page.d.ts","sourceRoot":"","sources":["../../../src/components/Page.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,cAAc,EAAE,MAAM,eAAe,CAAA;AACzD,OAAO,EAAE,YAAY,EAAwB,MAAM,uBAAuB,CAAA;AAG1E,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGjC,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACnD,SAAS,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,MAAM,CAAA;IAC/C,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAC1B;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA8ChD,CAAA;AAED,6CAA6C;AAC7C,eAAO,MAAM,QAAQ,qCAAa,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;AAkBpD,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,CA4F9D,CAAA;AAED,6CAA6C;AAC7C,eAAO,MAAM,QAAQ,mDAAa,CAAA"}
@@ -1,11 +1,27 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Container } from '@mui/material';
3
- import { FlexGrowCol, FlexRow } from '@xylabs/react-flexbox';
2
+ import { Container, styled } from '@mui/material';
3
+ import { FlexGrowCol } from '@xylabs/react-flexbox';
4
4
  import { useUserEvents } from '@xylabs/react-pixel';
5
5
  import { useAsyncEffect } from '@xylabs/react-shared';
6
6
  import { Helmet } from 'react-helmet';
7
7
  import { useLocation } from 'react-router-dom';
8
- export const WebAppPage = ({ spacing = 1, disableBreadcrumbGutter, disableGutters, title, container, breadcrumbs, children, ...props }) => {
8
+ import { WebAppBody } from './Body';
9
+ const WebAppPageRoot = styled(FlexGrowCol, {
10
+ name: 'WebAppPage',
11
+ shouldForwardProp: (propName) => propName !== 'scrollingBreakpoint',
12
+ slot: 'Root',
13
+ })(({ theme, scrollingBreakpoint = 'sm' }) => ({
14
+ alignItems: 'stretch',
15
+ inset: 'unset',
16
+ justifyContent: 'start',
17
+ maxWidth: '100vw',
18
+ position: 'relative',
19
+ [theme.breakpoints.down(scrollingBreakpoint)]: {
20
+ inset: 0,
21
+ position: 'absolute',
22
+ },
23
+ }));
24
+ export const WebAppPage = ({ disableGutters, disableBreadcrumbGutter, title, container, children, breadcrumbs, scrollingBreakpoint, devMode, ...props }) => {
9
25
  const userEvents = useUserEvents();
10
26
  const { pathname } = useLocation();
11
27
  useAsyncEffect(
@@ -13,8 +29,12 @@ export const WebAppPage = ({ spacing = 1, disableBreadcrumbGutter, disableGutter
13
29
  async () => {
14
30
  await userEvents?.viewContent({ name: title ?? 'NodeBasePage', path: location.pathname });
15
31
  }, [pathname, title, userEvents]);
16
- const Body = (props) => (_jsxs(FlexGrowCol, { gap: 1, paddingY: spacing, justifyContent: "flex-start", alignItems: "stretch", ...props, children: [_jsx(FlexRow, { justifyContent: "flex-start", marginX: disableBreadcrumbGutter ? 0 : spacing, children: breadcrumbs }), children] }));
17
- return (_jsxs(FlexGrowCol, { alignItems: "stretch", justifyContent: "flex-start", minHeight: 0, maxWidth: "100vw", overflow: "visible scroll", 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(Body, { ...props }) })) : (_jsx(Body, { paddingX: disableGutters ? 0 : 1, ...props }))] }));
32
+ if (devMode) {
33
+ return (_jsxs(WebAppPageRoot, { scrollingBreakpoint: scrollingBreakpoint, ...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, { devMode: devMode, disableBreadcrumbGutter: disableBreadcrumbGutter, breadcrumbs: breadcrumbs, scrollingBreakpoint: scrollingBreakpoint, ...props, children: children }) })) : (_jsx(WebAppBody, { devMode: devMode, disableBreadcrumbGutter: disableBreadcrumbGutter, breadcrumbs: breadcrumbs, scrollingBreakpoint: scrollingBreakpoint, paddingX: disableGutters ? 0 : 1, ...props, children: children }))] }));
34
+ }
35
+ else {
36
+ return (_jsxs(FlexGrowCol, { alignItems: "stretch", justifyContent: "flex-start", minHeight: 0, maxWidth: "100vw", overflow: "visible scroll", 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, { devMode: devMode, disableBreadcrumbGutter: disableBreadcrumbGutter, breadcrumbs: breadcrumbs, scrollingBreakpoint: scrollingBreakpoint, paddingX: disableGutters ? 0 : 1, ...props, children: children }) })) : (_jsx(WebAppBody, { devMode: devMode, disableBreadcrumbGutter: disableBreadcrumbGutter, breadcrumbs: breadcrumbs, scrollingBreakpoint: scrollingBreakpoint, paddingX: disableGutters ? 0 : 1, ...props, children: children }))] }));
37
+ }
18
38
  };
19
39
  /** @deprecated use WebAppPagePage instead */
20
40
  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,CAAA;AACzD,OAAO,EAAgB,WAAW,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAS9C,MAAM,CAAC,MAAM,UAAU,GAA8B,CAAC,EACpD,OAAO,GAAG,CAAC,EACX,uBAAuB,EACvB,cAAc,EACd,KAAK,EACL,SAAS,EACT,WAAW,EACX,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,EAAE;IACH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2.14.20",
16
16
  "@xylabs/react-shared": "^2.14.20",
17
- "@xyo-network/react-app-settings": "^2.35.11",
18
- "@xyo-network/react-appbar": "^2.35.11",
19
- "@xyo-network/react-footer": "^2.35.11",
20
- "@xyo-network/react-shared": "^2.35.11",
17
+ "@xyo-network/react-app-settings": "^2.35.13",
18
+ "@xyo-network/react-appbar": "^2.35.13",
19
+ "@xyo-network/react-footer": "^2.35.13",
20
+ "@xyo-network/react-shared": "^2.35.13",
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.35.11"
81
+ "version": "2.35.13"
82
82
  }
@@ -0,0 +1,86 @@
1
+ import { Breakpoint, styled } from '@mui/material'
2
+ import { FlexBoxProps, FlexGrowCol, FlexRow } from '@xylabs/react-flexbox'
3
+ import React, { ReactNode } from 'react'
4
+
5
+ const WebAppBodyName = 'WebAppBody'
6
+
7
+ const WebAppBodyRoot = styled(FlexGrowCol, {
8
+ name: WebAppBodyName,
9
+ slot: 'Root',
10
+ })<WebAppBodyProps>(({ spacing, theme, scrollingBreakpoint = 'sm' }) => ({
11
+ alignItems: 'stretch',
12
+ gap: 1,
13
+ justifyContent: 'flex-start',
14
+ overflow: 'hidden',
15
+ paddingY: spacing,
16
+ [theme.breakpoints.down(scrollingBreakpoint)]: {
17
+ overflow: 'scroll',
18
+ },
19
+ }))
20
+
21
+ const WebAppBodyBreadcrumb = styled(FlexRow, {
22
+ name: WebAppBodyName,
23
+ slot: 'Breadcrumb',
24
+ })<WebAppBodyProps>(({ disableBreadcrumbGutter, spacing }) => ({
25
+ justifyContent: 'start',
26
+ marginX: disableBreadcrumbGutter ? 0 : spacing,
27
+ }))
28
+
29
+ const WebAppBodyScrollableWrapper = styled(FlexGrowCol, {
30
+ name: WebAppBodyName,
31
+ slot: 'ScrollableWrapper',
32
+ })<WebAppBodyProps>(() => ({}))
33
+
34
+ const WebAppBodyScrollable = styled(FlexGrowCol, {
35
+ name: WebAppBodyName,
36
+ slot: 'Scrollable',
37
+ })<WebAppBodyProps>(({ theme, scrollingBreakpoint = 'sm' }) => ({
38
+ alignItems: 'stretch',
39
+ inset: 0,
40
+ justifyContent: 'start',
41
+ position: 'absolute',
42
+ [theme.breakpoints.down(scrollingBreakpoint)]: {
43
+ inset: 'unset',
44
+ position: 'relative',
45
+ },
46
+ }))
47
+
48
+ export interface WebAppBodyProps extends FlexBoxProps {
49
+ breadcrumbs?: ReactNode
50
+ disableBreadcrumbGutter?: boolean
51
+ spacing?: string | number
52
+ scrollingBreakpoint?: Breakpoint
53
+ devMode?: boolean
54
+ }
55
+
56
+ export const WebAppBody: React.FC<WebAppBodyProps> = ({
57
+ devMode,
58
+ children,
59
+ breadcrumbs,
60
+ disableBreadcrumbGutter,
61
+ scrollingBreakpoint,
62
+ spacing,
63
+ ...props
64
+ }) => {
65
+ if (devMode) {
66
+ return (
67
+ <WebAppBodyRoot scrollingBreakpoint={scrollingBreakpoint} spacing={spacing} {...props}>
68
+ <WebAppBodyBreadcrumb disableBreadcrumbGutter={disableBreadcrumbGutter} spacing={spacing}>
69
+ {breadcrumbs}
70
+ </WebAppBodyBreadcrumb>
71
+ <WebAppBodyScrollableWrapper>
72
+ <WebAppBodyScrollable scrollingBreakpoint={scrollingBreakpoint}>{children}</WebAppBodyScrollable>
73
+ </WebAppBodyScrollableWrapper>
74
+ </WebAppBodyRoot>
75
+ )
76
+ } else {
77
+ return (
78
+ <FlexGrowCol gap={1} paddingY={spacing} justifyContent="flex-start" alignItems="stretch" {...props}>
79
+ <FlexRow justifyContent="flex-start" marginX={disableBreadcrumbGutter ? 0 : spacing}>
80
+ {breadcrumbs}
81
+ </FlexRow>
82
+ {children}
83
+ </FlexGrowCol>
84
+ )
85
+ }
86
+ }
@@ -1,13 +1,13 @@
1
1
  /* eslint-disable import/no-internal-modules */
2
2
  import { Breadcrumbs, List } from '@mui/material'
3
3
  import { ComponentMeta, ComponentStory } from '@storybook/react'
4
- import { FlexCol, FlexRow } from '@xylabs/react-flexbox'
4
+ import { FlexRow } from '@xylabs/react-flexbox'
5
5
  import { LinkEx } from '@xylabs/react-link'
6
6
  import { SiteMenuListItem } from '@xyo-network/react-appbar'
7
7
  import { BrowserRouter } from 'react-router-dom'
8
8
 
9
9
  import { WebAppChrome } from './Chrome'
10
- import { WebAppPage } from './Page'
10
+ import { WebAppPage, WebAppPageProps } from './Page'
11
11
 
12
12
  const StorybookEntry = {
13
13
  argTypes: {},
@@ -22,36 +22,38 @@ const StorybookEntry = {
22
22
 
23
23
  const rowArray = [32, 64, 128, 256, 512, 1024]
24
24
 
25
+ const Children: React.FC<WebAppPageProps> = (props) => (
26
+ <WebAppPage
27
+ breadcrumbs={
28
+ <Breadcrumbs>
29
+ <LinkEx>BreadCrumbs</LinkEx>
30
+ </Breadcrumbs>
31
+ }
32
+ {...props}
33
+ >
34
+ {rowArray.map((height) => {
35
+ return (
36
+ <FlexRow key={height} height={height}>
37
+ {height}
38
+ </FlexRow>
39
+ )
40
+ })}
41
+ </WebAppPage>
42
+ )
43
+
25
44
  const Template: ComponentStory<typeof WebAppChrome> = (args) => {
26
45
  return (
27
- <FlexCol height="80vh" alignItems="stretch" overflow="hidden">
28
- <BrowserRouter>
29
- <WebAppChrome
30
- menuItems={
31
- <List>
32
- <SiteMenuListItem primary="Hello" />
33
- </List>
34
- }
35
- {...args}
36
- >
37
- <WebAppPage
38
- breadcrumbs={
39
- <Breadcrumbs>
40
- <LinkEx>BreadCrumbs</LinkEx>
41
- </Breadcrumbs>
42
- }
43
- >
44
- {rowArray.map((height) => {
45
- return (
46
- <FlexRow key={height} height={height}>
47
- {height}
48
- </FlexRow>
49
- )
50
- })}
51
- </WebAppPage>
52
- </WebAppChrome>
53
- </BrowserRouter>
54
- </FlexCol>
46
+ <BrowserRouter>
47
+ <WebAppChrome
48
+ menuItems={
49
+ <List>
50
+ <SiteMenuListItem primary="Hello" />
51
+ </List>
52
+ }
53
+ height="calc(100vh - 2rem)"
54
+ {...args}
55
+ ></WebAppChrome>
56
+ </BrowserRouter>
55
57
  )
56
58
  }
57
59
 
@@ -59,9 +61,12 @@ const Default = Template.bind({})
59
61
  Default.args = {}
60
62
 
61
63
  const DefaultSideBar = Template.bind({})
62
- DefaultSideBar.args = { navigationType: 'sidebar' }
64
+ DefaultSideBar.args = { children: <Children devMode />, navigationType: 'sidebar' }
65
+
66
+ const DefaultAlwaysScrollable = Template.bind({})
67
+ DefaultAlwaysScrollable.args = { children: <Children devMode scrollingBreakpoint="xl" />, navigationType: 'sidebar' }
63
68
 
64
- export { Default, DefaultSideBar }
69
+ export { Default, DefaultAlwaysScrollable, DefaultSideBar }
65
70
 
66
71
  // eslint-disable-next-line import/no-default-export
67
72
  export default StorybookEntry
@@ -31,23 +31,23 @@ export const WebAppChrome: React.FC<WebAppChromeProps> = ({
31
31
  ...props
32
32
  }) => {
33
33
  return (
34
- <FlexCol alignItems="stretch" overflow="hidden" height="100vh" {...props}>
34
+ <FlexCol id="web-chrome-flex" alignItems="stretch" overflow="hidden" height="100vh" {...props}>
35
35
  <Helmet defaultTitle={appName} titleTemplate={`%s | ${appName}`}>
36
36
  <meta content="website" property="og:type" />
37
37
  </Helmet>
38
38
  {appbar ?? <ApplicationAppBar systemToolbar={<SystemToolbar menuItems={navigationType === 'menu' ? menuItems : undefined} />} />}
39
- <FlexGrowRow overflow="hidden" alignItems="stretch">
39
+ <FlexGrowRow id="sidebar-nav-flex" overflow="hidden" alignItems="stretch">
40
40
  {navigationType !== 'menu' ? (
41
41
  <>
42
42
  {menuItems}
43
43
  <Divider orientation="vertical" />
44
44
  </>
45
45
  ) : null}
46
- <FlexGrowCol justifyContent="flex-start" alignItems="stretch">
46
+ <FlexGrowCol id="main-flex" justifyContent="flex-start" alignItems="stretch">
47
47
  <ErrorBoundary fallback={errorPage ?? <WebAppErrorPage />}>{children}</ErrorBoundary>
48
48
  </FlexGrowCol>
49
49
  </FlexGrowRow>
50
- <FlexCol alignItems="stretch">
50
+ <FlexCol id="footer-flex" alignItems="stretch">
51
51
  <Paper elevation={footerElevation} square>
52
52
  {footer ?? <Footer dynamicHeight />}
53
53
  </Paper>
@@ -1,26 +1,42 @@
1
- import { Container, ContainerProps } from '@mui/material'
2
- import { FlexBoxProps, FlexGrowCol, FlexRow } from '@xylabs/react-flexbox'
1
+ import { Container, ContainerProps, styled } from '@mui/material'
2
+ import { FlexBoxProps, FlexGrowCol } from '@xylabs/react-flexbox'
3
3
  import { useUserEvents } from '@xylabs/react-pixel'
4
- import { useAsyncEffect } from '@xylabs/react-shared'
5
- import { ReactNode } from 'react'
4
+ import { useAsyncEffect, WithChildren } from '@xylabs/react-shared'
6
5
  import { Helmet } from 'react-helmet'
7
6
  import { useLocation } from 'react-router-dom'
8
- export interface WebAppPageProps extends FlexBoxProps {
7
+
8
+ import { WebAppBody, WebAppBodyProps } from './Body'
9
+
10
+ const WebAppPageRoot = styled(FlexGrowCol, {
11
+ name: 'WebAppPage',
12
+ shouldForwardProp: (propName) => propName !== 'scrollingBreakpoint',
13
+ slot: 'Root',
14
+ })<WebAppPageProps>(({ theme, scrollingBreakpoint = 'sm' }) => ({
15
+ alignItems: 'stretch',
16
+ inset: 'unset',
17
+ justifyContent: 'start',
18
+ maxWidth: '100vw',
19
+ position: 'relative',
20
+ [theme.breakpoints.down(scrollingBreakpoint)]: {
21
+ inset: 0,
22
+ position: 'absolute',
23
+ },
24
+ }))
25
+
26
+ export interface WebAppPageProps extends WebAppBodyProps, FlexBoxProps {
9
27
  container?: ContainerProps['maxWidth'] | 'none'
10
28
  disableGutters?: boolean
11
- breadcrumbs?: ReactNode
12
- disableBreadcrumbGutter?: boolean
13
- spacing?: string | number
14
29
  }
15
30
 
16
- export const WebAppPage: React.FC<WebAppPageProps> = ({
17
- spacing = 1,
18
- disableBreadcrumbGutter,
31
+ export const WebAppPage: React.FC<WithChildren<WebAppPageProps>> = ({
19
32
  disableGutters,
33
+ disableBreadcrumbGutter,
20
34
  title,
21
35
  container,
22
- breadcrumbs,
23
36
  children,
37
+ breadcrumbs,
38
+ scrollingBreakpoint,
39
+ devMode,
24
40
  ...props
25
41
  }) => {
26
42
  const userEvents = useUserEvents()
@@ -34,31 +50,76 @@ export const WebAppPage: React.FC<WebAppPageProps> = ({
34
50
  [pathname, title, userEvents],
35
51
  )
36
52
 
37
- const Body: React.FC<FlexBoxProps> = (props) => (
38
- <FlexGrowCol gap={1} paddingY={spacing} justifyContent="flex-start" alignItems="stretch" {...props}>
39
- <FlexRow justifyContent="flex-start" marginX={disableBreadcrumbGutter ? 0 : spacing}>
40
- {breadcrumbs}
41
- </FlexRow>
42
- {children}
43
- </FlexGrowCol>
44
- )
45
-
46
- return (
47
- <FlexGrowCol alignItems="stretch" justifyContent="flex-start" minHeight={0} maxWidth="100vw" overflow="visible scroll">
48
- <Helmet title={title} />
49
- {container && container !== 'none' ? (
50
- <Container
51
- disableGutters={disableGutters}
52
- style={{ alignItems: 'stretch', display: 'flex', flexDirection: 'column', flexGrow: 1, justifyContent: 'flex-start' }}
53
- maxWidth={container}
54
- >
55
- <Body {...props} />
56
- </Container>
57
- ) : (
58
- <Body paddingX={disableGutters ? 0 : 1} {...props} />
59
- )}
60
- </FlexGrowCol>
61
- )
53
+ if (devMode) {
54
+ return (
55
+ <WebAppPageRoot scrollingBreakpoint={scrollingBreakpoint} {...props}>
56
+ <Helmet title={title} />
57
+ {container && container !== 'none' ? (
58
+ <Container
59
+ disableGutters={disableGutters}
60
+ style={{ alignItems: 'stretch', display: 'flex', flexDirection: 'column', flexGrow: 1, justifyContent: 'flex-start' }}
61
+ maxWidth={container}
62
+ >
63
+ <WebAppBody
64
+ devMode={devMode}
65
+ disableBreadcrumbGutter={disableBreadcrumbGutter}
66
+ breadcrumbs={breadcrumbs}
67
+ scrollingBreakpoint={scrollingBreakpoint}
68
+ {...props}
69
+ >
70
+ {children}
71
+ </WebAppBody>
72
+ </Container>
73
+ ) : (
74
+ <WebAppBody
75
+ devMode={devMode}
76
+ disableBreadcrumbGutter={disableBreadcrumbGutter}
77
+ breadcrumbs={breadcrumbs}
78
+ scrollingBreakpoint={scrollingBreakpoint}
79
+ paddingX={disableGutters ? 0 : 1}
80
+ {...props}
81
+ >
82
+ {children}
83
+ </WebAppBody>
84
+ )}
85
+ </WebAppPageRoot>
86
+ )
87
+ } else {
88
+ return (
89
+ <FlexGrowCol alignItems="stretch" justifyContent="flex-start" minHeight={0} maxWidth="100vw" overflow="visible scroll">
90
+ <Helmet title={title} />
91
+ {container && container !== 'none' ? (
92
+ <Container
93
+ disableGutters={disableGutters}
94
+ style={{ alignItems: 'stretch', display: 'flex', flexDirection: 'column', flexGrow: 1, justifyContent: 'flex-start' }}
95
+ maxWidth={container}
96
+ >
97
+ <WebAppBody
98
+ devMode={devMode}
99
+ disableBreadcrumbGutter={disableBreadcrumbGutter}
100
+ breadcrumbs={breadcrumbs}
101
+ scrollingBreakpoint={scrollingBreakpoint}
102
+ paddingX={disableGutters ? 0 : 1}
103
+ {...props}
104
+ >
105
+ {children}
106
+ </WebAppBody>
107
+ </Container>
108
+ ) : (
109
+ <WebAppBody
110
+ devMode={devMode}
111
+ disableBreadcrumbGutter={disableBreadcrumbGutter}
112
+ breadcrumbs={breadcrumbs}
113
+ scrollingBreakpoint={scrollingBreakpoint}
114
+ paddingX={disableGutters ? 0 : 1}
115
+ {...props}
116
+ >
117
+ {children}
118
+ </WebAppBody>
119
+ )}
120
+ </FlexGrowCol>
121
+ )
122
+ }
62
123
  }
63
124
 
64
125
  /** @deprecated use WebAppPagePage instead */