intl-tel-input 25.12.3 → 25.12.5
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 +97 -23
- package/angular/build/IntlTelInput.js +70 -14
- package/angular/build/IntlTelInputWithUtils.js +352 -344
- package/angular/build/types/intl-tel-input/angular.d.ts +22 -3
- package/angular/build/types/intl-tel-input/angularWithUtils.d.ts +22 -3
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.js +2 -2
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +284 -332
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/build/js/utils.js +62 -60
- package/package.json +1 -1
- package/react/README.md +16 -14
- package/react/build/IntlTelInput.cjs +1 -1
- package/react/build/IntlTelInput.js +1 -1
- package/react/build/IntlTelInputWithUtils.cjs +283 -331
- package/react/build/IntlTelInputWithUtils.js +283 -331
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +1 -1
- package/vue/build/IntlTelInputWithUtils.mjs +283 -331
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.5/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.5/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.5/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.5/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.5/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.3/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
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# IntlTelInput Angular Component
|
|
2
|
+
|
|
2
3
|
An Angular component wrapper for the [intl-tel-input](https://github.com/jackocnr/intl-tel-input) JavaScript plugin. View the [source code](https://github.com/jackocnr/intl-tel-input/blob/master/angular/src/intl-tel-input/angular.ts).
|
|
3
4
|
|
|
4
5
|
## Table of Contents
|
|
6
|
+
|
|
5
7
|
- [Demo](#demo)
|
|
6
8
|
- [Getting Started](#getting-started)
|
|
7
9
|
- [Props](#props)
|
|
@@ -10,9 +12,32 @@ An Angular component wrapper for the [intl-tel-input](https://github.com/jackocn
|
|
|
10
12
|
- [Accessing Static Methods](#accessing-static-methods)
|
|
11
13
|
|
|
12
14
|
## Demo
|
|
13
|
-
|
|
15
|
+
|
|
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.
|
|
14
38
|
|
|
15
39
|
## Getting Started
|
|
40
|
+
|
|
16
41
|
```html
|
|
17
42
|
import { IntlTelInputComponent } from "intl-tel-input/angularWithUtils";
|
|
18
43
|
import "intl-tel-input/styles";
|
|
@@ -29,58 +54,107 @@ import "intl-tel-input/styles";
|
|
|
29
54
|
|
|
30
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`.
|
|
31
56
|
|
|
32
|
-
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.5/build/js/utils.js"`.
|
|
33
58
|
|
|
34
59
|
## Props
|
|
60
|
+
|
|
35
61
|
Here's a list of all of the current props you can pass to the IntlTelInput Angular component.
|
|
36
62
|
|
|
37
|
-
**disabled
|
|
38
|
-
Type: `Boolean`, Default: `false
|
|
63
|
+
**disabled**\
|
|
64
|
+
Type: `Boolean`, Default: `false`\
|
|
39
65
|
Sets the disabled attribute of both the telephone input and selected country button. _Note: we recommend using this instead of `inputProps.disabled`._
|
|
40
66
|
|
|
41
|
-
**initialValue
|
|
42
|
-
Type: `String
|
|
67
|
+
**initialValue**\
|
|
68
|
+
Type: `String`\
|
|
43
69
|
The initial value to put in the input. This will get auto-formatted on init (according to `formatOnDisplay` initialisation option). IntlTelInput is an uncontrolled input, and so will ignore any changes to this value.
|
|
44
70
|
|
|
45
|
-
**initOptions
|
|
46
|
-
Type: `Object
|
|
71
|
+
**initOptions**\
|
|
72
|
+
Type: `Object`\
|
|
47
73
|
An object containing the [initialisation options](https://github.com/jackocnr/intl-tel-input?tab=readme-ov-file#initialisation-options) to pass to the plugin. You can use these exactly the same way as with the main JavaScript plugin.
|
|
48
74
|
|
|
49
|
-
**inputProps
|
|
50
|
-
Type: `Object
|
|
75
|
+
**inputProps**\
|
|
76
|
+
Type: `Object`\
|
|
51
77
|
The props to pass to the input element e.g. `class`, `placeholder`, `required` etc. _Note: we recommend using the separate `disabled` prop instead of `inputProps.disabled`._
|
|
52
78
|
|
|
53
|
-
**usePreciseValidation
|
|
54
|
-
Type: `Boolean`, Default: `false
|
|
79
|
+
**usePreciseValidation**\
|
|
80
|
+
Type: `Boolean`, Default: `false`\
|
|
55
81
|
By default we use `isValidNumber` for validation, but if you'd rather use `isValidNumberPrecise` you can set this to `true`.
|
|
56
82
|
|
|
57
83
|
## Events
|
|
84
|
+
|
|
58
85
|
Here's a list of all of the current events you can listen to on the IntlTelInput angular component.
|
|
59
86
|
|
|
60
|
-
**countryChange
|
|
61
|
-
Type: `Function
|
|
87
|
+
**countryChange**\
|
|
88
|
+
Type: `Function`\
|
|
62
89
|
A handler to be called when the selected country changes. It will be passed the new country iso2 code e.g. "gb" for UK.
|
|
63
90
|
|
|
64
|
-
**errorCodeChange
|
|
65
|
-
Type: `Function
|
|
91
|
+
**errorCodeChange**\
|
|
92
|
+
Type: `Function`\
|
|
66
93
|
A handler to be called when the number validation error changes. It will be passed the new error code (or `null`).
|
|
67
94
|
|
|
68
|
-
**numberChange
|
|
69
|
-
Type: `Function
|
|
95
|
+
**numberChange**\
|
|
96
|
+
Type: `Function`\
|
|
70
97
|
A handler to be called when the number changes. It will be passed the new number.
|
|
71
98
|
|
|
72
|
-
**validityChange
|
|
73
|
-
Type: `Function
|
|
99
|
+
**validityChange**\
|
|
100
|
+
Type: `Function`\
|
|
74
101
|
A handler to be called when the number validity changes e.g. to true/false. It will be passed the new isValid boolean.
|
|
75
102
|
|
|
76
103
|
### Native Input Events
|
|
77
104
|
|
|
78
|
-
|
|
105
|
+
The component exposes several commonly used native DOM events that you can bind to using Angular's standard event binding syntax `(eventName)="handlerMethod($event)"`. For other native events not listed below, you can access the input element directly (see [Other Native Events](#other-native-events) section).
|
|
106
|
+
|
|
107
|
+
#### Supported Events
|
|
108
|
+
|
|
109
|
+
The following native input events are directly supported:
|
|
110
|
+
- `blur` - Fired when the input loses focus (receives `FocusEvent`)
|
|
111
|
+
- `focus` - Fired when the input receives focus (receives `FocusEvent`)
|
|
112
|
+
- `keydown` - Fired when a key is pressed down (receives `KeyboardEvent`)
|
|
113
|
+
- `keyup` - Fired when a key is released (receives `KeyboardEvent`)
|
|
114
|
+
- `paste` - Fired when content is pasted (receives `ClipboardEvent`)
|
|
115
|
+
- `click` - Fired when the input is clicked (receives `MouseEvent`)
|
|
116
|
+
|
|
117
|
+
Example usage:
|
|
118
|
+
```html
|
|
119
|
+
<intl-tel-input
|
|
120
|
+
(blur)="handleBlur($event)"
|
|
121
|
+
(focus)="handleFocus($event)"
|
|
122
|
+
(keydown)="handleKeyDown($event)"
|
|
123
|
+
(paste)="handlePaste($event)"
|
|
124
|
+
/>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
#### Other Native Events
|
|
128
|
+
|
|
129
|
+
For any other native DOM events not listed above, you can access the input element directly using a `ViewChild` reference and add event listeners manually:
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
export class MyComponent implements AfterViewInit, OnDestroy {
|
|
133
|
+
@ViewChild('telInput') telInput!: IntlTelInputComponent;
|
|
134
|
+
|
|
135
|
+
ngAfterViewInit() {
|
|
136
|
+
const input = this.telInput.getInput();
|
|
137
|
+
input?.addEventListener('mouseenter', this.handleMouseEnter);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
ngOnDestroy() {
|
|
141
|
+
const input = this.telInput.getInput();
|
|
142
|
+
input?.removeEventListener('mouseenter', this.handleMouseEnter);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
handleMouseEnter = (event: MouseEvent) => {
|
|
146
|
+
console.log('Mouse entered input:', event);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
```
|
|
79
150
|
|
|
80
151
|
## Accessing Instance Methods
|
|
81
152
|
|
|
82
|
-
You can access all of the plugin's [instance methods](https://github.com/jackocnr/intl-tel-input/blob/master/README.md#instance-methods) (`setNumber`, `setCountry`, `setPlaceholderNumberType` etc) by using a ViewChild reference into the IntlTelInput component (using the `#ref` prop), and then calling `this.
|
|
153
|
+
You can access all of the plugin's [instance methods](https://github.com/jackocnr/intl-tel-input/blob/master/README.md#instance-methods) (`setNumber`, `setCountry`, `setPlaceholderNumberType` etc) by using a ViewChild reference into the IntlTelInput component (using the `#ref` prop), and then calling `this.ref.getInstance()` e.g. `this.ref.getInstance().setNumber(...);`. See the [Set Number demo](https://github.com/jackocnr/intl-tel-input/blob/master/angular/demo/set-number/set-number.component.ts) for a full example. You can also access the input DOM element in a similar way: `this.ref.getInput()`.
|
|
154
|
+
|
|
155
|
+
> [!IMPORTANT]
|
|
156
|
+
> You must use `ngAfterViewInit` (not `ngOnInit` or `constructor`) to access instance or input methods, as the component needs to be fully initialized first.
|
|
83
157
|
|
|
84
158
|
## Accessing Static Methods
|
|
85
159
|
|
|
86
|
-
You can access all of the plugin's [static methods](https://github.com/jackocnr/intl-tel-input/blob/master/README.md#static-methods) by importing `intlTelInput` from the same file as the angular component e.g. `import {
|
|
160
|
+
You can access all of the plugin's [static methods](https://github.com/jackocnr/intl-tel-input/blob/master/README.md#static-methods) by importing `intlTelInput` from the same file as the angular component e.g. `import { intlTelInput } from "intl-tel-input/angular"` (note the lower case "i" in "intlTelInput"). You can then use this as you would with the main plugin e.g. `intlTelInput.getCountryData()` or `intlTelInput.utils.numberType` etc.
|
|
@@ -3807,7 +3807,7 @@ var intlTelInput = Object.assign((input, options) => {
|
|
|
3807
3807
|
attachUtils,
|
|
3808
3808
|
startedLoadingUtilsScript: false,
|
|
3809
3809
|
startedLoadingAutoCountry: false,
|
|
3810
|
-
version: "25.12.
|
|
3810
|
+
version: "25.12.5"
|
|
3811
3811
|
});
|
|
3812
3812
|
var intl_tel_input_default = intlTelInput;
|
|
3813
3813
|
|
|
@@ -3828,12 +3828,17 @@ var IntlTelInputComponent = class {
|
|
|
3828
3828
|
this.initialValue = "";
|
|
3829
3829
|
this.usePreciseValidation = false;
|
|
3830
3830
|
this.inputProps = {};
|
|
3831
|
-
this.disabled = void 0;
|
|
3832
3831
|
this.initOptions = {};
|
|
3833
3832
|
this.numberChange = new EventEmitter();
|
|
3834
3833
|
this.countryChange = new EventEmitter();
|
|
3835
3834
|
this.validityChange = new EventEmitter();
|
|
3836
3835
|
this.errorCodeChange = new EventEmitter();
|
|
3836
|
+
this.blur = new EventEmitter();
|
|
3837
|
+
this.focus = new EventEmitter();
|
|
3838
|
+
this.keydown = new EventEmitter();
|
|
3839
|
+
this.keyup = new EventEmitter();
|
|
3840
|
+
this.paste = new EventEmitter();
|
|
3841
|
+
this.click = new EventEmitter();
|
|
3837
3842
|
this.iti = null;
|
|
3838
3843
|
this.countryChangeHandler = () => this.handleInput();
|
|
3839
3844
|
this.onChange = () => {
|
|
@@ -3849,11 +3854,6 @@ var IntlTelInputComponent = class {
|
|
|
3849
3854
|
}
|
|
3850
3855
|
this.inputRef.nativeElement.addEventListener("countrychange", this.countryChangeHandler);
|
|
3851
3856
|
this.applyInputProps();
|
|
3852
|
-
for (const key in this.inputProps) {
|
|
3853
|
-
if (this.inputProps.hasOwnProperty(key)) {
|
|
3854
|
-
this.inputRef.nativeElement.setAttribute(key, this.inputProps[key]);
|
|
3855
|
-
}
|
|
3856
|
-
}
|
|
3857
3857
|
}
|
|
3858
3858
|
ngAfterViewInit() {
|
|
3859
3859
|
var _a, _b;
|
|
@@ -3888,12 +3888,36 @@ var IntlTelInputComponent = class {
|
|
|
3888
3888
|
this.onChange(num);
|
|
3889
3889
|
this.onValidatorChange();
|
|
3890
3890
|
}
|
|
3891
|
-
handleBlur() {
|
|
3891
|
+
handleBlur(event) {
|
|
3892
3892
|
this.onTouched();
|
|
3893
|
+
this.blur.emit(event);
|
|
3894
|
+
}
|
|
3895
|
+
handleFocus(event) {
|
|
3896
|
+
this.focus.emit(event);
|
|
3897
|
+
}
|
|
3898
|
+
handleKeyDown(event) {
|
|
3899
|
+
this.keydown.emit(event);
|
|
3900
|
+
}
|
|
3901
|
+
handleKeyUp(event) {
|
|
3902
|
+
this.keyup.emit(event);
|
|
3893
3903
|
}
|
|
3904
|
+
handlePaste(event) {
|
|
3905
|
+
this.paste.emit(event);
|
|
3906
|
+
}
|
|
3907
|
+
handleClick(event) {
|
|
3908
|
+
this.click.emit(event);
|
|
3909
|
+
}
|
|
3910
|
+
/**
|
|
3911
|
+
* This method must be called in `ngAfterViewInit` or later lifecycle hooks,
|
|
3912
|
+
* not in `ngOnInit` or the `constructor`, as the component needs to be fully initialized.
|
|
3913
|
+
*/
|
|
3894
3914
|
getInstance() {
|
|
3895
3915
|
return this.iti;
|
|
3896
3916
|
}
|
|
3917
|
+
/**
|
|
3918
|
+
* This method must be called in `ngAfterViewInit` or later lifecycle hooks,
|
|
3919
|
+
* not in `ngOnInit` or the `constructor`, as the component needs to be fully initialized.
|
|
3920
|
+
*/
|
|
3897
3921
|
getInput() {
|
|
3898
3922
|
return this.inputRef.nativeElement;
|
|
3899
3923
|
}
|
|
@@ -3957,7 +3981,7 @@ IntlTelInputComponent.\u0275cmp = /* @__PURE__ */ i0.\u0275\u0275defineComponent
|
|
|
3957
3981
|
let _t;
|
|
3958
3982
|
i0.\u0275\u0275queryRefresh(_t = i0.\u0275\u0275loadQuery()) && (ctx.inputRef = _t.first);
|
|
3959
3983
|
}
|
|
3960
|
-
}, inputs: { initialValue: "initialValue", usePreciseValidation: "usePreciseValidation", inputProps: "inputProps", disabled: "disabled", initOptions: "initOptions" }, outputs: { numberChange: "numberChange", countryChange: "countryChange", validityChange: "validityChange", errorCodeChange: "errorCodeChange" }, features: [i0.\u0275\u0275ProvidersFeature([
|
|
3984
|
+
}, inputs: { initialValue: "initialValue", usePreciseValidation: "usePreciseValidation", inputProps: "inputProps", disabled: "disabled", initOptions: "initOptions" }, outputs: { numberChange: "numberChange", countryChange: "countryChange", validityChange: "validityChange", errorCodeChange: "errorCodeChange", blur: "blur", focus: "focus", keydown: "keydown", keyup: "keyup", paste: "paste", click: "click" }, features: [i0.\u0275\u0275ProvidersFeature([
|
|
3961
3985
|
{
|
|
3962
3986
|
provide: NG_VALUE_ACCESSOR,
|
|
3963
3987
|
useExisting: forwardRef(() => IntlTelInputComponent),
|
|
@@ -3968,16 +3992,31 @@ IntlTelInputComponent.\u0275cmp = /* @__PURE__ */ i0.\u0275\u0275defineComponent
|
|
|
3968
3992
|
useExisting: forwardRef(() => IntlTelInputComponent),
|
|
3969
3993
|
multi: true
|
|
3970
3994
|
}
|
|
3971
|
-
]), i0.\u0275\u0275NgOnChangesFeature], decls: 2, vars: 0, consts: [["inputRef", ""], ["type", "tel", 3, "input", "blur"]], template: function IntlTelInputComponent_Template(rf, ctx) {
|
|
3995
|
+
]), i0.\u0275\u0275NgOnChangesFeature], decls: 2, vars: 0, consts: [["inputRef", ""], ["type", "tel", 3, "input", "blur", "focus", "keydown", "keyup", "paste", "click"]], template: function IntlTelInputComponent_Template(rf, ctx) {
|
|
3972
3996
|
if (rf & 1) {
|
|
3973
3997
|
const _r1 = i0.\u0275\u0275getCurrentView();
|
|
3974
3998
|
i0.\u0275\u0275elementStart(0, "input", 1, 0);
|
|
3975
3999
|
i0.\u0275\u0275listener("input", function IntlTelInputComponent_Template_input_input_0_listener() {
|
|
3976
4000
|
i0.\u0275\u0275restoreView(_r1);
|
|
3977
4001
|
return i0.\u0275\u0275resetView(ctx.handleInput());
|
|
3978
|
-
})("blur", function IntlTelInputComponent_Template_input_blur_0_listener() {
|
|
4002
|
+
})("blur", function IntlTelInputComponent_Template_input_blur_0_listener($event) {
|
|
4003
|
+
i0.\u0275\u0275restoreView(_r1);
|
|
4004
|
+
return i0.\u0275\u0275resetView(ctx.handleBlur($event));
|
|
4005
|
+
})("focus", function IntlTelInputComponent_Template_input_focus_0_listener($event) {
|
|
4006
|
+
i0.\u0275\u0275restoreView(_r1);
|
|
4007
|
+
return i0.\u0275\u0275resetView(ctx.handleFocus($event));
|
|
4008
|
+
})("keydown", function IntlTelInputComponent_Template_input_keydown_0_listener($event) {
|
|
3979
4009
|
i0.\u0275\u0275restoreView(_r1);
|
|
3980
|
-
return i0.\u0275\u0275resetView(ctx.
|
|
4010
|
+
return i0.\u0275\u0275resetView(ctx.handleKeyDown($event));
|
|
4011
|
+
})("keyup", function IntlTelInputComponent_Template_input_keyup_0_listener($event) {
|
|
4012
|
+
i0.\u0275\u0275restoreView(_r1);
|
|
4013
|
+
return i0.\u0275\u0275resetView(ctx.handleKeyUp($event));
|
|
4014
|
+
})("paste", function IntlTelInputComponent_Template_input_paste_0_listener($event) {
|
|
4015
|
+
i0.\u0275\u0275restoreView(_r1);
|
|
4016
|
+
return i0.\u0275\u0275resetView(ctx.handlePaste($event));
|
|
4017
|
+
})("click", function IntlTelInputComponent_Template_input_click_0_listener($event) {
|
|
4018
|
+
i0.\u0275\u0275restoreView(_r1);
|
|
4019
|
+
return i0.\u0275\u0275resetView(ctx.handleClick($event));
|
|
3981
4020
|
});
|
|
3982
4021
|
i0.\u0275\u0275elementEnd();
|
|
3983
4022
|
}
|
|
@@ -3993,7 +4032,12 @@ IntlTelInputComponent.\u0275cmp = /* @__PURE__ */ i0.\u0275\u0275defineComponent
|
|
|
3993
4032
|
type="tel"
|
|
3994
4033
|
#inputRef
|
|
3995
4034
|
(input)="handleInput()"
|
|
3996
|
-
(blur)="handleBlur()"
|
|
4035
|
+
(blur)="handleBlur($event)"
|
|
4036
|
+
(focus)="handleFocus($event)"
|
|
4037
|
+
(keydown)="handleKeyDown($event)"
|
|
4038
|
+
(keyup)="handleKeyUp($event)"
|
|
4039
|
+
(paste)="handlePaste($event)"
|
|
4040
|
+
(click)="handleClick($event)"
|
|
3997
4041
|
/>
|
|
3998
4042
|
`,
|
|
3999
4043
|
providers: [
|
|
@@ -4030,10 +4074,22 @@ IntlTelInputComponent.\u0275cmp = /* @__PURE__ */ i0.\u0275\u0275defineComponent
|
|
|
4030
4074
|
type: Output
|
|
4031
4075
|
}], errorCodeChange: [{
|
|
4032
4076
|
type: Output
|
|
4077
|
+
}], blur: [{
|
|
4078
|
+
type: Output
|
|
4079
|
+
}], focus: [{
|
|
4080
|
+
type: Output
|
|
4081
|
+
}], keydown: [{
|
|
4082
|
+
type: Output
|
|
4083
|
+
}], keyup: [{
|
|
4084
|
+
type: Output
|
|
4085
|
+
}], paste: [{
|
|
4086
|
+
type: Output
|
|
4087
|
+
}], click: [{
|
|
4088
|
+
type: Output
|
|
4033
4089
|
}] });
|
|
4034
4090
|
})();
|
|
4035
4091
|
(() => {
|
|
4036
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.\u0275setClassDebugInfo(IntlTelInputComponent, { className: "IntlTelInputComponent", filePath: "intl-tel-input/angular.ts", lineNumber:
|
|
4092
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.\u0275setClassDebugInfo(IntlTelInputComponent, { className: "IntlTelInputComponent", filePath: "intl-tel-input/angular.ts", lineNumber: 67 });
|
|
4037
4093
|
})();
|
|
4038
4094
|
export {
|
|
4039
4095
|
IntlTelInputComponent,
|