victory-core 36.8.2 → 36.8.4

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 (98) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/victory-core.js +181 -159
  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 +7 -11
  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.js +7 -6
  23. package/es/victory-util/axis.js +2 -2
  24. package/es/victory-util/common-props.d.ts +1 -0
  25. package/es/victory-util/data.js +14 -9
  26. package/es/victory-util/domain.js +15 -15
  27. package/es/victory-util/events.d.ts +3 -3
  28. package/es/victory-util/events.js +17 -20
  29. package/es/victory-util/helpers.js +5 -5
  30. package/es/victory-util/immutable.js +4 -2
  31. package/es/victory-util/label-helpers.d.ts +1 -1
  32. package/es/victory-util/label-helpers.js +11 -12
  33. package/es/victory-util/selection.js +1 -2
  34. package/es/victory-util/timer.js +1 -2
  35. package/es/victory-util/transitions.js +37 -26
  36. package/es/victory-util/user-props.d.ts +6 -0
  37. package/es/victory-util/user-props.js +12 -1
  38. package/es/victory-util/wrapper.js +14 -14
  39. package/lib/types/callbacks.d.ts +4 -4
  40. package/lib/victory-animation/util.d.ts +3 -3
  41. package/lib/victory-animation/util.js +5 -3
  42. package/lib/victory-animation/victory-animation.js +2 -2
  43. package/lib/victory-label/victory-label.d.ts +1 -1
  44. package/lib/victory-label/victory-label.js +7 -11
  45. package/lib/victory-primitives/arc.d.ts +1 -1
  46. package/lib/victory-primitives/arc.js +2 -2
  47. package/lib/victory-primitives/background.d.ts +1 -1
  48. package/lib/victory-primitives/background.js +2 -2
  49. package/lib/victory-primitives/border.d.ts +1 -1
  50. package/lib/victory-primitives/border.js +2 -2
  51. package/lib/victory-primitives/line-segment.d.ts +1 -1
  52. package/lib/victory-primitives/line-segment.js +2 -2
  53. package/lib/victory-primitives/point.d.ts +1 -1
  54. package/lib/victory-primitives/point.js +2 -2
  55. package/lib/victory-primitives/whisker.d.ts +1 -1
  56. package/lib/victory-primitives/whisker.js +16 -17
  57. package/lib/victory-util/add-events.js +7 -6
  58. package/lib/victory-util/axis.js +2 -2
  59. package/lib/victory-util/common-props.d.ts +1 -0
  60. package/lib/victory-util/data.js +14 -9
  61. package/lib/victory-util/domain.js +15 -15
  62. package/lib/victory-util/events.d.ts +3 -3
  63. package/lib/victory-util/events.js +17 -20
  64. package/lib/victory-util/helpers.js +5 -5
  65. package/lib/victory-util/immutable.js +4 -2
  66. package/lib/victory-util/label-helpers.d.ts +1 -1
  67. package/lib/victory-util/label-helpers.js +11 -11
  68. package/lib/victory-util/selection.js +1 -2
  69. package/lib/victory-util/timer.js +1 -2
  70. package/lib/victory-util/transitions.js +32 -26
  71. package/lib/victory-util/user-props.d.ts +6 -0
  72. package/lib/victory-util/user-props.js +13 -0
  73. package/lib/victory-util/wrapper.js +16 -14
  74. package/package.json +2 -2
  75. package/src/types/callbacks.ts +8 -5
  76. package/src/victory-animation/util.ts +5 -3
  77. package/src/victory-animation/victory-animation.tsx +3 -2
  78. package/src/victory-label/victory-label.tsx +18 -17
  79. package/src/victory-primitives/arc.tsx +2 -2
  80. package/src/victory-primitives/background.tsx +2 -2
  81. package/src/victory-primitives/border.tsx +2 -2
  82. package/src/victory-primitives/line-segment.tsx +2 -2
  83. package/src/victory-primitives/point.tsx +2 -2
  84. package/src/victory-primitives/whisker.tsx +5 -5
  85. package/src/victory-util/add-events.tsx +10 -9
  86. package/src/victory-util/axis.tsx +6 -2
  87. package/src/victory-util/common-props.tsx +1 -0
  88. package/src/victory-util/data.ts +12 -8
  89. package/src/victory-util/domain.ts +15 -15
  90. package/src/victory-util/events.ts +23 -31
  91. package/src/victory-util/helpers.ts +5 -5
  92. package/src/victory-util/immutable.ts +3 -2
  93. package/src/victory-util/label-helpers.ts +6 -10
  94. package/src/victory-util/selection.ts +3 -2
  95. package/src/victory-util/timer.ts +1 -2
  96. package/src/victory-util/transitions.ts +31 -22
  97. package/src/victory-util/user-props.ts +14 -0
  98. package/src/victory-util/wrapper.tsx +17 -22
