import { useRef, useEffect, type ReactNode } from 'react'; export function Dialog({ id, label, close, children, ownClose = false, }: { id: string; label: string; close: () => void; children: ReactNode; ownClose?: boolean; }) { const ref = useRef(null); useEffect(() => { const node = ref.current!; node.showModal(); return () => node.close(); }, []); return ( { event.preventDefault(); close(); }} > {!ownClose && ( )} {children} ); }