'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 PasswordInput = (props)=>{
    const { AfterInput, autoComplete = 'off', BeforeInput, className, description, Description, Error, inputRef, Label, label, localized, onChange, onKeyDown, path, placeholder, readOnly, required, rtl, showError, style, value, width } = props;
    const { i18n } = useTranslation();
    return /*#__PURE__*/ _jsxDEV("div", {
        className: [
            fieldBaseClass,
            'password',
            className,
            showError && 'error',
            readOnly && 'read-only'
        ].filter(Boolean).join(' '),
        style: {
            ...style,
            width
        },
        children: [
            /*#__PURE__*/ _jsxDEV(RenderCustomComponent, {
                CustomComponent: Label,
                Fallback: /*#__PURE__*/ _jsxDEV(FieldLabel, {
                    label: label,
                    localized: localized,
                    path: path,
                    required: required
                }, void 0, false, {
                    fileName: "src/fields/Password/input.tsx",
                    lineNumber: 64,
                    columnNumber: 11
                }, void 0)
            }, void 0, false, {
                fileName: "src/fields/Password/input.tsx",
                lineNumber: 61,
                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/Password/input.tsx",
                            lineNumber: 70,
                            columnNumber: 21
                        }, void 0)
                    }, void 0, false, {
                        fileName: "src/fields/Password/input.tsx",
                        lineNumber: 68,
                        columnNumber: 9
                    }, this),
                    /*#__PURE__*/ _jsxDEV("div", {
                        children: [
                            BeforeInput,
                            /*#__PURE__*/ _jsxDEV("input", {
                                "aria-label": getTranslation(label, i18n),
                                autoComplete: autoComplete,
                                "data-rtl": rtl,
                                disabled: readOnly,
                                id: `field-${path.replace(/\./g, '__')}`,
                                name: path,
                                onChange: onChange,
                                onKeyDown: onKeyDown,
                                placeholder: getTranslation(placeholder, i18n),
                                ref: inputRef,
                                type: "password",
                                value: value || ''
                            }, void 0, false, {
                                fileName: "src/fields/Password/input.tsx",
                                lineNumber: 74,
                                columnNumber: 11
                            }, this),
                            AfterInput
                        ]
                    }, void 0, true, {
                        fileName: "src/fields/Password/input.tsx",
                        lineNumber: 72,
                        columnNumber: 9
                    }, this),
                    /*#__PURE__*/ _jsxDEV(RenderCustomComponent, {
                        CustomComponent: Description,
                        Fallback: /*#__PURE__*/ _jsxDEV(FieldDescription, {
                            description: description,
                            path: path
                        }, void 0, false, {
                            fileName: "src/fields/Password/input.tsx",
                            lineNumber: 92,
                            columnNumber: 21
                        }, void 0)
                    }, void 0, false, {
                        fileName: "src/fields/Password/input.tsx",
                        lineNumber: 90,
                        columnNumber: 9
                    }, this)
                ]
            }, void 0, true, {
                fileName: "src/fields/Password/input.tsx",
                lineNumber: 67,
                columnNumber: 7
            }, this)
        ]
    }, void 0, true, {
        fileName: "src/fields/Password/input.tsx",
        lineNumber: 46,
        columnNumber: 5
    }, this);
};

//# sourceMappingURL=input.js.map