Skip to content

Commit

Permalink
Merge branch 'master' into issue/244-EnableTypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
hvilander committed Mar 29, 2022
2 parents 8d4dd75 + 607dd62 commit cf52069
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 9 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
### [7.4.1](https://github.com/SelectQuoteLabs/SQForm/compare/v7.4.0...v7.4.1) (2022-03-29)


### Bug Fixes

* 🐛 Removing depricated MUI Dialog prop disable Bg click ([b7cbd16](https://github.com/SelectQuoteLabs/SQForm/commit/b7cbd16b469b723ff6fc6bdd4947ccca05c370b1)), closes [#646](https://github.com/SelectQuoteLabs/SQForm/issues/646)

## [7.4.0](https://github.com/SelectQuoteLabs/SQForm/compare/v7.3.0...v7.4.0) (2022-02-28)


Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@selectquotelabs/sqform",
"version": "7.4.0",
"version": "7.4.1",
"description": "SQ Form",
"main": "dist/bundle.cjs.js",
"types": "dist/index.d.ts",
Expand Down
21 changes: 15 additions & 6 deletions src/components/SQFormDialog/SQFormDialogInner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,12 @@ function SQFormDialogInner({

const handleCancel = (
event: Record<string, unknown>,
reason: 'backdropClick' | 'escapeKeyDown'
reason: 'backdropClick' | 'escapeKeyDown' | 'cancelClick'
) => {
if (disableBackdropClick && reason === 'backdropClick') {
return;
}

if (!isDirty) {
onClose && onClose(event, reason);
} else {
Expand All @@ -158,13 +162,15 @@ function SQFormDialogInner({
return (
<Grid
container={true}
justify={showSecondaryButton ? 'space-between' : 'flex-end'}
justifyContent={showSecondaryButton ? 'space-between' : 'flex-end'}
>
{showSecondaryButton && (
<Grid item={true}>
<RoundedButton
title={cancelButtonText}
onClick={handleCancel}
onClick={(event: Record<string, unknown>) =>
handleCancel(event, 'cancelClick')
}
color="secondary"
variant="outlined"
>
Expand Down Expand Up @@ -201,11 +207,12 @@ function SQFormDialogInner({
return (
<>
<Dialog
disableBackdropClick={disableBackdropClick}
maxWidth={maxWidth}
open={isOpen}
TransitionComponent={Transition}
onClose={showSecondaryButton ? handleCancel : undefined}
onClose={
showSecondaryButton || disableBackdropClick ? handleCancel : undefined
}
>
<Form>
<DialogTitle disableTypography={true} classes={titleClasses}>
Expand All @@ -230,7 +237,9 @@ function SQFormDialogInner({
: showSecondaryButton && (
<RoundedButton
title={cancelButtonText}
onClick={handleCancel}
onClick={(event: Record<string, unknown>) =>
handleCancel(event, 'cancelClick')
}
color="secondary"
variant="outlined"
>
Expand Down
13 changes: 12 additions & 1 deletion src/components/SQFormDialogStepper/SQFormDialogStepper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,17 @@ export function SQFormDialogStepper<Values extends FormikValues>({
);
}

const handleClose = (
event, // Record<string, unknown>,
reason // 'backdropClick' | 'escapeKeyDown' | 'cancelClick'
) => {
if (disableBackdropClick && reason === 'backDropClick') {
return;
}

onClose(event, reason);
};

return (
<Formik
{...props}
Expand All @@ -242,7 +253,7 @@ export function SQFormDialogStepper<Values extends FormikValues>({
disableBackdropClick={disableBackdropClick}
maxWidth={maxWidth}
open={isOpen}
onClose={onClose}
onClose={handleClose}
fullWidth={fullWidth}
{...dialogProps}
>
Expand Down

0 comments on commit cf52069

Please sign in to comment.