@nextcloud/vue
Version:
Nextcloud vue components
67 lines (66 loc) • 2.57 kB
JavaScript
import '../assets/NcNoteCard-DZSuYX4-.css';
import { defineComponent, computed, createElementBlock, openBlock, normalizeClass, unref, renderSlot, createElementVNode, createVNode, createCommentVNode, toDisplayString } from "vue";
import { g as mdiAlert, h as mdiInformation, i as mdiCheckboxMarkedCircle, j as mdiAlertDecagram } from "./mdi-XFJRiRqJ.mjs";
import { i as isLegacy } from "./legacy-DcjXBL_t.mjs";
import { N as NcIconSvgWrapper } from "./NcIconSvgWrapper-BvLanNaW.mjs";
import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.mjs";
const _hoisted_1 = ["role"];
const _hoisted_2 = {
key: 0,
class: "notecard__heading"
};
const _hoisted_3 = { class: "notecard__text" };
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "NcNoteCard",
props: {
heading: { default: void 0 },
showAlert: { type: Boolean },
text: { default: void 0 },
type: { default: "warning" }
},
setup(__props) {
const props = __props;
const shouldShowAlert = computed(() => props.showAlert || props.type === "error");
const iconPath = computed(() => {
switch (props.type) {
case "error":
return mdiAlertDecagram;
case "success":
return mdiCheckboxMarkedCircle;
case "info":
return mdiInformation;
case "warning":
default:
return mdiAlert;
}
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(["notecard", {
[`notecard--${_ctx.type}`]: _ctx.type,
"notecard--legacy": unref(isLegacy)
}]),
role: shouldShowAlert.value ? "alert" : "note"
}, [
renderSlot(_ctx.$slots, "icon", {}, () => [
createVNode(unref(NcIconSvgWrapper), {
path: iconPath.value,
class: normalizeClass(["notecard__icon", { "notecard__icon--heading": _ctx.heading }]),
inline: ""
}, null, 8, ["path", "class"])
], true),
createElementVNode("div", null, [
_ctx.heading ? (openBlock(), createElementBlock("p", _hoisted_2, toDisplayString(_ctx.heading), 1)) : createCommentVNode("", true),
renderSlot(_ctx.$slots, "default", {}, () => [
createElementVNode("p", _hoisted_3, toDisplayString(_ctx.text), 1)
], true)
])
], 10, _hoisted_1);
};
}
});
const NcNoteCard = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-7e4656f9"]]);
export {
NcNoteCard as N
};
//# sourceMappingURL=NcNoteCard-CVhtNL04.mjs.map