mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
recharts: fix callback signatures, add missing props (#20130)
* recharts: fix callback signatures, add missing props * bump recharts version * remove undocumented HTMLAttributes * remove another className prop * changed version to 1.0.0 * change to version 1.0
This commit is contained in:
committed by
Ryan Cavanaugh
parent
24756a7ba8
commit
6f4e38015c
Vendored
+21
-13
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Recharts 0.22
|
||||
// Type definitions for Recharts 1.0
|
||||
// Project: http://recharts.org/
|
||||
// Definitions by: Maarten Mulders <https://github.com/mthmulders>
|
||||
// Raphael Mueller <https://github.com/rapmue>
|
||||
@@ -10,6 +10,11 @@ import * as React from 'react';
|
||||
|
||||
export type Percentage = string;
|
||||
export type RechartsFunction = () => void;
|
||||
export type LabelFormatter = (label: string | number) => React.ReactNode;
|
||||
export type TooltipFormatter = (value: string | number | Array<string | number>, name: string,
|
||||
entry: TooltipPayload, index: number) => React.ReactNode;
|
||||
export type ItemSorter<T> = (a: T, b: T) => number;
|
||||
export type ContentRenderer<P> = (props: P) => React.ReactNode;
|
||||
|
||||
export type LegendType = 'line' | 'square' | 'rect' | 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye' | 'none';
|
||||
export type LayoutType = 'horizontal' | 'vertical';
|
||||
@@ -153,7 +158,7 @@ export interface CartesianAxisProps {
|
||||
tickSize?: number;
|
||||
interval?: "preserveStart" | "preserveEnd" | "preserveStartEnd" | number;
|
||||
tick?: boolean | any | React.ReactElement<any> | RechartsFunction;
|
||||
label?: string | number | React.ReactElement<any> | RechartsFunction;
|
||||
label?: string | number | React.ReactElement<any> | ContentRenderer<CartesianAxisProps>;
|
||||
mirror?: boolean;
|
||||
}
|
||||
|
||||
@@ -261,7 +266,7 @@ export interface LegendProps {
|
||||
chartWidth?: number;
|
||||
chartHeight?: number;
|
||||
margin?: Margin;
|
||||
content?: React.ReactElement<any> | RechartsFunction;
|
||||
content?: React.ReactElement<any> | ContentRenderer<LegendProps>;
|
||||
wrapperStyle?: any;
|
||||
onClick?: RechartsFunction;
|
||||
onMouseDown?: RechartsFunction;
|
||||
@@ -540,7 +545,7 @@ export interface ReferenceAreaProps {
|
||||
viewBox?: ViewBox;
|
||||
xAxis?: any;
|
||||
yAxis?: any;
|
||||
label?: string | number | React.ReactElement<any> | RechartsFunction;
|
||||
label?: string | number | React.ReactElement<any> | ContentRenderer<ReferenceAreaProps>;
|
||||
isFront?: boolean;
|
||||
}
|
||||
|
||||
@@ -551,10 +556,11 @@ export interface ReferenceDotProps {
|
||||
yAxisId?: string | number;
|
||||
x: number | string;
|
||||
y: number | string;
|
||||
r: number;
|
||||
alwaysShow?: boolean;
|
||||
xAxis: any;
|
||||
yAxis: any;
|
||||
label?: string | number | React.ReactElement<any> | RechartsFunction;
|
||||
label?: string | number | React.ReactElement<any> | ContentRenderer<ReferenceDotProps>;
|
||||
isFront?: boolean;
|
||||
onClick?: RechartsFunction;
|
||||
onMouseDown?: RechartsFunction;
|
||||
@@ -577,7 +583,7 @@ export interface ReferenceLineProps {
|
||||
viewBox?: ViewBox;
|
||||
xAxis?: any;
|
||||
yAxis?: any;
|
||||
label?: string | number | React.ReactElement<any> | RechartsFunction;
|
||||
label?: string | number | React.ReactElement<any> | ContentRenderer<ReferenceLineProps>;
|
||||
isFront?: boolean;
|
||||
}
|
||||
|
||||
@@ -589,6 +595,7 @@ export interface ResponsiveContainerProps {
|
||||
height?: Percentage | number;
|
||||
minWidth?: number;
|
||||
minHeight?: number;
|
||||
maxHeight?: Percentage | number;
|
||||
debounce?: number;
|
||||
}
|
||||
|
||||
@@ -683,7 +690,7 @@ export interface Coordinate {
|
||||
}
|
||||
export interface TooltipPayload {
|
||||
name: string;
|
||||
value: number;
|
||||
value: string | number | Array<string | number>;
|
||||
unit: string;
|
||||
}
|
||||
export interface TooltipProps {
|
||||
@@ -698,13 +705,14 @@ export interface TooltipProps {
|
||||
coordinate?: Coordinate;
|
||||
payload?: TooltipPayload[];
|
||||
label?: string | number;
|
||||
content?: React.ReactElement<any> | React.StatelessComponent<any> | RechartsFunction;
|
||||
formatter?: RechartsFunction;
|
||||
labelFormatter?: RechartsFunction;
|
||||
itemSorter?: RechartsFunction;
|
||||
content?: React.ReactElement<any> | React.StatelessComponent<any> | ContentRenderer<TooltipProps>;
|
||||
formatter?: TooltipFormatter;
|
||||
labelFormatter?: LabelFormatter;
|
||||
itemSorter?: ItemSorter<TooltipPayload>;
|
||||
isAnimationActive?: boolean;
|
||||
animationBegin?: number;
|
||||
animationEasing?: AnimationEasingType;
|
||||
filterNull?: boolean;
|
||||
}
|
||||
|
||||
export class Tooltip extends React.Component<TooltipProps> { }
|
||||
@@ -722,11 +730,11 @@ export interface TreemapProps {
|
||||
|
||||
export interface Label {
|
||||
viewBox?: ViewBox | PolarViewBox;
|
||||
formatter?: RechartsFunction;
|
||||
formatter?: LabelFormatter;
|
||||
value: string | number;
|
||||
position?: PositionType;
|
||||
offset?: number;
|
||||
content?: React.ReactElement<any> | RechartsFunction;
|
||||
content?: React.ReactElement<any> | ContentRenderer<Label>;
|
||||
children?: any;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user