UNPKG

3.04 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 { getAccordionActionsUtilityClass } from "./accordionActionsClasses.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, getAccordionActionsUtilityClass, classes);
20};
21const AccordionActionsRoot = styled('div', {
22 name: 'MuiAccordionActions',
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 justifyContent: 'flex-end',
35 variants: [{
36 props: props => !props.disableSpacing,
37 style: {
38 '& > :not(style) ~ :not(style)': {
39 marginLeft: 8
40 }
41 }
42 }]
43});
44const AccordionActions = /*#__PURE__*/React.forwardRef(function AccordionActions(inProps, ref) {
45 const props = useDefaultProps({
46 props: inProps,
47 name: 'MuiAccordionActions'
48 });
49 const {
50 className,
51 disableSpacing = false,
52 ...other
53 } = props;
54 const ownerState = {
55 ...props,
56 disableSpacing
57 };
58 const classes = useUtilityClasses(ownerState);
59 return /*#__PURE__*/_jsx(AccordionActionsRoot, {
60 className: clsx(classes.root, className),
61 ref: ref,
62 ownerState: ownerState,
63 ...other
64 });
65});
66process.env.NODE_ENV !== "production" ? AccordionActions.propTypes /* remove-proptypes */ = {
67 // ┌────────────────────────────── Warning ──────────────────────────────┐
68 // │ These PropTypes are generated from the TypeScript type definitions. │
69 // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
70 // └─────────────────────────────────────────────────────────────────────┘
71 /**
72 * The content of the component.
73 */
74 children: PropTypes.node,
75 /**
76 * Override or extend the styles applied to the component.
77 */
78 classes: PropTypes.object,
79 /**
80 * @ignore
81 */
82 className: PropTypes.string,
83 /**
84 * If `true`, the actions do not have additional margin.
85 * @default false
86 */
87 disableSpacing: PropTypes.bool,
88 /**
89 * The system prop that allows defining system overrides as well as additional CSS styles.
90 */
91 sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
92} : void 0;
93export default AccordionActions;
\No newline at end of file