@campxdev/react-blueprint 2.3.9 → 2.3.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.
Files changed (26) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/cjs/types/src/components/Layout/AppLayout/components/AppBar.d.ts +2 -0
  3. package/dist/cjs/types/src/components/Layout/AppLayout/components/Sidebar/Sidebar.d.ts +8 -1
  4. package/dist/cjs/types/src/components/Layout/AppLayout/components/Sidebar/interfaces.d.ts +2 -0
  5. package/dist/cjs/types/src/components/Layout/AppLayout/components/UserProfilePopup.d.ts +2 -2
  6. package/dist/cjs/types/src/components/Layout/AppLayout/types.d.ts +2 -0
  7. package/dist/esm/index.js +2 -2
  8. package/dist/esm/types/src/components/Layout/AppLayout/components/AppBar.d.ts +2 -0
  9. package/dist/esm/types/src/components/Layout/AppLayout/components/Sidebar/Sidebar.d.ts +8 -1
  10. package/dist/esm/types/src/components/Layout/AppLayout/components/Sidebar/interfaces.d.ts +2 -0
  11. package/dist/esm/types/src/components/Layout/AppLayout/components/UserProfilePopup.d.ts +2 -2
  12. package/dist/esm/types/src/components/Layout/AppLayout/types.d.ts +2 -0
  13. package/dist/index.d.ts +4 -2
  14. package/package.json +1 -1
  15. package/src/components/DataDisplay/SidePanel/styles.tsx +1 -1
  16. package/src/components/Layout/AppLayout/AppLayout.tsx +5 -3
  17. package/src/components/Layout/AppLayout/components/AppBar.tsx +8 -3
  18. package/src/components/Layout/AppLayout/components/Sidebar/MenuBar.tsx +5 -1
  19. package/src/components/Layout/AppLayout/components/Sidebar/MenuItem.tsx +6 -1
  20. package/src/components/Layout/AppLayout/components/Sidebar/Sidebar.tsx +165 -45
  21. package/src/components/Layout/AppLayout/components/Sidebar/interfaces.ts +2 -0
  22. package/src/components/Layout/AppLayout/components/UserProfilePopup.tsx +4 -4
  23. package/src/components/Layout/AppLayout/types.ts +3 -0
  24. package/dist/cjs/types/src/components/Layout/AppLayout/components/PersistentSidebar.d.ts +0 -14
  25. package/dist/esm/types/src/components/Layout/AppLayout/components/PersistentSidebar.d.ts +0 -14
  26. package/src/components/Layout/AppLayout/components/PersistentSidebar.tsx +0 -171
