/**
 * @license
 * Copyright 2023 Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import { __decorate } from "tslib";
import { attachShadowTemplate, coerceBoolean, CustomElement, ensureChildren, FoundationProperty } from '@tylertech/forge-core';
import { BaseComponent } from '../../core/base/base-component';
import { StepComponent } from '../step/step';
import { StepperAdapter } from './stepper-adapter';
import { STEPPER_CONSTANTS } from './stepper-constants';
import { StepperFoundation } from './stepper-foundation';
const template = '<template><div class=\"forge-stepper\" part=\"root\"><slot></slot></div></template>';
const styles = '.forge-stepper{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;white-space:nowrap;overflow:hidden}.forge-stepper:not(.forge-stepper--vertical) ::slotted(*){display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;position:relative;min-width:112px}.forge-stepper--fixed ::slotted(*){-webkit-box-flex:1;flex:1}.forge-stepper--alternative{-webkit-box-align:start;align-items:flex-start}.forge-stepper--alternative ::slotted(*){min-width:160px}.forge-stepper--align-left{-webkit-box-pack:start;justify-content:flex-start}.forge-stepper--align-center{-webkit-box-pack:center;justify-content:center}.forge-stepper--align-right{-webkit-box-pack:end;justify-content:flex-end}:host{display:block}:host([hidden]){display:none}:host([vertical]) .forge-stepper{display:unset;-webkit-box-align:unset;align-items:unset;white-space:unset;overflow:unset}';
/**
 * The web component class behind the `<forge-stepper>` custom element.
 *
 * @tag forge-stepper
 */
let StepperComponent = class StepperComponent extends BaseComponent {
    constructor() {
        super();
        attachShadowTemplate(this, template, styles);
        this._foundation = new StepperFoundation(new StepperAdapter(this));
    }
    static get observedAttributes() {
        return [
            STEPPER_CONSTANTS.attributes.SELECTED_INDEX,
            STEPPER_CONSTANTS.attributes.LINEAR,
            STEPPER_CONSTANTS.attributes.ALTERNATIVE,
            STEPPER_CONSTANTS.attributes.LAYOUT_MODE,
            STEPPER_CONSTANTS.attributes.LAYOUT_ALIGN,
            STEPPER_CONSTANTS.attributes.DISABLED,
            STEPPER_CONSTANTS.attributes.VERTICAL
        ];
    }
    async connectedCallback() {
        await ensureChildren(this);
        this._foundation.initialize();
    }
    disconnectedCallback() {
        this._foundation.disconnect();
    }
    attributeChangedCallback(name, oldValue, newValue) {
        switch (name) {
            case STEPPER_CONSTANTS.attributes.SELECTED_INDEX:
                this.selectedIndex = Number(newValue) || 0;
                break;
            case STEPPER_CONSTANTS.attributes.LINEAR:
                this.linear = coerceBoolean(newValue);
                break;
            case STEPPER_CONSTANTS.attributes.ALTERNATIVE:
                this.alternative = coerceBoolean(newValue);
                break;
            case STEPPER_CONSTANTS.attributes.LAYOUT_MODE:
                this.layoutMode = newValue;
                break;
            case STEPPER_CONSTANTS.attributes.LAYOUT_ALIGN:
                this.layoutAlign = newValue;
                break;
            case STEPPER_CONSTANTS.attributes.DISABLED:
                this.disabled = coerceBoolean(newValue);
                break;
            case STEPPER_CONSTANTS.attributes.VERTICAL:
                this.vertical = coerceBoolean(newValue);
                break;
        }
    }
};
__decorate([
    FoundationProperty()
], StepperComponent.prototype, "steps", void 0);
__decorate([
    FoundationProperty()
], StepperComponent.prototype, "selectedIndex", void 0);
__decorate([
    FoundationProperty()
], StepperComponent.prototype, "linear", void 0);
__decorate([
    FoundationProperty()
], StepperComponent.prototype, "alternative", void 0);
__decorate([
    FoundationProperty()
], StepperComponent.prototype, "layoutMode", void 0);
__decorate([
    FoundationProperty()
], StepperComponent.prototype, "layoutAlign", void 0);
__decorate([
    FoundationProperty()
], StepperComponent.prototype, "disabled", void 0);
__decorate([
    FoundationProperty()
], StepperComponent.prototype, "vertical", void 0);
StepperComponent = __decorate([
    CustomElement({
        name: STEPPER_CONSTANTS.elementName,
        dependencies: [StepComponent]
    })
], StepperComponent);
export { StepperComponent };
