@madie/madie-design-system 1.2.62 → 2.0.1

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 (156) hide show
  1. package/.babelrc +14 -2
  2. package/.eslintrc.js +1 -1
  3. package/.storybook/.babelrc +2 -1
  4. package/.storybook/main.js +3 -11
  5. package/.storybook/preview.js +1 -1
  6. package/components/Accordion/index.jsx +32 -36
  7. package/components/AutoComplete/AutoComplete.jsx +2 -17
  8. package/components/Button/Button.stories.js +0 -7
  9. package/components/Button/index.js +34 -44
  10. package/components/DateField/DateField.jsx +2 -15
  11. package/components/DateField/DateField.stories.jsx +23 -10
  12. package/components/DateTimeField/DateTimeField.jsx +7 -11
  13. package/components/DateTimeField/DateTimeField.stories.jsx +29 -19
  14. package/components/InputLabel/index.jsx +1 -6
  15. package/components/Instant/Instant.stories.js +14 -6
  16. package/components/Instant/index.jsx +0 -16
  17. package/components/Link/index.js +14 -33
  18. package/components/MadieAlert/MadieAlert.stories.js +35 -29
  19. package/components/MadieAlert/index.jsx +5 -44
  20. package/components/MadieConfirmDialog/MadieConfirmDialog.stories.js +17 -32
  21. package/components/MadieConfirmDialog/index.jsx +0 -8
  22. package/components/MadieDeleteDialog/MadieDeleteDialog.stories.js +9 -24
  23. package/components/MadieDeleteDialog/index.jsx +0 -7
  24. package/components/MadieDialog/MadieDialog.stories.js +45 -121
  25. package/components/MadieDialog/index.jsx +4 -23
  26. package/components/MadieDiscardDialog/MadieDiscardDialog.stories.js +5 -12
  27. package/components/MadieDiscardDialog/index.jsx +0 -7
  28. package/components/MadieSpinner/MadieSpinner.stories.js +1 -9
  29. package/components/MadieSpinner/index.jsx +0 -5
  30. package/components/MadieTooltip/MadieTooltip.stories.js +7 -2
  31. package/components/MadieTooltip/index.jsx +0 -6
  32. package/components/MadieTooltipIcon/index.jsx +0 -5
  33. package/components/Modal/Modal.jsx +31 -43
  34. package/components/Modal/Modal.stories.js +18 -89
  35. package/components/Modal/index.jsx +6 -8
  36. package/components/NumberInput/NumberInput.stories.js +50 -67
  37. package/components/NumberInput/index.jsx +0 -13
  38. package/components/Pagination/index.jsx +0 -17
  39. package/components/Popover/Popover.stories.js +6 -14
  40. package/components/Popover/index.js +0 -23
  41. package/components/RadioButton/RadioButton.jsx +5 -15
  42. package/components/RadioButton/RadioButton.stories.jsx +6 -2
  43. package/components/ReadOnlyTextField/ReadOnlyTextField.stories.js +3 -8
  44. package/components/ReadOnlyTextField/index.jsx +1 -9
  45. package/components/RichTextEditor/RichTextEditor.stories.js +10 -8
  46. package/components/RichTextEditor/index.jsx +14 -30
  47. package/components/SanitizedContent/index.jsx +0 -8
  48. package/components/Search/Search.stories.js +2 -4
  49. package/components/Search/index.js +26 -40
  50. package/components/Select/Select.stories.js +59 -164
  51. package/components/Select/index.jsx +2 -17
  52. package/components/Tabs/Tab.js +29 -25
  53. package/components/Tabs/TabPanel.js +15 -19
  54. package/components/Tabs/Tabs.stories.js +43 -211
  55. package/components/Tabs/index.js +10 -28
  56. package/components/TextArea/TextArea.stories.js +87 -113
  57. package/components/TextArea/index.jsx +2 -14
  58. package/components/TextField/TextField.stories.js +100 -129
  59. package/components/TextField/index.jsx +2 -17
  60. package/components/TimeField/TimeField.jsx +0 -10
  61. package/components/TimeField/TimeField.stories.js +18 -8
  62. package/components/Toast/Toast.stories.js +42 -102
  63. package/components/Toast/index.jsx +0 -14
  64. package/components/TruncateText/TruncateText.stories.js +22 -17
  65. package/components/TruncateText/index.js +0 -8
  66. package/components/hooks/useGetConfig.js +2 -2
  67. package/components/{index.js → index.mjs} +37 -57
  68. package/dist/index.js +3 -1
  69. package/dist/index.js.LICENSE.txt +16 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/react/index.html +1 -1
  72. package/dist/react/index.mjs +103 -0
  73. package/dist/react/{index.js.LICENSE.txt → index.mjs.LICENSE.txt} +3 -52
  74. package/dist/react/index.mjs.map +1 -0
  75. package/dist/react/package.json +1 -0
  76. package/eslint.config.cjs +59 -0
  77. package/index.js +7 -9
  78. package/jest.config.mjs +10 -0
  79. package/lib/Chevron.jsx +2 -10
  80. package/package.json +57 -82
  81. package/styles/_main.scss +4 -3
  82. package/test/components/Accordion.test.js +1 -1
  83. package/test/components/AutoComplete.test.js +11 -6
  84. package/test/components/Button.test.js +13 -19
  85. package/test/components/DateField.test.js +25 -29
  86. package/test/components/DateTimeField.test.js +21 -25
  87. package/test/components/Instant.test.js +1 -1
  88. package/test/components/MadieAlert.test.js +22 -22
  89. package/test/components/MadieConfirmDialog.test.js +42 -64
  90. package/test/components/MadieDeleteDialog.test.js +51 -69
  91. package/test/components/MadieDialog.test.js +13 -13
  92. package/test/components/MadieDiscardDialog.test.js +28 -45
  93. package/test/components/MadieSpinner.test.js +12 -17
  94. package/test/components/Modal.test.js +115 -0
  95. package/test/components/Pagination.test.js +2 -2
  96. package/test/components/RadioButton.test.js +7 -7
  97. package/test/components/ReadOnlyTextField.test.js +4 -2
  98. package/test/components/RichTextEditor.test.js +90 -6
  99. package/test/components/Search.test.js +75 -0
  100. package/test/components/Select.test.js +97 -107
  101. package/test/components/Tabs.test.js +22 -24
  102. package/test/components/TextArea.test.js +78 -92
  103. package/test/components/TextField.test.js +128 -147
  104. package/test/components/Toast.test.js +67 -78
  105. package/test/components/TruncateText.test.js +75 -0
  106. package/test/components/index.test.js +23 -0
  107. package/webpack.config.mjs +79 -0
  108. package/webpack.config.react.mjs +72 -0
  109. package/.eslintignore +0 -5
  110. package/components/Alert/Alert.stories.js +0 -70
  111. package/components/Alert/index.js +0 -55
  112. package/components/Breadcrumb/Breadcrumb.md +0 -28
  113. package/components/Breadcrumb/Breadcrumb.stories.js +0 -76
  114. package/components/Breadcrumb/index.js +0 -92
  115. package/components/CalloutBox/CalloutBox.stories.js +0 -94
  116. package/components/CalloutBox/index.js +0 -109
  117. package/components/Card/Card.stories.js +0 -163
  118. package/components/Card/index.js +0 -144
  119. package/components/Dropdown/Dropdown.stories.js +0 -94
  120. package/components/Dropdown/index.js +0 -85
  121. package/components/Error/Collapsible.jsx +0 -93
  122. package/components/Error/ErrorUI.jsx +0 -31
  123. package/components/Error/error.js +0 -26
  124. package/components/FlashNotification/FlashNotificationUI.jsx +0 -91
  125. package/components/FlashNotification/index.js +0 -30
  126. package/components/Footer/Footer.stories.js +0 -20
  127. package/components/Footer/FooterUI.jsx +0 -137
  128. package/components/Footer/LegacyFooterUI.jsx +0 -204
  129. package/components/Footer/SocialLinks.jsx +0 -63
  130. package/components/Footer/Subscribe.jsx +0 -34
  131. package/components/Footer/footer.js +0 -30
  132. package/components/Infotip/Infotip.jsx +0 -75
  133. package/components/Infotip/Infotip.stories.js +0 -52
  134. package/components/Infotip/InfotipIcon.jsx +0 -41
  135. package/components/Infotip/index.js +0 -3
  136. package/components/Link/Link.stories.js +0 -82
  137. package/components/NotificationBanner/NotificationBanner.stories.js +0 -23
  138. package/components/NotificationBanner/index.js +0 -279
  139. package/components/Spinner/index.js +0 -9
  140. package/components/TextInput/TextInput.stories.js +0 -118
  141. package/components/TextInput/index.js +0 -137
  142. package/components/Tooltip/Tooltip.jsx +0 -88
  143. package/components/Tooltip/Tooltip.stories.js +0 -80
  144. package/components/Tooltip/index.js +0 -3
  145. package/components/Tooltip/position.js +0 -76
  146. package/components/UnwrappedSpinner/index.js +0 -8
  147. package/dist/browser.js +0 -1
  148. package/dist/react/index.js +0 -185
  149. package/dist/react/index.js.map +0 -1
  150. package/jest.config.js +0 -17
  151. package/test/components/ErrorUI.test.js +0 -32
  152. package/test/components/FooterUI.test.js +0 -122
  153. package/test/components/Infotip.test.js +0 -76
  154. package/test/components/Tooltip.test.js +0 -147
  155. package/webpack.config.js +0 -124
  156. package/webpack.config.react.js +0 -104
