UNPKG

@baseplate-dev/ui-components

Version:

Shared UI component library

16 lines 1.18 kB
import type React from 'react'; import type { Control, FieldPath, FieldValues } from 'react-hook-form'; import type { FormFieldProps } from '#src/types/form.js'; import { Switch } from '../switch/switch.js'; export interface SwitchFieldProps extends Omit<React.ComponentPropsWithRef<typeof Switch>, 'onChange' | 'value' | 'onCheckedChange' | 'checked'>, FormFieldProps { onChange?: (value: boolean) => void; value?: boolean; } declare function SwitchField({ label, description, error, onChange, value, className, ...props }: SwitchFieldProps): React.ReactElement; export interface SwitchFieldControllerProps<TFieldValues extends FieldValues = FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Omit<SwitchFieldProps, 'value'> { control: Control<TFieldValues>; name: TFieldName; } declare function SwitchFieldController<TFieldValues extends FieldValues = FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ control, name, ...rest }: SwitchFieldControllerProps<TFieldValues, TFieldName>): React.JSX.Element; export { SwitchField, SwitchFieldController }; //# sourceMappingURL=switch-field.d.ts.map