UNPKG

vexip-ui

Version:

A Vue 3 UI library, Highly customizability, full TypeScript, performance pretty good

3 lines (2 loc) 987 B
"use strict";const t=require("vue"),u=require("@vexip-ui/config"),d=require("./symbol.cjs"),v=t.defineComponent({name:"CarouselItem",__name:"carousel-item",setup(f){const e=t.inject(d.CAROUSEL_STATE,null),s=u.useNameHelper("carousel"),n=t.reactive({label:-1,width:0,height:0,offset:0}),l=t.computed(()=>(e==null?void 0:e.isItemActive(n.label))??!1),r=t.computed(()=>({[s.be("item")]:!0,[s.bem("item","active")]:l.value})),a=t.computed(()=>{const{width:i,height:o,offset:c}=n;return{width:i?`${i}px`:void 0,height:o?`${o}px`:void 0,transform:c?`translate${e!=null&&e.vertical?"Y":"X"}(${c}px)`:void 0}});e&&(e.increaseItem(n),t.onBeforeUnmount(()=>{e.decreaseItem(n)}));function m(){e==null||e.handleSelect(n.label)}return(i,o)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(r.value),role:"listitem",style:t.normalizeStyle(a.value),onClick:m},[t.renderSlot(i.$slots,"default",{active:l.value})],6))}});module.exports=v; //# sourceMappingURL=carousel-item.vue2.cjs.map