muffin-admin 13.5.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.
@@ -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, theme, defaultTheme, title = "React Admin", } = props;
36
- return (_jsx(AdminContext, { authProvider: authProvider, basename: basename, dataProvider: dataProvider, i18nProvider: i18nProvider, store: store, queryClient: queryClient, theme: theme !== null && theme !== void 0 ? theme : adminProps === null || adminProps === void 0 ? void 0 : adminProps.theme, lightTheme: lightTheme, darkTheme: 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 })) }) }) }));
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/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "13.5.0";
1
+ export declare const VERSION = "13.6.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "13.5.0";
1
+ export const VERSION = "13.6.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muffin-admin",
3
- "version": "13.5.0",
3
+ "version": "13.6.0",
4
4
  "description": "NPM package for https://github.com/klen/muffin-admin",
5
5
  "files": [
6
6
  "src",
@@ -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
- theme={theme ?? adminProps?.theme}
77
- lightTheme={lightTheme}
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/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = "13.5.0"
1
+ export const VERSION = "13.6.0"