UNPKG

3.45 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 memoTheme from "../utils/memoTheme.js";
9import { useDefaultProps } from "../DefaultPropsProvider/index.js";
10import { getDialogContentUtilityClass } from "./dialogContentClasses.js";
11import dialogTitleClasses from "../DialogTitle/dialogTitleClasses.js";
12import { jsx as _jsx } from "react/jsx-runtime";
13const useUtilityClasses = ownerState => {
14 const {
15 classes,
16 dividers
17 } = ownerState;
18 const slots = {
19 root: ['root', dividers && 'dividers']
20 };
21 return composeClasses(slots, getDialogContentUtilityClass, classes);
22};
23const DialogContentRoot = styled('div', {
24 name: 'MuiDialogContent',
25 slot: 'Root',
26 overridesResolver: (props, styles) => {
27 const {
28 ownerState
29 } = props;
30 return [styles.root, ownerState.dividers && styles.dividers];
31 }
32})(memoTheme(({
33 theme
34}) => ({
35 flex: '1 1 auto',
36 // Add iOS momentum scrolling for iOS < 13.0
37 WebkitOverflowScrolling: 'touch',
38 overflowY: 'auto',
39 padding: '20px 24px',
40 variants: [{
41 props: ({
42 ownerState
43 }) => ownerState.dividers,
44 style: {
45 padding: '16px 24px',
46 borderTop: `1px solid ${(theme.vars || theme).palette.divider}`,
47 borderBottom: `1px solid ${(theme.vars || theme).palette.divider}`
48 }
49 }, {
50 props: ({
51 ownerState
52 }) => !ownerState.dividers,
53 style: {
54 [`.${dialogTitleClasses.root} + &`]: {
55 paddingTop: 0
56 }
57 }
58 }]
59})));
60const DialogContent = /*#__PURE__*/React.forwardRef(function DialogContent(inProps, ref) {
61 const props = useDefaultProps({
62 props: inProps,
63 name: 'MuiDialogContent'
64 });
65 const {
66 className,
67 dividers = false,
68 ...other
69 } = props;
70 const ownerState = {
71 ...props,
72 dividers
73 };
74 const classes = useUtilityClasses(ownerState);
75 return /*#__PURE__*/_jsx(DialogContentRoot, {
76 className: clsx(classes.root, className),
77 ownerState: ownerState,
78 ref: ref,
79 ...other
80 });
81});
82process.env.NODE_ENV !== "production" ? DialogContent.propTypes /* remove-proptypes */ = {
83 // ┌────────────────────────────── Warning ──────────────────────────────┐
84 // │ These PropTypes are generated from the TypeScript type definitions. │
85 // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
86 // └─────────────────────────────────────────────────────────────────────┘
87 /**
88 * The content of the component.
89 */
90 children: PropTypes.node,
91 /**
92 * Override or extend the styles applied to the component.
93 */
94 classes: PropTypes.object,
95 /**
96 * @ignore
97 */
98 className: PropTypes.string,
99 /**
100 * Display the top and bottom dividers.
101 * @default false
102 */
103 dividers: PropTypes.bool,
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