@mudakit/ui 0.4.0 → 0.6.0

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 (30) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/MudaButton-B9EAJW32.js +57 -0
  3. package/dist/{MudaColorPicker-CnB1MYB3.js → MudaColorPicker-D9BhgHf9.js} +22 -22
  4. package/dist/MudaDialog-dQSFVdgu.js +55 -0
  5. package/dist/{MudaFormCombobox-DqH-EyMV.js → MudaFormCombobox-CK2De6Rv.js} +36 -36
  6. package/dist/MudaSidebar-DvKS4VtE.js +141 -0
  7. package/dist/components/MudaButton/MudaButton.types.d.ts +2 -0
  8. package/dist/components/MudaButton/MudaButton.vue.d.ts +4 -3
  9. package/dist/components/MudaButton/index.d.ts +1 -0
  10. package/dist/components/MudaButton/index.js +1 -1
  11. package/dist/components/MudaColorPicker/index.js +1 -1
  12. package/dist/components/MudaDialog/index.js +1 -1
  13. package/dist/components/MudaFormCombobox/index.js +1 -1
  14. package/dist/components/MudaSidebar/MudaSidebar.types.d.ts +16 -0
  15. package/dist/components/MudaSidebar/MudaSidebar.vue.d.ts +67 -0
  16. package/dist/components/MudaSidebar/MudaSidebarDrawer.vue.d.ts +29 -0
  17. package/dist/components/MudaSidebar/index.d.ts +2 -0
  18. package/dist/components/MudaSidebar/index.js +2 -0
  19. package/dist/components/MudaSidebar/useMudaSidebarContext.d.ts +13 -0
  20. package/dist/composables/index.d.ts +6 -0
  21. package/dist/composables/index.js +6 -0
  22. package/dist/composables/useMudaColors.d.ts +70 -0
  23. package/dist/index.d.ts +2 -0
  24. package/dist/index.js +33 -43
  25. package/dist/style.css +1 -1
  26. package/dist/useBodyScrollLock-4K-3lAFL.js +12 -0
  27. package/dist/useResizeObserver-B0uwslYk.js +47 -0
  28. package/package.json +6 -1
  29. package/dist/MudaButton-CWY0U8WO.js +0 -43
  30. package/dist/MudaDialog-D0VZdP3Y.js +0 -61
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a663c3f: Add the useMudaColors composable.
8
+
9
+ ## 0.5.0
10
+
11
+ ### Minor Changes
12
+
13
+ - fcbbcb8: - Add a public `@mudakit/ui/composables` entrypoint.
14
+ - Add outline-* and link-* variants to MudaButton
15
+ - Add the MudaSidebar component.
16
+ - Refresh the light and dark theme color palettes.
17
+
3
18
  ## 0.4.0
4
19
 
5
20
  ### Minor Changes
