Skip to content

Commit

Permalink
Merge pull request #105 from raycharius/v2.7.0
Browse files Browse the repository at this point in the history
✨ Add new block elements
  • Loading branch information
raycharius authored Nov 6, 2022
2 parents ef8f3f2 + 53aafda commit 68af561
Show file tree
Hide file tree
Showing 46 changed files with 1,091 additions and 74 deletions.
62 changes: 33 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,35 +128,39 @@ import { Modal, Section, bold, link } from 'slack-block-builder';

Below is a list of supported objects and how to access them in **Block Builder**:

| **Name** | **Type** | **Support** | **Accessed Via**
|----------------------|--------------------|--------------------------------|-----------------------------------------
| Home Tab | Surface | :white_check_mark: | `Surfaces.HomeTab()`
| Message | Surface | :white_check_mark: | `Surfaces.Message()`
| Modal | Surface | :white_check_mark: | `Surfaces.Modal()`
| Workflow Step | Surface | :white_check_mark: | `Surfaces.WorkflowStep()`
| Actions | Block | :white_check_mark: | `Blocks.Actions()`
| Context | Block | :white_check_mark: | `Blocks.Context()`
| Divider | Block | :white_check_mark: | `Blocks.Divider()`
| File | Block | :white_check_mark: | `Blocks.File()`
| Header | Block | :white_check_mark: | `Blocks.Header()`
| Image | Block | :white_check_mark: | `Blocks.Image()`
| Input | Block | :white_check_mark: | `Blocks.Input()`
| Section | Block | :white_check_mark: | `Blocks.Section()`
| Video | Block | :white_check_mark: | `Blocks.Video()`
| Button | Element | :white_check_mark:️ | `Elements.Button()`
| Checkboxes | Element | :white_check_mark: | `Elements.Checkboxes()`
| Date Picker | Element | :white_check_mark: | `Elements.DatePicker()`
| Time Picker | Element | :white_check_mark: | `Elements.TimePicker()`
| Image | Element | :white_check_mark: | `Elements.Img()`
| Overflow Menu | Element | :white_check_mark: | `Elements.OverflowMenu()`
| Radio Buttons | Element | :white_check_mark: | `Elements.RadioButtons()`
| Plain-Text Input | Element | :white_check_mark: | `Elements.TextInput()`
| Select Menus | Element | :white_check_mark: | `Elements.[Type]Select()`
| Multi-Select Menus | Element | :white_check_mark: | `Elements.[Type]MultiSelect()`
| Option | Composition Object | :white_check_mark: | `Bits.Option()`
| Confirm Dialog | Composition Object | :white_check_mark: | `Bits.ConfirmationDialog()`
| Option Group | Composition Object | :white_check_mark: | `Bits.OptionGroup()`
| Attachment | Legacy Feature | :white_check_mark: | `Bits.Attachment()`
| **Name** | **Type** | **Support** | **Accessed Via**
|--------------------|--------------------|--------------------------------|-----------------------------------------
| Home Tab | Surface | :white_check_mark: | `Surfaces.HomeTab()`
| Message | Surface | :white_check_mark: | `Surfaces.Message()`
| Modal | Surface | :white_check_mark: | `Surfaces.Modal()`
| Workflow Step | Surface | :white_check_mark: | `Surfaces.WorkflowStep()`
| Actions | Block | :white_check_mark: | `Blocks.Actions()`
| Context | Block | :white_check_mark: | `Blocks.Context()`
| Divider | Block | :white_check_mark: | `Blocks.Divider()`
| File | Block | :white_check_mark: | `Blocks.File()`
| Header | Block | :white_check_mark: | `Blocks.Header()`
| Image | Block | :white_check_mark: | `Blocks.Image()`
| Input | Block | :white_check_mark: | `Blocks.Input()`
| Section | Block | :white_check_mark: | `Blocks.Section()`
| Video | Block | :white_check_mark: | `Blocks.Video()`
| Button | Element | :white_check_mark:️ | `Elements.Button()`
| Checkboxes | Element | :white_check_mark: | `Elements.Checkboxes()`
| Date Picker | Element | :white_check_mark: | `Elements.DatePicker()`
| Date Time Picker | Element | :white_check_mark: | `Elements.DateTimePicker()`
| Email Input | Element | :white_check_mark: | `Elements.EmailInput()`
| Time Picker | Element | :white_check_mark: | `Elements.TimePicker()`
| Image | Element | :white_check_mark: | `Elements.Img()`
| Number Input | Element | :white_check_mark: | `Elements.NumberInput()`
| Overflow Menu | Element | :white_check_mark: | `Elements.OverflowMenu()`
| Radio Buttons | Element | :white_check_mark: | `Elements.RadioButtons()`
| Plain-Text Input | Element | :white_check_mark: | `Elements.TextInput()`
| Select Menus | Element | :white_check_mark: | `Elements.[Type]Select()`
| Multi-Select Menus | Element | :white_check_mark: | `Elements.[Type]MultiSelect()`
| URL Input | Element | :white_check_mark: | `Elements.NumberInput()`
| Option | Composition Object | :white_check_mark: | `Bits.Option()`
| Confirm Dialog | Composition Object | :white_check_mark: | `Bits.ConfirmationDialog()`
| Option Group | Composition Object | :white_check_mark: | `Bits.OptionGroup()`
| Attachment | Legacy Feature | :white_check_mark: | `Bits.Attachment()`

