UNPKG

@dialpad/dialtone

Version:

Dialpad's Dialtone design system monorepo

3 lines (2 loc) 1.87 kB
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),i=require("../../_plugin-vue_export-helper-BRilXfQE.cjs"),l={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 o(e,u,a,f,n,r){return t.openBlock(),t.createBlock(t.Transition,t.mergeProps({appear:a.appear,"enter-active-class":"d-collapsible__enter-active","leave-active-class":"d-collapsible__leave-active"},e.$attrs,{css:r.isCSSEnabled,onBeforeEnter:r.beforeEnter,onEnter:r.enter,onAfterEnter:r.afterEnter,onBeforeLeave:r.beforeLeave,onLeave:r.leave,onAfterLeave:r.afterLeave}),{default:t.withCtx(()=>[t.withDirectives((t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.elementType),t.normalizeProps(t.guardReactiveProps(e.$attrs)),{default:t.withCtx(()=>[n.initialized?t.renderSlot(e.$slots,"default",{key:0}):t.createCommentVNode("",!0)]),_:3},16)),[[t.vShow,a.show]])]),_:3},16,["appear","css","onBeforeEnter","onEnter","onAfterEnter","onBeforeLeave","onLeave","onAfterLeave"])}const s=i._(l,[["render",o]]);exports.default=s; //# sourceMappingURL=collapsible-lazy-show.cjs.map