1 | import React from 'react';
|
2 | /**
|
3 | * Override DefaultTheme to get accurate typings for your project.
|
4 | *
|
5 | * ```
|
6 | * // create styled-components.d.ts in your project source
|
7 | * // if it isn't being picked up, check tsconfig compilerOptions.types
|
8 | * import type { CSSProp } from "styled-components";
|
9 | * import Theme from './theme';
|
10 | *
|
11 | * type ThemeType = typeof Theme;
|
12 | *
|
13 | * declare module "styled-components" {
|
14 | * export interface DefaultTheme extends ThemeType {}
|
15 | * }
|
16 | *
|
17 | * declare module "react" {
|
18 | * interface DOMAttributes<T> {
|
19 | * css?: CSSProp;
|
20 | * }
|
21 | * }
|
22 | * ```
|
23 | */
|
24 | export interface DefaultTheme {
|
25 | [key: string]: any;
|
26 | }
|
27 | type ThemeFn = (outerTheme?: DefaultTheme | undefined) => DefaultTheme;
|
28 | type ThemeArgument = DefaultTheme | ThemeFn;
|
29 | type Props = {
|
30 | children?: React.ReactNode;
|
31 | theme: ThemeArgument;
|
32 | };
|
33 | export declare const ThemeContext: React.Context<DefaultTheme | undefined>;
|
34 | export declare const ThemeConsumer: React.Consumer<DefaultTheme | undefined>;
|
35 | /**
|
36 | * Returns the current theme (as provided by the closest ancestor `ThemeProvider`.)
|
37 | *
|
38 | * If no `ThemeProvider` is found, the function will error. If you need access to the theme in an
|
39 | * uncertain composition scenario, `React.useContext(ThemeContext)` will not emit an error if there
|
40 | * is no `ThemeProvider` ancestor.
|
41 | */
|
42 | export declare function useTheme(): DefaultTheme;
|
43 | /**
|
44 | * Provide a theme to an entire react component tree via context
|
45 | */
|
46 | export default function ThemeProvider(props: Props): React.JSX.Element | null;
|
47 | export {};
|