intl-tel-input 24.6.0 → 24.7.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.
package/README.md CHANGED
@@ -60,7 +60,7 @@ By default, on mobile devices we show a fullscreen popup instead of the inline d
60
60
  * Accessibility provided via ARIA tags
61
61
  * Typescript type definitions included
62
62
  * Easily customise styles by overriding CSS variables
63
- * React and Vue components included
63
+ * React and Vue components also included
64
64
  * Translations for country names (etc) provided in many different languages
65
65
  * Lots of initialisation options for customisation, as well as instance methods/events for interaction
66
66
 
@@ -74,16 +74,16 @@ _Note: We have now dropped support for all versions of Internet Explorer because
74
74
  ## Getting Started (Using a CDN)
75
75
  1. Add the CSS
76
76
  ```html
77
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@24.6.0/build/css/intlTelInput.css">
77
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@24.7.0/build/css/intlTelInput.css">
78
78
  ```
79
79
 
80
80
  2. Add the plugin script and initialise it on your input element
81
81
  ```html
82
- <script src="https://cdn.jsdelivr.net/npm/intl-tel-input@24.6.0/build/js/intlTelInput.min.js"></script>
82
+ <script src="https://cdn.jsdelivr.net/npm/intl-tel-input@24.7.0/build/js/intlTelInput.min.js"></script>
83
83
  <script>
84
84
  const input = document.querySelector("#phone");
85
85
  window.intlTelInput(input, {
86
- loadUtilsOnInit: "https://cdn.jsdelivr.net/npm/intl-tel-input@24.6.0/build/js/utils.js",
86
+ loadUtilsOnInit: "https://cdn.jsdelivr.net/npm/intl-tel-input@24.7.0/build/js/utils.js",
87
87
  });
88
88
  </script>
89
89
  ```
