@madie/madie-design-system 1.2.62 → 2.0.0
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/.eslintrc.js +1 -1
- package/.storybook/.babelrc +2 -1
- package/.storybook/main.js +3 -11
- package/components/AutoComplete/AutoComplete.jsx +1 -1
- package/components/Button/Button.stories.js +0 -2
- package/components/DateField/DateField.jsx +1 -1
- package/components/DateField/DateField.stories.jsx +23 -10
- package/components/DateTimeField/DateTimeField.jsx +6 -2
- package/components/DateTimeField/DateTimeField.stories.jsx +29 -19
- package/components/Instant/Instant.stories.js +14 -6
- package/components/MadieAlert/MadieAlert.stories.js +35 -29
- package/components/MadieAlert/index.jsx +5 -5
- package/components/MadieConfirmDialog/MadieConfirmDialog.stories.js +17 -27
- package/components/MadieDeleteDialog/MadieDeleteDialog.stories.js +9 -18
- package/components/MadieDialog/MadieDialog.stories.js +45 -116
- package/components/MadieDialog/index.jsx +4 -2
- package/components/MadieDiscardDialog/MadieDiscardDialog.stories.js +5 -7
- package/components/MadieSpinner/MadieSpinner.stories.js +1 -3
- package/components/MadieTooltip/MadieTooltip.stories.js +7 -2
- package/components/Modal/Modal.stories.js +18 -89
- package/components/NotificationBanner/NotificationBanner.stories.js +17 -11
- package/components/NotificationBanner/index.js +3 -3
- package/components/NumberInput/NumberInput.stories.js +51 -63
- package/components/Popover/Popover.stories.js +6 -14
- package/components/Popover/index.js +2 -2
- package/components/RadioButton/RadioButton.jsx +4 -2
- package/components/RadioButton/RadioButton.stories.jsx +6 -2
- package/components/ReadOnlyTextField/ReadOnlyTextField.stories.js +4 -3
- package/components/ReadOnlyTextField/index.jsx +1 -1
- package/components/RichTextEditor/RichTextEditor.stories.js +10 -8
- package/components/RichTextEditor/index.jsx +14 -15
- package/components/Search/Search.stories.js +2 -4
- package/components/Select/Select.stories.js +59 -160
- package/components/Select/index.jsx +1 -1
- package/components/Tabs/Tabs.stories.js +78 -210
- package/components/TextArea/TextArea.stories.js +88 -108
- package/components/TextArea/index.jsx +1 -1
- package/components/TextField/TextField.stories.js +101 -124
- package/components/TextField/index.jsx +1 -1
- package/components/TimeField/TimeField.stories.js +18 -8
- package/components/Toast/Toast.stories.js +42 -102
- package/components/TruncateText/TruncateText.stories.js +22 -17
- package/components/hooks/useGetConfig.js +2 -2
- package/components/index.js +0 -24
- package/dist/browser.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +182 -51
- package/dist/react/index.js.LICENSE.txt +27 -24
- package/dist/react/index.js.map +1 -1
- package/eslint.config.js +56 -0
- package/index.js +7 -9
- package/package.json +43 -75
- package/test/components/Accordion.test.js +1 -1
- package/test/components/AutoComplete.test.js +11 -6
- package/test/components/Button.test.js +7 -3
- 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.js +0 -1
- 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/Link/index.js +0 -61
- 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/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/.eslintrc.js
CHANGED
package/.storybook/.babelrc
CHANGED
package/.storybook/main.js
CHANGED
|
@@ -5,17 +5,9 @@ module.exports = {
|
|
|
5
5
|
],
|
|
6
6
|
|
|
7
7
|
addons: [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"@storybook/addon-knobs",
|
|
12
|
-
"@storybook/addon-a11y",
|
|
13
|
-
"@storybook/addon-docs",
|
|
14
|
-
"@storybook/addon-backgrounds",
|
|
15
|
-
"@storybook/addon-viewport",
|
|
16
|
-
"@storybook/addon-postcss",
|
|
17
|
-
"@storybook/addon-webpack5-compiler-babel"
|
|
18
|
-
],
|
|
8
|
+
"@storybook/addon-links",
|
|
9
|
+
"@storybook/addon-webpack5-compiler-babel",
|
|
10
|
+
"@storybook/addon-docs"],
|
|
19
11
|
|
|
20
12
|
webpackFinal: async (config) => {
|
|
21
13
|
// do mutation to the config
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
3
|
import FeatherIcon from "feather-icons-react";
|
|
5
4
|
|
|
6
5
|
import Button, { TextButton } from "./index";
|
|
@@ -8,7 +7,6 @@ import Button, { TextButton } from "./index";
|
|
|
8
7
|
export default {
|
|
9
8
|
title: "Button",
|
|
10
9
|
component: Button,
|
|
11
|
-
decorators: [withKnobs],
|
|
12
10
|
};
|
|
13
11
|
|
|
14
12
|
const Container = ({ className = "", children }) => (
|
|
@@ -1,41 +1,54 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import DateField from "./DateField";
|
|
3
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
3
|
|
|
5
4
|
export default {
|
|
6
5
|
title: "DateField",
|
|
7
6
|
component: DateField,
|
|
8
|
-
|
|
7
|
+
argTypes: {
|
|
8
|
+
label: { control: "text" },
|
|
9
|
+
disabled: { control: "boolean" },
|
|
10
|
+
value: { control: "text" },
|
|
11
|
+
},
|
|
9
12
|
};
|
|
13
|
+
|
|
10
14
|
export const DateFieldComponent = (args) => {
|
|
11
15
|
const [value, setValue] = useState("");
|
|
16
|
+
|
|
12
17
|
const handleDateChange = (e) => {
|
|
13
18
|
console.log("Handle change triggered", e.target.value);
|
|
14
19
|
setValue(e.target.value);
|
|
15
20
|
};
|
|
21
|
+
|
|
16
22
|
return (
|
|
17
23
|
<div className="qpp-u-padding--16">
|
|
18
24
|
<DateField
|
|
19
|
-
|
|
20
|
-
handleDateChange={handleDateChange}
|
|
25
|
+
{...args}
|
|
21
26
|
value={value}
|
|
27
|
+
handleDateChange={handleDateChange}
|
|
22
28
|
/>
|
|
23
29
|
</div>
|
|
24
30
|
);
|
|
25
31
|
};
|
|
26
32
|
|
|
33
|
+
DateFieldComponent.args = {
|
|
34
|
+
label: "Status Date",
|
|
35
|
+
disabled: false,
|
|
36
|
+
};
|
|
37
|
+
|
|
27
38
|
export const DateFieldComponentDisabled = (args) => {
|
|
28
39
|
const handleDateChange = (e) => {
|
|
29
40
|
console.log("Handle change triggered", e.target.value);
|
|
30
41
|
};
|
|
42
|
+
|
|
31
43
|
return (
|
|
32
44
|
<div className="qpp-u-padding--16">
|
|
33
|
-
<DateField
|
|
34
|
-
disabled
|
|
35
|
-
label="Status Date"
|
|
36
|
-
handleDateChange={handleDateChange}
|
|
37
|
-
value="2023-10-01"
|
|
38
|
-
/>
|
|
45
|
+
<DateField {...args} handleDateChange={handleDateChange} />
|
|
39
46
|
</div>
|
|
40
47
|
);
|
|
41
48
|
};
|
|
49
|
+
|
|
50
|
+
DateFieldComponentDisabled.args = {
|
|
51
|
+
label: "Status Date",
|
|
52
|
+
disabled: true,
|
|
53
|
+
value: "2023-10-01",
|
|
54
|
+
};
|
|
@@ -58,11 +58,15 @@ const DateTimeField = ({
|
|
|
58
58
|
return (
|
|
59
59
|
<ReadOnlyTextField
|
|
60
60
|
label={label}
|
|
61
|
-
value={
|
|
61
|
+
value={
|
|
62
|
+
dateTimeValue
|
|
63
|
+
? dayjs.utc(dateTimeValue).format("MM/DD/YYYY hh:mm A")
|
|
64
|
+
: "-"
|
|
65
|
+
}
|
|
62
66
|
id={id}
|
|
63
67
|
size="small"
|
|
64
68
|
/>
|
|
65
|
-
)
|
|
69
|
+
);
|
|
66
70
|
}
|
|
67
71
|
return (
|
|
68
72
|
<FormControl>
|
|
@@ -1,41 +1,51 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import DateTimeField from "./DateTimeField";
|
|
3
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
3
|
|
|
5
4
|
export default {
|
|
6
5
|
title: "DateTimeField",
|
|
7
6
|
component: DateTimeField,
|
|
8
|
-
|
|
7
|
+
argTypes: {
|
|
8
|
+
label: { control: "text" },
|
|
9
|
+
disabled: { control: "boolean" },
|
|
10
|
+
dateTimeValue: { control: "text" },
|
|
11
|
+
id: { control: "text" },
|
|
12
|
+
},
|
|
9
13
|
};
|
|
10
14
|
|
|
11
15
|
export const TimeDateFieldComponent = (args) => {
|
|
12
|
-
const [value, setValue] = useState("");
|
|
16
|
+
const [value, setValue] = useState(args.dateTimeValue || "");
|
|
17
|
+
|
|
13
18
|
const handleDateTimeChange = (e) => {
|
|
14
19
|
setValue(e.target.value);
|
|
15
20
|
};
|
|
21
|
+
|
|
16
22
|
return (
|
|
17
23
|
<div className="qpp-u-padding--16">
|
|
18
24
|
<DateTimeField
|
|
19
|
-
|
|
20
|
-
id="status_date_time"
|
|
21
|
-
label="Status Date/Time"
|
|
22
|
-
handleDateTimeChange={handleDateTimeChange}
|
|
25
|
+
{...args}
|
|
23
26
|
dateTimeValue={value}
|
|
27
|
+
handleDateTimeChange={handleDateTimeChange}
|
|
24
28
|
/>
|
|
25
29
|
</div>
|
|
26
30
|
);
|
|
27
31
|
};
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
TimeDateFieldComponent.args = {
|
|
34
|
+
label: "Status Date/Time",
|
|
35
|
+
disabled: false,
|
|
36
|
+
id: "status_date_time",
|
|
37
|
+
dateTimeValue: "",
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const TimeDateFieldComponentDisabled = (args) => (
|
|
41
|
+
<div className="qpp-u-padding--16">
|
|
42
|
+
<DateTimeField {...args} handleDateTimeChange={() => {}} />
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
TimeDateFieldComponentDisabled.args = {
|
|
47
|
+
label: "Status Date/Time",
|
|
48
|
+
disabled: true,
|
|
49
|
+
id: "status_date_time",
|
|
50
|
+
dateTimeValue: "2023-10-01T12:00:00Z",
|
|
41
51
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import Instant from "./index";
|
|
3
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
3
|
|
|
5
4
|
export default {
|
|
6
5
|
title: "Instant",
|
|
7
6
|
component: Instant,
|
|
8
|
-
|
|
7
|
+
argTypes: {
|
|
8
|
+
disabled: { control: "boolean" },
|
|
9
|
+
id: { control: "text" },
|
|
10
|
+
label: { control: "text" },
|
|
11
|
+
},
|
|
9
12
|
};
|
|
10
13
|
|
|
11
14
|
export const InstantComponent = (args) => {
|
|
@@ -13,16 +16,21 @@ export const InstantComponent = (args) => {
|
|
|
13
16
|
const handleDateTimeChange = (v) => {
|
|
14
17
|
setValue(v);
|
|
15
18
|
};
|
|
19
|
+
|
|
16
20
|
return (
|
|
17
21
|
<div className="qpp-u-padding--16">
|
|
18
|
-
<div>
|
|
22
|
+
<div>Date string: {value}</div>
|
|
19
23
|
<Instant
|
|
20
|
-
|
|
21
|
-
id="status_date_time"
|
|
22
|
-
label="Status Date/Time"
|
|
24
|
+
{...args}
|
|
23
25
|
handleDateTimeChange={handleDateTimeChange}
|
|
24
26
|
dateTimeValue={value}
|
|
25
27
|
/>
|
|
26
28
|
</div>
|
|
27
29
|
);
|
|
28
30
|
};
|
|
31
|
+
|
|
32
|
+
InstantComponent.args = {
|
|
33
|
+
disabled: false,
|
|
34
|
+
id: "status_date_time",
|
|
35
|
+
label: "Status Date/Time",
|
|
36
|
+
};
|
|
@@ -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";
|
|
@@ -54,8 +54,8 @@ const processContent = (content) => {
|
|
|
54
54
|
const childCount = Array.isArray(children)
|
|
55
55
|
? children.length
|
|
56
56
|
: children
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
? 1
|
|
58
|
+
: 0;
|
|
59
59
|
counts[el.type] += childCount;
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -246,7 +246,7 @@ const MadieAlert = ({
|
|
|
246
246
|
|
|
247
247
|
const totalMinimizedErrors = minimizedIndices.reduce(
|
|
248
248
|
(sum, index) => sum + (individualErrors[index] || 0),
|
|
249
|
-
0
|
|
249
|
+
0,
|
|
250
250
|
);
|
|
251
251
|
|
|
252
252
|
// Render alert content
|
|
@@ -298,7 +298,7 @@ const MadieAlert = ({
|
|
|
298
298
|
navigator.clipboard.writeText(
|
|
299
299
|
copyButton
|
|
300
300
|
? processContent(content).copyText
|
|
301
|
-
: copyText
|
|
301
|
+
: copyText,
|
|
302
302
|
);
|
|
303
303
|
updateState({ toastOpen: true });
|
|
304
304
|
}}
|
|
@@ -389,7 +389,7 @@ MadieAlert.propTypes = {
|
|
|
389
389
|
alertProps: PropTypes.object,
|
|
390
390
|
closeButtonProps: PropTypes.object,
|
|
391
391
|
copyButton: PropTypes.bool,
|
|
392
|
-
})
|
|
392
|
+
}),
|
|
393
393
|
),
|
|
394
394
|
};
|
|
395
395
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
3
|
import MadieConfirmDialog from "./index";
|
|
5
4
|
import Button from "../Button";
|
|
5
|
+
|
|
6
6
|
export default {
|
|
7
7
|
title: "MadieConfirmDialog",
|
|
8
8
|
component: MadieConfirmDialog,
|
|
9
|
-
decorators: [withKnobs],
|
|
10
9
|
};
|
|
11
10
|
|
|
12
11
|
const Wrapper = ({ children }) => (
|
|
@@ -21,31 +20,20 @@ Wrapper.propTypes = {
|
|
|
21
20
|
|
|
22
21
|
export const ConfirmDialog = () => {
|
|
23
22
|
const [open, setOpen] = useState(false);
|
|
24
|
-
const onClose = () => {
|
|
25
|
-
setOpen(false);
|
|
26
|
-
};
|
|
27
|
-
const onContinue = () => {
|
|
28
|
-
setOpen(false);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
23
|
const [openDiscardDialog, setOpenDiscardDialog] = useState(false);
|
|
32
|
-
const onDiscardDialogClose = () => {
|
|
33
|
-
setOpenDiscardDialog(false);
|
|
34
|
-
};
|
|
35
|
-
const onDiscardDialogContinue = () => {
|
|
36
|
-
setOpenDiscardDialog(false);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
24
|
const [openDeleteDialog, setOpenDeleteDialog] = useState(false);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
25
|
+
|
|
26
|
+
const onClose = () => setOpen(false);
|
|
27
|
+
const onContinue = () => setOpen(false);
|
|
28
|
+
|
|
29
|
+
const onDiscardDialogClose = () => setOpenDiscardDialog(false);
|
|
30
|
+
const onDiscardDialogContinue = () => setOpenDiscardDialog(false);
|
|
31
|
+
|
|
32
|
+
const onDeleteDialogClose = () => setOpenDeleteDialog(false);
|
|
33
|
+
const onDeleteDialogContinue = () => setOpenDeleteDialog(false);
|
|
46
34
|
|
|
47
35
|
return (
|
|
48
|
-
<
|
|
36
|
+
<Wrapper>
|
|
49
37
|
<p>
|
|
50
38
|
<Button variant="cyan" onClick={() => setOpen(true)}>
|
|
51
39
|
open Confirm Dialog
|
|
@@ -62,13 +50,12 @@ export const ConfirmDialog = () => {
|
|
|
62
50
|
<p>
|
|
63
51
|
<Button
|
|
64
52
|
variant="cyan"
|
|
65
|
-
onClick={() =>
|
|
66
|
-
setOpenDeleteDialog(true);
|
|
67
|
-
}}
|
|
53
|
+
onClick={() => setOpenDeleteDialog(true)}
|
|
68
54
|
>
|
|
69
55
|
open Delete Dialog
|
|
70
56
|
</Button>
|
|
71
57
|
</p>
|
|
58
|
+
|
|
72
59
|
<MadieConfirmDialog
|
|
73
60
|
open={open}
|
|
74
61
|
onContinue={onContinue}
|
|
@@ -78,6 +65,7 @@ export const ConfirmDialog = () => {
|
|
|
78
65
|
name="log out of UMLS"
|
|
79
66
|
action="confirm"
|
|
80
67
|
/>
|
|
68
|
+
|
|
81
69
|
<MadieConfirmDialog
|
|
82
70
|
open={openDiscardDialog}
|
|
83
71
|
onContinue={onDiscardDialogContinue}
|
|
@@ -89,6 +77,7 @@ export const ConfirmDialog = () => {
|
|
|
89
77
|
continueText="Yes, Discard All Changes"
|
|
90
78
|
cancelText="No, Keep Working"
|
|
91
79
|
/>
|
|
80
|
+
|
|
92
81
|
<MadieConfirmDialog
|
|
93
82
|
open={openDeleteDialog}
|
|
94
83
|
onContinue={onDeleteDialogContinue}
|
|
@@ -99,6 +88,7 @@ export const ConfirmDialog = () => {
|
|
|
99
88
|
action="delete"
|
|
100
89
|
continueText="Yes, Delete"
|
|
101
90
|
/>
|
|
102
|
-
</
|
|
91
|
+
</Wrapper>
|
|
103
92
|
);
|
|
104
93
|
};
|
|
94
|
+
ConfirmDialog.storyName = "ConfirmDialog";
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
3
|
import MadieDeleteDialog from "./index";
|
|
5
4
|
import Button from "../Button";
|
|
5
|
+
|
|
6
6
|
export default {
|
|
7
7
|
title: "MadieDeleteDialog",
|
|
8
8
|
component: MadieDeleteDialog,
|
|
9
|
-
decorators: [withKnobs],
|
|
10
9
|
};
|
|
11
10
|
|
|
12
11
|
const Wrapper = ({ children }) => (
|
|
@@ -21,15 +20,11 @@ Wrapper.propTypes = {
|
|
|
21
20
|
|
|
22
21
|
export const DeleteDialog = () => {
|
|
23
22
|
const [open, setOpen] = useState(false);
|
|
24
|
-
const onClose = () =>
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
const onContinue = () => {
|
|
28
|
-
setOpen(false);
|
|
29
|
-
};
|
|
23
|
+
const onClose = () => setOpen(false);
|
|
24
|
+
const onContinue = () => setOpen(false);
|
|
30
25
|
|
|
31
26
|
return (
|
|
32
|
-
<
|
|
27
|
+
<Wrapper>
|
|
33
28
|
<Button variant="cyan" onClick={() => setOpen(true)}>
|
|
34
29
|
open Dialog
|
|
35
30
|
</Button>
|
|
@@ -38,21 +33,17 @@ export const DeleteDialog = () => {
|
|
|
38
33
|
onContinue={onContinue}
|
|
39
34
|
onClose={onClose}
|
|
40
35
|
/>
|
|
41
|
-
</
|
|
36
|
+
</Wrapper>
|
|
42
37
|
);
|
|
43
38
|
};
|
|
44
39
|
|
|
45
40
|
export const DeleteDialogNoWarning = () => {
|
|
46
41
|
const [open, setOpen] = useState(false);
|
|
47
|
-
const onClose = () =>
|
|
48
|
-
|
|
49
|
-
};
|
|
50
|
-
const onContinue = () => {
|
|
51
|
-
setOpen(false);
|
|
52
|
-
};
|
|
42
|
+
const onClose = () => setOpen(false);
|
|
43
|
+
const onContinue = () => setOpen(false);
|
|
53
44
|
|
|
54
45
|
return (
|
|
55
|
-
<
|
|
46
|
+
<Wrapper>
|
|
56
47
|
<Button variant="cyan" onClick={() => setOpen(true)}>
|
|
57
48
|
open Dialog
|
|
58
49
|
</Button>
|
|
@@ -62,6 +53,6 @@ export const DeleteDialogNoWarning = () => {
|
|
|
62
53
|
onClose={onClose}
|
|
63
54
|
hideWarning={true}
|
|
64
55
|
/>
|
|
65
|
-
</
|
|
56
|
+
</Wrapper>
|
|
66
57
|
);
|
|
67
58
|
};
|