intl-tel-input 21.0.9 → 21.1.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 +7 -20
- package/build/css/intlTelInput.css +835 -816
- package/build/css/intlTelInput.min.css +1 -1
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.js +102 -106
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/utils.js +53 -53
- package/index.js +1 -0
- package/package.json +25 -20
- package/react/README.md +2 -0
- package/react/build/IntlTelInput.js +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# International Telephone Input [](https://app.travis-ci.com/jackocnr/intl-tel-input) <img src="https://img.shields.io/github/package-json/v/jackocnr/intl-tel-input.svg" /> <img src="https://img.shields.io/npm/dm/intl-tel-input.svg"
|
|
1
|
+
# International Telephone Input [](https://app.travis-ci.com/jackocnr/intl-tel-input) <img src="https://img.shields.io/github/package-json/v/jackocnr/intl-tel-input.svg" alt="version"/> <img src="https://img.shields.io/npm/dm/intl-tel-input.svg" alt="downloads"/>
|
|
2
2
|
|
|
3
3
|
🎉 NEWS: we now have our own <a href="https://intl-tel-input.com/examples/react-component.html">React component</a>! Play with it on <a href="https://intl-tel-input.com/storybook/">Storybook</a>! 🎉
|
|
4
4
|
|
|
@@ -11,7 +11,7 @@ A JavaScript plugin for entering and validating international telephone numbers.
|
|
|
11
11
|
If you find the plugin helpful, please consider [supporting the project](https://github.com/sponsors/jackocnr).
|
|
12
12
|
|
|
13
13
|
## Sponsored by
|
|
14
|
-
<img src="https://raw.github.com/jackocnr/intl-tel-input/master/screenshots/twilio.png" height="100" />
|
|
14
|
+
<img src="https://raw.github.com/jackocnr/intl-tel-input/master/screenshots/twilio.png" height="100" alt="Twilio"/>
|
|
15
15
|
Use <a href="https://www.twilio.com/blog/international-telephone-input-twilio?utm_source=github&utm_medium=referral&utm_campaign=intl_tel_input">Twilio's API to build phone verification, SMS 2FA, appointment reminders, marketing notifications and so much more</a>. We can't wait to see what you build.
|
|
16
16
|
|
|
17
17
|
## Table of Contents
|
|
@@ -30,17 +30,14 @@ Use <a href="https://www.twilio.com/blog/international-telephone-input-twilio?ut
|
|
|
30
30
|
- [Contributing](#contributing)
|
|
31
31
|
- [Attributions](#attributions)
|
|
32
32
|
|
|
33
|
-
|
|
34
33
|
## Demo and Examples
|
|
35
34
|
You can view [a live demo](https://intl-tel-input.com) and see some examples of how to use the various options. Alternatively, try it for yourself by downloading the project and opening demo.html in a browser.
|
|
36
35
|
|
|
37
|
-
|
|
38
36
|
## Mobile
|
|
39
37
|
By default, on mobile devices we show a fullscreen popup instead of the inline dropdown, to make better use of the limited screen space. This is similar to how a native `<select>` element works. You can control this behaviour with the `useFullscreenPopup` option. The popup can be closed by either selecting a country from the list or by tapping on the grey area at the sides. [See example](https://intl-tel-input.com/storybook/?path=/docs/intltelinput--usefullscreenpopup) (using the React component).
|
|
40
38
|
|
|
41
39
|
<img src="https://raw.github.com/jackocnr/intl-tel-input/master/screenshots/mobile-fullscreen.jpg" alt="Mobile screenshot" width="270px" style="max-width: 100%" />
|
|
42
40
|
|
|
43
|
-
|
|
44
41
|
## Features
|
|
45
42
|
* Automatically select the user's current country using an IP lookup
|
|
46
43
|
* Automatically set the input placeholder to an example number for the selected country
|
|
@@ -56,7 +53,6 @@ By default, on mobile devices we show a fullscreen popup instead of the inline d
|
|
|
56
53
|
* Easily customise styles by overriding the provided CSS variables
|
|
57
54
|
* React component included
|
|
58
55
|
|
|
59
|
-
|
|
60
56
|
## Browser Compatibility
|
|
61
57
|
| Chrome | Firefox | Safari | Edge |
|
|
62
58
|
| :----: | :-------: | :----: | :--: |
|
|
@@ -67,16 +63,16 @@ _Note: We have now dropped support for all versions of Internet Explorer because
|
|
|
67
63
|
## Getting Started (Using a CDN)
|
|
68
64
|
1. Add the CSS
|
|
69
65
|
```html
|
|
70
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@21.
|
|
66
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@21.1.1/build/css/intlTelInput.css">
|
|
71
67
|
```
|
|
72
68
|
|
|
73
69
|
2. Add the plugin script and initialise it on your input element
|
|
74
70
|
```html
|
|
75
|
-
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@21.
|
|
71
|
+
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@21.1.1/build/js/intlTelInput.min.js"></script>
|
|
76
72
|
<script>
|
|
77
73
|
const input = document.querySelector("#phone");
|
|
78
74
|
window.intlTelInput(input, {
|
|
79
|
-
utilsScript: "https://cdn.jsdelivr.net/npm/intl-tel-input@21.
|
|
75
|
+
utilsScript: "https://cdn.jsdelivr.net/npm/intl-tel-input@21.1.1/build/js/utils.js",
|
|
80
76
|
});
|
|
81
77
|
</script>
|
|
82
78
|
```
|
|
@@ -142,7 +138,6 @@ You can always get the full international number (including country code) using
|
|
|
142
138
|
|
|
143
139
|
If you know the user's country, you can set it with `initialCountry` (e.g. `"us"` for the United States), and if you don't, we recommend setting `initialCountry` to `"auto"` (along with the `geoIpLookup` option) to determine the user's country based on their IP address.
|
|
144
140
|
|
|
145
|
-
|
|
146
141
|
## Initialisation Options
|
|
147
142
|
When you initialise the plugin, the first argument is the input element, and the second is an object containing any initialisation options you want, which are detailed below. Note: any options that take country codes should be [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) codes.
|
|
148
143
|
|
|
@@ -296,7 +291,7 @@ Set this to false to hide the flags e.g. for political reasons. Must be used in
|
|
|
296
291
|
Type: `Boolean` Default: `false`
|
|
297
292
|
Display the country dial code next to the selected flag. Play with this option on [Storybook](https://intl-tel-input.com/storybook/?path=/docs/intltelinput--showselecteddialcode) (using the React component).
|
|
298
293
|
|
|
299
|
-
<img src="https://raw.github.com/jackocnr/intl-tel-input/master/screenshots/separateDialCode.png" width="257px" height="46px">
|
|
294
|
+
<img src="https://raw.github.com/jackocnr/intl-tel-input/master/screenshots/separateDialCode.png" width="257px" height="46px" alt="Separate Dial Code">
|
|
300
295
|
|
|
301
296
|
**strictMode**
|
|
302
297
|
Type: `Boolean` Default: `false`
|
|
@@ -310,7 +305,6 @@ Control when the country list appears as a fullscreen popup vs an inline dropdow
|
|
|
310
305
|
Type: `String` Default: `""` Example: `"build/js/utils.js"`
|
|
311
306
|
Enable formatting/validation etc. by specifying the URL of the included utils.js script (or alternatively just point it to the file on [cdnjs.com](https://cdnjs.com/libraries/intl-tel-input)). The script is fetched only when the page has finished loading (on the window load event) to prevent blocking (the script is ~215KB). When instantiating the plugin, a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) object is returned under the `promise` instance property, so you can do something like `iti.promise.then(callback)` to know when initialisation requests like this have finished. See [Utilities Script](#utilities-script) for more information.
|
|
312
307
|
|
|
313
|
-
|
|
314
308
|
## Public Methods
|
|
315
309
|
In these examples, `iti` refers to the plugin instance which gets returned when you initialise the plugin e.g.
|
|
316
310
|
```js
|
|
@@ -412,7 +406,6 @@ Change the placeholderNumberType option.
|
|
|
412
406
|
iti.setPlaceholderNumberType("FIXED_LINE");
|
|
413
407
|
```
|
|
414
408
|
|
|
415
|
-
|
|
416
409
|
## Static Methods
|
|
417
410
|
|
|
418
411
|
**getCountryData**
|
|
@@ -461,7 +454,6 @@ This is triggered when the user opens the dropdown.
|
|
|
461
454
|
**close:countrydropdown**
|
|
462
455
|
This is triggered when the user closes the dropdown.
|
|
463
456
|
|
|
464
|
-
|
|
465
457
|
## Utilities Script
|
|
466
458
|
The utilities script ([build/js/utils.js](build/js/utils.js)) is a custom build of Google's [libphonenumber](https://github.com/googlei18n/libphonenumber) which enables the following features:
|
|
467
459
|
|
|
@@ -474,7 +466,6 @@ International number formatting/validation is hard (it varies by country/distric
|
|
|
474
466
|
|
|
475
467
|
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).
|
|
476
468
|
|
|
477
|
-
|
|
478
469
|
## Troubleshooting
|
|
479
470
|
|
|
480
471
|
**Full width input**
|
|
@@ -515,21 +506,17 @@ _Note: there is currently [a bug](https://bugs.webkit.org/show_bug.cgi?id=141822
|
|
|
515
506
|
.iti__arrow { border: none; }
|
|
516
507
|
```
|
|
517
508
|
|
|
518
|
-
|
|
519
509
|
## Contributing
|
|
520
510
|
See the [contributing guide](https://github.com/jackocnr/intl-tel-input/blob/master/.github/CONTRIBUTING.md) for instructions on setting up the project and making changes, and also for how to update to a new version of libphonenumber, or how to update the flag images.
|
|
521
511
|
|
|
522
|
-
|
|
523
512
|
## Attributions
|
|
524
513
|
* Flag images from [region-flags](https://github.com/behdad/region-flags)
|
|
525
514
|
* Original country data from mledoze's [World countries in JSON, CSV and XML](https://github.com/mledoze/countries)
|
|
526
515
|
* Formatting/validation/example number code from [libphonenumber](https://github.com/googlei18n/libphonenumber)
|
|
527
516
|
* Feature contributions are listed in the wiki: [Contributions](https://github.com/jackocnr/intl-tel-input/wiki/Contributions)
|
|
528
517
|
|
|
529
|
-
|
|
530
518
|
## Links
|
|
531
519
|
* List of [integrations with intl-tel-input](https://github.com/jackocnr/intl-tel-input/wiki/Integrations)
|
|
532
520
|
|
|
533
|
-
<img width="200" src="https://www.browserstack.com/images/layout/browserstack-logo-600x315.png" /><br />
|
|
521
|
+
<img width="200" src="https://www.browserstack.com/images/layout/browserstack-logo-600x315.png" alt="BrowserStack"/><br />
|
|
534
522
|
Testing powered by [BrowserStack Open-Source Program](https://www.browserstack.com/open-source)
|
|
535
|
-
|