UNPKG

2.53 kBJavaScriptView Raw
1import _extends from "@babel/runtime/helpers/esm/extends";
2import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3const _excluded = ["className"];
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 Typography from '../Typography';
11import { getAlertTitleUtilityClass } from './alertTitleClasses';
12import { jsx as _jsx } from "react/jsx-runtime";
13
14const useUtilityClasses = ownerState => {
15 const {
16 classes
17 } = ownerState;
18 const slots = {
19 root: ['root']
20 };
21 return composeClasses(slots, getAlertTitleUtilityClass, classes);
22};
23
24const AlertTitleRoot = styled(Typography, {
25 name: 'MuiAlertTitle',
26 slot: 'Root',
27 overridesResolver: (props, styles) => styles.root
28})(({
29 theme
30}) => {
31 return {
32 fontWeight: theme.typography.fontWeightMedium,
33 marginTop: -2
34 };
35});
36const AlertTitle = /*#__PURE__*/React.forwardRef(function AlertTitle(inProps, ref) {
37 const props = useThemeProps({
38 props: inProps,
39 name: 'MuiAlertTitle'
40 });
41
42 const {
43 className
44 } = props,
45 other = _objectWithoutPropertiesLoose(props, _excluded);
46
47 const ownerState = props;
48 const classes = useUtilityClasses(ownerState);
49 return /*#__PURE__*/_jsx(AlertTitleRoot, _extends({
50 gutterBottom: true,
51 component: "div",
52 ownerState: ownerState,
53 ref: ref,
54 className: clsx(classes.root, className)
55 }, other));
56});
57process.env.NODE_ENV !== "production" ? AlertTitle.propTypes
58/* remove-proptypes */
59= {
60 // ----------------------------- Warning --------------------------------
61 // | These PropTypes are generated from the TypeScript type definitions |
62 // | To update them edit the d.ts file and run "yarn proptypes" |
63 // ----------------------------------------------------------------------
64
65 /**
66 * The content of the component.
67 */
68 children: PropTypes.node,
69
70 /**
71 * Override or extend the styles applied to the component.
72 */
73 classes: PropTypes.object,
74
75 /**
76 * @ignore
77 */
78 className: PropTypes.string,
79
80 /**
81 * The system prop that allows defining system overrides as well as additional CSS styles.
82 */
83 sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
84} : void 0;
85export default AlertTitle;
\No newline at end of file