@campxdev/campx-web-utils 0.2.6 → 0.2.8
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/export.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@campxdev/campx-web-utils",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"main": "./export.ts",
|
|
5
5
|
"private": false,
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@campxdev/react-blueprint": "^1.2.
|
|
7
|
+
"@campxdev/react-blueprint": "^1.2.1",
|
|
8
8
|
"@hookform/resolvers": "^3.9.0",
|
|
9
9
|
"@mui/x-date-pickers": "^7.12.1",
|
|
10
10
|
"@testing-library/jest-dom": "^5.14.1",
|
package/src/Layout/AppLayout.tsx
CHANGED
|
@@ -1,11 +1,65 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
AppHeader,
|
|
3
|
+
Icons,
|
|
4
|
+
MuiThemeProvider,
|
|
5
|
+
Sidebar,
|
|
6
|
+
Spinner,
|
|
7
|
+
} from '@campxdev/react-blueprint';
|
|
8
|
+
import { Box, Stack, useTheme } from '@mui/material';
|
|
9
|
+
import { Suspense, useState } from 'react';
|
|
10
|
+
import { ErrorBoundary } from '../context/export';
|
|
11
|
+
import {
|
|
12
|
+
SideMenuItemProps,
|
|
13
|
+
SubMenuItemProps,
|
|
14
|
+
} from '@campxdev/react-blueprint/src/components/Navigation/Sidebar/Sidebar';
|
|
15
|
+
|
|
16
|
+
interface Props {
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
menu: SideMenuItemProps[];
|
|
19
|
+
mainContainerSx?: any;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const AppLayout: React.FC<Props> = ({
|
|
23
|
+
children,
|
|
24
|
+
menu,
|
|
25
|
+
mainContainerSx,
|
|
26
|
+
}) => {
|
|
27
|
+
const [collapsed, setCollapsed] = useState(true);
|
|
28
|
+
const theme = useTheme();
|
|
2
29
|
|
|
3
|
-
const AppLayout = () => {
|
|
4
30
|
return (
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
31
|
+
<Stack
|
|
32
|
+
sx={{ backgroundColor: theme.palette.surface.defaultBackground }}
|
|
33
|
+
direction={'row'}
|
|
34
|
+
>
|
|
35
|
+
<Sidebar menu={menu} collapsed={collapsed} setCollapsed={setCollapsed} />
|
|
36
|
+
<Stack
|
|
37
|
+
margin="12px 12px 12px 0px"
|
|
38
|
+
gap="12px"
|
|
39
|
+
width={collapsed ? 'calc(100% - 84px)' : 'calc(100% - 278px)'}
|
|
40
|
+
>
|
|
41
|
+
<AppHeader
|
|
42
|
+
actions={[]}
|
|
43
|
+
collapsed={collapsed}
|
|
44
|
+
showActiveDevices={false}
|
|
45
|
+
clientName={''}
|
|
46
|
+
userFullName={''}
|
|
47
|
+
/>
|
|
48
|
+
<Box
|
|
49
|
+
sx={{
|
|
50
|
+
backgroundColor: theme.palette.surface.paperBackground,
|
|
51
|
+
borderRadius: '8px',
|
|
52
|
+
...mainContainerSx,
|
|
53
|
+
}}
|
|
54
|
+
onClick={() => {
|
|
55
|
+
setCollapsed(true);
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
<Suspense fallback={<Spinner />}>
|
|
59
|
+
<ErrorBoundary>{children}</ErrorBoundary>
|
|
60
|
+
</Suspense>
|
|
61
|
+
</Box>
|
|
62
|
+
</Stack>
|
|
63
|
+
</Stack>
|
|
8
64
|
);
|
|
9
65
|
};
|
|
10
|
-
|
|
11
|
-
export default AppLayout;
|
|
@@ -109,8 +109,8 @@ export const Login = ({ close }: { close: () => void }) => {
|
|
|
109
109
|
handleSubmit,
|
|
110
110
|
control,
|
|
111
111
|
formState: { errors },
|
|
112
|
-
} = useForm
|
|
113
|
-
resolver: yupResolver
|
|
112
|
+
} = useForm({
|
|
113
|
+
resolver: yupResolver(validationSchema),
|
|
114
114
|
});
|
|
115
115
|
|
|
116
116
|
const { mutate, isLoading } = useMutation(performLogin, {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { lightTheme, MuiThemeProvider } from '@campxdev/react-blueprint';
|
|
2
|
+
import { LocalizationProvider } from '@mui/x-date-pickers';
|
|
3
|
+
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3';
|
|
2
4
|
import Cookies from 'js-cookie';
|
|
3
5
|
import { ReactNode, useEffect } from 'react';
|
|
4
6
|
import { QueryClient, QueryClientProvider } from 'react-query';
|
|
@@ -46,9 +48,11 @@ export const Providers = ({
|
|
|
46
48
|
<QueryClientProvider client={queryClient}>
|
|
47
49
|
<MuiThemeProvider theme={theme}>
|
|
48
50
|
<SnackbarProvider>
|
|
49
|
-
<
|
|
50
|
-
<
|
|
51
|
-
|
|
51
|
+
<LocalizationProvider dateAdapter={AdapterDateFns}>
|
|
52
|
+
<ConfirmDialogProvider>
|
|
53
|
+
<ErrorBoundary>{children}</ErrorBoundary>
|
|
54
|
+
</ConfirmDialogProvider>
|
|
55
|
+
</LocalizationProvider>
|
|
52
56
|
</SnackbarProvider>
|
|
53
57
|
</MuiThemeProvider>
|
|
54
58
|
</QueryClientProvider>
|