@applica-software-guru/react-admin 1.0.60 → 1.0.62
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/dist/ApplicaAdmin.d.ts +35 -13
- package/dist/ApplicaAdmin.d.ts.map +1 -1
- package/dist/components/AuthBackground.d.ts.map +1 -1
- package/dist/components/Layout/Header/HeaderContent/index.d.ts +3 -3
- package/dist/components/Layout/Header/index.d.ts +3 -3
- package/dist/components/Layout/index.d.ts +3 -3
- package/dist/components/ra-pages/LoginPage.d.ts +5 -5
- package/dist/components/ra-pages/LoginPage.d.ts.map +1 -1
- package/dist/contexts/ThemeConfigContext.d.ts +40 -58
- package/dist/contexts/ThemeConfigContext.d.ts.map +1 -1
- package/dist/hooks/useThemeConfig.d.ts +1 -13
- package/dist/hooks/useThemeConfig.d.ts.map +1 -1
- package/dist/react-admin.cjs.js +28 -28
- package/dist/react-admin.cjs.js.map +1 -1
- package/dist/react-admin.es.js +1529 -1585
- package/dist/react-admin.es.js.map +1 -1
- package/dist/react-admin.umd.js +21 -21
- package/dist/react-admin.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/ApplicaAdmin.tsx +52 -25
- package/src/components/AuthBackground.tsx +21 -19
- package/src/components/Layout/Header/HeaderContent/index.jsx +3 -3
- package/src/components/Layout/Header/index.jsx +3 -3
- package/src/components/Layout/index.jsx +3 -3
- package/src/components/ra-pages/LoginPage.tsx +8 -8
- package/src/contexts/ThemeConfigContext.tsx +125 -0
- package/src/playground/App.jsx +6 -0
- package/src/themes/overrides/Autocomplete.jsx +1 -1
- package/src/contexts/ThemeConfigContext.jsx +0 -134
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import { createContext } from 'react';
|
|
3
|
-
import { useLocalStorage } from '../hooks';
|
|
4
|
-
|
|
5
|
-
const initialState = {
|
|
6
|
-
/**
|
|
7
|
-
* The props used for the theme font-style.
|
|
8
|
-
* We provide static below options -
|
|
9
|
-
* `'Inter', sans-serif`
|
|
10
|
-
* `'Poppins', sans-serif`
|
|
11
|
-
* `'Roboto', sans-serif`
|
|
12
|
-
* `'Public Sans', sans-serif` (default)
|
|
13
|
-
*/
|
|
14
|
-
fontFamily: `'Inter', sans-serif`,
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* the props used for menu orientation (diffrent theme layout).
|
|
18
|
-
* we provide static below options -
|
|
19
|
-
* 'vertical' (default)
|
|
20
|
-
* 'horizontal'
|
|
21
|
-
*/
|
|
22
|
-
menuOrientation: 'vertical',
|
|
23
|
-
/**
|
|
24
|
-
* the props used for show mini variant drawer
|
|
25
|
-
* the mini variant is recommended for apps sections that need quick selection access alongside content.
|
|
26
|
-
* default - false
|
|
27
|
-
*/
|
|
28
|
-
miniDrawer: false,
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* the props used for theme container.
|
|
32
|
-
* the container centers your content horizontally. It's the most basic layout element.
|
|
33
|
-
* default - true which show container
|
|
34
|
-
* false - will show fluid
|
|
35
|
-
*/
|
|
36
|
-
container: false,
|
|
37
|
-
/**
|
|
38
|
-
* the props used for default theme palette mode
|
|
39
|
-
* explore the default theme
|
|
40
|
-
* below theme options -
|
|
41
|
-
* 'light' (default)
|
|
42
|
-
* 'dark'
|
|
43
|
-
*/
|
|
44
|
-
mode: 'light',
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* the props used for theme primary color variants
|
|
48
|
-
* we provide static below options thoe s are already defaine in src/themes/theme -
|
|
49
|
-
* 'default'
|
|
50
|
-
* 'theme1'
|
|
51
|
-
* 'theme2'
|
|
52
|
-
* 'theme3'
|
|
53
|
-
* 'theme4'
|
|
54
|
-
* 'theme5'
|
|
55
|
-
* 'theme6'
|
|
56
|
-
* 'theme7'
|
|
57
|
-
* 'theme8'
|
|
58
|
-
*/
|
|
59
|
-
presetColor: 'theme4',
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* the props used for default theme direction
|
|
63
|
-
* explore the default theme
|
|
64
|
-
* below theme options -
|
|
65
|
-
* 'ltr' (default)
|
|
66
|
-
* 'rtl'
|
|
67
|
-
*/
|
|
68
|
-
themeDirection: 'ltr',
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* default path to redirect after login.
|
|
72
|
-
*/
|
|
73
|
-
appDefaultPath: '/',
|
|
74
|
-
/**
|
|
75
|
-
* default drawer width.
|
|
76
|
-
*/
|
|
77
|
-
drawerWidth: 260,
|
|
78
|
-
/**
|
|
79
|
-
* number of items to show in horizontal.
|
|
80
|
-
*/
|
|
81
|
-
horizontalMaxItems: 6,
|
|
82
|
-
/**
|
|
83
|
-
* Default spacing for elements
|
|
84
|
-
*/
|
|
85
|
-
spacing: 2
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const ThemeConfigContext = createContext(initialState);
|
|
89
|
-
|
|
90
|
-
const isVerticalLayout = (layout) => layout === 'vertical';
|
|
91
|
-
const isHorizontalLayout = (layout) => layout === 'horizontal';
|
|
92
|
-
|
|
93
|
-
const ThemeConfigProvider = ({ children }) => {
|
|
94
|
-
const [config, setConfig] = useLocalStorage('theme-config', initialState);
|
|
95
|
-
const setFontFamily = (fontFamily) => setConfig((config) => ({ ...config, fontFamily }));
|
|
96
|
-
const setMenuOrientation = (menuOrientation) => setConfig((config) => ({ ...config, menuOrientation }));
|
|
97
|
-
const setMiniDrawer = (miniDrawer) => setConfig((config) => ({ ...config, miniDrawer }));
|
|
98
|
-
const setContainer = (container) => setConfig((config) => ({ ...config, container }));
|
|
99
|
-
const setMode = (mode) => setConfig((config) => ({ ...config, mode }));
|
|
100
|
-
const setPresetColor = (presetColor) => setConfig((config) => ({ ...config, presetColor }));
|
|
101
|
-
const setThemeDirection = (themeDirection) => setConfig((config) => ({ ...config, themeDirection }));
|
|
102
|
-
const setAppDefaultPath = (appDefaultPath) => setConfig((config) => ({ ...config, appDefaultPath }));
|
|
103
|
-
const setDrawerWidth = (drawerWidth) => setConfig((config) => ({ ...config, drawerWidth }));
|
|
104
|
-
const setHorizontalMaxItems = (horizontalMaxItems) => setConfig((config) => ({ ...config, horizontalMaxItems }));
|
|
105
|
-
return (
|
|
106
|
-
<ThemeConfigContext.Provider
|
|
107
|
-
value={{
|
|
108
|
-
...config,
|
|
109
|
-
|
|
110
|
-
setFontFamily,
|
|
111
|
-
setMenuOrientation,
|
|
112
|
-
setMiniDrawer,
|
|
113
|
-
setContainer,
|
|
114
|
-
setMode,
|
|
115
|
-
setPresetColor,
|
|
116
|
-
setThemeDirection,
|
|
117
|
-
setAppDefaultPath,
|
|
118
|
-
setDrawerWidth,
|
|
119
|
-
setHorizontalMaxItems,
|
|
120
|
-
|
|
121
|
-
isVerticalLayout,
|
|
122
|
-
isHorizontalLayout
|
|
123
|
-
}}
|
|
124
|
-
>
|
|
125
|
-
{children}
|
|
126
|
-
</ThemeConfigContext.Provider>
|
|
127
|
-
);
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
ThemeConfigProvider.propTypes = {
|
|
131
|
-
children: PropTypes.node
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
export { ThemeConfigProvider, ThemeConfigContext };
|