Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

victory-legend

Package Overview
Dependencies
Maintainers
3
Versions
146
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

victory-legend - npm Package Compare versions

Comparing version 35.8.1 to 35.9.0

9

es/index.d.ts

@@ -39,3 +39,6 @@ import * as React from "react";

eventKey?: StringOrNumberOrCallback | string[];
events?: EventPropTypeInterface<VictoryLegendTTargetType, StringOrNumberOrCallback>[];
events?: EventPropTypeInterface<
VictoryLegendTTargetType,
StringOrNumberOrCallback
>[];
gutter?: number | { left: number; right: number };

@@ -45,3 +48,5 @@ itemsPerRow?: number;

rowGutter?: number | Omit<BlockProps, "left" | "right">;
style?: VictoryStyleInterface & { title?: VictoryLabelStyleObject | VictoryLabelStyleObject[] };
style?: VictoryStyleInterface & {
title?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
};
symbolSpacer?: number;

@@ -48,0 +53,0 @@ title?: string | string[];

@@ -39,3 +39,6 @@ import * as React from "react";

eventKey?: StringOrNumberOrCallback | string[];
events?: EventPropTypeInterface<VictoryLegendTTargetType, StringOrNumberOrCallback>[];
events?: EventPropTypeInterface<
VictoryLegendTTargetType,
StringOrNumberOrCallback
>[];
gutter?: number | { left: number; right: number };

@@ -45,3 +48,5 @@ itemsPerRow?: number;

rowGutter?: number | Omit<BlockProps, "left" | "right">;
style?: VictoryStyleInterface & { title?: VictoryLabelStyleObject | VictoryLabelStyleObject[] };
style?: VictoryStyleInterface & {
title?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
};
symbolSpacer?: number;

@@ -48,0 +53,0 @@ title?: string | string[];

{
"name": "victory-legend",
"version": "35.8.1",
"version": "35.9.0",
"description": "Legend Component for Victory",

@@ -24,3 +24,3 @@ "keywords": [

"prop-types": "^15.5.8",
"victory-core": "^35.8.1"
"victory-core": "^35.9.0"
},

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

@@ -6,3 +6,5 @@ import { defaults, assign, groupBy, keys, sum, range, isNil } from "lodash";

const { colorScale } = props;
return typeof colorScale === "string" ? Style.getColorScale(colorScale) : colorScale || [];
return typeof colorScale === "string"
? Style.getColorScale(colorScale)
: colorScale || [];
};

@@ -33,3 +35,4 @@

const { orientation, theme } = props;
const defaultStyles = theme && theme.legend && theme.legend.style ? theme.legend.style : {};
const defaultStyles =
theme && theme.legend && theme.legend.style ? theme.legend.style : {};
const style = getStyles(props, defaultStyles);

@@ -83,3 +86,5 @@ const colorScale = getColorScale(props);

const gutterWidth =
typeof gutter === "object" ? (gutter.left || 0) + (gutter.right || 0) : gutter || 0;
typeof gutter === "object"
? (gutter.left || 0) + (gutter.right || 0)
: gutter || 0;
const dataByColumn = groupBy(data, "column");

@@ -99,3 +104,5 @@ const columns = keys(dataByColumn);

const gutterHeight =
typeof gutter === "object" ? (gutter.top || 0) + (gutter.bottom || 0) : gutter || 0;
typeof gutter === "object"
? (gutter.top || 0) + (gutter.bottom || 0)
: gutter || 0;
const dataByRow = groupBy(data, "row");

