@madie/madie-design-system 2.0.0 → 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.
- package/.babelrc +14 -2
- package/.storybook/preview.js +1 -1
- package/components/Accordion/index.jsx +32 -36
- package/components/AutoComplete/AutoComplete.jsx +1 -16
- package/components/Button/Button.stories.js +0 -5
- package/components/Button/index.js +34 -44
- package/components/DateField/DateField.jsx +1 -14
- package/components/DateTimeField/DateTimeField.jsx +1 -9
- package/components/InputLabel/index.jsx +1 -6
- package/components/Instant/index.jsx +0 -16
- package/components/Link/index.js +42 -0
- package/components/MadieAlert/index.jsx +1 -40
- package/components/MadieConfirmDialog/MadieConfirmDialog.stories.js +0 -5
- package/components/MadieConfirmDialog/index.jsx +0 -8
- package/components/MadieDeleteDialog/MadieDeleteDialog.stories.js +24 -5
- package/components/MadieDeleteDialog/index.jsx +18 -8
- package/components/MadieDialog/MadieDialog.stories.js +0 -5
- package/components/MadieDialog/index.jsx +0 -21
- package/components/MadieDiscardDialog/MadieDiscardDialog.stories.js +0 -5
- package/components/MadieDiscardDialog/index.jsx +0 -7
- package/components/MadieSpinner/MadieSpinner.stories.js +0 -6
- package/components/MadieSpinner/index.jsx +0 -5
- package/components/MadieTooltip/index.jsx +0 -6
- package/components/MadieTooltipIcon/index.jsx +0 -5
- package/components/Modal/Modal.jsx +31 -43
- package/components/Modal/index.jsx +6 -8
- package/components/NumberInput/NumberInput.stories.js +0 -5
- package/components/NumberInput/index.jsx +0 -13
- package/components/Pagination/index.jsx +0 -17
- package/components/Popover/index.js +0 -23
- package/components/RadioButton/RadioButton.jsx +1 -13
- package/components/ReadOnlyTextField/ReadOnlyTextField.stories.js +0 -6
- package/components/ReadOnlyTextField/index.jsx +0 -8
- package/components/RichTextEditor/index.jsx +0 -15
- package/components/SanitizedContent/index.jsx +0 -8
- package/components/Search/index.js +26 -40
- package/components/Select/Select.stories.js +0 -4
- package/components/Select/index.jsx +1 -16
- package/components/Tabs/Tab.js +29 -25
- package/components/Tabs/TabPanel.js +15 -19
- package/components/Tabs/Tabs.stories.js +14 -50
- package/components/Tabs/index.js +10 -28
- package/components/TextArea/TextArea.stories.js +0 -6
- package/components/TextArea/index.jsx +1 -13
- package/components/TextField/TextField.stories.js +0 -6
- package/components/TextField/index.jsx +1 -16
- package/components/TimeField/TimeField.jsx +0 -10
- package/components/Toast/index.jsx +0 -14
- package/components/TruncateText/index.js +0 -8
- package/components/{index.js → index.mjs} +37 -33
- 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} +0 -52
- package/dist/react/index.mjs.map +1 -0
- package/dist/react/package.json +1 -0
- package/{eslint.config.js → eslint.config.cjs} +3 -0
- package/jest.config.mjs +10 -0
- package/lib/Chevron.jsx +2 -10
- package/package.json +18 -10
- package/styles/_main.scss +4 -3
- package/test/components/Button.test.js +6 -16
- package/test/components/MadieDeleteDialog.test.js +30 -1
- package/test/components/Search.test.js +1 -1
- package/test/components/TruncateText.test.js +1 -1
- package/webpack.config.mjs +79 -0
- package/webpack.config.react.mjs +72 -0
- package/components/NotificationBanner/NotificationBanner.stories.js +0 -29
- package/components/NotificationBanner/index.js +0 -279
- package/components/UnwrappedSpinner/index.js +0 -8
- package/dist/browser.js +0 -1
- package/dist/react/index.js +0 -316
- package/dist/react/index.js.map +0 -1
- package/jest.config.js +0 -17
- package/webpack.config.js +0 -123
- package/webpack.config.react.js +0 -104
package/.babelrc
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
"presets": [
|
|
3
|
+
["@babel/preset-react", { "runtime": "automatic" }],
|
|
4
|
+
["@babel/preset-env", { "modules": false }]
|
|
5
|
+
],
|
|
6
|
+
"plugins": [
|
|
7
|
+
"@babel/plugin-proposal-class-properties"
|
|
8
|
+
],
|
|
9
|
+
"env": {
|
|
10
|
+
"test": {
|
|
11
|
+
"presets": [
|
|
12
|
+
["@babel/preset-env", { "targets": { "node": "current" } }]
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
4
16
|
}
|
package/.storybook/preview.js
CHANGED
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
import React, { useState, useRef, useEffect } from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import { Chevron } from "../../lib/Chevron.jsx";
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @param {{
|
|
6
|
+
* title?: string,
|
|
7
|
+
* subTitle?: string,
|
|
8
|
+
* children: React.ReactNode,
|
|
9
|
+
* centerItem?: string,
|
|
10
|
+
* rightItem?: string,
|
|
11
|
+
* isOpen?: boolean
|
|
12
|
+
* }} props
|
|
13
|
+
*/
|
|
14
|
+
const Accordion = ({
|
|
15
|
+
title = "",
|
|
16
|
+
subTitle,
|
|
17
|
+
children,
|
|
18
|
+
centerItem,
|
|
19
|
+
rightItem,
|
|
20
|
+
isOpen = false,
|
|
21
|
+
}) => {
|
|
6
22
|
const content = useRef(null);
|
|
7
|
-
const [setActive, setActiveState] = useState(
|
|
23
|
+
const [setActive, setActiveState] = useState(isOpen ? "active" : "");
|
|
8
24
|
const ariaPressed = setActive ? "true" : "false";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return `${node.scrollHeight}px`;
|
|
12
|
-
}
|
|
13
|
-
return "auto";
|
|
14
|
-
};
|
|
25
|
+
|
|
26
|
+
const getHeight = (node) => (node ? `${node.scrollHeight}px` : "auto");
|
|
15
27
|
const height = setActive ? getHeight(content.current) : "0px";
|
|
16
28
|
const rotate = setActive ? "accordion-icon rotate" : "accordion-icon";
|
|
17
29
|
|
|
@@ -28,37 +40,37 @@ const Accordion = (props) => {
|
|
|
28
40
|
}
|
|
29
41
|
|
|
30
42
|
useEffect(() => {
|
|
31
|
-
if (
|
|
43
|
+
if (isOpen) {
|
|
32
44
|
openAccordion();
|
|
33
45
|
} else {
|
|
34
46
|
closeAccordion();
|
|
35
47
|
}
|
|
36
|
-
}, [
|
|
48
|
+
}, [isOpen]);
|
|
37
49
|
|
|
38
50
|
return (
|
|
39
51
|
<div className="accordion-section" data-testid="accordion">
|
|
40
52
|
<button
|
|
41
53
|
className={`accordion ${setActive}`}
|
|
42
|
-
aria-label={
|
|
54
|
+
aria-label={title}
|
|
43
55
|
aria-pressed={ariaPressed}
|
|
44
56
|
aria-expanded={ariaPressed}
|
|
45
57
|
tabIndex="0"
|
|
46
58
|
onClick={toggleAccordion}
|
|
47
59
|
>
|
|
48
60
|
<div className="accordion-left-title">
|
|
49
|
-
<p className="accordion-title">{
|
|
50
|
-
{
|
|
51
|
-
<p className="accordion-subtitle">{
|
|
61
|
+
<p className="accordion-title">{title}</p>
|
|
62
|
+
{subTitle && (
|
|
63
|
+
<p className="accordion-subtitle">{subTitle}</p>
|
|
52
64
|
)}
|
|
53
65
|
</div>
|
|
54
|
-
{
|
|
66
|
+
{centerItem && (
|
|
55
67
|
<div className="accordion-center">
|
|
56
|
-
<p>{
|
|
68
|
+
<p>{centerItem}</p>
|
|
57
69
|
</div>
|
|
58
70
|
)}
|
|
59
|
-
{
|
|
71
|
+
{rightItem && (
|
|
60
72
|
<div className="accordion-right">
|
|
61
|
-
<p>{
|
|
73
|
+
<p>{rightItem}</p>
|
|
62
74
|
</div>
|
|
63
75
|
)}
|
|
64
76
|
<div className="chevron-container">
|
|
@@ -70,26 +82,10 @@ const Accordion = (props) => {
|
|
|
70
82
|
style={{ maxHeight: height }}
|
|
71
83
|
className="accordion-content"
|
|
72
84
|
>
|
|
73
|
-
<div className="accordion-text dashed-border">
|
|
74
|
-
{props.children}
|
|
75
|
-
</div>
|
|
85
|
+
<div className="accordion-text dashed-border">{children}</div>
|
|
76
86
|
</div>
|
|
77
87
|
</div>
|
|
78
88
|
);
|
|
79
89
|
};
|
|
80
90
|
|
|
81
|
-
Accordion.propTypes = {
|
|
82
|
-
title: PropTypes.string.isRequired,
|
|
83
|
-
subTitle: PropTypes.string,
|
|
84
|
-
children: PropTypes.any.isRequired,
|
|
85
|
-
centerItem: PropTypes.string,
|
|
86
|
-
rightItem: PropTypes.string,
|
|
87
|
-
isOpen: PropTypes.bool,
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
Accordion.defaultProps = {
|
|
91
|
-
title: "",
|
|
92
|
-
isOpen: false,
|
|
93
|
-
};
|
|
94
|
-
|
|
95
91
|
export default Accordion;
|
|
@@ -6,11 +6,10 @@ import {
|
|
|
6
6
|
TextField,
|
|
7
7
|
Checkbox,
|
|
8
8
|
} from "@mui/material";
|
|
9
|
-
import PropTypes from "prop-types";
|
|
10
9
|
import InputLabel from "../InputLabel";
|
|
11
10
|
import CheckBoxOutlineBlankIcon from "@mui/icons-material/CheckBoxOutlineBlank";
|
|
12
11
|
import CheckBoxIcon from "@mui/icons-material/CheckBox";
|
|
13
|
-
import
|
|
12
|
+
import ReadOnlyTextField from "../ReadOnlyTextField";
|
|
14
13
|
import _ from "lodash";
|
|
15
14
|
|
|
16
15
|
const autoCompleteStyles = {
|
|
@@ -244,18 +243,4 @@ const AutoComplete = ({
|
|
|
244
243
|
);
|
|
245
244
|
};
|
|
246
245
|
|
|
247
|
-
AutoComplete.propTypes = {
|
|
248
|
-
id: PropTypes.string,
|
|
249
|
-
dataTestId: PropTypes.string,
|
|
250
|
-
placeholder: PropTypes.string,
|
|
251
|
-
required: PropTypes.bool,
|
|
252
|
-
disabled: PropTypes.bool,
|
|
253
|
-
multiple: PropTypes.bool,
|
|
254
|
-
error: PropTypes.bool,
|
|
255
|
-
label: PropTypes.string,
|
|
256
|
-
helperText: PropTypes.string,
|
|
257
|
-
options: PropTypes.arrayOf(PropTypes.element),
|
|
258
|
-
onChange: PropTypes.any,
|
|
259
|
-
};
|
|
260
|
-
|
|
261
246
|
export default AutoComplete;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import FeatherIcon from "feather-icons-react";
|
|
4
3
|
|
|
5
4
|
import Button, { TextButton } from "./index";
|
|
@@ -12,10 +11,6 @@ export default {
|
|
|
12
11
|
const Container = ({ className = "", children }) => (
|
|
13
12
|
<div className={`qppds qpp-u-padding--16 ${className}`}>{children}</div>
|
|
14
13
|
);
|
|
15
|
-
Container.propTypes = {
|
|
16
|
-
className: PropTypes.string,
|
|
17
|
-
children: PropTypes.node,
|
|
18
|
-
};
|
|
19
14
|
|
|
20
15
|
export const Primary = () => (
|
|
21
16
|
<div>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
|
|
4
3
|
const VARIANTS = [
|
|
5
4
|
"secondary",
|
|
@@ -14,27 +13,42 @@ const VARIANTS = [
|
|
|
14
13
|
];
|
|
15
14
|
const SIZES = ["big"];
|
|
16
15
|
|
|
16
|
+
/**
|
|
17
|
+
* @param {{
|
|
18
|
+
* children?: React.ReactNode,
|
|
19
|
+
* className?: string,
|
|
20
|
+
* href?: string,
|
|
21
|
+
* loading?: boolean,
|
|
22
|
+
* onClick?: () => void,
|
|
23
|
+
* size?: string | null,
|
|
24
|
+
* type?: string,
|
|
25
|
+
* variant?: string | null,
|
|
26
|
+
* [key: string]: any
|
|
27
|
+
* }} props
|
|
28
|
+
*/
|
|
17
29
|
const Button = ({
|
|
18
|
-
children,
|
|
19
|
-
className,
|
|
20
|
-
href,
|
|
21
|
-
loading,
|
|
22
|
-
onClick,
|
|
23
|
-
size,
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
children = null,
|
|
31
|
+
className = "",
|
|
32
|
+
href = "",
|
|
33
|
+
loading = false,
|
|
34
|
+
onClick = () => null,
|
|
35
|
+
size = null,
|
|
36
|
+
type = "button",
|
|
37
|
+
variant = null,
|
|
26
38
|
...rest
|
|
27
39
|
}) => {
|
|
28
40
|
let btnClass = "qpp-c-button";
|
|
29
41
|
|
|
30
42
|
if (VARIANTS.includes(variant)) {
|
|
31
|
-
btnClass
|
|
43
|
+
btnClass += ` qpp-c-button--${variant}`;
|
|
32
44
|
}
|
|
45
|
+
|
|
33
46
|
if (SIZES.includes(size)) {
|
|
34
|
-
btnClass
|
|
47
|
+
btnClass += ` qpp-c-button--${size}`;
|
|
35
48
|
}
|
|
49
|
+
|
|
36
50
|
if (className) {
|
|
37
|
-
btnClass
|
|
51
|
+
btnClass += ` ${className}`;
|
|
38
52
|
}
|
|
39
53
|
|
|
40
54
|
if (href) {
|
|
@@ -42,17 +56,18 @@ const Button = ({
|
|
|
42
56
|
<a
|
|
43
57
|
href={href}
|
|
44
58
|
data-testid="ds-btn"
|
|
45
|
-
className={btnClass
|
|
59
|
+
className={btnClass}
|
|
46
60
|
onClick={onClick}
|
|
47
61
|
>
|
|
48
62
|
{children}
|
|
49
63
|
</a>
|
|
50
64
|
);
|
|
51
65
|
}
|
|
66
|
+
|
|
52
67
|
return (
|
|
53
68
|
<button
|
|
54
69
|
data-testid="ds-btn"
|
|
55
|
-
className={btnClass
|
|
70
|
+
className={btnClass}
|
|
56
71
|
onClick={onClick}
|
|
57
72
|
disabled={loading}
|
|
58
73
|
type={type}
|
|
@@ -63,38 +78,13 @@ const Button = ({
|
|
|
63
78
|
);
|
|
64
79
|
};
|
|
65
80
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
onClick: PropTypes.func,
|
|
72
|
-
size: PropTypes.oneOf(SIZES),
|
|
73
|
-
type: PropTypes.string,
|
|
74
|
-
variant: PropTypes.oneOf(VARIANTS),
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
Button.defaultProps = {
|
|
78
|
-
children: false,
|
|
79
|
-
className: "",
|
|
80
|
-
href: "",
|
|
81
|
-
loading: false,
|
|
82
|
-
onClick: () => null,
|
|
83
|
-
size: null,
|
|
84
|
-
type: "button",
|
|
85
|
-
variant: null,
|
|
86
|
-
};
|
|
87
|
-
|
|
81
|
+
/**
|
|
82
|
+
* @param {{
|
|
83
|
+
* className?: string
|
|
84
|
+
* } & React.ComponentProps<typeof Button>} props
|
|
85
|
+
*/
|
|
88
86
|
export const TextButton = ({ className = "", ...props }) => (
|
|
89
87
|
<Button className={`qpp-c-button--text ${className}`} {...props} />
|
|
90
88
|
);
|
|
91
89
|
|
|
92
|
-
TextButton.propTypes = {
|
|
93
|
-
className: PropTypes.string,
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
TextButton.defaultProps = {
|
|
97
|
-
className: "",
|
|
98
|
-
};
|
|
99
|
-
|
|
100
90
|
export default Button;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import TextField from "../TextField";
|
|
4
3
|
import { Box } from "@mui/material";
|
|
5
4
|
import { DatePicker } from "@mui/x-date-pickers/DatePicker";
|
|
@@ -7,7 +6,7 @@ import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
|
|
7
6
|
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
|
|
8
7
|
import dayjs from "dayjs";
|
|
9
8
|
import utc from "dayjs/plugin/utc";
|
|
10
|
-
import
|
|
9
|
+
import ReadOnlyTextField from "../ReadOnlyTextField";
|
|
11
10
|
|
|
12
11
|
dayjs.extend(utc);
|
|
13
12
|
dayjs.utc();
|
|
@@ -112,17 +111,5 @@ const DateField = ({
|
|
|
112
111
|
</LocalizationProvider>
|
|
113
112
|
);
|
|
114
113
|
};
|
|
115
|
-
DateField.propTypes = {
|
|
116
|
-
label: PropTypes.string.isRequired,
|
|
117
|
-
value: PropTypes.object,
|
|
118
|
-
handleDateChange: PropTypes.func.isRequired,
|
|
119
|
-
disabled: PropTypes.bool,
|
|
120
|
-
id: PropTypes.string,
|
|
121
|
-
error: PropTypes.bool,
|
|
122
|
-
helperText: PropTypes.string,
|
|
123
|
-
required: PropTypes.bool,
|
|
124
|
-
containerSx: PropTypes.object,
|
|
125
|
-
textFieldSx: PropTypes.object,
|
|
126
|
-
};
|
|
127
114
|
|
|
128
115
|
export default DateField;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import TextField from "../TextField";
|
|
4
3
|
import { DateTimePicker } from "@mui/x-date-pickers/DateTimePicker";
|
|
5
4
|
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
|
@@ -8,7 +7,7 @@ import dayjs from "dayjs";
|
|
|
8
7
|
import utc from "dayjs/plugin/utc";
|
|
9
8
|
|
|
10
9
|
import { FormControl } from "@mui/material";
|
|
11
|
-
import
|
|
10
|
+
import ReadOnlyTextField from "../ReadOnlyTextField";
|
|
12
11
|
|
|
13
12
|
dayjs.extend(utc);
|
|
14
13
|
dayjs.utc();
|
|
@@ -93,12 +92,5 @@ const DateTimeField = ({
|
|
|
93
92
|
</FormControl>
|
|
94
93
|
);
|
|
95
94
|
};
|
|
96
|
-
DateTimeField.propTypes = {
|
|
97
|
-
id: PropTypes.string,
|
|
98
|
-
dateTimeValue: PropTypes.object,
|
|
99
|
-
handleDateTimeChange: PropTypes.func.isRequired,
|
|
100
|
-
label: PropTypes.string.isRequired,
|
|
101
|
-
disabled: PropTypes.bool,
|
|
102
|
-
};
|
|
103
95
|
|
|
104
96
|
export default DateTimeField;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { InputLabel as MUIInputLabel } from "@mui/material";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
3
|
|
|
5
4
|
const Label = ({ required, disabled, error, ...rest }) => {
|
|
6
5
|
return (
|
|
@@ -45,9 +44,5 @@ const Label = ({ required, disabled, error, ...rest }) => {
|
|
|
45
44
|
/>
|
|
46
45
|
);
|
|
47
46
|
};
|
|
48
|
-
|
|
49
|
-
required: PropTypes.bool.isRequired,
|
|
50
|
-
disabled: PropTypes.bool.isRequired,
|
|
51
|
-
error: PropTypes.bool,
|
|
52
|
-
};
|
|
47
|
+
|
|
53
48
|
export default Label;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import TextField from "../TextField";
|
|
4
3
|
import { DatePicker } from "@mui/x-date-pickers/DatePicker";
|
|
5
4
|
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
|
@@ -249,19 +248,4 @@ const Instant = ({
|
|
|
249
248
|
);
|
|
250
249
|
};
|
|
251
250
|
|
|
252
|
-
Instant.propTypes = {
|
|
253
|
-
id: PropTypes.string,
|
|
254
|
-
placeholder: PropTypes.string,
|
|
255
|
-
disabled: PropTypes.bool,
|
|
256
|
-
required: PropTypes.bool,
|
|
257
|
-
dateTimeValue: PropTypes.any,
|
|
258
|
-
handleDateTimeChange: PropTypes.function,
|
|
259
|
-
textFieldSx: PropTypes.any,
|
|
260
|
-
dateFieldSx: PropTypes.any,
|
|
261
|
-
error: PropTypes.bool,
|
|
262
|
-
helperText: PropTypes.string,
|
|
263
|
-
datePickerProps: PropTypes.any,
|
|
264
|
-
onBlur: PropTypes.any,
|
|
265
|
-
};
|
|
266
|
-
|
|
267
251
|
export default Instant;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
const VARIANTS = ["white", "gray"];
|
|
4
|
+
|
|
5
|
+
const DSLink = ({
|
|
6
|
+
className = "",
|
|
7
|
+
href = "",
|
|
8
|
+
download = false,
|
|
9
|
+
ariaLabel = null,
|
|
10
|
+
onClick = () => null,
|
|
11
|
+
children = null,
|
|
12
|
+
variant = null,
|
|
13
|
+
...rest
|
|
14
|
+
}) => {
|
|
15
|
+
let linkClass = "qpp-c-link";
|
|
16
|
+
|
|
17
|
+
if (VARIANTS.includes(variant)) {
|
|
18
|
+
linkClass +=
|
|
19
|
+
variant === "gray"
|
|
20
|
+
? " qpp-u-color--gray-60"
|
|
21
|
+
: ` qpp-u-color--${variant}`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (className) {
|
|
25
|
+
linkClass += ` ${className}`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<a
|
|
30
|
+
aria-label={ariaLabel}
|
|
31
|
+
className={linkClass}
|
|
32
|
+
href={href}
|
|
33
|
+
download={download}
|
|
34
|
+
onClick={onClick}
|
|
35
|
+
{...rest}
|
|
36
|
+
>
|
|
37
|
+
{children}
|
|
38
|
+
</a>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default DSLink;
|
|
@@ -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 = {
|
|
@@ -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
|
|
@@ -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,5 +1,4 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import MadieConfirmDialog from "./index";
|
|
4
3
|
import Button from "../Button";
|
|
5
4
|
|
|
@@ -13,10 +12,6 @@ const Wrapper = ({ children }) => (
|
|
|
13
12
|
{children}
|
|
14
13
|
</div>
|
|
15
14
|
);
|
|
16
|
-
Wrapper.propTypes = {
|
|
17
|
-
className: PropTypes.string,
|
|
18
|
-
children: PropTypes.node,
|
|
19
|
-
};
|
|
20
15
|
|
|
21
16
|
export const ConfirmDialog = () => {
|
|
22
17
|
const [open, setOpen] = useState(false);
|
|
@@ -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,5 +1,4 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import MadieDeleteDialog from "./index";
|
|
4
3
|
import Button from "../Button";
|
|
5
4
|
|
|
@@ -13,10 +12,8 @@ const Wrapper = ({ children }) => (
|
|
|
13
12
|
{children}
|
|
14
13
|
</div>
|
|
15
14
|
);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
children: PropTypes.node,
|
|
19
|
-
};
|
|
15
|
+
const contentWithHtmlTag =
|
|
16
|
+
'<p><strong>test &</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>';
|
|
20
17
|
|
|
21
18
|
export const DeleteDialog = () => {
|
|
22
19
|
const [open, setOpen] = useState(false);
|
|
@@ -56,3 +53,25 @@ export const DeleteDialogNoWarning = () => {
|
|
|
56
53
|
</Wrapper>
|
|
57
54
|
);
|
|
58
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,7 +1,15 @@
|
|
|
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";
|
|
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
|
+
};
|
|
5
13
|
|
|
6
14
|
const MadieDeleteDialog = ({
|
|
7
15
|
open,
|
|
@@ -34,7 +42,15 @@ const MadieDeleteDialog = ({
|
|
|
34
42
|
<section className="dialog-warning-body">
|
|
35
43
|
<p>
|
|
36
44
|
Are you sure you want to delete{" "}
|
|
37
|
-
<span className="strong">
|
|
45
|
+
<span className="strong">
|
|
46
|
+
{parse(
|
|
47
|
+
otherDialogProps?.name
|
|
48
|
+
? otherDialogProps?.name
|
|
49
|
+
: "",
|
|
50
|
+
options,
|
|
51
|
+
)}
|
|
52
|
+
</span>
|
|
53
|
+
?
|
|
38
54
|
</p>
|
|
39
55
|
</section>
|
|
40
56
|
{otherDialogProps.hideWarning !== true && (
|
|
@@ -47,10 +63,4 @@ const MadieDeleteDialog = ({
|
|
|
47
63
|
</MadieDialog>
|
|
48
64
|
);
|
|
49
65
|
|
|
50
|
-
MadieDeleteDialog.propTypes = {
|
|
51
|
-
open: PropTypes.bool,
|
|
52
|
-
onClose: PropTypes.func,
|
|
53
|
-
onContinue: PropTypes.func,
|
|
54
|
-
};
|
|
55
|
-
|
|
56
66
|
export default MadieDeleteDialog;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import MadieDialog from "./index";
|
|
4
3
|
import TextArea from "../TextArea";
|
|
5
4
|
import Select from "../Select";
|
|
@@ -17,10 +16,6 @@ const Wrapper = ({ children }) => (
|
|
|
17
16
|
{children}
|
|
18
17
|
</div>
|
|
19
18
|
);
|
|
20
|
-
Wrapper.propTypes = {
|
|
21
|
-
className: PropTypes.string,
|
|
22
|
-
children: PropTypes.node,
|
|
23
|
-
};
|
|
24
19
|
|
|
25
20
|
export const Dialog = () => {
|
|
26
21
|
const [open, setOpen] = useState(false);
|