intl-tel-input 19.2.14 → 19.2.16

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.
@@ -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;