UNPKG

3.33 kBJavaScriptView Raw
1import * as React from 'react';
2import PropTypes from 'prop-types';
3import clsx from 'clsx';
4// @ts-ignore
5import Container from '@mui/material-pigment-css/Container';
6import capitalize from '@mui/utils/capitalize';
7import composeClasses from '@mui/utils/composeClasses';
8import generateUtilityClass from '@mui/utils/generateUtilityClass';
9import { jsx as _jsx } from "react/jsx-runtime";
10const useUtilityClasses = ownerState => {
11 const {
12 classes,
13 fixed,
14 disableGutters,
15 maxWidth
16 } = ownerState;
17 const slots = {
18 root: ['root', maxWidth && `maxWidth${capitalize(String(maxWidth))}`, fixed && 'fixed', disableGutters && 'disableGutters']
19 };
20 return composeClasses(slots, slot => generateUtilityClass('MuiContainer', slot), classes);
21};
22/**
23 *
24 * Demos:
25 *
26 * - [Container](https://mui.com/material-ui/react-container/)
27 *
28 * API:
29 *
30 * - [PigmentContainer API](https://mui.com/material-ui/api/pigment-container/)
31 */
32const PigmentContainer = /*#__PURE__*/React.forwardRef(function PigmentContainer({
33 className,
34 disableGutters = false,
35 fixed = false,
36 maxWidth = 'lg',
37 ...props
38}, ref) {
39 const ownerState = {
40 ...props,
41 disableGutters,
42 fixed,
43 maxWidth
44 };
45 const classes = useUtilityClasses(ownerState);
46 return /*#__PURE__*/_jsx(Container, {
47 className: clsx(classes.root, className),
48 disableGutters: disableGutters,
49 fixed: fixed,
50 maxWidth: maxWidth,
51 ...props,
52 // @ts-ignore
53 ref: ref
54 });
55});
56process.env.NODE_ENV !== "production" ? PigmentContainer.propTypes /* remove-proptypes */ = {
57 // ┌────────────────────────────── Warning ──────────────────────────────┐
58 // │ These PropTypes are generated from the TypeScript type definitions. │
59 // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
60 // └─────────────────────────────────────────────────────────────────────┘
61 /**
62 * @ignore
63 */
64 children: PropTypes.node,
65 /**
66 * Override or extend the styles applied to the component.
67 */
68 classes: PropTypes.object,
69 /**
70 * @ignore
71 */
72 className: PropTypes.string,
73 /**
74 * If `true`, the left and right padding is removed.
75 * @default false
76 */
77 disableGutters: PropTypes.bool,
78 /**
79 * Set the max-width to match the min-width of the current breakpoint.
80 * This is useful if you'd prefer to design for a fixed set of sizes
81 * instead of trying to accommodate a fully fluid viewport.
82 * It's fluid by default.
83 * @default false
84 */
85 fixed: PropTypes.bool,
86 /**
87 * Determine the max-width of the container.
88 * The container width grows with the size of the screen.
89 * Set to `false` to disable `maxWidth`.
90 * @default 'lg'
91 */
92 maxWidth: PropTypes.oneOf(['lg', 'md', 'sm', 'xl', 'xs', false]),
93 /**
94 * The system prop that allows defining system overrides as well as additional CSS styles.
95 */
96 sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
97} : void 0;
98export default PigmentContainer;
\No newline at end of file