@mui/system 5.7.0 → 5.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Box/Box.spec.d.ts +1 -1
- package/CHANGELOG.md +72 -0
- package/Container/Container.d.ts +13 -0
- package/Container/Container.js +81 -0
- package/Container/ContainerProps.d.ts +40 -0
- package/Container/ContainerProps.js +5 -0
- package/Container/containerClasses.d.ts +22 -0
- package/Container/containerClasses.js +17 -0
- package/Container/createContainer.d.ts +18 -0
- package/Container/createContainer.js +172 -0
- package/Container/index.d.ts +5 -0
- package/Container/index.js +42 -0
- package/Container/package.json +6 -0
- package/createBox.spec.d.ts +1 -1
- package/createTheme/createBreakpoints.d.ts +5 -0
- package/createTheme/createSpacing.d.ts +10 -10
- package/cssVars/createCssVarsProvider.spec.d.ts +1 -1
- package/cssVars/createGetCssVar.d.ts +5 -5
- package/cssVars/cssVarsParser.d.ts +70 -70
- package/cssVars/getInitColorSchemeScript.d.ts +40 -40
- package/cssVars/index.d.ts +2 -2
- package/cssVars/useCurrentColorScheme.d.ts +53 -53
- package/esm/Container/Container.js +70 -0
- package/esm/Container/ContainerProps.js +1 -0
- package/esm/Container/containerClasses.js +6 -0
- package/esm/Container/createContainer.js +151 -0
- package/esm/Container/index.js +3 -0
- package/esm/index.js +4 -1
- package/index.d.ts +6 -0
- package/index.js +32 -2
- package/index.spec.d.ts +1 -1
- package/legacy/Container/Container.js +70 -0
- package/legacy/Container/ContainerProps.js +1 -0
- package/legacy/Container/containerClasses.js +6 -0
- package/legacy/Container/createContainer.js +148 -0
- package/legacy/Container/index.js +3 -0
- package/legacy/index.js +5 -2
- package/modern/Container/Container.js +70 -0
- package/modern/Container/ContainerProps.js +1 -0
- package/modern/Container/containerClasses.js +6 -0
- package/modern/Container/createContainer.js +151 -0
- package/modern/Container/index.js +3 -0
- package/modern/index.js +5 -2
- package/package.json +4 -4
- package/styleFunctionSx/styleFunctionSx.spec.d.ts +1 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import createContainer from './createContainer';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* Demos:
|
|
6
|
+
*
|
|
7
|
+
* - [Container (Material UI)](https://mui.com/material-ui/react-container/)
|
|
8
|
+
* - [Container (MUI System)](https://mui.com/system/react-container/)
|
|
9
|
+
*
|
|
10
|
+
* API:
|
|
11
|
+
*
|
|
12
|
+
* - [Container API](https://mui.com/system/api/container/)
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
var Container = createContainer();
|
|
16
|
+
process.env.NODE_ENV !== "production" ? Container.propTypes
|
|
17
|
+
/* remove-proptypes */
|
|
18
|
+
= {
|
|
19
|
+
// ----------------------------- Warning --------------------------------
|
|
20
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
21
|
+
// | To update them edit TypeScript types and run "yarn proptypes" |
|
|
22
|
+
// ----------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @ignore
|
|
26
|
+
*/
|
|
27
|
+
children: PropTypes.node,
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Override or extend the styles applied to the component.
|
|
31
|
+
*/
|
|
32
|
+
classes: PropTypes.object,
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The component used for the root node.
|
|
36
|
+
* Either a string to use a HTML element or a component.
|
|
37
|
+
*/
|
|
38
|
+
component: PropTypes.elementType,
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* If `true`, the left and right padding is removed.
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
disableGutters: PropTypes.bool,
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Set the max-width to match the min-width of the current breakpoint.
|
|
48
|
+
* This is useful if you'd prefer to design for a fixed set of sizes
|
|
49
|
+
* instead of trying to accommodate a fully fluid viewport.
|
|
50
|
+
* It's fluid by default.
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
fixed: PropTypes.bool,
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Determine the max-width of the container.
|
|
57
|
+
* The container width grows with the size of the screen.
|
|
58
|
+
* Set to `false` to disable `maxWidth`.
|
|
59
|
+
* @default 'lg'
|
|
60
|
+
*/
|
|
61
|
+
maxWidth: PropTypes
|
|
62
|
+
/* @typescript-to-proptypes-ignore */
|
|
63
|
+
.oneOfType([PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl', false]), PropTypes.string]),
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
67
|
+
*/
|
|
68
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
69
|
+
} : void 0;
|
|
70
|
+
export default Container;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
2
|
+
export function getContainerUtilityClass(slot) {
|
|
3
|
+
return generateUtilityClass('MuiContainer', slot);
|
|
4
|
+
}
|
|
5
|
+
var containerClasses = generateUtilityClasses('MuiContainer', ['root', 'disableGutters', 'fixed', 'maxWidthXs', 'maxWidthSm', 'maxWidthMd', 'maxWidthLg', 'maxWidthXl']);
|
|
6
|
+
export default containerClasses;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import clsx from 'clsx';
|
|
7
|
+
import { unstable_capitalize as capitalize, unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass } from '@mui/utils';
|
|
8
|
+
import useThemePropsSystem from '../useThemeProps';
|
|
9
|
+
import systemStyled from '../styled';
|
|
10
|
+
import createTheme from '../createTheme';
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
var defaultTheme = createTheme();
|
|
13
|
+
var defaultCreateStyledComponent = systemStyled('div', {
|
|
14
|
+
name: 'MuiContainer',
|
|
15
|
+
slot: 'Root',
|
|
16
|
+
overridesResolver: function overridesResolver(props, styles) {
|
|
17
|
+
var ownerState = props.ownerState;
|
|
18
|
+
return [styles.root, styles["maxWidth".concat(capitalize(String(ownerState.maxWidth)))], ownerState.fixed && styles.fixed, ownerState.disableGutters && styles.disableGutters];
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
var useThemePropsDefault = function useThemePropsDefault(inProps) {
|
|
23
|
+
return useThemePropsSystem({
|
|
24
|
+
props: inProps,
|
|
25
|
+
name: 'MuiContainer',
|
|
26
|
+
defaultTheme: defaultTheme
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var useUtilityClasses = function useUtilityClasses(ownerState, componentName) {
|
|
31
|
+
var getContainerUtilityClass = function getContainerUtilityClass(slot) {
|
|
32
|
+
return generateUtilityClass(componentName, slot);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var classes = ownerState.classes,
|
|
36
|
+
fixed = ownerState.fixed,
|
|
37
|
+
disableGutters = ownerState.disableGutters,
|
|
38
|
+
maxWidth = ownerState.maxWidth;
|
|
39
|
+
var slots = {
|
|
40
|
+
root: ['root', maxWidth && "maxWidth".concat(capitalize(String(maxWidth))), fixed && 'fixed', disableGutters && 'disableGutters']
|
|
41
|
+
};
|
|
42
|
+
return composeClasses(slots, getContainerUtilityClass, classes);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default function createContainer() {
|
|
46
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
47
|
+
var _options$createStyled = options.createStyledComponent,
|
|
48
|
+
createStyledComponent = _options$createStyled === void 0 ? defaultCreateStyledComponent : _options$createStyled,
|
|
49
|
+
_options$useThemeProp = options.useThemeProps,
|
|
50
|
+
useThemeProps = _options$useThemeProp === void 0 ? useThemePropsDefault : _options$useThemeProp,
|
|
51
|
+
_options$componentNam = options.componentName,
|
|
52
|
+
componentName = _options$componentNam === void 0 ? 'MuiContainer' : _options$componentNam;
|
|
53
|
+
var ContainerRoot = createStyledComponent(function (_ref) {
|
|
54
|
+
var theme = _ref.theme,
|
|
55
|
+
ownerState = _ref.ownerState;
|
|
56
|
+
return _extends({
|
|
57
|
+
width: '100%',
|
|
58
|
+
marginLeft: 'auto',
|
|
59
|
+
boxSizing: 'border-box',
|
|
60
|
+
marginRight: 'auto',
|
|
61
|
+
display: 'block'
|
|
62
|
+
}, !ownerState.disableGutters && _defineProperty({
|
|
63
|
+
paddingLeft: theme.spacing(2),
|
|
64
|
+
paddingRight: theme.spacing(2)
|
|
65
|
+
}, theme.breakpoints.up('sm'), {
|
|
66
|
+
paddingLeft: theme.spacing(3),
|
|
67
|
+
paddingRight: theme.spacing(3)
|
|
68
|
+
}));
|
|
69
|
+
}, function (_ref3) {
|
|
70
|
+
var theme = _ref3.theme,
|
|
71
|
+
ownerState = _ref3.ownerState;
|
|
72
|
+
return ownerState.fixed && Object.keys(theme.breakpoints.values).reduce(function (acc, breakpointValueKey) {
|
|
73
|
+
var breakpoint = breakpointValueKey;
|
|
74
|
+
var value = theme.breakpoints.values[breakpoint];
|
|
75
|
+
|
|
76
|
+
if (value !== 0) {
|
|
77
|
+
// @ts-ignore
|
|
78
|
+
acc[theme.breakpoints.up(breakpoint)] = {
|
|
79
|
+
maxWidth: "".concat(value).concat(theme.breakpoints.unit)
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return acc;
|
|
84
|
+
}, {});
|
|
85
|
+
}, function (_ref4) {
|
|
86
|
+
var theme = _ref4.theme,
|
|
87
|
+
ownerState = _ref4.ownerState;
|
|
88
|
+
return _extends({}, ownerState.maxWidth === 'xs' && _defineProperty({}, theme.breakpoints.up('xs'), {
|
|
89
|
+
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
90
|
+
maxWidth: Math.max(theme.breakpoints.values.xs, 444)
|
|
91
|
+
}), ownerState.maxWidth && // @ts-ignore module augmentation fails if custom breakpoints are used
|
|
92
|
+
ownerState.maxWidth !== 'xs' && _defineProperty({}, theme.breakpoints.up(ownerState.maxWidth), {
|
|
93
|
+
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
94
|
+
maxWidth: "".concat(theme.breakpoints.values[ownerState.maxWidth]).concat(theme.breakpoints.unit)
|
|
95
|
+
}));
|
|
96
|
+
});
|
|
97
|
+
var Container = /*#__PURE__*/React.forwardRef(function Container(inProps, ref) {
|
|
98
|
+
var props = useThemeProps(inProps);
|
|
99
|
+
|
|
100
|
+
var className = props.className,
|
|
101
|
+
_props$component = props.component,
|
|
102
|
+
component = _props$component === void 0 ? 'div' : _props$component,
|
|
103
|
+
_props$disableGutters = props.disableGutters,
|
|
104
|
+
disableGutters = _props$disableGutters === void 0 ? false : _props$disableGutters,
|
|
105
|
+
_props$fixed = props.fixed,
|
|
106
|
+
fixed = _props$fixed === void 0 ? false : _props$fixed,
|
|
107
|
+
_props$maxWidth = props.maxWidth,
|
|
108
|
+
maxWidth = _props$maxWidth === void 0 ? 'lg' : _props$maxWidth,
|
|
109
|
+
classesProp = props.classes,
|
|
110
|
+
other = _objectWithoutProperties(props, ["className", "component", "disableGutters", "fixed", "maxWidth", "classes"]);
|
|
111
|
+
|
|
112
|
+
var ownerState = _extends({}, props, {
|
|
113
|
+
component: component,
|
|
114
|
+
disableGutters: disableGutters,
|
|
115
|
+
fixed: fixed,
|
|
116
|
+
maxWidth: maxWidth
|
|
117
|
+
}); // @ts-ignore module augmentation fails if custom breakpoints are used
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
var classes = useUtilityClasses(ownerState, componentName);
|
|
121
|
+
return (
|
|
122
|
+
/*#__PURE__*/
|
|
123
|
+
// @ts-ignore theme is injected by the styled util
|
|
124
|
+
_jsx(ContainerRoot, _extends({
|
|
125
|
+
as: component // @ts-ignore module augmentation fails if custom breakpoints are used
|
|
126
|
+
,
|
|
127
|
+
ownerState: ownerState,
|
|
128
|
+
className: clsx(classes.root, className),
|
|
129
|
+
ref: ref
|
|
130
|
+
}, other))
|
|
131
|
+
);
|
|
132
|
+
});
|
|
133
|
+
process.env.NODE_ENV !== "production" ? Container.propTypes
|
|
134
|
+
/* remove-proptypes */
|
|
135
|
+
= {
|
|
136
|
+
children: PropTypes.node,
|
|
137
|
+
classes: PropTypes.object,
|
|
138
|
+
className: PropTypes.string,
|
|
139
|
+
component: PropTypes.elementType,
|
|
140
|
+
disableGutters: PropTypes.bool,
|
|
141
|
+
fixed: PropTypes.bool,
|
|
142
|
+
maxWidth: PropTypes
|
|
143
|
+
/* @typescript-to-proptypes-ignore */
|
|
144
|
+
.oneOfType([PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl', false]), PropTypes.string]),
|
|
145
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
146
|
+
} : void 0;
|
|
147
|
+
return Container;
|
|
148
|
+
}
|
package/legacy/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MUI v5.
|
|
1
|
+
/** @license MUI v5.8.0
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the MIT license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -44,4 +44,7 @@ export { default as useThemeWithoutDefault } from './useThemeWithoutDefault';
|
|
|
44
44
|
export * from './colorManipulator';
|
|
45
45
|
export { default as ThemeProvider } from './ThemeProvider';
|
|
46
46
|
export { default as unstable_createCssVarsProvider } from './cssVars/createCssVarsProvider';
|
|
47
|
-
export { default as unstable_createGetCssVar } from './cssVars/createGetCssVar';
|
|
47
|
+
export { default as unstable_createGetCssVar } from './cssVars/createGetCssVar';
|
|
48
|
+
export { default as createContainer } from './Container/createContainer';
|
|
49
|
+
export { default as Container } from './Container';
|
|
50
|
+
export * from './Container';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import createContainer from './createContainer';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* Demos:
|
|
6
|
+
*
|
|
7
|
+
* - [Container (Material UI)](https://mui.com/material-ui/react-container/)
|
|
8
|
+
* - [Container (MUI System)](https://mui.com/system/react-container/)
|
|
9
|
+
*
|
|
10
|
+
* API:
|
|
11
|
+
*
|
|
12
|
+
* - [Container API](https://mui.com/system/api/container/)
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const Container = createContainer();
|
|
16
|
+
process.env.NODE_ENV !== "production" ? Container.propTypes
|
|
17
|
+
/* remove-proptypes */
|
|
18
|
+
= {
|
|
19
|
+
// ----------------------------- Warning --------------------------------
|
|
20
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
21
|
+
// | To update them edit TypeScript types and run "yarn proptypes" |
|
|
22
|
+
// ----------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @ignore
|
|
26
|
+
*/
|
|
27
|
+
children: PropTypes.node,
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Override or extend the styles applied to the component.
|
|
31
|
+
*/
|
|
32
|
+
classes: PropTypes.object,
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The component used for the root node.
|
|
36
|
+
* Either a string to use a HTML element or a component.
|
|
37
|
+
*/
|
|
38
|
+
component: PropTypes.elementType,
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* If `true`, the left and right padding is removed.
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
disableGutters: PropTypes.bool,
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Set the max-width to match the min-width of the current breakpoint.
|
|
48
|
+
* This is useful if you'd prefer to design for a fixed set of sizes
|
|
49
|
+
* instead of trying to accommodate a fully fluid viewport.
|
|
50
|
+
* It's fluid by default.
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
fixed: PropTypes.bool,
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Determine the max-width of the container.
|
|
57
|
+
* The container width grows with the size of the screen.
|
|
58
|
+
* Set to `false` to disable `maxWidth`.
|
|
59
|
+
* @default 'lg'
|
|
60
|
+
*/
|
|
61
|
+
maxWidth: PropTypes
|
|
62
|
+
/* @typescript-to-proptypes-ignore */
|
|
63
|
+
.oneOfType([PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl', false]), PropTypes.string]),
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
67
|
+
*/
|
|
68
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
69
|
+
} : void 0;
|
|
70
|
+
export default Container;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
2
|
+
export function getContainerUtilityClass(slot) {
|
|
3
|
+
return generateUtilityClass('MuiContainer', slot);
|
|
4
|
+
}
|
|
5
|
+
const containerClasses = generateUtilityClasses('MuiContainer', ['root', 'disableGutters', 'fixed', 'maxWidthXs', 'maxWidthSm', 'maxWidthMd', 'maxWidthLg', 'maxWidthXl']);
|
|
6
|
+
export default containerClasses;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
const _excluded = ["className", "component", "disableGutters", "fixed", "maxWidth", "classes"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import clsx from 'clsx';
|
|
7
|
+
import { unstable_capitalize as capitalize, unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass } from '@mui/utils';
|
|
8
|
+
import useThemePropsSystem from '../useThemeProps';
|
|
9
|
+
import systemStyled from '../styled';
|
|
10
|
+
import createTheme from '../createTheme';
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
const defaultTheme = createTheme();
|
|
13
|
+
const defaultCreateStyledComponent = systemStyled('div', {
|
|
14
|
+
name: 'MuiContainer',
|
|
15
|
+
slot: 'Root',
|
|
16
|
+
overridesResolver: (props, styles) => {
|
|
17
|
+
const {
|
|
18
|
+
ownerState
|
|
19
|
+
} = props;
|
|
20
|
+
return [styles.root, styles[`maxWidth${capitalize(String(ownerState.maxWidth))}`], ownerState.fixed && styles.fixed, ownerState.disableGutters && styles.disableGutters];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const useThemePropsDefault = inProps => useThemePropsSystem({
|
|
25
|
+
props: inProps,
|
|
26
|
+
name: 'MuiContainer',
|
|
27
|
+
defaultTheme
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const useUtilityClasses = (ownerState, componentName) => {
|
|
31
|
+
const getContainerUtilityClass = slot => {
|
|
32
|
+
return generateUtilityClass(componentName, slot);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const {
|
|
36
|
+
classes,
|
|
37
|
+
fixed,
|
|
38
|
+
disableGutters,
|
|
39
|
+
maxWidth
|
|
40
|
+
} = ownerState;
|
|
41
|
+
const slots = {
|
|
42
|
+
root: ['root', maxWidth && `maxWidth${capitalize(String(maxWidth))}`, fixed && 'fixed', disableGutters && 'disableGutters']
|
|
43
|
+
};
|
|
44
|
+
return composeClasses(slots, getContainerUtilityClass, classes);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default function createContainer(options = {}) {
|
|
48
|
+
const {
|
|
49
|
+
// This will allow adding custom styled fn (for example for custom sx style function)
|
|
50
|
+
createStyledComponent = defaultCreateStyledComponent,
|
|
51
|
+
useThemeProps = useThemePropsDefault,
|
|
52
|
+
componentName = 'MuiContainer'
|
|
53
|
+
} = options;
|
|
54
|
+
const ContainerRoot = createStyledComponent(({
|
|
55
|
+
theme,
|
|
56
|
+
ownerState
|
|
57
|
+
}) => _extends({
|
|
58
|
+
width: '100%',
|
|
59
|
+
marginLeft: 'auto',
|
|
60
|
+
boxSizing: 'border-box',
|
|
61
|
+
marginRight: 'auto',
|
|
62
|
+
display: 'block'
|
|
63
|
+
}, !ownerState.disableGutters && {
|
|
64
|
+
paddingLeft: theme.spacing(2),
|
|
65
|
+
paddingRight: theme.spacing(2),
|
|
66
|
+
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
67
|
+
[theme.breakpoints.up('sm')]: {
|
|
68
|
+
paddingLeft: theme.spacing(3),
|
|
69
|
+
paddingRight: theme.spacing(3)
|
|
70
|
+
}
|
|
71
|
+
}), ({
|
|
72
|
+
theme,
|
|
73
|
+
ownerState
|
|
74
|
+
}) => ownerState.fixed && Object.keys(theme.breakpoints.values).reduce((acc, breakpointValueKey) => {
|
|
75
|
+
const breakpoint = breakpointValueKey;
|
|
76
|
+
const value = theme.breakpoints.values[breakpoint];
|
|
77
|
+
|
|
78
|
+
if (value !== 0) {
|
|
79
|
+
// @ts-ignore
|
|
80
|
+
acc[theme.breakpoints.up(breakpoint)] = {
|
|
81
|
+
maxWidth: `${value}${theme.breakpoints.unit}`
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return acc;
|
|
86
|
+
}, {}), ({
|
|
87
|
+
theme,
|
|
88
|
+
ownerState
|
|
89
|
+
}) => _extends({}, ownerState.maxWidth === 'xs' && {
|
|
90
|
+
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
91
|
+
[theme.breakpoints.up('xs')]: {
|
|
92
|
+
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
93
|
+
maxWidth: Math.max(theme.breakpoints.values.xs, 444)
|
|
94
|
+
}
|
|
95
|
+
}, ownerState.maxWidth && // @ts-ignore module augmentation fails if custom breakpoints are used
|
|
96
|
+
ownerState.maxWidth !== 'xs' && {
|
|
97
|
+
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
98
|
+
[theme.breakpoints.up(ownerState.maxWidth)]: {
|
|
99
|
+
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
100
|
+
maxWidth: `${theme.breakpoints.values[ownerState.maxWidth]}${theme.breakpoints.unit}`
|
|
101
|
+
}
|
|
102
|
+
}));
|
|
103
|
+
const Container = /*#__PURE__*/React.forwardRef(function Container(inProps, ref) {
|
|
104
|
+
const props = useThemeProps(inProps);
|
|
105
|
+
|
|
106
|
+
const {
|
|
107
|
+
className,
|
|
108
|
+
component = 'div',
|
|
109
|
+
disableGutters = false,
|
|
110
|
+
fixed = false,
|
|
111
|
+
maxWidth = 'lg'
|
|
112
|
+
} = props,
|
|
113
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
114
|
+
|
|
115
|
+
const ownerState = _extends({}, props, {
|
|
116
|
+
component,
|
|
117
|
+
disableGutters,
|
|
118
|
+
fixed,
|
|
119
|
+
maxWidth
|
|
120
|
+
}); // @ts-ignore module augmentation fails if custom breakpoints are used
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
const classes = useUtilityClasses(ownerState, componentName);
|
|
124
|
+
return (
|
|
125
|
+
/*#__PURE__*/
|
|
126
|
+
// @ts-ignore theme is injected by the styled util
|
|
127
|
+
_jsx(ContainerRoot, _extends({
|
|
128
|
+
as: component // @ts-ignore module augmentation fails if custom breakpoints are used
|
|
129
|
+
,
|
|
130
|
+
ownerState: ownerState,
|
|
131
|
+
className: clsx(classes.root, className),
|
|
132
|
+
ref: ref
|
|
133
|
+
}, other))
|
|
134
|
+
);
|
|
135
|
+
});
|
|
136
|
+
process.env.NODE_ENV !== "production" ? Container.propTypes
|
|
137
|
+
/* remove-proptypes */
|
|
138
|
+
= {
|
|
139
|
+
children: PropTypes.node,
|
|
140
|
+
classes: PropTypes.object,
|
|
141
|
+
className: PropTypes.string,
|
|
142
|
+
component: PropTypes.elementType,
|
|
143
|
+
disableGutters: PropTypes.bool,
|
|
144
|
+
fixed: PropTypes.bool,
|
|
145
|
+
maxWidth: PropTypes
|
|
146
|
+
/* @typescript-to-proptypes-ignore */
|
|
147
|
+
.oneOfType([PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl', false]), PropTypes.string]),
|
|
148
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
149
|
+
} : void 0;
|
|
150
|
+
return Container;
|
|
151
|
+
}
|
package/modern/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MUI v5.
|
|
1
|
+
/** @license MUI v5.8.0
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the MIT license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -44,4 +44,7 @@ export { default as useThemeWithoutDefault } from './useThemeWithoutDefault';
|
|
|
44
44
|
export * from './colorManipulator';
|
|
45
45
|
export { default as ThemeProvider } from './ThemeProvider';
|
|
46
46
|
export { default as unstable_createCssVarsProvider } from './cssVars/createCssVarsProvider';
|
|
47
|
-
export { default as unstable_createGetCssVar } from './cssVars/createGetCssVar';
|
|
47
|
+
export { default as unstable_createGetCssVar } from './cssVars/createGetCssVar';
|
|
48
|
+
export { default as createContainer } from './Container/createContainer';
|
|
49
|
+
export { default as Container } from './Container';
|
|
50
|
+
export * from './Container';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/system",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.8.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "CSS utilities for rapidly laying out custom designs.",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@babel/runtime": "^7.17.2",
|
|
47
|
-
"@mui/private-theming": "^5.
|
|
48
|
-
"@mui/styled-engine": "^5.
|
|
47
|
+
"@mui/private-theming": "^5.8.0",
|
|
48
|
+
"@mui/styled-engine": "^5.8.0",
|
|
49
49
|
"@mui/types": "^7.1.3",
|
|
50
|
-
"@mui/utils": "^5.
|
|
50
|
+
"@mui/utils": "^5.8.0",
|
|
51
51
|
"clsx": "^1.1.1",
|
|
52
52
|
"csstype": "^3.0.11",
|
|
53
53
|
"prop-types": "^15.8.1"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|