1 | import _extends from "@babel/runtime/helpers/esm/extends";
|
2 | import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
3 | import * as React from 'react';
|
4 | import PropTypes from 'prop-types';
|
5 | import clsx from 'clsx';
|
6 | import withStyles from '../styles/withStyles';
|
7 | import ButtonBase from '../ButtonBase';
|
8 | export const styles = theme => ({
|
9 |
|
10 | root: {
|
11 | display: 'block',
|
12 | textAlign: 'inherit',
|
13 | width: '100%',
|
14 | '&:hover $focusHighlight': {
|
15 | opacity: theme.palette.action.hoverOpacity
|
16 | },
|
17 | '&$focusVisible $focusHighlight': {
|
18 | opacity: 0.12
|
19 | }
|
20 | },
|
21 |
|
22 |
|
23 | focusVisible: {},
|
24 |
|
25 |
|
26 | focusHighlight: {
|
27 | overflow: 'hidden',
|
28 | pointerEvents: 'none',
|
29 | position: 'absolute',
|
30 | top: 0,
|
31 | right: 0,
|
32 | bottom: 0,
|
33 | left: 0,
|
34 | borderRadius: 'inherit',
|
35 | opacity: 0,
|
36 | backgroundColor: 'currentcolor',
|
37 | transition: theme.transitions.create('opacity', {
|
38 | duration: theme.transitions.duration.short
|
39 | })
|
40 | }
|
41 | });
|
42 | const CardActionArea = React.forwardRef(function CardActionArea(props, ref) {
|
43 | const {
|
44 | children,
|
45 | classes,
|
46 | className,
|
47 | focusVisibleClassName
|
48 | } = props,
|
49 | other = _objectWithoutPropertiesLoose(props, ["children", "classes", "className", "focusVisibleClassName"]);
|
50 |
|
51 | return React.createElement(ButtonBase, _extends({
|
52 | className: clsx(classes.root, className),
|
53 | focusVisibleClassName: clsx(focusVisibleClassName, classes.focusVisible),
|
54 | ref: ref
|
55 | }, other), children, React.createElement("span", {
|
56 | className: classes.focusHighlight
|
57 | }));
|
58 | });
|
59 | process.env.NODE_ENV !== "production" ? CardActionArea.propTypes = {
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 | |
66 |
|
67 |
|
68 | children: PropTypes.node,
|
69 |
|
70 | |
71 |
|
72 |
|
73 |
|
74 | classes: PropTypes.object,
|
75 |
|
76 | |
77 |
|
78 |
|
79 | className: PropTypes.string,
|
80 |
|
81 | |
82 |
|
83 |
|
84 | focusVisibleClassName: PropTypes.string
|
85 | } : void 0;
|
86 | export default withStyles(styles, {
|
87 | name: 'MuiCardActionArea'
|
88 | })(CardActionArea); |
\ | No newline at end of file |