@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,6 +1,5 @@
1
1
  import React from "react";
2
2
 
3
- import PropTypes from "prop-types";
4
3
  import { EditorContent, useEditor } from "@tiptap/react";
5
4
  import InputLabel from "../InputLabel";
6
5
 
@@ -197,7 +196,7 @@ const RichTextEditor = ({
197
196
  onChange(newValue);
198
197
  },
199
198
  },
200
- [content]
199
+ [content],
201
200
  );
202
201
  return (
203
202
  <div
@@ -245,36 +244,21 @@ const RichTextEditor = ({
245
244
  {label}
246
245
  </InputLabel>
247
246
  {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
- )}
247
+ <p
248
+ data-testid={`${id}-value`}
249
+ aria-labelledby={label}
250
+ dangerouslySetInnerHTML={{
251
+ __html: content ? DOMPurify.sanitize(content) : "-",
252
+ }}
253
+ />
254
+ ) : (
255
+ <>
256
+ <MenuBar editor={editor} />
257
+ <EditorContent editor={editor} />
258
+ </>
259
+ )}
262
260
  </div>
263
261
  );
264
262
  };
265
263
 
266
- RichTextEditor.propTypes = {
267
- id: PropTypes.string,
268
- error: PropTypes.bool,
269
- required: PropTypes.bool,
270
- label: PropTypes.string,
271
- onChange: PropTypes.func,
272
- content: PropTypes.any,
273
- disabled: PropTypes.bool,
274
- };
275
-
276
- MenuBar.propTypes = {
277
- editor: PropTypes.any,
278
- };
279
-
280
264
  export default RichTextEditor;
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
2
  import xss from "xss";
3
- import PropTypes from "prop-types";
4
3
 
5
4
  // Override the default allowed HTML tags
