@arche-mc2/arche-controls
Version:
We know that there are a ton of react UI library projects to choose from. Our hope with this one is to provide the next generation of react components that you can use to bootstrap your next project, or as a reference for building a UIKit. Read on to get
63 lines (62 loc) • 2.52 kB
TypeScript
import * as React from 'react';
import ValidationManager from '../Validation/ValidationManager';
import { ErrorDisplayMode } from '../Validation/ErrorDisplay';
import { Tooltip } from '../../../Display/Tooltip/types';
import { WithThemeProps } from '../../../../Common/theming/withTheme';
import { TestableComponentProps } from '../../../../Common/utils/types';
declare type RenderHelp = (children: React.ReactNode) => JSX.Element;
export interface BaseControlProps<_BaseType> extends TestableComponentProps, WithThemeProps {
name?: string;
onChange?: (event: React.ChangeEvent<any>, arg: _BaseType, error: string) => void;
value?: _BaseType;
defaultValue?: _BaseType;
disabled?: boolean;
readonly?: boolean;
tooltip?: string | Tooltip;
isRequired?: boolean;
showError?: boolean;
hasError?: boolean;
showSuccess?: boolean;
errorDisplayMode?: ErrorDisplayMode;
error?: string;
touched?: boolean;
helpMessage?: string | RenderHelp;
tabIndex?: number;
onClear?: () => void;
maxCharMsg?: string;
maxCharMsgShowNumber?: number;
forceMaxChar?: boolean;
}
export interface BaseControlState<_BaseType> {
error?: string;
value?: _BaseType;
extra?: any;
}
export declare abstract class BaseControlComponent<_Props, _BaseType> extends React.Component<BaseControlProps<_BaseType> & _Props, BaseControlState<_BaseType>> {
_validationManager: ValidationManager;
static defaultProps: BaseControlProps<any>;
constructor(props?: BaseControlProps<_BaseType> & _Props, context?: any);
private initWithProps;
protected registerValidations(): void;
abstract getValue(args: any): _BaseType;
protected setValue: (receiveValue: any) => _BaseType;
get isControlled(): boolean;
get currentValue(): _BaseType;
abstract renderControl(): JSX.Element;
private checkAndDispatch;
validateProps(nextProps: any): void;
handleChangeEvent: (event: React.ChangeEvent<any>, value?: _BaseType) => void;
handleClearEvent: (value: _BaseType) => void;
private checkData;
get hasError(): boolean;
abstract showError(): any;
abstract showSuccess(): any;
get error(): string;
onFocus: (event: any) => void;
onBlur: (event: any) => void;
get isFocused(): boolean;
get isTouched(): boolean;
render(): any;
dispatchOnChange: (data: _BaseType, event: React.ChangeEvent<any>, error: string) => void;
}
export {};