2022-08-27 15:58:36 +02:00
|
|
|
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
2022-05-03 15:08:28 +02:00
|
|
|
|
2023-02-14 11:17:39 +01:00
|
|
|
type BaseField<T, U> = {
|
|
|
|
|
type: T;
|
2022-05-03 15:08:28 +02:00
|
|
|
label: string;
|
2023-02-14 11:17:39 +01:00
|
|
|
description?: string;
|
2022-08-05 15:10:37 +02:00
|
|
|
placeholder?: string;
|
2023-02-14 11:17:39 +01:00
|
|
|
default?: U;
|
2022-05-03 15:08:28 +02:00
|
|
|
icon?: IconProp;
|
2022-10-27 03:17:53 -04:00
|
|
|
disabled?: boolean;
|
2023-01-08 11:35:30 +01:00
|
|
|
required?: boolean;
|
2023-02-14 11:17:39 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export interface IInput extends BaseField<'input', string> {
|
|
|
|
|
password?: boolean;
|
2022-05-03 15:08:28 +02:00
|
|
|
}
|
2022-08-09 23:50:14 +02:00
|
|
|
|
|
|
|
|
export interface ICheckbox {
|
2022-08-27 15:58:36 +02:00
|
|
|
type: 'checkbox';
|
2022-08-09 23:50:14 +02:00
|
|
|
label: string;
|
|
|
|
|
checked?: boolean;
|
2022-10-27 03:17:53 -04:00
|
|
|
disabled?: boolean;
|
2022-10-27 13:45:27 +02:00
|
|
|
description?: string;
|
2023-01-08 11:35:30 +01:00
|
|
|
required?: boolean;
|
2022-08-09 23:50:14 +02:00
|
|
|
}
|
|
|
|
|
|
2023-01-08 11:50:44 +01:00
|
|
|
export type OptionValue = { value: string; label?: string };
|
2023-02-14 11:17:39 +01:00
|
|
|
export interface ISelect extends BaseField<'select' | 'multi-select', string | string[]> {
|
2023-01-08 11:50:44 +01:00
|
|
|
options: Array<OptionValue>;
|
2023-01-09 14:34:41 +01:00
|
|
|
clearable?: boolean;
|
2022-08-09 23:50:14 +02:00
|
|
|
}
|
|
|
|
|
|
2023-02-14 11:17:39 +01:00
|
|
|
export interface INumber extends BaseField<'number', number> {
|
2022-08-27 15:58:36 +02:00
|
|
|
min?: number;
|
|
|
|
|
max?: number;
|
2022-08-09 23:50:14 +02:00
|
|
|
}
|
2022-08-10 21:05:27 +02:00
|
|
|
|
2023-02-14 11:17:39 +01:00
|
|
|
export interface ISlider extends Omit<BaseField<'slider', number>, 'description' | 'placeholder'> {
|
2022-08-10 21:05:27 +02:00
|
|
|
min?: number;
|
|
|
|
|
max?: number;
|
|
|
|
|
step?: number;
|
|
|
|
|
}
|
2023-01-08 11:23:50 +01:00
|
|
|
|
2023-02-14 11:17:39 +01:00
|
|
|
export interface IColorInput extends BaseField<'color', string> {
|
2023-01-08 11:23:50 +01:00
|
|
|
format?: 'hex' | 'hexa' | 'rgb' | 'rgba' | 'hsl' | 'hsla';
|
|
|
|
|
}
|
2023-01-13 19:09:07 +01:00
|
|
|
|
2023-02-14 11:17:39 +01:00
|
|
|
export interface IDateInput
|
|
|
|
|
extends Omit<BaseField<'date' | 'date-range', string | [string, string] | true>, 'placeholder'> {
|
|
|
|
|
format?: string;
|
2023-01-14 13:36:30 +01:00
|
|
|
clearable?: boolean;
|
|
|
|
|
min?: string;
|
|
|
|
|
max?: string;
|
2023-01-13 19:09:07 +01:00
|
|
|
}
|
2023-01-15 11:44:14 +01:00
|
|
|
|
2023-02-14 11:17:39 +01:00
|
|
|
export interface ITimeInput extends Omit<BaseField<'time', string>, 'placeholder'> {
|
2023-02-14 10:54:53 +01:00
|
|
|
format?: '12' | '24';
|
|
|
|
|
clearable?: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-14 11:17:39 +01:00
|
|
|
export interface ITextarea extends BaseField<'textarea', string> {
|
2023-01-15 11:44:14 +01:00
|
|
|
autosize?: boolean;
|
|
|
|
|
min?: number;
|
|
|
|
|
max?: number;
|
|
|
|
|
}
|