UNPKG

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