'use client'
import { DEPARTMENTS, getCities } from '@/lib/paraguay-geo'
interface GeoSelectWidgetProps {
departmentValue: string
cityValue: string
onDepartmentChange: (value: string) => void
onCityChange: (value: string) => void
departmentError?: string
cityError?: string
}
export function GeoSelectWidget({
departmentValue,
cityValue,
onDepartmentChange,
onCityChange,
departmentError,
cityError,
}: GeoSelectWidgetProps) {
const cities = departmentValue ? getCities(departmentValue) : []
const cityDisabled = !departmentValue
function handleDepartmentChange(val: string) {
onDepartmentChange(val)
onCityChange('') // limpiar ciudad al cambiar departamento
}
return (
{/* Departamento */}
{departmentError && (
{departmentError}
)}
{/* Ciudad */}
{cityError && (
{cityError}
)}
)
}