0.2.0 - Mid migration

This commit is contained in:
Daniel Mason 2022-04-25 14:47:15 +12:00
parent 139e6a915e
commit 7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions

View file

@ -0,0 +1,118 @@
import * as React from 'react';
import { TypographyProps } from '../Typography';
import { OverridableComponent, OverrideProps } from '../OverridableComponent';
export interface CardHeaderTypeMap<
Props = {},
DefaultComponent extends React.ElementType = 'div',
TitleTypographyComponent extends React.ElementType = 'span',
SubheaderTypographyComponent extends React.ElementType = 'span'
> {
props: Props & {
/**
* The action to display in the card header.
*/
action?: React.ReactNode;
/**
* The Avatar for the Card Header.
*/
avatar?: React.ReactNode;
/**
* 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.
*/
disableTypography?: boolean;
/**
* The content of the component.
*/
subheader?: React.ReactNode;
/**
* These props will be forwarded to the subheader
* (as long as disableTypography is not `true`).
*/
subheaderTypographyProps?: TypographyProps<
SubheaderTypographyComponent,
{ component?: SubheaderTypographyComponent }
>;
/**
* The content of the Card Title.
*/
title?: React.ReactNode;
/**
* These props will be forwarded to the title
* (as long as disableTypography is not `true`).
*/
titleTypographyProps?: TypographyProps<
TitleTypographyComponent,
{ component?: TitleTypographyComponent }
>;
};
defaultComponent: DefaultComponent;
classKey: CardHeaderClassKey;
}
/**
*
* Demos:
*
* - [Cards](https://material-ui.com/components/cards/)
*
* API:
*
* - [CardHeader API](https://material-ui.com/api/card-header/)
*/
declare const CardHeader: OverridableCardHeader;
export interface OverridableCardHeader extends OverridableComponent<CardHeaderTypeMap> {
<
DefaultComponent extends React.ElementType = CardHeaderTypeMap['defaultComponent'],
Props = {},
TitleTypographyComponent extends React.ElementType = 'span',
SubheaderTypographyComponent extends React.ElementType = 'span'
>(
props: CardHeaderPropsWithComponent<
DefaultComponent,
Props,
TitleTypographyComponent,
SubheaderTypographyComponent
>
): JSX.Element;
}
export type CardHeaderClassKey = 'root' | 'avatar' | 'action' | 'content' | 'title' | 'subheader';
export type CardHeaderProps<
DefaultComponent extends React.ElementType = CardHeaderTypeMap['defaultComponent'],
Props = {},
TitleTypographyComponent extends React.ElementType = 'span',
SubheaderTypographyComponent extends React.ElementType = 'span'
> = OverrideProps<
CardHeaderTypeMap<
Props,
DefaultComponent,
TitleTypographyComponent,
SubheaderTypographyComponent
>,
DefaultComponent
>;
export type CardHeaderPropsWithComponent<
DefaultComponent extends React.ElementType = CardHeaderTypeMap['defaultComponent'],
Props = {},
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?: DefaultComponent;
} & CardHeaderProps<
DefaultComponent,
Props,
TitleTypographyComponent,
SubheaderTypographyComponent
>;
export default CardHeader;

View file

