"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_STYLE = void 0;
const element_1 = require("../../../../../client/element");
const parentElement_1 = require("../../../../../client/platform/web/parentElement");
const Component_1 = require("../../../component/Div/Component");
const Component_2 = require("../../../component/value/Text/Component");
exports.DEFAULT_STYLE = {
    width: '100%',
    height: 'fit-content',
};
class TextBox extends element_1.Element {
    constructor($props, $system) {
        super($props, $system);
        this._prop_handler = {
            style: (style = {}) => {
                this._div.setProp('style', Object.assign(Object.assign({}, exports.DEFAULT_STYLE), style));
            },
            className: (className) => {
                this._div.setProp('className', className);
            },
            tabIndex: (tabIndex) => {
                this._div.setProp('tabIndex', tabIndex);
            },
            title: (title) => {
                this._div.setProp('title', title);
            },
            value: (value) => {
                this._text.setProp('value', value);
            },
        };
        const { className, style, tabIndex, title, draggable, value } = this.$props;
        const $element = (0, parentElement_1.default)($system);
        const div = new Component_1.default({
            style: Object.assign(Object.assign({}, exports.DEFAULT_STYLE), style),
            className,
            tabIndex,
            title,
            draggable,
        }, this.$system);
        this._div = div;
        const text = new Component_2.default({
            value,
        }, this.$system);
        this._text = text;
        div.registerParentRoot(text);
        this.$element = $element;
        this.$slot = {
            default: div,
        };
        this.setSubComponents({
            div,
            text,
        });
        this.registerRoot(div);
    }
    onPropChanged(prop, current) {
        this._prop_handler[prop](current);
    }
}
exports.default = TextBox;
//# sourceMappingURL=Component.js.map