@campxdev/react-blueprint 1.7.10 → 1.7.12
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/package.json +1 -1
- package/src/App.tsx +15 -71
- package/src/components/Assets/Icons/IconComponents/ScholarshipIcon.tsx +55 -0
- package/src/components/Assets/Icons/IconComponents/ThreeDotsMenuIcon.tsx +45 -0
- package/src/components/Assets/Icons/Icons.tsx +4 -0
- package/src/components/DataDisplay/Card/styles.tsx +1 -1
- package/src/components/Input/DateTimePicker/DateTimePicker.tsx +95 -0
- package/src/components/Input/FileUpload/FileUpload.tsx +215 -0
- package/src/components/Input/FormActions/FormActions.tsx +14 -10
- package/src/components/Input/FormControlWrapper/FormControlWrapper.tsx +12 -0
- package/src/components/Input/export.ts +2 -0
- package/src/components/Layout/AppHeader/AppHeader.tsx +14 -2
- package/src/components/Layout/AppHeader/styles/styles.tsx +10 -2
- package/src/components/Layout/PageContent/PageContent.tsx +19 -2
- package/src/components/Layout/StepperTitle/StepperTitle.tsx +39 -0
- package/src/components/Layout/export.ts +1 -0
- package/src/components/Navigation/PreviewFiles/PreviewFiles.tsx +10 -3
- package/src/stories/Input/DateTimePicker.stories.tsx +124 -0
- package/src/themes/commonTheme.ts +7 -0
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Button } from '@mui/material';
|
|
2
|
+
import { useForm } from 'react-hook-form';
|
|
3
|
+
|
|
3
4
|
import './App.css';
|
|
4
|
-
import {
|
|
5
|
+
import { FileUpload, FormControlWrapper } from './components/export';
|
|
5
6
|
|
|
6
7
|
interface RowType {
|
|
7
8
|
lastName: string;
|
|
@@ -10,82 +11,25 @@ interface RowType {
|
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
function App() {
|
|
14
|
+
const { control, watch, handleSubmit } = useForm({});
|
|
15
|
+
|
|
16
|
+
const onSubmit = (formData: any) => {
|
|
17
|
+
console.log(formData);
|
|
18
|
+
};
|
|
19
|
+
|
|
13
20
|
return (
|
|
14
21
|
<div
|
|
15
22
|
style={{
|
|
16
23
|
display: 'flex',
|
|
17
24
|
justifyContent: 'flex-start',
|
|
18
25
|
paddingLeft: '16px',
|
|
26
|
+
flexDirection: 'column',
|
|
19
27
|
}}
|
|
20
28
|
>
|
|
21
|
-
<
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
userName: 'ss',
|
|
26
|
-
action: 'create',
|
|
27
|
-
message: 's',
|
|
28
|
-
timestamp: new Date().toISOString(),
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
userName: 'ss',
|
|
32
|
-
action: 'update',
|
|
33
|
-
message: 's',
|
|
34
|
-
timestamp: new Date().toISOString(),
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
userName: 'ss',
|
|
38
|
-
action: 'update',
|
|
39
|
-
message: 's',
|
|
40
|
-
timestamp: new Date().toISOString(),
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
userName: 'ss',
|
|
44
|
-
action: 'update',
|
|
45
|
-
message: 's',
|
|
46
|
-
timestamp: new Date().toISOString(),
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
userName: 'ss',
|
|
50
|
-
action: 'update',
|
|
51
|
-
message: 's',
|
|
52
|
-
timestamp: new Date().toISOString(),
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
userName: 'ss',
|
|
56
|
-
action: 'delete',
|
|
57
|
-
message: 's',
|
|
58
|
-
timestamp: new Date().toISOString(),
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
userName: 'ss',
|
|
62
|
-
action: 'update',
|
|
63
|
-
message: 's',
|
|
64
|
-
timestamp: new Date().toISOString(),
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
userName: 'ss',
|
|
68
|
-
action: 'update',
|
|
69
|
-
message: 's',
|
|
70
|
-
timestamp: new Date().toISOString(),
|
|
71
|
-
},
|
|
72
|
-
]}
|
|
73
|
-
isFetchingNextPage={false}
|
|
74
|
-
fetchNextPage={function (): void {
|
|
75
|
-
// throw new Error('Function not implemented.');
|
|
76
|
-
}}
|
|
77
|
-
hasNextPage={undefined}
|
|
78
|
-
fromDate={null}
|
|
79
|
-
toDate={null}
|
|
80
|
-
setFromDate={function (date: Date | null): void {
|
|
81
|
-
// throw new Error('Function not implemented.');
|
|
82
|
-
}}
|
|
83
|
-
setToDate={function (date: Date | null): void {
|
|
84
|
-
// throw new Error('Function not implemented.');
|
|
85
|
-
}}
|
|
86
|
-
isLoading={false}
|
|
87
|
-
/>
|
|
88
|
-
</LocalizationProvider>
|
|
29
|
+
<FormControlWrapper control={control}>
|
|
30
|
+
<FileUpload label={'Files'} name="daaku" files={watch().daaku} />
|
|
31
|
+
</FormControlWrapper>
|
|
32
|
+
<Button onClick={handleSubmit(onSubmit)}>Submit</Button>
|
|
89
33
|
</div>
|
|
90
34
|
);
|
|
91
35
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useTheme } from '@mui/material';
|
|
2
|
+
|
|
3
|
+
const ScholarshipIcon = ({
|
|
4
|
+
color,
|
|
5
|
+
size = 16,
|
|
6
|
+
}: {
|
|
7
|
+
color?: string;
|
|
8
|
+
size?: number;
|
|
9
|
+
}) => {
|
|
10
|
+
const theme = useTheme();
|
|
11
|
+
color = color ?? theme.palette.text.black;
|
|
12
|
+
return (
|
|
13
|
+
<svg
|
|
14
|
+
width={size}
|
|
15
|
+
height={size}
|
|
16
|
+
viewBox="0 0 30 30"
|
|
17
|
+
fill="none"
|
|
18
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
19
|
+
>
|
|
20
|
+
<g clip-path="url(#clip0_4286_29361)">
|
|
21
|
+
<path
|
|
22
|
+
d="M15.0001 28.4369C14.614 28.4398 14.2313 28.365 13.8748 28.2168C13.5183 28.0686 13.1953 27.8501 12.9251 27.5744L11.0251 25.6744C10.8107 25.4997 10.5501 25.3911 10.2751 25.3619H7.57508C7.18919 25.3624 6.80698 25.2868 6.45037 25.1393C6.09375 24.9919 5.76973 24.7755 5.49686 24.5026C5.22398 24.2298 5.00763 23.9057 4.86018 23.5491C4.71273 23.1925 4.63709 22.8103 4.63758 22.4244V19.7244C4.6084 19.4494 4.49982 19.1888 4.32508 18.9744L2.42508 17.0744C2.15151 16.8026 1.93446 16.4793 1.78643 16.1231C1.6384 15.767 1.56232 15.3851 1.56258 14.9994C1.55966 14.6133 1.63452 14.2307 1.78271 13.8742C1.93089 13.5177 2.14936 13.1946 2.42508 12.9244L4.32508 11.0244C4.49982 10.81 4.6084 10.5494 4.63758 10.2744V7.57441C4.63709 7.18851 4.71273 6.80631 4.86018 6.44969C5.00763 6.09308 5.22398 5.76905 5.49686 5.49618C5.76973 5.22331 6.09375 5.00696 6.45037 4.85951C6.80698 4.71206 7.18919 4.63642 7.57508 4.63691H10.2751C10.5501 4.60773 10.8107 4.49915 11.0251 4.32441L12.9251 2.42441C13.4861 1.8947 14.2285 1.59961 15.0001 1.59961C15.7717 1.59961 16.514 1.8947 17.0751 2.42441L18.9751 4.32441C19.1895 4.49915 19.4501 4.60773 19.7251 4.63691H22.4251C22.811 4.63642 23.1932 4.71206 23.5498 4.85951C23.9064 5.00696 24.2304 5.22331 24.5033 5.49618C24.7762 5.76905 24.9925 6.09308 25.14 6.44969C25.2874 6.80631 25.3631 7.18851 25.3626 7.57441V10.2744C25.3918 10.5494 25.5003 10.81 25.6751 11.0244L27.5751 12.9244C27.8487 13.1963 28.0657 13.5196 28.2137 13.8757C28.3618 14.2318 28.4378 14.6137 28.4376 14.9994C28.4405 15.3855 28.3656 15.7682 28.2175 16.1247C28.0693 16.4812 27.8508 16.8042 27.5751 17.0744L25.6751 18.9744C25.5003 19.1888 25.3918 19.4494 25.3626 19.7244V22.4244C25.3631 22.8103 25.2874 23.1925 25.14 23.5491C24.9925 23.9057 24.7762 24.2298 24.5033 24.5026C24.2304 24.7755 23.9064 24.9919 23.5498 25.1393C23.1932 25.2868 22.811 25.3624 22.4251 25.3619H19.7251C19.4501 25.3911 19.1895 25.4997 18.9751 25.6744L17.0751 27.5744C16.8048 27.8501 16.4818 28.0686 16.1253 28.2168C15.7688 28.365 15.3861 28.4398 15.0001 28.4369ZM5.65008 17.6494C6.17686 18.2154 6.48292 18.9518 6.51258 19.7244V22.4244C6.51242 22.564 6.53979 22.7022 6.59313 22.8312C6.64646 22.9602 6.72472 23.0774 6.82341 23.1761C6.92211 23.2748 7.0393 23.353 7.16829 23.4064C7.29727 23.4597 7.43551 23.4871 7.57508 23.4869H10.2751C11.0478 23.5165 11.7841 23.8225 12.3501 24.3494L14.2501 26.2494C14.4523 26.442 14.7208 26.5494 15.0001 26.5494C15.2793 26.5494 15.5479 26.442 15.7501 26.2494L17.6501 24.3494C18.216 23.8225 18.9524 23.5165 19.7251 23.4869H22.4251C22.5647 23.4871 22.7029 23.4597 22.8319 23.4064C22.9609 23.353 23.0781 23.2748 23.1768 23.1761C23.2754 23.0774 23.3537 22.9602 23.407 22.8312C23.4604 22.7022 23.4877 22.564 23.4876 22.4244V19.7244C23.5172 18.9518 23.8233 18.2154 24.3501 17.6494L26.2501 15.7494C26.3491 15.6512 26.4277 15.5344 26.4813 15.4057C26.535 15.2769 26.5626 15.1389 26.5626 14.9994C26.5626 14.86 26.535 14.7219 26.4813 14.5932C26.4277 14.4644 26.3491 14.3476 26.2501 14.2494L24.3501 12.3494C23.8233 11.7834 23.5172 11.0471 23.4876 10.2744V7.57441C23.4877 7.43483 23.4604 7.2966 23.407 7.16761C23.3537 7.03863 23.2754 6.92144 23.1768 6.82274C23.0781 6.72405 22.9609 6.64579 22.8319 6.59245C22.7029 6.53912 22.5647 6.51175 22.4251 6.51191H19.7251C18.9524 6.48236 18.216 6.17628 17.6501 5.64941L15.7501 3.74941C15.5479 3.55683 15.2793 3.44941 15.0001 3.44941C14.7208 3.44941 14.4523 3.55683 14.2501 3.74941L12.3501 5.64941C11.7841 6.17628 11.0478 6.48236 10.2751 6.51191H7.57508C7.43551 6.51175 7.29727 6.53912 7.16829 6.59245C7.0393 6.64579 6.92211 6.72405 6.82341 6.82274C6.72472 6.92144 6.64646 7.03863 6.59313 7.16761C6.53979 7.2966 6.51242 7.43483 6.51258 7.57441V10.2744C6.48292 11.0471 6.17686 11.7834 5.65008 12.3494L3.75008 14.2494C3.65106 14.3476 3.57247 14.4644 3.51883 14.5932C3.4652 14.7219 3.43758 14.86 3.43758 14.9994C3.43758 15.1389 3.4652 15.2769 3.51883 15.4057C3.57247 15.5344 3.65106 15.6512 3.75008 15.7494L5.65008 17.6494Z"
|
|
23
|
+
fill={color}
|
|
24
|
+
stroke={color}
|
|
25
|
+
strokeWidth="0.4"
|
|
26
|
+
/>
|
|
27
|
+
<path
|
|
28
|
+
d="M18.7508 19.9999C18.503 20.0024 18.2601 19.9312 18.0529 19.7954C17.8457 19.6595 17.6836 19.4652 17.5871 19.237C17.4905 19.0088 17.464 18.7571 17.5108 18.5138C17.5576 18.2705 17.6757 18.0466 17.85 17.8706C18.0243 17.6945 18.247 17.5742 18.4898 17.5249C18.7326 17.4757 18.9846 17.4997 19.2137 17.5939C19.4428 17.6882 19.6388 17.8484 19.7767 18.0542C19.9146 18.26 19.9883 18.5022 19.9883 18.7499C19.9893 18.9133 19.958 19.0753 19.8963 19.2266C19.8347 19.3779 19.7437 19.5155 19.6288 19.6316C19.5138 19.7477 19.3771 19.84 19.2265 19.9032C19.0758 19.9664 18.9142 19.9993 18.7508 19.9999Z"
|
|
29
|
+
fill={color}
|
|
30
|
+
stroke={color}
|
|
31
|
+
strokeWidth="0.4"
|
|
32
|
+
/>
|
|
33
|
+
<path
|
|
34
|
+
d="M11.2625 12.4999C11.0148 12.5024 10.7719 12.4312 10.5647 12.2954C10.3575 12.1595 10.1953 11.9652 10.0988 11.737C10.0022 11.5088 9.9757 11.2571 10.0225 11.0138C10.0693 10.7705 10.1874 10.5466 10.3617 10.3706C10.536 10.1945 10.7587 10.0742 11.0015 10.0249C11.2443 9.9757 11.4963 9.99971 11.7254 10.0939C11.9546 10.1882 12.1505 10.3484 12.2884 10.5542C12.4264 10.76 12.5 11.0022 12.5 11.2499C12.501 11.4133 12.4697 11.5753 12.4081 11.7266C12.3464 11.8779 12.2555 12.0155 12.1405 12.1316C12.0256 12.2477 11.8888 12.34 11.7382 12.4032C11.5875 12.4664 11.4259 12.4993 11.2625 12.4999Z"
|
|
35
|
+
fill={color}
|
|
36
|
+
stroke={color}
|
|
37
|
+
strokeWidth="0.4"
|
|
38
|
+
/>
|
|
39
|
+
<path
|
|
40
|
+
d="M11.2486 19.6905C11.1254 19.6909 11.0034 19.6668 10.8897 19.6196C10.7759 19.5724 10.6727 19.503 10.5861 19.4155C10.412 19.2389 10.3145 19.0009 10.3145 18.753C10.3145 18.505 10.412 18.2671 10.5861 18.0905L18.0861 10.5905C18.2638 10.4249 18.4989 10.3347 18.7417 10.339C18.9846 10.3433 19.2163 10.4417 19.3881 10.6135C19.5599 10.7852 19.6583 11.017 19.6625 11.2598C19.6668 11.5027 19.5767 11.7378 19.4111 11.9155L11.9111 19.4155C11.8244 19.503 11.7212 19.5724 11.6075 19.6196C11.4937 19.6668 11.3717 19.6909 11.2486 19.6905Z"
|
|
41
|
+
fill={color}
|
|
42
|
+
stroke={color}
|
|
43
|
+
strokeWidth="0.4"
|
|
44
|
+
/>
|
|
45
|
+
</g>
|
|
46
|
+
<defs>
|
|
47
|
+
<clipPath id="clip0_4286_29361">
|
|
48
|
+
<rect width={size} height={size} fill="white" />
|
|
49
|
+
</clipPath>
|
|
50
|
+
</defs>
|
|
51
|
+
</svg>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default ScholarshipIcon;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useTheme } from '@mui/material';
|
|
2
|
+
|
|
3
|
+
export const ThreeDotsMenuIcon = ({
|
|
4
|
+
size = 16,
|
|
5
|
+
color,
|
|
6
|
+
backgroundColor,
|
|
7
|
+
}: {
|
|
8
|
+
size?: number;
|
|
9
|
+
color?: string;
|
|
10
|
+
backgroundColor?: string;
|
|
11
|
+
}) => {
|
|
12
|
+
const theme = useTheme();
|
|
13
|
+
const fill = color ?? theme.palette.primary.main;
|
|
14
|
+
const background = backgroundColor || theme.palette.secondary.main;
|
|
15
|
+
return (
|
|
16
|
+
<svg
|
|
17
|
+
width={size}
|
|
18
|
+
height={size}
|
|
19
|
+
viewBox="0 0 24 24"
|
|
20
|
+
fill="none"
|
|
21
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
22
|
+
>
|
|
23
|
+
<g clip-path="url(#clip0_462_9729)">
|
|
24
|
+
<rect width="24" height="24" rx="4" fill={background} />
|
|
25
|
+
<path
|
|
26
|
+
d="M16 11.9999C16 12.8836 16.7163 13.5999 17.6 13.5999C18.4836 13.5999 19.2 12.8836 19.2 11.9999C19.2 11.1162 18.4836 10.3999 17.6 10.3999C16.7163 10.3999 16 11.1162 16 11.9999Z"
|
|
27
|
+
fill={fill}
|
|
28
|
+
/>
|
|
29
|
+
<path
|
|
30
|
+
d="M10.4 11.9999C10.4 12.8836 11.1163 13.5999 12 13.5999C12.8836 13.5999 13.6 12.8836 13.6 11.9999C13.6 11.1162 12.8836 10.3999 12 10.3999C11.1163 10.3999 10.4 11.1162 10.4 11.9999Z"
|
|
31
|
+
fill={fill}
|
|
32
|
+
/>
|
|
33
|
+
<path
|
|
34
|
+
d="M4.8 11.9999C4.8 12.8836 5.51634 13.5999 6.4 13.5999C7.28366 13.5999 8 12.8836 8 11.9999C8 11.1162 7.28366 10.3999 6.4 10.3999C5.51634 10.3999 4.8 11.1162 4.8 11.9999Z"
|
|
35
|
+
fill={fill}
|
|
36
|
+
/>
|
|
37
|
+
</g>
|
|
38
|
+
<defs>
|
|
39
|
+
<clipPath id="clip0_462_9729">
|
|
40
|
+
<rect width="24" height="24" rx="4" fill="white" />
|
|
41
|
+
</clipPath>
|
|
42
|
+
</defs>
|
|
43
|
+
</svg>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
@@ -100,6 +100,7 @@ import { ResourcesIcon } from './IconComponents/ResourcesIcon';
|
|
|
100
100
|
import { RightIcon } from './IconComponents/RightIcon';
|
|
101
101
|
import { RouteIcon } from './IconComponents/RoutesIcon';
|
|
102
102
|
import { SaveIcon } from './IconComponents/SaveIcon';
|
|
103
|
+
import ScholarshipIcon from './IconComponents/ScholarshipIcon';
|
|
103
104
|
import { SearchIcon } from './IconComponents/SearchIcon';
|
|
104
105
|
import { SettlementsIcon } from './IconComponents/SettlementsIcon';
|
|
105
106
|
import { ShareIcon } from './IconComponents/ShareIcon';
|
|
@@ -110,6 +111,7 @@ import { StudentsIcon } from './IconComponents/StudentsIcon';
|
|
|
110
111
|
import { SuccessFilledIcon } from './IconComponents/SuccessFilledIcon';
|
|
111
112
|
import { TasksIcon } from './IconComponents/TasksIcon';
|
|
112
113
|
import { TextLocalIcon } from './IconComponents/TextLocalIcon';
|
|
114
|
+
import { ThreeDotsMenuIcon } from './IconComponents/ThreeDotsMenuIcon';
|
|
113
115
|
import { TicketSystemIcon } from './IconComponents/TicketingSystemIcon';
|
|
114
116
|
import { TicketsIcon } from './IconComponents/TicketsIcon';
|
|
115
117
|
import { TimeTableIcon } from './IconComponents/TimeTableIcon';
|
|
@@ -133,6 +135,7 @@ export const Icons = {
|
|
|
133
135
|
RedoIcon,
|
|
134
136
|
WhatsappIcon,
|
|
135
137
|
AssignmentIcon,
|
|
138
|
+
ThreeDotsMenuIcon,
|
|
136
139
|
ReportIssueIcon,
|
|
137
140
|
SmsIcon,
|
|
138
141
|
EmailIcon,
|
|
@@ -145,6 +148,7 @@ export const Icons = {
|
|
|
145
148
|
AddSquare,
|
|
146
149
|
DoneSquare,
|
|
147
150
|
ExpandIcon,
|
|
151
|
+
ScholarshipIcon,
|
|
148
152
|
AppsIcon,
|
|
149
153
|
CareerIcon,
|
|
150
154
|
ClogWheelIcon,
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { StackProps } from '@mui/material';
|
|
2
|
+
import {
|
|
3
|
+
DateTimePicker as MuiDateTimePicker,
|
|
4
|
+
DateTimePickerProps as MuiDateTimePickerProps,
|
|
5
|
+
PickersShortcutsItem,
|
|
6
|
+
PickerValidDate,
|
|
7
|
+
} from '@mui/x-date-pickers';
|
|
8
|
+
import { format as DateFnsFormat } from 'date-fns';
|
|
9
|
+
|
|
10
|
+
import { Icons } from '../../export';
|
|
11
|
+
import { LabelWrapper } from '../LabelWrapper/LabelWrapper';
|
|
12
|
+
|
|
13
|
+
type DateTimePickerProps<
|
|
14
|
+
TDate extends PickerValidDate,
|
|
15
|
+
TEnableAccessibleFieldDOMStructure extends boolean = false,
|
|
16
|
+
> = {
|
|
17
|
+
format?:
|
|
18
|
+
| 'yyyy'
|
|
19
|
+
| 'MMMM yyyy'
|
|
20
|
+
| 'MMM yyyy'
|
|
21
|
+
| 'dd MMMM yyyy'
|
|
22
|
+
| 'dd/MM/yyyy'
|
|
23
|
+
| 'MM/dd/yyyy'
|
|
24
|
+
| 'yyyy-MM-dd'
|
|
25
|
+
| 'yyyy-MM-dd hh:mm a'
|
|
26
|
+
| 'yyyy-MM-dd HH:mm'
|
|
27
|
+
| 'dd MMM yyyy HH:mm'
|
|
28
|
+
| 'dd MMM yyyy hh:mm a'
|
|
29
|
+
| 'dd/MM/yyyy hh:mm a'
|
|
30
|
+
| 'dd/MM/yyyy HH:mm'
|
|
31
|
+
| 'hh:mm a'
|
|
32
|
+
| 'HH:mm'
|
|
33
|
+
| 'hh:mm:ss a'
|
|
34
|
+
| 'HH:mm:ss'
|
|
35
|
+
| 'MMM dd, yyyy hh:mm a'
|
|
36
|
+
| 'MMMM dd, yyyy HH:mm'
|
|
37
|
+
| 'EEE, MMM dd yyyy'
|
|
38
|
+
| 'EEEE, MMMM dd, yyyy';
|
|
39
|
+
views?: ('year' | 'month' | 'day' | 'hours' | 'minutes' | 'seconds')[];
|
|
40
|
+
helperText?: string;
|
|
41
|
+
placeholder?: string;
|
|
42
|
+
shortcutsItems?: PickersShortcutsItem<any>[];
|
|
43
|
+
required?: boolean;
|
|
44
|
+
containerProps?: StackProps;
|
|
45
|
+
openPickerIcon?: React.ElementType;
|
|
46
|
+
} & MuiDateTimePickerProps<TDate, TEnableAccessibleFieldDOMStructure>;
|
|
47
|
+
|
|
48
|
+
export const DateTimePicker = <
|
|
49
|
+
TDate extends PickerValidDate,
|
|
50
|
+
TEnableAccessibleFieldDOMStructure extends boolean = false,
|
|
51
|
+
>({
|
|
52
|
+
label,
|
|
53
|
+
name,
|
|
54
|
+
required = false,
|
|
55
|
+
format = 'dd MMM yyyy hh:mm a',
|
|
56
|
+
views = ['year', 'month', 'day', 'hours', 'minutes', 'seconds'],
|
|
57
|
+
helperText,
|
|
58
|
+
placeholder = '',
|
|
59
|
+
shortcutsItems = [],
|
|
60
|
+
openPickerIcon: Icon = Icons.NoteIcon,
|
|
61
|
+
containerProps,
|
|
62
|
+
value,
|
|
63
|
+
...rest
|
|
64
|
+
}: DateTimePickerProps<TDate, TEnableAccessibleFieldDOMStructure>) => {
|
|
65
|
+
return (
|
|
66
|
+
<LabelWrapper
|
|
67
|
+
label={label}
|
|
68
|
+
required={required}
|
|
69
|
+
name={name}
|
|
70
|
+
containerProps={containerProps}
|
|
71
|
+
>
|
|
72
|
+
<MuiDateTimePicker
|
|
73
|
+
format={format}
|
|
74
|
+
views={views}
|
|
75
|
+
defaultValue={value}
|
|
76
|
+
slotProps={{
|
|
77
|
+
textField: {
|
|
78
|
+
helperText,
|
|
79
|
+
placeholder,
|
|
80
|
+
},
|
|
81
|
+
shortcuts: {
|
|
82
|
+
items: shortcutsItems,
|
|
83
|
+
},
|
|
84
|
+
}}
|
|
85
|
+
slots={{
|
|
86
|
+
openPickerIcon: Icon,
|
|
87
|
+
}}
|
|
88
|
+
dayOfWeekFormatter={(day: any) => {
|
|
89
|
+
return `${DateFnsFormat(day, 'EEEE').slice(0, 2)}.`;
|
|
90
|
+
}}
|
|
91
|
+
{...rest}
|
|
92
|
+
/>
|
|
93
|
+
</LabelWrapper>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Box,
|
|
3
|
+
FormLabel,
|
|
4
|
+
Stack,
|
|
5
|
+
styled,
|
|
6
|
+
SxProps,
|
|
7
|
+
useTheme,
|
|
8
|
+
} from '@mui/material';
|
|
9
|
+
import { IconButtons, Icons, PreviewFiles, Typography } from '../../export';
|
|
10
|
+
|
|
11
|
+
export type FileUploadProps = {
|
|
12
|
+
label: string;
|
|
13
|
+
name: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
files?: File[];
|
|
16
|
+
onChange?: (files: File[]) => void;
|
|
17
|
+
handleRemove?: (index: number) => void;
|
|
18
|
+
accept?: 'image/*' | '.pdf' | '.docx' | '.txt' | '*';
|
|
19
|
+
onInvalidFile?: (file: File) => void;
|
|
20
|
+
inputText?: string;
|
|
21
|
+
multiple?: boolean;
|
|
22
|
+
hideDeleteButton?: boolean;
|
|
23
|
+
errorText?: string;
|
|
24
|
+
sx?: SxProps;
|
|
25
|
+
showImage?: boolean;
|
|
26
|
+
previewSx?: SxProps;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const FileUpload = ({
|
|
30
|
+
label,
|
|
31
|
+
name = 'file-input',
|
|
32
|
+
disabled = false,
|
|
33
|
+
onChange,
|
|
34
|
+
handleRemove,
|
|
35
|
+
files = [],
|
|
36
|
+
accept = '*',
|
|
37
|
+
inputText,
|
|
38
|
+
onInvalidFile,
|
|
39
|
+
hideDeleteButton = false,
|
|
40
|
+
multiple = true,
|
|
41
|
+
errorText,
|
|
42
|
+
showImage,
|
|
43
|
+
previewSx,
|
|
44
|
+
sx,
|
|
45
|
+
}: FileUploadProps) => {
|
|
46
|
+
const theme = useTheme();
|
|
47
|
+
|
|
48
|
+
if (!onChange) {
|
|
49
|
+
return <Typography>onChange Missing</Typography>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
53
|
+
if (event.target.files) {
|
|
54
|
+
const newFiles = Array.from(event.target.files);
|
|
55
|
+
const validFiles: File[] = [];
|
|
56
|
+
const invalidFiles: File[] = [];
|
|
57
|
+
|
|
58
|
+
newFiles.forEach((file) => {
|
|
59
|
+
if (
|
|
60
|
+
accept === '*' ||
|
|
61
|
+
file.type.match(accept) ||
|
|
62
|
+
file.name.match(accept)
|
|
63
|
+
) {
|
|
64
|
+
validFiles.push(file);
|
|
65
|
+
} else {
|
|
66
|
+
invalidFiles.push(file);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
invalidFiles.forEach((file) => onInvalidFile?.(file));
|
|
71
|
+
|
|
72
|
+
if (validFiles.length > 0) {
|
|
73
|
+
if (multiple) {
|
|
74
|
+
onChange([...files, ...validFiles]);
|
|
75
|
+
} else {
|
|
76
|
+
onChange([validFiles[0]]);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<Stack sx={sx}>
|
|
84
|
+
<Typography variant="label1">{label}</Typography>
|
|
85
|
+
<input
|
|
86
|
+
accept={accept}
|
|
87
|
+
style={{ display: 'none' }}
|
|
88
|
+
id={name}
|
|
89
|
+
name={name}
|
|
90
|
+
type="file"
|
|
91
|
+
multiple={multiple}
|
|
92
|
+
disabled={disabled}
|
|
93
|
+
onChange={handleFileChange}
|
|
94
|
+
/>
|
|
95
|
+
|
|
96
|
+
<FormLabel htmlFor={name}>
|
|
97
|
+
<StyledFileSelectorContainer>
|
|
98
|
+
<Stack display={'flex'} alignItems={'center'}>
|
|
99
|
+
<Icons.ExportIcon size={20} />
|
|
100
|
+
<Typography
|
|
101
|
+
color={
|
|
102
|
+
disabled
|
|
103
|
+
? theme.palette.secondary.dark
|
|
104
|
+
: theme.palette.primary.main
|
|
105
|
+
}
|
|
106
|
+
variant="label2"
|
|
107
|
+
>
|
|
108
|
+
{inputText ?? 'Upload Files'}
|
|
109
|
+
</Typography>
|
|
110
|
+
</Stack>
|
|
111
|
+
</StyledFileSelectorContainer>
|
|
112
|
+
{errorText && (
|
|
113
|
+
<Typography
|
|
114
|
+
sx={{
|
|
115
|
+
display: 'flex',
|
|
116
|
+
alignItems: 'flex-end',
|
|
117
|
+
justifyContent: 'flex-end',
|
|
118
|
+
color: theme.palette.highlight.highlightRed,
|
|
119
|
+
}}
|
|
120
|
+
variant="caption"
|
|
121
|
+
>
|
|
122
|
+
{errorText}
|
|
123
|
+
</Typography>
|
|
124
|
+
)}
|
|
125
|
+
</FormLabel>
|
|
126
|
+
|
|
127
|
+
<Box display="flex" gap="12px" flexWrap="wrap">
|
|
128
|
+
{showImage ? (
|
|
129
|
+
files.map((file, index) => (
|
|
130
|
+
<StyledSelectedFileContainer key={index}>
|
|
131
|
+
<Box
|
|
132
|
+
sx={{
|
|
133
|
+
height: '120px',
|
|
134
|
+
display: 'flex',
|
|
135
|
+
overflow: 'hidden',
|
|
136
|
+
borderRadius: '8px',
|
|
137
|
+
}}
|
|
138
|
+
>
|
|
139
|
+
<img
|
|
140
|
+
src={URL.createObjectURL(file)}
|
|
141
|
+
style={{
|
|
142
|
+
height: '100%',
|
|
143
|
+
width: '100%',
|
|
144
|
+
objectFit: 'cover',
|
|
145
|
+
}}
|
|
146
|
+
alt={`Preview ${index}`}
|
|
147
|
+
/>
|
|
148
|
+
</Box>
|
|
149
|
+
|
|
150
|
+
{!disabled && !hideDeleteButton && (
|
|
151
|
+
<IconButtons.DeleteButton
|
|
152
|
+
onClick={() => {
|
|
153
|
+
const updatedFiles = [...files];
|
|
154
|
+
updatedFiles.splice(index, 1);
|
|
155
|
+
onChange(updatedFiles);
|
|
156
|
+
}}
|
|
157
|
+
size="small"
|
|
158
|
+
/>
|
|
159
|
+
)}
|
|
160
|
+
</StyledSelectedFileContainer>
|
|
161
|
+
))
|
|
162
|
+
) : (
|
|
163
|
+
<Box
|
|
164
|
+
sx={{
|
|
165
|
+
display: 'flex',
|
|
166
|
+
justifyContent: 'center',
|
|
167
|
+
alignItems: 'center',
|
|
168
|
+
padding: '8px',
|
|
169
|
+
overflow: 'hidden',
|
|
170
|
+
backgroundColor: theme.palette.background.default,
|
|
171
|
+
borderRadius: '8px',
|
|
172
|
+
}}
|
|
173
|
+
>
|
|
174
|
+
<PreviewFiles
|
|
175
|
+
sx={previewSx}
|
|
176
|
+
files={files}
|
|
177
|
+
onChange={(newFiles) => onChange?.(newFiles)}
|
|
178
|
+
/>
|
|
179
|
+
</Box>
|
|
180
|
+
)}
|
|
181
|
+
</Box>
|
|
182
|
+
</Stack>
|
|
183
|
+
);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const StyledSelectedFileContainer = styled(Box)(({ theme }) => ({
|
|
187
|
+
borderRadius: '10px',
|
|
188
|
+
position: 'relative',
|
|
189
|
+
flex: '1 1 auto',
|
|
190
|
+
textAlign: 'center',
|
|
191
|
+
marginTop: '5px',
|
|
192
|
+
minWidth: '400px',
|
|
193
|
+
'& > button': {
|
|
194
|
+
position: 'absolute',
|
|
195
|
+
right: '-4%',
|
|
196
|
+
top: '-10%',
|
|
197
|
+
},
|
|
198
|
+
}));
|
|
199
|
+
|
|
200
|
+
const StyledFileSelectorContainer = styled(Box)(({ theme }) => ({
|
|
201
|
+
border: '1.5px dotted',
|
|
202
|
+
height: '120px',
|
|
203
|
+
display: 'flex',
|
|
204
|
+
width: '100%',
|
|
205
|
+
borderRadius: '5px',
|
|
206
|
+
borderColor: theme.palette.primary.main,
|
|
207
|
+
justifyContent: 'center',
|
|
208
|
+
alignItems: 'center',
|
|
209
|
+
'&:hover': {
|
|
210
|
+
borderColor: theme.palette.primary.light,
|
|
211
|
+
backgroundColor: theme.palette.secondary.light,
|
|
212
|
+
transition:
|
|
213
|
+
'border-color 0.2s ease-in-out, background-color 0.2s ease-in-out',
|
|
214
|
+
},
|
|
215
|
+
}));
|
|
@@ -2,8 +2,8 @@ import { Stack, StackProps, useTheme } from '@mui/material';
|
|
|
2
2
|
import { Button, ButtonProps } from '../export';
|
|
3
3
|
|
|
4
4
|
export interface ButtonConfig extends ButtonProps {
|
|
5
|
-
title: string;
|
|
6
5
|
show?: boolean;
|
|
6
|
+
title?: string;
|
|
7
7
|
onClick?: () => void;
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -21,36 +21,40 @@ function FormActions({
|
|
|
21
21
|
showTopBorder = false,
|
|
22
22
|
}: FormActionsProps) {
|
|
23
23
|
const theme = useTheme();
|
|
24
|
+
|
|
24
25
|
const defaultSubmitProps: ButtonConfig = {
|
|
25
|
-
title: 'Submit',
|
|
26
26
|
show: true,
|
|
27
|
+
title: 'Submit',
|
|
27
28
|
variant: 'contained',
|
|
28
29
|
...submitButtonProps,
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
const defaultCancelProps: ButtonConfig = {
|
|
32
|
-
title: 'Cancel',
|
|
33
33
|
show: true,
|
|
34
|
+
title: 'Cancel',
|
|
34
35
|
variant: 'text',
|
|
35
36
|
disableRipple: true,
|
|
36
37
|
...cancelButtonProps,
|
|
37
38
|
};
|
|
38
39
|
|
|
40
|
+
const buttons = [defaultSubmitProps, defaultCancelProps].filter(
|
|
41
|
+
(button) => button.show,
|
|
42
|
+
);
|
|
43
|
+
|
|
39
44
|
return (
|
|
40
45
|
<Stack
|
|
41
46
|
direction="row"
|
|
42
47
|
borderTop={
|
|
43
48
|
showTopBorder ? `1px solid ${theme.palette.border.primary}` : 'none'
|
|
44
49
|
}
|
|
45
|
-
sx={{ p: '12px 16px' }}
|
|
50
|
+
sx={{ p: '12px 16px', gap: '12px' }}
|
|
46
51
|
{...stackProps}
|
|
47
52
|
>
|
|
48
|
-
{
|
|
49
|
-
<Button {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
)}
|
|
53
|
+
{buttons.map((button, index) => (
|
|
54
|
+
<Button key={index} {...button}>
|
|
55
|
+
{button.title}
|
|
56
|
+
</Button>
|
|
57
|
+
))}
|
|
54
58
|
</Stack>
|
|
55
59
|
);
|
|
56
60
|
}
|
|
@@ -2,6 +2,7 @@ import { Stack, SxProps } from '@mui/material';
|
|
|
2
2
|
import { TextFieldProps } from '@mui/material/TextField';
|
|
3
3
|
import React, { ReactElement, ReactNode, isValidElement } from 'react';
|
|
4
4
|
import { Control, Controller, FieldValues, Path } from 'react-hook-form';
|
|
5
|
+
import { FileUpload, FileUploadProps } from '../export';
|
|
5
6
|
import FormActions, { FormActionsProps } from '../FormActions/FormActions';
|
|
6
7
|
|
|
7
8
|
interface FormControlWrapperProps<T extends FieldValues = FieldValues> {
|
|
@@ -21,6 +22,8 @@ type ControlledElementProps<T extends FieldValues = FieldValues> = {
|
|
|
21
22
|
error?: boolean;
|
|
22
23
|
helperText?: ReactNode;
|
|
23
24
|
children?: ReactNode;
|
|
25
|
+
files?: File[];
|
|
26
|
+
onChange?: (files: File[]) => void;
|
|
24
27
|
[key: string]: any;
|
|
25
28
|
} & TextFieldProps;
|
|
26
29
|
|
|
@@ -47,10 +50,19 @@ export function FormControlWrapper<T extends FieldValues = FieldValues>({
|
|
|
47
50
|
name={name}
|
|
48
51
|
control={control}
|
|
49
52
|
render={({ field, fieldState: { error } }) => {
|
|
53
|
+
if (element.type === FileUpload) {
|
|
54
|
+
return React.cloneElement(element, {
|
|
55
|
+
...(restProps as Partial<FileUploadProps>),
|
|
56
|
+
files: field.value || [],
|
|
57
|
+
...field,
|
|
58
|
+
errorText: error ? error.message : undefined,
|
|
59
|
+
} as FileUploadProps);
|
|
60
|
+
}
|
|
50
61
|
const additionalProps =
|
|
51
62
|
element.type === 'input' && restProps.type === 'checkbox'
|
|
52
63
|
? { checked: field.value }
|
|
53
64
|
: { value: field.value };
|
|
65
|
+
console.log(error);
|
|
54
66
|
return React.cloneElement(element, {
|
|
55
67
|
...restProps,
|
|
56
68
|
...field,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './Button/Button';
|
|
2
2
|
export * from './DatePicker/DatePicker';
|
|
3
|
+
export * from './DateTimePicker/DateTimePicker';
|
|
4
|
+
export * from './FileUpload/FileUpload';
|
|
3
5
|
export * from './FormActions/FormActions';
|
|
4
6
|
export * from './FormControlWrapper/FormControlWrapper';
|
|
5
7
|
export * from './FormWrapper/FormWrapper';
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
IconButton,
|
|
3
|
+
Stack,
|
|
4
|
+
SxProps,
|
|
5
|
+
useMediaQuery,
|
|
6
|
+
useTheme,
|
|
7
|
+
} from '@mui/material';
|
|
2
8
|
import { ReactNode } from 'react';
|
|
3
9
|
import { ReportIssueIcon } from '../../Assets/Icons/IconComponents/ReportIssueIcon';
|
|
4
10
|
import { Typography } from '../../DataDisplay/Typography/Typography';
|
|
@@ -18,6 +24,7 @@ export interface AppHeaderProps {
|
|
|
18
24
|
profileSx?: any;
|
|
19
25
|
onLogoutClick?: any;
|
|
20
26
|
showActiveDevices?: boolean;
|
|
27
|
+
headerSx?: SxProps;
|
|
21
28
|
}
|
|
22
29
|
|
|
23
30
|
export const AppHeader = ({
|
|
@@ -31,6 +38,7 @@ export const AppHeader = ({
|
|
|
31
38
|
collapsed,
|
|
32
39
|
institutionsData,
|
|
33
40
|
showActiveDevices = true,
|
|
41
|
+
headerSx,
|
|
34
42
|
}: AppHeaderProps) => {
|
|
35
43
|
const theme = useTheme();
|
|
36
44
|
const isSmallScreen = useMediaQuery(theme.breakpoints.down('md'));
|
|
@@ -39,7 +47,11 @@ export const AppHeader = ({
|
|
|
39
47
|
window.open('https://helpdesk.campx.in/helpdesk/my-tickets', '_blank');
|
|
40
48
|
};
|
|
41
49
|
return (
|
|
42
|
-
<StyledHeader
|
|
50
|
+
<StyledHeader
|
|
51
|
+
collapsed={collapsed}
|
|
52
|
+
className="appHeader"
|
|
53
|
+
headerSx={headerSx}
|
|
54
|
+
>
|
|
43
55
|
<Typography variant={isSmallScreen ? 'subtitle3' : 'subtitle2'}>
|
|
44
56
|
{clientName}
|
|
45
57
|
</Typography>
|
|
@@ -2,7 +2,14 @@ import { Box, Divider, styled } from '@mui/material';
|
|
|
2
2
|
import { Link } from 'react-router-dom';
|
|
3
3
|
|
|
4
4
|
export const StyledHeader = styled('header')(
|
|
5
|
-
({
|
|
5
|
+
({
|
|
6
|
+
theme,
|
|
7
|
+
headerSx,
|
|
8
|
+
}: {
|
|
9
|
+
theme?: any;
|
|
10
|
+
collapsed: boolean;
|
|
11
|
+
headerSx?: any;
|
|
12
|
+
}) => ({
|
|
6
13
|
display: 'flex',
|
|
7
14
|
flexDirection: 'row',
|
|
8
15
|
alignItems: 'center',
|
|
@@ -17,10 +24,11 @@ export const StyledHeader = styled('header')(
|
|
|
17
24
|
[theme.breakpoints.down('md')]: {
|
|
18
25
|
height: '50px',
|
|
19
26
|
minHeight: '50px',
|
|
20
|
-
width: 'calc(100% - 84px)',
|
|
27
|
+
width: headerSx?.width?.sm ? headerSx?.width?.sm : 'calc(100% - 84px)',
|
|
21
28
|
marginTop: '12px',
|
|
22
29
|
padding: '0 12px',
|
|
23
30
|
},
|
|
31
|
+
...headerSx,
|
|
24
32
|
}),
|
|
25
33
|
);
|
|
26
34
|
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Box, BoxProps, styled } from '@mui/material';
|
|
2
2
|
|
|
3
|
+
export type PageContentProps = {
|
|
4
|
+
variant?: 'stepper' | 'standard';
|
|
5
|
+
} & BoxProps;
|
|
6
|
+
|
|
3
7
|
const PageContentContainer = styled(Box)(({ theme }) => ({
|
|
4
8
|
display: 'flex',
|
|
5
9
|
flexDirection: 'column',
|
|
@@ -11,8 +15,21 @@ const PageContentContainer = styled(Box)(({ theme }) => ({
|
|
|
11
15
|
borderRadius: '8px',
|
|
12
16
|
}));
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
const PageStepperContainer = styled(Box)(({ theme }) => ({
|
|
19
|
+
display: 'flex',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
flexDirection: 'column',
|
|
22
|
+
justifyContent: 'flex-start',
|
|
23
|
+
gap: '10px',
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
export const PageContent = ({
|
|
27
|
+
variant = 'standard',
|
|
28
|
+
...props
|
|
29
|
+
}: PageContentProps) => {
|
|
30
|
+
return variant == 'stepper' ? (
|
|
31
|
+
<PageStepperContainer {...props}>{props.children}</PageStepperContainer>
|
|
32
|
+
) : (
|
|
16
33
|
<PageContentContainer gap="12px" {...props}>
|
|
17
34
|
{props.children}
|
|
18
35
|
</PageContentContainer>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Box, BoxProps, styled } from '@mui/material';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { Typography } from '../../export';
|
|
4
|
+
|
|
5
|
+
export type StepperTitleProps = {
|
|
6
|
+
title?: string;
|
|
7
|
+
isShowTitle?: boolean;
|
|
8
|
+
content: ReactNode;
|
|
9
|
+
contentProps?: BoxProps;
|
|
10
|
+
titleProps?: BoxProps;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const StepperTitleContainer = styled(Box)(({ theme }) => ({
|
|
14
|
+
borderRadius: '8px',
|
|
15
|
+
minHeight: '100px',
|
|
16
|
+
minWidth: '60%',
|
|
17
|
+
backgroundColor: theme.palette.surface.paperBackground,
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
const TitleContainer = styled(Box)(({ theme }) => ({
|
|
21
|
+
backgroundColor: theme.palette.surface.grey,
|
|
22
|
+
height: '45px',
|
|
23
|
+
display: 'flex',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
paddingLeft: '16px',
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
export const StepperTitle = (props: StepperTitleProps) => {
|
|
29
|
+
return (
|
|
30
|
+
<StepperTitleContainer {...props.contentProps}>
|
|
31
|
+
{props.isShowTitle && (
|
|
32
|
+
<TitleContainer {...props.titleProps}>
|
|
33
|
+
<Typography variant="subtitle3">{props.title}</Typography>
|
|
34
|
+
</TitleContainer>
|
|
35
|
+
)}
|
|
36
|
+
{props.content}
|
|
37
|
+
</StepperTitleContainer>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
@@ -2,4 +2,5 @@ export * from './AppHeader/AppHeader';
|
|
|
2
2
|
export * from './PageContent/PageContent';
|
|
3
3
|
export * from './PageHeader/components/DensitySelector/DensitySelector';
|
|
4
4
|
export * from './PageHeader/PageHeader';
|
|
5
|
+
export * from './StepperTitle/StepperTitle';
|
|
5
6
|
export * from './TabsLayout/TabsLayout';
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
IconButton,
|
|
5
5
|
Stack,
|
|
6
6
|
styled,
|
|
7
|
+
SxProps,
|
|
7
8
|
Typography,
|
|
8
9
|
useTheme,
|
|
9
10
|
} from '@mui/material';
|
|
@@ -15,6 +16,7 @@ export type PreviewFilesProps = {
|
|
|
15
16
|
label?: string;
|
|
16
17
|
onChange?: (newFiles: File[], deletedFile: File) => void;
|
|
17
18
|
showDownload?: boolean;
|
|
19
|
+
sx?: SxProps;
|
|
18
20
|
} & Omit<BoxProps, 'onChange'>;
|
|
19
21
|
|
|
20
22
|
export const PreviewFiles = ({
|
|
@@ -22,6 +24,7 @@ export const PreviewFiles = ({
|
|
|
22
24
|
label,
|
|
23
25
|
onChange,
|
|
24
26
|
showDownload,
|
|
27
|
+
sx,
|
|
25
28
|
...props
|
|
26
29
|
}: PreviewFilesProps) => {
|
|
27
30
|
const theme = useTheme(),
|
|
@@ -86,7 +89,7 @@ export const PreviewFiles = ({
|
|
|
86
89
|
if (resolvedFiles.length === 0) return <></>;
|
|
87
90
|
|
|
88
91
|
return (
|
|
89
|
-
<Box {...props}>
|
|
92
|
+
<Box sx={sx} {...props}>
|
|
90
93
|
{label && (
|
|
91
94
|
<Typography
|
|
92
95
|
marginBottom={'8px'}
|
|
@@ -103,12 +106,16 @@ export const PreviewFiles = ({
|
|
|
103
106
|
direction={'row'}
|
|
104
107
|
sx={{ display: 'flex', alignItems: 'center', gap: '12px' }}
|
|
105
108
|
>
|
|
106
|
-
{
|
|
109
|
+
<Box width={'30px'} height={'30px'}>
|
|
110
|
+
{getFileIcon(file)}
|
|
111
|
+
</Box>
|
|
112
|
+
|
|
107
113
|
<Stack direction={'column'} marginLeft={'8px'}>
|
|
108
114
|
<Typography
|
|
109
115
|
fontSize={'14px'}
|
|
110
116
|
color={theme.palette.primary.main}
|
|
111
117
|
variant="label2"
|
|
118
|
+
sx={{ wordBreak: 'break-all' }}
|
|
112
119
|
>
|
|
113
120
|
{file.name}
|
|
114
121
|
</Typography>
|
|
@@ -149,7 +156,7 @@ export const PreviewFiles = ({
|
|
|
149
156
|
|
|
150
157
|
const PreviewContainer = styled(Box)(({ theme }) => ({
|
|
151
158
|
width: '100%',
|
|
152
|
-
|
|
159
|
+
minHeight: '60px',
|
|
153
160
|
cursor: 'pointer',
|
|
154
161
|
backgroundColor: theme.palette.secondary.light,
|
|
155
162
|
padding: '16px 8px',
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { LocalizationProvider } from '@mui/x-date-pickers';
|
|
2
|
+
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3';
|
|
3
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
4
|
+
import { add } from 'date-fns';
|
|
5
|
+
import { DateTimePicker, Icons } from '../../components/export';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof DateTimePicker> = {
|
|
8
|
+
title: 'Input/DateTimePicker',
|
|
9
|
+
component: DateTimePicker,
|
|
10
|
+
decorators: [
|
|
11
|
+
(Story) => (
|
|
12
|
+
<LocalizationProvider dateAdapter={AdapterDateFns}>
|
|
13
|
+
<Story />
|
|
14
|
+
</LocalizationProvider>
|
|
15
|
+
),
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default meta;
|
|
20
|
+
|
|
21
|
+
type Story = StoryObj<typeof DateTimePicker>;
|
|
22
|
+
|
|
23
|
+
const shortcutsItems = [
|
|
24
|
+
{ label: 'Now', getValue: () => new Date() },
|
|
25
|
+
{ label: '1 Hour Later', getValue: () => add(new Date(), { hours: 1 }) },
|
|
26
|
+
{ label: '1 Hour Ago', getValue: () => add(new Date(), { hours: -1 }) },
|
|
27
|
+
{
|
|
28
|
+
label: 'New Year',
|
|
29
|
+
getValue: () => new Date(new Date().getFullYear(), 0, 1, 0, 0),
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
export const Primary: Story = {
|
|
34
|
+
args: {
|
|
35
|
+
label: 'Date Time Picker',
|
|
36
|
+
name: 'date-time-picker',
|
|
37
|
+
placeholder: 'Select Date and Time',
|
|
38
|
+
required: true,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const WithShortcuts: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
...Primary.args,
|
|
45
|
+
label: 'With Shortcuts',
|
|
46
|
+
shortcutsItems,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const CustomFormat: Story = {
|
|
51
|
+
args: {
|
|
52
|
+
...Primary.args,
|
|
53
|
+
label: 'Custom Format',
|
|
54
|
+
format: 'MMM dd, yyyy hh:mm a',
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const ViewsYearMonth: Story = {
|
|
59
|
+
args: {
|
|
60
|
+
...Primary.args,
|
|
61
|
+
label: 'Year and Month Views',
|
|
62
|
+
views: ['year', 'month'],
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const WithHelperText: Story = {
|
|
67
|
+
args: {
|
|
68
|
+
...Primary.args,
|
|
69
|
+
label: 'With Helper Text',
|
|
70
|
+
helperText: 'Please select a valid date and time',
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const MinMaxDates: Story = {
|
|
75
|
+
args: {
|
|
76
|
+
...Primary.args,
|
|
77
|
+
label: 'With Min and Max Dates',
|
|
78
|
+
minDate: new Date('2024-01-01'),
|
|
79
|
+
maxDate: new Date('2024-12-31'),
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const CustomIcon: Story = {
|
|
84
|
+
args: {
|
|
85
|
+
...Primary.args,
|
|
86
|
+
label: 'With Custom Icon',
|
|
87
|
+
openPickerIcon: Icons.CareerIcon,
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const ReadOnly: Story = {
|
|
92
|
+
args: {
|
|
93
|
+
...Primary.args,
|
|
94
|
+
label: 'Read Only',
|
|
95
|
+
required: false,
|
|
96
|
+
disabled: true,
|
|
97
|
+
value: new Date('2024-09-15 14:30'),
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export const DisableFutureDates: Story = {
|
|
102
|
+
args: {
|
|
103
|
+
...Primary.args,
|
|
104
|
+
label: 'Disable Future Dates',
|
|
105
|
+
disableFuture: true,
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export const DisablePastDates: Story = {
|
|
110
|
+
args: {
|
|
111
|
+
...Primary.args,
|
|
112
|
+
label: 'Disable Past Dates',
|
|
113
|
+
disablePast: true,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export const DisableSpecificDates: Story = {
|
|
118
|
+
args: {
|
|
119
|
+
...Primary.args,
|
|
120
|
+
label: 'Disable Weekends',
|
|
121
|
+
shouldDisableDate: (date: Date) =>
|
|
122
|
+
date.getDay() === 0 || date.getDay() === 6,
|
|
123
|
+
},
|
|
124
|
+
};
|
|
@@ -334,6 +334,10 @@ export const getCommonTheme = (mode: Theme) => {
|
|
|
334
334
|
fontSize: '14px ',
|
|
335
335
|
fontFamily: 'Poppins',
|
|
336
336
|
fontWeight: 600,
|
|
337
|
+
'@media (max-width:959.95px)': {
|
|
338
|
+
fontSize: '12px',
|
|
339
|
+
padding: '6px 12px ',
|
|
340
|
+
},
|
|
337
341
|
'&:hover': {
|
|
338
342
|
boxShadow: 'none ',
|
|
339
343
|
'@media (hover: none )': {
|
|
@@ -558,6 +562,9 @@ export const getCommonTheme = (mode: Theme) => {
|
|
|
558
562
|
minHeight: '50px',
|
|
559
563
|
paddingBottom: '0px',
|
|
560
564
|
justifyContent: 'flex-start',
|
|
565
|
+
'@media (max-width:959.95px)': {
|
|
566
|
+
fontSize: '12px',
|
|
567
|
+
},
|
|
561
568
|
'&.Mui-selected': {
|
|
562
569
|
color: ColorTokens.text.primary,
|
|
563
570
|
},
|