text: class BRList{constructor(e,t){this.name=e,this.component=t,this.collapsible="br-list-collapsible"===this.name,this.checkable="br-list-checkable"===this.name,this.unique=t.hasAttribute("unique"),this.horizontal=t.hasAttribute("horizontal"),this.cols=this.horizontal?t.querySelectorAll(".col"):[],this.itens=t.querySelectorAll(":scope > .item"),0===this.itens.length&&(this.itens=t.querySelectorAll("div > .item")),this._setBehavior()}_setBehavior(){if(this.collapsible&&(this._closeAllItens(),this.itens.forEach(e=>{e.addEventListener("click",t=>{this._toggle(t,e)})})),this.checkable&&this.itens.forEach(e=>{this._setSelected(e),e.hasAttribute("disabled")||e.querySelector(".br-checkbox > input").addEventListener("click",t=>{"checkbox"===t.target.getAttribute("type")&&this._check(t,e)})}),this.cols.length>0){const e=this.cols.length,t=e>6&&e%2==1?e+1:e,s=100/(t/Math.ceil(t/6));this.cols.forEach(e=>{e.style.flexBasis=s+"%"})}}_toggle(e,t){t.hasAttribute("active")||this.unique&&this._closeAllItens(),t.toggleAttribute("active");const s=t.querySelector(".fa-angle-down")?t.querySelector(".fa-angle-down"):t.querySelector(".fa-angle-up");s&&(s.classList.toggle("fa-angle-down"),s.classList.toggle("fa-angle-up"))}_closeAllItens(){this.itens.forEach(e=>{e.removeAttribute("active");const t=e.querySelector(".fa-angle-down")?e.querySelector(".fa-angle-down"):e.querySelector(".fa-angle-up");t&&(t.classList.add("fa-angle-down"),t.classList.remove("fa-angle-up"))})}_check(e,t){t.classList.toggle("selected"),this._setSelected(t)}_setSelected(e){const t=e.querySelector(".br-checkbox"),s=t.querySelector("input"),l=e.classList.contains("selected");t&&(l?(t.classList.add("is-inverted"),s.setAttribute("checked",""),s.checked=!0):(t.classList.remove("is-inverted"),s.removeAttribute("checked"),s.checked=!1))}}const listList=[];for(const e of window.document.querySelectorAll(".br-list[collapsible]"))listList.push(new BRList("br-list-collapsible",e));for(const e of window.document.querySelectorAll(".br-list[checkable]"))listList.push(new BRList("br-list-checkable",e));export default BRList;
  //# sourceMappingURL=list.js.map