victory-core 36.5.3 → 36.6.2

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 (107) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/victory-core.js +5305 -4728
  3. package/dist/victory-core.min.js +1 -1
  4. package/es/index.d.ts +2 -1
  5. package/es/types/callbacks.d.ts +2 -1
  6. package/es/victory-animation/victory-animation.js +1 -1
  7. package/es/victory-label/victory-label.d.ts +4 -8
  8. package/es/victory-label/victory-label.js +19 -19
  9. package/es/victory-portal/portal.js +2 -2
  10. package/es/victory-primitives/arc.js +1 -1
  11. package/es/victory-primitives/circle.d.ts +1 -0
  12. package/es/victory-primitives/line.d.ts +1 -0
  13. package/es/victory-primitives/path.d.ts +1 -0
  14. package/es/victory-primitives/rect.d.ts +1 -0
  15. package/es/victory-primitives/tspan.d.ts +1 -0
  16. package/es/victory-state/victory-provider.d.ts +1 -0
  17. package/es/victory-transition/victory-transition.js +22 -22
  18. package/es/victory-util/add-events.d.ts +30 -9
  19. package/es/victory-util/add-events.js +4 -5
  20. package/es/victory-util/axis.js +22 -20
  21. package/es/victory-util/collection.d.ts +2 -2
  22. package/es/victory-util/data.d.ts +1 -1
  23. package/es/victory-util/data.js +2 -2
  24. package/es/victory-util/domain.js +4 -4
  25. package/es/victory-util/events.d.ts +1 -1
  26. package/es/victory-util/events.js +2 -2
  27. package/es/victory-util/helpers.d.ts +2 -1
  28. package/es/victory-util/hooks/use-animation-state.d.ts +22 -0
  29. package/es/victory-util/hooks/use-animation-state.js +2 -2
  30. package/es/victory-util/label-helpers.js +12 -12
  31. package/es/victory-util/prop-types.js +2 -2
  32. package/es/victory-util/scale.js +1 -1
  33. package/es/victory-util/selection.d.ts +6 -2
  34. package/es/victory-util/selection.js +16 -16
  35. package/es/victory-util/style.js +12 -12
  36. package/es/victory-util/textsize.js +2 -2
  37. package/es/victory-util/transitions.js +2 -2
  38. package/es/victory-util/user-props.d.ts +1 -1
  39. package/es/victory-util/user-props.js +3 -1
  40. package/es/victory-util/with-container.d.ts +2 -2
  41. package/es/victory-util/with-container.js +2 -1
  42. package/es/victory-util/wrapper.d.ts +1 -1
  43. package/es/victory-util/wrapper.js +8 -8
  44. package/lib/index.d.ts +2 -1
  45. package/lib/types/callbacks.d.ts +2 -1
  46. package/lib/victory-label/victory-label.d.ts +4 -8
  47. package/lib/victory-label/victory-label.js +19 -19
  48. package/lib/victory-portal/portal.js +2 -2
  49. package/lib/victory-primitives/circle.d.ts +1 -0
  50. package/lib/victory-primitives/line.d.ts +1 -0
  51. package/lib/victory-primitives/path.d.ts +1 -0
  52. package/lib/victory-primitives/rect.d.ts +1 -0
  53. package/lib/victory-primitives/tspan.d.ts +1 -0
  54. package/lib/victory-state/victory-provider.d.ts +1 -0
  55. package/lib/victory-transition/victory-transition.js +21 -21
  56. package/lib/victory-util/add-events.d.ts +30 -9
  57. package/lib/victory-util/add-events.js +4 -4
  58. package/lib/victory-util/axis.js +22 -20
  59. package/lib/victory-util/collection.d.ts +2 -2
  60. package/lib/victory-util/data.d.ts +1 -1
  61. package/lib/victory-util/data.js +2 -2
  62. package/lib/victory-util/domain.js +4 -4
  63. package/lib/victory-util/events.d.ts +1 -1
  64. package/lib/victory-util/events.js +2 -2
  65. package/lib/victory-util/helpers.d.ts +2 -1
  66. package/lib/victory-util/hooks/use-animation-state.d.ts +22 -0
  67. package/lib/victory-util/hooks/use-animation-state.js +2 -2
  68. package/lib/victory-util/label-helpers.js +12 -12
  69. package/lib/victory-util/prop-types.js +2 -2
  70. package/lib/victory-util/scale.js +1 -1
  71. package/lib/victory-util/selection.d.ts +6 -2
  72. package/lib/victory-util/selection.js +21 -17
  73. package/lib/victory-util/style.js +12 -12
  74. package/lib/victory-util/textsize.js +2 -2
  75. package/lib/victory-util/transitions.js +2 -2
  76. package/lib/victory-util/user-props.d.ts +1 -1
  77. package/lib/victory-util/user-props.js +3 -1
  78. package/lib/victory-util/with-container.d.ts +2 -2
  79. package/lib/victory-util/with-container.js +5 -3
  80. package/lib/victory-util/wrapper.d.ts +1 -1
  81. package/lib/victory-util/wrapper.js +8 -8
  82. package/package.json +261 -7
  83. package/src/index.ts +2 -4
  84. package/src/types/callbacks.ts +3 -1
  85. package/src/victory-animation/victory-animation.tsx +1 -1
  86. package/src/victory-label/victory-label.tsx +24 -28
  87. package/src/victory-primitives/arc.tsx +1 -1
  88. package/src/victory-transition/victory-transition.tsx +24 -26
  89. package/src/victory-util/add-events.tsx +59 -15
  90. package/src/victory-util/axis.tsx +12 -13
  91. package/src/victory-util/collection.tsx +13 -4
  92. package/src/victory-util/data.ts +2 -3
  93. package/src/victory-util/domain.ts +6 -6
  94. package/src/victory-util/events.ts +3 -3
  95. package/src/victory-util/helpers.ts +5 -1
  96. package/src/victory-util/hooks/{use-animation-state.js → use-animation-state.ts} +23 -8
  97. package/src/victory-util/label-helpers.ts +8 -12
  98. package/src/victory-util/point-path-helpers.ts +1 -1
  99. package/src/victory-util/prop-types.ts +1 -2
  100. package/src/victory-util/scale.ts +1 -1
  101. package/src/victory-util/selection.ts +15 -14
  102. package/src/victory-util/style.ts +10 -11
  103. package/src/victory-util/textsize.ts +3 -3
  104. package/src/victory-util/transitions.ts +1 -2
  105. package/src/victory-util/user-props.ts +2 -1
  106. package/src/victory-util/with-container.tsx +4 -7
  107. package/src/victory-util/wrapper.tsx +9 -11
