@@ -4,94 +4,97 @@ import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
44import { cn } from "@/lib/utils"
55import { buttonVariants } from "@/components/ui/button"
66
7- const AlertDialog = AlertDialogPrimitive . Root
8-
9- const AlertDialogTrigger = AlertDialogPrimitive . Trigger
7+ function AlertDialog ( { ... props } : React . ComponentProps < typeof AlertDialogPrimitive . Root > ) {
8+ return < AlertDialogPrimitive . Root data-slot = "alert-dialog" { ... props } />
9+ }
1010
11- const AlertDialogPortal = AlertDialogPrimitive . Portal
11+ function AlertDialogTrigger ( { ...props } : React . ComponentProps < typeof AlertDialogPrimitive . Trigger > ) {
12+ return < AlertDialogPrimitive . Trigger data-slot = "alert-dialog-trigger" { ...props } />
13+ }
1214
13- const AlertDialogOverlay = React . forwardRef <
14- React . ElementRef < typeof AlertDialogPrimitive . Overlay > ,
15- React . ComponentPropsWithoutRef < typeof AlertDialogPrimitive . Overlay >
16- > ( ( { className, ...props } , ref ) => (
17- < AlertDialogPrimitive . Overlay
18- className = { cn (
19- "fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" ,
20- className ,
21- ) }
22- { ...props }
23- ref = { ref }
24- />
25- ) )
26- AlertDialogOverlay . displayName = AlertDialogPrimitive . Overlay . displayName
15+ function AlertDialogPortal ( { ...props } : React . ComponentProps < typeof AlertDialogPrimitive . Portal > ) {
16+ return < AlertDialogPrimitive . Portal data-slot = "alert-dialog-portal" { ...props } />
17+ }
2718
28- const AlertDialogContent = React . forwardRef <
29- React . ElementRef < typeof AlertDialogPrimitive . Content > ,
30- React . ComponentPropsWithoutRef < typeof AlertDialogPrimitive . Content >
31- > ( ( { className, ...props } , ref ) => (
32- < AlertDialogPortal >
33- < AlertDialogOverlay />
34- < AlertDialogPrimitive . Content
35- ref = { ref }
19+ function AlertDialogOverlay ( { className, ...props } : React . ComponentProps < typeof AlertDialogPrimitive . Overlay > ) {
20+ return (
21+ < AlertDialogPrimitive . Overlay
22+ data-slot = "alert-dialog-overlay"
3623 className = { cn (
37- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-vscode-editor-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg " ,
24+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80 " ,
3825 className ,
3926 ) }
4027 { ...props }
4128 />
42- </ AlertDialogPortal >
43- ) )
44- AlertDialogContent . displayName = AlertDialogPrimitive . Content . displayName
29+ )
30+ }
4531
46- const AlertDialogHeader = ( { className, ...props } : React . HTMLAttributes < HTMLDivElement > ) => (
47- < div className = { cn ( "flex flex-col space-y-2 text-left" , className ) } { ...props } />
48- )
49- AlertDialogHeader . displayName = "AlertDialogHeader"
32+ function AlertDialogContent ( { className, ...props } : React . ComponentProps < typeof AlertDialogPrimitive . Content > ) {
33+ return (
34+ < AlertDialogPortal >
35+ < AlertDialogOverlay />
36+ < AlertDialogPrimitive . Content
37+ data-slot = "alert-dialog-content"
38+ className = { cn (
39+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg" ,
40+ className ,
41+ ) }
42+ { ...props }
43+ />
44+ </ AlertDialogPortal >
45+ )
46+ }
5047
51- const AlertDialogFooter = ( { className, ...props } : React . HTMLAttributes < HTMLDivElement > ) => (
52- < div className = { cn ( "flex flex-row justify-end space-x-2" , className ) } { ...props } />
53- )
54- AlertDialogFooter . displayName = "AlertDialogFooter"
48+ function AlertDialogHeader ( { className, ...props } : React . ComponentProps < "div" > ) {
49+ return (
50+ < div
51+ data-slot = "alert-dialog-header"
52+ className = { cn ( "flex flex-col gap-2 text-center sm:text-left" , className ) }
53+ { ...props }
54+ />
55+ )
56+ }
5557
56- const AlertDialogTitle = React . forwardRef <
57- React . ElementRef < typeof AlertDialogPrimitive . Title > ,
58- React . ComponentPropsWithoutRef < typeof AlertDialogPrimitive . Title >
59- > ( ( { className, ...props } , ref ) => (
60- < AlertDialogPrimitive . Title ref = { ref } className = { cn ( "text-lg font-semibold" , className ) } { ...props } />
61- ) )
62- AlertDialogTitle . displayName = AlertDialogPrimitive . Title . displayName
58+ function AlertDialogFooter ( { className, ...props } : React . ComponentProps < "div" > ) {
59+ return (
60+ < div
61+ data-slot = "alert-dialog-footer"
62+ className = { cn ( "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end" , className ) }
63+ { ...props }
64+ />
65+ )
66+ }
67+
68+ function AlertDialogTitle ( { className, ...props } : React . ComponentProps < typeof AlertDialogPrimitive . Title > ) {
69+ return (
70+ < AlertDialogPrimitive . Title
71+ data-slot = "alert-dialog-title"
72+ className = { cn ( "text-lg font-semibold" , className ) }
73+ { ...props }
74+ />
75+ )
76+ }
6377
64- const AlertDialogDescription = React . forwardRef <
65- React . ElementRef < typeof AlertDialogPrimitive . Description > ,
66- React . ComponentPropsWithoutRef < typeof AlertDialogPrimitive . Description >
67- > ( ( { className, ...props } , ref ) => (
68- < AlertDialogPrimitive . Description
69- ref = { ref }
70- className = { cn ( "text-base text-muted-foreground" , className ) }
71- { ...props }
72- />
73- ) )
74- AlertDialogDescription . displayName = AlertDialogPrimitive . Description . displayName
78+ function AlertDialogDescription ( {
79+ className,
80+ ...props
81+ } : React . ComponentProps < typeof AlertDialogPrimitive . Description > ) {
82+ return (
83+ < AlertDialogPrimitive . Description
84+ data-slot = "alert-dialog-description"
85+ className = { cn ( "text-muted-foreground text-sm" , className ) }
86+ { ...props }
87+ />
88+ )
89+ }
7590
76- const AlertDialogAction = React . forwardRef <
77- React . ElementRef < typeof AlertDialogPrimitive . Action > ,
78- React . ComponentPropsWithoutRef < typeof AlertDialogPrimitive . Action >
79- > ( ( { className, ...props } , ref ) => (
80- < AlertDialogPrimitive . Action ref = { ref } className = { cn ( buttonVariants ( ) , className ) } { ...props } />
81- ) )
82- AlertDialogAction . displayName = AlertDialogPrimitive . Action . displayName
91+ function AlertDialogAction ( { className, ...props } : React . ComponentProps < typeof AlertDialogPrimitive . Action > ) {
92+ return < AlertDialogPrimitive . Action className = { cn ( buttonVariants ( ) , className ) } { ...props } />
93+ }
8394
84- const AlertDialogCancel = React . forwardRef <
85- React . ElementRef < typeof AlertDialogPrimitive . Cancel > ,
86- React . ComponentPropsWithoutRef < typeof AlertDialogPrimitive . Cancel >
87- > ( ( { className, ...props } , ref ) => (
88- < AlertDialogPrimitive . Cancel
89- ref = { ref }
90- className = { cn ( buttonVariants ( { variant : "secondary" } ) , "mt-0" , className ) }
91- { ...props }
92- />
93- ) )
94- AlertDialogCancel . displayName = AlertDialogPrimitive . Cancel . displayName
95+ function AlertDialogCancel ( { className, ...props } : React . ComponentProps < typeof AlertDialogPrimitive . Cancel > ) {
96+ return < AlertDialogPrimitive . Cancel className = { cn ( buttonVariants ( { variant : "outline" } ) , className ) } { ...props } />
97+ }
9598
9699export {
97100 AlertDialog ,
0 commit comments