import{__decorate as e}from"../../_virtual/_tslib.js";import'./../../external/@lit/reactive-element/reactive-element.js';import{html as t}from'./../../external/lit-html/lit-html.js';import{LitElement as s}from'./../../external/lit-element/lit-element.js';import{customElement as o}from'./../../external/@lit/reactive-element/decorators/custom-element.js';import{property as l}from'./../../external/@lit/reactive-element/decorators/property.js';import{state as a}from'./../../external/@lit/reactive-element/decorators/state.js';import{queryAssignedElements as i}from'./../../external/@lit/reactive-element/decorators/query-assigned-elements.js';import r from"./accordion.scss.js";let d=class extends s{constructor(){super(...arguments),this.showNumbers=!1,this.startNumber=1,this.filledHeaders=!1,this.compact=!1,this.expandLabel="Expand all items",this.collapseLabel="Collapse all items",this._allOpenState=!1}_handleSlotChange(){this._updateChildren()}willUpdate(e){(e.has("filledHeaders")||e.has("compact")||e.has("startNumber")||e.has("showNumbers"))&&this._updateChildren()}_updateChildren(){this._accordionItems.forEach(((e,t)=>{e.setFilledHeader(this.filledHeaders),e.setCompact(this.compact),e.setIndex(this.startNumber+t),e.setShowNumbers(this.showNumbers)}))}_openAllItems(){this._accordionItems.map((e=>{e.open()}))}_closeAllItems(){this._accordionItems.map((e=>{e.close()}))}_toggleExpandAll(){this._allOpenState?(this._closeAllItems(),this._allOpenState=!1):(this._openAllItems(),this._allOpenState=!0)}render(){let e="";return this.filledHeaders&&(e+=" filled-headers"),t`
      <div class="kd-accordion">
        <div class="toggle-container">
          <a href="javascript:void(0)" @click="${this._toggleExpandAll}">
            ${this._allOpenState?this.collapseLabel:this.expandLabel}
          </a>
        </div>

        <div class="accordion-item-container${e}">
          <slot @slotchange="${this._handleSlotChange}"></slot>
        </div>
      </div>
    `}};d.styles=[r],e([l({type:Boolean})],d.prototype,"showNumbers",void 0),e([l({type:Number})],d.prototype,"startNumber",void 0),e([l({type:Boolean})],d.prototype,"filledHeaders",void 0),e([l({type:Boolean})],d.prototype,"compact",void 0),e([l({type:String})],d.prototype,"expandLabel",void 0),e([l({type:String})],d.prototype,"collapseLabel",void 0),e([a()],d.prototype,"_allOpenState",void 0),e([i({selector:"kd-accordion-item"})],d.prototype,"_accordionItems",void 0),d=e([o("kd-accordion")],d);export{d as Accordion};
//# sourceMappingURL=accordion.js.map