@@ -206,20 +206,20 @@ function getDefaultTickFormat(props) {
206
206
  return stringTicks(props) ? function (x, index) {
207
207
  return tickValues[index];
208
208
  } : fallbackFormat;
209
- } else {
210
- var invertedStringMap = stringMap && (0, _invert2.default)(stringMap);
211
- var tickValueArray = (0, _orderBy2.default)((0, _values2.default)(stringMap), function (n) {
212
- return n;
213
- });
214
- var dataNames = tickValueArray.map(function (tick) {
215
- return invertedStringMap[tick];
216
- }); // string ticks should have one tick of padding at the beginning
217
-
218
- var dataTicks = [""].concat(_toConsumableArray(dataNames), [""]);
219
- return function (x) {
220
- return dataTicks[x];
221
- };
222
209
  }
210
+
211
+ var invertedStringMap = stringMap && (0, _invert2.default)(stringMap);
212
+ var tickValueArray = (0, _orderBy2.default)((0, _values2.default)(stringMap), function (n) {
213
+ return n;
214
+ });
215
+ var dataNames = tickValueArray.map(function (tick) {
216
+ return invertedStringMap[tick];
217
+ }); // string ticks should have one tick of padding at the beginning
218
+
219
+ var dataTicks = [""].concat(_toConsumableArray(dataNames), [""]);
220
+ return function (x) {
221
+ return dataTicks[x];
222
+ };
223
223
  }
224
224
 
225
225
  function getStringTicks(props) {
@@ -284,7 +284,9 @@ function getTickArray(props) {
284
284
  }
285
285
  });
286
286
  return newTickArray;
287
- } else return undefined;
287
+ }
288
+
289
+ return undefined;
288
290
  };
289
291
 
290
292
  return Array.isArray(tickArray) && tickArray.length ? buildTickArray(tickArray) : undefined;
@@ -325,11 +327,11 @@ function getTickFormat(props, scale) {
325
327
  };
326
328
 
327
329
  return stringMap ? applyStringTicks : tickFormat;
