ngx-dial-input 2.0.2 → 2.0.3

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 (37) hide show
  1. package/README.md +9 -12
  2. package/data/countries.d.ts +2 -0
  3. package/data/countries.model.d.ts +9 -0
  4. package/esm2020/data/countries.mjs +1218 -0
  5. package/esm2020/data/countries.model.mjs +2 -0
  6. package/esm2020/lib/phone-input.component.mjs +302 -0
  7. package/esm2020/lib/phone-input.module.mjs +24 -0
  8. package/esm2020/ngx-dial-input.mjs +5 -0
  9. package/esm2020/public-api.mjs +6 -0
  10. package/fesm2015/ngx-dial-input.mjs +1555 -0
  11. package/fesm2015/ngx-dial-input.mjs.map +1 -0
  12. package/fesm2020/ngx-dial-input.mjs +1551 -0
  13. package/fesm2020/ngx-dial-input.mjs.map +1 -0
  14. package/index.d.ts +5 -0
  15. package/lib/phone-input.component.d.ts +37 -0
  16. package/lib/phone-input.module.d.ts +9 -0
  17. package/package.json +32 -49
  18. package/{projects/phone-input/src/public-api.ts → public-api.d.ts} +0 -3
  19. package/.editorconfig +0 -16
  20. package/.vscode/extensions.json +0 -4
  21. package/.vscode/launch.json +0 -20
  22. package/.vscode/tasks.json +0 -42
  23. package/angular.json +0 -41
  24. package/projects/phone-input/README.md +0 -24
  25. package/projects/phone-input/ng-package.json +0 -7
  26. package/projects/phone-input/package.json +0 -9
  27. package/projects/phone-input/src/data/countries.model.ts +0 -9
  28. package/projects/phone-input/src/data/countries.ts +0 -1219
  29. package/projects/phone-input/src/lib/phone-input.component.css +0 -0
  30. package/projects/phone-input/src/lib/phone-input.component.html +0 -0
  31. package/projects/phone-input/src/lib/phone-input.component.ts +0 -348
  32. package/projects/phone-input/src/lib/phone-input.module.ts +0 -15
  33. package/projects/phone-input/src/lib/phone-input.service.spec.ts +0 -16
  34. package/projects/phone-input/tsconfig.lib.json +0 -15
  35. package/projects/phone-input/tsconfig.lib.prod.json +0 -10
  36. package/projects/phone-input/tsconfig.spec.json +0 -14
  37. package/tsconfig.json +0 -33
