maz-ui 3.36.3 → 3.36.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.
@@ -0,0 +1,413 @@
1
+ import "../assets/MazDialogPromise.css";
2
+ import { ref as j, defineComponent as V, onMounted as W, watch as K, openBlock as p, createBlock as $, Teleport as q, createVNode as D, Transition as I, withCtx as v, createElementBlock as h, normalizeClass as w, createElementVNode as k, withModifiers as U, mergeProps as M, renderSlot as f, createCommentVNode as m, defineAsyncComponent as T, useAttrs as X, computed as S, createTextVNode as g, toDisplayString as y, unref as r, Fragment as P, renderList as G } from "vue";
3
+ const J = j(), b = j([]), Q = (n, o) => new Promise((d, i) => {
4
+ b.value = [
5
+ ...b.value,
6
+ {
7
+ id: n,
8
+ isActive: !0,
9
+ resolve: async () => {
10
+ await (o == null ? void 0 : o()), d(!0);
11
+ },
12
+ reject: i
13
+ }
14
+ ];
15
+ }), H = (n) => (b.value = b.value.filter(({ id: o }) => o !== n), b.value), N = (n, o, d = !1) => {
16
+ var i;
17
+ o && ((i = o[n]) == null || i.call(o, d), o.isActive = !1, setTimeout(() => {
18
+ H(o.id);
19
+ }, 500));
20
+ }, R = () => ({
21
+ confirmDialogData: J,
22
+ dialogState: b,
23
+ showDialogAndWaitChoice: Q,
24
+ removeDialogFromState: H,
25
+ rejectDialog: (n, o = "cancel") => N("reject", n, o),
26
+ resolveDialog: (n, o = "accept") => N("resolve", n, o)
27
+ }), O = "--backdrop-present", Y = /* @__PURE__ */ V({
28
+ inheritAttrs: !1,
29
+ __name: "MazBackdrop",
30
+ props: {
31
+ modelValue: { type: Boolean, default: !1 },
32
+ teleportSelector: { default: "body" },
33
+ beforeClose: { type: Function, default: void 0 },
34
+ persistent: { type: Boolean, default: !1 },
35
+ noCloseOnEscKey: { type: Boolean, default: !1 },
36
+ transitionName: { default: "backdrop-anim" },
37
+ backdropClass: { default: void 0 },
38
+ backdropContentClass: { default: void 0 }
39
+ },
40
+ emits: ["open", "close", "update:model-value", "before-close"],
41
+ setup(n, { expose: o, emit: d }) {
42
+ const i = () => {
43
+ document.documentElement.classList.add(O);
44
+ }, c = async () => {
45
+ document.querySelector(".m-backdrop.--present") || document.documentElement.classList.remove(O);
46
+ }, u = d, e = n, l = j(e.modelValue);
47
+ function s() {
48
+ C(!1);
49
+ }
50
+ async function C(a) {
51
+ var F;
52
+ a || (u("before-close"), await ((F = e.beforeClose) == null ? void 0 : F.call(e))), l.value = a;
53
+ }
54
+ function t() {
55
+ u("open");
56
+ }
57
+ function A() {
58
+ u("update:model-value", !1), u("close"), E();
59
+ }
60
+ function z() {
61
+ e.persistent || s();
62
+ }
63
+ function B(a) {
64
+ !e.noCloseOnEscKey && a.key === "Escape" && !e.persistent && s();
65
+ }
66
+ function L() {
67
+ i(), document.addEventListener("keyup", B, !1);
68
+ }
69
+ function E() {
70
+ document.removeEventListener("keyup", B), c();
71
+ }
72
+ return W(() => {
73
+ e.modelValue ? L() : E();
74
+ }), K(
75
+ () => e.modelValue,
76
+ (a) => {
77
+ l.value = a, a ? L() : E();
78
+ }
79
+ ), o({
80
+ onBackdropAnimationEnter: t,
81
+ onBackdropAnimationLeave: A,
82
+ onBackdropClicked: z,
83
+ close: s,
84
+ present: l,
85
+ toggleModal: C,
86
+ onKeyPress: B
87
+ }), (a, F) => (p(), $(q, { to: a.teleportSelector }, [
88
+ D(I, {
89
+ appear: "",
90
+ name: a.transitionName,
91
+ onAfterEnter: t,
92
+ onAfterLeave: A
93
+ }, {
94
+ default: v(() => [
95
+ l.value ? (p(), h(
96
+ "div",
97
+ {
98
+ key: 0,
99
+ class: w(["m-backdrop --present", [a.backdropClass]]),
100
+ tabindex: "-1",
101
+ role: "dialog"
102
+ },
103
+ [
104
+ k(
105
+ "button",
106
+ {
107
+ class: w(["m-backdrop-overlay", { "--disabled": a.persistent }]),
108
+ tabindex: "-1",
109
+ onClick: U(z, ["self"])
110
+ },
111
+ null,
112
+ 2
113
+ /* CLASS */
114
+ ),
115
+ k(
116
+ "div",
117
+ M({
118
+ class: ["m-backdrop-content", a.backdropContentClass]
119
+ }, a.$attrs, {
120
+ role: "document",
121
+ tabindex: "0"
122
+ }),
123
+ [
124
+ f(a.$slots, "default", { close: s })
125
+ ],
126
+ 16
127
+ /* FULL_PROPS */
128
+ )
129
+ ],
130
+ 2
131
+ /* CLASS */
132
+ )) : m("v-if", !0)
133
+ ]),
134
+ _: 3
135
+ /* FORWARDED */
136
+ }, 8, ["name"])
137
+ ], 8, ["to"]));
138
+ }
139
+ }), Z = {
140
+ key: 0,
141
+ id: "dialogTitle",
142
+ class: "maz-my-0 maz-text-xl maz-font-semibold"
143
+ }, x = {
144
+ id: "dialogDesc",
145
+ class: "m-dialog-content"
146
+ }, _ = {
147
+ key: 0,
148
+ class: "m-dialog-footer"
149
+ }, ee = /* @__PURE__ */ V({
150
+ __name: "MazDialog",
151
+ props: {
152
+ title: { default: void 0 },
153
+ noClose: { type: Boolean, default: !1 },
154
+ width: { default: "500px" },
155
+ maxWidth: { default: "95vw" },
156
+ maxHeight: { default: "95vh" },
157
+ scrollable: { type: Boolean, default: !1 },
158
+ persistent: { type: Boolean, default: !1 }
159
+ },
160
+ emits: [
161
+ /** Model binding */
162
+ "update:model-value",
163
+ /** Emitted when dialog is closed (after animation) */
164
+ "close",
165
+ /** Emitted when dialog is opened (after animation) */
166
+ "open"
167
+ ],
168
+ setup(n) {
169
+ const o = T(() => import("./MazBtn-B-q9T3u-.mjs")), d = T(() => import("./x-mark-BP8zWe_C.mjs")), i = X(), c = S(() => ({
170
+ ...i,
171
+ class: void 0,
172
+ style: void 0
173
+ })), u = S(() => ({
174
+ class: i.class,
175
+ style: i.style
176
+ }));
177
+ return (e, l) => (p(), $(Y, M(c.value, {
178
+ persistent: e.persistent,
179
+ "transition-name": "modal-anim",
180
+ "aria-labelledby": "dialogTitle",
181
+ "aria-describedby": "dialogDesc",
182
+ onClose: l[0] || (l[0] = (s) => e.$emit("close", s)),
183
+ onOpen: l[1] || (l[1] = (s) => e.$emit("open", s)),
184
+ "onUpdate:modelValue": l[2] || (l[2] = (s) => e.$emit("update:model-value", s))
185
+ }), {
186
+ default: v(({ close: s }) => [
187
+ k(
188
+ "div",
189
+ M({
190
+ class: ["m-dialog", { "--scrollable": e.scrollable }],
191
+ role: "dialog",
192
+ "aria-modal": "true",
193
+ style: [{ width: e.width, maxWidth: e.maxWidth, maxHeight: e.maxHeight }]
194
+ }, u.value),
195
+ [
196
+ m(`
197
+ @slot Header slot
198
+ @binding {Function} close close function
199
+ `),
200
+ f(e.$slots, "header", { close: s }, () => [
201
+ k(
202
+ "div",
203
+ {
204
+ class: w(["m-dialog-header", { "--has-title": e.$slots.title || e.title }])
205
+ },
206
+ [
207
+ e.$slots.title || e.title ? (p(), h("h2", Z, [
208
+ m(`
209
+ @slot Title slot in the header
210
+ `),
211
+ f(e.$slots, "title", {}, () => [
212
+ g(
213
+ y(e.title),
214
+ 1
215
+ /* TEXT */
216
+ )
217
+ ], !0)
218
+ ])) : m("v-if", !0),
219
+ !e.noClose && !e.persistent ? (p(), $(r(o), {
220
+ key: 1,
221
+ class: "m-dialog-closebtn",
222
+ color: "transparent",
223
+ onClick: s
224
+ }, {
225
+ default: v(() => [
226
+ D(r(d), { class: "maz-text-lg" })
227
+ ]),
228
+ _: 2
229
+ /* DYNAMIC */
230
+ }, 1032, ["onClick"])) : m("v-if", !0)
231
+ ],
232
+ 2
233
+ /* CLASS */
234
+ )
235
+ ], !0),
236
+ k("div", x, [
237
+ m(`
238
+ @slot Default content
239
+ @binding {Function} close close function
240
+ `),
241
+ f(e.$slots, "default", { close: s }, void 0, !0)
242
+ ]),
243
+ e.$slots.footer ? (p(), h("div", _, [
244
+ m(`
245
+ @slot Footer slot
246
+ @binding {Function} close close function
247
+ `),
248
+ f(e.$slots, "footer", { close: s }, void 0, !0)
249
+ ])) : m("v-if", !0)
250
+ ],
251
+ 16
252
+ /* FULL_PROPS */
253
+ )
254
+ ]),
255
+ _: 3
256
+ /* FORWARDED */
257
+ }, 16, ["persistent"]));
258
+ }
259
+ }), te = (n, o) => {
260
+ const d = n.__vccOpts || n;
261
+ for (const [i, c] of o)
262
+ d[i] = c;
263
+ return d;
264
+ }, oe = /* @__PURE__ */ te(ee, [["__scopeId", "data-v-6ded3568"]]), ne = { class: "maz-space-x-2" }, ae = /* @__PURE__ */ V({
265
+ __name: "MazDialogPromise",
266
+ props: {
267
+ /** Dialog Data - type DialogData */
268
+ data: { type: Object, default: void 0 },
269
+ /** Uniq identifier */
270
+ identifier: { type: String, required: !0 },
271
+ /** Custom buttons - type DialogButton[] */
272
+ buttons: { type: Array, default: () => [] }
273
+ },
274
+ setup(n) {
275
+ const o = T(() => import("./MazBtn-B-q9T3u-.mjs")), d = n, { dialogState: i, rejectDialog: c, resolveDialog: u } = R(), e = S(
276
+ () => i.value.find(({ id: l }) => l === d.identifier)
277
+ );
278
+ return (l, s) => {
279
+ var C;
280
+ return p(), $(oe, {
281
+ "model-value": ((C = e.value) == null ? void 0 : C.isActive) ?? !1,
282
+ "onUpdate:modelValue": s[2] || (s[2] = (t) => r(c)(e.value))
283
+ }, {
284
+ title: v(() => [
285
+ f(l.$slots, "title", {}, () => {
286
+ var t;
287
+ return [
288
+ g(
289
+ y((t = n.data) == null ? void 0 : t.title),
290
+ 1
291
+ /* TEXT */
292
+ )
293
+ ];
294
+ })
295
+ ]),
296
+ default: v(() => [
297
+ m(`
298
+ @slot Default slot - Place your content
299
+ @binding {Function} resolve resolve function
300
+ @binding {Function} reject reject function
301
+ `),
302
+ f(l.$slots, "default", {
303
+ resolve: (t) => r(u)(e.value, t),
304
+ reject: (t) => r(c)(e.value, t)
305
+ }, () => {
306
+ var t;
307
+ return [
308
+ g(
309
+ y((t = n.data) == null ? void 0 : t.message),
310
+ 1
311
+ /* TEXT */
312
+ )
313
+ ];
314
+ })
315
+ ]),
316
+ footer: v(() => [
317
+ m(`
318
+ @slot Footer Buttons slot
319
+ @binding {Function} resolve resolve function
320
+ @binding {Function} reject reject function
321
+ `),
322
+ f(l.$slots, "footer-button", {
323
+ resolve: (t) => r(u)(e.value, t),
324
+ reject: (t) => r(c)(e.value, t)
325
+ }, () => [
326
+ k("div", ne, [
327
+ n.buttons.length > 0 ? (p(!0), h(
328
+ P,
329
+ { key: 0 },
330
+ G(n.buttons, (t, A) => (p(), $(r(o), {
331
+ key: A,
332
+ color: t.color,
333
+ size: t.size,
334
+ outline: t.outline,
335
+ rounded: t.rounded,
336
+ disabled: t.disabled,
337
+ block: t.block,
338
+ loading: t.loading,
339
+ onClick: (z) => t.type === "resolve" ? r(u)(e.value, t.response) : r(c)(e.value, t.response)
340
+ }, {
341
+ default: v(() => [
342
+ g(
343
+ y(t.text),
344
+ 1
345
+ /* TEXT */
346
+ )
347
+ ]),
348
+ _: 2
349
+ /* DYNAMIC */
350
+ }, 1032, ["color", "size", "outline", "rounded", "disabled", "block", "loading", "onClick"]))),
351
+ 128
352
+ /* KEYED_FRAGMENT */
353
+ )) : (p(), h(
354
+ P,
355
+ { key: 1 },
356
+ [
357
+ D(r(o), {
358
+ color: "danger",
359
+ outline: "",
360
+ onClick: s[0] || (s[0] = (t) => r(c)(e.value))
361
+ }, {
362
+ default: v(() => [
363
+ f(l.$slots, "cancel-text", {}, () => {
364
+ var t;
365
+ return [
366
+ g(
367
+ y(((t = n.data) == null ? void 0 : t.cancelText) || "Cancel"),
368
+ 1
369
+ /* TEXT */
370
+ )
371
+ ];
372
+ })
373
+ ]),
374
+ _: 3
375
+ /* FORWARDED */
376
+ }),
377
+ D(r(o), {
378
+ color: "success",
379
+ onClick: s[1] || (s[1] = (t) => r(u)(e.value))
380
+ }, {
381
+ default: v(() => [
382
+ f(l.$slots, "confirm-text", {}, () => {
383
+ var t;
384
+ return [
385
+ g(
386
+ y(((t = n.data) == null ? void 0 : t.confirmText) || "Confirm"),
387
+ 1
388
+ /* TEXT */
389
+ )
390
+ ];
391
+ })
392
+ ]),
393
+ _: 3
394
+ /* FORWARDED */
395
+ })
396
+ ],
397
+ 64
398
+ /* STABLE_FRAGMENT */
399
+ ))
400
+ ])
401
+ ])
402
+ ]),
403
+ _: 3
404
+ /* FORWARDED */
405
+ }, 8, ["model-value"]);
406
+ };
407
+ }
408
+ });
409
+ export {
410
+ te as _,
411
+ ae as a,
412
+ R as u
413
+ };
@@ -1,6 +1,6 @@
1
1
  import "../assets/MazSpinner.css";
