Skip to content

Commit

Permalink
[typescript] Make StyledComponent only a type, not a class (#8366)
Browse files Browse the repository at this point in the history
* Make StyledComponent only a type, not a class
* Simplify withStyles overload for SFC
  • Loading branch information
pelotom authored and sebald committed Sep 25, 2017
1 parent dbbcaa6 commit 1a146b8
Show file tree
Hide file tree
Showing 86 changed files with 253 additions and 123 deletions.
4 changes: 3 additions & 1 deletion src/AppBar/AppBar.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ export interface AppBarProps extends PaperProps {
position?: 'static' | 'fixed' | 'absolute';
}

export default class AppBar extends StyledComponent<AppBarProps> {}
declare const AppBar: StyledComponent<AppBarProps>;

export default AppBar;
4 changes: 3 additions & 1 deletion src/Avatar/Avatar.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ export interface AvatarProps extends React.HTMLAttributes<HTMLDivElement> {
srcSet?: string;
}

export default class Avatar extends StyledComponent<AvatarProps> {}
declare const Avatar: StyledComponent<AvatarProps>;

export default Avatar;
4 changes: 3 additions & 1 deletion src/Badge/Badge.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement> {
color?: PropTypes.Color;
}

export default class Badge extends StyledComponent<BadgeProps> {}
declare const Badge: StyledComponent<BadgeProps>;

export default Badge;
6 changes: 3 additions & 3 deletions src/BottomNavigation/BottomNavigation.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ export type BottomNavigationProps = {
value?: any;
} & React.HTMLAttributes<HTMLDivElement>;

export default class BottomNavigation extends StyledComponent<
BottomNavigationProps
> {}
declare const BottomNavigation: StyledComponent<BottomNavigationProps>;

export default BottomNavigation;
6 changes: 3 additions & 3 deletions src/BottomNavigation/BottomNavigationButton.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ export type BottomNavigationButtonProps = {
value?: any;
} & Partial<Omit<ButtonBaseProps, 'onChange'>>;

export default class BottomNavigationButton extends StyledComponent<
BottomNavigationButtonProps
> {}
declare const BottomNavigationButton: StyledComponent<BottomNavigationButtonProps>;

export default BottomNavigationButton;
4 changes: 3 additions & 1 deletion src/Button/Button.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ export interface ButtonProps extends ButtonBaseProps {
type?: string;
}

export default class Button extends StyledComponent<ButtonProps> {}
declare const Button: StyledComponent<ButtonProps>;

export default Button
4 changes: 3 additions & 1 deletion src/ButtonBase/ButtonBase.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ export type ButtonBaseProps = {
} & React.ButtonHTMLAttributes<HTMLButtonElement> &
React.AnchorHTMLAttributes<HTMLAnchorElement>;

export default class ButtonBase extends StyledComponent<ButtonBaseProps> {}
declare const ButtonBase: StyledComponent<ButtonBaseProps>;

export default ButtonBase;
4 changes: 3 additions & 1 deletion src/Card/Card.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ export interface CardProps extends PaperProps {
raised?: boolean;
}

export default class Card extends StyledComponent<CardProps> {}
declare const Card: StyledComponent<CardProps>;

export default Card;
4 changes: 3 additions & 1 deletion src/Card/CardActions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ export interface CardActionsProps extends React.HTMLAttributes<HTMLDivElement> {
disableActionSpacing?: boolean;
}

export default class CardActions extends StyledComponent<CardActionsProps> {}
declare const CardActions: StyledComponent<CardActionsProps>;

export default CardActions;
4 changes: 3 additions & 1 deletion src/Card/CardContent.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import { StyledComponent } from '..';
export interface CardContentProps
extends React.HTMLAttributes<HTMLDivElement> {}

export default class CardContent extends StyledComponent<CardContentProps> {}
declare const CardContent: StyledComponent<CardContentProps>;

export default CardContent;
4 changes: 3 additions & 1 deletion src/Card/CardHeader.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ export type CardHeaderProps = {
title?: React.ReactNode;
} & Partial<Omit<CardContentProps, 'title'>>;

export default class CardHeader extends StyledComponent<CardHeaderProps> {}
declare const CardHeader: StyledComponent<CardHeaderProps>;

export default CardHeader;
4 changes: 3 additions & 1 deletion src/Card/CardMedia.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ export interface CardMediaProps extends React.HTMLAttributes<HTMLDivElement> {
image: string;
}

export default class CardMedia extends StyledComponent<CardMediaProps> {}
declare const CardMedia: StyledComponent<CardMediaProps>;

export default CardMedia;
4 changes: 3 additions & 1 deletion src/Checkbox/Checkbox.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import { SwitchBaseProps } from '../internal/SwitchBase';

export interface CheckboxProps extends SwitchBaseProps {}

export default class Checkbox extends StyledComponent<CheckboxProps> {}
declare const Checkbox: StyledComponent<CheckboxProps>;

export default Checkbox;
4 changes: 3 additions & 1 deletion src/Chip/Chip.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ export interface ChipProps extends React.HTMLAttributes<HTMLDivElement> {
onRequestDelete?: React.EventHandler<any>;
}

export default class Chip extends StyledComponent<ChipProps> {}
declare const Chip: StyledComponent<ChipProps>;

export default Chip;
4 changes: 3 additions & 1 deletion src/Dialog/Dialog.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ export type DialogProps = {
transition?: Function | React.ReactElement<any>;
} & ModalProps;

export default class Dialog extends StyledComponent<DialogProps> {}
declare const Dialog: StyledComponent<DialogProps>;

export default Dialog;
6 changes: 3 additions & 3 deletions src/Dialog/DialogActions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import { StyledComponent } from '..';
export interface DialogActionsProps
extends React.HTMLAttributes<HTMLDivElement> {}

export default class DialogActions extends StyledComponent<
DialogActionsProps
> {}
declare const DialogActions: StyledComponent<DialogActionsProps>;

export default DialogActions;
6 changes: 3 additions & 3 deletions src/Dialog/DialogContent.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import { StyledComponent } from '..';
export interface DialogContentProps
extends React.HTMLAttributes<HTMLDivElement> {}

export default class DialogContent extends StyledComponent<
DialogContentProps
> {}
declare const DialogContent: StyledComponent<DialogContentProps>;

export default DialogContent;
6 changes: 3 additions & 3 deletions src/Dialog/DialogContentText.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import { StyledComponent } from '..';
export interface DialogContentTextProps
extends React.HTMLAttributes<HTMLParagraphElement> {}

export default class DialogContentText extends StyledComponent<
DialogContentTextProps
> {}
declare const DialogContentText: StyledComponent<DialogContentTextProps>;

export default DialogContentText;
4 changes: 3 additions & 1 deletion src/Dialog/DialogTitle.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ export interface DialogTitleProps extends React.HTMLAttributes<HTMLDivElement> {
disableTypography?: boolean;
}

export default class DialogTitle extends StyledComponent<DialogTitleProps> {}
declare const DialogTitle: StyledComponent<DialogTitleProps>;

export default DialogTitle;
4 changes: 3 additions & 1 deletion src/Divider/Divider.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ export interface DividerProps extends React.HTMLAttributes<HTMLHRElement> {
light?: boolean;
}

export default class Divider extends StyledComponent<DividerProps> {}
declare const Divider: StyledComponent<DividerProps>;

export default Divider;
4 changes: 3 additions & 1 deletion src/Drawer/Drawer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ export interface DrawerProps extends ModalProps {
type: 'permanent' | 'persistent' | 'temporary';
}

export default class Drawer extends StyledComponent<DrawerProps> {}
declare const Drawer: StyledComponent<DrawerProps>;

export default Drawer;
4 changes: 3 additions & 1 deletion src/Form/FormControl.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ export interface FormControlProps
component?: React.ReactType;
}

