Skip to content

Commit

Permalink
Add new file_input block kit element. (#1689)
Browse files Browse the repository at this point in the history
  • Loading branch information
filmaj authored Nov 14, 2023
1 parent 7089a47 commit 41f771e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
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

0 comments on commit 41f771e

Please sign in to comment.