@gits-id/card
Version:
GITS Card Component
119 lines (118 loc) • 2.75 kB
JavaScript
import { defineComponent as C, toRefs as p, computed as n, openBlock as l, createBlock as h, resolveDynamicComponent as g, unref as o, normalizeClass as d, withCtx as m, renderSlot as s, createElementBlock as f, createElementVNode as u, toDisplayString as S, createCommentVNode as c } from "vue";
const w = { class: "card-title" }, $ = C({
__name: "VCard",
props: {
title: {
type: String,
default: ""
},
defaultWrapperClass: {
type: String,
default: ""
},
defaultHeaderClass: {
type: String,
default: "card-header"
},
defaultFooterClass: {
type: String,
default: "card-footer"
},
defaultBodyClass: {
type: String,
default: "card-body"
},
wrapperClass: {
type: String,
default: ""
},
headerClass: {
type: String,
default: ""
},
footerClass: {
type: String,
default: ""
},
bodyClass: {
type: String,
default: ""
},
hideHeader: {
type: Boolean,
default: !1
},
hideFooter: {
type: Boolean,
default: !1
},
bordered: {
type: Boolean,
default: !1
},
flat: {
type: Boolean,
default: !1
},
shadow: {
type: [Boolean, String],
default: !1
},
to: {
type: String,
default: ""
},
color: {
type: String,
default: "default"
}
},
setup(e) {
const a = e, { to: r } = p(a), i = n(() => r.value ? "router-link" : "div"), y = n(() => {
const t = a.flat ? "card--shadow-none" : typeof a.shadow == "string" ? `card--shadow-${a.shadow}` : "card--shadow";
return [
`card card-${a.color}`,
a.defaultWrapperClass,
a.wrapperClass,
t,
{
"card--bordered": a.bordered
}
];
});
return (t, B) => (l(), h(g(o(i)), {
to: o(r),
class: d(o(y))
}, {
default: m(() => [
s(t.$slots, "image"),
e.hideHeader ? c("", !0) : (l(), f("div", {
key: 0,
class: d([e.defaultHeaderClass, e.headerClass])
}, [
s(t.$slots, "header.prepend"),
s(t.$slots, "header", {}, () => [
u("div", w, S(e.title), 1)
]),
s(t.$slots, "header.append")
], 2)),
u("div", {
class: d([e.defaultBodyClass, e.bodyClass])
}, [
s(t.$slots, "default")
], 2),
e.hideFooter ? c("", !0) : (l(), f("div", {
key: 1,
class: d([e.defaultFooterClass, e.footerClass])
}, [
s(t.$slots, "footer")
], 2))
]),
_: 3
}, 8, ["to", "class"]));
}
});
export {
$ as VCard,
$ as default
};