diff --git a/packages/types/src/block-kit/blocks.ts b/packages/types/src/block-kit/blocks.ts index d33254b33..17d710acb 100644 --- a/packages/types/src/block-kit/blocks.ts +++ b/packages/types/src/block-kit/blocks.ts @@ -24,7 +24,13 @@ import type { URLInput, WorkflowButton, } from './block-elements'; -import type { PlainTextElement, SlackFileImageObject, TextObject, UrlImageObject } from './composition-objects'; +import type { + PlainTextElement, + RawTextElement, + SlackFileImageObject, + TextObject, + UrlImageObject, +} from './composition-objects'; export interface Block { /** @@ -57,6 +63,7 @@ export type KnownBlock = | MarkdownBlock | RichTextBlock | SectionBlock + | TableBlock | VideoBlock; /** @@ -361,6 +368,40 @@ export interface SectionBlock extends Block { expand?: boolean; } +/** + * @description Displays structured information in a table. + * @see {@link https://docs.slack.dev/reference/block-kit/blocks/table-block Table block reference}. + */ +export interface TableBlock extends Block { + /** + * @description The type of block. For a table block, `type` is always `table`. + */ + type: 'table'; + /** + * @description An array consisting of table rows. Maximum 100 rows. Each row object is an array with a max of 20 table cells. Table cells can have a type of raw_text or rich_text. + */ + rows: (RichTextBlock | RawTextElement)[][]; + /** + * @description An array describing column behavior. If there are fewer items in the column_settings array than there are columns in the table, then the items in the the column_settings array will describe the same number of columns in the table as there are in the array itself. Any additional columns will have the default behavior. Maximum 20 items. + */ + column_settings?: TableBlockColumnSettings[]; +} + +/** + * Schema for column_settings of the table block. + * @see {@link https://docs.slack.dev/reference/block-kit/blocks/table-block/#schema-for-column_settings}. + */ +interface TableBlockColumnSettings { + /** + * @description The alignment for items in this column. Can be left, center, or right. Defaults to left if not defined. + */ + align?: 'left' | 'center' | 'right'; + /** + * @description Whether the contents of this column should be wrapped or not. Defaults to false if not defined. + */ + is_wrapped?: boolean; +} + /** * @description Displays an embedded video player. A video block is designed to embed videos in all app surfaces (e.g. * link unfurls, messages, modals, App Home) — anywhere you can put blocks! To use the video block within your app, you diff --git a/packages/types/src/block-kit/composition-objects.ts b/packages/types/src/block-kit/composition-objects.ts index b0587776c..f4fb416a8 100644 --- a/packages/types/src/block-kit/composition-objects.ts +++ b/packages/types/src/block-kit/composition-objects.ts @@ -173,6 +173,21 @@ export interface MrkdwnElement { verbatim?: boolean; } +/** + * @description Defines an object containing some text. + * @see {@link https://docs.slack.dev/reference/block-kit/composition-objects/text-object Text object reference}. + */ +export interface RawTextElement { + /** + * @description The formatting to use for this text object. + */ + type: 'raw_text'; + /** + * @description The text for the block. The minimum length is 1 and maximum length is 3000 characters. + */ + text: string; +} + interface BaseConversationFilter { /** * @description Indicates which type of conversations should be included in the list. When this field is provided, any