@xyo-network/react-drawer 2.81.9 → 2.82.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. package/dist/browser/components/Drawer.d.cts +1 -1
  2. package/dist/browser/components/Drawer.d.cts.map +1 -1
  3. package/dist/browser/components/Drawer.d.mts +1 -1
  4. package/dist/browser/components/Drawer.d.mts.map +1 -1
  5. package/dist/browser/components/Drawer.d.ts +1 -1
  6. package/dist/browser/components/Drawer.d.ts.map +1 -1
  7. package/dist/browser/components/index.d.cts +1 -1
  8. package/dist/browser/components/index.d.cts.map +1 -1
  9. package/dist/browser/components/index.d.mts +1 -1
  10. package/dist/browser/components/index.d.mts.map +1 -1
  11. package/dist/browser/components/index.d.ts +1 -1
  12. package/dist/browser/components/index.d.ts.map +1 -1
  13. package/dist/browser/index.cjs +46 -31
  14. package/dist/browser/index.cjs.map +1 -1
  15. package/dist/browser/index.d.cts +1 -1
  16. package/dist/browser/index.d.mts +1 -1
  17. package/dist/browser/index.d.ts +1 -1
  18. package/dist/browser/index.mjs +82 -0
  19. package/dist/browser/index.mjs.map +1 -0
  20. package/dist/neutral/components/Drawer.d.cts +1 -1
  21. package/dist/neutral/components/Drawer.d.cts.map +1 -1
  22. package/dist/neutral/components/Drawer.d.mts +1 -1
  23. package/dist/neutral/components/Drawer.d.mts.map +1 -1
  24. package/dist/neutral/components/Drawer.d.ts +1 -1
  25. package/dist/neutral/components/Drawer.d.ts.map +1 -1
  26. package/dist/neutral/components/index.d.cts +1 -1
  27. package/dist/neutral/components/index.d.cts.map +1 -1
  28. package/dist/neutral/components/index.d.mts +1 -1
  29. package/dist/neutral/components/index.d.mts.map +1 -1
  30. package/dist/neutral/components/index.d.ts +1 -1
  31. package/dist/neutral/components/index.d.ts.map +1 -1
  32. package/dist/neutral/index.cjs +46 -31
  33. package/dist/neutral/index.cjs.map +1 -1
  34. package/dist/neutral/index.d.cts +1 -1
  35. package/dist/neutral/index.d.mts +1 -1
  36. package/dist/neutral/index.d.ts +1 -1
  37. package/dist/neutral/index.mjs +82 -0
  38. package/dist/neutral/index.mjs.map +1 -0
  39. package/dist/node/components/Drawer.d.cts +1 -1
  40. package/dist/node/components/Drawer.d.cts.map +1 -1
  41. package/dist/node/components/Drawer.d.mts +1 -1
  42. package/dist/node/components/Drawer.d.mts.map +1 -1
  43. package/dist/node/components/Drawer.d.ts +1 -1
  44. package/dist/node/components/Drawer.d.ts.map +1 -1
  45. package/dist/node/components/index.d.cts +1 -1
  46. package/dist/node/components/index.d.cts.map +1 -1
  47. package/dist/node/components/index.d.mts +1 -1
  48. package/dist/node/components/index.d.mts.map +1 -1
  49. package/dist/node/components/index.d.ts +1 -1
  50. package/dist/node/components/index.d.ts.map +1 -1
  51. package/dist/node/index.cjs +46 -31
  52. package/dist/node/index.cjs.map +1 -1
  53. package/dist/node/index.d.cts +1 -1
  54. package/dist/node/index.d.mts +1 -1
  55. package/dist/node/index.d.ts +1 -1
  56. package/dist/node/index.mjs +82 -0
  57. package/dist/node/index.mjs.map +1 -0
  58. package/package.json +9 -9
  59. package/src/components/Drawer.stories.tsx +2 -2
  60. package/src/components/Drawer.tsx +20 -16
  61. package/src/components/index.ts +1 -1
  62. package/src/index.ts +1 -1
  63. package/dist/browser/index.js +0 -75
  64. package/dist/browser/index.js.map +0 -1
  65. package/dist/neutral/index.js +0 -75
  66. package/dist/neutral/index.js.map +0 -1
  67. package/dist/node/index.js +0 -75
  68. package/dist/node/index.js.map +0 -1
