UNPKG

3.09 kBJavaScriptView Raw
1import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2import _extends from "@babel/runtime/helpers/esm/extends";
3import * as React from 'react';
4import PropTypes from 'prop-types';
5import clsx from 'clsx';
6import { unstable_composeClasses as composeClasses } from '@mui/base';
7import styled from '../styles/styled';
8import useThemeProps from '../styles/useThemeProps';
9import { getCardActionsUtilityClass } from './cardActionsClasses';
10import { jsx as _jsx } from "react/jsx-runtime";
11
12var useUtilityClasses = function useUtilityClasses(ownerState) {
13 var classes = ownerState.classes,
14 disableSpacing = ownerState.disableSpacing;
15 var slots = {
16 root: ['root', !disableSpacing && 'spacing']
17 };
18 return composeClasses(slots, getCardActionsUtilityClass, classes);
19};
20
21var CardActionsRoot = styled('div', {
22 name: 'MuiCardActions',
23 slot: 'Root',
24 overridesResolver: function overridesResolver(props, styles) {
25 var ownerState = props.ownerState;
26 return [styles.root, !ownerState.disableSpacing && styles.spacing];
27 }
28})(function (_ref) {
29 var ownerState = _ref.ownerState;
30 return _extends({
31 display: 'flex',
32 alignItems: 'center',
33 padding: 8
34 }, !ownerState.disableSpacing && {
35 '& > :not(:first-of-type)': {
36 marginLeft: 8
37 }
38 });
39});
40var CardActions = /*#__PURE__*/React.forwardRef(function CardActions(inProps, ref) {
41 var props = useThemeProps({
42 props: inProps,
43 name: 'MuiCardActions'
44 });
45
46 var _props$disableSpacing = props.disableSpacing,
47 disableSpacing = _props$disableSpacing === void 0 ? false : _props$disableSpacing,
48 className = props.className,
49 other = _objectWithoutProperties(props, ["disableSpacing", "className"]);
50
51 var ownerState = _extends({}, props, {
52 disableSpacing: disableSpacing
53 });
54
55 var classes = useUtilityClasses(ownerState);
56 return /*#__PURE__*/_jsx(CardActionsRoot, _extends({
57 className: clsx(classes.root, className),
58 ownerState: ownerState,
59 ref: ref
60 }, other));
61});
62process.env.NODE_ENV !== "production" ? CardActions.propTypes
63/* remove-proptypes */
64= {
65 // ----------------------------- Warning --------------------------------
66 // | These PropTypes are generated from the TypeScript type definitions |
67 // | To update them edit the d.ts file and run "yarn proptypes" |
68 // ----------------------------------------------------------------------
69
70 /**
71 * The content of the component.
72 */
73 children: PropTypes.node,
74
75 /**
76 * Override or extend the styles applied to the component.
77 */
78 classes: PropTypes.object,
79
80 /**
81 * @ignore
82 */
83 className: PropTypes.string,
84
85 /**
86 * If `true`, the actions do not have additional margin.
87 * @default false
88 */
89 disableSpacing: PropTypes.bool,
90
91 /**
92 * The system prop that allows defining system overrides as well as additional CSS styles.
93 */
94 sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
95} : void 0;
96export default CardActions;
\No newline at end of file