Skip to content

Commit

Permalink
OA-16302: [GEM] Update libphonenumber to v18.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
arthutox committed Jun 1, 2023
1 parent a0a91e7 commit 3e88fef
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 54 deletions.
36 changes: 25 additions & 11 deletions app/assets/javascripts/intl-tel-input.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* International Telephone Input v18.1.5
* International Telephone Input v18.1.6
* https://github.com/jackocnr/intl-tel-input.git
* Licensed under the MIT license
*/
Expand Down Expand Up @@ -456,7 +456,6 @@
role: "combobox",
"aria-haspopup": "listbox",
"aria-controls": "iti-".concat(this.id, "__country-listbox"),
"aria-owns": "iti-".concat(this.id, "__country-listbox"),
"aria-expanded": "false",
"aria-label": "Telephone country code"
}), this.flagsContainer);
Expand Down Expand Up @@ -1079,22 +1078,19 @@
}, {
key: "_setFlag",
value: function _setFlag(countryCode) {
var _this$options3 = this.options, allowDropdown = _this$options3.allowDropdown, separateDialCode = _this$options3.separateDialCode, showFlags = _this$options3.showFlags;
var prevCountry = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
// do this first as it will throw an error and stop if countryCode is invalid
this.selectedCountryData = countryCode ? this._getCountryData(countryCode, false, false) : {};
// update the defaultCountry - we only need the iso2 from now on, so just store that
if (this.selectedCountryData.iso2) {
this.defaultCountry = this.selectedCountryData.iso2;
}
if (this.options.showFlags) {
if (showFlags) {
this.selectedFlagInner.setAttribute("class", "iti__flag iti__".concat(countryCode));
}
// update the selected country's title attribute
if (this.selectedFlag) {
var title = countryCode ? "".concat(this.selectedCountryData.name, ": +").concat(this.selectedCountryData.dialCode) : "Unknown";
this.selectedFlag.setAttribute("title", title);
}
if (this.options.separateDialCode) {
this._setSelectedCountryFlagTitleAttribute(countryCode, separateDialCode);
if (separateDialCode) {
var dialCode = this.selectedCountryData.dialCode ? "+".concat(this.selectedCountryData.dialCode) : "";
this.selectedDialCode.innerHTML = dialCode;
// offsetWidth is zero if input is in a hidden container during initialisation
Expand All @@ -1105,7 +1101,7 @@
// and the input's placeholder
this._updatePlaceholder();
// update the active list item
if (this.options.allowDropdown) {
if (allowDropdown) {
var prevItem = this.activeItem;
if (prevItem) {
prevItem.classList.remove("iti__active");
Expand All @@ -1122,6 +1118,24 @@
// return if the flag has changed or not
return prevCountry.iso2 !== countryCode;
}
}, {
key: "_setSelectedCountryFlagTitleAttribute",
value: function _setSelectedCountryFlagTitleAttribute(countryCode, separateDialCode) {
if (!this.selectedFlag) {
return;
}
var title;
if (countryCode && !separateDialCode) {
title = "".concat(this.selectedCountryData.name, ": +").concat(this.selectedCountryData.dialCode);
} else if (countryCode) {
// For screen reader output, we don't want to include the dial code in the reader output twice
// so just use the selected country name here:
title = this.selectedCountryData.name;
} else {
title = "Unknown";
}
this.selectedFlag.setAttribute("title", title);
}
}, {
key: "_getHiddenSelectedFlagWidth",
value: function _getHiddenSelectedFlagWidth() {
Expand Down Expand Up @@ -1517,7 +1531,7 @@
// default options
intlTelInputGlobals.defaults = defaults;
// version
intlTelInputGlobals.version = "18.1.5";
intlTelInputGlobals.version = "18.1.6";
var pluginName = "intlTelInput";
// A really lightweight plugin wrapper around the constructor,
// preventing against multiple instantiations
Expand Down
Loading

0 comments on commit 3e88fef

Please sign in to comment.