intl-tel-input 25.12.4 → 25.12.6
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 +10 -30
- package/angular/README.md +23 -2
- package/angular/build/IntlTelInput.js +2 -1
- package/angular/build/IntlTelInputWithUtils.js +380 -461
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.js +3 -2
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +381 -462
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/build/js/utils.js +89 -86
- package/package.json +1 -1
- package/react/README.md +16 -14
- package/react/build/IntlTelInput.cjs +2 -1
- package/react/build/IntlTelInput.js +2 -1
- package/react/build/IntlTelInputWithUtils.cjs +380 -461
- package/react/build/IntlTelInputWithUtils.js +380 -461
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +2 -2
- package/vue/build/IntlTelInputWithUtils.mjs +380 -462
package/README.md
CHANGED
|
@@ -81,16 +81,16 @@ _Note: We have now dropped support for all versions of Internet Explorer because
|
|
|
81
81
|
## Getting Started (Using a CDN)
|
|
82
82
|
1. Add the CSS
|
|
83
83
|
```html
|
|
84
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.
|
|
84
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.6/build/css/intlTelInput.css">
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
2. Add the plugin script and initialise it on your input element
|
|
88
88
|
```html
|
|
89
|
-
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.
|
|
89
|
+
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.6/build/js/intlTelInput.min.js"></script>
|
|
90
90
|
<script>
|
|
91
91
|
const input = document.querySelector("#phone");
|
|
92
92
|
window.intlTelInput(input, {
|
|
93
|
-
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.
|
|
93
|
+
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.6/build/js/utils.js"),
|
|
94
94
|
});
|
|
95
95
|
</script>
|
|
96
96
|
```
|
|
@@ -261,7 +261,7 @@ This will generate the following (hidden) elements, which will be automatically
|
|
|
261
261
|
|
|
262
262
|
**i18n**
|
|
263
263
|
Type: `Object` Default: `{}`
|
|
264
|
-
Allows you to specify translation strings for the 200+ country names, as well as other user interface text (e.g. the placeholder text for the country search input). The easiest way to do this is to import one of the [provided translation modules](https://github.com/jackocnr/intl-tel-input/tree/master/
|
|
264
|
+
Allows you to specify translation strings for the 200+ country names, as well as other user interface text (e.g. the placeholder text for the country search input). The easiest way to do this is to import one of the [provided translation modules](https://github.com/jackocnr/intl-tel-input/tree/master/src/js/intl-tel-input/i18n) and set `i18n` to that value (see option 1 below). You can also override one or more individual keys this way (see option 1 below). Alternatively, you can provide your own custom translations (see option 2 below). If providing your own, you will need to specify all the country names (which can be copied from the country-list project, e.g. here are the [country names in French](https://github.com/umpirsky/country-list/blob/master/data/fr/country.json)), as well as a few UI strings (listed below). [See example](https://intl-tel-input.com/examples/localise-countries.html).
|
|
265
265
|
|
|
266
266
|
If we don't currently support a language you need, it's easy to [contribute this](https://github.com/jackocnr/intl-tel-input/blob/master/.github/CONTRIBUTING.md#adding-a-new-translation) yourself - you only need to provide a handful of UI translation strings, as we automatically pull in the country names from the country-list project.
|
|
267
267
|
|
|
@@ -328,12 +328,12 @@ Set the initial country selection by specifying its country code, e.g. `"us"` fo
|
|
|
328
328
|
Type: `() => Promise<module>` Default: `null`
|
|
329
329
|
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.
|
|
330
330
|
|
|
331
|
-
The `loadUtils` option takes a function
|
|
331
|
+
The `loadUtils` option takes a function that returns a Promise resolving to the utils module (see example code below). You can `import` the utils module in different ways: (A) from a CDN, (B) from your own hosted version of [utils.js](https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.6/build/js/utils.js), or (C) if you use a bundler like Webpack, Vite or Parcel, you can import it directly from the package.
|
|
332
332
|
|
|
333
333
|
```js
|
|
334
334
|
// (A) import utils module from a CDN
|
|
335
335
|
intlTelInput(htmlInputElement, {
|
|
336
|
-
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.
|
|
336
|
+
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.6/build/js/utils.js"),
|
|
337
337
|
});
|
|
338
338
|
|
|
339
339
|
// (B) import utils module from your own hosted version of utils.js
|
|
@@ -341,7 +341,7 @@ intlTelInput(htmlInputElement, {
|
|
|
341
341
|
loadUtils: () => import("/path/to/utils.js"),
|
|
342
342
|
});
|
|
343
343
|
|
|
344
|
-
// (C)
|
|
344
|
+
// (C) with a bundler, you can import the utils module directly from the package
|
|
345
345
|
intlTelInput(htmlInputElement, {
|
|
346
346
|
loadUtils: () => import("intl-tel-input/utils"),
|
|
347
347
|
});
|
|
@@ -583,9 +583,9 @@ Example:
|
|
|
583
583
|
<img src="https://raw.github.com/jackocnr/intl-tel-input/master/screenshots/vanilla-dark.png" alt="Screenshot" width="263" height="269" />
|
|
584
584
|
|
|
585
585
|
## Translations
|
|
586
|
-
We provide [translations](https://github.com/jackocnr/intl-tel-input/tree/master/
|
|
586
|
+
We provide [translations](https://github.com/jackocnr/intl-tel-input/tree/master/src/js/intl-tel-input/i18n) for the 200+ country names, as well as other user interface text (e.g. the placeholder text for the country search input) in over 40 languages. See the `i18n` option for details on how to use them. [See them in action](https://intl-tel-input.com/storybook/?path=/docs/intltelinput--i18n).
|
|
587
587
|
|
|
588
|
-
Supported languages: Arabic, Bengali, Bosnian, Bulgarian, Catalan, Chinese, Croatian, Czech, Danish, Dutch, English, Estonian, Finnish, French, German, Greek, Hindi, Hungarian, Indonesian, Italian, Japanese, Korean, Marathi, Norwegian, Persian, Polish, Portuguese, Romanian, Russian, Slovak, Spanish, Swedish, Telugu, Thai, Turkish, Ukrainian, Urdu, Uzbek, Vietnamese.
|
|
588
|
+
Supported languages: Arabic, Albanian, Bengali, Bosnian, Bulgarian, Catalan, Chinese, Croatian, Czech, Danish, Dutch, English, Estonian, Finnish, French, German, Greek, Hindi, Hungarian, Indonesian, Italian, Japanese, Korean, Lithuanian, Marathi, Norwegian, Persian, Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovenian, Spanish, Swedish, Telugu, Thai, Turkish, Ukrainian, Urdu, Uzbek, Vietnamese.
|
|
589
589
|
|
|
590
590
|
If we don't currently support a language you need, it's easy to [contribute this](https://github.com/jackocnr/intl-tel-input/blob/master/.github/CONTRIBUTING.md#adding-a-new-translation) yourself - you only need to provide a handful of UI translation strings, as we automatically pull in the country names from the country-list project.
|
|
591
591
|
|
|
@@ -607,31 +607,11 @@ See [v25 discussion](https://github.com/jackocnr/intl-tel-input/discussions/1842
|
|
|
607
607
|
The utils script provides lots of great functionality (see the 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.
|
|
608
608
|
|
|
609
609
|
**Option 1: intlTelInputWithUtils**
|
|
610
|
-
If you're not concerned about filesize (e.g. you're lazy loading the main plugin script), the easiest thing to do is to
|
|
610
|
+
If you're not concerned about filesize (e.g. you're lazy loading the main plugin script), the easiest thing to do is to 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"`.
|
|
611
611
|
|
|
612
612
|
**Option 2: loadUtils**
|
|
613
613
|
If you *are* concerned about filesize, you can lazy load the utils module when the plugin initialises, using the `loadUtils` initialisation option.
|
|
614
614
|
|
|
615
|
-
The `loadUtils` option takes a function that returns a Promise resolving to the utils module. You can `import` the utils module in different ways (shown below): (A) from a CDN, (B) from your own hosted version of [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js), or (C) if you use a bundler like Webpack, Vite or Parcel, you can import it directly from the package.
|
|
616
|
-
|
|
617
|
-
```js
|
|
618
|
-
// (A) import utils module from a CDN
|
|
619
|
-
intlTelInput(htmlInputElement, {
|
|
620
|
-
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.4/build/js/utils.js"),
|
|
621
|
-
});
|
|
622
|
-
|
|
623
|
-
// (B) import utils module from your own hosted version of utils.js
|
|
624
|
-
intlTelInput(htmlInputElement, {
|
|
625
|
-
loadUtils: () => import("/path/to/utils.js"),
|
|
626
|
-
});
|
|
627
|
-
|
|
628
|
-
// (C) if your bundler supports it, you can import the utils module directly from the package
|
|
629
|
-
intlTelInput(htmlInputElement, {
|
|
630
|
-
loadUtils: () => import("intl-tel-input/utils"),
|
|
631
|
-
});
|
|
632
|
-
```
|
|
633
|
-
|
|
634
|
-
If you want more control over when this file is lazy-loaded, you can manually invoke the `attachUtils` static method whenever you like, instead of using the `loadUtils` initialisation option.
|
|
635
615
|
|
|
636
616
|
## Troubleshooting
|
|
637
617
|
|
package/angular/README.md
CHANGED
|
@@ -13,7 +13,28 @@ An Angular component wrapper for the [intl-tel-input](https://github.com/jackocn
|
|
|
13
13
|
|
|
14
14
|
## Demo
|
|
15
15
|
|
|
16
|
-
Try it
|
|
16
|
+
Try it yourself by running the demos locally:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Clone the repository
|
|
20
|
+
git clone https://github.com/jackocnr/intl-tel-input.git
|
|
21
|
+
cd intl-tel-input
|
|
22
|
+
|
|
23
|
+
# Initialize submodules (required for build)
|
|
24
|
+
git submodule update --init --recursive
|
|
25
|
+
|
|
26
|
+
# Install dependencies and build
|
|
27
|
+
npm install
|
|
28
|
+
npm run build
|
|
29
|
+
|
|
30
|
+
# Serve from project root
|
|
31
|
+
python3 -m http.server
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
> Then open [http://localhost:8000/angular/demo/simple/](http://localhost:8000/angular/demo/simple/) or other demos from the [angular demo folder](https://github.com/jackocnr/intl-tel-input/blob/master/angular/demo/)
|
|
35
|
+
|
|
36
|
+
> [!NOTE]
|
|
37
|
+
> Make sure to serve from the project root, not from the demo folders.
|
|
17
38
|
|
|
18
39
|
## Getting Started
|
|
19
40
|
|
|
@@ -33,7 +54,7 @@ import "intl-tel-input/styles";
|
|
|
33
54
|
|
|
34
55
|
See the [validation demo](https://github.com/jackocnr/intl-tel-input/blob/master/angular/demo/validation/validation.component.ts) for a more fleshed-out example of how to handle validation, or check out the [form demo](https://github.com/jackocnr/intl-tel-input/blob/master/angular/demo/form/form.component.ts) for an alternative approach using `ReactiveFormsModule`.
|
|
35
56
|
|
|
36
|
-
A note on the utils script (~260KB): if you're lazy loading the IntlTelInput chunk (and so less worried about filesize) then you can just `import { IntlTelInputComponent } from "intl-tel-input/angularWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/angular"` import, then you should couple this with the `loadUtils` 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 `loadUtils` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.
|
|
57
|
+
A note on the utils script (~260KB): if you're lazy loading the IntlTelInput chunk (and so less worried about filesize) then you can just `import { IntlTelInputComponent } from "intl-tel-input/angularWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/angular"` import, then you should couple this with the `loadUtils` 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 `loadUtils` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.6/build/js/utils.js"`.
|
|
37
58
|
|
|
38
59
|
## Props
|
|
39
60
|
|
|
@@ -3237,6 +3237,7 @@ var Iti = class _Iti {
|
|
|
3237
3237
|
this._handleEnterKey();
|
|
3238
3238
|
} else if (e.key === KEYS.ESC) {
|
|
3239
3239
|
this._closeDropdown();
|
|
3240
|
+
this.ui.selectedCountry.focus();
|
|
3240
3241
|
}
|
|
3241
3242
|
}
|
|
3242
3243
|
if (!this.options.countrySearch && REGEX.HIDDEN_SEARCH_CHAR.test(e.key)) {
|
|
@@ -3807,7 +3808,7 @@ var intlTelInput = Object.assign((input, options) => {
|
|
|
3807
3808
|
attachUtils,
|
|
3808
3809
|
startedLoadingUtilsScript: false,
|
|
3809
3810
|
startedLoadingAutoCountry: false,
|
|
3810
|
-
version: "25.12.
|
|
3811
|
+
version: "25.12.6"
|
|
3811
3812
|
});
|
|
3812
3813
|
var intl_tel_input_default = intlTelInput;
|
|
3813
3814
|
|