maz-ui 3.47.2-beta.23 → 3.47.2-beta.24

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 (25) hide show
  1. package/components/MazDialog.mjs +1 -1
  2. package/components/MazDialogPromise.mjs +1 -1
  3. package/components/assets/MazDialog.css +1 -1
  4. package/components/assets/MazDialogPromise.css +1 -1
  5. package/components/chunks/{MazBtn-CsLtHm4K.mjs → MazBtn-B5o15XDU.mjs} +2 -2
  6. package/components/chunks/{MazBtn-ZAcYNusG.mjs → MazBtn-D-lSRE8n.mjs} +2 -2
  7. package/components/chunks/{MazDialog-Ca3jJ12T.mjs → MazDialog-CVo6Lqqe.mjs} +102 -102
  8. package/components/chunks/MazDialogPromise-CpVRFbno.mjs +551 -0
  9. package/components/chunks/{MazSpinner-D5Sbo759.mjs → MazSpinner-5S6Sn-lq.mjs} +1 -1
  10. package/components/chunks/{MazSpinner-DPur0-r-.mjs → MazSpinner-Bn4pnCJx.mjs} +1 -1
  11. package/modules/assets/index.css +1 -1
  12. package/modules/chunks/{MazBtn-yNCoLFA6.mjs → MazBtn-BB46O5je.mjs} +2 -2
  13. package/modules/chunks/{MazBtn-CFge_w1W.cjs → MazBtn-CZT-LQS2.cjs} +1 -1
  14. package/modules/chunks/{MazIcon-C3__MBEL.mjs → MazIcon-CQd2Upkc.mjs} +1 -1
  15. package/modules/chunks/{MazIcon-CqhvM2xp.cjs → MazIcon-yWU14J0C.cjs} +1 -1
  16. package/modules/chunks/{MazSpinner-C4XtaFJk.mjs → MazSpinner-C2h_t5PV.mjs} +1 -1
  17. package/modules/chunks/{MazSpinner-DkJAN36F.cjs → MazSpinner-D8KHXwFm.cjs} +1 -1
  18. package/modules/chunks/{index-CXu9R01-.mjs → index-2pl8TbAm.mjs} +740 -740
  19. package/modules/chunks/index-DwaxfXYQ.cjs +124 -0
  20. package/modules/index.cjs +1 -1
  21. package/modules/index.mjs +1 -1
  22. package/nuxt/index.json +1 -1
  23. package/package.json +1 -1
  24. package/components/chunks/MazDialogPromise-DOnmLhui.mjs +0 -551
  25. package/modules/chunks/index-Bawg2UGE.cjs +0 -124
