mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-23 04:09:04 +03:00
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
* resolve zone friendly names against the correct camera * Improve handling of zone names in chat prompt * show a numeric keyboard for numeric config form fields on mobile * Specify english only for semantic search tool when model is JinaV1 * resolve export hwaccel args global value against the correct config path --------- Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
// Text Widget - maps to shadcn/ui Input
|
|
import type { WidgetProps } from "@rjsf/utils";
|
|
import { Input } from "@/components/ui/input";
|
|
import { cn } from "@/lib/utils";
|
|
import { getNumericInputMode, getSizedFieldClassName } from "../utils";
|
|
|
|
export function TextWidget(props: WidgetProps) {
|
|
const {
|
|
id,
|
|
value,
|
|
disabled,
|
|
readonly,
|
|
onChange,
|
|
onBlur,
|
|
onFocus,
|
|
placeholder,
|
|
schema,
|
|
options,
|
|
} = props;
|
|
|
|
const isNullable = Array.isArray(schema.type)
|
|
? schema.type.includes("null")
|
|
: false;
|
|
const fieldClassName = getSizedFieldClassName(options, "xs");
|
|
|
|
return (
|
|
<Input
|
|
id={id}
|
|
className={cn(fieldClassName)}
|
|
type="text"
|
|
inputMode={getNumericInputMode(schema, options)}
|
|
value={value ?? ""}
|
|
disabled={disabled || readonly}
|
|
placeholder={placeholder || (options.placeholder as string) || ""}
|
|
onChange={(e) =>
|
|
onChange(
|
|
e.target.value === ""
|
|
? isNullable
|
|
? null
|
|
: undefined
|
|
: e.target.value,
|
|
)
|
|
}
|
|
onBlur={(e) => onBlur(id, e.target.value)}
|
|
onFocus={(e) => onFocus(id, e.target.value)}
|
|
aria-label={schema.title}
|
|
/>
|
|
);
|
|
}
|