@madie/madie-design-system 1.0.36 → 1.0.38

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 (36) hide show
  1. package/components/AutoComplete/AutoComplete.jsx +54 -15
  2. package/components/AutoComplete/AutoComplete.stories.js +13 -0
  3. package/components/Select/Select.stories.js +79 -3
  4. package/components/Select/index.jsx +95 -45
  5. package/components/TextField/TextField.stories.js +38 -5
  6. package/components/TextField/index.jsx +61 -5
  7. package/dist/browser.js +1 -1
  8. package/dist/index.js +1 -1
  9. package/dist/react/index.js +19 -19
  10. package/dist/react/index.js.LICENSE.txt +9 -1
  11. package/dist/react/index.js.map +1 -1
  12. package/package.json +1 -1
  13. package/storybook-static/115.d30f56a6.iframe.bundle.js +2 -0
  14. package/storybook-static/{115.052877d9.iframe.bundle.js.LICENSE.txt → 115.d30f56a6.iframe.bundle.js.LICENSE.txt} +2 -2
  15. package/storybook-static/51.5c11732a.iframe.bundle.js +2 -0
  16. package/storybook-static/{51.33ed905d.iframe.bundle.js.LICENSE.txt → 51.5c11732a.iframe.bundle.js.LICENSE.txt} +0 -0
  17. package/storybook-static/51.a7049d5a5c3c2ef91c79.manager.bundle.js +2 -0
  18. package/storybook-static/{51.e7cc07022ab8980acd80.manager.bundle.js.LICENSE.txt → 51.a7049d5a5c3c2ef91c79.manager.bundle.js.LICENSE.txt} +0 -0
  19. package/storybook-static/533.3f094b15.iframe.bundle.js +103 -0
  20. package/storybook-static/{270.98f52535.iframe.bundle.js.LICENSE.txt → 533.3f094b15.iframe.bundle.js.LICENSE.txt} +1 -1
  21. package/storybook-static/533.3f094b15.iframe.bundle.js.map +1 -0
  22. package/storybook-static/658.d366724cc1e8334958f6.manager.bundle.js +2 -0
  23. package/storybook-static/{658.88b966648de6eea4ba47.manager.bundle.js.LICENSE.txt → 658.d366724cc1e8334958f6.manager.bundle.js.LICENSE.txt} +0 -0
  24. package/storybook-static/iframe.html +1 -1
  25. package/storybook-static/index.html +1 -1
  26. package/storybook-static/main.8ec673ea.iframe.bundle.js +1 -0
  27. package/storybook-static/project.json +1 -1
  28. package/storybook-static/{runtime~main.7307b17c.iframe.bundle.js → runtime~main.73716313.iframe.bundle.js} +1 -1
  29. package/storybook-static/{runtime~main.c221863e46a86c2b5e83.manager.bundle.js → runtime~main.76f0de5496e678d07142.manager.bundle.js} +1 -1
  30. package/storybook-static/115.052877d9.iframe.bundle.js +0 -2
  31. package/storybook-static/270.98f52535.iframe.bundle.js +0 -103
  32. package/storybook-static/270.98f52535.iframe.bundle.js.map +0 -1
  33. package/storybook-static/51.33ed905d.iframe.bundle.js +0 -2
  34. package/storybook-static/51.e7cc07022ab8980acd80.manager.bundle.js +0 -2
  35. package/storybook-static/658.88b966648de6eea4ba47.manager.bundle.js +0 -2
  36. package/storybook-static/main.807dbba6.iframe.bundle.js +0 -1
@@ -12,6 +12,7 @@ import CheckBoxOutlineBlankIcon from "@mui/icons-material/CheckBoxOutlineBlank";
12
12
  import CheckBoxIcon from "@mui/icons-material/CheckBox";
13
13
 
