feat(wizard): ciudad-select filtra por departamento desde geo json [4F]

- CiudadSelectField: autocomplete sobre Object.keys(geoData[depto]),
  mismo patrón que BarrioAutocompleteField (position:fixed, getBoundingClientRect,
  scroll listener, teclado ARIA). Reutiliza clases CSS .barrio-autocomplete-*.
- Limpia el valor de 2.2 via useEffect cuando cambia departamento (2.1),
  usando un ref estable para onChange para evitar dep cíclica.
- QuestionRenderer: branch code==='2.2' dentro del bloque single_choice;
  pasa answers['2.1:default'] como prop departamento.
- Sin cambios al seed, form-engine ni RPCs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
markosbenitez
2026-06-26 20:07:16 -03:00
parent 6e9ad89f7b
commit 3e7109a0f1
2 changed files with 182 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ import { CheckboxGroup } from './widgets/checkbox-group'
import { TextAreaField } from './widgets/text-area-field'
import { TextShortField } from './widgets/text-short-field'
import { BarrioAutocompleteField } from './widgets/barrio-autocomplete-field'
import { CiudadSelectField } from './widgets/ciudad-select-field'
interface QuestionRendererProps {
question: Question
@@ -28,6 +29,19 @@ export function QuestionRenderer({ question, value, onChange, error, answers }:
)
if (type === 'single_choice' && options) {
if (code === '2.2') {
return (
<CiudadSelectField
name={code}
label={legend}
value={(value as string) ?? ''}
required={required}
departamento={(answers?.['2.1:default'] as string) ?? null}
onChange={onChange}
error={error}
/>
)
}
return (
<RadioGroup
name={code}