@aotearoan/neon
Version:
Neon is a lightweight design library of Vue 3 components with minimal dependencies.
3 lines (2 loc) • 4.15 kB
JavaScript
;const d=require("./NeonTreeMenu.cjs.js"),e=require("vue"),m=require("../../../_virtual/_plugin-vue_export-helper.cjs.js"),c=["id"],k={class:"no-style"},p=["tabindex","onKeydown"],h={class:"no-style neon-tree-menu__items"},_=["onKeydown"];function y(t,i,f,g,C,B){const s=e.resolveComponent("neon-icon"),a=e.resolveComponent("neon-link");return t.modelValue?(e.openBlock(),e.createElementBlock("nav",{key:0,id:t.id,class:e.normalizeClass([[`neon-tree-menu--${t.color}`,t.exactHighlighting?"neon-tree-menu--exact":"neon-tree-menu--active",{"neon-tree-menu--expand-all":t.expandAll}],"neon-tree-menu"])},[e.createElementVNode("ul",k,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.modelValue,n=>{var u;return e.openBlock(),e.createElementBlock("li",{key:n.key,class:e.normalizeClass([{"neon-tree-menu__section--expanded":(n.expanded||t.expandAll)&&n.children&&((u=n.children)==null?void 0:u.length)!==0,"neon-tree-menu__section--disabled":n.disabled},"neon-tree-menu__section"])},[e.createVNode(a,{href:n.href,"no-style":!n.href,target:n.external?"_blank":void 0,class:"neon-tree-menu__section-link","outline-style":"none",tabindex:"-1",onClick:l=>{var o;return!n.disabled&&((((o=n.children)==null?void 0:o.length)||0)>0?t.onSectionClick(n.key):t.emit("click",n.href))}},{default:e.withCtx(()=>[n.icon?(e.openBlock(),e.createBlock(s,{key:0,id:t.id+"_"+n.key,name:n.icon,class:"neon-tree-menu__section-link-icon"},null,8,["id","name"])):e.createCommentVNode("",!0),e.createElementVNode("span",{tabindex:n.disabled?-1:0,class:"neon-tree-menu__section-link-label neon-tree-menu__section-link-label--outline-text",role:"link",onKeydown:[e.withKeys(e.withModifiers(l=>!n.disabled&&t.onSectionClick(n.key),["stop","prevent"]),["space"]),e.withKeys(l=>n.href&&t.click(l),["enter"]),e.withKeys(l=>n.href&&t.click(l),["space"])]},e.toDisplayString(n.label),41,p),n.children&&n.children.length!==0?(e.openBlock(),e.createBlock(s,{key:1,class:"neon-tree-menu__section-link-expansion-icon",name:"chevron-right"})):e.createCommentVNode("",!0)]),_:2},1032,["href","no-style","target","onClick"]),e.createElementVNode("ul",h,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.children,l=>(e.openBlock(),e.createElementBlock("li",{key:l.key,class:"neon-tree-menu__item"},[e.createVNode(a,{href:l.href,"no-style":!0,target:l.external?"_blank":void 0,class:"neon-tree-menu__item-link","outline-style":"none",tabindex:"-1",onClick:o=>{var r;return(((r=l.subMenu)==null?void 0:r.length)||0)>0?t.onItemClick(l.key):t.emit("click",l.href)}},{default:e.withCtx(()=>[e.createElementVNode("span",{class:"neon-tree-menu__item-link-label neon-tree-menu__item-link-label--outline-text",role:"link",tabindex:"0",onKeydown:[i[0]||(i[0]=e.withKeys(o=>t.click(o),["enter"])),e.withKeys(e.withModifiers(o=>t.onItemClick(l.key),["prevent"]),["space"])]},e.toDisplayString(l.label),41,_)]),_:2},1032,["href","target","onClick"]),l.subMenu&&l.subMenu.length>0?(e.openBlock(),e.createElementBlock("ul",{key:0,class:e.normalizeClass([{"neon-tree-menu__sub-menu--expanded":(t.expandAll||l.expanded)&&l.subMenu&&l.subMenu.length!==0},"no-style neon-tree-menu__sub-menu"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.subMenu,o=>(e.openBlock(),e.createElementBlock("li",{key:o.href,class:"neon-tree-menu__sub-menu-item"},[e.createVNode(a,{href:o.href,class:"neon-link--no-style neon-tree-menu__sub-menu-item-link","no-style":"","outline-style":"none",tabindex:"-1",onClick:r=>t.emit("click",o.href)},{default:e.withCtx(()=>[e.createElementVNode("span",{class:"neon-tree-menu__sub-menu-item-link-label neon-tree-menu__sub-menu-item-link-label--outline-text",role:"link",tabindex:"0",onKeydown:[i[1]||(i[1]=e.withKeys(e.withModifiers(r=>t.click(r),["prevent"]),["space"])),i[2]||(i[2]=e.withKeys(e.withModifiers(r=>t.click(r),["prevent"]),["enter"]))]},e.toDisplayString(o.label),33)]),_:2},1032,["href","onClick"])]))),128))],2)):e.createCommentVNode("",!0)]))),128))])],2)}),128))])],10,c)):e.createCommentVNode("",!0)}const b=m(d,[["render",y]]);module.exports=b;
//# sourceMappingURL=NeonTreeMenu.vue.cjs.js.map