UNPKG

3.6 kBJavaScriptView Raw
1import _extends from "@babel/runtime/helpers/esm/extends";
2import * as React from 'react';
3import PropTypes from 'prop-types';
4import useThemeProps from '../styles/useThemeProps';
5import GlobalStyles from '../GlobalStyles';
6import { jsx as _jsx } from "react/jsx-runtime";
7import { jsxs as _jsxs } from "react/jsx-runtime";
8export var html = function html(theme, enableColorScheme) {
9 return _extends({
10 WebkitFontSmoothing: 'antialiased',
11 // Antialiasing.
12 MozOsxFontSmoothing: 'grayscale',
13 // Antialiasing.
14 // Change from `box-sizing: content-box` so that `width`
15 // is not affected by `padding` or `border`.
16 boxSizing: 'border-box',
17 // Fix font resize problem in iOS
18 WebkitTextSizeAdjust: '100%'
19 }, enableColorScheme && {
20 colorScheme: theme.palette.mode
21 });
22};
23export var body = function body(theme) {
24 return _extends({
25 color: (theme.vars || theme).palette.text.primary
26 }, theme.typography.body1, {
27 backgroundColor: (theme.vars || theme).palette.background.default,
28 '@media print': {
29 // Save printer ink.
30 backgroundColor: (theme.vars || theme).palette.common.white
31 }
32 });
33};
34
35var _styles = function styles(theme) {
36 var _theme$components, _theme$components$Mui;
37
38 var enableColorScheme = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
39 var defaultStyles = {
40 html: html(theme, enableColorScheme),
41 '*, *::before, *::after': {
42 boxSizing: 'inherit'
43 },
44 'strong, b': {
45 fontWeight: theme.typography.fontWeightBold
46 },
47 body: _extends({
48 margin: 0
49 }, body(theme), {
50 // Add support for document.body.requestFullScreen().
51 // Other elements, if background transparent, are not supported.
52 '&::backdrop': {
53 backgroundColor: (theme.vars || theme).palette.background.default
54 }
55 })
56 };
57 var themeOverrides = (_theme$components = theme.components) == null ? void 0 : (_theme$components$Mui = _theme$components.MuiCssBaseline) == null ? void 0 : _theme$components$Mui.styleOverrides;
58
59 if (themeOverrides) {
60 defaultStyles = [defaultStyles, themeOverrides];
61 }
62
63 return defaultStyles;
64};
65/**
66 * Kickstart an elegant, consistent, and simple baseline to build upon.
67 */
68
69
70export { _styles as styles };
71
72function CssBaseline(inProps) {
73 var props = useThemeProps({
74 props: inProps,
75 name: 'MuiCssBaseline'
76 });
77 var children = props.children,
78 _props$enableColorSch = props.enableColorScheme,
79 enableColorScheme = _props$enableColorSch === void 0 ? false : _props$enableColorSch;
80 return /*#__PURE__*/_jsxs(React.Fragment, {
81 children: [/*#__PURE__*/_jsx(GlobalStyles, {
82 styles: function styles(theme) {
83 return _styles(theme, enableColorScheme);
84 }
85 }), children]
86 });
87}
88
89process.env.NODE_ENV !== "production" ? CssBaseline.propTypes
90/* remove-proptypes */
91= {
92 // ----------------------------- Warning --------------------------------
93 // | These PropTypes are generated from the TypeScript type definitions |
94 // | To update them edit the d.ts file and run "yarn proptypes" |
95 // ----------------------------------------------------------------------
96
97 /**
98 * You can wrap a node.
99 */
100 children: PropTypes.node,
101
102 /**
103 * Enable `color-scheme` CSS property to use `theme.palette.mode`.
104 * For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
105 * For browser support, check out https://caniuse.com/?search=color-scheme
106 * @default false
107 */
108 enableColorScheme: PropTypes.bool
109} : void 0;
110export default CssBaseline;
\No newline at end of file