UNPKG

@mui/material

Version:

Quickly build beautiful React apps. MUI is a simple and customizable component library to build faster, beautiful, and more accessible React applications. Follow your own design system, or start with Material Design.

100 lines (93 loc) 3.19 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import * as React from 'react'; import PropTypes from 'prop-types'; import useThemeProps from '../styles/useThemeProps'; import GlobalStyles from '../GlobalStyles'; import { jsx as _jsx } from "react/jsx-runtime"; import { jsxs as _jsxs } from "react/jsx-runtime"; export const html = (theme, enableColorScheme) => _extends({ WebkitFontSmoothing: 'antialiased', // Antialiasing. MozOsxFontSmoothing: 'grayscale', // Antialiasing. // Change from `box-sizing: content-box` so that `width` // is not affected by `padding` or `border`. boxSizing: 'border-box', // Fix font resize problem in iOS WebkitTextSizeAdjust: '100%' }, enableColorScheme && { colorScheme: theme.palette.mode }); export const body = theme => _extends({ color: theme.palette.text.primary }, theme.typography.body1, { backgroundColor: theme.palette.background.default, '@media print': { // Save printer ink. backgroundColor: theme.palette.common.white } }); export const styles = (theme, enableColorScheme = false) => { var _theme$components, _theme$components$Mui; let defaultStyles = { html: html(theme, enableColorScheme), '*, *::before, *::after': { boxSizing: 'inherit' }, 'strong, b': { fontWeight: theme.typography.fontWeightBold }, body: _extends({ margin: 0 }, body(theme), { // Add support for document.body.requestFullScreen(). // Other elements, if background transparent, are not supported. '&::backdrop': { backgroundColor: theme.palette.background.default } }) }; const themeOverrides = (_theme$components = theme.components) == null ? void 0 : (_theme$components$Mui = _theme$components.MuiCssBaseline) == null ? void 0 : _theme$components$Mui.styleOverrides; if (themeOverrides) { defaultStyles = [defaultStyles, themeOverrides]; } return defaultStyles; }; /** * Kickstart an elegant, consistent, and simple baseline to build upon. */ function CssBaseline(inProps) { const props = useThemeProps({ props: inProps, name: 'MuiCssBaseline' }); const { children, enableColorScheme = false } = props; return /*#__PURE__*/_jsxs(React.Fragment, { children: [/*#__PURE__*/_jsx(GlobalStyles, { styles: theme => styles(theme, enableColorScheme) }), children] }); } process.env.NODE_ENV !== "production" ? CssBaseline.propTypes /* remove-proptypes */ = { // ----------------------------- Warning -------------------------------- // | These PropTypes are generated from the TypeScript type definitions | // | To update them edit the d.ts file and run "yarn proptypes" | // ---------------------------------------------------------------------- /** * You can wrap a node. */ children: PropTypes.node, /** * Enable `color-scheme` CSS property to use `theme.palette.mode`. * For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme * For browser support, check out https://caniuse.com/?search=color-scheme * @default false */ enableColorScheme: PropTypes.bool } : void 0; export default CssBaseline;