@applica-software-guru/react-admin 1.5.249 → 1.5.251

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 (33) hide show
  1. package/dist/components/AuthWrapper.d.ts +2 -1
  2. package/dist/components/AuthWrapper.d.ts.map +1 -1
  3. package/dist/components/Layout/Footer.d.ts.map +1 -1
  4. package/dist/components/Layout/Layout.d.ts.map +1 -1
  5. package/dist/components/Layout/ThemeColor.d.ts +10 -0
  6. package/dist/components/Layout/ThemeColor.d.ts.map +1 -0
  7. package/dist/components/Layout/ThemeToggler.d.ts.map +1 -1
  8. package/dist/components/Layout/index.d.ts +1 -0
  9. package/dist/components/Layout/index.d.ts.map +1 -1
  10. package/dist/components/ra-fields/CoverField.d.ts +0 -1
  11. package/dist/components/ra-fields/CoverField.d.ts.map +1 -1
  12. package/dist/components/ra-inputs/FileInput.d.ts +0 -1
  13. package/dist/components/ra-inputs/FileInput.d.ts.map +1 -1
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/react-admin.cjs.js +59 -59
  17. package/dist/react-admin.cjs.js.map +1 -1
  18. package/dist/react-admin.es.js +7515 -7823
  19. package/dist/react-admin.es.js.map +1 -1
  20. package/dist/react-admin.umd.js +55 -55
  21. package/dist/react-admin.umd.js.map +1 -1
  22. package/package.json +2 -2
  23. package/src/components/AuthWrapper.tsx +19 -13
  24. package/src/components/Layout/Footer.tsx +8 -1
  25. package/src/components/Layout/Layout.tsx +2 -0
  26. package/src/components/Layout/ThemeColor.tsx +24 -0
  27. package/src/components/Layout/ThemeToggler.tsx +0 -1
  28. package/src/components/Layout/index.ts +1 -0
  29. package/src/components/ra-fields/CoverField.tsx +0 -1
  30. package/src/components/ra-inputs/FileInput.tsx +0 -1
  31. package/src/index.ts +4 -0
  32. package/src/playground/App.jsx +1 -0
  33. package/src/playground/config.jsx +3 -2
package/package.json CHANGED
@@ -108,12 +108,12 @@
108
108
  "format": "prettier --write .",
109
109
  "prepare": "husky",
110
110
  "preview": "vite preview",
111
- "start": "vite",
111
+ "start": "vite --host",
112
112
  "test": "vitest run",
113
113
  "watch": "vite build --watch"
114
114
  },
115
115
  "type": "module",
116
116
  "types": "dist/index.d.ts",
117
117
  "typings": "dist/index.d.ts",
118
- "version": "1.5.249"
118
+ "version": "1.5.251"
119
119
  }
@@ -1,5 +1,6 @@
1
1
  import { AuthBackground } from '@/components/AuthBackground';
2
2
  import { AuthCard } from '@/components/AuthCard';
3
+ import { ThemeColor } from '@/components/Layout';
3
4
  import { Footer } from '@/components/Layout/Footer';
4
5
  import { MainIcon } from '@/components/MainIcon';
5
6
  import { Box, Grid } from '@mui/material';
@@ -11,20 +12,23 @@ type AuthWrapperProps = PropsWithChildren<{
11
12
  copy?: string;
12
13
  background?: React.ReactNode | React.ComponentType;
13
14
  logo?: React.ReactNode;
15
+ footer?: boolean;
14
16
  }>;
15
17
 
