react-simple-phone-input 1.0.6-beta → 1.0.7-beta

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/dist/cjs/index.js CHANGED
@@ -2802,9 +2802,1329 @@ function requireReact_development () {
2802
2802
 
2803
2803
  var React = /*@__PURE__*/getDefaultExportFromCjs(react.exports);
2804
2804
 
2805
- const PhoneInput = () => {
2806
- return (React.createElement("div", null,
2807
- React.createElement("img", { src: "https://lh3.googleusercontent.com/d/1otxg0vwa395hbgPco_CUExdgJPkIx-t4", width: 200, height: 200, alt: "helo" })));
2805
+ const countryData = [
2806
+ {
2807
+ country: "Afghanistan",
2808
+ countryCode: "AF",
2809
+ callingCode: "+93"
2810
+ },
2811
+ {
2812
+ country: "Albania",
2813
+ countryCode: "AL",
2814
+ callingCode: "+355"
2815
+ },
2816
+ {
2817
+ country: "Algeria",
2818
+ countryCode: "DZ",
2819
+ callingCode: "+213"
2820
+ },
2821
+ {
2822
+ country: "American Samoa",
2823
+ countryCode: "AS",
2824
+ callingCode: "+1684"
2825
+ },
2826
+ {
2827
+ country: "Andorra",
2828
+ countryCode: "AD",
2829
+ callingCode: "+376"
2830
+ },
2831
+ {
2832
+ country: "Angola",
2833
+ countryCode: "AO",
2834
+ callingCode: "+244"
2835
+ },
2836
+ {
2837
+ country: "Anguilla",
2838
+ countryCode: "AI",
2839
+ callingCode: "+1264"
2840
+ },
2841
+ {
2842
+ country: "Antarctica",
2843
+ countryCode: "AQ",
2844
+ callingCode: "+672"
2845
+ },
2846
+ {
2847
+ country: "Antigua and Barbuda",
2848
+ countryCode: "AG",
2849
+ callingCode: "+1268"
2850
+ },
2851
+ {
2852
+ country: "Argentina",
2853
+ countryCode: "AR",
2854
+ callingCode: "+54"
2855
+ },
2856
+ {
2857
+ country: "Armenia",
2858
+ countryCode: "AM",
2859
+ callingCode: "+374"
2860
+ },
2861
+ {
2862
+ country: "Aruba",
2863
+ countryCode: "AW",
2864
+ callingCode: "+297"
2865
+ },
2866
+ {
2867
+ country: "Australia",
2868
+ countryCode: "AU",
2869
+ callingCode: "+61"
2870
+ },
2871
+ {
2872
+ country: "Austria",
2873
+ countryCode: "AT",
2874
+ callingCode: "+43"
2875
+ },
2876
+ {
2877
+ country: "Azerbaijan",
2878
+ countryCode: "AZ",
2879
+ callingCode: "+994"
2880
+ },
2881
+ {
2882
+ country: "Bahamas",
2883
+ countryCode: "BS",
2884
+ callingCode: "+1242"
2885
+ },
2886
+ {
2887
+ country: "Bahrain",
2888
+ countryCode: "BH",
2889
+ callingCode: "+973"
2890
+ },
2891
+ {
2892
+ country: "Bangladesh",
2893
+ countryCode: "BD",
2894
+ callingCode: "+880"
2895
+ },
2896
+ {
2897
+ country: "Barbados",
2898
+ countryCode: "BB",
2899
+ callingCode: "+1246"
2900
+ },
2901
+ {
2902
+ country: "Belarus",
2903
+ countryCode: "BY",
2904
+ callingCode: "+375"
2905
+ },
2906
+ {
2907
+ country: "Belgium",
2908
+ countryCode: "BE",
2909
+ callingCode: "+32"
2910
+ },
2911
+ {
2912
+ country: "Belize",
2913
+ countryCode: "BZ",
2914
+ callingCode: "+501"
2915
+ },
2916
+ {
2917
+ country: "Benin",
2918
+ countryCode: "BJ",
2919
+ callingCode: "+229"
2920
+ },
2921
+ {
2922
+ country: "Bermuda",
2923
+ countryCode: "BM",
2924
+ callingCode: "+1441"
2925
+ },
2926
+ {
2927
+ country: "Bhutan",
2928
+ countryCode: "BT",
2929
+ callingCode: "+975"
2930
+ },
2931
+ {
2932
+ country: "Bolivia",
2933
+ countryCode: "BO",
2934
+ callingCode: "+591"
2935
+ },
2936
+ {
2937
+ country: "Bosnia and Herzegovina",
2938
+ countryCode: "BA",
2939
+ callingCode: "+387"
2940
+ },
2941
+ {
2942
+ country: "Botswana",
2943
+ countryCode: "BW",
2944
+ callingCode: "+267"
2945
+ },
2946
+ {
2947
+ country: "Bouvet Island",
2948
+ countryCode: "BV",
2949
+ callingCode: "+47"
2950
+ },
2951
+ {
2952
+ country: "Brazil",
2953
+ countryCode: "BR",
2954
+ callingCode: "+55"
2955
+ },
2956
+ {
2957
+ country: "British Indian Ocean Territory",
2958
+ countryCode: "IO",
2959
+ callingCode: "+246"
2960
+ },
2961
+ {
2962
+ country: "British Virgin Islands",
2963
+ countryCode: "VG",
2964
+ callingCode: "+1284"
2965
+ },
2966
+ {
2967
+ country: "Brunei",
2968
+ countryCode: "BN",
2969
+ callingCode: "+673"
2970
+ },
2971
+ {
2972
+ country: "Bulgaria",
2973
+ countryCode: "BG",
2974
+ callingCode: "+359"
2975
+ },
2976
+ {
2977
+ country: "Burkina Faso",
2978
+ countryCode: "BF",
2979
+ callingCode: "+226"
2980
+ },
2981
+ {
2982
+ country: "Burundi",
2983
+ countryCode: "BI",
2984
+ callingCode: "+257"
2985
+ },
2986
+ {
2987
+ country: "Cambodia",
2988
+ countryCode: "KH",
2989
+ callingCode: "+855"
2990
+ },
2991
+ {
2992
+ country: "Cameroon",
2993
+ countryCode: "CM",
2994
+ callingCode: "+237"
2995
+ },
2996
+ {
2997
+ country: "Canada",
2998
+ countryCode: "CA",
2999
+ callingCode: "+1"
3000
+ },
3001
+ {
3002
+ country: "Cape Verde",
3003
+ countryCode: "CV",
3004
+ callingCode: "+238"
3005
+ },
3006
+ {
3007
+ country: "Cayman Islands",
3008
+ countryCode: "KY",
3009
+ callingCode: "+1345"
3010
+ },
3011
+ {
3012
+ country: "Central African Republic",
3013
+ countryCode: "CF",
3014
+ callingCode: "+236"
3015
+ },
3016
+ {
3017
+ country: "Chad",
3018
+ countryCode: "TD",
3019
+ callingCode: "+235"
3020
+ },
3021
+ {
3022
+ country: "Chile",
3023
+ countryCode: "CL",
3024
+ callingCode: "+56"
3025
+ },
3026
+ {
3027
+ country: "China",
3028
+ countryCode: "CN",
3029
+ callingCode: "+86"
3030
+ },
3031
+ {
3032
+ country: "Christmas Island",
3033
+ countryCode: "CX",
3034
+ callingCode: "+61"
3035
+ },
3036
+ {
3037
+ country: "Cocos Islands",
3038
+ countryCode: "CC",
3039
+ callingCode: "+61"
3040
+ },
3041
+ {
3042
+ country: "Colombia",
3043
+ countryCode: "CO",
3044
+ callingCode: "+57"
3045
+ },
3046
+ {
3047
+ country: "Comoros",
3048
+ countryCode: "KM",
3049
+ callingCode: "+269"
3050
+ },
3051
+ {
3052
+ country: "Cook Islands",
3053
+ countryCode: "CK",
3054
+ callingCode: "+682"
3055
+ },
3056
+ {
3057
+ country: "Costa Rica",
3058
+ countryCode: "CR",
3059
+ callingCode: "+506"
3060
+ },
3061
+ {
3062
+ country: "Croatia",
3063
+ countryCode: "HR",
3064
+ callingCode: "+385"
3065
+ },
3066
+ {
3067
+ country: "Cuba",
3068
+ countryCode: "CU",
3069
+ callingCode: "+53"
3070
+ },
3071
+ {
3072
+ country: "Cyprus",
3073
+ countryCode: "CY",
3074
+ callingCode: "+357"
3075
+ },
3076
+ {
3077
+ country: "Czech Republic",
3078
+ countryCode: "CZ",
3079
+ callingCode: "+420"
3080
+ },
3081
+ {
3082
+ country: "Democratic Republic of the Congo",
3083
+ countryCode: "CD",
3084
+ callingCode: "+243"
3085
+ },
3086
+ {
3087
+ country: "Denmark",
3088
+ countryCode: "DK",
3089
+ callingCode: "+45"
3090
+ },
3091
+ {
3092
+ country: "Djibouti",
3093
+ countryCode: "DJ",
3094
+ callingCode: "+253"
3095
+ },
3096
+ {
3097
+ country: "Dominica",
3098
+ countryCode: "DM",
3099
+ callingCode: "+1767"
3100
+ },
3101
+ {
3102
+ country: "Dominican Republic",
3103
+ countryCode: "DO",
3104
+ callingCode: "+1"
3105
+ },
3106
+ {
3107
+ country: "East Timor",
3108
+ countryCode: "TL",
3109
+ callingCode: "+670"
3110
+ },
3111
+ {
3112
+ country: "Ecuador",
3113
+ countryCode: "EC",
3114
+ callingCode: "+593"
3115
+ },
3116
+ {
3117
+ country: "Egypt",
3118
+ countryCode: "EG",
3119
+ callingCode: "+20"
3120
+ },
3121
+ {
3122
+ country: "El Salvador",
3123
+ countryCode: "SV",
3124
+ callingCode: "+503"
3125
+ },
3126
+ {
3127
+ country: "Equatorial Guinea",
3128
+ countryCode: "GQ",
3129
+ callingCode: "+240"
3130
+ },
3131
+ {
3132
+ country: "Eritrea",
3133
+ countryCode: "ER",
3134
+ callingCode: "+291"
3135
+ },
3136
+ {
3137
+ country: "Estonia",
3138
+ countryCode: "EE",
3139
+ callingCode: "+372"
3140
+ },
3141
+ {
3142
+ country: "Ethiopia",
3143
+ countryCode: "ET",
3144
+ callingCode: "+251"
3145
+ },
3146
+ {
3147
+ country: "Falkland Islands",
3148
+ countryCode: "FK",
3149
+ callingCode: "+500"
3150
+ },
3151
+ {
3152
+ country: "Faroe Islands",
3153
+ countryCode: "FO",
3154
+ callingCode: "+298"
3155
+ },
3156
+ {
3157
+ country: "Fiji",
3158
+ countryCode: "FJ",
3159
+ callingCode: "+679"
3160
+ },
3161
+ {
3162
+ country: "Finland",
3163
+ countryCode: "FI",
3164
+ callingCode: "+358"
3165
+ },
3166
+ {
3167
+ country: "France",
3168
+ countryCode: "FR",
3169
+ callingCode: "+33"
3170
+ },
3171
+ {
3172
+ country: "French Guiana",
3173
+ countryCode: "GF",
3174
+ callingCode: "+594"
3175
+ },
3176
+ {
3177
+ country: "French Polynesia",
3178
+ countryCode: "PF",
3179
+ callingCode: "+689"
3180
+ },
3181
+ {
3182
+ country: "French Southern Territories",
3183
+ countryCode: "TF",
3184
+ callingCode: "+262"
3185
+ },
3186
+ {
3187
+ country: "Gabon",
3188
+ countryCode: "GA",
3189
+ callingCode: "+241"
3190
+ },
3191
+ {
3192
+ country: "Gambia",
3193
+ countryCode: "GM",
3194
+ callingCode: "+220"
3195
+ },
3196
+ {
3197
+ country: "Georgia",
3198
+ countryCode: "GE",
3199
+ callingCode: "+995"
3200
+ },
3201
+ {
3202
+ country: "Germany",
3203
+ countryCode: "DE",
3204
+ callingCode: "+49"
3205
+ },
3206
+ {
3207
+ country: "Ghana",
3208
+ countryCode: "GH",
3209
+ callingCode: "+233"
3210
+ },
3211
+ {
3212
+ country: "Gibraltar",
3213
+ countryCode: "GI",
3214
+ callingCode: "+350"
3215
+ },
3216
+ {
3217
+ country: "Greece",
3218
+ countryCode: "GR",
3219
+ callingCode: "+30"
3220
+ },
3221
+ {
3222
+ country: "Greenland",
3223
+ countryCode: "GL",
3224
+ callingCode: "+299"
3225
+ },
3226
+ {
3227
+ country: "Grenada",
3228
+ countryCode: "GD",
3229
+ callingCode: "+473"
3230
+ },
3231
+ {
3232
+ country: "Guadeloupe",
3233
+ countryCode: "GP",
3234
+ callingCode: "+590"
3235
+ },
3236
+ {
3237
+ country: "Guam",
3238
+ countryCode: "GU",
3239
+ callingCode: "+1671"
3240
+ },
3241
+ {
3242
+ country: "Guatemala",
3243
+ countryCode: "GT",
3244
+ callingCode: "+502"
3245
+ },
3246
+ {
3247
+ country: "Guinea",
3248
+ countryCode: "GN",
3249
+ callingCode: "+224"
3250
+ },
3251
+ {
3252
+ country: "Guinea-Bissau",
3253
+ countryCode: "GW",
3254
+ callingCode: "+245"
3255
+ },
3256
+ {
3257
+ country: "Guyana",
3258
+ countryCode: "GY",
3259
+ callingCode: "+592"
3260
+ },
3261
+ {
3262
+ country: "Haiti",
3263
+ countryCode: "HT",
3264
+ callingCode: "+509"
3265
+ },
3266
+ {
3267
+ country: "Honduras",
3268
+ countryCode: "HN",
3269
+ callingCode: "+504"
3270
+ },
3271
+ {
3272
+ country: "Hong Kong",
3273
+ countryCode: "HK",
3274
+ callingCode: "+852"
3275
+ },
3276
+ {
3277
+ country: "Hungary",
3278
+ countryCode: "HU",
3279
+ callingCode: "+36"
3280
+ },
3281
+ {
3282
+ country: "Iceland",
3283
+ countryCode: "IS",
3284
+ callingCode: "+354"
3285
+ },
3286
+ {
3287
+ country: "India",
3288
+ countryCode: "IN",
3289
+ callingCode: "+91"
3290
+ },
3291
+ {
3292
+ country: "Indonesia",
3293
+ countryCode: "ID",
3294
+ callingCode: "+62"
3295
+ },
3296
+ {
3297
+ country: "Iran",
3298
+ countryCode: "IR",
3299
+ callingCode: "+98"
3300
+ },
3301
+ {
3302
+ country: "Iraq",
3303
+ countryCode: "IQ",
3304
+ callingCode: "+964"
3305
+ },
3306
+ {
3307
+ country: "Ireland",
3308
+ countryCode: "IE",
3309
+ callingCode: "+353"
3310
+ },
3311
+ {
3312
+ country: "Israel",
3313
+ countryCode: "IL",
3314
+ callingCode: "+972"
3315
+ },
3316
+ {
3317
+ country: "Italy",
3318
+ countryCode: "IT",
3319
+ callingCode: "+39"
3320
+ },
3321
+ {
3322
+ country: "Ivory Coast",
3323
+ countryCode: "CI",
3324
+ callingCode: "+225"
3325
+ },
3326
+ {
3327
+ country: "Jamaica",
3328
+ countryCode: "JM",
3329
+ callingCode: "+1876"
3330
+ },
3331
+ {
3332
+ country: "Japan",
3333
+ countryCode: "JP",
3334
+ callingCode: "+81"
3335
+ },
3336
+ {
3337
+ country: "Jordan",
3338
+ countryCode: "JO",
3339
+ callingCode: "+962"
3340
+ },
3341
+ {
3342
+ country: "Kazakhstan",
3343
+ countryCode: "KZ",
3344
+ callingCode: "+7"
3345
+ },
3346
+ {
3347
+ country: "Kenya",
3348
+ countryCode: "KE",
3349
+ callingCode: "+254"
3350
+ },
3351
+ {
3352
+ country: "Kiribati",
3353
+ countryCode: "KI",
3354
+ callingCode: "+686"
3355
+ },
3356
+ {
3357
+ country: "Kuwait",
3358
+ countryCode: "KW",
3359
+ callingCode: "+965"
3360
+ },
3361
+ {
3362
+ country: "Kyrgyzstan",
3363
+ countryCode: "KG",
3364
+ callingCode: "+996"
3365
+ },
3366
+ {
3367
+ country: "Laos",
3368
+ countryCode: "LA",
3369
+ callingCode: "+856"
3370
+ },
3371
+ {
3372
+ country: "Latvia",
3373
+ countryCode: "LV",
3374
+ callingCode: "+371"
3375
+ },
3376
+ {
3377
+ country: "Lebanon",
3378
+ countryCode: "LB",
3379
+ callingCode: "+961"
3380
+ },
3381
+ {
3382
+ country: "Lesotho",
3383
+ countryCode: "LS",
3384
+ callingCode: "+266"
3385
+ },
3386
+ {
3387
+ country: "Liberia",
3388
+ countryCode: "LR",
3389
+ callingCode: "+231"
3390
+ },
3391
+ {
3392
+ country: "Libya",
3393
+ countryCode: "LY",
3394
+ callingCode: "+218"
3395
+ },
3396
+ {
3397
+ country: "Liechtenstein",
3398
+ countryCode: "LI",
3399
+ callingCode: "+423"
3400
+ },
3401
+ {
3402
+ country: "Lithuania",
3403
+ countryCode: "LT",
3404
+ callingCode: "+370"
3405
+ },
3406
+ {
3407
+ country: "Luxembourg",
3408
+ countryCode: "LU",
3409
+ callingCode: "+352"
3410
+ },
3411
+ {
3412
+ country: "Macao",
3413
+ countryCode: "MO",
3414
+ callingCode: "+853"
3415
+ },
3416
+ {
3417
+ country: "Macedonia",
3418
+ countryCode: "MK",
3419
+ callingCode: "+389"
3420
+ },
3421
+ {
3422
+ country: "Madagascar",
3423
+ countryCode: "MG",
3424
+ callingCode: "+261"
3425
+ },
3426
+ {
3427
+ country: "Malawi",
3428
+ countryCode: "MW",
3429
+ callingCode: "+265"
3430
+ },
3431
+ {
3432
+ country: "Malaysia",
3433
+ countryCode: "MY",
3434
+ callingCode: "+60"
3435
+ },
3436
+ {
3437
+ country: "Maldives",
3438
+ countryCode: "MV",
3439
+ callingCode: "+960"
3440
+ },
3441
+ {
3442
+ country: "Mali",
3443
+ countryCode: "ML",
3444
+ callingCode: "+223"
3445
+ },
3446
+ {
3447
+ country: "Malta",
3448
+ countryCode: "MT",
3449
+ callingCode: "+356"
3450
+ },
3451
+ {
3452
+ country: "Marshall Islands",
3453
+ countryCode: "MH",
3454
+ callingCode: "+692"
3455
+ },
3456
+ {
3457
+ country: "Martinique",
3458
+ countryCode: "MQ",
3459
+ callingCode: "+596"
3460
+ },
3461
+ {
3462
+ country: "Mauritania",
3463
+ countryCode: "MR",
3464
+ callingCode: "+222"
3465
+ },
3466
+ {
3467
+ country: "Mauritius",
3468
+ countryCode: "MU",
3469
+ callingCode: "+230"
3470
+ },
3471
+ {
3472
+ country: "Mayotte",
3473
+ countryCode: "YT",
3474
+ callingCode: "+262"
3475
+ },
3476
+ {
3477
+ country: "Mexico",
3478
+ countryCode: "MX",
3479
+ callingCode: "+52"
3480
+ },
3481
+ {
3482
+ country: "Micronesia",
3483
+ countryCode: "FM",
3484
+ callingCode: "+691"
3485
+ },
3486
+ {
3487
+ country: "Moldova",
3488
+ countryCode: "MD",
3489
+ callingCode: "+373"
3490
+ },
3491
+ {
3492
+ country: "Monaco",
3493
+ countryCode: "MC",
3494
+ callingCode: "+377"
3495
+ },
3496
+ {
3497
+ country: "Mongolia",
3498
+ countryCode: "MN",
3499
+ callingCode: "+976"
3500
+ },
3501
+ {
3502
+ country: "Montserrat",
3503
+ countryCode: "MS",
3504
+ callingCode: "+1664"
3505
+ },
3506
+ {
3507
+ country: "Morocco",
3508
+ countryCode: "MA",
3509
+ callingCode: "+212"
3510
+ },
3511
+ {
3512
+ country: "Mozambique",
3513
+ countryCode: "MZ",
3514
+ callingCode: "+258"
3515
+ },
3516
+ {
3517
+ country: "Myanmar",
3518
+ countryCode: "MM",
3519
+ callingCode: "+95"
3520
+ },
3521
+ {
3522
+ country: "Namibia",
3523
+ countryCode: "NA",
3524
+ callingCode: "+264"
3525
+ },
3526
+ {
3527
+ country: "Nauru",
3528
+ countryCode: "NR",
3529
+ callingCode: "+674"
3530
+ },
3531
+ {
3532
+ country: "Nepal",
3533
+ countryCode: "NP",
3534
+ callingCode: "+977"
3535
+ },
3536
+ {
3537
+ country: "Netherlands",
3538
+ countryCode: "NL",
3539
+ callingCode: "+31"
3540
+ },
3541
+ {
3542
+ country: "New Caledonia",
3543
+ countryCode: "NC",
3544
+ callingCode: "+687"
3545
+ },
3546
+ {
3547
+ country: "New Zealand",
3548
+ countryCode: "NZ",
3549
+ callingCode: "+64"
3550
+ },
3551
+ {
3552
+ country: "Nicaragua",
3553
+ countryCode: "NI",
3554
+ callingCode: "+505"
3555
+ },
3556
+ {
3557
+ country: "Niger",
3558
+ countryCode: "NE",
3559
+ callingCode: "+227"
3560
+ },
3561
+ {
3562
+ country: "Nigeria",
3563
+ countryCode: "NG",
3564
+ callingCode: "+234"
3565
+ },
3566
+ {
3567
+ country: "Niue",
3568
+ countryCode: "NU",
3569
+ callingCode: "+683"
3570
+ },
3571
+ {
3572
+ country: "Norfolk Island",
3573
+ countryCode: "NF",
3574
+ callingCode: "+672"
3575
+ },
3576
+ {
3577
+ country: "North Korea",
3578
+ countryCode: "KP",
3579
+ callingCode: "+850"
3580
+ },
3581
+ {
3582
+ country: "Northern Mariana Islands",
3583
+ countryCode: "MP",
3584
+ callingCode: "+1670"
3585
+ },
3586
+ {
3587
+ country: "Norway",
3588
+ countryCode: "NO",
3589
+ callingCode: "+47"
3590
+ },
3591
+ {
3592
+ country: "Oman",
3593
+ countryCode: "OM",
3594
+ callingCode: "+968"
3595
+ },
3596
+ {
3597
+ country: "Pakistan",
3598
+ countryCode: "PK",
3599
+ callingCode: "+92"
3600
+ },
3601
+ {
3602
+ country: "Palau",
3603
+ countryCode: "PW",
3604
+ callingCode: "+680"
3605
+ },
3606
+ {
3607
+ country: "Palestinian Territory",
3608
+ countryCode: "PS",
3609
+ callingCode: "+970"
3610
+ },
3611
+ {
3612
+ country: "Panama",
3613
+ countryCode: "PA",
3614
+ callingCode: "+507"
3615
+ },
3616
+ {
3617
+ country: "Papua New Guinea",
3618
+ countryCode: "PG",
3619
+ callingCode: "+675"
3620
+ },
3621
+ {
3622
+ country: "Paraguay",
3623
+ countryCode: "PY",
3624
+ callingCode: "+595"
3625
+ },
3626
+ {
3627
+ country: "Peru",
3628
+ countryCode: "PE",
3629
+ callingCode: "+51"
3630
+ },
3631
+ {
3632
+ country: "Philippines",
3633
+ countryCode: "PH",
3634
+ callingCode: "+63"
3635
+ },
3636
+ {
3637
+ country: "Pitcairn",
3638
+ countryCode: "PN",
3639
+ callingCode: "+872"
3640
+ },
3641
+ {
3642
+ country: "Poland",
3643
+ countryCode: "PL",
3644
+ callingCode: "+48"
3645
+ },
3646
+ {
3647
+ country: "Portugal",
3648
+ countryCode: "PT",
3649
+ callingCode: "+351"
3650
+ },
3651
+ {
3652
+ country: "Puerto Rico",
3653
+ countryCode: "PR",
3654
+ callingCode: "+1"
3655
+ },
3656
+ {
3657
+ country: "Qatar",
3658
+ countryCode: "QA",
3659
+ callingCode: "+974"
3660
+ },
3661
+ {
3662
+ country: "Republic of the Congo",
3663
+ countryCode: "CG",
3664
+ callingCode: "+242"
3665
+ },
3666
+ {
3667
+ country: "Reunion",
3668
+ countryCode: "RE",
3669
+ callingCode: "+262"
3670
+ },
3671
+ {
3672
+ country: "Romania",
3673
+ countryCode: "RO",
3674
+ callingCode: "+40"
3675
+ },
3676
+ {
3677
+ country: "Russia",
3678
+ countryCode: "RU",
3679
+ callingCode: "+7"
3680
+ },
3681
+ {
3682
+ country: "Rwanda",
3683
+ countryCode: "RW",
3684
+ callingCode: "+250"
3685
+ },
3686
+ {
3687
+ country: "Saint Helena",
3688
+ countryCode: "SH",
3689
+ callingCode: "+290"
3690
+ },
3691
+ {
3692
+ country: "Saint Kitts and Nevis",
3693
+ countryCode: "KN",
3694
+ callingCode: "+1869"
3695
+ },
3696
+ {
3697
+ country: "Saint Lucia",
3698
+ countryCode: "LC",
3699
+ callingCode: "+1758"
3700
+ },
3701
+ {
3702
+ country: "Saint Pierre and Miquelon",
3703
+ countryCode: "PM",
3704
+ callingCode: "+508"
3705
+ },
3706
+ {
3707
+ country: "Saint Vincent and the Grenadines",
3708
+ countryCode: "VC",
3709
+ callingCode: "+1784"
3710
+ },
3711
+ {
3712
+ country: "Samoa",
3713
+ countryCode: "WS",
3714
+ callingCode: "+685"
3715
+ },
3716
+ {
3717
+ country: "San Marino",
3718
+ countryCode: "SM",
3719
+ callingCode: "+378"
3720
+ },
3721
+ {
3722
+ country: "Sao Tome and Principe",
3723
+ countryCode: "ST",
3724
+ callingCode: "+239"
3725
+ },
3726
+ {
3727
+ country: "Saudi Arabia",
3728
+ countryCode: "SA",
3729
+ callingCode: "+966"
3730
+ },
3731
+ {
3732
+ country: "Senegal",
3733
+ countryCode: "SN",
3734
+ callingCode: "+221"
3735
+ },
3736
+ {
3737
+ country: "Seychelles",
3738
+ countryCode: "SC",
3739
+ callingCode: "+248"
3740
+ },
3741
+ {
3742
+ country: "Sierra Leone",
3743
+ countryCode: "SL",
3744
+ callingCode: "+232"
3745
+ },
3746
+ {
3747
+ country: "Singapore",
3748
+ countryCode: "SG",
3749
+ callingCode: "+65"
3750
+ },
3751
+ {
3752
+ country: "Slovakia",
3753
+ countryCode: "SK",
3754
+ callingCode: "+421"
3755
+ },
3756
+ {
3757
+ country: "Slovenia",
3758
+ countryCode: "SI",
3759
+ callingCode: "+386"
3760
+ },
3761
+ {
3762
+ country: "Solomon Islands",
3763
+ countryCode: "SB",
3764
+ callingCode: "+677"
3765
+ },
3766
+ {
3767
+ country: "Somalia",
3768
+ countryCode: "SO",
3769
+ callingCode: "+252"
3770
+ },
3771
+ {
3772
+ country: "South Africa",
3773
+ countryCode: "ZA",
3774
+ callingCode: "+27"
3775
+ },
3776
+ {
3777
+ country: "South Georgia and the South Sandwich Islands",
3778
+ countryCode: "GS",
3779
+ callingCode: "+500"
3780
+ },
3781
+ {
3782
+ country: "South Korea",
3783
+ countryCode: "KR",
3784
+ callingCode: "+82"
3785
+ },
3786
+ {
3787
+ country: "Spain",
3788
+ countryCode: "ES",
3789
+ callingCode: "+34"
3790
+ },
3791
+ {
3792
+ country: "Sri Lanka",
3793
+ countryCode: "LK",
3794
+ callingCode: "+94"
3795
+ },
3796
+ {
3797
+ country: "Sudan",
3798
+ countryCode: "SD",
3799
+ callingCode: "+249"
3800
+ },
3801
+ {
3802
+ country: "Suriname",
3803
+ countryCode: "SR",
3804
+ callingCode: "+597"
3805
+ },
3806
+ {
3807
+ country: "Svalbard and Jan Mayen",
3808
+ countryCode: "SJ",
3809
+ callingCode: "+47"
3810
+ },
3811
+ {
3812
+ country: "Swaziland",
3813
+ countryCode: "SZ",
3814
+ callingCode: "+268"
3815
+ },
3816
+ {
3817
+ country: "Sweden",
3818
+ countryCode: "SE",
3819
+ callingCode: "+46"
3820
+ },
3821
+ {
3822
+ country: "Switzerland",
3823
+ countryCode: "CH",
3824
+ callingCode: "+41"
3825
+ },
3826
+ {
3827
+ country: "Syria",
3828
+ countryCode: "SY",
3829
+ callingCode: "+963"
3830
+ },
3831
+ {
3832
+ country: "Taiwan",
3833
+ countryCode: "TW",
3834
+ callingCode: "+886"
3835
+ },
3836
+ {
3837
+ country: "Tajikistan",
3838
+ countryCode: "TJ",
3839
+ callingCode: "+992"
3840
+ },
3841
+ {
3842
+ country: "Tanzania",
3843
+ countryCode: "TZ",
3844
+ callingCode: "+255"
3845
+ },
3846
+ {
3847
+ country: "Thailand",
3848
+ countryCode: "TH",
3849
+ callingCode: "+66"
3850
+ },
3851
+ {
3852
+ country: "Togo",
3853
+ countryCode: "TG",
3854
+ callingCode: "+228"
3855
+ },
3856
+ {
3857
+ country: "Tokelau",
3858
+ countryCode: "TK",
3859
+ callingCode: "+690"
3860
+ },
3861
+ {
3862
+ country: "Tonga",
3863
+ countryCode: "TO",
3864
+ callingCode: "+676"
3865
+ },
3866
+ {
3867
+ country: "Trinidad and Tobago",
3868
+ countryCode: "TT",
3869
+ callingCode: "+1868"
3870
+ },
3871
+ {
3872
+ country: "Tunisia",
3873
+ countryCode: "TN",
3874
+ callingCode: "+216"
3875
+ },
3876
+ {
3877
+ country: "Turkey",
3878
+ countryCode: "TR",
3879
+ callingCode: "+90"
3880
+ },
3881
+ {
3882
+ country: "Turkmenistan",
3883
+ countryCode: "TM",
3884
+ callingCode: "+993"
3885
+ },
3886
+ {
3887
+ country: "Turks and Caicos Islands",
3888
+ countryCode: "TC",
3889
+ callingCode: "+1649"
3890
+ },
3891
+ {
3892
+ country: "Tuvalu",
3893
+ countryCode: "TV",
3894
+ callingCode: "+688"
3895
+ },
3896
+ {
3897
+ country: "U.S. Virgin Islands",
3898
+ countryCode: "VI",
3899
+ callingCode: "+1340"
3900
+ },
3901
+ {
3902
+ country: "Uganda",
3903
+ countryCode: "UG",
3904
+ callingCode: "+256"
3905
+ },
3906
+ {
3907
+ country: "Ukraine",
3908
+ countryCode: "UA",
3909
+ callingCode: "+380"
3910
+ },
3911
+ {
3912
+ country: "United Arab Emirates",
3913
+ countryCode: "AE",
3914
+ callingCode: "+971"
3915
+ },
3916
+ {
3917
+ country: "United Kingdom",
3918
+ countryCode: "GB",
3919
+ callingCode: "+44"
3920
+ },
3921
+ {
3922
+ country: "United States",
3923
+ countryCode: "US",
3924
+ callingCode: "+1"
3925
+ },
3926
+ {
3927
+ country: "United States Minor Outlying Islands",
3928
+ countryCode: "UM",
3929
+ callingCode: "+1"
3930
+ },
3931
+ {
3932
+ country: "Uruguay",
3933
+ countryCode: "UY",
3934
+ callingCode: "+598"
3935
+ },
3936
+ {
3937
+ country: "Uzbekistan",
3938
+ countryCode: "UZ",
3939
+ callingCode: "+998"
3940
+ },
3941
+ {
3942
+ country: "Vanuatu",
3943
+ countryCode: "VU",
3944
+ callingCode: "+678"
3945
+ },
3946
+ {
3947
+ country: "Vatican",
3948
+ countryCode: "VA",
3949
+ callingCode: "+379"
3950
+ },
3951
+ {
3952
+ country: "Venezuela",
3953
+ countryCode: "VE",
3954
+ callingCode: "+58"
3955
+ },
3956
+ {
3957
+ country: "Vietnam",
3958
+ countryCode: "VN",
3959
+ callingCode: "+84"
3960
+ },
3961
+ {
3962
+ country: "Wallis and Futuna",
3963
+ countryCode: "WF",
3964
+ callingCode: "+681"
3965
+ },
3966
+ {
3967
+ country: "Western Sahara",
3968
+ countryCode: "EH",
3969
+ callingCode: "+212"
3970
+ },
3971
+ {
3972
+ country: "Yemen",
3973
+ countryCode: "YE",
3974
+ callingCode: "+967"
3975
+ },
3976
+ {
3977
+ country: "Zambia",
3978
+ countryCode: "ZM",
3979
+ callingCode: "+260"
3980
+ },
3981
+ {
3982
+ country: "Zimbabwe",
3983
+ countryCode: "ZW",
3984
+ callingCode: "+263"
3985
+ }
3986
+ ];
3987
+
3988
+ const getDefaultCountry = (code) => {
3989
+ const result = countryData.find((item) => item.countryCode === code);
3990
+ return result;
3991
+ };
3992
+ const getBySearch = (search, onlyCountry, excludeCountry) => {
3993
+ let countries = [];
3994
+ if (excludeCountry && excludeCountry.length > 0) {
3995
+ countries = countryData.filter((item) => !(excludeCountry === null || excludeCountry === void 0 ? void 0 : excludeCountry.includes(item.countryCode)));
3996
+ }
3997
+ else if (onlyCountry && (onlyCountry === null || onlyCountry === void 0 ? void 0 : onlyCountry.length) > 0) {
3998
+ countries = countryData.filter((item) => onlyCountry === null || onlyCountry === void 0 ? void 0 : onlyCountry.includes(item.countryCode));
3999
+ }
4000
+ else {
4001
+ countries = countryData;
4002
+ }
4003
+ const result = countries.filter((item) => {
4004
+ const escapeRegExp = (str) => str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
4005
+ const regex = new RegExp(escapeRegExp(search), "gi");
4006
+ return item.country.match(regex);
4007
+ });
4008
+ return result;
4009
+ };
4010
+ const getCountryByFilter = (onlyCountry, excludeCountry, preferredCountry) => {
4011
+ let countries = [];
4012
+ if (excludeCountry && excludeCountry.length > 0) {
4013
+ countries = countryData.filter((item) => !(excludeCountry === null || excludeCountry === void 0 ? void 0 : excludeCountry.includes(item.countryCode)));
4014
+ }
4015
+ else if (onlyCountry && (onlyCountry === null || onlyCountry === void 0 ? void 0 : onlyCountry.length) > 0) {
4016
+ countries = countryData.filter((item) => onlyCountry === null || onlyCountry === void 0 ? void 0 : onlyCountry.includes(item.countryCode));
4017
+ }
4018
+ else {
4019
+ countries = countryData;
4020
+ }
4021
+ const result = countries.sort((a, b) => (Number(preferredCountry === null || preferredCountry === void 0 ? void 0 : preferredCountry.includes(b.countryCode)) - Number(preferredCountry === null || preferredCountry === void 0 ? void 0 : preferredCountry.includes(a.countryCode)))
4022
+ || ((preferredCountry === null || preferredCountry === void 0 ? void 0 : preferredCountry.indexOf(a.countryCode)) - (preferredCountry === null || preferredCountry === void 0 ? void 0 : preferredCountry.indexOf(b.countryCode))));
4023
+ return result;
4024
+ };
4025
+
4026
+ function useOnClickOutside(ref, handler) {
4027
+ react.exports.useEffect(() => {
4028
+ const listener = (event) => {
4029
+ if (!ref.current || ref.current.contains(event.target)) {
4030
+ return;
4031
+ }
4032
+ handler(event);
4033
+ };
4034
+ document.addEventListener("mousedown", listener);
4035
+ document.addEventListener("touchstart", listener);
4036
+ return () => {
4037
+ document.removeEventListener("mousedown", listener);
4038
+ document.removeEventListener("touchstart", listener);
4039
+ };
4040
+ }, [ref, handler]);
4041
+ }
4042
+
4043
+ const PhoneInput = ({ placeholder, country, onChange, value, iconComponent, inputProps, onlyCountries, excludeCountries, preferredCountries, showDropdownIcon = true, dialCodeInputField = false, search = true, searchPlaceholder = "Search country", showSearchIcon = true, searchIconComponent, searchProps, searchNotFound = "Not found" }) => {
4044
+ const [selected, setSelected] = react.exports.useState({});
4045
+ const [isDropdown, setDropdown] = react.exports.useState(false);
4046
+ const [inputValue, setInputValue] = react.exports.useState(value || "");
4047
+ const [countryDataInfo, setCountryData] = react.exports.useState(countryData);
4048
+ const ref = react.exports.useRef();
4049
+ useOnClickOutside(ref, () => setDropdown(false));
4050
+ //Handler
4051
+ const handleChange = (e) => {
4052
+ const onlyNumber = e.target.value.replace(/\D/g, '');
4053
+ if (dialCodeInputField) {
4054
+ onChange("+" + onlyNumber);
4055
+ setInputValue("+" + onlyNumber);
4056
+ }
4057
+ else {
4058
+ setInputValue(onlyNumber);
4059
+ onChange(selected.callingCode + onlyNumber);
4060
+ }
4061
+ };
4062
+ const onSearchHandler = (e) => {
4063
+ const search = e.target.value;
4064
+ setCountryData(getBySearch(search, onlyCountries, excludeCountries));
4065
+ };
4066
+ const handleSelected = (item) => {
4067
+ if (dialCodeInputField) {
4068
+ const result = inputValue === null || inputValue === void 0 ? void 0 : inputValue.replace(selected.callingCode, item.callingCode);
4069
+ setInputValue(result.length > 0 ? result : item.callingCode);
4070
+ onChange(result.length > 0 ? result : item.callingCode);
4071
+ }
4072
+ else {
4073
+ onChange(item.callingCode + inputValue);
4074
+ }
4075
+ setSelected(item);
4076
+ setDropdown(false);
4077
+ };
4078
+ react.exports.useMemo(() => {
4079
+ if (dialCodeInputField) {
4080
+ const result = inputValue === null || inputValue === void 0 ? void 0 : inputValue.replace(selected.callingCode, getDefaultCountry(country).callingCode);
4081
+ console.log(result);
4082
+ setInputValue(result.length > 0 ? result : getDefaultCountry(country).callingCode);
4083
+ }
4084
+ setSelected(getDefaultCountry(country));
4085
+ }, [country, dialCodeInputField]);
4086
+ react.exports.useMemo(() => {
4087
+ setCountryData(getCountryByFilter(onlyCountries, excludeCountries, preferredCountries));
4088
+ }, [onlyCountries, excludeCountries, preferredCountries]);
4089
+ return (React.createElement("div", { className: "simple-phone-input-sri198-container" },
4090
+ React.createElement("div", { className: "simple-phone-input-sri198-main" },
4091
+ React.createElement("div", { className: "simple-phone-input-sri198-dropdown-container", ref: ref },
4092
+ React.createElement("div", { onClick: () => setDropdown(!isDropdown), className: dialCodeInputField ? "simple-phone-input-sri198-dropdown-container-button dial" : "simple-phone-input-sri198-dropdown-container-button" },
4093
+ React.createElement("img", { src: "https://cdn.jsdelivr.net/gh/siamahnaf198/country-flags@main/img/" + selected.countryCode + ".svg", alt: selected.country, width: "20px" }),
4094
+ !dialCodeInputField &&
4095
+ React.createElement("span", { className: "simple-phone-input-sri198-selected-code" }, selected.callingCode),
4096
+ showDropdownIcon &&
4097
+ React.createElement("div", { className: isDropdown ? "simple-phone-input-sri198-dropdown-icon" : "simple-phone-input-sri198-dropdown-icon active" }, iconComponent ? iconComponent : (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", preserveAspectRatio: "xMidYMid meet", viewBox: "0 0 24 24" },
4098
+ React.createElement("path", { fill: "currentColor", d: "m7 10l5 5l5-5z" }))))),
4099
+ React.createElement("ul", { className: isDropdown ? "simple-phone-input-sri198-dropdown active" : "simple-phone-input-sri198-dropdown" },
4100
+ search &&
4101
+ React.createElement("div", { className: "simple-phone-input-sri198-search-container" },
4102
+ React.createElement("input", Object.assign({ placeholder: searchPlaceholder }, searchProps, { onChange: onSearchHandler })),
4103
+ showSearchIcon &&
4104
+ React.createElement("div", { className: "simple-phone-input-sri198-search-icon" }, searchIconComponent !== null && searchIconComponent !== void 0 ? searchIconComponent : (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", preserveAspectRatio: "xMidYMid meet", viewBox: "0 0 48 48" },
4105
+ React.createElement("g", { fill: "#616161" },
4106
+ React.createElement("path", { d: "m29.175 31.99l2.828-2.827l12.019 12.019l-2.828 2.827z" }),
4107
+ React.createElement("circle", { cx: "20", cy: "20", r: "16" })),
4108
+ React.createElement("path", { fill: "#37474F", d: "m32.45 35.34l2.827-2.828l8.696 8.696l-2.828 2.828z" }),
4109
+ React.createElement("circle", { cx: "20", cy: "20", r: "13", fill: "#64B5F6" }),
4110
+ React.createElement("path", { fill: "#BBDEFB", d: "M26.9 14.2c-1.7-2-4.2-3.2-6.9-3.2s-5.2 1.2-6.9 3.2c-.4.4-.3 1.1.1 1.4c.4.4 1.1.3 1.4-.1C16 13.9 17.9 13 20 13s4 .9 5.4 2.5c.2.2.5.4.8.4c.2 0 .5-.1.6-.2c.4-.4.4-1.1.1-1.5z" }))))),
4111
+ countryDataInfo.length === 0 &&
4112
+ React.createElement("div", { className: "simple-phone-input-sri198-not-found" }, searchNotFound),
4113
+ countryDataInfo.map((item, i) => (React.createElement("li", { key: i, onClick: () => handleSelected(item), className: item.countryCode === selected.countryCode ? "active" : "" },
4114
+ React.createElement("img", { src: "https://cdn.jsdelivr.net/gh/siamahnaf198/country-flags@main/img/" + item.countryCode + ".svg", alt: item.country, width: "20px" }),
4115
+ React.createElement("span", { className: "simple-phone-input-sri198-dropdown-text" }, item.country),
4116
+ React.createElement("span", { className: "simple-phone-input-sri198-dropdown-country-code" }, item.callingCode)))))),
4117
+ React.createElement("input", Object.assign({ className: "simple-phone-input-sri198-input", placeholder: placeholder, onChange: handleChange, type: "tel", onInput: (e) => {
4118
+ if (dialCodeInputField) {
4119
+ const oldVal = inputValue.slice(selected.callingCode.length);
4120
+ if (e.target.value.startsWith(selected.callingCode)) {
4121
+ e.target.value = e.target.value;
4122
+ }
4123
+ else {
4124
+ e.target.value = selected.callingCode + oldVal;
4125
+ }
4126
+ }
4127
+ }, value: inputValue }, inputProps)))));
2808
4128
  };
2809
4129
 
2810
4130
  exports.PhoneInput = PhoneInput;