UNPKG

@dialpad/dialtone

Version:

Dialpad's Dialtone design system monorepo

2 lines 1.95 kB
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../../chunk-Bmb41Sf3.cjs`);const e=require(`../../_plugin-vue_export-helper-D8jCH6HB.cjs`);let t=require(`vue`);var n={name:`DtCollapsibleLazyShow`,inheritAttrs:!1,props:{show:{type:Boolean,default:null},appear:{type:Boolean,default:!1},elementType:{type:String,default:`div`}},data(){return{initialized:!!this.show}},computed:{isCSSEnabled(){return process.env.NODE_ENV!==`test`}},watch:{show:function(e){!e||this.initialized||(this.initialized=!0)}},methods:{beforeEnter(e){requestAnimationFrame(()=>{e.style.height||(e.style.height=`0px`)})},enter(e){requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.height=`${e.scrollHeight}px`})})},afterEnter(e){e.style.height=null},beforeLeave(e){requestAnimationFrame(()=>{e.style.height||(e.style.height=`${e.offsetHeight}px`)})},leave(e){requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.height=`0px`})})},afterLeave(e){e.style.height=null}}};function r(e,n,r,i,a,o){return(0,t.openBlock)(),(0,t.createBlock)(t.Transition,(0,t.mergeProps)({appear:r.appear,"enter-active-class":`d-collapsible__enter-active`,"leave-active-class":`d-collapsible__leave-active`},e.$attrs,{css:o.isCSSEnabled,onBeforeEnter:o.beforeEnter,onEnter:o.enter,onAfterEnter:o.afterEnter,onBeforeLeave:o.beforeLeave,onLeave:o.leave,onAfterLeave:o.afterLeave}),{default:(0,t.withCtx)(()=>[(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(r.elementType),(0,t.normalizeProps)((0,t.guardReactiveProps)(e.$attrs)),{default:(0,t.withCtx)(()=>[a.initialized?(0,t.renderSlot)(e.$slots,`default`,{key:0}):(0,t.createCommentVNode)(``,!0)]),_:3},16)),[[t.vShow,r.show]])]),_:3},16,[`appear`,`css`,`onBeforeEnter`,`onEnter`,`onAfterEnter`,`onBeforeLeave`,`onLeave`,`onAfterLeave`])}var i=e.t(n,[[`render`,r]]);exports.default=i; //# sourceMappingURL=collapsible-lazy-show.cjs.map