import { ChangeEvent } from 'react'; import { ariaDescribedByIds, FormContextType, getInputProps, RJSFSchema, StrictRJSFSchema, WidgetProps, } from '@snups/rjsf-utils'; import { ColorPicker } from 'primereact/colorpicker'; /** The `ColorWidget` component renders a color picker. * * @param props - The `WidgetProps` for this component */ export default function ColorWidget( props: WidgetProps, ) { const { id, placeholder, value, required, readonly, disabled, onChange, onChangeOverride, onBlur, onFocus, autofocus, options, schema, type, } = props; const inputProps = getInputProps(schema, type, options); const { inline } = options; const primeProps = (options.prime || {}) as object; const _onChange = ({ target: { value } }: ChangeEvent) => onChange(value === '' ? options.emptyValue : value); const _onBlur = () => onBlur && onBlur(id, value); const _onFocus = () => onFocus && onFocus(id, value); return ( (id, !!schema.examples)} /> ); }