maz-ui 3.22.4 → 3.23.1
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/MazAvatar.mjs +2 -2
- package/components/MazBackdrop.mjs +67 -107
- package/components/MazBadge.mjs +41 -50
- package/components/MazBottomSheet.mjs +2 -2
- package/components/MazBtn.mjs +2 -2
- package/components/MazCard.mjs +2 -2
- package/components/MazCarousel.mjs +2 -2
- package/components/MazChart.mjs +53 -63
- package/components/MazCheckbox.mjs +84 -128
- package/components/MazDialog.mjs +2 -2
- package/components/MazDialogPromise.mjs +3 -3
- package/components/MazDrawer.mjs +2 -2
- package/components/MazDropdown.mjs +2 -2
- package/components/MazDropzone.mjs +2 -2
- package/components/MazFullscreenLoader.mjs +14 -18
- package/components/MazGallery.mjs +352 -558
- package/components/MazIcon.mjs +76 -140
- package/components/MazInput.mjs +2 -2
- package/components/MazInputNumber.mjs +72 -99
- package/components/MazInputPrice.mjs +2 -2
- package/components/MazInputTags.mjs +2 -2
- package/components/MazLazyImg.mjs +2 -2
- package/components/MazPhoneNumberInput.mjs +2 -2
- package/components/MazPicker.mjs +2 -2
- package/components/MazRadio.mjs +65 -94
- package/components/MazRadioButtons.mjs +64 -78
- package/components/MazSelect.mjs +2 -2
- package/components/MazSlider.mjs +213 -325
- package/components/MazSpinner.mjs +25 -34
- package/components/MazStepper.mjs +2 -2
- package/components/MazSwitch.mjs +43 -60
- package/components/MazTabs.mjs +16 -25
- package/components/MazTabsBar.mjs +2 -2
- package/components/MazTabsContent.mjs +34 -43
- package/components/MazTabsContentItem.mjs +49 -63
- package/components/MazTextarea.mjs +124 -169
- package/components/MazTransitionExpand.mjs +36 -54
- package/components/assets/MazBackdrop.css +1 -1
- package/components/assets/MazBottomSheet.css +1 -1
- package/components/assets/MazDialog.css +1 -1
- package/components/assets/MazDialogPromise.css +1 -1
- package/components/assets/MazDrawer.css +1 -1
- package/components/assets/MazPhoneNumberInput.css +1 -1
- package/components/assets/MazSelect.css +1 -1
- package/components/chunks/MazAvatar-1636f58b.mjs +126 -0
- package/components/chunks/MazBottomSheet-c24f92f8.mjs +217 -0
- package/components/chunks/MazBtn-124f3700.mjs +153 -0
- package/components/chunks/MazBtn-1e61862b.mjs +153 -0
- package/components/chunks/MazBtn-2d1d1ba5.mjs +153 -0
- package/components/chunks/MazBtn-3d74f737.mjs +153 -0
- package/components/chunks/MazBtn-4a447126.mjs +153 -0
- package/components/chunks/MazBtn-555928ed.mjs +153 -0
- package/components/chunks/MazBtn-571454f6.mjs +153 -0
- package/components/chunks/MazBtn-5e426592.mjs +153 -0
- package/components/chunks/MazBtn-683effc1.mjs +153 -0
- package/components/chunks/MazBtn-6905cc39.mjs +153 -0
- package/components/chunks/MazBtn-6ce4cfd3.mjs +153 -0
- package/components/chunks/MazBtn-74656d5b.mjs +153 -0
- package/components/chunks/MazBtn-7706b2da.mjs +158 -0
- package/components/chunks/MazBtn-a7a913dd.mjs +153 -0
- package/components/chunks/MazBtn-fb3c7af8.mjs +153 -0
- package/components/chunks/MazCard-bcc36489.mjs +214 -0
- package/components/chunks/MazCarousel-6da75122.mjs +107 -0
- package/components/chunks/MazCheckbox-040dc2c4.mjs +117 -0
- package/components/chunks/MazCheckbox-3a2b48b4.mjs +117 -0
- package/components/chunks/MazDialog-44eda544.mjs +250 -0
- package/components/chunks/MazDialogPromise-eec5acde.mjs +419 -0
- package/components/chunks/MazDrawer-b628b37e.mjs +206 -0
- package/components/chunks/MazDropdown-6f2248b0.mjs +345 -0
- package/components/chunks/MazDropzone-8cac10a6.mjs +242 -0
- package/components/chunks/MazGallery-6b8ecedf.mjs +617 -0
- package/components/chunks/MazIcon-52a76873.mjs +101 -0
- package/components/chunks/MazIcon-95e31ff8.mjs +96 -0
- package/components/chunks/MazInput-1ed4f946.mjs +283 -0
- package/components/chunks/MazInput-8a217995.mjs +271 -0
- package/components/chunks/MazInput-c51881ea.mjs +278 -0
- package/components/chunks/MazInputPrice-cd348d46.mjs +392 -0
- package/components/chunks/MazInputTags-aa95fae7.mjs +446 -0
- package/components/chunks/MazLazyImg-0412ab38.mjs +259 -0
- package/components/chunks/MazLazyImg-47d3449a.mjs +254 -0
- package/components/chunks/MazPhoneNumberInput-e1bf46f9.mjs +1216 -0
- package/components/chunks/MazPicker-e4620d8b.mjs +1140 -0
- package/components/chunks/MazPickerCalendar-da62262c.mjs +535 -0
- package/components/chunks/MazPickerHeader-a2e041eb.mjs +186 -0
- package/components/chunks/MazPickerMonthSwitcher-5bf8bd08.mjs +97 -0
- package/components/chunks/MazPickerShortcuts-7f95430e.mjs +74 -0
- package/components/chunks/MazPickerTime-717402ae.mjs +219 -0
- package/components/chunks/MazPickerYearSwitcher-85f97b6d.mjs +106 -0
- package/components/chunks/MazSelect-6ff6bb96.mjs +652 -0
- package/components/chunks/MazSpinner-054f948c.mjs +39 -0
- package/components/chunks/MazSpinner-059ee1d2.mjs +39 -0
- package/components/chunks/MazSpinner-08ee440b.mjs +39 -0
- package/components/chunks/MazSpinner-13403729.mjs +39 -0
- package/components/chunks/MazSpinner-44011019.mjs +39 -0
- package/components/chunks/MazSpinner-452a1534.mjs +39 -0
- package/components/chunks/MazSpinner-4c02cfd2.mjs +39 -0
- package/components/chunks/MazSpinner-51aa73ca.mjs +39 -0
- package/components/chunks/MazSpinner-6d1d24d5.mjs +39 -0
- package/components/chunks/MazSpinner-6e7c4705.mjs +39 -0
- package/components/chunks/MazSpinner-7895f54f.mjs +39 -0
- package/components/chunks/MazSpinner-7eee202e.mjs +39 -0
- package/components/chunks/MazSpinner-805e14a6.mjs +39 -0
- package/components/chunks/MazSpinner-85080b43.mjs +39 -0
- package/components/chunks/MazSpinner-a13a50c9.mjs +39 -0
- package/components/chunks/MazSpinner-a6d61cee.mjs +43 -0
- package/components/chunks/MazSpinner-c67b05bb.mjs +39 -0
- package/components/chunks/MazSpinner-caa33afc.mjs +39 -0
- package/components/chunks/MazSpinner-cb8fbe9a.mjs +39 -0
- package/components/chunks/MazSpinner-d9ef329f.mjs +39 -0
- package/components/chunks/MazStepper-39f018f3.mjs +191 -0
- package/components/chunks/MazTabsBar-27965f16.mjs +132 -0
- package/components/chunks/MazTransitionExpand-55cfbecb.mjs +41 -0
- package/components/chunks/MazTransitionExpand-cd24498f.mjs +41 -0
- package/components/chunks/_plugin-vue_export-helper-dad06003.mjs +9 -0
- package/components/chunks/check-31d7ba2f.mjs +30 -0
- package/components/chunks/check-c9b483c0.mjs +30 -0
- package/components/chunks/{check-circle-7acfa4c4.mjs → check-circle-59c383ed.mjs} +10 -12
- package/components/chunks/chevron-down-2b60111a.mjs +30 -0
- package/components/chunks/chevron-left-39b4621e.mjs +30 -0
- package/components/chunks/chevron-right-949a60fa.mjs +30 -0
- package/components/chunks/debounce-19c516b6.mjs +11 -0
- package/components/chunks/examples.mobile.json-f63d22fb.mjs +4 -0
- package/components/chunks/{exclamation-circle-2e115536.mjs → exclamation-circle-e2620aab.mjs} +10 -12
- package/components/chunks/{exclamation-triangle-10eb48dc.mjs → exclamation-triangle-21bf116a.mjs} +10 -12
- package/components/chunks/{eye-fbb13657.mjs → eye-dc12ce09.mjs} +12 -15
- package/components/chunks/{eye-slash-342420ff.mjs → eye-slash-fa42a017.mjs} +10 -12
- package/components/chunks/{magnifying-glass-5dffa35e.mjs → magnifying-glass-908981c0.mjs} +10 -12
- package/components/chunks/minus-e71140e1.mjs +30 -0
- package/components/chunks/no-photography-4c6c77cf.mjs +4 -0
- package/components/chunks/{no-photography-b0d08d6f.mjs → no-photography-be94ddda.mjs} +12 -15
- package/components/chunks/{no-symbol-975ce547.mjs → no-symbol-87477ad0.mjs} +10 -12
- package/components/chunks/{pencil-2f766dc8.mjs → pencil-4c35b4e7.mjs} +10 -12
- package/components/chunks/plus-c20544c3.mjs +30 -0
- package/components/chunks/x-mark-35f2f1e7.mjs +30 -0
- package/components/chunks/x-mark-7761acf4.mjs +29 -0
- package/modules/chunks/MazBtn-2f302422.cjs +1 -0
- package/modules/chunks/MazBtn-760c3b29.mjs +153 -0
- package/modules/chunks/MazIcon-0bd6b78e.mjs +96 -0
- package/modules/chunks/MazIcon-599a907f.cjs +1 -0
- package/modules/chunks/MazSpinner-03bd76bd.mjs +39 -0
- package/modules/chunks/MazSpinner-6ffa8db1.cjs +1 -0
- package/modules/chunks/{arrow-top-right-on-square-32bbe5a1.mjs → arrow-top-right-on-square-15191934.mjs} +10 -12
- package/modules/chunks/arrow-top-right-on-square-8e4ea6e2.cjs +1 -0
- package/modules/chunks/chevron-left-36731110.cjs +1 -0
- package/modules/chunks/chevron-left-39b4621e.mjs +30 -0
- package/modules/chunks/index-6a90ef88.mjs +1618 -0
- package/modules/chunks/index-794680d2.cjs +124 -0
- package/modules/chunks/{link-4eb05848.mjs → link-bb14441d.mjs} +10 -12
- package/modules/chunks/link-c7791a2a.cjs +1 -0
- package/modules/chunks/no-photography-0f6fcaf4.cjs +1 -0
- package/modules/chunks/no-photography-4c6c77cf.mjs +4 -0
- package/modules/chunks/x-mark-35f2f1e7.mjs +30 -0
- package/modules/chunks/x-mark-a28deca5.cjs +1 -0
- package/modules/index.cjs +1 -0
- package/modules/index.mjs +42 -42
- package/nuxt/index.json +1 -1
- package/package.json +14 -4
- package/types/resolvers/index.d.ts +1 -0
- package/types/resolvers/unplugin-vue-components-resolver.d.ts +8 -0
- package/types/utils/index.d.ts +3 -0
- package/components/chunks/MazAvatar-358d78d4.mjs +0 -138
- package/components/chunks/MazBottomSheet-61090f4a.mjs +0 -267
- package/components/chunks/MazBtn-0e02f0da.mjs +0 -184
- package/components/chunks/MazBtn-1daf9063.mjs +0 -184
- package/components/chunks/MazBtn-2f4fa942.mjs +0 -184
- package/components/chunks/MazBtn-31c6b731.mjs +0 -184
- package/components/chunks/MazBtn-48382169.mjs +0 -184
- package/components/chunks/MazBtn-4e1e116e.mjs +0 -184
- package/components/chunks/MazBtn-50abc4c5.mjs +0 -184
- package/components/chunks/MazBtn-84e12b6a.mjs +0 -184
- package/components/chunks/MazBtn-b42e3575.mjs +0 -184
- package/components/chunks/MazBtn-b56a7278.mjs +0 -184
- package/components/chunks/MazBtn-bbd6e9c8.mjs +0 -184
- package/components/chunks/MazBtn-cf0c8fcb.mjs +0 -184
- package/components/chunks/MazBtn-d92908b2.mjs +0 -191
- package/components/chunks/MazBtn-f48da79c.mjs +0 -184
- package/components/chunks/MazBtn-fec4c3b7.mjs +0 -184
- package/components/chunks/MazCard-4331dca0.mjs +0 -237
- package/components/chunks/MazCarousel-7825c7c9.mjs +0 -133
- package/components/chunks/MazCheckbox-ab5ddda2.mjs +0 -153
- package/components/chunks/MazCheckbox-e0bbe6ec.mjs +0 -153
- package/components/chunks/MazDialog-83e54b8c.mjs +0 -290
- package/components/chunks/MazDialogPromise-6967e821.mjs +0 -474
- package/components/chunks/MazDrawer-d778b3d2.mjs +0 -256
- package/components/chunks/MazDropdown-6f4482d7.mjs +0 -426
- package/components/chunks/MazDropzone-d1bb62dc.mjs +0 -325
- package/components/chunks/MazGallery-b2dc4286.mjs +0 -821
- package/components/chunks/MazIcon-b779da0a.mjs +0 -159
- package/components/chunks/MazIcon-bda198b4.mjs +0 -165
- package/components/chunks/MazInput-713b00d0.mjs +0 -326
- package/components/chunks/MazInput-b9386887.mjs +0 -341
- package/components/chunks/MazInput-c33627dd.mjs +0 -334
- package/components/chunks/MazInputPrice-452297f5.mjs +0 -481
- package/components/chunks/MazInputTags-7a463b81.mjs +0 -526
- package/components/chunks/MazLazyImg-6e395356.mjs +0 -336
- package/components/chunks/MazLazyImg-e0d8b6d0.mjs +0 -329
- package/components/chunks/MazPhoneNumberInput-48fe2445.mjs +0 -1536
- package/components/chunks/MazPicker-50fc11d1.mjs +0 -1352
- package/components/chunks/MazPickerCalendar-cacb361c.mjs +0 -689
- package/components/chunks/MazPickerHeader-63d45179.mjs +0 -216
- package/components/chunks/MazPickerMonthSwitcher-913c6e2c.mjs +0 -110
- package/components/chunks/MazPickerShortcuts-c6fabfc6.mjs +0 -88
- package/components/chunks/MazPickerTime-5e4475da.mjs +0 -301
- package/components/chunks/MazPickerYearSwitcher-dd4fa89c.mjs +0 -125
- package/components/chunks/MazSelect-2e5cd411.mjs +0 -850
- package/components/chunks/MazSpinner-022d7bee.mjs +0 -46
- package/components/chunks/MazSpinner-100c99b8.mjs +0 -46
- package/components/chunks/MazSpinner-191ad23b.mjs +0 -46
- package/components/chunks/MazSpinner-3155378b.mjs +0 -46
- package/components/chunks/MazSpinner-339a9006.mjs +0 -46
- package/components/chunks/MazSpinner-53979e96.mjs +0 -46
- package/components/chunks/MazSpinner-68d2f2ac.mjs +0 -46
- package/components/chunks/MazSpinner-6b563b22.mjs +0 -46
- package/components/chunks/MazSpinner-7cdc13e7.mjs +0 -46
- package/components/chunks/MazSpinner-8859d658.mjs +0 -46
- package/components/chunks/MazSpinner-8e180605.mjs +0 -52
- package/components/chunks/MazSpinner-9950424b.mjs +0 -46
- package/components/chunks/MazSpinner-c8270a93.mjs +0 -46
- package/components/chunks/MazSpinner-cb491238.mjs +0 -46
- package/components/chunks/MazSpinner-cb6f99f3.mjs +0 -46
- package/components/chunks/MazSpinner-ce4be8f1.mjs +0 -46
- package/components/chunks/MazSpinner-e5a9f319.mjs +0 -46
- package/components/chunks/MazSpinner-e92bd359.mjs +0 -46
- package/components/chunks/MazSpinner-eea9056d.mjs +0 -46
- package/components/chunks/MazSpinner-f1e69f29.mjs +0 -46
- package/components/chunks/MazStepper-4c19dbfc.mjs +0 -255
- package/components/chunks/MazTabsBar-3c2e2d69.mjs +0 -157
- package/components/chunks/MazTransitionExpand-474b00d4.mjs +0 -57
- package/components/chunks/MazTransitionExpand-f9e5a2d6.mjs +0 -57
- package/components/chunks/_plugin-vue_export-helper-cc2b3d55.mjs +0 -10
- package/components/chunks/check-8da249b1.mjs +0 -32
- package/components/chunks/check-f2fcce10.mjs +0 -32
- package/components/chunks/chevron-down-a78b9604.mjs +0 -32
- package/components/chunks/chevron-left-3365d59b.mjs +0 -32
- package/components/chunks/chevron-right-02f9e837.mjs +0 -32
- package/components/chunks/debounce-7d66ffa9.mjs +0 -12
- package/components/chunks/examples.mobile.json-618ba782.mjs +0 -4
- package/components/chunks/minus-c9cdee90.mjs +0 -32
- package/components/chunks/no-photography-7f2be516.mjs +0 -4
- package/components/chunks/plus-b1b0a5a8.mjs +0 -32
- package/components/chunks/x-mark-3b05101b.mjs +0 -31
- package/components/chunks/x-mark-c6ff45dd.mjs +0 -32
- package/modules/chunks/MazBtn-90ffd148.mjs +0 -184
- package/modules/chunks/MazIcon-988edef7.mjs +0 -159
- package/modules/chunks/MazSpinner-a16a3d8f.mjs +0 -46
- package/modules/chunks/chevron-left-3365d59b.mjs +0 -32
- package/modules/chunks/index-b1625fc2.mjs +0 -2315
- package/modules/chunks/no-photography-7f2be516.mjs +0 -4
- package/modules/chunks/x-mark-c6ff45dd.mjs +0 -32
|
@@ -0,0 +1,1216 @@
|
|
|
1
|
+
import "../assets/MazPhoneNumberInput.css";
|
|
2
|
+
import { computed as c, defineComponent as xe, defineAsyncComponent as U, ref as m, getCurrentInstance as Ie, onMounted as Be, useSlots as Fe, openBlock as v, createElementBlock as C, normalizeClass as E, normalizeStyle as ee, createElementVNode as H, renderSlot as J, createVNode as L, unref as z, createCommentVNode as h, withDirectives as Ee, mergeProps as ke, toHandlers as Ne, vModelDynamic as Ke, createTextVNode as Ce, toDisplayString as _, createBlock as ue, withModifiers as re, withCtx as te, useCssVars as Me, onBeforeMount as Te, Transition as De, Fragment as Ue, renderList as Oe, nextTick as G, reactive as Re, watch as ve } from "vue";
|
|
3
|
+
import { isSupportedCountry as qe, getCountryCallingCode as Se, getExampleNumber as He, getCountries as je, parsePhoneNumberFromString as We, AsYouType as Ye } from "libphonenumber-js";
|
|
4
|
+
function Qe(e) {
|
|
5
|
+
return !!e;
|
|
6
|
+
}
|
|
7
|
+
const Pe = ({
|
|
8
|
+
componentName: e,
|
|
9
|
+
instance: u,
|
|
10
|
+
providedId: n
|
|
11
|
+
}) => c(() => n ?? `${e}-${u == null ? void 0 : u.uid}`), Ge = {
|
|
12
|
+
countrySelector: {
|
|
13
|
+
placeholder: "Country code",
|
|
14
|
+
error: "Choose country",
|
|
15
|
+
searchPlaceholder: "Search the country"
|
|
16
|
+
},
|
|
17
|
+
phoneInput: {
|
|
18
|
+
placeholder: "Phone number",
|
|
19
|
+
example: "Example:"
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
function Ae(e) {
|
|
23
|
+
return [...e].map((n) => n.charCodeAt(0) % 32 + 127461).map((n) => String.fromCodePoint(n)).join("");
|
|
24
|
+
}
|
|
25
|
+
let ge;
|
|
26
|
+
function Je(e, u, n) {
|
|
27
|
+
return n != null && n[u] ? n[u] : (ge || (ge = new Intl.DisplayNames([e], { type: "region" })), ge.of(u));
|
|
28
|
+
}
|
|
29
|
+
const Xe = /^[\d ().-]+$/, Ze = /^[^a-z]+$/i;
|
|
30
|
+
let Ve;
|
|
31
|
+
async function _e() {
|
|
32
|
+
const { default: e } = await import("./examples.mobile.json-f63d22fb.mjs");
|
|
33
|
+
return Ve = e, Ve;
|
|
34
|
+
}
|
|
35
|
+
function et(e, u) {
|
|
36
|
+
return Se(e) === Se(u);
|
|
37
|
+
}
|
|
38
|
+
function tt(e) {
|
|
39
|
+
var u;
|
|
40
|
+
try {
|
|
41
|
+
return e ? (u = He(e, Ve)) == null ? void 0 : u.formatNational() : void 0;
|
|
42
|
+
} catch (n) {
|
|
43
|
+
console.error(`[maz-ui](MazPhoneNumberInput) ${n}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function ot(e) {
|
|
47
|
+
if (!e)
|
|
48
|
+
return "";
|
|
49
|
+
const u = Ze.test(e), n = Xe.test(e);
|
|
50
|
+
return !u && !n ? e.replaceAll(/[^\d.]/g, "") : e;
|
|
51
|
+
}
|
|
52
|
+
function lt(e, u) {
|
|
53
|
+
const n = [], P = je();
|
|
54
|
+
e = e ?? Le().browserLocale ?? "en-US";
|
|
55
|
+
for (const x of P) {
|
|
56
|
+
const O = Je(e, x, u);
|
|
57
|
+
if (O)
|
|
58
|
+
try {
|
|
59
|
+
const N = Se(x);
|
|
60
|
+
n.push({
|
|
61
|
+
iso2: x,
|
|
62
|
+
dialCode: N,
|
|
63
|
+
name: O
|
|
64
|
+
});
|
|
65
|
+
} catch (N) {
|
|
66
|
+
console.error(`[MazPhoneNumberInput](getCountryCallingCode) ${N}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return n;
|
|
70
|
+
}
|
|
71
|
+
function Le() {
|
|
72
|
+
if (typeof window > "u")
|
|
73
|
+
return {};
|
|
74
|
+
const e = window.navigator.language;
|
|
75
|
+
if (!e)
|
|
76
|
+
return {};
|
|
77
|
+
let u = e.slice(3, 7).toUpperCase();
|
|
78
|
+
return u === "" && (u = e.slice(0, 2).toUpperCase()), u === "EN" && (u = "US"), u === "JA" && (u = "JP"), { locale: u, browserLocale: e };
|
|
79
|
+
}
|
|
80
|
+
function be(e) {
|
|
81
|
+
try {
|
|
82
|
+
const u = qe(e);
|
|
83
|
+
return u || (console.error(`[maz-ui](MazPhoneNumberInput) The code country "${e}" is not available`), !1);
|
|
84
|
+
} catch (u) {
|
|
85
|
+
return console.error(`[maz-ui](MazPhoneNumberInput) ${u}`), !1;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const at = ({
|
|
89
|
+
phoneNumber: e,
|
|
90
|
+
countryCode: u
|
|
91
|
+
}) => {
|
|
92
|
+
try {
|
|
93
|
+
if (!e)
|
|
94
|
+
return {
|
|
95
|
+
isValid: !1,
|
|
96
|
+
countryCode: u
|
|
97
|
+
};
|
|
98
|
+
const n = We(e, u);
|
|
99
|
+
return {
|
|
100
|
+
isValid: (n == null ? void 0 : n.isValid()) ?? !1,
|
|
101
|
+
isPossible: n == null ? void 0 : n.isPossible(),
|
|
102
|
+
countryCode: n == null ? void 0 : n.country,
|
|
103
|
+
countryCallingCode: n == null ? void 0 : n.countryCallingCode,
|
|
104
|
+
nationalNumber: n == null ? void 0 : n.nationalNumber,
|
|
105
|
+
type: n == null ? void 0 : n.getType(),
|
|
106
|
+
formatInternational: n == null ? void 0 : n.formatInternational(),
|
|
107
|
+
formatNational: n == null ? void 0 : n.formatNational(),
|
|
108
|
+
uri: n == null ? void 0 : n.getURI(),
|
|
109
|
+
e164: n == null ? void 0 : n.format("E.164"),
|
|
110
|
+
rfc3966: n == null ? void 0 : n.format("RFC3966")
|
|
111
|
+
};
|
|
112
|
+
} catch (n) {
|
|
113
|
+
throw new Error(`[MazPhoneNumberInput](getResultsFromPhoneNumber) ${n}`);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
function nt(e, u) {
|
|
117
|
+
try {
|
|
118
|
+
return u ? new Ye(e).input(u) : void 0;
|
|
119
|
+
} catch (n) {
|
|
120
|
+
throw new Error(`[MazPhoneNumberInput](getAsYouTypeFormat) ${n}`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
async function rt() {
|
|
124
|
+
try {
|
|
125
|
+
const e = await fetch("https://ipwho.is"), { country_code: u } = await e.json();
|
|
126
|
+
return u;
|
|
127
|
+
} catch (e) {
|
|
128
|
+
throw new Error(`[MazPhoneNumberInput](fetchCountryCode) ${e}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function ut() {
|
|
132
|
+
return {
|
|
133
|
+
fetchCountryCode: rt,
|
|
134
|
+
getAsYouTypeFormat: nt,
|
|
135
|
+
getResultsFromPhoneNumber: at,
|
|
136
|
+
loadPhoneNumberExamplesFile: _e,
|
|
137
|
+
getPhoneNumberExample: tt,
|
|
138
|
+
sanitizePhoneNumber: ot,
|
|
139
|
+
getCountriesList: lt,
|
|
140
|
+
browserLocale: Le,
|
|
141
|
+
isSameCountryCallingCode: et
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
function it(e, u) {
|
|
145
|
+
let n;
|
|
146
|
+
return function(...P) {
|
|
147
|
+
clearTimeout(n), n = setTimeout(() => {
|
|
148
|
+
e.apply(this, P);
|
|
149
|
+
}, u);
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
const st = {
|
|
153
|
+
key: 0,
|
|
154
|
+
class: "m-input-wrapper-left"
|
|
155
|
+
}, ct = { class: "m-input-wrapper-input" }, dt = ["id", "type", "name", "placeholder", "aria-label", "disabled", "readonly", "required"], ft = { key: 0 }, mt = {
|
|
156
|
+
key: 1,
|
|
157
|
+
class: "m-input-wrapper-right"
|
|
158
|
+
}, yt = /* @__PURE__ */ xe({
|
|
159
|
+
inheritAttrs: !1,
|
|
160
|
+
__name: "MazInput",
|
|
161
|
+
props: {
|
|
162
|
+
style: { type: [String, Array, Object], default: void 0 },
|
|
163
|
+
class: { type: String, default: void 0 },
|
|
164
|
+
modelValue: {
|
|
165
|
+
type: [String, Number, Boolean],
|
|
166
|
+
default: void 0
|
|
167
|
+
},
|
|
168
|
+
placeholder: { type: String, default: void 0 },
|
|
169
|
+
color: {
|
|
170
|
+
type: String,
|
|
171
|
+
default: "primary"
|
|
172
|
+
},
|
|
173
|
+
label: { type: String, default: void 0 },
|
|
174
|
+
name: { type: String, default: "input" },
|
|
175
|
+
type: {
|
|
176
|
+
type: String,
|
|
177
|
+
default: "text",
|
|
178
|
+
validator: (e) => [
|
|
179
|
+
"text",
|
|
180
|
+
"date",
|
|
181
|
+
"number",
|
|
182
|
+
"tel",
|
|
183
|
+
"search",
|
|
184
|
+
"url",
|
|
185
|
+
"password",
|
|
186
|
+
"month",
|
|
187
|
+
"time",
|
|
188
|
+
"week",
|
|
189
|
+
"email"
|
|
190
|
+
].includes(e)
|
|
191
|
+
},
|
|
192
|
+
required: { type: Boolean, default: !1 },
|
|
193
|
+
disabled: { type: Boolean, default: !1 },
|
|
194
|
+
readonly: { type: Boolean, default: !1 },
|
|
195
|
+
id: { type: String, default: void 0 },
|
|
196
|
+
error: { type: Boolean, default: !1 },
|
|
197
|
+
success: { type: Boolean, default: !1 },
|
|
198
|
+
warning: { type: Boolean, default: !1 },
|
|
199
|
+
hint: { type: String, default: void 0 },
|
|
200
|
+
inputClasses: { type: String, default: void 0 },
|
|
201
|
+
noBorder: { type: Boolean, default: !1 },
|
|
202
|
+
noRadius: { type: Boolean, default: !1 },
|
|
203
|
+
size: {
|
|
204
|
+
type: String,
|
|
205
|
+
default: "md",
|
|
206
|
+
validator: (e) => ["mini", "xs", "sm", "md", "lg", "xl"].includes(e)
|
|
207
|
+
},
|
|
208
|
+
debounce: { type: Boolean, default: !1 },
|
|
209
|
+
debounceDelay: { type: Number, default: 500 },
|
|
210
|
+
validButton: { type: Boolean, default: !1 },
|
|
211
|
+
validButtonLoading: { type: Boolean, default: !1 },
|
|
212
|
+
autoFocus: { type: Boolean, default: !1 },
|
|
213
|
+
borderActive: { type: Boolean, default: !1 },
|
|
214
|
+
leftIcon: { type: String, default: void 0 },
|
|
215
|
+
rightIcon: { type: String, default: void 0 }
|
|
216
|
+
},
|
|
217
|
+
emits: ["focus", "blur", "update:model-value", "click", "change", "update"],
|
|
218
|
+
setup(e, { emit: u }) {
|
|
219
|
+
const n = U(() => import("./MazBtn-2d1d1ba5.mjs")), P = U(() => import("./MazIcon-52a76873.mjs")), x = U(() => import("./eye-slash-fa42a017.mjs")), O = U(() => import("./eye-dc12ce09.mjs")), N = U(() => import("./check-31d7ba2f.mjs")), o = e, S = u, I = m(!1), f = m(!1), s = m(), oe = Ie(), le = Pe({
|
|
220
|
+
componentName: "MazInput",
|
|
221
|
+
instance: oe,
|
|
222
|
+
providedId: o.id
|
|
223
|
+
});
|
|
224
|
+
Be(() => {
|
|
225
|
+
var i;
|
|
226
|
+
o.autoFocus && ((i = s.value) == null || i.focus());
|
|
227
|
+
});
|
|
228
|
+
const X = c(() => o.class), $ = c(() => o.type === "password"), V = c(() => I.value ? "text" : o.type), F = c(() => {
|
|
229
|
+
if (!o.noBorder) {
|
|
230
|
+
if (o.error)
|
|
231
|
+
return "maz-border-danger";
|
|
232
|
+
if (o.success)
|
|
233
|
+
return "maz-border-success";
|
|
234
|
+
if (o.warning)
|
|
235
|
+
return "maz-border-warning";
|
|
236
|
+
if (f.value || o.borderActive) {
|
|
237
|
+
if (o.color === "black")
|
|
238
|
+
return "maz-border-black";
|
|
239
|
+
if (o.color === "danger")
|
|
240
|
+
return "maz-border-danger";
|
|
241
|
+
if (o.color === "info")
|
|
242
|
+
return "maz-border-info";
|
|
243
|
+
if (o.color === "primary")
|
|
244
|
+
return "maz-border-primary";
|
|
245
|
+
if (o.color === "secondary")
|
|
246
|
+
return "maz-border-secondary";
|
|
247
|
+
if (o.color === "success")
|
|
248
|
+
return "maz-border-success";
|
|
249
|
+
if (o.color === "warning")
|
|
250
|
+
return "maz-border-warning";
|
|
251
|
+
if (o.color === "white")
|
|
252
|
+
return "maz-border-white";
|
|
253
|
+
}
|
|
254
|
+
return "--default-border";
|
|
255
|
+
}
|
|
256
|
+
}), B = Fe(), Z = c(() => {
|
|
257
|
+
const { required: i, placeholder: g } = o;
|
|
258
|
+
if (g)
|
|
259
|
+
return i ? `${g} *` : g;
|
|
260
|
+
}), R = c(() => o.modelValue !== void 0 && o.modelValue !== ""), q = c({
|
|
261
|
+
get: () => o.modelValue,
|
|
262
|
+
set: (i) => A(i)
|
|
263
|
+
}), K = c(() => (!!o.label || !!o.hint) && (f.value || !!R.value || !!o.placeholder || ["date", "month", "week"].includes(o.type))), j = c(() => !!o.label || !!o.hint), ae = () => !!B["right-icon"] || $.value || !!B["valid-button"] || o.validButton || !!o.rightIcon, M = () => !!B["left-icon"] || !!o.leftIcon, T = (i) => {
|
|
264
|
+
S("focus", i), f.value = !0;
|
|
265
|
+
}, w = (i) => {
|
|
266
|
+
S("blur", i), f.value = !1;
|
|
267
|
+
}, W = (i) => S("change", i), y = it((i) => {
|
|
268
|
+
S("update:model-value", i);
|
|
269
|
+
}, o.debounceDelay), A = (i) => {
|
|
270
|
+
if (o.debounce)
|
|
271
|
+
return y(i);
|
|
272
|
+
S("update:model-value", i);
|
|
273
|
+
};
|
|
274
|
+
return (i, g) => (v(), C(
|
|
275
|
+
"div",
|
|
276
|
+
{
|
|
277
|
+
class: E(["m-input", [
|
|
278
|
+
{
|
|
279
|
+
"--is-focused": f.value || e.borderActive,
|
|
280
|
+
"--should-up": K.value,
|
|
281
|
+
"--has-label": j.value,
|
|
282
|
+
"--is-disabled": e.disabled,
|
|
283
|
+
"--is-readonly": e.readonly,
|
|
284
|
+
"--has-z-2": e.error || e.warning || e.success,
|
|
285
|
+
"--has-state": e.error || e.warning || e.success
|
|
286
|
+
},
|
|
287
|
+
X.value,
|
|
288
|
+
`--${e.color}`,
|
|
289
|
+
`--${e.size}`
|
|
290
|
+
]]),
|
|
291
|
+
style: ee(e.style)
|
|
292
|
+
},
|
|
293
|
+
[
|
|
294
|
+
H(
|
|
295
|
+
"div",
|
|
296
|
+
{
|
|
297
|
+
class: E(["m-input-wrapper", [e.inputClasses, F.value, { "maz-rounded": !e.noRadius }]])
|
|
298
|
+
},
|
|
299
|
+
[
|
|
300
|
+
M() ? (v(), C("div", st, [
|
|
301
|
+
i.$slots["left-icon"] || e.leftIcon ? J(i.$slots, "left-icon", { key: 0 }, () => [
|
|
302
|
+
L(z(P), {
|
|
303
|
+
name: e.leftIcon,
|
|
304
|
+
class: "maz-text-xl maz-text-muted"
|
|
305
|
+
}, null, 8, ["name"])
|
|
306
|
+
], !0) : h("v-if", !0)
|
|
307
|
+
])) : h("v-if", !0),
|
|
308
|
+
H("div", ct, [
|
|
309
|
+
Ee(H("input", ke({
|
|
310
|
+
id: z(le),
|
|
311
|
+
ref_key: "input",
|
|
312
|
+
ref: s,
|
|
313
|
+
"onUpdate:modelValue": g[0] || (g[0] = (p) => q.value = p),
|
|
314
|
+
type: V.value,
|
|
315
|
+
name: e.name
|
|
316
|
+
}, i.$attrs, {
|
|
317
|
+
placeholder: Z.value,
|
|
318
|
+
"aria-label": e.label || e.placeholder,
|
|
319
|
+
disabled: e.disabled,
|
|
320
|
+
readonly: e.readonly,
|
|
321
|
+
required: e.required,
|
|
322
|
+
class: "m-input-input"
|
|
323
|
+
}, Ne({
|
|
324
|
+
blur: w,
|
|
325
|
+
focus: T,
|
|
326
|
+
change: W
|
|
327
|
+
}, !0), {
|
|
328
|
+
onClick: g[1] || (g[1] = (p) => i.$emit("click", p))
|
|
329
|
+
}), null, 16, dt), [
|
|
330
|
+
[Ke, q.value]
|
|
331
|
+
]),
|
|
332
|
+
e.label || e.hint ? (v(), C(
|
|
333
|
+
"span",
|
|
334
|
+
{
|
|
335
|
+
key: 0,
|
|
336
|
+
ref: "label",
|
|
337
|
+
class: E(["m-input-label", [
|
|
338
|
+
{
|
|
339
|
+
"maz-text-danger-600": e.error,
|
|
340
|
+
"maz-text-success-600": e.success,
|
|
341
|
+
"maz-text-warning-600": e.warning
|
|
342
|
+
}
|
|
343
|
+
]])
|
|
344
|
+
},
|
|
345
|
+
[
|
|
346
|
+
Ce(
|
|
347
|
+
_(e.hint || e.label) + " ",
|
|
348
|
+
1
|
|
349
|
+
/* TEXT */
|
|
350
|
+
),
|
|
351
|
+
e.required ? (v(), C("sup", ft, "*")) : h("v-if", !0)
|
|
352
|
+
],
|
|
353
|
+
2
|
|
354
|
+
/* CLASS */
|
|
355
|
+
)) : h("v-if", !0)
|
|
356
|
+
]),
|
|
357
|
+
ae() ? (v(), C("div", mt, [
|
|
358
|
+
i.$slots["right-icon"] || e.rightIcon ? J(i.$slots, "right-icon", { key: 0 }, () => [
|
|
359
|
+
L(z(P), {
|
|
360
|
+
name: e.rightIcon,
|
|
361
|
+
class: "maz-text-xl maz-text-muted"
|
|
362
|
+
}, null, 8, ["name"])
|
|
363
|
+
], !0) : h("v-if", !0),
|
|
364
|
+
$.value ? (v(), ue(z(n), {
|
|
365
|
+
key: 1,
|
|
366
|
+
color: "transparent",
|
|
367
|
+
tabindex: "-1",
|
|
368
|
+
size: "mini",
|
|
369
|
+
onClick: g[2] || (g[2] = re((p) => I.value = !I.value, ["stop"]))
|
|
370
|
+
}, {
|
|
371
|
+
default: te(() => [
|
|
372
|
+
I.value ? (v(), ue(z(x), {
|
|
373
|
+
key: 0,
|
|
374
|
+
class: "maz-text-xl maz-text-muted"
|
|
375
|
+
})) : (v(), ue(z(O), {
|
|
376
|
+
key: 1,
|
|
377
|
+
class: "maz-text-xl maz-text-muted"
|
|
378
|
+
}))
|
|
379
|
+
]),
|
|
380
|
+
_: 1
|
|
381
|
+
/* STABLE */
|
|
382
|
+
})) : h("v-if", !0),
|
|
383
|
+
i.$slots["valid-button"] || e.validButton ? J(i.$slots, "valid-button", { key: 2 }, () => [
|
|
384
|
+
L(z(n), {
|
|
385
|
+
color: "transparent",
|
|
386
|
+
disabled: e.disabled,
|
|
387
|
+
tabindex: "-1",
|
|
388
|
+
loading: e.validButtonLoading,
|
|
389
|
+
class: "m-input-valid-button",
|
|
390
|
+
size: "mini",
|
|
391
|
+
type: "submit"
|
|
392
|
+
}, {
|
|
393
|
+
default: te(() => [
|
|
394
|
+
L(z(N), { class: "maz-text-2xl maz-text-normal" })
|
|
395
|
+
]),
|
|
396
|
+
_: 1
|
|
397
|
+
/* STABLE */
|
|
398
|
+
}, 8, ["disabled", "loading"])
|
|
399
|
+
], !0) : h("v-if", !0)
|
|
400
|
+
])) : h("v-if", !0)
|
|
401
|
+
],
|
|
402
|
+
2
|
|
403
|
+
/* CLASS */
|
|
404
|
+
)
|
|
405
|
+
],
|
|
406
|
+
6
|
|
407
|
+
/* CLASS, STYLE */
|
|
408
|
+
));
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
const $e = (e, u) => {
|
|
412
|
+
const n = e.__vccOpts || e;
|
|
413
|
+
for (const [P, x] of u)
|
|
414
|
+
n[P] = x;
|
|
415
|
+
return n;
|
|
416
|
+
}, we = /* @__PURE__ */ $e(yt, [["__scopeId", "data-v-32fa5093"]]);
|
|
417
|
+
m("system");
|
|
418
|
+
m("system");
|
|
419
|
+
m();
|
|
420
|
+
m([]);
|
|
421
|
+
let ze = null;
|
|
422
|
+
function vt(e, u) {
|
|
423
|
+
ze && clearTimeout(ze), ze = setTimeout(e, u);
|
|
424
|
+
}
|
|
425
|
+
const pt = ["onClick"], ht = {
|
|
426
|
+
key: 0,
|
|
427
|
+
tabindex: "-1",
|
|
428
|
+
class: "m-select-list__search-wrapper"
|
|
429
|
+
}, gt = { class: "m-select-list__no-results" }, bt = {
|
|
430
|
+
key: 2,
|
|
431
|
+
class: "m-select-list__scroll-wrapper",
|
|
432
|
+
tabindex: "-1"
|
|
433
|
+
}, zt = ["onClick"], Ct = /* @__PURE__ */ xe({
|
|
434
|
+
inheritAttrs: !1,
|
|
435
|
+
__name: "MazSelect",
|
|
436
|
+
props: {
|
|
437
|
+
style: { type: [String, Array, Object], default: void 0 },
|
|
438
|
+
class: { type: String, default: void 0 },
|
|
439
|
+
modelValue: {
|
|
440
|
+
type: [Number, String, Boolean, Array],
|
|
441
|
+
default: void 0
|
|
442
|
+
},
|
|
443
|
+
id: { type: String, default: void 0 },
|
|
444
|
+
options: { type: Array, default: void 0 },
|
|
445
|
+
optionValueKey: { type: String, default: "value" },
|
|
446
|
+
optionLabelKey: { type: String, default: "label" },
|
|
447
|
+
optionInputValueKey: { type: String, default: "label" },
|
|
448
|
+
listPosition: {
|
|
449
|
+
type: String,
|
|
450
|
+
default: "bottom left",
|
|
451
|
+
validator: (e) => ["top", "top right", "top left", "bottom", "bottom right", "bottom left"].includes(
|
|
452
|
+
e
|
|
453
|
+
)
|
|
454
|
+
},
|
|
455
|
+
required: { type: Boolean, default: !1 },
|
|
456
|
+
disabled: { type: Boolean, default: !1 },
|
|
457
|
+
open: { type: Boolean, default: !1 },
|
|
458
|
+
/** Choose color of the input */
|
|
459
|
+
color: {
|
|
460
|
+
type: String,
|
|
461
|
+
default: "primary"
|
|
462
|
+
},
|
|
463
|
+
/** Choose the option list item height */
|
|
464
|
+
itemHeight: { type: Number, default: 40 },
|
|
465
|
+
maxListHeight: { type: Number, default: 240 },
|
|
466
|
+
/** Add max-width value to option list */
|
|
467
|
+
maxListWidth: { type: Number, default: void 0 },
|
|
468
|
+
/** Choose size of the input */
|
|
469
|
+
size: {
|
|
470
|
+
type: String,
|
|
471
|
+
default: "md",
|
|
472
|
+
validator: (e) => ["mini", "xs", "sm", "md", "lg", "xl"].includes(e)
|
|
473
|
+
},
|
|
474
|
+
/** Display search input in option list */
|
|
475
|
+
search: { type: Boolean, default: !1 },
|
|
476
|
+
/** Search input placeholder */
|
|
477
|
+
searchPlaceholder: { type: String, default: "Search in options" },
|
|
478
|
+
/** Enable feature to select multiple values */
|
|
479
|
+
multiple: { type: Boolean, default: !1 }
|
|
480
|
+
},
|
|
481
|
+
emits: [
|
|
482
|
+
"close",
|
|
483
|
+
"open",
|
|
484
|
+
"blur",
|
|
485
|
+
"focus",
|
|
486
|
+
"change",
|
|
487
|
+
"update:model-value",
|
|
488
|
+
/** On selected value, returns the option object */
|
|
489
|
+
"selected-option"
|
|
490
|
+
],
|
|
491
|
+
setup(e, { emit: u }) {
|
|
492
|
+
Me((a) => ({
|
|
493
|
+
"1e2ca234": X.value,
|
|
494
|
+
a001241a: oe.value,
|
|
495
|
+
"75c5211b": le.value
|
|
496
|
+
}));
|
|
497
|
+
const n = U(() => import("./MazCheckbox-040dc2c4.mjs")), P = U(() => import("./magnifying-glass-908981c0.mjs")), x = U(() => import("./chevron-down-2b60111a.mjs")), O = U(() => import("./no-symbol-87477ad0.mjs")), N = Ie(), o = e, S = u, I = m(!1), f = m(), s = c(
|
|
498
|
+
() => ["black", "transparent", "white"].includes(o.color)
|
|
499
|
+
), oe = c(
|
|
500
|
+
() => s.value ? "var(--maz-color-black)" : `var(--maz-color-${o.color}-800)`
|
|
501
|
+
), le = c(
|
|
502
|
+
() => s.value ? "var(--maz-color-muted)" : `var(--maz-color-${o.color}-100)`
|
|
503
|
+
), X = c(
|
|
504
|
+
() => s.value ? "var(--maz-color-muted)" : `var(--maz-color-${o.color}-200)`
|
|
505
|
+
), $ = c(() => I.value || o.open), V = Pe({
|
|
506
|
+
componentName: "MazSelect",
|
|
507
|
+
instance: N,
|
|
508
|
+
providedId: o.id
|
|
509
|
+
}), F = c(
|
|
510
|
+
() => {
|
|
511
|
+
var a;
|
|
512
|
+
return ((a = o.options) == null ? void 0 : a.filter((t) => o.multiple ? Array.isArray(o.modelValue) ? o.modelValue.includes(t[o.optionValueKey]) && !K(t[o.optionValueKey]) : !1 : o.modelValue === t[o.optionValueKey] && !K(t[o.optionValueKey]))) ?? [];
|
|
513
|
+
}
|
|
514
|
+
);
|
|
515
|
+
Te(() => {
|
|
516
|
+
var a;
|
|
517
|
+
(a = o.options) != null && a.length || console.warn("[maz-ui](MazSelect) you must provide options"), Q();
|
|
518
|
+
});
|
|
519
|
+
const B = m(), Z = m(), R = m(), q = m(), K = (a) => a == null;
|
|
520
|
+
function j(a) {
|
|
521
|
+
var l;
|
|
522
|
+
return (((l = F.value) == null ? void 0 : l.some(
|
|
523
|
+
(r) => r[o.optionValueKey] === a[o.optionValueKey]
|
|
524
|
+
)) ?? !1) && !K(a[o.optionValueKey]);
|
|
525
|
+
}
|
|
526
|
+
const ae = c(() => {
|
|
527
|
+
var a, t;
|
|
528
|
+
return o.multiple && o.modelValue && Array.isArray(o.modelValue) ? o.modelValue.map(
|
|
529
|
+
(l) => {
|
|
530
|
+
var r, d;
|
|
531
|
+
return (d = (r = o.options) == null ? void 0 : r.find((b) => b[o.optionValueKey] === l)) == null ? void 0 : d[o.optionInputValueKey];
|
|
532
|
+
}
|
|
533
|
+
).join(", ") : (t = (a = o.options) == null ? void 0 : a.find((l) => l[o.optionValueKey] === o.modelValue)) == null ? void 0 : t[o.optionInputValueKey];
|
|
534
|
+
}), M = c(
|
|
535
|
+
() => o.listPosition.includes("bottom") ? "maz-slide" : "maz-slideinvert"
|
|
536
|
+
), T = m(""), w = m("");
|
|
537
|
+
function W(a) {
|
|
538
|
+
return a.normalize("NFD").replaceAll(/[\u0300-\u036F]/g, "").replaceAll(/[^\dA-Za-z\u0400-\u04FF]/g, "");
|
|
539
|
+
}
|
|
540
|
+
const y = (a, t) => t && a && W(a.toString().toLocaleLowerCase().trim()).includes(
|
|
541
|
+
W(t.toLocaleLowerCase().trim())
|
|
542
|
+
);
|
|
543
|
+
function A(a) {
|
|
544
|
+
var t;
|
|
545
|
+
return a ? (t = o.options) == null ? void 0 : t.filter((l) => {
|
|
546
|
+
const r = l[o.optionLabelKey], d = l[o.optionValueKey], b = l[o.optionInputValueKey];
|
|
547
|
+
return y(r, a) || y(d, a) || y(b, a);
|
|
548
|
+
}) : o.options;
|
|
549
|
+
}
|
|
550
|
+
const i = c(() => A(T.value)), g = async (a) => {
|
|
551
|
+
var t;
|
|
552
|
+
if (a && ("relatedTarget" in a && ((t = B.value) != null && t.contains(a.relatedTarget)) || a.type === "keydown"))
|
|
553
|
+
return a.preventDefault();
|
|
554
|
+
await G(), I.value = !1, f.value = 0, S("close", a);
|
|
555
|
+
}, p = async (a) => {
|
|
556
|
+
o.disabled || $.value || (a == null || a.preventDefault(), I.value = !0, await ne(), S("focus", a), S("open", I.value));
|
|
557
|
+
};
|
|
558
|
+
function ie() {
|
|
559
|
+
var a, t;
|
|
560
|
+
(t = ((a = Z.value) == null ? void 0 : a.$el).querySelector("input")) == null || t.focus();
|
|
561
|
+
}
|
|
562
|
+
function pe(a) {
|
|
563
|
+
I.value ? g(a) : ie();
|
|
564
|
+
}
|
|
565
|
+
function he(a) {
|
|
566
|
+
var t, l;
|
|
567
|
+
T.value = a, (l = ((t = R.value) == null ? void 0 : t.$el).querySelector("input")) == null || l.focus();
|
|
568
|
+
}
|
|
569
|
+
function se(a) {
|
|
570
|
+
var l;
|
|
571
|
+
a === "Backspace" && w.value.length > 0 ? w.value = w.value.slice(0, -1) : w.value += a;
|
|
572
|
+
const t = A(w.value);
|
|
573
|
+
t != null && t.length && (f.value = (l = i.value) == null ? void 0 : l.findIndex(
|
|
574
|
+
(r) => r[o.optionValueKey] === t[0][o.optionValueKey]
|
|
575
|
+
), typeof f.value == "number" && f.value >= 0 && ne(f.value)), vt(() => {
|
|
576
|
+
w.value = "";
|
|
577
|
+
}, 1e3);
|
|
578
|
+
}
|
|
579
|
+
const ce = (a) => {
|
|
580
|
+
const t = a.key;
|
|
581
|
+
/^[\dA-Za-z\u0400-\u04FF]$/.test(t) ? (a.preventDefault(), p(a), o.search ? he(t) : se(t)) : de(a);
|
|
582
|
+
}, de = (a) => {
|
|
583
|
+
const t = a.code, l = ["ArrowUp", "ArrowDown"].includes(t), r = ["Enter", "Space"].includes(t), d = t === "Escape" && $.value;
|
|
584
|
+
l ? Y(a, f.value) : r ? fe(a, f.value) : d && g();
|
|
585
|
+
}, Y = (a, t) => {
|
|
586
|
+
var d;
|
|
587
|
+
a.preventDefault();
|
|
588
|
+
const l = a.code;
|
|
589
|
+
$.value || p(a);
|
|
590
|
+
const r = (d = i.value) == null ? void 0 : d.length;
|
|
591
|
+
r && (typeof t == "number" ? t === r - 1 && l === "ArrowDown" ? f.value = 0 : t === 0 && l === "ArrowUp" ? f.value = r - 1 : f.value = l === "ArrowDown" ? t + 1 : t - 1 : f.value = l === "ArrowDown" ? 0 : r - 1, ne(f.value));
|
|
592
|
+
}, fe = (a, t) => {
|
|
593
|
+
var r, d, b;
|
|
594
|
+
if (a.preventDefault(), !$.value)
|
|
595
|
+
return p(a);
|
|
596
|
+
const l = t ? ((r = i.value) == null ? void 0 : r[t]) ?? ((d = i.value) == null ? void 0 : d[0]) : (b = i.value) == null ? void 0 : b[0];
|
|
597
|
+
K(l) || me(l);
|
|
598
|
+
};
|
|
599
|
+
async function ne(a) {
|
|
600
|
+
var l, r;
|
|
601
|
+
await G(), typeof a != "number" && Q();
|
|
602
|
+
const t = a ?? f.value;
|
|
603
|
+
typeof t == "number" && t >= 0 && ((r = (l = q.value) == null ? void 0 : l.querySelectorAll(".m-select-list-item")[t]) == null || r.scrollIntoView({
|
|
604
|
+
behavior: "auto",
|
|
605
|
+
block: "nearest",
|
|
606
|
+
inline: "start"
|
|
607
|
+
}));
|
|
608
|
+
}
|
|
609
|
+
function Q(a) {
|
|
610
|
+
var l;
|
|
611
|
+
const t = (l = i.value) == null ? void 0 : l.findIndex((r) => {
|
|
612
|
+
var d, b;
|
|
613
|
+
return o.multiple && Array.isArray(o.modelValue) ? a ? a[o.optionValueKey] === r[o.optionValueKey] : [...o.modelValue].reverse()[0] === r[o.optionValueKey] : ((b = (d = F.value) == null ? void 0 : d[0]) == null ? void 0 : b[o.optionValueKey]) === r[o.optionValueKey];
|
|
614
|
+
});
|
|
615
|
+
f.value = t && t >= 0 ? t : 0;
|
|
616
|
+
}
|
|
617
|
+
const me = (a, t = !0) => {
|
|
618
|
+
var b;
|
|
619
|
+
t && !o.multiple && G(() => g()), T.value = "";
|
|
620
|
+
const l = (b = F.value) == null ? void 0 : b.some(
|
|
621
|
+
(D) => D[o.optionValueKey] === a[o.optionValueKey]
|
|
622
|
+
);
|
|
623
|
+
let r = F.value;
|
|
624
|
+
l && o.multiple ? r = r == null ? void 0 : r.filter(
|
|
625
|
+
(D) => D[o.optionValueKey] !== a[o.optionValueKey]
|
|
626
|
+
) : o.multiple ? r.push(a) : r = [a];
|
|
627
|
+
const d = r.map((D) => D[o.optionValueKey]);
|
|
628
|
+
S("update:model-value", o.multiple ? d : d[0]), S("selected-option", a), Q(a), ie();
|
|
629
|
+
};
|
|
630
|
+
return (a, t) => (v(), C(
|
|
631
|
+
"div",
|
|
632
|
+
{
|
|
633
|
+
ref_key: "mazSelectElement",
|
|
634
|
+
ref: B,
|
|
635
|
+
class: E(["m-select", [{ "--is-open": $.value, "--disabled": e.disabled }, o.class]]),
|
|
636
|
+
style: ee(e.style),
|
|
637
|
+
onBlurCapture: g
|
|
638
|
+
},
|
|
639
|
+
[
|
|
640
|
+
L(we, ke({
|
|
641
|
+
id: z(V),
|
|
642
|
+
ref_key: "mazInputComponent",
|
|
643
|
+
ref: Z,
|
|
644
|
+
class: "m-select-input"
|
|
645
|
+
}, a.$attrs, {
|
|
646
|
+
required: e.required,
|
|
647
|
+
"border-active": I.value,
|
|
648
|
+
color: e.color,
|
|
649
|
+
"model-value": ae.value,
|
|
650
|
+
autocomplete: "off",
|
|
651
|
+
size: e.size,
|
|
652
|
+
disabled: e.disabled,
|
|
653
|
+
onFocus: re(p, ["prevent", "stop"]),
|
|
654
|
+
onClick: re(p, ["prevent", "stop"]),
|
|
655
|
+
onChange: t[0] || (t[0] = (l) => S("change", l)),
|
|
656
|
+
onKeydown: ce
|
|
657
|
+
}), {
|
|
658
|
+
"right-icon": te(() => [
|
|
659
|
+
H("button", {
|
|
660
|
+
tabindex: "-1",
|
|
661
|
+
type: "button",
|
|
662
|
+
class: "m-select-input__toggle-button maz-custom",
|
|
663
|
+
onClick: re(pe, ["stop"])
|
|
664
|
+
}, [
|
|
665
|
+
L(z(x), { class: "m-select-chevron maz-text-xl" })
|
|
666
|
+
], 8, pt)
|
|
667
|
+
]),
|
|
668
|
+
_: 1
|
|
669
|
+
/* STABLE */
|
|
670
|
+
}, 16, ["id", "required", "border-active", "color", "model-value", "size", "disabled", "onFocus", "onClick"]),
|
|
671
|
+
L(De, { name: M.value }, {
|
|
672
|
+
default: te(() => [
|
|
673
|
+
$.value ? (v(), C(
|
|
674
|
+
"div",
|
|
675
|
+
{
|
|
676
|
+
key: 0,
|
|
677
|
+
ref_key: "optionsListElement",
|
|
678
|
+
ref: q,
|
|
679
|
+
class: E(["m-select-list", {
|
|
680
|
+
"--top": e.listPosition.includes("top"),
|
|
681
|
+
"--left": e.listPosition.includes("left"),
|
|
682
|
+
"--right": e.listPosition.includes("right"),
|
|
683
|
+
"--bottom": e.listPosition.includes("bottom")
|
|
684
|
+
}]),
|
|
685
|
+
style: ee({
|
|
686
|
+
maxHeight: `${e.maxListHeight}px`,
|
|
687
|
+
maxWidth: `${e.maxListWidth}px`
|
|
688
|
+
})
|
|
689
|
+
},
|
|
690
|
+
[
|
|
691
|
+
e.search ? (v(), C("div", ht, [
|
|
692
|
+
L(we, {
|
|
693
|
+
ref_key: "searchInputComponent",
|
|
694
|
+
ref: R,
|
|
695
|
+
modelValue: T.value,
|
|
696
|
+
"onUpdate:modelValue": [
|
|
697
|
+
t[1] || (t[1] = (l) => T.value = l),
|
|
698
|
+
t[2] || (t[2] = (l) => f.value = 0)
|
|
699
|
+
],
|
|
700
|
+
size: "sm",
|
|
701
|
+
color: e.color,
|
|
702
|
+
placeholder: e.searchPlaceholder,
|
|
703
|
+
name: "search",
|
|
704
|
+
autocomplete: "off",
|
|
705
|
+
tabindex: "-1",
|
|
706
|
+
class: "m-select-list__search-input",
|
|
707
|
+
onKeydown: de
|
|
708
|
+
}, {
|
|
709
|
+
"left-icon": te(() => [
|
|
710
|
+
L(z(P), { class: "maz-h-[1.3rem] maz-w-[1.3rem]" })
|
|
711
|
+
]),
|
|
712
|
+
_: 1
|
|
713
|
+
/* STABLE */
|
|
714
|
+
}, 8, ["modelValue", "color", "placeholder"])
|
|
715
|
+
])) : h("v-if", !0),
|
|
716
|
+
h(`
|
|
717
|
+
@slot No results slot - Displayed when no results corresponding with seeach query
|
|
718
|
+
`),
|
|
719
|
+
!i.value || i.value.length <= 0 ? J(a.$slots, "no-results", { key: 1 }, () => [
|
|
720
|
+
H("span", gt, [
|
|
721
|
+
L(z(O), { class: "maz-h-6 maz-w-6 maz-text-normal" })
|
|
722
|
+
])
|
|
723
|
+
], !0) : (v(), C("div", bt, [
|
|
724
|
+
(v(!0), C(
|
|
725
|
+
Ue,
|
|
726
|
+
null,
|
|
727
|
+
Oe(i.value, (l, r) => (v(), C("button", {
|
|
728
|
+
key: r,
|
|
729
|
+
tabindex: "-1",
|
|
730
|
+
type: "button",
|
|
731
|
+
class: E(["m-select-list-item maz-custom", [
|
|
732
|
+
{
|
|
733
|
+
"--is-keyboard-selected": f.value === r,
|
|
734
|
+
"--is-selected": j(l),
|
|
735
|
+
"--is-none-value": K(l[e.optionValueKey])
|
|
736
|
+
}
|
|
737
|
+
]]),
|
|
738
|
+
style: ee({ minHeight: `${e.itemHeight}px` }),
|
|
739
|
+
onClick: re((d) => me(l), ["prevent", "stop"])
|
|
740
|
+
}, [
|
|
741
|
+
e.multiple ? (v(), ue(z(n), {
|
|
742
|
+
key: 0,
|
|
743
|
+
tabindex: "-1",
|
|
744
|
+
"model-value": j(l),
|
|
745
|
+
size: "sm",
|
|
746
|
+
color: e.color
|
|
747
|
+
}, null, 8, ["model-value", "color"])) : h("v-if", !0),
|
|
748
|
+
h(`
|
|
749
|
+
@slot Custom option
|
|
750
|
+
@binding {Object} option
|
|
751
|
+
@binding {Boolean} is-selected
|
|
752
|
+
`),
|
|
753
|
+
J(a.$slots, "default", {
|
|
754
|
+
option: l,
|
|
755
|
+
isSelected: j(l)
|
|
756
|
+
}, () => [
|
|
757
|
+
H(
|
|
758
|
+
"span",
|
|
759
|
+
null,
|
|
760
|
+
_(l[e.optionLabelKey]),
|
|
761
|
+
1
|
|
762
|
+
/* TEXT */
|
|
763
|
+
)
|
|
764
|
+
], !0)
|
|
765
|
+
], 14, zt))),
|
|
766
|
+
128
|
|
767
|
+
/* KEYED_FRAGMENT */
|
|
768
|
+
))
|
|
769
|
+
]))
|
|
770
|
+
],
|
|
771
|
+
6
|
|
772
|
+
/* CLASS, STYLE */
|
|
773
|
+
)) : h("v-if", !0)
|
|
774
|
+
]),
|
|
775
|
+
_: 3
|
|
776
|
+
/* FORWARDED */
|
|
777
|
+
}, 8, ["name"])
|
|
778
|
+
],
|
|
779
|
+
38
|
|
780
|
+
/* CLASS, STYLE, HYDRATE_EVENTS */
|
|
781
|
+
));
|
|
782
|
+
}
|
|
783
|
+
});
|
|
784
|
+
const St = /* @__PURE__ */ $e(Ct, [["__scopeId", "data-v-441d5cd5"]]), Vt = ["id"], wt = {
|
|
785
|
+
key: 0,
|
|
786
|
+
class: "maz-text-lg"
|
|
787
|
+
}, xt = /* @__PURE__ */ xe({
|
|
788
|
+
inheritAttrs: !1,
|
|
789
|
+
__name: "MazPhoneNumberInput",
|
|
790
|
+
props: {
|
|
791
|
+
style: { type: [String, Array, Object], default: void 0 },
|
|
792
|
+
class: { type: String, default: void 0 },
|
|
793
|
+
/** Country calling code + telephone number in international format */
|
|
794
|
+
modelValue: {
|
|
795
|
+
type: String,
|
|
796
|
+
validator: (e) => typeof e == "string" || e === void 0,
|
|
797
|
+
default: void 0
|
|
798
|
+
},
|
|
799
|
+
/** @deprecated */
|
|
800
|
+
defaultPhoneNumber: { type: String, default: void 0 },
|
|
801
|
+
/** Country code selected - Ex: "FR" */
|
|
802
|
+
countryCode: {
|
|
803
|
+
type: String,
|
|
804
|
+
default: void 0,
|
|
805
|
+
validator: (e) => be(e)
|
|
806
|
+
},
|
|
807
|
+
/** @deprecated - use country-code or v-model:country-code */
|
|
808
|
+
defaultCountryCode: {
|
|
809
|
+
type: String,
|
|
810
|
+
default: void 0,
|
|
811
|
+
validator: (e) => be(e)
|
|
812
|
+
},
|
|
813
|
+
id: { type: String, default: void 0 },
|
|
814
|
+
placeholder: { type: String, default: void 0 },
|
|
815
|
+
/** List of country codes to place first in the select list - Ex: ['FR', 'BE', 'GE'] */
|
|
816
|
+
preferredCountries: { type: Array, default: void 0 },
|
|
817
|
+
/** List of country codes to be removed from the select list - Ex: ['FR', 'BE', 'GE'] */
|
|
818
|
+
ignoredCountries: { type: Array, default: void 0 },
|
|
819
|
+
/** List of country codes to only have the countries selected in the select list - Ex: ['FR', 'BE', 'GE'] */
|
|
820
|
+
onlyCountries: { type: Array, default: void 0 },
|
|
821
|
+
/** Locale strings of the component */
|
|
822
|
+
translations: { type: Object, default: void 0 },
|
|
823
|
+
/** Position where the list of countries will be opened */
|
|
824
|
+
listPosition: {
|
|
825
|
+
type: String,
|
|
826
|
+
default: "bottom left",
|
|
827
|
+
validator: (e) => ["top", "top right", "top left", "bottom", "bottom right", "bottom left"].includes(
|
|
828
|
+
e
|
|
829
|
+
)
|
|
830
|
+
},
|
|
831
|
+
/** Component color applied - Ex: "secondary" */
|
|
832
|
+
color: { type: String, default: "primary" },
|
|
833
|
+
/** Component size applied - Ex: "sm" */
|
|
834
|
+
size: {
|
|
835
|
+
type: String,
|
|
836
|
+
default: "md",
|
|
837
|
+
validator: (e) => ["mini", "xs", "sm", "md", "lg", "xl"].includes(e)
|
|
838
|
+
},
|
|
839
|
+
/** Remove flags in country list */
|
|
840
|
+
noFlags: { type: Boolean, default: !1 },
|
|
841
|
+
/** Disable input */
|
|
842
|
+
disabled: { type: Boolean, default: !1 },
|
|
843
|
+
/** No show the phone number example */
|
|
844
|
+
noExample: { type: Boolean, default: !1 },
|
|
845
|
+
/** Disable search input in country list */
|
|
846
|
+
noSearch: { type: Boolean, default: !1 },
|
|
847
|
+
/** By default the component use the browser locale to set the default country code if not country code is provided */
|
|
848
|
+
noUseBrowserLocale: { type: Boolean, default: !1 },
|
|
849
|
+
/** The component will make a request to get the location of the user and use it to set the default country code */
|
|
850
|
+
fetchCountry: { type: Boolean, default: !1 },
|
|
851
|
+
/** No show the country selector */
|
|
852
|
+
noCountrySelector: { type: Boolean, default: !1 },
|
|
853
|
+
/** Show country calling code in the country list */
|
|
854
|
+
showCodeOnList: { type: Boolean, default: !1 },
|
|
855
|
+
/** Replace country names */
|
|
856
|
+
customCountriesList: {
|
|
857
|
+
type: Object,
|
|
858
|
+
default: void 0
|
|
859
|
+
},
|
|
860
|
+
/** Disabled auto-format as you type */
|
|
861
|
+
noFormattingAsYouType: { type: Boolean, default: !1 },
|
|
862
|
+
/**
|
|
863
|
+
* locale of country list - Ex: "fr-FR"
|
|
864
|
+
* @default {string} browser locale
|
|
865
|
+
*/
|
|
866
|
+
countryLocale: { type: String, default: void 0 },
|
|
867
|
+
/** Disable validation error UI */
|
|
868
|
+
noValidationError: { type: Boolean, default: !1 },
|
|
869
|
+
/** Disable validation success UI */
|
|
870
|
+
noValidationSuccess: { type: Boolean, default: !1 },
|
|
871
|
+
/** Add success UI */
|
|
872
|
+
success: { type: Boolean, default: !1 },
|
|
873
|
+
/** Add error UI */
|
|
874
|
+
error: { type: Boolean, default: !1 },
|
|
875
|
+
/** Will replace the calling code by the country name in the country selector */
|
|
876
|
+
countrySelectorDisplayName: { type: Boolean, default: !1 },
|
|
877
|
+
/** Choose the width of the country selector */
|
|
878
|
+
countrySelectorWidth: { type: String, default: "9rem" }
|
|
879
|
+
},
|
|
880
|
+
emits: [
|
|
881
|
+
/** emitted when country or phone number changes
|
|
882
|
+
* @property {Result} results - meta info of current phone numnber
|
|
883
|
+
*/
|
|
884
|
+
"update",
|
|
885
|
+
/** emitted when country or phone number changes
|
|
886
|
+
* @property {Result} results - meta info of current phone numnber
|
|
887
|
+
*/
|
|
888
|
+
"data",
|
|
889
|
+
/** emitted when selected country changes
|
|
890
|
+
* @property {CountryCode} countryCode - Country code
|
|
891
|
+
*/
|
|
892
|
+
"country-code",
|
|
893
|
+
/** emitted when country or phone number changes
|
|
894
|
+
* @property {String} phoneNumber - phoneNumber formatted
|
|
895
|
+
*/
|
|
896
|
+
"update:model-value",
|
|
897
|
+
/** emitted when country changes
|
|
898
|
+
* @property {CountryCode} countryCode - Country code
|
|
899
|
+
*/
|
|
900
|
+
"update:country-code"
|
|
901
|
+
],
|
|
902
|
+
setup(e, { emit: u }) {
|
|
903
|
+
const {
|
|
904
|
+
fetchCountryCode: n,
|
|
905
|
+
browserLocale: P,
|
|
906
|
+
getResultsFromPhoneNumber: x,
|
|
907
|
+
getAsYouTypeFormat: O,
|
|
908
|
+
getCountriesList: N,
|
|
909
|
+
getPhoneNumberExample: o,
|
|
910
|
+
sanitizePhoneNumber: S,
|
|
911
|
+
loadPhoneNumberExamplesFile: I
|
|
912
|
+
} = ut(), f = u, s = e, oe = Ie(), le = Pe({
|
|
913
|
+
componentName: "MazPhoneNumberInput",
|
|
914
|
+
instance: oe,
|
|
915
|
+
providedId: s.id
|
|
916
|
+
}), X = m(), $ = m(), V = Re({
|
|
917
|
+
start: 0,
|
|
918
|
+
end: 0,
|
|
919
|
+
cursorAtEnd: !0
|
|
920
|
+
}), F = m(!1), B = m(!1), Z = c(() => N(s.countryLocale, s.customCountriesList)), R = c(() => {
|
|
921
|
+
var t;
|
|
922
|
+
return (t = Z.value) == null ? void 0 : t.filter((l) => {
|
|
923
|
+
var r;
|
|
924
|
+
return !((r = s.ignoredCountries) != null && r.includes(l.iso2));
|
|
925
|
+
});
|
|
926
|
+
}), q = c(() => {
|
|
927
|
+
const t = s.onlyCountries || s.preferredCountries;
|
|
928
|
+
return t == null ? void 0 : t.map(
|
|
929
|
+
(l) => {
|
|
930
|
+
var r;
|
|
931
|
+
return (r = R.value) == null ? void 0 : r.find((d) => d.iso2.includes(l));
|
|
932
|
+
}
|
|
933
|
+
);
|
|
934
|
+
}), K = c(() => {
|
|
935
|
+
var t;
|
|
936
|
+
return (t = R.value) == null ? void 0 : t.filter((l) => {
|
|
937
|
+
var r;
|
|
938
|
+
return !((r = s.preferredCountries) != null && r.includes(l.iso2));
|
|
939
|
+
});
|
|
940
|
+
}), j = c(() => s.preferredCountries ? [...q.value ?? [], ...K.value ?? []] : s.onlyCountries ? q.value : R.value), ae = c(() => {
|
|
941
|
+
var t;
|
|
942
|
+
return (t = j.value) == null ? void 0 : t.map((l) => l ? {
|
|
943
|
+
...l,
|
|
944
|
+
dialCode: `+${l.dialCode}`
|
|
945
|
+
} : void 0).filter(Qe);
|
|
946
|
+
}), M = c(() => ({
|
|
947
|
+
...Ge,
|
|
948
|
+
...s.translations
|
|
949
|
+
})), T = c(() => {
|
|
950
|
+
if (s.placeholder)
|
|
951
|
+
return s.placeholder;
|
|
952
|
+
const t = M.value.phoneInput.placeholder;
|
|
953
|
+
if (s.noExample || !F.value)
|
|
954
|
+
return t;
|
|
955
|
+
{
|
|
956
|
+
const l = o(y.value);
|
|
957
|
+
return i.value.isValid || !l ? t : `${M.value.phoneInput.example} ${l}`;
|
|
958
|
+
}
|
|
959
|
+
}), w = c({
|
|
960
|
+
get: () => s.modelValue || s.defaultPhoneNumber,
|
|
961
|
+
set: (t) => {
|
|
962
|
+
f("update:model-value", t);
|
|
963
|
+
}
|
|
964
|
+
}), W = m(), y = c({
|
|
965
|
+
get: () => s.countryCode || s.defaultCountryCode || W.value,
|
|
966
|
+
set: (t) => {
|
|
967
|
+
f("country-code", t), f("update:country-code", t), W.value = t;
|
|
968
|
+
}
|
|
969
|
+
}), A = m(w.value), i = m(
|
|
970
|
+
x({
|
|
971
|
+
phoneNumber: w.value,
|
|
972
|
+
countryCode: y.value
|
|
973
|
+
})
|
|
974
|
+
), g = m(), p = c(() => s.noFormattingAsYouType ? A.value ?? "" : g.value ?? A.value ?? "");
|
|
975
|
+
async function ie() {
|
|
976
|
+
const t = await n();
|
|
977
|
+
t && Y(t);
|
|
978
|
+
}
|
|
979
|
+
async function pe() {
|
|
980
|
+
try {
|
|
981
|
+
!s.noExample && !F.value && (await I(), F.value = !0);
|
|
982
|
+
} catch {
|
|
983
|
+
console.error("[maz-ui](MazPhoneNumberInput) while loading phone number examples file");
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
Be(async () => {
|
|
987
|
+
await fe(w.value), await G(), s.fetchCountry && !y.value && await ie(), !s.defaultCountryCode && !s.noUseBrowserLocale && !y.value && he(), await pe();
|
|
988
|
+
}), ve(
|
|
989
|
+
() => i.value,
|
|
990
|
+
(t) => {
|
|
991
|
+
f("update", t), f("data", t);
|
|
992
|
+
},
|
|
993
|
+
{ immediate: !0, deep: !0 }
|
|
994
|
+
), ve(
|
|
995
|
+
() => y.value,
|
|
996
|
+
(t, l) => {
|
|
997
|
+
t && t !== l && (Y(t), ce(p.value));
|
|
998
|
+
}
|
|
999
|
+
), ve(
|
|
1000
|
+
() => w.value,
|
|
1001
|
+
async (t, l) => {
|
|
1002
|
+
t !== l && fe(t);
|
|
1003
|
+
}
|
|
1004
|
+
), ve(
|
|
1005
|
+
() => p.value,
|
|
1006
|
+
async (t, l) => {
|
|
1007
|
+
if (!s.noFormattingAsYouType && t && t !== l) {
|
|
1008
|
+
const r = Q();
|
|
1009
|
+
if (r && !i.value.isValid && typeof V.start == "number" && !V.cursorAtEnd) {
|
|
1010
|
+
const d = V.start, b = V.end;
|
|
1011
|
+
setTimeout(() => {
|
|
1012
|
+
r.setSelectionRange(d, b ?? d);
|
|
1013
|
+
}, 0);
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
);
|
|
1018
|
+
function he() {
|
|
1019
|
+
const { locale: t } = P();
|
|
1020
|
+
t && Y(t);
|
|
1021
|
+
}
|
|
1022
|
+
function se(t, l) {
|
|
1023
|
+
i.value = x({
|
|
1024
|
+
phoneNumber: t,
|
|
1025
|
+
countryCode: l
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
async function ce(t) {
|
|
1029
|
+
const l = Q();
|
|
1030
|
+
V.start = l == null ? void 0 : l.selectionStart, V.end = l == null ? void 0 : l.selectionEnd, V.cursorAtEnd = V.start ? V.start >= t.length : !0;
|
|
1031
|
+
const r = S(t);
|
|
1032
|
+
A.value = r;
|
|
1033
|
+
const d = x({
|
|
1034
|
+
phoneNumber: r,
|
|
1035
|
+
countryCode: y.value
|
|
1036
|
+
});
|
|
1037
|
+
w.value = d.e164;
|
|
1038
|
+
}
|
|
1039
|
+
function de(t) {
|
|
1040
|
+
se(p.value, t), Y(t, !0);
|
|
1041
|
+
}
|
|
1042
|
+
function Y(t, l = !1) {
|
|
1043
|
+
try {
|
|
1044
|
+
be(t) && (y.value = t, l && a());
|
|
1045
|
+
} catch (r) {
|
|
1046
|
+
console.error(`[maz-ui](MazPhoneNumberInput) ${r}`);
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
async function fe(t) {
|
|
1050
|
+
se(t, y.value), await G(), s.noFormattingAsYouType ? A.value = p.value : g.value = V.cursorAtEnd || i.value.isValid ? A.value = O(
|
|
1051
|
+
i.value.countryCode ?? y.value,
|
|
1052
|
+
i.value.formatNational ?? A.value
|
|
1053
|
+
) : A.value, await G(), ne(i.value);
|
|
1054
|
+
}
|
|
1055
|
+
function ne(t) {
|
|
1056
|
+
t.countryCode && y.value !== t.countryCode && Y(t.countryCode);
|
|
1057
|
+
}
|
|
1058
|
+
function Q() {
|
|
1059
|
+
var t;
|
|
1060
|
+
return (t = X.value) == null ? void 0 : t.$el.querySelector("input");
|
|
1061
|
+
}
|
|
1062
|
+
function me() {
|
|
1063
|
+
var t, l;
|
|
1064
|
+
(l = (t = $.value) == null ? void 0 : t.$el.querySelector("input")) == null || l.focus();
|
|
1065
|
+
}
|
|
1066
|
+
async function a() {
|
|
1067
|
+
var t;
|
|
1068
|
+
await G(), (t = Q()) == null || t.focus();
|
|
1069
|
+
}
|
|
1070
|
+
return (t, l) => {
|
|
1071
|
+
var r, d, b, D;
|
|
1072
|
+
return v(), C("div", {
|
|
1073
|
+
id: z(le),
|
|
1074
|
+
class: E(["m-phone-number-input", [
|
|
1075
|
+
s.class,
|
|
1076
|
+
{
|
|
1077
|
+
"--no-flags": e.noFlags
|
|
1078
|
+
}
|
|
1079
|
+
]]),
|
|
1080
|
+
style: ee(e.style)
|
|
1081
|
+
}, [
|
|
1082
|
+
y.value && !e.noFlags && !e.noCountrySelector ? (v(), C("button", {
|
|
1083
|
+
key: 0,
|
|
1084
|
+
class: "m-phone-number-input__country-flag maz-text-xl",
|
|
1085
|
+
tabindex: "-1",
|
|
1086
|
+
type: "button",
|
|
1087
|
+
onClick: me
|
|
1088
|
+
}, [
|
|
1089
|
+
h(`
|
|
1090
|
+
@slot Country selector flag
|
|
1091
|
+
@binding {String} country-code - current selected country code - Ex: \`"FR"\`
|
|
1092
|
+
`),
|
|
1093
|
+
J(t.$slots, "selector-flag", { countryCode: y.value }, () => [
|
|
1094
|
+
Ce(
|
|
1095
|
+
_(z(Ae)(y.value)),
|
|
1096
|
+
1
|
|
1097
|
+
/* TEXT */
|
|
1098
|
+
)
|
|
1099
|
+
], !0)
|
|
1100
|
+
])) : h("v-if", !0),
|
|
1101
|
+
e.noCountrySelector ? h("v-if", !0) : (v(), ue(St, {
|
|
1102
|
+
key: 1,
|
|
1103
|
+
ref_key: "CountrySelector",
|
|
1104
|
+
ref: $,
|
|
1105
|
+
class: "m-phone-number-input__select",
|
|
1106
|
+
"model-value": y.value,
|
|
1107
|
+
"option-value-key": "iso2",
|
|
1108
|
+
"option-label-key": "name",
|
|
1109
|
+
"option-input-value-key": e.countrySelectorDisplayName ? "name" : "dialCode",
|
|
1110
|
+
"max-list-width": 250,
|
|
1111
|
+
disabled: e.disabled,
|
|
1112
|
+
color: e.color,
|
|
1113
|
+
size: e.size,
|
|
1114
|
+
"list-position": e.listPosition,
|
|
1115
|
+
search: !e.noSearch,
|
|
1116
|
+
"search-placeholder": M.value.countrySelector.searchPlaceholder,
|
|
1117
|
+
options: ae.value,
|
|
1118
|
+
error: e.error || (e.noValidationError ? !1 : !!p.value && !y.value),
|
|
1119
|
+
hint: p.value && !y.value ? M.value.countrySelector.error : void 0,
|
|
1120
|
+
label: M.value.countrySelector.placeholder,
|
|
1121
|
+
success: e.success || (e.noValidationSuccess ? !1 : (r = i.value) == null ? void 0 : r.isValid),
|
|
1122
|
+
style: ee({
|
|
1123
|
+
width: e.countrySelectorWidth
|
|
1124
|
+
}),
|
|
1125
|
+
"onUpdate:modelValue": l[0] || (l[0] = (k) => de(k)),
|
|
1126
|
+
onFocus: l[1] || (l[1] = (k) => B.value = !1)
|
|
1127
|
+
}, {
|
|
1128
|
+
default: te(({ option: k, isSelected: ye }) => [
|
|
1129
|
+
H(
|
|
1130
|
+
"div",
|
|
1131
|
+
{
|
|
1132
|
+
class: E(["m-phone-number-input__select__item maz-flex maz-items-center maz-gap-1 maz-truncate", {
|
|
1133
|
+
"m-phone-number-input__select__item--selected": ye
|
|
1134
|
+
}])
|
|
1135
|
+
},
|
|
1136
|
+
[
|
|
1137
|
+
!e.noFlags && typeof k.iso2 == "string" ? (v(), C("span", wt, [
|
|
1138
|
+
h(`
|
|
1139
|
+
@slot Country list flag
|
|
1140
|
+
@binding {String} country-code - country code of option - Ex: \`"FR"\`
|
|
1141
|
+
@binding {{ iso2: string; dialCode: string; name: string; }} option - country data
|
|
1142
|
+
@binding {Boolean} is-selected - \`true\` if option is selected
|
|
1143
|
+
`),
|
|
1144
|
+
J(t.$slots, "country-list-flag", {
|
|
1145
|
+
countryCode: k.iso2,
|
|
1146
|
+
option: k,
|
|
1147
|
+
isSelected: ye
|
|
1148
|
+
}, () => [
|
|
1149
|
+
Ce(
|
|
1150
|
+
_(z(Ae)(k.iso2)),
|
|
1151
|
+
1
|
|
1152
|
+
/* TEXT */
|
|
1153
|
+
)
|
|
1154
|
+
], !0)
|
|
1155
|
+
])) : h("v-if", !0),
|
|
1156
|
+
e.showCodeOnList ? (v(), C(
|
|
1157
|
+
"span",
|
|
1158
|
+
{
|
|
1159
|
+
key: 1,
|
|
1160
|
+
class: E(["maz-w-9 maz-flex-none", { "maz-text-muted": !ye }])
|
|
1161
|
+
},
|
|
1162
|
+
_(k.dialCode),
|
|
1163
|
+
3
|
|
1164
|
+
/* TEXT, CLASS */
|
|
1165
|
+
)) : h("v-if", !0),
|
|
1166
|
+
H(
|
|
1167
|
+
"span",
|
|
1168
|
+
{
|
|
1169
|
+
class: E(["maz-flex-1 maz-truncate", { "maz-font-semibold": ye }])
|
|
1170
|
+
},
|
|
1171
|
+
_(k.name),
|
|
1172
|
+
3
|
|
1173
|
+
/* TEXT, CLASS */
|
|
1174
|
+
)
|
|
1175
|
+
],
|
|
1176
|
+
2
|
|
1177
|
+
/* CLASS */
|
|
1178
|
+
)
|
|
1179
|
+
]),
|
|
1180
|
+
_: 3
|
|
1181
|
+
/* FORWARDED */
|
|
1182
|
+
}, 8, ["model-value", "option-input-value-key", "disabled", "color", "size", "list-position", "search", "search-placeholder", "options", "error", "hint", "label", "success", "style"])),
|
|
1183
|
+
L(we, ke({
|
|
1184
|
+
id: e.id,
|
|
1185
|
+
ref_key: "PhoneNumberInput",
|
|
1186
|
+
ref: X,
|
|
1187
|
+
"model-value": p.value,
|
|
1188
|
+
label: T.value,
|
|
1189
|
+
disabled: e.disabled,
|
|
1190
|
+
color: e.color,
|
|
1191
|
+
error: e.error || (e.noValidationError ? !1 : !!p.value && !((d = i.value) != null && d.isValid))
|
|
1192
|
+
}, t.$attrs, {
|
|
1193
|
+
size: e.size,
|
|
1194
|
+
"icon-name": "phone",
|
|
1195
|
+
type: "tel",
|
|
1196
|
+
clearable: "",
|
|
1197
|
+
success: e.success || (e.noValidationSuccess ? !1 : (b = i.value) == null ? void 0 : b.isValid),
|
|
1198
|
+
class: ["m-phone-number-input__input maz-flex-1", {
|
|
1199
|
+
"--border-radius": !e.noCountrySelector,
|
|
1200
|
+
"--error": e.error || !((D = i.value) != null && D.isValid),
|
|
1201
|
+
"--focused": B.value
|
|
1202
|
+
}],
|
|
1203
|
+
onFocus: l[2] || (l[2] = (k) => B.value = !0),
|
|
1204
|
+
onBlur: l[3] || (l[3] = (k) => B.value = !1),
|
|
1205
|
+
"onUpdate:modelValue": l[4] || (l[4] = (k) => ce(k))
|
|
1206
|
+
}), null, 16, ["id", "model-value", "label", "disabled", "color", "error", "size", "success", "class"])
|
|
1207
|
+
], 14, Vt);
|
|
1208
|
+
};
|
|
1209
|
+
}
|
|
1210
|
+
});
|
|
1211
|
+
const $t = /* @__PURE__ */ $e(xt, [["__scopeId", "data-v-13c350c6"]]);
|
|
1212
|
+
export {
|
|
1213
|
+
$t as M,
|
|
1214
|
+
$e as _,
|
|
1215
|
+
Pe as u
|
|
1216
|
+
};
|