328
- } else {
329
- return function (x) {
330
- return x;
331
- };
332
330
  }
331
+
332
+ return function (x) {
333
+ return x;
334
+ };
333
335
  }
334
336
 
335
337
  function downsampleTicks(ticks, tickCount) {
@@ -376,7 +378,7 @@ function getTicks(props, scale) {
376
378
  * @param {String} axis: either x or y
377
379
  * @returns {Array} returns a domain from tickValues
378
380
  */
379
- //eslint-disable-next-line max-statements
381
+ // eslint-disable-next-line max-statements
380
382
 
381
383
 
382
384
  function getDomainFromData(props, axis) {
@@ -398,7 +400,7 @@ function getDomainFromData(props, axis) {
398
400
  var maxDomain = Domain.getMaxFromProps(props, axis);
399
401
  var tickStrings = stringTicks(props);
400
402
  var ticks = tickValues.map(function (value) {
401
- return +value;
403
+ return Number(value);
402
404
  });
403
405
  var defaultMin = tickStrings ? 1 : Collection.getMinValue(ticks);
404
406
  var defaultMax = tickStrings ? tickValues.length : Collection.getMaxValue(ticks);
@@ -1,8 +1,8 @@
1
1
  export declare function containsStrings<T>(collection: Array<T>): boolean;
2
2
  export declare function containsDates(collection: Array<number | Date>): boolean;
3
3
  export declare function containsNumbers(collection: any): boolean;
4
- export declare function containsOnlyStrings(collection: any): any;
5
- export declare function isArrayOfArrays(collection: any): any;
4
+ export declare function containsOnlyStrings(collection: Array<string> | unknown): collection is Array<string>;
5
+ export declare function isArrayOfArrays<T>(collection: Array<T> | Array<Array<T>> | unknown): collection is Array<Array<T>>;
6
6
  export declare function removeUndefined(arr: any): any;
7
7
  export declare function getMaxValue(arr: Array<number | Date>, ...values: Array<number | Date>): number | Date;
8
8
  export declare function getMinValue(arr: Array<number | Date>, ...values: Array<number | Date>): number | Date;
@@ -1,4 +1,4 @@
1
- export declare function formatDataFromDomain(dataset: any, domain: any, defaultBaseline: any): any;
1
+ export declare function formatDataFromDomain(dataset: any, domain: any, defaultBaseline?: any): any;
2
2
  /**
3
3
  * Returns an object mapping string data to numeric data
4
4
  * @param {Object} props: the props object
@@ -178,9 +178,9 @@ function addEventKeys(props, data) {
178
178
  return eventKey !== undefined ? (0, _assign2.default)({
179
179
  eventKey: eventKey
180
180
  }, datum) : datum;
181
- } else {
182
- return datum;
183
181
  }
182
+
183
+ return datum;
184
184
  });
185
185
  } // Exported Functions
186
186
  // This method will remove data points that fall outside of the desired domain (non-continuous charts only)
@@ -112,7 +112,7 @@ function getExtremeFromData(dataset, axis) {
112
112
  return getExtreme([memo, current]);
113
113
  }, initialValue);
114
114
  return containsDate ? new Date(result) : result;
115
- } //eslint-disable-next-line max-statements
115
+ } // eslint-disable-next-line max-statements
116
116
 
117
117
 
118
118
  function padDomain(domain, props, axis) {
@@ -310,12 +310,12 @@ function getDomainFromMinMax(min, max) {
310
310
  var verySmallNumber = // eslint-disable-next-line no-magic-numbers
311
311
  val === 0 ? 2 * Math.pow(10, -10) : Math.pow(10, -10);
312
312
  var verySmallDate = 1;
313
- var minVal = val instanceof Date ? new Date(+val - verySmallDate) : +val - verySmallNumber;
314
- var maxVal = val instanceof Date ? new Date(+val + verySmallDate) : +val + verySmallNumber;
313
+ var minVal = val instanceof Date ? new Date(Number(val) - verySmallDate) : Number(val) - verySmallNumber;
314
+ var maxVal = val instanceof Date ? new Date(Number(val) + verySmallDate) : Number(val) + verySmallNumber;
315
315
  return val === 0 ? [0, maxVal] : [minVal, maxVal];
316
316
  };
317
317
 
318
- return +min === +max ? getSinglePointDomain(max) : [min, max];
318
+ return Number(min) === Number(max) ? getSinglePointDomain(max) : [min, max];
319
319
  }
320
320
  /**
321
321
  * Returns a the domain for a given axis if domain is given in props
@@ -6,7 +6,7 @@ export interface ComponentEvent {
6
6
  eventKey?: ComponentEventKey | ComponentEventKey[];
7
7
  eventHandlers: ComponentEventHandlers;
8
8
  }
9
- export declare type ComponentEventName = `on${Capitalize<string>}`;
9
+ export declare type ComponentEventName = string;
10
10
  export interface ComponentEventHandlers {
11
11
  [k: ComponentEventName]: ComponentEventHandler;
12
12
  }
@@ -416,9 +416,9 @@ function getExternalMutation(mutations, baseProps, baseState, identifier) {
416
416
  return "".concat(m);
417
417
  });
418
418
  return (0, _includes2.default)(stringArray, identifier[type]);
419
- } else {
420
- return false;
421
419
  }
420
+
421
+ return false;
422
422
  };
423
423
 
424
424
  mutations = Array.isArray(mutations) ? mutations : [mutations];
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { CallbackArgs, ValueOrCallback } from "../types/callbacks";
2
3
  /**
3
4
  * creates an object with some keys excluded
4
5
  * replacement for lodash.omit for performance. does not mimic the entire lodash.omit api
@@ -23,7 +24,7 @@ export declare function getPadding(props: any, name?: string): {
23
24
  export declare function isTooltip(component: any): boolean;
24
25
  export declare function getDefaultStyles(props: any, role: any): any;
25
26
  export declare function getStyles(style: any, defaultStyles: any): any;
26
- export declare function evaluateProp(prop: any, props: any): any;
27
+ export declare function evaluateProp<TValue>(prop: ValueOrCallback<TValue>, props: CallbackArgs): TValue;
27
28
  export declare function evaluateStyle(style: any, props: any): any;
28
29
  export declare function degreesToRadians(degrees: any): any;
29
30
  export declare function radiansToDegrees(radians: any): any;
@@ -0,0 +1,22 @@
1
+ declare type AnyObject = Record<string, any>;
2
+ export declare type AnimationState = {
3
+ nodesShouldLoad?: boolean;
4
+ nodesDoneLoad?: boolean;
5
+ animating?: boolean;
6
+ childrenTransitions?: any[];
7
+ nodesWillExit?: boolean;
8
+ nodesWillEnter?: boolean;
9
+ nodesShouldEnter?: boolean;
10
+ oldProps?: AnyObject;
11
+ nextProps?: AnyObject;
12
+ continuous?: boolean;
13
+ };
14
+ export declare const useAnimationState: (initialState?: AnimationState) => {
15
+ state: AnimationState;
16
+ setState: (newState: AnimationState) => void;
17
+ getAnimationProps: (props: AnyObject | undefined, child: any, index: any) => any;
18
+ setAnimationState: (props: AnyObject | undefined, nextProps: any) => void;
19
+ getProps: (initialProps: AnyObject) => AnyObject;
20
+ };
21
+ export {};
22
+ //# sourceMappingURL=use-animation-state.d.ts.map
@@ -96,7 +96,7 @@ var useAnimationState = function () {
96
96
 
97
97
 
98
98
  var setAnimationState = _react.default.useCallback(function (props, nextProps) {
99
- if (!props || !props.animate) {
99
+ if (!(props !== null && props !== void 0 && props.animate)) {
100
100
  return;
101
101
  }
102
102
 
@@ -136,7 +136,7 @@ var useAnimationState = function () {
136
136
  nodesWillEnter: nodesWillEnter,
137
137
  nodesShouldEnter: nodesShouldEnter,
138
138
  childrenTransitions: Collection.isArrayOfArrays(childrenTransitions) ? childrenTransitions[0] : childrenTransitions,
139
- oldProps: _nodesWillExit ? props : null,
139
+ oldProps: _nodesWillExit ? props : undefined,
140
140
  nextProps: nextProps,
141
141
  continuous: continuous
142
142
  });
@@ -31,9 +31,9 @@ function getVerticalAnchor(props, datum) {
31
31
  return datum.verticalAnchor || labelStyle.verticalAnchor;
32
32
  } else if (!props.horizontal) {
33
33
  return sign >= 0 ? "end" : "start";
34
- } else {
35
- return "middle";
36
34
  }
35
+
36
+ return "middle";
37
37
  }
38
38
 
39
39
  function getTextAnchor(props, datum) {
@@ -47,9 +47,9 @@ function getTextAnchor(props, datum) {
47
47
  return datum.verticalAnchor || labelStyle.verticalAnchor;
48
48
  } else if (!horizontal) {
49
49
  return "middle";
50
- } else {
51
- return sign >= 0 ? "start" : "end";
52
50
  }
51
+
52
+ return sign >= 0 ? "start" : "end";
53
53
  }
54
54
 
55
55
  function getAngle(props, datum) {
@@ -95,13 +95,13 @@ function getPosition(props, datum) {
95
95
  x: x,
96
96
  y: y
97
97
  };
98
- } else {
99
- var polarPadding = getPolarPadding(props, datum);
100
- return {
101
- x: x + polarPadding.x,
102
- y: y + polarPadding.y
103
- };
104
98
  }
99
+
100
+ var polarPadding = getPolarPadding(props, datum);
101
+ return {
102
+ x: x + polarPadding.x,
103
+ y: y + polarPadding.y
104
+ };
105
105
  }
106
106
 
107
107
  function getPolarPadding(props, datum) {
@@ -132,9 +132,9 @@ function getPolarOrientation(degrees) {
132
132
  return "top"; // eslint-disable-next-line no-magic-numbers
133
133
  } else if (degrees > 135 && degrees < 225) {
134
134
  return "left";
135
- } else {
136
- return "bottom";
137
135
  }
136
+
137
+ return "bottom";
138
138
  } // Exported Functions
139
139
 
140
140
 
@@ -79,9 +79,9 @@ var getConstructor = function (value) {
79
79
  return undefinedConstructor;
80
80
  } else if (value === null) {
81
81
  return nullConstructor;
82
- } else {
83
- return value.constructor;
84
82
  }
83
+
84
+ return value.constructor;
85
85
  };
86
86
  /**
87
87
  * Get the name of the constructor used to create `value`, using
@@ -55,7 +55,7 @@ function isScaleDefined(props, axis) {
55
55
  if (!props.scale) {
56
56
  return false;
57
57
  } else if (props.scale.x || props.scale.y) {
58
- return props.scale[axis] ? true : false;
58
+ return !!props.scale[axis];
59
59
  }
60
60
 
61
61
  return true;
@@ -1,9 +1,12 @@
1
1
  import React from "react";
2
- import { VictoryCommonProps } from "./index";
2
+ import { VictoryCommonProps } from "./common-props";
3
3
  import type { DomainPropType, ScaleXYPropType } from "../types/prop-types";
4
4
  export declare function getParentSVG(evt: Pick<React.SyntheticEvent, "target"> & Partial<Pick<React.SyntheticEvent, "nativeEvent">>): SVGElement;
5
5
  export declare function getSVGEventCoordinates(evt: React.SyntheticEvent, svg?: SVGElement): SVGCoordinateType;
6
- export declare function getDomainCoordinates(props: Pick<VictoryCommonProps, "scale" | "horizontal">, domain?: DomainPropType): DomainPropType;
6
+ export declare function getDomainCoordinates(props: Pick<VictoryCommonProps, "scale" | "horizontal">, domain?: DomainPropType): {
7
+ x: number[];
8
+ y: number[];
9
+ };
7
10
  export declare function getDataCoordinates(props: any, scale: ScaleXYPropType, x: number, y: number): SVGCoordinateType;
8
11
  export declare function getBounds(props: ComputedCommonProps): SVGCoordinateBounds;
9
12
  export declare type SVGCoordinateType = {
@@ -20,6 +23,7 @@ declare type ComputedCommonProps = {
20
23
  x2: number;
21
24
  y1: number;
22
25
  y2: number;
26
+ horizontal?: boolean;
23
27
  };
24
28
  export {};
25
29
  //# sourceMappingURL=selection.d.ts.map
@@ -9,7 +9,11 @@ exports.getDomainCoordinates = getDomainCoordinates;
9
9
  exports.getParentSVG = getParentSVG;
10
10
  exports.getSVGEventCoordinates = getSVGEventCoordinates;
11
11
 
12
- var _index = require("./index");
12
+ var Collection = _interopRequireWildcard(require("./collection"));
13
+
14
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
+
16
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
17
 
14
18
  // Private Functions
15
19
  function transformTarget(target, matrix, dimension) {
@@ -42,9 +46,9 @@ function getParentSVG(evt) {
42
46
  var getParent = function (target) {
43
47
  if (target.nodeName === "svg") {
44
48
  return target;
45
- } else {
46
- return target.parentNode ? getParent(target.parentNode) : target;
47
49
  }
50
+
51
+ return target.parentNode ? getParent(target.parentNode) : target;
48
52
  };
49
53
 
50
54
  return getParent(evt.target);
@@ -93,20 +97,20 @@ function getDataCoordinates(props, scale, x, y) {
93
97
  x: horizontal ? scale.x.invert(y) : scale.x.invert(x),
94
98
  y: horizontal ? scale.y.invert(x) : scale.y.invert(y)
95
99
  };
96
- } else {
97
- var origin = props.origin || {
98
- x: 0,
99
- y: 0
100
- };
101
- var baseX = x - origin.x;
102
- var baseY = y - origin.y;
103
- var radius = Math.abs(baseX * Math.sqrt(1 + Math.pow(-baseY / baseX, 2)));
104
- var angle = (-Math.atan2(baseY, baseX) + Math.PI * 2) % (Math.PI * 2);
105
- return {
106
- x: scale.x.invert(angle),
107
- y: scale.y.invert(radius)
108
- };
109
100
  }
101
+
102
+ var origin = props.origin || {
103
+ x: 0,
104
+ y: 0
105
+ };
106
+ var baseX = x - origin.x;
107
+ var baseY = y - origin.y;
108
+ var radius = Math.abs(baseX * Math.sqrt(1 + Math.pow(-baseY / baseX, 2)));
109
+ var angle = (-Math.atan2(baseY, baseX) + Math.PI * 2) % (Math.PI * 2);
110
+ return {
111
+ x: scale.x.invert(angle),
112
+ y: scale.y.invert(radius)
113
+ };
110
114
  }
111
115
 
112
116
  function getBounds(props) {
@@ -119,7 +123,7 @@ function getBounds(props) {
119
123
  var point2 = getDataCoordinates(props, scale, x2, y2);
120
124
 
121
125
  var makeBound = function (a, b) {
122
- return [_index.Collection.getMinValue([a, b]), _index.Collection.getMaxValue([a, b])];
126
+ return [Collection.getMinValue([a, b]), Collection.getMaxValue([a, b])];
123
127
  };
124
128
 
125
129
  return {
@@ -24,22 +24,22 @@ var toTransformString = function (obj) {
24
24
  return more.reduce(function (memo, currentObj) {
25
25
  return [memo, toTransformString(currentObj)].join(" ");
26
26
  }, toTransformString(obj)).trim();
27
- } else {
28
- if (obj === undefined || obj === null || typeof obj === "string") {
29
- return obj;
30
- }
27
+ }
28
+
29
+ if (obj === undefined || obj === null || typeof obj === "string") {
30
+ return obj;
31
+ }
31
32
 
32
- var transforms = [];
33
+ var transforms = [];
33
34
 
34
- for (var key in obj) {
35
- if (obj.hasOwnProperty(key)) {
36
- var value = obj[key];
37
- transforms.push("".concat(key, "(").concat(value, ")"));
38
- }
35
+ for (var key in obj) {
36
+ if (obj.hasOwnProperty(key)) {
37
+ var value = obj[key];
38
+ transforms.push("".concat(key, "(").concat(value, ")"));
39
39
  }
40
-
41
- return transforms.join(" ").trim();
42
40
  }
41
+
42
+ return transforms.join(" ").trim();
43
43
  };
44
44
  /**
45
45
  * Given the name of a color scale, getColorScale will return an array
@@ -25,7 +25,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
25
25
 
26
26
  // Based on measuring specific character widths
27
27
  // as in the following example https://bl.ocks.org/tophtucker/62f93a4658387bb61e4510c37e2e97cf
28
- //prettier-ignore
28
+ // prettier-ignore
29
29
  var fonts = {
30
30
  "American Typewriter": {
31
31
  widths: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.25, 0.4203125, 0.3296875, 0.6, 0.6375, 0.8015625, 0.8203125, 0.1875, 0.45625, 0.45625, 0.6375, 0.5, 0.2734375, 0.309375, 0.2734375, 0.4390625, 0.6375, 0.6375, 0.6375, 0.6375, 0.6375, 0.6375, 0.6375, 0.6375, 0.6375, 0.6375, 0.2734375, 0.2734375, 0.5, 0.5, 0.5, 0.6, 0.6921875, 0.7640625, 0.6921875, 0.6375, 0.728125, 0.6734375, 0.6203125, 0.7109375, 0.784375, 0.3828125, 0.6421875, 0.7859375, 0.6375, 0.9484375, 0.7640625, 0.65625, 0.6375, 0.65625, 0.7296875, 0.6203125, 0.6375, 0.7109375, 0.740625, 0.940625, 0.784375, 0.7578125, 0.6203125, 0.4375, 0.5, 0.4375, 0.5, 0.5, 0.4921875, 0.5734375, 0.5890625, 0.5109375, 0.6, 0.528125, 0.43125, 0.5578125, 0.6375, 0.3109375, 0.40625, 0.6234375, 0.309375, 0.928125, 0.6375, 0.546875, 0.6, 0.58125, 0.4921875, 0.4921875, 0.4, 0.6203125, 0.625, 0.825, 0.6375, 0.640625, 0.528125, 0.5, 0.5, 0.5, 0.6671875],
@@ -131,7 +131,7 @@ var fonts = {
131
131
  widths: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.35, 0.39375, 0.459375, 0.81875, 0.6359375, 1.0765625, 0.759375, 0.26875, 0.4546875, 0.4546875, 0.6359375, 0.81875, 0.3640625, 0.4546875, 0.3640625, 0.4703125, 0.6359375, 0.6359375, 0.6359375, 0.6359375, 0.6359375, 0.6359375, 0.6359375, 0.6359375, 0.6359375, 0.6359375, 0.4546875, 0.4546875, 0.81875, 0.81875, 0.81875, 0.546875, 1, 0.684375, 0.6859375, 0.6984375, 0.771875, 0.6328125, 0.575, 0.7765625, 0.7515625, 0.421875, 0.4546875, 0.69375, 0.5578125, 0.84375, 0.7484375, 0.7875, 0.603125, 0.7875, 0.7, 0.684375, 0.6171875, 0.7328125, 0.684375, 0.9890625, 0.6859375, 0.615625, 0.6859375, 0.4546875, 0.46875, 0.4546875, 0.81875, 0.6421875, 0.6359375, 0.6015625, 0.6234375, 0.521875, 0.6234375, 0.596875, 0.384375, 0.6234375, 0.6328125, 0.275, 0.3765625, 0.5921875, 0.275, 0.9734375, 0.6328125, 0.6078125, 0.6234375, 0.6234375, 0.43125, 0.521875, 0.3953125, 0.6328125, 0.5921875, 0.81875, 0.5921875, 0.5921875, 0.5265625, 0.6359375, 0.4546875, 0.6359375, 0.81875],
132
132
  avg: 0.6171875000000003
133
133
  }
134
- }; //https://developer.mozilla.org/en/docs/Web/CSS/length
134
+ }; // https://developer.mozilla.org/en/docs/Web/CSS/length
135
135
  // Absolute sizes in pixels for obsolete measurement units.
136
136
 
137
137
  var absoluteMeasurementUnitsToPixels = {
@@ -357,9 +357,9 @@ function getTransitionPropsFactory(props, state, setState) {
357
357
  if (defaultTransitions) {
358
358
  var animationDuration = animate[type] && animate[type].duration;
359
359
  return animationDuration !== undefined ? animationDuration : defaultTransitions[type] && defaultTransitions[type].duration;
360
- } else {
361
- return {};
362
360
  }
361
+
362
+ return {};
363
363
  }; // eslint-disable-next-line max-statements, complexity, max-len
364
364
 
365
365
 
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- declare type SafeAttribute = `data-${string}` | `aria-${string}`;
2
+ declare type SafeAttribute = string;
3
3
  /**
4
4
  * getSafeUserProps - function that takes in a props object and removes any
5
5
  * key-value entries that do not match filter strings in the USER_PROPS_SAFELIST
@@ -38,7 +38,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
38
38
  var USER_PROPS_SAFELIST = {
39
39
  startsWith: ["data-", "aria-"],
40
40
  exactMatch: []
41
- };
41
+ }; // Normally we'd use Template Literal Types, but we're avoiding it to maximize TS compatibility with TS < 4.1
42
+
43
+ // `data-${string}` | `aria-${string}`;
42
44
 
43
45
  /**
44
46
  * doesPropStartWith: Function that takes a prop's key and runs it against all
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { VictoryProviderProps } from "victory-core";
2
+ import { VictoryProviderProps } from "../victory-state";
3
3
  import { VictoryCommonProps } from "./common-props";
4
- export declare function withContainer<Props extends VictoryCommonProps>(WrappedComponent: (props: Props) => React.ReactElement, initialProviderProps?: Partial<VictoryProviderProps>): (props: Props) => JSX.Element;
4
+ export declare function withContainer<Props extends VictoryCommonProps>(WrappedComponent: React.FC<Props>, initialProviderProps?: Partial<VictoryProviderProps>): React.FC<Props>;
5
5
  //# sourceMappingURL=with-container.d.ts.map
@@ -7,7 +7,9 @@ exports.withContainer = withContainer;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
10
- var _victoryCore = require("victory-core");
10
+ var _victoryState = require("../victory-state");
11
+
12
+ var _victoryContainer = require("../victory-container/victory-container");
11
13
 
12
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
15
 
@@ -32,10 +34,10 @@ function withContainer(WrappedComponent) {
32
34
  var _props$standalone = props.standalone,
33
35
  standalone = _props$standalone === void 0 ? true : _props$standalone,
34
36
  _props$containerCompo = props.containerComponent,
35
- containerComponent = _props$containerCompo === void 0 ? /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryContainer, null) : _props$containerCompo;
37
+ containerComponent = _props$containerCompo === void 0 ? /*#__PURE__*/_react.default.createElement(_victoryContainer.VictoryContainer, null) : _props$containerCompo;
36
38
 
37
39
  if (standalone) {
38
- return /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryProvider, providerProps, /*#__PURE__*/_react.default.cloneElement(containerComponent, providerProps, /*#__PURE__*/_react.default.createElement(WrappedComponent, props)));
40
+ return /*#__PURE__*/_react.default.createElement(_victoryState.VictoryProvider, providerProps, /*#__PURE__*/_react.default.cloneElement(containerComponent, providerProps, /*#__PURE__*/_react.default.createElement(WrappedComponent, props)));
39
41
  }
40
42
 
41
43
  return /*#__PURE__*/_react.default.createElement(WrappedComponent, props);
@@ -31,7 +31,7 @@ export declare function getStringsFromChildren(props: any, childComponents: any)
31
31
  x: any[];
32
32
  y: any[];
33
33
  };
34
- export declare function getCategories(props: any, childComponents: any, allStrings: any): {
34
+ export declare function getCategories(props: any, childComponents: any, allStrings?: any): {
35
35
  x: any;
36
36
  y: any;
37
37
  };
@@ -292,9 +292,9 @@ function getDomainFromChildren(props, axis, childComponents) {
292
292
  return null;
293
293
  } else if (child.type && (0, _isFunction2.default)(child.type.getDomain)) {
294
294
  return child.props && child.type.getDomain(sharedProps, axis);
295
- } else {
296
- return Domain.getDomain(sharedProps, axis);
297
295
  }
296
+
297
+ return Domain.getDomain(sharedProps, axis);
298
298
  };
299
299
 
300
300
  var childDomains = Helpers.reduceChildren(children, iteratee, props);
@@ -419,13 +419,13 @@ function getStringsFromCategories(childComponents, axis) {
419
419
 
420
420
  if (!Domain.isDomainComponent(child) || !childProps.categories) {
421
421
  return null;
422
- } else {
423
- var categories = childProps.categories && !Array.isArray(childProps.categories) ? childProps.categories[axis] : childProps.props.categories;
424
- var categoryStrings = categories && categories.filter(function (val) {
425
- return typeof val === "string";
426
- });
427
- return categoryStrings ? Collection.removeUndefined(categoryStrings) : [];
428
422
  }
423
+
424
+ var categories = childProps.categories && !Array.isArray(childProps.categories) ? childProps.categories[axis] : childProps.props.categories;
425
+ var categoryStrings = categories && categories.filter(function (val) {
426
+ return typeof val === "string";
427
+ });
428
+ return categoryStrings ? Collection.removeUndefined(categoryStrings) : [];
429
429
  };
430
430
 
431
431
  return Helpers.reduceChildren(childComponents.slice(0), iteratee);