'use client' import type { FC } from 'react' import { useCallback } from 'react' import { normaliseUserCodeInput } from '../utils/user-code' type Props = { value: string onChange: (normalised: string) => void disabled?: boolean autoFocus?: boolean } /** * CodeInput renders the user_code text field with live normalisation * (uppercase, reduced alphabet, XXXX-XXXX hyphenation). * * The onChange callback receives the normalised value only — the parent does * not need to run validation itself. */ const CodeInput: FC = ({ value, onChange, disabled, autoFocus }) => { const handle = useCallback((raw: string) => { onChange(normaliseUserCodeInput(raw)) }, [onChange]) return ( handle(e.target.value)} /> ) } export default CodeInput