import { useState } from 'react'; import { useForm } from '../../context/FormContext'; import { Plus } from 'lucide-react'; export default function FillBlank({ field, sectionId }) { const { formState, toggleOption, addCustomOption } = useForm(); const [customInput, setCustomInput] = useState(''); const fieldState = formState.sections[sectionId]?.[field.id] || { selected: [], customOptions: [] }; const allOptions = [...(field.options || []), ...(fieldState.customOptions || [])]; const selected = fieldState.selected || []; const filledSentence = field.sentence?.replace( /____________/g, selected.length > 0 ? selected.join(' / ') : '____________' ); const handleAddCustom = () => { if (customInput.trim()) { addCustomOption(sectionId, field.id, customInput.trim()); setCustomInput(''); } }; const handleKeyDown = (e) => { if (e.key === 'Enter') { e.preventDefault(); handleAddCustom(); } }; return (