Socket
Socket
Sign inDemoInstall

recharts

Package Overview
Dependencies
Maintainers
3
Versions
241
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

recharts - npm Package Compare versions

Comparing version 2.7.1 to 2.7.2

7

es6/cartesian/Area.js

@@ -9,2 +9,3 @@ import _isEqual from "lodash/isEqual";

var _excluded = ["layout", "type", "stroke", "connectNulls", "isRange", "ref"];
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

@@ -28,3 +29,2 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
/**

@@ -43,6 +43,3 @@ * @fileOverview Area

import { getCateCoordinateOfLine, getValueByDataKey } from '../util/ChartUtils';
import { filterProps } from '../util/ReactUtils';
var isDotProps = function isDotProps(dot) {
return _typeof(dot) === 'object' && 'cx' in dot && 'cy' in dot && 'r' in dot;
};
import { filterProps, isDotProps } from '../util/ReactUtils';
export var Area = /*#__PURE__*/function (_PureComponent) {

@@ -49,0 +46,0 @@ _inherits(Area, _PureComponent);

@@ -42,3 +42,3 @@ import _isEqual from "lodash/isEqual";

import { uniqueId, interpolateNumber } from '../util/DataUtils';
import { findAllByType, filterProps } from '../util/ReactUtils';
import { findAllByType, filterProps, isDotProps } from '../util/ReactUtils';
import { Global } from '../util/Global';

@@ -350,3 +350,3 @@ import { getCateCoordinateOfLine, getValueByDataKey } from '../util/ChartUtils';

strokeWidth = _ref2$strokeWidth === void 0 ? 2 : _ref2$strokeWidth;
var _ref3 = dot,
var _ref3 = isDotProps(dot) ? dot : {},
_ref3$clipDot = _ref3.clipDot,

@@ -353,0 +353,0 @@ clipDot = _ref3$clipDot === void 0 ? true : _ref3$clipDot;

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

this.mouseHandlerCallback = mouseHandlerCallback !== null && mouseHandlerCallback !== void 0 ? mouseHandlerCallback : this.mouseHandlerCallback;
if (this.activeIndex >= this.coordinateList.length) {
this.activeIndex = this.coordinateList.length - 1;
}
// Keep activeIndex in the bounds between 0 and the last coordinate index
this.activeIndex = Math.min(Math.max(this.activeIndex, 0), this.coordinateList.length - 1);
}

