import{h}from"@stencil/core";export class ScToggles{constructor(){this.accordion=!1,this.collapsible=!0,this.theme="default"}getToggles(){var e,t,l;let o=this.el.shadowRoot.querySelector("slot");if(o)return(null===(l=null===(t=null===(e=null==o?void 0:o.assignedNodes)||void 0===e?void 0:e.call(o))||void 0===t?void 0:t.filter)||void 0===l?void 0:l.call(t,(e=>"SC-TOGGLE"===e.nodeName)))||[]}handleShowChange(e){"SC-TOGGLE"===e.target.tagName&&this.accordion&&this.getToggles().map((t=>t.open=e.target===t))}handleCollapibleChange(){this.getToggles().map((e=>e.collapsible=this.collapsible))}componentDidLoad(){this.handleCollapibleChange();const e=this.getToggles();(null==e?void 0:e.length)&&!e.some((e=>e.open))&&(e[0].open=!0)}render(){const e="container"===this.theme?"sc-card":"div";return h(e,{key:"e3b9dc257461988bd4c21dbc2d39f0f42aaba300",class:{toggles:!0,[`toggles--theme-${this.theme}`]:!0},part:"base","no-padding":!0},h("slot",{key:"0e8c54bca84d3fd0588a498b78cfd60cf3b7052f"}))}static get is(){return"sc-toggles"}static get encapsulation(){return"shadow"}static get originalStyleUrls(){return{$:["sc-toggles.scss"]}}static get styleUrls(){return{$:["sc-toggles.css"]}}static get properties(){return{accordion:{type:"boolean",mutable:!1,complexType:{original:"boolean",resolved:"boolean",references:{}},required:!1,optional:!1,docs:{tags:[],text:"Should this function as an accordion?"},attribute:"accordion",reflect:!1,defaultValue:"false"},collapsible:{type:"boolean",mutable:!1,complexType:{original:"boolean",resolved:"boolean",references:{}},required:!1,optional:!1,docs:{tags:[],text:"Are these collapsible?"},attribute:"collapsible",reflect:!1,defaultValue:"true"},theme:{type:"string",mutable:!1,complexType:{original:"'default' | 'container'",resolved:'"container" | "default"',references:{}},required:!1,optional:!1,docs:{tags:[],text:"Theme for the toggles"},attribute:"theme",reflect:!1,defaultValue:"'default'"}}}static get elementRef(){return"el"}static get watchers(){return[{propName:"collapsible",methodName:"handleCollapibleChange"}]}static get listeners(){return[{name:"scShow",method:"handleShowChange",target:void 0,capture:!1,passive:!1}]}}