### Creating a Simple Interactive Message

Expand Down
6 changes: 5 additions & 1 deletion docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,20 @@
* [Checkboxes](elements/checkboxes.md "Block Builder – Checkboxes – Maintainable JavaScript Code for Slack Block Kit")
* [Conversation Multi-Select](elements/conversation-multi-select.md "Block Builder – Conversation Multi-Select – Maintainable JavaScript Code for Slack Block Kit")
* [Conversation Select](elements/conversation-select.md "Block Builder – Conversation Select – Maintainable JavaScript Code for Slack Block Kit")
* [Date Picker](elements/datepicker.md "Block Builder – Date Picker – Maintainable JavaScript Code for Slack Block Kit")
* [Date Picker](elements/date-picker.md "Block Builder – Date Picker – Maintainable JavaScript Code for Slack Block Kit")
* [Date Time Picker](elements/date-time-picker.md "Block Builder – Date Time Picker – Maintainable JavaScript Code for Slack Block Kit")
* [Email Input](elements/email-input.md "Block Builder – Email Input – Maintainable JavaScript Code for Slack Block Kit")
* [External Multi-Select](elements/external-multi-select.md "Block Builder – External Multi-Select – Maintainable JavaScript Code for Slack Block Kit")
* [External Select](elements/external-select.md "Block Builder – External Select – Maintainable JavaScript Code for Slack Block Kit")
* [Image](elements/img.md "Block Builder – Image – Maintainable JavaScript Code for Slack Block Kit")
* [Number Input](elements/number-input.md "Block Builder – Number Input – Maintainable JavaScript Code for Slack Block Kit")
* [Overflow Menu](elements/overflow-menu.md "Block Builder – Overflow Menu – Maintainable JavaScript Code for Slack Block Kit")
* [Radio Buttons](elements/radio-buttons.md "Block Builder – Radio Buttons – Maintainable JavaScript Code for Slack Block Kit")
* [Static Multi-Select](elements/static-multi-select.md "Block Builder – Static Multi-Select – Maintainable JavaScript Code for Slack Block Kit")
* [Static Select](elements/static-select.md "Block Builder – Static Select – Maintainable JavaScript Code for Slack Block Kit")
* [Plain-Text Input](elements/text-input.md "Block Builder – Plain-Text Input – Maintainable JavaScript Code for Slack Block Kit")
* [Time Picker](elements/timepicker.md "Block Builder – Time Picker – Maintainable JavaScript Code for Slack Block Kit")
* [URL Input](elements/url-input.md "Block Builder – URL Input – Maintainable JavaScript Code for Slack Block Kit")
* [User Multi-Select](elements/user-multi-select.md "Block Builder – User Multi-Select – Maintainable JavaScript Code for Slack Block Kit")
* [User Select](elements/user-select.md "Block Builder – User Select – Maintainable JavaScript Code for Slack Block Kit")

