import * as React from "react"; import { X } from "lucide-react"; export interface DialogProps { open?: boolean; onOpenChange?: (open: boolean) => void; children?: React.ReactNode; } export interface DialogTriggerProps { children?: React.ReactNode; asChild?: boolean; } export interface DialogContentProps { children?: React.ReactNode; className?: string; } export interface DialogHeaderProps { children?: React.ReactNode; className?: string; } export interface DialogFooterProps { children?: React.ReactNode; className?: string; } export interface DialogTitleProps { children?: React.ReactNode; className?: string; } export interface DialogDescriptionProps { children?: React.ReactNode; className?: string; } const DialogContext = React.createContext<{ open?: boolean; onOpenChange?: (open: boolean) => void; }>({}); export function Dialog({ open, onOpenChange, children }: DialogProps): React.JSX.Element { const contextValue: { open?: boolean; onOpenChange?: (open: boolean) => void } = {}; if (open !== undefined) { contextValue.open = open; } if (onOpenChange !== undefined) { contextValue.onOpenChange = onOpenChange; } return {children}; } export function DialogTrigger({ children, asChild }: DialogTriggerProps): React.JSX.Element { const { onOpenChange } = React.useContext(DialogContext); if (asChild && React.isValidElement(children)) { return React.cloneElement(children, { onClick: () => onOpenChange?.(true), } as React.HTMLAttributes); } return
onOpenChange?.(true)}>{children}
; } export function DialogContent({ children, className = "", }: DialogContentProps): React.JSX.Element | null { const { open, onOpenChange } = React.useContext(DialogContext); if (!open) return null; return (
{/* Overlay */}
onOpenChange?.(false)} /> {/* Dialog Content */}
{/* Close Button */} {children}
); } export function DialogHeader({ children, className = "" }: DialogHeaderProps): React.JSX.Element { return
{children}
; } export function DialogFooter({ children, className = "" }: DialogFooterProps): React.JSX.Element { return
{children}
; } export function DialogTitle({ children, className = "" }: DialogTitleProps): React.JSX.Element { return

{children}

; } export function DialogDescription({ children, className = "", }: DialogDescriptionProps): React.JSX.Element { return

{children}

; } export const DialogPortal = ({ children }: { children: React.ReactNode }): React.JSX.Element => ( <>{children} ); export const DialogOverlay = ({ children }: { children: React.ReactNode }): React.JSX.Element => ( <>{children} ); export const DialogClose = ({ children }: { children: React.ReactNode }): React.JSX.Element => ( <>{children} );