/**
 * @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 { ButtonToggleComponent } from '../button-toggle/button-toggle';
import { ButtonToggleGroupAdapter } from './button-toggle-group-adapter';
import { BUTTON_TOGGLE_GROUP_CONSTANTS } from './button-toggle-group-constants';
import { ButtonToggleGroupFoundation } from './button-toggle-group-foundation';
const template = '<template><div class=\"forge-button-toggle-group\" role=\"group\" aria-label=\"Button group\" part=\"root\"><slot></slot></div></template>';
const styles = '.forge-button-toggle-group{display:-webkit-box;display:flex}.forge-button-toggle-group ::slotted(:not(:last-child)){--forge-button-toggle-border-right-width:0;--forge-button-toggle-border-top-left-radius:0;--forge-button-toggle-border-bottom-left-radius:0;--forge-button-toggle-border-top-right-radius:0;--forge-button-toggle-border-bottom-right-radius:0}.forge-button-toggle-group ::slotted(:first-child){--forge-button-toggle-border-top-left-radius:4px;--forge-button-toggle-border-bottom-left-radius:4px}.forge-button-toggle-group ::slotted(:last-child){--forge-button-toggle-border-top-left-radius:0;--forge-button-toggle-border-bottom-left-radius:0;--forge-button-toggle-border-top-right-radius:4px;--forge-button-toggle-border-bottom-right-radius:4px}.forge-button-toggle-group--vertical{-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}.forge-button-toggle-group--vertical ::slotted(:not(:last-child)){--forge-button-toggle-border-right-width:1px;--forge-button-toggle-border-bottom-width:0;--forge-button-toggle-border-top-left-radius:0;--forge-button-toggle-border-bottom-left-radius:0;--forge-button-toggle-border-top-right-radius:0;--forge-button-toggle-border-bottom-right-radius:0}.forge-button-toggle-group--vertical ::slotted(:first-child){--forge-button-toggle-border-top-left-radius:4px;--forge-button-toggle-border-top-right-radius:4px}.forge-button-toggle-group--vertical ::slotted(:last-child){--forge-button-toggle-border-top-left-radius:0;--forge-button-toggle-border-top-right-radius:0;--forge-button-toggle-border-bottom-left-radius:4px;--forge-button-toggle-border-bottom-right-radius:4px}.forge-button-toggle-group ::slotted(:only-child){--forge-button-toggle-border-top-left-radius:4px;--forge-button-toggle-border-bottom-left-radius:4px;--forge-button-toggle-border-top-right-radius:4px;--forge-button-toggle-border-bottom-right-radius:4px}.forge-button-toggle-group--stretch{width:100%}:host{display:block}:host([hidden]){display:none}';
/**
 * The web component class behind the `<forge-button-toggle-group>` custom element.
 *
 * @tag forge-button-toggle-group
 */
let ButtonToggleGroupComponent = class ButtonToggleGroupComponent extends BaseComponent {
    constructor() {
        super();
        attachShadowTemplate(this, template, styles);
        this._foundation = new ButtonToggleGroupFoundation(new ButtonToggleGroupAdapter(this));
    }
    static get observedAttributes() {
        return [
            BUTTON_TOGGLE_GROUP_CONSTANTS.attributes.VALUE,
            BUTTON_TOGGLE_GROUP_CONSTANTS.attributes.MULTIPLE,
            BUTTON_TOGGLE_GROUP_CONSTANTS.attributes.MANDATORY,
            BUTTON_TOGGLE_GROUP_CONSTANTS.attributes.VERTICAL,
            BUTTON_TOGGLE_GROUP_CONSTANTS.attributes.STRETCH,
            BUTTON_TOGGLE_GROUP_CONSTANTS.attributes.DISABLED,
            BUTTON_TOGGLE_GROUP_CONSTANTS.attributes.DENSE
        ];
    }
    initializedCallback() {
        this._foundation.initialize();
    }
    disconnectedCallback() {
        this._foundation.disconnect();
    }
    attributeChangedCallback(name, oldValue, newValue) {
        switch (name) {
            case BUTTON_TOGGLE_GROUP_CONSTANTS.attributes.VALUE:
                this.value = newValue;
                break;
            case BUTTON_TOGGLE_GROUP_CONSTANTS.attributes.MULTIPLE:
                this.multiple = coerceBoolean(newValue);
                break;
            case BUTTON_TOGGLE_GROUP_CONSTANTS.attributes.MANDATORY:
                this.mandatory = coerceBoolean(newValue);
                break;
            case BUTTON_TOGGLE_GROUP_CONSTANTS.attributes.VERTICAL:
                this.vertical = coerceBoolean(newValue);
                break;
            case BUTTON_TOGGLE_GROUP_CONSTANTS.attributes.STRETCH:
                this.stretch = coerceBoolean(newValue);
                break;
            case BUTTON_TOGGLE_GROUP_CONSTANTS.attributes.DENSE:
                this.dense = coerceBoolean(newValue);
                break;
            case BUTTON_TOGGLE_GROUP_CONSTANTS.attributes.DISABLED:
                this.disabled = coerceBoolean(newValue);
                break;
        }
    }
};
__decorate([
    FoundationProperty()
], ButtonToggleGroupComponent.prototype, "value", void 0);
__decorate([
    FoundationProperty()
], ButtonToggleGroupComponent.prototype, "multiple", void 0);
__decorate([
    FoundationProperty()
], ButtonToggleGroupComponent.prototype, "mandatory", void 0);
__decorate([
    FoundationProperty()
], ButtonToggleGroupComponent.prototype, "vertical", void 0);
__decorate([
    FoundationProperty()
], ButtonToggleGroupComponent.prototype, "stretch", void 0);
__decorate([
    FoundationProperty()
], ButtonToggleGroupComponent.prototype, "dense", void 0);
__decorate([
    FoundationProperty()
], ButtonToggleGroupComponent.prototype, "disabled", void 0);
__decorate([
    FoundationProperty()
], ButtonToggleGroupComponent.prototype, "options", void 0);
ButtonToggleGroupComponent = __decorate([
    CustomElement({
        name: BUTTON_TOGGLE_GROUP_CONSTANTS.elementName,
        dependencies: [ButtonToggleComponent]
    })
], ButtonToggleGroupComponent);
export { ButtonToggleGroupComponent };
