@madie/madie-design-system 1.0.27 → 1.0.28

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.
@@ -0,0 +1,43 @@
1
+ import React, { useState } from "react";
2
+ import PropTypes from "prop-types";
3
+ import { withKnobs } from "@storybook/addon-knobs";
4
+ import MadieDeleteDialog from "./index";
5
+ import Button from "../Button";
6
+ export default {
7
+ title: "MadieDeleteDialog",
8
+ component: MadieDeleteDialog,
9
+ decorators: [withKnobs],
10
+ };
11
+
12
+ const Wrapper = ({ children }) => (
13
+ <div className="qpp-u-padding--16" style={{ width: 300 }}>
14
+ {children}
15
+ </div>
16
+ );
17
+ Wrapper.propTypes = {
18
+ className: PropTypes.string,
19
+ children: PropTypes.node,
20
+ };
21
+
22
+ export const DeleteDialog = () => {
23
+ const [open, setOpen] = useState(false);
24
+ const onClose = () => {
25
+ setOpen(false);
26
+ };
27
+ const onContinue = () => {
28
+ setOpen(false);
29
+ };
30
+
31
+ return (
32
+ <div className="qpp-u-padding--16" style={{ width: 300 }}>
33
+ <Button variant="cyan" onClick={() => setOpen(true)}>
34
+ open Dialog
35
+ </Button>
36
+ <MadieDeleteDialog
37
+ open={open}
38
+ onContinue={onContinue}
39
+ onClose={onClose}
40
+ />
41
+ </div>
42
+ );
43
+ };
@@ -0,0 +1,54 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import ErrorIcon from "@mui/icons-material/Error";
4
+ import MadieDialog from "../MadieDialog";
5
+
6
+ const MadieDeleteDialog = ({
7
+ open,
8
+ onClose,
9
+ onContinue,
10
+ ...otherDialogProps
11
+ }) => (
12
+ <MadieDialog
13
+ title={otherDialogProps.dialogTitle}
14
+ dialogProps={{
15
+ open: open,
16
+ onClose,
17
+ "data-testid": "delete-dialog",
18
+ }}
19
+ cancelButtonProps={{
20
+ variant: "secondary",
21
+ onClick: onClose,
22
+ cancelText: "Cancel",
23
+ "data-testid": "delete-dialog-cancel-button",
24
+ }}
25
+ continueButtonProps={{
26
+ variant: "danger-primary",
27
+ type: "submit",
28
+ "data-testid": "delete-dialog-continue-button",
29
+ continueText: "Yes, Delete",
30
+ onClick: onContinue,
31
+ }}
32
+ >
33
+ <div id="delete-dialog-body">
34
+ <section className="dialog-warning-body">
35
+ <p>
36
+ Are you sure you want to delete{" "}
37
+ <span className="strong">{otherDialogProps.name}</span>?
38
+ </p>
39
+ </section>
40
+ <section className="dialog-warning-action">
41
+ <ErrorIcon />
42
+ <p>This Action cannot be undone.</p>
43
+ </section>
44
+ </div>
45
+ </MadieDialog>
46
+ );
47
+
48
+ MadieDeleteDialog.propTypes = {
49
+ open: PropTypes.bool,
50
+ onClose: PropTypes.func,
51
+ onContinue: PropTypes.func,
52
+ };
53
+
54
+ export default MadieDeleteDialog;
@@ -11,6 +11,7 @@ import FormControlLabel from "./FormControlLabel";
11
11
  import MadieAlert from "./MadieAlert";
12
12
  import MadieDialog from "./MadieDialog";
13
13
  import MadieDiscardDialog from "./MadieDiscardDialog";
14
+ import MadieDeleteDialog from "./MadieDeleteDialog";
14
15
  import MadieSpinner from "./MadieSpinner";
15
16
  import Modal from "./Modal";
16
17
  import { Pagination } from "./Pagination";
@@ -126,6 +127,7 @@ export {
126
127
  MadieAlert,
127
128
  MadieDialog,
128
129
  MadieDiscardDialog,
130
+ MadieDeleteDialog,
129
131
  MadieSpinner,
130
132
  Pagination,
131
133
  ReadOnlyTextField,