victory-core 36.8.1 → 36.8.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.
Files changed (100) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/victory-core.js +182 -158
  3. package/dist/victory-core.min.js +1 -1
  4. package/es/types/callbacks.d.ts +4 -4
  5. package/es/victory-animation/util.d.ts +3 -3
  6. package/es/victory-animation/util.js +5 -3
  7. package/es/victory-animation/victory-animation.js +2 -2
  8. package/es/victory-label/victory-label.d.ts +1 -1
  9. package/es/victory-label/victory-label.js +8 -12
  10. package/es/victory-primitives/arc.d.ts +1 -1
  11. package/es/victory-primitives/arc.js +2 -2
  12. package/es/victory-primitives/background.d.ts +1 -1
  13. package/es/victory-primitives/background.js +2 -2
  14. package/es/victory-primitives/border.d.ts +1 -1
  15. package/es/victory-primitives/border.js +2 -2
  16. package/es/victory-primitives/line-segment.d.ts +1 -1
  17. package/es/victory-primitives/line-segment.js +2 -2
  18. package/es/victory-primitives/point.d.ts +1 -1
  19. package/es/victory-primitives/point.js +2 -2
  20. package/es/victory-primitives/whisker.d.ts +1 -1
  21. package/es/victory-primitives/whisker.js +16 -17
  22. package/es/victory-util/add-events.d.ts +2 -2
  23. package/es/victory-util/add-events.js +11 -8
  24. package/es/victory-util/axis.js +2 -2
  25. package/es/victory-util/common-props.d.ts +1 -0
  26. package/es/victory-util/data.js +14 -9
  27. package/es/victory-util/domain.js +15 -15
  28. package/es/victory-util/events.d.ts +3 -3
  29. package/es/victory-util/events.js +13 -16
  30. package/es/victory-util/helpers.js +5 -5
  31. package/es/victory-util/immutable.js +4 -2
  32. package/es/victory-util/label-helpers.d.ts +1 -1
  33. package/es/victory-util/label-helpers.js +11 -12
  34. package/es/victory-util/selection.js +1 -2
  35. package/es/victory-util/timer.js +1 -2
  36. package/es/victory-util/transitions.js +37 -26
  37. package/es/victory-util/user-props.d.ts +6 -0
  38. package/es/victory-util/user-props.js +12 -1
  39. package/es/victory-util/wrapper.js +14 -14
  40. package/lib/types/callbacks.d.ts +4 -4
  41. package/lib/victory-animation/util.d.ts +3 -3
  42. package/lib/victory-animation/util.js +5 -3
  43. package/lib/victory-animation/victory-animation.js +2 -2
  44. package/lib/victory-label/victory-label.d.ts +1 -1
  45. package/lib/victory-label/victory-label.js +8 -12
  46. package/lib/victory-primitives/arc.d.ts +1 -1
  47. package/lib/victory-primitives/arc.js +2 -2
  48. package/lib/victory-primitives/background.d.ts +1 -1
  49. package/lib/victory-primitives/background.js +2 -2
  50. package/lib/victory-primitives/border.d.ts +1 -1
  51. package/lib/victory-primitives/border.js +2 -2
  52. package/lib/victory-primitives/line-segment.d.ts +1 -1
  53. package/lib/victory-primitives/line-segment.js +2 -2
  54. package/lib/victory-primitives/point.d.ts +1 -1
  55. package/lib/victory-primitives/point.js +2 -2
  56. package/lib/victory-primitives/whisker.d.ts +1 -1
  57. package/lib/victory-primitives/whisker.js +16 -17
  58. package/lib/victory-util/add-events.d.ts +2 -2
  59. package/lib/victory-util/add-events.js +11 -8
  60. package/lib/victory-util/axis.js +2 -2
  61. package/lib/victory-util/common-props.d.ts +1 -0
  62. package/lib/victory-util/data.js +14 -9
  63. package/lib/victory-util/domain.js +15 -15
  64. package/lib/victory-util/events.d.ts +3 -3
  65. package/lib/victory-util/events.js +13 -16
  66. package/lib/victory-util/helpers.js +5 -5
  67. package/lib/victory-util/immutable.js +4 -2
  68. package/lib/victory-util/label-helpers.d.ts +1 -1
  69. package/lib/victory-util/label-helpers.js +11 -11
  70. package/lib/victory-util/selection.js +1 -2
  71. package/lib/victory-util/timer.js +1 -2
  72. package/lib/victory-util/transitions.js +32 -26
  73. package/lib/victory-util/user-props.d.ts +6 -0
  74. package/lib/victory-util/user-props.js +13 -0
  75. package/lib/victory-util/wrapper.js +16 -14
  76. package/package.json +2 -2
  77. package/src/types/callbacks.ts +8 -5
  78. package/src/victory-animation/util.ts +5 -3
  79. package/src/victory-animation/victory-animation.tsx +3 -2
  80. package/src/victory-label/victory-label.tsx +19 -18
  81. package/src/victory-primitives/arc.tsx +2 -2
  82. package/src/victory-primitives/background.tsx +2 -2
  83. package/src/victory-primitives/border.tsx +2 -2
  84. package/src/victory-primitives/line-segment.tsx +2 -2
  85. package/src/victory-primitives/point.tsx +2 -2
  86. package/src/victory-primitives/whisker.tsx +5 -5
  87. package/src/victory-util/add-events.tsx +24 -14
  88. package/src/victory-util/axis.tsx +6 -2
  89. package/src/victory-util/common-props.tsx +1 -0
  90. package/src/victory-util/data.ts +12 -8
  91. package/src/victory-util/domain.ts +15 -15
  92. package/src/victory-util/events.ts +15 -23
  93. package/src/victory-util/helpers.ts +5 -5
  94. package/src/victory-util/immutable.ts +3 -2
  95. package/src/victory-util/label-helpers.ts +6 -10
  96. package/src/victory-util/selection.ts +3 -2
  97. package/src/victory-util/timer.ts +1 -2
  98. package/src/victory-util/transitions.ts +31 -22
  99. package/src/victory-util/user-props.ts +14 -0
  100. package/src/victory-util/wrapper.tsx +17 -22
