@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.
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 +1 -1
  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 +25 -29
  57. package/test/components/DateTimeField.test.js +21 -25
  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,21 +1,31 @@
1
1
  import React, { useState } from "react";
2
- import { withKnobs } from "@storybook/addon-knobs";
3
2
  import Toast from "./index";
4
3
 
5
4
  export default {
6
5
  title: "Toast",
7
6
  component: Toast,
8
- decorators: [withKnobs],
7
+ argTypes: {
8
+ toastType: {
9
+ control: {
10
+ type: "select",
11
+ options: ["success", "warning", "info", "danger"],
12
+ },
13
+ },
14
+ message: { control: "text" },
15
+ autoHideDuration: { control: "number" },
16
+ },
9
17
  };
10
18
 
11
- export const SuccessToast = () => {
19
+ const Template = (args) => {
12
20
  const [toastOpen, setToastOpen] = useState(false);
21
+
13
22
  return (
14
23
  <div
15
24
  style={{
16
25
  height: "100vh",
17
26
  width: "100vw",
18
27
  backgroundColor: "#242424",
28
+ position: "relative",
19
29
  }}
20
30
  >
21
31
  <button
@@ -23,119 +33,49 @@ export const SuccessToast = () => {
23
33
  style={{
24
34
  position: "absolute",
25
35
  top: "50%",
26
- left: "calc(50% - 80px)",
36
+ left: "50%",
37
+ transform: "translate(-50%, -50%)",
38
+ padding: "8px 16px",
39
+ cursor: "pointer",
27
40
  }}
28
41
  >
29
- Simulate Success
42
+ Show Toast
30
43
  </button>
31
44
  <Toast
45
+ {...args}
32
46
  toastKey="toast-key"
33
- testId="success-toast"
34
- toastType="success"
47
+ testId={`${args.toastType}-toast`}
35
48
  open={toastOpen}
36
- message="An action has successfully been completed"
37
49
  onClose={() => setToastOpen(false)}
38
- autoHideDuration={3000}
39
50
  />
40
51
  </div>
41
52
  );
42
53
  };
43
54
 
44
- export const WarningToast = () => {
45
- const [toastOpen, setToastOpen] = useState(false);
46
- return (
47
- <div
48
- style={{
49
- height: "100vh",
50
- width: "100vw",
51
- backgroundColor: "#242424",
52
- }}
53
- >
54
- <button
55
- onClick={() => setToastOpen(true)}
56
- style={{
57
- position: "absolute",
58
- top: "50%",
59
- left: "calc(50% - 80px)",
60
- }}
61
- >
62
- Simulate Warning
63
- </button>
64
- <Toast
65
- toastKey="toast-key"
66
- toastType="warning"
67
- testId="warning-toast"
68
- open={toastOpen}
69
- message="Something has gone wrong. consider fixing before continuing"
70
- onClose={() => setToastOpen(false)}
71
- autoHideDuration={3000}
72
- />
73
- </div>
74
- );
55
+ export const SuccessToast = Template.bind({});
56
+ SuccessToast.args = {
57
+ toastType: "success",
58
+ message: "An action has successfully been completed",
59
+ autoHideDuration: 3000,
75
60
  };
76
61
 
77
- export const InfoToast = () => {
78
- const [toastOpen, setToastOpen] = useState(false);
79
- return (
80
- <div
81
- style={{
82
- height: "100vh",
83
- width: "100vw",
84
- backgroundColor: "#242424",
85
- }}
86
- >
87
- <button
88
- onClick={() => setToastOpen(true)}
89
- style={{
90
- position: "absolute",
91
- top: "50%",
92
- left: "calc(50% - 80px)",
93
- }}
94
- >
95
- Simulate Info
96
- </button>
97
- <Toast
98
- toastKey="toast-key"
99
- toastType="info"
100
- testId="info-toast"
101
- open={toastOpen}
102
- message="Some useful information"
103
- onClose={() => setToastOpen(false)}
104
- autoHideDuration={3000}
105
- />
106
- </div>
107
- );
62
+ export const WarningToast = Template.bind({});
63
+ WarningToast.args = {
64
+ toastType: "warning",
65
+ message: "Something has gone wrong. Consider fixing before continuing",
66
+ autoHideDuration: 3000,
108
67
  };
109
68
 
110
- export const DangerToast = () => {
111
- const [toastOpen, setToastOpen] = useState(false);
112
- return (
113
- <div
114
- style={{
115
- height: "100vh",
116
- width: "100vw",
117
- backgroundColor: "#242424",
118
- }}
119
- >
120
- <button
121
- onClick={() => setToastOpen(true)}
122
- style={{
123
- position: "absolute",
124
- top: "50%",
125
- left: "calc(50% - 80px)",
126
- }}
127
- >
128
- Simulate Danger
129
- </button>
130
- <Toast
131
- toastKey="toast-key"
132
- toastType="danger"
133
- testId="danger-toast"
134
- open={toastOpen}
135
- message="Something has gone wrong. Please try again"
136
- onClose={() => setToastOpen(false)}
137
- autoHideDuration={3000}
138
- />
139
- </div>
140
- );
69
+ export const InfoToast = Template.bind({});
70
+ InfoToast.args = {
71
+ toastType: "info",
72
+ message: "Some useful information",
73
+ autoHideDuration: 3000,
74
+ };
75
+
76
+ export const DangerToast = Template.bind({});
77
+ DangerToast.args = {
78
+ toastType: "danger",
79
+ message: "Something has gone wrong. Please try again",
80
+ autoHideDuration: 3000,
141
81
  };
@@ -1,25 +1,30 @@
1
1
  import * as React from "react";
2
- import { withKnobs } from "@storybook/addon-knobs";
3
2
  import TruncateText from "./index";
4
3
 
5
4
  export default {
6
5
  title: "Truncate Text",
7
6
  component: TruncateText,
8
- decorators: [withKnobs],
7
+ argTypes: {
8
+ text: { control: "text" },
9
+ maxLength: { control: { type: "number", min: 0 } },
10
+ dataTestId: { control: "text" },
11
+ fontSize: { control: "text" },
12
+ },
9
13
  };
10
14
 
11
- export const FullText = () => (
12
- <TruncateText
13
- text="Addressing Social Needs in the Inpatient Setting Part 4 of 4 Housing"
14
- maxLength={120}
15
- dataTestId={"measure-comments"}
16
- />
17
- );
18
- export const TruncatedText = () => (
19
- <TruncateText
20
- text="Addressing Social Needs in the Inpatient Setting Part 4 of 4 Housing Domain Addressing Social Needs in the Inpatient Setting Part 4 of 4 Housing Domain"
21
- maxLength={60}
22
- dataTestId={"measure-comments"}
23
- fontSize="1rem"
24
- />
25
- );
15
+ const Template = (args) => <TruncateText {...args} />;
16
+
17
+ export const FullText = Template.bind({});
18
+ FullText.args = {
19
+ text: "Addressing Social Needs in the Inpatient Setting Part 4 of 4 Housing",
20
+ maxLength: 120,
21
+ dataTestId: "measure-comments",
22
+ };
23
+
24
+ export const TruncatedText = Template.bind({});
25
+ TruncatedText.args = {
26
+ text: "Addressing Social Needs in the Inpatient Setting Part 4 of 4 Housing Domain Addressing Social Needs in the Inpatient Setting Part 4 of 4 Housing Domain",
27
+ maxLength: 60,
28
+ dataTestId: "measure-comments",
29
+ fontSize: "1rem",
30
+ };
@@ -22,7 +22,7 @@ const useGetConfig = ({
22
22
 
23
23
  useEffect(() => {
24
24
  const storageContent = JSON.parse(
25
- localStorage.getItem(localStorageName)
25
+ localStorage.getItem(localStorageName),
26
26
  );
27
27
  if (
28
28
  storageContent?.content &&
@@ -59,7 +59,7 @@ const useGetConfig = ({
59
59
 
60
60
  localStorage.setItem(
61
61
  localStorageName,
62
- JSON.stringify(storageItem)
62
+ JSON.stringify(storageItem),
63
63
  );
64
64
  setResult(storageItem);
65
65
  })
@@ -1,14 +1,8 @@
1
1
  import Accordion from "./Accordion";
2
- import Alert from "./Alert";
3
2
  import AutoComplete from "./AutoComplete/AutoComplete";
4
- import Breadcrumb from "./Breadcrumb";
5
3
  import Button, { TextButton } from "./Button";
6
- import CalloutBox from "./CalloutBox";
7
- import Card from "./Card";
8
4
  import DateField from "./DateField/DateField";
9
5
  import DateTimeField from "./DateTimeField/DateTimeField";
10
- import FlashNotification from "./FlashNotification/FlashNotificationUI";
11
- import Footer from "./Footer/FooterUI";
12
6
  import Instant from "./Instant";
13
7
  import InputLabel from "./InputLabel";
14
8
  import FormControlLabel from "./FormControlLabel";
@@ -27,20 +21,14 @@ import RadioButton from "./RadioButton/RadioButton";
27
21
  import ReadOnlyTextField from "./ReadOnlyTextField";
28
22
  import RichTextEditor from "./RichTextEditor";
29
23
  import Select from "./Select";
30
- import Spinner from "./UnwrappedSpinner";
31
24
  import TabPanel from "./Tabs/TabPanel";
32
25
  import Tabs from "./Tabs/index";
33
26
  import Tab from "./Tabs/Tab";
34
27
  import TextField from "./TextField";
35
28
  import TimeField from "./TimeField/TimeField";
36
29
  import TextArea from "./TextArea";
37
- import Tooltip from "./Tooltip";
38
30
  import Toast from "./Toast";
39
- import Infotip from "./Infotip";
40
31
  import Search from "./Search";
41
- import TextInput from "./TextInput";
42
- import Dropdown from "./Dropdown";
43
- import DSLink from "./Link";
44
32
  import NumberInput from "./NumberInput";
45
33
  import TruncateText from "./TruncateText/index";
46
34
  import theme from "../themes/actionCenterTheme.js";
@@ -128,20 +116,13 @@ const Icons = {
128
116
 
129
117
  export {
130
118
  Accordion,
131
- Alert,
132
119
  AutoComplete,
133
- Breadcrumb,
134
120
  Button,
135
- CalloutBox,
136
- Card,
137
121
  DateField,
138
122
  DateTimeField,
139
- FlashNotification,
140
- Footer,
141
123
  FormControlLabel,
142
124
  InputLabel,
143
125
  Icons,
144
- Infotip,
145
126
  Instant,
146
127
  Modal,
147
128
  MadieAlert,
@@ -160,19 +141,14 @@ export {
160
141
  RichTextEditor,
161
142
  Search,
162
143
  Select,
163
- Spinner,
164
144
  TabPanel,
165
145
  Tabs,
166
146
  Tab,
167
147
  TextButton,
168
- TextInput,
169
148
  TimeField,
170
149
  TextField,
171
150
  TextArea,
172
151
  Toast,
173
- Dropdown,
174
- Tooltip,
175
- DSLink,
176
152
  TruncateText,
177
153
  theme,
178
154
  };