1
1
import React from "react" ;
2
2
import PropTypes from "prop-types" ;
3
- import { InputLabel } from "@madie/madie-design-system/dist/react " ;
3
+ import InputLabel from "../InputLabel " ;
4
4
import { DateTimePicker } from "@mui/x-date-pickers/DateTimePicker" ;
5
5
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider" ;
6
6
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs" ;
7
- import dayjs from " dayjs" ;
8
- import utc from " dayjs/plugin/utc" ;
7
+ import dayjs from ' dayjs'
8
+ import utc from ' dayjs/plugin/utc' ;
9
9
10
10
import { FormControl } from "@mui/material" ;
11
11
import { kebabCase } from "lodash" ;
12
12
13
- dayjs . extend ( utc ) ;
13
+ dayjs . extend ( utc )
14
14
export const dateTimeTextFieldStyle = {
15
- width : "240px" ,
16
- borderRadius : "3px" ,
17
- height : 40 ,
18
- border : "1px solid #B0B0B0" ,
19
- marginTop : "8px" ,
20
- "& .MuiOutlinedInput-notchedOutline" : {
15
+ width : "240px" ,
21
16
borderRadius : "3px" ,
22
- "& legend" : {
23
- width : 0 ,
17
+ height : 40 ,
18
+ border : "1px solid #B0B0B0" ,
19
+ marginTop : "8px" ,
20
+ "& .MuiOutlinedInput-notchedOutline" : {
21
+ borderRadius : "3px" ,
22
+ "& legend" : {
23
+ width : 0 ,
24
+ } ,
24
25
} ,
25
- } ,
26
- "& .MuiOutlinedInput-root " : {
27
- "&&" : {
28
- borderRadius : "3px" ,
26
+ "& .MuiOutlinedInput-root" : {
27
+ "&& " : {
28
+ borderRadius : "3px" ,
29
+ } ,
29
30
} ,
30
- } ,
31
- "& .MuiInputBase-input" : {
32
- color : "#333333 " ,
33
- fontFamily : "Rubik" ,
34
- fontSize : 14 ,
35
- borderRadius : "3px " ,
36
- padding : "9px " ,
37
- Width : "240px" ,
38
- "&::placeholder" : {
39
- opacity : 1 ,
40
- color : "#717171 " ,
41
- fontFamily : "Rubik" ,
42
- fontSize : 14 ,
31
+ "& .MuiInputBase-input" : {
32
+ color : "#333333" ,
33
+ fontFamily : "Rubik " ,
34
+ fontSize : 14 ,
35
+ borderRadius : "3px" ,
36
+ padding : "9px " ,
37
+ Width : "240px " ,
38
+ "&::placeholder" : {
39
+ opacity : 1 ,
40
+ color : "#717171" ,
41
+ fontFamily : "Rubik " ,
42
+ fontSize : 14 ,
43
+ } ,
43
44
} ,
44
- } ,
45
45
} ;
46
46
47
- const DateTimeField = ( {
48
- label,
49
- dateTimeValue,
50
- handleDateTimeChange,
51
- disabled,
52
- } ) => {
53
- return (
54
- < FormControl >
55
- < LocalizationProvider dateAdapter = { AdapterDayjs } >
56
- < InputLabel
57
- style = { { marginBottom : 0 , height : 16 } }
58
- data-testId = { `${ kebabCase ( label ) } ` }
59
- >
60
- { `${ label } ` }
61
- </ InputLabel >
62
- < DateTimePicker
63
- value = { dateTimeValue ? dateTimeValue : null }
64
- onChange = { handleDateTimeChange }
65
- views = { [ "year" , "day" , "hours" , "minutes" ] }
66
- disabled = { disabled }
67
- slotProps = { {
68
- textField : {
69
- id : "dateTime" ,
70
- sx : dateTimeTextFieldStyle ,
71
- } ,
72
- } }
73
- />
74
- </ LocalizationProvider >
75
- </ FormControl >
76
- ) ;
47
+ const DateTimeField = ( { label, dateTimeValue, handleDateTimeChange, disabled } ) => {
48
+ return (
49
+ < FormControl >
50
+ < LocalizationProvider dateAdapter = { AdapterDayjs } >
51
+ < InputLabel
52
+ style = { { marginBottom : 0 , height : 16 } }
53
+ data-testId = { `${ kebabCase ( label ) } ` }
54
+ >
55
+ { `${ label } ` }
56
+ </ InputLabel >
57
+ < DateTimePicker
58
+ value = { dateTimeValue ? dateTimeValue : null }
59
+ onChange = { handleDateTimeChange }
60
+ views = { [ "year" , "day" , "hours" , "minutes" ] }
61
+ disabled = { disabled }
62
+ slotProps = { {
63
+ textField : {
64
+ id : "dateTime" ,
65
+ sx : dateTimeTextFieldStyle ,
66
+ } ,
67
+ } }
68
+ />
69
+ </ LocalizationProvider >
70
+ </ FormControl >
71
+ ) ;
77
72
} ;
78
73
DateTimeField . propTypes = {
79
- dateTimeValue : PropTypes . object ,
80
- handleDateTimeChange : PropTypes . func . isRequired ,
81
- label : PropTypes . string . isRequired ,
82
- disabled : PropTypes . bool ,
74
+ dateTimeValue : PropTypes . object ,
75
+ handleDateTimeChange : PropTypes . func . isRequired ,
76
+ label : PropTypes . string . isRequired ,
77
+ disabled :PropTypes . bool
83
78
} ;
84
79
85
- export default DateTimeField ;
80
+ export default DateTimeField ;
0 commit comments