-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
index.d.ts
99 lines (86 loc) · 2.43 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun>
// TypeScript Version: 2.8
import { EmotionCache } from '@emotion/cache'
import css, { Interpolation, SerializedStyles } from '@emotion/css'
import { Keyframes } from '@emotion/serialize'
import {
ClassAttributes,
ComponentClass,
Context,
Provider,
FC,
ReactElement,
ReactNode,
Ref,
createElement
} from 'react'
export {
ArrayInterpolation,
ComponentSelector,
CSSObject,
FunctionInterpolation,
ObjectInterpolation
} from '@emotion/css'
export { EmotionCache, Interpolation, Keyframes, SerializedStyles, css }
export const ThemeContext: Context<object>
export const CacheProvider: Provider<EmotionCache>
export function withEmotionCache<Props, RefType = any>(
func: (props: Props, context: EmotionCache, ref: Ref<RefType>) => ReactNode
): FC<Props & ClassAttributes<RefType>>
export const jsx: typeof createElement
export type InterpolationWithTheme<Theme> =
| Interpolation
| ((theme: Theme) => Interpolation)
export interface GlobalProps<Theme> {
styles: InterpolationWithTheme<Theme>
}
/**
* @desc
* JSX generic are supported only after TS@2.9
*/
export function Global<Theme = any>(props: GlobalProps<Theme>): ReactElement
export function keyframes(
template: TemplateStringsArray,
...args: Array<Interpolation>
): Keyframes
export function keyframes(...args: Array<Interpolation>): Keyframes
export interface ArrayClassNamesArg extends Array<ClassNamesArg> {}
export type ClassNamesArg =
| undefined
| null
| string
| boolean
| { [className: string]: boolean | null | undefined }
| ArrayClassNamesArg
export interface ClassNamesContent<Theme> {
css(template: TemplateStringsArray, ...args: Array<Interpolation>): string
css(...args: Array<Interpolation>): string
cx(...args: Array<ClassNamesArg>): string
theme: Theme
}
export interface ClassNamesProps<Theme> {
children(content: ClassNamesContent<Theme>): ReactNode
}
/**
* @desc
* JSX generic are supported only after TS@2.9
*/
export function ClassNames<Theme = any>(
props: ClassNamesProps<Theme>
): ReactElement
declare module 'react' {
interface DOMAttributes<T> {
css?: InterpolationWithTheme<any>
}
}
declare global {
namespace JSX {
/**
* Do we need to modify `LibraryManagedAttributes` too,
* to make `className` props optional when `css` props is specified?
*/
interface IntrinsicAttributes {
css?: InterpolationWithTheme<any>
}
}
}