import * as React from 'react' import { AlertDialog as BaseAlertDialog } from '@base-ui/react/alert-dialog' import { cn } from '../../internal/utils' import { type ModalContentProps, splitModalProps } from '../../internal/modal' type AlertDialogProps = React.ComponentProps const AlertDialog = Object.assign( function AlertDialog(props: AlertDialogProps) { return }, { createHandle: BaseAlertDialog.createHandle }, ) type AlertDialogTriggerProps = React.ComponentProps function AlertDialogTrigger({ className, ...props }: AlertDialogTriggerProps) { return } type AlertDialogContentProps = ModalContentProps< React.ComponentProps, React.ComponentProps, React.ComponentProps, React.ComponentProps > & { /** * Render the dimmed, blurred backdrop behind the popup. * @default true */ backdrop?: boolean /** * Wrap the popup in a translucent glass frame. Needs `backdrop`: without one the popup * is always a plain solid card. * @default true */ frame?: boolean } function AlertDialogContent({ className, children, backdrop = true, frame = true, backdropProps, viewportProps, ...props }: AlertDialogContentProps) { const { portal, popup } = splitModalProps(props) const forceBackdrop = backdropProps?.forceRender === true // The frame is a rim of blurred page around the popup, so it only reads against the // backdrop. Without one it collapses to a plain solid card. const showFrame = frame && backdrop return ( {backdrop && ( )}
[data-slot=alert-dialog-footer]]:pb-6 not-has-[>[data-slot=alert-dialog-header]]:pt-6 [&>[data-slot=alert-dialog-header]+[data-slot=alert-dialog-footer]]:pt-0', showFrame && cn( 'bg-background rounded-[calc(var(--radius-2xl)*5/6)]', !forceBackdrop && 'group-data-nested/alert-dialog-popup:rounded-none group-data-nested/alert-dialog-popup:bg-transparent', ), )} > {children}
) } type AlertDialogHeaderProps = React.ComponentPropsWithoutRef<'div'> function AlertDialogHeader({ className, ...props }: AlertDialogHeaderProps) { return (
) } type AlertDialogTitleProps = React.ComponentProps function AlertDialogTitle({ className, ...props }: AlertDialogTitleProps) { return ( ) } type AlertDialogDescriptionProps = React.ComponentProps function AlertDialogDescription({ className, ...props }: AlertDialogDescriptionProps) { return ( ) } type AlertDialogBodyProps = React.ComponentPropsWithoutRef<'div'> function AlertDialogBody({ className, ...props }: AlertDialogBodyProps) { return
} type AlertDialogFooterProps = React.ComponentPropsWithoutRef<'div'> function AlertDialogFooter({ className, ...props }: AlertDialogFooterProps) { return (
) } type AlertDialogCloseProps = React.ComponentProps function AlertDialogClose({ className, ...props }: AlertDialogCloseProps) { return } export { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogBody, AlertDialogFooter, AlertDialogClose, } export type { AlertDialogProps, AlertDialogTriggerProps, AlertDialogContentProps, AlertDialogHeaderProps, AlertDialogTitleProps, AlertDialogDescriptionProps, AlertDialogBodyProps, AlertDialogFooterProps, AlertDialogCloseProps, }