victory-bar 36.8.2 → 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.
@@ -194,14 +194,13 @@ var defaultProps = {
194
194
  shapeRendering: "auto"
195
195
  }; // eslint-disable-next-line prefer-arrow-callback
196
196
 
197
- var Bar = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.forwardRef)(function Bar(props, ref) {
198
- props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), props));
199
- var _props = props,
200
- polar = _props.polar,
201
- origin = _props.origin,
202
- style = _props.style,
203
- barWidth = _props.barWidth,
204
- cornerRadius = _props.cornerRadius;
197
+ var Bar = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.forwardRef)(function Bar(initialProps, ref) {
198
+ var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps));
199
+ var polar = props.polar,
200
+ origin = props.origin,
201
+ style = props.style,
202
+ barWidth = props.barWidth,
203
+ cornerRadius = props.cornerRadius;
205
204
  var path = polar ? (0,_path_helper_methods__WEBPACK_IMPORTED_MODULE_5__.getPolarBarPath)(props, cornerRadius) : (0,_path_helper_methods__WEBPACK_IMPORTED_MODULE_5__.getBarPath)(props, barWidth, cornerRadius);
206
205
  var defaultTransform = polar && origin ? "translate(".concat(origin.x, ", ").concat(origin.y, ")") : undefined;
207
206
 
@@ -429,32 +428,33 @@ var getCalculatedValues = function (props) {
429
428
  };
430
429
  };
431
430
 
