UNPKG

@nextcloud/vue

Version:
67 lines (66 loc) 2.53 kB
import '../assets/NcNoteCard.css'; import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, unref, renderSlot, createVNode, createElementVNode, toDisplayString, createCommentVNode } from "vue"; import { k as mdiAlert, l as mdiInformation, n as mdiCheckboxMarkedCircle, o as mdiAlertDecagram } from "./mdi.mjs"; import { a as isLegacy } from "./legacy.mjs"; import { N as NcIconSvgWrapper } from "./NcIconSvgWrapper.mjs"; import { _ as _export_sfc } from "./_plugin-vue_export-helper.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--${__props.type}`]: __props.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": __props.heading }]), inline: "" }, null, 8, ["path", "class"]) ], true), createElementVNode("div", null, [ __props.heading ? (openBlock(), createElementBlock("p", _hoisted_2, toDisplayString(__props.heading), 1)) : createCommentVNode("", true), renderSlot(_ctx.$slots, "default", {}, () => [ createElementVNode("p", _hoisted_3, toDisplayString(__props.text), 1) ], true) ]) ], 10, _hoisted_1); }; } }); const NcNoteCard = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6be9fa31"]]); export { NcNoteCard as N }; //# sourceMappingURL=NcNoteCard.mjs.map