intl-tel-input 25.8.6 → 25.10.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intl-tel-input",
3
- "version": "25.8.6",
3
+ "version": "25.10.0",
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.0/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.
@@ -3164,10 +3166,11 @@ var Iti = class _Iti {
3164
3166
  if (!this.selectedCountryData.iso2) {
3165
3167
  return false;
3166
3168
  }
3169
+ const testValidity = (s) => precise ? this._utilsIsValidNumber(s) : this._utilsIsPossibleNumber(s);
3167
3170
  const val = this._getFullNumber();
3168
3171
  const alphaCharPosition = val.search(/\p{L}/u);
3169
- const testValidity = (s) => precise ? this._utilsIsValidNumber(s) : this._utilsIsPossibleNumber(s);
3170
- if (alphaCharPosition > -1) {
3172
+ const hasAlphaChar = alphaCharPosition > -1;
3173
+ if (hasAlphaChar && !this.options.allowPhonewords) {
3171
3174
  const beforeAlphaChar = val.substring(0, alphaCharPosition);
3172
3175
  const beforeAlphaIsValid = testValidity(beforeAlphaChar);
3173
3176
  const isValid = testValidity(val);
@@ -3268,7 +3271,7 @@ var intlTelInput = Object.assign(
3268
3271
  attachUtils,
3269
3272
  startedLoadingUtilsScript: false,
3270
3273
  startedLoadingAutoCountry: false,
3271
- version: "25.8.6"
3274
+ version: "25.10.0"
3272
3275
  }
3273
3276
  );
3274
3277
  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.
@@ -3128,10 +3130,11 @@ var Iti = class _Iti {
3128
3130
  if (!this.selectedCountryData.iso2) {
3129
3131
  return false;
3130
3132
  }
3133
+ const testValidity = (s) => precise ? this._utilsIsValidNumber(s) : this._utilsIsPossibleNumber(s);
3131
3134
  const val = this._getFullNumber();
3132
3135
  const alphaCharPosition = val.search(/\p{L}/u);
3133
- const testValidity = (s) => precise ? this._utilsIsValidNumber(s) : this._utilsIsPossibleNumber(s);
3134
- if (alphaCharPosition > -1) {
3136
+ const hasAlphaChar = alphaCharPosition > -1;
3137
+ if (hasAlphaChar && !this.options.allowPhonewords) {
3135
3138
  const beforeAlphaChar = val.substring(0, alphaCharPosition);
3136
3139
  const beforeAlphaIsValid = testValidity(beforeAlphaChar);
3137
3140
  const isValid = testValidity(val);
@@ -3232,7 +3235,7 @@ var intlTelInput = Object.assign(
3232
3235
  attachUtils,
3233
3236
  startedLoadingUtilsScript: false,
3234
3237
  startedLoadingAutoCountry: false,
3235
- version: "25.8.6"
3238
+ version: "25.10.0"
3236
3239
  }
3237
3240
  );
3238
3241
  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.
@@ -3164,10 +3166,11 @@ var Iti = class _Iti {
3164
3166
  if (!this.selectedCountryData.iso2) {
3165
3167
  return false;
3166
3168
  }
3169
+ const testValidity = (s) => precise ? this._utilsIsValidNumber(s) : this._utilsIsPossibleNumber(s);
3167
3170
  const val = this._getFullNumber();
3168
3171
  const alphaCharPosition = val.search(/\p{L}/u);
3169
- const testValidity = (s) => precise ? this._utilsIsValidNumber(s) : this._utilsIsPossibleNumber(s);
3170
- if (alphaCharPosition > -1) {
3172
+ const hasAlphaChar = alphaCharPosition > -1;
3173
+ if (hasAlphaChar && !this.options.allowPhonewords) {
3171
3174
  const beforeAlphaChar = val.substring(0, alphaCharPosition);
3172
3175
  const beforeAlphaIsValid = testValidity(beforeAlphaChar);
3173
3176
  const isValid = testValidity(val);
@@ -3268,7 +3271,7 @@ var intlTelInput = Object.assign(
3268
3271
  attachUtils,
3269
3272
  startedLoadingUtilsScript: false,
3270
3273
  startedLoadingAutoCountry: false,
3271
- version: "25.8.6"
3274
+ version: "25.10.0"
3272
3275
  }
3273
3276
  );
3274
3277
  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.
@@ -3128,10 +3130,11 @@ var Iti = class _Iti {
3128
3130
  if (!this.selectedCountryData.iso2) {
3129
3131
  return false;
3130
3132
  }
3133
+ const testValidity = (s) => precise ? this._utilsIsValidNumber(s) : this._utilsIsPossibleNumber(s);
3131
3134
  const val = this._getFullNumber();
3132
3135
  const alphaCharPosition = val.search(/\p{L}/u);
3133
- const testValidity = (s) => precise ? this._utilsIsValidNumber(s) : this._utilsIsPossibleNumber(s);
3134
- if (alphaCharPosition > -1) {
3136
+ const hasAlphaChar = alphaCharPosition > -1;
3137
+ if (hasAlphaChar && !this.options.allowPhonewords) {
3135
3138
  const beforeAlphaChar = val.substring(0, alphaCharPosition);
3136
3139
  const beforeAlphaIsValid = testValidity(beforeAlphaChar);
3137
3140
  const isValid = testValidity(val);
@@ -3232,7 +3235,7 @@ var intlTelInput = Object.assign(
3232
3235
  attachUtils,
3233
3236
  startedLoadingUtilsScript: false,
3234
3237
  startedLoadingAutoCountry: false,
3235
- version: "25.8.6"
3238
+ version: "25.10.0"
3236
3239
  }
3237
3240
  );
3238
3241
  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.0/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.
@@ -1,4 +1,4 @@
1
- import { mergeModels as k, useModel as M, ref as N, onMounted as E, watch as B, onUnmounted as R, withDirectives as F, createElementBlock as V, openBlock as z, mergeProps as O, vModelText as $ } from "vue";
1
+ import { mergeModels as A, useModel as M, ref as N, onMounted as E, watch as B, onUnmounted as R, withDirectives as F, createElementBlock as V, openBlock as z, mergeProps as O, vModelText as $ } from "vue";
2
2
  const j = [
3
3
  [
4
4
  "af",
@@ -1601,6 +1601,8 @@ const D = (u) => typeof window < "u" && typeof window.matchMedia == "function" &
1601
1601
  }
1602
1602
  return !1;
1603
1603
  }, x = {
1604
+ // Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
1605
+ allowPhonewords: !1,
1604
1606
  //* Whether or not to allow the dropdown.
1605
1607
  allowDropdown: !0,
1606
1608
  //* Add a placeholder in the input with an example number for the selected country.
@@ -1667,7 +1669,7 @@ const D = (u) => typeof window < "u" && typeof window.matchMedia == "function" &
1667
1669
  "887",
1668
1670
  "888",
1669
1671
  "889"
1670
- ], v = (u) => u.replace(/\D/g, ""), A = (u = "") => u.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), P = (u) => {
1672
+ ], v = (u) => u.replace(/\D/g, ""), k = (u = "") => u.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), P = (u) => {
1671
1673
  const t = v(u);
1672
1674
  if (t.charAt(0) === "1") {
1673
1675
  const e = t.substring(1, 4);
@@ -1725,7 +1727,7 @@ class L {
1725
1727
  //* Precompute and cache country search tokens to speed up filtering
1726
1728
  _cacheSearchTokens() {
1727
1729
  for (const t of this.countries)
1728
- t.normalisedName = A(t.name), t.initials = t.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((e) => e[0]).join("").toLowerCase(), t.dialCodePlus = `+${t.dialCode}`;
1730
+ t.normalisedName = k(t.name), t.initials = t.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((e) => e[0]).join("").toLowerCase(), t.dialCodePlus = `+${t.dialCode}`;
1729
1731
  }
1730
1732
  //* Sort countries by countryOrder option (if present), then name.
1731
1733
  _sortCountries() {
@@ -2167,7 +2169,7 @@ class L {
2167
2169
  _filterCountries(t, e = !1) {
2168
2170
  let i = !0;
2169
2171
  this.countryList.innerHTML = "";
2170
- const s = A(t), n = s.length, r = [], o = [], d = [], C = [], c = [], p = [];
2172
+ const s = k(t), n = s.length, r = [], o = [], d = [], C = [], c = [], p = [];
2171
2173
  for (const a of this.countries)
2172
2174
  e || n === 0 ? d.push(a) : a.iso2 === s ? r.push(a) : a.normalisedName.startsWith(s) ? o.push(a) : a.normalisedName.includes(s) ? d.push(a) : s === a.dialCode || s === a.dialCodePlus ? C.push(a) : a.dialCodePlus.includes(s) ? c.push(a) : a.initials.includes(s) && p.push(a);
2173
2175
  const y = [
@@ -2530,12 +2532,12 @@ class L {
2530
2532
  _validateNumber(t) {
2531
2533
  if (!this.selectedCountryData.iso2)
2532
2534
  return !1;
2533
- const e = this._getFullNumber(), i = e.search(new RegExp("\\p{L}", "u")), s = (n) => t ? this._utilsIsValidNumber(n) : this._utilsIsPossibleNumber(n);
2534
- if (i > -1) {
2535
- const n = e.substring(0, i), r = s(n), o = s(e);
2536
- return r && o;
2535
+ const e = (r) => t ? this._utilsIsValidNumber(r) : this._utilsIsPossibleNumber(r), i = this._getFullNumber(), s = i.search(new RegExp("\\p{L}", "u"));
2536
+ if (s > -1 && !this.options.allowPhonewords) {
2537
+ const r = i.substring(0, s), o = e(r), d = e(i);
2538
+ return o && d;
2537
2539
  }
2538
- return s(e);
2540
+ return e(i);
2539
2541
  }
2540
2542
  _utilsIsValidNumber(t) {
2541
2543
  return l.utils ? l.utils.isValidNumber(t, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
@@ -2600,11 +2602,11 @@ const Y = (u) => {
2600
2602
  attachUtils: Y,
2601
2603
  startedLoadingUtilsScript: !1,
2602
2604
  startedLoadingAutoCountry: !1,
2603
- version: "25.8.6"
2605
+ version: "25.10.0"
2604
2606
  }
2605
2607
  ), Z = {
2606
2608
  __name: "IntlTelInput",
2607
- props: /* @__PURE__ */ k({
2609
+ props: /* @__PURE__ */ A({
2608
2610
  disabled: {
2609
2611
  type: Boolean,
2610
2612
  default: !1
@@ -2628,7 +2630,7 @@ const Y = (u) => {
2628
2630
  },
2629
2631
  modelModifiers: {}
2630
2632
  }),
2631
- emits: /* @__PURE__ */ k([
2633
+ emits: /* @__PURE__ */ A([
2632
2634
  "changeNumber",
2633
2635
  "changeCountry",
2634
2636
  "changeValidity",