UNPKG

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