maz-ui 3.46.1-beta.0 → 3.46.1-beta.1

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.
@@ -17,7 +17,13 @@ type LinkItem = ItemBase & MazLinkProps & {
17
17
  type ActionItem = ItemBase & {
18
18
  action?: () => unknown;
19
19
  };
20
- export type MenuItem = (LinkItem | ActionItem);
20
+ export type MenuItem = (LinkItem & {
21
+ action?: never;
22
+ }) | (ActionItem & {
23
+ href?: never;
24
+ to?: never;
25
+ target?: never;
26
+ });
21
27
  export interface Props {
22
28
  style?: HTMLAttributes['style'];
23
29
  class?: HTMLAttributes['class'];
@@ -68,10 +74,30 @@ declare function __VLS_template(): {
68
74
  item: MenuItem;
69
75
  }): any;
70
76
  "menuitem-label"?(_: {
71
- item: MenuItem;
77
+ item: Record<string, unknown> & {
78
+ label: string;
79
+ class?: unknown;
80
+ color?: Color;
81
+ } & MazLinkProps & {
82
+ target?: string;
83
+ href?: string;
84
+ to?: RouteLocationRaw;
85
+ } & {
86
+ action?: never;
87
+ };
72
88
  }): any;
73
89
  "menuitem-label"?(_: {
74
- item: MenuItem;
90
+ item: Record<string, unknown> & {
91
+ label: string;
92
+ class?: unknown;
93
+ color?: Color;
94
+ } & {
95
+ action?: () => unknown;
96
+ } & {
97
+ href?: never;
98
+ to?: never;
99
+ target?: never;
100
+ };
75
101
  }): any;
76
102
  };
77
103
  refs: {};
