import React from "react"; import { X } from "lucide-react"; import { Button } from "./button"; interface DialogProps { open: boolean; onOpenChange: (open: boolean) => void; children: React.ReactNode; } interface DialogContentProps { children: React.ReactNode; className?: string; } interface DialogHeaderProps { children: React.ReactNode; className?: string; } interface DialogTitleProps { children: React.ReactNode; className?: string; } interface DialogDescriptionProps { children: React.ReactNode; className?: string; } interface DialogFooterProps { children: React.ReactNode; } export function Dialog({ open, onOpenChange, children }: DialogProps) { if (!open) return null; const handleBackdropClick = () => { // Close the modal when backdrop is clicked onOpenChange(false); }; const handleContentClick = (e: React.MouseEvent) => { // Stop any clicks inside the content from bubbling to backdrop e.stopPropagation(); }; const handleContentMouseDown = (e: React.MouseEvent) => { // Prevent mousedown from bubbling during text selection e.stopPropagation(); }; return (
{/* Backdrop - handles clicks to close */}
{/* Modal content - positioned above backdrop with z-index */}
e.stopPropagation()} > {children}
); } export function DialogContent({ children, className = "", }: DialogContentProps) { // Default width classes if none provided const hasWidthClass = className.includes('w-[') || className.includes('w-full') || className.includes('max-w-'); const defaultWidthClasses = hasWidthClass ? '' : 'max-w-lg w-full'; return (
{children}
); } export function DialogHeader({ children, className = "" }: DialogHeaderProps) { return (
{children}
); } export function DialogTitle({ children, className = "" }: DialogTitleProps) { return

{children}

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

{children}

; } export function DialogClose({ onClose }: { onClose: () => void }) { return ( ); } export function DialogFooter({ children }: DialogFooterProps) { return (
{children}
); }