/**
 * @license
 * Copyright 2023 Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import { __decorate } from "tslib";
import { attachShadowTemplate, coerceBoolean, CustomElement, FoundationProperty } from '@tylertech/forge-core';
import { BaseComponent } from '../core/base/base-component';
import { ExpansionPanelAdapter } from './expansion-panel-adapter';
import { EXPANSION_PANEL_CONSTANTS } from './expansion-panel-constants';
import { ExpansionPanelFoundation } from './expansion-panel-foundation';
const template = '<template><div class=\"forge-expansion-panel\" part=\"root\"><div class=\"forge-expansion-panel__header\" part=\"header\"><slot name=\"header\"></slot></div><div class=\"forge-expansion-panel__content\" style=\"height: 0; opacity: 0; visibility: hidden;\" part=\"content\"><slot></slot></div></div></template>';
const styles = '.forge-expansion-panel{display:block;display:var(--forge-expansion-panel-display,block);height:auto;height:var(--forge-expansion-panel-height,auto)}.forge-expansion-panel__header{outline:0}.forge-expansion-panel__header:hover{cursor:pointer}.forge-expansion-panel__header forge-open-icon{margin-left:auto}.forge-expansion-panel__content{overflow:hidden;overflow:var(--forge-expansion-panel-content-overflow,hidden);max-height:none;max-height:var(--forge-expansion-panel-content-max-height,none)}.forge-expansion-panel__content::-webkit-scrollbar{width:16px;width:var(--forge-scrollbar-width,16px);height:16px;height:var(--forge-scrollbar-height,16px)}.forge-expansion-panel__content::-webkit-scrollbar-corner{background-color:#f0f0f0;background-color:var(--forge-theme-scrollbar-track,#f0f0f0)}.forge-expansion-panel__content::-webkit-scrollbar-track{background-color:#f0f0f0;background-color:var(--forge-theme-scrollbar-track,#f0f0f0)}.forge-expansion-panel__content::-webkit-scrollbar-track:hover{background-color:#ececec;background-color:var(--forge-theme-scrollbar-track-hover,#ececec)}.forge-expansion-panel__content::-webkit-scrollbar-thumb{background-color:#bdbdbd;background-color:var(--forge-theme-scrollbar-thumb,#bdbdbd);height:32px;height:var(--forge-scrollbar-min-height,32px);width:32px;width:var(--forge-scrollbar-min-width,32px);border-radius:10px;border-radius:var(--forge-scrollbar-border-radius,10px);border-width:3px;border-width:var(--forge-scrollbar-border-width,3px);border-style:solid;border-color:transparent;background-clip:content-box}.forge-expansion-panel__content::-webkit-scrollbar-thumb:hover{background-color:#9e9e9e;background-color:var(--forge-theme-scrollbar-thumb-hover,#9e9e9e)}:host{display:block}:host([hidden]){display:none}';
/**
 * A web component that encapsulates the functionality of expanding/collapsing content when clicked.
 *
 * @tag forge-expansion-panel
 */
let ExpansionPanelComponent = class ExpansionPanelComponent extends BaseComponent {
    constructor() {
        super();
        attachShadowTemplate(this, template, styles);
        this._foundation = new ExpansionPanelFoundation(new ExpansionPanelAdapter(this));
    }
    static get observedAttributes() {
        return [
            EXPANSION_PANEL_CONSTANTS.attributes.OPEN,
            EXPANSION_PANEL_CONSTANTS.attributes.ORIENTATION,
            EXPANSION_PANEL_CONSTANTS.attributes.USE_ANIMATIONS
        ];
    }
    initializedCallback() {
        this._foundation.initialize();
    }
    connectedCallback() {
        this._foundation.connect();
    }
    attributeChangedCallback(name, oldValue, newValue) {
        switch (name) {
            case EXPANSION_PANEL_CONSTANTS.attributes.OPEN:
                this.open = coerceBoolean(newValue);
                break;
            case EXPANSION_PANEL_CONSTANTS.attributes.ORIENTATION:
                this.orientation = newValue;
                break;
            case EXPANSION_PANEL_CONSTANTS.attributes.USE_ANIMATIONS:
                this.useAnimations = coerceBoolean(newValue);
                break;
        }
    }
    disconnectedCallback() {
        this._foundation.disconnect();
    }
    /** Toggles the collapsed state. */
    toggle() {
        this.open = !this.open;
    }
    /** Forces the expansion panel to expand/collapse without transition animations. */
    setOpenImmediate(open) {
        this._foundation.setOpenImmediate(open);
    }
};
__decorate([
    FoundationProperty()
], ExpansionPanelComponent.prototype, "open", void 0);
__decorate([
    FoundationProperty()
], ExpansionPanelComponent.prototype, "openCallback", void 0);
__decorate([
    FoundationProperty()
], ExpansionPanelComponent.prototype, "closeCallback", void 0);
__decorate([
    FoundationProperty()
], ExpansionPanelComponent.prototype, "orientation", void 0);
__decorate([
    FoundationProperty()
], ExpansionPanelComponent.prototype, "useAnimations", void 0);
ExpansionPanelComponent = __decorate([
    CustomElement({
        name: EXPANSION_PANEL_CONSTANTS.elementName
    })
], ExpansionPanelComponent);
export { ExpansionPanelComponent };
