@toolpad/core
Version:
Dashboard framework powered by Material UI.
126 lines • 3.31 kB
TypeScript
import * as React from 'react';
import { Theme } from '@mui/material/styles';
import type { LinkProps } from '../shared/Link';
import { type LocaleText } from "./LocalizationProvider.js";
export interface NavigateOptions {
history?: 'auto' | 'push' | 'replace';
}
export interface Navigate {
(url: string | URL, options?: NavigateOptions): void;
}
/**
* Abstract router used by Toolpad components.
*/
export interface Router {
pathname: string;
searchParams: URLSearchParams;
navigate: Navigate;
Link?: React.ComponentType<LinkProps>;
}
export interface Branding {
title?: string;
logo?: React.ReactNode;
homeUrl?: string;
}
export interface NavigationPageItem {
kind?: 'page';
segment?: string;
title?: string;
icon?: React.ReactNode;
pattern?: string;
action?: React.ReactNode;
children?: Navigation;
}
export interface NavigationSubheaderItem {
kind: 'header';
title: string;
}
export interface NavigationDividerItem {
kind: 'divider';
}
export type NavigationItem = NavigationPageItem | NavigationSubheaderItem | NavigationDividerItem;
export type Navigation = NavigationItem[];
export interface Session {
user?: {
id?: string | null;
name?: string | null;
image?: string | null;
email?: string | null;
};
}
export interface Authentication {
signIn: () => void;
signOut: () => void;
}
export declare const AuthenticationContext: React.Context<Authentication | null>;
export declare const SessionContext: React.Context<Session | null>;
export type AppTheme = Theme | {
light: Theme;
dark: Theme;
};
export interface AppProviderProps {
/**
* The content of the app provider.
*/
children: React.ReactNode;
/**
* [Theme or themes](https://mui.com/toolpad/core/react-app-provider/#theming) to be used by the app in light/dark mode. A [CSS variables theme](https://mui.com/material-ui/customization/css-theme-variables/overview/) is recommended.
* @default createDefaultTheme()
*/
theme?: AppTheme;
/**
* Branding options for the app.
* @default null
*/
branding?: Branding | null;
/**
* Navigation definition for the app. [Find out more](https://mui.com/toolpad/core/react-app-provider/#navigation).
* @default []
*/
navigation?: Navigation;
/**
* Router implementation used inside Toolpad components.
* @default null
*/
router?: Router;
/**
* Locale text for components
*/
localeText?: Partial<LocaleText>;
/**
* Session info about the current user.
* @default null
*/
session?: Session | null;
/**
* Authentication methods.
* @default null
*/
authentication?: Authentication | null;
/**
* The window where the application is rendered.
* This is needed when rendering the app inside an iframe, for example.
* @default window
*/
window?: Window;
/**
* The nonce to be used for inline scripts.
*/
nonce?: string;
}
/**
*
* 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)
*/
declare function AppProvider(props: AppProviderProps): React.JSX.Element;
declare namespace AppProvider {
var propTypes: any;
}
export { AppProvider };