paradiego
This commit is contained in:
198
node_modules/@mui/material/modern/CardHeader/CardHeader.js
generated
vendored
Normal file
198
node_modules/@mui/material/modern/CardHeader/CardHeader.js
generated
vendored
Normal file
@@ -0,0 +1,198 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import clsx from 'clsx';
|
||||
import composeClasses from '@mui/utils/composeClasses';
|
||||
import Typography, { typographyClasses } from "../Typography/index.js";
|
||||
import { styled } from "../zero-styled/index.js";
|
||||
import { useDefaultProps } from "../DefaultPropsProvider/index.js";
|
||||
import cardHeaderClasses, { getCardHeaderUtilityClass } from "./cardHeaderClasses.js";
|
||||
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
||||
const useUtilityClasses = ownerState => {
|
||||
const {
|
||||
classes
|
||||
} = ownerState;
|
||||
const slots = {
|
||||
root: ['root'],
|
||||
avatar: ['avatar'],
|
||||
action: ['action'],
|
||||
content: ['content'],
|
||||
title: ['title'],
|
||||
subheader: ['subheader']
|
||||
};
|
||||
return composeClasses(slots, getCardHeaderUtilityClass, classes);
|
||||
};
|
||||
const CardHeaderRoot = styled('div', {
|
||||
name: 'MuiCardHeader',
|
||||
slot: 'Root',
|
||||
overridesResolver: (props, styles) => ({
|
||||
[`& .${cardHeaderClasses.title}`]: styles.title,
|
||||
[`& .${cardHeaderClasses.subheader}`]: styles.subheader,
|
||||
...styles.root
|
||||
})
|
||||
})({
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
padding: 16
|
||||
});
|
||||
const CardHeaderAvatar = styled('div', {
|
||||
name: 'MuiCardHeader',
|
||||
slot: 'Avatar',
|
||||
overridesResolver: (props, styles) => styles.avatar
|
||||
})({
|
||||
display: 'flex',
|
||||
flex: '0 0 auto',
|
||||
marginRight: 16
|
||||
});
|
||||
const CardHeaderAction = styled('div', {
|
||||
name: 'MuiCardHeader',
|
||||
slot: 'Action',
|
||||
overridesResolver: (props, styles) => styles.action
|
||||
})({
|
||||
flex: '0 0 auto',
|
||||
alignSelf: 'flex-start',
|
||||
marginTop: -4,
|
||||
marginRight: -8,
|
||||
marginBottom: -4
|
||||
});
|
||||
const CardHeaderContent = styled('div', {
|
||||
name: 'MuiCardHeader',
|
||||
slot: 'Content',
|
||||
overridesResolver: (props, styles) => styles.content
|
||||
})({
|
||||
flex: '1 1 auto',
|
||||
[`.${typographyClasses.root}:where(& .${cardHeaderClasses.title})`]: {
|
||||
display: 'block'
|
||||
},
|
||||
[`.${typographyClasses.root}:where(& .${cardHeaderClasses.subheader})`]: {
|
||||
display: 'block'
|
||||
}
|
||||
});
|
||||
const CardHeader = /*#__PURE__*/React.forwardRef(function CardHeader(inProps, ref) {
|
||||
const props = useDefaultProps({
|
||||
props: inProps,
|
||||
name: 'MuiCardHeader'
|
||||
});
|
||||
const {
|
||||
action,
|
||||
avatar,
|
||||
className,
|
||||
component = 'div',
|
||||
disableTypography = false,
|
||||
subheader: subheaderProp,
|
||||
subheaderTypographyProps,
|
||||
title: titleProp,
|
||||
titleTypographyProps,
|
||||
...other
|
||||
} = props;
|
||||
const ownerState = {
|
||||
...props,
|
||||
component,
|
||||
disableTypography
|
||||
};
|
||||
const classes = useUtilityClasses(ownerState);
|
||||
let title = titleProp;
|
||||
if (title != null && title.type !== Typography && !disableTypography) {
|
||||
title = /*#__PURE__*/_jsx(Typography, {
|
||||
variant: avatar ? 'body2' : 'h5',
|
||||
className: classes.title,
|
||||
component: "span",
|
||||
...titleTypographyProps,
|
||||
children: title
|
||||
});
|
||||
}
|
||||
let subheader = subheaderProp;
|
||||
if (subheader != null && subheader.type !== Typography && !disableTypography) {
|
||||
subheader = /*#__PURE__*/_jsx(Typography, {
|
||||
variant: avatar ? 'body2' : 'body1',
|
||||
className: classes.subheader,
|
||||
color: "textSecondary",
|
||||
component: "span",
|
||||
...subheaderTypographyProps,
|
||||
children: subheader
|
||||
});
|
||||
}
|
||||
return /*#__PURE__*/_jsxs(CardHeaderRoot, {
|
||||
className: clsx(classes.root, className),
|
||||
as: component,
|
||||
ref: ref,
|
||||
ownerState: ownerState,
|
||||
...other,
|
||||
children: [avatar && /*#__PURE__*/_jsx(CardHeaderAvatar, {
|
||||
className: classes.avatar,
|
||||
ownerState: ownerState,
|
||||
children: avatar
|
||||
}), /*#__PURE__*/_jsxs(CardHeaderContent, {
|
||||
className: classes.content,
|
||||
ownerState: ownerState,
|
||||
children: [title, subheader]
|
||||
}), action && /*#__PURE__*/_jsx(CardHeaderAction, {
|
||||
className: classes.action,
|
||||
ownerState: ownerState,
|
||||
children: action
|
||||
})]
|
||||
});
|
||||
});
|
||||
process.env.NODE_ENV !== "production" ? CardHeader.propTypes /* remove-proptypes */ = {
|
||||
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
||||
// │ These PropTypes are generated from the TypeScript type definitions. │
|
||||
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
||||
// └─────────────────────────────────────────────────────────────────────┘
|
||||
/**
|
||||
* The action to display in the card header.
|
||||
*/
|
||||
action: PropTypes.node,
|
||||
/**
|
||||
* The Avatar element to display.
|
||||
*/
|
||||
avatar: PropTypes.node,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
children: PropTypes.node,
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
*/
|
||||
classes: PropTypes.object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: PropTypes.string,
|
||||
/**
|
||||
* The component used for the root node.
|
||||
* Either a string to use a HTML element or a component.
|
||||
*/
|
||||
component: PropTypes.elementType,
|
||||
/**
|
||||
* If `true`, `subheader` and `title` won't be wrapped by a Typography component.
|
||||
* This can be useful to render an alternative Typography variant by wrapping
|
||||
* the `title` text, and optional `subheader` text
|
||||
* with the Typography component.
|
||||
* @default false
|
||||
*/
|
||||
disableTypography: PropTypes.bool,
|
||||
/**
|
||||
* The content of the component.
|
||||
*/
|
||||
subheader: PropTypes.node,
|
||||
/**
|
||||
* These props will be forwarded to the subheader
|
||||
* (as long as disableTypography is not `true`).
|
||||
*/
|
||||
subheaderTypographyProps: PropTypes.object,
|
||||
/**
|
||||
* The system prop that allows defining system overrides as well as additional CSS styles.
|
||||
*/
|
||||
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
||||
/**
|
||||
* The content of the component.
|
||||
*/
|
||||
title: PropTypes.node,
|
||||
/**
|
||||
* These props will be forwarded to the title
|
||||
* (as long as disableTypography is not `true`).
|
||||
*/
|
||||
titleTypographyProps: PropTypes.object
|
||||
} : void 0;
|
||||
export default CardHeader;
|
||||
7
node_modules/@mui/material/modern/CardHeader/cardHeaderClasses.js
generated
vendored
Normal file
7
node_modules/@mui/material/modern/CardHeader/cardHeaderClasses.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
||||
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
||||
export function getCardHeaderUtilityClass(slot) {
|
||||
return generateUtilityClass('MuiCardHeader', slot);
|
||||
}
|
||||
const cardHeaderClasses = generateUtilityClasses('MuiCardHeader', ['root', 'avatar', 'action', 'content', 'title', 'subheader']);
|
||||
export default cardHeaderClasses;
|
||||
3
node_modules/@mui/material/modern/CardHeader/index.js
generated
vendored
Normal file
3
node_modules/@mui/material/modern/CardHeader/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export { default } from "./CardHeader.js";
|
||||
export { default as cardHeaderClasses } from "./cardHeaderClasses.js";
|
||||
export * from "./cardHeaderClasses.js";
|
||||
Reference in New Issue
Block a user