Skip to content

on-confirm-disabled-rename #3909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions packages/paste-core/components/alert-dialog/src/AlertDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,22 @@ export interface AlertDialogProps extends HTMLPasteProps<"div"> {
*/
onDismissLabel: string;
/**
* Disable the confirm button
* Disable the confirm button. Use isConfirmDisabled
* @deprecated This prop has been deprecated in favor of the `isConfirmDisabled` prop.
*
* @default false
* @type {boolean}
* @memberof AlertDialogProps
*/
onConfirmDisabled?: boolean;
/**
* Disable the confirm button
*
* @default false
* @type {boolean}
* @memberof AlertDialogProps
*/
isConfirmDisabled?: boolean;
/**
* Overrides the default element name to apply unique styles with the Customization Provider
*
Expand All @@ -105,6 +114,7 @@ export const AlertDialog = React.forwardRef<HTMLDivElement, AlertDialogProps>(
onDismiss,
onDismissLabel,
onConfirmDisabled,
isConfirmDisabled,
...props
},
ref,
Expand Down Expand Up @@ -143,7 +153,7 @@ export const AlertDialog = React.forwardRef<HTMLDivElement, AlertDialogProps>(
onDismissLabel={onDismissLabel}
onConfirm={onConfirm}
onConfirmLabel={onConfirmLabel}
onConfirmDisabled={onConfirmDisabled}
isConfirmDisabled={isConfirmDisabled || onConfirmDisabled}
/>
</Box>
</ModalDialogOverlay>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export interface AlertDialogFooterProps extends HTMLPasteProps<"div">, Pick<BoxP
onConfirmLabel: string;
onDismiss: () => void;
onDismissLabel: string;
isConfirmDisabled?: boolean;
/** @deprecated This prop has been deprecated in favor of the `isConfirmDisabled` prop. */
onConfirmDisabled?: boolean;
}

Expand All @@ -23,7 +25,8 @@ export const AlertDialogFooter = React.forwardRef<HTMLDivElement, AlertDialogFoo
onConfirmLabel,
onDismiss,
onDismissLabel,
onConfirmDisabled = false,
onConfirmDisabled,
isConfirmDisabled = onConfirmDisabled || false,
...props
},
ref,
Expand All @@ -47,7 +50,7 @@ export const AlertDialogFooter = React.forwardRef<HTMLDivElement, AlertDialogFoo
<Button variant="secondary" onClick={onDismiss}>
{onDismissLabel}
</Button>
<Button variant={primaryVariant} onClick={onConfirm} disabled={destructive && onConfirmDisabled}>
<Button variant={primaryVariant} onClick={onConfirm} disabled={destructive && isConfirmDisabled}>
{onConfirmLabel}
</Button>
</Stack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const DisabledButtonDestructiveAlertDialog = ({ dialogIsOpen = false }):
onDismiss={handleDismiss}
onDismissLabel="Cancel"
destructive
onConfirmDisabled={isDisabled}
isConfirmDisabled={isDisabled}
>
You&apos;re about to delete &ldquo;Toyota TCB Automobile (Gevelsberg)&ldquo; and all data associated with it.
This regulatory bundle will be deleted immediately. You can&apos;t undo this action.
Expand Down
Loading