@@ -0,0 +1,57 @@
1
+ import { createBlock as e, defineComponent as t, mergeProps as n, openBlock as r, renderSlot as i, resolveDynamicComponent as a, withCtx as o } from "vue";
2
+ //#endregion
3
+ //#region src/components/MudaButton/MudaButton.vue
4
+ var s = /* @__PURE__ */ t({
5
+ __name: "MudaButton",
6
+ props: {
7
+ size: { default: "medium" },
8
+ variant: { default: "default" },
9
+ disabled: {
10
+ type: Boolean,
11
+ default: !1
12
+ },
13
+ as: { default: "button" }
14
+ },
15
+ setup(t) {
16
+ let s = t;
17
+ return (t, c) => (r(), e(a(s.as), n(t.$attrs, {
18
+ disabled: s.disabled,
19
+ class: ["muda:flex muda:items-center muda:justify-center muda:gap-1 muda:focus-visible:outline-2 muda:focus-visible:outline-offset-2", {
20
+ "muda-link-reset": s.as === "a",
21
+ "muda-button-reset": s.as === "button",
22
+ "muda:rounded-md muda:font-semibold": !0,
23
+ "muda:px-2.5 muda:py-1.5 muda:text-xs": s.size === "small",
24
+ "muda:px-3 muda:py-2 muda:text-sm": s.size === "medium",
25
+ "muda:px-3.5 muda:py-2.5 muda:text-sm": s.size === "large",
26
+ "muda:cursor-pointer": !s.disabled,
27
+ "muda:cursor-not-allowed": s.disabled,
28
+ "muda:border muda:border-secondary-light muda:bg-form-background muda:text-secondary muda:shadow-xs muda:disabled:text-secondary/40": s.variant === "default",
29
+ "muda:border muda:border-primary-dark muda:bg-primary muda:fill-white muda:text-white muda:shadow-xs muda:hover:bg-primary-dark muda:focus-visible:bg-primary muda:disabled:border-primary-dark/20 muda:disabled:bg-primary-light/70": s.variant === "primary",
30
+ "muda:border muda:border-secondary-dark muda:bg-secondary muda:fill-white muda:text-white muda:shadow-xs muda:hover:bg-secondary-dark muda:focus-visible:bg-secondary muda:disabled:border-secondary-dark/20 muda:disabled:bg-secondary-light/70": s.variant === "secondary",
31
+ "muda:border muda:border-success-dark muda:bg-success muda:fill-white muda:text-white muda:shadow-xs muda:hover:bg-success-dark muda:focus-visible:bg-success muda:disabled:border-success-dark/20 muda:disabled:bg-success-light/70": s.variant === "success",
32
+ "muda:border muda:border-warning-dark muda:bg-warning muda:fill-white muda:text-white muda:shadow-xs muda:hover:bg-warning-dark muda:focus-visible:bg-warning muda:disabled:border-warning-dark/20 muda:disabled:bg-warning-light/70": s.variant === "warning",
33
+ "muda:border muda:border-danger-dark muda:bg-danger muda:fill-white muda:text-white muda:shadow-xs muda:hover:bg-danger-dark muda:focus-visible:bg-danger muda:disabled:border-danger-dark/20 muda:disabled:bg-danger-light/70": s.variant === "danger",
34
+ "muda:border muda:border-info-dark muda:bg-info muda:fill-white muda:text-white muda:shadow-xs muda:hover:bg-info-dark muda:focus-visible:bg-info muda:disabled:border-info-dark/20 muda:disabled:bg-info-light/70": s.variant === "info",
35
+ "muda:border muda:border-secondary-light muda:text-secondary muda:disabled:text-secondary/40": s.variant === "outline-default",
36
+ "muda:border muda:border-primary muda:text-primary muda:enabled:hover:bg-primary muda:enabled:hover:fill-white muda:enabled:hover:text-white muda:disabled:border-primary/20 muda:disabled:text-primary/40": s.variant === "outline-primary",
37
+ "muda:border muda:border-secondary muda:text-secondary muda:enabled:hover:bg-secondary muda:enabled:hover:fill-white muda:enabled:hover:text-white muda:disabled:border-secondary/20 muda:disabled:text-secondary/40": s.variant === "outline-secondary",
38
+ "muda:border muda:border-success muda:text-success muda:enabled:hover:bg-success muda:enabled:hover:fill-white muda:enabled:hover:text-white muda:disabled:border-success/20 muda:disabled:text-success/40": s.variant === "outline-success",
39
+ "muda:border muda:border-warning muda:text-warning muda:enabled:hover:bg-warning muda:enabled:hover:fill-white muda:enabled:hover:text-white muda:disabled:border-warning/20 muda:disabled:text-warning/40": s.variant === "outline-warning",
40
+ "muda:border muda:border-danger muda:text-danger muda:enabled:hover:bg-danger muda:enabled:hover:fill-white muda:enabled:hover:text-white muda:disabled:border-danger/20 muda:disabled:text-danger/40": s.variant === "outline-danger",
41
+ "muda:border muda:border-info muda:text-info muda:enabled:hover:bg-info muda:enabled:hover:fill-white muda:enabled:hover:text-white muda:disabled:border-info/20 muda:disabled:text-info/40": s.variant === "outline-info",
42
+ "muda:text-secondary muda:disabled:text-secondary/40": s.variant === "link-default",
43
+ "muda:text-primary muda:enabled:hover:text-primary-dark muda:disabled:text-primary/40": s.variant === "link-primary",
44
+ "muda:text-secondary muda:enabled:hover:text-secondary-dark muda:disabled:text-secondary/40": s.variant === "link-secondary",
45
+ "muda:text-success muda:enabled:hover:text-success-dark muda:disabled:text-success/40": s.variant === "link-success",
46
+ "muda:text-warning muda:enabled:hover:text-warning-dark muda:disabled:text-warning/40": s.variant === "link-warning",
47
+ "muda:text-danger muda:enabled:hover:text-danger-dark muda:disabled:text-danger/40": s.variant === "link-danger",
48
+ "muda:text-info muda:enabled:hover:text-info-dark muda:disabled:text-info/40": s.variant === "link-info"
49
+ }]
50
+ }), {
51
+ default: o(() => [i(t.$slots, "default")]),
52
+ _: 3
53
+ }, 16, ["disabled", "class"]));
54
+ }
55
+ });
56
+ //#endregion
57
+ export { s as t };
@@ -1,10 +1,10 @@
1
- import { t as e } from "./MudaButton-CWY0U8WO.js";
2
- import { t } from "./keymap-BzfMgdJH.js";
3
- import { t as n } from "./MudaIcon-BwqQQnti.js";
4
- import { t as r } from "./MudaFormInput-D1-kQq9y.js";
5
- import { t as i } from "./MudaPopover-C1fDWbPf.js";
6
- import { t as a } from "./_plugin-vue_export-helper-B3ysoDQm.js";
7
- import { t as o } from "./useKeyDown-B1jmp4nA.js";
1
+ import { t as e } from "./useKeyDown-B1jmp4nA.js";
2
+ import { t } from "./MudaButton-B9EAJW32.js";
3
+ import { t as n } from "./keymap-BzfMgdJH.js";
4
+ import { t as r } from "./MudaIcon-BwqQQnti.js";
5
+ import { t as i } from "./MudaFormInput-D1-kQq9y.js";
6
+ import { t as a } from "./MudaPopover-C1fDWbPf.js";
7
+ import { t as o } from "./_plugin-vue_export-helper-B3ysoDQm.js";
8
8
  import { createBlock as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, mergeModels as p, mergeProps as m, normalizeStyle as h, openBlock as g, ref as _, toDisplayString as v, unref as y, useModel as b, watch as x, watchEffect as S, withCtx as C, withModifiers as w } from "vue";
