intl-tel-input 25.14.1 → 26.0.0-beta.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 +27 -43
- package/angular/README.md +1 -1
- package/angular/build/IntlTelInput.js +78 -324
- package/angular/build/IntlTelInputWithUtils.js +78 -324
- package/angular/build/types/intl-tel-input/i18n/ar/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/bg/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/bn/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/bs/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/ca/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/cs/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/da/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/de/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/ee/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/el/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/en/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/es/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/fa/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/fi/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/fr/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/hi/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/hr/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/hu/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/id/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/index.d.ts +43 -43
- package/angular/build/types/intl-tel-input/i18n/it/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/ja/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/ko/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/lt/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/mr/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/nl/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/no/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/pl/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/pt/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/ro/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/ru/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/sk/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/sl/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/sq/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/sr/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/sv/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/te/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/th/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/tr/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/types.d.ts +2 -4
- package/angular/build/types/intl-tel-input/i18n/uk/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/ur/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/uz/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/vi/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input/i18n/zh/index.d.ts +3 -6
- package/angular/build/types/intl-tel-input.d.ts +1 -1
- package/angular/build/types/modules/constants.d.ts +1 -1
- package/angular/build/types/modules/core/icons.d.ts +2 -0
- package/angular/build/types/modules/core/options.d.ts +1 -2
- package/angular/build/types/modules/core/ui.d.ts +2 -3
- package/angular/build/types/modules/data/country-data.d.ts +2 -2
- package/angular/build/types/modules/format/formatting.d.ts +2 -2
- package/angular/build/types/modules/types/public-api.d.ts +3 -1
- package/build/css/demo.css +1 -3
- package/build/css/intlTelInput-no-assets.css +1257 -0
- package/build/css/intlTelInput-no-assets.min.css +1 -0
- package/build/css/intlTelInput.css +21 -22
- 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/i18n/ar/index.js +23 -5
- package/build/js/i18n/bg/index.js +17 -5
- package/build/js/i18n/bn/index.js +17 -5
- package/build/js/i18n/bs/index.js +23 -5
- package/build/js/i18n/ca/index.js +17 -5
- package/build/js/i18n/cs/index.js +20 -5
- package/build/js/i18n/da/index.js +17 -5
- package/build/js/i18n/de/index.js +17 -5
- package/build/js/i18n/ee/index.js +17 -5
- package/build/js/i18n/el/index.js +17 -5
- package/build/js/i18n/en/index.js +18 -5
- package/build/js/i18n/es/index.js +17 -5
- package/build/js/i18n/fa/index.js +17 -5
- package/build/js/i18n/fi/index.js +17 -5
- package/build/js/i18n/fr/index.js +17 -5
- package/build/js/i18n/hi/index.js +17 -5
- package/build/js/i18n/hr/index.js +23 -5
- package/build/js/i18n/hu/index.js +17 -5
- package/build/js/i18n/id/index.js +17 -5
- package/build/js/i18n/index.js +43 -43
- package/build/js/i18n/it/index.js +17 -5
- package/build/js/i18n/ja/index.js +17 -5
- package/build/js/i18n/ko/index.js +17 -5
- package/build/js/i18n/lt/index.js +26 -5
- package/build/js/i18n/mr/index.js +17 -5
- package/build/js/i18n/nl/index.js +17 -5
- package/build/js/i18n/no/index.js +17 -5
- package/build/js/i18n/pl/index.js +21 -5
- package/build/js/i18n/pt/index.js +17 -5
- package/build/js/i18n/ro/index.js +21 -5
- package/build/js/i18n/ru/index.js +23 -5
- package/build/js/i18n/sk/index.js +23 -5
- package/build/js/i18n/sl/index.js +25 -5
- package/build/js/i18n/sq/index.js +18 -5
- package/build/js/i18n/sr/index.js +24 -5
- package/build/js/i18n/sv/index.js +17 -5
- package/build/js/i18n/te/index.js +17 -5
- package/build/js/i18n/th/index.js +17 -5
- package/build/js/i18n/tr/index.js +17 -5
- package/build/js/i18n/uk/index.js +23 -5
- package/build/js/i18n/ur/index.js +17 -5
- package/build/js/i18n/uz/index.js +17 -5
- package/build/js/i18n/vi/index.js +17 -5
- package/build/js/i18n/zh/index.js +17 -5
- package/build/js/intlTelInput.d.ts +118 -677
- package/build/js/intlTelInput.js +79 -329
- package/build/js/intlTelInput.min.js +8 -4
- package/build/js/intlTelInputWithUtils.js +79 -329
- package/build/js/intlTelInputWithUtils.min.js +7 -3
- package/package.json +10 -4
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +78 -328
- package/react/build/IntlTelInput.d.ts +118 -677
- package/react/build/IntlTelInput.js +78 -328
- package/react/build/IntlTelInputWithUtils.cjs +78 -328
- package/react/build/IntlTelInputWithUtils.js +78 -328
- package/svelte/README.md +1 -1
- package/svelte/build/IntlTelInput.mjs +1170 -1413
- package/svelte/build/IntlTelInputWithUtils.mjs +935 -1178
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.vue.d.ts +34 -0
- package/vue/build/IntlTelInputWithUtils.vue.d.ts +34 -0
- package/vue/build/exports/IntlTelInput.d.ts +3 -0
- package/vue/build/exports/IntlTelInput.mjs +66 -0
- package/vue/build/exports/IntlTelInputWithUtils.d.ts +3 -0
- package/vue/build/{IntlTelInputWithUtils.mjs → exports/IntlTelInputWithUtils.mjs} +533 -3866
- package/vue/build/{IntlTelInput.mjs → intl-tel-input-BY4WpieT.mjs} +403 -720
- package/vue/build/intl-tel-input.d.ts +97 -0
- package/vue/build/modules/constants.d.ts +85 -0
- package/vue/build/modules/core/countrySearch.d.ts +17 -0
- package/vue/build/modules/core/icons.d.ts +9 -0
- package/vue/build/modules/core/options.d.ts +3 -0
- package/vue/build/modules/core/ui.d.ts +45 -0
- package/vue/build/modules/data/country-data.d.ts +12 -0
- package/vue/build/modules/data/nanp-regionless.d.ts +2 -0
- package/vue/build/modules/format/caret.d.ts +1 -0
- package/vue/build/modules/format/formatting.d.ts +3 -0
- package/vue/build/modules/types/events.d.ts +9 -0
- package/vue/build/modules/types/public-api.d.ts +79 -0
- package/vue/build/modules/utils/dom.d.ts +6 -0
- package/vue/build/modules/utils/string.d.ts +2 -0
- package/build/js/i18n/ar/countries.js +0 -245
- package/build/js/i18n/ar/interface.js +0 -23
- package/build/js/i18n/bg/countries.js +0 -245
- package/build/js/i18n/bg/interface.js +0 -13
- package/build/js/i18n/bn/countries.js +0 -245
- package/build/js/i18n/bn/interface.js +0 -13
- package/build/js/i18n/bs/countries.js +0 -245
- package/build/js/i18n/bs/interface.js +0 -20
- package/build/js/i18n/ca/countries.js +0 -245
- package/build/js/i18n/ca/interface.js +0 -13
- package/build/js/i18n/cs/countries.js +0 -245
- package/build/js/i18n/cs/interface.js +0 -20
- package/build/js/i18n/da/countries.js +0 -245
- package/build/js/i18n/da/interface.js +0 -13
- package/build/js/i18n/de/countries.js +0 -245
- package/build/js/i18n/de/interface.js +0 -13
- package/build/js/i18n/ee/countries.js +0 -245
- package/build/js/i18n/ee/interface.js +0 -13
- package/build/js/i18n/el/countries.js +0 -245
- package/build/js/i18n/el/interface.js +0 -13
- package/build/js/i18n/en/countries.js +0 -245
- package/build/js/i18n/en/interface.js +0 -14
- package/build/js/i18n/es/countries.js +0 -245
- package/build/js/i18n/es/interface.js +0 -13
- package/build/js/i18n/fa/countries.js +0 -245
- package/build/js/i18n/fa/interface.js +0 -13
- package/build/js/i18n/fi/countries.js +0 -245
- package/build/js/i18n/fi/interface.js +0 -13
- package/build/js/i18n/fr/countries.js +0 -245
- package/build/js/i18n/fr/interface.js +0 -13
- package/build/js/i18n/hi/countries.js +0 -245
- package/build/js/i18n/hi/interface.js +0 -13
- package/build/js/i18n/hr/countries.js +0 -245
- package/build/js/i18n/hr/interface.js +0 -20
- package/build/js/i18n/hu/countries.js +0 -245
- package/build/js/i18n/hu/interface.js +0 -13
- package/build/js/i18n/id/countries.js +0 -245
- package/build/js/i18n/id/interface.js +0 -13
- package/build/js/i18n/it/countries.js +0 -245
- package/build/js/i18n/it/interface.js +0 -13
- package/build/js/i18n/ja/countries.js +0 -245
- package/build/js/i18n/ja/interface.js +0 -13
- package/build/js/i18n/ko/countries.js +0 -245
- package/build/js/i18n/ko/interface.js +0 -13
- package/build/js/i18n/lt/countries.js +0 -245
- package/build/js/i18n/lt/interface.js +0 -26
- package/build/js/i18n/mr/countries.js +0 -245
- package/build/js/i18n/mr/interface.js +0 -13
- package/build/js/i18n/nl/countries.js +0 -245
- package/build/js/i18n/nl/interface.js +0 -13
- package/build/js/i18n/no/countries.js +0 -245
- package/build/js/i18n/no/interface.js +0 -13
- package/build/js/i18n/pl/countries.js +0 -245
- package/build/js/i18n/pl/interface.js +0 -19
- package/build/js/i18n/pt/countries.js +0 -245
- package/build/js/i18n/pt/interface.js +0 -13
- package/build/js/i18n/ro/countries.js +0 -245
- package/build/js/i18n/ro/interface.js +0 -18
- package/build/js/i18n/ru/countries.js +0 -245
- package/build/js/i18n/ru/interface.js +0 -20
- package/build/js/i18n/sk/countries.js +0 -245
- package/build/js/i18n/sk/interface.js +0 -20
- package/build/js/i18n/sl/countries.js +0 -245
- package/build/js/i18n/sl/interface.js +0 -25
- package/build/js/i18n/sq/countries.js +0 -245
- package/build/js/i18n/sq/interface.js +0 -14
- package/build/js/i18n/sr/countries.js +0 -245
- package/build/js/i18n/sr/interface.js +0 -21
- package/build/js/i18n/sv/countries.js +0 -245
- package/build/js/i18n/sv/interface.js +0 -13
- package/build/js/i18n/te/countries.js +0 -245
- package/build/js/i18n/te/interface.js +0 -13
- package/build/js/i18n/th/countries.js +0 -245
- package/build/js/i18n/th/interface.js +0 -13
- package/build/js/i18n/tr/countries.js +0 -245
- package/build/js/i18n/tr/interface.js +0 -13
- package/build/js/i18n/uk/countries.js +0 -245
- package/build/js/i18n/uk/interface.js +0 -20
- package/build/js/i18n/ur/countries.js +0 -245
- package/build/js/i18n/ur/interface.js +0 -13
- package/build/js/i18n/uz/countries.js +0 -245
- package/build/js/i18n/uz/interface.js +0 -13
- package/build/js/i18n/vi/countries.js +0 -245
- package/build/js/i18n/vi/interface.js +0 -13
- package/build/js/i18n/zh/countries.js +0 -245
- package/build/js/i18n/zh/interface.js +0 -13
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.
|
|
84
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@25.15.0/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.
|
|
89
|
+
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@25.15.0/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.
|
|
93
|
+
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.15.0/build/js/utils.js"),
|
|
94
94
|
});
|
|
95
95
|
</script>
|
|
96
96
|
```
|
|
@@ -100,13 +100,11 @@ _Note: We have now dropped support for all versions of Internet Explorer because
|
|
|
100
100
|
|
|
101
101
|
2. Import the CSS: `import 'intl-tel-input/build/css/intlTelInput.css';`
|
|
102
102
|
|
|
103
|
-
3. Set the path to flags.webp
|
|
103
|
+
3. Set the path to flags.webp in your CSS, by overriding the CSS variables
|
|
104
104
|
```css
|
|
105
105
|
.iti {
|
|
106
106
|
--iti-path-flags-1x: url('path/to/flags.webp');
|
|
107
107
|
--iti-path-flags-2x: url('path/to/flags@2x.webp');
|
|
108
|
-
--iti-path-globe-1x: url('path/to/globe.webp');
|
|
109
|
-
--iti-path-globe-2x: url('path/to/globe@2x.webp');
|
|
110
108
|
}
|
|
111
109
|
```
|
|
112
110
|
|
|
@@ -130,13 +128,11 @@ Most bundlers (such as Webpack, Vite, or Parcel) will see this and place the [ut
|
|
|
130
128
|
<link rel="stylesheet" href="path/to/intlTelInput.css">
|
|
131
129
|
```
|
|
132
130
|
|
|
133
|
-
3. Set the path to flags.webp
|
|
131
|
+
3. Set the path to flags.webp in your CSS, by overriding the CSS variables
|
|
134
132
|
```css
|
|
135
133
|
.iti {
|
|
136
134
|
--iti-path-flags-1x: url('path/to/flags.webp');
|
|
137
135
|
--iti-path-flags-2x: url('path/to/flags@2x.webp');
|
|
138
|
-
--iti-path-globe-1x: url('path/to/globe.webp');
|
|
139
|
-
--iti-path-globe-2x: url('path/to/globe@2x.webp');
|
|
140
136
|
}
|
|
141
137
|
```
|
|
142
138
|
|
|
@@ -169,6 +165,10 @@ When you initialise the plugin, the first argument is the input element, and the
|
|
|
169
165
|
Type: `Boolean` Default: `true`
|
|
170
166
|
Whether or not to allow the dropdown. If disabled, there is no dropdown arrow, and the selected country is not clickable. Also, if showFlags is enabled, we display the selected flag on the right instead, because it is just a marker of state. Note that if `separateDialCode` is enabled, `allowDropdown` is forced to `true` as the dropdown is required when the user types "+" in this case. Play with this option on [Storybook](https://intl-tel-input.com/storybook/?path=/docs/intltelinput--allowdropdown) (using the React component).
|
|
171
167
|
|
|
168
|
+
**allowNumberExtensions**.
|
|
169
|
+
Type: `Boolean` Default: `false`
|
|
170
|
+
Whether or not the validation methods return `true` for numbers containing extensions, e.g. "+1 702 123-1234 ext. 1234".
|
|
171
|
+
|
|
172
172
|
**allowPhonewords**
|
|
173
173
|
Type: `Boolean` Default: `false`
|
|
174
174
|
Whether or not the validation methods return `true` for numbers containing phonewords, e.g. "+1 702 FLOWERS".
|
|
@@ -261,9 +261,9 @@ 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
|
|
264
|
+
Allows you to specify translation strings for the user interface text (e.g. the placeholder text for the country search input) or to override any country names (generated with `Intl.DisplayNames`). 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 the `i18n` initialisation option 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, see the required UI strings listed below. [See example](https://intl-tel-input.com/examples/localise-countries.html).
|
|
265
265
|
|
|
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
|
|
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.
|
|
267
267
|
|
|
268
268
|
Option 1: import one of the provided translation modules
|
|
269
269
|
```js
|
|
@@ -286,13 +286,6 @@ Option 2: define your own custom translations
|
|
|
286
286
|
```js
|
|
287
287
|
intlTelInput(input, {
|
|
288
288
|
i18n: {
|
|
289
|
-
// Country names - see the full list in src/js/intl-tel-input/i18n/en/countries.ts
|
|
290
|
-
af: "Afghanistan",
|
|
291
|
-
al: "Albania",
|
|
292
|
-
dz: "Algeria",
|
|
293
|
-
as: "American Samoa",
|
|
294
|
-
ad: "Andorra",
|
|
295
|
-
...
|
|
296
289
|
// Aria label for the selected country element, when there is a country selected
|
|
297
290
|
selectedCountryAriaLabel: "Change country, selected ${countryName} (${dialCode})",
|
|
298
291
|
// Aria label and title text for the selected country element, when no country is selected
|
|
@@ -303,18 +296,13 @@ intlTelInput(input, {
|
|
|
303
296
|
searchPlaceholder: "Search",
|
|
304
297
|
// Aria label for the clear search button
|
|
305
298
|
clearSearchAriaLabel: "Clear search",
|
|
306
|
-
// Visible text
|
|
307
|
-
|
|
308
|
-
// Screen reader
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
multipleSearchResults: "${count} results found",
|
|
312
|
-
// OPTIONAL: For more complex pluralisation cases, e.g. Polish or Arabic, you can implement your own logic, like below. In this case, you can omit the "one" and "multiple" keys above.
|
|
313
|
-
searchResultsText(count) {
|
|
314
|
-
// NOTE: zero results are always handled by "zeroSearchResults" above
|
|
299
|
+
// Visible text for when the search produces no results
|
|
300
|
+
searchEmptyState: "No results found",
|
|
301
|
+
// Screen reader summary of search results
|
|
302
|
+
searchSummaryAria(count) {
|
|
303
|
+
if (count === 0) return "No results found";
|
|
315
304
|
if (count === 1) return "1 result found";
|
|
316
|
-
|
|
317
|
-
return `Many ${count} results found`;
|
|
305
|
+
return `${count} results found`;
|
|
318
306
|
}
|
|
319
307
|
}
|
|
320
308
|
});
|
|
@@ -328,12 +316,12 @@ Set the initial country selection by specifying its country code, e.g. `"us"` fo
|
|
|
328
316
|
Type: `() => Promise<module>` Default: `null`
|
|
329
317
|
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
318
|
|
|
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.
|
|
319
|
+
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.15.0/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
320
|
|
|
333
321
|
```js
|
|
334
322
|
// (A) import utils module from a CDN
|
|
335
323
|
intlTelInput(htmlInputElement, {
|
|
336
|
-
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.
|
|
324
|
+
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.15.0/build/js/utils.js"),
|
|
337
325
|
});
|
|
338
326
|
|
|
339
327
|
// (B) import utils module from your own hosted version of utils.js
|
|
@@ -376,15 +364,15 @@ __Note: if the user enters their number with autofill or by copying and pasting
|
|
|
376
364
|
|
|
377
365
|
**strictMode**
|
|
378
366
|
Type: `Boolean` Default: `false`
|
|
379
|
-
As the user types in the input, ignore any irrelevant characters. The user can only enter numeric characters and an optional plus at the beginning. Cap the length at the maximum valid number length (this respects `
|
|
367
|
+
As the user types in the input, ignore any irrelevant characters. The user can only enter numeric characters and an optional plus at the beginning. Cap the length at the maximum valid number length (this respects `allowedNumberTypes`). Requires the [utils script to be loaded](#loading-the-utilities-script). [See example](https://intl-tel-input.com/examples/strict-mode.html).
|
|
380
368
|
|
|
381
369
|
**useFullscreenPopup**
|
|
382
370
|
Type: `Boolean` Default: `true on mobile devices, false otherwise`
|
|
383
371
|
Control when the country list appears as a fullscreen popup vs an inline dropdown. By default, it will appear as a fullscreen popup on mobile devices (based on user-agent and screen width), to make better use of the limited space (similar to how a native `<select>` works), and as an inline dropdown on larger devices/screens. Play with this option on [Storybook](https://intl-tel-input.com/storybook/?path=/docs/intltelinput--usefullscreenpopup) (using the React component).
|
|
384
372
|
|
|
385
|
-
**
|
|
386
|
-
Type: `String[]` Default: `["MOBILE"]`
|
|
387
|
-
Specify an array of [the keys](https://github.com/jackocnr/intl-tel-input/blob/master/src/js/utils.js#L198) from the enum `intlTelInput.utils.numberType` to set the number type(s) to enforce during validation, as well as the number length to enforce with `strictMode`. Set it to `null` to not enforce any particular type. By default, it's set to `["MOBILE"]` so `isValidNumber` will only return `true` for
|
|
373
|
+
**allowedNumberTypes**
|
|
374
|
+
Type: `String[]` Default: `["MOBILE", "FIXED_LINE"]`
|
|
375
|
+
Specify an array of [the keys](https://github.com/jackocnr/intl-tel-input/blob/master/src/js/utils.js#L198) from the enum `intlTelInput.utils.numberType` to set the number type(s) to enforce during validation, as well as the number length to enforce with `strictMode`. Set it to `null` to not enforce any particular type. By default, it's set to `["MOBILE", "FIXED_LINE"]` so `isValidNumber` (etc) will only return `true` for those kinds of numbers. Alternatively, you could set it to simply `["MOBILE"]` if you only wanted to accept mobile numbers as valid. _Note: previously named `validationNumberTypes`._
|
|
388
376
|
|
|
389
377
|
## Instance Methods
|
|
390
378
|
In these examples, `iti` refers to the plugin instance which gets returned when you initialise the plugin, e.g.
|
|
@@ -454,7 +442,7 @@ if (error === intlTelInput.utils.validationError.TOO_SHORT) {
|
|
|
454
442
|
```
|
|
455
443
|
|
|
456
444
|
**isValidNumber**
|
|
457
|
-
(Note: only returns `true` for valid <ins>mobile numbers</ins> by default - see `
|
|
445
|
+
(Note: only returns `true` for valid <ins>mobile numbers</ins> by default - see `allowedNumberTypes`)
|
|
458
446
|
Check if the current number is valid based on its length - [see example](https://intl-tel-input.com/examples/validation-practical.html), which should be sufficient for most use cases. See `isValidNumberPrecise` (DANGEROUS) for more precise validation, but the advantage of `isValidNumber` is that it is much more future-proof, as while countries around the world regularly update their number rules, they rarely change their number lengths. If this method returns `false`, you can use `getValidationError` to get more information. Requires the [utils script to be loaded](#loading-the-utilities-script).
|
|
459
447
|
```js
|
|
460
448
|
const isValid = iti.isValidNumber();
|
|
@@ -462,7 +450,7 @@ const isValid = iti.isValidNumber();
|
|
|
462
450
|
Returns: `true`/`false`
|
|
463
451
|
|
|
464
452
|
**isValidNumberPrecise** ⚠️ DANGEROUS
|
|
465
|
-
(Note: only returns `true` for valid <ins>mobile numbers</ins> by default - see `
|
|
453
|
+
(Note: only returns `true` for valid <ins>mobile numbers</ins> by default - see `allowedNumberTypes`)
|
|
466
454
|
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 constantly keep the plugin up-to-date (e.g. via an automated script) else <ins>you will start rejecting valid numbers</ins>. 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).
|
|
467
455
|
```js
|
|
468
456
|
const isValid = iti.isValidNumberPrecise();
|
|
@@ -545,8 +533,6 @@ This is triggered when the user closes the dropdown.
|
|
|
545
533
|
## Theming / Dark Mode
|
|
546
534
|
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.
|
|
547
535
|
|
|
548
|
-
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).
|
|
549
|
-
|
|
550
536
|
Dark mode example (with screenshot below):
|
|
551
537
|
```css
|
|
552
538
|
@media (prefers-color-scheme: dark) {
|
|
@@ -554,10 +540,8 @@ Dark mode example (with screenshot below):
|
|
|
554
540
|
--iti-border-color: #5b5b5b;
|
|
555
541
|
--iti-dialcode-color: #999999;
|
|
556
542
|
--iti-dropdown-bg: #0d1117;
|
|
557
|
-
--iti-
|
|
543
|
+
--iti-icon-color: #aaaaaa;
|
|
558
544
|
--iti-hover-color: #30363d;
|
|
559
|
-
--iti-path-globe-1x: url("path/to/globe_light.webp");
|
|
560
|
-
--iti-path-globe-2x: url("path/to/globe_light@2x.webp");
|
|
561
545
|
}
|
|
562
546
|
}
|
|
563
547
|
```
|
|
@@ -587,7 +571,7 @@ We provide [translations](https://github.com/jackocnr/intl-tel-input/tree/master
|
|
|
587
571
|
|
|
588
572
|
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
573
|
|
|
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
|
|
574
|
+
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.
|
|
591
575
|
|
|
592
576
|
## Utilities Script
|
|
593
577
|
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:
|
package/angular/README.md
CHANGED
|
@@ -54,7 +54,7 @@ import "intl-tel-input/styles";
|
|
|
54
54
|
|
|
55
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`.
|
|
56
56
|
|
|
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.
|
|
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.15.0/build/js/utils.js"`.
|
|
58
58
|
|
|
59
59
|
## Props
|
|
60
60
|
|