"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
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 = __importDefault(require("../../../component/Div/Component"));
const Component_2 = __importDefault(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.$propHandler = {
            style: (style = {}) => {
                this._div.setProp('style', { ...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.parentElement)($system);
        const div = new Component_1.default({
            style: { ...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.$unbundled = false;
        this.$slot = {
            default: div,
        };
        this.setSubComponents({
            div,
            text,
        });
        this.registerRoot(div);
    }
    onPropChanged(prop, current, prev) {
        this.$propHandler[prop](current, prev);
    }
}
exports.default = TextBox;
//# sourceMappingURL=Component.js.map