/**
 * @license
 * Copyright Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import { __decorate } from "tslib";
import { coerceBoolean, FoundationProperty } from '@tylertech/forge-core';
import { BaseComponent } from '../../core/base/base-component';
import { WithLabelAwareness } from '../../core/mixins/label/with-label-aware';
import { BASE_FIELD_CONSTANTS } from './base-field-constants';
export class BaseField extends WithLabelAwareness(BaseComponent) {
    static get observedAttributes() {
        return Object.values(BASE_FIELD_CONSTANTS.observedAttributes);
    }
    constructor() {
        super();
    }
    attributeChangedCallback(name, oldValue, newValue) {
        switch (name) {
            case BASE_FIELD_CONSTANTS.observedAttributes.LABEL_POSITION:
                this.labelPosition = newValue;
                return;
            case BASE_FIELD_CONSTANTS.observedAttributes.LABEL_ALIGNMENT:
                this.labelAlignment = newValue;
                return;
            case BASE_FIELD_CONSTANTS.observedAttributes.INVALID:
                this.invalid = coerceBoolean(newValue);
                return;
            case BASE_FIELD_CONSTANTS.observedAttributes.REQUIRED:
                this.required = coerceBoolean(newValue);
                return;
            case BASE_FIELD_CONSTANTS.observedAttributes.OPTIONAL:
                this.optional = coerceBoolean(newValue);
                return;
            case BASE_FIELD_CONSTANTS.observedAttributes.DISABLED:
                this.disabled = coerceBoolean(newValue);
                return;
            case BASE_FIELD_CONSTANTS.observedAttributes.FLOAT_LABEL:
                this.floatLabel = coerceBoolean(newValue);
                return;
            case BASE_FIELD_CONSTANTS.observedAttributes.VARIANT:
                this.variant = newValue;
                return;
            case BASE_FIELD_CONSTANTS.observedAttributes.THEME:
                this.theme = newValue;
                return;
            case BASE_FIELD_CONSTANTS.observedAttributes.SHAPE:
                this.shape = newValue;
                return;
            case BASE_FIELD_CONSTANTS.observedAttributes.DENSITY:
                this.density = newValue;
                return;
            case BASE_FIELD_CONSTANTS.observedAttributes.DENSE:
                this.dense = coerceBoolean(newValue);
                return;
            case BASE_FIELD_CONSTANTS.observedAttributes.POPOVER_ICON:
                this.popoverIcon = coerceBoolean(newValue);
                return;
            case BASE_FIELD_CONSTANTS.observedAttributes.POPOVER_EXPANDED:
                this.popoverExpanded = coerceBoolean(newValue);
                return;
            case BASE_FIELD_CONSTANTS.observedAttributes.SUPPORT_TEXT_INSET:
                this.supportTextInset = newValue;
                return;
        }
    }
    labelClickedCallback() {
        this._foundation.click();
    }
    labelChangedCallback(value) {
        this._foundation.applyLabel(value);
    }
    floatLabelWithoutAnimation(value) {
        this._foundation.floatLabelWithoutAnimation(value);
    }
}
__decorate([
    FoundationProperty()
], BaseField.prototype, "labelPosition", void 0);
__decorate([
    FoundationProperty()
], BaseField.prototype, "labelAlignment", void 0);
__decorate([
    FoundationProperty()
], BaseField.prototype, "invalid", void 0);
__decorate([
    FoundationProperty()
], BaseField.prototype, "required", void 0);
__decorate([
    FoundationProperty()
], BaseField.prototype, "optional", void 0);
__decorate([
    FoundationProperty()
], BaseField.prototype, "disabled", void 0);
__decorate([
    FoundationProperty({ name: 'permanentlyFloatLabel' })
], BaseField.prototype, "floatLabel", void 0);
__decorate([
    FoundationProperty()
], BaseField.prototype, "variant", void 0);
__decorate([
    FoundationProperty()
], BaseField.prototype, "theme", void 0);
__decorate([
    FoundationProperty()
], BaseField.prototype, "shape", void 0);
__decorate([
    FoundationProperty()
], BaseField.prototype, "density", void 0);
__decorate([
    FoundationProperty()
], BaseField.prototype, "dense", void 0);
__decorate([
    FoundationProperty()
], BaseField.prototype, "popoverIcon", void 0);
__decorate([
    FoundationProperty()
], BaseField.prototype, "popoverExpanded", void 0);
__decorate([
    FoundationProperty()
], BaseField.prototype, "supportTextInset", void 0);
