@madie/madie-design-system 2.0.1 → 2.0.2

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.
@@ -12,6 +12,9 @@ const Wrapper = ({ children }) => (
12
12
  {children}
13
13
  </div>
14
14
  );
15
+ const contentWithHtmlTag =
16
+ '<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>';
17
+
15
18
  export const DeleteDialog = () => {
16
19
  const [open, setOpen] = useState(false);
17
20
  const onClose = () => setOpen(false);
@@ -50,3 +53,25 @@ export const DeleteDialogNoWarning = () => {
50
53
  </Wrapper>
51
54
  );
52
55
  };
56
+
57
+ export const DeleteDialogWithHtmlTags = () => {
58
+ const [open, setOpen] = useState(false);
59
+ const onClose = () => setOpen(false);
60
+ const onContinue = () => setOpen(false);
61
+
62
+ return (
63
+ <Wrapper>
64
+ <Button variant="cyan" onClick={() => setOpen(true)}>
65
+ open Dialog
66
+ </Button>
67
+ <MadieDeleteDialog
68
+ open={open}
69
+ onContinue={onContinue}
70
+ onClose={onClose}
71
+ hideWarning={true}
72
+ dialogTitle="Delete Measure Reference"
73
+ name={contentWithHtmlTag}
74
+ />
75
+ </Wrapper>
76
+ );
77
+ };
@@ -1,6 +1,15 @@
1
1
  import React from "react";
2
2
  import ErrorIcon from "@mui/icons-material/Error";
3
3
  import MadieDialog from "../MadieDialog";
4
+ import parse, { domToReact } from "html-react-parser";
5
+
6
+ const options = {
7
+ replace: ({ name, children }) => {
8
+ if (name === "p") {
9
+ return <>{domToReact(children)}</>; // Return the children directly, effectively removing the <p> tag
10
+ }
11
+ },
12
+ };
4
13
 
5
14
  const MadieDeleteDialog = ({
6
15
  open,
@@ -33,7 +42,15 @@ const MadieDeleteDialog = ({
33
42
  <section className="dialog-warning-body">
34
43
  <p>
35
44
  Are you sure you want to delete{" "}
36
- <span className="strong">{otherDialogProps.name}</span>?
45
+ <span className="strong">
46
+ {parse(
47
+ otherDialogProps?.name
48
+ ? otherDialogProps?.name
49
+ : "",
50
+ options,
51
+ )}
52
+ </span>
53
+ ?
37
54
  </p>
38
55
  </section>
39
56
  {otherDialogProps.hideWarning !== true && (