import React from 'react'; import { Dialog, DialogContent, DialogHeader, DialogTitle } from '../components/Dialog/Dialog'; import { cn } from '../lib/utils'; export interface ManagedDialogProps { id: string; isOpen?: boolean; title?: string; description?: string; content: React.ComponentType<{ hide?: () => void }>; contentProps?: Record; isDraggable?: boolean; shouldCloseOnEsc?: boolean; shouldCloseOnOverlayClick?: boolean; defaultPosition?: { x: number; y: number }; onClose?: (id: string) => void; unstyled?: boolean; showOverlay?: boolean; containerClassName?: string; } const ManagedDialog: React.FC = ({ id, isOpen, title, content: DialogContentComponent, contentProps, isDraggable, shouldCloseOnEsc = false, shouldCloseOnOverlayClick = false, showOverlay = true, defaultPosition, onClose, unstyled, containerClassName, }) => { return ( { if (!open) { onClose(id); } }} isDraggable={isDraggable} shouldCloseOnEsc={shouldCloseOnEsc} shouldCloseOnOverlayClick={shouldCloseOnOverlayClick} showOverlay={showOverlay} > {!unstyled && {title && {title}}} onClose(id)} /> ); }; export default ManagedDialog;