Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new file_input block kit element soon to be introduced. #1689

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions packages/types/src/block-kit/block-elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,29 @@ export interface EmailInput extends Actionable, Dispatchable, Focusable, Placeho
initial_value?: string;
}

/**
* @description Allows user to upload files. In order to use the `file_input` element within your app,
* your app must have the `files:read` scope.
* @see {@link https://api.slack.com/reference/block-kit/block-elements#file_input File input element reference}.
*/
export interface FileInput extends Actionable {
/**
* @description The type of element. In this case `type` is always `file_input`.
*/
type: 'file_input';
/**
* @description An array of valid {@link https://api.slack.com/types/file#types file extensions} that will be accepted
* for this element. All file extensions will be accepted if `filetypes` is not specified. This validation is provided
* for convenience only, and you should perform your own file type validation based on what you expect to receive.
*/
filetypes?: string[];
/**
* @description Maximum number of files that can be uploaded for this `file_input` element. Minimum of `1`, maximum of
* `10`. Defaults to `10` if not specified.
*/
max_files?: number;
}

/**
* @description Displays an image as part of a larger block of content. Use this `image` block if you want a block with
* only an image in it.
Expand Down
4 changes: 2 additions & 2 deletions packages/types/src/block-kit/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { PlainTextElement, MrkdwnElement } from './composition-objects';
import { Actionable } from './extensions';
import { Button, Checkboxes, Datepicker, DateTimepicker, EmailInput, ImageElement, MultiSelect, NumberInput, Overflow, PlainTextInput, RadioButtons, Select, Timepicker, URLInput, WorkflowButton, RichTextSection, RichTextList, RichTextQuote, RichTextPreformatted, RichTextInput } from './block-elements';
import { Button, Checkboxes, Datepicker, DateTimepicker, EmailInput, FileInput, ImageElement, MultiSelect, NumberInput, Overflow, PlainTextInput, RadioButtons, Select, Timepicker, URLInput, WorkflowButton, RichTextSection, RichTextList, RichTextQuote, RichTextPreformatted, RichTextInput } from './block-elements';

export interface Block {
type: string;
Expand Down Expand Up @@ -159,7 +159,7 @@ export interface InputBlock extends Block {
* @description A block element.
*/
element: Select | MultiSelect | Datepicker | Timepicker | DateTimepicker | PlainTextInput | URLInput | EmailInput
| NumberInput | RadioButtons | Checkboxes | RichTextInput;
| NumberInput | RadioButtons | Checkboxes | RichTextInput | FileInput;
/**
* @description A boolean that indicates whether or not the use of elements in this block should dispatch a
* {@link https://api.slack.com/reference/interaction-payloads/block-actions block_actions payload}. Defaults to `false`.
Expand Down
Loading