@@ -1,64 +1,64 @@
1
- import { computed as x, getCurrentInstance as ee, nextTick as oe, defineComponent as ne, defineAsyncComponent as I, ref as L, watch as T, resolveComponent as te, withDirectives as U, openBlock as b, createElementBlock as h, unref as u, normalizeClass as M, normalizeStyle as le, createElementVNode as w, withModifiers as z, renderSlot as m, createTextVNode as C, toDisplayString as g, createCommentVNode as v, createVNode as N, mergeProps as A, withCtx as B, createBlock as S, Transition as re, Fragment as F, renderList as se, vShow as ie } from "vue";
1
+ import { computed as ee, getCurrentInstance as oe, nextTick as ne, defineComponent as te, defineAsyncComponent as E, ref as L, watch as T, withDirectives as U, openBlock as v, createElementBlock as w, unref as a, normalizeClass as $, normalizeStyle as re, createElementVNode as h, withModifiers as z, renderSlot as f, createTextVNode as M, toDisplayString as A, createCommentVNode as p, createVNode as N, mergeProps as B, withCtx as O, createBlock as S, Transition as le, Fragment as F, renderList as se, vShow as ie } from "vue";
2
2
  import './assets/MazDropdown.css';function ae({
3
3
  componentName: t,
4
- providedId: l
4
+ providedId: r
5
5
  }) {
6
- return x(() => {
6
+ return ee(() => {
7
7
  var n;
8
- return l ?? `${t}-${(n = ee()) == null ? void 0 : n.uid}`;
8
+ return r ?? `${t}-${(n = oe()) == null ? void 0 : n.uid}`;
9
9
  });
10
10
  }
11
- const D = "__maz-click-outside__";
11
+ const g = "__maz-click-outside__";
12
12
  function V() {
13
13
  return document.ontouchstart === null ? "touchstart" : "click";
14
14
  }
15
- async function _(t, l) {
15
+ async function q(t, r) {
16
16
  try {
17
- q(t);
18
- const n = l.instance, c = l.value, k = typeof c == "function";
17
+ H(t);
18
+ const n = r.instance, d = r.value, k = typeof d == "function";
19
19
  if (!k)
20
20
  throw new Error("[maz-ui](vClickOutside) the callback should be a function");
21
- await oe(), t[D] = (f) => {
22
- if ((!t || f.target && !t.contains(f.target)) && c && k)
23
- return c.call(n, f);
21
+ await ne(), t[g] = (b) => {
22
+ if ((!t || b.target && !t.contains(b.target)) && d && k)
23
+ return d.call(n, b);
24
24
  };
25
- const E = V();
26
- document.addEventListener(E, t[D], { passive: !0 });
25
+ const C = V();
26
+ document.addEventListener(C, t[g], { passive: !0 });
27
27
  } catch (n) {
28
28
  console.error("[maz-ui](vClickOutside)", n);
29
29
  }
30
30
  }
31
- function q(t) {
31
+ function H(t) {
32
32
  try {
33
- const l = V();
34
- document.removeEventListener(l, t[D], !1), delete t[D];
35
- } catch (l) {
36
- console.error("[maz-ui](vClickOutside)", l);
33
+ const r = V();
34
+ document.removeEventListener(r, t[g], !1), delete t[g];
35
+ } catch (r) {
36
+ console.error("[maz-ui](vClickOutside)", r);
37
37
  }
38
38
  }
39
- function ue(t, l) {
39
+ function ue(t, r) {
40
40
  try {
41
- if (l.value === l.oldValue)
41
+ if (r.value === r.oldValue)
42
42
  return;
43
- _(t, l);
43
+ q(t, r);
44
44
  } catch (n) {
45
45
  console.error("[maz-ui](vClickOutside)", n);
46
46
  }
47
47
  }
48
48
  const de = {
49
- mounted: _,
49
+ mounted: q,
50
50
  updated: ue,
51
- unmounted: q
51
+ unmounted: H
52
52
  };
53
- function ce(t, l) {
53
+ function ce(t, r) {
54
54
  let n;
55
- return function(...c) {
55
+ return function(...d) {
56
56
  clearTimeout(n), n = setTimeout(() => {
57
- t.apply(this, c);
58
- }, l);
57
+ t.apply(this, d);
58
+ }, r);
59
59
  };
60
60
  }
61
- const fe = ["id"], pe = ["aria-expanded"], me = ["id"], ve = { class: "button-span" }, be = ["onClick"], ye = /* @__PURE__ */ ne({
61
+ const fe = ["id"], pe = ["aria-expanded"], me = ["id"], ve = { class: "button-span" }, be = ["onClick"], ye = /* @__PURE__ */ te({
62
62
  inheritAttrs: !1,
63
63
  __name: "MazDropdown",
64
64
  props: {
@@ -76,247 +76,242 @@ const fe = ["id"], pe = ["aria-expanded"], me = ["id"], ve = { class: "button-sp
76
76
  screenReaderDescription: { default: "Open menu dropdown" }
77
77
  },
78
78
  emits: ["menuitem-clicked", "update:open"],
79
- setup(t, { emit: l }) {
80
- const n = t, c = l, k = I(() => import("./chunks/MazBtn-C-RDq3T0.mjs").then((e) => e.M)), E = I(() => import("./chunks/chevron-down-BkvtON3b.mjs")), f = ae({
79
+ setup(t, { emit: r }) {
80
+ const n = t, d = r, k = E(() => import("./chunks/MazBtn-qFUqOv5D.mjs")), C = E(() => import("./chunks/MazLink-CJ1canOj.mjs")), b = E(() => import("./chunks/chevron-down-BkvtON3b.mjs")), y = ae({
81
81
  componentName: "MazDropdown",
82
82
  providedId: n.id
83
- }), i = L(n.open), s = L(), p = ce((e) => {
84
- a(e);
83
+ }), i = L(n.open), s = L(), c = ce((e) => {
84
+ u(e);
85
85
  }, 200);
86
- function H() {
87
- i.value && a(!1);
88
- }
89
86
  function R() {
90
- a(!i.value);
87
+ i.value && u(!1);
88
+ }
89
+ function _() {
90
+ u(!i.value);
91
91
  }
92
92
  function j() {
93
- ["click"].includes(n.trigger) && R();
93
+ ["click"].includes(n.trigger) && _();
94
94
  }
95
95
  function K() {
96
- ["hover", "both"].includes(n.trigger) && a(!0);
96
+ ["hover", "both"].includes(n.trigger) && u(!0);
97
97
  }
98
98
  function P() {
99
- ["hover", "both"].includes(n.trigger) && (i.value === !1 ? a(!0) : p(!0));
99
+ ["hover", "both"].includes(n.trigger) && (i.value === !1 ? u(!0) : c(!0));
100
100
  }
101
101
  function Q() {
102
- ["hover", "both"].includes(n.trigger) && p(!1);
102
+ ["hover", "both"].includes(n.trigger) && c(!1);
103
103
  }
104
104
  function G() {
105
- p(!1);
105
+ c(!1);
106
106
  }
107
- function a(e) {
108
- n.disabled || (i.value = e, c("update:open", e));
107
+ function u(e) {
108
+ n.disabled || (i.value = e, d("update:open", e));
109
109
  }
110
110
  function J(e) {
111
111
  return "action" in e;
112
112
  }
113
- async function W(e, r) {
114
- var d;
115
- c("menuitem-clicked", r), await ((d = e.action) == null ? void 0 : d.call(e)), n.noCloseOnClick || y();
113
+ function W(e) {
114
+ return "href" in e || "to" in e;
116
115
  }
117
- function y() {
118
- n.noCloseOnClick === !1 && a(!1);
116
+ async function X(e, l) {
117
+ var o;
118
+ d("menuitem-clicked", l), await ((o = e.action) == null ? void 0 : o.call(e)), n.noCloseOnClick || D();
119
119
  }
120
- function O(e) {
121
- e.key === "Escape" ? (e.preventDefault(), a(!1)) : ["ArrowDown", "ArrowUp"].includes(e.key) ? Y(e) : e.key === "Enter" && typeof s.value == "number" && (e.preventDefault(), document.querySelectorAll(`#${f.value} .menuitem`)[s.value].click(), y());
120
+ function D() {
121
+ n.noCloseOnClick === !1 && u(!1);
122
122
  }
123
- function X(e) {
124
- ["ArrowDown", "ArrowUp", "Enter"].includes(e.key) && i.value === !1 && (e.preventDefault(), a(!0));
123
+ function I(e) {
124
+ e.key === "Escape" ? (e.preventDefault(), u(!1)) : ["ArrowDown", "ArrowUp"].includes(e.key) ? Z(e) : e.key === "Enter" && typeof s.value == "number" && (e.preventDefault(), document.querySelectorAll(`#${y.value} .menuitem`)[s.value].click(), D());
125
125
  }
126
126
  function Y(e) {
127
- var o;
127
+ ["ArrowDown", "ArrowUp", "Enter"].includes(e.key) && i.value === !1 && (e.preventDefault(), u(!0));
128
+ }
129
+ function Z(e) {
130
+ var m;
128
131
  e.preventDefault();
129
- const r = e.key;
130
- i.value || a(!0);
131
- const d = (o = n.items) == null ? void 0 : o.length;
132
- d && (typeof s.value == "number" ? s.value === d - 1 && r === "ArrowDown" ? s.value = 0 : s.value === 0 && r === "ArrowUp" ? s.value = d - 1 : s.value = r === "ArrowDown" ? s.value + 1 : s.value - 1 : s.value = r === "ArrowDown" ? 0 : d - 1);
132
+ const l = e.key;
133
+ i.value || u(!0);
134
+ const o = (m = n.items) == null ? void 0 : m.length;
135
+ o && (typeof s.value == "number" ? s.value === o - 1 && l === "ArrowDown" ? s.value = 0 : s.value === 0 && l === "ArrowUp" ? s.value = o - 1 : s.value = l === "ArrowDown" ? s.value + 1 : s.value - 1 : s.value = l === "ArrowDown" ? 0 : o - 1);
133
136
  }
134
137
  return T(
135
138
  () => i.value,
136
139
  (e) => {
137
- e ? document.addEventListener("keydown", O) : document.removeEventListener("keydown", O), s.value = void 0;
140
+ e ? document.addEventListener("keydown", I) : document.removeEventListener("keydown", I), s.value = void 0;
138
141
  }
139
142
  ), T(
140
143
  () => n.open,
141
- (e) => a(e)
142
- ), (e, r) => {
143
- const d = te("MazLink");
144
- return U((b(), h("div", {
145
- id: u(f),
146
- class: M(["m-dropdown", [n.class]]),
147
- style: le(e.style)
144
+ (e) => u(e)
145
+ ), (e, l) => U((v(), w("div", {
146
+ id: a(y),
147
+ class: $(["m-dropdown", [n.class]]),
148
+ style: re(e.style)
149
+ }, [
150
+ h("div", {
151
+ role: "button",
152
+ tabindex: "0",
153
+ class: "m-dropdown__wrapper",
154
+ "aria-expanded": i.value,
155
+ "aria-haspopup": "menu",
156
+ onClick: z(j, ["stop"]),
157
+ onFocus: K,
158
+ onBlur: G,
159
+ onKeydown: Y,
160
+ onMouseenter: P,
161
+ onMouseleave: Q
148
162
  }, [
149
- w("div", {
150
- role: "button",
151
- tabindex: "0",
152
- class: "m-dropdown__wrapper",
153
- "aria-expanded": i.value,
154
- "aria-haspopup": "menu",
155
- onClick: z(j, ["stop"]),
156
- onFocus: K,
157
- onBlur: G,
158
- onKeydown: X,
159
- onMouseenter: P,
160
- onMouseleave: Q
163
+ h("span", {
164
+ id: `${a(y)}-labelspan`,
165
+ class: "maz-sr-only"
161
166
  }, [
162
- w("span", {
163
- id: `${u(f)}-labelspan`,
164
- class: "maz-sr-only"
165
- }, [
166
- m(e.$slots, "screen-reader-description", {}, () => [
167
- C(
168
- g(e.screenReaderDescription),
169
- 1
170
- /* TEXT */
171
- )
172
- ])
173
- ], 8, me),
174
- v(`
167
+ f(e.$slots, "screen-reader-description", {}, () => [
168
+ M(
169
+ A(e.screenReaderDescription),
170
+ 1
171
+ /* TEXT */
172
+ )
173
+ ])
174
+ ], 8, me),
175
+ p(`
175
176
  @slot Custom Element
176
177
  @binding {Boolen} is-open close function
177
178
  @default \`<MazBtn />\`
178
179
  `),
179
- m(e.$slots, "element", { isOpen: i.value }, () => [
180
- N(u(k), A({
181
- color: e.color,
182
- disabled: e.disabled,
183
- "aria-labelledby": `${u(f)}-labelspan`
184
- }, e.$attrs, { tabindex: "-1" }), {
185
- default: B(() => [
186
- w("span", ve, [
187
- v(" @slot Button text "),
188
- m(e.$slots, "default"),
189
- e.noChevron ? v("v-if", !0) : (b(), S(u(E), {
190
- key: 0,
191
- class: M([{ "maz-rotate-180": i.value }, "chevron-icon"])
192
- }, null, 8, ["class"]))
193
- ]),
194
- v(" @slot Menu Label ")
180
+ f(e.$slots, "element", { isOpen: i.value }, () => [
181
+ N(a(k), B({
182
+ color: e.color,
183
+ disabled: e.disabled,
184
+ "aria-labelledby": `${a(y)}-labelspan`
185
+ }, e.$attrs, { tabindex: "-1" }), {
186
+ default: O(() => [
187
+ h("span", ve, [
188
+ p(" @slot Button text "),
189
+ f(e.$slots, "default"),
190
+ e.noChevron ? p("v-if", !0) : (v(), S(a(b), {
191
+ key: 0,
192
+ class: $([{ "maz-rotate-180": i.value }, "chevron-icon"])
193
+ }, null, 8, ["class"]))
195
194
  ]),
196
- _: 3
197
- /* FORWARDED */
198
- }, 16, ["color", "disabled", "aria-labelledby"])
199
- ])
200
- ], 40, pe),
201
- N(re, {
202
- name: "maz-scale-fade",
203
- persisted: ""
204
- }, {
205
- default: B(() => [
206
- U(w(
207
- "div",
208
- {
209
- role: "menu",
210
- "aria-label": "Menu",
211
- class: M(["menu", {
212
- "--top": e.position.includes("top"),
213
- "--left": e.position.includes("left"),
214
- "--right": e.position.includes("right"),
215
- "--bottom": e.position.includes("bottom")
216
- }]),
217
- tabindex: "-1",
218
- onFocus: r[0] || (r[0] = (o) => u(p)(!0)),
219
- onBlur: r[1] || (r[1] = (o) => u(p)(!1)),
220
- onMouseenter: r[2] || (r[2] = (o) => ["hover", "both"].includes(e.trigger) ? u(p)(!0) : void 0),
221
- onMouseleave: r[3] || (r[3] = (o) => ["hover", "both"].includes(e.trigger) ? u(p)(!1) : void 0)
222
- },
223
- [
224
- v(`
195
+ p(" @slot Menu Label ")
196
+ ]),
197
+ _: 3
198
+ /* FORWARDED */
199
+ }, 16, ["color", "disabled", "aria-labelledby"])
200
+ ])
201
+ ], 40, pe),
202
+ N(le, {
203
+ name: "maz-scale-fade",
204
+ persisted: ""
205
+ }, {
206
+ default: O(() => [
207
+ U(h(
208
+ "div",
209
+ {
210
+ role: "menu",
211
+ "aria-label": "Menu",
212
+ class: $(["menu", {
213
+ "--top": e.position.includes("top"),
214
+ "--left": e.position.includes("left"),
215
+ "--right": e.position.includes("right"),
216
+ "--bottom": e.position.includes("bottom")
217
+ }]),
218
+ tabindex: "-1",
219
+ onFocus: l[0] || (l[0] = (o) => a(c)(!0)),
220
+ onBlur: l[1] || (l[1] = (o) => a(c)(!1)),
221
+ onMouseenter: l[2] || (l[2] = (o) => ["hover", "both"].includes(e.trigger) ? a(c)(!0) : void 0),
222
+ onMouseleave: l[3] || (l[3] = (o) => ["hover", "both"].includes(e.trigger) ? a(c)(!1) : void 0)
223
+ },
224
+ [
225
+ p(`
225
226
  @slot Custom dropdown panel
226
227
  @binding {Array} items - items prop data
227
228
  `),
228
- m(e.$slots, "dropdown", { items: e.items }, () => [
229
- (b(!0), h(
229
+ f(e.$slots, "dropdown", { items: e.items }, () => [
230
+ (v(!0), w(
231
+ F,
232
+ null,
233
+ se(e.items, (o, m) => (v(), w(
230
234
  F,
231
- null,
232
- se(e.items, (o, $) => (b(), h(
233
- F,
234
- { key: $ },
235
- [
236
- v(`
235
+ { key: m },
236
+ [
237
+ p(`
237
238
  @slot Custom menu item
238
239
  @binding {Object} item - menu item
239
240
  `),
240
- m(e.$slots, "menuitem", { item: o }, () => [
241
- C(
242
- g(o.label) + " ",
243
- 1
244
- /* TEXT */
245
- ),
246
- o.to || o.href ? (b(), S(d, A({
247
- key: 0,
248
- target: o.href ? o.target ?? "_self" : void 0,
249
- to: o.to,
250
- href: o.href,
251
- color: o.color ?? "theme",
252
- ref_for: !0
253
- }, o, {
254
- class: ["menuitem", [
255
- {
256
- "--is-keyboard-selected": s.value === $
257
- },
258
- o.class
259
- ]],
260
- tabindex: "-1",
261
- onClick: z(y, ["stop"])
262
- }), {
263
- default: B(() => [
264
- m(e.$slots, "menuitem-label", { item: o }, () => [
265
- C(
266
- g(o.label),
267
- 1
268
- /* TEXT */
269
- )
270
- ])
271
- ]),
272
- _: 2
273
- /* DYNAMIC */
274
- }, 1040, ["target", "to", "href", "color", "class"])) : o.action ? (b(), h("button", A({
275
- key: 1,
276
- tabindex: "-1",
277
- type: "button",
278
- ref_for: !0
279
- }, o, {
280
- class: ["menuitem menuitem__button", [
281
- {
282
- "--is-keyboard-selected": s.value === $
283
- },
284
- o.class,
285
- `--${o.color ?? "theme"}`
286
- ]],
287
- onClick: z((Z) => J(o) ? W(o, Z) : y(), ["stop"])
288
- }), [
289
- m(e.$slots, "menuitem-label", { item: o }, () => [
290
- C(
291
- g(o.label),
241
+ f(e.$slots, "menuitem", { item: o }, () => [
242
+ W(o) ? (v(), S(a(C), B({
243
+ key: 0,
244
+ target: o.href ? o.target ?? "_self" : void 0,
245
+ to: o.to,
246
+ href: o.href,
247
+ color: o.color ?? "theme",
248
+ ref_for: !0
249
+ }, o, {
250
+ class: ["menuitem", [
251
+ {
252
+ "--is-keyboard-selected": s.value === m
253
+ },
254
+ o.class
255
+ ]],
256
+ tabindex: "-1",
257
+ onClick: z(D, ["stop"])
258
+ }), {
259
+ default: O(() => [
260
+ f(e.$slots, "menuitem-label", { item: o }, () => [
261
+ M(
262
+ A(o.label),
292
263
  1
293
264
  /* TEXT */
294
265
  )
295
266
  ])
296
- ], 16, be)) : v("v-if", !0)
297
- ])
298
- ],
299
- 64
300
- /* STABLE_FRAGMENT */
301
- ))),
302
- 128
303
- /* KEYED_FRAGMENT */
304
- ))
305
- ])
306
- ],
307
- 34
308
- /* CLASS, NEED_HYDRATION */
309
- ), [
310
- [ie, i.value]
311
- ])
312
- ]),
313
- _: 3
314
- /* FORWARDED */
315
- })
316
- ], 14, fe)), [
317
- [u(de), H]
318
- ]);
319
- };
267
+ ]),
268
+ _: 2
269
+ /* DYNAMIC */
270
+ }, 1040, ["target", "to", "href", "color", "class"])) : J(o) ? (v(), w("button", B({
271
+ key: 1,
272
+ tabindex: "-1",
273
+ type: "button",
274
+ ref_for: !0
275
+ }, o, {
276
+ class: ["menuitem menuitem__button", [
277
+ {
278
+ "--is-keyboard-selected": s.value === m
279
+ },
280
+ o.class,
281
+ `--${o.color ?? "theme"}`
282
+ ]],
283
+ onClick: z((x) => X(o, x), ["stop"])
284
+ }), [
285
+ f(e.$slots, "menuitem-label", { item: o }, () => [
286
+ M(
287
+ A(o.label),
288
+ 1
289
+ /* TEXT */
290
+ )
291
+ ])
292
+ ], 16, be)) : p("v-if", !0)
293
+ ])
294
+ ],
295
+ 64
296
+ /* STABLE_FRAGMENT */
297
+ ))),
298
+ 128
299
+ /* KEYED_FRAGMENT */
300
+ ))
301
+ ])
302
+ ],
303
+ 34
304
+ /* CLASS, NEED_HYDRATION */
305
+ ), [
306
+ [ie, i.value]
307
+ ])
308
+ ]),
309
+ _: 3
310
+ /* FORWARDED */
311
+ })
312
+ ], 14, fe)), [
313
+ [a(de), R]
314
+ ]);
320
315
  }
321
316
  });
322
317
  export {
@@ -0,0 +1,150 @@
1
+ import { defineComponent as F, defineAsyncComponent as h, useAttrs as j, useSlots as E, onBeforeMount as O, computed as l, openBlock as n, createBlock as a, resolveDynamicComponent as r, normalizeClass as s, withCtx as R, createElementBlock as u, createCommentVNode as t, renderSlot as d, unref as c } from "vue";
2
+ import { _ as w } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
3
+ import '../assets/MazBtn.css';const A = /* @__PURE__ */ F({
4
+ __name: "MazBtn",
5
+ props: {
6
+ variant: { default: "button" },
7
+ size: { default: "md" },
8
+ color: { default: "primary" },
9
+ type: { default: "button" },
10
+ rounded: { type: Boolean },
11
+ roundedSize: { default: "lg" },
12
+ noRounded: { type: Boolean },
13
+ outline: { type: Boolean },
14
+ pastel: { type: Boolean },
15
+ block: { type: Boolean },
16
+ noUnderline: { type: Boolean },
17
+ loading: { type: Boolean },
18
+ disabled: { type: Boolean },
19
+ fab: { type: Boolean },
20
+ icon: { type: [String, Function, Object], default: void 0 },
21
+ leftIcon: { type: [String, Function, Object], default: void 0 },
22
+ rightIcon: { type: [String, Function, Object], default: void 0 },
23
+ noPadding: { type: Boolean },
24
+ noElevation: { type: Boolean },
25
+ contentClass: { default: void 0 }
26
+ },
27
+ setup(g) {
28
+ const o = g, z = h(() => import("./MazSpinner-SgVUnAHk.mjs")), f = h(() => import("./MazIcon-BDGxCy9M.mjs")), { href: k, to: B } = j(), p = E();
29
+ O(() => {
30
+ o.icon && !o.fab && console.error('[maz-ui](MazBtn) the prop "icon" must be used only with "fab" props');
31
+ });
32
+ const v = l(() => k ? "a" : B ? "router-link" : "button"), I = l(
33
+ () => o.pastel ? `--${o.color}-pastel` : o.outline ? `--${o.color}-outline` : `--${o.color}`
34
+ ), b = l(
35
+ () => (o.loading || o.disabled) && v.value === "button"
36
+ ), C = l(() => b.value ? "--cursor-default" : "--cursor-pointer"), $ = l(() => `--is-${o.variant}`), i = l(() => o.loading && o.variant === "button"), m = l(() => !!p["left-icon"] || o.leftIcon), y = l(() => !!p["right-icon"] || o.rightIcon), S = l(() => m.value || y.value), M = l(() => o.fab && (o.icon || !!p.icon)), T = l(() => v.value === "button" ? o.type : void 0);
37
+ return (e, D) => (n(), a(r(v.value), {
38
+ disabled: b.value || void 0,
39
+ class: s(["m-btn", [
40
+ `--${e.size}`,
41
+ !e.fab && !e.rounded && e.roundedSize && `--rounded-${e.roundedSize}`,
42
+ I.value,
43
+ C.value,
44
+ $.value,
45
+ {
46
+ "--block": e.block,
47
+ "--no-underline": e.noUnderline,
48
+ "--fab": e.fab,
49
+ "--loading": e.loading,
50
+ "--disabled": b.value,
51
+ "--icon": S.value,
52
+ "--rounded": e.rounded,
53
+ "--no-rounded": e.noRounded,
54
+ "--no-padding": e.noPadding,
55
+ "--no-elevation": e.noElevation
56
+ }
57
+ ]]),
58
+ type: T.value
59
+ }, {
60
+ default: R(() => [
61
+ m.value ? (n(), u(
62
+ "div",
63
+ {
64
+ key: 0,
65
+ class: s(["m-btn__icon-left maz-flex maz-flex-center", { "maz-invisible": i.value }])
66
+ },
67
+ [
68
+ t(`
69
+ @slot left-icon - The icon to display on the left of the button
70
+ `),
71
+ d(e.$slots, "left-icon", {}, () => [
72
+ typeof e.leftIcon == "string" ? (n(), a(c(f), {
73
+ key: 0,
74
+ name: e.leftIcon
75
+ }, null, 8, ["name"])) : e.leftIcon ? (n(), a(r(e.leftIcon), { key: 1 })) : t("v-if", !0)
76
+ ], !0)
77
+ ],
78
+ 2
79
+ /* CLASS */
80
+ )) : t("v-if", !0),
81
+ M.value ? (n(), u(
82
+ "div",
83
+ {
84
+ key: 1,
85
+ class: s(["m-btn__icon", { "maz-invisible": i.value }])
86
+ },
87
+ [
88
+ t(`
89
+ @slot icon - The icon to display on the fab button
90
+ `),
91
+ d(e.$slots, "icon", {}, () => [
92
+ typeof e.icon == "string" ? (n(), a(c(f), {
93
+ key: 0,
94
+ name: e.icon
95
+ }, null, 8, ["name"])) : e.icon ? (n(), a(r(e.icon), { key: 1 })) : t("v-if", !0)
96
+ ], !0)
97
+ ],
98
+ 2
99
+ /* CLASS */
100
+ )) : t("v-if", !0),
101
+ e.$slots.default ? (n(), u(
102
+ "span",
103
+ {
104
+ key: 2,
105
+ class: s([{ "maz-invisible": i.value }, e.contentClass])
106
+ },
107
+ [
108
+ t(`
109
+ @slot default - The content of the button
110
+ `),
111
+ d(e.$slots, "default", {}, void 0, !0)
112
+ ],
113
+ 2
114
+ /* CLASS */
115
+ )) : t("v-if", !0),
116
+ y.value ? (n(), u(
117
+ "div",
118
+ {
119
+ key: 3,
120
+ class: s(["m-btn__icon-right", { "maz-invisible": i.value }])
121
+ },
122
+ [
123
+ t(`
124
+ @slot right-icon - The icon to display on the right of the button
125
+ `),
126
+ d(e.$slots, "right-icon", {}, () => [
127
+ typeof e.rightIcon == "string" ? (n(), a(c(f), {
128
+ key: 0,
129
+ name: e.rightIcon
130
+ }, null, 8, ["name"])) : e.rightIcon ? (n(), a(r(e.rightIcon), { key: 1 })) : t("v-if", !0)
131
+ ], !0)
132
+ ],
133
+ 2
134
+ /* CLASS */
135
+ )) : t("v-if", !0),
136
+ i.value ? (n(), a(c(z), {
137
+ key: 4,
138
+ class: "m-btn-loader",
139
+ size: "2em",
140
+ color: e.color
141
+ }, null, 8, ["color"])) : t("v-if", !0)
142
+ ]),
143
+ _: 3
144
+ /* FORWARDED */
145
+ }, 8, ["disabled", "class", "type"]));
146
+ }
147
+ }), U = /* @__PURE__ */ w(A, [["__scopeId", "data-v-792f66c0"]]);
148
+ export {
149
+ U as default
150
+ };
@@ -0,0 +1,79 @@
1
+ import { defineComponent as u, defineAsyncComponent as d, openBlock as o, createBlock as n, resolveDynamicComponent as r, mergeProps as s, withCtx as p, createCommentVNode as t, renderSlot as l, unref as a, createVNode as h } from "vue";
2
+ import { _ as m } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
3
+ import '../assets/MazLink.css';const y = /* @__PURE__ */ u({
4
+ __name: "MazLink",
5
+ props: {
6
+ id: { default: void 0 },
7
+ title: { default: void 0 },
8
+ href: { default: "#" },
9
+ to: { default: void 0 },
10
+ color: { default: "primary" },
11
+ target: { default: "_self" },
12
+ download: { default: void 0 },
13
+ rel: { default: void 0 },
14
+ ariaLabel: { default: void 0 },
15
+ underline: { type: Boolean, default: !1 },
16
+ underlineOnlyHover: { type: Boolean, default: !0 },
17
+ autoExternal: { type: Boolean, default: !0 },
18
+ leftIcon: { type: [String, Function, Object], default: void 0 },
19
+ rightIcon: { type: [String, Function, Object], default: void 0 }
20
+ },
21
+ setup(c) {
22
+ const f = d(
23
+ () => import("./arrow-top-right-on-square-jPmYJ34F.mjs")
24
+ ), i = d(() => import("./MazIcon-BDGxCy9M.mjs"));
25
+ return (e, g) => (o(), n(r(e.to ? "router-link" : "a"), s({
26
+ id: e.id,
27
+ class: ["m-link", [
28
+ {
29
+ "--underline": e.underline,
30
+ "--underline-only-hover": !e.underline && e.underlineOnlyHover
31
+ },
32
+ `--${e.color}`
33
+ ]],
34
+ to: e.to,
35
+ href: e.href,
36
+ title: e.title,
37
+ target: e.target,
38
+ rel: e.rel,
39
+ download: e.download,
40
+ "aria-label": e.ariaLabel
41
+ }, e.$attrs), {
42
+ default: p(() => [
43
+ t(`
44
+ @slot left-icon - The icon to display on the left of the text
45
+ `),
46
+ l(e.$slots, "left-icon", {}, () => [
47
+ typeof e.leftIcon == "string" ? (o(), n(a(i), {
48
+ key: 0,
49
+ name: e.leftIcon
50
+ }, null, 8, ["name"])) : e.leftIcon ? (o(), n(r(e.leftIcon), { key: 1 })) : t("v-if", !0)
51
+ ], !0),
52
+ t(`
53
+ @slot Text of the link
54
+ `),
55
+ l(e.$slots, "default", {}, void 0, !0),
56
+ t(`
57
+ @slot right-icon - The icon to display on the left of the text
58
+ `),
59
+ l(e.$slots, "right-icon", {}, () => [
60
+ typeof e.rightIcon == "string" ? (o(), n(a(i), {
61
+ key: 0,
62
+ name: e.rightIcon
63
+ }, null, 8, ["name"])) : e.rightIcon ? (o(), n(r(e.rightIcon), { key: 1 })) : t("v-if", !0)
64
+ ], !0),
65
+ t(`
66
+ @slot external-icon - Replace the default external icon
67
+ `),
68
+ e.autoExternal && e.target === "_blank" ? l(e.$slots, "external-icon", { key: 0 }, () => [
69
+ h(a(f))
70
+ ], !0) : t("v-if", !0)
71
+ ]),
72
+ _: 3
73
+ /* FORWARDED */
74
+ }, 16, ["id", "class", "to", "href", "title", "target", "rel", "download", "aria-label"]));
75
+ }
76
+ }), I = /* @__PURE__ */ m(y, [["__scopeId", "data-v-b1120a61"]]);
77
+ export {
78
+ I as default
79
+ };
@@ -0,0 +1,37 @@
1
+ import { defineComponent as n, openBlock as r, createElementBlock as o, normalizeClass as s, createElementVNode as a } from "vue";
2
+ import { _ as i } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
3
+ import '../assets/MazSpinner.css';const c = ["width", "height"], p = /* @__PURE__ */ n({
4
+ __name: "MazSpinner",
5
+ props: {
6
+ size: { type: String, default: "2em" },
7
+ color: {
8
+ type: String,
9
+ default: "primary"
10
+ }
11
+ },
12
+ setup(e) {
13
+ return (l, t) => (r(), o("svg", {
14
+ width: e.size,
15
+ height: e.size,
16
+ version: "1.1",
17
+ xmlns: "http://www.w3.org/2000/svg",
18
+ x: "0px",
19
+ y: "0px",
20
+ viewBox: "0 0 50 50",
21
+ "xml:space": "preserve",
22
+ class: s(["m-spinner", `m-spinner--${e.color}`]),
23
+ style: { "enable-background": "new 0 0 50 50" }
24
+ }, t[0] || (t[0] = [
25
+ a(
26
+ "path",
27
+ { 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" },
28
+ null,
29
+ -1
30
+ /* HOISTED */
31
+ )
32
+ ]), 10, c));
33
+ }
34
+ }), h = /* @__PURE__ */ i(p, [["__scopeId", "data-v-c16a57a3"]]);
35
+ export {
36
+ h as default
37
+ };
@@ -0,0 +1,9 @@
1
+ const s = (t, r) => {
2
+ const o = t.__vccOpts || t;
3
+ for (const [c, e] of r)
4
+ o[c] = e;
5
+ return o;
6
+ };
7
+ export {
8
+ s as _
9
+ };
package/nuxt/index.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.0.0"
6
6
  },
7
- "version": "3.46.1-beta.0",
7
+ "version": "3.46.1-beta.1",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "maz-ui",
3
3
  "type": "module",
4
- "version": "3.46.1-beta.0",
4
+ "version": "3.46.1-beta.1",
5
5
  "description": "A standalone components library for Vue.Js 3 & Nuxt.Js 3",
6
6
  "author": "Louis Mazel <me@loicmazuel.com>",
7
7
  "license": "MIT",
@@ -17,7 +17,13 @@ type LinkItem = ItemBase & MazLinkProps & {
17
17
  type ActionItem = ItemBase & {
18
18
  action?: () => unknown;
19
19
  };
20
- export type MenuItem = (LinkItem | ActionItem);
20
+ export type MenuItem = (LinkItem & {
21
+ action?: never;
22
+ }) | (ActionItem & {
23
+ href?: never;
24
+ to?: never;
25
+ target?: never;
26
+ });
21
27
  export interface Props {
22
28
  style?: HTMLAttributes['style'];
23
29
  class?: HTMLAttributes['class'];
@@ -68,10 +74,30 @@ declare function __VLS_template(): {
68
74
  item: MenuItem;
69
75
  }): any;
70
76
  "menuitem-label"?(_: {
71
- item: MenuItem;
77
+ item: Record<string, unknown> & {
78
+ label: string;
79
+ class?: unknown;
80
+ color?: Color;
81
+ } & MazLinkProps & {
82
+ target?: string;
83
+ href?: string;
84
+ to?: RouteLocationRaw;
85
+ } & {
86
+ action?: never;
87
+ };
72
88
  }): any;
73
89
  "menuitem-label"?(_: {
74
- item: MenuItem;
90
+ item: Record<string, unknown> & {
91
+ label: string;
92
+ class?: unknown;
93
+ color?: Color;
94
+ } & {
95
+ action?: () => unknown;
96
+ } & {
97
+ href?: never;
98
+ to?: never;
99
+ target?: never;
100
+ };
75
101
  }): any;
76
102
  };
77
103
  refs: {};