intl-tel-input 25.14.0 → 25.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +5 -5
  2. package/angular/README.md +1 -1
  3. package/angular/build/IntlTelInput.js +1 -1
  4. package/angular/build/IntlTelInputWithUtils.js +1 -1
  5. package/build/css/intlTelInput-no-assets.css +1259 -0
  6. package/build/css/intlTelInput-no-assets.min.css +1 -0
  7. package/build/css/intlTelInput.css +6 -4
  8. package/build/css/intlTelInput.min.css +1 -1
  9. package/build/js/data.js +1 -1
  10. package/build/js/data.min.js +1 -1
  11. package/build/js/intlTelInput.js +2 -2
  12. package/build/js/intlTelInput.min.js +2 -2
  13. package/build/js/intlTelInputWithUtils.js +2 -2
  14. package/build/js/intlTelInputWithUtils.min.js +2 -2
  15. package/package.json +1 -1
  16. package/react/README.md +1 -1
  17. package/react/build/IntlTelInput.cjs +1 -1
  18. package/react/build/IntlTelInput.js +1 -1
  19. package/react/build/IntlTelInputWithUtils.cjs +1 -1
  20. package/react/build/IntlTelInputWithUtils.js +1 -1
  21. package/svelte/README.md +1 -1
  22. package/svelte/build/IntlTelInput.mjs +1 -1
  23. package/svelte/build/IntlTelInputWithUtils.mjs +1 -1
  24. package/vue/README.md +1 -1
  25. package/vue/build/IntlTelInput.mjs +1 -1
  26. package/vue/build/IntlTelInput.vue.d.ts +34 -0
  27. package/vue/build/IntlTelInputWithUtils.mjs +1 -1
  28. package/vue/build/IntlTelInputWithUtils.vue.d.ts +34 -0
  29. package/vue/build/exports/IntlTelInput.d.ts +3 -0
  30. package/vue/build/exports/IntlTelInput.mjs +66 -0
  31. package/vue/build/exports/IntlTelInputWithUtils.d.ts +3 -0
  32. package/vue/build/exports/IntlTelInputWithUtils.mjs +6207 -0
  33. package/vue/build/intl-tel-input-Db39yQmC.mjs +3083 -0
  34. package/vue/build/intl-tel-input.d.ts +97 -0
  35. package/vue/build/modules/constants.d.ts +85 -0
  36. package/vue/build/modules/core/countrySearch.d.ts +17 -0
  37. package/vue/build/modules/core/icons.d.ts +9 -0
  38. package/vue/build/modules/core/options.d.ts +3 -0
  39. package/vue/build/modules/core/ui.d.ts +46 -0
  40. package/vue/build/modules/data/country-data.d.ts +12 -0
  41. package/vue/build/modules/data/nanp-regionless.d.ts +2 -0
  42. package/vue/build/modules/format/caret.d.ts +1 -0
  43. package/vue/build/modules/format/formatting.d.ts +3 -0
  44. package/vue/build/modules/types/events.d.ts +9 -0
  45. package/vue/build/modules/types/public-api.d.ts +78 -0
  46. package/vue/build/modules/utils/dom.d.ts +6 -0
  47. package/vue/build/modules/utils/string.d.ts +2 -0
