import{r as e,g as s,h as a}from"./p-e42dfa95.js";import{i as t}from"./p-cc0aeb50.js";const i=class{constructor(s){e(this,s)}get el(){return s(this)}label="";icon;collapsed=false;isOpen=false;isHover=false;toggle=()=>{if(this.collapsed)return;this.isOpen=!this.isOpen};handleTitleKeydown=e=>{if(t(e.key)){e.preventDefault();this.toggle()}};handleMouseEnter=()=>{if(!this.collapsed)return;this.isHover=true};handleMouseLeave=()=>{if(!this.collapsed)return;this.isHover=false};handleChildrenClick=()=>{if(!this.collapsed)return;this.isHover=false};render(){const e=this.collapsed?this.isHover:this.isOpen;return a("li",{key:"2158b7ce59919c89c5f86a1218e1f2c16fb7cc11",class:{"hb-sub-menu":true,"hb-sub-menu--open":this.isOpen,"hb-sub-menu--collapsed":this.collapsed},role:"menuitem","aria-haspopup":"menu","aria-expanded":e?"true":"false",onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},a("div",{key:"ed1b49c0417a21673d8eac14dfb15e31db722917",class:"hb-sub-menu__title",role:"button",tabindex:0,"aria-expanded":e?"true":"false",title:this.collapsed?this.label:undefined,onClick:this.toggle,onKeyDown:this.handleTitleKeydown},this.icon&&a("span",{key:"488430d18a0a4c2fd81f38d621988b3a06ef874a",class:"hb-sub-menu__icon"},this.icon),a("span",{key:"ba16d8aaddeba6ec00a9b19ac4069802a1cc503b",class:"hb-sub-menu__label"},this.label),a("span",{key:"cf3b32672f9f36d4ffbe570f7dbad1e2755afe3c",class:{"hb-sub-menu__arrow":true,"hb-sub-menu__arrow--open":e}},"▶")),e&&a("ul",{key:"6f0404f6e5b89ae0c59b47630f8d17620800b46f",class:{"hb-sub-menu__children":true,"hb-sub-menu__children--popover":this.collapsed},role:"menu",onClick:this.handleChildrenClick},a("slot",{key:"795f95cc807e590339faff8745eb6c36c326f9f2"})))}};export{i as hb_sub_menu};
//# sourceMappingURL=p-c922d672.entry.js.map