UNPKG

@mui/material

Version:

Material UI is an open-source React component library that implements Google's Material Design. It's comprehensive and can be used in production out of the box.

40 lines (39 loc) 1.18 kB
'use client'; import * as React from 'react'; import ThemeProviderNoVars from "./ThemeProviderNoVars.js"; import { CssVarsProvider } from "./ThemeProviderWithVars.js"; import THEME_ID from "./identifier.js"; import { jsx as _jsx } from "react/jsx-runtime"; export default function ThemeProvider({ theme, ...props }) { if (typeof theme === 'function') { return /*#__PURE__*/_jsx(ThemeProviderNoVars, { theme: theme, ...props }); } const muiTheme = THEME_ID in theme ? theme[THEME_ID] : theme; if (!('colorSchemes' in muiTheme)) { if (!('vars' in muiTheme)) { // For non-CSS variables themes, set `vars` to null to prevent theme inheritance from the upper theme. // The example use case is the docs demo that uses ThemeProvider to customize the theme while the upper theme is using CSS variables. return /*#__PURE__*/_jsx(ThemeProviderNoVars, { theme: { ...theme, vars: null }, ...props }); } return /*#__PURE__*/_jsx(ThemeProviderNoVars, { theme: theme, ...props }); } return /*#__PURE__*/_jsx(CssVarsProvider, { theme: theme, ...props }); }