@etsoo/toolpad 1.0.12 → 1.0.13
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/babel.config.json +11 -0
- package/build/cjs/Account/Account.js +104 -0
- package/build/cjs/Account/Account.test.js +40 -0
- package/build/cjs/Account/AccountPopoverFooter.js +18 -0
- package/build/cjs/Account/AccountPopoverHeader.js +12 -0
- package/build/cjs/Account/AccountPreview.js +96 -0
- package/build/cjs/Account/AccountPreview.test.js +52 -0
- package/build/cjs/Account/SignInButton.js +56 -0
- package/build/cjs/Account/SignOutButton.js +58 -0
- package/build/cjs/Account/index.js +22 -0
- package/build/cjs/AppProvider/AppProvider.js +40 -0
- package/build/cjs/AppProvider/AppProvider.test.js +18 -0
- package/build/cjs/AppProvider/AppProviderComponent.js +33 -0
- package/build/cjs/AppProvider/AppThemeProvider.js +111 -0
- package/build/cjs/AppProvider/index.js +17 -0
- package/build/cjs/DashboardLayout/DashboardLayout.js +230 -0
- package/build/cjs/DashboardLayout/DashboardLayout.test.js +296 -0
- package/build/cjs/DashboardLayout/DashboardSidebarSubNavigation.js +185 -0
- package/build/cjs/DashboardLayout/ThemeSwitcher.js +84 -0
- package/build/cjs/DashboardLayout/TitleBar.d.ts +2 -0
- package/build/cjs/DashboardLayout/TitleBar.js +57 -0
- package/build/cjs/DashboardLayout/ToolbarActions.js +11 -0
- package/build/cjs/DashboardLayout/index.js +19 -0
- package/build/cjs/DashboardLayout/utils.js +20 -0
- package/build/{PageContainer → cjs/PageContainer}/PageContainer.d.ts +4 -0
- package/build/cjs/PageContainer/PageContainer.js +133 -0
- package/build/cjs/PageContainer/PageContainer.test.js +128 -0
- package/build/cjs/PageContainer/PageContainerToolbar.js +26 -0
- package/build/cjs/PageContainer/PageContainerToolbar.test.js +15 -0
- package/build/cjs/PageContainer/index.js +18 -0
- package/build/cjs/index.js +24 -0
- package/build/cjs/nextjs/AppProvider.js +18 -0
- package/build/cjs/nextjs/AppProvider.test.js +71 -0
- package/build/cjs/nextjs/AppProviderNextApp.js +63 -0
- package/build/cjs/nextjs/AppProviderNextPages.js +73 -0
- package/build/cjs/nextjs/index.js +17 -0
- package/build/cjs/persistence/codec.js +60 -0
- package/build/cjs/persistence/index.js +17 -0
- package/build/cjs/persistence/useStorageState.js +153 -0
- package/build/cjs/persistence/useStorageState.test.js +63 -0
- package/build/cjs/react-router-dom/AppProvider.js +64 -0
- package/build/cjs/react-router-dom/AppProvider.test.js +14 -0
- package/build/cjs/react-router-dom/index.js +17 -0
- package/build/cjs/shared/Link.js +55 -0
- package/build/cjs/shared/components.js +30 -0
- package/build/cjs/shared/context.js +46 -0
- package/build/cjs/shared/locales/LocaleContext.js +71 -0
- package/build/cjs/shared/navigation.js +151 -0
- package/build/cjs/useActivePage/index.js +17 -0
- package/build/cjs/useActivePage/useActivePage.js +83 -0
- package/build/cjs/useLocalStorageState/index.js +17 -0
- package/build/cjs/useLocalStorageState/useLocalStorageState.js +17 -0
- package/build/cjs/useSessionStorageState/index.js +17 -0
- package/build/cjs/useSessionStorageState/useSessionStorageState.js +17 -0
- package/build/cjs/utils/collections.js +53 -0
- package/build/cjs/utils/describeConformance.js +6 -0
- package/build/cjs/utils/events.js +58 -0
- package/build/cjs/utils/hooks/index.js +10 -0
- package/build/cjs/utils/hooks/useBoolean.js +47 -0
- package/build/cjs/utils/hooks/useDebounced.js +64 -0
- package/build/cjs/utils/hooks/useDebouncedHandler.js +77 -0
- package/build/cjs/utils/hooks/useLatest.js +44 -0
- package/build/cjs/utils/hooks/usePageTitle.js +49 -0
- package/build/cjs/utils/hooks/useSsr.js +52 -0
- package/build/cjs/utils/hooks/useStorageState.js +86 -0
- package/build/cjs/utils/warnOnce.js +14 -0
- package/build/mjs/Account/Account.d.ts +63 -0
- package/build/mjs/Account/Account.test.d.ts +1 -0
- package/build/mjs/Account/AccountPopoverFooter.d.ts +6 -0
- package/build/mjs/Account/AccountPopoverHeader.d.ts +6 -0
- package/build/mjs/Account/AccountPreview.d.ts +64 -0
- package/build/mjs/Account/AccountPreview.test.d.ts +1 -0
- package/build/mjs/Account/SignInButton.d.ts +2 -0
- package/build/mjs/Account/SignOutButton.d.ts +3 -0
- package/build/mjs/Account/index.js +6 -0
- package/build/mjs/AppProvider/AppProvider.d.ts +105 -0
- package/build/mjs/AppProvider/AppProvider.test.d.ts +4 -0
- package/build/mjs/AppProvider/AppProviderComponent.d.ts +14 -0
- package/build/mjs/AppProvider/AppThemeProvider.d.ts +12 -0
- package/build/mjs/DashboardLayout/DashboardLayout.d.ts +91 -0
- package/build/{DashboardLayout → mjs/DashboardLayout}/DashboardLayout.js +9 -10
- package/build/mjs/DashboardLayout/DashboardLayout.test.d.ts +1 -0
- package/build/mjs/DashboardLayout/DashboardSidebarSubNavigation.d.ts +16 -0
- package/build/mjs/DashboardLayout/ThemeSwitcher.d.ts +5 -0
- package/build/mjs/DashboardLayout/TitleBar.d.ts +2 -0
- package/build/mjs/DashboardLayout/ToolbarActions.d.ts +5 -0
- package/build/mjs/DashboardLayout/index.d.ts +2 -0
- package/build/mjs/DashboardLayout/utils.d.ts +8 -0
- package/build/mjs/PageContainer/PageContainer.d.ts +61 -0
- package/build/{PageContainer → mjs/PageContainer}/PageContainer.js +8 -4
- package/build/mjs/PageContainer/PageContainer.test.d.ts +1 -0
- package/build/mjs/PageContainer/PageContainerToolbar.d.ts +16 -0
- package/build/mjs/PageContainer/PageContainerToolbar.test.d.ts +1 -0
- package/build/mjs/PageContainer/index.js +2 -0
- package/build/mjs/index.js +8 -0
- package/build/mjs/nextjs/AppProvider.d.ts +6 -0
- package/build/mjs/nextjs/AppProvider.test.d.ts +1 -0
- package/build/mjs/nextjs/AppProviderNextApp.d.ts +5 -0
- package/build/mjs/nextjs/AppProviderNextPages.d.ts +5 -0
- package/build/mjs/nextjs/index.js +1 -0
- package/build/mjs/persistence/codec.d.ts +47 -0
- package/build/mjs/persistence/index.js +1 -0
- package/build/mjs/persistence/useStorageState.d.ts +50 -0
- package/build/mjs/persistence/useStorageState.test.d.ts +1 -0
- package/build/mjs/react-router-dom/AppProvider.d.ts +6 -0
- package/build/mjs/react-router-dom/AppProvider.test.d.ts +1 -0
- package/build/mjs/react-router-dom/index.d.ts +1 -0
- package/build/mjs/react-router-dom/index.js +1 -0
- package/build/mjs/shared/Link.d.ts +8 -0
- package/build/mjs/shared/components.d.ts +5 -0
- package/build/mjs/shared/context.d.ts +12 -0
- package/build/mjs/shared/locales/LocaleContext.d.ts +56 -0
- package/build/mjs/shared/navigation.d.ts +16 -0
- package/build/mjs/useActivePage/index.js +1 -0
- package/build/mjs/useActivePage/useActivePage.d.ts +8 -0
- package/build/mjs/useLocalStorageState/index.js +1 -0
- package/build/mjs/useLocalStorageState/useLocalStorageState.d.ts +2 -0
- package/build/mjs/useSessionStorageState/index.js +1 -0
- package/build/mjs/useSessionStorageState/useSessionStorageState.d.ts +2 -0
- package/build/mjs/utils/collections.d.ts +44 -0
- package/build/mjs/utils/describeConformance.d.ts +7 -0
- package/build/mjs/utils/events.d.ts +27 -0
- package/build/mjs/utils/hooks/index.js +2 -0
- package/build/mjs/utils/hooks/useBoolean.d.ts +11 -0
- package/build/mjs/utils/hooks/useDebounced.d.ts +8 -0
- package/build/mjs/utils/hooks/useDebouncedHandler.d.ts +12 -0
- package/build/mjs/utils/hooks/useLatest.d.ts +6 -0
- package/build/mjs/utils/hooks/usePageTitle.d.ts +4 -0
- package/build/mjs/utils/hooks/useSsr.d.ts +4 -0
- package/build/mjs/utils/hooks/useStorageState.d.ts +10 -0
- package/build/mjs/utils/warnOnce.d.ts +5 -0
- package/package.json +33 -23
- package/src/DashboardLayout/DashboardLayout.tsx +13 -12
- package/src/PageContainer/PageContainer.tsx +12 -4
- package/tsconfig.cjs.json +20 -0
- package/tsconfig.json +2 -2
- package/build/DashboardLayout/TitleBar.d.ts +0 -2
- /package/build/{Account → cjs/Account}/Account.d.ts +0 -0
- /package/build/{Account → cjs/Account}/Account.test.d.ts +0 -0
- /package/build/{Account → cjs/Account}/AccountPopoverFooter.d.ts +0 -0
- /package/build/{Account → cjs/Account}/AccountPopoverHeader.d.ts +0 -0
- /package/build/{Account → cjs/Account}/AccountPreview.d.ts +0 -0
- /package/build/{Account → cjs/Account}/AccountPreview.test.d.ts +0 -0
- /package/build/{Account → cjs/Account}/SignInButton.d.ts +0 -0
- /package/build/{Account → cjs/Account}/SignOutButton.d.ts +0 -0
- /package/build/{Account → cjs/Account}/index.d.ts +0 -0
- /package/build/{AppProvider → cjs/AppProvider}/AppProvider.d.ts +0 -0
- /package/build/{AppProvider → cjs/AppProvider}/AppProvider.test.d.ts +0 -0
- /package/build/{AppProvider → cjs/AppProvider}/AppProviderComponent.d.ts +0 -0
- /package/build/{AppProvider → cjs/AppProvider}/AppThemeProvider.d.ts +0 -0
- /package/build/{AppProvider → cjs/AppProvider}/index.d.ts +0 -0
- /package/build/{DashboardLayout → cjs/DashboardLayout}/DashboardLayout.d.ts +0 -0
- /package/build/{DashboardLayout → cjs/DashboardLayout}/DashboardLayout.test.d.ts +0 -0
- /package/build/{DashboardLayout → cjs/DashboardLayout}/DashboardSidebarSubNavigation.d.ts +0 -0
- /package/build/{DashboardLayout → cjs/DashboardLayout}/ThemeSwitcher.d.ts +0 -0
- /package/build/{DashboardLayout → cjs/DashboardLayout}/ToolbarActions.d.ts +0 -0
- /package/build/{DashboardLayout → cjs/DashboardLayout}/index.d.ts +0 -0
- /package/build/{DashboardLayout → cjs/DashboardLayout}/utils.d.ts +0 -0
- /package/build/{PageContainer → cjs/PageContainer}/PageContainer.test.d.ts +0 -0
- /package/build/{PageContainer → cjs/PageContainer}/PageContainerToolbar.d.ts +0 -0
- /package/build/{PageContainer → cjs/PageContainer}/PageContainerToolbar.test.d.ts +0 -0
- /package/build/{PageContainer → cjs/PageContainer}/index.d.ts +0 -0
- /package/build/{index.d.ts → cjs/index.d.ts} +0 -0
- /package/build/{nextjs → cjs/nextjs}/AppProvider.d.ts +0 -0
- /package/build/{nextjs → cjs/nextjs}/AppProvider.test.d.ts +0 -0
- /package/build/{nextjs → cjs/nextjs}/AppProviderNextApp.d.ts +0 -0
- /package/build/{nextjs → cjs/nextjs}/AppProviderNextPages.d.ts +0 -0
- /package/build/{nextjs → cjs/nextjs}/index.d.ts +0 -0
- /package/build/{persistence → cjs/persistence}/codec.d.ts +0 -0
- /package/build/{persistence → cjs/persistence}/index.d.ts +0 -0
- /package/build/{persistence → cjs/persistence}/useStorageState.d.ts +0 -0
- /package/build/{persistence → cjs/persistence}/useStorageState.test.d.ts +0 -0
- /package/build/{react-router-dom → cjs/react-router-dom}/AppProvider.d.ts +0 -0
- /package/build/{react-router-dom → cjs/react-router-dom}/AppProvider.test.d.ts +0 -0
- /package/build/{react-router-dom → cjs/react-router-dom}/index.d.ts +0 -0
- /package/build/{shared → cjs/shared}/Link.d.ts +0 -0
- /package/build/{shared → cjs/shared}/components.d.ts +0 -0
- /package/build/{shared → cjs/shared}/context.d.ts +0 -0
- /package/build/{shared → cjs/shared}/locales/LocaleContext.d.ts +0 -0
- /package/build/{shared → cjs/shared}/navigation.d.ts +0 -0
- /package/build/{useActivePage → cjs/useActivePage}/index.d.ts +0 -0
- /package/build/{useActivePage → cjs/useActivePage}/useActivePage.d.ts +0 -0
- /package/build/{useLocalStorageState → cjs/useLocalStorageState}/index.d.ts +0 -0
- /package/build/{useLocalStorageState → cjs/useLocalStorageState}/useLocalStorageState.d.ts +0 -0
- /package/build/{useSessionStorageState → cjs/useSessionStorageState}/index.d.ts +0 -0
- /package/build/{useSessionStorageState → cjs/useSessionStorageState}/useSessionStorageState.d.ts +0 -0
- /package/build/{utils → cjs/utils}/collections.d.ts +0 -0
- /package/build/{utils → cjs/utils}/describeConformance.d.ts +0 -0
- /package/build/{utils → cjs/utils}/events.d.ts +0 -0
- /package/build/{utils → cjs/utils}/hooks/index.d.ts +0 -0
- /package/build/{utils → cjs/utils}/hooks/useBoolean.d.ts +0 -0
- /package/build/{utils → cjs/utils}/hooks/useDebounced.d.ts +0 -0
- /package/build/{utils → cjs/utils}/hooks/useDebouncedHandler.d.ts +0 -0
- /package/build/{utils → cjs/utils}/hooks/useLatest.d.ts +0 -0
- /package/build/{utils → cjs/utils}/hooks/usePageTitle.d.ts +0 -0
- /package/build/{utils → cjs/utils}/hooks/useSsr.d.ts +0 -0
- /package/build/{utils → cjs/utils}/hooks/useStorageState.d.ts +0 -0
- /package/build/{utils → cjs/utils}/warnOnce.d.ts +0 -0
- /package/build/{Account → mjs/Account}/Account.js +0 -0
- /package/build/{Account → mjs/Account}/Account.test.js +0 -0
- /package/build/{Account → mjs/Account}/AccountPopoverFooter.js +0 -0
- /package/build/{Account → mjs/Account}/AccountPopoverHeader.js +0 -0
- /package/build/{Account → mjs/Account}/AccountPreview.js +0 -0
- /package/build/{Account → mjs/Account}/AccountPreview.test.js +0 -0
- /package/build/{Account → mjs/Account}/SignInButton.js +0 -0
- /package/build/{Account → mjs/Account}/SignOutButton.js +0 -0
- /package/build/{Account/index.js → mjs/Account/index.d.ts} +0 -0
- /package/build/{AppProvider → mjs/AppProvider}/AppProvider.js +0 -0
- /package/build/{AppProvider → mjs/AppProvider}/AppProvider.test.js +0 -0
- /package/build/{AppProvider → mjs/AppProvider}/AppProviderComponent.js +0 -0
- /package/build/{AppProvider → mjs/AppProvider}/AppThemeProvider.js +0 -0
- /package/build/{AppProvider/index.js → mjs/AppProvider/index.d.ts} +0 -0
- /package/build/{nextjs → mjs/AppProvider}/index.js +0 -0
- /package/build/{DashboardLayout → mjs/DashboardLayout}/DashboardLayout.test.js +0 -0
- /package/build/{DashboardLayout → mjs/DashboardLayout}/DashboardSidebarSubNavigation.js +0 -0
- /package/build/{DashboardLayout → mjs/DashboardLayout}/ThemeSwitcher.js +0 -0
- /package/build/{DashboardLayout → mjs/DashboardLayout}/TitleBar.js +0 -0
- /package/build/{DashboardLayout → mjs/DashboardLayout}/ToolbarActions.js +0 -0
- /package/build/{DashboardLayout → mjs/DashboardLayout}/index.js +0 -0
- /package/build/{DashboardLayout → mjs/DashboardLayout}/utils.js +0 -0
- /package/build/{PageContainer → mjs/PageContainer}/PageContainer.test.js +0 -0
- /package/build/{PageContainer → mjs/PageContainer}/PageContainerToolbar.js +0 -0
- /package/build/{PageContainer → mjs/PageContainer}/PageContainerToolbar.test.js +0 -0
- /package/build/{PageContainer/index.js → mjs/PageContainer/index.d.ts} +0 -0
- /package/build/{index.js → mjs/index.d.ts} +0 -0
- /package/build/{nextjs → mjs/nextjs}/AppProvider.js +0 -0
- /package/build/{nextjs → mjs/nextjs}/AppProvider.test.js +0 -0
- /package/build/{nextjs → mjs/nextjs}/AppProviderNextApp.js +0 -0
- /package/build/{nextjs → mjs/nextjs}/AppProviderNextPages.js +0 -0
- /package/build/{react-router-dom/index.js → mjs/nextjs/index.d.ts} +0 -0
- /package/build/{persistence → mjs/persistence}/codec.js +0 -0
- /package/build/{persistence/index.js → mjs/persistence/index.d.ts} +0 -0
- /package/build/{persistence → mjs/persistence}/useStorageState.js +0 -0
- /package/build/{persistence → mjs/persistence}/useStorageState.test.js +0 -0
- /package/build/{react-router-dom → mjs/react-router-dom}/AppProvider.js +0 -0
- /package/build/{react-router-dom → mjs/react-router-dom}/AppProvider.test.js +0 -0
- /package/build/{shared → mjs/shared}/Link.js +0 -0
- /package/build/{shared → mjs/shared}/components.js +0 -0
- /package/build/{shared → mjs/shared}/context.js +0 -0
- /package/build/{shared → mjs/shared}/locales/LocaleContext.js +0 -0
- /package/build/{shared → mjs/shared}/navigation.js +0 -0
- /package/build/{useActivePage/index.js → mjs/useActivePage/index.d.ts} +0 -0
- /package/build/{useActivePage → mjs/useActivePage}/useActivePage.js +0 -0
- /package/build/{useLocalStorageState/index.js → mjs/useLocalStorageState/index.d.ts} +0 -0
- /package/build/{useLocalStorageState → mjs/useLocalStorageState}/useLocalStorageState.js +0 -0
- /package/build/{useSessionStorageState/index.js → mjs/useSessionStorageState/index.d.ts} +0 -0
- /package/build/{useSessionStorageState → mjs/useSessionStorageState}/useSessionStorageState.js +0 -0
- /package/build/{utils → mjs/utils}/collections.js +0 -0
- /package/build/{utils → mjs/utils}/describeConformance.js +0 -0
- /package/build/{utils → mjs/utils}/events.js +0 -0
- /package/build/{utils/hooks/index.js → mjs/utils/hooks/index.d.ts} +0 -0
- /package/build/{utils → mjs/utils}/hooks/useBoolean.js +0 -0
- /package/build/{utils → mjs/utils}/hooks/useDebounced.js +0 -0
- /package/build/{utils → mjs/utils}/hooks/useDebouncedHandler.js +0 -0
- /package/build/{utils → mjs/utils}/hooks/useLatest.js +0 -0
- /package/build/{utils → mjs/utils}/hooks/usePageTitle.js +0 -0
- /package/build/{utils → mjs/utils}/hooks/useSsr.js +0 -0
- /package/build/{utils → mjs/utils}/hooks/useStorageState.js +0 -0
- /package/build/{utils → mjs/utils}/warnOnce.js +0 -0
- /package/{vite.config.ts → vite.config.mts} +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Codec } from "./codec";
|
|
3
|
+
export type StorageStateInitializer<T> = () => T | null;
|
|
4
|
+
export type UseStorageStateHookResult<T> = [
|
|
5
|
+
T | null,
|
|
6
|
+
React.Dispatch<React.SetStateAction<T | null>>
|
|
7
|
+
];
|
|
8
|
+
export declare function useStorageStateServer<T = string>(): UseStorageStateHookResult<T>;
|
|
9
|
+
export interface DefaultStorageStateoptions<T = string> {
|
|
10
|
+
codec?: Codec<T>;
|
|
11
|
+
}
|
|
12
|
+
export interface StorageStateOptions<T> extends DefaultStorageStateoptions<T> {
|
|
13
|
+
codec: Codec<T>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Sync state to local storage so that it persists through a page refresh. Usage is
|
|
17
|
+
* similar to useState except we pass in a storage key so that we can default
|
|
18
|
+
* to that value on page load instead of the specified initial value.
|
|
19
|
+
*
|
|
20
|
+
* Since the storage API isn't available in server-rendering environments, we
|
|
21
|
+
* return null during SSR and hydration.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useStorageState(area: Storage, key: string | null, initializer?: string | null | StorageStateInitializer<string>, options?: DefaultStorageStateoptions): UseStorageStateHookResult<string>;
|
|
24
|
+
export declare function useStorageState<T>(area: Storage, key: string | null, initializer: T | null | StorageStateInitializer<T>, options: StorageStateOptions<T>): UseStorageStateHookResult<T>;
|
|
25
|
+
export interface UseStorageState {
|
|
26
|
+
/**
|
|
27
|
+
* Sync state to local or session storage so that it persists through a page refresh. Usage is
|
|
28
|
+
* similar to useState except we pass in a storage key that uniquely identifies the value.
|
|
29
|
+
* @param key The key to use for storing the value in local or session storage.
|
|
30
|
+
* @param initializer The initial value to use if the key is not present in storage.
|
|
31
|
+
* @param options Additional options for the storage state.
|
|
32
|
+
*/
|
|
33
|
+
(key: string | null, initializer?: string | null | StorageStateInitializer<string>, options?: DefaultStorageStateoptions): UseStorageStateHookResult<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Sync state to local or session storage so that it persists through a page refresh. Usage is
|
|
36
|
+
* similar to useState except we pass in a storage key that uniquely identifies the value.
|
|
37
|
+
* @param key The key to use for storing the value in local or session storage.
|
|
38
|
+
* @param initializer The initial value to use if the key is not present in storage.
|
|
39
|
+
* @param options Additional options for the storage state.
|
|
40
|
+
*/
|
|
41
|
+
<T>(key: string | null, initializer: T | null | StorageStateInitializer<T>, options: StorageStateOptions<T>): UseStorageStateHookResult<T>;
|
|
42
|
+
/**
|
|
43
|
+
* Sync state to local or session storage so that it persists through a page refresh. Usage is
|
|
44
|
+
* similar to useState except we pass in a storage key that uniquely identifies the value.
|
|
45
|
+
* @param key The key to use for storing the value in local or session storage.
|
|
46
|
+
* @param initializer The initial value to use if the key is not present in storage.
|
|
47
|
+
* @param options Additional options for the storage state.
|
|
48
|
+
*/
|
|
49
|
+
<T>(key: string | null, initializer?: T | null | StorageStateInitializer<T>, options?: StorageStateOptions<T>): UseStorageStateHookResult<T>;
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./AppProvider";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./AppProvider";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* @ignore - internal component.
|
|
4
|
+
*/
|
|
5
|
+
export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
6
|
+
history?: "auto" | "push" | "replace";
|
|
7
|
+
}
|
|
8
|
+
export declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { PaletteMode } from "@mui/material";
|
|
3
|
+
import type { Branding, Navigation, Router } from "../AppProvider";
|
|
4
|
+
export declare const BrandingContext: React.Context<Branding | null>;
|
|
5
|
+
export declare const NavigationContext: React.Context<Navigation>;
|
|
6
|
+
export declare const PaletteModeContext: React.Context<{
|
|
7
|
+
paletteMode: PaletteMode;
|
|
8
|
+
setPaletteMode: (mode: PaletteMode) => void;
|
|
9
|
+
isDualTheme: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const RouterContext: React.Context<Router | null>;
|
|
12
|
+
export declare const WindowContext: React.Context<Window | undefined>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const DEFAULT_LOCALE_TEXT: {
|
|
3
|
+
signInLabel: string;
|
|
4
|
+
signOutLabel: string;
|
|
5
|
+
accountIconButtonAriaLabel: string;
|
|
6
|
+
expandMenuTitle: string;
|
|
7
|
+
expandNavMenuAriaLabel: string;
|
|
8
|
+
collapseMenuTitle: string;
|
|
9
|
+
collapseNavMenuAriaLabel: string;
|
|
10
|
+
switchModeTitle: string;
|
|
11
|
+
darkModeTitle: string;
|
|
12
|
+
lightModeTitle: string;
|
|
13
|
+
switchThemeModeAriaLabel: string;
|
|
14
|
+
switchToDarkModeAriaLabel: string;
|
|
15
|
+
switchToLightModeAriaLabel: string;
|
|
16
|
+
};
|
|
17
|
+
export type LocaleContextType = typeof DEFAULT_LOCALE_TEXT;
|
|
18
|
+
export declare const LocaleContext: React.Context<{
|
|
19
|
+
signInLabel: string;
|
|
20
|
+
signOutLabel: string;
|
|
21
|
+
accountIconButtonAriaLabel: string;
|
|
22
|
+
expandMenuTitle: string;
|
|
23
|
+
expandNavMenuAriaLabel: string;
|
|
24
|
+
collapseMenuTitle: string;
|
|
25
|
+
collapseNavMenuAriaLabel: string;
|
|
26
|
+
switchModeTitle: string;
|
|
27
|
+
darkModeTitle: string;
|
|
28
|
+
lightModeTitle: string;
|
|
29
|
+
switchThemeModeAriaLabel: string;
|
|
30
|
+
switchToDarkModeAriaLabel: string;
|
|
31
|
+
switchToLightModeAriaLabel: string;
|
|
32
|
+
}>;
|
|
33
|
+
export interface LocaleProviderProps {
|
|
34
|
+
localeText?: Partial<LocaleContextType>;
|
|
35
|
+
children: React.ReactNode;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @ignore - internal component.
|
|
39
|
+
*/
|
|
40
|
+
export declare function LocaleProvider({ localeText, children }: LocaleProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
export declare function useLocaleText(): {
|
|
42
|
+
signInLabel: string;
|
|
43
|
+
signOutLabel: string;
|
|
44
|
+
accountIconButtonAriaLabel: string;
|
|
45
|
+
expandMenuTitle: string;
|
|
46
|
+
expandNavMenuAriaLabel: string;
|
|
47
|
+
collapseMenuTitle: string;
|
|
48
|
+
collapseNavMenuAriaLabel: string;
|
|
49
|
+
switchModeTitle: string;
|
|
50
|
+
darkModeTitle: string;
|
|
51
|
+
lightModeTitle: string;
|
|
52
|
+
switchThemeModeAriaLabel: string;
|
|
53
|
+
switchToDarkModeAriaLabel: string;
|
|
54
|
+
switchToLightModeAriaLabel: string;
|
|
55
|
+
};
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Navigation, NavigationItem, NavigationPageItem, NavigationSubheaderItem } from "../AppProvider";
|
|
2
|
+
export declare const getItemKind: (item: NavigationItem) => "page" | "header" | "divider";
|
|
3
|
+
export declare const isPageItem: (item: NavigationItem) => item is NavigationPageItem;
|
|
4
|
+
export declare const getItemTitle: (item: NavigationPageItem | NavigationSubheaderItem) => string;
|
|
5
|
+
export declare function getPageItemFullPath(basePath: string, navigationItem: NavigationPageItem): string;
|
|
6
|
+
export declare function isPageItemSelected(navigationItem: NavigationPageItem, basePath: string, pathname: string): boolean;
|
|
7
|
+
export declare function hasSelectedNavigationChildren(navigationItem: NavigationItem, basePath: string, pathname: string): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Matches a path against the navigation to find the active page. i.e. the page that should be
|
|
10
|
+
* marked as selected in the navigation.
|
|
11
|
+
*/
|
|
12
|
+
export declare function matchPath(navigation: Navigation, path: string): NavigationPageItem | null;
|
|
13
|
+
/**
|
|
14
|
+
* Gets the path for a specific navigation page item.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getItemPath(navigation: Navigation, item: NavigationPageItem): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./useActivePage";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./useLocalStorageState";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./useSessionStorageState";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare function asArray<T>(maybeArray: T | T[]): T[];
|
|
2
|
+
type PropertiesOf<P> = Extract<keyof P, string>;
|
|
3
|
+
type Require<T, K extends keyof T> = T & {
|
|
4
|
+
[P in K]-?: T[P];
|
|
5
|
+
};
|
|
6
|
+
type Ensure<U, K extends PropertyKey> = K extends keyof U ? Require<U, K> : U & Record<K, unknown>;
|
|
7
|
+
/**
|
|
8
|
+
* Type aware version of Object.protoype.hasOwnProperty.
|
|
9
|
+
* See https://fettblog.eu/typescript-hasownproperty/
|
|
10
|
+
*/
|
|
11
|
+
export declare function hasOwnProperty<X extends {}, Y extends PropertyKey>(obj: X, prop: Y): obj is Ensure<X, Y>;
|
|
12
|
+
/**
|
|
13
|
+
* Maps `obj` to a new object. The `mapper` function receives an entry array of key and value and
|
|
14
|
+
* is allowed to manipulate both. It can also return `null` to omit a property from the result.
|
|
15
|
+
*/
|
|
16
|
+
export declare function mapProperties<P, L extends PropertyKey, U>(obj: P, mapper: <K extends PropertiesOf<P>>(old: [K, P[K]]) => [L, U] | null): Record<L, U>;
|
|
17
|
+
/**
|
|
18
|
+
* Maps an objects' property keys. The result is a new object with the mapped keys, but the same values.
|
|
19
|
+
*/
|
|
20
|
+
export declare function mapKeys<U>(obj: Record<string, U>, mapper: (old: string) => string): Record<string, U>;
|
|
21
|
+
/**
|
|
22
|
+
* Maps an objects' property values. The result is a new object with the same keys, but mapped values.
|
|
23
|
+
*/
|
|
24
|
+
export declare function mapValues<P, V>(obj: P, mapper: (old: P[PropertiesOf<P>], key: PropertiesOf<P>) => V): Record<PropertiesOf<P>, V>;
|
|
25
|
+
/**
|
|
26
|
+
* Filters an objects' property values. Similar to `array.filter` but for objects. The result is a new
|
|
27
|
+
* object with all the properties removed for which `filter` returned `false`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function filterValues<K extends PropertyKey, P, Q extends P>(obj: Record<K, P>, filter: (old: P) => old is Q): Record<K, Q>;
|
|
30
|
+
export declare function filterValues<P>(obj: P, filter: (old: P[keyof P]) => boolean): Partial<P>;
|
|
31
|
+
export declare function filterValues<U>(obj: Record<string, U>, filter: (old: U) => boolean): Record<string, U>;
|
|
32
|
+
/**
|
|
33
|
+
* Filters an objects' property keys. Similar to `array.filter` but for objects. The result is a new
|
|
34
|
+
* object with all the properties removed for which `filter` returned `false`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function filterKeys<P>(obj: P, filter: (old: keyof P) => boolean): Partial<P>;
|
|
37
|
+
export declare function filterKeys<U>(obj: Record<string, U>, filter: (old: string) => boolean): Record<string, U>;
|
|
38
|
+
/**
|
|
39
|
+
* Compares the properties of two objects. Returns `true` if all properties are strictly equal, `false`
|
|
40
|
+
* otherwise.
|
|
41
|
+
* Pass a subset of properties to only compare those.
|
|
42
|
+
*/
|
|
43
|
+
export declare function equalProperties<P extends object>(obj1: P, obj2: P, subset?: (keyof P)[]): boolean;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface ConformanceOptions {
|
|
3
|
+
refInstanceof?: unknown;
|
|
4
|
+
inheritComponent?: React.ElementType;
|
|
5
|
+
skip?: Array<"themeDefaultProps">;
|
|
6
|
+
}
|
|
7
|
+
export default function describeConformance(minimalElement: React.ReactElement<unknown>, getOptions: () => ConformanceOptions): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type EventName = string | symbol;
|
|
2
|
+
export type EventHandlers = Record<EventName, unknown>;
|
|
3
|
+
export type EventHandler<T extends EventHandlers, K extends keyof T = keyof T> = (event: T[K]) => void;
|
|
4
|
+
export type AllEventsHandler<T extends EventHandlers, K extends keyof T = keyof T> = (type: K, event: T[K]) => void;
|
|
5
|
+
/**
|
|
6
|
+
* Lightweight event emitter
|
|
7
|
+
*/
|
|
8
|
+
export declare class Emitter<T extends EventHandlers = {}> {
|
|
9
|
+
private handlers;
|
|
10
|
+
/**
|
|
11
|
+
* Add a listener for an event
|
|
12
|
+
*/
|
|
13
|
+
on(name: "*", handler: AllEventsHandler<T>): void;
|
|
14
|
+
on<K extends keyof T>(name: K, handler: EventHandler<T, K>): void;
|
|
15
|
+
/**
|
|
16
|
+
* Remove a listener from an event
|
|
17
|
+
*/
|
|
18
|
+
off<K extends keyof T>(name: K, handler: EventHandler<T, K>): void;
|
|
19
|
+
/**
|
|
20
|
+
* Subscribe to an event and return an unsubscribe function.
|
|
21
|
+
*/
|
|
22
|
+
subscribe<K extends keyof T>(name: K, handler: EventHandler<T, K>): () => void;
|
|
23
|
+
/**
|
|
24
|
+
* Emit an event.
|
|
25
|
+
*/
|
|
26
|
+
emit<K extends keyof T>(name: K, event: T[K]): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* A utility with shortcuts to manipulate boolean values.
|
|
4
|
+
*/
|
|
5
|
+
export default function useBoolean(initialValue: boolean): {
|
|
6
|
+
value: boolean;
|
|
7
|
+
setValue: React.Dispatch<React.SetStateAction<boolean>>;
|
|
8
|
+
toggle: () => void;
|
|
9
|
+
setTrue: () => void;
|
|
10
|
+
setFalse: () => void;
|
|
11
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This hook allows you to debounce any fast changing value. The debounced value will only
|
|
3
|
+
* reflect the latest value when the useDebounce hook has not been called for the specified
|
|
4
|
+
* time period.
|
|
5
|
+
*
|
|
6
|
+
* Inspired by https://usehooks.com/useDebounce/
|
|
7
|
+
*/
|
|
8
|
+
export default function useDebounced<T>(value: T, delay: number): T;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface Handler<P extends unknown[]> {
|
|
2
|
+
(...params: P): void;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Creates a debounced version of the handler that is passed. The invocation of [fn] is
|
|
6
|
+
* delayed for [delay] milliseconds from the last invocation of the debounced function.
|
|
7
|
+
*
|
|
8
|
+
* This implementation adds on the lodash implementation in that it handles updates to the
|
|
9
|
+
* delay value.
|
|
10
|
+
*/
|
|
11
|
+
export default function useDebouncedHandler<P extends unknown[]>(fn: Handler<P>, delay: number): Handler<P>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
type Initializer<T> = () => T;
|
|
3
|
+
type UseStorageStateHookResult<T> = [
|
|
4
|
+
T,
|
|
5
|
+
React.Dispatch<React.SetStateAction<T>>
|
|
6
|
+
];
|
|
7
|
+
declare function useStorageStateServer(kind: "session" | "local", key: string, initializer: string | Initializer<string>): UseStorageStateHookResult<string>;
|
|
8
|
+
declare function useStorageStateServer(kind: "session" | "local", key: string, initializer?: string | null | Initializer<string | null>): UseStorageStateHookResult<string | null>;
|
|
9
|
+
declare const _default: typeof useStorageStateServer;
|
|
10
|
+
export default _default;
|
package/package.json
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/toolpad",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"author": "ETSOO",
|
|
5
5
|
"description": "Dashboard framework extention based on Toolpad Core",
|
|
6
|
-
"main": "build/index.js",
|
|
7
|
-
"module": "build/index.js",
|
|
8
|
-
"type": "module",
|
|
6
|
+
"main": "build/cjs/index.js",
|
|
7
|
+
"module": "build/mjs/index.js",
|
|
9
8
|
"exports": {
|
|
10
9
|
".": {
|
|
11
|
-
"types": "./build/index.d.ts",
|
|
12
|
-
"import": "./build/index.js"
|
|
10
|
+
"types": "./build/mjs/index.d.ts",
|
|
11
|
+
"import": "./build/mjs/index.js",
|
|
12
|
+
"require": "./build/cjs/index.js"
|
|
13
13
|
},
|
|
14
14
|
"./nextjs": {
|
|
15
|
-
"types": "./build/nextjs/index.d.ts",
|
|
16
|
-
"import": "./build/nextjs/index.js"
|
|
15
|
+
"types": "./build/mjs/nextjs/index.d.ts",
|
|
16
|
+
"import": "./build/mjs/nextjs/index.js",
|
|
17
|
+
"require": "./build/cjs/nextjs/index.js"
|
|
17
18
|
},
|
|
18
19
|
"./react-router-dom": {
|
|
19
|
-
"types": "./build/react-router-dom/index.d.ts",
|
|
20
|
-
"import": "./build/react-router-dom/index.js"
|
|
20
|
+
"types": "./build/mjs/react-router-dom/index.d.ts",
|
|
21
|
+
"import": "./build/mjs/react-router-dom/index.js",
|
|
22
|
+
"require": "./build/cjs/react-router-dom/index.js"
|
|
21
23
|
}
|
|
22
24
|
},
|
|
23
25
|
"sideEffects": false,
|
|
@@ -38,38 +40,46 @@
|
|
|
38
40
|
},
|
|
39
41
|
"homepage": "https://github.com/ETSOO/etsoo-toolpad#readme",
|
|
40
42
|
"scripts": {
|
|
41
|
-
"build": "tsc",
|
|
43
|
+
"build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json",
|
|
42
44
|
"test": "vitest",
|
|
43
45
|
"testb": "vitest --browser.enabled"
|
|
44
46
|
},
|
|
45
47
|
"dependencies": {
|
|
46
|
-
"@babel/runtime": "^7.26.0",
|
|
47
48
|
"@emotion/react": "^11.14.0",
|
|
48
49
|
"@emotion/styled": "^11.14.0",
|
|
50
|
+
"@mui/icons-material": "6.3.1",
|
|
51
|
+
"@mui/material": "6.3.1",
|
|
49
52
|
"@mui/utils": "6.3.1",
|
|
50
53
|
"invariant": "2.2.4",
|
|
51
54
|
"path-to-regexp": "6.3.0",
|
|
52
|
-
"react": "^
|
|
53
|
-
},
|
|
54
|
-
"overrides": {
|
|
55
|
-
"react": "$react",
|
|
56
|
-
"@emotion/react": "$@emotion/react"
|
|
55
|
+
"react": "^19.0.0"
|
|
57
56
|
},
|
|
58
57
|
"devDependencies": {
|
|
59
|
-
"@
|
|
60
|
-
"@
|
|
58
|
+
"@babel/cli": "^7.26.4",
|
|
59
|
+
"@babel/core": "^7.26.0",
|
|
60
|
+
"@babel/plugin-transform-runtime": "^7.25.9",
|
|
61
|
+
"@babel/preset-env": "^7.26.0",
|
|
62
|
+
"@babel/runtime-corejs3": "^7.26.0",
|
|
61
63
|
"@testing-library/jest-dom": "^6.6.3",
|
|
62
64
|
"@testing-library/react": "^16.1.0",
|
|
63
65
|
"@types/invariant": "2.2.37",
|
|
64
|
-
"@types/react": "
|
|
65
|
-
"@types/react-dom": "
|
|
66
|
+
"@types/react": "19.0.4",
|
|
67
|
+
"@types/react-dom": "19.0.2",
|
|
66
68
|
"@vitejs/plugin-react": "4.3.4",
|
|
67
69
|
"@vitest/browser": "2.1.8",
|
|
68
|
-
"jsdom": "^
|
|
69
|
-
"next": "^15.
|
|
70
|
+
"jsdom": "^26.0.0",
|
|
71
|
+
"next": "^15.1.4",
|
|
70
72
|
"next-router-mock": "^0.9.13",
|
|
71
73
|
"playwright": "^1.49.1",
|
|
72
74
|
"react-router-dom": "7.1.1",
|
|
73
75
|
"vitest": "2.1.8"
|
|
76
|
+
},
|
|
77
|
+
"peerDependenciesMeta": {
|
|
78
|
+
"next": {
|
|
79
|
+
"optional": true
|
|
80
|
+
},
|
|
81
|
+
"react-router-dom": {
|
|
82
|
+
"optional": true
|
|
83
|
+
}
|
|
74
84
|
}
|
|
75
85
|
}
|
|
@@ -9,7 +9,6 @@ import Stack from "@mui/material/Stack";
|
|
|
9
9
|
import Toolbar from "@mui/material/Toolbar";
|
|
10
10
|
import Tooltip from "@mui/material/Tooltip";
|
|
11
11
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
12
|
-
import type {} from "@mui/material/themeCssVarsAugmentation";
|
|
13
12
|
import MenuIcon from "@mui/icons-material/Menu";
|
|
14
13
|
import MenuOpenIcon from "@mui/icons-material/MenuOpen";
|
|
15
14
|
import { NavigationContext, WindowContext } from "../shared/context";
|
|
@@ -24,15 +23,6 @@ import {
|
|
|
24
23
|
import { TitleBar } from "./TitleBar";
|
|
25
24
|
import { useLocaleText } from "../shared/locales/LocaleContext";
|
|
26
25
|
|
|
27
|
-
const AppBar = styled(MuiAppBar)(({ theme }) => ({
|
|
28
|
-
borderWidth: 0,
|
|
29
|
-
borderBottomWidth: 1,
|
|
30
|
-
borderStyle: "solid",
|
|
31
|
-
borderColor: (theme.vars ?? theme).palette.divider,
|
|
32
|
-
boxShadow: "none",
|
|
33
|
-
zIndex: theme.zIndex.drawer + 1
|
|
34
|
-
}));
|
|
35
|
-
|
|
36
26
|
export interface SidebarFooterProps {
|
|
37
27
|
mini: boolean;
|
|
38
28
|
}
|
|
@@ -337,7 +327,18 @@ function DashboardLayout(props: DashboardLayoutProps) {
|
|
|
337
327
|
...sx
|
|
338
328
|
}}
|
|
339
329
|
>
|
|
340
|
-
<
|
|
330
|
+
<MuiAppBar
|
|
331
|
+
color="inherit"
|
|
332
|
+
position="absolute"
|
|
333
|
+
sx={(theme) => ({
|
|
334
|
+
borderWidth: 0,
|
|
335
|
+
borderBottomWidth: 1,
|
|
336
|
+
borderStyle: "solid",
|
|
337
|
+
borderColor: theme.palette.divider,
|
|
338
|
+
boxShadow: "none",
|
|
339
|
+
zIndex: theme.zIndex.drawer + 1
|
|
340
|
+
})}
|
|
341
|
+
>
|
|
341
342
|
<Toolbar
|
|
342
343
|
sx={{ backgroundColor: "inherit", mx: { xs: -0.75, sm: -1.5 } }}
|
|
343
344
|
>
|
|
@@ -381,7 +382,7 @@ function DashboardLayout(props: DashboardLayoutProps) {
|
|
|
381
382
|
<ToolbarAccountSlot {...slotProps?.toolbarAccount} />
|
|
382
383
|
</Stack>
|
|
383
384
|
</Toolbar>
|
|
384
|
-
</
|
|
385
|
+
</MuiAppBar>
|
|
385
386
|
|
|
386
387
|
{!hideNavigation ? (
|
|
387
388
|
<React.Fragment>
|
|
@@ -79,10 +79,14 @@ export function PageDataContextProvider(
|
|
|
79
79
|
props: React.PropsWithChildren<PageData>
|
|
80
80
|
) {
|
|
81
81
|
// Destruct
|
|
82
|
-
const { title, breadcrumbs, ...rest } = props;
|
|
82
|
+
const { title, page, breadcrumbs, ...rest } = props;
|
|
83
83
|
|
|
84
84
|
// useReducer hook to manage state with our reducer function and initial state
|
|
85
|
-
const [state, dispatch] = React.useReducer(reducer, {
|
|
85
|
+
const [state, dispatch] = React.useReducer(reducer, {
|
|
86
|
+
title,
|
|
87
|
+
page,
|
|
88
|
+
breadcrumbs
|
|
89
|
+
});
|
|
86
90
|
|
|
87
91
|
// Provide the state and dispatch function to the context value
|
|
88
92
|
return <PageDataContext.Provider value={{ state, dispatch }} {...rest} />;
|
|
@@ -90,6 +94,10 @@ export function PageDataContextProvider(
|
|
|
90
94
|
|
|
91
95
|
export type PageContainerProps = React.PropsWithChildren<
|
|
92
96
|
ContainerProps & {
|
|
97
|
+
/**
|
|
98
|
+
* The default title of the page.
|
|
99
|
+
*/
|
|
100
|
+
defaultTitle?: string;
|
|
93
101
|
/**
|
|
94
102
|
* The components used for each slot inside.
|
|
95
103
|
*/
|
|
@@ -113,7 +121,7 @@ export type PageContainerProps = React.PropsWithChildren<
|
|
|
113
121
|
* - [PageContainer API](https://mui.com/toolpad/core/api/page-container)
|
|
114
122
|
*/
|
|
115
123
|
function PageContainer(props: PageContainerProps) {
|
|
116
|
-
const { children, slots, slotProps, ...rest } = props;
|
|
124
|
+
const { children, defaultTitle, slots, slotProps, ...rest } = props;
|
|
117
125
|
|
|
118
126
|
const loaded = React.useRef(false);
|
|
119
127
|
const { state, dispatch } = React.useContext(PageDataContext);
|
|
@@ -129,7 +137,7 @@ function PageContainer(props: PageContainerProps) {
|
|
|
129
137
|
}, [activePage?.sourcePath]);
|
|
130
138
|
|
|
131
139
|
let resolvedBreadcrumbs = state.breadcrumbs ?? activePage?.breadcrumbs ?? [];
|
|
132
|
-
const title = state.title ?? activePage?.title ?? "";
|
|
140
|
+
const title = state.title ?? defaultTitle ?? activePage?.title ?? "";
|
|
133
141
|
|
|
134
142
|
if (state.page) {
|
|
135
143
|
resolvedBreadcrumbs = [
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
|
+
"target": "ES2020",
|
|
5
|
+
"allowJs": false,
|
|
6
|
+
"module": "NodeNext",
|
|
7
|
+
"moduleResolution": "NodeNext",
|
|
8
|
+
"resolveJsonModule": true,
|
|
9
|
+
"isolatedModules": true,
|
|
10
|
+
"outDir": "./build/cjs",
|
|
11
|
+
"noEmit": false,
|
|
12
|
+
"declaration": true,
|
|
13
|
+
"strict": true,
|
|
14
|
+
"esModuleInterop": true,
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"jsx": "react-jsx",
|
|
17
|
+
"forceConsistentCasingInFileNames": true
|
|
18
|
+
},
|
|
19
|
+
"include": ["src"]
|
|
20
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
4
|
"target": "ES2020",
|
|
5
|
-
"module": "
|
|
5
|
+
"module": "ES2020",
|
|
6
6
|
"moduleResolution": "bundler",
|
|
7
7
|
"isolatedModules": true,
|
|
8
|
-
"outDir": "build",
|
|
8
|
+
"outDir": "./build/mjs",
|
|
9
9
|
"noEmit": false,
|
|
10
10
|
"declaration": true,
|
|
11
11
|
"strict": true,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|