@@ -1,4 +1,4 @@
1
- import { D3Scale, Datum, ID } from "./prop-types";
1
+ import { D3Scale, Datum, ID, ScalePropType } from "./prop-types";
2
2
  import { BlockProps, OrientationTypes } from "../victory-theme/types";
3
3
  /**
4
4
  * This is the first parameter of a callback when a callback is used to
@@ -15,9 +15,9 @@ export interface CallbackArgs {
15
15
  index?: ID;
16
16
  x?: number;
17
17
  y?: number;
18
- scale?: {
19
- x?: D3Scale;
20
- y?: D3Scale;
18
+ scale?: ScalePropType | D3Scale | {
19
+ x?: ScalePropType | D3Scale;
20
+ y?: ScalePropType | D3Scale;
21
21
  };
22
22
  tick?: any;
23
23
  ticks?: any;
@@ -34,11 +34,11 @@ export declare const interpolateFunction: (a: any, b: any) => (t: any) => any;
34
34
  * differs in that it uses our custom interpolators when interpolating the value of each property in
35
35
  * an object. This allows the correct interpolation of nested objects, including styles
36
36
  *
37
- * @param {any} a - Start value.
38
- * @param {any} b - End value.
37
+ * @param {any} startValue - Start value.
38
+ * @param {any} endValue - End value.
39
39
  * @returns {Function} An interpolation function.
40
40
  */
41
- export declare const interpolateObject: (a: any, b: any) => (t: any) => {};
41
+ export declare const interpolateObject: (startValue: any, endValue: any) => (t: any) => {};
42
42
  export declare const interpolateString: (a: any, b: any) => (t: number) => any;
43
43
  /**
44
44
  * By default, the list of interpolators used by `d3.interpolate` has a few
@@ -100,12 +100,12 @@ export var interpolateFunction = function (a, b) {
100
100
  * differs in that it uses our custom interpolators when interpolating the value of each property in
101
101
  * an object. This allows the correct interpolation of nested objects, including styles
102
102
  *
103
- * @param {any} a - Start value.
104
- * @param {any} b - End value.
103
+ * @param {any} startValue - Start value.
104
+ * @param {any} endValue - End value.
105
105
  * @returns {Function} An interpolation function.
106
106
  */
107
107
 
