@xyo-network/react-drawer 2.67.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. package/LICENSE +165 -0
  2. package/README.md +13 -0
  3. package/dist/browser/components/Drawer.d.cts +10 -0
  4. package/dist/browser/components/Drawer.d.cts.map +1 -0
  5. package/dist/browser/components/Drawer.d.mts +10 -0
  6. package/dist/browser/components/Drawer.d.mts.map +1 -0
  7. package/dist/browser/components/Drawer.d.ts +10 -0
  8. package/dist/browser/components/Drawer.d.ts.map +1 -0
  9. package/dist/browser/components/index.d.cts +2 -0
  10. package/dist/browser/components/index.d.cts.map +1 -0
  11. package/dist/browser/components/index.d.mts +2 -0
  12. package/dist/browser/components/index.d.mts.map +1 -0
  13. package/dist/browser/components/index.d.ts +2 -0
  14. package/dist/browser/components/index.d.ts.map +1 -0
  15. package/dist/browser/index.cjs +98 -0
  16. package/dist/browser/index.cjs.map +1 -0
  17. package/dist/browser/index.d.cts +2 -0
  18. package/dist/browser/index.d.cts.map +1 -0
  19. package/dist/browser/index.d.mts +2 -0
  20. package/dist/browser/index.d.mts.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.js +75 -0
  24. package/dist/browser/index.js.map +1 -0
  25. package/dist/node/components/Drawer.d.cts +10 -0
  26. package/dist/node/components/Drawer.d.cts.map +1 -0
  27. package/dist/node/components/Drawer.d.mts +10 -0
  28. package/dist/node/components/Drawer.d.mts.map +1 -0
  29. package/dist/node/components/Drawer.d.ts +10 -0
  30. package/dist/node/components/Drawer.d.ts.map +1 -0
  31. package/dist/node/components/index.d.cts +2 -0
  32. package/dist/node/components/index.d.cts.map +1 -0
  33. package/dist/node/components/index.d.mts +2 -0
  34. package/dist/node/components/index.d.mts.map +1 -0
  35. package/dist/node/components/index.d.ts +2 -0
  36. package/dist/node/components/index.d.ts.map +1 -0
  37. package/dist/node/index.cjs +102 -0
  38. package/dist/node/index.cjs.map +1 -0
  39. package/dist/node/index.d.cts +2 -0
  40. package/dist/node/index.d.cts.map +1 -0
  41. package/dist/node/index.d.mts +2 -0
  42. package/dist/node/index.d.mts.map +1 -0
  43. package/dist/node/index.d.ts +2 -0
  44. package/dist/node/index.d.ts.map +1 -0
  45. package/dist/node/index.js +75 -0
  46. package/dist/node/index.js.map +1 -0
  47. package/package.json +80 -0
  48. package/src/components/Drawer.stories.tsx +35 -0
  49. package/src/components/Drawer.tsx +87 -0
  50. package/src/components/index.ts +1 -0
  51. package/src/index.ts +1 -0
  52. package/src/types/images.d.ts +5 -0
  53. package/typedoc.json +5 -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,13 @@
