maz-ui 3.37.3 → 3.37.4
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/MazBottomSheet.mjs +1 -1
- package/components/MazBtn.d.ts +2 -2
- package/components/MazBtn.mjs +1 -1
- package/components/MazCard.d.ts +2 -0
- package/components/MazCard.mjs +1 -1
- package/components/MazCarousel.mjs +1 -1
- package/components/MazDialog.mjs +1 -1
- package/components/MazDialogPromise.mjs +1 -1
- package/components/MazDrawer.mjs +1 -1
- package/components/MazDropdown.mjs +1 -1
- package/components/MazInput.mjs +1 -1
- package/components/MazInputNumber.mjs +1 -1
- package/components/MazInputPrice.mjs +1 -1
- package/components/MazInputTags.d.ts +4 -4
- package/components/MazInputTags.mjs +1 -1
- package/components/MazPagination.mjs +1 -1
- package/components/MazPhoneNumberInput/CountrySelector.vue.d.ts +8 -4
- package/components/MazPhoneNumberInput/use-maz-phone-number-input.d.ts +2 -2
- package/components/MazPhoneNumberInput.d.ts +21 -8
- package/components/MazPhoneNumberInput.mjs +1 -1
- package/components/MazPicker.mjs +1 -1
- package/components/MazRadio.d.ts +89 -92
- package/components/MazRadio.mjs +67 -73
- package/components/MazRadioButtons.d.ts +84 -62
- package/components/MazRadioButtons.mjs +112 -60
- package/components/MazSelect.d.ts +12 -7
- package/components/MazSelect.mjs +1 -1
- package/components/MazSwitch.d.ts +61 -67
- package/components/MazSwitch.mjs +41 -48
- package/components/MazTable.mjs +1 -1
- package/components/MazTextarea.d.ts +23 -8
- package/components/MazTextarea.mjs +1 -1
- package/components/assets/MazBtn.css +1 -1
- package/components/assets/MazCard.css +1 -1
- package/components/assets/MazInputNumber.css +1 -1
- package/components/assets/MazInputTags.css +1 -1
- package/components/assets/MazPagination.css +1 -1
- package/components/assets/MazPhoneNumberInput.css +1 -1
- package/components/assets/MazRadio.css +1 -1
- package/components/assets/MazRadioButtons.css +1 -1
- package/components/assets/MazSelect.css +1 -1
- package/components/assets/MazSwitch.css +1 -1
- package/components/assets/MazTable.css +1 -1
- package/components/assets/MazTextarea.css +1 -1
- package/components/chunks/{MazBottomSheet-DZ1n4bGL.mjs → MazBottomSheet-B9OYmgyx.mjs} +1 -1
- package/components/chunks/{MazBtn-CnZU5zlG.mjs → MazBtn-4stpYG-V.mjs} +8 -8
- package/components/chunks/{MazBtn-BJs3rzUf.mjs → MazBtn-BQZOiUux.mjs} +8 -8
- package/components/chunks/{MazBtn-DLYgzr9e.mjs → MazBtn-Bgt41rUb.mjs} +11 -11
- package/components/chunks/MazBtn-CNyFbl9Y.mjs +151 -0
- package/components/chunks/{MazBtn-BTHDxDz7.mjs → MazBtn-CrNEwd_M.mjs} +8 -8
- package/components/chunks/MazBtn-CyXtFeAh.mjs +151 -0
- package/components/chunks/{MazBtn-CnkBOGKK.mjs → MazBtn-DOtOjQOl.mjs} +11 -11
- package/components/chunks/{MazBtn-IH6bjzah.mjs → MazBtn-DXC8jXNK.mjs} +8 -8
- package/components/chunks/{MazBtn-Dbe098kd.mjs → MazBtn-De3ZeaJJ.mjs} +8 -8
- package/components/chunks/{MazBtn-CDQAW3fg.mjs → MazBtn-g6VJMuer.mjs} +8 -8
- package/components/chunks/MazBtn-v1mwE1O3.mjs +151 -0
- package/components/chunks/{MazBtn-pLRsSxug.mjs → MazBtn-z9IFp0ZS.mjs} +8 -8
- package/components/chunks/{MazCard-CNE9c3L5.mjs → MazCard-E9Eg2VRn.mjs} +10 -8
- package/components/chunks/{MazCarousel-CMJgMJf1.mjs → MazCarousel-CtSpgIm6.mjs} +1 -1
- package/components/chunks/{MazCheckbox-DJBo7Ejt.mjs → MazCheckbox-BE7eLIkK.mjs} +1 -1
- package/components/chunks/{MazCheckbox-CM7mucQa.mjs → MazCheckbox-eSSrvpn9.mjs} +1 -1
- package/components/chunks/{MazDialog-BVqOTysP.mjs → MazDialog-CjsC6fGo.mjs} +1 -1
- package/components/chunks/{MazDialogPromise-BjciKAwR.mjs → MazDialogPromise-Blv60XZR.mjs} +2 -2
- package/components/chunks/{MazGallery-BUUq89aM.mjs → MazGallery-DRgvR7K0.mjs} +2 -2
- package/components/chunks/{MazIcon-BKfQ_rkt.mjs → MazIcon-C_IIdjqr.mjs} +1 -1
- package/components/chunks/{MazInput-Caas-0Nk.mjs → MazInput-Dn4JzYhe.mjs} +1 -1
- package/components/chunks/{MazInputNumber-CnoCQQzg.mjs → MazInputNumber-Df31nPnc.mjs} +2 -2
- package/components/chunks/{MazInputPrice---5nCUKm.mjs → MazInputPrice-DATyEiwP.mjs} +1 -1
- package/components/chunks/{MazInputTags-CipoVBP2.mjs → MazInputTags-DBzwE87F.mjs} +3 -3
- package/components/chunks/{MazPagination-CXw3yqbu.mjs → MazPagination-BU6fSHr2.mjs} +2 -2
- package/components/chunks/MazPhoneNumberInput-D8hP4ZzW.mjs +1419 -0
- package/components/chunks/{MazPicker-CfhI75aw.mjs → MazPicker-D71j9m8h.mjs} +2 -2
- package/components/chunks/{MazPickerCalendar-DnkNE-Am.mjs → MazPickerCalendar-psuBcTR7.mjs} +3 -3
- package/components/chunks/{MazPickerHeader-Vt86yzXS.mjs → MazPickerHeader-BmqHJE0a.mjs} +1 -1
- package/components/chunks/{MazPickerMonthSwitcher-zfKhsjW1.mjs → MazPickerMonthSwitcher-DgU0pLkF.mjs} +2 -2
- package/components/chunks/{MazPickerShortcuts-DUIKfOO8.mjs → MazPickerShortcuts-D9YXi3Ns.mjs} +2 -2
- package/components/chunks/{MazPickerTime-B2znRxr2.mjs → MazPickerTime-8ZqSEb_N.mjs} +2 -2
- package/components/chunks/{MazPickerYearSwitcher-CB339kof.mjs → MazPickerYearSwitcher-D-zu0tMs.mjs} +3 -3
- package/components/chunks/MazSelect-Cc8JAFML.mjs +731 -0
- package/components/chunks/{MazSpinner-DFseK3o_.mjs → MazSpinner-2-OAJWTi.mjs} +1 -1
- package/components/chunks/MazSpinner-B0xEVmcj.mjs +38 -0
- package/components/chunks/{MazSpinner-2fDI3i5h.mjs → MazSpinner-B3Gt0AEt.mjs} +1 -1
- package/components/chunks/MazSpinner-B6Z6X_KC.mjs +38 -0
- package/components/chunks/{MazSpinner-CORsBFCP.mjs → MazSpinner-BVaJBGw5.mjs} +1 -1
- package/components/chunks/{MazSpinner-CVBVegaS.mjs → MazSpinner-BVflp3wp.mjs} +1 -1
- package/components/chunks/MazSpinner-BmqyUsTZ.mjs +38 -0
- package/components/chunks/{MazSpinner-XMLkiLTL.mjs → MazSpinner-Btk7fYzq.mjs} +1 -1
- package/components/chunks/{MazSpinner-BtFWH26r.mjs → MazSpinner-CAQqdZfW.mjs} +1 -1
- package/components/chunks/MazSpinner-COqX5baD.mjs +38 -0
- package/components/chunks/{MazSpinner-Bky73siD.mjs → MazSpinner-CV3h3CKR.mjs} +1 -1
- package/components/chunks/MazSpinner-Cm5GeVV-.mjs +38 -0
- package/components/chunks/{MazSpinner-CkHAaRhk.mjs → MazSpinner-D9uDPRkX.mjs} +1 -1
- package/components/chunks/MazSpinner-DO1id61e.mjs +38 -0
- package/components/chunks/MazSpinner-K26cuR_A.mjs +38 -0
- package/components/chunks/MazSpinner-LCpiZGMP.mjs +38 -0
- package/components/chunks/MazTable-vcm_SC7e.mjs +1846 -0
- package/components/chunks/{MazTransitionExpand-BWsQP7UF.mjs → MazTransitionExpand-DXKtquVe.mjs} +1 -1
- package/css/main.css +1 -1
- package/modules/assets/MazBtn.css +1 -1
- package/modules/chunks/{MazBtn-BxYYeNGe.mjs → MazBtn-CNsgLyRm.mjs} +8 -8
- package/modules/chunks/{MazBtn-CHUwa3fu.cjs → MazBtn-DmXrGuUE.cjs} +2 -2
- package/modules/chunks/{MazIcon-CnOCvJTw.mjs → MazIcon-DwRWkhhR.mjs} +1 -1
- package/modules/chunks/{MazIcon-DcbutTbM.cjs → MazIcon-rh9PwwaQ.cjs} +1 -1
- package/modules/chunks/{MazSpinner-TL9_4BOs.cjs → MazSpinner-BzucVZXm.cjs} +1 -1
- package/modules/chunks/{MazSpinner-ClFhZyF_.mjs → MazSpinner-mCJd14Kq.mjs} +1 -1
- package/modules/chunks/{index-DksGhf51.cjs → index-DHsybBwE.cjs} +1 -1
- package/modules/chunks/{index-_xAQ9uTd.mjs → index-DrSSNP9y.mjs} +2 -2
- package/modules/index.cjs +1 -1
- package/modules/index.mjs +1 -1
- package/nuxt/index.json +1 -1
- package/nuxt/index.mjs +5 -5
- package/package.json +6 -6
- package/types/components/MazBtn.vue.d.ts +2 -2
- package/types/components/MazCard.vue.d.ts +2 -0
- package/types/components/MazInputTags.vue.d.ts +4 -4
- package/types/components/MazPhoneNumberInput/CountrySelector.vue.d.ts +8 -4
- package/types/components/MazPhoneNumberInput/use-maz-phone-number-input.d.ts +2 -2
- package/types/components/MazPhoneNumberInput.vue.d.ts +21 -8
- package/types/components/MazRadio.vue.d.ts +89 -92
- package/types/components/MazRadioButtons.vue.d.ts +84 -62
- package/types/components/MazSelect.vue.d.ts +12 -7
- package/types/components/MazSwitch.vue.d.ts +61 -67
- package/types/components/MazTextarea.vue.d.ts +23 -8
- package/components/chunks/MazBtn-Cpnby6Lb.mjs +0 -151
- package/components/chunks/MazBtn-D5q0p_mK.mjs +0 -151
- package/components/chunks/MazBtn-Koayc6g_.mjs +0 -151
- package/components/chunks/MazPhoneNumberInput-BDiyO_6j.mjs +0 -1423
- package/components/chunks/MazSelect-Cr1xT89o.mjs +0 -767
- package/components/chunks/MazSpinner-CdKm_Lcp.mjs +0 -38
- package/components/chunks/MazSpinner-CkdjTE0y.mjs +0 -38
- package/components/chunks/MazSpinner-CtMh7fIX.mjs +0 -38
- package/components/chunks/MazSpinner-DECa8Pby.mjs +0 -38
- package/components/chunks/MazSpinner-DMBy6mx3.mjs +0 -38
- package/components/chunks/MazSpinner-DPmNDRtT.mjs +0 -38
- package/components/chunks/MazSpinner-Dq4o-_GM.mjs +0 -38
- package/components/chunks/MazSpinner-DyE_USVF.mjs +0 -38
- package/components/chunks/MazTable-CIlP0a61.mjs +0 -1882
|
@@ -1,1423 +0,0 @@
|
|
|
1
|
-
import '../assets/MazPhoneNumberInput.css';
|
|
2
|
-
import { getCurrentInstance as to, computed as v, defineComponent as re, defineAsyncComponent as U, ref as I, onMounted as we, useSlots as lo, openBlock as C, createElementBlock as P, normalizeClass as E, normalizeStyle as _, createElementVNode as R, createCommentVNode as V, renderSlot as H, createBlock as K, unref as b, resolveDynamicComponent as Fe, withDirectives as Ne, mergeProps as pe, toHandlers as no, vModelDynamic as ao, createTextVNode as Ce, toDisplayString as G, withModifiers as x, withCtx as ae, createVNode as q, nextTick as ee, useCssVars as ro, onBeforeMount as so, Transition as uo, Fragment as Ae, renderList as io, reactive as co, mergeModels as Le, useModel as po, watch as he } from "vue";
|
|
3
|
-
import { getCountries as Te, getCountryCallingCode as de, getExampleNumber as fo, isSupportedCountry as mo, parsePhoneNumberFromString as yo, AsYouType as vo } from "libphonenumber-js";
|
|
4
|
-
function ho(t, l) {
|
|
5
|
-
let o;
|
|
6
|
-
return function(...c) {
|
|
7
|
-
clearTimeout(o), o = setTimeout(() => {
|
|
8
|
-
t.apply(this, c);
|
|
9
|
-
}, l);
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
const ke = ({
|
|
13
|
-
componentName: t,
|
|
14
|
-
providedId: l
|
|
15
|
-
}) => {
|
|
16
|
-
const o = to();
|
|
17
|
-
return v(() => l ?? `${t}-${o == null ? void 0 : o.uid}`);
|
|
18
|
-
}, bo = {
|
|
19
|
-
key: 0,
|
|
20
|
-
class: "m-input-wrapper-left"
|
|
21
|
-
}, go = { class: "m-input-wrapper-input" }, zo = ["id", "type", "name", "inputmode", "placeholder", "aria-label", "disabled", "readonly", "required"], Co = { key: 0 }, Vo = {
|
|
22
|
-
key: 1,
|
|
23
|
-
class: "m-input-wrapper-right"
|
|
24
|
-
}, wo = /* @__PURE__ */ re({
|
|
25
|
-
inheritAttrs: !1,
|
|
26
|
-
__name: "MazInput",
|
|
27
|
-
props: {
|
|
28
|
-
style: { default: void 0 },
|
|
29
|
-
class: { default: void 0 },
|
|
30
|
-
modelValue: { type: [String, Number, null, Boolean], default: void 0 },
|
|
31
|
-
placeholder: { default: void 0 },
|
|
32
|
-
label: { default: void 0 },
|
|
33
|
-
name: { default: void 0 },
|
|
34
|
-
color: { default: "primary" },
|
|
35
|
-
type: { default: "text" },
|
|
36
|
-
required: { type: Boolean, default: !1 },
|
|
37
|
-
disabled: { type: Boolean, default: !1 },
|
|
38
|
-
readonly: { type: Boolean, default: !1 },
|
|
39
|
-
id: { default: void 0 },
|
|
40
|
-
error: { type: Boolean, default: !1 },
|
|
41
|
-
success: { type: Boolean, default: !1 },
|
|
42
|
-
warning: { type: Boolean, default: !1 },
|
|
43
|
-
hint: { default: void 0 },
|
|
44
|
-
inputClasses: { default: void 0 },
|
|
45
|
-
noBorder: { type: Boolean, default: !1 },
|
|
46
|
-
noRadius: { type: Boolean, default: !1 },
|
|
47
|
-
inputmode: { default: "text" },
|
|
48
|
-
size: { default: "md" },
|
|
49
|
-
debounce: { type: [Boolean, Number], default: !1 },
|
|
50
|
-
debounceDelay: { default: 500 },
|
|
51
|
-
validButton: { type: Boolean, default: !1 },
|
|
52
|
-
validButtonLoading: { type: Boolean, default: !1 },
|
|
53
|
-
autoFocus: { type: Boolean, default: !1 },
|
|
54
|
-
borderActive: { type: Boolean, default: !1 },
|
|
55
|
-
leftIcon: { default: void 0 },
|
|
56
|
-
rightIcon: { default: void 0 },
|
|
57
|
-
roundedSize: { default: void 0 },
|
|
58
|
-
block: { type: Boolean }
|
|
59
|
-
},
|
|
60
|
-
emits: ["update:model-value", "focus", "blur", "click", "change"],
|
|
61
|
-
setup(t, { emit: l }) {
|
|
62
|
-
const o = U(() => import("./MazBtn-D5q0p_mK.mjs")), c = U(() => import("./MazIcon-Cxrv3_OK.mjs")), m = U(() => import("./eye-slash-tjfxO0LK.mjs")), f = U(() => import("./eye-DqO_Jx56.mjs")), n = U(() => import("./check-7UA4j2f2.mjs")), i = t, k = l, h = I(!1), B = I(!1), M = I(), d = ke({
|
|
63
|
-
componentName: "MazInput",
|
|
64
|
-
providedId: i.id
|
|
65
|
-
});
|
|
66
|
-
we(() => {
|
|
67
|
-
var r;
|
|
68
|
-
i.autoFocus && ((r = M.value) == null || r.focus());
|
|
69
|
-
});
|
|
70
|
-
const g = v(() => i.type === "password"), y = v(() => h.value ? "text" : i.type), F = v(() => {
|
|
71
|
-
if (!i.noBorder) {
|
|
72
|
-
if (i.error)
|
|
73
|
-
return "maz-border-danger";
|
|
74
|
-
if (i.success)
|
|
75
|
-
return "maz-border-success";
|
|
76
|
-
if (i.warning)
|
|
77
|
-
return "maz-border-warning";
|
|
78
|
-
if (B.value || i.borderActive) {
|
|
79
|
-
if (i.color === "black")
|
|
80
|
-
return "maz-border-black";
|
|
81
|
-
if (i.color === "danger")
|
|
82
|
-
return "maz-border-danger";
|
|
83
|
-
if (i.color === "info")
|
|
84
|
-
return "maz-border-info";
|
|
85
|
-
if (i.color === "primary")
|
|
86
|
-
return "maz-border-primary";
|
|
87
|
-
if (i.color === "secondary")
|
|
88
|
-
return "maz-border-secondary";
|
|
89
|
-
if (i.color === "success")
|
|
90
|
-
return "maz-border-success";
|
|
91
|
-
if (i.color === "warning")
|
|
92
|
-
return "maz-border-warning";
|
|
93
|
-
if (i.color === "white")
|
|
94
|
-
return "maz-border-white";
|
|
95
|
-
}
|
|
96
|
-
return "--default-border";
|
|
97
|
-
}
|
|
98
|
-
}), z = lo(), $ = v(() => {
|
|
99
|
-
const { required: r, placeholder: L } = i;
|
|
100
|
-
if (L)
|
|
101
|
-
return r ? `${L} *` : L;
|
|
102
|
-
}), a = v(() => N.value !== void 0 && N.value !== ""), S = ho(
|
|
103
|
-
(r) => {
|
|
104
|
-
N.value = r;
|
|
105
|
-
},
|
|
106
|
-
typeof i.debounce == "number" ? i.debounce : i.debounceDelay ?? 500
|
|
107
|
-
), N = v({
|
|
108
|
-
get: () => i.modelValue,
|
|
109
|
-
set: (r) => {
|
|
110
|
-
if (i.debounce)
|
|
111
|
-
return S(r);
|
|
112
|
-
k("update:model-value", r);
|
|
113
|
-
}
|
|
114
|
-
}), ue = v(() => (!!i.label || !!i.hint) && (B.value || !!a.value || !!i.placeholder || ["date", "month", "week"].includes(i.type))), ie = v(() => !!i.label || !!i.hint);
|
|
115
|
-
function O() {
|
|
116
|
-
return !!z["right-icon"] || g.value || !!z["valid-button"] || i.validButton || !!i.rightIcon;
|
|
117
|
-
}
|
|
118
|
-
function te() {
|
|
119
|
-
return !!z["left-icon"] || !!i.leftIcon;
|
|
120
|
-
}
|
|
121
|
-
function fe(r) {
|
|
122
|
-
k("focus", r), B.value = !0;
|
|
123
|
-
}
|
|
124
|
-
function me(r) {
|
|
125
|
-
k("blur", r), B.value = !1;
|
|
126
|
-
}
|
|
127
|
-
function j(r) {
|
|
128
|
-
return k("change", r);
|
|
129
|
-
}
|
|
130
|
-
return (r, L) => (C(), P(
|
|
131
|
-
"div",
|
|
132
|
-
{
|
|
133
|
-
class: E(["m-input", [
|
|
134
|
-
{
|
|
135
|
-
"--is-focused": B.value || r.borderActive,
|
|
136
|
-
"--should-up": ue.value,
|
|
137
|
-
"--has-label": ie.value,
|
|
138
|
-
"--is-disabled": r.disabled,
|
|
139
|
-
"--is-readonly": r.readonly,
|
|
140
|
-
"--has-z-2": r.error || r.warning || r.success,
|
|
141
|
-
"--has-state": r.error || r.warning || r.success,
|
|
142
|
-
"--block": r.block
|
|
143
|
-
},
|
|
144
|
-
i.class,
|
|
145
|
-
`--${r.color}`,
|
|
146
|
-
`--${r.size}`
|
|
147
|
-
]]),
|
|
148
|
-
style: _(r.style)
|
|
149
|
-
},
|
|
150
|
-
[
|
|
151
|
-
R(
|
|
152
|
-
"div",
|
|
153
|
-
{
|
|
154
|
-
class: E(["m-input-wrapper", [
|
|
155
|
-
r.inputClasses,
|
|
156
|
-
F.value,
|
|
157
|
-
r.roundedSize ? `--rounded-${r.roundedSize}` : { "maz-rounded": !r.noRadius }
|
|
158
|
-
]])
|
|
159
|
-
},
|
|
160
|
-
[
|
|
161
|
-
te() ? (C(), P("div", bo, [
|
|
162
|
-
V(`
|
|
163
|
-
@slot left-icon - The icon to display on the left of the input
|
|
164
|
-
`),
|
|
165
|
-
r.$slots["left-icon"] || r.leftIcon ? H(r.$slots, "left-icon", { key: 0 }, () => [
|
|
166
|
-
typeof r.leftIcon == "string" ? (C(), K(b(c), {
|
|
167
|
-
key: 0,
|
|
168
|
-
name: r.leftIcon,
|
|
169
|
-
class: "maz-text-xl maz-text-muted"
|
|
170
|
-
}, null, 8, ["name"])) : r.leftIcon ? (C(), K(Fe(r.leftIcon), {
|
|
171
|
-
key: 1,
|
|
172
|
-
class: "maz-text-xl maz-text-muted"
|
|
173
|
-
})) : V("v-if", !0)
|
|
174
|
-
], !0) : V("v-if", !0)
|
|
175
|
-
])) : V("v-if", !0),
|
|
176
|
-
R("div", go, [
|
|
177
|
-
Ne(R("input", pe({
|
|
178
|
-
id: b(d),
|
|
179
|
-
ref_key: "input",
|
|
180
|
-
ref: M,
|
|
181
|
-
"onUpdate:modelValue": L[0] || (L[0] = (Y) => N.value = Y),
|
|
182
|
-
type: y.value,
|
|
183
|
-
name: r.name
|
|
184
|
-
}, r.$attrs, {
|
|
185
|
-
inputmode: r.inputmode,
|
|
186
|
-
placeholder: $.value,
|
|
187
|
-
"aria-label": r.label || r.placeholder,
|
|
188
|
-
disabled: r.disabled,
|
|
189
|
-
readonly: r.readonly,
|
|
190
|
-
required: r.required,
|
|
191
|
-
class: "m-input-input"
|
|
192
|
-
}, no({
|
|
193
|
-
blur: me,
|
|
194
|
-
focus: fe,
|
|
195
|
-
change: j
|
|
196
|
-
}, !0), {
|
|
197
|
-
onClick: L[1] || (L[1] = (Y) => r.$emit("click", Y))
|
|
198
|
-
}), null, 16, zo), [
|
|
199
|
-
[ao, N.value]
|
|
200
|
-
]),
|
|
201
|
-
r.label || r.hint ? (C(), P(
|
|
202
|
-
"span",
|
|
203
|
-
{
|
|
204
|
-
key: 0,
|
|
205
|
-
ref: "label",
|
|
206
|
-
class: E(["m-input-label", [
|
|
207
|
-
{
|
|
208
|
-
"maz-text-danger-600": r.error,
|
|
209
|
-
"maz-text-success-600": r.success,
|
|
210
|
-
"maz-text-warning-600": r.warning
|
|
211
|
-
}
|
|
212
|
-
]])
|
|
213
|
-
},
|
|
214
|
-
[
|
|
215
|
-
Ce(
|
|
216
|
-
G(r.hint || r.label) + " ",
|
|
217
|
-
1
|
|
218
|
-
/* TEXT */
|
|
219
|
-
),
|
|
220
|
-
r.required ? (C(), P("sup", Co, "*")) : V("v-if", !0)
|
|
221
|
-
],
|
|
222
|
-
2
|
|
223
|
-
/* CLASS */
|
|
224
|
-
)) : V("v-if", !0)
|
|
225
|
-
]),
|
|
226
|
-
O() ? (C(), P("div", Vo, [
|
|
227
|
-
V(`
|
|
228
|
-
@slot right-icon - The icon to display on the right of the input
|
|
229
|
-
`),
|
|
230
|
-
r.$slots["right-icon"] || r.rightIcon ? H(r.$slots, "right-icon", { key: 0 }, () => [
|
|
231
|
-
typeof r.rightIcon == "string" ? (C(), K(b(c), {
|
|
232
|
-
key: 0,
|
|
233
|
-
name: r.rightIcon,
|
|
234
|
-
class: "maz-text-xl maz-text-muted"
|
|
235
|
-
}, null, 8, ["name"])) : r.rightIcon ? (C(), K(Fe(r.rightIcon), {
|
|
236
|
-
key: 1,
|
|
237
|
-
class: "maz-text-xl maz-text-muted"
|
|
238
|
-
})) : V("v-if", !0)
|
|
239
|
-
], !0) : V("v-if", !0),
|
|
240
|
-
g.value ? (C(), K(b(o), {
|
|
241
|
-
key: 1,
|
|
242
|
-
color: "transparent",
|
|
243
|
-
tabindex: "-1",
|
|
244
|
-
size: "mini",
|
|
245
|
-
onClick: L[2] || (L[2] = x((Y) => h.value = !h.value, ["stop"]))
|
|
246
|
-
}, {
|
|
247
|
-
default: ae(() => [
|
|
248
|
-
h.value ? (C(), K(b(m), {
|
|
249
|
-
key: 0,
|
|
250
|
-
class: "maz-text-xl maz-text-muted"
|
|
251
|
-
})) : (C(), K(b(f), {
|
|
252
|
-
key: 1,
|
|
253
|
-
class: "maz-text-xl maz-text-muted"
|
|
254
|
-
}))
|
|
255
|
-
]),
|
|
256
|
-
_: 1
|
|
257
|
-
/* STABLE */
|
|
258
|
-
})) : V("v-if", !0),
|
|
259
|
-
V(`
|
|
260
|
-
@slot valid-button - Replace the valid button by your own
|
|
261
|
-
`),
|
|
262
|
-
r.$slots["valid-button"] || r.validButton ? H(r.$slots, "valid-button", { key: 2 }, () => [
|
|
263
|
-
q(b(o), {
|
|
264
|
-
color: "transparent",
|
|
265
|
-
disabled: r.disabled,
|
|
266
|
-
tabindex: "-1",
|
|
267
|
-
loading: r.validButtonLoading,
|
|
268
|
-
class: "m-input-valid-button",
|
|
269
|
-
size: "mini",
|
|
270
|
-
type: "submit"
|
|
271
|
-
}, {
|
|
272
|
-
default: ae(() => [
|
|
273
|
-
q(b(n), { class: "maz-text-2xl maz-text-normal" })
|
|
274
|
-
]),
|
|
275
|
-
_: 1
|
|
276
|
-
/* STABLE */
|
|
277
|
-
}, 8, ["disabled", "loading"])
|
|
278
|
-
], !0) : V("v-if", !0)
|
|
279
|
-
])) : V("v-if", !0)
|
|
280
|
-
],
|
|
281
|
-
2
|
|
282
|
-
/* CLASS */
|
|
283
|
-
)
|
|
284
|
-
],
|
|
285
|
-
6
|
|
286
|
-
/* CLASS, STYLE */
|
|
287
|
-
));
|
|
288
|
-
}
|
|
289
|
-
}), se = (t, l) => {
|
|
290
|
-
const o = t.__vccOpts || t;
|
|
291
|
-
for (const [c, m] of l)
|
|
292
|
-
o[c] = m;
|
|
293
|
-
return o;
|
|
294
|
-
}, Ve = /* @__PURE__ */ se(wo, [["__scopeId", "data-v-78090be8"]]);
|
|
295
|
-
let be = null;
|
|
296
|
-
function ko(t, l) {
|
|
297
|
-
be && clearTimeout(be), be = setTimeout(t, l);
|
|
298
|
-
}
|
|
299
|
-
const ce = "__maz-click-outside__", De = () => document.ontouchstart === null ? "touchstart" : "click";
|
|
300
|
-
async function Ue(t, l) {
|
|
301
|
-
try {
|
|
302
|
-
Re(t);
|
|
303
|
-
const o = l.instance, c = l.value, m = typeof c == "function";
|
|
304
|
-
if (!m)
|
|
305
|
-
throw new Error("[maz-ui](vClickOutside) the callback should be a function");
|
|
306
|
-
await ee(), t[ce] = (n) => {
|
|
307
|
-
if ((!t || n.target && !t.contains(n.target)) && c && m)
|
|
308
|
-
return c.call(o, n);
|
|
309
|
-
};
|
|
310
|
-
const f = De();
|
|
311
|
-
document.addEventListener(f, t[ce], { passive: !0 });
|
|
312
|
-
} catch (o) {
|
|
313
|
-
console.error("[maz-ui](vClickOutside)", o);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
function Re(t) {
|
|
317
|
-
try {
|
|
318
|
-
const l = De();
|
|
319
|
-
document.removeEventListener(l, t[ce], !1), delete t[ce];
|
|
320
|
-
} catch (l) {
|
|
321
|
-
console.error("[maz-ui](vClickOutside)", l);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
function Io(t, l) {
|
|
325
|
-
try {
|
|
326
|
-
if (l.value === l.oldValue)
|
|
327
|
-
return;
|
|
328
|
-
Ue(t, l);
|
|
329
|
-
} catch (o) {
|
|
330
|
-
console.error("[maz-ui](vClickOutside)", o);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
const So = {
|
|
334
|
-
mounted: Ue,
|
|
335
|
-
updated: Io,
|
|
336
|
-
unmounted: Re
|
|
337
|
-
};
|
|
338
|
-
function Bo(t, l) {
|
|
339
|
-
const o = t.length, c = l.length, m = [];
|
|
340
|
-
for (let f = 0; f <= o; f++)
|
|
341
|
-
m[f] = [f];
|
|
342
|
-
for (let f = 0; f <= c; f++)
|
|
343
|
-
m[0][f] = f;
|
|
344
|
-
for (let f = 1; f <= o; f++)
|
|
345
|
-
for (let n = 1; n <= c; n++) {
|
|
346
|
-
const i = t[f - 1] === l[n - 1] ? 0 : 1;
|
|
347
|
-
m[f][n] = Math.min(
|
|
348
|
-
m[f - 1][n] + 1,
|
|
349
|
-
m[f][n - 1] + 1,
|
|
350
|
-
m[f - 1][n - 1] + i
|
|
351
|
-
);
|
|
352
|
-
}
|
|
353
|
-
return m[o][c];
|
|
354
|
-
}
|
|
355
|
-
function Me(t) {
|
|
356
|
-
return t.normalize("NFD").replaceAll(/[\u0300-\u036F]/g, "").toLowerCase();
|
|
357
|
-
}
|
|
358
|
-
function Oe(t, l) {
|
|
359
|
-
const o = Bo(t, l), c = Math.max(t.length, l.length);
|
|
360
|
-
return 1 - o / c;
|
|
361
|
-
}
|
|
362
|
-
function $o(t, l, o = 0.75) {
|
|
363
|
-
return Oe(t, l) >= o;
|
|
364
|
-
}
|
|
365
|
-
function ge(t, l, o = 0.75) {
|
|
366
|
-
const c = v(
|
|
367
|
-
() => Me(typeof t == "string" ? t : t.value)
|
|
368
|
-
), m = v(
|
|
369
|
-
() => Me(typeof l == "string" ? l : l.value)
|
|
370
|
-
), f = v(() => typeof o == "number" ? o : o.value), n = v(() => Oe(c.value, m.value));
|
|
371
|
-
return {
|
|
372
|
-
isMatching: v(
|
|
373
|
-
() => $o(c.value, m.value, f.value)
|
|
374
|
-
),
|
|
375
|
-
score: n
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
|
-
const Po = ["aria-label"], Fo = { class: "m-select-list__no-results" }, Ao = {
|
|
379
|
-
key: 2,
|
|
380
|
-
class: "m-select-list__scroll-wrapper",
|
|
381
|
-
tabindex: "-1"
|
|
382
|
-
}, Lo = { class: "m-select-list-optgroup" }, Mo = ["onClick"], Eo = /* @__PURE__ */ re({
|
|
383
|
-
inheritAttrs: !1,
|
|
384
|
-
__name: "MazSelect",
|
|
385
|
-
props: {
|
|
386
|
-
style: { default: void 0 },
|
|
387
|
-
class: { default: void 0 },
|
|
388
|
-
id: { default: void 0 },
|
|
389
|
-
modelValue: { type: [String, Number, null, Boolean, Array], default: void 0 },
|
|
390
|
-
options: { default: void 0 },
|
|
391
|
-
optionValueKey: { default: "value" },
|
|
392
|
-
optionLabelKey: { default: "label" },
|
|
393
|
-
optionInputValueKey: { default: "label" },
|
|
394
|
-
listPosition: { default: "bottom left" },
|
|
395
|
-
itemHeight: { default: void 0 },
|
|
396
|
-
maxListHeight: { default: 240 },
|
|
397
|
-
maxListWidth: { default: void 0 },
|
|
398
|
-
size: { default: "md" },
|
|
399
|
-
color: { default: "primary" },
|
|
400
|
-
search: { type: Boolean },
|
|
401
|
-
searchPlaceholder: { default: "Search in options" },
|
|
402
|
-
open: { type: Boolean },
|
|
403
|
-
multiple: { type: Boolean },
|
|
404
|
-
required: { type: Boolean },
|
|
405
|
-
disabled: { type: Boolean },
|
|
406
|
-
block: { type: Boolean }
|
|
407
|
-
},
|
|
408
|
-
emits: ["close", "open", "blur", "focus", "change", "update:model-value", "selected-option"],
|
|
409
|
-
setup(t, { emit: l }) {
|
|
410
|
-
ro((e) => ({
|
|
411
|
-
"4ce1fbd6": g.value,
|
|
412
|
-
"3d1b8a94": M.value,
|
|
413
|
-
"12d1f1fc": d.value
|
|
414
|
-
}));
|
|
415
|
-
const o = U(() => import("./MazCheckbox-CM7mucQa.mjs")), c = U(() => import("./magnifying-glass-DZGg7953.mjs")), m = U(() => import("./chevron-down-CzMH-gFW.mjs")), f = U(() => import("./no-symbol-QAqP9IlR.mjs")), n = t, i = l, k = I(!1), h = I(), B = v(
|
|
416
|
-
() => ["black", "transparent", "white"].includes(n.color)
|
|
417
|
-
), M = v(
|
|
418
|
-
() => B.value ? "var(--maz-color-black)" : `var(--maz-color-${n.color}-800)`
|
|
419
|
-
), d = v(
|
|
420
|
-
() => B.value ? "var(--maz-color-muted)" : `var(--maz-color-${n.color}-100)`
|
|
421
|
-
), g = v(
|
|
422
|
-
() => B.value ? "var(--maz-color-muted)" : `var(--maz-color-${n.color}-200)`
|
|
423
|
-
), y = v(() => k.value || n.open), F = ke({
|
|
424
|
-
componentName: "MazSelect",
|
|
425
|
-
providedId: n.id
|
|
426
|
-
});
|
|
427
|
-
function z(e) {
|
|
428
|
-
return {
|
|
429
|
-
[n.optionValueKey]: e,
|
|
430
|
-
[n.optionLabelKey]: e,
|
|
431
|
-
[n.optionInputValueKey]: e
|
|
432
|
-
};
|
|
433
|
-
}
|
|
434
|
-
function $(e) {
|
|
435
|
-
return {
|
|
436
|
-
...e,
|
|
437
|
-
[n.optionValueKey]: e[n.optionValueKey],
|
|
438
|
-
[n.optionLabelKey]: e[n.optionLabelKey],
|
|
439
|
-
[n.optionInputValueKey]: e[n.optionInputValueKey]
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
const a = v(() => {
|
|
443
|
-
var s;
|
|
444
|
-
const e = [];
|
|
445
|
-
if (!((s = n.options) != null && s.length))
|
|
446
|
-
return [];
|
|
447
|
-
for (const u of n.options)
|
|
448
|
-
typeof u == "string" || typeof u == "number" || typeof u == "boolean" ? e.push(z(u)) : "options" in u && Array.isArray(u.options) ? e.push(
|
|
449
|
-
{ label: u.label, isOptGroup: !0 },
|
|
450
|
-
...u.options.map(
|
|
451
|
-
(p) => typeof p == "string" || typeof p == "number" || typeof p == "boolean" ? z(p) : $(p)
|
|
452
|
-
)
|
|
453
|
-
) : e.push($(u));
|
|
454
|
-
return e;
|
|
455
|
-
}), S = v(
|
|
456
|
-
() => {
|
|
457
|
-
var e;
|
|
458
|
-
return ((e = a.value) == null ? void 0 : e.filter((s) => n.multiple ? Array.isArray(n.modelValue) ? n.modelValue.includes(s[n.optionValueKey]) && !O(s[n.optionValueKey]) : !1 : n.modelValue === s[n.optionValueKey] && !O(s[n.optionValueKey]))) ?? [];
|
|
459
|
-
}
|
|
460
|
-
);
|
|
461
|
-
so(() => {
|
|
462
|
-
var e;
|
|
463
|
-
(e = n.options) != null && e.length || console.warn("[maz-ui](MazSelect) you must provide options"), ve();
|
|
464
|
-
});
|
|
465
|
-
const Z = I(), N = I(), ue = I(), ie = I(), O = (e) => e == null;
|
|
466
|
-
function te(e) {
|
|
467
|
-
var u;
|
|
468
|
-
return (((u = S.value) == null ? void 0 : u.some(
|
|
469
|
-
(p) => p[n.optionValueKey] === e[n.optionValueKey]
|
|
470
|
-
)) ?? !1) && !O(e[n.optionValueKey]);
|
|
471
|
-
}
|
|
472
|
-
const fe = v(() => {
|
|
473
|
-
var s;
|
|
474
|
-
if (n.multiple && n.modelValue && Array.isArray(n.modelValue))
|
|
475
|
-
return n.modelValue.map(
|
|
476
|
-
(u) => {
|
|
477
|
-
var p, w;
|
|
478
|
-
return (w = (p = a.value) == null ? void 0 : p.find((A) => A[n.optionValueKey] === u)) == null ? void 0 : w[n.optionInputValueKey];
|
|
479
|
-
}
|
|
480
|
-
).join(", ");
|
|
481
|
-
const e = (s = a.value) == null ? void 0 : s.find(
|
|
482
|
-
(u) => u[n.optionValueKey] === n.modelValue
|
|
483
|
-
);
|
|
484
|
-
return O(n.modelValue) || e == null ? void 0 : e[n.optionInputValueKey];
|
|
485
|
-
}), me = v(
|
|
486
|
-
() => n.listPosition.includes("bottom") ? "maz-slide" : "maz-slideinvert"
|
|
487
|
-
), j = I(""), r = I("");
|
|
488
|
-
function L(e) {
|
|
489
|
-
return e.normalize("NFD").replaceAll(/[\u0300-\u036F]/g, "").replaceAll(/[^\dA-Za-z\u0400-\u04FF]/g, "");
|
|
490
|
-
}
|
|
491
|
-
const Y = (e, s) => s && e && L(e.toString().toLocaleLowerCase().trim()).includes(
|
|
492
|
-
L(s.toLocaleLowerCase().trim())
|
|
493
|
-
);
|
|
494
|
-
function Se(e) {
|
|
495
|
-
var s;
|
|
496
|
-
return e ? (s = a.value) == null ? void 0 : s.filter((u) => {
|
|
497
|
-
const p = u[n.optionLabelKey], w = u[n.optionValueKey], A = u[n.optionInputValueKey];
|
|
498
|
-
return Y(p, e) || Y(A, e) || Y(w, e) || typeof p == "string" && ge(p, e).isMatching.value || typeof A == "string" && ge(A, e).isMatching.value || typeof w == "string" && ge(w, e).isMatching.value;
|
|
499
|
-
}) : a.value;
|
|
500
|
-
}
|
|
501
|
-
const T = v(() => Se(j.value));
|
|
502
|
-
async function le(e) {
|
|
503
|
-
var s;
|
|
504
|
-
if (y.value) {
|
|
505
|
-
if (e && ("relatedTarget" in e && ((s = Z.value) != null && s.contains(e.relatedTarget)) || e.type === "keydown"))
|
|
506
|
-
return e.preventDefault();
|
|
507
|
-
await ee(), k.value = !1, h.value = 0, i("close", e);
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
async function ne(e) {
|
|
511
|
-
n.disabled || y.value || (e == null || e.preventDefault(), k.value = !0, await ye(), i("focus", e), i("open", k.value));
|
|
512
|
-
}
|
|
513
|
-
function Be() {
|
|
514
|
-
var e, s;
|
|
515
|
-
(s = ((e = N.value) == null ? void 0 : e.$el).querySelector("input")) == null || s.focus();
|
|
516
|
-
}
|
|
517
|
-
function Ze(e) {
|
|
518
|
-
k.value ? le(e) : Be();
|
|
519
|
-
}
|
|
520
|
-
function Xe(e) {
|
|
521
|
-
var s, u;
|
|
522
|
-
j.value = e, (u = ((s = ue.value) == null ? void 0 : s.$el).querySelector("input")) == null || u.focus();
|
|
523
|
-
}
|
|
524
|
-
function xe(e) {
|
|
525
|
-
var u;
|
|
526
|
-
e === "Backspace" && r.value.length > 0 ? r.value = r.value.slice(0, -1) : r.value += e;
|
|
527
|
-
const s = Se(r.value);
|
|
528
|
-
s != null && s.length && (h.value = (u = T.value) == null ? void 0 : u.findIndex(
|
|
529
|
-
(p) => p[n.optionValueKey] === s[0][n.optionValueKey]
|
|
530
|
-
), typeof h.value == "number" && h.value >= 0 && ye(h.value)), ko(() => {
|
|
531
|
-
r.value = "";
|
|
532
|
-
}, 1e3);
|
|
533
|
-
}
|
|
534
|
-
const _e = (e) => {
|
|
535
|
-
const s = e.key;
|
|
536
|
-
/^[\dA-Za-z\u0400-\u04FF]$/.test(s) ? (e.preventDefault(), ne(e), n.search ? Xe(s) : xe(s)) : $e(e);
|
|
537
|
-
}, $e = (e) => {
|
|
538
|
-
const s = e.code, u = ["ArrowUp", "ArrowDown"].includes(s), p = ["Enter", "Space"].includes(s), w = s === "Escape" && y.value;
|
|
539
|
-
u ? eo(e, h.value) : p ? oo(e, h.value) : w && le();
|
|
540
|
-
}, eo = (e, s) => {
|
|
541
|
-
var w;
|
|
542
|
-
e.preventDefault();
|
|
543
|
-
const u = e.code;
|
|
544
|
-
y.value || ne(e);
|
|
545
|
-
const p = (w = T.value) == null ? void 0 : w.length;
|
|
546
|
-
p && (typeof s == "number" ? s === p - 1 && u === "ArrowDown" ? h.value = 0 : s === 0 && u === "ArrowUp" ? h.value = p - 1 : h.value = u === "ArrowDown" ? s + 1 : s - 1 : h.value = u === "ArrowDown" ? 0 : p - 1, ye(h.value));
|
|
547
|
-
}, oo = (e, s) => {
|
|
548
|
-
var p, w, A;
|
|
549
|
-
if (e.preventDefault(), !y.value)
|
|
550
|
-
return ne(e);
|
|
551
|
-
const u = s ? ((p = T.value) == null ? void 0 : p[s]) ?? ((w = T.value) == null ? void 0 : w[0]) : (A = T.value) == null ? void 0 : A[0];
|
|
552
|
-
O(u) || Pe(u);
|
|
553
|
-
};
|
|
554
|
-
async function ye(e) {
|
|
555
|
-
var u, p;
|
|
556
|
-
await ee(), typeof e != "number" && ve();
|
|
557
|
-
const s = e ?? h.value;
|
|
558
|
-
typeof s == "number" && s >= 0 && ((p = (u = ie.value) == null ? void 0 : u.querySelectorAll(".m-select-list-item")[s]) == null || p.scrollIntoView({
|
|
559
|
-
behavior: "auto",
|
|
560
|
-
block: "nearest",
|
|
561
|
-
inline: "start"
|
|
562
|
-
}));
|
|
563
|
-
}
|
|
564
|
-
function ve(e) {
|
|
565
|
-
var u;
|
|
566
|
-
const s = (u = T.value) == null ? void 0 : u.findIndex((p) => {
|
|
567
|
-
var w, A;
|
|
568
|
-
return n.multiple && Array.isArray(n.modelValue) ? e ? e[n.optionValueKey] === p[n.optionValueKey] : [...n.modelValue].reverse()[0] === p[n.optionValueKey] : ((A = (w = S.value) == null ? void 0 : w[0]) == null ? void 0 : A[n.optionValueKey]) === p[n.optionValueKey];
|
|
569
|
-
});
|
|
570
|
-
h.value = s && s >= 0 ? s : 0;
|
|
571
|
-
}
|
|
572
|
-
const Pe = (e, s = !0) => {
|
|
573
|
-
var A;
|
|
574
|
-
s && !n.multiple && ee(() => le()), j.value = "";
|
|
575
|
-
const u = (A = S.value) == null ? void 0 : A.some(
|
|
576
|
-
(X) => X[n.optionValueKey] === e[n.optionValueKey]
|
|
577
|
-
);
|
|
578
|
-
let p = S.value;
|
|
579
|
-
u && n.multiple ? p = p == null ? void 0 : p.filter(
|
|
580
|
-
(X) => X[n.optionValueKey] !== e[n.optionValueKey]
|
|
581
|
-
) : n.multiple ? p.push(e) : p = [e];
|
|
582
|
-
const w = p.map((X) => X[n.optionValueKey]);
|
|
583
|
-
i("update:model-value", n.multiple ? w : w[0]), i("selected-option", e), ve(e), Be();
|
|
584
|
-
};
|
|
585
|
-
return (e, s) => Ne((C(), P(
|
|
586
|
-
"div",
|
|
587
|
-
{
|
|
588
|
-
ref_key: "mazSelectElement",
|
|
589
|
-
ref: Z,
|
|
590
|
-
class: E(["m-select", [
|
|
591
|
-
{ "--is-open": y.value, "--disabled": e.disabled, "--block": e.block },
|
|
592
|
-
n.class,
|
|
593
|
-
`--${e.size}`
|
|
594
|
-
]]),
|
|
595
|
-
style: _(e.style)
|
|
596
|
-
},
|
|
597
|
-
[
|
|
598
|
-
q(Ve, pe({
|
|
599
|
-
id: b(F),
|
|
600
|
-
ref_key: "mazInputComponent",
|
|
601
|
-
ref: N,
|
|
602
|
-
class: "m-select-input"
|
|
603
|
-
}, e.$attrs, {
|
|
604
|
-
required: e.required,
|
|
605
|
-
"border-active": k.value,
|
|
606
|
-
color: e.color,
|
|
607
|
-
"model-value": fe.value,
|
|
608
|
-
autocomplete: "off",
|
|
609
|
-
size: e.size,
|
|
610
|
-
block: "",
|
|
611
|
-
disabled: e.disabled,
|
|
612
|
-
onFocus: x(ne, ["prevent", "stop"]),
|
|
613
|
-
onClick: x(ne, ["prevent", "stop"]),
|
|
614
|
-
onBlur: x(le, ["prevent", "stop"]),
|
|
615
|
-
onChange: s[0] || (s[0] = (u) => i("change", u)),
|
|
616
|
-
onKeydown: _e
|
|
617
|
-
}), {
|
|
618
|
-
"right-icon": ae(() => [
|
|
619
|
-
R("button", {
|
|
620
|
-
tabindex: "-1",
|
|
621
|
-
type: "button",
|
|
622
|
-
class: "m-select-input__toggle-button maz-custom",
|
|
623
|
-
"aria-label": `${y.value ? "collapse" : "expand"} list of options`,
|
|
624
|
-
onClick: x(Ze, ["stop"])
|
|
625
|
-
}, [
|
|
626
|
-
q(b(m), { class: "m-select-chevron maz-text-xl" })
|
|
627
|
-
], 8, Po)
|
|
628
|
-
]),
|
|
629
|
-
_: 1
|
|
630
|
-
/* STABLE */
|
|
631
|
-
}, 16, ["id", "required", "border-active", "color", "model-value", "size", "disabled"]),
|
|
632
|
-
q(uo, { name: me.value }, {
|
|
633
|
-
default: ae(() => [
|
|
634
|
-
y.value ? (C(), P(
|
|
635
|
-
"div",
|
|
636
|
-
{
|
|
637
|
-
key: 0,
|
|
638
|
-
ref_key: "optionsListElement",
|
|
639
|
-
ref: ie,
|
|
640
|
-
class: E(["m-select-list", {
|
|
641
|
-
"--top": e.listPosition.includes("top"),
|
|
642
|
-
"--left": e.listPosition.includes("left"),
|
|
643
|
-
"--right": e.listPosition.includes("right"),
|
|
644
|
-
"--bottom": e.listPosition.includes("bottom")
|
|
645
|
-
}]),
|
|
646
|
-
style: _({
|
|
647
|
-
maxHeight: `${e.maxListHeight}px`,
|
|
648
|
-
maxWidth: `${e.maxListWidth}px`
|
|
649
|
-
})
|
|
650
|
-
},
|
|
651
|
-
[
|
|
652
|
-
e.search ? (C(), K(Ve, {
|
|
653
|
-
key: 0,
|
|
654
|
-
ref_key: "searchInputComponent",
|
|
655
|
-
ref: ue,
|
|
656
|
-
modelValue: j.value,
|
|
657
|
-
"onUpdate:modelValue": [
|
|
658
|
-
s[1] || (s[1] = (u) => j.value = u),
|
|
659
|
-
s[2] || (s[2] = (u) => h.value = 0)
|
|
660
|
-
],
|
|
661
|
-
size: "sm",
|
|
662
|
-
color: e.color,
|
|
663
|
-
placeholder: e.searchPlaceholder,
|
|
664
|
-
name: "search",
|
|
665
|
-
autocomplete: "off",
|
|
666
|
-
tabindex: "-1",
|
|
667
|
-
class: "m-select-list__search-input maz-flex-none",
|
|
668
|
-
"left-icon": b(c),
|
|
669
|
-
onKeydown: $e
|
|
670
|
-
}, null, 8, ["modelValue", "color", "placeholder", "left-icon"])) : V("v-if", !0),
|
|
671
|
-
V(`
|
|
672
|
-
@slot No results slot - Displayed when no results corresponding with search query
|
|
673
|
-
`),
|
|
674
|
-
!T.value || T.value.length <= 0 ? H(e.$slots, "no-results", { key: 1 }, () => [
|
|
675
|
-
R("span", Fo, [
|
|
676
|
-
q(b(f), { class: "maz-h-6 maz-w-6 maz-text-normal" })
|
|
677
|
-
])
|
|
678
|
-
], !0) : (C(), P("div", Ao, [
|
|
679
|
-
(C(!0), P(
|
|
680
|
-
Ae,
|
|
681
|
-
null,
|
|
682
|
-
io(T.value, (u, p) => (C(), P(
|
|
683
|
-
Ae,
|
|
684
|
-
{ key: p },
|
|
685
|
-
[
|
|
686
|
-
V(`
|
|
687
|
-
@slot Custom optgroup label
|
|
688
|
-
@binding {String} label - the label of the optgroup
|
|
689
|
-
`),
|
|
690
|
-
u.label && u.isOptGroup ? H(e.$slots, "optgroup", {
|
|
691
|
-
key: 0,
|
|
692
|
-
label: u.label
|
|
693
|
-
}, () => [
|
|
694
|
-
R(
|
|
695
|
-
"span",
|
|
696
|
-
Lo,
|
|
697
|
-
G(u.label),
|
|
698
|
-
1
|
|
699
|
-
/* TEXT */
|
|
700
|
-
)
|
|
701
|
-
], !0) : (C(), P("button", {
|
|
702
|
-
key: 1,
|
|
703
|
-
tabindex: "-1",
|
|
704
|
-
type: "button",
|
|
705
|
-
class: E(["m-select-list-item maz-custom maz-flex-none", [
|
|
706
|
-
{
|
|
707
|
-
"--is-keyboard-selected": h.value === p,
|
|
708
|
-
"--is-selected": te(u),
|
|
709
|
-
"--is-none-value": O(u[e.optionValueKey])
|
|
710
|
-
}
|
|
711
|
-
]]),
|
|
712
|
-
style: _(e.itemHeight ? { height: `${e.itemHeight}px` } : void 0),
|
|
713
|
-
onClick: x((w) => Pe(u), ["prevent", "stop"])
|
|
714
|
-
}, [
|
|
715
|
-
e.multiple ? (C(), K(b(o), {
|
|
716
|
-
key: 0,
|
|
717
|
-
tabindex: "-1",
|
|
718
|
-
"model-value": te(u),
|
|
719
|
-
size: "sm",
|
|
720
|
-
color: e.color
|
|
721
|
-
}, null, 8, ["model-value", "color"])) : V("v-if", !0),
|
|
722
|
-
V(`
|
|
723
|
-
@slot Custom option
|
|
724
|
-
@binding {Object} option - the option object
|
|
725
|
-
@binding {Boolean} is-selected - if the option is selected
|
|
726
|
-
`),
|
|
727
|
-
H(e.$slots, "default", {
|
|
728
|
-
option: u,
|
|
729
|
-
isSelected: te(u)
|
|
730
|
-
}, () => [
|
|
731
|
-
R(
|
|
732
|
-
"span",
|
|
733
|
-
null,
|
|
734
|
-
G(u[e.optionLabelKey]),
|
|
735
|
-
1
|
|
736
|
-
/* TEXT */
|
|
737
|
-
)
|
|
738
|
-
], !0)
|
|
739
|
-
], 14, Mo))
|
|
740
|
-
],
|
|
741
|
-
64
|
|
742
|
-
/* STABLE_FRAGMENT */
|
|
743
|
-
))),
|
|
744
|
-
128
|
|
745
|
-
/* KEYED_FRAGMENT */
|
|
746
|
-
))
|
|
747
|
-
]))
|
|
748
|
-
],
|
|
749
|
-
6
|
|
750
|
-
/* CLASS, STYLE */
|
|
751
|
-
)) : V("v-if", !0)
|
|
752
|
-
]),
|
|
753
|
-
_: 3
|
|
754
|
-
/* FORWARDED */
|
|
755
|
-
}, 8, ["name"])
|
|
756
|
-
],
|
|
757
|
-
6
|
|
758
|
-
/* CLASS, STYLE */
|
|
759
|
-
)), [
|
|
760
|
-
[b(So), le]
|
|
761
|
-
]);
|
|
762
|
-
}
|
|
763
|
-
}), Ko = /* @__PURE__ */ se(Eo, [["__scopeId", "data-v-7a4ba989"]]);
|
|
764
|
-
function Ye(t) {
|
|
765
|
-
return !!t;
|
|
766
|
-
}
|
|
767
|
-
function Ee(t) {
|
|
768
|
-
return [...t].map((l) => {
|
|
769
|
-
const o = l.codePointAt(0);
|
|
770
|
-
return o ? o % 32 + 127461 : void 0;
|
|
771
|
-
}).filter(Ye).map((l) => String.fromCodePoint(l)).join("");
|
|
772
|
-
}
|
|
773
|
-
const J = I();
|
|
774
|
-
async function No() {
|
|
775
|
-
if (J.value)
|
|
776
|
-
return J.value;
|
|
777
|
-
const { default: t } = await import("./examples.mobile.json-zD8w3Qhl.mjs");
|
|
778
|
-
return J.value = t, J.value;
|
|
779
|
-
}
|
|
780
|
-
function To(t, l) {
|
|
781
|
-
return de(t) === de(l);
|
|
782
|
-
}
|
|
783
|
-
function Do(t) {
|
|
784
|
-
var l;
|
|
785
|
-
try {
|
|
786
|
-
return J.value && t ? (l = fo(t, J.value)) == null ? void 0 : l.formatNational() : void 0;
|
|
787
|
-
} catch (o) {
|
|
788
|
-
console.error(`[maz-ui](MazPhoneNumberInput) ${o}`);
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
function Uo(t) {
|
|
792
|
-
try {
|
|
793
|
-
const l = mo(t);
|
|
794
|
-
return l || (console.error(`[maz-ui](MazPhoneNumberInput) The code country "${t}" is not available`), !1);
|
|
795
|
-
} catch (l) {
|
|
796
|
-
return console.error(`[maz-ui](MazPhoneNumberInput) ${l}`), !1;
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
function Ro({
|
|
800
|
-
phoneNumber: t,
|
|
801
|
-
countryCode: l
|
|
802
|
-
}) {
|
|
803
|
-
try {
|
|
804
|
-
if (!t)
|
|
805
|
-
return {
|
|
806
|
-
isValid: !1,
|
|
807
|
-
countryCode: l
|
|
808
|
-
};
|
|
809
|
-
const o = yo(t, l);
|
|
810
|
-
return {
|
|
811
|
-
countryCode: (o == null ? void 0 : o.country) ?? l,
|
|
812
|
-
isValid: (o == null ? void 0 : o.isValid()) ?? !1,
|
|
813
|
-
isPossible: o == null ? void 0 : o.isPossible(),
|
|
814
|
-
countryCallingCode: o == null ? void 0 : o.countryCallingCode,
|
|
815
|
-
nationalNumber: o == null ? void 0 : o.nationalNumber,
|
|
816
|
-
type: o == null ? void 0 : o.getType(),
|
|
817
|
-
formatInternational: o == null ? void 0 : o.formatInternational(),
|
|
818
|
-
formatNational: o == null ? void 0 : o.formatNational(),
|
|
819
|
-
uri: o == null ? void 0 : o.getURI(),
|
|
820
|
-
e164: o == null ? void 0 : o.format("E.164"),
|
|
821
|
-
rfc3966: o == null ? void 0 : o.format("RFC3966"),
|
|
822
|
-
phoneNumber: t
|
|
823
|
-
};
|
|
824
|
-
} catch (o) {
|
|
825
|
-
throw new Error(`[MazPhoneNumberInput](getResultsFromPhoneNumber) ${o}`);
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
function Oo(t, l) {
|
|
829
|
-
try {
|
|
830
|
-
return l ? new vo(t).input(l) : "";
|
|
831
|
-
} catch (o) {
|
|
832
|
-
throw new Error(`[MazPhoneNumberInput](getAsYouTypeFormat) ${o}`);
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
function qe() {
|
|
836
|
-
return {
|
|
837
|
-
examples: J,
|
|
838
|
-
getAsYouTypeFormat: Oo,
|
|
839
|
-
getPhoneNumberResults: Ro,
|
|
840
|
-
loadPhoneNumberExamplesFile: No,
|
|
841
|
-
getPhoneNumberExample: Do,
|
|
842
|
-
isSameCountryCallingCode: To,
|
|
843
|
-
isCountryAvailable: Uo,
|
|
844
|
-
getCountries: Te,
|
|
845
|
-
getCountryCallingCode: de
|
|
846
|
-
};
|
|
847
|
-
}
|
|
848
|
-
const { isCountryAvailable: Yo, getPhoneNumberResults: He, getAsYouTypeFormat: qo } = qe(), oe = I(""), W = I(), Q = co({
|
|
849
|
-
start: 0,
|
|
850
|
-
end: 0,
|
|
851
|
-
cursorAtEnd: !0
|
|
852
|
-
}), D = I({
|
|
853
|
-
isValid: !1,
|
|
854
|
-
countryCode: void 0
|
|
855
|
-
});
|
|
856
|
-
async function Ho() {
|
|
857
|
-
try {
|
|
858
|
-
const t = await fetch("https://ipwho.is"), { country_code: l } = await t.json();
|
|
859
|
-
return l;
|
|
860
|
-
} catch (t) {
|
|
861
|
-
throw new Error(`[MazPhoneNumberInput](fetchCountryCode) ${t}`);
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
function We(t) {
|
|
865
|
-
if (!t)
|
|
866
|
-
return "";
|
|
867
|
-
const l = new RegExp(/[^\d ()+-]/g);
|
|
868
|
-
return t.replaceAll(l, "").trim();
|
|
869
|
-
}
|
|
870
|
-
function Wo(t, l) {
|
|
871
|
-
const o = t == null ? void 0 : t.$el.querySelector("input");
|
|
872
|
-
Q.start = o == null ? void 0 : o.selectionStart, Q.end = o == null ? void 0 : o.selectionEnd, Q.cursorAtEnd = l && typeof Q.start == "number" && l.length > 0 ? Q.start >= l.length : !0;
|
|
873
|
-
}
|
|
874
|
-
function je(t) {
|
|
875
|
-
if (t) {
|
|
876
|
-
if (!Yo(t)) {
|
|
877
|
-
W.value = void 0;
|
|
878
|
-
return;
|
|
879
|
-
}
|
|
880
|
-
W.value = t;
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
function Qe({
|
|
884
|
-
newPhoneNumber: t,
|
|
885
|
-
autoFormat: l,
|
|
886
|
-
noFormattingAsYouType: o,
|
|
887
|
-
updateResults: c = !0
|
|
888
|
-
}) {
|
|
889
|
-
const m = We(t);
|
|
890
|
-
if (c && (D.value = He({
|
|
891
|
-
phoneNumber: m,
|
|
892
|
-
countryCode: W.value
|
|
893
|
-
})), D.value.isValid && D.value.formatNational && l)
|
|
894
|
-
oe.value = D.value.formatNational;
|
|
895
|
-
else if (Q.cursorAtEnd && !o) {
|
|
896
|
-
const f = qo(W.value, m);
|
|
897
|
-
oe.value = f;
|
|
898
|
-
} else
|
|
899
|
-
oe.value = m;
|
|
900
|
-
D.value.countryCode && D.value.countryCode !== W.value && Ge({
|
|
901
|
-
countryCode: D.value.countryCode,
|
|
902
|
-
autoFormat: l,
|
|
903
|
-
noFormattingAsYouType: o,
|
|
904
|
-
updateResults: !1
|
|
905
|
-
});
|
|
906
|
-
}
|
|
907
|
-
function Ge({
|
|
908
|
-
countryCode: t,
|
|
909
|
-
autoFormat: l,
|
|
910
|
-
noFormattingAsYouType: o,
|
|
911
|
-
updateResults: c = !0
|
|
912
|
-
}) {
|
|
913
|
-
if (!t) {
|
|
914
|
-
W.value = void 0;
|
|
915
|
-
return;
|
|
916
|
-
}
|
|
917
|
-
t !== W.value && je(t), c && (D.value = He({
|
|
918
|
-
phoneNumber: oe.value,
|
|
919
|
-
countryCode: t
|
|
920
|
-
})), Qe({
|
|
921
|
-
newPhoneNumber: oe.value,
|
|
922
|
-
autoFormat: l,
|
|
923
|
-
noFormattingAsYouType: o,
|
|
924
|
-
updateResults: !1
|
|
925
|
-
});
|
|
926
|
-
}
|
|
927
|
-
function Je() {
|
|
928
|
-
if (typeof window > "u")
|
|
929
|
-
return;
|
|
930
|
-
const t = window.navigator.language;
|
|
931
|
-
if (!t)
|
|
932
|
-
return;
|
|
933
|
-
let l = t.slice(3, 7).toUpperCase();
|
|
934
|
-
return l === "" && (l = t.slice(0, 2).toUpperCase()), l === "EN" && (l = "US"), l === "JA" && (l = "JP"), {
|
|
935
|
-
locale: l,
|
|
936
|
-
browserLocale: t
|
|
937
|
-
};
|
|
938
|
-
}
|
|
939
|
-
let ze, Ke;
|
|
940
|
-
function jo(t, l, o) {
|
|
941
|
-
return o != null && o[l] ? o[l] : ((Ke !== t || !ze) && (Ke = t, ze = new Intl.DisplayNames([t], { type: "region" })), ze.of(l));
|
|
942
|
-
}
|
|
943
|
-
function Qo(t, l) {
|
|
944
|
-
var m;
|
|
945
|
-
const o = [], c = Te();
|
|
946
|
-
t = t ?? ((m = Je()) == null ? void 0 : m.browserLocale) ?? "en-US";
|
|
947
|
-
for (const f of c) {
|
|
948
|
-
const n = jo(t, f, l);
|
|
949
|
-
if (n)
|
|
950
|
-
try {
|
|
951
|
-
const i = de(f);
|
|
952
|
-
o.push({
|
|
953
|
-
iso2: f,
|
|
954
|
-
dialCode: i,
|
|
955
|
-
name: n
|
|
956
|
-
});
|
|
957
|
-
} catch (i) {
|
|
958
|
-
console.error(`[MazPhoneNumberInput](getCountryCallingCode) ${i}`);
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
return o;
|
|
962
|
-
}
|
|
963
|
-
function Ie() {
|
|
964
|
-
return {
|
|
965
|
-
setSelectedCountry: je,
|
|
966
|
-
results: D,
|
|
967
|
-
sanitizePhoneNumber: We,
|
|
968
|
-
fetchCountryCode: Ho,
|
|
969
|
-
selectedCountry: W,
|
|
970
|
-
phoneNumber: oe,
|
|
971
|
-
selectionRange: Q,
|
|
972
|
-
saveCursorPosition: Wo,
|
|
973
|
-
onPhoneNumberChanged: Qe,
|
|
974
|
-
onCountryChanged: Ge,
|
|
975
|
-
getBrowserLocale: Je,
|
|
976
|
-
getCountriesList: Qo
|
|
977
|
-
};
|
|
978
|
-
}
|
|
979
|
-
const Go = {
|
|
980
|
-
key: 0,
|
|
981
|
-
class: "maz-text-lg"
|
|
982
|
-
}, Jo = /* @__PURE__ */ re({
|
|
983
|
-
__name: "CountrySelector",
|
|
984
|
-
props: {
|
|
985
|
-
style: { default: void 0 },
|
|
986
|
-
class: { default: void 0 },
|
|
987
|
-
modelValue: { default: void 0 },
|
|
988
|
-
id: {},
|
|
989
|
-
color: {},
|
|
990
|
-
size: {},
|
|
991
|
-
preferredCountries: { default: void 0 },
|
|
992
|
-
ignoredCountries: { default: void 0 },
|
|
993
|
-
onlyCountries: { default: void 0 },
|
|
994
|
-
customCountriesList: { default: void 0 },
|
|
995
|
-
locales: {},
|
|
996
|
-
listPosition: { default: "bottom left" },
|
|
997
|
-
noFlags: { type: Boolean },
|
|
998
|
-
noSearch: { type: Boolean },
|
|
999
|
-
disabled: { type: Boolean },
|
|
1000
|
-
showCodeOnList: { type: Boolean },
|
|
1001
|
-
countryLocale: { default: void 0 },
|
|
1002
|
-
success: { type: Boolean },
|
|
1003
|
-
error: { type: Boolean },
|
|
1004
|
-
countrySelectorDisplayName: { type: Boolean },
|
|
1005
|
-
width: { default: "9rem" }
|
|
1006
|
-
},
|
|
1007
|
-
emits: ["update:model-value"],
|
|
1008
|
-
setup(t) {
|
|
1009
|
-
const l = t, o = I(), { phoneNumber: c, getCountriesList: m } = Ie(), f = v(() => m(l.countryLocale, l.customCountriesList)), n = v(() => {
|
|
1010
|
-
var d;
|
|
1011
|
-
return (d = f.value) == null ? void 0 : d.filter((g) => {
|
|
1012
|
-
var y;
|
|
1013
|
-
return !((y = l.ignoredCountries) != null && y.includes(g.iso2));
|
|
1014
|
-
});
|
|
1015
|
-
}), i = v(() => {
|
|
1016
|
-
const d = l.onlyCountries || l.preferredCountries;
|
|
1017
|
-
return d == null ? void 0 : d.map(
|
|
1018
|
-
(g) => {
|
|
1019
|
-
var y;
|
|
1020
|
-
return (y = n.value) == null ? void 0 : y.find((F) => F.iso2.includes(g));
|
|
1021
|
-
}
|
|
1022
|
-
);
|
|
1023
|
-
}), k = v(() => {
|
|
1024
|
-
var d;
|
|
1025
|
-
return (d = n.value) == null ? void 0 : d.filter((g) => {
|
|
1026
|
-
var y;
|
|
1027
|
-
return !((y = l.preferredCountries) != null && y.includes(g.iso2));
|
|
1028
|
-
});
|
|
1029
|
-
}), h = v(() => l.preferredCountries ? [...i.value ?? [], ...k.value ?? []] : l.onlyCountries ? i.value : n.value), B = v(() => {
|
|
1030
|
-
var d;
|
|
1031
|
-
return (d = h.value) == null ? void 0 : d.map((g) => g ? {
|
|
1032
|
-
...g,
|
|
1033
|
-
dialCode: `+${g.dialCode}`
|
|
1034
|
-
} : void 0).filter(Ye);
|
|
1035
|
-
});
|
|
1036
|
-
function M() {
|
|
1037
|
-
var d, g;
|
|
1038
|
-
(g = (d = o.value) == null ? void 0 : d.$el.querySelector("input")) == null || g.focus();
|
|
1039
|
-
}
|
|
1040
|
-
return (d, g) => (C(), P(
|
|
1041
|
-
"div",
|
|
1042
|
-
{
|
|
1043
|
-
class: E(["m-country-selector", [l.class, { "--no-flags": d.noFlags }]]),
|
|
1044
|
-
style: _(d.style)
|
|
1045
|
-
},
|
|
1046
|
-
[
|
|
1047
|
-
d.modelValue && !d.noFlags ? (C(), P(
|
|
1048
|
-
"button",
|
|
1049
|
-
{
|
|
1050
|
-
key: 0,
|
|
1051
|
-
class: E(["m-country-selector__country-flag maz-text-xl", {
|
|
1052
|
-
"--should-have-bottom-flag": d.locales.countrySelector.placeholder.length > 0
|
|
1053
|
-
}]),
|
|
1054
|
-
tabindex: "-1",
|
|
1055
|
-
type: "button",
|
|
1056
|
-
onClick: M
|
|
1057
|
-
},
|
|
1058
|
-
[
|
|
1059
|
-
V(`
|
|
1060
|
-
@slot Country selector flag
|
|
1061
|
-
@binding {String} country-code - current selected country code - Ex: \`"FR"\`
|
|
1062
|
-
`),
|
|
1063
|
-
H(d.$slots, "selector-flag", { countryCode: d.modelValue }, () => [
|
|
1064
|
-
Ce(
|
|
1065
|
-
G(b(Ee)(d.modelValue)),
|
|
1066
|
-
1
|
|
1067
|
-
/* TEXT */
|
|
1068
|
-
)
|
|
1069
|
-
], !0)
|
|
1070
|
-
],
|
|
1071
|
-
2
|
|
1072
|
-
/* CLASS */
|
|
1073
|
-
)) : V("v-if", !0),
|
|
1074
|
-
q(Ko, pe({
|
|
1075
|
-
id: `country-selector-${d.id}`,
|
|
1076
|
-
ref_key: "CountrySelectorRef",
|
|
1077
|
-
ref: o,
|
|
1078
|
-
"model-value": d.modelValue
|
|
1079
|
-
}, d.$attrs, {
|
|
1080
|
-
class: "m-country-selector__select",
|
|
1081
|
-
"option-value-key": "iso2",
|
|
1082
|
-
"option-label-key": "name",
|
|
1083
|
-
"option-input-value-key": d.countrySelectorDisplayName ? "name" : "dialCode",
|
|
1084
|
-
"max-list-width": 250,
|
|
1085
|
-
disabled: d.disabled,
|
|
1086
|
-
color: d.color,
|
|
1087
|
-
size: d.size,
|
|
1088
|
-
error: d.error,
|
|
1089
|
-
"list-position": d.listPosition,
|
|
1090
|
-
"item-height": 38,
|
|
1091
|
-
success: d.success,
|
|
1092
|
-
search: !d.noSearch,
|
|
1093
|
-
"search-placeholder": d.locales.countrySelector.searchPlaceholder,
|
|
1094
|
-
options: B.value,
|
|
1095
|
-
hint: b(c) && !d.modelValue ? d.locales.countrySelector.error : void 0,
|
|
1096
|
-
label: d.locales.countrySelector.placeholder,
|
|
1097
|
-
style: {
|
|
1098
|
-
width: d.width
|
|
1099
|
-
},
|
|
1100
|
-
"onUpdate:modelValue": g[0] || (g[0] = (y) => d.$emit("update:model-value", y))
|
|
1101
|
-
}), {
|
|
1102
|
-
default: ae(({ option: y, isSelected: F }) => [
|
|
1103
|
-
R(
|
|
1104
|
-
"div",
|
|
1105
|
-
{
|
|
1106
|
-
class: E(["m-country-selector__select__item maz-flex maz-items-center maz-gap-1 maz-truncate", {
|
|
1107
|
-
"m-country-selector__select__item--selected": F
|
|
1108
|
-
}])
|
|
1109
|
-
},
|
|
1110
|
-
[
|
|
1111
|
-
!d.noFlags && typeof y.iso2 == "string" ? (C(), P("span", Go, [
|
|
1112
|
-
V(`
|
|
1113
|
-
@slot Country list flag
|
|
1114
|
-
@binding {String} country-code - country code of option - Ex: \`"FR"\`
|
|
1115
|
-
@binding {{ iso2: string; dialCode: string; name: string; }} option - country data
|
|
1116
|
-
@binding {Boolean} is-selected - \`true\` if option is selected
|
|
1117
|
-
`),
|
|
1118
|
-
H(d.$slots, "country-list-flag", {
|
|
1119
|
-
countryCode: y.iso2,
|
|
1120
|
-
option: y,
|
|
1121
|
-
isSelected: F
|
|
1122
|
-
}, () => [
|
|
1123
|
-
Ce(
|
|
1124
|
-
G(b(Ee)(y.iso2)),
|
|
1125
|
-
1
|
|
1126
|
-
/* TEXT */
|
|
1127
|
-
)
|
|
1128
|
-
], !0)
|
|
1129
|
-
])) : V("v-if", !0),
|
|
1130
|
-
d.showCodeOnList ? (C(), P(
|
|
1131
|
-
"span",
|
|
1132
|
-
{
|
|
1133
|
-
key: 1,
|
|
1134
|
-
class: E(["maz-w-9 maz-flex-none", { "maz-text-muted": !F }])
|
|
1135
|
-
},
|
|
1136
|
-
G(y.dialCode),
|
|
1137
|
-
3
|
|
1138
|
-
/* TEXT, CLASS */
|
|
1139
|
-
)) : V("v-if", !0),
|
|
1140
|
-
R(
|
|
1141
|
-
"span",
|
|
1142
|
-
{
|
|
1143
|
-
class: E(["maz-flex-1 maz-truncate", { "maz-font-semibold": F }])
|
|
1144
|
-
},
|
|
1145
|
-
G(y.name),
|
|
1146
|
-
3
|
|
1147
|
-
/* TEXT, CLASS */
|
|
1148
|
-
)
|
|
1149
|
-
],
|
|
1150
|
-
2
|
|
1151
|
-
/* CLASS */
|
|
1152
|
-
)
|
|
1153
|
-
]),
|
|
1154
|
-
_: 3
|
|
1155
|
-
/* FORWARDED */
|
|
1156
|
-
}, 16, ["id", "model-value", "option-input-value-key", "disabled", "color", "size", "error", "list-position", "success", "search", "search-placeholder", "options", "hint", "label", "style"])
|
|
1157
|
-
],
|
|
1158
|
-
6
|
|
1159
|
-
/* CLASS, STYLE */
|
|
1160
|
-
));
|
|
1161
|
-
}
|
|
1162
|
-
}), Zo = /* @__PURE__ */ se(Jo, [["__scopeId", "data-v-e21defba"]]), Xo = /* @__PURE__ */ re({
|
|
1163
|
-
__name: "PhoneInput",
|
|
1164
|
-
props: /* @__PURE__ */ Le({
|
|
1165
|
-
id: {},
|
|
1166
|
-
color: {},
|
|
1167
|
-
size: {},
|
|
1168
|
-
locales: {},
|
|
1169
|
-
label: { default: void 0 },
|
|
1170
|
-
noExample: { type: Boolean },
|
|
1171
|
-
disabled: { type: Boolean },
|
|
1172
|
-
hasRadius: { type: Boolean },
|
|
1173
|
-
success: { type: Boolean },
|
|
1174
|
-
error: { type: Boolean },
|
|
1175
|
-
autoFormat: { type: Boolean },
|
|
1176
|
-
noFormattingAsYouType: { type: Boolean }
|
|
1177
|
-
}, {
|
|
1178
|
-
modelValue: {},
|
|
1179
|
-
modelModifiers: {}
|
|
1180
|
-
}),
|
|
1181
|
-
emits: /* @__PURE__ */ Le(["update:model-value"], ["update:modelValue"]),
|
|
1182
|
-
setup(t, { emit: l }) {
|
|
1183
|
-
const o = t, c = l, m = po(t, "modelValue"), { loadPhoneNumberExamplesFile: f, getPhoneNumberExample: n, examples: i } = qe(), { selectedCountry: k, results: h, saveCursorPosition: B } = Ie(), M = I(!1), d = v(() => {
|
|
1184
|
-
var $;
|
|
1185
|
-
if (o.label)
|
|
1186
|
-
return o.label;
|
|
1187
|
-
const z = o.locales.phoneInput.placeholder;
|
|
1188
|
-
if (o.noExample || !i.value)
|
|
1189
|
-
return z;
|
|
1190
|
-
{
|
|
1191
|
-
const a = n(k.value);
|
|
1192
|
-
return ($ = h.value) != null && $.isValid || !a ? z : `${o.locales.phoneInput.example} ${a}`;
|
|
1193
|
-
}
|
|
1194
|
-
}), g = I();
|
|
1195
|
-
async function y() {
|
|
1196
|
-
try {
|
|
1197
|
-
return f();
|
|
1198
|
-
} catch (z) {
|
|
1199
|
-
console.error("[maz-ui](MazPhoneNumberInput) while loading phone number examples file", z);
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
async function F(z) {
|
|
1203
|
-
g.value && z && B(g.value, z), await ee(), c("update:model-value", z);
|
|
1204
|
-
}
|
|
1205
|
-
return we(() => {
|
|
1206
|
-
o.noExample || y();
|
|
1207
|
-
}), (z, $) => (C(), K(Ve, pe({
|
|
1208
|
-
id: `phone-number-${z.id}`,
|
|
1209
|
-
ref_key: "PhoneInputRef",
|
|
1210
|
-
ref: g,
|
|
1211
|
-
"model-value": m.value
|
|
1212
|
-
}, z.$attrs, {
|
|
1213
|
-
label: d.value,
|
|
1214
|
-
disabled: z.disabled,
|
|
1215
|
-
color: z.color,
|
|
1216
|
-
error: z.error,
|
|
1217
|
-
size: z.size,
|
|
1218
|
-
success: z.success,
|
|
1219
|
-
type: "tel",
|
|
1220
|
-
inputmode: "tel",
|
|
1221
|
-
class: ["m-phone-input", {
|
|
1222
|
-
"--border-radius": z.hasRadius,
|
|
1223
|
-
"--error": z.error || !b(h).isValid,
|
|
1224
|
-
"--focused": M.value
|
|
1225
|
-
}],
|
|
1226
|
-
onFocus: $[0] || ($[0] = (a) => M.value = !0),
|
|
1227
|
-
onBlur: $[1] || ($[1] = (a) => M.value = !1),
|
|
1228
|
-
"onUpdate:modelValue": $[2] || ($[2] = (a) => F(a))
|
|
1229
|
-
}), null, 16, ["id", "model-value", "label", "disabled", "color", "error", "size", "success", "class"]));
|
|
1230
|
-
}
|
|
1231
|
-
}), xo = /* @__PURE__ */ se(Xo, [["__scopeId", "data-v-e2bf70df"]]), _o = {
|
|
1232
|
-
countrySelector: {
|
|
1233
|
-
placeholder: "Country code",
|
|
1234
|
-
error: "Choose country",
|
|
1235
|
-
searchPlaceholder: "Search the country"
|
|
1236
|
-
},
|
|
1237
|
-
phoneInput: {
|
|
1238
|
-
placeholder: "Phone number",
|
|
1239
|
-
example: "Example:"
|
|
1240
|
-
}
|
|
1241
|
-
}, et = /* @__PURE__ */ re({
|
|
1242
|
-
inheritAttrs: !1,
|
|
1243
|
-
__name: "MazPhoneNumberInput",
|
|
1244
|
-
props: {
|
|
1245
|
-
style: { default: void 0 },
|
|
1246
|
-
class: { default: void 0 },
|
|
1247
|
-
modelValue: { default: void 0 },
|
|
1248
|
-
defaultPhoneNumber: { default: void 0 },
|
|
1249
|
-
countryCode: { default: void 0 },
|
|
1250
|
-
defaultCountryCode: { default: void 0 },
|
|
1251
|
-
id: { default: void 0 },
|
|
1252
|
-
placeholder: { default: void 0 },
|
|
1253
|
-
preferredCountries: { default: void 0 },
|
|
1254
|
-
ignoredCountries: { default: void 0 },
|
|
1255
|
-
onlyCountries: { default: void 0 },
|
|
1256
|
-
translations: { default: void 0 },
|
|
1257
|
-
listPosition: { default: "bottom left" },
|
|
1258
|
-
color: { default: "primary" },
|
|
1259
|
-
size: { default: "md" },
|
|
1260
|
-
noFlags: { type: Boolean },
|
|
1261
|
-
disabled: { type: Boolean },
|
|
1262
|
-
noExample: { type: Boolean },
|
|
1263
|
-
noSearch: { type: Boolean },
|
|
1264
|
-
noUseBrowserLocale: { type: Boolean },
|
|
1265
|
-
fetchCountry: { type: Boolean },
|
|
1266
|
-
noCountrySelector: { type: Boolean },
|
|
1267
|
-
showCodeOnList: { type: Boolean },
|
|
1268
|
-
customCountriesList: { default: void 0 },
|
|
1269
|
-
autoFormat: { type: Boolean, default: !0 },
|
|
1270
|
-
noFormattingAsYouType: { type: Boolean, default: !1 },
|
|
1271
|
-
countryLocale: { default: void 0 },
|
|
1272
|
-
noValidationError: { type: Boolean },
|
|
1273
|
-
noValidationSuccess: { type: Boolean },
|
|
1274
|
-
success: { type: Boolean },
|
|
1275
|
-
error: { type: Boolean },
|
|
1276
|
-
countrySelectorDisplayName: { type: Boolean },
|
|
1277
|
-
countrySelectorWidth: { default: "9rem" },
|
|
1278
|
-
block: { type: Boolean }
|
|
1279
|
-
},
|
|
1280
|
-
emits: ["update", "data", "country-code", "update:model-value", "update:country-code"],
|
|
1281
|
-
setup(t, { emit: l }) {
|
|
1282
|
-
const o = l, c = t, {
|
|
1283
|
-
phoneNumber: m,
|
|
1284
|
-
selectedCountry: f,
|
|
1285
|
-
results: n,
|
|
1286
|
-
fetchCountryCode: i,
|
|
1287
|
-
setSelectedCountry: k,
|
|
1288
|
-
onPhoneNumberChanged: h,
|
|
1289
|
-
onCountryChanged: B,
|
|
1290
|
-
getBrowserLocale: M
|
|
1291
|
-
} = Ie(), d = ke({
|
|
1292
|
-
componentName: "MazPhoneNumberInput",
|
|
1293
|
-
providedId: c.id
|
|
1294
|
-
}), g = v(() => ({
|
|
1295
|
-
..._o,
|
|
1296
|
-
...c.translations
|
|
1297
|
-
}));
|
|
1298
|
-
we(async () => {
|
|
1299
|
-
var a;
|
|
1300
|
-
if (k(c.countryCode ?? c.defaultCountryCode), c.fetchCountry && !f.value) {
|
|
1301
|
-
const S = await i();
|
|
1302
|
-
k(S);
|
|
1303
|
-
}
|
|
1304
|
-
if (!c.defaultCountryCode && !c.noUseBrowserLocale && !f.value) {
|
|
1305
|
-
const S = (a = M()) == null ? void 0 : a.locale;
|
|
1306
|
-
k(S);
|
|
1307
|
-
}
|
|
1308
|
-
});
|
|
1309
|
-
const y = I();
|
|
1310
|
-
function F() {
|
|
1311
|
-
var a;
|
|
1312
|
-
return (a = y.value) == null ? void 0 : a.$el.querySelector("input");
|
|
1313
|
-
}
|
|
1314
|
-
async function z() {
|
|
1315
|
-
var a;
|
|
1316
|
-
await ee(), (a = F()) == null || a.select();
|
|
1317
|
-
}
|
|
1318
|
-
function $(a) {
|
|
1319
|
-
B({
|
|
1320
|
-
countryCode: a,
|
|
1321
|
-
autoFormat: c.autoFormat,
|
|
1322
|
-
noFormattingAsYouType: c.noFormattingAsYouType
|
|
1323
|
-
}), z();
|
|
1324
|
-
}
|
|
1325
|
-
return he(
|
|
1326
|
-
() => c.modelValue ?? c.defaultPhoneNumber,
|
|
1327
|
-
(a, S) => {
|
|
1328
|
-
a && a !== S && a !== m.value && h({
|
|
1329
|
-
newPhoneNumber: a,
|
|
1330
|
-
autoFormat: c.autoFormat,
|
|
1331
|
-
noFormattingAsYouType: c.noFormattingAsYouType
|
|
1332
|
-
});
|
|
1333
|
-
},
|
|
1334
|
-
{
|
|
1335
|
-
immediate: !0
|
|
1336
|
-
}
|
|
1337
|
-
), he(
|
|
1338
|
-
() => c.countryCode ?? c.defaultCountryCode,
|
|
1339
|
-
(a, S) => {
|
|
1340
|
-
a && a !== S && a !== f.value && B({
|
|
1341
|
-
countryCode: a,
|
|
1342
|
-
autoFormat: c.autoFormat,
|
|
1343
|
-
noFormattingAsYouType: c.noFormattingAsYouType
|
|
1344
|
-
});
|
|
1345
|
-
},
|
|
1346
|
-
{
|
|
1347
|
-
immediate: !0
|
|
1348
|
-
}
|
|
1349
|
-
), he(
|
|
1350
|
-
n,
|
|
1351
|
-
(a) => {
|
|
1352
|
-
o("update", a), o("data", a), a.e164 && a.isValid ? o("update:model-value", a.e164) : o("update:model-value", m.value), o("country-code", f.value), o("update:country-code", f.value);
|
|
1353
|
-
},
|
|
1354
|
-
{
|
|
1355
|
-
immediate: !0
|
|
1356
|
-
}
|
|
1357
|
-
), (a, S) => {
|
|
1358
|
-
var Z;
|
|
1359
|
-
return C(), P(
|
|
1360
|
-
"div",
|
|
1361
|
-
{
|
|
1362
|
-
class: E(["m-phone-number-input", [c.class, { "--block": a.block }]]),
|
|
1363
|
-
style: _(a.style)
|
|
1364
|
-
},
|
|
1365
|
-
[
|
|
1366
|
-
a.noCountrySelector ? V("v-if", !0) : (C(), K(Zo, {
|
|
1367
|
-
key: 0,
|
|
1368
|
-
id: b(d),
|
|
1369
|
-
"model-value": b(f),
|
|
1370
|
-
color: a.color,
|
|
1371
|
-
size: a.size,
|
|
1372
|
-
"country-locale": a.countryLocale,
|
|
1373
|
-
"country-selector-display-name": a.countrySelectorDisplayName,
|
|
1374
|
-
"custom-countries-list": a.customCountriesList,
|
|
1375
|
-
"ignored-countries": a.ignoredCountries,
|
|
1376
|
-
"list-position": a.listPosition,
|
|
1377
|
-
"no-flags": a.noFlags,
|
|
1378
|
-
"no-search": a.noSearch,
|
|
1379
|
-
error: a.error || (a.noValidationError ? !1 : !!b(m) && !b(f)),
|
|
1380
|
-
success: a.success || (a.noValidationSuccess ? !1 : (Z = b(n)) == null ? void 0 : Z.isValid),
|
|
1381
|
-
locales: g.value,
|
|
1382
|
-
disabled: a.disabled,
|
|
1383
|
-
"show-code-on-list": a.showCodeOnList,
|
|
1384
|
-
"only-countries": a.onlyCountries,
|
|
1385
|
-
"preferred-countries": a.preferredCountries,
|
|
1386
|
-
width: a.countrySelectorWidth,
|
|
1387
|
-
"onUpdate:modelValue": $
|
|
1388
|
-
}, null, 8, ["id", "model-value", "color", "size", "country-locale", "country-selector-display-name", "custom-countries-list", "ignored-countries", "list-position", "no-flags", "no-search", "error", "success", "locales", "disabled", "show-code-on-list", "only-countries", "preferred-countries", "width"])),
|
|
1389
|
-
q(xo, {
|
|
1390
|
-
id: b(d),
|
|
1391
|
-
ref_key: "PhoneInputRef",
|
|
1392
|
-
ref: y,
|
|
1393
|
-
"model-value": b(m),
|
|
1394
|
-
color: a.color,
|
|
1395
|
-
size: a.size,
|
|
1396
|
-
"no-example": a.noExample,
|
|
1397
|
-
block: "",
|
|
1398
|
-
disabled: a.disabled,
|
|
1399
|
-
"has-radius": !a.noCountrySelector,
|
|
1400
|
-
success: a.success || (a.noValidationSuccess ? !1 : b(n).isValid),
|
|
1401
|
-
error: a.error || (a.noValidationError ? !1 : !!b(m) && !b(n).isValid),
|
|
1402
|
-
locales: g.value,
|
|
1403
|
-
"no-formatting-as-you-type": a.noFormattingAsYouType,
|
|
1404
|
-
"auto-format": a.autoFormat,
|
|
1405
|
-
label: a.placeholder,
|
|
1406
|
-
"onUpdate:modelValue": S[0] || (S[0] = (N) => b(h)({
|
|
1407
|
-
newPhoneNumber: N,
|
|
1408
|
-
autoFormat: a.autoFormat,
|
|
1409
|
-
noFormattingAsYouType: a.noFormattingAsYouType
|
|
1410
|
-
}))
|
|
1411
|
-
}, null, 8, ["id", "model-value", "color", "size", "no-example", "disabled", "has-radius", "success", "error", "locales", "no-formatting-as-you-type", "auto-format", "label"])
|
|
1412
|
-
],
|
|
1413
|
-
6
|
|
1414
|
-
/* CLASS, STYLE */
|
|
1415
|
-
);
|
|
1416
|
-
};
|
|
1417
|
-
}
|
|
1418
|
-
}), lt = /* @__PURE__ */ se(et, [["__scopeId", "data-v-5481a936"]]);
|
|
1419
|
-
export {
|
|
1420
|
-
lt as M,
|
|
1421
|
-
se as _,
|
|
1422
|
-
ke as u
|
|
1423
|
-
};
|