@@ -224,12 +224,12 @@ var interpolateFunction = function (a, b) {
224
224
  * differs in that it uses our custom interpolators when interpolating the value of each property in
225
225
  * an object. This allows the correct interpolation of nested objects, including styles
226
226
  *
227
- * @param {any} a - Start value.
228
- * @param {any} b - End value.
227
+ * @param {any} startValue - Start value.
228
+ * @param {any} endValue - End value.
229
229
  * @returns {Function} An interpolation function.
230
230
  */
231
231
 
232
- var interpolateObject = function (a, b) {
232
+ var interpolateObject = function (startValue, endValue) {
233
233
  var interpolateTypes = function (x, y) {
234
234
  if (x === y || !isInterpolatable(x) || !isInterpolatable(y)) {
235
235
  return interpolateImmediate(x, y);
@@ -254,6 +254,8 @@ var interpolateObject = function (a, b) {
254
254
 
255
255
  var i = {};
256
256
  var c = {};
257
+ var a = startValue;
258
+ var b = endValue;
257
259
  var k;
258
260
 
259
261
  if (a === null || typeof a !== "object") {
@@ -421,8 +423,8 @@ var VictoryAnimation = /*#__PURE__*/function (_React$Component) {
421
423
  step can generate imprecise values, sometimes greater than 1
422
424
  if this happens set the state to 1 and return, cancelling the timer
423
425
  */
424
- duration = duration !== undefined ? duration : _this.props.duration;
425
- var step = duration ? elapsed / duration : 1;
426
+ var animationDuration = duration !== undefined ? duration : _this.props.duration;
427
+ var step = animationDuration ? elapsed / animationDuration : 1;
426
428
 
427
429
  if (step >= 1) {
428
430
  _this.setState({
@@ -1348,8 +1350,7 @@ var getStyles = function (style, props) {
1348
1350
  }
1349
1351
 
1350
1352
  var getSingleStyle = function (s) {
1351
- s = s ? lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, s, defaultStyles) : defaultStyles;
1352
- var baseStyles = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.evaluateStyle(s, props);
1353
+ var baseStyles = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.evaluateStyle(s ? lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, s, defaultStyles) : defaultStyles, props);
1353
1354
  return lodash_assign__WEBPACK_IMPORTED_MODULE_2___default()({}, baseStyles, {
1354
1355
  fontSize: getFontSize(baseStyles)
1355
1356
  });
@@ -1553,22 +1554,19 @@ var getInlineXOffset = function (calculatedProps, textElements, index) {
1553
1554
  switch (textAnchor) {
1554
1555
  case "start":
1555
1556
  return widths.reduce(function (memo, width, i) {
1556
- memo = i < index ? memo + width : memo;
1557
- return memo;
1557
+ return i < index ? memo + width : memo;
1558
1558
  }, 0);
1559
1559
 
1560
1560
  case "end":
1561
1561
  return widths.reduce(function (memo, width, i) {
1562
- memo = i > index ? memo - width : memo;
1563
- return memo;
1562
+ return i > index ? memo - width : memo;
1564
1563
  }, 0);
1565
1564
 
1566
1565
  default:
1567
1566
  // middle
1568
1567
  return widths.reduce(function (memo, width, i) {
1569
1568
  var offsetWidth = i < index ? width : 0;
1570
- memo = i === index ? memo + width / 2 : memo + offsetWidth;
1571
- return memo;
1569
+ return i === index ? memo + width / 2 : memo + offsetWidth;
1572
1570
  }, centerOffset);
1573
1571
  }
1574
1572
  };
@@ -1700,7 +1698,7 @@ var getCalculatedProps = function (props) {
1700
1698
  verticalAnchor: verticalAnchor,
1701
1699
  dx: dx,
1702
1700
  dy: dy,
1703
- originalDy: props.dy,
1701
+ originalDy: _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.evaluateProp(props.dy, props),
1704
1702
  transform: transform,
1705
1703
  x: x,
1706
1704
  y: y
@@ -1770,8 +1768,8 @@ var defaultProps = {
1770
1768
  // Magic number from d3.
1771
1769
  lineHeight: 1
1772
1770
  };
1773
- var VictoryLabel = function (props) {
1774
- props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), props));
1771
+ var VictoryLabel = function (initialProps) {
1772
+ var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps));
1775
1773
 
1776
1774
  if (props.text === null || props.text === undefined) {
1777
1775
  return null;
@@ -1792,7 +1790,7 @@ var VictoryLabel = function (props) {
1792
1790
  fontSize: currentStyle.fontSize || defaultStyles.fontSize,
1793
1791
  capHeight: capHeightPx,
1794
1792
  text: line,
1795
- // @ts-expect-error TODO: This looks like a bug:
1793
+ // TODO: This looks like a bug:
1796
1794
  textSize: _victory_util_textsize__WEBPACK_IMPORTED_MODULE_12__.approximateTextSize(line, currentStyle),
1797
1795
  lineHeight: currentLineHeight,
1798
1796
  backgroundPadding: getSingleValue(backgroundPadding, i)
@@ -2232,8 +2230,8 @@ var defaultProps = {
2232
2230
  role: "presentation",
2233
2231
  shapeRendering: "auto"
2234
2232
  };
2235
- var Arc = function (props) {
2236
- props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), props));
2233
+ var Arc = function (initialProps) {
2234
+ var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps));
2237
2235
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(props.pathComponent, _objectSpread(_objectSpread({}, props.events), {}, {
2238
2236
  "aria-label": props.ariaLabel,
2239
2237
  d: getArcPath(props),
@@ -2313,8 +2311,8 @@ var defaultProps = {
2313
2311
  role: "presentation",
2314
2312
  shapeRendering: "auto"
2315
2313
  };
2316
- var Background = function (props) {
2317
- props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), props));
2314
+ var Background = function (initialProps) {
2315
+ var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps));
2318
2316
  return props.polar ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(props.circleComponent, _objectSpread(_objectSpread({}, props.events), {}, {
2319
2317
  style: props.style,
2320
2318
  role: props.role,
@@ -2413,8 +2411,8 @@ var defaultProps = {
2413
2411
  role: "presentation",
2414
2412
  shapeRendering: "auto"
2415
2413
  };
2416
- var Border = function (props) {
2417
- props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), props));
2414
+ var Border = function (initialProps) {
2415
+ var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps));
2418
2416
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(props.rectComponent, _objectSpread(_objectSpread({}, props.events), {}, {
2419
2417
  "aria-label": props.ariaLabel,
2420
2418
  style: props.style,
@@ -2639,8 +2637,8 @@ var defaultProps = {
2639
2637
  role: "presentation",
2640
2638
  shapeRendering: "auto"
2641
2639
  };
2642
- var LineSegment = function (props) {
2643
- props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), props));
2640
+ var LineSegment = function (initialProps) {
2641
+ var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps));
2644
2642
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(props.lineComponent, _objectSpread(_objectSpread({}, props.events), {}, {
2645
2643
  "aria-label": props.ariaLabel,
2646
2644
  style: props.style,
@@ -2868,8 +2866,8 @@ var defaultProps = {
2868
2866
  role: "presentation",
2869
2867
  shapeRendering: "auto"
2870
2868
  };
2871
- var Point = function (props) {
2872
- props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), props));
2869
+ var Point = function (initialProps) {
2870
+ var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps));
2873
2871
  var userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_5__.getSafeUserProps(props);
2874
2872
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(props.pathComponent, _objectSpread(_objectSpread({}, props.events), {}, {
2875
2873
  "aria-label": props.ariaLabel,
@@ -3118,23 +3116,22 @@ var defaultProps = {
3118
3116
  role: "presentation",
3119
3117
  shapeRendering: "auto"
3120
3118
  };
3121
- var Whisker = function (props) {
3122
- props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), props));
3123
- var _props = props,
3124
- ariaLabel = _props.ariaLabel,
3125
- groupComponent = _props.groupComponent,
3126
- lineComponent = _props.lineComponent,
3127
- events = _props.events,
3128
- className = _props.className,
3129
- majorWhisker = _props.majorWhisker,
3130
- minorWhisker = _props.minorWhisker,
3131
- transform = _props.transform,
3132
- clipPath = _props.clipPath,
3133
- role = _props.role,
3134
- shapeRendering = _props.shapeRendering,
3135
- style = _props.style,
3136
- desc = _props.desc,
3137
- tabIndex = _props.tabIndex;
3119
+ var Whisker = function (initialProps) {
3120
+ var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps));
3121
+ var ariaLabel = props.ariaLabel,
3122
+ groupComponent = props.groupComponent,
3123
+ lineComponent = props.lineComponent,
3124
+ events = props.events,
3125
+ className = props.className,
3126
+ majorWhisker = props.majorWhisker,
3127
+ minorWhisker = props.minorWhisker,
3128
+ transform = props.transform,
3129
+ clipPath = props.clipPath,
3130
+ role = props.role,
3131
+ shapeRendering = props.shapeRendering,
3132
+ style = props.style,
3133
+ desc = props.desc,
3134
+ tabIndex = props.tabIndex;
3138
3135
 
3139
3136
  var baseProps = _objectSpread(_objectSpread({}, events), {}, {
3140
3137
  style: style,
@@ -4301,8 +4298,7 @@ function addEvents(WrappedComponent) {
4301
4298
  value: function applyExternalMutations(props, externalMutations) {
4302
4299
  if (!lodash_isEmpty__WEBPACK_IMPORTED_MODULE_5___default()(externalMutations)) {
4303
4300
  var callbacks = props.externalEventMutations.reduce(function (memo, mutation) {
4304
- memo = lodash_isFunction__WEBPACK_IMPORTED_MODULE_4___default()(mutation.callback) ? memo.concat(mutation.callback) : memo;
4305
- return memo;
4301
+ return lodash_isFunction__WEBPACK_IMPORTED_MODULE_4___default()(mutation.callback) ? memo.concat(mutation.callback) : memo;
4306
4302
  }, []);
4307
4303
  var compiledCallbacks = callbacks.length ? function () {
4308
4304
  callbacks.forEach(function (c) {
@@ -4357,8 +4353,8 @@ function addEvents(WrappedComponent) {
4357
4353
  }, {
4358
4354
  key: "getBaseProps",
4359
4355
  value: function getBaseProps(props, getSharedEventState) {
4360
- getSharedEventState = getSharedEventState || this.getSharedEventState.bind(this);
4361
- var sharedParentState = getSharedEventState("parent", "parent");
4356
+ var getSharedEventStateFunction = getSharedEventState || this.getSharedEventState.bind(this);
4357
+ var sharedParentState = getSharedEventStateFunction("parent", "parent");
4362
4358
  var parentState = this.getEventState("parent", "parent");
4363
4359
 
4364
4360
  var baseParentProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_7___default()({}, parentState, sharedParentState);
@@ -4393,13 +4389,15 @@ function addEvents(WrappedComponent) {
4393
4389
  return undefined;
4394
4390
  }
4395
4391
 
4392
+ var currentProps = component && typeof component === "object" && "props" in component ? component.props : undefined;
4393
+
4396
4394
  if (this.hasEvents) {
4397
4395
  var baseEvents = this.getEvents(this.props, type, key);
4398
4396
 
4399
4397
  var componentProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_7___default()({
4400
4398
  index: index,
4401
4399
  key: id
4402
- }, this.getEventState(key, type), this.getSharedEventState(key, type), component.props, baseProps, {
4400
+ }, this.getEventState(key, type), this.getSharedEventState(key, type), currentProps, baseProps, {
4403
4401
  id: id
4404
4402
  });
4405
4403
 
@@ -4413,7 +4411,7 @@ function addEvents(WrappedComponent) {
4413
4411
  return lodash_defaults__WEBPACK_IMPORTED_MODULE_7___default()({
4414
4412
  index: index,
4415
4413
  key: id
4416
- }, component.props, baseProps, {
4414
+ }, currentProps, baseProps, {
4417
4415
  id: id
4418
4416
  });
4419
4417
  }
@@ -4455,13 +4453,15 @@ function addEvents(WrappedComponent) {
4455
4453
  var dataKeys = lodash_without__WEBPACK_IMPORTED_MODULE_0___default()(this.dataKeys, "all");
4456
4454
 
4457
4455
  var labelComponents = dataKeys.reduce(function (memo, key) {
4456
+ var newMemo = memo;
4457
+
4458
4458
  var labelProps = _this8.getComponentProps(labelComponent, "labels", key);
4459
4459
 
4460
4460
  if (labelProps && labelProps.text !== undefined && labelProps.text !== null) {
4461
- memo = memo.concat( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default().cloneElement(labelComponent, labelProps));
4461
+ newMemo = newMemo.concat( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default().cloneElement(labelComponent, labelProps));
4462
4462
  }
4463
4463
 
4464
- return memo;
4464
+ return newMemo;
4465
4465
  }, []);
4466
4466
  var dataProps = this.getComponentProps(dataComponent, "data", "all");
4467
4467
  var children = [/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default().cloneElement(dataComponent, dataProps)].concat(_toConsumableArray(labelComponents));
@@ -4607,11 +4607,11 @@ function getAxis(props) {
4607
4607
  */
4608
4608
 
4609
4609
  function findAxisComponents(childComponents, predicate) {
4610
- predicate = predicate || (lodash_identity__WEBPACK_IMPORTED_MODULE_9___default());
4610
+ var predicateFunction = predicate || (lodash_identity__WEBPACK_IMPORTED_MODULE_9___default());
4611
4611
 
4612
4612
  var findAxes = function (children) {
4613
4613
  return children.reduce(function (memo, child) {
4614
- if (child.type && child.type.role === "axis" && predicate(child)) {
4614
+ if (child.type && child.type.role === "axis" && predicateFunction(child)) {
4615
4615
  return memo.concat(child);
4616
4616
  } else if (child.props && child.props.children) {
4617
4617
  return memo.concat(findAxes(react__WEBPACK_IMPORTED_MODULE_12___default().Children.toArray(child.props.children)));
@@ -5355,12 +5355,14 @@ function sortData(dataset, sortKey) {
5355
5355
  } // Ensures previous VictoryLine api for sortKey prop stays consistent
5356
5356
 
5357
5357
 
5358
+ var formattedSortKey = sortKey;
5359
+
5358
5360
  if (sortKey === "x" || sortKey === "y") {
5359
- sortKey = "_".concat(sortKey);
5361
+ formattedSortKey = "_".concat(sortKey);
5360
5362
  }
5361
5363
 
5362
5364
  var order = sortOrder === "ascending" ? "asc" : "desc";
5363
- return lodash_orderBy__WEBPACK_IMPORTED_MODULE_5___default()(dataset, sortKey, order);
5365
+ return lodash_orderBy__WEBPACK_IMPORTED_MODULE_5___default()(dataset, formattedSortKey, order);
5364
5366
  } // This method will remove data points that break certain scales. (log scale only)
5365
5367
 
5366
5368
 
@@ -5551,7 +5553,10 @@ function formatData(dataset, props, expectedKeys) {
5551
5553
  return [];
5552
5554
  }
5553
5555
 
5554
- var defaultKeys = ["x", "y", "y0"];
5556
+ var defaultKeys = ["x", "y", "y0"]; // TODO: We shouldn’t mutate the expectedKeys param here,
5557
+ // but we need to figure out why changing it causes regressions in tests.
5558
+ // eslint-disable-next-line no-param-reassign
5559
+
5555
5560
  expectedKeys = Array.isArray(expectedKeys) ? expectedKeys : defaultKeys;
5556
5561
 
5557
5562
  var createAccessor = function (name) {
@@ -5576,13 +5581,13 @@ function formatData(dataset, props, expectedKeys) {
5576
5581
 
5577
5582
  var data = preformattedData ? dataset : dataset.reduce(function (dataArr, datum, index) {
5578
5583
  // eslint-disable-line complexity
5579
- datum = parseDatum(datum);
5584
+ var parsedDatum = parseDatum(datum);
5580
5585
  var fallbackValues = {
5581
5586
  x: index,
5582
- y: datum
5587
+ y: parsedDatum
5583
5588
  };
5584
5589
  var processedValues = expectedKeys.reduce(function (memo, type) {
5585
- var processedValue = accessor[type](datum);
5590
+ var processedValue = accessor[type](parsedDatum);
5586
5591
  var value = processedValue !== undefined ? processedValue : fallbackValues[type];
5587
5592
 
5588
5593
  if (value !== undefined) {
@@ -5597,7 +5602,7 @@ function formatData(dataset, props, expectedKeys) {
5597
5602
  return memo;
5598
5603
  }, {});
5599
5604
 
5600
- var formattedDatum = lodash_assign__WEBPACK_IMPORTED_MODULE_12___default()({}, processedValues, datum);
5605
+ var formattedDatum = lodash_assign__WEBPACK_IMPORTED_MODULE_12___default()({}, processedValues, parsedDatum);
5601
5606
 
5602
5607
  if (!lodash_isEmpty__WEBPACK_IMPORTED_MODULE_4___default()(formattedDatum)) {
5603
5608
  dataArr.push(formattedDatum);
@@ -5708,8 +5713,8 @@ function getStringsFromData(props, axis) {
5708
5713
  }, []);
5709
5714
  var sortedData = sortData(data, props.sortKey, props.sortOrder);
5710
5715
  var dataStrings = sortedData.reduce(function (dataArr, datum) {
5711
- datum = parseDatum(datum);
5712
- dataArr.push(accessor(datum));
5716
+ var parsedDatum = parseDatum(datum);
5717
+ dataArr.push(accessor(parsedDatum));
5713
5718
  return dataArr;
5714
5719
  }, []).filter(function (datum) {
5715
5720
  return typeof datum === "string";
@@ -6075,18 +6080,18 @@ function padDomain(domain, props, axis) {
6075
6080
 
6076
6081
 
6077
6082
  function createDomainFunction(getDomainFromDataFunction, formatDomainFunction) {
6078
- getDomainFromDataFunction = lodash_isFunction__WEBPACK_IMPORTED_MODULE_2___default()(getDomainFromDataFunction) ? getDomainFromDataFunction : getDomainFromData;
6079
- formatDomainFunction = lodash_isFunction__WEBPACK_IMPORTED_MODULE_2___default()(formatDomainFunction) ? formatDomainFunction : formatDomain;
6083
+ var getDomainFromDataFn = lodash_isFunction__WEBPACK_IMPORTED_MODULE_2___default()(getDomainFromDataFunction) ? getDomainFromDataFunction : getDomainFromData;
6084
+ var formatDomainFn = lodash_isFunction__WEBPACK_IMPORTED_MODULE_2___default()(formatDomainFunction) ? formatDomainFunction : formatDomain;
6080
6085
  return function (props, axis) {
6081
6086
  var propsDomain = getDomainFromProps(props, axis);
6082
6087
 
6083
6088
  if (propsDomain) {
6084
- return formatDomainFunction(propsDomain, props, axis);
6089
+ return formatDomainFn(propsDomain, props, axis);
6085
6090
  }
6086
6091
 
6087
6092
  var categories = _data__WEBPACK_IMPORTED_MODULE_10__.getCategories(props, axis);
6088
- var domain = categories ? getDomainFromCategories(props, axis, categories) : getDomainFromDataFunction(props, axis);
6089
- return domain ? formatDomainFunction(domain, props, axis) : undefined;
6093
+ var domain = categories ? getDomainFromCategories(props, axis, categories) : getDomainFromDataFn(props, axis);
6094
+ return domain ? formatDomainFn(domain, props, axis) : undefined;
6090
6095
  };
6091
6096
  }
6092
6097
  /**
@@ -6119,27 +6124,27 @@ function getDomain(props, axis) {
6119
6124
  */
6120
6125
 
6121
6126
  function getDomainFromCategories(props, axis, categories) {
6122
- categories = categories || _data__WEBPACK_IMPORTED_MODULE_10__.getCategories(props, axis);
6127
+ var categoriesArray = categories || _data__WEBPACK_IMPORTED_MODULE_10__.getCategories(props, axis);
6123
6128
  var polar = props.polar,
6124
6129
  _props$startAngle = props.startAngle,
6125
6130
  startAngle = _props$startAngle === void 0 ? 0 : _props$startAngle,
6126
6131
  _props$endAngle = props.endAngle,
6127
6132
  endAngle = _props$endAngle === void 0 ? 360 : _props$endAngle;
6128
6133
 
6129
- if (!categories) {
6134
+ if (!categoriesArray) {
6130
6135
  return undefined;
6131
6136
  }
6132
6137
 
6133
6138
  var minDomain = getMinFromProps(props, axis);
6134
6139
  var maxDomain = getMaxFromProps(props, axis);
6135
- var stringArray = _collection__WEBPACK_IMPORTED_MODULE_8__.containsStrings(categories) ? _data__WEBPACK_IMPORTED_MODULE_10__.getStringsFromCategories(props, axis) : [];
6140
+ var stringArray = _collection__WEBPACK_IMPORTED_MODULE_8__.containsStrings(categoriesArray) ? _data__WEBPACK_IMPORTED_MODULE_10__.getStringsFromCategories(props, axis) : [];
6136
6141
  var stringMap = stringArray.length === 0 ? null : stringArray.reduce(function (memo, string, index) {
6137
6142
  memo[string] = index + 1;
6138
6143
  return memo;
6139
6144
  }, {});
6140
- var categoryValues = stringMap ? categories.map(function (value) {
6145
+ var categoryValues = stringMap ? categoriesArray.map(function (value) {
6141
6146
  return stringMap[value];
6142
- }) : categories;
6147
+ }) : categoriesArray;
6143
6148
  var min = minDomain !== undefined ? minDomain : _collection__WEBPACK_IMPORTED_MODULE_8__.getMinValue(categoryValues);
6144
6149
  var max = maxDomain !== undefined ? maxDomain : _collection__WEBPACK_IMPORTED_MODULE_8__.getMaxValue(categoryValues);
6145
6150
  var categoryDomain = getDomainFromMinMax(min, max);
@@ -6154,7 +6159,7 @@ function getDomainFromCategories(props, axis, categories) {
6154
6159
  */
6155
6160
 
6156
6161
  function getDomainFromData(props, axis, dataset) {
6157
- dataset = dataset || _data__WEBPACK_IMPORTED_MODULE_10__.getData(props);
6162
+ var datasetArray = dataset || _data__WEBPACK_IMPORTED_MODULE_10__.getData(props);
6158
6163
  var polar = props.polar,
6159
6164
  _props$startAngle2 = props.startAngle,
6160
6165
  startAngle = _props$startAngle2 === void 0 ? 0 : _props$startAngle2,
@@ -6163,14 +6168,14 @@ function getDomainFromData(props, axis, dataset) {
6163
6168
  var minDomain = getMinFromProps(props, axis);
6164
6169
  var maxDomain = getMaxFromProps(props, axis);
6165
6170
 
6166
- if (dataset.length < 1) {
6171
+ if (datasetArray.length < 1) {
6167
6172
  return minDomain !== undefined && maxDomain !== undefined ? getDomainFromMinMax(minDomain, maxDomain) : undefined;
6168
6173
  }
6169
6174
 
6170
- var min = minDomain !== undefined ? minDomain : getExtremeFromData(dataset, axis, "min");
6171
- var max = maxDomain !== undefined ? maxDomain : getExtremeFromData(dataset, axis, "max");
6175
+ var min = minDomain !== undefined ? minDomain : getExtremeFromData(datasetArray, axis, "min");
6176
+ var max = maxDomain !== undefined ? maxDomain : getExtremeFromData(datasetArray, axis, "max");
6172
6177
  var domain = getDomainFromMinMax(min, max);
6173
- return polar && axis === "x" && Math.abs(startAngle - endAngle) === 360 ? getSymmetricDomain(domain, getFlatData(dataset, axis)) : domain;
6178
+ return polar && axis === "x" && Math.abs(startAngle - endAngle) === 360 ? getSymmetricDomain(domain, getFlatData(datasetArray, axis)) : domain;
6174
6179
  }
6175
6180
  /**
6176
6181
  * Returns a domain in the form of a two element array given a min and max value.
@@ -6483,14 +6488,14 @@ function getScopedEvents(events, namespace, childType, baseProps) {
6483
6488
  // eslint-disable-next-line no-invalid-this
6484
6489
 
6485
6490
 
6486
- baseProps = baseProps || this.baseProps; // returns the original base props or base state of a given target element
6491
+ var newBaseProps = baseProps || this.baseProps; // returns the original base props or base state of a given target element
6487
6492
 
6488
6493
  var getTargetProps = function (identifier, type) {
6489
6494
  var childName = identifier.childName,
6490
6495
  target = identifier.target,
6491
6496
  key = identifier.key; // eslint-disable-next-line no-invalid-this
6492
6497
 
6493
- var baseType = type === "props" ? baseProps : _this2.state || {};
6498
+ var baseType = type === "props" ? newBaseProps : _this2.state || {};
6494
6499
  var base = childName === undefined || childName === null || !baseType[childName] ? baseType : baseType[childName];
6495
6500
  return key === "parent" ? base.parent : base[key] && base[key][target];
6496
6501
  }; // Returns the state object with the mutation caused by a given eventReturn
@@ -6578,8 +6583,7 @@ function getScopedEvents(events, namespace, childType, baseProps) {
6578
6583
 
6579
6584
  var parseEventReturn = function (eventReturn, eventKey) {
6580
6585
  return Array.isArray(eventReturn) ? eventReturn.reduce(function (memo, props) {
6581
- memo = lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()({}, memo, parseEvent(props, eventKey));
6582
- return memo;
6586
+ return lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()({}, memo, parseEvent(props, eventKey));
6583
6587
  }, {}) : parseEvent(eventReturn, eventKey);
6584
6588
  };
6585
6589
 
@@ -6665,9 +6669,10 @@ function getEventState(eventKey, namespace, childType) {
6665
6669
  */
6666
6670
  // eslint-disable-next-line max-params
6667
6671
 
6668
- function getExternalMutationsWithChildren(mutations, baseProps, baseState, childNames) {
6669
- baseProps = baseProps || {};
6670
- baseState = baseState || {};
6672
+ function getExternalMutationsWithChildren(mutations) {
6673
+ var baseProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6674
+ var baseState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6675
+ var childNames = arguments.length > 3 ? arguments[3] : undefined;
6671
6676
  return childNames.reduce(function (memo, childName) {
6672
6677
  var childState = baseState[childName];
6673
6678
  var mutation = getExternalMutations(mutations, baseProps[childName], baseState[childName], childName);
@@ -6689,9 +6694,10 @@ function getExternalMutationsWithChildren(mutations, baseProps, baseState, child
6689
6694
  */
6690
6695
  // eslint-disable-next-line max-params
6691
6696
 
6692
- function getExternalMutations(mutations, baseProps, baseState, childName) {
6693
- baseProps = baseProps || {};
6694
- baseState = baseState || {};
6697
+ function getExternalMutations(mutations) {
6698
+ var baseProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6699
+ var baseState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6700
+ var childName = arguments.length > 3 ? arguments[3] : undefined;
6695
6701
 
6696
6702
  var eventKeys = lodash_keys__WEBPACK_IMPORTED_MODULE_0___default()(baseProps);
6697
6703
 
@@ -6757,8 +6763,7 @@ function getExternalMutation(mutations, baseProps, baseState, identifier) {
6757
6763
  return false;
6758
6764
  };
6759
6765
 
6760
- mutations = Array.isArray(mutations) ? mutations : [mutations];
6761
- var scopedMutations = mutations;
6766
+ var scopedMutations = Array.isArray(mutations) ? mutations : [mutations];
6762
6767
 
6763
6768
  if (identifier.childName) {
6764
6769
  scopedMutations = mutations.filter(function (m) {
@@ -6797,13 +6802,10 @@ function getExternalMutation(mutations, baseProps, baseState, identifier) {
6797
6802
 
6798
6803
  function getComponentEvents(props, components) {
6799
6804
  var events = Array.isArray(components) && components.reduce(function (memo, componentName) {
6800
- var _memo;
6801
-
6802
6805
  var component = props[componentName];
6803
6806
  var defaultEvents = component && component.type && component.type.defaultEvents;
6804
6807
  var componentEvents = lodash_isFunction__WEBPACK_IMPORTED_MODULE_6___default()(defaultEvents) ? defaultEvents(component.props) : defaultEvents;
6805
- memo = Array.isArray(componentEvents) ? (_memo = memo).concat.apply(_memo, _toConsumableArray(componentEvents)) : memo;
6806
- return memo;
6808
+ return Array.isArray(componentEvents) ? memo.concat.apply(memo, _toConsumableArray(componentEvents)) : memo;
6807
6809
  }, []);
6808
6810
  return events && events.length ? events : undefined;
6809
6811
  }
@@ -7161,6 +7163,7 @@ function reduceChildren(children, iteratee) {
7161
7163
 
7162
7164
  var traverseChildren = function (childArray, names, parent) {
7163
7165
  return childArray.reduce(function (memo, child, index) {
7166
+ var newMemo = memo;
7164
7167
  var childRole = child.type && child.type.role;
7165
7168
  var childName = child.props.name || "".concat(childRole, "-").concat(names[index]);
7166
7169
 
@@ -7178,16 +7181,16 @@ function reduceChildren(children, iteratee) {
7178
7181
  });
7179
7182
 
7180
7183
  var nestedResults = traverseChildren(nestedChildren, _childNames, child);
7181
- memo = combine(memo, nestedResults);
7184
+ newMemo = combine(newMemo, nestedResults);
7182
7185
  } else {
7183
7186
  var result = iteratee(child, childName, parent);
7184
7187
 
7185
7188
  if (result) {
7186
- memo = combine(memo, result);
7189
+ newMemo = combine(newMemo, result);
7187
7190
  }
7188
7191
  }
7189
7192
 
7190
- return memo;
7193
+ return newMemo;
7191
7194
  }, initialMemo);
7192
7195
  };
7193
7196
 
@@ -7213,8 +7216,7 @@ function isHorizontal(props) {
7213
7216
  var childProps = child.props || {};
7214
7217
 
7215
7218
  if (memo || childProps.horizontal || !childProps.children) {
7216
- memo = memo || childProps.horizontal;
7217
- return memo;
7219
+ return memo || childProps.horizontal;
7218
7220
  }
7219
7221
 
7220
7222
  return traverseChildren(react__WEBPACK_IMPORTED_MODULE_6___default().Children.toArray(childProps.children));
@@ -7468,11 +7470,13 @@ function isMap(x) {
7468
7470
  }
7469
7471
  function shallowToJS(x, whitelist) {
7470
7472
  return isIterable(x) ? x.reduce(function (result, curr, key) {
7473
+ var newCurr = curr;
7474
+
7471
7475
  if (whitelist && whitelist[key]) {
7472
- curr = shallowToJS(curr);
7476
+ newCurr = shallowToJS(curr);
7473
7477
  }
7474
7478
 
7475
- result[key] = curr;
7479
+ result[key] = newCurr;
7476
7480
  return result;
7477
7481
  }, isList(x) ? [] : {}) : x;
7478
7482
  }
@@ -7609,12 +7613,10 @@ __webpack_require__.r(__webpack_exports__);
7609
7613
  /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./helpers */ "./victory-util/helpers.ts");
7610
7614
 
7611
7615
 
7612
- /* eslint-disable no-use-before-define */
7613
-
7614
7616
 
7615
7617
  // Private Functions
7616
- function getVerticalAnchor(props, datum) {
7617
- datum = datum || {};
7618
+ function getVerticalAnchor(props) {
7619
+ var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
7618
7620
  var sign = datum._y >= 0 ? 1 : -1;
7619
7621
  var labelStyle = props.style && props.style.labels || {};
7620
7622
 
@@ -7627,8 +7629,8 @@ function getVerticalAnchor(props, datum) {
7627
7629
  return "middle";
7628
7630
  }
7629
7631
 
7630
- function getTextAnchor(props, datum) {
7631
- datum = datum || {};
7632
+ function getTextAnchor(props) {
7633
+ var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
7632
7634
  var style = props.style,
7633
7635
  horizontal = props.horizontal;
7634
7636
  var sign = datum._y >= 0 ? 1 : -1;
@@ -7643,14 +7645,14 @@ function getTextAnchor(props, datum) {
7643
7645
  return sign >= 0 ? "start" : "end";
7644
7646
  }
7645
7647
 
7646
- function getAngle(props, datum) {
7647
- datum = datum || {};
7648
+ function getAngle(props) {
7649
+ var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
7648
7650
  var labelStyle = props.style && props.style.labels || {};
7649
7651
  return datum.angle === undefined ? labelStyle.angle : datum.angle;
7650
7652
  }
7651
7653
 
7652
- function getPadding(props, datum) {
7653
- datum = datum || {};
7654
+ function getPadding(props) {
7655
+ var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
7654
7656
  var horizontal = props.horizontal,
7655
7657
  style = props.style;
7656
7658
  var labelStyle = style.labels || {};
@@ -7729,8 +7731,9 @@ function getPolarOrientation(degrees) {
7729
7731
  } // Exported Functions
7730
7732
 
7731
7733
 
7732
- function getText(props, datum, index) {
7733
- datum = datum || {};
7734
+ function getText(props) {
7735
+ var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
7736
+ var index = arguments.length > 2 ? arguments[2] : undefined;
7734
7737
 
7735
7738
  if (datum.label !== undefined) {
7736
7739
  return datum.label;
@@ -8553,8 +8556,7 @@ function getSVGEventCoordinates(evt, svg) {
8553
8556
  }
8554
8557
 
8555
8558
  var location = isReactTouchEvent(evt) ? evt.changedTouches[0] : evt;
8556
- svg = svg || getParentSVG(location);
8557
- var matrix = getTransformationMatrix(svg);
8559
+ var matrix = getTransformationMatrix(svg || getParentSVG(location));
8558
8560
  return {
8559
8561
  x: transformTarget(location.clientX, matrix, "x"),
8560
8562
  y: transformTarget(location.clientY, matrix, "y")
@@ -9196,11 +9198,10 @@ var Timer = /*#__PURE__*/function () {
9196
9198
  }, {
9197
9199
  key: "subscribe",
9198
9200
  value: function subscribe(callback, duration) {
9199
- duration = this.shouldAnimate ? duration : 0;
9200
9201
  var subscriptionID = this.subscribers.push({
9201
9202
  startTime: (0,victory_vendor_d3_timer__WEBPACK_IMPORTED_MODULE_0__.now)(),
9202
9203
  callback: callback,
9203
- duration: duration
9204
+ duration: this.shouldAnimate ? duration : 0
9204
9205
  });
9205
9206
  this.activeSubscriptions++;
9206
9207
  this.start();
@@ -9387,36 +9388,38 @@ function getInitialChildProps(animate, data) {
9387
9388
 
9388
9389
 
9389
9390
  function getChildBeforeLoad(animate, child, data, cb) {
9390
- animate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
9391
+ var newAnimate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
9391
9392
  onEnd: cb
9392
9393
  });
9393
9394
 
9394
- if (animate && animate.onLoad && !animate.onLoad.duration) {
9395
+ if (newAnimate && newAnimate.onLoad && !newAnimate.onLoad.duration) {
9395
9396
  return {
9396
- animate: animate,
9397
+ animate: newAnimate,
9397
9398
  data: data
9398
9399
  };
9399
9400
  }
9400
9401
 
9401
- var before = animate.onLoad && animate.onLoad.before ? animate.onLoad.before : (lodash_identity__WEBPACK_IMPORTED_MODULE_1___default()); // If nodes need to exit, transform them with the provided onLoad.before function.
9402
+ var before = newAnimate.onLoad && newAnimate.onLoad.before ? newAnimate.onLoad.before : (lodash_identity__WEBPACK_IMPORTED_MODULE_1___default()); // If nodes need to exit, transform them with the provided onLoad.before function.
9402
9403
 
9403
- data = data.map(function (datum, idx) {
9404
+ var newData = data.map(function (datum, idx) {
9404
9405
  return lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, before(datum, idx, data));
9405
9406
  });
9406
9407
  return {
9407
- animate: animate,
9408
- data: data,
9408
+ animate: newAnimate,
9409
+ data: newData,
9409
9410
  clipWidth: 0
9410
9411
  };
9411
9412
  } // eslint-disable-next-line max-params
9412
9413
 
9413
9414
 
9414
9415
  function getChildOnLoad(animate, data, cb) {
9415
- animate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
9416
+ var newAnimate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
9416
9417
  onEnd: cb
9417
9418
  });
9418
9419
 
9419
- if (animate && animate.onLoad && !animate.onLoad.duration) {
9420
+ var newData = data;
9421
+
9422
+ if (newAnimate && newAnimate.onLoad && !newAnimate.onLoad.duration) {
9420
9423
  return {
9421
9424
  animate: animate,
9422
9425
  data: data
@@ -9425,12 +9428,12 @@ function getChildOnLoad(animate, data, cb) {
9425
9428
 
9426
9429
  var after = animate.onLoad && animate.onLoad.after ? animate.onLoad.after : (lodash_identity__WEBPACK_IMPORTED_MODULE_1___default()); // If nodes need to exit, transform them with the provided onLoad.after function.
9427
9430
 
9428
- data = data.map(function (datum, idx) {
9431
+ newData = data.map(function (datum, idx) {
9429
9432
  return lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, after(datum, idx, data));
9430
9433
  });
9431
9434
  return {
9432
- animate: animate,
9433
- data: data
9435
+ animate: newAnimate,
9436
+ data: newData
9434
9437
  };
9435
9438
  } // eslint-disable-next-line max-params, max-len
9436
9439
 
@@ -9439,7 +9442,10 @@ function getChildPropsOnExit(animate, child, data, exitingNodes, cb) {
9439
9442
  // Whether or not _this_ child has exiting nodes, we want the exit-
9440
9443
  // transition for all children to have the same duration, delay, etc.
9441
9444
  var onExit = animate && animate.onExit;
9442
- animate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, onExit);
9445
+
9446
+ var newAnimate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, onExit);
9447
+
9448
+ var newData = data;
9443
9449
 
9444
9450
  if (exitingNodes) {
9445
9451
  // After the exit transition occurs, trigger the animations for
@@ -9447,39 +9453,42 @@ function getChildPropsOnExit(animate, child, data, exitingNodes, cb) {
9447
9453
  animate.onEnd = cb;
9448
9454
  var before = animate.onExit && animate.onExit.before ? animate.onExit.before : (lodash_identity__WEBPACK_IMPORTED_MODULE_1___default()); // If nodes need to exit, transform them with the provided onExit.before function.
9449
9455
 
9450
- data = data.map(function (datum, idx) {
9456
+ newData = data.map(function (datum, idx) {
9451
9457
  var key = (datum.key || idx).toString();
9452
9458
  return exitingNodes[key] ? lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, before(datum, idx, data)) : datum;
9453
9459
  });
9454
9460
  }
9455
9461
 
9456
9462
  return {
9457
- animate: animate,
9458
- data: data
9463
+ animate: newAnimate,
9464
+ data: newData
9459
9465
  };
9460
9466
  } // eslint-disable-next-line max-params,max-len
9461
9467
 
9462
9468
 
9463
9469
  function getChildPropsBeforeEnter(animate, child, data, enteringNodes, cb) {
9470
+ var newAnimate = animate;
9471
+ var newData = data;
9472
+
9464
9473
  if (enteringNodes) {
9465
9474
  // Perform a normal animation here, except - when it finishes - trigger
9466
9475
  // the transition for entering nodes.
9467
- animate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
9476
+ newAnimate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
9468
9477
  onEnd: cb
9469
9478
  });
9470
9479
  var before = animate.onEnter && animate.onEnter.before ? animate.onEnter.before : (lodash_identity__WEBPACK_IMPORTED_MODULE_1___default()); // We want the entering nodes to be included in the transition target
9471
9480
  // domain. However, we may not want these nodes to be displayed initially,
9472
9481
  // so perform the `onEnter.before` transformation on each node.
9473
9482
 
9474
- data = data.map(function (datum, idx) {
9483
+ newData = data.map(function (datum, idx) {
9475
9484
  var key = (datum.key || idx).toString();
9476
9485
  return enteringNodes[key] ? lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, before(datum, idx, data)) : datum;
9477
9486
  });
9478
9487
  }
9479
9488
 
9480
9489
  return {
9481
- animate: animate,
9482
- data: data
9490
+ animate: newAnimate,
9491
+ data: newData
9483
9492
  };
9484
9493
  } // eslint-disable-next-line max-params, max-len
9485
9494
 
@@ -9488,23 +9497,26 @@ function getChildPropsOnEnter(animate, data, enteringNodes, cb) {
9488
9497
  // Whether or not _this_ child has entering nodes, we want the entering-
9489
9498
  // transition for all children to have the same duration, delay, etc.
9490
9499
  var onEnter = animate && animate.onEnter;
9491
- animate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, onEnter);
9500
+
9501
+ var newAnimate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, onEnter);
9502
+
9503
+ var newData = data;
9492
9504
 
9493
9505
  if (enteringNodes) {
9494
9506
  // Old nodes have been transitioned to their new values, and the
9495
9507
  // domain should encompass the nodes that will now enter. So perform
9496
9508
  // the `onEnter.after` transformation on each node.
9497
- animate.onEnd = cb;
9498
- var after = animate.onEnter && animate.onEnter.after ? animate.onEnter.after : (lodash_identity__WEBPACK_IMPORTED_MODULE_1___default());
9499
- data = data.map(function (datum, idx) {
9509
+ newAnimate.onEnd = cb;
9510
+ var after = newAnimate.onEnter && newAnimate.onEnter.after ? newAnimate.onEnter.after : (lodash_identity__WEBPACK_IMPORTED_MODULE_1___default());
9511
+ newData = data.map(function (datum, idx) {
9500
9512
  var key = getDatumKey(datum, idx);
9501
9513
  return enteringNodes[key] ? lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, after(datum, idx, data)) : datum;
9502
9514
  });
9503
9515
  }
9504
9516
 
9505
9517
  return {
9506
- animate: animate,
9507
- data: data
9518
+ animate: newAnimate,
9519
+ data: newData
9508
9520
  };
9509
9521
  }
9510
9522
  /**
@@ -9670,6 +9682,7 @@ function getTransitionPropsFactory(props, state, setState) {
9670
9682
  "use strict";
9671
9683
  __webpack_require__.r(__webpack_exports__);
9672
9684
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9685
+ /* harmony export */ "assert": () => (/* binding */ assert),
9673
9686
  /* harmony export */ "getSafeUserProps": () => (/* binding */ getSafeUserProps),
9674
9687
  /* harmony export */ "withSafeUserProps": () => (/* binding */ withSafeUserProps)
9675
9688
  /* harmony export */ });
@@ -9750,6 +9763,18 @@ var testIfSafeProp = function (key) {
9750
9763
  if (doesPropStartWith(key) || isExactMatch(key)) return true;
9751
9764
  return false;
9752
9765
  };
9766
+ /**
9767
+ * Asserts that value is not null or undefined, throwing an error if it is.
9768
+ * @param value The value to assert
9769
+ * @param message The error message to throw
9770
+ */
9771
+
9772
+
9773
+ function assert(value, message) {
9774
+ if (value === undefined || value === null) {
9775
+ throw new Error(message);
9776
+ }
9777
+ }
9753
9778
  /**
9754
9779
  * getSafeUserProps - function that takes in a props object and removes any
9755
9780
  * key-value entries that do not match filter strings in the USER_PROPS_SAFELIST
@@ -9759,7 +9784,6 @@ var testIfSafeProp = function (key) {
9759
9784
  * @returns {Object}: object containing remaining acceptable props
9760
9785
  */
9761
9786
 
9762
-
9763
9787
  var getSafeUserProps = function (props) {
9764
9788
  var propsToFilter = _objectSpread({}, props);
9765
9789
 
@@ -9962,12 +9986,13 @@ function getDataFromChildren(props, childComponents) {
9962
9986
  var childProps = lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()({}, child.props, parentProps);
9963
9987
 
9964
9988
  var childData;
9989
+ var childElement = child;
9965
9990
 
9966
9991
  if (!_data__WEBPACK_IMPORTED_MODULE_12__.isDataComponent(child)) {
9967
9992
  return null;
9968
9993
  } else if (child.type && lodash_isFunction__WEBPACK_IMPORTED_MODULE_5___default()(child.type.getData)) {
9969
- child = parent ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default().cloneElement(child, parent.props) : child;
9970
- childData = child.type.getData(childProps);
9994
+ childElement = parent ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default().cloneElement(child, parent.props) : child;
9995
+ childData = childElement.type.getData(childProps);
9971
9996
  } else {
9972
9997
  childData = _data__WEBPACK_IMPORTED_MODULE_12__.getData(childProps);
9973
9998
  }
@@ -9998,17 +10023,16 @@ function getData(props, childComponents) {
9998
10023
  return _data__WEBPACK_IMPORTED_MODULE_12__.getData(props);
9999
10024
  }
10000
10025
 
10001
- childComponents = childComponents || react__WEBPACK_IMPORTED_MODULE_9___default().Children.toArray(props.children);
10002
- return getDataFromChildren(props, childComponents);
10026
+ return getDataFromChildren(props, childComponents || react__WEBPACK_IMPORTED_MODULE_9___default().Children.toArray(props.children));
10003
10027
  }
10004
10028
  function getWidth(props, groupLength, seriesLength) {
10005
10029
  var datasets = props.datasets,
10006
10030
  horizontal = props.horizontal;
10007
10031
  var range = horizontal ? _helpers__WEBPACK_IMPORTED_MODULE_11__.getRange(props, "y") : _helpers__WEBPACK_IMPORTED_MODULE_11__.getRange(props, "x");
10008
10032
  var extent = Math.abs(range[1] - range[0]);
10009
- seriesLength = seriesLength !== undefined ? seriesLength : Array.isArray(datasets[0]) && datasets[0].length || 1;
10010
- groupLength = groupLength || datasets.length;
10011
- var bars = groupLength * seriesLength;
10033
+ var seriesLengthValue = seriesLength !== undefined ? seriesLength : Array.isArray(datasets[0]) && datasets[0].length || 1;
10034
+ var groupLengthValue = groupLength || datasets.length;
10035
+ var bars = groupLengthValue * seriesLengthValue;
10012
10036
  var barRatio = 0.5;
10013
10037
  return Math.round(barRatio * extent / bars);
10014
10038
  }
@@ -10100,9 +10124,9 @@ function getDomainFromChildren(props, axis, childComponents) {
10100
10124
  return [min, max];
10101
10125
  }
10102
10126
  function getDomain(props, axis, childComponents) {
10103
- childComponents = childComponents || react__WEBPACK_IMPORTED_MODULE_9___default().Children.toArray(props.children);
10127
+ var children = childComponents || react__WEBPACK_IMPORTED_MODULE_9___default().Children.toArray(props.children);
10104
10128
  var propsDomain = _domain__WEBPACK_IMPORTED_MODULE_13__.getDomainFromProps(props, axis);
10105
- var domainPadding = getDefaultDomainPadding(props, axis, childComponents);
10129
+ var domainPadding = getDefaultDomainPadding(props, axis, children);
10106
10130
  var domain;
10107
10131
 
10108
10132
  if (propsDomain) {
@@ -10112,7 +10136,7 @@ function getDomain(props, axis, childComponents) {
10112
10136
  var maxDomain = _domain__WEBPACK_IMPORTED_MODULE_13__.getMaxFromProps(props, axis);
10113
10137
  var dataset = (props.data || props.y) && _data__WEBPACK_IMPORTED_MODULE_12__.getData(props);
10114
10138
  var dataDomain = dataset ? _domain__WEBPACK_IMPORTED_MODULE_13__.getDomainFromData(props, axis, dataset) : [];
10115
- var childDomain = getDomainFromChildren(props, axis, childComponents);
10139
+ var childDomain = getDomainFromChildren(props, axis, children);
10116
10140
  var min = minDomain || _collection__WEBPACK_IMPORTED_MODULE_14__.getMinValue([].concat(_toConsumableArray(dataDomain), _toConsumableArray(childDomain)));
10117
10141
  var max = maxDomain || _collection__WEBPACK_IMPORTED_MODULE_14__.getMaxValue([].concat(_toConsumableArray(dataDomain), _toConsumableArray(childDomain)));
10118
10142
  domain = _domain__WEBPACK_IMPORTED_MODULE_13__.getDomainFromMinMax(min, max);
@@ -10274,10 +10298,10 @@ function getCategoryAndAxisStringsFromChildren(props, axis, childComponents) {
10274
10298
  return lodash_uniq__WEBPACK_IMPORTED_MODULE_4___default()(lodash_flatten__WEBPACK_IMPORTED_MODULE_6___default()([].concat(_toConsumableArray(categoryStrings), _toConsumableArray(axisStrings))));
10275
10299
  }
10276
10300
  function getStringsFromChildren(props, childComponents) {
10277
- childComponents = childComponents || react__WEBPACK_IMPORTED_MODULE_9___default().Children.toArray(props.children);
10278
- var xStrings = getCategoryAndAxisStringsFromChildren(props, "x", childComponents);
10279
- var yStrings = getCategoryAndAxisStringsFromChildren(props, "y", childComponents);
10280
- var dataStrings = getStringsFromData(childComponents);
10301
+ var children = childComponents || react__WEBPACK_IMPORTED_MODULE_9___default().Children.toArray(props.children);
10302
+ var xStrings = getCategoryAndAxisStringsFromChildren(props, "x", children);
10303
+ var yStrings = getCategoryAndAxisStringsFromChildren(props, "y", children);
10304
+ var dataStrings = getStringsFromData(children);
10281
10305
  return {
10282
10306
  x: lodash_uniq__WEBPACK_IMPORTED_MODULE_4___default()(lodash_flatten__WEBPACK_IMPORTED_MODULE_6___default()([].concat(_toConsumableArray(xStrings), _toConsumableArray(dataStrings.x)))),
10283
10307
  y: lodash_uniq__WEBPACK_IMPORTED_MODULE_4___default()(lodash_flatten__WEBPACK_IMPORTED_MODULE_6___default()([].concat(_toConsumableArray(yStrings), _toConsumableArray(dataStrings.y))))