@madie/madie-design-system 1.2.36 → 1.2.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.
- package/.storybook/main.js +6 -0
- package/components/Instant/Instant.stories.js +28 -0
- package/components/Instant/index.jsx +267 -0
- package/components/MadieConfirmDialog/MadieConfirmDialog.stories.js +104 -0
- package/components/MadieConfirmDialog/index.jsx +64 -0
- package/components/TextField/index.jsx +36 -39
- package/components/index.js +2 -0
- package/coverage/clover.xml +116 -58
- package/coverage/coverage-final.json +8 -6
- package/coverage/lcov-report/index.html +43 -13
- package/coverage/lcov-report/react/components/Accordion/index.html +1 -1
- package/coverage/lcov-report/react/components/Accordion/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Button/index.html +1 -1
- package/coverage/lcov-report/react/components/Button/index.js.html +17 -17
- package/coverage/lcov-report/react/components/DateField/DateField.jsx.html +1 -1
- package/coverage/lcov-report/react/components/DateField/index.html +1 -1
- package/coverage/lcov-report/react/components/DateTimeField/DateTimeField.jsx.html +1 -1
- package/coverage/lcov-report/react/components/DateTimeField/index.html +1 -1
- package/coverage/lcov-report/react/components/Error/Collapsible.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Error/ErrorUI.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Error/error.js.html +1 -1
- package/coverage/lcov-report/react/components/Error/index.html +1 -1
- package/coverage/lcov-report/react/components/Footer/FooterUI.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Footer/LegacyFooterUI.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Footer/footer.js.html +1 -1
- package/coverage/lcov-report/react/components/Footer/index.html +1 -1
- package/coverage/lcov-report/react/components/Infotip/Infotip.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Infotip/InfotipIcon.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Infotip/index.html +1 -1
- package/coverage/lcov-report/react/components/Infotip/index.js.html +1 -1
- package/coverage/lcov-report/react/components/InputLabel/index.html +1 -1
- package/coverage/lcov-report/react/components/InputLabel/index.jsx.html +4 -4
- package/coverage/lcov-report/react/components/Instant/index.html +116 -0
- package/coverage/lcov-report/react/components/Instant/index.jsx.html +886 -0
- package/coverage/lcov-report/react/components/MadieAlert/index.html +1 -1
- package/coverage/lcov-report/react/components/MadieAlert/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/MadieConfirmDialog/index.html +116 -0
- package/coverage/lcov-report/react/components/MadieConfirmDialog/index.jsx.html +277 -0
- package/coverage/lcov-report/react/components/MadieDeleteDialog/index.html +1 -1
- package/coverage/lcov-report/react/components/MadieDeleteDialog/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/MadieDialog/index.html +1 -1
- package/coverage/lcov-report/react/components/MadieDialog/index.jsx.html +14 -14
- package/coverage/lcov-report/react/components/MadieDiscardDialog/index.html +1 -1
- package/coverage/lcov-report/react/components/MadieDiscardDialog/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/MadieSpinner/index.html +1 -1
- package/coverage/lcov-report/react/components/MadieSpinner/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/MadieTooltip/index.html +1 -1
- package/coverage/lcov-report/react/components/MadieTooltip/index.jsx.html +3 -3
- package/coverage/lcov-report/react/components/MadieTooltipIcon/index.html +1 -1
- package/coverage/lcov-report/react/components/MadieTooltipIcon/index.jsx.html +3 -3
- package/coverage/lcov-report/react/components/Pagination/index.html +1 -1
- package/coverage/lcov-report/react/components/Pagination/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Popover/index.html +1 -1
- package/coverage/lcov-report/react/components/Popover/index.js.html +1 -1
- package/coverage/lcov-report/react/components/ReadOnlyTextField/index.html +1 -1
- package/coverage/lcov-report/react/components/ReadOnlyTextField/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Select/index.html +1 -1
- package/coverage/lcov-report/react/components/Select/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Tabs/Tab.js.html +1 -1
- package/coverage/lcov-report/react/components/Tabs/index.html +1 -1
- package/coverage/lcov-report/react/components/Tabs/index.js.html +1 -1
- package/coverage/lcov-report/react/components/TextArea/index.html +1 -1
- package/coverage/lcov-report/react/components/TextArea/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/TextField/index.html +9 -9
- package/coverage/lcov-report/react/components/TextField/index.jsx.html +58 -67
- package/coverage/lcov-report/react/components/Toast/index.html +1 -1
- package/coverage/lcov-report/react/components/Toast/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Tooltip/Tooltip.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Tooltip/index.html +1 -1
- package/coverage/lcov-report/react/components/Tooltip/index.js.html +1 -1
- package/coverage/lcov-report/react/components/Tooltip/position.js.html +1 -1
- package/coverage/lcov-report/react/index.html +1 -1
- package/coverage/lcov-report/react/index.js.html +1 -1
- package/coverage/lcov-report/react/lib/Chevron.jsx.html +1 -1
- package/coverage/lcov-report/react/lib/SvgComponents.jsx.html +1 -1
- package/coverage/lcov-report/react/lib/index.html +1 -1
- package/coverage/lcov.info +235 -114
- package/dist/browser.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/package-lock.json +220 -131
- package/package.json +1 -1
- package/styles/_qpp-style.scss +1 -0
- package/styles/components/_madie-confirm-dialog.scss +34 -0
- package/styles/qppds/components/_madie-confirm-dialog.scss +35 -0
- package/styles/qppds/components/index.scss +1 -0
- package/test/components/Instant.test.js +83 -0
- package/test/components/MadieConfirmDialog.test.js +159 -0
- package/webpack.config.react.js +13 -0
package/.storybook/main.js
CHANGED
|
@@ -39,6 +39,12 @@ module.exports = {
|
|
|
39
39
|
},
|
|
40
40
|
],
|
|
41
41
|
});
|
|
42
|
+
// the below lines add hot reload, but somehow put CI/CD into a hanging state
|
|
43
|
+
// config.watchOptions = {
|
|
44
|
+
// aggregateTimeout: 300, // Delay before rebuilding after the first change
|
|
45
|
+
// poll: 1000, // Check for changes every second
|
|
46
|
+
// ignored: /node_modules/, // Ignore node_modules to improve performance
|
|
47
|
+
// };
|
|
42
48
|
|
|
43
49
|
return config;
|
|
44
50
|
},
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import Instant from "./index";
|
|
3
|
+
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Instant",
|
|
7
|
+
component: Instant,
|
|
8
|
+
decorators: [withKnobs],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const InstantComponent = (args) => {
|
|
12
|
+
const [value, setValue] = useState("");
|
|
13
|
+
const handleDateTimeChange = (v) => {
|
|
14
|
+
setValue(v);
|
|
15
|
+
};
|
|
16
|
+
return (
|
|
17
|
+
<div className="qpp-u-padding--16">
|
|
18
|
+
<div> Date string: {value} </div>
|
|
19
|
+
<Instant
|
|
20
|
+
disabled={false}
|
|
21
|
+
id="status_date_time"
|
|
22
|
+
label="Status Date/Time"
|
|
23
|
+
handleDateTimeChange={handleDateTimeChange}
|
|
24
|
+
dateTimeValue={value}
|
|
25
|
+
/>
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import TextField from "../TextField";
|
|
4
|
+
import { DatePicker } from "@mui/x-date-pickers/DatePicker";
|
|
5
|
+
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
|
6
|
+
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
|
|
7
|
+
import dayjs from "dayjs";
|
|
8
|
+
import utc from "dayjs/plugin/utc";
|
|
9
|
+
import timezone from "dayjs/plugin/timezone";
|
|
10
|
+
import { FormControl, Box } from "@mui/material";
|
|
11
|
+
|
|
12
|
+
dayjs.extend(utc);
|
|
13
|
+
dayjs.utc();
|
|
14
|
+
dayjs.extend(timezone);
|
|
15
|
+
const formatDateTime = (dateTime) =>
|
|
16
|
+
dayjs.utc(dateTime).format("YYYY-MM-DDTHH:mm:ss.SSSZ");
|
|
17
|
+
export const defaultDateFieldStyles = {
|
|
18
|
+
width: "170px",
|
|
19
|
+
height: 40,
|
|
20
|
+
marginTop: "8px",
|
|
21
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
22
|
+
border: "1px solid #8C8C8C",
|
|
23
|
+
borderRadius: "3px",
|
|
24
|
+
"& legend": {
|
|
25
|
+
width: 0,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
"& .MuiOutlinedInput-root": {
|
|
29
|
+
"&&": {
|
|
30
|
+
borderRadius: "3px",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
"& .MuiInputBase-input": {
|
|
34
|
+
color: "#333333",
|
|
35
|
+
fontFamily: "Rubik",
|
|
36
|
+
fontSize: 14,
|
|
37
|
+
borderRadius: "3px",
|
|
38
|
+
padding: "9px",
|
|
39
|
+
Width: "170px",
|
|
40
|
+
"&::placeholder": {
|
|
41
|
+
opacity: 1,
|
|
42
|
+
color: "#717171",
|
|
43
|
+
fontFamily: "Rubik",
|
|
44
|
+
fontSize: 14,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
const Instant = ({
|
|
49
|
+
dateTimeValue,
|
|
50
|
+
handleDateTimeChange,
|
|
51
|
+
required = false,
|
|
52
|
+
disabled,
|
|
53
|
+
id = "default_dateTime-input",
|
|
54
|
+
textFieldSx = {},
|
|
55
|
+
dateFieldSx = {},
|
|
56
|
+
error = false,
|
|
57
|
+
helperText,
|
|
58
|
+
datePickerProps = {},
|
|
59
|
+
onBlur,
|
|
60
|
+
...rest
|
|
61
|
+
}) => {
|
|
62
|
+
const textFieldStyles = {
|
|
63
|
+
width: "55px",
|
|
64
|
+
height: "40px",
|
|
65
|
+
"& .MuiInputBase-input": {
|
|
66
|
+
color: "#333",
|
|
67
|
+
fontFamily: "Rubik",
|
|
68
|
+
fontSize: 14,
|
|
69
|
+
borderRadius: "3px",
|
|
70
|
+
padding: "9px 5px 9px 5px",
|
|
71
|
+
"&::placeholder": {
|
|
72
|
+
opacity: 1,
|
|
73
|
+
color: "#717171",
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
const handleHoursChange = (e) => {
|
|
78
|
+
const newHours = parseInt(e.target.value, 10);
|
|
79
|
+
if (dateTimeValue) {
|
|
80
|
+
const updatedDateTime = dayjs
|
|
81
|
+
.utc(dateTimeValue)
|
|
82
|
+
.set("hour", newHours);
|
|
83
|
+
handleDateTimeChange(formatDateTime(updatedDateTime));
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const handleMinutesChange = (e) => {
|
|
87
|
+
const newMinutes = parseInt(e.target.value, 10);
|
|
88
|
+
if (dateTimeValue) {
|
|
89
|
+
const updatedDateTime = dayjs
|
|
90
|
+
.utc(dateTimeValue)
|
|
91
|
+
.set("minute", newMinutes);
|
|
92
|
+
handleDateTimeChange(formatDateTime(updatedDateTime));
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const handleSecondsChange = (e) => {
|
|
96
|
+
const newSeconds = parseInt(e.target.value, 10);
|
|
97
|
+
if (dateTimeValue) {
|
|
98
|
+
const updatedDateTime = dayjs
|
|
99
|
+
.utc(dateTimeValue)
|
|
100
|
+
.set("second", newSeconds);
|
|
101
|
+
handleDateTimeChange(formatDateTime(updatedDateTime));
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
const handleMillisecondsChange = (e) => {
|
|
105
|
+
const newMilliseconds = parseInt(e.target.value, 10);
|
|
106
|
+
if (dateTimeValue) {
|
|
107
|
+
const updatedDateTime = dayjs
|
|
108
|
+
.utc(dateTimeValue)
|
|
109
|
+
.set("millisecond", newMilliseconds);
|
|
110
|
+
handleDateTimeChange(formatDateTime(updatedDateTime));
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const onDateChange = (newDate) => {
|
|
114
|
+
if (!isNaN(newDate)) {
|
|
115
|
+
if (dateTimeValue) {
|
|
116
|
+
const updatedDate = dayjs.utc(newDate);
|
|
117
|
+
handleDateTimeChange(formatDateTime(updatedDate));
|
|
118
|
+
} else {
|
|
119
|
+
const updatedDate = newDate.utc(newDate);
|
|
120
|
+
handleDateTimeChange(formatDateTime(updatedDate));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
return (
|
|
125
|
+
<FormControl error={error}>
|
|
126
|
+
<LocalizationProvider dateAdapter={AdapterDayjs}>
|
|
127
|
+
<Box
|
|
128
|
+
sx={{
|
|
129
|
+
display: "flex",
|
|
130
|
+
flexDirection: "row",
|
|
131
|
+
flexGrow: 1,
|
|
132
|
+
}}
|
|
133
|
+
>
|
|
134
|
+
<Box sx={{ marginRight: "24px" }}>
|
|
135
|
+
<DatePicker
|
|
136
|
+
value={
|
|
137
|
+
dateTimeValue ? dayjs.utc(dateTimeValue) : null
|
|
138
|
+
}
|
|
139
|
+
onChange={onDateChange}
|
|
140
|
+
disabled={disabled}
|
|
141
|
+
onClose={() => (onBlur ? onBlur() : undefined)}
|
|
142
|
+
slotProps={{
|
|
143
|
+
textField: (params) => {
|
|
144
|
+
const { InputProps } = params;
|
|
145
|
+
InputProps["data-testid"] = id;
|
|
146
|
+
InputProps["aria-required"] = required;
|
|
147
|
+
return {
|
|
148
|
+
id: id,
|
|
149
|
+
label: "Date",
|
|
150
|
+
sx: {
|
|
151
|
+
...defaultDateFieldStyles,
|
|
152
|
+
...dateFieldSx,
|
|
153
|
+
},
|
|
154
|
+
value: dateTimeValue
|
|
155
|
+
? dayjs.utc(dateTimeValue)
|
|
156
|
+
: null,
|
|
157
|
+
onChange: onDateChange,
|
|
158
|
+
error,
|
|
159
|
+
helperText: helperText,
|
|
160
|
+
onBlur: onBlur,
|
|
161
|
+
...rest,
|
|
162
|
+
};
|
|
163
|
+
},
|
|
164
|
+
openPickerButton: {
|
|
165
|
+
id: `${id}-open-picker-button`,
|
|
166
|
+
"data-testid": `${id}-open-picker-button`,
|
|
167
|
+
},
|
|
168
|
+
}}
|
|
169
|
+
slots={{ textField: TextField }}
|
|
170
|
+
/>
|
|
171
|
+
</Box>
|
|
172
|
+
<TextField
|
|
173
|
+
id={`${id}-hour`}
|
|
174
|
+
data-testid={`${id}-hour`}
|
|
175
|
+
value={
|
|
176
|
+
dateTimeValue ? dayjs.utc(dateTimeValue).hour() : 0
|
|
177
|
+
}
|
|
178
|
+
onChange={handleHoursChange}
|
|
179
|
+
label="Hr"
|
|
180
|
+
type="number"
|
|
181
|
+
disabled={!dateTimeValue}
|
|
182
|
+
inputProps={{
|
|
183
|
+
min: 0,
|
|
184
|
+
max: 24,
|
|
185
|
+
}}
|
|
186
|
+
textFieldStyles={textFieldStyles}
|
|
187
|
+
required={required}
|
|
188
|
+
/>
|
|
189
|
+
<TextField
|
|
190
|
+
id={`${id}-minute`}
|
|
191
|
+
data-testid={`${id}-minute`}
|
|
192
|
+
value={
|
|
193
|
+
dateTimeValue
|
|
194
|
+
? dayjs.utc(dateTimeValue).minute()
|
|
195
|
+
: 0
|
|
196
|
+
}
|
|
197
|
+
onChange={handleMinutesChange}
|
|
198
|
+
label="Min"
|
|
199
|
+
type="number"
|
|
200
|
+
disabled={!dateTimeValue}
|
|
201
|
+
inputProps={{
|
|
202
|
+
min: 0,
|
|
203
|
+
max: 60,
|
|
204
|
+
}}
|
|
205
|
+
textFieldStyles={textFieldStyles}
|
|
206
|
+
required={required}
|
|
207
|
+
/>
|
|
208
|
+
<TextField
|
|
209
|
+
id={`${id}-second`}
|
|
210
|
+
data-testid={`${id}-second`}
|
|
211
|
+
value={
|
|
212
|
+
dateTimeValue
|
|
213
|
+
? dayjs.utc(dateTimeValue).second()
|
|
214
|
+
: 0
|
|
215
|
+
}
|
|
216
|
+
onChange={handleSecondsChange}
|
|
217
|
+
label="Sec"
|
|
218
|
+
type="number"
|
|
219
|
+
disabled={!dateTimeValue}
|
|
220
|
+
inputProps={{
|
|
221
|
+
min: 0,
|
|
222
|
+
max: 60,
|
|
223
|
+
}}
|
|
224
|
+
textFieldStyles={textFieldStyles}
|
|
225
|
+
required={required}
|
|
226
|
+
/>
|
|
227
|
+
<TextField
|
|
228
|
+
id={`${id}-millisecond`}
|
|
229
|
+
data-testid={`${id}-millisecond`}
|
|
230
|
+
value={
|
|
231
|
+
dateTimeValue
|
|
232
|
+
? dayjs.utc(dateTimeValue).millisecond()
|
|
233
|
+
: 0
|
|
234
|
+
}
|
|
235
|
+
onChange={handleMillisecondsChange}
|
|
236
|
+
label="MS"
|
|
237
|
+
type="number"
|
|
238
|
+
disabled={!dateTimeValue}
|
|
239
|
+
inputProps={{
|
|
240
|
+
min: 0,
|
|
241
|
+
max: 999,
|
|
242
|
+
}}
|
|
243
|
+
textFieldStyles={textFieldStyles}
|
|
244
|
+
required={required}
|
|
245
|
+
/>
|
|
246
|
+
</Box>
|
|
247
|
+
</LocalizationProvider>
|
|
248
|
+
</FormControl>
|
|
249
|
+
);
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
Instant.propTypes = {
|
|
253
|
+
id: PropTypes.string,
|
|
254
|
+
placeholder: PropTypes.string,
|
|
255
|
+
disabled: PropTypes.bool,
|
|
256
|
+
required: PropTypes.bool,
|
|
257
|
+
dateTimeValue: PropTypes.any,
|
|
258
|
+
handleDateTimeChange: PropTypes.function,
|
|
259
|
+
textFieldSx: PropTypes.any,
|
|
260
|
+
dateFieldSx: PropTypes.any,
|
|
261
|
+
error: PropTypes.bool,
|
|
262
|
+
helperText: PropTypes.string,
|
|
263
|
+
datePickerProps: PropTypes.any,
|
|
264
|
+
onBlur: PropTypes.any,
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
export default Instant;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
|
+
import MadieConfirmDialog from "./index";
|
|
5
|
+
import Button from "../Button";
|
|
6
|
+
export default {
|
|
7
|
+
title: "MadieConfirmDialog",
|
|
8
|
+
component: MadieConfirmDialog,
|
|
9
|
+
decorators: [withKnobs],
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const Wrapper = ({ children }) => (
|
|
13
|
+
<div className="qpp-u-padding--16" style={{ width: 300 }}>
|
|
14
|
+
{children}
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
Wrapper.propTypes = {
|
|
18
|
+
className: PropTypes.string,
|
|
19
|
+
children: PropTypes.node,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const ConfirmDialog = () => {
|
|
23
|
+
const [open, setOpen] = useState(false);
|
|
24
|
+
const onClose = () => {
|
|
25
|
+
setOpen(false);
|
|
26
|
+
};
|
|
27
|
+
const onContinue = () => {
|
|
28
|
+
setOpen(false);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const [openDiscardDialog, setOpenDiscardDialog] = useState(false);
|
|
32
|
+
const onDiscardDialogClose = () => {
|
|
33
|
+
setOpenDiscardDialog(false);
|
|
34
|
+
};
|
|
35
|
+
const onDiscardDialogContinue = () => {
|
|
36
|
+
setOpenDiscardDialog(false);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const [openDeleteDialog, setOpenDeleteDialog] = useState(false);
|
|
40
|
+
const onDeleteDialogClose = () => {
|
|
41
|
+
setOpenDeleteDialog(false);
|
|
42
|
+
};
|
|
43
|
+
const onDeleteDialogContinue = () => {
|
|
44
|
+
setOpenDeleteDialog(false);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<div className="qpp-u-padding--16" style={{ width: 300 }}>
|
|
49
|
+
<p>
|
|
50
|
+
<Button variant="cyan" onClick={() => setOpen(true)}>
|
|
51
|
+
open Confirm Dialog
|
|
52
|
+
</Button>
|
|
53
|
+
</p>
|
|
54
|
+
<p>
|
|
55
|
+
<Button
|
|
56
|
+
variant="cyan"
|
|
57
|
+
onClick={() => setOpenDiscardDialog(true)}
|
|
58
|
+
>
|
|
59
|
+
open Discard Dialog
|
|
60
|
+
</Button>
|
|
61
|
+
</p>
|
|
62
|
+
<p>
|
|
63
|
+
<Button
|
|
64
|
+
variant="cyan"
|
|
65
|
+
onClick={() => {
|
|
66
|
+
setOpenDeleteDialog(true);
|
|
67
|
+
}}
|
|
68
|
+
>
|
|
69
|
+
open Delete Dialog
|
|
70
|
+
</Button>
|
|
71
|
+
</p>
|
|
72
|
+
<MadieConfirmDialog
|
|
73
|
+
open={open}
|
|
74
|
+
onContinue={onContinue}
|
|
75
|
+
onClose={onClose}
|
|
76
|
+
warning="You are about to Sign Out from UMLS. You will need to enter your UMLS API key to log back in."
|
|
77
|
+
dialogTitle="Are you sure?"
|
|
78
|
+
name="log out of UMLS"
|
|
79
|
+
action="confirm"
|
|
80
|
+
/>
|
|
81
|
+
<MadieConfirmDialog
|
|
82
|
+
open={openDiscardDialog}
|
|
83
|
+
onContinue={onDiscardDialogContinue}
|
|
84
|
+
onClose={onDiscardDialogClose}
|
|
85
|
+
warning="This Action cannot be undone."
|
|
86
|
+
dialogTitle="Discard Changes"
|
|
87
|
+
name="discard your changes"
|
|
88
|
+
action="discard"
|
|
89
|
+
continueText="Yes, Discard All Changes"
|
|
90
|
+
cancelText="No, Keep Working"
|
|
91
|
+
/>
|
|
92
|
+
<MadieConfirmDialog
|
|
93
|
+
open={openDeleteDialog}
|
|
94
|
+
onContinue={onDeleteDialogContinue}
|
|
95
|
+
onClose={onDeleteDialogClose}
|
|
96
|
+
warning="This Action cannot be undone."
|
|
97
|
+
dialogTitle="Are You Sure"
|
|
98
|
+
name="delete this Definition"
|
|
99
|
+
action="delete"
|
|
100
|
+
continueText="Yes, Delete"
|
|
101
|
+
/>
|
|
102
|
+
</div>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import ErrorIcon from "@mui/icons-material/Error";
|
|
4
|
+
import MadieDialog from "../MadieDialog";
|
|
5
|
+
|
|
6
|
+
const MadieConfirmDialog = ({
|
|
7
|
+
open,
|
|
8
|
+
onClose,
|
|
9
|
+
onContinue,
|
|
10
|
+
action,
|
|
11
|
+
warning,
|
|
12
|
+
...otherDialogProps
|
|
13
|
+
}) => (
|
|
14
|
+
<MadieDialog
|
|
15
|
+
title={otherDialogProps.dialogTitle}
|
|
16
|
+
dialogProps={{
|
|
17
|
+
open: open,
|
|
18
|
+
onClose,
|
|
19
|
+
"data-testid": `${action}-dialog`,
|
|
20
|
+
}}
|
|
21
|
+
cancelButtonProps={{
|
|
22
|
+
variant: "secondary",
|
|
23
|
+
onClick: onClose,
|
|
24
|
+
cancelText: otherDialogProps.cancelText
|
|
25
|
+
? otherDialogProps.cancelText
|
|
26
|
+
: "Cancel",
|
|
27
|
+
"data-testid": `${action}-dialog-cancel-button`,
|
|
28
|
+
}}
|
|
29
|
+
continueButtonProps={{
|
|
30
|
+
variant: "danger-primary",
|
|
31
|
+
type: "submit",
|
|
32
|
+
"data-testid": `${action}-dialog-continue-button`,
|
|
33
|
+
continueText: otherDialogProps.continueText
|
|
34
|
+
? otherDialogProps.continueText
|
|
35
|
+
: "Continue",
|
|
36
|
+
onClick: onContinue,
|
|
37
|
+
}}
|
|
38
|
+
>
|
|
39
|
+
<div id="confirm-dialog-body">
|
|
40
|
+
<section className="dialog-warning-body">
|
|
41
|
+
{action?.includes("discard") && (
|
|
42
|
+
<p>You have unsaved changes.</p>
|
|
43
|
+
)}
|
|
44
|
+
<p>
|
|
45
|
+
Are you sure you want to{" "}
|
|
46
|
+
<span className="strong">{otherDialogProps.name}</span>?
|
|
47
|
+
</p>
|
|
48
|
+
</section>
|
|
49
|
+
<section className="dialog-warning-action">
|
|
50
|
+
<ErrorIcon />
|
|
51
|
+
<p>{warning}</p>
|
|
52
|
+
</section>
|
|
53
|
+
</div>
|
|
54
|
+
</MadieDialog>
|
|
55
|
+
);
|
|
56
|
+
MadieConfirmDialog.propTypes = {
|
|
57
|
+
open: PropTypes.bool,
|
|
58
|
+
onClose: PropTypes.func,
|
|
59
|
+
onContinue: PropTypes.func,
|
|
60
|
+
action: PropTypes.string,
|
|
61
|
+
warning: PropTypes.string,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export default MadieConfirmDialog;
|
|
@@ -18,6 +18,7 @@ const TextField = ({
|
|
|
18
18
|
tooltipText,
|
|
19
19
|
inputProps,
|
|
20
20
|
labelColor = undefined,
|
|
21
|
+
textFieldStyles = {},
|
|
21
22
|
...rest
|
|
22
23
|
}) => {
|
|
23
24
|
// get a copy of input props
|
|
@@ -40,6 +41,39 @@ const TextField = ({
|
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
|
|
44
|
+
const extendedTextFieldStyles = {
|
|
45
|
+
borderRadius: "3px",
|
|
46
|
+
border: "none",
|
|
47
|
+
marginTop: "8px",
|
|
48
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
49
|
+
borderRadius: "3px",
|
|
50
|
+
borderColor: "#8C8C8C",
|
|
51
|
+
"& legend": {
|
|
52
|
+
width: 0,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
"& .MuiInputBase-root": {
|
|
56
|
+
height: "auto",
|
|
57
|
+
},
|
|
58
|
+
"& .MuiOutlinedInput-root": {
|
|
59
|
+
"&&": {
|
|
60
|
+
borderRadius: "3px",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
// input base selector
|
|
64
|
+
"& .MuiInputBase-input": {
|
|
65
|
+
color: "#333",
|
|
66
|
+
fontFamily: "Rubik",
|
|
67
|
+
fontSize: 14,
|
|
68
|
+
borderRadius: "3px",
|
|
69
|
+
padding: "9px 14px",
|
|
70
|
+
"&::placeholder": {
|
|
71
|
+
opacity: 1,
|
|
72
|
+
color: "#717171",
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
...textFieldStyles,
|
|
76
|
+
};
|
|
43
77
|
return (
|
|
44
78
|
<FormControl fullWidth error={error}>
|
|
45
79
|
<div
|
|
@@ -128,45 +162,7 @@ const TextField = ({
|
|
|
128
162
|
</FormHelperText>
|
|
129
163
|
)}
|
|
130
164
|
<MUITextField
|
|
131
|
-
sx={
|
|
132
|
-
{
|
|
133
|
-
borderRadius: "3px",
|
|
134
|
-
border: "none",
|
|
135
|
-
marginTop: "8px",
|
|
136
|
-
"& .MuiOutlinedInput-notchedOutline": {
|
|
137
|
-
borderRadius: "3px",
|
|
138
|
-
borderColor: "#8C8C8C",
|
|
139
|
-
"& legend": {
|
|
140
|
-
width: 0,
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
"& .MuiInputBase-root": {
|
|
144
|
-
height: "auto",
|
|
145
|
-
},
|
|
146
|
-
"& .MuiOutlinedInput-root": {
|
|
147
|
-
"&&": {
|
|
148
|
-
borderRadius: "3px",
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
// input base selector
|
|
152
|
-
"& .MuiInputBase-input": {
|
|
153
|
-
color: "#333",
|
|
154
|
-
fontFamily: "Rubik",
|
|
155
|
-
fontSize: 14,
|
|
156
|
-
borderRadius: "3px",
|
|
157
|
-
padding: "9px 14px",
|
|
158
|
-
"&::placeholder": {
|
|
159
|
-
opacity: 1,
|
|
160
|
-
color: "#717171",
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
},
|
|
164
|
-
error && {
|
|
165
|
-
"& .MuiOutlinedInput-notchedOutline": {
|
|
166
|
-
borderColor: "#AE1C1C !important",
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
]}
|
|
165
|
+
sx={extendedTextFieldStyles}
|
|
170
166
|
label={null}
|
|
171
167
|
error={error}
|
|
172
168
|
disabled={disabled}
|
|
@@ -180,6 +176,7 @@ const TextField = ({
|
|
|
180
176
|
|
|
181
177
|
TextField.propTypes = {
|
|
182
178
|
id: PropTypes.string,
|
|
179
|
+
textFieldStyles: PropTypes.object,
|
|
183
180
|
error: PropTypes.bool,
|
|
184
181
|
helperText: PropTypes.string,
|
|
185
182
|
required: PropTypes.bool,
|
package/components/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import DateField from "./DateField/DateField";
|
|
|
9
9
|
import DateTimeField from "./DateTimeField/DateTimeField";
|
|
10
10
|
import FlashNotification from "./FlashNotification/FlashNotificationUI";
|
|
11
11
|
import Footer from "./Footer/FooterUI";
|
|
12
|
+
import Instant from "./Instant";
|
|
12
13
|
import InputLabel from "./InputLabel";
|
|
13
14
|
import FormControlLabel from "./FormControlLabel";
|
|
14
15
|
import MadieAlert from "./MadieAlert";
|
|
@@ -137,6 +138,7 @@ export {
|
|
|
137
138
|
InputLabel,
|
|
138
139
|
Icons,
|
|
139
140
|
Infotip,
|
|
141
|
+
Instant,
|
|
140
142
|
Modal,
|
|
141
143
|
MadieAlert,
|
|
142
144
|
MadieDialog,
|