@telegraph/modal 0.0.2 → 0.0.3
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 +11 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/css/default.css +1 -1
- package/dist/esm/index.mjs +117 -57
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/Modal/Modal.d.ts +58 -6
- package/dist/types/Modal/Modal.d.ts.map +1 -1
- package/dist/types/Modal/Modal.stories.d.ts +7 -0
- package/dist/types/Modal/Modal.stories.d.ts.map +1 -0
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @telegraph/modal
|
|
2
2
|
|
|
3
|
+
## 0.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#98](https://github.com/knocklabs/telegraph/pull/98) [`1e06a4e`](https://github.com/knocklabs/telegraph/commit/1e06a4e505ec5a2d6bdebf3d6355fa9c7f8d12fa) Thanks [@kylemcd](https://github.com/kylemcd)! - updates to modal component for production use
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`1e06a4e`](https://github.com/knocklabs/telegraph/commit/1e06a4e505ec5a2d6bdebf3d6355fa9c7f8d12fa)]:
|
|
10
|
+
- @telegraph/layout@0.0.9
|
|
11
|
+
- @telegraph/icon@0.0.9
|
|
12
|
+
- @telegraph/button@0.0.16
|
|
13
|
+
|
|
3
14
|
## 0.0.2
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),b=require("@radix-ui/react-dialog"),j=require("@radix-ui/react-visually-hidden"),m=require("@telegraph/button"),g=require("@telegraph/icon"),a=require("@telegraph/layout"),h=require("clsx"),l=require("framer-motion"),c=require("react");function d(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(o,e,n.get?n:{enumerable:!0,get:()=>t[e]})}}return o.default=t,Object.freeze(o)}const i=d(b),w=d(j),k=c.forwardRef(({defaultOpen:t,open:o,onOpenChange:e,a11yTitle:n,a11yDescription:u,className:x,children:p,...s},y)=>r.jsxs(i.Root,{open:o,onOpenChange:e,defaultOpen:t,children:[r.jsxs(w.Root,{children:[r.jsx(i.Title,{children:n}),u&&r.jsx(i.Description,{children:u})]}),r.jsx(l.AnimatePresence,{children:o&&r.jsxs(r.Fragment,{children:[r.jsx(i.Overlay,{asChild:!0,children:r.jsx(a.Box,{as:l.motion.div,onClick:()=>e==null?void 0:e(!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"})}),r.jsx(a.Stack,{className:h("absolute 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:l.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:s.maxW??"140",w:s.w??"full",bg:"surface-1",border:!0,rounded:"4",...s,ref:y,children:p})]})})]})),R=c.forwardRef(({children:t,...o},e)=>r.jsx(i.Content,{ref:e,...o,asChild:!0,children:r.jsx(a.Stack,{direction:"column",children:t})})),q=c.forwardRef(({variant:t="ghost",...o},e)=>r.jsx(i.Close,{asChild:!0,children:r.jsx(m.Button,{icon:{icon:g.Lucide.X,alt:"Close Modal"},variant:t,...o,ref:e})})),S=c.forwardRef(({children:t,...o},e)=>r.jsx(a.Stack,{direction:"column",px:"6",py:"4",...o,ref:e,children:t})),v=c.forwardRef(({children:t,...o},e)=>r.jsx(a.Stack,{direction:"row",justify:"space-between",align:"center",px:"6",py:"4",borderBottom:!0,...o,ref:e,children:t})),M=c.forwardRef(({children:t,...o},e)=>r.jsx(a.Stack,{direction:"row",align:"center",justify:"end",gap:"2",px:"6",py:"4",borderTop:!0,...o,ref:e,children:t})),f={};Object.assign(f,{Root:k,Content:R,Close:q,Body:S,Header:v,Footer:M});exports.Modal=f;
|
|
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 { 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 React.ComponentPropsWithoutRef<typeof Stack> & {\n
|
|
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 { 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 React.ComponentPropsWithoutRef<typeof Stack> & {\n a11yTitle: string;\n a11yDescription?: string;\n };\n\ntype RootRef = HTMLDivElement;\n\nconst Root = React.forwardRef<RootRef, RootProps>(\n (\n {\n defaultOpen,\n open,\n onOpenChange,\n a11yTitle,\n a11yDescription,\n className,\n children,\n ...props\n },\n forwardedRef,\n ) => {\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 asChild>\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 </Dialog.Overlay>\n <Stack\n className={clsx(\n \"absolute 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 ref={forwardedRef}\n >\n {children}\n </Stack>\n </>\n )}\n </AnimatePresence>\n </Dialog.Root>\n );\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 = Omit<\n React.ComponentPropsWithoutRef<typeof Dialog.Close>,\n \"color\"\n> &\n React.ComponentPropsWithoutRef<typeof Button>;\ntype CloseRef = React.ElementRef<typeof Button>;\n\nconst Close = React.forwardRef<CloseRef, CloseProps>(\n ({ variant = \"ghost\", ...props }, forwardedRef) => {\n return (\n <Dialog.Close asChild>\n <Button\n icon={{ icon: Lucide.X, alt: \"Close Modal\" }}\n variant={variant}\n {...props}\n ref={forwardedRef}\n />\n </Dialog.Close>\n );\n },\n);\n\ntype BodyProps = React.ComponentPropsWithoutRef<typeof Stack>;\ntype BodyRef = React.ElementRef<typeof Stack>;\n\nconst Body: React.FC<BodyProps> = React.forwardRef<BodyRef, BodyProps>(\n ({ children, ...props }, forwardedRef) => {\n return (\n <Stack direction=\"column\" px=\"6\" py=\"4\" {...props} ref={forwardedRef}>\n {children}\n </Stack>\n );\n },\n);\n\ntype HeaderProps = React.ComponentPropsWithoutRef<typeof Stack>;\ntype HeaderRef = React.ElementRef<typeof Stack>;\n\nconst Header: React.FC<HeaderProps> = React.forwardRef<HeaderRef, HeaderProps>(\n ({ children, ...props }, forwardedRef) => {\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 ref={forwardedRef}\n >\n {children}\n </Stack>\n );\n },\n);\n\ntype FooterProps = React.ComponentPropsWithoutRef<typeof Stack>;\ntype FooterRef = React.ElementRef<typeof Stack>;\n\nconst Footer: React.FC<FooterProps> = React.forwardRef<FooterRef, FooterProps>(\n ({ children, ...props }, forwardedRef) => {\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 ref={forwardedRef}\n >\n {children}\n </Stack>\n );\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","React","defaultOpen","open","onOpenChange","a11yTitle","a11yDescription","className","children","props","forwardedRef","jsxs","Dialog","VisuallyHidden","jsx","AnimatePresence","Fragment","Box","motion","Stack","clsx","Content","Close","variant","Button","Lucide","Body","Header","Footer","Modal"],"mappings":"koBAoBMA,EAAOC,EAAM,WACjB,CACE,CACE,YAAAC,EACA,KAAAC,EACA,aAAAC,EACA,UAAAC,EACA,gBAAAC,EACA,UAAAC,EACA,SAAAC,EACA,GAAGC,GAELC,IAGEC,EAAA,KAACC,EAAO,KAAP,CACC,KAAAT,EACA,aAAAC,EACA,YAAAF,EAEA,SAAA,CAACS,EAAAA,KAAAE,EAAe,KAAf,CACC,SAAA,CAACC,EAAAA,IAAAF,EAAO,MAAP,CAAc,SAAUP,CAAA,CAAA,EACxBC,GACCQ,EAAA,IAACF,EAAO,YAAP,CAAoB,SAAgBN,EAAA,CAAA,EAEzC,EACAQ,EAAA,IAACC,EACE,gBAAA,CAAA,SAAAZ,GAEGQ,OAAAK,EAAAA,SAAA,CAAA,SAAA,CAAAF,EAAA,IAACF,EAAO,QAAP,CAAe,QAAO,GACrB,SAAAE,EAAA,IAACG,EAAA,IAAA,CACC,GAAIC,EAAO,OAAA,IACX,QAAS,IAAMd,GAAA,YAAAA,EAAe,IAC9B,QAAS,CAAE,eAAgB,YAAa,QAAS,CAAE,EACnD,QAAS,CAAE,eAAgB,YAAa,QAAS,CAAE,EACnD,KAAM,CAAE,eAAgB,YAAa,QAAS,CAAE,EAChD,WAAY,CAAE,SAAU,GAAK,OAAQ,EAAG,KAAM,QAAS,EACvD,UAAU,0CAAA,CAAA,EAEd,EACAU,EAAA,IAACK,EAAA,MAAA,CACC,UAAWC,EACT,mDACA,sDACAb,CACF,EACA,UAAU,SACV,GAAIW,EAAO,OAA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AAU,GAAGC,CAAA,EAASC,IAErBI,EAAA,IAACK,EAAA,MAAA,CACC,UAAU,MACV,QAAQ,gBACR,MAAM,SACN,GAAG,IACH,GAAG,IACH,aAAY,GACX,GAAGV,EACJ,IAAKC,EAEJ,SAAAF,CAAA,CAAA,CAIT,EAKMoB,EAAgC3B,EAAM,WAC1C,CAAC,CAAE,SAAAO,EAAU,GAAGC,CAAA,EAASC,IAErBI,EAAA,IAACK,EAAA,MAAA,CACC,UAAU,MACV,MAAM,SACN,QAAQ,MACR,IAAI,IACJ,GAAG,IACH,GAAG,IACH,UAAS,GACR,GAAGV,EACJ,IAAKC,EAEJ,SAAAF,CAAA,CAAA,CAIT,EAEMqB,EAAQ,CAAC,EASf,OAAO,OAAOA,EAAO,CACnB,KAAA7B,EACA,QAAAqB,EACA,MAAAC,EACA,KAAAI,EACA,OAAAC,EACA,OAAAC,CACF,CAAC"}
|
package/dist/css/default.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.tgph :is(.fixed){position:fixed}.tgph :is(.absolute){position:absolute}.tgph :is(.inset-0){inset:var(--tgph-spacing-0)}.tgph :is(.left-1\/2){left:50%}.tgph :is(.top-0){top:var(--tgph-spacing-0)}.tgph :is(.z-modal){z-index:var(--tgph-zIndex-modal)}.tgph :is(.z-overlay){z-index:var(--tgph-zIndex-overlay)}.tgph :is(.max-h-\[calc\(100vh-var\(--tgph-spacing-32\)\)\]){max-height:calc(100vh - var(--tgph-spacing-32))}.tgph :is(.-translate-x-1\/2){--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.tgph :is(.
|
|
1
|
+
.tgph :is(.fixed){position:fixed}.tgph :is(.absolute){position:absolute}.tgph :is(.inset-0){inset:var(--tgph-spacing-0)}.tgph :is(.left-1\/2){left:50%}.tgph :is(.top-0){top:var(--tgph-spacing-0)}.tgph :is(.z-modal){z-index:var(--tgph-zIndex-modal)}.tgph :is(.z-overlay){z-index:var(--tgph-zIndex-overlay)}.tgph :is(.max-h-\[calc\(100vh-var\(--tgph-spacing-32\)\)\]){max-height:calc(100vh - var(--tgph-spacing-32))}.tgph :is(.-translate-x-1\/2){--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.tgph :is(.border){border-width:1px}.tgph :is(.bg-alpha-black-4){background-color:var(--tgph-alpha-black-4)}.tgph :is(.shadow-1){--tw-shadow: var(--tgph-shadow-1);--tw-shadow-colored: var(--tgph-shadow-1);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.tgph :is(.outline){outline-style:solid}.tgph :is(.blur){--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.tgph :is(.transition){transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,70 +1,130 @@
|
|
|
1
|
-
import { jsx as t,
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import c from "
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
import { jsxs as n, jsx as t, Fragment as x } from "react/jsx-runtime";
|
|
2
|
+
import * as i from "@radix-ui/react-dialog";
|
|
3
|
+
import * as y from "@radix-ui/react-visually-hidden";
|
|
4
|
+
import { Button as b } from "@telegraph/button";
|
|
5
|
+
import { Lucide as h } from "@telegraph/icon";
|
|
6
|
+
import { Box as w, Stack as c } from "@telegraph/layout";
|
|
7
|
+
import R from "clsx";
|
|
8
|
+
import { AnimatePresence as g, motion as s } from "framer-motion";
|
|
9
|
+
import a from "react";
|
|
10
|
+
const k = a.forwardRef(
|
|
11
|
+
({
|
|
12
|
+
defaultOpen: e,
|
|
13
|
+
open: o,
|
|
14
|
+
onOpenChange: r,
|
|
15
|
+
a11yTitle: f,
|
|
16
|
+
a11yDescription: d,
|
|
17
|
+
className: m,
|
|
18
|
+
children: u,
|
|
19
|
+
...l
|
|
20
|
+
}, p) => /* @__PURE__ */ n(
|
|
21
|
+
i.Root,
|
|
22
|
+
{
|
|
23
|
+
open: o,
|
|
24
|
+
onOpenChange: r,
|
|
25
|
+
defaultOpen: e,
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ n(y.Root, { children: [
|
|
28
|
+
/* @__PURE__ */ t(i.Title, { children: f }),
|
|
29
|
+
d && /* @__PURE__ */ t(i.Description, { children: d })
|
|
30
|
+
] }),
|
|
31
|
+
/* @__PURE__ */ t(g, { children: o && /* @__PURE__ */ n(x, { children: [
|
|
32
|
+
/* @__PURE__ */ t(i.Overlay, { asChild: !0, children: /* @__PURE__ */ t(
|
|
33
|
+
w,
|
|
32
34
|
{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
as: s.div,
|
|
36
|
+
onClick: () => r == null ? void 0 : r(!1),
|
|
37
|
+
initial: { backdropFilter: "blur(0px)", opacity: 0 },
|
|
38
|
+
animate: { backdropFilter: "blur(4px)", opacity: 1 },
|
|
39
|
+
exit: { backdropFilter: "blur(0px)", opacity: 0 },
|
|
40
|
+
transition: { duration: 0.3, bounce: 0, type: "spring" },
|
|
41
|
+
className: "fixed inset-0 bg-alpha-black-4 z-overlay"
|
|
42
|
+
}
|
|
43
|
+
) }),
|
|
44
|
+
/* @__PURE__ */ t(
|
|
45
|
+
c,
|
|
46
|
+
{
|
|
47
|
+
className: R(
|
|
48
|
+
"absolute z-modal top-0 left-1/2 -translate-x-1/2",
|
|
49
|
+
"max-h-[calc(100vh-var(--tgph-spacing-32))] shadow-1",
|
|
50
|
+
m
|
|
36
51
|
),
|
|
37
52
|
direction: "column",
|
|
38
53
|
as: s.div,
|
|
39
|
-
bg: "surface-1",
|
|
40
|
-
rounded: "4",
|
|
41
54
|
my: "16",
|
|
42
|
-
initial: { scale: 0.8, opacity: 0, y: -20 },
|
|
43
|
-
animate: { scale: 1, opacity: 1, y: 0 },
|
|
44
|
-
exit: { scale: 0.8, opacity: 0, y: -20 },
|
|
55
|
+
initial: { scale: 0.8, opacity: 0, y: -20, x: "-50%" },
|
|
56
|
+
animate: { scale: 1, opacity: 1, y: 0, x: "-50%" },
|
|
57
|
+
exit: { scale: 0.8, opacity: 0, y: -20, x: "-50%" },
|
|
45
58
|
transition: { duration: 0.2, bounce: 0, type: "spring" },
|
|
59
|
+
maxW: l.maxW ?? "140",
|
|
60
|
+
w: l.w ?? "full",
|
|
61
|
+
bg: "surface-1",
|
|
46
62
|
border: !0,
|
|
47
|
-
|
|
63
|
+
rounded: "4",
|
|
64
|
+
...l,
|
|
65
|
+
ref: p,
|
|
66
|
+
children: u
|
|
48
67
|
}
|
|
49
68
|
)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
), v =
|
|
55
|
-
e,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
69
|
+
] }) })
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
), v = a.forwardRef(
|
|
74
|
+
({ children: e, ...o }, r) => /* @__PURE__ */ t(i.Content, { ref: r, ...o, asChild: !0, children: /* @__PURE__ */ t(c, { direction: "column", children: e }) })
|
|
75
|
+
), j = a.forwardRef(
|
|
76
|
+
({ variant: e = "ghost", ...o }, r) => /* @__PURE__ */ t(i.Close, { asChild: !0, children: /* @__PURE__ */ t(
|
|
77
|
+
b,
|
|
78
|
+
{
|
|
79
|
+
icon: { icon: h.X, alt: "Close Modal" },
|
|
80
|
+
variant: e,
|
|
81
|
+
...o,
|
|
82
|
+
ref: r
|
|
83
|
+
}
|
|
84
|
+
) })
|
|
85
|
+
), F = a.forwardRef(
|
|
86
|
+
({ children: e, ...o }, r) => /* @__PURE__ */ t(c, { direction: "column", px: "6", py: "4", ...o, ref: r, children: e })
|
|
87
|
+
), B = a.forwardRef(
|
|
88
|
+
({ children: e, ...o }, r) => /* @__PURE__ */ t(
|
|
89
|
+
c,
|
|
90
|
+
{
|
|
91
|
+
direction: "row",
|
|
92
|
+
justify: "space-between",
|
|
93
|
+
align: "center",
|
|
94
|
+
px: "6",
|
|
95
|
+
py: "4",
|
|
96
|
+
borderBottom: !0,
|
|
97
|
+
...o,
|
|
98
|
+
ref: r,
|
|
99
|
+
children: e
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
), C = a.forwardRef(
|
|
103
|
+
({ children: e, ...o }, r) => /* @__PURE__ */ t(
|
|
104
|
+
c,
|
|
105
|
+
{
|
|
106
|
+
direction: "row",
|
|
107
|
+
align: "center",
|
|
108
|
+
justify: "end",
|
|
109
|
+
gap: "2",
|
|
110
|
+
px: "6",
|
|
111
|
+
py: "4",
|
|
112
|
+
borderTop: !0,
|
|
113
|
+
...o,
|
|
114
|
+
ref: r,
|
|
115
|
+
children: e
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
), z = {};
|
|
119
|
+
Object.assign(z, {
|
|
120
|
+
Root: k,
|
|
121
|
+
Content: v,
|
|
122
|
+
Close: j,
|
|
123
|
+
Body: F,
|
|
124
|
+
Header: B,
|
|
125
|
+
Footer: C
|
|
66
126
|
});
|
|
67
127
|
export {
|
|
68
|
-
|
|
128
|
+
z as Modal
|
|
69
129
|
};
|
|
70
130
|
//# sourceMappingURL=index.mjs.map
|
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 { 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 React.ComponentPropsWithoutRef<typeof Stack> & {\n
|
|
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 { 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 React.ComponentPropsWithoutRef<typeof Stack> & {\n a11yTitle: string;\n a11yDescription?: string;\n };\n\ntype RootRef = HTMLDivElement;\n\nconst Root = React.forwardRef<RootRef, RootProps>(\n (\n {\n defaultOpen,\n open,\n onOpenChange,\n a11yTitle,\n a11yDescription,\n className,\n children,\n ...props\n },\n forwardedRef,\n ) => {\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 asChild>\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 </Dialog.Overlay>\n <Stack\n className={clsx(\n \"absolute 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 ref={forwardedRef}\n >\n {children}\n </Stack>\n </>\n )}\n </AnimatePresence>\n </Dialog.Root>\n );\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 = Omit<\n React.ComponentPropsWithoutRef<typeof Dialog.Close>,\n \"color\"\n> &\n React.ComponentPropsWithoutRef<typeof Button>;\ntype CloseRef = React.ElementRef<typeof Button>;\n\nconst Close = React.forwardRef<CloseRef, CloseProps>(\n ({ variant = \"ghost\", ...props }, forwardedRef) => {\n return (\n <Dialog.Close asChild>\n <Button\n icon={{ icon: Lucide.X, alt: \"Close Modal\" }}\n variant={variant}\n {...props}\n ref={forwardedRef}\n />\n </Dialog.Close>\n );\n },\n);\n\ntype BodyProps = React.ComponentPropsWithoutRef<typeof Stack>;\ntype BodyRef = React.ElementRef<typeof Stack>;\n\nconst Body: React.FC<BodyProps> = React.forwardRef<BodyRef, BodyProps>(\n ({ children, ...props }, forwardedRef) => {\n return (\n <Stack direction=\"column\" px=\"6\" py=\"4\" {...props} ref={forwardedRef}>\n {children}\n </Stack>\n );\n },\n);\n\ntype HeaderProps = React.ComponentPropsWithoutRef<typeof Stack>;\ntype HeaderRef = React.ElementRef<typeof Stack>;\n\nconst Header: React.FC<HeaderProps> = React.forwardRef<HeaderRef, HeaderProps>(\n ({ children, ...props }, forwardedRef) => {\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 ref={forwardedRef}\n >\n {children}\n </Stack>\n );\n },\n);\n\ntype FooterProps = React.ComponentPropsWithoutRef<typeof Stack>;\ntype FooterRef = React.ElementRef<typeof Stack>;\n\nconst Footer: React.FC<FooterProps> = React.forwardRef<FooterRef, FooterProps>(\n ({ children, ...props }, forwardedRef) => {\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 ref={forwardedRef}\n >\n {children}\n </Stack>\n );\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","React","defaultOpen","open","onOpenChange","a11yTitle","a11yDescription","className","children","props","forwardedRef","jsxs","Dialog","VisuallyHidden","jsx","AnimatePresence","Fragment","Box","motion","Stack","clsx","Content","Close","variant","Button","Lucide","Body","Header","Footer","Modal"],"mappings":";;;;;;;;;AAoBA,MAAMA,IAAOC,EAAM;AAAA,EACjB,CACE;AAAA,IACE,aAAAC;AAAA,IACA,MAAAC;AAAA,IACA,cAAAC;AAAA,IACA,WAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,GAAGC;AAAA,KAELC,MAGE,gBAAAC;AAAA,IAACC,EAAO;AAAA,IAAP;AAAA,MACC,MAAAT;AAAA,MACA,cAAAC;AAAA,MACA,aAAAF;AAAA,MAEA,UAAA;AAAA,QAAC,gBAAAS,EAAAE,EAAe,MAAf,EACC,UAAA;AAAA,UAAC,gBAAAC,EAAAF,EAAO,OAAP,EAAc,UAAUP,EAAA,CAAA;AAAA,UACxBC,KACC,gBAAAQ,EAACF,EAAO,aAAP,EAAoB,UAAgBN,GAAA;AAAA,QAAA,GAEzC;AAAA,QACA,gBAAAQ,EAACC,GACE,EAAA,UAAAZ,KAEG,gBAAAQ,EAAAK,GAAA,EAAA,UAAA;AAAA,UAAA,gBAAAF,EAACF,EAAO,SAAP,EAAe,SAAO,IACrB,UAAA,gBAAAE;AAAA,YAACG;AAAA,YAAA;AAAA,cACC,IAAIC,EAAO;AAAA,cACX,SAAS,MAAMd,KAAA,gBAAAA,EAAe;AAAA,cAC9B,SAAS,EAAE,gBAAgB,aAAa,SAAS,EAAE;AAAA,cACnD,SAAS,EAAE,gBAAgB,aAAa,SAAS,EAAE;AAAA,cACnD,MAAM,EAAE,gBAAgB,aAAa,SAAS,EAAE;AAA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";
|
|
2
|
-
import {
|
|
2
|
+
import { Lucide } from "@telegraph/icon";
|
|
3
|
+
import { Stack } from "@telegraph/layout";
|
|
3
4
|
import React from "react";
|
|
4
5
|
type RootProps = Omit<React.ComponentPropsWithoutRef<typeof Dialog.Root>, "modal"> & React.ComponentPropsWithoutRef<typeof Stack> & {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
container?: HTMLElement;
|
|
8
|
-
};
|
|
6
|
+
a11yTitle: string;
|
|
7
|
+
a11yDescription?: string;
|
|
9
8
|
};
|
|
10
9
|
declare const Root: React.ForwardRefExoticComponent<Omit<RootProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
-
declare const Content: React.
|
|
10
|
+
declare const Content: React.ForwardRefExoticComponent<Omit<Dialog.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
declare const Close: React.ForwardRefExoticComponent<(Omit<Omit<Omit<Dialog.DialogCloseProps & React.RefAttributes<HTMLButtonElement>, "ref">, "color"> & Omit<import("@telegraph/helpers").AsProp<React.ElementType<any, keyof React.JSX.IntrinsicElements>> & Omit<any, "as"> & {
|
|
12
|
+
leadingIcon?: ({
|
|
13
|
+
icon: React.ForwardRefExoticComponent<Omit<Lucide.LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
14
|
+
alt: string;
|
|
15
|
+
size?: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | undefined;
|
|
16
|
+
variant?: "primary" | "secondary" | undefined;
|
|
17
|
+
color?: "white" | "disabled" | "default" | "gray" | "accent" | "beige" | "blue" | "green" | "yellow" | "purple" | "red" | undefined;
|
|
18
|
+
} & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<SVGSVGElement>) | undefined;
|
|
19
|
+
trailingIcon?: ({
|
|
20
|
+
icon: React.ForwardRefExoticComponent<Omit<Lucide.LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
21
|
+
alt: string;
|
|
22
|
+
size?: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | undefined;
|
|
23
|
+
variant?: "primary" | "secondary" | undefined;
|
|
24
|
+
color?: "white" | "disabled" | "default" | "gray" | "accent" | "beige" | "blue" | "green" | "yellow" | "purple" | "red" | undefined;
|
|
25
|
+
} & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<SVGSVGElement>) | undefined;
|
|
26
|
+
icon?: undefined;
|
|
27
|
+
} & {
|
|
28
|
+
variant?: "ghost" | "solid" | "soft" | "outline" | undefined;
|
|
29
|
+
size?: "1" | "2" | "3" | undefined;
|
|
30
|
+
color?: "gray" | "accent" | "blue" | "green" | "yellow" | "purple" | "red" | undefined;
|
|
31
|
+
state?: "disabled" | "loading" | "default" | "error" | "success" | "warning" | undefined;
|
|
32
|
+
active?: boolean | undefined;
|
|
33
|
+
} & {
|
|
34
|
+
ref?: (string | React.Ref<HTMLButtonElement>) | undefined;
|
|
35
|
+
}, "ref">, "ref"> | Omit<Omit<Omit<Dialog.DialogCloseProps & React.RefAttributes<HTMLButtonElement>, "ref">, "color"> & Omit<import("@telegraph/helpers").AsProp<React.ElementType<any, keyof React.JSX.IntrinsicElements>> & Omit<any, "as"> & {
|
|
36
|
+
icon?: ({
|
|
37
|
+
icon: React.ForwardRefExoticComponent<Omit<Lucide.LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
38
|
+
alt: string;
|
|
39
|
+
size?: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | undefined;
|
|
40
|
+
variant?: "primary" | "secondary" | undefined;
|
|
41
|
+
color?: "white" | "disabled" | "default" | "gray" | "accent" | "beige" | "blue" | "green" | "yellow" | "purple" | "red" | undefined;
|
|
42
|
+
} & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<SVGSVGElement>) | undefined;
|
|
43
|
+
leadingIcon?: undefined;
|
|
44
|
+
trailingIcon?: undefined;
|
|
45
|
+
} & {
|
|
46
|
+
variant?: "ghost" | "solid" | "soft" | "outline" | undefined;
|
|
47
|
+
size?: "1" | "2" | "3" | undefined;
|
|
48
|
+
color?: "gray" | "accent" | "blue" | "green" | "yellow" | "purple" | "red" | undefined;
|
|
49
|
+
state?: "disabled" | "loading" | "default" | "error" | "success" | "warning" | undefined;
|
|
50
|
+
active?: boolean | undefined;
|
|
51
|
+
} & {
|
|
52
|
+
ref?: (string | React.Ref<HTMLButtonElement>) | undefined;
|
|
53
|
+
}, "ref">, "ref">) & React.RefAttributes<HTMLButtonElement>>;
|
|
54
|
+
type BodyProps = React.ComponentPropsWithoutRef<typeof Stack>;
|
|
55
|
+
declare const Body: React.FC<BodyProps>;
|
|
56
|
+
type HeaderProps = React.ComponentPropsWithoutRef<typeof Stack>;
|
|
57
|
+
declare const Header: React.FC<HeaderProps>;
|
|
58
|
+
type FooterProps = React.ComponentPropsWithoutRef<typeof Stack>;
|
|
59
|
+
declare const Footer: React.FC<FooterProps>;
|
|
12
60
|
declare const Modal: {
|
|
13
61
|
Root: typeof Root;
|
|
14
62
|
Content: typeof Content;
|
|
63
|
+
Close: typeof Close;
|
|
64
|
+
Body: typeof Body;
|
|
65
|
+
Header: typeof Header;
|
|
66
|
+
Footer: typeof Footer;
|
|
15
67
|
};
|
|
16
68
|
export { Modal };
|
|
17
69
|
//# sourceMappingURL=Modal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAGjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAO,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,KAAK,SAAS,GAAG,IAAI,CACnB,KAAK,CAAC,wBAAwB,CAAC,OAAO,MAAM,CAAC,IAAI,CAAC,EAClD,OAAO,CACR,GACC,KAAK,CAAC,wBAAwB,CAAC,OAAO,KAAK,CAAC,GAAG;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAIJ,QAAA,MAAM,IAAI,+FAqET,CAAC;AAKF,QAAA,MAAM,OAAO,qJAQZ,CAAC;AASF,QAAA,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4DAaV,CAAC;AAEF,KAAK,SAAS,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,KAAK,CAAC,CAAC;AAG9D,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAQ7B,CAAC;AAEF,KAAK,WAAW,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,KAAK,CAAC,CAAC;AAGhE,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAiBjC,CAAC;AAEF,KAAK,WAAW,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,KAAK,CAAC,CAAC;AAGhE,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAkBjC,CAAC;AAEF,QAAA,MAAM,KAAK;UACH,WAAW;aACR,cAAc;WAChB,YAAY;UACb,WAAW;YACT,aAAa;YACb,aAAa;CACtB,CAAC;AAWF,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Modal as TelegraphModal } from "./Modal";
|
|
3
|
+
declare const meta: Meta<typeof TelegraphModal.Root>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof TelegraphModal.Root>;
|
|
6
|
+
export declare const Modal: Story;
|
|
7
|
+
//# sourceMappingURL=Modal.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.stories.d.ts","sourceRoot":"","sources":["../../../src/Modal/Modal.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAKvD,OAAO,EAAE,KAAK,IAAI,cAAc,EAAE,MAAM,SAAS,CAAC;AAElD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,cAAc,CAAC,IAAI,CAG1C,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC;AAElD,eAAO,MAAM,KAAK,EAAE,KAyBnB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telegraph/modal",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"repository": "https://github.com/knocklabs/telegraph/tree/main/packages/modal",
|
|
5
5
|
"author": "@knocklabs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,7 +35,10 @@
|
|
|
35
35
|
},
|
|
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.16",
|
|
40
|
+
"@telegraph/icon": "^0.0.9",
|
|
41
|
+
"@telegraph/layout": "^0.0.9",
|
|
39
42
|
"clsx": "^2.1.0",
|
|
40
43
|
"framer-motion": "^11.1.9"
|
|
41
44
|
},
|
|
@@ -43,9 +46,9 @@
|
|
|
43
46
|
"@knocklabs/eslint-config": "^0.0.3",
|
|
44
47
|
"@knocklabs/prettier-config": "^0.0.1",
|
|
45
48
|
"@knocklabs/typescript-config": "^0.0.2",
|
|
46
|
-
"@telegraph/postcss-config": "^0.0.
|
|
49
|
+
"@telegraph/postcss-config": "^0.0.14",
|
|
47
50
|
"@telegraph/tailwind-config": "^0.0.11",
|
|
48
|
-
"@telegraph/vite-config": "^0.0.
|
|
51
|
+
"@telegraph/vite-config": "^0.0.9",
|
|
49
52
|
"@telegraph/vitest-config": "^0.0.6",
|
|
50
53
|
"@types/react": "^18.2.48",
|
|
51
54
|
"eslint": "^8.56.0",
|