1 | 'use client';
|
2 |
|
3 | import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
4 | import _extends from "@babel/runtime/helpers/esm/extends";
|
5 | import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
6 | import * as React from 'react';
|
7 | import PropTypes from 'prop-types';
|
8 | import clsx from 'clsx';
|
9 | import composeClasses from '@mui/utils/composeClasses';
|
10 | import { useDefaultProps } from '../DefaultPropsProvider';
|
11 | import styled from '../styles/styled';
|
12 | import { html, body } from '../CssBaseline/CssBaseline';
|
13 | import { getScopedCssBaselineUtilityClass } from './scopedCssBaselineClasses';
|
14 | import { jsx as _jsx } from "react/jsx-runtime";
|
15 | var useUtilityClasses = function useUtilityClasses(ownerState) {
|
16 | var classes = ownerState.classes;
|
17 | var slots = {
|
18 | root: ['root']
|
19 | };
|
20 | return composeClasses(slots, getScopedCssBaselineUtilityClass, classes);
|
21 | };
|
22 | var ScopedCssBaselineRoot = styled('div', {
|
23 | name: 'MuiScopedCssBaseline',
|
24 | slot: 'Root',
|
25 | overridesResolver: function overridesResolver(props, styles) {
|
26 | return styles.root;
|
27 | }
|
28 | })(function (_ref) {
|
29 | var theme = _ref.theme,
|
30 | ownerState = _ref.ownerState;
|
31 | var colorSchemeStyles = {};
|
32 | if (ownerState.enableColorScheme && theme.colorSchemes) {
|
33 | Object.entries(theme.colorSchemes).forEach(function (_ref2) {
|
34 | var _scheme$palette;
|
35 | var _ref3 = _slicedToArray(_ref2, 2),
|
36 | key = _ref3[0],
|
37 | scheme = _ref3[1];
|
38 | colorSchemeStyles["&".concat(theme.getColorSchemeSelector(key).replace(/\s*&/, ''))] = {
|
39 | colorScheme: (_scheme$palette = scheme.palette) == null ? void 0 : _scheme$palette.mode
|
40 | };
|
41 | });
|
42 | }
|
43 | return _extends({}, html(theme, ownerState.enableColorScheme), body(theme), {
|
44 | '& *, & *::before, & *::after': {
|
45 | boxSizing: 'inherit'
|
46 | },
|
47 | '& strong, & b': {
|
48 | fontWeight: theme.typography.fontWeightBold
|
49 | }
|
50 | }, colorSchemeStyles);
|
51 | });
|
52 | var ScopedCssBaseline = React.forwardRef(function ScopedCssBaseline(inProps, ref) {
|
53 | var props = useDefaultProps({
|
54 | props: inProps,
|
55 | name: 'MuiScopedCssBaseline'
|
56 | });
|
57 | var className = props.className,
|
58 | _props$component = props.component,
|
59 | component = _props$component === void 0 ? 'div' : _props$component,
|
60 | enableColorScheme = props.enableColorScheme,
|
61 | other = _objectWithoutProperties(props, ["className", "component", "enableColorScheme"]);
|
62 | var ownerState = _extends({}, props, {
|
63 | component: component
|
64 | });
|
65 | var classes = useUtilityClasses(ownerState);
|
66 | return _jsx(ScopedCssBaselineRoot, _extends({
|
67 | as: component,
|
68 | className: clsx(classes.root, className),
|
69 | ref: ref,
|
70 | ownerState: ownerState
|
71 | }, other));
|
72 | });
|
73 | process.env.NODE_ENV !== "production" ? ScopedCssBaseline.propTypes = {
|
74 |
|
75 |
|
76 |
|
77 |
|
78 | |
79 |
|
80 |
|
81 | children: PropTypes.node,
|
82 | |
83 |
|
84 |
|
85 | classes: PropTypes.object,
|
86 | |
87 |
|
88 |
|
89 | className: PropTypes.string,
|
90 | |
91 |
|
92 |
|
93 |
|
94 | component: PropTypes.elementType,
|
95 | |
96 |
|
97 |
|
98 |
|
99 |
|
100 | enableColorScheme: PropTypes.bool,
|
101 | |
102 |
|
103 |
|
104 | sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
105 | } : void 0;
|
106 | export default ScopedCssBaseline; |
\ | No newline at end of file |