@madie/madie-design-system 1.2.62 → 2.0.1
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/.babelrc +14 -2
- package/.eslintrc.js +1 -1
- package/.storybook/.babelrc +2 -1
- package/.storybook/main.js +3 -11
- package/.storybook/preview.js +1 -1
- package/components/Accordion/index.jsx +32 -36
- package/components/AutoComplete/AutoComplete.jsx +2 -17
- package/components/Button/Button.stories.js +0 -7
- package/components/Button/index.js +34 -44
- package/components/DateField/DateField.jsx +2 -15
- package/components/DateField/DateField.stories.jsx +23 -10
- package/components/DateTimeField/DateTimeField.jsx +7 -11
- package/components/DateTimeField/DateTimeField.stories.jsx +29 -19
- package/components/InputLabel/index.jsx +1 -6
- package/components/Instant/Instant.stories.js +14 -6
- package/components/Instant/index.jsx +0 -16
- package/components/Link/index.js +14 -33
- package/components/MadieAlert/MadieAlert.stories.js +35 -29
- package/components/MadieAlert/index.jsx +5 -44
- package/components/MadieConfirmDialog/MadieConfirmDialog.stories.js +17 -32
- package/components/MadieConfirmDialog/index.jsx +0 -8
- package/components/MadieDeleteDialog/MadieDeleteDialog.stories.js +9 -24
- package/components/MadieDeleteDialog/index.jsx +0 -7
- package/components/MadieDialog/MadieDialog.stories.js +45 -121
- package/components/MadieDialog/index.jsx +4 -23
- package/components/MadieDiscardDialog/MadieDiscardDialog.stories.js +5 -12
- package/components/MadieDiscardDialog/index.jsx +0 -7
- package/components/MadieSpinner/MadieSpinner.stories.js +1 -9
- package/components/MadieSpinner/index.jsx +0 -5
- package/components/MadieTooltip/MadieTooltip.stories.js +7 -2
- package/components/MadieTooltip/index.jsx +0 -6
- package/components/MadieTooltipIcon/index.jsx +0 -5
- package/components/Modal/Modal.jsx +31 -43
- package/components/Modal/Modal.stories.js +18 -89
- package/components/Modal/index.jsx +6 -8
- package/components/NumberInput/NumberInput.stories.js +50 -67
- package/components/NumberInput/index.jsx +0 -13
- package/components/Pagination/index.jsx +0 -17
- package/components/Popover/Popover.stories.js +6 -14
- package/components/Popover/index.js +0 -23
- package/components/RadioButton/RadioButton.jsx +5 -15
- package/components/RadioButton/RadioButton.stories.jsx +6 -2
- package/components/ReadOnlyTextField/ReadOnlyTextField.stories.js +3 -8
- package/components/ReadOnlyTextField/index.jsx +1 -9
- package/components/RichTextEditor/RichTextEditor.stories.js +10 -8
- package/components/RichTextEditor/index.jsx +14 -30
- package/components/SanitizedContent/index.jsx +0 -8
- package/components/Search/Search.stories.js +2 -4
- package/components/Search/index.js +26 -40
- package/components/Select/Select.stories.js +59 -164
- package/components/Select/index.jsx +2 -17
- package/components/Tabs/Tab.js +29 -25
- package/components/Tabs/TabPanel.js +15 -19
- package/components/Tabs/Tabs.stories.js +43 -211
- package/components/Tabs/index.js +10 -28
- package/components/TextArea/TextArea.stories.js +87 -113
- package/components/TextArea/index.jsx +2 -14
- package/components/TextField/TextField.stories.js +100 -129
- package/components/TextField/index.jsx +2 -17
- package/components/TimeField/TimeField.jsx +0 -10
- package/components/TimeField/TimeField.stories.js +18 -8
- package/components/Toast/Toast.stories.js +42 -102
- package/components/Toast/index.jsx +0 -14
- package/components/TruncateText/TruncateText.stories.js +22 -17
- package/components/TruncateText/index.js +0 -8
- package/components/hooks/useGetConfig.js +2 -2
- package/components/{index.js → index.mjs} +37 -57
- package/dist/index.js +3 -1
- package/dist/index.js.LICENSE.txt +16 -0
- package/dist/index.js.map +1 -0
- package/dist/react/index.html +1 -1
- package/dist/react/index.mjs +103 -0
- package/dist/react/{index.js.LICENSE.txt → index.mjs.LICENSE.txt} +3 -52
- package/dist/react/index.mjs.map +1 -0
- package/dist/react/package.json +1 -0
- package/eslint.config.cjs +59 -0
- package/index.js +7 -9
- package/jest.config.mjs +10 -0
- package/lib/Chevron.jsx +2 -10
- package/package.json +57 -82
- package/styles/_main.scss +4 -3
- package/test/components/Accordion.test.js +1 -1
- package/test/components/AutoComplete.test.js +11 -6
- package/test/components/Button.test.js +13 -19
- package/test/components/DateField.test.js +25 -29
- package/test/components/DateTimeField.test.js +21 -25
- package/test/components/Instant.test.js +1 -1
- package/test/components/MadieAlert.test.js +22 -22
- package/test/components/MadieConfirmDialog.test.js +42 -64
- package/test/components/MadieDeleteDialog.test.js +51 -69
- package/test/components/MadieDialog.test.js +13 -13
- package/test/components/MadieDiscardDialog.test.js +28 -45
- package/test/components/MadieSpinner.test.js +12 -17
- package/test/components/Modal.test.js +115 -0
- package/test/components/Pagination.test.js +2 -2
- package/test/components/RadioButton.test.js +7 -7
- package/test/components/ReadOnlyTextField.test.js +4 -2
- package/test/components/RichTextEditor.test.js +90 -6
- package/test/components/Search.test.js +75 -0
- package/test/components/Select.test.js +97 -107
- package/test/components/Tabs.test.js +22 -24
- package/test/components/TextArea.test.js +78 -92
- package/test/components/TextField.test.js +128 -147
- package/test/components/Toast.test.js +67 -78
- package/test/components/TruncateText.test.js +75 -0
- package/test/components/index.test.js +23 -0
- package/webpack.config.mjs +79 -0
- package/webpack.config.react.mjs +72 -0
- package/.eslintignore +0 -5
- package/components/Alert/Alert.stories.js +0 -70
- package/components/Alert/index.js +0 -55
- package/components/Breadcrumb/Breadcrumb.md +0 -28
- package/components/Breadcrumb/Breadcrumb.stories.js +0 -76
- package/components/Breadcrumb/index.js +0 -92
- package/components/CalloutBox/CalloutBox.stories.js +0 -94
- package/components/CalloutBox/index.js +0 -109
- package/components/Card/Card.stories.js +0 -163
- package/components/Card/index.js +0 -144
- package/components/Dropdown/Dropdown.stories.js +0 -94
- package/components/Dropdown/index.js +0 -85
- package/components/Error/Collapsible.jsx +0 -93
- package/components/Error/ErrorUI.jsx +0 -31
- package/components/Error/error.js +0 -26
- package/components/FlashNotification/FlashNotificationUI.jsx +0 -91
- package/components/FlashNotification/index.js +0 -30
- package/components/Footer/Footer.stories.js +0 -20
- package/components/Footer/FooterUI.jsx +0 -137
- package/components/Footer/LegacyFooterUI.jsx +0 -204
- package/components/Footer/SocialLinks.jsx +0 -63
- package/components/Footer/Subscribe.jsx +0 -34
- package/components/Footer/footer.js +0 -30
- package/components/Infotip/Infotip.jsx +0 -75
- package/components/Infotip/Infotip.stories.js +0 -52
- package/components/Infotip/InfotipIcon.jsx +0 -41
- package/components/Infotip/index.js +0 -3
- package/components/Link/Link.stories.js +0 -82
- package/components/NotificationBanner/NotificationBanner.stories.js +0 -23
- package/components/NotificationBanner/index.js +0 -279
- package/components/Spinner/index.js +0 -9
- package/components/TextInput/TextInput.stories.js +0 -118
- package/components/TextInput/index.js +0 -137
- package/components/Tooltip/Tooltip.jsx +0 -88
- package/components/Tooltip/Tooltip.stories.js +0 -80
- package/components/Tooltip/index.js +0 -3
- package/components/Tooltip/position.js +0 -76
- package/components/UnwrappedSpinner/index.js +0 -8
- package/dist/browser.js +0 -1
- package/dist/react/index.js +0 -185
- package/dist/react/index.js.map +0 -1
- package/jest.config.js +0 -17
- package/test/components/ErrorUI.test.js +0 -32
- package/test/components/FooterUI.test.js +0 -122
- package/test/components/Infotip.test.js +0 -76
- package/test/components/Tooltip.test.js +0 -147
- package/webpack.config.js +0 -124
- package/webpack.config.react.js +0 -104
package/components/Link/index.js
CHANGED
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
|
|
4
3
|
const VARIANTS = ["white", "gray"];
|
|
5
4
|
|
|
6
5
|
const DSLink = ({
|
|
7
|
-
className,
|
|
8
|
-
href,
|
|
9
|
-
download,
|
|
10
|
-
ariaLabel,
|
|
11
|
-
onClick,
|
|
12
|
-
children,
|
|
13
|
-
variant,
|
|
6
|
+
className = "",
|
|
7
|
+
href = "",
|
|
8
|
+
download = false,
|
|
9
|
+
ariaLabel = null,
|
|
10
|
+
onClick = () => null,
|
|
11
|
+
children = null,
|
|
12
|
+
variant = null,
|
|
14
13
|
...rest
|
|
15
14
|
}) => {
|
|
16
15
|
let linkClass = "qpp-c-link";
|
|
16
|
+
|
|
17
17
|
if (VARIANTS.includes(variant)) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
linkClass +=
|
|
19
|
+
variant === "gray"
|
|
20
|
+
? " qpp-u-color--gray-60"
|
|
21
|
+
: ` qpp-u-color--${variant}`;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
if (className) {
|
|
24
|
-
linkClass
|
|
25
|
+
linkClass += ` ${className}`;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
return (
|
|
28
29
|
<a
|
|
29
30
|
aria-label={ariaLabel}
|
|
30
|
-
className={linkClass
|
|
31
|
+
className={linkClass}
|
|
31
32
|
href={href}
|
|
32
33
|
download={download}
|
|
33
34
|
onClick={onClick}
|
|
@@ -38,24 +39,4 @@ const DSLink = ({
|
|
|
38
39
|
);
|
|
39
40
|
};
|
|
40
41
|
|
|
41
|
-
DSLink.propTypes = {
|
|
42
|
-
children: PropTypes.node,
|
|
43
|
-
className: PropTypes.string,
|
|
44
|
-
href: PropTypes.string,
|
|
45
|
-
ariaLabel: PropTypes.string,
|
|
46
|
-
onClick: PropTypes.func,
|
|
47
|
-
download: PropTypes.bool,
|
|
48
|
-
variant: PropTypes.oneOf(VARIANTS),
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
DSLink.defaultProps = {
|
|
52
|
-
children: null,
|
|
53
|
-
className: "",
|
|
54
|
-
href: "",
|
|
55
|
-
ariaLabel: null,
|
|
56
|
-
onClick: () => null,
|
|
57
|
-
download: false,
|
|
58
|
-
variant: null,
|
|
59
|
-
};
|
|
60
|
-
|
|
61
42
|
export default DSLink;
|
|
@@ -1,34 +1,42 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import MadieAlert from "./index";
|
|
3
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
3
|
|
|
5
4
|
export default {
|
|
6
5
|
title: "Madie Alert",
|
|
7
6
|
component: MadieAlert,
|
|
8
7
|
decorators: [
|
|
9
|
-
|
|
10
|
-
(storyFn) => (
|
|
8
|
+
(Story) => (
|
|
11
9
|
<div style={{ padding: "120px", backgroundColor: "gray" }}>
|
|
12
|
-
|
|
10
|
+
<Story />
|
|
13
11
|
</div>
|
|
14
12
|
),
|
|
15
13
|
],
|
|
14
|
+
argTypes: {
|
|
15
|
+
type: {
|
|
16
|
+
control: { type: "select" },
|
|
17
|
+
options: ["info", "warning", "error", "success"],
|
|
18
|
+
},
|
|
19
|
+
content: { control: "text" },
|
|
20
|
+
active: { control: "boolean" },
|
|
21
|
+
},
|
|
16
22
|
};
|
|
17
23
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
const Template = (args) => <MadieAlert {...args} />;
|
|
25
|
+
|
|
26
|
+
export const MadieAlertWarning = Template.bind({});
|
|
27
|
+
MadieAlertWarning.args = {
|
|
28
|
+
type: "warning",
|
|
29
|
+
content:
|
|
30
|
+
"Your measure needs a CMS ID, you must first create and import your measure from MAT.",
|
|
31
|
+
};
|
|
24
32
|
MadieAlertWarning.storyName = "MadieAlertWarning";
|
|
25
33
|
|
|
26
|
-
export const MadieAlertInfo = ()
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
export const MadieAlertInfo = Template.bind({});
|
|
35
|
+
MadieAlertInfo.args = {
|
|
36
|
+
type: "info",
|
|
37
|
+
content:
|
|
38
|
+
"Your measure needs a CMS ID, you must first create and import your measure from MAT.",
|
|
39
|
+
};
|
|
32
40
|
MadieAlertInfo.storyName = "MadieAlertInfo";
|
|
33
41
|
|
|
34
42
|
export const MadieAlertInfoList = () => (
|
|
@@ -62,19 +70,17 @@ export const MadieAlertWithTitle = () => (
|
|
|
62
70
|
);
|
|
63
71
|
MadieAlertWithTitle.storyName = "withTitle";
|
|
64
72
|
|
|
65
|
-
export const MadieAlertError = ()
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
);
|
|
73
|
+
export const MadieAlertError = Template.bind({});
|
|
74
|
+
MadieAlertError.args = {
|
|
75
|
+
type: "error",
|
|
76
|
+
content: "Please complete the CQL Editor process before continuing.",
|
|
77
|
+
active: false,
|
|
78
|
+
};
|
|
72
79
|
MadieAlertError.storyName = "MadieAlertError";
|
|
73
80
|
|
|
74
|
-
export const MadieAlertSuccess = ()
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
);
|
|
81
|
+
export const MadieAlertSuccess = Template.bind({});
|
|
82
|
+
MadieAlertSuccess.args = {
|
|
83
|
+
type: "success",
|
|
84
|
+
content: "Your measure has been succesfully updated.",
|
|
85
|
+
};
|
|
80
86
|
MadieAlertSuccess.storyName = "MadieAlertSuccess";
|
|
@@ -12,7 +12,6 @@ import { IconButton } from "@mui/material";
|
|
|
12
12
|
import ClearIcon from "@mui/icons-material/Clear";
|
|
13
13
|
import Toast from "../Toast/index";
|
|
14
14
|
import classNames from "classnames";
|
|
15
|
-
import PropTypes from "prop-types";
|
|
16
15
|
|
|
17
16
|
// Define icon mapping outside component to avoid recreation on each render
|
|
18
17
|
const typeToIconMap = {
|
|
@@ -54,8 +53,8 @@ const processContent = (content) => {
|
|
|
54
53
|
const childCount = Array.isArray(children)
|
|
55
54
|
? children.length
|
|
56
55
|
: children
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
? 1
|
|
57
|
+
: 0;
|
|
59
58
|
counts[el.type] += childCount;
|
|
60
59
|
}
|
|
61
60
|
|
|
@@ -144,15 +143,6 @@ const ActionButton = ({ tooltip, onClick, icon, testId, sx }) => (
|
|
|
144
143
|
</Tooltip>
|
|
145
144
|
);
|
|
146
145
|
|
|
147
|
-
// Add PropTypes for ActionButton
|
|
148
|
-
ActionButton.propTypes = {
|
|
149
|
-
tooltip: PropTypes.string.isRequired,
|
|
150
|
-
onClick: PropTypes.func.isRequired,
|
|
151
|
-
icon: PropTypes.node.isRequired,
|
|
152
|
-
testId: PropTypes.string.isRequired,
|
|
153
|
-
sx: PropTypes.object,
|
|
154
|
-
};
|
|
155
|
-
|
|
156
146
|
const MadieAlert = ({
|
|
157
147
|
type = "warning",
|
|
158
148
|
visible = true,
|
|
@@ -161,7 +151,7 @@ const MadieAlert = ({
|
|
|
161
151
|
minimizeAlerts = false,
|
|
162
152
|
alertProps,
|
|
163
153
|
closeButtonProps,
|
|
164
|
-
copyButton,
|
|
154
|
+
copyButton = false,
|
|
165
155
|
alerts = null,
|
|
166
156
|
}) => {
|
|
167
157
|
// Consolidate related state
|
|
@@ -246,7 +236,7 @@ const MadieAlert = ({
|
|
|
246
236
|
|
|
247
237
|
const totalMinimizedErrors = minimizedIndices.reduce(
|
|
248
238
|
(sum, index) => sum + (individualErrors[index] || 0),
|
|
249
|
-
0
|
|
239
|
+
0,
|
|
250
240
|
);
|
|
251
241
|
|
|
252
242
|
// Render alert content
|
|
@@ -298,7 +288,7 @@ const MadieAlert = ({
|
|
|
298
288
|
navigator.clipboard.writeText(
|
|
299
289
|
copyButton
|
|
300
290
|
? processContent(content).copyText
|
|
301
|
-
: copyText
|
|
291
|
+
: copyText,
|
|
302
292
|
);
|
|
303
293
|
updateState({ toastOpen: true });
|
|
304
294
|
}}
|
|
@@ -370,33 +360,4 @@ const MadieAlert = ({
|
|
|
370
360
|
);
|
|
371
361
|
};
|
|
372
362
|
|
|
373
|
-
// PropTypes definition
|
|
374
|
-
MadieAlert.propTypes = {
|
|
375
|
-
type: PropTypes.string,
|
|
376
|
-
visible: PropTypes.bool,
|
|
377
|
-
content: PropTypes.node,
|
|
378
|
-
canClose: PropTypes.bool,
|
|
379
|
-
alertProps: PropTypes.object,
|
|
380
|
-
closeButtonProps: PropTypes.object,
|
|
381
|
-
copyButton: PropTypes.bool,
|
|
382
|
-
minimizeAlerts: PropTypes.bool,
|
|
383
|
-
alerts: PropTypes.arrayOf(
|
|
384
|
-
PropTypes.shape({
|
|
385
|
-
type: PropTypes.string,
|
|
386
|
-
visible: PropTypes.bool,
|
|
387
|
-
content: PropTypes.node,
|
|
388
|
-
canClose: PropTypes.bool,
|
|
389
|
-
alertProps: PropTypes.object,
|
|
390
|
-
closeButtonProps: PropTypes.object,
|
|
391
|
-
copyButton: PropTypes.bool,
|
|
392
|
-
})
|
|
393
|
-
),
|
|
394
|
-
};
|
|
395
|
-
|
|
396
|
-
MadieAlert.defaultProps = {
|
|
397
|
-
copyButton: false,
|
|
398
|
-
minimizeAlerts: false,
|
|
399
|
-
alerts: null,
|
|
400
|
-
};
|
|
401
|
-
|
|
402
363
|
export default MadieAlert;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
2
|
import MadieConfirmDialog from "./index";
|
|
5
3
|
import Button from "../Button";
|
|
4
|
+
|
|
6
5
|
export default {
|
|
7
6
|
title: "MadieConfirmDialog",
|
|
8
7
|
component: MadieConfirmDialog,
|
|
9
|
-
decorators: [withKnobs],
|
|
10
8
|
};
|
|
11
9
|
|
|
12
10
|
const Wrapper = ({ children }) => (
|
|
@@ -14,38 +12,23 @@ const Wrapper = ({ children }) => (
|
|
|
14
12
|
{children}
|
|
15
13
|
</div>
|
|
16
14
|
);
|
|
17
|
-
Wrapper.propTypes = {
|
|
18
|
-
className: PropTypes.string,
|
|
19
|
-
children: PropTypes.node,
|
|
20
|
-
};
|
|
21
15
|
|
|
22
16
|
export const ConfirmDialog = () => {
|
|
23
17
|
const [open, setOpen] = useState(false);
|
|
24
|
-
const onClose = () => {
|
|
25
|
-
setOpen(false);
|
|
26
|
-
};
|
|
27
|
-
const onContinue = () => {
|
|
28
|
-
setOpen(false);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
18
|
const [openDiscardDialog, setOpenDiscardDialog] = useState(false);
|
|
32
|
-
const onDiscardDialogClose = () => {
|
|
33
|
-
setOpenDiscardDialog(false);
|
|
34
|
-
};
|
|
35
|
-
const onDiscardDialogContinue = () => {
|
|
36
|
-
setOpenDiscardDialog(false);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
19
|
const [openDeleteDialog, setOpenDeleteDialog] = useState(false);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
20
|
+
|
|
21
|
+
const onClose = () => setOpen(false);
|
|
22
|
+
const onContinue = () => setOpen(false);
|
|
23
|
+
|
|
24
|
+
const onDiscardDialogClose = () => setOpenDiscardDialog(false);
|
|
25
|
+
const onDiscardDialogContinue = () => setOpenDiscardDialog(false);
|
|
26
|
+
|
|
27
|
+
const onDeleteDialogClose = () => setOpenDeleteDialog(false);
|
|
28
|
+
const onDeleteDialogContinue = () => setOpenDeleteDialog(false);
|
|
46
29
|
|
|
47
30
|
return (
|
|
48
|
-
<
|
|
31
|
+
<Wrapper>
|
|
49
32
|
<p>
|
|
50
33
|
<Button variant="cyan" onClick={() => setOpen(true)}>
|
|
51
34
|
open Confirm Dialog
|
|
@@ -62,13 +45,12 @@ export const ConfirmDialog = () => {
|
|
|
62
45
|
<p>
|
|
63
46
|
<Button
|
|
64
47
|
variant="cyan"
|
|
65
|
-
onClick={() =>
|
|
66
|
-
setOpenDeleteDialog(true);
|
|
67
|
-
}}
|
|
48
|
+
onClick={() => setOpenDeleteDialog(true)}
|
|
68
49
|
>
|
|
69
50
|
open Delete Dialog
|
|
70
51
|
</Button>
|
|
71
52
|
</p>
|
|
53
|
+
|
|
72
54
|
<MadieConfirmDialog
|
|
73
55
|
open={open}
|
|
74
56
|
onContinue={onContinue}
|
|
@@ -78,6 +60,7 @@ export const ConfirmDialog = () => {
|
|
|
78
60
|
name="log out of UMLS"
|
|
79
61
|
action="confirm"
|
|
80
62
|
/>
|
|
63
|
+
|
|
81
64
|
<MadieConfirmDialog
|
|
82
65
|
open={openDiscardDialog}
|
|
83
66
|
onContinue={onDiscardDialogContinue}
|
|
@@ -89,6 +72,7 @@ export const ConfirmDialog = () => {
|
|
|
89
72
|
continueText="Yes, Discard All Changes"
|
|
90
73
|
cancelText="No, Keep Working"
|
|
91
74
|
/>
|
|
75
|
+
|
|
92
76
|
<MadieConfirmDialog
|
|
93
77
|
open={openDeleteDialog}
|
|
94
78
|
onContinue={onDeleteDialogContinue}
|
|
@@ -99,6 +83,7 @@ export const ConfirmDialog = () => {
|
|
|
99
83
|
action="delete"
|
|
100
84
|
continueText="Yes, Delete"
|
|
101
85
|
/>
|
|
102
|
-
</
|
|
86
|
+
</Wrapper>
|
|
103
87
|
);
|
|
104
88
|
};
|
|
89
|
+
ConfirmDialog.storyName = "ConfirmDialog";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import ErrorIcon from "@mui/icons-material/Error";
|
|
4
3
|
import MadieDialog from "../MadieDialog";
|
|
5
4
|
|
|
@@ -53,12 +52,5 @@ const MadieConfirmDialog = ({
|
|
|
53
52
|
</div>
|
|
54
53
|
</MadieDialog>
|
|
55
54
|
);
|
|
56
|
-
MadieConfirmDialog.propTypes = {
|
|
57
|
-
open: PropTypes.bool,
|
|
58
|
-
onClose: PropTypes.func,
|
|
59
|
-
onContinue: PropTypes.func,
|
|
60
|
-
action: PropTypes.string,
|
|
61
|
-
warning: PropTypes.string,
|
|
62
|
-
};
|
|
63
55
|
|
|
64
56
|
export default MadieConfirmDialog;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
2
|
import MadieDeleteDialog from "./index";
|
|
5
3
|
import Button from "../Button";
|
|
4
|
+
|
|
6
5
|
export default {
|
|
7
6
|
title: "MadieDeleteDialog",
|
|
8
7
|
component: MadieDeleteDialog,
|
|
9
|
-
decorators: [withKnobs],
|
|
10
8
|
};
|
|
11
9
|
|
|
12
10
|
const Wrapper = ({ children }) => (
|
|
@@ -14,22 +12,13 @@ const Wrapper = ({ children }) => (
|
|
|
14
12
|
{children}
|
|
15
13
|
</div>
|
|
16
14
|
);
|
|
17
|
-
Wrapper.propTypes = {
|
|
18
|
-
className: PropTypes.string,
|
|
19
|
-
children: PropTypes.node,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
15
|
export const DeleteDialog = () => {
|
|
23
16
|
const [open, setOpen] = useState(false);
|
|
24
|
-
const onClose = () =>
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
const onContinue = () => {
|
|
28
|
-
setOpen(false);
|
|
29
|
-
};
|
|
17
|
+
const onClose = () => setOpen(false);
|
|
18
|
+
const onContinue = () => setOpen(false);
|
|
30
19
|
|
|
31
20
|
return (
|
|
32
|
-
<
|
|
21
|
+
<Wrapper>
|
|
33
22
|
<Button variant="cyan" onClick={() => setOpen(true)}>
|
|
34
23
|
open Dialog
|
|
35
24
|
</Button>
|
|
@@ -38,21 +27,17 @@ export const DeleteDialog = () => {
|
|
|
38
27
|
onContinue={onContinue}
|
|
39
28
|
onClose={onClose}
|
|
40
29
|
/>
|
|
41
|
-
</
|
|
30
|
+
</Wrapper>
|
|
42
31
|
);
|
|
43
32
|
};
|
|
44
33
|
|
|
45
34
|
export const DeleteDialogNoWarning = () => {
|
|
46
35
|
const [open, setOpen] = useState(false);
|
|
47
|
-
const onClose = () =>
|
|
48
|
-
|
|
49
|
-
};
|
|
50
|
-
const onContinue = () => {
|
|
51
|
-
setOpen(false);
|
|
52
|
-
};
|
|
36
|
+
const onClose = () => setOpen(false);
|
|
37
|
+
const onContinue = () => setOpen(false);
|
|
53
38
|
|
|
54
39
|
return (
|
|
55
|
-
<
|
|
40
|
+
<Wrapper>
|
|
56
41
|
<Button variant="cyan" onClick={() => setOpen(true)}>
|
|
57
42
|
open Dialog
|
|
58
43
|
</Button>
|
|
@@ -62,6 +47,6 @@ export const DeleteDialogNoWarning = () => {
|
|
|
62
47
|
onClose={onClose}
|
|
63
48
|
hideWarning={true}
|
|
64
49
|
/>
|
|
65
|
-
</
|
|
50
|
+
</Wrapper>
|
|
66
51
|
);
|
|
67
52
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import ErrorIcon from "@mui/icons-material/Error";
|
|
4
3
|
import MadieDialog from "../MadieDialog";
|
|
5
4
|
|
|
@@ -47,10 +46,4 @@ const MadieDeleteDialog = ({
|
|
|
47
46
|
</MadieDialog>
|
|
48
47
|
);
|
|
49
48
|
|
|
50
|
-
MadieDeleteDialog.propTypes = {
|
|
51
|
-
open: PropTypes.bool,
|
|
52
|
-
onClose: PropTypes.func,
|
|
53
|
-
onContinue: PropTypes.func,
|
|
54
|
-
};
|
|
55
|
-
|
|
56
49
|
export default MadieDeleteDialog;
|