@mudakit/ui 0.1.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.
- package/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/README.md +46 -0
- package/THIRD_PARTY_LICENSES +15 -0
- package/dist/MudaButton-Bw6Fw2-Y.js +42 -0
- package/dist/MudaButtonStack-xCMVwXHf.js +16 -0
- package/dist/MudaCalendar-f1lHTxVw.js +593 -0
- package/dist/MudaCard-C9geam4O.js +10 -0
- package/dist/MudaColorPicker-Ny8v-KZR.js +134 -0
- package/dist/MudaDialog-C6dOmY_K.js +105 -0
- package/dist/MudaDropdown-DJOG_m6C.js +54 -0
- package/dist/MudaErrorBox-C0DvbAfU.js +28 -0
- package/dist/MudaFormCheckbox-CDY-INi6.js +43 -0
- package/dist/MudaFormCombobox-CBaRBOKQ.js +186 -0
- package/dist/MudaFormField-Bt5W7NC1.js +42 -0
- package/dist/MudaFormInput-CI_xfpTj.js +56 -0
- package/dist/MudaFormRadio-DOXXv3mT.js +21 -0
- package/dist/MudaFormRadioGroup-45qiNrzt.js +48 -0
- package/dist/MudaFormSelect-Bt6EW1N-.js +28 -0
- package/dist/MudaFormSwitch-CtdB9qIP.js +33 -0
- package/dist/MudaFormText-s-Y3QoDX.js +23 -0
- package/dist/MudaIcon-BhSsLCZx.js +1886 -0
- package/dist/MudaIconPicker-CZWLPHbE.js +114 -0
- package/dist/MudaMarker-1xxDZJgb.js +24 -0
- package/dist/MudaPagination-BYyElnCp.js +119 -0
- package/dist/MudaPopover-BgwkVjjX.js +67 -0
- package/dist/MudaSpinner-C5_q8Vtn.js +26 -0
- package/dist/MudaTable-DWwTyMmj.js +33 -0
- package/dist/MudaTag-DLqit790.js +27 -0
- package/dist/_plugin-vue_export-helper-B3ysoDQm.js +8 -0
- package/dist/common/components.d.ts +3 -0
- package/dist/common/keymap.d.ts +9 -0
- package/dist/common/range.d.ts +1 -0
- package/dist/components/MudaButton/MudaButton.vue.d.ts +25 -0
- package/dist/components/MudaButton/index.d.ts +1 -0
- package/dist/components/MudaButton/index.js +2 -0
- package/dist/components/MudaButtonStack/MudaButtonStack.vue.d.ts +16 -0
- package/dist/components/MudaButtonStack/index.d.ts +1 -0
- package/dist/components/MudaButtonStack/index.js +2 -0
- package/dist/components/MudaCalendar/MudaCalendar.dayjs.d.ts +3 -0
- package/dist/components/MudaCalendar/MudaCalendar.types.d.ts +30 -0
- package/dist/components/MudaCalendar/MudaCalendar.vue.d.ts +27 -0
- package/dist/components/MudaCalendar/MudaCalendarDatePicker.vue.d.ts +22 -0
- package/dist/components/MudaCalendar/MudaCalendarDays.vue.d.ts +25 -0
- package/dist/components/MudaCalendar/MudaCalendarHead.vue.d.ts +21 -0
- package/dist/components/MudaCalendar/MudaCalendarInput.vue.d.ts +25 -0
- package/dist/components/MudaCalendar/MudaCalendarMonths.vue.d.ts +27 -0
- package/dist/components/MudaCalendar/MudaCalendarWeekDays.vue.d.ts +9 -0
- package/dist/components/MudaCalendar/MudaCalendarYears.vue.d.ts +27 -0
- package/dist/components/MudaCalendar/index.d.ts +4 -0
- package/dist/components/MudaCalendar/index.js +2 -0
- package/dist/components/MudaCalendar/useMudaCalendar.d.ts +18 -0
- package/dist/components/MudaCard/MudaCard.vue.d.ts +13 -0
- package/dist/components/MudaCard/index.d.ts +1 -0
- package/dist/components/MudaCard/index.js +2 -0
- package/dist/components/MudaColorPicker/MudaColorPicker.vue.d.ts +21 -0
- package/dist/components/MudaColorPicker/MudaColorPickerControl.vue.d.ts +18 -0
- package/dist/components/MudaColorPicker/index.d.ts +2 -0
- package/dist/components/MudaColorPicker/index.js +2 -0
- package/dist/components/MudaDialog/MudaDialog.vue.d.ts +20 -0
- package/dist/components/MudaDialog/MudaDialogFocusTrap.vue.d.ts +18 -0
- package/dist/components/MudaDialog/index.d.ts +1 -0
- package/dist/components/MudaDialog/index.js +2 -0
- package/dist/components/MudaDropdown/MudaDropdown.types.d.ts +8 -0
- package/dist/components/MudaDropdown/MudaDropdown.vue.d.ts +33 -0
- package/dist/components/MudaDropdown/index.d.ts +2 -0
- package/dist/components/MudaDropdown/index.js +2 -0
- package/dist/components/MudaErrorBox/MudaErrorBox.vue.d.ts +9 -0
- package/dist/components/MudaErrorBox/index.d.ts +1 -0
- package/dist/components/MudaErrorBox/index.js +2 -0
- package/dist/components/MudaFormCheckbox/MudaFormCheckbox.types.d.ts +1 -0
- package/dist/components/MudaFormCheckbox/MudaFormCheckbox.vue.d.ts +18 -0
- package/dist/components/MudaFormCheckbox/index.d.ts +2 -0
- package/dist/components/MudaFormCheckbox/index.js +2 -0
- package/dist/components/MudaFormCombobox/MudaFormCombobox.types.d.ts +5 -0
- package/dist/components/MudaFormCombobox/MudaFormComboboxMultiple.vue.d.ts +32 -0
- package/dist/components/MudaFormCombobox/MudaFormComboboxSingle.vue.d.ts +34 -0
- package/dist/components/MudaFormCombobox/index.d.ts +3 -0
- package/dist/components/MudaFormCombobox/index.js +2 -0
- package/dist/components/MudaFormField/MudaFormField.vue.d.ts +31 -0
- package/dist/components/MudaFormField/MudaFormFieldErrors.vue.d.ts +8 -0
- package/dist/components/MudaFormField/index.d.ts +2 -0
- package/dist/components/MudaFormField/index.js +2 -0
- package/dist/components/MudaFormInput/MudaFormInput.types.d.ts +5 -0
- package/dist/components/MudaFormInput/MudaFormInput.vue.d.ts +31 -0
- package/dist/components/MudaFormInput/index.d.ts +2 -0
- package/dist/components/MudaFormInput/index.js +2 -0
- package/dist/components/MudaFormRadio/MudaFormRadio.types.d.ts +1 -0
- package/dist/components/MudaFormRadio/MudaFormRadio.vue.d.ts +11 -0
- package/dist/components/MudaFormRadio/index.d.ts +2 -0
- package/dist/components/MudaFormRadio/index.js +2 -0
- package/dist/components/MudaFormRadioGroup/MudaFormRadioGroup.types.d.ts +7 -0
- package/dist/components/MudaFormRadioGroup/MudaFormRadioGroup.vue.d.ts +34 -0
- package/dist/components/MudaFormRadioGroup/index.d.ts +2 -0
- package/dist/components/MudaFormRadioGroup/index.js +2 -0
- package/dist/components/MudaFormSelect/MudaFormSelect.vue.d.ts +24 -0
- package/dist/components/MudaFormSelect/index.d.ts +1 -0
- package/dist/components/MudaFormSelect/index.js +2 -0
- package/dist/components/MudaFormSwitch/MudaFormSwitch.vue.d.ts +14 -0
- package/dist/components/MudaFormSwitch/index.d.ts +1 -0
- package/dist/components/MudaFormSwitch/index.js +2 -0
- package/dist/components/MudaFormText/MudaFormText.types.d.ts +4 -0
- package/dist/components/MudaFormText/MudaFormText.vue.d.ts +13 -0
- package/dist/components/MudaFormText/index.d.ts +2 -0
- package/dist/components/MudaFormText/index.js +2 -0
- package/dist/components/MudaIcon/MudaIcon.types.d.ts +5 -0
- package/dist/components/MudaIcon/MudaIcon.vue.d.ts +13 -0
- package/dist/components/MudaIcon/icons/filled.d.ts +100 -0
- package/dist/components/MudaIcon/icons/index.d.ts +2 -0
- package/dist/components/MudaIcon/icons/outlined.d.ts +100 -0
- package/dist/components/MudaIcon/index.d.ts +3 -0
- package/dist/components/MudaIcon/index.js +2 -0
- package/dist/components/MudaIcon/useMudaIcon.d.ts +109 -0
- package/dist/components/MudaIconPicker/MudaIconPicker.vue.d.ts +24 -0
- package/dist/components/MudaIconPicker/MudaIconPickerList.vue.d.ts +16 -0
- package/dist/components/MudaIconPicker/index.d.ts +1 -0
- package/dist/components/MudaIconPicker/index.js +2 -0
- package/dist/components/MudaIconPicker/useMudaIconPickerList.d.ts +3 -0
- package/dist/components/MudaMarker/MudaMarker.vue.d.ts +22 -0
- package/dist/components/MudaMarker/index.d.ts +1 -0
- package/dist/components/MudaMarker/index.js +2 -0
- package/dist/components/MudaPagination/MudaPagination.vue.d.ts +29 -0
- package/dist/components/MudaPagination/MudaPaginationItem.vue.d.ts +17 -0
- package/dist/components/MudaPagination/index.d.ts +1 -0
- package/dist/components/MudaPagination/index.js +2 -0
- package/dist/components/MudaPopover/MudaPopover.types.d.ts +3 -0
- package/dist/components/MudaPopover/MudaPopover.vue.d.ts +37 -0
- package/dist/components/MudaPopover/index.d.ts +2 -0
- package/dist/components/MudaPopover/index.js +2 -0
- package/dist/components/MudaSpinner/MudaSpinner.vue.d.ts +11 -0
- package/dist/components/MudaSpinner/index.d.ts +1 -0
- package/dist/components/MudaSpinner/index.js +2 -0
- package/dist/components/MudaTable/MudaTable.vue.d.ts +19 -0
- package/dist/components/MudaTable/MudaTableCell.vue.d.ts +13 -0
- package/dist/components/MudaTable/MudaTableHead.vue.d.ts +13 -0
- package/dist/components/MudaTable/MudaTableRow.vue.d.ts +13 -0
- package/dist/components/MudaTable/index.d.ts +4 -0
- package/dist/components/MudaTable/index.js +2 -0
- package/dist/components/MudaTag/MudaTag.vue.d.ts +21 -0
- package/dist/components/MudaTag/index.d.ts +1 -0
- package/dist/components/MudaTag/index.js +2 -0
- package/dist/composables/useBodyScrollLock.d.ts +2 -0
- package/dist/composables/useClickOutside.d.ts +2 -0
- package/dist/composables/useFocusTrap.d.ts +5 -0
- package/dist/composables/useKeyDown.d.ts +1 -0
- package/dist/composables/useResizeObserver.d.ts +2 -0
- package/dist/composables/useZIndex.d.ts +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +26 -0
- package/dist/keymap-BzfMgdJH.js +6 -0
- package/dist/style.css +2 -0
- package/dist/styles.js +0 -0
- package/dist/useClickOutside-B6tdxsc3.js +15 -0
- package/dist/useKeyDown-B1jmp4nA.js +11 -0
- package/dist/useZIndex-DWnsohLZ.js +8 -0
- package/package.json +79 -0
- package/style.css.d.ts +3 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { t as e } from "./MudaButton-Bw6Fw2-Y.js";
|
|
2
|
+
import { t } from "./keymap-BzfMgdJH.js";
|
|
3
|
+
import { t as n } from "./MudaIcon-BhSsLCZx.js";
|
|
4
|
+
import { t as r } from "./MudaFormInput-CI_xfpTj.js";
|
|
5
|
+
import { t as i } from "./MudaPopover-BgwkVjjX.js";
|
|
6
|
+
import { t as a } from "./_plugin-vue_export-helper-B3ysoDQm.js";
|
|
7
|
+
import { t as o } from "./useKeyDown-B1jmp4nA.js";
|
|
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
|
+
import { ColorPickerCanvas as T, ColorPickerHueCursor as E, ColorPickerSaturationCursor as D, useColorPicker as O } from "@wattanx/vue-color-picker";
|
|
10
|
+
//#region src/common/components.ts
|
|
11
|
+
var k = {
|
|
12
|
+
small: 120,
|
|
13
|
+
medium: 180,
|
|
14
|
+
large: 240
|
|
15
|
+
}, A = /*@__PURE__*/ f({
|
|
16
|
+
__name: "MudaColorPickerControl",
|
|
17
|
+
props: {
|
|
18
|
+
size: { default: k.medium },
|
|
19
|
+
initialColor: { default: "#cccccc" }
|
|
20
|
+
},
|
|
21
|
+
emits: ["change"],
|
|
22
|
+
setup(e, { emit: t }) {
|
|
23
|
+
let n = e, r = t, { onMoveHue: i, onMoveSaturation: a, selfColor: o, saturationPosition: s, huePosition: l } = O({
|
|
24
|
+
initialColor: n.initialColor,
|
|
25
|
+
width: n.size,
|
|
26
|
+
height: n.size
|
|
27
|
+
});
|
|
28
|
+
return S(() => {
|
|
29
|
+
r("change", o.value.hex);
|
|
30
|
+
}), (e, t) => (g(), c("div", {
|
|
31
|
+
class: "flex flex-col gap-4",
|
|
32
|
+
style: h({ width: `${n.size}px` })
|
|
33
|
+
}, [d(y(T), {
|
|
34
|
+
class: "color-picker-saturation relative w-full rounded-lg select-none",
|
|
35
|
+
style: h({
|
|
36
|
+
backgroundColor: `hsl(${y(o).hsv.h}, 100%, 50%)`,
|
|
37
|
+
height: `${n.size}px`
|
|
38
|
+
}),
|
|
39
|
+
onChangePosition: y(a)
|
|
40
|
+
}, {
|
|
41
|
+
default: C(() => [d(y(D), {
|
|
42
|
+
class: "absolute h-4 w-4 -translate-x-2 -translate-y-2 rounded-full border-2 border-white shadow-xs shadow-gray-400",
|
|
43
|
+
"saturation-position": y(s),
|
|
44
|
+
hex: y(o).hex
|
|
45
|
+
}, null, 8, ["saturation-position", "hex"])]),
|
|
46
|
+
_: 1
|
|
47
|
+
}, 8, ["style", "onChangePosition"]), d(y(T), {
|
|
48
|
+
class: "color-picker-hue relative h-4 w-full rounded-lg select-none",
|
|
49
|
+
onChangePosition: y(i)
|
|
50
|
+
}, {
|
|
51
|
+
default: C(() => [d(y(E), {
|
|
52
|
+
position: y(l),
|
|
53
|
+
hue: y(o).hsv.h,
|
|
54
|
+
direction: "horizontal",
|
|
55
|
+
class: "absolute h-4 w-4 -translate-x-2 rounded-full border-2 border-white shadow-xs shadow-gray-400"
|
|
56
|
+
}, null, 8, ["position", "hue"])]),
|
|
57
|
+
_: 1
|
|
58
|
+
}, 8, ["onChangePosition"])], 4));
|
|
59
|
+
}
|
|
60
|
+
}), j = /*#__PURE__*/ a(A, [["__scopeId", "data-v-da1392ff"]]), M = { class: "flex flex-col gap-2" }, N = /* @__PURE__ */ f({
|
|
61
|
+
inheritAttrs: !1,
|
|
62
|
+
__name: "MudaColorPicker",
|
|
63
|
+
props: /*@__PURE__*/ p({
|
|
64
|
+
size: { default: "medium" },
|
|
65
|
+
buttonLabel: {},
|
|
66
|
+
disabled: { type: Boolean },
|
|
67
|
+
appendToBody: { type: Boolean },
|
|
68
|
+
isInvalid: { type: Boolean }
|
|
69
|
+
}, {
|
|
70
|
+
modelValue: { default: "#007bff" },
|
|
71
|
+
modelModifiers: {}
|
|
72
|
+
}),
|
|
73
|
+
emits: ["update:modelValue"],
|
|
74
|
+
setup(a) {
|
|
75
|
+
let c = a, f = b(a, "modelValue"), p = _(), S = _(f.value), T = _(!1);
|
|
76
|
+
x(f, (e) => {
|
|
77
|
+
T.value || (S.value = e);
|
|
78
|
+
}), o((e) => {
|
|
79
|
+
if (T.value) switch (e.key) {
|
|
80
|
+
case t.Escape: T.value = !1, p.value?.input?.blur();
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
let E = () => {
|
|
84
|
+
f.value = S.value, T.value = !1;
|
|
85
|
+
};
|
|
86
|
+
return (t, a) => (g(), s(y(i), {
|
|
87
|
+
modelValue: T.value,
|
|
88
|
+
"onUpdate:modelValue": a[4] ||= (e) => T.value = e,
|
|
89
|
+
placement: "bottom-start",
|
|
90
|
+
"append-to-body": c.appendToBody
|
|
91
|
+
}, {
|
|
92
|
+
content: C(() => [l("div", M, [(g(), s(j, {
|
|
93
|
+
key: c.size,
|
|
94
|
+
"initial-color": f.value,
|
|
95
|
+
size: y(k)[c.size],
|
|
96
|
+
onChange: a[3] ||= (e) => S.value = e
|
|
97
|
+
}, null, 8, ["initial-color", "size"])), d(y(e), {
|
|
98
|
+
type: "button",
|
|
99
|
+
variant: "primary",
|
|
100
|
+
size: "small",
|
|
101
|
+
onClick: w(E, ["stop"]),
|
|
102
|
+
style: h({ backgroundColor: S.value })
|
|
103
|
+
}, {
|
|
104
|
+
default: C(() => [u(v(c.buttonLabel ?? S.value), 1)]),
|
|
105
|
+
_: 1
|
|
106
|
+
}, 8, ["style"])])]),
|
|
107
|
+
default: C(() => [d(y(r), m({
|
|
108
|
+
ref_key: "inputRef",
|
|
109
|
+
ref: p
|
|
110
|
+
}, t.$attrs, {
|
|
111
|
+
modelValue: f.value,
|
|
112
|
+
"onUpdate:modelValue": a[0] ||= (e) => f.value = e,
|
|
113
|
+
disabled: c.disabled,
|
|
114
|
+
"is-invalid": c.isInvalid,
|
|
115
|
+
readonly: "",
|
|
116
|
+
onFocus: a[1] ||= (e) => T.value = !0,
|
|
117
|
+
"onClick:before": a[2] ||= (e) => T.value = !0
|
|
118
|
+
}), {
|
|
119
|
+
before: C(() => [d(y(n), {
|
|
120
|
+
icon: "palette:outlined",
|
|
121
|
+
color: f.value
|
|
122
|
+
}, null, 8, ["color"])]),
|
|
123
|
+
_: 1
|
|
124
|
+
}, 16, [
|
|
125
|
+
"modelValue",
|
|
126
|
+
"disabled",
|
|
127
|
+
"is-invalid"
|
|
128
|
+
])]),
|
|
129
|
+
_: 1
|
|
130
|
+
}, 8, ["modelValue", "append-to-body"]));
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
//#endregion
|
|
134
|
+
export { j as n, N as t };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { t as e } from "./keymap-BzfMgdJH.js";
|
|
2
|
+
import { t } from "./useZIndex-DWnsohLZ.js";
|
|
3
|
+
import { t as n } from "./useKeyDown-B1jmp4nA.js";
|
|
4
|
+
import { Teleport as r, Transition as i, createBlock as a, createCommentVNode as o, createElementVNode as s, createVNode as c, defineComponent as l, mergeProps as u, nextTick as d, normalizeStyle as f, onMounted as p, onUnmounted as m, openBlock as h, ref as g, renderSlot as _, resolveDynamicComponent as v, unref as y, useModel as b, useTemplateRef as x, watch as S, withCtx as C, withModifiers as w } from "vue";
|
|
5
|
+
//#region src/composables/useBodyScrollLock.ts
|
|
6
|
+
var T = 0, E = "", D = (e) => {
|
|
7
|
+
let t = !1, n = () => {
|
|
8
|
+
t || typeof document > "u" || (T === 0 && (E = document.body.style.overflow, document.body.style.overflow = "hidden"), T += 1, t = !0);
|
|
9
|
+
}, r = () => {
|
|
10
|
+
!t || typeof document > "u" || (--T, t = !1, T === 0 && (document.body.style.overflow = E));
|
|
11
|
+
};
|
|
12
|
+
S(e, (e) => e ? n() : r(), { immediate: !0 }), m(r);
|
|
13
|
+
}, O = (t) => {
|
|
14
|
+
let n = g(null), r = (e) => {
|
|
15
|
+
let t = [
|
|
16
|
+
"a[href]",
|
|
17
|
+
"button:not([disabled])",
|
|
18
|
+
"input:not([disabled])",
|
|
19
|
+
"select:not([disabled])",
|
|
20
|
+
"textarea:not([disabled])",
|
|
21
|
+
"[tabindex]:not([tabindex=\"-1\"])",
|
|
22
|
+
"[contenteditable]:not([tabindex=\"-1\"])"
|
|
23
|
+
].join(",");
|
|
24
|
+
return Array.from(e.querySelectorAll(t));
|
|
25
|
+
}, i = (n) => {
|
|
26
|
+
if (n.key !== e.Tab || !t.value) return;
|
|
27
|
+
let i = r(t.value);
|
|
28
|
+
if (i.length === 0) return;
|
|
29
|
+
let a = i[0], o = i[i.length - 1];
|
|
30
|
+
n.shiftKey ? document.activeElement === a && (o?.focus(), n.preventDefault()) : document.activeElement === o && (a?.focus(), n.preventDefault());
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
activate: async () => {
|
|
34
|
+
if (!t.value) return;
|
|
35
|
+
n.value = document.activeElement, document.addEventListener("keydown", i), await d();
|
|
36
|
+
let e = r(t.value);
|
|
37
|
+
e.length > 0 && e[0]?.focus();
|
|
38
|
+
},
|
|
39
|
+
deactivate: () => {
|
|
40
|
+
document.removeEventListener("keydown", i), n.value?.focus();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}, k = /* @__PURE__ */ l({
|
|
44
|
+
__name: "MudaDialogFocusTrap",
|
|
45
|
+
props: { is: { default: "div" } },
|
|
46
|
+
setup(e) {
|
|
47
|
+
let t = e, { activate: n, deactivate: r } = O(x("trap"));
|
|
48
|
+
return p(n), m(r), (e, n) => (h(), a(v(t.is), {
|
|
49
|
+
ref: "trap",
|
|
50
|
+
tabindex: "-1",
|
|
51
|
+
role: "region"
|
|
52
|
+
}, {
|
|
53
|
+
default: C(() => [_(e.$slots, "default")]),
|
|
54
|
+
_: 3
|
|
55
|
+
}, 512));
|
|
56
|
+
}
|
|
57
|
+
}), A = { class: "fixed inset-0 w-screen overflow-y-auto py-6" }, j = { class: "flex min-h-full items-center justify-center" }, M = /* @__PURE__ */ l({
|
|
58
|
+
inheritAttrs: !1,
|
|
59
|
+
__name: "MudaDialog",
|
|
60
|
+
props: {
|
|
61
|
+
modelValue: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
required: !0
|
|
64
|
+
},
|
|
65
|
+
modelModifiers: {}
|
|
66
|
+
},
|
|
67
|
+
emits: ["update:modelValue"],
|
|
68
|
+
setup(l) {
|
|
69
|
+
let d = b(l, "modelValue"), p = x("dialog"), m = t();
|
|
70
|
+
D(d), n((t) => {
|
|
71
|
+
if (d.value) switch (t.key) {
|
|
72
|
+
case e.Escape: d.value = !1, t.preventDefault();
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
let g = (e) => {
|
|
76
|
+
p.value?.contains(e.target) || (d.value = !1);
|
|
77
|
+
};
|
|
78
|
+
return (e, t) => (h(), a(r, { to: "body" }, [c(i, {
|
|
79
|
+
"enter-active-class": "transition-opacity ease-linear duration-100",
|
|
80
|
+
"leave-active-class": "transition-opacity ease-linear duration-100",
|
|
81
|
+
"enter-from-class": "opacity-0",
|
|
82
|
+
"leave-to-class": "opacity-0"
|
|
83
|
+
}, {
|
|
84
|
+
default: C(() => [d.value ? (h(), a(k, {
|
|
85
|
+
key: 0,
|
|
86
|
+
"aria-modal": "true",
|
|
87
|
+
role: "dialog",
|
|
88
|
+
class: "fixed inset-0 bg-gray-500/30 backdrop-blur-xs transition-opacity",
|
|
89
|
+
style: f({ zIndex: y(m) }),
|
|
90
|
+
onClickCapture: g,
|
|
91
|
+
onWheel: t[0] ||= w(() => {}, ["stop"])
|
|
92
|
+
}, {
|
|
93
|
+
default: C(() => [s("div", A, [s("div", j, [s("div", u(e.$attrs, {
|
|
94
|
+
class: "rounded-lg bg-background p-4 focus:outline-hidden",
|
|
95
|
+
tabindex: "0",
|
|
96
|
+
ref: "dialog"
|
|
97
|
+
}), [_(e.$slots, "default")], 16)])])]),
|
|
98
|
+
_: 3
|
|
99
|
+
}, 8, ["style"])) : o("", !0)]),
|
|
100
|
+
_: 3
|
|
101
|
+
})]));
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
//#endregion
|
|
105
|
+
export { M as t };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { t as e } from "./MudaIcon-BhSsLCZx.js";
|
|
2
|
+
import { t } from "./MudaPopover-BgwkVjjX.js";
|
|
3
|
+
import { Fragment as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, defineComponent as c, mergeModels as l, normalizeClass as u, openBlock as d, renderList as f, renderSlot as p, toDisplayString as m, unref as h, useModel as g, useSlots as _, withCtx as v, withModifiers as y } from "vue";
|
|
4
|
+
//#region src/components/MudaDropdown/MudaDropdown.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var b = { class: "flex flex-col" }, x = ["onClick"], S = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "flex items-center gap-2"
|
|
8
|
+
}, C = /* @__PURE__ */ c({
|
|
9
|
+
__name: "MudaDropdown",
|
|
10
|
+
props: /*@__PURE__*/ l({ items: {} }, {
|
|
11
|
+
modelValue: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: !1
|
|
14
|
+
},
|
|
15
|
+
modelModifiers: {}
|
|
16
|
+
}),
|
|
17
|
+
emits: /*@__PURE__*/ l(["action"], ["update:modelValue"]),
|
|
18
|
+
setup(c, { emit: l }) {
|
|
19
|
+
let C = c, w = _(), T = l, E = g(c, "modelValue"), D = (e, t) => {
|
|
20
|
+
E.value = !1, T("action", e, t);
|
|
21
|
+
};
|
|
22
|
+
return (c, l) => (d(), r(h(t), {
|
|
23
|
+
modelValue: E.value,
|
|
24
|
+
"onUpdate:modelValue": l[0] ||= (e) => E.value = e,
|
|
25
|
+
placement: "bottom-start",
|
|
26
|
+
"append-to-body": ""
|
|
27
|
+
}, {
|
|
28
|
+
content: v(() => [o("div", b, [(d(!0), a(n, null, f(C.items, (t, n) => (d(), a("button", {
|
|
29
|
+
key: n,
|
|
30
|
+
class: u(["muda-button-reset flex w-full cursor-pointer items-center gap-2 rounded-md px-4 py-2 text-left text-sm", {
|
|
31
|
+
"fill-secondary text-secondary hover:bg-secondary-light": t.variant === "default" || t.variant == null,
|
|
32
|
+
"fill-primary text-primary hover:bg-primary hover:fill-white hover:text-white": t.variant === "primary",
|
|
33
|
+
"fill-secondary text-secondary hover:bg-secondary hover:fill-white hover:text-white": t.variant === "secondary",
|
|
34
|
+
"fill-success text-success hover:bg-success hover:fill-white hover:text-white": t.variant === "success",
|
|
35
|
+
"fill-danger text-danger hover:bg-danger hover:fill-white hover:text-white": t.variant === "danger",
|
|
36
|
+
"fill-warning text-warning hover:bg-warning hover:fill-white hover:text-white": t.variant === "warning",
|
|
37
|
+
"fill-info text-info hover:bg-info hover:fill-white hover:text-white": t.variant === "info"
|
|
38
|
+
}]),
|
|
39
|
+
onClick: y((e) => D(t, n), ["prevent"])
|
|
40
|
+
}, [w.item == null ? (d(), a("span", S, [t.icon == null ? i("", !0) : (d(), r(h(e), {
|
|
41
|
+
key: 0,
|
|
42
|
+
icon: t.icon,
|
|
43
|
+
size: "small"
|
|
44
|
+
}, null, 8, ["icon"])), s(" " + m(t.label), 1)])) : p(c.$slots, "item", {
|
|
45
|
+
item: t,
|
|
46
|
+
index: n
|
|
47
|
+
}, void 0, void 0, 1)], 10, x))), 128))])]),
|
|
48
|
+
default: v(() => [p(c.$slots, "default")]),
|
|
49
|
+
_: 3
|
|
50
|
+
}, 8, ["modelValue"]));
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
//#endregion
|
|
54
|
+
export { C as t };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { computed as e, createElementBlock as t, createElementVNode as n, defineComponent as r, openBlock as i, toDisplayString as a } from "vue";
|
|
2
|
+
//#region src/components/MudaErrorBox/MudaErrorBox.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
+
var o = {
|
|
4
|
+
class: "flex flex-col gap-2",
|
|
5
|
+
role: "alert",
|
|
6
|
+
"aria-live": "assertive"
|
|
7
|
+
}, s = { class: "text-center text-4xl font-bold text-danger" }, c = { class: "text-center text-2xl font-semibold tracking-tight text-secondary-dark" }, l = /* @__PURE__ */ r({
|
|
8
|
+
__name: "MudaErrorBox",
|
|
9
|
+
props: {
|
|
10
|
+
title: { default: "Error" },
|
|
11
|
+
error: {}
|
|
12
|
+
},
|
|
13
|
+
setup(r) {
|
|
14
|
+
let l = r, u = e(() => {
|
|
15
|
+
if (l.error instanceof Error) return l.error.message;
|
|
16
|
+
if (l.error == null) return "Unknown error";
|
|
17
|
+
if (typeof l.error == "string") return l.error;
|
|
18
|
+
try {
|
|
19
|
+
return JSON.stringify(l.error) ?? String(l.error);
|
|
20
|
+
} catch {
|
|
21
|
+
return String(l.error);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return (e, r) => (i(), t("div", o, [n("h1", s, a(l.title), 1), n("h2", c, a(u.value), 1)]));
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
//#endregion
|
|
28
|
+
export { l as t };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createElementBlock as e, defineComponent as t, mergeModels as n, mergeProps as r, openBlock as i, useModel as a, vModelCheckbox as o, withDirectives as s } from "vue";
|
|
2
|
+
//#endregion
|
|
3
|
+
//#region src/components/MudaFormCheckbox/MudaFormCheckbox.vue
|
|
4
|
+
var c = /* @__PURE__ */ t({
|
|
5
|
+
__name: "MudaFormCheckbox",
|
|
6
|
+
props: /*@__PURE__*/ n({ size: { default: "medium" } }, {
|
|
7
|
+
modelValue: {
|
|
8
|
+
type: [
|
|
9
|
+
Boolean,
|
|
10
|
+
Array,
|
|
11
|
+
null
|
|
12
|
+
],
|
|
13
|
+
default: void 0
|
|
14
|
+
},
|
|
15
|
+
modelModifiers: {}
|
|
16
|
+
}),
|
|
17
|
+
emits: ["update:modelValue"],
|
|
18
|
+
setup(t) {
|
|
19
|
+
let n = t, c = a(t, "modelValue");
|
|
20
|
+
return (t, a) => s((i(), e("input", r(t.$attrs, {
|
|
21
|
+
"onUpdate:modelValue": a[0] ||= (e) => c.value = e,
|
|
22
|
+
type: "checkbox",
|
|
23
|
+
"data-checked": "✓",
|
|
24
|
+
class: [
|
|
25
|
+
n.size === "small" && "size-4 before:text-xs",
|
|
26
|
+
n.size === "medium" && "size-5 before:text-lg",
|
|
27
|
+
n.size === "large" && "size-6 before:text-xl",
|
|
28
|
+
"muda-control-reset bg-form-background",
|
|
29
|
+
"relative shrink-0 appearance-none outline-hidden",
|
|
30
|
+
"rounded-xs border border-secondary-light text-secondary-dark",
|
|
31
|
+
"focus:ring-2 focus:ring-primary-light focus:outline-hidden",
|
|
32
|
+
"disabled:border-secondary-dark/20 disabled:text-secondary-light",
|
|
33
|
+
"before:absolute before:top-0 before:right-0 before:bottom-0 before:left-0",
|
|
34
|
+
"before:flex before:items-center before:justify-center",
|
|
35
|
+
"before:text-sm before:font-bold before:text-primary",
|
|
36
|
+
"checked:before:content-[attr(data-checked)]",
|
|
37
|
+
"disabled:before:text-secondary-light"
|
|
38
|
+
]
|
|
39
|
+
}), null, 16)), [[o, c.value]]);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
//#endregion
|
|
43
|
+
export { c as t };
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { t as e } from "./keymap-BzfMgdJH.js";
|
|
2
|
+
import { t } from "./MudaIcon-BhSsLCZx.js";
|
|
3
|
+
import { t as n } from "./MudaFormInput-CI_xfpTj.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";
|
|
7
|
+
import { t as o } from "./MudaFormCheckbox-CDY-INi6.js";
|
|
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
|
+
import { autoUpdate as I, flip as L, offset as R, shift as z, size as B, useFloating as V } from "@floating-ui/vue";
|
|
10
|
+
//#region src/components/MudaFormCombobox/MudaFormComboboxMultiple.vue?vue&type=script&setup=true&lang.ts
|
|
11
|
+
var H = { class: "flex flex-col" }, U = {
|
|
12
|
+
key: 0,
|
|
13
|
+
class: "-mt-2.75 rounded-b-lg border border-secondary-light bg-form-background pt-2.5"
|
|
14
|
+
}, W = { class: "m-0 muda-no-scrollbar flex max-h-80 list-none flex-col gap-1 muda-scroll-container-v-form-background rounded-lg px-2 py-2" }, G = { class: "flex cursor-pointer items-center gap-2" }, K = /* @__PURE__ */ v({
|
|
15
|
+
inheritAttrs: !1,
|
|
16
|
+
__name: "MudaFormComboboxMultiple",
|
|
17
|
+
props: /*@__PURE__*/ y({
|
|
18
|
+
options: {},
|
|
19
|
+
placeholder: {},
|
|
20
|
+
disabled: { type: Boolean }
|
|
21
|
+
}, {
|
|
22
|
+
modelValue: { default: () => [] },
|
|
23
|
+
modelModifiers: {}
|
|
24
|
+
}),
|
|
25
|
+
emits: ["update:modelValue"],
|
|
26
|
+
setup(e) {
|
|
27
|
+
let r = e, i = A(), a = k(e, "modelValue"), c = w(""), l = u(() => {
|
|
28
|
+
let e = c.value.trim().toLowerCase();
|
|
29
|
+
return e === "" ? r.options : r.options.filter((t) => t.label.toLowerCase().includes(e));
|
|
30
|
+
}), h = () => {
|
|
31
|
+
c.value.length > 0 ? c.value = "" : a.value = [];
|
|
32
|
+
};
|
|
33
|
+
return (e, u) => (C(), p("div", H, [_(O(n), b(e.$attrs, {
|
|
34
|
+
modelValue: c.value,
|
|
35
|
+
"onUpdate:modelValue": u[0] ||= (e) => c.value = e,
|
|
36
|
+
placeholder: r.placeholder,
|
|
37
|
+
"onClick:after": h,
|
|
38
|
+
disabled: r.disabled
|
|
39
|
+
}), {
|
|
40
|
+
after: P(() => [c.value.length > 0 ? (C(), d(O(t), {
|
|
41
|
+
key: 0,
|
|
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)]),
|
|
44
|
+
_: 1
|
|
45
|
+
}, 16, [
|
|
46
|
+
"modelValue",
|
|
47
|
+
"placeholder",
|
|
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,
|
|
52
|
+
size: "small",
|
|
53
|
+
value: t.value,
|
|
54
|
+
disabled: r.disabled
|
|
55
|
+
}, null, 8, [
|
|
56
|
+
"modelValue",
|
|
57
|
+
"value",
|
|
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)]));
|
|
60
|
+
}
|
|
61
|
+
}), q = {
|
|
62
|
+
ref: "root",
|
|
63
|
+
class: "relative"
|
|
64
|
+
}, J = ["onClick"], Y = /* @__PURE__ */ v({
|
|
65
|
+
__name: "MudaFormComboboxSingle",
|
|
66
|
+
props: /*@__PURE__*/ y({
|
|
67
|
+
options: {},
|
|
68
|
+
placeholder: {},
|
|
69
|
+
disabled: { type: Boolean },
|
|
70
|
+
appendToBody: { type: Boolean },
|
|
71
|
+
isInvalid: { type: Boolean }
|
|
72
|
+
}, {
|
|
73
|
+
modelValue: { default: void 0 },
|
|
74
|
+
modelModifiers: {}
|
|
75
|
+
}),
|
|
76
|
+
emits: ["update:modelValue"],
|
|
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(() => {
|
|
79
|
+
let e = H.value.trim().toLowerCase();
|
|
80
|
+
return e === "" ? m.options : m.options.filter((t) => t.label.toLowerCase().includes(e));
|
|
81
|
+
}), { floatingStyles: Q } = V(U, W, {
|
|
82
|
+
whileElementsMounted: I,
|
|
83
|
+
transform: !1,
|
|
84
|
+
placement: "bottom-start",
|
|
85
|
+
strategy: "absolute",
|
|
86
|
+
middleware: [
|
|
87
|
+
R(0),
|
|
88
|
+
L(),
|
|
89
|
+
z({ padding: 5 }),
|
|
90
|
+
B({ apply({ elements: e }) {
|
|
91
|
+
Object.assign(e.floating.style, { minWidth: `${e.reference.getBoundingClientRect().width}px` });
|
|
92
|
+
} })
|
|
93
|
+
]
|
|
94
|
+
}), $ = (e) => {
|
|
95
|
+
let t = Z.value[e];
|
|
96
|
+
t != null && (H.value = t.label, y.value = t.value, K.value = !1);
|
|
97
|
+
}, ee = (e) => {
|
|
98
|
+
e.preventDefault(), H.value = "", y.value = void 0;
|
|
99
|
+
};
|
|
100
|
+
return r([U, W], () => {
|
|
101
|
+
K.value &&= !1;
|
|
102
|
+
}), a((t) => {
|
|
103
|
+
if (K.value && !t.isComposing) switch (t.key) {
|
|
104
|
+
case e.Enter:
|
|
105
|
+
Y.value != null && ($(Y.value), t.preventDefault());
|
|
106
|
+
break;
|
|
107
|
+
case e.Escape:
|
|
108
|
+
K.value = !1;
|
|
109
|
+
break;
|
|
110
|
+
case e.ArrowDown:
|
|
111
|
+
if (Z.value.length === 0) {
|
|
112
|
+
Y.value = null;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
Y.value = Y.value == null ? 0 : (Y.value + 1) % Z.value.length, t.preventDefault();
|
|
116
|
+
break;
|
|
117
|
+
case e.ArrowUp:
|
|
118
|
+
if (Z.value.length === 0) {
|
|
119
|
+
Y.value = null;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
Y.value = Y.value == null ? Z.value.length - 1 : (Y.value + Z.value.length - 1) % Z.value.length, t.preventDefault();
|
|
123
|
+
}
|
|
124
|
+
}), N(() => {
|
|
125
|
+
Y.value != null && W.value?.children[Y.value]?.scrollIntoView({
|
|
126
|
+
block: "center",
|
|
127
|
+
behavior: "smooth"
|
|
128
|
+
});
|
|
129
|
+
}), M(Z, (e) => {
|
|
130
|
+
Y.value = K.value && e.length > 0 ? 0 : null;
|
|
131
|
+
}), M(K, (e) => {
|
|
132
|
+
e || G.value?.input?.blur(), Y.value = e && Z.value.length > 0 ? 0 : null;
|
|
133
|
+
}), M([y, () => m.options], ([e]) => {
|
|
134
|
+
H.value = m.options.find(({ value: t }) => t === e)?.label ?? "";
|
|
135
|
+
}, { deep: !0 }), (e, r) => (C(), p("div", q, [_(O(n), b(e.$attrs, {
|
|
136
|
+
modelValue: H.value,
|
|
137
|
+
"onUpdate:modelValue": r[0] ||= (e) => H.value = e,
|
|
138
|
+
ref_key: "inputRef",
|
|
139
|
+
ref: G,
|
|
140
|
+
onFocus: r[1] ||= (e) => K.value = !0,
|
|
141
|
+
"onClick:after": ee,
|
|
142
|
+
disabled: m.disabled,
|
|
143
|
+
placeholder: m.placeholder,
|
|
144
|
+
"is-invalid": m.isInvalid
|
|
145
|
+
}), h({ _: 2 }, [H.value.length > 0 ? {
|
|
146
|
+
name: "after",
|
|
147
|
+
fn: P(() => [_(O(t), { icon: "close:outlined" })]),
|
|
148
|
+
key: "0"
|
|
149
|
+
} : void 0]), 1040, [
|
|
150
|
+
"modelValue",
|
|
151
|
+
"disabled",
|
|
152
|
+
"placeholder",
|
|
153
|
+
"is-invalid"
|
|
154
|
+
]), m.disabled ? f("", !0) : (C(), d(c, {
|
|
155
|
+
key: 0,
|
|
156
|
+
to: "body",
|
|
157
|
+
disabled: !m.appendToBody
|
|
158
|
+
}, [_(l, {
|
|
159
|
+
"enter-active-class": "transition-opacity ease-linear duration-100",
|
|
160
|
+
"leave-active-class": "transition-opacity ease-linear duration-100",
|
|
161
|
+
"enter-from-class": "opacity-0",
|
|
162
|
+
"leave-to-class": "opacity-0"
|
|
163
|
+
}, {
|
|
164
|
+
default: P(() => [K.value ? (C(), p("ul", {
|
|
165
|
+
key: 0,
|
|
166
|
+
ref: "list",
|
|
167
|
+
class: "m-0 max-h-52 w-max list-none overflow-auto rounded-sm bg-form-background p-0 shadow-lg",
|
|
168
|
+
style: S({
|
|
169
|
+
...O(Q),
|
|
170
|
+
zIndex: O(X)
|
|
171
|
+
})
|
|
172
|
+
}, [(C(!0), p(s, null, T(Z.value, (t, n) => (C(), p("li", {
|
|
173
|
+
key: `${String(t.value)}-${n}`,
|
|
174
|
+
role: "button",
|
|
175
|
+
class: x(["flex h-10 w-full cursor-pointer items-center px-2 text-base select-none", {
|
|
176
|
+
"bg-primary-light text-white": Y.value === n,
|
|
177
|
+
"bg-primary text-white": t.value === y.value
|
|
178
|
+
}]),
|
|
179
|
+
onClick: F((e) => $(n), ["prevent"])
|
|
180
|
+
}, [v.label == null ? (C(), p(s, { key: 1 }, [g(D(t.label), 1)], 64)) : E(e.$slots, "label", { option: t }, void 0, void 0, 0)], 10, J))), 128))], 4)) : f("", !0)]),
|
|
181
|
+
_: 3
|
|
182
|
+
})], 8, ["disabled"]))], 512));
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
//#endregion
|
|
186
|
+
export { K as n, Y as t };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createVNode as o, defineComponent as s, normalizeClass as c, openBlock as l, renderList as u, renderSlot as d, resolveDynamicComponent as f, toDisplayString as p, withCtx as m } from "vue";
|
|
2
|
+
//#region src/components/MudaFormField/MudaFormFieldErrors.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
+
var h = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "m-0 list-none fill-danger p-0 text-danger"
|
|
6
|
+
}, g = /* @__PURE__ */ s({
|
|
7
|
+
__name: "MudaFormFieldErrors",
|
|
8
|
+
props: { errors: {} },
|
|
9
|
+
setup(t) {
|
|
10
|
+
let n = t;
|
|
11
|
+
return (t, a) => n.errors && n.errors.length > 0 ? (l(), i("ul", h, [(l(!0), i(e, null, u(n.errors, (e, t) => (l(), i("li", {
|
|
12
|
+
key: `${e.message}-${t}`,
|
|
13
|
+
class: "text-xs wrap-break-word"
|
|
14
|
+
}, p(e.message), 1))), 128))])) : r("", !0);
|
|
15
|
+
}
|
|
16
|
+
}), _ = { class: "flex flex-col gap-2" }, v = /* @__PURE__ */ s({
|
|
17
|
+
__name: "MudaFormField",
|
|
18
|
+
props: {
|
|
19
|
+
axis: { default: "vertical" },
|
|
20
|
+
errors: {},
|
|
21
|
+
labelPosition: { default: "before" },
|
|
22
|
+
as: { default: "label" }
|
|
23
|
+
},
|
|
24
|
+
setup(s) {
|
|
25
|
+
let u = s, p = t(() => u.errors && u.errors.length > 0);
|
|
26
|
+
return (t, s) => (l(), i("div", _, [(l(), n(f(u.as), { class: c(["flex cursor-pointer text-sm leading-6 font-medium", {
|
|
27
|
+
"flex-col gap-1": u.axis === "vertical",
|
|
28
|
+
"flex-row items-center gap-2": u.axis === "horizontal"
|
|
29
|
+
}]) }, {
|
|
30
|
+
default: m(() => [u.labelPosition === "before" ? (l(), i(e, { key: 0 }, [a("span", { class: c(["block", {
|
|
31
|
+
"text-secondary-dark": !p.value,
|
|
32
|
+
"text-danger": p.value
|
|
33
|
+
}]) }, [d(t.$slots, "label")], 2), d(t.$slots, "default")], 64)) : u.labelPosition === "after" ? (l(), i(e, { key: 1 }, [d(t.$slots, "default"), a("span", { class: c(["block", {
|
|
34
|
+
"text-secondary-dark": !p.value,
|
|
35
|
+
"text-danger": p.value
|
|
36
|
+
}]) }, [d(t.$slots, "label")], 2)], 64)) : r("", !0)]),
|
|
37
|
+
_: 3
|
|
38
|
+
}, 8, ["class"])), o(g, { errors: u.errors }, null, 8, ["errors"])]));
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
//#endregion
|
|
42
|
+
export { g as n, v as t };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { computed as e, createCommentVNode as t, createElementBlock as n, createElementVNode as r, defineComponent as i, getCurrentInstance as a, mergeModels as o, mergeProps as s, normalizeClass as c, openBlock as l, renderSlot as u, useModel as d, useSlots as f, useTemplateRef as p, vModelDynamic as m, withDirectives as h } from "vue";
|
|
2
|
+
//#region src/components/MudaFormInput/MudaFormInput.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
+
var g = { class: "relative inline-block w-full" }, _ = { class: "flex size-6 items-center justify-center" }, v = { class: "flex size-6 items-center justify-center" }, y = /* @__PURE__ */ i({
|
|
4
|
+
inheritAttrs: !1,
|
|
5
|
+
__name: "MudaFormInput",
|
|
6
|
+
props: /*@__PURE__*/ o({ isInvalid: { type: Boolean } }, {
|
|
7
|
+
modelValue: {},
|
|
8
|
+
modelModifiers: {}
|
|
9
|
+
}),
|
|
10
|
+
emits: /*@__PURE__*/ o(["click:before", "click:after"], ["update:modelValue"]),
|
|
11
|
+
setup(i, { expose: o, emit: y }) {
|
|
12
|
+
let b = i, x = f(), S = d(i, "modelValue"), C = y;
|
|
13
|
+
o({ input: p("input") });
|
|
14
|
+
let w = e(() => {
|
|
15
|
+
let e = a()?.vnode.props;
|
|
16
|
+
return e != null && e["onClick:before"] != null;
|
|
17
|
+
}), T = e(() => {
|
|
18
|
+
let e = a()?.vnode.props;
|
|
19
|
+
return e != null && e["onClick:after"] != null;
|
|
20
|
+
});
|
|
21
|
+
return (e, i) => (l(), n("span", g, [
|
|
22
|
+
x.before == null ? t("", !0) : (l(), n("span", {
|
|
23
|
+
key: 0,
|
|
24
|
+
class: c(["absolute inset-y-0 left-2 flex items-center", {
|
|
25
|
+
"fill-primary text-primary": !b.isInvalid,
|
|
26
|
+
"fill-danger text-danger": b.isInvalid,
|
|
27
|
+
"pointer-events-none": !w.value,
|
|
28
|
+
"cursor-pointer": w.value
|
|
29
|
+
}]),
|
|
30
|
+
onClick: i[0] ||= (e) => C("click:before", e)
|
|
31
|
+
}, [r("span", _, [u(e.$slots, "before")])], 2)),
|
|
32
|
+
h(r("input", s(e.$attrs, {
|
|
33
|
+
"onUpdate:modelValue": i[1] ||= (e) => S.value = e,
|
|
34
|
+
ref: "input",
|
|
35
|
+
class: ["muda-control-reset block h-10 w-full rounded-md border bg-form-background px-2 text-secondary-dark placeholder:text-secondary-light focus:ring-2 focus:outline-hidden disabled:border-secondary-dark/20 disabled:bg-secondary-light disabled:text-secondary-light", {
|
|
36
|
+
"border-secondary-light focus:ring-primary-light": !b.isInvalid,
|
|
37
|
+
"border-danger focus:ring-danger-light": b.isInvalid,
|
|
38
|
+
"pl-9": x.before != null,
|
|
39
|
+
"pr-9": x.after != null
|
|
40
|
+
}]
|
|
41
|
+
}), null, 16), [[m, S.value]]),
|
|
42
|
+
x.after == null ? t("", !0) : (l(), n("span", {
|
|
43
|
+
key: 1,
|
|
44
|
+
class: c(["absolute inset-y-0 right-2 flex items-center", {
|
|
45
|
+
"fill-primary text-primary": !b.isInvalid,
|
|
46
|
+
"fill-danger text-danger": b.isInvalid,
|
|
47
|
+
"pointer-events-none": !T.value,
|
|
48
|
+
"cursor-pointer": T.value
|
|
49
|
+
}]),
|
|
50
|
+
onClick: i[2] ||= (e) => C("click:after", e)
|
|
51
|
+
}, [r("span", v, [u(e.$slots, "after")])], 2))
|
|
52
|
+
]));
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
//#endregion
|
|
56
|
+
export { y as t };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createElementBlock as e, defineComponent as t, mergeProps as n, openBlock as r, useModel as i, vModelRadio as a, withDirectives as o } from "vue";
|
|
2
|
+
//#endregion
|
|
3
|
+
//#region src/components/MudaFormRadio/MudaFormRadio.vue
|
|
4
|
+
var s = /* @__PURE__ */ t({
|
|
5
|
+
__name: "MudaFormRadio",
|
|
6
|
+
props: {
|
|
7
|
+
modelValue: {},
|
|
8
|
+
modelModifiers: {}
|
|
9
|
+
},
|
|
10
|
+
emits: ["update:modelValue"],
|
|
11
|
+
setup(t) {
|
|
12
|
+
let s = i(t, "modelValue");
|
|
13
|
+
return (t, i) => o((r(), e("input", n(t.$attrs, {
|
|
14
|
+
"onUpdate:modelValue": i[0] ||= (e) => s.value = e,
|
|
15
|
+
type: "radio",
|
|
16
|
+
class: "muda-control-reset h-4 w-4 bg-form-background text-primary focus:ring-primary"
|
|
17
|
+
}), null, 16)), [[a, s.value]]);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
export { s as t };
|