-
Notifications
You must be signed in to change notification settings - Fork 119
/
Elements.ts
76 lines (63 loc) · 1.99 KB
/
Elements.ts
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import { IOptionObject, ITextObject } from './Objects';
export enum BlockElementType {
BUTTON = 'button',
IMAGE = 'image',
OVERFLOW_MENU = 'overflow',
PLAIN_TEXT_INPUT = 'plain_text_input',
STATIC_SELECT = 'static_select',
MULTI_STATIC_SELECT = 'multi_static_select',
}
export interface IBlockElement {
type: BlockElementType;
}
export type AccessoryElements = IButtonElement | IImageElement | IOverflowMenuElement;
export interface IInteractiveElement extends IBlockElement {
actionId: string;
}
export interface IInputElement extends IBlockElement {
actionId: string;
placeholder: ITextObject;
initialValue?: string | Array<string>;
}
export enum ButtonStyle {
PRIMARY = 'primary',
DANGER = 'danger',
}
export interface IButtonElement extends IInteractiveElement {
type: BlockElementType.BUTTON;
text: ITextObject;
value?: string;
url?: string;
style?: ButtonStyle;
// confirm?: IConfirmationDialogObject;
}
export interface IImageElement extends IBlockElement {
type: BlockElementType.IMAGE;
imageUrl: string;
altText: string;
}
export interface IOverflowMenuElement extends IInteractiveElement {
type: BlockElementType.OVERFLOW_MENU;
options: Array<IOptionObject>;
// confirm?: IConfirmationDialogObject;
}
export interface IPlainTextInputElement extends IInputElement {
type: BlockElementType.PLAIN_TEXT_INPUT;
initialValue?: string;
multiline?: boolean;
}
export interface ISelectElement extends IInputElement {
type: BlockElementType.STATIC_SELECT | BlockElementType.MULTI_STATIC_SELECT;
}
export interface IStaticSelectElement extends ISelectElement {
type: BlockElementType.STATIC_SELECT;
placeholder: ITextObject;
options: Array<IOptionObject>;
initialValue?: string;
}
export interface IMultiStaticSelectElement extends ISelectElement {
type: BlockElementType.MULTI_STATIC_SELECT;
placeholder: ITextObject;
options: Array<IOptionObject>;
initialValue?: Array<string>;
}