fix(striker-ui): expose disableProceed in ConfirmDialog

main
Tsu-ba-me 2 years ago
parent 952d95feac
commit fc016ea719
  1. 10
      striker-ui/components/ConfirmDialog.tsx
  2. 1
      striker-ui/types/ConfirmDialog.d.ts

@ -42,6 +42,7 @@ const ConfirmDialog = forwardRef<
PaperProps: paperProps = {}, PaperProps: paperProps = {},
...restDialogProps ...restDialogProps
} = {}, } = {},
disableProceed: isDisableProceed,
formContent: isFormContent, formContent: isFormContent,
loading: isLoading = false, loading: isLoading = false,
loadingAction: isLoadingAction = false, loadingAction: isLoadingAction = false,
@ -60,8 +61,11 @@ const ConfirmDialog = forwardRef<
ref, ref,
) => { ) => {
const { sx: paperSx, ...restPaperProps } = paperProps; const { sx: paperSx, ...restPaperProps } = paperProps;
const { sx: proceedButtonSx, ...restProceedButtonProps } = const {
proceedButtonProps; disabled: proceedButtonDisabled = isDisableProceed,
sx: proceedButtonSx,
...restProceedButtonProps
} = proceedButtonProps;
const [isOpen, setIsOpen] = useState<boolean>(openInitially); const [isOpen, setIsOpen] = useState<boolean>(openInitially);
@ -142,6 +146,7 @@ const ConfirmDialog = forwardRef<
const proceedButtonElement = useMemo( const proceedButtonElement = useMemo(
() => ( () => (
<ContainedButton <ContainedButton
disabled={proceedButtonDisabled}
onClick={proceedButtonClickEventHandler} onClick={proceedButtonClickEventHandler}
type={proceedButtonType} type={proceedButtonType}
{...restProceedButtonProps} {...restProceedButtonProps}
@ -160,6 +165,7 @@ const ConfirmDialog = forwardRef<
[ [
actionProceedText, actionProceedText,
proceedButtonClickEventHandler, proceedButtonClickEventHandler,
proceedButtonDisabled,
proceedButtonSx, proceedButtonSx,
proceedButtonType, proceedButtonType,
proceedColour, proceedColour,

@ -3,6 +3,7 @@ type ConfirmDialogOptionalProps = {
closeOnProceed?: boolean; closeOnProceed?: boolean;
contentContainerProps?: import('../components/FlexBox').FlexBoxProps; contentContainerProps?: import('../components/FlexBox').FlexBoxProps;
dialogProps?: Partial<import('@mui/material').DialogProps>; dialogProps?: Partial<import('@mui/material').DialogProps>;
disableProceed?: boolean;
formContent?: boolean; formContent?: boolean;
loading?: boolean; loading?: boolean;
loadingAction?: boolean; loadingAction?: boolean;

Loading…
Cancel
Save