import React, { useState } from 'react'; import { Box, Text, useFocus } from 'ink'; import TextInput from 'ink-text-input'; interface InputProps { mask?: boolean; children?: React.ReactNode; onSetValue: (key: string) => void; autoFocus?: boolean; id: string; disabled?: boolean; } export const Input = ({ onSetValue, mask, children, id, disabled, autoFocus }: InputProps) => { const [inputValue, setInputValue] = useState(''); const [error, setError] = useState(null); const { isFocused } = useFocus({ id, autoFocus }); return ( {children} { if (!value.trim()) { setError('Value cannot be empty'); return; } try { onSetValue(value.trim()); setError(null); } catch (err) { setError('Invalid format'); } }} /> {error && {error}} ); };