UNPKG

@material-ui/core

Version:

React components that implement Google's Material Design.

42 lines (37 loc) 1.34 kB
import { Omit, IsAny, CoerceEmptyInterface } from '@material-ui/types'; import { CreateCSSProperties, StyledComponentProps, WithStylesOptions, } from '@material-ui/styles/withStyles'; import { Theme as DefaultTheme } from './createMuiTheme'; import * as React from 'react'; // These definitions are almost identical to the ones in @material-ui/styles/styled // Only difference is that ComponentCreator has a default theme type // If you need to change these types, update the ones in @material-ui/styles as well /** * @internal */ export type ComponentCreator<Component extends React.ElementType> = < Theme = DefaultTheme, Props extends {} = any >( styles: | CreateCSSProperties<Props> | ((props: { theme: Theme } & CoerceEmptyInterface<Props>) => CreateCSSProperties<Props>), options?: WithStylesOptions<Theme>, ) => React.ComponentType< Omit< JSX.LibraryManagedAttributes<Component, React.ComponentProps<Component>>, 'classes' | 'className' > & StyledComponentProps<'root'> & { className?: string } & CoerceEmptyInterface< Props extends { theme: Theme } ? Omit<Props, 'theme'> & { theme?: Theme } : Props > >; export interface StyledProps { className: string; } export default function styled<Component extends React.ElementType>( Component: Component, ): ComponentCreator<Component>;