UNPKG

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