Expand Down
File renamed without changes.
66 changes: 66 additions & 0 deletions docs/elements/date-time-picker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Date Picker

?> **Note:** This document is a reference to the `DateTimePickerBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Date Picker docs](https://api.slack.com/reference/block-kit/block-elements#datetimepicker) on Slack's doc site.

### Creating an Instance

The function that creates a new instance of `DateTimePickerBuilder` is available as both a top-level import and as a member of its 'category', `Elements`:

```javascript
import { DateTimePicker } from 'slack-block-builder';

const myObj = DateTimePicker(params?);

```
```javascript
import { Elements } from 'slack-block-builder';

const myObj = Elements.DateTimePicker(params?);
```
### Params
Each instance of the `DateTimePickerBuilder` object has chainable setter methods for the object's properties. However, properties with primitive values can optionally be passed to the instantiating function, should you prefer:
`actionId` – *String*
`initialDateTime` – *Date*
?> **Note:** For an explanation of any one of the parameters, see its corresponding setter method below.
### Setter Methods
All setter methods return `this`, the instance of `DateTimePickerBuilder` on which it is called.
```javascript
DateTimePickerBuilder.focusOnLoad(boolean?);
```
Sets an element to have auto focus on opening the view Defaults to `true`.
```javascript
DateTimePickerBuilder.actionId(string);
```
Sets a string to be an identifier for the action taken by the user. It is sent back to your app in the interaction payload when the element is interacted or when the view is submitted.
```javascript
DateTimePickerBuilder.confirm(ConfirmationDialog);
```
For confirmation dialogs, sets the text of the button that confirms the action to which the confirmation dialog has been added. For elements, adds a confirmation dialog that is displayed when the user interacts with the element to confirm the selection or action.
```javascript
DateTimePickerBuilder.initialDateTime(Date);
```
Pre-populates the date time picker with a selected, default date and time.
### Other Methods
The `DateTimePickerBuilder` object also has other methods available:
```javascript
DateTimePickerBuilder.end();
```
Performs no alterations to the object on which it is called. It is meant to simulate a closing HTML tag for those who prefer to have an explicit end declared for an object.
78 changes: 78 additions & 0 deletions docs/elements/email-input.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Email Input

?> **Note:** This document is a reference to the `EmailInputBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Email Input docs](https://api.slack.com/reference/block-kit/block-elements#email) on Slack's doc site.

### Creating an Instance

The function that creates a new instance of `EmailInputBuilder` is available as both a top-level import and as a member of its 'category', `Elements`:

```javascript
import { EmailInput } from 'slack-block-builder';

const myObj = EmailInput(params?);

```
```javascript
import { Elements } from 'slack-block-builder';

const myObj = Elements.EmailInput(params?);
```
### Params
Each instance of the `EmailInputBuilder` object has chainable setter methods for the object's properties. However, properties with primitive values can optionally be passed to the instantiating function, should you prefer:
`actionId` – *String*
`initialValue` – *String*
`placeholder` – *String*
?> **Note:** For an explanation of any one of the parameters, see its corresponding setter method below.
### Setter Methods
All setter methods return `this`, the instance of `EmailInputBuilder` on which it is called.
```javascript
EmailInputBuilder.dispatchActionOnCharacterEntered(boolean?);
```
Instructs the Slack API to dispatch an interaction payload to your app when the user enters or deletes a character in the input. Defaults to `true`.
```javascript
EmailInputBuilder.dispatchActionOnEnterPressed(boolean?);
```
Instructs the Slack API to dispatch an interaction payload to your app when the user presses the enter key while the input is in focus. Defaults to `true`.
```javascript
EmailInputBuilder.focusOnLoad(boolean?);
```
Sets an element to have auto focus on opening the view Defaults to `true`.
```javascript
EmailInputBuilder.actionId(string);
```
Sets a string to be an identifier for the action taken by the user. It is sent back to your app in the interaction payload when the element is interacted or when the view is submitted.
```javascript
EmailInputBuilder.initialValue(string);
```
Pre-populates the input with a default value.
```javascript
EmailInputBuilder.placeholder(string);
```
Defines the text displayed as a placeholder in the empty input element.
### Other Methods
The `EmailInputBuilder` object also has other methods available:
```javascript
EmailInputBuilder.end();
```
Performs no alterations to the object on which it is called. It is meant to simulate a closing HTML tag for those who prefer to have an explicit end declared for an object.
99 changes: 99 additions & 0 deletions docs/elements/number-input.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Email Input

?> **Note:** This document is a reference to the `NumberInputBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Email Input docs](https://api.slack.com/reference/block-kit/block-elements#number) on Slack's doc site.

### Creating an Instance

The function that creates a new instance of `NumberInputBuilder` is available as both a top-level import and as a member of its 'category', `Elements`:

```javascript
import { NumberInput } from 'slack-block-builder';

const myObj = NumberInput(params?);

```
```javascript
import { Elements } from 'slack-block-builder';

const myObj = Elements.NumberInput(params?);
```
### Params
Each instance of the `NumberInputBuilder` object has chainable setter methods for the object's properties. However, properties with primitive values can optionally be passed to the instantiating function, should you prefer:
`actionId` – *String*
`initialValue` – *Int*
`isDecimalAllowed` – *boolean*
`minValue` – *Int*
`maxValue` – *Int*
`placeholder` – *String*
?> **Note:** For an explanation of any one of the parameters, see its corresponding setter method below.
### Setter Methods
All setter methods return `this`, the instance of `NumberInputBuilder` on which it is called.
```javascript
NumberInputBuilder.dispatchActionOnCharacterEntered(boolean?);
```
Instructs the Slack API to dispatch an interaction payload to your app when the user enters or deletes a character in the input. Defaults to `true`.
```javascript
NumberInputBuilder.dispatchActionOnEnterPressed(boolean?);
```
Instructs the Slack API to dispatch an interaction payload to your app when the user presses the enter key while the input is in focus. Defaults to `true`.
```javascript
NumberInputBuilder.focusOnLoad(boolean?);
```
Sets an element to have auto focus on opening the view Defaults to `true`.
```javascript
NumberInputBuilder.actionId(string);
```
Sets a string to be an identifier for the action taken by the user. It is sent back to your app in the interaction payload when the element is interacted or when the view is submitted.
```javascript
NumberInputBuilder.initialValue(string);
```
Pre-populates the input with a default value.
```javascript
NumberInputBuilder.isDecimalAllowed(boolean);
```
Dicates whether a decimal is allowed for the value entered into the number input.
```javascript
NumberInputBuilder.maxValue(int);
```
Sets a maximum value for the number input.
```javascript
NumberInputBuilder.minValue(int);
```
Sets a minimum value for the number input.
```javascript
NumberInputBuilder.placeholder(string);
```
Defines the text displayed as a placeholder in the empty input element.
### Other Methods
The `NumberInputBuilder` object also has other methods available:
```javascript
NumberInputBuilder.end();
```
Performs no alterations to the object on which it is called. It is meant to simulate a closing HTML tag for those who prefer to have an explicit end declared for an object.
2 changes: 1 addition & 1 deletion docs/elements/text-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Sets a string to be an identifier for the action taken by the user. It is sent b
TextInputBuilder.initialValue(string);
```
Pre-populates the text input with default, editable text.
Pre-populates the input with a default value.
```javascript
TextInputBuilder.maxLength(int);
```
Expand Down
Loading

0 comments on commit 68af561

Please sign in to comment.