UNPKG

fox-slack-block-builder

Version:

Maintainable code for interactive Slack messages, modals, home tabs, and workflow steps. A must-have for the Slack Block Kit framework.

332 lines (331 loc) 17.3 kB
"use strict"; /* eslint-disable max-len */ Object.defineProperty(exports, "__esModule", { value: true }); exports.Elements = exports.UserSelect = exports.UserMultiSelect = exports.URLInput = exports.TimePicker = exports.TextInput = exports.StaticSelect = exports.StaticMultiSelect = exports.RadioButtons = exports.OverflowMenu = exports.NumberInput = exports.FileInput = exports.Img = exports.ExternalSelect = exports.ExternalMultiSelect = exports.EmailInput = exports.DateTimePicker = exports.DatePicker = exports.ConversationSelect = exports.ConversationMultiSelect = exports.Checkboxes = exports.ChannelSelect = exports.ChannelMultiSelect = exports.Button = void 0; const button_1 = require("./button"); const channel_multi_select_1 = require("./channel-multi-select"); const channel_select_1 = require("./channel-select"); const checkboxes_1 = require("./checkboxes"); const conversation_multi_select_1 = require("./conversation-multi-select"); const conversation_select_1 = require("./conversation-select"); const date_picker_1 = require("./date-picker"); const date_time_picker_1 = require("./date-time-picker"); const email_input_1 = require("./email-input"); const external_multi_select_1 = require("./external-multi-select"); const external_select_1 = require("./external-select"); const file_input_1 = require("./file-input"); const img_1 = require("./img"); const number_input_1 = require("./number-input"); const overflow_menu_1 = require("./overflow-menu"); const radio_buttons_1 = require("./radio-buttons"); const static_multi_select_1 = require("./static-multi-select"); const static_select_1 = require("./static-select"); const text_input_1 = require("./text-input"); const timepicker_1 = require("./timepicker"); const url_input_1 = require("./url-input"); const user_multi_select_1 = require("./user-multi-select"); const user_select_1 = require("./user-select"); /** * Functions here do not use arrow functions stored in variables for IDE color compatibility. */ /** * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.accessibilityLabel] Sets a longer descriptive text that will be read out by screen readers instead of the button text object. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [params.text] Sets the display text for the button. * @param {string} [params.url] Sets the URL to redirect the user to when this button is clicked. * @param {string} [params.value] Sets the value to be passed to your app when this button is clicked. * * {@link https://api.slack.com/reference/block-kit/block-elements#button|View in Slack API Documentation} */ function Button(params) { return new button_1.ButtonBuilder(params); } exports.Button = Button; /** * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {int} [params.maxSelectedItems] Sets a limit to how many items the user can select. * * {@link https://api.slack.com/reference/block-kit/block-elements#channel_multi_select|View in Slack API Documentation} */ function ChannelMultiSelect(params) { return new channel_multi_select_1.ChannelMultiSelectBuilder(params); } exports.ChannelMultiSelect = ChannelMultiSelect; /** * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [params.initialChannel] Sets the default selected item in the menu. * * {@link https://api.slack.com/reference/block-kit/block-elements#channel_select|View in Slack API Documentation} */ function ChannelSelect(params) { return new channel_select_1.ChannelSelectBuilder(params); } exports.ChannelSelect = ChannelSelect; /** * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * * {@link https://api.slack.com/reference/block-kit/block-elements#checkboxes|View in Slack API Documentation} */ function Checkboxes(params) { return new checkboxes_1.CheckboxesBuilder(params); } exports.Checkboxes = Checkboxes; /** * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {int} [params.maxSelectedItems] Sets a limit to how many items the user can select. * * {@link https://api.slack.com/reference/block-kit/block-elements#conversation_multi_select|View in Slack API Documentation} */ function ConversationMultiSelect(params) { return new conversation_multi_select_1.ConversationMultiSelectBuilder(params); } exports.ConversationMultiSelect = ConversationMultiSelect; /** * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [params.initialConversation] Sets the default selected item in the menu. * * {@link https://api.slack.com/reference/block-kit/block-elements#conversation_multi_select|View in Slack API Documentation} */ function ConversationSelect(params) { return new conversation_select_1.ConversationSelectBuilder(params); } exports.ConversationSelect = ConversationSelect; /** * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [params.initialDate] Sets the default selected date in the menu. * * {@link https://api.slack.com/reference/block-kit/block-elements#datepicker|View in Slack API Documentation} */ function DatePicker(params) { return new date_picker_1.DatePickerBuilder(params); } exports.DatePicker = DatePicker; /** * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [params.initialDateTime] Sets the default selected date and time for the date time picker. * * {@link https://api.slack.com/reference/block-kit/block-elements#datetimepicker|View in Slack API Documentation} */ function DateTimePicker(params) { return new date_time_picker_1.DateTimePickerBuilder(params); } exports.DateTimePicker = DateTimePicker; /** * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [params.initialValue] Sets the default email entered into the Email input at modal render. * * {@link https://api.slack.com/reference/block-kit/block-elements#email|View in Slack API Documentation} */ function EmailInput(params) { return new email_input_1.EmailInputBuilder(params); } exports.EmailInput = EmailInput; /** * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {int} [params.maxSelectedItems] Sets a limit to how many items the user can select. * @param {int} [params.minQueryLength] Sets a minimum number of characters types before querying your options URL. * * {@link https://api.slack.com/reference/block-kit/block-elements#external_multi_select|View in Slack API Documentation} */ function ExternalMultiSelect(params) { return new external_multi_select_1.ExternalMultiSelectBuilder(params); } exports.ExternalMultiSelect = ExternalMultiSelect; /** * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {int} [params.minQueryLength] Sets a minimum number of characters types before querying your options URL. * * {@link https://api.slack.com/reference/block-kit/block-elements#external_select|View in Slack API Documentation} */ function ExternalSelect(params) { return new external_select_1.ExternalSelectBuilder(params); } exports.ExternalSelect = ExternalSelect; /** * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.imageUrl] Sets the source URL from which the image will be loaded. * @param {string} [params.altText] Sets the textual summary of the image. * * {@link https://api.slack.com/reference/block-kit/block-elements#image|View in Slack API Documentation} */ function Img(params) { return new img_1.ImgBuilder(params); } exports.Img = Img; /** * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.filetypes] Sets the accepted filetypes. * @param {string} [params.maxFiles] Sets the maximum number of files to upload. * * {@link https://api.slack.com/reference/block-kit/block-elements#file_input|View in Slack API Documentation} */ function FileInput(params) { return new file_input_1.FileInputBuilder(params); } exports.FileInput = FileInput; /** * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {boolean} [params.isDecimalAllowed] Dicates whether a decimal is allowed for the value entered into the number input. * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [params.initialValue] Sets the default text entered into the text input at modal render. * @param {int} [params.minValue] Sets a minimum value for the number input. * @param {int} [params.maxValue] Sets a maximum value for the number input. * * {@link https://api.slack.com/reference/block-kit/block-elements#number|View in Slack API Documentation} */ function NumberInput(params) { return new number_input_1.NumberInputBuilder(params); } exports.NumberInput = NumberInput; /** * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * * {@link https://api.slack.com/reference/block-kit/block-elements#overflow|View in Slack API Documentation} */ function OverflowMenu(params) { return new overflow_menu_1.OverflowMenuBuilder(params); } exports.OverflowMenu = OverflowMenu; /** * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * * {@link https://api.slack.com/reference/block-kit/block-elements#radio|View in Slack API Documentation} */ function RadioButtons(params) { return new radio_buttons_1.RadioButtonsBuilder(params); } exports.RadioButtons = RadioButtons; /** * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {int} [params.maxSelectedItems] Sets a limit to how many items the user can select. * * {@link https://api.slack.com/reference/block-kit/block-elements#static_multi_select|View in Slack API Documentation} */ function StaticMultiSelect(params) { return new static_multi_select_1.StaticMultiSelectBuilder(params); } exports.StaticMultiSelect = StaticMultiSelect; /** * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * * {@link https://api.slack.com/reference/block-kit/block-elements#static_select|View in Slack API Documentation} */ function StaticSelect(params) { return new static_select_1.StaticSelectBuilder(params); } exports.StaticSelect = StaticSelect; /** * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [params.initialValue] Sets the default text entered into the text input at modal render. * @param {boolean} [params.multiline] Sets whether the input will be a single line or a larger text area. * @param {int} [params.minLength] Sets a minimum character count in order for the user to submit the form. * @param {int} [params.maxLength] Sets a maximum character count allowed to send the form. * * {@link https://api.slack.com/reference/block-kit/block-elements#input|View in Slack API Documentation} */ function TextInput(params) { return new text_input_1.TextInputBuilder(params); } exports.TextInput = TextInput; /** * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [params.initialTime] Sets the default selected time in the menu. * * {@link https://api.slack.com/reference/block-kit/block-elements#timepicker|View in Slack API Documentation} */ function TimePicker(params) { return new timepicker_1.TimePickerBuilder(params); } exports.TimePicker = TimePicker; /** * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [params.initialValue] Sets the default URL entered into the URL input at modal render. * * {@link https://api.slack.com/reference/block-kit/block-elements#url|View in Slack API Documentation} */ function URLInput(params) { return new url_input_1.URLInputBuilder(params); } exports.URLInput = URLInput; /** * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {int} [params.maxSelectedItems] Sets a limit to how many items the user can select. * * {@link https://api.slack.com/reference/block-kit/block-elements#users_multi_select|View in Slack API Documentation} */ function UserMultiSelect(params) { return new user_multi_select_1.UserMultiSelectBuilder(params); } exports.UserMultiSelect = UserMultiSelect; /** * @param {Object} [params] Parameters passed to the constructor. * @param {string} [params.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [params.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [params.initialUser] Setts the default selected user in the menu. * * {@link https://api.slack.com/reference/block-kit/block-elements#users_select|View in Slack API Documentation} */ function UserSelect(params) { return new user_select_1.UserSelectBuilder(params); } exports.UserSelect = UserSelect; const elements = { Button, ChannelMultiSelect, ChannelSelect, Checkboxes, ConversationMultiSelect, ConversationSelect, DatePicker, DateTimePicker, EmailInput, ExternalMultiSelect, ExternalSelect, Img, NumberInput, OverflowMenu, RadioButtons, StaticMultiSelect, StaticSelect, TextInput, TimePicker, URLInput, UserMultiSelect, UserSelect, FileInput, }; exports.Elements = elements;