import { JSXSlack } from '../../jsx';
import { DistributedProps } from '../../utils';
import { PrivateMetadataTransformer } from './utils';
interface ModalPropsBase {
children: JSXSlack.ChildNodes;
/**
* An identifier for this modal to recognize it in various events from Slack.
*/
callbackId?: string;
/**
* An optional metadata string for handling stored data in callback events
* from Slack API. (3000 characters maximum)
*
* If not defined, the modal will use values defined in
* `` as metadata stringified to JSON.
*
* ### Custom transformer
*
* You can also customize how to transform hidden values into string by
* passing the custom transformer function.
*
* @example
* ```jsx
* hidden && new URLSearchParams(hidden).toString()}
* >
*
*
*
*
* ```
*
* In this example, the private metadata would be `A=foobar&B=123&C=true` by
* transformation using `URLSearchParams`.
*
* The transformer takes an argument: JSON object of hidden values, or
* `undefined` when there was no hidden values. It must return the transformed
* string, or `undefined` if won't assign private metadata.
*/
privateMetadata?: string | PrivateMetadataTransformer;
}
interface BasicModalProps extends ModalPropsBase {
/**
* Set whether all stacked views will clear by the close button on this modal.
*/
clearOnClose?: boolean;
/** A text for close button of the modal. (24 characters maximum) */
close?: string;
/** A unique ID for all views on a per-team basis. */
externalId?: string;
/**
* Set whether to send `view_closed` event to the request URL of Slack app
* when closed modal.
*/
notifyOnClose?: boolean;
/**
* A text for submit button of the regular modal. (24 characters maximum)
*
* If not defined this prop in the regular modal and it required the submit
* button, the label will be defined by `` in children,
* or used default label "Submit".
*/
submit?: string;
/** An user-facing title of the modal. (24 characters maximum) */
title: string;
/**
* Set a type of modal.
*
* - `modal` (default): The regular modal surface.
* - `workflow_step`: The modal surface for [custom workflow step](https://api.slack.com/workflows/steps).
*/
type?: 'modal';
}
interface WorkflowStepModalProps extends ModalPropsBase {
type: 'workflow_step';
/**
* ### `workflow_step` type
*
* When type prop has set as workflow_step, this prop has a different meaning
* corresponded with [`submit_disabled` field in a configuration view object](https://api.slack.com/reference/workflows/configuration-view).
*
* By setting `submit` as `false`, the submit button will be disabled _until
* one or more inputs have filled_.
*/
submit?: boolean;
}
type ModalProps = DistributedProps;
/**
* The container component for the view of
* [modals](https://api.slack.com/surfaces/modals).
*
* `` can include following block elements:
*
* - `` (``)
* - `` (``)
* - `` (``)
* - `` (``)
* - ``
* - ``
* - `` (``)
* - `