import * as React from 'react'; import { createPortal } from 'react-dom'; import { X } from 'lucide-react'; import { cn } from '@/lib/utils'; type DialogSize = 'standard' | 'form' | 'destructive'; interface DialogContextValue { open: boolean; onOpenChange: (open: boolean) => void; size: DialogSize; } const DialogContext = React.createContext(undefined); function useDialog() { const ctx = React.useContext(DialogContext); if (!ctx) throw new Error('useDialog must be used within a Dialog'); return ctx; } interface DialogProps { open?: boolean; onOpenChange?: (open: boolean) => void; size?: DialogSize; children: React.ReactNode; } const Dialog: React.FC = ({ open = false, onOpenChange, size = 'standard', children }) => ( {}), size }}> {children} ); const DialogTrigger = React.forwardRef>( ({ onClick, ...props }, ref) => { const { onOpenChange } = useDialog(); return ( , document.body, ); } ); DialogContent.displayName = 'DialogContent'; const DialogHeader: React.FC> = ({ className, ...props }) => (
); DialogHeader.displayName = 'DialogHeader'; const DialogBody: React.FC> = ({ className, ...props }) => (
); DialogBody.displayName = 'DialogBody'; const DialogFooter: React.FC> = ({ className, ...props }) => (
); DialogFooter.displayName = 'DialogFooter'; const DialogTitleText = React.forwardRef>( ({ className, ...props }, ref) => (

) ); DialogTitleText.displayName = 'DialogTitle'; const DialogDescription = React.forwardRef>( ({ className, ...props }, ref) => (

) ); DialogDescription.displayName = 'DialogDescription'; export { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogBody, DialogFooter, DialogTitleText as DialogTitle, DialogDescription, };