import { IconAlertCircle as AlertCircle, IconEye as Eye, IconEyeOff as EyeOff, IconKey as KeyRound, IconLock as LockKeyhole, IconMail as Mail, IconUser as UserRound, } from '@tabler/icons-react' import { useState } from 'react' import { t } from '@/shared/i18n' export interface FieldProps { name: string label: string value: string onInput?: (value: string) => void placeholder?: string type?: 'text' | 'email' | 'password' icon?: 'mail' | 'lock' | 'user' | 'key' helper?: string error?: string autoComplete?: string disabled?: boolean readOnly?: boolean maxLength?: number } const fieldIcons = { mail: Mail, lock: LockKeyhole, user: UserRound, key: KeyRound } export function Field({ name, label, value, onInput, placeholder, type = 'text', icon = 'mail', helper, error, autoComplete, disabled, readOnly, maxLength, }: FieldProps) { const [show, setShow] = useState(false) const Icon = fieldIcons[icon] const description = error || helper return (
{error &&