victory-group 36.9.2 → 37.0.0

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,242 +1,217 @@
1
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
-
3
- 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."); }
4
-
5
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
-
7
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
8
-
9
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
-
11
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
-
13
- 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); }
14
-
15
- 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; }
16
-
17
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
18
-
19
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
-
21
- 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; }
22
-
23
- 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; }
24
-
25
- 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; }
26
-
27
1
  /* eslint-disable no-use-before-define */
28
2
  import React from "react";
29
3
  import { Data, Helpers, Scale, Wrapper } from "victory-core";
30
4
  import isEqual from "react-fast-compare";
31
- var fallbackProps = {
5
+ const fallbackProps = {
32
6
  width: 450,
33
7
  height: 300,
34
8
  padding: 50,
35
9
  offset: 0
36
- }; // eslint-disable-next-line max-statements
10
+ };
37
11
 
12
+ // eslint-disable-next-line max-statements
38
13
  export function getCalculatedProps(initialProps, childComponents) {
39
- var role = "group";
40
- var props = Helpers.modifyProps(initialProps, fallbackProps, role);
41
- var style = Wrapper.getStyle(props.theme, props.style, role);
42
- var offset = props.offset,
43
- colorScale = props.colorScale,
44
- color = props.color,
45
- polar = props.polar,
46
- horizontal = props.horizontal;
47
- var categories = props.categories || Wrapper.getCategories(props, childComponents, null);
48
- var datasets = props.datasets || Wrapper.getDataFromChildren(props, null);
49
- var domain = {
14
+ const role = "group";
15
+ const props = Helpers.modifyProps(initialProps, fallbackProps, role);
16
+ const style = Wrapper.getStyle(props.theme, props.style, role);
17
+ const {
18
+ offset,
19
+ colorScale,
20
+ color,
21
+ polar,
22
+ horizontal
23
+ } = props;
24
+ const categories = props.categories || Wrapper.getCategories(props, childComponents, null);
25
+ const datasets = props.datasets || Wrapper.getDataFromChildren(props, null);
26
+ const domain = {
50
27
  x: Wrapper.getDomain(Object.assign({}, props, {
51
- categories: categories
28
+ categories
52
29
  }), "x", childComponents),
53
30
  y: Wrapper.getDomain(Object.assign({}, props, {
54
- categories: categories
31
+ categories
55
32
  }), "y", childComponents)
56
33
  };
57
- var range = props.range || {
34
+ const range = props.range || {
58
35
  x: Helpers.getRange(props, "x"),
59
36
  y: Helpers.getRange(props, "y")
60
37
  };
61
- var baseScale = {
38
+ const baseScale = {
62
39
  x: Scale.getScaleFromProps(props, "x") || Wrapper.getScale(props, "x"),
63
40
  y: Scale.getScaleFromProps(props, "y") || Wrapper.getScale(props, "y")
64
41
  };
65
- var scale = {
42
+ const scale = {
66
43
  x: baseScale.x.domain(domain.x).range(props.horizontal ? range.y : range.x),
67
44
  y: baseScale.y.domain(domain.y).range(props.horizontal ? range.x : range.y)
68
45
  };
69
- var origin = polar ? props.origin : Helpers.getPolarOrigin(props);
70
- var padding = Helpers.getPadding(props);
46
+ const origin = polar ? props.origin : Helpers.getPolarOrigin(props);
47
+ const padding = Helpers.getPadding(props);
71
48
  return {
72
- datasets: datasets,
73
- categories: categories,
74
- range: range,
75
- domain: domain,
76
- horizontal: horizontal,
77
- scale: scale,
78
- style: style,
79
- colorScale: colorScale,
80
- color: color,
81
- offset: offset,
82
- origin: origin,
83
- padding: padding
49
+ datasets,
50
+ categories,
51
+ range,
52
+ domain,
53
+ horizontal,
54
+ scale,
55
+ style,
56
+ colorScale,
57
+ color,
58
+ offset,
59
+ origin,
60
+ padding
84
61
  };
85
- } // We need to remove sharedEvents in order to memoize the calculated data
86
- // With shared events, the props change on every event, and every value is re-calculated
62
+ }
87
63
 
88
- var withoutSharedEvents = function (props) {
89
- var children = props.children;
90
- var modifiedChildren = React.Children.toArray(children).map(function (child) {
91
- return _objectSpread(_objectSpread({}, child), {}, {
64
+ // We need to remove sharedEvents in order to memoize the calculated data
65
+ // With shared events, the props change on every event, and every value is re-calculated
66
+ const withoutSharedEvents = props => {
67
+ const {
68
+ children
69
+ } = props;
70
+ const modifiedChildren = React.Children.toArray(children).map(child => {
71
+ return {
72
+ ...child,
92
73
  props: Helpers.omit(child.props, ["sharedEvents"])
93
- });
74
+ };
94
75
  });
95
76
  props.children = modifiedChildren;
96
77
  return props;
97
78
  };
98
-
99
79
  export function useMemoizedProps(initialProps) {
100
- var modifiedProps = withoutSharedEvents(initialProps);
80
+ const modifiedProps = withoutSharedEvents(initialProps);
81
+ const [props, setProps] = React.useState(modifiedProps);
101
82
 
102
- var _React$useState = React.useState(modifiedProps),
103
- _React$useState2 = _slicedToArray(_React$useState, 2),
104
- props = _React$useState2[0],
105
- setProps = _React$useState2[1]; // React.memo uses shallow equality to compare objects. This way props
83
+ // React.memo uses shallow equality to compare objects. This way props
106
84
  // will only be re-calculated when they change.
107
-
108
-
109
- React.useEffect(function () {
85
+ React.useEffect(() => {
110
86
  if (!isEqual(modifiedProps, props)) {
111
87
  setProps(modifiedProps);
112
88
  }
113
89
  }, [props, setProps, modifiedProps]);
114
- return React.useMemo(function () {
90
+ return React.useMemo(() => {
115
91
  return getCalculatedProps(props, props.children);
116
92
  }, [props]);
117
93
  }
118
-
119
94
  function pixelsToValue(props, axis, calculatedProps) {
120
95
  if (!props.offset) {
121
96
  return 0;
122
97
  }
123
-
124
- var currentAxis = Helpers.getCurrentAxis(axis, props.horizontal);
125
- var domain = calculatedProps.domain[axis];
126
- var range = calculatedProps.range[currentAxis];
127
- var domainExtent = Math.max.apply(Math, _toConsumableArray(domain)) - Math.min.apply(Math, _toConsumableArray(domain));
128
- var rangeExtent = Math.max.apply(Math, _toConsumableArray(range)) - Math.min.apply(Math, _toConsumableArray(range));
98
+ const currentAxis = Helpers.getCurrentAxis(axis, props.horizontal);
99
+ const domain = calculatedProps.domain[axis];
100
+ const range = calculatedProps.range[currentAxis];
101
+ const domainExtent = Math.max(...domain) - Math.min(...domain);
102
+ const rangeExtent = Math.max(...range) - Math.min(...range);
129
103
  return domainExtent / rangeExtent * props.offset;
130
- } // eslint-disable-next-line max-params
131
-
104
+ }
132
105
 
106
+ // eslint-disable-next-line max-params
133
107
  function getX0(props, calculatedProps, index, role) {
134
- var groupLength = role === "stack" ? calculatedProps.datasets[0].length : calculatedProps.datasets.length;
135
- var center = (groupLength - 1) / 2;
136
- var totalWidth = pixelsToValue(props, "x", calculatedProps);
108
+ const groupLength = role === "stack" ? calculatedProps.datasets[0].length : calculatedProps.datasets.length;
109
+ const center = (groupLength - 1) / 2;
110
+ const totalWidth = pixelsToValue(props, "x", calculatedProps);
137
111
  return (index - center) * totalWidth;
138
- } // eslint-disable-next-line max-params
139
-
112
+ }
140
113
 
114
+ // eslint-disable-next-line max-params
141
115
  function getPolarX0(props, calculatedProps, index, role) {
142
- var groupLength = role === "stack" ? calculatedProps.datasets[0].length : calculatedProps.datasets.length;
143
- var center = (groupLength - 1) / 2;
144
- var width = getAngularWidth(props, calculatedProps);
116
+ const groupLength = role === "stack" ? calculatedProps.datasets[0].length : calculatedProps.datasets.length;
117
+ const center = (groupLength - 1) / 2;
118
+ const width = getAngularWidth(props, calculatedProps);
145
119
  return (index - center) * width;
146
120
  }
147
-
148
121
  function getAngularWidth(props, calculatedProps) {
149
- var range = calculatedProps.range;
150
- var angularRange = Math.abs(range.x[1] - range.x[0]);
151
- var r = Math.max.apply(Math, _toConsumableArray(range.y));
122
+ const {
123
+ range
124
+ } = calculatedProps;
125
+ const angularRange = Math.abs(range.x[1] - range.x[0]);
126
+ const r = Math.max(...range.y);
152
127
  return props.offset / (2 * Math.PI * r) * angularRange;
153
128
  }
154
-
155
129
  function getLabels(props, datasets, index) {
156
130
  if (!props.labels) {
157
131
  return undefined;
158
132
  }
159
-
160
133
  return Math.floor(datasets.length / 2) === index ? props.labels : undefined;
161
134
  }
162
-
163
135
  function getChildProps(props, calculatedProps) {
164
- var categories = calculatedProps.categories,
165
- domain = calculatedProps.domain,
166
- range = calculatedProps.range,
167
- scale = calculatedProps.scale,
168
- horizontal = calculatedProps.horizontal,
169
- origin = calculatedProps.origin,
170
- padding = calculatedProps.padding;
171
- var width = props.width,
172
- height = props.height,
173
- theme = props.theme,
174
- polar = props.polar;
136
+ const {
137
+ categories,
138
+ domain,
139
+ range,
140
+ scale,
141
+ horizontal,
142
+ origin,
143
+ padding
144
+ } = calculatedProps;
145
+ const {
146
+ width,
147
+ height,
148
+ theme,
149
+ polar
150
+ } = props;
175
151
  return {
176
- height: height,
177
- width: width,
178
- theme: theme,
179
- polar: polar,
180
- origin: origin,
181
- categories: categories,
182
- domain: domain,
183
- range: range,
184
- scale: scale,
185
- horizontal: horizontal,
186
- padding: padding,
152
+ height,
153
+ width,
154
+ theme,
155
+ polar,
156
+ origin,
157
+ categories,
158
+ domain,
159
+ range,
160
+ scale,
161
+ horizontal,
162
+ padding,
187
163
  standalone: false
188
164
  };
189
165
  }
190
-
191
166
  function getColorScale(props, child) {
192
- var role = child.type && child.type.role;
193
- var colorScaleOptions = child.props.colorScale || props.colorScale;
194
-
167
+ const role = child.type && child.type.role;
168
+ const colorScaleOptions = child.props.colorScale || props.colorScale;
195
169
  if (role !== "group" && role !== "stack") {
196
170
  return undefined;
197
171
  }
198
-
199
172
  return props.theme && props.theme.group ? colorScaleOptions || props.theme.group.colorScale : colorScaleOptions;
200
173
  }
201
-
202
- function getDataWithOffset(props) {
203
- var defaultDataset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
204
- var offset = arguments.length > 2 ? arguments[2] : undefined;
205
- var dataset = props.data || props.y ? Data.getData(props) : defaultDataset;
206
- var xOffset = offset || 0;
207
- return dataset.map(function (datum) {
208
- var _x1 = datum._x instanceof Date ? new Date(datum._x.getTime() + xOffset) : datum._x + xOffset;
209
-
174
+ function getDataWithOffset(props, defaultDataset, offset) {
175
+ if (defaultDataset === void 0) {
176
+ defaultDataset = [];
177
+ }
178
+ const dataset = props.data || props.y ? Data.getData(props) : defaultDataset;
179
+ const xOffset = offset || 0;
180
+ return dataset.map(datum => {
181
+ const _x1 = datum._x instanceof Date ? new Date(datum._x.getTime() + xOffset) : datum._x + xOffset;
210
182
  return Object.assign({}, datum, {
211
- _x1: _x1
183
+ _x1
212
184
  });
213
185
  });
214
186
  }
215
-
216
187
  export function getChildren(initialProps, childComponents, calculatedProps) {
217
- var props = Helpers.modifyProps(initialProps, fallbackProps, "stack");
218
- var children = childComponents || React.Children.toArray(props.children);
219
- var newCalculatedProps = calculatedProps || getCalculatedProps(props, children);
220
- var datasets = newCalculatedProps.datasets;
221
- var labelComponent = props.labelComponent,
222
- polar = props.polar;
223
- var childProps = getChildProps(props, newCalculatedProps);
224
- var parentName = props.name || "group";
225
- return children.map(function (child, index) {
226
- var role = child.type && child.type.role;
227
- var xOffset = polar ? getPolarX0(props, newCalculatedProps, index, role) : getX0(props, newCalculatedProps, index, role);
228
- var style = role === "voronoi" || role === "tooltip" || role === "label" ? child.props.style : Wrapper.getChildStyle(child, index, newCalculatedProps);
229
- var labels = props.labels ? getLabels(props, datasets, index) : child.props.labels;
230
- var name = child.props.name || "".concat(parentName, "-").concat(role, "-").concat(index);
188
+ const props = Helpers.modifyProps(initialProps, fallbackProps, "stack");
189
+ const children = childComponents || React.Children.toArray(props.children);
190
+ const newCalculatedProps = calculatedProps || getCalculatedProps(props, children);
191
+ const {
192
+ datasets
193
+ } = newCalculatedProps;
194
+ const {
195
+ labelComponent,
196
+ polar
197
+ } = props;
198
+ const childProps = getChildProps(props, newCalculatedProps);
199
+ const parentName = props.name || "group";
200
+ return children.map((child, index) => {
201
+ const role = child.type && child.type.role;
202
+ const xOffset = polar ? getPolarX0(props, newCalculatedProps, index, role) : getX0(props, newCalculatedProps, index, role);
203
+ const style = role === "voronoi" || role === "tooltip" || role === "label" ? child.props.style : Wrapper.getChildStyle(child, index, newCalculatedProps);
204
+ const labels = props.labels ? getLabels(props, datasets, index) : child.props.labels;
205
+ const name = child.props.name || `${parentName}-${role}-${index}`;
231
206
  return /*#__PURE__*/React.cloneElement(child, Object.assign({
232
- labels: labels,
233
- style: style,
234
- key: "".concat(name, "-key-").concat(index),
235
- name: name,
207
+ labels,
208
+ style,
209
+ key: `${name}-key-${index}`,
210
+ name,
236
211
  data: getDataWithOffset(props, datasets[index], xOffset),
237
212
  colorScale: getColorScale(props, child),
238
213
  labelComponent: labelComponent || child.props.labelComponent,
239
- xOffset: xOffset
214
+ xOffset
240
215
  }, childProps));
241
216
  });
242
217
  }
@@ -1,115 +1,105 @@
1
1
  import _isEmpty from "lodash/isEmpty";
2
2
  import _defaults from "lodash/defaults";
3
-
4
- 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; }
5
-
6
- 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; }
7
-
8
- 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; }
9
-
10
3
  import React from "react";
11
4
  import { Helpers, Hooks, UserProps, VictoryContainer, VictoryTheme, Wrapper } from "victory-core";
12
5
  import { VictorySharedEvents } from "victory-shared-events";
13
6
  import { getChildren, useMemoizedProps } from "./helper-methods";
14
7
  import isEqual from "react-fast-compare";
15
- var fallbackProps = {
8
+ const fallbackProps = {
16
9
  width: 450,
17
10
  height: 300,
18
11
  padding: 50,
19
12
  offset: 0
20
13
  };
21
- var defaultProps = {
14
+ const defaultProps = {
22
15
  containerComponent: /*#__PURE__*/React.createElement(VictoryContainer, null),
23
16
  groupComponent: /*#__PURE__*/React.createElement("g", null),
24
17
  samples: 50,
25
18
  standalone: true,
26
19
  theme: VictoryTheme.grayscale
27
20
  };
28
-
29
- var VictoryGroupBase = function (initialProps) {
21
+ const VictoryGroupBase = initialProps => {
30
22
  // eslint-disable-next-line no-use-before-define
31
- var role = VictoryGroup === null || VictoryGroup === void 0 ? void 0 : VictoryGroup.role;
32
-
33
- var _Hooks$useAnimationSt = Hooks.useAnimationState(),
34
- getAnimationProps = _Hooks$useAnimationSt.getAnimationProps,
35
- setAnimationState = _Hooks$useAnimationSt.setAnimationState,
36
- getProps = _Hooks$useAnimationSt.getProps;
37
-
38
- var propsWithDefaults = React.useMemo(function () {
39
- return _objectSpread(_objectSpread({}, defaultProps), initialProps);
40
- }, [initialProps]);
41
- var props = getProps(propsWithDefaults);
42
- var modifiedProps = Helpers.modifyProps(props, fallbackProps, role);
43
- var eventKey = modifiedProps.eventKey,
44
- containerComponent = modifiedProps.containerComponent,
45
- standalone = modifiedProps.standalone,
46
- groupComponent = modifiedProps.groupComponent,
47
- externalEventMutations = modifiedProps.externalEventMutations,
48
- width = modifiedProps.width,
49
- height = modifiedProps.height,
50
- theme = modifiedProps.theme,
51
- polar = modifiedProps.polar,
52
- horizontal = modifiedProps.horizontal,
53
- name = modifiedProps.name;
54
- var childComponents = React.Children.toArray(modifiedProps.children);
55
- var calculatedProps = useMemoizedProps(modifiedProps);
56
- var domain = calculatedProps.domain,
57
- scale = calculatedProps.scale,
58
- style = calculatedProps.style,
59
- origin = calculatedProps.origin;
60
- var newChildren = React.useMemo(function () {
61
- var children = getChildren(props, childComponents, calculatedProps);
62
- return children.map(function (child, index) {
63
- var childProps = Object.assign({
23
+ const role = VictoryGroup?.role;
24
+ const {
25
+ getAnimationProps,
26
+ setAnimationState,
27
+ getProps
28
+ } = Hooks.useAnimationState();
29
+ const propsWithDefaults = React.useMemo(() => ({
30
+ ...defaultProps,
31
+ ...initialProps
32
+ }), [initialProps]);
33
+ const props = getProps(propsWithDefaults);
34
+ const modifiedProps = Helpers.modifyProps(props, fallbackProps, role);
35
+ const {
36
+ eventKey,
37
+ containerComponent,
38
+ standalone,
39
+ groupComponent,
40
+ externalEventMutations,
41
+ width,
42
+ height,
43
+ theme,
44
+ polar,
45
+ horizontal,
46
+ name
47
+ } = modifiedProps;
48
+ const childComponents = React.Children.toArray(modifiedProps.children);
49
+ const calculatedProps = useMemoizedProps(modifiedProps);
50
+ const {
51
+ domain,
52
+ scale,
53
+ style,
54
+ origin
55
+ } = calculatedProps;
56
+ const newChildren = React.useMemo(() => {
57
+ const children = getChildren(props, childComponents, calculatedProps);
58
+ return children.map((child, index) => {
59
+ const childProps = Object.assign({
64
60
  animate: getAnimationProps(props, child, index)
65
61
  }, child.props);
66
62
  return /*#__PURE__*/React.cloneElement(child, childProps);
67
63
  });
68
64
  }, [props, childComponents, calculatedProps, getAnimationProps]);
69
- var containerProps = React.useMemo(function () {
65
+ const containerProps = React.useMemo(() => {
70
66
  if (standalone) {
71
67
  return {
72
- domain: domain,
73
- scale: scale,
74
- width: width,
75
- height: height,
76
- standalone: standalone,
77
- theme: theme,
68
+ domain,
69
+ scale,
70
+ width,
71
+ height,
72
+ standalone,
73
+ theme,
78
74
  style: style.parent,
79
- horizontal: horizontal,
80
- polar: polar,
81
- origin: origin,
82
- name: name
75
+ horizontal,
76
+ polar,
77
+ origin,
78
+ name
83
79
  };
84
80
  }
85
-
86
81
  return {};
87
82
  }, [standalone, domain, scale, width, height, theme, style, horizontal, polar, origin, name]);
88
- var userProps = React.useMemo(function () {
89
- return UserProps.getSafeUserProps(propsWithDefaults);
90
- }, [propsWithDefaults]);
91
- var container = React.useMemo(function () {
83
+ const userProps = React.useMemo(() => UserProps.getSafeUserProps(propsWithDefaults), [propsWithDefaults]);
84
+ const container = React.useMemo(() => {
92
85
  if (standalone) {
93
- var defaultContainerProps = _defaults({}, containerComponent.props, containerProps, userProps);
94
-
86
+ const defaultContainerProps = _defaults({}, containerComponent.props, containerProps, userProps);
95
87
  return /*#__PURE__*/React.cloneElement(containerComponent, defaultContainerProps);
96
88
  }
97
-
98
89
  return /*#__PURE__*/React.cloneElement(groupComponent, userProps);
99
90
  }, [groupComponent, standalone, containerComponent, containerProps, userProps]);
100
- var events = React.useMemo(function () {
91
+ const events = React.useMemo(() => {
101
92
  return Wrapper.getAllEvents(props);
102
93
  }, [props]);
103
- var previousProps = Hooks.usePreviousProps(propsWithDefaults);
104
- React.useEffect(function () {
94
+ const previousProps = Hooks.usePreviousProps(propsWithDefaults);
95
+ React.useEffect(() => {
105
96
  // This is called before dismount to keep state in sync
106
- return function () {
97
+ return () => {
107
98
  if (propsWithDefaults.animate) {
108
99
  setAnimationState(previousProps, props);
109
100
  }
110
101
  };
111
102
  }, [setAnimationState, previousProps, propsWithDefaults, props]);
112
-
113
103
  if (!_isEmpty(events)) {
114
104
  return /*#__PURE__*/React.createElement(VictorySharedEvents, {
115
105
  container: container,
@@ -118,14 +108,12 @@ var VictoryGroupBase = function (initialProps) {
118
108
  externalEventMutations: externalEventMutations
119
109
  }, newChildren);
120
110
  }
121
-
122
111
  return /*#__PURE__*/React.cloneElement(container, container.props, newChildren);
123
112
  };
124
-
125
- var componentConfig = {
113
+ const componentConfig = {
126
114
  role: "group",
127
115
  expectedComponents: ["groupComponent", "containerComponent", "labelComponent"],
128
- getChildren: getChildren
116
+ getChildren
129
117
  };
130
- export var VictoryGroup = Object.assign( /*#__PURE__*/React.memo(VictoryGroupBase, isEqual), componentConfig);
118
+ export const VictoryGroup = Object.assign( /*#__PURE__*/React.memo(VictoryGroupBase, isEqual), componentConfig);
131
119
  VictoryGroup.displayName = "VictoryGroup";