mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-13 15:13:07 +00:00
Turn StateSelect and CitySelect into autocomplete comboboxes so long lists no longer bias people toward the top option. A shared FormCombobox wraps shadcn's (Base UI) Combobox and bridges it to react-hook-form via useController, storing the state code / city name while displaying a label. Matching is accent-insensitive and prefix-based; the list opens after 1 character and results are alphabetical. State searches by both full name and initials (new StateNames map). Adds @base-ui/react + shadcn combobox/input-group primitives, and documents our export-const and named-hook-import conventions in the components rule (with the src/components/ui/* shadcn carve-out).
33 lines
688 B
TypeScript
33 lines
688 B
TypeScript
import { CitiesByState } from '@/lib/cities'
|
|
|
|
export type StateKey = keyof typeof CitiesByState
|
|
|
|
export const StateNames: Record<StateKey, string> = {
|
|
AC: 'Acre',
|
|
AL: 'Alagoas',
|
|
AP: 'Amapá',
|
|
AM: 'Amazonas',
|
|
BA: 'Bahia',
|
|
CE: 'Ceará',
|
|
DF: 'Distrito Federal',
|
|
ES: 'Espírito Santo',
|
|
GO: 'Goiás',
|
|
MA: 'Maranhão',
|
|
MT: 'Mato Grosso',
|
|
MS: 'Mato Grosso do Sul',
|
|
MG: 'Minas Gerais',
|
|
PA: 'Pará',
|
|
PB: 'Paraíba',
|
|
PR: 'Paraná',
|
|
PE: 'Pernambuco',
|
|
PI: 'Piauí',
|
|
RJ: 'Rio de Janeiro',
|
|
RN: 'Rio Grande do Norte',
|
|
RS: 'Rio Grande do Sul',
|
|
RO: 'Rondônia',
|
|
RR: 'Roraima',
|
|
SC: 'Santa Catarina',
|
|
SP: 'São Paulo',
|
|
SE: 'Sergipe',
|
|
TO: 'Tocantins',
|
|
}
|