UNPKG

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