Skip to content

v5.1.0

Compare
Choose a tag to compare
@viclafouch viclafouch released this 14 Feb 11:42
· 40 commits to master since this release

Fix

Validation phone (matchIsValidTel)

  • #88 : Excluded country numbers continue to be formatted

What changed ?

Previously, matchIsValidTel give you true if your phone number is correct whatever the country. But what if the country of the phone has been excluded to the component?

Example:

import { MuiTelInput } from 'mui-tel-input'

<MuiTelInput excludedCountries={['FR']} />
import { matchIsValidTel } from 'mui-tel-input'

matchIsValidTel('+33626766XXX') // `true` but no, `FR` country has been excluded :(

How to solve it with version >= 5.1.0?

import { matchIsValidTel } from 'mui-tel-input'

matchIsValidTel('+33626766XXX',  { excludedCountries: ['FR'] }) // `false` :)

You can also pass onlyCountries and continents to the second object parameter.

More details:

export declare function matchIsValidTel(text: string, options?: {
    excludedCountries?: MuiTelInputCountry[];
    onlyCountries?: MuiTelInputCountry[];
    continents?: MuiTelInputContinent[];
}): boolean;
  • Fix: #106
  • docs: #126 Add Next.Js instructions to the documentation

Chore

  • Update deps