└── build ├── css ├── demo.css ├── intlTelInput.css └── intlTelInput.min.css ├── img ├── flags.png └── flags@2x.png └── js ├── data.js ├── data.min.js ├── intlTelInput-jquery.js ├── intlTelInput-jquery.min.js ├── intlTelInput.js ├── intlTelInput.min.js └── utils.js /build/css/demo.css: -------------------------------------------------------------------------------- 1 | * { 2 | box-sizing: border-box; 3 | -moz-box-sizing: border-box; } 4 | 5 | body { 6 | margin: 20px; 7 | font-size: 14px; 8 | font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; 9 | color: #555; } 10 | 11 | .iti__hide { 12 | display: none; } 13 | 14 | pre { 15 | margin: 0 !important; 16 | display: inline-block; } 17 | 18 | .token.operator, 19 | .token.entity, 20 | .token.url, 21 | .language-css .token.string, 22 | .style .token.string, 23 | .token.variable { 24 | background: none; } 25 | 26 | input, button { 27 | height: 35px; 28 | margin: 0; 29 | padding: 6px 12px; 30 | border-radius: 2px; 31 | font-family: inherit; 32 | font-size: 100%; 33 | color: inherit; } 34 | input[disabled], button[disabled] { 35 | background-color: #eee; } 36 | 37 | input, select { 38 | border: 1px solid #CCC; 39 | width: 250px; } 40 | 41 | ::-webkit-input-placeholder { 42 | color: #BBB; } 43 | 44 | ::-moz-placeholder { 45 | /* Firefox 19+ */ 46 | color: #BBB; 47 | opacity: 1; } 48 | 49 | :-ms-input-placeholder { 50 | color: #BBB; } 51 | 52 | button { 53 | color: #FFF; 54 | background-color: #428BCA; 55 | border: 1px solid #357EBD; } 56 | button:hover { 57 | background-color: #3276B1; 58 | border-color: #285E8E; 59 | cursor: pointer; } 60 | 61 | #result { 62 | margin-bottom: 100px; } 63 | -------------------------------------------------------------------------------- /build/css/intlTelInput.css: -------------------------------------------------------------------------------- 1 | .iti { 2 | position: relative; 3 | display: inline-block; } 4 | .iti * { 5 | box-sizing: border-box; 6 | -moz-box-sizing: border-box; } 7 | .iti__hide { 8 | display: none; } 9 | .iti__v-hide { 10 | visibility: hidden; } 11 | .iti input, .iti input[type=text], .iti input[type=tel] { 12 | position: relative; 13 | z-index: 0; 14 | margin-top: 0 !important; 15 | margin-bottom: 0 !important; 16 | padding-right: 36px; 17 | margin-right: 0; } 18 | .iti__flag-container { 19 | position: absolute; 20 | top: 0; 21 | bottom: 0; 22 | right: 0; 23 | padding: 1px; } 24 | .iti__selected-flag { 25 | z-index: 1; 26 | position: relative; 27 | display: flex; 28 | align-items: center; 29 | height: 100%; 30 | padding: 0 6px 0 8px; } 31 | .iti__arrow { 32 | margin-left: 6px; 33 | width: 0; 34 | height: 0; 35 | border-left: 3px solid transparent; 36 | border-right: 3px solid transparent; 37 | border-top: 4px solid #555; } 38 | .iti__arrow--up { 39 | border-top: none; 40 | border-bottom: 4px solid #555; } 41 | .iti__country-list { 42 | position: absolute; 43 | z-index: 2; 44 | list-style: none; 45 | text-align: left; 46 | padding: 0; 47 | margin: 0 0 0 -1px; 48 | box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2); 49 | background-color: white; 50 | border: 1px solid #CCC; 51 | white-space: nowrap; 52 | max-height: 200px; 53 | overflow-y: scroll; 54 | -webkit-overflow-scrolling: touch; } 55 | .iti__country-list--dropup { 56 | bottom: 100%; 57 | margin-bottom: -1px; } 58 | @media (max-width: 500px) { 59 | .iti__country-list { 60 | white-space: normal; } } 61 | .iti__flag-box { 62 | display: inline-block; 63 | width: 20px; } 64 | .iti__divider { 65 | padding-bottom: 5px; 66 | margin-bottom: 5px; 67 | border-bottom: 1px solid #CCC; } 68 | .iti__country { 69 | padding: 5px 10px; 70 | outline: none; } 71 | .iti__dial-code { 72 | color: #999; } 73 | .iti__country.iti__highlight { 74 | background-color: rgba(0, 0, 0, 0.05); } 75 | .iti__flag-box, .iti__country-name, .iti__dial-code { 76 | vertical-align: middle; } 77 | .iti__flag-box, .iti__country-name { 78 | margin-right: 6px; } 79 | .iti--allow-dropdown input, .iti--allow-dropdown input[type=text], .iti--allow-dropdown input[type=tel], .iti--separate-dial-code input, .iti--separate-dial-code input[type=text], .iti--separate-dial-code input[type=tel] { 80 | padding-right: 6px; 81 | padding-left: 52px; 82 | margin-left: 0; } 83 | .iti--allow-dropdown .iti__flag-container, .iti--separate-dial-code .iti__flag-container { 84 | right: auto; 85 | left: 0; } 86 | .iti--allow-dropdown .iti__flag-container:hover { 87 | cursor: pointer; } 88 | .iti--allow-dropdown .iti__flag-container:hover .iti__selected-flag { 89 | background-color: rgba(0, 0, 0, 0.05); } 90 | .iti--allow-dropdown input[disabled] + .iti__flag-container:hover, 91 | .iti--allow-dropdown input[readonly] + .iti__flag-container:hover { 92 | cursor: default; } 93 | .iti--allow-dropdown input[disabled] + .iti__flag-container:hover .iti__selected-flag, 94 | .iti--allow-dropdown input[readonly] + .iti__flag-container:hover .iti__selected-flag { 95 | background-color: transparent; } 96 | .iti--separate-dial-code .iti__selected-flag { 97 | background-color: rgba(0, 0, 0, 0.05); } 98 | .iti--separate-dial-code .iti__selected-dial-code { 99 | margin-left: 6px; } 100 | .iti--container { 101 | position: absolute; 102 | top: -1000px; 103 | left: -1000px; 104 | z-index: 1060; 105 | padding: 1px; } 106 | .iti--container:hover { 107 | cursor: pointer; } 108 | 109 | .iti-mobile .iti--container { 110 | top: 30px; 111 | bottom: 30px; 112 | left: 30px; 113 | right: 30px; 114 | position: fixed; } 115 | 116 | .iti-mobile .iti__country-list { 117 | max-height: 100%; 118 | width: 100%; } 119 | 120 | .iti-mobile .iti__country { 121 | padding: 10px 10px; 122 | line-height: 1.5em; } 123 | 124 | .iti__flag { 125 | width: 20px; } 126 | .iti__flag.iti__be { 127 | width: 18px; } 128 | .iti__flag.iti__ch { 129 | width: 15px; } 130 | .iti__flag.iti__mc { 131 | width: 19px; } 132 | .iti__flag.iti__ne { 133 | width: 18px; } 134 | .iti__flag.iti__np { 135 | width: 13px; } 136 | .iti__flag.iti__va { 137 | width: 15px; } 138 | @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { 139 | .iti__flag { 140 | background-size: 5652px 15px; } } 141 | .iti__flag.iti__ac { 142 | height: 10px; 143 | background-position: 0px 0px; } 144 | .iti__flag.iti__ad { 145 | height: 14px; 146 | background-position: -22px 0px; } 147 | .iti__flag.iti__ae { 148 | height: 10px; 149 | background-position: -44px 0px; } 150 | .iti__flag.iti__af { 151 | height: 14px; 152 | background-position: -66px 0px; } 153 | .iti__flag.iti__ag { 154 | height: 14px; 155 | background-position: -88px 0px; } 156 | .iti__flag.iti__ai { 157 | height: 10px; 158 | background-position: -110px 0px; } 159 | .iti__flag.iti__al { 160 | height: 15px; 161 | background-position: -132px 0px; } 162 | .iti__flag.iti__am { 163 | height: 10px; 164 | background-position: -154px 0px; } 165 | .iti__flag.iti__ao { 166 | height: 14px; 167 | background-position: -176px 0px; } 168 | .iti__flag.iti__aq { 169 | height: 14px; 170 | background-position: -198px 0px; } 171 | .iti__flag.iti__ar { 172 | height: 13px; 173 | background-position: -220px 0px; } 174 | .iti__flag.iti__as { 175 | height: 10px; 176 | background-position: -242px 0px; } 177 | .iti__flag.iti__at { 178 | height: 14px; 179 | background-position: -264px 0px; } 180 | .iti__flag.iti__au { 181 | height: 10px; 182 | background-position: -286px 0px; } 183 | .iti__flag.iti__aw { 184 | height: 14px; 185 | background-position: -308px 0px; } 186 | .iti__flag.iti__ax { 187 | height: 13px; 188 | background-position: -330px 0px; } 189 | .iti__flag.iti__az { 190 | height: 10px; 191 | background-position: -352px 0px; } 192 | .iti__flag.iti__ba { 193 | height: 10px; 194 | background-position: -374px 0px; } 195 | .iti__flag.iti__bb { 196 | height: 14px; 197 | background-position: -396px 0px; } 198 | .iti__flag.iti__bd { 199 | height: 12px; 200 | background-position: -418px 0px; } 201 | .iti__flag.iti__be { 202 | height: 15px; 203 | background-position: -440px 0px; } 204 | .iti__flag.iti__bf { 205 | height: 14px; 206 | background-position: -460px 0px; } 207 | .iti__flag.iti__bg { 208 | height: 12px; 209 | background-position: -482px 0px; } 210 | .iti__flag.iti__bh { 211 | height: 12px; 212 | background-position: -504px 0px; } 213 | .iti__flag.iti__bi { 214 | height: 12px; 215 | background-position: -526px 0px; } 216 | .iti__flag.iti__bj { 217 | height: 14px; 218 | background-position: -548px 0px; } 219 | .iti__flag.iti__bl { 220 | height: 14px; 221 | background-position: -570px 0px; } 222 | .iti__flag.iti__bm { 223 | height: 10px; 224 | background-position: -592px 0px; } 225 | .iti__flag.iti__bn { 226 | height: 10px; 227 | background-position: -614px 0px; } 228 | .iti__flag.iti__bo { 229 | height: 14px; 230 | background-position: -636px 0px; } 231 | .iti__flag.iti__bq { 232 | height: 14px; 233 | background-position: -658px 0px; } 234 | .iti__flag.iti__br { 235 | height: 14px; 236 | background-position: -680px 0px; } 237 | .iti__flag.iti__bs { 238 | height: 10px; 239 | background-position: -702px 0px; } 240 | .iti__flag.iti__bt { 241 | height: 14px; 242 | background-position: -724px 0px; } 243 | .iti__flag.iti__bv { 244 | height: 15px; 245 | background-position: -746px 0px; } 246 | .iti__flag.iti__bw { 247 | height: 14px; 248 | background-position: -768px 0px; } 249 | .iti__flag.iti__by { 250 | height: 10px; 251 | background-position: -790px 0px; } 252 | .iti__flag.iti__bz { 253 | height: 14px; 254 | background-position: -812px 0px; } 255 | .iti__flag.iti__ca { 256 | height: 10px; 257 | background-position: -834px 0px; } 258 | .iti__flag.iti__cc { 259 | height: 10px; 260 | background-position: -856px 0px; } 261 | .iti__flag.iti__cd { 262 | height: 15px; 263 | background-position: -878px 0px; } 264 | .iti__flag.iti__cf { 265 | height: 14px; 266 | background-position: -900px 0px; } 267 | .iti__flag.iti__cg { 268 | height: 14px; 269 | background-position: -922px 0px; } 270 | .iti__flag.iti__ch { 271 | height: 15px; 272 | background-position: -944px 0px; } 273 | .iti__flag.iti__ci { 274 | height: 14px; 275 | background-position: -961px 0px; } 276 | .iti__flag.iti__ck { 277 | height: 10px; 278 | background-position: -983px 0px; } 279 | .iti__flag.iti__cl { 280 | height: 14px; 281 | background-position: -1005px 0px; } 282 | .iti__flag.iti__cm { 283 | height: 14px; 284 | background-position: -1027px 0px; } 285 | .iti__flag.iti__cn { 286 | height: 14px; 287 | background-position: -1049px 0px; } 288 | .iti__flag.iti__co { 289 | height: 14px; 290 | background-position: -1071px 0px; } 291 | .iti__flag.iti__cp { 292 | height: 14px; 293 | background-position: -1093px 0px; } 294 | .iti__flag.iti__cr { 295 | height: 12px; 296 | background-position: -1115px 0px; } 297 | .iti__flag.iti__cu { 298 | height: 10px; 299 | background-position: -1137px 0px; } 300 | .iti__flag.iti__cv { 301 | height: 12px; 302 | background-position: -1159px 0px; } 303 | .iti__flag.iti__cw { 304 | height: 14px; 305 | background-position: -1181px 0px; } 306 | .iti__flag.iti__cx { 307 | height: 10px; 308 | background-position: -1203px 0px; } 309 | .iti__flag.iti__cy { 310 | height: 14px; 311 | background-position: -1225px 0px; } 312 | .iti__flag.iti__cz { 313 | height: 14px; 314 | background-position: -1247px 0px; } 315 | .iti__flag.iti__de { 316 | height: 12px; 317 | background-position: -1269px 0px; } 318 | .iti__flag.iti__dg { 319 | height: 10px; 320 | background-position: -1291px 0px; } 321 | .iti__flag.iti__dj { 322 | height: 14px; 323 | background-position: -1313px 0px; } 324 | .iti__flag.iti__dk { 325 | height: 15px; 326 | background-position: -1335px 0px; } 327 | .iti__flag.iti__dm { 328 | height: 10px; 329 | background-position: -1357px 0px; } 330 | .iti__flag.iti__do { 331 | height: 14px; 332 | background-position: -1379px 0px; } 333 | .iti__flag.iti__dz { 334 | height: 14px; 335 | background-position: -1401px 0px; } 336 | .iti__flag.iti__ea { 337 | height: 14px; 338 | background-position: -1423px 0px; } 339 | .iti__flag.iti__ec { 340 | height: 14px; 341 | background-position: -1445px 0px; } 342 | .iti__flag.iti__ee { 343 | height: 13px; 344 | background-position: -1467px 0px; } 345 | .iti__flag.iti__eg { 346 | height: 14px; 347 | background-position: -1489px 0px; } 348 | .iti__flag.iti__eh { 349 | height: 10px; 350 | background-position: -1511px 0px; } 351 | .iti__flag.iti__er { 352 | height: 10px; 353 | background-position: -1533px 0px; } 354 | .iti__flag.iti__es { 355 | height: 14px; 356 | background-position: -1555px 0px; } 357 | .iti__flag.iti__et { 358 | height: 10px; 359 | background-position: -1577px 0px; } 360 | .iti__flag.iti__eu { 361 | height: 14px; 362 | background-position: -1599px 0px; } 363 | .iti__flag.iti__fi { 364 | height: 12px; 365 | background-position: -1621px 0px; } 366 | .iti__flag.iti__fj { 367 | height: 10px; 368 | background-position: -1643px 0px; } 369 | .iti__flag.iti__fk { 370 | height: 10px; 371 | background-position: -1665px 0px; } 372 | .iti__flag.iti__fm { 373 | height: 11px; 374 | background-position: -1687px 0px; } 375 | .iti__flag.iti__fo { 376 | height: 15px; 377 | background-position: -1709px 0px; } 378 | .iti__flag.iti__fr { 379 | height: 14px; 380 | background-position: -1731px 0px; } 381 | .iti__flag.iti__ga { 382 | height: 15px; 383 | background-position: -1753px 0px; } 384 | .iti__flag.iti__gb { 385 | height: 10px; 386 | background-position: -1775px 0px; } 387 | .iti__flag.iti__gd { 388 | height: 12px; 389 | background-position: -1797px 0px; } 390 | .iti__flag.iti__ge { 391 | height: 14px; 392 | background-position: -1819px 0px; } 393 | .iti__flag.iti__gf { 394 | height: 14px; 395 | background-position: -1841px 0px; } 396 | .iti__flag.iti__gg { 397 | height: 14px; 398 | background-position: -1863px 0px; } 399 | .iti__flag.iti__gh { 400 | height: 14px; 401 | background-position: -1885px 0px; } 402 | .iti__flag.iti__gi { 403 | height: 10px; 404 | background-position: -1907px 0px; } 405 | .iti__flag.iti__gl { 406 | height: 14px; 407 | background-position: -1929px 0px; } 408 | .iti__flag.iti__gm { 409 | height: 14px; 410 | background-position: -1951px 0px; } 411 | .iti__flag.iti__gn { 412 | height: 14px; 413 | background-position: -1973px 0px; } 414 | .iti__flag.iti__gp { 415 | height: 14px; 416 | background-position: -1995px 0px; } 417 | .iti__flag.iti__gq { 418 | height: 14px; 419 | background-position: -2017px 0px; } 420 | .iti__flag.iti__gr { 421 | height: 14px; 422 | background-position: -2039px 0px; } 423 | .iti__flag.iti__gs { 424 | height: 10px; 425 | background-position: -2061px 0px; } 426 | .iti__flag.iti__gt { 427 | height: 13px; 428 | background-position: -2083px 0px; } 429 | .iti__flag.iti__gu { 430 | height: 11px; 431 | background-position: -2105px 0px; } 432 | .iti__flag.iti__gw { 433 | height: 10px; 434 | background-position: -2127px 0px; } 435 | .iti__flag.iti__gy { 436 | height: 12px; 437 | background-position: -2149px 0px; } 438 | .iti__flag.iti__hk { 439 | height: 14px; 440 | background-position: -2171px 0px; } 441 | .iti__flag.iti__hm { 442 | height: 10px; 443 | background-position: -2193px 0px; } 444 | .iti__flag.iti__hn { 445 | height: 10px; 446 | background-position: -2215px 0px; } 447 | .iti__flag.iti__hr { 448 | height: 10px; 449 | background-position: -2237px 0px; } 450 | .iti__flag.iti__ht { 451 | height: 12px; 452 | background-position: -2259px 0px; } 453 | .iti__flag.iti__hu { 454 | height: 10px; 455 | background-position: -2281px 0px; } 456 | .iti__flag.iti__ic { 457 | height: 14px; 458 | background-position: -2303px 0px; } 459 | .iti__flag.iti__id { 460 | height: 14px; 461 | background-position: -2325px 0px; } 462 | .iti__flag.iti__ie { 463 | height: 10px; 464 | background-position: -2347px 0px; } 465 | .iti__flag.iti__il { 466 | height: 15px; 467 | background-position: -2369px 0px; } 468 | .iti__flag.iti__im { 469 | height: 10px; 470 | background-position: -2391px 0px; } 471 | .iti__flag.iti__in { 472 | height: 14px; 473 | background-position: -2413px 0px; } 474 | .iti__flag.iti__io { 475 | height: 10px; 476 | background-position: -2435px 0px; } 477 | .iti__flag.iti__iq { 478 | height: 14px; 479 | background-position: -2457px 0px; } 480 | .iti__flag.iti__ir { 481 | height: 12px; 482 | background-position: -2479px 0px; } 483 | .iti__flag.iti__is { 484 | height: 15px; 485 | background-position: -2501px 0px; } 486 | .iti__flag.iti__it { 487 | height: 14px; 488 | background-position: -2523px 0px; } 489 | .iti__flag.iti__je { 490 | height: 12px; 491 | background-position: -2545px 0px; } 492 | .iti__flag.iti__jm { 493 | height: 10px; 494 | background-position: -2567px 0px; } 495 | .iti__flag.iti__jo { 496 | height: 10px; 497 | background-position: -2589px 0px; } 498 | .iti__flag.iti__jp { 499 | height: 14px; 500 | background-position: -2611px 0px; } 501 | .iti__flag.iti__ke { 502 | height: 14px; 503 | background-position: -2633px 0px; } 504 | .iti__flag.iti__kg { 505 | height: 12px; 506 | background-position: -2655px 0px; } 507 | .iti__flag.iti__kh { 508 | height: 13px; 509 | background-position: -2677px 0px; } 510 | .iti__flag.iti__ki { 511 | height: 10px; 512 | background-position: -2699px 0px; } 513 | .iti__flag.iti__km { 514 | height: 12px; 515 | background-position: -2721px 0px; } 516 | .iti__flag.iti__kn { 517 | height: 14px; 518 | background-position: -2743px 0px; } 519 | .iti__flag.iti__kp { 520 | height: 10px; 521 | background-position: -2765px 0px; } 522 | .iti__flag.iti__kr { 523 | height: 14px; 524 | background-position: -2787px 0px; } 525 | .iti__flag.iti__kw { 526 | height: 10px; 527 | background-position: -2809px 0px; } 528 | .iti__flag.iti__ky { 529 | height: 10px; 530 | background-position: -2831px 0px; } 531 | .iti__flag.iti__kz { 532 | height: 10px; 533 | background-position: -2853px 0px; } 534 | .iti__flag.iti__la { 535 | height: 14px; 536 | background-position: -2875px 0px; } 537 | .iti__flag.iti__lb { 538 | height: 14px; 539 | background-position: -2897px 0px; } 540 | .iti__flag.iti__lc { 541 | height: 10px; 542 | background-position: -2919px 0px; } 543 | .iti__flag.iti__li { 544 | height: 12px; 545 | background-position: -2941px 0px; } 546 | .iti__flag.iti__lk { 547 | height: 10px; 548 | background-position: -2963px 0px; } 549 | .iti__flag.iti__lr { 550 | height: 11px; 551 | background-position: -2985px 0px; } 552 | .iti__flag.iti__ls { 553 | height: 14px; 554 | background-position: -3007px 0px; } 555 | .iti__flag.iti__lt { 556 | height: 12px; 557 | background-position: -3029px 0px; } 558 | .iti__flag.iti__lu { 559 | height: 12px; 560 | background-position: -3051px 0px; } 561 | .iti__flag.iti__lv { 562 | height: 10px; 563 | background-position: -3073px 0px; } 564 | .iti__flag.iti__ly { 565 | height: 10px; 566 | background-position: -3095px 0px; } 567 | .iti__flag.iti__ma { 568 | height: 14px; 569 | background-position: -3117px 0px; } 570 | .iti__flag.iti__mc { 571 | height: 15px; 572 | background-position: -3139px 0px; } 573 | .iti__flag.iti__md { 574 | height: 10px; 575 | background-position: -3160px 0px; } 576 | .iti__flag.iti__me { 577 | height: 10px; 578 | background-position: -3182px 0px; } 579 | .iti__flag.iti__mf { 580 | height: 14px; 581 | background-position: -3204px 0px; } 582 | .iti__flag.iti__mg { 583 | height: 14px; 584 | background-position: -3226px 0px; } 585 | .iti__flag.iti__mh { 586 | height: 11px; 587 | background-position: -3248px 0px; } 588 | .iti__flag.iti__mk { 589 | height: 10px; 590 | background-position: -3270px 0px; } 591 | .iti__flag.iti__ml { 592 | height: 14px; 593 | background-position: -3292px 0px; } 594 | .iti__flag.iti__mm { 595 | height: 14px; 596 | background-position: -3314px 0px; } 597 | .iti__flag.iti__mn { 598 | height: 10px; 599 | background-position: -3336px 0px; } 600 | .iti__flag.iti__mo { 601 | height: 14px; 602 | background-position: -3358px 0px; } 603 | .iti__flag.iti__mp { 604 | height: 10px; 605 | background-position: -3380px 0px; } 606 | .iti__flag.iti__mq { 607 | height: 14px; 608 | background-position: -3402px 0px; } 609 | .iti__flag.iti__mr { 610 | height: 14px; 611 | background-position: -3424px 0px; } 612 | .iti__flag.iti__ms { 613 | height: 10px; 614 | background-position: -3446px 0px; } 615 | .iti__flag.iti__mt { 616 | height: 14px; 617 | background-position: -3468px 0px; } 618 | .iti__flag.iti__mu { 619 | height: 14px; 620 | background-position: -3490px 0px; } 621 | .iti__flag.iti__mv { 622 | height: 14px; 623 | background-position: -3512px 0px; } 624 | .iti__flag.iti__mw { 625 | height: 14px; 626 | background-position: -3534px 0px; } 627 | .iti__flag.iti__mx { 628 | height: 12px; 629 | background-position: -3556px 0px; } 630 | .iti__flag.iti__my { 631 | height: 10px; 632 | background-position: -3578px 0px; } 633 | .iti__flag.iti__mz { 634 | height: 14px; 635 | background-position: -3600px 0px; } 636 | .iti__flag.iti__na { 637 | height: 14px; 638 | background-position: -3622px 0px; } 639 | .iti__flag.iti__nc { 640 | height: 10px; 641 | background-position: -3644px 0px; } 642 | .iti__flag.iti__ne { 643 | height: 15px; 644 | background-position: -3666px 0px; } 645 | .iti__flag.iti__nf { 646 | height: 10px; 647 | background-position: -3686px 0px; } 648 | .iti__flag.iti__ng { 649 | height: 10px; 650 | background-position: -3708px 0px; } 651 | .iti__flag.iti__ni { 652 | height: 12px; 653 | background-position: -3730px 0px; } 654 | .iti__flag.iti__nl { 655 | height: 14px; 656 | background-position: -3752px 0px; } 657 | .iti__flag.iti__no { 658 | height: 15px; 659 | background-position: -3774px 0px; } 660 | .iti__flag.iti__np { 661 | height: 15px; 662 | background-position: -3796px 0px; } 663 | .iti__flag.iti__nr { 664 | height: 10px; 665 | background-position: -3811px 0px; } 666 | .iti__flag.iti__nu { 667 | height: 10px; 668 | background-position: -3833px 0px; } 669 | .iti__flag.iti__nz { 670 | height: 10px; 671 | background-position: -3855px 0px; } 672 | .iti__flag.iti__om { 673 | height: 10px; 674 | background-position: -3877px 0px; } 675 | .iti__flag.iti__pa { 676 | height: 14px; 677 | background-position: -3899px 0px; } 678 | .iti__flag.iti__pe { 679 | height: 14px; 680 | background-position: -3921px 0px; } 681 | .iti__flag.iti__pf { 682 | height: 14px; 683 | background-position: -3943px 0px; } 684 | .iti__flag.iti__pg { 685 | height: 15px; 686 | background-position: -3965px 0px; } 687 | .iti__flag.iti__ph { 688 | height: 10px; 689 | background-position: -3987px 0px; } 690 | .iti__flag.iti__pk { 691 | height: 14px; 692 | background-position: -4009px 0px; } 693 | .iti__flag.iti__pl { 694 | height: 13px; 695 | background-position: -4031px 0px; } 696 | .iti__flag.iti__pm { 697 | height: 14px; 698 | background-position: -4053px 0px; } 699 | .iti__flag.iti__pn { 700 | height: 10px; 701 | background-position: -4075px 0px; } 702 | .iti__flag.iti__pr { 703 | height: 14px; 704 | background-position: -4097px 0px; } 705 | .iti__flag.iti__ps { 706 | height: 10px; 707 | background-position: -4119px 0px; } 708 | .iti__flag.iti__pt { 709 | height: 14px; 710 | background-position: -4141px 0px; } 711 | .iti__flag.iti__pw { 712 | height: 13px; 713 | background-position: -4163px 0px; } 714 | .iti__flag.iti__py { 715 | height: 11px; 716 | background-position: -4185px 0px; } 717 | .iti__flag.iti__qa { 718 | height: 8px; 719 | background-position: -4207px 0px; } 720 | .iti__flag.iti__re { 721 | height: 14px; 722 | background-position: -4229px 0px; } 723 | .iti__flag.iti__ro { 724 | height: 14px; 725 | background-position: -4251px 0px; } 726 | .iti__flag.iti__rs { 727 | height: 14px; 728 | background-position: -4273px 0px; } 729 | .iti__flag.iti__ru { 730 | height: 14px; 731 | background-position: -4295px 0px; } 732 | .iti__flag.iti__rw { 733 | height: 14px; 734 | background-position: -4317px 0px; } 735 | .iti__flag.iti__sa { 736 | height: 14px; 737 | background-position: -4339px 0px; } 738 | .iti__flag.iti__sb { 739 | height: 10px; 740 | background-position: -4361px 0px; } 741 | .iti__flag.iti__sc { 742 | height: 10px; 743 | background-position: -4383px 0px; } 744 | .iti__flag.iti__sd { 745 | height: 10px; 746 | background-position: -4405px 0px; } 747 | .iti__flag.iti__se { 748 | height: 13px; 749 | background-position: -4427px 0px; } 750 | .iti__flag.iti__sg { 751 | height: 14px; 752 | background-position: -4449px 0px; } 753 | .iti__flag.iti__sh { 754 | height: 10px; 755 | background-position: -4471px 0px; } 756 | .iti__flag.iti__si { 757 | height: 10px; 758 | background-position: -4493px 0px; } 759 | .iti__flag.iti__sj { 760 | height: 15px; 761 | background-position: -4515px 0px; } 762 | .iti__flag.iti__sk { 763 | height: 14px; 764 | background-position: -4537px 0px; } 765 | .iti__flag.iti__sl { 766 | height: 14px; 767 | background-position: -4559px 0px; } 768 | .iti__flag.iti__sm { 769 | height: 15px; 770 | background-position: -4581px 0px; } 771 | .iti__flag.iti__sn { 772 | height: 14px; 773 | background-position: -4603px 0px; } 774 | .iti__flag.iti__so { 775 | height: 14px; 776 | background-position: -4625px 0px; } 777 | .iti__flag.iti__sr { 778 | height: 14px; 779 | background-position: -4647px 0px; } 780 | .iti__flag.iti__ss { 781 | height: 10px; 782 | background-position: -4669px 0px; } 783 | .iti__flag.iti__st { 784 | height: 10px; 785 | background-position: -4691px 0px; } 786 | .iti__flag.iti__sv { 787 | height: 12px; 788 | background-position: -4713px 0px; } 789 | .iti__flag.iti__sx { 790 | height: 14px; 791 | background-position: -4735px 0px; } 792 | .iti__flag.iti__sy { 793 | height: 14px; 794 | background-position: -4757px 0px; } 795 | .iti__flag.iti__sz { 796 | height: 14px; 797 | background-position: -4779px 0px; } 798 | .iti__flag.iti__ta { 799 | height: 10px; 800 | background-position: -4801px 0px; } 801 | .iti__flag.iti__tc { 802 | height: 10px; 803 | background-position: -4823px 0px; } 804 | .iti__flag.iti__td { 805 | height: 14px; 806 | background-position: -4845px 0px; } 807 | .iti__flag.iti__tf { 808 | height: 14px; 809 | background-position: -4867px 0px; } 810 | .iti__flag.iti__tg { 811 | height: 13px; 812 | background-position: -4889px 0px; } 813 | .iti__flag.iti__th { 814 | height: 14px; 815 | background-position: -4911px 0px; } 816 | .iti__flag.iti__tj { 817 | height: 10px; 818 | background-position: -4933px 0px; } 819 | .iti__flag.iti__tk { 820 | height: 10px; 821 | background-position: -4955px 0px; } 822 | .iti__flag.iti__tl { 823 | height: 10px; 824 | background-position: -4977px 0px; } 825 | .iti__flag.iti__tm { 826 | height: 14px; 827 | background-position: -4999px 0px; } 828 | .iti__flag.iti__tn { 829 | height: 14px; 830 | background-position: -5021px 0px; } 831 | .iti__flag.iti__to { 832 | height: 10px; 833 | background-position: -5043px 0px; } 834 | .iti__flag.iti__tr { 835 | height: 14px; 836 | background-position: -5065px 0px; } 837 | .iti__flag.iti__tt { 838 | height: 12px; 839 | background-position: -5087px 0px; } 840 | .iti__flag.iti__tv { 841 | height: 10px; 842 | background-position: -5109px 0px; } 843 | .iti__flag.iti__tw { 844 | height: 14px; 845 | background-position: -5131px 0px; } 846 | .iti__flag.iti__tz { 847 | height: 14px; 848 | background-position: -5153px 0px; } 849 | .iti__flag.iti__ua { 850 | height: 14px; 851 | background-position: -5175px 0px; } 852 | .iti__flag.iti__ug { 853 | height: 14px; 854 | background-position: -5197px 0px; } 855 | .iti__flag.iti__um { 856 | height: 11px; 857 | background-position: -5219px 0px; } 858 | .iti__flag.iti__un { 859 | height: 14px; 860 | background-position: -5241px 0px; } 861 | .iti__flag.iti__us { 862 | height: 11px; 863 | background-position: -5263px 0px; } 864 | .iti__flag.iti__uy { 865 | height: 14px; 866 | background-position: -5285px 0px; } 867 | .iti__flag.iti__uz { 868 | height: 10px; 869 | background-position: -5307px 0px; } 870 | .iti__flag.iti__va { 871 | height: 15px; 872 | background-position: -5329px 0px; } 873 | .iti__flag.iti__vc { 874 | height: 14px; 875 | background-position: -5346px 0px; } 876 | .iti__flag.iti__ve { 877 | height: 14px; 878 | background-position: -5368px 0px; } 879 | .iti__flag.iti__vg { 880 | height: 10px; 881 | background-position: -5390px 0px; } 882 | .iti__flag.iti__vi { 883 | height: 14px; 884 | background-position: -5412px 0px; } 885 | .iti__flag.iti__vn { 886 | height: 14px; 887 | background-position: -5434px 0px; } 888 | .iti__flag.iti__vu { 889 | height: 12px; 890 | background-position: -5456px 0px; } 891 | .iti__flag.iti__wf { 892 | height: 14px; 893 | background-position: -5478px 0px; } 894 | .iti__flag.iti__ws { 895 | height: 10px; 896 | background-position: -5500px 0px; } 897 | .iti__flag.iti__xk { 898 | height: 15px; 899 | background-position: -5522px 0px; } 900 | .iti__flag.iti__ye { 901 | height: 14px; 902 | background-position: -5544px 0px; } 903 | .iti__flag.iti__yt { 904 | height: 14px; 905 | background-position: -5566px 0px; } 906 | .iti__flag.iti__za { 907 | height: 14px; 908 | background-position: -5588px 0px; } 909 | .iti__flag.iti__zm { 910 | height: 14px; 911 | background-position: -5610px 0px; } 912 | .iti__flag.iti__zw { 913 | height: 10px; 914 | background-position: -5632px 0px; } 915 | 916 | .iti__flag { 917 | height: 15px; 918 | box-shadow: 0px 0px 1px 0px #888; 919 | background-image: url("../img/flags.png"); 920 | background-repeat: no-repeat; 921 | background-color: #DBDBDB; 922 | background-position: 20px 0; } 923 | @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { 924 | .iti__flag { 925 | background-image: url("../img/flags@2x.png"); } } 926 | 927 | .iti__flag.iti__np { 928 | background-color: transparent; } 929 | -------------------------------------------------------------------------------- /build/css/intlTelInput.min.css: -------------------------------------------------------------------------------- 1 | .iti{position:relative;display:inline-block}.iti *{box-sizing:border-box;-moz-box-sizing:border-box}.iti__hide{display:none}.iti__v-hide{visibility:hidden}.iti input,.iti input[type=tel],.iti input[type=text]{position:relative;z-index:0;margin-top:0!important;margin-bottom:0!important;padding-right:36px;margin-right:0}.iti__flag-container{position:absolute;top:0;bottom:0;right:0;padding:1px}.iti__selected-flag{z-index:1;position:relative;display:flex;align-items:center;height:100%;padding:0 6px 0 8px}.iti__arrow{margin-left:6px;width:0;height:0;border-left:3px solid transparent;border-right:3px solid transparent;border-top:4px solid #555}.iti__arrow--up{border-top:none;border-bottom:4px solid #555}.iti__country-list{position:absolute;z-index:2;list-style:none;text-align:left;padding:0;margin:0 0 0 -1px;box-shadow:1px 1px 4px rgba(0,0,0,.2);background-color:#fff;border:1px solid #ccc;white-space:nowrap;max-height:200px;overflow-y:scroll;-webkit-overflow-scrolling:touch}.iti__country-list--dropup{bottom:100%;margin-bottom:-1px}@media (max-width:500px){.iti__country-list{white-space:normal}}.iti__flag-box{display:inline-block;width:20px}.iti__divider{padding-bottom:5px;margin-bottom:5px;border-bottom:1px solid #ccc}.iti__country{padding:5px 10px;outline:0}.iti__dial-code{color:#999}.iti__country.iti__highlight{background-color:rgba(0,0,0,.05)}.iti__country-name,.iti__dial-code,.iti__flag-box{vertical-align:middle}.iti__country-name,.iti__flag-box{margin-right:6px}.iti--allow-dropdown input,.iti--allow-dropdown input[type=tel],.iti--allow-dropdown input[type=text],.iti--separate-dial-code input,.iti--separate-dial-code input[type=tel],.iti--separate-dial-code input[type=text]{padding-right:6px;padding-left:52px;margin-left:0}.iti--allow-dropdown .iti__flag-container,.iti--separate-dial-code .iti__flag-container{right:auto;left:0}.iti--allow-dropdown .iti__flag-container:hover{cursor:pointer}.iti--allow-dropdown .iti__flag-container:hover .iti__selected-flag{background-color:rgba(0,0,0,.05)}.iti--allow-dropdown input[disabled]+.iti__flag-container:hover,.iti--allow-dropdown input[readonly]+.iti__flag-container:hover{cursor:default}.iti--allow-dropdown input[disabled]+.iti__flag-container:hover .iti__selected-flag,.iti--allow-dropdown input[readonly]+.iti__flag-container:hover .iti__selected-flag{background-color:transparent}.iti--separate-dial-code .iti__selected-flag{background-color:rgba(0,0,0,.05)}.iti--separate-dial-code .iti__selected-dial-code{margin-left:6px}.iti--container{position:absolute;top:-1000px;left:-1000px;z-index:1060;padding:1px}.iti--container:hover{cursor:pointer}.iti-mobile .iti--container{top:30px;bottom:30px;left:30px;right:30px;position:fixed}.iti-mobile .iti__country-list{max-height:100%;width:100%}.iti-mobile .iti__country{padding:10px 10px;line-height:1.5em}.iti__flag{width:20px}.iti__flag.iti__be{width:18px}.iti__flag.iti__ch{width:15px}.iti__flag.iti__mc{width:19px}.iti__flag.iti__ne{width:18px}.iti__flag.iti__np{width:13px}.iti__flag.iti__va{width:15px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){.iti__flag{background-size:5652px 15px}}.iti__flag.iti__ac{height:10px;background-position:0 0}.iti__flag.iti__ad{height:14px;background-position:-22px 0}.iti__flag.iti__ae{height:10px;background-position:-44px 0}.iti__flag.iti__af{height:14px;background-position:-66px 0}.iti__flag.iti__ag{height:14px;background-position:-88px 0}.iti__flag.iti__ai{height:10px;background-position:-110px 0}.iti__flag.iti__al{height:15px;background-position:-132px 0}.iti__flag.iti__am{height:10px;background-position:-154px 0}.iti__flag.iti__ao{height:14px;background-position:-176px 0}.iti__flag.iti__aq{height:14px;background-position:-198px 0}.iti__flag.iti__ar{height:13px;background-position:-220px 0}.iti__flag.iti__as{height:10px;background-position:-242px 0}.iti__flag.iti__at{height:14px;background-position:-264px 0}.iti__flag.iti__au{height:10px;background-position:-286px 0}.iti__flag.iti__aw{height:14px;background-position:-308px 0}.iti__flag.iti__ax{height:13px;background-position:-330px 0}.iti__flag.iti__az{height:10px;background-position:-352px 0}.iti__flag.iti__ba{height:10px;background-position:-374px 0}.iti__flag.iti__bb{height:14px;background-position:-396px 0}.iti__flag.iti__bd{height:12px;background-position:-418px 0}.iti__flag.iti__be{height:15px;background-position:-440px 0}.iti__flag.iti__bf{height:14px;background-position:-460px 0}.iti__flag.iti__bg{height:12px;background-position:-482px 0}.iti__flag.iti__bh{height:12px;background-position:-504px 0}.iti__flag.iti__bi{height:12px;background-position:-526px 0}.iti__flag.iti__bj{height:14px;background-position:-548px 0}.iti__flag.iti__bl{height:14px;background-position:-570px 0}.iti__flag.iti__bm{height:10px;background-position:-592px 0}.iti__flag.iti__bn{height:10px;background-position:-614px 0}.iti__flag.iti__bo{height:14px;background-position:-636px 0}.iti__flag.iti__bq{height:14px;background-position:-658px 0}.iti__flag.iti__br{height:14px;background-position:-680px 0}.iti__flag.iti__bs{height:10px;background-position:-702px 0}.iti__flag.iti__bt{height:14px;background-position:-724px 0}.iti__flag.iti__bv{height:15px;background-position:-746px 0}.iti__flag.iti__bw{height:14px;background-position:-768px 0}.iti__flag.iti__by{height:10px;background-position:-790px 0}.iti__flag.iti__bz{height:14px;background-position:-812px 0}.iti__flag.iti__ca{height:10px;background-position:-834px 0}.iti__flag.iti__cc{height:10px;background-position:-856px 0}.iti__flag.iti__cd{height:15px;background-position:-878px 0}.iti__flag.iti__cf{height:14px;background-position:-900px 0}.iti__flag.iti__cg{height:14px;background-position:-922px 0}.iti__flag.iti__ch{height:15px;background-position:-944px 0}.iti__flag.iti__ci{height:14px;background-position:-961px 0}.iti__flag.iti__ck{height:10px;background-position:-983px 0}.iti__flag.iti__cl{height:14px;background-position:-1005px 0}.iti__flag.iti__cm{height:14px;background-position:-1027px 0}.iti__flag.iti__cn{height:14px;background-position:-1049px 0}.iti__flag.iti__co{height:14px;background-position:-1071px 0}.iti__flag.iti__cp{height:14px;background-position:-1093px 0}.iti__flag.iti__cr{height:12px;background-position:-1115px 0}.iti__flag.iti__cu{height:10px;background-position:-1137px 0}.iti__flag.iti__cv{height:12px;background-position:-1159px 0}.iti__flag.iti__cw{height:14px;background-position:-1181px 0}.iti__flag.iti__cx{height:10px;background-position:-1203px 0}.iti__flag.iti__cy{height:14px;background-position:-1225px 0}.iti__flag.iti__cz{height:14px;background-position:-1247px 0}.iti__flag.iti__de{height:12px;background-position:-1269px 0}.iti__flag.iti__dg{height:10px;background-position:-1291px 0}.iti__flag.iti__dj{height:14px;background-position:-1313px 0}.iti__flag.iti__dk{height:15px;background-position:-1335px 0}.iti__flag.iti__dm{height:10px;background-position:-1357px 0}.iti__flag.iti__do{height:14px;background-position:-1379px 0}.iti__flag.iti__dz{height:14px;background-position:-1401px 0}.iti__flag.iti__ea{height:14px;background-position:-1423px 0}.iti__flag.iti__ec{height:14px;background-position:-1445px 0}.iti__flag.iti__ee{height:13px;background-position:-1467px 0}.iti__flag.iti__eg{height:14px;background-position:-1489px 0}.iti__flag.iti__eh{height:10px;background-position:-1511px 0}.iti__flag.iti__er{height:10px;background-position:-1533px 0}.iti__flag.iti__es{height:14px;background-position:-1555px 0}.iti__flag.iti__et{height:10px;background-position:-1577px 0}.iti__flag.iti__eu{height:14px;background-position:-1599px 0}.iti__flag.iti__fi{height:12px;background-position:-1621px 0}.iti__flag.iti__fj{height:10px;background-position:-1643px 0}.iti__flag.iti__fk{height:10px;background-position:-1665px 0}.iti__flag.iti__fm{height:11px;background-position:-1687px 0}.iti__flag.iti__fo{height:15px;background-position:-1709px 0}.iti__flag.iti__fr{height:14px;background-position:-1731px 0}.iti__flag.iti__ga{height:15px;background-position:-1753px 0}.iti__flag.iti__gb{height:10px;background-position:-1775px 0}.iti__flag.iti__gd{height:12px;background-position:-1797px 0}.iti__flag.iti__ge{height:14px;background-position:-1819px 0}.iti__flag.iti__gf{height:14px;background-position:-1841px 0}.iti__flag.iti__gg{height:14px;background-position:-1863px 0}.iti__flag.iti__gh{height:14px;background-position:-1885px 0}.iti__flag.iti__gi{height:10px;background-position:-1907px 0}.iti__flag.iti__gl{height:14px;background-position:-1929px 0}.iti__flag.iti__gm{height:14px;background-position:-1951px 0}.iti__flag.iti__gn{height:14px;background-position:-1973px 0}.iti__flag.iti__gp{height:14px;background-position:-1995px 0}.iti__flag.iti__gq{height:14px;background-position:-2017px 0}.iti__flag.iti__gr{height:14px;background-position:-2039px 0}.iti__flag.iti__gs{height:10px;background-position:-2061px 0}.iti__flag.iti__gt{height:13px;background-position:-2083px 0}.iti__flag.iti__gu{height:11px;background-position:-2105px 0}.iti__flag.iti__gw{height:10px;background-position:-2127px 0}.iti__flag.iti__gy{height:12px;background-position:-2149px 0}.iti__flag.iti__hk{height:14px;background-position:-2171px 0}.iti__flag.iti__hm{height:10px;background-position:-2193px 0}.iti__flag.iti__hn{height:10px;background-position:-2215px 0}.iti__flag.iti__hr{height:10px;background-position:-2237px 0}.iti__flag.iti__ht{height:12px;background-position:-2259px 0}.iti__flag.iti__hu{height:10px;background-position:-2281px 0}.iti__flag.iti__ic{height:14px;background-position:-2303px 0}.iti__flag.iti__id{height:14px;background-position:-2325px 0}.iti__flag.iti__ie{height:10px;background-position:-2347px 0}.iti__flag.iti__il{height:15px;background-position:-2369px 0}.iti__flag.iti__im{height:10px;background-position:-2391px 0}.iti__flag.iti__in{height:14px;background-position:-2413px 0}.iti__flag.iti__io{height:10px;background-position:-2435px 0}.iti__flag.iti__iq{height:14px;background-position:-2457px 0}.iti__flag.iti__ir{height:12px;background-position:-2479px 0}.iti__flag.iti__is{height:15px;background-position:-2501px 0}.iti__flag.iti__it{height:14px;background-position:-2523px 0}.iti__flag.iti__je{height:12px;background-position:-2545px 0}.iti__flag.iti__jm{height:10px;background-position:-2567px 0}.iti__flag.iti__jo{height:10px;background-position:-2589px 0}.iti__flag.iti__jp{height:14px;background-position:-2611px 0}.iti__flag.iti__ke{height:14px;background-position:-2633px 0}.iti__flag.iti__kg{height:12px;background-position:-2655px 0}.iti__flag.iti__kh{height:13px;background-position:-2677px 0}.iti__flag.iti__ki{height:10px;background-position:-2699px 0}.iti__flag.iti__km{height:12px;background-position:-2721px 0}.iti__flag.iti__kn{height:14px;background-position:-2743px 0}.iti__flag.iti__kp{height:10px;background-position:-2765px 0}.iti__flag.iti__kr{height:14px;background-position:-2787px 0}.iti__flag.iti__kw{height:10px;background-position:-2809px 0}.iti__flag.iti__ky{height:10px;background-position:-2831px 0}.iti__flag.iti__kz{height:10px;background-position:-2853px 0}.iti__flag.iti__la{height:14px;background-position:-2875px 0}.iti__flag.iti__lb{height:14px;background-position:-2897px 0}.iti__flag.iti__lc{height:10px;background-position:-2919px 0}.iti__flag.iti__li{height:12px;background-position:-2941px 0}.iti__flag.iti__lk{height:10px;background-position:-2963px 0}.iti__flag.iti__lr{height:11px;background-position:-2985px 0}.iti__flag.iti__ls{height:14px;background-position:-3007px 0}.iti__flag.iti__lt{height:12px;background-position:-3029px 0}.iti__flag.iti__lu{height:12px;background-position:-3051px 0}.iti__flag.iti__lv{height:10px;background-position:-3073px 0}.iti__flag.iti__ly{height:10px;background-position:-3095px 0}.iti__flag.iti__ma{height:14px;background-position:-3117px 0}.iti__flag.iti__mc{height:15px;background-position:-3139px 0}.iti__flag.iti__md{height:10px;background-position:-3160px 0}.iti__flag.iti__me{height:10px;background-position:-3182px 0}.iti__flag.iti__mf{height:14px;background-position:-3204px 0}.iti__flag.iti__mg{height:14px;background-position:-3226px 0}.iti__flag.iti__mh{height:11px;background-position:-3248px 0}.iti__flag.iti__mk{height:10px;background-position:-3270px 0}.iti__flag.iti__ml{height:14px;background-position:-3292px 0}.iti__flag.iti__mm{height:14px;background-position:-3314px 0}.iti__flag.iti__mn{height:10px;background-position:-3336px 0}.iti__flag.iti__mo{height:14px;background-position:-3358px 0}.iti__flag.iti__mp{height:10px;background-position:-3380px 0}.iti__flag.iti__mq{height:14px;background-position:-3402px 0}.iti__flag.iti__mr{height:14px;background-position:-3424px 0}.iti__flag.iti__ms{height:10px;background-position:-3446px 0}.iti__flag.iti__mt{height:14px;background-position:-3468px 0}.iti__flag.iti__mu{height:14px;background-position:-3490px 0}.iti__flag.iti__mv{height:14px;background-position:-3512px 0}.iti__flag.iti__mw{height:14px;background-position:-3534px 0}.iti__flag.iti__mx{height:12px;background-position:-3556px 0}.iti__flag.iti__my{height:10px;background-position:-3578px 0}.iti__flag.iti__mz{height:14px;background-position:-3600px 0}.iti__flag.iti__na{height:14px;background-position:-3622px 0}.iti__flag.iti__nc{height:10px;background-position:-3644px 0}.iti__flag.iti__ne{height:15px;background-position:-3666px 0}.iti__flag.iti__nf{height:10px;background-position:-3686px 0}.iti__flag.iti__ng{height:10px;background-position:-3708px 0}.iti__flag.iti__ni{height:12px;background-position:-3730px 0}.iti__flag.iti__nl{height:14px;background-position:-3752px 0}.iti__flag.iti__no{height:15px;background-position:-3774px 0}.iti__flag.iti__np{height:15px;background-position:-3796px 0}.iti__flag.iti__nr{height:10px;background-position:-3811px 0}.iti__flag.iti__nu{height:10px;background-position:-3833px 0}.iti__flag.iti__nz{height:10px;background-position:-3855px 0}.iti__flag.iti__om{height:10px;background-position:-3877px 0}.iti__flag.iti__pa{height:14px;background-position:-3899px 0}.iti__flag.iti__pe{height:14px;background-position:-3921px 0}.iti__flag.iti__pf{height:14px;background-position:-3943px 0}.iti__flag.iti__pg{height:15px;background-position:-3965px 0}.iti__flag.iti__ph{height:10px;background-position:-3987px 0}.iti__flag.iti__pk{height:14px;background-position:-4009px 0}.iti__flag.iti__pl{height:13px;background-position:-4031px 0}.iti__flag.iti__pm{height:14px;background-position:-4053px 0}.iti__flag.iti__pn{height:10px;background-position:-4075px 0}.iti__flag.iti__pr{height:14px;background-position:-4097px 0}.iti__flag.iti__ps{height:10px;background-position:-4119px 0}.iti__flag.iti__pt{height:14px;background-position:-4141px 0}.iti__flag.iti__pw{height:13px;background-position:-4163px 0}.iti__flag.iti__py{height:11px;background-position:-4185px 0}.iti__flag.iti__qa{height:8px;background-position:-4207px 0}.iti__flag.iti__re{height:14px;background-position:-4229px 0}.iti__flag.iti__ro{height:14px;background-position:-4251px 0}.iti__flag.iti__rs{height:14px;background-position:-4273px 0}.iti__flag.iti__ru{height:14px;background-position:-4295px 0}.iti__flag.iti__rw{height:14px;background-position:-4317px 0}.iti__flag.iti__sa{height:14px;background-position:-4339px 0}.iti__flag.iti__sb{height:10px;background-position:-4361px 0}.iti__flag.iti__sc{height:10px;background-position:-4383px 0}.iti__flag.iti__sd{height:10px;background-position:-4405px 0}.iti__flag.iti__se{height:13px;background-position:-4427px 0}.iti__flag.iti__sg{height:14px;background-position:-4449px 0}.iti__flag.iti__sh{height:10px;background-position:-4471px 0}.iti__flag.iti__si{height:10px;background-position:-4493px 0}.iti__flag.iti__sj{height:15px;background-position:-4515px 0}.iti__flag.iti__sk{height:14px;background-position:-4537px 0}.iti__flag.iti__sl{height:14px;background-position:-4559px 0}.iti__flag.iti__sm{height:15px;background-position:-4581px 0}.iti__flag.iti__sn{height:14px;background-position:-4603px 0}.iti__flag.iti__so{height:14px;background-position:-4625px 0}.iti__flag.iti__sr{height:14px;background-position:-4647px 0}.iti__flag.iti__ss{height:10px;background-position:-4669px 0}.iti__flag.iti__st{height:10px;background-position:-4691px 0}.iti__flag.iti__sv{height:12px;background-position:-4713px 0}.iti__flag.iti__sx{height:14px;background-position:-4735px 0}.iti__flag.iti__sy{height:14px;background-position:-4757px 0}.iti__flag.iti__sz{height:14px;background-position:-4779px 0}.iti__flag.iti__ta{height:10px;background-position:-4801px 0}.iti__flag.iti__tc{height:10px;background-position:-4823px 0}.iti__flag.iti__td{height:14px;background-position:-4845px 0}.iti__flag.iti__tf{height:14px;background-position:-4867px 0}.iti__flag.iti__tg{height:13px;background-position:-4889px 0}.iti__flag.iti__th{height:14px;background-position:-4911px 0}.iti__flag.iti__tj{height:10px;background-position:-4933px 0}.iti__flag.iti__tk{height:10px;background-position:-4955px 0}.iti__flag.iti__tl{height:10px;background-position:-4977px 0}.iti__flag.iti__tm{height:14px;background-position:-4999px 0}.iti__flag.iti__tn{height:14px;background-position:-5021px 0}.iti__flag.iti__to{height:10px;background-position:-5043px 0}.iti__flag.iti__tr{height:14px;background-position:-5065px 0}.iti__flag.iti__tt{height:12px;background-position:-5087px 0}.iti__flag.iti__tv{height:10px;background-position:-5109px 0}.iti__flag.iti__tw{height:14px;background-position:-5131px 0}.iti__flag.iti__tz{height:14px;background-position:-5153px 0}.iti__flag.iti__ua{height:14px;background-position:-5175px 0}.iti__flag.iti__ug{height:14px;background-position:-5197px 0}.iti__flag.iti__um{height:11px;background-position:-5219px 0}.iti__flag.iti__un{height:14px;background-position:-5241px 0}.iti__flag.iti__us{height:11px;background-position:-5263px 0}.iti__flag.iti__uy{height:14px;background-position:-5285px 0}.iti__flag.iti__uz{height:10px;background-position:-5307px 0}.iti__flag.iti__va{height:15px;background-position:-5329px 0}.iti__flag.iti__vc{height:14px;background-position:-5346px 0}.iti__flag.iti__ve{height:14px;background-position:-5368px 0}.iti__flag.iti__vg{height:10px;background-position:-5390px 0}.iti__flag.iti__vi{height:14px;background-position:-5412px 0}.iti__flag.iti__vn{height:14px;background-position:-5434px 0}.iti__flag.iti__vu{height:12px;background-position:-5456px 0}.iti__flag.iti__wf{height:14px;background-position:-5478px 0}.iti__flag.iti__ws{height:10px;background-position:-5500px 0}.iti__flag.iti__xk{height:15px;background-position:-5522px 0}.iti__flag.iti__ye{height:14px;background-position:-5544px 0}.iti__flag.iti__yt{height:14px;background-position:-5566px 0}.iti__flag.iti__za{height:14px;background-position:-5588px 0}.iti__flag.iti__zm{height:14px;background-position:-5610px 0}.iti__flag.iti__zw{height:10px;background-position:-5632px 0}.iti__flag{height:15px;box-shadow:0 0 1px 0 #888;background-image:url(../img/flags.png);background-repeat:no-repeat;background-color:#dbdbdb;background-position:20px 0}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){.iti__flag{background-image:url(../img/flags@2x.png)}}.iti__flag.iti__np{background-color:transparent} -------------------------------------------------------------------------------- /build/img/flags.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kenkarate/phone-number-validation/e6b7b051e86bbf771b918ab2a60d7f06052ee3ac/build/img/flags.png -------------------------------------------------------------------------------- /build/img/flags@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kenkarate/phone-number-validation/e6b7b051e86bbf771b918ab2a60d7f06052ee3ac/build/img/flags@2x.png -------------------------------------------------------------------------------- /build/js/data.js: -------------------------------------------------------------------------------- 1 | /* 2 | * International Telephone Input v17.0.18 3 | * https://github.com/jackocnr/intl-tel-input.git 4 | * Licensed under the MIT license 5 | */ 6 | 7 | // wrap in UMD 8 | (function() { 9 | // Array of country objects for the flag dropdown. 10 | // Here is the criteria for the plugin to support a given country/territory 11 | // - It has an iso2 code: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 12 | // - It has it's own country calling code (it is not a sub-region of another country): https://en.wikipedia.org/wiki/List_of_country_calling_codes 13 | // - It has a flag in the region-flags project: https://github.com/behdad/region-flags/tree/gh-pages/png 14 | // - It is supported by libphonenumber (it must be listed on this page): https://github.com/googlei18n/libphonenumber/blob/master/resources/ShortNumberMetadata.xml 15 | // Each country array has the following information: 16 | // [ 17 | // Country name, 18 | // iso2 code, 19 | // International dial code, 20 | // Order (if >1 country with same dial code), 21 | // Area codes 22 | // ] 23 | var allCountries = [ [ "Afghanistan (‫افغانستان‬‎)", "af", "93" ], [ "Albania (Shqipëri)", "al", "355" ], [ "Algeria (‫الجزائر‬‎)", "dz", "213" ], [ "American Samoa", "as", "1", 5, [ "684" ] ], [ "Andorra", "ad", "376" ], [ "Angola", "ao", "244" ], [ "Anguilla", "ai", "1", 6, [ "264" ] ], [ "Antigua and Barbuda", "ag", "1", 7, [ "268" ] ], [ "Argentina", "ar", "54" ], [ "Armenia (Հայաստան)", "am", "374" ], [ "Aruba", "aw", "297" ], [ "Ascension Island", "ac", "247" ], [ "Australia", "au", "61", 0 ], [ "Austria (Österreich)", "at", "43" ], [ "Azerbaijan (Azərbaycan)", "az", "994" ], [ "Bahamas", "bs", "1", 8, [ "242" ] ], [ "Bahrain (‫البحرين‬‎)", "bh", "973" ], [ "Bangladesh (বাংলাদেশ)", "bd", "880" ], [ "Barbados", "bb", "1", 9, [ "246" ] ], [ "Belarus (Беларусь)", "by", "375" ], [ "Belgium (België)", "be", "32" ], [ "Belize", "bz", "501" ], [ "Benin (Bénin)", "bj", "229" ], [ "Bermuda", "bm", "1", 10, [ "441" ] ], [ "Bhutan (འབྲུག)", "bt", "975" ], [ "Bolivia", "bo", "591" ], [ "Bosnia and Herzegovina (Босна и Херцеговина)", "ba", "387" ], [ "Botswana", "bw", "267" ], [ "Brazil (Brasil)", "br", "55" ], [ "British Indian Ocean Territory", "io", "246" ], [ "British Virgin Islands", "vg", "1", 11, [ "284" ] ], [ "Brunei", "bn", "673" ], [ "Bulgaria (България)", "bg", "359" ], [ "Burkina Faso", "bf", "226" ], [ "Burundi (Uburundi)", "bi", "257" ], [ "Cambodia (កម្ពុជា)", "kh", "855" ], [ "Cameroon (Cameroun)", "cm", "237" ], [ "Canada", "ca", "1", 1, [ "204", "226", "236", "249", "250", "289", "306", "343", "365", "387", "403", "416", "418", "431", "437", "438", "450", "506", "514", "519", "548", "579", "581", "587", "604", "613", "639", "647", "672", "705", "709", "742", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905" ] ], [ "Cape Verde (Kabu Verdi)", "cv", "238" ], [ "Caribbean Netherlands", "bq", "599", 1, [ "3", "4", "7" ] ], [ "Cayman Islands", "ky", "1", 12, [ "345" ] ], [ "Central African Republic (République centrafricaine)", "cf", "236" ], [ "Chad (Tchad)", "td", "235" ], [ "Chile", "cl", "56" ], [ "China (中国)", "cn", "86" ], [ "Christmas Island", "cx", "61", 2, [ "89164" ] ], [ "Cocos (Keeling) Islands", "cc", "61", 1, [ "89162" ] ], [ "Colombia", "co", "57" ], [ "Comoros (‫جزر القمر‬‎)", "km", "269" ], [ "Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)", "cd", "243" ], [ "Congo (Republic) (Congo-Brazzaville)", "cg", "242" ], [ "Cook Islands", "ck", "682" ], [ "Costa Rica", "cr", "506" ], [ "Côte d’Ivoire", "ci", "225" ], [ "Croatia (Hrvatska)", "hr", "385" ], [ "Cuba", "cu", "53" ], [ "Curaçao", "cw", "599", 0 ], [ "Cyprus (Κύπρος)", "cy", "357" ], [ "Czech Republic (Česká republika)", "cz", "420" ], [ "Denmark (Danmark)", "dk", "45" ], [ "Djibouti", "dj", "253" ], [ "Dominica", "dm", "1", 13, [ "767" ] ], [ "Dominican Republic (República Dominicana)", "do", "1", 2, [ "809", "829", "849" ] ], [ "Ecuador", "ec", "593" ], [ "Egypt (‫مصر‬‎)", "eg", "20" ], [ "El Salvador", "sv", "503" ], [ "Equatorial Guinea (Guinea Ecuatorial)", "gq", "240" ], [ "Eritrea", "er", "291" ], [ "Estonia (Eesti)", "ee", "372" ], [ "Eswatini", "sz", "268" ], [ "Ethiopia", "et", "251" ], [ "Falkland Islands (Islas Malvinas)", "fk", "500" ], [ "Faroe Islands (Føroyar)", "fo", "298" ], [ "Fiji", "fj", "679" ], [ "Finland (Suomi)", "fi", "358", 0 ], [ "France", "fr", "33" ], [ "French Guiana (Guyane française)", "gf", "594" ], [ "French Polynesia (Polynésie française)", "pf", "689" ], [ "Gabon", "ga", "241" ], [ "Gambia", "gm", "220" ], [ "Georgia (საქართველო)", "ge", "995" ], [ "Germany (Deutschland)", "de", "49" ], [ "Ghana (Gaana)", "gh", "233" ], [ "Gibraltar", "gi", "350" ], [ "Greece (Ελλάδα)", "gr", "30" ], [ "Greenland (Kalaallit Nunaat)", "gl", "299" ], [ "Grenada", "gd", "1", 14, [ "473" ] ], [ "Guadeloupe", "gp", "590", 0 ], [ "Guam", "gu", "1", 15, [ "671" ] ], [ "Guatemala", "gt", "502" ], [ "Guernsey", "gg", "44", 1, [ "1481", "7781", "7839", "7911" ] ], [ "Guinea (Guinée)", "gn", "224" ], [ "Guinea-Bissau (Guiné Bissau)", "gw", "245" ], [ "Guyana", "gy", "592" ], [ "Haiti", "ht", "509" ], [ "Honduras", "hn", "504" ], [ "Hong Kong (香港)", "hk", "852" ], [ "Hungary (Magyarország)", "hu", "36" ], [ "Iceland (Ísland)", "is", "354" ], [ "India (भारत)", "in", "91" ], [ "Indonesia", "id", "62" ], [ "Iran (‫ایران‬‎)", "ir", "98" ], [ "Iraq (‫العراق‬‎)", "iq", "964" ], [ "Ireland", "ie", "353" ], [ "Isle of Man", "im", "44", 2, [ "1624", "74576", "7524", "7924", "7624" ] ], [ "Israel (‫ישראל‬‎)", "il", "972" ], [ "Italy (Italia)", "it", "39", 0 ], [ "Jamaica", "jm", "1", 4, [ "876", "658" ] ], [ "Japan (日本)", "jp", "81" ], [ "Jersey", "je", "44", 3, [ "1534", "7509", "7700", "7797", "7829", "7937" ] ], [ "Jordan (‫الأردن‬‎)", "jo", "962" ], [ "Kazakhstan (Казахстан)", "kz", "7", 1, [ "33", "7" ] ], [ "Kenya", "ke", "254" ], [ "Kiribati", "ki", "686" ], [ "Kosovo", "xk", "383" ], [ "Kuwait (‫الكويت‬‎)", "kw", "965" ], [ "Kyrgyzstan (Кыргызстан)", "kg", "996" ], [ "Laos (ລາວ)", "la", "856" ], [ "Latvia (Latvija)", "lv", "371" ], [ "Lebanon (‫لبنان‬‎)", "lb", "961" ], [ "Lesotho", "ls", "266" ], [ "Liberia", "lr", "231" ], [ "Libya (‫ليبيا‬‎)", "ly", "218" ], [ "Liechtenstein", "li", "423" ], [ "Lithuania (Lietuva)", "lt", "370" ], [ "Luxembourg", "lu", "352" ], [ "Macau (澳門)", "mo", "853" ], [ "North Macedonia (Македонија)", "mk", "389" ], [ "Madagascar (Madagasikara)", "mg", "261" ], [ "Malawi", "mw", "265" ], [ "Malaysia", "my", "60" ], [ "Maldives", "mv", "960" ], [ "Mali", "ml", "223" ], [ "Malta", "mt", "356" ], [ "Marshall Islands", "mh", "692" ], [ "Martinique", "mq", "596" ], [ "Mauritania (‫موريتانيا‬‎)", "mr", "222" ], [ "Mauritius (Moris)", "mu", "230" ], [ "Mayotte", "yt", "262", 1, [ "269", "639" ] ], [ "Mexico (México)", "mx", "52" ], [ "Micronesia", "fm", "691" ], [ "Moldova (Republica Moldova)", "md", "373" ], [ "Monaco", "mc", "377" ], [ "Mongolia (Монгол)", "mn", "976" ], [ "Montenegro (Crna Gora)", "me", "382" ], [ "Montserrat", "ms", "1", 16, [ "664" ] ], [ "Morocco (‫المغرب‬‎)", "ma", "212", 0 ], [ "Mozambique (Moçambique)", "mz", "258" ], [ "Myanmar (Burma) (မြန်မာ)", "mm", "95" ], [ "Namibia (Namibië)", "na", "264" ], [ "Nauru", "nr", "674" ], [ "Nepal (नेपाल)", "np", "977" ], [ "Netherlands (Nederland)", "nl", "31" ], [ "New Caledonia (Nouvelle-Calédonie)", "nc", "687" ], [ "New Zealand", "nz", "64" ], [ "Nicaragua", "ni", "505" ], [ "Niger (Nijar)", "ne", "227" ], [ "Nigeria", "ng", "234" ], [ "Niue", "nu", "683" ], [ "Norfolk Island", "nf", "672" ], [ "North Korea (조선 민주주의 인민 공화국)", "kp", "850" ], [ "Northern Mariana Islands", "mp", "1", 17, [ "670" ] ], [ "Norway (Norge)", "no", "47", 0 ], [ "Oman (‫عُمان‬‎)", "om", "968" ], [ "Pakistan (‫پاکستان‬‎)", "pk", "92" ], [ "Palau", "pw", "680" ], [ "Palestine (‫فلسطين‬‎)", "ps", "970" ], [ "Panama (Panamá)", "pa", "507" ], [ "Papua New Guinea", "pg", "675" ], [ "Paraguay", "py", "595" ], [ "Peru (Perú)", "pe", "51" ], [ "Philippines", "ph", "63" ], [ "Poland (Polska)", "pl", "48" ], [ "Portugal", "pt", "351" ], [ "Puerto Rico", "pr", "1", 3, [ "787", "939" ] ], [ "Qatar (‫قطر‬‎)", "qa", "974" ], [ "Réunion (La Réunion)", "re", "262", 0 ], [ "Romania (România)", "ro", "40" ], [ "Russia (Россия)", "ru", "7", 0 ], [ "Rwanda", "rw", "250" ], [ "Saint Barthélemy", "bl", "590", 1 ], [ "Saint Helena", "sh", "290" ], [ "Saint Kitts and Nevis", "kn", "1", 18, [ "869" ] ], [ "Saint Lucia", "lc", "1", 19, [ "758" ] ], [ "Saint Martin (Saint-Martin (partie française))", "mf", "590", 2 ], [ "Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)", "pm", "508" ], [ "Saint Vincent and the Grenadines", "vc", "1", 20, [ "784" ] ], [ "Samoa", "ws", "685" ], [ "San Marino", "sm", "378" ], [ "São Tomé and Príncipe (São Tomé e Príncipe)", "st", "239" ], [ "Saudi Arabia (‫المملكة العربية السعودية‬‎)", "sa", "966" ], [ "Senegal (Sénégal)", "sn", "221" ], [ "Serbia (Србија)", "rs", "381" ], [ "Seychelles", "sc", "248" ], [ "Sierra Leone", "sl", "232" ], [ "Singapore", "sg", "65" ], [ "Sint Maarten", "sx", "1", 21, [ "721" ] ], [ "Slovakia (Slovensko)", "sk", "421" ], [ "Slovenia (Slovenija)", "si", "386" ], [ "Solomon Islands", "sb", "677" ], [ "Somalia (Soomaaliya)", "so", "252" ], [ "South Africa", "za", "27" ], [ "South Korea (대한민국)", "kr", "82" ], [ "South Sudan (‫جنوب السودان‬‎)", "ss", "211" ], [ "Spain (España)", "es", "34" ], [ "Sri Lanka (ශ්‍රී ලංකාව)", "lk", "94" ], [ "Sudan (‫السودان‬‎)", "sd", "249" ], [ "Suriname", "sr", "597" ], [ "Svalbard and Jan Mayen", "sj", "47", 1, [ "79" ] ], [ "Sweden (Sverige)", "se", "46" ], [ "Switzerland (Schweiz)", "ch", "41" ], [ "Syria (‫سوريا‬‎)", "sy", "963" ], [ "Taiwan (台灣)", "tw", "886" ], [ "Tajikistan", "tj", "992" ], [ "Tanzania", "tz", "255" ], [ "Thailand (ไทย)", "th", "66" ], [ "Timor-Leste", "tl", "670" ], [ "Togo", "tg", "228" ], [ "Tokelau", "tk", "690" ], [ "Tonga", "to", "676" ], [ "Trinidad and Tobago", "tt", "1", 22, [ "868" ] ], [ "Tunisia (‫تونس‬‎)", "tn", "216" ], [ "Turkey (Türkiye)", "tr", "90" ], [ "Turkmenistan", "tm", "993" ], [ "Turks and Caicos Islands", "tc", "1", 23, [ "649" ] ], [ "Tuvalu", "tv", "688" ], [ "U.S. Virgin Islands", "vi", "1", 24, [ "340" ] ], [ "Uganda", "ug", "256" ], [ "Ukraine (Україна)", "ua", "380" ], [ "United Arab Emirates (‫الإمارات العربية المتحدة‬‎)", "ae", "971" ], [ "United Kingdom", "gb", "44", 0 ], [ "United States", "us", "1", 0 ], [ "Uruguay", "uy", "598" ], [ "Uzbekistan (Oʻzbekiston)", "uz", "998" ], [ "Vanuatu", "vu", "678" ], [ "Vatican City (Città del Vaticano)", "va", "39", 1, [ "06698" ] ], [ "Venezuela", "ve", "58" ], [ "Vietnam (Việt Nam)", "vn", "84" ], [ "Wallis and Futuna (Wallis-et-Futuna)", "wf", "681" ], [ "Western Sahara (‫الصحراء الغربية‬‎)", "eh", "212", 1, [ "5288", "5289" ] ], [ "Yemen (‫اليمن‬‎)", "ye", "967" ], [ "Zambia", "zm", "260" ], [ "Zimbabwe", "zw", "263" ], [ "Åland Islands", "ax", "358", 1, [ "18" ] ] ]; 24 | // loop over all of the countries above, restructuring the data to be objects with named keys 25 | for (var i = 0; i < allCountries.length; i++) { 26 | var c = allCountries[i]; 27 | allCountries[i] = { 28 | name: c[0], 29 | iso2: c[1], 30 | dialCode: c[2], 31 | priority: c[3] || 0, 32 | areaCodes: c[4] || null 33 | }; 34 | } 35 | if (typeof module === "object" && module.exports) module.exports = allCountries; else window.allCountries = allCountries; 36 | })(); -------------------------------------------------------------------------------- /build/js/data.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * International Telephone Input v17.0.18 3 | * https://github.com/jackocnr/intl-tel-input.git 4 | * Licensed under the MIT license 5 | */ 6 | 7 | !function(){for(var a=[["Afghanistan (‫افغانستان‬‎)","af","93"],["Albania (Shqipëri)","al","355"],["Algeria (‫الجزائر‬‎)","dz","213"],["American Samoa","as","1",5,["684"]],["Andorra","ad","376"],["Angola","ao","244"],["Anguilla","ai","1",6,["264"]],["Antigua and Barbuda","ag","1",7,["268"]],["Argentina","ar","54"],["Armenia (Հայաստան)","am","374"],["Aruba","aw","297"],["Ascension Island","ac","247"],["Australia","au","61",0],["Austria (Österreich)","at","43"],["Azerbaijan (Azərbaycan)","az","994"],["Bahamas","bs","1",8,["242"]],["Bahrain (‫البحرين‬‎)","bh","973"],["Bangladesh (বাংলাদেশ)","bd","880"],["Barbados","bb","1",9,["246"]],["Belarus (Беларусь)","by","375"],["Belgium (België)","be","32"],["Belize","bz","501"],["Benin (Bénin)","bj","229"],["Bermuda","bm","1",10,["441"]],["Bhutan (འབྲུག)","bt","975"],["Bolivia","bo","591"],["Bosnia and Herzegovina (Босна и Херцеговина)","ba","387"],["Botswana","bw","267"],["Brazil (Brasil)","br","55"],["British Indian Ocean Territory","io","246"],["British Virgin Islands","vg","1",11,["284"]],["Brunei","bn","673"],["Bulgaria (България)","bg","359"],["Burkina Faso","bf","226"],["Burundi (Uburundi)","bi","257"],["Cambodia (កម្ពុជា)","kh","855"],["Cameroon (Cameroun)","cm","237"],["Canada","ca","1",1,["204","226","236","249","250","289","306","343","365","387","403","416","418","431","437","438","450","506","514","519","548","579","581","587","604","613","639","647","672","705","709","742","778","780","782","807","819","825","867","873","902","905"]],["Cape Verde (Kabu Verdi)","cv","238"],["Caribbean Netherlands","bq","599",1,["3","4","7"]],["Cayman Islands","ky","1",12,["345"]],["Central African Republic (République centrafricaine)","cf","236"],["Chad (Tchad)","td","235"],["Chile","cl","56"],["China (中国)","cn","86"],["Christmas Island","cx","61",2,["89164"]],["Cocos (Keeling) Islands","cc","61",1,["89162"]],["Colombia","co","57"],["Comoros (‫جزر القمر‬‎)","km","269"],["Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)","cd","243"],["Congo (Republic) (Congo-Brazzaville)","cg","242"],["Cook Islands","ck","682"],["Costa Rica","cr","506"],["Côte d’Ivoire","ci","225"],["Croatia (Hrvatska)","hr","385"],["Cuba","cu","53"],["Curaçao","cw","599",0],["Cyprus (Κύπρος)","cy","357"],["Czech Republic (Česká republika)","cz","420"],["Denmark (Danmark)","dk","45"],["Djibouti","dj","253"],["Dominica","dm","1",13,["767"]],["Dominican Republic (República Dominicana)","do","1",2,["809","829","849"]],["Ecuador","ec","593"],["Egypt (‫مصر‬‎)","eg","20"],["El Salvador","sv","503"],["Equatorial Guinea (Guinea Ecuatorial)","gq","240"],["Eritrea","er","291"],["Estonia (Eesti)","ee","372"],["Eswatini","sz","268"],["Ethiopia","et","251"],["Falkland Islands (Islas Malvinas)","fk","500"],["Faroe Islands (Føroyar)","fo","298"],["Fiji","fj","679"],["Finland (Suomi)","fi","358",0],["France","fr","33"],["French Guiana (Guyane française)","gf","594"],["French Polynesia (Polynésie française)","pf","689"],["Gabon","ga","241"],["Gambia","gm","220"],["Georgia (საქართველო)","ge","995"],["Germany (Deutschland)","de","49"],["Ghana (Gaana)","gh","233"],["Gibraltar","gi","350"],["Greece (Ελλάδα)","gr","30"],["Greenland (Kalaallit Nunaat)","gl","299"],["Grenada","gd","1",14,["473"]],["Guadeloupe","gp","590",0],["Guam","gu","1",15,["671"]],["Guatemala","gt","502"],["Guernsey","gg","44",1,["1481","7781","7839","7911"]],["Guinea (Guinée)","gn","224"],["Guinea-Bissau (Guiné Bissau)","gw","245"],["Guyana","gy","592"],["Haiti","ht","509"],["Honduras","hn","504"],["Hong Kong (香港)","hk","852"],["Hungary (Magyarország)","hu","36"],["Iceland (Ísland)","is","354"],["India (भारत)","in","91"],["Indonesia","id","62"],["Iran (‫ایران‬‎)","ir","98"],["Iraq (‫العراق‬‎)","iq","964"],["Ireland","ie","353"],["Isle of Man","im","44",2,["1624","74576","7524","7924","7624"]],["Israel (‫ישראל‬‎)","il","972"],["Italy (Italia)","it","39",0],["Jamaica","jm","1",4,["876","658"]],["Japan (日本)","jp","81"],["Jersey","je","44",3,["1534","7509","7700","7797","7829","7937"]],["Jordan (‫الأردن‬‎)","jo","962"],["Kazakhstan (Казахстан)","kz","7",1,["33","7"]],["Kenya","ke","254"],["Kiribati","ki","686"],["Kosovo","xk","383"],["Kuwait (‫الكويت‬‎)","kw","965"],["Kyrgyzstan (Кыргызстан)","kg","996"],["Laos (ລາວ)","la","856"],["Latvia (Latvija)","lv","371"],["Lebanon (‫لبنان‬‎)","lb","961"],["Lesotho","ls","266"],["Liberia","lr","231"],["Libya (‫ليبيا‬‎)","ly","218"],["Liechtenstein","li","423"],["Lithuania (Lietuva)","lt","370"],["Luxembourg","lu","352"],["Macau (澳門)","mo","853"],["North Macedonia (Македонија)","mk","389"],["Madagascar (Madagasikara)","mg","261"],["Malawi","mw","265"],["Malaysia","my","60"],["Maldives","mv","960"],["Mali","ml","223"],["Malta","mt","356"],["Marshall Islands","mh","692"],["Martinique","mq","596"],["Mauritania (‫موريتانيا‬‎)","mr","222"],["Mauritius (Moris)","mu","230"],["Mayotte","yt","262",1,["269","639"]],["Mexico (México)","mx","52"],["Micronesia","fm","691"],["Moldova (Republica Moldova)","md","373"],["Monaco","mc","377"],["Mongolia (Монгол)","mn","976"],["Montenegro (Crna Gora)","me","382"],["Montserrat","ms","1",16,["664"]],["Morocco (‫المغرب‬‎)","ma","212",0],["Mozambique (Moçambique)","mz","258"],["Myanmar (Burma) (မြန်မာ)","mm","95"],["Namibia (Namibië)","na","264"],["Nauru","nr","674"],["Nepal (नेपाल)","np","977"],["Netherlands (Nederland)","nl","31"],["New Caledonia (Nouvelle-Calédonie)","nc","687"],["New Zealand","nz","64"],["Nicaragua","ni","505"],["Niger (Nijar)","ne","227"],["Nigeria","ng","234"],["Niue","nu","683"],["Norfolk Island","nf","672"],["North Korea (조선 민주주의 인민 공화국)","kp","850"],["Northern Mariana Islands","mp","1",17,["670"]],["Norway (Norge)","no","47",0],["Oman (‫عُمان‬‎)","om","968"],["Pakistan (‫پاکستان‬‎)","pk","92"],["Palau","pw","680"],["Palestine (‫فلسطين‬‎)","ps","970"],["Panama (Panamá)","pa","507"],["Papua New Guinea","pg","675"],["Paraguay","py","595"],["Peru (Perú)","pe","51"],["Philippines","ph","63"],["Poland (Polska)","pl","48"],["Portugal","pt","351"],["Puerto Rico","pr","1",3,["787","939"]],["Qatar (‫قطر‬‎)","qa","974"],["Réunion (La Réunion)","re","262",0],["Romania (România)","ro","40"],["Russia (Россия)","ru","7",0],["Rwanda","rw","250"],["Saint Barthélemy","bl","590",1],["Saint Helena","sh","290"],["Saint Kitts and Nevis","kn","1",18,["869"]],["Saint Lucia","lc","1",19,["758"]],["Saint Martin (Saint-Martin (partie française))","mf","590",2],["Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)","pm","508"],["Saint Vincent and the Grenadines","vc","1",20,["784"]],["Samoa","ws","685"],["San Marino","sm","378"],["São Tomé and Príncipe (São Tomé e Príncipe)","st","239"],["Saudi Arabia (‫المملكة العربية السعودية‬‎)","sa","966"],["Senegal (Sénégal)","sn","221"],["Serbia (Србија)","rs","381"],["Seychelles","sc","248"],["Sierra Leone","sl","232"],["Singapore","sg","65"],["Sint Maarten","sx","1",21,["721"]],["Slovakia (Slovensko)","sk","421"],["Slovenia (Slovenija)","si","386"],["Solomon Islands","sb","677"],["Somalia (Soomaaliya)","so","252"],["South Africa","za","27"],["South Korea (대한민국)","kr","82"],["South Sudan (‫جنوب السودان‬‎)","ss","211"],["Spain (España)","es","34"],["Sri Lanka (ශ්‍රී ලංකාව)","lk","94"],["Sudan (‫السودان‬‎)","sd","249"],["Suriname","sr","597"],["Svalbard and Jan Mayen","sj","47",1,["79"]],["Sweden (Sverige)","se","46"],["Switzerland (Schweiz)","ch","41"],["Syria (‫سوريا‬‎)","sy","963"],["Taiwan (台灣)","tw","886"],["Tajikistan","tj","992"],["Tanzania","tz","255"],["Thailand (ไทย)","th","66"],["Timor-Leste","tl","670"],["Togo","tg","228"],["Tokelau","tk","690"],["Tonga","to","676"],["Trinidad and Tobago","tt","1",22,["868"]],["Tunisia (‫تونس‬‎)","tn","216"],["Turkey (Türkiye)","tr","90"],["Turkmenistan","tm","993"],["Turks and Caicos Islands","tc","1",23,["649"]],["Tuvalu","tv","688"],["U.S. Virgin Islands","vi","1",24,["340"]],["Uganda","ug","256"],["Ukraine (Україна)","ua","380"],["United Arab Emirates (‫الإمارات العربية المتحدة‬‎)","ae","971"],["United Kingdom","gb","44",0],["United States","us","1",0],["Uruguay","uy","598"],["Uzbekistan (Oʻzbekiston)","uz","998"],["Vanuatu","vu","678"],["Vatican City (Città del Vaticano)","va","39",1,["06698"]],["Venezuela","ve","58"],["Vietnam (Việt Nam)","vn","84"],["Wallis and Futuna (Wallis-et-Futuna)","wf","681"],["Western Sahara (‫الصحراء الغربية‬‎)","eh","212",1,["5288","5289"]],["Yemen (‫اليمن‬‎)","ye","967"],["Zambia","zm","260"],["Zimbabwe","zw","263"],["Åland Islands","ax","358",1,["18"]]],b=0;b1 country with same dial code), 30 | // Area codes 31 | // ] 32 | var allCountries = [ [ "Afghanistan (‫افغانستان‬‎)", "af", "93" ], [ "Albania (Shqipëri)", "al", "355" ], [ "Algeria (‫الجزائر‬‎)", "dz", "213" ], [ "American Samoa", "as", "1", 5, [ "684" ] ], [ "Andorra", "ad", "376" ], [ "Angola", "ao", "244" ], [ "Anguilla", "ai", "1", 6, [ "264" ] ], [ "Antigua and Barbuda", "ag", "1", 7, [ "268" ] ], [ "Argentina", "ar", "54" ], [ "Armenia (Հայաստան)", "am", "374" ], [ "Aruba", "aw", "297" ], [ "Ascension Island", "ac", "247" ], [ "Australia", "au", "61", 0 ], [ "Austria (Österreich)", "at", "43" ], [ "Azerbaijan (Azərbaycan)", "az", "994" ], [ "Bahamas", "bs", "1", 8, [ "242" ] ], [ "Bahrain (‫البحرين‬‎)", "bh", "973" ], [ "Bangladesh (বাংলাদেশ)", "bd", "880" ], [ "Barbados", "bb", "1", 9, [ "246" ] ], [ "Belarus (Беларусь)", "by", "375" ], [ "Belgium (België)", "be", "32" ], [ "Belize", "bz", "501" ], [ "Benin (Bénin)", "bj", "229" ], [ "Bermuda", "bm", "1", 10, [ "441" ] ], [ "Bhutan (འབྲུག)", "bt", "975" ], [ "Bolivia", "bo", "591" ], [ "Bosnia and Herzegovina (Босна и Херцеговина)", "ba", "387" ], [ "Botswana", "bw", "267" ], [ "Brazil (Brasil)", "br", "55" ], [ "British Indian Ocean Territory", "io", "246" ], [ "British Virgin Islands", "vg", "1", 11, [ "284" ] ], [ "Brunei", "bn", "673" ], [ "Bulgaria (България)", "bg", "359" ], [ "Burkina Faso", "bf", "226" ], [ "Burundi (Uburundi)", "bi", "257" ], [ "Cambodia (កម្ពុជា)", "kh", "855" ], [ "Cameroon (Cameroun)", "cm", "237" ], [ "Canada", "ca", "1", 1, [ "204", "226", "236", "249", "250", "289", "306", "343", "365", "387", "403", "416", "418", "431", "437", "438", "450", "506", "514", "519", "548", "579", "581", "587", "604", "613", "639", "647", "672", "705", "709", "742", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905" ] ], [ "Cape Verde (Kabu Verdi)", "cv", "238" ], [ "Caribbean Netherlands", "bq", "599", 1, [ "3", "4", "7" ] ], [ "Cayman Islands", "ky", "1", 12, [ "345" ] ], [ "Central African Republic (République centrafricaine)", "cf", "236" ], [ "Chad (Tchad)", "td", "235" ], [ "Chile", "cl", "56" ], [ "China (中国)", "cn", "86" ], [ "Christmas Island", "cx", "61", 2, [ "89164" ] ], [ "Cocos (Keeling) Islands", "cc", "61", 1, [ "89162" ] ], [ "Colombia", "co", "57" ], [ "Comoros (‫جزر القمر‬‎)", "km", "269" ], [ "Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)", "cd", "243" ], [ "Congo (Republic) (Congo-Brazzaville)", "cg", "242" ], [ "Cook Islands", "ck", "682" ], [ "Costa Rica", "cr", "506" ], [ "Côte d’Ivoire", "ci", "225" ], [ "Croatia (Hrvatska)", "hr", "385" ], [ "Cuba", "cu", "53" ], [ "Curaçao", "cw", "599", 0 ], [ "Cyprus (Κύπρος)", "cy", "357" ], [ "Czech Republic (Česká republika)", "cz", "420" ], [ "Denmark (Danmark)", "dk", "45" ], [ "Djibouti", "dj", "253" ], [ "Dominica", "dm", "1", 13, [ "767" ] ], [ "Dominican Republic (República Dominicana)", "do", "1", 2, [ "809", "829", "849" ] ], [ "Ecuador", "ec", "593" ], [ "Egypt (‫مصر‬‎)", "eg", "20" ], [ "El Salvador", "sv", "503" ], [ "Equatorial Guinea (Guinea Ecuatorial)", "gq", "240" ], [ "Eritrea", "er", "291" ], [ "Estonia (Eesti)", "ee", "372" ], [ "Eswatini", "sz", "268" ], [ "Ethiopia", "et", "251" ], [ "Falkland Islands (Islas Malvinas)", "fk", "500" ], [ "Faroe Islands (Føroyar)", "fo", "298" ], [ "Fiji", "fj", "679" ], [ "Finland (Suomi)", "fi", "358", 0 ], [ "France", "fr", "33" ], [ "French Guiana (Guyane française)", "gf", "594" ], [ "French Polynesia (Polynésie française)", "pf", "689" ], [ "Gabon", "ga", "241" ], [ "Gambia", "gm", "220" ], [ "Georgia (საქართველო)", "ge", "995" ], [ "Germany (Deutschland)", "de", "49" ], [ "Ghana (Gaana)", "gh", "233" ], [ "Gibraltar", "gi", "350" ], [ "Greece (Ελλάδα)", "gr", "30" ], [ "Greenland (Kalaallit Nunaat)", "gl", "299" ], [ "Grenada", "gd", "1", 14, [ "473" ] ], [ "Guadeloupe", "gp", "590", 0 ], [ "Guam", "gu", "1", 15, [ "671" ] ], [ "Guatemala", "gt", "502" ], [ "Guernsey", "gg", "44", 1, [ "1481", "7781", "7839", "7911" ] ], [ "Guinea (Guinée)", "gn", "224" ], [ "Guinea-Bissau (Guiné Bissau)", "gw", "245" ], [ "Guyana", "gy", "592" ], [ "Haiti", "ht", "509" ], [ "Honduras", "hn", "504" ], [ "Hong Kong (香港)", "hk", "852" ], [ "Hungary (Magyarország)", "hu", "36" ], [ "Iceland (Ísland)", "is", "354" ], [ "India (भारत)", "in", "91" ], [ "Indonesia", "id", "62" ], [ "Iran (‫ایران‬‎)", "ir", "98" ], [ "Iraq (‫العراق‬‎)", "iq", "964" ], [ "Ireland", "ie", "353" ], [ "Isle of Man", "im", "44", 2, [ "1624", "74576", "7524", "7924", "7624" ] ], [ "Israel (‫ישראל‬‎)", "il", "972" ], [ "Italy (Italia)", "it", "39", 0 ], [ "Jamaica", "jm", "1", 4, [ "876", "658" ] ], [ "Japan (日本)", "jp", "81" ], [ "Jersey", "je", "44", 3, [ "1534", "7509", "7700", "7797", "7829", "7937" ] ], [ "Jordan (‫الأردن‬‎)", "jo", "962" ], [ "Kazakhstan (Казахстан)", "kz", "7", 1, [ "33", "7" ] ], [ "Kenya", "ke", "254" ], [ "Kiribati", "ki", "686" ], [ "Kosovo", "xk", "383" ], [ "Kuwait (‫الكويت‬‎)", "kw", "965" ], [ "Kyrgyzstan (Кыргызстан)", "kg", "996" ], [ "Laos (ລາວ)", "la", "856" ], [ "Latvia (Latvija)", "lv", "371" ], [ "Lebanon (‫لبنان‬‎)", "lb", "961" ], [ "Lesotho", "ls", "266" ], [ "Liberia", "lr", "231" ], [ "Libya (‫ليبيا‬‎)", "ly", "218" ], [ "Liechtenstein", "li", "423" ], [ "Lithuania (Lietuva)", "lt", "370" ], [ "Luxembourg", "lu", "352" ], [ "Macau (澳門)", "mo", "853" ], [ "North Macedonia (Македонија)", "mk", "389" ], [ "Madagascar (Madagasikara)", "mg", "261" ], [ "Malawi", "mw", "265" ], [ "Malaysia", "my", "60" ], [ "Maldives", "mv", "960" ], [ "Mali", "ml", "223" ], [ "Malta", "mt", "356" ], [ "Marshall Islands", "mh", "692" ], [ "Martinique", "mq", "596" ], [ "Mauritania (‫موريتانيا‬‎)", "mr", "222" ], [ "Mauritius (Moris)", "mu", "230" ], [ "Mayotte", "yt", "262", 1, [ "269", "639" ] ], [ "Mexico (México)", "mx", "52" ], [ "Micronesia", "fm", "691" ], [ "Moldova (Republica Moldova)", "md", "373" ], [ "Monaco", "mc", "377" ], [ "Mongolia (Монгол)", "mn", "976" ], [ "Montenegro (Crna Gora)", "me", "382" ], [ "Montserrat", "ms", "1", 16, [ "664" ] ], [ "Morocco (‫المغرب‬‎)", "ma", "212", 0 ], [ "Mozambique (Moçambique)", "mz", "258" ], [ "Myanmar (Burma) (မြန်မာ)", "mm", "95" ], [ "Namibia (Namibië)", "na", "264" ], [ "Nauru", "nr", "674" ], [ "Nepal (नेपाल)", "np", "977" ], [ "Netherlands (Nederland)", "nl", "31" ], [ "New Caledonia (Nouvelle-Calédonie)", "nc", "687" ], [ "New Zealand", "nz", "64" ], [ "Nicaragua", "ni", "505" ], [ "Niger (Nijar)", "ne", "227" ], [ "Nigeria", "ng", "234" ], [ "Niue", "nu", "683" ], [ "Norfolk Island", "nf", "672" ], [ "North Korea (조선 민주주의 인민 공화국)", "kp", "850" ], [ "Northern Mariana Islands", "mp", "1", 17, [ "670" ] ], [ "Norway (Norge)", "no", "47", 0 ], [ "Oman (‫عُمان‬‎)", "om", "968" ], [ "Pakistan (‫پاکستان‬‎)", "pk", "92" ], [ "Palau", "pw", "680" ], [ "Palestine (‫فلسطين‬‎)", "ps", "970" ], [ "Panama (Panamá)", "pa", "507" ], [ "Papua New Guinea", "pg", "675" ], [ "Paraguay", "py", "595" ], [ "Peru (Perú)", "pe", "51" ], [ "Philippines", "ph", "63" ], [ "Poland (Polska)", "pl", "48" ], [ "Portugal", "pt", "351" ], [ "Puerto Rico", "pr", "1", 3, [ "787", "939" ] ], [ "Qatar (‫قطر‬‎)", "qa", "974" ], [ "Réunion (La Réunion)", "re", "262", 0 ], [ "Romania (România)", "ro", "40" ], [ "Russia (Россия)", "ru", "7", 0 ], [ "Rwanda", "rw", "250" ], [ "Saint Barthélemy", "bl", "590", 1 ], [ "Saint Helena", "sh", "290" ], [ "Saint Kitts and Nevis", "kn", "1", 18, [ "869" ] ], [ "Saint Lucia", "lc", "1", 19, [ "758" ] ], [ "Saint Martin (Saint-Martin (partie française))", "mf", "590", 2 ], [ "Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)", "pm", "508" ], [ "Saint Vincent and the Grenadines", "vc", "1", 20, [ "784" ] ], [ "Samoa", "ws", "685" ], [ "San Marino", "sm", "378" ], [ "São Tomé and Príncipe (São Tomé e Príncipe)", "st", "239" ], [ "Saudi Arabia (‫المملكة العربية السعودية‬‎)", "sa", "966" ], [ "Senegal (Sénégal)", "sn", "221" ], [ "Serbia (Србија)", "rs", "381" ], [ "Seychelles", "sc", "248" ], [ "Sierra Leone", "sl", "232" ], [ "Singapore", "sg", "65" ], [ "Sint Maarten", "sx", "1", 21, [ "721" ] ], [ "Slovakia (Slovensko)", "sk", "421" ], [ "Slovenia (Slovenija)", "si", "386" ], [ "Solomon Islands", "sb", "677" ], [ "Somalia (Soomaaliya)", "so", "252" ], [ "South Africa", "za", "27" ], [ "South Korea (대한민국)", "kr", "82" ], [ "South Sudan (‫جنوب السودان‬‎)", "ss", "211" ], [ "Spain (España)", "es", "34" ], [ "Sri Lanka (ශ්‍රී ලංකාව)", "lk", "94" ], [ "Sudan (‫السودان‬‎)", "sd", "249" ], [ "Suriname", "sr", "597" ], [ "Svalbard and Jan Mayen", "sj", "47", 1, [ "79" ] ], [ "Sweden (Sverige)", "se", "46" ], [ "Switzerland (Schweiz)", "ch", "41" ], [ "Syria (‫سوريا‬‎)", "sy", "963" ], [ "Taiwan (台灣)", "tw", "886" ], [ "Tajikistan", "tj", "992" ], [ "Tanzania", "tz", "255" ], [ "Thailand (ไทย)", "th", "66" ], [ "Timor-Leste", "tl", "670" ], [ "Togo", "tg", "228" ], [ "Tokelau", "tk", "690" ], [ "Tonga", "to", "676" ], [ "Trinidad and Tobago", "tt", "1", 22, [ "868" ] ], [ "Tunisia (‫تونس‬‎)", "tn", "216" ], [ "Turkey (Türkiye)", "tr", "90" ], [ "Turkmenistan", "tm", "993" ], [ "Turks and Caicos Islands", "tc", "1", 23, [ "649" ] ], [ "Tuvalu", "tv", "688" ], [ "U.S. Virgin Islands", "vi", "1", 24, [ "340" ] ], [ "Uganda", "ug", "256" ], [ "Ukraine (Україна)", "ua", "380" ], [ "United Arab Emirates (‫الإمارات العربية المتحدة‬‎)", "ae", "971" ], [ "United Kingdom", "gb", "44", 0 ], [ "United States", "us", "1", 0 ], [ "Uruguay", "uy", "598" ], [ "Uzbekistan (Oʻzbekiston)", "uz", "998" ], [ "Vanuatu", "vu", "678" ], [ "Vatican City (Città del Vaticano)", "va", "39", 1, [ "06698" ] ], [ "Venezuela", "ve", "58" ], [ "Vietnam (Việt Nam)", "vn", "84" ], [ "Wallis and Futuna (Wallis-et-Futuna)", "wf", "681" ], [ "Western Sahara (‫الصحراء الغربية‬‎)", "eh", "212", 1, [ "5288", "5289" ] ], [ "Yemen (‫اليمن‬‎)", "ye", "967" ], [ "Zambia", "zm", "260" ], [ "Zimbabwe", "zw", "263" ], [ "Åland Islands", "ax", "358", 1, [ "18" ] ] ]; 33 | // loop over all of the countries above, restructuring the data to be objects with named keys 34 | for (var i = 0; i < allCountries.length; i++) { 35 | var c = allCountries[i]; 36 | allCountries[i] = { 37 | name: c[0], 38 | iso2: c[1], 39 | dialCode: c[2], 40 | priority: c[3] || 0, 41 | areaCodes: c[4] || null 42 | }; 43 | } 44 | "use strict"; 45 | function _classCallCheck(instance, Constructor) { 46 | if (!(instance instanceof Constructor)) { 47 | throw new TypeError("Cannot call a class as a function"); 48 | } 49 | } 50 | function _defineProperties(target, props) { 51 | for (var i = 0; i < props.length; i++) { 52 | var descriptor = props[i]; 53 | descriptor.enumerable = descriptor.enumerable || false; 54 | descriptor.configurable = true; 55 | if ("value" in descriptor) descriptor.writable = true; 56 | Object.defineProperty(target, descriptor.key, descriptor); 57 | } 58 | } 59 | function _createClass(Constructor, protoProps, staticProps) { 60 | if (protoProps) _defineProperties(Constructor.prototype, protoProps); 61 | if (staticProps) _defineProperties(Constructor, staticProps); 62 | return Constructor; 63 | } 64 | var intlTelInputGlobals = { 65 | getInstance: function getInstance(input) { 66 | var id = input.getAttribute("data-intl-tel-input-id"); 67 | return window.intlTelInputGlobals.instances[id]; 68 | }, 69 | instances: {}, 70 | // using a global like this allows us to mock it in the tests 71 | documentReady: function documentReady() { 72 | return document.readyState === "complete"; 73 | } 74 | }; 75 | if (typeof window === "object") window.intlTelInputGlobals = intlTelInputGlobals; 76 | // these vars persist through all instances of the plugin 77 | var id = 0; 78 | var defaults = { 79 | // whether or not to allow the dropdown 80 | allowDropdown: true, 81 | // if there is just a dial code in the input: remove it on blur 82 | autoHideDialCode: true, 83 | // add a placeholder in the input with an example number for the selected country 84 | autoPlaceholder: "polite", 85 | // modify the parentClass 86 | customContainer: "", 87 | // modify the auto placeholder 88 | customPlaceholder: null, 89 | // append menu to specified element 90 | dropdownContainer: null, 91 | // don't display these countries 92 | excludeCountries: [], 93 | // format the input value during initialisation and on setNumber 94 | formatOnDisplay: true, 95 | // geoIp lookup function 96 | geoIpLookup: null, 97 | // inject a hidden input with this name, and on submit, populate it with the result of getNumber 98 | hiddenInput: "", 99 | // initial country 100 | initialCountry: "", 101 | // localized country names e.g. { 'de': 'Deutschland' } 102 | localizedCountries: null, 103 | // don't insert international dial codes 104 | nationalMode: true, 105 | // display only these countries 106 | onlyCountries: [], 107 | // number type to use for placeholders 108 | placeholderNumberType: "MOBILE", 109 | // the countries at the top of the list. defaults to united states and united kingdom 110 | preferredCountries: [ "us", "gb" ], 111 | // display the country dial code next to the selected flag so it's not part of the typed number 112 | separateDialCode: false, 113 | // specify the path to the libphonenumber script to enable validation/formatting 114 | utilsScript: "" 115 | }; 116 | // https://en.wikipedia.org/wiki/List_of_North_American_Numbering_Plan_area_codes#Non-geographic_area_codes 117 | var regionlessNanpNumbers = [ "800", "822", "833", "844", "855", "866", "877", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889" ]; 118 | // utility function to iterate over an object. can't use Object.entries or native forEach because 119 | // of IE11 120 | var forEachProp = function forEachProp(obj, callback) { 121 | var keys = Object.keys(obj); 122 | for (var i = 0; i < keys.length; i++) { 123 | callback(keys[i], obj[keys[i]]); 124 | } 125 | }; 126 | // run a method on each instance of the plugin 127 | var forEachInstance = function forEachInstance(method) { 128 | forEachProp(window.intlTelInputGlobals.instances, function(key) { 129 | window.intlTelInputGlobals.instances[key][method](); 130 | }); 131 | }; 132 | // this is our plugin class that we will create an instance of 133 | // eslint-disable-next-line no-unused-vars 134 | var Iti = /*#__PURE__*/ 135 | function() { 136 | function Iti(input, options) { 137 | var _this = this; 138 | _classCallCheck(this, Iti); 139 | this.id = id++; 140 | this.telInput = input; 141 | this.activeItem = null; 142 | this.highlightedItem = null; 143 | // process specified options / defaults 144 | // alternative to Object.assign, which isn't supported by IE11 145 | var customOptions = options || {}; 146 | this.options = {}; 147 | forEachProp(defaults, function(key, value) { 148 | _this.options[key] = customOptions.hasOwnProperty(key) ? customOptions[key] : value; 149 | }); 150 | this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder")); 151 | } 152 | _createClass(Iti, [ { 153 | key: "_init", 154 | value: function _init() { 155 | var _this2 = this; 156 | // if in nationalMode, disable options relating to dial codes 157 | if (this.options.nationalMode) this.options.autoHideDialCode = false; 158 | // if separateDialCode then doesn't make sense to A) insert dial code into input 159 | // (autoHideDialCode), and B) display national numbers (because we're displaying the country 160 | // dial code next to them) 161 | if (this.options.separateDialCode) { 162 | this.options.autoHideDialCode = this.options.nationalMode = false; 163 | } 164 | // we cannot just test screen size as some smartphones/website meta tags will report desktop 165 | // resolutions 166 | // Note: for some reason jasmine breaks if you put this in the main Plugin function with the 167 | // rest of these declarations 168 | // Note: to target Android Mobiles (and not Tablets), we must find 'Android' and 'Mobile' 169 | this.isMobile = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); 170 | if (this.isMobile) { 171 | // trigger the mobile dropdown css 172 | document.body.classList.add("iti-mobile"); 173 | // on mobile, we want a full screen dropdown, so we must append it to the body 174 | if (!this.options.dropdownContainer) this.options.dropdownContainer = document.body; 175 | } 176 | // these promises get resolved when their individual requests complete 177 | // this way the dev can do something like iti.promise.then(...) to know when all requests are 178 | // complete 179 | if (typeof Promise !== "undefined") { 180 | var autoCountryPromise = new Promise(function(resolve, reject) { 181 | _this2.resolveAutoCountryPromise = resolve; 182 | _this2.rejectAutoCountryPromise = reject; 183 | }); 184 | var utilsScriptPromise = new Promise(function(resolve, reject) { 185 | _this2.resolveUtilsScriptPromise = resolve; 186 | _this2.rejectUtilsScriptPromise = reject; 187 | }); 188 | this.promise = Promise.all([ autoCountryPromise, utilsScriptPromise ]); 189 | } else { 190 | // prevent errors when Promise doesn't exist 191 | this.resolveAutoCountryPromise = this.rejectAutoCountryPromise = function() {}; 192 | this.resolveUtilsScriptPromise = this.rejectUtilsScriptPromise = function() {}; 193 | } 194 | // in various situations there could be no country selected initially, but we need to be able 195 | // to assume this variable exists 196 | this.selectedCountryData = {}; 197 | // process all the data: onlyCountries, excludeCountries, preferredCountries etc 198 | this._processCountryData(); 199 | // generate the markup 200 | this._generateMarkup(); 201 | // set the initial state of the input value and the selected flag 202 | this._setInitialState(); 203 | // start all of the event listeners: autoHideDialCode, input keydown, selectedFlag click 204 | this._initListeners(); 205 | // utils script, and auto country 206 | this._initRequests(); 207 | } 208 | }, { 209 | key: "_processCountryData", 210 | value: function _processCountryData() { 211 | // process onlyCountries or excludeCountries array if present 212 | this._processAllCountries(); 213 | // process the countryCodes map 214 | this._processCountryCodes(); 215 | // process the preferredCountries 216 | this._processPreferredCountries(); 217 | // translate countries according to localizedCountries option 218 | if (this.options.localizedCountries) this._translateCountriesByLocale(); 219 | // sort countries by name 220 | if (this.options.onlyCountries.length || this.options.localizedCountries) { 221 | this.countries.sort(this._countryNameSort); 222 | } 223 | } 224 | }, { 225 | key: "_addCountryCode", 226 | value: function _addCountryCode(iso2, countryCode, priority) { 227 | if (countryCode.length > this.countryCodeMaxLen) { 228 | this.countryCodeMaxLen = countryCode.length; 229 | } 230 | if (!this.countryCodes.hasOwnProperty(countryCode)) { 231 | this.countryCodes[countryCode] = []; 232 | } 233 | // bail if we already have this country for this countryCode 234 | for (var i = 0; i < this.countryCodes[countryCode].length; i++) { 235 | if (this.countryCodes[countryCode][i] === iso2) return; 236 | } 237 | // check for undefined as 0 is falsy 238 | var index = priority !== undefined ? priority : this.countryCodes[countryCode].length; 239 | this.countryCodes[countryCode][index] = iso2; 240 | } 241 | }, { 242 | key: "_processAllCountries", 243 | value: function _processAllCountries() { 244 | if (this.options.onlyCountries.length) { 245 | var lowerCaseOnlyCountries = this.options.onlyCountries.map(function(country) { 246 | return country.toLowerCase(); 247 | }); 248 | this.countries = allCountries.filter(function(country) { 249 | return lowerCaseOnlyCountries.indexOf(country.iso2) > -1; 250 | }); 251 | } else if (this.options.excludeCountries.length) { 252 | var lowerCaseExcludeCountries = this.options.excludeCountries.map(function(country) { 253 | return country.toLowerCase(); 254 | }); 255 | this.countries = allCountries.filter(function(country) { 256 | return lowerCaseExcludeCountries.indexOf(country.iso2) === -1; 257 | }); 258 | } else { 259 | this.countries = allCountries; 260 | } 261 | } 262 | }, { 263 | key: "_translateCountriesByLocale", 264 | value: function _translateCountriesByLocale() { 265 | for (var i = 0; i < this.countries.length; i++) { 266 | var iso = this.countries[i].iso2.toLowerCase(); 267 | if (this.options.localizedCountries.hasOwnProperty(iso)) { 268 | this.countries[i].name = this.options.localizedCountries[iso]; 269 | } 270 | } 271 | } 272 | }, { 273 | key: "_countryNameSort", 274 | value: function _countryNameSort(a, b) { 275 | return a.name.localeCompare(b.name); 276 | } 277 | }, { 278 | key: "_processCountryCodes", 279 | value: function _processCountryCodes() { 280 | this.countryCodeMaxLen = 0; 281 | // here we store just dial codes 282 | this.dialCodes = {}; 283 | // here we store "country codes" (both dial codes and their area codes) 284 | this.countryCodes = {}; 285 | // first: add dial codes 286 | for (var i = 0; i < this.countries.length; i++) { 287 | var c = this.countries[i]; 288 | if (!this.dialCodes[c.dialCode]) this.dialCodes[c.dialCode] = true; 289 | this._addCountryCode(c.iso2, c.dialCode, c.priority); 290 | } 291 | // next: add area codes 292 | // this is a second loop over countries, to make sure we have all of the "root" countries 293 | // already in the map, so that we can access them, as each time we add an area code substring 294 | // to the map, we also need to include the "root" country's code, as that also matches 295 | for (var _i = 0; _i < this.countries.length; _i++) { 296 | var _c = this.countries[_i]; 297 | // area codes 298 | if (_c.areaCodes) { 299 | var rootCountryCode = this.countryCodes[_c.dialCode][0]; 300 | // for each area code 301 | for (var j = 0; j < _c.areaCodes.length; j++) { 302 | var areaCode = _c.areaCodes[j]; 303 | // for each digit in the area code to add all partial matches as well 304 | for (var k = 1; k < areaCode.length; k++) { 305 | var partialDialCode = _c.dialCode + areaCode.substr(0, k); 306 | // start with the root country, as that also matches this dial code 307 | this._addCountryCode(rootCountryCode, partialDialCode); 308 | this._addCountryCode(_c.iso2, partialDialCode); 309 | } 310 | // add the full area code 311 | this._addCountryCode(_c.iso2, _c.dialCode + areaCode); 312 | } 313 | } 314 | } 315 | } 316 | }, { 317 | key: "_processPreferredCountries", 318 | value: function _processPreferredCountries() { 319 | this.preferredCountries = []; 320 | for (var i = 0; i < this.options.preferredCountries.length; i++) { 321 | var countryCode = this.options.preferredCountries[i].toLowerCase(); 322 | var countryData = this._getCountryData(countryCode, false, true); 323 | if (countryData) this.preferredCountries.push(countryData); 324 | } 325 | } 326 | }, { 327 | key: "_createEl", 328 | value: function _createEl(name, attrs, container) { 329 | var el = document.createElement(name); 330 | if (attrs) forEachProp(attrs, function(key, value) { 331 | return el.setAttribute(key, value); 332 | }); 333 | if (container) container.appendChild(el); 334 | return el; 335 | } 336 | }, { 337 | key: "_generateMarkup", 338 | value: function _generateMarkup() { 339 | // if autocomplete does not exist on the element and its form, then 340 | // prevent autocomplete as there's no safe, cross-browser event we can react to, so it can 341 | // easily put the plugin in an inconsistent state e.g. the wrong flag selected for the 342 | // autocompleted number, which on submit could mean wrong number is saved (esp in nationalMode) 343 | if (!this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete"))) { 344 | this.telInput.setAttribute("autocomplete", "off"); 345 | } 346 | // containers (mostly for positioning) 347 | var parentClass = "iti"; 348 | if (this.options.allowDropdown) parentClass += " iti--allow-dropdown"; 349 | if (this.options.separateDialCode) parentClass += " iti--separate-dial-code"; 350 | if (this.options.customContainer) { 351 | parentClass += " "; 352 | parentClass += this.options.customContainer; 353 | } 354 | var wrapper = this._createEl("div", { 355 | "class": parentClass 356 | }); 357 | this.telInput.parentNode.insertBefore(wrapper, this.telInput); 358 | this.flagsContainer = this._createEl("div", { 359 | "class": "iti__flag-container" 360 | }, wrapper); 361 | wrapper.appendChild(this.telInput); 362 | // selected flag (displayed to left of input) 363 | this.selectedFlag = this._createEl("div", { 364 | "class": "iti__selected-flag", 365 | role: "combobox", 366 | "aria-controls": "iti-".concat(this.id, "__country-listbox"), 367 | "aria-owns": "iti-".concat(this.id, "__country-listbox"), 368 | "aria-expanded": "false" 369 | }, this.flagsContainer); 370 | this.selectedFlagInner = this._createEl("div", { 371 | "class": "iti__flag" 372 | }, this.selectedFlag); 373 | if (this.options.separateDialCode) { 374 | this.selectedDialCode = this._createEl("div", { 375 | "class": "iti__selected-dial-code" 376 | }, this.selectedFlag); 377 | } 378 | if (this.options.allowDropdown) { 379 | // make element focusable and tab navigable 380 | this.selectedFlag.setAttribute("tabindex", "0"); 381 | this.dropdownArrow = this._createEl("div", { 382 | "class": "iti__arrow" 383 | }, this.selectedFlag); 384 | // country dropdown: preferred countries, then divider, then all countries 385 | this.countryList = this._createEl("ul", { 386 | "class": "iti__country-list iti__hide", 387 | id: "iti-".concat(this.id, "__country-listbox"), 388 | role: "listbox", 389 | "aria-label": "List of countries" 390 | }); 391 | if (this.preferredCountries.length) { 392 | this._appendListItems(this.preferredCountries, "iti__preferred", true); 393 | this._createEl("li", { 394 | "class": "iti__divider", 395 | role: "separator", 396 | "aria-disabled": "true" 397 | }, this.countryList); 398 | } 399 | this._appendListItems(this.countries, "iti__standard"); 400 | // create dropdownContainer markup 401 | if (this.options.dropdownContainer) { 402 | this.dropdown = this._createEl("div", { 403 | "class": "iti iti--container" 404 | }); 405 | this.dropdown.appendChild(this.countryList); 406 | } else { 407 | this.flagsContainer.appendChild(this.countryList); 408 | } 409 | } 410 | if (this.options.hiddenInput) { 411 | var hiddenInputName = this.options.hiddenInput; 412 | var name = this.telInput.getAttribute("name"); 413 | if (name) { 414 | var i = name.lastIndexOf("["); 415 | // if input name contains square brackets, then give the hidden input the same name, 416 | // replacing the contents of the last set of brackets with the given hiddenInput name 417 | if (i !== -1) hiddenInputName = "".concat(name.substr(0, i), "[").concat(hiddenInputName, "]"); 418 | } 419 | this.hiddenInput = this._createEl("input", { 420 | type: "hidden", 421 | name: hiddenInputName 422 | }); 423 | wrapper.appendChild(this.hiddenInput); 424 | } 425 | } 426 | }, { 427 | key: "_appendListItems", 428 | value: function _appendListItems(countries, className, preferred) { 429 | // we create so many DOM elements, it is faster to build a temp string 430 | // and then add everything to the DOM in one go at the end 431 | var tmp = ""; 432 | // for each country 433 | for (var i = 0; i < countries.length; i++) { 434 | var c = countries[i]; 435 | var idSuffix = preferred ? "-preferred" : ""; 436 | // open the list item 437 | tmp += "
  • "); 438 | // add the flag 439 | tmp += "
    "); 440 | // and the country name and dial code 441 | tmp += "".concat(c.name, ""); 442 | tmp += "+".concat(c.dialCode, ""); 443 | // close the list item 444 | tmp += "
  • "; 445 | } 446 | this.countryList.insertAdjacentHTML("beforeend", tmp); 447 | } 448 | }, { 449 | key: "_setInitialState", 450 | value: function _setInitialState() { 451 | // fix firefox bug: when first load page (with input with value set to number with intl dial 452 | // code) and initialising plugin removes the dial code from the input, then refresh page, 453 | // and we try to init plugin again but this time on number without dial code so get grey flag 454 | var attributeValue = this.telInput.getAttribute("value"); 455 | var inputValue = this.telInput.value; 456 | var useAttribute = attributeValue && attributeValue.charAt(0) === "+" && (!inputValue || inputValue.charAt(0) !== "+"); 457 | var val = useAttribute ? attributeValue : inputValue; 458 | var dialCode = this._getDialCode(val); 459 | var isRegionlessNanp = this._isRegionlessNanp(val); 460 | var _this$options = this.options, initialCountry = _this$options.initialCountry, nationalMode = _this$options.nationalMode, autoHideDialCode = _this$options.autoHideDialCode, separateDialCode = _this$options.separateDialCode; 461 | // if we already have a dial code, and it's not a regionlessNanp, we can go ahead and set the 462 | // flag, else fall back to the default country 463 | if (dialCode && !isRegionlessNanp) { 464 | this._updateFlagFromNumber(val); 465 | } else if (initialCountry !== "auto") { 466 | // see if we should select a flag 467 | if (initialCountry) { 468 | this._setFlag(initialCountry.toLowerCase()); 469 | } else { 470 | if (dialCode && isRegionlessNanp) { 471 | // has intl dial code, is regionless nanp, and no initialCountry, so default to US 472 | this._setFlag("us"); 473 | } else { 474 | // no dial code and no initialCountry, so default to first in list 475 | this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2; 476 | if (!val) { 477 | this._setFlag(this.defaultCountry); 478 | } 479 | } 480 | } 481 | // if empty and no nationalMode and no autoHideDialCode then insert the default dial code 482 | if (!val && !nationalMode && !autoHideDialCode && !separateDialCode) { 483 | this.telInput.value = "+".concat(this.selectedCountryData.dialCode); 484 | } 485 | } 486 | // NOTE: if initialCountry is set to auto, that will be handled separately 487 | // format - note this wont be run after _updateDialCode as that's only called if no val 488 | if (val) this._updateValFromNumber(val); 489 | } 490 | }, { 491 | key: "_initListeners", 492 | value: function _initListeners() { 493 | this._initKeyListeners(); 494 | if (this.options.autoHideDialCode) this._initBlurListeners(); 495 | if (this.options.allowDropdown) this._initDropdownListeners(); 496 | if (this.hiddenInput) this._initHiddenInputListener(); 497 | } 498 | }, { 499 | key: "_initHiddenInputListener", 500 | value: function _initHiddenInputListener() { 501 | var _this3 = this; 502 | this._handleHiddenInputSubmit = function() { 503 | _this3.hiddenInput.value = _this3.getNumber(); 504 | }; 505 | if (this.telInput.form) this.telInput.form.addEventListener("submit", this._handleHiddenInputSubmit); 506 | } 507 | }, { 508 | key: "_getClosestLabel", 509 | value: function _getClosestLabel() { 510 | var el = this.telInput; 511 | while (el && el.tagName !== "LABEL") { 512 | el = el.parentNode; 513 | } 514 | return el; 515 | } 516 | }, { 517 | key: "_initDropdownListeners", 518 | value: function _initDropdownListeners() { 519 | var _this4 = this; 520 | // hack for input nested inside label (which is valid markup): clicking the selected-flag to 521 | // open the dropdown would then automatically trigger a 2nd click on the input which would 522 | // close it again 523 | this._handleLabelClick = function(e) { 524 | // if the dropdown is closed, then focus the input, else ignore the click 525 | if (_this4.countryList.classList.contains("iti__hide")) _this4.telInput.focus(); else e.preventDefault(); 526 | }; 527 | var label = this._getClosestLabel(); 528 | if (label) label.addEventListener("click", this._handleLabelClick); 529 | // toggle country dropdown on click 530 | this._handleClickSelectedFlag = function() { 531 | // only intercept this event if we're opening the dropdown 532 | // else let it bubble up to the top ("click-off-to-close" listener) 533 | // we cannot just stopPropagation as it may be needed to close another instance 534 | if (_this4.countryList.classList.contains("iti__hide") && !_this4.telInput.disabled && !_this4.telInput.readOnly) { 535 | _this4._showDropdown(); 536 | } 537 | }; 538 | this.selectedFlag.addEventListener("click", this._handleClickSelectedFlag); 539 | // open dropdown list if currently focused 540 | this._handleFlagsContainerKeydown = function(e) { 541 | var isDropdownHidden = _this4.countryList.classList.contains("iti__hide"); 542 | if (isDropdownHidden && [ "ArrowUp", "Up", "ArrowDown", "Down", " ", "Enter" ].indexOf(e.key) !== -1) { 543 | // prevent form from being submitted if "ENTER" was pressed 544 | e.preventDefault(); 545 | // prevent event from being handled again by document 546 | e.stopPropagation(); 547 | _this4._showDropdown(); 548 | } 549 | // allow navigation from dropdown to input on TAB 550 | if (e.key === "Tab") _this4._closeDropdown(); 551 | }; 552 | this.flagsContainer.addEventListener("keydown", this._handleFlagsContainerKeydown); 553 | } 554 | }, { 555 | key: "_initRequests", 556 | value: function _initRequests() { 557 | var _this5 = this; 558 | // if the user has specified the path to the utils script, fetch it on window.load, else resolve 559 | if (this.options.utilsScript && !window.intlTelInputUtils) { 560 | // if the plugin is being initialised after the window.load event has already been fired 561 | if (window.intlTelInputGlobals.documentReady()) { 562 | window.intlTelInputGlobals.loadUtils(this.options.utilsScript); 563 | } else { 564 | // wait until the load event so we don't block any other requests e.g. the flags image 565 | window.addEventListener("load", function() { 566 | window.intlTelInputGlobals.loadUtils(_this5.options.utilsScript); 567 | }); 568 | } 569 | } else this.resolveUtilsScriptPromise(); 570 | if (this.options.initialCountry === "auto") this._loadAutoCountry(); else this.resolveAutoCountryPromise(); 571 | } 572 | }, { 573 | key: "_loadAutoCountry", 574 | value: function _loadAutoCountry() { 575 | // 3 options: 576 | // 1) already loaded (we're done) 577 | // 2) not already started loading (start) 578 | // 3) already started loading (do nothing - just wait for loading callback to fire) 579 | if (window.intlTelInputGlobals.autoCountry) { 580 | this.handleAutoCountry(); 581 | } else if (!window.intlTelInputGlobals.startedLoadingAutoCountry) { 582 | // don't do this twice! 583 | window.intlTelInputGlobals.startedLoadingAutoCountry = true; 584 | if (typeof this.options.geoIpLookup === "function") { 585 | this.options.geoIpLookup(function(countryCode) { 586 | window.intlTelInputGlobals.autoCountry = countryCode.toLowerCase(); 587 | // tell all instances the auto country is ready 588 | // TODO: this should just be the current instances 589 | // UPDATE: use setTimeout in case their geoIpLookup function calls this callback straight 590 | // away (e.g. if they have already done the geo ip lookup somewhere else). Using 591 | // setTimeout means that the current thread of execution will finish before executing 592 | // this, which allows the plugin to finish initialising. 593 | setTimeout(function() { 594 | return forEachInstance("handleAutoCountry"); 595 | }); 596 | }, function() { 597 | return forEachInstance("rejectAutoCountryPromise"); 598 | }); 599 | } 600 | } 601 | } 602 | }, { 603 | key: "_initKeyListeners", 604 | value: function _initKeyListeners() { 605 | var _this6 = this; 606 | // update flag on keyup 607 | this._handleKeyupEvent = function() { 608 | if (_this6._updateFlagFromNumber(_this6.telInput.value)) { 609 | _this6._triggerCountryChange(); 610 | } 611 | }; 612 | this.telInput.addEventListener("keyup", this._handleKeyupEvent); 613 | // update flag on cut/paste events (now supported in all major browsers) 614 | this._handleClipboardEvent = function() { 615 | // hack because "paste" event is fired before input is updated 616 | setTimeout(_this6._handleKeyupEvent); 617 | }; 618 | this.telInput.addEventListener("cut", this._handleClipboardEvent); 619 | this.telInput.addEventListener("paste", this._handleClipboardEvent); 620 | } 621 | }, { 622 | key: "_cap", 623 | value: function _cap(number) { 624 | var max = this.telInput.getAttribute("maxlength"); 625 | return max && number.length > max ? number.substr(0, max) : number; 626 | } 627 | }, { 628 | key: "_initBlurListeners", 629 | value: function _initBlurListeners() { 630 | var _this7 = this; 631 | // on blur or form submit: if just a dial code then remove it 632 | this._handleSubmitOrBlurEvent = function() { 633 | _this7._removeEmptyDialCode(); 634 | }; 635 | if (this.telInput.form) this.telInput.form.addEventListener("submit", this._handleSubmitOrBlurEvent); 636 | this.telInput.addEventListener("blur", this._handleSubmitOrBlurEvent); 637 | } 638 | }, { 639 | key: "_removeEmptyDialCode", 640 | value: function _removeEmptyDialCode() { 641 | if (this.telInput.value.charAt(0) === "+") { 642 | var numeric = this._getNumeric(this.telInput.value); 643 | // if just a plus, or if just a dial code 644 | if (!numeric || this.selectedCountryData.dialCode === numeric) { 645 | this.telInput.value = ""; 646 | } 647 | } 648 | } 649 | }, { 650 | key: "_getNumeric", 651 | value: function _getNumeric(s) { 652 | return s.replace(/\D/g, ""); 653 | } 654 | }, { 655 | key: "_trigger", 656 | value: function _trigger(name) { 657 | // have to use old school document.createEvent as IE11 doesn't support `new Event()` syntax 658 | var e = document.createEvent("Event"); 659 | e.initEvent(name, true, true); 660 | // can bubble, and is cancellable 661 | this.telInput.dispatchEvent(e); 662 | } 663 | }, { 664 | key: "_showDropdown", 665 | value: function _showDropdown() { 666 | this.countryList.classList.remove("iti__hide"); 667 | this.selectedFlag.setAttribute("aria-expanded", "true"); 668 | this._setDropdownPosition(); 669 | // update highlighting and scroll to active list item 670 | if (this.activeItem) { 671 | this._highlightListItem(this.activeItem, false); 672 | this._scrollTo(this.activeItem, true); 673 | } 674 | // bind all the dropdown-related listeners: mouseover, click, click-off, keydown 675 | this._bindDropdownListeners(); 676 | // update the arrow 677 | this.dropdownArrow.classList.add("iti__arrow--up"); 678 | this._trigger("open:countrydropdown"); 679 | } 680 | }, { 681 | key: "_toggleClass", 682 | value: function _toggleClass(el, className, shouldHaveClass) { 683 | if (shouldHaveClass && !el.classList.contains(className)) el.classList.add(className); else if (!shouldHaveClass && el.classList.contains(className)) el.classList.remove(className); 684 | } 685 | }, { 686 | key: "_setDropdownPosition", 687 | value: function _setDropdownPosition() { 688 | var _this8 = this; 689 | if (this.options.dropdownContainer) { 690 | this.options.dropdownContainer.appendChild(this.dropdown); 691 | } 692 | if (!this.isMobile) { 693 | var pos = this.telInput.getBoundingClientRect(); 694 | // windowTop from https://stackoverflow.com/a/14384091/217866 695 | var windowTop = window.pageYOffset || document.documentElement.scrollTop; 696 | var inputTop = pos.top + windowTop; 697 | var dropdownHeight = this.countryList.offsetHeight; 698 | // dropdownFitsBelow = (dropdownBottom < windowBottom) 699 | var dropdownFitsBelow = inputTop + this.telInput.offsetHeight + dropdownHeight < windowTop + window.innerHeight; 700 | var dropdownFitsAbove = inputTop - dropdownHeight > windowTop; 701 | // by default, the dropdown will be below the input. If we want to position it above the 702 | // input, we add the dropup class. 703 | this._toggleClass(this.countryList, "iti__country-list--dropup", !dropdownFitsBelow && dropdownFitsAbove); 704 | // if dropdownContainer is enabled, calculate postion 705 | if (this.options.dropdownContainer) { 706 | // by default the dropdown will be directly over the input because it's not in the flow. 707 | // If we want to position it below, we need to add some extra top value. 708 | var extraTop = !dropdownFitsBelow && dropdownFitsAbove ? 0 : this.telInput.offsetHeight; 709 | // calculate placement 710 | this.dropdown.style.top = "".concat(inputTop + extraTop, "px"); 711 | this.dropdown.style.left = "".concat(pos.left + document.body.scrollLeft, "px"); 712 | // close menu on window scroll 713 | this._handleWindowScroll = function() { 714 | return _this8._closeDropdown(); 715 | }; 716 | window.addEventListener("scroll", this._handleWindowScroll); 717 | } 718 | } 719 | } 720 | }, { 721 | key: "_getClosestListItem", 722 | value: function _getClosestListItem(target) { 723 | var el = target; 724 | while (el && el !== this.countryList && !el.classList.contains("iti__country")) { 725 | el = el.parentNode; 726 | } 727 | // if we reached the countryList element, then return null 728 | return el === this.countryList ? null : el; 729 | } 730 | }, { 731 | key: "_bindDropdownListeners", 732 | value: function _bindDropdownListeners() { 733 | var _this9 = this; 734 | // when mouse over a list item, just highlight that one 735 | // we add the class "highlight", so if they hit "enter" we know which one to select 736 | this._handleMouseoverCountryList = function(e) { 737 | // handle event delegation, as we're listening for this event on the countryList 738 | var listItem = _this9._getClosestListItem(e.target); 739 | if (listItem) _this9._highlightListItem(listItem, false); 740 | }; 741 | this.countryList.addEventListener("mouseover", this._handleMouseoverCountryList); 742 | // listen for country selection 743 | this._handleClickCountryList = function(e) { 744 | var listItem = _this9._getClosestListItem(e.target); 745 | if (listItem) _this9._selectListItem(listItem); 746 | }; 747 | this.countryList.addEventListener("click", this._handleClickCountryList); 748 | // click off to close 749 | // (except when this initial opening click is bubbling up) 750 | // we cannot just stopPropagation as it may be needed to close another instance 751 | var isOpening = true; 752 | this._handleClickOffToClose = function() { 753 | if (!isOpening) _this9._closeDropdown(); 754 | isOpening = false; 755 | }; 756 | document.documentElement.addEventListener("click", this._handleClickOffToClose); 757 | // listen for up/down scrolling, enter to select, or letters to jump to country name. 758 | // use keydown as keypress doesn't fire for non-char keys and we want to catch if they 759 | // just hit down and hold it to scroll down (no keyup event). 760 | // listen on the document because that's where key events are triggered if no input has focus 761 | var query = ""; 762 | var queryTimer = null; 763 | this._handleKeydownOnDropdown = function(e) { 764 | // prevent down key from scrolling the whole page, 765 | // and enter key from submitting a form etc 766 | e.preventDefault(); 767 | // up and down to navigate 768 | if (e.key === "ArrowUp" || e.key === "Up" || e.key === "ArrowDown" || e.key === "Down") _this9._handleUpDownKey(e.key); else if (e.key === "Enter") _this9._handleEnterKey(); else if (e.key === "Escape") _this9._closeDropdown(); else if (/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(e.key)) { 769 | // jump to countries that start with the query string 770 | if (queryTimer) clearTimeout(queryTimer); 771 | query += e.key.toLowerCase(); 772 | _this9._searchForCountry(query); 773 | // if the timer hits 1 second, reset the query 774 | queryTimer = setTimeout(function() { 775 | query = ""; 776 | }, 1e3); 777 | } 778 | }; 779 | document.addEventListener("keydown", this._handleKeydownOnDropdown); 780 | } 781 | }, { 782 | key: "_handleUpDownKey", 783 | value: function _handleUpDownKey(key) { 784 | var next = key === "ArrowUp" || key === "Up" ? this.highlightedItem.previousElementSibling : this.highlightedItem.nextElementSibling; 785 | if (next) { 786 | // skip the divider 787 | if (next.classList.contains("iti__divider")) { 788 | next = key === "ArrowUp" || key === "Up" ? next.previousElementSibling : next.nextElementSibling; 789 | } 790 | this._highlightListItem(next, true); 791 | } 792 | } 793 | }, { 794 | key: "_handleEnterKey", 795 | value: function _handleEnterKey() { 796 | if (this.highlightedItem) this._selectListItem(this.highlightedItem); 797 | } 798 | }, { 799 | key: "_searchForCountry", 800 | value: function _searchForCountry(query) { 801 | for (var i = 0; i < this.countries.length; i++) { 802 | if (this._startsWith(this.countries[i].name, query)) { 803 | var listItem = this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(this.countries[i].iso2)); 804 | // update highlighting and scroll 805 | this._highlightListItem(listItem, false); 806 | this._scrollTo(listItem, true); 807 | break; 808 | } 809 | } 810 | } 811 | }, { 812 | key: "_startsWith", 813 | value: function _startsWith(a, b) { 814 | return a.substr(0, b.length).toLowerCase() === b; 815 | } 816 | }, { 817 | key: "_updateValFromNumber", 818 | value: function _updateValFromNumber(originalNumber) { 819 | var number = originalNumber; 820 | if (this.options.formatOnDisplay && window.intlTelInputUtils && this.selectedCountryData) { 821 | var useNational = !this.options.separateDialCode && (this.options.nationalMode || number.charAt(0) !== "+"); 822 | var _intlTelInputUtils$nu = intlTelInputUtils.numberFormat, NATIONAL = _intlTelInputUtils$nu.NATIONAL, INTERNATIONAL = _intlTelInputUtils$nu.INTERNATIONAL; 823 | var format = useNational ? NATIONAL : INTERNATIONAL; 824 | number = intlTelInputUtils.formatNumber(number, this.selectedCountryData.iso2, format); 825 | } 826 | number = this._beforeSetNumber(number); 827 | this.telInput.value = number; 828 | } 829 | }, { 830 | key: "_updateFlagFromNumber", 831 | value: function _updateFlagFromNumber(originalNumber) { 832 | // if we're in nationalMode and we already have US/Canada selected, make sure the number starts 833 | // with a +1 so _getDialCode will be able to extract the area code 834 | // update: if we dont yet have selectedCountryData, but we're here (trying to update the flag 835 | // from the number), that means we're initialising the plugin with a number that already has a 836 | // dial code, so fine to ignore this bit 837 | var number = originalNumber; 838 | var selectedDialCode = this.selectedCountryData.dialCode; 839 | var isNanp = selectedDialCode === "1"; 840 | if (number && this.options.nationalMode && isNanp && number.charAt(0) !== "+") { 841 | if (number.charAt(0) !== "1") number = "1".concat(number); 842 | number = "+".concat(number); 843 | } 844 | // update flag if user types area code for another country 845 | if (this.options.separateDialCode && selectedDialCode && number.charAt(0) !== "+") { 846 | number = "+".concat(selectedDialCode).concat(number); 847 | } 848 | // try and extract valid dial code from input 849 | var dialCode = this._getDialCode(number, true); 850 | var numeric = this._getNumeric(number); 851 | var countryCode = null; 852 | if (dialCode) { 853 | var countryCodes = this.countryCodes[this._getNumeric(dialCode)]; 854 | // check if the right country is already selected. this should be false if the number is 855 | // longer than the matched dial code because in this case we need to make sure that if 856 | // there are multiple country matches, that the first one is selected (note: we could 857 | // just check that here, but it requires the same loop that we already have later) 858 | var alreadySelected = countryCodes.indexOf(this.selectedCountryData.iso2) !== -1 && numeric.length <= dialCode.length - 1; 859 | var isRegionlessNanpNumber = selectedDialCode === "1" && this._isRegionlessNanp(numeric); 860 | // only update the flag if: 861 | // A) NOT (we currently have a NANP flag selected, and the number is a regionlessNanp) 862 | // AND 863 | // B) the right country is not already selected 864 | if (!isRegionlessNanpNumber && !alreadySelected) { 865 | // if using onlyCountries option, countryCodes[0] may be empty, so we must find the first 866 | // non-empty index 867 | for (var j = 0; j < countryCodes.length; j++) { 868 | if (countryCodes[j]) { 869 | countryCode = countryCodes[j]; 870 | break; 871 | } 872 | } 873 | } 874 | } else if (number.charAt(0) === "+" && numeric.length) { 875 | // invalid dial code, so empty 876 | // Note: use getNumeric here because the number has not been formatted yet, so could contain 877 | // bad chars 878 | countryCode = ""; 879 | } else if (!number || number === "+") { 880 | // empty, or just a plus, so default 881 | countryCode = this.defaultCountry; 882 | } 883 | if (countryCode !== null) { 884 | return this._setFlag(countryCode); 885 | } 886 | return false; 887 | } 888 | }, { 889 | key: "_isRegionlessNanp", 890 | value: function _isRegionlessNanp(number) { 891 | var numeric = this._getNumeric(number); 892 | if (numeric.charAt(0) === "1") { 893 | var areaCode = numeric.substr(1, 3); 894 | return regionlessNanpNumbers.indexOf(areaCode) !== -1; 895 | } 896 | return false; 897 | } 898 | }, { 899 | key: "_highlightListItem", 900 | value: function _highlightListItem(listItem, shouldFocus) { 901 | var prevItem = this.highlightedItem; 902 | if (prevItem) prevItem.classList.remove("iti__highlight"); 903 | this.highlightedItem = listItem; 904 | this.highlightedItem.classList.add("iti__highlight"); 905 | if (shouldFocus) this.highlightedItem.focus(); 906 | } 907 | }, { 908 | key: "_getCountryData", 909 | value: function _getCountryData(countryCode, ignoreOnlyCountriesOption, allowFail) { 910 | var countryList = ignoreOnlyCountriesOption ? allCountries : this.countries; 911 | for (var i = 0; i < countryList.length; i++) { 912 | if (countryList[i].iso2 === countryCode) { 913 | return countryList[i]; 914 | } 915 | } 916 | if (allowFail) { 917 | return null; 918 | } 919 | throw new Error("No country data for '".concat(countryCode, "'")); 920 | } 921 | }, { 922 | key: "_setFlag", 923 | value: function _setFlag(countryCode) { 924 | var prevCountry = this.selectedCountryData.iso2 ? this.selectedCountryData : {}; 925 | // do this first as it will throw an error and stop if countryCode is invalid 926 | this.selectedCountryData = countryCode ? this._getCountryData(countryCode, false, false) : {}; 927 | // update the defaultCountry - we only need the iso2 from now on, so just store that 928 | if (this.selectedCountryData.iso2) { 929 | this.defaultCountry = this.selectedCountryData.iso2; 930 | } 931 | this.selectedFlagInner.setAttribute("class", "iti__flag iti__".concat(countryCode)); 932 | // update the selected country's title attribute 933 | var title = countryCode ? "".concat(this.selectedCountryData.name, ": +").concat(this.selectedCountryData.dialCode) : "Unknown"; 934 | this.selectedFlag.setAttribute("title", title); 935 | if (this.options.separateDialCode) { 936 | var dialCode = this.selectedCountryData.dialCode ? "+".concat(this.selectedCountryData.dialCode) : ""; 937 | this.selectedDialCode.innerHTML = dialCode; 938 | // offsetWidth is zero if input is in a hidden container during initialisation 939 | var selectedFlagWidth = this.selectedFlag.offsetWidth || this._getHiddenSelectedFlagWidth(); 940 | // add 6px of padding after the grey selected-dial-code box, as this is what we use in the css 941 | this.telInput.style.paddingLeft = "".concat(selectedFlagWidth + 6, "px"); 942 | } 943 | // and the input's placeholder 944 | this._updatePlaceholder(); 945 | // update the active list item 946 | if (this.options.allowDropdown) { 947 | var prevItem = this.activeItem; 948 | if (prevItem) { 949 | prevItem.classList.remove("iti__active"); 950 | prevItem.setAttribute("aria-selected", "false"); 951 | } 952 | if (countryCode) { 953 | // check if there is a preferred item first, else fall back to standard 954 | var nextItem = this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(countryCode, "-preferred")) || this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(countryCode)); 955 | nextItem.setAttribute("aria-selected", "true"); 956 | nextItem.classList.add("iti__active"); 957 | this.activeItem = nextItem; 958 | this.selectedFlag.setAttribute("aria-activedescendant", nextItem.getAttribute("id")); 959 | } 960 | } 961 | // return if the flag has changed or not 962 | return prevCountry.iso2 !== countryCode; 963 | } 964 | }, { 965 | key: "_getHiddenSelectedFlagWidth", 966 | value: function _getHiddenSelectedFlagWidth() { 967 | // to get the right styling to apply, all we need is a shallow clone of the container, 968 | // and then to inject a deep clone of the selectedFlag element 969 | var containerClone = this.telInput.parentNode.cloneNode(); 970 | containerClone.style.visibility = "hidden"; 971 | document.body.appendChild(containerClone); 972 | var flagsContainerClone = this.flagsContainer.cloneNode(); 973 | containerClone.appendChild(flagsContainerClone); 974 | var selectedFlagClone = this.selectedFlag.cloneNode(true); 975 | flagsContainerClone.appendChild(selectedFlagClone); 976 | var width = selectedFlagClone.offsetWidth; 977 | containerClone.parentNode.removeChild(containerClone); 978 | return width; 979 | } 980 | }, { 981 | key: "_updatePlaceholder", 982 | value: function _updatePlaceholder() { 983 | var shouldSetPlaceholder = this.options.autoPlaceholder === "aggressive" || !this.hadInitialPlaceholder && this.options.autoPlaceholder === "polite"; 984 | if (window.intlTelInputUtils && shouldSetPlaceholder) { 985 | var numberType = intlTelInputUtils.numberType[this.options.placeholderNumberType]; 986 | var placeholder = this.selectedCountryData.iso2 ? intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2, this.options.nationalMode, numberType) : ""; 987 | placeholder = this._beforeSetNumber(placeholder); 988 | if (typeof this.options.customPlaceholder === "function") { 989 | placeholder = this.options.customPlaceholder(placeholder, this.selectedCountryData); 990 | } 991 | this.telInput.setAttribute("placeholder", placeholder); 992 | } 993 | } 994 | }, { 995 | key: "_selectListItem", 996 | value: function _selectListItem(listItem) { 997 | // update selected flag and active list item 998 | var flagChanged = this._setFlag(listItem.getAttribute("data-country-code")); 999 | this._closeDropdown(); 1000 | this._updateDialCode(listItem.getAttribute("data-dial-code"), true); 1001 | // focus the input 1002 | this.telInput.focus(); 1003 | // put cursor at end - this fix is required for FF and IE11 (with nationalMode=false i.e. auto 1004 | // inserting dial code), who try to put the cursor at the beginning the first time 1005 | var len = this.telInput.value.length; 1006 | this.telInput.setSelectionRange(len, len); 1007 | if (flagChanged) { 1008 | this._triggerCountryChange(); 1009 | } 1010 | } 1011 | }, { 1012 | key: "_closeDropdown", 1013 | value: function _closeDropdown() { 1014 | this.countryList.classList.add("iti__hide"); 1015 | this.selectedFlag.setAttribute("aria-expanded", "false"); 1016 | // update the arrow 1017 | this.dropdownArrow.classList.remove("iti__arrow--up"); 1018 | // unbind key events 1019 | document.removeEventListener("keydown", this._handleKeydownOnDropdown); 1020 | document.documentElement.removeEventListener("click", this._handleClickOffToClose); 1021 | this.countryList.removeEventListener("mouseover", this._handleMouseoverCountryList); 1022 | this.countryList.removeEventListener("click", this._handleClickCountryList); 1023 | // remove menu from container 1024 | if (this.options.dropdownContainer) { 1025 | if (!this.isMobile) window.removeEventListener("scroll", this._handleWindowScroll); 1026 | if (this.dropdown.parentNode) this.dropdown.parentNode.removeChild(this.dropdown); 1027 | } 1028 | this._trigger("close:countrydropdown"); 1029 | } 1030 | }, { 1031 | key: "_scrollTo", 1032 | value: function _scrollTo(element, middle) { 1033 | var container = this.countryList; 1034 | // windowTop from https://stackoverflow.com/a/14384091/217866 1035 | var windowTop = window.pageYOffset || document.documentElement.scrollTop; 1036 | var containerHeight = container.offsetHeight; 1037 | var containerTop = container.getBoundingClientRect().top + windowTop; 1038 | var containerBottom = containerTop + containerHeight; 1039 | var elementHeight = element.offsetHeight; 1040 | var elementTop = element.getBoundingClientRect().top + windowTop; 1041 | var elementBottom = elementTop + elementHeight; 1042 | var newScrollTop = elementTop - containerTop + container.scrollTop; 1043 | var middleOffset = containerHeight / 2 - elementHeight / 2; 1044 | if (elementTop < containerTop) { 1045 | // scroll up 1046 | if (middle) newScrollTop -= middleOffset; 1047 | container.scrollTop = newScrollTop; 1048 | } else if (elementBottom > containerBottom) { 1049 | // scroll down 1050 | if (middle) newScrollTop += middleOffset; 1051 | var heightDifference = containerHeight - elementHeight; 1052 | container.scrollTop = newScrollTop - heightDifference; 1053 | } 1054 | } 1055 | }, { 1056 | key: "_updateDialCode", 1057 | value: function _updateDialCode(newDialCodeBare, hasSelectedListItem) { 1058 | var inputVal = this.telInput.value; 1059 | // save having to pass this every time 1060 | var newDialCode = "+".concat(newDialCodeBare); 1061 | var newNumber; 1062 | if (inputVal.charAt(0) === "+") { 1063 | // there's a plus so we're dealing with a replacement (doesn't matter if nationalMode or not) 1064 | var prevDialCode = this._getDialCode(inputVal); 1065 | if (prevDialCode) { 1066 | // current number contains a valid dial code, so replace it 1067 | newNumber = inputVal.replace(prevDialCode, newDialCode); 1068 | } else { 1069 | // current number contains an invalid dial code, so ditch it 1070 | // (no way to determine where the invalid dial code ends and the rest of the number begins) 1071 | newNumber = newDialCode; 1072 | } 1073 | } else if (this.options.nationalMode || this.options.separateDialCode) { 1074 | // don't do anything 1075 | return; 1076 | } else { 1077 | // nationalMode is disabled 1078 | if (inputVal) { 1079 | // there is an existing value with no dial code: prefix the new dial code 1080 | newNumber = newDialCode + inputVal; 1081 | } else if (hasSelectedListItem || !this.options.autoHideDialCode) { 1082 | // no existing value and either they've just selected a list item, or autoHideDialCode is 1083 | // disabled: insert new dial code 1084 | newNumber = newDialCode; 1085 | } else { 1086 | return; 1087 | } 1088 | } 1089 | this.telInput.value = newNumber; 1090 | } 1091 | }, { 1092 | key: "_getDialCode", 1093 | value: function _getDialCode(number, includeAreaCode) { 1094 | var dialCode = ""; 1095 | // only interested in international numbers (starting with a plus) 1096 | if (number.charAt(0) === "+") { 1097 | var numericChars = ""; 1098 | // iterate over chars 1099 | for (var i = 0; i < number.length; i++) { 1100 | var c = number.charAt(i); 1101 | // if char is number (https://stackoverflow.com/a/8935649/217866) 1102 | if (!isNaN(parseInt(c, 10))) { 1103 | numericChars += c; 1104 | // if current numericChars make a valid dial code 1105 | if (includeAreaCode) { 1106 | if (this.countryCodes[numericChars]) { 1107 | // store the actual raw string (useful for matching later) 1108 | dialCode = number.substr(0, i + 1); 1109 | } 1110 | } else { 1111 | if (this.dialCodes[numericChars]) { 1112 | dialCode = number.substr(0, i + 1); 1113 | // if we're just looking for a dial code, we can break as soon as we find one 1114 | break; 1115 | } 1116 | } 1117 | // stop searching as soon as we can - in this case when we hit max len 1118 | if (numericChars.length === this.countryCodeMaxLen) { 1119 | break; 1120 | } 1121 | } 1122 | } 1123 | } 1124 | return dialCode; 1125 | } 1126 | }, { 1127 | key: "_getFullNumber", 1128 | value: function _getFullNumber() { 1129 | var val = this.telInput.value.trim(); 1130 | var dialCode = this.selectedCountryData.dialCode; 1131 | var prefix; 1132 | var numericVal = this._getNumeric(val); 1133 | if (this.options.separateDialCode && val.charAt(0) !== "+" && dialCode && numericVal) { 1134 | // when using separateDialCode, it is visible so is effectively part of the typed number 1135 | prefix = "+".concat(dialCode); 1136 | } else { 1137 | prefix = ""; 1138 | } 1139 | return prefix + val; 1140 | } 1141 | }, { 1142 | key: "_beforeSetNumber", 1143 | value: function _beforeSetNumber(originalNumber) { 1144 | var number = originalNumber; 1145 | if (this.options.separateDialCode) { 1146 | var dialCode = this._getDialCode(number); 1147 | // if there is a valid dial code 1148 | if (dialCode) { 1149 | // in case _getDialCode returned an area code as well 1150 | dialCode = "+".concat(this.selectedCountryData.dialCode); 1151 | // a lot of numbers will have a space separating the dial code and the main number, and 1152 | // some NANP numbers will have a hyphen e.g. +1 684-733-1234 - in both cases we want to get 1153 | // rid of it 1154 | // NOTE: don't just trim all non-numerics as may want to preserve an open parenthesis etc 1155 | var start = number[dialCode.length] === " " || number[dialCode.length] === "-" ? dialCode.length + 1 : dialCode.length; 1156 | number = number.substr(start); 1157 | } 1158 | } 1159 | return this._cap(number); 1160 | } 1161 | }, { 1162 | key: "_triggerCountryChange", 1163 | value: function _triggerCountryChange() { 1164 | this._trigger("countrychange"); 1165 | } 1166 | }, { 1167 | key: "handleAutoCountry", 1168 | value: function handleAutoCountry() { 1169 | if (this.options.initialCountry === "auto") { 1170 | // we must set this even if there is an initial val in the input: in case the initial val is 1171 | // invalid and they delete it - they should see their auto country 1172 | this.defaultCountry = window.intlTelInputGlobals.autoCountry; 1173 | // if there's no initial value in the input, then update the flag 1174 | if (!this.telInput.value) { 1175 | this.setCountry(this.defaultCountry); 1176 | } 1177 | this.resolveAutoCountryPromise(); 1178 | } 1179 | } 1180 | }, { 1181 | key: "handleUtils", 1182 | value: function handleUtils() { 1183 | // if the request was successful 1184 | if (window.intlTelInputUtils) { 1185 | // if there's an initial value in the input, then format it 1186 | if (this.telInput.value) { 1187 | this._updateValFromNumber(this.telInput.value); 1188 | } 1189 | this._updatePlaceholder(); 1190 | } 1191 | this.resolveUtilsScriptPromise(); 1192 | } 1193 | }, { 1194 | key: "destroy", 1195 | value: function destroy() { 1196 | var form = this.telInput.form; 1197 | if (this.options.allowDropdown) { 1198 | // make sure the dropdown is closed (and unbind listeners) 1199 | this._closeDropdown(); 1200 | this.selectedFlag.removeEventListener("click", this._handleClickSelectedFlag); 1201 | this.flagsContainer.removeEventListener("keydown", this._handleFlagsContainerKeydown); 1202 | // label click hack 1203 | var label = this._getClosestLabel(); 1204 | if (label) label.removeEventListener("click", this._handleLabelClick); 1205 | } 1206 | // unbind hiddenInput listeners 1207 | if (this.hiddenInput && form) form.removeEventListener("submit", this._handleHiddenInputSubmit); 1208 | // unbind autoHideDialCode listeners 1209 | if (this.options.autoHideDialCode) { 1210 | if (form) form.removeEventListener("submit", this._handleSubmitOrBlurEvent); 1211 | this.telInput.removeEventListener("blur", this._handleSubmitOrBlurEvent); 1212 | } 1213 | // unbind key events, and cut/paste events 1214 | this.telInput.removeEventListener("keyup", this._handleKeyupEvent); 1215 | this.telInput.removeEventListener("cut", this._handleClipboardEvent); 1216 | this.telInput.removeEventListener("paste", this._handleClipboardEvent); 1217 | // remove attribute of id instance: data-intl-tel-input-id 1218 | this.telInput.removeAttribute("data-intl-tel-input-id"); 1219 | // remove markup (but leave the original input) 1220 | var wrapper = this.telInput.parentNode; 1221 | wrapper.parentNode.insertBefore(this.telInput, wrapper); 1222 | wrapper.parentNode.removeChild(wrapper); 1223 | delete window.intlTelInputGlobals.instances[this.id]; 1224 | } 1225 | }, { 1226 | key: "getExtension", 1227 | value: function getExtension() { 1228 | if (window.intlTelInputUtils) { 1229 | return intlTelInputUtils.getExtension(this._getFullNumber(), this.selectedCountryData.iso2); 1230 | } 1231 | return ""; 1232 | } 1233 | }, { 1234 | key: "getNumber", 1235 | value: function getNumber(format) { 1236 | if (window.intlTelInputUtils) { 1237 | var iso2 = this.selectedCountryData.iso2; 1238 | return intlTelInputUtils.formatNumber(this._getFullNumber(), iso2, format); 1239 | } 1240 | return ""; 1241 | } 1242 | }, { 1243 | key: "getNumberType", 1244 | value: function getNumberType() { 1245 | if (window.intlTelInputUtils) { 1246 | return intlTelInputUtils.getNumberType(this._getFullNumber(), this.selectedCountryData.iso2); 1247 | } 1248 | return -99; 1249 | } 1250 | }, { 1251 | key: "getSelectedCountryData", 1252 | value: function getSelectedCountryData() { 1253 | return this.selectedCountryData; 1254 | } 1255 | }, { 1256 | key: "getValidationError", 1257 | value: function getValidationError() { 1258 | if (window.intlTelInputUtils) { 1259 | var iso2 = this.selectedCountryData.iso2; 1260 | return intlTelInputUtils.getValidationError(this._getFullNumber(), iso2); 1261 | } 1262 | return -99; 1263 | } 1264 | }, { 1265 | key: "isValidNumber", 1266 | value: function isValidNumber() { 1267 | var val = this._getFullNumber().trim(); 1268 | var countryCode = this.options.nationalMode ? this.selectedCountryData.iso2 : ""; 1269 | return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(val, countryCode) : null; 1270 | } 1271 | }, { 1272 | key: "setCountry", 1273 | value: function setCountry(originalCountryCode) { 1274 | var countryCode = originalCountryCode.toLowerCase(); 1275 | // check if already selected 1276 | if (!this.selectedFlagInner.classList.contains("iti__".concat(countryCode))) { 1277 | this._setFlag(countryCode); 1278 | this._updateDialCode(this.selectedCountryData.dialCode, false); 1279 | this._triggerCountryChange(); 1280 | } 1281 | } 1282 | }, { 1283 | key: "setNumber", 1284 | value: function setNumber(number) { 1285 | // we must update the flag first, which updates this.selectedCountryData, which is used for 1286 | // formatting the number before displaying it 1287 | var flagChanged = this._updateFlagFromNumber(number); 1288 | this._updateValFromNumber(number); 1289 | if (flagChanged) { 1290 | this._triggerCountryChange(); 1291 | } 1292 | } 1293 | }, { 1294 | key: "setPlaceholderNumberType", 1295 | value: function setPlaceholderNumberType(type) { 1296 | this.options.placeholderNumberType = type; 1297 | this._updatePlaceholder(); 1298 | } 1299 | } ]); 1300 | return Iti; 1301 | }(); 1302 | /******************** 1303 | * STATIC METHODS 1304 | ********************/ 1305 | // get the country data object 1306 | intlTelInputGlobals.getCountryData = function() { 1307 | return allCountries; 1308 | }; 1309 | // inject a