maz-ui 3.47.2-beta.4 → 3.47.2-beta.5

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.
@@ -1,7 +1,7 @@
1
1
  import type { RouteLocationRaw } from 'vue-router';
2
2
  import type { Color } from './MazBtn.vue';
3
3
  import type { MazLinkProps } from './MazLink.vue';
4
- import type { Position } from './types';
4
+ import type { Icon, Position } from './types';
5
5
  import { type HTMLAttributes } from 'vue';
6
6
  export type { Color, Position };
7
7
  type ItemBase = Record<string, unknown> & {
@@ -77,6 +77,7 @@ export interface MazDropdownProps {
77
77
  * If true, the button will have a full width
78
78
  */
79
79
  block?: boolean;
80
+ dropdownIcon?: string | Icon;
80
81
  }
81
82
  declare function __VLS_template(): {
82
83
  slots: {
@@ -1,327 +1,4 @@
1
- import { useId as ee, computed as oe, ref as y, nextTick as ne, defineComponent as te, defineAsyncComponent as D, watch as I, withDirectives as T, openBlock as v, createElementBlock as b, unref as a, normalizeClass as $, normalizeStyle as S, createElementVNode as L, withModifiers as E, renderSlot as p, createTextVNode as z, toDisplayString as B, createCommentVNode as O, createVNode as U, mergeProps as A, createSlots as re, withCtx as h, createBlock as N, Transition as le, Fragment as se, renderList as ie, vShow as ae } from "vue";
2
- import './assets/MazDropdown.css';function ue({
3
- componentName: t,
4
- providedId: r
5
- }) {
6
- const n = ee();
7
- return oe(() => r ?? `${t}-${n}`);
8
- }
9
- y("system");
10
- y("system");
11
- const w = "__maz-click-outside__";
12
- function F() {
13
- return document.ontouchstart === null ? "touchstart" : "click";
14
- }
15
- async function P(t, r) {
16
- try {
17
- V(t);
18
- const n = r.instance, c = r.value, d = typeof c == "function";
19
- if (!d)
20
- throw new Error("[maz-ui](vClickOutside) the callback should be a function");
21
- await ne(), t[w] = (k) => {
22
- if ((!t || k.target && !t.contains(k.target)) && c && d)
23
- return c.call(n, k);
24
- };
25
- const C = F();
26
- document.addEventListener(C, t[w], { passive: !0 });
27
- } catch (n) {
28
- console.error("[maz-ui](vClickOutside)", n);
29
- }
30
- }
31
- function V(t) {
32
- try {
33
- const r = F();
34
- document.removeEventListener(r, t[w], !1), delete t[w];
35
- } catch (r) {
36
- console.error("[maz-ui](vClickOutside)", r);
37
- }
38
- }
39
- function ce(t, r) {
40
- try {
41
- if (r.value === r.oldValue)
42
- return;
43
- P(t, r);
44
- } catch (n) {
45
- console.error("[maz-ui](vClickOutside)", n);
46
- }
47
- }
48
- const de = {
49
- mounted: P,
50
- updated: ce,
51
- unmounted: V
52
- };
53
- function fe(t, r) {
54
- let n;
55
- return function(...c) {
56
- clearTimeout(n), n = setTimeout(() => {
57
- t.apply(this, c);
58
- }, r);
59
- };
60
- }
61
- const pe = {
62
- cancelText: "Cancel",
63
- confirmText: "Confirm",
64
- cancelButton: {
65
- text: "Cancel",
66
- color: "danger"
67
- },
68
- confirmButton: {
69
- text: "Confirm",
70
- color: "success"
71
- }
72
- };
73
- y(pe);
74
- y([]);
75
- const me = ["id"], ve = ["aria-expanded"], ye = ["id"], ke = ["onClick"], he = /* @__PURE__ */ te({
76
- inheritAttrs: !1,
77
- __name: "MazDropdown",
78
- props: {
79
- style: { default: void 0 },
80
- class: { default: void 0 },
81
- items: { default: () => [] },
82
- open: { type: Boolean },
83
- id: { default: void 0 },
84
- trigger: { default: "both" },
85
- color: { default: "transparent" },
86
- position: { default: "bottom left" },
87
- noCloseOnClick: { type: Boolean },
88
- disabled: { type: Boolean },
89
- noChevron: { type: Boolean },
90
- screenReaderDescription: { default: "Open menu dropdown" },
91
- menuPanelClass: {},
92
- menuPanelStyle: {},
93
- block: { type: Boolean }
94
- },
95
- emits: ["menuitem-clicked", "update:open"],
96
- setup(t, { emit: r }) {
97
- const n = t, c = r, d = ue({
98
- componentName: "MazDropdown",
99
- providedId: n.id
100
- }), C = D(() => import("./chunks/MazBtn-cDJlUVVY.mjs")), k = D(() => import("./chunks/MazLink-C_3Wya94.mjs")), H = D(() => import("./chunks/chevron-down-BkvtON3b.mjs")), i = y(n.open), s = y(), f = fe((e) => {
101
- u(e);
102
- }, 200);
103
- function R() {
104
- i.value && u(!1);
105
- }
106
- function q() {
107
- u(!i.value);
108
- }
109
- function K() {
110
- ["click"].includes(n.trigger) && q();
111
- }
112
- function Q() {
113
- ["hover", "both"].includes(n.trigger) && u(!0);
114
- }
115
- function j() {
116
- ["hover", "both"].includes(n.trigger) && (i.value === !1 ? u(!0) : f(!0));
117
- }
118
- function G() {
119
- ["hover", "both"].includes(n.trigger) && f(!1);
120
- }
121
- function J() {
122
- f(!1);
123
- }
124
- function u(e) {
125
- n.disabled || (i.value = e, c("update:open", e));
126
- }
127
- function W(e) {
128
- return "action" in e;
129
- }
130
- function X(e) {
131
- return "href" in e || "to" in e;
132
- }
133
- async function Y(e, l) {
134
- var o;
135
- c("menuitem-clicked", l), await ((o = e.action) == null ? void 0 : o.call(e)), n.noCloseOnClick || g();
136
- }
137
- function g() {
138
- n.noCloseOnClick === !1 && u(!1);
139
- }
140
- function M(e) {
141
- e.key === "Escape" ? (e.preventDefault(), u(!1)) : ["ArrowDown", "ArrowUp"].includes(e.key) ? _(e) : e.key === "Enter" && typeof s.value == "number" && (e.preventDefault(), document.querySelectorAll(`#${d.value} .menuitem`)[s.value].click(), g());
142
- }
143
- function Z(e) {
144
- ["ArrowDown", "ArrowUp", "Enter"].includes(e.key) && i.value === !1 && (e.preventDefault(), u(!0));
145
- }
146
- function _(e) {
147
- var m;
148
- e.preventDefault();
149
- const l = e.key;
150
- i.value || u(!0);
151
- const o = (m = n.items) == null ? void 0 : m.length;
152
- 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);
153
- }
154
- return I(
155
- () => i.value,
156
- (e) => {
157
- e ? document.addEventListener("keydown", M) : document.removeEventListener("keydown", M), s.value = void 0;
158
- }
159
- ), I(
160
- () => n.open,
161
- (e) => u(e)
162
- ), (e, l) => T((v(), b("div", {
163
- id: a(d),
164
- class: $(["m-dropdown", [n.class, { "--block": e.block }]]),
165
- style: S(e.style)
166
- }, [
167
- L("div", {
168
- role: "button",
169
- tabindex: "0",
170
- class: "m-dropdown__wrapper",
171
- "aria-expanded": i.value,
172
- "aria-haspopup": "menu",
173
- onClick: E(K, ["stop"]),
174
- onFocus: Q,
175
- onBlur: J,
176
- onKeydown: Z,
177
- onMouseenter: j,
178
- onMouseleave: G
179
- }, [
180
- e.screenReaderDescription || e.$slots["screen-reader-description"] ? (v(), b("span", {
181
- key: 0,
182
- id: `${a(d)}-labelspan`,
183
- class: "maz-sr-only"
184
- }, [
185
- p(e.$slots, "screen-reader-description", {}, () => [
186
- z(
187
- B(e.screenReaderDescription),
188
- 1
189
- /* TEXT */
190
- )
191
- ])
192
- ], 8, ye)) : O("v-if", !0),
193
- p(e.$slots, "element", { isOpen: i.value }, () => [
194
- U(a(C), A({
195
- "aria-labelledby": `${a(d)}-labelspan`,
196
- color: e.color,
197
- disabled: e.disabled
198
- }, e.$attrs, {
199
- tabindex: "-1",
200
- block: e.block
201
- }), re({
202
- default: h(() => [
203
- p(e.$slots, "default")
204
- ]),
205
- _: 2
206
- /* DYNAMIC */
207
- }, [
208
- e.noChevron ? void 0 : {
209
- name: "right-icon",
210
- fn: h(() => [
211
- e.noChevron ? O("v-if", !0) : (v(), N(a(H), {
212
- key: 0,
213
- class: $([{ "maz-rotate-180": i.value }, "chevron-icon"])
214
- }, null, 8, ["class"]))
215
- ]),
216
- key: "0"
217
- }
218
- ]), 1040, ["aria-labelledby", "color", "disabled", "block"])
219
- ])
220
- ], 40, ve),
221
- U(le, {
222
- name: "maz-scale-fade",
223
- persisted: ""
224
- }, {
225
- default: h(() => [
226
- T(L(
227
- "div",
228
- {
229
- role: "menu",
230
- "aria-label": "Menu",
231
- class: $(["menu", [{
232
- "--top": e.position.includes("top"),
233
- "--left": e.position.includes("left"),
234
- "--right": e.position.includes("right"),
235
- "--bottom": e.position.includes("bottom")
236
- }, e.menuPanelClass]]),
237
- tabindex: "-1",
238
- style: S(e.menuPanelStyle),
239
- onFocus: l[0] || (l[0] = (o) => a(f)(!0)),
240
- onBlur: l[1] || (l[1] = (o) => a(f)(!1)),
241
- onMouseenter: l[2] || (l[2] = (o) => ["hover", "both"].includes(e.trigger) ? a(f)(!0) : void 0),
242
- onMouseleave: l[3] || (l[3] = (o) => ["hover", "both"].includes(e.trigger) ? a(f)(!1) : void 0)
243
- },
244
- [
245
- p(e.$slots, "dropdown", { items: e.items }, () => [
246
- (v(!0), b(
247
- se,
248
- null,
249
- ie(e.items, (o, m) => p(e.$slots, "menuitem", {
250
- key: m,
251
- item: o
252
- }, () => [
253
- X(o) ? (v(), N(a(k), A({
254
- key: 0,
255
- target: o.href ? o.target ?? "_self" : void 0,
256
- to: o.to,
257
- href: o.href,
258
- color: o.color ?? "theme",
259
- ref_for: !0
260
- }, o, {
261
- "underline-only-hover": o.underlineOnlyHover ?? !1,
262
- class: ["menuitem", [
263
- {
264
- "--is-keyboard-selected": s.value === m
265
- },
266
- o.class
267
- ]],
268
- tabindex: "-1",
269
- onClick: E(g, ["stop"])
270
- }), {
271
- default: h(() => [
272
- p(e.$slots, "menuitem-label", { item: o }, () => [
273
- z(
274
- B(o.label),
275
- 1
276
- /* TEXT */
277
- )
278
- ])
279
- ]),
280
- _: 2
281
- /* DYNAMIC */
282
- }, 1040, ["target", "to", "href", "color", "underline-only-hover", "class"])) : W(o) ? (v(), b("button", A({
283
- key: 1,
284
- tabindex: "-1",
285
- type: "button",
286
- ref_for: !0
287
- }, o, {
288
- class: ["menuitem menuitem__button", [
289
- {
290
- "--is-keyboard-selected": s.value === m
291
- },
292
- o.class,
293
- `--${o.color ?? "theme"}`
294
- ]],
295
- onClick: E((x) => Y(o, x), ["stop"])
296
- }), [
297
- p(e.$slots, "menuitem-label", { item: o }, () => [
298
- z(
299
- B(o.label),
300
- 1
301
- /* TEXT */
302
- )
303
- ])
304
- ], 16, ke)) : O("v-if", !0)
305
- ])),
306
- 128
307
- /* KEYED_FRAGMENT */
308
- ))
309
- ])
310
- ],
311
- 38
312
- /* CLASS, STYLE, NEED_HYDRATION */
313
- ), [
314
- [ae, i.value]
315
- ])
316
- ]),
317
- _: 3
318
- /* FORWARDED */
319
- })
320
- ], 14, me)), [
321
- [a(de), R]
322
- ]);
323
- }
324
- });
1
+ import { a as f } from "./chunks/MazDropdown-peYVJsXv.mjs";
325
2
  export {
326
- he as default
3
+ f as default
327
4
  };
@@ -28,7 +28,7 @@ import '../assets/MazBtn.css';const N = {
28
28
  justify: { default: "center" }
29
29
  },
30
30
  setup(z) {
31
- const n = z, b = v(() => import("./MazSpinner-yr9xVdAa.mjs")), c = v(() => import("./MazIcon-BbvBov5G.mjs")), { href: g, to: h } = E(), f = O(), y = o(() => g ? "a" : h ? "router-link" : "button"), j = o(
31
+ const n = z, b = v(() => import("./MazSpinner-yr9xVdAa.mjs")), c = v(() => import("./MazIcon-Bk4mYF1h.mjs")), { href: g, to: h } = E(), f = O(), y = o(() => g ? "a" : h ? "router-link" : "button"), j = o(
32
32
  () => n.pastel ? `--${n.color}-pastel` : n.outline ? `--${n.color}-outline` : `--${n.color}`
33
33
  ), m = o(
34
34
  () => (n.loading || n.disabled) && y.value === "button"
@@ -0,0 +1,441 @@
1
+ import { inject as re, useId as le, computed as q, ref as k, nextTick as Y, defineComponent as Z, onMounted as se, watchEffect as ie, openBlock as y, createElementBlock as S, mergeProps as z, createCommentVNode as M, defineAsyncComponent as N, watch as j, withDirectives as K, unref as m, normalizeClass as U, normalizeStyle as Q, createElementVNode as X, withModifiers as F, renderSlot as b, createTextVNode as H, toDisplayString as V, createVNode as J, createSlots as ae, withCtx as $, Fragment as W, createBlock as D, resolveDynamicComponent as ue, Transition as ce, renderList as de, vShow as fe } from "vue";
2
+ import '../assets/MazDropdown.css';function pe(l, s) {
3
+ const n = re(l, s);
4
+ if (!n)
5
+ throw new TypeError(`[maz-ui](injectStrict) Could not resolve ${l}`);
6
+ return n;
7
+ }
8
+ function me({
9
+ componentName: l,
10
+ providedId: s
11
+ }) {
12
+ const n = le();
13
+ return q(() => s ?? `${l}-${n}`);
14
+ }
15
+ k("system");
16
+ k("system");
17
+ const I = "__maz-click-outside__";
18
+ function _() {
19
+ return document.ontouchstart === null ? "touchstart" : "click";
20
+ }
21
+ async function x(l, s) {
22
+ try {
23
+ ee(l);
24
+ const n = s.instance, f = s.value, p = typeof f == "function";
25
+ if (!p)
26
+ throw new Error("[maz-ui](vClickOutside) the callback should be a function");
27
+ await Y(), l[I] = (w) => {
28
+ if ((!l || w.target && !l.contains(w.target)) && f && p)
29
+ return f.call(n, w);
30
+ };
31
+ const v = _();
32
+ document.addEventListener(v, l[I], { passive: !0 });
33
+ } catch (n) {
34
+ console.error("[maz-ui](vClickOutside)", n);
35
+ }
36
+ }
37
+ function ee(l) {
38
+ try {
39
+ const s = _();
40
+ document.removeEventListener(s, l[I], !1), delete l[I];
41
+ } catch (s) {
42
+ console.error("[maz-ui](vClickOutside)", s);
43
+ }
44
+ }
45
+ function ve(l, s) {
46
+ try {
47
+ if (s.value === s.oldValue)
48
+ return;
49
+ x(l, s);
50
+ } catch (n) {
51
+ console.error("[maz-ui](vClickOutside)", n);
52
+ }
53
+ }
54
+ const ye = {
55
+ mounted: x,
56
+ updated: ve,
57
+ unmounted: ee
58
+ };
59
+ function he(l, s) {
60
+ let n;
61
+ return function(...f) {
62
+ clearTimeout(n), n = setTimeout(() => {
63
+ l.apply(this, f);
64
+ }, s);
65
+ };
66
+ }
67
+ const we = {
68
+ cancelText: "Cancel",
69
+ confirmText: "Confirm",
70
+ cancelButton: {
71
+ text: "Cancel",
72
+ color: "danger"
73
+ },
74
+ confirmButton: {
75
+ text: "Confirm",
76
+ color: "success"
77
+ }
78
+ };
79
+ k(we);
80
+ k([]);
81
+ const ge = ["innerHTML"], ke = /* @__PURE__ */ Z({
82
+ __name: "MazIcon",
83
+ props: {
84
+ /** The source path of the SVG file - e.g: `/icons/home.svg` */
85
+ src: { type: String, default: void 0 },
86
+ /** The path of the folder where the SVG files are stored - e.g: `/icons` */
87
+ path: { type: String, default: void 0 },
88
+ /** The name of the SVG file - e.g: `home` */
89
+ name: { type: String, default: void 0 },
90
+ /** The size of the SVG file - e.g: `1em` */
91
+ size: { type: String, default: void 0 },
92
+ /** The title of the SVG file - e.g: `Home` */
93
+ title: { type: String, default: void 0 },
94
+ /** The function to transform the source of the SVG file - e.g: `(svg) => svg` */
95
+ transformSource: {
96
+ type: Function,
97
+ default: (l) => l
98
+ }
99
+ },
100
+ emits: ["loaded", "unloaded", "error"],
101
+ setup(l, { emit: s }) {
102
+ const n = l, f = s, p = {}, v = k(), w = k();
103
+ function A() {
104
+ try {
105
+ return pe("mazIconPath");
106
+ } catch {
107
+ return;
108
+ }
109
+ }
110
+ const d = q(() => n.path ?? A()), u = q(() => n.src ? n.src : d.value ? `${d.value}/${n.name}.svg` : `/${n.name}.svg`);
111
+ se(() => {
112
+ !n.name && !n.src && console.error('[maz-ui](MazIcon) you should provide "name" or "src" as prop');
113
+ });
114
+ function h(r, i) {
115
+ const t = r.querySelectorAll("title");
116
+ if (t.length > 0)
117
+ t[0].textContent = i;
118
+ else {
119
+ const a = document.createElementNS("http://www.w3.org/2000/svg", "title");
120
+ a.textContent = i, r.append(a);
121
+ }
122
+ }
123
+ function T(r) {
124
+ return Object.keys(r).reduce((i, t) => (r[t] !== !1 && r[t] !== null && r[t] !== void 0 && (i[t] = r[t]), i), {});
125
+ }
126
+ function O(r) {
127
+ const i = {}, t = r.attributes;
128
+ if (!t)
129
+ return i;
130
+ for (let a = t.length - 1; a >= 0; a--)
131
+ i[t[a].name] = t[a].value;
132
+ return i;
133
+ }
134
+ function L(r) {
135
+ let i = r.cloneNode(!0);
136
+ return i = n.transformSource(r), n.title && h(i, n.title), r.innerHTML;
137
+ }
138
+ async function B(r) {
139
+ p[r] || (p[r] = P(r));
140
+ try {
141
+ v.value = await p[r], await Y(), f("loaded", w.value);
142
+ } catch (i) {
143
+ v.value && (v.value = void 0, f("unloaded")), delete p[r], f("error", i);
144
+ }
145
+ }
146
+ function P(r) {
147
+ return new Promise((i, t) => {
148
+ const a = new XMLHttpRequest();
149
+ a.open("GET", r, !0), a.addEventListener("load", () => {
150
+ if (a.status >= 200 && a.status < 400)
151
+ try {
152
+ let g = new DOMParser().parseFromString(a.responseText, "text/xml").querySelectorAll("svg")[0];
153
+ g ? (g = n.transformSource(g), i(g)) : t(new Error('Loaded file is not valid SVG"'));
154
+ } catch (C) {
155
+ t(C);
156
+ }
157
+ else
158
+ t(new Error("Error loading SVG"));
159
+ }), a.addEventListener("error", (C) => t(C)), a.send();
160
+ });
161
+ }
162
+ return ie(() => B(u.value)), (r, i) => v.value ? (y(), S("svg", z({
163
+ key: 0,
164
+ ref_key: "svgElem",
165
+ ref: w,
166
+ width: "1em",
167
+ height: "1em"
168
+ }, {
169
+ ...O(v.value),
170
+ ...T(r.$attrs)
171
+ }, {
172
+ style: `font-size: ${l.size}`,
173
+ innerHTML: L(v.value)
174
+ }), null, 16, ge)) : M("v-if", !0);
175
+ }
176
+ }), be = ["id"], Ce = ["aria-expanded"], Ee = ["id"], Se = ["onClick"], De = /* @__PURE__ */ Z({
177
+ inheritAttrs: !1,
178
+ __name: "MazDropdown",
179
+ props: {
180
+ style: { default: void 0 },
181
+ class: { default: void 0 },
182
+ items: { default: () => [] },
183
+ open: { type: Boolean },
184
+ id: { default: void 0 },
185
+ trigger: { default: "both" },
186
+ color: { default: "transparent" },
187
+ position: { default: "bottom left" },
188
+ noCloseOnClick: { type: Boolean },
189
+ disabled: { type: Boolean },
190
+ noChevron: { type: Boolean },
191
+ screenReaderDescription: { default: "Open menu dropdown" },
192
+ menuPanelClass: {},
193
+ menuPanelStyle: {},
194
+ block: { type: Boolean },
195
+ dropdownIcon: {}
196
+ },
197
+ emits: ["menuitem-clicked", "update:open"],
198
+ setup(l, { emit: s }) {
199
+ const n = l, f = s, p = me({
200
+ componentName: "MazDropdown",
201
+ providedId: n.id
202
+ }), v = N(() => import("./MazBtn-BJxI5VQw.mjs")), w = N(() => import("./MazLink-Cd4MwIC9.mjs")), A = N(() => import("./chevron-down-BkvtON3b.mjs")), d = k(n.open), u = k(), h = he((e) => {
203
+ t(e);
204
+ }, 200);
205
+ function T() {
206
+ d.value && t(!1);
207
+ }
208
+ function O() {
209
+ t(!d.value);
210
+ }
211
+ function L() {
212
+ ["click"].includes(n.trigger) && O();
213
+ }
214
+ function B() {
215
+ ["hover", "both"].includes(n.trigger) && t(!0);
216
+ }
217
+ function P() {
218
+ ["hover", "both"].includes(n.trigger) && (d.value === !1 ? t(!0) : h(!0));
219
+ }
220
+ function r() {
221
+ ["hover", "both"].includes(n.trigger) && h(!1);
222
+ }
223
+ function i() {
224
+ h(!1);
225
+ }
226
+ function t(e) {
227
+ n.disabled || (d.value = e, f("update:open", e));
228
+ }
229
+ function a(e) {
230
+ return "action" in e;
231
+ }
232
+ function C(e) {
233
+ return "href" in e || "to" in e;
234
+ }
235
+ async function R(e, c) {
236
+ var o;
237
+ f("menuitem-clicked", c), await ((o = e.action) == null ? void 0 : o.call(e)), n.noCloseOnClick || g();
238
+ }
239
+ function g() {
240
+ n.noCloseOnClick === !1 && t(!1);
241
+ }
242
+ function G(e) {
243
+ e.key === "Escape" ? (e.preventDefault(), t(!1)) : ["ArrowDown", "ArrowUp"].includes(e.key) ? oe(e) : e.key === "Enter" && typeof u.value == "number" && (e.preventDefault(), document.querySelectorAll(`#${p.value} .menuitem`)[u.value].click(), g());
244
+ }
245
+ function ne(e) {
246
+ ["ArrowDown", "ArrowUp", "Enter"].includes(e.key) && d.value === !1 && (e.preventDefault(), t(!0));
247
+ }
248
+ function oe(e) {
249
+ var E;
250
+ e.preventDefault();
251
+ const c = e.key;
252
+ d.value || t(!0);
253
+ const o = (E = n.items) == null ? void 0 : E.length;
254
+ o && (typeof u.value == "number" ? u.value === o - 1 && c === "ArrowDown" ? u.value = 0 : u.value === 0 && c === "ArrowUp" ? u.value = o - 1 : u.value = c === "ArrowDown" ? u.value + 1 : u.value - 1 : u.value = c === "ArrowDown" ? 0 : o - 1);
255
+ }
256
+ return j(
257
+ () => d.value,
258
+ (e) => {
259
+ e ? document.addEventListener("keydown", G) : document.removeEventListener("keydown", G), u.value = void 0;
260
+ }
261
+ ), j(
262
+ () => n.open,
263
+ (e) => t(e)
264
+ ), (e, c) => K((y(), S("div", {
265
+ id: m(p),
266
+ class: U(["m-dropdown", [n.class, { "--block": e.block }]]),
267
+ style: Q(e.style)
268
+ }, [
269
+ X("div", {
270
+ role: "button",
271
+ tabindex: "0",
272
+ class: "m-dropdown__wrapper",
273
+ "aria-expanded": d.value,
274
+ "aria-haspopup": "menu",
275
+ onClick: F(L, ["stop"]),
276
+ onFocus: B,
277
+ onBlur: i,
278
+ onKeydown: ne,
279
+ onMouseenter: P,
280
+ onMouseleave: r
281
+ }, [
282
+ e.screenReaderDescription || e.$slots["screen-reader-description"] ? (y(), S("span", {
283
+ key: 0,
284
+ id: `${m(p)}-labelspan`,
285
+ class: "maz-sr-only"
286
+ }, [
287
+ b(e.$slots, "screen-reader-description", {}, () => [
288
+ H(
289
+ V(e.screenReaderDescription),
290
+ 1
291
+ /* TEXT */
292
+ )
293
+ ])
294
+ ], 8, Ee)) : M("v-if", !0),
295
+ b(e.$slots, "element", { isOpen: d.value }, () => [
296
+ J(m(v), z({
297
+ "aria-labelledby": `${m(p)}-labelspan`,
298
+ color: e.color,
299
+ disabled: e.disabled
300
+ }, e.$attrs, {
301
+ tabindex: "-1",
302
+ block: e.block
303
+ }), ae({
304
+ default: $(() => [
305
+ b(e.$slots, "default")
306
+ ]),
307
+ _: 2
308
+ /* DYNAMIC */
309
+ }, [
310
+ e.noChevron ? void 0 : {
311
+ name: "right-icon",
312
+ fn: $(() => [
313
+ e.dropdownIcon ? (y(), S(
314
+ W,
315
+ { key: 0 },
316
+ [
317
+ typeof e.dropdownIcon == "string" ? (y(), D(ke, {
318
+ key: 0,
319
+ name: e.dropdownIcon
320
+ }, null, 8, ["name"])) : e.dropdownIcon ? (y(), D(ue(e.dropdownIcon), { key: 1 })) : M("v-if", !0)
321
+ ],
322
+ 64
323
+ /* STABLE_FRAGMENT */
324
+ )) : (y(), D(m(A), {
325
+ key: 1,
326
+ class: U([{ "maz-rotate-180": d.value }, "chevron-icon"])
327
+ }, null, 8, ["class"]))
328
+ ]),
329
+ key: "0"
330
+ }
331
+ ]), 1040, ["aria-labelledby", "color", "disabled", "block"])
332
+ ])
333
+ ], 40, Ce),
334
+ J(ce, {
335
+ name: "maz-scale-fade",
336
+ persisted: ""
337
+ }, {
338
+ default: $(() => [
339
+ K(X(
340
+ "div",
341
+ {
342
+ role: "menu",
343
+ "aria-label": "Menu",
344
+ class: U(["menu", [{
345
+ "--top": e.position.includes("top"),
346
+ "--left": e.position.includes("left"),
347
+ "--right": e.position.includes("right"),
348
+ "--bottom": e.position.includes("bottom")
349
+ }, e.menuPanelClass]]),
350
+ tabindex: "-1",
351
+ style: Q(e.menuPanelStyle),
352
+ onFocus: c[0] || (c[0] = (o) => m(h)(!0)),
353
+ onBlur: c[1] || (c[1] = (o) => m(h)(!1)),
354
+ onMouseenter: c[2] || (c[2] = (o) => ["hover", "both"].includes(e.trigger) ? m(h)(!0) : void 0),
355
+ onMouseleave: c[3] || (c[3] = (o) => ["hover", "both"].includes(e.trigger) ? m(h)(!1) : void 0)
356
+ },
357
+ [
358
+ b(e.$slots, "dropdown", { items: e.items }, () => [
359
+ (y(!0), S(
360
+ W,
361
+ null,
362
+ de(e.items, (o, E) => b(e.$slots, "menuitem", {
363
+ key: E,
364
+ item: o
365
+ }, () => [
366
+ C(o) ? (y(), D(m(w), z({
367
+ key: 0,
368
+ target: o.href ? o.target ?? "_self" : void 0,
369
+ to: o.to,
370
+ href: o.href,
371
+ color: o.color ?? "theme",
372
+ ref_for: !0
373
+ }, o, {
374
+ "underline-only-hover": o.underlineOnlyHover ?? !1,
375
+ class: ["menuitem", [
376
+ {
377
+ "--is-keyboard-selected": u.value === E
378
+ },
379
+ o.class
380
+ ]],
381
+ tabindex: "-1",
382
+ onClick: F(g, ["stop"])
383
+ }), {
384
+ default: $(() => [
385
+ b(e.$slots, "menuitem-label", { item: o }, () => [
386
+ H(
387
+ V(o.label),
388
+ 1
389
+ /* TEXT */
390
+ )
391
+ ])
392
+ ]),
393
+ _: 2
394
+ /* DYNAMIC */
395
+ }, 1040, ["target", "to", "href", "color", "underline-only-hover", "class"])) : a(o) ? (y(), S("button", z({
396
+ key: 1,
397
+ tabindex: "-1",
398
+ type: "button",
399
+ ref_for: !0
400
+ }, o, {
401
+ class: ["menuitem menuitem__button", [
402
+ {
403
+ "--is-keyboard-selected": u.value === E
404
+ },
405
+ o.class,
406
+ `--${o.color ?? "theme"}`
407
+ ]],
408
+ onClick: F((te) => R(o, te), ["stop"])
409
+ }), [
410
+ b(e.$slots, "menuitem-label", { item: o }, () => [
411
+ H(
412
+ V(o.label),
413
+ 1
414
+ /* TEXT */
415
+ )
416
+ ])
417
+ ], 16, Se)) : M("v-if", !0)
418
+ ])),
419
+ 128
420
+ /* KEYED_FRAGMENT */
421
+ ))
422
+ ])
423
+ ],
424
+ 38
425
+ /* CLASS, STYLE, NEED_HYDRATION */
426
+ ), [
427
+ [fe, d.value]
428
+ ])
429
+ ]),
430
+ _: 3
431
+ /* FORWARDED */
432
+ })
433
+ ], 14, be)), [
434
+ [m(ye), T]
435
+ ]);
436
+ }
437
+ });
438
+ export {
439
+ ke as _,
440
+ De as a
441
+ };
@@ -0,0 +1,4 @@
1
+ import { _ as f } from "./MazDropdown-peYVJsXv.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -21,7 +21,7 @@ import '../assets/MazLink.css';const y = /* @__PURE__ */ f({
21
21
  setup(g) {
22
22
  const u = d(
23
23
  () => import("./arrow-top-right-on-square-jPmYJ34F.mjs")
24
- ), i = d(() => import("./MazIcon-BbvBov5G.mjs"));
24
+ ), i = d(() => import("./MazIcon-Bk4mYF1h.mjs"));
25
25
  return (e, c) => (o(), t(r(e.to ? "router-link" : "a"), s({
26
26
  id: e.id,
27
27
  class: ["m-link", [
package/nuxt/index.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.0.0"
6
6
  },
7
- "version": "3.47.2-beta.4",
7
+ "version": "3.47.2-beta.5",
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.47.2-beta.4",
4
+ "version": "3.47.2-beta.5",
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",
@@ -1,7 +1,7 @@
1
1
  import type { RouteLocationRaw } from 'vue-router';
2
2
  import type { Color } from './MazBtn.vue';
3
3
  import type { MazLinkProps } from './MazLink.vue';
4
- import type { Position } from './types';
4
+ import type { Icon, Position } from './types';
5
5
  import { type HTMLAttributes } from 'vue';
6
6
  export type { Color, Position };
7
7
  type ItemBase = Record<string, unknown> & {
@@ -77,6 +77,7 @@ export interface MazDropdownProps {
77
77
  * If true, the button will have a full width
78
78
  */
79
79
  block?: boolean;
80
+ dropdownIcon?: string | Icon;
80
81
  }
81
82
  declare function __VLS_template(): {
82
83
  slots: {