-
Notifications
You must be signed in to change notification settings - Fork 686
feat(types): add ContainerBlock for block kit #2721
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
Open
srtaalej
wants to merge
6
commits into
main
Choose a base branch
from
ale-add-containerblock
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3b4a44c
feat(types): add ContainerBlock for block kit
srtaalej 38fe38d
chore: add changeset for ContainerBlock
srtaalej aa218e9
Merge branch 'main' into ale-add-containerblock
srtaalej 6a30441
fix: format test file with biome
srtaalej 5b36fd7
Merge branch 'ale-add-containerblock' of https://github.com/slackapi/…
srtaalej d61f4e9
refactor: inline ContainerBlockChildBlock type
srtaalej File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@slack/types": minor | ||
| --- | ||
|
|
||
| feat(types): add `ContainerBlock` interface and `ContainerBlockChildBlock` union type |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,6 +58,7 @@ export type KnownBlock = | |
| | AlertBlock | ||
| | CardBlock | ||
| | CarouselBlock | ||
| | ContainerBlock | ||
| | ContextBlock | ||
| | ContextActionsBlock | ||
| | DividerBlock | ||
|
|
@@ -184,6 +185,69 @@ export interface CarouselBlock extends Block { | |
| elements: CardBlock[]; | ||
| } | ||
|
|
||
| /** | ||
| * @description A general-purpose wrapper for grouping child blocks together, with a configurable size. | ||
| * Note: `has_header_divider` cannot be set to `true` when `is_collapsible` is `true`. | ||
| * @see {@link https://docs.slack.dev/reference/block-kit/blocks/container-block Container block reference}. | ||
| */ | ||
| export interface ContainerBlock extends Block { | ||
| /** | ||
| * @description The type of block. For a container block, `type` is always `container`. | ||
| */ | ||
| type: 'container'; | ||
| /** | ||
| * @description Plain text title for the container. Maximum length is 150 characters. | ||
| * One of `title` or `rich_text_title` is required. | ||
| */ | ||
| title?: PlainTextElement; | ||
| /** | ||
| * @description Rich text title for the container. Takes precedence over `title` if both are provided. | ||
| * One of `title` or `rich_text_title` is required. | ||
| */ | ||
| rich_text_title?: RichTextBlock; | ||
| /** | ||
| * @description Subtitle for the container in plain text or mrkdwn format. Maximum length is 150 characters. | ||
| */ | ||
| subtitle?: TextObject; | ||
| /** | ||
| * @description An array of child blocks. Maximum 10 blocks. | ||
| */ | ||
| child_blocks: ( | ||
| | ActionsBlock | ||
| | ContextBlock | ||
| | DividerBlock | ||
| | FileBlock | ||
| | HeaderBlock | ||
| | ImageBlock | ||
| | InputBlock | ||
| | RichTextBlock | ||
| | SectionBlock | ||
| | TableBlock | ||
| | VideoBlock | ||
| )[]; | ||
| /** | ||
| * @description Controls the width of the container. Defaults to `"standard"`. | ||
| */ | ||
| width?: 'narrow' | 'standard' | 'wide' | 'full'; | ||
|
Comment on lines
+228
to
+231
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🌟 praise: I think we should embrace enum more in ongoing iteration and expand it as needed. IIRC this hasn't been our practice forever but it offers a better experience in current releases with fast fixes onward as needed. Changing a |
||
| /** | ||
| * @description An image element displayed alongside the title and subtitle. | ||
| */ | ||
| icon?: ImageElement; | ||
| /** | ||
| * @description Whether the container can be collapsed. Defaults to `false`. | ||
| */ | ||
| is_collapsible?: boolean; | ||
| /** | ||
| * @description Whether the container is collapsed by default. Requires `is_collapsible` to be `true`. Defaults to `false`. | ||
| */ | ||
| default_collapsed?: boolean; | ||
| /** | ||
| * @description Whether to show a visible border separating header from content. | ||
| * Only applies when `is_collapsible` is not `true`. Defaults to `false`. | ||
| */ | ||
| has_header_divider?: boolean; | ||
| } | ||
|
|
||
| /** | ||
| * A helper union type of all Block Elements that can be used in a {@link ContextBlock}. | ||
| * @see {@link https://docs.slack.dev/reference/block-kit/blocks/context-block Context block reference}. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔭 suggestion: We should update reference pages to match these types if it's correct?