/
index.d.ts
115 lines (95 loc) · 2.89 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
* This file is part of the nivo project.
*
* Copyright 2016-present, Raphaël Benitte.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import * as React from 'react'
import {
Dimensions,
Box,
Theme,
MotionProps,
StackOrder,
StackOffset,
AreaCurve,
SvgDefsAndFill,
PropertyAccessor,
} from '@nivo/core'
import { OrdinalColorScaleConfig, InheritedColorConfig } from '@nivo/colors'
import { LegendProps } from '@nivo/legends'
import { Scale } from '@nivo/scales'
import { AxisProps } from '@nivo/axes'
declare module '@nivo/stream' {
export type TooltipFormatter<T> = (value: T) => React.ReactNode
export type TooltipLabel<T> = (value: T) => string
export type StackFunc<T> = (
data: T[]
) => {
0: number
1: number
data: T
}[][]
export interface Datum {
color: string
index: number
key: string
value: number
x: number
y1: number
y2: number
}
export type DatumToNumber = (datum: Datum) => number
interface OptionalStreamProps<T> extends SvgDefsAndFill<T>, MotionProps {
stack: StackFunc<T>
xScale: Scale
yScale: Scale
order: StackOrder
offsetType: StackOffset
curve: AreaCurve
legendLabel: PropertyAccessor<T, string>
margin: Box
axisTop: AxisProps | null
axisRight: AxisProps | null
axisBottom: AxisProps | null
axisLeft: AxisProps | null
enableGridX: boolean
enableGridY: boolean
colors: OrdinalColorScaleConfig
fillOpacity: number
borderWidth: number
borderColor: InheritedColorConfig<T>
enableDots: boolean
renderDot: StreamDotsItem
dotPosition: 'start' | 'center' | 'end'
dotSize: DatumToNumber | number
dotColor: InheritedColorConfig<T>
dotBorderWidth: DatumToNumber | number
dotBorderColor: InheritedColorConfig<T>
isInteractive: boolean
tooltipLabel: TooltipLabel<T>
tooltipFormat: TooltipFormatter<T> | string
enableStackTooltip: boolean
theme: Theme
role: string
legends: LegendProps[]
}
export interface StreamProps<T> extends Partial<OptionalStreamProps<T>> {
data: T[]
keys: string[]
}
export interface StreamDotsItemProps {
x: number
y: number
size: number
color: string
borderWidth: number
borderColor: string
}
export class StreamDotsItem extends React.Component<StreamDotsItemProps> {}
export interface StreamSvgProps<T> extends StreamProps<T>, MotionProps {}
export class Stream<T> extends React.Component<StreamProps<T> & Dimensions> {}
export class ResponsiveStream<T> extends React.Component<StreamProps<T>> {}
}