@gpa-gemstone/react-forms
Version:
React Form modules for gpa webapps
60 lines (59 loc) • 1.44 kB
TypeScript
import * as React from 'react';
import { ColorResult } from 'react-color';
interface IProps<T> {
/**
* Record to be used in the form
* @type {T}
*/
Record: T;
/**
* Field of the record to be edited
* @type {keyof T}
*/
Field: keyof T;
/**
* Setter function to update the Record
* @param record - Updated record of type T
* @param color - Color result from the picker
* @returns {void}
*/
Setter: (record: T, color: ColorResult) => void;
/**
* Label to display for the form, defaults to the Field prop
* @type {string}
* @optional
*/
Label: string;
/**
* Flag to disable the input field
* @type {boolean}
* @optional
*/
Disabled?: boolean;
/**
* Feedback message to show when input is invalid
* @type {string}
* @optional
*/
Feedback?: string;
/**
* CSS styles to apply to the button
* @type {React.CSSProperties}
* @optional
*/
Style?: React.CSSProperties;
/**
* List of colors to be used in the color picker
* @type {string[]}
* @optional
*/
Colors?: string[];
/**
* Position of the triangle pointer in the color picker
* @type {'hide' | 'top'}
* @optional
*/
Triangle?: 'hide' | 'top';
}
export default function ColorPicker<T>(props: IProps<T>): JSX.Element;
export {};