@campxdev/campx-web-utils 0.2.8 → 0.2.10

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 CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@campxdev/campx-web-utils",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "main": "./export.ts",
5
5
  "private": false,
6
6
  "dependencies": {
7
- "@campxdev/react-blueprint": "^1.2.1",
7
+ "@campxdev/react-blueprint": "^1.2.3",
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",
@@ -15,6 +15,7 @@
15
15
  "@types/react": "^18.0.0",
16
16
  "@types/react-dom": "^18.0.0",
17
17
  "axios": "^1.7.2",
18
+ "framer-motion": "^11.3.21",
18
19
  "cookie-js": "^0.0.1",
19
20
  "date-fns": "^3.6.0",
20
21
  "device-detector-js": "^3.0.3",
@@ -26,6 +27,7 @@
26
27
  "react-scripts": "5.0.1",
27
28
  "react-toastify": "^9.0.1",
28
29
  "typescript": "^4.4.2",
30
+ "uuid": "^10.0.0",
29
31
  "web-vitals": "^2.1.0",
30
32
  "yup": "^1.4.0"
31
33
  },
@@ -1,17 +1,9 @@
1
- import {
2
- AppHeader,
3
- Icons,
4
- MuiThemeProvider,
5
- Sidebar,
6
- Spinner,
7
- } from '@campxdev/react-blueprint';
1
+ import { AppHeader, Sidebar, Spinner } from '@campxdev/react-blueprint';
2
+ import { SideMenuItemProps } from '@campxdev/react-blueprint/src/components/Navigation/Sidebar/Sidebar';
8
3
  import { Box, Stack, useTheme } from '@mui/material';
4
+ import { motion } from 'framer-motion';
9
5
  import { Suspense, useState } from 'react';
10
6
  import { ErrorBoundary } from '../context/export';
11
- import {
12
- SideMenuItemProps,
13
- SubMenuItemProps,
14
- } from '@campxdev/react-blueprint/src/components/Navigation/Sidebar/Sidebar';
15
7
 
16
8
  interface Props {
17
9
  children?: React.ReactNode;
@@ -33,33 +25,56 @@ export const AppLayout: React.FC<Props> = ({
33
25
  direction={'row'}
34
26
  >
35
27
  <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)'}
28
+ <motion.div
29
+ animate={{
30
+ width: collapsed ? 'calc(100% - 84px)' : 'calc(100% - 278px)',
31
+ }}
32
+ transition={{ duration: 0.3, ease: 'circOut' }}
33
+ style={{
34
+ margin: '12px 12px 12px 0px',
35
+ width: 'calc(100% - 84px)',
36
+ }}
40
37
  >
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>
38
+ <Stack gap="12px">
39
+ <AppHeader
40
+ actions={[]}
41
+ collapsed={collapsed}
42
+ showActiveDevices={false}
43
+ clientName={''}
44
+ userFullName={''}
45
+ />
46
+ <Box
47
+ sx={{
48
+ // backgroundColor: theme.palette.surface.paperBackground,
49
+ borderRadius: '8px',
50
+ height: 'calc(100vh - 96px)',
51
+ overflowY: 'scroll',
52
+ paddingRight: '8px',
53
+ '&::-webkit-scrollbar': {
54
+ width: '0.5em',
55
+ height: '0.2em',
56
+ },
57
+
58
+ '&::-webkit-scrollbar-thumb': {
59
+ backgroundColor: theme.palette.primary.light,
60
+ borderRadius: '3px',
61
+
62
+ '&:hover': {
63
+ backgroundColor: theme.palette.primary.main,
64
+ },
65
+ },
66
+ ...mainContainerSx,
67
+ }}
68
+ onClick={() => {
69
+ setCollapsed(true);
70
+ }}
71
+ >
72
+ <Suspense fallback={<Spinner />}>
73
+ <ErrorBoundary>{children}</ErrorBoundary>
74
+ </Suspense>
75
+ </Box>
76
+ </Stack>
77
+ </motion.div>
63
78
  </Stack>
64
79
  );
65
80
  };
