@applica-software-guru/react-admin 1.1.93 → 1.1.95

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 (156) hide show
  1. package/dist/components/AuthWrapper.d.ts.map +1 -1
  2. package/dist/components/Layout/Content.d.ts +5 -0
  3. package/dist/components/Layout/Content.d.ts.map +1 -0
  4. package/dist/components/Layout/Drawer/Drawer.d.ts +8 -0
  5. package/dist/components/Layout/Drawer/Drawer.d.ts.map +1 -0
  6. package/dist/components/Layout/Drawer/DrawerHeader.d.ts +8 -0
  7. package/dist/components/Layout/Drawer/DrawerHeader.d.ts.map +1 -0
  8. package/dist/components/Layout/Drawer/DrawerHeaderStyled.d.ts +4 -0
  9. package/dist/components/Layout/Drawer/DrawerHeaderStyled.d.ts.map +1 -0
  10. package/dist/components/Layout/Drawer/index.d.ts +3 -18
  11. package/dist/components/Layout/Drawer/index.d.ts.map +1 -1
  12. package/dist/components/Layout/Footer.d.ts +11 -10
  13. package/dist/components/Layout/Footer.d.ts.map +1 -1
  14. package/dist/components/Layout/Header/DrawerToggle.d.ts +3 -0
  15. package/dist/components/Layout/Header/DrawerToggle.d.ts.map +1 -0
  16. package/dist/components/Layout/Header/Header.d.ts +8 -0
  17. package/dist/components/Layout/Header/Header.d.ts.map +1 -0
  18. package/dist/components/Layout/Header/Notification/Notification.d.ts +3 -0
  19. package/dist/components/Layout/Header/Notification/Notification.d.ts.map +1 -0
  20. package/dist/components/Layout/Header/Notification/NotificationItem.d.ts +19 -0
  21. package/dist/components/Layout/Header/Notification/NotificationItem.d.ts.map +1 -0
  22. package/dist/components/Layout/Header/Notification/index.d.ts +2 -0
  23. package/dist/components/Layout/Header/Notification/index.d.ts.map +1 -0
  24. package/dist/components/Layout/Header/Profile/Profile.d.ts.map +1 -0
  25. package/dist/components/Layout/Header/Profile/buttons/ChangePasswordButton.d.ts.map +1 -0
  26. package/dist/components/Layout/Header/Profile/buttons/LogoutButton.d.ts.map +1 -0
  27. package/dist/components/Layout/Header/Profile/buttons/StopImpersonateButton.d.ts.map +1 -0
  28. package/dist/components/Layout/Header/Profile/buttons/index.d.ts.map +1 -0
  29. package/dist/components/Layout/Header/Profile/index.d.ts +2 -0
  30. package/dist/components/Layout/Header/Profile/index.d.ts.map +1 -0
  31. package/dist/components/Layout/Header/ResponsiveSection.d.ts +5 -0
  32. package/dist/components/Layout/Header/ResponsiveSection.d.ts.map +1 -0
  33. package/dist/components/Layout/Header/Spacer.d.ts +5 -0
  34. package/dist/components/Layout/Header/Spacer.d.ts.map +1 -0
  35. package/dist/components/Layout/Header/index.d.ts +7 -20
  36. package/dist/components/Layout/Header/index.d.ts.map +1 -1
  37. package/dist/components/Layout/HorizontalBar.d.ts +5 -0
  38. package/dist/components/Layout/HorizontalBar.d.ts.map +1 -0
  39. package/dist/components/Layout/Layout.d.ts +19 -0
  40. package/dist/components/Layout/Layout.d.ts.map +1 -0
  41. package/dist/components/Layout/NavMenu.d.ts +5 -0
  42. package/dist/components/Layout/NavMenu.d.ts.map +1 -0
  43. package/dist/components/Layout/Navigation/NavCollapse.d.ts.map +1 -0
  44. package/dist/components/Layout/{Drawer/DrawerContent/Navigation → Navigation}/NavGroup.d.ts +2 -3
  45. package/dist/components/Layout/Navigation/NavGroup.d.ts.map +1 -0
  46. package/dist/components/Layout/Navigation/NavItem.d.ts.map +1 -0
  47. package/dist/components/Layout/Navigation/Navigation.d.ts +7 -0
  48. package/dist/components/Layout/Navigation/Navigation.d.ts.map +1 -0
  49. package/dist/components/Layout/Navigation/index.d.ts +2 -0
  50. package/dist/components/Layout/Navigation/index.d.ts.map +1 -0
  51. package/dist/components/Layout/Provider.d.ts +84 -0
  52. package/dist/components/Layout/Provider.d.ts.map +1 -0
  53. package/dist/components/Layout/Wrapper.d.ts +6 -0
  54. package/dist/components/Layout/Wrapper.d.ts.map +1 -0
  55. package/dist/components/Layout/index.d.ts +10 -22
  56. package/dist/components/Layout/index.d.ts.map +1 -1
  57. package/dist/components/ra-inputs/AutocompleteArrayInput.d.ts +1 -0
  58. package/dist/components/ra-inputs/AutocompleteArrayInput.d.ts.map +1 -1
  59. package/dist/components/ra-inputs/AutocompleteInput.d.ts +1 -0
  60. package/dist/components/ra-inputs/AutocompleteInput.d.ts.map +1 -1
  61. package/dist/components/ra-lists/List.d.ts.map +1 -1
  62. package/dist/hooks/index.d.ts +2 -0
  63. package/dist/hooks/index.d.ts.map +1 -1
  64. package/dist/hooks/mui.d.ts +7 -0
  65. package/dist/hooks/mui.d.ts.map +1 -0
  66. package/dist/hooks/useRefDimensions.d.ts +13 -0
  67. package/dist/hooks/useRefDimensions.d.ts.map +1 -0
  68. package/dist/react-admin.cjs.js +101 -92
  69. package/dist/react-admin.cjs.js.map +1 -1
  70. package/dist/react-admin.es.js +23530 -20993
  71. package/dist/react-admin.es.js.map +1 -1
  72. package/dist/react-admin.umd.js +102 -93
  73. package/dist/react-admin.umd.js.map +1 -1
  74. package/dist/style.css +1 -1
  75. package/package.json +1 -1
  76. package/src/components/AuthWrapper.jsx +1 -1
  77. package/src/components/Layout/Content.tsx +30 -0
  78. package/src/components/Layout/Drawer/Drawer.tsx +61 -0
  79. package/src/components/Layout/Drawer/DrawerHeader.tsx +31 -0
  80. package/src/components/Layout/Drawer/{DrawerHeader/DrawerHeaderStyled.jsx → DrawerHeaderStyled.jsx} +1 -1
  81. package/src/components/Layout/Drawer/index.ts +3 -0
  82. package/src/components/Layout/Footer.tsx +26 -0
  83. package/src/components/Layout/Header/DrawerToggle.tsx +28 -0
  84. package/src/components/Layout/Header/Header.tsx +43 -0
  85. package/src/components/Layout/Header/{HeaderContent/Notification.jsx → Notification/Notification.tsx} +60 -54
  86. package/src/components/Layout/Header/Notification/NotificationItem.tsx +85 -0
  87. package/src/components/Layout/Header/Notification/index.ts +1 -0
  88. package/src/components/Layout/Header/{HeaderContent → Profile}/Profile.jsx +15 -3
  89. package/src/components/Layout/Header/Profile/index.ts +1 -0
  90. package/src/components/Layout/Header/{HeaderContent/MobileSection.jsx → ResponsiveSection.tsx} +31 -38
  91. package/src/components/Layout/Header/Spacer.tsx +9 -0
  92. package/src/components/Layout/Header/index.ts +7 -0
  93. package/src/components/Layout/HorizontalBar.tsx +39 -0
  94. package/src/components/Layout/Layout.tsx +60 -0
  95. package/src/components/Layout/NavMenu.tsx +12 -0
  96. package/src/components/Layout/{Drawer/DrawerContent/Navigation → Navigation}/NavCollapse.jsx +7 -8
  97. package/src/components/Layout/{Drawer/DrawerContent/Navigation → Navigation}/NavGroup.jsx +8 -19
  98. package/src/components/Layout/{Drawer/DrawerContent/Navigation → Navigation}/NavItem.jsx +7 -8
  99. package/src/components/Layout/Navigation/Navigation.tsx +76 -0
  100. package/src/components/Layout/Navigation/index.ts +1 -0
  101. package/src/components/Layout/Provider.tsx +290 -0
  102. package/src/components/Layout/Wrapper.tsx +16 -0
  103. package/src/components/Layout/index.ts +10 -0
  104. package/src/components/ra-inputs/AutocompleteArrayInput.jsx +5 -2
  105. package/src/components/ra-inputs/AutocompleteInput.jsx +6 -2
  106. package/src/components/ra-lists/List.tsx +1 -5
  107. package/src/hooks/index.jsx +2 -0
  108. package/src/hooks/mui.ts +21 -0
  109. package/src/hooks/useRefDimensions.ts +61 -0
  110. package/dist/components/Layout/Drawer/DrawerContent/Navigation/NavCollapse.d.ts.map +0 -1
  111. package/dist/components/Layout/Drawer/DrawerContent/Navigation/NavGroup.d.ts.map +0 -1
  112. package/dist/components/Layout/Drawer/DrawerContent/Navigation/NavItem.d.ts.map +0 -1
  113. package/dist/components/Layout/Drawer/DrawerContent/Navigation/index.d.ts +0 -3
  114. package/dist/components/Layout/Drawer/DrawerContent/Navigation/index.d.ts.map +0 -1
  115. package/dist/components/Layout/Drawer/DrawerContent/index.d.ts +0 -3
  116. package/dist/components/Layout/Drawer/DrawerContent/index.d.ts.map +0 -1
  117. package/dist/components/Layout/Drawer/DrawerHeader/DrawerHeaderStyled.d.ts +0 -5
  118. package/dist/components/Layout/Drawer/DrawerHeader/DrawerHeaderStyled.d.ts.map +0 -1
  119. package/dist/components/Layout/Drawer/DrawerHeader/index.d.ts +0 -15
  120. package/dist/components/Layout/Drawer/DrawerHeader/index.d.ts.map +0 -1
  121. package/dist/components/Layout/Drawer/HorizontalBar.d.ts +0 -3
  122. package/dist/components/Layout/Drawer/HorizontalBar.d.ts.map +0 -1
  123. package/dist/components/Layout/Header/HeaderContent/MobileSection.d.ts +0 -3
  124. package/dist/components/Layout/Header/HeaderContent/MobileSection.d.ts.map +0 -1
  125. package/dist/components/Layout/Header/HeaderContent/Notification.d.ts +0 -16
  126. package/dist/components/Layout/Header/HeaderContent/Notification.d.ts.map +0 -1
  127. package/dist/components/Layout/Header/HeaderContent/NotificationItem.d.ts +0 -31
  128. package/dist/components/Layout/Header/HeaderContent/NotificationItem.d.ts.map +0 -1
  129. package/dist/components/Layout/Header/HeaderContent/Profile.d.ts.map +0 -1
  130. package/dist/components/Layout/Header/HeaderContent/buttons/ChangePasswordButton.d.ts.map +0 -1
  131. package/dist/components/Layout/Header/HeaderContent/buttons/LogoutButton.d.ts.map +0 -1
  132. package/dist/components/Layout/Header/HeaderContent/buttons/StopImpersonateButton.d.ts.map +0 -1
  133. package/dist/components/Layout/Header/HeaderContent/buttons/index.d.ts.map +0 -1
  134. package/dist/components/Layout/Header/HeaderContent/index.d.ts +0 -17
  135. package/dist/components/Layout/Header/HeaderContent/index.d.ts.map +0 -1
  136. package/src/components/Layout/Drawer/DrawerContent/Navigation/index.jsx +0 -73
  137. package/src/components/Layout/Drawer/DrawerContent/index.jsx +0 -19
  138. package/src/components/Layout/Drawer/DrawerHeader/index.jsx +0 -39
  139. package/src/components/Layout/Drawer/HorizontalBar.jsx +0 -55
  140. package/src/components/Layout/Drawer/index.jsx +0 -60
  141. package/src/components/Layout/Footer.jsx +0 -18
  142. package/src/components/Layout/Header/HeaderContent/NotificationItem.jsx +0 -97
  143. package/src/components/Layout/Header/HeaderContent/index.jsx +0 -36
  144. package/src/components/Layout/Header/index.jsx +0 -81
  145. package/src/components/Layout/index.jsx +0 -114
  146. /package/dist/components/Layout/Header/{HeaderContent → Profile}/Profile.d.ts +0 -0
  147. /package/dist/components/Layout/Header/{HeaderContent → Profile}/buttons/ChangePasswordButton.d.ts +0 -0
  148. /package/dist/components/Layout/Header/{HeaderContent → Profile}/buttons/LogoutButton.d.ts +0 -0
  149. /package/dist/components/Layout/Header/{HeaderContent → Profile}/buttons/StopImpersonateButton.d.ts +0 -0
  150. /package/dist/components/Layout/Header/{HeaderContent → Profile}/buttons/index.d.ts +0 -0
  151. /package/dist/components/Layout/{Drawer/DrawerContent/Navigation → Navigation}/NavCollapse.d.ts +0 -0
  152. /package/dist/components/Layout/{Drawer/DrawerContent/Navigation → Navigation}/NavItem.d.ts +0 -0
  153. /package/src/components/Layout/Header/{HeaderContent → Profile}/buttons/ChangePasswordButton.tsx +0 -0
  154. /package/src/components/Layout/Header/{HeaderContent → Profile}/buttons/LogoutButton.tsx +0 -0
  155. /package/src/components/Layout/Header/{HeaderContent → Profile}/buttons/StopImpersonateButton.tsx +0 -0
  156. /package/src/components/Layout/Header/{HeaderContent → Profile}/buttons/index.jsx +0 -0
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .simplebar-content:before,.simplebar-content:after{content:" ";display:table}.simplebar-scrollbar:before{position:absolute;content:"";background:black;border-radius:7px;left:2px;right:2px;opacity:0;transition:opacity .2s .5s linear}[data-simplebar]{position:relative;flex-direction:column;flex-wrap:wrap;justify-content:flex-start;align-content:flex-start;align-items:flex-start}.simplebar-wrapper{overflow:hidden;width:inherit;height:inherit;max-width:inherit;max-height:inherit}.simplebar-mask{direction:inherit;position:absolute;overflow:hidden;padding:0;margin:0;left:0;top:0;bottom:0;right:0;width:auto!important;height:auto!important;z-index:0}.simplebar-offset{direction:inherit!important;box-sizing:inherit!important;resize:none!important;position:absolute;top:0;left:0;bottom:0;right:0;padding:0;margin:0;-webkit-overflow-scrolling:touch}.simplebar-content-wrapper{direction:inherit;box-sizing:border-box!important;position:relative;display:block;height:100%;width:auto;max-width:100%;max-height:100%;overflow:auto;scrollbar-width:none;-ms-overflow-style:none}.simplebar-content-wrapper::-webkit-scrollbar,.simplebar-hide-scrollbar::-webkit-scrollbar{display:none;width:0;height:0}.simplebar-content:after,.simplebar-content:before{content:" ";display:table}.simplebar-placeholder{max-height:100%;max-width:100%;width:100%;pointer-events:none}.simplebar-height-auto-observer-wrapper{box-sizing:inherit!important;height:100%;width:100%;max-width:1px;position:relative;float:left;max-height:1px;overflow:hidden;z-index:-1;padding:0;margin:0;pointer-events:none;flex-grow:inherit;flex-shrink:0;flex-basis:0}.simplebar-height-auto-observer{box-sizing:inherit;display:block;opacity:0;position:absolute;top:0;left:0;height:1000%;width:1000%;min-height:1px;min-width:1px;overflow:hidden;pointer-events:none;z-index:-1}.simplebar-track{z-index:1;position:absolute;right:0;bottom:0;pointer-events:none;overflow:hidden}[data-simplebar].simplebar-dragging,[data-simplebar].simplebar-dragging .simplebar-content{pointer-events:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}[data-simplebar].simplebar-dragging .simplebar-track{pointer-events:all}.simplebar-scrollbar{position:absolute;left:0;right:0;min-height:10px}.simplebar-scrollbar:before{position:absolute;content:"";background:#000;border-radius:7px;left:2px;right:2px;opacity:0;transition:opacity .2s .5s linear}.simplebar-scrollbar.simplebar-visible:before{opacity:.5;transition-delay:0s;transition-duration:0s}.simplebar-track.simplebar-vertical{top:0;width:11px}.simplebar-scrollbar:before{top:2px;bottom:2px;left:2px;right:2px}.simplebar-track.simplebar-horizontal{left:0;height:11px}.simplebar-track.simplebar-horizontal .simplebar-scrollbar{right:auto;left:0;top:0;bottom:0;min-height:0;min-width:10px;width:auto}[data-simplebar-direction=rtl] .simplebar-track.simplebar-vertical{right:auto;left:0}.simplebar-dummy-scrollbar-size{direction:rtl;position:fixed;opacity:0;visibility:hidden;height:500px;width:500px;overflow-y:hidden;overflow-x:scroll;-ms-overflow-style:scrollbar!important}.simplebar-dummy-scrollbar-size>div{width:200%;height:200%;margin:10px 0}.simplebar-hide-scrollbar{position:fixed;left:0;visibility:hidden;overflow-y:scroll;scrollbar-width:none;-ms-overflow-style:none}
1
+ [data-simplebar]{position:relative;flex-direction:column;flex-wrap:wrap;justify-content:flex-start;align-content:flex-start;align-items:flex-start}.simplebar-wrapper{overflow:hidden;width:inherit;height:inherit;max-width:inherit;max-height:inherit}.simplebar-mask{direction:inherit;position:absolute;overflow:hidden;padding:0;margin:0;left:0;top:0;bottom:0;right:0;width:auto!important;height:auto!important;z-index:0}.simplebar-offset{direction:inherit!important;box-sizing:inherit!important;resize:none!important;position:absolute;top:0;left:0;bottom:0;right:0;padding:0;margin:0;-webkit-overflow-scrolling:touch}.simplebar-content-wrapper{direction:inherit;box-sizing:border-box!important;position:relative;display:block;height:100%;width:auto;max-width:100%;max-height:100%;overflow:auto;scrollbar-width:none;-ms-overflow-style:none}.simplebar-content-wrapper::-webkit-scrollbar,.simplebar-hide-scrollbar::-webkit-scrollbar{display:none;width:0;height:0}.simplebar-content:after,.simplebar-content:before{content:" ";display:table}.simplebar-placeholder{max-height:100%;max-width:100%;width:100%;pointer-events:none}.simplebar-height-auto-observer-wrapper{box-sizing:inherit!important;height:100%;width:100%;max-width:1px;position:relative;float:left;max-height:1px;overflow:hidden;z-index:-1;padding:0;margin:0;pointer-events:none;flex-grow:inherit;flex-shrink:0;flex-basis:0}.simplebar-height-auto-observer{box-sizing:inherit;display:block;opacity:0;position:absolute;top:0;left:0;height:1000%;width:1000%;min-height:1px;min-width:1px;overflow:hidden;pointer-events:none;z-index:-1}.simplebar-track{z-index:1;position:absolute;right:0;bottom:0;pointer-events:none;overflow:hidden}[data-simplebar].simplebar-dragging,[data-simplebar].simplebar-dragging .simplebar-content{pointer-events:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}[data-simplebar].simplebar-dragging .simplebar-track{pointer-events:all}.simplebar-scrollbar{position:absolute;left:0;right:0;min-height:10px}.simplebar-scrollbar:before{position:absolute;content:"";background:#000;border-radius:7px;left:2px;right:2px;opacity:0;transition:opacity .2s .5s linear}.simplebar-scrollbar.simplebar-visible:before{opacity:.5;transition-delay:0s;transition-duration:0s}.simplebar-track.simplebar-vertical{top:0;width:11px}.simplebar-scrollbar:before{top:2px;bottom:2px;left:2px;right:2px}.simplebar-track.simplebar-horizontal{left:0;height:11px}.simplebar-track.simplebar-horizontal .simplebar-scrollbar{right:auto;left:0;top:0;bottom:0;min-height:0;min-width:10px;width:auto}[data-simplebar-direction=rtl] .simplebar-track.simplebar-vertical{right:auto;left:0}.simplebar-dummy-scrollbar-size{direction:rtl;position:fixed;opacity:0;visibility:hidden;height:500px;width:500px;overflow-y:hidden;overflow-x:scroll;-ms-overflow-style:scrollbar!important}.simplebar-dummy-scrollbar-size>div{width:200%;height:200%;margin:10px 0}.simplebar-hide-scrollbar{position:fixed;left:0;visibility:hidden;overflow-y:scroll;scrollbar-width:none;-ms-overflow-style:none}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applica-software-guru/react-admin",
3
- "version": "1.1.93",
3
+ "version": "1.1.95",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -2,10 +2,10 @@ import { Box, Grid } from '@mui/material';
2
2
 
3
3
  import AuthBackground from './AuthBackground';
4
4
  import AuthCard from './AuthCard';
5
- import Footer from './Layout/Footer';
6
5
  import MainIcon from './MainIcon';
7
6
  import PropTypes from 'prop-types';
8
7
  import React from 'react';
8
+ import { Footer } from './Layout';
9
9
 
10
10
  const AuthWrapper = ({ version, name, children, background = AuthBackground }) => {
11
11
  return (
@@ -0,0 +1,30 @@
1
+ import { Box, Container, Toolbar } from '@mui/material';
2
+ import { useLayoutDrawerState, useLayoutMediaState } from './Provider';
3
+ import { useThemeConfig } from '../../hooks';
4
+
5
+ type ILayoutContentProps = React.PropsWithChildren;
6
+
7
+ function LayoutContent(props: ILayoutContentProps) {
8
+ const { width } = useLayoutDrawerState(),
9
+ { horizontal } = useLayoutMediaState(),
10
+ { container } = useThemeConfig();
11
+ return (
12
+ <Box component="main" sx={{ width: `calc(100% - ${width}px)`, flexGrow: 1, p: { xs: 0, sm: 2, lg: 1 }, pt: { lg: 2 } }}>
13
+ <Toolbar sx={{ mt: horizontal ? 8 : 'inherit' }} /> {/*Hugh...*/}
14
+ <Container
15
+ maxWidth={container ? 'xl' : false}
16
+ sx={{
17
+ ...(container && { px: { xs: 0, sm: 2 } }),
18
+ position: 'relative',
19
+ minHeight: 'calc(100vh - 110px)',
20
+ display: 'flex',
21
+ flexDirection: 'column'
22
+ }}
23
+ >
24
+ {props.children}
25
+ </Container>
26
+ </Box>
27
+ );
28
+ }
29
+
30
+ export { LayoutContent };
@@ -0,0 +1,61 @@
1
+ import { useMemo } from 'react';
2
+ import { Box, Drawer as MUIDrawer, SxProps, useTheme } from '@mui/material';
3
+ import { useSx } from '../../../hooks';
4
+ import { useLayoutDrawerState, useLayoutMediaState } from '../Provider';
5
+ import MiniDrawerStyled from './MiniDrawerStyled';
6
+ import { DrawerHeader } from './DrawerHeader';
7
+ import { SimpleBar } from '../../third-party';
8
+
9
+ type IDrawerProps = React.PropsWithChildren<{
10
+ sx?: SxProps;
11
+ }>;
12
+
13
+ function Drawer(props: IDrawerProps) {
14
+ const theme = useTheme(),
15
+ sx = useSx(props, { flexShrink: { md: 0 }, zIndex: 1200 }),
16
+ { downLg } = useLayoutMediaState(),
17
+ { open, handleDrawerToggle, width } = useLayoutDrawerState(),
18
+ Component = !downLg ? MiniDrawerStyled : MUIDrawer,
19
+ container = document.body,
20
+ ComponentProps = useMemo(() => {
21
+ return !downLg
22
+ ? { variant: 'permanent' }
23
+ : {
24
+ container: container,
25
+ variant: 'temporary',
26
+ onClose: handleDrawerToggle,
27
+ ModalProps: { keepMounted: true },
28
+ sx: {
29
+ display: { xs: 'block', lg: 'none' },
30
+ '& .MuiDrawer-paper': {
31
+ boxSizing: 'border-box',
32
+ width: width,
33
+ borderRight: `1px solid ${theme.palette.divider}`,
34
+ backgroundImage: 'none',
35
+ boxShadow: 'inherit'
36
+ }
37
+ }
38
+ };
39
+ }, [downLg, container, handleDrawerToggle, width]);
40
+
41
+ return (
42
+ <Box component="nav" sx={sx} aria-label="mailbox folders">
43
+ {/*@ts-ignore*/}
44
+ <Component {...ComponentProps} open={open}>
45
+ <DrawerHeader />
46
+ <SimpleBar
47
+ sx={{
48
+ '& .simplebar-content': {
49
+ display: 'flex',
50
+ flexDirection: 'column'
51
+ }
52
+ }}
53
+ >
54
+ {props.children}
55
+ </SimpleBar>
56
+ </Component>
57
+ </Box>
58
+ );
59
+ }
60
+
61
+ export { Drawer };
@@ -0,0 +1,31 @@
1
+ import { SxProps, useTheme } from '@mui/material';
2
+ import { useLayoutDrawerState, useLayoutLogoState, useLayoutMediaState } from '../Provider';
3
+ import { DrawerHeaderStyled } from './DrawerHeaderStyled';
4
+ import { useSx } from '../../../hooks';
5
+ import Logo from '../../Logo';
6
+
7
+ type IDrawerHeaderType = React.PropsWithChildren<{
8
+ sx?: SxProps;
9
+ }>;
10
+
11
+ function DrawerHeader(props: IDrawerHeaderType) {
12
+ const theme = useTheme(),
13
+ { horizontal } = useLayoutMediaState(),
14
+ { open } = useLayoutDrawerState(),
15
+ { icon, main } = useLayoutLogoState(),
16
+ sx = useSx(props, {
17
+ minHeight: horizontal ? 'unset' : '60px',
18
+ width: horizontal ? { xs: '100%', lg: '424px' } : 'inherit',
19
+ paddingTop: horizontal ? { xs: '10px', lg: '0' } : '8px',
20
+ paddingBottom: horizontal ? { xs: '18px', lg: '0' } : '8px',
21
+ paddingLeft: horizontal ? { xs: '24px', lg: '0' } : open ? '24px' : 0
22
+ });
23
+ return (
24
+ //@ts-ignore
25
+ <DrawerHeaderStyled theme={theme} open={open} sx={sx}>
26
+ <Logo isIcon={!open} sx={{ width: open ? 'auto' : 35, height: 35 }} logoMain={main} logoIcon={icon} />
27
+ </DrawerHeaderStyled>
28
+ );
29
+ }
30
+
31
+ export { DrawerHeader };
@@ -15,4 +15,4 @@ DrawerHeaderStyled.propTypes = {
15
15
  open: PropTypes.bool
16
16
  };
17
17
 
18
- export default DrawerHeaderStyled;
18
+ export { DrawerHeaderStyled };
@@ -0,0 +1,3 @@
1
+ export * from './Drawer';
2
+ export * from './DrawerHeader';
3
+ export * from './DrawerHeaderStyled';
@@ -0,0 +1,26 @@
1
+ import { Stack, Typography } from '@mui/material';
2
+
3
+ import PropTypes from 'prop-types';
4
+
5
+ type IFooterProps = {
6
+ name: string;
7
+ version: string;
8
+ };
9
+
10
+ function Footer(props: IFooterProps) {
11
+ const { name, version } = props;
12
+ return (
13
+ <Stack direction="row" justifyContent="space-between" alignItems="center" sx={{ p: '24px 16px 0px', mt: 'auto' }}>
14
+ <Typography variant="caption">
15
+ &copy; Applica Software Guru for {name} - {version}
16
+ </Typography>
17
+ </Stack>
18
+ );
19
+ }
20
+
21
+ Footer.propTypes = {
22
+ name: PropTypes.string.isRequired,
23
+ version: PropTypes.string.isRequired
24
+ };
25
+
26
+ export { Footer };
@@ -0,0 +1,28 @@
1
+ import { MenuFoldOutlined, MenuUnfoldOutlined } from '@ant-design/icons';
2
+ import { IconButton } from '../../@extended';
3
+ import { useLayoutDrawerState, useLayoutThemeState } from '../Provider';
4
+
5
+ function DrawerToggle() {
6
+ const { iconColor, iconColorOpen } = useLayoutThemeState(),
7
+ { open, handleDrawerToggle } = useLayoutDrawerState();
8
+
9
+ return (
10
+ //@ts-ignore
11
+ <IconButton
12
+ aria-label="open drawer"
13
+ onClick={handleDrawerToggle}
14
+ edge="start"
15
+ color="secondary"
16
+ variant="light"
17
+ sx={{
18
+ color: 'text.primary',
19
+ bgcolor: open ? iconColorOpen : iconColor,
20
+ ml: { xs: 0, lg: -2 }
21
+ }}
22
+ >
23
+ {!open ? <MenuUnfoldOutlined /> : <MenuFoldOutlined />}
24
+ </IconButton>
25
+ );
26
+ }
27
+
28
+ export { DrawerToggle };
@@ -0,0 +1,43 @@
1
+ import { useRef } from 'react';
2
+ import _ from 'lodash';
3
+ import { SxProps, AppBar, useTheme, Toolbar } from '@mui/material';
4
+ import { useLayoutDrawerState, useLayoutMediaState } from '../Provider';
5
+ import AppBarStyled from './AppBarStyled';
6
+ import { useSx } from '../../../hooks';
7
+ import { DrawerToggle } from './DrawerToggle';
8
+
9
+ type IHeaderProps = React.PropsWithChildren<{ sx?: SxProps }>;
10
+ function Header(props: IHeaderProps) {
11
+ const headerRef = useRef<HTMLElement>(),
12
+ theme = useTheme(),
13
+ { downLg, horizontal } = useLayoutMediaState(),
14
+ { open, width } = useLayoutDrawerState(),
15
+ Component = !downLg ? AppBarStyled : AppBar,
16
+ sx = useSx(props, {
17
+ borderBottom: `1px solid ${theme.palette.divider}`,
18
+ zIndex: 1200,
19
+ width: horizontal ? '100%' : open ? `calc(100% - ${width}px)` : { xs: '100%', lg: 'calc(100% - 60px)' }
20
+ }),
21
+ ComponentProps = {
22
+ position: 'fixed',
23
+ color: 'inherit',
24
+ elevation: 0,
25
+ sx: sx
26
+ };
27
+
28
+ if (!downLg) {
29
+ _.extend(ComponentProps, { open: open });
30
+ }
31
+
32
+ return (
33
+ //@ts-ignore
34
+ <Component ref={headerRef} {...ComponentProps}>
35
+ <Toolbar sx={{ '& > *': { marginX: theme.spacing(0.325) } }}>
36
+ {!horizontal && <DrawerToggle />}
37
+ {props.children}
38
+ </Toolbar>
39
+ </Component>
40
+ );
41
+ }
42
+
43
+ export { Header };
@@ -1,13 +1,11 @@
1
- import { Badge, Box, ClickAwayListener, List, Paper, Popper, Tooltip, useMediaQuery } from '@mui/material';
2
- import { BellOutlined, CheckCircleOutlined } from '@ant-design/icons';
1
+ import { useCallback, useEffect, useRef, useState } from 'react';
2
+ import { Badge, Box, ClickAwayListener, List, Paper, Popper, Tooltip, useTheme } from '@mui/material';
3
+ import { useLayoutMediaState, useLayoutNotificationsState, useLayoutThemeState } from '../../Provider';
3
4
  import { IconButton, Transitions } from '../../../@extended';
4
- import { useEffect, useRef, useState } from 'react';
5
-
5
+ import { BellOutlined, CheckCircleOutlined } from '@ant-design/icons';
6
+ import { useGetList } from 'ra-core';
6
7
  import MainCard from '../../../MainCard';
7
- import NotificationItem from './NotificationItem';
8
- import PropTypes from 'prop-types';
9
- import { useGetList } from 'react-admin';
10
- import { useTheme } from '@mui/material/styles';
8
+ import { HeaderNotificationItem, INotification } from './NotificationItem';
11
9
 
12
10
  const avatarSX = {
13
11
  width: 36,
@@ -25,46 +23,53 @@ const actionSX = {
25
23
  transform: 'none'
26
24
  };
27
25
 
28
- const Notification = ({ resource }) => {
29
- const theme = useTheme();
30
- const matchesXs = useMediaQuery(theme.breakpoints.down('md'));
26
+ function HeaderNotification() {
27
+ const { enable } = useLayoutNotificationsState();
31
28
 
32
- const anchorRef = useRef(null);
33
- const [open, setOpen] = useState(false);
34
- const handleToggle = () => {
35
- setOpen((prevOpen) => !prevOpen);
36
- };
37
-
38
- const handleClose = (event) => {
39
- if (anchorRef.current && anchorRef.current.contains(event.target)) {
40
- return;
41
- }
42
- setOpen(false);
43
- };
29
+ return enable ? <HeaderNotificationButton /> : null;
30
+ }
44
31
 
45
- const iconBackColorOpen = theme.palette.mode === 'dark' ? 'grey.200' : 'grey.300';
46
- const iconBackColor = theme.palette.mode === 'dark' ? 'background.default' : 'grey.100';
32
+ function HeaderNotificationButton() {
33
+ const theme = useTheme(),
34
+ anchorRef = useRef(),
35
+ { resource } = useLayoutNotificationsState(),
36
+ { downMd } = useLayoutMediaState(),
37
+ { iconColor, iconColorOpen } = useLayoutThemeState(),
38
+ [notificationOpen, setNotificationOpen] = useState(false),
39
+ [notifications, setNotifications] = useState<Array<INotification>>([]),
40
+ read = notifications.filter((item) => item.readed === null).length,
41
+ handleToggle = useCallback(() => setNotificationOpen(!notificationOpen), [notificationOpen]),
42
+ handleClose = useCallback(() => {
43
+ //@ts-ignore
44
+ if (anchorRef.current && anchorRef.current.contains(event.target)) {
45
+ return;
46
+ }
47
+ setNotificationOpen(false);
48
+ }, [anchorRef.current, setNotificationOpen]),
49
+ { data, isLoading } = useGetList<INotification>(resource, {
50
+ pagination: { page: 1, perPage: 50 },
51
+ sort: { field: 'created', order: 'DESC' },
52
+ filter: {
53
+ readed: false
54
+ }
55
+ });
47
56
 
48
- const { data, isLoading } = useGetList(resource, {
49
- pagination: { page: 1, perPage: 50 },
50
- sort: { field: 'created', order: 'DESC' },
51
- filter: {
52
- readed: false
57
+ useEffect(() => {
58
+ if (!isLoading && data) {
59
+ setNotifications(data ?? []);
53
60
  }
54
- });
55
- const [notifications, setNotifications] = useState([]);
56
- useEffect(() => setNotifications(!isLoading && data ? data : []), [data, isLoading]);
57
- const read = notifications.filter((item) => item.readed === null).length;
61
+ }, [data, isLoading]);
58
62
 
59
63
  return (
60
- <Box sx={{ flexShrink: 0, ml: 0.75 }}>
64
+ <Box sx={{ flexShrink: 0 }}>
65
+ {/*@ts-ignore*/}
61
66
  <IconButton
62
67
  color="secondary"
63
68
  variant="light"
64
- sx={{ color: 'text.primary', bgcolor: open ? iconBackColorOpen : iconBackColor }}
69
+ sx={{ color: 'text.primary', bgcolor: notificationOpen ? iconColorOpen : iconColor }}
65
70
  aria-label="open profile"
66
71
  ref={anchorRef}
67
- aria-controls={open ? 'profile-grow' : undefined}
72
+ aria-controls={notificationOpen ? 'profile-grow' : undefined}
68
73
  aria-haspopup="true"
69
74
  onClick={handleToggle}
70
75
  >
@@ -73,8 +78,8 @@ const Notification = ({ resource }) => {
73
78
  </Badge>
74
79
  </IconButton>
75
80
  <Popper
76
- placement={matchesXs ? 'bottom' : 'bottom-end'}
77
- open={open}
81
+ placement={downMd ? 'bottom' : 'bottom-end'}
82
+ open={notificationOpen}
78
83
  anchorEl={anchorRef.current}
79
84
  role={undefined}
80
85
  transition
@@ -84,16 +89,18 @@ const Notification = ({ resource }) => {
84
89
  {
85
90
  name: 'offset',
86
91
  options: {
87
- offset: [matchesXs ? -5 : 0, 9]
92
+ offset: [downMd ? -5 : 0, 9]
88
93
  }
89
94
  }
90
95
  ]
91
96
  }}
92
97
  >
93
98
  {({ TransitionProps }) => (
94
- <Transitions type="grow" position={matchesXs ? 'top' : 'top-right'} sx={{ overflow: 'hidden' }} in={open} {...TransitionProps}>
99
+ //@ts-ignore
100
+ <Transitions type="grow" position={downMd ? 'top' : 'top-right'} in={open} {...TransitionProps}>
95
101
  <Paper
96
102
  sx={{
103
+ //@ts-ignore
97
104
  boxShadow: theme.customShadows.z1,
98
105
  width: '100%',
99
106
  minWidth: 285,
@@ -107,12 +114,13 @@ const Notification = ({ resource }) => {
107
114
  <MainCard
108
115
  title="Notification"
109
116
  elevation={0}
110
- border={true}
117
+ border={false}
111
118
  content={false}
112
119
  secondary={
113
120
  <>
114
121
  {read > 0 && (
115
122
  <Tooltip title="Mark as all read">
123
+ {/*@ts-ignore*/}
116
124
  <IconButton color="success" size="small">
117
125
  <CheckCircleOutlined style={{ fontSize: '1.15rem' }} />
118
126
  </IconButton>
@@ -133,8 +141,14 @@ const Notification = ({ resource }) => {
133
141
  }
134
142
  }}
135
143
  >
136
- {notifications.map((item) => (
137
- <NotificationItem resource={resource} key={item.id} selected={read > 0} notification={item} onClick={handleClose} />
144
+ {notifications.map((item, index) => (
145
+ <HeaderNotificationItem
146
+ key={item.id}
147
+ selected={read > 0}
148
+ notification={item}
149
+ onClick={handleClose}
150
+ divider={index < notifications.length - 1}
151
+ />
138
152
  ))}
139
153
  </List>
140
154
  </MainCard>
@@ -145,14 +159,6 @@ const Notification = ({ resource }) => {
145
159
  </Popper>
146
160
  </Box>
147
161
  );
148
- };
149
-
150
- Notification.displayName = 'Notification';
151
- Notification.defaultProps = {
152
- resource: 'entities/notification'
153
- };
154
- Notification.propTypes = {
155
- resource: PropTypes.string.isRequired
156
- };
162
+ }
157
163
 
158
- export default Notification;
164
+ export { HeaderNotification };
@@ -0,0 +1,85 @@
1
+ import { useCallback, useMemo } from 'react';
2
+ import { Avatar, Box, ListItem, ListItemAvatar, ListItemButton, ListItemText, useTheme } from '@mui/material';
3
+ import { useLocaleState, useNotify, useRedirect, useUpdate } from 'ra-core';
4
+ import { useLayoutNotificationsState } from '../../Provider';
5
+ import dayjs from 'dayjs';
6
+ import { MessageOutlined } from '@ant-design/icons';
7
+
8
+ type INotification = {
9
+ id: string;
10
+ readed: number | null;
11
+ resource: string;
12
+ created: string | number | dayjs.Dayjs | Date | null | undefined;
13
+ title: string;
14
+ content: string;
15
+ };
16
+
17
+ type IHeaderNotificationItemProps = {
18
+ selected: boolean;
19
+ notification: INotification;
20
+ onClick: () => void;
21
+ divider?: boolean;
22
+ };
23
+ function HeaderNotificationItem(props: IHeaderNotificationItemProps) {
24
+ const theme = useTheme(),
25
+ { notification, onClick, selected, divider } = props,
26
+ { resource } = useLayoutNotificationsState(),
27
+ notify = useNotify(),
28
+ redirect = useRedirect(),
29
+ [update] = useUpdate(
30
+ resource,
31
+ {
32
+ id: notification?.id,
33
+ data: {
34
+ ...notification,
35
+ readed: dayjs().format('YYYY-MM-DD HH:mm:ss')
36
+ }
37
+ },
38
+ {
39
+ onSuccess: () => {
40
+ if (notification?.resource) {
41
+ if (notification?.resource.startsWith('/')) {
42
+ redirect(notification?.resource);
43
+ onClick();
44
+ } else {
45
+ document.location.href = notification?.resource;
46
+ }
47
+ } else {
48
+ onClick();
49
+ }
50
+ },
51
+ //@ts-ignore
52
+ onFailure: () => {
53
+ //@ts-ignore
54
+ notify('resources.notifications.messages.readed.error', 'warning');
55
+ }
56
+ }
57
+ ),
58
+ handleClick = useCallback(() => update(), [update]),
59
+ [locale] = useLocaleState(),
60
+ ago = useMemo(() => dayjs(notification.created).locale(locale).fromNow(), [notification, locale]);
61
+
62
+ return (
63
+ <ListItem disablePadding divider={divider}>
64
+ <ListItemButton selected={selected} onClick={handleClick}>
65
+ <ListItemAvatar>
66
+ <Avatar
67
+ sx={{
68
+ color: 'primary.main',
69
+ bgcolor: 'primary.lighter'
70
+ }}
71
+ >
72
+ <MessageOutlined />
73
+ </Avatar>
74
+ </ListItemAvatar>
75
+ <ListItemText primary={notification.title} secondary={notification.content} />
76
+ <Box flexGrow={1} flexShrink={1} minWidth={theme.spacing(2)} />
77
+ <ListItemText primary={ago} primaryTypographyProps={{ variant: 'caption' }} />
78
+ </ListItemButton>
79
+ </ListItem>
80
+ );
81
+ }
82
+
83
+ export type { INotification };
84
+
85
+ export { HeaderNotificationItem };
@@ -0,0 +1 @@
1
+ export * from './Notification';
@@ -1,5 +1,18 @@
1
1
  import { Avatar, IconButton, Transitions } from '../../../@extended';
2
- import { Box, ButtonBase, CardContent, ClickAwayListener, Grid, List, Paper, Popper, Stack, Tooltip, Typography } from '@mui/material';
2
+ import {
3
+ Box,
4
+ ButtonBase,
5
+ CardContent,
6
+ ClickAwayListener,
7
+ Grid,
8
+ List,
9
+ Paper,
10
+ Popper,
11
+ Stack,
12
+ Tooltip,
13
+ Typography,
14
+ useTheme
15
+ } from '@mui/material';
3
16
  import { ChangePasswordButton, LogoutButton, StopImpersonateButton } from './buttons';
4
17
  import { useAuthProvider, useDataProvider, useGetIdentity, useLogout } from 'react-admin';
5
18
  import { useCallback, useEffect, useRef, useState } from 'react';
@@ -7,7 +20,6 @@ import { useCallback, useEffect, useRef, useState } from 'react';
7
20
  import { LogoutOutlined } from '@ant-design/icons';
8
21
  import MainCard from '../../../MainCard';
9
22
  import PropTypes from 'prop-types';
10
- import { useTheme } from '@mui/material/styles';
11
23
 
12
24
  function TabPanel({ children, value, index, ...other }) {
13
25
  return (
@@ -62,7 +74,7 @@ const Profile = () => {
62
74
  }, [dataProvider, hasProfilePic]);
63
75
 
64
76
  return (
65
- <Box sx={{ flexShrink: 0, ml: 0.75 }}>
77
+ <Box sx={{ flexShrink: 0 }}>
66
78
  <ButtonBase
67
79
  sx={{
68
80
  p: 0.25,
@@ -0,0 +1 @@
1
+ export { default as HeaderProfile } from './Profile';