UNPKG

1.52 kBTypeScriptView Raw
1/**
2 * @fileOverview Legend
3 */
4import React, { PureComponent, CSSProperties } from 'react';
5import { Payload, Props as DefaultProps } from './DefaultLegendContent';
6import { LayoutType } from '../util/types';
7import { UniqueOption } from '../util/payload/getUniqPayload';
8export type Props = DefaultProps & {
9 wrapperStyle?: CSSProperties;
10 chartWidth?: number;
11 chartHeight?: number;
12 width?: number;
13 height?: number;
14 margin?: {
15 top?: number;
16 left?: number;
17 bottom?: number;
18 right?: number;
19 };
20 payloadUniqBy?: UniqueOption<Payload>;
21 onBBoxUpdate?: (box: DOMRect | null) => void;
22};
23interface State {
24 boxWidth: number;
25 boxHeight: number;
26}
27export declare class Legend extends PureComponent<Props, State> {
28 static displayName: string;
29 static defaultProps: {
30 iconSize: number;
31 layout: string;
32 align: string;
33 verticalAlign: string;
34 };
35 private wrapperNode;
36 static getWithHeight(item: {
37 props: {
38 layout?: LayoutType;
39 height?: number;
40 width?: number;
41 };
42 }, chartWidth: number): null | {
43 height: number;
44 } | {
45 width: number;
46 };
47 lastBoundingBox: {
48 width: number;
49 height: number;
50 };
51 componentDidMount(): void;
52 componentDidUpdate(): void;
53 getBBox(): DOMRect;
54 private updateBBox;
55 private getBBoxSnapshot;
56 private getDefaultPosition;
57 render(): React.JSX.Element;
58}
59export {};