1 | import * as React from 'react';
|
2 | import {
|
3 | StyleObject,
|
4 | StyletronComponent,
|
5 | WithStyleFn as StyletronWithStyleFn,
|
6 | StyledFn as StyletronStyledFn,
|
7 | } from 'styletron-react';
|
8 | import {Override, Overrides} from './overrides';
|
9 | import {Locale} from './locale';
|
10 | import {Theme, ThemePrimitives} from './theme';
|
11 |
|
12 | type UseStyletronFn<Theme> = () => [(arg: StyleObject) => string, Theme];
|
13 | export function createThemedUseStyletron<Theme>(): UseStyletronFn<Theme>;
|
14 | export const useStyletron: UseStyletronFn<Theme>;
|
15 |
|
16 | export function createTheme<P extends object>(
|
17 | primitives: Partial<ThemePrimitives>,
|
18 | overrides?: P,
|
19 | ): Theme & P;
|
20 | export function createLightTheme<P extends object>(
|
21 | primitives: Partial<ThemePrimitives>,
|
22 | overrides?: P,
|
23 | ): Theme & P;
|
24 | export function createDarkTheme<P extends object>(
|
25 | primitives: Partial<ThemePrimitives>,
|
26 | overrides?: P,
|
27 | ): Theme & P;
|
28 | export function mergeOverrides<T>(
|
29 | target?: Overrides<T>,
|
30 | source?: Overrides<T>,
|
31 | ): Overrides<T>;
|
32 | export function styled<
|
33 | P extends object,
|
34 | C extends keyof JSX.IntrinsicElements | React.ComponentType<any>,
|
35 | T = Theme
|
36 | >(
|
37 | component: C,
|
38 | styledFn: StyleObject | ((props: {$theme: T} & P) => StyleObject),
|
39 | ): StyletronComponent<
|
40 | Pick<
|
41 | React.ComponentProps<C>,
|
42 | Exclude<keyof React.ComponentProps<C>, {className: string}>
|
43 | > &
|
44 | P
|
45 | >;
|
46 |
|
47 | export const LightTheme: Theme;
|
48 | export const LightThemeMove: Theme;
|
49 | export const lightThemePrimitives: ThemePrimitives;
|
50 | export const DarkTheme: Theme;
|
51 | export const DarkThemeMove: Theme;
|
52 | export const darkThemePrimitives: ThemePrimitives;
|
53 |
|
54 | export interface BaseProviderOverrides {
|
55 | AppContainer?: Override<any>;
|
56 | LayersContainer?: Override<any>;
|
57 | }
|
58 |
|
59 | export interface BaseProviderProps {
|
60 | children: React.ReactNode;
|
61 | theme: Theme;
|
62 | overrides?: BaseProviderOverrides;
|
63 | zIndex?: number;
|
64 | }
|
65 | export const BaseProvider: React.FC<BaseProviderProps>;
|
66 |
|
67 | export interface LocaleProviderProps {
|
68 | locale: Partial<Locale>;
|
69 | children?: React.ReactNode;
|
70 | }
|
71 | export const LocaleProvider: React.FC<LocaleProviderProps>;
|
72 |
|
73 | export interface ThemeProviderProps {
|
74 | theme: Theme;
|
75 | children?: React.ReactNode;
|
76 | }
|
77 | export const ThemeProvider: React.FC<ThemeProviderProps>;
|
78 |
|
79 | export interface StyledFn<T> extends StyletronStyledFn {
|
80 | <
|
81 | C extends keyof JSX.IntrinsicElements | React.ComponentType<any>,
|
82 | P extends object
|
83 | >(
|
84 | component: C,
|
85 | style: (props: {$theme: T} & P) => StyleObject,
|
86 | ): StyletronComponent<
|
87 | Pick<
|
88 | React.ComponentProps<C>,
|
89 | Exclude<keyof React.ComponentProps<C>, {className: string}>
|
90 | > &
|
91 | P
|
92 | >;
|
93 | }
|
94 |
|
95 | export function createThemedStyled<Theme>(): StyledFn<Theme>;
|
96 |
|
97 | export interface WithStyleFn<T = Theme> extends StyletronWithStyleFn {
|
98 | <C extends StyletronComponent<any>, P extends object, T1 = T>(
|
99 | component: C,
|
100 | style: (props: P & {$theme: T1}) => StyleObject,
|
101 | ): StyletronComponent<React.ComponentProps<C> & P>;
|
102 | }
|
103 |
|
104 | export const withStyle: WithStyleFn;
|
105 |
|
106 | export function createThemedWithStyle<Theme>(): WithStyleFn<Theme>;
|