14
14
  const autoCompleteStyles = {
15
+ marginTop: "8px",
15
16
  borderRadius: "3px",
16
17
  height: 40,
17
18
  border: "1px solid #DDDDDD",
@@ -82,16 +83,68 @@ const AutoComplete = ({
82
83
  }) => {
83
84
  return (
84
85
  <FormControl error={error} fullWidth>
86
+ <div style={{ width: 1, display: "flex", flexDirection: "column", flexGrow: 1}}/>
85
87
  <InputLabel
86
88
  htmlFor={`${id}`}
87
89
  id={`${id}-label`}
88
90
  disabled={disabled}
89
91
  required={required}
90
92
  shrink
91
- error={error}
93
+ style={{marginBottom: 0, height: 16}} // force a heignt
94
+ sx={[
95
+ {
96
+ backgroundColor: "transparent",
97
+ display: "flex",
98
+ flexDirection: "row-reverse",
99
+ alignSelf: "baseline",
100
+ textTransform: "none",
101
+ // force it outside the select box
102
+ position: "initial",
103
+ transform: "translateX(0px) translateY(0px)",
104
+ fontFamily: "Rubik",
105
+ fontWeight: 500,
106
+ fontSize: 14,
107
+ color: "#333",
108
+ "& .MuiInputLabel-asterisk": {
109
+ color: "#AE1C1C !important",
110
+ marginRight: "3px !important", //this was
111
+ },
112
+ },
113
+ required && {
114
+ transform: "translateX(-12px) translateY(0px)",
115
+ "& .MuiInputLabel-asterisk": {
116
+ color: "#D92F2",
117
+ marginRight: "3px !important", //this was
118
+ },
119
+ },
120
+ disabled && {
121
+ color: "rgba(0,0,0,0.6)",
122
+ },
123
+ error && {
124
+ color: "#AE1C1C !important",
125
+ },
126
+ ]}
92
127
  >
93
128
  {label}
94
129
  </InputLabel>
130
+ {helperText && (<FormHelperText
131
+ tabIndex={0}
132
+ aria-live="polite"
133
+ id={`${id}-helper-text`}
134
+ data-testid={`${id}-helper-text`}
135
+ error={error}
136
+ sx={[{
137
+ margin: "4px 0px 0px 0px",
138
+ color: "#515151",
139
+ lineHeight: 1
140
+ },
141
+ error && {
142
+ color: "#AE1C1C !important",
143
+ },
144
+ ]}
145
+ >
146
+ {helperText}
147
+ </FormHelperText>)}
95
148
  <MUIAutoComplete
96
149
  disablePortal
97
150
  id={id}
@@ -147,20 +200,6 @@ const AutoComplete = ({
147
200
  onChange(id, selectedVal || "")
148
201
  }
149
202
  />
150
- {helperText && (
151
- <FormHelperText
152
- tabIndex={0}
153
- aria-live="polite"
154
- id={`${id}-helper-text`}
155
- data-testid={`${id}-helper-text`}
156
- error={error}
157
- sx={ error &&
158
- { color: "#AE1C1C !important" }
159
- }
160
- >
161
- {helperText}
162
- </FormHelperText>
163
- )}
164
203
  </FormControl>
165
204
  );
166
205
  };
@@ -96,3 +96,16 @@ AutoCompleteMultipleWithError.args = {
96
96
  helperText: "At least one field is required",
97
97
  error: true,
98
98
  };
99
+
100
+
101
+ export const AutoCompleteWithVariableHeights = () => {
102
+ return (
103
+ <div className="qpp-u-padding--16">
104
+ <div style={{display: "flex", flexDirection: "row", flexGrow: 1}}>
105
+ <TemplateMultipleSelect placeholder="test" required={true} helperText="test"/>
106
+ <TemplateMultipleSelect placeholder="test" required={true} 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 "/>
107
+ <TemplateMultipleSelect placeholder="test" required={true} helperText="test"/>
108
+ </div>
109
+ </div>
110
+ );
111
+ };
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import { withKnobs } from "@storybook/addon-knobs";
4
4
  import Select from "./index";
5
- import { MenuItem } from "@mui/material";
5
+ import { MenuItem, Box } from "@mui/material";
6
6
 
7
7
  export default {
8
8
  title: "Select",
@@ -11,7 +11,7 @@ export default {
11
11
  };
12
12
 
13
13
  const Wrapper = ({ children }) => (
14
- <div className="qpp-u-padding--16" style={{ width: 300 }}>
14
+ <div className="qpp-u-padding--16" style={{ width: 300, marginBottom: "16px" }} >
15
15
  {children}
16
16
  </div>
17
17
  );
@@ -139,7 +139,7 @@ export const Error = () => (
139
139
  inputProps={{ "data-testid": "measure-name-input" }}
140
140
  data-testid="measure-name-text-field"
141
141
  size="small"
142
- helperText="An error message"
142
+ helperText="An error message An error message An error message"
143
143
  options={options.map(({ key, value, testId, name }) => {
144
144
  return (
145
145
  <MenuItem
@@ -154,3 +154,79 @@ export const Error = () => (
154
154
  />
155
155
  </Wrapper>
156
156
  );
157
+
158
+
159
+
160
+ export const VariedHeights = () => (
161
+ <div className="qpp-u-padding--16" style={{ width: 900, marginBottom: "16px" }} >
162
+ <Box sx={{display: "flex",
163
+ flexDirection: "row"}}>
164
+ <Select
165
+ error
166
+ placeHolder={{ name: "placeholder", value: "" }}
167
+ defaultValue=""
168
+ label="Text Label"
169
+ id="measureName"
170
+ inputProps={{ "data-testid": "measure-name-input" }}
171
+ data-testid="measure-name-text-field"
172
+ size="small"
173
+ helperText="An error message"
174
+ options={options.map(({ key, value, testId, name }) => {
175
+ return (
176
+ <MenuItem
177
+ key={key}
178
+ value={value}
179
+ data-testid={`option-${testId}`}
180
+ >
181
+ {name}
182
+ </MenuItem>
183
+ );
184
+ })}
185
+ />
186
+ <Select
187
+ // error
188
+ placeHolder={{ name: "placeholder", value: "" }}
189
+ defaultValue=""
190
+ label="Text Label"
191
+ id="measureName"
192
+ inputProps={{ "data-testid": "measure-name-input" }}
193
+ data-testid="measure-name-text-field"
194
+ size="small"
195
+ helperText=""
196
+ options={options.map(({ key, value, testId, name }) => {
197
+ return (
198
+ <MenuItem
199
+ key={key}
200
+ value={value}
201
+ data-testid={`option-${testId}`}
202
+ >
203
+ {name}
204
+ </MenuItem>
205
+ );
206
+ })}
207
+ />
208
+ <Select
209
+ // error
210
+ placeHolder={{ name: "placeholder", value: "" }}
211
+ defaultValue=""
212
+ label="Text Label"
213
+ id="measureName"
214
+ inputProps={{ "data-testid": "measure-name-input" }}
215
+ data-testid="measure-name-text-field"
216
+ size="small"
217
+ 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 "
218
+ options={options.map(({ key, value, testId, name }) => {
219
+ return (
220
+ <MenuItem
221
+ key={key}
222
+ value={value}
223
+ data-testid={`option-${testId}`}
224
+ >
225
+ {name}
226
+ </MenuItem>
227
+ );
228
+ })}
229
+ />
230
+ </Box>
231
+ </div>
232
+ )
@@ -5,42 +5,6 @@ import InputLabel from "../InputLabel";
5
5
  import FormHelperText from "@mui/material/FormHelperText";
6
6
  import PropTypes from "prop-types";
7
7
 
8
- const selectStyles = {
9
- borderRadius: "3px",
10
- height: 40, //there's a .13 coming from somewhere.
11
- border: "1px solid #DDDDDD",
12
- // remove weird line break from legend
13
- "& .MuiOutlinedInput-notchedOutline": {
14
- borderRadius: "3px",
15
- "& legend": {
16
- width: 0,
17
- },
18
- },
19
- "& .MuiOutlinedInput-root": {
20
- "&&": {
21
- borderRadius: "3px",
22
- },
23
- },
24
- // input base selector
25
- "& .MuiInputBase-input": {
26
- color: "#333",
27
- fontFamily: "Rubik",
28
- fontSize: 14,
29
- borderRadius: "3px",
30
- padding: "9px 14px",
31
- "&::placeholder": {
32
- color: "#717171"
33
- },
34
- },
35
- "& .MuiSelect-icon": {
36
- color: "#323232",
37
- },
38
- "& .Mui-disabled" : {
39
- backgroundColor: "#EDEDED",
40
- border: "#EDEDED",
41
- }
42
- }
43
-
44
8
  const Select = ({
45
9
  placeHolder = undefined, // expects placeholder objects of { name: value } and inserts into the render item function.
46
10
  required = false,
@@ -67,16 +31,110 @@ const Select = ({
67
31
  );
68
32
  return (
69
33
  <FormControl error={error} fullWidth>
34
+ {/* to deal with multiple height helper text in a single row*/}
35
+ <div style={{ width: 1, display: "flex", flexDirection: "column", flexGrow: 1}}/>
70
36
  <InputLabel
37
+ // {/* has init at .2rem/3.2 px bottom. passing sx breaks style. */}
71
38
  id={`${id}-label`}
72
39
  disabled={disabled}
73
40
  required={required}
74
41
  shrink
42
+ style={{marginBottom: 0, height: 16}} // force a heignt
43
+ sx={[
44
+ {
45
+ backgroundColor: "transparent",
46
+ display: "flex",
47
+ flexDirection: "row-reverse",
48
+ alignSelf: "baseline",
49
+ textTransform: "none",
50
+ // force it outside the select box
51
+ position: "initial",
52
+ transform: "translateX(0px) translateY(0px)",
53
+ fontFamily: "Rubik",
54
+ fontWeight: 500,
55
+ fontSize: 14,
56
+ color: "#333",
57
+ "& .MuiInputLabel-asterisk": {
58
+ color: "#AE1C1C !important",
59
+ marginRight: "3px !important", //this was
60
+ },
61
+ },
62
+ required && {
63
+ transform: "translateX(-12px) translateY(0px)",
64
+ "& .MuiInputLabel-asterisk": {
65
+ color: "#D92F2",
66
+ marginRight: "3px !important", //this was
67
+ },
68
+ },
69
+ disabled && {
70
+ color: "rgba(0,0,0,0.6)",
71
+ },
72
+ error && {
73
+ color: "#AE1C1C !important",
74
+ },
75
+ ]}
75
76
  >
76
77
  {label}
77
78
  </InputLabel>
79
+ {helperText && (<FormHelperText
80
+ tabIndex={0}
81
+ aria-live="polite"
82
+ data-testid={`${id}-helper-text`}
83
+ id={`${id}-helper-text`}
84
+ sx={[{
85
+ margin: "4px 0px 0px 0px",
86
+ color: "#515151",
87
+ lineHeight: 1
88
+ },
89
+ error && {
90
+ color: "#AE1C1C !important",
91
+ },
92
+ ]}
93
+ >
94
+ {helperText}
95
+ </FormHelperText>)}
78
96
  <MUISelect
79
- sx={selectStyles}
97
+ sx={[{
98
+ borderRadius: "3px",
99
+ height: 40,
100
+ border: "1px solid #DDDDDD",
101
+ marginTop: "8px",
102
+ "& .MuiOutlinedInput-notchedOutline": {
103
+ borderRadius: "3px",
104
+ "& legend": {
105
+ width: 0,
106
+ },
107
+ },
108
+ "& .MuiOutlinedInput-root": {
109
+ "&&": {
110
+ borderRadius: "3px",
111
+ },
112
+ },
113
+ // input base selector
114
+ "& .MuiInputBase-input": {
115
+ color: "#333",
116
+ fontFamily: "Rubik",
117
+ fontSize: 14,
118
+ borderRadius: "3px",
119
+ padding: "9px 14px",
120
+ "&::placeholder": {
121
+ color: "#717171"
122
+ },
123
+ },
124
+ "& .MuiSelect-icon": {
125
+ color: "#323232",
126
+ },
127
+ "& .Mui-disabled" : {
128
+ backgroundColor: "#EDEDED",
129
+ border: "#EDEDED",
130
+ }},
131
+ error && {
132
+ "& .MuiOutlinedInput-notchedOutline": {
133
+ borderColor: "#AE1C1C !important",
134
+ },
135
+ },
136
+ ]
137
+ }
80
138
  displayEmpty
81
139
  IconComponent={ExpandMoreIcon}
82
140
  disabled={disabled}
@@ -96,14 +154,6 @@ const Select = ({
96
154
  >
97
155
  {options && options}
98
156
  </MUISelect>
99
- {helperText && (
100
- <FormHelperText
101
- data-testid={`helper-text`}
102
- id={`${id}-helper-text`}
103
- >
104
- {helperText}
105
- </FormHelperText>
106
- )}
107
157
  </FormControl>
108
158
  );
109
159
  };
@@ -89,11 +89,44 @@ export const Error = () => (
89
89
  inputProps={{ "data-testid": "measure-name-input" }}
90
90
  data-testid="measure-name-text-field"
91
91
  size="small"
92
- helperText={
93
- <FormHelperText data-testid={`helper-text`} error={true}>
94
- An error message
95
- </FormHelperText>
96
- }
92
+ helperText="An error message"
97
93
  />
98
94
  </Wrapper>
99
95
  );
96
+
97
+ export const VariedHeights = () => (
98
+ <div className="qpp-u-padding--16" style={{ width: 900, marginBottom: "16px" }} >
99
+ <div style={{display: "flex",
100
+ flexDirection: "row"}}>
101
+ <TextField
102
+ placeholder="Placeholder"
103
+ required
104
+ label="Text Label"
105
+ id="measureName"
106
+ inputProps={{ "data-testid": "measure-name-input" }}
107
+ data-testid="measure-name-text-field"
108
+ size="small"
109
+ helperText="An error message"
110
+ />
111
+ <TextField
112
+ placeholder="Placeholder"
113
+ label="Text Label"
114
+ id="measureName"
115
+ inputProps={{ "data-testid": "measure-name-input" }}
116
+ data-testid="measure-name-text-field"
117
+ size="small"
118
+ 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 "
119
+ />
120
+ <TextField
121
+ placeholder="Placeholder"
122
+ error
123
+ required
124
+ label="Text Label"
125
+ id="measureName"
126
+ inputProps={{ "data-testid": "measure-name-input" }}
127
+ data-testid="measure-name-text-field"
128
+ size="small"
129
+ helperText="An error message"
130
+ />
131
+ </div>
132
+ </div>)
@@ -18,20 +18,73 @@ const TextField = ({
18
18
  }) => {
19
19
  return (
20
20
  <FormControl fullWidth error={error}>
21
+ <div style={{ width: 1, display: "flex", flexDirection: "column", flexGrow: 1}}/>
21
22
  <InputLabel
22
23
  disabled={disabled}
23
24
  shrink
24
25
  required={required}
25
26
  error={error}
26
27
  htmlFor={id}
28
+ style={{marginBottom: 0, height: 16}} // force a heignt
29
+ sx={[
30
+ {
31
+ backgroundColor: "transparent",
32
+ display: "flex",
33
+ flexDirection: "row-reverse",
34
+ alignSelf: "baseline",
35
+ textTransform: "none",
36
+ // force it outside the select box
37
+ position: "initial",
38
+ transform: "translateX(0px) translateY(0px)",
39
+ fontFamily: "Rubik",
40
+ fontWeight: 500,
41
+ fontSize: 14,
42
+ color: "#333",
43
+ "& .MuiInputLabel-asterisk": {
44
+ color: "#AE1C1C !important",
45
+ marginRight: "3px !important", //this was
46
+ },
47
+ },
48
+ required && {
49
+ transform: "translateX(-12px) translateY(0px)",
50
+ "& .MuiInputLabel-asterisk": {
51
+ color: "#D92F2",
52
+ marginRight: "3px !important", //this was
53
+ },
54
+ },
55
+ disabled && {
56
+ color: "rgba(0,0,0,0.6)",
57
+ },
58
+ error && {
59
+ color: "#AE1C1C !important",
60
+ },
61
+ ]}
27
62
  >
28
63
  {label}
29
64
  </InputLabel>
65
+ { helperText && (<FormHelperText
66
+ tabIndex={0}
67
+ aria-live="polite"
68
+ id={`${id}-helper-text`}
69
+ data-testid={`${id}-helper-text`}
70
+ sx={[{
71
+ margin: "4px 0px 0px 0px",
72
+ color: "#515151",
73
+ lineHeight: 1
74
+ },
75
+ error && {
76
+ color: "#AE1C1C !important",
77
+ },
78
+ ]}
79
+ >
80
+ {helperText}
81
+ </FormHelperText>)}
30
82
  <MUITextField
31
- sx={{
83
+ sx={[{
32
84
  borderRadius: "3px",
33
85
  height: 40, //there's a .13 coming from somewhere.
34
86
  border: "1px solid #DDDDDD",
87
+ marginTop: "8px",
35
88
  // remove weird line break from legend
36
89
  "& .MuiOutlinedInput-notchedOutline": {
37
90
  borderRadius: "3px",
@@ -52,19 +105,22 @@ const TextField = ({
52
105
  borderRadius: "3px",
53
106
  padding: "9px 14px",
54
107
  "&::placeholder": {
108
+ opacity: 1,
55
109
  color: "#717171"
56
110
  },
57
111
  },
58
- }}
112
+ },
113
+ error && {
114
+ "& .MuiOutlinedInput-notchedOutline": {
115
+ borderColor: "#AE1C1C !important",
116
+ },
117
+ }]}
59
118
  label={null}
60
119
  error={error}
61
120
  disabled={disabled}
62
121
  id={id}
63
122
  {...rest}
64
123
  />
65
- <FormHelperText id={`${id}-helper-text`}>
66
- {helperText && helperText}
67
- </FormHelperText>
68
124
  </FormControl>
69
125
  );
70
126
  };