1 | 'use client';
|
2 |
|
3 | import * as React from 'react';
|
4 | import PropTypes from 'prop-types';
|
5 | import clsx from 'clsx';
|
6 | import composeClasses from '@mui/utils/composeClasses';
|
7 | import Typography from "../Typography/index.js";
|
8 | import { styled } from "../zero-styled/index.js";
|
9 | import { useDefaultProps } from "../DefaultPropsProvider/index.js";
|
10 | import { getDialogTitleUtilityClass } from "./dialogTitleClasses.js";
|
11 | import DialogContext from "../Dialog/DialogContext.js";
|
12 | import { jsx as _jsx } from "react/jsx-runtime";
|
13 | const useUtilityClasses = ownerState => {
|
14 | const {
|
15 | classes
|
16 | } = ownerState;
|
17 | const slots = {
|
18 | root: ['root']
|
19 | };
|
20 | return composeClasses(slots, getDialogTitleUtilityClass, classes);
|
21 | };
|
22 | const 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 | });
|
30 | const DialogTitle = 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 _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 | });
|
55 | process.env.NODE_ENV !== "production" ? DialogTitle.propTypes = {
|
56 |
|
57 |
|
58 |
|
59 |
|
60 | |
61 |
|
62 |
|
63 | children: PropTypes.node,
|
64 | |
65 |
|
66 |
|
67 | classes: PropTypes.object,
|
68 | |
69 |
|
70 |
|
71 | className: PropTypes.string,
|
72 | |
73 |
|
74 |
|
75 | id: PropTypes.string,
|
76 | |
77 |
|
78 |
|
79 | sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
80 | } : void 0;
|
81 | export default DialogTitle; |
\ | No newline at end of file |