@@ -1,11 +1,11 @@
1
1
  import { Navigate } from 'react-router-dom';
2
2
  import AppContent from '../AppContent';
3
- import AppLayout from '../Layout/AppLayout';
3
+ import { AppLayout } from '../Layout/AppLayout';
4
4
 
5
5
  export const mainRoutes = [
6
6
  {
7
7
  path: '/',
8
- element: <AppLayout />,
8
+ element: <AppLayout menu={[]} />,
9
9
  children: [
10
10
  {
11
11
  index: true,
@@ -9,6 +9,8 @@ interface ConfirmStateProps {
9
9
  onConfirm: () => void,
10
10
  onCancel: () => void,
11
11
  type?: ConfirmDialogType,
12
+ confirmButtonText?: string,
13
+ cancelButtonText?: string,
12
14
  ) => void;
13
15
  }
14
16
 
@@ -29,6 +31,8 @@ export const ConfirmDialogProvider = ({
29
31
  onConfirm: () => void,
30
32
  onCancel: () => void,
31
33
  type: ConfirmDialogType = 'confirm',
34
+ confirmButtonText?: string,
35
+ cancelButtonText?: string,
32
36
  ) => {
33
37
  ApplicationStore.update((s) => {
34
38
  s.confirmDialog = {
@@ -38,6 +42,8 @@ export const ConfirmDialogProvider = ({
38
42
  onConfirm,
39
43
  onCancel,
40
44
  type,
45
+ confirmButtonText,
46
+ cancelButtonText,
41
47
  };
42
48
  });
43
49
  };
@@ -56,6 +62,8 @@ export const ConfirmDialogProvider = ({
56
62
  title={confirmDialog.title}
57
63
  message={confirmDialog.message}
58
64
  type={confirmDialog.type}
65
+ confirmButtonText={confirmDialog.confirmButtonText}
66
+ cancelButtonText={confirmDialog.cancelButtonText}
59
67
  onConfirm={() => {
60
68
  confirmDialog.onConfirm();
61
69
  handleCloseDialog();
@@ -15,6 +15,8 @@ export type ApplicationStoreType = {
15
15
  onConfirm: () => void;
16
16
  onCancel: () => void;
17
17
  type: ConfirmDialogType;
18
+ confirmButtonText?: string;
19
+ cancelButtonText?: string;
18
20
  };
19
21
  };
20
22
 
@@ -5,6 +5,8 @@ const defaultConfirmDialogState = {
5
5
  isOpen: false,
6
6
  title: '',
7
7
  message: '',
8
+ confirmButtonText: '',
9
+ cancelButtonText: '',
8
10
  type: 'confirm' as ConfirmDialogType,
9
11
  onConfirm: () => {},
10
12
  onCancel: () => {},
@@ -14,10 +16,14 @@ const useConfirm = () => {
14
16
  const isConfirmed = ({
15
17
  title,
16
18
  message,
19
+ confirmButtonText,
20
+ cancelButtonText,
17
21
  type = 'confirm',
18
22
  }: {
19
23
  title: string;
20
24
  message: string;
25
+ confirmButtonText?: string;
26
+ cancelButtonText?: string;
21
27
  type?: ConfirmDialogType;
22
28
  }): Promise<boolean> =>
23
29
  new Promise((resolve) => {
@@ -26,6 +32,8 @@ const useConfirm = () => {
26
32
  isOpen: true,
27
33
  title,
28
34
  message,
35
+ confirmButtonText,
36
+ cancelButtonText,
29
37
  type,
30
38
  onConfirm: () => {
31
39
  resolve(true);
package/tsconfig.json CHANGED
@@ -18,5 +18,5 @@
18
18
  "types": ["node"]
19
19
  },
20
20
  "include": ["src", "./types"],
21
- "exclude": ["node_modules", ".yalc"]
21
+ "exclude": [".yalc"]
22
22
  }