// #region Imports
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Themeable } from '../../../../Controls/Behaviors/Themeable';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { CustomElement } from '../../Abstracts/CustomElement';
import { disclosureElementTemplate } from './DisclosureElementTemplate';
import { disclosureElementJoyStyle } from './Themes/DisclosureElement.Joy';
import { disclosureElementMemphisStyle } from './Themes/DisclosureElement.Memphis';
import { disclosureElementCosmopolitanStyle } from './Themes/DisclosureElement.Cosmopolitan';
// #endregion
/**
 * Disclosure - A component that represents a disclosure widget for revealing or hiding additional content.
 *
 * @description This component provides an interface for expanding and collapsing content, making it useful for organizing information in a way that is accessible yet unobtrusive.
 *
 * @name Disclosure
 * @element mosaik-disclosure
 * @category UI Components
 *
 * @slot start - The slot for placing content at the start of the disclosure.
 * @slot summary - The slot for placing summary content that triggers the disclosure.
 * @slot end - The slot for placing content at the end of the disclosure.
 * @slot - The default slot for placing the main content inside the disclosure.
 *
 * @csspart details - The part representing the details content area.
 * @csspart summary - The part representing the summary content area.
 *
 * @public
 *
 * @example
 * ```html
 * <mosaik-disclosure>
 *   <div slot="summary">Summary Content</div>
 *   <div slot="details">Detailed Content that can be expanded or collapsed.</div>
 * </mosaik-disclosure>
 * ```
 */
let DisclosureElement = class DisclosureElement extends Themeable(CustomElement) {
    // #region Fields
    _detailsElement;
    _summary;
    _isExpanded;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._detailsElement = null;
        this._summary = '';
        this._isExpanded = false;
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `{@link is}` property.
     * The `{@link is}` property represents natural name of this element.
     *
     * @public
     * @static
     * @readonly
     */
    static get is() {
        return 'mosaik-disclosure';
    }
    /**
     * Gets or sets the `summary` property.
     *
     * @public
     * @attr
     */
    get summary() {
        return this._summary;
    }
    set summary(value) {
        if (this._summary !== value) {
            this._summary = value;
            this.requestUpdate('summary');
        }
    }
    /**
     * Gets or sets the `isExpanded` property.
     *
     * @public
     * @attr
     */
    get isExpanded() {
        return this._isExpanded;
    }
    set isExpanded(value) {
        if (this._isExpanded !== value) {
            this._isExpanded = value;
            this.requestUpdate('isExpanded');
        }
    }
    // #endregion
    // #region Methods
    /**
     * @public
     * @override
     */
    connectedCallback() {
        super.connectedCallback();
        if (this.isExpanded) {
            this.show();
        }
    }
    /**
     * @public
     * @override
     */
    disconnectedCallback() {
        super.disconnectedCallback();
    }
    /**
     * Show extra content.
     */
    show() {
        if (this._detailsElement) {
            this._detailsElement.open = true;
        }
    }
    /**
     * Hide extra content.
     */
    hide() {
        if (this._detailsElement) {
            this._detailsElement.open = false;
        }
    }
    /**
     * Toggle the current(expanded/collapsed) state.
     */
    toggle() {
        if (this._detailsElement) {
            this._detailsElement.open = !this._detailsElement.open;
        }
    }
    /**
     * Update the aria attr and fire `toggle` event
     */
    onToggle() {
        if (this._detailsElement) {
            this.isExpanded = this._detailsElement.open;
        }
    }
    /**
     * @protected
     * @override
     */
    onApplyTemplate() {
        super.onApplyTemplate();
        this._detailsElement = this.getTemplatePart('details');
    }
};
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], DisclosureElement.prototype, "summary", null);
__decorate([
    Attribute({
        type: Boolean,
        useDefault: true
    }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], DisclosureElement.prototype, "isExpanded", null);
DisclosureElement = __decorate([
    Component({
        selector: 'mosaik-disclosure',
        template: disclosureElementTemplate,
        themes: {
            joy: disclosureElementJoyStyle,
            memphis: disclosureElementMemphisStyle,
            cosmopolitan: disclosureElementCosmopolitanStyle
        },
        imports: []
    }),
    __metadata("design:paramtypes", [])
], DisclosureElement);
export { DisclosureElement };
//# sourceMappingURL=DisclosureElement.js.map