@madie/madie-design-system 1.2.61 → 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.
Files changed (118) hide show
  1. package/.eslintrc.js +1 -1
  2. package/.storybook/.babelrc +2 -1
  3. package/.storybook/main.js +3 -11
  4. package/components/AutoComplete/AutoComplete.jsx +1 -1
  5. package/components/Button/Button.stories.js +0 -2
  6. package/components/DateField/DateField.jsx +2 -2
  7. package/components/DateField/DateField.stories.jsx +23 -10
  8. package/components/DateTimeField/DateTimeField.jsx +6 -2
  9. package/components/DateTimeField/DateTimeField.stories.jsx +29 -19
  10. package/components/Instant/Instant.stories.js +14 -6
  11. package/components/MadieAlert/MadieAlert.stories.js +35 -29
  12. package/components/MadieAlert/index.jsx +5 -5
  13. package/components/MadieConfirmDialog/MadieConfirmDialog.stories.js +17 -27
  14. package/components/MadieDeleteDialog/MadieDeleteDialog.stories.js +9 -18
  15. package/components/MadieDialog/MadieDialog.stories.js +45 -116
  16. package/components/MadieDialog/index.jsx +4 -2
  17. package/components/MadieDiscardDialog/MadieDiscardDialog.stories.js +5 -7
  18. package/components/MadieSpinner/MadieSpinner.stories.js +1 -3
  19. package/components/MadieTooltip/MadieTooltip.stories.js +7 -2
  20. package/components/Modal/Modal.stories.js +18 -89
  21. package/components/NotificationBanner/NotificationBanner.stories.js +17 -11
  22. package/components/NotificationBanner/index.js +3 -3
  23. package/components/NumberInput/NumberInput.stories.js +51 -63
  24. package/components/Popover/Popover.stories.js +6 -14
  25. package/components/Popover/index.js +2 -2
  26. package/components/RadioButton/RadioButton.jsx +4 -2
  27. package/components/RadioButton/RadioButton.stories.jsx +6 -2
  28. package/components/ReadOnlyTextField/ReadOnlyTextField.stories.js +4 -3
  29. package/components/ReadOnlyTextField/index.jsx +1 -1
  30. package/components/RichTextEditor/RichTextEditor.stories.js +10 -8
  31. package/components/RichTextEditor/index.jsx +14 -15
  32. package/components/Search/Search.stories.js +2 -4
  33. package/components/Select/Select.stories.js +59 -160
  34. package/components/Select/index.jsx +1 -1
  35. package/components/Tabs/Tabs.stories.js +78 -210
  36. package/components/TextArea/TextArea.stories.js +88 -108
  37. package/components/TextArea/index.jsx +1 -1
  38. package/components/TextField/TextField.stories.js +101 -124
  39. package/components/TextField/index.jsx +1 -1
  40. package/components/TimeField/TimeField.stories.js +18 -8
  41. package/components/Toast/Toast.stories.js +42 -102
  42. package/components/TruncateText/TruncateText.stories.js +22 -17
  43. package/components/hooks/useGetConfig.js +2 -2
  44. package/components/index.js +0 -24
  45. package/dist/browser.js +1 -1
  46. package/dist/index.js +1 -1
  47. package/dist/react/index.js +182 -51
  48. package/dist/react/index.js.LICENSE.txt +27 -24
  49. package/dist/react/index.js.map +1 -1
  50. package/eslint.config.js +56 -0
  51. package/index.js +7 -9
  52. package/package.json +43 -75
  53. package/test/components/Accordion.test.js +1 -1
  54. package/test/components/AutoComplete.test.js +11 -6
  55. package/test/components/Button.test.js +7 -3
  56. package/test/components/DateField.test.js +26 -30
  57. package/test/components/DateTimeField.test.js +22 -26
  58. package/test/components/Instant.test.js +1 -1
  59. package/test/components/MadieAlert.test.js +22 -22
  60. package/test/components/MadieConfirmDialog.test.js +42 -64
  61. package/test/components/MadieDeleteDialog.test.js +51 -69
  62. package/test/components/MadieDialog.test.js +13 -13
  63. package/test/components/MadieDiscardDialog.test.js +28 -45
  64. package/test/components/MadieSpinner.test.js +12 -17
  65. package/test/components/Modal.test.js +115 -0
  66. package/test/components/Pagination.test.js +2 -2
  67. package/test/components/RadioButton.test.js +7 -7
  68. package/test/components/ReadOnlyTextField.test.js +4 -2
  69. package/test/components/RichTextEditor.test.js +90 -6
  70. package/test/components/Search.test.js +75 -0
  71. package/test/components/Select.test.js +97 -107
  72. package/test/components/Tabs.test.js +22 -24
  73. package/test/components/TextArea.test.js +78 -92
  74. package/test/components/TextField.test.js +128 -147
  75. package/test/components/Toast.test.js +67 -78
  76. package/test/components/TruncateText.test.js +75 -0
  77. package/test/components/index.test.js +23 -0
  78. package/webpack.config.js +0 -1
  79. package/.eslintignore +0 -5
  80. package/components/Alert/Alert.stories.js +0 -70
  81. package/components/Alert/index.js +0 -55
  82. package/components/Breadcrumb/Breadcrumb.md +0 -28
  83. package/components/Breadcrumb/Breadcrumb.stories.js +0 -76
  84. package/components/Breadcrumb/index.js +0 -92
  85. package/components/CalloutBox/CalloutBox.stories.js +0 -94
  86. package/components/CalloutBox/index.js +0 -109
  87. package/components/Card/Card.stories.js +0 -163
  88. package/components/Card/index.js +0 -144
  89. package/components/Dropdown/Dropdown.stories.js +0 -94
  90. package/components/Dropdown/index.js +0 -85
  91. package/components/Error/Collapsible.jsx +0 -93
  92. package/components/Error/ErrorUI.jsx +0 -31
  93. package/components/Error/error.js +0 -26
  94. package/components/FlashNotification/FlashNotificationUI.jsx +0 -91
  95. package/components/FlashNotification/index.js +0 -30
  96. package/components/Footer/Footer.stories.js +0 -20
  97. package/components/Footer/FooterUI.jsx +0 -137
  98. package/components/Footer/LegacyFooterUI.jsx +0 -204
  99. package/components/Footer/SocialLinks.jsx +0 -63
  100. package/components/Footer/Subscribe.jsx +0 -34
  101. package/components/Footer/footer.js +0 -30
  102. package/components/Infotip/Infotip.jsx +0 -75
  103. package/components/Infotip/Infotip.stories.js +0 -52
  104. package/components/Infotip/InfotipIcon.jsx +0 -41
  105. package/components/Infotip/index.js +0 -3
  106. package/components/Link/Link.stories.js +0 -82
  107. package/components/Link/index.js +0 -61
  108. package/components/Spinner/index.js +0 -9
  109. package/components/TextInput/TextInput.stories.js +0 -118
  110. package/components/TextInput/index.js +0 -137
  111. package/components/Tooltip/Tooltip.jsx +0 -88
  112. package/components/Tooltip/Tooltip.stories.js +0 -80
  113. package/components/Tooltip/index.js +0 -3
  114. package/components/Tooltip/position.js +0 -76
  115. package/test/components/ErrorUI.test.js +0 -32
  116. package/test/components/FooterUI.test.js +0 -122
  117. package/test/components/Infotip.test.js +0 -76
  118. 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
