UNPKG

@baseplate-dev/ui-components

Version:

Shared UI component library

36 lines 1.83 kB
import type { Control, FieldPath, FieldValues } from 'react-hook-form'; import type { FormFieldProps } from '#src/types/form.js'; export interface ColorPickerFieldProps extends FormFieldProps { className?: string; wrapperClassName?: string; disabled?: boolean; placeholder?: string; onChange?: (value: string) => void; formatColorName?: (value: string) => string; value?: string; hideText?: boolean; /** * Parse a color string into a hex color. * @param color - The color string to parse. * @returns The hex color. */ parseColor?: (color: string) => string; /** * Serialize a hex color into a color string. * @param hex - The hex color to serialize. * @returns The color string. */ serializeColor?: (hex: string) => string; ref?: React.Ref<HTMLButtonElement>; } /** * Field with label and error states that wraps a ColorPicker component. */ declare function ColorPickerField({ className, wrapperClassName, disabled, placeholder, onChange, value, label, error, description, hideText, formatColorName, parseColor, serializeColor, ref, }: ColorPickerFieldProps): React.ReactElement; export interface ColorPickerFieldControllerProps<TFieldValues extends FieldValues = FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Omit<ColorPickerFieldProps, 'value'> { control: Control<TFieldValues>; name: TFieldName; } declare function ColorPickerFieldController<TFieldValues extends FieldValues = FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ control, name, ref, ...rest }: ColorPickerFieldControllerProps<TFieldValues, TFieldName>): React.ReactElement; export { ColorPickerField, ColorPickerFieldController }; //# sourceMappingURL=color-picker-field.d.ts.map