@telegraph/modal 0.0.10 → 0.0.12
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/CHANGELOG.md +15 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +7 -7
- package/dist/esm/index.mjs.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @telegraph/modal
|
|
2
2
|
|
|
3
|
+
## 0.0.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#136](https://github.com/knocklabs/telegraph/pull/136) [`89ad0f4`](https://github.com/knocklabs/telegraph/commit/89ad0f4b72a3d5e4f60dfda2a7352da1117e69cc) Thanks [@kylemcd](https://github.com/kylemcd)! - fix modal not being able to scroll
|
|
8
|
+
|
|
9
|
+
## 0.0.11
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`8d4c7bb`](https://github.com/knocklabs/telegraph/commit/8d4c7bb5031747c185faa31c0bc0aef7bd14d01c)]:
|
|
14
|
+
- @telegraph/layout@0.0.13
|
|
15
|
+
- @telegraph/button@0.0.22
|
|
16
|
+
- @telegraph/icon@0.0.13
|
|
17
|
+
|
|
3
18
|
## 0.0.10
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),y=require("@radix-ui/react-dialog"),b=require("@radix-ui/react-visually-hidden"),j=require("@telegraph/button"),m=require("@telegraph/icon"),c=require("@telegraph/layout"),f=require("clsx"),s=require("framer-motion"),g=require("react");function u(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),y=require("@radix-ui/react-dialog"),b=require("@radix-ui/react-visually-hidden"),j=require("@telegraph/button"),m=require("@telegraph/icon"),c=require("@telegraph/layout"),f=require("clsx"),s=require("framer-motion"),g=require("react");function u(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(r,o,n.get?n:{enumerable:!0,get:()=>e[o]})}}return r.default=e,Object.freeze(r)}const i=u(y),h=u(b),k=({defaultOpen:e,open:r,onOpenChange:o,a11yTitle:n,a11yDescription:l,className:x,children:p,...a})=>t.jsxs(i.Root,{open:r,onOpenChange:o,defaultOpen:e,children:[t.jsxs(h.Root,{children:[t.jsx(i.Title,{children:n}),l&&t.jsx(i.Description,{children:l})]}),t.jsx(s.AnimatePresence,{children:r&&t.jsx(t.Fragment,{children:t.jsxs(i.Overlay,{children:[t.jsx(c.Box,{as:s.motion.div,onClick:()=>o==null?void 0:o(!1),initial:{backdropFilter:"blur(0px)",opacity:0},animate:{backdropFilter:"blur(4px)",opacity:1},exit:{backdropFilter:"blur(0px)",opacity:0},transition:{duration:.3,bounce:0,type:"spring"},className:"fixed inset-0 bg-alpha-black-4 z-overlay"}),t.jsx(c.Stack,{className:f("fixed z-modal top-0 left-1/2 -translate-x-1/2","max-h-[calc(100vh-var(--tgph-spacing-32))] shadow-1",x),direction:"column",as:s.motion.div,my:"16",initial:{scale:.8,opacity:0,y:-20,x:"-50%"},animate:{scale:1,opacity:1,y:0,x:"-50%"},exit:{scale:.8,opacity:0,y:-20,x:"-50%"},transition:{duration:.2,bounce:0,type:"spring"},maxW:a.maxW??"140",w:a.w??"full",bg:"surface-1",border:!0,rounded:"4",...a,children:p})]})})})]}),q=g.forwardRef(({children:e,...r},o)=>t.jsx(i.Content,{ref:o,...r,asChild:!0,children:t.jsx(c.Stack,{direction:"column",children:e})})),S=({size:e="1",variant:r="ghost",...o})=>t.jsx(i.Close,{asChild:!0,children:t.jsx(j.Button,{icon:{icon:m.Lucide.X,alt:"Close Modal"},variant:r,size:e,...o})}),v=({children:e,...r})=>t.jsx(c.Stack,{direction:"column",px:"6",py:"4",...r,children:e}),w=({children:e,...r})=>t.jsx(c.Stack,{direction:"row",justify:"space-between",align:"center",px:"6",py:"4",borderBottom:!0,...r,children:e}),M=({children:e,...r})=>t.jsx(c.Stack,{direction:"row",align:"center",justify:"end",gap:"2",px:"6",py:"4",borderTop:!0,...r,children:e}),d={};Object.assign(d,{Root:k,Content:q,Close:S,Body:v,Header:w,Footer:M});exports.Modal=d;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/Modal/Modal.tsx"],"sourcesContent":["import * as Dialog from \"@radix-ui/react-dialog\";\nimport * as VisuallyHidden from \"@radix-ui/react-visually-hidden\";\nimport { Button } from \"@telegraph/button\";\nimport type {\n PolymorphicProps,\n TgphComponentProps,\n TgphElement,\n} from \"@telegraph/helpers\";\nimport { Lucide } from \"@telegraph/icon\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport clsx from \"clsx\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport React from \"react\";\n\ntype RootProps = Omit<\n React.ComponentPropsWithoutRef<typeof Dialog.Root>,\n \"modal\"\n> &\n TgphComponentProps<typeof Stack> & {\n a11yTitle: string;\n a11yDescription?: string;\n };\n\nconst Root = ({\n defaultOpen,\n open,\n onOpenChange,\n a11yTitle,\n a11yDescription,\n className,\n children,\n ...props\n}: RootProps) => {\n return (\n <Dialog.Root\n open={open}\n onOpenChange={onOpenChange}\n defaultOpen={defaultOpen}\n >\n <VisuallyHidden.Root>\n <Dialog.Title>{a11yTitle}</Dialog.Title>\n {a11yDescription && (\n <Dialog.Description>{a11yDescription}</Dialog.Description>\n )}\n </VisuallyHidden.Root>\n <AnimatePresence>\n {open && (\n <>\n <Dialog.Overlay
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/Modal/Modal.tsx"],"sourcesContent":["import * as Dialog from \"@radix-ui/react-dialog\";\nimport * as VisuallyHidden from \"@radix-ui/react-visually-hidden\";\nimport { Button } from \"@telegraph/button\";\nimport type {\n PolymorphicProps,\n TgphComponentProps,\n TgphElement,\n} from \"@telegraph/helpers\";\nimport { Lucide } from \"@telegraph/icon\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport clsx from \"clsx\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport React from \"react\";\n\ntype RootProps = Omit<\n React.ComponentPropsWithoutRef<typeof Dialog.Root>,\n \"modal\"\n> &\n TgphComponentProps<typeof Stack> & {\n a11yTitle: string;\n a11yDescription?: string;\n };\n\nconst Root = ({\n defaultOpen,\n open,\n onOpenChange,\n a11yTitle,\n a11yDescription,\n className,\n children,\n ...props\n}: RootProps) => {\n return (\n <Dialog.Root\n open={open}\n onOpenChange={onOpenChange}\n defaultOpen={defaultOpen}\n >\n <VisuallyHidden.Root>\n <Dialog.Title>{a11yTitle}</Dialog.Title>\n {a11yDescription && (\n <Dialog.Description>{a11yDescription}</Dialog.Description>\n )}\n </VisuallyHidden.Root>\n <AnimatePresence>\n {open && (\n <>\n <Dialog.Overlay>\n <Box\n as={motion.div}\n onClick={() => onOpenChange?.(false)}\n initial={{ backdropFilter: \"blur(0px)\", opacity: 0 }}\n animate={{ backdropFilter: \"blur(4px)\", opacity: 1 }}\n exit={{ backdropFilter: \"blur(0px)\", opacity: 0 }}\n transition={{ duration: 0.3, bounce: 0, type: \"spring\" }}\n className=\"fixed inset-0 bg-alpha-black-4 z-overlay\"\n />\n <Stack\n className={clsx(\n \"fixed z-modal top-0 left-1/2 -translate-x-1/2\",\n \"max-h-[calc(100vh-var(--tgph-spacing-32))] shadow-1\",\n className,\n )}\n direction=\"column\"\n as={motion.div}\n my=\"16\"\n initial={{ scale: 0.8, opacity: 0, y: -20, x: \"-50%\" }}\n animate={{ scale: 1, opacity: 1, y: 0, x: \"-50%\" }}\n exit={{ scale: 0.8, opacity: 0, y: -20, x: \"-50%\" }}\n transition={{ duration: 0.2, bounce: 0, type: \"spring\" }}\n maxW={props.maxW ?? \"140\"}\n w={props.w ?? \"full\"}\n bg=\"surface-1\"\n border\n rounded=\"4\"\n {...props}\n >\n {children}\n </Stack>\n </Dialog.Overlay>\n </>\n )}\n </AnimatePresence>\n </Dialog.Root>\n );\n};\n\ntype ContentProps = React.ComponentPropsWithoutRef<typeof Dialog.Content>;\ntype ContentRef = React.ElementRef<typeof Dialog.Content>;\n\nconst Content = React.forwardRef<ContentRef, ContentProps>(\n ({ children, ...props }, forwardedRef) => {\n return (\n <Dialog.Content ref={forwardedRef} {...props} asChild>\n <Stack direction=\"column\">{children}</Stack>\n </Dialog.Content>\n );\n },\n);\n\ntype CloseProps<T extends TgphElement> = TgphComponentProps<typeof Button<T>> &\n Omit<React.ComponentPropsWithoutRef<typeof Dialog.Close>, \"color\">;\nconst Close = <T extends TgphElement>({\n size = \"1\",\n variant = \"ghost\",\n ...props\n}: CloseProps<T>) => {\n return (\n <Dialog.Close asChild>\n <Button\n icon={{ icon: Lucide.X, alt: \"Close Modal\" }}\n variant={variant}\n size={size}\n {...props}\n />\n </Dialog.Close>\n );\n};\n\ntype BodyProps<T extends TgphElement> = PolymorphicProps<T> &\n TgphComponentProps<typeof Stack<T>>;\n\nconst Body = <T extends TgphElement>({ children, ...props }: BodyProps<T>) => {\n return (\n <Stack direction=\"column\" px=\"6\" py=\"4\" {...props}>\n {children}\n </Stack>\n );\n};\n\ntype HeaderProps<T extends TgphElement> = PolymorphicProps<T> &\n TgphComponentProps<typeof Stack<T>>;\n\nconst Header = <T extends TgphElement>({\n children,\n ...props\n}: HeaderProps<T>) => {\n return (\n <Stack\n direction=\"row\"\n justify=\"space-between\"\n align=\"center\"\n px=\"6\"\n py=\"4\"\n borderBottom\n {...props}\n >\n {children}\n </Stack>\n );\n};\n\ntype FooterProps<T extends TgphElement> = PolymorphicProps<T> &\n TgphComponentProps<typeof Stack<T>>;\n\nconst Footer = <T extends TgphElement>({\n children,\n ...props\n}: FooterProps<T>) => {\n return (\n <Stack\n direction=\"row\"\n align=\"center\"\n justify=\"end\"\n gap=\"2\"\n px=\"6\"\n py=\"4\"\n borderTop\n {...props}\n >\n {children}\n </Stack>\n );\n};\n\nconst Modal = {} as {\n Root: typeof Root;\n Content: typeof Content;\n Close: typeof Close;\n Body: typeof Body;\n Header: typeof Header;\n Footer: typeof Footer;\n};\n\nObject.assign(Modal, {\n Root,\n Content,\n Close,\n Body,\n Header,\n Footer,\n});\n\nexport { Modal };\n"],"names":["Root","defaultOpen","open","onOpenChange","a11yTitle","a11yDescription","className","children","props","jsxs","Dialog","VisuallyHidden","jsx","AnimatePresence","Box","motion","Stack","clsx","Content","React","forwardedRef","Close","size","variant","Button","Lucide","Body","Header","Footer","Modal"],"mappings":"koBAuBMA,EAAO,CAAC,CACZ,YAAAC,EACA,KAAAC,EACA,aAAAC,EACA,UAAAC,EACA,gBAAAC,EACA,UAAAC,EACA,SAAAC,EACA,GAAGC,CACL,IAEIC,EAAA,KAACC,EAAO,KAAP,CACC,KAAAR,EACA,aAAAC,EACA,YAAAF,EAEA,SAAA,CAACQ,EAAAA,KAAAE,EAAe,KAAf,CACC,SAAA,CAACC,EAAAA,IAAAF,EAAO,MAAP,CAAc,SAAUN,CAAA,CAAA,EACxBC,GACCO,EAAA,IAACF,EAAO,YAAP,CAAoB,SAAgBL,EAAA,CAAA,EAEzC,QACCQ,EAAAA,gBACE,CAAA,SAAAX,qBAEG,SAACO,EAAAA,KAAAC,EAAO,QAAP,CACC,SAAA,CAAAE,EAAA,IAACE,EAAA,IAAA,CACC,GAAIC,EAAO,OAAA,IACX,QAAS,IAAMZ,GAAA,YAAAA,EAAe,IAC9B,QAAS,CAAE,eAAgB,YAAa,QAAS,CAAE,EACnD,QAAS,CAAE,eAAgB,YAAa,QAAS,CAAE,E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AA,IAACI,EAAM,MAAA,CAAA,UAAU,SAAS,GAAG,IAAI,GAAG,IAAK,GAAGR,EACzC,SAAAD,CACH,CAAA,EAOEoB,EAAS,CAAwB,CACrC,SAAApB,EACA,GAAGC,CACL,IAEII,EAAA,IAACI,EAAA,MAAA,CACC,UAAU,MACV,QAAQ,gBACR,MAAM,SACN,GAAG,IACH,GAAG,IACH,aAAY,GACX,GAAGR,EAEH,SAAAD,CAAA,CAAA,EAQDqB,EAAS,CAAwB,CACrC,SAAArB,EACA,GAAGC,CACL,IAEII,EAAA,IAACI,EAAA,MAAA,CACC,UAAU,MACV,MAAM,SACN,QAAQ,MACR,IAAI,IACJ,GAAG,IACH,GAAG,IACH,UAAS,GACR,GAAGR,EAEH,SAAAD,CAAA,CAAA,EAKDsB,EAAQ,CAAC,EASf,OAAO,OAAOA,EAAO,CACnB,KAAA7B,EACA,QAAAkB,EACA,MAAAG,EACA,KAAAK,EACA,OAAAC,EACA,OAAAC,CACF,CAAC"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as t, jsxs as l, Fragment as
|
|
1
|
+
import { jsx as t, jsxs as l, Fragment as u } from "react/jsx-runtime";
|
|
2
2
|
import * as e from "@radix-ui/react-dialog";
|
|
3
3
|
import * as x from "@radix-ui/react-visually-hidden";
|
|
4
4
|
import { Button as f } from "@telegraph/button";
|
|
@@ -14,7 +14,7 @@ const k = ({
|
|
|
14
14
|
a11yTitle: d,
|
|
15
15
|
a11yDescription: n,
|
|
16
16
|
className: m,
|
|
17
|
-
children:
|
|
17
|
+
children: p,
|
|
18
18
|
...c
|
|
19
19
|
}) => /* @__PURE__ */ l(
|
|
20
20
|
e.Root,
|
|
@@ -27,8 +27,8 @@ const k = ({
|
|
|
27
27
|
/* @__PURE__ */ t(e.Title, { children: d }),
|
|
28
28
|
n && /* @__PURE__ */ t(e.Description, { children: n })
|
|
29
29
|
] }),
|
|
30
|
-
/* @__PURE__ */ t(g, { children: r && /* @__PURE__ */ l(
|
|
31
|
-
/* @__PURE__ */ t(
|
|
30
|
+
/* @__PURE__ */ t(g, { children: r && /* @__PURE__ */ t(u, { children: /* @__PURE__ */ l(e.Overlay, { children: [
|
|
31
|
+
/* @__PURE__ */ t(
|
|
32
32
|
b,
|
|
33
33
|
{
|
|
34
34
|
as: s.div,
|
|
@@ -39,7 +39,7 @@ const k = ({
|
|
|
39
39
|
transition: { duration: 0.3, bounce: 0, type: "spring" },
|
|
40
40
|
className: "fixed inset-0 bg-alpha-black-4 z-overlay"
|
|
41
41
|
}
|
|
42
|
-
)
|
|
42
|
+
),
|
|
43
43
|
/* @__PURE__ */ t(
|
|
44
44
|
a,
|
|
45
45
|
{
|
|
@@ -61,10 +61,10 @@ const k = ({
|
|
|
61
61
|
border: !0,
|
|
62
62
|
rounded: "4",
|
|
63
63
|
...c,
|
|
64
|
-
children:
|
|
64
|
+
children: p
|
|
65
65
|
}
|
|
66
66
|
)
|
|
67
|
-
] }) })
|
|
67
|
+
] }) }) })
|
|
68
68
|
]
|
|
69
69
|
}
|
|
70
70
|
), v = w.forwardRef(
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/Modal/Modal.tsx"],"sourcesContent":["import * as Dialog from \"@radix-ui/react-dialog\";\nimport * as VisuallyHidden from \"@radix-ui/react-visually-hidden\";\nimport { Button } from \"@telegraph/button\";\nimport type {\n PolymorphicProps,\n TgphComponentProps,\n TgphElement,\n} from \"@telegraph/helpers\";\nimport { Lucide } from \"@telegraph/icon\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport clsx from \"clsx\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport React from \"react\";\n\ntype RootProps = Omit<\n React.ComponentPropsWithoutRef<typeof Dialog.Root>,\n \"modal\"\n> &\n TgphComponentProps<typeof Stack> & {\n a11yTitle: string;\n a11yDescription?: string;\n };\n\nconst Root = ({\n defaultOpen,\n open,\n onOpenChange,\n a11yTitle,\n a11yDescription,\n className,\n children,\n ...props\n}: RootProps) => {\n return (\n <Dialog.Root\n open={open}\n onOpenChange={onOpenChange}\n defaultOpen={defaultOpen}\n >\n <VisuallyHidden.Root>\n <Dialog.Title>{a11yTitle}</Dialog.Title>\n {a11yDescription && (\n <Dialog.Description>{a11yDescription}</Dialog.Description>\n )}\n </VisuallyHidden.Root>\n <AnimatePresence>\n {open && (\n <>\n <Dialog.Overlay
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/Modal/Modal.tsx"],"sourcesContent":["import * as Dialog from \"@radix-ui/react-dialog\";\nimport * as VisuallyHidden from \"@radix-ui/react-visually-hidden\";\nimport { Button } from \"@telegraph/button\";\nimport type {\n PolymorphicProps,\n TgphComponentProps,\n TgphElement,\n} from \"@telegraph/helpers\";\nimport { Lucide } from \"@telegraph/icon\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport clsx from \"clsx\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport React from \"react\";\n\ntype RootProps = Omit<\n React.ComponentPropsWithoutRef<typeof Dialog.Root>,\n \"modal\"\n> &\n TgphComponentProps<typeof Stack> & {\n a11yTitle: string;\n a11yDescription?: string;\n };\n\nconst Root = ({\n defaultOpen,\n open,\n onOpenChange,\n a11yTitle,\n a11yDescription,\n className,\n children,\n ...props\n}: RootProps) => {\n return (\n <Dialog.Root\n open={open}\n onOpenChange={onOpenChange}\n defaultOpen={defaultOpen}\n >\n <VisuallyHidden.Root>\n <Dialog.Title>{a11yTitle}</Dialog.Title>\n {a11yDescription && (\n <Dialog.Description>{a11yDescription}</Dialog.Description>\n )}\n </VisuallyHidden.Root>\n <AnimatePresence>\n {open && (\n <>\n <Dialog.Overlay>\n <Box\n as={motion.div}\n onClick={() => onOpenChange?.(false)}\n initial={{ backdropFilter: \"blur(0px)\", opacity: 0 }}\n animate={{ backdropFilter: \"blur(4px)\", opacity: 1 }}\n exit={{ backdropFilter: \"blur(0px)\", opacity: 0 }}\n transition={{ duration: 0.3, bounce: 0, type: \"spring\" }}\n className=\"fixed inset-0 bg-alpha-black-4 z-overlay\"\n />\n <Stack\n className={clsx(\n \"fixed z-modal top-0 left-1/2 -translate-x-1/2\",\n \"max-h-[calc(100vh-var(--tgph-spacing-32))] shadow-1\",\n className,\n )}\n direction=\"column\"\n as={motion.div}\n my=\"16\"\n initial={{ scale: 0.8, opacity: 0, y: -20, x: \"-50%\" }}\n animate={{ scale: 1, opacity: 1, y: 0, x: \"-50%\" }}\n exit={{ scale: 0.8, opacity: 0, y: -20, x: \"-50%\" }}\n transition={{ duration: 0.2, bounce: 0, type: \"spring\" }}\n maxW={props.maxW ?? \"140\"}\n w={props.w ?? \"full\"}\n bg=\"surface-1\"\n border\n rounded=\"4\"\n {...props}\n >\n {children}\n </Stack>\n </Dialog.Overlay>\n </>\n )}\n </AnimatePresence>\n </Dialog.Root>\n );\n};\n\ntype ContentProps = React.ComponentPropsWithoutRef<typeof Dialog.Content>;\ntype ContentRef = React.ElementRef<typeof Dialog.Content>;\n\nconst Content = React.forwardRef<ContentRef, ContentProps>(\n ({ children, ...props }, forwardedRef) => {\n return (\n <Dialog.Content ref={forwardedRef} {...props} asChild>\n <Stack direction=\"column\">{children}</Stack>\n </Dialog.Content>\n );\n },\n);\n\ntype CloseProps<T extends TgphElement> = TgphComponentProps<typeof Button<T>> &\n Omit<React.ComponentPropsWithoutRef<typeof Dialog.Close>, \"color\">;\nconst Close = <T extends TgphElement>({\n size = \"1\",\n variant = \"ghost\",\n ...props\n}: CloseProps<T>) => {\n return (\n <Dialog.Close asChild>\n <Button\n icon={{ icon: Lucide.X, alt: \"Close Modal\" }}\n variant={variant}\n size={size}\n {...props}\n />\n </Dialog.Close>\n );\n};\n\ntype BodyProps<T extends TgphElement> = PolymorphicProps<T> &\n TgphComponentProps<typeof Stack<T>>;\n\nconst Body = <T extends TgphElement>({ children, ...props }: BodyProps<T>) => {\n return (\n <Stack direction=\"column\" px=\"6\" py=\"4\" {...props}>\n {children}\n </Stack>\n );\n};\n\ntype HeaderProps<T extends TgphElement> = PolymorphicProps<T> &\n TgphComponentProps<typeof Stack<T>>;\n\nconst Header = <T extends TgphElement>({\n children,\n ...props\n}: HeaderProps<T>) => {\n return (\n <Stack\n direction=\"row\"\n justify=\"space-between\"\n align=\"center\"\n px=\"6\"\n py=\"4\"\n borderBottom\n {...props}\n >\n {children}\n </Stack>\n );\n};\n\ntype FooterProps<T extends TgphElement> = PolymorphicProps<T> &\n TgphComponentProps<typeof Stack<T>>;\n\nconst Footer = <T extends TgphElement>({\n children,\n ...props\n}: FooterProps<T>) => {\n return (\n <Stack\n direction=\"row\"\n align=\"center\"\n justify=\"end\"\n gap=\"2\"\n px=\"6\"\n py=\"4\"\n borderTop\n {...props}\n >\n {children}\n </Stack>\n );\n};\n\nconst Modal = {} as {\n Root: typeof Root;\n Content: typeof Content;\n Close: typeof Close;\n Body: typeof Body;\n Header: typeof Header;\n Footer: typeof Footer;\n};\n\nObject.assign(Modal, {\n Root,\n Content,\n Close,\n Body,\n Header,\n Footer,\n});\n\nexport { Modal };\n"],"names":["Root","defaultOpen","open","onOpenChange","a11yTitle","a11yDescription","className","children","props","jsxs","Dialog","VisuallyHidden","jsx","AnimatePresence","Box","motion","Stack","clsx","Content","React","forwardedRef","Close","size","variant","Button","Lucide","Body","Header","Footer","Modal"],"mappings":";;;;;;;;;AAuBA,MAAMA,IAAO,CAAC;AAAA,EACZ,aAAAC;AAAA,EACA,MAAAC;AAAA,EACA,cAAAC;AAAA,EACA,WAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,MAEI,gBAAAC;AAAA,EAACC,EAAO;AAAA,EAAP;AAAA,IACC,MAAAR;AAAA,IACA,cAAAC;AAAA,IACA,aAAAF;AAAA,IAEA,UAAA;AAAA,MAAC,gBAAAQ,EAAAE,EAAe,MAAf,EACC,UAAA;AAAA,QAAC,gBAAAC,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AAAA,IACR,GAAGR;AAAA,IAEH,UAAAD;AAAA,EAAA;AAAA,GAKDsB,IAAQ,CAAC;AASf,OAAO,OAAOA,GAAO;AAAA,EACnB,MAAA7B;AAAA,EACA,SAAAkB;AAAA,EACA,OAAAG;AAAA,EACA,MAAAK;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AACF,CAAC;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telegraph/modal",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"repository": "https://github.com/knocklabs/telegraph/tree/main/packages/modal",
|
|
5
5
|
"author": "@knocklabs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@radix-ui/react-dialog": "^1.0.5",
|
|
38
38
|
"@radix-ui/react-visually-hidden": "^1.0.3",
|
|
39
|
-
"@telegraph/button": "^0.0.
|
|
40
|
-
"@telegraph/icon": "^0.0.
|
|
41
|
-
"@telegraph/layout": "^0.0.
|
|
39
|
+
"@telegraph/button": "^0.0.22",
|
|
40
|
+
"@telegraph/icon": "^0.0.13",
|
|
41
|
+
"@telegraph/layout": "^0.0.13",
|
|
42
42
|
"clsx": "^2.1.0",
|
|
43
43
|
"framer-motion": "^11.1.9"
|
|
44
44
|
},
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"react": "^18.2.0",
|
|
56
56
|
"react-dom": "^18.2.0",
|
|
57
57
|
"typescript": "^5.3.3",
|
|
58
|
-
"vite": "^5.
|
|
58
|
+
"vite": "^5.3.0",
|
|
59
59
|
"vitest": "^1.2.2"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|