The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import { useCommitOnBlur } from "~/hooks/useCommitOnBlur"; |
| 2 | import { Input, type InputProps } from "./input"; |
| 3 | |
| 4 | export type DraftInputProps = Omit<InputProps, "value" | "onChange" | "defaultValue"> & { |
| 5 | readonly value: string; |
| 6 | readonly onCommit: (next: string) => void; |
| 7 | readonly normalizeDraft?: (previous: string, next: string) => string; |
| 8 | }; |
| 9 | |
| 10 | /** Commit drafts without settings-wide rerenders or server round trips per keystroke. */ |
| 11 | export function DraftInput({ value, onCommit, normalizeDraft, ...rest }: DraftInputProps) { |
| 12 | const bag = useCommitOnBlur(value, onCommit, normalizeDraft); |
| 13 | return <Input {...rest} {...bag} />; |
| 14 | } |