@xyo-network/react-drawer 6.2.0 → 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/components/Drawer.stories.d.ts +4 -4
- package/dist/browser/components/Drawer.stories.d.ts.map +1 -1
- package/dist/browser/index.mjs +39 -45
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +20 -13
- package/src/components/Drawer.tsx +1 -1
- package/typedoc.json +0 -5
- package/xy.config.ts +0 -10
@@ -2,9 +2,9 @@ import type { Meta } from '@storybook/react-vite';
|
|
2
2
|
import type { DrawerExProps } from './Drawer.tsx';
|
3
3
|
declare const _default: Meta;
|
4
4
|
export default _default;
|
5
|
-
declare const Default: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, DrawerExProps>;
|
6
|
-
declare const WithOpen: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, DrawerExProps>;
|
7
|
-
declare const WithFullScreen: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, DrawerExProps>;
|
8
|
-
declare const WithTitles: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, DrawerExProps>;
|
5
|
+
declare const Default: import(".store/storybook-virtual-997ab3c959/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, DrawerExProps>;
|
6
|
+
declare const WithOpen: import(".store/storybook-virtual-997ab3c959/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, DrawerExProps>;
|
7
|
+
declare const WithFullScreen: import(".store/storybook-virtual-997ab3c959/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, DrawerExProps>;
|
8
|
+
declare const WithTitles: import(".store/storybook-virtual-997ab3c959/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, DrawerExProps>;
|
9
9
|
export { Default, WithFullScreen, WithOpen, WithTitles, };
|
10
10
|
//# sourceMappingURL=Drawer.stories.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Drawer.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,uBAAuB,CAAA;AAG1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;wBAGA,IAAI;AAArD,wBAAqD;AAUrD,QAAA,MAAM,OAAO,
|
1
|
+
{"version":3,"file":"Drawer.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,uBAAuB,CAAA;AAG1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;wBAGA,IAAI;AAArD,wBAAqD;AAUrD,QAAA,MAAM,OAAO,mJAAoB,CAAA;AAGjC,QAAA,MAAM,QAAQ,mJAAoB,CAAA;AAGlC,QAAA,MAAM,cAAc,mJAAoB,CAAA;AAOxC,QAAA,MAAM,UAAU,mJAAoB,CAAA;AAOpC,OAAO,EACL,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,GAC9C,CAAA"}
|
package/dist/browser/index.mjs
CHANGED
@@ -1,11 +1,22 @@
|
|
1
|
-
var __defProp = Object.defineProperty;
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
3
|
-
|
4
1
|
// src/components/Drawer.tsx
|
5
|
-
import {
|
2
|
+
import {
|
3
|
+
Drawer,
|
4
|
+
Paper,
|
5
|
+
styled,
|
6
|
+
Typography
|
7
|
+
} from "@mui/material";
|
6
8
|
import { FlexCol } from "@xylabs/react-flexbox";
|
7
|
-
import
|
8
|
-
|
9
|
+
import { useMemo } from "react";
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
11
|
+
var DrawerEx = ({
|
12
|
+
children,
|
13
|
+
heightVariant = "full",
|
14
|
+
subTitle,
|
15
|
+
title,
|
16
|
+
onClose,
|
17
|
+
widthVariant = "partial",
|
18
|
+
...props
|
19
|
+
}) => {
|
9
20
|
const variantBasedProps = useMemo(() => {
|
10
21
|
return {
|
11
22
|
PaperProps: {
|
@@ -17,38 +28,27 @@ var DrawerEx = /* @__PURE__ */ __name(({ children, heightVariant = "full", subTi
|
|
17
28
|
width: widthVariant === "partial" ? "auto" : "100%"
|
18
29
|
}
|
19
30
|
},
|
20
|
-
onClick:
|
31
|
+
onClick: (event) => onClose?.(event, "backdropClick")
|
21
32
|
};
|
22
|
-
}, [
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
width: widthVariant === "full" ? "100%" : void 0
|
33
|
+
}, [heightVariant, onClose, widthVariant]);
|
34
|
+
return /* @__PURE__ */ jsx(Drawer, { anchor: "top", onClose, ...variantBasedProps, ...props, children: /* @__PURE__ */ jsxs(
|
35
|
+
StyledDrawerContentPaper,
|
36
|
+
{
|
37
|
+
widthVariant,
|
38
|
+
elevation: 16,
|
39
|
+
onClick: (event) => event.stopPropagation(),
|
40
|
+
sx: { width: widthVariant === "full" ? "100%" : void 0 },
|
41
|
+
children: [
|
42
|
+
title || subTitle ? /* @__PURE__ */ jsxs(FlexCol, { alignItems: "start", gap: 1, children: [
|
43
|
+
title ? /* @__PURE__ */ jsx(StyledEllipsisTypography, { variant: "h3", children: title }) : null,
|
44
|
+
subTitle ? /* @__PURE__ */ jsx(Typography, { variant: "subtitle1", textTransform: "none", children: subTitle }) : null
|
45
|
+
] }) : null,
|
46
|
+
children
|
47
|
+
]
|
38
48
|
}
|
39
|
-
}
|
40
|
-
|
41
|
-
|
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
|
-
})(() => ({
|
49
|
+
) });
|
50
|
+
};
|
51
|
+
var StyledEllipsisTypography = styled(Typography, { name: "StyledEllipsisTypography" })(() => ({
|
52
52
|
maxWidth: "100%",
|
53
53
|
overflowX: "hidden",
|
54
54
|
textOverflow: "ellipsis",
|
@@ -56,9 +56,7 @@ var StyledEllipsisTypography = styled(Typography, {
|
|
56
56
|
}));
|
57
57
|
var StyledDrawerContentPaper = styled(Paper, {
|
58
58
|
name: "StyledDrawerContentPaper",
|
59
|
-
shouldForwardProp:
|
60
|
-
"widthVariant"
|
61
|
-
].includes(prop), "shouldForwardProp")
|
59
|
+
shouldForwardProp: (prop) => !["widthVariant"].includes(prop)
|
62
60
|
})(({ theme, widthVariant }) => ({
|
63
61
|
alignItems: "stretch",
|
64
62
|
borderRadius: `0 0 ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px`,
|
@@ -69,12 +67,8 @@ var StyledDrawerContentPaper = styled(Paper, {
|
|
69
67
|
maxWidth: "100%",
|
70
68
|
overflowX: "hidden",
|
71
69
|
padding: theme.spacing(3),
|
72
|
-
[theme.breakpoints.up("lg")]: {
|
73
|
-
|
74
|
-
},
|
75
|
-
[theme.breakpoints.up("md")]: {
|
76
|
-
width: widthVariant === "full" ? "100%" : "75%"
|
77
|
-
}
|
70
|
+
[theme.breakpoints.up("lg")]: { width: widthVariant === "full" ? "100%" : "50%" },
|
71
|
+
[theme.breakpoints.up("md")]: { width: widthVariant === "full" ? "100%" : "75%" }
|
78
72
|
}));
|
79
73
|
export {
|
80
74
|
DrawerEx
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/components/Drawer.tsx"],"sourcesContent":["import type { DrawerProps } from '@mui/material'\nimport {\n Drawer, Paper, styled, Typography,\n} from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport type { MouseEvent, PropsWithChildren } from 'react'\nimport React, { 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')]: { width: widthVariant === 'full' ? '100%' : '50%' },\n [theme.breakpoints.up('md')]: { width: widthVariant === 'full' ? '100%' : '75%' },\n}))\n"],"mappings":"
|
1
|
+
{"version":3,"sources":["../../src/components/Drawer.tsx"],"sourcesContent":["import type { DrawerProps } from '@mui/material'\nimport {\n Drawer, Paper, styled, Typography,\n} from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport type { MouseEvent, PropsWithChildren } from 'react'\nimport React, { 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: MouseEvent) => 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')]: { width: widthVariant === 'full' ? '100%' : '50%' },\n [theme.breakpoints.up('md')]: { width: widthVariant === 'full' ? '100%' : '75%' },\n}))\n"],"mappings":";AACA;AAAA,EACE;AAAA,EAAQ;AAAA,EAAO;AAAA,EAAQ;AAAA,OAClB;AACP,SAAS,eAAe;AAExB,SAAgB,eAAe;AA4CjB,SAEM,KAFN;AAnCP,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;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AS,MAAM;AAAA,EAChF,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,OAAO,iBAAiB,SAAS,SAAS,MAAM;AAClF,EAAE;","names":[]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@xyo-network/react-drawer",
|
3
|
-
"version": "
|
3
|
+
"version": "7.0.1",
|
4
4
|
"description": "Common React library for all XYO projects that use React",
|
5
5
|
"keywords": [
|
6
6
|
"xyo",
|
@@ -38,24 +38,31 @@
|
|
38
38
|
},
|
39
39
|
"module": "dist/browser/index.mjs",
|
40
40
|
"types": "dist/browser/index.d.ts",
|
41
|
+
"files": [
|
42
|
+
"dist",
|
43
|
+
"src"
|
44
|
+
],
|
41
45
|
"dependencies": {
|
42
|
-
"@xylabs/react-flexbox": "
|
46
|
+
"@xylabs/react-flexbox": "~7.0.1"
|
43
47
|
},
|
44
48
|
"devDependencies": {
|
45
|
-
"@mui/material": "
|
46
|
-
"@storybook/react-vite": "
|
47
|
-
"@types/react": "
|
48
|
-
"@xylabs/ts-scripts-yarn3": "
|
49
|
-
"@xylabs/tsconfig
|
50
|
-
"
|
51
|
-
"react
|
52
|
-
"
|
53
|
-
"
|
49
|
+
"@mui/material": "~7.3.1",
|
50
|
+
"@storybook/react-vite": "~9.1.2",
|
51
|
+
"@types/react": "~19.1.10",
|
52
|
+
"@xylabs/ts-scripts-yarn3": "~7.1.1",
|
53
|
+
"@xylabs/tsconfig": "~7.1.1",
|
54
|
+
"@xylabs/tsconfig-dom": "~7.1.1",
|
55
|
+
"@xylabs/tsconfig-react": "~7.1.1",
|
56
|
+
"react": "~19.1.1",
|
57
|
+
"react-dom": "~19.1.1",
|
58
|
+
"storybook": "~9.1.2",
|
59
|
+
"typescript": "~5.9.2",
|
60
|
+
"vite": "~7.1.2"
|
54
61
|
},
|
55
62
|
"peerDependencies": {
|
56
63
|
"@mui/material": ">=6 <8",
|
57
|
-
"react": "
|
58
|
-
"react-dom": "
|
64
|
+
"react": "~19",
|
65
|
+
"react-dom": "~19"
|
59
66
|
},
|
60
67
|
"publishConfig": {
|
61
68
|
"access": "public"
|
@@ -43,7 +43,7 @@ export const DrawerEx: React.FC<DrawerExProps> = ({
|
|
43
43
|
<StyledDrawerContentPaper
|
44
44
|
widthVariant={widthVariant}
|
45
45
|
elevation={16}
|
46
|
-
onClick={event => event.stopPropagation()}
|
46
|
+
onClick={(event: MouseEvent) => event.stopPropagation()}
|
47
47
|
sx={{ width: widthVariant === 'full' ? '100%' : undefined }}
|
48
48
|
>
|
49
49
|
{title || subTitle
|
package/typedoc.json
DELETED