9
9
  import { ColorPickerCanvas as T, ColorPickerHueCursor as E, ColorPickerSaturationCursor as D, useColorPicker as O } from "@wattanx/vue-color-picker";
10
10
  //#region src/common/components.ts
@@ -57,7 +57,7 @@ var k = {
57
57
  _: 1
58
58
  }, 8, ["onChangePosition"])], 4));
59
59
  }
60
- }), j = /*#__PURE__*/ a(A, [["__scopeId", "data-v-bdb328ef"]]), M = { class: "muda:flex muda:flex-col muda:gap-2" }, N = /* @__PURE__ */ f({
60
+ }), j = /*#__PURE__*/ o(A, [["__scopeId", "data-v-bdb328ef"]]), M = { class: "muda:flex muda:flex-col muda:gap-2" }, N = /* @__PURE__ */ f({
61
61
  inheritAttrs: !1,
62
62
  __name: "MudaColorPicker",
63
63
  props: /*@__PURE__*/ p({
@@ -71,21 +71,21 @@ var k = {
71
71
  modelModifiers: {}
72
72
  }),
73
73
  emits: ["update:modelValue"],
74
- setup(a) {
75
- let c = a, f = b(a, "modelValue"), p = _(), S = _(f.value), T = _(!1);
74
+ setup(o) {
75
+ let c = o, f = b(o, "modelValue"), p = _(), S = _(f.value), T = _(!1);
76
76
  x(f, (e) => {
77
77
  T.value || (S.value = e);
78
- }), o((e) => {
78
+ }), e((e) => {
79
79
  if (T.value) switch (e.key) {
80
- case t.Escape: T.value = !1, p.value?.input?.blur();
80
+ case n.Escape: T.value = !1, p.value?.input?.blur();
81
81
  }
82
82
  });
83
83
  let E = () => {
84
84
  f.value = S.value, T.value = !1;
85
85
  };
86
- return (t, a) => (g(), s(y(i), {
86
+ return (e, n) => (g(), s(y(a), {
87
87
  modelValue: T.value,
88
- "onUpdate:modelValue": a[4] ||= (e) => T.value = e,
88
+ "onUpdate:modelValue": n[4] ||= (e) => T.value = e,
89
89
  placement: "bottom-start",
90
90
  "append-to-body": c.appendToBody
91
91
  }, {
@@ -93,8 +93,8 @@ var k = {
93
93
  key: c.size,
94
94
  "initial-color": f.value,
95
95
  size: y(k)[c.size],
96
- onChange: a[3] ||= (e) => S.value = e
97
- }, null, 8, ["initial-color", "size"])), d(y(e), {
96
+ onChange: n[3] ||= (e) => S.value = e
97
+ }, null, 8, ["initial-color", "size"])), d(y(t), {
98
98
  type: "button",
99
99
  variant: "primary",
100
100
  size: "small",
@@ -104,19 +104,19 @@ var k = {
104
104
  default: C(() => [u(v(c.buttonLabel ?? S.value), 1)]),
105
105
  _: 1
106
106
  }, 8, ["style"])])]),
107
- default: C(() => [d(y(r), m({
107
+ default: C(() => [d(y(i), m({
108
108
  ref_key: "inputRef",
109
109
  ref: p
110
- }, t.$attrs, {
110
+ }, e.$attrs, {
111
111
  modelValue: f.value,
112
- "onUpdate:modelValue": a[0] ||= (e) => f.value = e,
112
+ "onUpdate:modelValue": n[0] ||= (e) => f.value = e,
113
113
  disabled: c.disabled,
114
114
  "is-invalid": c.isInvalid,
115
115
  readonly: "",
116
- onFocus: a[1] ||= (e) => T.value = !0,
117
- "onClick:before": a[2] ||= (e) => T.value = !0
116
+ onFocus: n[1] ||= (e) => T.value = !0,
117
+ "onClick:before": n[2] ||= (e) => T.value = !0
118
118
  }), {
119
- before: C(() => [d(y(n), {
119
+ before: C(() => [d(y(r), {
120
120
  icon: "palette:outlined",
121
121
  color: f.value
122
122
  }, null, 8, ["color"])]),
@@ -0,0 +1,55 @@
1
+ import { t as e } from "./useBodyScrollLock-4K-3lAFL.js";
2
+ import { t } from "./useKeyDown-B1jmp4nA.js";
3
+ import { t as n } from "./useZIndex-DWnsohLZ.js";
4
+ import { t as r } from "./keymap-BzfMgdJH.js";
5
+ import { t as i } from "./MudaFocusTrap-CGlvV_MC.js";
6
+ import { Teleport as a, Transition as o, createBlock as s, createCommentVNode as c, createElementVNode as l, createVNode as u, defineComponent as d, mergeProps as f, normalizeStyle as p, openBlock as m, renderSlot as h, unref as g, useModel as _, useTemplateRef as v, withCtx as y, withModifiers as b } from "vue";
7
+ //#region src/components/MudaDialog/MudaDialog.vue?vue&type=script&setup=true&lang.ts
8
+ var x = { class: "muda:fixed muda:inset-0 muda:w-screen muda:overflow-y-auto muda:py-6" }, S = { class: "muda:flex muda:min-h-full muda:items-center muda:justify-center" }, C = /* @__PURE__ */ d({
9
+ inheritAttrs: !1,
10
+ __name: "MudaDialog",
11
+ props: {
12
+ modelValue: {
13
+ type: Boolean,
14
+ required: !0
15
+ },
16
+ modelModifiers: {}
17
+ },
18
+ emits: ["update:modelValue"],
19
+ setup(d) {
20
+ let C = _(d, "modelValue"), w = v("dialog"), T = n();
21
+ e(C), t((e) => {
22
+ if (C.value) switch (e.key) {
23
+ case r.Escape: C.value = !1, e.preventDefault();
24
+ }
25
+ });
26
+ let E = (e) => {
27
+ w.value?.contains(e.target) || (C.value = !1);
28
+ };
29
+ return (e, t) => (m(), s(a, { to: "body" }, [u(o, {
30
+ "enter-active-class": "muda:transition-opacity muda:ease-linear muda:duration-100",
31
+ "leave-active-class": "muda:transition-opacity muda:ease-linear muda:duration-100",
32
+ "enter-from-class": "muda:opacity-0",
33
+ "leave-to-class": "muda:opacity-0"
34
+ }, {
35
+ default: y(() => [C.value ? (m(), s(g(i), {
36
+ key: 0,
37
+ role: "dialog",
38
+ class: "muda:fixed muda:inset-0 muda:bg-gray-500/30 muda:backdrop-blur-xs muda:transition-opacity",
39
+ style: p({ zIndex: g(T) }),
40
+ onClickCapture: E,
41
+ onWheel: t[0] ||= b(() => {}, ["stop"])
42
+ }, {
43
+ default: y(() => [l("div", x, [l("div", S, [l("div", f(e.$attrs, {
44
+ class: "muda:rounded-lg muda:bg-background muda:p-4 muda:focus:outline-hidden",
45
+ tabindex: "0",
46
+ ref: "dialog"
47
+ }), [h(e.$slots, "default")], 16)])])]),
48
+ _: 3
49
+ }, 8, ["style"])) : c("", !0)]),
50
+ _: 3
51
+ })]));
52
+ }
53
+ });
54
+ //#endregion
55
+ export { C as t };
@@ -1,9 +1,9 @@
1
- import { t as e } from "./keymap-BzfMgdJH.js";
2
- import { t } from "./MudaIcon-BwqQQnti.js";
3
- import { t as n } from "./MudaFormInput-D1-kQq9y.js";
4
- import { t as r } from "./useClickOutside-B6tdxsc3.js";
5
- import { t as i } from "./useZIndex-DWnsohLZ.js";
6
- import { t as a } from "./useKeyDown-B1jmp4nA.js";
1
+ import { t as e } from "./useClickOutside-B6tdxsc3.js";
2
+ import { t } from "./useKeyDown-B1jmp4nA.js";
3
+ import { t as n } from "./useZIndex-DWnsohLZ.js";
4
+ import { t as r } from "./keymap-BzfMgdJH.js";
5
+ import { t as i } from "./MudaIcon-BwqQQnti.js";
6
+ import { t as a } from "./MudaFormInput-D1-kQq9y.js";
7
7
  import { t as o } from "./MudaFormCheckbox-C1wTjohm.js";
8
8
  import { Fragment as s, Teleport as c, Transition as l, computed as u, createBlock as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, createSlots as h, createTextVNode as g, createVNode as _, defineComponent as v, mergeModels as y, mergeProps as b, normalizeClass as x, normalizeStyle as S, openBlock as C, ref as w, renderList as T, renderSlot as E, toDisplayString as D, unref as O, useModel as k, useSlots as A, useTemplateRef as j, watch as M, watchEffect as N, withCtx as P, withModifiers as F } from "vue";
9
9
  import { autoUpdate as I, flip as L, offset as R, shift as z, size as B, useFloating as V } from "@floating-ui/vue";
@@ -24,39 +24,39 @@ var H = { class: "muda:flex muda:flex-col" }, U = {
24
24
  }),
25
25
  emits: ["update:modelValue"],
26
26
  setup(e) {
27
- let r = e, i = A(), a = k(e, "modelValue"), c = w(""), l = u(() => {
27
+ let t = e, n = A(), r = k(e, "modelValue"), c = w(""), l = u(() => {
28
28
  let e = c.value.trim().toLowerCase();
29
- return e === "" ? r.options : r.options.filter((t) => t.label.toLowerCase().includes(e));
29
+ return e === "" ? t.options : t.options.filter((t) => t.label.toLowerCase().includes(e));
30
30
  }), h = () => {
31
- c.value.length > 0 ? c.value = "" : a.value = [];
31
+ c.value.length > 0 ? c.value = "" : r.value = [];
32
32
  };
33
- return (e, u) => (C(), p("div", H, [_(O(n), b(e.$attrs, {
33
+ return (e, u) => (C(), p("div", H, [_(O(a), b(e.$attrs, {
34
34
  modelValue: c.value,
35
35
  "onUpdate:modelValue": u[0] ||= (e) => c.value = e,
36
- placeholder: r.placeholder,
36
+ placeholder: t.placeholder,
37
37
  "onClick:after": h,
38
- disabled: r.disabled
38
+ disabled: t.disabled
39
39
  }), {
40
- after: P(() => [c.value.length > 0 ? (C(), d(O(t), {
40
+ after: P(() => [c.value.length > 0 ? (C(), d(O(i), {
41
41
  key: 0,
42
42
  icon: "close:outlined"
43
- })) : a.value.length > 0 ? (C(), p(s, { key: 1 }, [g(D(a.value.length) + " ", 1), _(O(t), { icon: "close:outlined" })], 64)) : f("", !0)]),
43
+ })) : r.value.length > 0 ? (C(), p(s, { key: 1 }, [g(D(r.value.length) + " ", 1), _(O(i), { icon: "close:outlined" })], 64)) : f("", !0)]),
44
44
  _: 1
45
45
  }, 16, [
46
46
  "modelValue",
47
47
  "placeholder",
48
48
  "disabled"
49
- ]), !r.disabled && l.value.length > 0 ? (C(), p("div", U, [m("ul", W, [(C(!0), p(s, null, T(l.value, (t) => (C(), p("li", { key: t.value }, [m("label", G, [_(O(o), {
50
- modelValue: a.value,
51
- "onUpdate:modelValue": u[1] ||= (e) => a.value = e,
49
+ ]), !t.disabled && l.value.length > 0 ? (C(), p("div", U, [m("ul", W, [(C(!0), p(s, null, T(l.value, (i) => (C(), p("li", { key: i.value }, [m("label", G, [_(O(o), {
50
+ modelValue: r.value,
51
+ "onUpdate:modelValue": u[1] ||= (e) => r.value = e,
52
52
  size: "small",
53
- value: t.value,
54
- disabled: r.disabled
53
+ value: i.value,
54
+ disabled: t.disabled
55
55
  }, null, 8, [
56
56
  "modelValue",
57
57
  "value",
58
58
  "disabled"
59
- ]), i.label == null ? (C(), p(s, { key: 1 }, [g(D(t.label), 1)], 64)) : E(e.$slots, "label", { option: t }, void 0, void 0, 0)])]))), 128))])])) : f("", !0)]));
59
+ ]), n.label == null ? (C(), p(s, { key: 1 }, [g(D(i.label), 1)], 64)) : E(e.$slots, "label", { option: i }, void 0, void 0, 0)])]))), 128))])])) : f("", !0)]));
60
60
  }
61
61
  }), q = {
62
62
  ref: "root",
@@ -75,7 +75,7 @@ var H = { class: "muda:flex muda:flex-col" }, U = {
75
75
  }),
76
76
  emits: ["update:modelValue"],
77
77
  setup(o) {
78
- let m = o, v = A(), y = k(o, "modelValue"), H = w(m.options.find(({ value: e }) => e === y.value)?.label ?? ""), U = j("root"), W = j("list"), G = w(), K = w(!1), Y = w(null), X = i(), Z = u(() => {
78
+ let m = o, v = A(), y = k(o, "modelValue"), H = w(m.options.find(({ value: e }) => e === y.value)?.label ?? ""), U = j("root"), W = j("list"), G = w(), K = w(!1), Y = w(null), X = n(), Z = u(() => {
79
79
  let e = H.value.trim().toLowerCase();
80
80
  return e === "" ? m.options : m.options.filter((t) => t.label.toLowerCase().includes(e));
81
81
  }), { floatingStyles: Q } = V(U, W, {
@@ -97,30 +97,30 @@ var H = { class: "muda:flex muda:flex-col" }, U = {
97
97
  }, ee = (e) => {
98
98
  e.preventDefault(), H.value = "", y.value = void 0;
99
99
  };
100
- return r([U, W], () => {
100
+ return e([U, W], () => {
101
101
  K.value &&= !1;
102
- }), a((t) => {
103
- if (K.value && !t.isComposing) switch (t.key) {
104
- case e.Enter:
105
- case e.Tab:
106
- Y.value != null && ($(Y.value), t.preventDefault());
102
+ }), t((e) => {
103
+ if (K.value && !e.isComposing) switch (e.key) {
104
+ case r.Enter:
105
+ case r.Tab:
106
+ Y.value != null && ($(Y.value), e.preventDefault());
107
107
  break;
108
- case e.Escape:
108
+ case r.Escape:
109
109
  K.value = !1;
110
110
  break;
111
- case e.ArrowDown:
111
+ case r.ArrowDown:
112
112
  if (Z.value.length === 0) {
113
113
  Y.value = null;
114
114
  break;
115
115
  }
116
- Y.value = Y.value == null ? 0 : (Y.value + 1) % Z.value.length, t.preventDefault();
116
+ Y.value = Y.value == null ? 0 : (Y.value + 1) % Z.value.length, e.preventDefault();
117
117
  break;
118
- case e.ArrowUp:
118
+ case r.ArrowUp:
119
119
  if (Z.value.length === 0) {
120
120
  Y.value = null;
121
121
  break;
122
122
  }
123
- Y.value = Y.value == null ? Z.value.length - 1 : (Y.value + Z.value.length - 1) % Z.value.length, t.preventDefault();
123
+ Y.value = Y.value == null ? Z.value.length - 1 : (Y.value + Z.value.length - 1) % Z.value.length, e.preventDefault();
124
124
  }
125
125
  }), N(() => {
126
126
  Y.value != null && W.value?.children[Y.value]?.scrollIntoView({
@@ -133,19 +133,19 @@ var H = { class: "muda:flex muda:flex-col" }, U = {
133
133
  e || G.value?.input?.blur(), Y.value = e && Z.value.length > 0 ? 0 : null;
134
134
  }), M([y, () => m.options], ([e]) => {
135
135
  H.value = m.options.find(({ value: t }) => t === e)?.label ?? "";
136
- }, { deep: !0 }), (e, r) => (C(), p("div", q, [_(O(n), b(e.$attrs, {
136
+ }, { deep: !0 }), (e, t) => (C(), p("div", q, [_(O(a), b(e.$attrs, {
137
137
  modelValue: H.value,
138
- "onUpdate:modelValue": r[0] ||= (e) => H.value = e,
138
+ "onUpdate:modelValue": t[0] ||= (e) => H.value = e,
139
139
  ref_key: "inputRef",
140
140
  ref: G,
141
- onFocus: r[1] ||= (e) => K.value = !0,
141
+ onFocus: t[1] ||= (e) => K.value = !0,
142
142
  "onClick:after": ee,
143
143
  disabled: m.disabled,
144
144
  placeholder: m.placeholder,
145
145
  "is-invalid": m.isInvalid
146
146
  }), h({ _: 2 }, [H.value.length > 0 ? {
147
147
  name: "after",
148
- fn: P(() => [_(O(t), { icon: "close:outlined" })]),
148
+ fn: P(() => [_(O(i), { icon: "close:outlined" })]),
149
149
  key: "0"
150
150
  } : void 0]), 1040, [
151
151
  "modelValue",
@@ -0,0 +1,141 @@
1
+ import { Fragment as e, Transition as t, computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createVNode as s, defineComponent as c, inject as l, mergeModels as u, normalizeClass as d, normalizeStyle as f, openBlock as p, provide as m, renderList as h, renderSlot as g, toRefs as _, unref as v, useModel as y, useSlots as b, vShow as x, withCtx as S, withDirectives as C } from "vue";
2
+ //#region src/components/MudaSidebar/MudaSidebar.types.ts
3
+ var w = "64px", T = "360px", E = Symbol("MUDA_SIDEBAR_CONTEXT");
4
+ function D() {
5
+ return l(E);
6
+ }
7
+ //#endregion
8
+ //#region src/components/MudaSidebar/MudaSidebarDrawer.vue?vue&type=script&setup=true&lang.ts
9
+ var O = { class: "muda:flex muda:items-center" }, k = { class: "muda:flex muda:w-full muda:items-center muda:justify-center" }, A = /* @__PURE__ */ c({
10
+ __name: "MudaSidebarDrawer",
11
+ props: { item: {} },
12
+ setup(e) {
13
+ let r = e, c = b(), { selectedItem: l, mode: u, position: m, paneWidth: h, contentWidth: _, size: y } = D(), w = n(() => c.content != null), T = n(() => r.item.name === l.value), E = (e) => {
14
+ switch (r.item.type) {
15
+ case "pane":
16
+ l.value = l.value === r.item.name ? null : r.item.name;
17
+ break;
18
+ case "button": e.preventDefault(), r.item.onClick();
19
+ }
20
+ };
21
+ return (e, n) => (p(), a("div", O, [o("div", k, [o("button", {
22
+ type: "button",
23
+ class: d(["muda-button-reset muda:flex muda:cursor-pointer muda:items-center muda:justify-center muda:text-xs muda:hover:fill-primary-light muda:hover:text-primary-light", {
24
+ "muda:rounded-md muda:fill-primary muda:text-primary": T.value,
25
+ "muda:fill-secondary muda:text-secondary": !T.value,
26
+ "muda:size-8": v(y) === "small",
27
+ "muda:size-9": v(y) === "medium",
28
+ "muda:size-10": v(y) === "large"
29
+ }]),
30
+ onClick: E
31
+ }, [g(e.$slots, "label", { isActive: T.value })], 2)]), w.value ? (p(), a("div", {
32
+ key: 0,
33
+ class: d(["muda:absolute muda:top-0 muda:bottom-0 muda:z-100 muda:overflow-hidden", {
34
+ "muda:right-full": v(u) === "absolute" && v(m) === "right",
35
+ "muda:left-full": v(u) === "absolute" && v(m) === "left"
36
+ }]),
37
+ style: f({
38
+ left: v(u) === "static" && v(m) === "left" ? v(h) : void 0,
39
+ right: v(u) === "static" && v(m) === "right" ? v(h) : void 0
40
+ })
41
+ }, [s(t, {
42
+ "enter-active-class": "muda:transition-transform muda:duration-300 muda:ease-out muda:overflow-x-hidden",
43
+ "enter-from-class": v(m) === "left" ? "muda:-translate-x-full" : "muda:translate-x-full",
44
+ "enter-to-class": "muda:translate-x-0",
45
+ "leave-active-class": "muda:transition-transform muda:duration-300 muda:ease-out muda:overflow-x-hidden",
46
+ "leave-from-class": "muda:translate-x-0",
47
+ "leave-to-class": v(m) === "left" ? "muda:-translate-x-full" : "muda:translate-x-full"
48
+ }, {
49
+ default: S(() => [C(o("div", {
50
+ class: "muda:relative muda:h-full muda:overflow-hidden",
51
+ style: f({ width: v(_) })
52
+ }, [o("div", { class: d(["muda:absolute muda:inset-0 muda:z-100 muda:border-secondary-light muda:bg-foreground", {
53
+ "muda:before:absolute muda:before:top-0 muda:before:bottom-0 muda:before:z-50 muda:before:w-2 muda:before:from-black muda:before:opacity-10 muda:before:content-['']": v(u) === "absolute",
54
+ "muda:left-2 muda:border-l muda:before:-left-2 muda:before:bg-linear-to-l": v(u) === "absolute" && v(m) === "right",
55
+ "muda:right-2 muda:border-r muda:before:-right-2 muda:before:bg-linear-to-r": v(u) === "absolute" && v(m) === "left",
56
+ "muda:left-0 muda:border-l": v(u) !== "absolute" && v(m) === "right",
57
+ "muda:right-0 muda:border-r": v(u) !== "absolute" && v(m) === "left"
58
+ }]) }, [g(e.$slots, "content", { isActive: T.value })], 2)], 4), [[x, T.value]])]),
59
+ _: 3
60
+ }, 8, ["enter-from-class", "leave-to-class"])], 6)) : i("", !0)]));
61
+ }
62
+ }), j = { class: "muda:flex muda:h-full muda:flex-col" }, M = { class: "muda:flex muda:h-full muda:flex-col muda:justify-end" }, N = /* @__PURE__ */ c({
63
+ __name: "MudaSidebar",
64
+ props: /*@__PURE__*/ u({
65
+ items: {},
66
+ size: { default: "medium" },
67
+ position: { default: "left" },
68
+ mode: { default: "absolute" },
69
+ contentWidth: { default: T },
70
+ paneWidth: { default: w }
71
+ }, {
72
+ modelValue: { required: !0 },
73
+ modelModifiers: {}
74
+ }),
75
+ emits: ["update:modelValue"],
76
+ setup(t) {
77
+ let i = t, s = y(t, "modelValue"), { contentWidth: c, mode: l, paneWidth: u, position: v, size: b } = _(i);
78
+ m(E, {
79
+ selectedItem: s,
80
+ contentWidth: c,
81
+ mode: l,
82
+ paneWidth: u,
83
+ position: v,
84
+ size: b
85
+ });
86
+ let x = n(() => ({
87
+ mode: l.value,
88
+ position: v.value,
89
+ size: b.value
90
+ })), C = n(() => i.items.filter((e) => e.position === "top")), w = n(() => i.items.filter((e) => e.position === "bottom"));
91
+ return (t, n) => (p(), a("div", {
92
+ class: d(["muda:relative muda:flex muda:h-full muda:bg-transparent muda:transition-[width] muda:duration-300 muda:ease-out", {
93
+ "muda:justify-end": i.position === "right",
94
+ "muda:justify-start": i.position === "left"
95
+ }]),
96
+ style: f({ width: i.mode === "static" && s.value != null ? `calc(${i.contentWidth} + ${i.paneWidth})` : i.paneWidth })
97
+ }, [o("div", {
98
+ class: d(["muda:flex muda:h-full muda:flex-col muda:bg-foreground muda:py-4", {
99
+ "muda:border-l muda:border-l-secondary-light": i.position === "right",
100
+ "muda:border-r muda:border-r-secondary-light": i.position === "left"
101
+ }]),
102
+ style: f({ width: i.paneWidth })
103
+ }, [o("div", j, [(p(!0), a(e, null, h(C.value, (e, n) => (p(), r(A, {
104
+ key: e.name,
105
+ item: e
106
+ }, {
107
+ label: S(({ isActive: r }) => [g(t.$slots, `${e.name}-label`, {
108
+ item: e,
109
+ index: n,
110
+ isActive: r,
111
+ context: x.value
112
+ })]),
113
+ content: S(({ isActive: r }) => [g(t.$slots, e.name, {
114
+ item: e,
115
+ index: n,
116
+ isActive: r,
117
+ context: x.value
118
+ })]),
119
+ _: 2
120
+ }, 1032, ["item"]))), 128))]), o("div", M, [(p(!0), a(e, null, h(w.value, (e, n) => (p(), r(A, {
121
+ key: e.name,
122
+ item: e
123
+ }, {
124
+ label: S(({ isActive: r }) => [g(t.$slots, `${e.name}-label`, {
125
+ item: e,
126
+ index: n,
127
+ isActive: r,
128
+ context: x.value
129
+ })]),
130
+ content: S(({ isActive: r }) => [g(t.$slots, e.name, {
131
+ item: e,
132
+ index: n,
133
+ isActive: r,
134
+ context: x.value
135
+ })]),
136
+ _: 2
137
+ }, 1032, ["item"]))), 128))])], 6)], 6));
138
+ }
139
+ });
140
+ //#endregion
141
+ export { T as n, w as r, N as t };
@@ -0,0 +1,2 @@
1
+ import type { MudaComponentVariant } from "../../common/components";
2
+ export type MudaButtonVariant = MudaComponentVariant | `outline-${MudaComponentVariant}` | `link-${MudaComponentVariant}`;
@@ -1,7 +1,8 @@
1
- import type { MudaComponentSize, MudaComponentVariant } from "../../common/components";
1
+ import type { MudaComponentSize } from "../../common/components";
2
+ import { MudaButtonVariant } from "./MudaButton.types";
2
3
  type __VLS_Props = {
3
4
  size?: MudaComponentSize;
4
- variant?: MudaComponentVariant;
5
+ variant?: MudaButtonVariant;
5
6
  disabled?: boolean;
6
7
  as?: "button" | "a";
7
8
  };
@@ -11,7 +12,7 @@ type __VLS_Slots = {} & {
11
12
  };
12
13
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
13
14
  size: MudaComponentSize;
14
- variant: MudaComponentVariant;
15
+ variant: MudaButtonVariant;
15
16
  disabled: boolean;
16
17
  as: "button" | "a";
17
18
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1 +1,2 @@
1
+ export * from "./MudaButton.types";
1
2
  export { default as MudaButton } from "./MudaButton.vue";
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../MudaButton-CWY0U8WO.js";
1
+ import { t as e } from "../../MudaButton-B9EAJW32.js";
2
2
  export { e as MudaButton };
@@ -1,2 +1,2 @@
1
- import { n as e, t } from "../../MudaColorPicker-CnB1MYB3.js";
1
+ import { n as e, t } from "../../MudaColorPicker-D9BhgHf9.js";
2
2
  export { t as MudaColorPicker, e as MudaColorPickerControl };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../MudaDialog-D0VZdP3Y.js";
1
+ import { t as e } from "../../MudaDialog-dQSFVdgu.js";
2
2
  export { e as MudaDialog };
@@ -1,2 +1,2 @@
1
- import { n as e, t } from "../../MudaFormCombobox-DqH-EyMV.js";
1
+ import { n as e, t } from "../../MudaFormCombobox-CK2De6Rv.js";
2
2
  export { e as MudaFormComboboxMultiple, t as MudaFormComboboxSingle };
@@ -0,0 +1,16 @@
1
+ export type MudaSidebarMode = "absolute" | "static";
2
+ export type MudaSidebarPosition = "left" | "right";
3
+ export type MudaSidebarItemPosition = "top" | "bottom";
4
+ interface MudaSidebarItemBase<T extends string> {
5
+ name: T;
6
+ position: MudaSidebarItemPosition;
7
+ }
8
+ export type MudaSidebarItem<T extends string> = MudaSidebarItemBase<T> & ({
9
+ type: "pane";
10
+ } | {
11
+ type: "button";
12
+ onClick: () => void;
13
+ });
14
+ export declare const MUDA_SIDEBAR_DEFAULT_PANE_WIDTH = "64px";
15
+ export declare const MUDA_SIDEBAR_DEFAULT_CONTENT_WIDTH = "360px";
16
+ export {};
@@ -0,0 +1,67 @@
1
+ import { MudaComponentSize } from "../../common/components";
2
+ import { type MudaSidebarItem, type MudaSidebarMode, type MudaSidebarPosition } from "./MudaSidebar.types";
3
+ declare const __VLS_export: <T extends string>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<({
5
+ items: MudaSidebarItem<T>[];
6
+ size?: MudaComponentSize;
7
+ position?: MudaSidebarPosition;
8
+ mode?: MudaSidebarMode;
9
+ contentWidth?: string;
10
+ paneWidth?: string;
11
+ } & {
12
+ modelValue: T | null;
13
+ }) & {
14
+ "onUpdate:modelValue"?: ((value: T | null) => any) | undefined;
15
+ }> & (typeof globalThis extends {
16
+ __VLS_PROPS_FALLBACK: infer P;
17
+ } ? P : {});
18
+ expose: (exposed: {}) => void;
19
+ attrs: any;
20
+ slots: { [K in `${T}-label`]?: ((props: {
21
+ item: MudaSidebarItem<T>;
22
+ index: number;
23
+ isActive: boolean;
24
+ context: {
25
+ mode: MudaSidebarMode;
26
+ position: MudaSidebarPosition;
27
+ size: MudaComponentSize;
28
+ };
29
+ }) => any) | undefined; } & { [K_1 in T]?: ((props: {
30
+ item: MudaSidebarItem<T>;
31
+ index: number;
32
+ isActive: boolean;
33
+ context: {
34
+ mode: MudaSidebarMode;
35
+ position: MudaSidebarPosition;
36
+ size: MudaComponentSize;
37
+ };
38
+ }) => any) | undefined; } & { [K_2 in `${T}-label`]?: ((props: {
39
+ item: MudaSidebarItem<T>;
40
+ index: number;
41
+ isActive: boolean;
42
+ context: {
43
+ mode: MudaSidebarMode;
44
+ position: MudaSidebarPosition;
45
+ size: MudaComponentSize;
46
+ };
47
+ }) => any) | undefined; } & { [K_3 in T]?: ((props: {
48
+ item: MudaSidebarItem<T>;
49
+ index: number;
50
+ isActive: boolean;
51
+ context: {
52
+ mode: MudaSidebarMode;
53
+ position: MudaSidebarPosition;
54
+ size: MudaComponentSize;
55
+ };
56
+ }) => any) | undefined; };
57
+ emit: (event: "update:modelValue", value: T | null) => void;
58
+ }>) => import("vue").VNode & {
59
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
60
+ };
61
+ declare const _default: typeof __VLS_export;
62
+ export default _default;
63
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
64
+ [K in keyof T]: T[K];
65
+ } : {
66
+ [K in keyof T as K]: T[K];
67
+ }) & {};