1
+ [![logo][]](https://xyo.network)
2
+
3
+ Part of [@xyo-network/sdk-xyo-react](https://www.npmjs.com/package/@xyo-network/sdk-xyo-react)
4
+
5
+ ## License
6
+
7
+ > See the [LICENSE](LICENSE) file for license details
8
+
9
+ ## Credits
10
+
11
+ [Made with 🔥 and ❄️ by XYO](https://xyo.network)
12
+
13
+ [logo]: https://cdn.xy.company/img/brand/XYO_full_colored.png
@@ -0,0 +1,10 @@
1
+ import { DrawerProps } from '@mui/material';
2
+ import { PropsWithChildren } from 'react';
3
+ export interface DrawerExProps extends PropsWithChildren<DrawerProps> {
4
+ heightVariant?: 'full' | 'auto';
5
+ subTitle?: string;
6
+ title?: string;
7
+ widthVariant?: 'full' | 'partial';
8
+ }
9
+ export declare const DrawerEx: React.FC<DrawerExProps>;
10
+ //# sourceMappingURL=Drawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,WAAW,EAA6B,MAAM,eAAe,CAAA;AAE9E,OAAO,EAAc,iBAAiB,EAAW,MAAM,OAAO,CAAA;AAE9D,MAAM,WAAW,aAAc,SAAQ,iBAAiB,CAAC,WAAW,CAAC;IACnE,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAClC;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA+C5C,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { DrawerProps } from '@mui/material';
2
+ import { PropsWithChildren } from 'react';
3
+ export interface DrawerExProps extends PropsWithChildren<DrawerProps> {
4
+ heightVariant?: 'full' | 'auto';
5
+ subTitle?: string;
6
+ title?: string;
7
+ widthVariant?: 'full' | 'partial';
8
+ }
9
+ export declare const DrawerEx: React.FC<DrawerExProps>;
10
+ //# sourceMappingURL=Drawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,WAAW,EAA6B,MAAM,eAAe,CAAA;AAE9E,OAAO,EAAc,iBAAiB,EAAW,MAAM,OAAO,CAAA;AAE9D,MAAM,WAAW,aAAc,SAAQ,iBAAiB,CAAC,WAAW,CAAC;IACnE,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAClC;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA+C5C,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { DrawerProps } from '@mui/material';
2
+ import { PropsWithChildren } from 'react';
3
+ export interface DrawerExProps extends PropsWithChildren<DrawerProps> {
4
+ heightVariant?: 'full' | 'auto';
5
+ subTitle?: string;
6
+ title?: string;
7
+ widthVariant?: 'full' | 'partial';
8
+ }
9
+ export declare const DrawerEx: React.FC<DrawerExProps>;
10
+ //# sourceMappingURL=Drawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,WAAW,EAA6B,MAAM,eAAe,CAAA;AAE9E,OAAO,EAAc,iBAAiB,EAAW,MAAM,OAAO,CAAA;AAE9D,MAAM,WAAW,aAAc,SAAQ,iBAAiB,CAAC,WAAW,CAAC;IACnE,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAClC;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA+C5C,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './Drawer';
2
+ //# 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,UAAU,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './Drawer';
2
+ //# 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,UAAU,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './Drawer';
2
+ //# 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,UAAU,CAAA"}
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ DrawerEx: () => DrawerEx
24
+ });
25
+ module.exports = __toCommonJS(src_exports);
26
+
27
+ // src/components/Drawer.tsx
28
+ var import_material = require("@mui/material");
29
+ var import_react_flexbox = require("@xylabs/react-flexbox");
30
+ var import_react = require("react");
31
+ var import_jsx_runtime = require("react/jsx-runtime");
32
+ var DrawerEx = ({
33
+ children,
34
+ heightVariant = "full",
35
+ subTitle,
36
+ title,
37
+ onClose,
38
+ widthVariant = "partial",
39
+ ...props
40
+ }) => {
41
+ const variantBasedProps = (0, import_react.useMemo)(() => {
42
+ return {
43
+ PaperProps: {
44
+ sx: {
45
+ alignItems: "center",
46
+ background: "transparent",
47
+ boxShadow: "none",
48
+ height: heightVariant === "full" ? "100%" : "auto",
49
+ width: widthVariant === "partial" ? "auto" : "100%"
50
+ }
51
+ },
52
+ onClick: (event) => onClose?.(event, "backdropClick")
53
+ };
54
+ }, [heightVariant, onClose, widthVariant]);
55
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Drawer, { anchor: "top", onClose, ...variantBasedProps, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
56
+ StyledDrawerContentPaper,
57
+ {
58
+ widthVariant,
59
+ elevation: 16,
60
+ onClick: (event) => event.stopPropagation(),
61
+ sx: { width: widthVariant === "full" ? "100%" : void 0 },
62
+ children: [
63
+ title || subTitle ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_flexbox.FlexCol, { alignItems: "start", gap: 1, children: [
64
+ title ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledEllipsisTypography, { variant: "h3", children: title }) : null,
65
+ subTitle ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "subtitle1", textTransform: "none", children: subTitle }) : null
66
+ ] }) : null,
67
+ children
68
+ ]
69
+ }
70
+ ) });
71
+ };
72
+ var StyledEllipsisTypography = (0, import_material.styled)(import_material.Typography, { name: "StyledEllipsisTypography" })(() => ({
73
+ maxWidth: "100%",
74
+ overflowX: "hidden",
75
+ textOverflow: "ellipsis",
76
+ whiteSpace: "nowrap"
77
+ }));
78
+ var StyledDrawerContentPaper = (0, import_material.styled)(import_material.Paper, {
79
+ name: "StyledDrawerContentPaper",
80
+ shouldForwardProp: (prop) => !["widthVariant"].includes(prop)
81
+ })(({ theme, widthVariant }) => ({
82
+ alignItems: "stretch",
83
+ borderRadius: `0 0 ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px`,
84
+ display: "flex",
85
+ flexDirection: "column",
86
+ gap: theme.spacing(2),
87
+ height: "100%",
88
+ maxWidth: "100%",
89
+ overflowX: "hidden",
90
+ padding: theme.spacing(3),
91
+ [theme.breakpoints.up("lg")]: {
92
+ width: widthVariant === "full" ? "100%" : "50%"
93
+ },
94
+ [theme.breakpoints.up("md")]: {
95
+ width: widthVariant === "full" ? "100%" : "75%"
96
+ }
97
+ }));
98
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts","../../src/components/Drawer.tsx"],"sourcesContent":["export * from './components'\n","import { Drawer, DrawerProps, Paper, styled, Typography } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { MouseEvent, PropsWithChildren, useMemo } from 'react'\n\nexport interface DrawerExProps extends PropsWithChildren<DrawerProps> {\n heightVariant?: 'full' | 'auto'\n subTitle?: string\n title?: string\n widthVariant?: 'full' | 'partial'\n}\n\nexport const DrawerEx: React.FC<DrawerExProps> = ({\n children,\n heightVariant = 'full',\n subTitle,\n title,\n onClose,\n widthVariant = 'partial',\n ...props\n}) => {\n const variantBasedProps = useMemo(() => {\n return {\n PaperProps: {\n sx: {\n alignItems: 'center',\n background: 'transparent',\n boxShadow: 'none',\n height: heightVariant === 'full' ? '100%' : 'auto',\n width: widthVariant === 'partial' ? 'auto' : '100%',\n },\n },\n onClick: (event: MouseEvent) => onClose?.(event, 'backdropClick'),\n }\n }, [heightVariant, onClose, widthVariant])\n\n return (\n <Drawer anchor={'top'} onClose={onClose} {...variantBasedProps} {...props}>\n {/* Trap the event to prevent triggering the backdrop onClick */}\n <StyledDrawerContentPaper\n widthVariant={widthVariant}\n elevation={16}\n onClick={(event) => event.stopPropagation()}\n sx={{ width: widthVariant === 'full' ? '100%' : undefined }}\n >\n {title || subTitle ? (\n <FlexCol alignItems=\"start\" gap={1}>\n {title ? <StyledEllipsisTypography variant={'h3'}>{title}</StyledEllipsisTypography> : null}\n {subTitle ? (\n <Typography variant={'subtitle1'} textTransform=\"none\">\n {subTitle}\n </Typography>\n ) : null}\n </FlexCol>\n ) : null}\n {children}\n </StyledDrawerContentPaper>\n </Drawer>\n )\n}\n\nconst StyledEllipsisTypography = styled(Typography, { name: 'StyledEllipsisTypography' })(() => ({\n maxWidth: '100%',\n overflowX: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}))\n\nconst StyledDrawerContentPaper = styled(Paper, {\n name: 'StyledDrawerContentPaper',\n shouldForwardProp: (prop) => !['widthVariant'].includes(prop as string),\n})<DrawerExProps>(({ theme, widthVariant }) => ({\n alignItems: 'stretch',\n borderRadius: `0 0 ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px`,\n display: 'flex',\n flexDirection: 'column',\n gap: theme.spacing(2),\n height: '100%',\n maxWidth: '100%',\n overflowX: 'hidden',\n padding: theme.spacing(3),\n [theme.breakpoints.up('lg')]: {\n width: widthVariant === 'full' ? '100%' : '50%',\n },\n [theme.breakpoints.up('md')]: {\n width: widthVariant === 'full' ? '100%' : '75%',\n },\n}))\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAA+D;AAC/D,2BAAwB;AACxB,mBAAuD;AA2C7C;AAlCH,IAAM,WAAoC,CAAC;AAAA,EAChD;AAAA,EACA,gBAAgB;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,GAAG;AACL,MAAM;AACJ,QAAM,wBAAoB,sBAAQ,MAAM;AACtC,WAAO;AAAA,MACL,YAAY;AAAA,QACV,IAAI;AAAA,UACF,YAAY;AAAA,UACZ,YAAY;AAAA,UACZ,WAAW;AAAA,UACX,QAAQ,kBAAkB,SAAS,SAAS;AAAA,UAC5C,OAAO,iBAAiB,YAAY,SAAS;AAAA,QAC/C;AAAA,MACF;AAAA,MACA,SAAS,CAAC,UAAsB,UAAU,OAAO,eAAe;AAAA,IAClE;AAAA,EACF,GAAG,CAAC,eAAe,SAAS,YAAY,CAAC;AAEzC,SACE,4CAAC,0BAAO,QAAQ,OAAO,SAAmB,GAAG,mBAAoB,GAAG,OAElE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW;AAAA,MACX,SAAS,CAAC,UAAU,MAAM,gBAAgB;AAAA,MAC1C,IAAI,EAAE,OAAO,iBAAiB,SAAS,SAAS,OAAU;AAAA,MAEzD;AAAA,iBAAS,WACR,6CAAC,gCAAQ,YAAW,SAAQ,KAAK,GAC9B;AAAA,kBAAQ,4CAAC,4BAAyB,SAAS,MAAO,iBAAM,IAA8B;AAAA,UACtF,WACC,4CAAC,8BAAW,SAAS,aAAa,eAAc,QAC7C,oBACH,IACE;AAAA,WACN,IACE;AAAA,QACH;AAAA;AAAA;AAAA,EACH,GACF;AAEJ;AAEA,IAAM,+BAA2B,wBAAO,4BAAY,EAAE,MAAM,2BAA2B,CAAC,EAAE,OAAO;AAAA,EAC/F,UAAU;AAAA,EACV,WAAW;AAAA,EACX,cAAc;AAAA,EACd,YAAY;AACd,EAAE;AAEF,IAAM,+BAA2B,wBAAO,uBAAO;AAAA,EAC7C,MAAM;AAAA,EACN,mBAAmB,CAAC,SAAS,CAAC,CAAC,cAAc,EAAE,SAAS,IAAc;AACxE,CAAC,EAAiB,CAAC,EAAE,OAAO,aAAa,OAAO;AAAA,EAC9C,YAAY;AAAA,EACZ,cAAc,OAAO,MAAM,MAAM,YAAY,MAAM,MAAM,MAAM,YAAY;AAAA,EAC3E,SAAS;AAAA,EACT,eAAe;AAAA,EACf,KAAK,MAAM,QAAQ,CAAC;AAAA,EACpB,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,WAAW;AAAA,EACX,SAAS,MAAM,QAAQ,CAAC;AAAA,EACxB,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG;AAAA,IAC5B,OAAO,iBAAiB,SAAS,SAAS;AAAA,EAC5C;AAAA,EACA,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG;AAAA,IAC5B,OAAO,iBAAiB,SAAS,SAAS;AAAA,EAC5C;AACF,EAAE;","names":[]}
@@ -0,0 +1,2 @@
1
+ export * from './components';
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,cAAc,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './components';
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,cAAc,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './components';
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,cAAc,CAAA"}
@@ -0,0 +1,75 @@
1
+ // src/components/Drawer.tsx
2
+ import { Drawer, Paper, styled, Typography } from "@mui/material";
3
+ import { FlexCol } from "@xylabs/react-flexbox";
4
+ import { useMemo } from "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ var DrawerEx = ({
7
+ children,
8
+ heightVariant = "full",
9
+ subTitle,
10
+ title,
11
+ onClose,
12
+ widthVariant = "partial",
13
+ ...props
14
+ }) => {
15
+ const variantBasedProps = useMemo(() => {
16
+ return {
17
+ PaperProps: {
18
+ sx: {
19
+ alignItems: "center",
20
+ background: "transparent",
21
+ boxShadow: "none",
22
+ height: heightVariant === "full" ? "100%" : "auto",
23
+ width: widthVariant === "partial" ? "auto" : "100%"
24
+ }
25
+ },
26
+ onClick: (event) => onClose?.(event, "backdropClick")
27
+ };
28
+ }, [heightVariant, onClose, widthVariant]);
29
+ return /* @__PURE__ */ jsx(Drawer, { anchor: "top", onClose, ...variantBasedProps, ...props, children: /* @__PURE__ */ jsxs(
30
+ StyledDrawerContentPaper,
31
+ {
32
+ widthVariant,
33
+ elevation: 16,
34
+ onClick: (event) => event.stopPropagation(),
35
+ sx: { width: widthVariant === "full" ? "100%" : void 0 },
36
+ children: [
37
+ title || subTitle ? /* @__PURE__ */ jsxs(FlexCol, { alignItems: "start", gap: 1, children: [
38
+ title ? /* @__PURE__ */ jsx(StyledEllipsisTypography, { variant: "h3", children: title }) : null,
39
+ subTitle ? /* @__PURE__ */ jsx(Typography, { variant: "subtitle1", textTransform: "none", children: subTitle }) : null
40
+ ] }) : null,
41
+ children
42
+ ]
43
+ }
44
+ ) });
45
+ };
46
+ var StyledEllipsisTypography = styled(Typography, { name: "StyledEllipsisTypography" })(() => ({
47
+ maxWidth: "100%",
48
+ overflowX: "hidden",
49
+ textOverflow: "ellipsis",
50
+ whiteSpace: "nowrap"
51
+ }));
52
+ var StyledDrawerContentPaper = styled(Paper, {
53
+ name: "StyledDrawerContentPaper",
54
+ shouldForwardProp: (prop) => !["widthVariant"].includes(prop)
55
+ })(({ theme, widthVariant }) => ({
56
+ alignItems: "stretch",
57
+ borderRadius: `0 0 ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px`,
58
+ display: "flex",
59
+ flexDirection: "column",
60
+ gap: theme.spacing(2),
61
+ height: "100%",
62
+ maxWidth: "100%",
63
+ overflowX: "hidden",
64
+ padding: theme.spacing(3),
65
+ [theme.breakpoints.up("lg")]: {
66
+ width: widthVariant === "full" ? "100%" : "50%"
67
+ },
68
+ [theme.breakpoints.up("md")]: {
69
+ width: widthVariant === "full" ? "100%" : "75%"
70
+ }
71
+ }));
72
+ export {
73
+ DrawerEx
74
+ };
75
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Drawer.tsx"],"sourcesContent":["import { Drawer, DrawerProps, Paper, styled, Typography } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { MouseEvent, PropsWithChildren, useMemo } from 'react'\n\nexport interface DrawerExProps extends PropsWithChildren<DrawerProps> {\n heightVariant?: 'full' | 'auto'\n subTitle?: string\n title?: string\n widthVariant?: 'full' | 'partial'\n}\n\nexport const DrawerEx: React.FC<DrawerExProps> = ({\n children,\n heightVariant = 'full',\n subTitle,\n title,\n onClose,\n widthVariant = 'partial',\n ...props\n}) => {\n const variantBasedProps = useMemo(() => {\n return {\n PaperProps: {\n sx: {\n alignItems: 'center',\n background: 'transparent',\n boxShadow: 'none',\n height: heightVariant === 'full' ? '100%' : 'auto',\n width: widthVariant === 'partial' ? 'auto' : '100%',\n },\n },\n onClick: (event: MouseEvent) => onClose?.(event, 'backdropClick'),\n }\n }, [heightVariant, onClose, widthVariant])\n\n return (\n <Drawer anchor={'top'} onClose={onClose} {...variantBasedProps} {...props}>\n {/* Trap the event to prevent triggering the backdrop onClick */}\n <StyledDrawerContentPaper\n widthVariant={widthVariant}\n elevation={16}\n onClick={(event) => event.stopPropagation()}\n sx={{ width: widthVariant === 'full' ? '100%' : undefined }}\n >\n {title || subTitle ? (\n <FlexCol alignItems=\"start\" gap={1}>\n {title ? <StyledEllipsisTypography variant={'h3'}>{title}</StyledEllipsisTypography> : null}\n {subTitle ? (\n <Typography variant={'subtitle1'} textTransform=\"none\">\n {subTitle}\n </Typography>\n ) : null}\n </FlexCol>\n ) : null}\n {children}\n </StyledDrawerContentPaper>\n </Drawer>\n )\n}\n\nconst StyledEllipsisTypography = styled(Typography, { name: 'StyledEllipsisTypography' })(() => ({\n maxWidth: '100%',\n overflowX: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}))\n\nconst StyledDrawerContentPaper = styled(Paper, {\n name: 'StyledDrawerContentPaper',\n shouldForwardProp: (prop) => !['widthVariant'].includes(prop as string),\n})<DrawerExProps>(({ theme, widthVariant }) => ({\n alignItems: 'stretch',\n borderRadius: `0 0 ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px`,\n display: 'flex',\n flexDirection: 'column',\n gap: theme.spacing(2),\n height: '100%',\n maxWidth: '100%',\n overflowX: 'hidden',\n padding: theme.spacing(3),\n [theme.breakpoints.up('lg')]: {\n width: widthVariant === 'full' ? '100%' : '50%',\n },\n [theme.breakpoints.up('md')]: {\n width: widthVariant === 'full' ? '100%' : '75%',\n },\n}))\n"],"mappings":";AAAA,SAAS,QAAqB,OAAO,QAAQ,kBAAkB;AAC/D,SAAS,eAAe;AACxB,SAAwC,eAAe;AA2C7C,SACW,KADX;AAlCH,IAAM,WAAoC,CAAC;AAAA,EAChD;AAAA,EACA,gBAAgB;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,GAAG;AACL,MAAM;AACJ,QAAM,oBAAoB,QAAQ,MAAM;AACtC,WAAO;AAAA,MACL,YAAY;AAAA,QACV,IAAI;AAAA,UACF,YAAY;AAAA,UACZ,YAAY;AAAA,UACZ,WAAW;AAAA,UACX,QAAQ,kBAAkB,SAAS,SAAS;AAAA,UAC5C,OAAO,iBAAiB,YAAY,SAAS;AAAA,QAC/C;AAAA,MACF;AAAA,MACA,SAAS,CAAC,UAAsB,UAAU,OAAO,eAAe;AAAA,IAClE;AAAA,EACF,GAAG,CAAC,eAAe,SAAS,YAAY,CAAC;AAEzC,SACE,oBAAC,UAAO,QAAQ,OAAO,SAAmB,GAAG,mBAAoB,GAAG,OAElE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW;AAAA,MACX,SAAS,CAAC,UAAU,MAAM,gBAAgB;AAAA,MAC1C,IAAI,EAAE,OAAO,iBAAiB,SAAS,SAAS,OAAU;AAAA,MAEzD;AAAA,iBAAS,WACR,qBAAC,WAAQ,YAAW,SAAQ,KAAK,GAC9B;AAAA,kBAAQ,oBAAC,4BAAyB,SAAS,MAAO,iBAAM,IAA8B;AAAA,UACtF,WACC,oBAAC,cAAW,SAAS,aAAa,eAAc,QAC7C,oBACH,IACE;AAAA,WACN,IACE;AAAA,QACH;AAAA;AAAA;AAAA,EACH,GACF;AAEJ;AAEA,IAAM,2BAA2B,OAAO,YAAY,EAAE,MAAM,2BAA2B,CAAC,EAAE,OAAO;AAAA,EAC/F,UAAU;AAAA,EACV,WAAW;AAAA,EACX,cAAc;AAAA,EACd,YAAY;AACd,EAAE;AAEF,IAAM,2BAA2B,OAAO,OAAO;AAAA,EAC7C,MAAM;AAAA,EACN,mBAAmB,CAAC,SAAS,CAAC,CAAC,cAAc,EAAE,SAAS,IAAc;AACxE,CAAC,EAAiB,CAAC,EAAE,OAAO,aAAa,OAAO;AAAA,EAC9C,YAAY;AAAA,EACZ,cAAc,OAAO,MAAM,MAAM,YAAY,MAAM,MAAM,MAAM,YAAY;AAAA,EAC3E,SAAS;AAAA,EACT,eAAe;AAAA,EACf,KAAK,MAAM,QAAQ,CAAC;AAAA,EACpB,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,WAAW;AAAA,EACX,SAAS,MAAM,QAAQ,CAAC;AAAA,EACxB,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG;AAAA,IAC5B,OAAO,iBAAiB,SAAS,SAAS;AAAA,EAC5C;AAAA,EACA,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG;AAAA,IAC5B,OAAO,iBAAiB,SAAS,SAAS;AAAA,EAC5C;AACF,EAAE;","names":[]}
@@ -0,0 +1,10 @@
1
+ import { DrawerProps } from '@mui/material';
2
+ import { PropsWithChildren } from 'react';
3
+ export interface DrawerExProps extends PropsWithChildren<DrawerProps> {
4
+ heightVariant?: 'full' | 'auto';
5
+ subTitle?: string;
6
+ title?: string;
7
+ widthVariant?: 'full' | 'partial';
8
+ }
9
+ export declare const DrawerEx: React.FC<DrawerExProps>;
10
+ //# sourceMappingURL=Drawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,WAAW,EAA6B,MAAM,eAAe,CAAA;AAE9E,OAAO,EAAc,iBAAiB,EAAW,MAAM,OAAO,CAAA;AAE9D,MAAM,WAAW,aAAc,SAAQ,iBAAiB,CAAC,WAAW,CAAC;IACnE,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAClC;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA+C5C,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { DrawerProps } from '@mui/material';
2
+ import { PropsWithChildren } from 'react';
3
+ export interface DrawerExProps extends PropsWithChildren<DrawerProps> {
4
+ heightVariant?: 'full' | 'auto';
5
+ subTitle?: string;
6
+ title?: string;
7
+ widthVariant?: 'full' | 'partial';
8
+ }
9
+ export declare const DrawerEx: React.FC<DrawerExProps>;
10
+ //# sourceMappingURL=Drawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,WAAW,EAA6B,MAAM,eAAe,CAAA;AAE9E,OAAO,EAAc,iBAAiB,EAAW,MAAM,OAAO,CAAA;AAE9D,MAAM,WAAW,aAAc,SAAQ,iBAAiB,CAAC,WAAW,CAAC;IACnE,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAClC;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA+C5C,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { DrawerProps } from '@mui/material';
2
+ import { PropsWithChildren } from 'react';
3
+ export interface DrawerExProps extends PropsWithChildren<DrawerProps> {
4
+ heightVariant?: 'full' | 'auto';
5
+ subTitle?: string;
6
+ title?: string;
7
+ widthVariant?: 'full' | 'partial';
8
+ }
9
+ export declare const DrawerEx: React.FC<DrawerExProps>;
10
+ //# sourceMappingURL=Drawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,WAAW,EAA6B,MAAM,eAAe,CAAA;AAE9E,OAAO,EAAc,iBAAiB,EAAW,MAAM,OAAO,CAAA;AAE9D,MAAM,WAAW,aAAc,SAAQ,iBAAiB,CAAC,WAAW,CAAC;IACnE,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAClC;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA+C5C,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './Drawer';
2
+ //# 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,UAAU,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './Drawer';
2
+ //# 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,UAAU,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './Drawer';
2
+ //# 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,UAAU,CAAA"}
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ DrawerEx: () => DrawerEx
24
+ });
25
+ module.exports = __toCommonJS(src_exports);
26
+
27
+ // src/components/Drawer.tsx
28
+ var import_material = require("@mui/material");
29
+ var import_react_flexbox = require("@xylabs/react-flexbox");
30
+ var import_react = require("react");
31
+ var import_jsx_runtime = require("react/jsx-runtime");
32
+ var DrawerEx = ({
33
+ children,
34
+ heightVariant = "full",
35
+ subTitle,
36
+ title,
37
+ onClose,
38
+ widthVariant = "partial",
39
+ ...props
40
+ }) => {
41
+ const variantBasedProps = (0, import_react.useMemo)(() => {
42
+ return {
43
+ PaperProps: {
44
+ sx: {
45
+ alignItems: "center",
46
+ background: "transparent",
47
+ boxShadow: "none",
48
+ height: heightVariant === "full" ? "100%" : "auto",
49
+ width: widthVariant === "partial" ? "auto" : "100%"
50
+ }
51
+ },
52
+ onClick: (event) => onClose == null ? void 0 : onClose(event, "backdropClick")
53
+ };
54
+ }, [heightVariant, onClose, widthVariant]);
55
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Drawer, { anchor: "top", onClose, ...variantBasedProps, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
56
+ StyledDrawerContentPaper,
57
+ {
58
+ widthVariant,
59
+ elevation: 16,
60
+ onClick: (event) => event.stopPropagation(),
61
+ sx: { width: widthVariant === "full" ? "100%" : void 0 },
62
+ children: [
63
+ title || subTitle ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_flexbox.FlexCol, { alignItems: "start", gap: 1, children: [
64
+ title ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledEllipsisTypography, { variant: "h3", children: title }) : null,
65
+ subTitle ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "subtitle1", textTransform: "none", children: subTitle }) : null
66
+ ] }) : null,
67
+ children
68
+ ]
69
+ }
70
+ ) });
71
+ };
72
+ var StyledEllipsisTypography = (0, import_material.styled)(import_material.Typography, { name: "StyledEllipsisTypography" })(() => ({
73
+ maxWidth: "100%",
74
+ overflowX: "hidden",
75
+ textOverflow: "ellipsis",
76
+ whiteSpace: "nowrap"
77
+ }));
78
+ var StyledDrawerContentPaper = (0, import_material.styled)(import_material.Paper, {
79
+ name: "StyledDrawerContentPaper",
80
+ shouldForwardProp: (prop) => !["widthVariant"].includes(prop)
81
+ })(({ theme, widthVariant }) => ({
82
+ alignItems: "stretch",
83
+ borderRadius: `0 0 ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px`,
84
+ display: "flex",
85
+ flexDirection: "column",
86
+ gap: theme.spacing(2),
87
+ height: "100%",
88
+ maxWidth: "100%",
89
+ overflowX: "hidden",
90
+ padding: theme.spacing(3),
91
+ [theme.breakpoints.up("lg")]: {
92
+ width: widthVariant === "full" ? "100%" : "50%"
93
+ },
94
+ [theme.breakpoints.up("md")]: {
95
+ width: widthVariant === "full" ? "100%" : "75%"
96
+ }
97
+ }));
98
+ // Annotate the CommonJS export names for ESM import in node:
99
+ 0 && (module.exports = {
100
+ DrawerEx
101
+ });
102
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts","../../src/components/Drawer.tsx"],"sourcesContent":["export * from './components'\n","import { Drawer, DrawerProps, Paper, styled, Typography } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { MouseEvent, PropsWithChildren, useMemo } from 'react'\n\nexport interface DrawerExProps extends PropsWithChildren<DrawerProps> {\n heightVariant?: 'full' | 'auto'\n subTitle?: string\n title?: string\n widthVariant?: 'full' | 'partial'\n}\n\nexport const DrawerEx: React.FC<DrawerExProps> = ({\n children,\n heightVariant = 'full',\n subTitle,\n title,\n onClose,\n widthVariant = 'partial',\n ...props\n}) => {\n const variantBasedProps = useMemo(() => {\n return {\n PaperProps: {\n sx: {\n alignItems: 'center',\n background: 'transparent',\n boxShadow: 'none',\n height: heightVariant === 'full' ? '100%' : 'auto',\n width: widthVariant === 'partial' ? 'auto' : '100%',\n },\n },\n onClick: (event: MouseEvent) => onClose?.(event, 'backdropClick'),\n }\n }, [heightVariant, onClose, widthVariant])\n\n return (\n <Drawer anchor={'top'} onClose={onClose} {...variantBasedProps} {...props}>\n {/* Trap the event to prevent triggering the backdrop onClick */}\n <StyledDrawerContentPaper\n widthVariant={widthVariant}\n elevation={16}\n onClick={(event) => event.stopPropagation()}\n sx={{ width: widthVariant === 'full' ? '100%' : undefined }}\n >\n {title || subTitle ? (\n <FlexCol alignItems=\"start\" gap={1}>\n {title ? <StyledEllipsisTypography variant={'h3'}>{title}</StyledEllipsisTypography> : null}\n {subTitle ? (\n <Typography variant={'subtitle1'} textTransform=\"none\">\n {subTitle}\n </Typography>\n ) : null}\n </FlexCol>\n ) : null}\n {children}\n </StyledDrawerContentPaper>\n </Drawer>\n )\n}\n\nconst StyledEllipsisTypography = styled(Typography, { name: 'StyledEllipsisTypography' })(() => ({\n maxWidth: '100%',\n overflowX: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}))\n\nconst StyledDrawerContentPaper = styled(Paper, {\n name: 'StyledDrawerContentPaper',\n shouldForwardProp: (prop) => !['widthVariant'].includes(prop as string),\n})<DrawerExProps>(({ theme, widthVariant }) => ({\n alignItems: 'stretch',\n borderRadius: `0 0 ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px`,\n display: 'flex',\n flexDirection: 'column',\n gap: theme.spacing(2),\n height: '100%',\n maxWidth: '100%',\n overflowX: 'hidden',\n padding: theme.spacing(3),\n [theme.breakpoints.up('lg')]: {\n width: widthVariant === 'full' ? '100%' : '50%',\n },\n [theme.breakpoints.up('md')]: {\n width: widthVariant === 'full' ? '100%' : '75%',\n },\n}))\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAA+D;AAC/D,2BAAwB;AACxB,mBAAuD;AA2C7C;AAlCH,IAAM,WAAoC,CAAC;AAAA,EAChD;AAAA,EACA,gBAAgB;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,GAAG;AACL,MAAM;AACJ,QAAM,wBAAoB,sBAAQ,MAAM;AACtC,WAAO;AAAA,MACL,YAAY;AAAA,QACV,IAAI;AAAA,UACF,YAAY;AAAA,UACZ,YAAY;AAAA,UACZ,WAAW;AAAA,UACX,QAAQ,kBAAkB,SAAS,SAAS;AAAA,UAC5C,OAAO,iBAAiB,YAAY,SAAS;AAAA,QAC/C;AAAA,MACF;AAAA,MACA,SAAS,CAAC,UAAsB,mCAAU,OAAO;AAAA,IACnD;AAAA,EACF,GAAG,CAAC,eAAe,SAAS,YAAY,CAAC;AAEzC,SACE,4CAAC,0BAAO,QAAQ,OAAO,SAAmB,GAAG,mBAAoB,GAAG,OAElE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW;AAAA,MACX,SAAS,CAAC,UAAU,MAAM,gBAAgB;AAAA,MAC1C,IAAI,EAAE,OAAO,iBAAiB,SAAS,SAAS,OAAU;AAAA,MAEzD;AAAA,iBAAS,WACR,6CAAC,gCAAQ,YAAW,SAAQ,KAAK,GAC9B;AAAA,kBAAQ,4CAAC,4BAAyB,SAAS,MAAO,iBAAM,IAA8B;AAAA,UACtF,WACC,4CAAC,8BAAW,SAAS,aAAa,eAAc,QAC7C,oBACH,IACE;AAAA,WACN,IACE;AAAA,QACH;AAAA;AAAA;AAAA,EACH,GACF;AAEJ;AAEA,IAAM,+BAA2B,wBAAO,4BAAY,EAAE,MAAM,2BAA2B,CAAC,EAAE,OAAO;AAAA,EAC/F,UAAU;AAAA,EACV,WAAW;AAAA,EACX,cAAc;AAAA,EACd,YAAY;AACd,EAAE;AAEF,IAAM,+BAA2B,wBAAO,uBAAO;AAAA,EAC7C,MAAM;AAAA,EACN,mBAAmB,CAAC,SAAS,CAAC,CAAC,cAAc,EAAE,SAAS,IAAc;AACxE,CAAC,EAAiB,CAAC,EAAE,OAAO,aAAa,OAAO;AAAA,EAC9C,YAAY;AAAA,EACZ,cAAc,OAAO,MAAM,MAAM,YAAY,MAAM,MAAM,MAAM,YAAY;AAAA,EAC3E,SAAS;AAAA,EACT,eAAe;AAAA,EACf,KAAK,MAAM,QAAQ,CAAC;AAAA,EACpB,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,WAAW;AAAA,EACX,SAAS,MAAM,QAAQ,CAAC;AAAA,EACxB,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG;AAAA,IAC5B,OAAO,iBAAiB,SAAS,SAAS;AAAA,EAC5C;AAAA,EACA,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG;AAAA,IAC5B,OAAO,iBAAiB,SAAS,SAAS;AAAA,EAC5C;AACF,EAAE;","names":[]}
@@ -0,0 +1,2 @@
1
+ export * from './components';
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,cAAc,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './components';
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,cAAc,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './components';
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,cAAc,CAAA"}
@@ -0,0 +1,75 @@
1
+ // src/components/Drawer.tsx
2
+ import { Drawer, Paper, styled, Typography } from "@mui/material";
3
+ import { FlexCol } from "@xylabs/react-flexbox";
4
+ import { useMemo } from "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ var DrawerEx = ({
7
+ children,
8
+ heightVariant = "full",
9
+ subTitle,
10
+ title,
11
+ onClose,
12
+ widthVariant = "partial",
13
+ ...props
14
+ }) => {
15
+ const variantBasedProps = useMemo(() => {
16
+ return {
17
+ PaperProps: {
18
+ sx: {
19
+ alignItems: "center",
20
+ background: "transparent",
21
+ boxShadow: "none",
22
+ height: heightVariant === "full" ? "100%" : "auto",
23
+ width: widthVariant === "partial" ? "auto" : "100%"
24
+ }
25
+ },
26
+ onClick: (event) => onClose == null ? void 0 : onClose(event, "backdropClick")
27
+ };
28
+ }, [heightVariant, onClose, widthVariant]);
29
+ return /* @__PURE__ */ jsx(Drawer, { anchor: "top", onClose, ...variantBasedProps, ...props, children: /* @__PURE__ */ jsxs(
30
+ StyledDrawerContentPaper,
31
+ {
32
+ widthVariant,
33
+ elevation: 16,
34
+ onClick: (event) => event.stopPropagation(),
35
+ sx: { width: widthVariant === "full" ? "100%" : void 0 },
36
+ children: [
37
+ title || subTitle ? /* @__PURE__ */ jsxs(FlexCol, { alignItems: "start", gap: 1, children: [
38
+ title ? /* @__PURE__ */ jsx(StyledEllipsisTypography, { variant: "h3", children: title }) : null,
39
+ subTitle ? /* @__PURE__ */ jsx(Typography, { variant: "subtitle1", textTransform: "none", children: subTitle }) : null
40
+ ] }) : null,
41
+ children
42
+ ]
43
+ }
44
+ ) });
45
+ };
46
+ var StyledEllipsisTypography = styled(Typography, { name: "StyledEllipsisTypography" })(() => ({
47
+ maxWidth: "100%",
48
+ overflowX: "hidden",
49
+ textOverflow: "ellipsis",
50
+ whiteSpace: "nowrap"
51
+ }));
52
+ var StyledDrawerContentPaper = styled(Paper, {
53
+ name: "StyledDrawerContentPaper",
54
+ shouldForwardProp: (prop) => !["widthVariant"].includes(prop)
55
+ })(({ theme, widthVariant }) => ({
56
+ alignItems: "stretch",
57
+ borderRadius: `0 0 ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px`,
58
+ display: "flex",
59
+ flexDirection: "column",
60
+ gap: theme.spacing(2),
61
+ height: "100%",
62
+ maxWidth: "100%",
63
+ overflowX: "hidden",
64
+ padding: theme.spacing(3),
65
+ [theme.breakpoints.up("lg")]: {
66
+ width: widthVariant === "full" ? "100%" : "50%"
67
+ },
68
+ [theme.breakpoints.up("md")]: {
69
+ width: widthVariant === "full" ? "100%" : "75%"
70
+ }
71
+ }));
72
+ export {
73
+ DrawerEx
74
+ };
75
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Drawer.tsx"],"sourcesContent":["import { Drawer, DrawerProps, Paper, styled, Typography } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { MouseEvent, PropsWithChildren, useMemo } from 'react'\n\nexport interface DrawerExProps extends PropsWithChildren<DrawerProps> {\n heightVariant?: 'full' | 'auto'\n subTitle?: string\n title?: string\n widthVariant?: 'full' | 'partial'\n}\n\nexport const DrawerEx: React.FC<DrawerExProps> = ({\n children,\n heightVariant = 'full',\n subTitle,\n title,\n onClose,\n widthVariant = 'partial',\n ...props\n}) => {\n const variantBasedProps = useMemo(() => {\n return {\n PaperProps: {\n sx: {\n alignItems: 'center',\n background: 'transparent',\n boxShadow: 'none',\n height: heightVariant === 'full' ? '100%' : 'auto',\n width: widthVariant === 'partial' ? 'auto' : '100%',\n },\n },\n onClick: (event: MouseEvent) => onClose?.(event, 'backdropClick'),\n }\n }, [heightVariant, onClose, widthVariant])\n\n return (\n <Drawer anchor={'top'} onClose={onClose} {...variantBasedProps} {...props}>\n {/* Trap the event to prevent triggering the backdrop onClick */}\n <StyledDrawerContentPaper\n widthVariant={widthVariant}\n elevation={16}\n onClick={(event) => event.stopPropagation()}\n sx={{ width: widthVariant === 'full' ? '100%' : undefined }}\n >\n {title || subTitle ? (\n <FlexCol alignItems=\"start\" gap={1}>\n {title ? <StyledEllipsisTypography variant={'h3'}>{title}</StyledEllipsisTypography> : null}\n {subTitle ? (\n <Typography variant={'subtitle1'} textTransform=\"none\">\n {subTitle}\n </Typography>\n ) : null}\n </FlexCol>\n ) : null}\n {children}\n </StyledDrawerContentPaper>\n </Drawer>\n )\n}\n\nconst StyledEllipsisTypography = styled(Typography, { name: 'StyledEllipsisTypography' })(() => ({\n maxWidth: '100%',\n overflowX: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}))\n\nconst StyledDrawerContentPaper = styled(Paper, {\n name: 'StyledDrawerContentPaper',\n shouldForwardProp: (prop) => !['widthVariant'].includes(prop as string),\n})<DrawerExProps>(({ theme, widthVariant }) => ({\n alignItems: 'stretch',\n borderRadius: `0 0 ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px`,\n display: 'flex',\n flexDirection: 'column',\n gap: theme.spacing(2),\n height: '100%',\n maxWidth: '100%',\n overflowX: 'hidden',\n padding: theme.spacing(3),\n [theme.breakpoints.up('lg')]: {\n width: widthVariant === 'full' ? '100%' : '50%',\n },\n [theme.breakpoints.up('md')]: {\n width: widthVariant === 'full' ? '100%' : '75%',\n },\n}))\n"],"mappings":";AAAA,SAAS,QAAqB,OAAO,QAAQ,kBAAkB;AAC/D,SAAS,eAAe;AACxB,SAAwC,eAAe;AA2C7C,SACW,KADX;AAlCH,IAAM,WAAoC,CAAC;AAAA,EAChD;AAAA,EACA,gBAAgB;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,GAAG;AACL,MAAM;AACJ,QAAM,oBAAoB,QAAQ,MAAM;AACtC,WAAO;AAAA,MACL,YAAY;AAAA,QACV,IAAI;AAAA,UACF,YAAY;AAAA,UACZ,YAAY;AAAA,UACZ,WAAW;AAAA,UACX,QAAQ,kBAAkB,SAAS,SAAS;AAAA,UAC5C,OAAO,iBAAiB,YAAY,SAAS;AAAA,QAC/C;AAAA,MACF;AAAA,MACA,SAAS,CAAC,UAAsB,mCAAU,OAAO;AAAA,IACnD;AAAA,EACF,GAAG,CAAC,eAAe,SAAS,YAAY,CAAC;AAEzC,SACE,oBAAC,UAAO,QAAQ,OAAO,SAAmB,GAAG,mBAAoB,GAAG,OAElE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW;AAAA,MACX,SAAS,CAAC,UAAU,MAAM,gBAAgB;AAAA,MAC1C,IAAI,EAAE,OAAO,iBAAiB,SAAS,SAAS,OAAU;AAAA,MAEzD;AAAA,iBAAS,WACR,qBAAC,WAAQ,YAAW,SAAQ,KAAK,GAC9B;AAAA,kBAAQ,oBAAC,4BAAyB,SAAS,MAAO,iBAAM,IAA8B;AAAA,UACtF,WACC,oBAAC,cAAW,SAAS,aAAa,eAAc,QAC7C,oBACH,IACE;AAAA,WACN,IACE;AAAA,QACH;AAAA;AAAA;AAAA,EACH,GACF;AAEJ;AAEA,IAAM,2BAA2B,OAAO,YAAY,EAAE,MAAM,2BAA2B,CAAC,EAAE,OAAO;AAAA,EAC/F,UAAU;AAAA,EACV,WAAW;AAAA,EACX,cAAc;AAAA,EACd,YAAY;AACd,EAAE;AAEF,IAAM,2BAA2B,OAAO,OAAO;AAAA,EAC7C,MAAM;AAAA,EACN,mBAAmB,CAAC,SAAS,CAAC,CAAC,cAAc,EAAE,SAAS,IAAc;AACxE,CAAC,EAAiB,CAAC,EAAE,OAAO,aAAa,OAAO;AAAA,EAC9C,YAAY;AAAA,EACZ,cAAc,OAAO,MAAM,MAAM,YAAY,MAAM,MAAM,MAAM,YAAY;AAAA,EAC3E,SAAS;AAAA,EACT,eAAe;AAAA,EACf,KAAK,MAAM,QAAQ,CAAC;AAAA,EACpB,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,WAAW;AAAA,EACX,SAAS,MAAM,QAAQ,CAAC;AAAA,EACxB,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG;AAAA,IAC5B,OAAO,iBAAiB,SAAS,SAAS;AAAA,EAC5C;AAAA,EACA,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG;AAAA,IAC5B,OAAO,iBAAiB,SAAS,SAAS;AAAA,EAC5C;AACF,EAAE;","names":[]}
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@xyo-network/react-drawer",
3
+ "author": {
4
+ "email": "support@xyo.network",
5
+ "name": "XYO Development Team",
6
+ "url": "https://xyo.network"
7
+ },
8
+ "bugs": {
9
+ "email": "support@xyo.network",
10
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
11
+ },
12
+ "dependencies": {
13
+ "@xylabs/react-flexbox": "^3.0.39"
14
+ },
15
+ "peerDependencies": {
16
+ "@mui/material": "^5",
17
+ "@mui/styles": "^5",
18
+ "react": "^18",
19
+ "react-dom": "^18"
20
+ },
21
+ "devDependencies": {
22
+ "@storybook/react": "^7.6.10",
23
+ "@xylabs/ts-scripts-yarn3": "^3.2.42",
24
+ "@xylabs/tsconfig-react": "^3.2.42",
25
+ "typescript": "^5.3.3"
26
+ },
27
+ "description": "Common React library for all XYO projects that use React",
28
+ "docs": "dist/docs.json",
29
+ "exports": {
30
+ ".": {
31
+ "node": {
32
+ "import": {
33
+ "types": "./dist/node/index.d.mts",
34
+ "default": "./dist/node/index.js"
35
+ },
36
+ "require": {
37
+ "types": "./dist/node/index.d.cts",
38
+ "default": "./dist/node/index.cjs"
39
+ }
40
+ },
41
+ "browser": {
42
+ "import": {
43
+ "types": "./dist/browser/index.d.mts",
44
+ "default": "./dist/browser/index.js"
45
+ },
46
+ "require": {
47
+ "types": "./dist/browser/index.d.cts",
48
+ "default": "./dist/browser/index.cjs"
49
+ }
50
+ },
51
+ "default": "./dist/browser/index.js"
52
+ },
53
+ "./package.json": "./package.json"
54
+ },
55
+ "main": "dist/browser/index.cjs",
56
+ "module": "dist/browser/index.js",
57
+ "homepage": "https://xyo.network",
58
+ "keywords": [
59
+ "xyo",
60
+ "utility",
61
+ "typescript",
62
+ "react"
63
+ ],
64
+ "license": "LGPL-3.0-only",
65
+ "publishConfig": {
66
+ "access": "public"
67
+ },
68
+ "repository": {
69
+ "type": "git",
70
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js.git"
71
+ },
72
+ "scripts": {
73
+ "lint-pkg": "npmPkgJsonLint .",
74
+ "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\""
75
+ },
76
+ "sideEffects": false,
77
+ "types": "dist/browser/index.d.ts",
78
+ "version": "2.67.18",
79
+ "type": "module"
80
+ }
@@ -0,0 +1,35 @@
1
+ import { Meta, StoryFn } from '@storybook/react'
2
+ import { DrawerEx, DrawerExProps } from './Drawer'
3
+
4
+ // eslint-disable-next-line import/no-default-export
5
+ export default {
6
+ title: 'modules/drawer/Ex',
7
+ } as Meta
8
+
9
+ const Template: StoryFn<React.FC<DrawerExProps>> = (props) => {
10
+ return <div style={{ width: '100vw', height: 'calc(100vh - 2rem)'}}><DrawerEx {...props} /></div>
11
+ }
12
+
13
+ const Default = Template.bind({})
14
+ Default.args = {}
15
+
16
+ const WithOpen = Template.bind({})
17
+ WithOpen.args = {
18
+ open: true
19
+ }
20
+
21
+ const WithFullScreen = Template.bind({})
22
+ WithFullScreen.args = {
23
+ open: true,
24
+ widthVariant: 'full',
25
+ heightVariant: 'full'
26
+ }
27
+
28
+ const WithTitles = Template.bind({})
29
+ WithTitles.args = {
30
+ open: true,
31
+ title: 'Title',
32
+ subTitle: "SubTitle"
33
+ }
34
+
35
+ export { Default, WithFullScreen, WithOpen, WithTitles }
@@ -0,0 +1,87 @@
1
+ import { Drawer, DrawerProps, Paper, styled, Typography } from '@mui/material'
2
+ import { FlexCol } from '@xylabs/react-flexbox'
3
+ import { MouseEvent, PropsWithChildren, useMemo } from 'react'
4
+
5
+ export interface DrawerExProps extends PropsWithChildren<DrawerProps> {
6
+ heightVariant?: 'full' | 'auto'
7
+ subTitle?: string
8
+ title?: string
9
+ widthVariant?: 'full' | 'partial'
10
+ }
11
+
12
+ export const DrawerEx: React.FC<DrawerExProps> = ({
13
+ children,
14
+ heightVariant = 'full',
15
+ subTitle,
16
+ title,
17
+ onClose,
18
+ widthVariant = 'partial',
19
+ ...props
20
+ }) => {
21
+ const variantBasedProps = useMemo(() => {
22
+ return {
23
+ PaperProps: {
24
+ sx: {
25
+ alignItems: 'center',
26
+ background: 'transparent',
27
+ boxShadow: 'none',
28
+ height: heightVariant === 'full' ? '100%' : 'auto',
29
+ width: widthVariant === 'partial' ? 'auto' : '100%',
30
+ },
31
+ },
32
+ onClick: (event: MouseEvent) => onClose?.(event, 'backdropClick'),
33
+ }
34
+ }, [heightVariant, onClose, widthVariant])
35
+
36
+ return (
37
+ <Drawer anchor={'top'} onClose={onClose} {...variantBasedProps} {...props}>
38
+ {/* Trap the event to prevent triggering the backdrop onClick */}
39
+ <StyledDrawerContentPaper
40
+ widthVariant={widthVariant}
41
+ elevation={16}
42
+ onClick={(event) => event.stopPropagation()}
43
+ sx={{ width: widthVariant === 'full' ? '100%' : undefined }}
44
+ >
45
+ {title || subTitle ? (
46
+ <FlexCol alignItems="start" gap={1}>
47
+ {title ? <StyledEllipsisTypography variant={'h3'}>{title}</StyledEllipsisTypography> : null}
48
+ {subTitle ? (
49
+ <Typography variant={'subtitle1'} textTransform="none">
50
+ {subTitle}
51
+ </Typography>
52
+ ) : null}
53
+ </FlexCol>
54
+ ) : null}
55
+ {children}
56
+ </StyledDrawerContentPaper>
57
+ </Drawer>
58
+ )
59
+ }
60
+
61
+ const StyledEllipsisTypography = styled(Typography, { name: 'StyledEllipsisTypography' })(() => ({
62
+ maxWidth: '100%',
63
+ overflowX: 'hidden',
64
+ textOverflow: 'ellipsis',
65
+ whiteSpace: 'nowrap',
66
+ }))
67
+
68
+ const StyledDrawerContentPaper = styled(Paper, {
69
+ name: 'StyledDrawerContentPaper',
70
+ shouldForwardProp: (prop) => !['widthVariant'].includes(prop as string),
71
+ })<DrawerExProps>(({ theme, widthVariant }) => ({
72
+ alignItems: 'stretch',
73
+ borderRadius: `0 0 ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px`,
74
+ display: 'flex',
75
+ flexDirection: 'column',
76
+ gap: theme.spacing(2),
77
+ height: '100%',
78
+ maxWidth: '100%',
79
+ overflowX: 'hidden',
80
+ padding: theme.spacing(3),
81
+ [theme.breakpoints.up('lg')]: {
82
+ width: widthVariant === 'full' ? '100%' : '50%',
83
+ },
84
+ [theme.breakpoints.up('md')]: {
85
+ width: widthVariant === 'full' ? '100%' : '75%',
86
+ },
87
+ }))
@@ -0,0 +1 @@
1
+ export * from './Drawer'
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './components'
@@ -0,0 +1,5 @@
1
+ declare module '*.png'
2
+ declare module '*.jpg'
3
+ declare module '*.svg'
4
+ declare module '*.gif'
5
+ declare module '*.webp'
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
+ }