import React from "react"; import { ColorPicker, ColorPickerProps } from "@mantine/core"; import { useController, FieldValues, UseControllerProps, } from "react-hook-form"; type Props = ColorPickerProps & { name: UseControllerProps["name"]; rules?: UseControllerProps["rules"]; defaultValue?: UseControllerProps["defaultValue"]; }; function RHFColorPicker(props: Props) { const { name, rules, defaultValue, ...others } = props; const { field, fieldState: { error }, } = useController({ name, rules }); return ; } export default RHFColorPicker; export const createColorPickerField = () => { const Field = (props: Props) => ; return Field; };