export default class FormControl extends StyledComponent<FormControlProps> {}
declare const FormControl: StyledComponent<FormControlProps>;

export default FormControl;
6 changes: 3 additions & 3 deletions src/Form/FormControlLabel.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ export type FormControlLabelProps = {
value?: string;
} & React.LabelHTMLAttributes<HTMLLabelElement>;

export default class FormControlLabel extends StyledComponent<
FormControlLabelProps
> {}
declare const FormControlLabel: StyledComponent<FormControlLabelProps>;

export default FormControlLabel;
4 changes: 3 additions & 1 deletion src/Form/FormGroup.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ export interface FormGroupProps
row?: boolean;
}

export default class FormGroup extends StyledComponent<FormGroupProps> {}
declare const FormGroup: StyledComponent<FormGroupProps>;

export default FormGroup;
6 changes: 3 additions & 3 deletions src/Form/FormHelperText.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ export interface FormHelperTextProps
margin?: 'dense';
}

export default class FormHelperText extends StyledComponent<
FormHelperTextProps
> {}
declare const FormHelperText: StyledComponent<FormHelperTextProps>;

export default FormHelperText;
4 changes: 3 additions & 1 deletion src/Form/FormLabel.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ export interface FormLabelProps
required?: boolean;
}

export default class FormLabel extends StyledComponent<FormLabelProps> {}
declare const FormLabel: StyledComponent<FormLabelProps>;

