@madie/madie-design-system 1.0.49 → 1.0.51

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.
@@ -39,11 +39,11 @@ export const dateTextFieldStyle = {
39
39
  },
40
40
  };
41
41
 
42
- const DateField = ({ label, value, handlDateTimeChange }) => {
42
+ const DateField = ({ label, value, handleDateChange, disabled }) => {
43
43
  return (
44
44
  <LocalizationProvider dateAdapter={AdapterDayjs}>
45
45
  <InputLabel
46
- data-testid={`${kebabCase(label)}-date`}
46
+ data-testid={`${kebabCase(label)}`}
47
47
  style={{ marginBottom: 0, height: 16 }}
48
48
  sx={[
49
49
  {
@@ -61,11 +61,12 @@ const DateField = ({ label, value, handlDateTimeChange }) => {
61
61
  },
62
62
  ]}
63
63
  >
64
- {`${label} Date`}
64
+ {`${label}`}
65
65
  </InputLabel>
66
66
  <DatePicker
67
67
  value={value ? value : null}
68
- onChange={handlDateTimeChange}
68
+ onChange={handleDateChange}
69
+ disabled={disabled}
69
70
  slotProps={{
70
71
  textField: {
71
72
  id: "date",
@@ -78,8 +79,9 @@ const DateField = ({ label, value, handlDateTimeChange }) => {
78
79
  };
79
80
  DateField.propTypes = {
80
81
  label: PropTypes.string.isRequired,
81
- value: PropTypes.any,
82
- handlDateTimeChange: PropTypes.func.isRequired,
82
+ value: PropTypes.object,
83
+ handleDateChange: PropTypes.func.isRequired,
84
+ disabled:PropTypes.bool
83
85
  };
84
86
 
85
87
  export default DateField;
@@ -9,15 +9,16 @@ export default {
9
9
  };
10
10
  export const DateFieldComponent = (args) => {
11
11
  const [value, setValue] = useState("");
12
- const handlDateTimeChange = (e) => {
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
- handlDateTimeChange={handlDateTimeChange}
19
+ disabled={false}
20
+ label="Status Date"
21
+ handleDateChange={handleDateChange}
21
22
  value={value}
22
23
  />
23
24
  </div>
@@ -0,0 +1,77 @@
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,disabled }) => {
44
+ console.log(disabled)
45
+ return (
46
+ <FormControl>
47
+ <LocalizationProvider dateAdapter={AdapterDayjs}>
48
+ <InputLabel
49
+ style={{ marginBottom: 0, height: 16 }}
50
+ data-testId={`${kebabCase(label)}`}
51
+ >
52
+ {`${label}`}
53
+ </InputLabel>
54
+ <DateTimePicker
55
+ value={dateTimeValue ? dateTimeValue : null}
56
+ onChange={handleDateTimeChange}
57
+ views={["year", "day", "hours", "minutes"]}
58
+ disabled={disabled}
59
+ slotProps={{
60
+ textField: {
61
+ id: "dateTime",
62
+ sx: dateTimeTextFieldStyle,
63
+ },
64
+ }}
65
+ />
66
+ </LocalizationProvider>
67
+ </FormControl>
68
+ );
69
+ };
70
+ DateTimeField.propTypes = {
71
+ dateTimeValue: PropTypes.object,
72
+ handleDateTimeChange: PropTypes.func.isRequired,
73
+ label: PropTypes.string.isRequired,
74
+ disabled:PropTypes.bool
75
+ };
76
+
77
+ export default DateTimeField;
@@ -0,0 +1,27 @@
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
+ disabled={true}
21
+ label="Status Date/Time"
22
+ handlDateTimeChange={handlDateTimeChange}
23
+ dateTimeValue={value}
24
+ />
25
+ </div>
26
+ );
27
+ };
@@ -89,6 +89,7 @@ const TextArea = ({
89
89
  </FormHelperText>
90
90
  )}
91
91
  <TextareaAutosize
92
+ style={{ marginTop: '8px'}}
92
93
  className={
93
94
  error ? "text-area-variable error" : "text-area-variable"
94
95
  }
@@ -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,