UNPKG

buefy

Version:

Lightweight UI components for Vue.js (v3) based on Bulma

3 lines (2 loc) 1.46 kB
/*! Buefy v3.0.2 | MIT License | github.com/buefy/buefy */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Collapse={},e.Vue)}(this,(function(e,t){"use strict";const i=["is-top","is-bottom"];var s=t.defineComponent({name:"BCollapse",props:{modelValue:{type:Boolean,default:!0},animation:{type:String,default:"fade"},ariaId:{type:String,default:""},position:{type:String,default:"is-top",validator:e=>i.indexOf(e)>-1}},emits:{close:()=>!0,open:()=>!0,"update:modelValue":e=>!0},data(){return{isOpen:this.modelValue}},watch:{modelValue(e){this.isOpen=e}},methods:{toggle(){this.isOpen=!this.isOpen,this.$emit("update:modelValue",this.isOpen),this.isOpen?this.$emit("open"):this.$emit("close")}},render(){const e=t.h("div",{class:"collapse-trigger",onClick:this.toggle},this.$slots.trigger?this.$slots.trigger({open:this.isOpen}):void 0),i=t.withDirectives(t.h(t.Transition,{name:this.animation},(()=>[t.h("div",{class:"collapse-content",id:this.ariaId},this.$slots)])),[[t.vShow,this.isOpen]]);return t.h("div",{class:"collapse"},"is-top"===this.position?[e,i]:[i,e])}});const o={install(e){((e,t)=>{const i=t.name;if(null==i)throw new Error("Buefy.registerComponent: missing component name");e.component(i,t)})(e,s)}};e.BCollapse=s,e.default=o,Object.defineProperty(e,"__esModule",{value:!0})}));