@@ -0,0 +1,97 @@
1
+ import { Iso2 } from './intl-tel-input/data';
2
+ import { NumberType, SomeOptions, IntlTelInputInterface, SelectedCountryData } from './modules/types/public-api';
3
+ declare global {
4
+ interface HTMLInputElement {
5
+ iti?: Iti;
6
+ }
7
+ }
8
+ export declare class Iti {
9
+ readonly id: number;
10
+ readonly promise: Promise<[unknown, unknown]>;
11
+ private readonly ui;
12
+ private readonly options;
13
+ private readonly isAndroid;
14
+ private readonly countries;
15
+ private readonly dialCodeMaxLen;
16
+ private readonly dialCodeToIso2Map;
17
+ private readonly dialCodes;
18
+ private readonly countryByIso2;
19
+ private selectedCountryData;
20
+ private maxCoreNumberLength;
21
+ private defaultCountry;
22
+ private abortController;
23
+ private dropdownAbortController;
24
+ private userNumeralSet;
25
+ private resolveAutoCountryPromise;
26
+ private rejectAutoCountryPromise;
27
+ private resolveUtilsScriptPromise;
28
+ private rejectUtilsScriptPromise;
29
+ constructor(input: HTMLInputElement, customOptions?: SomeOptions);
30
+ private static _getIsAndroid;
31
+ private _updateNumeralSet;
32
+ private _mapAsciiToUserNumerals;
33
+ private _normaliseNumerals;
34
+ private _getTelInputValue;
35
+ private _setTelInputValue;
36
+ private _createInitPromises;
37
+ _init(): void;
38
+ private _processCountryData;
39
+ private _setInitialState;
40
+ private _initListeners;
41
+ private _initHiddenInputListener;
42
+ private _initDropdownListeners;
43
+ private _initRequests;
44
+ private _loadAutoCountry;
45
+ private _openDropdownWithPlus;
46
+ private _initTelInputListeners;
47
+ private _bindInputListener;
48
+ private _maybeBindKeydownListener;
49
+ private _maybeBindPasteListener;
50
+ private _cap;
51
+ private _trigger;
52
+ private _openDropdown;
53
+ private _setDropdownPosition;
54
+ private _bindDropdownListeners;
55
+ private _bindDropdownMouseoverListener;
56
+ private _bindDropdownCountryClickListener;
57
+ private _bindDropdownClickOffListener;
58
+ private _bindDropdownKeydownListener;
59
+ private _bindDropdownSearchListeners;
60
+ private _searchForCountry;
61
+ private _filterCountriesByQuery;
62
+ private _handleUpDownKey;
63
+ private _handleEnterKey;
64
+ private _updateValFromNumber;
65
+ private _updateCountryFromNumber;
66
+ private _ensureHasDialCode;
67
+ private _getNewCountryFromNumber;
68
+ private _setCountry;
69
+ private _updateMaxLength;
70
+ private _updatePlaceholder;
71
+ private _selectListItem;
72
+ private _closeDropdown;
73
+ private _updateDialCode;
74
+ private _getDialCode;
75
+ private _getFullNumber;
76
+ private _beforeSetNumber;
77
+ private _triggerCountryChange;
78
+ handleAutoCountry(): void;
79
+ handleUtils(): void;
80
+ destroy(): void;
81
+ getExtension(): string;
82
+ getNumber(format?: number): string;
83
+ getNumberType(): number;
84
+ getSelectedCountryData(): SelectedCountryData;
85
+ getValidationError(): number;
86
+ isValidNumber(): boolean | null;
87
+ isValidNumberPrecise(): boolean | null;
88
+ private _utilsIsPossibleNumber;
89
+ private _validateNumber;
90
+ private _utilsIsValidNumber;
91
+ setCountry(iso2: Iso2): void;
92
+ setNumber(number: string): void;
93
+ setPlaceholderNumberType(type: NumberType): void;
94
+ setDisabled(disabled: boolean): void;
95
+ }
96
+ declare const intlTelInput: IntlTelInputInterface;
97
+ export default intlTelInput;
@@ -0,0 +1,85 @@
1
+ import { Iso2 } from '../intl-tel-input/data';
2
+ export declare const EVENTS: {
3
+ readonly OPEN_COUNTRY_DROPDOWN: "open:countrydropdown";
4
+ readonly CLOSE_COUNTRY_DROPDOWN: "close:countrydropdown";
5
+ readonly COUNTRY_CHANGE: "countrychange";
6
+ readonly INPUT: "input";
7
+ };
8
+ export declare const CLASSES: {
9
+ readonly HIDE: "iti__hide";
10
+ readonly V_HIDE: "iti__v-hide";
11
+ readonly ARROW_UP: "iti__arrow--up";
12
+ readonly GLOBE: "iti__globe";
13
+ readonly FLAG: "iti__flag";
14
+ readonly COUNTRY_ITEM: "iti__country";
15
+ readonly HIGHLIGHT: "iti__highlight";
16
+ };
17
+ export declare const KEYS: {
18
+ readonly ARROW_UP: "ArrowUp";
19
+ readonly ARROW_DOWN: "ArrowDown";
20
+ readonly SPACE: " ";
21
+ readonly ENTER: "Enter";
22
+ readonly ESC: "Escape";
23
+ readonly TAB: "Tab";
24
+ };
25
+ export declare const INPUT_TYPES: {
26
+ readonly PASTE: "insertFromPaste";
27
+ readonly DELETE_FWD: "deleteContentForward";
28
+ };
29
+ export declare const REGEX: {
30
+ readonly ALPHA_UNICODE: RegExp;
31
+ readonly NON_PLUS_NUMERIC: RegExp;
32
+ readonly NON_PLUS_NUMERIC_GLOBAL: RegExp;
33
+ readonly HIDDEN_SEARCH_CHAR: RegExp;
34
+ };
35
+ export declare const TIMINGS: {
36
+ readonly SEARCH_DEBOUNCE_MS: 100;
37
+ readonly HIDDEN_SEARCH_RESET_MS: 1000;
38
+ readonly NEXT_TICK: 0;
39
+ };
40
+ export declare const SENTINELS: {
41
+ readonly UNKNOWN_NUMBER_TYPE: -99;
42
+ readonly UNKNOWN_VALIDATION_ERROR: -99;
43
+ };
44
+ export declare const LAYOUT: {
45
+ readonly SANE_SELECTED_WITH_DIAL_WIDTH: 78;
46
+ readonly SANE_SELECTED_NO_DIAL_WIDTH: 42;
47
+ readonly INPUT_PADDING_EXTRA_LEFT: 6;
48
+ };
49
+ export declare const DIAL: {
50
+ readonly PLUS: "+";
51
+ readonly NANP: "1";
52
+ };
53
+ export declare const UK: {
54
+ readonly ISO2: Iso2;
55
+ readonly DIAL_CODE: "44";
56
+ readonly MOBILE_PREFIX: "7";
57
+ readonly MOBILE_CORE_LENGTH: 10;
58
+ };
59
+ export declare const US: {
60
+ ISO2: Iso2;
61
+ DIAL_CODE: string;
62
+ };
63
+ export declare const PLACEHOLDER_MODES: {
64
+ readonly AGGRESSIVE: "aggressive";
65
+ readonly POLITE: "polite";
66
+ readonly OFF: "off";
67
+ };
68
+ export declare const INITIAL_COUNTRY: {
69
+ readonly AUTO: "auto";
70
+ };
71
+ export declare const DATA_KEYS: {
72
+ readonly COUNTRY_CODE: "countryCode";
73
+ readonly DIAL_CODE: "dialCode";
74
+ };
75
+ export declare const ARIA: {
76
+ readonly EXPANDED: "aria-expanded";
77
+ readonly LABEL: "aria-label";
78
+ readonly SELECTED: "aria-selected";
79
+ readonly ACTIVE_DESCENDANT: "aria-activedescendant";
80
+ readonly HASPOPUP: "aria-haspopup";
81
+ readonly CONTROLS: "aria-controls";
82
+ readonly HIDDEN: "aria-hidden";
83
+ readonly AUTOCOMPLETE: "aria-autocomplete";
84
+ readonly MODAL: "aria-modal";
85
+ };
@@ -0,0 +1,17 @@
1
+ import { Country } from '../../intl-tel-input/data';
2
+ /**
3
+ * Country search: Given raw query, return ordered list of countries by priority buckets.
4
+ * Buckets (in order):
5
+ * 1. exact ISO2 matches
6
+ * 2. name starts with
7
+ * 3. name contains
8
+ * 4. dial code exact match (bare or with plus)
9
+ * 5. dial code contains (with plus form)
10
+ * 6. initials match
11
+ * Each bucket preserves country.priority ordering.
12
+ */
13
+ export declare const getMatchedCountries: (countries: Country[], query: string) => Country[];
14
+ /**
15
+ * Hidden search (when countrySearch disabled): find first whose name starts with query (case-insensitive).
16
+ */
17
+ export declare const findFirstCountryStartingWith: (countries: Country[], query: string) => Country | null;
@@ -0,0 +1,9 @@
1
+ /** Magnifying glass search icon */
2
+ export declare const buildSearchIcon: () => string;
3
+ /**
4
+ * Clear (circle with X) icon
5
+ * @param id Instance id used to create a unique mask id.
6
+ */
7
+ export declare const buildClearIcon: (id: number) => string;
8
+ /** Globe icon used when no country is selected */
9
+ export declare const buildGlobeIcon: () => string;
@@ -0,0 +1,3 @@
1
+ import { AllOptions } from '../types/public-api';
2
+ export declare const defaults: AllOptions;
3
+ export declare const applyOptionSideEffects: (o: AllOptions) => void;
@@ -0,0 +1,46 @@
1
+ import { Country, Iso2 } from '../../intl-tel-input/data';
2
+ import { AllOptions } from '../types/public-api';
3
+ export default class UI {
4
+ private readonly options;
5
+ private readonly id;
6
+ private readonly isRTL;
7
+ private readonly originalPaddingLeft;
8
+ private countries;
9
+ telInput: HTMLInputElement;
10
+ countryContainer: HTMLElement;
11
+ selectedCountry: HTMLElement;
12
+ selectedCountryInner: HTMLElement;
13
+ selectedDialCode: HTMLElement;
14
+ dropdownArrow: HTMLElement;
15
+ dropdownContent: HTMLElement;
16
+ searchInput: HTMLInputElement;
17
+ searchIcon: HTMLElement;
18
+ searchClearButton: HTMLButtonElement;
19
+ searchNoResults: HTMLElement;
20
+ searchResultsA11yText: HTMLElement;
21
+ countryList: HTMLElement;
22
+ dropdown: HTMLElement;
23
+ hiddenInput: HTMLInputElement;
24
+ hiddenInputCountry: HTMLInputElement;
25
+ highlightedItem: HTMLElement | null;
26
+ selectedItem: HTMLElement | null;
27
+ readonly hadInitialPlaceholder: boolean;
28
+ constructor(input: HTMLInputElement, options: AllOptions, id: number);
29
+ generateMarkup(countries: Country[]): void;
30
+ private _prepareTelInput;
31
+ private _createWrapperAndInsert;
32
+ private _maybeBuildCountryContainer;
33
+ private _buildDropdownContent;
34
+ private _buildSearchUI;
35
+ private _maybeUpdateInputPaddingAndReveal;
36
+ private _maybeBuildHiddenInputs;
37
+ private _appendListItems;
38
+ updateInputPadding(): void;
39
+ private _getHiddenSelectedCountryWidth;
40
+ updateSearchResultsA11yText(): void;
41
+ scrollTo(element: HTMLElement): void;
42
+ highlightListItem(listItem: HTMLElement | null, shouldFocus: boolean): void;
43
+ updateSelectedItem(iso2: Iso2 | ""): void;
44
+ filterCountries(matchedCountries: Country[]): void;
45
+ destroy(): void;
46
+ }
@@ -0,0 +1,12 @@
1
+ import { Country, Iso2 } from '../../intl-tel-input/data';
2
+ import { AllOptions } from '../types/public-api';
3
+ export interface DialCodeProcessingResult {
4
+ dialCodes: Set<string>;
5
+ dialCodeMaxLen: number;
6
+ dialCodeToIso2Map: Record<string, Iso2[]>;
7
+ }
8
+ export declare const processAllCountries: (options: AllOptions) => Country[];
9
+ export declare const generateCountryNames: (countries: Country[], options: AllOptions) => void;
10
+ export declare const processDialCodes: (countries: Country[]) => DialCodeProcessingResult;
11
+ export declare const sortCountries: (countries: Country[], options: AllOptions) => void;
12
+ export declare const cacheSearchTokens: (countries: Country[]) => void;
@@ -0,0 +1,2 @@
1
+ export declare const regionlessNanpNumbers: string[];
2
+ export declare const isRegionlessNanp: (number: string) => boolean;
@@ -0,0 +1 @@
1
+ export declare const translateCursorPosition: (relevantChars: number, formattedValue: string, prevCaretPos: number, isDeleteForwards: boolean) => number;
@@ -0,0 +1,3 @@
1
+ import { SelectedCountryData } from '../types/public-api';
2
+ export declare const beforeSetNumber: (fullNumber: string, dialCode: string, separateDialCode: boolean, selectedCountryData: SelectedCountryData) => string;
3
+ export declare const formatNumberAsYouType: (fullNumber: string, telInputValue: string, utils: any, selectedCountryData: SelectedCountryData, separateDialCode: boolean) => string;
@@ -0,0 +1,9 @@
1
+ import { EVENTS } from '../constants';
2
+ export type ItiEventMap = {
3
+ [EVENTS.COUNTRY_CHANGE]: Record<string, never>;
4
+ [EVENTS.OPEN_COUNTRY_DROPDOWN]: Record<string, never>;
5
+ [EVENTS.CLOSE_COUNTRY_DROPDOWN]: Record<string, never>;
6
+ [EVENTS.INPUT]: {
7
+ isSetNumber?: boolean;
8
+ };
9
+ };
@@ -0,0 +1,78 @@
1
+ import { Country, Iso2 } from '../../intl-tel-input/data';
2
+ import { I18n } from '../../intl-tel-input/i18n/types';
3
+ import { Iti } from '../../intl-tel-input';
4
+ import { PLACEHOLDER_MODES } from '../constants';
5
+ export type UtilsLoader = () => Promise<{
6
+ default: ItiUtils;
7
+ }>;
8
+ export type ItiUtils = {
9
+ formatNumber(number: string, iso2: string | undefined, format?: number): string;
10
+ formatNumberAsYouType(number: string, iso2: string | undefined): string;
11
+ getCoreNumber(number: string, iso2: string | undefined): string;
12
+ getExampleNumber(iso2: string | undefined, nationalMode: boolean, numberType: number, useE164?: boolean): string;
13
+ getExtension(number: string, iso2: string | undefined): string;
14
+ getNumberType(number: string, iso2: string | undefined): number;
15
+ getValidationError(number: string, iso2: string | undefined): number;
16
+ isPossibleNumber(number: string, iso2: string | undefined, numberType?: NumberType[] | null): boolean;
17
+ isValidNumber(number: string, iso2: string | undefined, numberType?: NumberType[] | null): boolean;
18
+ numberFormat: {
19
+ NATIONAL: number;
20
+ INTERNATIONAL: number;
21
+ E164: number;
22
+ RFC3966: number;
23
+ };
24
+ numberType: Record<string, number>;
25
+ };
26
+ export type NumberType = "FIXED_LINE_OR_MOBILE" | "FIXED_LINE" | "MOBILE" | "PAGER" | "PERSONAL_NUMBER" | "PREMIUM_RATE" | "SHARED_COST" | "TOLL_FREE" | "UAN" | "UNKNOWN" | "VOICEMAIL" | "VOIP";
27
+ type ValueOf<T> = T[keyof T];
28
+ export interface AllOptions {
29
+ allowDropdown: boolean;
30
+ allowPhonewords: boolean;
31
+ autoPlaceholder: ValueOf<typeof PLACEHOLDER_MODES>;
32
+ containerClass: string;
33
+ countryOrder: Iso2[] | null;
34
+ countrySearch: boolean;
35
+ countryNameLocale: string;
36
+ customPlaceholder: ((selectedCountryPlaceholder: string, selectedCountryData: SelectedCountryData) => string) | null;
37
+ dropdownContainer: HTMLElement | null;
38
+ excludeCountries: Iso2[];
39
+ fixDropdownWidth: boolean;
40
+ formatAsYouType: boolean;
41
+ formatOnDisplay: boolean;
42
+ geoIpLookup: ((success: (iso2: Iso2) => void, failure: () => void) => void) | null;
43
+ hiddenInput: ((telInputName: string) => {
44
+ phone: string;
45
+ country?: string;
46
+ }) | null;
47
+ i18n: I18n;
48
+ initialCountry: Iso2 | "auto" | "";
49
+ loadUtils: UtilsLoader | null;
50
+ nationalMode: boolean;
51
+ onlyCountries: Iso2[];
52
+ placeholderNumberType: NumberType;
53
+ showFlags: boolean;
54
+ separateDialCode: boolean;
55
+ strictMode: boolean;
56
+ useFullscreenPopup: boolean;
57
+ validationNumberTypes: NumberType[] | null;
58
+ }
59
+ export type SomeOptions = Partial<AllOptions>;
60
+ export interface IntlTelInputInterface {
61
+ (input: HTMLInputElement, options?: SomeOptions): Iti;
62
+ autoCountry?: Iso2;
63
+ defaults: AllOptions;
64
+ documentReady: () => boolean;
65
+ getCountryData: () => Country[];
66
+ getInstance: (input: HTMLInputElement) => Iti | null;
67
+ instances: {
68
+ [key: string]: Iti;
69
+ };
70
+ attachUtils: (source: UtilsLoader) => Promise<unknown> | null;
71
+ startedLoadingAutoCountry: boolean;
72
+ startedLoadingUtilsScript: boolean;
73
+ version: string | undefined;
74
+ utils?: ItiUtils;
75
+ }
76
+ type EmptyObject = Record<string, never>;
77
+ export type SelectedCountryData = Country | EmptyObject;
78
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Build a space-delimited class string from an object map of className -> truthy/falsey.
3
+ * Only keys with truthy values are included.
4
+ */
5
+ export declare const buildClassNames: (flags: Record<string, unknown>) => string;
6
+ export declare const createEl: (tagName: string, attrs?: object | null, container?: HTMLElement) => HTMLElement;
@@ -0,0 +1,2 @@
1
+ export declare const getNumeric: (s: string) => string;
2
+ export declare const normaliseString: (s?: string) => string;