'use client' import * as React from 'react' import { cn } from '../../lib/utils' export interface CreateListDialogProps { open: boolean onClose: () => void onSubmit: (data: { name: string; description: string; sourceType: string }) => void isSubmitting?: boolean sourceTypes?: Array<{ value: string; label: string }> } const defaultSourceTypes = [ { value: 'static', label: 'Static' }, { value: 'funnel', label: 'Funnel' }, { value: 'query', label: 'Query' }, ] export function CreateListDialog({ open, onClose, onSubmit, isSubmitting = false, sourceTypes = defaultSourceTypes, }: CreateListDialogProps) { const [name, setName] = React.useState('') const [description, setDescription] = React.useState('') const [sourceType, setSourceType] = React.useState(sourceTypes[0]?.value ?? 'static') React.useEffect(() => { if (open) { setName('') setDescription('') setSourceType(sourceTypes[0]?.value ?? 'static') } }, [open, sourceTypes]) const handleSubmit = (e: React.FormEvent) => { e.preventDefault() if (!name.trim()) return onSubmit({ name: name.trim(), description: description.trim(), sourceType }) } if (!open) return null return (