Skip to content
Open
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
5 changes: 5 additions & 0 deletions .changeset/rich-text-input-min-max-lines.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@slack/types": minor
---

feat(types): add optional `min_lines` and `max_lines` properties to `RichTextInput` element
9 changes: 9 additions & 0 deletions packages/types/src/block-kit/block-elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1066,4 +1066,13 @@ export interface RichTextInput extends Actionable, Dispatchable, Focusable, Plac
* @description Initial contents of the input when it is loaded.
*/
initial_value?: RichTextBlock;
/**
* @description The minimum number of lines of text shown in the input. Must be between 1 and 50.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @description The minimum number of lines of text shown in the input. Must be between 1 and 50.
* @description The minimum number of lines of text shown in the input. Must be between 1 and 100.

🔬 question: I find the API docs suggest "100" as a maximum minimum - would this be something to update here or in reference?

The minimum number of visible text lines the input should display before scrolling. Controls the initial height of the input. Must be between 1 and 100.

🔗 https://docs.slack.dev/reference/block-kit/block-elements/rich-text-input-element/

*/
min_lines?: number;
/**
* @description The maximum number of lines of text shown in the input before it scrolls. Must be between 1 and 50.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @description The maximum number of lines of text shown in the input before it scrolls. Must be between 1 and 50.
* @description The maximum number of lines of text shown in the input before it scrolls. Must be between 1 and 100.

🦠 note: Similar suggestion as above!

* Defaults to `8` when not specified.
*/
max_lines?: number;
}
30 changes: 30 additions & 0 deletions packages/types/test/block-elements.test-d.ts

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌟 praise: Thanks for keeping qualities highest with test! I'm hoping we can organize this file as more coverage is added for other elements ongoing.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { expectAssignable, expectError } from 'tsd';
import type { RichTextInput } from '../src/index';

// RichTextInput — happy paths
expectAssignable<RichTextInput>({
type: 'rich_text_input',
});
expectAssignable<RichTextInput>({
type: 'rich_text_input',
min_lines: 3,
});
expectAssignable<RichTextInput>({
type: 'rich_text_input',
max_lines: 16,
});
expectAssignable<RichTextInput>({
type: 'rich_text_input',
min_lines: 3,
max_lines: 16,
});

// RichTextInput — sad paths
expectError<RichTextInput>({
type: 'rich_text_input',
min_lines: '3',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
min_lines: '3',
min_lines: '3', // Minimum should be integer

🧪 suggestion(non-blocking): To make these spec more clear!

});
expectError<RichTextInput>({
type: 'rich_text_input',
max_lines: '16',
});