@madie/madie-design-system 1.2.29 → 1.2.31

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 (77) hide show
  1. package/components/DateTimeField/DateTimeField.jsx +5 -9
  2. package/components/MadieDialog/MadieDialog.stories.js +29 -8
  3. package/components/MadieDialog/index.jsx +65 -66
  4. package/coverage/clover.xml +28 -25
  5. package/coverage/coverage-final.json +4 -4
  6. package/coverage/lcov-report/index.html +16 -16
  7. package/coverage/lcov-report/react/components/Accordion/index.html +1 -1
  8. package/coverage/lcov-report/react/components/Accordion/index.jsx.html +1 -1
  9. package/coverage/lcov-report/react/components/Button/index.html +1 -1
  10. package/coverage/lcov-report/react/components/Button/index.js.html +3 -3
  11. package/coverage/lcov-report/react/components/DateField/DateField.jsx.html +1 -1
  12. package/coverage/lcov-report/react/components/DateField/index.html +1 -1
  13. package/coverage/lcov-report/react/components/DateTimeField/DateTimeField.jsx.html +12 -24
  14. package/coverage/lcov-report/react/components/DateTimeField/index.html +5 -5
  15. package/coverage/lcov-report/react/components/Error/Collapsible.jsx.html +1 -1
  16. package/coverage/lcov-report/react/components/Error/ErrorUI.jsx.html +1 -1
  17. package/coverage/lcov-report/react/components/Error/error.js.html +1 -1
  18. package/coverage/lcov-report/react/components/Error/index.html +1 -1
  19. package/coverage/lcov-report/react/components/Footer/FooterUI.jsx.html +1 -1
  20. package/coverage/lcov-report/react/components/Footer/LegacyFooterUI.jsx.html +1 -1
  21. package/coverage/lcov-report/react/components/Footer/footer.js.html +1 -1
  22. package/coverage/lcov-report/react/components/Footer/index.html +1 -1
  23. package/coverage/lcov-report/react/components/Infotip/Infotip.jsx.html +1 -1
  24. package/coverage/lcov-report/react/components/Infotip/InfotipIcon.jsx.html +1 -1
  25. package/coverage/lcov-report/react/components/Infotip/index.html +1 -1
  26. package/coverage/lcov-report/react/components/Infotip/index.js.html +1 -1
  27. package/coverage/lcov-report/react/components/InputLabel/index.html +1 -1
  28. package/coverage/lcov-report/react/components/InputLabel/index.jsx.html +2 -2
  29. package/coverage/lcov-report/react/components/MadieAlert/index.html +1 -1
  30. package/coverage/lcov-report/react/components/MadieAlert/index.jsx.html +1 -1
  31. package/coverage/lcov-report/react/components/MadieDeleteDialog/index.html +1 -1
  32. package/coverage/lcov-report/react/components/MadieDeleteDialog/index.jsx.html +1 -1
  33. package/coverage/lcov-report/react/components/MadieDialog/index.html +11 -11
  34. package/coverage/lcov-report/react/components/MadieDialog/index.jsx.html +85 -88
  35. package/coverage/lcov-report/react/components/MadieDiscardDialog/index.html +1 -1
  36. package/coverage/lcov-report/react/components/MadieDiscardDialog/index.jsx.html +1 -1
  37. package/coverage/lcov-report/react/components/MadieSpinner/index.html +1 -1
  38. package/coverage/lcov-report/react/components/MadieSpinner/index.jsx.html +1 -1
  39. package/coverage/lcov-report/react/components/MadieTooltip/index.html +1 -1
  40. package/coverage/lcov-report/react/components/MadieTooltip/index.jsx.html +1 -1
  41. package/coverage/lcov-report/react/components/MadieTooltipIcon/index.html +1 -1
  42. package/coverage/lcov-report/react/components/MadieTooltipIcon/index.jsx.html +1 -1
  43. package/coverage/lcov-report/react/components/Pagination/index.html +1 -1
  44. package/coverage/lcov-report/react/components/Pagination/index.jsx.html +1 -1
  45. package/coverage/lcov-report/react/components/Popover/index.html +1 -1
  46. package/coverage/lcov-report/react/components/Popover/index.js.html +1 -1
  47. package/coverage/lcov-report/react/components/ReadOnlyTextField/index.html +1 -1
  48. package/coverage/lcov-report/react/components/ReadOnlyTextField/index.jsx.html +1 -1
  49. package/coverage/lcov-report/react/components/Select/index.html +1 -1
  50. package/coverage/lcov-report/react/components/Select/index.jsx.html +1 -1
  51. package/coverage/lcov-report/react/components/Tabs/Tab.js.html +1 -1
  52. package/coverage/lcov-report/react/components/Tabs/index.html +1 -1
  53. package/coverage/lcov-report/react/components/Tabs/index.js.html +1 -1
  54. package/coverage/lcov-report/react/components/TextArea/index.html +1 -1
  55. package/coverage/lcov-report/react/components/TextArea/index.jsx.html +1 -1
  56. package/coverage/lcov-report/react/components/TextField/index.html +1 -1
  57. package/coverage/lcov-report/react/components/TextField/index.jsx.html +1 -1
  58. package/coverage/lcov-report/react/components/Toast/index.html +1 -1
  59. package/coverage/lcov-report/react/components/Toast/index.jsx.html +1 -1
  60. package/coverage/lcov-report/react/components/Tooltip/Tooltip.jsx.html +1 -1
  61. package/coverage/lcov-report/react/components/Tooltip/index.html +1 -1
  62. package/coverage/lcov-report/react/components/Tooltip/index.js.html +1 -1
  63. package/coverage/lcov-report/react/components/Tooltip/position.js.html +1 -1
  64. package/coverage/lcov-report/react/index.html +1 -1
  65. package/coverage/lcov-report/react/index.js.html +1 -1
  66. package/coverage/lcov-report/react/lib/Chevron.jsx.html +1 -1
  67. package/coverage/lcov-report/react/lib/SvgComponents.jsx.html +1 -1
  68. package/coverage/lcov-report/react/lib/index.html +1 -1
  69. package/coverage/lcov.info +62 -47
  70. package/dist/browser.js +1 -1
  71. package/dist/index.js +1 -1
  72. package/dist/react/index.js +1 -1
  73. package/dist/react/index.js.map +1 -1
  74. package/package-lock.json +191 -115
  75. package/package.json +1 -1
  76. package/test/components/DateTimeField.test.js +3 -2
  77. package/test/components/MadieDialog.test.js +44 -0
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
2
  import PropTypes from "prop-types";
