victory-chart 37.3.1 → 37.3.3

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,8 +1,6 @@
1
- import _defaults from "lodash/defaults";
2
- /* eslint-disable no-use-before-define */
3
-
4
1
  import React from "react";
5
2
  import { Helpers, Scale, Axis, Wrapper } from "victory-core";
3
+ import defaults from "lodash/defaults";
6
4
  const fallbackProps = {
7
5
  width: 450,
8
6
  height: 300,
@@ -46,7 +44,7 @@ export function getBackgroundWithProps(props, calculatedProps) {
46
44
  key: `${parentName}-background`,
47
45
  width
48
46
  };
49
- return /*#__PURE__*/React.cloneElement(backgroundElement, _defaults({}, backgroundElement.props, backgroundProps));
47
+ return /*#__PURE__*/React.cloneElement(backgroundElement, defaults({}, backgroundElement.props, backgroundProps));
50
48
  }
51
49
  function getChildProps(child, props, calculatedProps) {
52
50
  const axisChild = Axis.findAxisComponents([child]);
@@ -73,7 +71,7 @@ function getChildProps(child, props, calculatedProps) {
73
71
  function getStyles(props) {
74
72
  const styleProps = props.style && props.style.parent;
75
73
  return {
76
- parent: _defaults({}, styleProps, {
74
+ parent: defaults({}, styleProps, {
77
75
  height: "100%",
78
76
  width: "100%",
79
77
  userSelect: "none"
@@ -111,7 +109,7 @@ export function getCalculatedProps(initialProps, childComponents) {
111
109
  y: baseScale.y.domain(domain.y).range(horizontal ? range.x : range.y)
112
110
  };
113
111
  const origin = polar ? Helpers.getPolarOrigin(props) : Axis.getOrigin(domain);
114
- const padding = Helpers.getPadding(props);
112
+ const padding = Helpers.getPadding(props.padding);
115
113
  return {
116
114
  categories,
117
115
  domain,
@@ -141,12 +139,12 @@ export function getChildren(props, childComponents, calculatedProps) {
141
139
  const parentName = props.name || "chart";
142
140
  return children.filter(React.isValidElement).map((child, index) => {
143
141
  const role = child.type && child.type.role;
144
- 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, {
145
143
  parent: baseStyle
146
144
  });
147
145
  const childProps = getChildProps(child, props, newCalculatedProps);
148
146
  const name = child.props.name || `${parentName}-${role}-${index}`;
149
- const newProps = _defaults({
147
+ const newProps = defaults({
150
148
  horizontal,
151
149
  height,
152
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,12 +7,10 @@ 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
- /* eslint-disable no-use-before-define */
15
-
16
14
  const fallbackProps = {
17
15
  width: 450,
18
16
  height: 300,
@@ -56,7 +54,7 @@ function getBackgroundWithProps(props, calculatedProps) {
56
54
  key: `${parentName}-background`,
57
55
  width
58
56
  };
59
- 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));
60
58
  }
61
59
  function getChildProps(child, props, calculatedProps) {
62
60
  const axisChild = _victoryCore.Axis.findAxisComponents([child]);
@@ -83,7 +81,7 @@ function getChildProps(child, props, calculatedProps) {
83
81
  function getStyles(props) {
84
82
  const styleProps = props.style && props.style.parent;
85
83
  return {
86
- parent: (0, _defaults2.default)({}, styleProps, {
84
+ parent: (0, _defaults.default)({}, styleProps, {
87
85
  height: "100%",
88
86
  width: "100%",
89
87
  userSelect: "none"
@@ -121,7 +119,7 @@ function getCalculatedProps(initialProps, childComponents) {
121
119
  y: baseScale.y.domain(domain.y).range(horizontal ? range.x : range.y)
122
120
  };
123
121
  const origin = polar ? _victoryCore.Helpers.getPolarOrigin(props) : _victoryCore.Axis.getOrigin(domain);
124
- const padding = _victoryCore.Helpers.getPadding(props);
122
+ const padding = _victoryCore.Helpers.getPadding(props.padding);
125
123
  return {
126
124
  categories,
127
125
  domain,
@@ -151,12 +149,12 @@ function getChildren(props, childComponents, calculatedProps) {
151
149
  const parentName = props.name || "chart";
152
150
  return children.filter(_react.default.isValidElement).map((child, index) => {
153
151
  const role = child.type && child.type.role;
154
- 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, {
155
153
  parent: baseStyle
156
154
  });
157
155
  const childProps = getChildProps(child, props, newCalculatedProps);
158
156
  const name = child.props.name || `${parentName}-${role}-${index}`;
159
- const newProps = (0, _defaults2.default)({
157
+ const newProps = (0, _defaults.default)({
160
158
  horizontal,
161
159
  height,
162
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.1",
3
+ "version": "37.3.3",
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.1",
26
- "victory-core": "37.3.1",
27
- "victory-polar-axis": "37.3.1",
28
- "victory-shared-events": "37.3.1"
25
+ "victory-axis": "37.3.3",
26
+ "victory-core": "37.3.3",
27
+ "victory-polar-axis": "37.3.3",
28
+ "victory-shared-events": "37.3.3"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "react": ">=16.6.0"
@@ -202,38 +202,10 @@
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
- "command": "nps lint:pkg",
206
+ "command": "eslint src",
233
207
  "files": [
234
- "src/**",
235
- "../../.eslintignore",
236
- "../../.eslintrc.js"
208
+ "src/**"
237
209
  ],
238
210
  "output": [],
239
211
  "dependencies": [
@@ -249,11 +221,9 @@
249
221
  ]
250
222
  },
251
223
  "lint:fix": {
252
- "command": "pnpm run lint || nps lint:pkg:fix",
224
+ "command": "eslint --fix src",
253
225
  "files": [
254
- "src/**",
255
- "../../.eslintignore",
256
- "../../.eslintrc.js"
226
+ "src/**"
257
227
  ],
258
228
  "output": [],
259
229
  "dependencies": [
@@ -303,8 +273,6 @@
303
273
  "check": "wireit",
304
274
  "types:check": "wireit",
305
275
  "types:create": "wireit",
306
- "format": "wireit",
307
- "format:fix": "wireit",
308
276
  "lint": "wireit",
309
277
  "lint:fix": "wireit",
310
278
  "jest": "wireit"
@@ -1,8 +1,6 @@
1
- /* eslint-disable no-use-before-define */
2
-
3
1
  import React from "react";
4
2
  import { Helpers, Scale, Axis, Wrapper } from "victory-core";
5
- import { defaults } from "lodash";
3
+ import defaults from "lodash/defaults";
6
4
 
7
5
  const fallbackProps = {
8
6
  width: 450,
@@ -117,7 +115,7 @@ export function getCalculatedProps(initialProps, childComponents) {
117
115
 
118
116
  const origin = polar ? Helpers.getPolarOrigin(props) : Axis.getOrigin(domain);
119
117
 
120
- const padding = Helpers.getPadding(props);
118
+ const padding = Helpers.getPadding(props.padding);
121
119
 
122
120
  return {
123
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,