victory-chart 37.3.2 → 37.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { Helpers } from "victory-core";
2
3
  export declare function getBackgroundWithProps(props: any, calculatedProps: any): React.DetailedReactHTMLElement<any, HTMLElement>;
3
4
  export declare function getCalculatedProps(initialProps: any, childComponents: any): {
4
5
  categories: {
@@ -29,12 +30,7 @@ export declare function getCalculatedProps(initialProps: any, childComponents: a
29
30
  x: number | Date;
30
31
  y: number | Date;
31
32
  };
32
- padding: {
33
- top: any;
34
- bottom: any;
35
- left: any;
36
- right: any;
37
- };
33
+ padding: Helpers.ElementPadding;
38
34
  };
39
35
  export declare function getChildren(props: any, childComponents: any, calculatedProps: any): any;
40
36
  export declare const getChildComponents: (props: any, defaultAxes?: any) => (string | number | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment | React.ReactPortal)[];
@@ -1,6 +1,6 @@
1
- import _defaults from "lodash/defaults";
2
1
  import React from "react";
3
2
  import { Helpers, Scale, Axis, Wrapper } from "victory-core";
3
+ import defaults from "lodash/defaults";
4
4
  const fallbackProps = {
5
5
  width: 450,
6
6
  height: 300,
@@ -44,7 +44,7 @@ export function getBackgroundWithProps(props, calculatedProps) {
44
44
  key: `${parentName}-background`,
45
45
  width
46
46
  };
47
- return /*#__PURE__*/React.cloneElement(backgroundElement, _defaults({}, backgroundElement.props, backgroundProps));
47
+ return /*#__PURE__*/React.cloneElement(backgroundElement, defaults({}, backgroundElement.props, backgroundProps));
48
48
  }
49
49
  function getChildProps(child, props, calculatedProps) {
50
50
  const axisChild = Axis.findAxisComponents([child]);
@@ -71,7 +71,7 @@ function getChildProps(child, props, calculatedProps) {
71
71
  function getStyles(props) {
72
72
  const styleProps = props.style && props.style.parent;
73
73
  return {
74
- parent: _defaults({}, styleProps, {
74
+ parent: defaults({}, styleProps, {
75
75
  height: "100%",
76
76
  width: "100%",
77
77
  userSelect: "none"
@@ -109,7 +109,7 @@ export function getCalculatedProps(initialProps, childComponents) {
109
109
  y: baseScale.y.domain(domain.y).range(horizontal ? range.x : range.y)
110
110
  };
111
111
  const origin = polar ? Helpers.getPolarOrigin(props) : Axis.getOrigin(domain);
112
- const padding = Helpers.getPadding(props);
112
+ const padding = Helpers.getPadding(props.padding);
113
113
  return {
114
114
  categories,
115
115
  domain,
@@ -139,12 +139,12 @@ export function getChildren(props, childComponents, calculatedProps) {
139
139
  const parentName = props.name || "chart";
140
140
  return children.filter(React.isValidElement).map((child, index) => {
141
141
  const role = child.type && child.type.role;
142
- const style = Array.isArray(child.props.style) ? child.props.style : _defaults({}, child.props.style, {
142
+ const style = Array.isArray(child.props.style) ? child.props.style : defaults({}, child.props.style, {
143
143
  parent: baseStyle
144
144
  });
145
145
  const childProps = getChildProps(child, props, newCalculatedProps);
146
146
  const name = child.props.name || `${parentName}-${role}-${index}`;
147
- const newProps = _defaults({
147
+ const newProps = defaults({
148
148
  horizontal,
149
149
  height,
150
150
  polar,
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { CategoryPropType, DomainPropType, EventPropTypeInterface, StringOrNumberOrCallback, VictoryCommonProps, VictoryStyleInterface, VictoryStyleObject } from "victory-core";
3
3
  export declare const VictoryChart: React.NamedExoticComponent<VictoryChartProps>;
4
- export declare type AxesType = {
4
+ export type AxesType = {
5
5
  dependent?: React.ReactElement | null;
6
6
  independent?: React.ReactElement | null;
7
7
  };
@@ -1,6 +1,6 @@
1
- import _isEmpty from "lodash/isEmpty";
2
- import _defaults from "lodash/defaults";
3
1
  import React from "react";
2
+ import defaults from "lodash/defaults";
3
+ import isEmpty from "lodash/isEmpty";
4
4
  import { Background, Helpers, Hooks, UserProps, VictoryContainer, VictoryTheme, Wrapper } from "victory-core";
5
5
  import { VictorySharedEvents } from "victory-shared-events";
6
6
  import { VictoryAxis } from "victory-axis";
@@ -32,7 +32,7 @@ const defaultProps = {
32
32
  theme: VictoryTheme.grayscale
33
33
  };
34
34
  const VictoryChartImpl = initialProps => {
35
- const propsWithDefaults = React.useMemo(() => _defaults({}, initialProps, defaultProps), [initialProps]);
35
+ const propsWithDefaults = React.useMemo(() => defaults({}, initialProps, defaultProps), [initialProps]);
36
36
  const role = "chart";
37
37
  const {
38
38
  getAnimationProps,
@@ -101,7 +101,7 @@ const VictoryChartImpl = initialProps => {
101
101
  }, [desc, domain, height, horizontal, name, origin, polar, scale, standalone, style, title, theme, width]);
102
102
  const container = React.useMemo(() => {
103
103
  if (standalone) {
104
- const defaultContainerProps = _defaults({}, containerComponent.props, containerProps, UserProps.getSafeUserProps(propsWithDefaults));
104
+ const defaultContainerProps = defaults({}, containerComponent.props, containerProps, UserProps.getSafeUserProps(propsWithDefaults));
105
105
  return /*#__PURE__*/React.cloneElement(containerComponent, defaultContainerProps);
106
106
  }
107
107
  return groupComponent;
@@ -118,7 +118,7 @@ const VictoryChartImpl = initialProps => {
118
118
  }
119
119
  };
120
120
  }, [setAnimationState, previousProps, propsWithDefaults]);
121
- if (!_isEmpty(events)) {
121
+ if (!isEmpty(events)) {
122
122
  return /*#__PURE__*/React.createElement(VictorySharedEvents, {
123
123
  container: container,
124
124
  eventKey: eventKey,
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { Helpers } from "victory-core";
2
3
  export declare function getBackgroundWithProps(props: any, calculatedProps: any): React.DetailedReactHTMLElement<any, HTMLElement>;
3
4
  export declare function getCalculatedProps(initialProps: any, childComponents: any): {
4
5
  categories: {
@@ -29,12 +30,7 @@ export declare function getCalculatedProps(initialProps: any, childComponents: a
29
30
  x: number | Date;
30
31
  y: number | Date;
31
32
  };
32
- padding: {
33
- top: any;
34
- bottom: any;
35
- left: any;
36
- right: any;
37
- };
33
+ padding: Helpers.ElementPadding;
38
34
  };
39
35
  export declare function getChildren(props: any, childComponents: any, calculatedProps: any): any;
40
36
  export declare const getChildComponents: (props: any, defaultAxes?: any) => (string | number | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment | React.ReactPortal)[];
@@ -7,9 +7,9 @@ exports.getBackgroundWithProps = getBackgroundWithProps;
7
7
  exports.getCalculatedProps = getCalculatedProps;
8
8
  exports.getChildComponents = void 0;
9
9
  exports.getChildren = getChildren;
10
- var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
11
10
  var _react = _interopRequireDefault(require("react"));
12
11
  var _victoryCore = require("victory-core");
12
+ var _defaults = _interopRequireDefault(require("lodash/defaults"));
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
14
  const fallbackProps = {
15
15
  width: 450,
@@ -54,7 +54,7 @@ function getBackgroundWithProps(props, calculatedProps) {
54
54
  key: `${parentName}-background`,
55
55
  width
56
56
  };
57
- return /*#__PURE__*/_react.default.cloneElement(backgroundElement, (0, _defaults2.default)({}, backgroundElement.props, backgroundProps));
57
+ return /*#__PURE__*/_react.default.cloneElement(backgroundElement, (0, _defaults.default)({}, backgroundElement.props, backgroundProps));
58
58
  }
59
59
  function getChildProps(child, props, calculatedProps) {
60
60
  const axisChild = _victoryCore.Axis.findAxisComponents([child]);
@@ -81,7 +81,7 @@ function getChildProps(child, props, calculatedProps) {
81
81
  function getStyles(props) {
82
82
  const styleProps = props.style && props.style.parent;
83
83
  return {
84
- parent: (0, _defaults2.default)({}, styleProps, {
84
+ parent: (0, _defaults.default)({}, styleProps, {
85
85
  height: "100%",
86
86
  width: "100%",
87
87
  userSelect: "none"
@@ -119,7 +119,7 @@ function getCalculatedProps(initialProps, childComponents) {
119
119
  y: baseScale.y.domain(domain.y).range(horizontal ? range.x : range.y)
120
120
  };
121
121
  const origin = polar ? _victoryCore.Helpers.getPolarOrigin(props) : _victoryCore.Axis.getOrigin(domain);
122
- const padding = _victoryCore.Helpers.getPadding(props);
122
+ const padding = _victoryCore.Helpers.getPadding(props.padding);
123
123
  return {
124
124
  categories,
125
125
  domain,
@@ -149,12 +149,12 @@ function getChildren(props, childComponents, calculatedProps) {
149
149
  const parentName = props.name || "chart";
150
150
  return children.filter(_react.default.isValidElement).map((child, index) => {
151
151
  const role = child.type && child.type.role;
152
- const style = Array.isArray(child.props.style) ? child.props.style : (0, _defaults2.default)({}, child.props.style, {
152
+ const style = Array.isArray(child.props.style) ? child.props.style : (0, _defaults.default)({}, child.props.style, {
153
153
  parent: baseStyle
154
154
  });
155
155
  const childProps = getChildProps(child, props, newCalculatedProps);
156
156
  const name = child.props.name || `${parentName}-${role}-${index}`;
157
- const newProps = (0, _defaults2.default)({
157
+ const newProps = (0, _defaults.default)({
158
158
  horizontal,
159
159
  height,
160
160
  polar,
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { CategoryPropType, DomainPropType, EventPropTypeInterface, StringOrNumberOrCallback, VictoryCommonProps, VictoryStyleInterface, VictoryStyleObject } from "victory-core";
3
3
  export declare const VictoryChart: React.NamedExoticComponent<VictoryChartProps>;
4
- export declare type AxesType = {
4
+ export type AxesType = {
5
5
  dependent?: React.ReactElement | null;
6
6
  independent?: React.ReactElement | null;
7
7
  };
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.VictoryChart = void 0;
7
- var _isEmpty2 = _interopRequireDefault(require("lodash/isEmpty"));
8
- var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
9
7
  var _react = _interopRequireDefault(require("react"));
8
+ var _defaults = _interopRequireDefault(require("lodash/defaults"));
9
+ var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
10
10
  var _victoryCore = require("victory-core");
11
11
  var _victorySharedEvents = require("victory-shared-events");
12
12
  var _victoryAxis = require("victory-axis");
@@ -39,7 +39,7 @@ const defaultProps = {
39
39
  theme: _victoryCore.VictoryTheme.grayscale
40
40
  };
41
41
  const VictoryChartImpl = initialProps => {
42
- const propsWithDefaults = _react.default.useMemo(() => (0, _defaults2.default)({}, initialProps, defaultProps), [initialProps]);
42
+ const propsWithDefaults = _react.default.useMemo(() => (0, _defaults.default)({}, initialProps, defaultProps), [initialProps]);
43
43
  const role = "chart";
44
44
  const {
45
45
  getAnimationProps,
@@ -108,7 +108,7 @@ const VictoryChartImpl = initialProps => {
108
108
  }, [desc, domain, height, horizontal, name, origin, polar, scale, standalone, style, title, theme, width]);
109
109
  const container = _react.default.useMemo(() => {
110
110
  if (standalone) {
111
- const defaultContainerProps = (0, _defaults2.default)({}, containerComponent.props, containerProps, _victoryCore.UserProps.getSafeUserProps(propsWithDefaults));
111
+ const defaultContainerProps = (0, _defaults.default)({}, containerComponent.props, containerProps, _victoryCore.UserProps.getSafeUserProps(propsWithDefaults));
112
112
  return /*#__PURE__*/_react.default.cloneElement(containerComponent, defaultContainerProps);
113
113
  }
114
114
  return groupComponent;
@@ -125,7 +125,7 @@ const VictoryChartImpl = initialProps => {
125
125
  }
126
126
  };
127
127
  }, [setAnimationState, previousProps, propsWithDefaults]);
128
- if (!(0, _isEmpty2.default)(events)) {
128
+ if (!(0, _isEmpty.default)(events)) {
129
129
  return /*#__PURE__*/_react.default.createElement(_victorySharedEvents.VictorySharedEvents, {
130
130
  container: container,
131
131
  eventKey: eventKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "victory-chart",
3
- "version": "37.3.2",
3
+ "version": "37.3.4",
4
4
  "description": "Chart Component for Victory",
5
5
  "keywords": [
6
6
  "data visualization",
@@ -22,10 +22,10 @@
22
22
  "dependencies": {
23
23
  "lodash": "^4.17.19",
24
24
  "react-fast-compare": "^3.2.0",
25
- "victory-axis": "37.3.2",
26
- "victory-core": "37.3.2",
27
- "victory-polar-axis": "37.3.2",
28
- "victory-shared-events": "37.3.2"
25
+ "victory-axis": "37.3.4",
26
+ "victory-core": "37.3.4",
27
+ "victory-polar-axis": "37.3.4",
28
+ "victory-shared-events": "37.3.4"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "react": ">=16.6.0"
@@ -202,32 +202,6 @@
202
202
  "pnpm-lock.yaml"
203
203
  ]
204
204
  },
205
- "format": {
206
- "command": "nps format:pkg",
207
- "files": [
208
- "src/**",
209
- "*.json",
210
- "../../.prettierignore",
211
- "../../.prettierrc.json"
212
- ],
213
- "output": [],
214
- "packageLocks": [
215
- "pnpm-lock.yaml"
216
- ]
217
- },
218
- "format:fix": {
219
- "command": "pnpm run format || nps format:pkg:fix",
220
- "files": [
221
- "src/**",
222
- "*.json",
223
- "../../.prettierignore",
224
- "../../.prettierrc.json"
225
- ],
226
- "output": [],
227
- "packageLocks": [
228
- "pnpm-lock.yaml"
229
- ]
230
- },
231
205
  "lint": {
232
206
  "command": "eslint src",
233
207
  "files": [
@@ -299,8 +273,6 @@
299
273
  "check": "wireit",
300
274
  "types:check": "wireit",
301
275
  "types:create": "wireit",
302
- "format": "wireit",
303
- "format:fix": "wireit",
304
276
  "lint": "wireit",
305
277
  "lint:fix": "wireit",
306
278
  "jest": "wireit"
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { Helpers, Scale, Axis, Wrapper } from "victory-core";
3
- import { defaults } from "lodash";
3
+ import defaults from "lodash/defaults";
4
4
 
5
5
  const fallbackProps = {
6
6
  width: 450,
@@ -115,7 +115,7 @@ export function getCalculatedProps(initialProps, childComponents) {
115
115
 
116
116
  const origin = polar ? Helpers.getPolarOrigin(props) : Axis.getOrigin(domain);
117
117
 
118
- const padding = Helpers.getPadding(props);
118
+ const padding = Helpers.getPadding(props.padding);
119
119
 
120
120
  return {
121
121
  categories,
@@ -1,5 +1,7 @@
1
- import { defaults, isEmpty } from "lodash";
2
1
  import React from "react";
2
+ import defaults from "lodash/defaults";
3
+ import isEmpty from "lodash/isEmpty";
4
+
3
5
  import {
4
6
  Background,
5
7
  Helpers,