@crodriguezdominguez/ion-intl-tel-input 2.0.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.
Files changed (31) hide show
  1. package/README.md +308 -0
  2. package/crodriguezdominguez-ion-intl-tel-input-2.0.0.tgz +0 -0
  3. package/esm2020/crodriguezdominguez-ion-intl-tel-input.mjs +5 -0
  4. package/esm2020/lib/data/countries.mjs +2006 -0
  5. package/esm2020/lib/ion-intl-tel-input/ion-intl-tel-code.component.mjs +72 -0
  6. package/esm2020/lib/ion-intl-tel-input/ion-intl-tel-input.component.mjs +747 -0
  7. package/esm2020/lib/ion-intl-tel-input.directive.mjs +68 -0
  8. package/esm2020/lib/ion-intl-tel-input.module.mjs +51 -0
  9. package/esm2020/lib/ion-intl-tel-input.service.mjs +20 -0
  10. package/esm2020/lib/models/country.model.mjs +2 -0
  11. package/esm2020/lib/models/ion-intl-tel-input.model.mjs +2 -0
  12. package/esm2020/lib/pipes/country-placeholder.mjs +38 -0
  13. package/esm2020/lib/util/util.mjs +10 -0
  14. package/esm2020/public-api.mjs +10 -0
  15. package/fesm2015/crodriguezdominguez-ion-intl-tel-input.mjs +2997 -0
  16. package/fesm2015/crodriguezdominguez-ion-intl-tel-input.mjs.map +1 -0
  17. package/fesm2020/crodriguezdominguez-ion-intl-tel-input.mjs +2994 -0
  18. package/fesm2020/crodriguezdominguez-ion-intl-tel-input.mjs.map +1 -0
  19. package/index.d.ts +5 -0
  20. package/lib/data/countries.d.ts +2 -0
  21. package/lib/ion-intl-tel-input/ion-intl-tel-code.component.d.ts +28 -0
  22. package/lib/ion-intl-tel-input/ion-intl-tel-input.component.d.ts +310 -0
  23. package/lib/ion-intl-tel-input.directive.d.ts +10 -0
  24. package/lib/ion-intl-tel-input.module.d.ts +13 -0
  25. package/lib/ion-intl-tel-input.service.d.ts +9 -0
  26. package/lib/models/country.model.d.ts +10 -0
  27. package/lib/models/ion-intl-tel-input.model.d.ts +6 -0
  28. package/lib/pipes/country-placeholder.d.ts +8 -0
  29. package/lib/util/util.d.ts +1 -0
  30. package/package.json +64 -0
  31. package/public-api.d.ts +6 -0
