@dialpad/dialtone
Version:
Dialpad's Dialtone design system monorepo
3 lines (2 loc) • 2.16 kB
JavaScript
;Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),n=require("../../common/utils/index.cjs"),s=require("./empty-state-constants.cjs"),u=require("../stack/stack.cjs"),T={key:0,class:"d-empty-state__illustration"},I={key:1,class:"d-empty-state__icon"},C={__name:"empty_state",props:{size:{type:String,default:"lg",validator:t=>Object.keys(s.EMPTY_STATE_SIZE_MODIFIERS).includes(t)},headerText:{type:String,required:!0},bodyText:{type:String,default:null}},setup(t){const l=e.useSlots(),o=t,d=e.computed(()=>n.hasSlotContent(l.icon)),c=e.computed(()=>n.hasSlotContent(l.illustration)),r=e.computed(()=>o.size==="sm"),i=e.computed(()=>d.value&&(!c.value||r.value)),m=e.computed(()=>c.value&&!r.value),_=e.computed(()=>s.EMPTY_STATE_SIZE_MODIFIERS[o.size]),S=e.computed(()=>["d-empty-state",_.value]),p=e.computed(()=>s.EMPTY_STATE_CONTENT_SIZE_MODIFIERS[o.size]),y=e.computed(()=>s.EMPTY_STATE_HEADLINE_SIZE_MODIFIERS[o.size]),E=e.computed(()=>s.EMPTY_STATE_BODY_SIZE_MODIFIERS[o.size]);return e.onMounted(()=>{!o.bodyText&&!n.hasSlotContent(l.body)&&console.error("DtEmptyState: You should provide either bodyText or content on body slot.")}),(a,h)=>(e.openBlock(),e.createBlock(e.unref(u.default),{class:e.normalizeClass(S.value)},{default:e.withCtx(()=>[m.value?(e.openBlock(),e.createElementBlock("span",T,[e.renderSlot(a.$slots,"illustration")])):e.createCommentVNode("",!0),i.value?(e.openBlock(),e.createElementBlock("span",I,[e.renderSlot(a.$slots,"icon",{iconSize:"800"})])):e.createCommentVNode("",!0),e.createVNode(e.unref(u.default),{gap:"450",class:e.normalizeClass(["d-empty-state__content",p.value])},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["d-empty-state__header-text",y.value])},e.toDisplayString(t.headerText),3),t.bodyText?(e.openBlock(),e.createElementBlock("p",{key:0,class:e.normalizeClass(["d-empty-state__body-text",E.value])},e.toDisplayString(t.bodyText),3)):e.createCommentVNode("",!0)]),_:1},8,["class"]),e.renderSlot(a.$slots,"body")]),_:3},8,["class"]))}};exports.default=C;
//# sourceMappingURL=empty-state.cjs.map