UNPKG

@wulperstudio/cms

Version:
32 lines (31 loc) 1.27 kB
import React from 'react'; import { InputPhoneContinentType, InputPhoneCountry } from '../constants'; import { InputPhoneInfo } from '../InputPhone.types'; type UsePhoneDigitsParams = { value: string; onChange?: (value: string, info: InputPhoneInfo) => void; defaultCountry?: InputPhoneCountry; forceCallingCode?: boolean; disableFormatting?: boolean; excludedCountries?: InputPhoneCountry[]; onlyCountries?: InputPhoneCountry[]; continents?: InputPhoneContinentType[]; }; type State = { inputValue: string; isoCode: InputPhoneCountry | null; }; type GetInitialStateParams = { defaultCountry?: InputPhoneCountry; initialValue: string; disableFormatting?: boolean; }; export declare function getInitialState(params: GetInitialStateParams): State; export declare function usePhoneDigits({ value, onChange, defaultCountry, forceCallingCode, onlyCountries, excludedCountries, continents, disableFormatting, }: UsePhoneDigitsParams): { inputValue: string; isoCode: import("libphonenumber-js/types").CountryCode | null; onInputChange: (event: React.ChangeEvent<HTMLInputElement>) => void; onCountryChange: (newCountry: InputPhoneCountry) => void; inputRef: React.RefObject<HTMLInputElement>; }; export {};