victory-errorbar 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.
@@ -143,14 +143,12 @@ var defaultProps = {
143
143
  role: "presentation",
144
144
  shapeRendering: "auto"
145
145
  };
146
- var ErrorBar = function (props) {
147
- props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), props));
148
- var _props = props,
149
- groupComponent = _props.groupComponent;
146
+ var ErrorBar = function (initialProps) {
147
+ var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps));
148
+ var groupComponent = props.groupComponent;
150
149
  var userProps = victory_core__WEBPACK_IMPORTED_MODULE_4__.getSafeUserProps(props);
151
- var _props2 = props,
152
- tabIndex = _props2.tabIndex,
153
- ariaLabel = _props2.ariaLabel;
150
+ var tabIndex = props.tabIndex,
151
+ ariaLabel = props.ariaLabel;
154
152
  var error = calculateError(props);
155
153
  var children = [error.right ? renderBorder(props, error, "right") : null, error.left ? renderBorder(props, error, "left") : null, error.bottom ? renderBorder(props, error, "bottom") : null, error.top ? renderBorder(props, error, "top") : null, error.right ? renderCross(props, error, "right") : null, error.left ? renderCross(props, error, "left") : null, error.bottom ? renderCross(props, error, "bottom") : null, error.top ? renderCross(props, error, "top") : null].filter(Boolean);
