intl-tel-input 25.8.5 → 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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * International Telephone Input v25.8.5
2
+ * International Telephone Input v25.10.0
3
3
  * https://github.com/jackocnr/intl-tel-input.git
4
4
  * Licensed under the MIT license
5
5
  */
@@ -1628,7 +1628,7 @@ var factoryOutput = (() => {
1628
1628
 
1629
1629
  // src/js/intl-tel-input/i18n/en/interface.ts
1630
1630
  var interfaceTranslations = {
1631
- selectedCountryAriaLabel: "Change country, selected ${country}",
1631
+ selectedCountryAriaLabel: "Change country, selected ${countryName} (${dialCode})",
1632
1632
  noCountrySelected: "Select country",
1633
1633
  countryListAriaLabel: "List of countries",
1634
1634
  searchPlaceholder: "Search",
@@ -1665,6 +1665,8 @@ var factoryOutput = (() => {
1665
1665
  return false;
1666
1666
  };
1667
1667
  var defaults = {
1668
+ // Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
1669
+ allowPhonewords: false,
1668
1670
  //* Whether or not to allow the dropdown.
1669
1671
  allowDropdown: true,
1670
1672
  //* Add a placeholder in the input with an example number for the selected country.
@@ -2772,7 +2774,7 @@ var factoryOutput = (() => {
2772
2774
  //* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
2773
2775
  _setCountry(iso2) {
2774
2776
  const { separateDialCode, showFlags, i18n } = this.options;
2775
- const prevCountry = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
2777
+ const prevIso2 = this.selectedCountryData.iso2 || "";
2776
2778
  this.selectedCountryData = iso2 ? this._getCountryData(iso2, false) || {} : {};
2777
2779
  if (this.selectedCountryData.iso2) {
2778
2780
  this.defaultCountry = this.selectedCountryData.iso2;
@@ -2781,8 +2783,9 @@ var factoryOutput = (() => {
2781
2783
  const flagClass = iso2 && showFlags ? `iti__flag iti__${iso2}` : "iti__flag iti__globe";
2782
2784
  let ariaLabel, title;
2783
2785
  if (iso2) {
2784
- title = this.selectedCountryData.name;
2785
- ariaLabel = i18n.selectedCountryAriaLabel.replace("${country}", this.selectedCountryData.name);
2786
+ const { name, dialCode } = this.selectedCountryData;
2787
+ title = name;
2788
+ ariaLabel = i18n.selectedCountryAriaLabel.replace("${countryName}", name).replace("${dialCode}", `+${dialCode}`);
2786
2789
  } else {
2787
2790
  title = i18n.noCountrySelected;
2788
2791
  ariaLabel = i18n.noCountrySelected;
@@ -2798,7 +2801,7 @@ var factoryOutput = (() => {
2798
2801
  }
2799
2802
  this._updatePlaceholder();
2800
2803
  this._updateMaxLength();
2801
- return prevCountry.iso2 !== iso2;
2804
+ return prevIso2 !== iso2;
2802
2805
  }
2803
2806
  //* Update the input padding to make space for the selected country/dial code.
2804
2807
  _updateInputPadding() {
@@ -3167,10 +3170,11 @@ var factoryOutput = (() => {
3167
3170
  if (!this.selectedCountryData.iso2) {
3168
3171
  return false;
3169
3172
  }
3173
+ const testValidity = (s) => precise ? this._utilsIsValidNumber(s) : this._utilsIsPossibleNumber(s);
3170
3174
  const val = this._getFullNumber();
3171
3175
  const alphaCharPosition = val.search(/\p{L}/u);
3172
- const testValidity = (s) => precise ? this._utilsIsValidNumber(s) : this._utilsIsPossibleNumber(s);
3173
- if (alphaCharPosition > -1) {
3176
+ const hasAlphaChar = alphaCharPosition > -1;
3177
+ if (hasAlphaChar && !this.options.allowPhonewords) {
3174
3178
  const beforeAlphaChar = val.substring(0, alphaCharPosition);
3175
3179
  const beforeAlphaIsValid = testValidity(beforeAlphaChar);
3176
3180
  const isValid = testValidity(val);
@@ -3271,7 +3275,7 @@ var factoryOutput = (() => {
3271
3275
  attachUtils,
3272
3276
  startedLoadingUtilsScript: false,
3273
3277
  startedLoadingAutoCountry: false,
3274
- version: "25.8.5"
3278
+ version: "25.10.0"
3275
3279
  }
3276
3280
  );
3277
3281
  var intl_tel_input_default = intlTelInput;