Blame view

天文台pc/tianwentai-ui/node_modules/@mui/system/esm/createBox/createBox.js 1.07 KB
bc518174   王天杨   提交两个项目文件
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
  'use client';
  
  import * as React from 'react';
  import clsx from 'clsx';
  import styled from '@mui/styled-engine';
  import styleFunctionSx, { extendSxProp } from "../styleFunctionSx/index.js";
  import useTheme from "../useTheme/index.js";
  import { jsx as _jsx } from "react/jsx-runtime";
  export default function createBox(options = {}) {
    const {
      themeId,
      defaultTheme,
      defaultClassName = 'MuiBox-root',
      generateClassName
    } = options;
    const BoxRoot = styled('div', {
      shouldForwardProp: prop => prop !== 'theme' && prop !== 'sx' && prop !== 'as'
    })(styleFunctionSx);
    const Box = /*#__PURE__*/React.forwardRef(function Box(inProps, ref) {
      const theme = useTheme(defaultTheme);
      const {
        className,
        component = 'div',
        ...other
      } = extendSxProp(inProps);
      return /*#__PURE__*/_jsx(BoxRoot, {
        as: component,
        ref: ref,
        className: clsx(className, generateClassName ? generateClassName(defaultClassName) : defaultClassName),
        theme: themeId ? theme[themeId] || theme : theme,
        ...other
      });
    });
    return Box;
  }