File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
package/src/components/ConfirmDialog/helpers Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -5,11 +5,9 @@ import ConfirmDialogBase from "./ConfirmDialogBase";
55 * @summary React hook for creating detached confirm dialogs with ease
66 * @param {Object } props Props to configure a confirm dialog
77 * @param {String } props.cancelActionText Cancel button text
8- * @param {Function } props.children Render prop `{({ openDialog }) => ()}`
98 * @param {Boolean } props.closeOnConfirm Close dialog on confirmation. Default `true`
109 * @param {String } props.confirmActionText Text for confirm button
1110 * @param {ReactElement } props.content Child elements of the dialog. Use if this for rendering a custom components in the dialog.
12- * @param {Boolean } props.isOpen Dialog open/close state
1311 * @param {String|React.Element } props.message Message body. May be a String or a React component. Use if your message is mostly text.
1412 * @param {Function } props.onClose Close callback
1513 * @param {Function } props.onConfirm Confirmation callback
@@ -18,13 +16,17 @@ import ConfirmDialogBase from "./ConfirmDialogBase";
1816 */
1917export default function useConfirmDialog ( {
2018 closeOnConfirm = true ,
21- onConfirm = ( ) => { } ,
19+ onClose = ( ) => { } ,
20+ onConfirm = ( ) => { } ,
2221 ...props
2322} ) {
2423 const [ isOpen , setOpen ] = useState ( false ) ;
2524
2625 const openDialog = ( ) => setOpen ( true ) ;
27- const closeDialog = ( ) => setOpen ( false ) ;
26+ const closeDialog = ( ) => {
27+ setOpen ( false ) ;
28+ onClose ( ) ;
29+ } ;
2830 const handleConfirm = ( ) => {
2931 onConfirm ( ) ;
3032
You can’t perform that action at this time.
0 commit comments