@@ -6,22 +6,53 @@ import type * as React from 'react';
6
6
import { Button } from '@/components/primitives' ;
7
7
import { tcls } from '@/lib/tailwind' ;
8
8
9
+ /**
10
+ * Root component for the Sheet dialog.
11
+ * Wraps the Radix UI Dialog.Root component and provides the context for the sheet dialog.
12
+ *
13
+ * @example
14
+ * <Sheet>
15
+ * <SheetTrigger>Open</SheetTrigger>
16
+ * <SheetContent>
17
+ * <SheetHeader>
18
+ * <SheetTitle>Title</SheetTitle>
19
+ * <SheetDescription>Description</SheetDescription>
20
+ * </SheetHeader>
21
+ * </SheetContent>
22
+ * </Sheet>
23
+ */
9
24
export function Sheet ( { ...props } : React . ComponentProps < typeof SheetPrimitive . Root > ) {
10
25
return < SheetPrimitive . Root data-slot = "sheet" { ...props } /> ;
11
26
}
12
27
28
+ /**
29
+ * Trigger component that opens the sheet dialog.
30
+ * Typically used as a button or other interactive element to open the sheet.
31
+ */
13
32
export function SheetTrigger ( { ...props } : React . ComponentProps < typeof SheetPrimitive . Trigger > ) {
14
33
return < SheetPrimitive . Trigger data-slot = "sheet-trigger" { ...props } /> ;
15
34
}
16
35
36
+ /**
37
+ * Close component that closes the sheet dialog.
38
+ * Can be used to create custom close buttons or triggers.
39
+ */
17
40
export function SheetClose ( { ...props } : React . ComponentProps < typeof SheetPrimitive . Close > ) {
18
41
return < SheetPrimitive . Close data-slot = "sheet-close" { ...props } /> ;
19
42
}
20
43
44
+ /**
45
+ * Portal component that renders the sheet content outside the DOM hierarchy.
46
+ * Ensures proper stacking context and accessibility.
47
+ */
21
48
export function SheetPortal ( { ...props } : React . ComponentProps < typeof SheetPrimitive . Portal > ) {
22
49
return < SheetPrimitive . Portal data-slot = "sheet-portal" { ...props } /> ;
23
50
}
24
51
52
+ /**
53
+ * Overlay component that creates a semi-transparent backdrop behind the sheet.
54
+ * Includes blur effect and animation states for opening/closing.
55
+ */
25
56
function SheetOverlay ( {
26
57
className,
27
58
...props
@@ -30,14 +61,20 @@ function SheetOverlay({
30
61
< SheetPrimitive . Overlay
31
62
data-slot = "sheet-overlay"
32
63
className = { tcls (
33
- 'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-30 bg-tint-12/4 backdrop-blur-lg data-[state=closed]:animate-out data-[state=open]:animate-in dark:bg-tint-1/6' ,
64
+ 'fixed inset-0 z-30 bg-tint-12/4 backdrop-blur-lg data-[state=closed]:animate-fadeIn data-[state=closed]:animate- out data-[state=open]:animate-fadeOut data-[state=open]:animate-in dark:bg-tint-1/6' ,
34
65
className
35
66
) }
36
67
{ ...props }
37
68
/>
38
69
) ;
39
70
}
40
71
72
+ /**
73
+ * Main content component for the sheet dialog.
74
+ * Handles positioning, animations, and styling of the sheet content.
75
+ * @param side - Determines which side the sheet slides in from ('left' or 'right')
76
+ * @param overlayClassName - Optional className for the overlay component
77
+ */
41
78
export function SheetContent ( {
42
79
className,
43
80
overlayClassName,
@@ -109,6 +146,10 @@ export function SheetContent({
109
146
) ;
110
147
}
111
148
149
+ /**
150
+ * Header component for the sheet dialog.
151
+ * Provides consistent padding and layout for the sheet header area.
152
+ */
112
153
export function SheetHeader ( { className, ...props } : React . ComponentProps < 'div' > ) {
113
154
return (
114
155
< div
@@ -119,6 +160,10 @@ export function SheetHeader({ className, ...props }: React.ComponentProps<'div'>
119
160
) ;
120
161
}
121
162
163
+ /**
164
+ * Title component for the sheet dialog.
165
+ * Renders the main heading of the sheet with consistent styling.
166
+ */
122
167
export function SheetTitle ( {
123
168
className,
124
169
...props
@@ -132,6 +177,10 @@ export function SheetTitle({
132
177
) ;
133
178
}
134
179
180
+ /**
181
+ * Description component for the sheet dialog.
182
+ * Renders supplementary text or description with consistent styling.
183
+ */
135
184
export function SheetDescription ( {
136
185
className,
137
186
...props
0 commit comments