intl-tel-input 26.4.1 → 26.5.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.
Files changed (33) hide show
  1. package/README.md +1 -1
  2. package/angular/README.md +2 -160
  3. package/angular/build/IntlTelInput.js +236 -184
  4. package/angular/build/IntlTelInputWithUtils.js +236 -184
  5. package/angular/build/types/intl-tel-input.d.ts +1 -7
  6. package/angular/build/types/modules/core/numerals.d.ts +8 -0
  7. package/angular/build/types/modules/core/ui.d.ts +13 -1
  8. package/angular/build/types/modules/data/intl-regionless.d.ts +2 -0
  9. package/build/js/data.js +1 -1
  10. package/build/js/data.min.js +1 -1
  11. package/build/js/intlTelInput.d.ts +28 -8
  12. package/build/js/intlTelInput.js +248 -192
  13. package/build/js/intlTelInput.min.js +6 -6
  14. package/build/js/intlTelInputWithUtils.js +248 -192
  15. package/build/js/intlTelInputWithUtils.min.js +6 -6
  16. package/package.json +1 -1
  17. package/react/README.md +2 -95
  18. package/react/build/IntlTelInput.cjs +247 -191
  19. package/react/build/IntlTelInput.d.ts +28 -8
  20. package/react/build/IntlTelInput.js +247 -191
  21. package/react/build/IntlTelInputWithUtils.cjs +247 -191
  22. package/react/build/IntlTelInputWithUtils.js +247 -191
  23. package/svelte/README.md +3 -75
  24. package/svelte/build/IntlTelInput.mjs +1429 -1392
  25. package/svelte/build/IntlTelInputWithUtils.mjs +1661 -1624
  26. package/vue/README.md +2 -82
  27. package/vue/build/exports/IntlTelInput.mjs +1 -1
  28. package/vue/build/exports/IntlTelInputWithUtils.mjs +1 -1
  29. package/vue/build/{intl-tel-input-7v8EGiVH.mjs → intl-tel-input-08bxCgwi.mjs} +359 -322
  30. package/vue/build/intl-tel-input.d.ts +1 -7
  31. package/vue/build/modules/core/numerals.d.ts +8 -0
  32. package/vue/build/modules/core/ui.d.ts +13 -1
  33. package/vue/build/modules/data/intl-regionless.d.ts +2 -0
