mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-11 10:57:38 +03:00
35 lines
820 B
TypeScript
35 lines
820 B
TypeScript
|
|
// Textarea Widget - maps to shadcn/ui Textarea
|
||
|
|
import type { WidgetProps } from "@rjsf/utils";
|
||
|
|
import { Textarea } from "@/components/ui/textarea";
|
||
|
|
|
||
|
|
export function TextareaWidget(props: WidgetProps) {
|
||
|
|
const {
|
||
|
|
id,
|
||
|
|
value,
|
||
|
|
disabled,
|
||
|
|
readonly,
|
||
|
|
onChange,
|
||
|
|
onBlur,
|
||
|
|
onFocus,
|
||
|
|
placeholder,
|
||
|
|
schema,
|
||
|
|
options,
|
||
|
|
} = props;
|
||
|
|
|
||
|
|
return (
|
||
|
|
<Textarea
|
||
|
|
id={id}
|
||
|
|
value={value ?? ""}
|
||
|
|
disabled={disabled || readonly}
|
||
|
|
placeholder={placeholder || (options.placeholder as string) || ""}
|
||
|
|
rows={(options.rows as number) || 3}
|
||
|
|
onChange={(e) =>
|
||
|
|
onChange(e.target.value === "" ? undefined : e.target.value)
|
||
|
|
}
|
||
|
|
onBlur={(e) => onBlur(id, e.target.value)}
|
||
|
|
onFocus={(e) => onFocus(id, e.target.value)}
|
||
|
|
aria-label={schema.title}
|
||
|
|
/>
|
||
|
|
);
|
||
|
|
}
|