@xylabs/react-webapp 7.1.17 → 7.2.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/README.md +6 -46
- package/package.json +74 -38
- package/src/components/Body.tsx +0 -102
- package/src/components/Chrome.stories.tsx +0 -71
- package/src/components/Chrome.tsx +0 -67
- package/src/components/ErrorPage.tsx +0 -22
- package/src/components/NotFoundPage/Page.stories.tsx +0 -21
- package/src/components/NotFoundPage/Page.tsx +0 -14
- package/src/components/NotFoundPage/index.ts +0 -1
- package/src/components/Page.tsx +0 -103
- package/src/components/index.ts +0 -5
- package/src/components/lib/cssValues.ts +0 -16
- package/src/components/lib/index.ts +0 -1
- package/src/index.ts +0 -1
package/README.md
CHANGED
|
@@ -1,67 +1,27 @@
|
|
|
1
|
-
[![logo][]](https://xylabs.com)
|
|
2
|
-
|
|
3
1
|
# @xylabs/react-webapp
|
|
4
2
|
|
|
5
|
-
[![npm-badge]
|
|
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
|
-
|
|
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
|
|
10
|
+
npm install {{name}}
|
|
30
11
|
```
|
|
31
12
|
|
|
32
|
-
|
|
13
|
+
or
|
|
33
14
|
|
|
34
15
|
```sh
|
|
35
|
-
yarn add
|
|
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
|
|
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.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "Common React library for all XY Labs projects that use React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"utility",
|
|
@@ -35,56 +35,92 @@
|
|
|
35
35
|
},
|
|
36
36
|
"./package.json": "./package.json"
|
|
37
37
|
},
|
|
38
|
-
"module": "dist/browser/index.mjs",
|
|
39
|
-
"types": "dist/browser/index.d.ts",
|
|
40
38
|
"files": [
|
|
41
39
|
"dist",
|
|
42
|
-
"
|
|
40
|
+
"README.md"
|
|
43
41
|
],
|
|
44
42
|
"dependencies": {
|
|
45
|
-
"@xylabs/react-app-settings": "~7.
|
|
46
|
-
"@xylabs/react-appbar": "~7.
|
|
47
|
-
"@xylabs/react-async-effect": "~7.
|
|
48
|
-
"@xylabs/react-
|
|
49
|
-
"@xylabs/react-
|
|
50
|
-
"@xylabs/react-flexbox": "~7.
|
|
51
|
-
"@xylabs/react-
|
|
52
|
-
"@xylabs/react-
|
|
53
|
-
"@xylabs/sdk-js": "~5.0.80",
|
|
54
|
-
"react-helmet": "~6.1.0"
|
|
43
|
+
"@xylabs/react-app-settings": "~7.2.0",
|
|
44
|
+
"@xylabs/react-appbar": "~7.2.0",
|
|
45
|
+
"@xylabs/react-async-effect": "~7.2.0",
|
|
46
|
+
"@xylabs/react-error": "~7.2.0",
|
|
47
|
+
"@xylabs/react-button": "~7.2.0",
|
|
48
|
+
"@xylabs/react-flexbox": "~7.2.0",
|
|
49
|
+
"@xylabs/react-shared": "~7.2.0",
|
|
50
|
+
"@xylabs/react-pixel": "~7.2.0"
|
|
55
51
|
},
|
|
56
52
|
"devDependencies": {
|
|
57
|
-
"@mui/icons-material": "~7.3.
|
|
58
|
-
"@mui/material": "~7.3.
|
|
59
|
-
"@
|
|
53
|
+
"@mui/icons-material": "~7.3.10",
|
|
54
|
+
"@mui/material": "~7.3.10",
|
|
55
|
+
"@opentelemetry/api": "^1.9.1",
|
|
56
|
+
"@opentelemetry/sdk-trace-base": ">=2.7.1 <3",
|
|
57
|
+
"@react-spring/web": "~10.0.3",
|
|
58
|
+
"@storybook/react-vite": "~10.3.6",
|
|
59
|
+
"@types/node": "~25.6.0",
|
|
60
60
|
"@types/react": "^19.2.14",
|
|
61
61
|
"@types/react-helmet": "~6.1.11",
|
|
62
|
-
"@xylabs/
|
|
63
|
-
"@xylabs/
|
|
64
|
-
"@xylabs/
|
|
65
|
-
"@xylabs/
|
|
66
|
-
"@xylabs/
|
|
67
|
-
"@xylabs/tsconfig": "~7.
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
62
|
+
"@xylabs/pixel": "^5.1.0",
|
|
63
|
+
"@xylabs/sdk-js": "~5.1.0",
|
|
64
|
+
"@xylabs/toolchain": "~7.12.3",
|
|
65
|
+
"@xylabs/tsconfig": "~7.12.3",
|
|
66
|
+
"@xylabs/tsconfig-dom": "~7.12.3",
|
|
67
|
+
"@xylabs/tsconfig-react": "~7.12.3",
|
|
68
|
+
"async-mutex": ">=0.5.0 <0.6",
|
|
69
|
+
"bn.js": ">=5.2.3 <5.3",
|
|
70
|
+
"bowser": ">=2.14.1 <2.15",
|
|
71
|
+
"buffer": ">=6.0.3 <6.1",
|
|
72
|
+
"chalk": ">=5.6.2 <5.7",
|
|
73
|
+
"esbuild": "^0.28.0",
|
|
74
|
+
"eslint": ">=10.2.1 <11",
|
|
75
|
+
"ethers": ">=6.16.0 <7",
|
|
76
|
+
"fast-deep-equal": ">=3.1.3 <3.2",
|
|
77
|
+
"js-cookie": ">=3.0.5 <3.1",
|
|
78
|
+
"mixpanel-browser": "^2.78.0",
|
|
79
|
+
"pako": "~2.1.0",
|
|
80
|
+
"query-string": "~9.3.1",
|
|
81
|
+
"react": "^19.2.5",
|
|
82
|
+
"react-dom": "^19.2.5",
|
|
83
|
+
"react-helmet": "~6.1.0",
|
|
84
|
+
"react-is": "^19.2.5",
|
|
85
|
+
"react-router-dom": "~7.14.2",
|
|
86
|
+
"recharts": "~3.8.1",
|
|
87
|
+
"spark-md5": ">=3.0.2 <3.1",
|
|
88
|
+
"storybook": "~10.3.6",
|
|
74
89
|
"typescript": "^5.9.3",
|
|
75
|
-
"vite": "~
|
|
76
|
-
"zod": "^4.3
|
|
90
|
+
"vite": "~8.0.10",
|
|
91
|
+
"zod": "^4.4.3",
|
|
92
|
+
"@xylabs/react-link": "~7.2.0"
|
|
77
93
|
},
|
|
78
94
|
"peerDependencies": {
|
|
79
|
-
"@mui/icons-material": ">=
|
|
80
|
-
"@mui/material": ">=
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"react-
|
|
84
|
-
"
|
|
95
|
+
"@mui/icons-material": ">=7.3.10 <7.4",
|
|
96
|
+
"@mui/material": ">=7.3.10 <7.4",
|
|
97
|
+
"@opentelemetry/api": ">=1.9.1 <2",
|
|
98
|
+
"@opentelemetry/sdk-trace-base": ">=2.7.1 <3",
|
|
99
|
+
"@react-spring/web": ">=10.0.3 <10.1",
|
|
100
|
+
"@xylabs/pixel": ">=5.1.0 <6",
|
|
101
|
+
"@xylabs/sdk-js": ">=5.1.0 <5.2",
|
|
102
|
+
"async-mutex": ">=0.5.0 <1",
|
|
103
|
+
"bn.js": ">=5.2.3 <6",
|
|
104
|
+
"bowser": ">=2.14.1 <3",
|
|
105
|
+
"buffer": ">=6.0.3 <7",
|
|
106
|
+
"chalk": ">=5.6.2 <6",
|
|
107
|
+
"ethers": ">=6.16.0 <7",
|
|
108
|
+
"fast-deep-equal": ">=3.1.3 <4",
|
|
109
|
+
"js-cookie": ">=3.0.5 <4",
|
|
110
|
+
"mixpanel-browser": ">=2.78.0 <3",
|
|
111
|
+
"pako": ">=2.1.0 <2.2",
|
|
112
|
+
"query-string": ">=9.3.1 <9.4",
|
|
113
|
+
"react": ">=19.2.5 <20",
|
|
114
|
+
"react-dom": ">=19.2.5 <20",
|
|
115
|
+
"react-helmet": ">=6.1.0 <6.2",
|
|
116
|
+
"react-is": ">=19.2.5 <20",
|
|
117
|
+
"react-router-dom": ">=7.14.2 <7.15",
|
|
118
|
+
"recharts": ">=3.8.1 <3.9",
|
|
119
|
+
"spark-md5": ">=3.0.2 <4",
|
|
120
|
+
"zod": ">=4.4.3 <5"
|
|
85
121
|
},
|
|
86
122
|
"publishConfig": {
|
|
87
123
|
"access": "public"
|
|
88
124
|
},
|
|
89
125
|
"docs": "dist/docs.json"
|
|
90
|
-
}
|
|
126
|
+
}
|
package/src/components/Body.tsx
DELETED
|
@@ -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'
|
package/src/components/Page.tsx
DELETED
|
@@ -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
|
package/src/components/index.ts
DELETED
|
@@ -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'
|