package/README.md CHANGED
@@ -16,7 +16,7 @@ A JavaScript plugin for entering, formatting and validating international teleph
16
16
  Use [Twilio's API to build phone verification, SMS 2FA, appointment reminders, marketing notifications and so much more](https://www.twilio.com/blog/international-telephone-input-twilio?utm_source=github&utm_medium=referral&utm_campaign=intl_tel_input). We can't wait to see what you build.
17
17
 
18
18
  ## React, Vue, Angular and Svelte Components
19
- We provide React, Vue, Angular and Svelte (beta) components alongside the regular JavaScript plugin. This readme is for the JavaScript plugin. View the [React Component](https://github.com/jackocnr/intl-tel-input/blob/master/react/README.md), the [Vue Component](https://github.com/jackocnr/intl-tel-input/blob/master/vue/README.md) the [Angular Component](https://github.com/jackocnr/intl-tel-input/blob/master/angular/README.md), or the [Svelte component (beta)](https://github.com/jackocnr/intl-tel-input/blob/master/svelte/README.md).
19
+ We provide React, Vue, Angular and Svelte (beta) components alongside the regular JavaScript plugin. This readme is for the JavaScript plugin. View the [React Component](https://intl-tel-input.com/docs/react-component), the [Vue Component](https://intl-tel-input.com/docs/vue-component) the [Angular Component](https://intl-tel-input.com/docs/angular-component), or the [Svelte component](https://intl-tel-input.com/docs/svelte-component).
20
20
 
21
21
  ## Docs and Examples
22
22
  We have a newly updated website, where you can find [a full set of docs](https://intl-tel-input.com/docs/getting-started.html), a [live playground](https://intl-tel-input.com/playground/) where you can try out all of the options, as well as plenty of [examples](https://intl-tel-input.com/examples/validation-practical.html) of different setups.
package/angular/README.md CHANGED
@@ -1,163 +1,5 @@
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
+ An Angular component 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).
4
4
 
5
- ## Table of Contents
6
-
7
- - [Demo](#demo)
8
- - [Getting Started](#getting-started)
9
- - [Props](#props)
10
- - [Events](#events)
11
- - [Accessing Instance Methods](#accessing-instance-methods)
12
- - [Accessing Static Methods](#accessing-static-methods)
13
-
14
- ## Demo
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
- # Initialise 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.
38
-
39
- ## Getting Started
40
-
41
- ```html
42
- import { IntlTelInputComponent } from "intl-tel-input/angularWithUtils";
43
- import "intl-tel-input/styles";
44
-
45
- <intl-tel-input
46
- #telInput
47
- (numberChange)="handleNumberChange($event)"
48
- (validityChange)="handleValidityChange($event)"
49
- [initOptions]="{
50
- initialCountry: 'us',
51
- }"
52
- />
53
- ```
54
-
55
- > [!NOTE]
56
- > You can also import the CSS in your Angular workspace configuration (`angular.json`). See Angular's [Styles and scripts configuration](https://angular.dev/reference/configs/workspace-config#styles-and-scripts-configuration) documentation.
57
-
58
- 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`.
59
-
60
- 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 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@26.4.1/build/js/utils.js"`.
61
-
62
- ## Props
63
-
64
- Here's a list of all of the current props you can pass to the IntlTelInput Angular component.
65
-
66
- **disabled**\
67
- Type: `Boolean`, Default: `false`\
68
- Sets the disabled attribute of both the telephone input and the selected country button. _Note: We recommend using this instead of `inputProps.disabled`._
69
-
70
- **initialValue**\
71
- Type: `String`\
72
- 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.
73
-
74
- **initOptions**\
75
- Type: `Object`\
76
- 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.
77
-
78
- **inputProps**\
79
- Type: `Object`\
80
- 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`._
81
-
82
- **usePreciseValidation**\
83
- Type: `Boolean`, Default: `false`\
84
- By default, we use `isValidNumber` for validation, but if you'd rather use `isValidNumberPrecise`, you can set this to `true`.
85
-
86
- ## Events
87
-
88
- Here's a list of all of the current events you can listen to on the IntlTelInput angular component.
89
-
90
- **countryChange**\
91
- Type: `Function`\
92
- A handler to be called when the selected country changes. It will be passed the new country iso2 code, e.g. "gb" for the UK.
93
-
94
- **errorCodeChange**\
95
- Type: `Function`\
96
- A handler to be called when the number validation error changes. It will be passed the new error code (or `null`).
97
-
98
- **numberChange**\
99
- Type: `Function`\
100
- A handler to be called when the number changes. It will be passed the new number.
101
-
102
- **validityChange**\
103
- Type: `Function`\
104
- A handler to be called when the number validity changes, e.g. to true/false. It will be passed the new isValid boolean.
105
-
106
- ### Native Input Events
107
-
108
- 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).
109
-
110
- #### Supported Events
111
-
112
- The following native input events are directly supported:
113
- - `blur` - Fired when the input loses focus (receives `FocusEvent`)
114
- - `focus` - Fired when the input receives focus (receives `FocusEvent`)
115
- - `keydown` - Fired when a key is pressed down (receives `KeyboardEvent`)
116
- - `keyup` - Fired when a key is released (receives `KeyboardEvent`)
117
- - `paste` - Fired when content is pasted (receives `ClipboardEvent`)
118
- - `click` - Fired when the input is clicked (receives `MouseEvent`)
119
-
120
- Example usage:
121
- ```html
122
- <intl-tel-input
123
- (blur)="handleBlur($event)"
124
- (focus)="handleFocus($event)"
125
- (keydown)="handleKeyDown($event)"
126
- (paste)="handlePaste($event)"
127
- />
128
- ```
129
-
130
- #### Other Native Events
131
-
132
- 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:
133
-
134
- ```typescript
135
- export class MyComponent implements AfterViewInit, OnDestroy {
136
- @ViewChild('telInput') telInput!: IntlTelInputComponent;
137
-
138
- ngAfterViewInit() {
139
- const input = this.telInput.getInput();
140
- input?.addEventListener('mouseenter', this.handleMouseEnter);
141
- }
142
-
143
- ngOnDestroy() {
144
- const input = this.telInput.getInput();
145
- input?.removeEventListener('mouseenter', this.handleMouseEnter);
146
- }
147
-
148
- handleMouseEnter = (event: MouseEvent) => {
149
- console.log('Mouse entered input:', event);
150
- }
151
- }
152
- ```
153
-
154
- ## Accessing Instance Methods
155
-
156
- You can access all of the plugin's [instance methods](https://intl-tel-input.com/docs/methods.html#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()`.
157
-
158
- > [!IMPORTANT]
159
- > You must use `ngAfterViewInit` (not `ngOnInit` or `constructor`) to access instance or input methods, as the component needs to be fully initialised first.
160
-
161
- ## Accessing Static Methods
162
-
163
- You can access all of the plugin's [static methods](https://intl-tel-input.com/docs/methods.html#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.
5
+ [Explore docs »](https://intl-tel-input.com/docs/angular-component)