ontime-components
Version:
List of react components
53 lines (52 loc) • 1.83 kB
TypeScript
import React, { Component } from 'react';
import { IProps, IState } from '../../libs/interfaces';
import { TSize } from '../Button';
import { TError } from '../InputErrors';
declare type TLabelPosition = 'top' | 'left' | 'right';
declare type TKind = 'radio' | 'button';
declare type TPosition = 'row' | 'column';
interface IRadioGroupProps extends IProps {
label?: string;
labelPosition?: TLabelPosition;
required?: boolean;
name?: string;
kind?: TKind;
position?: TPosition;
size?: TSize;
data?: any[];
mapValue?: string | Function;
errors?: TError[] | null;
onClick?: Function;
onBlur?: Function;
onChange?: Function;
value?: string | number | any;
}
interface IRadioGroupDefProps {
labelPosition: TLabelPosition;
position: TPosition;
kind: TKind;
size: TSize;
data: any[];
}
interface IRadioGroupState extends IState {
value: boolean;
}
declare class RadioGroup extends Component<IRadioGroupProps & IRadioGroupDefProps, IRadioGroupState> {
static defaultProps: IRadioGroupDefProps;
readonly state: IRadioGroupState;
static getDerivedStateFromProps(nextProps: any, prevState: any): {
value: any;
} | null;
constructor(props: IRadioGroupProps & IRadioGroupDefProps);
value: boolean;
setState(state: IRadioGroupState): Promise<unknown>;
onClick(value: string | number | any, e: React.MouseEvent<HTMLElement, MouseEvent>): void;
onChange(value: string | number | any): void;
onBlur(value: string | number | any): void;
renderLabel(): JSX.Element;
renderErrors(): JSX.Element | null;
renderRadio(value: any, idx: number): JSX.Element;
renderInput(): JSX.Element;
render(): JSX.Element;
}
export { RadioGroup, IRadioGroupProps, IRadioGroupState, TLabelPosition, TKind, TPosition };