@@ -5,14 +5,37 @@ import { X } from 'lucide-react';
55import { ComponentPropsWithoutRef , ElementRef , forwardRef , HTMLAttributes } from 'react' ;
66import { cn } from '../../lib/utils' ;
77
8+ /**
9+ * The root Dialog component that manages the state and accessibility of the dialog
10+ * @see https://ui.shadcn.com/docs/components/dialog
11+ * @returns A Dialog root component
12+ */
813const Dialog = Root ;
914
15+ /**
16+ * The button that opens the dialog when clicked
17+ * @returns A button component that triggers the dialog
18+ */
1019const DialogTrigger = Trigger ;
1120
21+ /**
22+ * Portal component that renders the dialog content in a portal
23+ * @returns A portal component for dialog content
24+ */
1225const DialogPortal = Portal ;
1326
27+ /**
28+ * Button component for closing the dialog
29+ * @returns A close button component
30+ */
1431const DialogClose = Close ;
1532
33+ /**
34+ * The overlay that covers the screen behind the dialog
35+ * @param props - Props for the overlay component including className and ref
36+ * @param props.className - Additional CSS classes to apply to the dialog overlay
37+ * @returns A semi-transparent overlay component
38+ */
1639const DialogOverlay = forwardRef < ElementRef < typeof Overlay > , ComponentPropsWithoutRef < typeof Overlay > > (
1740 ( { className, ...props } , ref ) => (
1841 < Overlay
@@ -27,6 +50,12 @@ const DialogOverlay = forwardRef<ElementRef<typeof Overlay>, ComponentPropsWitho
2750) ;
2851DialogOverlay . displayName = Overlay . displayName ;
2952
53+ /**
54+ * The main content container of the dialog
55+ * @param props - Props for the content component including className, children and ref
56+ * @param props.className - Additional CSS classes to apply to the dialog content
57+ * @returns A dialog content container component
58+ */
3059const DialogContent = forwardRef < ElementRef < typeof Content > , ComponentPropsWithoutRef < typeof Content > > (
3160 ( { className, children, ...props } , ref ) => (
3261 < DialogPortal >
@@ -50,11 +79,23 @@ const DialogContent = forwardRef<ElementRef<typeof Content>, ComponentPropsWitho
5079) ;
5180DialogContent . displayName = Content . displayName ;
5281
82+ /**
83+ * Container for the dialog header content
84+ * @param props - HTML div element attributes including className
85+ * @param props.className - Additional CSS classes to apply to the dialog header
86+ * @returns A header container component
87+ */
5388const DialogHeader = ( { className, ...props } : HTMLAttributes < HTMLDivElement > ) => (
5489 < div className = { cn ( 'flex flex-col space-y-1.5 text-center sm:text-start' , className ) } { ...props } />
5590) ;
5691DialogHeader . displayName = 'DialogHeader' ;
5792
93+ /**
94+ * Container for the dialog footer content
95+ * @param props - HTML div element attributes including className
96+ * @param props.className - Additional CSS classes to apply to the dialog footer
97+ * @returns A footer container component
98+ */
5899const DialogFooter = ( { className, ...props } : HTMLAttributes < HTMLDivElement > ) => (
59100 < div
60101 className = { cn ( 'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 rtl:space-x-reverse' , className ) }
@@ -63,13 +104,25 @@ const DialogFooter = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) =
63104) ;
64105DialogFooter . displayName = 'DialogFooter' ;
65106
107+ /**
108+ * The title component of the dialog
109+ * @param props - Props for the title component including className and ref
110+ * @param props.className - Additional CSS classes to apply to the dialog title
111+ * @returns A title component for the dialog
112+ */
66113const DialogTitle = forwardRef < ElementRef < typeof Title > , ComponentPropsWithoutRef < typeof Title > > (
67114 ( { className, ...props } , ref ) => (
68115 < Title ref = { ref } className = { cn ( 'text-lg font-semibold leading-none tracking-tight' , className ) } { ...props } />
69116 )
70117) ;
71118DialogTitle . displayName = Title . displayName ;
72119
120+ /**
121+ * The description component of the dialog
122+ * @param props - Props for the description component including className and ref
123+ * @param props.className - Additional CSS classes to apply to the dialog description
124+ * @returns A description component for the dialog
125+ */
73126const DialogDescription = forwardRef < ElementRef < typeof Description > , ComponentPropsWithoutRef < typeof Description > > (
74127 ( { className, ...props } , ref ) => (
75128 < Description ref = { ref } className = { cn ( 'text-sm text-muted-foreground' , className ) } { ...props } />
0 commit comments