2025-08-24 16:41:44 +03:00
|
|
|
import { RefObject, TextareaHTMLAttributes } from "preact/compat";
|
2025-08-24 15:48:53 +03:00
|
|
|
|
|
|
|
|
interface FormTextAreaProps extends Omit<TextareaHTMLAttributes, "onBlur" | "onChange"> {
|
2025-08-19 22:54:15 +03:00
|
|
|
id?: string;
|
2025-08-19 13:46:13 +03:00
|
|
|
currentValue: string;
|
2025-08-24 15:48:53 +03:00
|
|
|
onChange?(newValue: string): void;
|
2025-08-19 13:46:13 +03:00
|
|
|
onBlur?(newValue: string): void;
|
2025-08-24 16:41:44 +03:00
|
|
|
inputRef?: RefObject<HTMLTextAreaElement>
|
2025-08-19 13:46:13 +03:00
|
|
|
}
|
2025-08-24 20:23:00 +03:00
|
|
|
export default function FormTextArea({ inputRef, id, onBlur, onChange, currentValue, className, ...restProps }: FormTextAreaProps) {
|
2025-08-19 13:46:13 +03:00
|
|
|
return (
|
|
|
|
|
<textarea
|
2025-08-24 16:41:44 +03:00
|
|
|
ref={inputRef}
|
2025-08-19 22:54:15 +03:00
|
|
|
id={id}
|
2025-08-24 15:29:07 +03:00
|
|
|
className={`form-control ${className ?? ""}`}
|
2025-08-24 15:48:53 +03:00
|
|
|
onChange={(e) => {
|
|
|
|
|
onChange?.(e.currentTarget.value);
|
|
|
|
|
}}
|
2025-08-19 13:46:13 +03:00
|
|
|
onBlur={(e) => {
|
|
|
|
|
onBlur?.(e.currentTarget.value);
|
|
|
|
|
}}
|
2025-08-19 17:39:41 +03:00
|
|
|
style={{ width: "100%" }}
|
2025-08-24 15:48:53 +03:00
|
|
|
{...restProps}
|
2025-08-19 13:46:13 +03:00
|
|
|
>{currentValue}</textarea>
|
|
|
|
|
)
|
|
|
|
|
}
|