156
154
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(groupComponent, _objectSpread({
@@ -354,29 +352,30 @@ var getLabelProps = function (dataProps, text, style) {
354
352
  return lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, labelProps, victory_core__WEBPACK_IMPORTED_MODULE_6__.omit(tooltipTheme, ["style"]));
355
353
  };
356
354
 
357
- var getBaseProps = function (props, fallbackProps) {
358
- var modifiedProps = victory_core__WEBPACK_IMPORTED_MODULE_6__.modifyProps(props, fallbackProps, "errorbar");
359
- props = lodash_assign__WEBPACK_IMPORTED_MODULE_1___default()({}, modifiedProps, getCalculatedValues(modifiedProps));
360
- var _props = props,
361
- borderWidth = _props.borderWidth,
362
- data = _props.data,
363
- domain = _props.domain,
364
- events = _props.events,
365
- groupComponent = _props.groupComponent,
366
- height = _props.height,
367
- horizontal = _props.horizontal,
368
- labels = _props.labels,
369
- name = _props.name,
370
- origin = _props.origin,
371
- padding = _props.padding,
372
- polar = _props.polar,
373
- scale = _props.scale,
374
- sharedEvents = _props.sharedEvents,
375
- standalone = _props.standalone,
376
- style = _props.style,
377
- theme = _props.theme,
378
- width = _props.width,
379
- disableInlineStyles = _props.disableInlineStyles;
355
+ var getBaseProps = function (initialProps, fallbackProps) {
356
+ var modifiedProps = victory_core__WEBPACK_IMPORTED_MODULE_6__.modifyProps(initialProps, fallbackProps, "errorbar");
357
+
358
+ var props = lodash_assign__WEBPACK_IMPORTED_MODULE_1___default()({}, modifiedProps, getCalculatedValues(modifiedProps));
359
+
360
+ var borderWidth = props.borderWidth,
361
+ data = props.data,
362
+ domain = props.domain,
363
+ events = props.events,
364
+ groupComponent = props.groupComponent,
365
+ height = props.height,
366
+ horizontal = props.horizontal,
367
+ labels = props.labels,
368
+ name = props.name,
369
+ origin = props.origin,
370
+ padding = props.padding,
371
+ polar = props.polar,
372
+ scale = props.scale,
373
+ sharedEvents = props.sharedEvents,
374
+ standalone = props.standalone,
375
+ style = props.style,
376
+ theme = props.theme,
377
+ width = props.width,
378
+ disableInlineStyles = props.disableInlineStyles;
380
379
  var initialChildProps = {
381
380
  parent: {
382
381
  data: data,
@@ -403,13 +402,13 @@ var getBaseProps = function (props, fallbackProps) {
403
402
  x = _Helpers$scalePoint.x,
404
403
  y = _Helpers$scalePoint.y;
405
404
 
406
- datum = formatDataFromDomain(datum, domain);
407
- var errorX = getErrors(props, datum, "x");
408
- var errorY = getErrors(props, datum, "y");
405
+ var formattedDatum = formatDataFromDomain(datum, domain);
406
+ var errorX = getErrors(props, formattedDatum, "x");
407
+ var errorY = getErrors(props, formattedDatum, "y");
409
408
  var dataProps = {
410
409
  borderWidth: borderWidth,
411
410
  data: data,
412
- datum: datum,
411
+ datum: formattedDatum,
413
412
  errorX: horizontal ? errorY : errorX,
414
413
  errorY: horizontal ? errorX : errorY,
415
414
  groupComponent: groupComponent,
@@ -7345,12 +7344,12 @@ var interpolateFunction = function (a, b) {
7345
7344
  * differs in that it uses our custom interpolators when interpolating the value of each property in
7346
7345
  * an object. This allows the correct interpolation of nested objects, including styles
7347
7346
  *
7348
- * @param {any} a - Start value.
7349
- * @param {any} b - End value.
7347
+ * @param {any} startValue - Start value.
7348
+ * @param {any} endValue - End value.
7350
7349
  * @returns {Function} An interpolation function.
7351
7350
  */
7352
7351
 
7353
- var interpolateObject = function (a, b) {
7352
+ var interpolateObject = function (startValue, endValue) {
7354
7353
  var interpolateTypes = function (x, y) {
7355
7354
  if (x === y || !isInterpolatable(x) || !isInterpolatable(y)) {
7356
7355
  return interpolateImmediate(x, y);
@@ -7375,6 +7374,8 @@ var interpolateObject = function (a, b) {
7375
7374
 
7376
7375
  var i = {};
7377
7376
  var c = {};
7377
+ var a = startValue;
7378
+ var b = endValue;
7378
7379
  var k;
7379
7380
 
7380
7381
  if (a === null || typeof a !== "object") {
@@ -7542,8 +7543,8 @@ var VictoryAnimation = /*#__PURE__*/function (_React$Component) {
7542
7543
  step can generate imprecise values, sometimes greater than 1
7543
7544
  if this happens set the state to 1 and return, cancelling the timer
7544
7545
  */
7545
- duration = duration !== undefined ? duration : _this.props.duration;
7546
- var step = duration ? elapsed / duration : 1;
7546
+ var animationDuration = duration !== undefined ? duration : _this.props.duration;
7547
+ var step = animationDuration ? elapsed / animationDuration : 1;
7547
7548
 
7548
7549
  if (step >= 1) {
7549
7550
  _this.setState({
@@ -8159,8 +8160,7 @@ var getStyles = function (style, props) {
8159
8160
  }
8160
8161
 
8161
8162
  var getSingleStyle = function (s) {
8162
- s = s ? lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, s, defaultStyles) : defaultStyles;
8163
- var baseStyles = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.evaluateStyle(s, props);
8163
+ var baseStyles = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.evaluateStyle(s ? lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, s, defaultStyles) : defaultStyles, props);
8164
8164
  return lodash_assign__WEBPACK_IMPORTED_MODULE_2___default()({}, baseStyles, {
8165
8165
  fontSize: getFontSize(baseStyles)
8166
8166
  });
@@ -8364,22 +8364,19 @@ var getInlineXOffset = function (calculatedProps, textElements, index) {
8364
8364
  switch (textAnchor) {
8365
8365
  case "start":
8366
8366
  return widths.reduce(function (memo, width, i) {
8367
- memo = i < index ? memo + width : memo;
8368
- return memo;
8367
+ return i < index ? memo + width : memo;
8369
8368
  }, 0);
8370
8369
 
8371
8370
  case "end":
8372
8371
  return widths.reduce(function (memo, width, i) {
8373
- memo = i > index ? memo - width : memo;
8374
- return memo;
8372
+ return i > index ? memo - width : memo;
8375
8373
  }, 0);
8376
8374
 
8377
8375
  default:
8378
8376
  // middle
8379
8377
  return widths.reduce(function (memo, width, i) {
8380
8378
  var offsetWidth = i < index ? width : 0;
8381
- memo = i === index ? memo + width / 2 : memo + offsetWidth;
8382
- return memo;
8379
+ return i === index ? memo + width / 2 : memo + offsetWidth;
8383
8380
  }, centerOffset);
8384
8381
  }
8385
8382
  };
@@ -8511,7 +8508,7 @@ var getCalculatedProps = function (props) {
8511
8508
  verticalAnchor: verticalAnchor,
8512
8509
  dx: dx,
8513
8510
  dy: dy,
8514
- originalDy: props.dy,
8511
+ originalDy: _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.evaluateProp(props.dy, props),
8515
8512
  transform: transform,
8516
8513
  x: x,
8517
8514
  y: y
@@ -8581,8 +8578,8 @@ var defaultProps = {
8581
8578
  // Magic number from d3.
8582
8579
  lineHeight: 1
8583
8580
  };
8584
- var VictoryLabel = function (props) {
8585
- props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), props));
8581
+ var VictoryLabel = function (initialProps) {
8582
+ var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps));
8586
8583
 
8587
8584
  if (props.text === null || props.text === undefined) {
8588
8585
  return null;
@@ -8603,7 +8600,7 @@ var VictoryLabel = function (props) {
8603
8600
  fontSize: currentStyle.fontSize || defaultStyles.fontSize,
8604
8601
  capHeight: capHeightPx,
8605
8602
  text: line,
8606
- // @ts-expect-error TODO: This looks like a bug:
8603
+ // TODO: This looks like a bug:
8607
8604
  textSize: _victory_util_textsize__WEBPACK_IMPORTED_MODULE_12__.approximateTextSize(line, currentStyle),
8608
8605
  lineHeight: currentLineHeight,
8609
8606
  backgroundPadding: getSingleValue(backgroundPadding, i)
@@ -10296,8 +10293,7 @@ function addEvents(WrappedComponent) {
10296
10293
  value: function applyExternalMutations(props, externalMutations) {
10297
10294
  if (!lodash_isEmpty__WEBPACK_IMPORTED_MODULE_5___default()(externalMutations)) {
10298
10295
  var callbacks = props.externalEventMutations.reduce(function (memo, mutation) {
10299
- memo = lodash_isFunction__WEBPACK_IMPORTED_MODULE_4___default()(mutation.callback) ? memo.concat(mutation.callback) : memo;
10300
- return memo;
10296
+ return lodash_isFunction__WEBPACK_IMPORTED_MODULE_4___default()(mutation.callback) ? memo.concat(mutation.callback) : memo;
10301
10297
  }, []);
10302
10298
  var compiledCallbacks = callbacks.length ? function () {
10303
10299
  callbacks.forEach(function (c) {
@@ -10352,8 +10348,8 @@ function addEvents(WrappedComponent) {
10352
10348
  }, {
10353
10349
  key: "getBaseProps",
10354
10350
  value: function getBaseProps(props, getSharedEventState) {
10355
- getSharedEventState = getSharedEventState || this.getSharedEventState.bind(this);
10356
- var sharedParentState = getSharedEventState("parent", "parent");
10351
+ var getSharedEventStateFunction = getSharedEventState || this.getSharedEventState.bind(this);
10352
+ var sharedParentState = getSharedEventStateFunction("parent", "parent");
10357
10353
  var parentState = this.getEventState("parent", "parent");
10358
10354
 
10359
10355
  var baseParentProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_7___default()({}, parentState, sharedParentState);
@@ -10388,13 +10384,15 @@ function addEvents(WrappedComponent) {
10388
10384
  return undefined;
10389
10385
  }
10390
10386
 
10387
+ var currentProps = component && typeof component === "object" && "props" in component ? component.props : undefined;
10388
+
10391
10389
  if (this.hasEvents) {
10392
10390
  var baseEvents = this.getEvents(this.props, type, key);
10393
10391
 
10394
10392
  var componentProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_7___default()({
10395
10393
  index: index,
10396
10394
  key: id
10397
- }, this.getEventState(key, type), this.getSharedEventState(key, type), component.props, baseProps, {
10395
+ }, this.getEventState(key, type), this.getSharedEventState(key, type), currentProps, baseProps, {
10398
10396
  id: id
10399
10397
  });
10400
10398
 
@@ -10408,7 +10406,7 @@ function addEvents(WrappedComponent) {
10408
10406
  return lodash_defaults__WEBPACK_IMPORTED_MODULE_7___default()({
10409
10407
  index: index,
10410
10408
  key: id
10411
- }, component.props, baseProps, {
10409
+ }, currentProps, baseProps, {
10412
10410
  id: id
10413
10411
  });
10414
10412
  }
@@ -10450,13 +10448,15 @@ function addEvents(WrappedComponent) {
10450
10448
  var dataKeys = lodash_without__WEBPACK_IMPORTED_MODULE_0___default()(this.dataKeys, "all");
10451
10449
 
10452
10450
  var labelComponents = dataKeys.reduce(function (memo, key) {
10451
+ var newMemo = memo;
10452
+
10453
10453
  var labelProps = _this8.getComponentProps(labelComponent, "labels", key);
10454
10454
 
10455
10455
  if (labelProps && labelProps.text !== undefined && labelProps.text !== null) {
10456
- memo = memo.concat( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default().cloneElement(labelComponent, labelProps));
10456
+ newMemo = newMemo.concat( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default().cloneElement(labelComponent, labelProps));
10457
10457
  }
10458
10458
 
10459
- return memo;
10459
+ return newMemo;
10460
10460
  }, []);
10461
10461
  var dataProps = this.getComponentProps(dataComponent, "data", "all");
10462
10462
  var children = [/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default().cloneElement(dataComponent, dataProps)].concat(_toConsumableArray(labelComponents));
@@ -10855,12 +10855,14 @@ function sortData(dataset, sortKey) {
10855
10855
  } // Ensures previous VictoryLine api for sortKey prop stays consistent
10856
10856
 
10857
10857
 
10858
+ var formattedSortKey = sortKey;
10859
+
10858
10860
  if (sortKey === "x" || sortKey === "y") {
10859
- sortKey = "_".concat(sortKey);
10861
+ formattedSortKey = "_".concat(sortKey);
10860
10862
  }
10861
10863
 
10862
10864
  var order = sortOrder === "ascending" ? "asc" : "desc";
10863
- return lodash_orderBy__WEBPACK_IMPORTED_MODULE_5___default()(dataset, sortKey, order);
10865
+ return lodash_orderBy__WEBPACK_IMPORTED_MODULE_5___default()(dataset, formattedSortKey, order);
10864
10866
  } // This method will remove data points that break certain scales. (log scale only)
10865
10867
 
10866
10868
 
@@ -11051,7 +11053,10 @@ function formatData(dataset, props, expectedKeys) {
11051
11053
  return [];
11052
11054
  }
11053
11055
 
11054
- var defaultKeys = ["x", "y", "y0"];
11056
+ var defaultKeys = ["x", "y", "y0"]; // TODO: We shouldn’t mutate the expectedKeys param here,
11057
+ // but we need to figure out why changing it causes regressions in tests.
11058
+ // eslint-disable-next-line no-param-reassign
11059
+
11055
11060
  expectedKeys = Array.isArray(expectedKeys) ? expectedKeys : defaultKeys;
11056
11061
 
11057
11062
  var createAccessor = function (name) {
@@ -11076,13 +11081,13 @@ function formatData(dataset, props, expectedKeys) {
11076
11081
 
11077
11082
  var data = preformattedData ? dataset : dataset.reduce(function (dataArr, datum, index) {
11078
11083
  // eslint-disable-line complexity
11079
- datum = parseDatum(datum);
11084
+ var parsedDatum = parseDatum(datum);
11080
11085
  var fallbackValues = {
11081
11086
  x: index,
11082
- y: datum
11087
+ y: parsedDatum
11083
11088
  };
11084
11089
  var processedValues = expectedKeys.reduce(function (memo, type) {
11085
- var processedValue = accessor[type](datum);
11090
+ var processedValue = accessor[type](parsedDatum);
11086
11091
  var value = processedValue !== undefined ? processedValue : fallbackValues[type];
11087
11092
 
11088
11093
  if (value !== undefined) {
@@ -11097,7 +11102,7 @@ function formatData(dataset, props, expectedKeys) {
11097
11102
  return memo;
11098
11103
  }, {});
11099
11104
 
11100
- var formattedDatum = lodash_assign__WEBPACK_IMPORTED_MODULE_12___default()({}, processedValues, datum);
11105
+ var formattedDatum = lodash_assign__WEBPACK_IMPORTED_MODULE_12___default()({}, processedValues, parsedDatum);
11101
11106
 
11102
11107
  if (!lodash_isEmpty__WEBPACK_IMPORTED_MODULE_4___default()(formattedDatum)) {
11103
11108
  dataArr.push(formattedDatum);
@@ -11208,8 +11213,8 @@ function getStringsFromData(props, axis) {
11208
11213
  }, []);
11209
11214
  var sortedData = sortData(data, props.sortKey, props.sortOrder);
11210
11215
  var dataStrings = sortedData.reduce(function (dataArr, datum) {
11211
- datum = parseDatum(datum);
11212
- dataArr.push(accessor(datum));
11216
+ var parsedDatum = parseDatum(datum);
11217
+ dataArr.push(accessor(parsedDatum));
11213
11218
  return dataArr;
11214
11219
  }, []).filter(function (datum) {
11215
11220
  return typeof datum === "string";
@@ -11575,18 +11580,18 @@ function padDomain(domain, props, axis) {
11575
11580
 
11576
11581
 
11577
11582
  function createDomainFunction(getDomainFromDataFunction, formatDomainFunction) {
11578
- getDomainFromDataFunction = lodash_isFunction__WEBPACK_IMPORTED_MODULE_2___default()(getDomainFromDataFunction) ? getDomainFromDataFunction : getDomainFromData;
11579
- formatDomainFunction = lodash_isFunction__WEBPACK_IMPORTED_MODULE_2___default()(formatDomainFunction) ? formatDomainFunction : formatDomain;
11583
+ var getDomainFromDataFn = lodash_isFunction__WEBPACK_IMPORTED_MODULE_2___default()(getDomainFromDataFunction) ? getDomainFromDataFunction : getDomainFromData;
11584
+ var formatDomainFn = lodash_isFunction__WEBPACK_IMPORTED_MODULE_2___default()(formatDomainFunction) ? formatDomainFunction : formatDomain;
11580
11585
  return function (props, axis) {
11581
11586
  var propsDomain = getDomainFromProps(props, axis);
11582
11587
 
11583
11588
  if (propsDomain) {
11584
- return formatDomainFunction(propsDomain, props, axis);
11589
+ return formatDomainFn(propsDomain, props, axis);
11585
11590
  }
11586
11591
 
11587
11592
  var categories = _data__WEBPACK_IMPORTED_MODULE_10__.getCategories(props, axis);
11588
- var domain = categories ? getDomainFromCategories(props, axis, categories) : getDomainFromDataFunction(props, axis);
11589
- return domain ? formatDomainFunction(domain, props, axis) : undefined;
11593
+ var domain = categories ? getDomainFromCategories(props, axis, categories) : getDomainFromDataFn(props, axis);
11594
+ return domain ? formatDomainFn(domain, props, axis) : undefined;
11590
11595
  };
11591
11596
  }
11592
11597
  /**
@@ -11619,27 +11624,27 @@ function getDomain(props, axis) {
11619
11624
  */
11620
11625
 
11621
11626
  function getDomainFromCategories(props, axis, categories) {
11622
- categories = categories || _data__WEBPACK_IMPORTED_MODULE_10__.getCategories(props, axis);
11627
+ var categoriesArray = categories || _data__WEBPACK_IMPORTED_MODULE_10__.getCategories(props, axis);
11623
11628
  var polar = props.polar,
11624
11629
  _props$startAngle = props.startAngle,
11625
11630
  startAngle = _props$startAngle === void 0 ? 0 : _props$startAngle,
11626
11631
  _props$endAngle = props.endAngle,
11627
11632
  endAngle = _props$endAngle === void 0 ? 360 : _props$endAngle;
11628
11633
 
11629
- if (!categories) {
11634
+ if (!categoriesArray) {
11630
11635
  return undefined;
11631
11636
  }
11632
11637
 
11633
11638
  var minDomain = getMinFromProps(props, axis);
11634
11639
  var maxDomain = getMaxFromProps(props, axis);
11635
- var stringArray = _collection__WEBPACK_IMPORTED_MODULE_8__.containsStrings(categories) ? _data__WEBPACK_IMPORTED_MODULE_10__.getStringsFromCategories(props, axis) : [];
11640
+ var stringArray = _collection__WEBPACK_IMPORTED_MODULE_8__.containsStrings(categoriesArray) ? _data__WEBPACK_IMPORTED_MODULE_10__.getStringsFromCategories(props, axis) : [];
11636
11641
  var stringMap = stringArray.length === 0 ? null : stringArray.reduce(function (memo, string, index) {
11637
11642
  memo[string] = index + 1;
11638
11643
  return memo;
11639
11644
  }, {});
11640
- var categoryValues = stringMap ? categories.map(function (value) {
11645
+ var categoryValues = stringMap ? categoriesArray.map(function (value) {
11641
11646
  return stringMap[value];
11642
- }) : categories;
11647
+ }) : categoriesArray;
11643
11648
  var min = minDomain !== undefined ? minDomain : _collection__WEBPACK_IMPORTED_MODULE_8__.getMinValue(categoryValues);
11644
11649
  var max = maxDomain !== undefined ? maxDomain : _collection__WEBPACK_IMPORTED_MODULE_8__.getMaxValue(categoryValues);
11645
11650
  var categoryDomain = getDomainFromMinMax(min, max);
@@ -11654,7 +11659,7 @@ function getDomainFromCategories(props, axis, categories) {
11654
11659
  */
11655
11660
 
11656
11661
  function getDomainFromData(props, axis, dataset) {
11657
- dataset = dataset || _data__WEBPACK_IMPORTED_MODULE_10__.getData(props);
11662
+ var datasetArray = dataset || _data__WEBPACK_IMPORTED_MODULE_10__.getData(props);
11658
11663
  var polar = props.polar,
11659
11664
  _props$startAngle2 = props.startAngle,
11660
11665
  startAngle = _props$startAngle2 === void 0 ? 0 : _props$startAngle2,
@@ -11663,14 +11668,14 @@ function getDomainFromData(props, axis, dataset) {
11663
11668
  var minDomain = getMinFromProps(props, axis);
11664
11669
  var maxDomain = getMaxFromProps(props, axis);
11665
11670
 
11666
- if (dataset.length < 1) {
11671
+ if (datasetArray.length < 1) {
11667
11672
  return minDomain !== undefined && maxDomain !== undefined ? getDomainFromMinMax(minDomain, maxDomain) : undefined;
11668
11673
  }
11669
11674
 
11670
- var min = minDomain !== undefined ? minDomain : getExtremeFromData(dataset, axis, "min");
11671
- var max = maxDomain !== undefined ? maxDomain : getExtremeFromData(dataset, axis, "max");
11675
+ var min = minDomain !== undefined ? minDomain : getExtremeFromData(datasetArray, axis, "min");
11676
+ var max = maxDomain !== undefined ? maxDomain : getExtremeFromData(datasetArray, axis, "max");
11672
11677
  var domain = getDomainFromMinMax(min, max);
11673
- return polar && axis === "x" && Math.abs(startAngle - endAngle) === 360 ? getSymmetricDomain(domain, getFlatData(dataset, axis)) : domain;
11678
+ return polar && axis === "x" && Math.abs(startAngle - endAngle) === 360 ? getSymmetricDomain(domain, getFlatData(datasetArray, axis)) : domain;
11674
11679
  }
11675
11680
  /**
11676
11681
  * Returns a domain in the form of a two element array given a min and max value.
@@ -11983,14 +11988,14 @@ function getScopedEvents(events, namespace, childType, baseProps) {
11983
11988
  // eslint-disable-next-line no-invalid-this
11984
11989
 
11985
11990
 
11986
- baseProps = baseProps || this.baseProps; // returns the original base props or base state of a given target element
11991
+ var newBaseProps = baseProps || this.baseProps; // returns the original base props or base state of a given target element
11987
11992
 
11988
11993
  var getTargetProps = function (identifier, type) {
11989
11994
  var childName = identifier.childName,
11990
11995
  target = identifier.target,
11991
11996
  key = identifier.key; // eslint-disable-next-line no-invalid-this
11992
11997
 
11993
- var baseType = type === "props" ? baseProps : _this2.state || {};
11998
+ var baseType = type === "props" ? newBaseProps : _this2.state || {};
11994
11999
  var base = childName === undefined || childName === null || !baseType[childName] ? baseType : baseType[childName];
11995
12000
  return key === "parent" ? base.parent : base[key] && base[key][target];
11996
12001
  }; // Returns the state object with the mutation caused by a given eventReturn
@@ -12078,8 +12083,7 @@ function getScopedEvents(events, namespace, childType, baseProps) {
12078
12083
 
12079
12084
  var parseEventReturn = function (eventReturn, eventKey) {
12080
12085
  return Array.isArray(eventReturn) ? eventReturn.reduce(function (memo, props) {
12081
- memo = lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()({}, memo, parseEvent(props, eventKey));
12082
- return memo;
12086
+ return lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()({}, memo, parseEvent(props, eventKey));
12083
12087
  }, {}) : parseEvent(eventReturn, eventKey);
12084
12088
  };
12085
12089
 
@@ -12165,9 +12169,10 @@ function getEventState(eventKey, namespace, childType) {
12165
12169
  */
12166
12170
  // eslint-disable-next-line max-params
12167
12171
 
12168
- function getExternalMutationsWithChildren(mutations, baseProps, baseState, childNames) {
12169
- baseProps = baseProps || {};
12170
- baseState = baseState || {};
12172
+ function getExternalMutationsWithChildren(mutations) {
12173
+ var baseProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12174
+ var baseState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
12175
+ var childNames = arguments.length > 3 ? arguments[3] : undefined;
12171
12176
  return childNames.reduce(function (memo, childName) {
12172
12177
  var childState = baseState[childName];
12173
12178
  var mutation = getExternalMutations(mutations, baseProps[childName], baseState[childName], childName);
@@ -12189,9 +12194,10 @@ function getExternalMutationsWithChildren(mutations, baseProps, baseState, child
12189
12194
  */
12190
12195
  // eslint-disable-next-line max-params
12191
12196
 
12192
- function getExternalMutations(mutations, baseProps, baseState, childName) {
12193
- baseProps = baseProps || {};
12194
- baseState = baseState || {};
12197
+ function getExternalMutations(mutations) {
12198
+ var baseProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12199
+ var baseState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
12200
+ var childName = arguments.length > 3 ? arguments[3] : undefined;
12195
12201
 
12196
12202
  var eventKeys = lodash_keys__WEBPACK_IMPORTED_MODULE_0___default()(baseProps);
12197
12203
 
@@ -12257,8 +12263,7 @@ function getExternalMutation(mutations, baseProps, baseState, identifier) {
12257
12263
  return false;
12258
12264
  };
12259
12265
 
12260
- mutations = Array.isArray(mutations) ? mutations : [mutations];
12261
- var scopedMutations = mutations;
12266
+ var scopedMutations = Array.isArray(mutations) ? mutations : [mutations];
12262
12267
 
12263
12268
  if (identifier.childName) {
12264
12269
  scopedMutations = mutations.filter(function (m) {
@@ -12297,13 +12302,10 @@ function getExternalMutation(mutations, baseProps, baseState, identifier) {
12297
12302
 
12298
12303
  function getComponentEvents(props, components) {
12299
12304
  var events = Array.isArray(components) && components.reduce(function (memo, componentName) {
12300
- var _memo;
12301
-
12302
12305
  var component = props[componentName];
12303
12306
  var defaultEvents = component && component.type && component.type.defaultEvents;
12304
12307
  var componentEvents = lodash_isFunction__WEBPACK_IMPORTED_MODULE_6___default()(defaultEvents) ? defaultEvents(component.props) : defaultEvents;
12305
- memo = Array.isArray(componentEvents) ? (_memo = memo).concat.apply(_memo, _toConsumableArray(componentEvents)) : memo;
12306
- return memo;
12308
+ return Array.isArray(componentEvents) ? memo.concat.apply(memo, _toConsumableArray(componentEvents)) : memo;
12307
12309
  }, []);
12308
12310
  return events && events.length ? events : undefined;
12309
12311
  }
@@ -12661,6 +12663,7 @@ function reduceChildren(children, iteratee) {
12661
12663
 
12662
12664
  var traverseChildren = function (childArray, names, parent) {
12663
12665
  return childArray.reduce(function (memo, child, index) {
12666
+ var newMemo = memo;
12664
12667
  var childRole = child.type && child.type.role;
12665
12668
  var childName = child.props.name || "".concat(childRole, "-").concat(names[index]);
12666
12669
 
@@ -12678,16 +12681,16 @@ function reduceChildren(children, iteratee) {
12678
12681
  });
12679
12682
 
12680
12683
  var nestedResults = traverseChildren(nestedChildren, _childNames, child);
12681
- memo = combine(memo, nestedResults);
12684
+ newMemo = combine(newMemo, nestedResults);
12682
12685
  } else {
12683
12686
  var result = iteratee(child, childName, parent);
12684
12687
 
12685
12688
  if (result) {
12686
- memo = combine(memo, result);
12689
+ newMemo = combine(newMemo, result);
12687
12690
  }
12688
12691
  }
12689
12692
 
12690
- return memo;
12693
+ return newMemo;
12691
12694
  }, initialMemo);
12692
12695
  };
12693
12696
 
@@ -12713,8 +12716,7 @@ function isHorizontal(props) {
12713
12716
  var childProps = child.props || {};
12714
12717
 
12715
12718
  if (memo || childProps.horizontal || !childProps.children) {
12716
- memo = memo || childProps.horizontal;
12717
- return memo;
12719
+ return memo || childProps.horizontal;
12718
12720
  }
12719
12721
 
12720
12722
  return traverseChildren(react__WEBPACK_IMPORTED_MODULE_6___default().Children.toArray(childProps.children));
@@ -12767,11 +12769,13 @@ function isMap(x) {
12767
12769
  }
12768
12770
  function shallowToJS(x, whitelist) {
12769
12771
  return isIterable(x) ? x.reduce(function (result, curr, key) {
12772
+ var newCurr = curr;
12773
+
12770
12774
  if (whitelist && whitelist[key]) {
12771
- curr = shallowToJS(curr);
12775
+ newCurr = shallowToJS(curr);
12772
12776
  }
12773
12777
 
12774
- result[key] = curr;
12778
+ result[key] = newCurr;
12775
12779
  return result;
12776
12780
  }, isList(x) ? [] : {}) : x;
12777
12781
  }
@@ -12799,12 +12803,10 @@ __webpack_require__.r(__webpack_exports__);
12799
12803
  /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
12800
12804
 
12801
12805
 
12802
- /* eslint-disable no-use-before-define */
12803
-
12804
12806
 
12805
12807
  // Private Functions
12806
- function getVerticalAnchor(props, datum) {
12807
- datum = datum || {};
12808
+ function getVerticalAnchor(props) {
12809
+ var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12808
12810
  var sign = datum._y >= 0 ? 1 : -1;
12809
12811
  var labelStyle = props.style && props.style.labels || {};
12810
12812
 
@@ -12817,8 +12819,8 @@ function getVerticalAnchor(props, datum) {
12817
12819
  return "middle";
12818
12820
  }
12819
12821
 
12820
- function getTextAnchor(props, datum) {
12821
- datum = datum || {};
12822
+ function getTextAnchor(props) {
12823
+ var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12822
12824
  var style = props.style,
12823
12825
  horizontal = props.horizontal;
12824
12826
  var sign = datum._y >= 0 ? 1 : -1;
@@ -12833,14 +12835,14 @@ function getTextAnchor(props, datum) {
12833
12835
  return sign >= 0 ? "start" : "end";
12834
12836
  }
12835
12837
 
12836
- function getAngle(props, datum) {
12837
- datum = datum || {};
12838
+ function getAngle(props) {
12839
+ var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12838
12840
  var labelStyle = props.style && props.style.labels || {};
12839
12841
  return datum.angle === undefined ? labelStyle.angle : datum.angle;
12840
12842
  }
12841
12843
 
12842
- function getPadding(props, datum) {
12843
- datum = datum || {};
12844
+ function getPadding(props) {
12845
+ var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12844
12846
  var horizontal = props.horizontal,
12845
12847
  style = props.style;
12846
12848
  var labelStyle = style.labels || {};
@@ -12919,8 +12921,9 @@ function getPolarOrientation(degrees) {
12919
12921
  } // Exported Functions
12920
12922
 
12921
12923
 
12922
- function getText(props, datum, index) {
12923
- datum = datum || {};
12924
+ function getText(props) {
12925
+ var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12926
+ var index = arguments.length > 2 ? arguments[2] : undefined;
12924
12927
 
12925
12928
  if (datum.label !== undefined) {
12926
12929
  return datum.label;
@@ -14080,11 +14083,10 @@ var Timer = /*#__PURE__*/function () {
14080
14083
  }, {
14081
14084
  key: "subscribe",
14082
14085
  value: function subscribe(callback, duration) {
14083
- duration = this.shouldAnimate ? duration : 0;
14084
14086
  var subscriptionID = this.subscribers.push({
14085
14087
  startTime: (0,victory_vendor_d3_timer__WEBPACK_IMPORTED_MODULE_0__.now)(),
14086
14088
  callback: callback,
14087
- duration: duration
14089
+ duration: this.shouldAnimate ? duration : 0
14088
14090
  });
14089
14091
  this.activeSubscriptions++;
14090
14092
  this.start();
@@ -14271,36 +14273,38 @@ function getInitialChildProps(animate, data) {
14271
14273
 
14272
14274
 
14273
14275
  function getChildBeforeLoad(animate, child, data, cb) {
14274
- animate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
14276
+ var newAnimate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
14275
14277
  onEnd: cb
14276
14278
  });
14277
14279
 
14278
- if (animate && animate.onLoad && !animate.onLoad.duration) {
14280
+ if (newAnimate && newAnimate.onLoad && !newAnimate.onLoad.duration) {
14279
14281
  return {
14280
- animate: animate,
14282
+ animate: newAnimate,
14281
14283
  data: data
14282
14284
  };
14283
14285
  }
14284
14286
 
14285
- 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.
14287
+ 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.
14286
14288
 
14287
- data = data.map(function (datum, idx) {
14289
+ var newData = data.map(function (datum, idx) {
14288
14290
  return lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, before(datum, idx, data));
14289
14291
  });
14290
14292
  return {
14291
- animate: animate,
14292
- data: data,
14293
+ animate: newAnimate,
14294
+ data: newData,
14293
14295
  clipWidth: 0
14294
14296
  };
14295
14297
  } // eslint-disable-next-line max-params
14296
14298
 
14297
14299
 
14298
14300
  function getChildOnLoad(animate, data, cb) {
14299
- animate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
14301
+ var newAnimate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
14300
14302
  onEnd: cb
14301
14303
  });
14302
14304
 
14303
- if (animate && animate.onLoad && !animate.onLoad.duration) {
14305
+ var newData = data;
14306
+
14307
+ if (newAnimate && newAnimate.onLoad && !newAnimate.onLoad.duration) {
14304
14308
  return {
14305
14309
  animate: animate,
14306
14310
  data: data
@@ -14309,12 +14313,12 @@ function getChildOnLoad(animate, data, cb) {
14309
14313
 
14310
14314
  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.
14311
14315
 
14312
- data = data.map(function (datum, idx) {
14316
+ newData = data.map(function (datum, idx) {
14313
14317
  return lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, after(datum, idx, data));
14314
14318
  });
14315
14319
  return {
14316
- animate: animate,
14317
- data: data
14320
+ animate: newAnimate,
14321
+ data: newData
14318
14322
  };
14319
14323
  } // eslint-disable-next-line max-params, max-len
14320
14324
 
@@ -14323,7 +14327,10 @@ function getChildPropsOnExit(animate, child, data, exitingNodes, cb) {
14323
14327
  // Whether or not _this_ child has exiting nodes, we want the exit-
14324
14328
  // transition for all children to have the same duration, delay, etc.
14325
14329
  var onExit = animate && animate.onExit;
14326
- animate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, onExit);
14330
+
14331
+ var newAnimate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, onExit);
14332
+
14333
+ var newData = data;
14327
14334
 
14328
14335
  if (exitingNodes) {
14329
14336
  // After the exit transition occurs, trigger the animations for
@@ -14331,39 +14338,42 @@ function getChildPropsOnExit(animate, child, data, exitingNodes, cb) {
14331
14338
  animate.onEnd = cb;
14332
14339
  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.
14333
14340
 
14334
- data = data.map(function (datum, idx) {
14341
+ newData = data.map(function (datum, idx) {
14335
14342
  var key = (datum.key || idx).toString();
14336
14343
  return exitingNodes[key] ? lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, before(datum, idx, data)) : datum;
14337
14344
  });
14338
14345
  }
14339
14346
 
14340
14347
  return {
14341
- animate: animate,
14342
- data: data
14348
+ animate: newAnimate,
14349
+ data: newData
14343
14350
  };
14344
14351
  } // eslint-disable-next-line max-params,max-len
14345
14352
 
14346
14353
 
14347
14354
  function getChildPropsBeforeEnter(animate, child, data, enteringNodes, cb) {
14355
+ var newAnimate = animate;
14356
+ var newData = data;
14357
+
14348
14358
  if (enteringNodes) {
14349
14359
  // Perform a normal animation here, except - when it finishes - trigger
14350
14360
  // the transition for entering nodes.
14351
- animate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
14361
+ newAnimate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
14352
14362
  onEnd: cb
14353
14363
  });
14354
14364
  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
14355
14365
  // domain. However, we may not want these nodes to be displayed initially,
14356
14366
  // so perform the `onEnter.before` transformation on each node.
14357
14367
 
14358
- data = data.map(function (datum, idx) {
14368
+ newData = data.map(function (datum, idx) {
14359
14369
  var key = (datum.key || idx).toString();
14360
14370
  return enteringNodes[key] ? lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, before(datum, idx, data)) : datum;
14361
14371
  });
14362
14372
  }
14363
14373
 
14364
14374
  return {
14365
- animate: animate,
14366
- data: data
14375
+ animate: newAnimate,
14376
+ data: newData
14367
14377
  };
14368
14378
  } // eslint-disable-next-line max-params, max-len
14369
14379
 
@@ -14372,23 +14382,26 @@ function getChildPropsOnEnter(animate, data, enteringNodes, cb) {
14372
14382
  // Whether or not _this_ child has entering nodes, we want the entering-
14373
14383
  // transition for all children to have the same duration, delay, etc.
14374
14384
  var onEnter = animate && animate.onEnter;
14375
- animate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, onEnter);
14385
+
14386
+ var newAnimate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, onEnter);
14387
+
14388
+ var newData = data;
14376
14389
 
14377
14390
  if (enteringNodes) {
14378
14391
  // Old nodes have been transitioned to their new values, and the
14379
14392
  // domain should encompass the nodes that will now enter. So perform
14380
14393
  // the `onEnter.after` transformation on each node.
14381
- animate.onEnd = cb;
14382
- var after = animate.onEnter && animate.onEnter.after ? animate.onEnter.after : (lodash_identity__WEBPACK_IMPORTED_MODULE_1___default());
14383
- data = data.map(function (datum, idx) {
14394
+ newAnimate.onEnd = cb;
14395
+ var after = newAnimate.onEnter && newAnimate.onEnter.after ? newAnimate.onEnter.after : (lodash_identity__WEBPACK_IMPORTED_MODULE_1___default());
14396
+ newData = data.map(function (datum, idx) {
14384
14397
  var key = getDatumKey(datum, idx);
14385
14398
  return enteringNodes[key] ? lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, after(datum, idx, data)) : datum;
14386
14399
  });
14387
14400
  }
14388
14401
 
14389
14402
  return {
14390
- animate: animate,
14391
- data: data
14403
+ animate: newAnimate,
14404
+ data: newData
14392
14405
  };
14393
14406
  }
14394
14407
  /**
@@ -14554,6 +14567,7 @@ function getTransitionPropsFactory(props, state, setState) {
14554
14567
  "use strict";
14555
14568
  __webpack_require__.r(__webpack_exports__);
14556
14569
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
14570
+ /* harmony export */ "assert": () => (/* binding */ assert),
14557
14571
  /* harmony export */ "getSafeUserProps": () => (/* binding */ getSafeUserProps),
14558
14572
  /* harmony export */ "withSafeUserProps": () => (/* binding */ withSafeUserProps)
14559
14573
  /* harmony export */ });
@@ -14634,6 +14648,18 @@ var testIfSafeProp = function (key) {
14634
14648
  if (doesPropStartWith(key) || isExactMatch(key)) return true;
14635
14649
  return false;
14636
14650
  };
14651
+ /**
14652
+ * Asserts that value is not null or undefined, throwing an error if it is.
14653
+ * @param value The value to assert
14654
+ * @param message The error message to throw
14655
+ */
14656
+
14657
+
14658
+ function assert(value, message) {
14659
+ if (value === undefined || value === null) {
14660
+ throw new Error(message);
14661
+ }
14662
+ }
14637
14663
  /**
14638
14664
  * getSafeUserProps - function that takes in a props object and removes any
14639
14665
  * key-value entries that do not match filter strings in the USER_PROPS_SAFELIST
@@ -14643,7 +14669,6 @@ var testIfSafeProp = function (key) {
14643
14669
  * @returns {Object}: object containing remaining acceptable props
14644
14670
  */
14645
14671
 
14646
-
14647
14672
  var getSafeUserProps = function (props) {
14648
14673
  var propsToFilter = _objectSpread({}, props);
14649
14674