UNPKG

@etsoo/toolpad

Version:

Dashboard framework extention based on Toolpad Core

32 lines (31 loc) 1.65 kB
"use client"; import { jsx as _jsx } from "react/jsx-runtime"; import { BrandingContext, NavigationContext, RouterContext, WindowContext } from "../shared/context"; import { AppThemeProvider } from "./AppThemeProvider"; import { createTheme as createMuiTheme } from "@mui/material/styles"; import { AuthenticationContext, SessionContext } from "./AppProvider"; import { LocaleProvider } from "../shared/locales/LocaleContext"; function createTheme() { return createMuiTheme({ cssVariables: { colorSchemeSelector: "data-toolpad-color-scheme" }, colorSchemes: { dark: true } }); } /** * * Demos: * * - [App Provider](https://mui.com/toolpad/core/react-app-provider/) * - [Dashboard Layout](https://mui.com/toolpad/core/react-dashboard-layout/) * * API: * * - [AppProvider API](https://mui.com/toolpad/core/api/app-provider) */ function AppProvider(props) { const { children, theme = createTheme(), branding = null, localeText, navigation = [], router = null, authentication = null, session = null, window: appWindow } = props; return (_jsx(WindowContext.Provider, { value: appWindow, children: _jsx(AuthenticationContext.Provider, { value: authentication, children: _jsx(SessionContext.Provider, { value: session, children: _jsx(RouterContext.Provider, { value: router, children: _jsx(AppThemeProvider, { theme: theme, window: appWindow, children: _jsx(LocaleProvider, { localeText: localeText, children: _jsx(BrandingContext.Provider, { value: branding, children: _jsx(NavigationContext.Provider, { value: navigation, children: children }) }) }) }) }) }) }) })); } export { AppProvider };