import { useState, useRef, useEffect } from 'react' import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' interface CreateTypeDialogProps { open: boolean onClose: () => void onCreate: (name: string) => void } export function CreateTypeDialog({ open, onClose, onCreate }: CreateTypeDialogProps) { const [name, setName] = useState('') const inputRef = useRef(null) useEffect(() => { if (open) { setName('') // eslint-disable-line react-hooks/set-state-in-effect -- reset on dialog open setTimeout(() => inputRef.current?.focus(), 50) } }, [open]) const handleSubmit = (e: React.FormEvent) => { e.preventDefault() const trimmed = name.trim() if (!trimmed) return onCreate(trimmed) onClose() } return ( { if (!isOpen) onClose() }}> Create New Type
setName(e.target.value)} />

Creates a type document. Its properties become defaults for new docs of this type.

) }