<!-- components/oxi-section/form/field/textarea -->
<div class="row">
    <div class="col-lg-10">
        <textarea
            class="form-control"
            rows={{this.rows}}
            value={{this.textOutput}}
            placeholder={{@content.placeholder}}
            readonly={{if this.lockTextInput "readonly"}}
            required={{not @content.is_optional}}
            {{on "keydown" this.onKeydown}}
            {{on "input" this.onInput}}
            {{on "drop" this.fileDropped}}
            {{on "dragover" this.showCopyEffect}}
            {{on-init @setFocusInfo true}}
        />
        <div class="invalid-feedback">{{@error}}</div>
    </div>
    <div class="col-lg-2 d-flex flex-column justify-content-start gap-2">
        {{#if @content.allow_upload}}
            <BsButton
                @type="light"
                class="oxi-btn-exceptional btn-sm"
                @onClick={{this.openFileUpload}}
                disabled={{this.hasContent}}
                @icon="glyphicon glyphicon-folder-open"
            >
                <Tippy>{{t 'component.oxifield_textarea.open'}}</Tippy>
            </BsButton>
        {{/if}}

        {{#if @content.autofill}}
            <OxiSection::Form::Autofill
                @config={{@content.autofill}}
                @disabled={{this.hasContent}}
                @valueSetter={{this.setAutofill}}
                @encodeFields={{@encodeFields}}
            />
        {{/if}}

        {{#if (or @content.allow_upload @content.autofill)}}
            <BsButton
                @type="light"
                class="oxi-btn-cancel btn-sm"
                @onClick={{this.resetInput}}
                disabled={{not this.hasContent}}
                @icon="glyphicon glyphicon-trash"
            >
                <Tippy>{{t 'component.oxifield_textarea.reset'}}</Tippy>
            </BsButton>
        {{/if}}
    </div>
</div>

{{#if (or @content.allow_upload @content.autofill)}}
    {{this.filename}}
{{/if}}

{{#if @content.allow_upload}}
    <input
        type="file"
        class="oxi-file-input d-none"
        {{on "change" this.fileSelected}}
        {{on-init this.setFileUploadElement}}
    />
{{/if}}
