import { Host, h } from "@stencil/core";
import { BEM } from "../../utils/bem";
export class Data {
    constructor() {
        /**
         * If `true` a bottom border is added to the data-item.
         */
        this.border = false;
        /**
         * If `true` the data list is horizontal instead of vertical.
         */
        this.horizontal = false;
        this.inputElements = ['bal-data-item'];
    }
    borderHandler() {
        this.updateProps([...this.inputElements], 'border');
    }
    updateProps(selectors, key) {
        const value = this[key];
        if (value !== undefined) {
            this.notifyComponents(selectors, input => (input[key] = value));
        }
    }
    notifyComponents(selectors, callback) {
        const components = this.element.querySelectorAll(selectors.join(', '));
        components.forEach((c) => callback(c));
    }
    componentWillLoad() {
        this.borderHandler();
    }
    render() {
        const block = BEM.block('data');
        return (h(Host, { key: 'aa8b8920767ec213d19c0ff5bd5b020afd720736', class: Object.assign(Object.assign(Object.assign({}, block.class()), block.modifier('has-border').class(this.border)), block.modifier('is-horizontal').class(this.horizontal)) }, h("slot", { key: '521ef64fdbd14bae75547ca851ae20e40d50a68f' })));
    }
    static get is() { return "bal-data"; }
    static get originalStyleUrls() {
        return {
            "$": ["bal-data.sass"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["bal-data.css"]
        };
    }
    static get properties() {
        return {
            "border": {
                "type": "boolean",
                "attribute": "border",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If `true` a bottom border is added to the data-item."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "false"
            },
            "horizontal": {
                "type": "boolean",
                "attribute": "horizontal",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If `true` the data list is horizontal instead of vertical."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "false"
            }
        };
    }
    static get elementRef() { return "element"; }
    static get watchers() {
        return [{
                "propName": "border",
                "methodName": "borderHandler"
            }];
    }
}
