Repository URL to install this package:
|
Version:
2.8.0-studio-release ▾
|
import React from 'react';
import { ComponentClass, Component, ClassicComponent, ComponentElement } from 'react';
import { Serializable } from '@skava/typings';
import { HTMLInputElementReact, InputValue, InputType as ObserverInputType } from './typings.inputs';
export * from './typings.inputs';
export declare type InputStringType = 'text' | 'radio' | 'radioGroup' | 'groupedElements' | 'textarea' | 'checkbox' | 'email' | 'telephone' | 'password' | 'confirmPassword' | 'button' | 'flatButton' | 'label' | 'googleAutoSugggest' | 'dropdown' | string;
export interface InputStateMethodsType<Props = any> {
updateFocused(event: Event, input?: InputStateType | Component<Props>): void;
validateInput(input: InputStateType): void;
validateInput(event: Event, input: InputStateType): void;
setValue(value?: string | boolean): InputStateType;
getValue(identifierOrName: string): any;
setInputReference(input: HTMLInputElement): void;
setProps(props: React.Attributes): void;
toJSON(): Serializable;
toString(): string;
}
export declare class InputStateType<Props = any> {
dynamicState?: {
[key: string]: any;
};
input: HTMLInputElementReact | ObserverInputType;
value: InputValue;
props: Props;
index: number;
isFocused: false | true;
isValid: true | false;
isValidInput: true | false;
hasValidationError?: false | true;
errorMessage?: string;
errorMessageFor?: string;
elementList?: Array<InputStateType>;
/**
* @description for checkboxes & radios
*/
isSelected?: boolean;
isRequired?: boolean;
isEnabled?: boolean;
identity?: 'name' | string;
identifier?: string;
name?: '' | string;
_identifier?: string;
/**
* @todo Array
* @description commaSeparatedArray or array (currently only array)
*/
validationType?: string | Array<string | Function>;
type?: InputStringType;
/**
* added
*/
isVisible?: boolean;
isHidden?: boolean;
}
export declare type InputStateComposedType = InputStateType & InputStateMethodsType & ObserverInputProps;
export interface ObserverInputComponent<Props extends ObserverInputProps = ObserverInputProps> extends ComponentClass<Props> {
state: InputStateType;
}
export interface InputTypeHandlers {
handleChange(event: MouseEvent): void;
handleFocus(event: MouseEvent): void;
handleBlur(event: MouseEvent): void;
}
export declare type ReactInput = ComponentElement<ObserverInputProps, ClassicComponent<ObserverInputProps>>;
export interface InputTypeActions {
toggleCheckBox(): ReactInput;
updateDropDownState(): ReactInput;
}
export interface RenderPropPluginCapable extends InputTypeHandlers, InputTypeActions {
renderGroupBox(): ReactInput;
renderTextBox(): ReactInput;
renderTextArea(): ReactInput;
renderRadioGroup(): ReactInput;
renderCheckBox(): ReactInput;
renderFlatButton(): ReactInput;
renderLabel(): ReactInput;
renderButton(): ReactInput;
renderGoogleSuggestionInput(): ReactInput;
renderSelectBoxWithHeading(): ReactInput;
formControls(): ReactInput;
renderWrap(): ReactInput;
}
export interface ObserverInputProps {
onToggle?: (state: InputStateType) => void;
onClick?: () => void;
className?: string;
elementList?: InputConfig[];
isHidden?: boolean;
type: InputStringType;
placeholderText?: string;
state?: InputStateType;
[key: string]: any;
}
export declare type Value = string | number | boolean;
export interface InputConfig {
identifier?: string;
name?: string;
label?: string;
value: Value;
type: string;
state?: InputStateType;
}