garage-erp/shared/components/form/fields/rhf-checkbox-field.tsx
2026-03-26 03:49:05 +03:00

25 lines
732 B
TypeScript

"use client"
import type { FieldValues, FieldPath } from "react-hook-form"
import { RhfField } from "../rhf-field"
import { CheckboxField, type CheckboxFieldProps } from "../controls/checkbox-field"
import type { BaseFieldControlProps } from "../types"
type RhfCheckboxFieldProps<
TValues extends FieldValues,
TName extends FieldPath<TValues>,
> = {
name: TName
label?: string
description?: string
required?: boolean
disabled?: boolean
} & Omit<CheckboxFieldProps, keyof BaseFieldControlProps<boolean>>
export function RhfCheckboxField<
TValues extends FieldValues,
TName extends FieldPath<TValues>,
>(props: RhfCheckboxFieldProps<TValues, TName>) {
return <RhfField {...props} component={CheckboxField} />
}