import * as DialogPrimitive from "@radix-ui/react-dialog"; import { IconX } from "@tabler/icons-react"; import * as React from "react"; import { cn } from "../utils.js"; const Dialog = DialogPrimitive.Root; const DialogTrigger = DialogPrimitive.Trigger; const DialogPortal = DialogPrimitive.Portal; const DialogClose = DialogPrimitive.Close; type DialogMotion = "default" | "instant"; interface DialogOverlayProps extends React.ComponentPropsWithoutRef< typeof DialogPrimitive.Overlay > { motion?: DialogMotion; } const DialogOverlay = React.forwardRef< React.ElementRef, DialogOverlayProps >(({ className, motion = "default", ...props }, ref) => ( )); DialogOverlay.displayName = DialogPrimitive.Overlay.displayName; interface DialogContentProps extends React.ComponentPropsWithoutRef< typeof DialogPrimitive.Content > { // When true, the default close button is hidden; the caller is responsible for // providing a dismiss affordance (e.g. a footer Cancel action). hideClose?: boolean; // High-frequency keyboard surfaces can opt out without changing ordinary dialogs. motion?: DialogMotion; container?: React.ComponentPropsWithoutRef< typeof DialogPrimitive.Portal >["container"]; closeLabel?: string; overlayClassName?: string; overlayStyle?: React.CSSProperties; } const DialogContent = React.forwardRef< React.ElementRef, DialogContentProps >( ( { className, children, hideClose, motion = "default", container, closeLabel = "Close", overlayClassName, overlayStyle, ...props }, ref, ) => ( {children} {!hideClose && ( {closeLabel} )} ), ); DialogContent.displayName = DialogPrimitive.Content.displayName; const DialogHeader = ({ className, ...props }: React.HTMLAttributes) => (
); DialogHeader.displayName = "DialogHeader"; const DialogFooter = ({ className, ...props }: React.HTMLAttributes) => (
); DialogFooter.displayName = "DialogFooter"; const DialogTitle = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); DialogTitle.displayName = DialogPrimitive.Title.displayName; const DialogDescription = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); DialogDescription.displayName = DialogPrimitive.Description.displayName; export { Dialog, DialogPortal, DialogOverlay, DialogClose, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, };