maz-ui 3.47.2-beta.20 → 3.47.2-beta.21
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/MazChecklist.mjs +1 -1
- package/components/MazInput.d.ts +2 -0
- package/components/MazInput.mjs +1 -1
- package/components/MazInputNumber.mjs +1 -1
- package/components/MazInputPrice.mjs +1 -1
- package/components/MazInputTags.mjs +1 -1
- package/components/MazPhoneNumberInput/PhoneInput.vue.d.ts +9 -20
- package/components/MazPhoneNumberInput/types.d.ts +2 -1
- package/components/MazPhoneNumberInput/useLibphonenumber.d.ts +8 -3
- package/components/MazPhoneNumberInput.mjs +1 -1
- package/components/MazPicker.mjs +1 -1
- package/components/MazSelect.mjs +1 -1
- package/components/MazTable.mjs +1 -1
- package/components/assets/MazInput.css +1 -1
- package/components/assets/MazInputNumber.css +1 -1
- package/components/assets/MazInputPrice.css +1 -1
- package/components/assets/MazInputTags.css +1 -1
- package/components/assets/MazPhoneNumberInput.css +1 -1
- package/components/assets/MazPicker.css +1 -1
- package/components/chunks/{MazBtn-Db6ai-Mv.mjs → MazBtn-4-B-zs6Y.mjs} +2 -2
- package/components/chunks/{MazBtn-B5ioqwkK.mjs → MazBtn-C6zsmGnw.mjs} +2 -2
- package/components/chunks/MazBtn-C7yEnuOD.mjs +103 -0
- package/components/chunks/{MazBtn-CElHmZjv.mjs → MazBtn-DAXwt847.mjs} +2 -2
- package/components/chunks/{MazBtn-BrfhtojY.mjs → MazBtn-DOWVQgpN.mjs} +2 -2
- package/components/chunks/{MazBtn-C4nwxs9T.mjs → MazBtn-DZaVjTvW.mjs} +2 -2
- package/components/chunks/{MazCheckbox-B5ZcWc3y.mjs → MazCheckbox-BNvSeNBP.mjs} +1 -1
- package/components/chunks/{MazCheckbox-BDPgDiU3.mjs → MazCheckbox-CCma_qyQ.mjs} +1 -1
- package/components/chunks/{MazCheckbox-BeLByOEa.mjs → MazCheckbox-eOEEACaM.mjs} +1 -1
- package/components/chunks/{MazChecklist-BurPprmw.mjs → MazChecklist-Bb_70sf5.mjs} +1 -1
- package/components/chunks/{MazIcon-CaXpmvN2.mjs → MazIcon-kLACGOa2.mjs} +1 -1
- package/components/chunks/{MazInput-BT-mbJfZ.mjs → MazInput-BM4n-byz.mjs} +18 -18
- package/components/chunks/{MazInput-BTIdtLkD.mjs → MazInput-BcutbP8N.mjs} +11 -11
- package/components/chunks/{MazInput-BfWJoPre.mjs → MazInput-C9Qh4Gt3.mjs} +10 -10
- package/components/chunks/{MazInputNumber-R0RzDeyD.mjs → MazInputNumber-DgjOMiOt.mjs} +40 -40
- package/components/chunks/{MazInputPrice-CKSdqO4X.mjs → MazInputPrice-D6fJN9yv.mjs} +41 -41
- package/components/chunks/{MazInputTags-D6jQ2-Ia.mjs → MazInputTags-DthGSyHQ.mjs} +51 -51
- package/components/chunks/{MazLoadingBar-D3pDBJSb.mjs → MazLoadingBar-C2qPjfEQ.mjs} +1 -1
- package/components/chunks/MazPhoneNumberInput-BQjByOtQ.mjs +1813 -0
- package/components/chunks/{MazPicker-CwiuW5Pv.mjs → MazPicker-BljfUneI.mjs} +11 -11
- package/components/chunks/{MazPickerMonthSwitcher-C65el7R0.mjs → MazPickerMonthSwitcher-CEVb4BXw.mjs} +1 -1
- package/components/chunks/{MazPickerShortcuts-DbrOoszH.mjs → MazPickerShortcuts-DayGMC9m.mjs} +1 -1
- package/components/chunks/{MazPickerYearSwitcher-D9lqntyR.mjs → MazPickerYearSwitcher-DC1lFIbp.mjs} +1 -1
- package/components/chunks/{MazSelect-CyWAOXo4.mjs → MazSelect-CH3JdigO.mjs} +54 -54
- package/components/chunks/{MazSelect-CbT4tFqV.mjs → MazSelect-D3KXcHJS.mjs} +3 -3
- package/components/chunks/MazSpinner-B5JChIrj.mjs +34 -0
- package/components/chunks/{MazSpinner-N-1gjTUE.mjs → MazSpinner-BBZoDxwq.mjs} +1 -1
- package/components/chunks/{MazSpinner-DYE8e9xl.mjs → MazSpinner-BIPm54-3.mjs} +1 -1
- package/components/chunks/{MazSpinner-CS1_l-tv.mjs → MazSpinner-C-ln9ldX.mjs} +1 -1
- package/components/chunks/{MazSpinner-BDda3YzZ.mjs → MazSpinner-C11EOZZd.mjs} +1 -1
- package/components/chunks/{MazSpinner-CwmaAuL1.mjs → MazSpinner-CCc9ajpj.mjs} +1 -1
- package/components/chunks/{MazSpinner-C2-JMhVh.mjs → MazSpinner-CgKOIkQQ.mjs} +1 -1
- package/components/chunks/{MazSpinner-mtv0dluJ.mjs → MazSpinner-CwdlrYSt.mjs} +1 -1
- package/components/chunks/MazSpinner-DoPIk0St.mjs +34 -0
- package/components/chunks/{MazTable-hA0HicaL.mjs → MazTable-BU3Hluiu.mjs} +1 -1
- package/components/chunks/{MazTableCell-DkCidYWY.mjs → MazTableCell-DKMZAanm.mjs} +1 -1
- package/components/chunks/{MazTableRow-BAl6Fzm8.mjs → MazTableRow-CDHpmXfw.mjs} +1 -1
- package/components/chunks/{MazTableTitle-CY_LNDOk.mjs → MazTableTitle-BSFZ84Ob.mjs} +1 -1
- package/components/chunks/examples.mobile.json-tW3aL0qI.mjs +4 -0
- package/nuxt/index.json +1 -1
- package/package.json +2 -2
- package/types/components/MazInput.vue.d.ts +2 -0
- package/types/components/MazPhoneNumberInput/PhoneInput.vue.d.ts +9 -20
- package/types/components/MazPhoneNumberInput/types.d.ts +2 -1
- package/types/components/MazPhoneNumberInput/useLibphonenumber.d.ts +8 -3
- package/components/MazPhoneNumberInput.d.ts +0 -283
- package/components/chunks/MazBtn-D4NOcykx.mjs +0 -103
- package/components/chunks/MazPhoneNumberInput-DibUhBpk.mjs +0 -1809
- package/components/chunks/MazSpinner-DudoF-cG.mjs +0 -34
- package/components/chunks/MazSpinner-EAz0nFxC.mjs +0 -34
- package/components/chunks/examples.mobile.json-JpNGylGv.mjs +0 -4
- package/types/components/MazPhoneNumberInput.vue.d.ts +0 -283
|
@@ -1,1809 +0,0 @@
|
|
|
1
|
-
import '../assets/MazPhoneNumberInput.css';var Je = Object.defineProperty;
|
|
2
|
-
var Ze = (a, o, e) => o in a ? Je(a, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[o] = e;
|
|
3
|
-
var ee = (a, o, e) => Ze(a, typeof o != "symbol" ? o + "" : o, e);
|
|
4
|
-
import { computed as h, useId as Xe, inject as xe, defineComponent as ne, defineAsyncComponent as q, withDirectives as ze, openBlock as y, createElementBlock as P, normalizeClass as T, normalizeStyle as oe, Fragment as be, renderList as Be, createElementVNode as Y, mergeProps as le, createVNode as U, unref as k, createCommentVNode as $, renderSlot as N, ref as E, onMounted as Ie, useSlots as _e, toDisplayString as te, createBlock as K, resolveDynamicComponent as ke, toHandlers as eo, vModelDynamic as oo, createTextVNode as to, withModifiers as se, withCtx as J, onBeforeMount as Oe, nextTick as ue, Transition as lo, mergeModels as Pe, useModel as ao, provide as so, watch as he } from "vue";
|
|
5
|
-
import { getCountries as Me, getCountryCallingCode as ce, isSupportedCountry as no, parsePhoneNumberFromString as ro, getExampleNumber as io, AsYouType as uo } from "libphonenumber-js";
|
|
6
|
-
function Ae({
|
|
7
|
-
componentName: a,
|
|
8
|
-
providedId: o
|
|
9
|
-
}) {
|
|
10
|
-
return h(() => o ?? `${a}-${Xe().replace(/:/g, "")}`);
|
|
11
|
-
}
|
|
12
|
-
function Le(a, o = "20x15") {
|
|
13
|
-
return `https://flagcdn.com/${o}/${a.toLowerCase()}.png`;
|
|
14
|
-
}
|
|
15
|
-
function Te(a, o) {
|
|
16
|
-
const e = xe(a, o);
|
|
17
|
-
if (!e)
|
|
18
|
-
throw new TypeError(`[maz-ui](injectStrict) Could not resolve ${a.toString()}`);
|
|
19
|
-
return e;
|
|
20
|
-
}
|
|
21
|
-
function co(a) {
|
|
22
|
-
return !!a;
|
|
23
|
-
}
|
|
24
|
-
const mo = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", po = {
|
|
25
|
-
baseClass: "m-lazy-img",
|
|
26
|
-
loadedClass: "m-lazy-loaded",
|
|
27
|
-
loadingClass: "m-lazy-loading",
|
|
28
|
-
errorClass: "m-lazy-error",
|
|
29
|
-
noPhotoClass: "m-lazy-no-photo",
|
|
30
|
-
noPhoto: !1,
|
|
31
|
-
observerOnce: !0,
|
|
32
|
-
loadOnce: !1,
|
|
33
|
-
noUseErrorPhoto: !1,
|
|
34
|
-
observerOptions: {
|
|
35
|
-
threshold: 0.1
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
class fo {
|
|
39
|
-
constructor(o = {}) {
|
|
40
|
-
ee(this, "observers", []);
|
|
41
|
-
ee(this, "defaultOptions", po);
|
|
42
|
-
ee(this, "options");
|
|
43
|
-
ee(this, "onImgLoadedCallback");
|
|
44
|
-
ee(this, "onImgErrorCallback");
|
|
45
|
-
ee(this, "hasImgLoaded", !1);
|
|
46
|
-
this.options = this.buildOptions(o), this.onImgLoadedCallback = this.imageIsLoaded.bind(this), this.onImgErrorCallback = this.imageHasError.bind(this);
|
|
47
|
-
}
|
|
48
|
-
async loadErrorPhoto() {
|
|
49
|
-
const { default: o } = await import("./no-photography-BJX8HSus.mjs");
|
|
50
|
-
return o;
|
|
51
|
-
}
|
|
52
|
-
buildOptions(o) {
|
|
53
|
-
return {
|
|
54
|
-
...this.defaultOptions,
|
|
55
|
-
...o,
|
|
56
|
-
observerOptions: {
|
|
57
|
-
...this.defaultOptions.observerOptions,
|
|
58
|
-
...o.observerOptions
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
removeClass(o, e) {
|
|
63
|
-
o.classList.remove(e);
|
|
64
|
-
}
|
|
65
|
-
addClass(o, e) {
|
|
66
|
-
o.classList.add(e);
|
|
67
|
-
}
|
|
68
|
-
removeAllStateClasses(o) {
|
|
69
|
-
this.removeClass(o, this.options.loadedClass), this.removeClass(o, this.options.loadingClass), this.removeClass(o, this.options.errorClass), this.removeClass(o, this.options.noPhotoClass);
|
|
70
|
-
}
|
|
71
|
-
setBaseClass(o) {
|
|
72
|
-
this.addClass(o, this.options.baseClass);
|
|
73
|
-
}
|
|
74
|
-
imageIsLoading(o) {
|
|
75
|
-
var e, t;
|
|
76
|
-
this.addClass(o, this.options.loadingClass), (t = (e = this.options).onLoading) == null || t.call(e, o);
|
|
77
|
-
}
|
|
78
|
-
imageHasNoPhoto(o) {
|
|
79
|
-
this.removeClass(o, this.options.loadingClass), this.addClass(o, this.options.noPhotoClass), this.setDefaultPhoto(o);
|
|
80
|
-
}
|
|
81
|
-
imageIsLoaded(o) {
|
|
82
|
-
var e, t;
|
|
83
|
-
this.hasImgLoaded = !0, this.removeClass(o, this.options.loadingClass), this.addClass(o, this.options.loadedClass), (t = (e = this.options).onLoaded) == null || t.call(e, o);
|
|
84
|
-
}
|
|
85
|
-
imageHasError(o) {
|
|
86
|
-
var e, t;
|
|
87
|
-
this.removeClass(o, this.options.loadingClass), this.addClass(o, this.options.errorClass), (t = (e = this.options).onError) == null || t.call(e, o), this.setDefaultPhoto(o);
|
|
88
|
-
}
|
|
89
|
-
getSrc(o) {
|
|
90
|
-
return typeof o.value == "object" ? o.value.src : o.value;
|
|
91
|
-
}
|
|
92
|
-
getImageUrl(o, e) {
|
|
93
|
-
const t = this.getImgElement(o).getAttribute("data-lazy-src");
|
|
94
|
-
return t || this.getSrc(e);
|
|
95
|
-
}
|
|
96
|
-
async setPictureSourceUrls(o) {
|
|
97
|
-
const e = o.querySelectorAll("source");
|
|
98
|
-
if (e.length > 0)
|
|
99
|
-
for await (const t of e) {
|
|
100
|
-
const r = t.getAttribute("data-lazy-srcset");
|
|
101
|
-
if (r)
|
|
102
|
-
t.srcset = r;
|
|
103
|
-
else
|
|
104
|
-
return this.imageHasError(o);
|
|
105
|
-
}
|
|
106
|
-
else
|
|
107
|
-
this.imageHasError(o);
|
|
108
|
-
}
|
|
109
|
-
hasBgImgMode(o) {
|
|
110
|
-
return o.arg === "bg-image";
|
|
111
|
-
}
|
|
112
|
-
isPictureElement(o) {
|
|
113
|
-
return o instanceof HTMLPictureElement;
|
|
114
|
-
}
|
|
115
|
-
getImgElement(o) {
|
|
116
|
-
return this.isPictureElement(o) ? o.querySelector("img") : o;
|
|
117
|
-
}
|
|
118
|
-
async setDefaultPhoto(o) {
|
|
119
|
-
if (this.options.noUseErrorPhoto)
|
|
120
|
-
return;
|
|
121
|
-
const e = this.options.fallbackSrc ?? this.options.errorPhoto;
|
|
122
|
-
typeof e == "string" && this.addClass(o, this.options.noPhotoClass);
|
|
123
|
-
const t = e ?? await this.loadErrorPhoto(), r = o.querySelectorAll("source");
|
|
124
|
-
if (r.length > 0)
|
|
125
|
-
for await (const u of r)
|
|
126
|
-
u.srcset = t;
|
|
127
|
-
else
|
|
128
|
-
this.setImgSrc(o, t);
|
|
129
|
-
}
|
|
130
|
-
addEventListenerToImg(o) {
|
|
131
|
-
const e = this.getImgElement(o);
|
|
132
|
-
e.addEventListener("load", () => this.onImgLoadedCallback(o), {
|
|
133
|
-
once: !0
|
|
134
|
-
}), e.addEventListener("error", (t) => this.onImgErrorCallback(o, t), { once: !0 });
|
|
135
|
-
}
|
|
136
|
-
async loadImage(o, e) {
|
|
137
|
-
if (this.imageIsLoading(o), this.isPictureElement(o))
|
|
138
|
-
this.addEventListenerToImg(o), await this.setPictureSourceUrls(o);
|
|
139
|
-
else {
|
|
140
|
-
const t = this.getImageUrl(o, e);
|
|
141
|
-
if (!t)
|
|
142
|
-
return this.imageHasError(o);
|
|
143
|
-
this.hasBgImgMode(e) ? (o.style.backgroundImage = `url('${t}')`, this.imageIsLoaded(o)) : (this.addEventListenerToImg(o), this.setImgSrc(o, t));
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
setImgSrc(o, e) {
|
|
147
|
-
const t = this.getImgElement(o);
|
|
148
|
-
t.src = e;
|
|
149
|
-
}
|
|
150
|
-
handleIntersectionObserver(o, e, t, r) {
|
|
151
|
-
var u, v;
|
|
152
|
-
this.observers.push(r);
|
|
153
|
-
for (const p of t)
|
|
154
|
-
if (p.isIntersecting) {
|
|
155
|
-
if ((v = (u = this.options).onIntersecting) == null || v.call(u, p.target), this.options.observerOnce && r.unobserve(o), this.options.loadOnce && this.hasImgLoaded)
|
|
156
|
-
return;
|
|
157
|
-
this.loadImage(o, e);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
createObserver(o, e) {
|
|
161
|
-
const t = (v, p) => {
|
|
162
|
-
this.handleIntersectionObserver(o, e, v, p);
|
|
163
|
-
}, r = this.options.observerOptions;
|
|
164
|
-
new IntersectionObserver(t, r).observe(o);
|
|
165
|
-
}
|
|
166
|
-
async imageHandler(o, e, t) {
|
|
167
|
-
if (t === "update")
|
|
168
|
-
for await (const r of this.observers) r.unobserve(o);
|
|
169
|
-
window.IntersectionObserver ? this.createObserver(o, e) : this.loadImage(o, e);
|
|
170
|
-
}
|
|
171
|
-
async bindUpdateHandler(o, e, t) {
|
|
172
|
-
if (this.options.noPhoto)
|
|
173
|
-
return this.imageHasNoPhoto(o);
|
|
174
|
-
await this.imageHandler(o, e, t);
|
|
175
|
-
}
|
|
176
|
-
async add(o, e) {
|
|
177
|
-
if (this.hasBgImgMode(e) && this.isPictureElement(o))
|
|
178
|
-
throw new Error(`[MazLazyImg] You can't use the "bg-image" mode with "<picture />" element`);
|
|
179
|
-
setTimeout(() => this.setBaseClass(o), 0), o.getAttribute("src") || this.setImgSrc(o, mo), await this.bindUpdateHandler(o, e, "bind");
|
|
180
|
-
}
|
|
181
|
-
async update(o, e) {
|
|
182
|
-
e.value !== e.oldValue && (this.hasImgLoaded = !1, this.removeAllStateClasses(o), await this.bindUpdateHandler(o, e, "update"));
|
|
183
|
-
}
|
|
184
|
-
remove(o, e) {
|
|
185
|
-
this.hasImgLoaded = !1, this.hasBgImgMode(e) && (o.style.backgroundImage = ""), this.removeAllStateClasses(o);
|
|
186
|
-
for (const t of this.observers)
|
|
187
|
-
t.unobserve(o);
|
|
188
|
-
this.observers = [];
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
let de;
|
|
192
|
-
const ho = {
|
|
193
|
-
created(a, o) {
|
|
194
|
-
const e = typeof o.value == "object" ? o.value : {};
|
|
195
|
-
de = new fo(e), de.add(a, o);
|
|
196
|
-
},
|
|
197
|
-
updated(a, o) {
|
|
198
|
-
de.update(a, o);
|
|
199
|
-
},
|
|
200
|
-
unmounted(a, o) {
|
|
201
|
-
de.remove(a, o);
|
|
202
|
-
}
|
|
203
|
-
}, vo = ["data-lazy-srcset", "media"], yo = ["alt"], go = {
|
|
204
|
-
key: 0,
|
|
205
|
-
class: "m-lazy-img-component-loader"
|
|
206
|
-
}, bo = /* @__PURE__ */ ne({
|
|
207
|
-
inheritAttrs: !1,
|
|
208
|
-
__name: "MazLazyImg",
|
|
209
|
-
props: {
|
|
210
|
-
style: { default: void 0 },
|
|
211
|
-
class: { default: void 0 },
|
|
212
|
-
image: { default: void 0 },
|
|
213
|
-
src: { default: void 0 },
|
|
214
|
-
alt: { default: void 0 },
|
|
215
|
-
noPhoto: { type: Boolean },
|
|
216
|
-
noLoader: { type: Boolean },
|
|
217
|
-
noObserverOnce: { type: Boolean },
|
|
218
|
-
loadOnce: { type: Boolean },
|
|
219
|
-
imageHeightFull: { type: Boolean },
|
|
220
|
-
observerOptions: { default: void 0 },
|
|
221
|
-
fallbackSrc: { default: void 0 },
|
|
222
|
-
imgClass: {},
|
|
223
|
-
block: { type: Boolean }
|
|
224
|
-
},
|
|
225
|
-
emits: ["intersecting", "loading", "loaded", "error"],
|
|
226
|
-
setup(a) {
|
|
227
|
-
const o = a, e = q(() => import("./MazSpinner-EAz0nFxC.mjs")), t = h(() => o.image || o.src), r = h(() => {
|
|
228
|
-
var u;
|
|
229
|
-
return typeof t.value == "string" ? [{ srcset: t.value }] : (u = t.value) == null ? void 0 : u.sources;
|
|
230
|
-
});
|
|
231
|
-
return (u, v) => ze((y(), P(
|
|
232
|
-
"picture",
|
|
233
|
-
{
|
|
234
|
-
class: T(["m-lazy-img-component", [{ "--use-loader": !u.noLoader, "--height-full": u.imageHeightFull, "--block": u.block }, o.class]]),
|
|
235
|
-
style: oe(u.style)
|
|
236
|
-
},
|
|
237
|
-
[
|
|
238
|
-
(y(!0), P(
|
|
239
|
-
be,
|
|
240
|
-
null,
|
|
241
|
-
Be(r.value, ({ srcset: p, media: B }, L) => (y(), P("source", {
|
|
242
|
-
key: L,
|
|
243
|
-
"data-lazy-srcset": p,
|
|
244
|
-
media: B
|
|
245
|
-
}, null, 8, vo))),
|
|
246
|
-
128
|
|
247
|
-
/* KEYED_FRAGMENT */
|
|
248
|
-
)),
|
|
249
|
-
Y("img", le(u.$attrs, {
|
|
250
|
-
src: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
|
|
251
|
-
loading: "lazy",
|
|
252
|
-
alt: u.alt,
|
|
253
|
-
class: u.imgClass
|
|
254
|
-
}), null, 16, yo),
|
|
255
|
-
u.noLoader ? $("v-if", !0) : (y(), P("div", go, [
|
|
256
|
-
U(k(e), { size: "2em" })
|
|
257
|
-
])),
|
|
258
|
-
N(u.$slots, "default", {}, void 0, !0)
|
|
259
|
-
],
|
|
260
|
-
6
|
|
261
|
-
/* CLASS, STYLE */
|
|
262
|
-
)), [
|
|
263
|
-
[k(ho), {
|
|
264
|
-
noPhoto: u.noPhoto,
|
|
265
|
-
loadOnce: u.loadOnce,
|
|
266
|
-
observerOptions: u.observerOptions,
|
|
267
|
-
fallbackSrc: u.fallbackSrc,
|
|
268
|
-
observerOnce: !u.noObserverOnce,
|
|
269
|
-
onIntersecting: (p) => u.$emit("intersecting", p),
|
|
270
|
-
onLoading: (p) => u.$emit("loading", p),
|
|
271
|
-
onLoaded: (p) => u.$emit("loaded", p),
|
|
272
|
-
onError: (p) => u.$emit("error", p)
|
|
273
|
-
}]
|
|
274
|
-
]);
|
|
275
|
-
}
|
|
276
|
-
}), re = (a, o) => {
|
|
277
|
-
const e = a.__vccOpts || a;
|
|
278
|
-
for (const [t, r] of o)
|
|
279
|
-
e[t] = r;
|
|
280
|
-
return e;
|
|
281
|
-
}, Ee = /* @__PURE__ */ re(bo, [["__scopeId", "data-v-83e40430"]]), Co = {
|
|
282
|
-
removeAccents: !0,
|
|
283
|
-
caseSensitive: !1,
|
|
284
|
-
replaceSpaces: !0,
|
|
285
|
-
removeSpecialCharacters: !1,
|
|
286
|
-
trim: !0,
|
|
287
|
-
normalizeSpaces: !0,
|
|
288
|
-
removeNumbers: !1,
|
|
289
|
-
customNormalizationForms: ["NFC", "NFKD"]
|
|
290
|
-
};
|
|
291
|
-
function me(a, o) {
|
|
292
|
-
const e = { ...Co, ...o }, t = {
|
|
293
|
-
À: "A",
|
|
294
|
-
Á: "A",
|
|
295
|
-
Â: "A",
|
|
296
|
-
Ã: "A",
|
|
297
|
-
Ä: "A",
|
|
298
|
-
Å: "A",
|
|
299
|
-
à: "a",
|
|
300
|
-
á: "a",
|
|
301
|
-
â: "a",
|
|
302
|
-
ã: "a",
|
|
303
|
-
ä: "a",
|
|
304
|
-
å: "a",
|
|
305
|
-
È: "E",
|
|
306
|
-
É: "E",
|
|
307
|
-
Ê: "E",
|
|
308
|
-
Ë: "E",
|
|
309
|
-
è: "e",
|
|
310
|
-
é: "e",
|
|
311
|
-
ê: "e",
|
|
312
|
-
ë: "e",
|
|
313
|
-
Î: "I",
|
|
314
|
-
Ï: "I",
|
|
315
|
-
í: "I",
|
|
316
|
-
î: "i",
|
|
317
|
-
ï: "i",
|
|
318
|
-
Ô: "O",
|
|
319
|
-
Õ: "O",
|
|
320
|
-
Ö: "O",
|
|
321
|
-
Ø: "O",
|
|
322
|
-
ô: "o",
|
|
323
|
-
õ: "o",
|
|
324
|
-
ö: "o",
|
|
325
|
-
ø: "o",
|
|
326
|
-
Ù: "U",
|
|
327
|
-
Ú: "U",
|
|
328
|
-
Û: "U",
|
|
329
|
-
Ü: "U",
|
|
330
|
-
ù: "u",
|
|
331
|
-
ú: "u",
|
|
332
|
-
û: "u",
|
|
333
|
-
ü: "u",
|
|
334
|
-
Ç: "C",
|
|
335
|
-
ç: "c",
|
|
336
|
-
ÿ: "y",
|
|
337
|
-
Ñ: "N",
|
|
338
|
-
ñ: "n",
|
|
339
|
-
ó: "o"
|
|
340
|
-
};
|
|
341
|
-
let r = a.toString();
|
|
342
|
-
if (e.trim && (r = r.trim()), e.normalizeSpaces && (r = r.replaceAll(/\s+/g, " ")), e.replaceSpaces && (r = r.replaceAll(" ", "-")), e.removeNumbers && (r = r.replaceAll(/\d/g, "")), e.removeAccents && (r = r.replaceAll(/[ÀÁÂÃÄÅÇÈÉÊËÎÏÑÔÕÖØÙÚÛÜàáâãäåçèéêëíîïñóôõöøùúûüÿ]/g, (u) => t[u] || u), r = r.replaceAll(/[\u0300-\u036F]/g, "")), e.caseSensitive === !1 && (r = r.toLowerCase()), e.removeSpecialCharacters && (r = r.replaceAll(/[^\dA-Z-]/gi, "")), e.trim && (r = r.trim()), e.customNormalizationForms)
|
|
343
|
-
for (const u of e.customNormalizationForms)
|
|
344
|
-
r = r.normalize(u);
|
|
345
|
-
return r;
|
|
346
|
-
}
|
|
347
|
-
function zo(a, o) {
|
|
348
|
-
const e = a.length, t = o.length, r = [];
|
|
349
|
-
for (let u = 0; u <= e; u++)
|
|
350
|
-
r[u] = [u];
|
|
351
|
-
for (let u = 0; u <= t; u++)
|
|
352
|
-
r[0][u] = u;
|
|
353
|
-
for (let u = 1; u <= e; u++)
|
|
354
|
-
for (let v = 1; v <= t; v++) {
|
|
355
|
-
const p = a[u - 1] === o[v - 1] ? 0 : 1;
|
|
356
|
-
r[u][v] = Math.min(
|
|
357
|
-
r[u - 1][v] + 1,
|
|
358
|
-
r[u][v - 1] + 1,
|
|
359
|
-
r[u - 1][v - 1] + p
|
|
360
|
-
);
|
|
361
|
-
}
|
|
362
|
-
return r[e][t];
|
|
363
|
-
}
|
|
364
|
-
function Fe(a, o) {
|
|
365
|
-
const e = zo(a, o), t = Math.max(a.length, o.length);
|
|
366
|
-
return 1 - e / t;
|
|
367
|
-
}
|
|
368
|
-
function Io(a, o, e = 0.75) {
|
|
369
|
-
return Fe(a, o) >= e;
|
|
370
|
-
}
|
|
371
|
-
function ve(a, o, e = 0.75) {
|
|
372
|
-
const t = h(
|
|
373
|
-
() => me(typeof a == "string" ? a : a.value)
|
|
374
|
-
), r = h(
|
|
375
|
-
() => me(typeof o == "string" ? o : o.value)
|
|
376
|
-
), u = h(() => typeof e == "number" ? e : e.value), v = h(() => Fe(t.value, r.value));
|
|
377
|
-
return {
|
|
378
|
-
isMatching: h(
|
|
379
|
-
() => Io(t.value, r.value, u.value)
|
|
380
|
-
),
|
|
381
|
-
score: v
|
|
382
|
-
};
|
|
383
|
-
}
|
|
384
|
-
function Ne(a, o, e) {
|
|
385
|
-
var v, p;
|
|
386
|
-
a.stopPropagation();
|
|
387
|
-
const t = typeof e.value == "function" ? e.value : e.value.handler, r = typeof e.value == "object" ? e.value.exclude : void 0;
|
|
388
|
-
let u = !1;
|
|
389
|
-
if (r && r.length > 0) {
|
|
390
|
-
for (const B of r)
|
|
391
|
-
if (!u && a.target instanceof HTMLElement) {
|
|
392
|
-
const L = (v = document.querySelector(B)) == null ? void 0 : v.getAttribute("id");
|
|
393
|
-
u = (a.target.getAttribute("id") === L || ((p = document.querySelector(B)) == null ? void 0 : p.contains(a.target))) ?? !1;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
!o.contains(a.target) && !u && (t == null || t(a));
|
|
397
|
-
}
|
|
398
|
-
function Ke() {
|
|
399
|
-
return document.ontouchstart === null ? "touchstart" : "click";
|
|
400
|
-
}
|
|
401
|
-
function Ao(a, o) {
|
|
402
|
-
const e = Ke();
|
|
403
|
-
document.removeEventListener(e, (t) => Ne(t, a, o));
|
|
404
|
-
}
|
|
405
|
-
function wo(a, o) {
|
|
406
|
-
if (typeof o.value != "function" && typeof o.value == "object" && typeof o.value.handler != "function") {
|
|
407
|
-
console.error("[maz-ui](vClosable) v-closable directive requires a handler function");
|
|
408
|
-
return;
|
|
409
|
-
}
|
|
410
|
-
const e = Ke();
|
|
411
|
-
document.addEventListener(e, (t) => Ne(t, a, o));
|
|
412
|
-
}
|
|
413
|
-
const So = {
|
|
414
|
-
mounted: wo,
|
|
415
|
-
unmounted: Ao
|
|
416
|
-
};
|
|
417
|
-
let ye = null;
|
|
418
|
-
function Vo(a, o) {
|
|
419
|
-
ye && clearTimeout(ye), ye = setTimeout(a, o);
|
|
420
|
-
}
|
|
421
|
-
function ko(a, o) {
|
|
422
|
-
let e;
|
|
423
|
-
return function(...t) {
|
|
424
|
-
clearTimeout(e), e = setTimeout(() => {
|
|
425
|
-
a.apply(this, t);
|
|
426
|
-
}, o);
|
|
427
|
-
};
|
|
428
|
-
}
|
|
429
|
-
const Po = ["for"], Lo = {
|
|
430
|
-
key: 0,
|
|
431
|
-
class: "m-input-wrapper-left"
|
|
432
|
-
}, Eo = ["id", "type", "name", "inputmode", "placeholder", "aria-label", "disabled", "readonly", "required"], $o = { key: 0 }, Bo = {
|
|
433
|
-
key: 1,
|
|
434
|
-
class: "m-input-wrapper-right"
|
|
435
|
-
}, Oo = /* @__PURE__ */ ne({
|
|
436
|
-
inheritAttrs: !1,
|
|
437
|
-
__name: "MazInput",
|
|
438
|
-
props: {
|
|
439
|
-
style: { default: void 0 },
|
|
440
|
-
class: { default: void 0 },
|
|
441
|
-
modelValue: { default: void 0 },
|
|
442
|
-
placeholder: { default: void 0 },
|
|
443
|
-
label: { default: void 0 },
|
|
444
|
-
topLabel: {},
|
|
445
|
-
assistiveText: {},
|
|
446
|
-
name: { default: void 0 },
|
|
447
|
-
color: { default: "primary" },
|
|
448
|
-
type: { default: "text" },
|
|
449
|
-
required: { type: Boolean, default: !1 },
|
|
450
|
-
disabled: { type: Boolean, default: !1 },
|
|
451
|
-
readonly: { type: Boolean, default: !1 },
|
|
452
|
-
id: { default: void 0 },
|
|
453
|
-
error: { type: Boolean, default: !1 },
|
|
454
|
-
success: { type: Boolean, default: !1 },
|
|
455
|
-
warning: { type: Boolean, default: !1 },
|
|
456
|
-
hint: { default: void 0 },
|
|
457
|
-
inputClasses: { default: void 0 },
|
|
458
|
-
noBorder: { type: Boolean, default: !1 },
|
|
459
|
-
noRadius: { type: Boolean, default: !1 },
|
|
460
|
-
inputmode: { default: "text" },
|
|
461
|
-
size: { default: "md" },
|
|
462
|
-
debounce: { type: [Boolean, Number], default: !1 },
|
|
463
|
-
debounceDelay: { default: 500 },
|
|
464
|
-
validButton: { type: Boolean, default: !1 },
|
|
465
|
-
validButtonLoading: { type: Boolean, default: !1 },
|
|
466
|
-
autoFocus: { type: Boolean, default: !1 },
|
|
467
|
-
borderActive: { type: Boolean, default: !1 },
|
|
468
|
-
leftIcon: { type: [String, Function, Object], default: void 0 },
|
|
469
|
-
rightIcon: { type: [String, Function, Object], default: void 0 },
|
|
470
|
-
roundedSize: { default: void 0 },
|
|
471
|
-
block: { type: Boolean }
|
|
472
|
-
},
|
|
473
|
-
emits: ["update:model-value", "focus", "blur", "click", "change", "input"],
|
|
474
|
-
setup(a, { emit: o }) {
|
|
475
|
-
const e = a, t = o, r = q(() => import("./MazBtn-D4NOcykx.mjs")), u = q(() => import("./MazIcon-CaXpmvN2.mjs")), v = q(() => import("./eye-slash-BoO00xzs.mjs")), p = q(() => import("./eye-f8zAUc30.mjs")), B = q(() => import("./check-C9Q_W85g.mjs")), L = E(!1), g = E(!1), A = E(), i = Ae({
|
|
476
|
-
componentName: "MazInput",
|
|
477
|
-
providedId: e.id
|
|
478
|
-
});
|
|
479
|
-
Ie(() => {
|
|
480
|
-
var s;
|
|
481
|
-
e.autoFocus && ((s = A.value) == null || s.focus());
|
|
482
|
-
});
|
|
483
|
-
const f = h(() => e.type === "password"), z = h(() => L.value ? "text" : e.type), w = h(() => {
|
|
484
|
-
if (!e.noBorder) {
|
|
485
|
-
if (e.error)
|
|
486
|
-
return "maz-border-danger";
|
|
487
|
-
if (e.success)
|
|
488
|
-
return "maz-border-success";
|
|
489
|
-
if (e.warning)
|
|
490
|
-
return "maz-border-warning";
|
|
491
|
-
if (g.value || e.borderActive) {
|
|
492
|
-
if (e.color === "black")
|
|
493
|
-
return "maz-border-black";
|
|
494
|
-
if (e.color === "danger")
|
|
495
|
-
return "maz-border-danger";
|
|
496
|
-
if (e.color === "info")
|
|
497
|
-
return "maz-border-info";
|
|
498
|
-
if (e.color === "primary")
|
|
499
|
-
return "maz-border-primary";
|
|
500
|
-
if (e.color === "secondary")
|
|
501
|
-
return "maz-border-secondary";
|
|
502
|
-
if (e.color === "success")
|
|
503
|
-
return "maz-border-success";
|
|
504
|
-
if (e.color === "warning")
|
|
505
|
-
return "maz-border-warning";
|
|
506
|
-
if (e.color === "white")
|
|
507
|
-
return "maz-border-white";
|
|
508
|
-
}
|
|
509
|
-
return "--default-border";
|
|
510
|
-
}
|
|
511
|
-
}), H = _e(), j = h(() => {
|
|
512
|
-
const { required: s, placeholder: F } = e;
|
|
513
|
-
if (F)
|
|
514
|
-
return s ? `${F} *` : F;
|
|
515
|
-
}), Z = h(() => C.value !== void 0 && C.value !== ""), b = ko(
|
|
516
|
-
(s) => {
|
|
517
|
-
t("update:model-value", s);
|
|
518
|
-
},
|
|
519
|
-
typeof e.debounce == "number" ? e.debounce : e.debounceDelay ?? 500
|
|
520
|
-
);
|
|
521
|
-
function S(s) {
|
|
522
|
-
if (e.debounce)
|
|
523
|
-
return b(s);
|
|
524
|
-
t("update:model-value", s);
|
|
525
|
-
}
|
|
526
|
-
const C = h({
|
|
527
|
-
get: () => e.modelValue,
|
|
528
|
-
set: (s) => S(s)
|
|
529
|
-
}), W = h(() => (!!e.label || !!e.hint) && (g.value || !!Z.value || !!e.placeholder || ["date", "month", "week"].includes(e.type))), X = h(() => !!e.label || !!e.hint);
|
|
530
|
-
function n() {
|
|
531
|
-
return !!H["right-icon"] || f.value || !!H["valid-button"] || e.validButton || !!e.rightIcon;
|
|
532
|
-
}
|
|
533
|
-
function V() {
|
|
534
|
-
return !!H["left-icon"] || !!e.leftIcon;
|
|
535
|
-
}
|
|
536
|
-
function D(s) {
|
|
537
|
-
t("focus", s), g.value = !0;
|
|
538
|
-
}
|
|
539
|
-
function M(s) {
|
|
540
|
-
t("blur", s), g.value = !1;
|
|
541
|
-
}
|
|
542
|
-
function Q(s) {
|
|
543
|
-
return t("change", s);
|
|
544
|
-
}
|
|
545
|
-
function x(s) {
|
|
546
|
-
return t("input", s);
|
|
547
|
-
}
|
|
548
|
-
return (s, F) => (y(), P(
|
|
549
|
-
"div",
|
|
550
|
-
{
|
|
551
|
-
class: T(["m-input", [
|
|
552
|
-
{
|
|
553
|
-
"--is-focused": g.value || s.borderActive,
|
|
554
|
-
"--should-up": W.value,
|
|
555
|
-
"--has-label": X.value,
|
|
556
|
-
"--is-disabled": s.disabled,
|
|
557
|
-
"--is-readonly": s.readonly,
|
|
558
|
-
"--has-z-2": s.error || s.warning || s.success,
|
|
559
|
-
"--has-state": s.error || s.warning || s.success,
|
|
560
|
-
"--block": s.block
|
|
561
|
-
},
|
|
562
|
-
e.class,
|
|
563
|
-
`--${s.color}`
|
|
564
|
-
]]),
|
|
565
|
-
style: oe(s.style)
|
|
566
|
-
},
|
|
567
|
-
[
|
|
568
|
-
s.topLabel ? (y(), P("label", {
|
|
569
|
-
key: 0,
|
|
570
|
-
for: k(i),
|
|
571
|
-
class: "m-input-top-label"
|
|
572
|
-
}, te(s.topLabel), 9, Po)) : $("v-if", !0),
|
|
573
|
-
Y(
|
|
574
|
-
"div",
|
|
575
|
-
{
|
|
576
|
-
class: T(["m-input-wrapper", [
|
|
577
|
-
s.inputClasses,
|
|
578
|
-
w.value,
|
|
579
|
-
s.roundedSize ? `--rounded-${s.roundedSize}` : { "maz-rounded": !s.noRadius },
|
|
580
|
-
{ "--block": s.block }
|
|
581
|
-
]])
|
|
582
|
-
},
|
|
583
|
-
[
|
|
584
|
-
V() ? (y(), P("div", Lo, [
|
|
585
|
-
s.$slots["left-icon"] || s.leftIcon ? N(s.$slots, "left-icon", { key: 0 }, () => [
|
|
586
|
-
typeof s.leftIcon == "string" ? (y(), K(k(u), {
|
|
587
|
-
key: 0,
|
|
588
|
-
name: s.leftIcon,
|
|
589
|
-
class: "maz-text-xl maz-text-muted"
|
|
590
|
-
}, null, 8, ["name"])) : s.leftIcon ? (y(), K(ke(s.leftIcon), {
|
|
591
|
-
key: 1,
|
|
592
|
-
class: "maz-text-xl maz-text-muted"
|
|
593
|
-
})) : $("v-if", !0)
|
|
594
|
-
], !0) : $("v-if", !0)
|
|
595
|
-
])) : $("v-if", !0),
|
|
596
|
-
Y(
|
|
597
|
-
"div",
|
|
598
|
-
{
|
|
599
|
-
class: T(["m-input-wrapper-input", [`--${s.size}`, { "--top-label": !!s.topLabel }]])
|
|
600
|
-
},
|
|
601
|
-
[
|
|
602
|
-
ze(Y("input", le({
|
|
603
|
-
id: k(i),
|
|
604
|
-
ref_key: "input",
|
|
605
|
-
ref: A,
|
|
606
|
-
"onUpdate:modelValue": F[0] || (F[0] = (_) => C.value = _),
|
|
607
|
-
type: z.value,
|
|
608
|
-
name: s.name
|
|
609
|
-
}, s.$attrs, {
|
|
610
|
-
inputmode: s.inputmode,
|
|
611
|
-
placeholder: j.value,
|
|
612
|
-
"aria-label": s.label || s.placeholder,
|
|
613
|
-
disabled: s.disabled,
|
|
614
|
-
readonly: s.readonly,
|
|
615
|
-
required: s.required,
|
|
616
|
-
class: "m-input-input"
|
|
617
|
-
}, eo({
|
|
618
|
-
blur: M,
|
|
619
|
-
focus: D,
|
|
620
|
-
change: Q,
|
|
621
|
-
input: x
|
|
622
|
-
}, !0), {
|
|
623
|
-
onClick: F[1] || (F[1] = (_) => s.$emit("click", _))
|
|
624
|
-
}), null, 16, Eo), [
|
|
625
|
-
[oo, C.value]
|
|
626
|
-
]),
|
|
627
|
-
s.label || s.hint ? (y(), P(
|
|
628
|
-
"span",
|
|
629
|
-
{
|
|
630
|
-
key: 0,
|
|
631
|
-
class: T(["m-input-label", [
|
|
632
|
-
{
|
|
633
|
-
"maz-text-danger-600": s.error,
|
|
634
|
-
"maz-text-success-600": s.success,
|
|
635
|
-
"maz-text-warning-600": s.warning
|
|
636
|
-
}
|
|
637
|
-
]])
|
|
638
|
-
},
|
|
639
|
-
[
|
|
640
|
-
to(
|
|
641
|
-
te(s.hint || s.label) + " ",
|
|
642
|
-
1
|
|
643
|
-
/* TEXT */
|
|
644
|
-
),
|
|
645
|
-
s.required ? (y(), P("sup", $o, "*")) : $("v-if", !0)
|
|
646
|
-
],
|
|
647
|
-
2
|
|
648
|
-
/* CLASS */
|
|
649
|
-
)) : $("v-if", !0)
|
|
650
|
-
],
|
|
651
|
-
2
|
|
652
|
-
/* CLASS */
|
|
653
|
-
),
|
|
654
|
-
n() ? (y(), P("div", Bo, [
|
|
655
|
-
s.$slots["right-icon"] || s.rightIcon ? N(s.$slots, "right-icon", { key: 0 }, () => [
|
|
656
|
-
typeof s.rightIcon == "string" ? (y(), K(k(u), {
|
|
657
|
-
key: 0,
|
|
658
|
-
name: s.rightIcon,
|
|
659
|
-
class: "maz-text-xl maz-text-muted"
|
|
660
|
-
}, null, 8, ["name"])) : s.rightIcon ? (y(), K(ke(s.rightIcon), {
|
|
661
|
-
key: 1,
|
|
662
|
-
class: "maz-text-xl maz-text-muted"
|
|
663
|
-
})) : $("v-if", !0)
|
|
664
|
-
], !0) : $("v-if", !0),
|
|
665
|
-
f.value ? (y(), K(k(r), {
|
|
666
|
-
key: 1,
|
|
667
|
-
color: "transparent",
|
|
668
|
-
tabindex: "-1",
|
|
669
|
-
size: "mini",
|
|
670
|
-
onClick: F[2] || (F[2] = se((_) => L.value = !L.value, ["stop"]))
|
|
671
|
-
}, {
|
|
672
|
-
default: J(() => [
|
|
673
|
-
L.value ? (y(), K(k(v), {
|
|
674
|
-
key: 0,
|
|
675
|
-
class: "maz-text-xl maz-text-muted"
|
|
676
|
-
})) : (y(), K(k(p), {
|
|
677
|
-
key: 1,
|
|
678
|
-
class: "maz-text-xl maz-text-muted"
|
|
679
|
-
}))
|
|
680
|
-
]),
|
|
681
|
-
_: 1
|
|
682
|
-
/* STABLE */
|
|
683
|
-
})) : $("v-if", !0),
|
|
684
|
-
s.$slots["valid-button"] || s.validButton ? N(s.$slots, "valid-button", { key: 2 }, () => [
|
|
685
|
-
U(k(r), {
|
|
686
|
-
color: "transparent",
|
|
687
|
-
disabled: s.disabled,
|
|
688
|
-
tabindex: "-1",
|
|
689
|
-
loading: s.validButtonLoading,
|
|
690
|
-
class: "m-input-valid-button",
|
|
691
|
-
size: "mini",
|
|
692
|
-
type: "submit"
|
|
693
|
-
}, {
|
|
694
|
-
default: J(() => [
|
|
695
|
-
U(k(B), { class: "maz-text-2xl maz-text-normal" })
|
|
696
|
-
]),
|
|
697
|
-
_: 1
|
|
698
|
-
/* STABLE */
|
|
699
|
-
}, 8, ["disabled", "loading"])
|
|
700
|
-
], !0) : $("v-if", !0)
|
|
701
|
-
])) : $("v-if", !0)
|
|
702
|
-
],
|
|
703
|
-
2
|
|
704
|
-
/* CLASS */
|
|
705
|
-
),
|
|
706
|
-
s.assistiveText ? (y(), P(
|
|
707
|
-
"div",
|
|
708
|
-
{
|
|
709
|
-
key: 1,
|
|
710
|
-
class: T(["m-input-bottom-text", [
|
|
711
|
-
{
|
|
712
|
-
"maz-text-danger-600": s.error,
|
|
713
|
-
"maz-text-success-600": s.success,
|
|
714
|
-
"maz-text-warning-600": s.warning,
|
|
715
|
-
"maz-text-muted": !s.error && !s.success && !s.warning
|
|
716
|
-
}
|
|
717
|
-
]])
|
|
718
|
-
},
|
|
719
|
-
te(s.assistiveText),
|
|
720
|
-
3
|
|
721
|
-
/* TEXT, CLASS */
|
|
722
|
-
)) : $("v-if", !0)
|
|
723
|
-
],
|
|
724
|
-
6
|
|
725
|
-
/* CLASS, STYLE */
|
|
726
|
-
));
|
|
727
|
-
}
|
|
728
|
-
}), Ce = /* @__PURE__ */ re(Oo, [["__scopeId", "data-v-2cfe0ca2"]]), Mo = ["aria-label"], To = { class: "m-select-list__no-results" }, Fo = {
|
|
729
|
-
key: 2,
|
|
730
|
-
class: "m-select-list__scroll-wrapper",
|
|
731
|
-
tabindex: "-1"
|
|
732
|
-
}, No = { class: "m-select-list-optgroup" }, Ko = ["onClick"], Uo = /* @__PURE__ */ ne({
|
|
733
|
-
inheritAttrs: !1,
|
|
734
|
-
__name: "MazSelect",
|
|
735
|
-
props: {
|
|
736
|
-
style: { default: void 0 },
|
|
737
|
-
class: { default: void 0 },
|
|
738
|
-
id: { default: void 0 },
|
|
739
|
-
modelValue: { default: void 0 },
|
|
740
|
-
options: { default: void 0 },
|
|
741
|
-
optionValueKey: { default: "value" },
|
|
742
|
-
optionLabelKey: { default: "label" },
|
|
743
|
-
optionInputValueKey: { default: "label" },
|
|
744
|
-
listPosition: { default: "bottom left" },
|
|
745
|
-
itemHeight: { default: void 0 },
|
|
746
|
-
maxListHeight: { default: 240 },
|
|
747
|
-
maxListWidth: { default: void 0 },
|
|
748
|
-
minListHeight: { default: void 0 },
|
|
749
|
-
minListWidth: { default: void 0 },
|
|
750
|
-
size: { default: "md" },
|
|
751
|
-
color: { default: "primary" },
|
|
752
|
-
search: { type: Boolean },
|
|
753
|
-
searchPlaceholder: { default: "Search in options" },
|
|
754
|
-
searchThreshold: { default: 0.75 },
|
|
755
|
-
open: { type: Boolean },
|
|
756
|
-
multiple: { type: Boolean, default: void 0 },
|
|
757
|
-
required: { type: Boolean },
|
|
758
|
-
disabled: { type: Boolean },
|
|
759
|
-
block: { type: Boolean },
|
|
760
|
-
excludeSelectors: { default: void 0 },
|
|
761
|
-
autocomplete: { default: "off" }
|
|
762
|
-
},
|
|
763
|
-
emits: ["close", "open", "blur", "focus", "change", "input", "update:model-value", "selected-option"],
|
|
764
|
-
setup(a, { expose: o, emit: e }) {
|
|
765
|
-
const t = a, r = e, u = q(() => import("./MazCheckbox-B5ZcWc3y.mjs")), v = q(() => import("./magnifying-glass--nBiyXot.mjs")), p = q(() => import("./chevron-down-BkvtON3b.mjs")), B = q(() => import("./no-symbol-CIgKzsrB.mjs"));
|
|
766
|
-
o({
|
|
767
|
-
/** Method to open the option list */
|
|
768
|
-
openList: ie,
|
|
769
|
-
/** Method to close the option list */
|
|
770
|
-
closeList: ae
|
|
771
|
-
});
|
|
772
|
-
const L = E(!1), g = E(), A = h(
|
|
773
|
-
() => ["black", "transparent", "white"].includes(t.color)
|
|
774
|
-
), i = h(
|
|
775
|
-
() => A.value ? "var(--maz-color-black)" : `var(--maz-color-${t.color}-800)`
|
|
776
|
-
), f = h(
|
|
777
|
-
() => A.value ? "var(--maz-color-muted)" : `var(--maz-color-${t.color}-100)`
|
|
778
|
-
), z = h(
|
|
779
|
-
() => A.value ? "var(--maz-color-muted)" : `var(--maz-color-${t.color}-200)`
|
|
780
|
-
), w = h(() => L.value || t.open), H = Ae({
|
|
781
|
-
componentName: "MazSelect",
|
|
782
|
-
providedId: t.id
|
|
783
|
-
});
|
|
784
|
-
function j(l) {
|
|
785
|
-
return {
|
|
786
|
-
[t.optionValueKey]: l,
|
|
787
|
-
[t.optionLabelKey]: l,
|
|
788
|
-
[t.optionInputValueKey]: l
|
|
789
|
-
};
|
|
790
|
-
}
|
|
791
|
-
function Z(l) {
|
|
792
|
-
return {
|
|
793
|
-
...l,
|
|
794
|
-
[t.optionValueKey]: l[t.optionValueKey],
|
|
795
|
-
[t.optionLabelKey]: l[t.optionLabelKey],
|
|
796
|
-
[t.optionInputValueKey]: l[t.optionInputValueKey]
|
|
797
|
-
};
|
|
798
|
-
}
|
|
799
|
-
const b = h(() => {
|
|
800
|
-
var c;
|
|
801
|
-
const l = [];
|
|
802
|
-
if (!((c = t.options) != null && c.length))
|
|
803
|
-
return [];
|
|
804
|
-
for (const d of t.options)
|
|
805
|
-
typeof d == "string" || typeof d == "number" || typeof d == "boolean" ? l.push(j(d)) : typeof d == "object" && "options" in d && Array.isArray(d.options) ? l.push(
|
|
806
|
-
{ label: d.label, isOptGroup: !0 },
|
|
807
|
-
...d.options.map(
|
|
808
|
-
(m) => typeof m == "string" || typeof m == "number" || typeof m == "boolean" ? j(m) : Z(m)
|
|
809
|
-
)
|
|
810
|
-
) : l.push(Z(d));
|
|
811
|
-
return l;
|
|
812
|
-
}), S = h(
|
|
813
|
-
() => {
|
|
814
|
-
var l;
|
|
815
|
-
return ((l = b.value) == null ? void 0 : l.filter((c) => t.multiple ? Array.isArray(t.modelValue) ? t.modelValue.includes(c[t.optionValueKey]) && !V(c[t.optionValueKey]) : !1 : t.modelValue === c[t.optionValueKey] && !V(c[t.optionValueKey]))) ?? [];
|
|
816
|
-
}
|
|
817
|
-
);
|
|
818
|
-
Oe(() => {
|
|
819
|
-
var l;
|
|
820
|
-
(l = t.options) != null && l.length || console.warn("[maz-ui](MazSelect) you must provide options"), fe();
|
|
821
|
-
});
|
|
822
|
-
const C = E(), W = E(), X = E(), n = E();
|
|
823
|
-
function V(l) {
|
|
824
|
-
return l == null;
|
|
825
|
-
}
|
|
826
|
-
function D(l) {
|
|
827
|
-
var d;
|
|
828
|
-
return (((d = S.value) == null ? void 0 : d.some(
|
|
829
|
-
(m) => m[t.optionValueKey] === l[t.optionValueKey]
|
|
830
|
-
)) ?? !1) && !V(l[t.optionValueKey]);
|
|
831
|
-
}
|
|
832
|
-
const M = h(() => {
|
|
833
|
-
var c;
|
|
834
|
-
if (t.multiple && t.modelValue && Array.isArray(t.modelValue))
|
|
835
|
-
return t.modelValue.map(
|
|
836
|
-
(d) => {
|
|
837
|
-
var m, I;
|
|
838
|
-
return (I = (m = b.value) == null ? void 0 : m.find((O) => O[t.optionValueKey] === d)) == null ? void 0 : I[t.optionInputValueKey];
|
|
839
|
-
}
|
|
840
|
-
).join(", ");
|
|
841
|
-
const l = (c = b.value) == null ? void 0 : c.find(
|
|
842
|
-
(d) => d[t.optionValueKey] === t.modelValue
|
|
843
|
-
);
|
|
844
|
-
return V(t.modelValue) || l == null ? void 0 : l[t.optionInputValueKey];
|
|
845
|
-
}), Q = h(
|
|
846
|
-
() => t.listPosition.includes("bottom") ? "maz-slide" : "maz-slideinvert"
|
|
847
|
-
), x = E(""), s = E("");
|
|
848
|
-
function F(l, c) {
|
|
849
|
-
return c && l && me(l).includes(me(c));
|
|
850
|
-
}
|
|
851
|
-
function _(l) {
|
|
852
|
-
var c;
|
|
853
|
-
return l ? (c = b.value) == null ? void 0 : c.filter((d) => {
|
|
854
|
-
const m = d[t.optionLabelKey], I = d[t.optionValueKey], O = d[t.optionInputValueKey], R = t.searchThreshold;
|
|
855
|
-
return F(m, l) || F(O, l) || F(I, l) || typeof m == "string" && ve(m, l, R).isMatching.value || typeof O == "string" && ve(O, l, R).isMatching.value || typeof I == "string" && ve(I, l, R).isMatching.value;
|
|
856
|
-
}) : b.value;
|
|
857
|
-
}
|
|
858
|
-
const G = h(() => _(x.value));
|
|
859
|
-
async function ae(l) {
|
|
860
|
-
var d, m;
|
|
861
|
-
if (!w.value)
|
|
862
|
-
return;
|
|
863
|
-
if (l && ("relatedTarget" in l && ((d = C.value) != null && d.contains(l.relatedTarget)) || l.type === "keydown"))
|
|
864
|
-
return l.preventDefault();
|
|
865
|
-
const c = l && "relatedTarget" in l && l.relatedTarget instanceof HTMLElement && l.relatedTarget.getAttribute("id");
|
|
866
|
-
if ((m = t.excludeSelectors) != null && m.includes(`#${c}`))
|
|
867
|
-
return l == null ? void 0 : l.preventDefault();
|
|
868
|
-
await ue(), L.value = !1, g.value = 0, r("close", l);
|
|
869
|
-
}
|
|
870
|
-
async function ie(l) {
|
|
871
|
-
t.disabled || w.value || (l == null || l.preventDefault(), L.value = !0, await pe(), r("focus", l), r("open", L.value));
|
|
872
|
-
}
|
|
873
|
-
function we() {
|
|
874
|
-
var l, c;
|
|
875
|
-
(c = ((l = W.value) == null ? void 0 : l.$el).querySelector("input")) == null || c.focus();
|
|
876
|
-
}
|
|
877
|
-
function Re() {
|
|
878
|
-
var l, c;
|
|
879
|
-
(c = ((l = W.value) == null ? void 0 : l.$el).querySelector("input")) == null || c.dispatchEvent(new Event("input"));
|
|
880
|
-
}
|
|
881
|
-
function qe(l) {
|
|
882
|
-
L.value ? ae(l) : we();
|
|
883
|
-
}
|
|
884
|
-
function Ye(l) {
|
|
885
|
-
var c, d;
|
|
886
|
-
x.value = l, (d = ((c = X.value) == null ? void 0 : c.$el).querySelector("input")) == null || d.focus();
|
|
887
|
-
}
|
|
888
|
-
function je(l) {
|
|
889
|
-
var d;
|
|
890
|
-
l === "Backspace" && s.value.length > 0 ? s.value = s.value.slice(0, -1) : s.value += l;
|
|
891
|
-
const c = _(s.value);
|
|
892
|
-
c != null && c.length && (g.value = (d = G.value) == null ? void 0 : d.findIndex(
|
|
893
|
-
(m) => m[t.optionValueKey] === c[0][t.optionValueKey]
|
|
894
|
-
), typeof g.value == "number" && g.value >= 0 && pe(g.value)), Vo(() => {
|
|
895
|
-
s.value = "";
|
|
896
|
-
}, 1e3);
|
|
897
|
-
}
|
|
898
|
-
function We(l) {
|
|
899
|
-
const c = l.key;
|
|
900
|
-
/^[\dA-Za-z\u0400-\u04FF]$/.test(c) ? (l.preventDefault(), ie(l), t.search ? Ye(c) : je(c)) : Se(l);
|
|
901
|
-
}
|
|
902
|
-
function Se(l, c = !0) {
|
|
903
|
-
const d = l.code, m = ["ArrowUp", "ArrowDown"].includes(d), I = (c ? ["Enter", "Space"] : ["Enter"]).includes(d), O = d === "Escape" && w.value;
|
|
904
|
-
m ? Qe(l, g.value) : I ? Ge(l, g.value) : O && ae(l);
|
|
905
|
-
}
|
|
906
|
-
function Qe(l, c) {
|
|
907
|
-
var I;
|
|
908
|
-
l.preventDefault();
|
|
909
|
-
const d = l.code;
|
|
910
|
-
w.value || ie(l);
|
|
911
|
-
const m = (I = G.value) == null ? void 0 : I.length;
|
|
912
|
-
m && (typeof c == "number" ? c === m - 1 && d === "ArrowDown" ? g.value = 0 : c === 0 && d === "ArrowUp" ? g.value = m - 1 : g.value = d === "ArrowDown" ? c + 1 : c - 1 : g.value = d === "ArrowDown" ? 0 : m - 1, pe(g.value));
|
|
913
|
-
}
|
|
914
|
-
function Ge(l, c) {
|
|
915
|
-
var m, I, O;
|
|
916
|
-
if (!w.value)
|
|
917
|
-
return;
|
|
918
|
-
l.preventDefault();
|
|
919
|
-
const d = c ? ((m = G.value) == null ? void 0 : m[c]) ?? ((I = G.value) == null ? void 0 : I[0]) : (O = G.value) == null ? void 0 : O[0];
|
|
920
|
-
V(d) || Ve(d);
|
|
921
|
-
}
|
|
922
|
-
async function pe(l) {
|
|
923
|
-
var d, m;
|
|
924
|
-
await ue(), typeof l != "number" && fe();
|
|
925
|
-
const c = l ?? g.value;
|
|
926
|
-
if (typeof c == "number" && c >= 0) {
|
|
927
|
-
const I = (d = n.value) == null ? void 0 : d.querySelectorAll(".m-select-list-item");
|
|
928
|
-
(m = I == null ? void 0 : I[c]) == null || m.scrollIntoView({
|
|
929
|
-
behavior: "auto",
|
|
930
|
-
block: "nearest",
|
|
931
|
-
inline: "start"
|
|
932
|
-
});
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
function fe(l) {
|
|
936
|
-
var d;
|
|
937
|
-
const c = (d = G.value) == null ? void 0 : d.findIndex((m) => {
|
|
938
|
-
var I, O;
|
|
939
|
-
return t.multiple && Array.isArray(t.modelValue) ? l ? l[t.optionValueKey] === m[t.optionValueKey] : [...t.modelValue].reverse()[0] === m[t.optionValueKey] : ((O = (I = S.value) == null ? void 0 : I[0]) == null ? void 0 : O[t.optionValueKey]) === m[t.optionValueKey];
|
|
940
|
-
});
|
|
941
|
-
g.value = c && c >= 0 ? c : 0;
|
|
942
|
-
}
|
|
943
|
-
function Ve(l, c = !0) {
|
|
944
|
-
var O;
|
|
945
|
-
c && !t.multiple && ue(() => ae()), x.value = "";
|
|
946
|
-
const d = (O = S.value) == null ? void 0 : O.some(
|
|
947
|
-
(R) => R[t.optionValueKey] === l[t.optionValueKey]
|
|
948
|
-
);
|
|
949
|
-
let m = S.value;
|
|
950
|
-
d && t.multiple ? m = m == null ? void 0 : m.filter(
|
|
951
|
-
(R) => R[t.optionValueKey] !== l[t.optionValueKey]
|
|
952
|
-
) : t.multiple ? m.push(l) : m = [l];
|
|
953
|
-
const I = m.map((R) => R[t.optionValueKey]);
|
|
954
|
-
r("update:model-value", t.multiple ? I : I[0]), r("selected-option", l), Re(), fe(l), we();
|
|
955
|
-
}
|
|
956
|
-
return (l, c) => ze((y(), P(
|
|
957
|
-
"div",
|
|
958
|
-
{
|
|
959
|
-
ref_key: "mazSelectElement",
|
|
960
|
-
ref: C,
|
|
961
|
-
class: T(["m-select", [
|
|
962
|
-
{ "--is-open": w.value, "--disabled": l.disabled, "--block": l.block },
|
|
963
|
-
t.class,
|
|
964
|
-
`--${l.size}`
|
|
965
|
-
]]),
|
|
966
|
-
style: oe([l.style, { "--keyboard-selected-bg-color": z.value, "--selected-bg-color": f.value, "--selected-text-color": i.value }])
|
|
967
|
-
},
|
|
968
|
-
[
|
|
969
|
-
U(Ce, le({
|
|
970
|
-
id: k(H),
|
|
971
|
-
ref_key: "mazInputComponent",
|
|
972
|
-
ref: W,
|
|
973
|
-
class: "m-select-input"
|
|
974
|
-
}, l.$attrs, {
|
|
975
|
-
required: l.required,
|
|
976
|
-
"border-active": L.value,
|
|
977
|
-
color: l.color,
|
|
978
|
-
"model-value": M.value,
|
|
979
|
-
size: l.size,
|
|
980
|
-
block: "",
|
|
981
|
-
autocomplete: l.autocomplete,
|
|
982
|
-
disabled: l.disabled,
|
|
983
|
-
onFocus: se(ie, ["prevent", "stop"]),
|
|
984
|
-
onBlur: se(ae, ["prevent", "stop"]),
|
|
985
|
-
onClick: se(ie, ["prevent", "stop"]),
|
|
986
|
-
onChange: c[0] || (c[0] = (d) => r("change", d)),
|
|
987
|
-
onInput: c[1] || (c[1] = (d) => r("input", d)),
|
|
988
|
-
onKeydown: We
|
|
989
|
-
}), {
|
|
990
|
-
"right-icon": J(() => [
|
|
991
|
-
Y("button", {
|
|
992
|
-
tabindex: "-1",
|
|
993
|
-
type: "button",
|
|
994
|
-
class: "m-select-input__toggle-button maz-custom",
|
|
995
|
-
"aria-label": `${w.value ? "collapse" : "expand"} list of options`,
|
|
996
|
-
onClick: se(qe, ["stop"])
|
|
997
|
-
}, [
|
|
998
|
-
U(k(p), { class: "m-select-chevron maz-text-xl" })
|
|
999
|
-
], 8, Mo)
|
|
1000
|
-
]),
|
|
1001
|
-
_: 1
|
|
1002
|
-
/* STABLE */
|
|
1003
|
-
}, 16, ["id", "required", "border-active", "color", "model-value", "size", "autocomplete", "disabled"]),
|
|
1004
|
-
U(lo, { name: Q.value }, {
|
|
1005
|
-
default: J(() => [
|
|
1006
|
-
w.value ? (y(), P(
|
|
1007
|
-
"div",
|
|
1008
|
-
{
|
|
1009
|
-
key: 0,
|
|
1010
|
-
ref_key: "optionsListElement",
|
|
1011
|
-
ref: n,
|
|
1012
|
-
class: T(["m-select-list", {
|
|
1013
|
-
"--top": l.listPosition.includes("top"),
|
|
1014
|
-
"--left": l.listPosition.includes("left"),
|
|
1015
|
-
"--right": l.listPosition.includes("right"),
|
|
1016
|
-
"--bottom": l.listPosition.includes("bottom")
|
|
1017
|
-
}]),
|
|
1018
|
-
style: oe({
|
|
1019
|
-
maxHeight: `${l.maxListHeight}px`,
|
|
1020
|
-
maxWidth: `${l.maxListWidth}px`,
|
|
1021
|
-
minHeight: `${l.minListHeight}px`,
|
|
1022
|
-
minWidth: `${l.minListWidth}px`
|
|
1023
|
-
})
|
|
1024
|
-
},
|
|
1025
|
-
[
|
|
1026
|
-
l.search ? (y(), K(Ce, {
|
|
1027
|
-
key: 0,
|
|
1028
|
-
ref_key: "searchInputComponent",
|
|
1029
|
-
ref: X,
|
|
1030
|
-
modelValue: x.value,
|
|
1031
|
-
"onUpdate:modelValue": [
|
|
1032
|
-
c[2] || (c[2] = (d) => x.value = d),
|
|
1033
|
-
c[4] || (c[4] = (d) => g.value = 0)
|
|
1034
|
-
],
|
|
1035
|
-
size: "sm",
|
|
1036
|
-
color: l.color,
|
|
1037
|
-
placeholder: l.searchPlaceholder,
|
|
1038
|
-
name: "search",
|
|
1039
|
-
inputmode: "search",
|
|
1040
|
-
block: "",
|
|
1041
|
-
autocomplete: "off",
|
|
1042
|
-
tabindex: "-1",
|
|
1043
|
-
class: "m-select-list__search-input maz-flex-none",
|
|
1044
|
-
"left-icon": k(v),
|
|
1045
|
-
onKeydown: c[3] || (c[3] = (d) => Se(d, !1))
|
|
1046
|
-
}, null, 8, ["modelValue", "color", "placeholder", "left-icon"])) : $("v-if", !0),
|
|
1047
|
-
!G.value || G.value.length <= 0 ? N(l.$slots, "no-results", { key: 1 }, () => [
|
|
1048
|
-
Y("span", To, [
|
|
1049
|
-
U(k(B), { class: "maz-h-6 maz-w-6 maz-text-normal" })
|
|
1050
|
-
])
|
|
1051
|
-
], !0) : (y(), P("div", Fo, [
|
|
1052
|
-
(y(!0), P(
|
|
1053
|
-
be,
|
|
1054
|
-
null,
|
|
1055
|
-
Be(G.value, (d, m) => (y(), P(
|
|
1056
|
-
be,
|
|
1057
|
-
{ key: m },
|
|
1058
|
-
[
|
|
1059
|
-
d.label && d.isOptGroup ? N(l.$slots, "optgroup", {
|
|
1060
|
-
key: 0,
|
|
1061
|
-
label: d.label
|
|
1062
|
-
}, () => [
|
|
1063
|
-
Y(
|
|
1064
|
-
"span",
|
|
1065
|
-
No,
|
|
1066
|
-
te(d.label),
|
|
1067
|
-
1
|
|
1068
|
-
/* TEXT */
|
|
1069
|
-
)
|
|
1070
|
-
], !0) : (y(), P("button", {
|
|
1071
|
-
key: 1,
|
|
1072
|
-
tabindex: "-1",
|
|
1073
|
-
type: "button",
|
|
1074
|
-
class: T(["m-select-list-item maz-custom maz-flex-none", [
|
|
1075
|
-
{
|
|
1076
|
-
"--is-keyboard-selected": g.value === m,
|
|
1077
|
-
"--is-selected": D(d),
|
|
1078
|
-
"--is-none-value": V(d[l.optionValueKey])
|
|
1079
|
-
}
|
|
1080
|
-
]]),
|
|
1081
|
-
style: oe(l.itemHeight ? { height: `${l.itemHeight}px` } : void 0),
|
|
1082
|
-
onClick: se((I) => Ve(d), ["prevent", "stop"])
|
|
1083
|
-
}, [
|
|
1084
|
-
l.multiple ? (y(), K(k(u), {
|
|
1085
|
-
key: 0,
|
|
1086
|
-
tabindex: "-1",
|
|
1087
|
-
"model-value": D(d),
|
|
1088
|
-
size: "sm",
|
|
1089
|
-
color: l.color
|
|
1090
|
-
}, null, 8, ["model-value", "color"])) : $("v-if", !0),
|
|
1091
|
-
N(l.$slots, "default", {
|
|
1092
|
-
option: d,
|
|
1093
|
-
isSelected: D(d)
|
|
1094
|
-
}, () => [
|
|
1095
|
-
Y(
|
|
1096
|
-
"span",
|
|
1097
|
-
null,
|
|
1098
|
-
te(d[l.optionLabelKey]),
|
|
1099
|
-
1
|
|
1100
|
-
/* TEXT */
|
|
1101
|
-
)
|
|
1102
|
-
], !0)
|
|
1103
|
-
], 14, Ko))
|
|
1104
|
-
],
|
|
1105
|
-
64
|
|
1106
|
-
/* STABLE_FRAGMENT */
|
|
1107
|
-
))),
|
|
1108
|
-
128
|
|
1109
|
-
/* KEYED_FRAGMENT */
|
|
1110
|
-
))
|
|
1111
|
-
]))
|
|
1112
|
-
],
|
|
1113
|
-
6
|
|
1114
|
-
/* CLASS, STYLE */
|
|
1115
|
-
)) : $("v-if", !0)
|
|
1116
|
-
]),
|
|
1117
|
-
_: 3
|
|
1118
|
-
/* FORWARDED */
|
|
1119
|
-
}, 8, ["name"])
|
|
1120
|
-
],
|
|
1121
|
-
6
|
|
1122
|
-
/* CLASS, STYLE */
|
|
1123
|
-
)), [
|
|
1124
|
-
[k(So), {
|
|
1125
|
-
exclude: l.excludeSelectors,
|
|
1126
|
-
handler: ae
|
|
1127
|
-
}]
|
|
1128
|
-
]);
|
|
1129
|
-
}
|
|
1130
|
-
}), Ho = /* @__PURE__ */ re(Uo, [["__scopeId", "data-v-07cbef8c"]]);
|
|
1131
|
-
function Ue() {
|
|
1132
|
-
if (typeof window > "u")
|
|
1133
|
-
return;
|
|
1134
|
-
const a = window.navigator.language;
|
|
1135
|
-
if (!a)
|
|
1136
|
-
return;
|
|
1137
|
-
let o = a.slice(3, 7).toUpperCase();
|
|
1138
|
-
return o === "" && (o = a.slice(0, 2).toUpperCase()), o === "EN" && (o = "US"), o === "JA" && (o = "JP"), {
|
|
1139
|
-
locale: o,
|
|
1140
|
-
browserLocale: a
|
|
1141
|
-
};
|
|
1142
|
-
}
|
|
1143
|
-
let ge, $e;
|
|
1144
|
-
function Do(a, o, e) {
|
|
1145
|
-
return e != null && e[o] ? e[o] : (($e !== a || !ge) && ($e = a, ge = new Intl.DisplayNames([a], { type: "region" })), ge.of(o));
|
|
1146
|
-
}
|
|
1147
|
-
function Ro(a, o) {
|
|
1148
|
-
var r;
|
|
1149
|
-
const e = [], t = Me();
|
|
1150
|
-
a = a ?? ((r = Ue()) == null ? void 0 : r.browserLocale) ?? "en-US";
|
|
1151
|
-
for (const u of t) {
|
|
1152
|
-
const v = Do(a, u, o);
|
|
1153
|
-
if (v)
|
|
1154
|
-
try {
|
|
1155
|
-
const p = ce(u);
|
|
1156
|
-
e.push({
|
|
1157
|
-
iso2: u,
|
|
1158
|
-
dialCode: p,
|
|
1159
|
-
name: v
|
|
1160
|
-
});
|
|
1161
|
-
} catch (p) {
|
|
1162
|
-
console.error(`[MazPhoneNumberInput](getCountryCallingCode) ${p}`);
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
|
-
return e;
|
|
1166
|
-
}
|
|
1167
|
-
async function qo() {
|
|
1168
|
-
try {
|
|
1169
|
-
const a = await fetch("https://ipwho.is"), { country_code: o } = await a.json();
|
|
1170
|
-
return o;
|
|
1171
|
-
} catch (a) {
|
|
1172
|
-
throw new Error(`[MazPhoneNumberInput](fetchCountryCode) ${a}`);
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
function Yo(a) {
|
|
1176
|
-
if (!a)
|
|
1177
|
-
return "";
|
|
1178
|
-
const o = new RegExp(/[^\d ()+-]/g);
|
|
1179
|
-
return a.replaceAll(o, "").trim();
|
|
1180
|
-
}
|
|
1181
|
-
function He() {
|
|
1182
|
-
return {
|
|
1183
|
-
sanitizePhoneNumber: Yo,
|
|
1184
|
-
fetchCountryCode: qo,
|
|
1185
|
-
getBrowserLocale: Ue,
|
|
1186
|
-
getCountriesList: Ro
|
|
1187
|
-
};
|
|
1188
|
-
}
|
|
1189
|
-
const jo = ["id"], Wo = {
|
|
1190
|
-
key: 0,
|
|
1191
|
-
class: "m-country-selector__select__item__flag-container"
|
|
1192
|
-
}, Qo = /* @__PURE__ */ ne({
|
|
1193
|
-
__name: "CountrySelector",
|
|
1194
|
-
props: {
|
|
1195
|
-
style: { default: void 0 },
|
|
1196
|
-
class: { default: void 0 },
|
|
1197
|
-
modelValue: { default: void 0 },
|
|
1198
|
-
id: {},
|
|
1199
|
-
color: {},
|
|
1200
|
-
size: {},
|
|
1201
|
-
preferredCountries: { default: void 0 },
|
|
1202
|
-
ignoredCountries: { default: void 0 },
|
|
1203
|
-
onlyCountries: { default: void 0 },
|
|
1204
|
-
customCountriesList: { default: void 0 },
|
|
1205
|
-
locales: {},
|
|
1206
|
-
listPosition: { default: "bottom left" },
|
|
1207
|
-
noFlags: { type: Boolean },
|
|
1208
|
-
noSearch: { type: Boolean },
|
|
1209
|
-
disabled: { type: Boolean },
|
|
1210
|
-
showCodeOnList: { type: Boolean },
|
|
1211
|
-
countryLocale: { default: void 0 },
|
|
1212
|
-
success: { type: Boolean },
|
|
1213
|
-
error: { type: Boolean },
|
|
1214
|
-
countrySelectorDisplayName: { type: Boolean },
|
|
1215
|
-
searchThreshold: {},
|
|
1216
|
-
width: { default: "9rem" },
|
|
1217
|
-
excludeSelectors: { default: void 0 }
|
|
1218
|
-
},
|
|
1219
|
-
emits: ["update:model-value"],
|
|
1220
|
-
setup(a) {
|
|
1221
|
-
const o = a, { phoneNumber: e } = Te("data"), t = E(), { getCountriesList: r } = He(), u = h(() => r(o.countryLocale, o.customCountriesList)), v = h(
|
|
1222
|
-
() => {
|
|
1223
|
-
var i;
|
|
1224
|
-
return (i = u.value) == null ? void 0 : i.filter((f) => {
|
|
1225
|
-
var z;
|
|
1226
|
-
return !((z = o.ignoredCountries) != null && z.includes(f.iso2));
|
|
1227
|
-
});
|
|
1228
|
-
}
|
|
1229
|
-
), p = h(() => {
|
|
1230
|
-
const i = o.onlyCountries || o.preferredCountries;
|
|
1231
|
-
return i == null ? void 0 : i.map(
|
|
1232
|
-
(f) => {
|
|
1233
|
-
var z;
|
|
1234
|
-
return (z = v.value) == null ? void 0 : z.find((w) => w.iso2.includes(f));
|
|
1235
|
-
}
|
|
1236
|
-
);
|
|
1237
|
-
}), B = h(
|
|
1238
|
-
() => {
|
|
1239
|
-
var i;
|
|
1240
|
-
return (i = v.value) == null ? void 0 : i.filter((f) => {
|
|
1241
|
-
var z;
|
|
1242
|
-
return !((z = o.preferredCountries) != null && z.includes(f.iso2));
|
|
1243
|
-
});
|
|
1244
|
-
}
|
|
1245
|
-
), L = h(
|
|
1246
|
-
() => o.preferredCountries ? [...p.value ?? [], ...B.value ?? []] : o.onlyCountries ? p.value : v.value
|
|
1247
|
-
), g = h(
|
|
1248
|
-
() => {
|
|
1249
|
-
var i;
|
|
1250
|
-
return (i = L.value) == null ? void 0 : i.map(
|
|
1251
|
-
(f) => f ? {
|
|
1252
|
-
...f,
|
|
1253
|
-
dialCode: `+${f.dialCode}`
|
|
1254
|
-
} : void 0
|
|
1255
|
-
).filter(co);
|
|
1256
|
-
}
|
|
1257
|
-
);
|
|
1258
|
-
function A() {
|
|
1259
|
-
var i;
|
|
1260
|
-
(i = t.value) == null || i.openList();
|
|
1261
|
-
}
|
|
1262
|
-
return (i, f) => (y(), P(
|
|
1263
|
-
"div",
|
|
1264
|
-
{
|
|
1265
|
-
class: T(["m-country-selector", [o.class, { "--no-flags": i.noFlags }]]),
|
|
1266
|
-
style: oe(i.style)
|
|
1267
|
-
},
|
|
1268
|
-
[
|
|
1269
|
-
i.modelValue && !i.noFlags ? (y(), P("button", {
|
|
1270
|
-
key: 0,
|
|
1271
|
-
id: `country-selector-flag-button-${i.id}`,
|
|
1272
|
-
class: T(["m-country-selector__country-flag", {
|
|
1273
|
-
"--should-have-bottom-flag": i.locales.countrySelector.placeholder.length > 0
|
|
1274
|
-
}]),
|
|
1275
|
-
tabindex: "-1",
|
|
1276
|
-
type: "button",
|
|
1277
|
-
onClick: A
|
|
1278
|
-
}, [
|
|
1279
|
-
N(i.$slots, "selector-flag", { countryCode: i.modelValue }, () => [
|
|
1280
|
-
U(Ee, {
|
|
1281
|
-
src: k(Le)(i.modelValue, "h20"),
|
|
1282
|
-
alt: i.modelValue,
|
|
1283
|
-
width: "20",
|
|
1284
|
-
height: "20",
|
|
1285
|
-
"img-class": "maz-w-5 maz-h-4 maz-rounded-sm"
|
|
1286
|
-
}, null, 8, ["src", "alt"])
|
|
1287
|
-
], !0)
|
|
1288
|
-
], 10, jo)) : $("v-if", !0),
|
|
1289
|
-
U(Ho, le({
|
|
1290
|
-
id: `country-selector-${i.id}`,
|
|
1291
|
-
ref_key: "CountrySelectorRef",
|
|
1292
|
-
ref: t,
|
|
1293
|
-
"model-value": i.modelValue
|
|
1294
|
-
}, { ...i.$attrs }, {
|
|
1295
|
-
class: "m-country-selector__select",
|
|
1296
|
-
"option-value-key": "iso2",
|
|
1297
|
-
"option-label-key": "name",
|
|
1298
|
-
"option-input-value-key": i.countrySelectorDisplayName ? "name" : "dialCode",
|
|
1299
|
-
name: "country",
|
|
1300
|
-
"max-list-width": 250,
|
|
1301
|
-
"min-list-width": 200,
|
|
1302
|
-
disabled: i.disabled,
|
|
1303
|
-
color: i.color,
|
|
1304
|
-
size: i.size,
|
|
1305
|
-
error: i.error,
|
|
1306
|
-
"list-position": i.listPosition,
|
|
1307
|
-
"item-height": 38,
|
|
1308
|
-
success: i.success,
|
|
1309
|
-
search: !i.noSearch,
|
|
1310
|
-
"search-placeholder": i.locales.countrySelector.searchPlaceholder,
|
|
1311
|
-
"search-threshold": i.searchThreshold,
|
|
1312
|
-
options: g.value,
|
|
1313
|
-
hint: k(e) && !i.modelValue ? i.locales.countrySelector.error : void 0,
|
|
1314
|
-
label: i.locales.countrySelector.placeholder,
|
|
1315
|
-
style: {
|
|
1316
|
-
width: i.width
|
|
1317
|
-
},
|
|
1318
|
-
"exclude-selectors": [`#country-selector-flag-button-${i.id}`, ...i.excludeSelectors ?? []],
|
|
1319
|
-
"onUpdate:modelValue": f[0] || (f[0] = (z) => i.$emit("update:model-value", z))
|
|
1320
|
-
}), {
|
|
1321
|
-
"no-results": J(() => [
|
|
1322
|
-
N(i.$slots, "no-results", {}, void 0, !0)
|
|
1323
|
-
]),
|
|
1324
|
-
default: J(({ option: z, isSelected: w }) => [
|
|
1325
|
-
Y(
|
|
1326
|
-
"div",
|
|
1327
|
-
{
|
|
1328
|
-
class: T(["m-country-selector__select__item", {
|
|
1329
|
-
"m-country-selector__select__item--selected": w
|
|
1330
|
-
}])
|
|
1331
|
-
},
|
|
1332
|
-
[
|
|
1333
|
-
!i.noFlags && typeof z.iso2 == "string" ? (y(), P("span", Wo, [
|
|
1334
|
-
N(i.$slots, "country-list-flag", {
|
|
1335
|
-
countryCode: z.iso2,
|
|
1336
|
-
option: z,
|
|
1337
|
-
isSelected: w
|
|
1338
|
-
}, () => [
|
|
1339
|
-
U(Ee, {
|
|
1340
|
-
src: k(Le)(z.iso2, "h20"),
|
|
1341
|
-
alt: `${z.name} flag`,
|
|
1342
|
-
width: "20",
|
|
1343
|
-
height: "20",
|
|
1344
|
-
"img-class": "maz-rounded-full maz-w-5 maz-h-5"
|
|
1345
|
-
}, null, 8, ["src", "alt"])
|
|
1346
|
-
], !0)
|
|
1347
|
-
])) : $("v-if", !0),
|
|
1348
|
-
i.showCodeOnList ? (y(), P(
|
|
1349
|
-
"span",
|
|
1350
|
-
{
|
|
1351
|
-
key: 1,
|
|
1352
|
-
class: T(["maz-w-9 maz-flex-none", { "maz-text-muted": !w }])
|
|
1353
|
-
},
|
|
1354
|
-
te(z.dialCode),
|
|
1355
|
-
3
|
|
1356
|
-
/* TEXT, CLASS */
|
|
1357
|
-
)) : $("v-if", !0),
|
|
1358
|
-
Y(
|
|
1359
|
-
"span",
|
|
1360
|
-
{
|
|
1361
|
-
class: T(["maz-flex-1 maz-truncate", { "maz-font-semibold": w }])
|
|
1362
|
-
},
|
|
1363
|
-
te(z.name),
|
|
1364
|
-
3
|
|
1365
|
-
/* TEXT, CLASS */
|
|
1366
|
-
)
|
|
1367
|
-
],
|
|
1368
|
-
2
|
|
1369
|
-
/* CLASS */
|
|
1370
|
-
)
|
|
1371
|
-
]),
|
|
1372
|
-
_: 3
|
|
1373
|
-
/* FORWARDED */
|
|
1374
|
-
}, 16, ["id", "model-value", "option-input-value-key", "disabled", "color", "size", "error", "list-position", "success", "search", "search-placeholder", "search-threshold", "options", "hint", "label", "style", "exclude-selectors"])
|
|
1375
|
-
],
|
|
1376
|
-
6
|
|
1377
|
-
/* CLASS, STYLE */
|
|
1378
|
-
));
|
|
1379
|
-
}
|
|
1380
|
-
}), Go = /* @__PURE__ */ re(Qo, [["__scopeId", "data-v-e2fee821"]]), Jo = {
|
|
1381
|
-
countrySelector: {
|
|
1382
|
-
placeholder: "Country code",
|
|
1383
|
-
error: "Choose country",
|
|
1384
|
-
searchPlaceholder: "Search the country"
|
|
1385
|
-
},
|
|
1386
|
-
phoneInput: {
|
|
1387
|
-
placeholder: "Phone number",
|
|
1388
|
-
example: "Example:"
|
|
1389
|
-
}
|
|
1390
|
-
};
|
|
1391
|
-
function Zo(a) {
|
|
1392
|
-
try {
|
|
1393
|
-
const o = no(a);
|
|
1394
|
-
return o || (console.error(`[maz-ui](MazPhoneNumberInput) The code country "${a}" is not available`), !1);
|
|
1395
|
-
} catch (o) {
|
|
1396
|
-
return console.error(`[maz-ui](MazPhoneNumberInput) ${o}`), !1;
|
|
1397
|
-
}
|
|
1398
|
-
}
|
|
1399
|
-
function Xo({
|
|
1400
|
-
phoneNumber: a,
|
|
1401
|
-
countryCode: o
|
|
1402
|
-
}) {
|
|
1403
|
-
try {
|
|
1404
|
-
if (!a)
|
|
1405
|
-
return {
|
|
1406
|
-
isValid: !1,
|
|
1407
|
-
countryCode: o
|
|
1408
|
-
};
|
|
1409
|
-
const e = ro(a, o ?? void 0), t = (e == null ? void 0 : e.isValid()) ?? !1;
|
|
1410
|
-
return {
|
|
1411
|
-
countryCode: e == null ? void 0 : e.country,
|
|
1412
|
-
isValid: t,
|
|
1413
|
-
isPossible: e == null ? void 0 : e.isPossible(),
|
|
1414
|
-
countryCallingCode: e == null ? void 0 : e.countryCallingCode,
|
|
1415
|
-
nationalNumber: e == null ? void 0 : e.nationalNumber,
|
|
1416
|
-
type: e == null ? void 0 : e.getType(),
|
|
1417
|
-
formatInternational: e == null ? void 0 : e.formatInternational(),
|
|
1418
|
-
formatNational: e == null ? void 0 : e.formatNational(),
|
|
1419
|
-
uri: e == null ? void 0 : e.getURI(),
|
|
1420
|
-
e164: e == null ? void 0 : e.format("E.164"),
|
|
1421
|
-
rfc3966: e == null ? void 0 : e.format("RFC3966"),
|
|
1422
|
-
possibleCountries: e == null ? void 0 : e.getPossibleCountries(),
|
|
1423
|
-
phoneNumber: a
|
|
1424
|
-
};
|
|
1425
|
-
} catch (e) {
|
|
1426
|
-
throw new Error(`[MazPhoneNumberInput](getResultsFromPhoneNumber) ${e}`);
|
|
1427
|
-
}
|
|
1428
|
-
}
|
|
1429
|
-
async function xo() {
|
|
1430
|
-
const { default: a } = await import("./examples.mobile.json-JpNGylGv.mjs");
|
|
1431
|
-
return a;
|
|
1432
|
-
}
|
|
1433
|
-
function _o(a, o) {
|
|
1434
|
-
var e;
|
|
1435
|
-
try {
|
|
1436
|
-
return a && o ? (e = io(o, a)) == null ? void 0 : e.formatNational() : void 0;
|
|
1437
|
-
} catch (t) {
|
|
1438
|
-
console.error(`[maz-ui](MazPhoneNumberInput) ${t}`);
|
|
1439
|
-
}
|
|
1440
|
-
}
|
|
1441
|
-
function et(a, o) {
|
|
1442
|
-
try {
|
|
1443
|
-
return !o || !a ? void 0 : new uo(a).input(o);
|
|
1444
|
-
} catch (e) {
|
|
1445
|
-
throw new Error(`[MazPhoneNumberInput](getAsYouTypeFormat) ${e}`);
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
function De() {
|
|
1449
|
-
function a(o, e) {
|
|
1450
|
-
return ce(o) === ce(e);
|
|
1451
|
-
}
|
|
1452
|
-
return {
|
|
1453
|
-
getAsYouTypeFormat: et,
|
|
1454
|
-
getPhoneNumberResults: Xo,
|
|
1455
|
-
getPhoneNumberExamplesFile: xo,
|
|
1456
|
-
getPhoneNumberExample: _o,
|
|
1457
|
-
isSameCountryCallingCode: a,
|
|
1458
|
-
isCountryAvailable: Zo,
|
|
1459
|
-
getCountries: Me,
|
|
1460
|
-
getCountryCallingCode: ce
|
|
1461
|
-
};
|
|
1462
|
-
}
|
|
1463
|
-
const ot = /* @__PURE__ */ ne({
|
|
1464
|
-
__name: "PhoneInput",
|
|
1465
|
-
props: /* @__PURE__ */ Pe({
|
|
1466
|
-
id: {},
|
|
1467
|
-
color: {},
|
|
1468
|
-
size: {},
|
|
1469
|
-
locales: {},
|
|
1470
|
-
label: { default: void 0 },
|
|
1471
|
-
placeholder: { default: void 0 },
|
|
1472
|
-
noExample: { type: Boolean },
|
|
1473
|
-
disabled: { type: Boolean },
|
|
1474
|
-
hasRadius: { type: Boolean },
|
|
1475
|
-
success: { type: Boolean },
|
|
1476
|
-
error: { type: Boolean },
|
|
1477
|
-
autoFormat: { type: Boolean },
|
|
1478
|
-
noFormattingAsYouType: { type: Boolean }
|
|
1479
|
-
}, {
|
|
1480
|
-
modelValue: {},
|
|
1481
|
-
modelModifiers: {}
|
|
1482
|
-
}),
|
|
1483
|
-
emits: /* @__PURE__ */ Pe(["update:model-value"], ["update:modelValue"]),
|
|
1484
|
-
setup(a, { emit: o }) {
|
|
1485
|
-
const e = a, t = o, r = ao(a, "modelValue"), { getPhoneNumberExamplesFile: u, getPhoneNumberExample: v } = De(), { selectionRange: p, results: B, selectedCountry: L } = Te("data"), g = E(), A = E(!1);
|
|
1486
|
-
function i(b, S) {
|
|
1487
|
-
const C = v(b, S);
|
|
1488
|
-
return C ? `${e.locales.phoneInput.example} ${C}` : void 0;
|
|
1489
|
-
}
|
|
1490
|
-
const f = h(() => {
|
|
1491
|
-
var S;
|
|
1492
|
-
if (e.label || e.placeholder)
|
|
1493
|
-
return e.label || e.placeholder;
|
|
1494
|
-
const b = e.locales.phoneInput.placeholder;
|
|
1495
|
-
if (e.noExample || !g.value)
|
|
1496
|
-
return b;
|
|
1497
|
-
{
|
|
1498
|
-
const C = i(g.value, L.value);
|
|
1499
|
-
return (S = B.value) != null && S.isValid || !C ? b : C;
|
|
1500
|
-
}
|
|
1501
|
-
}), z = h(() => e.placeholder ? {
|
|
1502
|
-
placeholder: f.value
|
|
1503
|
-
} : {
|
|
1504
|
-
label: f.value
|
|
1505
|
-
}), w = E();
|
|
1506
|
-
async function H() {
|
|
1507
|
-
try {
|
|
1508
|
-
if (g.value)
|
|
1509
|
-
return;
|
|
1510
|
-
g.value = await u();
|
|
1511
|
-
} catch (b) {
|
|
1512
|
-
console.error("[maz-ui](MazPhoneNumberInput) while loading phone number examples file", b);
|
|
1513
|
-
}
|
|
1514
|
-
}
|
|
1515
|
-
async function j(b) {
|
|
1516
|
-
w.value && b && Z(w.value, b), await ue(), t("update:model-value", b);
|
|
1517
|
-
}
|
|
1518
|
-
function Z(b, S) {
|
|
1519
|
-
const C = b.$el.querySelector("input");
|
|
1520
|
-
p.value.start = C == null ? void 0 : C.selectionStart, p.value.end = C == null ? void 0 : C.selectionEnd, p.value.cursorAtEnd = S && typeof p.value.start == "number" && S.length > 0 ? p.value.start >= S.length : !0;
|
|
1521
|
-
}
|
|
1522
|
-
return Ie(() => {
|
|
1523
|
-
e.noExample || H();
|
|
1524
|
-
}), (b, S) => (y(), K(Ce, le({
|
|
1525
|
-
id: b.id,
|
|
1526
|
-
ref_key: "PhoneInputRef",
|
|
1527
|
-
ref: w,
|
|
1528
|
-
"model-value": r.value
|
|
1529
|
-
}, { ...b.$attrs, ...z.value }, {
|
|
1530
|
-
disabled: b.disabled,
|
|
1531
|
-
color: b.color,
|
|
1532
|
-
error: b.error,
|
|
1533
|
-
size: b.size,
|
|
1534
|
-
success: b.success,
|
|
1535
|
-
class: ["m-phone-input", [
|
|
1536
|
-
{
|
|
1537
|
-
"--border-radius": b.hasRadius,
|
|
1538
|
-
"--error": b.error || !k(B).isValid,
|
|
1539
|
-
"--focused": A.value
|
|
1540
|
-
}
|
|
1541
|
-
]],
|
|
1542
|
-
onFocus: S[0] || (S[0] = (C) => A.value = !0),
|
|
1543
|
-
onBlur: S[1] || (S[1] = (C) => A.value = !1),
|
|
1544
|
-
"onUpdate:modelValue": S[2] || (S[2] = (C) => j(C))
|
|
1545
|
-
}), null, 16, ["id", "model-value", "disabled", "color", "error", "size", "success", "class"]));
|
|
1546
|
-
}
|
|
1547
|
-
}), tt = /* @__PURE__ */ re(ot, [["__scopeId", "data-v-fcb760a8"]]), lt = /* @__PURE__ */ ne({
|
|
1548
|
-
name: "MazPhoneNumberInput",
|
|
1549
|
-
inheritAttrs: !1,
|
|
1550
|
-
__name: "MazPhoneNumberInput",
|
|
1551
|
-
props: {
|
|
1552
|
-
style: { default: void 0 },
|
|
1553
|
-
class: { default: void 0 },
|
|
1554
|
-
modelValue: { default: void 0 },
|
|
1555
|
-
defaultPhoneNumber: { default: void 0 },
|
|
1556
|
-
countryCode: { default: void 0 },
|
|
1557
|
-
defaultCountryCode: { default: void 0 },
|
|
1558
|
-
id: { default: void 0 },
|
|
1559
|
-
placeholder: { default: void 0 },
|
|
1560
|
-
label: { default: void 0 },
|
|
1561
|
-
preferredCountries: { default: void 0 },
|
|
1562
|
-
ignoredCountries: { default: void 0 },
|
|
1563
|
-
onlyCountries: { default: void 0 },
|
|
1564
|
-
translations: { default: void 0 },
|
|
1565
|
-
listPosition: { default: "bottom left" },
|
|
1566
|
-
color: { default: "primary" },
|
|
1567
|
-
size: { default: "md" },
|
|
1568
|
-
noFlags: { type: Boolean },
|
|
1569
|
-
disabled: { type: Boolean },
|
|
1570
|
-
noExample: { type: Boolean },
|
|
1571
|
-
noSearch: { type: Boolean },
|
|
1572
|
-
searchThreshold: { default: 0.75 },
|
|
1573
|
-
noUseBrowserLocale: { type: Boolean },
|
|
1574
|
-
fetchCountry: { type: Boolean },
|
|
1575
|
-
noCountrySelector: { type: Boolean },
|
|
1576
|
-
showCodeOnList: { type: Boolean },
|
|
1577
|
-
customCountriesList: { default: void 0 },
|
|
1578
|
-
autoFormat: { type: Boolean, default: !0 },
|
|
1579
|
-
noFormattingAsYouType: { type: Boolean, default: !1 },
|
|
1580
|
-
countryLocale: { default: void 0 },
|
|
1581
|
-
noValidationError: { type: Boolean },
|
|
1582
|
-
noValidationSuccess: { type: Boolean },
|
|
1583
|
-
success: { type: Boolean },
|
|
1584
|
-
error: { type: Boolean },
|
|
1585
|
-
countrySelectorDisplayName: { type: Boolean },
|
|
1586
|
-
countrySelectorWidth: { default: "9rem" },
|
|
1587
|
-
block: { type: Boolean },
|
|
1588
|
-
excludeSelectors: { default: void 0 },
|
|
1589
|
-
orientation: { default: "responsive" },
|
|
1590
|
-
countrySelectAttributes: { default: () => ({
|
|
1591
|
-
name: "country",
|
|
1592
|
-
autocomplete: "off"
|
|
1593
|
-
}) },
|
|
1594
|
-
phoneInputAttributes: { default: () => ({
|
|
1595
|
-
name: "phone",
|
|
1596
|
-
autocomplete: "tel",
|
|
1597
|
-
inputmode: "tel"
|
|
1598
|
-
}) }
|
|
1599
|
-
},
|
|
1600
|
-
emits: ["update:model-value", "country-code", "update:country-code", "update", "data"],
|
|
1601
|
-
setup(a, { emit: o }) {
|
|
1602
|
-
const e = a, t = o, { fetchCountryCode: r, sanitizePhoneNumber: u, getBrowserLocale: v } = He(), { isCountryAvailable: p, getPhoneNumberResults: B, getAsYouTypeFormat: L } = De(), g = Ae({
|
|
1603
|
-
componentName: "MazPhoneNumberInput",
|
|
1604
|
-
providedId: e.id
|
|
1605
|
-
}), A = E(), i = E(), f = E({
|
|
1606
|
-
isValid: !1,
|
|
1607
|
-
countryCode: void 0
|
|
1608
|
-
}), z = E(), w = E({
|
|
1609
|
-
start: 0,
|
|
1610
|
-
end: 0,
|
|
1611
|
-
cursorAtEnd: !0
|
|
1612
|
-
});
|
|
1613
|
-
so("data", {
|
|
1614
|
-
selectedCountry: i,
|
|
1615
|
-
phoneNumber: A,
|
|
1616
|
-
results: f,
|
|
1617
|
-
selectionRange: w
|
|
1618
|
-
});
|
|
1619
|
-
const H = h(() => ({
|
|
1620
|
-
...Jo,
|
|
1621
|
-
...e.translations
|
|
1622
|
-
}));
|
|
1623
|
-
Oe(async () => {
|
|
1624
|
-
if (C(e.countryCode ?? e.defaultCountryCode), e.fetchCountry && !i.value) {
|
|
1625
|
-
const n = await r();
|
|
1626
|
-
C(n);
|
|
1627
|
-
}
|
|
1628
|
-
}), Ie(() => {
|
|
1629
|
-
var n;
|
|
1630
|
-
if (!e.defaultCountryCode && !e.noUseBrowserLocale && !i.value) {
|
|
1631
|
-
const V = (n = v()) == null ? void 0 : n.locale;
|
|
1632
|
-
C(V);
|
|
1633
|
-
}
|
|
1634
|
-
});
|
|
1635
|
-
const j = E();
|
|
1636
|
-
function Z() {
|
|
1637
|
-
var n;
|
|
1638
|
-
return (n = j.value) == null ? void 0 : n.$el.querySelector("input");
|
|
1639
|
-
}
|
|
1640
|
-
async function b() {
|
|
1641
|
-
var n;
|
|
1642
|
-
await ue(), (n = Z()) == null || n.select();
|
|
1643
|
-
}
|
|
1644
|
-
function S(n) {
|
|
1645
|
-
X({
|
|
1646
|
-
countryCode: n
|
|
1647
|
-
}), b();
|
|
1648
|
-
}
|
|
1649
|
-
function C(n) {
|
|
1650
|
-
if (n) {
|
|
1651
|
-
if (!p(n)) {
|
|
1652
|
-
console.warn(`[MazPhoneNumberInput] Country code not available: "${n}"`), i.value = void 0;
|
|
1653
|
-
return;
|
|
1654
|
-
}
|
|
1655
|
-
i.value = n;
|
|
1656
|
-
}
|
|
1657
|
-
}
|
|
1658
|
-
function W({
|
|
1659
|
-
newPhoneNumber: n,
|
|
1660
|
-
updateResults: V = !0,
|
|
1661
|
-
updateCountry: D = !0
|
|
1662
|
-
}) {
|
|
1663
|
-
const M = u(n);
|
|
1664
|
-
if (V && (f.value = B({
|
|
1665
|
-
phoneNumber: M,
|
|
1666
|
-
countryCode: i.value
|
|
1667
|
-
})), w.value.cursorAtEnd && !e.noFormattingAsYouType && e.autoFormat) {
|
|
1668
|
-
const Q = f.value.isValid ? f.value.formatNational : M;
|
|
1669
|
-
z.value = L(i.value, Q), A.value = z.value || Q;
|
|
1670
|
-
} else
|
|
1671
|
-
A.value = f.value.isValid ? f.value.formatNational : M;
|
|
1672
|
-
D && f.value.countryCode && f.value.countryCode !== i.value && X({
|
|
1673
|
-
countryCode: f.value.countryCode,
|
|
1674
|
-
updateResults: !1
|
|
1675
|
-
});
|
|
1676
|
-
}
|
|
1677
|
-
function X({
|
|
1678
|
-
countryCode: n,
|
|
1679
|
-
updateResults: V = !0
|
|
1680
|
-
}) {
|
|
1681
|
-
if (!n) {
|
|
1682
|
-
i.value = void 0;
|
|
1683
|
-
return;
|
|
1684
|
-
}
|
|
1685
|
-
n !== i.value && C(n), V && (f.value = B({
|
|
1686
|
-
phoneNumber: A.value,
|
|
1687
|
-
countryCode: n
|
|
1688
|
-
})), W({
|
|
1689
|
-
newPhoneNumber: A.value,
|
|
1690
|
-
updateResults: !1,
|
|
1691
|
-
updateCountry: !1
|
|
1692
|
-
});
|
|
1693
|
-
}
|
|
1694
|
-
return he(
|
|
1695
|
-
() => e.modelValue ?? e.defaultPhoneNumber,
|
|
1696
|
-
(n, V) => {
|
|
1697
|
-
n !== V && n !== A.value && W({
|
|
1698
|
-
newPhoneNumber: n
|
|
1699
|
-
});
|
|
1700
|
-
},
|
|
1701
|
-
{
|
|
1702
|
-
immediate: !0
|
|
1703
|
-
}
|
|
1704
|
-
), he(
|
|
1705
|
-
() => e.countryCode ?? e.defaultCountryCode,
|
|
1706
|
-
(n, V) => {
|
|
1707
|
-
n && n !== V && n !== i.value && X({
|
|
1708
|
-
countryCode: n
|
|
1709
|
-
});
|
|
1710
|
-
},
|
|
1711
|
-
{
|
|
1712
|
-
immediate: !0
|
|
1713
|
-
}
|
|
1714
|
-
), he(
|
|
1715
|
-
f,
|
|
1716
|
-
(n) => {
|
|
1717
|
-
t("update", n), t("data", n), n.e164 && n.isValid ? t("update:model-value", n.e164) : t("update:model-value", A.value), t("country-code", i.value), t("update:country-code", i.value);
|
|
1718
|
-
},
|
|
1719
|
-
{
|
|
1720
|
-
immediate: !0
|
|
1721
|
-
}
|
|
1722
|
-
), (n, V) => {
|
|
1723
|
-
var D;
|
|
1724
|
-
return y(), P(
|
|
1725
|
-
"div",
|
|
1726
|
-
{
|
|
1727
|
-
class: T(["m-phone-number-input", [e.class, { "--block": n.block }, n.orientation ? `--${n.orientation}` : void 0]]),
|
|
1728
|
-
style: oe(n.style)
|
|
1729
|
-
},
|
|
1730
|
-
[
|
|
1731
|
-
n.noCountrySelector ? $("v-if", !0) : (y(), K(Go, le({
|
|
1732
|
-
key: 0,
|
|
1733
|
-
id: k(g)
|
|
1734
|
-
}, n.countrySelectAttributes, {
|
|
1735
|
-
"model-value": i.value,
|
|
1736
|
-
color: n.color,
|
|
1737
|
-
size: n.size,
|
|
1738
|
-
"country-locale": n.countryLocale,
|
|
1739
|
-
"country-selector-display-name": n.countrySelectorDisplayName,
|
|
1740
|
-
"custom-countries-list": n.customCountriesList,
|
|
1741
|
-
"ignored-countries": n.ignoredCountries,
|
|
1742
|
-
"list-position": n.listPosition,
|
|
1743
|
-
"no-flags": n.noFlags,
|
|
1744
|
-
"no-search": n.noSearch,
|
|
1745
|
-
"exclude-selectors": n.excludeSelectors,
|
|
1746
|
-
error: n.error || (n.noValidationError ? !1 : !!A.value && !i.value),
|
|
1747
|
-
success: n.success || (n.noValidationSuccess ? !1 : (D = f.value) == null ? void 0 : D.isValid),
|
|
1748
|
-
locales: H.value,
|
|
1749
|
-
disabled: n.disabled,
|
|
1750
|
-
"search-threshold": n.searchThreshold,
|
|
1751
|
-
"show-code-on-list": n.showCodeOnList,
|
|
1752
|
-
"only-countries": n.onlyCountries,
|
|
1753
|
-
"preferred-countries": n.preferredCountries,
|
|
1754
|
-
width: n.countrySelectorWidth,
|
|
1755
|
-
"onUpdate:modelValue": S
|
|
1756
|
-
}), {
|
|
1757
|
-
"no-results": J(() => [
|
|
1758
|
-
N(n.$slots, "no-results", {}, void 0, !0)
|
|
1759
|
-
]),
|
|
1760
|
-
"selector-flag": J(({ countryCode: M }) => [
|
|
1761
|
-
N(n.$slots, "selector-flag", { countryCode: M }, void 0, !0)
|
|
1762
|
-
]),
|
|
1763
|
-
"country-list-flag": J(({ isSelected: M, option: Q }) => [
|
|
1764
|
-
N(n.$slots, "country-list-flag", {
|
|
1765
|
-
countryCode: Q.iso2,
|
|
1766
|
-
option: Q,
|
|
1767
|
-
isSelected: M
|
|
1768
|
-
}, void 0, !0)
|
|
1769
|
-
]),
|
|
1770
|
-
_: 3
|
|
1771
|
-
/* FORWARDED */
|
|
1772
|
-
}, 16, ["id", "model-value", "color", "size", "country-locale", "country-selector-display-name", "custom-countries-list", "ignored-countries", "list-position", "no-flags", "no-search", "exclude-selectors", "error", "success", "locales", "disabled", "search-threshold", "show-code-on-list", "only-countries", "preferred-countries", "width"])),
|
|
1773
|
-
U(tt, le({
|
|
1774
|
-
id: k(g),
|
|
1775
|
-
ref_key: "PhoneInputRef",
|
|
1776
|
-
ref: j,
|
|
1777
|
-
modelValue: A.value,
|
|
1778
|
-
"onUpdate:modelValue": V[0] || (V[0] = (M) => A.value = M)
|
|
1779
|
-
}, { ...n.$attrs, ...n.phoneInputAttributes }, {
|
|
1780
|
-
color: n.color,
|
|
1781
|
-
size: n.size,
|
|
1782
|
-
"no-example": n.noExample,
|
|
1783
|
-
block: "",
|
|
1784
|
-
disabled: n.disabled,
|
|
1785
|
-
"has-radius": !n.noCountrySelector,
|
|
1786
|
-
success: n.success || (n.noValidationSuccess ? !1 : f.value.isValid),
|
|
1787
|
-
error: n.error || (n.noValidationError ? !1 : !!A.value && !f.value.isValid),
|
|
1788
|
-
locales: H.value,
|
|
1789
|
-
"no-formatting-as-you-type": n.noFormattingAsYouType,
|
|
1790
|
-
"auto-format": n.autoFormat,
|
|
1791
|
-
label: n.label,
|
|
1792
|
-
placeholder: n.placeholder,
|
|
1793
|
-
"onUpdate:modelValue": V[1] || (V[1] = (M) => W({
|
|
1794
|
-
newPhoneNumber: M
|
|
1795
|
-
}))
|
|
1796
|
-
}), null, 16, ["id", "modelValue", "color", "size", "no-example", "disabled", "has-radius", "success", "error", "locales", "no-formatting-as-you-type", "auto-format", "label", "placeholder"])
|
|
1797
|
-
],
|
|
1798
|
-
6
|
|
1799
|
-
/* CLASS, STYLE */
|
|
1800
|
-
);
|
|
1801
|
-
};
|
|
1802
|
-
}
|
|
1803
|
-
}), rt = /* @__PURE__ */ re(lt, [["__scopeId", "data-v-71810071"]]);
|
|
1804
|
-
export {
|
|
1805
|
-
rt as M,
|
|
1806
|
-
re as _,
|
|
1807
|
-
Te as i,
|
|
1808
|
-
Ae as u
|
|
1809
|
-
};
|