@madie/madie-design-system 1.2.74 → 1.2.75

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.
@@ -18,6 +18,9 @@ Wrapper.propTypes = {
18
18
  className: PropTypes.string,
19
19
  children: PropTypes.node,
20
20
  };
21
+ const contentWithHtmlTag =
22
+ '<p><strong>test &amp;</strong></p><table class="rich-text-table" style="min-width: 75px"><colgroup><col style="min-width: 25px"><col style="min-width: 25px"><col style="min-width: 25px"></colgroup><tbody><tr><th colspan="1" rowspan="1"><p></p></th><th colspan="1" rowspan="1"><p></p></th><th colspan="1" rowspan="1"><p></p></th></tr><tr><td colspan="1" rowspan="1"><p>table col 1</p></td><td colspan="1" rowspan="1"><p>table col 2</p></td><td colspan="1" rowspan="1"><p>table col 3</p></td></tr><tr><td colspan="1" rowspan="1"><p>table col 4</p></td><td colspan="1" rowspan="1"><p>table col 5</p></td><td colspan="1" rowspan="1"><p>table col 6</p></td></tr></tbody></table><ol><li><p><strong>test2</strong></p></li><li><p><strong>test3</strong></p></li></ol>';
23
+
21
24
 
22
25
  export const DeleteDialog = () => {
23
26
  const [open, setOpen] = useState(false);
@@ -65,3 +68,25 @@ export const DeleteDialogNoWarning = () => {
65
68
  </div>
66
69
  );
67
70
  };
71
+
72
+ export const DeleteDialogWithHtmlTags = () => {
73
+ const [open, setOpen] = useState(false);
74
+ const onClose = () => setOpen(false);
75
+ const onContinue = () => setOpen(false);
76
+
77
+ return (
78
+ <Wrapper>
79
+ <Button variant="cyan" onClick={() => setOpen(true)}>
80
+ open Dialog
81
+ </Button>
82
+ <MadieDeleteDialog
83
+ open={open}
84
+ onContinue={onContinue}
85
+ onClose={onClose}
86
+ hideWarning={true}
87
+ dialogTitle="Delete Measure Reference"
88
+ name={contentWithHtmlTag}
89
+ />
90
+ </Wrapper>
91
+ );
92
+ };
@@ -2,6 +2,15 @@ import React from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import ErrorIcon from "@mui/icons-material/Error";
4
4
  import MadieDialog from "../MadieDialog";
5
+ import parse, { domToReact } from "html-react-parser";
6
+
7
+ const options = {
8
+ replace: ({ name, children }) => {
9
+ if (name === "p") {
10
+ return <>{domToReact(children)}</>; // Return the children directly, effectively removing the <p> tag
11
+ }
12
+ },
13
+ };
5
14
 
6
15
  const MadieDeleteDialog = ({
7
16
  open,
@@ -34,7 +43,15 @@ const MadieDeleteDialog = ({
34
43
  <section className="dialog-warning-body">
35
44
  <p>
36
45
  Are you sure you want to delete{" "}
37
- <span className="strong">{otherDialogProps.name}</span>?
46
+ <span className="strong">
47
+ {parse(
48
+ otherDialogProps?.name
49
+ ? otherDialogProps?.name
50
+ : "",
51
+ options,
52
+ )}
53
+ </span>
54
+ ?
38
55
  </p>
39
56
  </section>
40
57
  {otherDialogProps.hideWarning !== true && (