intl-tel-input 19.2.8 → 19.2.12
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/Gruntfile.js +2 -2
- package/README.md +9 -3
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput-jquery.js +2 -2
- package/build/js/intlTelInput-jquery.min.js +2 -2
- package/build/js/intlTelInput.js +2 -2
- package/build/js/intlTelInput.min.js +2 -2
- package/composer.json +1 -1
- package/grunt/shell.js +2 -2
- package/grunt/watch.js +4 -0
- package/package.json +3 -4
- package/react/build/IntlTelInput.cjs.js +2 -2
- package/react/build/IntlTelInput.cjs.js.map +3 -3
- package/react/build/IntlTelInput.esm.js +2 -2
- package/react/build/IntlTelInput.esm.js.map +3 -3
- package/react/demo/simple-bundle.js +31 -23
- package/react/demo/validation-bundle.js +31 -23
- package/react/src/IntlTelInput.js +5 -3
- package/screenshots/mobile-fullscreen.jpg +0 -0
|
@@ -24330,7 +24330,7 @@ var require_IntlTelInput_cjs = __commonJS({
|
|
|
24330
24330
|
return n = D(n), n in s ? Object.defineProperty(s, n, { value: t, enumerable: true, configurable: true, writable: true }) : s[n] = t, s;
|
|
24331
24331
|
}
|
|
24332
24332
|
function x(s, n) {
|
|
24333
|
-
return _(s) ||
|
|
24333
|
+
return _(s) || I(s, n) || U(s, n) || O();
|
|
24334
24334
|
}
|
|
24335
24335
|
function O() {
|
|
24336
24336
|
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
@@ -24339,21 +24339,21 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24339
24339
|
function U(s, n) {
|
|
24340
24340
|
if (s) {
|
|
24341
24341
|
if (typeof s == "string")
|
|
24342
|
-
return
|
|
24342
|
+
return S(s, n);
|
|
24343
24343
|
var t = Object.prototype.toString.call(s).slice(8, -1);
|
|
24344
24344
|
if (t === "Object" && s.constructor && (t = s.constructor.name), t === "Map" || t === "Set")
|
|
24345
24345
|
return Array.from(s);
|
|
24346
24346
|
if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))
|
|
24347
|
-
return
|
|
24347
|
+
return S(s, n);
|
|
24348
24348
|
}
|
|
24349
24349
|
}
|
|
24350
|
-
function
|
|
24350
|
+
function S(s, n) {
|
|
24351
24351
|
(n == null || n > s.length) && (n = s.length);
|
|
24352
24352
|
for (var t = 0, e = new Array(n); t < n; t++)
|
|
24353
24353
|
e[t] = s[t];
|
|
24354
24354
|
return e;
|
|
24355
24355
|
}
|
|
24356
|
-
function
|
|
24356
|
+
function I(s, n) {
|
|
24357
24357
|
var t = s == null ? null : typeof Symbol < "u" && s[Symbol.iterator] || s["@@iterator"];
|
|
24358
24358
|
if (t != null) {
|
|
24359
24359
|
var e, i, o, r, a = [], l = true, u = false;
|
|
@@ -24383,18 +24383,18 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24383
24383
|
if (Array.isArray(s))
|
|
24384
24384
|
return s;
|
|
24385
24385
|
}
|
|
24386
|
-
function
|
|
24386
|
+
function L(s, n) {
|
|
24387
24387
|
if (!(s instanceof n))
|
|
24388
24388
|
throw new TypeError("Cannot call a class as a function");
|
|
24389
24389
|
}
|
|
24390
|
-
function
|
|
24390
|
+
function b(s, n) {
|
|
24391
24391
|
for (var t = 0; t < n.length; t++) {
|
|
24392
24392
|
var e = n[t];
|
|
24393
24393
|
e.enumerable = e.enumerable || false, e.configurable = true, "value" in e && (e.writable = true), Object.defineProperty(s, D(e.key), e);
|
|
24394
24394
|
}
|
|
24395
24395
|
}
|
|
24396
24396
|
function M(s, n, t) {
|
|
24397
|
-
return n &&
|
|
24397
|
+
return n && b(s.prototype, n), t && b(s, t), Object.defineProperty(s, "prototype", { writable: false }), s;
|
|
24398
24398
|
}
|
|
24399
24399
|
function D(s) {
|
|
24400
24400
|
var n = H(s, "string");
|
|
@@ -24412,13 +24412,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24412
24412
|
}
|
|
24413
24413
|
return (n === "string" ? String : Number)(s);
|
|
24414
24414
|
}
|
|
24415
|
-
var
|
|
24415
|
+
var k = { getInstance: function(n) {
|
|
24416
24416
|
var t = n.getAttribute("data-intl-tel-input-id");
|
|
24417
24417
|
return window.intlTelInputGlobals.instances[t];
|
|
24418
24418
|
}, instances: {}, documentReady: function() {
|
|
24419
24419
|
return document.readyState === "complete";
|
|
24420
24420
|
} };
|
|
24421
|
-
typeof window == "object" && (window.intlTelInputGlobals =
|
|
24421
|
+
typeof window == "object" && (window.intlTelInputGlobals = k);
|
|
24422
24422
|
var W = 0, G = { 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: "" }, q = ["800", "822", "833", "844", "855", "866", "877", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889"], E = function(n) {
|
|
24423
24423
|
var t = window.intlTelInputGlobals.instances;
|
|
24424
24424
|
Object.values(t).forEach(function(e) {
|
|
@@ -24427,7 +24427,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24427
24427
|
}, Y = function() {
|
|
24428
24428
|
function s(n) {
|
|
24429
24429
|
var t = arguments.length > 1 && arguments[1] !== c ? arguments[1] : {};
|
|
24430
|
-
|
|
24430
|
+
L(this, s), this.id = W++, this.telInput = n, this.activeItem = null, this.highlightedItem = null, this.options = Object.assign({}, G, t), this.hadInitialPlaceholder = !!n.getAttribute("placeholder");
|
|
24431
24431
|
}
|
|
24432
24432
|
return M(s, [{ key: "_init", value: function() {
|
|
24433
24433
|
var t = this;
|
|
@@ -24614,7 +24614,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24614
24614
|
var e = new Event(t, { bubbles: true, cancelable: true });
|
|
24615
24615
|
this.telInput.dispatchEvent(e);
|
|
24616
24616
|
} }, { key: "_showDropdown", value: function() {
|
|
24617
|
-
this.options.fixDropdownWidth && (this.dropdownContent.style.width = "".concat(this.telInput.offsetWidth, "px")), this.dropdownContent.classList.remove("iti__hide"), this.selectedFlag.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), this.options.countrySearch
|
|
24617
|
+
if (this.options.fixDropdownWidth && (this.dropdownContent.style.width = "".concat(this.telInput.offsetWidth, "px")), this.dropdownContent.classList.remove("iti__hide"), this.selectedFlag.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), this.options.countrySearch) {
|
|
24618
|
+
var t = this.countryList.firstElementChild;
|
|
24619
|
+
t && this._highlightListItem(t, false), this.searchInput.focus();
|
|
24620
|
+
} else
|
|
24621
|
+
this.activeItem && (this._highlightListItem(this.activeItem, false), this._scrollTo(this.activeItem, true));
|
|
24622
|
+
this._bindDropdownListeners(), this.dropdownArrow.classList.add("iti__arrow--up"), this._trigger("open:countrydropdown");
|
|
24618
24623
|
} }, { key: "_toggleClass", value: function(t, e, i) {
|
|
24619
24624
|
i && !t.classList.contains(e) ? t.classList.add(e) : !i && t.classList.contains(e) && t.classList.remove(e);
|
|
24620
24625
|
} }, { key: "_setDropdownPosition", value: function() {
|
|
@@ -24868,7 +24873,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24868
24873
|
this.options.placeholderNumberType = t, this._updatePlaceholder();
|
|
24869
24874
|
} }]), s;
|
|
24870
24875
|
}();
|
|
24871
|
-
|
|
24876
|
+
k.getCountryData = function() {
|
|
24872
24877
|
return h;
|
|
24873
24878
|
};
|
|
24874
24879
|
var R = function(n, t, e) {
|
|
@@ -24879,7 +24884,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24879
24884
|
E("rejectUtilsScriptPromise"), e && e();
|
|
24880
24885
|
}, i.className = "iti-load-utils", i.async = true, i.src = n, document.body.appendChild(i);
|
|
24881
24886
|
};
|
|
24882
|
-
return
|
|
24887
|
+
return k.loadUtils = function(s) {
|
|
24883
24888
|
if (!window.intlTelInputUtils && !window.intlTelInputGlobals.startedLoadingUtilsScript) {
|
|
24884
24889
|
if (window.intlTelInputGlobals.startedLoadingUtilsScript = true, typeof Promise < "u")
|
|
24885
24890
|
return new Promise(function(n, t) {
|
|
@@ -24888,7 +24893,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24888
24893
|
R(s);
|
|
24889
24894
|
}
|
|
24890
24895
|
return null;
|
|
24891
|
-
},
|
|
24896
|
+
}, k.defaults = G, k.version = "19.2.12", function(s, n) {
|
|
24892
24897
|
var t = new Y(s, n);
|
|
24893
24898
|
return t._init(), s.setAttribute("data-intl-tel-input-id", t.id), window.intlTelInputGlobals.instances[t.id] = t, t;
|
|
24894
24899
|
};
|
|
@@ -24898,22 +24903,25 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24898
24903
|
var at = {};
|
|
24899
24904
|
ot(at, { default: () => st });
|
|
24900
24905
|
module2.exports = rt(at);
|
|
24901
|
-
var
|
|
24906
|
+
var w = B(require_react());
|
|
24902
24907
|
var d = B(require_prop_types());
|
|
24903
24908
|
var V = B(z());
|
|
24904
|
-
var j = ({ initialValue: c, onChangeNumber: h, onChangeCountry: v, onChangeValidity: m, onChangeErrorCode: C, initOptions: P, className: x, disabled: O, onFocus: U, onBlur:
|
|
24905
|
-
let
|
|
24906
|
-
let
|
|
24907
|
-
if (h(
|
|
24909
|
+
var j = ({ initialValue: c, onChangeNumber: h, onChangeCountry: v, onChangeValidity: m, onChangeErrorCode: C, initOptions: P, className: x, disabled: O, onFocus: U, onBlur: S }) => {
|
|
24910
|
+
let I = (0, w.useRef)(null), _ = (0, w.useRef)(null), L = () => {
|
|
24911
|
+
let b = _.current.getNumber(), M = _.current.getSelectedCountryData().iso2;
|
|
24912
|
+
if (h(b), v(M), _.current.isValidNumber())
|
|
24908
24913
|
m(true), C(null);
|
|
24909
24914
|
else {
|
|
24910
24915
|
let D = _.current.getValidationError();
|
|
24911
24916
|
m(false), C(D);
|
|
24912
24917
|
}
|
|
24913
24918
|
};
|
|
24914
|
-
return (0,
|
|
24915
|
-
|
|
24916
|
-
|
|
24919
|
+
return (0, w.useEffect)(() => {
|
|
24920
|
+
let b = I.current;
|
|
24921
|
+
return _.current = (0, V.default)(I.current, P), b.addEventListener("countrychange", L), () => {
|
|
24922
|
+
b.removeEventListener("countrychange", L), _.current.destroy();
|
|
24923
|
+
};
|
|
24924
|
+
}, []), w.default.createElement("input", { type: "tel", ref: I, onInput: L, defaultValue: c, className: x, disabled: O, onFocus: U, onBlur: S });
|
|
24917
24925
|
};
|
|
24918
24926
|
j.propTypes = { initialValue: d.default.string, onChangeNumber: d.default.func, onChangeCountry: d.default.func, onChangeValidity: d.default.func, onChangeErrorCode: d.default.func, initOptions: d.default.shape({ allowDropdown: d.default.bool, autoInsertDialCode: d.default.bool, autoPlaceholder: d.default.string, containerClass: d.default.string, countrySearch: d.default.bool, customPlaceholder: d.default.func, dropdownContainer: d.default.node, excludeCountries: d.default.arrayOf(d.default.string), fixDropdownWidth: d.default.bool, formatAsYouType: d.default.bool, formatOnDisplay: d.default.bool, geoIpLookup: d.default.func, hiddenInput: d.default.func, i18n: d.default.objectOf(d.default.string), initialCountry: d.default.string, nationalMode: d.default.bool, onlyCountries: d.default.arrayOf(d.default.string), placeholderNumberType: d.default.string, preferredCountries: d.default.arrayOf(d.default.string), showFlags: d.default.bool, showSelectedDialCode: d.default.bool, useFullscreenPopup: d.default.bool, utilsScript: d.default.string }), className: d.default.string, disabled: d.default.bool, onFocus: d.default.func, onBlur: d.default.func };
|
|
24919
24927
|
j.defaultProps = { initialValue: "", onChangeNumber: () => {
|
|
@@ -24330,7 +24330,7 @@ var require_IntlTelInput_cjs = __commonJS({
|
|
|
24330
24330
|
return n = D(n), n in s ? Object.defineProperty(s, n, { value: t, enumerable: true, configurable: true, writable: true }) : s[n] = t, s;
|
|
24331
24331
|
}
|
|
24332
24332
|
function x(s, n) {
|
|
24333
|
-
return _(s) ||
|
|
24333
|
+
return _(s) || I(s, n) || U(s, n) || O();
|
|
24334
24334
|
}
|
|
24335
24335
|
function O() {
|
|
24336
24336
|
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
@@ -24339,21 +24339,21 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24339
24339
|
function U(s, n) {
|
|
24340
24340
|
if (s) {
|
|
24341
24341
|
if (typeof s == "string")
|
|
24342
|
-
return
|
|
24342
|
+
return S(s, n);
|
|
24343
24343
|
var t = Object.prototype.toString.call(s).slice(8, -1);
|
|
24344
24344
|
if (t === "Object" && s.constructor && (t = s.constructor.name), t === "Map" || t === "Set")
|
|
24345
24345
|
return Array.from(s);
|
|
24346
24346
|
if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))
|
|
24347
|
-
return
|
|
24347
|
+
return S(s, n);
|
|
24348
24348
|
}
|
|
24349
24349
|
}
|
|
24350
|
-
function
|
|
24350
|
+
function S(s, n) {
|
|
24351
24351
|
(n == null || n > s.length) && (n = s.length);
|
|
24352
24352
|
for (var t = 0, e = new Array(n); t < n; t++)
|
|
24353
24353
|
e[t] = s[t];
|
|
24354
24354
|
return e;
|
|
24355
24355
|
}
|
|
24356
|
-
function
|
|
24356
|
+
function I(s, n) {
|
|
24357
24357
|
var t = s == null ? null : typeof Symbol < "u" && s[Symbol.iterator] || s["@@iterator"];
|
|
24358
24358
|
if (t != null) {
|
|
24359
24359
|
var e, i, o, r, a = [], l = true, u = false;
|
|
@@ -24383,18 +24383,18 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24383
24383
|
if (Array.isArray(s))
|
|
24384
24384
|
return s;
|
|
24385
24385
|
}
|
|
24386
|
-
function
|
|
24386
|
+
function L(s, n) {
|
|
24387
24387
|
if (!(s instanceof n))
|
|
24388
24388
|
throw new TypeError("Cannot call a class as a function");
|
|
24389
24389
|
}
|
|
24390
|
-
function
|
|
24390
|
+
function b(s, n) {
|
|
24391
24391
|
for (var t = 0; t < n.length; t++) {
|
|
24392
24392
|
var e = n[t];
|
|
24393
24393
|
e.enumerable = e.enumerable || false, e.configurable = true, "value" in e && (e.writable = true), Object.defineProperty(s, D(e.key), e);
|
|
24394
24394
|
}
|
|
24395
24395
|
}
|
|
24396
24396
|
function M(s, n, t) {
|
|
24397
|
-
return n &&
|
|
24397
|
+
return n && b(s.prototype, n), t && b(s, t), Object.defineProperty(s, "prototype", { writable: false }), s;
|
|
24398
24398
|
}
|
|
24399
24399
|
function D(s) {
|
|
24400
24400
|
var n = H(s, "string");
|
|
@@ -24412,13 +24412,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24412
24412
|
}
|
|
24413
24413
|
return (n === "string" ? String : Number)(s);
|
|
24414
24414
|
}
|
|
24415
|
-
var
|
|
24415
|
+
var k = { getInstance: function(n) {
|
|
24416
24416
|
var t = n.getAttribute("data-intl-tel-input-id");
|
|
24417
24417
|
return window.intlTelInputGlobals.instances[t];
|
|
24418
24418
|
}, instances: {}, documentReady: function() {
|
|
24419
24419
|
return document.readyState === "complete";
|
|
24420
24420
|
} };
|
|
24421
|
-
typeof window == "object" && (window.intlTelInputGlobals =
|
|
24421
|
+
typeof window == "object" && (window.intlTelInputGlobals = k);
|
|
24422
24422
|
var W = 0, G = { 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: "" }, q = ["800", "822", "833", "844", "855", "866", "877", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889"], E = function(n) {
|
|
24423
24423
|
var t = window.intlTelInputGlobals.instances;
|
|
24424
24424
|
Object.values(t).forEach(function(e) {
|
|
@@ -24427,7 +24427,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24427
24427
|
}, Y = function() {
|
|
24428
24428
|
function s(n) {
|
|
24429
24429
|
var t = arguments.length > 1 && arguments[1] !== c ? arguments[1] : {};
|
|
24430
|
-
|
|
24430
|
+
L(this, s), this.id = W++, this.telInput = n, this.activeItem = null, this.highlightedItem = null, this.options = Object.assign({}, G, t), this.hadInitialPlaceholder = !!n.getAttribute("placeholder");
|
|
24431
24431
|
}
|
|
24432
24432
|
return M(s, [{ key: "_init", value: function() {
|
|
24433
24433
|
var t = this;
|
|
@@ -24614,7 +24614,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24614
24614
|
var e = new Event(t, { bubbles: true, cancelable: true });
|
|
24615
24615
|
this.telInput.dispatchEvent(e);
|
|
24616
24616
|
} }, { key: "_showDropdown", value: function() {
|
|
24617
|
-
this.options.fixDropdownWidth && (this.dropdownContent.style.width = "".concat(this.telInput.offsetWidth, "px")), this.dropdownContent.classList.remove("iti__hide"), this.selectedFlag.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), this.options.countrySearch
|
|
24617
|
+
if (this.options.fixDropdownWidth && (this.dropdownContent.style.width = "".concat(this.telInput.offsetWidth, "px")), this.dropdownContent.classList.remove("iti__hide"), this.selectedFlag.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), this.options.countrySearch) {
|
|
24618
|
+
var t = this.countryList.firstElementChild;
|
|
24619
|
+
t && this._highlightListItem(t, false), this.searchInput.focus();
|
|
24620
|
+
} else
|
|
24621
|
+
this.activeItem && (this._highlightListItem(this.activeItem, false), this._scrollTo(this.activeItem, true));
|
|
24622
|
+
this._bindDropdownListeners(), this.dropdownArrow.classList.add("iti__arrow--up"), this._trigger("open:countrydropdown");
|
|
24618
24623
|
} }, { key: "_toggleClass", value: function(t, e, i) {
|
|
24619
24624
|
i && !t.classList.contains(e) ? t.classList.add(e) : !i && t.classList.contains(e) && t.classList.remove(e);
|
|
24620
24625
|
} }, { key: "_setDropdownPosition", value: function() {
|
|
@@ -24868,7 +24873,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24868
24873
|
this.options.placeholderNumberType = t, this._updatePlaceholder();
|
|
24869
24874
|
} }]), s;
|
|
24870
24875
|
}();
|
|
24871
|
-
|
|
24876
|
+
k.getCountryData = function() {
|
|
24872
24877
|
return h;
|
|
24873
24878
|
};
|
|
24874
24879
|
var R = function(n, t, e) {
|
|
@@ -24879,7 +24884,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24879
24884
|
E("rejectUtilsScriptPromise"), e && e();
|
|
24880
24885
|
}, i.className = "iti-load-utils", i.async = true, i.src = n, document.body.appendChild(i);
|
|
24881
24886
|
};
|
|
24882
|
-
return
|
|
24887
|
+
return k.loadUtils = function(s) {
|
|
24883
24888
|
if (!window.intlTelInputUtils && !window.intlTelInputGlobals.startedLoadingUtilsScript) {
|
|
24884
24889
|
if (window.intlTelInputGlobals.startedLoadingUtilsScript = true, typeof Promise < "u")
|
|
24885
24890
|
return new Promise(function(n, t) {
|
|
@@ -24888,7 +24893,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24888
24893
|
R(s);
|
|
24889
24894
|
}
|
|
24890
24895
|
return null;
|
|
24891
|
-
},
|
|
24896
|
+
}, k.defaults = G, k.version = "19.2.12", function(s, n) {
|
|
24892
24897
|
var t = new Y(s, n);
|
|
24893
24898
|
return t._init(), s.setAttribute("data-intl-tel-input-id", t.id), window.intlTelInputGlobals.instances[t.id] = t, t;
|
|
24894
24899
|
};
|
|
@@ -24898,22 +24903,25 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24898
24903
|
var at = {};
|
|
24899
24904
|
ot(at, { default: () => st });
|
|
24900
24905
|
module2.exports = rt(at);
|
|
24901
|
-
var
|
|
24906
|
+
var w = B(require_react());
|
|
24902
24907
|
var d = B(require_prop_types());
|
|
24903
24908
|
var V = B(z());
|
|
24904
|
-
var j = ({ initialValue: c, onChangeNumber: h, onChangeCountry: v, onChangeValidity: m, onChangeErrorCode: C, initOptions: P, className: x, disabled: O, onFocus: U, onBlur:
|
|
24905
|
-
let
|
|
24906
|
-
let
|
|
24907
|
-
if (h(
|
|
24909
|
+
var j = ({ initialValue: c, onChangeNumber: h, onChangeCountry: v, onChangeValidity: m, onChangeErrorCode: C, initOptions: P, className: x, disabled: O, onFocus: U, onBlur: S }) => {
|
|
24910
|
+
let I = (0, w.useRef)(null), _ = (0, w.useRef)(null), L = () => {
|
|
24911
|
+
let b = _.current.getNumber(), M = _.current.getSelectedCountryData().iso2;
|
|
24912
|
+
if (h(b), v(M), _.current.isValidNumber())
|
|
24908
24913
|
m(true), C(null);
|
|
24909
24914
|
else {
|
|
24910
24915
|
let D = _.current.getValidationError();
|
|
24911
24916
|
m(false), C(D);
|
|
24912
24917
|
}
|
|
24913
24918
|
};
|
|
24914
|
-
return (0,
|
|
24915
|
-
|
|
24916
|
-
|
|
24919
|
+
return (0, w.useEffect)(() => {
|
|
24920
|
+
let b = I.current;
|
|
24921
|
+
return _.current = (0, V.default)(I.current, P), b.addEventListener("countrychange", L), () => {
|
|
24922
|
+
b.removeEventListener("countrychange", L), _.current.destroy();
|
|
24923
|
+
};
|
|
24924
|
+
}, []), w.default.createElement("input", { type: "tel", ref: I, onInput: L, defaultValue: c, className: x, disabled: O, onFocus: U, onBlur: S });
|
|
24917
24925
|
};
|
|
24918
24926
|
j.propTypes = { initialValue: d.default.string, onChangeNumber: d.default.func, onChangeCountry: d.default.func, onChangeValidity: d.default.func, onChangeErrorCode: d.default.func, initOptions: d.default.shape({ allowDropdown: d.default.bool, autoInsertDialCode: d.default.bool, autoPlaceholder: d.default.string, containerClass: d.default.string, countrySearch: d.default.bool, customPlaceholder: d.default.func, dropdownContainer: d.default.node, excludeCountries: d.default.arrayOf(d.default.string), fixDropdownWidth: d.default.bool, formatAsYouType: d.default.bool, formatOnDisplay: d.default.bool, geoIpLookup: d.default.func, hiddenInput: d.default.func, i18n: d.default.objectOf(d.default.string), initialCountry: d.default.string, nationalMode: d.default.bool, onlyCountries: d.default.arrayOf(d.default.string), placeholderNumberType: d.default.string, preferredCountries: d.default.arrayOf(d.default.string), showFlags: d.default.bool, showSelectedDialCode: d.default.bool, useFullscreenPopup: d.default.bool, utilsScript: d.default.string }), className: d.default.string, disabled: d.default.bool, onFocus: d.default.func, onBlur: d.default.func };
|
|
24919
24927
|
j.defaultProps = { initialValue: "", onChangeNumber: () => {
|
|
@@ -38,12 +38,14 @@ const IntlTelInput = ({
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
useEffect(() => {
|
|
41
|
+
// store a reference to the current input ref, which otherwise is already lost in the cleanup function
|
|
42
|
+
const inputRefCurrent = inputRef.current;
|
|
41
43
|
itiRef.current = intlTelInput(inputRef.current, initOptions);
|
|
42
|
-
|
|
44
|
+
inputRefCurrent.addEventListener("countrychange", update);
|
|
43
45
|
return () => {
|
|
44
|
-
|
|
46
|
+
inputRefCurrent.removeEventListener("countrychange", update);
|
|
45
47
|
itiRef.current.destroy();
|
|
46
|
-
}
|
|
48
|
+
};
|
|
47
49
|
}, []);
|
|
48
50
|
|
|
49
51
|
return (
|
|
Binary file
|