@vue-interface/dropdown-menu
Version:
A Vue dropdown menu component.
2 lines (1 loc) • 1.61 kB
JavaScript
(function(t,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(t=typeof globalThis<"u"?globalThis:t||self,n(t.DropdownMenu={},t.Vue))})(this,function(t,n){"use strict";function d(o,e){o.props.class=`${o.props.class||""} ${e}`.trim()}function p(o){for(const e of o){e.type===n.Fragment&&p(e.children),e.props=Object.assign({class:void 0},e.props),e.attrs=Object.assign({},e.attrs),e.attrs.on||(e.attrs.on={});const s=e.props.class&&e.props.class.match(/dropdown-item/),r=e.props.class&&e.props.class.match(/dropdown-divider/);typeof e.type=="string"&&e.type.match(/^h\d$/)?d(e,"dropdown-header"):e.type==="hr"&&!r?(e.type="div",d(e,"dropdown-divider")):!s&&!r&&d(e,"dropdown-item")}return o}const a=(o,e)=>n.h("div",{},p(e.slots.default())),l=n.defineComponent({name:"DropdownMenu",components:{DropdownMenuItems:a},props:{align:{type:String,default:"left",validate(o){return["left","right"].indexOf(o.toLowerCase())!==-1}},show:Boolean}}),c=(o,e)=>{const s=o.__vccOpts||o;for(const[r,i]of e)s[r]=i;return s},f=["aria-labelledby"];function u(o,e,s,r,i,h){const w=n.resolveComponent("dropdown-menu-items");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["dropdown-menu",{"dropdown-menu-left":o.align==="left","dropdown-menu-right":o.align==="right",show:o.show}]),"aria-labelledby":o.$attrs.id},[n.createVNode(w,null,{default:n.withCtx(()=>[n.renderSlot(o.$slots,"default")]),_:3})],10,f)}const m=c(l,[["render",u]]);t.DropdownMenu=m,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});