1
- "use client" ;
1
+ "use client"
2
2
3
- import * as React from "react" ;
4
- import * as DialogPrimitive from "@radix-ui/react-dialog" ;
5
- import { X } from "lucide-react" ;
3
+ import * as React from "react"
4
+ import * as DialogPrimitive from "@radix-ui/react-dialog"
5
+ import { X } from "lucide-react"
6
6
7
- import { cn } from "@/lib/utils" ;
7
+ import { cn } from "@/lib/utils"
8
8
9
- const Dialog = DialogPrimitive . Root ;
9
+ const Dialog = DialogPrimitive . Root
10
10
11
- const DialogTrigger = DialogPrimitive . Trigger ;
11
+ const DialogTrigger = DialogPrimitive . Trigger
12
12
13
- const DialogPortal = ( {
14
- className,
15
- ...props
16
- } :DialogPrimitive . DialogPortalProps ) => (
17
- < DialogPrimitive . Portal className = { cn ( className ) } { ...props } />
18
- ) ;
19
- DialogPortal . displayName = DialogPrimitive . Portal . displayName ;
13
+ const DialogPortal = DialogPrimitive . Portal
14
+
15
+ const DialogClose = DialogPrimitive . Close
20
16
21
17
const DialogOverlay = React . forwardRef <
22
18
React . ElementRef < typeof DialogPrimitive . Overlay > ,
@@ -26,12 +22,12 @@ const DialogOverlay = React.forwardRef<
26
22
ref = { ref }
27
23
className = { cn (
28
24
"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" ,
29
- className ,
25
+ className
30
26
) }
31
27
{ ...props }
32
28
/>
33
- ) ) ;
34
- DialogOverlay . displayName = DialogPrimitive . Overlay . displayName ;
29
+ ) )
30
+ DialogOverlay . displayName = DialogPrimitive . Overlay . displayName
35
31
36
32
const DialogContent = React . forwardRef <
37
33
React . ElementRef < typeof DialogPrimitive . Content > ,
@@ -42,19 +38,20 @@ const DialogContent = React.forwardRef<
42
38
< DialogPrimitive . Content
43
39
ref = { ref }
44
40
className = { cn (
45
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-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%] sm:rounded-lg md:w-full " ,
46
- className ,
41
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-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%] sm:rounded-lg" ,
42
+ className
47
43
) }
48
- { ...props } >
44
+ { ...props }
45
+ >
49
46
{ children }
50
47
< DialogPrimitive . Close className = "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground" >
51
48
< X className = "h-4 w-4" />
52
49
< span className = "sr-only" > Close</ span >
53
50
</ DialogPrimitive . Close >
54
51
</ DialogPrimitive . Content >
55
52
</ DialogPortal >
56
- ) ) ;
57
- DialogContent . displayName = DialogPrimitive . Content . displayName ;
53
+ ) )
54
+ DialogContent . displayName = DialogPrimitive . Content . displayName
58
55
59
56
const DialogHeader = ( {
60
57
className,
@@ -63,12 +60,12 @@ const DialogHeader = ({
63
60
< div
64
61
className = { cn (
65
62
"flex flex-col space-y-1.5 text-center sm:text-left" ,
66
- className ,
63
+ className
67
64
) }
68
65
{ ...props }
69
66
/>
70
- ) ;
71
- DialogHeader . displayName = "DialogHeader" ;
67
+ )
68
+ DialogHeader . displayName = "DialogHeader"
72
69
73
70
const DialogFooter = ( {
74
71
className,
@@ -77,12 +74,12 @@ const DialogFooter = ({
77
74
< div
78
75
className = { cn (
79
76
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2" ,
80
- className ,
77
+ className
81
78
) }
82
79
{ ...props }
83
80
/>
84
- ) ;
85
- DialogFooter . displayName = "DialogFooter" ;
81
+ )
82
+ DialogFooter . displayName = "DialogFooter"
86
83
87
84
const DialogTitle = React . forwardRef <
88
85
React . ElementRef < typeof DialogPrimitive . Title > ,
@@ -92,12 +89,12 @@ const DialogTitle = React.forwardRef<
92
89
ref = { ref }
93
90
className = { cn (
94
91
"text-lg font-semibold leading-none tracking-tight" ,
95
- className ,
92
+ className
96
93
) }
97
94
{ ...props }
98
95
/>
99
- ) ) ;
100
- DialogTitle . displayName = DialogPrimitive . Title . displayName ;
96
+ ) )
97
+ DialogTitle . displayName = DialogPrimitive . Title . displayName
101
98
102
99
const DialogDescription = React . forwardRef <
103
100
React . ElementRef < typeof DialogPrimitive . Description > ,
@@ -108,15 +105,18 @@ const DialogDescription = React.forwardRef<
108
105
className = { cn ( "text-sm text-muted-foreground" , className ) }
109
106
{ ...props }
110
107
/>
111
- ) ) ;
112
- DialogDescription . displayName = DialogPrimitive . Description . displayName ;
108
+ ) )
109
+ DialogDescription . displayName = DialogPrimitive . Description . displayName
113
110
114
111
export {
115
112
Dialog ,
113
+ DialogPortal ,
114
+ DialogOverlay ,
115
+ DialogClose ,
116
116
DialogTrigger ,
117
117
DialogContent ,
118
118
DialogHeader ,
119
119
DialogFooter ,
120
120
DialogTitle ,
121
121
DialogDescription ,
122
- } ;
122
+ }