import { CheckboxProps } from "@trackunit/react-form-components"; import { ReactElement, SyntheticEvent } from "react"; import { FieldValues, UseFormRegister, UseFormSetValue } from "react-hook-form"; import { ValidationRules } from "./getValidationRules"; import { FormGroupExposedProps } from "./types"; export interface BooleanCustomFieldProps extends Omit, FormGroupExposedProps { /** * A id for the field * * @memberof BooleanCustomFieldProps */ id: string; /** * A value to be displayed by a input field * * @memberof BooleanCustomFieldProps */ description?: string; /** * A text to be displayed under the input with a short description of field purpose * * @memberof BooleanCustomFieldProps */ value?: boolean; /** * A default value to be displayed by a input field * * @memberof BooleanCustomFieldProps */ defaultValue?: boolean; /** * A id that can be used in tests to get the component * * @memberof BooleanCustomFieldProps */ "data-testid"?: string; /** * A custom handler for onChange event * * @memberof BooleanCustomFieldProps */ onChange?: (event: SyntheticEvent) => void; /** * A flag that can be used to disable the input, default value is false * * @memberof BooleanCustomFieldProps */ disabled?: boolean; /** * Used for field validation by React Hook Form library it dynamically set the value of a registered field and have the options to validate and update the form state. At the same time, it tries to avoid unnecessary rerender. * * @memberof BooleanCustomFieldProps */ setValue?: UseFormSetValue; /** * This method allows you to register an input or select element and apply validation rules to React Hook Form. Validation rules are all based on the HTML standard and also allow for custom validation methods. * * @memberof BooleanCustomFieldProps */ register?: UseFormRegister; /** * Validation rules that can be passed to the field, they can be pass along with error messages. Rules are described here https://react-hook-form.com/api/useform/register * * @memberof BooleanCustomFieldProps */ validationRules?: ValidationRules; /** * If a value is set, the field is rendered in its invalid state. * * @memberof BooleanCustomFieldProps */ errorMessage?: string; } /** * A component that can be used to render a boolean field. * See BooleanCustomFieldProps for prop documentation. * * @returns {ReactElement} A component that can be used to render a boolean field. */ export declare const BooleanCustomField: ({ defaultValue, "data-testid": dataTestId, onChange, value, id, setValue, register, validationRules, disabled, readOnly, label, tip, isInvalid, errorMessage, helpAddon, maxLength, helpText, ...rest }: BooleanCustomFieldProps) => ReactElement;