@@ -315,10 +315,10 @@ intlTelInput(input, {
315
315
  Type: `String` Default: `""`
316
316
  Set the initial country selection by specifying its country code e.g. `"us"` for the United States. (Be careful not to do this unless you are sure of the user's country, as it can lead to tricky issues if set incorrectly and the user auto-fills their national number and submits the form without checking - in certain cases, this can pass validation and you can end up storing a number with the wrong dial code). You can also set `initialCountry` to `"auto"`, which will look up the user's country based on their IP address (requires the `geoIpLookup` option - [see example](https://intl-tel-input.com/examples/lookup-country.html)). Note that however you use `initialCountry`, it will not update the country selection if the input already contains a number with an international dial code.
317
317
 
318
- **loadUtilsOnInit**
318
+ **loadUtilsOnInit** (see [v25 discussion](https://github.com/jackocnr/intl-tel-input/discussions/1842))
319
319
  Type: `String` or `() => Promise<module>` Default: `""` Example: `"/build/js/utils.js"`
320
320
 
321
- This is one way to (lazy) load the included utils.js (to enable formatting/validation etc) - see [Loading The Utilities Script](#loading-the-utilities-script) for more options. You will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `loadUtilsOnInit` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@24.6.0/build/js/utils.js"`. The script is loaded via a [dynamic import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) statement, which means the URL cannot be relative - it must be absolute.
321
+ This is one way to (lazy) load the included utils.js (to enable formatting/validation etc) - see [Loading The Utilities Script](#loading-the-utilities-script) for more options. You will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `loadUtilsOnInit` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@24.7.0/build/js/utils.js"`. The script is loaded via a [dynamic import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) statement, which means the URL cannot be relative - it must be absolute.
322
322
 
323
323
  Alternatively, this can be a function that returns a promise for the utils module. When using a bundler like Webpack, this can be used to tell the bundler that the utils script should be kept in a separate file from the rest of your code. For example: `{ loadUtilsOnInit: () => import("intl-tel-input/utils") }`.
324
324
 
@@ -437,7 +437,7 @@ const isValid = iti.isValidNumber();
437
437
  ```
438
438
  Returns: `true`/`false`
439
439
 
440
- **isValidNumberPrecise**
440
+ **isValidNumberPrecise** ⚠️ DEPRECATED - see [discussion](https://github.com/jackocnr/intl-tel-input/discussions/1840)
441
441
  Check if the current number is valid using precise matching rules for each country/area code etc - [see example](https://intl-tel-input.com/examples/validation.html). Note that these rules change each month for various countries around the world, so you need to be careful to keep the plugin up-to-date else you will start rejecting valid numbers. For a simpler and more future-proof form of validation, see `isValidNumber` above. If validation fails, you can use `getValidationError` to get more information. Requires the [utils script to be loaded](#loading-the-utilities-script).
442
442
  ```js
443
443
  const isValid = iti.isValidNumberPrecise();
@@ -492,7 +492,7 @@ const iti = intlTelInput.getInstance(input);
492
492
  iti.isValidNumber(); // etc
493
493
  ```
494
494
 
495
- **loadUtils**
495
+ **loadUtils** (see [v25 discussion](https://github.com/jackocnr/intl-tel-input/discussions/1842))
496
496
  An alternative to the `loadUtilsOnInit` option, this method lets you manually load the utils.js script on demand, to enable formatting/validation etc. See [Loading The Utilities Script](#loading-the-utilities-script) for more information. This method should only be called once per page. A [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) object is returned so you can use `loadUtils().then(callback)` to know when it's finished.
497
497
  ```js
498
498
  // Load from a URL:
@@ -576,14 +576,16 @@ International number formatting/validation is hard (it varies by country/distric
576
576
 
577
577
  To recompile the utils script yourself (e.g. to update the version of libphonenumber it is built from), see the [contributing guide](https://github.com/jackocnr/intl-tel-input/blob/master/.github/CONTRIBUTING.md#updating-to-a-new-version-of-libphonenumber).
578
578
 
579
- ## Loading The Utilities Script
579
+ ## Loading The Utilities Script
580
+ See [v25 discussion](https://github.com/jackocnr/intl-tel-input/discussions/1842).
581
+
580
582
  The utils script provides lots of great functionality (see above section), but comes at the cost of increased filesize (~260KB). There are two main ways to load the utils script, depending on whether you're concerned about filesize or not.
581
583
 
582
584
  **Option 1: intlTelInputWithUtils**
583
585
  If you're not concerned about filesize (e.g. you're lazy loading this script), the easiest thing to do is to just use the full bundle (`/build/js/intlTelInputWithUtils.js`), which comes with the utils script included. This script can be used exactly like the main intlTelInput.js - so it can either be loaded directly onto the page (which defines `window.intlTelInput` like usual), or it can be imported like so: `import intlTelInput from "intl-tel-input/intlTelInputWithUtils"`.
584
586
 
585
587
  **Option 2: loadUtilsOnInit**
586
- If you *are* concerned about filesize, you can lazy load the utils script when the plugin initialises, using the `loadUtilsOnInit` initialisation option. You will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `loadUtilsOnInit` option to that URL, or just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@24.6.0/build/js/utils.js"`.
588
+ If you *are* concerned about filesize, you can lazy load the utils script when the plugin initialises, using the `loadUtilsOnInit` initialisation option. You will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `loadUtilsOnInit` option to that URL, or just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@24.7.0/build/js/utils.js"`.
587
589
 
588
590
  Alternatively, you can set the `loadUtilsOnInit` option to a function that returns a promise for the utils script as a JS module object. If you use a bundler like Webpack, Vite, or Parcel to build your app, you can use it like this automatically separate the utils into a different bundle:
589
591
 
package/build/js/data.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * International Telephone Input v24.6.0
2
+ * International Telephone Input v24.7.0
3
3
  * https://github.com/jackocnr/intl-tel-input.git
4
4
  * Licensed under the MIT license
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*
2
- * International Telephone Input v24.6.0
2
+ * International Telephone Input v24.7.0
3
3
  * https://github.com/jackocnr/intl-tel-input.git
4
4
  * Licensed under the MIT license
5
5
  */
@@ -0,0 +1,245 @@
1
+ const countryTranslations = {
2
+ ad: "Andorra",
3
+ ae: "De Forenede Arabiske Emirater",
4
+ af: "Afghanistan",
5
+ ag: "Antigua og Barbuda",
6
+ ai: "Anguilla",
7
+ al: "Albanien",
8
+ am: "Armenien",
9
+ ao: "Angola",
10
+ ar: "Argentina",
11
+ as: "Amerikansk Samoa",
12
+ at: "Østrig",
13
+ au: "Australien",
14
+ aw: "Aruba",
15
+ ax: "Åland",
16
+ az: "Aserbajdsjan",
17
+ ba: "Bosnien-Hercegovina",
18
+ bb: "Barbados",
19
+ bd: "Bangladesh",
20
+ be: "Belgien",
21
+ bf: "Burkina Faso",
22
+ bg: "Bulgarien",
23
+ bh: "Bahrain",
24
+ bi: "Burundi",
25
+ bj: "Benin",
26
+ bl: "Saint Barthélemy",
27
+ bm: "Bermuda",
28
+ bn: "Brunei",
29
+ bo: "Bolivia",
30
+ bq: "De tidligere Nederlandske Antiller",
31
+ br: "Brasilien",
32
+ bs: "Bahamas",
33
+ bt: "Bhutan",
34
+ bw: "Botswana",
35
+ by: "Hviderusland",
36
+ bz: "Belize",
37
+ ca: "Canada",
38
+ cc: "Cocosøerne",
39
+ cd: "Congo-Kinshasa",
40
+ cf: "Den Centralafrikanske Republik",
41
+ cg: "Congo-Brazzaville",
42
+ ch: "Schweiz",
43
+ ci: "Elfenbenskysten",
44
+ ck: "Cookøerne",
45
+ cl: "Chile",
46
+ cm: "Cameroun",
47
+ cn: "Kina",
48
+ co: "Colombia",
49
+ cr: "Costa Rica",
50
+ cu: "Cuba",
51
+ cv: "Kap Verde",
52
+ cw: "Curaçao",
53
+ cx: "Juleøen",
54
+ cy: "Cypern",
55
+ cz: "Tjekkiet",
56
+ de: "Tyskland",
57
+ dj: "Djibouti",
58
+ dk: "Danmark",
59
+ dm: "Dominica",
60
+ do: "Den Dominikanske Republik",
61
+ dz: "Algeriet",
62
+ ec: "Ecuador",
63
+ ee: "Estland",
64
+ eg: "Egypten",
65
+ eh: "Vestsahara",
66
+ er: "Eritrea",
67
+ es: "Spanien",
68
+ et: "Etiopien",
69
+ fi: "Finland",
70
+ fj: "Fiji",
71
+ fk: "Falklandsøerne",
72
+ fm: "Mikronesien",
73
+ fo: "Færøerne",
74
+ fr: "Frankrig",
75
+ ga: "Gabon",
76
+ gb: "Storbritannien",
77
+ gd: "Grenada",
78
+ ge: "Georgien",
79
+ gf: "Fransk Guyana",
80
+ gg: "Guernsey",
81
+ gh: "Ghana",
82
+ gi: "Gibraltar",
83
+ gl: "Grønland",
84
+ gm: "Gambia",
85
+ gn: "Guinea",
86
+ gp: "Guadeloupe",
87
+ gq: "Ækvatorialguinea",
88
+ gr: "Grækenland",
89
+ gt: "Guatemala",
90
+ gu: "Guam",
91
+ gw: "Guinea-Bissau",
92
+ gy: "Guyana",
93
+ hk: "SAR Hongkong",
94
+ hn: "Honduras",
95
+ hr: "Kroatien",
96
+ ht: "Haiti",
97
+ hu: "Ungarn",
98
+ id: "Indonesien",
99
+ ie: "Irland",
100
+ il: "Israel",
101
+ im: "Isle of Man",
102
+ in: "Indien",
103
+ io: "Det Britiske Territorium i Det Indiske Ocean",
104
+ iq: "Irak",
105
+ ir: "Iran",
106
+ is: "Island",
107
+ it: "Italien",
108
+ je: "Jersey",
109
+ jm: "Jamaica",
110
+ jo: "Jordan",
111
+ jp: "Japan",
112
+ ke: "Kenya",
113
+ kg: "Kirgisistan",
114
+ kh: "Cambodja",
115
+ ki: "Kiribati",
116
+ km: "Comorerne",
117
+ kn: "Saint Kitts og Nevis",
118
+ kp: "Nordkorea",
119
+ kr: "Sydkorea",
120
+ kw: "Kuwait",
121
+ ky: "Caymanøerne",
122
+ kz: "Kasakhstan",
123
+ la: "Laos",
124
+ lb: "Libanon",
125
+ lc: "Saint Lucia",
126
+ li: "Liechtenstein",
127
+ lk: "Sri Lanka",
128
+ lr: "Liberia",
129
+ ls: "Lesotho",
130
+ lt: "Litauen",
131
+ lu: "Luxembourg",
132
+ lv: "Letland",
133
+ ly: "Libyen",
134
+ ma: "Marokko",
135
+ mc: "Monaco",
136
+ md: "Moldova",
137
+ me: "Montenegro",
138
+ mf: "Saint Martin",
139
+ mg: "Madagaskar",
140
+ mh: "Marshalløerne",
141
+ mk: "Nordmakedonien",
142
+ ml: "Mali",
143
+ mm: "Myanmar (Burma)",
144
+ mn: "Mongoliet",
145
+ mo: "SAR Macao",
146
+ mp: "Nordmarianerne",
147
+ mq: "Martinique",
148
+ mr: "Mauretanien",
149
+ ms: "Montserrat",
150
+ mt: "Malta",
151
+ mu: "Mauritius",
152
+ mv: "Maldiverne",
153
+ mw: "Malawi",
154
+ mx: "Mexico",
155
+ my: "Malaysia",
156
+ mz: "Mozambique",
157
+ na: "Namibia",
158
+ nc: "Ny Kaledonien",
159
+ ne: "Niger",
160
+ nf: "Norfolk Island",
161
+ ng: "Nigeria",
162
+ ni: "Nicaragua",
163
+ nl: "Holland",
164
+ no: "Norge",
165
+ np: "Nepal",
166
+ nr: "Nauru",
167
+ nu: "Niue",
168
+ nz: "New Zealand",
169
+ om: "Oman",
170
+ pa: "Panama",
171
+ pe: "Peru",
172
+ pf: "Fransk Polynesien",
173
+ pg: "Papua Ny Guinea",
174
+ ph: "Filippinerne",
175
+ pk: "Pakistan",
176
+ pl: "Polen",
177
+ pm: "Saint Pierre og Miquelon",
178
+ pr: "Puerto Rico",
179
+ ps: "De palæstinensiske områder",
180
+ pt: "Portugal",
181
+ pw: "Palau",
182
+ py: "Paraguay",
183
+ qa: "Qatar",
184
+ re: "Réunion",
185
+ ro: "Rumænien",
186
+ rs: "Serbien",
187
+ ru: "Rusland",
188
+ rw: "Rwanda",
189
+ sa: "Saudi-Arabien",
190
+ sb: "Salomonøerne",
191
+ sc: "Seychellerne",
192
+ sd: "Sudan",
193
+ se: "Sverige",
194
+ sg: "Singapore",
195
+ sh: "St. Helena",
196
+ si: "Slovenien",
197
+ sj: "Svalbard og Jan Mayen",
198
+ sk: "Slovakiet",
199
+ sl: "Sierra Leone",
200
+ sm: "San Marino",
201
+ sn: "Senegal",
202
+ so: "Somalia",
203
+ sr: "Surinam",
204
+ ss: "Sydsudan",
205
+ st: "São Tomé og Príncipe",
206
+ sv: "El Salvador",
207
+ sx: "Sint Maarten",
208
+ sy: "Syrien",
209
+ sz: "Eswatini",
210
+ tc: "Turks- og Caicosøerne",
211
+ td: "Tchad",
212
+ tg: "Togo",
213
+ th: "Thailand",
214
+ tj: "Tadsjikistan",
215
+ tk: "Tokelau",
216
+ tl: "Timor-Leste",
217
+ tm: "Turkmenistan",
218
+ tn: "Tunesien",
219
+ to: "Tonga",
220
+ tr: "Tyrkiet",
221
+ tt: "Trinidad og Tobago",
222
+ tv: "Tuvalu",
223
+ tw: "Taiwan",
224
+ tz: "Tanzania",
225
+ ua: "Ukraine",
226
+ ug: "Uganda",
227
+ us: "USA",
228
+ uy: "Uruguay",
229
+ uz: "Usbekistan",
230
+ va: "Vatikanstaten",
231
+ vc: "Saint Vincent og Grenadinerne",
232
+ ve: "Venezuela",
233
+ vg: "De Britiske Jomfruøer",
234
+ vi: "De Amerikanske Jomfruøer",
235
+ vn: "Vietnam",
236
+ vu: "Vanuatu",
237
+ wf: "Wallis og Futuna",
238
+ ws: "Samoa",
239
+ ye: "Yemen",
240
+ yt: "Mayotte",
241
+ za: "Sydafrika",
242
+ zm: "Zambia",
243
+ zw: "Zimbabwe"
244
+ };
245
+ export default countryTranslations;
@@ -0,0 +1,5 @@
1
+ import countryTranslations from "./countries.js";
2
+ import interfaceTranslations from "./interface.js";
3
+ export { countryTranslations, interfaceTranslations };
4
+ const allTranslations = { ...countryTranslations, ...interfaceTranslations };
5
+ export default allTranslations;
@@ -0,0 +1,13 @@
1
+ const interfaceTranslations = {
2
+ selectedCountryAriaLabel: "Valgt land",
3
+ noCountrySelected: "Intet land er valgt",
4
+ countryListAriaLabel: "Liste over lande",
5
+ searchPlaceholder: "Søge",
6
+ zeroSearchResults: "Ingen resultater fundet",
7
+ oneSearchResult: "1 resultat fundet",
8
+ multipleSearchResults: "${count} resultater fundet",
9
+ // additional countries (not supported by country-list library)
10
+ ac: "Ascension",
11
+ xk: "Kosovo"
12
+ };
13
+ export default interfaceTranslations;
@@ -4,6 +4,7 @@ export { default as bn, countryTranslations as bnCountryTranslations, interfaceT
4
4
  export { default as bs, countryTranslations as bsCountryTranslations, interfaceTranslations as bsInterfaceTranslations } from "./bs";
5
5
  export { default as ca, countryTranslations as caCountryTranslations, interfaceTranslations as caInterfaceTranslations } from "./ca";
6
6
  export { default as cs, countryTranslations as csCountryTranslations, interfaceTranslations as csInterfaceTranslations } from "./cs";
7
+ export { default as da, countryTranslations as daCountryTranslations, interfaceTranslations as daInterfaceTranslations } from "./da";
7
8
  export { default as de, countryTranslations as deCountryTranslations, interfaceTranslations as deInterfaceTranslations } from "./de";
8
9
  export { default as el, countryTranslations as elCountryTranslations, interfaceTranslations as elInterfaceTranslations } from "./el";
9
10
  export { default as en, countryTranslations as enCountryTranslations, interfaceTranslations as enInterfaceTranslations } from "./en";
@@ -594,6 +594,24 @@ declare module "intl-tel-input/i18n/cs" {
594
594
  const allTranslations: I18n;
595
595
  export default allTranslations;
596
596
  }
597
+ declare module "intl-tel-input/i18n/da/countries" {
598
+ import { I18n } from "intl-tel-input/i18n/types";
599
+ const countryTranslations: I18n;
600
+ export default countryTranslations;
601
+ }
602
+ declare module "intl-tel-input/i18n/da/interface" {
603
+ import { I18n } from "intl-tel-input/i18n/types";
604
+ const interfaceTranslations: I18n;
605
+ export default interfaceTranslations;
606
+ }
607
+ declare module "intl-tel-input/i18n/da" {
608
+ import { I18n } from "intl-tel-input/i18n/types";
609
+ import countryTranslations from "intl-tel-input/i18n/da/countries";
610
+ import interfaceTranslations from "intl-tel-input/i18n/da/interface";
611
+ export { countryTranslations, interfaceTranslations };
612
+ const allTranslations: I18n;
613
+ export default allTranslations;
614
+ }
597
615
  declare module "intl-tel-input/i18n/de/countries" {
598
616
  import { I18n } from "intl-tel-input/i18n/types";
599
617
  const countryTranslations: I18n;
@@ -1105,6 +1123,7 @@ declare module "intl-tel-input/i18n" {
1105
1123
  export { default as bs, countryTranslations as bsCountryTranslations, interfaceTranslations as bsInterfaceTranslations } from "intl-tel-input/i18n/bs";
1106
1124
  export { default as ca, countryTranslations as caCountryTranslations, interfaceTranslations as caInterfaceTranslations } from "intl-tel-input/i18n/ca";
1107
1125
  export { default as cs, countryTranslations as csCountryTranslations, interfaceTranslations as csInterfaceTranslations } from "intl-tel-input/i18n/cs";
1126
+ export { default as da, countryTranslations as daCountryTranslations, interfaceTranslations as daInterfaceTranslations } from "intl-tel-input/i18n/da";
1108
1127
  export { default as de, countryTranslations as deCountryTranslations, interfaceTranslations as deInterfaceTranslations } from "intl-tel-input/i18n/de";
1109
1128
  export { default as el, countryTranslations as elCountryTranslations, interfaceTranslations as elInterfaceTranslations } from "intl-tel-input/i18n/el";
1110
1129
  export { default as en, countryTranslations as enCountryTranslations, interfaceTranslations as enInterfaceTranslations } from "intl-tel-input/i18n/en";
@@ -1,5 +1,5 @@
1
1
  /*
2
- * International Telephone Input v24.6.0
2
+ * International Telephone Input v24.7.0
3
3
  * https://github.com/jackocnr/intl-tel-input.git
4
4
  * Licensed under the MIT license
5
5
  */
@@ -3153,7 +3153,7 @@ var factoryOutput = (() => {
3153
3153
  loadUtils,
3154
3154
  startedLoadingUtilsScript: false,
3155
3155
  startedLoadingAutoCountry: false,
3156
- version: "24.6.0"
3156
+ version: "24.7.0"
3157
3157
  }
3158
3158
  );
3159
3159
  var intl_tel_input_default = intlTelInput;