victory-legend
Advanced tools
Comparing version 37.3.2 to 37.3.3
# victory-legend | ||
## 37.3.3 | ||
### Patch Changes | ||
- Remove deprecated babel-plugin-lodash plugin ([#2965](https://github.com/FormidableLabs/victory/pull/2965)) | ||
* Improve types in victory-core helpers ([#2999](https://github.com/FormidableLabs/victory/pull/2999)) | ||
## 37.3.2 | ||
@@ -4,0 +12,0 @@ |
@@ -1,4 +0,4 @@ | ||
import _range from "lodash/range"; | ||
import _groupBy from "lodash/groupBy"; | ||
import _defaults from "lodash/defaults"; | ||
import defaults from "lodash/defaults"; | ||
import groupBy from "lodash/groupBy"; | ||
import range from "lodash/range"; | ||
import { Helpers, Style, TextSize } from "victory-core"; | ||
@@ -18,3 +18,3 @@ const getColorScale = props => { | ||
return data.map((datum, index) => { | ||
const baseLabelStyles = _defaults({}, datum.labels, style.labels); | ||
const baseLabelStyles = defaults({}, datum.labels, style.labels); | ||
return Helpers.evaluateStyle(baseLabelStyles, { | ||
@@ -37,7 +37,7 @@ datum, | ||
return { | ||
parent: _defaults(style.parent, styleObject.parent, parentStyleProps), | ||
data: _defaults({}, style.data, styleObject.data), | ||
labels: _defaults({}, style.labels, styleObject.labels), | ||
border: _defaults({}, style.border, styleObject.border), | ||
title: _defaults({}, style.title, styleObject.title) | ||
parent: defaults(style.parent, styleObject.parent, parentStyleProps), | ||
data: defaults({}, style.data, styleObject.data), | ||
labels: defaults({}, style.labels, styleObject.labels), | ||
border: defaults({}, style.border, styleObject.border), | ||
title: defaults({}, style.title, styleObject.title) | ||
}; | ||
@@ -54,5 +54,3 @@ }; | ||
const isHorizontal = orientation === "horizontal"; | ||
const borderPadding = Helpers.getPadding({ | ||
padding: props.borderPadding | ||
}); | ||
const borderPadding = Helpers.getPadding(props.borderPadding); | ||
return Object.assign({}, props, { | ||
@@ -113,3 +111,3 @@ style, | ||
const gutterWidth = typeof gutter === "object" ? (gutter.left || 0) + (gutter.right || 0) : gutter || 0; | ||
const dataByColumn = _groupBy(data, "column"); | ||
const dataByColumn = groupBy(data, "column"); | ||
const columns = Object.keys(dataByColumn); | ||
@@ -127,3 +125,3 @@ return columns.reduce((memo, curr, index) => { | ||
const gutterHeight = typeof gutter === "object" ? (gutter.top || 0) + (gutter.bottom || 0) : gutter || 0; | ||
const dataByRow = _groupBy(data, "row"); | ||
const dataByRow = groupBy(data, "row"); | ||
return Object.keys(dataByRow).reduce((memo, curr, index) => { | ||
@@ -153,4 +151,4 @@ const rows = dataByRow[curr]; | ||
return { | ||
x: _range(column).reduce((memo, curr) => memo + columnWidths[curr], 0), | ||
y: _range(row).reduce((memo, curr) => memo + rowHeights[curr], 0) | ||
x: range(column).reduce((memo, curr) => memo + columnWidths[curr], 0), | ||
y: range(row).reduce((memo, curr) => memo + rowHeights[curr], 0) | ||
}; | ||
@@ -181,3 +179,3 @@ }; | ||
const anchors = getAnchors(titleOrientation, centerTitle); | ||
return Array.isArray(componentStyle) ? componentStyle.map(obj => _defaults({}, obj, baseStyle, anchors)) : _defaults({}, componentStyle, baseStyle, anchors); | ||
return Array.isArray(componentStyle) ? componentStyle.map(obj => defaults({}, obj, baseStyle, anchors)) : defaults({}, componentStyle, baseStyle, anchors); | ||
}; | ||
@@ -313,3 +311,3 @@ const getTitleProps = (props, borderProps) => { | ||
const color = colorScale[i % colorScale.length]; | ||
const dataStyle = _defaults({}, datum.symbol, style.data, { | ||
const dataStyle = defaults({}, datum.symbol, style.data, { | ||
fill: color | ||
@@ -316,0 +314,0 @@ }); |
import React from "react"; | ||
import { BlockProps, ColorScalePropType, EventPropTypeInterface, OrientationTypes, PaddingProps, StringOrNumberOrCallback, VictoryCommonProps, VictoryDatableProps, VictorySingleLabelableProps, VictoryStyleInterface, VictoryLabelStyleObject, EventsMixinClass } from "victory-core"; | ||
export declare type VictoryLegendTTargetType = "data" | "labels" | "parent"; | ||
export declare type VictoryLegendOrientationType = "horizontal" | "vertical"; | ||
export type VictoryLegendTTargetType = "data" | "labels" | "parent"; | ||
export type VictoryLegendOrientationType = "horizontal" | "vertical"; | ||
export interface VictoryLegendProps extends VictoryCommonProps, VictoryDatableProps, VictorySingleLabelableProps { | ||
@@ -81,5 +81,5 @@ borderComponent?: React.ReactElement; | ||
renderContainer(component: any, children: any): React.DetailedReactHTMLElement<any, HTMLElement>; | ||
animateComponent(props: import("victory-core").EventMixinCommonProps, defaultAnimationWhitelist: string[]): React.ReactElement<any, string | React.JSXElementConstructor<any>>; | ||
animateComponent(props: import("victory-core").EventMixinCommonProps, defaultAnimationWhitelist: string[]): React.ReactElement; | ||
renderContinuousData(props: import("victory-core").EventMixinCommonProps): React.DetailedReactHTMLElement<any, HTMLElement>; | ||
renderData(props: any, shouldRenderDatum?: ((datum: any) => boolean) | undefined): React.DetailedReactHTMLElement<any, HTMLElement>; | ||
renderData(props: any, shouldRenderDatum?: (datum: any) => boolean): React.DetailedReactHTMLElement<any, HTMLElement>; | ||
context: unknown; | ||
@@ -101,3 +101,3 @@ setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<import("victory-core").EventMixinCommonProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void; | ||
UNSAFE_componentWillUpdate?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextState: Readonly<{}>, nextContext: any): void; | ||
componentEvents: import("@/victory-core/lib/victory-util/events").ComponentEvent[]; | ||
componentEvents: Array<import("@/victory-core/lib/victory-util/events").ComponentEvent>; | ||
getSharedEventState: (key: string, value: string) => unknown; | ||
@@ -109,6 +109,6 @@ baseProps: Record<string, object>; | ||
}; | ||
getBaseProps?(props: import("victory-core").EventMixinCommonProps): Record<string, object>; | ||
role?: string | undefined; | ||
getBaseProps?(props: import("victory-core").EventMixinCommonProps): import("victory-core").EventMixinCalculatedValues["baseProps"]; | ||
role?: import("victory-core").VictoryComponentRole; | ||
expectedComponents?: string[] | undefined; | ||
getChildren?: ((props: import("victory-core").EventMixinCommonProps, childComponents?: React.ReactNode[] | undefined, calculatedProps?: import("victory-core").EventMixinCommonProps | undefined) => void) | undefined; | ||
getChildren?: ((props: import("victory-core").EventMixinCommonProps, childComponents?: Array<React.ReactNode>, calculatedProps?: import("victory-core").EventMixinCommonProps | undefined) => void) | undefined; | ||
animationWhitelist?: string[] | undefined; | ||
@@ -115,0 +115,0 @@ } & typeof VictoryLegendBase; |
@@ -7,5 +7,5 @@ "use strict"; | ||
exports.getDimensions = exports.getBaseProps = void 0; | ||
var _range2 = _interopRequireDefault(require("lodash/range")); | ||
var _groupBy2 = _interopRequireDefault(require("lodash/groupBy")); | ||
var _defaults2 = _interopRequireDefault(require("lodash/defaults")); | ||
var _defaults = _interopRequireDefault(require("lodash/defaults")); | ||
var _groupBy = _interopRequireDefault(require("lodash/groupBy")); | ||
var _range = _interopRequireDefault(require("lodash/range")); | ||
var _victoryCore = require("victory-core"); | ||
@@ -26,3 +26,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
return data.map((datum, index) => { | ||
const baseLabelStyles = (0, _defaults2.default)({}, datum.labels, style.labels); | ||
const baseLabelStyles = (0, _defaults.default)({}, datum.labels, style.labels); | ||
return _victoryCore.Helpers.evaluateStyle(baseLabelStyles, { | ||
@@ -45,7 +45,7 @@ datum, | ||
return { | ||
parent: (0, _defaults2.default)(style.parent, styleObject.parent, parentStyleProps), | ||
data: (0, _defaults2.default)({}, style.data, styleObject.data), | ||
labels: (0, _defaults2.default)({}, style.labels, styleObject.labels), | ||
border: (0, _defaults2.default)({}, style.border, styleObject.border), | ||
title: (0, _defaults2.default)({}, style.title, styleObject.title) | ||
parent: (0, _defaults.default)(style.parent, styleObject.parent, parentStyleProps), | ||
data: (0, _defaults.default)({}, style.data, styleObject.data), | ||
labels: (0, _defaults.default)({}, style.labels, styleObject.labels), | ||
border: (0, _defaults.default)({}, style.border, styleObject.border), | ||
title: (0, _defaults.default)({}, style.title, styleObject.title) | ||
}; | ||
@@ -62,5 +62,3 @@ }; | ||
const isHorizontal = orientation === "horizontal"; | ||
const borderPadding = _victoryCore.Helpers.getPadding({ | ||
padding: props.borderPadding | ||
}); | ||
const borderPadding = _victoryCore.Helpers.getPadding(props.borderPadding); | ||
return Object.assign({}, props, { | ||
@@ -121,3 +119,3 @@ style, | ||
const gutterWidth = typeof gutter === "object" ? (gutter.left || 0) + (gutter.right || 0) : gutter || 0; | ||
const dataByColumn = (0, _groupBy2.default)(data, "column"); | ||
const dataByColumn = (0, _groupBy.default)(data, "column"); | ||
const columns = Object.keys(dataByColumn); | ||
@@ -135,3 +133,3 @@ return columns.reduce((memo, curr, index) => { | ||
const gutterHeight = typeof gutter === "object" ? (gutter.top || 0) + (gutter.bottom || 0) : gutter || 0; | ||
const dataByRow = (0, _groupBy2.default)(data, "row"); | ||
const dataByRow = (0, _groupBy.default)(data, "row"); | ||
return Object.keys(dataByRow).reduce((memo, curr, index) => { | ||
@@ -161,4 +159,4 @@ const rows = dataByRow[curr]; | ||
return { | ||
x: (0, _range2.default)(column).reduce((memo, curr) => memo + columnWidths[curr], 0), | ||
y: (0, _range2.default)(row).reduce((memo, curr) => memo + rowHeights[curr], 0) | ||
x: (0, _range.default)(column).reduce((memo, curr) => memo + columnWidths[curr], 0), | ||
y: (0, _range.default)(row).reduce((memo, curr) => memo + rowHeights[curr], 0) | ||
}; | ||
@@ -189,3 +187,3 @@ }; | ||
const anchors = getAnchors(titleOrientation, centerTitle); | ||
return Array.isArray(componentStyle) ? componentStyle.map(obj => (0, _defaults2.default)({}, obj, baseStyle, anchors)) : (0, _defaults2.default)({}, componentStyle, baseStyle, anchors); | ||
return Array.isArray(componentStyle) ? componentStyle.map(obj => (0, _defaults.default)({}, obj, baseStyle, anchors)) : (0, _defaults.default)({}, componentStyle, baseStyle, anchors); | ||
}; | ||
@@ -322,3 +320,3 @@ const getTitleProps = (props, borderProps) => { | ||
const color = colorScale[i % colorScale.length]; | ||
const dataStyle = (0, _defaults2.default)({}, datum.symbol, style.data, { | ||
const dataStyle = (0, _defaults.default)({}, datum.symbol, style.data, { | ||
fill: color | ||
@@ -325,0 +323,0 @@ }); |
import React from "react"; | ||
import { BlockProps, ColorScalePropType, EventPropTypeInterface, OrientationTypes, PaddingProps, StringOrNumberOrCallback, VictoryCommonProps, VictoryDatableProps, VictorySingleLabelableProps, VictoryStyleInterface, VictoryLabelStyleObject, EventsMixinClass } from "victory-core"; | ||
export declare type VictoryLegendTTargetType = "data" | "labels" | "parent"; | ||
export declare type VictoryLegendOrientationType = "horizontal" | "vertical"; | ||
export type VictoryLegendTTargetType = "data" | "labels" | "parent"; | ||
export type VictoryLegendOrientationType = "horizontal" | "vertical"; | ||
export interface VictoryLegendProps extends VictoryCommonProps, VictoryDatableProps, VictorySingleLabelableProps { | ||
@@ -81,5 +81,5 @@ borderComponent?: React.ReactElement; | ||
renderContainer(component: any, children: any): React.DetailedReactHTMLElement<any, HTMLElement>; | ||
animateComponent(props: import("victory-core").EventMixinCommonProps, defaultAnimationWhitelist: string[]): React.ReactElement<any, string | React.JSXElementConstructor<any>>; | ||
animateComponent(props: import("victory-core").EventMixinCommonProps, defaultAnimationWhitelist: string[]): React.ReactElement; | ||
renderContinuousData(props: import("victory-core").EventMixinCommonProps): React.DetailedReactHTMLElement<any, HTMLElement>; | ||
renderData(props: any, shouldRenderDatum?: ((datum: any) => boolean) | undefined): React.DetailedReactHTMLElement<any, HTMLElement>; | ||
renderData(props: any, shouldRenderDatum?: (datum: any) => boolean): React.DetailedReactHTMLElement<any, HTMLElement>; | ||
context: unknown; | ||
@@ -101,3 +101,3 @@ setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<import("victory-core").EventMixinCommonProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void; | ||
UNSAFE_componentWillUpdate?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextState: Readonly<{}>, nextContext: any): void; | ||
componentEvents: import("@/victory-core/lib/victory-util/events").ComponentEvent[]; | ||
componentEvents: Array<import("@/victory-core/lib/victory-util/events").ComponentEvent>; | ||
getSharedEventState: (key: string, value: string) => unknown; | ||
@@ -109,6 +109,6 @@ baseProps: Record<string, object>; | ||
}; | ||
getBaseProps?(props: import("victory-core").EventMixinCommonProps): Record<string, object>; | ||
role?: string | undefined; | ||
getBaseProps?(props: import("victory-core").EventMixinCommonProps): import("victory-core").EventMixinCalculatedValues["baseProps"]; | ||
role?: import("victory-core").VictoryComponentRole; | ||
expectedComponents?: string[] | undefined; | ||
getChildren?: ((props: import("victory-core").EventMixinCommonProps, childComponents?: React.ReactNode[] | undefined, calculatedProps?: import("victory-core").EventMixinCommonProps | undefined) => void) | undefined; | ||
getChildren?: ((props: import("victory-core").EventMixinCommonProps, childComponents?: Array<React.ReactNode>, calculatedProps?: import("victory-core").EventMixinCommonProps | undefined) => void) | undefined; | ||
animationWhitelist?: string[] | undefined; | ||
@@ -115,0 +115,0 @@ } & typeof VictoryLegendBase; |
{ | ||
"name": "victory-legend", | ||
"version": "37.3.2", | ||
"version": "37.3.3", | ||
"description": "Legend Component for Victory", | ||
@@ -24,3 +24,3 @@ "keywords": [ | ||
"lodash": "^4.17.19", | ||
"victory-core": "37.3.2" | ||
"victory-core": "37.3.3" | ||
}, | ||
@@ -184,28 +184,2 @@ "peerDependencies": { | ||
}, | ||
"format": { | ||
"command": "nps format:pkg", | ||
"files": [ | ||
"src/**", | ||
"*.json", | ||
"../../.prettierignore", | ||
"../../.prettierrc.json" | ||
], | ||
"output": [], | ||
"packageLocks": [ | ||
"pnpm-lock.yaml" | ||
] | ||
}, | ||
"format:fix": { | ||
"command": "pnpm run format || nps format:pkg:fix", | ||
"files": [ | ||
"src/**", | ||
"*.json", | ||
"../../.prettierignore", | ||
"../../.prettierrc.json" | ||
], | ||
"output": [], | ||
"packageLocks": [ | ||
"pnpm-lock.yaml" | ||
] | ||
}, | ||
"lint": { | ||
@@ -273,4 +247,2 @@ "command": "eslint src", | ||
"types:create": "wireit", | ||
"format": "wireit", | ||
"format:fix": "wireit", | ||
"lint": "wireit", | ||
@@ -277,0 +249,0 @@ "lint:fix": "wireit", |
@@ -1,2 +0,4 @@ | ||
import { defaults, groupBy, range } from "lodash"; | ||
import defaults from "lodash/defaults"; | ||
import groupBy from "lodash/groupBy"; | ||
import range from "lodash/range"; | ||
import { Helpers, Style, TextSize } from "victory-core"; | ||
@@ -39,3 +41,3 @@ import { VictoryLegendProps } from "./victory-legend"; | ||
const isHorizontal = orientation === "horizontal"; | ||
const borderPadding = Helpers.getPadding({ padding: props.borderPadding }); | ||
const borderPadding = Helpers.getPadding(props.borderPadding); | ||
return Object.assign({}, props, { | ||
@@ -42,0 +44,0 @@ style, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
732647
13906
1
+ Addedvictory-core@37.3.3(transitive)
+ Addedvictory-vendor@37.3.3(transitive)
- Removedvictory-core@37.3.2(transitive)
- Removedvictory-vendor@37.3.2(transitive)
Updatedvictory-core@37.3.3