blob: 67b0aa3ecd56bb8e8f30fe1d3e03ec7dcac7edb9 (
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 type { ChangeEventHandler, FocusEventHandler } from 'react';
import type { 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;
};
}
|