@madie/madie-design-system 1.0.48 → 1.0.50
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/components/DateField/DateField.jsx +63 -80
- package/components/DateField/DateField.stories.jsx +3 -3
- package/components/DateTimeField/DateTimeField.jsx +74 -0
- package/components/DateTimeField/DateTimeField.stories.jsx +26 -0
- package/components/index.js +2 -0
- package/dist/browser.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +16 -16
- package/dist/react/index.js.map +1 -1
- package/package.json +2 -2
- package/storybook-static/49.cffaab28.iframe.bundle.js +103 -0
- package/storybook-static/{602.f6d1ca28.iframe.bundle.js.LICENSE.txt → 49.cffaab28.iframe.bundle.js.LICENSE.txt} +9 -0
- package/storybook-static/49.cffaab28.iframe.bundle.js.map +1 -0
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/main.99ea6040.iframe.bundle.js +1 -0
- package/storybook-static/project.json +1 -1
- package/test/components/DateField.test.js +7 -4
- package/test/components/DateTimeField.test.js +31 -0
- package/storybook-static/602.f6d1ca28.iframe.bundle.js +0 -103
- package/storybook-static/602.f6d1ca28.iframe.bundle.js.map +0 -1
- package/storybook-static/main.04a59fc2.iframe.bundle.js +0 -1
|
@@ -4,99 +4,82 @@ import InputLabel from "../InputLabel";
|
|
|
4
4
|
import { DatePicker } from "@mui/x-date-pickers/DatePicker";
|
|
5
5
|
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
|
6
6
|
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
|
|
7
|
-
import InputAdornment from "@mui/material/InputAdornment";
|
|
8
|
-
import EventIcon from "@mui/icons-material/Event";
|
|
9
7
|
import { kebabCase } from "lodash";
|
|
10
8
|
|
|
11
|
-
export const
|
|
12
|
-
|
|
13
|
-
borderRadius: "3px",
|
|
14
|
-
height: 40,
|
|
15
|
-
border: "1px solid #DDDDDD",
|
|
16
|
-
marginTop: "8px",
|
|
17
|
-
"& .MuiOutlinedInput-notchedOutline": {
|
|
9
|
+
export const dateTextFieldStyle = {
|
|
10
|
+
width: "170px",
|
|
18
11
|
borderRadius: "3px",
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
height: 40,
|
|
13
|
+
border: "1px solid #B0B0B0",
|
|
14
|
+
marginTop: "8px",
|
|
15
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
16
|
+
borderRadius: "3px",
|
|
17
|
+
"& legend": {
|
|
18
|
+
width: 0,
|
|
19
|
+
},
|
|
21
20
|
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
"& .MuiOutlinedInput-root": {
|
|
22
|
+
"&&": {
|
|
23
|
+
borderRadius: "3px",
|
|
24
|
+
},
|
|
26
25
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
padding: "9px 5px 9px 4px",
|
|
26
|
+
"& .MuiInputBase-input": {
|
|
27
|
+
color: "#333333",
|
|
28
|
+
fontFamily: "Rubik",
|
|
29
|
+
fontSize: 14,
|
|
30
|
+
borderRadius: "3px",
|
|
31
|
+
padding: "9px",
|
|
32
|
+
Width: "170px",
|
|
33
|
+
"&::placeholder": {
|
|
34
|
+
opacity: 1,
|
|
35
|
+
color: "#717171",
|
|
36
|
+
fontFamily: "Rubik",
|
|
37
|
+
fontSize: 14,
|
|
38
|
+
},
|
|
41
39
|
},
|
|
42
|
-
},
|
|
43
40
|
};
|
|
44
41
|
|
|
45
|
-
const DateField = ({ label, value,
|
|
42
|
+
const DateField = ({ label, value, handleDateChange }) => {
|
|
46
43
|
return (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
position="start"
|
|
81
|
-
style={{
|
|
82
|
-
color: "#515151",
|
|
83
|
-
left: "10.42%",
|
|
84
|
-
}}
|
|
85
|
-
>
|
|
86
|
-
<EventIcon />
|
|
87
|
-
</InputAdornment>
|
|
88
|
-
),
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
}}
|
|
92
|
-
/>
|
|
93
|
-
</LocalizationProvider>
|
|
44
|
+
<LocalizationProvider dateAdapter={AdapterDayjs}>
|
|
45
|
+
<InputLabel
|
|
46
|
+
data-testid={`${kebabCase(label)}`}
|
|
47
|
+
style={{ marginBottom: 0, height: 16 }}
|
|
48
|
+
sx={[
|
|
49
|
+
{
|
|
50
|
+
backgroundColor: "transparent",
|
|
51
|
+
textTransform: "none",
|
|
52
|
+
height: 17,
|
|
53
|
+
left: 0,
|
|
54
|
+
right: 0,
|
|
55
|
+
top: 0,
|
|
56
|
+
fontFamily: "Rubik",
|
|
57
|
+
fontStyle: "normal",
|
|
58
|
+
fontWeight: 500,
|
|
59
|
+
fontSize: 14,
|
|
60
|
+
color: "#333333",
|
|
61
|
+
},
|
|
62
|
+
]}
|
|
63
|
+
>
|
|
64
|
+
{`${label}`}
|
|
65
|
+
</InputLabel>
|
|
66
|
+
<DatePicker
|
|
67
|
+
value={value ? value : null}
|
|
68
|
+
onChange={handleDateChange}
|
|
69
|
+
slotProps={{
|
|
70
|
+
textField: {
|
|
71
|
+
id: "date",
|
|
72
|
+
sx: dateTextFieldStyle,
|
|
73
|
+
},
|
|
74
|
+
}}
|
|
75
|
+
/>
|
|
76
|
+
</LocalizationProvider>
|
|
94
77
|
);
|
|
95
78
|
};
|
|
96
79
|
DateField.propTypes = {
|
|
97
80
|
label: PropTypes.string.isRequired,
|
|
98
|
-
value: PropTypes.
|
|
99
|
-
|
|
81
|
+
value: PropTypes.object,
|
|
82
|
+
handleDateChange: PropTypes.func.isRequired,
|
|
100
83
|
};
|
|
101
84
|
|
|
102
85
|
export default DateField;
|
|
@@ -9,15 +9,15 @@ export default {
|
|
|
9
9
|
};
|
|
10
10
|
export const DateFieldComponent = (args) => {
|
|
11
11
|
const [value, setValue] = useState("");
|
|
12
|
-
const
|
|
12
|
+
const handleDateChange = (e) => {
|
|
13
13
|
console.log("Handle change triggered", e.target.value);
|
|
14
14
|
setValue(e.target.value);
|
|
15
15
|
};
|
|
16
16
|
return (
|
|
17
17
|
<div className="qpp-u-padding--16">
|
|
18
18
|
<DateField
|
|
19
|
-
label="Status"
|
|
20
|
-
|
|
19
|
+
label="Status Date"
|
|
20
|
+
handleDateChange={handleDateChange}
|
|
21
21
|
value={value}
|
|
22
22
|
/>
|
|
23
23
|
</div>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import InputLabel from "../InputLabel";
|
|
4
|
+
import { DateTimePicker } from "@mui/x-date-pickers/DateTimePicker";
|
|
5
|
+
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
|
6
|
+
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
|
|
7
|
+
import { FormControl } from "@mui/material";
|
|
8
|
+
import { kebabCase } from "lodash";
|
|
9
|
+
|
|
10
|
+
export const dateTimeTextFieldStyle = {
|
|
11
|
+
width: "240px",
|
|
12
|
+
borderRadius: "3px",
|
|
13
|
+
height: 40,
|
|
14
|
+
border: "1px solid #B0B0B0",
|
|
15
|
+
marginTop: "8px",
|
|
16
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
17
|
+
borderRadius: "3px",
|
|
18
|
+
"& legend": {
|
|
19
|
+
width: 0,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
"& .MuiOutlinedInput-root": {
|
|
23
|
+
"&&": {
|
|
24
|
+
borderRadius: "3px",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
"& .MuiInputBase-input": {
|
|
28
|
+
color: "#333333",
|
|
29
|
+
fontFamily: "Rubik",
|
|
30
|
+
fontSize: 14,
|
|
31
|
+
borderRadius: "3px",
|
|
32
|
+
padding: "9px",
|
|
33
|
+
Width: "240px",
|
|
34
|
+
"&::placeholder": {
|
|
35
|
+
opacity: 1,
|
|
36
|
+
color: "#717171",
|
|
37
|
+
fontFamily: "Rubik",
|
|
38
|
+
fontSize: 14,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const DateTimeField = ({ label, dateTimeValue, handleDateTimeChange }) => {
|
|
44
|
+
return (
|
|
45
|
+
<FormControl>
|
|
46
|
+
<LocalizationProvider dateAdapter={AdapterDayjs}>
|
|
47
|
+
<InputLabel
|
|
48
|
+
style={{ marginBottom: 0, height: 16 }}
|
|
49
|
+
data-testId={`${kebabCase(label)}`}
|
|
50
|
+
>
|
|
51
|
+
{`${label}`}
|
|
52
|
+
</InputLabel>
|
|
53
|
+
<DateTimePicker
|
|
54
|
+
value={dateTimeValue ? dateTimeValue : null}
|
|
55
|
+
onChange={handleDateTimeChange}
|
|
56
|
+
views={["year", "day", "hours", "minutes"]}
|
|
57
|
+
slotProps={{
|
|
58
|
+
textField: {
|
|
59
|
+
id: "dateTime",
|
|
60
|
+
sx: dateTimeTextFieldStyle,
|
|
61
|
+
},
|
|
62
|
+
}}
|
|
63
|
+
/>
|
|
64
|
+
</LocalizationProvider>
|
|
65
|
+
</FormControl>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
DateTimeField.propTypes = {
|
|
69
|
+
dateTimeValue: PropTypes.object,
|
|
70
|
+
handleDateTimeChange: PropTypes.func.isRequired,
|
|
71
|
+
label: PropTypes.string.isRequired,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default DateTimeField;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import DateTimeField from "./DateTimeField";
|
|
3
|
+
import { withKnobs } from "@storybook/addon-knobs";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "DateTimeField",
|
|
7
|
+
component: DateTimeField,
|
|
8
|
+
decorators: [withKnobs],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const TimeDateFieldComponent = (args) => {
|
|
12
|
+
const [value, setValue] = useState("");
|
|
13
|
+
const handlDateTimeChange = (e) => {
|
|
14
|
+
console.log("Handle change triggered", e.target.value);
|
|
15
|
+
setValue(e.target.value);
|
|
16
|
+
};
|
|
17
|
+
return (
|
|
18
|
+
<div className="qpp-u-padding--16">
|
|
19
|
+
<DateTimeField
|
|
20
|
+
label="Status Date/Time"
|
|
21
|
+
handlDateTimeChange={handlDateTimeChange}
|
|
22
|
+
dateTimeValue={value}
|
|
23
|
+
/>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
};
|
package/components/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import Button, { TextButton } from "./Button";
|
|
|
6
6
|
import CalloutBox from "./CalloutBox";
|
|
7
7
|
import Card from "./Card";
|
|
8
8
|
import DateField from "./DateField/DateField";
|
|
9
|
+
import DateTimeField from "./DateTimeField/DateTimeField";
|
|
9
10
|
import FlashNotification from "./FlashNotification/FlashNotificationUI";
|
|
10
11
|
import Footer from "./Footer/FooterUI";
|
|
11
12
|
import InputLabel from "./InputLabel";
|
|
@@ -125,6 +126,7 @@ export {
|
|
|
125
126
|
CalloutBox,
|
|
126
127
|
Card,
|
|
127
128
|
DateField,
|
|
129
|
+
DateTimeField,
|
|
128
130
|
FlashNotification,
|
|
129
131
|
Footer,
|
|
130
132
|
FormControlLabel,
|