'use client';
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
import { getTranslation } from '@payloadcms/translations';
import React from 'react';
import { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js';
import { FieldDescription } from '../../fields/FieldDescription/index.js';
import { FieldError } from '../../fields/FieldError/index.js';
import { FieldLabel } from '../../fields/FieldLabel/index.js';
import { useTranslation } from '../../providers/Translation/index.js';
import { fieldBaseClass } from '../shared/index.js';
import './index.scss';
export const TextareaInput = (props)=>{
    const { AfterInput, BeforeInput, className, Description, description, Error, Label, label, localized, onChange, path, placeholder, readOnly, required, rows, rtl, showError, style, value } = props;
    const { i18n } = useTranslation();
    return /*#__PURE__*/ _jsxDEV("div", {
        className: [
            fieldBaseClass,
            'textarea',
            className,
            showError && 'error',
            readOnly && 'read-only'
        ].filter(Boolean).join(' '),
        style: style,
        children: [
            /*#__PURE__*/ _jsxDEV(RenderCustomComponent, {
                CustomComponent: Label,
                Fallback: /*#__PURE__*/ _jsxDEV(FieldLabel, {
                    htmlFor: `field-${path.replace(/\./g, '__')}`,
                    label: label,
                    localized: localized,
                    path: path,
                    required: required
                }, void 0, false, {
                    fileName: "src/fields/Textarea/Input.tsx",
                    lineNumber: 58,
                    columnNumber: 11
                }, void 0)
            }, void 0, false, {
                fileName: "src/fields/Textarea/Input.tsx",
                lineNumber: 55,
                columnNumber: 7
            }, this),
            /*#__PURE__*/ _jsxDEV("div", {
                className: `${fieldBaseClass}__wrap`,
                children: [
                    /*#__PURE__*/ _jsxDEV(RenderCustomComponent, {
                        CustomComponent: Error,
                        Fallback: /*#__PURE__*/ _jsxDEV(FieldError, {
                            path: path,
                            showError: showError
                        }, void 0, false, {
                            fileName: "src/fields/Textarea/Input.tsx",
                            lineNumber: 70,
                            columnNumber: 21
                        }, void 0)
                    }, void 0, false, {
                        fileName: "src/fields/Textarea/Input.tsx",
                        lineNumber: 68,
                        columnNumber: 9
                    }, this),
                    BeforeInput,
                    /*#__PURE__*/ _jsxDEV("div", {
                        className: "textarea-outer",
                        children: /*#__PURE__*/ _jsxDEV("textarea", {
                            "data-rtl": rtl,
                            disabled: readOnly,
                            id: `field-${path.replace(/\./g, '__')}`,
                            name: path,
                            onChange: onChange,
                            placeholder: getTranslation(placeholder, i18n),
                            rows: rows,
                            style: {
                                '--rows': rows
                            },
                            value: value || ''
                        }, void 0, false, {
                            fileName: "src/fields/Textarea/Input.tsx",
                            lineNumber: 74,
                            columnNumber: 11
                        }, this)
                    }, void 0, false, {
                        fileName: "src/fields/Textarea/Input.tsx",
                        lineNumber: 73,
                        columnNumber: 9
                    }, this),
                    AfterInput,
                    /*#__PURE__*/ _jsxDEV(RenderCustomComponent, {
                        CustomComponent: Description,
                        Fallback: /*#__PURE__*/ _jsxDEV(FieldDescription, {
                            description: description,
                            path: path
                        }, void 0, false, {
                            fileName: "src/fields/Textarea/Input.tsx",
                            lineNumber: 93,
                            columnNumber: 21
                        }, void 0)
                    }, void 0, false, {
                        fileName: "src/fields/Textarea/Input.tsx",
                        lineNumber: 91,
                        columnNumber: 9
                    }, this)
                ]
            }, void 0, true, {
                fileName: "src/fields/Textarea/Input.tsx",
                lineNumber: 67,
                columnNumber: 7
            }, this)
        ]
    }, void 0, true, {
        fileName: "src/fields/Textarea/Input.tsx",
        lineNumber: 43,
        columnNumber: 5
    }, this);
};

//# sourceMappingURL=Input.js.map