@@ -1,171 +0,0 @@
1
- import {
2
- Box,
3
- IconButton,
4
- Stack,
5
- styled,
6
- useMediaQuery,
7
- useTheme,
8
- } from '@mui/material';
9
- import { AnimatePresence, motion } from 'framer-motion';
10
- import React, { useState } from 'react';
11
- import { CampxFullLogoIconV2 } from '../../../Assets/Icons/IconComponents/CampxFullLogoIconV2';
12
- import { CampxIconV2 } from '../../../Assets/Icons/IconComponents/CampxIconV2';
13
- import { Icons } from '../../../export';
14
- import { MenuBar } from './Sidebar/MenuBar';
15
- import { SideMenuItemProps } from './Sidebar/interfaces';
16
- import { useSidebarNavigation } from './Sidebar/useSidebarNavigation';
17
- import { UserProfilePopup, UserProfilePopupProps } from './UserProfilePopup';
18
-
19
- interface PersistentSidebarProps {
20
- /** Menu items for navigation */
21
- menu: SideMenuItemProps[];
22
-
23
- userProfileParams: UserProfilePopupProps;
24
- /** Whether the sidebar is collapsed */
25
- collapsed: boolean;
26
- /** Function to toggle sidebar collapse state */
27
- onToggle: () => void;
28
- }
29
-
30
- export const PersistentSidebar: React.FC<PersistentSidebarProps> = ({
31
- menu,
32
- userProfileParams,
33
- collapsed,
34
- onToggle,
35
- }) => {
36
- const theme = useTheme();
37
- const isSmallScreen = useMediaQuery(theme.breakpoints.down('md'));
38
- const [hovered, setHovered] = useState(false);
39
- // Use the navigation hook
40
- const navigation = useSidebarNavigation(menu);
41
-
42
- return (
43
- <>
44
- {/* Mobile overlay backdrop */}
45
- <AnimatePresence>
46
- {!collapsed && isSmallScreen && (
47
- <motion.div
48
- initial={{ opacity: 0 }}
49
- animate={{ opacity: 1 }}
50
- exit={{ opacity: 0 }}
51
- transition={{ duration: 0.2 }}
52
- style={{
53
- position: 'fixed',
54
- top: 0,
55
- left: 0,
56
- right: 0,
57
- bottom: 0,
58
- backgroundColor: 'rgba(0, 0, 0, 0.5)',
59
- zIndex: 1299,
60
- }}
61
- onClick={onToggle}
62
- />
63
- )}
64
- </AnimatePresence>
65
-
66
- {/* Persistent Sidebar */}
67
- <motion.div
68
- animate={{
69
- width: collapsed ? '64px' : '250px',
70
- x: isSmallScreen && collapsed ? '-100%' : '0%',
71
- }}
72
- transition={{ duration: 0.3, ease: [0.32, 0.72, 0, 1] }}
73
- style={{
74
- position: isSmallScreen ? 'fixed' : 'relative',
75
- zIndex: isSmallScreen ? 1300 : 1,
76
- height: '100vh',
77
- flexShrink: 0,
78
- }}
79
- >
80
- <SidebarContainer>
81
- {/* Sidebar Header */}
82
- <Stack
83
- direction="row"
84
- justifyContent="space-between"
85
- alignItems="center"
86
- sx={{
87
- height: '64px',
88
- padding: collapsed ? '0' : '0 16px',
89
- [theme.breakpoints.down('md')]: {
90
- height: '54px',
91
- },
92
- }}
93
- >
94
- {/* Logo - Show icon when collapsed, full logo when expanded */}
95
- {collapsed ? (
96
- <IconButton
97
- onClick={() => {
98
- setHovered(false);
99
- onToggle();
100
- }}
101
- onMouseEnter={() => setHovered(true)}
102
- onMouseLeave={() => setHovered(false)}
103
- sx={{
104
- width: '64px',
105
- height: '64px',
106
- borderRadius: 0,
107
- [theme.breakpoints.down('md')]: {
108
- height: '54px',
109
- width: '54px',
110
- },
111
- ':hover': { cursor: 'e-resize' },
112
- }}
113
- >
114
- {hovered ? <Icons.RightIcon size={24} /> : <CampxIconV2 />}
115
- </IconButton>
116
- ) : (
117
- <>
118
- <CampxFullLogoIconV2 />
119
- <IconButton onClick={onToggle}>
120
- <Icons.LeftIcon size={20} />
121
- </IconButton>
122
- </>
123
- )}
124
- </Stack>
125
-
126
- {/* Menu Content */}
127
- <motion.div
128
- key={`sidebar-${navigation.currentMenuState.title || 'main'}`}
129
- initial={{ x: navigation.menuPosition }}
130
- animate={{ x: 0 }}
131
- transition={{
132
- duration: 0.3,
133
- ease: navigation.menuPosition ? 'circOut' : 'circIn',
134
- }}
135
- style={{
136
- height: `calc(100% - 116px)`,
137
- width: '100%',
138
- }}
139
- >
140
- <MenuBar
141
- currentMenuState={navigation.currentMenuState}
142
- menuPosition={navigation.menuPosition}
143
- internalMenuClickHandler={navigation.internalMenuClickHandler}
144
- previousMenuClickHandler={navigation.previousMenuClickHandler}
145
- onClose={isSmallScreen ? onToggle : undefined}
146
- collapsed={collapsed}
147
- />
148
- </motion.div>
149
- <Box sx={{ position: 'fixed', bottom: 0, left: 0 }}>
150
- <UserProfilePopup
151
- userFullName={userProfileParams?.userFullName}
152
- designation={userProfileParams?.designation}
153
- onLogout={userProfileParams?.onLogout}
154
- onAccountClick={userProfileParams?.onAccountClick}
155
- profileActions={userProfileParams?.profileActions}
156
- collapsed={collapsed}
157
- />
158
- </Box>
159
- </SidebarContainer>
160
- </motion.div>
161
- </>
162
- );
163
- };
164
-
165
- const SidebarContainer = styled(Stack)(({ theme }: { theme?: any }) => ({
166
- height: '100%',
167
- backgroundColor: theme.palette.surface.paperBackground,
168
- flexDirection: 'column',
169
- overflow: 'hidden',
170
- borderRight: `1px solid ${theme.palette.divider}`,
171
- }));