UNPKG

2 kBJavaScriptView Raw
1import _extends from "@babel/runtime/helpers/esm/extends";
2import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3import * as React from 'react';
4import PropTypes from 'prop-types';
5import clsx from 'clsx';
6import withStyles from '../styles/withStyles';
7import Typography from '../Typography';
8export const styles = {
9 /* Styles applied to the root element. */
10 root: {
11 margin: 0,
12 padding: '16px 24px',
13 flex: '0 0 auto'
14 }
15};
16const DialogTitle = /*#__PURE__*/React.forwardRef(function DialogTitle(props, ref) {
17 const {
18 children,
19 classes,
20 className,
21 disableTypography = false
22 } = props,
23 other = _objectWithoutPropertiesLoose(props, ["children", "classes", "className", "disableTypography"]);
24
25 return /*#__PURE__*/React.createElement("div", _extends({
26 className: clsx(classes.root, className),
27 ref: ref
28 }, other), disableTypography ? children : /*#__PURE__*/React.createElement(Typography, {
29 component: "h2",
30 variant: "h6"
31 }, children));
32});
33process.env.NODE_ENV !== "production" ? DialogTitle.propTypes = {
34 // ----------------------------- Warning --------------------------------
35 // | These PropTypes are generated from the TypeScript type definitions |
36 // | To update them edit the d.ts file and run "yarn proptypes" |
37 // ----------------------------------------------------------------------
38
39 /**
40 * The content of the component.
41 */
42 children: PropTypes.node,
43
44 /**
45 * Override or extend the styles applied to the component.
46 * See [CSS API](#css) below for more details.
47 */
48 classes: PropTypes.object,
49
50 /**
51 * @ignore
52 */
53 className: PropTypes.string,
54
55 /**
56 * If `true`, the children won't be wrapped by a typography component.
57 * For instance, this can be useful to render an h4 instead of the default h2.
58 */
59 disableTypography: PropTypes.bool
60} : void 0;
61export default withStyles(styles, {
62 name: 'MuiDialogTitle'
63})(DialogTitle);
\No newline at end of file