intl-tel-input 24.0.0 → 24.0.2
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 +13 -10
- package/build/css/intlTelInput.css +253 -363
- package/build/css/intlTelInput.min.css +1 -1
- package/build/img/flags.png +0 -0
- package/build/img/flags.webp +0 -0
- package/build/img/flags@2x.png +0 -0
- package/build/img/flags@2x.webp +0 -0
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.js +5 -4
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +5 -4
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/package.json +1 -1
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +4 -3
- package/react/build/IntlTelInput.js +4 -3
- package/react/build/IntlTelInputWithUtils.cjs +4 -3
- package/react/build/IntlTelInputWithUtils.js +4 -3
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ You can view [a live demo](https://intl-tel-input.com) and see some examples of
|
|
|
45
45
|
## Mobile
|
|
46
46
|
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).
|
|
47
47
|
|
|
48
|
-
<img src="https://raw.github.com/jackocnr/intl-tel-input/master/screenshots/mobile
|
|
48
|
+
<img src="https://raw.github.com/jackocnr/intl-tel-input/master/screenshots/mobile.png" alt="Mobile screenshot" width="270px" style="max-width: 100%" />
|
|
49
49
|
|
|
50
50
|
## Features
|
|
51
51
|
* Automatically select the user's current country using an IP lookup
|
|
@@ -73,16 +73,16 @@ _Note: We have now dropped support for all versions of Internet Explorer because
|
|
|
73
73
|
## Getting Started (Using a CDN)
|
|
74
74
|
1. Add the CSS
|
|
75
75
|
```html
|
|
76
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@24.0.
|
|
76
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@24.0.2/build/css/intlTelInput.css">
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
2. Add the plugin script and initialise it on your input element
|
|
80
80
|
```html
|
|
81
|
-
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@24.0.
|
|
81
|
+
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@24.0.2/build/js/intlTelInput.min.js"></script>
|
|
82
82
|
<script>
|
|
83
83
|
const input = document.querySelector("#phone");
|
|
84
84
|
window.intlTelInput(input, {
|
|
85
|
-
utilsScript: "https://cdn.jsdelivr.net/npm/intl-tel-input@24.0.
|
|
85
|
+
utilsScript: "https://cdn.jsdelivr.net/npm/intl-tel-input@24.0.2/build/js/utils.js",
|
|
86
86
|
});
|
|
87
87
|
</script>
|
|
88
88
|
```
|
|
@@ -332,7 +332,7 @@ Control when the country list appears as a fullscreen popup vs an inline dropdow
|
|
|
332
332
|
|
|
333
333
|
**utilsScript**
|
|
334
334
|
Type: `String` Default: `""` Example: `"/build/js/utils.js"`
|
|
335
|
-
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 `utilsScript` 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.0.
|
|
335
|
+
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 `utilsScript` 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.0.2/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. The script is only fetched when you initialise the plugin, and additionally, only when the page has finished loading (on the window load event) to prevent blocking (the script is ~260KB). 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.
|
|
336
336
|
|
|
337
337
|
**validationNumberType**
|
|
338
338
|
Type: `String` Default: `"MOBILE"`
|
|
@@ -492,11 +492,11 @@ This is triggered when the user opens the dropdown.
|
|
|
492
492
|
This is triggered when the user closes the dropdown.
|
|
493
493
|
|
|
494
494
|
## Theming / Dark Mode
|
|
495
|
-
There are lots of CSS variables available for theming. See [intlTelInput.scss](https://github.com/jackocnr/intl-tel-input/blob/master/src/css/intlTelInput.scss) for
|
|
495
|
+
There are lots of CSS variables available for theming. See [intlTelInput.scss](https://github.com/jackocnr/intl-tel-input/blob/master/src/css/intlTelInput.scss) for the full list.
|
|
496
496
|
|
|
497
|
-
|
|
497
|
+
As for the empty state (globe icon), the default version is dark grey, and we also provide a "light" version, that should work better with a dark theme. Alternatively, it's easy to [re-generate the globe icon](https://free-icon-rainbow.com/international-call-free-icon) in whatever colour you need for your theme. We recommend you download it in the highest resolution possible, and then scale the image down to the required sizes (20px wide for the default version and 40px wide for the @2x version).
|
|
498
498
|
|
|
499
|
-
Dark mode example:
|
|
499
|
+
Dark mode example (with screenshot below):
|
|
500
500
|
```css
|
|
501
501
|
@media (prefers-color-scheme: dark) {
|
|
502
502
|
.iti {
|
|
@@ -528,6 +528,9 @@ NOTE: this assumes you already have your own dark mode styling in place for gene
|
|
|
528
528
|
}
|
|
529
529
|
```
|
|
530
530
|
|
|
531
|
+
Example:
|
|
532
|
+
<img src="https://raw.github.com/jackocnr/intl-tel-input/master/screenshots/dark-mode.png" alt="Screenshot" width="269px" height="284px" />
|
|
533
|
+
|
|
531
534
|
## Utilities Script
|
|
532
535
|
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:
|
|
533
536
|
|
|
@@ -547,7 +550,7 @@ The utils script provides lots of great functionality (see above section), but c
|
|
|
547
550
|
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"`.
|
|
548
551
|
|
|
549
552
|
**Option 2: utilsScript**
|
|
550
|
-
If you *are* concerned about filesize, you can lazy load the utils script when the plugin intitialises, using the `utilsScript` 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 `utilsScript` 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.0.
|
|
553
|
+
If you *are* concerned about filesize, you can lazy load the utils script when the plugin intitialises, using the `utilsScript` 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 `utilsScript` 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.0.2/build/js/utils.js"`. If you want more control over when this file is lazy loaded, you can manually invoke the `loadUtils` static method, instead of using `utilsScript`.
|
|
551
554
|
|
|
552
555
|
## Troubleshooting
|
|
553
556
|
|
|
@@ -593,7 +596,7 @@ _Note: there is currently [a bug](https://bugs.webkit.org/show_bug.cgi?id=141822
|
|
|
593
596
|
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, how to update the flag images, or how to add a new translation.
|
|
594
597
|
|
|
595
598
|
## Attributions
|
|
596
|
-
* Flag images from [
|
|
599
|
+
* Flag images from [flag-icons](https://github.com/lipis/flag-icons)
|
|
597
600
|
* Original country data from mledoze's [World countries in JSON, CSV and XML](https://github.com/mledoze/countries)
|
|
598
601
|
* Formatting/validation/example number code from [libphonenumber](https://github.com/googlei18n/libphonenumber)
|
|
599
602
|
* Feature contributions are listed in the wiki: [Contributions](https://github.com/jackocnr/intl-tel-input/wiki/Contributions)
|