16
- function AuthWrapper({ version, name, copy, children, logo, background = AuthBackground }: AuthWrapperProps) {
18
+ function AuthWrapper({
19
+ version,
20
+ name,
21
+ copy,
22
+ children,
23
+ logo,
24
+ background = AuthBackground,
25
+ footer = true
26
+ }: AuthWrapperProps) {
17
27
  return (
18
- <Box sx={{ minHeight: '100vh' }}>
28
+ <Box>
29
+ <ThemeColor source="default" />
19
30
  {React.isValidElement(background) ? background : React.createElement(background as any)}
20
- <Grid
21
- container
22
- direction="column"
23
- justifyContent="flex-end"
24
- sx={{
25
- minHeight: '100vh'
26
- }}
27
- >
31
+ <Grid container direction="column" justifyContent="flex-end">
28
32
  <Grid item xs={12} sx={{ ml: 3 }}>
29
33
  {logo ? logo : <MainIcon title={name} />}
30
34
  </Grid>
@@ -41,9 +45,11 @@ function AuthWrapper({ version, name, copy, children, logo, background = AuthBac
41
45
  <AuthCard>{children}</AuthCard>
42
46
  </Grid>
43
47
  </Grid>
44
- <Grid item sx={{ pb: 1 }}>
45
- <Footer name={name} copy={copy} version={version} />
46
- </Grid>
48
+ {footer ? (
49
+ <Grid item sx={{ pb: 1, position: 'absolute', bottom: 0, ml: 2 }}>
50
+ <Footer name={name} copy={copy} version={version} />
51
+ </Grid>
52
+ ) : null}
47
53
  </Grid>
48
54
  </Grid>
49
55
  </Box>
@@ -9,7 +9,14 @@ type IFooterProps = {
9
9
  function Footer(props: IFooterProps) {
10
10
  const { name, version, copy = '&copy; Applica Software Guru for' } = props;
11
11
  return (
12
- <Stack direction="row" justifyContent="space-between" alignItems="center" sx={{ p: '24px 16px 0px', mt: 'auto' }}>
12
+ <Stack
13
+ direction="row"
14
+ justifyContent="space-between"
15
+ alignItems="flex-end"
16
+ flexGrow={1}
17
+ height="auto"
18
+ sx={{ pt: 1 }}
19
+ >
13
20
  <Typography variant="caption">
14
21
  <span dangerouslySetInnerHTML={{ __html: copy || '' }} /> {name} - {version}
15
22
  </Typography>
@@ -8,6 +8,7 @@ import { ThemeToggler } from './ThemeToggler';
8
8
  import { LayoutWrapper } from './Wrapper';
9
9
  import { Breadcrumbs } from '@/components/@extended';
10
10
  import { useBreadcrumbs } from '@/components/Layout/MenuProvider';
11
+ import { ThemeColor } from '@/components/Layout/ThemeColor';
11
12
  import { ErrorProps, LoadingIndicator } from 'ra-ui-materialui';
12
13
  import { Outlet } from 'react-router-dom';
13
14
 
@@ -29,6 +30,7 @@ const Layout = withLayoutProvider(function Layout(props: ILayoutProps) {
29
30
  <HeaderSpacer />
30
31
  <LocaleButton />
31
32
  {enableThemeToggler ? <ThemeToggler /> : null}
33
+ <ThemeColor />
32
34
  <LoadingIndicator />
33
35
  <HeaderNotification />
34
36
  <ResponsiveSection>
@@ -0,0 +1,24 @@
1
+ import { useThemeConfig } from '@/components/Layout/ThemeProvider';
2
+ import { useTheme } from '@mui/material';
3
+ import _ from 'lodash';
4
+ import { useEffect } from 'react';
5
+
6
+ type ThemeColorProps = {
7
+ source?: 'paper' | 'default';
8
+ };
9
+ /**
10
+ * ThemeColor component is responsible for setting the theme color in the browser.
11
+ * It uses the current theme mode and the theme object to set the theme color.
12
+ */
13
+ function ThemeColor({ source = 'paper' }: ThemeColorProps) {
14
+ const { mode } = useThemeConfig();
15
+ const theme = useTheme();
16
+ useEffect(() => {
17
+ const backgroundColor = _.get(theme.palette.background, source);
18
+ document.querySelector('meta[name="theme-color"]')?.setAttribute('content', backgroundColor as string);
19
+ }, [mode, theme, source]);
20
+
21
+ return null;
22
+ }
23
+
24
+ export { ThemeColor };
@@ -4,7 +4,6 @@ import { MoonOutlined, SunOutlined } from '@ant-design/icons';
4
4
 
5
5
  function ThemeToggler(): JSX.Element {
6
6
  const { mode, setMode } = useThemeConfig();
7
-
8
7
  return (
9
8
  <HeaderToggleButton
10
9
  value="theme-mode"
@@ -9,6 +9,7 @@ export * from './MenuProvider';
9
9
  export * from './NavMenu';
10
10
  export * from './Navigation';
11
11
  export * from './Provider';
12
+ export * from './ThemeColor';
12
13
  export * from './ThemeProvider';
13
14
  export * from './ThemeToggler';
14
15
  export * from './Wrapper';
@@ -15,7 +15,6 @@ type CoverFieldProps = {
15
15
  * @example
16
16
  * // Suppose you have a property, in your record, called 'image' and it contains a base64 string related field called '_image'.
17
17
  * // You can use this component as follows:
18
- * import { CoverField } from 'ra-ui-applica';
19
18
  * ...
20
19
  * <CoverField source="image" />
21
20
  *
@@ -33,7 +33,6 @@ const StyledFileInput = styled(RaFileInput, { slot: 'root' })(({ theme }) => ({
33
33
  *
34
34
  * @example
35
35
  * // If you hav an object class with @File annotation, you can map it to a FileInput:
36
- * import { FileInput } from 'ra-ui-applica';
37
36
  * ...
38
37
  * <FileInput source="file_property" />
39
38
  *
package/src/index.ts CHANGED
@@ -79,6 +79,8 @@ export {
79
79
  usePermissions,
80
80
  useRecordContext,
81
81
  useRefresh,
82
+ useRemoveFromStore,
83
+ useResetStore,
82
84
  useResourceContext,
83
85
  useResourceDefinition,
84
86
  useResourceDefinitions,
@@ -86,6 +88,8 @@ export {
86
88
  useShowController,
87
89
  useSimpleFormIterator,
88
90
  useSimpleFormIteratorItem,
91
+ useStore,
92
+ useStoreContext,
89
93
  useTranslate,
90
94
  useTranslateLabel,
91
95
  useUnselect,
@@ -37,6 +37,7 @@ function App() {
37
37
  enableNotification
38
38
  enableRegistration
39
39
  enablePasswordRecover
40
+ enableThemeToggler
40
41
  >
41
42
  <CustomRoutes>
42
43
  <Route path="/custom-page" element={<CustomPage />} />
@@ -1,7 +1,8 @@
1
1
  let environment = 'PRODUCTION';
2
2
  let appUrl = `//${document.location.host}/`;
3
- if (appUrl.endsWith(':3000/') || appUrl.indexOf(':51') !== -1) {
4
- appUrl = 'http://localhost:8080/';
3
+ if (appUrl.endsWith(':3000/')) {
4
+ const callingHostOrIp = document.location.host.split(':')[0];
5
+ appUrl = `//${callingHostOrIp}:8080/`;
5
6
  environment = 'DEVELOPER';
6
7
  }
7
8
  const APP_NAME = 'Applica';