1 | import _extends from "@babel/runtime/helpers/esm/extends";
|
2 | import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3 | import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
4 | import * as React from 'react';
|
5 | import PropTypes from 'prop-types';
|
6 | import clsx from 'clsx';
|
7 | import { unstable_composeClasses as composeClasses } from '@mui/base';
|
8 | import useThemeProps from '../styles/useThemeProps';
|
9 | import styled from '../styles/styled';
|
10 | import cardActionAreaClasses, { getCardActionAreaUtilityClass } from './cardActionAreaClasses';
|
11 | import ButtonBase from '../ButtonBase';
|
12 | import { jsx as _jsx } from "react/jsx-runtime";
|
13 | import { jsxs as _jsxs } from "react/jsx-runtime";
|
14 |
|
15 | var useUtilityClasses = function useUtilityClasses(ownerState) {
|
16 | var classes = ownerState.classes;
|
17 | var slots = {
|
18 | root: ['root'],
|
19 | focusHighlight: ['focusHighlight']
|
20 | };
|
21 | return composeClasses(slots, getCardActionAreaUtilityClass, classes);
|
22 | };
|
23 |
|
24 | var CardActionAreaRoot = styled(ButtonBase, {
|
25 | name: 'MuiCardActionArea',
|
26 | slot: 'Root',
|
27 | overridesResolver: function overridesResolver(props, styles) {
|
28 | return styles.root;
|
29 | }
|
30 | })(function (_ref) {
|
31 | var _ref2;
|
32 |
|
33 | var theme = _ref.theme;
|
34 | return _ref2 = {
|
35 | display: 'block',
|
36 | textAlign: 'inherit',
|
37 | width: '100%'
|
38 | }, _defineProperty(_ref2, "&:hover .".concat(cardActionAreaClasses.focusHighlight), {
|
39 | opacity: (theme.vars || theme).palette.action.hoverOpacity,
|
40 | '@media (hover: none)': {
|
41 | opacity: 0
|
42 | }
|
43 | }), _defineProperty(_ref2, "&.".concat(cardActionAreaClasses.focusVisible, " .").concat(cardActionAreaClasses.focusHighlight), {
|
44 | opacity: (theme.vars || theme).palette.action.focusOpacity
|
45 | }), _ref2;
|
46 | });
|
47 | var CardActionAreaFocusHighlight = styled('span', {
|
48 | name: 'MuiCardActionArea',
|
49 | slot: 'FocusHighlight',
|
50 | overridesResolver: function overridesResolver(props, styles) {
|
51 | return styles.focusHighlight;
|
52 | }
|
53 | })(function (_ref3) {
|
54 | var theme = _ref3.theme;
|
55 | return {
|
56 | overflow: 'hidden',
|
57 | pointerEvents: 'none',
|
58 | position: 'absolute',
|
59 | top: 0,
|
60 | right: 0,
|
61 | bottom: 0,
|
62 | left: 0,
|
63 | borderRadius: 'inherit',
|
64 | opacity: 0,
|
65 | backgroundColor: 'currentcolor',
|
66 | transition: theme.transitions.create('opacity', {
|
67 | duration: theme.transitions.duration.short
|
68 | })
|
69 | };
|
70 | });
|
71 | var CardActionArea = React.forwardRef(function CardActionArea(inProps, ref) {
|
72 | var props = useThemeProps({
|
73 | props: inProps,
|
74 | name: 'MuiCardActionArea'
|
75 | });
|
76 |
|
77 | var children = props.children,
|
78 | className = props.className,
|
79 | focusVisibleClassName = props.focusVisibleClassName,
|
80 | other = _objectWithoutProperties(props, ["children", "className", "focusVisibleClassName"]);
|
81 |
|
82 | var ownerState = props;
|
83 | var classes = useUtilityClasses(ownerState);
|
84 | return _jsxs(CardActionAreaRoot, _extends({
|
85 | className: clsx(classes.root, className),
|
86 | focusVisibleClassName: clsx(focusVisibleClassName, classes.focusVisible),
|
87 | ref: ref,
|
88 | ownerState: ownerState
|
89 | }, other, {
|
90 | children: [children, _jsx(CardActionAreaFocusHighlight, {
|
91 | className: classes.focusHighlight,
|
92 | ownerState: ownerState
|
93 | })]
|
94 | }));
|
95 | });
|
96 | process.env.NODE_ENV !== "production" ? CardActionArea.propTypes
|
97 |
|
98 | = {
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 | |
105 |
|
106 |
|
107 | children: PropTypes.node,
|
108 |
|
109 | |
110 |
|
111 |
|
112 | classes: PropTypes.object,
|
113 |
|
114 | |
115 |
|
116 |
|
117 | className: PropTypes.string,
|
118 |
|
119 | |
120 |
|
121 |
|
122 | focusVisibleClassName: PropTypes.string,
|
123 |
|
124 | |
125 |
|
126 |
|
127 | sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
128 | } : void 0;
|
129 | export default CardActionArea; |
\ | No newline at end of file |