UNPKG

pzl-react-reusable-components

Version:
58 lines (50 loc) 1.63 kB
export type ConfirmDialogResponseValue = boolean | string export type ConfirmDialogResponse = [string, ConfirmDialogResponseValue?, boolean?] export interface IUseConfirmationState { /** * */ props?: IConfirmDialogProps; /** * On response callback is called when the user clicks one of the * of the possible responses in the dialog. * * @param responseValue The value of the response button clicked. * @param comment The value of the comment field if enabled. */ onResponse?: (responseValue: ConfirmDialogResponseValue, comment?: string) => void; } export interface IConfirmDialogProps { /** * Title to display in the dialog. */ title?: string /** * Subtext to display in the dialog. */ subText?: string /** * On response callback is called when the user clicks one of the * of the possible responses in the dialog. * * @param responseValue The value of the response button clicked. * @param comment The value of the comment field if enabled. */ onResponse?: (responseValue: ConfirmDialogResponseValue, comment?: string) => void /** * Array of possible responses. Array of up to three properties. * * 1. The button text (string) * 2. The returned value (boolean or string) * 3. Render button as primary (boolean) */ responses: ConfirmDialogResponse[] /** * Enable comments field in the dialog. */ enableCommentsField?: boolean /** * Placeholder text for the comments field. */ commentsFieldPlaceholder?: string }