muffin-admin 13.4.0 → 13.6.0
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/MuffinAdmin.js +6 -2
- package/dist/types.d.ts +2 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/MuffinAdmin.tsx +5 -4
- package/src/types.ts +3 -0
- package/src/version.ts +1 -1
package/dist/MuffinAdmin.js
CHANGED
|
@@ -22,18 +22,22 @@ import { buildProvider, muffinTranslations } from "./i18n";
|
|
|
22
22
|
import { muffinDarkTheme, muffinLightTheme } from "./themes";
|
|
23
23
|
import { buildAdmin, deepMerge, findBuilder, findIcon, setupAdmin } from "./utils";
|
|
24
24
|
export function MuffinAdmin(_a) {
|
|
25
|
+
var _b;
|
|
25
26
|
var { lightTheme = muffinLightTheme, darkTheme = muffinDarkTheme } = _a, props = __rest(_a, ["lightTheme", "darkTheme"]);
|
|
26
27
|
const opts = useMuffinAdminOpts();
|
|
27
28
|
const { resources = [], auth, adminProps, apiUrl, locales: backendLocales } = opts;
|
|
28
29
|
document.title = (adminProps === null || adminProps === void 0 ? void 0 : adminProps.title) || "Muffin Admin";
|
|
30
|
+
// The configured theme is merged into both palettes, otherwise it is lost as soon as
|
|
31
|
+
// react-admin switches to the dark mode
|
|
32
|
+
const themeOverride = (_b = props.theme) !== null && _b !== void 0 ? _b : adminProps === null || adminProps === void 0 ? void 0 : adminProps.theme;
|
|
29
33
|
const muffinI18nProvider = buildProvider(backendLocales
|
|
30
34
|
? Object.fromEntries(Object.entries(muffinTranslations).map(([locale, messages]) => [
|
|
31
35
|
locale,
|
|
32
36
|
deepMerge({}, messages, backendLocales[locale], buildAdmin(["locale", locale]) || {}),
|
|
33
37
|
]))
|
|
34
38
|
: muffinTranslations);
|
|
35
|
-
const { basename, authProvider = findBuilder(["auth-provider"])(auth), dataProvider = findBuilder(["data-provider"])(apiUrl), catchAll, dashboard = findBuilder(["dashboard"]), disableTelemetry, error, i18nProvider = muffinI18nProvider, layout = findBuilder(["layout"]), loading, loginPage = findBuilder(["loginpage"]), authCallbackPage, notification, queryClient, requireAuth = auth.required, store = localStorageStore(), ready,
|
|
36
|
-
return (_jsx(AdminContext, { authProvider: authProvider, basename: basename, dataProvider: dataProvider, i18nProvider: i18nProvider, store: store, queryClient: queryClient,
|
|
39
|
+
const { basename, authProvider = findBuilder(["auth-provider"])(auth), dataProvider = findBuilder(["data-provider"])(apiUrl), catchAll, dashboard = findBuilder(["dashboard"]), disableTelemetry, error, i18nProvider = muffinI18nProvider, layout = findBuilder(["layout"]), loading, loginPage = findBuilder(["loginpage"]), authCallbackPage, notification, queryClient, requireAuth = auth.required, store = localStorageStore(), ready, defaultTheme, title = "React Admin", } = props;
|
|
40
|
+
return (_jsx(AdminContext, { authProvider: authProvider, basename: basename, dataProvider: dataProvider, i18nProvider: i18nProvider, store: store, queryClient: queryClient, lightTheme: themeOverride ? deepMerge({}, lightTheme, themeOverride) : lightTheme, darkTheme: themeOverride ? deepMerge({}, darkTheme, themeOverride) : darkTheme, defaultTheme: defaultTheme, children: _jsx(ConfirmationProvider, { children: _jsx(AdminUI, { layout: layout, dashboard: dashboard, disableTelemetry: disableTelemetry, catchAll: catchAll, error: error, title: title, loading: loading, loginPage: loginPage, authCallbackPage: authCallbackPage, notification: notification, requireAuth: requireAuth, ready: ready, children: resources === null || resources === void 0 ? void 0 : resources.map(({ name }) => buildAdmin(["resource", name], { name })) }) }) }));
|
|
37
41
|
}
|
|
38
42
|
setupAdmin(["admin"], MuffinAdmin);
|
|
39
43
|
export function MuffinAdminLayout(props) {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ThemeOptions } from "@mui/material";
|
|
1
2
|
export type TID = string | number;
|
|
2
3
|
export type TProps = {
|
|
3
4
|
[key: string]: any;
|
|
@@ -83,6 +84,7 @@ export type AdminOpts = {
|
|
|
83
84
|
title: string;
|
|
84
85
|
disableTelemetry?: boolean;
|
|
85
86
|
mutationMode?: "optimistic" | "pessimistic" | "undoable";
|
|
87
|
+
theme?: ThemeOptions;
|
|
86
88
|
};
|
|
87
89
|
apiUrl: string;
|
|
88
90
|
appBarLinks: [{
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "13.
|
|
1
|
+
export declare const VERSION = "13.6.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "13.
|
|
1
|
+
export const VERSION = "13.6.0";
|
package/package.json
CHANGED
package/src/MuffinAdmin.tsx
CHANGED
|
@@ -31,6 +31,9 @@ export function MuffinAdmin({
|
|
|
31
31
|
const { resources = [], auth, adminProps, apiUrl, locales: backendLocales } = opts
|
|
32
32
|
|
|
33
33
|
document.title = adminProps?.title || "Muffin Admin"
|
|
34
|
+
// The configured theme is merged into both palettes, otherwise it is lost as soon as
|
|
35
|
+
// react-admin switches to the dark mode
|
|
36
|
+
const themeOverride = props.theme ?? adminProps?.theme
|
|
34
37
|
const muffinI18nProvider = buildProvider(
|
|
35
38
|
backendLocales
|
|
36
39
|
? Object.fromEntries(
|
|
@@ -60,7 +63,6 @@ export function MuffinAdmin({
|
|
|
60
63
|
requireAuth = auth.required,
|
|
61
64
|
store = localStorageStore(),
|
|
62
65
|
ready,
|
|
63
|
-
theme,
|
|
64
66
|
defaultTheme,
|
|
65
67
|
title = "React Admin",
|
|
66
68
|
} = props
|
|
@@ -73,9 +75,8 @@ export function MuffinAdmin({
|
|
|
73
75
|
i18nProvider={i18nProvider}
|
|
74
76
|
store={store}
|
|
75
77
|
queryClient={queryClient}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
darkTheme={darkTheme}
|
|
78
|
+
lightTheme={themeOverride ? deepMerge({}, lightTheme, themeOverride) : lightTheme}
|
|
79
|
+
darkTheme={themeOverride ? deepMerge({}, darkTheme, themeOverride) : darkTheme}
|
|
79
80
|
defaultTheme={defaultTheme}
|
|
80
81
|
>
|
|
81
82
|
<ConfirmationProvider>
|
package/src/types.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ThemeOptions } from "@mui/material"
|
|
2
|
+
|
|
1
3
|
export type TID = string | number
|
|
2
4
|
|
|
3
5
|
export type TProps = {
|
|
@@ -126,6 +128,7 @@ export type AdminOpts = {
|
|
|
126
128
|
title: string
|
|
127
129
|
disableTelemetry?: boolean
|
|
128
130
|
mutationMode?: "optimistic" | "pessimistic" | "undoable"
|
|
131
|
+
theme?: ThemeOptions
|
|
129
132
|
}
|
|
130
133
|
apiUrl: string
|
|
131
134
|
appBarLinks: [{ url: string; title: string; icon?: string }]
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "13.
|
|
1
|
+
export const VERSION = "13.6.0"
|