"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SwitchField = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const form_1 = require("../../../components/ui/form");
const switch_1 = require("../../../components/ui/switch");
const tooltip_1 = require("../../../components/ui/tooltip");
const SwitchField = ({ label, name, control, labelExtra, tooltip, required, disabled, disabledTooltip, 'data-testid': dataTestId }) => {
    return ((0, jsx_runtime_1.jsx)(form_1.FormField, { name: name, control: control, render: ({ field }) => ((0, jsx_runtime_1.jsxs)(form_1.FormItem, { required: required, children: [label && ((0, jsx_runtime_1.jsx)(form_1.FormLabel, { extra: tooltip ? (0, jsx_runtime_1.jsx)(form_1.FormTooltip, { children: tooltip }) : labelExtra, children: label })), (0, jsx_runtime_1.jsx)("div", { className: "relative", children: (0, jsx_runtime_1.jsx)(form_1.FormControl, { children: disabled && disabledTooltip ? ((0, jsx_runtime_1.jsx)(tooltip_1.TooltipProvider, { children: (0, jsx_runtime_1.jsxs)(tooltip_1.Tooltip, { children: [(0, jsx_runtime_1.jsx)(tooltip_1.TooltipTrigger, { asChild: true, children: (0, jsx_runtime_1.jsx)("div", { className: "inline-flex w-auto", children: (0, jsx_runtime_1.jsx)(switch_1.Switch, { checked: field.value, onCheckedChange: field.onChange, disabled: disabled }) }) }), (0, jsx_runtime_1.jsx)(tooltip_1.TooltipContent, { children: disabledTooltip })] }) })) : ((0, jsx_runtime_1.jsx)(switch_1.Switch, { checked: field.value, onCheckedChange: field.onChange, disabled: disabled, "data-testid": dataTestId })) }) }), (0, jsx_runtime_1.jsx)(form_1.FormMessage, {})] })) }));
};
exports.SwitchField = SwitchField;
