Blame view

天文台pc/tianwentai-ui/node_modules/@mui/material/esm/SwipeableDrawer/SwipeArea.js 2.16 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
  'use client';
  
  import * as React from 'react';
  import PropTypes from 'prop-types';
  import clsx from 'clsx';
  import { styled } from "../zero-styled/index.js";
  import memoTheme from "../utils/memoTheme.js";
  import rootShouldForwardProp from "../styles/rootShouldForwardProp.js";
  import capitalize from "../utils/capitalize.js";
  import { isHorizontal } from "../Drawer/Drawer.js";
  import { jsx as _jsx } from "react/jsx-runtime";
  const SwipeAreaRoot = styled('div', {
    name: 'MuiSwipeArea',
    shouldForwardProp: rootShouldForwardProp
  })(memoTheme(({
    theme
  }) => ({
    position: 'fixed',
    top: 0,
    left: 0,
    bottom: 0,
    zIndex: theme.zIndex.drawer - 1,
    variants: [{
      props: {
        anchor: 'left'
      },
      style: {
        right: 'auto'
      }
    }, {
      props: {
        anchor: 'right'
      },
      style: {
        left: 'auto',
        right: 0
      }
    }, {
      props: {
        anchor: 'top'
      },
      style: {
        bottom: 'auto',
        right: 0
      }
    }, {
      props: {
        anchor: 'bottom'
      },
      style: {
        top: 'auto',
        bottom: 0,
        right: 0
      }
    }]
  })));
  
  /**
   * @ignore - internal component.
   */
  const SwipeArea = /*#__PURE__*/React.forwardRef(function SwipeArea(props, ref) {
    const {
      anchor,
      classes = {},
      className,
      width,
      style,
      ...other
    } = props;
    const ownerState = props;
    return /*#__PURE__*/_jsx(SwipeAreaRoot, {
      className: clsx('PrivateSwipeArea-root', classes.root, classes[`anchor${capitalize(anchor)}`], className),
      ref: ref,
      style: {
        [isHorizontal(anchor) ? 'width' : 'height']: width,
        ...style
      },
      ownerState: ownerState,
      ...other
    });
  });
  process.env.NODE_ENV !== "production" ? SwipeArea.propTypes = {
    /**
     * Side on which to attach the discovery area.
     */
    anchor: PropTypes.oneOf(['left', 'top', 'right', 'bottom']).isRequired,
    /**
     * @ignore
     */
    classes: PropTypes.object,
    /**
     * @ignore
     */
    className: PropTypes.string,
    /**
     * @ignore
     */
    style: PropTypes.object,
    /**
     * The width of the left most (or right most) area in `px` where the
     * drawer can be swiped open from.
     */
    width: PropTypes.number.isRequired
  } : void 0;
  export default SwipeArea;