UNPKG

3.37 kBJavaScriptView Raw
1'use client';
2
3import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4import _extends from "@babel/runtime/helpers/esm/extends";
5import * as React from 'react';
6import PropTypes from 'prop-types';
7import clsx from 'clsx';
8import composeClasses from '@mui/utils/composeClasses';
9import styled from '../styles/styled';
10import { useDefaultProps } from '../DefaultPropsProvider';
11import { getCardActionsUtilityClass } from './cardActionsClasses';
12import { jsx as _jsx } from "react/jsx-runtime";
13var useUtilityClasses = function useUtilityClasses(ownerState) {
14 var classes = ownerState.classes,
15 disableSpacing = ownerState.disableSpacing;
16 var slots = {
17 root: ['root', !disableSpacing && 'spacing']
18 };
19 return composeClasses(slots, getCardActionsUtilityClass, classes);
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(style) ~ :not(style)': {
36 marginLeft: 8
37 }
38 });
39});
40var CardActions = /*#__PURE__*/React.forwardRef(function CardActions(inProps, ref) {
41 var props = useDefaultProps({
42 props: inProps,
43 name: 'MuiCardActions'
44 });
45 var _props$disableSpacing = props.disableSpacing,
46 disableSpacing = _props$disableSpacing === void 0 ? false : _props$disableSpacing,
47 className = props.className,
48 other = _objectWithoutProperties(props, ["disableSpacing", "className"]);
49 var ownerState = _extends({}, props, {
50 disableSpacing: disableSpacing
51 });
52 var classes = useUtilityClasses(ownerState);
53 return /*#__PURE__*/_jsx(CardActionsRoot, _extends({
54 className: clsx(classes.root, className),
55 ownerState: ownerState,
56 ref: ref
57 }, other));
58});
59process.env.NODE_ENV !== "production" ? CardActions.propTypes /* remove-proptypes */ = {
60 // ┌────────────────────────────── Warning ──────────────────────────────┐
61 // │ These PropTypes are generated from the TypeScript type definitions. │
62 // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
63 // └─────────────────────────────────────────────────────────────────────┘
64 /**
65 * The content of the component.
66 */
67 children: PropTypes.node,
68 /**
69 * Override or extend the styles applied to the component.
70 */
71 classes: PropTypes.object,
72 /**
73 * @ignore
74 */
75 className: PropTypes.string,
76 /**
77 * If `true`, the actions do not have additional margin.
78 * @default false
79 */
80 disableSpacing: PropTypes.bool,
81 /**
82 * The system prop that allows defining system overrides as well as additional CSS styles.
83 */
84 sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
85} : void 0;
86export default CardActions;
\No newline at end of file