import { InfoIcon } from "lucide-react";
import { memo } from "react";
import {
type Control,
Controller,
type FieldValues,
type Path,
} from "react-hook-form";
import { Label } from "@/components/ui/label";
import { Switch } from "@/components/ui/switch";
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip";
// Hoisted static JSX to avoid recreation on each render
const infoIcon = (
);
interface SwitchFieldProps {
readonly name: Path;
readonly label: string;
readonly description: string;
readonly control: Control;
}
function SwitchFieldInner({
name,
label,
description,
control,
}: SwitchFieldProps) {
return (
(
{infoIcon}
{description}
)}
/>
);
}
export const SwitchField = memo(SwitchFieldInner) as typeof SwitchFieldInner;