intl-tel-input 24.3.6 → 24.4.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.
- package/README.md +5 -7
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.js +11 -7
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +243 -264
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/build/js/utils.js +44 -45
- package/package.json +2 -2
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +10 -6
- package/react/build/IntlTelInput.js +10 -6
- package/react/build/IntlTelInputWithUtils.cjs +242 -263
- package/react/build/IntlTelInputWithUtils.js +242 -263
- package/vue/README.md +50 -6
- package/vue/build/IntlTelInput.mjs +70 -60
- package/vue/build/IntlTelInputWithUtils.mjs +467 -482
package/vue/README.md
CHANGED
|
@@ -5,9 +5,12 @@ A Vue component wrapper for the [intl-tel-input](https://github.com/jackocnr/int
|
|
|
5
5
|
- [Demo](#demo)
|
|
6
6
|
- [Getting Started](#getting-started)
|
|
7
7
|
- [Props](#props)
|
|
8
|
+
- [Events](#events)
|
|
9
|
+
- [Accessing Instance Methods](#accessing-instance-methods)
|
|
10
|
+
- [Accessing Static Methods](#accessing-static-methods)
|
|
8
11
|
|
|
9
12
|
## Demo
|
|
10
|
-
Try it for yourself by downloading the project and running `npm install` and then `npm run vue:demo` and then
|
|
13
|
+
Try it for yourself by downloading the project and running `npm install` and then `npm run vue:demo` and then copy the given URL into your browser.
|
|
11
14
|
|
|
12
15
|
## Getting Started
|
|
13
16
|
```vue
|
|
@@ -25,15 +28,56 @@ Try it for yourself by downloading the project and running `npm install` and the
|
|
|
25
28
|
</template>
|
|
26
29
|
```
|
|
27
30
|
|
|
28
|
-
See the [Validation demo](https://github.com/jackocnr/intl-tel-input/blob/master/vue/demo/validation/App.vue) for a more fleshed-out example of how to handle validation
|
|
31
|
+
See the [Validation demo](https://github.com/jackocnr/intl-tel-input/blob/master/vue/demo/validation/App.vue) for a more fleshed-out example of how to handle validation. Make sure to change the path in the `package.json` script to the correct demo if you're running it locally e.g.:
|
|
29
32
|
|
|
30
|
-
|
|
33
|
+
```
|
|
34
|
+
"vue:demo": "vite --config vue/demo/[demo variant]/vite.config.js"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
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/vueWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/vue"` import, then you should couple this with the `utilsScript` 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 `utilsScript` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@24.4.0/build/js/utils.js"`.
|
|
31
38
|
|
|
32
39
|
## Props
|
|
33
40
|
Here's a list of all of the current props you can pass to the IntlTelInput Vue component.
|
|
34
41
|
|
|
35
|
-
**
|
|
36
|
-
Type: `
|
|
42
|
+
**disabled**
|
|
43
|
+
Type: `Boolean`, Default: `false`
|
|
44
|
+
Sets the disabled attribute of both the telephone input and selected country button. *Note: we recommend using this instead of `inputProps.disabled`.*
|
|
45
|
+
|
|
46
|
+
**inputProps**
|
|
47
|
+
Type: `Object`
|
|
48
|
+
The props to pass to the input element e.g. `id`, `class`, `placeholder`, `required`, `onBlur` etc. *Note: we recommend using the separate `disabled` prop instead of `inputProps.disabled`.*
|
|
49
|
+
|
|
50
|
+
**options**
|
|
51
|
+
Type: `Object`
|
|
37
52
|
An object containing the [initialisation options](https://github.com/jackocnr/intl-tel-input?tab=readme-ov-file#initialisation-options) to pass to the plugin. You can use these exactly the same way as with the main JavaScript plugin.
|
|
38
53
|
|
|
39
|
-
|
|
54
|
+
**value**
|
|
55
|
+
Type: `String`
|
|
56
|
+
The initial value to put in the input. This will get auto-formatted on init (according to `formatOnDisplay` initialisation option). IntlTelInput is an uncontrolled input, and so will ignore any changes to this value.
|
|
57
|
+
|
|
58
|
+
## Events
|
|
59
|
+
Here's a list of all of the current events you can listen to on the IntlTelInput Vue component.
|
|
60
|
+
|
|
61
|
+
**changeCountry**
|
|
62
|
+
Type: `Function`
|
|
63
|
+
A handler to be called when the selected country changes. It will be passed the new country iso2 code e.g. "gb" for UK.
|
|
64
|
+
|
|
65
|
+
**changeErrorCode**
|
|
66
|
+
Type: `Function`
|
|
67
|
+
A handler to be called when the number validation error changes. It will be passed the new error code (or `null`).
|
|
68
|
+
|
|
69
|
+
**changeNumber**
|
|
70
|
+
Type: `Function`
|
|
71
|
+
A handler to be called when the number changes. It will be passed the new number.
|
|
72
|
+
|
|
73
|
+
**changeValidity**
|
|
74
|
+
Type: `Function`
|
|
75
|
+
A handler to be called when the number validity changes e.g. to true/false. It will be passed the new isValid boolean.
|
|
76
|
+
|
|
77
|
+
## Accessing Instance Methods
|
|
78
|
+
|
|
79
|
+
You can access all of the plugin's [instance methods](https://github.com/jackocnr/intl-tel-input/blob/master/README.md#instance-methods) (`setNumber`, `setCountry`, `setPlaceholderNumberType` etc) by passing a ref into the IntlTelInput component (using the `ref` prop), and then calling `ref.intlTelInput.instance` e.g. `ref.intlTelInput.instance.setNumber(...);`. See the [Set Number demo](https://github.com/jackocnr/intl-tel-input/blob/master/vue/demo/set-number/App.vue) for a full example. You can also access the input DOM element in a similar way: `ref.intlTelInput.input`.
|
|
80
|
+
|
|
81
|
+
## Accessing Static Methods
|
|
82
|
+
|
|
83
|
+
You can access all of the plugin's [static methods](https://github.com/jackocnr/intl-tel-input/blob/master/README.md#static-methods) by importing `intlTelInput` from the same file as the Vue component e.g. `import { intlTelInput } from "intl-tel-input/vue"` (note the lower case "i" in "intlTelInput"). You can then use this as you would with the main plugin e.g. `intlTelInput.getCountryData()` or `intlTelInput.utils.numberType` etc.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mergeModels as L, useModel as
|
|
1
|
+
import { mergeModels as L, useModel as P, ref as v, onMounted as x, watch as E, onUnmounted as M, withDirectives as B, openBlock as O, createElementBlock as V, mergeProps as F, vModelText as z } from "vue";
|
|
2
2
|
const D = [
|
|
3
3
|
[
|
|
4
4
|
"af",
|
|
@@ -1318,7 +1318,7 @@ for (let u = 0; u < D.length; u++) {
|
|
|
1318
1318
|
nodeById: {}
|
|
1319
1319
|
};
|
|
1320
1320
|
}
|
|
1321
|
-
const
|
|
1321
|
+
const R = {
|
|
1322
1322
|
ad: "Andorra",
|
|
1323
1323
|
ae: "United Arab Emirates",
|
|
1324
1324
|
af: "Afghanistan",
|
|
@@ -1561,7 +1561,7 @@ const F = {
|
|
|
1561
1561
|
za: "South Africa",
|
|
1562
1562
|
zm: "Zambia",
|
|
1563
1563
|
zw: "Zimbabwe"
|
|
1564
|
-
},
|
|
1564
|
+
}, $ = {
|
|
1565
1565
|
selectedCountryAriaLabel: "Selected country",
|
|
1566
1566
|
noCountrySelected: "No country selected",
|
|
1567
1567
|
countryListAriaLabel: "List of countries",
|
|
@@ -1572,10 +1572,10 @@ const F = {
|
|
|
1572
1572
|
// additional countries (not supported by country-list library)
|
|
1573
1573
|
ac: "Ascension Island",
|
|
1574
1574
|
xk: "Kosovo"
|
|
1575
|
-
}, S = { ...
|
|
1575
|
+
}, S = { ...R, ...$ };
|
|
1576
1576
|
for (let u = 0; u < b.length; u++)
|
|
1577
1577
|
b[u].name = S[b[u].iso2];
|
|
1578
|
-
let
|
|
1578
|
+
let j = 0;
|
|
1579
1579
|
const k = {
|
|
1580
1580
|
//* Whether or not to allow the dropdown.
|
|
1581
1581
|
allowDropdown: !0,
|
|
@@ -1631,7 +1631,7 @@ const k = {
|
|
|
1631
1631
|
utilsScript: "",
|
|
1632
1632
|
//* The number type to enforce during validation.
|
|
1633
1633
|
validationNumberType: "MOBILE"
|
|
1634
|
-
},
|
|
1634
|
+
}, K = [
|
|
1635
1635
|
"800",
|
|
1636
1636
|
"822",
|
|
1637
1637
|
"833",
|
|
@@ -1653,10 +1653,10 @@ const k = {
|
|
|
1653
1653
|
const t = I(u);
|
|
1654
1654
|
if (t.charAt(0) === "1") {
|
|
1655
1655
|
const e = t.substr(1, 3);
|
|
1656
|
-
return
|
|
1656
|
+
return K.indexOf(e) !== -1;
|
|
1657
1657
|
}
|
|
1658
1658
|
return !1;
|
|
1659
|
-
},
|
|
1659
|
+
}, U = (u, t, e, i) => {
|
|
1660
1660
|
if (e === 0 && !i)
|
|
1661
1661
|
return 0;
|
|
1662
1662
|
let s = 0;
|
|
@@ -1667,16 +1667,16 @@ const k = {
|
|
|
1667
1667
|
return n;
|
|
1668
1668
|
}
|
|
1669
1669
|
return t.length;
|
|
1670
|
-
},
|
|
1670
|
+
}, y = (u, t, e) => {
|
|
1671
1671
|
const i = document.createElement(u);
|
|
1672
1672
|
return t && Object.entries(t).forEach(([s, n]) => i.setAttribute(s, n)), e && e.appendChild(i), i;
|
|
1673
1673
|
}, _ = (u) => {
|
|
1674
1674
|
const { instances: t } = l;
|
|
1675
1675
|
Object.values(t).forEach((e) => e[u]());
|
|
1676
1676
|
};
|
|
1677
|
-
class
|
|
1677
|
+
class H {
|
|
1678
1678
|
constructor(t, e = {}) {
|
|
1679
|
-
this.id =
|
|
1679
|
+
this.id = j++, this.telInput = t, this.highlightedItem = null, this.options = Object.assign({}, k, e), this.hadInitialPlaceholder = !!t.getAttribute("placeholder");
|
|
1680
1680
|
}
|
|
1681
1681
|
//* Can't be private as it's called from intlTelInput convenience wrapper.
|
|
1682
1682
|
_init() {
|
|
@@ -1785,16 +1785,13 @@ class K {
|
|
|
1785
1785
|
} = this.options;
|
|
1786
1786
|
let C = "iti";
|
|
1787
1787
|
t && (C += " iti--allow-dropdown"), i && (C += " iti--show-flags"), s && (C += ` ${s}`), r || (C += " iti--inline-dropdown");
|
|
1788
|
-
const c =
|
|
1788
|
+
const c = y("div", { class: C });
|
|
1789
1789
|
if ((h = this.telInput.parentNode) == null || h.insertBefore(c, this.telInput), t || i || e) {
|
|
1790
|
-
this.countryContainer =
|
|
1790
|
+
this.countryContainer = y(
|
|
1791
1791
|
"div",
|
|
1792
|
-
{
|
|
1793
|
-
class: "iti__country-container",
|
|
1794
|
-
style: this.showSelectedCountryOnLeft ? "left: 0" : "right: 0"
|
|
1795
|
-
},
|
|
1792
|
+
{ class: "iti__country-container" },
|
|
1796
1793
|
c
|
|
1797
|
-
), t ? (this.selectedCountry =
|
|
1794
|
+
), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", t ? (this.selectedCountry = y(
|
|
1798
1795
|
"button",
|
|
1799
1796
|
{
|
|
1800
1797
|
type: "button",
|
|
@@ -1806,30 +1803,30 @@ class K {
|
|
|
1806
1803
|
role: "combobox"
|
|
1807
1804
|
},
|
|
1808
1805
|
this.countryContainer
|
|
1809
|
-
), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry =
|
|
1806
|
+
), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = y(
|
|
1810
1807
|
"div",
|
|
1811
1808
|
{ class: "iti__selected-country" },
|
|
1812
1809
|
this.countryContainer
|
|
1813
1810
|
);
|
|
1814
|
-
const
|
|
1815
|
-
if (this.selectedCountryInner =
|
|
1811
|
+
const m = y("div", { class: "iti__selected-country-primary" }, this.selectedCountry);
|
|
1812
|
+
if (this.selectedCountryInner = y("div", { class: "iti__flag" }, m), this.selectedCountryA11yText = y(
|
|
1816
1813
|
"span",
|
|
1817
1814
|
{ class: "iti__a11y-text" },
|
|
1818
1815
|
this.selectedCountryInner
|
|
1819
|
-
), t && (this.dropdownArrow =
|
|
1816
|
+
), t && (this.dropdownArrow = y(
|
|
1820
1817
|
"div",
|
|
1821
1818
|
{ class: "iti__arrow", "aria-hidden": "true" },
|
|
1822
|
-
|
|
1823
|
-
)), e && (this.selectedDialCode =
|
|
1819
|
+
m
|
|
1820
|
+
)), e && (this.selectedDialCode = y(
|
|
1824
1821
|
"div",
|
|
1825
1822
|
{ class: "iti__selected-dial-code" },
|
|
1826
1823
|
this.selectedCountry
|
|
1827
1824
|
)), t) {
|
|
1828
1825
|
const f = a ? "" : "iti--flexible-dropdown-width";
|
|
1829
|
-
if (this.dropdownContent =
|
|
1826
|
+
if (this.dropdownContent = y("div", {
|
|
1830
1827
|
id: `iti-${this.id}__dropdown-content`,
|
|
1831
1828
|
class: `iti__dropdown-content iti__hide ${f}`
|
|
1832
|
-
}), p && (this.searchInput =
|
|
1829
|
+
}), p && (this.searchInput = y(
|
|
1833
1830
|
"input",
|
|
1834
1831
|
{
|
|
1835
1832
|
type: "text",
|
|
@@ -1843,11 +1840,11 @@ class K {
|
|
|
1843
1840
|
autocomplete: "off"
|
|
1844
1841
|
},
|
|
1845
1842
|
this.dropdownContent
|
|
1846
|
-
), this.searchResultsA11yText =
|
|
1843
|
+
), this.searchResultsA11yText = y(
|
|
1847
1844
|
"span",
|
|
1848
1845
|
{ class: "iti__a11y-text" },
|
|
1849
1846
|
this.dropdownContent
|
|
1850
|
-
)), this.countryList =
|
|
1847
|
+
)), this.countryList = y(
|
|
1851
1848
|
"ul",
|
|
1852
1849
|
{
|
|
1853
1850
|
class: "iti__country-list",
|
|
@@ -1858,17 +1855,17 @@ class K {
|
|
|
1858
1855
|
this.dropdownContent
|
|
1859
1856
|
), this._appendListItems(), p && this._updateSearchResultsText(), o) {
|
|
1860
1857
|
let g = "iti iti--container";
|
|
1861
|
-
r ? g += " iti--fullscreen-popup" : g += " iti--inline-dropdown", this.dropdown =
|
|
1858
|
+
r ? g += " iti--fullscreen-popup" : g += " iti--inline-dropdown", this.dropdown = y("div", { class: g }), this.dropdown.appendChild(this.dropdownContent);
|
|
1862
1859
|
} else
|
|
1863
1860
|
this.countryContainer.appendChild(this.dropdownContent);
|
|
1864
1861
|
}
|
|
1865
1862
|
}
|
|
1866
1863
|
if (c.appendChild(this.telInput), this._updateInputPadding(), n) {
|
|
1867
|
-
const
|
|
1868
|
-
f.phone && (this.hiddenInput =
|
|
1864
|
+
const m = this.telInput.getAttribute("name") || "", f = n(m);
|
|
1865
|
+
f.phone && (this.hiddenInput = y("input", {
|
|
1869
1866
|
type: "hidden",
|
|
1870
1867
|
name: f.phone
|
|
1871
|
-
}), c.appendChild(this.hiddenInput)), f.country && (this.hiddenInputCountry =
|
|
1868
|
+
}), c.appendChild(this.hiddenInput)), f.country && (this.hiddenInputCountry = y("input", {
|
|
1872
1869
|
type: "hidden",
|
|
1873
1870
|
name: f.country
|
|
1874
1871
|
}), c.appendChild(this.hiddenInputCountry));
|
|
@@ -1877,7 +1874,7 @@ class K {
|
|
|
1877
1874
|
//* For each country: add a country list item <li> to the countryList <ul> container.
|
|
1878
1875
|
_appendListItems() {
|
|
1879
1876
|
for (let t = 0; t < this.countries.length; t++) {
|
|
1880
|
-
const e = this.countries[t], i = t === 0 ? "iti__highlight" : "", s =
|
|
1877
|
+
const e = this.countries[t], i = t === 0 ? "iti__highlight" : "", s = y(
|
|
1881
1878
|
"li",
|
|
1882
1879
|
{
|
|
1883
1880
|
id: `iti-${this.id}__item-${e.iso2}`,
|
|
@@ -1965,8 +1962,8 @@ class K {
|
|
|
1965
1962
|
let a = !1;
|
|
1966
1963
|
new RegExp("\\p{L}", "u").test(this.telInput.value) && (a = !0), this._handleInputEvent = (r) => {
|
|
1967
1964
|
if (this.isAndroid && (r == null ? void 0 : r.data) === "+" && i && n && o) {
|
|
1968
|
-
const c = this.telInput.selectionStart || 0, h = this.telInput.value.substring(0, c - 1),
|
|
1969
|
-
this.telInput.value = h +
|
|
1965
|
+
const c = this.telInput.selectionStart || 0, h = this.telInput.value.substring(0, c - 1), m = this.telInput.value.substring(c);
|
|
1966
|
+
this.telInput.value = h + m, this._openDropdownWithPlus();
|
|
1970
1967
|
return;
|
|
1971
1968
|
}
|
|
1972
1969
|
this._updateCountryFromNumber(this.telInput.value) && this._triggerCountryChange();
|
|
@@ -1974,8 +1971,8 @@ class K {
|
|
|
1974
1971
|
p || d && !t ? a = !0 : /[^+0-9]/.test(this.telInput.value) || (a = !1);
|
|
1975
1972
|
const C = (r == null ? void 0 : r.detail) && r.detail.isSetNumber && !s;
|
|
1976
1973
|
if (e && !a && !C) {
|
|
1977
|
-
const c = this.telInput.selectionStart || 0,
|
|
1978
|
-
this.telInput.value = g, this.telInput.setSelectionRange(
|
|
1974
|
+
const c = this.telInput.selectionStart || 0, m = this.telInput.value.substring(0, c).replace(/[^+0-9]/g, "").length, f = (r == null ? void 0 : r.inputType) === "deleteContentForward", g = this._formatNumberAsYouType(), w = U(m, g, c, f);
|
|
1975
|
+
this.telInput.value = g, this.telInput.setSelectionRange(w, w);
|
|
1979
1976
|
}
|
|
1980
1977
|
}, this.telInput.addEventListener("input", this._handleInputEvent), (t || i) && (this._handleKeydownEvent = (r) => {
|
|
1981
1978
|
if (r.key && r.key.length === 1 && !r.altKey && !r.ctrlKey && !r.metaKey) {
|
|
@@ -1984,8 +1981,8 @@ class K {
|
|
|
1984
1981
|
return;
|
|
1985
1982
|
}
|
|
1986
1983
|
if (t) {
|
|
1987
|
-
const p = this.telInput.selectionStart === 0 && r.key === "+", d = /^[0-9]$/.test(r.key), C = i ? d : p || d, c = this._getFullNumber(), h = l.utils.getCoreNumber(c, this.selectedCountryData.iso2),
|
|
1988
|
-
(!C ||
|
|
1984
|
+
const p = this.telInput.selectionStart === 0 && r.key === "+", d = /^[0-9]$/.test(r.key), C = i ? d : p || d, c = this._getFullNumber(), h = l.utils.getCoreNumber(c, this.selectedCountryData.iso2), m = this.maxCoreNumberLength && h.length >= this.maxCoreNumberLength, f = this.telInput.value.substring(this.telInput.selectionStart, this.telInput.selectionEnd), g = /\d/.test(f), T = (this.telInput.selectionStart || 0) === this.telInput.value.length;
|
|
1985
|
+
(!C || m && !g && T) && r.preventDefault();
|
|
1989
1986
|
}
|
|
1990
1987
|
}
|
|
1991
1988
|
}, this.telInput.addEventListener("keydown", this._handleKeydownEvent));
|
|
@@ -2442,7 +2439,7 @@ class K {
|
|
|
2442
2439
|
this.telInput.disabled = t, t ? this.selectedCountry.setAttribute("disabled", "true") : this.selectedCountry.removeAttribute("disabled");
|
|
2443
2440
|
}
|
|
2444
2441
|
}
|
|
2445
|
-
const
|
|
2442
|
+
const G = (u) => !l.utils && !l.startedLoadingUtilsScript ? (l.startedLoadingUtilsScript = !0, new Promise((t, e) => {
|
|
2446
2443
|
import(
|
|
2447
2444
|
/* webpackIgnore: true */
|
|
2448
2445
|
/* @vite-ignore */
|
|
@@ -2454,7 +2451,7 @@ const U = (u) => !l.utils && !l.startedLoadingUtilsScript ? (l.startedLoadingUti
|
|
|
2454
2451
|
});
|
|
2455
2452
|
})) : null, l = Object.assign(
|
|
2456
2453
|
(u, t) => {
|
|
2457
|
-
const e = new
|
|
2454
|
+
const e = new H(u, t);
|
|
2458
2455
|
return e._init(), u.setAttribute("data-intl-tel-input-id", e.id.toString()), l.instances[e.id] = e, e;
|
|
2459
2456
|
},
|
|
2460
2457
|
{
|
|
@@ -2470,12 +2467,20 @@ const U = (u) => !l.utils && !l.startedLoadingUtilsScript ? (l.startedLoadingUti
|
|
|
2470
2467
|
},
|
|
2471
2468
|
//* A map from instance ID to instance object.
|
|
2472
2469
|
instances: {},
|
|
2473
|
-
loadUtils:
|
|
2474
|
-
version: "24.
|
|
2470
|
+
loadUtils: G,
|
|
2471
|
+
version: "24.4.0"
|
|
2475
2472
|
}
|
|
2476
|
-
),
|
|
2473
|
+
), q = {
|
|
2477
2474
|
__name: "IntlTelInput",
|
|
2478
2475
|
props: /* @__PURE__ */ L({
|
|
2476
|
+
disabled: {
|
|
2477
|
+
type: Boolean,
|
|
2478
|
+
default: !1
|
|
2479
|
+
},
|
|
2480
|
+
inputProps: {
|
|
2481
|
+
type: Object,
|
|
2482
|
+
default: () => ({})
|
|
2483
|
+
},
|
|
2479
2484
|
options: {
|
|
2480
2485
|
type: Object,
|
|
2481
2486
|
default: () => ({})
|
|
@@ -2483,9 +2488,6 @@ const U = (u) => !l.utils && !l.startedLoadingUtilsScript ? (l.startedLoadingUti
|
|
|
2483
2488
|
value: {
|
|
2484
2489
|
type: String,
|
|
2485
2490
|
default: ""
|
|
2486
|
-
},
|
|
2487
|
-
disabled: {
|
|
2488
|
-
type: Boolean
|
|
2489
2491
|
}
|
|
2490
2492
|
}, {
|
|
2491
2493
|
modelValue: {
|
|
@@ -2494,11 +2496,19 @@ const U = (u) => !l.utils && !l.startedLoadingUtilsScript ? (l.startedLoadingUti
|
|
|
2494
2496
|
},
|
|
2495
2497
|
modelModifiers: {}
|
|
2496
2498
|
}),
|
|
2497
|
-
emits: /* @__PURE__ */ L([
|
|
2499
|
+
emits: /* @__PURE__ */ L([
|
|
2500
|
+
"changeNumber",
|
|
2501
|
+
"changeCountry",
|
|
2502
|
+
"changeValidity",
|
|
2503
|
+
"changeErrorCode"
|
|
2504
|
+
], ["update:modelValue"]),
|
|
2498
2505
|
setup(u, { expose: t, emit: e }) {
|
|
2499
|
-
const i =
|
|
2506
|
+
const i = P(u, "modelValue"), s = u, n = e, o = v(), a = v(), r = v(!1), p = () => a.value ? s.options.strictMode ? a.value.isValidNumberPrecise() : a.value.isValidNumber() : null, d = () => {
|
|
2500
2507
|
let h = p();
|
|
2501
|
-
r.value !== h && (r.value = h, n("changeValidity", !!h), n(
|
|
2508
|
+
r.value !== h && (r.value = h, n("changeValidity", !!h), n(
|
|
2509
|
+
"changeErrorCode",
|
|
2510
|
+
h ? null : a.value.getValidationError()
|
|
2511
|
+
));
|
|
2502
2512
|
}, C = () => {
|
|
2503
2513
|
var h;
|
|
2504
2514
|
n("changeNumber", ((h = a.value) == null ? void 0 : h.getNumber()) ?? ""), d();
|
|
@@ -2506,29 +2516,29 @@ const U = (u) => !l.utils && !l.startedLoadingUtilsScript ? (l.startedLoadingUti
|
|
|
2506
2516
|
var h;
|
|
2507
2517
|
n("changeCountry", ((h = a.value) == null ? void 0 : h.getSelectedCountryData().iso2) ?? ""), C(), d();
|
|
2508
2518
|
};
|
|
2509
|
-
return
|
|
2519
|
+
return x(() => {
|
|
2510
2520
|
o.value && (a.value = l(o.value, s.options), s.value && a.value.setNumber(s.value), s.disabled && a.value.setDisabled(s.disabled));
|
|
2511
|
-
}),
|
|
2521
|
+
}), E(
|
|
2512
2522
|
() => s.disabled,
|
|
2513
2523
|
(h) => {
|
|
2514
|
-
var
|
|
2515
|
-
return (
|
|
2524
|
+
var m;
|
|
2525
|
+
return (m = a.value) == null ? void 0 : m.setDisabled(h);
|
|
2516
2526
|
}
|
|
2517
|
-
),
|
|
2527
|
+
), M(() => {
|
|
2518
2528
|
var h;
|
|
2519
2529
|
return (h = a.value) == null ? void 0 : h.destroy();
|
|
2520
|
-
}), t({ instance: a, input: o }), (h,
|
|
2530
|
+
}), t({ instance: a, input: o }), (h, m) => B((O(), V("input", F({
|
|
2521
2531
|
ref_key: "input",
|
|
2522
2532
|
ref: o,
|
|
2523
|
-
"onUpdate:modelValue":
|
|
2533
|
+
"onUpdate:modelValue": m[0] || (m[0] = (f) => i.value = f),
|
|
2524
2534
|
type: "tel",
|
|
2525
2535
|
onCountrychange: c,
|
|
2526
2536
|
onInput: C
|
|
2527
|
-
}, null,
|
|
2528
|
-
[
|
|
2537
|
+
}, u.inputProps), null, 16)), [
|
|
2538
|
+
[z, i.value]
|
|
2529
2539
|
]);
|
|
2530
2540
|
}
|
|
2531
2541
|
};
|
|
2532
2542
|
export {
|
|
2533
|
-
|
|
2543
|
+
q as default
|
|
2534
2544
|
};
|