Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Add more props documentation to IntelliSense #20264

Merged
merged 15 commits into from
Mar 25, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/material-ui/src/Card/Card.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { StandardProps } from '..';
import { PaperProps } from '../Paper';

export interface CardProps extends StandardProps<PaperProps, CardClassKey> {
/**
* If `true`, the card will use raised styling.
*/
raised?: boolean;
}

Expand All @@ -19,6 +22,4 @@ export type CardClassKey = 'root';
* - [Card API](https://material-ui.com/api/card/)
* - inherits [Paper API](https://material-ui.com/api/paper/)
*/
declare const Card: React.ComponentType<CardProps>;

export default Card;
export default function Card(props: CardProps): JSX.Element;
6 changes: 5 additions & 1 deletion packages/material-ui/src/Card/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ const Card = React.forwardRef(function Card(props, ref) {
});

Card.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the d.ts file and run "yarn proptypes" |
// ----------------------------------------------------------------------
/**
* The content of the component.
*/
Expand All @@ -33,7 +37,7 @@ Card.propTypes = {
* Override or extend the styles applied to the component.
* See [CSS API](#css) below for more details.
*/
classes: PropTypes.object.isRequired,
classes: PropTypes.object,
/**
* @ignore
*/
Expand Down
7 changes: 4 additions & 3 deletions packages/material-ui/src/CardActions/CardActions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { StandardProps } from '..';

export interface CardActionsProps
extends StandardProps<React.HTMLAttributes<HTMLDivElement>, CardActionsClassKey> {
/**
* If `true`, the actions do not have additional margin.
*/
disableSpacing?: boolean;
}

Expand All @@ -18,6 +21,4 @@ export type CardActionsClassKey = 'root' | 'spacing';
*
* - [CardActions API](https://material-ui.com/api/card-actions/)
*/
declare const CardActions: React.ComponentType<CardActionsProps>;

export default CardActions;
export default function CardActions(props: CardActionsProps): JSX.Element;
6 changes: 5 additions & 1 deletion packages/material-ui/src/CardActions/CardActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ const CardActions = React.forwardRef(function CardActions(props, ref) {
});

CardActions.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the d.ts file and run "yarn proptypes" |
// ----------------------------------------------------------------------
/**
* The content of the component.
*/
Expand All @@ -39,7 +43,7 @@ CardActions.propTypes = {
* Override or extend the styles applied to the component.
* See [CSS API](#css) below for more details.
*/
classes: PropTypes.object.isRequired,
classes: PropTypes.object,
/**
* @ignore
*/
Expand Down
39 changes: 36 additions & 3 deletions packages/material-ui/src/Collapse/Collapse.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,44 @@ import { Theme } from '../styles/createMuiTheme';
import { TransitionProps } from '../transitions/transition';

export interface CollapseProps extends StandardProps<TransitionProps, CollapseClassKey, 'timeout'> {
/**
* The content node to be collapsed.
*/
children?: React.ReactNode;
/**
* The height of the container when collapsed.
*/
collapsedHeight?: string | number;
/**
* The component used for the root node.
* Either a string to use a DOM element or a component.
*/
component?: React.ElementType<TransitionProps>;
theme?: Theme;
/**
* If `true`, the component will transition in.
*/
in?: boolean;
/**
*/
eps1lon marked this conversation as resolved.
Show resolved Hide resolved
onEnter?: TransitionProps['onEnter'];
/**
*/
onEntered?: TransitionProps['onEntered'];
/**
*/
onEntering?: TransitionProps['onEntering'];
/**
*/
onExit?: TransitionProps['onExit'];
/**
*/
onExiting?: TransitionProps['onExiting'];
/**
* The duration for the transition, in milliseconds.
* You may specify a single timeout for all transitions, or individually with an object.
*
* Set to 'auto' to automatically calculate transition time based on height.
*/
timeout?: TransitionProps['timeout'] | 'auto';
}

Expand All @@ -28,6 +62,5 @@ export type CollapseClassKey = 'container' | 'entered' | 'hidden' | 'wrapper' |
* - [Collapse API](https://material-ui.com/api/collapse/)
* - inherits [Transition API](https://reactcommunity.org/react-transition-group/transition#Transition-props)
*/
declare const Collapse: React.ComponentType<CollapseProps>;

export default Collapse;
export default function Collapse(props: CollapseProps): JSX.Element;
16 changes: 12 additions & 4 deletions packages/material-ui/src/Collapse/Collapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ const Collapse = React.forwardRef(function Collapse(props, ref) {
});

Collapse.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the d.ts file and run "yarn proptypes" |
// ----------------------------------------------------------------------
/**
* The content node to be collapsed.
*/
Expand All @@ -199,15 +203,15 @@ Collapse.propTypes = {
* Override or extend the styles applied to the component.
* See [CSS API](#css) below for more details.
*/
classes: PropTypes.object.isRequired,
classes: PropTypes.object,
/**
* @ignore
*/
className: PropTypes.string,
/**
* The height of the container when collapsed.
*/
collapsedHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
collapsedHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
/**
* The component used for the root node.
* Either a string to use a DOM element or a component.
Expand Down Expand Up @@ -248,9 +252,13 @@ Collapse.propTypes = {
* Set to 'auto' to automatically calculate transition time based on height.
*/
timeout: PropTypes.oneOfType([
PropTypes.number,
PropTypes.shape({ enter: PropTypes.number, exit: PropTypes.number }),
PropTypes.oneOf(['auto']),
PropTypes.number,
PropTypes.shape({
appear: PropTypes.number,
enter: PropTypes.number,
exit: PropTypes.number,
}),
]),
};

Expand Down
7 changes: 4 additions & 3 deletions packages/material-ui/src/DialogActions/DialogActions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { StandardProps } from '..';

export interface DialogActionsProps
extends StandardProps<React.HTMLAttributes<HTMLDivElement>, DialogActionsClassKey> {
/**
* If `true`, the actions do not have additional margin.
*/
disableSpacing?: boolean;
}

Expand All @@ -18,6 +21,4 @@ export type DialogActionsClassKey = 'root' | 'spacing';
*
* - [DialogActions API](https://material-ui.com/api/dialog-actions/)
*/
declare const DialogActions: React.ComponentType<DialogActionsProps>;

export default DialogActions;
export default function DialogActions(props: DialogActionsProps): JSX.Eleement;
6 changes: 5 additions & 1 deletion packages/material-ui/src/DialogActions/DialogActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ const DialogActions = React.forwardRef(function DialogActions(props, ref) {
});

DialogActions.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the d.ts file and run "yarn proptypes" |
// ----------------------------------------------------------------------
/**
* The content of the component.
*/
Expand All @@ -41,7 +45,7 @@ DialogActions.propTypes = {
* Override or extend the styles applied to the component.
* See [CSS API](#css) below for more details.
*/
classes: PropTypes.object.isRequired,
classes: PropTypes.object,
/**
* @ignore
*/
Expand Down
7 changes: 4 additions & 3 deletions packages/material-ui/src/DialogContent/DialogContent.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { StandardProps } from '..';

export interface DialogContentProps
extends StandardProps<React.HTMLAttributes<HTMLDivElement>, DialogContentClassKey> {
/**
* Display the top and bottom dividers.
*/
dividers?: boolean;
}

Expand All @@ -18,6 +21,4 @@ export type DialogContentClassKey = 'root' | 'dividers';
*
* - [DialogContent API](https://material-ui.com/api/dialog-content/)
*/
declare const DialogContent: React.ComponentType<DialogContentProps>;

export default DialogContent;
export default function DialogContent(props: DialogContentProps): JSX.Element;
6 changes: 5 additions & 1 deletion packages/material-ui/src/DialogContent/DialogContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ const DialogContent = React.forwardRef(function DialogContent(props, ref) {
});

DialogContent.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the d.ts file and run "yarn proptypes" |
// ----------------------------------------------------------------------
/**
* The content of the component.
*/
Expand All @@ -50,7 +54,7 @@ DialogContent.propTypes = {
* Override or extend the styles applied to the component.
* See [CSS API](#css) below for more details.
*/
classes: PropTypes.object.isRequired,
classes: PropTypes.object,
/**
* @ignore
*/
Expand Down
8 changes: 5 additions & 3 deletions packages/material-ui/src/DialogTitle/DialogTitle.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import { StandardProps } from '..';

export interface DialogTitleProps
extends StandardProps<React.HTMLAttributes<HTMLDivElement>, DialogTitleClassKey> {
/**
* If `true`, the children won't be wrapped by a typography component.
* For instance, this can be useful to render an h4 instead of the default h2.
*/
disableTypography?: boolean;
}

Expand All @@ -18,6 +22,4 @@ export type DialogTitleClassKey = 'root';
*
* - [DialogTitle API](https://material-ui.com/api/dialog-title/)
*/
declare const DialogTitle: React.ComponentType<DialogTitleProps>;

export default DialogTitle;
export default function DialogTitle(props: DialogTitleProps): JSX.Element;
8 changes: 6 additions & 2 deletions packages/material-ui/src/DialogTitle/DialogTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,19 @@ const DialogTitle = React.forwardRef(function DialogTitle(props, ref) {
});

DialogTitle.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the d.ts file and run "yarn proptypes" |
// ----------------------------------------------------------------------
/**
* The content of the component.
*/
children: PropTypes.node.isRequired,
children: PropTypes.node,
/**
* Override or extend the styles applied to the component.
* See [CSS API](#css) below for more details.
*/
classes: PropTypes.object.isRequired,
classes: PropTypes.object,
/**
* @ignore
*/
Expand Down
35 changes: 34 additions & 1 deletion packages/material-ui/src/Drawer/Drawer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,48 @@ export interface DrawerProps
DrawerClassKey,
'open' | 'children'
> {
/**
* Side from which the drawer will appear.
*/
anchor?: 'left' | 'top' | 'right' | 'bottom';
/**
* The contents of the drawer.
*/
children?: React.ReactNode;
/**
* The elevation of the drawer.
*/
elevation?: number;
/**
* Props applied to the [`Modal`](/api/modal/) element.
*/
ModalProps?: Partial<ModalProps>;
/**
* Callback fired when the component requests to be closed.
*
* @param {object} event The event source of the callback.
*/
onClose?: ModalProps['onClose'];
/**
* If `true`, the drawer is open.
*/
open?: boolean;
/**
* Props applied to the [`Paper`](/api/paper/) element.
*/
PaperProps?: Partial<PaperProps>;
/**
* Props applied to the [`Slide`](/api/slide/) element.
*/
SlideProps?: Partial<SlideProps>;
theme?: Theme;
/**
* The duration for the transition, in milliseconds.
* You may specify a single timeout for all transitions, or individually with an object.
*/
transitionDuration?: TransitionProps['timeout'];
/**
* The variant to use.
*/
variant?: 'permanent' | 'persistent' | 'temporary';
}

Expand Down
14 changes: 11 additions & 3 deletions packages/material-ui/src/Drawer/Drawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,14 @@ const Drawer = React.forwardRef(function Drawer(props, ref) {
});

Drawer.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the d.ts file and run "yarn proptypes" |
// ----------------------------------------------------------------------
/**
* Side from which the drawer will appear.
*/
anchor: PropTypes.oneOf(['left', 'top', 'right', 'bottom']),
anchor: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
/**
* @ignore
*/
Expand All @@ -214,7 +218,7 @@ Drawer.propTypes = {
* Override or extend the styles applied to the component.
* See [CSS API](#css) below for more details.
*/
classes: PropTypes.object.isRequired,
classes: PropTypes.object,
/**
* @ignore
*/
Expand Down Expand Up @@ -251,7 +255,11 @@ Drawer.propTypes = {
*/
transitionDuration: PropTypes.oneOfType([
PropTypes.number,
PropTypes.shape({ enter: PropTypes.number, exit: PropTypes.number }),
PropTypes.shape({
appear: PropTypes.number,
enter: PropTypes.number,
exit: PropTypes.number,
}),
]),
/**
* The variant to use.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import * as React from 'react';
import { StandardProps } from '..';

export interface ExpansionPanelActionsProps
extends StandardProps<React.HTMLAttributes<HTMLDivElement>, ExpansionPanelActionsClassKey> {}
extends StandardProps<React.HTMLAttributes<HTMLDivElement>, ExpansionPanelActionsClassKey> {
/**
* If `true`, the actions do not have additional margin.
*/
disableSpacing?: boolean;
}

export type ExpansionPanelActionsClassKey = 'root' | 'spacing';

Expand Down
Loading