UNPKG

jsx-slack

Version:

Build JSON object for Slack Block Kit surfaces from JSX

50 lines (49 loc) 2.76 kB
import { BuiltInComponent } from '../../jsx-internals'; import { DistributedProps } from '../../utils'; import { ConfirmableProps } from '../composition/Confirm'; import { FilterProps } from '../composition/utils'; import { InputComponentProps } from '../layout/Input'; import { ActionProps, AutoFocusibleProps, SingleSelectableProps, MultiSelectablePropsFrom, ResponsableUrlProps } from './utils'; declare const conversationIdString: unique symbol; type ConversationIdString = string & { [conversationIdString]?: never; }; interface SingleConversationsSelectProps extends ActionProps, AutoFocusibleProps, ConfirmableProps, SingleSelectableProps, FilterProps { children?: never; /** * A string of ID for the initially selected conversation. In multiple select, * you can set multiple conversation IDs through array. * * `initialConversation` accepts the conversation id prefixed with `C`, `D`, * and `G`. In addition, jsx-slack recognizes the special value `current` for * indicating the origin conversation that the container surface belongs to. * * **NOTE**: `current` corresponds to `default_to_current_conversation` field * in Slack API. It will be ignored if defined initial conversations, so * multiple conversations select cannot specify `current` along with specific * conversations. */ initialConversation?: ConversationIdString | 'current'; /** The placeholder text shown in select field. */ placeholder?: string; /** An alias into `initialConversation` prop. */ value?: ConversationIdString | 'current'; } interface MultiConversationsSelectProps extends MultiSelectablePropsFrom<SingleConversationsSelectProps, 'initialConversation' | 'value'> { initialConversation?: ConversationIdString | 'current' | ConversationIdString[]; value?: ConversationIdString | 'current' | ConversationIdString[]; } export type ConversationsSelectProps = DistributedProps<InputComponentProps<SingleConversationsSelectProps, ResponsableUrlProps> | InputComponentProps<MultiConversationsSelectProps>>; /** * The interactive component or input component for * [the `conversations_select` element](https://api.slack.com/reference/block-kit/block-elements#conversation_select) and * [the `multi_conversations_select` element](https://api.slack.com/reference/block-kit/block-elements#conversation_multi_select). * * Provide a selectable menu element from a list of many kind of conversations * visible to the current user in the active workspace. * * @return The partial JSON of a block element for selecting from conversations, * or `input` layout block with it */ export declare const ConversationsSelect: BuiltInComponent<ConversationsSelectProps>; export {};