import { forwardRef } from 'react'; import { useFormContext } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; import { FormControl, FormField, FormItem, FormLabel, FormMessage, } from './ui/form'; import { Input, InputProps } from './ui/input'; interface IProps { value?: string | undefined; onChange?: (val: string | undefined) => void; } export const DelimiterInput = forwardRef( ({ value, onChange, maxLength, defaultValue }, ref) => { const nextValue = value?.replaceAll('\n', '\\n'); const handleInputChange = (e: React.ChangeEvent) => { const val = e.target.value; const nextValue = val.replaceAll('\\n', '\n'); onChange?.(nextValue); }; return ( ); }, ); export function DelimiterFormField() { const { t } = useTranslation(); const form = useFormContext(); return ( ( {t('knowledgeDetails.delimiter')} )} /> ); }