blob: aa274b9db5b155c179d9a7b4f782c3b9f816ffd6 (
plain) (
blame)
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
|
import { ChangeEventHandler, FocusEventHandler } from 'react';
import { GlobalError } from './ferdium-components.types';
interface SelectOptions {
disabled?: boolean;
label?: string;
value?: string;
}
interface Listeners {
onChange?: ChangeEventHandler<HTMLInputElement | HTMLSelectElement>;
onBlur?: FocusEventHandler<HTMLElement>;
onFocus?: FocusEventHandler<HTMLElement>;
onDrop?: (file: File) => void;
}
export interface Field extends Listeners {
id?: string;
type?: string; // todo specifiy probably
name?: string;
value?: any;
label?: string;
placeholder?: string;
disabled?: boolean;
error?: GlobalError | string;
options?: SelectOptions[];
default?: string | boolean | number | null;
validators?: any; // Not sure yet.
set?: (value: any) => void;
[key: string]: any;
}
export interface FormFields {
fields: {
[key: string]: Field;
};
}
|