// #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 { disclosureElementCosmopolitanStyle } from './Themes/DisclosureElement.Cosmopolitan';
import { disclosureElementJoyStyle } from './Themes/DisclosureElement.Joy';
import { disclosureElementMemphisStyle } from './Themes/DisclosureElement.Memphis';
// #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 - The default slot for placing the main content inside the disclosure.
 * @slot end - The slot for placing content at the end of the disclosure.
 * @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.
 *
 * @csspart details - The part representing the details content area.
 * @csspart summary - The part representing the summary content area.
 *
 * @cssprop {String} --disclosure-font-family - The font family CSS custom property.
 * @cssprop {String} --disclosure-font-letter-spacing - The font letter spacing CSS custom property.
 * @cssprop {String} --disclosure-font-line-height - The font line height CSS custom property.
 * @cssprop {String} --disclosure-font-size - The font size CSS custom property.
 * @cssprop {String} --disclosure-font-text-decoration - The font text decoration CSS custom property.
 * @cssprop {String} --disclosure-font-text-transform - The font text transform CSS custom property.
 * @cssprop {String} --disclosure-font-weight - The font weight CSS custom property.
 * @cssprop {String} --disclosure-gap - The gap CSS custom property.
 * @cssprop {String} --disclosure-padding-bottom - The padding bottom CSS custom property.
 * @cssprop {String} --disclosure-padding-left - The padding left CSS custom property.
 * @cssprop {String} --disclosure-padding-right - The padding right CSS custom property.
 * @cssprop {String} --disclosure-padding-top - The padding top CSS custom property.
 * @cssprop {String} --disclosure-shadow - The shadow CSS custom property.
 * @cssprop {String} --disclosure-shadow-blur - The shadow blur CSS custom property.
 * @cssprop {String} --disclosure-shadow-color - The shadow color CSS custom property.
 * @cssprop {String} --disclosure-shadow-offset-x - The shadow offset x CSS custom property.
 * @cssprop {String} --disclosure-shadow-offset-y - The shadow offset y CSS custom property.
 * @cssprop {String} --disclosure-shadow-spread - The shadow spread CSS custom property.
 * @cssprop {String} --disclosure-transition-duration - The transition duration CSS custom property.
 * @cssprop {String} --disclosure-transition-mode - The transition mode CSS custom property.
 * @cssprop {String} --disclosure-transition-property - The transition property CSS custom property.
 * @cssprop {String} --disclosure-translate - The translate CSS custom property.
 *
 * @example
 * Basic usage with summary attribute:
 * ```html
 * <mosaik-disclosure summary="Additional Details">
 *   <mosaik-text text="This content is revealed when the summary is clicked."></mosaik-text>
 * </mosaik-disclosure>
 * ```
 *
 * @example
 * With custom summary slot content:
 * ```html
 * <mosaik-disclosure>
 *   <mosaik-button slot="summary" label="Show More" appearance="plain"></mosaik-button>
 *   <mosaik-text text="Detailed content that is hidden by default."></mosaik-text>
 * </mosaik-disclosure>
 * ```
 *
 * @public
 */
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 `is` property.
     * The `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