@madie/madie-design-system 1.2.59 → 1.2.61

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.
@@ -10,6 +10,8 @@ import PropTypes from "prop-types";
10
10
  import InputLabel from "../InputLabel";
11
11
  import CheckBoxOutlineBlankIcon from "@mui/icons-material/CheckBoxOutlineBlank";
12
12
  import CheckBoxIcon from "@mui/icons-material/CheckBox";
13
+ import { ReadOnlyTextField } from "../index";
14
+ import _ from "lodash";
13
15
 
14
16
  const autoCompleteStyles = {
15
17
  marginTop: "8px",
@@ -83,6 +85,19 @@ const AutoComplete = ({
83
85
  onChange,
84
86
  ...rest
85
87
  }) => {
88
+ if (disabled) {
89
+ return (
90
+ <ReadOnlyTextField
91
+ required={required}
92
+ label={label}
93
+ id={id}
94
+ size="small"
95
+ {...rest}
96
+ value={_.isEmpty(rest.value) ? "-" : rest.value}
97
+ />
98
+ )
99
+ }
100
+
86
101
  return (
87
102
  <FormControl error={error} fullWidth>
88
103
  <div
@@ -7,6 +7,7 @@ import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
7
7
  import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
8
8
  import dayjs from "dayjs";
9
9
  import utc from "dayjs/plugin/utc";
10
+ import { ReadOnlyTextField } from "../index";
10
11
 
11
12
  dayjs.extend(utc);
12
13
  dayjs.utc();
@@ -55,6 +56,19 @@ const DateField = ({
55
56
  textFieldSx = {},
56
57
  ...rest
57
58
  }) => {
59
+ if (disabled) {
60
+ return (
61
+ <ReadOnlyTextField
62
+ required={required}
63
+ label={label}
64
+ id={id}
65
+ size="small"
66
+ {...rest}
67
+ value={value ? dayjs.utc(value).format("YYYY/MM/DD") : "-"}
68
+ />
69
+ )
70
+ }
71
+
58
72
  if (containerSx === undefined || containerSx === null) {
59
73
  containerSx = {};
60
74
  }
@@ -16,7 +16,6 @@ export const DateFieldComponent = (args) => {
16
16
  return (
17
17
  <div className="qpp-u-padding--16">
18
18
  <DateField
19
- disabled={false}
20
19
  label="Status Date"
21
20
  handleDateChange={handleDateChange}
22
21
  value={value}
@@ -24,3 +23,19 @@ export const DateFieldComponent = (args) => {
24
23
  </div>
25
24
  );
26
25
  };
26
+
27
+ export const DateFieldComponentDisabled = (args) => {
28
+ const handleDateChange = (e) => {
29
+ console.log("Handle change triggered", e.target.value);
30
+ };
31
+ return (
32
+ <div className="qpp-u-padding--16">
33
+ <DateField
34
+ disabled
35
+ label="Status Date"
36
+ handleDateChange={handleDateChange}
37
+ value="2023-10-01"
38
+ />
39
+ </div>
40
+ );
41
+ };
@@ -8,6 +8,7 @@ import dayjs from "dayjs";
8
8
  import utc from "dayjs/plugin/utc";
9
9
 
10
10
  import { FormControl } from "@mui/material";
11
+ import { ReadOnlyTextField } from "../index";
11
12
 
12
13
  dayjs.extend(utc);
13
14
  dayjs.utc();
@@ -53,6 +54,16 @@ const DateTimeField = ({
53
54
  disabled,
54
55
  id = "default_dateTime-input",
55
56
  }) => {
57
+ if (disabled) {
58
+ return (
59
+ <ReadOnlyTextField
60
+ label={label}
61
+ value={dateTimeValue ? dayjs.utc(dateTimeValue).format("YYYY/MM/DD HH:mm A") : "-"}
62
+ id={id}
63
+ size="small"
64
+ />
65
+ )
66
+ }
56
67
  return (
57
68
  <FormControl>
58
69
  <LocalizationProvider dateAdapter={AdapterDayjs}>
@@ -25,3 +25,17 @@ export const TimeDateFieldComponent = (args) => {
25
25
  </div>
26
26
  );
27
27
  };
28
+
29
+ export const TimeDateFieldComponentDisabled = (args) => {
30
+ return (
31
+ <div className="qpp-u-padding--16">
32
+ <DateTimeField
33
+ disabled={true}
34
+ id="status_date_time"
35
+ label="Status Date/Time"
36
+ handleDateTimeChange={(e) => {}}
37
+ dateTimeValue="2023-10-01T12:00:00Z"
38
+ />
39
+ </div>
40
+ );
41
+ };
@@ -346,6 +346,7 @@ const MadieAlert = ({
346
346
  cursor: "pointer",
347
347
  }}
348
348
  data-testid="minimized-alert"
349
+ className="minimized-alert"
349
350
  onClick={(e) => {
350
351
  e.preventDefault();
351
352
  restoreAllAlerts();
@@ -8,6 +8,7 @@ import {
8
8
  } from "@mui/material";
9
9
  import PropTypes from "prop-types";
10
10
  import InputLabel from "../InputLabel";
11
+ import { ReadOnlyTextField } from "../index";
11
12
 
12
13
  const RadioButton = ({
13
14
  id,
@@ -20,6 +21,19 @@ const RadioButton = ({
20
21
  helperText,
21
22
  ...rest
22
23
  }) => {
24
+ if (disabled) {
25
+ const option = options?.find(option => String(option.value) === rest.value);
26
+ return (
27
+ <ReadOnlyTextField
28
+ required={required}
29
+ label={label}
30
+ id={id}
31
+ size="small"
32
+ {...rest}
33
+ value={option?.label}
34
+ />
35
+ )
36
+ }
23
37
  return (
24
38
  <FormControl error={error} fullWidth>
25
39
  <InputLabel
@@ -36,11 +36,17 @@ const TemplateRadioButton = (args) => {
36
36
  export const RadioButtonWithLabel = TemplateRadioButton.bind({});
37
37
  RadioButtonWithLabel.args = {};
38
38
 
39
- export const RadioButtonWithLabelDisabled = TemplateRadioButton.bind({});
40
- RadioButtonWithLabelDisabled.args = {
39
+ export const RadioButtonWithLabelDisabledWithNoValue = TemplateRadioButton.bind({});
40
+ RadioButtonWithLabelDisabledWithNoValue.args = {
41
41
  disabled: true,
42
42
  };
43
43
 
44
+ export const RadioButtonWithLabelDisabledWithValue = TemplateRadioButton.bind({});
45
+ RadioButtonWithLabelDisabledWithValue.args = {
46
+ disabled: true,
47
+ value: "options 3",
48
+ };
49
+
44
50
  export const RadioButtonWithHelperText = TemplateRadioButton.bind({});
45
51
  RadioButtonWithHelperText.args = {
46
52
  helperText: "Helper text goes here",
@@ -27,24 +27,7 @@ export const Textfield = () => (
27
27
  inputProps={{ "data-testid": "measure-name-input" }}
28
28
  data-testid="measure-name-text-field"
29
29
  size="small"
30
- />
31
- </Wrapper>
32
- );
33
-
34
- export const WithHelperText = () => (
35
- <Wrapper>
36
- <ReadOnlyTextField
37
- placeholder="Placeholder"
38
- label="Text Label"
39
- id="measureName"
40
- inputProps={{ "data-testid": "measure-name-input" }}
41
- data-testid="measure-name-text-field"
42
- size="small"
43
- helperText={
44
- <FormHelperText data-testid={`helper-text`} error={false}>
45
- a descriptive message
46
- </FormHelperText>
47
- }
30
+ value="All Patient Encounters; Cancer Diagnosis; Chemo Administered; Chemotherapy Received during Last 14 days; Chemotherapy Received during Last 14 days - Encounter; Chemotherapy Received during Last 14 days - Medication; Chemotherapy Received during Last 14 days - Procedure; Denominator; Initial Population; Numerator; Patient Expired; SDE Ethnicity; SDE Payer; SDE Race; SDE Sex; Two Office Visits in Measurement Period"
48
31
  />
49
32
  </Wrapper>
50
33
  );
@@ -1,36 +1,22 @@
1
1
  import React from "react";
2
- import {
3
- FormControl,
4
- TextField as MUITextField,
5
- FormHelperText,
6
- } from "@mui/material";
2
+ import {FormControl, TextareaAutosize} from "@mui/material";
7
3
  import InputLabel from "../InputLabel";
8
4
  import PropTypes from "prop-types";
5
+ import _ from "lodash";
9
6
 
10
7
  const ReadOnlyTextField = ({
11
8
  id,
12
- error = false,
13
- helperText = undefined,
14
9
  required = false,
15
10
  disabled = false,
16
11
  label,
17
12
  ...rest
18
13
  }) => {
19
14
  return (
20
- <FormControl fullWidth error={error}>
21
- <div
22
- style={{
23
- width: 1,
24
- display: "flex",
25
- flexDirection: "column",
26
- flexGrow: 1,
27
- }}
28
- />
15
+ <FormControl fullWidth>
29
16
  <InputLabel
30
17
  disabled={disabled}
31
18
  shrink
32
19
  required={required}
33
- error={error}
34
20
  htmlFor={id}
35
21
  sx={[
36
22
  {
@@ -61,71 +47,31 @@ const ReadOnlyTextField = ({
61
47
  disabled && {
62
48
  color: "rgba(0,0,0,0.6)",
63
49
  },
64
- error && {
65
- color: "#AE1C1C !important",
66
- },
67
50
  ]}
68
51
  >
69
52
  {label}
70
53
  </InputLabel>
71
- {helperText && (
72
- <FormHelperText
73
- tabIndex={0}
74
- aria-live="polite"
75
- id={`${id}-helper-text`}
76
- data-testid={`${id}-helper-text`}
77
- sx={[
78
- {
79
- margin: "4px 0px 0px 0px",
80
- color: "#515151",
81
- lineHeight: 1,
82
- },
83
- error && {
84
- color: "#AE1C1C !important",
85
- },
86
- ]}
87
- >
88
- {helperText}
89
- </FormHelperText>
90
- )}
91
- <MUITextField
92
- sx={{
54
+ <TextareaAutosize
55
+ style={{
56
+ color: "#333",
57
+ fontFamily: "Rubik",
58
+ fontSize: "14px",
59
+ fontStyle: "normal",
60
+ fontWeight: 400,
61
+ lineHeight: "24px",
93
62
  border: "none",
94
- "& .MuiOutlinedInput-root": {
95
- "& > fieldset": {
96
- border: "none",
97
- },
98
- },
99
- "& .MuiInputBase-root": {
100
- height: "auto",
101
- },
102
- "& .MuiInputBase-input": {
103
- lineHeight: "19px",
104
- fontFamily: "Rubik",
105
- disableUnderline: true,
106
- fontSize: 16,
107
- padding: "9px 0px",
108
- color: "#333",
109
- "&::placeholder": {
110
- opacity: 1,
111
- color: "#333",
112
- },
113
- "&:focus": {
114
- border: "none",
115
- outline: "none",
116
- boxShadow: "none",
117
- },
118
- },
119
- }}
120
- InputProps={{
121
- readOnly: true,
63
+ resize: "none",
64
+ padding: "0px 0px",
65
+ outline: "none",
66
+ boxShadow: "none",
122
67
  }}
68
+ readOnly={true}
123
69
  disableUnderline={true}
124
70
  label={null}
125
- error={error}
126
71
  disabled={disabled}
127
72
  id={id}
128
73
  {...rest}
74
+ value={_.isEmpty(rest?.value) ? "-" : rest.value}
129
75
  />
130
76
  </FormControl>
131
77
  );
@@ -133,8 +79,6 @@ const ReadOnlyTextField = ({
133
79
 
134
80
  ReadOnlyTextField.propTypes = {
135
81
  id: PropTypes.string,
136
- error: PropTypes.bool,
137
- helperText: PropTypes.string,
138
82
  required: PropTypes.bool,
139
83
  disabled: PropTypes.bool,
140
84
  placeholder: PropTypes.string, // expects placeholder objects of { name: value } and inserts into the render item function.
@@ -4,6 +4,7 @@ import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
4
4
  import InputLabel from "../InputLabel";
5
5
  import FormHelperText from "@mui/material/FormHelperText";
6
6
  import PropTypes from "prop-types";
7
+ import { ReadOnlyTextField } from "../index";
7
8
 
8
9
  const Select = ({
9
10
  placeHolder = undefined, // expects placeholder objects of { name: value } and inserts into the render item function.
@@ -24,6 +25,18 @@ const Select = ({
24
25
  ],
25
26
  ...rest
26
27
  }) => {
28
+ if (disabled) {
29
+ return (
30
+ <ReadOnlyTextField
31
+ required={required}
32
+ label={label}
33
+ id={id}
34
+ size="small"
35
+ {...rest}
36
+ />
37
+ )
38
+ }
39
+
27
40
  const placehold = (
28
41
  <span style={{ color: "#717171" }}>
29
42
  {placeHolder?.name || "placeholder"}
@@ -49,7 +49,23 @@ export const WithHelperText = () => (
49
49
  </Wrapper>
50
50
  );
51
51
 
52
- export const Disabled = () => (
52
+ export const DisabledWithValue = () => (
53
+ <Wrapper>
54
+ <TextArea
55
+ placeholder="Placeholder"
56
+ label="Text Label"
57
+ id="measureName"
58
+ inputProps={{ "data-testid": "measure-name-input" }}
59
+ data-testid="measure-name-text-field"
60
+ size="small"
61
+ value="This is a disabled text area"
62
+ disabled
63
+ required
64
+ />
65
+ </Wrapper>
66
+ );
67
+
68
+ export const DisabledWithNoValue = () => (
53
69
  <Wrapper>
54
70
  <TextArea
55
71
  placeholder="Placeholder"
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import { FormControl, FormHelperText, TextareaAutosize } from "@mui/material";
3
3
  import InputLabel from "../InputLabel";
4
4
  import PropTypes from "prop-types";
5
+ import { ReadOnlyTextField } from "../index";
5
6
 
6
7
  const TextArea = ({
7
8
  id,
@@ -14,6 +15,17 @@ const TextArea = ({
14
15
  maxLength = undefined,
15
16
  ...rest
16
17
  }) => {
18
+ if (disabled) {
19
+ return (
20
+ <ReadOnlyTextField
21
+ required={required}
22
+ label={label}
23
+ id={id}
24
+ size="small"
25
+ {...rest}
26
+ />
27
+ )
28
+ }
17
29
  // coerce this to avoid issue passing props to dom.
18
30
  // text area autosize is deprecated and only takes style rules
19
31
  return (
@@ -7,6 +7,7 @@ import {
7
7
  import InputLabel from "../InputLabel";
8
8
  import MadieToolTip from "../MadieTooltip";
9
9
  import PropTypes from "prop-types";
10
+ import { ReadOnlyTextField } from "../index";
10
11
 
11
12
  const TextField = ({
12
13
  id,
@@ -22,6 +23,17 @@ const TextField = ({
22
23
  maxLength = undefined,
23
24
  ...rest
24
25
  }) => {
26
+ if (disabled) {
27
+ return (
28
+ <ReadOnlyTextField
29
+ required={required}
30
+ label={label}
31
+ id={id}
32
+ size="small"
33
+ {...rest}
34
+ />
35
+ )
36
+ }
25
37
  // get a copy of input props
26
38
  const newInputProps = { ...inputProps } || {};
27
39