(text: string)
| 43 | }; |
| 44 | |
| 45 | const onSlice = (text: string) => { |
| 46 | const sliced = text.slice(0, length); |
| 47 | setCode(sliced.split('')); |
| 48 | onChange?.(sliced); |
| 49 | |
| 50 | if (sliced.length === length) { |
| 51 | onSubmit(sliced); |
| 52 | } |
| 53 | }; |
| 54 | |
| 55 | const onPaste: ClipboardEventHandler<HTMLInputElement> = (e) => { |
| 56 | const text = e.clipboardData.getData('text'); |