@xylabs/react-webapp 5.2.8

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.
Files changed (39) hide show
  1. package/LICENSE +165 -0
  2. package/README.md +67 -0
  3. package/dist/browser/components/Body.d.ts +13 -0
  4. package/dist/browser/components/Body.d.ts.map +1 -0
  5. package/dist/browser/components/Chrome.d.ts +16 -0
  6. package/dist/browser/components/Chrome.d.ts.map +1 -0
  7. package/dist/browser/components/ErrorPage.d.ts +9 -0
  8. package/dist/browser/components/ErrorPage.d.ts.map +1 -0
  9. package/dist/browser/components/NotFoundPage/Page.d.ts +6 -0
  10. package/dist/browser/components/NotFoundPage/Page.d.ts.map +1 -0
  11. package/dist/browser/components/NotFoundPage/index.d.ts +2 -0
  12. package/dist/browser/components/NotFoundPage/index.d.ts.map +1 -0
  13. package/dist/browser/components/Page.d.ts +13 -0
  14. package/dist/browser/components/Page.d.ts.map +1 -0
  15. package/dist/browser/components/index.d.ts +6 -0
  16. package/dist/browser/components/index.d.ts.map +1 -0
  17. package/dist/browser/components/lib/cssValues.d.ts +6 -0
  18. package/dist/browser/components/lib/cssValues.d.ts.map +1 -0
  19. package/dist/browser/components/lib/index.d.ts +2 -0
  20. package/dist/browser/components/lib/index.d.ts.map +1 -0
  21. package/dist/browser/index.d.ts +2 -0
  22. package/dist/browser/index.d.ts.map +1 -0
  23. package/dist/browser/index.mjs +255 -0
  24. package/dist/browser/index.mjs.map +1 -0
  25. package/package.json +77 -0
  26. package/src/components/Body.tsx +102 -0
  27. package/src/components/Chrome.stories.tsx +71 -0
  28. package/src/components/Chrome.tsx +69 -0
  29. package/src/components/ErrorPage.tsx +22 -0
  30. package/src/components/NotFoundPage/Page.stories.tsx +21 -0
  31. package/src/components/NotFoundPage/Page.tsx +14 -0
  32. package/src/components/NotFoundPage/index.ts +1 -0
  33. package/src/components/Page.tsx +102 -0
  34. package/src/components/index.ts +5 -0
  35. package/src/components/lib/cssValues.ts +16 -0
  36. package/src/components/lib/index.ts +1 -0
  37. package/src/index.ts +1 -0
  38. package/typedoc.json +5 -0
  39. package/xy.config.ts +10 -0
