UNPKG

2.76 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 Typography from "../Typography/index.js";
8import { styled } from "../zero-styled/index.js";
9import { useDefaultProps } from "../DefaultPropsProvider/index.js";
10import { getDialogTitleUtilityClass } from "./dialogTitleClasses.js";
11import DialogContext from "../Dialog/DialogContext.js";
12import { jsx as _jsx } from "react/jsx-runtime";
13const useUtilityClasses = ownerState => {
14 const {
15 classes
16 } = ownerState;
17 const slots = {
18 root: ['root']
19 };
20 return composeClasses(slots, getDialogTitleUtilityClass, classes);
21};
22const DialogTitleRoot = styled(Typography, {
23 name: 'MuiDialogTitle',
24 slot: 'Root',
25 overridesResolver: (props, styles) => styles.root
26})({
27 padding: '16px 24px',
28 flex: '0 0 auto'
29});
30const DialogTitle = /*#__PURE__*/React.forwardRef(function DialogTitle(inProps, ref) {
31 const props = useDefaultProps({
32 props: inProps,
33 name: 'MuiDialogTitle'
34 });
35 const {
36 className,
37 id: idProp,
38 ...other
39 } = props;
40 const ownerState = props;
41 const classes = useUtilityClasses(ownerState);
42 const {
43 titleId = idProp
44 } = React.useContext(DialogContext);
45 return /*#__PURE__*/_jsx(DialogTitleRoot, {
46 component: "h2",
47 className: clsx(classes.root, className),
48 ownerState: ownerState,
49 ref: ref,
50 variant: "h6",
51 id: idProp ?? titleId,
52 ...other
53 });
54});
55process.env.NODE_ENV !== "production" ? DialogTitle.propTypes /* remove-proptypes */ = {
56 // ┌────────────────────────────── Warning ──────────────────────────────┐
57 // │ These PropTypes are generated from the TypeScript type definitions. │
58 // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
59 // └─────────────────────────────────────────────────────────────────────┘
60 /**
61 * The content of the component.
62 */
63 children: PropTypes.node,
64 /**
65 * Override or extend the styles applied to the component.
66 */
67 classes: PropTypes.object,
68 /**
69 * @ignore
70 */
71 className: PropTypes.string,
72 /**
73 * @ignore
74 */
75 id: PropTypes.string,
76 /**
77 * The system prop that allows defining system overrides as well as additional CSS styles.
78 */
79 sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
80} : void 0;
81export default DialogTitle;
\No newline at end of file