export default FormLabel;
4 changes: 3 additions & 1 deletion src/Grid/Grid.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ export type GridProps = {
} & Partial<{ [key in Breakpoint]: boolean | GridSize }>
& Partial<Omit<React.HTMLAttributes<HTMLElement>, 'hidden'>>;

export default class Grid extends StyledComponent<GridProps> {}
declare const Grid: StyledComponent<GridProps>;

export default Grid;
4 changes: 3 additions & 1 deletion src/GridList/GridList.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ export interface GridListProps {
spacing?: number;
}

export default class GridList extends StyledComponent<GridListProps> {}
declare const GridList: StyledComponent<GridListProps>;

export default GridList;
4 changes: 3 additions & 1 deletion src/GridList/GridListTile.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ export interface GridListTileProps {
row?: number;
}

export default class GridListTile extends StyledComponent<GridListTileProps> {}
declare const GridListTile: StyledComponent<GridListTileProps>;

export default GridListTile;
6 changes: 3 additions & 3 deletions src/GridList/GridListTileBar.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ export interface GridListTileBarProps {
titlePosition?: 'top' | 'bottom';
}

export default class GridListTileBar extends StyledComponent<
GridListTileBarProps
> {}
declare const GridListTileBar: StyledComponent<GridListTileBarProps>;

export default GridListTileBar;
4 changes: 3 additions & 1 deletion src/Hidden/Hidden.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ export interface HiddenProps {
implementation?: 'js' | 'css';
}

export default class Hidden extends StyledComponent<HiddenProps> {}
declare const Hidden: StyledComponent<HiddenProps>;

export default Hidden;
4 changes: 3 additions & 1 deletion src/Hidden/HiddenJs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ export interface HiddenJsProps {
xlDown?: boolean;
}

export default class HiddenJs extends StyledComponent<HiddenJsProps> {}
declare const HiddenJs: StyledComponent<HiddenJsProps>;

export default HiddenJs;
4 changes: 3 additions & 1 deletion src/Icon/Icon.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ export interface IconProps extends React.HTMLAttributes<HTMLSpanElement> {
color?: PropTypes.Color | 'action' | 'contrast' | 'disabled' | 'error';
}

export default class Icon extends StyledComponent<IconProps> {}
declare const Icon: StyledComponent<IconProps>;

export default Icon;
4 changes: 3 additions & 1 deletion src/IconButton/IconButton.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ export interface IconButtonProps extends ButtonBaseProps {
rootRef?: React.Ref<any>;
}

export default class IconButton extends StyledComponent<IconButtonProps> {}
declare const IconButton: StyledComponent<IconButtonProps>;

