// #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 { Animatable } from '../../../Behaviors/Animatable';
import { Appearanceable } from '../../../Behaviors/Appearanceable';
import { Disableable } from '../../../Behaviors/Disableable';
import { Variantable } from '../../../Behaviors/Variantable';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { Property } from '../../../Decorators/PropertyDecorator';
import { CaretPosition } from '../../../Types/CaretPosition';
import { ExpandDirection } from '../../../Types/ExpandDirection';
import { CustomElement } from '../../Abstracts/CustomElement';
import { RippleElement } from '../../Effects/Ripple/RippleElement';
import { StackElement } from '../../Layouts/Stack/StackElement';
import { IconElement } from '../../Media/Icon/IconElement';
import { FocusRingElement } from '../../Primitives/FocusRing/FocusRingElement';
import { TextElement } from '../../Primitives/Text/TextElement';
import { expanderElementTemplate } from './ExpanderElementTemplate';
import { ExpanderHeaderElement } from './ExpanderHeaderElement';
import { ExpanderSubHeaderElement } from './ExpanderSubHeaderElement';
import { expanderElementJoyStyle } from './Themes/ExpanderElement.Joy';
import { expanderElementRetroStyle } from './Themes/ExpanderElement.Retro';
import { expanderElementCosmopolitanStyle } from './Themes/ExpanderElement.Cosmopolitan';
import { Themeable } from '../../../Behaviors/Themeable';
// #endregion
/**
 * Expander - A component that represents an expandable section of content.
 *
 * @name Expander
 * @element mosaik-expander
 * @category UI Components
 *
 * @description This component allows users to expand or collapse a section of content, making it useful for organizing information without overwhelming the user.
 *
 * @example
 * ```html
 * <mosaik-expander>
 *   <div slot="header">Expander Header</div>
 *   <div slot="default">Content inside the expander.</div>
 * </mosaik-expander>
 * ```
 *
 * @fires expanded - Fired when the element is expanded.
 * @fires collapsed - Fired when the element is collapsed.
 * @fires toggled - Fired when the element is toggled.
 *
 * @slot icon - The slot for placing an icon in the expander.
 * @slot header - The slot for placing header content.
 * @slot subHeader - The slot for placing sub-header content.
 * @slot - The default slot for placing main content inside the expander.
 *
 * @csspart root - The root part of the expander.
 * @csspart heading - The part representing the header area.
 * @csspart focusRing - The focus ring part for accessibility.
 * @csspart ripple - The ripple effect part for interaction.
 * @csspart icon - The part representing the icon.
 * @csspart header - The part representing the header text.
 * @csspart subHeader - The part representing the sub-header text.
 * @csspart caret - The part representing the caret or indicator for expansion.
 * @csspart expandable - The part representing the expandable content area.
 *
 * @cssprop {unknown} --expander-font-family - The font-family property for the expander text.
 * @cssprop {unknown} --expander-font-size - The font-size property for the expander text.
 * @cssprop {unknown} --expander-font-line-height - The line-height property for the expander text.
 * @cssprop {unknown} --expander-font-weight - The font-weight property for the expander text.
 * @cssprop {unknown} --expander-font-letter-spacing - The letter-spacing property for the expander text.
 * @cssprop {unknown} --expander-font-text-decoration - The text-decoration property for the expander text.
 * @cssprop {unknown} --expander-font-text-transform - The text-transform property for the expander text.
 * @cssprop {unknown} --expander-background-color - The background-color property for the expander.
 * @cssprop {unknown} --expander-foreground-color - The foreground-color property for the expander.
 * @cssprop {unknown} --expander-border-color - The border-color property for the expander.
 * @cssprop {unknown} --expander-border-width - The border-width property for the expander.
 * @cssprop {unknown} --expander-border-radius - The border-radius property for the expander.
 * @cssprop {unknown} --expander-border-style - The border-style property for the expander.
 * @cssprop {unknown} --expander-transition-duration - The transition duration for the expander animations.
 * @cssprop {unknown} --expander-transition-mode - The transition mode for the expander animations.
 * @cssprop {unknown} --expander-transition-property - The transition property for the expander animations.
 * @cssprop {unknown} --expander-shadow - The shadow property for the expander.
 * @cssprop {unknown} --expander-padding-top - The padding-top property for the expander.
 * @cssprop {unknown} --expander-padding-right - The padding-right property for the expander.
 * @cssprop {unknown} --expander-padding-bottom - The padding-bottom property for the expander.
 * @cssprop {unknown} --expander-padding-left - The padding-left property for the expander.
 * @cssprop {unknown} --expander-gap - The gap property for spacing within the expander.
 * @cssprop {unknown} --expander-divider-height - The height of the divider within the expander.
 *
 * @dependency {ExpanderHeaderElement} - The Expander Header element used in the expander.
 * @dependency {ExpanderSubHeaderElement} - The Expander Sub Header element used in the expander.
 * @dependency {IconElement} - The Icon element used within the expander.
 * @dependency {RippleElement} - The Ripple element for interaction effects.
 * @dependency {FocusRingElement} - The Focus Ring element for accessibility.
 * @dependency {TextElement} - The Text element used for text content.
 * @dependency {StackElement} - The Stack element for layout management.
 *
 * @public
 */
