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