@@ -116,3 +123,6 @@ return keys(dataByRow).reduce((memo, curr, index) => {

const padding = style.padding || 0;
return { height: textSize.height + 2 * padding || 0, width: textSize.width + 2 * padding || 0 };
return {
height: textSize.height + 2 * padding || 0,
width: textSize.width + 2 * padding || 0
};
};

@@ -140,3 +150,4 @@

if (centerTitle) {
const horizontal = titleOrientation === "top" || titleOrientation === "bottom";
const horizontal =
titleOrientation === "top" || titleOrientation === "bottom";
return {

@@ -154,3 +165,4 @@ textAnchor: horizontal ? "middle" : standardAnchors.textAnchor,

const baseStyle = (props.style && props.style.title) || {};
const componentStyle = (titleComponent.props && titleComponent.props.style) || {};
const componentStyle =
(titleComponent.props && titleComponent.props.style) || {};
const anchors = getAnchors(titleOrientation, centerTitle);

@@ -168,3 +180,4 @@ return Array.isArray(componentStyle)

const padding = Array.isArray(style) ? style[0].padding : style.padding;
const horizontal = titleOrientation === "top" || titleOrientation === "bottom";
const horizontal =
titleOrientation === "top" || titleOrientation === "bottom";
const xOrientation = titleOrientation === "bottom" ? "bottom" : "top";

@@ -183,4 +196,10 @@ const yOrientation = titleOrientation === "right" ? "right" : "left";

return {
x: titleOrientation === "right" ? props.x + width - xOffset : props.x + xOffset,
y: titleOrientation === "bottom" ? props.y + height - yOffset : props.y + yOffset,
x:
titleOrientation === "right"
? props.x + width - xOffset
: props.x + xOffset,
y:
titleOrientation === "bottom"
? props.y + height - yOffset
: props.y + yOffset,
style,

@@ -193,3 +212,4 @@ text: title

const { x, y, borderPadding, style } = props;
const height = (contentHeight || 0) + borderPadding.top + borderPadding.bottom;
const height =
(contentHeight || 0) + borderPadding.top + borderPadding.bottom;
const width = (contentWidth || 0) + borderPadding.left + borderPadding.right;

@@ -206,3 +226,5 @@ return { x, y, height, width, style: assign({ fill: "none" }, style.border) };

const rowHeights = getRowHeights(props, groupedData);
const titleDimensions = title ? getTitleDimensions(props) : { height: 0, width: 0 };
const titleDimensions = title
? getTitleDimensions(props)
: { height: 0, width: 0 };

@@ -244,3 +266,5 @@ return {

const labelStyles = getLabelStyles(props);
const titleDimensions = title ? getTitleDimensions(props) : { height: 0, width: 0 };
const titleDimensions = title
? getTitleDimensions(props)
: { height: 0, width: 0 };
const titleOffset = {

@@ -247,0 +271,0 @@ x: titleOrientation === "left" ? titleDimensions.width : 0,

@@ -39,3 +39,6 @@ import * as React from "react";

eventKey?: StringOrNumberOrCallback | string[];
events?: EventPropTypeInterface<VictoryLegendTTargetType, StringOrNumberOrCallback>[];
events?: EventPropTypeInterface<
VictoryLegendTTargetType,
StringOrNumberOrCallback
>[];
gutter?: number | { left: number; right: number };

@@ -45,3 +48,5 @@ itemsPerRow?: number;

rowGutter?: number | Omit<BlockProps, "left" | "right">;
style?: VictoryStyleInterface & { title?: VictoryLabelStyleObject | VictoryLabelStyleObject[] };
style?: VictoryStyleInterface & {
title?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
};
symbolSpacer?: number;

@@ -48,0 +53,0 @@ title?: string | string[];

@@ -67,3 +67,6 @@ import React from "react";

PropTypes.func,
CustomPropTypes.allOfType([CustomPropTypes.integer, CustomPropTypes.nonNegative]),
CustomPropTypes.allOfType([
CustomPropTypes.integer,
CustomPropTypes.nonNegative
]),
PropTypes.string

@@ -76,3 +79,6 @@ ]),

PropTypes.array,
CustomPropTypes.allOfType([CustomPropTypes.integer, CustomPropTypes.nonNegative]),
CustomPropTypes.allOfType([
CustomPropTypes.integer,
CustomPropTypes.nonNegative
]),
PropTypes.string

@@ -89,3 +95,6 @@ ]),

PropTypes.array,
CustomPropTypes.allOfType([CustomPropTypes.integer, CustomPropTypes.nonNegative]),
CustomPropTypes.allOfType([
CustomPropTypes.integer,
CustomPropTypes.nonNegative
]),
PropTypes.string

@@ -188,3 +197,7 @@ ]),

}
const labelProps = this.getComponentProps(labelComponent, "labels", index);
const labelProps = this.getComponentProps(
labelComponent,
"labels",
index
);
if (labelProps.text !== undefined && labelProps.text !== null) {

@@ -196,8 +209,23 @@ return React.cloneElement(labelComponent, labelProps);

.filter(Boolean);
const borderProps = this.getComponentProps(props.borderComponent, "border", "all");
const borderComponent = React.cloneElement(props.borderComponent, borderProps);
const borderProps = this.getComponentProps(
props.borderComponent,
"border",
"all"
);
const borderComponent = React.cloneElement(
props.borderComponent,
borderProps
);
if (title) {
const titleProps = this.getComponentProps(props.title, "title", "all");
const titleComponent = React.cloneElement(props.titleComponent, titleProps);
return [borderComponent, ...dataComponents, titleComponent, ...labelComponents];
const titleComponent = React.cloneElement(
props.titleComponent,
titleProps
);
return [
borderComponent,
...dataComponents,
titleComponent,
...labelComponents
];
}

@@ -204,0 +232,0 @@ return [borderComponent, ...dataComponents, ...labelComponents];

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

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

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