/**
 * @license
 * Copyright 2023 Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import { __decorate } from "tslib";
import { attachShadowTemplate, coerceBoolean, CustomElement, FoundationProperty } from '@tylertech/forge-core';
import { BaseComponent } from '../../core/base/base-component';
import { ChipComponent } from '../chip/chip';
import { ChipSetAdapter } from './chip-set-adapter';
import { CHIP_SET_CONSTANTS } from './chip-set-constants';
import { ChipSetFoundation } from './chip-set-foundation';
const template = '<template><div class=\"forge-chip-set\" part=\"root\"><slot></slot></div></template>';
const styles = '.forge-chip-set{gap:4px;gap:var(--forge-chip-set-spacing,4px);display:-webkit-box;display:flex;flex-wrap:wrap}.forge-chip-set ::slotted(forge-chip:not(:last-child)){margin-right:4px;margin-right:var(--forge-chip-set-spacing,4px)}.forge-chip-set--vertical{-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}.forge-chip-set--vertical ::slotted(forge-chip:not(:last-child)){margin-bottom:4px;margin-bottom:var(--forge-chip-set-spacing,4px)}:host{display:inline-block}:host([hidden]){display:none}';
/**
 * The web component class behind the `<forge-chip-set>` custom element.
 *
 * @tag forge-chip-set
 */
let ChipSetComponent = class ChipSetComponent extends BaseComponent {
    constructor() {
        super();
        attachShadowTemplate(this, template, styles);
        this._foundation = new ChipSetFoundation(new ChipSetAdapter(this));
    }
    static get observedAttributes() {
        return [
            CHIP_SET_CONSTANTS.attributes.VERTICAL,
            CHIP_SET_CONSTANTS.attributes.TYPE,
            CHIP_SET_CONSTANTS.attributes.DENSE,
            CHIP_SET_CONSTANTS.attributes.DISABLED
        ];
    }
    connectedCallback() {
        this._foundation.initialize();
    }
    disconnectedCallback() {
        this._foundation.destroy();
    }
    attributeChangedCallback(name, oldValue, newValue) {
        switch (name) {
            case CHIP_SET_CONSTANTS.attributes.VERTICAL:
                this.vertical = coerceBoolean(newValue);
                break;
            case CHIP_SET_CONSTANTS.attributes.TYPE:
                this.type = newValue;
                break;
            case CHIP_SET_CONSTANTS.attributes.DENSE:
                this.dense = coerceBoolean(newValue);
                break;
            case CHIP_SET_CONSTANTS.attributes.DISABLED:
                this.disabled = coerceBoolean(newValue);
                break;
        }
    }
};
__decorate([
    FoundationProperty()
], ChipSetComponent.prototype, "vertical", void 0);
__decorate([
    FoundationProperty()
], ChipSetComponent.prototype, "type", void 0);
__decorate([
    FoundationProperty()
], ChipSetComponent.prototype, "dense", void 0);
__decorate([
    FoundationProperty()
], ChipSetComponent.prototype, "disabled", void 0);
ChipSetComponent = __decorate([
    CustomElement({
        name: CHIP_SET_CONSTANTS.elementName,
        dependencies: [ChipComponent]
    })
], ChipSetComponent);
export { ChipSetComponent };
