@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
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
3
2
|
import NumberInput from "./index";
|
|
4
3
|
import PropTypes from "prop-types";
|
|
5
4
|
|
|
6
5
|
export default {
|
|
7
6
|
title: "NumberInput",
|
|
8
7
|
component: NumberInput,
|
|
9
|
-
decorators: [withKnobs],
|
|
10
8
|
};
|
|
11
9
|
|
|
12
10
|
const Wrapper = ({ children }) => (
|
|
@@ -14,72 +12,62 @@ const Wrapper = ({ children }) => (
|
|
|
14
12
|
{children}
|
|
15
13
|
</div>
|
|
16
14
|
);
|
|
15
|
+
|
|
17
16
|
Wrapper.propTypes = {
|
|
18
|
-
className: PropTypes.string,
|
|
19
17
|
children: PropTypes.node,
|
|
20
18
|
};
|
|
21
19
|
|
|
22
|
-
export const BasicNumberInput = () =>
|
|
23
|
-
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
);
|
|
28
|
-
};
|
|
20
|
+
export const BasicNumberInput = () => (
|
|
21
|
+
<Wrapper>
|
|
22
|
+
<NumberInput id="basic-number-input" label="Demo number input" />
|
|
23
|
+
</Wrapper>
|
|
24
|
+
);
|
|
29
25
|
|
|
30
|
-
export const NumberInputWithNoNegativeNumbers = () =>
|
|
31
|
-
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
);
|
|
42
|
-
};
|
|
26
|
+
export const NumberInputWithNoNegativeNumbers = () => (
|
|
27
|
+
<Wrapper>
|
|
28
|
+
<NumberInput
|
|
29
|
+
id="number-input-non-negative"
|
|
30
|
+
label="Demo number input"
|
|
31
|
+
aria-label="Demo number input"
|
|
32
|
+
placeholder="Type a number…"
|
|
33
|
+
allowNegative={false}
|
|
34
|
+
/>
|
|
35
|
+
</Wrapper>
|
|
36
|
+
);
|
|
43
37
|
|
|
44
|
-
export const NumberInputWithErrorAndHelperText = () =>
|
|
45
|
-
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
);
|
|
57
|
-
};
|
|
38
|
+
export const NumberInputWithErrorAndHelperText = () => (
|
|
39
|
+
<Wrapper>
|
|
40
|
+
<NumberInput
|
|
41
|
+
id="number-input-error"
|
|
42
|
+
error={true}
|
|
43
|
+
label="Demo number input"
|
|
44
|
+
aria-label="Demo number input"
|
|
45
|
+
placeholder="Type a number…"
|
|
46
|
+
helperText="Please Enter a valid integer"
|
|
47
|
+
/>
|
|
48
|
+
</Wrapper>
|
|
49
|
+
);
|
|
58
50
|
|
|
59
|
-
export const NumberInputDisabled = () =>
|
|
60
|
-
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
);
|
|
71
|
-
};
|
|
51
|
+
export const NumberInputDisabled = () => (
|
|
52
|
+
<Wrapper>
|
|
53
|
+
<NumberInput
|
|
54
|
+
id="number-input-disabled"
|
|
55
|
+
label="Demo number input"
|
|
56
|
+
aria-label="Demo number input"
|
|
57
|
+
placeholder="Type a number…"
|
|
58
|
+
disabled={true}
|
|
59
|
+
/>
|
|
60
|
+
</Wrapper>
|
|
61
|
+
);
|
|
72
62
|
|
|
73
|
-
export const NumberInputWithTooltip = () =>
|
|
74
|
-
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
);
|
|
85
|
-
};
|
|
63
|
+
export const NumberInputWithTooltip = () => (
|
|
64
|
+
<Wrapper>
|
|
65
|
+
<NumberInput
|
|
66
|
+
id="number-input-tooltip"
|
|
67
|
+
label="Demo number input"
|
|
68
|
+
aria-label="Demo number input"
|
|
69
|
+
placeholder="Type a number…"
|
|
70
|
+
tooltipText="Provides information"
|
|
71
|
+
/>
|
|
72
|
+
</Wrapper>
|
|
73
|
+
);
|
|
@@ -1,37 +1,29 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import Popover from "./index";
|
|
3
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
3
|
|
|
5
4
|
export default {
|
|
6
5
|
title: "Popover",
|
|
7
6
|
component: Popover,
|
|
8
|
-
decorators: [withKnobs],
|
|
9
7
|
};
|
|
10
8
|
|
|
11
9
|
export const PopOver = () => {
|
|
12
10
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
13
11
|
const [optionsOpen, setOptionsOpen] = useState(false);
|
|
14
12
|
|
|
15
|
-
const onClose = () =>
|
|
16
|
-
setOptionsOpen(false);
|
|
17
|
-
};
|
|
13
|
+
const onClose = () => setOptionsOpen(false);
|
|
18
14
|
|
|
19
15
|
const handleOpen = (e) => {
|
|
20
16
|
setAnchorEl(e.currentTarget);
|
|
21
17
|
setOptionsOpen(true);
|
|
22
18
|
};
|
|
23
19
|
|
|
24
|
-
const viewEditredirect = () =>
|
|
25
|
-
setOptionsOpen(false);
|
|
26
|
-
};
|
|
20
|
+
const viewEditredirect = () => setOptionsOpen(false);
|
|
27
21
|
|
|
28
|
-
const zipData = () =>
|
|
29
|
-
setOptionsOpen(false);
|
|
30
|
-
};
|
|
22
|
+
const zipData = () => setOptionsOpen(false);
|
|
31
23
|
|
|
32
24
|
return (
|
|
33
25
|
<div className="qpp-u-padding--12">
|
|
34
|
-
<button className="qpp-c-button" onClick={
|
|
26
|
+
<button className="qpp-c-button" onClick={handleOpen}>
|
|
35
27
|
Open Popover
|
|
36
28
|
</button>
|
|
37
29
|
<Popover
|
|
@@ -42,13 +34,13 @@ export const PopOver = () => {
|
|
|
42
34
|
editViewSelectOptionProps={{
|
|
43
35
|
label: "View",
|
|
44
36
|
toImplementFunction: viewEditredirect,
|
|
45
|
-
dataTestId:
|
|
37
|
+
dataTestId: "edit-measure-1",
|
|
46
38
|
}}
|
|
47
39
|
otherSelectOptionProps={[
|
|
48
40
|
{
|
|
49
41
|
label: "Export",
|
|
50
42
|
toImplementFunction: zipData,
|
|
51
|
-
dataTestId:
|
|
43
|
+
dataTestId: "export-measure-1",
|
|
52
44
|
},
|
|
53
45
|
]}
|
|
54
46
|
/>
|
|
@@ -118,14 +118,14 @@ MadiePopover.propTypes = {
|
|
|
118
118
|
dataTestId: PropTypes.string,
|
|
119
119
|
label: PropTypes.string,
|
|
120
120
|
toImplementFunction: PropTypes.func,
|
|
121
|
-
})
|
|
121
|
+
}),
|
|
122
122
|
),
|
|
123
123
|
additionalSelectOptionProps: PropTypes.arrayOf(
|
|
124
124
|
PropTypes.shape({
|
|
125
125
|
dataTestId: PropTypes.string,
|
|
126
126
|
label: PropTypes.string,
|
|
127
127
|
toImplementFunction: PropTypes.func,
|
|
128
|
-
})
|
|
128
|
+
}),
|
|
129
129
|
),
|
|
130
130
|
};
|
|
131
131
|
|
|
@@ -22,7 +22,9 @@ const RadioButton = ({
|
|
|
22
22
|
...rest
|
|
23
23
|
}) => {
|
|
24
24
|
if (disabled) {
|
|
25
|
-
const option = options?.find(
|
|
25
|
+
const option = options?.find(
|
|
26
|
+
(option) => String(option.value) === String(rest.value),
|
|
27
|
+
);
|
|
26
28
|
return (
|
|
27
29
|
<ReadOnlyTextField
|
|
28
30
|
required={required}
|
|
@@ -32,7 +34,7 @@ const RadioButton = ({
|
|
|
32
34
|
{...rest}
|
|
33
35
|
value={option?.label}
|
|
34
36
|
/>
|
|
35
|
-
)
|
|
37
|
+
);
|
|
36
38
|
}
|
|
37
39
|
return (
|
|
38
40
|
<FormControl error={error} fullWidth>
|
|
@@ -36,12 +36,16 @@ const TemplateRadioButton = (args) => {
|
|
|
36
36
|
export const RadioButtonWithLabel = TemplateRadioButton.bind({});
|
|
37
37
|
RadioButtonWithLabel.args = {};
|
|
38
38
|
|
|
39
|
-
export const RadioButtonWithLabelDisabledWithNoValue = TemplateRadioButton.bind(
|
|
39
|
+
export const RadioButtonWithLabelDisabledWithNoValue = TemplateRadioButton.bind(
|
|
40
|
+
{},
|
|
41
|
+
);
|
|
40
42
|
RadioButtonWithLabelDisabledWithNoValue.args = {
|
|
41
43
|
disabled: true,
|
|
42
44
|
};
|
|
43
45
|
|
|
44
|
-
export const RadioButtonWithLabelDisabledWithValue = TemplateRadioButton.bind(
|
|
46
|
+
export const RadioButtonWithLabelDisabledWithValue = TemplateRadioButton.bind(
|
|
47
|
+
{},
|
|
48
|
+
);
|
|
45
49
|
RadioButtonWithLabelDisabledWithValue.args = {
|
|
46
50
|
disabled: true,
|
|
47
51
|
value: "options 3",
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
3
|
import ReadOnlyTextField from "./index";
|
|
5
4
|
import { FormHelperText } from "@mui/material";
|
|
5
|
+
|
|
6
6
|
export default {
|
|
7
7
|
title: "ReadOnlyTextField",
|
|
8
8
|
component: ReadOnlyTextField,
|
|
9
|
-
decorators: [withKnobs],
|
|
10
9
|
};
|
|
11
10
|
|
|
12
11
|
const Wrapper = ({ children }) => (
|
|
@@ -14,10 +13,12 @@ const Wrapper = ({ children }) => (
|
|
|
14
13
|
{children}
|
|
15
14
|
</div>
|
|
16
15
|
);
|
|
16
|
+
|
|
17
17
|
Wrapper.propTypes = {
|
|
18
18
|
className: PropTypes.string,
|
|
19
19
|
children: PropTypes.node,
|
|
20
20
|
};
|
|
21
|
+
|
|
21
22
|
export const Textfield = () => (
|
|
22
23
|
<Wrapper>
|
|
23
24
|
<ReadOnlyTextField
|
|
@@ -73,7 +74,7 @@ export const Error = () => (
|
|
|
73
74
|
data-testid="measure-name-text-field"
|
|
74
75
|
size="small"
|
|
75
76
|
helperText={
|
|
76
|
-
<FormHelperText data-testid=
|
|
77
|
+
<FormHelperText data-testid="helper-text" error>
|
|
77
78
|
An error message
|
|
78
79
|
</FormHelperText>
|
|
79
80
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
3
2
|
import RichTextEditor from "./index";
|
|
3
|
+
|
|
4
4
|
export default {
|
|
5
5
|
title: "RichTextEditor",
|
|
6
6
|
component: RichTextEditor,
|
|
7
7
|
decorators: [
|
|
8
|
-
withKnobs,
|
|
9
8
|
(storyFn) => <div style={{ padding: "120px" }}>{storyFn()}</div>,
|
|
10
9
|
],
|
|
11
10
|
};
|
|
@@ -16,10 +15,11 @@ export const TextEditor = () => {
|
|
|
16
15
|
const handleChange = (selectedVal) => {
|
|
17
16
|
setValue(selectedVal);
|
|
18
17
|
};
|
|
18
|
+
|
|
19
19
|
return (
|
|
20
20
|
<RichTextEditor
|
|
21
|
-
label=
|
|
22
|
-
required
|
|
21
|
+
label="Test Text Editor"
|
|
22
|
+
required
|
|
23
23
|
onChange={handleChange}
|
|
24
24
|
content={value}
|
|
25
25
|
disabled={false}
|
|
@@ -27,22 +27,24 @@ export const TextEditor = () => {
|
|
|
27
27
|
);
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
TextEditor.storyName = "Rich Text Editor";
|
|
31
|
+
|
|
30
32
|
export const ReadOnlyTextEditor = () => {
|
|
31
33
|
const [value, setValue] = useState(
|
|
32
|
-
"<p>This is <strong>readonly</strong> content</p>"
|
|
34
|
+
"<p>This is <strong>readonly</strong> content</p>",
|
|
33
35
|
);
|
|
34
36
|
|
|
35
37
|
const handleChange = (selectedVal) => {
|
|
36
38
|
setValue(selectedVal);
|
|
37
39
|
};
|
|
40
|
+
|
|
38
41
|
return (
|
|
39
42
|
<RichTextEditor
|
|
40
43
|
label="Test Text Editor"
|
|
41
|
-
required
|
|
44
|
+
required
|
|
42
45
|
onChange={handleChange}
|
|
43
46
|
content={value}
|
|
44
|
-
disabled
|
|
47
|
+
disabled
|
|
45
48
|
/>
|
|
46
49
|
);
|
|
47
50
|
};
|
|
48
|
-
TextEditor.storyName = "Rich Text Editor";
|
|
@@ -197,7 +197,7 @@ const RichTextEditor = ({
|
|
|
197
197
|
onChange(newValue);
|
|
198
198
|
},
|
|
199
199
|
},
|
|
200
|
-
[content]
|
|
200
|
+
[content],
|
|
201
201
|
);
|
|
202
202
|
return (
|
|
203
203
|
<div
|
|
@@ -245,20 +245,19 @@ const RichTextEditor = ({
|
|
|
245
245
|
{label}
|
|
246
246
|
</InputLabel>
|
|
247
247
|
{disabled ? (
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
)}
|
|
248
|
+
<p
|
|
249
|
+
data-testid={`${id}-value`}
|
|
250
|
+
aria-labelledby={label}
|
|
251
|
+
dangerouslySetInnerHTML={{
|
|
252
|
+
__html: content ? DOMPurify.sanitize(content) : "-",
|
|
253
|
+
}}
|
|
254
|
+
/>
|
|
255
|
+
) : (
|
|
256
|
+
<>
|
|
257
|
+
<MenuBar editor={editor} />
|
|
258
|
+
<EditorContent editor={editor} />
|
|
259
|
+
</>
|
|
260
|
+
)}
|
|
262
261
|
</div>
|
|
263
262
|
);
|
|
264
263
|
};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import Search from "./index";
|
|
3
|
-
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
3
|
|
|
5
4
|
export default {
|
|
6
5
|
title: "Search",
|
|
7
6
|
component: Search,
|
|
8
|
-
decorators: [withKnobs],
|
|
9
7
|
};
|
|
10
8
|
|
|
11
9
|
export const ExampleSearch = () => (
|
|
@@ -13,8 +11,8 @@ export const ExampleSearch = () => (
|
|
|
13
11
|
id="Example id"
|
|
14
12
|
name="Example name"
|
|
15
13
|
placeholder="Example placeholder"
|
|
16
|
-
inputAriaLabel="Example input
|
|
17
|
-
buttonAriaLabel="Example button
|
|
14
|
+
inputAriaLabel="Example input aria-label"
|
|
15
|
+
buttonAriaLabel="Example button aria-label"
|
|
18
16
|
/>
|
|
19
17
|
);
|
|
20
18
|
|