"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const field_1 = require("../../../../../client/field");
class TextArea extends field_1.Field {
    constructor($props, $system) {
        const { flags: { defaultInputModeNone }, } = $system;
        super($props, $system, $system.api.document.createElement('textarea'), {
            valueKey: 'value',
            defaultStyle: $system.style['textarea'],
            defaultAttr: {
                spellcheck: false,
                autocomplete: 'off',
                autocapitalize: 'off',
                inputmode: defaultInputModeNone ? 'none' : 'text',
            },
            propHandlers: {
                placeholder: (placeholder) => {
                    this.$element.placeholder = placeholder;
                },
            },
        });
        const { placeholder = '' } = $props;
        this.$element.placeholder = placeholder;
    }
    getSelection() {
        const { selectionStart, selectionEnd, selectionDirection } = this.$element;
        return [
            {
                path: [],
                start: selectionStart,
                end: selectionEnd,
                direction: selectionDirection,
            },
        ];
    }
    setSelectionRange(start, end, direction) {
        this.$element.setSelectionRange(start ?? null, end ?? null, direction ?? 'none');
    }
}
exports.default = TextArea;
//# sourceMappingURL=Component.js.map