6
5
  const defaultAllowedTags = [
@@ -190,11 +189,4 @@ const SanitizedContent = ({
190
189
  );
191
190
  };
192
191
 
193
- SanitizedContent.propTypes = {
194
- html: PropTypes.string,
195
- customClassName: PropTypes.string,
196
- allowedTags: PropTypes.array,
197
- allowedAttributes: PropTypes.array,
198
- };
199
-
200
192
  export default SanitizedContent;
@@ -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
 
@@ -1,19 +1,33 @@
1
1
  import React from "react";
2
- import PropTypes from "prop-types";
3
2
  import SearchIcon from "@mui/icons-material/Search";
4
3
 
4
+ /**
5
+ * @param {{
6
+ * id?: string,
7
+ * name?: string,
8
+ * placeholder?: string,
9
+ * disableSearchBtn?: boolean,
10
+ * disabled?: boolean,
11
+ * inputValue?: string,
12
+ * onClick?: () => void,
13
+ * onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void,
14
+ * inputAriaLabel?: string,
15
+ * buttonAriaLabel?: string,
16
+ * inputWidth?: string
17
+ * }} props
18
+ */
5
19
  const Search = ({
6
- id,
7
- name,
8
- placeholder,
9
- disableSearchBtn,
10
- disabled,
11
- inputValue,
12
- onClick,
13
- onChange,
14
- inputAriaLabel,
15
- buttonAriaLabel,
16
- inputWidth,
20
+ id = "search-input",
21
+ name = "",
22
+ placeholder = "",
23
+ disableSearchBtn = false,
24
+ disabled = false,
25
+ inputValue = "",
26
+ onClick = () => null,
27
+ onChange = () => null,
28
+ inputAriaLabel = "",
29
+ buttonAriaLabel = "",
30
+ inputWidth = "auto",
17
31
  }) => {
18
32
  const inputStyle = {
19
33
  width: inputWidth,
@@ -55,32 +69,4 @@ const Search = ({
55
69
  );
56
70
  };
57
71
 
58
- Search.propTypes = {
59
- id: PropTypes.string,
60
- name: PropTypes.string,
61
- placeholder: PropTypes.string,
62
- disableSearchBtn: PropTypes.bool,
63
- disabled: PropTypes.bool,
64
- inputValue: PropTypes.string,
65
- onClick: PropTypes.func,
66
- onChange: PropTypes.func,
67
- inputAriaLabel: PropTypes.string,
68
- buttonAriaLabel: PropTypes.string,
69
- inputWidth: PropTypes.string,
70
- };
71
-
72
- Search.defaultProps = {
73
- id: "search-input",
74
- name: "",
75
- placeholder: "",
76
- disableSearchBtn: false,
77
- disabled: false,
78
- inputValue: "",
79
- onClick: () => null,
80
- onChange: () => null,
81
- inputAriaLabel: "",
82
- buttonAriaLabel: "",
83
- inputWidth: "auto",
84
- };
85
-
86
72
  export default Search;
@@ -1,13 +1,23 @@
1
1
  import React from "react";
2
- import PropTypes from "prop-types";
3
- import { withKnobs } from "@storybook/addon-knobs";
4
2
  import Select from "./index";
5
3
  import { MenuItem, Box } from "@mui/material";
6
4
 
7
5
  export default {
8
6
  title: "Select",
9
7
  component: Select,
10
- decorators: [withKnobs],
8
+ argTypes: {
9
+ defaultValue: { control: "text" },
10
+ placeHolder: { control: "object" },
11
+ label: { control: "text" },
12
+ id: { control: "text" },
13
+ size: {
14
+ control: { type: "select", options: ["small", "medium", "large"] },
15
+ },
16
+ disabled: { control: "boolean" },
17
+ required: { control: "boolean" },
18
+ error: { control: "boolean" },
19
+ helperText: { control: "text" },
20
+ },
11
21
  };
12
22
 
13
23
  const Wrapper = ({ children }) => (
@@ -18,145 +28,62 @@ const Wrapper = ({ children }) => (
18
28
  {children}
19
29
  </div>
20
30
  );
21
- Wrapper.propTypes = {
22
- className: PropTypes.string,
23
- children: PropTypes.node,
24
- };
25
31
 
26
32
  const options = [
27
33
  { key: "key1", value: "value1", testId: "testid1", name: "name1" },
28
34
  { key: "key2", value: "value2", testId: "testid2", name: "name2" },
29
35
  { key: "key3", value: "value2", testId: "testid3", name: "name3" },
30
36
  ];
31
- export const SelectWithLabel = () => (
32
- <Wrapper>
33
- <Select
34
- defaultValue=""
35
- placeHolder={{ name: "placeholder", value: "" }}
36
- label="Text Label"
37
- id="measureName"
38
- inputProps={{ "data-testid": "measure-name-input" }}
39
- data-testid="measure-name-text-field"
40
- size="small"
41
- options={options.map(({ key, value, testId, name }) => {
42
- return (
43
- <MenuItem
44
- key={key}
45
- value={value}
46
- data-testid={`option-${testId}`}
47
- >
48
- {name}
49
- </MenuItem>
50
- );
51
- })}
52
- />
53
- </Wrapper>
54
- );
55
37
 
56
- export const WithHelperText = () => (
57
- <Wrapper>
58
- <Select
59
- placeHolder={{ name: "placeholder", value: "" }}
60
- defaultValue=""
61
- label="Text Label"
62
- id="measureName"
63
- inputProps={{ "data-testid": "measure-name-input" }}
64
- data-testid="measure-name-text-field"
65
- size="small"
66
- helperText="A descriptive message"
67
- options={options.map(({ key, value, testId, name }) => {
68
- return (
69
- <MenuItem
70
- key={key}
71
- value={value}
72
- data-testid={`option-${testId}`}
73
- >
74
- {name}
75
- </MenuItem>
76
- );
77
- })}
78
- />
79
- </Wrapper>
80
- );
38
+ const renderedOptions = options.map(({ key, value, testId, name }) => (
39
+ <MenuItem key={key} value={value} data-testid={`option-${testId}`}>
40
+ {name}
41
+ </MenuItem>
42
+ ));
81
43
 
82
- export const Disabled = () => (
44
+ const Template = (args) => (
83
45
  <Wrapper>
84
- <Select
85
- placeHolder={{ name: "placeholder", value: "" }}
86
- defaultValue=""
87
- label="Text Label"
88
- id="measureName"
89
- inputProps={{ "data-testid": "measure-name-input" }}
90
- data-testid="measure-name-text-field"
91
- size="small"
92
- disabled
93
- options={options.map(({ key, value, testId, name }) => {
94
- return (
95
- <MenuItem
96
- key={key}
97
- value={value}
98
- data-testid={`option-${testId}`}
99
- >
100
- {name}
101
- </MenuItem>
102
- );
103
- })}
104
- />
46
+ <Select {...args} options={renderedOptions} />
105
47
  </Wrapper>
106
48
  );
107
49
 
108
- export const Required = () => (
109
- <Wrapper>
110
- <Select
111
- required
112
- placeHolder={{ name: "placeholder", value: "" }}
113
- defaultValue=""
114
- label="Text Label"
115
- id="measureName"
116
- inputProps={{ "data-testid": "measure-name-input" }}
117
- data-testid="measure-name-text-field"
118
- size="small"
119
- options={options.map(({ key, value, testId, name }) => {
120
- return (
121
- <MenuItem
122
- key={key}
123
- value={value}
124
- data-testid={`option-${testId}`}
125
- >
126
- {name}
127
- </MenuItem>
128
- );
129
- })}
130
- />
131
- </Wrapper>
132
- );
50
+ export const SelectWithLabel = Template.bind({});
51
+ SelectWithLabel.args = {
52
+ defaultValue: "",
53
+ placeHolder: { name: "placeholder", value: "" },
54
+ label: "Text Label",
55
+ id: "measureName",
56
+ size: "small",
57
+ disabled: false,
58
+ required: false,
59
+ error: false,
60
+ helperText: "",
61
+ };
133
62
 
134
- export const Error = () => (
135
- <Wrapper>
136
- <Select
137
- error
138
- placeHolder={{ name: "placeholder", value: "" }}
139
- defaultValue=""
140
- label="Text Label"
141
- id="measureName"
142
- inputProps={{ "data-testid": "measure-name-input" }}
143
- data-testid="measure-name-text-field"
144
- size="small"
145
- helperText="An error message An error message An error message"
146
- options={options.map(({ key, value, testId, name }) => {
147
- return (
148
- <MenuItem
149
- key={key}
150
- value={value}
151
- data-testid={`option-${testId}`}
152
- >
153
- {name}
154
- </MenuItem>
155
- );
156
- })}
157
- />
158
- </Wrapper>
159
- );
63
+ export const WithHelperText = Template.bind({});
64
+ WithHelperText.args = {
65
+ ...SelectWithLabel.args,
66
+ helperText: "A descriptive message",
67
+ };
68
+
69
+ export const Disabled = Template.bind({});
70
+ Disabled.args = {
71
+ ...SelectWithLabel.args,
72
+ disabled: true,
73
+ };
74
+
75
+ export const Required = Template.bind({});
76
+ Required.args = {
77
+ ...SelectWithLabel.args,
78
+ required: true,
79
+ };
80
+
81
+ export const Error = Template.bind({});
82
+ Error.args = {
83
+ ...SelectWithLabel.args,
84
+ error: true,
85
+ helperText: "An error message An error message An error message",
86
+ };
160
87
 
161
88
  export const VariedHeights = () => (
162
89
  <div
@@ -174,20 +101,9 @@ export const VariedHeights = () => (
174
101
  data-testid="measure-name-text-field"
175
102
  size="small"
176
103
  helperText="An error message"
177
- options={options.map(({ key, value, testId, name }) => {
178
- return (
179
- <MenuItem
180
- key={key}
181
- value={value}
182
- data-testid={`option-${testId}`}
183
- >
184
- {name}
185
- </MenuItem>
186
- );
187
- })}
104
+ options={renderedOptions}
188
105
  />
189
106
  <Select
190
- // error
191
107
  placeHolder={{ name: "placeholder", value: "" }}
192
108
  defaultValue=""
193
109
  label="Text Label"
@@ -196,20 +112,9 @@ export const VariedHeights = () => (
196
112
  data-testid="measure-name-text-field"
197
113
  size="small"
198
114
  helperText=""
199
- options={options.map(({ key, value, testId, name }) => {
200
- return (
201
- <MenuItem
202
- key={key}
203
- value={value}
204
- data-testid={`option-${testId}`}
205
- >
206
- {name}
207
- </MenuItem>
208
- );
209
- })}
115
+ options={renderedOptions}
210
116
  />
211
117
  <Select
212
- // error
213
118
  placeHolder={{ name: "placeholder", value: "" }}
214
119
  defaultValue=""
215
120
  label="Text Label"
@@ -218,17 +123,7 @@ export const VariedHeights = () => (
218
123
  data-testid="measure-name-text-field"
219
124
  size="small"
220
125
  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 "
221
- options={options.map(({ key, value, testId, name }) => {
222
- return (
223
- <MenuItem
224
- key={key}
225
- value={value}
226
- data-testid={`option-${testId}`}
227
- >
228
- {name}
229
- </MenuItem>
230
- );
231
- })}
126
+ options={renderedOptions}
232
127
  />
233
128
  </Box>
234
129
  </div>
@@ -3,8 +3,7 @@ import { FormControl, Select as MUISelect, MenuItem } from "@mui/material";
3
3
  import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
4
4
  import InputLabel from "../InputLabel";
5
5
  import FormHelperText from "@mui/material/FormHelperText";
6
- import PropTypes from "prop-types";
7
- import { ReadOnlyTextField } from "../index";
6
+ import ReadOnlyTextField from "../ReadOnlyTextField";
8
7
 
9
8
  const Select = ({
10
9
  placeHolder = undefined, // expects placeholder objects of { name: value } and inserts into the render item function.
@@ -34,7 +33,7 @@ const Select = ({
34
33
  size="small"
35
34
  {...rest}
36
35
  />
37
- )
36
+ );
38
37
  }
39
38
 
40
39
  const placehold = (
@@ -174,18 +173,4 @@ const Select = ({
174
173
  );
175
174
  };
176
175
 
177
- Select.propTypes = {
178
- id: PropTypes.string,
179
- placeHolder: PropTypes.shape({
180
- name: PropTypes.string,
181
- value: PropTypes.any,
182
- }), // expects placeholder objects of { name: value } and inserts into the render item function.
183
- required: PropTypes.bool,
184
- disabled: PropTypes.bool,
185
- error: PropTypes.bool,
186
- label: PropTypes.string,
187
- helperText: PropTypes.string,
188
- options: PropTypes.arrayOf(PropTypes.element),
189
- };
190
-
191
176
  export default Select;
@@ -1,5 +1,4 @@
1
1
  import React from "react";
2
- import PropTypes from "prop-types";
3
2
  import { Tab as MuiTab } from "@mui/material";
4
3
 
5
4
  const typeA = {
@@ -14,6 +13,7 @@ const typeA = {
14
13
  boxShadow: "0px 0px 0px 4px #CBE4FF",
15
14
  },
16
15
  };
16
+
17
17
  const typeB = {
18
18
  color: "#515151",
19
19
  "&:hover": {
@@ -25,6 +25,7 @@ const typeB = {
25
25
  background: "#fff",
26
26
  },
27
27
  };
28
+
28
29
  const typeC = {
29
30
  color: "#333",
30
31
  background: "#EDEDED",
@@ -38,7 +39,20 @@ const typeC = {
38
39
  },
39
40
  };
40
41
 
41
- const Tab = ({ type, orientation, size, ...rest }) => {
42
+ /**
43
+ * @param {{
44
+ * type?: "A" | "B" | "C" | "D",
45
+ * size?: "standard" | string,
46
+ * orientation?: "horizontal" | "vertical",
47
+ * [key: string]: any
48
+ * }} props
49
+ */
50
+ const Tab = ({
51
+ type = "A",
52
+ size = "standard",
53
+ orientation = "horizontal",
54
+ ...rest
55
+ }) => {
42
56
  const baseStyle = {
43
57
  height: size === "standard" ? "48px" : "60px",
44
58
  fontFamily: "Rubik, sans serif",
@@ -46,35 +60,25 @@ const Tab = ({ type, orientation, size, ...rest }) => {
46
60
  padding: size === "standard" ? "14.5px 24px" : "20.5px 24px",
47
61
  textTransform: "none",
48
62
  fontSize: "16px",
49
- alignItems: orientation === "vertical" && "flex-start",
63
+ alignItems: orientation === "vertical" ? "flex-start" : undefined,
50
64
  "&.Mui-disabled": {
51
65
  background: "#DDDDDD",
52
66
  color: "#717171 !important",
53
67
  },
54
68
  };
55
- const style = ((type) => {
56
- if (type === "A") {
57
- return { ...baseStyle, ...typeA };
58
- }
59
- if (type === "B" || type === "D") {
60
- return { ...baseStyle, ...typeB };
61
- }
62
- if (type === "C") {
63
- return { ...baseStyle, ...typeC };
64
- }
65
- })(type);
66
- return <MuiTab tabIndex={0} sx={style} {...rest} />;
67
- };
68
69
 
69
- Tab.propTypes = {
70
- orientation: PropTypes.string,
71
- type: PropTypes.oneOf(["A", "B", "C", "D"]),
72
- size: PropTypes.oneOf(["standard", "large"]),
73
- };
74
- Tab.defaultProps = {
75
- type: "A",
76
- size: "standard",
77
- onChange: null,
70
+ const variantStyles =
71
+ type === "A"
72
+ ? typeA
73
+ : type === "B" || type === "D"
74
+ ? typeB
75
+ : type === "C"
76
+ ? typeC
77
+ : {};
78
+
79
+ const style = { ...baseStyle, ...variantStyles };
80
+
81
+ return <MuiTab tabIndex={0} sx={style} {...rest} />;
78
82
  };
79
83
 
80
84
  export default Tab;
@@ -1,15 +1,25 @@
1
1
  import React from "react";
2
- import PropTypes from "prop-types";
3
2
 
3
+ /**
4
+ * @param {{
5
+ * children?: React.ReactNode,
6
+ * value?: number,
7
+ * id: string,
8
+ * index?: number,
9
+ * className?: string,
10
+ * disabled?: boolean
11
+ * }} props
12
+ */
4
13
  export const TabPanel = ({
5
14
  children,
6
- value,
15
+ value = 0,
16
+ index = 0,
7
17
  id,
8
- index,
9
- className,
10
- disabled,
18
+ className = "",
19
+ disabled = false,
11
20
  }) => {
12
21
  const classes = ["qpp-c-tabs__panel", className].filter(Boolean).join(" ");
22
+
13
23
  return (
14
24
  <div
15
25
  role="tabpanel"
@@ -24,18 +34,4 @@ export const TabPanel = ({
24
34
  );
25
35
  };
26
36
 
27
- TabPanel.propTypes = {
28
- children: PropTypes.node,
29
- className: PropTypes.string,
30
- index: PropTypes.number.isRequired,
31
- id: PropTypes.string,
32
- value: PropTypes.number.isRequired,
33
- disabled: PropTypes.bool,
34
- };
35
-
36
- TabPanel.defaultProps = {
37
- index: 0,
38
- value: 0,
39
- };
40
-
41
37
  export default TabPanel;