intl-tel-input 25.10.12 → 25.11.1
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.
- package/README.md +62 -59
- package/angular/README.md +1 -1
- package/angular/build/IntlTelInput.js +887 -688
- package/angular/build/IntlTelInputWithUtils.js +891 -692
- package/angular/build/types/intl-tel-input/data.d.ts +3 -3
- package/angular/build/types/intl-tel-input.d.ts +22 -70
- package/angular/build/types/modules/constants.d.ts +84 -0
- package/angular/build/types/modules/core/countrySearch.d.ts +17 -0
- package/angular/build/types/modules/core/icons.d.ts +7 -0
- package/angular/build/types/modules/core/options.d.ts +2 -1
- package/angular/build/types/modules/core/ui.d.ts +44 -0
- package/angular/build/types/modules/data/country-data.d.ts +5 -5
- package/angular/build/types/modules/format/caret.d.ts +1 -1
- package/angular/build/types/modules/format/formatting.d.ts +3 -3
- package/angular/build/types/modules/types/events.d.ts +9 -0
- package/angular/build/types/modules/types/public-api.d.ts +3 -0
- package/angular/build/types/modules/utils/dom.d.ts +5 -0
- package/build/js/data.js +8 -2
- package/build/js/data.min.js +2 -2
- package/build/js/intlTelInput.d.ts +214 -83
- package/build/js/intlTelInput.js +1034 -770
- package/build/js/intlTelInput.min.js +13 -13
- package/build/js/intlTelInputWithUtils.js +1038 -774
- package/build/js/intlTelInputWithUtils.min.js +13 -13
- package/build/js/utils.js +4 -4
- package/package.json +3 -1
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +1033 -769
- package/react/build/IntlTelInput.d.ts +214 -83
- package/react/build/IntlTelInput.js +1033 -769
- package/react/build/IntlTelInputWithUtils.cjs +1037 -773
- package/react/build/IntlTelInputWithUtils.js +1037 -773
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +967 -739
- package/vue/build/IntlTelInputWithUtils.mjs +1279 -1051
|
@@ -11,9 +11,9 @@ declare module "intl-tel-input/data" {
|
|
|
11
11
|
nodeById: {
|
|
12
12
|
[instanceId: number]: HTMLElement;
|
|
13
13
|
};
|
|
14
|
-
normalisedName
|
|
15
|
-
initials
|
|
16
|
-
dialCodePlus
|
|
14
|
+
normalisedName: string;
|
|
15
|
+
initials: string;
|
|
16
|
+
dialCodePlus: string;
|
|
17
17
|
};
|
|
18
18
|
const allCountries: Country[];
|
|
19
19
|
export default allCountries;
|
|
@@ -50,6 +50,92 @@ declare module "intl-tel-input/i18n/en" {
|
|
|
50
50
|
const allTranslations: I18n;
|
|
51
51
|
export default allTranslations;
|
|
52
52
|
}
|
|
53
|
+
declare module "modules/constants" {
|
|
54
|
+
import { Iso2 } from "intl-tel-input/data";
|
|
55
|
+
export const EVENTS: {
|
|
56
|
+
readonly OPEN_COUNTRY_DROPDOWN: "open:countrydropdown";
|
|
57
|
+
readonly CLOSE_COUNTRY_DROPDOWN: "close:countrydropdown";
|
|
58
|
+
readonly COUNTRY_CHANGE: "countrychange";
|
|
59
|
+
readonly INPUT: "input";
|
|
60
|
+
};
|
|
61
|
+
export const CLASSES: {
|
|
62
|
+
readonly HIDE: "iti__hide";
|
|
63
|
+
readonly V_HIDE: "iti__v-hide";
|
|
64
|
+
readonly ARROW_UP: "iti__arrow--up";
|
|
65
|
+
readonly GLOBE: "iti__globe";
|
|
66
|
+
readonly FLAG: "iti__flag";
|
|
67
|
+
readonly COUNTRY_ITEM: "iti__country";
|
|
68
|
+
readonly HIGHLIGHT: "iti__highlight";
|
|
69
|
+
};
|
|
70
|
+
export const KEYS: {
|
|
71
|
+
readonly ARROW_UP: "ArrowUp";
|
|
72
|
+
readonly ARROW_DOWN: "ArrowDown";
|
|
73
|
+
readonly SPACE: " ";
|
|
74
|
+
readonly ENTER: "Enter";
|
|
75
|
+
readonly ESC: "Escape";
|
|
76
|
+
readonly TAB: "Tab";
|
|
77
|
+
};
|
|
78
|
+
export const INPUT_TYPES: {
|
|
79
|
+
readonly PASTE: "insertFromPaste";
|
|
80
|
+
readonly DELETE_FWD: "deleteContentForward";
|
|
81
|
+
};
|
|
82
|
+
export const REGEX: {
|
|
83
|
+
readonly ALPHA_UNICODE: RegExp;
|
|
84
|
+
readonly NON_PLUS_NUMERIC: RegExp;
|
|
85
|
+
readonly NON_PLUS_NUMERIC_GLOBAL: RegExp;
|
|
86
|
+
readonly HIDDEN_SEARCH_CHAR: RegExp;
|
|
87
|
+
};
|
|
88
|
+
export const TIMINGS: {
|
|
89
|
+
readonly SEARCH_DEBOUNCE_MS: 100;
|
|
90
|
+
readonly HIDDEN_SEARCH_RESET_MS: 1000;
|
|
91
|
+
readonly NEXT_TICK: 0;
|
|
92
|
+
};
|
|
93
|
+
export const SENTINELS: {
|
|
94
|
+
readonly UNKNOWN_NUMBER_TYPE: -99;
|
|
95
|
+
readonly UNKNOWN_VALIDATION_ERROR: -99;
|
|
96
|
+
};
|
|
97
|
+
export const LAYOUT: {
|
|
98
|
+
readonly SANE_SELECTED_WITH_DIAL_WIDTH: 78;
|
|
99
|
+
readonly SANE_SELECTED_NO_DIAL_WIDTH: 42;
|
|
100
|
+
readonly INPUT_PADDING_EXTRA_LEFT: 6;
|
|
101
|
+
};
|
|
102
|
+
export const DIAL: {
|
|
103
|
+
readonly PLUS: "+";
|
|
104
|
+
readonly NANP: "1";
|
|
105
|
+
};
|
|
106
|
+
export const UK: {
|
|
107
|
+
readonly ISO2: Iso2;
|
|
108
|
+
readonly DIAL_CODE: "44";
|
|
109
|
+
readonly MOBILE_PREFIX: "7";
|
|
110
|
+
readonly MOBILE_CORE_LENGTH: 10;
|
|
111
|
+
};
|
|
112
|
+
export const US: {
|
|
113
|
+
ISO2: Iso2;
|
|
114
|
+
DIAL_CODE: string;
|
|
115
|
+
};
|
|
116
|
+
export const PLACEHOLDER_MODES: {
|
|
117
|
+
readonly AGGRESSIVE: "aggressive";
|
|
118
|
+
readonly POLITE: "polite";
|
|
119
|
+
};
|
|
120
|
+
export const INITIAL_COUNTRY: {
|
|
121
|
+
readonly AUTO: "auto";
|
|
122
|
+
};
|
|
123
|
+
export const DATA_KEYS: {
|
|
124
|
+
readonly COUNTRY_CODE: "countryCode";
|
|
125
|
+
readonly DIAL_CODE: "dialCode";
|
|
126
|
+
};
|
|
127
|
+
export const ARIA: {
|
|
128
|
+
readonly EXPANDED: "aria-expanded";
|
|
129
|
+
readonly LABEL: "aria-label";
|
|
130
|
+
readonly SELECTED: "aria-selected";
|
|
131
|
+
readonly ACTIVE_DESCENDANT: "aria-activedescendant";
|
|
132
|
+
readonly HASPOPUP: "aria-haspopup";
|
|
133
|
+
readonly CONTROLS: "aria-controls";
|
|
134
|
+
readonly HIDDEN: "aria-hidden";
|
|
135
|
+
readonly AUTOCOMPLETE: "aria-autocomplete";
|
|
136
|
+
readonly MODAL: "aria-modal";
|
|
137
|
+
};
|
|
138
|
+
}
|
|
53
139
|
declare module "modules/types/public-api" {
|
|
54
140
|
import type { Country, Iso2 } from "intl-tel-input/data";
|
|
55
141
|
import type { I18n } from "intl-tel-input/i18n/types";
|
|
@@ -123,19 +209,101 @@ declare module "modules/types/public-api" {
|
|
|
123
209
|
version: string | undefined;
|
|
124
210
|
utils?: ItiUtils;
|
|
125
211
|
}
|
|
212
|
+
type EmptyObject = Record<string, never>;
|
|
213
|
+
export type SelectedCountryData = Country | EmptyObject;
|
|
126
214
|
}
|
|
127
215
|
declare module "modules/core/options" {
|
|
216
|
+
import { I18n } from "intl-tel-input/i18n/types";
|
|
128
217
|
import type { AllOptions } from "modules/types/public-api";
|
|
129
218
|
export const defaults: AllOptions;
|
|
130
|
-
export
|
|
219
|
+
export const applyOptionSideEffects: (o: AllOptions, defaultEnglishStrings: I18n) => void;
|
|
131
220
|
}
|
|
132
221
|
declare module "modules/utils/string" {
|
|
133
222
|
export const getNumeric: (s: string) => string;
|
|
134
223
|
export const normaliseString: (s?: string) => string;
|
|
135
224
|
}
|
|
225
|
+
declare module "modules/core/countrySearch" {
|
|
226
|
+
import type { Country } from "intl-tel-input/data";
|
|
227
|
+
/**
|
|
228
|
+
* Country search: Given raw query, return ordered list of countries by priority buckets.
|
|
229
|
+
* Buckets (in order):
|
|
230
|
+
* 1. exact ISO2 matches
|
|
231
|
+
* 2. name starts with
|
|
232
|
+
* 3. name contains
|
|
233
|
+
* 4. dial code exact match (bare or with plus)
|
|
234
|
+
* 5. dial code contains (with plus form)
|
|
235
|
+
* 6. initials match
|
|
236
|
+
* Each bucket preserves country.priority ordering.
|
|
237
|
+
*/
|
|
238
|
+
export const getMatchedCountries: (countries: Country[], query: string) => Country[];
|
|
239
|
+
/**
|
|
240
|
+
* Hidden search (when countrySearch disabled): find first whose name starts with query (case-insensitive).
|
|
241
|
+
*/
|
|
242
|
+
export const findFirstCountryStartingWith: (countries: Country[], query: string) => Country | null;
|
|
243
|
+
}
|
|
136
244
|
declare module "modules/utils/dom" {
|
|
245
|
+
/**
|
|
246
|
+
* Build a space-delimited class string from an object map of className -> truthy/falsey.
|
|
247
|
+
* Only keys with truthy values are included.
|
|
248
|
+
*/
|
|
249
|
+
export const buildClassNames: (flags: Record<string, unknown>) => string;
|
|
137
250
|
export const createEl: (tagName: string, attrs?: object | null, container?: HTMLElement) => HTMLElement;
|
|
138
251
|
}
|
|
252
|
+
declare module "modules/core/icons" {
|
|
253
|
+
/** Magnifying glass search icon */
|
|
254
|
+
export const buildSearchIcon: () => string;
|
|
255
|
+
/**
|
|
256
|
+
* Clear (circle with X) icon
|
|
257
|
+
* @param id Instance id used to create a unique mask id.
|
|
258
|
+
*/
|
|
259
|
+
export const buildClearIcon: (id: number) => string;
|
|
260
|
+
}
|
|
261
|
+
declare module "modules/core/ui" {
|
|
262
|
+
import { Country } from "intl-tel-input/data";
|
|
263
|
+
import { AllOptions } from "modules/types/public-api";
|
|
264
|
+
export default class UI {
|
|
265
|
+
private readonly options;
|
|
266
|
+
private readonly id;
|
|
267
|
+
private readonly isRTL;
|
|
268
|
+
private readonly originalPaddingLeft;
|
|
269
|
+
private countries;
|
|
270
|
+
telInput: HTMLInputElement;
|
|
271
|
+
countryContainer: HTMLElement;
|
|
272
|
+
selectedCountry: HTMLElement;
|
|
273
|
+
selectedCountryInner: HTMLElement;
|
|
274
|
+
selectedDialCode: HTMLElement;
|
|
275
|
+
dropdownArrow: HTMLElement;
|
|
276
|
+
dropdownContent: HTMLElement;
|
|
277
|
+
searchInput: HTMLInputElement;
|
|
278
|
+
searchIcon: HTMLElement;
|
|
279
|
+
searchClearButton: HTMLButtonElement;
|
|
280
|
+
searchNoResults: HTMLElement;
|
|
281
|
+
searchResultsA11yText: HTMLElement;
|
|
282
|
+
countryList: HTMLElement;
|
|
283
|
+
dropdown: HTMLElement;
|
|
284
|
+
hiddenInput: HTMLInputElement;
|
|
285
|
+
hiddenInputCountry: HTMLInputElement;
|
|
286
|
+
highlightedItem: HTMLElement | null;
|
|
287
|
+
readonly hadInitialPlaceholder: boolean;
|
|
288
|
+
constructor(input: HTMLInputElement, options: AllOptions, id: number);
|
|
289
|
+
generateMarkup(countries: Country[]): void;
|
|
290
|
+
private _prepareTelInput;
|
|
291
|
+
private _createWrapperAndInsert;
|
|
292
|
+
private _maybeBuildCountryContainer;
|
|
293
|
+
private _buildDropdownContent;
|
|
294
|
+
private _buildSearchUI;
|
|
295
|
+
private _maybeUpdateInputPaddingAndReveal;
|
|
296
|
+
private _maybeBuildHiddenInputs;
|
|
297
|
+
private _appendListItems;
|
|
298
|
+
updateInputPadding(): void;
|
|
299
|
+
private _getHiddenSelectedCountryWidth;
|
|
300
|
+
updateSearchResultsA11yText(): void;
|
|
301
|
+
scrollTo(element: HTMLElement): void;
|
|
302
|
+
highlightListItem(listItem: HTMLElement | null, shouldFocus: boolean): void;
|
|
303
|
+
filterCountries(matchedCountries: Country[]): void;
|
|
304
|
+
destroy(): void;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
139
307
|
declare module "modules/data/country-data" {
|
|
140
308
|
import { Country, Iso2 } from "intl-tel-input/data";
|
|
141
309
|
import type { AllOptions } from "modules/types/public-api";
|
|
@@ -144,104 +312,68 @@ declare module "modules/data/country-data" {
|
|
|
144
312
|
dialCodeMaxLen: number;
|
|
145
313
|
dialCodeToIso2Map: Record<string, Iso2[]>;
|
|
146
314
|
}
|
|
147
|
-
export
|
|
148
|
-
export
|
|
149
|
-
export
|
|
150
|
-
export
|
|
151
|
-
export
|
|
315
|
+
export const processAllCountries: (options: AllOptions) => Country[];
|
|
316
|
+
export const translateCountryNames: (countries: Country[], options: AllOptions) => void;
|
|
317
|
+
export const processDialCodes: (countries: Country[], options: AllOptions) => DialCodeProcessingResult;
|
|
318
|
+
export const sortCountries: (countries: Country[], options: AllOptions) => void;
|
|
319
|
+
export const cacheSearchTokens: (countries: Country[]) => void;
|
|
152
320
|
}
|
|
153
321
|
declare module "modules/format/formatting" {
|
|
154
|
-
import {
|
|
155
|
-
export
|
|
156
|
-
export
|
|
322
|
+
import { SelectedCountryData } from "modules/types/public-api";
|
|
323
|
+
export const beforeSetNumber: (fullNumber: string, dialCode: string, separateDialCode: boolean, selectedCountryData: SelectedCountryData) => string;
|
|
324
|
+
export const formatNumberAsYouType: (fullNumber: string, telInputValue: string, utils: any, selectedCountryData: SelectedCountryData, separateDialCode: boolean) => string;
|
|
157
325
|
}
|
|
158
326
|
declare module "modules/format/caret" {
|
|
159
|
-
export
|
|
327
|
+
export const translateCursorPosition: (relevantChars: number, formattedValue: string, prevCaretPos: number, isDeleteForwards: boolean) => number;
|
|
160
328
|
}
|
|
161
329
|
declare module "modules/data/nanp-regionless" {
|
|
162
330
|
export const regionlessNanpNumbers: string[];
|
|
163
331
|
export const isRegionlessNanp: (number: string) => boolean;
|
|
164
332
|
}
|
|
333
|
+
declare module "modules/types/events" {
|
|
334
|
+
import { EVENTS } from "modules/constants";
|
|
335
|
+
export type ItiEventMap = {
|
|
336
|
+
[EVENTS.COUNTRY_CHANGE]: Record<string, never>;
|
|
337
|
+
[EVENTS.OPEN_COUNTRY_DROPDOWN]: Record<string, never>;
|
|
338
|
+
[EVENTS.CLOSE_COUNTRY_DROPDOWN]: Record<string, never>;
|
|
339
|
+
[EVENTS.INPUT]: {
|
|
340
|
+
isSetNumber?: boolean;
|
|
341
|
+
};
|
|
342
|
+
};
|
|
343
|
+
}
|
|
165
344
|
declare module "intl-tel-input" {
|
|
166
|
-
import {
|
|
167
|
-
import type { NumberType, SomeOptions, IntlTelInputInterface } from "modules/types/public-api";
|
|
345
|
+
import { Iso2 } from "intl-tel-input/data";
|
|
346
|
+
import type { NumberType, SomeOptions, IntlTelInputInterface, SelectedCountryData } from "modules/types/public-api";
|
|
168
347
|
global {
|
|
169
348
|
interface HTMLInputElement {
|
|
170
349
|
iti?: Iti;
|
|
171
350
|
}
|
|
172
351
|
}
|
|
173
352
|
export class Iti {
|
|
174
|
-
id: number;
|
|
175
|
-
promise: Promise<[unknown, unknown]>;
|
|
176
|
-
private
|
|
177
|
-
private
|
|
178
|
-
private
|
|
179
|
-
private
|
|
180
|
-
private
|
|
181
|
-
private
|
|
353
|
+
readonly id: number;
|
|
354
|
+
readonly promise: Promise<[unknown, unknown]>;
|
|
355
|
+
private readonly ui;
|
|
356
|
+
private readonly options;
|
|
357
|
+
private readonly isAndroid;
|
|
358
|
+
private readonly countries;
|
|
359
|
+
private readonly dialCodeMaxLen;
|
|
360
|
+
private readonly dialCodeToIso2Map;
|
|
361
|
+
private readonly dialCodes;
|
|
362
|
+
private readonly countryByIso2;
|
|
182
363
|
private selectedCountryData;
|
|
183
|
-
private countries;
|
|
184
|
-
private dialCodeMaxLen;
|
|
185
|
-
private dialCodeToIso2Map;
|
|
186
|
-
private dialCodes;
|
|
187
|
-
private countryByIso2;
|
|
188
|
-
private countryContainer;
|
|
189
|
-
private selectedCountry;
|
|
190
|
-
private selectedCountryInner;
|
|
191
|
-
private selectedDialCode;
|
|
192
|
-
private dropdownArrow;
|
|
193
|
-
private dropdownContent;
|
|
194
|
-
private searchInput;
|
|
195
|
-
private searchIcon;
|
|
196
|
-
private searchClearButton;
|
|
197
|
-
private searchNoResults;
|
|
198
|
-
private searchResultsA11yText;
|
|
199
|
-
private countryList;
|
|
200
|
-
private dropdown;
|
|
201
|
-
private hiddenInput;
|
|
202
|
-
private hiddenInputCountry;
|
|
203
364
|
private maxCoreNumberLength;
|
|
204
365
|
private defaultCountry;
|
|
205
|
-
private
|
|
206
|
-
private
|
|
207
|
-
private _handleLabelClick;
|
|
208
|
-
private _handleClickSelectedCountry;
|
|
209
|
-
private _handleCountryContainerKeydown;
|
|
210
|
-
private _handleInputEvent;
|
|
211
|
-
private _handleKeydownEvent;
|
|
212
|
-
private _handlePasteEvent;
|
|
213
|
-
private _handleWindowScroll;
|
|
214
|
-
private _handleMouseoverCountryList;
|
|
215
|
-
private _handleClickCountryList;
|
|
216
|
-
private _handleClickOffToClose;
|
|
217
|
-
private _handleKeydownOnDropdown;
|
|
218
|
-
private _handleSearchChange;
|
|
219
|
-
private _handleSearchClear;
|
|
220
|
-
private _handlePageLoad;
|
|
221
|
-
private _doAttachUtils;
|
|
366
|
+
private abortController;
|
|
367
|
+
private dropdownAbortController;
|
|
222
368
|
private resolveAutoCountryPromise;
|
|
223
369
|
private rejectAutoCountryPromise;
|
|
224
370
|
private resolveUtilsScriptPromise;
|
|
225
371
|
private rejectUtilsScriptPromise;
|
|
226
|
-
/**
|
|
227
|
-
* Build a space-delimited class string from an object map of className -> truthy/falsey.
|
|
228
|
-
* Only keys with truthy values are included.
|
|
229
|
-
*/
|
|
230
|
-
private static _buildClassNames;
|
|
231
372
|
constructor(input: HTMLInputElement, customOptions?: SomeOptions);
|
|
232
|
-
private
|
|
373
|
+
private static _getIsAndroid;
|
|
233
374
|
private _createInitPromises;
|
|
234
375
|
_init(): void;
|
|
235
376
|
private _processCountryData;
|
|
236
|
-
private _generateMarkup;
|
|
237
|
-
private _prepareTelInput;
|
|
238
|
-
private _createWrapperAndInsert;
|
|
239
|
-
private _maybeBuildCountryContainer;
|
|
240
|
-
private _buildDropdownContent;
|
|
241
|
-
private _buildSearchUI;
|
|
242
|
-
private _maybeUpdateInputPaddingAndReveal;
|
|
243
|
-
private _maybeBuildHiddenInputs;
|
|
244
|
-
private _appendListItems;
|
|
245
377
|
private _setInitialState;
|
|
246
378
|
private _initListeners;
|
|
247
379
|
private _initHiddenInputListener;
|
|
@@ -258,25 +390,24 @@ declare module "intl-tel-input" {
|
|
|
258
390
|
private _openDropdown;
|
|
259
391
|
private _setDropdownPosition;
|
|
260
392
|
private _bindDropdownListeners;
|
|
393
|
+
private _bindDropdownMouseoverListener;
|
|
394
|
+
private _bindDropdownCountryClickListener;
|
|
395
|
+
private _bindDropdownClickOffListener;
|
|
396
|
+
private _bindDropdownKeydownListener;
|
|
397
|
+
private _bindDropdownSearchListeners;
|
|
261
398
|
private _searchForCountry;
|
|
262
|
-
private
|
|
263
|
-
private _getMatchedCountries;
|
|
264
|
-
private _updateSearchResultsA11yText;
|
|
399
|
+
private _filterCountriesByQuery;
|
|
265
400
|
private _handleUpDownKey;
|
|
266
401
|
private _handleEnterKey;
|
|
267
402
|
private _updateValFromNumber;
|
|
268
403
|
private _updateCountryFromNumber;
|
|
269
404
|
private _ensureHasDialCode;
|
|
270
405
|
private _getNewCountryFromNumber;
|
|
271
|
-
private _highlightListItem;
|
|
272
406
|
private _setCountry;
|
|
273
|
-
private _updateInputPadding;
|
|
274
407
|
private _updateMaxLength;
|
|
275
|
-
private _getHiddenSelectedCountryWidth;
|
|
276
408
|
private _updatePlaceholder;
|
|
277
409
|
private _selectListItem;
|
|
278
410
|
private _closeDropdown;
|
|
279
|
-
private _scrollTo;
|
|
280
411
|
private _updateDialCode;
|
|
281
412
|
private _getDialCode;
|
|
282
413
|
private _getFullNumber;
|
|
@@ -288,7 +419,7 @@ declare module "intl-tel-input" {
|
|
|
288
419
|
getExtension(): string;
|
|
289
420
|
getNumber(format?: number): string;
|
|
290
421
|
getNumberType(): number;
|
|
291
|
-
getSelectedCountryData():
|
|
422
|
+
getSelectedCountryData(): SelectedCountryData;
|
|
292
423
|
getValidationError(): number;
|
|
293
424
|
isValidNumber(): boolean | null;
|
|
294
425
|
isValidNumberPrecise(): boolean | null;
|