blob: 07234a47a34db2c63566c77dc3213fac8cf82438 (
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
|
import { File } from 'electron-dl';
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]: Field;
};
}
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 SelectOptions {
disabled?: boolean;
label?: string;
value?: string;
}
export interface Listeners {
onChange?: ChangeEventHandler<HTMLInputElement | HTMLSelectElement>;
onBlur?: FocusEventHandler<HTMLElement>;
onFocus?: FocusEventHandler<HTMLElement>;
onDrop?: (file: File) => void;
}
|