UNPKG

@gpa-gemstone/react-forms

Version:
73 lines (72 loc) 1.8 kB
import * as React from 'react'; export interface IOption { Value: any; Element: React.ReactElement<any> | string; } interface IProps<T> { /** * Function to determine the validity of a field * @param field - Field of the record to check * @returns {boolean} */ Valid?: (field: keyof T) => boolean; /** * Feedback message to show when input is invalid * @type {string} * @optional */ Feedback?: string; /** * Record to be used in form * @type {T} */ Record: T; /** * Field of the record to be edited * @type {keyof T} */ Field: keyof T; /** * Label to display for the form, defaults to the Field prop * @type {string | JSX.Element} * @optional */ Label?: string | JSX.Element; /** * Help message or element to display * @type {string | JSX.Element} * @optional */ Help?: string | JSX.Element; /** * Flag to disable the input field * @type {boolean} * @optional */ Disabled?: boolean; /** * Setter function to update the Record * @param record - Updated Record */ Setter: (record: T, option: IOption) => void; /** * Options for the select dropdown * @type {{ Value: any, Element: React.ReactElement<any> }[]} */ Options: IOption[]; /** * CSS styles to apply to the selected value * @type {React.CSSProperties} * @optional */ Style?: React.CSSProperties; /** * CSS style to apply to the button holding the selected value * @type {React.CSSProperties} * @optional * */ BtnStyle?: React.CSSProperties; } export default function StylableSelect<T>(props: IProps<T>): JSX.Element; export {};