108
- export var interpolateObject = function (a, b) {
108
+ export var interpolateObject = function (startValue, endValue) {
109
109
  var interpolateTypes = function (x, y) {
110
110
  if (x === y || !isInterpolatable(x) || !isInterpolatable(y)) {
111
111
  return interpolateImmediate(x, y);
@@ -130,6 +130,8 @@ export var interpolateObject = function (a, b) {
130
130
 
131
131
  var i = {};
132
132
  var c = {};
133
+ var a = startValue;
134
+ var b = endValue;
133
135
  var k;
134
136
 
135
137
  if (a === null || typeof a !== "object") {
@@ -61,8 +61,8 @@ export var VictoryAnimation = /*#__PURE__*/function (_React$Component) {
61
61
  step can generate imprecise values, sometimes greater than 1
62
62
  if this happens set the state to 1 and return, cancelling the timer
63
63
  */
64
- duration = duration !== undefined ? duration : _this.props.duration;
65
- var step = duration ? elapsed / duration : 1;
64
+ var animationDuration = duration !== undefined ? duration : _this.props.duration;
65
+ var step = animationDuration ? elapsed / animationDuration : 1;
66
66
 
67
67
  if (step >= 1) {
68
68
  _this.setState({
@@ -17,7 +17,7 @@ export interface VictoryLabelProps {
17
17
  capHeight?: StringOrNumberOrCallback;
18
18
  children?: StringOrNumberOrCallback;
19
19
  className?: string;
20
- datum?: object;
20
+ datum?: Record<string, any>;
21
21
  data?: any[];
22
22
  desc?: string;
23
23
  direction?: string;
@@ -91,8 +91,7 @@ var getStyles = function (style, props) {
91
91
  }
92
92
 
93
93
  var getSingleStyle = function (s) {
94
- s = s ? _defaults({}, s, defaultStyles) : defaultStyles;
95
- var baseStyles = Helpers.evaluateStyle(s, props);
94
+ var baseStyles = Helpers.evaluateStyle(s ? _defaults({}, s, defaultStyles) : defaultStyles, props);
96
95
  return _assign({}, baseStyles, {
97
96
  fontSize: getFontSize(baseStyles)
98
97
  });
@@ -296,22 +295,19 @@ var getInlineXOffset = function (calculatedProps, textElements, index) {
296
295
  switch (textAnchor) {
297
296
  case "start":
298
297
  return widths.reduce(function (memo, width, i) {
299
- memo = i < index ? memo + width : memo;
300
- return memo;
298
+ return i < index ? memo + width : memo;
301
299
  }, 0);
302
300
 
303
301
  case "end":
304
302
  return widths.reduce(function (memo, width, i) {
305
- memo = i > index ? memo - width : memo;
306
- return memo;
303
+ return i > index ? memo - width : memo;
307
304
  }, 0);
308
305
 
309
306
  default:
310
307
  // middle
311
308
  return widths.reduce(function (memo, width, i) {
312
309
  var offsetWidth = i < index ? width : 0;
313
- memo = i === index ? memo + width / 2 : memo + offsetWidth;
314
- return memo;
310
+ return i === index ? memo + width / 2 : memo + offsetWidth;
315
311
  }, centerOffset);
316
312
  }
317
313
  };
@@ -513,8 +509,8 @@ var defaultProps = {
513
509
  // Magic number from d3.
514
510
  lineHeight: 1
515
511
  };
516
- export var VictoryLabel = function (props) {
517
- props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), props));
512
+ export var VictoryLabel = function (initialProps) {
513
+ var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps));
518
514
 
519
515
  if (props.text === null || props.text === undefined) {
520
516
  return null;
@@ -535,7 +531,7 @@ export var VictoryLabel = function (props) {
535
531
  fontSize: currentStyle.fontSize || defaultStyles.fontSize,
536
532
  capHeight: capHeightPx,
537
533
  text: line,
538
- // @ts-expect-error TODO: This looks like a bug:
534
+ // TODO: This looks like a bug:
539
535
  textSize: TextSize.approximateTextSize(line, currentStyle),
540
536
  lineHeight: currentLineHeight,
541
537
  backgroundPadding: getSingleValue(backgroundPadding, i)
@@ -12,7 +12,7 @@ export interface ArcProps extends VictoryCommonPrimitiveProps {
12
12
  startAngle?: number;
13
13
  }
14
14
  export declare const Arc: {
15
- (props: ArcProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
15
+ (initialProps: ArcProps): React.DetailedReactHTMLElement<any, HTMLElement>;
16
16
  propTypes: {
17
17
  closedPath: PropTypes.Requireable<boolean>;
18
18
  cx: PropTypes.Requireable<number>;
@@ -68,8 +68,8 @@ var defaultProps = {
68
68
  role: "presentation",
69
69
  shapeRendering: "auto"
70
70
  };
71
- export var Arc = function (props) {
72
- props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), props));
71
+ export var Arc = function (initialProps) {
72
+ var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps));
73
73
  return /*#__PURE__*/React.cloneElement(props.pathComponent, _objectSpread(_objectSpread({}, props.events), {}, {
74
74
  "aria-label": props.ariaLabel,
75
75
  d: getArcPath(props),
@@ -12,7 +12,7 @@ export interface BackgroundProps extends VictoryCommonPrimitiveProps {
12
12
  y?: number;
13
13
  }
14
14
  export declare const Background: {
15
- (props: BackgroundProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
15
+ (initialProps: BackgroundProps): React.DetailedReactHTMLElement<any, HTMLElement>;
16
16
  propTypes: {
17
17
  circleComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
18
18
  height: PropTypes.Requireable<number>;
@@ -30,8 +30,8 @@ var defaultProps = {
30
30
  role: "presentation",
31
31
  shapeRendering: "auto"
32
32
  };
33
- export var Background = function (props) {
34
- props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), props));
33
+ export var Background = function (initialProps) {
34
+ var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps));
35
35
  return props.polar ? /*#__PURE__*/React.cloneElement(props.circleComponent, _objectSpread(_objectSpread({}, props.events), {}, {
36
36
  style: props.style,
37
37
  role: props.role,
@@ -9,7 +9,7 @@ export interface BorderProps extends VictoryCommonPrimitiveProps {
9
9
  y?: number;
10
10
  }
11
11
  export declare const Border: {
12
- (props: BorderProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
12
+ (initialProps: BorderProps): React.DetailedReactHTMLElement<any, HTMLElement>;
13
13
  propTypes: {
14
14
  height: PropTypes.Requireable<number>;
15
15
  rectComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
@@ -42,8 +42,8 @@ var defaultProps = {
42
42
  role: "presentation",
43
43
  shapeRendering: "auto"
44
44
  };
45
- export var Border = function (props) {
46
- props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), props));
45
+ export var Border = function (initialProps) {
46
+ var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps));
47
47
  return /*#__PURE__*/React.cloneElement(props.rectComponent, _objectSpread(_objectSpread({}, props.events), {}, {
48
48
  "aria-label": props.ariaLabel,
49
49
  style: props.style,
@@ -10,7 +10,7 @@ export interface LineSegmentProps extends VictoryCommonPrimitiveProps {
10
10
  y2?: number;
11
11
  }
12
12
  export declare const LineSegment: {
13
- (props: LineSegmentProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
13
+ (initialProps: LineSegmentProps): React.DetailedReactHTMLElement<any, HTMLElement>;
14
14
  propTypes: {
15
15
  datum: PropTypes.Requireable<any>;
16
16
  lineComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
@@ -42,8 +42,8 @@ var defaultProps = {
42
42
  role: "presentation",
43
43
  shapeRendering: "auto"
44
44
  };
45
- export var LineSegment = function (props) {
46
- props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), props));
45
+ export var LineSegment = function (initialProps) {
46
+ var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps));
47
47
  return /*#__PURE__*/React.cloneElement(props.lineComponent, _objectSpread(_objectSpread({}, props.events), {}, {
48
48
  "aria-label": props.ariaLabel,
49
49
  style: props.style,
@@ -12,7 +12,7 @@ export interface PointProps extends VictoryCommonPrimitiveProps {
12
12
  y?: number;
13
13
  }
14
14
  export declare const Point: {
15
- (props: PointProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
15
+ (initialProps: PointProps): React.DetailedReactHTMLElement<any, HTMLElement>;
16
16
  propTypes: {
17
17
  datum: PropTypes.Requireable<object>;
18
18
  getPath: PropTypes.Requireable<(...args: any[]) => any>;
@@ -63,8 +63,8 @@ var defaultProps = {
63
63
  role: "presentation",
64
64
  shapeRendering: "auto"
65
65
  };
66
- export var Point = function (props) {
67
- props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), props));
66
+ export var Point = function (initialProps) {
67
+ var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps));
68
68
  var userProps = UserProps.getSafeUserProps(props);
69
69
  return /*#__PURE__*/React.cloneElement(props.pathComponent, _objectSpread(_objectSpread({}, props.events), {}, {
70
70
  "aria-label": props.ariaLabel,
@@ -14,7 +14,7 @@ export interface WhiskerProps extends VictoryCommonPrimitiveProps {
14
14
  minorWhisker?: WhiskerAxes;
15
15
  }
16
16
  export declare const Whisker: {
17
- (props: WhiskerProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
17
+ (initialProps: WhiskerProps): React.DetailedReactHTMLElement<{}, HTMLElement>;
18
18
  propTypes: {
19
19
  groupComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
20
20
  lineComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
@@ -41,23 +41,22 @@ var defaultProps = {
41
41
  role: "presentation",
42
42
  shapeRendering: "auto"
43
43
  };
44
- export var Whisker = function (props) {
45
- props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), props));
46
- var _props = props,
47
- ariaLabel = _props.ariaLabel,
48
- groupComponent = _props.groupComponent,
49
- lineComponent = _props.lineComponent,
50
- events = _props.events,
51
- className = _props.className,
52
- majorWhisker = _props.majorWhisker,
53
- minorWhisker = _props.minorWhisker,
54
- transform = _props.transform,
55
- clipPath = _props.clipPath,
56
- role = _props.role,
57
- shapeRendering = _props.shapeRendering,
58
- style = _props.style,
59
- desc = _props.desc,
60
- tabIndex = _props.tabIndex;
44
+ export var Whisker = function (initialProps) {
45
+ var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps));
46
+ var ariaLabel = props.ariaLabel,
47
+ groupComponent = props.groupComponent,
48
+ lineComponent = props.lineComponent,
49
+ events = props.events,
50
+ className = props.className,
51
+ majorWhisker = props.majorWhisker,
52
+ minorWhisker = props.minorWhisker,
53
+ transform = props.transform,
54
+ clipPath = props.clipPath,
55
+ role = props.role,
56
+ shapeRendering = props.shapeRendering,
57
+ style = props.style,
58
+ desc = props.desc,
59
+ tabIndex = props.tabIndex;
61
60
 
62
61
  var baseProps = _objectSpread(_objectSpread({}, events), {}, {
63
62
  style: style,
@@ -222,8 +222,7 @@ export function addEvents(WrappedComponent) {
222
222
  value: function applyExternalMutations(props, externalMutations) {
223
223
  if (!_isEmpty(externalMutations)) {
224
224
  var callbacks = props.externalEventMutations.reduce(function (memo, mutation) {
225
- memo = _isFunction(mutation.callback) ? memo.concat(mutation.callback) : memo;
226
- return memo;
225
+ return _isFunction(mutation.callback) ? memo.concat(mutation.callback) : memo;
227
226
  }, []);
228
227
  var compiledCallbacks = callbacks.length ? function () {
229
228
  callbacks.forEach(function (c) {
@@ -278,8 +277,8 @@ export function addEvents(WrappedComponent) {
278
277
  }, {
279
278
  key: "getBaseProps",
280
279
  value: function getBaseProps(props, getSharedEventState) {
281
- getSharedEventState = getSharedEventState || this.getSharedEventState.bind(this);
282
- var sharedParentState = getSharedEventState("parent", "parent");
280
+ var getSharedEventStateFunction = getSharedEventState || this.getSharedEventState.bind(this);
281
+ var sharedParentState = getSharedEventStateFunction("parent", "parent");
283
282
  var parentState = this.getEventState("parent", "parent");
284
283
 
285
284
  var baseParentProps = _defaults({}, parentState, sharedParentState);
@@ -378,13 +377,15 @@ export function addEvents(WrappedComponent) {
378
377
  var dataKeys = _without(this.dataKeys, "all");
379
378
 
380
379
  var labelComponents = dataKeys.reduce(function (memo, key) {
380
+ var newMemo = memo;
381
+
381
382
  var labelProps = _this8.getComponentProps(labelComponent, "labels", key);
382
383
 
383
384
  if (labelProps && labelProps.text !== undefined && labelProps.text !== null) {
384
- memo = memo.concat( /*#__PURE__*/React.cloneElement(labelComponent, labelProps));
385
+ newMemo = newMemo.concat( /*#__PURE__*/React.cloneElement(labelComponent, labelProps));
385
386
  }
386
387
 
387
- return memo;
388
+ return newMemo;
388
389
  }, []);
389
390
  var dataProps = this.getComponentProps(dataComponent, "data", "all");
390
391
  var children = [/*#__PURE__*/React.cloneElement(dataComponent, dataProps)].concat(_toConsumableArray(labelComponents));
@@ -46,11 +46,11 @@ export function getAxis(props) {
46
46
  */
47
47
 
48
48
  export function findAxisComponents(childComponents, predicate) {
49
- predicate = predicate || _identity;
49
+ var predicateFunction = predicate || _identity;
50
50
 
51
51
  var findAxes = function (children) {
52
52
  return children.reduce(function (memo, child) {
53
- if (child.type && child.type.role === "axis" && predicate(child)) {
53
+ if (child.type && child.type.role === "axis" && predicateFunction(child)) {
54
54
  return memo.concat(child);
55
55
  } else if (child.props && child.props.children) {
56
56
  return memo.concat(findAxes(React.Children.toArray(child.props.children)));
@@ -20,6 +20,7 @@ export interface VictoryCommonThemeProps {
20
20
  animate?: boolean | AnimatePropTypeInterface;
21
21
  colorScale?: ColorScalePropType;
22
22
  containerComponent?: React.ReactElement;
23
+ disableInlineStyles?: boolean;
23
24
  domainPadding?: DomainPaddingPropType;
24
25
  externalEventMutations?: EventCallbackInterface<string | string[], StringOrNumberOrList>[];
25
26
  groupComponent?: React.ReactElement;
@@ -66,12 +66,14 @@ function sortData(dataset, sortKey) {
66
66
  } // Ensures previous VictoryLine api for sortKey prop stays consistent
67
67
 
68
68
 
69
+ var formattedSortKey = sortKey;
70
+
69
71
  if (sortKey === "x" || sortKey === "y") {
70
- sortKey = "_".concat(sortKey);
72
+ formattedSortKey = "_".concat(sortKey);
71
73
  }
72
74
 
73
75
  var order = sortOrder === "ascending" ? "asc" : "desc";
74
- return _orderBy(dataset, sortKey, order);
76
+ return _orderBy(dataset, formattedSortKey, order);
75
77
  } // This method will remove data points that break certain scales. (log scale only)
76
78
 
77
79
 
@@ -262,7 +264,10 @@ export function formatData(dataset, props, expectedKeys) {
262
264
  return [];
263
265
  }
264
266
 
265
- var defaultKeys = ["x", "y", "y0"];
267
+ var defaultKeys = ["x", "y", "y0"]; // TODO: We shouldn’t mutate the expectedKeys param here,
268
+ // but we need to figure out why changing it causes regressions in tests.
269
+ // eslint-disable-next-line no-param-reassign
270
+
266
271
  expectedKeys = Array.isArray(expectedKeys) ? expectedKeys : defaultKeys;
267
272
 
268
273
  var createAccessor = function (name) {
@@ -287,13 +292,13 @@ export function formatData(dataset, props, expectedKeys) {
287
292
 
288
293
  var data = preformattedData ? dataset : dataset.reduce(function (dataArr, datum, index) {
289
294
  // eslint-disable-line complexity
290
- datum = parseDatum(datum);
295
+ var parsedDatum = parseDatum(datum);
291
296
  var fallbackValues = {
292
297
  x: index,
293
- y: datum
298
+ y: parsedDatum
294
299
  };
295
300
  var processedValues = expectedKeys.reduce(function (memo, type) {
296
- var processedValue = accessor[type](datum);
301
+ var processedValue = accessor[type](parsedDatum);
297
302
  var value = processedValue !== undefined ? processedValue : fallbackValues[type];
298
303
 
299
304
  if (value !== undefined) {
@@ -308,7 +313,7 @@ export function formatData(dataset, props, expectedKeys) {
308
313
  return memo;
309
314
  }, {});
310
315
 
311
- var formattedDatum = _assign({}, processedValues, datum);
316
+ var formattedDatum = _assign({}, processedValues, parsedDatum);
312
317
 
313
318
  if (!_isEmpty(formattedDatum)) {
314
319
  dataArr.push(formattedDatum);
@@ -419,8 +424,8 @@ export function getStringsFromData(props, axis) {
419
424
  }, []);
420
425
  var sortedData = sortData(data, props.sortKey, props.sortOrder);
421
426
  var dataStrings = sortedData.reduce(function (dataArr, datum) {
422
- datum = parseDatum(datum);
423
- dataArr.push(accessor(datum));
427
+ var parsedDatum = parseDatum(datum);
428
+ dataArr.push(accessor(parsedDatum));
424
429
  return dataArr;
425
430
  }, []).filter(function (datum) {
426
431
  return typeof datum === "string";
@@ -164,18 +164,18 @@ function padDomain(domain, props, axis) {
164
164
 
165
165
 
166
166
  export function createDomainFunction(getDomainFromDataFunction, formatDomainFunction) {
167
- getDomainFromDataFunction = _isFunction(getDomainFromDataFunction) ? getDomainFromDataFunction : getDomainFromData;
168
- formatDomainFunction = _isFunction(formatDomainFunction) ? formatDomainFunction : formatDomain;
167
+ var getDomainFromDataFn = _isFunction(getDomainFromDataFunction) ? getDomainFromDataFunction : getDomainFromData;
168
+ var formatDomainFn = _isFunction(formatDomainFunction) ? formatDomainFunction : formatDomain;
169
169
  return function (props, axis) {
170
170
  var propsDomain = getDomainFromProps(props, axis);
171
171
 
172
172
  if (propsDomain) {
173
- return formatDomainFunction(propsDomain, props, axis);
173
+ return formatDomainFn(propsDomain, props, axis);
174
174
  }
175
175
 
176
176
  var categories = Data.getCategories(props, axis);
177
- var domain = categories ? getDomainFromCategories(props, axis, categories) : getDomainFromDataFunction(props, axis);
178
- return domain ? formatDomainFunction(domain, props, axis) : undefined;
177
+ var domain = categories ? getDomainFromCategories(props, axis, categories) : getDomainFromDataFn(props, axis);
178
+ return domain ? formatDomainFn(domain, props, axis) : undefined;
179
179
  };
180
180
  }
181
181
  /**
@@ -208,27 +208,27 @@ export function getDomain(props, axis) {
208
208
  */
209
209
 
210
210
  export function getDomainFromCategories(props, axis, categories) {
211
- categories = categories || Data.getCategories(props, axis);
211
+ var categoriesArray = categories || Data.getCategories(props, axis);
212
212
  var polar = props.polar,
213
213
  _props$startAngle = props.startAngle,
214
214
  startAngle = _props$startAngle === void 0 ? 0 : _props$startAngle,
215
215
  _props$endAngle = props.endAngle,
216
216
  endAngle = _props$endAngle === void 0 ? 360 : _props$endAngle;
217
217
 
218
- if (!categories) {
218
+ if (!categoriesArray) {
219
219
  return undefined;
220
220
  }
221
221
 
222
222
  var minDomain = getMinFromProps(props, axis);
223
223
  var maxDomain = getMaxFromProps(props, axis);
224
- var stringArray = Collection.containsStrings(categories) ? Data.getStringsFromCategories(props, axis) : [];
224
+ var stringArray = Collection.containsStrings(categoriesArray) ? Data.getStringsFromCategories(props, axis) : [];
225
225
  var stringMap = stringArray.length === 0 ? null : stringArray.reduce(function (memo, string, index) {
226
226
  memo[string] = index + 1;
227
227
  return memo;
228
228
  }, {});
229
- var categoryValues = stringMap ? categories.map(function (value) {
229
+ var categoryValues = stringMap ? categoriesArray.map(function (value) {
230
230
  return stringMap[value];
231
- }) : categories;
231
+ }) : categoriesArray;
232
232
  var min = minDomain !== undefined ? minDomain : Collection.getMinValue(categoryValues);
233
233
  var max = maxDomain !== undefined ? maxDomain : Collection.getMaxValue(categoryValues);
234
234
  var categoryDomain = getDomainFromMinMax(min, max);
@@ -243,7 +243,7 @@ export function getDomainFromCategories(props, axis, categories) {
243
243
  */
244
244
 
245
245
  export function getDomainFromData(props, axis, dataset) {
246
- dataset = dataset || Data.getData(props);
246
+ var datasetArray = dataset || Data.getData(props);
247
247
  var polar = props.polar,
248
248
  _props$startAngle2 = props.startAngle,
249
249
  startAngle = _props$startAngle2 === void 0 ? 0 : _props$startAngle2,
@@ -252,14 +252,14 @@ export function getDomainFromData(props, axis, dataset) {
252
252
  var minDomain = getMinFromProps(props, axis);
253
253
  var maxDomain = getMaxFromProps(props, axis);
254
254
 
255
- if (dataset.length < 1) {
255
+ if (datasetArray.length < 1) {
256
256
  return minDomain !== undefined && maxDomain !== undefined ? getDomainFromMinMax(minDomain, maxDomain) : undefined;
257
257
  }
258
258
 
259
- var min = minDomain !== undefined ? minDomain : getExtremeFromData(dataset, axis, "min");
260
- var max = maxDomain !== undefined ? maxDomain : getExtremeFromData(dataset, axis, "max");
259
+ var min = minDomain !== undefined ? minDomain : getExtremeFromData(datasetArray, axis, "min");
260
+ var max = maxDomain !== undefined ? maxDomain : getExtremeFromData(datasetArray, axis, "max");
261
261
  var domain = getDomainFromMinMax(min, max);
262
- return polar && axis === "x" && Math.abs(startAngle - endAngle) === 360 ? getSymmetricDomain(domain, getFlatData(dataset, axis)) : domain;
262
+ return polar && axis === "x" && Math.abs(startAngle - endAngle) === 360 ? getSymmetricDomain(domain, getFlatData(datasetArray, axis)) : domain;
263
263
  }
264
264
  /**
265
265
  * Returns a domain in the form of a two element array given a min and max value.
@@ -16,7 +16,7 @@ interface ComponentWithEvents extends EventMixinCalculatedValues {
16
16
  state: any;
17
17
  setState: any;
18
18
  }
19
- export declare function getEvents(this: ComponentWithEvents, props: any, target: any, eventKey: any, getScopedEvents: any): any;
19
+ export declare function getEvents(this: ComponentWithEvents, props: any, target?: any, eventKey?: any, getScopedEvents?: any): any;
20
20
  export declare function getScopedEvents(this: ComponentWithEvents, events: any, namespace: any, childType: any, baseProps: any): {};
21
21
  export declare function getPartialEvents(events: ComponentEventHandlers, eventKey: ComponentEventKey, childProps: unknown): PartialEvents;
22
22
  export interface PartialEvents {
@@ -33,7 +33,7 @@ export declare function getEventState(this: ComponentWithEvents, eventKey: Compo
33
33
  *
34
34
  * @return {Object} a object describing all mutations for VictorySharedEvents
35
35
  */
36
- export declare function getExternalMutationsWithChildren(mutations: any, baseProps: any, baseState: any, childNames: any): any;
36
+ export declare function getExternalMutationsWithChildren(mutations: any, baseProps: {} | undefined, baseState: {} | undefined, childNames: any): any;
37
37
  /**
38
38
  * Returns a set of all mutations for a component
39
39
  *
@@ -44,7 +44,7 @@ export declare function getExternalMutationsWithChildren(mutations: any, basePro
44
44
  *
45
45
  * @return {Object} a object describing mutations for a given component
46
46
  */
47
- export declare function getExternalMutations(mutations: any, baseProps: any, baseState: any, childName?: any): {};
47
+ export declare function getExternalMutations(mutations: any, baseProps?: {}, baseState?: {}, childName?: any): {};
48
48
  /**
49
49
  * Returns a set of mutations for a particular element given scoped baseProps and baseState
50
50
  *