432
- var getBaseProps = function (props, fallbackProps) {
433
- var modifiedProps = victory_core__WEBPACK_IMPORTED_MODULE_4__.modifyProps(props, fallbackProps, "bar");
434
- props = lodash_assign__WEBPACK_IMPORTED_MODULE_1___default()({}, modifiedProps, getCalculatedValues(modifiedProps));
435
- var _props = props,
436
- alignment = _props.alignment,
437
- barRatio = _props.barRatio,
438
- cornerRadius = _props.cornerRadius,
439
- data = _props.data,
440
- disableInlineStyles = _props.disableInlineStyles,
441
- domain = _props.domain,
442
- events = _props.events,
443
- height = _props.height,
444
- horizontal = _props.horizontal,
445
- origin = _props.origin,
446
- padding = _props.padding,
447
- polar = _props.polar,
448
- scale = _props.scale,
449
- sharedEvents = _props.sharedEvents,
450
- standalone = _props.standalone,
451
- style = _props.style,
452
- theme = _props.theme,
453
- width = _props.width,
454
- labels = _props.labels,
455
- name = _props.name,
456
- barWidth = _props.barWidth,
457
- getPath = _props.getPath;
431
+ var getBaseProps = function (initialProps, fallbackProps) {
432
+ var modifiedProps = victory_core__WEBPACK_IMPORTED_MODULE_4__.modifyProps(initialProps, fallbackProps, "bar");
433
+
434
+ var props = lodash_assign__WEBPACK_IMPORTED_MODULE_1___default()({}, modifiedProps, getCalculatedValues(modifiedProps));
435
+
436
+ var alignment = props.alignment,
437
+ barRatio = props.barRatio,
438
+ cornerRadius = props.cornerRadius,
439
+ data = props.data,
440
+ disableInlineStyles = props.disableInlineStyles,
441
+ domain = props.domain,
442
+ events = props.events,
443
+ height = props.height,
444
+ horizontal = props.horizontal,
445
+ origin = props.origin,
446
+ padding = props.padding,
447
+ polar = props.polar,
448
+ scale = props.scale,
449
+ sharedEvents = props.sharedEvents,
450
+ standalone = props.standalone,
451
+ style = props.style,
452
+ theme = props.theme,
453
+ width = props.width,
454
+ labels = props.labels,
455
+ name = props.name,
456
+ barWidth = props.barWidth,
457
+ getPath = props.getPath;
458
458
  var initialChildProps = {
459
459
  parent: {
460
460
  horizontal: horizontal,
@@ -606,9 +606,11 @@ var transformAngle = function (angle) {
606
606
  var getCustomBarPath = function (props, width) {
607
607
  var getPath = props.getPath;
608
608
 
609
- var propsWithCalculatedValues = _objectSpread(_objectSpread({}, props), getPosition(props, width));
609
+ if (typeof getPath === "function") {
610
+ var propsWithCalculatedValues = _objectSpread(_objectSpread({}, props), getPosition(props, width));
610
611
 
611
- return getPath(propsWithCalculatedValues);
612
+ return getPath(propsWithCalculatedValues);
613
+ }
612
614
  };
613
615
 
614
616
  var getStartAngle = function (props, index) {
@@ -653,8 +655,7 @@ var mapPointsToPath = function (coords, cornerRadius, direction) {
653
655
  var bottomRightPath = "".concat(cornerRadius.bottomRight, " ").concat(cornerRadius.bottomRight, " ").concat(direction);
654
656
  var commands = ["M", "A ".concat(bottomLeftPath, ","), "L", "A ".concat(topLeftPath, ","), "L", "A ".concat(topRightPath, ","), "L", "A ".concat(bottomRightPath, ",")];
655
657
  var path = commands.reduce(function (acc, command, i) {
656
- acc += "".concat(command, " ").concat(coords[i].x, ", ").concat(coords[i].y, " \n");
657
- return acc;
658
+ return "".concat(acc).concat(command, " ").concat(coords[i].x, ", ").concat(coords[i].y, " \n");
658
659
  }, "");
659
660
  return "".concat(path, " z");
660
661
  };
@@ -877,8 +878,8 @@ var getVerticalPolarBarPath = function (props, cornerRadius) {
877
878
  start = alignment === "start" ? currentAngle : currentAngle - size;
878
879
  end = alignment === "end" ? currentAngle : currentAngle + size;
879
880
  } else {
880
- start = getStartAngle(props, index);
881
- end = getEndAngle(props, index);
881
+ start = getStartAngle(props, Number(index));
882
+ end = getEndAngle(props, Number(index));
882
883
  }
883
884
 
884
885
  var getPath = function (edge) {
@@ -1006,8 +1007,7 @@ var getVerticalPolarBarPath = function (props, cornerRadius) {
1006
1007
  var bottomPath = getBottomPath();
1007
1008
  var moves = [].concat(_toConsumableArray(topPath), _toConsumableArray(bottomPath));
1008
1009
  var path = moves.reduce(function (memo, move) {
1009
- memo += "".concat(move.command, " ").concat(move.coords.join());
1010
- return memo;
1010
+ return "".concat(memo).concat(move.command, " ").concat(move.coords.join());
1011
1011
  }, "");
1012
1012
  return "".concat(path, " z");
1013
1013
  };
@@ -7958,12 +7958,12 @@ var interpolateFunction = function (a, b) {
7958
7958
  * differs in that it uses our custom interpolators when interpolating the value of each property in
7959
7959
  * an object. This allows the correct interpolation of nested objects, including styles
7960
7960
  *
7961
- * @param {any} a - Start value.
7962
- * @param {any} b - End value.
7961
+ * @param {any} startValue - Start value.
7962
+ * @param {any} endValue - End value.
7963
7963
  * @returns {Function} An interpolation function.
7964
7964
  */
7965
7965
 
7966
- var interpolateObject = function (a, b) {
7966
+ var interpolateObject = function (startValue, endValue) {
7967
7967
  var interpolateTypes = function (x, y) {
7968
7968
  if (x === y || !isInterpolatable(x) || !isInterpolatable(y)) {
7969
7969
  return interpolateImmediate(x, y);
@@ -7988,6 +7988,8 @@ var interpolateObject = function (a, b) {
7988
7988
 
7989
7989
  var i = {};
7990
7990
  var c = {};
7991
+ var a = startValue;
7992
+ var b = endValue;
7991
7993
  var k;
7992
7994
 
7993
7995
  if (a === null || typeof a !== "object") {
@@ -8155,8 +8157,8 @@ var VictoryAnimation = /*#__PURE__*/function (_React$Component) {
8155
8157
  step can generate imprecise values, sometimes greater than 1
8156
8158
  if this happens set the state to 1 and return, cancelling the timer
8157
8159
  */
8158
- duration = duration !== undefined ? duration : _this.props.duration;
8159
- var step = duration ? elapsed / duration : 1;
8160
+ var animationDuration = duration !== undefined ? duration : _this.props.duration;
8161
+ var step = animationDuration ? elapsed / animationDuration : 1;
8160
8162
 
8161
8163
  if (step >= 1) {
8162
8164
  _this.setState({
@@ -8772,8 +8774,7 @@ var getStyles = function (style, props) {
8772
8774
  }
8773
8775
 
8774
8776
  var getSingleStyle = function (s) {
8775
- s = s ? lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, s, defaultStyles) : defaultStyles;
8776
- var baseStyles = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.evaluateStyle(s, props);
8777
+ var baseStyles = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.evaluateStyle(s ? lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, s, defaultStyles) : defaultStyles, props);
8777
8778
  return lodash_assign__WEBPACK_IMPORTED_MODULE_2___default()({}, baseStyles, {
8778
8779
  fontSize: getFontSize(baseStyles)
8779
8780
  });
@@ -8977,22 +8978,19 @@ var getInlineXOffset = function (calculatedProps, textElements, index) {
8977
8978
  switch (textAnchor) {
8978
8979
  case "start":
8979
8980
  return widths.reduce(function (memo, width, i) {
8980
- memo = i < index ? memo + width : memo;
8981
- return memo;
8981
+ return i < index ? memo + width : memo;
8982
8982
  }, 0);
8983
8983
 
8984
8984
  case "end":
8985
8985
  return widths.reduce(function (memo, width, i) {
8986
- memo = i > index ? memo - width : memo;
8987
- return memo;
8986
+ return i > index ? memo - width : memo;
8988
8987
  }, 0);
8989
8988
 
8990
8989
  default:
8991
8990
  // middle
8992
8991
  return widths.reduce(function (memo, width, i) {
8993
8992
  var offsetWidth = i < index ? width : 0;
8994
- memo = i === index ? memo + width / 2 : memo + offsetWidth;
8995
- return memo;
8993
+ return i === index ? memo + width / 2 : memo + offsetWidth;
8996
8994
  }, centerOffset);
8997
8995
  }
8998
8996
  };
@@ -9194,8 +9192,8 @@ var defaultProps = {
9194
9192
  // Magic number from d3.
9195
9193
  lineHeight: 1
9196
9194
  };
9197
- var VictoryLabel = function (props) {
9198
- props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), props));
9195
+ var VictoryLabel = function (initialProps) {
9196
+ var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps));
9199
9197
 
9200
9198
  if (props.text === null || props.text === undefined) {
9201
9199
  return null;
@@ -9216,7 +9214,7 @@ var VictoryLabel = function (props) {
9216
9214
  fontSize: currentStyle.fontSize || defaultStyles.fontSize,
9217
9215
  capHeight: capHeightPx,
9218
9216
  text: line,
9219
- // @ts-expect-error TODO: This looks like a bug:
9217
+ // TODO: This looks like a bug:
9220
9218
  textSize: _victory_util_textsize__WEBPACK_IMPORTED_MODULE_12__.approximateTextSize(line, currentStyle),
9221
9219
  lineHeight: currentLineHeight,
9222
9220
  backgroundPadding: getSingleValue(backgroundPadding, i)
@@ -10908,8 +10906,7 @@ function addEvents(WrappedComponent) {
10908
10906
  value: function applyExternalMutations(props, externalMutations) {
10909
10907
  if (!lodash_isEmpty__WEBPACK_IMPORTED_MODULE_5___default()(externalMutations)) {
10910
10908
  var callbacks = props.externalEventMutations.reduce(function (memo, mutation) {
10911
- memo = lodash_isFunction__WEBPACK_IMPORTED_MODULE_4___default()(mutation.callback) ? memo.concat(mutation.callback) : memo;
10912
- return memo;
10909
+ return lodash_isFunction__WEBPACK_IMPORTED_MODULE_4___default()(mutation.callback) ? memo.concat(mutation.callback) : memo;
10913
10910
  }, []);
10914
10911
  var compiledCallbacks = callbacks.length ? function () {
10915
10912
  callbacks.forEach(function (c) {
@@ -10964,8 +10961,8 @@ function addEvents(WrappedComponent) {
10964
10961
  }, {
10965
10962
  key: "getBaseProps",
10966
10963
  value: function getBaseProps(props, getSharedEventState) {
10967
- getSharedEventState = getSharedEventState || this.getSharedEventState.bind(this);
10968
- var sharedParentState = getSharedEventState("parent", "parent");
10964
+ var getSharedEventStateFunction = getSharedEventState || this.getSharedEventState.bind(this);
10965
+ var sharedParentState = getSharedEventStateFunction("parent", "parent");
10969
10966
  var parentState = this.getEventState("parent", "parent");
10970
10967
 
10971
10968
  var baseParentProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_7___default()({}, parentState, sharedParentState);
@@ -11064,13 +11061,15 @@ function addEvents(WrappedComponent) {
11064
11061
  var dataKeys = lodash_without__WEBPACK_IMPORTED_MODULE_0___default()(this.dataKeys, "all");
11065
11062
 
11066
11063
  var labelComponents = dataKeys.reduce(function (memo, key) {
11064
+ var newMemo = memo;
11065
+
11067
11066
  var labelProps = _this8.getComponentProps(labelComponent, "labels", key);
11068
11067
 
11069
11068
  if (labelProps && labelProps.text !== undefined && labelProps.text !== null) {
11070
- memo = memo.concat( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default().cloneElement(labelComponent, labelProps));
11069
+ newMemo = newMemo.concat( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default().cloneElement(labelComponent, labelProps));
11071
11070
  }
11072
11071
 
11073
- return memo;
11072
+ return newMemo;
11074
11073
  }, []);
11075
11074
  var dataProps = this.getComponentProps(dataComponent, "data", "all");
11076
11075
  var children = [/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default().cloneElement(dataComponent, dataProps)].concat(_toConsumableArray(labelComponents));
@@ -11320,12 +11319,14 @@ function sortData(dataset, sortKey) {
11320
11319
  } // Ensures previous VictoryLine api for sortKey prop stays consistent
11321
11320
 
11322
11321
 
11322
+ var formattedSortKey = sortKey;
11323
+
11323
11324
  if (sortKey === "x" || sortKey === "y") {
11324
- sortKey = "_".concat(sortKey);
11325
+ formattedSortKey = "_".concat(sortKey);
11325
11326
  }
11326
11327
 
11327
11328
  var order = sortOrder === "ascending" ? "asc" : "desc";
11328
- return lodash_orderBy__WEBPACK_IMPORTED_MODULE_5___default()(dataset, sortKey, order);
11329
+ return lodash_orderBy__WEBPACK_IMPORTED_MODULE_5___default()(dataset, formattedSortKey, order);
11329
11330
  } // This method will remove data points that break certain scales. (log scale only)
11330
11331
 
11331
11332
 
@@ -11516,7 +11517,10 @@ function formatData(dataset, props, expectedKeys) {
11516
11517
  return [];
11517
11518
  }
11518
11519
 
11519
- var defaultKeys = ["x", "y", "y0"];
11520
+ var defaultKeys = ["x", "y", "y0"]; // TODO: We shouldn’t mutate the expectedKeys param here,
11521
+ // but we need to figure out why changing it causes regressions in tests.
11522
+ // eslint-disable-next-line no-param-reassign
11523
+
11520
11524
  expectedKeys = Array.isArray(expectedKeys) ? expectedKeys : defaultKeys;
11521
11525
 
11522
11526
  var createAccessor = function (name) {
@@ -11541,13 +11545,13 @@ function formatData(dataset, props, expectedKeys) {
11541
11545
 
11542
11546
  var data = preformattedData ? dataset : dataset.reduce(function (dataArr, datum, index) {
11543
11547
  // eslint-disable-line complexity
11544
- datum = parseDatum(datum);
11548
+ var parsedDatum = parseDatum(datum);
11545
11549
  var fallbackValues = {
11546
11550
  x: index,
11547
- y: datum
11551
+ y: parsedDatum
11548
11552
  };
11549
11553
  var processedValues = expectedKeys.reduce(function (memo, type) {
11550
- var processedValue = accessor[type](datum);
11554
+ var processedValue = accessor[type](parsedDatum);
11551
11555
  var value = processedValue !== undefined ? processedValue : fallbackValues[type];
11552
11556
 
11553
11557
  if (value !== undefined) {
@@ -11562,7 +11566,7 @@ function formatData(dataset, props, expectedKeys) {
11562
11566
  return memo;
11563
11567
  }, {});
11564
11568
 
11565
- var formattedDatum = lodash_assign__WEBPACK_IMPORTED_MODULE_12___default()({}, processedValues, datum);
11569
+ var formattedDatum = lodash_assign__WEBPACK_IMPORTED_MODULE_12___default()({}, processedValues, parsedDatum);
11566
11570
 
11567
11571
  if (!lodash_isEmpty__WEBPACK_IMPORTED_MODULE_4___default()(formattedDatum)) {
11568
11572
  dataArr.push(formattedDatum);
@@ -11673,8 +11677,8 @@ function getStringsFromData(props, axis) {
11673
11677
  }, []);
11674
11678
  var sortedData = sortData(data, props.sortKey, props.sortOrder);
11675
11679
  var dataStrings = sortedData.reduce(function (dataArr, datum) {
11676
- datum = parseDatum(datum);
11677
- dataArr.push(accessor(datum));
11680
+ var parsedDatum = parseDatum(datum);
11681
+ dataArr.push(accessor(parsedDatum));
11678
11682
  return dataArr;
11679
11683
  }, []).filter(function (datum) {
11680
11684
  return typeof datum === "string";
@@ -11918,18 +11922,18 @@ function padDomain(domain, props, axis) {
11918
11922
 
11919
11923
 
11920
11924
  function createDomainFunction(getDomainFromDataFunction, formatDomainFunction) {
11921
- getDomainFromDataFunction = lodash_isFunction__WEBPACK_IMPORTED_MODULE_2___default()(getDomainFromDataFunction) ? getDomainFromDataFunction : getDomainFromData;
11922
- formatDomainFunction = lodash_isFunction__WEBPACK_IMPORTED_MODULE_2___default()(formatDomainFunction) ? formatDomainFunction : formatDomain;
11925
+ var getDomainFromDataFn = lodash_isFunction__WEBPACK_IMPORTED_MODULE_2___default()(getDomainFromDataFunction) ? getDomainFromDataFunction : getDomainFromData;
11926
+ var formatDomainFn = lodash_isFunction__WEBPACK_IMPORTED_MODULE_2___default()(formatDomainFunction) ? formatDomainFunction : formatDomain;
11923
11927
  return function (props, axis) {
11924
11928
  var propsDomain = getDomainFromProps(props, axis);
11925
11929
 
11926
11930
  if (propsDomain) {
11927
- return formatDomainFunction(propsDomain, props, axis);
11931
+ return formatDomainFn(propsDomain, props, axis);
11928
11932
  }
11929
11933
 
11930
11934
  var categories = _data__WEBPACK_IMPORTED_MODULE_10__.getCategories(props, axis);
11931
- var domain = categories ? getDomainFromCategories(props, axis, categories) : getDomainFromDataFunction(props, axis);
11932
- return domain ? formatDomainFunction(domain, props, axis) : undefined;
11935
+ var domain = categories ? getDomainFromCategories(props, axis, categories) : getDomainFromDataFn(props, axis);
11936
+ return domain ? formatDomainFn(domain, props, axis) : undefined;
11933
11937
  };
11934
11938
  }
11935
11939
  /**
@@ -11962,27 +11966,27 @@ function getDomain(props, axis) {
11962
11966
  */
11963
11967
 
11964
11968
  function getDomainFromCategories(props, axis, categories) {
11965
- categories = categories || _data__WEBPACK_IMPORTED_MODULE_10__.getCategories(props, axis);
11969
+ var categoriesArray = categories || _data__WEBPACK_IMPORTED_MODULE_10__.getCategories(props, axis);
11966
11970
  var polar = props.polar,
11967
11971
  _props$startAngle = props.startAngle,
11968
11972
  startAngle = _props$startAngle === void 0 ? 0 : _props$startAngle,
11969
11973
  _props$endAngle = props.endAngle,
11970
11974
  endAngle = _props$endAngle === void 0 ? 360 : _props$endAngle;
11971
11975
 
11972
- if (!categories) {
11976
+ if (!categoriesArray) {
11973
11977
  return undefined;
11974
11978
  }
11975
11979
 
11976
11980
  var minDomain = getMinFromProps(props, axis);
11977
11981
  var maxDomain = getMaxFromProps(props, axis);
11978
- var stringArray = _collection__WEBPACK_IMPORTED_MODULE_8__.containsStrings(categories) ? _data__WEBPACK_IMPORTED_MODULE_10__.getStringsFromCategories(props, axis) : [];
11982
+ var stringArray = _collection__WEBPACK_IMPORTED_MODULE_8__.containsStrings(categoriesArray) ? _data__WEBPACK_IMPORTED_MODULE_10__.getStringsFromCategories(props, axis) : [];
11979
11983
  var stringMap = stringArray.length === 0 ? null : stringArray.reduce(function (memo, string, index) {
11980
11984
  memo[string] = index + 1;
11981
11985
  return memo;
11982
11986
  }, {});
11983
- var categoryValues = stringMap ? categories.map(function (value) {
11987
+ var categoryValues = stringMap ? categoriesArray.map(function (value) {
11984
11988
  return stringMap[value];
11985
- }) : categories;
11989
+ }) : categoriesArray;
11986
11990
  var min = minDomain !== undefined ? minDomain : _collection__WEBPACK_IMPORTED_MODULE_8__.getMinValue(categoryValues);
11987
11991
  var max = maxDomain !== undefined ? maxDomain : _collection__WEBPACK_IMPORTED_MODULE_8__.getMaxValue(categoryValues);
11988
11992
  var categoryDomain = getDomainFromMinMax(min, max);
@@ -11997,7 +12001,7 @@ function getDomainFromCategories(props, axis, categories) {
11997
12001
  */
11998
12002
 
11999
12003
  function getDomainFromData(props, axis, dataset) {
12000
- dataset = dataset || _data__WEBPACK_IMPORTED_MODULE_10__.getData(props);
12004
+ var datasetArray = dataset || _data__WEBPACK_IMPORTED_MODULE_10__.getData(props);
12001
12005
  var polar = props.polar,
12002
12006
  _props$startAngle2 = props.startAngle,
12003
12007
  startAngle = _props$startAngle2 === void 0 ? 0 : _props$startAngle2,
@@ -12006,14 +12010,14 @@ function getDomainFromData(props, axis, dataset) {
12006
12010
  var minDomain = getMinFromProps(props, axis);
12007
12011
  var maxDomain = getMaxFromProps(props, axis);
12008
12012
 
12009
- if (dataset.length < 1) {
12013
+ if (datasetArray.length < 1) {
12010
12014
  return minDomain !== undefined && maxDomain !== undefined ? getDomainFromMinMax(minDomain, maxDomain) : undefined;
12011
12015
  }
12012
12016
 
12013
- var min = minDomain !== undefined ? minDomain : getExtremeFromData(dataset, axis, "min");
12014
- var max = maxDomain !== undefined ? maxDomain : getExtremeFromData(dataset, axis, "max");
12017
+ var min = minDomain !== undefined ? minDomain : getExtremeFromData(datasetArray, axis, "min");
12018
+ var max = maxDomain !== undefined ? maxDomain : getExtremeFromData(datasetArray, axis, "max");
12015
12019
  var domain = getDomainFromMinMax(min, max);
12016
- return polar && axis === "x" && Math.abs(startAngle - endAngle) === 360 ? getSymmetricDomain(domain, getFlatData(dataset, axis)) : domain;
12020
+ return polar && axis === "x" && Math.abs(startAngle - endAngle) === 360 ? getSymmetricDomain(domain, getFlatData(datasetArray, axis)) : domain;
12017
12021
  }
12018
12022
  /**
12019
12023
  * Returns a domain in the form of a two element array given a min and max value.
@@ -12326,14 +12330,14 @@ function getScopedEvents(events, namespace, childType, baseProps) {
12326
12330
  // eslint-disable-next-line no-invalid-this
12327
12331
 
12328
12332
 
12329
- baseProps = baseProps || this.baseProps; // returns the original base props or base state of a given target element
12333
+ var newBaseProps = baseProps || this.baseProps; // returns the original base props or base state of a given target element
12330
12334
 
12331
12335
  var getTargetProps = function (identifier, type) {
12332
12336
  var childName = identifier.childName,
12333
12337
  target = identifier.target,
12334
12338
  key = identifier.key; // eslint-disable-next-line no-invalid-this
12335
12339
 
12336
- var baseType = type === "props" ? baseProps : _this2.state || {};
12340
+ var baseType = type === "props" ? newBaseProps : _this2.state || {};
12337
12341
  var base = childName === undefined || childName === null || !baseType[childName] ? baseType : baseType[childName];
12338
12342
  return key === "parent" ? base.parent : base[key] && base[key][target];
12339
12343
  }; // Returns the state object with the mutation caused by a given eventReturn
@@ -12421,8 +12425,7 @@ function getScopedEvents(events, namespace, childType, baseProps) {
12421
12425
 
12422
12426
  var parseEventReturn = function (eventReturn, eventKey) {
12423
12427
  return Array.isArray(eventReturn) ? eventReturn.reduce(function (memo, props) {
12424
- memo = lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()({}, memo, parseEvent(props, eventKey));
12425
- return memo;
12428
+ return lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()({}, memo, parseEvent(props, eventKey));
12426
12429
  }, {}) : parseEvent(eventReturn, eventKey);
12427
12430
  };
12428
12431
 
@@ -12508,9 +12511,10 @@ function getEventState(eventKey, namespace, childType) {
12508
12511
  */
12509
12512
  // eslint-disable-next-line max-params
12510
12513
 
12511
- function getExternalMutationsWithChildren(mutations, baseProps, baseState, childNames) {
12512
- baseProps = baseProps || {};
12513
- baseState = baseState || {};
12514
+ function getExternalMutationsWithChildren(mutations) {
12515
+ var baseProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12516
+ var baseState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
12517
+ var childNames = arguments.length > 3 ? arguments[3] : undefined;
12514
12518
  return childNames.reduce(function (memo, childName) {
12515
12519
  var childState = baseState[childName];
12516
12520
  var mutation = getExternalMutations(mutations, baseProps[childName], baseState[childName], childName);
@@ -12532,9 +12536,10 @@ function getExternalMutationsWithChildren(mutations, baseProps, baseState, child
12532
12536
  */
12533
12537
  // eslint-disable-next-line max-params
12534
12538
 
12535
- function getExternalMutations(mutations, baseProps, baseState, childName) {
12536
- baseProps = baseProps || {};
12537
- baseState = baseState || {};
12539
+ function getExternalMutations(mutations) {
12540
+ var baseProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12541
+ var baseState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
12542
+ var childName = arguments.length > 3 ? arguments[3] : undefined;
12538
12543
 
12539
12544
  var eventKeys = lodash_keys__WEBPACK_IMPORTED_MODULE_0___default()(baseProps);
12540
12545
 
@@ -12600,8 +12605,7 @@ function getExternalMutation(mutations, baseProps, baseState, identifier) {
12600
12605
  return false;
12601
12606
  };
12602
12607
 
12603
- mutations = Array.isArray(mutations) ? mutations : [mutations];
12604
- var scopedMutations = mutations;
12608
+ var scopedMutations = Array.isArray(mutations) ? mutations : [mutations];
12605
12609
 
12606
12610
  if (identifier.childName) {
12607
12611
  scopedMutations = mutations.filter(function (m) {
@@ -12640,13 +12644,10 @@ function getExternalMutation(mutations, baseProps, baseState, identifier) {
12640
12644
 
12641
12645
  function getComponentEvents(props, components) {
12642
12646
  var events = Array.isArray(components) && components.reduce(function (memo, componentName) {
12643
- var _memo;
12644
-
12645
12647
  var component = props[componentName];
12646
12648
  var defaultEvents = component && component.type && component.type.defaultEvents;
12647
12649
  var componentEvents = lodash_isFunction__WEBPACK_IMPORTED_MODULE_6___default()(defaultEvents) ? defaultEvents(component.props) : defaultEvents;
12648
- memo = Array.isArray(componentEvents) ? (_memo = memo).concat.apply(_memo, _toConsumableArray(componentEvents)) : memo;
12649
- return memo;
12650
+ return Array.isArray(componentEvents) ? memo.concat.apply(memo, _toConsumableArray(componentEvents)) : memo;
12650
12651
  }, []);
12651
12652
  return events && events.length ? events : undefined;
12652
12653
  }
@@ -13004,6 +13005,7 @@ function reduceChildren(children, iteratee) {
13004
13005
 
13005
13006
  var traverseChildren = function (childArray, names, parent) {
13006
13007
  return childArray.reduce(function (memo, child, index) {
13008
+ var newMemo = memo;
13007
13009
  var childRole = child.type && child.type.role;
13008
13010
  var childName = child.props.name || "".concat(childRole, "-").concat(names[index]);
13009
13011
 
@@ -13021,16 +13023,16 @@ function reduceChildren(children, iteratee) {
13021
13023
  });
13022
13024
 
13023
13025
  var nestedResults = traverseChildren(nestedChildren, _childNames, child);
13024
- memo = combine(memo, nestedResults);
13026
+ newMemo = combine(newMemo, nestedResults);
13025
13027
  } else {
13026
13028
  var result = iteratee(child, childName, parent);
13027
13029
 
13028
13030
  if (result) {
13029
- memo = combine(memo, result);
13031
+ newMemo = combine(newMemo, result);
13030
13032
  }
13031
13033
  }
13032
13034
 
13033
- return memo;
13035
+ return newMemo;
13034
13036
  }, initialMemo);
13035
13037
  };
13036
13038
 
@@ -13056,8 +13058,7 @@ function isHorizontal(props) {
13056
13058
  var childProps = child.props || {};
13057
13059
 
13058
13060
  if (memo || childProps.horizontal || !childProps.children) {
13059
- memo = memo || childProps.horizontal;
13060
- return memo;
13061
+ return memo || childProps.horizontal;
13061
13062
  }
13062
13063
 
13063
13064
  return traverseChildren(react__WEBPACK_IMPORTED_MODULE_6___default().Children.toArray(childProps.children));
@@ -13110,11 +13111,13 @@ function isMap(x) {
13110
13111
  }
13111
13112
  function shallowToJS(x, whitelist) {
13112
13113
  return isIterable(x) ? x.reduce(function (result, curr, key) {
13114
+ var newCurr = curr;
13115
+
13113
13116
  if (whitelist && whitelist[key]) {
13114
- curr = shallowToJS(curr);
13117
+ newCurr = shallowToJS(curr);
13115
13118
  }
13116
13119
 
13117
- result[key] = curr;
13120
+ result[key] = newCurr;
13118
13121
  return result;
13119
13122
  }, isList(x) ? [] : {}) : x;
13120
13123
  }
@@ -13142,12 +13145,10 @@ __webpack_require__.r(__webpack_exports__);
13142
13145
  /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
13143
13146
 
13144
13147
 
13145
- /* eslint-disable no-use-before-define */
13146
-
13147
13148
 
13148
13149
  // Private Functions
13149
- function getVerticalAnchor(props, datum) {
13150
- datum = datum || {};
13150
+ function getVerticalAnchor(props) {
13151
+ var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
13151
13152
  var sign = datum._y >= 0 ? 1 : -1;
13152
13153
  var labelStyle = props.style && props.style.labels || {};
13153
13154
 
@@ -13160,8 +13161,8 @@ function getVerticalAnchor(props, datum) {
13160
13161
  return "middle";
13161
13162
  }
13162
13163
 
13163
- function getTextAnchor(props, datum) {
13164
- datum = datum || {};
13164
+ function getTextAnchor(props) {
13165
+ var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
13165
13166
  var style = props.style,
13166
13167
  horizontal = props.horizontal;
13167
13168
  var sign = datum._y >= 0 ? 1 : -1;
@@ -13176,14 +13177,14 @@ function getTextAnchor(props, datum) {
13176
13177
  return sign >= 0 ? "start" : "end";
13177
13178
  }
13178
13179
 
13179
- function getAngle(props, datum) {
13180
- datum = datum || {};
13180
+ function getAngle(props) {
13181
+ var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
13181
13182
  var labelStyle = props.style && props.style.labels || {};
13182
13183
  return datum.angle === undefined ? labelStyle.angle : datum.angle;
13183
13184
  }
13184
13185
 
13185
- function getPadding(props, datum) {
13186
- datum = datum || {};
13186
+ function getPadding(props) {
13187
+ var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
13187
13188
  var horizontal = props.horizontal,
13188
13189
  style = props.style;
13189
13190
  var labelStyle = style.labels || {};
@@ -13262,8 +13263,9 @@ function getPolarOrientation(degrees) {
13262
13263
  } // Exported Functions
13263
13264
 
13264
13265
 
13265
- function getText(props, datum, index) {
13266
- datum = datum || {};
13266
+ function getText(props) {
13267
+ var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
13268
+ var index = arguments.length > 2 ? arguments[2] : undefined;
13267
13269
 
13268
13270
  if (datum.label !== undefined) {
13269
13271
  return datum.label;
@@ -14423,11 +14425,10 @@ var Timer = /*#__PURE__*/function () {
14423
14425
  }, {
14424
14426
  key: "subscribe",
14425
14427
  value: function subscribe(callback, duration) {
14426
- duration = this.shouldAnimate ? duration : 0;
14427
14428
  var subscriptionID = this.subscribers.push({
14428
14429
  startTime: (0,victory_vendor_d3_timer__WEBPACK_IMPORTED_MODULE_0__.now)(),
14429
14430
  callback: callback,
14430
- duration: duration
14431
+ duration: this.shouldAnimate ? duration : 0
14431
14432
  });
14432
14433
  this.activeSubscriptions++;
14433
14434
  this.start();
@@ -14614,36 +14615,38 @@ function getInitialChildProps(animate, data) {
14614
14615
 
14615
14616
 
14616
14617
  function getChildBeforeLoad(animate, child, data, cb) {
14617
- animate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
14618
+ var newAnimate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
14618
14619
  onEnd: cb
14619
14620
  });
14620
14621
 
14621
- if (animate && animate.onLoad && !animate.onLoad.duration) {
14622
+ if (newAnimate && newAnimate.onLoad && !newAnimate.onLoad.duration) {
14622
14623
  return {
14623
- animate: animate,
14624
+ animate: newAnimate,
14624
14625
  data: data
14625
14626
  };
14626
14627
  }
14627
14628
 
14628
- 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.
14629
+ 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.
14629
14630
 
14630
- data = data.map(function (datum, idx) {
14631
+ var newData = data.map(function (datum, idx) {
14631
14632
  return lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, before(datum, idx, data));
14632
14633
  });
14633
14634
  return {
14634
- animate: animate,
14635
- data: data,
14635
+ animate: newAnimate,
14636
+ data: newData,
14636
14637
  clipWidth: 0
14637
14638
  };
14638
14639
  } // eslint-disable-next-line max-params
14639
14640
 
14640
14641
 
14641
14642
  function getChildOnLoad(animate, data, cb) {
14642
- animate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
14643
+ var newAnimate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
14643
14644
  onEnd: cb
14644
14645
  });
14645
14646
 
14646
- if (animate && animate.onLoad && !animate.onLoad.duration) {
14647
+ var newData = data;
14648
+
14649
+ if (newAnimate && newAnimate.onLoad && !newAnimate.onLoad.duration) {
14647
14650
  return {
14648
14651
  animate: animate,
14649
14652
  data: data
@@ -14652,12 +14655,12 @@ function getChildOnLoad(animate, data, cb) {
14652
14655
 
14653
14656
  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.
14654
14657
 
14655
- data = data.map(function (datum, idx) {
14658
+ newData = data.map(function (datum, idx) {
14656
14659
  return lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, after(datum, idx, data));
14657
14660
  });
14658
14661
  return {
14659
- animate: animate,
14660
- data: data
14662
+ animate: newAnimate,
14663
+ data: newData
14661
14664
  };
14662
14665
  } // eslint-disable-next-line max-params, max-len
14663
14666
 
@@ -14666,7 +14669,10 @@ function getChildPropsOnExit(animate, child, data, exitingNodes, cb) {
14666
14669
  // Whether or not _this_ child has exiting nodes, we want the exit-
14667
14670
  // transition for all children to have the same duration, delay, etc.
14668
14671
  var onExit = animate && animate.onExit;
14669
- animate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, onExit);
14672
+
14673
+ var newAnimate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, onExit);
14674
+
14675
+ var newData = data;
14670
14676
 
14671
14677
  if (exitingNodes) {
14672
14678
  // After the exit transition occurs, trigger the animations for
@@ -14674,39 +14680,42 @@ function getChildPropsOnExit(animate, child, data, exitingNodes, cb) {
14674
14680
  animate.onEnd = cb;
14675
14681
  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.
14676
14682
 
14677
- data = data.map(function (datum, idx) {
14683
+ newData = data.map(function (datum, idx) {
14678
14684
  var key = (datum.key || idx).toString();
14679
14685
  return exitingNodes[key] ? lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, before(datum, idx, data)) : datum;
14680
14686
  });
14681
14687
  }
14682
14688
 
14683
14689
  return {
14684
- animate: animate,
14685
- data: data
14690
+ animate: newAnimate,
14691
+ data: newData
14686
14692
  };
14687
14693
  } // eslint-disable-next-line max-params,max-len
14688
14694
 
14689
14695
 
14690
14696
  function getChildPropsBeforeEnter(animate, child, data, enteringNodes, cb) {
14697
+ var newAnimate = animate;
14698
+ var newData = data;
14699
+
14691
14700
  if (enteringNodes) {
14692
14701
  // Perform a normal animation here, except - when it finishes - trigger
14693
14702
  // the transition for entering nodes.
14694
- animate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
14703
+ newAnimate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
14695
14704
  onEnd: cb
14696
14705
  });
14697
14706
  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
14698
14707
  // domain. However, we may not want these nodes to be displayed initially,
14699
14708
  // so perform the `onEnter.before` transformation on each node.
14700
14709
 
14701
- data = data.map(function (datum, idx) {
14710
+ newData = data.map(function (datum, idx) {
14702
14711
  var key = (datum.key || idx).toString();
14703
14712
  return enteringNodes[key] ? lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, before(datum, idx, data)) : datum;
14704
14713
  });
14705
14714
  }
14706
14715
 
14707
14716
  return {
14708
- animate: animate,
14709
- data: data
14717
+ animate: newAnimate,
14718
+ data: newData
14710
14719
  };
14711
14720
  } // eslint-disable-next-line max-params, max-len
14712
14721
 
@@ -14715,23 +14724,26 @@ function getChildPropsOnEnter(animate, data, enteringNodes, cb) {
14715
14724
  // Whether or not _this_ child has entering nodes, we want the entering-
14716
14725
  // transition for all children to have the same duration, delay, etc.
14717
14726
  var onEnter = animate && animate.onEnter;
14718
- animate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, onEnter);
14727
+
14728
+ var newAnimate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, onEnter);
14729
+
14730
+ var newData = data;
14719
14731
 
14720
14732
  if (enteringNodes) {
14721
14733
  // Old nodes have been transitioned to their new values, and the
14722
14734
  // domain should encompass the nodes that will now enter. So perform
14723
14735
  // the `onEnter.after` transformation on each node.
14724
- animate.onEnd = cb;
14725
- var after = animate.onEnter && animate.onEnter.after ? animate.onEnter.after : (lodash_identity__WEBPACK_IMPORTED_MODULE_1___default());
14726
- data = data.map(function (datum, idx) {
14736
+ newAnimate.onEnd = cb;
14737
+ var after = newAnimate.onEnter && newAnimate.onEnter.after ? newAnimate.onEnter.after : (lodash_identity__WEBPACK_IMPORTED_MODULE_1___default());
14738
+ newData = data.map(function (datum, idx) {
14727
14739
  var key = getDatumKey(datum, idx);
14728
14740
  return enteringNodes[key] ? lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, after(datum, idx, data)) : datum;
14729
14741
  });
14730
14742
  }
14731
14743
 
14732
14744
  return {
14733
- animate: animate,
14734
- data: data
14745
+ animate: newAnimate,
14746
+ data: newData
14735
14747
  };
14736
14748
  }
14737
14749
  /**
@@ -14897,6 +14909,7 @@ function getTransitionPropsFactory(props, state, setState) {
14897
14909
  "use strict";
14898
14910
  __webpack_require__.r(__webpack_exports__);
14899
14911
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
14912
+ /* harmony export */ "assert": () => (/* binding */ assert),
14900
14913
  /* harmony export */ "getSafeUserProps": () => (/* binding */ getSafeUserProps),
14901
14914
  /* harmony export */ "withSafeUserProps": () => (/* binding */ withSafeUserProps)
14902
14915
  /* harmony export */ });
@@ -14977,6 +14990,18 @@ var testIfSafeProp = function (key) {
14977
14990
  if (doesPropStartWith(key) || isExactMatch(key)) return true;
14978
14991
  return false;
14979
14992
  };
14993
+ /**
14994
+ * Asserts that value is not null or undefined, throwing an error if it is.
14995
+ * @param value The value to assert
14996
+ * @param message The error message to throw
14997
+ */
14998
+
14999
+
15000
+ function assert(value, message) {
15001
+ if (value === undefined || value === null) {
15002
+ throw new Error(message);
15003
+ }
15004
+ }
14980
15005
  /**
14981
15006
  * getSafeUserProps - function that takes in a props object and removes any
14982
15007
  * key-value entries that do not match filter strings in the USER_PROPS_SAFELIST
@@ -14986,7 +15011,6 @@ var testIfSafeProp = function (key) {
14986
15011
  * @returns {Object}: object containing remaining acceptable props
14987
15012
  */
14988
15013
 
14989
-
14990
15014
  var getSafeUserProps = function (props) {
14991
15015
  var propsToFilter = _objectSpread({}, props);
14992
15016