-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.d.ts
198 lines (184 loc) · 4.49 KB
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
import * as React from 'react';
import {MaskInputProps} from "@idui/react-mask-input";
export interface InputStateColorsSet {
border?: string;
color?: string;
background?: string;
placeholder?: string;
tag?: string;
}
export interface InputColors {
default?: InputStateColorsSet;
disabled?: InputStateColorsSet;
error?: InputStateColorsSet;
focused?: InputStateColorsSet;
}
export interface CommonInputProps extends MaskInputProps {
/**
* onChange input handler
*/
onChange?: (value: string) => void;
/**
* onClear input handler
*/
onClear?: () => void;
/**
* can value be empty or not
*/
required?: boolean;
/**
* is input readOnly
*/
readOnly?: boolean;
/**
* is input disabled
*/
disabled?: boolean;
/**
* is input has error
*/
hasError?: boolean;
/**
* call onChange with input value instead of whole Event. If mask provided then onlyValue would be true
* @default true
*/
onlyValue?: boolean;
/**
* whether user can clear input or not
* @default true
*/
isClearable?: boolean;
/**
* function that returns true if clear icon should be show depending on current value
* @default (value) => Boolean(value)
*/
isClearIconShown?: (inputValue: string) => boolean;
/**
* placement of clear icon
* @default 'right'
*/
clearIconPlacement?: 'right' | 'left';
/**
* input mask. If specified you can provide other props from @idui/react-mask-input
*/
mask?: string;
/**
* element, embedded to the left side of TextInput
*/
leftAddon?: React.ReactNode;
/**
* element, embedded to the right side of TextInput
*/
rightAddon?: React.ReactNode;
/**
* input container className
*/
className?: string;
/**
* elements, inserted right before rightAddon
*/
children?: React.ReactNode;
/**
* colors theme for different input states
*/
colors?: InputColors;
/**
* max value length
*/
maxlength?: number;
/**
* input name
*/
name?: string;
/**
* input placeholder
*/
placeholder?: string;
/**
* input tabIndex
*/
tabIndex?: number;
/**
* whether enable autocompletion or not
*/
autoComplete?: boolean;
/**
* whether set focus on init or not
*/
autoFocus?: boolean;
}
export interface TextInputProps extends CommonInputProps {
/**
* input value
*/
value?: string;
/**
* input type
* @default 'text'
*/
type?: 'text' | 'password' | 'email' | 'tel' | 'url' | 'date' | 'time' | 'datetime' | 'datetime-local' | 'month' | 'week' | 'color';
}
export class TextInput extends React.Component<TextInputProps> {}
export interface NumberInputProps extends CommonInputProps {
/**
* input value
*/
value?: number;
/**
* separator inserted between thousands in displayed value
* @default ' '
*/
thousandsSeparator?: string;
/**
* count of digits shown in integral part of displayed value if value has an integral part
*/
countOfDigitsAfterPoint?: number;
/**
* maximum input value
*/
max?: number;
/**
* minimum input value
*/
min?: number;
}
export class NumberInput extends React.Component<NumberInputProps> {}
export interface SearchInputProps extends CommonInputProps {
/**
* input value
*/
value?: string;
/**
* time interval during which onChange called only once
* @default 300
*/
searchTimeout?: number;
/**
* whether show search icon or not
* @default true
*/
showSearchIcon?: boolean;
/**
* placement of search icon
* @default 'left'
*/
searchIconPlacement?: 'right' | 'left';
}
export class SearchInput extends React.Component<SearchInputProps> {}
export interface TagInputProps extends CommonInputProps {
/**
* onChange TagInput handler
*/
onChange?: (value: string[]) => void;
/**
* input type
* @default 'text'
*/
type?: 'text' | 'password' | 'email' | 'tel' | 'url' | 'number' | 'date' | 'time' | 'datetime' | 'datetime-local' | 'month' | 'week' | 'color';
/**
* TagInput value (array of tags)
* @default []
*/
value?: string[];
}
export class TagInput extends React.Component<TagInputProps> {}