@xylabs/react-webapp 7.1.16 → 7.1.20

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/README.md CHANGED
@@ -1,67 +1,27 @@
1
- [![logo][]](https://xylabs.com)
2
-
3
1
  # @xylabs/react-webapp
4
2
 
5
- [![npm-badge][]][npm-link]
6
- [![npm-downloads-badge][]][npm-link]
7
- [![jsdelivr-badge][]][jsdelivr-link]
8
- [![npm-license-badge][]](LICENSE)
9
-
10
- > XY Labs generalized React library
11
-
12
- ## Table of Contents
3
+ [![npm][npm-badge]][npm-link]
13
4
 
14
- - [Description](#description)
15
- - [Install](#install)
16
- - [Maintainers](#maintainers)
17
- - [License](#license)
18
- - [Credits](#credits)
19
-
20
- ## Description
21
-
22
- Common React code that is used throughout XYO projects that use React.
5
+ > Common React library for all XY Labs projects that use React
23
6
 
24
7
  ## Install
25
8
 
26
- Using npm:
27
-
28
9
  ```sh
29
- npm i --save @xylabs/react-webapp
10
+ npm install {{name}}
30
11
  ```
31
12
 
32
- Using yarn:
13
+ or
33
14
 
34
15
  ```sh
35
- yarn add @xylabs/react-webapp
16
+ yarn add {{name}}
36
17
  ```
37
18
 
38
- ## Documentation
39
- [Developer Reference](https://xylabs.github.io/sdk-react)
40
-
41
- [Storybook](https://xylabs.github.io/sdk-react/storybook)
42
-
43
- ## Maintainers
44
-
45
- - [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))
46
- - [Matt Jones](https://github.com/jonesmac)
47
- - [Joel Carter](https://github.com/JoelBCarter)
48
- - [Jordan Trouw](https://github.com/jordantrouw)
49
19
 
50
20
  ## License
51
21
 
52
- See the [LICENSE](LICENSE) file for license details
22
+ See the [LICENSE](LICENSE) file for license rights and limitations (LGPL-3.0-only).
53
23
 
54
- ## Credits
55
24
 
56
- [Made with 🔥and ❄️ by XY Labs](https://xylabs.com)
57
-
58
- [logo]: https://cdn.xy.company/img/brand/XYPersistentCompany_Logo_Icon_Colored.svg
59
25
 
60
26
  [npm-badge]: https://img.shields.io/npm/v/@xylabs/react-webapp.svg
61
27
  [npm-link]: https://www.npmjs.com/package/@xylabs/react-webapp
62
-
63
- [npm-downloads-badge]: https://img.shields.io/npm/dw/@xylabs/react-webapp
64
- [npm-license-badge]: https://img.shields.io/npm/l/@xylabs/react-webapp
65
-
66
- [jsdelivr-badge]: https://data.jsdelivr.com/v1/package/npm/@xylabs/react-webapp/badge
67
- [jsdelivr-link]: https://www.jsdelivr.com/package/npm/@xylabs/react-webapp
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/react-webapp",
3
- "version": "7.1.16",
3
+ "version": "7.1.20",
4
4
  "description": "Common React library for all XY Labs projects that use React",
5
5
  "keywords": [
6
6
  "utility",
@@ -31,60 +31,69 @@
31
31
  "default": "./dist/browser/index.mjs"
32
32
  },
33
33
  "types": "./dist/browser/index.d.ts",
34
+ "import": "./dist/browser/index.mjs",
34
35
  "default": "./dist/browser/index.mjs"
35
36
  },
36
37
  "./package.json": "./package.json"
37
38
  },
38
- "module": "dist/browser/index.mjs",
39
39
  "types": "dist/browser/index.d.ts",
40
40
  "files": [
41
41
  "dist",
42
- "src"
42
+ "README.md"
43
43
  ],
44
44
  "dependencies": {
45
- "@xylabs/react-app-settings": "~7.1.16",
46
- "@xylabs/react-appbar": "~7.1.16",
47
- "@xylabs/react-async-effect": "~7.1.16",
48
- "@xylabs/react-button": "~7.1.16",
49
- "@xylabs/react-error": "~7.1.16",
50
- "@xylabs/react-flexbox": "~7.1.16",
51
- "@xylabs/react-pixel": "~7.1.16",
52
- "@xylabs/react-shared": "~7.1.16",
53
- "@xylabs/sdk-js": "~5.0.65",
54
- "react-helmet": "~6.1.0"
45
+ "@xylabs/sdk-js": "~5.0.95",
46
+ "react-router-dom": "~7.14.0",
47
+ "@xylabs/react-app-settings": "~7.1.20",
48
+ "@xylabs/react-appbar": "~7.1.20",
49
+ "@xylabs/react-button": "~7.1.20",
50
+ "@xylabs/react-error": "~7.1.20",
51
+ "@xylabs/react-flexbox": "~7.1.20",
52
+ "@xylabs/react-shared": "~7.1.20",
53
+ "@xylabs/react-pixel": "~7.1.20"
55
54
  },
56
55
  "devDependencies": {
57
- "@mui/icons-material": "~7.3.7",
58
- "@mui/material": "~7.3.7",
59
- "@storybook/react-vite": "~10.2.3",
60
- "@types/react": "^19.2.10",
56
+ "@mui/material": "~7.3.9",
57
+ "@opentelemetry/api": "^1.9.1",
58
+ "@storybook/react-vite": "~10.3.4",
59
+ "@types/node": "~25.5.2",
60
+ "@types/react": "^19.2.14",
61
61
  "@types/react-helmet": "~6.1.11",
62
- "@xylabs/react-button": "~7.1.16",
63
- "@xylabs/react-flexbox": "~7.1.16",
64
- "@xylabs/react-link": "~7.1.16",
65
- "@xylabs/react-pixel": "~7.1.16",
66
- "@xylabs/ts-scripts-yarn3": "~7.3.2",
67
- "@xylabs/tsconfig": "~7.3.2",
68
- "@xylabs/tsconfig-dom": "~7.3.2",
69
- "@xylabs/tsconfig-react": "~7.3.2",
62
+ "@xylabs/ts-scripts-common": "~7.8.5",
63
+ "@xylabs/ts-scripts-pnpm": "~7.8.5",
64
+ "@xylabs/tsconfig": "~7.8",
65
+ "@xylabs/tsconfig-dom": "~7.8.5",
66
+ "@xylabs/tsconfig-react": "~7.8.5",
67
+ "@xylabs/zod": "~5.0.95",
68
+ "axios": "^1.14.0",
69
+ "esbuild": "^0.28.0",
70
+ "pako": "~2.1.0",
70
71
  "react": "^19.2.4",
71
72
  "react-dom": "^19.2.4",
72
- "react-router-dom": "^7.13.0",
73
- "storybook": "~10.2.3",
73
+ "react-helmet": "~6.1.0",
74
+ "react-is": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
75
+ "storybook": "~10.3.4",
74
76
  "typescript": "^5.9.3",
75
- "vite": "~7.3.1",
76
- "zod": "^4.3.6"
77
+ "vite": "~8.0.5",
78
+ "zod": "^4.3.6",
79
+ "@xylabs/react-async-effect": "~7.1.20",
80
+ "@xylabs/react-dialogs": "~7.1.20",
81
+ "@xylabs/react-link": "~7.1.20",
82
+ "@xylabs/react-promise": "~7.1.20",
83
+ "@xylabs/react-quick-tip-button": "~7.1.20"
77
84
  },
78
85
  "peerDependencies": {
79
- "@mui/icons-material": ">=6 <8",
80
86
  "@mui/material": ">=6 <8",
87
+ "@xylabs/zod": "~5.0.95",
88
+ "pako": "~2.1.0",
81
89
  "react": "^19",
82
- "react-dom": "^19",
83
- "react-router-dom": "^7",
84
- "zod": "^4"
90
+ "react-helmet": "~6.1.0",
91
+ "react-is": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
92
+ "@xylabs/react-quick-tip-button": "~7.1.20",
93
+ "@xylabs/react-async-effect": "~7.1.20"
85
94
  },
86
95
  "publishConfig": {
87
96
  "access": "public"
88
97
  },
89
98
  "docs": "dist/docs.json"
90
- }
99
+ }
@@ -1,9 +0,0 @@
1
- import type { Meta } from '@storybook/react-vite';
2
- import { WebAppChrome } from './Chrome.tsx';
3
- declare const StorybookEntry: Meta<typeof WebAppChrome>;
4
- declare const Default: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("./Chrome.tsx").WebAppChromeProps>;
5
- declare const DefaultSideBar: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("./Chrome.tsx").WebAppChromeProps>;
6
- declare const WithFixedSizePage: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("./Chrome.tsx").WebAppChromeProps>;
7
- export { Default, DefaultSideBar, WithFixedSizePage, };
8
- export default StorybookEntry;
9
- //# sourceMappingURL=Chrome.stories.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Chrome.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Chrome.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,uBAAuB,CAAA;AAO1D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAI3C,QAAA,MAAM,cAAc,EAKf,IAAI,CAAC,OAAO,YAAY,CAAC,CAAA;AAwC9B,QAAA,MAAM,OAAO,uIAAoB,CAAA;AAGjC,QAAA,MAAM,cAAc,uIAAoB,CAAA;AAGxC,QAAA,MAAM,iBAAiB,uIAAoB,CAAA;AAG3C,OAAO,EACL,OAAO,EAAE,cAAc,EAAE,iBAAiB,GAC3C,CAAA;AAED,eAAe,cAAc,CAAA"}
@@ -1,10 +0,0 @@
1
- import type { Meta } from '@storybook/react-vite';
2
- import { NotFound } from '@xylabs/react-shared';
3
- import React from 'react';
4
- declare const StorybookEntry: Meta<typeof NotFound>;
5
- declare const Default: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & import("@mui/material/OverridableComponent").CommonProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("@mui/material/OverridableComponent").CommonProps | keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & {
6
- component?: React.ElementType;
7
- }>;
8
- export { Default };
9
- export default StorybookEntry;
10
- //# sourceMappingURL=Page.stories.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Page.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/NotFoundPage/Page.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,QAAA,MAAM,cAAc,EAKf,IAAI,CAAC,OAAO,QAAQ,CAAC,CAAA;AAM1B,QAAA,MAAM,OAAO;;EAAoB,CAAA;AAGjC,OAAO,EAAE,OAAO,EAAE,CAAA;AAElB,eAAe,cAAc,CAAA"}
@@ -1,102 +0,0 @@
1
- import type { Breakpoint } from '@mui/material'
2
- import { styled } from '@mui/material'
3
- import type { FlexBoxProps } from '@xylabs/react-flexbox'
4
- import { FlexGrowCol, FlexRow } from '@xylabs/react-flexbox'
5
- import type { ReactNode } from 'react'
6
- import React from 'react'
7
-
8
- import { fixedContent, scrollableContent } from './lib/index.ts'
9
-
10
- const WebAppBodyName = 'WebAppBody'
11
- const propsNotForwarded = new Set(['mobileScrollingBreakpoint', 'variant', 'spacing', 'disableBreadcrumbGutter'])
12
- const defaultStyledOptions = { shouldForwardProp: (prop: string) => !propsNotForwarded.has(prop) }
13
-
14
- const WebAppBodyRoot = styled(FlexGrowCol, {
15
- ...defaultStyledOptions,
16
- name: WebAppBodyName,
17
- slot: 'Root',
18
- })<WebAppBodyProps>(({
19
- spacing, theme, mobileScrollingBreakpoint = 'sm', variant,
20
- }) => {
21
- const scrollable = variant === 'scrollable'
22
- return theme.unstable_sx({
23
- alignItems: 'stretch',
24
- gap: 1,
25
- justifyContent: 'flex-start',
26
- overflowX: 'visible',
27
- overflowY: scrollable ? 'scroll' : 'hidden',
28
- paddingY: spacing,
29
- [theme.breakpoints.down(mobileScrollingBreakpoint)]: { overflowY: 'scroll' },
30
- })
31
- })
32
-
33
- const WebAppBodyBreadcrumb = styled(FlexRow, {
34
- ...defaultStyledOptions,
35
- name: WebAppBodyName,
36
- slot: 'Breadcrumb',
37
- })<WebAppBodyProps>(({
38
- theme, disableBreadcrumbGutter, spacing,
39
- }) =>
40
- theme.unstable_sx({
41
- justifyContent: 'start',
42
- marginX: disableBreadcrumbGutter ? 0 : spacing,
43
- }))
44
-
45
- const WebAppBodyScrollableWrapper = styled(FlexGrowCol, {
46
- name: WebAppBodyName,
47
- slot: 'ScrollableWrapper',
48
- })<WebAppBodyProps>(() => ({ alignItems: 'stretch' }))
49
-
50
- const WebAppBodyScrollable = styled(FlexGrowCol, {
51
- ...defaultStyledOptions,
52
- name: WebAppBodyName,
53
- slot: 'Scrollable',
54
- })<WebAppBodyProps>(({
55
- theme, mobileScrollingBreakpoint = 'sm', variant,
56
- }) => {
57
- const props = variant === 'scrollable' ? scrollableContent : fixedContent
58
- return {
59
- ...props,
60
- alignItems: 'stretch',
61
- justifyContent: 'start',
62
- [theme.breakpoints.down(mobileScrollingBreakpoint)]: {
63
- inset: 'unset',
64
- position: 'relative',
65
- },
66
- }
67
- })
68
-
69
- export interface WebAppBodyProps extends FlexBoxProps {
70
- breadcrumbs?: ReactNode
71
- disableBreadcrumbGutter?: boolean
72
- mobileScrollingBreakpoint?: Breakpoint
73
- spacing?: string | number
74
- variant?: 'scrollable' | 'fixed'
75
- }
76
-
77
- export const WebAppBody: React.FC<WebAppBodyProps> = ({
78
- children,
79
- breadcrumbs,
80
- disableBreadcrumbGutter,
81
- mobileScrollingBreakpoint,
82
- spacing = 1,
83
- variant,
84
- ...props
85
- }) => {
86
- return (
87
- <WebAppBodyRoot mobileScrollingBreakpoint={mobileScrollingBreakpoint} spacing={spacing} variant={variant} {...props}>
88
- {breadcrumbs
89
- ? (
90
- <WebAppBodyBreadcrumb disableBreadcrumbGutter={disableBreadcrumbGutter} spacing={spacing}>
91
- {breadcrumbs}
92
- </WebAppBodyBreadcrumb>
93
- )
94
- : null}
95
- <WebAppBodyScrollableWrapper>
96
- <WebAppBodyScrollable mobileScrollingBreakpoint={mobileScrollingBreakpoint} variant={variant}>
97
- {children}
98
- </WebAppBodyScrollable>
99
- </WebAppBodyScrollableWrapper>
100
- </WebAppBodyRoot>
101
- )
102
- }
@@ -1,71 +0,0 @@
1
- import { Breadcrumbs, List } from '@mui/material'
2
- import type { Meta, StoryFn } from '@storybook/react-vite'
3
- import { MenuListItemContainer } from '@xylabs/react-appbar'
4
- import { FlexRow } from '@xylabs/react-flexbox'
5
- import { LinkEx } from '@xylabs/react-link'
6
- import React from 'react'
7
- import { BrowserRouter } from 'react-router-dom'
8
-
9
- import { WebAppChrome } from './Chrome.tsx'
10
- import type { WebAppPageProps } from './Page.tsx'
11
- import { WebAppPage } from './Page.tsx'
12
-
13
- const StorybookEntry = {
14
- argTypes: {},
15
- component: WebAppChrome,
16
- parameters: { docs: { page: null } },
17
- title: 'webapp/WebAppChrome',
18
- } as Meta<typeof WebAppChrome>
19
-
20
- const rowArray = [32, 64, 128, 256, 512, 1024]
21
-
22
- const Children: React.FC<WebAppPageProps> = props => (
23
- <WebAppPage
24
- breadcrumbs={(
25
- <Breadcrumbs>
26
- <LinkEx>BreadCrumbs</LinkEx>
27
- </Breadcrumbs>
28
- )}
29
- {...props}
30
- >
31
- {rowArray.map((height) => {
32
- return (
33
- <FlexRow key={height} height={height}>
34
- {height}
35
- </FlexRow>
36
- )
37
- })}
38
- </WebAppPage>
39
- )
40
-
41
- const Template: StoryFn<typeof WebAppChrome> = (args) => {
42
- return (
43
- <BrowserRouter>
44
- <WebAppChrome
45
- menuItems={(
46
- <List>
47
- <MenuListItemContainer primary="Hello" />
48
- </List>
49
- )}
50
- height="calc(100vh - 2rem)"
51
- {...args}
52
- >
53
- </WebAppChrome>
54
- </BrowserRouter>
55
- )
56
- }
57
-
58
- const Default = Template.bind({})
59
- Default.args = {}
60
-
61
- const DefaultSideBar = Template.bind({})
62
- DefaultSideBar.args = { children: <Children />, navigationType: 'sidebar' }
63
-
64
- const WithFixedSizePage = Template.bind({})
65
- WithFixedSizePage.args = { children: <Children variant="fixed" />, navigationType: 'sidebar' }
66
-
67
- export {
68
- Default, DefaultSideBar, WithFixedSizePage,
69
- }
70
-
71
- export default StorybookEntry
@@ -1,67 +0,0 @@
1
- import { Divider, Paper } from '@mui/material'
2
- import type { WebAppNavigationType } from '@xylabs/react-app-settings'
3
- import { ApplicationAppBar, SystemToolbar } from '@xylabs/react-appbar'
4
- import { ErrorBoundary } from '@xylabs/react-error'
5
- import type { FlexBoxProps } from '@xylabs/react-flexbox'
6
- import {
7
- FlexCol, FlexGrowCol, FlexGrowRow,
8
- } from '@xylabs/react-flexbox'
9
- import type { ReactNode } from 'react'
10
- import React from 'react'
11
- import { Helmet } from 'react-helmet'
12
-
13
- import { WebAppErrorPage } from './ErrorPage.tsx'
14
-
15
- export interface WebAppChromeProps extends FlexBoxProps {
16
- appName: string
17
- appbar?: ReactNode
18
- errorBoundary?: boolean
19
- errorPage?: ReactNode
20
- footer?: ReactNode
21
- footerElevation?: number
22
- menuItems?: ReactNode
23
- navigationType?: WebAppNavigationType
24
- }
25
-
26
- export const WebAppChrome = ({
27
- ref, appName, appbar, children, errorBoundary, errorPage, footer, footerElevation = 4, menuItems, navigationType = 'menu', ...props
28
- }: WebAppChromeProps) => {
29
- return (
30
- <FlexCol id="web-chrome-flex" alignItems="stretch" overflow="hidden" height="100vh" ref={ref} {...props}>
31
- <Helmet defaultTitle={appName} titleTemplate={`%s | ${appName}`}>
32
- <meta content="website" property="og:type" />
33
- </Helmet>
34
- {appbar ?? <ApplicationAppBar systemToolbar={<SystemToolbar menuItems={navigationType === 'menu' ? menuItems : undefined} />} />}
35
- <FlexGrowRow id="sidebar-nav-flex" overflow="hidden" alignItems="stretch">
36
- {navigationType === 'menu'
37
- ? null
38
- : (
39
- <>
40
- {menuItems}
41
- <Divider orientation="vertical" />
42
- </>
43
- )}
44
- <FlexGrowCol id="main-flex" justifyContent="flex-start" alignItems="stretch">
45
- {errorBoundary
46
- ? (
47
- <ErrorBoundary
48
- fallbackWithError={(error) => {
49
- return errorPage ?? <WebAppErrorPage error={error} />
50
- }}
51
- >
52
- {children}
53
- </ErrorBoundary>
54
- )
55
- : children}
56
- </FlexGrowCol>
57
- </FlexGrowRow>
58
- <FlexCol id="footer-flex" alignItems="stretch">
59
- <Paper elevation={footerElevation} square>
60
- {footer}
61
- </Paper>
62
- </FlexCol>
63
- </FlexCol>
64
- )
65
- }
66
-
67
- WebAppChrome.displayName = 'WebAppChrome'
@@ -1,22 +0,0 @@
1
- import { ButtonEx } from '@xylabs/react-button'
2
- import React from 'react'
3
-
4
- import type { WebAppPageProps } from './Page.tsx'
5
- import { WebAppPage } from './Page.tsx'
6
-
7
- export interface WebAppErrorPageProps extends WebAppPageProps {
8
- error?: Error
9
- }
10
-
11
- export const WebAppErrorPage: React.FC<WebAppErrorPageProps> = ({ error, ...props }) => (
12
- <WebAppPage title="Oops! Something went wrong" {...props}>
13
- <h1>Oops! Something went wrong!</h1>
14
- <p>{`${error}`}</p>
15
- <ButtonEx href="/" variant="contained">
16
- Homepage
17
- </ButtonEx>
18
- </WebAppPage>
19
- )
20
-
21
- /** @deprecated use WebAppErrorPage instead */
22
- export const ErrorPage = WebAppErrorPage
@@ -1,21 +0,0 @@
1
- import type { Meta, StoryFn } from '@storybook/react-vite'
2
- import { NotFound } from '@xylabs/react-shared'
3
- import React from 'react'
4
-
5
- const StorybookEntry = {
6
- argTypes: {},
7
- component: NotFound,
8
- parameters: { docs: { page: null } },
9
- title: 'webapp/NotFound',
10
- } as Meta<typeof NotFound>
11
-
12
- const Template: StoryFn<typeof NotFound> = () => {
13
- return <NotFound />
14
- }
15
-
16
- const Default = Template.bind({})
17
- Default.args = {}
18
-
19
- export { Default }
20
-
21
- export default StorybookEntry
@@ -1,14 +0,0 @@
1
- import { NotFound } from '@xylabs/react-shared'
2
- import React from 'react'
3
-
4
- import type { WebAppPageProps } from '../Page.tsx'
5
- import { WebAppPage } from '../Page.tsx'
6
-
7
- export const WebAppNotFoundPage: React.FC<WebAppPageProps> = ({ title, ...props }) => (
8
- <WebAppPage title={title ?? 'Sorry! Page Not Found'} {...props}>
9
- <NotFound />
10
- </WebAppPage>
11
- )
12
-
13
- /** @deprecated use WebAppNotFoundPage instead */
14
- export const NotFoundPage = WebAppNotFoundPage
@@ -1 +0,0 @@
1
- export * from './Page.tsx'
@@ -1,103 +0,0 @@
1
- import type { ContainerProps } from '@mui/material'
2
- import { Container, styled } from '@mui/material'
3
- import { useAsyncEffect } from '@xylabs/react-async-effect'
4
- import type { FlexBoxProps } from '@xylabs/react-flexbox'
5
- import { FlexGrowCol } from '@xylabs/react-flexbox'
6
- import { useUserEvents } from '@xylabs/react-pixel'
7
- import { isDefined } from '@xylabs/sdk-js'
8
- import type { PropsWithChildren } from 'react'
9
- import React from 'react'
10
- import { Helmet } from 'react-helmet'
11
- import { useLocation } from 'react-router-dom'
12
-
13
- import type { WebAppBodyProps } from './Body.tsx'
14
- import { WebAppBody } from './Body.tsx'
15
- import { fixedWrap, scrollableWrap } from './lib/index.ts'
16
-
17
- const WebAppPageRoot = styled(FlexGrowCol, {
18
- name: 'WebAppPage',
19
- shouldForwardProp: propName => propName !== 'mobileScrollingBreakpoint' && propName !== 'variant',
20
- slot: 'Root',
21
- })<WebAppPageProps>(({
22
- theme, mobileScrollingBreakpoint = 'sm', variant,
23
- }) => {
24
- const props = variant === 'scrollable' ? scrollableWrap : fixedWrap
25
- return {
26
- ...props,
27
- alignItems: 'stretch',
28
- justifyContent: 'start',
29
- maxWidth: '100vw',
30
- [theme.breakpoints.down(mobileScrollingBreakpoint)]: {
31
- inset: 0,
32
- position: 'absolute',
33
- },
34
- }
35
- })
36
-
37
- export interface WebAppPageProps extends WebAppBodyProps, FlexBoxProps {
38
- container?: ContainerProps['maxWidth'] | 'none'
39
- disableGutters?: boolean
40
- }
41
-
42
- export const WebAppPage: React.FC<PropsWithChildren<WebAppPageProps>> = ({
43
- disableGutters,
44
- disableBreadcrumbGutter,
45
- title,
46
- container,
47
- children,
48
- breadcrumbs,
49
- mobileScrollingBreakpoint,
50
- variant = 'scrollable',
51
- ...props
52
- }) => {
53
- const userEvents = useUserEvents()
54
- const { pathname } = useLocation()
55
-
56
- useAsyncEffect(
57
- async () => {
58
- await userEvents?.viewContent({ name: title ?? 'NodeBasePage', path: location.pathname })
59
- },
60
- [pathname, title, userEvents],
61
- )
62
-
63
- return (
64
- <WebAppPageRoot mobileScrollingBreakpoint={mobileScrollingBreakpoint} variant={variant} {...props}>
65
- <Helmet title={title} />
66
- {isDefined(container) && container !== 'none'
67
- ? (
68
- <Container
69
- disableGutters={disableGutters}
70
- style={{
71
- alignItems: 'stretch', display: 'flex', flexDirection: 'column', flexGrow: 1, justifyContent: 'flex-start',
72
- }}
73
- maxWidth={container}
74
- >
75
- <WebAppBody
76
- disableBreadcrumbGutter={disableBreadcrumbGutter}
77
- breadcrumbs={breadcrumbs}
78
- mobileScrollingBreakpoint={mobileScrollingBreakpoint}
79
- variant={variant}
80
- {...props}
81
- >
82
- {children}
83
- </WebAppBody>
84
- </Container>
85
- )
86
- : (
87
- <WebAppBody
88
- disableBreadcrumbGutter={disableBreadcrumbGutter}
89
- breadcrumbs={breadcrumbs}
90
- mobileScrollingBreakpoint={mobileScrollingBreakpoint}
91
- paddingX={disableGutters ? 0 : 1}
92
- variant={variant}
93
- {...props}
94
- >
95
- {children}
96
- </WebAppBody>
97
- )}
98
- </WebAppPageRoot>
99
- )
100
- }
101
-
102
- /** @deprecated use WebAppPagePage instead */
103
- export const FlexPage = WebAppPage
@@ -1,5 +0,0 @@
1
- export * from './Body.tsx'
2
- export * from './Chrome.tsx'
3
- export * from './ErrorPage.tsx'
4
- export * from './NotFoundPage/index.ts'
5
- export * from './Page.tsx'
@@ -1,16 +0,0 @@
1
- import type { 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 = { ...fixedWrap } as const
15
-
16
- export const fixedContent: CSSProperties = { ...scrollableWrap } as const
@@ -1 +0,0 @@
1
- export * from './cssValues.ts'
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './components/index.ts'