jsx-slack
Version:
Build JSON object for Slack Block Kit surfaces from JSX
46 lines (45 loc) • 1.66 kB
TypeScript
import { JSXSlack } from '../../jsx';
import { BuiltInComponent } from '../../jsx-internals';
import { OptgroupComposition } from '../composition/Optgroup';
import { OptionComposition } from '../composition/Option';
export declare const selectFragmentSelectedOptionsSymbol: unique symbol;
export type SelectFragmentObject = ({
options: OptionComposition[];
} | {
option_groups: OptgroupComposition[];
}) & {
readonly [selectFragmentSelectedOptionsSymbol]?: OptionComposition[];
};
export interface SelectFragmentProps {
children?: JSXSlack.ChildNodes;
}
export declare const SelectFragmentInternal: BuiltInComponent<SelectFragmentProps & {
from?: BuiltInComponent<any> | undefined;
}>;
/**
* Generate JSON for the external data source of `<ExternalSelect>`.
*
* It must contain elements either of `<Option>` or `<Optgroup>` as immediate
* children. The outputted JSON has an array of corresponded elements, or empty
* options array if it has provided no options.
*
* For example, [Bolt framework for JavaScript](https://slack.dev/bolt/concepts#options)
* by Slack can provide external data source easily by using `<SelectFragment>`
* together.
*
* ```javascript
* // `app` is an instance of the app created by Bolt framework
* app.options('external_action', async ({ ack }) => {
* await ack(
* <SelectFragment>
* <Option value="a">Option A</Option>
* <Option value="b">Option B</Option>
* <Option value="c">Option C</Option>
* </SelectFragment>
* )
* })
* ```
*
* @return The JSON for the external data source
*/
export declare const SelectFragment: BuiltInComponent<SelectFragmentProps>;