1 | 'use client';
|
2 |
|
3 | import * as React from 'react';
|
4 | import PropTypes from 'prop-types';
|
5 | import clsx from 'clsx';
|
6 | import { styled } from "../zero-styled/index.js";
|
7 | import memoTheme from "../utils/memoTheme.js";
|
8 | import rootShouldForwardProp from "../styles/rootShouldForwardProp.js";
|
9 | import capitalize from "../utils/capitalize.js";
|
10 | import { isHorizontal } from "../Drawer/Drawer.js";
|
11 | import { jsx as _jsx } from "react/jsx-runtime";
|
12 | const SwipeAreaRoot = styled('div', {
|
13 | shouldForwardProp: rootShouldForwardProp
|
14 | })(memoTheme(({
|
15 | theme
|
16 | }) => ({
|
17 | position: 'fixed',
|
18 | top: 0,
|
19 | left: 0,
|
20 | bottom: 0,
|
21 | zIndex: theme.zIndex.drawer - 1,
|
22 | variants: [{
|
23 | props: {
|
24 | anchor: 'left'
|
25 | },
|
26 | style: {
|
27 | right: 'auto'
|
28 | }
|
29 | }, {
|
30 | props: {
|
31 | anchor: 'right'
|
32 | },
|
33 | style: {
|
34 | left: 'auto',
|
35 | right: 0
|
36 | }
|
37 | }, {
|
38 | props: {
|
39 | anchor: 'top'
|
40 | },
|
41 | style: {
|
42 | bottom: 'auto',
|
43 | right: 0
|
44 | }
|
45 | }, {
|
46 | props: {
|
47 | anchor: 'bottom'
|
48 | },
|
49 | style: {
|
50 | top: 'auto',
|
51 | bottom: 0,
|
52 | right: 0
|
53 | }
|
54 | }]
|
55 | })));
|
56 |
|
57 |
|
58 |
|
59 |
|
60 | const SwipeArea = React.forwardRef(function SwipeArea(props, ref) {
|
61 | const {
|
62 | anchor,
|
63 | classes = {},
|
64 | className,
|
65 | width,
|
66 | style,
|
67 | ...other
|
68 | } = props;
|
69 | const ownerState = props;
|
70 | return _jsx(SwipeAreaRoot, {
|
71 | className: clsx('PrivateSwipeArea-root', classes.root, classes[`anchor${capitalize(anchor)}`], className),
|
72 | ref: ref,
|
73 | style: {
|
74 | [isHorizontal(anchor) ? 'width' : 'height']: width,
|
75 | ...style
|
76 | },
|
77 | ownerState: ownerState,
|
78 | ...other
|
79 | });
|
80 | });
|
81 | process.env.NODE_ENV !== "production" ? SwipeArea.propTypes = {
|
82 | |
83 |
|
84 |
|
85 | anchor: PropTypes.oneOf(['left', 'top', 'right', 'bottom']).isRequired,
|
86 | |
87 |
|
88 |
|
89 | classes: PropTypes.object,
|
90 | |
91 |
|
92 |
|
93 | className: PropTypes.string,
|
94 | |
95 |
|
96 |
|
97 | style: PropTypes.object,
|
98 | |
99 |
|
100 |
|
101 |
|
102 | width: PropTypes.number.isRequired
|
103 | } : void 0;
|
104 | export default SwipeArea; |
\ | No newline at end of file |