import { useState } from 'react' import { Dialog, DialogContent, DialogDescription, 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) => boolean | void | Promise initialName?: string } interface CreateTypeDialogFormProps { initialName: string onClose: () => void onCreate: (name: string) => boolean | void | Promise } function CreateTypeDialogForm({ initialName, onClose, onCreate }: CreateTypeDialogFormProps) { const [name, setName] = useState(initialName) const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() const trimmed = name.trim() if (!trimmed) return const created = await onCreate(trimmed) if (created !== false) onClose() } return (
setName(e.target.value)} onFocus={(e) => e.currentTarget.select()} />

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

) } export function CreateTypeDialog({ open, onClose, onCreate, initialName = '' }: CreateTypeDialogProps) { return ( { if (!isOpen) onClose() }}> Create New Type Create a type document so notes of this type can inherit templates and metadata. ) }