-
-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathindex.ts
More file actions
424 lines (370 loc) · 18.7 KB
/
Copy pathindex.ts
File metadata and controls
424 lines (370 loc) · 18.7 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
/* eslint-disable max-len */
import { ButtonBuilder, ButtonParams } from './button';
import { ChannelMultiSelectBuilder, ChannelMultiSelectParams } from './channel-multi-select';
import { ChannelSelectBuilder, ChannelSelectParams } from './channel-select';
import { CheckboxesBuilder, CheckboxesParams } from './checkboxes';
import { ConversationMultiSelectBuilder, ConversationMultiSelectParams } from './conversation-multi-select';
import { ConversationSelectBuilder, ConversationSelectParams } from './conversation-select';
import { DatePickerBuilder, DatePickerParams } from './date-picker';
import { DateTimePickerBuilder, DateTimePickerParams } from './date-time-picker';
import { EmailInputBuilder, EmailInputParams } from './email-input';
import { ExternalMultiSelectBuilder, ExternalMultiSelectParams } from './external-multi-select';
import { ExternalSelectBuilder, ExternalSelectParams } from './external-select';
import { FileInputBuilder, FileInputParams } from './file-input';
import { ImgBuilder, ImgParams } from './img';
import { NumberInputBuilder, NumberInputParams } from './number-input';
import { OverflowMenuBuilder, OverflowMenuParams } from './overflow-menu';
import { RadioButtonsBuilder, RadioButtonsParams } from './radio-buttons';
import { StaticMultiSelectBuilder, StaticMultiSelectParams } from './static-multi-select';
import { StaticSelectBuilder, StaticSelectParams } from './static-select';
import { TextInputBuilder, TextInputParams } from './text-input';
import { TimePickerBuilder, TimePickerParams } from './timepicker';
import { URLInputBuilder, URLInputParams } from './url-input';
import { UserMultiSelectBuilder, UserMultiSelectParams } from './user-multi-select';
import { UserSelectBuilder, UserSelectParams } from './user-select';
import { WorkflowButtonBuilder, WorkflowButtonParams } from './workflow-button';
export type {
ButtonBuilder,
ButtonParams,
ChannelMultiSelectBuilder,
ChannelMultiSelectParams,
ChannelSelectBuilder,
ChannelSelectParams,
CheckboxesBuilder,
CheckboxesParams,
ConversationMultiSelectBuilder,
ConversationMultiSelectParams,
ConversationSelectBuilder,
ConversationSelectParams,
DatePickerBuilder,
DatePickerParams,
DateTimePickerBuilder,
DateTimePickerParams,
EmailInputBuilder,
EmailInputParams,
ExternalMultiSelectBuilder,
ExternalMultiSelectParams,
ExternalSelectBuilder,
ExternalSelectParams,
ImgBuilder,
ImgParams,
NumberInputBuilder,
NumberInputParams,
OverflowMenuBuilder,
OverflowMenuParams,
RadioButtonsBuilder,
RadioButtonsParams,
StaticMultiSelectBuilder,
StaticMultiSelectParams,
StaticSelectBuilder,
StaticSelectParams,
TextInputBuilder,
TextInputParams,
TimePickerBuilder,
TimePickerParams,
URLInputBuilder,
URLInputParams,
UserMultiSelectBuilder,
UserMultiSelectParams,
UserSelectBuilder,
UserSelectParams,
FileInputBuilder,
FileInputParams,
WorkflowButtonBuilder,
WorkflowButtonParams,
};
/**
* Functions here do not use arrow functions stored in variables for IDE color compatibility.
*/
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.accessibilityLabel] Sets a longer descriptive text that will be read out by screen readers instead of the button text object.
* @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [params.text] Sets the display text for the button.
* @param {string} [params.url] Sets the URL to redirect the user to when this button is clicked.
* @param {string} [params.value] Sets the value to be passed to your app when this button is clicked.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#button|View in Slack API Documentation}
*/
export function Button(params?: ButtonParams): ButtonBuilder {
return new ButtonBuilder(params);
}
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {int} [params.maxSelectedItems] Sets a limit to how many items the user can select.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#channel_multi_select|View in Slack API Documentation}
*/
export function ChannelMultiSelect(params?: ChannelMultiSelectParams): ChannelMultiSelectBuilder {
return new ChannelMultiSelectBuilder(params);
}
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {string} [params.initialChannel] Sets the default selected item in the menu.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#channel_select|View in Slack API Documentation}
*/
export function ChannelSelect(params?: ChannelSelectParams): ChannelSelectBuilder {
return new ChannelSelectBuilder(params);
}
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#checkboxes|View in Slack API Documentation}
*/
export function Checkboxes(params?: CheckboxesParams): CheckboxesBuilder {
return new CheckboxesBuilder(params);
}
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {int} [params.maxSelectedItems] Sets a limit to how many items the user can select.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#conversation_multi_select|View in Slack API Documentation}
*/
export function ConversationMultiSelect(params?: ConversationMultiSelectParams): ConversationMultiSelectBuilder {
return new ConversationMultiSelectBuilder(params);
}
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {string} [params.initialConversation] Sets the default selected item in the menu.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#conversation_multi_select|View in Slack API Documentation}
*/
export function ConversationSelect(params?: ConversationSelectParams): ConversationSelectBuilder {
return new ConversationSelectBuilder(params);
}
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {string} [params.initialDate] Sets the default selected date in the menu.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#datepicker|View in Slack API Documentation}
*/
export function DatePicker(params?: DatePickerParams): DatePickerBuilder {
return new DatePickerBuilder(params);
}
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [params.initialDateTime] Sets the default selected date and time for the date time picker.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#datetimepicker|View in Slack API Documentation}
*/
export function DateTimePicker(params?: DateTimePickerParams): DateTimePickerBuilder {
return new DateTimePickerBuilder(params);
}
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {string} [params.initialValue] Sets the default email entered into the Email input at modal render.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#email|View in Slack API Documentation}
*/
export function EmailInput(params?: EmailInputParams): EmailInputBuilder {
return new EmailInputBuilder(params);
}
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {int} [params.maxSelectedItems] Sets a limit to how many items the user can select.
* @param {int} [params.minQueryLength] Sets a minimum number of characters types before querying your options URL.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#external_multi_select|View in Slack API Documentation}
*/
export function ExternalMultiSelect(params?: ExternalMultiSelectParams): ExternalMultiSelectBuilder {
return new ExternalMultiSelectBuilder(params);
}
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {int} [params.minQueryLength] Sets a minimum number of characters types before querying your options URL.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#external_select|View in Slack API Documentation}
*/
export function ExternalSelect(params?: ExternalSelectParams): ExternalSelectBuilder {
return new ExternalSelectBuilder(params);
}
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.imageUrl] Sets the source URL from which the image will be loaded.
* @param {string} [params.altText] Sets the textual summary of the image.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#image|View in Slack API Documentation}
*/
export function Img(params?: ImgParams): ImgBuilder {
return new ImgBuilder(params);
}
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.filetypes] Sets the accepted filetypes.
* @param {string} [params.maxFiles] Sets the maximum number of files to upload.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#file_input|View in Slack API Documentation}
*/
export function FileInput(params?: FileInputParams): FileInputBuilder {
return new FileInputBuilder(params);
}
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {boolean} [params.isDecimalAllowed] Dicates whether a decimal is allowed for the value entered into the number input.
* @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {string} [params.initialValue] Sets the default text entered into the text input at modal render.
* @param {int} [params.minValue] Sets a minimum value for the number input.
* @param {int} [params.maxValue] Sets a maximum value for the number input.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#number|View in Slack API Documentation}
*/
export function NumberInput(params?: NumberInputParams): NumberInputBuilder {
return new NumberInputBuilder(params);
}
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#overflow|View in Slack API Documentation}
*/
export function OverflowMenu(params?: OverflowMenuParams): OverflowMenuBuilder {
return new OverflowMenuBuilder(params);
}
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#radio|View in Slack API Documentation}
*/
export function RadioButtons(params?: RadioButtonsParams): RadioButtonsBuilder {
return new RadioButtonsBuilder(params);
}
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {int} [params.maxSelectedItems] Sets a limit to how many items the user can select.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#static_multi_select|View in Slack API Documentation}
*/
export function StaticMultiSelect(params?: StaticMultiSelectParams): StaticMultiSelectBuilder {
return new StaticMultiSelectBuilder(params);
}
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#static_select|View in Slack API Documentation}
*/
export function StaticSelect(params?: StaticSelectParams): StaticSelectBuilder {
return new StaticSelectBuilder(params);
}
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {string} [params.initialValue] Sets the default text entered into the text input at modal render.
* @param {boolean} [params.multiline] Sets whether the input will be a single line or a larger text area.
* @param {int} [params.minLength] Sets a minimum character count in order for the user to submit the form.
* @param {int} [params.maxLength] Sets a maximum character count allowed to send the form.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#input|View in Slack API Documentation}
*/
export function TextInput(params?: TextInputParams): TextInputBuilder {
return new TextInputBuilder(params);
}
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {string} [params.initialTime] Sets the default selected time in the menu.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#timepicker|View in Slack API Documentation}
*/
export function TimePicker(params?: TimePickerParams): TimePickerBuilder {
return new TimePickerBuilder(params);
}
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {string} [params.initialValue] Sets the default URL entered into the URL input at modal render.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#url|View in Slack API Documentation}
*/
export function URLInput(params?: URLInputParams): URLInputBuilder {
return new URLInputBuilder(params);
}
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {int} [params.maxSelectedItems] Sets a limit to how many items the user can select.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#users_multi_select|View in Slack API Documentation}
*/
export function UserMultiSelect(params?: UserMultiSelectParams): UserMultiSelectBuilder {
return new UserMultiSelectBuilder(params);
}
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {string} [params.initialUser] Setts the default selected user in the menu.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#users_select|View in Slack API Documentation}
*/
export function UserSelect(params?: UserSelectParams): UserSelectBuilder {
return new UserSelectBuilder(params);
}
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.accessibilityLabel] Sets a longer descriptive text that will be read out by screen readers instead of the button text object.
* @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [params.text] Sets the display text for the button.
* @param {string} [params.trigger] Sets a trigger object that contains information about a workflow's trigger.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#workflow_button|View in Slack API Documentation}
*/
export function WorkflowButton(params?: WorkflowButtonParams): WorkflowButtonBuilder {
return new WorkflowButtonBuilder(params);
}
const elements = {
Button,
ChannelMultiSelect,
ChannelSelect,
Checkboxes,
ConversationMultiSelect,
ConversationSelect,
DatePicker,
DateTimePicker,
EmailInput,
ExternalMultiSelect,
ExternalSelect,
Img,
NumberInput,
OverflowMenu,
RadioButtons,
StaticMultiSelect,
StaticSelect,
TextInput,
TimePicker,
URLInput,
UserMultiSelect,
UserSelect,
FileInput,
WorkflowButton,
};
// Strange export. I know. For IDE highlighting purposes.
export { elements as Elements };