teqo-backup/src/lib/states.ts
Francisco Ignácio Fontoura Solla 712649eecf Replace state/city selects with type-to-filter comboboxes
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).
2026-07-15 14:41:58 -03:00

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',
}