import * as React from 'react';
import { cn } from '@/lib/utils';
const Textarea = React.forwardRef<
HTMLTextAreaElement,
React.ComponentProps<'textarea'>
>(({ className, ...props }, ref) => {
return (
);
});
Textarea.displayName = 'Textarea';
export { Textarea };
type Value = string | readonly string[] | number | undefined;
export const BlurTextarea = React.forwardRef<
HTMLTextAreaElement,
React.ComponentProps<'textarea'> & {
value: Value;
onChange(value: Value): void;
}
>(({ value, onChange, ...props }, ref) => {
const [val, setVal] = React.useState();
const handleChange: React.ChangeEventHandler =
React.useCallback((e) => {
setVal(e.target.value);
}, []);
const handleBlur: React.FocusEventHandler =
React.useCallback(
(e) => {
onChange?.(e.target.value);
},
[onChange],
);
React.useEffect(() => {
setVal(value);
}, [value]);
return (
);
});