@@ -0,0 +1,82 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/components/Drawer.tsx
5
+ import { Drawer, Paper, styled, Typography } from "@mui/material";
6
+ import { FlexCol } from "@xylabs/react-flexbox";
7
+ import React, { useMemo } from "react";
8
+ var DrawerEx = /* @__PURE__ */ __name(({ children, heightVariant = "full", subTitle, title, onClose, widthVariant = "partial", ...props }) => {
9
+ const variantBasedProps = useMemo(() => {
10
+ return {
11
+ PaperProps: {
12
+ sx: {
13
+ alignItems: "center",
14
+ background: "transparent",
15
+ boxShadow: "none",
16
+ height: heightVariant === "full" ? "100%" : "auto",
17
+ width: widthVariant === "partial" ? "auto" : "100%"
18
+ }
19
+ },
20
+ onClick: /* @__PURE__ */ __name((event) => onClose?.(event, "backdropClick"), "onClick")
21
+ };
22
+ }, [
23
+ heightVariant,
24
+ onClose,
25
+ widthVariant
26
+ ]);
27
+ return /* @__PURE__ */ React.createElement(Drawer, {
28
+ anchor: "top",
29
+ onClose,
30
+ ...variantBasedProps,
31
+ ...props
32
+ }, /* @__PURE__ */ React.createElement(StyledDrawerContentPaper, {
33
+ widthVariant,
34
+ elevation: 16,
35
+ onClick: /* @__PURE__ */ __name((event) => event.stopPropagation(), "onClick"),
36
+ sx: {
37
+ width: widthVariant === "full" ? "100%" : void 0
38
+ }
39
+ }, title || subTitle ? /* @__PURE__ */ React.createElement(FlexCol, {
40
+ alignItems: "start",
41
+ gap: 1
42
+ }, title ? /* @__PURE__ */ React.createElement(StyledEllipsisTypography, {
43
+ variant: "h3"
44
+ }, title) : null, subTitle ? /* @__PURE__ */ React.createElement(Typography, {
45
+ variant: "subtitle1",
46
+ textTransform: "none"
47
+ }, subTitle) : null) : null, children));
48
+ }, "DrawerEx");
49
+ var StyledEllipsisTypography = styled(Typography, {
50
+ name: "StyledEllipsisTypography"
51
+ })(() => ({
52
+ maxWidth: "100%",
53
+ overflowX: "hidden",
54
+ textOverflow: "ellipsis",
55
+ whiteSpace: "nowrap"
56
+ }));
57
+ var StyledDrawerContentPaper = styled(Paper, {
58
+ name: "StyledDrawerContentPaper",
59
+ shouldForwardProp: /* @__PURE__ */ __name((prop) => ![
60
+ "widthVariant"
61
+ ].includes(prop), "shouldForwardProp")
62
+ })(({ theme, widthVariant }) => ({
63
+ alignItems: "stretch",
64
+ borderRadius: `0 0 ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px`,
65
+ display: "flex",
66
+ flexDirection: "column",
67
+ gap: theme.spacing(2),
68
+ height: "100%",
69
+ maxWidth: "100%",
70
+ overflowX: "hidden",
71
+ padding: theme.spacing(3),
72
+ [theme.breakpoints.up("lg")]: {
73
+ width: widthVariant === "full" ? "100%" : "50%"
74
+ },
75
+ [theme.breakpoints.up("md")]: {
76
+ width: widthVariant === "full" ? "100%" : "75%"
77
+ }
78
+ }));
79
+ export {
80
+ DrawerEx
81
+ };
82
+ //# sourceMappingURL=index.mjs.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 React, { 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 ? (\n <FlexCol alignItems=\"start\" gap={1}>\n {title\n ? <StyledEllipsisTypography variant=\"h3\">{title}</StyledEllipsisTypography>\n : null}\n {subTitle\n ? (\n <Typography variant=\"subtitle1\" textTransform=\"none\">\n {subTitle}\n </Typography>\n )\n : null}\n </FlexCol>\n )\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,SAASA,QAAqBC,OAAOC,QAAQC,kBAAkB;AAC/D,SAASC,eAAe;AACxB,OAAOC,SAAwCC,eAAe;AASvD,IAAMC,WAAoC,wBAAC,EAChDC,UACAC,gBAAgB,QAChBC,UACAC,OACAC,SACAC,eAAe,WACf,GAAGC,MAAAA,MACJ;AACC,QAAMC,oBAAoBC,QAAQ,MAAA;AAChC,WAAO;MACLC,YAAY;QACVC,IAAI;UACFC,YAAY;UACZC,YAAY;UACZC,WAAW;UACXC,QAAQb,kBAAkB,SAAS,SAAS;UAC5Cc,OAAOV,iBAAiB,YAAY,SAAS;QAC/C;MACF;MACAW,SAAS,wBAACC,UAAsBb,UAAUa,OAAO,eAAA,GAAxC;IACX;EACF,GAAG;IAAChB;IAAeG;IAASC;GAAa;AAEzC,SACE,sBAAA,cAACa,QAAAA;IAAOC,QAAO;IAAMf;IAAmB,GAAGG;IAAoB,GAAGD;KAEhE,sBAAA,cAACc,0BAAAA;IACCf;IACAgB,WAAW;IACXL,SAASC,wBAAAA,UAASA,MAAMK,gBAAe,GAA9BL;IACTP,IAAI;MAAEK,OAAOV,iBAAiB,SAAS,SAASkB;IAAU;KAEzDpB,SAASD,WAEJ,sBAAA,cAACsB,SAAAA;IAAQb,YAAW;IAAQc,KAAK;KAC9BtB,QACG,sBAAA,cAACuB,0BAAAA;IAAyBC,SAAQ;KAAMxB,KAAAA,IACxC,MACHD,WAEK,sBAAA,cAAC0B,YAAAA;IAAWD,SAAQ;IAAYE,eAAc;KAC3C3B,QAAAA,IAGL,IAAA,IAGR,MACHF,QAAAA,CAAAA;AAIT,GArDiD;AAuDjD,IAAM0B,2BAA2BI,OAAOF,YAAY;EAAEG,MAAM;AAA2B,CAAA,EAAG,OAAO;EAC/FC,UAAU;EACVC,WAAW;EACXC,cAAc;EACdC,YAAY;AACd,EAAA;AAEA,IAAMf,2BAA2BU,OAAOM,OAAO;EAC7CL,MAAM;EACNM,mBAAmBC,wBAAAA,SAAQ,CAAC;IAAC;IAAgBC,SAASD,IAAAA,GAAnCA;AACrB,CAAA,EAAkB,CAAC,EAAEE,OAAOnC,aAAY,OAAQ;EAC9CM,YAAY;EACZ8B,cAAc,OAAOD,MAAME,MAAMD,YAAY,MAAMD,MAAME,MAAMD,YAAY;EAC3EE,SAAS;EACTC,eAAe;EACfnB,KAAKe,MAAMK,QAAQ,CAAA;EACnB/B,QAAQ;EACRkB,UAAU;EACVC,WAAW;EACXa,SAASN,MAAMK,QAAQ,CAAA;EACvB,CAACL,MAAMO,YAAYC,GAAG,IAAA,CAAA,GAAQ;IAC5BjC,OAAOV,iBAAiB,SAAS,SAAS;EAC5C;EACA,CAACmC,MAAMO,YAAYC,GAAG,IAAA,CAAA,GAAQ;IAC5BjC,OAAOV,iBAAiB,SAAS,SAAS;EAC5C;AACF,EAAA;","names":["Drawer","Paper","styled","Typography","FlexCol","React","useMemo","DrawerEx","children","heightVariant","subTitle","title","onClose","widthVariant","props","variantBasedProps","useMemo","PaperProps","sx","alignItems","background","boxShadow","height","width","onClick","event","Drawer","anchor","StyledDrawerContentPaper","elevation","stopPropagation","undefined","FlexCol","gap","StyledEllipsisTypography","variant","Typography","textTransform","styled","name","maxWidth","overflowX","textOverflow","whiteSpace","Paper","shouldForwardProp","prop","includes","theme","borderRadius","shape","display","flexDirection","spacing","padding","breakpoints","up"]}
@@ -1,5 +1,5 @@
1
1
  import { DrawerProps } from '@mui/material';
