@sheerid/jslib-nightly
Version:
SheerID JavaScript Library
35 lines (33 loc) • 1.46 kB
TypeScript
import { default as React } from 'react';
import { InjectedIntlProps } from 'react-intl';
import { CustomFormFieldConfig, VerificationService } from '../../../lib/types/types';
export declare const FormFieldConfigType: {
readonly TEXT: "text";
readonly CHECKBOX: "checkbox";
readonly SELECT: "select";
readonly RADIO: "radio";
readonly DATE: "date";
readonly DATEYM: "dateYm";
};
export interface FormFieldCustomProps extends InjectedIntlProps {
config: CustomFormFieldConfig;
verificationService: VerificationService;
}
export interface FormFieldBaseComponentProps<TFieldValue> {
fieldId: string;
value: TFieldValue;
onChange: (value: TFieldValue) => void;
label: React.ReactNode;
errorMessage?: React.ReactNode;
}
export declare const getMessageIdForLabel: (config: CustomFormFieldConfig) => string;
export declare const getMessageIdForExplanation: (config: CustomFormFieldConfig) => string;
export declare const getMessageIdForPlaceholder: (config: CustomFormFieldConfig) => string;
/**
* Custom form field component.
* Implementors can render a form field passing in config using setOptions, rather than
* having to create an entire React project and override component(s).
*/
export declare const FormFieldCustom: React.ComponentClass<Pick<FormFieldCustomProps, "verificationService" | "config">, any> & {
WrappedComponent: React.ComponentType<FormFieldCustomProps & InjectedIntlProps>;
};