let ExpanderElement = class ExpanderElement extends Themeable(Disableable(Animatable(Variantable(Appearanceable(CustomElement))))) {
    // #region Fields
    _expandableElement;
    _header;
    _subHeader;
    _icon;
    _direction;
    _isExpanded;
    _caretPosition;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._header = '';
        this._subHeader = '';
        this._icon = '';
        this._direction = ExpandDirection.Down;
        this._isExpanded = false;
        this._caretPosition = CaretPosition.After;
    }
    // #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-expander';
    }
    /**
     * Gets or sets the `header` property.
     *
     * @public
     * @attr
     */
    get header() {
        return this._header;
    }
    set header(value) {
        if (this._header !== value) {
            this._header = value;
            this.requestUpdate('header');
        }
    }
    /**
     * Gets or sets the `subHeader` property.
     *
     * @public
     * @attr
     */
    get subHeader() {
        return this._subHeader;
    }
    set subHeader(value) {
        if (this._subHeader !== value) {
            this._subHeader = value;
            this.requestUpdate('subHeader');
        }
    }
    /**
     * Gets or sets the `icon` property.
     *
     * @public
     */
    get icon() {
        return this._icon;
    }
    set icon(value) {
        if (this._icon !== value) {
            this._icon = value;
            this.requestUpdate('icon');
        }
    }
    /**
     * Gets or sets the `direction` property.
     *
     * @public
     * @attr
     */
    get direction() {
        return this._direction;
    }
    set direction(value) {
        if (this._direction !== value) {
            this._direction = value;
            this.requestUpdate('direction');
        }
    }
    /**
     * 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');
        }
    }
    /**
     * Gets or sets the `caretPosition` property.
     *
     * @public
     * @attr
     */
    get caretPosition() {
        return this._caretPosition;
    }
    set caretPosition(value) {
        if (this._caretPosition !== value) {
            this._caretPosition = value;
            this.requestUpdate('caretPosition');
        }
    }
    // #endregion
    // #region Methods
    /**
     * @public
     */
    toggle() {
        if (this.disabled) {
            return;
        }
        if (!this.isExpanded) {
            this.expand();
        }
        else {
            this.collapse();
        }
    }
    /**
     * @public
     */
    expand() {
        if (this.disabled) {
            return;
        }
        if (this._isExpanded) {
            return;
        }
        this._expandableElement.expand();
    }
    /**
     * @public
     */
    collapse() {
        if (this.disabled) {
            return;
        }
        if (!this._isExpanded) {
            return;
        }
        this._expandableElement.collapse();
    }
    /**
     * @protected
     * @template
     */
    onApplyTemplate() {
        super.onApplyTemplate();
        this._expandableElement = this.getTemplatePart('expandable');
    }
};
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], ExpanderElement.prototype, "header", null);
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], ExpanderElement.prototype, "subHeader", null);
__decorate([
    Property({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], ExpanderElement.prototype, "icon", null);
__decorate([
    Attribute({ type: ExpandDirection }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], ExpanderElement.prototype, "direction", null);
__decorate([
    Attribute({
        type: Boolean,
        useDefault: true
    }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], ExpanderElement.prototype, "isExpanded", null);
__decorate([
    Attribute({ type: CaretPosition }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], ExpanderElement.prototype, "caretPosition", null);
ExpanderElement = __decorate([
    Component({
        selector: 'mosaik-expander',
        template: expanderElementTemplate,
        themes: {
            joy: expanderElementJoyStyle,
            retro: expanderElementRetroStyle,
            cosmopolitan: expanderElementCosmopolitanStyle
        },
        imports: [
            ExpanderHeaderElement,
            ExpanderSubHeaderElement,
            IconElement,
            RippleElement,
            FocusRingElement,
            TextElement,
            StackElement
        ]
    }),
    __metadata("design:paramtypes", [])
], ExpanderElement);
export { ExpanderElement };
//# sourceMappingURL=ExpanderElement.js.map