UNPKG

13.6 kBTypeScriptView Raw
1// Generated by dts-bundle v0.6.1
2// Dependencies for this module:
3// ../../react
4
5declare module 'redux-form-lite' {
6 import Form from 'redux-form-lite/Form';
7 import Field from 'redux-form-lite/Field';
8 import FieldArray from 'redux-form-lite/FieldArray';
9 import reducer from 'redux-form-lite/formsReducer';
10 export { Form, Field, FieldArray, reducer };
11}
12
13declare module 'redux-form-lite/Form' {
14 import * as React from 'react';
15 import * as actions from 'redux-form-lite/actions';
16 export interface IFormProps extends React.HTMLProps<HTMLFormElement> {
17 name: string;
18 persistent?: boolean;
19 onSubmit?: (values: Object) => Promise<any> | void;
20 withRef?: (el: HTMLFormElement) => void;
21 }
22 export type StateProps = {
23 _form: boolean;
24 _values: Object;
25 _valid: boolean;
26 _submitting: boolean;
27 };
28 export type ActionProps = {
29 _addForm: actions.AddFormCreator;
30 _removeForm: actions.RemoveFormCreator;
31 _touchAll: actions.TouchAllCreator;
32 _submitStart: actions.SubmitStartCreator;
33 _submitStop: actions.SubmitStopCreator;
34 };
35 export type Props<T> = StateProps & ActionProps & IFormProps & T;
36 export type Context = {
37 reduxFormLite: string;
38 };
39 var _default: React.ComponentClass<IFormProps>;
40 export default _default;
41}
42
43declare module 'redux-form-lite/Field' {
44 import * as React from 'react';
45 import { ContextProps } from 'redux-form-lite/utils/connectField';
46 import { InputProps, MetaProps } from 'redux-form-lite/utils/fieldProps';
47 import { Value } from 'redux-form-lite/utils/getValue';
48 export interface ISuppliedProps {
49 input: InputProps;
50 meta: MetaProps;
51 }
52 export interface IOwnProps {
53 name: string;
54 component: React.ComponentClass<ISuppliedProps> | React.SFC<ISuppliedProps> | string;
55 validate?: Validate;
56 normalize?: Normalize;
57 defaultValue?: string;
58 withRef?: (el: React.ReactElement<any>) => void;
59 }
60 export type Validate = (value: Value) => string | null;
61 export type Normalize = (value: Value) => Value;
62 const Contexted: React.StatelessComponent<IOwnProps & {
63 name: string;
64 }> & {
65 WrappedComponent?: React.ComponentClass<IOwnProps & {
66 name: string;
67 } & ContextProps> | undefined;
68 };
69 export default Contexted;
70}
71
72declare module 'redux-form-lite/FieldArray' {
73 import * as React from 'react';
74 import { ContextProps } from 'redux-form-lite/utils/connectField';
75 import { FieldProps } from 'redux-form-lite/utils/fieldArrayProps';
76 export interface ISuppliedProps {
77 name: string;
78 fields: FieldProps;
79 }
80 export interface IOwnProps {
81 name: string;
82 component: React.ComponentClass<ISuppliedProps> | React.SFC<ISuppliedProps>;
83 withRef?: (el: React.ReactElement<any>) => void;
84 }
85 const Contexted: React.StatelessComponent<IOwnProps & {
86 name: string;
87 }> & {
88 WrappedComponent?: React.ComponentClass<IOwnProps & {
89 name: string;
90 } & ContextProps> | undefined;
91 };
92 export default Contexted;
93}
94
95declare module 'redux-form-lite/formsReducer' {
96 import { FormObj } from 'redux-form-lite/utils/containers';
97 import { Action } from 'redux-form-lite/actions';
98 export type State = {
99 [form: string]: FormObj;
100 };
101 export default function formsReducer(state: State, a: Action): State;
102}
103
104declare module 'redux-form-lite/actions' {
105 import { FieldObj } from "redux-form-lite/utils/containers";
106 import { Value } from "redux-form-lite/utils/getValue";
107 export const ADD_FORM = "@redux-form-lite/ADD_FORM";
108 export const REMOVE_FORM = "@redux-form-lite/REMOVE_FORM";
109 export const ADD_FIELD = "@redux-form-lite/ADD_FIELD";
110 export const REMOVE_FIELD = "@redux-form-lite/REMOVE_FIELD";
111 export const TOUCH_ALL = "@redux-form-lite/TOUCH_ALL";
112 export const SUBMIT_START = "@redux-form-lite/SUBMIT_START";
113 export const SUBMIT_STOP = "@redux-form-lite/SUBMIT_STOP";
114 export const ADD_ARRAY = "@redux-form-lite/ADD_ARRAY";
115 export const REMOVE_ARRAY = "@redux-form-lite/REMOVE_ARRAY";
116 export const ARRAY_PUSH = "@redux-form-lite/ARRAY_PUSH";
117 export const ARRAY_POP = "@redux-form-lite/ARRAY_POP";
118 export const ARRAY_UNSHIFT = "@redux-form-lite/ARRAY_UNSHIFT";
119 export const ARRAY_SHIFT = "@redux-form-lite/ARRAY_SHIFT";
120 export const FIELD_CHANGE = "@redux-form-lite/FIELD_CHANGE";
121 export const FIELD_FOCUS = "@redux-form-lite/FIELD_FOCUS";
122 export const FIELD_BLUR = "@redux-form-lite/FIELD_BLUR";
123 export const FIELD_VALUE = "@redux-form-lite/FIELD_VALUE";
124 export const FIELD_ERROR = "@redux-form-lite/FIELD_ERROR";
125 export type AddFormAction = {
126 type: '@redux-form-lite/ADD_FORM';
127 payload: {
128 name: string;
129 };
130 };
131 export type AddFormCreator = (name: string) => AddFormAction;
132 export const addForm: AddFormCreator;
133 export type RemoveFormAction = {
134 type: '@redux-form-lite/REMOVE_FORM';
135 payload: {
136 name: string;
137 };
138 };
139 export type RemoveFormCreator = (name: string) => RemoveFormAction;
140 export const removeForm: RemoveFormCreator;
141 export type AddFieldAction = {
142 type: '@redux-form-lite/ADD_FIELD';
143 payload: {
144 form: string;
145 id: string;
146 field: FieldObj;
147 };
148 };
149 export type AddFieldCreator = (form: string, id: string, field: FieldObj) => AddFieldAction;
150 export const addField: AddFieldCreator;
151 export type RemoveFieldAction = {
152 type: '@redux-form-lite/REMOVE_FIELD';
153 payload: {
154 form: string;
155 id: string;
156 };
157 };
158 export type RemoveFieldCreator = (form: string, id: string) => RemoveFieldAction;
159 export const removeField: RemoveFieldCreator;
160 export type TouchAllAction = {
161 type: '@redux-form-lite/TOUCH_ALL';
162 payload: {
163 form: string;
164 };
165 };
166 export type TouchAllCreator = (form: string) => TouchAllAction;
167 export const touchAll: TouchAllCreator;
168 export type SubmitStartAction = {
169 type: '@redux-form-lite/SUBMIT_START';
170 payload: {
171 form: string;
172 };
173 };
174 export type SubmitStartCreator = (form: string) => SubmitStartAction;
175 export const submitStart: SubmitStartCreator;
176 export type SubmitStopAction = {
177 type: '@redux-form-lite/SUBMIT_STOP';
178 payload: {
179 form: string;
180 };
181 };
182 export type SubmitStopCreator = (form: string) => SubmitStopAction;
183 export const submitStop: SubmitStopCreator;
184 export type AddArrayAction = {
185 type: '@redux-form-lite/ADD_ARRAY';
186 payload: {
187 form: string;
188 id: string;
189 };
190 };
191 export type AddArrayCreator = (form: string, id: string) => AddArrayAction;
192 export const addArray: AddArrayCreator;
193 export type RemoveArrayAction = {
194 type: '@redux-form-lite/REMOVE_ARRAY';
195 payload: {
196 form: string;
197 id: string;
198 };
199 };
200 export type RemoveArrayCreator = (form: string, id: string) => RemoveArrayAction;
201 export const removeArray: RemoveArrayCreator;
202 export type PushAction = {
203 type: '@redux-form-lite/ARRAY_PUSH';
204 payload: {
205 form: string;
206 id: string;
207 };
208 };
209 export type PushCreator = (form: string, id: string) => PushAction;
210 export const arrayPush: PushCreator;
211 export type PopAction = {
212 type: '@redux-form-lite/ARRAY_POP';
213 payload: {
214 form: string;
215 id: string;
216 };
217 };
218 export type PopCreator = (form: string, id: string) => PopAction;
219 export const arrayPop: PopCreator;
220 export type UnshiftAction = {
221 type: '@redux-form-lite/ARRAY_UNSHIFT';
222 payload: {
223 form: string;
224 id: string;
225 };
226 };
227 export type UnshiftCreator = (form: string, id: string) => UnshiftAction;
228 export const arrayUnshift: UnshiftCreator;
229 export type ShiftAction = {
230 type: '@redux-form-lite/ARRAY_SHIFT';
231 payload: {
232 form: string;
233 id: string;
234 };
235 };
236 export type ShiftCreator = (form: string, id: string) => ShiftAction;
237 export const arrayShift: ShiftCreator;
238 export type FieldChangeAction = {
239 type: '@redux-form-lite/FIELD_CHANGE';
240 payload: {
241 form: string;
242 field: string;
243 value: Value;
244 error: string | null;
245 dirty: boolean;
246 };
247 };
248 export type FieldChangeCreator = (form: string, field: string, value: Value, error: string | null, dirty: boolean) => FieldChangeAction;
249 export const fieldChange: FieldChangeCreator;
250 export type FieldFocusAction = {
251 type: '@redux-form-lite/FIELD_FOCUS';
252 payload: {
253 form: string;
254 field: string;
255 };
256 };
257 export type FieldFocusCreator = (form: string, field: string) => FieldFocusAction;
258 export const fieldFocus: FieldFocusCreator;
259 export type FieldBlurAction = {
260 type: '@redux-form-lite/FIELD_BLUR';
261 payload: {
262 form: string;
263 field: string;
264 value: Value;
265 error: string | null;
266 dirty: boolean;
267 };
268 };
269 export type FieldBlurCreator = (form: string, field: string, value: Value, error: string | null, dirty: boolean) => FieldBlurAction;
270 export const fieldBlur: FieldBlurCreator;
271 export type FieldValueAction = {
272 type: '@redux-form-lite/FIELD_VALUE';
273 payload: {
274 form: string;
275 field: string;
276 value: Value;
277 };
278 };
279 export type FieldValueCreator = (form: string, field: string, value: Value) => FieldValueAction;
280 export const fieldValue: FieldValueCreator;
281 export type FieldErrorAction = {
282 type: '@redux-form-lite/FIELD_ERROR';
283 payload: {
284 form: string;
285 field: string;
286 error: string | null;
287 };
288 };
289 export type FieldErrorCreator = (form: string, field: string, error: string | null) => FieldErrorAction;
290 export const fieldError: FieldErrorCreator;
291 export type Action = AddFormAction | RemoveFormAction | AddFieldAction | RemoveFieldAction | TouchAllAction | SubmitStartAction | SubmitStopAction | AddArrayAction | RemoveArrayAction | PushAction | PopAction | UnshiftAction | ShiftAction | FieldChangeAction | FieldFocusAction | FieldBlurAction | FieldValueAction | FieldErrorAction;
292}
293
294declare module 'redux-form-lite/utils/connectField' {
295 import * as React from 'react';
296 export type FormProps = {
297 name: string;
298 };
299 export type ContextProps = {
300 _form: string;
301 };
302 export type WrappedField<T> = React.ComponentClass<T & FormProps & ContextProps>;
303 export type Connected<T> = React.SFC<T & FormProps> & {
304 WrappedComponent?: WrappedField<T>;
305 };
306 export default function connectField<T>(Wrapped: WrappedField<T>): Connected<T>;
307}
308
309declare module 'redux-form-lite/utils/fieldProps' {
310 import { Value, Target } from "redux-form-lite/utils/getValue";
311 export interface IAllProps {
312 value: Value;
313 checked?: boolean;
314 }
315 export type InputProps = {
316 name: string;
317 value: Value;
318 onChange: (ev: React.SyntheticEvent<Target>) => void;
319 onFocus: (ev: React.SyntheticEvent<Target>) => void;
320 onBlur: (ev: React.SyntheticEvent<Target>) => void;
321 };
322 export type MetaProps = {
323 error: string | null;
324 dirty: boolean;
325 touched: boolean;
326 visited: boolean;
327 active: boolean;
328 };
329 export type SeparatedProps = {
330 input: InputProps;
331 meta: MetaProps;
332 custom: Object;
333 };
334 var _default: (x0: IAllProps) => SeparatedProps;
335 export default _default;
336}
337
338declare module 'redux-form-lite/utils/getValue' {
339 export type Target = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
340 export type Value = string | string[] | boolean | FileList | null;
341 const getValue: (ev: any) => Value;
342 export default getValue;
343}
344
345declare module 'redux-form-lite/utils/fieldArrayProps' {
346 export type FieldProps = {
347 length: number;
348 map: (fn: (arr: string[]) => any) => any;
349 push: () => void;
350 pop: () => void;
351 unshift: () => void;
352 shift: () => void;
353 };
354 const fieldArrayProps: <T>(props: T, fields: FieldProps) => T & {
355 fields: FieldProps;
356 };
357 export default fieldArrayProps;
358}
359
360declare module 'redux-form-lite/utils/containers' {
361 import { Value } from "redux-form-lite/utils/getValue";
362 export const form: {
363 fields: {};
364 arrays: {};
365 submitting: boolean;
366 };
367 export const field: {
368 value: string;
369 error: null;
370 visited: boolean;
371 touched: boolean;
372 active: boolean;
373 dirty: boolean;
374 };
375 export type FieldObj = {
376 value: Value;
377 visited: boolean;
378 touched: boolean;
379 active: boolean;
380 error: string | null;
381 dirty: boolean;
382 };
383 export type FormObj = {
384 fields: {
385 [key: string]: FieldObj;
386 };
387 arrays: {
388 [key: string]: number;
389 };
390 submitting: boolean;
391 };
392}
393