@dialpad/dialtone
Version:
Dialpad's Dialtone design system monorepo
64 lines (63 loc) • 1.86 kB
JavaScript
import { DtIconInfo, DtIconCheckCircle, DtIconAlertTriangle, DtIconAlertCircle, DtIconBell } from "@dialpad/dialtone-icons/vue3";
import { NOTICE_KINDS } from "./notice_constants.js";
import { hasSlotContent } from "../../common/utils.js";
import { openBlock, createElementBlock, renderSlot, createBlock, resolveDynamicComponent, createCommentVNode } from "vue";
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
const kindToIcon = /* @__PURE__ */ new Map([
["info", DtIconInfo],
["success", DtIconCheckCircle],
["warning", DtIconAlertTriangle],
["error", DtIconAlertCircle],
["base", DtIconBell]
]);
const _sfc_main = {
compatConfig: { MODE: 3 },
name: "DtNoticeIcon",
components: {
DtIconInfo,
DtIconCheckCircle,
DtIconAlertTriangle,
DtIconAlertCircle,
DtIconBell
},
props: {
/**
* Kind of icon
* @values base, error, info, success, warning
*/
kind: {
type: String,
default: "base",
validate(kind) {
return NOTICE_KINDS.includes(kind);
}
}
},
data() {
return {
hasSlotContent
};
},
computed: {
defaultIcon() {
return kindToIcon.get(this.kind);
}
}
};
const _hoisted_1 = {
key: 0,
"aria-hidden": "true",
class: "d-notice__icon"
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return $options.defaultIcon || $data.hasSlotContent(_ctx.$slots.default) ? (openBlock(), createElementBlock("div", _hoisted_1, [
renderSlot(_ctx.$slots, "default", {}, () => [
(openBlock(), createBlock(resolveDynamicComponent($options.defaultIcon), { size: "400" }))
])
])) : createCommentVNode("", true);
}
const DtNoticeIcon = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
DtNoticeIcon as default
};
//# sourceMappingURL=notice_icon.vue.js.map