New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

victory-voronoi-container

Package Overview
Dependencies
Maintainers
3
Versions
159
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

victory-voronoi-container - npm Package Compare versions

Comparing version

to
35.9.0

5

es/index.d.ts

@@ -19,2 +19,5 @@ import * as React from "react";

export class VictoryVoronoiContainer extends React.Component<VictoryVoronoiContainerProps, any> {}
export class VictoryVoronoiContainer extends React.Component<
VictoryVoronoiContainerProps,
any
> {}

@@ -19,2 +19,5 @@ import * as React from "react";

export class VictoryVoronoiContainer extends React.Component<VictoryVoronoiContainerProps, any> {}
export class VictoryVoronoiContainer extends React.Component<
VictoryVoronoiContainerProps,
any
> {}

6

package.json
{
"name": "victory-voronoi-container",
"version": "35.8.4",
"version": "35.9.0",
"description": "Interactive Voronoi Mouseover Component for Victory",

@@ -26,4 +26,4 @@ "keywords": [

"react-fast-compare": "^2.0.0",
"victory-core": "^35.8.1",
"victory-tooltip": "^35.8.1"
"victory-core": "^35.9.0",
"victory-tooltip": "^35.9.0"
},

@@ -30,0 +30,0 @@ "scripts": {

@@ -19,2 +19,5 @@ import * as React from "react";

export class VictoryVoronoiContainer extends React.Component<VictoryVoronoiContainerProps, any> {}
export class VictoryVoronoiContainer extends React.Component<
VictoryVoronoiContainerProps,
any
> {}

@@ -5,3 +5,7 @@ import PropTypes from "prop-types";

import { VictoryTooltip } from "victory-tooltip";
import { VictoryContainer, Helpers, PropTypes as CustomPropTypes } from "victory-core";
import {
VictoryContainer,
Helpers,
PropTypes as CustomPropTypes
} from "victory-core";
import VoronoiHelpers from "./voronoi-helpers";

@@ -51,12 +55,20 @@

onMouseLeave: (evt, targetProps) => {
return props.disable ? {} : VoronoiHelpers.onMouseLeave(evt, targetProps);
return props.disable
? {}
: VoronoiHelpers.onMouseLeave(evt, targetProps);
},
onTouchCancel: (evt, targetProps) => {
return props.disable ? {} : VoronoiHelpers.onMouseLeave(evt, targetProps);
return props.disable
? {}
: VoronoiHelpers.onMouseLeave(evt, targetProps);
},
onMouseMove: (evt, targetProps) => {
return props.disable ? {} : VoronoiHelpers.onMouseMove(evt, targetProps);
return props.disable
? {}
: VoronoiHelpers.onMouseMove(evt, targetProps);
},
onTouchMove: (evt, targetProps) => {
return props.disable ? {} : VoronoiHelpers.onMouseMove(evt, targetProps);
return props.disable
? {}
: VoronoiHelpers.onMouseMove(evt, targetProps);
}

@@ -99,3 +111,6 @@ }

if (!voronoiDimension || points.length < 2) {
return { ...basePosition, center: defaults({}, labelProps.center, center) };
return {
...basePosition,
center: defaults({}, labelProps.center, center)
};
}

@@ -112,7 +127,13 @@

const componentProps = labelComponent.props || {};
const themeStyles = theme && theme.voronoi && theme.voronoi.style ? theme.voronoi.style : {};
const themeStyles =
theme && theme.voronoi && theme.voronoi.style
? theme.voronoi.style
: {};
const componentStyleArray =
type === "flyout" ? componentProps.flyoutStyle : componentProps.style;
return points.reduce((memo, datum, index) => {
const labelProps = defaults({}, componentProps, { datum, active: true });
const labelProps = defaults({}, componentProps, {
datum,
active: true
});
const text = isFunction(labels) ? labels(labelProps) : undefined;

@@ -128,3 +149,5 @@ const textArray = text !== undefined ? `${text}`.split("\n") : [];

);
const styleArray = textArray.length ? textArray.map(() => style) : [style];
const styleArray = textArray.length
? textArray.map(() => style)
: [style];
memo = memo.concat(styleArray);

@@ -142,3 +165,5 @@ return memo;

const defaultOrientation = y < 0 ? "bottom" : "top";
const labelOrientation = horizontal ? defaultHorizontalOrientation : defaultOrientation;
const labelOrientation = horizontal
? defaultHorizontalOrientation
: defaultOrientation;
const orientation = mouseFollowTooltips ? undefined : labelOrientation;

@@ -148,3 +173,4 @@ return {

pointerLength: multiPoint ? 0 : undefined,
constrainToVisibleArea: multiPoint || mouseFollowTooltips ? true : undefined
constrainToVisibleArea:
multiPoint || mouseFollowTooltips ? true : undefined
};

@@ -157,3 +183,6 @@ }

const text = points.reduce((memo, datum) => {
const labelProps = defaults({}, componentProps, { datum, active: true });
const labelProps = defaults({}, componentProps, {
datum,
active: true
});
const t = isFunction(labels) ? labels(labelProps) : null;

@@ -170,3 +199,4 @@ if (t === null || t === undefined) {

const { childName, eventKey, style, continuous, ...datum } = points[0];
const name = props.name === childName ? childName : `${props.name}-${childName}`;
const name =
props.name === childName ? childName : `${props.name}-${childName}`;
const labelProps = defaults(

@@ -205,4 +235,8 @@ {

const { text } = labelProps;
const showLabel = Array.isArray(text) ? text.filter(Boolean).length : text;
return showLabel ? React.cloneElement(labelComponent, labelProps) : null;
const showLabel = Array.isArray(text)
? text.filter(Boolean).length
: text;
return showLabel
? React.cloneElement(labelComponent, labelProps)
: null;
} else {

@@ -215,3 +249,6 @@ return null;

getChildren(props) {
return [...React.Children.toArray(props.children), this.getTooltip(props)];
return [
...React.Children.toArray(props.children),
this.getTooltip(props)
];
}

@@ -218,0 +255,0 @@ };

import { Collection, Selection, Data, Helpers } from "victory-core";
import { assign, throttle, isFunction, isEmpty, includes, isString, isRegExp } from "lodash";
import {
assign,
throttle,
isFunction,
isEmpty,
includes,
isString,
isRegExp
} from "lodash";
import isEqual from "react-fast-compare";

@@ -13,3 +21,4 @@ import Delaunay from "delaunay-find/lib/index.js";

if (polar) {
const distanceSquared = Math.pow(x - origin.x, 2) + Math.pow(y - origin.y, 2);
const distanceSquared =
Math.pow(x - origin.x, 2) + Math.pow(y - origin.y, 2);
const radius = Math.max(...scale.y.range());

@@ -71,7 +80,13 @@ return distanceSquared < Math.pow(radius, 2);

const isRegExpMatch = blacklistRegExp.some((regExp) => regExp.test(name));
if (!Data.isDataComponent(child) || includes(blacklistStr, name) || isRegExpMatch) {
if (
!Data.isDataComponent(child) ||
includes(blacklistStr, name) ||
isRegExpMatch
) {
return null;
}
const getChildData =
child.type && isFunction(child.type.getData) ? child.type.getData : getData;
child.type && isFunction(child.type.getData)
? child.type.getData
: getData;
const childData = getChildData(child.props);

@@ -98,3 +113,4 @@ return childData ? addMeta(childData, name, child) : null;

const { x, y } = mousePosition;
const distanceSquared = Math.pow(x - point[0], 2) + Math.pow(y - point[1], 2);
const distanceSquared =
Math.pow(x - point[0], 2) + Math.pow(y - point[1], 2);
return distanceSquared < Math.pow(radius, 2);

@@ -111,4 +127,10 @@ },

const index = delaunay.find(mousePosition.x, mousePosition.y);
const withinRadius = this.withinRadius(scaledData[index], mousePosition, props.radius);
const points = withinRadius ? this.findPoints(datasets, datasets[index]) : [];
const withinRadius = this.withinRadius(
scaledData[index],
mousePosition,
props.radius
);
const points = withinRadius
? this.findPoints(datasets, datasets[index])
: [];
return { points, index };

@@ -124,3 +146,6 @@ },

const defaultTarget = activateData ? ["data"] : [];
const targets = labels && !activateLabels ? defaultTarget : defaultTarget.concat("labels");
const targets =
labels && !activateLabels
? defaultTarget
: defaultTarget.concat("labels");
if (isEmpty(targets)) {

@@ -130,3 +155,4 @@ return [];

return targets.map((target) => {
const eventKey = continuous === true && target === "data" ? "all" : point.eventKey;
const eventKey =
continuous === true && target === "data" ? "all" : point.eventKey;
return {

@@ -148,3 +174,6 @@ childName,

const defaultTarget = activateData ? ["data"] : [];
const targets = labels && !activateLabels ? defaultTarget : defaultTarget.concat("labels");
const targets =
labels && !activateLabels
? defaultTarget
: defaultTarget.concat("labels");
if (isEmpty(targets)) {

@@ -191,3 +220,5 @@ return [];

const inactiveMutations = activePoints.length
? activePoints.map((point) => this.getInactiveMutations(targetProps, point))
? activePoints.map((point) =>
this.getInactiveMutations(targetProps, point)
)
: [];

@@ -205,8 +236,20 @@ return this.getParentMutation([]).concat(...inactiveMutations);

const inactiveMutations = activePoints.length
? activePoints.map((point) => this.getInactiveMutations(targetProps, point))
? activePoints.map((point) =>
this.getInactiveMutations(targetProps, point)
)
: [];
return this.getParentMutation([], mousePosition, parentSVG).concat(...inactiveMutations);
return this.getParentMutation([], mousePosition, parentSVG).concat(
...inactiveMutations
);
}
const { points = [], index } = this.getVoronoiPoints(targetProps, mousePosition);
const parentMutations = this.getParentMutation(points, mousePosition, parentSVG, index);
const { points = [], index } = this.getVoronoiPoints(
targetProps,
mousePosition
);
const parentMutations = this.getParentMutation(
points,
mousePosition,
parentSVG,
index
);
if (activePoints.length && isEqual(points, activePoints)) {

@@ -221,3 +264,5 @@ return parentMutations;

const inactiveMutations = activePoints.length
? activePoints.map((point) => this.getInactiveMutations(targetProps, point))
? activePoints.map((point) =>
this.getInactiveMutations(targetProps, point)
)
: [];

@@ -224,0 +269,0 @@ return parentMutations.concat(...inactiveMutations, ...activeMutations);

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

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