3
- import InputLabel from "../InputLabel";
4
3
  import TextField from "../TextField";
5
4
  import { DateTimePicker } from "@mui/x-date-pickers/DateTimePicker";
6
5
  import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
@@ -9,13 +8,12 @@ import dayjs from "dayjs";
9
8
  import utc from "dayjs/plugin/utc";
10
9
 
11
10
  import { FormControl } from "@mui/material";
12
- import { kebabCase } from "lodash";
13
11
 
14
12
  dayjs.extend(utc);
15
13
  dayjs.utc();
16
14
  export const dateTimeTextFieldStyle = {
17
15
  width: "240px",
18
- height: 40,
16
+ height: "40px",
19
17
  marginTop: "8px",
20
18
  "& .MuiOutlinedInput-notchedOutline": {
21
19
  border: "1px solid #8C8C8C",
@@ -43,6 +41,9 @@ export const dateTimeTextFieldStyle = {
43
41
  fontSize: 14,
44
42
  },
45
43
  },
44
+ "& .MuiInputBase-root": {
45
+ height: "40px",
46
+ },
46
47
  };
47
48
 
48
49
  const DateTimeField = ({
@@ -55,12 +56,6 @@ const DateTimeField = ({
55
56
  return (
56
57
  <FormControl>
57
58
  <LocalizationProvider dateAdapter={AdapterDayjs}>
58
- <InputLabel
59
- style={{ marginBottom: 0, height: 16 }}
60
- data-testId={`${kebabCase(label)}`}
61
- >
62
- {`${label}`}
63
- </InputLabel>
64
59
  <DateTimePicker
65
60
  value={dateTimeValue ? dayjs.utc(dateTimeValue) : null}
66
61
  onChange={handleDateTimeChange}
@@ -70,6 +65,7 @@ const DateTimeField = ({
70
65
  textField: {
71
66
  id: id, // textfield will delegate an input data-testid based off id
72
67
  sx: dateTimeTextFieldStyle,
68
+ label,
73
69
  },
74
70
  openPickerButton: {
75
71
  id: `${id}-open-picker-button`,
@@ -34,6 +34,21 @@ export const Dialog = () => {
34
34
 
35
35
  const [form, setForm] = useState(false);
36
36
  const [required, setRequired] = useState(false);
37
+ const [showDialogActions, setShowDialogActions] = useState(false);
38
+
39
+ const cancelButtonProps = showDialogActions
40
+ ? {
41
+ cancelText: "Discard Changes",
42
+ "data-testid": "cancel-button",
43
+ }
44
+ : undefined;
45
+ const continueButtonProps = showDialogActions
46
+ ? {
47
+ continueText: "Save",
48
+ "data-testid": "save-button",
49
+ }
50
+ : undefined;
51
+
37
52
  return (
38
53
  <div className="qpp-u-padding--16" style={{ width: 300 }}>
39
54
  <FormGroup>
@@ -57,6 +72,18 @@ export const Dialog = () => {
57
72
  }
58
73
  label="Required"
59
74
  />
75
+ <FormControlLabel
76
+ control={
77
+ <Switch
78
+ checked={showDialogActions}
79
+ onChange={(e) =>
80
+ setShowDialogActions(e.target.checked)
81
+ }
82
+ name="actions"
83
+ />
84
+ }
85
+ label="actions"
86
+ />
60
87
  </FormGroup>
61
88
  <Button variant="cyan" onClick={() => setOpen(true)}>
62
89
  open Dialog
@@ -70,14 +97,8 @@ export const Dialog = () => {
70
97
  onClose,
71
98
  onSubmit: onContinue,
72
99
  }}
73
- cancelButtonProps={{
74
- cancelText: "Discard Changes",
75
- "data-testid": "cancel-button",
76
- }}
77
- continueButtonProps={{
78
- continueText: "Save",
79
- "data-testid": "save-button",
80
- }}
100
+ cancelButtonProps={cancelButtonProps}
101
+ continueButtonProps={continueButtonProps}
81
102
  >
82
103
  <div>
83
104
  <Select
@@ -29,6 +29,52 @@ const DraggablePaper = (props) => {
29
29
  );
30
30
  };
31
31
 
32
+ const Actions = ({ onClose, cancelButtonProps, continueButtonProps }) => {
33
+ const { cancelText, cancelIcon, ...otherCancelButtonProps } =
34
+ cancelButtonProps;
35
+ const { continueText, continueIcon, ...otherContinueButtonProps } =
36
+ continueButtonProps;
37
+ return (
38
+ <>
39
+ <Divider sx={{ borderColor: "#8c8c8c" }} />
40
+ <DialogActions
41
+ sx={{
42
+ padding: "16px",
43
+ "& >:not(:first-of-type)": {
44
+ marginLeft: "16px",
45
+ },
46
+ }}
47
+ >
48
+ {cancelButtonProps && (
49
+ <Button
50
+ variant="secondary"
51
+ onClick={onClose}
52
+ {...otherCancelButtonProps}
53
+ >
54
+ <span>
55
+ {cancelText}
56
+ {cancelIcon}
57
+ </span>
58
+ </Button>
59
+ )}
60
+ {continueButtonProps && (
61
+ <Button
62
+ className="qpp-c-button--cyan"
63
+ type="submit"
64
+ style={{ marginTop: 0 }}
65
+ {...otherContinueButtonProps}
66
+ >
67
+ <span>
68
+ {continueText}
69
+ {continueIcon}
70
+ </span>
71
+ </Button>
72
+ )}
73
+ </DialogActions>
74
+ </>
75
+ );
76
+ };
77
+
32
78
  const MadieDialog = ({
33
79
  /*
34
80
  Lets make a reusable component
@@ -66,10 +112,6 @@ const MadieDialog = ({
66
112
  showRequiredFieldMessage,
67
113
  ...otherDialogProps
68
114
  } = dialogProps;
69
- const { cancelText, cancelIcon, ...otherCancelButtonProps } =
70
- cancelButtonProps;
71
- const { continueText, continueIcon, ...otherContinueButonProps } =
72
- continueButtonProps;
73
115
 
74
116
  return (
75
117
  <Dialog
@@ -192,37 +234,13 @@ const MadieDialog = ({
192
234
 
193
235
  {children}
194
236
  </DialogContent>
195
- <Divider sx={{ borderColor: "#8c8c8c" }} />
196
- <DialogActions
197
- sx={{
198
- padding: "16px",
199
- "& >:not(:first-of-type)": {
200
- marginLeft: "16px",
201
- },
202
- }}
203
- >
204
- <Button
205
- variant="secondary"
206
- onClick={onClose}
207
- {...otherCancelButtonProps}
208
- >
209
- <span>
210
- {cancelText}
211
- {cancelIcon}
212
- </span>
213
- </Button>
214
- <Button
215
- className="qpp-c-button--cyan"
216
- type="submit"
217
- style={{ marginTop: 0 }}
218
- {...otherContinueButonProps}
219
- >
220
- <span>
221
- {continueText}
222
- {continueIcon}
223
- </span>
224
- </Button>
225
- </DialogActions>
237
+ {(cancelButtonProps || continueButtonProps) && (
238
+ <Actions
239
+ onClose={onClose}
240
+ continueButtonProps={continueButtonProps}
241
+ cancelButtonProps={cancelButtonProps}
242
+ />
243
+ )}
226
244
  </form>
227
245
  ) : (
228
246
  <>
@@ -259,37 +277,13 @@ const MadieDialog = ({
259
277
  <DialogContent sx={{ padding: "32px" }}>
260
278
  {children}
261
279
  </DialogContent>
262
- <Divider sx={{ borderColor: "#8c8c8c" }} />
263
- <DialogActions
264
- sx={{
265
- padding: "16px",
266
- "& >:not(:first-of-type)": {
267
- marginLeft: "16px",
268
- },
269
- }}
270
- >
271
- <Button
272
- variant="secondary"
273
- onClick={onClose}
274
- {...otherCancelButtonProps}
275
- >
276
- <span>
277
- {cancelText}
278
- {cancelIcon}
279
- </span>
280
- </Button>
281
- <Button
282
- variant="cyan"
283
- type="submit"
284
- style={{ marginTop: 0 }}
285
- {...otherContinueButonProps}
286
- >
287
- <span>
288
- {continueText}
289
- {continueIcon}
290
- </span>
291
- </Button>
292
- </DialogActions>
280
+ {(cancelButtonProps || continueButtonProps) && (
281
+ <Actions
282
+ onClose={onClose}
283
+ continueButtonProps={continueButtonProps}
284
+ cancelButtonProps={cancelButtonProps}
285
+ />
286
+ )}
293
287
  </>
294
288
  )}
295
289
  </Dialog>
@@ -310,4 +304,9 @@ DraggablePaper.propTypes = {
310
304
  children: PropTypes.object,
311
305
  };
312
306
 
307
+ Actions.propTypes = {
308
+ onClose: PropTypes.any,
309
+ cancelButtonProps: PropTypes.object,
310
+ continueButtonProps: PropTypes.object,
311
+ };
313
312
  export default MadieDialog;
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1724262722044" clover="3.2.0">
3
- <project timestamp="1724262722044" name="All files">
4
- <metrics statements="393" coveredstatements="379" conditionals="308" coveredconditionals="265" methods="113" coveredmethods="106" elements="814" coveredelements="750" complexity="0" loc="393" ncloc="393" packages="26" files="36" classes="36"/>
2
+ <coverage generated="1726059836699" clover="3.2.0">
3
+ <project timestamp="1726059836700" name="All files">
4
+ <metrics statements="396" coveredstatements="382" conditionals="318" coveredconditionals="274" methods="114" coveredmethods="107" elements="828" coveredelements="763" complexity="0" loc="396" ncloc="396" packages="26" files="36" classes="36"/>
5
5
  <package name="react">
6
6
  <metrics statements="3" coveredstatements="1" conditionals="0" coveredconditionals="0" methods="2" coveredmethods="0"/>
7
7
  <file name="index.js" path="/home/runner/work/madie-design-system/madie-design-system/react/index.js">
@@ -46,11 +46,11 @@
46
46
  <line num="17" count="4" type="stmt"/>
47
47
  <line num="28" count="28" type="stmt"/>
48
48
  <line num="30" count="28" type="cond" truecount="2" falsecount="0"/>
49
- <line num="31" count="19" type="stmt"/>
49
+ <line num="31" count="18" type="stmt"/>
50
50
  <line num="33" count="28" type="cond" truecount="2" falsecount="0"/>
51
51
  <line num="34" count="1" type="stmt"/>
52
52
  <line num="36" count="28" type="cond" truecount="2" falsecount="0"/>
53
- <line num="37" count="2" type="stmt"/>
53
+ <line num="37" count="13" type="stmt"/>
54
54
  <line num="40" count="28" type="cond" truecount="2" falsecount="0"/>
55
55
  <line num="41" count="1" type="stmt"/>
56
56
  <line num="52" count="27" type="stmt"/>
@@ -85,15 +85,15 @@
85
85
  </file>
86
86
  </package>
87
87
  <package name="react.components.DateTimeField">
88
- <metrics statements="6" coveredstatements="6" conditionals="3" coveredconditionals="2" methods="1" coveredmethods="1"/>
88
+ <metrics statements="6" coveredstatements="6" conditionals="3" coveredconditionals="1" methods="1" coveredmethods="1"/>
89
89
  <file name="DateTimeField.jsx" path="/home/runner/work/madie-design-system/madie-design-system/react/components/DateTimeField/DateTimeField.jsx">
90
- <metrics statements="6" coveredstatements="6" conditionals="3" coveredconditionals="2" methods="1" coveredmethods="1"/>
90
+ <metrics statements="6" coveredstatements="6" conditionals="3" coveredconditionals="1" methods="1" coveredmethods="1"/>
91
+ <line num="12" count="1" type="stmt"/>
92
+ <line num="13" count="1" type="stmt"/>
91
93
  <line num="14" count="1" type="stmt"/>
92
- <line num="15" count="1" type="stmt"/>
93
- <line num="16" count="1" type="stmt"/>
94
- <line num="48" count="1" type="stmt"/>
95
- <line num="55" count="1" type="stmt"/>
96
- <line num="85" count="1" type="stmt"/>
94
+ <line num="49" count="1" type="stmt"/>
95
+ <line num="56" count="1" type="stmt"/>
96
+ <line num="81" count="1" type="stmt"/>
97
97
  </file>
98
98
  </package>
99
99
  <package name="react.components.Error">
@@ -193,7 +193,7 @@
193
193
  <file name="index.jsx" path="/home/runner/work/madie-design-system/madie-design-system/react/components/InputLabel/index.jsx">
194
194
  <metrics statements="3" coveredstatements="3" conditionals="6" coveredconditionals="6" methods="1" coveredmethods="1"/>
195
195
  <line num="5" count="6" type="stmt"/>
196
- <line num="6" count="27" type="stmt"/>
196
+ <line num="6" count="26" type="stmt"/>
197
197
  <line num="48" count="6" type="stmt"/>
198
198
  </file>
199
199
  </package>
@@ -247,21 +247,24 @@
247
247
  </file>
248
248
  </package>
249
249
  <package name="react.components.MadieDialog">
250
- <metrics statements="12" coveredstatements="12" conditionals="6" coveredconditionals="5" methods="3" coveredmethods="3"/>
250
+ <metrics statements="15" coveredstatements="15" conditionals="16" coveredconditionals="15" methods="4" coveredmethods="4"/>
251
251
  <file name="index.jsx" path="/home/runner/work/madie-design-system/madie-design-system/react/components/MadieDialog/index.jsx">
252
- <metrics statements="12" coveredstatements="12" conditionals="6" coveredconditionals="5" methods="3" coveredmethods="3"/>
252
+ <metrics statements="15" coveredstatements="15" conditionals="16" coveredconditionals="15" methods="4" coveredmethods="4"/>
253
253
  <line num="17" count="3" type="stmt"/>
254
- <line num="18" count="12" type="stmt"/>
255
- <line num="20" count="12" type="stmt"/>
254
+ <line num="18" count="15" type="stmt"/>
255
+ <line num="20" count="14" type="stmt"/>
256
256
  <line num="32" count="3" type="stmt"/>
257
- <line num="68" count="18" type="stmt"/>
258
- <line num="70" count="18" type="stmt"/>
259
- <line num="72" count="18" type="stmt"/>
260
- <line num="74" count="18" type="stmt"/>
261
- <line num="94" count="1" type="stmt"/>
262
- <line num="95" count="1" type="stmt"/>
263
- <line num="299" count="3" type="stmt"/>
264
- <line num="309" count="3" type="stmt"/>
257
+ <line num="34" count="12" type="stmt"/>
258
+ <line num="36" count="12" type="stmt"/>
259
+ <line num="37" count="12" type="stmt"/>
260
+ <line num="78" count="3" type="stmt"/>
261
+ <line num="114" count="20" type="stmt"/>
262
+ <line num="116" count="20" type="stmt"/>
263
+ <line num="136" count="1" type="stmt"/>
264
+ <line num="137" count="1" type="stmt"/>
265
+ <line num="293" count="3" type="stmt"/>
266
+ <line num="303" count="3" type="stmt"/>
267
+ <line num="307" count="3" type="stmt"/>
265
268
  </file>
266
269
  </package>
267
270
  <package name="react.components.MadieDiscardDialog">