@ -0,0 +1,183 @@
"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.styles = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var React = _interopRequireWildcard(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _clsx = _interopRequireDefault(require("clsx"));
var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
var _Typography = _interopRequireDefault(require("../Typography"));
var styles = {
/* Styles applied to the root element. */
root: {
display: 'flex',
alignItems: 'center',
padding: 16
},
/* Styles applied to the avatar element. */
avatar: {
flex: '0 0 auto',
marginRight: 16
},
/* Styles applied to the action element. */
action: {
flex: '0 0 auto',
alignSelf: 'flex-start',
marginTop: -8,
marginRight: -8
},
/* Styles applied to the content wrapper element. */
content: {
flex: '1 1 auto'
},
/* Styles applied to the title Typography element. */
title: {},
/* Styles applied to the subheader Typography element. */
subheader: {}
};
exports.styles = styles;
var CardHeader = /*#__PURE__*/React.forwardRef(function CardHeader(props, ref) {
var action = props.action,
avatar = props.avatar,
classes = props.classes,
className = props.className,
_props$component = props.component,
Component = _props$component === void 0 ? 'div' : _props$component,
_props$disableTypogra = props.disableTypography,
disableTypography = _props$disableTypogra === void 0 ? false : _props$disableTypogra,
subheaderProp = props.subheader,
subheaderTypographyProps = props.subheaderTypographyProps,
titleProp = props.title,
titleTypographyProps = props.titleTypographyProps,
other = (0, _objectWithoutProperties2.default)(props, ["action", "avatar", "classes", "className", "component", "disableTypography", "subheader", "subheaderTypographyProps", "title", "titleTypographyProps"]);
var title = titleProp;
if (title != null && title.type !== _Typography.default && !disableTypography) {
title = /*#__PURE__*/React.createElement(_Typography.default, (0, _extends2.default)({
variant: avatar ? 'body2' : 'h5',
className: classes.title,
component: "span",
display: "block"
}, titleTypographyProps), title);
}
var subheader = subheaderProp;
if (subheader != null && subheader.type !== _Typography.default && !disableTypography) {
subheader = /*#__PURE__*/React.createElement(_Typography.default, (0, _extends2.default)({
variant: avatar ? 'body2' : 'body1',
className: classes.subheader,
color: "textSecondary",
component: "span",
display: "block"
}, subheaderTypographyProps), subheader);
}
return /*#__PURE__*/React.createElement(Component, (0, _extends2.default)({
className: (0, _clsx.default)(classes.root, className),
ref: ref
}, other), avatar && /*#__PURE__*/React.createElement("div", {
className: classes.avatar
}, avatar), /*#__PURE__*/React.createElement("div", {
className: classes.content
}, title, subheader), action && /*#__PURE__*/React.createElement("div", {
className: classes.action
}, action));
});
process.env.NODE_ENV !== "production" ? CardHeader.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the d.ts file and run "yarn proptypes" |
// ----------------------------------------------------------------------
/**
* The action to display in the card header.
*/
action: _propTypes.default.node,
/**
* The Avatar for the Card Header.
*/
avatar: _propTypes.default.node,
/**
* @ignore
*/
children: _propTypes.default.node,
/**
* Override or extend the styles applied to the component.
* See [CSS API](#css) below for more details.
*/
classes: _propTypes.default.object,
/**
* @ignore
*/
className: _propTypes.default.string,
/**
* The component used for the root node.
* Either a string to use a HTML element or a component.
*/
component: _propTypes.default
/* @typescript-to-proptypes-ignore */
.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.
*/
disableTypography: _propTypes.default.bool,
/**
* The content of the component.
*/
subheader: _propTypes.default.node,
/**
* These props will be forwarded to the subheader
* (as long as disableTypography is not `true`).
*/
subheaderTypographyProps: _propTypes.default.object,
/**
* The content of the Card Title.
*/
title: _propTypes.default.node,
/**
* These props will be forwarded to the title
* (as long as disableTypography is not `true`).
*/
titleTypographyProps: _propTypes.default.object
} : void 0;
var _default = (0, _withStyles.default)(styles, {
name: 'MuiCardHeader'
})(CardHeader);
exports.default = _default;

View file

@ -0,0 +1,2 @@
export { default } from './CardHeader';
export * from './CardHeader';

15
web/node_modules/@material-ui/core/CardHeader/index.js generated vendored Normal file
View file

@ -0,0 +1,15 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function get() {
return _CardHeader.default;
}
});
var _CardHeader = _interopRequireDefault(require("./CardHeader"));

View file

@ -0,0 +1,5 @@
{
"sideEffects": false,
"module": "../esm/CardHeader/index.js",
"typings": "./index.d.ts"
}