UNPKG

fox-block-builder

Version:

Maintainable code for loop slack-block-kit-like modal builder

274 lines (273 loc) 18.8 kB
import { ButtonBuilder, ButtonParams } from './button'; import { ChannelMultiSelectBuilder, ChannelMultiSelectParams } from './channel-multi-select'; import { ChannelSelectBuilder, ChannelSelectParams } from './channel-select'; import { CheckboxesBuilder, CheckboxesParams } from './checkboxes'; import { ConversationMultiSelectBuilder, ConversationMultiSelectParams } from './conversation-multi-select'; import { ConversationSelectBuilder, ConversationSelectParams } from './conversation-select'; import { DatePickerBuilder, DatePickerParams } from './date-picker'; import { DateTimePickerBuilder, DateTimePickerParams } from './date-time-picker'; import { EmailInputBuilder, EmailInputParams } from './email-input'; import { ExternalMultiSelectBuilder, ExternalMultiSelectParams } from './external-multi-select'; import { ExternalSelectBuilder, ExternalSelectParams } from './external-select'; import { FileInputBuilder, FileInputParams } from './file-input'; import { ImgBuilder, ImgParams } from './img'; import { NumberInputBuilder, NumberInputParams } from './number-input'; import { OverflowMenuBuilder, OverflowMenuParams } from './overflow-menu'; import { RadioButtonsBuilder, RadioButtonsParams } from './radio-buttons'; import { StaticMultiSelectBuilder, StaticMultiSelectParams } from './static-multi-select'; import { StaticSelectBuilder, StaticSelectParams } from './static-select'; import { TextInputBuilder, TextInputParams } from './text-input'; import { TimePickerBuilder, TimePickerParams } from './timepicker'; import { URLInputBuilder, URLInputParams } from './url-input'; import { UserMultiSelectBuilder, UserMultiSelectParams } from './user-multi-select'; import { UserSelectBuilder, UserSelectParams } from './user-select'; import { DirectorySelectBuilder, DirectorySelectParams } from './directory-select'; import { OneSSelectBuilder, OneSSelectParams } from './one-s-select'; import { ImageSelectBuilder, ImageSelectParams } from './image-select'; import { TImageSelectVariant } from '../internal/types/index'; import { DateRangePickerBuilder, DateRangePickerParams } from './date-range-picker'; import { AddableInputBuilder, AddableParams } from './addable-input'; export type { ButtonBuilder, ButtonParams, ChannelMultiSelectBuilder, ChannelMultiSelectParams, ChannelSelectBuilder, ChannelSelectParams, CheckboxesBuilder, CheckboxesParams, ConversationMultiSelectBuilder, ConversationMultiSelectParams, ConversationSelectBuilder, ConversationSelectParams, DatePickerBuilder, DatePickerParams, DateTimePickerBuilder, DateTimePickerParams, EmailInputBuilder, EmailInputParams, ExternalMultiSelectBuilder, ExternalMultiSelectParams, ExternalSelectBuilder, ExternalSelectParams, ImgBuilder, ImgParams, NumberInputBuilder, NumberInputParams, OverflowMenuBuilder, OverflowMenuParams, RadioButtonsBuilder, RadioButtonsParams, StaticMultiSelectBuilder, StaticMultiSelectParams, StaticSelectBuilder, StaticSelectParams, TextInputBuilder, TextInputParams, TimePickerBuilder, TimePickerParams, URLInputBuilder, URLInputParams, UserMultiSelectBuilder, UserMultiSelectParams, UserSelectBuilder, UserSelectParams, FileInputBuilder, FileInputParams, }; /** * Functions here do not use arrow functions stored in variables for IDE color compatibility. */ /** * @param {Object} [config] Parameters passed to the constructor. * @param {string} [config.accessibilityLabel] Sets a longer descriptive text that will be read out by screen readers instead of the button text object. * @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [config.text] Sets the display text for the button. * @param {string} [config.url] Sets the URL to redirect the user to when this button is clicked. * @param {string} [config.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} */ export declare function Button(params?: ButtonParams): ButtonBuilder; /** * @param {Object} [config] Parameters passed to the constructor. * @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with. * @param {int} [config.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} */ export declare function ChannelMultiSelect(params?: ChannelMultiSelectParams): ChannelMultiSelectBuilder; /** * @param {Object} [config] Parameters passed to the constructor. * @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [config.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} */ export declare function ChannelSelect(params?: ChannelSelectParams): ChannelSelectBuilder; /** * @param {Object} [config] Parameters passed to the constructor. * @param {string} [config.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} */ export declare function Checkboxes(params?: CheckboxesParams): CheckboxesBuilder; /** * @param {Object} [config] Parameters passed to the constructor. * @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with. * @param {int} [config.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} */ export declare function ConversationMultiSelect(params?: ConversationMultiSelectParams): ConversationMultiSelectBuilder; /** * @param {Object} [config] Parameters passed to the constructor. * @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [config.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} */ export declare function ConversationSelect(params?: ConversationSelectParams): ConversationSelectBuilder; /** * @param {Object} [config] Parameters passed to the constructor. * @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [config.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} */ export declare function DatePicker(params?: DatePickerParams): DatePickerBuilder; /** * @param {Object} [config] Parameters passed to the constructor. * @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [config.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} */ export declare function DateTimePicker(params?: DateTimePickerParams): DateTimePickerBuilder; /** * @param {Object} [config] Parameters passed to the constructor. * @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [config.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} */ export declare function EmailInput(params?: EmailInputParams): EmailInputBuilder; /** * @param {Object} [config] Parameters passed to the constructor. * @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with. * @param {int} [config.maxSelectedItems] Sets a limit to how many items the user can select. * @param {int} [config.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} */ export declare function ExternalMultiSelect(params?: ExternalMultiSelectParams): ExternalMultiSelectBuilder; /** * @param {Object} [config] Parameters passed to the constructor. * @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with. * @param {int} [config.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} */ export declare function ExternalSelect(params?: ExternalSelectParams): ExternalSelectBuilder; /** * @param {Object} [config] Parameters passed to the constructor. * @param {string} [config.imageUrl] Sets the source URL from which the image will be loaded. * @param {string} [config.altText] Sets the textual summary of the image. * * {@link https://api.slack.com/reference/block-kit/block-elements#image|View in Slack API Documentation} */ export declare function Img(params?: ImgParams): ImgBuilder; /** * @param {Object} [config] Parameters passed to the constructor. * @param {string} [config.filetypes] Sets the accepted filetypes. * @param {string} [config.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} */ export declare function FileInput(params?: FileInputParams): FileInputBuilder; /** * @param {Object} [config] Parameters passed to the constructor. * @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {boolean} [config.isDecimalAllowed] Dicates whether a decimal is allowed for the value entered into the number input. * @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [config.initialValue] Sets the default text entered into the text input at modal render. * @param {int} [config.minValue] Sets a minimum value for the number input. * @param {int} [config.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} */ export declare function NumberInput(params?: NumberInputParams): NumberInputBuilder; /** * @param {Object} [config] Parameters passed to the constructor. * @param {string} [config.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} */ export declare function OverflowMenu(params?: OverflowMenuParams): OverflowMenuBuilder; /** * @param {Object} [config] Parameters passed to the constructor. * @param {string} [config.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} */ export declare function RadioButtons(params?: RadioButtonsParams): RadioButtonsBuilder; /** * @param {Object} [config] Parameters passed to the constructor. * @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with. * @param {int} [config.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} */ export declare function StaticMultiSelect(params?: StaticMultiSelectParams): StaticMultiSelectBuilder; /** * @param {Object} [config] Parameters passed to the constructor. * @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [config.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} */ export declare function StaticSelect(params?: StaticSelectParams): StaticSelectBuilder; /** * @param {Object} [config] Parameters passed to the constructor. * @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [config.initialValue] Sets the default text entered into the text input at modal render. * @param {boolean} [config.multiline] Sets whether the input will be a single line or a larger text area. * @param {int} [config.minLength] Sets a minimum character count in order for the user to submit the form. * @param {int} [config.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} */ export declare function TextInput(params?: TextInputParams): TextInputBuilder; /** * @param {Object} [config] Parameters passed to the constructor. * @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [config.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} */ export declare function TimePicker(params?: TimePickerParams): TimePickerBuilder; /** * @param {Object} [config] Parameters passed to the constructor. * @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [config.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} */ export declare function URLInput(params?: URLInputParams): URLInputBuilder; /** * @param {Object} [config] Parameters passed to the constructor. * @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with. * @param {int} [config.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} */ export declare function UserMultiSelect(params?: UserMultiSelectParams): UserMultiSelectBuilder; /** * @param {Object} [config] Parameters passed to the constructor. * @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads. * @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with. * @param {string} [config.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} */ export declare function UserSelect(params?: UserSelectParams): UserSelectBuilder; /** Расширенные элементы нашего форка */ /** Выбор параметров из хендбуков ПФ */ export declare function DirectorySelect(params: DirectorySelectParams): DirectorySelectBuilder; /** Выбор параметров из хендбуков ПФ */ export declare function OneSSelect(params: OneSSelectParams): OneSSelectBuilder; /** Выбор изображений. Формат опций - {url: {ссылка}, text: {alt}} */ export declare function ImageSelect(variant?: TImageSelectVariant, params?: ImageSelectParams): ImageSelectBuilder; export declare function DateRangePicker(params?: DateRangePickerParams): DateRangePickerBuilder; export declare function AddableInput(params?: AddableParams): AddableInputBuilder; declare const elements: { Button: typeof Button; ChannelMultiSelect: typeof ChannelMultiSelect; ChannelSelect: typeof ChannelSelect; Checkboxes: typeof Checkboxes; DatePicker: typeof DatePicker; DateTimePicker: typeof DateTimePicker; EmailInput: typeof EmailInput; NumberInput: typeof NumberInput; RadioButtons: typeof RadioButtons; StaticMultiSelect: typeof StaticMultiSelect; StaticSelect: typeof StaticSelect; TextInput: typeof TextInput; TimePicker: typeof TimePicker; URLInput: typeof URLInput; UserMultiSelect: typeof UserMultiSelect; UserSelect: typeof UserSelect; FileInput: typeof FileInput; DirectorySelect: typeof DirectorySelect; OneSSelect: typeof OneSSelect; ImageSelect: typeof ImageSelect; DateRangePicker: typeof DateRangePicker; AddableInput: typeof AddableInput; }; export { elements as Elements };