@@ -1,551 +0,0 @@
1
- import { defineComponent as K, ref as M, onMounted as R, watch as G, nextTick as N, openBlock as p, createBlock as w, Teleport as Y, createVNode as Z, Transition as x, withCtx as h, createElementBlock as L, mergeProps as A, createElementVNode as T, normalizeClass as H, withModifiers as _, renderSlot as b, createCommentVNode as z, defineAsyncComponent as W, useAttrs as ee, computed as D, createTextVNode as V, toDisplayString as P, unref as f, Fragment as I, renderList as te } from "vue";
2
- import '../assets/MazDialogPromise.css';const oe = {
3
- role: "dialog",
4
- class: "m-backdrop-container",
5
- "aria-modal": "true"
6
- }, ne = { class: "m-backdrop-wrapper" }, U = "--backdrop-present", ae = /* @__PURE__ */ K({
7
- inheritAttrs: !1,
8
- __name: "MazBackdrop",
9
- props: {
10
- modelValue: { type: Boolean, default: !1 },
11
- teleportSelector: { default: "body" },
12
- beforeClose: { type: Function, default: void 0 },
13
- persistent: { type: Boolean, default: !1 },
14
- noCloseOnEscKey: { type: Boolean, default: !1 },
15
- transitionName: { default: "backdrop-anim" },
16
- backdropClass: { default: () => {
17
- } },
18
- backdropContentClass: { default: () => {
19
- } },
20
- contentPadding: { type: Boolean, default: !1 },
21
- justify: { default: "none" },
22
- align: { default: "none" },
23
- variant: {}
24
- },
25
- emits: ["open", "close", "update:model-value", "before-close"],
26
- setup(i, { expose: s, emit: n }) {
27
- const d = n;
28
- function v() {
29
- document.documentElement.classList.add(U);
30
- }
31
- function y() {
32
- document.querySelector(".m-backdrop.--present") || document.documentElement.classList.remove(U);
33
- }
34
- const c = M(i.modelValue);
35
- function m() {
36
- E(!1);
37
- }
38
- async function E(e) {
39
- var r;
40
- e || (d("before-close"), await ((r = i.beforeClose) == null ? void 0 : r.call(i))), c.value = e;
41
- }
42
- function k() {
43
- d("open");
44
- }
45
- function g() {
46
- d("update:model-value", !1), d("close"), $();
47
- }
48
- function t() {
49
- i.persistent || m();
50
- }
51
- function l(e) {
52
- !i.noCloseOnEscKey && e.key === "Escape" && !i.persistent && m();
53
- }
54
- function u() {
55
- v(), document.addEventListener("keyup", l, !1);
56
- }
57
- function $() {
58
- document.removeEventListener("keyup", l), y();
59
- }
60
- R(() => {
61
- i.modelValue ? u() : $();
62
- });
63
- let j = null;
64
- function o(e) {
65
- const r = document.querySelector(e), B = r && Array.from(r.querySelectorAll('a[href], button, textarea, input[type="text"], input[type="radio"], input[type="checkbox"], select')), C = B == null ? void 0 : B.filter((F) => {
66
- const q = window.getComputedStyle(F);
67
- return q.display !== "none" && q.visibility !== "hidden" && !F.disabled;
68
- });
69
- return C && C.length > 0 ? C[0] : null;
70
- }
71
- return G(
72
- () => i.modelValue,
73
- async (e) => {
74
- if (c.value = e, e) {
75
- u(), j = document.activeElement, await N();
76
- const r = o(".m-backdrop-content");
77
- r == null || r.focus();
78
- } else
79
- $(), await N(), j == null || j.focus();
80
- }
81
- ), s({
82
- onBackdropAnimationEnter: k,
83
- onBackdropAnimationLeave: g,
84
- onBackdropClicked: t,
85
- close: m,
86
- present: c,
87
- toggleModal: E,
88
- onKeyPress: l
89
- }), (e, r) => (p(), w(Y, { to: e.teleportSelector }, [
90
- Z(x, {
91
- appear: "",
92
- name: e.transitionName,
93
- onAfterEnter: k,
94
- onAfterLeave: g
95
- }, {
96
- default: h(() => [
97
- c.value ? (p(), L(
98
- "div",
99
- A({
100
- key: 0,
101
- class: "m-backdrop --present"
102
- }, e.$attrs, {
103
- class: [e.backdropClass, e.variant && `--variant-${e.variant}`, { "--persistent": e.persistent }]
104
- }),
105
- [
106
- T("div", oe, [
107
- T("div", ne, [
108
- T(
109
- "div",
110
- {
111
- class: H(["m-backdrop-content", [e.backdropContentClass, `--justify-${e.justify}`, `--align-${e.align}`, { "--padding": e.contentPadding }]]),
112
- role: "button",
113
- tabindex: "-1",
114
- onClick: _(t, ["self"])
115
- },
116
- [
117
- b(e.$slots, "default", {
118
- close: m,
119
- onBackdropClicked: t
120
- }, void 0, !0)
121
- ],
122
- 2
123
- /* CLASS */
124
- )
125
- ])
126
- ])
127
- ],
128
- 16
129
- /* FULL_PROPS */
130
- )) : z("v-if", !0)
131
- ]),
132
- _: 3
133
- /* FORWARDED */
134
- }, 8, ["name"])
135
- ], 8, ["to"]));
136
- }
137
- }), J = (i, s) => {
138
- const n = i.__vccOpts || i;
139
- for (const [d, v] of s)
140
- n[d] = v;
141
- return n;
142
- }, le = /* @__PURE__ */ J(ae, [["__scopeId", "data-v-7aa1682e"]]), se = {
143
- key: 0,
144
- id: "dialogTitle",
145
- class: "m-dialog-title"
146
- }, ie = {
147
- key: 0,
148
- class: "m-dialog-footer"
149
- }, re = /* @__PURE__ */ K({
150
- name: "MazDialog",
151
- inheritAttrs: !1,
152
- __name: "MazDialog",
153
- props: {
154
- modelValue: { type: Boolean },
155
- title: { default: void 0 },
156
- noClose: { type: Boolean, default: !1 },
157
- maxWidth: { default: "100%" },
158
- minWidth: { default: "32rem" },
159
- scrollable: { type: Boolean, default: !1 },
160
- persistent: { type: Boolean, default: !1 },
161
- teleportSelector: {},
162
- beforeClose: {},
163
- noCloseOnEscKey: { type: Boolean },
164
- transitionName: {},
165
- backdropClass: {},
166
- backdropContentClass: {},
167
- contentPadding: { type: Boolean },
168
- justify: {},
169
- align: {},
170
- variant: {}
171
- },
172
- emits: ["open", "close", "update:model-value"],
173
- setup(i, { expose: s }) {
174
- const n = i, d = W(() => import("./MazBtn-ZAcYNusG.mjs")), v = W(() => import("./x-mark-CnZwVvA7.mjs")), y = ee(), c = M();
175
- s({
176
- close: () => {
177
- var t, l;
178
- return (l = (t = c.value) == null ? void 0 : t.close) == null ? void 0 : l.call(t);
179
- }
180
- });
181
- const m = D(() => {
182
- const t = [
183
- "modelValue",
184
- "title",
185
- "noClose",
186
- "maxWidth",
187
- "minWidth",
188
- "scrollable"
189
- ];
190
- return Object.fromEntries(
191
- Object.entries(n).filter(([l]) => !t.includes(l))
192
- );
193
- }), E = D(() => ({
194
- ...y,
195
- class: void 0,
196
- style: void 0
197
- })), k = D(() => ({
198
- class: y.class,
199
- style: y.style
200
- })), g = M();
201
- return n.scrollable && G(() => n.modelValue, async (t) => {
202
- await N(), t && g.value && setTimeout(() => {
203
- var l;
204
- (l = g.value) == null || l.scrollTo({ top: 0, behavior: "instant" });
205
- }, 0);
206
- }), (t, l) => (p(), w(le, A({ ...E.value, ...m.value }, {
207
- ref_key: "backdrop",
208
- ref: c,
209
- "model-value": t.modelValue,
210
- "transition-name": "modal-anim",
211
- "aria-labelledby": "dialogTitle",
212
- "aria-describedby": "dialogDesc",
213
- "content-padding": "",
214
- justify: "center",
215
- variant: "dialog",
216
- onClose: l[0] || (l[0] = (u) => t.$emit("close", u)),
217
- onOpen: l[1] || (l[1] = (u) => t.$emit("open", u)),
218
- "onUpdate:modelValue": l[2] || (l[2] = (u) => t.$emit("update:model-value", u))
219
- }), {
220
- default: h(({ close: u, onBackdropClicked: $ }) => [
221
- T(
222
- "div",
223
- A({
224
- class: ["m-dialog", { "--scrollable": t.scrollable }],
225
- role: "dialog",
226
- "aria-modal": "true",
227
- style: [{ "--max-width": t.maxWidth, "--min-width": t.minWidth }]
228
- }, k.value),
229
- [
230
- b(t.$slots, "header", {
231
- close: u,
232
- onBackdropClicked: $
233
- }, () => [
234
- T(
235
- "div",
236
- {
237
- class: H(["m-dialog-header", { "--has-title": t.$slots.title || t.title }])
238
- },
239
- [
240
- t.$slots.title || t.title ? (p(), L("h2", se, [
241
- b(t.$slots, "title", {}, () => [
242
- V(
243
- P(t.title),
244
- 1
245
- /* TEXT */
246
- )
247
- ], !0)
248
- ])) : z("v-if", !0),
249
- !t.noClose && !t.persistent ? (p(), w(f(d), {
250
- key: 1,
251
- color: "transparent",
252
- size: "sm",
253
- icon: f(v),
254
- onClick: u
255
- }, null, 8, ["icon", "onClick"])) : z("v-if", !0)
256
- ],
257
- 2
258
- /* CLASS */
259
- )
260
- ], !0),
261
- T(
262
- "div",
263
- {
264
- id: "dialogDesc",
265
- ref_key: "dialogContent",
266
- ref: g,
267
- class: "m-dialog-content"
268
- },
269
- [
270
- b(t.$slots, "default", {
271
- close: u,
272
- onBackdropClicked: $
273
- }, void 0, !0)
274
- ],
275
- 512
276
- /* NEED_PATCH */
277
- ),
278
- t.$slots.footer ? (p(), L("div", ie, [
279
- b(t.$slots, "footer", {
280
- close: u,
281
- onBackdropClicked: $
282
- }, void 0, !0)
283
- ])) : z("v-if", !0)
284
- ],
285
- 16
286
- /* FULL_PROPS */
287
- )
288
- ]),
289
- _: 3
290
- /* FORWARDED */
291
- }, 16, ["model-value"]));
292
- }
293
- }), de = /* @__PURE__ */ J(re, [["__scopeId", "data-v-b16ef3d7"]]), S = {
294
- cancelText: "Cancel",
295
- confirmText: "Confirm",
296
- cancelButton: {
297
- text: "Cancel",
298
- color: "danger"
299
- },
300
- confirmButton: {
301
- text: "Confirm",
302
- color: "success"
303
- }
304
- }, ue = M(S), O = M([]);
305
- function ce(i, s) {
306
- return new Promise((n, d) => {
307
- O.value = [
308
- ...O.value,
309
- {
310
- id: i,
311
- isActive: !0,
312
- resolve: async (v) => {
313
- n(v), await (s == null ? void 0 : s());
314
- },
315
- reject: async (v) => {
316
- d(v), await (s == null ? void 0 : s());
317
- }
318
- }
319
- ];
320
- });
321
- }
322
- function Q(i) {
323
- return O.value = O.value.filter(({ id: s }) => s !== i), O.value;
324
- }
325
- function X(i, s, n) {
326
- var d;
327
- s && ((d = s[i]) == null || d.call(s, n), s.isActive = !1, setTimeout(() => {
328
- Q(s.id);
329
- }, 500));
330
- }
331
- function me() {
332
- return {
333
- data: ue,
334
- dialogState: O,
335
- showDialogAndWaitChoice: ce,
336
- removeDialogFromState: Q,
337
- rejectDialog: async (i, s = new Error("cancel"), n) => (await (n == null ? void 0 : n()), X("reject", i, s)),
338
- resolveDialog: async (i, s = "accept", n) => (await (n == null ? void 0 : n()), X("resolve", i, s))
339
- };
340
- }
341
- const fe = { class: "maz-flex maz-items-center maz-gap-2" }, ve = /* @__PURE__ */ K({
342
- __name: "MazDialogPromise",
343
- props: {
344
- data: { default: void 0 },
345
- message: { default: void 0 },
346
- identifier: { default: void 0 },
347
- buttons: { default: void 0 },
348
- modelValue: { type: Boolean },
349
- title: {},
350
- noClose: { type: Boolean },
351
- maxWidth: {},
352
- minWidth: {},
353
- scrollable: { type: Boolean },
354
- persistent: { type: Boolean },
355
- teleportSelector: {},
356
- beforeClose: {},
357
- noCloseOnEscKey: { type: Boolean },
358
- transitionName: {},
359
- backdropClass: {},
360
- backdropContentClass: {},
361
- contentPadding: { type: Boolean },
362
- justify: {},
363
- align: {},
364
- variant: {},
365
- cancelText: {},
366
- cancelButton: { type: [Boolean, Object] },
367
- confirmText: {},
368
- confirmButton: { type: [Boolean, Object] }
369
- },
370
- emits: ["open", "close"],
371
- setup(i, { expose: s }) {
372
- const n = i, d = W(() => import("./MazBtn-ZAcYNusG.mjs")), { dialogState: v, rejectDialog: y, resolveDialog: c, data: m } = me(), E = D(() => {
373
- var o;
374
- return n.buttons ?? ((o = n.data) == null ? void 0 : o.buttons) ?? m.value.buttons;
375
- }), k = D(() => ({
376
- ...S,
377
- ...m.value,
378
- ...n.data
379
- })), g = D(() => {
380
- var r, a, B, C;
381
- if (!(((r = m.value) == null ? void 0 : r.cancelButton) ?? ((a = n.data) == null ? void 0 : a.cancelButton) ?? S.cancelButton))
382
- return;
383
- const e = {
384
- ...S.cancelButton,
385
- ...(B = m.value) == null ? void 0 : B.cancelButton,
386
- ...(C = n.data) == null ? void 0 : C.cancelButton
387
- };
388
- return {
389
- ...e,
390
- text: n.cancelText || k.value.cancelText || e.text
391
- };
392
- }), t = D(() => {
393
- var r, a, B, C;
394
- if (!(((r = m.value) == null ? void 0 : r.confirmButton) ?? ((a = n.data) == null ? void 0 : a.confirmButton) ?? S.confirmButton))
395
- return;
396
- const e = {
397
- ...S.confirmButton,
398
- ...(B = m.value) == null ? void 0 : B.confirmButton,
399
- ...(C = n.data) == null ? void 0 : C.confirmButton
400
- };
401
- return {
402
- ...e,
403
- text: n.confirmText || k.value.confirmText || e.text
404
- };
405
- }), l = D(
406
- () => v.value.find(({ id: o }) => o === n.identifier)
407
- ), u = M();
408
- s({
409
- close: () => {
410
- var o, e;
411
- return (e = (o = u.value) == null ? void 0 : o.close) == null ? void 0 : e.call(o);
412
- }
413
- });
414
- function $(o) {
415
- return "type" in o && (o.type === "resolve" || o.type === "reject");
416
- }
417
- function j(o, e) {
418
- return $(e) ? e.type === "resolve" ? c(o, e.response) : y(o, e.response) : c(o, void 0, e.action);
419
- }
420
- return (o, e) => {
421
- var r;
422
- return p(), w(de, A({
423
- ref_key: "dialog",
424
- ref: u
425
- }, { ...o.$attrs, ...n }, {
426
- "model-value": ((r = l.value) == null ? void 0 : r.isActive) ?? o.modelValue ?? !1,
427
- onClose: e[2] || (e[2] = (a) => o.$emit("close", a)),
428
- onOpen: e[3] || (e[3] = (a) => o.$emit("open", a)),
429
- "onUpdate:modelValue": e[4] || (e[4] = (a) => f(y)(l.value))
430
- }), {
431
- title: h(() => [
432
- b(o.$slots, "title", {}, () => {
433
- var a;
434
- return [
435
- V(
436
- P(o.title || ((a = k.value) == null ? void 0 : a.title)),
437
- 1
438
- /* TEXT */
439
- )
440
- ];
441
- })
442
- ]),
443
- default: h(() => [
444
- b(o.$slots, "default", {
445
- resolve: (a) => f(c)(l.value, a),
446
- reject: (a) => f(y)(l.value, a)
447
- }, () => {
448
- var a;
449
- return [
450
- V(
451
- P(o.message || ((a = k.value) == null ? void 0 : a.message)),
452
- 1
453
- /* TEXT */
454
- )
455
- ];
456
- })
457
- ]),
458
- footer: h(() => [
459
- b(o.$slots, "footer-button", {
460
- resolve: (a) => f(c)(l.value, a),
461
- reject: (a) => f(y)(l.value, a)
462
- }, () => [
463
- T("div", fe, [
464
- E.value ? (p(!0), L(
465
- I,
466
- { key: 0 },
467
- te(E.value, (a, B) => (p(), w(f(d), A({
468
- key: B,
469
- ref_for: !0
470
- }, {
471
- ...a,
472
- type: "button"
473
- }, {
474
- onClick: (C) => j(l.value, a)
475
- }), {
476
- default: h(() => [
477
- V(
478
- P(a.text),
479
- 1
480
- /* TEXT */
481
- )
482
- ]),
483
- _: 2
484
- /* DYNAMIC */
485
- }, 1040, ["onClick"]))),
486
- 128
487
- /* KEYED_FRAGMENT */
488
- )) : (p(), L(
489
- I,
490
- { key: 1 },
491
- [
492
- g.value ? (p(), w(
493
- f(d),
494
- A({ key: 0 }, g.value, {
495
- onClick: e[0] || (e[0] = (a) => f(y)(l.value))
496
- }),
497
- {
498
- default: h(() => [
499
- b(o.$slots, "cancel-text", {}, () => [
500
- V(
501
- P(g.value.text),
502
- 1
503
- /* TEXT */
504
- )
505
- ])
506
- ]),
507
- _: 3
508
- /* FORWARDED */
509
- },
510
- 16
511
- /* FULL_PROPS */
512
- )) : z("v-if", !0),
513
- t.value ? (p(), w(
514
- f(d),
515
- A({ key: 1 }, t.value, {
516
- onClick: e[1] || (e[1] = (a) => f(c)(l.value))
517
- }),
518
- {
519
- default: h(() => [
520
- b(o.$slots, "confirm-text", {}, () => [
521
- V(
522
- P(t.value.text),
523
- 1
524
- /* TEXT */
525
- )
526
- ])
527
- ]),
528
- _: 3
529
- /* FORWARDED */
530
- },
531
- 16
532
- /* FULL_PROPS */
533
- )) : z("v-if", !0)
534
- ],
535
- 64
536
- /* STABLE_FRAGMENT */
537
- ))
538
- ])
539
- ])
540
- ]),
541
- _: 3
542
- /* FORWARDED */
543
- }, 16, ["model-value"]);
544
- };
545
- }
546
- });
547
- export {
548
- J as _,
549
- ve as a,
550
- me as u
551
- };