import type { CountryCode, PhoneTemplate, CountryFlag } from './templates'; export interface Formatted { readonly text: string; readonly caret: number; readonly countryCode: CountryCode | null; readonly CountryFlag: CountryFlag | null; readonly callingCode: string | null; readonly number: string; readonly template: string; readonly placeholder: string; readonly isValid: boolean; } type Parse = (text: string, caret?: number) => { readonly text: string; readonly caret: number; }; type GetTemplateInfo = (parsedValue: string) => { readonly countryCode: CountryCode | null; readonly CountryFlag: CountryFlag | null; readonly callingCode: string | null; readonly template: string; readonly placeholder: string; readonly regexp: RegExp; }; type Validate = (inputValue: string, template: string) => boolean; type Format = (text: string, caret: number, defaultCountry?: string | null) => Formatted; type ParseAndValidate = (inputValue: string) => boolean; type ParseAndFormat = (inputValue: string, caret?: number) => Formatted; export declare const usePhoneUtils: (params: { templates: readonly PhoneTemplate[]; }) => { /** * Validate parsed phone string by template\ * ```js * // Example: * validateParsedInput('79129876543', '7 (xxx) xxx-xx-xx'); // true * validateParsedInput('79129876', '7 (xxx) xxx-xx-xx'); // false * ``` */ validateParsedInput: Validate; getTemplateInfo: GetTemplateInfo; /** * Parse plain phone string and validate result\ * ```js * // Example: * parseAndValidate('+7 912 659-99-88'); // true * parseAndValidate('+7 912 659-99-'); // false * ``` */ parseAndValidate: ParseAndValidate; parseAndFormat: ParseAndFormat; /** * Format phone string by template\ * ```js * // Example: * format('') * ``` */ formatParsedInput: Format; /** * Parse input phone string\ * ```js * // Example: * const { text, caret } = parseInput('+7 (912', 7); // { '7912', 4 } * ``` */ parseInput: Parse; }; export {};