intl-tel-input 25.8.2 → 25.8.4

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/README.md CHANGED
@@ -77,16 +77,16 @@ _Note: We have now dropped support for all versions of Internet Explorer because
77
77
  ## Getting Started (Using a CDN)
78
78
  1. Add the CSS
79
79
  ```html
80
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@25.8.2/build/css/intlTelInput.css">
80
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@25.8.4/build/css/intlTelInput.css">
81
81
  ```
82
82
 
83
83
  2. Add the plugin script and initialise it on your input element
84
84
  ```html
85
- <script src="https://cdn.jsdelivr.net/npm/intl-tel-input@25.8.2/build/js/intlTelInput.min.js"></script>
85
+ <script src="https://cdn.jsdelivr.net/npm/intl-tel-input@25.8.4/build/js/intlTelInput.min.js"></script>
86
86
  <script>
87
87
  const input = document.querySelector("#phone");
88
88
  window.intlTelInput(input, {
89
- loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.8.2/build/js/utils.js"),
89
+ loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.8.4/build/js/utils.js"),
90
90
  });
91
91
  </script>
92
92
  ```
@@ -207,7 +207,7 @@ Automatically format the number as the user types. This feature will be disabled
207
207
 
208
208
  **formatOnDisplay**
209
209
  Type: `Boolean` Default: `true`
