mc-plus 1.0.7 → 1.0.8
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/dist/es/hooks-c7yYlQyM.js +15 -0
- package/dist/es/index.js +40 -12
- package/dist/es/mc-alert-D_0-anUc.js +12 -0
- package/dist/es/{mc-button-D6IV1cvA.js → mc-button-CUHRxe0J.js} +3 -3
- package/dist/es/{mc-collapse-DE4emHTm.js → mc-collapse-HNiVA8cx.js} +2 -2
- package/dist/es/{mc-icon-B0xq3JPC.js → mc-icon--CImsgxi.js} +1 -1
- package/dist/es/mc-input-C0-hVMB4.js +16 -0
- package/dist/es/mc-message-CiZLkARt.js +51 -0
- package/dist/es/mc-radio-CyQBkFhk.js +20 -0
- package/dist/es/mc-select-DphuwPx6.js +52 -0
- package/dist/es/mc-switch-B6sZH0JJ.js +11 -0
- package/dist/es/mc-tag-DAxgmVb3.js +53 -0
- package/dist/es/mc-toast-FFs5K38d.js +52 -0
- package/dist/es/mc-tooltip-CSuvzJyd.js +33 -0
- package/dist/es/theme/index.css +1 -1
- package/dist/es/theme/mc-alert.css +1 -0
- package/dist/es/theme/mc-input.css +1 -0
- package/dist/es/theme/mc-message.css +1 -0
- package/dist/es/theme/mc-radio.css +1 -0
- package/dist/es/theme/mc-select.css +1 -0
- package/dist/es/theme/mc-switch.css +1 -0
- package/dist/es/theme/mc-tag.css +1 -0
- package/dist/es/theme/mc-toast.css +1 -0
- package/dist/es/theme/mc-tooltip.css +1 -0
- package/dist/es/{utils-CDDTlenj.js → utils-BwgRXuj9.js} +1 -1
- package/dist/es/vendor-CNzO2Q1s.js +506 -0
- package/dist/index.css +1 -1
- package/dist/types/components/index.d.ts +10 -1
- package/dist/types/components/mc-alert/index.d.ts +48 -0
- package/dist/types/components/mc-alert/types.d.ts +17 -0
- package/dist/types/components/mc-input/index.d.ts +57 -0
- package/dist/types/components/mc-input/types.d.ts +17 -0
- package/dist/types/components/mc-message/index.d.ts +64 -0
- package/dist/types/components/mc-message/types.d.ts +35 -0
- package/dist/types/components/mc-radio/index.d.ts +87 -0
- package/dist/types/components/mc-radio/types.d.ts +35 -0
- package/dist/types/components/mc-select/constant.d.ts +4 -0
- package/dist/types/components/mc-select/index.d.ts +93 -0
- package/dist/types/components/mc-select/types.d.ts +42 -0
- package/dist/types/components/mc-switch/index.d.ts +45 -0
- package/dist/types/components/mc-switch/types.d.ts +15 -0
- package/dist/types/components/mc-tag/index.d.ts +57 -0
- package/dist/types/components/mc-tag/types.d.ts +24 -0
- package/dist/types/components/mc-toast/index.d.ts +61 -0
- package/dist/types/components/mc-toast/toast.d.ts +19 -0
- package/dist/types/components/mc-toast/types.d.ts +21 -0
- package/dist/types/components/mc-tooltip/index.d.ts +65 -0
- package/dist/types/components/mc-tooltip/types.d.ts +20 -0
- package/dist/types/hooks/index.d.ts +2 -0
- package/dist/types/hooks/useClickOutside.d.ts +2 -0
- package/dist/types/hooks/useEventListener.d.ts +2 -0
- package/dist/umd/index.css +1 -1
- package/dist/umd/index.css.gz +0 -0
- package/dist/umd/index.umd.cjs +3 -1
- package/dist/umd/index.umd.cjs.gz +0 -0
- package/package.json +4 -1
- package/dist/es/vendor-D4RgMZ9r.js +0 -171
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { isRef as e, watch as t, onMounted as n, onBeforeUnmount as r, unref as v } from "vue";
|
|
2
|
+
function a(a2, i) {
|
|
3
|
+
var o, s, u;
|
|
4
|
+
o = document, s = "click", u = (e2) => {
|
|
5
|
+
a2.value && e2.target && (a2.value.contains(e2.target) || i(e2));
|
|
6
|
+
}, e(o) ? t(o, (e2, t2) => {
|
|
7
|
+
t2 == null ? void 0 : t2.removeEventListener(s, u), e2 == null ? void 0 : e2.addEventListener(s, u);
|
|
8
|
+
}) : n(() => o == null ? void 0 : o.addEventListener(s, u)), r(() => {
|
|
9
|
+
var _a;
|
|
10
|
+
return (_a = v(o)) == null ? void 0 : _a.removeEventListener(s, u);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
a as u
|
|
15
|
+
};
|
package/dist/es/index.js
CHANGED
|
@@ -1,15 +1,43 @@
|
|
|
1
|
-
import { p as
|
|
2
|
-
import { M
|
|
3
|
-
import {
|
|
4
|
-
import { M as
|
|
5
|
-
import { a } from "./mc-collapse-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { p as s, m as o } from "./utils-BwgRXuj9.js";
|
|
2
|
+
import { M } from "./mc-alert-D_0-anUc.js";
|
|
3
|
+
import { M as r } from "./mc-button-CUHRxe0J.js";
|
|
4
|
+
import { M as m } from "./mc-collapse-HNiVA8cx.js";
|
|
5
|
+
import { a } from "./mc-collapse-HNiVA8cx.js";
|
|
6
|
+
import { a as p } from "./mc-icon--CImsgxi.js";
|
|
7
|
+
import { M as M2, a as a2 } from "./mc-message-CiZLkARt.js";
|
|
8
|
+
import { M as M3, a as a3 } from "./mc-radio-CyQBkFhk.js";
|
|
9
|
+
import { M as i } from "./mc-switch-B6sZH0JJ.js";
|
|
10
|
+
import { M as f } from "./mc-tooltip-CSuvzJyd.js";
|
|
11
|
+
import { M as j } from "./mc-input-C0-hVMB4.js";
|
|
12
|
+
import { M as l, a as n, b as x } from "./mc-select-DphuwPx6.js";
|
|
13
|
+
import { M as M4 } from "./mc-tag-DAxgmVb3.js";
|
|
14
|
+
import { M as M5, c, t, e, a as a4, b, d } from "./mc-toast-FFs5K38d.js";
|
|
15
|
+
const g = [r, p, m, i, f, j, l, n, x];
|
|
16
|
+
s();
|
|
17
|
+
const u = o(g);
|
|
9
18
|
export {
|
|
10
|
-
|
|
11
|
-
r as
|
|
19
|
+
M as McAlert,
|
|
20
|
+
r as McButton,
|
|
21
|
+
m as McCollapse,
|
|
12
22
|
a as McCollapseItem,
|
|
13
|
-
|
|
14
|
-
|
|
23
|
+
p as McIcon,
|
|
24
|
+
j as McInput,
|
|
25
|
+
M2 as McMessage,
|
|
26
|
+
M3 as McRadio,
|
|
27
|
+
a3 as McRadioGroup,
|
|
28
|
+
l as McSelect,
|
|
29
|
+
n as McSelectGroup,
|
|
30
|
+
x as McSelectOption,
|
|
31
|
+
i as McSwitch,
|
|
32
|
+
M4 as McTag,
|
|
33
|
+
M5 as McToast,
|
|
34
|
+
f as McTooltip,
|
|
35
|
+
a2 as Message,
|
|
36
|
+
c as createToast,
|
|
37
|
+
u as default,
|
|
38
|
+
t as toast,
|
|
39
|
+
e as toastError,
|
|
40
|
+
a4 as toastPrimary,
|
|
41
|
+
b as toastSuccess,
|
|
42
|
+
d as toastWarning
|
|
15
43
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { _ as e, w as t } from "./utils-BwgRXuj9.js";
|
|
2
|
+
import { defineComponent as s, ref as l, useAttrs as o, computed as a, createElementBlock as c, createCommentVNode as r, openBlock as i, normalizeClass as n, normalizeStyle as m, createElementVNode as _, createBlock as d, renderSlot as p, toDisplayString as f } from "vue";
|
|
3
|
+
import { M as u } from "./mc-icon--CImsgxi.js";
|
|
4
|
+
const y = { class: "mc-alert__content" }, h = { key: 1, class: "mc-alert__message" }, v = { class: "mc-alert__title" }, k = { class: "mc-alert__description" }, w = t(e(s({ name: "McAlert", __name: "mc-alert", props: { type: { default: "info" }, title: {}, description: {}, closable: { type: Boolean, default: true }, showIcon: { type: Boolean, default: true }, height: {}, width: {} }, emits: ["close"], setup(e2, { expose: t2, emit: s2 }) {
|
|
5
|
+
const w2 = e2, g = s2, I = l(), M = l(true), b = o(), j = a(() => ({ ...b.style || {}, width: w2.width, height: w2.height })), x = { success: "Accept_02", info: "Info_02", warning: "Error_02", error: "Error_04" }, A = (e3) => {
|
|
6
|
+
M.value = false, g("close", e3);
|
|
7
|
+
};
|
|
8
|
+
return t2({ ref: I }), (e3, t3) => M.value ? (i(), c("div", { key: 0, ref_key: "_ref", ref: I, style: m(j.value), class: n(["mc-alert", [`mc-alert--${e3.type}`]]) }, [_("div", y, [e3.showIcon ? (i(), d(u, { key: 0, name: x[e3.type], class: "mc-alert__icon" }, null, 8, ["name"])) : r("", true), e3.description ? (i(), c("div", h, [_("div", v, f(e3.title), 1), _("div", k, f(e3.description), 1)])) : p(e3.$slots, "default", { key: 2 }, void 0, true)]), e3.closable ? (i(), d(u, { key: 0, name: "Cross", class: "mc-alert__close", onClick: A })) : r("", true)], 6)) : r("", true);
|
|
9
|
+
} }), [["__scopeId", "data-v-ed288fa3"]]));
|
|
10
|
+
export {
|
|
11
|
+
w as M
|
|
12
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as e, toRefs as t, ref as o, useAttrs as a, computed as i, toValue as l, createElementBlock as n, openBlock as s, unref as d, normalizeClass as u, normalizeStyle as r, createBlock as c, createCommentVNode as m, renderSlot as p, createVNode as f } from "vue";
|
|
2
|
-
import { M as v } from "./mc-icon
|
|
3
|
-
import { t as y } from "./vendor-
|
|
4
|
-
import { _ as h, w as g } from "./utils-
|
|
2
|
+
import { M as v } from "./mc-icon--CImsgxi.js";
|
|
3
|
+
import { t as y } from "./vendor-CNzO2Q1s.js";
|
|
4
|
+
import { _ as h, w as g } from "./utils-BwgRXuj9.js";
|
|
5
5
|
const b = ["type", "disabled"], k = { key: 1, class: "loading-icon" }, I = g(h(e({ name: "McButton", __name: "mc-button", props: { type: { default: "primary" }, nativeType: { default: "button" }, size: { default: "medium" }, disabled: { type: Boolean }, loading: { type: Boolean }, useThrottle: { type: Boolean, default: true }, throttleDuration: { default: 500 }, leftIcon: {}, rightIcon: {}, content: {}, height: {}, width: {} }, emits: ["click"], setup(e2, { expose: h2, emit: g2 }) {
|
|
6
6
|
const I2 = e2, { loading: _, disabled: w, throttleDuration: B, height: T, width: j } = t(I2), z = g2, M = o(), $ = t(a()), x = i(() => ({ ...l($).style, width: j.value ? j.value : void 0, height: T.value ? T.value : void 0 })), D = (e3) => {
|
|
7
7
|
_.value || w.value || z("click", e3);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as e, ref as a, watchEffect as l, watch as s, provide as o, createElementBlock as c, openBlock as t, renderSlot as i, inject as m, computed as d, normalizeClass as n, createElementVNode as p, withDirectives as u, createTextVNode as r, toDisplayString as v, createVNode as _, vShow as h } from "vue";
|
|
2
|
-
import { d as f, _ as C, w as V } from "./utils-
|
|
3
|
-
import { M as b } from "./mc-icon
|
|
2
|
+
import { d as f, _ as C, w as V } from "./utils-BwgRXuj9.js";
|
|
3
|
+
import { M as b } from "./mc-icon--CImsgxi.js";
|
|
4
4
|
const g = Symbol("COLLAPSE_CONTEXT"), I = "McCollapse", M = { class: "mc-collapse" }, k = C(e({ name: I, __name: "mc-collapse", props: { modelValue: {}, accordion: { type: Boolean } }, emits: ["update:modelValue", "change"], setup(e2, { emit: m2 }) {
|
|
5
5
|
const d2 = a(e2.modelValue), n2 = m2;
|
|
6
6
|
l(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as c, ref as e, createElementBlock as o, openBlock as s, normalizeClass as n } from "vue";
|
|
2
|
-
import { _ as m, w as a } from "./utils-
|
|
2
|
+
import { _ as m, w as a } from "./utils-BwgRXuj9.js";
|
|
3
3
|
const i = m(c({ name: "McIcon", __name: "mc-icon", props: { name: {} }, emits: ["click"], setup(c2, { expose: m2, emit: a2 }) {
|
|
4
4
|
const i2 = a2, r2 = e();
|
|
5
5
|
return m2({ ref: r2 }), (c3, e2) => (s(), o("i", { ref_key: "_ref", ref: r2, class: n(["mc-iconfont", `mc-icon--${c3.name}`]), onClick: e2[0] || (e2[0] = (c4) => ((c5) => {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineComponent as e, ref as a, watch as l, createElementBlock as s, openBlock as o, normalizeClass as p, renderSlot as t, withDirectives as u, createCommentVNode as n, createVNode as d, createElementVNode as c, withModifiers as i, vModelDynamic as m } from "vue";
|
|
2
|
+
import { M as r } from "./mc-icon--CImsgxi.js";
|
|
3
|
+
import { _ as v, w as h } from "./utils-BwgRXuj9.js";
|
|
4
|
+
const b = { key: 0, class: "mc-input-icon" }, y = ["type", "placeholder", "disabled"], f = { key: 0, class: "mc-input-icon mc-input-icon-eye" }, w = h(v(e({ name: "McInput", __name: "mc-input", props: { modelValue: {}, search: { type: Boolean }, disabled: { type: Boolean }, password: { type: Boolean }, placeholder: { default: "Please input" } }, emits: ["update:modelValue", "input", "change", "focus", "blur"], setup(e2, { emit: v2 }) {
|
|
5
|
+
const h2 = e2, w2 = v2, _ = a(h2.modelValue ?? "");
|
|
6
|
+
l(() => h2.modelValue, (e3) => {
|
|
7
|
+
_.value = e3, w2("change", e3);
|
|
8
|
+
});
|
|
9
|
+
const V = a(false), B = () => {
|
|
10
|
+
w2("update:modelValue", _.value), w2("input", _.value);
|
|
11
|
+
};
|
|
12
|
+
return (e3, a2) => (o(), s("div", { class: p(["mc-input", { "mc-input--disabled": e3.disabled }]) }, [t(e3.$slots, "pre", {}, () => [e3.search ? (o(), s("span", b, [d(r, { name: "Search" })])) : n("", true)], true), u(c("input", { class: "mc-input__inner", type: V.value && e3.password ? "password" : "text", "onUpdate:modelValue": a2[0] || (a2[0] = (e4) => _.value = e4), placeholder: e3.placeholder, disabled: e3.disabled, onInput: i(B, ["stop"]), onFocus: a2[1] || (a2[1] = i((e4) => w2("focus", e4), ["stop"])), onBlur: a2[2] || (a2[2] = i((e4) => w2("blur", e4), ["stop"])) }, null, 40, y), [[m, _.value]]), t(e3.$slots, "default", { class: "post" }, () => [e3.password ? (o(), s("span", f, [d(r, { name: V.value ? "Review-Hidden" : "Review", onClick: a2[3] || (a2[3] = (e4) => V.value = !V.value) }, null, 8, ["name"])])) : n("", true)], true)], 2));
|
|
13
|
+
} }), [["__scopeId", "data-v-5e55909a"]]));
|
|
14
|
+
export {
|
|
15
|
+
w as M
|
|
16
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { _ as e, w as s } from "./utils-BwgRXuj9.js";
|
|
2
|
+
import { defineComponent as o, ref as t, toRefs as n, useAttrs as a, computed as c, toValue as r, onMounted as m, createBlock as l, openBlock as i, Transition as d, withCtx as p, withDirectives as u, createElementVNode as f, normalizeStyle as g, normalizeClass as _, createCommentVNode as y, createElementBlock as v, toDisplayString as h, vShow as C, render as w, createVNode as b } from "vue";
|
|
3
|
+
import { M as E } from "./mc-icon--CImsgxi.js";
|
|
4
|
+
const I = { class: "mc-message__content" }, k = { class: "mc-message__text" }, x = { class: "mc-message__title" }, M = { key: 0, class: "mc-message__description" }, A = e(o({ name: "McMessage", __name: "mc-message", props: { type: { default: "info" }, message: { default: "" }, description: { default: "" }, duration: { default: 3e3 }, showIcon: { type: Boolean, default: true }, closable: { type: Boolean, default: false }, onClose: {} }, emits: ["close"], setup(e2, { expose: s2, emit: o2 }) {
|
|
5
|
+
const w2 = e2, b2 = o2, A2 = t(), B2 = t(true), j2 = n(a()), L2 = c(() => ({ ...r(j2).style })), T2 = { success: "Accept_02", info: "Info_02", warning: "Error_02", error: "Error_04" }, $2 = () => {
|
|
6
|
+
var _a;
|
|
7
|
+
B2.value = false, b2("close"), (_a = w2.onClose) == null ? void 0 : _a.call(w2);
|
|
8
|
+
};
|
|
9
|
+
return m(() => {
|
|
10
|
+
w2.duration > 0 && setTimeout(() => {
|
|
11
|
+
$2();
|
|
12
|
+
}, w2.duration);
|
|
13
|
+
}), s2({ ref: A2, handleClose: $2 }), (e3, s3) => (i(), l(d, { name: "mc-message-fade" }, { default: p(() => [u(f("div", { ref_key: "_ref", ref: A2, class: _(["mc-message", [`mc-message--${e3.type}`]]), style: g(L2.value) }, [f("div", I, [e3.showIcon ? (i(), l(E, { key: 0, name: T2[e3.type], class: "mc-message__icon" }, null, 8, ["name"])) : y("", true), f("div", k, [f("div", x, h(e3.message), 1), e3.description ? (i(), v("div", M, h(e3.description), 1)) : y("", true)])]), e3.closable ? (i(), l(E, { key: 0, name: "Cross", class: "mc-message__close", onClick: $2 })) : y("", true)], 6), [[C, B2.value]])]), _: 1 }));
|
|
14
|
+
} }), [["__scopeId", "data-v-7b740c4b"]]), B = s(A);
|
|
15
|
+
let j = 1;
|
|
16
|
+
const L = [], T = () => {
|
|
17
|
+
let e2 = document.getElementById("mc-message-container");
|
|
18
|
+
return e2 || (e2 = document.createElement("div"), e2.id = "mc-message-container", document.body.appendChild(e2)), e2;
|
|
19
|
+
}, $ = { info: (e2) => q(e2, "info"), success: (e2) => q(e2, "success"), warning: (e2) => q(e2, "warning"), error: (e2) => q(e2, "error"), close: (e2) => z(e2), closeAll: () => {
|
|
20
|
+
[...L].forEach((e2) => {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
const s2 = (_a = e2.vm.component) == null ? void 0 : _a.exposed;
|
|
23
|
+
(_b = s2 == null ? void 0 : s2.handleClose) == null ? void 0 : _b.call(s2);
|
|
24
|
+
});
|
|
25
|
+
} };
|
|
26
|
+
function q(e2, s2) {
|
|
27
|
+
"string" == typeof e2 && (e2 = { message: e2 });
|
|
28
|
+
const o2 = "message_" + j++, t2 = e2.onClose, n2 = T(), a2 = document.createElement("div");
|
|
29
|
+
a2.setAttribute("data-message-id", o2), a2.classList.add("mc-message-item");
|
|
30
|
+
const c2 = { ...e2, type: s2, id: o2, onClose: () => {
|
|
31
|
+
t2 == null ? void 0 : t2(), z(o2);
|
|
32
|
+
} };
|
|
33
|
+
L.length >= 20 && z(L[0].id);
|
|
34
|
+
const r2 = b(A, c2);
|
|
35
|
+
return w(r2, a2), n2.appendChild(a2), L.push({ vm: r2, id: o2, wrapper: a2 }), { close: () => {
|
|
36
|
+
z(o2);
|
|
37
|
+
} };
|
|
38
|
+
}
|
|
39
|
+
function z(e2) {
|
|
40
|
+
const s2 = L.findIndex((s3) => s3.id === e2);
|
|
41
|
+
if (-1 === s2) return;
|
|
42
|
+
const o2 = L[s2];
|
|
43
|
+
if (!o2) return;
|
|
44
|
+
w(null, o2.wrapper);
|
|
45
|
+
const t2 = T();
|
|
46
|
+
t2.contains(o2.wrapper) && t2.removeChild(o2.wrapper), L.splice(s2, 1), 0 === L.length && document.body.contains(t2) && document.body.removeChild(t2);
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
B as M,
|
|
50
|
+
$ as a
|
|
51
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { _ as e, w as a } from "./utils-BwgRXuj9.js";
|
|
2
|
+
import { defineComponent as l, toRefs as d, ref as u, provide as o, computed as s, createElementBlock as i, openBlock as r, normalizeClass as t, unref as n, renderSlot as m, inject as p, createElementVNode as c, withDirectives as v, vModelRadio as _, toDisplayString as b } from "vue";
|
|
3
|
+
const f = e(l({ name: "McRadioGroup", __name: "mc-radio-group", props: { modelValue: { type: [String, Number, Boolean] }, disabled: { type: Boolean }, size: { default: "medium" }, name: {} }, emits: ["update:modelValue", "change"], setup(e2, { expose: a2, emit: l2 }) {
|
|
4
|
+
const p2 = e2, { modelValue: c2, disabled: v2, size: _2, name: b2 } = d(p2), f2 = l2, g2 = u();
|
|
5
|
+
return o("radioGroup", { value: s(() => c2.value), size: s(() => _2.value), disabled: s(() => v2.value), name: s(() => b2.value), change: (e3) => {
|
|
6
|
+
v2.value || (f2("update:modelValue", e3), f2("change", e3));
|
|
7
|
+
} }), a2({ ref: g2 }), (e3, a3) => (r(), i("div", { ref_key: "_ref", ref: g2, class: t(["mc-radio-group", { "is-disabled": n(v2) }]) }, [m(e3.$slots, "default", {}, void 0, true)], 2));
|
|
8
|
+
} }), [["__scopeId", "data-v-19cdf1eb"]]), g = { class: "mc-radio__input" }, y = ["value", "disabled"], V = { class: "mc-radio__label" }, h = { key: 0 }, k = a(e(l({ name: "McRadio", __name: "mc-radio", props: { modelValue: { type: [String, Number, Boolean] }, value: { type: [String, Number, Boolean] }, disabled: { type: Boolean }, label: {} }, emits: ["update:modelValue", "change"], setup(e2, { expose: a2, emit: l2 }) {
|
|
9
|
+
const o2 = e2, { modelValue: f2, value: k2, disabled: B2, label: x } = d(o2), z = l2, G = u(), M = p("radioGroup", void 0), N = s(() => {
|
|
10
|
+
var _a;
|
|
11
|
+
return ((_a = M == null ? void 0 : M.disabled) == null ? void 0 : _a.value) ?? B2.value;
|
|
12
|
+
}), S = s(() => (M == null ? void 0 : M.value.value) ?? f2.value), I = s(() => S.value === k2.value), R = s({ get: () => M ? M.value.value : f2.value, set(e3) {
|
|
13
|
+
M ? M.change(e3) : (z("update:modelValue", e3), z("change", e3));
|
|
14
|
+
} });
|
|
15
|
+
return a2({ ref: G }), (e3, a3) => (r(), i("label", { ref_key: "_ref", ref: G, class: t(["mc-radio", { "is-disabled": N.value, "is-checked": I.value }]) }, [c("span", g, [a3[1] || (a3[1] = c("span", { class: "mc-radio__inner" }, null, -1)), v(c("input", { class: "mc-radio__original", type: "radio", value: n(k2), disabled: N.value, "onUpdate:modelValue": a3[0] || (a3[0] = (e4) => R.value = e4) }, null, 8, y), [[_, R.value]])]), c("span", V, [n(x) ? (r(), i("span", h, b(n(x)), 1)) : m(e3.$slots, "default", { key: 1 }, void 0, true)])], 2));
|
|
16
|
+
} }), [["__scopeId", "data-v-dc6efc75"]])), B = a(f);
|
|
17
|
+
export {
|
|
18
|
+
k as M,
|
|
19
|
+
B as a
|
|
20
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { defineComponent as e, ref as l, computed as t, watch as a, provide as o, createElementBlock as s, openBlock as c, normalizeStyle as i, normalizeClass as u, createElementVNode as d, createVNode as n, createCommentVNode as v, createBlock as r, resolveDynamicComponent as p, withDirectives as m, vModelText as h, Transition as f, withCtx as g, renderSlot as _, createTextVNode as y, vShow as w, inject as b, useSlots as k, onMounted as V, onBeforeUnmount as O, h as S, toDisplayString as x, toRefs as C, useAttrs as M, toValue as j } from "vue";
|
|
2
|
+
import { M as I } from "./mc-icon--CImsgxi.js";
|
|
3
|
+
import { u as $ } from "./hooks-c7yYlQyM.js";
|
|
4
|
+
import { i as A, l as N } from "./vendor-CNzO2Q1s.js";
|
|
5
|
+
import { _ as B, w as G } from "./utils-BwgRXuj9.js";
|
|
6
|
+
const D = Symbol("selectContext"), P = Symbol("selectGroupContext"), T = { key: 0, class: "mc-select-selected-content" }, U = { class: "mc-select-input-wrapper" }, q = ["placeholder", "readonly"], z = { class: "mc-select-dropdown-wrapper" }, E = { class: "mc-select-dropdown" }, F = { key: 0, class: "mc-select-no-data" }, H = B(e({ name: "McSelect", inheritAttrs: false, __name: "mc-select", props: { modelValue: { default: "" }, placeholder: { default: "Please select" }, disabled: { type: Boolean }, type: { default: "single" }, width: {}, height: {}, search: { type: Boolean } }, emits: ["update:modelValue", "change"], setup(e2, { emit: b2 }) {
|
|
7
|
+
const k2 = e2, V2 = b2, O2 = l([]), S2 = t(() => A(P2.value) ? O2.value : O2.value.filter((e3) => N(e3.label ?? e3.value).includes(N(P2.value)))), x2 = t(() => 0 === S2.value.length), C2 = l(false), M2 = () => {
|
|
8
|
+
C2.value = !C2.value;
|
|
9
|
+
}, j2 = l([k2.modelValue]);
|
|
10
|
+
a(() => k2.modelValue, () => {
|
|
11
|
+
j2.value = [k2.modelValue];
|
|
12
|
+
});
|
|
13
|
+
const B2 = t(() => O2.value.find((e3) => e3.value === j2.value[0])), G2 = t(() => B2.value ? "" : k2.placeholder), P2 = l(""), H2 = () => {
|
|
14
|
+
C2.value = true;
|
|
15
|
+
}, J2 = t(() => ({ width: k2.width ?? void 0, height: k2.height ?? void 0 })), K2 = l();
|
|
16
|
+
return $(K2, () => {
|
|
17
|
+
C2.value = false;
|
|
18
|
+
}), o(D, { filterOptions: S2, selectValues: j2, handleSelect: (e3) => {
|
|
19
|
+
C2.value = false, P2.value = "", V2("update:modelValue", e3.value), V2("change", e3.value);
|
|
20
|
+
}, removeOption: (e3) => {
|
|
21
|
+
O2.value = O2.value.filter((l2) => l2.value !== e3.value);
|
|
22
|
+
}, addOption: (e3) => {
|
|
23
|
+
O2.value.push(e3);
|
|
24
|
+
} }), (e3, l2) => (c(), s("div", { class: u(["mc-select", [C2.value ? "mc-select-expand" : "mc-select-collapse"]]), ref_key: "_ref", ref: K2, style: i(J2.value) }, [d("div", { class: "mc-select-trigger", onClick: M2 }, [B2.value && !P2.value ? (c(), s("div", T, [(c(), r(p(B2.value._vnode), { key: B2.value.value }))])) : v("", true), d("div", U, [m(d("input", { class: u(["mc-select-input", { "mc-select-input-readonly": !e3.search }]), type: "text", placeholder: G2.value, "onUpdate:modelValue": l2[0] || (l2[0] = (e4) => P2.value = e4), onInput: H2, readonly: !e3.search }, null, 42, q), [[h, P2.value]])]), d("div", { class: u(["mc-select-icon-wrapper", { "mc-select-icon-wrapper-expand": C2.value }]) }, [n(I, { name: "Down-Chevron" })], 2)]), n(f, { name: "mc-select-dropdown-transition" }, { default: g(() => [m(d("div", z, [d("div", E, [_(e3.$slots, "default", {}, void 0, true), x2.value ? (c(), s("div", F, [_(e3.$slots, "empty", {}, () => [l2[1] || (l2[1] = y("No data"))], true)])) : v("", true)])], 512), [[w, C2.value]])]), _: 3 })], 6));
|
|
25
|
+
} }), [["__scopeId", "data-v-e0082924"]]), J = { class: "mc-select-option-content" }, K = { class: "mc-select-option-icon" }, L = B(e({ name: "McSelectOption", inheritAttrs: false, __name: "mc-select-option", props: { value: {}, label: {}, width: {}, height: {}, _group: {}, _vnode: {} }, setup(e2, { expose: a2 }) {
|
|
26
|
+
const o2 = l(), n2 = e2, p2 = b(D, void 0), m2 = b(P, void 0), h2 = t(() => p2 == null ? void 0 : p2.selectValues.value.includes(n2.value)), f2 = t(() => !!(p2 == null ? void 0 : p2.filterOptions.value.some((e3) => e3.value === n2.value))), g2 = k(), w2 = () => {
|
|
27
|
+
p2 == null ? void 0 : p2.handleSelect(C2(n2));
|
|
28
|
+
};
|
|
29
|
+
V(() => {
|
|
30
|
+
p2 == null ? void 0 : p2.addOption(C2(n2));
|
|
31
|
+
}), O(() => {
|
|
32
|
+
p2 == null ? void 0 : p2.removeOption(C2(n2));
|
|
33
|
+
});
|
|
34
|
+
const C2 = (e3) => {
|
|
35
|
+
var _a;
|
|
36
|
+
return { ...e3, _group: m2 == null ? void 0 : m2.groupName, _vnode: S("div", { class: "mc-select-option-content" }, (_a = g2.default) == null ? void 0 : _a.call(g2, {})) };
|
|
37
|
+
}, M2 = t(() => ({ width: n2.width ?? void 0, height: n2.height ?? void 0 }));
|
|
38
|
+
return a2({ isShow: f2.value, ref: o2 }), (e3, l2) => f2.value ? (c(), s("div", { key: 0, class: u(["mc-select-dropdown-item mc-select-option", { "mc-select-option-icon-active": h2.value }]), onClick: w2, ref_key: "_ref", ref: o2, style: i(M2.value) }, [d("div", J, [_(e3.$slots, "default", {}, () => [y(x(e3.label), 1)], true)]), d("div", K, [h2.value ? (c(), r(I, { key: 0, name: "Tick" })) : v("", true)])], 6)) : v("", true);
|
|
39
|
+
} }), [["__scopeId", "data-v-7ead0f93"]]), Q = { class: "mc-select-group" }, R = { class: "mc-select-group-content" }, W = B(e({ name: "McSelectGroup", inheritAttrs: false, __name: "mc-select-group", props: { label: {}, width: {}, height: {} }, setup(e2) {
|
|
40
|
+
const l2 = e2, a2 = b(D, void 0);
|
|
41
|
+
o(P, { groupName: l2.label });
|
|
42
|
+
const u2 = t(() => a2 == null ? void 0 : a2.filterOptions.value.some((e3) => e3._group === l2.label)), n2 = C(M()), v2 = t(() => {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
return { ...(_b = (_a = j(n2)) == null ? void 0 : _a.style) == null ? void 0 : _b.value, width: l2.width ?? void 0, height: l2.height ?? void 0 };
|
|
45
|
+
});
|
|
46
|
+
return (e3, l3) => m((c(), s("div", Q, [d("div", { class: "mc-select-group-label", style: i(v2.value) }, x(e3.label), 5), d("div", R, [_(e3.$slots, "default", {}, void 0, true)])], 512)), [[w, u2.value]]);
|
|
47
|
+
} }), [["__scopeId", "data-v-2c1cb992"]]), X = G(H), Y = G(L), Z = G(W);
|
|
48
|
+
export {
|
|
49
|
+
X as M,
|
|
50
|
+
Z as a,
|
|
51
|
+
Y as b
|
|
52
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { defineComponent as e, ref as l, createElementBlock as a, openBlock as s, createElementVNode as t, normalizeClass as d, createCommentVNode as o, normalizeStyle as c, toDisplayString as i, renderSlot as m, createTextVNode as u } from "vue";
|
|
2
|
+
import { _ as p, w as n } from "./utils-BwgRXuj9.js";
|
|
3
|
+
const f = { class: "mc-switch-wrapper" }, r = ["disabled", "value"], b = { key: 0, class: "mc-switch-text" }, h = { key: 0, class: "mc-switch-label" }, w = n(p(e({ name: "McSwitch", __name: "mc-switch", props: { modelValue: { type: Boolean, default: false }, width: {}, label: {}, disabled: { type: Boolean, default: false }, onText: {}, offText: {} }, emits: ["update:modelValue"], setup(e2, { expose: p2, emit: n2 }) {
|
|
4
|
+
const w2 = e2, x = n2, y = l(), V = () => {
|
|
5
|
+
w2.disabled || x("update:modelValue", !w2.modelValue);
|
|
6
|
+
};
|
|
7
|
+
return p2({ ref: y }), (e3, l2) => (s(), a("div", f, [t("label", { ref_key: "_ref", ref: y, class: d(["mc-switch", { "is-active": e3.modelValue, "is-disabled": e3.disabled }]) }, [t("input", { type: "checkbox", class: "mc-switch-input", disabled: e3.disabled, value: e3.modelValue, onChange: V }, null, 40, r), t("span", { class: "mc-switch-core", style: c({ width: e3.width }) }, [e3.onText || e3.offText ? (s(), a("span", b, i(e3.modelValue ? e3.onText : e3.offText), 1)) : o("", true)], 4), e3.$slots.default || e3.label ? (s(), a("span", h, [m(e3.$slots, "default", {}, () => [u(i(e3.label), 1)], true)])) : o("", true)], 2)]));
|
|
8
|
+
} }), [["__scopeId", "data-v-04a4d333"]]));
|
|
9
|
+
export {
|
|
10
|
+
w as M
|
|
11
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { _ as t, w as e } from "./utils-BwgRXuj9.js";
|
|
2
|
+
import { defineComponent as a, toRefs as r, ref as s, computed as o, createBlock as l, openBlock as i, Transition as c, withCtx as u, createElementBlock as n, createCommentVNode as m, normalizeStyle as d, normalizeClass as h, unref as f, renderSlot as p, createVNode as g, withModifiers as v } from "vue";
|
|
3
|
+
import { M as b } from "./mc-icon--CImsgxi.js";
|
|
4
|
+
const y = e(t(a({ name: "McTag", __name: "mc-tag", props: { type: { default: "primary" }, size: { default: "medium" }, disabled: { type: Boolean }, closable: { type: Boolean }, color: {}, radius: { default: "default" }, height: {}, width: {}, icon: {}, selected: { type: Boolean, default: false } }, emits: ["click", "close"], setup(t2, { expose: e2, emit: a2 }) {
|
|
5
|
+
const y2 = t2, M = a2, { disabled: $, height: _, width: k, color: x, radius: W, icon: w, closable: C, selected: B } = r(y2), I = s(), T = s(true), j = s(false), z = o(() => {
|
|
6
|
+
const t3 = {};
|
|
7
|
+
if ((k == null ? void 0 : k.value) && (t3.width = k.value), (_ == null ? void 0 : _.value) && (t3.height = _.value), x == null ? void 0 : x.value) {
|
|
8
|
+
t3["--tag-color"] = x.value, t3["--tag-hover-color"] = ((t4, e4 = 0.7) => {
|
|
9
|
+
var _a;
|
|
10
|
+
if (!t4 || "transparent" === t4) return t4;
|
|
11
|
+
if (t4.startsWith("var(--")) return t4;
|
|
12
|
+
if (t4.startsWith("#")) {
|
|
13
|
+
const a4 = t4.slice(1), r3 = parseInt(a4, 16), s2 = r3 >> 16 & 255, o2 = r3 >> 8 & 255, l2 = 255 & r3;
|
|
14
|
+
return `rgb(${Math.max(0, Math.floor(s2 * e4))}, ${Math.max(0, Math.floor(o2 * e4))}, ${Math.max(0, Math.floor(l2 * e4))})`;
|
|
15
|
+
}
|
|
16
|
+
const a3 = document.createElement("div");
|
|
17
|
+
a3.style.color = t4, document.body.appendChild(a3);
|
|
18
|
+
const r2 = getComputedStyle(a3).color;
|
|
19
|
+
if (document.body.removeChild(a3), r2.startsWith("rgb") || r2.startsWith("rgba")) {
|
|
20
|
+
const t5 = ((_a = r2.match(/\d+/g)) == null ? void 0 : _a.map(Number)) || [0, 0, 0], a4 = Math.max(0, Math.floor(t5[0] * e4)), s2 = Math.max(0, Math.floor(t5[1] * e4)), o2 = Math.max(0, Math.floor(t5[2] * e4));
|
|
21
|
+
return r2.includes("a") ? `rgba(${a4}, ${s2}, ${o2}, ${parseFloat(r2.split(",")[3].trim().replace(")", ""))})` : `rgb(${a4}, ${s2}, ${o2})`;
|
|
22
|
+
}
|
|
23
|
+
return t4;
|
|
24
|
+
})(x.value, 0.7);
|
|
25
|
+
const e3 = N(x.value);
|
|
26
|
+
t3["--tag-text-color"] = e3 ? "white" : "var(--mc-black)";
|
|
27
|
+
}
|
|
28
|
+
return t3;
|
|
29
|
+
}), N = (t3) => {
|
|
30
|
+
var _a;
|
|
31
|
+
if (!t3 || "transparent" === t3) return false;
|
|
32
|
+
if (t3.startsWith("var(--")) return false;
|
|
33
|
+
if (t3.startsWith("#")) {
|
|
34
|
+
const e3 = t3.slice(1), a3 = parseInt(e3, 16);
|
|
35
|
+
return 0.299 * (a3 >> 16 & 255) + 0.587 * (a3 >> 8 & 255) + 0.114 * (255 & a3) > 186;
|
|
36
|
+
}
|
|
37
|
+
if (t3.startsWith("rgb") || t3.startsWith("rgba")) {
|
|
38
|
+
const e3 = ((_a = t3.match(/\d+/g)) == null ? void 0 : _a.map(Number)) || [255, 255, 255];
|
|
39
|
+
return 0.299 * e3[0] + 0.587 * e3[1] + 0.114 * e3[2] > 186;
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
}, E = (t3) => {
|
|
43
|
+
$.value || M("click", t3);
|
|
44
|
+
}, F = async (t3) => {
|
|
45
|
+
$.value || (j.value = true, await new Promise((t4) => setTimeout(t4, 200)), T.value = false, M("close", t3), setTimeout(() => {
|
|
46
|
+
j.value = false;
|
|
47
|
+
}, 500));
|
|
48
|
+
};
|
|
49
|
+
return e2({ ref: I }), (t3, e3) => (i(), l(c, { name: "mc-tag-fade" }, { default: u(() => [T.value ? (i(), n("div", { key: 0, ref_key: "_ref", ref: I, class: h(["mc-tag", `mc-tag--${t3.type}`, `mc-tag--radius-${t3.radius}`, `mc-tag--${t3.size}`, { "is-disabled": f($), "is-selected": f(B), "is-closing": j.value }]), onClick: E, style: d(z.value) }, [f(w) ? (i(), l(b, { key: 0, name: f(w) }, null, 8, ["name"])) : m("", true), p(t3.$slots, "default", {}, void 0, true), g(c, { name: "mc-tag-close" }, { default: u(() => [f(C) ? (i(), l(b, { key: 0, name: "Cross", class: "mc-tag__close", onClick: v(F, ["stop"]) })) : m("", true)]), _: 1 })], 6)) : m("", true)]), _: 3 }));
|
|
50
|
+
} }), [["__scopeId", "data-v-4c1187d3"]]));
|
|
51
|
+
export {
|
|
52
|
+
y as M
|
|
53
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { defineComponent as e, ref as t, onMounted as o, onUnmounted as s, createElementBlock as n, openBlock as i, normalizeClass as l, createElementVNode as a, createCommentVNode as c, createVNode as r, toDisplayString as m, isVNode as d, render as y } from "vue";
|
|
2
|
+
import { _ as p, w as u } from "./utils-BwgRXuj9.js";
|
|
3
|
+
import { M as f } from "./mc-icon--CImsgxi.js";
|
|
4
|
+
const g = { key: 0, class: "mc-toast__icon" }, _ = { class: "mc-toast__title" }, v = { class: "mc-toast__body" }, C = { class: "mc-toast__message" }, h = p(e({ name: "McToast", __name: "mc-toast", props: { type: { default: "primary" }, title: { default: "" }, message: { default: "" }, icon: {}, showClose: { type: Boolean, default: true }, duration: { default: 0 }, position: { default: "top" }, onClose: {} }, emits: ["close"], setup(e2, { expose: d2, emit: y2 }) {
|
|
5
|
+
const p2 = e2, u2 = y2, h2 = t(), b2 = t(true), T2 = t(false);
|
|
6
|
+
let x2 = null;
|
|
7
|
+
const E2 = () => {
|
|
8
|
+
x2 && (clearTimeout(x2), x2 = null), T2.value = true, setTimeout(() => {
|
|
9
|
+
u2("close"), p2.onClose && p2.onClose();
|
|
10
|
+
}, 300);
|
|
11
|
+
};
|
|
12
|
+
return o(() => {
|
|
13
|
+
setTimeout(() => {
|
|
14
|
+
b2.value = false;
|
|
15
|
+
}, 20), p2.duration > 0 && (x2 = setTimeout(() => {
|
|
16
|
+
E2();
|
|
17
|
+
}, p2.duration));
|
|
18
|
+
}), s(() => {
|
|
19
|
+
x2 && (clearTimeout(x2), x2 = null);
|
|
20
|
+
}), d2({ ref: h2, close: E2 }), (e3, t2) => (i(), n("div", { ref_key: "_ref", ref: h2, class: l(["mc-toast", [b2.value ? "mc-toast--entering" : "", T2.value ? "mc-toast--leaving" : ""]]) }, [a("div", { class: l(["mc-toast__header", `mc-toast__header--${e3.type}`]) }, [e3.icon ? (i(), n("div", g, [r(f, { name: e3.icon }, null, 8, ["name"])])) : c("", true), a("div", _, m(e3.title), 1), e3.showClose ? (i(), n("div", { key: 1, class: "mc-toast__close", onClick: E2 }, [r(f, { name: "Cross" })])) : c("", true)], 2), a("div", v, [a("div", C, m(e3.message), 1)])], 2));
|
|
21
|
+
} }), [["__scopeId", "data-v-832f3e6d"]]), b = {};
|
|
22
|
+
let T = null;
|
|
23
|
+
const x = (e2) => {
|
|
24
|
+
var _a;
|
|
25
|
+
let t2 = {};
|
|
26
|
+
t2 = "string" == typeof e2 ? { message: e2 } : d(e2) ? { message: "" } : { ...e2 }, t2.position = t2.position || "top", T || (T = document.createElement("div"), T.className = "mc-toast-overlay", T.style.position = "fixed", T.style.top = "0", T.style.left = "0", T.style.width = "100%", T.style.height = "100%", T.style.backgroundColor = "rgba(0, 0, 0, 0.5)", T.style.zIndex = "9998", T.style.transition = "opacity 0.1s ease", T.style.opacity = "0", document.body.appendChild(T), T.getBoundingClientRect(), T.style.opacity = "1");
|
|
27
|
+
const o2 = ((e3) => {
|
|
28
|
+
if (b[e3]) return b[e3];
|
|
29
|
+
const t3 = document.createElement("div");
|
|
30
|
+
return t3.className = "mc-toast-container", t3.style.position = "fixed", t3.style.left = "50%", t3.style.top = "50%", t3.style.transform = "translate(-50%, -50%)", t3.style.zIndex = "9999", t3.style.display = "flex", t3.style.flexDirection = "column", t3.style.alignItems = "center", document.body.appendChild(t3), b[e3] = t3, t3;
|
|
31
|
+
})(t2.position), s2 = document.createElement("div"), n2 = r(h, { ...t2, onClose: () => {
|
|
32
|
+
o2.childNodes.length <= 1 && T && document.body.contains(T) && (T.style.opacity = "0", setTimeout(() => {
|
|
33
|
+
T && document.body.contains(T) && (document.body.removeChild(T), T = null);
|
|
34
|
+
}, 300)), t2.onClose && t2.onClose(), setTimeout(() => {
|
|
35
|
+
y(null, s2), o2.contains(s2) && o2.removeChild(s2), 0 === o2.childNodes.length && (document.body.contains(o2) && document.body.removeChild(o2), delete b[t2.position]);
|
|
36
|
+
}, 300);
|
|
37
|
+
} });
|
|
38
|
+
y(n2, s2), o2.appendChild(s2);
|
|
39
|
+
const i2 = (_a = n2.component) == null ? void 0 : _a.exposed;
|
|
40
|
+
return { close: () => {
|
|
41
|
+
i2 == null ? void 0 : i2.close();
|
|
42
|
+
} };
|
|
43
|
+
}, E = x, I = (e2) => x("string" == typeof e2 ? { message: e2, type: "primary", title: "Info", icon: "Info" } : { title: "Info", icon: "Info", ...e2, type: "primary" }), k = (e2) => x("string" == typeof e2 ? { message: e2, type: "success", title: "Success", icon: "Tick" } : { title: "Success", icon: "Tick", ...e2, type: "success" }), w = (e2) => x("string" == typeof e2 ? { message: e2, type: "warning", title: "Warning", icon: "Error_02" } : { title: "Warning", icon: "Error_02", ...e2, type: "warning" }), N = (e2) => x("string" == typeof e2 ? { message: e2, type: "error", title: "Error", icon: "Error" } : { title: "Error", icon: "Error", ...e2, type: "error" }), M = u(h);
|
|
44
|
+
export {
|
|
45
|
+
M,
|
|
46
|
+
I as a,
|
|
47
|
+
k as b,
|
|
48
|
+
x as c,
|
|
49
|
+
w as d,
|
|
50
|
+
N as e,
|
|
51
|
+
E as t
|
|
52
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { defineComponent as e, ref as o, computed as t, watch as a, onUnmounted as l, watchEffect as i, createElementBlock as s, openBlock as r, mergeProps as u, toHandlers as p, createElementVNode as n, createVNode as v, renderSlot as c, Transition as m, withCtx as d, createCommentVNode as f, createTextVNode as g, toDisplayString as h } from "vue";
|
|
2
|
+
import { createPopper as _ } from "@popperjs/core";
|
|
3
|
+
import { u as k } from "./hooks-c7yYlQyM.js";
|
|
4
|
+
import { d as b, b as y, i as N } from "./vendor-CNzO2Q1s.js";
|
|
5
|
+
import { _ as T, w as j } from "./utils-BwgRXuj9.js";
|
|
6
|
+
const w = j(T(e({ name: "McTooltip", __name: "mc-tooltip", props: { content: {}, trigger: { default: "hover" }, placement: { default: "bottom" }, disabled: { type: Boolean }, popperOptions: {}, showTimeout: { default: 0 }, hideTimeout: { default: 300 }, transitionName: { default: "fade" } }, emits: ["visible:change", "click:outside"], setup(e2, { expose: T2, emit: j2 }) {
|
|
7
|
+
const w2 = e2, x = j2, M = o({}), O = o({}), $ = o({}), B = o(), I = o(), q = o(), z = o(false), A = (e3) => {
|
|
8
|
+
w2.disabled && (e3 = false), z.value = e3, x("visible:change", e3);
|
|
9
|
+
}, C = t(() => ({ placement: w2.placement, modifiers: [{ name: "offset", options: { offset: [0, 8] } }], ...w2.popperOptions }));
|
|
10
|
+
let D, E, F;
|
|
11
|
+
a(z, (e3) => {
|
|
12
|
+
e3 && I.value && q.value && (D = _(I.value, q.value, C.value));
|
|
13
|
+
}, { flush: "post" }), l(() => {
|
|
14
|
+
N(D) || (D.destroy(), D = void 0);
|
|
15
|
+
});
|
|
16
|
+
const G = t(() => "hover" === w2.trigger ? w2.showTimeout : 0), H = t(() => "hover" === w2.trigger ? w2.hideTimeout : 0);
|
|
17
|
+
i(() => {
|
|
18
|
+
M.value = {}, O.value = {}, $.value = {}, w2.disabled ? K(false) : "click" === w2.trigger ? M.value.click = () => {
|
|
19
|
+
z.value ? K() : J();
|
|
20
|
+
} : "hover" === w2.trigger && (M.value.mouseenter = () => J(), O.value.mouseleave = () => K(), $.value.mouseenter = () => J()), E = b(y(A, null, true), G.value), F = b(y(A, null, false), H.value);
|
|
21
|
+
});
|
|
22
|
+
const J = (e3 = true) => {
|
|
23
|
+
F == null ? void 0 : F.cancel(), e3 ? E == null ? void 0 : E() : A(false);
|
|
24
|
+
}, K = (e3 = true) => {
|
|
25
|
+
E == null ? void 0 : E.cancel(), e3 ? F == null ? void 0 : F() : A(false);
|
|
26
|
+
};
|
|
27
|
+
return k(B, () => {
|
|
28
|
+
x("click:outside"), "hover" !== w2.trigger && z.value && K(false);
|
|
29
|
+
}), T2({ show: () => J(false), hide: () => K(false) }), (e3, o2) => (r(), s("div", u({ class: "mc-tooltip", ref_key: "containerNode", ref: B }, p(O.value, true)), [n("div", u({ class: "mc-tooltip__trigger", ref_key: "triggerNode", ref: I }, p(M.value, true)), [c(e3.$slots, "default", {}, void 0, true)], 16), v(m, { name: e3.transitionName }, { default: d(() => [z.value ? (r(), s("div", u({ key: 0, class: "mc-tooltip__popper", ref_key: "popperNode", ref: q }, p($.value, true)), [c(e3.$slots, "content", {}, () => [g(h(e3.content), 1)], true)], 16)) : f("", true)]), _: 3 }, 8, ["name"])], 16));
|
|
30
|
+
} }), [["__scopeId", "data-v-d3a7e7be"]]));
|
|
31
|
+
export {
|
|
32
|
+
w as M
|
|
33
|
+
};
|