UNPKG

@codeperate/cdp-ui-library

Version:

Codeperate UI Library

1 lines 794 B
import{r as t,h as s,H as i,a as o}from"./p-21e532ba.js";import{d as a}from"./p-c571c098.js";const e=class{constructor(s){t(this,s),this.props={display:!1},this.defaultConfig={classList:{content:"transition-all duration-500 overflow-hidden",expanded:"expanded"},maxHeight:"100vh",toggle:!0}}toggle(){this.props=Object.assign(Object.assign({},this.props),{display:!this.props.display})}componentWillLoad(){this._config=a(this.config,this.defaultConfig)}render(){const{classList:t,maxHeight:o,toggle:a}=this._config,{display:e}=this.props;return s(i,{class:e?t.expanded:""},s("div",{onClick:()=>a?this.toggle():null},s("slot",{name:"accordion"})),s("div",{ref:t=>this.contentEl=t,class:t.content,style:{maxHeight:e?o:"0"}},s("slot",null)))}get rootEl(){return o(this)}};export{e as cdp_accordion}