maz-ui 3.18.2 → 3.19.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/components/MazPhoneNumberInput/{constantes/locales.d.ts → default-locales.d.ts} +1 -2
- package/components/MazPhoneNumberInput/types.d.ts +40 -2
- package/components/MazPhoneNumberInput/use-libphonenumber.d.ts +32 -0
- package/components/MazPhoneNumberInput.d.ts +65 -14
- package/components/MazPhoneNumberInput.mjs +1 -1
- package/components/MazSelect.d.ts +2 -0
- package/components/MazSelect.mjs +1 -1
- package/components/assets/MazPhoneNumberInput.css +1 -1
- package/components/assets/MazSelect.css +1 -1
- package/components/chunks/{MazBtn-b191eece.mjs → MazBtn-290141e9.mjs} +2 -2
- package/components/chunks/{MazBtn-875045b0.mjs → MazBtn-8d0f8eb2.mjs} +2 -2
- package/components/chunks/{MazInput-3021f55e.mjs → MazInput-4775c6de.mjs} +2 -2
- package/components/chunks/MazPhoneNumberInput-37eb2437.mjs +650 -0
- package/components/chunks/{MazSelect-d3d81ae8.mjs → MazSelect-13d3fe3a.mjs} +52 -17
- package/components/chunks/{MazSelect-c03eaaf8.mjs → MazSelect-9270ae9c.mjs} +51 -16
- package/components/chunks/{MazSpinner-87273e1f.mjs → MazSpinner-3e5a5ee0.mjs} +1 -1
- package/components/chunks/{MazSpinner-a3fe9ccb.mjs → MazSpinner-bfd1f135.mjs} +1 -1
- package/modules/assets/index.css +1 -1
- package/modules/chunks/{MazBtn-bf5d1483.mjs → MazBtn-c57ccb54.mjs} +3 -3
- package/modules/chunks/{MazIcon-1567cfaf.mjs → MazIcon-c5f0f47e.mjs} +1 -1
- package/modules/chunks/{MazSpinner-dda0b697.mjs → MazSpinner-bb0e791a.mjs} +1 -1
- package/modules/chunks/{index-a39534c8.mjs → index-7220b7e8.mjs} +4 -4
- package/modules/index.mjs +1 -1
- package/nuxt/index.json +1 -1
- package/package.json +1 -1
- package/types/components/MazPhoneNumberInput/{constantes/locales.d.ts → default-locales.d.ts} +1 -2
- package/types/components/MazPhoneNumberInput/types.d.ts +40 -2
- package/types/components/MazPhoneNumberInput/use-libphonenumber.d.ts +32 -0
- package/types/components/MazPhoneNumberInput.vue.d.ts +65 -14
- package/types/components/MazSelect.vue.d.ts +2 -0
- package/components/MazPhoneNumberInput/utils/countries-name-list-by-iso-code.d.ts +0 -2
- package/components/MazPhoneNumberInput/utils/index.d.ts +0 -12
- package/components/chunks/MazPhoneNumberInput-59aa8e06.mjs +0 -854
- package/types/components/MazPhoneNumberInput/utils/countries-name-list-by-iso-code.d.ts +0 -2
- package/types/components/MazPhoneNumberInput/utils/index.d.ts +0 -12
|
@@ -1,854 +0,0 @@
|
|
|
1
|
-
import "../assets/MazPhoneNumberInput.css";
|
|
2
|
-
import { computed, defineComponent, defineAsyncComponent, getCurrentInstance, ref, onBeforeMount, onMounted, watch, openBlock, createElementBlock, unref, normalizeClass, toDisplayString, createCommentVNode, createBlock, withCtx, createElementVNode, createVNode, mergeProps } from "vue";
|
|
3
|
-
import { getExampleNumber, getCountries, getCountryCallingCode, isSupportedCountry, parsePhoneNumberFromString, AsYouType } from "libphonenumber-js";
|
|
4
|
-
const countriesNameListByIsoCode = {
|
|
5
|
-
AC: "Ascension Island",
|
|
6
|
-
AF: "Afghanistan",
|
|
7
|
-
AL: "Albania",
|
|
8
|
-
DZ: "Algeria",
|
|
9
|
-
AS: "American Samoa",
|
|
10
|
-
AD: "Andorra",
|
|
11
|
-
AO: "Angola",
|
|
12
|
-
AI: "Anguilla",
|
|
13
|
-
AG: "Antigua and Barbuda",
|
|
14
|
-
AR: "Argentina",
|
|
15
|
-
AM: "Armenia",
|
|
16
|
-
AW: "Aruba",
|
|
17
|
-
AU: "Australia",
|
|
18
|
-
AT: "Austria",
|
|
19
|
-
AZ: "Azerbaijan",
|
|
20
|
-
BS: "Bahamas (the)",
|
|
21
|
-
BH: "Bahrain",
|
|
22
|
-
BD: "Bangladesh",
|
|
23
|
-
BB: "Barbados",
|
|
24
|
-
BY: "Belarus",
|
|
25
|
-
BE: "Belgium",
|
|
26
|
-
BZ: "Belize",
|
|
27
|
-
BJ: "Benin",
|
|
28
|
-
BM: "Bermuda",
|
|
29
|
-
BT: "Bhutan",
|
|
30
|
-
BO: "Bolivia (Plurinational State of)",
|
|
31
|
-
BQ: "Bonaire, Sint Eustatius and Saba",
|
|
32
|
-
BA: "Bosnia and Herzegovina",
|
|
33
|
-
BW: "Botswana",
|
|
34
|
-
BR: "Brazil",
|
|
35
|
-
IO: "British Indian Ocean Territory (the)",
|
|
36
|
-
BN: "Brunei Darussalam",
|
|
37
|
-
BG: "Bulgaria",
|
|
38
|
-
BF: "Burkina Faso",
|
|
39
|
-
BI: "Burundi",
|
|
40
|
-
CV: "Cabo Verde",
|
|
41
|
-
KH: "Cambodia",
|
|
42
|
-
CM: "Cameroon",
|
|
43
|
-
CA: "Canada",
|
|
44
|
-
KY: "Cayman Islands (the)",
|
|
45
|
-
CF: "Central African Republic (the)",
|
|
46
|
-
TD: "Chad",
|
|
47
|
-
CL: "Chile",
|
|
48
|
-
CN: "China",
|
|
49
|
-
CX: "Christmas Island",
|
|
50
|
-
CC: "Cocos (Keeling) Islands (the)",
|
|
51
|
-
CO: "Colombia",
|
|
52
|
-
KM: "Comoros (the)",
|
|
53
|
-
CD: "Congo (the Democratic Republic of the)",
|
|
54
|
-
CG: "Congo (the)",
|
|
55
|
-
CK: "Cook Islands (the)",
|
|
56
|
-
CR: "Costa Rica",
|
|
57
|
-
HR: "Croatia",
|
|
58
|
-
CU: "Cuba",
|
|
59
|
-
CW: "Curaçao",
|
|
60
|
-
CY: "Cyprus",
|
|
61
|
-
CZ: "Czechia",
|
|
62
|
-
CI: "Côte d'Ivoire",
|
|
63
|
-
DK: "Denmark",
|
|
64
|
-
DJ: "Djibouti",
|
|
65
|
-
DM: "Dominica",
|
|
66
|
-
DO: "Dominican Republic (the)",
|
|
67
|
-
EC: "Ecuador",
|
|
68
|
-
EG: "Egypt",
|
|
69
|
-
SV: "El Salvador",
|
|
70
|
-
GQ: "Equatorial Guinea",
|
|
71
|
-
ER: "Eritrea",
|
|
72
|
-
EE: "Estonia",
|
|
73
|
-
SZ: "Eswatini",
|
|
74
|
-
ET: "Ethiopia",
|
|
75
|
-
FK: "Falkland Islands (the) [Malvinas]",
|
|
76
|
-
FO: "Faroe Islands (the)",
|
|
77
|
-
FJ: "Fiji",
|
|
78
|
-
FI: "Finland",
|
|
79
|
-
FR: "France",
|
|
80
|
-
GF: "French Guiana",
|
|
81
|
-
PF: "French Polynesia",
|
|
82
|
-
GA: "Gabon",
|
|
83
|
-
GM: "Gambia (the)",
|
|
84
|
-
GE: "Georgia",
|
|
85
|
-
DE: "Germany",
|
|
86
|
-
GH: "Ghana",
|
|
87
|
-
GI: "Gibraltar",
|
|
88
|
-
GR: "Greece",
|
|
89
|
-
GL: "Greenland",
|
|
90
|
-
GD: "Grenada",
|
|
91
|
-
GP: "Guadeloupe",
|
|
92
|
-
GU: "Guam",
|
|
93
|
-
GT: "Guatemala",
|
|
94
|
-
GG: "Guernsey",
|
|
95
|
-
GN: "Guinea",
|
|
96
|
-
GW: "Guinea-Bissau",
|
|
97
|
-
GY: "Guyana",
|
|
98
|
-
HT: "Haiti",
|
|
99
|
-
VA: "Holy See (the)",
|
|
100
|
-
HN: "Honduras",
|
|
101
|
-
HK: "Hong Kong",
|
|
102
|
-
HU: "Hungary",
|
|
103
|
-
IS: "Iceland",
|
|
104
|
-
IN: "India",
|
|
105
|
-
ID: "Indonesia",
|
|
106
|
-
IR: "Iran (Islamic Republic of)",
|
|
107
|
-
IQ: "Iraq",
|
|
108
|
-
IE: "Ireland",
|
|
109
|
-
IM: "Isle of Man",
|
|
110
|
-
IL: "Israel",
|
|
111
|
-
IT: "Italy",
|
|
112
|
-
JM: "Jamaica",
|
|
113
|
-
JP: "Japan",
|
|
114
|
-
JE: "Jersey",
|
|
115
|
-
JO: "Jordan",
|
|
116
|
-
KZ: "Kazakhstan",
|
|
117
|
-
KE: "Kenya",
|
|
118
|
-
KI: "Kiribati",
|
|
119
|
-
KP: "Korea (the Democratic People's Republic of)",
|
|
120
|
-
KR: "Korea (the Republic of)",
|
|
121
|
-
KW: "Kuwait",
|
|
122
|
-
KG: "Kyrgyzstan",
|
|
123
|
-
LA: "Lao People's Democratic Republic (the)",
|
|
124
|
-
LV: "Latvia",
|
|
125
|
-
LB: "Lebanon",
|
|
126
|
-
LS: "Lesotho",
|
|
127
|
-
LR: "Liberia",
|
|
128
|
-
LY: "Libya",
|
|
129
|
-
LI: "Liechtenstein",
|
|
130
|
-
LT: "Lithuania",
|
|
131
|
-
LU: "Luxembourg",
|
|
132
|
-
MO: "Macao",
|
|
133
|
-
MG: "Madagascar",
|
|
134
|
-
MW: "Malawi",
|
|
135
|
-
MY: "Malaysia",
|
|
136
|
-
MV: "Maldives",
|
|
137
|
-
ML: "Mali",
|
|
138
|
-
MT: "Malta",
|
|
139
|
-
MH: "Marshall Islands (the)",
|
|
140
|
-
MQ: "Martinique",
|
|
141
|
-
MR: "Mauritania",
|
|
142
|
-
MU: "Mauritius",
|
|
143
|
-
YT: "Mayotte",
|
|
144
|
-
MX: "Mexico",
|
|
145
|
-
FM: "Micronesia (Federated States of)",
|
|
146
|
-
MD: "Moldova (the Republic of)",
|
|
147
|
-
MC: "Monaco",
|
|
148
|
-
MN: "Mongolia",
|
|
149
|
-
ME: "Montenegro",
|
|
150
|
-
MS: "Montserrat",
|
|
151
|
-
MA: "Morocco",
|
|
152
|
-
MZ: "Mozambique",
|
|
153
|
-
MM: "Myanmar",
|
|
154
|
-
NA: "Namibia",
|
|
155
|
-
NR: "Nauru",
|
|
156
|
-
NP: "Nepal",
|
|
157
|
-
NL: "Netherlands (the)",
|
|
158
|
-
NC: "New Caledonia",
|
|
159
|
-
NZ: "New Zealand",
|
|
160
|
-
NI: "Nicaragua",
|
|
161
|
-
NE: "Niger (the)",
|
|
162
|
-
NG: "Nigeria",
|
|
163
|
-
NU: "Niue",
|
|
164
|
-
NF: "Norfolk Island",
|
|
165
|
-
MP: "Northern Mariana Islands (the)",
|
|
166
|
-
NO: "Norway",
|
|
167
|
-
OM: "Oman",
|
|
168
|
-
PK: "Pakistan",
|
|
169
|
-
PW: "Palau",
|
|
170
|
-
PS: "Palestine, State of",
|
|
171
|
-
PA: "Panama",
|
|
172
|
-
PG: "Papua New Guinea",
|
|
173
|
-
PY: "Paraguay",
|
|
174
|
-
PE: "Peru",
|
|
175
|
-
PH: "Philippines (the)",
|
|
176
|
-
PL: "Poland",
|
|
177
|
-
PT: "Portugal",
|
|
178
|
-
PR: "Puerto Rico",
|
|
179
|
-
QA: "Qatar",
|
|
180
|
-
MK: "Republic of North Macedonia",
|
|
181
|
-
RO: "Romania",
|
|
182
|
-
RU: "Russian Federation (the)",
|
|
183
|
-
RW: "Rwanda",
|
|
184
|
-
RE: "Réunion",
|
|
185
|
-
BL: "Saint Barthélemy",
|
|
186
|
-
SH: "Saint Helena, Ascension and Tristan da Cunha",
|
|
187
|
-
KN: "Saint Kitts and Nevis",
|
|
188
|
-
LC: "Saint Lucia",
|
|
189
|
-
MF: "Saint Martin (French part)",
|
|
190
|
-
PM: "Saint Pierre and Miquelon",
|
|
191
|
-
VC: "Saint Vincent and the Grenadines",
|
|
192
|
-
WS: "Samoa",
|
|
193
|
-
SM: "San Marino",
|
|
194
|
-
ST: "Sao Tome and Principe",
|
|
195
|
-
SA: "Saudi Arabia",
|
|
196
|
-
SN: "Senegal",
|
|
197
|
-
RS: "Serbia",
|
|
198
|
-
SC: "Seychelles",
|
|
199
|
-
SL: "Sierra Leone",
|
|
200
|
-
SG: "Singapore",
|
|
201
|
-
SX: "Sint Maarten (Dutch part)",
|
|
202
|
-
SK: "Slovakia",
|
|
203
|
-
SI: "Slovenia",
|
|
204
|
-
SB: "Solomon Islands",
|
|
205
|
-
SO: "Somalia",
|
|
206
|
-
ZA: "South Africa",
|
|
207
|
-
SS: "South Sudan",
|
|
208
|
-
ES: "Spain",
|
|
209
|
-
LK: "Sri Lanka",
|
|
210
|
-
SD: "Sudan (the)",
|
|
211
|
-
SR: "Suriname",
|
|
212
|
-
SJ: "Svalbard and Jan Mayen",
|
|
213
|
-
SE: "Sweden",
|
|
214
|
-
CH: "Switzerland",
|
|
215
|
-
SY: "Syrian Arab Republic",
|
|
216
|
-
TA: "Tajikistan",
|
|
217
|
-
TW: "Taiwan",
|
|
218
|
-
TJ: "Tajikistan",
|
|
219
|
-
TZ: "Tanzania, United Republic of",
|
|
220
|
-
TH: "Thailand",
|
|
221
|
-
TL: "Timor-Leste",
|
|
222
|
-
TG: "Togo",
|
|
223
|
-
TK: "Tokelau",
|
|
224
|
-
TO: "Tonga",
|
|
225
|
-
TT: "Trinidad and Tobago",
|
|
226
|
-
TN: "Tunisia",
|
|
227
|
-
TR: "Turkey",
|
|
228
|
-
TM: "Turkmenistan",
|
|
229
|
-
TC: "Turks and Caicos Islands (the)",
|
|
230
|
-
TV: "Tuvalu",
|
|
231
|
-
UG: "Uganda",
|
|
232
|
-
UA: "Ukraine",
|
|
233
|
-
AE: "United Arab Emirates (the)",
|
|
234
|
-
GB: "United Kingdom of Great Britain and Northern Ireland (the)",
|
|
235
|
-
US: "United States of America (the)",
|
|
236
|
-
UY: "Uruguay",
|
|
237
|
-
UZ: "Uzbekistan",
|
|
238
|
-
VU: "Vanuatu",
|
|
239
|
-
VE: "Venezuela (Bolivarian Republic of)",
|
|
240
|
-
VN: "Viet Nam",
|
|
241
|
-
VG: "Virgin Islands (British)",
|
|
242
|
-
VI: "Virgin Islands (U.S.)",
|
|
243
|
-
WF: "Wallis and Futuna",
|
|
244
|
-
EH: "Western Sahara",
|
|
245
|
-
YE: "Yemen",
|
|
246
|
-
XK: "Kosovo",
|
|
247
|
-
ZM: "Zambia",
|
|
248
|
-
ZW: "Zimbabwe",
|
|
249
|
-
AX: "Åland Islands"
|
|
250
|
-
};
|
|
251
|
-
function getCountryName(code, customCountriesNameListByIsoCode) {
|
|
252
|
-
return {
|
|
253
|
-
...countriesNameListByIsoCode,
|
|
254
|
-
...customCountriesNameListByIsoCode
|
|
255
|
-
}[code];
|
|
256
|
-
}
|
|
257
|
-
const PHONE_CHAR_REGEX = /^[\d ().-]+$/;
|
|
258
|
-
const NON_ALPHA_REGEX = /^[^a-z]+$/i;
|
|
259
|
-
let examples;
|
|
260
|
-
async function loadPhoneNumberExamplesFile() {
|
|
261
|
-
const { default: data } = await import("./examples.mobile.json-618ba782.mjs");
|
|
262
|
-
examples = data;
|
|
263
|
-
return examples;
|
|
264
|
-
}
|
|
265
|
-
function getExamplePhoneNumber(countryCode) {
|
|
266
|
-
return getExampleNumber(countryCode, examples);
|
|
267
|
-
}
|
|
268
|
-
function sanitizePhoneNumber(input) {
|
|
269
|
-
if (!input) {
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
const hasNonAlpha = NON_ALPHA_REGEX.test(input);
|
|
273
|
-
const hasPhoneChar = PHONE_CHAR_REGEX.test(input);
|
|
274
|
-
if (!hasNonAlpha && !hasPhoneChar) {
|
|
275
|
-
return input.replaceAll(/[^\d.]/g, "");
|
|
276
|
-
}
|
|
277
|
-
return input;
|
|
278
|
-
}
|
|
279
|
-
function getCountriesList(customCountriesNameListByIsoCode) {
|
|
280
|
-
const countriesList = [];
|
|
281
|
-
const isoList = getCountries();
|
|
282
|
-
for (const iso2 of isoList) {
|
|
283
|
-
const name = getCountryName(iso2, customCountriesNameListByIsoCode);
|
|
284
|
-
if (name) {
|
|
285
|
-
try {
|
|
286
|
-
const dialCode = getCountryCallingCode(iso2);
|
|
287
|
-
countriesList.push({
|
|
288
|
-
iso2,
|
|
289
|
-
dialCode,
|
|
290
|
-
name
|
|
291
|
-
});
|
|
292
|
-
} catch (error) {
|
|
293
|
-
console.error(`[MazPhoneNumberInput](getCountryCallingCode) ${error}`);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
return countriesList;
|
|
298
|
-
}
|
|
299
|
-
function browserLocale() {
|
|
300
|
-
try {
|
|
301
|
-
if (typeof window === "undefined") {
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
const browserLocale2 = window.navigator.language;
|
|
305
|
-
if (!browserLocale2) {
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
let locale = browserLocale2.slice(3, 7).toUpperCase();
|
|
309
|
-
if (locale === "") {
|
|
310
|
-
locale = browserLocale2.slice(0, 2).toUpperCase();
|
|
311
|
-
}
|
|
312
|
-
if (locale === "EN") {
|
|
313
|
-
locale = "US";
|
|
314
|
-
}
|
|
315
|
-
if (locale === "JA") {
|
|
316
|
-
locale = "JP";
|
|
317
|
-
}
|
|
318
|
-
return locale;
|
|
319
|
-
} catch (error) {
|
|
320
|
-
throw new Error(`[MazPhoneNumberInput](browserLocale) ${error}`);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
function isCountryAvailable(locale) {
|
|
324
|
-
try {
|
|
325
|
-
const response = isSupportedCountry(locale);
|
|
326
|
-
if (!response) {
|
|
327
|
-
console.error(
|
|
328
|
-
`[MazPhoneNumberInput](isCountryAvailable) The code country "${locale}" is not available`
|
|
329
|
-
);
|
|
330
|
-
}
|
|
331
|
-
return response;
|
|
332
|
-
} catch (error) {
|
|
333
|
-
throw new Error(`[MazPhoneNumberInput](isCountryAvailable) ${error}`);
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
const getResultsFromPhoneNumber = (countryCode, phoneNumber) => {
|
|
337
|
-
try {
|
|
338
|
-
if (!phoneNumber) {
|
|
339
|
-
return {
|
|
340
|
-
isValid: false,
|
|
341
|
-
countryCode
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
|
-
const parsing = parsePhoneNumberFromString(phoneNumber, countryCode);
|
|
345
|
-
return {
|
|
346
|
-
isValid: (parsing == null ? void 0 : parsing.isValid()) ?? false,
|
|
347
|
-
isPossible: parsing == null ? void 0 : parsing.isPossible(),
|
|
348
|
-
countryCode: parsing == null ? void 0 : parsing.country,
|
|
349
|
-
countryCallingCode: parsing == null ? void 0 : parsing.countryCallingCode,
|
|
350
|
-
nationalNumber: parsing == null ? void 0 : parsing.nationalNumber,
|
|
351
|
-
type: parsing == null ? void 0 : parsing.getType(),
|
|
352
|
-
formatInternational: parsing == null ? void 0 : parsing.formatInternational(),
|
|
353
|
-
formatNational: parsing == null ? void 0 : parsing.formatNational(),
|
|
354
|
-
uri: parsing == null ? void 0 : parsing.getURI(),
|
|
355
|
-
e164: parsing == null ? void 0 : parsing.format("E.164"),
|
|
356
|
-
rfc3966: parsing == null ? void 0 : parsing.format("RFC3966")
|
|
357
|
-
};
|
|
358
|
-
} catch (error) {
|
|
359
|
-
throw new Error(`[MazPhoneNumberInput](getResultsFromPhoneNumber) ${error}`);
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
function getAsYouTypeFormat(countryCode, phoneNumber) {
|
|
363
|
-
try {
|
|
364
|
-
if (!phoneNumber) {
|
|
365
|
-
return;
|
|
366
|
-
}
|
|
367
|
-
return countryCode ? new AsYouType(countryCode).input(phoneNumber) : phoneNumber;
|
|
368
|
-
} catch (error) {
|
|
369
|
-
throw new Error(`[MazPhoneNumberInput](getAsYouTypeFormat) ${error}`);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
async function fetchCountryCode() {
|
|
373
|
-
try {
|
|
374
|
-
const reponse = await fetch("https://ipwho.is");
|
|
375
|
-
const { country_code } = await reponse.json();
|
|
376
|
-
return country_code;
|
|
377
|
-
} catch (error) {
|
|
378
|
-
throw new Error(`[MazPhoneNumberInput](fetchCountryCode) ${error}`);
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
function truthyFilter(value) {
|
|
382
|
-
return !!value;
|
|
383
|
-
}
|
|
384
|
-
const useInstanceUniqId = ({
|
|
385
|
-
componentName,
|
|
386
|
-
instance,
|
|
387
|
-
providedId
|
|
388
|
-
}) => {
|
|
389
|
-
return computed(() => providedId ?? `${componentName}-${instance == null ? void 0 : instance.uid}`);
|
|
390
|
-
};
|
|
391
|
-
const locales = {
|
|
392
|
-
countrySelector: {
|
|
393
|
-
placeholder: "Country code",
|
|
394
|
-
error: "Choose country",
|
|
395
|
-
searchPlaceholder: "Search the country"
|
|
396
|
-
},
|
|
397
|
-
phoneInput: {
|
|
398
|
-
placeholder: "Phone number",
|
|
399
|
-
example: "Example:"
|
|
400
|
-
}
|
|
401
|
-
};
|
|
402
|
-
function localeToUnicodeFlag(locale) {
|
|
403
|
-
const characters = [...locale];
|
|
404
|
-
return characters.map((letter) => letter.charCodeAt(0) % 32 + 127461).map((n) => String.fromCodePoint(n)).join("");
|
|
405
|
-
}
|
|
406
|
-
const _hoisted_1 = ["id"];
|
|
407
|
-
const _hoisted_2 = {
|
|
408
|
-
key: 0,
|
|
409
|
-
class: "maz-mr-2 maz-text-lg"
|
|
410
|
-
};
|
|
411
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
412
|
-
__name: "MazPhoneNumberInput",
|
|
413
|
-
props: {
|
|
414
|
-
modelValue: {
|
|
415
|
-
type: String,
|
|
416
|
-
validator: (prop) => {
|
|
417
|
-
return typeof prop === "string" || prop === void 0;
|
|
418
|
-
},
|
|
419
|
-
default: void 0
|
|
420
|
-
},
|
|
421
|
-
id: { type: String, default: void 0 },
|
|
422
|
-
placeholder: { type: String, default: void 0 },
|
|
423
|
-
defaultPhoneNumber: { type: String, default: void 0 },
|
|
424
|
-
defaultCountryCode: {
|
|
425
|
-
type: String,
|
|
426
|
-
default: void 0,
|
|
427
|
-
validator: (code) => isCountryAvailable(code)
|
|
428
|
-
},
|
|
429
|
-
preferredCountries: {
|
|
430
|
-
type: Array,
|
|
431
|
-
default: void 0
|
|
432
|
-
},
|
|
433
|
-
ignoredCountries: {
|
|
434
|
-
type: Array,
|
|
435
|
-
default: void 0
|
|
436
|
-
},
|
|
437
|
-
onlyCountries: {
|
|
438
|
-
type: Array,
|
|
439
|
-
default: void 0
|
|
440
|
-
},
|
|
441
|
-
translations: {
|
|
442
|
-
type: Object,
|
|
443
|
-
default: void 0
|
|
444
|
-
},
|
|
445
|
-
listPosition: {
|
|
446
|
-
type: String,
|
|
447
|
-
default: "bottom left",
|
|
448
|
-
validator: (value) => {
|
|
449
|
-
return ["top", "top right", "top left", "bottom", "bottom right", "bottom left"].includes(
|
|
450
|
-
value
|
|
451
|
-
);
|
|
452
|
-
}
|
|
453
|
-
},
|
|
454
|
-
color: {
|
|
455
|
-
type: String,
|
|
456
|
-
default: "primary"
|
|
457
|
-
},
|
|
458
|
-
size: {
|
|
459
|
-
type: String,
|
|
460
|
-
default: "md",
|
|
461
|
-
validator: (value) => {
|
|
462
|
-
return ["mini", "xs", "sm", "md", "lg", "xl"].includes(value);
|
|
463
|
-
}
|
|
464
|
-
},
|
|
465
|
-
noFlags: { type: Boolean, default: false },
|
|
466
|
-
disabled: { type: Boolean, default: false },
|
|
467
|
-
noExample: { type: Boolean, default: false },
|
|
468
|
-
noSearch: { type: Boolean, default: false },
|
|
469
|
-
noUseBrowserLocale: { type: Boolean, default: false },
|
|
470
|
-
fetchCountry: { type: Boolean, default: false },
|
|
471
|
-
noCountrySelector: { type: Boolean, default: false },
|
|
472
|
-
showCodeOnList: { type: Boolean, default: false },
|
|
473
|
-
error: { type: Boolean, default: false },
|
|
474
|
-
customCountriesList: {
|
|
475
|
-
type: Object,
|
|
476
|
-
default: void 0
|
|
477
|
-
}
|
|
478
|
-
},
|
|
479
|
-
emits: ["update", "update:model-value", "country-code"],
|
|
480
|
-
setup(__props, { emit: emits }) {
|
|
481
|
-
const props = __props;
|
|
482
|
-
const MazInput = defineAsyncComponent(() => import("./MazInput-3021f55e.mjs"));
|
|
483
|
-
const MazSelect = defineAsyncComponent(() => import("./MazSelect-d3d81ae8.mjs"));
|
|
484
|
-
const instance = getCurrentInstance();
|
|
485
|
-
const instanceId = useInstanceUniqId({
|
|
486
|
-
componentName: "MazPhoneNumberInput",
|
|
487
|
-
instance,
|
|
488
|
-
providedId: props.id
|
|
489
|
-
});
|
|
490
|
-
const results = ref({});
|
|
491
|
-
const countryCode = ref();
|
|
492
|
-
const formattedNumber = ref();
|
|
493
|
-
const cursorPosition = ref();
|
|
494
|
-
const examplesFileLoaded = ref(false);
|
|
495
|
-
const inputFocused = ref(false);
|
|
496
|
-
const lastKeyPressed = ref();
|
|
497
|
-
const CountrySelector = ref();
|
|
498
|
-
const PhoneNumberInput = ref();
|
|
499
|
-
onBeforeMount(async () => {
|
|
500
|
-
try {
|
|
501
|
-
formattedNumber.value = props.modelValue ?? props.defaultPhoneNumber;
|
|
502
|
-
if (props.defaultCountryCode) {
|
|
503
|
-
setCountryCode(props.defaultCountryCode);
|
|
504
|
-
}
|
|
505
|
-
if (props.fetchCountry) {
|
|
506
|
-
const locale = await fetchCountryCode();
|
|
507
|
-
if (locale)
|
|
508
|
-
setCountryCode(locale);
|
|
509
|
-
}
|
|
510
|
-
getAndEmitResults(formattedNumber.value);
|
|
511
|
-
} catch (error) {
|
|
512
|
-
throw new Error(`[MazPhoneNumberInput](onBeforeMount) ${error}`);
|
|
513
|
-
}
|
|
514
|
-
try {
|
|
515
|
-
if (!props.noExample && !examplesFileLoaded.value) {
|
|
516
|
-
await loadPhoneNumberExamplesFile();
|
|
517
|
-
examplesFileLoaded.value = true;
|
|
518
|
-
}
|
|
519
|
-
} catch {
|
|
520
|
-
throw new Error(
|
|
521
|
-
"[MazPhoneNumberInput](onBeforeMount) while loading phone number examples file"
|
|
522
|
-
);
|
|
523
|
-
}
|
|
524
|
-
});
|
|
525
|
-
onMounted(() => {
|
|
526
|
-
try {
|
|
527
|
-
if (!props.defaultCountryCode && !props.noUseBrowserLocale && !countryCode.value) {
|
|
528
|
-
const locale = browserLocale();
|
|
529
|
-
if (locale) {
|
|
530
|
-
setCountryCode(locale);
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
if (props.defaultCountryCode && props.fetchCountry) {
|
|
534
|
-
throw String(
|
|
535
|
-
"Do not use 'fetch-country' and 'default-country-code' options in the same time"
|
|
536
|
-
);
|
|
537
|
-
}
|
|
538
|
-
if (props.defaultCountryCode && props.noUseBrowserLocale) {
|
|
539
|
-
throw String(
|
|
540
|
-
"If you use a 'default-country-code', do not use 'no-use-browser-locale' options"
|
|
541
|
-
);
|
|
542
|
-
}
|
|
543
|
-
} catch (error) {
|
|
544
|
-
console.warn(`[MazPhoneNumberInput](mounted) ${error}`);
|
|
545
|
-
}
|
|
546
|
-
});
|
|
547
|
-
const countries = computed(() => getCountriesList(props.customCountriesList));
|
|
548
|
-
const t = computed(() => ({
|
|
549
|
-
...locales,
|
|
550
|
-
...props.translations
|
|
551
|
-
}));
|
|
552
|
-
const isValid = computed(() => {
|
|
553
|
-
var _a;
|
|
554
|
-
return (_a = results.value) == null ? void 0 : _a.isValid;
|
|
555
|
-
});
|
|
556
|
-
const countriesList = computed(() => {
|
|
557
|
-
var _a;
|
|
558
|
-
return (_a = countries.value) == null ? void 0 : _a.filter((item) => {
|
|
559
|
-
var _a2;
|
|
560
|
-
return !((_a2 = props.ignoredCountries) == null ? void 0 : _a2.includes(item.iso2));
|
|
561
|
-
});
|
|
562
|
-
});
|
|
563
|
-
const countriesFiltered = computed(() => {
|
|
564
|
-
const countries2 = props.onlyCountries || props.preferredCountries;
|
|
565
|
-
return countries2 == null ? void 0 : countries2.map(
|
|
566
|
-
(country) => {
|
|
567
|
-
var _a;
|
|
568
|
-
return (_a = countriesList.value) == null ? void 0 : _a.find((item) => item.iso2.includes(country));
|
|
569
|
-
}
|
|
570
|
-
);
|
|
571
|
-
});
|
|
572
|
-
const otherCountries = computed(() => {
|
|
573
|
-
var _a;
|
|
574
|
-
return (_a = countriesList.value) == null ? void 0 : _a.filter((item) => {
|
|
575
|
-
var _a2;
|
|
576
|
-
return !((_a2 = props.preferredCountries) == null ? void 0 : _a2.includes(item.iso2));
|
|
577
|
-
});
|
|
578
|
-
});
|
|
579
|
-
const countriesSorted = computed(() => {
|
|
580
|
-
return props.preferredCountries ? [...countriesFiltered.value ?? [], ...otherCountries.value ?? []] : props.onlyCountries ? countriesFiltered.value : countriesList.value;
|
|
581
|
-
});
|
|
582
|
-
const countryOptions = computed(() => {
|
|
583
|
-
var _a;
|
|
584
|
-
return (_a = countriesSorted.value) == null ? void 0 : _a.map((country) => {
|
|
585
|
-
return country ? {
|
|
586
|
-
...country,
|
|
587
|
-
dialCode: `+${country.dialCode}`
|
|
588
|
-
} : void 0;
|
|
589
|
-
}).filter(truthyFilter);
|
|
590
|
-
});
|
|
591
|
-
const inputPlaceholder = computed(() => {
|
|
592
|
-
if (props.placeholder) {
|
|
593
|
-
return props.placeholder;
|
|
594
|
-
}
|
|
595
|
-
const defaultPlaceholder = t.value.phoneInput.placeholder;
|
|
596
|
-
if (props.noExample || !examplesFileLoaded.value) {
|
|
597
|
-
return defaultPlaceholder;
|
|
598
|
-
} else {
|
|
599
|
-
const example = getPhoneNumberExample();
|
|
600
|
-
return isValid.value || !example ? defaultPlaceholder : `${t.value.phoneInput.example} ${example}`;
|
|
601
|
-
}
|
|
602
|
-
});
|
|
603
|
-
watch(
|
|
604
|
-
() => props.modelValue,
|
|
605
|
-
(phoneNumber, oldPhoneNumber) => {
|
|
606
|
-
if (phoneNumber !== oldPhoneNumber) {
|
|
607
|
-
emitsValueAndResults(phoneNumber);
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
);
|
|
611
|
-
watch(
|
|
612
|
-
() => props.defaultPhoneNumber,
|
|
613
|
-
(phoneNumber, oldPhoneNumber) => {
|
|
614
|
-
if (phoneNumber !== oldPhoneNumber) {
|
|
615
|
-
emitsValueAndResults(phoneNumber);
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
);
|
|
619
|
-
watch(
|
|
620
|
-
() => props.defaultCountryCode,
|
|
621
|
-
(countryCode2, oldCountryCode) => {
|
|
622
|
-
if (countryCode2 && countryCode2 !== oldCountryCode) {
|
|
623
|
-
setCountryCode(countryCode2);
|
|
624
|
-
emitsValueAndResults();
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
);
|
|
628
|
-
const onKeydown = (event) => {
|
|
629
|
-
lastKeyPressed.value = event.key;
|
|
630
|
-
const target = event.target;
|
|
631
|
-
cursorPosition.value = target == null ? void 0 : target.selectionStart;
|
|
632
|
-
};
|
|
633
|
-
const getPhoneNumberExample = () => {
|
|
634
|
-
try {
|
|
635
|
-
const phoneNumber = countryCode.value ? getExamplePhoneNumber(countryCode.value) : void 0;
|
|
636
|
-
return phoneNumber ? phoneNumber.formatNational() : void 0;
|
|
637
|
-
} catch (error) {
|
|
638
|
-
throw new Error(`[MazPhoneNumberInput](getPhoneNumberExample) ${error}`);
|
|
639
|
-
}
|
|
640
|
-
};
|
|
641
|
-
const autoUpdateCountryCodeFromPhoneNumber = () => {
|
|
642
|
-
if (results.value && results.value.countryCode && countryCode.value !== results.value.countryCode) {
|
|
643
|
-
setCountryCode(results.value.countryCode);
|
|
644
|
-
}
|
|
645
|
-
};
|
|
646
|
-
const sanitizeNumber = (phoneNumber) => {
|
|
647
|
-
phoneNumber = sanitizePhoneNumber(phoneNumber);
|
|
648
|
-
const backSpacePressed = lastKeyPressed.value === "Backspace";
|
|
649
|
-
const lastCharacOfPhoneNumber = phoneNumber ? phoneNumber.at(-1) : "";
|
|
650
|
-
const lastCharIsParanthese = lastCharacOfPhoneNumber === ")";
|
|
651
|
-
if (backSpacePressed && lastCharIsParanthese) {
|
|
652
|
-
phoneNumber = phoneNumber == null ? void 0 : phoneNumber.trim().slice(0, -2);
|
|
653
|
-
}
|
|
654
|
-
return phoneNumber;
|
|
655
|
-
};
|
|
656
|
-
const getAndEmitResults = (phoneNumber, noAutoUpdateCountryCode) => {
|
|
657
|
-
results.value = getResultsFromPhoneNumber(countryCode.value, phoneNumber);
|
|
658
|
-
if (!noAutoUpdateCountryCode) {
|
|
659
|
-
autoUpdateCountryCodeFromPhoneNumber();
|
|
660
|
-
}
|
|
661
|
-
emits("update", results.value);
|
|
662
|
-
};
|
|
663
|
-
const emitsValueAndResults = (phoneNumber = props.modelValue, noAutoUpdateCountryCode) => {
|
|
664
|
-
try {
|
|
665
|
-
getAndEmitResults(phoneNumber, noAutoUpdateCountryCode);
|
|
666
|
-
emitValue(phoneNumber);
|
|
667
|
-
} catch (error) {
|
|
668
|
-
throw new Error(`[MazPhoneNumberInput](emitsValueAndResults) ${error}`);
|
|
669
|
-
}
|
|
670
|
-
};
|
|
671
|
-
const emitValue = (phoneNumber) => {
|
|
672
|
-
var _a, _b;
|
|
673
|
-
formattedNumber.value = sanitizeNumber(phoneNumber);
|
|
674
|
-
const internalResults = getResultsFromPhoneNumber(countryCode.value, phoneNumber);
|
|
675
|
-
const hasDeletedCharac = formattedNumber.value && phoneNumber && ((_a = formattedNumber.value) == null ? void 0 : _a.length) > (phoneNumber == null ? void 0 : phoneNumber.length);
|
|
676
|
-
const cursorIsAtEnd = phoneNumber && cursorPosition.value ? cursorPosition.value + 1 >= phoneNumber.length : true;
|
|
677
|
-
const shouldUseAsYoutType = !hasDeletedCharac && cursorIsAtEnd || internalResults.isValid;
|
|
678
|
-
if (countryCode.value) {
|
|
679
|
-
const isFullNumber = (_b = formattedNumber.value) == null ? void 0 : _b.includes("+");
|
|
680
|
-
formattedNumber.value = internalResults.formatNational && isFullNumber ? internalResults.formatNational : shouldUseAsYoutType ? getAsYouTypeFormat(countryCode.value, formattedNumber.value) : formattedNumber.value;
|
|
681
|
-
}
|
|
682
|
-
const valueToEmit = internalResults.isValid ? internalResults.e164 : formattedNumber.value;
|
|
683
|
-
if (valueToEmit !== props.modelValue) {
|
|
684
|
-
emits("update:model-value", valueToEmit);
|
|
685
|
-
}
|
|
686
|
-
};
|
|
687
|
-
const onBlur = () => {
|
|
688
|
-
inputFocused.value = false;
|
|
689
|
-
if (countryCode.value) {
|
|
690
|
-
formattedNumber.value = getAsYouTypeFormat(countryCode.value, formattedNumber.value);
|
|
691
|
-
}
|
|
692
|
-
};
|
|
693
|
-
const setCountryCode = (selectedCountryCode, autoFocusInput = false) => {
|
|
694
|
-
try {
|
|
695
|
-
const countryAvailable = isCountryAvailable(selectedCountryCode);
|
|
696
|
-
if (countryAvailable) {
|
|
697
|
-
countryCode.value = selectedCountryCode;
|
|
698
|
-
emits("country-code", selectedCountryCode);
|
|
699
|
-
emitsValueAndResults(props.modelValue, true);
|
|
700
|
-
}
|
|
701
|
-
if (autoFocusInput) {
|
|
702
|
-
focusPhoneNumberInput();
|
|
703
|
-
if (formattedNumber.value && formattedNumber.value.includes("+")) {
|
|
704
|
-
formattedNumber.value = void 0;
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
} catch (error) {
|
|
708
|
-
throw new Error(`[MazPhoneNumberInput](setCountryCode) ${error}`);
|
|
709
|
-
}
|
|
710
|
-
};
|
|
711
|
-
const focusCountrySelector = () => {
|
|
712
|
-
var _a, _b;
|
|
713
|
-
try {
|
|
714
|
-
(_b = (_a = CountrySelector.value) == null ? void 0 : _a.$el.querySelector("input")) == null ? void 0 : _b.focus();
|
|
715
|
-
} catch (error) {
|
|
716
|
-
throw new Error(`[MazPhoneNumberInput](focusCountrySelector) ${error}`);
|
|
717
|
-
}
|
|
718
|
-
};
|
|
719
|
-
const focusPhoneNumberInput = () => {
|
|
720
|
-
var _a, _b;
|
|
721
|
-
try {
|
|
722
|
-
(_b = (_a = PhoneNumberInput.value) == null ? void 0 : _a.$el.querySelector("input")) == null ? void 0 : _b.focus();
|
|
723
|
-
} catch (error) {
|
|
724
|
-
throw new Error(`[MazPhoneNumberInput](focusPhoneNumberInput) ${error}`);
|
|
725
|
-
}
|
|
726
|
-
};
|
|
727
|
-
return (_ctx, _cache) => {
|
|
728
|
-
return openBlock(), createElementBlock("div", {
|
|
729
|
-
id: unref(instanceId),
|
|
730
|
-
class: normalizeClass(["m-phone-number-input", {
|
|
731
|
-
"--no-flags": __props.noFlags
|
|
732
|
-
}])
|
|
733
|
-
}, [
|
|
734
|
-
countryCode.value && !__props.noFlags && !__props.noCountrySelector ? (openBlock(), createElementBlock(
|
|
735
|
-
"button",
|
|
736
|
-
{
|
|
737
|
-
key: 0,
|
|
738
|
-
class: "m-phone-number-input__country-flag maz-text-xl",
|
|
739
|
-
tabindex: "-1",
|
|
740
|
-
type: "button",
|
|
741
|
-
onClick: focusCountrySelector
|
|
742
|
-
},
|
|
743
|
-
toDisplayString(unref(localeToUnicodeFlag)(countryCode.value)),
|
|
744
|
-
1
|
|
745
|
-
/* TEXT */
|
|
746
|
-
)) : createCommentVNode("v-if", true),
|
|
747
|
-
!__props.noCountrySelector && countryOptions.value ? (openBlock(), createBlock(unref(MazSelect), {
|
|
748
|
-
key: 1,
|
|
749
|
-
ref_key: "CountrySelector",
|
|
750
|
-
ref: CountrySelector,
|
|
751
|
-
class: "m-phone-number-input__select",
|
|
752
|
-
"model-value": countryCode.value,
|
|
753
|
-
"option-value-key": "iso2",
|
|
754
|
-
"option-label-key": "name",
|
|
755
|
-
"option-input-value-key": "dialCode",
|
|
756
|
-
"max-list-width": 250,
|
|
757
|
-
disabled: __props.disabled,
|
|
758
|
-
color: __props.color,
|
|
759
|
-
size: __props.size,
|
|
760
|
-
"list-position": __props.listPosition,
|
|
761
|
-
search: !__props.noSearch,
|
|
762
|
-
"search-placeholder": t.value.countrySelector.searchPlaceholder,
|
|
763
|
-
options: countryOptions.value,
|
|
764
|
-
error: __props.error || !!formattedNumber.value && !countryCode.value,
|
|
765
|
-
hint: !!formattedNumber.value && !countryCode.value ? t.value.countrySelector.error : void 0,
|
|
766
|
-
label: t.value.countrySelector.placeholder,
|
|
767
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => setCountryCode($event, true)),
|
|
768
|
-
onFocus: _cache[1] || (_cache[1] = ($event) => inputFocused.value = false)
|
|
769
|
-
}, {
|
|
770
|
-
default: withCtx(({ option, isSelected }) => [
|
|
771
|
-
createElementVNode(
|
|
772
|
-
"div",
|
|
773
|
-
{
|
|
774
|
-
class: normalizeClass(["m-phone-number-input__select__item maz-flex maz-items-center maz-truncate", {
|
|
775
|
-
"m-phone-number-input__select__item--selected": isSelected
|
|
776
|
-
}])
|
|
777
|
-
},
|
|
778
|
-
[
|
|
779
|
-
!__props.noFlags && typeof option.iso2 === "string" ? (openBlock(), createElementBlock(
|
|
780
|
-
"span",
|
|
781
|
-
_hoisted_2,
|
|
782
|
-
toDisplayString(unref(localeToUnicodeFlag)(option.iso2)),
|
|
783
|
-
1
|
|
784
|
-
/* TEXT */
|
|
785
|
-
)) : createCommentVNode("v-if", true),
|
|
786
|
-
__props.showCodeOnList ? (openBlock(), createElementBlock(
|
|
787
|
-
"span",
|
|
788
|
-
{
|
|
789
|
-
key: 1,
|
|
790
|
-
class: normalizeClass(["maz-w-10 maz-flex-none", { "maz-text-muted": !isSelected }])
|
|
791
|
-
},
|
|
792
|
-
toDisplayString(option.dialCode),
|
|
793
|
-
3
|
|
794
|
-
/* TEXT, CLASS */
|
|
795
|
-
)) : createCommentVNode("v-if", true),
|
|
796
|
-
createElementVNode(
|
|
797
|
-
"span",
|
|
798
|
-
{
|
|
799
|
-
class: normalizeClass(["maz-flex-1 maz-truncate", { "maz-font-semibold": isSelected }])
|
|
800
|
-
},
|
|
801
|
-
toDisplayString(option.name),
|
|
802
|
-
3
|
|
803
|
-
/* TEXT, CLASS */
|
|
804
|
-
)
|
|
805
|
-
],
|
|
806
|
-
2
|
|
807
|
-
/* CLASS */
|
|
808
|
-
)
|
|
809
|
-
]),
|
|
810
|
-
_: 1
|
|
811
|
-
/* STABLE */
|
|
812
|
-
}, 8, ["model-value", "disabled", "color", "size", "list-position", "search", "search-placeholder", "options", "error", "hint", "label"])) : createCommentVNode("v-if", true),
|
|
813
|
-
createVNode(unref(MazInput), mergeProps({
|
|
814
|
-
id: __props.id,
|
|
815
|
-
ref_key: "PhoneNumberInput",
|
|
816
|
-
ref: PhoneNumberInput,
|
|
817
|
-
"model-value": formattedNumber.value,
|
|
818
|
-
label: inputPlaceholder.value,
|
|
819
|
-
disabled: __props.disabled,
|
|
820
|
-
color: __props.color,
|
|
821
|
-
error: __props.error || !!formattedNumber.value && !results.value.isValid
|
|
822
|
-
}, _ctx.$attrs, {
|
|
823
|
-
size: __props.size,
|
|
824
|
-
"icon-name": "phone",
|
|
825
|
-
type: "tel",
|
|
826
|
-
clearable: "",
|
|
827
|
-
class: ["m-phone-number-input__input maz-flex-1", {
|
|
828
|
-
"--border-radius": !__props.noCountrySelector,
|
|
829
|
-
"--error": __props.error || !results.value.isValid,
|
|
830
|
-
"--focused": inputFocused.value
|
|
831
|
-
}],
|
|
832
|
-
onFocus: _cache[2] || (_cache[2] = ($event) => inputFocused.value = true),
|
|
833
|
-
onBlur,
|
|
834
|
-
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => emitsValueAndResults($event)),
|
|
835
|
-
onKeydown: _cache[4] || (_cache[4] = ($event) => onKeydown($event))
|
|
836
|
-
}), null, 16, ["id", "model-value", "label", "disabled", "color", "error", "size", "class"])
|
|
837
|
-
], 10, _hoisted_1);
|
|
838
|
-
};
|
|
839
|
-
}
|
|
840
|
-
});
|
|
841
|
-
const MazPhoneNumberInput_vue_vue_type_style_index_0_scoped_af9afcca_lang = "";
|
|
842
|
-
const _export_sfc = (sfc, props) => {
|
|
843
|
-
const target = sfc.__vccOpts || sfc;
|
|
844
|
-
for (const [key, val] of props) {
|
|
845
|
-
target[key] = val;
|
|
846
|
-
}
|
|
847
|
-
return target;
|
|
848
|
-
};
|
|
849
|
-
const MazPhoneNumberInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-af9afcca"]]);
|
|
850
|
-
export {
|
|
851
|
-
MazPhoneNumberInput as M,
|
|
852
|
-
_export_sfc as _,
|
|
853
|
-
useInstanceUniqId as u
|
|
854
|
-
};
|