// #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 { fadeIn, fadeOut } from '../../../../Animations/Presets/Fade';
import { DomServiceLocator } from '../../../../Dom/Dom';
import { Animatable } from '../../../Behaviors/Animatable';
import { Disableable } from '../../../Behaviors/Disableable';
import { Insetable } from '../../../Behaviors/Insetable';
import { Themeable } from '../../../Behaviors/Themeable';
import { addInheritanceConsumerController } from '../../../Controllers/InheritanceConsumerController';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { Watch } from '../../../Decorators/WatchDecorator';
import { SelectorItemElement } from '../Abstracts/Selector/SelectorItemElement';
import { wizardStepElementCosmopolitanStyle } from './Themes/WizardStepElement.Cosmopolitan';
import { wizardStepElementJoyStyle } from './Themes/WizardStepElement.Joy';
import { wizardStepElementMemphisStyle } from './Themes/WizardStepElement.Memphis';
import { WizardElement } from './WizardElement';
import { WIZARD_INHERITANCE_CONTEXT } from './WizardInheritanceContext';
import { wizardStepElementTemplate } from './WizardStepElementTemplate';
// #endregion
/**
 * Wizard step - A component that allows users to navigate through steps to complete a task.
 *
 * @element mosaik-wizard-step
 * @category Selector
 *
 * @slot - The default slot.
 * @slot footer - The footer slot.
 *
 * @csspart content - The content part.
 * @csspart footer - The footer part.
 *
 * @cssprop {String} --wizard-step-font-family - The step font family CSS custom property.
 * @cssprop {String} --wizard-step-font-letter-spacing - The step font letter spacing CSS custom property.
 * @cssprop {String} --wizard-step-font-line-height - The step font line height CSS custom property.
 * @cssprop {String} --wizard-step-font-size - The step font size CSS custom property.
 * @cssprop {String} --wizard-step-font-text-decoration - The step font text decoration CSS custom property.
 * @cssprop {String} --wizard-step-font-text-transform - The step font text transform CSS custom property.
 * @cssprop {String} --wizard-step-font-weight - The step font weight CSS custom property.
 * @cssprop {String} --wizard-step-gap - The step gap CSS custom property.
 * @cssprop {String} --wizard-step-padding-bottom - The step padding bottom CSS custom property.
 * @cssprop {String} --wizard-step-padding-left - The step padding left CSS custom property.
 * @cssprop {String} --wizard-step-padding-right - The step padding right CSS custom property.
 * @cssprop {String} --wizard-step-padding-top - The step padding top CSS custom property.
 * @cssprop {String} --wizard-step-shadow - The step shadow CSS custom property.
 * @cssprop {String} --wizard-step-shadow-blur - The step shadow blur CSS custom property.
 * @cssprop {String} --wizard-step-shadow-color - The step shadow color CSS custom property.
 * @cssprop {String} --wizard-step-shadow-offset-x - The step shadow offset x CSS custom property.
 * @cssprop {String} --wizard-step-shadow-offset-y - The step shadow offset y CSS custom property.
 * @cssprop {String} --wizard-step-shadow-spread - The step shadow spread CSS custom property.
 * @cssprop {String} --wizard-step-transition-duration - The step transition duration CSS custom property.
 * @cssprop {String} --wizard-step-transition-mode - The step transition mode CSS custom property.
 * @cssprop {String} --wizard-step-transition-property - The step transition property CSS custom property.
 * @cssprop {String} --wizard-step-translate - The step translate CSS custom property.
 *
 * @example
 * Basic wizard step:
 * ```html
 * <mosaik-wizard-step header="Personal Information" is-active>
 *   <form>
 *     <mosaik-textbox type="text" placeholder="Your name">/mosaik-textbox>
 *     <mosaik-textbox type="email" placeholder="Your email"></mosaik-textbox>
 *   </form>
 * </mosaik-wizard-step>
 * ```
 *
 * @example
 * Wizard step with sub-header and footer:
 * ```html
 * <mosaik-wizard-step header="Review" sub-header="Please confirm your details">
 *   <p>Your information will be saved.</p>
 *   <div slot="footer">
 *     <button>Back</button>
 *     <button>Confirm</button>
 *   </div>
 * </mosaik-wizard-step>
 * ```
 *
 * @public
 */
let WizardStepElement = class WizardStepElement extends Themeable(Animatable(Disableable(Insetable(SelectorItemElement)))) {
    // #region Fields
    _inheritance = addInheritanceConsumerController(this, {
        context: WIZARD_INHERITANCE_CONTEXT
    });
    _header;
    _subHeader;
    _isActive;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._header = '';
        this._subHeader = '';
        this._isActive = false;
        this.enter = fadeIn;
        this.exit = fadeOut;
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `is` property.
     * The `is` property represents natural name of this element.
     *
     * @public
     * @static
     * @override
     * @readonly
     */
    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    // @ts-ignore
    static get is() {
        return 'mosaik-wizard-step';
    }
    /**
     * @inheritdoc
     * When used inside a Wizard, inherits the wizard's disabled state unless explicitly set.
     *
     * @public
     * @override
     */
    get disabled() {
        return this._inheritance.get('disabled', super.disabled);
    }
    set disabled(value) {
        this._inheritance.markExplicit('disabled');
        super.disabled = value;
    }
    /**
     * 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 `isActive` property.
     *
     * @public
     * @attr
     */
    get isActive() {
        return this._isActive;
    }
    set isActive(value) {
        if (this._isActive !== value) {
            this._isActive = value;
            this.requestUpdate('isActive');
        }
    }
    /**
     * Get the item parent.
     *
     * @protected
     * @readonly
     */
    get parent() {
        return DomServiceLocator.current.findAncestor(this, WizardElement.is, { strict: true });
    }
    // #endregion
    // #region Methods
    /**
     * @public
     * @override
     */
    connectedCallback() {
        super.connectedCallback();
        void this.play(this.enter ?? { steps: [] });
    }
    /**
     * @public
     * @override
     */
    disconnectedCallback() {
        void this.play(this.exit ?? { steps: [] });
        super.disconnectedCallback();
    }
    /**
     * @protected
     */
    onIsActivePropertyChanged(_prev, next) {
        if (next) {
            void this.updateComplete.then(() => {
                const index = this.parent.items.indexOf(this);
                this.parent.select(index);
            });
        }
    }
};
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], WizardStepElement.prototype, "header", null);
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], WizardStepElement.prototype, "subHeader", null);
__decorate([
    Attribute({
        type: Boolean,
        useDefault: true
    }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], WizardStepElement.prototype, "isActive", null);
__decorate([
    Watch('isActive'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Boolean, Boolean]),
    __metadata("design:returntype", void 0)
], WizardStepElement.prototype, "onIsActivePropertyChanged", null);
WizardStepElement = __decorate([
    Component({
        selector: 'mosaik-wizard-step',
        template: wizardStepElementTemplate,
        themes: {
            joy: wizardStepElementJoyStyle,
            memphis: wizardStepElementMemphisStyle,
            cosmopolitan: wizardStepElementCosmopolitanStyle
        },
        options: {
            mode: 'open',
            delegatesFocus: true
        },
        host: {
            role: 'tabpanel',
            slot: 'steps'
        },
        imports: []
    }),
    __metadata("design:paramtypes", [])
], WizardStepElement);
export { WizardStepElement };
//# sourceMappingURL=WizardStepElement.js.map