oneframe-react
Version:
Oneframe React ## Components, Hooks, Helper Functions & State Management
84 lines (83 loc) • 2.37 kB
TypeScript
import { ReactNode } from 'react';
import { IValidate } from '../../Form/type';
import NumberFormat from 'react-number-format';
export interface ITextFieldProps extends IMaskFormat {
className?: string;
variant?: 'standard' | 'filled' | 'outlined';
caption?: string;
errorText?: string;
leftAdornments?: () => ReactNode;
rightAdornments?: () => ReactNode;
captionActive?: boolean;
readOnly?: boolean;
disableUnderline?: boolean;
onRef?: (val: any) => void;
ref?: any;
id: string;
name: string;
numberFormat?: INumberFormatProps | boolean;
validate?: IValidate[];
setValidate?: any;
validateMessages?: any;
submitStatus?: boolean;
type?: string;
value?: unknown;
defaultValue?: string;
autoComplete?: string;
autoFocus?: boolean;
disabled?: boolean;
required?: boolean;
helperText?: string;
multiline?: boolean;
error?: any;
InputProps?: any;
InputLabelProps?: any;
inputProps?: any;
inputRef?: any;
rows?: number;
rowsMax?: number;
placeholder?: string;
fullWidth?: boolean;
size?: 'small' | 'medium' | undefined;
onClick?: any;
onChange?: (e: any) => void;
onBlur?: (e: any) => void;
onKeyPress?: (e: any) => void;
onKeyDown?: (e: any) => void;
onKeyUp?: (e: any) => void;
}
export interface IMaskProps {
mask?: any;
guide?: boolean;
showMask?: boolean;
keepCharPositions?: boolean;
placeholderChar?: 'space' | 'underscore' | undefined;
}
export interface IMaskFormat {
maskFormat?: any;
}
export interface INumberFormatProps {
thousandSeparator?: boolean | ',' | '.' | ' ';
decimalSeparator?: ',' | '.';
decimalScale?: number;
fixedDecimalScale?: boolean;
allowNegative?: boolean;
allowEmptyFormatting?: boolean;
prefix?: string;
suffix?: string;
type?: 'text' | 'tel' | 'password';
format?: string;
removeFormatting?: (formattedValue: string) => string;
mask?: string;
displayType?: 'input' | 'text' | undefined;
returnValue?: 'floatValue' | 'formattedValue' | 'value';
}
export interface INumberFormatCustomProps extends INumberFormatProps {
inputRef: (instance: NumberFormat | null) => void;
onChange: (event: {
target: {
value: any;
};
}) => void;
className?: string;
}