@telsystems/inputs
Version:
307 lines (260 loc) • 7.34 kB
TypeScript
import * as React from 'react';
type TLabelPosition = 'top' | 'left' | 'right';
export = Inputs;
export as namespace Inputs;
declare namespace Inputs {
/**
* Button компоненты кнопки
*/
const BTN_LG_SIZE = 'large';
const BTN_MD_SIZE = 'medium';
const BTN_SM_SIZE = 'small';
const BTN_PRIMARY_TYPE = 'primary';
const BTN_SECONDARY_TYPE = 'secondary';
const BTN_PAPER_TYPE = 'paper';
type TButtonSize = 'large' | 'medium' | 'small';
type TButtonType = 'primary' | 'secondary' | 'paper';
interface IButtonProps {
className?: string;
size?: TButtonSize;
type?: TButtonType;
disabled?: boolean;
isWaiting?: boolean;
onClick: (e: any) => void;
}
class Button extends React.Component<IButtonProps, any> {
public render(): JSX.Element;
}
/**
* IconButton - кнопка с иконкой
*/
type TIconButtonSize = TButtonSize;
type TIconButtonType = TButtonType;
interface IIconButtonProps extends IButtonProps {
iconId: string | number;
}
class IconButton extends React.Component<IIconButtonProps, any> {
public render(): JSX.Element;
}
/**
* DropDownButton - кнопка с многоточием для дропдаунов
*/
type TDropDownButtonSize = TButtonSize;
type TDropDownButtonType = TButtonType;
interface IDropDownButtonProps extends IButtonProps {
isActive?: boolean;
}
class DropDownButton extends React.Component<IDropDownButtonProps, any> {
public render(): JSX.Element;
}
/**
* TextInput - обыкновенное текстовое поле
*/
const INPUT_TYPE_TEXT = 'text';
const INPUT_TYPE_SEARCH = 'search';
type TTextInputType = 'text' | 'search';
type TValue = string | number;
interface IInputProps {
className?: string;
disabled?: boolean;
errorText?: string;
isWaiting?: boolean;
isPassword?: boolean;
placeholder?: string;
textAlignRight?: boolean;
value?: TValue;
onFocus?: (e: any) => void;
onBlur?: (e: any) => void;
onKeyDown?: (e: any) => void;
onKeyUp?: (e: any) => void;
onChange?: (value: string, e: object) => void;
getRef?: (input: HTMLElement) => void;
// указывает на то, будет ли кнопка для очищения значения
clearable?: boolean;
type?: TTextInputType;
incremental?: boolean;
}
class TextInput extends React.Component<IInputProps, any> {
public render(): JSX.Element;
}
/**
* MaskedInput - поле с маской
*/
interface IFormatOptions {
reverse?: boolean;
}
interface IMaskedInputProps extends IInputProps{
mask: string;
separators: string[];
value?: string;
formatOptions?: IFormatOptions;
}
class MaskedInput extends React.Component<IMaskedInputProps, any> {
public render(): JSX.Element;
}
/**
* NumericInput - поле для ввода числовых значений
*/
interface INumericInputProps extends IInputProps {
separateThousands?: boolean;
min?: number;
max?: number;
nullable?: boolean;
fractionDigits?: number;
fractionMask?: boolean;
integerMask?: string;
integerMaskParams?: object;
}
class NumericInput extends React.Component<INumericInputProps, any> {
public render(): JSX.Element;
}
/**
* Checkbox
*/
interface ICheckbox {
label: string;
selectedText?: string;
className?: string;
disabled?: boolean;
checked?: boolean;
labelAlign?: TLabelPosition;
onClick?: () => void;
}
class Checkbox extends React.Component<ICheckbox, any> {
public render(): JSX.Element;
}
/**
* DropDown
*/
interface IBasicDropDownItemContent {
title: string;
originTitle?: string;
}
interface IBasicDropDownItem {
content: IDropDownItemContent;
disabled?: boolean;
selected?: boolean;
useCheckbox?: boolean;
clearSelectedButton?: boolean;
onClick?: (e: any) => void;
CustomItem?: () => React.ReactNode;
}
const DROPDOWN_POSITION_LEFT = 'left';
const DROPDOWN_POSITION_RIGHT = 'right';
type TDropDownPosition = 'left' | 'right';
interface IBasicDropDown {
children: React.ReactNode | React.ReactNode[];
className?: string;
style?: object;
height?: number;
items: IDropDownItem[];
hideAfterClick?: boolean;
disabled?: boolean;
onItemClick: (itemData: IDropDownItemContent, index: number, e: any) => void;
onOpen?: () => void;
onClose?: () => void;
onClear?: () => void;
position: TDropDownPosition;
}
interface IDropDownItemContent extends IBasicDropDownItemContent {
}
interface IDropDownItem extends IBasicDropDownItem {
}
interface IDropDown extends IBasicDropDown {
openOnHover?: boolean;
useCheckbox?: boolean;
clearSelectedButton?: boolean;
}
class DropDown extends React.PureComponent<IDropDown, any> {
public render(): JSX.Element;
}
/**
* Select exports
*/
interface ISelectItemContent extends IBasicDropDownItemContent {
}
interface ISelectItem extends IBasicDropDownItem {
content: ISelectItemContent;
}
interface ISelect extends IBasicDropDown {
placeholder?: string;
selectedIndex?: number;
items: ISelectItem[];
onItemClick: (itemData: ISelectItemContent, index: number, e: any) => void;
}
interface ISuggestingInput extends ISelect {
value: string;
onChange: (suggestText: string) => void;
}
interface ISelectInput {
value?: string;
placeholder?: string;
disabled?: boolean;
readOnly?: boolean;
active?: boolean;
selectedCount?: number;
onClick?: (e: any) => void;
}
class Select extends React.PureComponent<ISelect, any> {
public render(): JSX.Element;
}
/**
* MultiSelect exports
*/
interface IMultiSelectItemContent extends IDropDownItemContent {
}
interface IMultiSelectItem extends IDropDownItem {
content: IMultiSelectItemContent;
}
interface IMultiSelectInput extends ISelectInput{
}
interface IMultiSelect extends ISelect {
useCheckbox?: boolean;
clearSelectedButton?: boolean;
items: IMultiSelectItem[];
onItemClick: (itemData: IMultiSelectItemContent, index: number, e: any) => void;
groupName?: string;
}
class MultiSelect extends React.PureComponent<IMultiSelect, any> {
public render(): JSX.Element;
}
type TMergedProps = IDropDown & IMultiSelect;
class BasicDropDown extends React.PureComponent<TMergedProps, any> {
public render(): JSX.Element;
}
/**
* Toggle
*/
interface IToggle {
label: string;
selectedText?: string;
className?: string;
disabled?: boolean;
checked?: boolean;
labelAlign?: TLabelPosition;
onClick?: () => void;
}
class Toggle extends React.PureComponent<IToggle, any> {
public render(): JSX.Element;
}
/**
* Radio
*/
interface IRadioItem {
value: string;
label: string;
selectedText?: string;
checked?: boolean;
disabled?: boolean;
}
interface IRadio {
items: IRadioItem[];
className?: string;
labelAlign?: TLabelPosition;
onChange?: (e: any) => void;
itemClassName?: string;
}
class Radio extends React.PureComponent<IRadio, any> {
public render(): JSX.Element;
}
}