/** * createCountryInput - the HEADLESS core behind : a searchable * country picker (search by name, dial code, or ISO code; roving active index + * keyboard) that emits the ISO 3166-1 alpha-2 code. Exposed as **prop-getters** * you spread onto YOUR OWN markup. No styles/DOM/portal - those stay in the * styled component. * * ```svelte * * * {#if ci.open} * * * {/if} * ``` */ import { type Country } from './countries'; /** Reactive inputs are passed as getters so the core tracks live prop changes. */ export type CountryInputConfig = { value: () => string | null; onChange?: (code: string) => void; disabled?: () => boolean; ariaLabel?: () => string | undefined; /** Accessible label for the in-panel search field (localizable). */ searchLabel?: () => string | undefined; /** DOM focus hook provided by the renderer; the core never touches the DOM. */ focusTrigger?: () => void; id?: () => string | undefined; invalid?: () => boolean; required?: () => boolean; error?: () => string | undefined; hint?: () => string | undefined; }; export declare function createCountryInput(config: CountryInputConfig): { /** Panel open state. */ readonly open: boolean; /** Highlighted country index into `filtered`. */ readonly activeIndex: number; /** Current search query. */ readonly query: string; /** Countries after the current search filter. */ readonly filtered: Country[]; /** The selected country, if any. */ readonly selected: Country | null; /** Controlled value (ISO alpha-2 code). */ readonly value: string | null; isActive: (i: number) => boolean; isSelected: (code: string) => boolean; setActive: (i: number) => void; setQuery: (v: string) => void; openPanel: () => void; close: () => void; toggle: () => void; pick: (code: string) => void; onKeydown: (e: KeyboardEvent) => void; /** Spread onto the trigger