package/LICENSE ADDED
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
package/README.md ADDED
@@ -0,0 +1,67 @@
1
+ [![logo][]](https://xylabs.com)
2
+
3
+ # @xylabs/react-webapp
4
+
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
13
+
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.
23
+
24
+ ## Install
25
+
26
+ Using npm:
27
+
28
+ ```sh
29
+ npm i --save @xylabs/react-webapp
30
+ ```
31
+
32
+ Using yarn:
33
+
34
+ ```sh
35
+ yarn add @xylabs/react-webapp
36
+ ```
37
+
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
+
50
+ ## License
51
+
52
+ See the [LICENSE](LICENSE) file for license details
53
+
54
+ ## Credits
55
+
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
+
60
+ [npm-badge]: https://img.shields.io/npm/v/@xylabs/react-webapp.svg
61
+ [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
@@ -0,0 +1,13 @@
1
+ import type { Breakpoint } from '@mui/material';
2
+ import type { FlexBoxProps } from '@xylabs/react-flexbox';
3
+ import type { ReactNode } from 'react';
4
+ import React from 'react';
5
+ export interface WebAppBodyProps extends FlexBoxProps {
6
+ breadcrumbs?: ReactNode;
7
+ disableBreadcrumbGutter?: boolean;
8
+ mobileScrollingBreakpoint?: Breakpoint;
9
+ spacing?: string | number;
10
+ variant?: 'scrollable' | 'fixed';
11
+ }
12
+ export declare const WebAppBody: React.FC<WebAppBodyProps>;
13
+ //# 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,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,MAAM,OAAO,CAAA;AA+DzB,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACnD,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,yBAAyB,CAAC,EAAE,UAAU,CAAA;IACtC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAA;CACjC;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAyBhD,CAAA"}
@@ -0,0 +1,16 @@
1
+ import type { WebAppNavigationType } from '@xylabs/react-app-settings';
2
+ import type { FlexBoxProps } from '@xylabs/react-flexbox';
3
+ import type { ReactNode } from 'react';
4
+ import React from 'react';
5
+ export interface WebAppChromeProps extends FlexBoxProps {
6
+ appName: string;
7
+ appbar?: ReactNode;
8
+ errorBoundary?: boolean;
9
+ errorPage?: ReactNode;
10
+ footer?: ReactNode;
11
+ footerElevation?: number;
12
+ menuItems?: ReactNode;
13
+ navigationType?: WebAppNavigationType;
14
+ }
15
+ export declare const WebAppChrome: React.ForwardRefExoticComponent<WebAppChromeProps & React.RefAttributes<HTMLDivElement>>;
16
+ //# sourceMappingURL=Chrome.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Chrome.d.ts","sourceRoot":"","sources":["../../../src/components/Chrome.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAGtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAIzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAqB,MAAM,OAAO,CAAA;AAKzC,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,cAAc,CAAC,EAAE,oBAAoB,CAAA;CACtC;AAED,eAAO,MAAM,YAAY,0FAyCxB,CAAA"}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { WebAppPageProps } from './Page.tsx';
3
+ export interface WebAppErrorPageProps extends WebAppPageProps {
4
+ error?: Error;
5
+ }
6
+ export declare const WebAppErrorPage: React.FC<WebAppErrorPageProps>;
7
+ /** @deprecated use WebAppErrorPage instead */
8
+ export declare const ErrorPage: React.FC<WebAppErrorPageProps>;
9
+ //# sourceMappingURL=ErrorPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorPage.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorPage.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAGjD,MAAM,WAAW,oBAAqB,SAAQ,eAAe;IAC3D,KAAK,CAAC,EAAE,KAAK,CAAA;CACd;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAQ1D,CAAA;AAED,8CAA8C;AAC9C,eAAO,MAAM,SAAS,gCAAkB,CAAA"}
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import type { WebAppPageProps } from '../Page.tsx';
3
+ export declare const WebAppNotFoundPage: React.FC<WebAppPageProps>;
4
+ /** @deprecated use WebAppNotFoundPage instead */
5
+ export declare const NotFoundPage: React.FC<WebAppPageProps>;
6
+ //# sourceMappingURL=Page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Page.d.ts","sourceRoot":"","sources":["../../../../src/components/NotFoundPage/Page.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAGlD,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAIxD,CAAA;AAED,kDAAkD;AAClD,eAAO,MAAM,YAAY,2BAAqB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './Page.tsx';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/NotFoundPage/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
@@ -0,0 +1,13 @@
1
+ import type { ContainerProps } from '@mui/material';
2
+ import type { FlexBoxProps } from '@xylabs/react-flexbox';
3
+ import type { PropsWithChildren } from 'react';
4
+ import React from 'react';
5
+ import type { WebAppBodyProps } from './Body.tsx';
6
+ export interface WebAppPageProps extends WebAppBodyProps, FlexBoxProps {
7
+ container?: ContainerProps['maxWidth'] | 'none';
8
+ disableGutters?: boolean;
9
+ }
10
+ export declare const WebAppPage: React.FC<PropsWithChildren<WebAppPageProps>>;
11
+ /** @deprecated use WebAppPagePage instead */
12
+ export declare const FlexPage: React.FC<PropsWithChildren<WebAppPageProps>>;
13
+ //# sourceMappingURL=Page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Page.d.ts","sourceRoot":"","sources":["../../../src/components/Page.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAGnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAGzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAwBjD,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,iBAAiB,CAAC,eAAe,CAAC,CA0DnE,CAAA;AAED,6CAA6C;AAC7C,eAAO,MAAM,QAAQ,8CAAa,CAAA"}
@@ -0,0 +1,6 @@
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';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,yBAAyB,CAAA;AACvC,cAAc,YAAY,CAAA"}
@@ -0,0 +1,6 @@
1
+ import type { 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,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAE1C,eAAO,MAAM,cAAc,EAAE,aAGnB,CAAA;AAEV,eAAO,MAAM,SAAS,EAAE,aAGd,CAAA;AAGV,eAAO,MAAM,iBAAiB,EAAE,aAAyC,CAAA;AAEzE,eAAO,MAAM,YAAY,EAAE,aAA8C,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './cssValues.ts';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './components/index.ts';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA"}
@@ -0,0 +1,255 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/components/Body.tsx
5
+ import { styled } from "@mui/material";
6
+ import { FlexGrowCol, FlexRow } from "@xylabs/react-flexbox";
7
+ import React from "react";
8
+
9
+ // src/components/lib/cssValues.ts
10
+ var scrollableWrap = {
11
+ inset: 0,
12
+ position: "absolute"
13
+ };
14
+ var fixedWrap = {
15
+ inset: "unset",
16
+ position: "relative"
17
+ };
18
+ var scrollableContent = {
19
+ ...fixedWrap
20
+ };
21
+ var fixedContent = {
22
+ ...scrollableWrap
23
+ };
24
+
25
+ // src/components/Body.tsx
26
+ var WebAppBodyName = "WebAppBody";
27
+ var propsNotForwarded = /* @__PURE__ */ new Set([
28
+ "mobileScrollingBreakpoint",
29
+ "variant",
30
+ "spacing",
31
+ "disableBreadcrumbGutter"
32
+ ]);
33
+ var defaultStyledOptions = {
34
+ shouldForwardProp: /* @__PURE__ */ __name((prop) => !propsNotForwarded.has(prop), "shouldForwardProp")
35
+ };
36
+ var WebAppBodyRoot = styled(FlexGrowCol, {
37
+ ...defaultStyledOptions,
38
+ name: WebAppBodyName,
39
+ slot: "Root"
40
+ })(({ spacing, theme, mobileScrollingBreakpoint = "sm", variant }) => {
41
+ const scrollable = variant === "scrollable";
42
+ return theme.unstable_sx({
43
+ alignItems: "stretch",
44
+ gap: 1,
45
+ justifyContent: "flex-start",
46
+ overflowX: "visible",
47
+ overflowY: scrollable ? "scroll" : "hidden",
48
+ paddingY: spacing,
49
+ [theme.breakpoints.down(mobileScrollingBreakpoint)]: {
50
+ overflowY: "scroll"
51
+ }
52
+ });
53
+ });
54
+ var WebAppBodyBreadcrumb = styled(FlexRow, {
55
+ ...defaultStyledOptions,
56
+ name: WebAppBodyName,
57
+ slot: "Breadcrumb"
58
+ })(({ theme, disableBreadcrumbGutter, spacing }) => theme.unstable_sx({
59
+ justifyContent: "start",
60
+ marginX: disableBreadcrumbGutter ? 0 : spacing
61
+ }));
62
+ var WebAppBodyScrollableWrapper = styled(FlexGrowCol, {
63
+ name: WebAppBodyName,
64
+ slot: "ScrollableWrapper"
65
+ })(() => ({
66
+ alignItems: "stretch"
67
+ }));
68
+ var WebAppBodyScrollable = styled(FlexGrowCol, {
69
+ ...defaultStyledOptions,
70
+ name: WebAppBodyName,
71
+ slot: "Scrollable"
72
+ })(({ theme, mobileScrollingBreakpoint = "sm", variant }) => {
73
+ const props = variant === "scrollable" ? scrollableContent : fixedContent;
74
+ return {
75
+ ...props,
76
+ alignItems: "stretch",
77
+ justifyContent: "start",
78
+ [theme.breakpoints.down(mobileScrollingBreakpoint)]: {
79
+ inset: "unset",
80
+ position: "relative"
81
+ }
82
+ };
83
+ });
84
+ var WebAppBody = /* @__PURE__ */ __name(({ children, breadcrumbs, disableBreadcrumbGutter, mobileScrollingBreakpoint, spacing = 1, variant, ...props }) => {
85
+ return /* @__PURE__ */ React.createElement(WebAppBodyRoot, {
86
+ mobileScrollingBreakpoint,
87
+ spacing,
88
+ variant,
89
+ ...props
90
+ }, breadcrumbs ? /* @__PURE__ */ React.createElement(WebAppBodyBreadcrumb, {
91
+ disableBreadcrumbGutter,
92
+ spacing
93
+ }, breadcrumbs) : null, /* @__PURE__ */ React.createElement(WebAppBodyScrollableWrapper, null, /* @__PURE__ */ React.createElement(WebAppBodyScrollable, {
94
+ mobileScrollingBreakpoint,
95
+ variant
96
+ }, children)));
97
+ }, "WebAppBody");
98
+
99
+ // src/components/Chrome.tsx
100
+ import { Divider, Paper } from "@mui/material";
101
+ import { ApplicationAppBar, SystemToolbar } from "@xylabs/react-appbar";
102
+ import { ErrorBoundary } from "@xylabs/react-error";
103
+ import { FlexCol, FlexGrowCol as FlexGrowCol3, FlexGrowRow } from "@xylabs/react-flexbox";
104
+ import React4, { forwardRef } from "react";
105
+ import { Helmet as Helmet2 } from "react-helmet";
106
+
107
+ // src/components/ErrorPage.tsx
108
+ import { ButtonEx } from "@xylabs/react-button";
109
+ import React3 from "react";
110
+
111
+ // src/components/Page.tsx
112
+ import { Container, styled as styled2 } from "@mui/material";
113
+ import { useAsyncEffect } from "@xylabs/react-async-effect";
114
+ import { FlexGrowCol as FlexGrowCol2 } from "@xylabs/react-flexbox";
115
+ import { useUserEvents } from "@xylabs/react-pixel";
116
+ import React2 from "react";
117
+ import { Helmet } from "react-helmet";
118
+ import { useLocation } from "react-router-dom";
119
+ var WebAppPageRoot = styled2(FlexGrowCol2, {
120
+ name: "WebAppPage",
121
+ shouldForwardProp: /* @__PURE__ */ __name((propName) => propName !== "mobileScrollingBreakpoint" && propName !== "variant", "shouldForwardProp"),
122
+ slot: "Root"
123
+ })(({ theme, mobileScrollingBreakpoint = "sm", variant }) => {
124
+ const props = variant === "scrollable" ? scrollableWrap : fixedWrap;
125
+ return {
126
+ ...props,
127
+ alignItems: "stretch",
128
+ justifyContent: "start",
129
+ maxWidth: "100vw",
130
+ [theme.breakpoints.down(mobileScrollingBreakpoint)]: {
131
+ inset: 0,
132
+ position: "absolute"
133
+ }
134
+ };
135
+ });
136
+ var WebAppPage = /* @__PURE__ */ __name(({ disableGutters, disableBreadcrumbGutter, title, container, children, breadcrumbs, mobileScrollingBreakpoint, variant = "scrollable", ...props }) => {
137
+ const userEvents = useUserEvents();
138
+ const { pathname } = useLocation();
139
+ useAsyncEffect(async () => {
140
+ await userEvents?.viewContent({
141
+ name: title ?? "NodeBasePage",
142
+ path: location.pathname
143
+ });
144
+ }, [
145
+ pathname,
146
+ title,
147
+ userEvents
148
+ ]);
149
+ return /* @__PURE__ */ React2.createElement(WebAppPageRoot, {
150
+ mobileScrollingBreakpoint,
151
+ variant,
152
+ ...props
153
+ }, /* @__PURE__ */ React2.createElement(Helmet, {
154
+ title
155
+ }), container && container !== "none" ? /* @__PURE__ */ React2.createElement(Container, {
156
+ disableGutters,
157
+ style: {
158
+ alignItems: "stretch",
159
+ display: "flex",
160
+ flexDirection: "column",
161
+ flexGrow: 1,
162
+ justifyContent: "flex-start"
163
+ },
164
+ maxWidth: container
165
+ }, /* @__PURE__ */ React2.createElement(WebAppBody, {
166
+ disableBreadcrumbGutter,
167
+ breadcrumbs,
168
+ mobileScrollingBreakpoint,
169
+ variant,
170
+ ...props
171
+ }, children)) : /* @__PURE__ */ React2.createElement(WebAppBody, {
172
+ disableBreadcrumbGutter,
173
+ breadcrumbs,
174
+ mobileScrollingBreakpoint,
175
+ paddingX: disableGutters ? 0 : 1,
176
+ variant,
177
+ ...props
178
+ }, children));
179
+ }, "WebAppPage");
180
+ var FlexPage = WebAppPage;
181
+
182
+ // src/components/ErrorPage.tsx
183
+ var WebAppErrorPage = /* @__PURE__ */ __name(({ error, ...props }) => /* @__PURE__ */ React3.createElement(WebAppPage, {
184
+ title: "Oops! Something went wrong",
185
+ ...props
186
+ }, /* @__PURE__ */ React3.createElement("h1", null, "Oops! Something went wrong!"), /* @__PURE__ */ React3.createElement("p", null, `${error}`), /* @__PURE__ */ React3.createElement(ButtonEx, {
187
+ href: "/",
188
+ variant: "contained"
189
+ }, "Homepage")), "WebAppErrorPage");
190
+ var ErrorPage = WebAppErrorPage;
191
+
192
+ // src/components/Chrome.tsx
193
+ var WebAppChrome = /* @__PURE__ */ forwardRef(({ appName, appbar, children, errorBoundary, errorPage, footer, footerElevation = 4, menuItems, navigationType = "menu", ...props }, ref) => {
194
+ return /* @__PURE__ */ React4.createElement(FlexCol, {
195
+ id: "web-chrome-flex",
196
+ alignItems: "stretch",
197
+ overflow: "hidden",
198
+ height: "100vh",
199
+ ref,
200
+ ...props
201
+ }, /* @__PURE__ */ React4.createElement(Helmet2, {
202
+ defaultTitle: appName,
203
+ titleTemplate: `%s | ${appName}`
204
+ }, /* @__PURE__ */ React4.createElement("meta", {
205
+ content: "website",
206
+ property: "og:type"
207
+ })), appbar ?? /* @__PURE__ */ React4.createElement(ApplicationAppBar, {
208
+ systemToolbar: /* @__PURE__ */ React4.createElement(SystemToolbar, {
209
+ menuItems: navigationType === "menu" ? menuItems : void 0
210
+ })
211
+ }), /* @__PURE__ */ React4.createElement(FlexGrowRow, {
212
+ id: "sidebar-nav-flex",
213
+ overflow: "hidden",
214
+ alignItems: "stretch"
215
+ }, navigationType === "menu" ? null : /* @__PURE__ */ React4.createElement(React4.Fragment, null, menuItems, /* @__PURE__ */ React4.createElement(Divider, {
216
+ orientation: "vertical"
217
+ })), /* @__PURE__ */ React4.createElement(FlexGrowCol3, {
218
+ id: "main-flex",
219
+ justifyContent: "flex-start",
220
+ alignItems: "stretch"
221
+ }, errorBoundary ? /* @__PURE__ */ React4.createElement(ErrorBoundary, {
222
+ fallbackWithError: /* @__PURE__ */ __name((error) => {
223
+ return errorPage ?? /* @__PURE__ */ React4.createElement(WebAppErrorPage, {
224
+ error
225
+ });
226
+ }, "fallbackWithError")
227
+ }, children) : children)), /* @__PURE__ */ React4.createElement(FlexCol, {
228
+ id: "footer-flex",
229
+ alignItems: "stretch"
230
+ }, /* @__PURE__ */ React4.createElement(Paper, {
231
+ elevation: footerElevation,
232
+ square: true
233
+ }, footer)));
234
+ });
235
+ WebAppChrome.displayName = "WebAppChrome";
236
+
237
+ // src/components/NotFoundPage/Page.tsx
238
+ import { NotFound } from "@xylabs/react-shared";
239
+ import React5 from "react";
240
+ var WebAppNotFoundPage = /* @__PURE__ */ __name(({ title, ...props }) => /* @__PURE__ */ React5.createElement(WebAppPage, {
241
+ title: title ?? "Sorry! Page Not Found",
242
+ ...props
243
+ }, /* @__PURE__ */ React5.createElement(NotFound, null)), "WebAppNotFoundPage");
244
+ var NotFoundPage = WebAppNotFoundPage;
245
+ export {
246
+ ErrorPage,
247
+ FlexPage,
248
+ NotFoundPage,
249
+ WebAppBody,
250
+ WebAppChrome,
251
+ WebAppErrorPage,
252
+ WebAppNotFoundPage,
253
+ WebAppPage
254
+ };
255
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Body.tsx","../../src/components/lib/cssValues.ts","../../src/components/Chrome.tsx","../../src/components/ErrorPage.tsx","../../src/components/Page.tsx","../../src/components/NotFoundPage/Page.tsx"],"sourcesContent":["import type { Breakpoint } from '@mui/material'\nimport { styled } from '@mui/material'\nimport type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexGrowCol, FlexRow } from '@xylabs/react-flexbox'\nimport type { ReactNode } from 'react'\nimport React from 'react'\n\nimport { fixedContent, scrollableContent } from './lib/index.ts'\n\nconst WebAppBodyName = 'WebAppBody'\nconst propsNotForwarded = new Set(['mobileScrollingBreakpoint', 'variant', 'spacing', 'disableBreadcrumbGutter'])\nconst defaultStyledOptions = { shouldForwardProp: (prop: string) => !propsNotForwarded.has(prop) }\n\nconst WebAppBodyRoot = styled(FlexGrowCol, {\n ...defaultStyledOptions,\n name: WebAppBodyName,\n slot: 'Root',\n})<WebAppBodyProps>(({\n spacing, theme, mobileScrollingBreakpoint = 'sm', variant,\n}) => {\n const scrollable = variant === 'scrollable'\n return theme.unstable_sx({\n alignItems: 'stretch',\n gap: 1,\n justifyContent: 'flex-start',\n overflowX: 'visible',\n overflowY: scrollable ? 'scroll' : 'hidden',\n paddingY: spacing,\n [theme.breakpoints.down(mobileScrollingBreakpoint)]: { overflowY: 'scroll' },\n })\n})\n\nconst WebAppBodyBreadcrumb = styled(FlexRow, {\n ...defaultStyledOptions,\n name: WebAppBodyName,\n slot: 'Breadcrumb',\n})<WebAppBodyProps>(({\n theme, disableBreadcrumbGutter, spacing,\n}) =>\n theme.unstable_sx({\n justifyContent: 'start',\n marginX: disableBreadcrumbGutter ? 0 : spacing,\n }))\n\nconst WebAppBodyScrollableWrapper = styled(FlexGrowCol, {\n name: WebAppBodyName,\n slot: 'ScrollableWrapper',\n})<WebAppBodyProps>(() => ({ alignItems: 'stretch' }))\n\nconst WebAppBodyScrollable = styled(FlexGrowCol, {\n ...defaultStyledOptions,\n name: WebAppBodyName,\n slot: 'Scrollable',\n})<WebAppBodyProps>(({\n theme, mobileScrollingBreakpoint = 'sm', variant,\n}) => {\n const props = variant === 'scrollable' ? scrollableContent : fixedContent\n return {\n ...props,\n alignItems: 'stretch',\n justifyContent: 'start',\n [theme.breakpoints.down(mobileScrollingBreakpoint)]: {\n inset: 'unset',\n position: 'relative',\n },\n }\n})\n\nexport interface WebAppBodyProps extends FlexBoxProps {\n breadcrumbs?: ReactNode\n disableBreadcrumbGutter?: boolean\n mobileScrollingBreakpoint?: Breakpoint\n spacing?: string | number\n variant?: 'scrollable' | 'fixed'\n}\n\nexport const WebAppBody: React.FC<WebAppBodyProps> = ({\n children,\n breadcrumbs,\n disableBreadcrumbGutter,\n mobileScrollingBreakpoint,\n spacing = 1,\n variant,\n ...props\n}) => {\n return (\n <WebAppBodyRoot mobileScrollingBreakpoint={mobileScrollingBreakpoint} spacing={spacing} variant={variant} {...props}>\n {breadcrumbs\n ? (\n <WebAppBodyBreadcrumb disableBreadcrumbGutter={disableBreadcrumbGutter} spacing={spacing}>\n {breadcrumbs}\n </WebAppBodyBreadcrumb>\n )\n : null}\n <WebAppBodyScrollableWrapper>\n <WebAppBodyScrollable mobileScrollingBreakpoint={mobileScrollingBreakpoint} variant={variant}>\n {children}\n </WebAppBodyScrollable>\n </WebAppBodyScrollableWrapper>\n </WebAppBodyRoot>\n )\n}\n","import type { CSSProperties } from 'react'\n\nexport const scrollableWrap: CSSProperties = {\n inset: 0,\n position: 'absolute',\n} as const\n\nexport const fixedWrap: CSSProperties = {\n inset: 'unset',\n position: 'relative',\n} as const\n\n// Making a scrollable vs fixed wrapper and content is an inversion of the wrap and content styles\nexport const scrollableContent: CSSProperties = { ...fixedWrap } as const\n\nexport const fixedContent: CSSProperties = { ...scrollableWrap } as const\n","import { Divider, Paper } from '@mui/material'\nimport type { WebAppNavigationType } from '@xylabs/react-app-settings'\nimport { ApplicationAppBar, SystemToolbar } from '@xylabs/react-appbar'\nimport { ErrorBoundary } from '@xylabs/react-error'\nimport type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport {\n FlexCol, FlexGrowCol, FlexGrowRow,\n} from '@xylabs/react-flexbox'\nimport type { ReactNode } from 'react'\nimport React, { forwardRef } from 'react'\nimport { Helmet } from 'react-helmet'\n\nimport { WebAppErrorPage } from './ErrorPage.tsx'\n\nexport interface WebAppChromeProps extends FlexBoxProps {\n appName: string\n appbar?: ReactNode\n errorBoundary?: boolean\n errorPage?: ReactNode\n footer?: ReactNode\n footerElevation?: number\n menuItems?: ReactNode\n navigationType?: WebAppNavigationType\n}\n\nexport const WebAppChrome = forwardRef<HTMLDivElement, WebAppChromeProps>(\n ({\n appName, appbar, children, errorBoundary, errorPage, footer, footerElevation = 4, menuItems, navigationType = 'menu', ...props\n }, ref) => {\n return (\n <FlexCol id=\"web-chrome-flex\" alignItems=\"stretch\" overflow=\"hidden\" height=\"100vh\" ref={ref} {...props}>\n <Helmet defaultTitle={appName} titleTemplate={`%s | ${appName}`}>\n <meta content=\"website\" property=\"og:type\" />\n </Helmet>\n {appbar ?? <ApplicationAppBar systemToolbar={<SystemToolbar menuItems={navigationType === 'menu' ? menuItems : undefined} />} />}\n <FlexGrowRow id=\"sidebar-nav-flex\" overflow=\"hidden\" alignItems=\"stretch\">\n {navigationType === 'menu'\n ? null\n : (\n <>\n {menuItems}\n <Divider orientation=\"vertical\" />\n </>\n )}\n <FlexGrowCol id=\"main-flex\" justifyContent=\"flex-start\" alignItems=\"stretch\">\n {errorBoundary\n ? (\n <ErrorBoundary\n fallbackWithError={(error) => {\n return errorPage ?? <WebAppErrorPage error={error} />\n }}\n >\n {children}\n </ErrorBoundary>\n )\n : children}\n </FlexGrowCol>\n </FlexGrowRow>\n <FlexCol id=\"footer-flex\" alignItems=\"stretch\">\n <Paper elevation={footerElevation} square>\n {footer}\n </Paper>\n </FlexCol>\n </FlexCol>\n )\n },\n)\n\nWebAppChrome.displayName = 'WebAppChrome'\n","import { ButtonEx } from '@xylabs/react-button'\nimport React from 'react'\n\nimport type { WebAppPageProps } from './Page.tsx'\nimport { WebAppPage } from './Page.tsx'\n\nexport interface WebAppErrorPageProps extends WebAppPageProps {\n error?: Error\n}\n\nexport const WebAppErrorPage: React.FC<WebAppErrorPageProps> = ({ error, ...props }) => (\n <WebAppPage title=\"Oops! Something went wrong\" {...props}>\n <h1>Oops! Something went wrong!</h1>\n <p>{`${error}`}</p>\n <ButtonEx href=\"/\" variant=\"contained\">\n Homepage\n </ButtonEx>\n </WebAppPage>\n)\n\n/** @deprecated use WebAppErrorPage instead */\nexport const ErrorPage = WebAppErrorPage\n","import type { ContainerProps } from '@mui/material'\nimport { Container, styled } from '@mui/material'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexGrowCol } from '@xylabs/react-flexbox'\nimport { useUserEvents } from '@xylabs/react-pixel'\nimport type { PropsWithChildren } from 'react'\nimport React from 'react'\nimport { Helmet } from 'react-helmet'\nimport { useLocation } from 'react-router-dom'\n\nimport type { WebAppBodyProps } from './Body.tsx'\nimport { WebAppBody } from './Body.tsx'\nimport { fixedWrap, scrollableWrap } from './lib/index.ts'\n\nconst WebAppPageRoot = styled(FlexGrowCol, {\n name: 'WebAppPage',\n shouldForwardProp: propName => propName !== 'mobileScrollingBreakpoint' && propName !== 'variant',\n slot: 'Root',\n})<WebAppPageProps>(({\n theme, mobileScrollingBreakpoint = 'sm', variant,\n}) => {\n const props = variant === 'scrollable' ? scrollableWrap : fixedWrap\n return {\n ...props,\n alignItems: 'stretch',\n justifyContent: 'start',\n maxWidth: '100vw',\n [theme.breakpoints.down(mobileScrollingBreakpoint)]: {\n inset: 0,\n position: 'absolute',\n },\n }\n})\n\nexport interface WebAppPageProps extends WebAppBodyProps, FlexBoxProps {\n container?: ContainerProps['maxWidth'] | 'none'\n disableGutters?: boolean\n}\n\nexport const WebAppPage: React.FC<PropsWithChildren<WebAppPageProps>> = ({\n disableGutters,\n disableBreadcrumbGutter,\n title,\n container,\n children,\n breadcrumbs,\n mobileScrollingBreakpoint,\n variant = 'scrollable',\n ...props\n}) => {\n const userEvents = useUserEvents()\n const { pathname } = useLocation()\n\n useAsyncEffect(\n async () => {\n await userEvents?.viewContent({ name: title ?? 'NodeBasePage', path: location.pathname })\n },\n [pathname, title, userEvents],\n )\n\n return (\n <WebAppPageRoot mobileScrollingBreakpoint={mobileScrollingBreakpoint} variant={variant} {...props}>\n <Helmet title={title} />\n {container && container !== 'none'\n ? (\n <Container\n disableGutters={disableGutters}\n style={{\n alignItems: 'stretch', display: 'flex', flexDirection: 'column', flexGrow: 1, justifyContent: 'flex-start',\n }}\n maxWidth={container}\n >\n <WebAppBody\n disableBreadcrumbGutter={disableBreadcrumbGutter}\n breadcrumbs={breadcrumbs}\n mobileScrollingBreakpoint={mobileScrollingBreakpoint}\n variant={variant}\n {...props}\n >\n {children}\n </WebAppBody>\n </Container>\n )\n : (\n <WebAppBody\n disableBreadcrumbGutter={disableBreadcrumbGutter}\n breadcrumbs={breadcrumbs}\n mobileScrollingBreakpoint={mobileScrollingBreakpoint}\n paddingX={disableGutters ? 0 : 1}\n variant={variant}\n {...props}\n >\n {children}\n </WebAppBody>\n )}\n </WebAppPageRoot>\n )\n}\n\n/** @deprecated use WebAppPagePage instead */\nexport const FlexPage = WebAppPage\n","import { NotFound } from '@xylabs/react-shared'\nimport React from 'react'\n\nimport type { WebAppPageProps } from '../Page.tsx'\nimport { WebAppPage } from '../Page.tsx'\n\nexport const WebAppNotFoundPage: React.FC<WebAppPageProps> = ({ title, ...props }) => (\n <WebAppPage title={title ?? 'Sorry! Page Not Found'} {...props}>\n <NotFound />\n </WebAppPage>\n)\n\n/** @deprecated use WebAppNotFoundPage instead */\nexport const NotFoundPage = WebAppNotFoundPage\n"],"mappings":"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","names":["styled","FlexGrowCol","FlexRow","React","scrollableWrap","inset","position","fixedWrap","scrollableContent","fixedContent","WebAppBodyName","propsNotForwarded","Set","defaultStyledOptions","shouldForwardProp","prop","has","WebAppBodyRoot","styled","FlexGrowCol","name","slot","spacing","theme","mobileScrollingBreakpoint","variant","scrollable","unstable_sx","alignItems","gap","justifyContent","overflowX","overflowY","paddingY","breakpoints","down","WebAppBodyBreadcrumb","FlexRow","disableBreadcrumbGutter","marginX","WebAppBodyScrollableWrapper","WebAppBodyScrollable","props","scrollableContent","fixedContent","inset","position","WebAppBody","children","breadcrumbs","Divider","Paper","ApplicationAppBar","SystemToolbar","ErrorBoundary","FlexCol","FlexGrowCol","FlexGrowRow","React","forwardRef","Helmet","ButtonEx","React","Container","styled","useAsyncEffect","FlexGrowCol","useUserEvents","React","Helmet","useLocation","WebAppPageRoot","styled","FlexGrowCol","name","shouldForwardProp","propName","slot","theme","mobileScrollingBreakpoint","variant","props","scrollableWrap","fixedWrap","alignItems","justifyContent","maxWidth","breakpoints","down","inset","position","WebAppPage","disableGutters","disableBreadcrumbGutter","title","container","children","breadcrumbs","userEvents","useUserEvents","pathname","useLocation","useAsyncEffect","viewContent","path","location","React","Helmet","Container","style","display","flexDirection","flexGrow","WebAppBody","paddingX","FlexPage","WebAppErrorPage","error","props","React","WebAppPage","title","h1","p","ButtonEx","href","variant","ErrorPage","WebAppChrome","forwardRef","appName","appbar","children","errorBoundary","errorPage","footer","footerElevation","menuItems","navigationType","props","ref","React","FlexCol","id","alignItems","overflow","height","Helmet","defaultTitle","titleTemplate","meta","content","property","ApplicationAppBar","systemToolbar","SystemToolbar","undefined","FlexGrowRow","Divider","orientation","FlexGrowCol","justifyContent","ErrorBoundary","fallbackWithError","error","WebAppErrorPage","Paper","elevation","square","displayName","NotFound","React","WebAppNotFoundPage","title","props","React","WebAppPage","NotFound","NotFoundPage"]}
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "@xylabs/react-webapp",
3
+ "version": "5.2.8",
4
+ "description": "Common React library for all XY Labs projects that use React",
5
+ "keywords": [
6
+ "utility",
7
+ "typescript",
8
+ "react"
9
+ ],
10
+ "homepage": "https://xylabs.com",
11
+ "bugs": {
12
+ "url": "git+https://github.com/xylabs/sdk-react/issues",
13
+ "email": "support@xylabs.com"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/xylabs/sdk-react.git"
18
+ },
19
+ "license": "LGPL-3.0-only",
20
+ "author": {
21
+ "name": "XY Labs Development Team",
22
+ "email": "support@xylabs.com",
23
+ "url": "https://xylabs.com"
24
+ },
25
+ "sideEffects": false,
26
+ "type": "module",
27
+ "exports": {
28
+ ".": {
29
+ "browser": {
30
+ "types": "./dist/browser/index.d.ts",
31
+ "default": "./dist/browser/index.mjs"
32
+ },
33
+ "types": "./dist/browser/index.d.ts",
34
+ "default": "./dist/browser/index.mjs"
35
+ },
36
+ "./package.json": "./package.json"
37
+ },
38
+ "module": "dist/browser/index.mjs",
39
+ "types": "dist/browser/index.d.ts",
40
+ "scripts": {
41
+ "license": "yarn license-checker --exclude \"MIT, ISC, Apache-2.0, BSD, BSD-2-Clause, CC-BY-4.0, Unlicense, CC-BY-3.0, CC0-1.0\"",
42
+ "lint-pkg": "npmPkgJsonLint ."
43
+ },
44
+ "dependencies": {
45
+ "@mui/icons-material": "^6.1.5",
46
+ "@mui/material": "^6.1.5",
47
+ "@mui/styles": "^6.1.5",
48
+ "@xylabs/react-app-settings": "^5.2.8",
49
+ "@xylabs/react-appbar": "^5.2.8",
50
+ "@xylabs/react-async-effect": "^5.2.8",
51
+ "@xylabs/react-button": "^5.2.8",
52
+ "@xylabs/react-error": "^5.2.8",
53
+ "@xylabs/react-flexbox": "^5.2.8",
54
+ "@xylabs/react-pixel": "^5.2.8",
55
+ "@xylabs/react-shared": "^5.2.8",
56
+ "react": "^18.3.1",
57
+ "react-dom": "^18.3.1",
58
+ "react-helmet": "^6.1.0",
59
+ "react-router-dom": "^6.27.0"
60
+ },
61
+ "devDependencies": {
62
+ "@storybook/react": "^8.3.6",
63
+ "@types/react-helmet": "^6.1.11",
64
+ "@xylabs/react-button": "^5.2.8",
65
+ "@xylabs/react-flexbox": "^5.2.8",
66
+ "@xylabs/react-link": "^5.2.8",
67
+ "@xylabs/react-pixel": "^5.2.8",
68
+ "@xylabs/ts-scripts-yarn3": "^4.2.3",
69
+ "@xylabs/tsconfig-react": "^4.2.3",
70
+ "storybook": "^8.3.6",
71
+ "typescript": "^5.6.3"
72
+ },
73
+ "publishConfig": {
74
+ "access": "public"
75
+ },
76
+ "docs": "dist/docs.json"
77
+ }
@@ -0,0 +1,102 @@
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
+ }
@@ -0,0 +1,71 @@
1
+ import { Breadcrumbs, List } from '@mui/material'
2
+ import type { Meta, StoryFn } from '@storybook/react'
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
@@ -0,0 +1,69 @@
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, { forwardRef } 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 = forwardRef<HTMLDivElement, WebAppChromeProps>(
27
+ ({
28
+ appName, appbar, children, errorBoundary, errorPage, footer, footerElevation = 4, menuItems, navigationType = 'menu', ...props
29
+ }, ref) => {
30
+ return (
31
+ <FlexCol id="web-chrome-flex" alignItems="stretch" overflow="hidden" height="100vh" ref={ref} {...props}>
32
+ <Helmet defaultTitle={appName} titleTemplate={`%s | ${appName}`}>
33
+ <meta content="website" property="og:type" />
34
+ </Helmet>
35
+ {appbar ?? <ApplicationAppBar systemToolbar={<SystemToolbar menuItems={navigationType === 'menu' ? menuItems : undefined} />} />}
36
+ <FlexGrowRow id="sidebar-nav-flex" overflow="hidden" alignItems="stretch">
37
+ {navigationType === 'menu'
38
+ ? null
39
+ : (
40
+ <>
41
+ {menuItems}
42
+ <Divider orientation="vertical" />
43
+ </>
44
+ )}
45
+ <FlexGrowCol id="main-flex" justifyContent="flex-start" alignItems="stretch">
46
+ {errorBoundary
47
+ ? (
48
+ <ErrorBoundary
49
+ fallbackWithError={(error) => {
50
+ return errorPage ?? <WebAppErrorPage error={error} />
51
+ }}
52
+ >
53
+ {children}
54
+ </ErrorBoundary>
55
+ )
56
+ : children}
57
+ </FlexGrowCol>
58
+ </FlexGrowRow>
59
+ <FlexCol id="footer-flex" alignItems="stretch">
60
+ <Paper elevation={footerElevation} square>
61
+ {footer}
62
+ </Paper>
63
+ </FlexCol>
64
+ </FlexCol>
65
+ )
66
+ },
67
+ )
68
+
69
+ WebAppChrome.displayName = 'WebAppChrome'
@@ -0,0 +1,22 @@
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
@@ -0,0 +1,21 @@
1
+ import type { Meta, StoryFn } from '@storybook/react'
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
@@ -0,0 +1,14 @@
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
@@ -0,0 +1 @@
1
+ export * from './Page.tsx'
@@ -0,0 +1,102 @@
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 type { PropsWithChildren } from 'react'
8
+ import React from 'react'
9
+ import { Helmet } from 'react-helmet'
10
+ import { useLocation } from 'react-router-dom'
11
+
12
+ import type { WebAppBodyProps } from './Body.tsx'
13
+ import { WebAppBody } from './Body.tsx'
14
+ import { fixedWrap, scrollableWrap } from './lib/index.ts'
15
+
16
+ const WebAppPageRoot = styled(FlexGrowCol, {
17
+ name: 'WebAppPage',
18
+ shouldForwardProp: propName => propName !== 'mobileScrollingBreakpoint' && propName !== 'variant',
19
+ slot: 'Root',
20
+ })<WebAppPageProps>(({
21
+ theme, mobileScrollingBreakpoint = 'sm', variant,
22
+ }) => {
23
+ const props = variant === 'scrollable' ? scrollableWrap : fixedWrap
24
+ return {
25
+ ...props,
26
+ alignItems: 'stretch',
27
+ justifyContent: 'start',
28
+ maxWidth: '100vw',
29
+ [theme.breakpoints.down(mobileScrollingBreakpoint)]: {
30
+ inset: 0,
31
+ position: 'absolute',
32
+ },
33
+ }
34
+ })
35
+
36
+ export interface WebAppPageProps extends WebAppBodyProps, FlexBoxProps {
37
+ container?: ContainerProps['maxWidth'] | 'none'
38
+ disableGutters?: boolean
39
+ }
40
+
41
+ export const WebAppPage: React.FC<PropsWithChildren<WebAppPageProps>> = ({
42
+ disableGutters,
43
+ disableBreadcrumbGutter,
44
+ title,
45
+ container,
46
+ children,
47
+ breadcrumbs,
48
+ mobileScrollingBreakpoint,
49
+ variant = 'scrollable',
50
+ ...props
51
+ }) => {
52
+ const userEvents = useUserEvents()
53
+ const { pathname } = useLocation()
54
+
55
+ useAsyncEffect(
56
+ async () => {
57
+ await userEvents?.viewContent({ name: title ?? 'NodeBasePage', path: location.pathname })
58
+ },
59
+ [pathname, title, userEvents],
60
+ )
61
+
62
+ return (
63
+ <WebAppPageRoot mobileScrollingBreakpoint={mobileScrollingBreakpoint} variant={variant} {...props}>
64
+ <Helmet title={title} />
65
+ {container && container !== 'none'
66
+ ? (
67
+ <Container
68
+ disableGutters={disableGutters}
69
+ style={{
70
+ alignItems: 'stretch', display: 'flex', flexDirection: 'column', flexGrow: 1, justifyContent: 'flex-start',
71
+ }}
72
+ maxWidth={container}
73
+ >
74
+ <WebAppBody
75
+ disableBreadcrumbGutter={disableBreadcrumbGutter}
76
+ breadcrumbs={breadcrumbs}
77
+ mobileScrollingBreakpoint={mobileScrollingBreakpoint}
78
+ variant={variant}
79
+ {...props}
80
+ >
81
+ {children}
82
+ </WebAppBody>
83
+ </Container>
84
+ )
85
+ : (
86
+ <WebAppBody
87
+ disableBreadcrumbGutter={disableBreadcrumbGutter}
88
+ breadcrumbs={breadcrumbs}
89
+ mobileScrollingBreakpoint={mobileScrollingBreakpoint}
90
+ paddingX={disableGutters ? 0 : 1}
91
+ variant={variant}
92
+ {...props}
93
+ >
94
+ {children}
95
+ </WebAppBody>
96
+ )}
97
+ </WebAppPageRoot>
98
+ )
99
+ }
100
+
101
+ /** @deprecated use WebAppPagePage instead */
102
+ export const FlexPage = WebAppPage
@@ -0,0 +1,5 @@
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'
@@ -0,0 +1,16 @@
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
@@ -0,0 +1 @@
1
+ export * from './cssValues.ts'
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './components/index.ts'
package/typedoc.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://typedoc.org/schema.json",
3
+ "entryPoints": ["src/index.ts"],
4
+ "tsconfig": "./tsconfig.typedoc.json"
5
+ }
package/xy.config.ts ADDED
@@ -0,0 +1,10 @@
1
+ import type { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
2
+ const config: XyTsupConfig = {
3
+ compile: {
4
+ browser: { src: true },
5
+ node: {},
6
+ neutral: {},
7
+ },
8
+ }
9
+
10
+ export default config