Socket
Socket
Sign inDemoInstall

recharts

Package Overview
Dependencies
42
Maintainers
3
Versions
235
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.8 to 2.1.9

13

CHANGELOG.md

@@ -0,1 +1,14 @@

## 2.1.9 (Feb 10, 2022)
# feat
- feat: allow axis domain to accept a callback (#2770)
- Categorical chart callback types (#2739)
# fix
- Fixing types in strict mode (#2745) (#2747)
- Fix: removes overlapping legend for categorical charts (#2752)
- Categorical chart callback types (#2739)
## 2.1.8 (dec 14, 2021)

@@ -2,0 +15,0 @@

14

es6/chart/Treemap.js

@@ -41,2 +41,3 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

/* eslint-disable jsx-a11y/no-static-element-interactions */
import classNames from 'classnames';

@@ -48,14 +49,13 @@ /**

import Smooth from 'react-smooth';
import classNames from 'classnames';
import { Tooltip } from '../component/Tooltip';
import { Layer } from '../container/Layer';
import { Surface } from '../container/Surface';
import { Layer } from '../container/Layer';
import { Polygon } from '../shape/Polygon';
import { Rectangle } from '../shape/Rectangle';
import { findChildByType, filterSvgElements, validateWidthHeight } from '../util/ReactUtils';
import { Global } from '../util/Global';
import { Tooltip } from '../component/Tooltip';
import { Polygon } from '../shape/Polygon';
import { getValueByDataKey } from '../util/ChartUtils';
import { COLOR_PANEL } from '../util/Constants';
import { uniqueId } from '../util/DataUtils';
import { getStringSize } from '../util/DOMUtils';
import { uniqueId } from '../util/DataUtils';
import { Global } from '../util/Global';
import { filterSvgElements, findChildByType, validateWidthHeight } from '../util/ReactUtils';
import { filterProps } from '../util/types';

@@ -62,0 +62,0 @@ var NODE_VALUE_KEY = 'value';

@@ -1047,2 +1047,6 @@ import _isEqual from "lodash/isEqual";

export var parseSpecifiedDomain = function parseSpecifiedDomain(specifiedDomain, dataDomain, allowDataOverflow) {
if (_isFunction(specifiedDomain)) {
return specifiedDomain(dataDomain, allowDataOverflow);
}
if (!_isArray(specifiedDomain)) {

@@ -1049,0 +1053,0 @@ return dataDomain;

@@ -18,2 +18,4 @@ "use strict";

var _classnames = _interopRequireDefault(require("classnames"));
var _react = _interopRequireWildcard(require("react"));

@@ -23,18 +25,12 @@

var _classnames = _interopRequireDefault(require("classnames"));
var _Tooltip = require("../component/Tooltip");
var _Layer = require("../container/Layer");
var _Surface = require("../container/Surface");
var _Layer = require("../container/Layer");
var _Polygon = require("../shape/Polygon");
var _Rectangle = require("../shape/Rectangle");
var _ReactUtils = require("../util/ReactUtils");
var _Global = require("../util/Global");
var _Tooltip = require("../component/Tooltip");
var _Polygon = require("../shape/Polygon");
var _ChartUtils = require("../util/ChartUtils");

@@ -44,6 +40,10 @@

var _DataUtils = require("../util/DataUtils");
var _DOMUtils = require("../util/DOMUtils");
var _DataUtils = require("../util/DataUtils");
var _Global = require("../util/Global");
var _ReactUtils = require("../util/ReactUtils");
var _types = require("../util/types");

@@ -50,0 +50,0 @@

@@ -1167,2 +1167,6 @@ "use strict";

var parseSpecifiedDomain = function parseSpecifiedDomain(specifiedDomain, dataDomain, allowDataOverflow) {
if ((0, _isFunction2["default"])(specifiedDomain)) {
return specifiedDomain(dataDomain, allowDataOverflow);
}
if (!(0, _isArray2["default"])(specifiedDomain)) {

@@ -1169,0 +1173,0 @@ return dataDomain;

{
"name": "recharts",
"version": "2.1.8",
"version": "2.1.9",
"description": "React charts",

@@ -5,0 +5,0 @@ "main": "lib/index",

# Recharts
[![Sponsors on Open Collective](https://opencollective.com/recharts/sponsors/badge.svg)](https://opencollective.com/recharts#sponsors)
[![Backers on Open Collective](https://opencollective.com/recharts/backers/badge.svg)](https://opencollective.com/recharts#backer)
[![Build Status](https://github.com/recharts/recharts/workflows/Node.js%20CI/badge.svg)](https://github.com/recharts/recharts/actions)

@@ -87,23 +85,2 @@ [![Coverage Status](https://coveralls.io/repos/recharts/recharts/badge.svg?branch=master&service=github)](https://coveralls.io/github/recharts/recharts?branch=master)

## Contribution
We'd love :heart: to hear what you think we should build. Please create an issue to write your usage or ideas.
We are looking for like-minded people who share the same idea about Recharts. The goal of this project is to create a more flexible charting library for the React community.
## Backers
[Become a backer](https://opencollective.com/recharts#backer) and get your image on our README on Github with a link to your site.
<a href="https://opencollective.com/recharts/backer/0/website?requireActive=false" target="_blank"><img src="https://opencollective.com/recharts/backer/0/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/recharts/backer/1/website?requireActive=false" target="_blank"><img src="https://opencollective.com/recharts/backer/1/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/recharts/backer/2/website?requireActive=false" target="_blank"><img src="https://opencollective.com/recharts/backer/2/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/recharts/backer/3/website?requireActive=false" target="_blank"><img src="https://opencollective.com/recharts/backer/3/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/recharts/backer/4/website?requireActive=false" target="_blank"><img src="https://opencollective.com/recharts/backer/4/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/recharts/backer/5/website?requireActive=false" target="_blank"><img src="https://opencollective.com/recharts/backer/5/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/recharts/backer/6/website?requireActive=false" target="_blank"><img src="https://opencollective.com/recharts/backer/6/avatar.svg?requireActive=false"></a>
## Sponsoring
Most of the core team members do this open source work in their free time. If you use recharts for a important work, and you'd like us to invest more time on it, please [donate](https://opencollective.com/recharts#sponsors). Thanks!
## License

@@ -110,0 +87,0 @@

@@ -88,2 +88,3 @@ // "export type" declarations on separate lines are in use

export { Treemap } from './chart/Treemap';
export type { Props as TreemapProps } from './chart/Treemap';
export { Sankey } from './chart/Sankey';

@@ -90,0 +91,0 @@ export { RadarChart } from './chart/RadarChart';

@@ -1049,2 +1049,6 @@ import _ from 'lodash';

export const parseSpecifiedDomain = (specifiedDomain: any, dataDomain: any, allowDataOverflow: boolean) => {
if (_.isFunction(specifiedDomain)) {
return specifiedDomain(dataDomain, allowDataOverflow);
}
if (!_.isArray(specifiedDomain)) {

@@ -1051,0 +1055,0 @@ return dataDomain;

@@ -988,3 +988,7 @@ import {

/** The domain of axis */
export type AxisDomain = string[] | number[] | [AxisDomainItem, AxisDomainItem];
export type AxisDomain =
| string[]
| number[]
| [AxisDomainItem, AxisDomainItem]
| (([dataMin, dataMax]: [number, number], allowDataOverflow: boolean) => [number, number]);

@@ -1113,6 +1117,10 @@ /** The props definition of base axis */

type RecordString<T> = Record<string, T>;
type AdaptEventHandlersReturn = RecordString<(e?: Event) => any> | RecordString<(e: Event) => void> | null;
export const adaptEventHandlers = (
props: Record<string, any> | Component | FunctionComponent | boolean,
props: RecordString<any> | Component | FunctionComponent | boolean,
newHandler?: (e?: Event) => any,
): Record<string, (e?: Event) => any> => {
): AdaptEventHandlersReturn => {
if (!props || typeof props === 'function' || typeof props === 'boolean') {

@@ -1122,6 +1130,6 @@ return null;

let inputProps = props as Record<string, any>;
let inputProps = props as RecordString<any>;
if (isValidElement(props)) {
inputProps = props.props as Record<string, any>;
inputProps = props.props as RecordString<any>;
}

@@ -1133,3 +1141,3 @@

const out: Record<string, (e: Event) => void> = {};
const out: RecordString<(e: Event) => void> = {};

@@ -1145,3 +1153,3 @@ Object.keys(inputProps).forEach(key => {

const getEventHandlerOfChild = (originalHandler: Function, data: any, index: number) => (e: Event): void => {
const getEventHandlerOfChild = (originalHandler: Function, data: any, index: number) => (e: Event): null => {
originalHandler(data, index, e);

@@ -1153,6 +1161,6 @@

export const adaptEventsOfChild = (
props: Record<string, any>,
props: RecordString<any>,
data: any,
index: number,
): Record<string, (e?: Event) => any> => {
): RecordString<(e?: Event) => any> | null => {
if (!_.isObject(props) || typeof props !== 'object') {

@@ -1162,11 +1170,14 @@ return null;

let out: Record<string, (e: Event) => void> = null;
let out: RecordString<(e: Event) => void> | null = null;
Object.keys(props).forEach((key: string) => {
const item = (props as any)[key];
if (EventKeys.includes(key) && typeof item === 'function') {
if (!out) out = {};
out[key] = getEventHandlerOfChild(item, data, index);
}
});
return out;

@@ -1173,0 +1184,0 @@ };

@@ -41,2 +41,3 @@ import React from 'react';

}
export declare type CategoricalChartFunc = (nextState: CategoricalChartState, event: any) => void;
export interface CategoricalChartProps {

@@ -61,8 +62,8 @@ syncId?: number | string;

defaultShowTooltip?: boolean;
onClick?: any;
onMouseLeave?: any;
onMouseEnter?: any;
onMouseMove?: any;
onMouseDown?: any;
onMouseUp?: any;
onClick?: CategoricalChartFunc;
onMouseLeave?: CategoricalChartFunc;
onMouseEnter?: CategoricalChartFunc;
onMouseMove?: CategoricalChartFunc;
onMouseDown?: CategoricalChartFunc;
onMouseUp?: CategoricalChartFunc;
reverseStackOrder?: boolean;

@@ -69,0 +70,0 @@ id?: string;

import React, { PureComponent } from 'react';
import { DataKey, TreemapNode } from '../util/types';
interface Props {
export interface Props {
width?: number;

@@ -5,0 +5,0 @@ height?: number;

@@ -79,2 +79,3 @@ export { Surface } from './container/Surface';

export { Treemap } from './chart/Treemap';
export type { Props as TreemapProps } from './chart/Treemap';
export { Sankey } from './chart/Sankey';

@@ -81,0 +82,0 @@ export { RadarChart } from './chart/RadarChart';

@@ -428,3 +428,3 @@ import { AriaAttributes, SVGProps, SyntheticEvent, ClipboardEvent, CompositionEvent, DragEvent, FocusEvent, FormEvent, KeyboardEvent, MouseEvent, TouchEvent, PointerEvent, UIEvent, WheelEvent, AnimationEvent, TransitionEvent, ReactNode, Component, FunctionComponent, ReactElement } from 'react';

export declare type AxisDomainItem = string | number | Function | 'auto' | 'dataMin' | 'dataMax';
export declare type AxisDomain = string[] | number[] | [AxisDomainItem, AxisDomainItem];
export declare type AxisDomain = string[] | number[] | [AxisDomainItem, AxisDomainItem] | (([dataMin, dataMax]: [number, number], allowDataOverflow: boolean) => [number, number]);
export interface BaseAxisProps {

@@ -481,4 +481,6 @@ type?: 'number' | 'category';

export declare const filterProps: (props: Record<string, any> | Component | FunctionComponent | boolean, includeEvents?: boolean, isSvg?: boolean) => Record<string, any>;
export declare const adaptEventHandlers: (props: Record<string, any> | Component | FunctionComponent | boolean, newHandler?: (e?: Event) => any) => Record<string, (e?: Event) => any>;
export declare const adaptEventsOfChild: (props: Record<string, any>, data: any, index: number) => Record<string, (e?: Event) => any>;
declare type RecordString<T> = Record<string, T>;
declare type AdaptEventHandlersReturn = RecordString<(e?: Event) => any> | RecordString<(e: Event) => void> | null;
export declare const adaptEventHandlers: (props: RecordString<any> | Component | FunctionComponent | boolean, newHandler?: (e?: Event) => any) => AdaptEventHandlersReturn;
export declare const adaptEventsOfChild: (props: RecordString<any>, data: any, index: number) => RecordString<(e?: Event) => any>;
export interface CategoricalChartOptions {

@@ -485,0 +487,0 @@ chartName?: string;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc