intl-tel-input 25.8.6 → 25.10.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intl-tel-input",
3
- "version": "25.8.6",
3
+ "version": "25.10.1",
4
4
  "description": "A JavaScript plugin for entering and validating international telephone numbers",
5
5
  "keywords": [
6
6
  "international",
@@ -100,18 +100,18 @@
100
100
  "lint:spelling": "cspell --dot --gitignore --no-progress '**'",
101
101
  "watch": "grunt watch",
102
102
  "build": "grunt build",
103
- "prepublishOnly": "grunt build",
104
- "build:js": "grunt js",
105
- "build:jsfast": "grunt jsfast",
103
+ "build:js": "grunt build:js",
104
+ "build:jsfast": "grunt build:jsfast",
106
105
  "build:translations": "grunt build:translations",
107
106
  "build:utils": "grunt build:utils",
108
- "build:css": "grunt css",
109
- "build:img": "grunt img",
110
- "build:react": "grunt react",
111
- "build:vue": "grunt vue",
112
- "build:angular": "grunt angular",
107
+ "build:css": "grunt build:css",
108
+ "build:img": "grunt build:img",
109
+ "build:react": "grunt build:react",
110
+ "build:vue": "grunt build:vue",
111
+ "build:angular": "grunt build:angular",
113
112
  "build:travis": "grunt build:travis",
114
- "vue:demo": "vite --config vue/demo/validation/vite.config.js"
113
+ "prepublishOnly": "grunt build",
114
+ "vue:demo": "vite --config vue/demo/validation/vite.config.js"
115
115
  },
116
116
  "style": "build/css/intlTelInput.css",
117
117
  "main": "./build/js/intlTelInput.js",
package/react/README.md CHANGED
@@ -28,7 +28,7 @@ import "intl-tel-input/styles";
28
28
 
29
29
  See the [Validation demo](https://github.com/jackocnr/intl-tel-input/blob/master/react/demo/validation/ValidationApp.tsx) for a more fleshed-out example of how to handle validation.
30
30
 
31
- A note on the utils script (~260KB): if you're lazy loading the IntlTelInput chunk (and so less worried about filesize) then you can just import IntlTelInput from `"intl-tel-input/reactWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/react"` import, then you should couple this with the `loadUtils` initialisation option - you will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `loadUtils` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@25.8.6/build/js/utils.js"`.
31
+ A note on the utils script (~260KB): if you're lazy loading the IntlTelInput chunk (and so less worried about filesize) then you can just import IntlTelInput from `"intl-tel-input/reactWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/react"` import, then you should couple this with the `loadUtils` initialisation option - you will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `loadUtils` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.1/build/js/utils.js"`.
32
32
 
33
33
  ## Props
34
34
  Here's a list of all of the current props you can pass to the IntlTelInput React component.
@@ -1661,6 +1661,8 @@ var computeDefaultUseFullscreenPopup = () => {
1661
1661
  return false;
1662
1662
  };
1663
1663
  var defaults = {
1664
+ // Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
1665
+ allowPhonewords: false,
1664
1666
  //* Whether or not to allow the dropdown.
1665
1667
  allowDropdown: true,
1666
1668
  //* Add a placeholder in the input with an example number for the selected country.
@@ -1975,7 +1977,8 @@ var Iti = class _Iti {
1975
1977
  if (allowDropdown || showFlags || separateDialCode) {
1976
1978
  this.countryContainer = createEl(
1977
1979
  "div",
1978
- { class: "iti__country-container" },
1980
+ // visibly hidden until we measure it's width to set the input padding correctly
1981
+ { class: "iti__country-container iti__v-hide" },
1979
1982
  wrapper
1980
1983
  );
1981
1984
  if (this.showSelectedCountryOnLeft) {
@@ -2140,7 +2143,10 @@ var Iti = class _Iti {
2140
2143
  }
2141
2144
  }
2142
2145
  wrapper.appendChild(this.telInput);
2143
- this._updateInputPadding();
2146
+ if (this.countryContainer) {
2147
+ this._updateInputPadding();
2148
+ this.countryContainer.classList.remove("iti__v-hide");
2149
+ }
2144
2150
  if (hiddenInput) {
2145
2151
  const telInputName = this.telInput.getAttribute("name") || "";
2146
2152
  const names = hiddenInput(telInputName);
@@ -2800,7 +2806,8 @@ var Iti = class _Iti {
2800
2806
  //* Update the input padding to make space for the selected country/dial code.
2801
2807
  _updateInputPadding() {
2802
2808
  if (this.selectedCountry) {
2803
- const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth();
2809
+ const saneDefaultWidth = this.options.separateDialCode ? 78 : 42;
2810
+ const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || saneDefaultWidth;
2804
2811
  const inputPadding = selectedCountryWidth + 6;
2805
2812
  if (this.showSelectedCountryOnLeft) {
2806
2813
  this.telInput.style.paddingLeft = `${inputPadding}px`;
@@ -2837,21 +2844,27 @@ var Iti = class _Iti {
2837
2844
  }
2838
2845
  }
2839
2846
  }
2840
- //* When the input is in a hidden container during initialisation, we must inject some markup
2841
- //* into the end of the DOM to calculate the correct offsetWidth.
2842
- //* NOTE: this is only used when separateDialCode is enabled, so countryContainer and selectedCountry
2843
- //* will definitely exist.
2847
+ //* When input is in a hidden container during init, we cannot calculate the selected country width.
2848
+ //* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
2849
+ //* To get the right styling to apply, all we need is a shallow clone of the container,
2850
+ //* and then to inject a deep clone of the selectedCountry element.
2844
2851
  _getHiddenSelectedCountryWidth() {
2845
2852
  if (this.telInput.parentNode) {
2853
+ let body;
2854
+ try {
2855
+ body = window.top.document.body;
2856
+ } catch (e) {
2857
+ body = document.body;
2858
+ }
2846
2859
  const containerClone = this.telInput.parentNode.cloneNode(false);
2847
2860
  containerClone.style.visibility = "hidden";
2848
- document.body.appendChild(containerClone);
2861
+ body.appendChild(containerClone);
2849
2862
  const countryContainerClone = this.countryContainer.cloneNode();
2850
2863
  containerClone.appendChild(countryContainerClone);
2851
2864
  const selectedCountryClone = this.selectedCountry.cloneNode(true);
2852
2865
  countryContainerClone.appendChild(selectedCountryClone);
2853
2866
  const width = selectedCountryClone.offsetWidth;
2854
- document.body.removeChild(containerClone);
2867
+ body.removeChild(containerClone);
2855
2868
  return width;
2856
2869
  }
2857
2870
  return 0;
@@ -3164,10 +3177,11 @@ var Iti = class _Iti {
3164
3177
  if (!this.selectedCountryData.iso2) {
3165
3178
  return false;
3166
3179
  }
3180
+ const testValidity = (s) => precise ? this._utilsIsValidNumber(s) : this._utilsIsPossibleNumber(s);
3167
3181
  const val = this._getFullNumber();
3168
3182
  const alphaCharPosition = val.search(/\p{L}/u);
3169
- const testValidity = (s) => precise ? this._utilsIsValidNumber(s) : this._utilsIsPossibleNumber(s);
3170
- if (alphaCharPosition > -1) {
3183
+ const hasAlphaChar = alphaCharPosition > -1;
3184
+ if (hasAlphaChar && !this.options.allowPhonewords) {
3171
3185
  const beforeAlphaChar = val.substring(0, alphaCharPosition);
3172
3186
  const beforeAlphaIsValid = testValidity(beforeAlphaChar);
3173
3187
  const isValid = testValidity(val);
@@ -3268,7 +3282,7 @@ var intlTelInput = Object.assign(
3268
3282
  attachUtils,
3269
3283
  startedLoadingUtilsScript: false,
3270
3284
  startedLoadingAutoCountry: false,
3271
- version: "25.8.6"
3285
+ version: "25.10.1"
3272
3286
  }
3273
3287
  );
3274
3288
  var intl_tel_input_default = intlTelInput;
@@ -346,6 +346,7 @@ declare module "intl-tel-input" {
346
346
  };
347
347
  interface AllOptions {
348
348
  allowDropdown: boolean;
349
+ allowPhonewords: boolean;
349
350
  autoPlaceholder: string;
350
351
  containerClass: string;
351
352
  countryOrder: string[];
@@ -1625,6 +1625,8 @@ var computeDefaultUseFullscreenPopup = () => {
1625
1625
  return false;
1626
1626
  };
1627
1627
  var defaults = {
1628
+ // Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
1629
+ allowPhonewords: false,
1628
1630
  //* Whether or not to allow the dropdown.
1629
1631
  allowDropdown: true,
1630
1632
  //* Add a placeholder in the input with an example number for the selected country.
@@ -1939,7 +1941,8 @@ var Iti = class _Iti {
1939
1941
  if (allowDropdown || showFlags || separateDialCode) {
1940
1942
  this.countryContainer = createEl(
1941
1943
  "div",
1942
- { class: "iti__country-container" },
1944
+ // visibly hidden until we measure it's width to set the input padding correctly
1945
+ { class: "iti__country-container iti__v-hide" },
1943
1946
  wrapper
1944
1947
  );
1945
1948
  if (this.showSelectedCountryOnLeft) {
@@ -2104,7 +2107,10 @@ var Iti = class _Iti {
2104
2107
  }
2105
2108
  }
2106
2109
  wrapper.appendChild(this.telInput);
2107
- this._updateInputPadding();
2110
+ if (this.countryContainer) {
2111
+ this._updateInputPadding();
2112
+ this.countryContainer.classList.remove("iti__v-hide");
2113
+ }
2108
2114
  if (hiddenInput) {
2109
2115
  const telInputName = this.telInput.getAttribute("name") || "";
2110
2116
  const names = hiddenInput(telInputName);
@@ -2764,7 +2770,8 @@ var Iti = class _Iti {
2764
2770
  //* Update the input padding to make space for the selected country/dial code.
2765
2771
  _updateInputPadding() {
2766
2772
  if (this.selectedCountry) {
2767
- const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth();
2773
+ const saneDefaultWidth = this.options.separateDialCode ? 78 : 42;
2774
+ const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || saneDefaultWidth;
2768
2775
  const inputPadding = selectedCountryWidth + 6;
2769
2776
  if (this.showSelectedCountryOnLeft) {
2770
2777
  this.telInput.style.paddingLeft = `${inputPadding}px`;
@@ -2801,21 +2808,27 @@ var Iti = class _Iti {
2801
2808
  }
2802
2809
  }
2803
2810
  }
2804
- //* When the input is in a hidden container during initialisation, we must inject some markup
2805
- //* into the end of the DOM to calculate the correct offsetWidth.
2806
- //* NOTE: this is only used when separateDialCode is enabled, so countryContainer and selectedCountry
2807
- //* will definitely exist.
2811
+ //* When input is in a hidden container during init, we cannot calculate the selected country width.
2812
+ //* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
2813
+ //* To get the right styling to apply, all we need is a shallow clone of the container,
2814
+ //* and then to inject a deep clone of the selectedCountry element.
2808
2815
  _getHiddenSelectedCountryWidth() {
2809
2816
  if (this.telInput.parentNode) {
2817
+ let body;
2818
+ try {
2819
+ body = window.top.document.body;
2820
+ } catch (e) {
2821
+ body = document.body;
2822
+ }
2810
2823
  const containerClone = this.telInput.parentNode.cloneNode(false);
2811
2824
  containerClone.style.visibility = "hidden";
2812
- document.body.appendChild(containerClone);
2825
+ body.appendChild(containerClone);
2813
2826
  const countryContainerClone = this.countryContainer.cloneNode();
2814
2827
  containerClone.appendChild(countryContainerClone);
2815
2828
  const selectedCountryClone = this.selectedCountry.cloneNode(true);
2816
2829
  countryContainerClone.appendChild(selectedCountryClone);
2817
2830
  const width = selectedCountryClone.offsetWidth;
2818
- document.body.removeChild(containerClone);
2831
+ body.removeChild(containerClone);
2819
2832
  return width;
2820
2833
  }
2821
2834
  return 0;
@@ -3128,10 +3141,11 @@ var Iti = class _Iti {
3128
3141
  if (!this.selectedCountryData.iso2) {
3129
3142
  return false;
3130
3143
  }
3144
+ const testValidity = (s) => precise ? this._utilsIsValidNumber(s) : this._utilsIsPossibleNumber(s);
3131
3145
  const val = this._getFullNumber();
3132
3146
  const alphaCharPosition = val.search(/\p{L}/u);
3133
- const testValidity = (s) => precise ? this._utilsIsValidNumber(s) : this._utilsIsPossibleNumber(s);
3134
- if (alphaCharPosition > -1) {
3147
+ const hasAlphaChar = alphaCharPosition > -1;
3148
+ if (hasAlphaChar && !this.options.allowPhonewords) {
3135
3149
  const beforeAlphaChar = val.substring(0, alphaCharPosition);
3136
3150
  const beforeAlphaIsValid = testValidity(beforeAlphaChar);
3137
3151
  const isValid = testValidity(val);
@@ -3232,7 +3246,7 @@ var intlTelInput = Object.assign(
3232
3246
  attachUtils,
3233
3247
  startedLoadingUtilsScript: false,
3234
3248
  startedLoadingAutoCountry: false,
3235
- version: "25.8.6"
3249
+ version: "25.10.1"
3236
3250
  }
3237
3251
  );
3238
3252
  var intl_tel_input_default = intlTelInput;
@@ -1661,6 +1661,8 @@ var computeDefaultUseFullscreenPopup = () => {
1661
1661
  return false;
1662
1662
  };
1663
1663
  var defaults = {
1664
+ // Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
1665
+ allowPhonewords: false,
1664
1666
  //* Whether or not to allow the dropdown.
1665
1667
  allowDropdown: true,
1666
1668
  //* Add a placeholder in the input with an example number for the selected country.
@@ -1975,7 +1977,8 @@ var Iti = class _Iti {
1975
1977
  if (allowDropdown || showFlags || separateDialCode) {
1976
1978
  this.countryContainer = createEl(
1977
1979
  "div",
1978
- { class: "iti__country-container" },
1980
+ // visibly hidden until we measure it's width to set the input padding correctly
1981
+ { class: "iti__country-container iti__v-hide" },
1979
1982
  wrapper
1980
1983
  );
1981
1984
  if (this.showSelectedCountryOnLeft) {
@@ -2140,7 +2143,10 @@ var Iti = class _Iti {
2140
2143
  }
2141
2144
  }
2142
2145
  wrapper.appendChild(this.telInput);
2143
- this._updateInputPadding();
2146
+ if (this.countryContainer) {
2147
+ this._updateInputPadding();
2148
+ this.countryContainer.classList.remove("iti__v-hide");
2149
+ }
2144
2150
  if (hiddenInput) {
2145
2151
  const telInputName = this.telInput.getAttribute("name") || "";
2146
2152
  const names = hiddenInput(telInputName);
@@ -2800,7 +2806,8 @@ var Iti = class _Iti {
2800
2806
  //* Update the input padding to make space for the selected country/dial code.
2801
2807
  _updateInputPadding() {
2802
2808
  if (this.selectedCountry) {
2803
- const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth();
2809
+ const saneDefaultWidth = this.options.separateDialCode ? 78 : 42;
2810
+ const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || saneDefaultWidth;
2804
2811
  const inputPadding = selectedCountryWidth + 6;
2805
2812
  if (this.showSelectedCountryOnLeft) {
2806
2813
  this.telInput.style.paddingLeft = `${inputPadding}px`;
@@ -2837,21 +2844,27 @@ var Iti = class _Iti {
2837
2844
  }
2838
2845
  }
2839
2846
  }
2840
- //* When the input is in a hidden container during initialisation, we must inject some markup
2841
- //* into the end of the DOM to calculate the correct offsetWidth.
2842
- //* NOTE: this is only used when separateDialCode is enabled, so countryContainer and selectedCountry
2843
- //* will definitely exist.
2847
+ //* When input is in a hidden container during init, we cannot calculate the selected country width.
2848
+ //* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
2849
+ //* To get the right styling to apply, all we need is a shallow clone of the container,
2850
+ //* and then to inject a deep clone of the selectedCountry element.
2844
2851
  _getHiddenSelectedCountryWidth() {
2845
2852
  if (this.telInput.parentNode) {
2853
+ let body;
2854
+ try {
2855
+ body = window.top.document.body;
2856
+ } catch (e) {
2857
+ body = document.body;
2858
+ }
2846
2859
  const containerClone = this.telInput.parentNode.cloneNode(false);
2847
2860
  containerClone.style.visibility = "hidden";
2848
- document.body.appendChild(containerClone);
2861
+ body.appendChild(containerClone);
2849
2862
  const countryContainerClone = this.countryContainer.cloneNode();
2850
2863
  containerClone.appendChild(countryContainerClone);
2851
2864
  const selectedCountryClone = this.selectedCountry.cloneNode(true);
2852
2865
  countryContainerClone.appendChild(selectedCountryClone);
2853
2866
  const width = selectedCountryClone.offsetWidth;
2854
- document.body.removeChild(containerClone);
2867
+ body.removeChild(containerClone);
2855
2868
  return width;
2856
2869
  }
2857
2870
  return 0;
@@ -3164,10 +3177,11 @@ var Iti = class _Iti {
3164
3177
  if (!this.selectedCountryData.iso2) {
3165
3178
  return false;
3166
3179
  }
3180
+ const testValidity = (s) => precise ? this._utilsIsValidNumber(s) : this._utilsIsPossibleNumber(s);
3167
3181
  const val = this._getFullNumber();
3168
3182
  const alphaCharPosition = val.search(/\p{L}/u);
3169
- const testValidity = (s) => precise ? this._utilsIsValidNumber(s) : this._utilsIsPossibleNumber(s);
3170
- if (alphaCharPosition > -1) {
3183
+ const hasAlphaChar = alphaCharPosition > -1;
3184
+ if (hasAlphaChar && !this.options.allowPhonewords) {
3171
3185
  const beforeAlphaChar = val.substring(0, alphaCharPosition);
3172
3186
  const beforeAlphaIsValid = testValidity(beforeAlphaChar);
3173
3187
  const isValid = testValidity(val);
@@ -3268,7 +3282,7 @@ var intlTelInput = Object.assign(
3268
3282
  attachUtils,
3269
3283
  startedLoadingUtilsScript: false,
3270
3284
  startedLoadingAutoCountry: false,
3271
- version: "25.8.6"
3285
+ version: "25.10.1"
3272
3286
  }
3273
3287
  );
3274
3288
  var intl_tel_input_default = intlTelInput;
@@ -1625,6 +1625,8 @@ var computeDefaultUseFullscreenPopup = () => {
1625
1625
  return false;
1626
1626
  };
1627
1627
  var defaults = {
1628
+ // Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
1629
+ allowPhonewords: false,
1628
1630
  //* Whether or not to allow the dropdown.
1629
1631
  allowDropdown: true,
1630
1632
  //* Add a placeholder in the input with an example number for the selected country.
@@ -1939,7 +1941,8 @@ var Iti = class _Iti {
1939
1941
  if (allowDropdown || showFlags || separateDialCode) {
1940
1942
  this.countryContainer = createEl(
1941
1943
  "div",
1942
- { class: "iti__country-container" },
1944
+ // visibly hidden until we measure it's width to set the input padding correctly
1945
+ { class: "iti__country-container iti__v-hide" },
1943
1946
  wrapper
1944
1947
  );
1945
1948
  if (this.showSelectedCountryOnLeft) {
@@ -2104,7 +2107,10 @@ var Iti = class _Iti {
2104
2107
  }
2105
2108
  }
2106
2109
  wrapper.appendChild(this.telInput);
2107
- this._updateInputPadding();
2110
+ if (this.countryContainer) {
2111
+ this._updateInputPadding();
2112
+ this.countryContainer.classList.remove("iti__v-hide");
2113
+ }
2108
2114
  if (hiddenInput) {
2109
2115
  const telInputName = this.telInput.getAttribute("name") || "";
2110
2116
  const names = hiddenInput(telInputName);
@@ -2764,7 +2770,8 @@ var Iti = class _Iti {
2764
2770
  //* Update the input padding to make space for the selected country/dial code.
2765
2771
  _updateInputPadding() {
2766
2772
  if (this.selectedCountry) {
2767
- const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth();
2773
+ const saneDefaultWidth = this.options.separateDialCode ? 78 : 42;
2774
+ const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || saneDefaultWidth;
2768
2775
  const inputPadding = selectedCountryWidth + 6;
2769
2776
  if (this.showSelectedCountryOnLeft) {
2770
2777
  this.telInput.style.paddingLeft = `${inputPadding}px`;
@@ -2801,21 +2808,27 @@ var Iti = class _Iti {
2801
2808
  }
2802
2809
  }
2803
2810
  }
2804
- //* When the input is in a hidden container during initialisation, we must inject some markup
2805
- //* into the end of the DOM to calculate the correct offsetWidth.
2806
- //* NOTE: this is only used when separateDialCode is enabled, so countryContainer and selectedCountry
2807
- //* will definitely exist.
2811
+ //* When input is in a hidden container during init, we cannot calculate the selected country width.
2812
+ //* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
2813
+ //* To get the right styling to apply, all we need is a shallow clone of the container,
2814
+ //* and then to inject a deep clone of the selectedCountry element.
2808
2815
  _getHiddenSelectedCountryWidth() {
2809
2816
  if (this.telInput.parentNode) {
2817
+ let body;
2818
+ try {
2819
+ body = window.top.document.body;
2820
+ } catch (e) {
2821
+ body = document.body;
2822
+ }
2810
2823
  const containerClone = this.telInput.parentNode.cloneNode(false);
2811
2824
  containerClone.style.visibility = "hidden";
2812
- document.body.appendChild(containerClone);
2825
+ body.appendChild(containerClone);
2813
2826
  const countryContainerClone = this.countryContainer.cloneNode();
2814
2827
  containerClone.appendChild(countryContainerClone);
2815
2828
  const selectedCountryClone = this.selectedCountry.cloneNode(true);
2816
2829
  countryContainerClone.appendChild(selectedCountryClone);
2817
2830
  const width = selectedCountryClone.offsetWidth;
2818
- document.body.removeChild(containerClone);
2831
+ body.removeChild(containerClone);
2819
2832
  return width;
2820
2833
  }
2821
2834
  return 0;
@@ -3128,10 +3141,11 @@ var Iti = class _Iti {
3128
3141
  if (!this.selectedCountryData.iso2) {
3129
3142
  return false;
3130
3143
  }
3144
+ const testValidity = (s) => precise ? this._utilsIsValidNumber(s) : this._utilsIsPossibleNumber(s);
3131
3145
  const val = this._getFullNumber();
3132
3146
  const alphaCharPosition = val.search(/\p{L}/u);
3133
- const testValidity = (s) => precise ? this._utilsIsValidNumber(s) : this._utilsIsPossibleNumber(s);
3134
- if (alphaCharPosition > -1) {
3147
+ const hasAlphaChar = alphaCharPosition > -1;
3148
+ if (hasAlphaChar && !this.options.allowPhonewords) {
3135
3149
  const beforeAlphaChar = val.substring(0, alphaCharPosition);
3136
3150
  const beforeAlphaIsValid = testValidity(beforeAlphaChar);
3137
3151
  const isValid = testValidity(val);
@@ -3232,7 +3246,7 @@ var intlTelInput = Object.assign(
3232
3246
  attachUtils,
3233
3247
  startedLoadingUtilsScript: false,
3234
3248
  startedLoadingAutoCountry: false,
3235
- version: "25.8.6"
3249
+ version: "25.10.1"
3236
3250
  }
3237
3251
  );
3238
3252
  var intl_tel_input_default = intlTelInput;
package/vue/README.md CHANGED
@@ -34,7 +34,7 @@ See the [Validation demo](https://github.com/jackocnr/intl-tel-input/blob/master
34
34
  "vue:demo": "vite --config vue/demo/[demo variant]/vite.config.js"
35
35
  ```
36
36
 
37
- A note on the utils script (~260KB): if you're lazy loading the IntlTelInput chunk (and so less worried about filesize) then you can just import IntlTelInput from `"intl-tel-input/vueWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/vue"` import, then you should couple this with the `loadUtils` initialisation option - you will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `loadUtils` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@25.8.6/build/js/utils.js"`.
37
+ A note on the utils script (~260KB): if you're lazy loading the IntlTelInput chunk (and so less worried about filesize) then you can just import IntlTelInput from `"intl-tel-input/vueWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/vue"` import, then you should couple this with the `loadUtils` initialisation option - you will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `loadUtils` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@25.10.1/build/js/utils.js"`.
38
38
 
39
39
  ## Props
40
40
  Here's a list of all of the current props you can pass to the IntlTelInput Vue component.