/**
 * @license
 * Copyright 2023 Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import { __decorate } from "tslib";
import { CustomElement, attachShadowTemplate, coerceBoolean, FoundationProperty } from '@tylertech/forge-core';
import { StackAdapter } from './stack-adapter';
import { StackFoundation } from './stack-foundation';
import { STACK_CONSTANTS } from './stack-constants';
import { BaseComponent } from '../core/base/base-component';
const template = '<template><div class=\"forge-stack\" part=\"root\"><slot></slot></div></template>';
const styles = '.forge-stack{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;width:100%;gap:16px;gap:var(--forge-stack-gap,16px);height:100%;height:var(--forge-stack-height,100%)}.forge-stack ::slotted(*){-webkit-box-flex:var(--forge-stack-stretch,initial);flex:var(--forge-stack-stretch,initial)}:host{display:block}:host([inline]) .forge-stack{-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row;--forge-stack-height:auto}:host([inline][wrap]) .forge-stack{flex-wrap:wrap}:host([stretch]:not([inline])){height:100%}:host([stretch]){--forge-stack-stretch:1}:host([alignment=start]) .forge-stack{-webkit-box-pack:start;justify-content:start}:host([alignment=center]) .forge-stack{-webkit-box-pack:center;justify-content:center}:host([alignment=end]) .forge-stack{-webkit-box-pack:end;justify-content:end}';
/**
 * The custom element class behind the `<forge-stack>` component.
 *
 * @tag forge-stack
 */
let StackComponent = class StackComponent extends BaseComponent {
    constructor() {
        super();
        attachShadowTemplate(this, template, styles);
        this._foundation = new StackFoundation(new StackAdapter(this));
    }
    static get observedAttributes() {
        return [
            STACK_CONSTANTS.attributes.INLINE,
            STACK_CONSTANTS.attributes.WRAP,
            STACK_CONSTANTS.attributes.STRETCH,
            STACK_CONSTANTS.attributes.GAP,
            STACK_CONSTANTS.attributes.ALIGNMENT
        ];
    }
    attributeChangedCallback(name, oldValue, newValue) {
        switch (name) {
            case STACK_CONSTANTS.attributes.INLINE:
                this.inline = coerceBoolean(newValue);
                break;
            case STACK_CONSTANTS.attributes.WRAP:
                this.wrap = coerceBoolean(newValue);
                break;
            case STACK_CONSTANTS.attributes.STRETCH:
                this.stretch = coerceBoolean(newValue);
                break;
            case STACK_CONSTANTS.attributes.GAP:
                this.gap = newValue;
                break;
            case STACK_CONSTANTS.attributes.ALIGNMENT:
                this.alignment = newValue;
                break;
        }
    }
};
__decorate([
    FoundationProperty()
], StackComponent.prototype, "inline", void 0);
__decorate([
    FoundationProperty()
], StackComponent.prototype, "wrap", void 0);
__decorate([
    FoundationProperty()
], StackComponent.prototype, "stretch", void 0);
__decorate([
    FoundationProperty()
], StackComponent.prototype, "gap", void 0);
__decorate([
    FoundationProperty()
], StackComponent.prototype, "alignment", void 0);
StackComponent = __decorate([
    CustomElement({
        name: STACK_CONSTANTS.elementName
    })
], StackComponent);
export { StackComponent };
