neue Homepage auf react basis

This commit is contained in:
2026-08-07 21:39:30 +02:00
parent 164bdd19ad
commit ee89442c04
52191 changed files with 1230242 additions and 58 deletions
+149
View File
@@ -0,0 +1,149 @@
import * as React from 'react';
import { SxProps } from '@mui/system';
import { TypographyProps } from "../Typography/index.mjs";
import { OverridableComponent, OverrideProps } from "../OverridableComponent/index.mjs";
import { Theme } from "../styles/index.mjs";
import { CreateSlotsAndSlotProps, SlotProps } from "../utils/types.mjs";
import { CardHeaderClasses } from "./cardHeaderClasses.mjs";
export interface CardHeaderRootSlotPropsOverrides {}
export interface CardHeaderAvatarSlotPropsOverrides {}
export interface CardHeaderActionSlotPropsOverrides {}
export interface CardHeaderContentSlotPropsOverrides {}
export interface CardHeaderTitleSlotPropsOverrides {}
export interface CardHeaderSubheaderSlotPropsOverrides {}
export interface CardHeaderSlots {
/**
* The component that renders the root slot.
* @default 'div'
*/
root: React.ElementType;
/**
* The component that renders the avatar slot.
* @default 'div'
*/
avatar: React.ElementType;
/**
* The component that renders the action slot.
* @default 'div'
*/
action: React.ElementType;
/**
* The component that renders the content slot.
* @default 'div'
*/
content: React.ElementType;
/**
* The component that renders the title slot (as long as disableTypography is not `true`).
* [Follow this guide](https://mui.com/material-ui/api/typography/#props) to learn more about the requirements for this component.
* @default Typography
*/
title: React.ElementType;
/**
* The component that renders the subheader slot (as long as disableTypography is not `true`).
* [Follow this guide](https://mui.com/material-ui/api/typography/#props) to learn more about the requirements for this component.
* @default Typography
*/
subheader: React.ElementType;
}
export type CardHeaderSlotsAndSlotProps<TitleTypographyComponent extends React.ElementType = React.ElementType<TypographyProps>, SubheaderTypographyComponent extends React.ElementType = React.ElementType<TypographyProps>> = CreateSlotsAndSlotProps<CardHeaderSlots, {
/**
* Props forwarded to the root slot.
* By default, the available props are based on the div element.
*/
root: SlotProps<'div', CardHeaderRootSlotPropsOverrides, CardHeaderOwnerState>;
/**
* Props forwarded to the avatar slot.
* By default, the available props are based on the div element.
*/
avatar: SlotProps<'div', CardHeaderAvatarSlotPropsOverrides, CardHeaderOwnerState>;
/**
* Props forwarded to the action slot.
* By default, the available props are based on the div element.
*/
action: SlotProps<'div', CardHeaderActionSlotPropsOverrides, CardHeaderOwnerState>;
/**
* Props forwarded to the content slot.
* By default, the available props are based on the div element.
*/
content: SlotProps<'div', CardHeaderContentSlotPropsOverrides, CardHeaderOwnerState>;
/**
* Props forwarded to the title slot (as long as disableTypography is not `true`).
* By default, the available props are based on the [Typography](https://mui.com/material-ui/api/typography/#props) component.
*/
title: TypographyProps<TitleTypographyComponent, {
component?: TitleTypographyComponent | undefined;
} & CardHeaderTitleSlotPropsOverrides> | ((ownerState: CardHeaderOwnerState) => TypographyProps<TitleTypographyComponent, {
component?: TitleTypographyComponent | undefined;
} & CardHeaderTitleSlotPropsOverrides>);
/**
* Props forwarded to the subheader slot (as long as disableTypography is not `true`).
* By default, the available props are based on the [Typography](https://mui.com/material-ui/api/typography/#props) component.
*/
subheader: TypographyProps<SubheaderTypographyComponent, {
component?: SubheaderTypographyComponent | undefined;
} & CardHeaderSubheaderSlotPropsOverrides> | ((ownerState: CardHeaderOwnerState) => TypographyProps<SubheaderTypographyComponent, {
component?: SubheaderTypographyComponent | undefined;
} & CardHeaderSubheaderSlotPropsOverrides>);
}>;
export interface CardHeaderOwnProps {
/**
* The action to display in the card header.
*/
action?: React.ReactNode;
/**
* The Avatar element to display.
*/
avatar?: React.ReactNode;
/**
* Override or extend the styles applied to the component.
*/
classes?: Partial<CardHeaderClasses> | undefined;
/**
* 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?: boolean | undefined;
/**
* The content of the component.
*/
subheader?: React.ReactNode;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx?: SxProps<Theme> | undefined;
/**
* The content of the component.
*/
title?: React.ReactNode;
}
export interface CardHeaderOwnerState extends CardHeaderOwnProps {}
export interface CardHeaderTypeMap<AdditionalProps = {}, RootComponent extends React.ElementType = 'div', TitleTypographyComponent extends React.ElementType = 'span', SubheaderTypographyComponent extends React.ElementType = 'span'> {
props: AdditionalProps & CardHeaderOwnProps & CardHeaderSlotsAndSlotProps<TitleTypographyComponent, SubheaderTypographyComponent>;
defaultComponent: RootComponent;
}
/**
*
* Demos:
*
* - [Card](https://mui.com/material-ui/react-card/)
*
* API:
*
* - [CardHeader API](https://mui.com/material-ui/api/card-header/)
*/
declare const CardHeader: OverridableCardHeader;
export interface OverridableCardHeader extends OverridableComponent<CardHeaderTypeMap> {
<RootComponent extends React.ElementType = CardHeaderTypeMap['defaultComponent'], AdditionalProps = {}, TitleTypographyComponent extends React.ElementType = 'span', SubheaderTypographyComponent extends React.ElementType = 'span'>(props: CardHeaderPropsWithComponent<RootComponent, AdditionalProps, TitleTypographyComponent, SubheaderTypographyComponent>): React.JSX.Element;
}
export type CardHeaderProps<RootComponent extends React.ElementType = CardHeaderTypeMap['defaultComponent'], AdditionalProps = {}, TitleTypographyComponent extends React.ElementType = 'span', SubheaderTypographyComponent extends React.ElementType = 'span'> = OverrideProps<CardHeaderTypeMap<AdditionalProps, RootComponent, TitleTypographyComponent, SubheaderTypographyComponent>, RootComponent>;
export type CardHeaderPropsWithComponent<RootComponent extends React.ElementType = CardHeaderTypeMap['defaultComponent'], AdditionalProps = {}, TitleTypographyComponent extends React.ElementType = 'span', SubheaderTypographyComponent extends React.ElementType = 'span'> = {
/**
* The component used for the root node.
* Either a string to use a HTML element or a component.
*/
component?: RootComponent | undefined;
} & CardHeaderProps<RootComponent, AdditionalProps, TitleTypographyComponent, SubheaderTypographyComponent>;
export default CardHeader;
+149
View File
@@ -0,0 +1,149 @@
import * as React from 'react';
import { SxProps } from '@mui/system';
import { TypographyProps } from "../Typography/index.js";
import { OverridableComponent, OverrideProps } from "../OverridableComponent/index.js";
import { Theme } from "../styles/index.js";
import { CreateSlotsAndSlotProps, SlotProps } from "../utils/types.js";
import { CardHeaderClasses } from "./cardHeaderClasses.js";
export interface CardHeaderRootSlotPropsOverrides {}
export interface CardHeaderAvatarSlotPropsOverrides {}
export interface CardHeaderActionSlotPropsOverrides {}
export interface CardHeaderContentSlotPropsOverrides {}
export interface CardHeaderTitleSlotPropsOverrides {}
export interface CardHeaderSubheaderSlotPropsOverrides {}
export interface CardHeaderSlots {
/**
* The component that renders the root slot.
* @default 'div'
*/
root: React.ElementType;
/**
* The component that renders the avatar slot.
* @default 'div'
*/
avatar: React.ElementType;
/**
* The component that renders the action slot.
* @default 'div'
*/
action: React.ElementType;
/**
* The component that renders the content slot.
* @default 'div'
*/
content: React.ElementType;
/**
* The component that renders the title slot (as long as disableTypography is not `true`).
* [Follow this guide](https://mui.com/material-ui/api/typography/#props) to learn more about the requirements for this component.
* @default Typography
*/
title: React.ElementType;
/**
* The component that renders the subheader slot (as long as disableTypography is not `true`).
* [Follow this guide](https://mui.com/material-ui/api/typography/#props) to learn more about the requirements for this component.
* @default Typography
*/
subheader: React.ElementType;
}
export type CardHeaderSlotsAndSlotProps<TitleTypographyComponent extends React.ElementType = React.ElementType<TypographyProps>, SubheaderTypographyComponent extends React.ElementType = React.ElementType<TypographyProps>> = CreateSlotsAndSlotProps<CardHeaderSlots, {
/**
* Props forwarded to the root slot.
* By default, the available props are based on the div element.
*/
root: SlotProps<'div', CardHeaderRootSlotPropsOverrides, CardHeaderOwnerState>;
/**
* Props forwarded to the avatar slot.
* By default, the available props are based on the div element.
*/
avatar: SlotProps<'div', CardHeaderAvatarSlotPropsOverrides, CardHeaderOwnerState>;
/**
* Props forwarded to the action slot.
* By default, the available props are based on the div element.
*/
action: SlotProps<'div', CardHeaderActionSlotPropsOverrides, CardHeaderOwnerState>;
/**
* Props forwarded to the content slot.
* By default, the available props are based on the div element.
*/
content: SlotProps<'div', CardHeaderContentSlotPropsOverrides, CardHeaderOwnerState>;
/**
* Props forwarded to the title slot (as long as disableTypography is not `true`).
* By default, the available props are based on the [Typography](https://mui.com/material-ui/api/typography/#props) component.
*/
title: TypographyProps<TitleTypographyComponent, {
component?: TitleTypographyComponent | undefined;
} & CardHeaderTitleSlotPropsOverrides> | ((ownerState: CardHeaderOwnerState) => TypographyProps<TitleTypographyComponent, {
component?: TitleTypographyComponent | undefined;
} & CardHeaderTitleSlotPropsOverrides>);
/**
* Props forwarded to the subheader slot (as long as disableTypography is not `true`).
* By default, the available props are based on the [Typography](https://mui.com/material-ui/api/typography/#props) component.
*/
subheader: TypographyProps<SubheaderTypographyComponent, {
component?: SubheaderTypographyComponent | undefined;
} & CardHeaderSubheaderSlotPropsOverrides> | ((ownerState: CardHeaderOwnerState) => TypographyProps<SubheaderTypographyComponent, {
component?: SubheaderTypographyComponent | undefined;
} & CardHeaderSubheaderSlotPropsOverrides>);
}>;
export interface CardHeaderOwnProps {
/**
* The action to display in the card header.
*/
action?: React.ReactNode;
/**
* The Avatar element to display.
*/
avatar?: React.ReactNode;
/**
* Override or extend the styles applied to the component.
*/
classes?: Partial<CardHeaderClasses> | undefined;
/**
* 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?: boolean | undefined;
/**
* The content of the component.
*/
subheader?: React.ReactNode;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx?: SxProps<Theme> | undefined;
/**
* The content of the component.
*/
title?: React.ReactNode;
}
export interface CardHeaderOwnerState extends CardHeaderOwnProps {}
export interface CardHeaderTypeMap<AdditionalProps = {}, RootComponent extends React.ElementType = 'div', TitleTypographyComponent extends React.ElementType = 'span', SubheaderTypographyComponent extends React.ElementType = 'span'> {
props: AdditionalProps & CardHeaderOwnProps & CardHeaderSlotsAndSlotProps<TitleTypographyComponent, SubheaderTypographyComponent>;
defaultComponent: RootComponent;
}
/**
*
* Demos:
*
* - [Card](https://mui.com/material-ui/react-card/)
*
* API:
*
* - [CardHeader API](https://mui.com/material-ui/api/card-header/)
*/
declare const CardHeader: OverridableCardHeader;
export interface OverridableCardHeader extends OverridableComponent<CardHeaderTypeMap> {
<RootComponent extends React.ElementType = CardHeaderTypeMap['defaultComponent'], AdditionalProps = {}, TitleTypographyComponent extends React.ElementType = 'span', SubheaderTypographyComponent extends React.ElementType = 'span'>(props: CardHeaderPropsWithComponent<RootComponent, AdditionalProps, TitleTypographyComponent, SubheaderTypographyComponent>): React.JSX.Element;
}
export type CardHeaderProps<RootComponent extends React.ElementType = CardHeaderTypeMap['defaultComponent'], AdditionalProps = {}, TitleTypographyComponent extends React.ElementType = 'span', SubheaderTypographyComponent extends React.ElementType = 'span'> = OverrideProps<CardHeaderTypeMap<AdditionalProps, RootComponent, TitleTypographyComponent, SubheaderTypographyComponent>, RootComponent>;
export type CardHeaderPropsWithComponent<RootComponent extends React.ElementType = CardHeaderTypeMap['defaultComponent'], AdditionalProps = {}, TitleTypographyComponent extends React.ElementType = 'span', SubheaderTypographyComponent extends React.ElementType = 'span'> = {
/**
* The component used for the root node.
* Either a string to use a HTML element or a component.
*/
component?: RootComponent | undefined;
} & CardHeaderProps<RootComponent, AdditionalProps, TitleTypographyComponent, SubheaderTypographyComponent>;
export default CardHeader;
+254
View File
@@ -0,0 +1,254 @@
"use strict";
'use client';
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var React = _interopRequireWildcard(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
var _Typography = _interopRequireWildcard(require("../Typography"));
var _zeroStyled = require("../zero-styled");
var _DefaultPropsProvider = require("../DefaultPropsProvider");
var _cardHeaderClasses = _interopRequireWildcard(require("./cardHeaderClasses"));
var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
var _jsxRuntime = require("react/jsx-runtime");
const useUtilityClasses = ownerState => {
const {
classes
} = ownerState;
const slots = {
root: ['root'],
avatar: ['avatar'],
action: ['action'],
content: ['content'],
title: ['title'],
subheader: ['subheader']
};
return (0, _composeClasses.default)(slots, _cardHeaderClasses.getCardHeaderUtilityClass, classes);
};
const CardHeaderRoot = (0, _zeroStyled.styled)('div', {
name: 'MuiCardHeader',
slot: 'Root',
overridesResolver: (props, styles) => {
return [{
[`& .${_cardHeaderClasses.default.title}`]: styles.title
}, {
[`& .${_cardHeaderClasses.default.subheader}`]: styles.subheader
}, styles.root];
}
})({
display: 'flex',
alignItems: 'center',
padding: 16
});
const CardHeaderAvatar = (0, _zeroStyled.styled)('div', {
name: 'MuiCardHeader',
slot: 'Avatar'
})({
display: 'flex',
flex: '0 0 auto',
marginRight: 16
});
const CardHeaderAction = (0, _zeroStyled.styled)('div', {
name: 'MuiCardHeader',
slot: 'Action'
})({
flex: '0 0 auto',
alignSelf: 'flex-start',
marginTop: -4,
marginRight: -8,
marginBottom: -4
});
const CardHeaderContent = (0, _zeroStyled.styled)('div', {
name: 'MuiCardHeader',
slot: 'Content'
})({
flex: '1 1 auto',
// Combine this and the below selector once https://github.com/emotion-js/emotion/issues/3366 is solved
[`.${_Typography.typographyClasses.root}:where(& .${_cardHeaderClasses.default.title})`]: {
display: 'block'
},
[`.${_Typography.typographyClasses.root}:where(& .${_cardHeaderClasses.default.subheader})`]: {
display: 'block'
}
});
const CardHeader = /*#__PURE__*/React.forwardRef(function CardHeader(inProps, ref) {
const props = (0, _DefaultPropsProvider.useDefaultProps)({
props: inProps,
name: 'MuiCardHeader'
});
const {
action,
avatar,
component = 'div',
disableTypography = false,
subheader: subheaderProp,
title: titleProp,
slots = {},
slotProps = {},
...other
} = props;
const ownerState = {
...props,
component,
disableTypography
};
const classes = useUtilityClasses(ownerState);
const externalForwardedProps = {
slots,
slotProps
};
let title = titleProp;
const [TitleSlot, titleSlotProps] = (0, _useSlot.default)('title', {
className: classes.title,
elementType: _Typography.default,
externalForwardedProps,
ownerState,
additionalProps: {
variant: avatar ? 'body2' : 'h5',
component: 'span'
}
});
if (title != null && title.type !== _Typography.default && !disableTypography) {
title = /*#__PURE__*/(0, _jsxRuntime.jsx)(TitleSlot, {
...titleSlotProps,
children: title
});
}
let subheader = subheaderProp;
const [SubheaderSlot, subheaderSlotProps] = (0, _useSlot.default)('subheader', {
className: classes.subheader,
elementType: _Typography.default,
externalForwardedProps,
ownerState,
additionalProps: {
variant: avatar ? 'body2' : 'body1',
color: 'textSecondary',
component: 'span'
}
});
if (subheader != null && subheader.type !== _Typography.default && !disableTypography) {
subheader = /*#__PURE__*/(0, _jsxRuntime.jsx)(SubheaderSlot, {
...subheaderSlotProps,
children: subheader
});
}
const [RootSlot, rootSlotProps] = (0, _useSlot.default)('root', {
ref,
className: classes.root,
elementType: CardHeaderRoot,
externalForwardedProps: {
...externalForwardedProps,
...other,
component
},
ownerState
});
const [AvatarSlot, avatarSlotProps] = (0, _useSlot.default)('avatar', {
className: classes.avatar,
elementType: CardHeaderAvatar,
externalForwardedProps,
ownerState
});
const [ContentSlot, contentSlotProps] = (0, _useSlot.default)('content', {
className: classes.content,
elementType: CardHeaderContent,
externalForwardedProps,
ownerState
});
const [ActionSlot, actionSlotProps] = (0, _useSlot.default)('action', {
className: classes.action,
elementType: CardHeaderAction,
externalForwardedProps,
ownerState
});
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(RootSlot, {
...rootSlotProps,
children: [avatar && /*#__PURE__*/(0, _jsxRuntime.jsx)(AvatarSlot, {
...avatarSlotProps,
children: avatar
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(ContentSlot, {
...contentSlotProps,
children: [title, subheader]
}), action && /*#__PURE__*/(0, _jsxRuntime.jsx)(ActionSlot, {
...actionSlotProps,
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.default.node,
/**
* The Avatar element to display.
*/
avatar: _propTypes.default.node,
/**
* @ignore
*/
children: _propTypes.default.node,
/**
* Override or extend the styles applied to the component.
*/
classes: _propTypes.default.object,
/**
* The component used for the root node.
* Either a string to use a HTML element or a component.
*/
component: _propTypes.default.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.default.bool,
/**
* The props used for each slot inside.
* @default {}
*/
slotProps: _propTypes.default /* @typescript-to-proptypes-ignore */.shape({
action: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
avatar: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
content: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
root: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
subheader: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
title: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
}),
/**
* The components used for each slot inside.
* @default {}
*/
slots: _propTypes.default.shape({
action: _propTypes.default.elementType,
avatar: _propTypes.default.elementType,
content: _propTypes.default.elementType,
root: _propTypes.default.elementType,
subheader: _propTypes.default.elementType,
title: _propTypes.default.elementType
}),
/**
* The content of the component.
*/
subheader: _propTypes.default.node,
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
/**
* The content of the component.
*/
title: _propTypes.default.node
} : void 0;
var _default = exports.default = CardHeader;
+247
View File
@@ -0,0 +1,247 @@
'use client';
import * as React from 'react';
import PropTypes from 'prop-types';
import composeClasses from '@mui/utils/composeClasses';
import Typography, { typographyClasses } from "../Typography/index.mjs";
import { styled } from "../zero-styled/index.mjs";
import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
import cardHeaderClasses, { getCardHeaderUtilityClass } from "./cardHeaderClasses.mjs";
import useSlot from "../utils/useSlot.mjs";
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) => {
return [{
[`& .${cardHeaderClasses.title}`]: styles.title
}, {
[`& .${cardHeaderClasses.subheader}`]: styles.subheader
}, styles.root];
}
})({
display: 'flex',
alignItems: 'center',
padding: 16
});
const CardHeaderAvatar = styled('div', {
name: 'MuiCardHeader',
slot: 'Avatar'
})({
display: 'flex',
flex: '0 0 auto',
marginRight: 16
});
const CardHeaderAction = styled('div', {
name: 'MuiCardHeader',
slot: 'Action'
})({
flex: '0 0 auto',
alignSelf: 'flex-start',
marginTop: -4,
marginRight: -8,
marginBottom: -4
});
const CardHeaderContent = styled('div', {
name: 'MuiCardHeader',
slot: 'Content'
})({
flex: '1 1 auto',
// Combine this and the below selector once https://github.com/emotion-js/emotion/issues/3366 is solved
[`.${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,
component = 'div',
disableTypography = false,
subheader: subheaderProp,
title: titleProp,
slots = {},
slotProps = {},
...other
} = props;
const ownerState = {
...props,
component,
disableTypography
};
const classes = useUtilityClasses(ownerState);
const externalForwardedProps = {
slots,
slotProps
};
let title = titleProp;
const [TitleSlot, titleSlotProps] = useSlot('title', {
className: classes.title,
elementType: Typography,
externalForwardedProps,
ownerState,
additionalProps: {
variant: avatar ? 'body2' : 'h5',
component: 'span'
}
});
if (title != null && title.type !== Typography && !disableTypography) {
title = /*#__PURE__*/_jsx(TitleSlot, {
...titleSlotProps,
children: title
});
}
let subheader = subheaderProp;
const [SubheaderSlot, subheaderSlotProps] = useSlot('subheader', {
className: classes.subheader,
elementType: Typography,
externalForwardedProps,
ownerState,
additionalProps: {
variant: avatar ? 'body2' : 'body1',
color: 'textSecondary',
component: 'span'
}
});
if (subheader != null && subheader.type !== Typography && !disableTypography) {
subheader = /*#__PURE__*/_jsx(SubheaderSlot, {
...subheaderSlotProps,
children: subheader
});
}
const [RootSlot, rootSlotProps] = useSlot('root', {
ref,
className: classes.root,
elementType: CardHeaderRoot,
externalForwardedProps: {
...externalForwardedProps,
...other,
component
},
ownerState
});
const [AvatarSlot, avatarSlotProps] = useSlot('avatar', {
className: classes.avatar,
elementType: CardHeaderAvatar,
externalForwardedProps,
ownerState
});
const [ContentSlot, contentSlotProps] = useSlot('content', {
className: classes.content,
elementType: CardHeaderContent,
externalForwardedProps,
ownerState
});
const [ActionSlot, actionSlotProps] = useSlot('action', {
className: classes.action,
elementType: CardHeaderAction,
externalForwardedProps,
ownerState
});
return /*#__PURE__*/_jsxs(RootSlot, {
...rootSlotProps,
children: [avatar && /*#__PURE__*/_jsx(AvatarSlot, {
...avatarSlotProps,
children: avatar
}), /*#__PURE__*/_jsxs(ContentSlot, {
...contentSlotProps,
children: [title, subheader]
}), action && /*#__PURE__*/_jsx(ActionSlot, {
...actionSlotProps,
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,
/**
* 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 props used for each slot inside.
* @default {}
*/
slotProps: PropTypes /* @typescript-to-proptypes-ignore */.shape({
action: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
avatar: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
content: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
subheader: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
title: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
}),
/**
* The components used for each slot inside.
* @default {}
*/
slots: PropTypes.shape({
action: PropTypes.elementType,
avatar: PropTypes.elementType,
content: PropTypes.elementType,
root: PropTypes.elementType,
subheader: PropTypes.elementType,
title: PropTypes.elementType
}),
/**
* The content of the component.
*/
subheader: PropTypes.node,
/**
* 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
} : void 0;
export default CardHeader;
+18
View File
@@ -0,0 +1,18 @@
export interface CardHeaderClasses {
/** Styles applied to the root element. */
root: string;
/** Styles applied to the avatar element. */
avatar: string;
/** Styles applied to the action element. */
action: string;
/** Styles applied to the content wrapper element. */
content: string;
/** Styles applied to the title Typography element. */
title: string;
/** Styles applied to the subheader Typography element. */
subheader: string;
}
export type CardHeaderClassKey = keyof CardHeaderClasses;
export declare function getCardHeaderUtilityClass(slot: string): string;
declare const cardHeaderClasses: CardHeaderClasses;
export default cardHeaderClasses;
+18
View File
@@ -0,0 +1,18 @@
export interface CardHeaderClasses {
/** Styles applied to the root element. */
root: string;
/** Styles applied to the avatar element. */
avatar: string;
/** Styles applied to the action element. */
action: string;
/** Styles applied to the content wrapper element. */
content: string;
/** Styles applied to the title Typography element. */
title: string;
/** Styles applied to the subheader Typography element. */
subheader: string;
}
export type CardHeaderClassKey = keyof CardHeaderClasses;
export declare function getCardHeaderUtilityClass(slot: string): string;
declare const cardHeaderClasses: CardHeaderClasses;
export default cardHeaderClasses;
+15
View File
@@ -0,0 +1,15 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
exports.getCardHeaderUtilityClass = getCardHeaderUtilityClass;
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
function getCardHeaderUtilityClass(slot) {
return (0, _generateUtilityClass.default)('MuiCardHeader', slot);
}
const cardHeaderClasses = (0, _generateUtilityClasses.default)('MuiCardHeader', ['root', 'avatar', 'action', 'content', 'title', 'subheader']);
var _default = exports.default = cardHeaderClasses;
+7
View 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;
+4
View File
@@ -0,0 +1,4 @@
export { default } from "./CardHeader.mjs";
export * from "./CardHeader.mjs";
export { default as cardHeaderClasses } from "./cardHeaderClasses.mjs";
export * from "./cardHeaderClasses.mjs";
+4
View File
@@ -0,0 +1,4 @@
export { default } from "./CardHeader.js";
export * from "./CardHeader.js";
export { default as cardHeaderClasses } from "./cardHeaderClasses.js";
export * from "./cardHeaderClasses.js";
+35
View File
@@ -0,0 +1,35 @@
"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _exportNames = {
cardHeaderClasses: true
};
Object.defineProperty(exports, "cardHeaderClasses", {
enumerable: true,
get: function () {
return _cardHeaderClasses.default;
}
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function () {
return _CardHeader.default;
}
});
var _CardHeader = _interopRequireDefault(require("./CardHeader"));
var _cardHeaderClasses = _interopRequireWildcard(require("./cardHeaderClasses"));
Object.keys(_cardHeaderClasses).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _cardHeaderClasses[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _cardHeaderClasses[key];
}
});
});
+3
View File
@@ -0,0 +1,3 @@
export { default } from "./CardHeader.mjs";
export { default as cardHeaderClasses } from "./cardHeaderClasses.mjs";
export * from "./cardHeaderClasses.mjs";