intl-tel-input 19.2.20 → 19.3.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.
@@ -24326,10 +24326,10 @@ var R = et((at, T) => {
24326
24326
  return s;
24327
24327
  }
24328
24328
  function N(s, n, t) {
24329
- return n = D(n), n in s ? Object.defineProperty(s, n, { value: t, enumerable: true, configurable: true, writable: true }) : s[n] = t, s;
24329
+ return n = A(n), n in s ? Object.defineProperty(s, n, { value: t, enumerable: true, configurable: true, writable: true }) : s[n] = t, s;
24330
24330
  }
24331
24331
  function F(s, n) {
24332
- return _(s) || w(s, n) || x(s, n) || P();
24332
+ return _(s) || I(s, n) || x(s, n) || P();
24333
24333
  }
24334
24334
  function P() {
24335
24335
  throw new TypeError(`Invalid attempt to destructure non-iterable instance.
@@ -24338,21 +24338,21 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24338
24338
  function x(s, n) {
24339
24339
  if (s) {
24340
24340
  if (typeof s == "string")
24341
- return k(s, n);
24341
+ return D(s, n);
24342
24342
  var t = Object.prototype.toString.call(s).slice(8, -1);
24343
24343
  if (t === "Object" && s.constructor && (t = s.constructor.name), t === "Map" || t === "Set")
24344
24344
  return Array.from(s);
24345
24345
  if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))
24346
- return k(s, n);
24346
+ return D(s, n);
24347
24347
  }
24348
24348
  }
24349
- function k(s, n) {
24349
+ function D(s, n) {
24350
24350
  (n == null || n > s.length) && (n = s.length);
24351
24351
  for (var t = 0, e = new Array(n); t < n; t++)
24352
24352
  e[t] = s[t];
24353
24353
  return e;
24354
24354
  }
24355
- function w(s, n) {
24355
+ function I(s, n) {
24356
24356
  var t = s == null ? null : typeof Symbol < "u" && s[Symbol.iterator] || s["@@iterator"];
24357
24357
  if (t != null) {
24358
24358
  var e, i, o, r, a = [], l = true, u = false;
@@ -24382,20 +24382,20 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24382
24382
  if (Array.isArray(s))
24383
24383
  return s;
24384
24384
  }
24385
- function I(s, n) {
24385
+ function L(s, n) {
24386
24386
  if (!(s instanceof n))
24387
24387
  throw new TypeError("Cannot call a class as a function");
24388
24388
  }
24389
24389
  function b(s, n) {
24390
24390
  for (var t = 0; t < n.length; t++) {
24391
24391
  var e = n[t];
24392
- e.enumerable = e.enumerable || false, e.configurable = true, "value" in e && (e.writable = true), Object.defineProperty(s, D(e.key), e);
24392
+ e.enumerable = e.enumerable || false, e.configurable = true, "value" in e && (e.writable = true), Object.defineProperty(s, A(e.key), e);
24393
24393
  }
24394
24394
  }
24395
24395
  function O(s, n, t) {
24396
24396
  return n && b(s.prototype, n), t && b(s, t), Object.defineProperty(s, "prototype", { writable: false }), s;
24397
24397
  }
24398
- function D(s) {
24398
+ function A(s) {
24399
24399
  var n = V(s, "string");
24400
24400
  return typeof n == "symbol" ? n : String(n);
24401
24401
  }
@@ -24411,14 +24411,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24411
24411
  }
24412
24412
  return (n === "string" ? String : Number)(s);
24413
24413
  }
24414
- var L = { getInstance: function(n) {
24414
+ var S = { getInstance: function(n) {
24415
24415
  var t = n.getAttribute("data-intl-tel-input-id");
24416
24416
  return window.intlTelInputGlobals.instances[t];
24417
24417
  }, instances: {}, documentReady: function() {
24418
24418
  return document.readyState === "complete";
24419
24419
  } };
24420
- typeof window == "object" && (window.intlTelInputGlobals = L);
24421
- var H = 0, M = { allowDropdown: true, autoInsertDialCode: false, autoPlaceholder: "polite", countrySearch: true, containerClass: "", customPlaceholder: null, dropdownContainer: null, excludeCountries: [], fixDropdownWidth: true, formatAsYouType: true, formatOnDisplay: true, geoIpLookup: null, hiddenInput: null, i18n: {}, initialCountry: "", nationalMode: true, onlyCountries: [], placeholderNumberType: "MOBILE", preferredCountries: [], showFlags: true, showSelectedDialCode: false, useFullscreenPopup: typeof navigator < "u" && typeof window < "u" ? /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 500 : false, utilsScript: "" }, W = ["800", "822", "833", "844", "855", "866", "877", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889"], S = function(n) {
24420
+ typeof window == "object" && (window.intlTelInputGlobals = S);
24421
+ var H = 0, M = { allowDropdown: true, autoInsertDialCode: false, autoPlaceholder: "polite", countrySearch: true, containerClass: "", customPlaceholder: null, defaultToFirstCountry: true, dropdownContainer: null, excludeCountries: [], fixDropdownWidth: true, formatAsYouType: true, formatOnDisplay: true, geoIpLookup: null, hiddenInput: null, i18n: {}, initialCountry: "", nationalMode: true, onlyCountries: [], placeholderNumberType: "MOBILE", preferredCountries: [], showFlags: true, showSelectedDialCode: false, useFullscreenPopup: typeof navigator < "u" && typeof window < "u" ? /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 500 : false, utilsScript: "" }, W = ["800", "822", "833", "844", "855", "866", "877", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889"], k = function(n) {
24422
24422
  var t = window.intlTelInputGlobals.instances;
24423
24423
  Object.values(t).forEach(function(e) {
24424
24424
  return e[n]();
@@ -24426,7 +24426,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24426
24426
  }, q = function() {
24427
24427
  function s(n) {
24428
24428
  var t = arguments.length > 1 && arguments[1] !== c ? arguments[1] : {};
24429
- I(this, s), this.id = H++, this.telInput = n, this.activeItem = null, this.highlightedItem = null, this.options = Object.assign({}, M, t), this.hadInitialPlaceholder = !!n.getAttribute("placeholder");
24429
+ L(this, s), this.id = H++, this.telInput = n, this.activeItem = null, this.highlightedItem = null, this.options = Object.assign({}, M, t), this.hadInitialPlaceholder = !!n.getAttribute("placeholder");
24430
24430
  }
24431
24431
  return O(s, [{ key: "_init", value: function() {
24432
24432
  var t = this;
@@ -24512,8 +24512,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24512
24512
  e && (f += " iti--allow-dropdown"), i && (f += " iti--show-selected-dial-code"), o && (f += " iti--show-flags"), r && (f += " ".concat(r)), h || (f += " iti--inline-dropdown");
24513
24513
  var v = this._createEl("div", { class: f });
24514
24514
  this.telInput.parentNode.insertBefore(v, this.telInput);
24515
- var A = e || o || i;
24516
- if (A && (this.flagsContainer = this._createEl("div", { class: "iti__flag-container" }, v)), v.appendChild(this.telInput), A && (this.selectedFlag = this._createEl("div", C({ class: "iti__selected-flag" }, e && { role: "combobox", "aria-haspopup": "listbox", "aria-controls": "iti-".concat(this.id, "__country-listbox"), "aria-expanded": "false", "aria-label": this.options.i18n.selectedCountryAriaLabel || "Selected country" }), this.flagsContainer)), o && (this.selectedFlagInner = this._createEl("div", { class: "iti__flag" }, this.selectedFlag)), this.selectedFlag && this.telInput.disabled && this.selectedFlag.setAttribute("aria-disabled", "true"), i && (this.selectedDialCode = this._createEl("div", { class: "iti__selected-dial-code" }, this.selectedFlag)), e) {
24515
+ var w = e || o || i;
24516
+ if (w && (this.flagsContainer = this._createEl("div", { class: "iti__flag-container" }, v)), v.appendChild(this.telInput), w && (this.selectedFlag = this._createEl("div", C({ class: "iti__selected-flag" }, e && { role: "combobox", "aria-haspopup": "listbox", "aria-controls": "iti-".concat(this.id, "__country-listbox"), "aria-expanded": "false", "aria-label": this.options.i18n.selectedCountryAriaLabel || "Selected country" }), this.flagsContainer)), o && (this.selectedFlagInner = this._createEl("div", { class: "iti__flag" }, this.selectedFlag)), this.selectedFlag && this.telInput.disabled && this.selectedFlag.setAttribute("aria-disabled", "true"), i && (this.selectedDialCode = this._createEl("div", { class: "iti__selected-dial-code" }, this.selectedFlag)), e) {
24517
24517
  this.telInput.disabled || this.selectedFlag.setAttribute("tabindex", "0"), this.dropdownArrow = this._createEl("div", { class: "iti__arrow" }, this.selectedFlag);
24518
24518
  var Y = u ? "" : "iti--flexible-dropdown-width";
24519
24519
  if (this.dropdownContent = this._createEl("div", { class: "iti__dropdown-content iti__hide ".concat(Y) }), g && (this.searchInput = this._createEl("input", { type: "text", class: "iti__search-input", placeholder: this.options.i18n.searchPlaceholder || "Search" }, this.dropdownContent)), this.countryList = this._createEl("ul", { class: "iti__country-list", id: "iti-".concat(this.id, "__country-listbox"), role: "listbox", "aria-label": this.options.i18n.countryListAriaLabel || "List of countries" }, this.dropdownContent), this.preferredCountries.length && !g && (this._appendListItems(this.preferredCountries, "iti__preferred", true), this._createEl("li", { class: "iti__divider", "aria-hidden": "true" }, this.countryList)), this._appendListItems(this.countries, "iti__standard"), l) {
@@ -24534,12 +24534,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24534
24534
  this.options.showFlags && (u += "<div class='iti__flag-box'><div class='iti__flag iti__".concat(r.iso2, "'></div></div>")), u += "<span class='iti__country-name'>".concat(r.name, "</span>"), u += "<span class='iti__dial-code'>+".concat(r.dialCode, "</span>"), l.insertAdjacentHTML("beforeend", u);
24535
24535
  }
24536
24536
  } }, { key: "_setInitialState", value: function() {
24537
- var t = arguments.length > 0 && arguments[0] !== c ? arguments[0] : false, e = this.telInput.getAttribute("value"), i = this.telInput.value, o = e && e.charAt(0) === "+" && (!i || i.charAt(0) !== "+"), r = o ? e : i, a = this._getDialCode(r), l = this._isRegionlessNanp(r), u = this.options, h = u.initialCountry, g = u.autoInsertDialCode;
24537
+ var t = arguments.length > 0 && arguments[0] !== c ? arguments[0] : false, e = this.telInput.getAttribute("value"), i = this.telInput.value, o = e && e.charAt(0) === "+" && (!i || i.charAt(0) !== "+"), r = o ? e : i, a = this._getDialCode(r), l = this._isRegionlessNanp(r), u = this.options, h = u.initialCountry, g = u.autoInsertDialCode, f = u.defaultToFirstCountry;
24538
24538
  if (a && !l)
24539
24539
  this._updateFlagFromNumber(r);
24540
24540
  else if (h !== "auto" || t) {
24541
- var f = h ? h.toLowerCase() : "", v = f && this._getCountryData(f, true);
24542
- v ? this._setFlag(f) : a && l ? this._setFlag("us") : (this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2, r || this._setFlag(this.defaultCountry)), !r && g && (this.telInput.value = "+".concat(this.selectedCountryData.dialCode));
24541
+ var v = h ? h.toLowerCase() : "", w = v && this._getCountryData(v, true);
24542
+ w ? this._setFlag(v) : a && l ? this._setFlag("us") : f && (this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2, r || this._setFlag(this.defaultCountry)), !r && g && (this.telInput.value = "+".concat(this.selectedCountryData.dialCode));
24543
24543
  }
24544
24544
  r && this._updateValFromNumber(r);
24545
24545
  } }, { key: "_initListeners", value: function() {
@@ -24571,10 +24571,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24571
24571
  window.intlTelInputGlobals.autoCountry ? this.handleAutoCountry() : window.intlTelInputGlobals.startedLoadingAutoCountry || (window.intlTelInputGlobals.startedLoadingAutoCountry = true, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(function() {
24572
24572
  var e = arguments.length > 0 && arguments[0] !== c ? arguments[0] : "", i = e.toLowerCase(), o = i && t._getCountryData(i, true);
24573
24573
  o ? (window.intlTelInputGlobals.autoCountry = i, setTimeout(function() {
24574
- return S("handleAutoCountry");
24575
- })) : (t._setInitialState(true), S("rejectAutoCountryPromise"));
24574
+ return k("handleAutoCountry");
24575
+ })) : (t._setInitialState(true), k("rejectAutoCountryPromise"));
24576
24576
  }, function() {
24577
- return S("rejectAutoCountryPromise");
24577
+ return k("rejectAutoCountryPromise");
24578
24578
  }));
24579
24579
  } }, { key: "_initKeyListeners", value: function() {
24580
24580
  var t = this, e = false;
@@ -24779,8 +24779,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24779
24779
  e && (f -= v), i.scrollTop = f;
24780
24780
  else if (g > l) {
24781
24781
  e && (f += v);
24782
- var A = r - u;
24783
- i.scrollTop = f - A;
24782
+ var w = r - u;
24783
+ i.scrollTop = f - w;
24784
24784
  }
24785
24785
  } }, { key: "_updateDialCode", value: function(t) {
24786
24786
  var e = this.telInput.value, i = "+".concat(t), o;
@@ -24877,18 +24877,18 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24877
24877
  this.options.placeholderNumberType = t, this._updatePlaceholder();
24878
24878
  } }]), s;
24879
24879
  }();
24880
- L.getCountryData = function() {
24880
+ S.getCountryData = function() {
24881
24881
  return p;
24882
24882
  };
24883
24883
  var B = function(n, t, e) {
24884
24884
  var i = document.createElement("script");
24885
24885
  i.onload = function() {
24886
- S("handleUtils"), t && t();
24886
+ k("handleUtils"), t && t();
24887
24887
  }, i.onerror = function() {
24888
- S("rejectUtilsScriptPromise"), e && e();
24888
+ k("rejectUtilsScriptPromise"), e && e();
24889
24889
  }, i.className = "iti-load-utils", i.async = true, i.src = n, document.body.appendChild(i);
24890
24890
  };
24891
- return L.loadUtils = function(s) {
24891
+ return S.loadUtils = function(s) {
24892
24892
  if (!window.intlTelInputUtils && !window.intlTelInputGlobals.startedLoadingUtilsScript) {
24893
24893
  if (window.intlTelInputGlobals.startedLoadingUtilsScript = true, typeof Promise < "u")
24894
24894
  return new Promise(function(n, t) {
@@ -24897,7 +24897,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24897
24897
  B(s);
24898
24898
  }
24899
24899
  return null;
24900
- }, L.defaults = M, L.version = "19.2.20", function(s, n) {
24900
+ }, S.defaults = M, S.version = "19.3.0", function(s, n) {
24901
24901
  var t = new q(s, n);
24902
24902
  return t._init(), s.setAttribute("data-intl-tel-input-id", t.id), window.intlTelInputGlobals.instances[t.id] = t, t;
24903
24903
  };
@@ -24905,22 +24905,22 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24905
24905
  });
24906
24906
  });
24907
24907
  var z = nt(R());
24908
- var U = ({ initialValue: c, onChangeNumber: p, onChangeCountry: y, onChangeValidity: m, onChangeErrorCode: C, initOptions: N, className: F, disabled: P, onFocus: x, onBlur: k }) => {
24909
- let w = (0, import_react.useRef)(null), _ = (0, import_react.useRef)(null), I = () => {
24908
+ var U = ({ initialValue: c, onChangeNumber: p, onChangeCountry: y, onChangeValidity: m, onChangeErrorCode: C, initOptions: N, className: F, disabled: P, onFocus: x, onBlur: D }) => {
24909
+ let I = (0, import_react.useRef)(null), _ = (0, import_react.useRef)(null), L = () => {
24910
24910
  let b = _.current.getNumber(), O = _.current.getSelectedCountryData().iso2;
24911
24911
  if (p(b), y(O), _.current.isValidNumber())
24912
24912
  m(true), C(null);
24913
24913
  else {
24914
- let D = _.current.getValidationError();
24915
- m(false), C(D);
24914
+ let A = _.current.getValidationError();
24915
+ m(false), C(A);
24916
24916
  }
24917
24917
  };
24918
24918
  return (0, import_react.useEffect)(() => {
24919
- let b = w.current;
24920
- return _.current = (0, z.default)(w.current, N), b.addEventListener("countrychange", I), () => {
24921
- b.removeEventListener("countrychange", I), _.current.destroy();
24919
+ let b = I.current;
24920
+ return _.current = (0, z.default)(I.current, N), b.addEventListener("countrychange", L), () => {
24921
+ b.removeEventListener("countrychange", L), _.current.destroy();
24922
24922
  };
24923
- }, []), import_react.default.createElement("input", { type: "tel", ref: w, onInput: I, defaultValue: c, className: F, disabled: P, onFocus: x, onBlur: k });
24923
+ }, []), import_react.default.createElement("input", { type: "tel", ref: I, onInput: L, defaultValue: c, className: F, disabled: P, onFocus: x, onBlur: D });
24924
24924
  };
24925
24925
  U.propTypes = { initialValue: import_prop_types.default.string, onChangeNumber: import_prop_types.default.func, onChangeCountry: import_prop_types.default.func, onChangeValidity: import_prop_types.default.func, onChangeErrorCode: import_prop_types.default.func, initOptions: import_prop_types.default.shape({ allowDropdown: import_prop_types.default.bool, autoInsertDialCode: import_prop_types.default.bool, autoPlaceholder: import_prop_types.default.string, containerClass: import_prop_types.default.string, countrySearch: import_prop_types.default.bool, customPlaceholder: import_prop_types.default.func, dropdownContainer: import_prop_types.default.node, excludeCountries: import_prop_types.default.arrayOf(import_prop_types.default.string), fixDropdownWidth: import_prop_types.default.bool, formatAsYouType: import_prop_types.default.bool, formatOnDisplay: import_prop_types.default.bool, geoIpLookup: import_prop_types.default.func, hiddenInput: import_prop_types.default.func, i18n: import_prop_types.default.objectOf(import_prop_types.default.string), initialCountry: import_prop_types.default.string, nationalMode: import_prop_types.default.bool, onlyCountries: import_prop_types.default.arrayOf(import_prop_types.default.string), placeholderNumberType: import_prop_types.default.string, preferredCountries: import_prop_types.default.arrayOf(import_prop_types.default.string), showFlags: import_prop_types.default.bool, showSelectedDialCode: import_prop_types.default.bool, useFullscreenPopup: import_prop_types.default.bool, utilsScript: import_prop_types.default.string }), className: import_prop_types.default.string, disabled: import_prop_types.default.bool, onFocus: import_prop_types.default.func, onBlur: import_prop_types.default.func };
24926
24926
  U.defaultProps = { initialValue: "", onChangeNumber: () => {
@@ -24326,10 +24326,10 @@ var R = et((at, T) => {
24326
24326
  return s;
24327
24327
  }
24328
24328
  function N(s, n, t) {
24329
- return n = D(n), n in s ? Object.defineProperty(s, n, { value: t, enumerable: true, configurable: true, writable: true }) : s[n] = t, s;
24329
+ return n = A(n), n in s ? Object.defineProperty(s, n, { value: t, enumerable: true, configurable: true, writable: true }) : s[n] = t, s;
24330
24330
  }
24331
24331
  function F(s, n) {
24332
- return _(s) || w(s, n) || x(s, n) || P();
24332
+ return _(s) || I(s, n) || x(s, n) || P();
24333
24333
  }
24334
24334
  function P() {
24335
24335
  throw new TypeError(`Invalid attempt to destructure non-iterable instance.
@@ -24338,21 +24338,21 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24338
24338
  function x(s, n) {
24339
24339
  if (s) {
24340
24340
  if (typeof s == "string")
24341
- return k(s, n);
24341
+ return D(s, n);
24342
24342
  var t = Object.prototype.toString.call(s).slice(8, -1);
24343
24343
  if (t === "Object" && s.constructor && (t = s.constructor.name), t === "Map" || t === "Set")
24344
24344
  return Array.from(s);
24345
24345
  if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))
24346
- return k(s, n);
24346
+ return D(s, n);
24347
24347
  }
24348
24348
  }
24349
- function k(s, n) {
24349
+ function D(s, n) {
24350
24350
  (n == null || n > s.length) && (n = s.length);
24351
24351
  for (var t = 0, e = new Array(n); t < n; t++)
24352
24352
  e[t] = s[t];
24353
24353
  return e;
24354
24354
  }
24355
- function w(s, n) {
24355
+ function I(s, n) {
24356
24356
  var t = s == null ? null : typeof Symbol < "u" && s[Symbol.iterator] || s["@@iterator"];
24357
24357
  if (t != null) {
24358
24358
  var e, i, o, r, a = [], l = true, u = false;
@@ -24382,20 +24382,20 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24382
24382
  if (Array.isArray(s))
24383
24383
  return s;
24384
24384
  }
24385
- function I(s, n) {
24385
+ function L(s, n) {
24386
24386
  if (!(s instanceof n))
24387
24387
  throw new TypeError("Cannot call a class as a function");
24388
24388
  }
24389
24389
  function b(s, n) {
24390
24390
  for (var t = 0; t < n.length; t++) {
24391
24391
  var e = n[t];
24392
- e.enumerable = e.enumerable || false, e.configurable = true, "value" in e && (e.writable = true), Object.defineProperty(s, D(e.key), e);
24392
+ e.enumerable = e.enumerable || false, e.configurable = true, "value" in e && (e.writable = true), Object.defineProperty(s, A(e.key), e);
24393
24393
  }
24394
24394
  }
24395
24395
  function O(s, n, t) {
24396
24396
  return n && b(s.prototype, n), t && b(s, t), Object.defineProperty(s, "prototype", { writable: false }), s;
24397
24397
  }
24398
- function D(s) {
24398
+ function A(s) {
24399
24399
  var n = V(s, "string");
24400
24400
  return typeof n == "symbol" ? n : String(n);
24401
24401
  }
@@ -24411,14 +24411,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24411
24411
  }
24412
24412
  return (n === "string" ? String : Number)(s);
24413
24413
  }
24414
- var L = { getInstance: function(n) {
24414
+ var S = { getInstance: function(n) {
24415
24415
  var t = n.getAttribute("data-intl-tel-input-id");
24416
24416
  return window.intlTelInputGlobals.instances[t];
24417
24417
  }, instances: {}, documentReady: function() {
24418
24418
  return document.readyState === "complete";
24419
24419
  } };
24420
- typeof window == "object" && (window.intlTelInputGlobals = L);
24421
- var H = 0, M = { allowDropdown: true, autoInsertDialCode: false, autoPlaceholder: "polite", countrySearch: true, containerClass: "", customPlaceholder: null, dropdownContainer: null, excludeCountries: [], fixDropdownWidth: true, formatAsYouType: true, formatOnDisplay: true, geoIpLookup: null, hiddenInput: null, i18n: {}, initialCountry: "", nationalMode: true, onlyCountries: [], placeholderNumberType: "MOBILE", preferredCountries: [], showFlags: true, showSelectedDialCode: false, useFullscreenPopup: typeof navigator < "u" && typeof window < "u" ? /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 500 : false, utilsScript: "" }, W = ["800", "822", "833", "844", "855", "866", "877", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889"], S = function(n) {
24420
+ typeof window == "object" && (window.intlTelInputGlobals = S);
24421
+ var H = 0, M = { allowDropdown: true, autoInsertDialCode: false, autoPlaceholder: "polite", countrySearch: true, containerClass: "", customPlaceholder: null, defaultToFirstCountry: true, dropdownContainer: null, excludeCountries: [], fixDropdownWidth: true, formatAsYouType: true, formatOnDisplay: true, geoIpLookup: null, hiddenInput: null, i18n: {}, initialCountry: "", nationalMode: true, onlyCountries: [], placeholderNumberType: "MOBILE", preferredCountries: [], showFlags: true, showSelectedDialCode: false, useFullscreenPopup: typeof navigator < "u" && typeof window < "u" ? /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 500 : false, utilsScript: "" }, W = ["800", "822", "833", "844", "855", "866", "877", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889"], k = function(n) {
24422
24422
  var t = window.intlTelInputGlobals.instances;
24423
24423
  Object.values(t).forEach(function(e) {
24424
24424
  return e[n]();
@@ -24426,7 +24426,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24426
24426
  }, q = function() {
24427
24427
  function s(n) {
24428
24428
  var t = arguments.length > 1 && arguments[1] !== c ? arguments[1] : {};
24429
- I(this, s), this.id = H++, this.telInput = n, this.activeItem = null, this.highlightedItem = null, this.options = Object.assign({}, M, t), this.hadInitialPlaceholder = !!n.getAttribute("placeholder");
24429
+ L(this, s), this.id = H++, this.telInput = n, this.activeItem = null, this.highlightedItem = null, this.options = Object.assign({}, M, t), this.hadInitialPlaceholder = !!n.getAttribute("placeholder");
24430
24430
  }
24431
24431
  return O(s, [{ key: "_init", value: function() {
24432
24432
  var t = this;
@@ -24512,8 +24512,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24512
24512
  e && (f += " iti--allow-dropdown"), i && (f += " iti--show-selected-dial-code"), o && (f += " iti--show-flags"), r && (f += " ".concat(r)), h || (f += " iti--inline-dropdown");
24513
24513
  var v = this._createEl("div", { class: f });
24514
24514
  this.telInput.parentNode.insertBefore(v, this.telInput);
24515
- var A = e || o || i;
24516
- if (A && (this.flagsContainer = this._createEl("div", { class: "iti__flag-container" }, v)), v.appendChild(this.telInput), A && (this.selectedFlag = this._createEl("div", C({ class: "iti__selected-flag" }, e && { role: "combobox", "aria-haspopup": "listbox", "aria-controls": "iti-".concat(this.id, "__country-listbox"), "aria-expanded": "false", "aria-label": this.options.i18n.selectedCountryAriaLabel || "Selected country" }), this.flagsContainer)), o && (this.selectedFlagInner = this._createEl("div", { class: "iti__flag" }, this.selectedFlag)), this.selectedFlag && this.telInput.disabled && this.selectedFlag.setAttribute("aria-disabled", "true"), i && (this.selectedDialCode = this._createEl("div", { class: "iti__selected-dial-code" }, this.selectedFlag)), e) {
24515
+ var w = e || o || i;
24516
+ if (w && (this.flagsContainer = this._createEl("div", { class: "iti__flag-container" }, v)), v.appendChild(this.telInput), w && (this.selectedFlag = this._createEl("div", C({ class: "iti__selected-flag" }, e && { role: "combobox", "aria-haspopup": "listbox", "aria-controls": "iti-".concat(this.id, "__country-listbox"), "aria-expanded": "false", "aria-label": this.options.i18n.selectedCountryAriaLabel || "Selected country" }), this.flagsContainer)), o && (this.selectedFlagInner = this._createEl("div", { class: "iti__flag" }, this.selectedFlag)), this.selectedFlag && this.telInput.disabled && this.selectedFlag.setAttribute("aria-disabled", "true"), i && (this.selectedDialCode = this._createEl("div", { class: "iti__selected-dial-code" }, this.selectedFlag)), e) {
24517
24517
  this.telInput.disabled || this.selectedFlag.setAttribute("tabindex", "0"), this.dropdownArrow = this._createEl("div", { class: "iti__arrow" }, this.selectedFlag);
24518
24518
  var Y = u ? "" : "iti--flexible-dropdown-width";
24519
24519
  if (this.dropdownContent = this._createEl("div", { class: "iti__dropdown-content iti__hide ".concat(Y) }), g && (this.searchInput = this._createEl("input", { type: "text", class: "iti__search-input", placeholder: this.options.i18n.searchPlaceholder || "Search" }, this.dropdownContent)), this.countryList = this._createEl("ul", { class: "iti__country-list", id: "iti-".concat(this.id, "__country-listbox"), role: "listbox", "aria-label": this.options.i18n.countryListAriaLabel || "List of countries" }, this.dropdownContent), this.preferredCountries.length && !g && (this._appendListItems(this.preferredCountries, "iti__preferred", true), this._createEl("li", { class: "iti__divider", "aria-hidden": "true" }, this.countryList)), this._appendListItems(this.countries, "iti__standard"), l) {
@@ -24534,12 +24534,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24534
24534
  this.options.showFlags && (u += "<div class='iti__flag-box'><div class='iti__flag iti__".concat(r.iso2, "'></div></div>")), u += "<span class='iti__country-name'>".concat(r.name, "</span>"), u += "<span class='iti__dial-code'>+".concat(r.dialCode, "</span>"), l.insertAdjacentHTML("beforeend", u);
24535
24535
  }
24536
24536
  } }, { key: "_setInitialState", value: function() {
24537
- var t = arguments.length > 0 && arguments[0] !== c ? arguments[0] : false, e = this.telInput.getAttribute("value"), i = this.telInput.value, o = e && e.charAt(0) === "+" && (!i || i.charAt(0) !== "+"), r = o ? e : i, a = this._getDialCode(r), l = this._isRegionlessNanp(r), u = this.options, h = u.initialCountry, g = u.autoInsertDialCode;
24537
+ var t = arguments.length > 0 && arguments[0] !== c ? arguments[0] : false, e = this.telInput.getAttribute("value"), i = this.telInput.value, o = e && e.charAt(0) === "+" && (!i || i.charAt(0) !== "+"), r = o ? e : i, a = this._getDialCode(r), l = this._isRegionlessNanp(r), u = this.options, h = u.initialCountry, g = u.autoInsertDialCode, f = u.defaultToFirstCountry;
24538
24538
  if (a && !l)
24539
24539
  this._updateFlagFromNumber(r);
24540
24540
  else if (h !== "auto" || t) {
24541
- var f = h ? h.toLowerCase() : "", v = f && this._getCountryData(f, true);
24542
- v ? this._setFlag(f) : a && l ? this._setFlag("us") : (this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2, r || this._setFlag(this.defaultCountry)), !r && g && (this.telInput.value = "+".concat(this.selectedCountryData.dialCode));
24541
+ var v = h ? h.toLowerCase() : "", w = v && this._getCountryData(v, true);
24542
+ w ? this._setFlag(v) : a && l ? this._setFlag("us") : f && (this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2, r || this._setFlag(this.defaultCountry)), !r && g && (this.telInput.value = "+".concat(this.selectedCountryData.dialCode));
24543
24543
  }
24544
24544
  r && this._updateValFromNumber(r);
24545
24545
  } }, { key: "_initListeners", value: function() {
@@ -24571,10 +24571,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24571
24571
  window.intlTelInputGlobals.autoCountry ? this.handleAutoCountry() : window.intlTelInputGlobals.startedLoadingAutoCountry || (window.intlTelInputGlobals.startedLoadingAutoCountry = true, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(function() {
24572
24572
  var e = arguments.length > 0 && arguments[0] !== c ? arguments[0] : "", i = e.toLowerCase(), o = i && t._getCountryData(i, true);
24573
24573
  o ? (window.intlTelInputGlobals.autoCountry = i, setTimeout(function() {
24574
- return S("handleAutoCountry");
24575
- })) : (t._setInitialState(true), S("rejectAutoCountryPromise"));
24574
+ return k("handleAutoCountry");
24575
+ })) : (t._setInitialState(true), k("rejectAutoCountryPromise"));
24576
24576
  }, function() {
24577
- return S("rejectAutoCountryPromise");
24577
+ return k("rejectAutoCountryPromise");
24578
24578
  }));
24579
24579
  } }, { key: "_initKeyListeners", value: function() {
24580
24580
  var t = this, e = false;
@@ -24779,8 +24779,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24779
24779
  e && (f -= v), i.scrollTop = f;
24780
24780
  else if (g > l) {
24781
24781
  e && (f += v);
24782
- var A = r - u;
24783
- i.scrollTop = f - A;
24782
+ var w = r - u;
24783
+ i.scrollTop = f - w;
24784
24784
  }
24785
24785
  } }, { key: "_updateDialCode", value: function(t) {
24786
24786
  var e = this.telInput.value, i = "+".concat(t), o;
@@ -24877,18 +24877,18 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24877
24877
  this.options.placeholderNumberType = t, this._updatePlaceholder();
24878
24878
  } }]), s;
24879
24879
  }();
24880
- L.getCountryData = function() {
24880
+ S.getCountryData = function() {
24881
24881
  return p;
24882
24882
  };
24883
24883
  var B = function(n, t, e) {
24884
24884
  var i = document.createElement("script");
24885
24885
  i.onload = function() {
24886
- S("handleUtils"), t && t();
24886
+ k("handleUtils"), t && t();
24887
24887
  }, i.onerror = function() {
24888
- S("rejectUtilsScriptPromise"), e && e();
24888
+ k("rejectUtilsScriptPromise"), e && e();
24889
24889
  }, i.className = "iti-load-utils", i.async = true, i.src = n, document.body.appendChild(i);
24890
24890
  };
24891
- return L.loadUtils = function(s) {
24891
+ return S.loadUtils = function(s) {
24892
24892
  if (!window.intlTelInputUtils && !window.intlTelInputGlobals.startedLoadingUtilsScript) {
24893
24893
  if (window.intlTelInputGlobals.startedLoadingUtilsScript = true, typeof Promise < "u")
24894
24894
  return new Promise(function(n, t) {
@@ -24897,7 +24897,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24897
24897
  B(s);
24898
24898
  }
24899
24899
  return null;
24900
- }, L.defaults = M, L.version = "19.2.20", function(s, n) {
24900
+ }, S.defaults = M, S.version = "19.3.0", function(s, n) {
24901
24901
  var t = new q(s, n);
24902
24902
  return t._init(), s.setAttribute("data-intl-tel-input-id", t.id), window.intlTelInputGlobals.instances[t.id] = t, t;
24903
24903
  };
@@ -24905,22 +24905,22 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24905
24905
  });
24906
24906
  });
24907
24907
  var z = nt(R());
24908
- var U = ({ initialValue: c, onChangeNumber: p, onChangeCountry: y, onChangeValidity: m, onChangeErrorCode: C, initOptions: N, className: F, disabled: P, onFocus: x, onBlur: k }) => {
24909
- let w = (0, import_react.useRef)(null), _ = (0, import_react.useRef)(null), I = () => {
24908
+ var U = ({ initialValue: c, onChangeNumber: p, onChangeCountry: y, onChangeValidity: m, onChangeErrorCode: C, initOptions: N, className: F, disabled: P, onFocus: x, onBlur: D }) => {
24909
+ let I = (0, import_react.useRef)(null), _ = (0, import_react.useRef)(null), L = () => {
24910
24910
  let b = _.current.getNumber(), O = _.current.getSelectedCountryData().iso2;
24911
24911
  if (p(b), y(O), _.current.isValidNumber())
24912
24912
  m(true), C(null);
24913
24913
  else {
24914
- let D = _.current.getValidationError();
24915
- m(false), C(D);
24914
+ let A = _.current.getValidationError();
24915
+ m(false), C(A);
24916
24916
  }
24917
24917
  };
24918
24918
  return (0, import_react.useEffect)(() => {
24919
- let b = w.current;
24920
- return _.current = (0, z.default)(w.current, N), b.addEventListener("countrychange", I), () => {
24921
- b.removeEventListener("countrychange", I), _.current.destroy();
24919
+ let b = I.current;
24920
+ return _.current = (0, z.default)(I.current, N), b.addEventListener("countrychange", L), () => {
24921
+ b.removeEventListener("countrychange", L), _.current.destroy();
24922
24922
  };
24923
- }, []), import_react.default.createElement("input", { type: "tel", ref: w, onInput: I, defaultValue: c, className: F, disabled: P, onFocus: x, onBlur: k });
24923
+ }, []), import_react.default.createElement("input", { type: "tel", ref: I, onInput: L, defaultValue: c, className: F, disabled: P, onFocus: x, onBlur: D });
24924
24924
  };
24925
24925
  U.propTypes = { initialValue: import_prop_types.default.string, onChangeNumber: import_prop_types.default.func, onChangeCountry: import_prop_types.default.func, onChangeValidity: import_prop_types.default.func, onChangeErrorCode: import_prop_types.default.func, initOptions: import_prop_types.default.shape({ allowDropdown: import_prop_types.default.bool, autoInsertDialCode: import_prop_types.default.bool, autoPlaceholder: import_prop_types.default.string, containerClass: import_prop_types.default.string, countrySearch: import_prop_types.default.bool, customPlaceholder: import_prop_types.default.func, dropdownContainer: import_prop_types.default.node, excludeCountries: import_prop_types.default.arrayOf(import_prop_types.default.string), fixDropdownWidth: import_prop_types.default.bool, formatAsYouType: import_prop_types.default.bool, formatOnDisplay: import_prop_types.default.bool, geoIpLookup: import_prop_types.default.func, hiddenInput: import_prop_types.default.func, i18n: import_prop_types.default.objectOf(import_prop_types.default.string), initialCountry: import_prop_types.default.string, nationalMode: import_prop_types.default.bool, onlyCountries: import_prop_types.default.arrayOf(import_prop_types.default.string), placeholderNumberType: import_prop_types.default.string, preferredCountries: import_prop_types.default.arrayOf(import_prop_types.default.string), showFlags: import_prop_types.default.bool, showSelectedDialCode: import_prop_types.default.bool, useFullscreenPopup: import_prop_types.default.bool, utilsScript: import_prop_types.default.string }), className: import_prop_types.default.string, disabled: import_prop_types.default.bool, onFocus: import_prop_types.default.func, onBlur: import_prop_types.default.func };
24926
24926
  U.defaultProps = { initialValue: "", onChangeNumber: () => {
@@ -18,7 +18,6 @@ const defaults = {
18
18
  // whether or not to allow the dropdown
19
19
  allowDropdown: true,
20
20
  // auto insert dial code (A) on init, (B) on user selecting a country, (C) on calling setCountry
21
- // also listen for blur/submit and auto remove dial code if that's all there is
22
21
  autoInsertDialCode: false,
23
22
  // add a placeholder in the input with an example number for the selected country
24
23
  autoPlaceholder: "polite",
@@ -28,6 +27,8 @@ const defaults = {
28
27
  containerClass: "",
29
28
  // modify the auto placeholder
30
29
  customPlaceholder: null,
30
+ // by default, initialise with the first country in the list selected (if no country set via the initial value or initialCountry option)
31
+ defaultToFirstCountry: true,
31
32
  // append menu to specified element
32
33
  dropdownContainer: null,
33
34
  // don't display these countries
@@ -582,7 +583,7 @@ class Iti {
582
583
  const val = useAttribute ? attributeValue : inputValue;
583
584
  const dialCode = this._getDialCode(val);
584
585
  const isRegionlessNanp = this._isRegionlessNanp(val);
585
- const { initialCountry, autoInsertDialCode } = this.options;
586
+ const { initialCountry, autoInsertDialCode, defaultToFirstCountry } = this.options;
586
587
 
587
588
  // if we already have a dial code, and it's not a regionlessNanp, we can go ahead and set the
588
589
  // flag, else fall back to the default country
@@ -598,7 +599,7 @@ class Iti {
598
599
  if (dialCode && isRegionlessNanp) {
599
600
  // has intl dial code, is regionless nanp, and no initialCountry, so default to US
600
601
  this._setFlag("us");
601
- } else {
602
+ } else if (defaultToFirstCountry) {
602
603
  // no dial code and no initialCountry, so default to first in list
603
604
  this.defaultCountry = this.preferredCountries.length
604
605
  ? this.preferredCountries[0].iso2