intl-tel-input 25.4.7 → 25.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/angular/build/IntlTelInput.cjs +9 -9
- package/angular/build/IntlTelInput.d.ts +1 -1
- package/angular/build/IntlTelInput.js +9 -9
- package/angular/build/IntlTelInputWithUtils.cjs +9 -9
- package/angular/build/IntlTelInputWithUtils.js +9 -9
- package/angular/build/intl-tel-input/angular.js +205 -0
- package/angular/build/intl-tel-input/angularWithUtils.js +206 -0
- package/angular/build/intl-tel-input/data.js +1096 -0
- package/angular/build/intl-tel-input/i18n/ar/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/ar/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/ar/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/bg/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/bg/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/bg/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/bn/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/bn/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/bn/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/bs/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/bs/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/bs/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/ca/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/ca/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/ca/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/cs/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/cs/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/cs/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/da/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/da/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/da/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/de/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/de/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/de/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/ee/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/ee/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/ee/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/el/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/el/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/el/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/en/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/en/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/en/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/es/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/es/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/es/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/fa/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/fa/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/fa/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/fi/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/fi/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/fi/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/fr/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/fr/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/fr/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/hi/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/hi/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/hi/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/hr/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/hr/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/hr/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/hu/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/hu/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/hu/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/id/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/id/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/id/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/index.js +40 -0
- package/angular/build/intl-tel-input/i18n/it/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/it/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/it/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/ja/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/ja/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/ja/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/ko/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/ko/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/ko/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/mr/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/mr/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/mr/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/nl/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/nl/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/nl/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/no/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/no/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/no/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/pl/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/pl/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/pl/interface.js +24 -0
- package/angular/build/intl-tel-input/i18n/pt/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/pt/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/pt/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/ro/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/ro/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/ro/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/ru/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/ru/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/ru/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/sk/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/sk/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/sk/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/sv/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/sv/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/sv/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/te/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/te/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/te/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/th/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/th/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/th/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/tr/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/tr/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/tr/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/types.js +1 -0
- package/angular/build/intl-tel-input/i18n/uk/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/uk/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/uk/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/ur/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/ur/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/ur/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/uz/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/uz/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/uz/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/vi/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/vi/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/vi/interface.js +13 -0
- package/angular/build/intl-tel-input/i18n/zh/countries.js +245 -0
- package/angular/build/intl-tel-input/i18n/zh/index.js +5 -0
- package/angular/build/intl-tel-input/i18n/zh/interface.js +13 -0
- package/angular/build/intl-tel-input/intlTelInputWithUtils.js +4 -0
- package/angular/build/intl-tel-input/utils.js +1341 -0
- package/angular/build/intl-tel-input.js +1812 -0
- package/angular/build/types/intl-tel-input/angular.d.ts +40 -0
- package/angular/build/types/intl-tel-input/angularWithUtils.d.ts +40 -0
- package/angular/build/types/intl-tel-input/data.d.ts +11 -0
- package/angular/build/types/intl-tel-input/i18n/ar/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/ar/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/ar/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/bg/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/bg/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/bg/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/bn/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/bn/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/bn/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/bs/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/bs/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/bs/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/ca/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/ca/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/ca/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/cs/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/cs/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/cs/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/da/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/da/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/da/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/de/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/de/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/de/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/ee/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/ee/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/ee/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/el/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/el/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/el/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/en/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/en/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/en/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/es/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/es/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/es/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/fa/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/fa/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/fa/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/fi/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/fi/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/fi/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/fr/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/fr/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/fr/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/hi/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/hi/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/hi/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/hr/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/hr/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/hr/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/hu/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/hu/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/hu/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/id/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/id/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/id/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/index.d.ts +39 -0
- package/angular/build/types/intl-tel-input/i18n/it/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/it/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/it/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/ja/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/ja/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/ja/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/ko/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/ko/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/ko/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/mr/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/mr/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/mr/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/nl/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/nl/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/nl/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/no/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/no/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/no/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/pl/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/pl/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/pl/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/pt/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/pt/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/pt/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/ro/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/ro/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/ro/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/ru/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/ru/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/ru/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/sk/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/sk/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/sk/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/sv/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/sv/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/sv/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/te/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/te/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/te/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/th/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/th/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/th/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/tr/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/tr/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/tr/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/types.d.ts +254 -0
- package/angular/build/types/intl-tel-input/i18n/uk/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/uk/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/uk/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/ur/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/ur/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/ur/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/uz/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/uz/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/uz/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/vi/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/vi/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/vi/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/zh/countries.d.ts +3 -0
- package/angular/build/types/intl-tel-input/i18n/zh/index.d.ts +6 -0
- package/angular/build/types/intl-tel-input/i18n/zh/interface.d.ts +3 -0
- package/angular/build/types/intl-tel-input/intlTelInputWithUtils.d.ts +2 -0
- package/angular/build/types/intl-tel-input/utils.d.ts +2 -0
- package/angular/build/types/intl-tel-input.d.ts +199 -0
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.d.ts +1 -1
- package/build/js/intlTelInput.js +46 -17
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +46 -17
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/package.json +5 -7
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +45 -16
- package/react/build/IntlTelInput.d.ts +1 -1
- package/react/build/IntlTelInput.js +45 -16
- package/react/build/IntlTelInputWithUtils.cjs +45 -16
- package/react/build/IntlTelInputWithUtils.js +45 -16
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +160 -153
- package/vue/build/IntlTelInputWithUtils.mjs +543 -536
|
@@ -1323,9 +1323,9 @@ const N = [
|
|
|
1323
1323
|
"263"
|
|
1324
1324
|
]
|
|
1325
1325
|
], I = [];
|
|
1326
|
-
for (let
|
|
1327
|
-
const t = N[
|
|
1328
|
-
I[
|
|
1326
|
+
for (let h = 0; h < N.length; h++) {
|
|
1327
|
+
const t = N[h];
|
|
1328
|
+
I[h] = {
|
|
1329
1329
|
name: "",
|
|
1330
1330
|
// this is now populated in the plugin
|
|
1331
1331
|
iso2: t[0],
|
|
@@ -1591,8 +1591,8 @@ const j = {
|
|
|
1591
1591
|
ac: "Ascension Island",
|
|
1592
1592
|
xk: "Kosovo"
|
|
1593
1593
|
}, k = { ...j, ...$ };
|
|
1594
|
-
for (let
|
|
1595
|
-
I[
|
|
1594
|
+
for (let h = 0; h < I.length; h++)
|
|
1595
|
+
I[h].name = k[I[h].iso2];
|
|
1596
1596
|
let U = 0;
|
|
1597
1597
|
const T = {
|
|
1598
1598
|
//* Whether or not to allow the dropdown.
|
|
@@ -1667,32 +1667,32 @@ const T = {
|
|
|
1667
1667
|
"887",
|
|
1668
1668
|
"888",
|
|
1669
1669
|
"889"
|
|
1670
|
-
], v = (
|
|
1671
|
-
const t = v(
|
|
1670
|
+
], v = (h) => h.replace(/\D/g, ""), A = (h = "") => h.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), S = (h) => {
|
|
1671
|
+
const t = v(h);
|
|
1672
1672
|
if (t.charAt(0) === "1") {
|
|
1673
1673
|
const e = t.substr(1, 3);
|
|
1674
1674
|
return H.includes(e);
|
|
1675
1675
|
}
|
|
1676
1676
|
return !1;
|
|
1677
|
-
}, K = (
|
|
1677
|
+
}, K = (h, t, e, i) => {
|
|
1678
1678
|
if (e === 0 && !i)
|
|
1679
1679
|
return 0;
|
|
1680
1680
|
let s = 0;
|
|
1681
1681
|
for (let n = 0; n < t.length; n++) {
|
|
1682
|
-
if (/[+0-9]/.test(t[n]) && s++, s ===
|
|
1682
|
+
if (/[+0-9]/.test(t[n]) && s++, s === h && !i)
|
|
1683
1683
|
return n + 1;
|
|
1684
|
-
if (i && s ===
|
|
1684
|
+
if (i && s === h + 1)
|
|
1685
1685
|
return n;
|
|
1686
1686
|
}
|
|
1687
1687
|
return t.length;
|
|
1688
|
-
},
|
|
1689
|
-
const i = document.createElement(
|
|
1688
|
+
}, m = (h, t, e) => {
|
|
1689
|
+
const i = document.createElement(h);
|
|
1690
1690
|
return t && Object.entries(t).forEach(([s, n]) => i.setAttribute(s, n)), e && e.appendChild(i), i;
|
|
1691
|
-
}, w = (
|
|
1692
|
-
const { instances: e } =
|
|
1693
|
-
Object.values(e).forEach((i) => i[
|
|
1691
|
+
}, w = (h, ...t) => {
|
|
1692
|
+
const { instances: e } = u;
|
|
1693
|
+
Object.values(e).forEach((i) => i[h](...t));
|
|
1694
1694
|
};
|
|
1695
|
-
class
|
|
1695
|
+
class W {
|
|
1696
1696
|
constructor(t, e = {}) {
|
|
1697
1697
|
this.id = U++, this.telInput = t, this.highlightedItem = null, this.options = Object.assign({}, T, e), this.hadInitialPlaceholder = !!t.getAttribute("placeholder");
|
|
1698
1698
|
}
|
|
@@ -1787,7 +1787,7 @@ class G {
|
|
|
1787
1787
|
}
|
|
1788
1788
|
//* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
|
|
1789
1789
|
_generateMarkup() {
|
|
1790
|
-
var
|
|
1790
|
+
var l, d, g;
|
|
1791
1791
|
this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
|
|
1792
1792
|
const {
|
|
1793
1793
|
allowDropdown: t,
|
|
@@ -1799,17 +1799,17 @@ class G {
|
|
|
1799
1799
|
fixDropdownWidth: r,
|
|
1800
1800
|
useFullscreenPopup: a,
|
|
1801
1801
|
countrySearch: c,
|
|
1802
|
-
i18n:
|
|
1802
|
+
i18n: y
|
|
1803
1803
|
} = this.options;
|
|
1804
|
-
let
|
|
1805
|
-
t && (
|
|
1806
|
-
const
|
|
1807
|
-
if ((
|
|
1808
|
-
this.countryContainer =
|
|
1804
|
+
let p = "iti";
|
|
1805
|
+
t && (p += " iti--allow-dropdown"), i && (p += " iti--show-flags"), s && (p += ` ${s}`), a || (p += " iti--inline-dropdown");
|
|
1806
|
+
const C = m("div", { class: p });
|
|
1807
|
+
if ((l = this.telInput.parentNode) == null || l.insertBefore(C, this.telInput), t || i || e) {
|
|
1808
|
+
this.countryContainer = m(
|
|
1809
1809
|
"div",
|
|
1810
1810
|
{ class: "iti__country-container" },
|
|
1811
|
-
|
|
1812
|
-
), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", t ? (this.selectedCountry =
|
|
1811
|
+
C
|
|
1812
|
+
), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", t ? (this.selectedCountry = m(
|
|
1813
1813
|
"button",
|
|
1814
1814
|
{
|
|
1815
1815
|
type: "button",
|
|
@@ -1821,85 +1821,85 @@ class G {
|
|
|
1821
1821
|
role: "combobox"
|
|
1822
1822
|
},
|
|
1823
1823
|
this.countryContainer
|
|
1824
|
-
), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry =
|
|
1824
|
+
), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = m(
|
|
1825
1825
|
"div",
|
|
1826
1826
|
{ class: "iti__selected-country" },
|
|
1827
1827
|
this.countryContainer
|
|
1828
1828
|
);
|
|
1829
|
-
const
|
|
1830
|
-
if (this.selectedCountryInner =
|
|
1829
|
+
const b = m("div", { class: "iti__selected-country-primary" }, this.selectedCountry);
|
|
1830
|
+
if (this.selectedCountryInner = m("div", { class: "iti__flag" }, b), this.selectedCountryA11yText = m(
|
|
1831
1831
|
"span",
|
|
1832
1832
|
{ class: "iti__a11y-text" },
|
|
1833
1833
|
this.selectedCountryInner
|
|
1834
|
-
), t && (this.dropdownArrow =
|
|
1834
|
+
), t && (this.dropdownArrow = m(
|
|
1835
1835
|
"div",
|
|
1836
1836
|
{ class: "iti__arrow", "aria-hidden": "true" },
|
|
1837
|
-
|
|
1838
|
-
)), e && (this.selectedDialCode =
|
|
1837
|
+
b
|
|
1838
|
+
)), e && (this.selectedDialCode = m(
|
|
1839
1839
|
"div",
|
|
1840
1840
|
{ class: "iti__selected-dial-code" },
|
|
1841
1841
|
this.selectedCountry
|
|
1842
1842
|
)), t) {
|
|
1843
1843
|
const f = r ? "" : "iti--flexible-dropdown-width";
|
|
1844
|
-
if (this.dropdownContent =
|
|
1844
|
+
if (this.dropdownContent = m("div", {
|
|
1845
1845
|
id: `iti-${this.id}__dropdown-content`,
|
|
1846
1846
|
class: `iti__dropdown-content iti__hide ${f}`
|
|
1847
|
-
}), c && (this.searchInput =
|
|
1847
|
+
}), c && (this.searchInput = m(
|
|
1848
1848
|
"input",
|
|
1849
1849
|
{
|
|
1850
1850
|
type: "text",
|
|
1851
1851
|
class: "iti__search-input",
|
|
1852
|
-
placeholder:
|
|
1852
|
+
placeholder: y.searchPlaceholder,
|
|
1853
1853
|
role: "combobox",
|
|
1854
1854
|
"aria-expanded": "true",
|
|
1855
|
-
"aria-label":
|
|
1855
|
+
"aria-label": y.searchPlaceholder,
|
|
1856
1856
|
"aria-controls": `iti-${this.id}__country-listbox`,
|
|
1857
1857
|
"aria-autocomplete": "list",
|
|
1858
1858
|
autocomplete: "off"
|
|
1859
1859
|
},
|
|
1860
1860
|
this.dropdownContent
|
|
1861
|
-
), this.searchResultsA11yText =
|
|
1861
|
+
), this.searchResultsA11yText = m(
|
|
1862
1862
|
"span",
|
|
1863
1863
|
{ class: "iti__a11y-text" },
|
|
1864
1864
|
this.dropdownContent
|
|
1865
|
-
)), this.countryList =
|
|
1865
|
+
)), this.countryList = m(
|
|
1866
1866
|
"ul",
|
|
1867
1867
|
{
|
|
1868
1868
|
class: "iti__country-list",
|
|
1869
1869
|
id: `iti-${this.id}__country-listbox`,
|
|
1870
1870
|
role: "listbox",
|
|
1871
|
-
"aria-label":
|
|
1871
|
+
"aria-label": y.countryListAriaLabel
|
|
1872
1872
|
},
|
|
1873
1873
|
this.dropdownContent
|
|
1874
1874
|
), this._appendListItems(), c && this._updateSearchResultsText(), o) {
|
|
1875
|
-
let
|
|
1876
|
-
s && (
|
|
1875
|
+
let _ = "iti iti--container";
|
|
1876
|
+
s && (_ += ` ${s}`), a ? _ += " iti--fullscreen-popup" : _ += " iti--inline-dropdown", this.dropdown = m("div", { class: _ }), this.dropdown.appendChild(this.dropdownContent);
|
|
1877
1877
|
} else
|
|
1878
1878
|
this.countryContainer.appendChild(this.dropdownContent);
|
|
1879
1879
|
}
|
|
1880
1880
|
}
|
|
1881
|
-
if (
|
|
1882
|
-
const
|
|
1881
|
+
if (C.appendChild(this.telInput), this._updateInputPadding(), n) {
|
|
1882
|
+
const b = this.telInput.getAttribute("name") || "", f = n(b);
|
|
1883
1883
|
if (f.phone) {
|
|
1884
|
-
const
|
|
1885
|
-
|
|
1884
|
+
const _ = (d = this.telInput.form) == null ? void 0 : d.querySelector(`input[name="${f.phone}"]`);
|
|
1885
|
+
_ ? this.hiddenInput = _ : (this.hiddenInput = m("input", {
|
|
1886
1886
|
type: "hidden",
|
|
1887
1887
|
name: f.phone
|
|
1888
|
-
}),
|
|
1888
|
+
}), C.appendChild(this.hiddenInput));
|
|
1889
1889
|
}
|
|
1890
1890
|
if (f.country) {
|
|
1891
|
-
const
|
|
1892
|
-
|
|
1891
|
+
const _ = (g = this.telInput.form) == null ? void 0 : g.querySelector(`input[name="${f.country}"]`);
|
|
1892
|
+
_ ? this.hiddenInputCountry = _ : (this.hiddenInputCountry = m("input", {
|
|
1893
1893
|
type: "hidden",
|
|
1894
1894
|
name: f.country
|
|
1895
|
-
}),
|
|
1895
|
+
}), C.appendChild(this.hiddenInputCountry));
|
|
1896
1896
|
}
|
|
1897
1897
|
}
|
|
1898
1898
|
}
|
|
1899
1899
|
//* For each country: add a country list item <li> to the countryList <ul> container.
|
|
1900
1900
|
_appendListItems() {
|
|
1901
1901
|
for (let t = 0; t < this.countries.length; t++) {
|
|
1902
|
-
const e = this.countries[t], i = t === 0 ? "iti__highlight" : "", s =
|
|
1902
|
+
const e = this.countries[t], i = t === 0 ? "iti__highlight" : "", s = m(
|
|
1903
1903
|
"li",
|
|
1904
1904
|
{
|
|
1905
1905
|
id: `iti-${this.id}__item-${e.iso2}`,
|
|
@@ -1921,12 +1921,12 @@ class G {
|
|
|
1921
1921
|
//* 1. Extracting a dial code from the given number
|
|
1922
1922
|
//* 2. Using explicit initialCountry
|
|
1923
1923
|
_setInitialState(t = !1) {
|
|
1924
|
-
const e = this.telInput.getAttribute("value"), i = this.telInput.value, n = e && e.charAt(0) === "+" && (!i || i.charAt(0) !== "+") ? e : i, o = this._getDialCode(n), r = S(n), { initialCountry: a, geoIpLookup: c } = this.options,
|
|
1924
|
+
const e = this.telInput.getAttribute("value"), i = this.telInput.value, n = e && e.charAt(0) === "+" && (!i || i.charAt(0) !== "+") ? e : i, o = this._getDialCode(n), r = S(n), { initialCountry: a, geoIpLookup: c } = this.options, y = a === "auto" && c;
|
|
1925
1925
|
if (o && !r)
|
|
1926
1926
|
this._updateCountryFromNumber(n);
|
|
1927
|
-
else if (!
|
|
1928
|
-
const
|
|
1929
|
-
|
|
1927
|
+
else if (!y || t) {
|
|
1928
|
+
const p = a ? a.toLowerCase() : "";
|
|
1929
|
+
p && this._getCountryData(p, !0) ? this._setCountry(p) : o && r ? this._setCountry("us") : this._setCountry();
|
|
1930
1930
|
}
|
|
1931
1931
|
n && this._updateValFromNumber(n);
|
|
1932
1932
|
}
|
|
@@ -1962,18 +1962,18 @@ class G {
|
|
|
1962
1962
|
//* Init many requests: utils script / geo ip lookup.
|
|
1963
1963
|
_initRequests() {
|
|
1964
1964
|
let { loadUtils: t, initialCountry: e, geoIpLookup: i } = this.options;
|
|
1965
|
-
t && !
|
|
1965
|
+
t && !u.utils ? (this._handlePageLoad = () => {
|
|
1966
1966
|
var n;
|
|
1967
|
-
window.removeEventListener("load", this._handlePageLoad), (n =
|
|
1967
|
+
window.removeEventListener("load", this._handlePageLoad), (n = u.attachUtils(t)) == null || n.catch(() => {
|
|
1968
1968
|
});
|
|
1969
|
-
},
|
|
1969
|
+
}, u.documentReady() ? this._handlePageLoad() : window.addEventListener("load", this._handlePageLoad)) : this.resolveUtilsScriptPromise(), e === "auto" && i && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
|
|
1970
1970
|
}
|
|
1971
1971
|
//* Perform the geo ip lookup.
|
|
1972
1972
|
_loadAutoCountry() {
|
|
1973
|
-
|
|
1973
|
+
u.autoCountry ? this.handleAutoCountry() : u.startedLoadingAutoCountry || (u.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
|
|
1974
1974
|
(t = "") => {
|
|
1975
1975
|
const e = t.toLowerCase();
|
|
1976
|
-
e && this._getCountryData(e, !0) ? (
|
|
1976
|
+
e && this._getCountryData(e, !0) ? (u.autoCountry = e, setTimeout(() => w("handleAutoCountry"))) : (this._setInitialState(!0), w("rejectAutoCountryPromise"));
|
|
1977
1977
|
},
|
|
1978
1978
|
() => {
|
|
1979
1979
|
this._setInitialState(!0), w("rejectAutoCountryPromise");
|
|
@@ -1989,17 +1989,17 @@ class G {
|
|
|
1989
1989
|
let r = !1;
|
|
1990
1990
|
new RegExp("\\p{L}", "u").test(this.telInput.value) && (r = !0), this._handleInputEvent = (a) => {
|
|
1991
1991
|
if (this.isAndroid && (a == null ? void 0 : a.data) === "+" && i && n && o) {
|
|
1992
|
-
const
|
|
1993
|
-
this.telInput.value =
|
|
1992
|
+
const C = this.telInput.selectionStart || 0, l = this.telInput.value.substring(0, C - 1), d = this.telInput.value.substring(C);
|
|
1993
|
+
this.telInput.value = l + d, this._openDropdownWithPlus();
|
|
1994
1994
|
return;
|
|
1995
1995
|
}
|
|
1996
1996
|
this._updateCountryFromNumber(this.telInput.value) && this._triggerCountryChange();
|
|
1997
|
-
const c = (a == null ? void 0 : a.data) && /[^+0-9]/.test(a.data),
|
|
1998
|
-
c ||
|
|
1999
|
-
const
|
|
2000
|
-
if (e && !r && !
|
|
2001
|
-
const
|
|
2002
|
-
this.telInput.value =
|
|
1997
|
+
const c = (a == null ? void 0 : a.data) && /[^+0-9]/.test(a.data), y = (a == null ? void 0 : a.inputType) === "insertFromPaste" && this.telInput.value;
|
|
1998
|
+
c || y && !t ? r = !0 : /[^+0-9]/.test(this.telInput.value) || (r = !1);
|
|
1999
|
+
const p = (a == null ? void 0 : a.detail) && a.detail.isSetNumber && !s;
|
|
2000
|
+
if (e && !r && !p) {
|
|
2001
|
+
const C = this.telInput.selectionStart || 0, d = this.telInput.value.substring(0, C).replace(/[^+0-9]/g, "").length, g = (a == null ? void 0 : a.inputType) === "deleteContentForward", b = this._formatNumberAsYouType(), f = K(d, b, C, g);
|
|
2002
|
+
this.telInput.value = b, this.telInput.setSelectionRange(f, f);
|
|
2003
2003
|
}
|
|
2004
2004
|
}, this.telInput.addEventListener("input", this._handleInputEvent), (t || i) && (this._handleKeydownEvent = (a) => {
|
|
2005
2005
|
if (a.key && a.key.length === 1 && !a.altKey && !a.ctrlKey && !a.metaKey) {
|
|
@@ -2008,13 +2008,8 @@ class G {
|
|
|
2008
2008
|
return;
|
|
2009
2009
|
}
|
|
2010
2010
|
if (t) {
|
|
2011
|
-
const c = this.telInput.value,
|
|
2012
|
-
|
|
2013
|
-
if (d) {
|
|
2014
|
-
const P = this.selectedCountryData.iso2;
|
|
2015
|
-
g = this._getCountryFromNumber(b) !== P;
|
|
2016
|
-
}
|
|
2017
|
-
(!h || f && !g && !C) && a.preventDefault();
|
|
2011
|
+
const c = this.telInput.value, p = !(c.charAt(0) === "+") && this.telInput.selectionStart === 0 && a.key === "+", C = /^[0-9]$/.test(a.key), l = i ? C : p || C, d = c.slice(0, this.telInput.selectionStart) + a.key + c.slice(this.telInput.selectionEnd), g = this._getFullNumber(d), b = u.utils.getCoreNumber(g, this.selectedCountryData.iso2), f = this.maxCoreNumberLength && b.length > this.maxCoreNumberLength, P = this._getNewCountryFromNumber(g) !== null;
|
|
2012
|
+
(!l || f && !P && !p) && a.preventDefault();
|
|
2018
2013
|
}
|
|
2019
2014
|
}
|
|
2020
2015
|
}, this.telInput.addEventListener("keydown", this._handleKeydownEvent));
|
|
@@ -2103,13 +2098,22 @@ class G {
|
|
|
2103
2098
|
_filterCountries(t, e = !1) {
|
|
2104
2099
|
let i = !0;
|
|
2105
2100
|
this.countryList.innerHTML = "";
|
|
2106
|
-
const s = A(t);
|
|
2107
|
-
for (let
|
|
2108
|
-
const
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2101
|
+
const s = A(t), n = s.length, o = [], r = [], a = [], c = [], y = [], p = [];
|
|
2102
|
+
for (let l = 0; l < this.countries.length; l++) {
|
|
2103
|
+
const d = this.countries[l], g = A(d.name), b = d.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((f) => f[0]).join("").toLowerCase();
|
|
2104
|
+
e || n === 0 ? a.push(d) : d.iso2.toLowerCase() === s ? o.push(d) : g.startsWith(s) ? r.push(d) : g.includes(s) ? a.push(d) : s === d.dialCode || s === `+${d.dialCode}` ? c.push(d) : `+${d.dialCode}`.includes(s) ? y.push(d) : b.includes(s) && p.push(d);
|
|
2105
|
+
}
|
|
2106
|
+
const C = [
|
|
2107
|
+
...o.sort((l, d) => l.priority - d.priority),
|
|
2108
|
+
...r.sort((l, d) => l.priority - d.priority),
|
|
2109
|
+
...a.sort((l, d) => l.priority - d.priority),
|
|
2110
|
+
...c.sort((l, d) => l.priority - d.priority),
|
|
2111
|
+
...y.sort((l, d) => l.priority - d.priority),
|
|
2112
|
+
...p.sort((l, d) => l.priority - d.priority)
|
|
2113
|
+
];
|
|
2114
|
+
for (const l of C) {
|
|
2115
|
+
const d = l.nodeById[this.id];
|
|
2116
|
+
d && (this.countryList.appendChild(d), i && (this._highlightListItem(d, !1), i = !1));
|
|
2113
2117
|
}
|
|
2114
2118
|
i && this._highlightListItem(null, !1), this.countryList.scrollTop = 0, this._updateSearchResultsText();
|
|
2115
2119
|
}
|
|
@@ -2133,9 +2137,9 @@ class G {
|
|
|
2133
2137
|
//* NOTE: this is called from _setInitialState, handleUtils and setNumber.
|
|
2134
2138
|
_updateValFromNumber(t) {
|
|
2135
2139
|
let e = t;
|
|
2136
|
-
if (this.options.formatOnDisplay &&
|
|
2137
|
-
const i = this.options.nationalMode || e.charAt(0) !== "+" && !this.options.separateDialCode, { NATIONAL: s, INTERNATIONAL: n } =
|
|
2138
|
-
e =
|
|
2140
|
+
if (this.options.formatOnDisplay && u.utils && this.selectedCountryData) {
|
|
2141
|
+
const i = this.options.nationalMode || e.charAt(0) !== "+" && !this.options.separateDialCode, { NATIONAL: s, INTERNATIONAL: n } = u.utils.numberFormat, o = i ? s : n;
|
|
2142
|
+
e = u.utils.formatNumber(
|
|
2139
2143
|
e,
|
|
2140
2144
|
this.selectedCountryData.iso2,
|
|
2141
2145
|
o
|
|
@@ -2146,7 +2150,7 @@ class G {
|
|
|
2146
2150
|
//* Check if need to select a new country based on the given number
|
|
2147
2151
|
//* Note: called from _setInitialState, keyup handler, setNumber.
|
|
2148
2152
|
_updateCountryFromNumber(t) {
|
|
2149
|
-
const e = this.
|
|
2153
|
+
const e = this._getNewCountryFromNumber(t);
|
|
2150
2154
|
return e !== null ? this._setCountry(e) : !1;
|
|
2151
2155
|
}
|
|
2152
2156
|
_ensureHasDialCode(t) {
|
|
@@ -2156,7 +2160,10 @@ class G {
|
|
|
2156
2160
|
const o = i && t.charAt(0) === i && !this.options.separateDialCode ? t.substring(1) : t;
|
|
2157
2161
|
return `+${e}${o}`;
|
|
2158
2162
|
}
|
|
2159
|
-
|
|
2163
|
+
// Get the country ISO2 code from the given number
|
|
2164
|
+
// BUT ONLY IF ITS CHANGED FROM THE CURRENTLY SELECTED COUNTRY
|
|
2165
|
+
// NOTE: consider refactoring this to be more clear
|
|
2166
|
+
_getNewCountryFromNumber(t) {
|
|
2160
2167
|
const e = t.indexOf("+");
|
|
2161
2168
|
let i = e ? t.substring(e) : t;
|
|
2162
2169
|
const s = this.selectedCountryData.iso2, n = this.selectedCountryData.dialCode;
|
|
@@ -2166,11 +2173,11 @@ class G {
|
|
|
2166
2173
|
const a = v(o), c = this.dialCodeToIso2Map[a];
|
|
2167
2174
|
if (!s && this.defaultCountry && c.includes(this.defaultCountry))
|
|
2168
2175
|
return this.defaultCountry;
|
|
2169
|
-
const
|
|
2170
|
-
if (!(n === "1" && S(r)) && !
|
|
2171
|
-
for (let
|
|
2172
|
-
if (c[
|
|
2173
|
-
return c[
|
|
2176
|
+
const y = this.selectedCountryData.areaCodes && r.length > a.length, p = s && c.includes(s) && !y;
|
|
2177
|
+
if (!(n === "1" && S(r)) && !p) {
|
|
2178
|
+
for (let l = 0; l < c.length; l++)
|
|
2179
|
+
if (c[l])
|
|
2180
|
+
return c[l];
|
|
2174
2181
|
}
|
|
2175
2182
|
} else {
|
|
2176
2183
|
if (i.charAt(0) === "+" && r.length)
|
|
@@ -2224,18 +2231,18 @@ class G {
|
|
|
2224
2231
|
//* Update the maximum valid number length for the currently selected country.
|
|
2225
2232
|
_updateMaxLength() {
|
|
2226
2233
|
const { strictMode: t, placeholderNumberType: e, validationNumberTypes: i } = this.options, { iso2: s } = this.selectedCountryData;
|
|
2227
|
-
if (t &&
|
|
2234
|
+
if (t && u.utils)
|
|
2228
2235
|
if (s) {
|
|
2229
|
-
const n =
|
|
2230
|
-
let o =
|
|
2236
|
+
const n = u.utils.numberType[e];
|
|
2237
|
+
let o = u.utils.getExampleNumber(
|
|
2231
2238
|
s,
|
|
2232
2239
|
!1,
|
|
2233
2240
|
n,
|
|
2234
2241
|
!0
|
|
2235
2242
|
), r = o;
|
|
2236
|
-
for (;
|
|
2243
|
+
for (; u.utils.isPossibleNumber(o, s, i); )
|
|
2237
2244
|
r = o, o += "0";
|
|
2238
|
-
const a =
|
|
2245
|
+
const a = u.utils.getCoreNumber(r, s);
|
|
2239
2246
|
this.maxCoreNumberLength = a.length, s === "by" && (this.maxCoreNumberLength = a.length + 1);
|
|
2240
2247
|
} else
|
|
2241
2248
|
this.maxCoreNumberLength = null;
|
|
@@ -2271,9 +2278,9 @@ class G {
|
|
|
2271
2278
|
nationalMode: i,
|
|
2272
2279
|
customPlaceholder: s
|
|
2273
2280
|
} = this.options, n = t === "aggressive" || !this.hadInitialPlaceholder && t === "polite";
|
|
2274
|
-
if (
|
|
2275
|
-
const o =
|
|
2276
|
-
let r = this.selectedCountryData.iso2 ?
|
|
2281
|
+
if (u.utils && n) {
|
|
2282
|
+
const o = u.utils.numberType[e];
|
|
2283
|
+
let r = this.selectedCountryData.iso2 ? u.utils.getExampleNumber(
|
|
2277
2284
|
this.selectedCountryData.iso2,
|
|
2278
2285
|
i,
|
|
2279
2286
|
o
|
|
@@ -2300,12 +2307,12 @@ class G {
|
|
|
2300
2307
|
}
|
|
2301
2308
|
//* Check if an element is visible within it's container, else scroll until it is.
|
|
2302
2309
|
_scrollTo(t) {
|
|
2303
|
-
const e = this.countryList, i = document.documentElement.scrollTop, s = e.offsetHeight, n = e.getBoundingClientRect().top + i, o = n + s, r = t.offsetHeight, a = t.getBoundingClientRect().top + i, c = a + r,
|
|
2310
|
+
const e = this.countryList, i = document.documentElement.scrollTop, s = e.offsetHeight, n = e.getBoundingClientRect().top + i, o = n + s, r = t.offsetHeight, a = t.getBoundingClientRect().top + i, c = a + r, y = a - n + e.scrollTop;
|
|
2304
2311
|
if (a < n)
|
|
2305
|
-
e.scrollTop =
|
|
2312
|
+
e.scrollTop = y;
|
|
2306
2313
|
else if (c > o) {
|
|
2307
|
-
const
|
|
2308
|
-
e.scrollTop =
|
|
2314
|
+
const p = s - r;
|
|
2315
|
+
e.scrollTop = y - p;
|
|
2309
2316
|
}
|
|
2310
2317
|
}
|
|
2311
2318
|
//* Replace any existing dial code with the new one
|
|
@@ -2366,7 +2373,7 @@ class G {
|
|
|
2366
2373
|
}
|
|
2367
2374
|
//* Format the number as the user types.
|
|
2368
2375
|
_formatNumberAsYouType() {
|
|
2369
|
-
const t = this._getFullNumber(), e =
|
|
2376
|
+
const t = this._getFullNumber(), e = u.utils ? u.utils.formatNumberAsYouType(t, this.selectedCountryData.iso2) : t, { dialCode: i } = this.selectedCountryData;
|
|
2370
2377
|
return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && e.includes(`+${i}`) ? (e.split(`+${i}`)[1] || "").trim() : e;
|
|
2371
2378
|
}
|
|
2372
2379
|
//**************************
|
|
@@ -2374,11 +2381,11 @@ class G {
|
|
|
2374
2381
|
//**************************
|
|
2375
2382
|
//* This is called when the geoip call returns.
|
|
2376
2383
|
handleAutoCountry() {
|
|
2377
|
-
this.options.initialCountry === "auto" &&
|
|
2384
|
+
this.options.initialCountry === "auto" && u.autoCountry && (this.defaultCountry = u.autoCountry, this.selectedCountryData.iso2 || this.selectedCountryInner.classList.contains("iti__globe") || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
|
|
2378
2385
|
}
|
|
2379
2386
|
//* This is called when the utils request completes.
|
|
2380
2387
|
handleUtils() {
|
|
2381
|
-
|
|
2388
|
+
u.utils && (this.telInput.value && this._updateValFromNumber(this.telInput.value), this.selectedCountryData.iso2 && (this._updatePlaceholder(), this._updateMaxLength())), this.resolveUtilsScriptPromise();
|
|
2382
2389
|
}
|
|
2383
2390
|
//********************
|
|
2384
2391
|
//* PUBLIC METHODS
|
|
@@ -2402,20 +2409,20 @@ class G {
|
|
|
2402
2409
|
const { form: i } = this.telInput;
|
|
2403
2410
|
this._handleHiddenInputSubmit && i && i.removeEventListener("submit", this._handleHiddenInputSubmit), this.telInput.removeEventListener("input", this._handleInputEvent), this._handleKeydownEvent && this.telInput.removeEventListener("keydown", this._handleKeydownEvent), this.telInput.removeAttribute("data-intl-tel-input-id"), e && (this.isRTL ? this.telInput.style.paddingRight = this.originalPaddingRight : this.telInput.style.paddingLeft = this.originalPaddingLeft);
|
|
2404
2411
|
const s = this.telInput.parentNode;
|
|
2405
|
-
(n = s == null ? void 0 : s.parentNode) == null || n.insertBefore(this.telInput, s), (o = s == null ? void 0 : s.parentNode) == null || o.removeChild(s), delete
|
|
2412
|
+
(n = s == null ? void 0 : s.parentNode) == null || n.insertBefore(this.telInput, s), (o = s == null ? void 0 : s.parentNode) == null || o.removeChild(s), delete u.instances[this.id];
|
|
2406
2413
|
}
|
|
2407
2414
|
//* Get the extension from the current number.
|
|
2408
2415
|
getExtension() {
|
|
2409
|
-
return
|
|
2416
|
+
return u.utils ? u.utils.getExtension(
|
|
2410
2417
|
this._getFullNumber(),
|
|
2411
2418
|
this.selectedCountryData.iso2
|
|
2412
2419
|
) : "";
|
|
2413
2420
|
}
|
|
2414
2421
|
//* Format the number to the given format.
|
|
2415
2422
|
getNumber(t) {
|
|
2416
|
-
if (
|
|
2423
|
+
if (u.utils) {
|
|
2417
2424
|
const { iso2: e } = this.selectedCountryData;
|
|
2418
|
-
return
|
|
2425
|
+
return u.utils.formatNumber(
|
|
2419
2426
|
this._getFullNumber(),
|
|
2420
2427
|
e,
|
|
2421
2428
|
t
|
|
@@ -2425,7 +2432,7 @@ class G {
|
|
|
2425
2432
|
}
|
|
2426
2433
|
//* Get the type of the entered number e.g. landline/mobile.
|
|
2427
2434
|
getNumberType() {
|
|
2428
|
-
return
|
|
2435
|
+
return u.utils ? u.utils.getNumberType(
|
|
2429
2436
|
this._getFullNumber(),
|
|
2430
2437
|
this.selectedCountryData.iso2
|
|
2431
2438
|
) : -99;
|
|
@@ -2436,9 +2443,9 @@ class G {
|
|
|
2436
2443
|
}
|
|
2437
2444
|
//* Get the validation error.
|
|
2438
2445
|
getValidationError() {
|
|
2439
|
-
if (
|
|
2446
|
+
if (u.utils) {
|
|
2440
2447
|
const { iso2: t } = this.selectedCountryData;
|
|
2441
|
-
return
|
|
2448
|
+
return u.utils.getValidationError(this._getFullNumber(), t);
|
|
2442
2449
|
}
|
|
2443
2450
|
return -99;
|
|
2444
2451
|
}
|
|
@@ -2454,7 +2461,7 @@ class G {
|
|
|
2454
2461
|
return this._utilsIsPossibleNumber(t);
|
|
2455
2462
|
}
|
|
2456
2463
|
_utilsIsPossibleNumber(t) {
|
|
2457
|
-
return
|
|
2464
|
+
return u.utils ? u.utils.isPossibleNumber(t, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
|
|
2458
2465
|
}
|
|
2459
2466
|
//* Validate the input val (precise)
|
|
2460
2467
|
isValidNumberPrecise() {
|
|
@@ -2468,7 +2475,7 @@ class G {
|
|
|
2468
2475
|
return this._utilsIsValidNumber(t);
|
|
2469
2476
|
}
|
|
2470
2477
|
_utilsIsValidNumber(t) {
|
|
2471
|
-
return
|
|
2478
|
+
return u.utils ? u.utils.isValidNumber(t, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
|
|
2472
2479
|
}
|
|
2473
2480
|
//* Update the selected country, and update the input val accordingly.
|
|
2474
2481
|
setCountry(t) {
|
|
@@ -2488,31 +2495,31 @@ class G {
|
|
|
2488
2495
|
this.telInput.disabled = t, t ? this.selectedCountry.setAttribute("disabled", "true") : this.selectedCountry.removeAttribute("disabled");
|
|
2489
2496
|
}
|
|
2490
2497
|
}
|
|
2491
|
-
const
|
|
2492
|
-
if (!
|
|
2498
|
+
const G = (h) => {
|
|
2499
|
+
if (!u.utils && !u.startedLoadingUtilsScript) {
|
|
2493
2500
|
let t;
|
|
2494
|
-
if (typeof
|
|
2501
|
+
if (typeof h == "function")
|
|
2495
2502
|
try {
|
|
2496
|
-
t = Promise.resolve(
|
|
2503
|
+
t = Promise.resolve(h());
|
|
2497
2504
|
} catch (e) {
|
|
2498
2505
|
return Promise.reject(e);
|
|
2499
2506
|
}
|
|
2500
2507
|
else
|
|
2501
|
-
return Promise.reject(new TypeError(`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof
|
|
2502
|
-
return
|
|
2508
|
+
return Promise.reject(new TypeError(`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof h}`));
|
|
2509
|
+
return u.startedLoadingUtilsScript = !0, t.then((e) => {
|
|
2503
2510
|
const i = e == null ? void 0 : e.default;
|
|
2504
2511
|
if (!i || typeof i != "object")
|
|
2505
2512
|
throw new TypeError("The loader function passed to attachUtils did not resolve to a module object with utils as its default export.");
|
|
2506
|
-
return
|
|
2513
|
+
return u.utils = i, w("handleUtils"), !0;
|
|
2507
2514
|
}).catch((e) => {
|
|
2508
2515
|
throw w("rejectUtilsScriptPromise", e), e;
|
|
2509
2516
|
});
|
|
2510
2517
|
}
|
|
2511
2518
|
return null;
|
|
2512
|
-
},
|
|
2513
|
-
(
|
|
2514
|
-
const e = new
|
|
2515
|
-
return e._init(),
|
|
2519
|
+
}, u = Object.assign(
|
|
2520
|
+
(h, t) => {
|
|
2521
|
+
const e = new W(h, t);
|
|
2522
|
+
return e._init(), h.setAttribute("data-intl-tel-input-id", e.id.toString()), u.instances[e.id] = e, h.iti = e, e;
|
|
2516
2523
|
},
|
|
2517
2524
|
{
|
|
2518
2525
|
defaults: T,
|
|
@@ -2521,18 +2528,18 @@ const W = (u) => {
|
|
|
2521
2528
|
//* Get the country data object.
|
|
2522
2529
|
getCountryData: () => I,
|
|
2523
2530
|
//* A getter for the plugin instance.
|
|
2524
|
-
getInstance: (
|
|
2525
|
-
const t =
|
|
2526
|
-
return t ?
|
|
2531
|
+
getInstance: (h) => {
|
|
2532
|
+
const t = h.getAttribute("data-intl-tel-input-id");
|
|
2533
|
+
return t ? u.instances[t] : null;
|
|
2527
2534
|
},
|
|
2528
2535
|
//* A map from instance ID to instance object.
|
|
2529
2536
|
instances: {},
|
|
2530
|
-
attachUtils:
|
|
2537
|
+
attachUtils: G,
|
|
2531
2538
|
startedLoadingUtilsScript: !1,
|
|
2532
2539
|
startedLoadingAutoCountry: !1,
|
|
2533
|
-
version: "25.
|
|
2540
|
+
version: "25.5.0"
|
|
2534
2541
|
}
|
|
2535
|
-
),
|
|
2542
|
+
), Y = {
|
|
2536
2543
|
__name: "IntlTelInput",
|
|
2537
2544
|
props: /* @__PURE__ */ D({
|
|
2538
2545
|
disabled: {
|
|
@@ -2564,39 +2571,39 @@ const W = (u) => {
|
|
|
2564
2571
|
"changeValidity",
|
|
2565
2572
|
"changeErrorCode"
|
|
2566
2573
|
], ["update:modelValue"]),
|
|
2567
|
-
setup(
|
|
2568
|
-
const i = x(
|
|
2569
|
-
let
|
|
2570
|
-
a.value !==
|
|
2574
|
+
setup(h, { expose: t, emit: e }) {
|
|
2575
|
+
const i = x(h, "modelValue"), s = h, n = e, o = L(), r = L(), a = L(!1), c = () => r.value ? s.options.strictMode ? r.value.isValidNumberPrecise() : r.value.isValidNumber() : null, y = () => {
|
|
2576
|
+
let l = c();
|
|
2577
|
+
a.value !== l && (a.value = l, n("changeValidity", !!l), n(
|
|
2571
2578
|
"changeErrorCode",
|
|
2572
|
-
|
|
2579
|
+
l ? null : r.value.getValidationError()
|
|
2573
2580
|
));
|
|
2574
|
-
}, C = () => {
|
|
2575
|
-
var h;
|
|
2576
|
-
n("changeNumber", ((h = r.value) == null ? void 0 : h.getNumber()) ?? ""), d();
|
|
2577
2581
|
}, p = () => {
|
|
2578
|
-
var
|
|
2579
|
-
n("
|
|
2582
|
+
var l;
|
|
2583
|
+
n("changeNumber", ((l = r.value) == null ? void 0 : l.getNumber()) ?? ""), y();
|
|
2584
|
+
}, C = () => {
|
|
2585
|
+
var l;
|
|
2586
|
+
n("changeCountry", ((l = r.value) == null ? void 0 : l.getSelectedCountryData().iso2) ?? ""), p(), y();
|
|
2580
2587
|
};
|
|
2581
2588
|
return E(() => {
|
|
2582
|
-
o.value && (r.value =
|
|
2589
|
+
o.value && (r.value = u(o.value, s.options), s.value && r.value.setNumber(s.value), s.disabled && r.value.setDisabled(s.disabled), a.value = c());
|
|
2583
2590
|
}), M(
|
|
2584
2591
|
() => s.disabled,
|
|
2585
|
-
(
|
|
2586
|
-
var
|
|
2587
|
-
return (
|
|
2592
|
+
(l) => {
|
|
2593
|
+
var d;
|
|
2594
|
+
return (d = r.value) == null ? void 0 : d.setDisabled(l);
|
|
2588
2595
|
}
|
|
2589
2596
|
), F(() => {
|
|
2590
|
-
var
|
|
2591
|
-
return (
|
|
2592
|
-
}), t({ instance: r, input: o }), (
|
|
2597
|
+
var l;
|
|
2598
|
+
return (l = r.value) == null ? void 0 : l.destroy();
|
|
2599
|
+
}), t({ instance: r, input: o }), (l, d) => B((z(), V("input", R({
|
|
2593
2600
|
ref_key: "input",
|
|
2594
2601
|
ref: o,
|
|
2595
|
-
"onUpdate:modelValue":
|
|
2602
|
+
"onUpdate:modelValue": d[0] || (d[0] = (g) => i.value = g),
|
|
2596
2603
|
type: "tel",
|
|
2597
|
-
onCountrychange:
|
|
2598
|
-
onInput:
|
|
2599
|
-
},
|
|
2604
|
+
onCountrychange: C,
|
|
2605
|
+
onInput: p
|
|
2606
|
+
}, h.inputProps), null, 16)), [
|
|
2600
2607
|
[
|
|
2601
2608
|
O,
|
|
2602
2609
|
i.value,
|
|
@@ -2607,5 +2614,5 @@ const W = (u) => {
|
|
|
2607
2614
|
}
|
|
2608
2615
|
};
|
|
2609
2616
|
export {
|
|
2610
|
-
|
|
2617
|
+
Y as default
|
|
2611
2618
|
};
|