- return (
24
- <Wrapper>
25
- <NumberInput id="basic-number-input" label="Demo number input" />
26
- </Wrapper>
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
- return (
32
- <Wrapper>
33
- <NumberInput
34
- id="basic-number-input"
35
- label="Demo number input"
36
- aria-label="Demo number input"
37
- placeholder="Type a number…"
38
- allowNegative={false}
39
- />
40
- </Wrapper>
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
- return (
46
- <Wrapper>
47
- <NumberInput
48
- id="basic-number-input"
49
- error={true}
50
- label="Demo number input"
51
- aria-label="Demo number input"
52
- placeholder="Type a number…"
53
- helperText={"Please Enter a valid integer"}
54
- />
55
- </Wrapper>
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
- return (
61
- <Wrapper>
62
- <NumberInput
63
- id="basic-number-input"
64
- label="Demo number input"
65
- aria-label="Demo number input"
66
- placeholder="Type a number…"
67
- disabled={true}
68
- />
69
- </Wrapper>
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
- return (
75
- <Wrapper>
76
- <NumberInput
77
- id="basic-number-input"
78
- label="Demo number input"
79
- aria-label="Demo number input"
80
- placeholder="Type a number…"
81
- tooltipText={"Provides information"}
82
- />
83
- </Wrapper>
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={(e) => handleOpen(e)}>
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: `edit-measure-1`,
37
+ dataTestId: "edit-measure-1",
46
38
  }}
47
39
  otherSelectOptionProps={[
48
40
  {
49
41
  label: "Export",
50
42
  toImplementFunction: zipData,
51
- dataTestId: `export-measure-1`,
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(option => String(option.value) === rest.value);
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={`helper-text`} error={true}>
77
+ <FormHelperText data-testid="helper-text" error>
77
78
  An error message
78
79
  </FormHelperText>
79
80
  }
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import {FormControl, TextareaAutosize} from "@mui/material";
2
+ import { FormControl, TextareaAutosize } from "@mui/material";
3
3
  import InputLabel from "../InputLabel";
4
4
  import PropTypes from "prop-types";
5
5
  import _ from "lodash";
@@ -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={"Test Text Editor"}
22
- required={true}
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={true}
44
+ required
42
45
  onChange={handleChange}
43
46
  content={value}
44
- disabled={true}
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
- <p
249
- data-testid={`${id}-value`}
250
- aria-labelledby={label}
251
- dangerouslySetInnerHTML={{
252
- __html: content ? DOMPurify.sanitize(content) : "-",
253
- }}
254
- />
255
-
256
- ) : (
257
- <>
258
- <MenuBar editor={editor}/>
259
- <EditorContent editor={editor}/>
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 arial-label"
17
- buttonAriaLabel="Example button arial-label"
14
+ inputAriaLabel="Example input aria-label"
15
+ buttonAriaLabel="Example button aria-label"
18
16
  />
19
17
  );
20
18