@@ -0,0 +1,1555 @@
1
+ import * as i0 from '@angular/core';
2
+ import { EventEmitter, forwardRef, Component, Input, Output, HostListener, NgModule } from '@angular/core';
3
+ import * as i2 from '@angular/forms';
4
+ import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
5
+ import { trigger, state, style, transition, animate } from '@angular/animations';
6
+ import * as i1 from '@angular/common';
7
+ import { CommonModule } from '@angular/common';
8
+
9
+ const countries = [
10
+ {
11
+ name: 'Pakistan',
12
+ native: 'پاکستان',
13
+ iso2: 'pk',
14
+ dialCode: '+92',
15
+ format: '+92 ### #######',
16
+ flag: 'https://flagcdn.com/w40/pk.png',
17
+ phoneLength: 10
18
+ },
19
+ {
20
+ name: 'South Korea',
21
+ native: '대한민국',
22
+ iso2: 'kr',
23
+ dialCode: '+82',
24
+ format: '+82 ## #### ####',
25
+ flag: 'https://flagcdn.com/w40/kr.png',
26
+ phoneLength: 10
27
+ },
28
+ {
29
+ name: 'United States',
30
+ native: 'United States',
31
+ iso2: 'us',
32
+ dialCode: '+1',
33
+ format: '+1 (###) ###-####',
34
+ flag: 'https://flagcdn.com/w40/us.png',
35
+ phoneLength: 10
36
+ },
37
+ {
38
+ name: 'United Kingdom',
39
+ native: 'United Kingdom',
40
+ iso2: 'gb',
41
+ dialCode: '+44',
42
+ format: '+44 #### ### ###',
43
+ flag: 'https://flagcdn.com/w40/gb.png',
44
+ phoneLength: 10
45
+ },
46
+ {
47
+ name: 'India',
48
+ native: 'भारत',
49
+ iso2: 'in',
50
+ dialCode: '+91',
51
+ format: '+91 #### ######',
52
+ flag: 'https://flagcdn.com/w40/in.png',
53
+ phoneLength: 10
54
+ },
55
+ {
56
+ name: 'China',
57
+ native: '中国',
58
+ iso2: 'cn',
59
+ dialCode: '+86',
60
+ format: '+86 #### #### ####',
61
+ flag: 'https://flagcdn.com/w40/cn.png',
62
+ phoneLength: 11
63
+ },
64
+ {
65
+ name: 'Japan',
66
+ native: '日本',
67
+ iso2: 'jp',
68
+ dialCode: '+81',
69
+ format: '+81 ##-####-####',
70
+ flag: 'https://flagcdn.com/w40/jp.png',
71
+ phoneLength: 10
72
+ },
73
+ {
74
+ name: 'Germany',
75
+ native: 'Deutschland',
76
+ iso2: 'de',
77
+ dialCode: '+49',
78
+ format: '+49 ## #### ####',
79
+ flag: 'https://flagcdn.com/w40/de.png',
80
+ phoneLength: 10
81
+ },
82
+ {
83
+ name: 'France',
84
+ native: 'France',
85
+ iso2: 'fr',
86
+ dialCode: '+33',
87
+ format: '+33 # ## ## ## ##',
88
+ flag: 'https://flagcdn.com/w40/fr.png',
89
+ phoneLength: 9
90
+ },
91
+ {
92
+ name: 'Brazil',
93
+ native: 'Brasil',
94
+ iso2: 'br',
95
+ dialCode: '+55',
96
+ format: '+55 ## ####-####',
97
+ flag: 'https://flagcdn.com/w40/br.png',
98
+ phoneLength: 11
99
+ },
100
+ {
101
+ name: 'Italy',
102
+ native: 'Italia',
103
+ iso2: 'it',
104
+ dialCode: '+39',
105
+ format: '+39 ## #### ####',
106
+ flag: 'https://flagcdn.com/w40/it.png',
107
+ phoneLength: 10
108
+ },
109
+ {
110
+ name: 'Spain',
111
+ native: 'España',
112
+ iso2: 'es',
113
+ dialCode: '+34',
114
+ format: '+34 ## ## ## ##',
115
+ flag: 'https://flagcdn.com/w40/es.png',
116
+ phoneLength: 9
117
+ },
118
+ {
119
+ name: 'Mexico',
120
+ native: 'México',
121
+ iso2: 'mx',
122
+ dialCode: '+52',
123
+ format: '+52 ## #### ####',
124
+ flag: 'https://flagcdn.com/w40/mx.png',
125
+ phoneLength: 10
126
+ },
127
+ {
128
+ name: 'Russia',
129
+ native: 'Россия',
130
+ iso2: 'ru',
131
+ dialCode: '+7',
132
+ format: '+7 (###) ###-##-##',
133
+ flag: 'https://flagcdn.com/w40/ru.png',
134
+ phoneLength: 10
135
+ },
136
+ {
137
+ name: 'Turkey',
138
+ native: 'Türkiye',
139
+ iso2: 'tr',
140
+ dialCode: '+90',
141
+ format: '+90 (###) ###-##-##',
142
+ flag: 'https://flagcdn.com/w40/tr.png',
143
+ phoneLength: 10
144
+ },
145
+ {
146
+ name: 'Indonesia',
147
+ native: 'Indonesia',
148
+ iso2: 'id',
149
+ dialCode: '+62',
150
+ format: '+62 ## #### ####',
151
+ flag: 'https://flagcdn.com/w40/id.png',
152
+ phoneLength: 10
153
+ },
154
+ {
155
+ name: 'Nigeria',
156
+ native: 'Nigeria',
157
+ iso2: 'ng',
158
+ dialCode: '+234',
159
+ format: '+234 ## ### ####',
160
+ flag: 'https://flagcdn.com/w40/ng.png',
161
+ phoneLength: 10
162
+ },
163
+ {
164
+ name: 'South Africa',
165
+ native: 'South Africa',
166
+ iso2: 'za',
167
+ dialCode: '+27',
168
+ format: '+27 ## ### ####',
169
+ flag: 'https://flagcdn.com/w40/za.png',
170
+ phoneLength: 9
171
+ },
172
+ {
173
+ name: 'Argentina',
174
+ native: 'Argentina',
175
+ iso2: 'ar',
176
+ dialCode: '+54',
177
+ format: '+54 ## ####-####',
178
+ flag: 'https://flagcdn.com/w40/ar.png',
179
+ phoneLength: 10
180
+ },
181
+ {
182
+ name: 'Philippines',
183
+ native: 'Pilipinas',
184
+ iso2: 'ph',
185
+ dialCode: '+63',
186
+ format: '+63 ## #### ####',
187
+ flag: 'https://flagcdn.com/w40/ph.png',
188
+ phoneLength: 10
189
+ },
190
+ {
191
+ name: 'Vietnam',
192
+ native: 'Việt Nam',
193
+ iso2: 'vn',
194
+ dialCode: '+84',
195
+ format: '+84 ## #### ####',
196
+ flag: 'https://flagcdn.com/w40/vn.png',
197
+ phoneLength: 9
198
+ },
199
+ {
200
+ name: 'Thailand',
201
+ native: 'ประเทศไทย',
202
+ iso2: 'th',
203
+ dialCode: '+66',
204
+ format: '+66 ## #### ####',
205
+ flag: 'https://flagcdn.com/w40/th.png',
206
+ phoneLength: 9
207
+ },
208
+ {
209
+ name: 'Egypt',
210
+ native: 'مصر',
211
+ iso2: 'eg',
212
+ dialCode: '+20',
213
+ format: '+20 ## #### ####',
214
+ flag: 'https://flagcdn.com/w40/eg.png',
215
+ phoneLength: 10
216
+ },
217
+ {
218
+ name: 'Colombia',
219
+ native: 'Colombia',
220
+ iso2: 'co',
221
+ dialCode: '+57',
222
+ format: '+57 ## #### ####',
223
+ flag: 'https://flagcdn.com/w40/co.png',
224
+ phoneLength: 10
225
+ },
226
+ {
227
+ name: 'Kenya',
228
+ native: 'Kenya',
229
+ iso2: 'ke',
230
+ dialCode: '+254',
231
+ format: '+254 ## ### ####',
232
+ flag: 'https://flagcdn.com/w40/ke.png',
233
+ phoneLength: 9
234
+ },
235
+ {
236
+ name: 'Malaysia',
237
+ native: 'Malaysia',
238
+ iso2: 'my',
239
+ dialCode: '+60',
240
+ format: '+60 ## #### ####',
241
+ flag: 'https://flagcdn.com/w40/my.png',
242
+ phoneLength: 9
243
+ },
244
+ {
245
+ name: 'Saudi Arabia',
246
+ native: 'المملكة العربية السعودية',
247
+ iso2: 'sa',
248
+ dialCode: '+966',
249
+ format: '+966 ## #### ####',
250
+ flag: 'https://flagcdn.com/w40/sa.png',
251
+ phoneLength: 9
252
+ },
253
+ {
254
+ name: 'Peru',
255
+ native: 'Perú',
256
+ iso2: 'pe',
257
+ dialCode: '+51',
258
+ format: '+51 ## #### ####',
259
+ flag: 'https://flagcdn.com/w40/pe.png',
260
+ phoneLength: 9
261
+ },
262
+ {
263
+ name: 'Chile',
264
+ native: 'Chile',
265
+ iso2: 'cl',
266
+ dialCode: '+56',
267
+ format: '+56 ## #### ####',
268
+ flag: 'https://flagcdn.com/w40/cl.png',
269
+ phoneLength: 9
270
+ },
271
+ {
272
+ name: 'Ukraine',
273
+ native: 'Україна',
274
+ iso2: 'ua',
275
+ dialCode: '+380',
276
+ format: '+380 ## ### ## ##',
277
+ flag: 'https://flagcdn.com/w40/ua.png',
278
+ phoneLength: 9
279
+ },
280
+ {
281
+ name: 'Iraq',
282
+ native: 'العراق',
283
+ iso2: 'iq',
284
+ dialCode: '+964',
285
+ format: '+964 ## #### ####',
286
+ flag: 'https://flagcdn.com/w40/iq.png',
287
+ phoneLength: 10
288
+ },
289
+ {
290
+ name: 'Morocco',
291
+ native: 'المغرب',
292
+ iso2: 'ma',
293
+ dialCode: '+212',
294
+ format: '+212 ## ### ####',
295
+ flag: 'https://flagcdn.com/w40/ma.png',
296
+ phoneLength: 9
297
+ },
298
+ {
299
+ name: 'Algeria',
300
+ native: 'الجزائر',
301
+ iso2: 'dz',
302
+ dialCode: '+213',
303
+ format: '+213 ## ## ## ##',
304
+ flag: 'https://flagcdn.com/w40/dz.png',
305
+ phoneLength: 9
306
+ },
307
+ {
308
+ name: 'Kazakhstan',
309
+ native: 'Қазақстан',
310
+ iso2: 'kz',
311
+ dialCode: '+7',
312
+ format: '+7 (###) ###-##-##',
313
+ flag: 'https://flagcdn.com/w40/kz.png',
314
+ phoneLength: 10
315
+ },
316
+ {
317
+ name: 'Ethiopia',
318
+ native: 'ኢትዮጵያ',
319
+ iso2: 'et',
320
+ dialCode: '+251',
321
+ format: '+251 ## #### ####',
322
+ flag: 'https://flagcdn.com/w40/et.png',
323
+ phoneLength: 9
324
+ },
325
+ {
326
+ name: 'Sudan',
327
+ native: 'السودان',
328
+ iso2: 'sd',
329
+ dialCode: '+249',
330
+ format: '+249 ## ### ####',
331
+ flag: 'https://flagcdn.com/w40/sd.png',
332
+ phoneLength: 9
333
+ },
334
+ {
335
+ name: 'Angola',
336
+ native: 'Angola',
337
+ iso2: 'ao',
338
+ dialCode: '+244',
339
+ format: '+244 ## ### ####',
340
+ flag: 'https://flagcdn.com/w40/ao.png',
341
+ phoneLength: 9
342
+ },
343
+ {
344
+ name: 'Ghana',
345
+ native: 'Ghana',
346
+ iso2: 'gh',
347
+ dialCode: '+233',
348
+ format: '+233 ## ### ####',
349
+ flag: 'https://flagcdn.com/w40/gh.png',
350
+ phoneLength: 9
351
+ },
352
+ {
353
+ name: 'Uganda',
354
+ native: 'Uganda',
355
+ iso2: 'ug',
356
+ dialCode: '+256',
357
+ format: '+256 ## ### ####',
358
+ flag: 'https://flagcdn.com/w40/ug.png',
359
+ phoneLength: 9
360
+ },
361
+ {
362
+ name: 'Nepal',
363
+ native: 'नेपाल',
364
+ iso2: 'np',
365
+ dialCode: '+977',
366
+ format: '+977 ## #### ####',
367
+ flag: 'https://flagcdn.com/w40/np.png',
368
+ phoneLength: 10
369
+ },
370
+ {
371
+ name: 'Venezuela',
372
+ native: 'Venezuela',
373
+ iso2: 've',
374
+ dialCode: '+58',
375
+ format: '+58 ##-###-####',
376
+ flag: 'https://flagcdn.com/w40/ve.png',
377
+ phoneLength: 10
378
+ },
379
+ {
380
+ name: 'Sri Lanka',
381
+ native: 'ශ්‍රී ලංකාව',
382
+ iso2: 'lk',
383
+ dialCode: '+94',
384
+ format: '+94 ## #### ####',
385
+ flag: 'https://flagcdn.com/w40/lk.png',
386
+ phoneLength: 9
387
+ },
388
+ {
389
+ name: 'Tanzania',
390
+ native: 'Tanzania',
391
+ iso2: 'tz',
392
+ dialCode: '+255',
393
+ format: '+255 ## ### ####',
394
+ flag: 'https://flagcdn.com/w40/tz.png',
395
+ phoneLength: 9
396
+ },
397
+ {
398
+ name: 'Zimbabwe',
399
+ native: 'Zimbabwe',
400
+ iso2: 'zw',
401
+ dialCode: '+263',
402
+ format: '+263 ## ### ####',
403
+ flag: 'https://flagcdn.com/w40/zw.png',
404
+ phoneLength: 9
405
+ },
406
+ {
407
+ name: 'Czech Republic',
408
+ native: 'Česká republika',
409
+ iso2: 'cz',
410
+ dialCode: '+420',
411
+ format: '+420 ## ### ###',
412
+ flag: 'https://flagcdn.com/w40/cz.png',
413
+ phoneLength: 9
414
+ },
415
+ {
416
+ name: 'Finland',
417
+ native: 'Suomi',
418
+ iso2: 'fi',
419
+ dialCode: '+358',
420
+ format: '+358 ## #### ####',
421
+ flag: 'https://flagcdn.com/w40/fi.png',
422
+ phoneLength: 10
423
+ },
424
+ {
425
+ name: 'Sweden',
426
+ native: 'Sverige',
427
+ iso2: 'se',
428
+ dialCode: '+46',
429
+ format: '+46 ## ### ## ##',
430
+ flag: 'https://flagcdn.com/w40/se.png',
431
+ phoneLength: 9
432
+ },
433
+ {
434
+ name: 'Norway',
435
+ native: 'Norge',
436
+ iso2: 'no',
437
+ dialCode: '+47',
438
+ format: '+47 ## ## ## ##',
439
+ flag: 'https://flagcdn.com/w40/no.png',
440
+ phoneLength: 8
441
+ },
442
+ {
443
+ name: 'Denmark',
444
+ native: 'Danmark',
445
+ iso2: 'dk',
446
+ dialCode: '+45',
447
+ format: '+45 ## ## ## ##',
448
+ flag: 'https://flagcdn.com/w40/dk.png',
449
+ phoneLength: 8
450
+ },
451
+ {
452
+ name: 'Austria',
453
+ native: 'Österreich',
454
+ iso2: 'at',
455
+ dialCode: '+43',
456
+ format: '+43 ## #### ####',
457
+ flag: 'https://flagcdn.com/w40/at.png',
458
+ phoneLength: 10
459
+ },
460
+ {
461
+ name: 'Belgium',
462
+ native: 'België',
463
+ iso2: 'be',
464
+ dialCode: '+32',
465
+ format: '+32 ## ## ## ##',
466
+ flag: 'https://flagcdn.com/w40/be.png',
467
+ phoneLength: 9
468
+ },
469
+ {
470
+ name: 'Switzerland',
471
+ native: 'Schweiz',
472
+ iso2: 'ch',
473
+ dialCode: '+41',
474
+ format: '+41 ## ### ####',
475
+ flag: 'https://flagcdn.com/w40/ch.png',
476
+ phoneLength: 9
477
+ },
478
+ {
479
+ name: 'Portugal',
480
+ native: 'Portugal',
481
+ iso2: 'pt',
482
+ dialCode: '+351',
483
+ format: '+351 ## ### ####',
484
+ flag: 'https://flagcdn.com/w40/pt.png',
485
+ phoneLength: 9
486
+ },
487
+ {
488
+ name: 'Ireland',
489
+ native: 'Éire',
490
+ iso2: 'ie',
491
+ dialCode: '+353',
492
+ format: '+353 ## ### ####',
493
+ flag: 'https://flagcdn.com/w40/ie.png',
494
+ phoneLength: 9
495
+ },
496
+ {
497
+ name: 'Hungary',
498
+ native: 'Magyarország',
499
+ iso2: 'hu',
500
+ dialCode: '+36',
501
+ format: '+36 ## ### ####',
502
+ flag: 'https://flagcdn.com/w40/hu.png',
503
+ phoneLength: 9
504
+ },
505
+ {
506
+ name: 'Romania',
507
+ native: 'România',
508
+ iso2: 'ro',
509
+ dialCode: '+40',
510
+ format: '+40 ## #### ####',
511
+ flag: 'https://flagcdn.com/w40/ro.png',
512
+ phoneLength: 9
513
+ },
514
+ {
515
+ name: 'Slovakia',
516
+ native: 'Slovensko',
517
+ iso2: 'sk',
518
+ dialCode: '+421',
519
+ format: '+421 ## ### ###',
520
+ flag: 'https://flagcdn.com/w40/sk.png',
521
+ phoneLength: 9
522
+ },
523
+ {
524
+ name: 'Bulgaria',
525
+ native: 'България',
526
+ iso2: 'bg',
527
+ dialCode: '+359',
528
+ format: '+359 ## ### ####',
529
+ flag: 'https://flagcdn.com/w40/bg.png',
530
+ phoneLength: 9
531
+ },
532
+ {
533
+ name: 'Croatia',
534
+ native: 'Hrvatska',
535
+ iso2: 'hr',
536
+ dialCode: '+385',
537
+ format: '+385 ## ### ####',
538
+ flag: 'https://flagcdn.com/w40/hr.png',
539
+ phoneLength: 9
540
+ },
541
+ {
542
+ name: 'Serbia',
543
+ native: 'Србија',
544
+ iso2: 'rs',
545
+ dialCode: '+381',
546
+ format: '+381 ## ### ####',
547
+ flag: 'https://flagcdn.com/w40/rs.png',
548
+ phoneLength: 9
549
+ },
550
+ {
551
+ name: 'Slovenia',
552
+ native: 'Slovenija',
553
+ iso2: 'si',
554
+ dialCode: '+386',
555
+ format: '+386 ## ### ####',
556
+ flag: 'https://flagcdn.com/w40/si.png',
557
+ phoneLength: 8
558
+ },
559
+ {
560
+ name: 'Lithuania',
561
+ native: 'Lietuva',
562
+ iso2: 'lt',
563
+ dialCode: '+370',
564
+ format: '+370 ## ### ####',
565
+ flag: 'https://flagcdn.com/w40/lt.png',
566
+ phoneLength: 8
567
+ },
568
+ {
569
+ name: 'Latvia',
570
+ native: 'Latvija',
571
+ iso2: 'lv',
572
+ dialCode: '+371',
573
+ format: '+371 ## ### ####',
574
+ flag: 'https://flagcdn.com/w40/lv.png',
575
+ phoneLength: 8
576
+ },
577
+ {
578
+ name: 'Estonia',
579
+ native: 'Eesti',
580
+ iso2: 'ee',
581
+ dialCode: '+372',
582
+ format: '+372 ## ### ####',
583
+ flag: 'https://flagcdn.com/w40/ee.png',
584
+ phoneLength: 8
585
+ },
586
+ {
587
+ name: 'Moldova',
588
+ native: 'Moldova',
589
+ iso2: 'md',
590
+ dialCode: '+373',
591
+ format: '+373 ## ### ###',
592
+ flag: 'https://flagcdn.com/w40/md.png',
593
+ phoneLength: 8
594
+ },
595
+ {
596
+ name: 'Belarus',
597
+ native: 'Беларусь',
598
+ iso2: 'by',
599
+ dialCode: '+375',
600
+ format: '+375 ## ### ####',
601
+ flag: 'https://flagcdn.com/w40/by.png',
602
+ phoneLength: 9
603
+ },
604
+ {
605
+ name: 'Bosnia and Herzegovina',
606
+ native: 'Bosna i Hercegovina',
607
+ iso2: 'ba',
608
+ dialCode: '+387',
609
+ format: '+387 ## ### ####',
610
+ flag: 'https://flagcdn.com/w40/ba.png',
611
+ phoneLength: 8
612
+ },
613
+ {
614
+ name: 'North Macedonia',
615
+ native: 'Северна Македонија',
616
+ iso2: 'mk',
617
+ dialCode: '+389',
618
+ format: '+389 ## ### ####',
619
+ flag: 'https://flagcdn.com/w40/mk.png',
620
+ phoneLength: 8
621
+ },
622
+ {
623
+ name: 'Georgia',
624
+ native: 'საქართველო',
625
+ iso2: 'ge',
626
+ dialCode: '+995',
627
+ format: '+995 ## ### ####',
628
+ flag: 'https://flagcdn.com/w40/ge.png',
629
+ phoneLength: 9
630
+ },
631
+ {
632
+ name: 'Armenia',
633
+ native: 'Հայաստան',
634
+ iso2: 'am',
635
+ dialCode: '+374',
636
+ format: '+374 ## ### ####',
637
+ flag: 'https://flagcdn.com/w40/am.png',
638
+ phoneLength: 8
639
+ },
640
+ {
641
+ name: 'Azerbaijan',
642
+ native: 'Azərbaycan',
643
+ iso2: 'az',
644
+ dialCode: '+994',
645
+ format: '+994 ## ### ## ##',
646
+ flag: 'https://flagcdn.com/w40/az.png',
647
+ phoneLength: 9
648
+ },
649
+ {
650
+ name: 'Kyrgyzstan',
651
+ native: 'Кыргызстан',
652
+ iso2: 'kg',
653
+ dialCode: '+996',
654
+ format: '+996 ## ### ####',
655
+ flag: 'https://flagcdn.com/w40/kg.png',
656
+ phoneLength: 9
657
+ },
658
+ {
659
+ name: 'Uzbekistan',
660
+ native: 'O‘zbekiston',
661
+ iso2: 'uz',
662
+ dialCode: '+998',
663
+ format: '+998 ## ### ## ##',
664
+ flag: 'https://flagcdn.com/w40/uz.png',
665
+ phoneLength: 9
666
+ },
667
+ {
668
+ name: 'Turkmenistan',
669
+ native: 'Türkmenistan',
670
+ iso2: 'tm',
671
+ dialCode: '+993',
672
+ format: '+993 ## ### ## ##',
673
+ flag: 'https://flagcdn.com/w40/tm.png',
674
+ phoneLength: 8
675
+ },
676
+ {
677
+ name: 'Tajikistan',
678
+ native: 'Тоҷикистон',
679
+ iso2: 'tj',
680
+ dialCode: '+992',
681
+ format: '+992 ## ### ####',
682
+ flag: 'https://flagcdn.com/w40/tj.png',
683
+ phoneLength: 9
684
+ },
685
+ {
686
+ name: 'Mongolia',
687
+ native: 'Монгол улс',
688
+ iso2: 'mn',
689
+ dialCode: '+976',
690
+ format: '+976 ## #### ####',
691
+ flag: 'https://flagcdn.com/w40/mn.png',
692
+ phoneLength: 8
693
+ },
694
+ {
695
+ name: 'Myanmar',
696
+ native: 'မြန်မာ',
697
+ iso2: 'mm',
698
+ dialCode: '+95',
699
+ format: '+95 ## #### ####',
700
+ flag: 'https://flagcdn.com/w40/mm.png',
701
+ phoneLength: 9
702
+ },
703
+ {
704
+ name: 'Cambodia',
705
+ native: 'កម្ពុជា',
706
+ iso2: 'kh',
707
+ dialCode: '+855',
708
+ format: '+855 ## ### ###',
709
+ flag: 'https://flagcdn.com/w40/kh.png',
710
+ phoneLength: 8
711
+ },
712
+ {
713
+ name: 'Bangladesh',
714
+ native: 'বাংলাদেশ',
715
+ iso2: 'bd',
716
+ dialCode: '+880',
717
+ format: '+880 ## #### ####',
718
+ flag: 'https://flagcdn.com/w40/bd.png',
719
+ phoneLength: 10
720
+ },
721
+ {
722
+ name: 'Laos',
723
+ native: 'ສປປ ລາວ',
724
+ iso2: 'la',
725
+ dialCode: '+856',
726
+ format: '+856 ## ### ####',
727
+ flag: 'https://flagcdn.com/w40/la.png',
728
+ phoneLength: 10
729
+ },
730
+ {
731
+ name: 'Brunei',
732
+ native: 'Brunei',
733
+ iso2: 'bn',
734
+ dialCode: '+673',
735
+ format: '+673 ## ### ####',
736
+ flag: 'https://flagcdn.com/w40/bn.png',
737
+ phoneLength: 7
738
+ },
739
+ {
740
+ name: 'Singapore',
741
+ native: '新加坡',
742
+ iso2: 'sg',
743
+ dialCode: '+65',
744
+ format: '+65 #### ####',
745
+ flag: 'https://flagcdn.com/w40/sg.png',
746
+ phoneLength: 8
747
+ },
748
+ {
749
+ name: 'New Zealand',
750
+ native: 'Aotearoa',
751
+ iso2: 'nz',
752
+ dialCode: '+64',
753
+ format: '+64 ## ### ####',
754
+ flag: 'https://flagcdn.com/w40/nz.png',
755
+ phoneLength: 9
756
+ },
757
+ {
758
+ name: 'Australia',
759
+ native: 'Australia',
760
+ iso2: 'au',
761
+ dialCode: '+61',
762
+ format: '+61 ## ### ####',
763
+ flag: 'https://flagcdn.com/w40/au.png',
764
+ phoneLength: 9
765
+ },
766
+ {
767
+ name: 'Fiji',
768
+ native: 'Fiji',
769
+ iso2: 'fj',
770
+ dialCode: '+679',
771
+ format: '+679 ## ### ####',
772
+ flag: 'https://flagcdn.com/w40/fj.png',
773
+ phoneLength: 7
774
+ },
775
+ {
776
+ name: 'Papua New Guinea',
777
+ native: 'Papua New Guinea',
778
+ iso2: 'pg',
779
+ dialCode: '+675',
780
+ format: '+675 ## ### ####',
781
+ flag: 'https://flagcdn.com/w40/pg.png',
782
+ phoneLength: 8
783
+ },
784
+ {
785
+ name: 'Solomon Islands',
786
+ native: 'Solomon Islands',
787
+ iso2: 'sb',
788
+ dialCode: '+677',
789
+ format: '+677 ## ### ####',
790
+ flag: 'https://flagcdn.com/w40/sb.png',
791
+ phoneLength: 7
792
+ },
793
+ {
794
+ name: 'Samoa',
795
+ native: 'Sāmoa',
796
+ iso2: 'ws',
797
+ dialCode: '+685',
798
+ format: '+685 ## ### ####',
799
+ flag: 'https://flagcdn.com/w40/ws.png',
800
+ phoneLength: 7
801
+ },
802
+ {
803
+ name: 'Tonga',
804
+ native: 'Tonga',
805
+ iso2: 'to',
806
+ dialCode: '+676',
807
+ format: '+676 ## ### ####',
808
+ flag: 'https://flagcdn.com/w40/to.png',
809
+ phoneLength: 7
810
+ },
811
+ {
812
+ name: 'Vanuatu',
813
+ native: 'Vanuatu',
814
+ iso2: 'vu',
815
+ dialCode: '+678',
816
+ format: '+678 ## ### ####',
817
+ flag: 'https://flagcdn.com/w40/vu.png',
818
+ phoneLength: 7
819
+ },
820
+ {
821
+ name: 'Kiribati',
822
+ native: 'Kiribati',
823
+ iso2: 'ki',
824
+ dialCode: '+686',
825
+ format: '+686 ## ### ####',
826
+ flag: 'https://flagcdn.com/w40/ki.png',
827
+ phoneLength: 5
828
+ },
829
+ {
830
+ name: 'Marshall Islands',
831
+ native: 'M̧ajeļ',
832
+ iso2: 'mh',
833
+ dialCode: '+692',
834
+ format: '+692 ## ### ####',
835
+ flag: 'https://flagcdn.com/w40/mh.png',
836
+ phoneLength: 7
837
+ },
838
+ {
839
+ name: 'Micronesia',
840
+ native: 'Micronesia',
841
+ iso2: 'fm',
842
+ dialCode: '+691',
843
+ format: '+691 ## ### ####',
844
+ flag: 'https://flagcdn.com/w40/fm.png',
845
+ phoneLength: 7
846
+ },
847
+ {
848
+ name: 'Tuvalu',
849
+ native: 'Tuvalu',
850
+ iso2: 'tv',
851
+ dialCode: '+688',
852
+ format: '+688 ## ### ####',
853
+ flag: 'https://flagcdn.com/w40/tv.png',
854
+ phoneLength: 5
855
+ },
856
+ {
857
+ name: 'Nauru',
858
+ native: 'Nauru',
859
+ iso2: 'nr',
860
+ dialCode: '+674',
861
+ format: '+674 ## ### ####',
862
+ flag: 'https://flagcdn.com/w40/nr.png',
863
+ phoneLength: 7
864
+ },
865
+ {
866
+ name: 'Palau',
867
+ native: 'Beluu er a Belau',
868
+ iso2: 'pw',
869
+ dialCode: '+680',
870
+ format: '+680 ## ### ####',
871
+ flag: 'https://flagcdn.com/w40/pw.png',
872
+ phoneLength: 7
873
+ },
874
+ {
875
+ name: 'American Samoa',
876
+ native: 'American Samoa',
877
+ iso2: 'as',
878
+ dialCode: '+1 684',
879
+ format: '+1 684 ### ####',
880
+ flag: 'https://flagcdn.com/w40/as.png',
881
+ phoneLength: 7
882
+ },
883
+ {
884
+ name: 'Guam',
885
+ native: 'Guam',
886
+ iso2: 'gu',
887
+ dialCode: '+1 671',
888
+ format: '+1 671 ### ####',
889
+ flag: 'https://flagcdn.com/w40/gu.png',
890
+ phoneLength: 7
891
+ },
892
+ {
893
+ name: 'Northern Mariana Islands',
894
+ native: 'Northern Mariana Islands',
895
+ iso2: 'mp',
896
+ dialCode: '+1 670',
897
+ format: '+1 670 ### ####',
898
+ flag: 'https://flagcdn.com/w40/mp.png',
899
+ phoneLength: 7
900
+ },
901
+ {
902
+ name: 'Puerto Rico',
903
+ native: 'Puerto Rico',
904
+ iso2: 'pr',
905
+ dialCode: '+1 787',
906
+ format: '+1 787 ### ####',
907
+ flag: 'https://flagcdn.com/w40/pr.png',
908
+ phoneLength: 10
909
+ },
910
+ {
911
+ name: 'Virgin Islands (US)',
912
+ native: 'Virgin Islands (US)',
913
+ iso2: 'vi',
914
+ dialCode: '+1 340',
915
+ format: '+1 340 ### ####',
916
+ flag: 'https://flagcdn.com/w40/vi.png',
917
+ phoneLength: 10
918
+ },
919
+ {
920
+ name: 'Saint Kitts and Nevis',
921
+ native: 'Saint Kitts and Nevis',
922
+ iso2: 'kn',
923
+ dialCode: '+1 869',
924
+ format: '+1 869 ### ####',
925
+ flag: 'https://flagcdn.com/w40/kn.png',
926
+ phoneLength: 10
927
+ },
928
+ {
929
+ name: 'Saint Lucia',
930
+ native: 'Saint Lucia',
931
+ iso2: 'lc',
932
+ dialCode: '+1 758',
933
+ format: '+1 758 ### ####',
934
+ flag: 'https://flagcdn.com/w40/lc.png',
935
+ phoneLength: 10
936
+ },
937
+ {
938
+ name: 'Saint Vincent and the Grenadines',
939
+ native: 'Saint Vincent and the Grenadines',
940
+ iso2: 'vc',
941
+ dialCode: '+1 784',
942
+ format: '+1 784 ### ####',
943
+ flag: 'https://flagcdn.com/w40/vc.png',
944
+ phoneLength: 10
945
+ },
946
+ {
947
+ name: 'Dominica',
948
+ native: 'Dominica',
949
+ iso2: 'dm',
950
+ dialCode: '+1 767',
951
+ format: '+1 767 ### ####',
952
+ flag: 'https://flagcdn.com/w40/dm.png',
953
+ phoneLength: 10
954
+ },
955
+ {
956
+ name: 'Grenada',
957
+ native: 'Grenada',
958
+ iso2: 'gd',
959
+ dialCode: '+1 473',
960
+ format: '+1 473 ### ####',
961
+ flag: 'https://flagcdn.com/w40/gd.png',
962
+ phoneLength: 10
963
+ },
964
+ {
965
+ name: 'Barbados',
966
+ native: 'Barbados',
967
+ iso2: 'bb',
968
+ dialCode: '+1 246',
969
+ format: '+1 246 ### ####',
970
+ flag: 'https://flagcdn.com/w40/bb.png',
971
+ phoneLength: 10
972
+ },
973
+ {
974
+ name: 'Antigua and Barbuda',
975
+ native: 'Antigua and Barbuda',
976
+ iso2: 'ag',
977
+ dialCode: '+1 268',
978
+ format: '+1 268 ### ####',
979
+ flag: 'https://flagcdn.com/w40/ag.png',
980
+ phoneLength: 10
981
+ },
982
+ {
983
+ name: 'Dominican Republic',
984
+ native: 'República Dominicana',
985
+ iso2: 'do',
986
+ dialCode: '+1 809',
987
+ format: '+1 809 ### ####',
988
+ flag: 'https://flagcdn.com/w40/do.png',
989
+ phoneLength: 10
990
+ },
991
+ {
992
+ name: 'Haiti',
993
+ native: 'Haïti',
994
+ iso2: 'ht',
995
+ dialCode: '+509',
996
+ format: '+509 ##-##-####',
997
+ flag: 'https://flagcdn.com/w40/ht.png',
998
+ phoneLength: 8
999
+ },
1000
+ {
1001
+ name: 'Cuba',
1002
+ native: 'Cuba',
1003
+ iso2: 'cu',
1004
+ dialCode: '+53',
1005
+ format: '+53 ##-###-####',
1006
+ flag: 'https://flagcdn.com/w40/cu.png',
1007
+ phoneLength: 8
1008
+ },
1009
+ {
1010
+ name: 'Jamaica',
1011
+ native: 'Jamaica',
1012
+ iso2: 'jm',
1013
+ dialCode: '+1 876',
1014
+ format: '+1 876 ### ####',
1015
+ flag: 'https://flagcdn.com/w40/jm.png',
1016
+ phoneLength: 10
1017
+ },
1018
+ {
1019
+ name: 'Bahamas',
1020
+ native: 'Bahamas',
1021
+ iso2: 'bs',
1022
+ dialCode: '+1 242',
1023
+ format: '+1 242 ### ####',
1024
+ flag: 'https://flagcdn.com/w40/bs.png',
1025
+ phoneLength: 10
1026
+ },
1027
+ {
1028
+ name: 'Trinidad and Tobago',
1029
+ native: 'Trinidad and Tobago',
1030
+ iso2: 'tt',
1031
+ dialCode: '+1 868',
1032
+ format: '+1 868 ### ####',
1033
+ flag: 'https://flagcdn.com/w40/tt.png',
1034
+ phoneLength: 10
1035
+ },
1036
+ {
1037
+ name: 'Montserrat',
1038
+ native: 'Montserrat',
1039
+ iso2: 'ms',
1040
+ dialCode: '+1 664',
1041
+ format: '+1 664 ### ####',
1042
+ flag: 'https://flagcdn.com/w40/ms.png',
1043
+ phoneLength: 10
1044
+ },
1045
+ {
1046
+ name: 'Anguilla',
1047
+ native: 'Anguilla',
1048
+ iso2: 'ai',
1049
+ dialCode: '+1 264',
1050
+ format: '+1 264 ### ####',
1051
+ flag: 'https://flagcdn.com/w40/ai.png',
1052
+ phoneLength: 10
1053
+ },
1054
+ {
1055
+ name: 'British Virgin Islands',
1056
+ native: 'British Virgin Islands',
1057
+ iso2: 'vg',
1058
+ dialCode: '+1 284',
1059
+ format: '+1 284 ### ####',
1060
+ flag: 'https://flagcdn.com/w40/vg.png',
1061
+ phoneLength: 10
1062
+ },
1063
+ {
1064
+ name: 'Turks and Caicos Islands',
1065
+ native: 'Turks and Caicos Islands',
1066
+ iso2: 'tc',
1067
+ dialCode: '+1 649',
1068
+ format: '+1 649 ### ####',
1069
+ flag: 'https://flagcdn.com/w40/tc.png',
1070
+ phoneLength: 10
1071
+ },
1072
+ {
1073
+ name: 'Greenland',
1074
+ native: 'Kalaallit Nunaat',
1075
+ iso2: 'gl',
1076
+ dialCode: '+299',
1077
+ format: '+299 ## ## ##',
1078
+ flag: 'https://flagcdn.com/w40/gl.png',
1079
+ phoneLength: 6
1080
+ },
1081
+ {
1082
+ name: 'Bermuda',
1083
+ native: 'Bermuda',
1084
+ iso2: 'bm',
1085
+ dialCode: '+1 441',
1086
+ format: '+1 441 ### ####',
1087
+ flag: 'https://flagcdn.com/w40/bm.png',
1088
+ phoneLength: 10
1089
+ },
1090
+ {
1091
+ name: 'Saint Barthélemy',
1092
+ native: 'Saint-Barthélemy',
1093
+ iso2: 'bl',
1094
+ dialCode: '+590',
1095
+ format: '+590 ## ## ## ##',
1096
+ flag: 'https://flagcdn.com/w40/bl.png',
1097
+ phoneLength: 9
1098
+ },
1099
+ {
1100
+ name: 'Saint Martin (French part)',
1101
+ native: 'Saint-Martin (partie française)',
1102
+ iso2: 'mf',
1103
+ dialCode: '+590',
1104
+ format: '+590 ## ## ## ##',
1105
+ flag: 'https://flagcdn.com/w40/mf.png',
1106
+ phoneLength: 9
1107
+ },
1108
+ {
1109
+ name: 'Guadeloupe',
1110
+ native: 'Guadeloupe',
1111
+ iso2: 'gp',
1112
+ dialCode: '+590',
1113
+ format: '+590 ## ## ## ##',
1114
+ flag: 'https://flagcdn.com/w40/gp.png',
1115
+ phoneLength: 9
1116
+ },
1117
+ {
1118
+ name: 'Martinique',
1119
+ native: 'Martinique',
1120
+ iso2: 'mq',
1121
+ dialCode: '+596',
1122
+ format: '+596 ## ## ## ##',
1123
+ flag: 'https://flagcdn.com/w40/mq.png',
1124
+ phoneLength: 9 // Mobile: 9 digits (e.g., +596 696 12 34 56)
1125
+ },
1126
+ {
1127
+ name: 'Réunion',
1128
+ native: 'La Réunion',
1129
+ iso2: 're',
1130
+ dialCode: '+262',
1131
+ format: '+262 ## ## ## ##',
1132
+ flag: 'https://flagcdn.com/w40/re.png',
1133
+ phoneLength: 9 // Mobile: 9 digits (e.g., +262 692 12 34 56)
1134
+ },
1135
+ {
1136
+ name: 'Mayotte',
1137
+ native: 'Mayotte',
1138
+ iso2: 'yt',
1139
+ dialCode: '+262',
1140
+ format: '+262 ## ## ## ##',
1141
+ flag: 'https://flagcdn.com/w40/yt.png',
1142
+ phoneLength: 9 // Same as Réunion (e.g., +262 639 12 34 56)
1143
+ },
1144
+ {
1145
+ name: 'French Guiana',
1146
+ native: 'Guyane française',
1147
+ iso2: 'gf',
1148
+ dialCode: '+594',
1149
+ format: '+594 ## ## ## ##',
1150
+ flag: 'https://flagcdn.com/w40/gf.png',
1151
+ phoneLength: 9 // Mobile: 9 digits (e.g., +594 694 12 34 56)
1152
+ },
1153
+ {
1154
+ name: 'Wallis and Futuna',
1155
+ native: 'Uvea o Futuna',
1156
+ iso2: 'wf',
1157
+ dialCode: '+681',
1158
+ format: '+681 ## ## ##',
1159
+ flag: 'https://flagcdn.com/w40/wf.png',
1160
+ phoneLength: 6 // Mobile: 6 digits (e.g., +681 72 34 56)
1161
+ },
1162
+ {
1163
+ name: 'New Caledonia',
1164
+ native: 'Nouvelle-Calédonie',
1165
+ iso2: 'nc',
1166
+ dialCode: '+687',
1167
+ format: '+687 ## ## ##',
1168
+ flag: 'https://flagcdn.com/w40/nc.png',
1169
+ phoneLength: 6 // Mobile: 6 digits (e.g., +687 75 12 34)
1170
+ },
1171
+ {
1172
+ name: 'French Polynesia',
1173
+ native: 'Polynésie française',
1174
+ iso2: 'pf',
1175
+ dialCode: '+689',
1176
+ format: '+689 ## ## ##',
1177
+ flag: 'https://flagcdn.com/w40/pf.png',
1178
+ phoneLength: 6 // Mobile: 6 digits (e.g., +689 87 12 34)
1179
+ },
1180
+ {
1181
+ name: 'Cook Islands',
1182
+ native: 'Kūki Ākau',
1183
+ iso2: 'ck',
1184
+ dialCode: '+682',
1185
+ format: '+682 ## ###',
1186
+ flag: 'https://flagcdn.com/w40/ck.png',
1187
+ phoneLength: 5 // Mobile: 5 digits (e.g., +682 71 234)
1188
+ },
1189
+ {
1190
+ name: 'Niue',
1191
+ native: 'Niuē',
1192
+ iso2: 'nu',
1193
+ dialCode: '+683',
1194
+ format: '+683 ## ###',
1195
+ flag: 'https://flagcdn.com/w40/nu.png',
1196
+ phoneLength: 4 // Mobile: 4 digits (e.g., +683 1234)
1197
+ },
1198
+ {
1199
+ name: 'Tokelau',
1200
+ native: 'Tokelau',
1201
+ iso2: 'tk',
1202
+ dialCode: '+690',
1203
+ format: '+690 ## ###',
1204
+ flag: 'https://flagcdn.com/w40/tk.png',
1205
+ phoneLength: 4 // Mobile: 4 digits (e.g., +690 1234)
1206
+ },
1207
+ {
1208
+ name: 'Canada',
1209
+ native: 'Canada',
1210
+ iso2: 'ca',
1211
+ dialCode: '+1',
1212
+ format: '+1 ### ### ####',
1213
+ flag: 'https://flagcdn.com/w40/ca.png',
1214
+ phoneLength: 10 // NANP standard (e.g., +1 416 123 4567)
1215
+ },
1216
+ {
1217
+ name: 'Panama',
1218
+ native: 'Panamá',
1219
+ iso2: 'pa',
1220
+ dialCode: '+507',
1221
+ format: '+507 ##-###-####',
1222
+ flag: 'https://flagcdn.com/w40/pa.png',
1223
+ phoneLength: 8 // Mobile: 8 digits (e.g., +507 6123 4567)
1224
+ }
1225
+ ];
1226
+
1227
+ class PhoneInputComponent {
1228
+ constructor(eRef) {
1229
+ this.eRef = eRef;
1230
+ this.countriesList = countries;
1231
+ this.searchTerm = '';
1232
+ this.defaultCountry = '';
1233
+ this.placeholder = '';
1234
+ this.searchEnabled = true;
1235
+ this.numberFormat = 'international';
1236
+ this.setFirstCountry = '';
1237
+ this.phoneChange = new EventEmitter();
1238
+ this.phoneNumber = '';
1239
+ this.isInvalid = false;
1240
+ this.dropdownOpen = false;
1241
+ this.animating = false;
1242
+ this.selectedCountry = countries[0];
1243
+ this.onChange = () => { };
1244
+ this.onTouched = () => { };
1245
+ }
1246
+ ngOnInit() {
1247
+ if (this.defaultCountry) {
1248
+ const match = countries.find(c => c.iso2 === this.defaultCountry.toLowerCase());
1249
+ if (match)
1250
+ this.selectedCountry = match;
1251
+ }
1252
+ }
1253
+ handleClickOutside(event) {
1254
+ if (!this.eRef.nativeElement.contains(event.target)) {
1255
+ this.dropdownOpen = false;
1256
+ }
1257
+ }
1258
+ onAnimationDone(event) {
1259
+ if (!this.dropdownOpen) {
1260
+ this.animating = false;
1261
+ }
1262
+ }
1263
+ toggleDropdown() {
1264
+ this.dropdownOpen = !this.dropdownOpen;
1265
+ this.animating = true;
1266
+ }
1267
+ onClickOutside(event) {
1268
+ if (!this.eRef.nativeElement.contains(event.target)) {
1269
+ this.dropdownOpen = false;
1270
+ }
1271
+ }
1272
+ onSearchChange() {
1273
+ const term = this.searchTerm.toLowerCase();
1274
+ this.countriesList = countries.filter(c => {
1275
+ var _a;
1276
+ return c.name.toLowerCase().includes(term) ||
1277
+ ((_a = c.native) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(term));
1278
+ });
1279
+ }
1280
+ selectCountry(country) {
1281
+ this.selectedCountry = country;
1282
+ this.searchTerm = '';
1283
+ this.countriesList = countries;
1284
+ this.dropdownOpen = false;
1285
+ this.emitPhoneChange();
1286
+ }
1287
+ onPhoneInput() {
1288
+ this.emitPhoneChange();
1289
+ }
1290
+ emitPhoneChange() {
1291
+ var _a, _b;
1292
+ const raw = this.phoneNumber || '';
1293
+ const digitsOnly = raw.replace(/\D/g, '');
1294
+ const hyphenCount = (raw.match(/-/g) || []).length;
1295
+ const spaceCount = (raw.match(/ /g) || []).length;
1296
+ const totalChars = this.phoneNumber.length;
1297
+ const maxAllowedLength = ((_a = this.selectedCountry) === null || _a === void 0 ? void 0 : _a.phoneLength) + hyphenCount + spaceCount;
1298
+ if (digitsOnly.length !== ((_b = this.selectedCountry) === null || _b === void 0 ? void 0 : _b.phoneLength)) {
1299
+ this.isInvalid = true;
1300
+ }
1301
+ else if (totalChars > maxAllowedLength) {
1302
+ this.isInvalid = true;
1303
+ }
1304
+ else {
1305
+ this.isInvalid = false;
1306
+ }
1307
+ const fullPhone = this.selectedCountry.dialCode + raw;
1308
+ const structuredValue = {
1309
+ e164Number: fullPhone,
1310
+ nationalNumber: raw,
1311
+ dialCode: this.selectedCountry.dialCode,
1312
+ countryCode: this.selectedCountry.iso2,
1313
+ isValid: !this.isInvalid,
1314
+ };
1315
+ this.onChange(structuredValue);
1316
+ this.phoneChange.emit(structuredValue);
1317
+ }
1318
+ writeValue(value) {
1319
+ if (value && value.dialCode && value.countryCode) {
1320
+ const match = countries.find(c => c.dialCode === value.dialCode && c.iso2 === value.countryCode);
1321
+ if (match) {
1322
+ this.selectedCountry = match;
1323
+ }
1324
+ else {
1325
+ this.selectedCountry = countries[0];
1326
+ }
1327
+ this.phoneNumber = value.nationalNumber || '';
1328
+ }
1329
+ else {
1330
+ this.selectedCountry = countries[0];
1331
+ this.phoneNumber = '';
1332
+ }
1333
+ }
1334
+ registerOnChange(fn) {
1335
+ this.onChange = fn;
1336
+ }
1337
+ registerOnTouched(fn) {
1338
+ this.onTouched = fn;
1339
+ }
1340
+ allowPhoneCharacters(event) {
1341
+ const allowedChars = [' ', '-'];
1342
+ const charCode = event.charCode;
1343
+ // Allow digits 0–9
1344
+ if (charCode >= 48 && charCode <= 57)
1345
+ return;
1346
+ // Allow hyphen and space
1347
+ if (allowedChars.includes(event.key))
1348
+ return;
1349
+ event.preventDefault();
1350
+ }
1351
+ }
1352
+ PhoneInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PhoneInputComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1353
+ PhoneInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: PhoneInputComponent, selector: "phone-input", inputs: { defaultCountry: "defaultCountry", placeholder: "placeholder", searchEnabled: "searchEnabled", numberFormat: "numberFormat", setFirstCountry: "setFirstCountry" }, outputs: { phoneChange: "phoneChange" }, host: { listeners: { "document:click": "handleClickOutside($event)" } }, providers: [{
1354
+ provide: NG_VALUE_ACCESSOR,
1355
+ useExisting: forwardRef(() => PhoneInputComponent),
1356
+ multi: true
1357
+ }], ngImport: i0, template: `<div class="phone-input-wrapper">
1358
+ <div class="input-container">
1359
+ <!-- Country Selector (20%) -->
1360
+ <div class="country-select" (click)="toggleDropdown()" (blur)="toggleDropdown()">
1361
+ <img [src]="selectedCountry.flag" width="20" />
1362
+ <span>{{selectedCountry.dialCode}}</span>
1363
+ <span class="arrow-down">▾</span>
1364
+ </div>
1365
+
1366
+ <!-- Phone Input (80%) -->
1367
+ <input
1368
+ type="tel"
1369
+ pattern="[0-9\\s\\-]*"
1370
+ inputmode="numeric"
1371
+ class="phone-input"
1372
+ [placeholder]="placeholder"
1373
+ [(ngModel)]="phoneNumber"
1374
+ [ngClass]="{ 'error-border': isInvalid }"
1375
+ (input)="onPhoneInput()"
1376
+ (keypress)="allowPhoneCharacters($event)"
1377
+ />
1378
+ </div>
1379
+
1380
+ <!-- Dropdown Content (full width below) -->
1381
+ <div
1382
+ class="dropdown-content"
1383
+ [@dropdownAnimation]="dropdownOpen ? 'open' : 'closed'"
1384
+ *ngIf="dropdownOpen || animating"
1385
+ (@dropdownAnimation.done)="onAnimationDone($event)" >
1386
+ <input
1387
+ *ngIf="searchEnabled"
1388
+ type="text"
1389
+ class="search-box"
1390
+ placeholder="Search Country"
1391
+ [(ngModel)]="searchTerm"
1392
+ (input)="onSearchChange()"
1393
+ />
1394
+ <div class="country-list">
1395
+ <div
1396
+ class="country-option"
1397
+ *ngFor="let country of countriesList"
1398
+ (click)="selectCountry(country)"
1399
+ >
1400
+ <img [src]="country.flag" width="20" />
1401
+ <span class="country-name">{{ country.name }} ({{ country.native }})</span>
1402
+ <span class="dial-code">{{ country.dialCode }}</span>
1403
+ </div>
1404
+ </div>
1405
+ </div>
1406
+ </div>
1407
+
1408
+ `, isInline: true, styles: [".phone-input-wrapper{position:relative;font-family:Arial,sans-serif}.input-container{display:flex;width:100%;padding-bottom:3px}.country-select{width:24%;display:flex;align-items:center;justify-content:space-between;border:1px solid #ccc;border-right:none;border-radius:4px 0 0 4px;padding:8px;cursor:pointer;background-color:#f8f8f8}.country-select img{margin-right:5px}.arrow-down{font-size:13px;color:#666}.arrow-down:after{display:none}.phone-input{width:80%;padding:8px 12px;border:1px solid #ccc;border-radius:0 4px 4px 0;outline:none}.dropdown-content{position:absolute;top:100%;left:0;width:100%;background:white;border:1px solid #ccc;border-radius:0 0 4px 4px;box-shadow:0 2px 4px #0000001a;z-index:1000;margin-top:-1px}.search-box{width:100%;padding:8px 12px;border:none;border-bottom:1px solid #eee;outline:none}.country-list{max-height:200px;overflow-y:auto}.country-option{display:flex;align-items:center;padding:8px 12px;cursor:pointer}.country-option:hover{background-color:#f5f5f5}.country-option img{margin-right:5px}.country-name{flex-grow:1}.dial-code{color:#666;font-size:.9em}input.error-border{border-color:red}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], animations: [
1409
+ trigger('dropdownAnimation', [
1410
+ state('open', style({
1411
+ opacity: 1,
1412
+ transform: 'scaleY(1)',
1413
+ height: '*',
1414
+ padding: '*'
1415
+ })),
1416
+ state('closed', style({
1417
+ opacity: 0,
1418
+ transform: 'scaleY(0)',
1419
+ height: '0px',
1420
+ padding: '0px'
1421
+ })),
1422
+ transition('closed => open', [
1423
+ animate('200ms ease-out')
1424
+ ]),
1425
+ transition('open => closed', [
1426
+ animate('150ms ease-in')
1427
+ ])
1428
+ ])
1429
+ ] });
1430
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PhoneInputComponent, decorators: [{
1431
+ type: Component,
1432
+ args: [{ selector: 'phone-input', animations: [
1433
+ trigger('dropdownAnimation', [
1434
+ state('open', style({
1435
+ opacity: 1,
1436
+ transform: 'scaleY(1)',
1437
+ height: '*',
1438
+ padding: '*'
1439
+ })),
1440
+ state('closed', style({
1441
+ opacity: 0,
1442
+ transform: 'scaleY(0)',
1443
+ height: '0px',
1444
+ padding: '0px'
1445
+ })),
1446
+ transition('closed => open', [
1447
+ animate('200ms ease-out')
1448
+ ]),
1449
+ transition('open => closed', [
1450
+ animate('150ms ease-in')
1451
+ ])
1452
+ ])
1453
+ ], template: `<div class="phone-input-wrapper">
1454
+ <div class="input-container">
1455
+ <!-- Country Selector (20%) -->
1456
+ <div class="country-select" (click)="toggleDropdown()" (blur)="toggleDropdown()">
1457
+ <img [src]="selectedCountry.flag" width="20" />
1458
+ <span>{{selectedCountry.dialCode}}</span>
1459
+ <span class="arrow-down">▾</span>
1460
+ </div>
1461
+
1462
+ <!-- Phone Input (80%) -->
1463
+ <input
1464
+ type="tel"
1465
+ pattern="[0-9\\s\\-]*"
1466
+ inputmode="numeric"
1467
+ class="phone-input"
1468
+ [placeholder]="placeholder"
1469
+ [(ngModel)]="phoneNumber"
1470
+ [ngClass]="{ 'error-border': isInvalid }"
1471
+ (input)="onPhoneInput()"
1472
+ (keypress)="allowPhoneCharacters($event)"
1473
+ />
1474
+ </div>
1475
+
1476
+ <!-- Dropdown Content (full width below) -->
1477
+ <div
1478
+ class="dropdown-content"
1479
+ [@dropdownAnimation]="dropdownOpen ? 'open' : 'closed'"
1480
+ *ngIf="dropdownOpen || animating"
1481
+ (@dropdownAnimation.done)="onAnimationDone($event)" >
1482
+ <input
1483
+ *ngIf="searchEnabled"
1484
+ type="text"
1485
+ class="search-box"
1486
+ placeholder="Search Country"
1487
+ [(ngModel)]="searchTerm"
1488
+ (input)="onSearchChange()"
1489
+ />
1490
+ <div class="country-list">
1491
+ <div
1492
+ class="country-option"
1493
+ *ngFor="let country of countriesList"
1494
+ (click)="selectCountry(country)"
1495
+ >
1496
+ <img [src]="country.flag" width="20" />
1497
+ <span class="country-name">{{ country.name }} ({{ country.native }})</span>
1498
+ <span class="dial-code">{{ country.dialCode }}</span>
1499
+ </div>
1500
+ </div>
1501
+ </div>
1502
+ </div>
1503
+
1504
+ `, providers: [{
1505
+ provide: NG_VALUE_ACCESSOR,
1506
+ useExisting: forwardRef(() => PhoneInputComponent),
1507
+ multi: true
1508
+ }], styles: [".phone-input-wrapper{position:relative;font-family:Arial,sans-serif}.input-container{display:flex;width:100%;padding-bottom:3px}.country-select{width:24%;display:flex;align-items:center;justify-content:space-between;border:1px solid #ccc;border-right:none;border-radius:4px 0 0 4px;padding:8px;cursor:pointer;background-color:#f8f8f8}.country-select img{margin-right:5px}.arrow-down{font-size:13px;color:#666}.arrow-down:after{display:none}.phone-input{width:80%;padding:8px 12px;border:1px solid #ccc;border-radius:0 4px 4px 0;outline:none}.dropdown-content{position:absolute;top:100%;left:0;width:100%;background:white;border:1px solid #ccc;border-radius:0 0 4px 4px;box-shadow:0 2px 4px #0000001a;z-index:1000;margin-top:-1px}.search-box{width:100%;padding:8px 12px;border:none;border-bottom:1px solid #eee;outline:none}.country-list{max-height:200px;overflow-y:auto}.country-option{display:flex;align-items:center;padding:8px 12px;cursor:pointer}.country-option:hover{background-color:#f5f5f5}.country-option img{margin-right:5px}.country-name{flex-grow:1}.dial-code{color:#666;font-size:.9em}input.error-border{border-color:red}\n"] }]
1509
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { defaultCountry: [{
1510
+ type: Input
1511
+ }], placeholder: [{
1512
+ type: Input
1513
+ }], searchEnabled: [{
1514
+ type: Input
1515
+ }], numberFormat: [{
1516
+ type: Input
1517
+ }], setFirstCountry: [{
1518
+ type: Input
1519
+ }], phoneChange: [{
1520
+ type: Output
1521
+ }], handleClickOutside: [{
1522
+ type: HostListener,
1523
+ args: ['document:click', ['$event']]
1524
+ }] } });
1525
+
1526
+ class PhoneInputModule {
1527
+ }
1528
+ PhoneInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PhoneInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1529
+ PhoneInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: PhoneInputModule, declarations: [PhoneInputComponent], imports: [CommonModule,
1530
+ FormsModule], exports: [PhoneInputComponent] });
1531
+ PhoneInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PhoneInputModule, imports: [CommonModule,
1532
+ FormsModule] });
1533
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PhoneInputModule, decorators: [{
1534
+ type: NgModule,
1535
+ args: [{
1536
+ declarations: [PhoneInputComponent],
1537
+ imports: [
1538
+ CommonModule,
1539
+ FormsModule
1540
+ ],
1541
+ exports: [PhoneInputComponent]
1542
+ }]
1543
+ }] });
1544
+
1545
+ /*
1546
+ * Public API Surface of phone-input
1547
+ */
1548
+
1549
+ /**
1550
+ * Generated bundle index. Do not edit.
1551
+ */
1552
+
1553
+ export { PhoneInputComponent, PhoneInputModule };
1554
+ //# sourceMappingURL=ngx-dial-input.mjs.map
1555
+ //# sourceMappingURL=ngx-dial-input.mjs.map