diff --git a/striker-ui/components/ConfirmDialog.tsx b/striker-ui/components/ConfirmDialog.tsx index 5259db49..e2a587f9 100644 --- a/striker-ui/components/ConfirmDialog.tsx +++ b/striker-ui/components/ConfirmDialog.tsx @@ -43,6 +43,7 @@ const ConfirmDialog = forwardRef< ...restDialogProps } = {}, formContent: isFormContent, + loading: isLoading = false, loadingAction: isLoadingAction = false, onActionAppend, onCancelAppend, @@ -208,6 +209,29 @@ const ConfirmDialog = forwardRef< [isScrollContent, scrollBoxSx], ); + const contentAreaElement = useMemo( + () => + isLoading ? ( + + ) : ( + <> + + {contentElement} + + {preActionArea} + {actionAreaElement} + + ), + [ + actionAreaElement, + combinedScrollBoxSx, + contentElement, + isLoading, + preActionArea, + restScrollBoxProps, + ], + ); + useImperativeHandle( ref, () => ({ @@ -232,11 +256,7 @@ const ConfirmDialog = forwardRef< onSubmit={contentContainerSubmitEventHandler} {...contentContainerProps} > - - {contentElement} - - {preActionArea} - {actionAreaElement} + {contentAreaElement} ); diff --git a/striker-ui/types/ConfirmDialog.d.ts b/striker-ui/types/ConfirmDialog.d.ts index 24e94d11..0be940a8 100644 --- a/striker-ui/types/ConfirmDialog.d.ts +++ b/striker-ui/types/ConfirmDialog.d.ts @@ -4,6 +4,7 @@ type ConfirmDialogOptionalProps = { contentContainerProps?: import('../components/FlexBox').FlexBoxProps; dialogProps?: Partial; formContent?: boolean; + loading?: boolean; loadingAction?: boolean; onActionAppend?: ContainedButtonProps['onClick']; onProceedAppend?: ContainedButtonProps['onClick'];