@@ -46,2 +46,8 @@ }, {

value: function keyboardEvent(e) {
// The AccessibilityManager relies on the Tooltip component. When tooltips suddenly stop existing,
// it can cause errors. We use this function to check. We don't want arrow keys to be processed
// if there are no tooltips, since that will cause unexpected behavior of users.
if (this.coordinateList.length === 0) {
return;
}
switch (e.key) {

@@ -78,2 +84,8 @@ case 'ArrowRight':

}
// This can happen when the tooltips suddenly stop existing as children of the component
// That update doesn't otherwise fire events, so we have to double check here.
if (this.coordinateList.length === 0) {
return;
}
var _this$container$getBo = this.container.getBoundingClientRect(),

@@ -80,0 +92,0 @@ x = _this$container$getBo.x,

@@ -11,2 +11,3 @@ import _isObject from "lodash/isObject";

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
import { Children, isValidElement } from 'react';

@@ -148,2 +149,5 @@ import { isFragment } from 'react-is';

};
export var isDotProps = function isDotProps(dot) {
return dot && _typeof(dot) === 'object' && 'cx' in dot && 'cy' in dot && 'r' in dot;
};

@@ -150,0 +154,0 @@ /**

@@ -29,2 +29,3 @@ "use strict";

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

@@ -47,9 +48,5 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } /**
* @fileOverview Area
*/
var isDotProps = function isDotProps(dot) {
return _typeof(dot) === 'object' && 'cx' in dot && 'cy' in dot && 'r' in dot;
};
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /**
* @fileOverview Area
*/
var Area = /*#__PURE__*/function (_PureComponent) {

@@ -361,3 +358,3 @@ _inherits(Area, _PureComponent);

strokeWidth = _ref2$strokeWidth === void 0 ? 2 : _ref2$strokeWidth;
var _ref3 = isDotProps(dot) ? dot : {},
var _ref3 = (0, _ReactUtils.isDotProps)(dot) ? dot : {},
_ref3$clipDot = _ref3.clipDot,

@@ -364,0 +361,0 @@ clipDot = _ref3$clipDot === void 0 ? true : _ref3$clipDot;

@@ -357,3 +357,3 @@ "use strict";

strokeWidth = _ref2$strokeWidth === void 0 ? 2 : _ref2$strokeWidth;
var _ref3 = dot,
var _ref3 = (0, _ReactUtils.isDotProps)(dot) ? dot : {},
_ref3$clipDot = _ref3.clipDot,

@@ -360,0 +360,0 @@ clipDot = _ref3$clipDot === void 0 ? true : _ref3$clipDot;

@@ -39,5 +39,5 @@ "use strict";

this.mouseHandlerCallback = mouseHandlerCallback !== null && mouseHandlerCallback !== void 0 ? mouseHandlerCallback : this.mouseHandlerCallback;
if (this.activeIndex >= this.coordinateList.length) {
this.activeIndex = this.coordinateList.length - 1;
}
// Keep activeIndex in the bounds between 0 and the last coordinate index
this.activeIndex = Math.min(Math.max(this.activeIndex, 0), this.coordinateList.length - 1);
}

@@ -52,2 +52,8 @@ }, {

value: function keyboardEvent(e) {
// The AccessibilityManager relies on the Tooltip component. When tooltips suddenly stop existing,
// it can cause errors. We use this function to check. We don't want arrow keys to be processed
// if there are no tooltips, since that will cause unexpected behavior of users.
if (this.coordinateList.length === 0) {
return;
}
switch (e.key) {

@@ -84,2 +90,8 @@ case 'ArrowRight':

}
// This can happen when the tooltips suddenly stop existing as children of the component
// That update doesn't otherwise fire events, so we have to double check here.
if (this.coordinateList.length === 0) {
return;
}
var _this$container$getBo = this.container.getBoundingClientRect(),

@@ -86,0 +98,0 @@ x = _this$container$getBo.x,

@@ -9,3 +9,3 @@ "use strict";

exports.findChildByType = findChildByType;
exports.withoutType = exports.validateWidthHeight = exports.toArray = exports.renderByOrder = exports.parseChildIndex = exports.isValidSpreadableProp = exports.isSingleChildEqual = exports.isChildrenEqual = exports.getReactEventByType = exports.getDisplayName = void 0;
exports.withoutType = exports.validateWidthHeight = exports.toArray = exports.renderByOrder = exports.parseChildIndex = exports.isValidSpreadableProp = exports.isSingleChildEqual = exports.isDotProps = exports.isChildrenEqual = exports.getReactEventByType = exports.getDisplayName = void 0;
var _isObject2 = _interopRequireDefault(require("lodash/isObject"));

@@ -27,2 +27,3 @@ var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
var REACT_BROWSER_EVENT_MAP = {

@@ -166,2 +167,5 @@ click: 'onClick',

};
var isDotProps = function isDotProps(dot) {
return dot && _typeof(dot) === 'object' && 'cx' in dot && 'cy' in dot && 'r' in dot;
};

@@ -176,2 +180,3 @@ /**

*/
exports.isDotProps = isDotProps;
var isValidSpreadableProp = function isValidSpreadableProp(property, key, includeEvents, svgElementType) {

@@ -178,0 +183,0 @@ var _FilteredElementKeyMa;

{
"name": "recharts",
"version": "2.7.1",
"version": "2.7.2",
"description": "React charts",

@@ -140,3 +140,3 @@ "main": "lib/index",

"jest-environment-jsdom": "^27.5.1",
"lint-staged": "^13.1.0",
"lint-staged": "^13.2.2",
"prettier": "^2.2.1",

@@ -143,0 +143,0 @@ "react": "^16.14.0",

@@ -7,3 +7,3 @@ import React, { PureComponent, ReactElement, SVGProps } from 'react';

import { D3Scale, LegendType, TooltipType, AnimationTiming, ChartOffset, Coordinate, DataKey, TickItem } from '../util/types';
declare type AreaDot = ReactElement<SVGElement> | ((props: any) => ReactElement<SVGElement>) | ((props: any) => ReactElement<SVGElement>) | DotProps | boolean;
export declare type AreaDot = ReactElement<SVGElement> | ((props: any) => ReactElement<SVGElement>) | ((props: any) => ReactElement<SVGElement>) | DotProps | boolean;
interface AreaPointItem extends CurvePoint {

@@ -10,0 +10,0 @@ value?: number | number[];

@@ -8,3 +8,3 @@ import React, { PureComponent, ReactElement } from 'react';

import { D3Scale, LegendType, TooltipType, AnimationTiming, ChartOffset, DataKey, TickItem } from '../util/types';
declare type LineDot = ReactElement<SVGElement> | ((props: any) => ReactElement<SVGElement>) | DotProps | boolean;
export declare type LineDot = ReactElement<SVGElement> | ((props: any) => ReactElement<SVGElement>) | DotProps | boolean;
export interface LinePointItem extends CurvePoint {

@@ -11,0 +11,0 @@ value?: number;

@@ -33,2 +33,2 @@ import React, { CSSProperties, ReactNode } from 'react';

}
export declare const DefaultTooltipContent: <TValue extends ValueType, TName extends string | number>(props: Props<TValue, TName>) => React.JSX.Element;
export declare const DefaultTooltipContent: <TValue extends string | number | (string | number)[], TName extends string | number>(props: Props<TValue, TName>) => React.JSX.Element;

@@ -45,3 +45,3 @@ import React, { CSSProperties, ReactNode, ReactElement, SVGProps } from 'react';

export declare const Tooltip: {
<TValue extends ValueType, TName extends string | number>(props: DefaultProps<TValue, TName> & {
<TValue extends string | number | (string | number)[], TName extends string | number>(props: DefaultProps<TValue, TName> & {
allowEscapeViewBox?: {

@@ -48,0 +48,0 @@ x?: boolean;

import React, { Component, FunctionComponent, ReactNode } from 'react';
import { DotProps } from '..';
import { FilteredSvgElementType } from './types';
import { AreaDot } from '../cartesian/Area';
import { LineDot } from '../cartesian/Line';
export declare const SCALE_TYPES: string[];

@@ -12,2 +15,3 @@ export declare const LEGEND_TYPES: string[];

export declare const validateWidthHeight: (el: any) => boolean;
export declare const isDotProps: (dot: LineDot | AreaDot) => dot is DotProps;
export declare const isValidSpreadableProp: (property: unknown, key: string, includeEvents?: boolean, svgElementType?: FilteredSvgElementType) => boolean;

@@ -14,0 +18,0 @@ export declare const filterSvgElements: (children: React.ReactElement[]) => React.ReactElement[];

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc