import{r as e,g as a,h as t}from"./p-e42dfa95.js";import{i as s}from"./p-cc0aeb50.js";const i=class{constructor(a){e(this,a)}get el(){return a(this)}key="";title="";disabled=false;active=false;isOpen=false;componentDidLoad(){this.isOpen=this.active}handleActiveChange(e){this.isOpen=e}toggle=()=>{if(this.disabled)return;this.isOpen=!this.isOpen;this.active=this.isOpen;this.el.dispatchEvent(new CustomEvent("hbCollapseItemToggle",{detail:{key:this.key,active:this.isOpen},bubbles:true,composed:true}))};handleHeaderKeydown=e=>{if(this.disabled)return;if(s(e.key)){e.preventDefault();this.toggle()}};render(){return t("div",{key:"37cf0afe29b3a3b6bb538a8dc962804a71c9dce9",class:{"hb-collapse-item":true,"hb-collapse-item--active":this.isOpen,"hb-collapse-item--disabled":this.disabled}},t("div",{key:"be864927a75dc717aab21745f728adbd149fd3b8",class:"hb-collapse-item__header",role:"button",tabindex:this.disabled?-1:0,"aria-expanded":this.isOpen?"true":"false","aria-disabled":this.disabled?"true":undefined,onClick:this.toggle,onKeyDown:this.handleHeaderKeydown},t("span",{key:"afea7c20f59efc964aeebfb995d0b713ebb28542",class:"hb-collapse-item__title"},this.title),t("span",{key:"1aa30ec50c6105f8a07a2ac30ea8108d19923eb8",class:{"hb-collapse-item__arrow":true,"hb-collapse-item__arrow--open":this.isOpen}},"▶")),t("div",{key:"6e6d66dd8477019c7dc8dbc66fd81646e8c3899a",class:{"hb-collapse-item__wrapper":true,"hb-collapse-item__wrapper--open":this.isOpen}},t("div",{key:"776a67a054ea8fd5b664f2e475843ff2344b41c4",class:"hb-collapse-item__content"},t("slot",{key:"1fc2c8492891d16fef88b83c2f46207a2508a81e"}))))}static get watchers(){return{active:["handleActiveChange"]}}};export{i as hb_collapse_item};
//# sourceMappingURL=p-769960f4.entry.js.map