/
createBox.js
48 lines (43 loc) · 1.36 KB
/
createBox.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import styled from '@mui/styled-engine';
import styleFunctionSx, { extendSxProp } from './styleFunctionSx';
import useTheme from './useTheme';
export default function createBox(options = {}) {
const { defaultTheme } = options;
const BoxRoot = styled('div')(styleFunctionSx);
const Box = React.forwardRef(function Box(inProps, ref) {
const theme = useTheme(defaultTheme);
const { className, component = 'div', ...other } = extendSxProp(inProps);
return (
<BoxRoot
as={component}
ref={ref}
className={clsx(className, 'MuiBox-root')}
theme={theme}
{...other}
/>
);
});
Box.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" |
// ----------------------------------------------------------------------
/**
* @ignore
*/
children: PropTypes.node,
/**
* The component used for the root node.
* Either a string to use a HTML element or a component.
*/
component: PropTypes.elementType,
/**
* @ignore
*/
sx: PropTypes.object,
};
return Box;
}