Skip to content

v2.1.0: PhoneInput full country list, preferred countries and E.164 validation

Latest

Choose a tag to compare

@sapatmohit sapatmohit released this 04 Dec 12:45
27c4d25

No breaking prop changes. PhoneInput's default list grows from 50 to ~244 countries, and the English names in the exported COUNTRIES now come from Intl.DisplayNames, so a few differ from before (e.g. TR is now "Türkiye") and wording can vary slightly between browsers. If you need a short, fixed list, pass countries.

Added

  • PhoneInput: every ITU-T E.164 country (~244 entries). Flags are derived from the ISO code and English names from Intl.DisplayNames, so neither is stored in the bundle. The original 50 keep their order at the top. (#95, @ujwalbajaj)
  • PhoneInput: preferredCountries pins countries above a divider (style it with classNames.preferredDivider). They are added even when missing from countries. (#95)
  • PhoneInput: countries and preferredCountries accept bare ISO codes ("IN") as well as Country objects. Unknown codes are dropped. (#95)
  • PhoneInput: opt-in basic E.164 validation. validate marks a malformed non-empty number aria-invalid, and onValidityChange(valid, e164) reports validity and the normalized number. No new dependency. (#95)
<PhoneInput
  countries={["IN", "US", "GB", "LK"]}
  preferredCountries={["IN", "GB"]}
  validate
  onValidityChange={(valid, e164) => setE164(valid ? e164 : "")}
/>

Fixed

  • PhoneInput: country search ignores accents and curly apostrophes, and matches common former names ("turkey", "ivory coast", "czech republic", "swaziland"), including under a non-English displayLocale. Hong Kong and Macao keep their short names. (#105)
  • PhoneInput: the preferred-countries divider is placed correctly when a Country in preferredCountries uses a lowercase code. (#105)

Docs

  • Landing page and docs in Spanish, Japanese and Arabic, translated with Babelize, with a language dropdown. (#97, #98, #99, #100, #101)
  • Translated metadata, hreflang links and a sitemap for every language. (#102)
  • Docs UI text and search follow the page's language. (#103)

Full changelog: v2.0.2...v2.1.0