intl-tel-input 19.2.14 → 19.2.15

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.
@@ -5,15 +5,11 @@ import React from 'react';
5
5
  import { createRoot } from 'react-dom/client';
6
6
  import IntlTelInput from '../build/IntlTelInput.cjs';
7
7
 
8
- // defined in package.json scripts section
9
- const version = process.env.VERSION;
10
-
11
8
  const App = () => (
12
9
  <IntlTelInput
13
10
  initOptions={{
14
11
  initialCountry: "us",
15
- // use a CDN so it also works on intl-tel-input.com
16
- utilsScript: `https://cdn.jsdelivr.net/npm/intl-tel-input@${version}/build/js/utils.js`,
12
+ utilsScript: "../../build/js/utils.js",
17
13
  }}
18
14
  />
19
15
  );
@@ -13947,11 +13947,11 @@ var require_react_dom_development = __commonJS({
13947
13947
  }
13948
13948
  function registerMutableSourceForHydration(root3, mutableSource) {
13949
13949
  var getVersion = mutableSource._getVersion;
13950
- var version2 = getVersion(mutableSource._source);
13950
+ var version = getVersion(mutableSource._source);
13951
13951
  if (root3.mutableSourceEagerHydrationData == null) {
13952
- root3.mutableSourceEagerHydrationData = [mutableSource, version2];
13952
+ root3.mutableSourceEagerHydrationData = [mutableSource, version];
13953
13953
  } else {
13954
- root3.mutableSourceEagerHydrationData.push(mutableSource, version2);
13954
+ root3.mutableSourceEagerHydrationData.push(mutableSource, version);
13955
13955
  }
13956
13956
  }
13957
13957
  var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig;
@@ -24807,7 +24807,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24807
24807
  return i;
24808
24808
  } }, { key: "_getFullNumber", value: function() {
24809
24809
  var t = this.telInput.value.trim(), e = this.selectedCountryData.dialCode, i, o = this._getNumeric(t);
24810
- return this.options.showSelectedDialCode && t.charAt(0) !== "+" && e && o ? i = "+".concat(e) : i = "", i + t;
24810
+ return this.options.showSelectedDialCode && !this.options.nationalMode && t.charAt(0) !== "+" && e && o ? i = "+".concat(e) : i = "", i + t;
24811
24811
  } }, { key: "_beforeSetNumber", value: function(t) {
24812
24812
  var e = t;
24813
24813
  if (this.options.showSelectedDialCode) {
@@ -24822,9 +24822,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24822
24822
  } }, { key: "_triggerCountryChange", value: function() {
24823
24823
  this._trigger("countrychange");
24824
24824
  } }, { key: "_formatNumberAsYouType", value: function() {
24825
- var t = this._getFullNumber().trim(), e = window.intlTelInputUtils ? intlTelInputUtils.formatNumberAsYouType(t, this.selectedCountryData.iso2) : t;
24826
- if (this.options.showSelectedDialCode && this.telInput.value.charAt(0) !== "+") {
24827
- var i = this.selectedCountryData.dialCode, o = e.split("+".concat(i))[1] || "";
24825
+ var t = this._getFullNumber(), e = window.intlTelInputUtils ? intlTelInputUtils.formatNumberAsYouType(t, this.selectedCountryData.iso2) : t, i = this.selectedCountryData.dialCode;
24826
+ if (this.options.showSelectedDialCode && !this.options.nationalMode && this.telInput.value.charAt(0) !== "+" && e.includes("+".concat(i))) {
24827
+ var o = e.split("+".concat(i))[1] || "";
24828
24828
  return o.trim();
24829
24829
  }
24830
24830
  return e;
@@ -24861,10 +24861,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24861
24861
  }
24862
24862
  return -99;
24863
24863
  } }, { key: "isValidNumber", value: function() {
24864
- var t = this._getFullNumber().trim();
24864
+ var t = this._getFullNumber();
24865
24865
  return window.intlTelInputUtils ? intlTelInputUtils.isPossibleNumber(t, this.selectedCountryData.iso2) : null;
24866
24866
  } }, { key: "isValidNumberPrecise", value: function() {
24867
- var t = this._getFullNumber().trim();
24867
+ var t = this._getFullNumber();
24868
24868
  return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(t, this.selectedCountryData.iso2) : null;
24869
24869
  } }, { key: "setCountry", value: function(t) {
24870
24870
  var e = t.toLowerCase();
@@ -24896,7 +24896,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24896
24896
  R(s);
24897
24897
  }
24898
24898
  return null;
24899
- }, S.defaults = G, S.version = "19.2.14", function(s, n) {
24899
+ }, S.defaults = G, S.version = "19.2.15", function(s, n) {
24900
24900
  var t = new Y(s, n);
24901
24901
  return t._init(), s.setAttribute("data-intl-tel-input-id", t.id), window.intlTelInputGlobals.instances[t.id] = t, t;
24902
24902
  };
@@ -24942,14 +24942,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24942
24942
  var import_react = __toESM(require_react());
24943
24943
  var import_client = __toESM(require_client());
24944
24944
  var import_IntlTelInput = __toESM(require_IntlTelInput_cjs());
24945
- var version = "19.2.14";
24946
24945
  var App = () => /* @__PURE__ */ import_react.default.createElement(
24947
24946
  import_IntlTelInput.default,
24948
24947
  {
24949
24948
  initOptions: {
24950
24949
  initialCountry: "us",
24951
- // use a CDN so it also works on intl-tel-input.com
24952
- utilsScript: `https://cdn.jsdelivr.net/npm/intl-tel-input@${version}/build/js/utils.js`
24950
+ utilsScript: "../../build/js/utils.js"
24953
24951
  }
24954
24952
  }
24955
24953
  );
@@ -24807,7 +24807,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24807
24807
  return i;
24808
24808
  } }, { key: "_getFullNumber", value: function() {
24809
24809
  var t = this.telInput.value.trim(), e = this.selectedCountryData.dialCode, i, o = this._getNumeric(t);
24810
- return this.options.showSelectedDialCode && t.charAt(0) !== "+" && e && o ? i = "+".concat(e) : i = "", i + t;
24810
+ return this.options.showSelectedDialCode && !this.options.nationalMode && t.charAt(0) !== "+" && e && o ? i = "+".concat(e) : i = "", i + t;
24811
24811
  } }, { key: "_beforeSetNumber", value: function(t) {
24812
24812
  var e = t;
24813
24813
  if (this.options.showSelectedDialCode) {
@@ -24822,9 +24822,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24822
24822
  } }, { key: "_triggerCountryChange", value: function() {
24823
24823
  this._trigger("countrychange");
24824
24824
  } }, { key: "_formatNumberAsYouType", value: function() {
24825
- var t = this._getFullNumber().trim(), e = window.intlTelInputUtils ? intlTelInputUtils.formatNumberAsYouType(t, this.selectedCountryData.iso2) : t;
24826
- if (this.options.showSelectedDialCode && this.telInput.value.charAt(0) !== "+") {
24827
- var i = this.selectedCountryData.dialCode, o = e.split("+".concat(i))[1] || "";
24825
+ var t = this._getFullNumber(), e = window.intlTelInputUtils ? intlTelInputUtils.formatNumberAsYouType(t, this.selectedCountryData.iso2) : t, i = this.selectedCountryData.dialCode;
24826
+ if (this.options.showSelectedDialCode && !this.options.nationalMode && this.telInput.value.charAt(0) !== "+" && e.includes("+".concat(i))) {
24827
+ var o = e.split("+".concat(i))[1] || "";
24828
24828
  return o.trim();
24829
24829
  }
24830
24830
  return e;
@@ -24861,10 +24861,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24861
24861
  }
24862
24862
  return -99;
24863
24863
  } }, { key: "isValidNumber", value: function() {
24864
- var t = this._getFullNumber().trim();
24864
+ var t = this._getFullNumber();
24865
24865
  return window.intlTelInputUtils ? intlTelInputUtils.isPossibleNumber(t, this.selectedCountryData.iso2) : null;
24866
24866
  } }, { key: "isValidNumberPrecise", value: function() {
24867
- var t = this._getFullNumber().trim();
24867
+ var t = this._getFullNumber();
24868
24868
  return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(t, this.selectedCountryData.iso2) : null;
24869
24869
  } }, { key: "setCountry", value: function(t) {
24870
24870
  var e = t.toLowerCase();
@@ -24896,7 +24896,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24896
24896
  R(s);
24897
24897
  }
24898
24898
  return null;
24899
- }, S.defaults = G, S.version = "19.2.14", function(s, n) {
24899
+ }, S.defaults = G, S.version = "19.2.15", function(s, n) {
24900
24900
  var t = new Y(s, n);
24901
24901
  return t._init(), s.setAttribute("data-intl-tel-input-id", t.id), window.intlTelInputGlobals.instances[t.id] = t, t;
24902
24902
  };
@@ -1614,6 +1614,7 @@ class Iti {
1614
1614
 
1615
1615
  if (
1616
1616
  this.options.showSelectedDialCode &&
1617
+ !this.options.nationalMode &&
1617
1618
  val.charAt(0) !== "+" &&
1618
1619
  dialCode &&
1619
1620
  numericVal
@@ -1658,13 +1659,18 @@ class Iti {
1658
1659
 
1659
1660
  // format the number as the user types
1660
1661
  _formatNumberAsYouType() {
1661
- const val = this._getFullNumber().trim();
1662
+ const val = this._getFullNumber();
1662
1663
  const result = window.intlTelInputUtils
1663
1664
  ? intlTelInputUtils.formatNumberAsYouType(val, this.selectedCountryData.iso2)
1664
1665
  : val;
1665
1666
  // if showSelectedDialCode and they haven't (re)typed the dial code in the input as well, then remove the dial code
1666
- if (this.options.showSelectedDialCode && this.telInput.value.charAt(0) !== '+') {
1667
- const { dialCode } = this.selectedCountryData;
1667
+ const { dialCode } = this.selectedCountryData;
1668
+ if (
1669
+ this.options.showSelectedDialCode &&
1670
+ !this.options.nationalMode &&
1671
+ this.telInput.value.charAt(0) !== "+" &&
1672
+ result.includes(`+${dialCode}`)
1673
+ ) {
1668
1674
  const afterDialCode = result.split(`+${dialCode}`)[1] || "";
1669
1675
  return afterDialCode.trim();
1670
1676
  }
@@ -1808,7 +1814,7 @@ class Iti {
1808
1814
 
1809
1815
  // validate the input val - assumes the global function isPossibleNumber (from utilsScript)
1810
1816
  isValidNumber() {
1811
- const val = this._getFullNumber().trim();
1817
+ const val = this._getFullNumber();
1812
1818
  return window.intlTelInputUtils
1813
1819
  ? intlTelInputUtils.isPossibleNumber(val, this.selectedCountryData.iso2)
1814
1820
  : null;
@@ -1816,7 +1822,7 @@ class Iti {
1816
1822
 
1817
1823
  // validate the input val (precise) - assumes the global function isValidNumber (from utilsScript)
1818
1824
  isValidNumberPrecise() {
1819
- const val = this._getFullNumber().trim();
1825
+ const val = this._getFullNumber();
1820
1826
  return window.intlTelInputUtils
1821
1827
  ? intlTelInputUtils.isValidNumber(val, this.selectedCountryData.iso2)
1822
1828
  : null;