/** * Copyright (c) 2023-present Plane Software, Inc. and contributors * SPDX-License-Identifier: AGPL-3.0-only * See the LICENSE file for details. */ import type { Control, FieldPath, FieldValues } from "react-hook-form"; import { Controller } from "react-hook-form"; // plane internal packages import { ToggleSwitch } from "@plane/ui"; type Props = { control: Control; field: TControllerSwitchFormField; }; export type TControllerSwitchFormField = { name: FieldPath; label: string; }; export function ControllerSwitch(props: Props) { const { control, field: { name, label }, } = props; return (

Refresh user attributes from {label} during sign in

} render={({ field: { value, onChange } }) => { const parsedValue = Number.parseInt(typeof value === "string" ? value : String(value ?? "0"), 10); const isOn = !Number.isNaN(parsedValue) && parsedValue !== 0; return onChange(isOn ? "0" : "1")} size="sm" />; }} />
); }