refactor(monorepo): decouple api and webui into workspaces packages

This commit is contained in:
yiling
2026-06-01 23:35:00 +08:00
parent e3f4fa219e
commit 1f341c15d0
288 changed files with 18024 additions and 21178 deletions
@@ -0,0 +1,36 @@
import * as React from 'react'
import { Input } from './input'
interface DebouncedInputProps extends Omit<
React.ComponentProps<typeof Input>,
'onChange' | 'value'
> {
value: string | number
onChange: (value: string | number) => void
debounce?: number
}
export function DebouncedInput({
value: initialValue,
onChange,
debounce = 500,
...props
}: DebouncedInputProps) {
const [value, setValue] = React.useState(initialValue)
React.useEffect(() => {
setValue(initialValue)
}, [initialValue])
React.useEffect(() => {
const timeout = setTimeout(() => {
if (value !== initialValue) {
onChange(value)
}
}, debounce)
return () => clearTimeout(timeout)
}, [value, debounce, onChange, initialValue])
return <Input {...props} value={value} onChange={(e) => setValue(e.target.value)} />
}