victory-chart 36.7.0 → 36.8.2

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,18 +1,6 @@
1
1
  import _assign from "lodash/assign";
2
2
  import _defaults from "lodash/defaults";
3
3
 
4
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
5
-
6
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
-
8
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
9
-
10
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
11
-
12
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
13
-
14
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
15
-
16
4
  /* eslint-disable no-use-before-define */
17
5
  import React from "react";
18
6
  import { Helpers, Scale, Axis, Wrapper } from "victory-core";
@@ -151,7 +139,7 @@ export function getChildren(props, childComponents, calculatedProps) {
151
139
  origin = _calculatedProps.origin,
152
140
  horizontal = _calculatedProps.horizontal;
153
141
  var parentName = props.name || "chart";
154
- return childComponents.map(function (child, index) {
142
+ return childComponents.filter(React.isValidElement).map(function (child, index) {
155
143
  var role = child.type && child.type.role;
156
144
  var style = Array.isArray(child.props.style) ? child.props.style : _defaults({}, child.props.style, {
157
145
  parent: baseStyle
@@ -179,10 +167,8 @@ export function getChildren(props, childComponents, calculatedProps) {
179
167
  export var getChildComponents = function (props, defaultAxes) {
180
168
  var childComponents = React.Children.toArray(props.children);
181
169
 
182
- var newChildComponents = _toConsumableArray(childComponents);
183
-
184
170
  if (childComponents.length === 0) {
185
- newChildComponents.push(defaultAxes.independent, defaultAxes.dependent);
171
+ childComponents.push(defaultAxes.independent, defaultAxes.dependent);
186
172
  } else {
187
173
  var axisComponents = {
188
174
  dependent: Axis.getAxisComponentsWithParent(childComponents, "dependent"),
@@ -190,11 +176,11 @@ export var getChildComponents = function (props, defaultAxes) {
190
176
  };
191
177
 
192
178
  if (axisComponents.dependent.length === 0 && axisComponents.independent.length === 0) {
193
- newChildComponents = props.prependDefaultAxes ? [defaultAxes.independent, defaultAxes.dependent].concat(newChildComponents) : newChildComponents.concat([defaultAxes.independent, defaultAxes.dependent]);
179
+ childComponents = props.prependDefaultAxes ? [defaultAxes.independent, defaultAxes.dependent].concat(childComponents) : childComponents.concat([defaultAxes.independent, defaultAxes.dependent]);
194
180
  }
195
181
  }
196
182
 
197
- return newChildComponents;
183
+ return childComponents;
198
184
  };
199
185
 
200
186
  var getDomain = function (props, axis, childComponents) {
@@ -21,8 +21,30 @@ var fallbackProps = {
21
21
  height: 300,
22
22
  padding: 50
23
23
  };
24
+ var defaultProps = {
25
+ backgroundComponent: /*#__PURE__*/React.createElement(Background, null),
26
+ containerComponent: /*#__PURE__*/React.createElement(VictoryContainer, null),
27
+ defaultAxes: {
28
+ independent: /*#__PURE__*/React.createElement(VictoryAxis, null),
29
+ dependent: /*#__PURE__*/React.createElement(VictoryAxis, {
30
+ dependentAxis: true
31
+ })
32
+ },
33
+ defaultPolarAxes: {
34
+ independent: /*#__PURE__*/React.createElement(VictoryPolarAxis, null),
35
+ dependent: /*#__PURE__*/React.createElement(VictoryPolarAxis, {
36
+ dependentAxis: true
37
+ })
38
+ },
39
+ groupComponent: /*#__PURE__*/React.createElement("g", null),
40
+ standalone: true,
41
+ theme: VictoryTheme.grayscale
42
+ };
24
43
 
25
44
  var VictoryChartImpl = function (initialProps) {
45
+ var propsWithDefaults = React.useMemo(function () {
46
+ return _objectSpread(_objectSpread({}, defaultProps), initialProps);
47
+ }, [initialProps]);
26
48
  var role = "chart";
27
49
 
28
50
  var _Hooks$useAnimationSt = Hooks.useAnimationState(),
@@ -30,7 +52,7 @@ var VictoryChartImpl = function (initialProps) {
30
52
  setAnimationState = _Hooks$useAnimationSt.setAnimationState,
31
53
  getProps = _Hooks$useAnimationSt.getProps;
32
54
 
33
- var props = getProps(initialProps);
55
+ var props = getProps(propsWithDefaults);
34
56
  var modifiedProps = Helpers.modifyProps(props, fallbackProps, role);
35
57
  var desc = modifiedProps.desc,
36
58
  eventKey = modifiedProps.eventKey,
@@ -96,25 +118,25 @@ var VictoryChartImpl = function (initialProps) {
96
118
  }, [desc, domain, height, horizontal, name, origin, polar, scale, standalone, style, title, theme, width]);
97
119
  var container = React.useMemo(function () {
98
120
  if (standalone) {
99
- var defaultContainerProps = _defaults({}, containerComponent.props, containerProps, UserProps.getSafeUserProps(initialProps));
121
+ var defaultContainerProps = _defaults({}, containerComponent.props, containerProps, UserProps.getSafeUserProps(propsWithDefaults));
100
122
 
101
123
  return /*#__PURE__*/React.cloneElement(containerComponent, defaultContainerProps);
102
124
  }
103
125
 
104
126
  return groupComponent;
105
- }, [groupComponent, standalone, containerComponent, containerProps, initialProps]);
127
+ }, [groupComponent, standalone, containerComponent, containerProps, propsWithDefaults]);
106
128
  var events = React.useMemo(function () {
107
129
  return Wrapper.getAllEvents(props);
108
130
  }, [props]);
109
- var previousProps = Hooks.usePreviousProps(initialProps);
131
+ var previousProps = Hooks.usePreviousProps(propsWithDefaults);
110
132
  React.useEffect(function () {
111
133
  // This is called before dismount to keep state in sync
112
134
  return function () {
113
- if (initialProps.animate) {
114
- setAnimationState(previousProps, initialProps);
135
+ if (propsWithDefaults.animate) {
136
+ setAnimationState(previousProps, propsWithDefaults);
115
137
  }
116
138
  };
117
- }, [setAnimationState, previousProps, initialProps]);
139
+ }, [setAnimationState, previousProps, propsWithDefaults]);
118
140
 
119
141
  if (!_isEmpty(events)) {
120
142
  return /*#__PURE__*/React.createElement(VictorySharedEvents, {
@@ -144,25 +166,6 @@ VictoryChartImpl.propTypes = _objectSpread(_objectSpread({}, CommonProps.basePro
144
166
  prependDefaultAxes: PropTypes.bool,
145
167
  startAngle: PropTypes.number
146
168
  });
147
- VictoryChartImpl.defaultProps = {
148
- backgroundComponent: /*#__PURE__*/React.createElement(Background, null),
149
- containerComponent: /*#__PURE__*/React.createElement(VictoryContainer, null),
150
- defaultAxes: {
151
- independent: /*#__PURE__*/React.createElement(VictoryAxis, null),
152
- dependent: /*#__PURE__*/React.createElement(VictoryAxis, {
153
- dependentAxis: true
154
- })
155
- },
156
- defaultPolarAxes: {
157
- independent: /*#__PURE__*/React.createElement(VictoryPolarAxis, null),
158
- dependent: /*#__PURE__*/React.createElement(VictoryPolarAxis, {
159
- dependentAxis: true
160
- })
161
- },
162
- groupComponent: /*#__PURE__*/React.createElement("g", null),
163
- standalone: true,
164
- theme: VictoryTheme.grayscale
165
- };
166
169
  export var VictoryChart = /*#__PURE__*/React.memo(VictoryChartImpl, isEqual);
167
170
  VictoryChart.displayName = "VictoryChart"; // @ts-expect-error FIXME: Does this "expectedComponents" do anything?
168
171
 
@@ -18,18 +18,7 @@ var _victoryCore = require("victory-core");
18
18
 
19
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
20
 
21
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
22
-
23
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
24
-
25
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
26
-
27
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
28
-
29
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
30
-
31
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
32
-
21
+ /* eslint-disable no-use-before-define */
33
22
  var fallbackProps = {
34
23
  width: 450,
35
24
  height: 300,
@@ -171,7 +160,7 @@ function getChildren(props, childComponents, calculatedProps) {
171
160
  origin = _calculatedProps.origin,
172
161
  horizontal = _calculatedProps.horizontal;
173
162
  var parentName = props.name || "chart";
174
- return childComponents.map(function (child, index) {
163
+ return childComponents.filter(_react.default.isValidElement).map(function (child, index) {
175
164
  var role = child.type && child.type.role;
176
165
  var style = Array.isArray(child.props.style) ? child.props.style : (0, _defaults2.default)({}, child.props.style, {
177
166
  parent: baseStyle
@@ -198,10 +187,8 @@ function getChildren(props, childComponents, calculatedProps) {
198
187
  var getChildComponents = function (props, defaultAxes) {
199
188
  var childComponents = _react.default.Children.toArray(props.children);
200
189
 
201
- var newChildComponents = _toConsumableArray(childComponents);
202
-
203
190
  if (childComponents.length === 0) {
204
- newChildComponents.push(defaultAxes.independent, defaultAxes.dependent);
191
+ childComponents.push(defaultAxes.independent, defaultAxes.dependent);
205
192
  } else {
206
193
  var axisComponents = {
207
194
  dependent: _victoryCore.Axis.getAxisComponentsWithParent(childComponents, "dependent"),
@@ -209,11 +196,11 @@ var getChildComponents = function (props, defaultAxes) {
209
196
  };
210
197
 
211
198
  if (axisComponents.dependent.length === 0 && axisComponents.independent.length === 0) {
212
- newChildComponents = props.prependDefaultAxes ? [defaultAxes.independent, defaultAxes.dependent].concat(newChildComponents) : newChildComponents.concat([defaultAxes.independent, defaultAxes.dependent]);
199
+ childComponents = props.prependDefaultAxes ? [defaultAxes.independent, defaultAxes.dependent].concat(childComponents) : childComponents.concat([defaultAxes.independent, defaultAxes.dependent]);
213
200
  }
214
201
  }
215
202
 
216
- return newChildComponents;
203
+ return childComponents;
217
204
  };
218
205
 
219
206
  exports.getChildComponents = getChildComponents;
@@ -40,8 +40,31 @@ var fallbackProps = {
40
40
  height: 300,
41
41
  padding: 50
42
42
  };
43
+ var defaultProps = {
44
+ backgroundComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.Background, null),
45
+ containerComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryContainer, null),
46
+ defaultAxes: {
47
+ independent: /*#__PURE__*/_react.default.createElement(_victoryAxis.VictoryAxis, null),
48
+ dependent: /*#__PURE__*/_react.default.createElement(_victoryAxis.VictoryAxis, {
49
+ dependentAxis: true
50
+ })
51
+ },
52
+ defaultPolarAxes: {
53
+ independent: /*#__PURE__*/_react.default.createElement(_victoryPolarAxis.VictoryPolarAxis, null),
54
+ dependent: /*#__PURE__*/_react.default.createElement(_victoryPolarAxis.VictoryPolarAxis, {
55
+ dependentAxis: true
56
+ })
57
+ },
58
+ groupComponent: /*#__PURE__*/_react.default.createElement("g", null),
59
+ standalone: true,
60
+ theme: _victoryCore.VictoryTheme.grayscale
61
+ };
43
62
 
44
63
  var VictoryChartImpl = function (initialProps) {
64
+ var propsWithDefaults = _react.default.useMemo(function () {
65
+ return _objectSpread(_objectSpread({}, defaultProps), initialProps);
66
+ }, [initialProps]);
67
+
45
68
  var role = "chart";
46
69
 
47
70
  var _Hooks$useAnimationSt = _victoryCore.Hooks.useAnimationState(),
@@ -49,7 +72,7 @@ var VictoryChartImpl = function (initialProps) {
49
72
  setAnimationState = _Hooks$useAnimationSt.setAnimationState,
50
73
  getProps = _Hooks$useAnimationSt.getProps;
51
74
 
52
- var props = getProps(initialProps);
75
+ var props = getProps(propsWithDefaults);
53
76
 
54
77
  var modifiedProps = _victoryCore.Helpers.modifyProps(props, fallbackProps, role);
55
78
 
@@ -122,27 +145,27 @@ var VictoryChartImpl = function (initialProps) {
122
145
 
123
146
  var container = _react.default.useMemo(function () {
124
147
  if (standalone) {
125
- var defaultContainerProps = (0, _defaults2.default)({}, containerComponent.props, containerProps, _victoryCore.UserProps.getSafeUserProps(initialProps));
148
+ var defaultContainerProps = (0, _defaults2.default)({}, containerComponent.props, containerProps, _victoryCore.UserProps.getSafeUserProps(propsWithDefaults));
126
149
  return /*#__PURE__*/_react.default.cloneElement(containerComponent, defaultContainerProps);
127
150
  }
128
151
 
129
152
  return groupComponent;
130
- }, [groupComponent, standalone, containerComponent, containerProps, initialProps]);
153
+ }, [groupComponent, standalone, containerComponent, containerProps, propsWithDefaults]);
131
154
 
132
155
  var events = _react.default.useMemo(function () {
133
156
  return _victoryCore.Wrapper.getAllEvents(props);
134
157
  }, [props]);
135
158
 
136
- var previousProps = _victoryCore.Hooks.usePreviousProps(initialProps);
159
+ var previousProps = _victoryCore.Hooks.usePreviousProps(propsWithDefaults);
137
160
 
138
161
  _react.default.useEffect(function () {
139
162
  // This is called before dismount to keep state in sync
140
163
  return function () {
141
- if (initialProps.animate) {
142
- setAnimationState(previousProps, initialProps);
164
+ if (propsWithDefaults.animate) {
165
+ setAnimationState(previousProps, propsWithDefaults);
143
166
  }
144
167
  };
145
- }, [setAnimationState, previousProps, initialProps]);
168
+ }, [setAnimationState, previousProps, propsWithDefaults]);
146
169
 
147
170
  if (!(0, _isEmpty2.default)(events)) {
148
171
  return /*#__PURE__*/_react.default.createElement(_victorySharedEvents.VictorySharedEvents, {
@@ -172,25 +195,6 @@ VictoryChartImpl.propTypes = _objectSpread(_objectSpread({}, _victoryCore.Common
172
195
  prependDefaultAxes: _propTypes.default.bool,
173
196
  startAngle: _propTypes.default.number
174
197
  });
175
- VictoryChartImpl.defaultProps = {
176
- backgroundComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.Background, null),
177
- containerComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryContainer, null),
178
- defaultAxes: {
179
- independent: /*#__PURE__*/_react.default.createElement(_victoryAxis.VictoryAxis, null),
180
- dependent: /*#__PURE__*/_react.default.createElement(_victoryAxis.VictoryAxis, {
181
- dependentAxis: true
182
- })
183
- },
184
- defaultPolarAxes: {
185
- independent: /*#__PURE__*/_react.default.createElement(_victoryPolarAxis.VictoryPolarAxis, null),
186
- dependent: /*#__PURE__*/_react.default.createElement(_victoryPolarAxis.VictoryPolarAxis, {
187
- dependentAxis: true
188
- })
189
- },
190
- groupComponent: /*#__PURE__*/_react.default.createElement("g", null),
191
- standalone: true,
192
- theme: _victoryCore.VictoryTheme.grayscale
193
- };
194
198
 
195
199
  var VictoryChart = /*#__PURE__*/_react.default.memo(VictoryChartImpl, _reactFastCompare.default);
196
200
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "victory-chart",
3
- "version": "36.7.0",
3
+ "version": "36.8.2",
4
4
  "description": "Chart Component for Victory",
5
5
  "keywords": [
6
6
  "data visualization",
@@ -23,10 +23,10 @@
23
23
  "lodash": "^4.17.19",
24
24
  "prop-types": "^15.8.1",
25
25
  "react-fast-compare": "^3.2.0",
26
- "victory-axis": "^36.7.0",
27
- "victory-core": "^36.7.0",
28
- "victory-polar-axis": "^36.7.0",
29
- "victory-shared-events": "^36.7.0"
26
+ "victory-axis": "^36.8.2",
27
+ "victory-core": "^36.8.2",
28
+ "victory-polar-axis": "^36.8.2",
29
+ "victory-shared-events": "^36.8.2"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": ">=16.6.0"
@@ -133,7 +133,7 @@ export function getChildren(props, childComponents, calculatedProps) {
133
133
  const { origin, horizontal } = calculatedProps;
134
134
  const parentName = props.name || "chart";
135
135
 
136
- return childComponents.map((child, index) => {
136
+ return childComponents.filter(React.isValidElement).map((child, index) => {
137
137
  const role = child.type && child.type.role;
138
138
  const style = Array.isArray(child.props.style)
139
139
  ? child.props.style
@@ -161,11 +161,10 @@ export function getChildren(props, childComponents, calculatedProps) {
161
161
  }
162
162
 
163
163
  export const getChildComponents = (props, defaultAxes?) => {
164
- const childComponents = React.Children.toArray(props.children);
165
- let newChildComponents = [...childComponents];
164
+ let childComponents = React.Children.toArray(props.children);
166
165
 
167
166
  if (childComponents.length === 0) {
168
- newChildComponents.push(defaultAxes.independent, defaultAxes.dependent);
167
+ childComponents.push(defaultAxes.independent, defaultAxes.dependent);
169
168
  } else {
170
169
  const axisComponents = {
171
170
  dependent: Axis.getAxisComponentsWithParent(childComponents, "dependent"),
@@ -179,18 +178,18 @@ export const getChildComponents = (props, defaultAxes?) => {
179
178
  axisComponents.dependent.length === 0 &&
180
179
  axisComponents.independent.length === 0
181
180
  ) {
182
- newChildComponents = props.prependDefaultAxes
181
+ childComponents = props.prependDefaultAxes
183
182
  ? [defaultAxes.independent, defaultAxes.dependent].concat(
184
- newChildComponents,
183
+ childComponents,
185
184
  )
186
- : newChildComponents.concat([
185
+ : childComponents.concat([
187
186
  defaultAxes.independent,
188
187
  defaultAxes.dependent,
189
188
  ]);
190
189
  }
191
190
  }
192
191
 
193
- return newChildComponents;
192
+ return childComponents;
194
193
  };
195
194
 
196
195
  const getDomain = (props, axis, childComponents) => {
@@ -36,11 +36,31 @@ const fallbackProps = {
36
36
  padding: 50,
37
37
  };
38
38
 
39
+ const defaultProps = {
40
+ backgroundComponent: <Background />,
41
+ containerComponent: <VictoryContainer />,
42
+ defaultAxes: {
43
+ independent: <VictoryAxis />,
44
+ dependent: <VictoryAxis dependentAxis />,
45
+ },
46
+ defaultPolarAxes: {
47
+ independent: <VictoryPolarAxis />,
48
+ dependent: <VictoryPolarAxis dependentAxis />,
49
+ },
50
+ groupComponent: <g />,
51
+ standalone: true,
52
+ theme: VictoryTheme.grayscale,
53
+ };
54
+
39
55
  const VictoryChartImpl: React.FC<VictoryChartProps> = (initialProps) => {
56
+ const propsWithDefaults = React.useMemo(
57
+ () => ({ ...defaultProps, ...initialProps }),
58
+ [initialProps],
59
+ );
40
60
  const role = "chart";
41
61
  const { getAnimationProps, setAnimationState, getProps } =
42
62
  Hooks.useAnimationState();
43
- const props = getProps(initialProps);
63
+ const props = getProps(propsWithDefaults);
44
64
 
45
65
  const modifiedProps = Helpers.modifyProps(props, fallbackProps, role);
46
66
  const {
@@ -137,7 +157,7 @@ const VictoryChartImpl: React.FC<VictoryChartProps> = (initialProps) => {
137
157
  {},
138
158
  containerComponent.props,
139
159
  containerProps,
140
- UserProps.getSafeUserProps(initialProps),
160
+ UserProps.getSafeUserProps(propsWithDefaults),
141
161
  );
142
162
  return React.cloneElement(containerComponent, defaultContainerProps);
143
163
  }
@@ -147,23 +167,23 @@ const VictoryChartImpl: React.FC<VictoryChartProps> = (initialProps) => {
147
167
  standalone,
148
168
  containerComponent,
149
169
  containerProps,
150
- initialProps,
170
+ propsWithDefaults,
151
171
  ]);
152
172
 
153
173
  const events = React.useMemo(() => {
154
174
  return Wrapper.getAllEvents(props);
155
175
  }, [props]);
156
176
 
157
- const previousProps = Hooks.usePreviousProps(initialProps);
177
+ const previousProps = Hooks.usePreviousProps(propsWithDefaults);
158
178
 
159
179
  React.useEffect(() => {
160
180
  // This is called before dismount to keep state in sync
161
181
  return () => {
162
- if (initialProps.animate) {
163
- setAnimationState(previousProps, initialProps);
182
+ if (propsWithDefaults.animate) {
183
+ setAnimationState(previousProps, propsWithDefaults);
164
184
  }
165
185
  };
166
- }, [setAnimationState, previousProps, initialProps]);
186
+ }, [setAnimationState, previousProps, propsWithDefaults]);
167
187
 
168
188
  if (!isEmpty(events)) {
169
189
  return (
@@ -201,22 +221,6 @@ VictoryChartImpl.propTypes = {
201
221
  startAngle: PropTypes.number,
202
222
  };
203
223
 
204
- VictoryChartImpl.defaultProps = {
205
- backgroundComponent: <Background />,
206
- containerComponent: <VictoryContainer />,
207
- defaultAxes: {
208
- independent: <VictoryAxis />,
209
- dependent: <VictoryAxis dependentAxis />,
210
- },
211
- defaultPolarAxes: {
212
- independent: <VictoryPolarAxis />,
213
- dependent: <VictoryPolarAxis dependentAxis />,
214
- },
215
- groupComponent: <g />,
216
- standalone: true,
217
- theme: VictoryTheme.grayscale,
218
- };
219
-
220
224
  export const VictoryChart = React.memo(VictoryChartImpl, isEqual);
221
225
 
222
226
  VictoryChart.displayName = "VictoryChart";
@@ -1,25 +0,0 @@
1
- import * as React from "react";
2
- import { CategoryPropType, DomainPropType, EventPropTypeInterface, StringOrNumberOrCallback, VictoryCommonProps, VictoryStyleInterface, VictoryStyleObject } from "victory-core";
3
- import { AxesType } from "..";
4
- interface VictoryChartProps extends VictoryCommonProps {
5
- backgroundComponent?: React.ReactElement;
6
- categories?: CategoryPropType;
7
- children?: React.ReactNode | React.ReactNode[];
8
- desc?: string;
9
- defaultAxes?: AxesType;
10
- defaultPolarAxes?: AxesType;
11
- domain?: DomainPropType;
12
- endAngle?: number;
13
- eventKey?: StringOrNumberOrCallback;
14
- events?: EventPropTypeInterface<string, string[] | number[] | string | number>[];
15
- innerRadius?: number;
16
- prependDefaultAxes?: boolean;
17
- startAngle?: number;
18
- style?: Pick<VictoryStyleInterface, "parent"> & {
19
- background?: VictoryStyleObject;
20
- };
21
- title?: string;
22
- }
23
- declare const _default: React.FC<VictoryChartProps>;
24
- export default _default;
25
- //# sourceMappingURL=victory-chart.d.ts.map
@@ -1,55 +0,0 @@
1
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
-
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
-
5
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
-
7
- import * as React from "react";
8
- import { withContainer, useDomain, useScale, useData } from "victory-core/es/v37";
9
- import { VictoryAxis } from "victory-axis";
10
- var DEFAULT_AXES = {
11
- independent: /*#__PURE__*/React.createElement(VictoryAxis, null),
12
- dependent: /*#__PURE__*/React.createElement(VictoryAxis, {
13
- dependentAxis: true
14
- })
15
- }; // TODO: This does not accept data
16
-
17
- var VictoryChart = function (_ref) {
18
- var _ref$defaultAxes = _ref.defaultAxes,
19
- defaultAxes = _ref$defaultAxes === void 0 ? DEFAULT_AXES : _ref$defaultAxes,
20
- _ref$groupComponent = _ref.groupComponent,
21
- groupComponent = _ref$groupComponent === void 0 ? /*#__PURE__*/React.createElement("g", null) : _ref$groupComponent,
22
- children = _ref.children;
23
- var scale = useScale();
24
- var data = useData();
25
- var domain = useDomain();
26
- var axes = React.useMemo(function () {
27
- var _defaultAxes$DEFAULT_ = _objectSpread(_objectSpread({}, defaultAxes), DEFAULT_AXES),
28
- dependent = _defaultAxes$DEFAULT_.dependent,
29
- independent = _defaultAxes$DEFAULT_.independent;
30
-
31
- var axisProps = {
32
- data: data,
33
- domain: domain,
34
- // @ts-expect-error we need to fix this scale type
35
- scale: scale,
36
- standalone: false
37
- };
38
- return [/*#__PURE__*/React.cloneElement(dependent, _objectSpread(_objectSpread({}, axisProps), {}, {
39
- key: "dependent-axis"
40
- })), /*#__PURE__*/React.cloneElement(independent, _objectSpread(_objectSpread({}, axisProps), {}, {
41
- key: "independent-axis"
42
- }))];
43
- }, [defaultAxes, domain, scale, data]);
44
- var childComponents = React.Children.map(children, function (child, index) {
45
- // @ts-expect-error Why is this throwing a type error?
46
- return /*#__PURE__*/React.cloneElement(child, {
47
- key: "child-".concat(index),
48
- index: index,
49
- standalone: false
50
- });
51
- });
52
- return /*#__PURE__*/React.cloneElement(groupComponent, {}, axes, childComponents);
53
- };
54
-
55
- export default withContainer(VictoryChart);
@@ -1,25 +0,0 @@
1
- import * as React from "react";
2
- import { CategoryPropType, DomainPropType, EventPropTypeInterface, StringOrNumberOrCallback, VictoryCommonProps, VictoryStyleInterface, VictoryStyleObject } from "victory-core";
3
- import { AxesType } from "..";
4
- interface VictoryChartProps extends VictoryCommonProps {
5
- backgroundComponent?: React.ReactElement;
6
- categories?: CategoryPropType;
7
- children?: React.ReactNode | React.ReactNode[];
8
- desc?: string;
9
- defaultAxes?: AxesType;
10
- defaultPolarAxes?: AxesType;
11
- domain?: DomainPropType;
12
- endAngle?: number;
13
- eventKey?: StringOrNumberOrCallback;
14
- events?: EventPropTypeInterface<string, string[] | number[] | string | number>[];
15
- innerRadius?: number;
16
- prependDefaultAxes?: boolean;
17
- startAngle?: number;
18
- style?: Pick<VictoryStyleInterface, "parent"> & {
19
- background?: VictoryStyleObject;
20
- };
21
- title?: string;
22
- }
23
- declare const _default: React.FC<VictoryChartProps>;
24
- export default _default;
25
- //# sourceMappingURL=victory-chart.d.ts.map
@@ -1,71 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var React = _interopRequireWildcard(require("react"));
9
-
10
- var _v = require("victory-core/es/v37");
11
-
12
- var _victoryAxis = require("victory-axis");
13
-
14
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
-
16
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
-
18
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
19
-
20
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
21
-
22
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
23
-
24
- var DEFAULT_AXES = {
25
- independent: /*#__PURE__*/React.createElement(_victoryAxis.VictoryAxis, null),
26
- dependent: /*#__PURE__*/React.createElement(_victoryAxis.VictoryAxis, {
27
- dependentAxis: true
28
- })
29
- }; // TODO: This does not accept data
30
-
31
- var VictoryChart = function (_ref) {
32
- var _ref$defaultAxes = _ref.defaultAxes,
33
- defaultAxes = _ref$defaultAxes === void 0 ? DEFAULT_AXES : _ref$defaultAxes,
34
- _ref$groupComponent = _ref.groupComponent,
35
- groupComponent = _ref$groupComponent === void 0 ? /*#__PURE__*/React.createElement("g", null) : _ref$groupComponent,
36
- children = _ref.children;
37
- var scale = (0, _v.useScale)();
38
- var data = (0, _v.useData)();
39
- var domain = (0, _v.useDomain)();
40
- var axes = React.useMemo(function () {
41
- var _defaultAxes$DEFAULT_ = _objectSpread(_objectSpread({}, defaultAxes), DEFAULT_AXES),
42
- dependent = _defaultAxes$DEFAULT_.dependent,
43
- independent = _defaultAxes$DEFAULT_.independent;
44
-
45
- var axisProps = {
46
- data: data,
47
- domain: domain,
48
- // @ts-expect-error we need to fix this scale type
49
- scale: scale,
50
- standalone: false
51
- };
52
- return [/*#__PURE__*/React.cloneElement(dependent, _objectSpread(_objectSpread({}, axisProps), {}, {
53
- key: "dependent-axis"
54
- })), /*#__PURE__*/React.cloneElement(independent, _objectSpread(_objectSpread({}, axisProps), {}, {
55
- key: "independent-axis"
56
- }))];
57
- }, [defaultAxes, domain, scale, data]);
58
- var childComponents = React.Children.map(children, function (child, index) {
59
- // @ts-expect-error Why is this throwing a type error?
60
- return /*#__PURE__*/React.cloneElement(child, {
61
- key: "child-".concat(index),
62
- index: index,
63
- standalone: false
64
- });
65
- });
66
- return /*#__PURE__*/React.cloneElement(groupComponent, {}, axes, childComponents);
67
- };
68
-
69
- var _default = (0, _v.withContainer)(VictoryChart);
70
-
71
- exports.default = _default;