diff --git a/packages/material-ui/package.json b/packages/material-ui/package.json index 13cbe2a23272e4..794b52e77a00eb 100644 --- a/packages/material-ui/package.json +++ b/packages/material-ui/package.json @@ -62,6 +62,9 @@ "scroll": "^2.0.3", "warning": "^4.0.1" }, + "devDependencies": { + "@types/react-router-dom": "^4.2.7" + }, "sideEffects": false, "publishConfig": { "access": "public" diff --git a/packages/material-ui/src/AppBar/AppBar.d.ts b/packages/material-ui/src/AppBar/AppBar.d.ts index fa5ca4a3f06676..25d011af11c70d 100644 --- a/packages/material-ui/src/AppBar/AppBar.d.ts +++ b/packages/material-ui/src/AppBar/AppBar.d.ts @@ -1,7 +1,8 @@ +import * as React from 'react'; import { PropTypes, StandardProps } from '..'; import { PaperProps } from '../Paper'; -export interface AppBarProps extends StandardProps { +export interface AppBarProps extends StandardProps, AppBarClassKey> { color?: PropTypes.Color; position?: 'fixed' | 'absolute' | 'sticky' | 'static'; } @@ -16,6 +17,6 @@ export type AppBarClassKey = | 'colorPrimary' | 'colorSecondary'; -declare const AppBar: React.ComponentType; +declare class AppBar extends React.Component> {} export default AppBar; diff --git a/packages/material-ui/src/Avatar/Avatar.d.ts b/packages/material-ui/src/Avatar/Avatar.d.ts index dc494ad952a0bd..f85acba7c1fc57 100644 --- a/packages/material-ui/src/Avatar/Avatar.d.ts +++ b/packages/material-ui/src/Avatar/Avatar.d.ts @@ -1,19 +1,21 @@ import * as React from 'react'; -import { StandardProps } from '..'; +import { AnyComponent, PassthruProps, StandardProps } from '..'; -export interface AvatarProps - extends StandardProps, AvatarClassKey> { +export type AvatarProps = StandardProps< + PassthruProps, + AvatarClassKey +> & { alt?: string; childrenClassName?: string; - component?: React.ReactType; + component?: C; imgProps?: React.HtmlHTMLAttributes; sizes?: string; src?: string; srcSet?: string; -} +}; export type AvatarClassKey = 'root' | 'colorDefault' | 'img'; -declare const Avatar: React.ComponentType; +declare class Avatar extends React.Component> {} export default Avatar; diff --git a/packages/material-ui/src/Badge/Badge.d.ts b/packages/material-ui/src/Badge/Badge.d.ts index 45a15eef116dfb..e30a8d55a7f6a2 100644 --- a/packages/material-ui/src/Badge/Badge.d.ts +++ b/packages/material-ui/src/Badge/Badge.d.ts @@ -1,16 +1,16 @@ import * as React from 'react'; import { StandardProps, PropTypes } from '..'; -export interface BadgeProps +export interface BadgeProps extends StandardProps, BadgeClassKey> { badgeContent: React.ReactNode; children: React.ReactNode; color?: PropTypes.Color | 'error'; - component?: React.ReactType; + component?: React.ReactType; } export type BadgeClassKey = 'root' | 'badge' | 'colorPrimary' | 'colorSecondary'; -declare const Badge: React.ComponentType; +declare class Badge extends React.Component> {} export default Badge; diff --git a/packages/material-ui/src/BottomNavigationAction/BottomNavigationAction.d.ts b/packages/material-ui/src/BottomNavigationAction/BottomNavigationAction.d.ts index 9a891c40808096..6727181b218dc1 100644 --- a/packages/material-ui/src/BottomNavigationAction/BottomNavigationAction.d.ts +++ b/packages/material-ui/src/BottomNavigationAction/BottomNavigationAction.d.ts @@ -2,8 +2,8 @@ import * as React from 'react'; import { StandardProps } from '..'; import { ButtonBaseProps } from '../ButtonBase'; -export interface BottomNavigationActionProps - extends StandardProps { +export interface BottomNavigationActionProps + extends StandardProps, BottomNavigationActionClassKey, 'onChange'> { icon?: string | React.ReactElement; label?: React.ReactNode; onChange?: (event: React.ChangeEvent<{}>, value: any) => void; @@ -15,6 +15,8 @@ export interface BottomNavigationActionProps export type BottomNavigationActionClassKey = 'root' | 'selected' | 'iconOnly' | 'wrapper' | 'label'; -declare const BottomNavigationAction: React.ComponentType; +declare class BottomNavigationAction extends React.Component< + C & BottomNavigationActionProps +> {} export default BottomNavigationAction; diff --git a/packages/material-ui/src/Button/Button.d.ts b/packages/material-ui/src/Button/Button.d.ts index a01e336643eaa3..87b1962a2d6745 100644 --- a/packages/material-ui/src/Button/Button.d.ts +++ b/packages/material-ui/src/Button/Button.d.ts @@ -2,9 +2,10 @@ import * as React from 'react'; import { StandardProps, PropTypes } from '..'; import { ButtonBaseProps } from '../ButtonBase'; -export interface ButtonProps extends StandardProps { +export interface ButtonProps + extends StandardProps, ButtonClassKey, 'component'> { color?: PropTypes.Color; - component?: React.ReactType; + component?: React.ReactType; disabled?: boolean; disableFocusRipple?: boolean; disableRipple?: boolean; @@ -41,6 +42,6 @@ export type ButtonClassKey = | 'sizeLarge' | 'fullWidth'; -declare const Button: React.ComponentType; +declare class Button extends React.Component> {} export default Button; diff --git a/packages/material-ui/src/ButtonBase/ButtonBase.d.ts b/packages/material-ui/src/ButtonBase/ButtonBase.d.ts index 22c7eade399b1c..40f003bb846033 100644 --- a/packages/material-ui/src/ButtonBase/ButtonBase.d.ts +++ b/packages/material-ui/src/ButtonBase/ButtonBase.d.ts @@ -2,7 +2,7 @@ import * as React from 'react'; import { StandardProps } from '..'; import { TouchRippleProps } from './TouchRipple'; -export interface ButtonBaseProps +export interface ButtonBaseProps extends StandardProps< React.AnchorHTMLAttributes & React.ButtonHTMLAttributes, ButtonBaseClassKey @@ -10,7 +10,7 @@ export interface ButtonBaseProps action?: (actions: ButtonBaseActions) => void; buttonRef?: React.Ref | React.RefObject; centerRipple?: boolean; - component?: React.ReactType; + component?: React.ReactType; disableRipple?: boolean; disableTouchRipple?: boolean; focusRipple?: boolean; @@ -25,6 +25,6 @@ export interface ButtonBaseActions { focusVisible(): void; } -declare const ButtonBase: React.ComponentType; +declare class ButtonBase extends React.Component> {} export default ButtonBase; diff --git a/packages/material-ui/src/Card/Card.d.ts b/packages/material-ui/src/Card/Card.d.ts index 0104856e1ed363..2ca72e68ece77f 100644 --- a/packages/material-ui/src/Card/Card.d.ts +++ b/packages/material-ui/src/Card/Card.d.ts @@ -2,12 +2,12 @@ import * as React from 'react'; import { StandardProps } from '..'; import { PaperProps } from '../Paper'; -export interface CardProps extends StandardProps { +export interface CardProps extends StandardProps, CardClassKey> { raised?: boolean; } export type CardClassKey = 'root'; -declare const Card: React.ComponentType; +declare class Card extends React.Component> {} export default Card; diff --git a/packages/material-ui/src/CardContent/CardContent.d.ts b/packages/material-ui/src/CardContent/CardContent.d.ts index 3d3e2c2c6c712e..742202b335a882 100644 --- a/packages/material-ui/src/CardContent/CardContent.d.ts +++ b/packages/material-ui/src/CardContent/CardContent.d.ts @@ -1,13 +1,13 @@ import * as React from 'react'; import { StandardProps } from '..'; -export interface CardContentProps +export interface CardContentProps extends StandardProps, CardContentClassKey> { - component?: React.ReactType; + component?: React.ReactType; } export type CardContentClassKey = 'root'; -declare const CardContent: React.ComponentType; +declare class CardContent extends React.Component> {} export default CardContent; diff --git a/packages/material-ui/src/CardHeader/CardHeader.d.ts b/packages/material-ui/src/CardHeader/CardHeader.d.ts index 0a824fdfc06139..26c280b70b00b8 100644 --- a/packages/material-ui/src/CardHeader/CardHeader.d.ts +++ b/packages/material-ui/src/CardHeader/CardHeader.d.ts @@ -2,17 +2,17 @@ import * as React from 'react'; import { StandardProps } from '..'; import { CardContentProps } from '../CardContent'; -export interface CardHeaderProps +export interface CardHeaderProps extends StandardProps, CardHeaderClassKey, 'title'> { action?: React.ReactNode; avatar?: React.ReactNode; - component?: React.ReactType; + component?: React.ReactType; subheader?: React.ReactNode; title?: React.ReactNode; } export type CardHeaderClassKey = 'root' | 'avatar' | 'action' | 'content' | 'title' | 'subheader'; -declare const CardHeader: React.ComponentType; +declare class CardHeader extends React.Component> {} export default CardHeader; diff --git a/packages/material-ui/src/CardMedia/CardMedia.d.ts b/packages/material-ui/src/CardMedia/CardMedia.d.ts index 9f69e46e067a79..8a0b6c977b75ea 100644 --- a/packages/material-ui/src/CardMedia/CardMedia.d.ts +++ b/packages/material-ui/src/CardMedia/CardMedia.d.ts @@ -1,15 +1,15 @@ import * as React from 'react'; import { StandardProps } from '..'; -export interface CardMediaProps +export interface CardMediaProps extends StandardProps, CardMediaClassKey> { - component?: React.ReactType; + component?: React.ReactType; image?: string; src?: string; } export type CardMediaClassKey = 'root' | 'media'; -declare const CardMedia: React.ComponentType; +declare class CardMedia extends React.Component> {} export default CardMedia; diff --git a/packages/material-ui/src/Checkbox/Checkbox.d.ts b/packages/material-ui/src/Checkbox/Checkbox.d.ts index 5dbe9824adcdd6..f92510715628c6 100644 --- a/packages/material-ui/src/Checkbox/Checkbox.d.ts +++ b/packages/material-ui/src/Checkbox/Checkbox.d.ts @@ -2,8 +2,8 @@ import * as React from 'react'; import { StandardProps } from '..'; import { SwitchBaseProps, SwitchBaseClassKey } from '../internal/SwitchBase'; -export interface CheckboxProps - extends StandardProps { +export interface CheckboxProps + extends StandardProps, CheckboxClassKey, 'checkedIcon' | 'color' | 'icon'> { checkedIcon?: React.ReactNode; color?: 'primary' | 'secondary' | 'default'; icon?: React.ReactNode; @@ -11,6 +11,6 @@ export interface CheckboxProps export type CheckboxClassKey = SwitchBaseClassKey | 'colorPrimary' | 'colorSecondary'; -declare const Checkbox: React.ComponentType; +declare class Checkbox extends React.Component> {} export default Checkbox; diff --git a/packages/material-ui/src/Chip/Chip.d.ts b/packages/material-ui/src/Chip/Chip.d.ts index a7c5698fb4a62c..394110e7acdd01 100644 --- a/packages/material-ui/src/Chip/Chip.d.ts +++ b/packages/material-ui/src/Chip/Chip.d.ts @@ -1,11 +1,11 @@ import * as React from 'react'; import { StandardProps } from '..'; -export interface ChipProps +export interface ChipProps extends StandardProps, ChipClassKey> { avatar?: React.ReactElement; clickable?: boolean; - component?: React.ReactType; + component?: React.ReactType; deleteIcon?: React.ReactElement; label?: React.ReactNode; onDelete?: React.EventHandler; @@ -21,6 +21,6 @@ export type ChipClassKey = | 'label' | 'deleteIcon'; -declare const Chip: React.ComponentType; +declare class Chip extends React.Component> {} export default Chip; diff --git a/packages/material-ui/src/Collapse/Collapse.d.ts b/packages/material-ui/src/Collapse/Collapse.d.ts index 6342f9ab6f25b4..42c40d84029e2f 100644 --- a/packages/material-ui/src/Collapse/Collapse.d.ts +++ b/packages/material-ui/src/Collapse/Collapse.d.ts @@ -3,16 +3,17 @@ import { StandardProps } from '..'; import { Theme } from '../styles/createMuiTheme'; import { TransitionProps } from '../transitions/transition'; -export interface CollapseProps extends StandardProps { +export interface CollapseProps + extends StandardProps { children?: React.ReactNode; collapsedHeight?: string; - component?: React.ReactType; + component?: React.ReactType; theme?: Theme; timeout?: TransitionProps['timeout'] | 'auto'; } export type CollapseClassKey = 'container' | 'entered'; -declare const Collapse: React.ComponentType; +declare class Collapse extends React.Component> {} export default Collapse; diff --git a/packages/material-ui/src/Dialog/Dialog.d.ts b/packages/material-ui/src/Dialog/Dialog.d.ts index 416749422c0dc2..9f575f7fe2edb3 100644 --- a/packages/material-ui/src/Dialog/Dialog.d.ts +++ b/packages/material-ui/src/Dialog/Dialog.d.ts @@ -1,16 +1,15 @@ import * as React from 'react'; import { StandardProps } from '..'; -import { PaperProps } from '../Paper'; import { ModalProps } from '../Modal'; import { TransitionHandlerProps, TransitionProps } from '../transitions/transition'; -export interface DialogProps +export interface DialogProps extends StandardProps, DialogClassKey, 'children'> { children?: React.ReactNode; fullScreen?: boolean; fullWidth?: boolean; maxWidth?: 'xs' | 'sm' | 'md' | false; - PaperProps?: Partial; + PaperProps?: Partial; scroll?: 'body' | 'paper'; TransitionComponent?: React.ReactType; transitionDuration?: TransitionProps['timeout']; @@ -30,6 +29,6 @@ export type DialogClassKey = | 'paperFullWidth' | 'paperFullScreen'; -declare const Dialog: React.ComponentType; +declare class Dialog extends React.Component> { } export default Dialog; diff --git a/packages/material-ui/src/Divider/Divider.d.ts b/packages/material-ui/src/Divider/Divider.d.ts index a38a8de451bb37..d6048258c13df5 100644 --- a/packages/material-ui/src/Divider/Divider.d.ts +++ b/packages/material-ui/src/Divider/Divider.d.ts @@ -1,16 +1,16 @@ import * as React from 'react'; import { StandardProps } from '..'; -export interface DividerProps +export interface DividerProps extends StandardProps, DividerClassKey> { absolute?: boolean; - component?: React.ReactType; + component?: React.ReactType; inset?: boolean; light?: boolean; } export type DividerClassKey = 'root' | 'absolute' | 'inset' | 'light'; -declare const Divider: React.ComponentType; +declare class Divider extends React.Component> {} export default Divider; diff --git a/packages/material-ui/src/Drawer/Drawer.d.ts b/packages/material-ui/src/Drawer/Drawer.d.ts index 019a424df99549..42c08fade71684 100644 --- a/packages/material-ui/src/Drawer/Drawer.d.ts +++ b/packages/material-ui/src/Drawer/Drawer.d.ts @@ -6,7 +6,7 @@ import { PaperProps } from '../Paper'; import { Theme } from '../styles/createMuiTheme'; import { TransitionHandlerProps, TransitionProps } from '../transitions/transition'; -export interface DrawerProps +export interface DrawerProps extends StandardProps< ModalProps & Partial, DrawerClassKey, @@ -17,7 +17,7 @@ export interface DrawerProps elevation?: number; ModalProps?: Partial; open?: boolean; - PaperProps?: Partial; + PaperProps?: Partial>; SlideProps?: Partial; theme?: Theme; transitionDuration?: TransitionProps['timeout']; @@ -37,6 +37,6 @@ export type DrawerClassKey = | 'paperAnchorDockedBottom' | 'modal'; -declare const Drawer: React.ComponentType; +declare class Drawer extends React.Component> {} export default Drawer; diff --git a/packages/material-ui/src/ExpansionPanel/ExpansionPanel.d.ts b/packages/material-ui/src/ExpansionPanel/ExpansionPanel.d.ts index ff825d6dd6b252..525b1f7fac0458 100644 --- a/packages/material-ui/src/ExpansionPanel/ExpansionPanel.d.ts +++ b/packages/material-ui/src/ExpansionPanel/ExpansionPanel.d.ts @@ -3,9 +3,9 @@ import { StandardProps } from '..'; import { CollapseProps } from '../Collapse'; import { PaperProps } from '../Paper'; -export interface ExpansionPanelProps - extends StandardProps { - CollapseProps?: Partial; +export interface ExpansionPanelProps + extends StandardProps, ExpansionPanelClassKey, 'onChange'> { + CollapseProps?: Partial>; defaultExpanded?: boolean; disabled?: boolean; expanded?: boolean; @@ -14,6 +14,6 @@ export interface ExpansionPanelProps export type ExpansionPanelClassKey = 'root' | 'expanded' | 'disabled'; -declare const ExpansionPanel: React.ComponentType; +declare class ExpansionPanel extends React.Component> {} export default ExpansionPanel; diff --git a/packages/material-ui/src/ExpansionPanelSummary/ExpansionPanelSummary.d.ts b/packages/material-ui/src/ExpansionPanelSummary/ExpansionPanelSummary.d.ts index 922baea5816ce1..2071c92cc155fd 100644 --- a/packages/material-ui/src/ExpansionPanelSummary/ExpansionPanelSummary.d.ts +++ b/packages/material-ui/src/ExpansionPanelSummary/ExpansionPanelSummary.d.ts @@ -2,8 +2,8 @@ import * as React from 'react'; import { StandardProps } from '..'; import { ButtonBaseProps } from '../ButtonBase'; -export interface ExpansionPanelSummaryProps - extends StandardProps { +export interface ExpansionPanelSummaryProps + extends StandardProps, ExpansionPanelSummaryClassKey> { disabled?: boolean; expanded?: boolean; expandIcon?: React.ReactNode; @@ -18,6 +18,6 @@ export type ExpansionPanelSummaryClassKey = | 'content' | 'expandIcon'; -declare const ExpansionPanelSummary: React.ComponentType; +declare class ExpansionPanelSummary extends React.Component> {} export default ExpansionPanelSummary; diff --git a/packages/material-ui/src/FormControl/FormControl.d.ts b/packages/material-ui/src/FormControl/FormControl.d.ts index 2815a0c5c728fe..1d15ffeb94233a 100644 --- a/packages/material-ui/src/FormControl/FormControl.d.ts +++ b/packages/material-ui/src/FormControl/FormControl.d.ts @@ -1,9 +1,9 @@ import * as React from 'react'; import { StandardProps, PropTypes } from '..'; -export interface FormControlProps +export interface FormControlProps extends StandardProps, FormControlClassKey> { - component?: React.ReactType; + component?: React.ReactType; disabled?: boolean; error?: boolean; fullWidth?: boolean; @@ -15,6 +15,6 @@ export interface FormControlProps export type FormControlClassKey = 'root' | 'marginNormal' | 'marginDense' | 'fullWidth'; -declare const FormControl: React.ComponentType; +declare class FormControl extends React.Component> {} export default FormControl; diff --git a/packages/material-ui/src/FormHelperText/FormHelperText.d.ts b/packages/material-ui/src/FormHelperText/FormHelperText.d.ts index 4ceeff56f64051..bc293d62d2f134 100644 --- a/packages/material-ui/src/FormHelperText/FormHelperText.d.ts +++ b/packages/material-ui/src/FormHelperText/FormHelperText.d.ts @@ -1,16 +1,16 @@ import * as React from 'react'; import { StandardProps } from '..'; -export interface FormHelperTextProps +export interface FormHelperTextProps extends StandardProps, FormHelperTextClassKey> { disabled?: boolean; error?: boolean; - component?: React.ReactType; + component?: React.ReactType; margin?: 'dense'; } export type FormHelperTextClassKey = 'root' | 'error' | 'disabled' | 'marginDense'; -declare const FormHelperText: React.ComponentType; +declare class FormHelperText extends React.Component> {} export default FormHelperText; diff --git a/packages/material-ui/src/FormLabel/FormLabel.d.ts b/packages/material-ui/src/FormLabel/FormLabel.d.ts index f1cdffccdf3573..debd1be9b5bfec 100644 --- a/packages/material-ui/src/FormLabel/FormLabel.d.ts +++ b/packages/material-ui/src/FormLabel/FormLabel.d.ts @@ -1,18 +1,19 @@ import * as React from 'react'; import { StandardProps } from '..'; -export interface FormLabelProps extends StandardProps { - component?: React.ReactType; +export interface FormLabelProps + extends StandardProps, FormLabelClassKey> { + component?: React.ReactType; disabled?: boolean; error?: boolean; focused?: boolean; required?: boolean; } -export type FormLabelBaseProps = React.LabelHTMLAttributes; +export type FormLabelBaseProps = React.LabelHTMLAttributes; export type FormLabelClassKey = 'root' | 'focused' | 'disabled' | 'error' | 'asterisk'; -declare const FormLabel: React.ComponentType; +declare class FormLabel extends React.Component> {} export default FormLabel; diff --git a/packages/material-ui/src/Grid/Grid.d.ts b/packages/material-ui/src/Grid/Grid.d.ts index 24f5b8bd2de4b5..f08078dbb4b1bd 100644 --- a/packages/material-ui/src/Grid/Grid.d.ts +++ b/packages/material-ui/src/Grid/Grid.d.ts @@ -27,7 +27,7 @@ export type GridWrap = 'nowrap' | 'wrap' | 'wrap-reverse'; export type GridSize = 'auto' | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12; -export interface GridProps +export interface GridProps extends StandardProps< React.HTMLAttributes & Partial>, GridClassKey, @@ -35,7 +35,7 @@ export interface GridProps > { alignContent?: GridContentAlignment; alignItems?: GridItemsAlignment; - component?: string | React.ComponentType>; + component?: string | React.ComponentType, StrippedProps>>; container?: boolean; direction?: GridDirection; item?: boolean; @@ -85,7 +85,7 @@ export type GridClassKey = | 'grid-xs-11' | 'grid-xs-12'; -declare const Grid: React.ComponentType; +declare class Grid extends React.Component> {} export default Grid; diff --git a/packages/material-ui/src/GridList/GridList.d.ts b/packages/material-ui/src/GridList/GridList.d.ts index 06f97a8c9b35a8..9bcdda36ec4c4c 100644 --- a/packages/material-ui/src/GridList/GridList.d.ts +++ b/packages/material-ui/src/GridList/GridList.d.ts @@ -1,16 +1,16 @@ import * as React from 'react'; import { StandardProps } from '..'; -export interface GridListProps +export interface GridListProps extends StandardProps, GridListClassKey> { cellHeight?: number | 'auto'; cols?: number; - component?: React.ReactType; + component?: React.ReactType; spacing?: number; } export type GridListClassKey = 'root'; -declare const GridList: React.ComponentType; +declare class GridList extends React.Component> {} export default GridList; diff --git a/packages/material-ui/src/GridListTile/GridListTile.d.ts b/packages/material-ui/src/GridListTile/GridListTile.d.ts index ddd1eab6d0fe18..7f3090174b763f 100644 --- a/packages/material-ui/src/GridListTile/GridListTile.d.ts +++ b/packages/material-ui/src/GridListTile/GridListTile.d.ts @@ -1,15 +1,15 @@ import * as React from 'react'; import { StandardProps } from '..'; -export interface GridListTileProps +export interface GridListTileProps extends StandardProps, GridListTileClassKey> { cols?: number; - component?: React.ReactType; + component?: React.ReactType; rows?: number; } export type GridListTileClassKey = 'root' | 'tile' | 'imgFullHeight' | 'imgFullWidth'; -declare const GridListTile: React.ComponentType; +declare class GridListTile extends React.Component> {} export default GridListTile; diff --git a/packages/material-ui/src/IconButton/IconButton.d.ts b/packages/material-ui/src/IconButton/IconButton.d.ts index a6bd70eaa52536..8b2888502b0c42 100644 --- a/packages/material-ui/src/IconButton/IconButton.d.ts +++ b/packages/material-ui/src/IconButton/IconButton.d.ts @@ -2,7 +2,8 @@ import * as React from 'react'; import { StandardProps, PropTypes } from '..'; import { ButtonBaseProps } from '../ButtonBase'; -export interface IconButtonProps extends StandardProps { +export interface IconButtonProps + extends StandardProps, IconButtonClassKey> { color?: PropTypes.Color; disabled?: boolean; disableRipple?: boolean; @@ -16,6 +17,6 @@ export type IconButtonClassKey = | 'disabled' | 'label'; -declare const IconButton: React.ComponentType; +declare class IconButton extends React.Component> {} export default IconButton; diff --git a/packages/material-ui/src/InputAdornment/InputAdornment.d.ts b/packages/material-ui/src/InputAdornment/InputAdornment.d.ts index 7793ef99be7ea3..27c5ba16aff65d 100644 --- a/packages/material-ui/src/InputAdornment/InputAdornment.d.ts +++ b/packages/material-ui/src/InputAdornment/InputAdornment.d.ts @@ -1,15 +1,15 @@ import * as React from 'react'; import { StandardProps } from '..'; -export interface InputAdornmentProps +export interface InputAdornmentProps extends StandardProps, InputAdornmentClassKey> { - component?: React.ReactType; + component?: React.ReactType; disableTypography?: boolean; position: 'start' | 'end'; } export type InputAdornmentClassKey = 'root' | 'positionStart' | 'positionEnd'; -declare const InputAdornment: React.ComponentType; +declare class InputAdornment extends React.Component> {} export default InputAdornment; diff --git a/packages/material-ui/src/InputLabel/InputLabel.d.ts b/packages/material-ui/src/InputLabel/InputLabel.d.ts index 71e352afd11f9b..2fe5a880f5fb4f 100644 --- a/packages/material-ui/src/InputLabel/InputLabel.d.ts +++ b/packages/material-ui/src/InputLabel/InputLabel.d.ts @@ -3,7 +3,8 @@ import { StandardProps } from '..'; import { FormLabelProps, FormLabelClassKey } from '../FormLabel'; import { ClassNameMap } from '../styles/withStyles'; -export interface InputLabelProps extends StandardProps { +export interface InputLabelProps + extends StandardProps, InputLabelClassKey> { disableAnimation?: boolean; disabled?: boolean; error?: boolean; @@ -15,6 +16,6 @@ export interface InputLabelProps extends StandardProps; +declare class InputLabel extends React.Component> {} export default InputLabel; diff --git a/packages/material-ui/src/List/List.d.ts b/packages/material-ui/src/List/List.d.ts index fa7a1eea302f23..cf8311fdde50e1 100644 --- a/packages/material-ui/src/List/List.d.ts +++ b/packages/material-ui/src/List/List.d.ts @@ -1,9 +1,9 @@ import * as React from 'react'; import { StandardProps } from '..'; -export interface ListProps +export interface ListProps extends StandardProps, ListClassKey> { - component?: React.ReactType; + component?: React.ReactType; dense?: boolean; disablePadding?: boolean; subheader?: React.ReactElement; @@ -11,6 +11,6 @@ export interface ListProps export type ListClassKey = 'root' | 'padding' | 'dense' | 'subheader'; -declare const List: React.ComponentType; +declare class List extends React.Component> {} export default List; diff --git a/packages/material-ui/src/ListItem/ListItem.d.ts b/packages/material-ui/src/ListItem/ListItem.d.ts index 2b7003c07995a1..ac23c0f3eea363 100644 --- a/packages/material-ui/src/ListItem/ListItem.d.ts +++ b/packages/material-ui/src/ListItem/ListItem.d.ts @@ -2,14 +2,14 @@ import * as React from 'react'; import { StandardProps } from '..'; import { ButtonBaseProps } from '../ButtonBase'; -export interface ListItemProps +export interface ListItemProps extends StandardProps< - ButtonBaseProps & React.LiHTMLAttributes, + ButtonBaseProps & React.LiHTMLAttributes, ListItemClassKey, 'component' > { button?: boolean; - component?: React.ReactType; + component?: React.ReactType; ContainerComponent?: React.ReactType>; ContainerProps?: React.HTMLAttributes; dense?: boolean; @@ -31,6 +31,6 @@ export type ListItemClassKey = | 'button' | 'secondaryAction'; -declare const ListItem: React.ComponentType; +declare class ListItem extends React.Component> {} export default ListItem; diff --git a/packages/material-ui/src/ListSubheader/ListSubheader.d.ts b/packages/material-ui/src/ListSubheader/ListSubheader.d.ts index 5b9d110d69c996..7b3b38a614fc73 100644 --- a/packages/material-ui/src/ListSubheader/ListSubheader.d.ts +++ b/packages/material-ui/src/ListSubheader/ListSubheader.d.ts @@ -1,9 +1,9 @@ import * as React from 'react'; import { StandardProps } from '..'; -export interface ListSubheaderProps +export interface ListSubheaderProps extends StandardProps, ListSubheaderClassKey> { - component?: React.ReactType; + component?: React.ReactType; color?: 'default' | 'primary' | 'inherit'; inset?: boolean; disableSticky?: boolean; @@ -11,6 +11,6 @@ export interface ListSubheaderProps export type ListSubheaderClassKey = 'root' | 'colorPrimary' | 'colorInherit' | 'inset' | 'sticky'; -declare const ListSubheader: React.ComponentType; +declare class ListSubheader extends React.Component> {} export default ListSubheader; diff --git a/packages/material-ui/src/Menu/Menu.d.ts b/packages/material-ui/src/Menu/Menu.d.ts index 493fa207127317..79e0f8138b6d46 100644 --- a/packages/material-ui/src/Menu/Menu.d.ts +++ b/packages/material-ui/src/Menu/Menu.d.ts @@ -1,23 +1,23 @@ import * as React from 'react'; -import { PopoverProps, PopoverClassKey } from '../Popover'; +import { StandardProps } from '..'; import { MenuListProps } from '../MenuList'; import { PaperProps } from '../Paper'; -import { StandardProps } from '..'; -import { TransitionHandlerProps, TransitionProps } from '../transitions/transition'; +import { PopoverClassKey, PopoverProps } from '../Popover'; import { ClassNameMap } from '../styles/withStyles'; +import { TransitionHandlerProps, TransitionProps } from '../transitions/transition'; -export interface MenuProps - extends StandardProps, MenuClassKey> { +export interface MenuProps + extends StandardProps & Partial, MenuClassKey> { anchorEl?: HTMLElement; disableAutoFocusItem?: boolean; - MenuListProps?: Partial; - PaperProps?: Partial; + MenuListProps?: Partial>; + PaperProps?: Partial; PopoverClasses?: Partial>; transitionDuration?: TransitionProps['timeout'] | 'auto'; } export type MenuClassKey = 'paper'; -declare const Menu: React.ComponentType; +declare class Menu extends React.Component> { } export default Menu; diff --git a/packages/material-ui/src/MenuItem/MenuItem.d.ts b/packages/material-ui/src/MenuItem/MenuItem.d.ts index e97ce7c9c96201..bbc3e8cd3b995e 100644 --- a/packages/material-ui/src/MenuItem/MenuItem.d.ts +++ b/packages/material-ui/src/MenuItem/MenuItem.d.ts @@ -2,14 +2,14 @@ import * as React from 'react'; import { StandardProps } from '..'; import { ListItemProps } from '../ListItem'; -export interface MenuItemProps extends StandardProps { - component?: React.ReactType; +export interface MenuItemProps extends StandardProps, MenuItemClassKey> { + component?: React.ReactType; role?: string; selected?: boolean; } export type MenuItemClassKey = 'root' | 'selected'; -declare const MenuItem: React.ComponentType; +declare class MenuItem extends React.Component> {} export default MenuItem; diff --git a/packages/material-ui/src/MenuList/MenuList.d.ts b/packages/material-ui/src/MenuList/MenuList.d.ts index 61bc56f472203a..fd69775c25fecb 100644 --- a/packages/material-ui/src/MenuList/MenuList.d.ts +++ b/packages/material-ui/src/MenuList/MenuList.d.ts @@ -2,12 +2,13 @@ import * as React from 'react'; import { StandardProps } from '..'; import { ListProps, ListClassKey } from '../List'; -export interface MenuListProps extends StandardProps { +export interface MenuListProps + extends StandardProps, MenuListClassKey, 'onKeyDown'> { onKeyDown?: React.ReactEventHandler>; } export type MenuListClassKey = ListClassKey; -declare const MenuList: React.ComponentType; +declare class MenuList extends React.Component> {} export default MenuList; diff --git a/packages/material-ui/src/MobileStepper/MobileStepper.d.ts b/packages/material-ui/src/MobileStepper/MobileStepper.d.ts index a6391594a91a3d..d713b7e43bbdfa 100644 --- a/packages/material-ui/src/MobileStepper/MobileStepper.d.ts +++ b/packages/material-ui/src/MobileStepper/MobileStepper.d.ts @@ -3,7 +3,8 @@ import { StandardProps } from '..'; import { PaperProps } from '../Paper'; import { ButtonProps } from '../Button'; -export interface MobileStepperProps extends StandardProps { +export interface MobileStepperProps + extends StandardProps, MobileStepperClassKey> { activeStep?: number; backButton: React.ReactElement; nextButton: React.ReactElement; @@ -22,6 +23,6 @@ export type MobileStepperClassKey = | 'dotActive' | 'progress'; -declare const MobileStepper: React.ComponentType; +declare class MobileStepper extends React.Component> {} export default MobileStepper; diff --git a/packages/material-ui/src/Paper/Paper.d.ts b/packages/material-ui/src/Paper/Paper.d.ts index c24d4816a14163..4c15f175000cb7 100644 --- a/packages/material-ui/src/Paper/Paper.d.ts +++ b/packages/material-ui/src/Paper/Paper.d.ts @@ -1,9 +1,9 @@ import * as React from 'react'; import { StandardProps } from '..'; -export interface PaperProps +export interface PaperProps extends StandardProps, PaperClassKey> { - component?: React.ReactType; + component?: React.ReactType; elevation?: number; square?: boolean; } @@ -37,6 +37,6 @@ export type PaperClassKey = | 'elevation23' | 'elevation24'; -declare const Paper: React.ComponentType; +declare class Paper extends React.Component> {} export default Paper; diff --git a/packages/material-ui/src/Popover/Popover.d.ts b/packages/material-ui/src/Popover/Popover.d.ts index 813e4599214fd5..58cd1260c92fbc 100644 --- a/packages/material-ui/src/Popover/Popover.d.ts +++ b/packages/material-ui/src/Popover/Popover.d.ts @@ -16,7 +16,7 @@ export interface PopoverPosition { export type PopoverReference = 'anchorEl' | 'anchorPosition' | 'none'; -export interface PopoverProps +export interface PopoverProps extends StandardProps, PopoverClassKey, 'children'> { action?: (actions: PopoverActions) => void; anchorEl?: HTMLElement | ((element: HTMLElement) => HTMLElement); @@ -28,7 +28,7 @@ export interface PopoverProps getContentAnchorEl?: (element: HTMLElement) => HTMLElement; marginThreshold?: number; modal?: boolean; - PaperProps?: Partial; + PaperProps?: Partial>; role?: string; transformOrigin?: PopoverOrigin; TransitionComponent?: React.ReactType; @@ -42,6 +42,6 @@ export interface PopoverActions { updatePosition(): void; } -declare const Popover: React.ComponentType; +declare class Popover extends React.Component> {} export default Popover; diff --git a/packages/material-ui/src/Radio/Radio.d.ts b/packages/material-ui/src/Radio/Radio.d.ts index be2d98a50a6469..495e4eaca7038a 100644 --- a/packages/material-ui/src/Radio/Radio.d.ts +++ b/packages/material-ui/src/Radio/Radio.d.ts @@ -2,8 +2,8 @@ import * as React from 'react'; import { StandardProps } from '..'; import { SwitchBaseProps, SwitchBaseClassKey } from '../internal/SwitchBase'; -export interface RadioProps - extends StandardProps { +export interface RadioProps + extends StandardProps, RadioClassKey, 'checkedIcon' | 'color' | 'icon'> { checkedIcon?: React.ReactNode; color?: 'primary' | 'secondary' | 'default'; icon?: React.ReactNode; @@ -11,6 +11,6 @@ export interface RadioProps export type RadioClassKey = SwitchBaseClassKey | 'colorPrimary' | 'colorSecondary'; -declare const Radio: React.ComponentType; +declare class Radio extends React.Component> {} export default Radio; diff --git a/packages/material-ui/src/Select/Select.d.ts b/packages/material-ui/src/Select/Select.d.ts index 260e9f8c850adb..693b8dddbe49a3 100644 --- a/packages/material-ui/src/Select/Select.d.ts +++ b/packages/material-ui/src/Select/Select.d.ts @@ -4,26 +4,26 @@ import { InputProps } from '../Input'; import { MenuProps } from '../Menu'; import { SelectInputProps } from './SelectInput'; -export interface SelectProps +export interface SelectProps extends StandardProps, - Pick { + Pick, 'onChange'> { autoWidth?: boolean; displayEmpty?: boolean; IconComponent?: React.ReactType; input?: React.ReactNode; - MenuProps?: Partial; + MenuProps?: Partial>; multiple?: boolean; native?: boolean; onClose?: (event: React.ChangeEvent<{}>) => void; onOpen?: (event: React.ChangeEvent<{}>) => void; open?: boolean; - renderValue?: (value: SelectProps['value']) => React.ReactNode; + renderValue?: (value: C & SelectProps['value']) => React.ReactNode; SelectDisplayProps?: React.HTMLAttributes; value?: Array | string | number; } export type SelectClassKey = 'root' | 'select' | 'selectMenu' | 'disabled' | 'icon'; -declare const Select: React.ComponentType; +declare class Select extends React.Component> {} export default Select; diff --git a/packages/material-ui/src/Select/SelectInput.d.ts b/packages/material-ui/src/Select/SelectInput.d.ts index 19f60bb2254126..8ee033a7b33e77 100644 --- a/packages/material-ui/src/Select/SelectInput.d.ts +++ b/packages/material-ui/src/Select/SelectInput.d.ts @@ -1,15 +1,15 @@ import * as React from 'react'; import { MenuProps } from '../Menu'; -export interface SelectInputProps { +export interface SelectInputProps { autoFocus?: boolean; autoWidth: boolean; disabled?: boolean; IconComponent?: React.ReactType; inputRef?: ( - ref: HTMLSelectElement | { node: HTMLInputElement; value: SelectInputProps['value'] }, + ref: HTMLSelectElement | { node: HTMLInputElement; value: C & SelectInputProps['value'] }, ) => void; - MenuProps?: Partial; + MenuProps?: Partial>; multiple: boolean; name?: string; native: boolean; @@ -20,12 +20,12 @@ export interface SelectInputProps { onOpen?: (event: React.ChangeEvent<{}>) => void; open?: boolean; readOnly?: boolean; - renderValue?: (value: SelectInputProps['value']) => React.ReactNode; + renderValue?: (value: C & SelectInputProps['value']) => React.ReactNode; SelectDisplayProps?: React.HTMLAttributes; tabIndex?: number; value?: string | number | Array; } -declare const SelectInput: React.ComponentType; +declare class SelectInput extends React.Component> {} export default SelectInput; diff --git a/packages/material-ui/src/Snackbar/Snackbar.d.ts b/packages/material-ui/src/Snackbar/Snackbar.d.ts index 7a04af6bc1ee21..95febc09e668bc 100644 --- a/packages/material-ui/src/Snackbar/Snackbar.d.ts +++ b/packages/material-ui/src/Snackbar/Snackbar.d.ts @@ -8,7 +8,7 @@ export type SnackBarOrigin = { vertical?: 'top' | 'center' | 'bottom' | number; }; -export interface SnackbarProps +export interface SnackbarProps extends StandardProps< React.HTMLAttributes & Partial, SnackbarClassKey @@ -16,7 +16,7 @@ export interface SnackbarProps action?: React.ReactElement | React.ReactElement[]; anchorOrigin?: SnackBarOrigin; autoHideDuration?: number; - ContentProps?: Partial; + ContentProps?: Partial>; disableWindowBlurListener?: boolean; message?: React.ReactElement; onClose?: (event: React.SyntheticEvent, reason: string) => void; @@ -38,6 +38,6 @@ export type SnackbarClassKey = | 'anchorOriginTopLeft' | 'anchorOriginBottomLeft'; -declare const Snackbar: React.ComponentType; +declare class Snackbar extends React.Component> {} export default Snackbar; diff --git a/packages/material-ui/src/SnackbarContent/SnackbarContent.d.ts b/packages/material-ui/src/SnackbarContent/SnackbarContent.d.ts index 21a9f27eb2991c..715d8e77c3d23a 100644 --- a/packages/material-ui/src/SnackbarContent/SnackbarContent.d.ts +++ b/packages/material-ui/src/SnackbarContent/SnackbarContent.d.ts @@ -2,13 +2,14 @@ import * as React from 'react'; import { StandardProps } from '..'; import { PaperProps } from '../Paper'; -export interface SnackbarContentProps extends StandardProps { +export interface SnackbarContentProps + extends StandardProps, SnackbarContentClassKey> { action?: React.ReactElement; message: React.ReactElement | string; } export type SnackbarContentClassKey = 'root' | 'message' | 'action'; -declare const SnackbarContent: React.ComponentType; +declare class SnackbarContent extends React.Component> {} export default SnackbarContent; diff --git a/packages/material-ui/src/StepButton/StepButton.d.ts b/packages/material-ui/src/StepButton/StepButton.d.ts index ad6985c4d25130..e883ac3f55a608 100644 --- a/packages/material-ui/src/StepButton/StepButton.d.ts +++ b/packages/material-ui/src/StepButton/StepButton.d.ts @@ -5,7 +5,8 @@ import { ButtonBaseProps } from '../ButtonBase'; export type StepButtonIcon = React.ReactElement | string | number | null; -export interface StepButtonProps extends StandardProps { +export interface StepButtonProps + extends StandardProps, StepButtonClasskey> { active?: boolean; alternativeLabel?: boolean; completed?: boolean; @@ -18,6 +19,6 @@ export interface StepButtonProps extends StandardProps; +declare class StepButton extends React.Component> {} export default StepButton; diff --git a/packages/material-ui/src/Stepper/Stepper.d.ts b/packages/material-ui/src/Stepper/Stepper.d.ts index 0e149787853aa8..344e5171ab1a8d 100644 --- a/packages/material-ui/src/Stepper/Stepper.d.ts +++ b/packages/material-ui/src/Stepper/Stepper.d.ts @@ -4,7 +4,7 @@ import { PaperProps } from '../Paper'; export type Orientation = 'horizontal' | 'vertical'; -export interface StepperProps extends StandardProps { +export interface StepperProps extends StandardProps, StepperClasskey> { activeStep?: number; alternativeLabel?: boolean; children: React.ReactNode; @@ -15,6 +15,6 @@ export interface StepperProps extends StandardProps export type StepperClasskey = 'root' | 'horizontal' | 'vertical' | 'alternativeLabel'; -declare const Stepper: React.ComponentType; +declare class Stepper extends React.Component> {} export default Stepper; diff --git a/packages/material-ui/src/SwipeableDrawer/SwipeableDrawer.d.ts b/packages/material-ui/src/SwipeableDrawer/SwipeableDrawer.d.ts index 8f84a143182fe2..efd9634f3944f7 100644 --- a/packages/material-ui/src/SwipeableDrawer/SwipeableDrawer.d.ts +++ b/packages/material-ui/src/SwipeableDrawer/SwipeableDrawer.d.ts @@ -2,7 +2,7 @@ import * as React from 'react'; import { Omit } from '..'; import { DrawerProps } from '../Drawer'; -export interface SwipeableDrawerProps extends Omit { +export interface SwipeableDrawerProps extends Omit, 'onClose' | 'open'> { disableBackdropTransition?: boolean; disableDiscovery?: boolean; disableSwipeToOpen?: boolean; @@ -12,6 +12,6 @@ export interface SwipeableDrawerProps extends Omit; +declare class SwipeableDrawer extends React.Component> {} export default SwipeableDrawer; diff --git a/packages/material-ui/src/Switch/Switch.d.ts b/packages/material-ui/src/Switch/Switch.d.ts index dd2d4475fb25ca..bbfccc7ff0a2f7 100644 --- a/packages/material-ui/src/Switch/Switch.d.ts +++ b/packages/material-ui/src/Switch/Switch.d.ts @@ -2,8 +2,8 @@ import * as React from 'react'; import { StandardProps } from '..'; import { SwitchBaseProps, SwitchBaseClassKey } from '../internal/SwitchBase'; -export interface SwitchProps - extends StandardProps { +export interface SwitchProps + extends StandardProps, SwitchClassKey, 'checkedIcon' | 'color' | 'icon'> { checkedIcon?: React.ReactNode; color?: 'primary' | 'secondary' | 'default'; icon?: React.ReactNode; @@ -18,6 +18,6 @@ export type SwitchClassKey = | 'colorPrimary' | 'colorSecondary'; -declare const Switch: React.ComponentType; +declare class Switch extends React.Component> {} export default Switch; diff --git a/packages/material-ui/src/Tab/Tab.d.ts b/packages/material-ui/src/Tab/Tab.d.ts index fb9cb6115e19e7..0489a1d4054788 100644 --- a/packages/material-ui/src/Tab/Tab.d.ts +++ b/packages/material-ui/src/Tab/Tab.d.ts @@ -2,7 +2,8 @@ import * as React from 'react'; import { StandardProps } from '..'; import { ButtonBaseProps } from '../ButtonBase'; -export interface TabProps extends StandardProps { +export interface TabProps + extends StandardProps, TabClassKey, 'onChange'> { disabled?: boolean; fullWidth?: boolean; icon?: string | React.ReactElement; @@ -29,6 +30,6 @@ export type TabClassKey = | 'label' | 'labelWrapped'; -declare const Tab: React.ComponentType; +declare class Tab extends React.Component> {} export default Tab; diff --git a/packages/material-ui/src/Table/Table.d.ts b/packages/material-ui/src/Table/Table.d.ts index c35b7d615ce7e2..3a4aa289569812 100644 --- a/packages/material-ui/src/Table/Table.d.ts +++ b/packages/material-ui/src/Table/Table.d.ts @@ -1,14 +1,14 @@ import * as React from 'react'; import { StandardProps } from '..'; -export interface TableProps extends StandardProps { - component?: React.ReactType; +export interface TableProps extends StandardProps, TableClassKey> { + component?: React.ReactType>; } -export type TableBaseProps = React.TableHTMLAttributes; +export type TableBaseProps = React.TableHTMLAttributes; export type TableClassKey = 'root'; -declare const Table: React.ComponentType; +declare class Table extends React.Component> {} export default Table; diff --git a/packages/material-ui/src/TableBody/TableBody.d.ts b/packages/material-ui/src/TableBody/TableBody.d.ts index db31de65598845..db94963918ca80 100644 --- a/packages/material-ui/src/TableBody/TableBody.d.ts +++ b/packages/material-ui/src/TableBody/TableBody.d.ts @@ -1,14 +1,14 @@ import * as React from 'react'; import { StandardProps } from '..'; -export interface TableBodyProps extends StandardProps { - component?: React.ReactType; +export interface TableBodyProps extends StandardProps, TableBodyClassKey> { + component?: React.ReactType>; } export type TableBodyClassKey = 'root'; -export type TableBodyBaseProps = React.HTMLAttributes; +export type TableBodyBaseProps = React.HTMLAttributes; -declare const TableBody: React.ComponentType; +declare class TableBody extends React.Component> {} export default TableBody; diff --git a/packages/material-ui/src/TableCell/TableCell.d.ts b/packages/material-ui/src/TableCell/TableCell.d.ts index 51b16bb02d5981..4228d794a1c7ba 100644 --- a/packages/material-ui/src/TableCell/TableCell.d.ts +++ b/packages/material-ui/src/TableCell/TableCell.d.ts @@ -9,16 +9,17 @@ import { StandardProps } from '..'; * Since it is not decided via prop, we have create loose typings * here. */ -export interface TableCellProps extends StandardProps { - component?: React.ReactType; +export interface TableCellProps + extends StandardProps, TableCellClassKey> { + component?: React.ReactType>; numeric?: boolean; padding?: Padding; sortDirection?: SortDirection; variant?: 'head' | 'body' | 'footer'; } -export type TableCellBaseProps = React.ThHTMLAttributes & - React.TdHTMLAttributes; +export type TableCellBaseProps = React.ThHTMLAttributes & + React.TdHTMLAttributes; export type Padding = 'default' | 'checkbox' | 'dense' | 'none'; @@ -34,6 +35,6 @@ export type TableCellClassKey = | 'paddingCheckbox' | 'paddingNone'; -declare const TableCell: React.ComponentType; +declare class TableCell extends React.Component> {} export default TableCell; diff --git a/packages/material-ui/src/TableFooter/TableFooter.d.ts b/packages/material-ui/src/TableFooter/TableFooter.d.ts index 853fe875ad9424..e6320798ba17be 100644 --- a/packages/material-ui/src/TableFooter/TableFooter.d.ts +++ b/packages/material-ui/src/TableFooter/TableFooter.d.ts @@ -1,14 +1,15 @@ import * as React from 'react'; import { StandardProps } from '..'; -export interface TableFooterProps extends StandardProps { - component?: React.ReactType; +export interface TableFooterProps + extends StandardProps, TableFooterClassKey> { + component?: React.ReactType>; } export type TableFooterClassKey = 'root'; -export type TableFooterBaseProps = React.HTMLAttributes; +export type TableFooterBaseProps = React.HTMLAttributes; -declare const TableFooter: React.ComponentType; +declare class TableFooter extends React.Component> {} export default TableFooter; diff --git a/packages/material-ui/src/TableHead/TableHead.d.ts b/packages/material-ui/src/TableHead/TableHead.d.ts index 8dac1cb2fc2899..2cddc3ddfc7ce0 100644 --- a/packages/material-ui/src/TableHead/TableHead.d.ts +++ b/packages/material-ui/src/TableHead/TableHead.d.ts @@ -1,14 +1,14 @@ import * as React from 'react'; import { StandardProps } from '..'; -export interface TableHeadProps extends StandardProps { - component?: React.ReactType; +export interface TableHeadProps extends StandardProps, TableHeadClassKey> { + component?: React.ReactType>; } export type TableHeadClassKey = 'root'; -export type TableHeadBaseProps = React.HTMLAttributes; +export type TableHeadBaseProps = React.HTMLAttributes; -declare const TableHead: React.ComponentType; +declare class TableHead extends React.Component> {} export default TableHead; diff --git a/packages/material-ui/src/TablePagination/TablePagination.d.ts b/packages/material-ui/src/TablePagination/TablePagination.d.ts index bb4b6f5f1dcff1..9ca2a8e23fc0d6 100644 --- a/packages/material-ui/src/TablePagination/TablePagination.d.ts +++ b/packages/material-ui/src/TablePagination/TablePagination.d.ts @@ -11,24 +11,24 @@ export interface LabelDisplayedRowsArgs { page: number; } -export interface TablePaginationProps - extends StandardProps { - ActionsComponent?: React.ReactType; - backIconButtonProps?: Partial; - component?: React.ReactType; +export interface TablePaginationProps + extends StandardProps, TablePaginationClassKey> { + ActionsComponent?: React.ReactType>; + backIconButtonProps?: Partial>; + component?: React.ReactType>; count: number; labelDisplayedRows?: (paginationInfo: LabelDisplayedRowsArgs) => React.ReactNode; labelRowsPerPage?: React.ReactNode; - nextIconButtonProps?: Partial; + nextIconButtonProps?: Partial>; onChangePage: (event: React.MouseEvent | null, page: number) => void; onChangeRowsPerPage?: React.ChangeEventHandler; page: number; rowsPerPage: number; rowsPerPageOptions?: number[]; - SelectProps?: Partial; + SelectProps?: Partial>; } -export type TablePaginationBaseProps = TableCellProps; +export type TablePaginationBaseProps = TableCellProps; export type TablePaginationClassKey = | 'root' @@ -41,6 +41,6 @@ export type TablePaginationClassKey = | 'select' | 'actions'; -declare const TablePagination: React.ComponentType; +declare class TablePagination extends React.Component> {} export default TablePagination; diff --git a/packages/material-ui/src/TablePaginationActions/TablePaginationActions.d.ts b/packages/material-ui/src/TablePaginationActions/TablePaginationActions.d.ts index 4ae44795bb96ed..a44867f61e4e7f 100644 --- a/packages/material-ui/src/TablePaginationActions/TablePaginationActions.d.ts +++ b/packages/material-ui/src/TablePaginationActions/TablePaginationActions.d.ts @@ -2,15 +2,15 @@ import * as React from 'react'; import { StandardProps } from '..'; import { IconButtonProps } from '../IconButton/IconButton'; -export interface TablePaginationActionsProps extends React.HTMLAttributes { - backIconButtonProps?: Partial; +export interface TablePaginationActionsProps extends React.HTMLAttributes { + backIconButtonProps?: Partial>; count: number; - nextIconButtonProps?: Partial; + nextIconButtonProps?: Partial>; onChangePage: (event: React.MouseEvent | null, page: number) => void; page: number; rowsPerPage: number; } -declare const TablePaginationActions: React.ComponentType; +declare class TablePaginationActions extends React.Component> {} export default TablePaginationActions; diff --git a/packages/material-ui/src/TableRow/TableRow.d.ts b/packages/material-ui/src/TableRow/TableRow.d.ts index 30a5c2c1c82982..a3d9bbf561db47 100644 --- a/packages/material-ui/src/TableRow/TableRow.d.ts +++ b/packages/material-ui/src/TableRow/TableRow.d.ts @@ -1,8 +1,8 @@ import * as React from 'react'; import { StandardProps } from '..'; -export interface TableRowProps extends StandardProps { - component?: React.ReactType; +export interface TableRowProps extends StandardProps { + component?: React.ReactType; hover?: boolean; selected?: boolean; } @@ -11,6 +11,6 @@ export type TableRowBaseProps = React.HTMLAttributes; export type TableRowClassKey = 'root' | 'selected' | 'hover' | 'head' | 'footer'; -declare const TableRow: React.ComponentType; +declare class TableRow extends React.Component> {} export default TableRow; diff --git a/packages/material-ui/src/TableSortLabel/TableSortLabel.d.ts b/packages/material-ui/src/TableSortLabel/TableSortLabel.d.ts index 068240183d5327..1c336a68ca4e51 100644 --- a/packages/material-ui/src/TableSortLabel/TableSortLabel.d.ts +++ b/packages/material-ui/src/TableSortLabel/TableSortLabel.d.ts @@ -2,8 +2,8 @@ import * as React from 'react'; import { StandardProps } from '..'; import { ButtonBaseProps } from '../ButtonBase'; -export interface TableSortLabelProps - extends StandardProps { +export interface TableSortLabelProps + extends StandardProps, TableSortLabelClassKey> { active?: boolean; direction?: 'asc' | 'desc'; } @@ -15,6 +15,6 @@ export type TableSortLabelClassKey = | 'iconDirectionDesc' | 'iconDirectionAsc'; -declare const TableSortLabel: React.ComponentType; +declare class TableSortLabel extends React.Component> {} export default TableSortLabel; diff --git a/packages/material-ui/src/Tabs/TabScrollButton.d.ts b/packages/material-ui/src/Tabs/TabScrollButton.d.ts index f7b3c766141fc3..28b722500b6567 100644 --- a/packages/material-ui/src/Tabs/TabScrollButton.d.ts +++ b/packages/material-ui/src/Tabs/TabScrollButton.d.ts @@ -1,14 +1,15 @@ +import * as React from 'react'; import { StandardProps } from '..'; import { ButtonBaseProps } from '../ButtonBase/ButtonBase'; -export interface TabScrollButtonProps - extends StandardProps { +export interface TabScrollButtonProps + extends StandardProps, TabScrollButtonClassKey> { direction?: 'left' | 'right'; visible?: boolean; } export type TabScrollButtonClassKey = 'root'; -declare const TabScrollButton: React.ComponentType; +declare class TabScrollButton extends React.Component> {} export default TabScrollButton; diff --git a/packages/material-ui/src/Tabs/Tabs.d.ts b/packages/material-ui/src/Tabs/Tabs.d.ts index 31e6dc685047f9..ba7a40b2f20526 100644 --- a/packages/material-ui/src/Tabs/Tabs.d.ts +++ b/packages/material-ui/src/Tabs/Tabs.d.ts @@ -3,12 +3,12 @@ import { StandardProps } from '..'; import { ButtonBaseProps } from '../ButtonBase/ButtonBase'; import { TabIndicatorProps } from './TabIndicator'; -export interface TabsProps - extends StandardProps { +export interface TabsProps + extends StandardProps, TabsClassKey, 'onChange' | 'action' | 'component'> { action?: (actions: TabsActions) => void; centered?: boolean; children?: React.ReactNode; - component?: React.ReactType; + component?: React.ReactType>; fullWidth?: boolean; indicatorColor?: 'secondary' | 'primary' | string; onChange?: (event: React.ChangeEvent<{}>, value: any) => void; @@ -36,6 +36,6 @@ export interface TabsActions { updateIndicator(): void; } -declare const Tabs: React.ComponentType; +declare class Tabs extends React.Component> {} export default Tabs; diff --git a/packages/material-ui/src/TextField/TextField.d.ts b/packages/material-ui/src/TextField/TextField.d.ts index d31b3e1e24a627..4df1c52759b149 100644 --- a/packages/material-ui/src/TextField/TextField.d.ts +++ b/packages/material-ui/src/TextField/TextField.d.ts @@ -7,19 +7,19 @@ import { InputLabelProps } from '../InputLabel'; import { FormControlClassKey } from '../FormControl'; import { SelectProps } from '../Select'; -export interface TextFieldProps - extends StandardProps { +export interface TextFieldProps + extends StandardProps, TextFieldClassKey, 'onChange' | 'defaultValue'> { autoComplete?: string; autoFocus?: boolean; children?: React.ReactNode; defaultValue?: string | number; disabled?: boolean; error?: boolean; - FormHelperTextProps?: Partial; + FormHelperTextProps?: Partial>; fullWidth?: boolean; helperText?: React.ReactNode; id?: string; - InputLabelProps?: Partial; + InputLabelProps?: Partial>; InputProps?: Partial; inputProps?: InputProps['inputProps']; inputRef?: React.Ref | React.RefObject; @@ -33,13 +33,13 @@ export interface TextFieldProps rows?: string | number; rowsMax?: string | number; select?: boolean; - SelectProps?: Partial; + SelectProps?: Partial>; type?: string; value?: Array | string | number; } export type TextFieldClassKey = FormControlClassKey; -declare const TextField: React.ComponentType; +declare class TextField extends React.Component> {} export default TextField; diff --git a/packages/material-ui/src/Typography/Typography.d.ts b/packages/material-ui/src/Typography/Typography.d.ts index 64f0d6deda4dc2..b136dc7b79531e 100644 --- a/packages/material-ui/src/Typography/Typography.d.ts +++ b/packages/material-ui/src/Typography/Typography.d.ts @@ -2,11 +2,11 @@ import * as React from 'react'; import { StandardProps, PropTypes } from '..'; import { Style, TextStyle } from '../styles/createTypography'; -export interface TypographyProps +export interface TypographyProps extends StandardProps, TypographyClassKey> { align?: PropTypes.Alignment; color?: PropTypes.Color | 'textSecondary' | 'error'; - component?: React.ReactType; + component?: React.ReactType; gutterBottom?: boolean; headlineMapping?: { [type in TextStyle]: string }; noWrap?: boolean; @@ -38,6 +38,6 @@ export type TypographyClassKey = | 'colorSecondary' | 'colorTextSecondary'; -declare const Typography: React.ComponentType; +declare class Typography extends React.Component> {} export default Typography; diff --git a/packages/material-ui/src/index.d.ts b/packages/material-ui/src/index.d.ts index 16d32dd7c499be..6cf2f77e52327a 100644 --- a/packages/material-ui/src/index.d.ts +++ b/packages/material-ui/src/index.d.ts @@ -2,6 +2,16 @@ import * as React from 'react'; import { StyledComponentProps } from './styles'; export { StyledComponentProps }; +export type AnyComponent = React.ReactType; + +export type PassthruProps = + InferredProps; + +export type InferredProps = + C extends React.ComponentType ? P : + C extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[C] : + {}; + /** * All standard components exposed by `material-ui` are `StyledComponents` with * certain `classes`, on which one can also set a top-level `className` and inline diff --git a/packages/material-ui/src/internal/SwitchBase.d.ts b/packages/material-ui/src/internal/SwitchBase.d.ts index f22c6e4a2b9954..1c1dd9cbb9a690 100644 --- a/packages/material-ui/src/internal/SwitchBase.d.ts +++ b/packages/material-ui/src/internal/SwitchBase.d.ts @@ -2,8 +2,8 @@ import * as React from 'react'; import { StandardProps } from '..'; import { IconButtonProps } from '../IconButton'; -export interface SwitchBaseProps - extends StandardProps { +export interface SwitchBaseProps + extends StandardProps, SwitchBaseClassKey, 'onChange'> { checked?: boolean | string; checkedIcon: React.ReactNode; defaultChecked?: boolean; @@ -22,7 +22,7 @@ export interface SwitchBaseProps export type SwitchBaseClassKey = 'root' | 'checked' | 'disabled' | 'input'; -export type SwitchBase = React.Component; +export type SwitchBase = React.Component>; export interface CreateSwitchBaseOptions { defaultIcon?: React.ReactNode; @@ -30,4 +30,4 @@ export interface CreateSwitchBaseOptions { type?: string; } -export default function createSwitch(options: CreateSwitchBaseOptions): SwitchBase; +export default function createSwitch(options: CreateSwitchBaseOptions): SwitchBase; diff --git a/packages/material-ui/test/typescript/components.spec.tsx b/packages/material-ui/test/typescript/components.spec.tsx index 8c06d84d948e9c..95072b50221a2a 100644 --- a/packages/material-ui/test/typescript/components.spec.tsx +++ b/packages/material-ui/test/typescript/components.spec.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; +import { Link, LinkProps } from 'react-router-dom'; import { AppBar, Avatar, @@ -86,7 +87,20 @@ const AppBarTest = () => ( ); -const AvatarTest = () => ; +const AvatarTest = () => ( +
+ log(e)} alt="Image Alt" src="example.jpg" /> + log(e)} component="button" alt="Image Alt" src="example.jpg" /> +
} + x={3} + // Should NOT be allowed: + // onClick={e => log(e)} + alt="Image Alt" + src="example.jpg" + /> +
+); const AvaterClassName = () => ; @@ -124,6 +138,14 @@ const ButtonTest = () => ( + + + +
); diff --git a/yarn.lock b/yarn.lock index 590db7d09c6ff7..8e347303335647 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1058,6 +1058,10 @@ "@types/minimatch" "*" "@types/node" "*" +"@types/history@*": + version "4.6.2" + resolved "https://registry.yarnpkg.com/@types/history/-/history-4.6.2.tgz#12cfaba693ba20f114ed5765467ff25fdf67ddb0" + "@types/jss@^9.5.3": version "9.5.3" resolved "https://registry.yarnpkg.com/@types/jss/-/jss-9.5.3.tgz#0c106de3fe0b324cd4173fac7dab26c12cda624e" @@ -1073,6 +1077,21 @@ version "10.3.4" resolved "https://registry.yarnpkg.com/@types/node/-/node-10.3.4.tgz#c74e8aec19e555df44609b8057311052a2c84d9e" +"@types/react-router-dom@^4.2.7": + version "4.2.7" + resolved "https://registry.yarnpkg.com/@types/react-router-dom/-/react-router-dom-4.2.7.tgz#9d36bfe175f916dd8d7b6b0237feed6cce376b4c" + dependencies: + "@types/history" "*" + "@types/react" "*" + "@types/react-router" "*" + +"@types/react-router@*": + version "4.0.26" + resolved "https://registry.yarnpkg.com/@types/react-router/-/react-router-4.0.26.tgz#4489c873642baa633014294a6d0a290001ba9860" + dependencies: + "@types/history" "*" + "@types/react" "*" + "@types/react-transition-group@^2.0.8": version "2.0.11" resolved "https://registry.yarnpkg.com/@types/react-transition-group/-/react-transition-group-2.0.11.tgz#feb274676a39383fffaa0dff710958d2251abefb"