2
- import { PropsWithChildren } from 'react';
2
+ import React, { PropsWithChildren } from 'react';
3
3
  export interface DrawerExProps extends PropsWithChildren<DrawerProps> {
4
4
  heightVariant?: 'full' | 'auto';
5
5
  subTitle?: string;
@@ -1 +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,CAiD5C,CAAA"}
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,KAAK,EAAE,EAAc,iBAAiB,EAAW,MAAM,OAAO,CAAA;AAErE,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,CAqD5C,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { DrawerProps } from '@mui/material';
2
- import { PropsWithChildren } from 'react';
2
+ import React, { PropsWithChildren } from 'react';
3
3
  export interface DrawerExProps extends PropsWithChildren<DrawerProps> {
4
4
  heightVariant?: 'full' | 'auto';
5
5
  subTitle?: string;
@@ -1 +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,CAiD5C,CAAA"}
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,KAAK,EAAE,EAAc,iBAAiB,EAAW,MAAM,OAAO,CAAA;AAErE,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,CAqD5C,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { DrawerProps } from '@mui/material';
2
- import { PropsWithChildren } from 'react';
2
+ import React, { PropsWithChildren } from 'react';
3
3
  export interface DrawerExProps extends PropsWithChildren<DrawerProps> {
4
4
  heightVariant?: 'full' | 'auto';
5
5
  subTitle?: string;
@@ -1 +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,CAiD5C,CAAA"}
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,KAAK,EAAE,EAAc,iBAAiB,EAAW,MAAM,OAAO,CAAA;AAErE,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,CAqD5C,CAAA"}
@@ -1,2 +1,2 @@
1
- export * from './Drawer.js';
1
+ export * from './Drawer.tsx';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
@@ -1,2 +1,2 @@
1
- export * from './Drawer.js';
1
+ export * from './Drawer.tsx';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
@@ -1,2 +1,2 @@
1
- export * from './Drawer.js';
1
+ export * from './Drawer.tsx';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
@@ -1,8 +1,11 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
9
  var __export = (target, all) => {
7
10
  for (var name in all)
8
11
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -15,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
15
18
  }
16
19
  return to;
17
20
  };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
18
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
30
 
20
31
  // src/index.ts
@@ -27,17 +38,8 @@ module.exports = __toCommonJS(src_exports);
27
38
  // src/components/Drawer.tsx
28
39
  var import_material = require("@mui/material");
29
40
  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
+ var import_react = __toESM(require("react"), 1);
42
+ var DrawerEx = /* @__PURE__ */ __name(({ children, heightVariant = "full", subTitle, title, onClose, widthVariant = "partial", ...props }) => {
41
43
  const variantBasedProps = (0, import_react.useMemo)(() => {
42
44
  return {
43
45
  PaperProps: {
@@ -49,27 +51,38 @@ var DrawerEx = ({
49
51
  width: widthVariant === "partial" ? "auto" : "100%"
50
52
  }
51
53
  },
52
- onClick: (event) => onClose == null ? void 0 : onClose(event, "backdropClick")
54
+ onClick: /* @__PURE__ */ __name((event) => onClose == null ? void 0 : onClose(event, "backdropClick"), "onClick")
53
55
  };
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
- ]
56
+ }, [
57
+ heightVariant,
58
+ onClose,
59
+ widthVariant
60
+ ]);
61
+ return /* @__PURE__ */ import_react.default.createElement(import_material.Drawer, {
62
+ anchor: "top",
63
+ onClose,
64
+ ...variantBasedProps,
65
+ ...props
66
+ }, /* @__PURE__ */ import_react.default.createElement(StyledDrawerContentPaper, {
67
+ widthVariant,
68
+ elevation: 16,
69
+ onClick: /* @__PURE__ */ __name((event) => event.stopPropagation(), "onClick"),
70
+ sx: {
71
+ width: widthVariant === "full" ? "100%" : void 0
69
72
  }
70
- ) });
71
- };
72
- var StyledEllipsisTypography = (0, import_material.styled)(import_material.Typography, { name: "StyledEllipsisTypography" })(() => ({
73
+ }, title || subTitle ? /* @__PURE__ */ import_react.default.createElement(import_react_flexbox.FlexCol, {
74
+ alignItems: "start",
75
+ gap: 1
76
+ }, title ? /* @__PURE__ */ import_react.default.createElement(StyledEllipsisTypography, {
77
+ variant: "h3"
78
+ }, title) : null, subTitle ? /* @__PURE__ */ import_react.default.createElement(import_material.Typography, {
79
+ variant: "subtitle1",
80
+ textTransform: "none"
81
+ }, subTitle) : null) : null, children));
82
+ }, "DrawerEx");
83
+ var StyledEllipsisTypography = (0, import_material.styled)(import_material.Typography, {
84
+ name: "StyledEllipsisTypography"
85
+ })(() => ({
73
86
  maxWidth: "100%",
74
87
  overflowX: "hidden",
75
88
  textOverflow: "ellipsis",
@@ -77,7 +90,9 @@ var StyledEllipsisTypography = (0, import_material.styled)(import_material.Typog
77
90
  }));
78
91
  var StyledDrawerContentPaper = (0, import_material.styled)(import_material.Paper, {
79
92
  name: "StyledDrawerContentPaper",
80
- shouldForwardProp: (prop) => !["widthVariant"].includes(prop)
93
+ shouldForwardProp: /* @__PURE__ */ __name((prop) => ![
94
+ "widthVariant"
95
+ ].includes(prop), "shouldForwardProp")
81
96
  })(({ theme, widthVariant }) => ({
82
97
  alignItems: "stretch",
83
98
  borderRadius: `0 0 ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px`,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/components/Drawer.tsx"],"sourcesContent":["export * from './components/index.js'\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 ?\n <StyledEllipsisTypography variant={'h3'}>{title}</StyledEllipsisTypography>\n : 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,kBACC,4CAAC,4BAAyB,SAAS,MAAO,iBAAM,IAChD;AAAA,UACD,WACC,4CAAC,8BAAW,SAAS,aAAa,eAAc,QAC7C,oBACH,IACA;AAAA,WACJ,IACA;AAAA,QACD;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":[]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/components/Drawer.tsx"],"sourcesContent":["export * from './components/index.ts'\n","import { Drawer, DrawerProps, Paper, styled, Typography } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport React, { 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 ? (\n <FlexCol alignItems=\"start\" gap={1}>\n {title\n ? <StyledEllipsisTypography variant=\"h3\">{title}</StyledEllipsisTypography>\n : null}\n {subTitle\n ? (\n <Typography variant=\"subtitle1\" textTransform=\"none\">\n {subTitle}\n </Typography>\n )\n : null}\n </FlexCol>\n )\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;;;;;;;ACAA,sBAA+D;AAC/D,2BAAwB;AACxB,mBAA8D;AASvD,IAAMA,WAAoC,wBAAC,EAChDC,UACAC,gBAAgB,QAChBC,UACAC,OACAC,SACAC,eAAe,WACf,GAAGC,MAAAA,MACJ;AACC,QAAMC,wBAAoBC,sBAAQ,MAAA;AAChC,WAAO;MACLC,YAAY;QACVC,IAAI;UACFC,YAAY;UACZC,YAAY;UACZC,WAAW;UACXC,QAAQb,kBAAkB,SAAS,SAAS;UAC5Cc,OAAOV,iBAAiB,YAAY,SAAS;QAC/C;MACF;MACAW,SAAS,wBAACC,UAAsBb,mCAAUa,OAAO,kBAAxC;IACX;EACF,GAAG;IAAChB;IAAeG;IAASC;GAAa;AAEzC,SACE,6BAAAa,QAAA,cAACC,wBAAAA;IAAOC,QAAO;IAAMhB;IAAmB,GAAGG;IAAoB,GAAGD;KAEhE,6BAAAY,QAAA,cAACG,0BAAAA;IACChB;IACAiB,WAAW;IACXN,SAASC,wBAAAA,UAASA,MAAMM,gBAAe,GAA9BN;IACTP,IAAI;MAAEK,OAAOV,iBAAiB,SAAS,SAASmB;IAAU;KAEzDrB,SAASD,WAEJ,6BAAAgB,QAAA,cAACO,8BAAAA;IAAQd,YAAW;IAAQe,KAAK;KAC9BvB,QACG,6BAAAe,QAAA,cAACS,0BAAAA;IAAyBC,SAAQ;KAAMzB,KAAAA,IACxC,MACHD,WAEK,6BAAAgB,QAAA,cAACW,4BAAAA;IAAWD,SAAQ;IAAYE,eAAc;KAC3C5B,QAAAA,IAGL,IAAA,IAGR,MACHF,QAAAA,CAAAA;AAIT,GArDiD;AAuDjD,IAAM2B,+BAA2BI,wBAAOF,4BAAY;EAAEG,MAAM;AAA2B,CAAA,EAAG,OAAO;EAC/FC,UAAU;EACVC,WAAW;EACXC,cAAc;EACdC,YAAY;AACd,EAAA;AAEA,IAAMf,+BAA2BU,wBAAOM,uBAAO;EAC7CL,MAAM;EACNM,mBAAmBC,wBAAAA,SAAQ,CAAC;IAAC;IAAgBC,SAASD,IAAAA,GAAnCA;AACrB,CAAA,EAAkB,CAAC,EAAEE,OAAOpC,aAAY,OAAQ;EAC9CM,YAAY;EACZ+B,cAAc,OAAOD,MAAME,MAAMD,YAAY,MAAMD,MAAME,MAAMD,YAAY;EAC3EE,SAAS;EACTC,eAAe;EACfnB,KAAKe,MAAMK,QAAQ,CAAA;EACnBhC,QAAQ;EACRmB,UAAU;EACVC,WAAW;EACXa,SAASN,MAAMK,QAAQ,CAAA;EACvB,CAACL,MAAMO,YAAYC,GAAG,IAAA,CAAA,GAAQ;IAC5BlC,OAAOV,iBAAiB,SAAS,SAAS;EAC5C;EACA,CAACoC,MAAMO,YAAYC,GAAG,IAAA,CAAA,GAAQ;IAC5BlC,OAAOV,iBAAiB,SAAS,SAAS;EAC5C;AACF,EAAA;","names":["DrawerEx","children","heightVariant","subTitle","title","onClose","widthVariant","props","variantBasedProps","useMemo","PaperProps","sx","alignItems","background","boxShadow","height","width","onClick","event","React","Drawer","anchor","StyledDrawerContentPaper","elevation","stopPropagation","undefined","FlexCol","gap","StyledEllipsisTypography","variant","Typography","textTransform","styled","name","maxWidth","overflowX","textOverflow","whiteSpace","Paper","shouldForwardProp","prop","includes","theme","borderRadius","shape","display","flexDirection","spacing","padding","breakpoints","up"]}
@@ -1,2 +1,2 @@
1
- export * from './components/index.js';
1
+ export * from './components/index.ts';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export * from './components/index.js';
1
+ export * from './components/index.ts';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export * from './components/index.js';
1
+ export * from './components/index.ts';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,82 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/components/Drawer.tsx
5
+ import { Drawer, Paper, styled, Typography } from "@mui/material";
6
+ import { FlexCol } from "@xylabs/react-flexbox";
7
+ import React, { useMemo } from "react";
8
+ var DrawerEx = /* @__PURE__ */ __name(({ children, heightVariant = "full", subTitle, title, onClose, widthVariant = "partial", ...props }) => {
9
+ const variantBasedProps = useMemo(() => {
10
+ return {
11
+ PaperProps: {
12
+ sx: {
13
+ alignItems: "center",
14
+ background: "transparent",
15
+ boxShadow: "none",
16
+ height: heightVariant === "full" ? "100%" : "auto",
17
+ width: widthVariant === "partial" ? "auto" : "100%"
18
+ }
19
+ },
20
+ onClick: /* @__PURE__ */ __name((event) => onClose == null ? void 0 : onClose(event, "backdropClick"), "onClick")
21
+ };
22
+ }, [
23
+ heightVariant,
24
+ onClose,
25
+ widthVariant
26
+ ]);
27
+ return /* @__PURE__ */ React.createElement(Drawer, {
28
+ anchor: "top",
29
+ onClose,
30
+ ...variantBasedProps,
31
+ ...props
32
+ }, /* @__PURE__ */ React.createElement(StyledDrawerContentPaper, {
33
+ widthVariant,
34
+ elevation: 16,
35
+ onClick: /* @__PURE__ */ __name((event) => event.stopPropagation(), "onClick"),
36
+ sx: {
37
+ width: widthVariant === "full" ? "100%" : void 0
38
+ }
39
+ }, title || subTitle ? /* @__PURE__ */ React.createElement(FlexCol, {
40
+ alignItems: "start",
41
+ gap: 1
42
+ }, title ? /* @__PURE__ */ React.createElement(StyledEllipsisTypography, {
43
+ variant: "h3"
44
+ }, title) : null, subTitle ? /* @__PURE__ */ React.createElement(Typography, {
45
+ variant: "subtitle1",
46
+ textTransform: "none"
47
+ }, subTitle) : null) : null, children));
48
+ }, "DrawerEx");
49
+ var StyledEllipsisTypography = styled(Typography, {
50
+ name: "StyledEllipsisTypography"
51
+ })(() => ({
52
+ maxWidth: "100%",
53
+ overflowX: "hidden",
54
+ textOverflow: "ellipsis",
55
+ whiteSpace: "nowrap"
56
+ }));
57
+ var StyledDrawerContentPaper = styled(Paper, {
58
+ name: "StyledDrawerContentPaper",
59
+ shouldForwardProp: /* @__PURE__ */ __name((prop) => ![
60
+ "widthVariant"
61
+ ].includes(prop), "shouldForwardProp")
62
+ })(({ theme, widthVariant }) => ({
63
+ alignItems: "stretch",
64
+ borderRadius: `0 0 ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px`,
65
+ display: "flex",
66
+ flexDirection: "column",
67
+ gap: theme.spacing(2),
68
+ height: "100%",
69
+ maxWidth: "100%",
70
+ overflowX: "hidden",
71
+ padding: theme.spacing(3),
72
+ [theme.breakpoints.up("lg")]: {
73
+ width: widthVariant === "full" ? "100%" : "50%"
74
+ },
75
+ [theme.breakpoints.up("md")]: {
76
+ width: widthVariant === "full" ? "100%" : "75%"
77
+ }
78
+ }));
79
+ export {
80
+ DrawerEx
81
+ };
82
+ //# sourceMappingURL=index.mjs.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 React, { 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 ? (\n <FlexCol alignItems=\"start\" gap={1}>\n {title\n ? <StyledEllipsisTypography variant=\"h3\">{title}</StyledEllipsisTypography>\n : null}\n {subTitle\n ? (\n <Typography variant=\"subtitle1\" textTransform=\"none\">\n {subTitle}\n </Typography>\n )\n : null}\n </FlexCol>\n )\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,SAASA,QAAqBC,OAAOC,QAAQC,kBAAkB;AAC/D,SAASC,eAAe;AACxB,OAAOC,SAAwCC,eAAe;AASvD,IAAMC,WAAoC,wBAAC,EAChDC,UACAC,gBAAgB,QAChBC,UACAC,OACAC,SACAC,eAAe,WACf,GAAGC,MAAAA,MACJ;AACC,QAAMC,oBAAoBC,QAAQ,MAAA;AAChC,WAAO;MACLC,YAAY;QACVC,IAAI;UACFC,YAAY;UACZC,YAAY;UACZC,WAAW;UACXC,QAAQb,kBAAkB,SAAS,SAAS;UAC5Cc,OAAOV,iBAAiB,YAAY,SAAS;QAC/C;MACF;MACAW,SAAS,wBAACC,UAAsBb,mCAAUa,OAAO,kBAAxC;IACX;EACF,GAAG;IAAChB;IAAeG;IAASC;GAAa;AAEzC,SACE,sBAAA,cAACa,QAAAA;IAAOC,QAAO;IAAMf;IAAmB,GAAGG;IAAoB,GAAGD;KAEhE,sBAAA,cAACc,0BAAAA;IACCf;IACAgB,WAAW;IACXL,SAASC,wBAAAA,UAASA,MAAMK,gBAAe,GAA9BL;IACTP,IAAI;MAAEK,OAAOV,iBAAiB,SAAS,SAASkB;IAAU;KAEzDpB,SAASD,WAEJ,sBAAA,cAACsB,SAAAA;IAAQb,YAAW;IAAQc,KAAK;KAC9BtB,QACG,sBAAA,cAACuB,0BAAAA;IAAyBC,SAAQ;KAAMxB,KAAAA,IACxC,MACHD,WAEK,sBAAA,cAAC0B,YAAAA;IAAWD,SAAQ;IAAYE,eAAc;KAC3C3B,QAAAA,IAGL,IAAA,IAGR,MACHF,QAAAA,CAAAA;AAIT,GArDiD;AAuDjD,IAAM0B,2BAA2BI,OAAOF,YAAY;EAAEG,MAAM;AAA2B,CAAA,EAAG,OAAO;EAC/FC,UAAU;EACVC,WAAW;EACXC,cAAc;EACdC,YAAY;AACd,EAAA;AAEA,IAAMf,2BAA2BU,OAAOM,OAAO;EAC7CL,MAAM;EACNM,mBAAmBC,wBAAAA,SAAQ,CAAC;IAAC;IAAgBC,SAASD,IAAAA,GAAnCA;AACrB,CAAA,EAAkB,CAAC,EAAEE,OAAOnC,aAAY,OAAQ;EAC9CM,YAAY;EACZ8B,cAAc,OAAOD,MAAME,MAAMD,YAAY,MAAMD,MAAME,MAAMD,YAAY;EAC3EE,SAAS;EACTC,eAAe;EACfnB,KAAKe,MAAMK,QAAQ,CAAA;EACnB/B,QAAQ;EACRkB,UAAU;EACVC,WAAW;EACXa,SAASN,MAAMK,QAAQ,CAAA;EACvB,CAACL,MAAMO,YAAYC,GAAG,IAAA,CAAA,GAAQ;IAC5BjC,OAAOV,iBAAiB,SAAS,SAAS;EAC5C;EACA,CAACmC,MAAMO,YAAYC,GAAG,IAAA,CAAA,GAAQ;IAC5BjC,OAAOV,iBAAiB,SAAS,SAAS;EAC5C;AACF,EAAA;","names":["Drawer","Paper","styled","Typography","FlexCol","React","useMemo","DrawerEx","children","heightVariant","subTitle","title","onClose","widthVariant","props","variantBasedProps","useMemo","PaperProps","sx","alignItems","background","boxShadow","height","width","onClick","event","Drawer","anchor","StyledDrawerContentPaper","elevation","stopPropagation","undefined","FlexCol","gap","StyledEllipsisTypography","variant","Typography","textTransform","styled","name","maxWidth","overflowX","textOverflow","whiteSpace","Paper","shouldForwardProp","prop","includes","theme","borderRadius","shape","display","flexDirection","spacing","padding","breakpoints","up"]}
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
11
11
  },
12
12
  "dependencies": {
13
- "@xylabs/react-flexbox": "^3.4.1"
13
+ "@xylabs/react-flexbox": "^3.4.2"
14
14
  },
15
15
  "peerDependencies": {
16
16
  "@mui/material": "^5",
@@ -19,9 +19,9 @@
19
19
  "react-dom": "^18"
20
20
  },
21
21
  "devDependencies": {
22
- "@storybook/react": "^7.6.20",
23
- "@xylabs/ts-scripts-yarn3": "^3.12.4",
24
- "@xylabs/tsconfig-react": "^3.12.4",
22
+ "@storybook/react": "^8.2.7",
23
+ "@xylabs/ts-scripts-yarn3": "^3.15.16",
24
+ "@xylabs/tsconfig-react": "^3.15.16",
25
25
  "typescript": "^5.5.4"
26
26
  },
27
27
  "description": "Common React library for all XYO projects that use React",
@@ -31,7 +31,7 @@
31
31
  "node": {
32
32
  "import": {
33
33
  "types": "./dist/node/index.d.mts",
34
- "default": "./dist/node/index.js"
34
+ "default": "./dist/node/index.mjs"
35
35
  },
36
36
  "require": {
37
37
  "types": "./dist/node/index.d.cts",
@@ -41,19 +41,19 @@
41
41
  "browser": {
42
42
  "import": {
43
43
  "types": "./dist/browser/index.d.mts",
44
- "default": "./dist/browser/index.js"
44
+ "default": "./dist/browser/index.mjs"
45
45
  },
46
46
  "require": {
47
47
  "types": "./dist/browser/index.d.cts",
48
48
  "default": "./dist/browser/index.cjs"
49
49
  }
50
50
  },
51
- "default": "./dist/browser/index.js"
51
+ "default": "./dist/browser/index.mjs"
52
52
  },
53
53
  "./package.json": "./package.json"
54
54
  },
55
55
  "main": "dist/browser/index.cjs",
56
- "module": "dist/browser/index.js",
56
+ "module": "dist/browser/index.mjs",
57
57
  "homepage": "https://xyo.network",
58
58
  "keywords": [
59
59
  "xyo",
@@ -75,6 +75,6 @@
75
75
  },
76
76
  "sideEffects": false,
77
77
  "types": "dist/browser/index.d.ts",
78
- "version": "2.81.9",
78
+ "version": "2.82.0",
79
79
  "type": "module"
80
80
  }
@@ -1,8 +1,8 @@
1
1
  import { Meta, StoryFn } from '@storybook/react'
2
+ import React from 'react'
2
3
 
3
- import { DrawerEx, DrawerExProps } from './Drawer.js'
4
+ import { DrawerEx, DrawerExProps } from './Drawer.tsx'
4
5
 
5
- // eslint-disable-next-line import/no-default-export
6
6
  export default {
7
7
  title: 'modules/drawer/Ex',
8
8
  } as Meta
@@ -1,6 +1,6 @@
1
1
  import { Drawer, DrawerProps, Paper, styled, Typography } from '@mui/material'
2
2
  import { FlexCol } from '@xylabs/react-flexbox'
3
- import { MouseEvent, PropsWithChildren, useMemo } from 'react'
3
+ import React, { MouseEvent, PropsWithChildren, useMemo } from 'react'
4
4
 
5
5
  export interface DrawerExProps extends PropsWithChildren<DrawerProps> {
6
6
  heightVariant?: 'full' | 'auto'
@@ -34,26 +34,30 @@ export const DrawerEx: React.FC<DrawerExProps> = ({
34
34
  }, [heightVariant, onClose, widthVariant])
35
35
 
36
36
  return (
37
- <Drawer anchor={'top'} onClose={onClose} {...variantBasedProps} {...props}>
37
+ <Drawer anchor="top" onClose={onClose} {...variantBasedProps} {...props}>
38
38
  {/* Trap the event to prevent triggering the backdrop onClick */}
39
39
  <StyledDrawerContentPaper
40
40
  widthVariant={widthVariant}
41
41
  elevation={16}
42
- onClick={(event) => event.stopPropagation()}
42
+ onClick={event => event.stopPropagation()}
43
43
  sx={{ width: widthVariant === 'full' ? '100%' : undefined }}
44
44
  >
45
- {title || subTitle ?
46
- <FlexCol alignItems="start" gap={1}>
47
- {title ?
48
- <StyledEllipsisTypography variant={'h3'}>{title}</StyledEllipsisTypography>
49
- : null}
50
- {subTitle ?
51
- <Typography variant={'subtitle1'} textTransform="none">
52
- {subTitle}
53
- </Typography>
54
- : null}
55
- </FlexCol>
56
- : null}
45
+ {title || subTitle
46
+ ? (
47
+ <FlexCol alignItems="start" gap={1}>
48
+ {title
49
+ ? <StyledEllipsisTypography variant="h3">{title}</StyledEllipsisTypography>
50
+ : null}
51
+ {subTitle
52
+ ? (
53
+ <Typography variant="subtitle1" textTransform="none">
54
+ {subTitle}
55
+ </Typography>
56
+ )
57
+ : null}
58
+ </FlexCol>
59
+ )
60
+ : null}
57
61
  {children}
58
62
  </StyledDrawerContentPaper>
59
63
  </Drawer>
@@ -69,7 +73,7 @@ const StyledEllipsisTypography = styled(Typography, { name: 'StyledEllipsisTypog
69
73
 
70
74
  const StyledDrawerContentPaper = styled(Paper, {
71
75
  name: 'StyledDrawerContentPaper',
72
- shouldForwardProp: (prop) => !['widthVariant'].includes(prop as string),
76
+ shouldForwardProp: prop => !['widthVariant'].includes(prop as string),
73
77
  })<DrawerExProps>(({ theme, widthVariant }) => ({
74
78
  alignItems: 'stretch',
75
79
  borderRadius: `0 0 ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px`,
@@ -1 +1 @@
1
- export * from './Drawer.js'
1
+ export * from './Drawer.tsx'
package/src/index.ts CHANGED
@@ -1 +1 @@
1
- export * from './components/index.js'
1
+ export * from './components/index.ts'