UNPKG

1.62 kBTypeScriptView Raw
1/**
2 * @fileOverview Default Tooltip Content
3 */
4import React, { CSSProperties, ReactNode } from 'react';
5export type TooltipType = 'none';
6export type ValueType = number | string | Array<number | string>;
7export type NameType = number | string;
8export type Formatter<TValue extends ValueType, TName extends NameType> = (value: TValue, name: TName, item: Payload<TValue, TName>, index: number, payload: Array<Payload<TValue, TName>>) => [React.ReactNode, TName] | React.ReactNode;
9export interface Payload<TValue extends ValueType, TName extends NameType> {
10 type?: TooltipType;
11 color?: string;
12 formatter?: Formatter<TValue, TName>;
13 name?: TName;
14 value?: TValue;
15 unit?: ReactNode;
16 dataKey?: string | number;
17 payload?: any;
18 chartType?: string;
19 stroke?: string;
20 strokeDasharray?: string | number;
21 strokeWidth?: number | string;
22 className?: string;
23 hide?: boolean;
24}
25export interface Props<TValue extends ValueType, TName extends NameType> {
26 separator?: string;
27 wrapperClassName?: string;
28 labelClassName?: string;
29 formatter?: Formatter<TValue, TName>;
30 contentStyle?: CSSProperties;
31 itemStyle?: CSSProperties;
32 labelStyle?: CSSProperties;
33 labelFormatter?: (label: any, payload: Array<Payload<TValue, TName>>) => ReactNode;
34 label?: any;
35 payload?: Array<Payload<TValue, TName>>;
36 itemSorter?: (item: Payload<TValue, TName>) => number | string;
37 accessibilityLayer?: boolean;
38}
39export declare const DefaultTooltipContent: <TValue extends ValueType, TName extends NameType>(props: Props<TValue, TName>) => React.JSX.Element;