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