UNPKG

@baseplate-dev/ui-components

Version:

Shared UI component library

41 lines 2.23 kB
import type React from 'react'; import type { Control, FieldPath, FieldValues } from 'react-hook-form'; import type { FormFieldProps, MultiSelectOptionProps } from '#src/types/form.js'; export interface MultiSwitchFieldProps<OptionType> extends MultiSelectOptionProps<OptionType>, FormFieldProps { value?: string[]; onChange?: (value: string[]) => void; className?: string; disabled?: boolean; } interface MultiSwitchFieldControllerPropsBase<OptionType, TFieldValues extends FieldValues = FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Omit<MultiSwitchFieldProps<OptionType>, 'value'> { control: Control<TFieldValues>; name: TFieldName; } type MultiSwitchFieldControllerProps<OptionType, TFieldValues extends FieldValues = FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = MultiSwitchFieldControllerPropsBase<OptionType, TFieldValues, TFieldName>; export declare const MultiSwitchField: (<OptionType>(props: MultiSwitchFieldProps<OptionType> & (OptionType extends { label: string; } ? unknown : { renderItemLabel?: ((value: OptionType, options: { selected: boolean; }) => React.ReactNode) | undefined; getOptionLabel: (value: OptionType) => string; }) & (OptionType extends { value: string; } ? unknown : { getOptionValue: (value: OptionType) => string | null; }) & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null) & { Controller: <OptionType, TFieldValues extends FieldValues = FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(props: MultiSwitchFieldControllerProps<OptionType, TFieldValues, TFieldName> & (OptionType extends { label: string; } ? unknown : { renderItemLabel?: ((value: OptionType, options: { selected: boolean; }) => React.ReactNode) | undefined; getOptionLabel: (value: OptionType) => string; }) & (OptionType extends { value: string; } ? unknown : { getOptionValue: (value: OptionType) => string | null; }) & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null; }; export {}; //# sourceMappingURL=multi-switch-field.d.ts.map