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