import * as React from "react"; import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"; import { cva, type VariantProps } from "class-variance-authority"; import { cn } from "@/lib/utils"; import { buttonVariants } from "@/components/ui/button"; const AlertDialog = AlertDialogPrimitive.Root; const AlertDialogTrigger = AlertDialogPrimitive.Trigger; const AlertDialogPortal = AlertDialogPrimitive.Portal; const AlertDialogOverlay = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName; const AlertDialogContent = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { portalProps?: AlertDialogPrimitive.AlertDialogPortalProps; } >(({ className, portalProps, ...props }, ref) => ( )); AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName; const AlertDialogHeader = ({ className, ...props }: React.HTMLAttributes) => (
); AlertDialogHeader.displayName = "AlertDialogHeader"; const alertDialogFooterVariants = cva( "flex flex-col-reverse gap-2 sm:flex-row", { variants: { variant: { // 1-2 action buttons: full-width stacked on mobile, right-aligned auto on desktop. // [&>button] only targets real button children, so non-button siblings are untouched. actions: "sm:justify-end [&>button]:w-full sm:[&>button]:w-auto", // context content (text/popover) alongside actions: space-between on desktop. // flex-col (not -reverse) keeps the context above the buttons when stacked on mobile. split: "flex-col sm:items-center sm:justify-between", // alignment only; never touches children. Escape hatch for unusual content. plain: "sm:justify-end", }, }, defaultVariants: { variant: "actions", }, }, ); const AlertDialogFooter = ({ className, variant, ...props }: React.HTMLAttributes & VariantProps) => (
); AlertDialogFooter.displayName = "AlertDialogFooter"; const AlertDialogTitle = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName; const AlertDialogDescription = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName; const AlertDialogAction = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName; const AlertDialogCancel = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName; export { AlertDialog, AlertDialogPortal, AlertDialogOverlay, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel, };