2
2
  import { defineComponent as t, openBlock as o, createElementBlock as c, normalizeClass as n, pushScopeId as s, popScopeId as r, createElementVNode as i } from "vue";
3
- import { _ as p } from "./MazDialog-CW8YIBc1.mjs";
3
+ import { _ as p } from "./MazDialog--vjZyPR3.mjs";
4
4
  const a = (e) => (s("data-v-c67298ec"), e = e(), r(), e), d = ["width", "height"], l = /* @__PURE__ */ a(() => /* @__PURE__ */ i(
5
5
  "path",
6
6
  { d: "M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z" },
@@ -1,6 +1,6 @@
1
1
  import "../assets/MazSpinner.css";
2
2
  import { defineComponent as t, openBlock as o, createElementBlock as c, normalizeClass as n, pushScopeId as s, popScopeId as r, createElementVNode as i } from "vue";
3
- import { _ as p } from "./MazDialogPromise-Cd5B1cpr.mjs";
3
+ import { _ as p } from "./MazDialogPromise-r1kerrgl.mjs";
4
4
  const a = (e) => (s("data-v-c67298ec"), e = e(), r(), e), d = ["width", "height"], l = /* @__PURE__ */ a(() => /* @__PURE__ */ i(
5
5
  "path",
6
6
  { d: "M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z" },
package/nuxt/index.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "3.36.3"
7
+ "version": "3.36.4"
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maz-ui",
3
- "version": "3.36.3",
3
+ "version": "3.36.4",
4
4
  "description": "A standalone components library for Vue.Js 3 & Nuxt.Js 3",
5
5
  "author": "Louis Mazel <me@loicmazuel.com>",
6
6
  "main": "./modules/index.cjs",
@@ -1,75 +1,46 @@
1
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
2
- /** Modal's title in header */
3
- title: {
4
- type: StringConstructor;
5
- default: undefined;
6
- };
1
+ export type Props = {
2
+ /** Title of the modal in header */
3
+ title?: string;
7
4
  /** Remove the close button in header */
8
- noClose: {
9
- type: BooleanConstructor;
10
- default: boolean;
11
- };
5
+ noClose?: boolean;
12
6
  /** Modal's width */
13
- width: {
14
- type: StringConstructor;
15
- default: string;
16
- };
7
+ width?: string;
17
8
  /** Modal's max-width */
18
- maxWidth: {
19
- type: StringConstructor;
20
- default: string;
21
- };
9
+ maxWidth?: string;
22
10
  /** Modal's max-height */
23
- maxHeight: {
24
- type: StringConstructor;
25
- default: string;
26
- };
11
+ maxHeight?: string;
27
12
  /** Modal's content becomes scrollable - warning: a overflow is applied */
28
- scrollable: {
29
- type: BooleanConstructor;
30
- default: boolean;
31
- };
32
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
+ scrollable?: boolean;
14
+ /** Persistent dialog (not closable by clicking outside and remove close button) */
15
+ persistent?: boolean;
16
+ };
17
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
18
+ title: undefined;
19
+ noClose: boolean;
20
+ width: string;
21
+ maxWidth: string;
22
+ maxHeight: string;
23
+ scrollable: boolean;
24
+ persistent: boolean;
25
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
33
26
  close: (...args: any[]) => void;
34
27
  open: (...args: any[]) => void;
35
28
  "update:model-value": (...args: any[]) => void;
36
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
37
- /** Modal's title in header */
38
- title: {
39
- type: StringConstructor;
40
- default: undefined;
41
- };
42
- /** Remove the close button in header */
43
- noClose: {
44
- type: BooleanConstructor;
45
- default: boolean;
46
- };
47
- /** Modal's width */
48
- width: {
49
- type: StringConstructor;
50
- default: string;
51
- };
52
- /** Modal's max-width */
53
- maxWidth: {
54
- type: StringConstructor;
55
- default: string;
56
- };
57
- /** Modal's max-height */
58
- maxHeight: {
59
- type: StringConstructor;
60
- default: string;
61
- };
62
- /** Modal's content becomes scrollable - warning: a overflow is applied */
63
- scrollable: {
64
- type: BooleanConstructor;
65
- default: boolean;
66
- };
67
- }>> & {
29
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
30
+ title: undefined;
31
+ noClose: boolean;
32
+ width: string;
33
+ maxWidth: string;
34
+ maxHeight: string;
35
+ scrollable: boolean;
36
+ persistent: boolean;
37
+ }>>> & {
68
38
  onClose?: ((...args: any[]) => any) | undefined;
69
39
  onOpen?: ((...args: any[]) => any) | undefined;
70
40
  "onUpdate:model-value"?: ((...args: any[]) => any) | undefined;
71
41
  }, {
72
42
  title: string;
43
+ persistent: boolean;
73
44
  width: string;
74
45
  noClose: boolean;
75
46
  maxWidth: string;
@@ -88,8 +59,25 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
88
59
  }): any;
89
60
  }>;
90
61
  export default _default;
62
+ type __VLS_WithDefaults<P, D> = {
63
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
64
+ default: D[K];
65
+ }> : P[K];
66
+ };
67
+ type __VLS_Prettify<T> = {
68
+ [K in keyof T]: T[K];
69
+ } & {};
91
70
  type __VLS_WithTemplateSlots<T, S> = T & {
92
71
  new (): {
93
72
  $slots: S;
94
73
  };
95
74
  };
75
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
76
+ type __VLS_TypePropsToOption<T> = {
77
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
78
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
79
+ } : {
80
+ type: import('vue').PropType<T[K]>;
81
+ required: true;
82
+ };
83
+ };