Package-level declarations

State holders and configuration: CountryPickerConfig (how a picker behaves), CountryPickerState (the sheet's transient state) with rememberCountryPickerState, and PhoneNumberFieldState with rememberPhoneNumberFieldState.

Types

Link copied to clipboard
sealed interface CountryLoadState

How the country list is doing.

Link copied to clipboard
data class CountryPickerConfig(val selectionMode: CountrySelectionMode = CountrySelectionMode.Single, val allowedCountryCodes: Set<String>? = null, val excludedCountryCodes: Set<String> = emptySet(), val disabledCountryCodes: Set<String> = emptySet(), val enabledRegions: Set<CountryRegion> = CountryRegion.entries.toSet(), val initialRegion: CountryRegion? = null, val showRecentlySelected: Boolean = true, val showSuggestedCountries: Boolean = true, val showSearch: Boolean = true, val closeOnSingleSelection: Boolean = true, val minimumSelectionCount: Int = 0, val maximumSelectionCount: Int? = null, val autoConfirmOnMaximum: Boolean = false, val searchFields: Set<CountrySearchField> = CountrySearchField.All, val minimumSearchQueryLength: Int = 1, val suggestedCountryCodes: List<String> = emptyList(), val recentCountryLimit: Int = 5, val countryComparator: Comparator<Country>? = null)

Everything about what a picker offers and how selection behaves, in one value.

Link copied to clipboard

Owns the picker's transient UI state: sheet visibility, search query, region filter, and the pending selection.

Link copied to clipboard
data class CountryQuickPick(val country: Country, val source: QuickPickSource)

A country offered as a one-tap shortcut, and why.

Link copied to clipboard
data class CountrySection(val kind: CountrySectionKind, val items: List<CountryMatch>)

One titled group of countries in the sheet.

Link copied to clipboard

The kinds of section the sheet can show, in the order they appear.

Link copied to clipboard

State for a phone number field: the selected country, the digits typed, and everything derived from them.

Link copied to clipboard

Functions

Link copied to clipboard

Records a confirmed selection into store whenever it changes.

Link copied to clipboard
fun rememberCountryPickerState(config: CountryPickerConfig = CountryPickerConfig(), selectedCountries: Set<Country> = emptySet(), repository: CountryRepository = CountryRepository.Default, recentCountryStore: RecentCountryStore = NoOpRecentCountryStore, detector: CountryDetector? = null, detectionBehavior: CountryDetectionBehavior = CountryDetectionBehavior.ShowBadge, onDetectedCountry: (Country) -> Unit = {}): CountryPickerState

Creates and remembers a CountryPickerState, wiring data loading, restoration, country detection and the recents store.

Link copied to clipboard
fun rememberPhoneNumberFieldState(initialCountry: Country, initialNumber: String = "", enforceMaxLength: Boolean = true, allowedNumberTypes: Set<PhoneNumberType> = emptySet()): PhoneNumberFieldState

Remembers a PhoneNumberFieldState, restoring the country and digits across configuration change and process death.