/**
 * @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 { ListItemComponent } from '../list-item';
import { ListAdapter } from './list-adapter';
import { LIST_CONSTANTS } from './list-constants';
import { ListFoundation } from './list-foundation';
const template = '<template><div class=\"forge-list\" part=\"root\"><slot></slot></div></template>';
const styles = '.forge-list{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto,sans-serif;font-family:var(--mdc-typography-subtitle1-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:1rem;font-size:var(--mdc-typography-subtitle1-font-size, 1rem);line-height:1.75rem;line-height:var(--mdc-typography-subtitle1-line-height, 1.75rem);font-weight:400;font-weight:var(--mdc-typography-subtitle1-font-weight,400);letter-spacing:.009375em;letter-spacing:var(--mdc-typography-subtitle1-letter-spacing, .009375em);text-decoration:inherit;-webkit-text-decoration:var(--mdc-typography-subtitle1-text-decoration,inherit);text-decoration:var(--mdc-typography-subtitle1-text-decoration,inherit);text-transform:inherit;text-transform:var(--mdc-typography-subtitle1-text-transform,inherit);line-height:1.5rem;padding-top:8px;padding-top:var(--forge-list-padding,8px);padding-bottom:8px;padding-bottom:var(--forge-list-padding,8px);margin:0;list-style-type:none}.forge-list:focus{outline:0}:host{display:block;contain:content}:host([hidden]){display:none}';
/**
 * The custom element class behind the `<forge-list>` element.
 *
 * @tag forge-list
 */
let ListComponent = class ListComponent extends BaseComponent {
    constructor() {
        super();
        attachShadowTemplate(this, template, styles);
        this._foundation = new ListFoundation(new ListAdapter(this));
    }
    static get observedAttributes() {
        return [
            LIST_CONSTANTS.attributes.STATIC,
            LIST_CONSTANTS.attributes.DENSE,
            LIST_CONSTANTS.attributes.SELECTED_VALUE,
            LIST_CONSTANTS.attributes.PROPAGATE_CLICK,
            LIST_CONSTANTS.attributes.INDENTED
        ];
    }
    initializedCallback() {
        this._foundation.initialize();
    }
    attributeChangedCallback(name, oldValue, newValue) {
        switch (name) {
            case LIST_CONSTANTS.attributes.STATIC:
                this.static = coerceBoolean(newValue);
                break;
            case LIST_CONSTANTS.attributes.DENSE:
                this.dense = coerceBoolean(newValue);
                break;
            case LIST_CONSTANTS.attributes.PROPAGATE_CLICK:
                this.propagateClick = coerceBoolean(newValue);
                break;
            case LIST_CONSTANTS.attributes.INDENTED:
                this.indented = coerceBoolean(newValue);
                break;
            case LIST_CONSTANTS.attributes.SELECTED_VALUE:
                this.selectedValue = newValue;
                break;
        }
    }
};
__decorate([
    FoundationProperty()
], ListComponent.prototype, "static", void 0);
__decorate([
    FoundationProperty()
], ListComponent.prototype, "dense", void 0);
__decorate([
    FoundationProperty()
], ListComponent.prototype, "propagateClick", void 0);
__decorate([
    FoundationProperty()
], ListComponent.prototype, "indented", void 0);
__decorate([
    FoundationProperty()
], ListComponent.prototype, "selectedValue", void 0);
ListComponent = __decorate([
    CustomElement({
        name: LIST_CONSTANTS.elementName,
        dependencies: [ListItemComponent]
    })
], ListComponent);
export { ListComponent };
