AI Plan Generation. Clear button sets focus

This commit is contained in:
AG
2025-12-15 22:46:04 +02:00
parent 854eda98d2
commit c275804fbc
9 changed files with 542 additions and 9 deletions

View File

@@ -26,6 +26,7 @@ const FilledInput: React.FC<FilledInputProps> = ({
multiline = false, rows = 3
}) => {
const id = useId();
const inputRef = React.useRef<HTMLInputElement | HTMLTextAreaElement>(null);
const handleClear = () => {
const syntheticEvent = {
@@ -33,6 +34,7 @@ const FilledInput: React.FC<FilledInputProps> = ({
} as React.ChangeEvent<HTMLInputElement>;
onChange(syntheticEvent);
if (onClear) onClear();
inputRef.current?.focus();
};
return (
@@ -43,6 +45,7 @@ const FilledInput: React.FC<FilledInputProps> = ({
{!multiline ? (
<input
ref={inputRef as React.RefObject<HTMLInputElement>}
id={id}
type={type}
step={step}
@@ -59,6 +62,7 @@ const FilledInput: React.FC<FilledInputProps> = ({
/>
) : (
<textarea
ref={inputRef as React.RefObject<HTMLTextAreaElement>}
id={id}
rows={rows}
className={`w-full pt-6 pb-2 pl-4 bg-transparent text-body-lg text-on-surface focus:outline-none placeholder-transparent resize-none ${rightElement ? 'pr-20' : 'pr-10'}`}