intl-tel-input 25.8.1 → 25.8.3

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.1",
3
+ "version": "25.8.3",
4
4
  "description": "A JavaScript plugin for entering and validating international telephone numbers",
5
5
  "keywords": [
6
6
  "international",
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.1/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.8.3/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.
@@ -1624,8 +1624,8 @@ var countries_default = countryTranslations;
1624
1624
 
1625
1625
  // src/js/intl-tel-input/i18n/en/interface.ts
1626
1626
  var interfaceTranslations = {
1627
- selectedCountryAriaLabel: "Selected country",
1628
- noCountrySelected: "No country selected",
1627
+ selectedCountryAriaLabel: "Change country, selected ${country}",
1628
+ noCountrySelected: "Select country",
1629
1629
  countryListAriaLabel: "List of countries",
1630
1630
  searchPlaceholder: "Search",
1631
1631
  clearSearchAriaLabel: "Clear search",
@@ -1990,7 +1990,7 @@ var Iti = class _Iti {
1990
1990
  type: "button",
1991
1991
  class: "iti__selected-country",
1992
1992
  "aria-expanded": "false",
1993
- "aria-label": this.options.i18n.selectedCountryAriaLabel,
1993
+ "aria-label": this.options.i18n.noCountrySelected,
1994
1994
  "aria-haspopup": "dialog",
1995
1995
  "aria-controls": `iti-${this.id}__dropdown-content`
1996
1996
  },
@@ -2006,12 +2006,15 @@ var Iti = class _Iti {
2006
2006
  this.countryContainer
2007
2007
  );
2008
2008
  }
2009
- const selectedCountryPrimary = createEl("div", { class: "iti__selected-country-primary" }, this.selectedCountry);
2010
- this.selectedCountryInner = createEl("div", { class: "iti__flag" }, selectedCountryPrimary);
2011
- this.selectedCountryA11yText = createEl(
2012
- "span",
2013
- { class: "iti__a11y-text" },
2014
- this.selectedCountryInner
2009
+ const selectedCountryPrimary = createEl(
2010
+ "div",
2011
+ { class: "iti__selected-country-primary" },
2012
+ this.selectedCountry
2013
+ );
2014
+ this.selectedCountryInner = createEl(
2015
+ "div",
2016
+ { class: "iti__flag" },
2017
+ selectedCountryPrimary
2015
2018
  );
2016
2019
  if (allowDropdown) {
2017
2020
  this.dropdownArrow = createEl(
@@ -2023,7 +2026,7 @@ var Iti = class _Iti {
2023
2026
  if (separateDialCode) {
2024
2027
  this.selectedDialCode = createEl(
2025
2028
  "div",
2026
- { class: "iti__selected-dial-code", "aria-hidden": "true", dir: "ltr" },
2029
+ { class: "iti__selected-dial-code", dir: "ltr" },
2027
2030
  this.selectedCountry
2028
2031
  );
2029
2032
  }
@@ -2265,7 +2268,8 @@ var Iti = class _Iti {
2265
2268
  label.addEventListener("click", this._handleLabelClick);
2266
2269
  }
2267
2270
  this._handleClickSelectedCountry = () => {
2268
- if (this.dropdownContent.classList.contains("iti__hide") && !this.telInput.disabled && !this.telInput.readOnly) {
2271
+ const dropdownClosed = this.dropdownContent.classList.contains("iti__hide");
2272
+ if (dropdownClosed && !this.telInput.disabled && !this.telInput.readOnly) {
2269
2273
  this._openDropdown();
2270
2274
  }
2271
2275
  };
@@ -2480,17 +2484,19 @@ var Iti = class _Iti {
2480
2484
  }
2481
2485
  };
2482
2486
  this.countryList.addEventListener("click", this._handleClickCountryList);
2483
- let isOpening = true;
2484
- this._handleClickOffToClose = () => {
2485
- if (!isOpening) {
2487
+ this._handleClickOffToClose = (e) => {
2488
+ const target = e.target;
2489
+ const clickedInsideDropdown = !!target.closest(`#iti-${this.id}__dropdown-content`);
2490
+ if (!clickedInsideDropdown) {
2486
2491
  this._closeDropdown();
2487
2492
  }
2488
- isOpening = false;
2489
2493
  };
2490
- document.documentElement.addEventListener(
2491
- "click",
2492
- this._handleClickOffToClose
2493
- );
2494
+ setTimeout(() => {
2495
+ document.documentElement.addEventListener(
2496
+ "click",
2497
+ this._handleClickOffToClose
2498
+ );
2499
+ }, 0);
2494
2500
  let query = "";
2495
2501
  let queryTimer = null;
2496
2502
  this._handleKeydownOnDropdown = (e) => {
@@ -2543,14 +2549,12 @@ var Iti = class _Iti {
2543
2549
  }, 100);
2544
2550
  };
2545
2551
  this.searchInput.addEventListener("input", this._handleSearchChange);
2546
- this._handleSearchClear = (e) => {
2547
- e.stopPropagation();
2552
+ this._handleSearchClear = () => {
2548
2553
  this.searchInput.value = "";
2549
2554
  this.searchInput.focus();
2550
2555
  doFilter();
2551
2556
  };
2552
2557
  this.searchClearButton.addEventListener("click", this._handleSearchClear);
2553
- this.searchInput.addEventListener("click", (e) => e.stopPropagation());
2554
2558
  }
2555
2559
  }
2556
2560
  //* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
@@ -2769,20 +2773,20 @@ var Iti = class _Iti {
2769
2773
  if (this.selectedCountryData.iso2) {
2770
2774
  this.defaultCountry = this.selectedCountryData.iso2;
2771
2775
  }
2772
- if (this.selectedCountryInner) {
2773
- let flagClass = "";
2774
- let a11yText = "";
2775
- if (iso2 && showFlags) {
2776
- flagClass = `iti__flag iti__${iso2}`;
2777
- a11yText = `${this.selectedCountryData.name} +${this.selectedCountryData.dialCode}`;
2776
+ if (this.selectedCountry) {
2777
+ const flagClass = iso2 && showFlags ? `iti__flag iti__${iso2}` : "iti__flag iti__globe";
2778
+ let ariaLabel, title;
2779
+ if (iso2) {
2780
+ title = this.selectedCountryData.name;
2781
+ ariaLabel = i18n.selectedCountryAriaLabel.replace("${country}", this.selectedCountryData.name);
2778
2782
  } else {
2779
- flagClass = "iti__flag iti__globe";
2780
- a11yText = i18n.noCountrySelected;
2783
+ title = i18n.noCountrySelected;
2784
+ ariaLabel = i18n.noCountrySelected;
2781
2785
  }
2782
2786
  this.selectedCountryInner.className = flagClass;
2783
- this.selectedCountryA11yText.textContent = a11yText;
2787
+ this.selectedCountry.setAttribute("title", title);
2788
+ this.selectedCountry.setAttribute("aria-label", ariaLabel);
2784
2789
  }
2785
- this._setSelectedCountryTitleAttribute(iso2, separateDialCode);
2786
2790
  if (separateDialCode) {
2787
2791
  const dialCode = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
2788
2792
  this.selectedDialCode.innerHTML = dialCode;
@@ -2832,20 +2836,6 @@ var Iti = class _Iti {
2832
2836
  }
2833
2837
  }
2834
2838
  }
2835
- _setSelectedCountryTitleAttribute(iso2 = null, separateDialCode) {
2836
- if (!this.selectedCountry) {
2837
- return;
2838
- }
2839
- let title;
2840
- if (iso2 && !separateDialCode) {
2841
- title = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}`;
2842
- } else if (iso2) {
2843
- title = this.selectedCountryData.name;
2844
- } else {
2845
- title = "Unknown";
2846
- }
2847
- this.selectedCountry.setAttribute("title", title);
2848
- }
2849
2839
  //* When the input is in a hidden container during initialisation, we must inject some markup
2850
2840
  //* into the end of the DOM to calculate the correct offsetWidth.
2851
2841
  //* NOTE: this is only used when separateDialCode is enabled, so countryContainer and selectedCountry
@@ -3271,7 +3261,7 @@ var intlTelInput = Object.assign(
3271
3261
  attachUtils,
3272
3262
  startedLoadingUtilsScript: false,
3273
3263
  startedLoadingAutoCountry: false,
3274
- version: "25.8.1"
3264
+ version: "25.8.3"
3275
3265
  }
3276
3266
  );
3277
3267
  var intl_tel_input_default = intlTelInput;
@@ -393,7 +393,6 @@ declare module "intl-tel-input" {
393
393
  private countryContainer;
394
394
  private selectedCountry;
395
395
  private selectedCountryInner;
396
- private selectedCountryA11yText;
397
396
  private selectedDialCode;
398
397
  private dropdownArrow;
399
398
  private dropdownContent;
@@ -471,7 +470,6 @@ declare module "intl-tel-input" {
471
470
  private _setCountry;
472
471
  private _updateInputPadding;
473
472
  private _updateMaxLength;
474
- private _setSelectedCountryTitleAttribute;
475
473
  private _getHiddenSelectedCountryWidth;
476
474
  private _updatePlaceholder;
477
475
  private _selectListItem;
@@ -1588,8 +1588,8 @@ var countries_default = countryTranslations;
1588
1588
 
1589
1589
  // src/js/intl-tel-input/i18n/en/interface.ts
1590
1590
  var interfaceTranslations = {
1591
- selectedCountryAriaLabel: "Selected country",
1592
- noCountrySelected: "No country selected",
1591
+ selectedCountryAriaLabel: "Change country, selected ${country}",
1592
+ noCountrySelected: "Select country",
1593
1593
  countryListAriaLabel: "List of countries",
1594
1594
  searchPlaceholder: "Search",
1595
1595
  clearSearchAriaLabel: "Clear search",
@@ -1954,7 +1954,7 @@ var Iti = class _Iti {
1954
1954
  type: "button",
1955
1955
  class: "iti__selected-country",
1956
1956
  "aria-expanded": "false",
1957
- "aria-label": this.options.i18n.selectedCountryAriaLabel,
1957
+ "aria-label": this.options.i18n.noCountrySelected,
1958
1958
  "aria-haspopup": "dialog",
1959
1959
  "aria-controls": `iti-${this.id}__dropdown-content`
1960
1960
  },
@@ -1970,12 +1970,15 @@ var Iti = class _Iti {
1970
1970
  this.countryContainer
1971
1971
  );
1972
1972
  }
1973
- const selectedCountryPrimary = createEl("div", { class: "iti__selected-country-primary" }, this.selectedCountry);
1974
- this.selectedCountryInner = createEl("div", { class: "iti__flag" }, selectedCountryPrimary);
1975
- this.selectedCountryA11yText = createEl(
1976
- "span",
1977
- { class: "iti__a11y-text" },
1978
- this.selectedCountryInner
1973
+ const selectedCountryPrimary = createEl(
1974
+ "div",
1975
+ { class: "iti__selected-country-primary" },
1976
+ this.selectedCountry
1977
+ );
1978
+ this.selectedCountryInner = createEl(
1979
+ "div",
1980
+ { class: "iti__flag" },
1981
+ selectedCountryPrimary
1979
1982
  );
1980
1983
  if (allowDropdown) {
1981
1984
  this.dropdownArrow = createEl(
@@ -1987,7 +1990,7 @@ var Iti = class _Iti {
1987
1990
  if (separateDialCode) {
1988
1991
  this.selectedDialCode = createEl(
1989
1992
  "div",
1990
- { class: "iti__selected-dial-code", "aria-hidden": "true", dir: "ltr" },
1993
+ { class: "iti__selected-dial-code", dir: "ltr" },
1991
1994
  this.selectedCountry
1992
1995
  );
1993
1996
  }
@@ -2229,7 +2232,8 @@ var Iti = class _Iti {
2229
2232
  label.addEventListener("click", this._handleLabelClick);
2230
2233
  }
2231
2234
  this._handleClickSelectedCountry = () => {
2232
- if (this.dropdownContent.classList.contains("iti__hide") && !this.telInput.disabled && !this.telInput.readOnly) {
2235
+ const dropdownClosed = this.dropdownContent.classList.contains("iti__hide");
2236
+ if (dropdownClosed && !this.telInput.disabled && !this.telInput.readOnly) {
2233
2237
  this._openDropdown();
2234
2238
  }
2235
2239
  };
@@ -2444,17 +2448,19 @@ var Iti = class _Iti {
2444
2448
  }
2445
2449
  };
2446
2450
  this.countryList.addEventListener("click", this._handleClickCountryList);
2447
- let isOpening = true;
2448
- this._handleClickOffToClose = () => {
2449
- if (!isOpening) {
2451
+ this._handleClickOffToClose = (e) => {
2452
+ const target = e.target;
2453
+ const clickedInsideDropdown = !!target.closest(`#iti-${this.id}__dropdown-content`);
2454
+ if (!clickedInsideDropdown) {
2450
2455
  this._closeDropdown();
2451
2456
  }
2452
- isOpening = false;
2453
2457
  };
2454
- document.documentElement.addEventListener(
2455
- "click",
2456
- this._handleClickOffToClose
2457
- );
2458
+ setTimeout(() => {
2459
+ document.documentElement.addEventListener(
2460
+ "click",
2461
+ this._handleClickOffToClose
2462
+ );
2463
+ }, 0);
2458
2464
  let query = "";
2459
2465
  let queryTimer = null;
2460
2466
  this._handleKeydownOnDropdown = (e) => {
@@ -2507,14 +2513,12 @@ var Iti = class _Iti {
2507
2513
  }, 100);
2508
2514
  };
2509
2515
  this.searchInput.addEventListener("input", this._handleSearchChange);
2510
- this._handleSearchClear = (e) => {
2511
- e.stopPropagation();
2516
+ this._handleSearchClear = () => {
2512
2517
  this.searchInput.value = "";
2513
2518
  this.searchInput.focus();
2514
2519
  doFilter();
2515
2520
  };
2516
2521
  this.searchClearButton.addEventListener("click", this._handleSearchClear);
2517
- this.searchInput.addEventListener("click", (e) => e.stopPropagation());
2518
2522
  }
2519
2523
  }
2520
2524
  //* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
@@ -2733,20 +2737,20 @@ var Iti = class _Iti {
2733
2737
  if (this.selectedCountryData.iso2) {
2734
2738
  this.defaultCountry = this.selectedCountryData.iso2;
2735
2739
  }
2736
- if (this.selectedCountryInner) {
2737
- let flagClass = "";
2738
- let a11yText = "";
2739
- if (iso2 && showFlags) {
2740
- flagClass = `iti__flag iti__${iso2}`;
2741
- a11yText = `${this.selectedCountryData.name} +${this.selectedCountryData.dialCode}`;
2740
+ if (this.selectedCountry) {
2741
+ const flagClass = iso2 && showFlags ? `iti__flag iti__${iso2}` : "iti__flag iti__globe";
2742
+ let ariaLabel, title;
2743
+ if (iso2) {
2744
+ title = this.selectedCountryData.name;
2745
+ ariaLabel = i18n.selectedCountryAriaLabel.replace("${country}", this.selectedCountryData.name);
2742
2746
  } else {
2743
- flagClass = "iti__flag iti__globe";
2744
- a11yText = i18n.noCountrySelected;
2747
+ title = i18n.noCountrySelected;
2748
+ ariaLabel = i18n.noCountrySelected;
2745
2749
  }
2746
2750
  this.selectedCountryInner.className = flagClass;
2747
- this.selectedCountryA11yText.textContent = a11yText;
2751
+ this.selectedCountry.setAttribute("title", title);
2752
+ this.selectedCountry.setAttribute("aria-label", ariaLabel);
2748
2753
  }
2749
- this._setSelectedCountryTitleAttribute(iso2, separateDialCode);
2750
2754
  if (separateDialCode) {
2751
2755
  const dialCode = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
2752
2756
  this.selectedDialCode.innerHTML = dialCode;
@@ -2796,20 +2800,6 @@ var Iti = class _Iti {
2796
2800
  }
2797
2801
  }
2798
2802
  }
2799
- _setSelectedCountryTitleAttribute(iso2 = null, separateDialCode) {
2800
- if (!this.selectedCountry) {
2801
- return;
2802
- }
2803
- let title;
2804
- if (iso2 && !separateDialCode) {
2805
- title = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}`;
2806
- } else if (iso2) {
2807
- title = this.selectedCountryData.name;
2808
- } else {
2809
- title = "Unknown";
2810
- }
2811
- this.selectedCountry.setAttribute("title", title);
2812
- }
2813
2803
  //* When the input is in a hidden container during initialisation, we must inject some markup
2814
2804
  //* into the end of the DOM to calculate the correct offsetWidth.
2815
2805
  //* NOTE: this is only used when separateDialCode is enabled, so countryContainer and selectedCountry
@@ -3235,7 +3225,7 @@ var intlTelInput = Object.assign(
3235
3225
  attachUtils,
3236
3226
  startedLoadingUtilsScript: false,
3237
3227
  startedLoadingAutoCountry: false,
3238
- version: "25.8.1"
3228
+ version: "25.8.3"
3239
3229
  }
3240
3230
  );
3241
3231
  var intl_tel_input_default = intlTelInput;
@@ -1624,8 +1624,8 @@ var countries_default = countryTranslations;
1624
1624
 
1625
1625
  // src/js/intl-tel-input/i18n/en/interface.ts
1626
1626
  var interfaceTranslations = {
1627
- selectedCountryAriaLabel: "Selected country",
1628
- noCountrySelected: "No country selected",
1627
+ selectedCountryAriaLabel: "Change country, selected ${country}",
1628
+ noCountrySelected: "Select country",
1629
1629
  countryListAriaLabel: "List of countries",
1630
1630
  searchPlaceholder: "Search",
1631
1631
  clearSearchAriaLabel: "Clear search",
@@ -1990,7 +1990,7 @@ var Iti = class _Iti {
1990
1990
  type: "button",
1991
1991
  class: "iti__selected-country",
1992
1992
  "aria-expanded": "false",
1993
- "aria-label": this.options.i18n.selectedCountryAriaLabel,
1993
+ "aria-label": this.options.i18n.noCountrySelected,
1994
1994
  "aria-haspopup": "dialog",
1995
1995
  "aria-controls": `iti-${this.id}__dropdown-content`
1996
1996
  },
@@ -2006,12 +2006,15 @@ var Iti = class _Iti {
2006
2006
  this.countryContainer
2007
2007
  );
2008
2008
  }
2009
- const selectedCountryPrimary = createEl("div", { class: "iti__selected-country-primary" }, this.selectedCountry);
2010
- this.selectedCountryInner = createEl("div", { class: "iti__flag" }, selectedCountryPrimary);
2011
- this.selectedCountryA11yText = createEl(
2012
- "span",
2013
- { class: "iti__a11y-text" },
2014
- this.selectedCountryInner
2009
+ const selectedCountryPrimary = createEl(
2010
+ "div",
2011
+ { class: "iti__selected-country-primary" },
2012
+ this.selectedCountry
2013
+ );
2014
+ this.selectedCountryInner = createEl(
2015
+ "div",
2016
+ { class: "iti__flag" },
2017
+ selectedCountryPrimary
2015
2018
  );
2016
2019
  if (allowDropdown) {
2017
2020
  this.dropdownArrow = createEl(
@@ -2023,7 +2026,7 @@ var Iti = class _Iti {
2023
2026
  if (separateDialCode) {
2024
2027
  this.selectedDialCode = createEl(
2025
2028
  "div",
2026
- { class: "iti__selected-dial-code", "aria-hidden": "true", dir: "ltr" },
2029
+ { class: "iti__selected-dial-code", dir: "ltr" },
2027
2030
  this.selectedCountry
2028
2031
  );
2029
2032
  }
@@ -2265,7 +2268,8 @@ var Iti = class _Iti {
2265
2268
  label.addEventListener("click", this._handleLabelClick);
2266
2269
  }
2267
2270
  this._handleClickSelectedCountry = () => {
2268
- if (this.dropdownContent.classList.contains("iti__hide") && !this.telInput.disabled && !this.telInput.readOnly) {
2271
+ const dropdownClosed = this.dropdownContent.classList.contains("iti__hide");
2272
+ if (dropdownClosed && !this.telInput.disabled && !this.telInput.readOnly) {
2269
2273
  this._openDropdown();
2270
2274
  }
2271
2275
  };
@@ -2480,17 +2484,19 @@ var Iti = class _Iti {
2480
2484
  }
2481
2485
  };
2482
2486
  this.countryList.addEventListener("click", this._handleClickCountryList);
2483
- let isOpening = true;
2484
- this._handleClickOffToClose = () => {
2485
- if (!isOpening) {
2487
+ this._handleClickOffToClose = (e) => {
2488
+ const target = e.target;
2489
+ const clickedInsideDropdown = !!target.closest(`#iti-${this.id}__dropdown-content`);
2490
+ if (!clickedInsideDropdown) {
2486
2491
  this._closeDropdown();
2487
2492
  }
2488
- isOpening = false;
2489
2493
  };
2490
- document.documentElement.addEventListener(
2491
- "click",
2492
- this._handleClickOffToClose
2493
- );
2494
+ setTimeout(() => {
2495
+ document.documentElement.addEventListener(
2496
+ "click",
2497
+ this._handleClickOffToClose
2498
+ );
2499
+ }, 0);
2494
2500
  let query = "";
2495
2501
  let queryTimer = null;
2496
2502
  this._handleKeydownOnDropdown = (e) => {
@@ -2543,14 +2549,12 @@ var Iti = class _Iti {
2543
2549
  }, 100);
2544
2550
  };
2545
2551
  this.searchInput.addEventListener("input", this._handleSearchChange);
2546
- this._handleSearchClear = (e) => {
2547
- e.stopPropagation();
2552
+ this._handleSearchClear = () => {
2548
2553
  this.searchInput.value = "";
2549
2554
  this.searchInput.focus();
2550
2555
  doFilter();
2551
2556
  };
2552
2557
  this.searchClearButton.addEventListener("click", this._handleSearchClear);
2553
- this.searchInput.addEventListener("click", (e) => e.stopPropagation());
2554
2558
  }
2555
2559
  }
2556
2560
  //* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
@@ -2769,20 +2773,20 @@ var Iti = class _Iti {
2769
2773
  if (this.selectedCountryData.iso2) {
2770
2774
  this.defaultCountry = this.selectedCountryData.iso2;
2771
2775
  }
2772
- if (this.selectedCountryInner) {
2773
- let flagClass = "";
2774
- let a11yText = "";
2775
- if (iso2 && showFlags) {
2776
- flagClass = `iti__flag iti__${iso2}`;
2777
- a11yText = `${this.selectedCountryData.name} +${this.selectedCountryData.dialCode}`;
2776
+ if (this.selectedCountry) {
2777
+ const flagClass = iso2 && showFlags ? `iti__flag iti__${iso2}` : "iti__flag iti__globe";
2778
+ let ariaLabel, title;
2779
+ if (iso2) {
2780
+ title = this.selectedCountryData.name;
2781
+ ariaLabel = i18n.selectedCountryAriaLabel.replace("${country}", this.selectedCountryData.name);
2778
2782
  } else {
2779
- flagClass = "iti__flag iti__globe";
2780
- a11yText = i18n.noCountrySelected;
2783
+ title = i18n.noCountrySelected;
2784
+ ariaLabel = i18n.noCountrySelected;
2781
2785
  }
2782
2786
  this.selectedCountryInner.className = flagClass;
2783
- this.selectedCountryA11yText.textContent = a11yText;
2787
+ this.selectedCountry.setAttribute("title", title);
2788
+ this.selectedCountry.setAttribute("aria-label", ariaLabel);
2784
2789
  }
2785
- this._setSelectedCountryTitleAttribute(iso2, separateDialCode);
2786
2790
  if (separateDialCode) {
2787
2791
  const dialCode = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
2788
2792
  this.selectedDialCode.innerHTML = dialCode;
@@ -2832,20 +2836,6 @@ var Iti = class _Iti {
2832
2836
  }
2833
2837
  }
2834
2838
  }
2835
- _setSelectedCountryTitleAttribute(iso2 = null, separateDialCode) {
2836
- if (!this.selectedCountry) {
2837
- return;
2838
- }
2839
- let title;
2840
- if (iso2 && !separateDialCode) {
2841
- title = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}`;
2842
- } else if (iso2) {
2843
- title = this.selectedCountryData.name;
2844
- } else {
2845
- title = "Unknown";
2846
- }
2847
- this.selectedCountry.setAttribute("title", title);
2848
- }
2849
2839
  //* When the input is in a hidden container during initialisation, we must inject some markup
2850
2840
  //* into the end of the DOM to calculate the correct offsetWidth.
2851
2841
  //* NOTE: this is only used when separateDialCode is enabled, so countryContainer and selectedCountry
@@ -3271,7 +3261,7 @@ var intlTelInput = Object.assign(
3271
3261
  attachUtils,
3272
3262
  startedLoadingUtilsScript: false,
3273
3263
  startedLoadingAutoCountry: false,
3274
- version: "25.8.1"
3264
+ version: "25.8.3"
3275
3265
  }
3276
3266
  );
3277
3267
  var intl_tel_input_default = intlTelInput;