UNPKG

3.19 kBJavaScriptView Raw
1import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2import _extends from "@babel/runtime/helpers/esm/extends";
3const _excluded = ["className", "dividers"];
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 { getDialogContentUtilityClass } from './dialogContentClasses';
11import dialogTitleClasses from '../DialogTitle/dialogTitleClasses';
12import { jsx as _jsx } from "react/jsx-runtime";
13
14const useUtilityClasses = ownerState => {
15 const {
16 classes,
17 dividers
18 } = ownerState;
19 const slots = {
20 root: ['root', dividers && 'dividers']
21 };
22 return composeClasses(slots, getDialogContentUtilityClass, classes);
23};
24
25const DialogContentRoot = styled('div', {
26 name: 'MuiDialogContent',
27 slot: 'Root',
28 overridesResolver: (props, styles) => {
29 const {
30 ownerState
31 } = props;
32 return [styles.root, ownerState.dividers && styles.dividers];
33 }
34})(({
35 theme,
36 ownerState
37}) => _extends({
38 flex: '1 1 auto',
39 // Add iOS momentum scrolling for iOS < 13.0
40 WebkitOverflowScrolling: 'touch',
41 overflowY: 'auto',
42 padding: '20px 24px'
43}, ownerState.dividers ? {
44 padding: '16px 24px',
45 borderTop: `1px solid ${(theme.vars || theme).palette.divider}`,
46 borderBottom: `1px solid ${(theme.vars || theme).palette.divider}`
47} : {
48 [`.${dialogTitleClasses.root} + &`]: {
49 paddingTop: 0
50 }
51}));
52const DialogContent = /*#__PURE__*/React.forwardRef(function DialogContent(inProps, ref) {
53 const props = useThemeProps({
54 props: inProps,
55 name: 'MuiDialogContent'
56 });
57
58 const {
59 className,
60 dividers = false
61 } = props,
62 other = _objectWithoutPropertiesLoose(props, _excluded);
63
64 const ownerState = _extends({}, props, {
65 dividers
66 });
67
68 const classes = useUtilityClasses(ownerState);
69 return /*#__PURE__*/_jsx(DialogContentRoot, _extends({
70 className: clsx(classes.root, className),
71 ownerState: ownerState,
72 ref: ref
73 }, other));
74});
75process.env.NODE_ENV !== "production" ? DialogContent.propTypes
76/* remove-proptypes */
77= {
78 // ----------------------------- Warning --------------------------------
79 // | These PropTypes are generated from the TypeScript type definitions |
80 // | To update them edit the d.ts file and run "yarn proptypes" |
81 // ----------------------------------------------------------------------
82
83 /**
84 * The content of the component.
85 */
86 children: PropTypes.node,
87
88 /**
89 * Override or extend the styles applied to the component.
90 */
91 classes: PropTypes.object,
92
93 /**
94 * @ignore
95 */
96 className: PropTypes.string,
97
98 /**
99 * Display the top and bottom dividers.
100 * @default false
101 */
102 dividers: PropTypes.bool,
103
104 /**
105 * The system prop that allows defining system overrides as well as additional CSS styles.
106 */
107 sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
108} : void 0;
109export default DialogContent;
\No newline at end of file