@elementor/editor-ui 4.0.0-573 → 4.0.0-591
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -5
- package/dist/index.mjs +7 -5
- package/package.json +2 -2
- package/src/components/__tests__/confirmation-dialog.test.tsx +208 -0
- package/src/components/confirmation-dialog.tsx +12 -7
- package/src/components/promotions/promotion-popover.tsx +1 -0
package/dist/index.d.mts
CHANGED
|
@@ -242,14 +242,14 @@ declare const ConfirmationDialog: {
|
|
|
242
242
|
};
|
|
243
243
|
type ConfirmationDialogTitleProps = React$1.PropsWithChildren<{
|
|
244
244
|
icon?: React$1.ElementType;
|
|
245
|
-
iconColor?: 'error' | 'secondary';
|
|
245
|
+
iconColor?: 'error' | 'secondary' | 'primary';
|
|
246
246
|
}>;
|
|
247
247
|
type ConfirmationDialogActionsProps = {
|
|
248
248
|
onClose: () => void;
|
|
249
249
|
onConfirm: () => void;
|
|
250
250
|
cancelLabel?: string;
|
|
251
251
|
confirmLabel?: string;
|
|
252
|
-
color?: 'error' | 'secondary';
|
|
252
|
+
color?: 'error' | 'secondary' | 'primary';
|
|
253
253
|
onSuppressMessage?: () => void;
|
|
254
254
|
suppressLabel?: string;
|
|
255
255
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -242,14 +242,14 @@ declare const ConfirmationDialog: {
|
|
|
242
242
|
};
|
|
243
243
|
type ConfirmationDialogTitleProps = React$1.PropsWithChildren<{
|
|
244
244
|
icon?: React$1.ElementType;
|
|
245
|
-
iconColor?: 'error' | 'secondary';
|
|
245
|
+
iconColor?: 'error' | 'secondary' | 'primary';
|
|
246
246
|
}>;
|
|
247
247
|
type ConfirmationDialogActionsProps = {
|
|
248
248
|
onClose: () => void;
|
|
249
249
|
onConfirm: () => void;
|
|
250
250
|
cancelLabel?: string;
|
|
251
251
|
confirmLabel?: string;
|
|
252
|
-
color?: 'error' | 'secondary';
|
|
252
|
+
color?: 'error' | 'secondary' | 'primary';
|
|
253
253
|
onSuppressMessage?: () => void;
|
|
254
254
|
suppressLabel?: string;
|
|
255
255
|
};
|
package/dist/index.js
CHANGED
|
@@ -653,6 +653,7 @@ function PopoverAlert({ title, content, ctaUrl, ctaText, onClose }) {
|
|
|
653
653
|
color: "promotion",
|
|
654
654
|
icon: /* @__PURE__ */ React15.createElement(import_icons5.CrownFilledIcon, { fontSize: "tiny" }),
|
|
655
655
|
onClose,
|
|
656
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
656
657
|
role: "dialog",
|
|
657
658
|
"aria-label": "promotion-popover-title",
|
|
658
659
|
action: /* @__PURE__ */ React15.createElement(
|
|
@@ -1089,14 +1090,14 @@ var import_icons9 = require("@elementor/icons");
|
|
|
1089
1090
|
var import_ui24 = require("@elementor/ui");
|
|
1090
1091
|
var import_i18n6 = require("@wordpress/i18n");
|
|
1091
1092
|
var TITLE_ID2 = "confirmation-dialog";
|
|
1092
|
-
var ConfirmationDialog = ({ open, onClose, children }) => /* @__PURE__ */ React25.createElement(import_ui24.Dialog, { open, onClose, "aria-labelledby": TITLE_ID2, maxWidth: "
|
|
1093
|
+
var ConfirmationDialog = ({ open, onClose, children }) => /* @__PURE__ */ React25.createElement(import_ui24.Dialog, { open, onClose, "aria-labelledby": TITLE_ID2, maxWidth: "sm" }, children);
|
|
1093
1094
|
var ConfirmationDialogTitle = ({
|
|
1094
1095
|
children,
|
|
1095
1096
|
icon: Icon = import_icons9.AlertOctagonFilledIcon,
|
|
1096
1097
|
iconColor = "error"
|
|
1097
1098
|
}) => /* @__PURE__ */ React25.createElement(import_ui24.DialogTitle, { id: TITLE_ID2, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React25.createElement(Icon, { color: iconColor }), children);
|
|
1098
|
-
var ConfirmationDialogContent = ({ children }) => /* @__PURE__ */ React25.createElement(import_ui24.DialogContent,
|
|
1099
|
-
var ConfirmationDialogContentText = (props) => /* @__PURE__ */ React25.createElement(import_ui24.DialogContentText, { variant: "body2", color: "
|
|
1099
|
+
var ConfirmationDialogContent = ({ children }) => /* @__PURE__ */ React25.createElement(import_ui24.DialogContent, { sx: { mt: 2 } }, children);
|
|
1100
|
+
var ConfirmationDialogContentText = (props) => /* @__PURE__ */ React25.createElement(import_ui24.DialogContentText, { variant: "body2", color: "secondary", ...props });
|
|
1100
1101
|
var ConfirmationDialogActions = ({
|
|
1101
1102
|
onClose,
|
|
1102
1103
|
onConfirm,
|
|
@@ -1121,10 +1122,11 @@ var ConfirmationDialogActions = ({
|
|
|
1121
1122
|
{
|
|
1122
1123
|
checked: dontShowAgain,
|
|
1123
1124
|
onChange: (event) => setDontShowAgain(event.target.checked),
|
|
1124
|
-
size: "
|
|
1125
|
+
size: "medium",
|
|
1126
|
+
color: "secondary"
|
|
1125
1127
|
}
|
|
1126
1128
|
),
|
|
1127
|
-
label: /* @__PURE__ */ React25.createElement(import_ui24.Typography, { variant: "body2" }, suppressLabel)
|
|
1129
|
+
label: /* @__PURE__ */ React25.createElement(import_ui24.Typography, { variant: "body2", color: "text.secondary" }, suppressLabel)
|
|
1128
1130
|
}
|
|
1129
1131
|
), /* @__PURE__ */ React25.createElement("div", null, /* @__PURE__ */ React25.createElement(import_ui24.Button, { color: "secondary", onClick: onClose }, cancelLabel ?? (0, import_i18n6.__)("Not now", "elementor")), /* @__PURE__ */ React25.createElement(import_ui24.Button, { autoFocus: true, variant: "contained", color, onClick: handleConfirm, sx: { ml: 1 } }, confirmLabel ?? (0, import_i18n6.__)("Delete", "elementor"))));
|
|
1130
1132
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -615,6 +615,7 @@ function PopoverAlert({ title, content, ctaUrl, ctaText, onClose }) {
|
|
|
615
615
|
color: "promotion",
|
|
616
616
|
icon: /* @__PURE__ */ React15.createElement(CrownFilledIcon2, { fontSize: "tiny" }),
|
|
617
617
|
onClose,
|
|
618
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
618
619
|
role: "dialog",
|
|
619
620
|
"aria-label": "promotion-popover-title",
|
|
620
621
|
action: /* @__PURE__ */ React15.createElement(
|
|
@@ -1070,14 +1071,14 @@ import {
|
|
|
1070
1071
|
} from "@elementor/ui";
|
|
1071
1072
|
import { __ as __6 } from "@wordpress/i18n";
|
|
1072
1073
|
var TITLE_ID2 = "confirmation-dialog";
|
|
1073
|
-
var ConfirmationDialog = ({ open, onClose, children }) => /* @__PURE__ */ React25.createElement(Dialog4, { open, onClose, "aria-labelledby": TITLE_ID2, maxWidth: "
|
|
1074
|
+
var ConfirmationDialog = ({ open, onClose, children }) => /* @__PURE__ */ React25.createElement(Dialog4, { open, onClose, "aria-labelledby": TITLE_ID2, maxWidth: "sm" }, children);
|
|
1074
1075
|
var ConfirmationDialogTitle = ({
|
|
1075
1076
|
children,
|
|
1076
1077
|
icon: Icon = AlertOctagonFilledIcon,
|
|
1077
1078
|
iconColor = "error"
|
|
1078
1079
|
}) => /* @__PURE__ */ React25.createElement(DialogTitle3, { id: TITLE_ID2, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React25.createElement(Icon, { color: iconColor }), children);
|
|
1079
|
-
var ConfirmationDialogContent = ({ children }) => /* @__PURE__ */ React25.createElement(DialogContent2,
|
|
1080
|
-
var ConfirmationDialogContentText = (props) => /* @__PURE__ */ React25.createElement(DialogContentText2, { variant: "body2", color: "
|
|
1080
|
+
var ConfirmationDialogContent = ({ children }) => /* @__PURE__ */ React25.createElement(DialogContent2, { sx: { mt: 2 } }, children);
|
|
1081
|
+
var ConfirmationDialogContentText = (props) => /* @__PURE__ */ React25.createElement(DialogContentText2, { variant: "body2", color: "secondary", ...props });
|
|
1081
1082
|
var ConfirmationDialogActions = ({
|
|
1082
1083
|
onClose,
|
|
1083
1084
|
onConfirm,
|
|
@@ -1102,10 +1103,11 @@ var ConfirmationDialogActions = ({
|
|
|
1102
1103
|
{
|
|
1103
1104
|
checked: dontShowAgain,
|
|
1104
1105
|
onChange: (event) => setDontShowAgain(event.target.checked),
|
|
1105
|
-
size: "
|
|
1106
|
+
size: "medium",
|
|
1107
|
+
color: "secondary"
|
|
1106
1108
|
}
|
|
1107
1109
|
),
|
|
1108
|
-
label: /* @__PURE__ */ React25.createElement(Typography6, { variant: "body2" }, suppressLabel)
|
|
1110
|
+
label: /* @__PURE__ */ React25.createElement(Typography6, { variant: "body2", color: "text.secondary" }, suppressLabel)
|
|
1109
1111
|
}
|
|
1110
1112
|
), /* @__PURE__ */ React25.createElement("div", null, /* @__PURE__ */ React25.createElement(Button7, { color: "secondary", onClick: onClose }, cancelLabel ?? __6("Not now", "elementor")), /* @__PURE__ */ React25.createElement(Button7, { autoFocus: true, variant: "contained", color, onClick: handleConfirm, sx: { ml: 1 } }, confirmLabel ?? __6("Delete", "elementor"))));
|
|
1111
1113
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-ui",
|
|
3
3
|
"description": "Elementor Editor UI",
|
|
4
|
-
"version": "4.0.0-
|
|
4
|
+
"version": "4.0.0-591",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"react-dom": "^18.3.1"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@elementor/editor-v1-adapters": "4.0.0-
|
|
40
|
+
"@elementor/editor-v1-adapters": "4.0.0-591",
|
|
41
41
|
"@elementor/icons": "^1.63.0",
|
|
42
42
|
"@elementor/ui": "1.36.17",
|
|
43
43
|
"@tanstack/react-virtual": "^3.13.3",
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
3
|
+
|
|
4
|
+
import { ConfirmationDialog } from '../confirmation-dialog';
|
|
5
|
+
|
|
6
|
+
describe( 'ConfirmationDialog', () => {
|
|
7
|
+
const mockOnClose = jest.fn();
|
|
8
|
+
const mockOnConfirm = jest.fn();
|
|
9
|
+
const mockOnSuppressMessage = jest.fn();
|
|
10
|
+
|
|
11
|
+
beforeEach( () => {
|
|
12
|
+
jest.clearAllMocks();
|
|
13
|
+
} );
|
|
14
|
+
|
|
15
|
+
it( 'should render with title, content, and actions', () => {
|
|
16
|
+
// Act
|
|
17
|
+
render(
|
|
18
|
+
<ConfirmationDialog open={ true } onClose={ mockOnClose }>
|
|
19
|
+
<ConfirmationDialog.Title>Delete Item</ConfirmationDialog.Title>
|
|
20
|
+
<ConfirmationDialog.Content>
|
|
21
|
+
<ConfirmationDialog.ContentText>
|
|
22
|
+
Are you sure you want to delete this item?
|
|
23
|
+
</ConfirmationDialog.ContentText>
|
|
24
|
+
</ConfirmationDialog.Content>
|
|
25
|
+
<ConfirmationDialog.Actions
|
|
26
|
+
onClose={ mockOnClose }
|
|
27
|
+
onConfirm={ mockOnConfirm }
|
|
28
|
+
cancelLabel="Cancel"
|
|
29
|
+
confirmLabel="Delete"
|
|
30
|
+
/>
|
|
31
|
+
</ConfirmationDialog>
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
// Assert
|
|
35
|
+
expect( screen.getByText( 'Delete Item' ) ).toBeInTheDocument();
|
|
36
|
+
expect( screen.getByText( 'Are you sure you want to delete this item?' ) ).toBeInTheDocument();
|
|
37
|
+
expect( screen.getByRole( 'button', { name: 'Cancel' } ) ).toBeInTheDocument();
|
|
38
|
+
expect( screen.getByRole( 'button', { name: 'Delete' } ) ).toBeInTheDocument();
|
|
39
|
+
} );
|
|
40
|
+
|
|
41
|
+
it( 'should call onClose when cancel button is clicked', () => {
|
|
42
|
+
// Arrange
|
|
43
|
+
render(
|
|
44
|
+
<ConfirmationDialog open={ true } onClose={ mockOnClose }>
|
|
45
|
+
<ConfirmationDialog.Title>Confirm Action</ConfirmationDialog.Title>
|
|
46
|
+
<ConfirmationDialog.Content>
|
|
47
|
+
<ConfirmationDialog.ContentText>Are you sure?</ConfirmationDialog.ContentText>
|
|
48
|
+
</ConfirmationDialog.Content>
|
|
49
|
+
<ConfirmationDialog.Actions onClose={ mockOnClose } onConfirm={ mockOnConfirm } />
|
|
50
|
+
</ConfirmationDialog>
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
// Act
|
|
54
|
+
fireEvent.click( screen.getByRole( 'button', { name: 'Not now' } ) );
|
|
55
|
+
|
|
56
|
+
// Assert
|
|
57
|
+
expect( mockOnClose ).toHaveBeenCalledTimes( 1 );
|
|
58
|
+
expect( mockOnConfirm ).not.toHaveBeenCalled();
|
|
59
|
+
} );
|
|
60
|
+
|
|
61
|
+
it( 'should call onConfirm when confirm button is clicked', () => {
|
|
62
|
+
// Arrange
|
|
63
|
+
render(
|
|
64
|
+
<ConfirmationDialog open={ true } onClose={ mockOnClose }>
|
|
65
|
+
<ConfirmationDialog.Title>Confirm Action</ConfirmationDialog.Title>
|
|
66
|
+
<ConfirmationDialog.Content>
|
|
67
|
+
<ConfirmationDialog.ContentText>Are you sure?</ConfirmationDialog.ContentText>
|
|
68
|
+
</ConfirmationDialog.Content>
|
|
69
|
+
<ConfirmationDialog.Actions onClose={ mockOnClose } onConfirm={ mockOnConfirm } />
|
|
70
|
+
</ConfirmationDialog>
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
// Act
|
|
74
|
+
fireEvent.click( screen.getByRole( 'button', { name: 'Delete' } ) );
|
|
75
|
+
|
|
76
|
+
// Assert
|
|
77
|
+
expect( mockOnConfirm ).toHaveBeenCalledTimes( 1 );
|
|
78
|
+
} );
|
|
79
|
+
|
|
80
|
+
it( 'should render with custom icon and icon color', () => {
|
|
81
|
+
// Arrange
|
|
82
|
+
const CustomIcon = () => <span>Custom Icon</span>;
|
|
83
|
+
|
|
84
|
+
// Act
|
|
85
|
+
render(
|
|
86
|
+
<ConfirmationDialog open={ true } onClose={ mockOnClose }>
|
|
87
|
+
<ConfirmationDialog.Title icon={ CustomIcon } iconColor="primary">
|
|
88
|
+
Custom Title
|
|
89
|
+
</ConfirmationDialog.Title>
|
|
90
|
+
<ConfirmationDialog.Content>
|
|
91
|
+
<ConfirmationDialog.ContentText>Content</ConfirmationDialog.ContentText>
|
|
92
|
+
</ConfirmationDialog.Content>
|
|
93
|
+
<ConfirmationDialog.Actions onClose={ mockOnClose } onConfirm={ mockOnConfirm } />
|
|
94
|
+
</ConfirmationDialog>
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
// Assert
|
|
98
|
+
expect( screen.getByText( 'Custom Icon' ) ).toBeInTheDocument();
|
|
99
|
+
expect( screen.getByText( 'Custom Title' ) ).toBeInTheDocument();
|
|
100
|
+
} );
|
|
101
|
+
|
|
102
|
+
it( 'should render "Don\'t show again" checkbox when onSuppressMessage is provided', () => {
|
|
103
|
+
// Act
|
|
104
|
+
render(
|
|
105
|
+
<ConfirmationDialog open={ true } onClose={ mockOnClose }>
|
|
106
|
+
<ConfirmationDialog.Title>Confirm Action</ConfirmationDialog.Title>
|
|
107
|
+
<ConfirmationDialog.Content>
|
|
108
|
+
<ConfirmationDialog.ContentText>Are you sure?</ConfirmationDialog.ContentText>
|
|
109
|
+
</ConfirmationDialog.Content>
|
|
110
|
+
<ConfirmationDialog.Actions
|
|
111
|
+
onClose={ mockOnClose }
|
|
112
|
+
onConfirm={ mockOnConfirm }
|
|
113
|
+
onSuppressMessage={ mockOnSuppressMessage }
|
|
114
|
+
/>
|
|
115
|
+
</ConfirmationDialog>
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
// Assert
|
|
119
|
+
expect( screen.getByText( "Don't show this again" ) ).toBeInTheDocument();
|
|
120
|
+
expect( screen.getByRole( 'checkbox' ) ).toBeInTheDocument();
|
|
121
|
+
} );
|
|
122
|
+
|
|
123
|
+
it( 'should call onSuppressMessage when checkbox is checked and confirm is clicked', () => {
|
|
124
|
+
// Arrange
|
|
125
|
+
render(
|
|
126
|
+
<ConfirmationDialog open={ true } onClose={ mockOnClose }>
|
|
127
|
+
<ConfirmationDialog.Title>Confirm Action</ConfirmationDialog.Title>
|
|
128
|
+
<ConfirmationDialog.Content>
|
|
129
|
+
<ConfirmationDialog.ContentText>Are you sure?</ConfirmationDialog.ContentText>
|
|
130
|
+
</ConfirmationDialog.Content>
|
|
131
|
+
<ConfirmationDialog.Actions
|
|
132
|
+
onClose={ mockOnClose }
|
|
133
|
+
onConfirm={ mockOnConfirm }
|
|
134
|
+
onSuppressMessage={ mockOnSuppressMessage }
|
|
135
|
+
/>
|
|
136
|
+
</ConfirmationDialog>
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
// Act
|
|
140
|
+
const checkbox = screen.getByRole( 'checkbox' );
|
|
141
|
+
fireEvent.click( checkbox );
|
|
142
|
+
fireEvent.click( screen.getByRole( 'button', { name: 'Delete' } ) );
|
|
143
|
+
|
|
144
|
+
// Assert
|
|
145
|
+
expect( mockOnSuppressMessage ).toHaveBeenCalledTimes( 1 );
|
|
146
|
+
expect( mockOnConfirm ).toHaveBeenCalledTimes( 1 );
|
|
147
|
+
} );
|
|
148
|
+
|
|
149
|
+
it( 'should render with custom button labels', () => {
|
|
150
|
+
// Act
|
|
151
|
+
render(
|
|
152
|
+
<ConfirmationDialog open={ true } onClose={ mockOnClose }>
|
|
153
|
+
<ConfirmationDialog.Title>Custom Labels</ConfirmationDialog.Title>
|
|
154
|
+
<ConfirmationDialog.Content>
|
|
155
|
+
<ConfirmationDialog.ContentText>Content</ConfirmationDialog.ContentText>
|
|
156
|
+
</ConfirmationDialog.Content>
|
|
157
|
+
<ConfirmationDialog.Actions
|
|
158
|
+
onClose={ mockOnClose }
|
|
159
|
+
onConfirm={ mockOnConfirm }
|
|
160
|
+
cancelLabel="No thanks"
|
|
161
|
+
confirmLabel="Yes, proceed"
|
|
162
|
+
/>
|
|
163
|
+
</ConfirmationDialog>
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
// Assert
|
|
167
|
+
expect( screen.getByRole( 'button', { name: 'No thanks' } ) ).toBeInTheDocument();
|
|
168
|
+
expect( screen.getByRole( 'button', { name: 'Yes, proceed' } ) ).toBeInTheDocument();
|
|
169
|
+
} );
|
|
170
|
+
|
|
171
|
+
it( 'should render with custom suppress label', () => {
|
|
172
|
+
// Act
|
|
173
|
+
render(
|
|
174
|
+
<ConfirmationDialog open={ true } onClose={ mockOnClose }>
|
|
175
|
+
<ConfirmationDialog.Title>Confirm Action</ConfirmationDialog.Title>
|
|
176
|
+
<ConfirmationDialog.Content>
|
|
177
|
+
<ConfirmationDialog.ContentText>Are you sure?</ConfirmationDialog.ContentText>
|
|
178
|
+
</ConfirmationDialog.Content>
|
|
179
|
+
<ConfirmationDialog.Actions
|
|
180
|
+
onClose={ mockOnClose }
|
|
181
|
+
onConfirm={ mockOnConfirm }
|
|
182
|
+
onSuppressMessage={ mockOnSuppressMessage }
|
|
183
|
+
suppressLabel="Don't ask me again"
|
|
184
|
+
/>
|
|
185
|
+
</ConfirmationDialog>
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
// Assert
|
|
189
|
+
expect( screen.getByText( "Don't ask me again" ) ).toBeInTheDocument();
|
|
190
|
+
} );
|
|
191
|
+
|
|
192
|
+
it( 'should not render when open is false', () => {
|
|
193
|
+
// Act
|
|
194
|
+
render(
|
|
195
|
+
<ConfirmationDialog open={ false } onClose={ mockOnClose }>
|
|
196
|
+
<ConfirmationDialog.Title>Should Not Render</ConfirmationDialog.Title>
|
|
197
|
+
<ConfirmationDialog.Content>
|
|
198
|
+
<ConfirmationDialog.ContentText>Hidden Content</ConfirmationDialog.ContentText>
|
|
199
|
+
</ConfirmationDialog.Content>
|
|
200
|
+
<ConfirmationDialog.Actions onClose={ mockOnClose } onConfirm={ mockOnConfirm } />
|
|
201
|
+
</ConfirmationDialog>
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
// Assert
|
|
205
|
+
expect( screen.queryByText( 'Should Not Render' ) ).not.toBeInTheDocument();
|
|
206
|
+
expect( screen.queryByRole( 'dialog' ) ).not.toBeInTheDocument();
|
|
207
|
+
} );
|
|
208
|
+
} );
|
|
@@ -21,14 +21,14 @@ const TITLE_ID = 'confirmation-dialog';
|
|
|
21
21
|
type ConfirmationDialogProps = Pick< DialogProps, 'open' | 'onClose' | 'children' >;
|
|
22
22
|
|
|
23
23
|
export const ConfirmationDialog = ( { open, onClose, children }: ConfirmationDialogProps ) => (
|
|
24
|
-
<Dialog open={ open } onClose={ onClose } aria-labelledby={ TITLE_ID } maxWidth="
|
|
24
|
+
<Dialog open={ open } onClose={ onClose } aria-labelledby={ TITLE_ID } maxWidth="sm">
|
|
25
25
|
{ children }
|
|
26
26
|
</Dialog>
|
|
27
27
|
);
|
|
28
28
|
|
|
29
29
|
type ConfirmationDialogTitleProps = React.PropsWithChildren< {
|
|
30
30
|
icon?: React.ElementType;
|
|
31
|
-
iconColor?: 'error' | 'secondary';
|
|
31
|
+
iconColor?: 'error' | 'secondary' | 'primary';
|
|
32
32
|
} >;
|
|
33
33
|
|
|
34
34
|
const ConfirmationDialogTitle = ( {
|
|
@@ -43,11 +43,11 @@ const ConfirmationDialogTitle = ( {
|
|
|
43
43
|
);
|
|
44
44
|
|
|
45
45
|
const ConfirmationDialogContent = ( { children }: React.PropsWithChildren ) => (
|
|
46
|
-
<DialogContent>{ children }</DialogContent>
|
|
46
|
+
<DialogContent sx={ { mt: 2 } }>{ children }</DialogContent>
|
|
47
47
|
);
|
|
48
48
|
|
|
49
49
|
const ConfirmationDialogContentText = ( props: DialogContentTextProps ) => (
|
|
50
|
-
<DialogContentText variant="body2" color="
|
|
50
|
+
<DialogContentText variant="body2" color="secondary" { ...props } />
|
|
51
51
|
);
|
|
52
52
|
|
|
53
53
|
type ConfirmationDialogActionsProps = {
|
|
@@ -55,7 +55,7 @@ type ConfirmationDialogActionsProps = {
|
|
|
55
55
|
onConfirm: () => void;
|
|
56
56
|
cancelLabel?: string;
|
|
57
57
|
confirmLabel?: string;
|
|
58
|
-
color?: 'error' | 'secondary';
|
|
58
|
+
color?: 'error' | 'secondary' | 'primary';
|
|
59
59
|
onSuppressMessage?: () => void;
|
|
60
60
|
suppressLabel?: string;
|
|
61
61
|
};
|
|
@@ -88,10 +88,15 @@ const ConfirmationDialogActions = ( {
|
|
|
88
88
|
onChange={ ( event: React.ChangeEvent< HTMLInputElement > ) =>
|
|
89
89
|
setDontShowAgain( event.target.checked )
|
|
90
90
|
}
|
|
91
|
-
size="
|
|
91
|
+
size="medium"
|
|
92
|
+
color="secondary"
|
|
92
93
|
/>
|
|
93
94
|
}
|
|
94
|
-
label={
|
|
95
|
+
label={
|
|
96
|
+
<Typography variant="body2" color="text.secondary">
|
|
97
|
+
{ suppressLabel }
|
|
98
|
+
</Typography>
|
|
99
|
+
}
|
|
95
100
|
/>
|
|
96
101
|
) }
|
|
97
102
|
<div>
|
|
@@ -79,6 +79,7 @@ function PopoverAlert( { title, content, ctaUrl, ctaText, onClose }: PromotionPo
|
|
|
79
79
|
color="promotion"
|
|
80
80
|
icon={ <CrownFilledIcon fontSize="tiny" /> }
|
|
81
81
|
onClose={ onClose }
|
|
82
|
+
onMouseDown={ ( e: MouseEvent ) => e.stopPropagation() }
|
|
82
83
|
role="dialog"
|
|
83
84
|
aria-label="promotion-popover-title"
|
|
84
85
|
action={
|