package/README.md ADDED
@@ -0,0 +1,308 @@
1
+ # Interstellus Ionic International Telephone Input
2
+
3
+ An Ionic component for International Phone Number Input, that allows all countries, validation with google phone lib, limited countries, preferred countries, virtual scrolling and much more.
4
+
5
+ ## Contents
6
+ - [Interstellus Ionic International Telephone Input](#interstellus-ionic-international-telephone-input)
7
+ * [Contents](#Contents)
8
+ * [Supported Ionic versions](#Supported-Ionic-Versions)
9
+ * [Getting Started](#Getting-Started)
10
+ + [Step 1: Install it.](#Step-1-Install-it)
11
+ + [Step 2: Import it.](#Step-2-Import-it)
12
+ + [Step 3: Add it to template.](#Step-3-Add-it-to-template)
13
+ + [Step 4: Configure it.](#Step-4-Configure-it)
14
+ + [Step 5: Add validation.](#Step-5-Add-validation)
15
+ + [Step 6: Configure validation.](#Step-6-Configure-validation)
16
+ * [Options](#Options)
17
+ * [Events](#Events)
18
+ * [Contributing](#Contributing)
19
+ * [Versioning](#Versioning)
20
+ * [Authors](#Authors)
21
+ * [License](#License)
22
+ * [Acknowledgments](#Acknowledgments)
23
+
24
+
25
+ ## Supported Ionic Versions
26
+
27
+ - Ionic 4 (>=4.0.0)
28
+
29
+ ## Getting Started
30
+
31
+ ### Step 1: Install it.
32
+ #### Install Independently
33
+ ```
34
+ npm install ion-intl-tel-input --save
35
+ ```
36
+
37
+ #### Or Install with All dependencies
38
+ ```
39
+ npm install ion-intl-tel-input ionic-selectable flag-icon-css google-libphonenumber --save
40
+ ```
41
+
42
+ #### Add flag styles
43
+ Add the following to your `styles` array of project in `angular.json` (located in projects root directory).
44
+ ```
45
+ {
46
+ "input": "node_modules/flag-icon-css/sass/flag-icon.scss"
47
+ }
48
+ ```
49
+
50
+ ### Step 2: Import it.
51
+
52
+ First, import `IsIonIntlTelInputModule` to your `app.module.ts` that is normally located in `src\app\app.module.ts`.
53
+
54
+ ```
55
+ import { IonIntlTelInputModule } from 'ion-intl-tel-input';
56
+
57
+ @NgModule({
58
+ imports: [
59
+ IonIntlTelInputModule
60
+ ]
61
+ })
62
+ export class AppModule { }
63
+
64
+ ```
65
+
66
+ **Note:** Additionally, if you are using lazy loaded pages. Check if your pages have a module file, for example, `home.module.ts`, and if they do then import `IsIonIntlTelInputModule` to each page module too.
67
+
68
+ ```
69
+ import { IonIntlTelInputModule } from 'ionic-selectable';
70
+ import { HomePage } from './home';
71
+
72
+ @NgModule({
73
+ declarations: [
74
+ HomePage
75
+ ],
76
+ imports: [
77
+ IonicPageModule.forChild(HomePage),
78
+ IonIntlTelInputModule
79
+ ]
80
+ })
81
+ export class HomePageModule { }
82
+ ```
83
+
84
+ ### Step 3: Add it to template.
85
+
86
+ #### a. Usage with Template Driven Forms
87
+ ```
88
+ <form>
89
+ <ion-item>
90
+ <ion-label position="stacked">Tel Input</ion-label>
91
+ <ion-intl-tel-input
92
+ id="phone-number"
93
+ name="phone-number"
94
+ [(ngModel)]="phoneNumber"
95
+ #phoneNumberControl="ngModel" >
96
+ </ion-intl-tel-input>
97
+ </ion-item>
98
+ </form>
99
+ ```
100
+
101
+ #### b. Usage with Reactive Forms
102
+ ```
103
+ <form [formGroup]="form" (ngSubmit)="onSubmit()">
104
+ <ion-item>
105
+ <ion-label position="floating">Tel Input</ion-label>
106
+ <ion-intl-tel-input
107
+ formControlName="phoneNumber" >
108
+ </ion-intl-tel-input>
109
+ </ion-item>
110
+ </form>
111
+ ```
112
+
113
+ ### Step 4: Configure it.
114
+
115
+ #### a. Usage with Template Driven Forms
116
+ ```
117
+ @Component({ ... })
118
+ export class HomePage {
119
+
120
+ phoneNumber = '';
121
+
122
+ constructor() { }
123
+ }
124
+ ```
125
+
126
+ #### b. Usage with Reactive Forms
127
+ ```
128
+
129
+ @Component({ ... })
130
+ export class HomePage implements OnInit {
131
+
132
+ formValue = {phoneNumber: '', test: ''};
133
+ form: FormGroup;
134
+
135
+ constructor() { }
136
+
137
+ ngOnInit() {
138
+ this.form = new FormGroup({
139
+ phoneNumber: new FormControl({
140
+ value: this.formValue.phoneNumber
141
+ })
142
+ });
143
+ }
144
+
145
+ get phoneNumber() { return this.form.get('phoneNumber'); }
146
+
147
+ onSubmit() {
148
+ console.log(this.phoneNumber.value);
149
+ }
150
+ }
151
+ ```
152
+
153
+ ### Step 5: Add validation.
154
+
155
+ #### a. Usage with Template Driven Forms
156
+ ```
157
+ <form>
158
+ <ion-item>
159
+ <ion-label position="stacked">Tel Input</ion-label>
160
+ <ion-intl-tel-input
161
+ id="phone-number"
162
+ name="phone-number"
163
+ [(ngModel)]="phoneNumber"
164
+ #phoneNumberControl="ngModel"
165
+ ionIntlTelInputValid >
166
+ </ion-intl-tel-input>
167
+ </ion-item>
168
+
169
+ <div *ngIf="phoneNumberControl.invalid && phoneNumberControl.touched">
170
+ <ion-text color="danger" *ngIf="phoneNumberControl.errors.required">
171
+ <p class="ion-no-margin"><sub>Phone is required.</sub></p>
172
+ </ion-text>
173
+ <ion-text color="danger" *ngIf="phoneNumberControl.errors.phone">
174
+ <p class="ion-no-margin"><sub>Phone is not valid.</sub></p>
175
+ </ion-text>
176
+ </div>
177
+ </form>
178
+ ```
179
+
180
+ #### b. Usage with Reactive Forms
181
+ ```
182
+ <form [formGroup]="form" (ngSubmit)="onSubmit()">
183
+ <ion-item>
184
+ <ion-label position="floating">Tel Input</ion-label>
185
+ <ion-intl-tel-input
186
+ formControlName="phoneNumber" >
187
+ </ion-intl-tel-input>
188
+ </ion-item>
189
+
190
+ <div *ngIf="phoneNumber.invalid && phoneNumber.touched">
191
+ <ion-text color="danger" *ngIf="phoneNumber.errors.required">
192
+ <p class="ion-no-margin"><sub>Phone is required.</sub></p>
193
+ </ion-text>
194
+ <ion-text color="danger" *ngIf="phoneNumber.errors.phone">
195
+ <p class="ion-no-margin"><sub>Phone number is not valid.</sub></p>
196
+ </ion-text>
197
+ </div>
198
+ </form>
199
+ ```
200
+
201
+ ### Step 6: Configure validation.
202
+
203
+ #### a. Usage with Template Driven Forms
204
+ ```
205
+ @Component({ ... })
206
+ export class HomePage {
207
+
208
+ phoneNumber = '';
209
+
210
+ constructor() { }
211
+ }
212
+ ```
213
+
214
+ #### b. Usage with Reactive Forms
215
+ ```
216
+ import { IonIntlTelInputValidators } from 'is-ion-intl-tel-input';
217
+
218
+ @Component({ ... })
219
+ export class HomePage implements OnInit {
220
+
221
+ formValue = {phoneNumber: '', test: ''};
222
+ form: FormGroup;
223
+
224
+ constructor() { }
225
+
226
+ ngOnInit() {
227
+ this.form = new FormGroup({
228
+ phoneNumber: new FormControl({
229
+ value: this.formValue.phoneNumber
230
+ }, [
231
+ Validators.required,
232
+ IonIntlTelInputValidators.phone
233
+ ])
234
+ });
235
+ }
236
+
237
+ get phoneNumber() { return this.form.get('phoneNumber'); }
238
+
239
+ onSubmit() {
240
+ console.log(this.phoneNumber.value);
241
+ }
242
+ }
243
+ ```
244
+
245
+ ## Options
246
+
247
+ | Option | Type | Default | Description |
248
+ | ------------------------- | -------- | ------- | ----------- |
249
+ | defaultCountryiso | string | NULL | Iso Code of default selected Country. |
250
+ | dialCodePrefix | string | + | Determines whether to use `00` or `+` as dial code prefix. Available attributes are `+` and `00`. |
251
+ | enableAutoCountrySelect | boolean | false | Determines whether to select automatic country based on user input. |
252
+ | enablePlaceholder | boolean | true | Determines whether an example number will be shown as a placeholder in input. |
253
+ | fallbackPlaceholder | string | NULL | A fallaback placeholder to be used if no example number is found for a country. |
254
+ | inputPlaceholder | string | NULL | If a custom placeholder is needed for input. If this property is set it will override `enablePlaceholder`and only this placeholder will be shown. |
255
+ | maxLength | string | 15 | Maximum Length for input. |
256
+ | modalTitle | string | Select Country | Title of modal opened to select country dial code. |
257
+ | modalCssClass | string | NULL | CSS class to attach to dial code selection modal. |
258
+ | modalSearchPlaceholder | string | Enter country name | Placeholder for input in dial code selection modal. |
259
+ | modalCloseText | string | Close | Text for close button in dial code selection modal. |
260
+ | modalCloseButtonSlot | string | end | Slot for close button in dial code selection modal. [Ionic slots](https://ionicframework.com/docs/api/item) are supported. |
261
+ | modalCanSearch | boolean | true | Determines whether dial code selection modal should be searchable or not. |
262
+ | modalShouldBackdropClose | boolean | true | Determines whether dial code selection modal is closed on backdrop click. |
263
+ | modalShouldFocusSearchbar | boolean | true | Determines whether input should be focused when dial code selection modal is opened. |
264
+ | modalSearchFailText | string | No countries found | Determines whether input should be focused when dial code selection modal is opened. |
265
+ | onlyCountries | string[] | [] | List of iso codes of manually selected countries as string, which will appear in the dropdown. **Note**: `onlyCountries` should be a string array of country iso codes. |
266
+ | preferredCountries | string[] | [] | List of iso codes as string of countries, which will appear at the top in dial code selection modal. **Note**: `preferredCountries` should be a string array of country iso codes.
267
+ | selectFirstCountry | boolean | true | Determines whether first country should be selected in dial code select or not. |
268
+ | separateDialCode | boolean | true | Determines whether to visually separate dialcode into the drop down element. |
269
+
270
+ ## Events
271
+
272
+ | Event Name | Type | Description |
273
+ | -------------- | ------------------- | ----------- |
274
+ | numberChange | `EventEmitter<any>` | Fires when the Phone number Input is changed. |
275
+ | numberBlur | `EventEmitter<any>` | Fires when the Phone number Input is blurred. |
276
+ | numberFocus | `EventEmitter<any>` | Fires when the Phone number Input is focused. |
277
+ | numberInput | `EventEmitter<any>` | Fires when the user is typing in Phone number Input. |
278
+ | codeChange | `EventEmitter<any>` | Fires when the dial code selection is changed. |
279
+ | codeOpen | `EventEmitter<any>` | Fires when the dial code selection modal is opened. |
280
+ | codeClose | `EventEmitter<any>` | Fires when the dial code selection modal is closed. |
281
+ | codeSelect | `EventEmitter<any>` | Fires when a dial code is selected in dial code selection modal. |
282
+
283
+ ## Contributing
284
+
285
+ This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
286
+
287
+ ## Versioning
288
+
289
+ We use [SemVer](http://semver.org/) for versioning.
290
+
291
+ ## Authors
292
+
293
+ * **Azzam Asghar** - *Initial work* - [Azzam Asghar](https://github.com/azzamasghar1)
294
+
295
+ See also the list of [contributors](https://github.com/azzamasghar1/is-ion-intl-tel-input/contributors) who participated in this project.
296
+
297
+ ## License
298
+
299
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details
300
+
301
+ ## Acknowledgments
302
+
303
+ This project would never have been possible without the following great plugins:
304
+ * [Ionic Selectable](https://github.com/eakoriakin/ionic-selectable) by [@eakoriakin](https://github.com/eakoriakin)
305
+ * [International Telephone Input for Angular (NgxIntlTelInput)](https://github.com/webcat12345/ngx-intl-tel-input) by [@webcat12345](https://github.com/webcat12345)
306
+ * [flag-icon-css](https://github.com/lipis/flag-icon-css) by [@lipis](https://github.com/lipis)
307
+
308
+ So please do go ahead and give them a star for their efforts.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './public-api';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JvZHJpZ3VlemRvbWluZ3Vlei1pb24taW50bC10ZWwtaW5wdXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9wcm9qZWN0cy9pb24taW50bC10ZWwtaW5wdXQvc3JjL2Nyb2RyaWd1ZXpkb21pbmd1ZXotaW9uLWludGwtdGVsLWlucHV0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxjQUFjLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vcHVibGljLWFwaSc7XG4iXX0=