210
- Format the input value (according to the `nationalMode` option) during initialisation, and on `setNumber`. Requires the [utils script to be loaded](#loading-the-utilities-script).
210
+ Format the input value (according to the `nationalMode` option) during initialisation, when a new country is selected, on `setNumber` and on `setCountry`. Requires the [utils script to be loaded](#loading-the-utilities-script).
211
211
 
212
212
  **geoIpLookup**
213
213
  Type: `Function` Default: `null`
@@ -322,7 +322,7 @@ The `loadUtils` option takes a function which returns a Promise which resolves t
322
322
  ```js
323
323
  // (A) import utils module from a CDN
324
324
  intlTelInput(htmlInputElement, {
325
- loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.8.2/build/js/utils.js"),
325
+ loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.8.4/build/js/utils.js"),
326
326
  });
327
327
 
328
328
  // (B) import utils module from your own hosted version of utils.js
@@ -459,7 +459,7 @@ const isValid = iti.isValidNumberPrecise();
459
459
  Returns: `true`/`false`
460
460
 
461
461
  **setCountry**
462
- Change the selected country. It should be rare, if ever, that you need to do this, as the selected country gets updated automatically when calling `setNumber` and passing a number including an international dial code, which is the recommended usage. Note you can omit the country code argument to set the country to the default empty (globe) state.
462
+ Change the selected country. It should be rare, if ever, that you need to do this, as the selected country gets updated automatically when calling `setNumber` and passing a number including an international dial code, which is the recommended usage. Note you can omit the country code argument to set the country to the default empty (globe) state. _Note that if `formatOnDisplay` is enabled, this will attempt to format the number to either national or international format according to the `nationalMode` option._
463
463
  ```js
464
464
  iti.setCountry("gb");
465
465
  ```
@@ -606,7 +606,7 @@ The `loadUtils` option takes a function which returns a Promise which resolves t
606
606
  ```js
607
607
  // (A) import utils module from a CDN
608
608
  intlTelInput(htmlInputElement, {
609
- loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.8.2/build/js/utils.js"),
609
+ loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.8.4/build/js/utils.js"),
610
610
  });
611
611
 
612
612
  // (B) import utils module from your own hosted version of utils.js
package/angular/README.md CHANGED
@@ -29,7 +29,7 @@ import "intl-tel-input/styles";
29
29
 
30
30
  See the [Validation demo](https://github.com/jackocnr/intl-tel-input/blob/master/angular/demo/validation/validation.component.ts) for a more fleshed-out example of how to handle validation.
31
31
 
32
- 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/angularWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/angular"` 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.2/build/js/utils.js"`.
32
+ 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/angularWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/angular"` 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.4/build/js/utils.js"`.
33
33
 
34
34
  ## Props
35
35
  Here's a list of all of the current props you can pass to the IntlTelInput Angular component.
@@ -1946,7 +1946,7 @@ var Iti = class _Iti {
1946
1946
  this.dropdownArrow = createEl("div", { class: "iti__arrow", "aria-hidden": "true" }, selectedCountryPrimary);
1947
1947
  }
1948
1948
  if (separateDialCode) {
1949
- this.selectedDialCode = createEl("div", { class: "iti__selected-dial-code", "aria-hidden": "true", dir: "ltr" }, this.selectedCountry);
1949
+ this.selectedDialCode = createEl("div", { class: "iti__selected-dial-code", dir: "ltr" }, this.selectedCountry);
1950
1950
  }
1951
1951
  if (allowDropdown) {
1952
1952
  const extraClasses = fixDropdownWidth ? "" : "iti--flexible-dropdown-width";
@@ -2227,7 +2227,7 @@ var Iti = class _Iti {
2227
2227
  }
2228
2228
  //* Initialize the tel input listeners.
2229
2229
  _initTelInputListeners() {
2230
- const { strictMode, formatAsYouType, separateDialCode, formatOnDisplay, allowDropdown, countrySearch } = this.options;
2230
+ const { strictMode, formatAsYouType, separateDialCode, allowDropdown, countrySearch } = this.options;
2231
2231
  let userOverrideFormatting = false;
2232
2232
  if (/\p{L}/u.test(this.telInput.value)) {
2233
2233
  userOverrideFormatting = true;
@@ -2251,8 +2251,8 @@ var Iti = class _Iti {
2251
2251
  } else if (!/[^+0-9]/.test(this.telInput.value)) {
2252
2252
  userOverrideFormatting = false;
2253
2253
  }
2254
- const disableFormatOnSetNumber = (e === null || e === void 0 ? void 0 : e.detail) && e.detail["isSetNumber"] && !formatOnDisplay;
2255
- if (formatAsYouType && !userOverrideFormatting && !disableFormatOnSetNumber) {
2254
+ const isSetNumber = (e === null || e === void 0 ? void 0 : e.detail) && e.detail["isSetNumber"];
2255
+ if (formatAsYouType && !userOverrideFormatting && !isSetNumber) {
2256
2256
  const currentCaretPos = this.telInput.selectionStart || 0;
2257
2257
  const valueBeforeCaret = this.telInput.value.substring(0, currentCaretPos);
2258
2258
  const relevantCharsBeforeCaret = valueBeforeCaret.replace(/[^+0-9]/g, "").length;
@@ -2645,20 +2645,20 @@ var Iti = class _Iti {
2645
2645
  if (this.selectedCountryData.iso2) {
2646
2646
  this.defaultCountry = this.selectedCountryData.iso2;
2647
2647
  }
2648
- if (this.selectedCountryInner) {
2649
- let flagClass = "";
2650
- let ariaLabel = "";
2651
- if (iso2 && showFlags) {
2652
- flagClass = `iti__flag iti__${iso2}`;
2648
+ if (this.selectedCountry) {
2649
+ const flagClass = iso2 && showFlags ? `iti__flag iti__${iso2}` : "iti__flag iti__globe";
2650
+ let ariaLabel, title;
2651
+ if (iso2) {
2652
+ title = this.selectedCountryData.name;
2653
2653
  ariaLabel = i18n.selectedCountryAriaLabel.replace("${country}", this.selectedCountryData.name);
2654
2654
  } else {
2655
- flagClass = "iti__flag iti__globe";
2655
+ title = i18n.noCountrySelected;
2656
2656
  ariaLabel = i18n.noCountrySelected;
2657
2657
  }
2658
2658
  this.selectedCountryInner.className = flagClass;
2659
+ this.selectedCountry.setAttribute("title", title);
2659
2660
  this.selectedCountry.setAttribute("aria-label", ariaLabel);
2660
2661
  }
2661
- this._setSelectedCountryTitleAttribute(iso2, separateDialCode);
2662
2662
  if (separateDialCode) {
2663
2663
  const dialCode = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
2664
2664
  this.selectedDialCode.innerHTML = dialCode;
@@ -2703,20 +2703,6 @@ var Iti = class _Iti {
2703
2703
  }
2704
2704
  }
2705
2705
  }
2706
- _setSelectedCountryTitleAttribute(iso2 = null, separateDialCode) {
2707
- if (!this.selectedCountry) {
2708
- return;
2709
- }
2710
- let title;
2711
- if (iso2 && !separateDialCode) {
2712
- title = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}`;
2713
- } else if (iso2) {
2714
- title = this.selectedCountryData.name;
2715
- } else {
2716
- title = this.options.i18n.noCountrySelected;
2717
- }
2718
- this.selectedCountry.setAttribute("title", title);
2719
- }
2720
2706
  //* When the input is in a hidden container during initialisation, we must inject some markup
2721
2707
  //* into the end of the DOM to calculate the correct offsetWidth.
2722
2708
  //* NOTE: this is only used when separateDialCode is enabled, so countryContainer and selectedCountry
@@ -2755,6 +2741,9 @@ var Iti = class _Iti {
2755
2741
  const countryChanged = this._setCountry(listItem.getAttribute("data-country-code"));
2756
2742
  this._closeDropdown();
2757
2743
  this._updateDialCode(listItem.getAttribute("data-dial-code"));
2744
+ if (this.options.formatOnDisplay) {
2745
+ this._updateValFromNumber(this.telInput.value);
2746
+ }
2758
2747
  this.telInput.focus();
2759
2748
  if (countryChanged) {
2760
2749
  this._triggerCountryChange();
@@ -3031,6 +3020,9 @@ var Iti = class _Iti {
3031
3020
  if (isCountryChange) {
3032
3021
  this._setCountry(iso2Lower);
3033
3022
  this._updateDialCode(this.selectedCountryData.dialCode);
3023
+ if (this.options.formatOnDisplay) {
3024
+ this._updateValFromNumber(this.telInput.value);
3025
+ }
3034
3026
  this._triggerCountryChange();
3035
3027
  }
3036
3028
  }
@@ -3108,7 +3100,7 @@ var intlTelInput = Object.assign((input, options) => {
3108
3100
  attachUtils,
3109
3101
  startedLoadingUtilsScript: false,
3110
3102
  startedLoadingAutoCountry: false,
3111
- version: "25.8.2"
3103
+ version: "25.8.4"
3112
3104
  });
3113
3105
  var intl_tel_input_default = intlTelInput;
3114
3106
 
@@ -1946,7 +1946,7 @@ var Iti = class _Iti {
1946
1946
  this.dropdownArrow = createEl("div", { class: "iti__arrow", "aria-hidden": "true" }, selectedCountryPrimary);
1947
1947
  }
1948
1948
  if (separateDialCode) {
1949
- this.selectedDialCode = createEl("div", { class: "iti__selected-dial-code", "aria-hidden": "true", dir: "ltr" }, this.selectedCountry);
1949
+ this.selectedDialCode = createEl("div", { class: "iti__selected-dial-code", dir: "ltr" }, this.selectedCountry);
1950
1950
  }
1951
1951
  if (allowDropdown) {
1952
1952
  const extraClasses = fixDropdownWidth ? "" : "iti--flexible-dropdown-width";
@@ -2227,7 +2227,7 @@ var Iti = class _Iti {
2227
2227
  }
2228
2228
  //* Initialize the tel input listeners.
2229
2229
  _initTelInputListeners() {
2230
- const { strictMode, formatAsYouType, separateDialCode, formatOnDisplay, allowDropdown, countrySearch } = this.options;
2230
+ const { strictMode, formatAsYouType, separateDialCode, allowDropdown, countrySearch } = this.options;
2231
2231
  let userOverrideFormatting = false;
2232
2232
  if (/\p{L}/u.test(this.telInput.value)) {
2233
2233
  userOverrideFormatting = true;
@@ -2251,8 +2251,8 @@ var Iti = class _Iti {
2251
2251
  } else if (!/[^+0-9]/.test(this.telInput.value)) {
2252
2252
  userOverrideFormatting = false;
2253
2253
  }
2254
- const disableFormatOnSetNumber = (e === null || e === void 0 ? void 0 : e.detail) && e.detail["isSetNumber"] && !formatOnDisplay;
2255
- if (formatAsYouType && !userOverrideFormatting && !disableFormatOnSetNumber) {
2254
+ const isSetNumber = (e === null || e === void 0 ? void 0 : e.detail) && e.detail["isSetNumber"];
2255
+ if (formatAsYouType && !userOverrideFormatting && !isSetNumber) {
2256
2256
  const currentCaretPos = this.telInput.selectionStart || 0;
2257
2257
  const valueBeforeCaret = this.telInput.value.substring(0, currentCaretPos);
2258
2258
  const relevantCharsBeforeCaret = valueBeforeCaret.replace(/[^+0-9]/g, "").length;
@@ -2645,20 +2645,20 @@ var Iti = class _Iti {
2645
2645
  if (this.selectedCountryData.iso2) {
2646
2646
  this.defaultCountry = this.selectedCountryData.iso2;
2647
2647
  }
2648
- if (this.selectedCountryInner) {
2649
- let flagClass = "";
2650
- let ariaLabel = "";
2651
- if (iso2 && showFlags) {
2652
- flagClass = `iti__flag iti__${iso2}`;
2648
+ if (this.selectedCountry) {
2649
+ const flagClass = iso2 && showFlags ? `iti__flag iti__${iso2}` : "iti__flag iti__globe";
2650
+ let ariaLabel, title;
2651
+ if (iso2) {
2652
+ title = this.selectedCountryData.name;
2653
2653
  ariaLabel = i18n.selectedCountryAriaLabel.replace("${country}", this.selectedCountryData.name);
2654
2654
  } else {
2655
- flagClass = "iti__flag iti__globe";
2655
+ title = i18n.noCountrySelected;
2656
2656
  ariaLabel = i18n.noCountrySelected;
2657
2657
  }
2658
2658
  this.selectedCountryInner.className = flagClass;
2659
+ this.selectedCountry.setAttribute("title", title);
2659
2660
  this.selectedCountry.setAttribute("aria-label", ariaLabel);
2660
2661
  }
2661
- this._setSelectedCountryTitleAttribute(iso2, separateDialCode);
2662
2662
  if (separateDialCode) {
2663
2663
  const dialCode = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
2664
2664
  this.selectedDialCode.innerHTML = dialCode;
@@ -2703,20 +2703,6 @@ var Iti = class _Iti {
2703
2703
  }
2704
2704
  }
2705
2705
  }
2706
- _setSelectedCountryTitleAttribute(iso2 = null, separateDialCode) {
2707
- if (!this.selectedCountry) {
2708
- return;
2709
- }
2710
- let title;
2711
- if (iso2 && !separateDialCode) {
2712
- title = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}`;
2713
- } else if (iso2) {
2714
- title = this.selectedCountryData.name;
2715
- } else {
2716
- title = this.options.i18n.noCountrySelected;
2717
- }
2718
- this.selectedCountry.setAttribute("title", title);
2719
- }
2720
2706
  //* When the input is in a hidden container during initialisation, we must inject some markup
2721
2707
  //* into the end of the DOM to calculate the correct offsetWidth.
2722
2708
  //* NOTE: this is only used when separateDialCode is enabled, so countryContainer and selectedCountry
@@ -2755,6 +2741,9 @@ var Iti = class _Iti {
2755
2741
  const countryChanged = this._setCountry(listItem.getAttribute("data-country-code"));
2756
2742
  this._closeDropdown();
2757
2743
  this._updateDialCode(listItem.getAttribute("data-dial-code"));
2744
+ if (this.options.formatOnDisplay) {
2745
+ this._updateValFromNumber(this.telInput.value);
2746
+ }
2758
2747
  this.telInput.focus();
2759
2748
  if (countryChanged) {
2760
2749
  this._triggerCountryChange();
@@ -3031,6 +3020,9 @@ var Iti = class _Iti {
3031
3020
  if (isCountryChange) {
3032
3021
  this._setCountry(iso2Lower);
3033
3022
  this._updateDialCode(this.selectedCountryData.dialCode);
3023
+ if (this.options.formatOnDisplay) {
3024
+ this._updateValFromNumber(this.telInput.value);
3025
+ }
3034
3026
  this._triggerCountryChange();
3035
3027
  }
3036
3028
  }
@@ -3108,7 +3100,7 @@ var intlTelInput = Object.assign((input, options) => {
3108
3100
  attachUtils,
3109
3101
  startedLoadingUtilsScript: false,
3110
3102
  startedLoadingAutoCountry: false,
3111
- version: "25.8.2"
3103
+ version: "25.8.4"
3112
3104
  });
3113
3105
  var intl_tel_input_default = intlTelInput;
3114
3106
 
@@ -176,7 +176,6 @@ export declare class Iti {
176
176
  private _setCountry;
177
177
  private _updateInputPadding;
178
178
  private _updateMaxLength;
179
- private _setSelectedCountryTitleAttribute;
180
179
  private _getHiddenSelectedCountryWidth;
181
180
  private _updatePlaceholder;
182
181
  private _selectListItem;
package/build/js/data.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * International Telephone Input v25.8.2
2
+ * International Telephone Input v25.8.4
3
3
  * https://github.com/jackocnr/intl-tel-input.git
4
4
  * Licensed under the MIT license
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*
2
- * International Telephone Input v25.8.2
2
+ * International Telephone Input v25.8.4
3
3
  * https://github.com/jackocnr/intl-tel-input.git
4
4
  * Licensed under the MIT license
5
5
  */
@@ -470,7 +470,6 @@ declare module "intl-tel-input" {
470
470
  private _setCountry;
471
471
  private _updateInputPadding;
472
472
  private _updateMaxLength;
473
- private _setSelectedCountryTitleAttribute;
474
473
  private _getHiddenSelectedCountryWidth;
475
474
  private _updatePlaceholder;
476
475
  private _selectListItem;
@@ -1,5 +1,5 @@
1
1
  /*
2
- * International Telephone Input v25.8.2
2
+ * International Telephone Input v25.8.4
3
3
  * https://github.com/jackocnr/intl-tel-input.git
4
4
  * Licensed under the MIT license
5
5
  */
@@ -2031,7 +2031,7 @@ var factoryOutput = (() => {
2031
2031
  if (separateDialCode) {
2032
2032
  this.selectedDialCode = createEl(
2033
2033
  "div",
2034
- { class: "iti__selected-dial-code", "aria-hidden": "true", dir: "ltr" },
2034
+ { class: "iti__selected-dial-code", dir: "ltr" },
2035
2035
  this.selectedCountry
2036
2036
  );
2037
2037
  }
@@ -2353,7 +2353,7 @@ var factoryOutput = (() => {
2353
2353
  }
2354
2354
  //* Initialize the tel input listeners.
2355
2355
  _initTelInputListeners() {
2356
- const { strictMode, formatAsYouType, separateDialCode, formatOnDisplay, allowDropdown, countrySearch } = this.options;
2356
+ const { strictMode, formatAsYouType, separateDialCode, allowDropdown, countrySearch } = this.options;
2357
2357
  let userOverrideFormatting = false;
2358
2358
  if (/\p{L}/u.test(this.telInput.value)) {
2359
2359
  userOverrideFormatting = true;
@@ -2377,8 +2377,8 @@ var factoryOutput = (() => {
2377
2377
  } else if (!/[^+0-9]/.test(this.telInput.value)) {
2378
2378
  userOverrideFormatting = false;
2379
2379
  }
2380
- const disableFormatOnSetNumber = e?.detail && e.detail["isSetNumber"] && !formatOnDisplay;
2381
- if (formatAsYouType && !userOverrideFormatting && !disableFormatOnSetNumber) {
2380
+ const isSetNumber = e?.detail && e.detail["isSetNumber"];
2381
+ if (formatAsYouType && !userOverrideFormatting && !isSetNumber) {
2382
2382
  const currentCaretPos = this.telInput.selectionStart || 0;
2383
2383
  const valueBeforeCaret = this.telInput.value.substring(0, currentCaretPos);
2384
2384
  const relevantCharsBeforeCaret = valueBeforeCaret.replace(/[^+0-9]/g, "").length;
@@ -2778,20 +2778,20 @@ var factoryOutput = (() => {
2778
2778
  if (this.selectedCountryData.iso2) {
2779
2779
  this.defaultCountry = this.selectedCountryData.iso2;
2780
2780
  }
2781
- if (this.selectedCountryInner) {
2782
- let flagClass = "";
2783
- let ariaLabel = "";
2784
- if (iso2 && showFlags) {
2785
- flagClass = `iti__flag iti__${iso2}`;
2781
+ if (this.selectedCountry) {
2782
+ const flagClass = iso2 && showFlags ? `iti__flag iti__${iso2}` : "iti__flag iti__globe";
2783
+ let ariaLabel, title;
2784
+ if (iso2) {
2785
+ title = this.selectedCountryData.name;
2786
2786
  ariaLabel = i18n.selectedCountryAriaLabel.replace("${country}", this.selectedCountryData.name);
2787
2787
  } else {
2788
- flagClass = "iti__flag iti__globe";
2788
+ title = i18n.noCountrySelected;
2789
2789
  ariaLabel = i18n.noCountrySelected;
2790
2790
  }
2791
2791
  this.selectedCountryInner.className = flagClass;
2792
+ this.selectedCountry.setAttribute("title", title);
2792
2793
  this.selectedCountry.setAttribute("aria-label", ariaLabel);
2793
2794
  }
2794
- this._setSelectedCountryTitleAttribute(iso2, separateDialCode);
2795
2795
  if (separateDialCode) {
2796
2796
  const dialCode = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
2797
2797
  this.selectedDialCode.innerHTML = dialCode;
@@ -2841,20 +2841,6 @@ var factoryOutput = (() => {
2841
2841
  }
2842
2842
  }
2843
2843
  }
2844
- _setSelectedCountryTitleAttribute(iso2 = null, separateDialCode) {
2845
- if (!this.selectedCountry) {
2846
- return;
2847
- }
2848
- let title;
2849
- if (iso2 && !separateDialCode) {
2850
- title = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}`;
2851
- } else if (iso2) {
2852
- title = this.selectedCountryData.name;
2853
- } else {
2854
- title = this.options.i18n.noCountrySelected;
2855
- }
2856
- this.selectedCountry.setAttribute("title", title);
2857
- }
2858
2844
  //* When the input is in a hidden container during initialisation, we must inject some markup
2859
2845
  //* into the end of the DOM to calculate the correct offsetWidth.
2860
2846
  //* NOTE: this is only used when separateDialCode is enabled, so countryContainer and selectedCountry
@@ -2904,6 +2890,9 @@ var factoryOutput = (() => {
2904
2890
  );
2905
2891
  this._closeDropdown();
2906
2892
  this._updateDialCode(listItem.getAttribute("data-dial-code"));
2893
+ if (this.options.formatOnDisplay) {
2894
+ this._updateValFromNumber(this.telInput.value);
2895
+ }
2907
2896
  this.telInput.focus();
2908
2897
  if (countryChanged) {
2909
2898
  this._triggerCountryChange();
@@ -3201,6 +3190,9 @@ var factoryOutput = (() => {
3201
3190
  if (isCountryChange) {
3202
3191
  this._setCountry(iso2Lower);
3203
3192
  this._updateDialCode(this.selectedCountryData.dialCode);
3193
+ if (this.options.formatOnDisplay) {
3194
+ this._updateValFromNumber(this.telInput.value);
3195
+ }
3204
3196
  this._triggerCountryChange();
3205
3197
  }
3206
3198
  }
@@ -3280,7 +3272,7 @@ var factoryOutput = (() => {
3280
3272
  attachUtils,
3281
3273
  startedLoadingUtilsScript: false,
3282
3274
  startedLoadingAutoCountry: false,
3283
- version: "25.8.2"
3275
+ version: "25.8.4"
3284
3276
  }
3285
3277
  );
3286
3278
  var intl_tel_input_default = intlTelInput;