export default IconButton;
4 changes: 3 additions & 1 deletion src/Input/Input.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@ export type InputProps = {
>
>;

export default class Input extends StyledComponent<InputProps> {}
declare const Input: StyledComponent<InputProps>;

export default Input;
4 changes: 3 additions & 1 deletion src/Input/InputLabel.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ export interface InputLabelProps extends FormLabelProps {
shrink?: boolean;
}

export default class InputLabel extends StyledComponent<InputLabelProps> {}
declare const InputLabel: StyledComponent<InputLabelProps>;

export default InputLabel;
4 changes: 3 additions & 1 deletion src/Input/Textarea.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ export type TextareaProps = {
value?: string;
} & React.TextareaHTMLAttributes<HTMLTextAreaElement>;

export default class Textarea extends StyledComponent<TextareaProps> {}
declare const Textarea: StyledComponent<TextareaProps>;

export default Textarea;
4 changes: 3 additions & 1 deletion src/List/List.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ export interface ListProps extends React.HTMLAttributes<HTMLUListElement> {
subheader?: React.ReactElement<any>;
}

export default class List extends StyledComponent<ListProps> {}
declare const List: StyledComponent<ListProps>;

export default List;
4 changes: 3 additions & 1 deletion src/List/ListItem.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ export type ListItemProps = {
} & ButtonBaseProps &
React.LiHTMLAttributes<HTMLLIElement>;

export default class ListItem extends StyledComponent<ListItemProps> {}
declare const ListItem: StyledComponent<ListItemProps>;

export default ListItem;
6 changes: 3 additions & 3 deletions src/List/ListItemAvatar.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { StyledComponent } from '..';

export interface ListItemAvatarProps {}

export default class ListItemAvatar extends StyledComponent<
ListItemAvatarProps
> {}
declare const ListItemAvatar: StyledComponent<ListItemAvatarProps>;

export default ListItemAvatar;
4 changes: 3 additions & 1 deletion src/List/ListItemIcon.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ import { StyledComponent } from '..';

export interface ListItemIconProps {}

export default class ListItemIcon extends StyledComponent<ListItemIconProps> {}
declare const ListItemIcon: StyledComponent<ListItemIconProps>;

export default ListItemIcon;
6 changes: 3 additions & 3 deletions src/List/ListItemSecondaryAction.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { StyledComponent } from '..';

export interface ListItemSecondaryActionProps {}

export default class ListItemSecondaryAction extends StyledComponent<
ListItemSecondaryActionProps
> {}
declare const ListItemSecondaryAction: StyledComponent<ListItemSecondaryActionProps>;

export default ListItemSecondaryAction;
4 changes: 3 additions & 1 deletion src/List/ListItemText.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ export interface ListItemTextProps
secondary?: React.ReactNode;
}

export default class ListItemText extends StyledComponent<ListItemTextProps> {}
declare const ListItemText: StyledComponent<ListItemTextProps>;

export default ListItemText;
6 changes: 3 additions & 3 deletions src/List/ListSubheader.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ export interface ListSubheaderProps
disableSticky?: boolean;
}

export default class ListSubheader extends StyledComponent<
ListSubheaderProps
> {}
declare const ListSubheader: StyledComponent<ListSubheaderProps>;

export default ListSubheader;
4 changes: 3 additions & 1 deletion src/Menu/Menu.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ export type MenuProps = {
} & Partial<TransitionHandlers> &
PopoverProps;

export default class Menu extends StyledComponent<MenuProps> {}
declare const Menu: StyledComponent<MenuProps>;

export default Menu;
4 changes: 3 additions & 1 deletion src/Menu/MenuItem.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ export interface MenuItemProps extends ListItemProps {
selected?: boolean;
}

export default class MenuItem extends StyledComponent<MenuItemProps> {}
declare const MenuItem: StyledComponent<MenuItemProps>;

export default MenuItem;
4 changes: 3 additions & 1 deletion src/Menu/MenuList.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ export type MenuListProps = {
onKeyDown?: React.ReactEventHandler<React.KeyboardEvent<any>>;
} & ListProps;

export default class MenuList extends StyledComponent<MenuListProps> {}
declare const MenuList: StyledComponent<MenuListProps>;

export default MenuList;
Loading

0 comments on commit 1a146b8

Please sign in to comment.