blob: c9932c053dbed2f9308a4c69839e27938da5522a (
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
37
38
39
40
41
42
43
44
45
46
47
|
import { ChangeEventHandler, FocusEventHandler } from 'react';
import { GlobalError } from './ferdium-components.types';
export interface FormFieldOptions {
value?: string;
label?: string;
disabled?: boolean;
}
export interface FormFields {
fields: {
[key: string]: {
label?: string;
placeholder?: string;
options?: FormFieldOptions[];
value?: string | boolean | number | null;
default?: string | boolean | number | null;
type?: string; // todo specifiy probably
disabled?: boolean;
validators?: any; // Not sure yet.
};
};
}
export interface Field extends Partial<Listeners> {
id?: string;
type?: string;
name?: string;
value: string | string[];
label?: string;
placeholder?: string;
disabled?: boolean;
error?: GlobalError | string;
options?: SelectOptions[];
}
export interface SelectOptions {
disabled?: boolean;
label?: string;
value?: string;
}
export interface Listeners {
onChange?: ChangeEventHandler<HTMLInputElement | HTMLSelectElement>;
onBlur?: FocusEventHandler<HTMLElement>;
onFocus?: FocusEventHandler<HTMLElement>;
}
|