1 | import { Omit } from '@material-ui/types';
|
2 | import {
|
3 | CreateCSSProperties,
|
4 | StyledComponentProps,
|
5 | WithStylesOptions,
|
6 | } from '@material-ui/styles/withStyles';
|
7 | import { Theme as DefaultTheme } from './createTheme';
|
8 | import * as React from 'react';
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | export type ComponentCreator<Component extends React.ElementType> = <
|
18 | Theme = DefaultTheme,
|
19 | Props extends {} = {}
|
20 | >(
|
21 | styles:
|
22 | | CreateCSSProperties<Props>
|
23 | | ((props: { theme: Theme } & Props) => CreateCSSProperties<Props>),
|
24 | options?: WithStylesOptions<Theme>
|
25 | ) => React.ComponentType<
|
26 | Omit<
|
27 | JSX.LibraryManagedAttributes<Component, React.ComponentProps<Component>>,
|
28 | 'classes' | 'className'
|
29 | > &
|
30 | StyledComponentProps<'root'> & { className?: string } & (Props extends { theme: Theme }
|
31 | ? Omit<Props, 'theme'> & { theme?: Theme }
|
32 | : Props)
|
33 | >;
|
34 |
|
35 | export interface StyledProps {
|
36 | className: string;
|
37 | }
|
38 |
|
39 | export default function styled<Component extends React.ElementType>(
|
40 | Component: Component
|
41 | ): ComponentCreator<Component>;
|