Skip to content

Commit

Permalink
feat: export portal and overlay for alert-dialog, dialog and sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
shadcn committed Oct 3, 2023
1 parent 524e4b8 commit 0ed1d97
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 8 deletions.
8 changes: 6 additions & 2 deletions apps/www/registry/default/ui/alert-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const AlertDialog = AlertDialogPrimitive.Root

const AlertDialogTrigger = AlertDialogPrimitive.Trigger

const AlertDialogPortal = AlertDialogPrimitive.Portal

const AlertDialogOverlay = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
Expand All @@ -29,7 +31,7 @@ const AlertDialogContent = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Portal>
<AlertDialogPortal>
<AlertDialogOverlay />
<AlertDialogPrimitive.Content
ref={ref}
Expand All @@ -39,7 +41,7 @@ const AlertDialogContent = React.forwardRef<
)}
{...props}
/>
</AlertDialogPrimitive.Portal>
</AlertDialogPortal>
))
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName

Expand Down Expand Up @@ -126,6 +128,8 @@ AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName

export {
AlertDialog,
AlertDialogPortal,
AlertDialogOverlay,
AlertDialogTrigger,
AlertDialogContent,
AlertDialogHeader,
Expand Down
8 changes: 6 additions & 2 deletions apps/www/registry/default/ui/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const Dialog = DialogPrimitive.Root

const DialogTrigger = DialogPrimitive.Trigger

const DialogPortal = DialogPrimitive.Portal

const DialogOverlay = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
Expand All @@ -29,7 +31,7 @@ const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
>(({ className, children, ...props }, ref) => (
<DialogPrimitive.Portal>
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Content
ref={ref}
Expand All @@ -45,7 +47,7 @@ const DialogContent = React.forwardRef<
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
</DialogPrimitive.Content>
</DialogPrimitive.Portal>
</DialogPortal>
))
DialogContent.displayName = DialogPrimitive.Content.displayName

Expand Down Expand Up @@ -106,6 +108,8 @@ DialogDescription.displayName = DialogPrimitive.Description.displayName

export {
Dialog,
DialogPortal,
DialogOverlay,
DialogTrigger,
DialogContent,
DialogHeader,
Expand Down
2 changes: 2 additions & 0 deletions apps/www/registry/default/ui/sheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ SheetDescription.displayName = SheetPrimitive.Description.displayName

export {
Sheet,
SheetPortal,
SheetOverlay,
SheetTrigger,
SheetClose,
SheetContent,
Expand Down
8 changes: 6 additions & 2 deletions apps/www/registry/new-york/ui/alert-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const AlertDialog = AlertDialogPrimitive.Root

const AlertDialogTrigger = AlertDialogPrimitive.Trigger

const AlertDialogPortal = AlertDialogPrimitive.Portal

const AlertDialogOverlay = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
Expand All @@ -29,7 +31,7 @@ const AlertDialogContent = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Portal>
<AlertDialogPortal>
<AlertDialogOverlay />
<AlertDialogPrimitive.Content
ref={ref}
Expand All @@ -39,7 +41,7 @@ const AlertDialogContent = React.forwardRef<
)}
{...props}
/>
</AlertDialogPrimitive.Portal>
</AlertDialogPortal>
))
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName

Expand Down Expand Up @@ -126,6 +128,8 @@ AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName

export {
AlertDialog,
AlertDialogPortal,
AlertDialogOverlay,
AlertDialogTrigger,
AlertDialogContent,
AlertDialogHeader,
Expand Down
8 changes: 6 additions & 2 deletions apps/www/registry/new-york/ui/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const Dialog = DialogPrimitive.Root

const DialogTrigger = DialogPrimitive.Trigger

const DialogPortal = DialogPrimitive.Portal

const DialogOverlay = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
Expand All @@ -29,7 +31,7 @@ const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
>(({ className, children, ...props }, ref) => (
<DialogPrimitive.Portal>
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Content
ref={ref}
Expand All @@ -45,7 +47,7 @@ const DialogContent = React.forwardRef<
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
</DialogPrimitive.Content>
</DialogPrimitive.Portal>
</DialogPortal>
))
DialogContent.displayName = DialogPrimitive.Content.displayName

Expand Down Expand Up @@ -106,6 +108,8 @@ DialogDescription.displayName = DialogPrimitive.Description.displayName

export {
Dialog,
DialogPortal,
DialogOverlay,
DialogTrigger,
DialogContent,
DialogHeader,
Expand Down
2 changes: 2 additions & 0 deletions apps/www/registry/new-york/ui/sheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ SheetDescription.displayName = SheetPrimitive.Description.displayName

export {
Sheet,
SheetPortal,
SheetOverlay,
SheetTrigger,
SheetClose,
SheetContent,
Expand Down

0 comments on commit 0ed1d97

Please sign in to comment.