intl-tel-input
Version:
A JavaScript plugin for entering and validating international telephone numbers
98 lines (97 loc) • 7.05 kB
TypeScript
import intlTelInput, { Iti } from "intl-tel-input";
import type { AllOptions } from "intl-tel-input";
import { OnDestroy, ElementRef, EventEmitter, AfterViewInit, OnChanges, SimpleChanges } from "@angular/core";
import { ControlValueAccessor, Validator, AbstractControl, ValidationErrors } from "@angular/forms";
import * as i0 from "@angular/core";
export { intlTelInput };
declare class IntlTelInput implements AfterViewInit, OnDestroy, OnChanges, ControlValueAccessor, Validator {
inputRef: ElementRef<HTMLInputElement>;
/** initialValue is only used during initialization — changes after init are ignored. */
initialValue?: string;
usePreciseValidation: boolean;
inputAttributes: Record<string, string>;
disabled: boolean;
readonly: boolean;
allowDropdown?: AllOptions["allowDropdown"];
allowedNumberTypes?: AllOptions["allowedNumberTypes"];
allowNumberExtensions?: AllOptions["allowNumberExtensions"];
allowPhonewords?: AllOptions["allowPhonewords"];
autoPlaceholder?: AllOptions["autoPlaceholder"];
containerClass?: AllOptions["containerClass"];
countryNameLocale?: AllOptions["countryNameLocale"];
countryOrder?: AllOptions["countryOrder"];
countrySearch?: AllOptions["countrySearch"];
customPlaceholder?: AllOptions["customPlaceholder"];
dropdownAlwaysOpen?: AllOptions["dropdownAlwaysOpen"];
dropdownContainer?: AllOptions["dropdownContainer"];
excludeCountries?: AllOptions["excludeCountries"];
fixDropdownWidth?: AllOptions["fixDropdownWidth"];
formatAsYouType?: AllOptions["formatAsYouType"];
formatOnDisplay?: AllOptions["formatOnDisplay"];
geoIpLookup?: AllOptions["geoIpLookup"];
hiddenInput?: AllOptions["hiddenInput"];
i18n?: AllOptions["i18n"];
initialCountry?: AllOptions["initialCountry"];
loadUtils?: AllOptions["loadUtils"];
nationalMode?: AllOptions["nationalMode"];
onlyCountries?: AllOptions["onlyCountries"];
placeholderNumberType?: AllOptions["placeholderNumberType"];
searchInputClass?: AllOptions["searchInputClass"];
separateDialCode?: AllOptions["separateDialCode"];
showFlags?: AllOptions["showFlags"];
strictMode?: AllOptions["strictMode"];
useFullscreenPopup?: AllOptions["useFullscreenPopup"];
numberChange: EventEmitter<string>;
countryChange: EventEmitter<string>;
validityChange: EventEmitter<boolean>;
errorCodeChange: EventEmitter<number | null>;
blur: EventEmitter<FocusEvent>;
focus: EventEmitter<FocusEvent>;
keydown: EventEmitter<KeyboardEvent>;
keyup: EventEmitter<KeyboardEvent>;
paste: EventEmitter<ClipboardEvent>;
click: EventEmitter<MouseEvent>;
private iti?;
private appliedInputAttrKeys;
private lastEmittedNumber?;
private lastEmittedCountry?;
private lastEmittedValidity?;
private lastEmittedErrorCode?;
private pendingWriteValue?;
private countryChangeHandler;
private onChange;
private onTouched;
private onValidatorChange;
ngAfterViewInit(): void;
private buildInitOptions;
ngOnChanges(changes: SimpleChanges): void;
handleInput(): void;
handleBlur(event: FocusEvent): void;
handleFocus(event: FocusEvent): void;
handleKeyDown(event: KeyboardEvent): void;
handleKeyUp(event: KeyboardEvent): void;
handlePaste(event: ClipboardEvent): void;
handleClick(event: MouseEvent): void;
/**
* This method must be called in `ngAfterViewInit` or later lifecycle hooks,
* not in `ngOnInit` or the `constructor`, as the component needs to be fully initialized.
*/
getInstance(): Iti | undefined;
/**
* This method must be called in `ngAfterViewInit` or later lifecycle hooks,
* not in `ngOnInit` or the `constructor`, as the component needs to be fully initialized.
*/
getInput(): HTMLInputElement;
ngOnDestroy(): void;
private ignoredInputAttrs;
private applyInputAttrs;
writeValue(value: string | null): void;
registerOnChange(fn: any): void;
registerOnTouched(fn: any): void;
setDisabledState(isDisabled: boolean): void;
validate(_control: AbstractControl): ValidationErrors | null;
registerOnValidatorChange(fn: () => void): void;
static ɵfac: i0.ɵɵFactoryDeclaration<IntlTelInput, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<IntlTelInput, "intl-tel-input", never, { "initialValue": { "alias": "initialValue"; "required": false; }; "usePreciseValidation": { "alias": "usePreciseValidation"; "required": false; }; "inputAttributes": { "alias": "inputAttributes"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "allowDropdown": { "alias": "allowDropdown"; "required": false; }; "allowedNumberTypes": { "alias": "allowedNumberTypes"; "required": false; }; "allowNumberExtensions": { "alias": "allowNumberExtensions"; "required": false; }; "allowPhonewords": { "alias": "allowPhonewords"; "required": false; }; "autoPlaceholder": { "alias": "autoPlaceholder"; "required": false; }; "containerClass": { "alias": "containerClass"; "required": false; }; "countryNameLocale": { "alias": "countryNameLocale"; "required": false; }; "countryOrder": { "alias": "countryOrder"; "required": false; }; "countrySearch": { "alias": "countrySearch"; "required": false; }; "customPlaceholder": { "alias": "customPlaceholder"; "required": false; }; "dropdownAlwaysOpen": { "alias": "dropdownAlwaysOpen"; "required": false; }; "dropdownContainer": { "alias": "dropdownContainer"; "required": false; }; "excludeCountries": { "alias": "excludeCountries"; "required": false; }; "fixDropdownWidth": { "alias": "fixDropdownWidth"; "required": false; }; "formatAsYouType": { "alias": "formatAsYouType"; "required": false; }; "formatOnDisplay": { "alias": "formatOnDisplay"; "required": false; }; "geoIpLookup": { "alias": "geoIpLookup"; "required": false; }; "hiddenInput": { "alias": "hiddenInput"; "required": false; }; "i18n": { "alias": "i18n"; "required": false; }; "initialCountry": { "alias": "initialCountry"; "required": false; }; "loadUtils": { "alias": "loadUtils"; "required": false; }; "nationalMode": { "alias": "nationalMode"; "required": false; }; "onlyCountries": { "alias": "onlyCountries"; "required": false; }; "placeholderNumberType": { "alias": "placeholderNumberType"; "required": false; }; "searchInputClass": { "alias": "searchInputClass"; "required": false; }; "separateDialCode": { "alias": "separateDialCode"; "required": false; }; "showFlags": { "alias": "showFlags"; "required": false; }; "strictMode": { "alias": "strictMode"; "required": false; }; "useFullscreenPopup": { "alias": "useFullscreenPopup"; "required": false; }; }, { "numberChange": "numberChange"; "countryChange": "countryChange"; "validityChange": "validityChange"; "errorCodeChange": "errorCodeChange"; "blur": "blur"; "focus": "focus"; "keydown": "keydown"; "keyup": "keyup"; "paste": "paste"; "click": "click"; }, never, never, true, never>;
}
export default IntlTelInput;