dk-plus
Version:
91 lines (90 loc) • 2.99 kB
JavaScript
import { useSlots as w, computed as f, reactive as x, toRefs as z } from "vue";
import { sizeChange as g } from "../../_utils/filtration/index.js";
import { getColor as n } from "../public/get-color/index.js";
import { getStyleList as L } from "../public/get-StyleList/index.js";
import "../../_icon/index.js";
const q = (t) => {
const r = w(), h = f(
() => !(r.default && r.default() && r.default()[0].children)
);
let u = [
"type",
"size",
"disabled",
"loading",
"round",
"circle",
"textDecoration",
"shadow",
"ripples",
"diffusion"
];
const b = x({
...z(t)
});
h.value && (r.icon && (u = [...u, "iconSlot"], b.iconSlot = !0), r.afterIcon && (u = [...u, "afterIconSlot"], b.afterIconSlot = !0));
const { classes: C, stylesList: e } = L(b, "button"), y = C([...u], "button"), S = f(() => {
const { bgColor: o, fontColor: l, shadow: i, fontSize: a, diffusionBgColor: c } = t;
let s = {
"--button-color": l,
"--button-hover": l ? n(t.fontColor).getDodge(0.4) : null,
"--button-active": l ? n(t.fontColor).getDeepen(0.4) : null,
"--button-shadow": i,
"--button-font-size": g(a),
"--button-hover-borderColor": o ? n(t.bgColor).getDodge(0.4) : null,
"--button-hover-background": o ? n(t.bgColor).getDodge(0.4) : null,
"--button-background": o || null,
"--button-ripples-BgColor": c || null
};
if (o) {
const d = {
"--button-background": o || null,
"--button-hover": o ? n(t.bgColor).getDeepen(0.4) : null,
"--button-active": o ? n(t.bgColor).getDeepen(0.2) : null
};
s = { ...s, ...d };
}
return s;
}), v = C([...["personalityType", "personalitySize", "disabled"]], "button"), p = f(() => {
const {
personalityBorderColor: o,
personalityBorderHoveColor: l,
personalityBgColor: i,
personalityBgHoveColor: a,
personalityFontColor: c,
personalityFontHoveColor: s,
personalityBoxShadow: d,
personalityBoxShadowHove: m,
personalityReflect: B,
fontSize: D
} = t;
return {
"--border-color": e(o),
"--button-borderColor-top": e(o, 0),
"--button-borderColor-right": e(o, 1),
"--button-borderColor-bottom": e(o, 2),
"--button-borderColor-left": e(o, 3),
"--button-borderColor-top-hover": e(l, 0),
"--button-borderColor-right-hover": e(l, 1),
"--button-borderColor-bottom-hover": e(l, 2),
"--button-borderColor-left-hover": e(l, 3),
"--button-bgColor": i || null,
"--button-bgColor-hover": a || null,
"--button-FontColor": c || null,
"--button-FontColor-hover": s || null,
"--button-box-shadow": d || null,
"--button-box-shadow-hover": m,
"--button-font-size": g(D),
"--button-box-reflect": B || null
};
});
return {
classList: y,
styleList: S,
personaClassList: v,
personalityStylist: p
};
};
export {
q as getButton
};