@@ -1,14 +1,26 @@
1
1
  import React from "react";
2
- import PropTypes from "prop-types";
3
- import { withKnobs } from "@storybook/addon-knobs";
4
2
  import TextField from "./index";
5
3
  import { FormHelperText, IconButton, InputAdornment } from "@mui/material";
6
4
  import SearchIcon from "@mui/icons-material/Search";
7
5
  import ClearIcon from "@mui/icons-material/Clear";
6
+
8
7
  export default {
9
8
  title: "TextField",
10
9
  component: TextField,
11
- decorators: [withKnobs],
10
+ argTypes: {
11
+ disabled: { control: "boolean" },
12
+ error: { control: "boolean" },
13
+ required: { control: "boolean" },
14
+ size: {
15
+ control: { type: "select" },
16
+ options: ["small", "medium", "large"], // adjust if your component supports different sizes
17
+ },
18
+ helperText: { control: "text" },
19
+ label: { control: "text" },
20
+ placeholder: { control: "text" },
21
+ labelColor: { control: "color" },
22
+ value: { control: "text" },
23
+ },
12
24
  };
13
25
 
14
26
  const Wrapper = ({ children }) => (
@@ -16,143 +28,109 @@ const Wrapper = ({ children }) => (
16
28
  {children}
17
29
  </div>
18
30
  );
19
- Wrapper.propTypes = {
20
- className: PropTypes.string,
21
- children: PropTypes.node,
22
- };
23
31
 
24
- export const Textfield = () => (
32
+ const Template = (args) => (
25
33
  <Wrapper>
26
34
  <TextField
27
- placeholder="Placeholder"
28
- label="Text Label"
29
- id="measureName"
30
- inputProps={{ "data-testid": "measure-name-input" }}
31
- data-testid="measure-name-text-field"
32
- size="small"
35
+ {...args}
36
+ id={args.id || "measureName"}
37
+ inputProps={{
38
+ "data-testid": "measure-name-input",
39
+ ...args.inputProps,
40
+ }}
41
+ data-testid={args["data-testid"] || "measure-name-text-field"}
33
42
  />
34
43
  </Wrapper>
35
44
  );
36
45
 
37
- export const WithHelperText = () => (
38
- <Wrapper>
39
- <TextField
40
- placeholder="Placeholder"
41
- label="Text Label"
42
- id="measureName"
43
- inputProps={{ "data-testid": "measure-name-input" }}
44
- data-testid="measure-name-text-field"
45
- size="small"
46
- helperText={
47
- <FormHelperText data-testid={`helper-text`} error={false}>
48
- a descriptive message
49
- </FormHelperText>
50
- }
51
- />
52
- </Wrapper>
53
- );
46
+ export const Interactive = Template.bind({});
47
+ Interactive.args = {
48
+ size: "small",
49
+ disabled: false,
50
+ error: false,
51
+ required: false,
52
+ helperText: "",
53
+ label: "Text Label",
54
+ placeholder: "Placeholder",
55
+ labelColor: undefined,
56
+ value: "",
57
+ };
54
58
 
55
- export const Disabled = () => (
56
- <Wrapper>
59
+ export const WithHelperText = Template.bind({});
60
+ WithHelperText.args = {
61
+ ...Interactive.args,
62
+ helperText: (
63
+ <FormHelperText data-testid="helper-text" error={false}>
64
+ a descriptive message
65
+ </FormHelperText>
66
+ ),
67
+ };
68
+
69
+ export const Disabled = Template.bind({});
70
+ Disabled.args = {
71
+ ...Interactive.args,
72
+ disabled: true,
73
+ label: "Disabled Text Label",
74
+ };
75
+
76
+ export const Required = Template.bind({});
77
+ Required.args = {
78
+ ...Interactive.args,
79
+ required: true,
80
+ };
81
+
82
+ export const Error = Template.bind({});
83
+ Error.args = {
84
+ ...Interactive.args,
85
+ error: true,
86
+ required: true,
87
+ helperText: "An error message",
88
+ };
89
+
90
+ export const WithToolTipText = Template.bind({});
91
+ WithToolTipText.args = {
92
+ ...Interactive.args,
93
+ label: "Confirm New Version #",
94
+ tooltipText: "Input the new version # located to the left to confirm.",
95
+ helperText: "test",
96
+ id: "measure-name",
97
+ };
98
+
99
+ export const VariedHeights = () => (
100
+ <div
101
+ className="qpp-u-padding--16"
102
+ style={{ width: 900, marginBottom: "16px", display: "flex", gap: 16 }}
103
+ >
57
104
  <TextField
58
105
  placeholder="Placeholder"
59
- label="Disabled Text Label"
60
- id="measureName"
61
- inputProps={{ "data-testid": "measure-name-input" }}
62
- data-testid="measure-name-text-field"
106
+ required
107
+ label="Text Label"
108
+ id="measureName1"
109
+ inputProps={{ "data-testid": "measure-name-input1" }}
110
+ data-testid="measure-name-text-field1"
63
111
  size="small"
64
- disabled
112
+ helperText="An error message"
65
113
  />
66
- </Wrapper>
67
- );
68
-
69
- export const Required = () => (
70
- <Wrapper>
71
114
  <TextField
72
115
  placeholder="Placeholder"
73
- required
74
116
  label="Text Label"
75
- id="measureName"
76
- inputProps={{ "data-testid": "measure-name-input" }}
77
- data-testid="measure-name-text-field"
117
+ id="measureName2"
118
+ inputProps={{ "data-testid": "measure-name-input2" }}
119
+ data-testid="measure-name-text-field2"
78
120
  size="small"
121
+ helperText="An error message designed to take up a lot of space to see how we space multiple input elements within the same row in a responsive manner "
79
122
  />
80
- </Wrapper>
81
- );
82
-
83
- export const Error = () => (
84
- <Wrapper>
85
123
  <TextField
86
124
  placeholder="Placeholder"
87
125
  error
88
126
  required
89
127
  label="Text Label"
90
- id="measureName"
91
- inputProps={{ "data-testid": "measure-name-input" }}
92
- data-testid="measure-name-text-field"
128
+ id="measureName3"
129
+ inputProps={{ "data-testid": "measure-name-input3" }}
130
+ data-testid="measure-name-text-field3"
93
131
  size="small"
94
132
  helperText="An error message"
95
133
  />
96
- </Wrapper>
97
- );
98
-
99
- export const WithToolTipText = () => (
100
- <Wrapper>
101
- <TextField
102
- placeholder="Placeholder"
103
- label="Confirm New Version #"
104
- data-testid="measure-name-text-field"
105
- size="small"
106
- tooltipText="Input the new version # located to the left to confirm."
107
- helperText="test"
108
- id="measure-name"
109
- // previously this was how it was done. it could make more sense to only pass it an id and progrematically determine it. Example:
110
- // inputProps={{
111
- // "data-testid": "measure-name-input",
112
- // "aria-describedby":
113
- // "measure-name-helper-text measure-name-tooltip",
114
- // }}
115
- />
116
- </Wrapper>
117
- );
118
-
119
- export const VariedHeights = () => (
120
- <div
121
- className="qpp-u-padding--16"
122
- style={{ width: 900, marginBottom: "16px" }}
123
- >
124
- <div style={{ display: "flex", flexDirection: "row" }}>
125
- <TextField
126
- placeholder="Placeholder"
127
- required
128
- label="Text Label"
129
- id="measureName"
130
- inputProps={{ "data-testid": "measure-name-input" }}
131
- data-testid="measure-name-text-field"
132
- size="small"
133
- helperText="An error message"
134
- />
135
- <TextField
136
- placeholder="Placeholder"
137
- label="Text Label"
138
- id="measureName"
139
- inputProps={{ "data-testid": "measure-name-input" }}
140
- data-testid="measure-name-text-field"
141
- size="small"
142
- helperText="An error message designed to take up a lot of space to see how we space multiple input elements within the same row in a responsive manner "
143
- />
144
- <TextField
145
- placeholder="Placeholder"
146
- error
147
- required
148
- label="Text Label"
149
- id="measureName"
150
- inputProps={{ "data-testid": "measure-name-input" }}
151
- data-testid="measure-name-text-field"
152
- size="small"
153
- helperText="An error message"
154
- />
155
- </div>
156
134
  </div>
157
135
  );
158
136
 
@@ -176,7 +154,7 @@ export const WithLeftAndRightIcon = () => (
176
154
  ),
177
155
  endAdornment: (
178
156
  <InputAdornment position="end">
179
- <IconButton onClick="">
157
+ <IconButton onClick={() => {}}>
180
158
  <ClearIcon />
181
159
  </IconButton>
182
160
  </InputAdornment>
@@ -188,16 +166,9 @@ export const WithLeftAndRightIcon = () => (
188
166
  </Wrapper>
189
167
  );
190
168
 
191
- export const TextfieldDifferentLabel = () => (
192
- <Wrapper>
193
- <TextField
194
- placeholder="Placeholder"
195
- label="Text Label with different color"
196
- labelColor={"#1976d2"}
197
- id="measureName"
198
- inputProps={{ "data-testid": "measure-name-input" }}
199
- data-testid="measure-name-text-field"
200
- size="small"
201
- />
202
- </Wrapper>
203
- );
169
+ export const TextfieldDifferentLabel = Template.bind({});
170
+ TextfieldDifferentLabel.args = {
171
+ ...Interactive.args,
172
+ label: "Text Label with different color",
173
+ labelColor: "#1976d2",
174
+ };
@@ -6,8 +6,7 @@ import {
6
6
  } from "@mui/material";
7
7
  import InputLabel from "../InputLabel";
8
8
  import MadieToolTip from "../MadieTooltip";
9
- import PropTypes from "prop-types";
10
- import { ReadOnlyTextField } from "../index";
9
+ import ReadOnlyTextField from "../ReadOnlyTextField";
11
10
 
12
11
  const TextField = ({
13
12
  id,
@@ -32,7 +31,7 @@ const TextField = ({
32
31
  size="small"
33
32
  {...rest}
34
33
  />
35
- )
34
+ );
36
35
  }
37
36
  // get a copy of input props
38
37
  const newInputProps = { ...inputProps } || {};
@@ -204,18 +203,4 @@ const TextField = ({
204
203
  );
205
204
  };
206
205
 
207
- TextField.propTypes = {
208
- id: PropTypes.string,
209
- textFieldStyles: PropTypes.object,
210
- error: PropTypes.bool,
211
- helperText: PropTypes.string,
212
- required: PropTypes.bool,
213
- disabled: PropTypes.bool,
214
- placeholder: PropTypes.string, // expects placeholder objects of { name: value } and inserts into the render item function.
215
- label: PropTypes.string,
216
- tooltipText: PropTypes.string,
217
- inputProps: PropTypes.object,
218
- labelColor: PropTypes.string,
219
- maxLength: PropTypes.number,
220
- };
221
206
  export default TextField;
@@ -4,7 +4,6 @@ import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
4
4
  import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
5
5
  import InputLabel from "../InputLabel";
6
6
  import { kebabCase } from "lodash";
7
- import PropTypes from "prop-types";
8
7
 
9
8
  const timeFieldStyle = {
10
9
  width: "170px",
@@ -89,13 +88,4 @@ const TimeField = ({
89
88
  );
90
89
  };
91
90
 
92
- TimeField.propTypes = {
93
- label: PropTypes.string.isRequired,
94
- value: PropTypes.object,
95
- handleTimeChange: PropTypes.func.isRequired,
96
- disabled: PropTypes.bool,
97
- required: PropTypes.bool,
98
- error: PropTypes.string,
99
- };
100
-
101
91
  export default TimeField;
@@ -1,26 +1,36 @@
1
1
  import React, { useState } from "react";
2
2
  import TimeField from "./TimeField";
3
- import { withKnobs } from "@storybook/addon-knobs";
4
3
 
5
4
  export default {
6
5
  title: "TimeField",
7
6
  component: TimeField,
8
- decorators: [withKnobs],
7
+ argTypes: {
8
+ disabled: { control: "boolean" },
9
+ label: { control: "text" },
10
+ },
9
11
  };
10
- export const TimeFieldComponent = (args) => {
12
+
13
+ const Template = (args) => {
11
14
  const [value, setValue] = useState("");
12
- const handleTimeChange = (newValue, v) => {
15
+
16
+ const handleTimeChange = (newValue) => {
13
17
  console.log("Time changed: newValue = ", newValue);
14
18
  setValue(newValue);
15
19
  };
20
+
16
21
  return (
17
- <div className="qpp-u-padding--16">
22
+ <div className="qpp-u-padding--16" style={{ width: 300 }}>
18
23
  <TimeField
19
- disabled={false}
20
- label="Result Time"
21
- handleTimeChange={handleTimeChange}
24
+ {...args}
22
25
  value={value}
26
+ handleTimeChange={handleTimeChange}
23
27
  />
24
28
  </div>
25
29
  );
26
30
  };
31
+
32
+ export const Default = Template.bind({});
33
+ Default.args = {
34
+ disabled: false,
35
+ label: "Result Time",
36
+ };
@@ -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
  };
@@ -9,7 +9,6 @@ import { IconButton, Snackbar } from "@mui/material";
9
9
  import ClearIcon from "@mui/icons-material/Clear";
10
10
 
11
11
  import classNames from "classnames";
12
- import PropTypes from "prop-types";
13
12
 
14
13
  const Toast = ({
15
14
  toastType = "warning",
@@ -101,17 +100,4 @@ const Toast = ({
101
100
  );
102
101
  };
103
102
 
104
- Toast.propTypes = {
105
- toastType: PropTypes.string,
106
- open: PropTypes.bool,
107
- message: PropTypes.node,
108
- canClose: PropTypes.bool,
109
- onClose: PropTypes.func,
110
- autoHideDuration: PropTypes.number,
111
- testId: PropTypes.string,
112
- toastKey: PropTypes.string,
113
- toastProps: PropTypes.object,
114
- closeButtonProps: PropTypes.object,
115
- };
116
-
117
103
  export default Toast;
@@ -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
+ };
@@ -1,7 +1,6 @@
1
1
  import { IconButton } from "@mui/material";
2
2
  import React, { useState } from "react";
3
3
  import _ from "lodash";
4
- import PropTypes from "prop-types";
5
4
 
6
5
  const TruncateText = ({
7
6
  text,
@@ -42,11 +41,4 @@ const TruncateText = ({
42
41
  );
43
42
  };
44
43
 
45
- TruncateText.propTypes = {
46
- text: PropTypes.string,
47
- maxLength: PropTypes.number,
48
- dataTestId: PropTypes.string,
49
- fontSize: PropTypes.string,
50
- };
51
-
52
44
  export default TruncateText;
@@ -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
  })