UNPKG

buefy

Version:

Lightweight UI components for Vue.js based on Bulma

3 lines (2 loc) 4.37 kB
/*! Buefy v0.8.2 | MIT License | github.com/buefy/buefy */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).Navbar={})}(this,function(e){"use strict";function t(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var i=function(e,t,i,n,s,o,a,r,d,c){"boolean"!=typeof a&&(d=r,r=a,a=!1);var l,f="function"==typeof i?i.options:i;if(e&&e.render&&(f.render=e.render,f.staticRenderFns=e.staticRenderFns,f._compiled=!0,s&&(f.functional=!0)),n&&(f._scopeId=n),o?(l=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,d(e)),e&&e._registeredComponents&&e._registeredComponents.add(o)},f._ssrRegister=l):t&&(l=a?function(){t.call(this,c(this.$root.$options.shadowRoot))}:function(e){t.call(this,r(e))}),l)if(f.functional){var u=f.render;f.render=function(e,t){return l.call(t),u(e,t)}}else{var v=f.beforeCreate;f.beforeCreate=v?[].concat(v,l):[l]}return i};var n=i({render:function(){var e=this.$createElement,t=this._self._c||e;return t("a",{staticClass:"navbar-burger burger",class:{"is-active":this.isOpened},attrs:{role:"button","aria-label":"menu","aria-expanded":this.isOpened}},[t("span",{attrs:{"aria-hidden":"true"}}),this._v(" "),t("span",{attrs:{"aria-hidden":"true"}}),this._v(" "),t("span",{attrs:{"aria-hidden":"true"}})])},staticRenderFns:[]},void 0,{name:"NavbarBurger",props:{isOpened:{type:Boolean,default:!1}}},void 0,!1,void 0,void 0,void 0);var s=i({render:function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("nav",{staticClass:"navbar",class:e.computedClasses,attrs:{role:"navigation","aria-label":"main navigation"}},[i("div",{staticClass:"navbar-brand"},[e._t("brand"),e._v(" "),e._t("burger",[i("navbar-burger",{attrs:{"is-opened":e.isOpened},nativeOn:{click:function(t){e.toggleActive(t)}}})],null,{isOpened:e.isOpened,toggleActive:e.toggleActive})],2),e._v(" "),i("div",{staticClass:"navbar-menu",class:{"is-active":e.isOpened}},[i("div",{staticClass:"navbar-start"},[e._t("start")],2),e._v(" "),i("div",{staticClass:"navbar-end"},[e._t("end")],2)])])},staticRenderFns:[]},void 0,{name:"BNavbar",components:{NavbarBurger:n},props:{type:[String,Object],transparent:{type:Boolean,default:!1},fixedTop:{type:Boolean,default:!1},fixedBottom:{type:Boolean,default:!1},isActive:{type:Boolean,default:!1}},data:function(){return{internalIsActive:this.isActive}},computed:{isOpened:function(){return this.internalIsActive},computedClasses:function(){return[this.type,t({},"is-fixed-top",this.fixedTop),t({},"is-fixed-bottom",this.fixedBottom)]}},watch:{isActive:{handler:function(e){this.internalIsActive=e},immediate:!0},fixedTop:{handler:function(e){if(this.checkIfFixedPropertiesAreColliding(),e)return this.setBodyClass("is-fixed-top");this.removeBodyClass("is-fixed-top")},immediate:!0},fixedBottom:{handler:function(e){if(this.checkIfFixedPropertiesAreColliding(),e)return this.setBodyClass("is-fixed-bottom");this.removeBodyClass("is-fixed-bottom")},immediate:!0}},methods:{toggleActive:function(){this.internalIsActive=!this.internalIsActive,this.$emit("update:isActive",this.internalIsActive)},setBodyClass:function(e){"undefined"!=typeof window&&document.body.classList.add(e)},removeBodyClass:function(e){"undefined"!=typeof window&&document.body.classList.remove(e)},checkIfFixedPropertiesAreColliding:function(){if(this.fixedTop&&this.fixedBottom)throw new Error("You should choose if the BNavbar is fixed bottom or fixed top, but not both")}},beforeDestroy:function(){this.removeBodyClass("is-fixed-bottom"),this.removeBodyClass("is-fixed-top")}},void 0,!1,void 0,void 0,void 0);var o,a=i({render:function(){var e=this.$createElement;return(this._self._c||e)(this.tag,this._b({tag:"component",staticClass:"navbar-item"},"component",this.$attrs,!1),[this._t("default")],2)},staticRenderFns:[]},void 0,{name:"BNavbarItem",props:{tag:{type:String,default:"a"}}},void 0,!1,void 0,void 0,void 0),r=function(e,t){e.component(t.name,t)},d={install:function(e){r(e,s),r(e,a)}};o=d,"undefined"!=typeof window&&window.Vue&&window.Vue.use(o),e.Navbar=s,e.NavbarItem=a,e.default=d,Object.defineProperty(e,"__esModule",{value:!0})});