-
Notifications
You must be signed in to change notification settings - Fork 68
/
index.d.ts
40 lines (32 loc) · 1.29 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import * as React from "react";
declare module "react-css-themr" {
type TReactCSSThemrTheme = {
[key: string]: string | TReactCSSThemrTheme
}
type TMapThemrProps<P> = (ownProps: P, theme: TReactCSSThemrTheme) => P & { theme: TReactCSSThemrTheme }
export function themeable(...themes: Array<TReactCSSThemrTheme>): TReactCSSThemrTheme;
export interface IThemrOptions {
/** @default "deeply" */
composeTheme?: "deeply" | "softly" | false,
//currently there's no way to lift decorated component's generic type argument (P) to upper decorator
//that's why just {}
mapThemrProps?: TMapThemrProps<{}>
}
export interface ThemeProviderProps {
innerRef?: Function,
theme: TReactCSSThemrTheme
}
export class ThemeProvider extends React.Component<ThemeProviderProps, any> {
}
interface ThemedComponent<P, S> extends React.Component<P, S> {
}
interface ThemedComponentClass<P, S> extends React.ComponentClass<P> {
new(props?: P, context?: any): ThemedComponent<P, S>;
}
export function themr(
identifier: string | number | symbol,
defaultTheme?: {},
options?: IThemrOptions
): <P, S>(component: (new(props?: P, context?: any) => React.Component<P, S>) | React.SFC<P>) =>
ThemedComponentClass<P & { mapThemrProps?: TMapThemrProps<P> }, S>;
}