import { useState } from 'react' import Input from '@/components/ui/Input' import Button from '@/components/ui/Button' import Badge from '@/components/ui/Badge' export interface FreeTextPathologyInputProps { items: string[] onChange: (next: string[]) => void } export default function FreeTextPathologyInput({ items, onChange, }: FreeTextPathologyInputProps) { const [v, setV] = useState('') function add() { const trimmed = v.trim() if (!trimmed) return onChange([...items, trimmed]) setV('') } function remove(i: number) { onChange(items.filter((_, k) => k !== i)) } return (
setV(e.target.value)} placeholder="Pathologie additionnelle (texte libre)" onKeyDown={(e) => { if (e.key === 'Enter') { e.preventDefault(); add() } }} aria-label="Pathologie libre" />
{items.length > 0 && ( )}
) }