2025-08-05 19:06:47 +03:00
|
|
|
import { HTMLInputTypeAttribute, RefObject } from "preact/compat";
|
2025-08-04 23:22:45 +03:00
|
|
|
|
2025-08-03 21:18:18 +03:00
|
|
|
interface FormTextBoxProps {
|
2025-08-04 23:22:45 +03:00
|
|
|
id?: string;
|
2025-08-03 21:18:18 +03:00
|
|
|
name: string;
|
2025-08-04 23:22:45 +03:00
|
|
|
type?: HTMLInputTypeAttribute;
|
2025-08-03 21:18:18 +03:00
|
|
|
currentValue?: string;
|
|
|
|
|
className?: string;
|
2025-08-04 23:22:45 +03:00
|
|
|
autoComplete?: string;
|
2025-08-03 21:18:18 +03:00
|
|
|
onChange?(newValue: string): void;
|
2025-08-05 19:06:47 +03:00
|
|
|
inputRef?: RefObject<HTMLInputElement>;
|
2025-08-03 21:18:18 +03:00
|
|
|
}
|
|
|
|
|
|
2025-08-05 19:06:47 +03:00
|
|
|
export default function FormTextBox({ id, type, name, className, currentValue, onChange, autoComplete, inputRef }: FormTextBoxProps) {
|
2025-08-03 21:18:18 +03:00
|
|
|
return (
|
2025-08-04 21:17:35 +03:00
|
|
|
<input
|
2025-08-05 19:06:47 +03:00
|
|
|
ref={inputRef}
|
2025-08-04 23:22:45 +03:00
|
|
|
type={type ?? "text"}
|
2025-08-05 19:06:47 +03:00
|
|
|
className={`form-control ${className ?? ""}`}
|
2025-08-04 23:22:45 +03:00
|
|
|
id={id}
|
2025-08-04 21:17:35 +03:00
|
|
|
name={name}
|
|
|
|
|
value={currentValue}
|
2025-08-04 23:22:45 +03:00
|
|
|
autoComplete={autoComplete}
|
2025-08-04 21:17:35 +03:00
|
|
|
onInput={e => onChange?.(e.currentTarget.value)} />
|
2025-08-03 21:18:18 +03:00
|
|
|
);
|
|
|
|
|
}
|