victory-core 36.9.2 → 37.0.0

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 (110) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/victory-core.js +4371 -5749
  3. package/dist/victory-core.min.js +1 -1
  4. package/es/victory-accessible-group/victory-accessible-group.js +9 -15
  5. package/es/victory-animation/util.js +28 -47
  6. package/es/victory-animation/victory-animation.js +51 -67
  7. package/es/victory-clip-container/victory-clip-container.js +153 -229
  8. package/es/victory-container/victory-container.js +157 -216
  9. package/es/victory-label/victory-label.js +246 -323
  10. package/es/victory-portal/portal-context.js +1 -2
  11. package/es/victory-portal/portal.js +30 -76
  12. package/es/victory-portal/victory-portal.js +47 -104
  13. package/es/victory-primitives/arc.js +44 -47
  14. package/es/victory-primitives/background.js +14 -17
  15. package/es/victory-primitives/border.js +20 -24
  16. package/es/victory-primitives/circle.js +13 -27
  17. package/es/victory-primitives/clip-path.js +3 -7
  18. package/es/victory-primitives/line-segment.js +20 -24
  19. package/es/victory-primitives/line.js +13 -27
  20. package/es/victory-primitives/path.js +13 -27
  21. package/es/victory-primitives/point.js +36 -40
  22. package/es/victory-primitives/rect.js +13 -27
  23. package/es/victory-primitives/text.js +15 -28
  24. package/es/victory-primitives/tspan.js +13 -26
  25. package/es/victory-primitives/whisker.js +43 -47
  26. package/es/victory-theme/grayscale.js +22 -22
  27. package/es/victory-theme/material.js +46 -46
  28. package/es/victory-theme/victory-theme.js +3 -3
  29. package/es/victory-transition/victory-transition.js +126 -206
  30. package/es/victory-util/add-events.js +263 -374
  31. package/es/victory-util/axis.js +126 -222
  32. package/es/victory-util/collection.js +13 -41
  33. package/es/victory-util/data.js +159 -214
  34. package/es/victory-util/default-transitions.js +33 -51
  35. package/es/victory-util/domain.js +122 -171
  36. package/es/victory-util/events.js +168 -258
  37. package/es/victory-util/helpers.js +153 -178
  38. package/es/victory-util/hooks/use-animation-state.js +61 -99
  39. package/es/victory-util/hooks/use-previous-props.js +2 -2
  40. package/es/victory-util/immutable.js +6 -8
  41. package/es/victory-util/label-helpers.js +128 -130
  42. package/es/victory-util/line-helpers.js +29 -41
  43. package/es/victory-util/log.js +1 -1
  44. package/es/victory-util/point-path-helpers.js +89 -49
  45. package/es/victory-util/scale.js +24 -42
  46. package/es/victory-util/selection.js +39 -40
  47. package/es/victory-util/style.js +8 -13
  48. package/es/victory-util/textsize.js +80 -154
  49. package/es/victory-util/timer-context.js +2 -2
  50. package/es/victory-util/timer.js +40 -76
  51. package/es/victory-util/transitions.js +110 -150
  52. package/es/victory-util/type-helpers.js +2 -3
  53. package/es/victory-util/user-props.js +24 -49
  54. package/es/victory-util/wrapper.js +184 -247
  55. package/lib/index.js +0 -30
  56. package/lib/victory-accessible-group/victory-accessible-group.js +9 -19
  57. package/lib/victory-animation/util.js +28 -63
  58. package/lib/victory-animation/victory-animation.js +54 -83
  59. package/lib/victory-clip-container/victory-clip-container.js +156 -243
  60. package/lib/victory-container/victory-container.js +160 -232
  61. package/lib/victory-label/victory-label.js +248 -344
  62. package/lib/victory-portal/portal-context.js +1 -6
  63. package/lib/victory-portal/portal.js +31 -81
  64. package/lib/victory-portal/victory-portal.js +50 -116
  65. package/lib/victory-primitives/arc.js +48 -57
  66. package/lib/victory-primitives/background.js +16 -28
  67. package/lib/victory-primitives/border.js +22 -34
  68. package/lib/victory-primitives/circle.js +16 -36
  69. package/lib/victory-primitives/clip-path.js +3 -11
  70. package/lib/victory-primitives/index.js +0 -28
  71. package/lib/victory-primitives/line-segment.js +22 -34
  72. package/lib/victory-primitives/line.js +16 -36
  73. package/lib/victory-primitives/path.js +16 -36
  74. package/lib/victory-primitives/point.js +38 -52
  75. package/lib/victory-primitives/rect.js +16 -36
  76. package/lib/victory-primitives/text.js +15 -33
  77. package/lib/victory-primitives/tspan.js +13 -31
  78. package/lib/victory-primitives/whisker.js +45 -57
  79. package/lib/victory-theme/grayscale.js +23 -24
  80. package/lib/victory-theme/material.js +47 -48
  81. package/lib/victory-theme/victory-theme.js +2 -7
  82. package/lib/victory-transition/victory-transition.js +129 -224
  83. package/lib/victory-util/add-events.js +263 -380
  84. package/lib/victory-util/axis.js +128 -241
  85. package/lib/victory-util/collection.js +13 -50
  86. package/lib/victory-util/data.js +160 -239
  87. package/lib/victory-util/default-transitions.js +33 -54
  88. package/lib/victory-util/domain.js +123 -193
  89. package/lib/victory-util/events.js +167 -274
  90. package/lib/victory-util/helpers.js +156 -207
  91. package/lib/victory-util/hooks/index.js +0 -2
  92. package/lib/victory-util/hooks/use-animation-state.js +63 -113
  93. package/lib/victory-util/hooks/use-previous-props.js +2 -7
  94. package/lib/victory-util/immutable.js +6 -18
  95. package/lib/victory-util/index.js +2 -51
  96. package/lib/victory-util/label-helpers.js +130 -141
  97. package/lib/victory-util/line-helpers.js +31 -49
  98. package/lib/victory-util/log.js +1 -2
  99. package/lib/victory-util/point-path-helpers.js +91 -63
  100. package/lib/victory-util/scale.js +26 -57
  101. package/lib/victory-util/selection.js +41 -49
  102. package/lib/victory-util/style.js +8 -16
  103. package/lib/victory-util/textsize.js +80 -157
  104. package/lib/victory-util/timer-context.js +2 -8
  105. package/lib/victory-util/timer.js +40 -76
  106. package/lib/victory-util/transitions.js +110 -152
  107. package/lib/victory-util/type-helpers.js +2 -9
  108. package/lib/victory-util/user-props.js +25 -59
  109. package/lib/victory-util/wrapper.js +186 -281
  110. package/package.json +2 -2
@@ -27,57 +27,48 @@ exports.radiansToDegrees = radiansToDegrees;
27
27
  exports.range = range;
28
28
  exports.reduceChildren = reduceChildren;
29
29
  exports.scalePoint = scalePoint;
30
-
31
30
  var _pick2 = _interopRequireDefault(require("lodash/pick"));
32
-
33
31
  var _property2 = _interopRequireDefault(require("lodash/property"));
34
-
35
32
  var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
36
-
37
33
  var _react = _interopRequireWildcard(require("react"));
38
-
39
- 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); }
40
-
41
- 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; }
42
-
34
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
35
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
43
36
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
44
-
45
37
  /* eslint-disable no-use-before-define */
38
+
46
39
  // Private Functions
40
+
47
41
  function getCartesianRange(props, axis) {
48
42
  // determine how to lay the axis and what direction positive and negative are
49
- var vertical = axis !== "x";
50
- var padding = getPadding(props);
51
-
43
+ const vertical = axis !== "x";
44
+ const padding = getPadding(props);
52
45
  if (vertical) {
53
46
  return [props.height - padding.bottom, padding.top];
54
47
  }
55
-
56
48
  return [padding.left, props.width - padding.right];
57
49
  }
58
-
59
50
  function getPolarRange(props, axis) {
60
51
  if (axis === "x") {
61
- var startAngle = degreesToRadians(props.startAngle || 0);
62
- var endAngle = degreesToRadians(props.endAngle || 360);
52
+ const startAngle = degreesToRadians(props.startAngle || 0);
53
+ const endAngle = degreesToRadians(props.endAngle || 360);
63
54
  return [startAngle, endAngle];
64
55
  }
65
-
66
56
  return [props.innerRadius || 0, getRadius(props)];
67
- } // Exported Functions
57
+ }
58
+
59
+ // Exported Functions
68
60
 
69
61
  /**
70
62
  * Creates an object composed of the inverted keys and values of object.
71
63
  * If object contains duplicate values, subsequent values overwrite property assignments of previous values.
72
64
  */
73
-
74
-
75
65
  function invert(original) {
76
- return Object.entries(original).reduce(function (acc, current) {
66
+ return Object.entries(original).reduce((acc, current) => {
77
67
  acc[current[1]] = current[0];
78
68
  return acc;
79
69
  }, {});
80
70
  }
71
+
81
72
  /**
82
73
  * creates an object with some keys excluded
83
74
  * replacement for lodash.omit for performance. does not mimic the entire lodash.omit api
@@ -85,45 +76,39 @@ function invert(original) {
85
76
  * @param {Array<String>} ks: an array of keys to omit from the new object
86
77
  * @returns {Object} new object with same properties as originalObject
87
78
  */
88
-
89
-
90
- function omit(originalObject) {
91
- var ks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
79
+ function omit(originalObject, ks) {
80
+ if (ks === void 0) {
81
+ ks = [];
82
+ }
92
83
  // code based on babel's _objectWithoutProperties
93
- var newObject = {};
94
-
95
- for (var key in originalObject) {
84
+ const newObject = {};
85
+ for (const key in originalObject) {
96
86
  // @ts-expect-error String is not assignable to Key
97
87
  if (ks.indexOf(key) >= 0) {
98
88
  continue;
99
89
  }
100
-
101
90
  if (!Object.prototype.hasOwnProperty.call(originalObject, key)) {
102
91
  continue;
103
92
  }
104
-
105
93
  newObject[key] = originalObject[key];
106
94
  }
107
-
108
95
  return newObject;
109
96
  }
110
-
111
97
  function getPoint(datum) {
112
- var exists = function (val) {
113
- return val !== undefined;
114
- };
115
-
116
- var _x = datum._x,
117
- _x1 = datum._x1,
118
- _x0 = datum._x0,
119
- _voronoiX = datum._voronoiX,
120
- _y = datum._y,
121
- _y1 = datum._y1,
122
- _y0 = datum._y0,
123
- _voronoiY = datum._voronoiY;
124
- var defaultX = exists(_x1) ? _x1 : _x;
125
- var defaultY = exists(_y1) ? _y1 : _y;
126
- var point = {
98
+ const exists = val => val !== undefined;
99
+ const {
100
+ _x,
101
+ _x1,
102
+ _x0,
103
+ _voronoiX,
104
+ _y,
105
+ _y1,
106
+ _y0,
107
+ _voronoiY
108
+ } = datum;
109
+ const defaultX = exists(_x1) ? _x1 : _x;
110
+ const defaultY = exists(_y1) ? _y1 : _y;
111
+ const point = {
127
112
  x: exists(_voronoiX) ? _voronoiX : defaultX,
128
113
  x0: exists(_x0) ? _x0 : _x,
129
114
  y: exists(_voronoiY) ? _voronoiY : defaultY,
@@ -131,20 +116,21 @@ function getPoint(datum) {
131
116
  };
132
117
  return (0, _defaults2.default)({}, point, datum);
133
118
  }
134
-
135
119
  function scalePoint(props, datum) {
136
- var scale = props.scale,
137
- polar = props.polar,
138
- horizontal = props.horizontal;
139
- var d = getPoint(datum);
140
- var origin = props.origin || {
120
+ const {
121
+ scale,
122
+ polar,
123
+ horizontal
124
+ } = props;
125
+ const d = getPoint(datum);
126
+ const origin = props.origin || {
141
127
  x: 0,
142
128
  y: 0
143
129
  };
144
- var x = horizontal ? scale.y(d.y) : scale.x(d.x);
145
- var x0 = horizontal ? scale.y(d.y0) : scale.x(d.x0);
146
- var y = horizontal ? scale.x(d.x) : scale.y(d.y);
147
- var y0 = horizontal ? scale.x(d.x0) : scale.y(d.y0);
130
+ const x = horizontal ? scale.y(d.y) : scale.x(d.x);
131
+ const x0 = horizontal ? scale.y(d.y0) : scale.x(d.x0);
132
+ const y = horizontal ? scale.x(d.x) : scale.y(d.y);
133
+ const y0 = horizontal ? scale.x(d.x0) : scale.y(d.y0);
148
134
  return {
149
135
  x: polar ? y * Math.cos(x) + origin.x : x,
150
136
  x0: polar ? y0 * Math.cos(x0) + origin.x : x0,
@@ -152,12 +138,13 @@ function scalePoint(props, datum) {
152
138
  y0: polar ? -y0 * Math.sin(x0) + origin.x : y0
153
139
  };
154
140
  }
155
-
156
- function getPadding(props) {
157
- var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "padding";
158
- var padding = props[name];
159
- var paddingVal = typeof padding === "number" ? padding : 0;
160
- var paddingObj = typeof padding === "object" ? padding : {};
141
+ function getPadding(props, name) {
142
+ if (name === void 0) {
143
+ name = "padding";
144
+ }
145
+ const padding = props[name];
146
+ const paddingVal = typeof padding === "number" ? padding : 0;
147
+ const paddingObj = typeof padding === "object" ? padding : {};
161
148
  return {
162
149
  top: paddingObj.top || paddingVal,
163
150
  bottom: paddingObj.bottom || paddingVal,
@@ -165,137 +152,124 @@ function getPadding(props) {
165
152
  right: paddingObj.right || paddingVal
166
153
  };
167
154
  }
168
-
169
155
  function isTooltip(component) {
170
- var labelRole = component && component.type && component.type.role;
156
+ const labelRole = component && component.type && component.type.role;
171
157
  return labelRole === "tooltip";
172
158
  }
173
-
174
159
  function getDefaultStyles(props, role) {
175
- var _props$theme = props.theme,
176
- theme = _props$theme === void 0 ? {} : _props$theme,
177
- labelComponent = props.labelComponent;
178
- var defaultStyles = theme[role] && theme[role].style || {};
179
-
160
+ const {
161
+ theme = {},
162
+ labelComponent
163
+ } = props;
164
+ const defaultStyles = theme[role] && theme[role].style || {};
180
165
  if (!isTooltip(labelComponent)) {
181
166
  return defaultStyles;
182
167
  }
183
-
184
- var tooltipStyle = theme.tooltip && theme.tooltip.style || {};
185
- var labelStyle = (0, _defaults2.default)({}, tooltipStyle, defaultStyles.labels);
168
+ const tooltipStyle = theme.tooltip && theme.tooltip.style || {};
169
+ const labelStyle = (0, _defaults2.default)({}, tooltipStyle, defaultStyles.labels);
186
170
  return (0, _defaults2.default)({}, {
187
171
  labels: labelStyle
188
172
  }, defaultStyles);
189
173
  }
190
-
191
174
  function getStyles(style, defaultStyles) {
192
- var width = "100%";
193
- var height = "100%";
194
-
175
+ const width = "100%";
176
+ const height = "100%";
195
177
  if (!style) {
196
178
  return (0, _defaults2.default)({
197
179
  parent: {
198
- height: height,
199
- width: width
180
+ height,
181
+ width
200
182
  }
201
183
  }, defaultStyles);
202
184
  }
203
-
204
- var data = style.data,
205
- labels = style.labels,
206
- parent = style.parent;
207
- var defaultParent = defaultStyles && defaultStyles.parent || {};
208
- var defaultLabels = defaultStyles && defaultStyles.labels || {};
209
- var defaultData = defaultStyles && defaultStyles.data || {};
185
+ const {
186
+ data,
187
+ labels,
188
+ parent
189
+ } = style;
190
+ const defaultParent = defaultStyles && defaultStyles.parent || {};
191
+ const defaultLabels = defaultStyles && defaultStyles.labels || {};
192
+ const defaultData = defaultStyles && defaultStyles.data || {};
210
193
  return {
211
194
  parent: (0, _defaults2.default)({}, parent, defaultParent, {
212
- width: width,
213
- height: height
195
+ width,
196
+ height
214
197
  }),
215
198
  labels: (0, _defaults2.default)({}, labels, defaultLabels),
216
199
  data: (0, _defaults2.default)({}, data, defaultData)
217
200
  };
218
201
  }
219
-
220
202
  function evaluateProp(prop, props) {
221
203
  return isFunction(prop) ? prop(props) : prop;
222
204
  }
223
-
224
205
  function evaluateStyle(style, props) {
225
206
  if (props.disableInlineStyles) {
226
207
  return {};
227
208
  }
228
-
229
- if (!style || !Object.keys(style).some(function (value) {
230
- return isFunction(style[value]);
231
- })) {
209
+ if (!style || !Object.keys(style).some(value => isFunction(style[value]))) {
232
210
  return style;
233
211
  }
234
-
235
- return Object.keys(style).reduce(function (prev, curr) {
212
+ return Object.keys(style).reduce((prev, curr) => {
236
213
  prev[curr] = evaluateProp(style[curr], props);
237
214
  return prev;
238
215
  }, {});
239
216
  }
240
-
241
217
  function degreesToRadians(degrees) {
242
218
  return typeof degrees === "number" ? degrees * (Math.PI / 180) : degrees;
243
219
  }
244
-
245
220
  function radiansToDegrees(radians) {
246
221
  return typeof radians === "number" ? radians / (Math.PI / 180) : radians;
247
222
  }
248
-
249
223
  function getRadius(props) {
250
- var _getPadding = getPadding(props),
251
- left = _getPadding.left,
252
- right = _getPadding.right,
253
- top = _getPadding.top,
254
- bottom = _getPadding.bottom;
255
-
256
- var width = props.width,
257
- height = props.height;
224
+ const {
225
+ left,
226
+ right,
227
+ top,
228
+ bottom
229
+ } = getPadding(props);
230
+ const {
231
+ width,
232
+ height
233
+ } = props;
258
234
  return Math.min(width - left - right, height - top - bottom) / 2;
259
235
  }
260
-
261
236
  function getPolarOrigin(props) {
262
- var width = props.width,
263
- height = props.height;
264
-
265
- var _getPadding2 = getPadding(props),
266
- top = _getPadding2.top,
267
- bottom = _getPadding2.bottom,
268
- left = _getPadding2.left,
269
- right = _getPadding2.right;
270
-
271
- var radius = Math.min(width - left - right, height - top - bottom) / 2;
272
- var offsetWidth = width / 2 + left - right;
273
- var offsetHeight = height / 2 + top - bottom;
237
+ const {
238
+ width,
239
+ height
240
+ } = props;
241
+ const {
242
+ top,
243
+ bottom,
244
+ left,
245
+ right
246
+ } = getPadding(props);
247
+ const radius = Math.min(width - left - right, height - top - bottom) / 2;
248
+ const offsetWidth = width / 2 + left - right;
249
+ const offsetHeight = height / 2 + top - bottom;
274
250
  return {
275
251
  x: offsetWidth + radius > width ? radius + left - right : offsetWidth,
276
252
  y: offsetHeight + radius > height ? radius + top - bottom : offsetHeight
277
253
  };
278
254
  }
279
-
280
255
  function getRange(props, axis) {
281
256
  if (props.range && props.range[axis]) {
282
257
  return props.range[axis];
283
258
  } else if (props.range && Array.isArray(props.range)) {
284
259
  return props.range;
285
260
  }
286
-
287
261
  return props.polar ? getPolarRange(props, axis) : getCartesianRange(props, axis);
288
262
  }
263
+
289
264
  /**
290
265
  * Checks if `value` is `null` or `undefined`.
291
266
  * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
292
267
  */
293
-
294
-
295
268
  function isNil(value) {
296
269
  // eslint-disable-next-line eqeqeq
297
270
  return value == null;
298
271
  }
272
+
299
273
  /**
300
274
  * Checks if `value` is classified as a `Function` object.
301
275
  *
@@ -303,12 +277,9 @@ function isNil(value) {
303
277
  * @param {*} value The value to check.
304
278
  * @returns {boolean} Returns `true` if `value` is a function, else `false`.
305
279
  */
306
-
307
-
308
280
  function isFunction(value) {
309
281
  return typeof value === "function";
310
282
  }
311
-
312
283
  function createAccessor(key) {
313
284
  // creates a data accessor function
314
285
  // given a property key, path, array index, or null for identity.
@@ -316,50 +287,45 @@ function createAccessor(key) {
316
287
  return key;
317
288
  } else if (key === null || key === undefined) {
318
289
  // null/undefined means "return the data item itself"
319
- return function (x) {
320
- return x;
321
- };
322
- } // otherwise, assume it is an array index, property key or path (_.property handles all three)
323
-
324
-
290
+ return x => x;
291
+ }
292
+ // otherwise, assume it is an array index, property key or path (_.property handles all three)
325
293
  return (0, _property2.default)(key);
326
294
  }
327
-
328
295
  function modifyProps(props, fallbackProps, role) {
329
- var theme = props.theme && props.theme[role] ? props.theme[role] : {};
330
- var themeProps = omit(theme, ["style"]);
331
- var horizontal = isHorizontal(props);
332
- var defaultObject = horizontal === undefined ? {} : {
333
- horizontal: horizontal
296
+ const theme = props.theme && props.theme[role] ? props.theme[role] : {};
297
+ const themeProps = omit(theme, ["style"]);
298
+ const horizontal = isHorizontal(props);
299
+ const defaultObject = horizontal === undefined ? {} : {
300
+ horizontal
334
301
  };
335
302
  return (0, _defaults2.default)(defaultObject, props, themeProps, fallbackProps);
336
303
  }
304
+
337
305
  /**
338
306
  * Returns the given axis or the opposite axis when horizontal
339
307
  * @param {string} axis: the given axis, either "x" pr "y"
340
308
  * @param {Boolean} horizontal: true when the chart is flipped to the horizontal orientation
341
309
  * @returns {String} the dimension appropriate for the axis given its props "x" or "y"
342
310
  */
343
-
344
-
345
311
  function getCurrentAxis(axis, horizontal) {
346
- var otherAxis = axis === "x" ? "y" : "x";
312
+ const otherAxis = axis === "x" ? "y" : "x";
347
313
  return horizontal ? otherAxis : axis;
348
314
  }
315
+
349
316
  /**
350
317
  * Creates an object with the same keys as object and values generated by running
351
318
  * each own enumerable string keyed property of object through the function fn
352
319
  */
353
-
354
-
355
320
  function mapValues(values, fn) {
356
321
  if (values) {
357
- return Object.keys(values).reduce(function (acc, key) {
322
+ return Object.keys(values).reduce((acc, key) => {
358
323
  acc[key] = fn(values[key]);
359
324
  return acc;
360
325
  }, {});
361
326
  }
362
327
  }
328
+
363
329
  /**
364
330
  * Creates an array of numbers (positive and/or negative) progressing
365
331
  * from start up to, but not including, end.
@@ -370,29 +336,25 @@ function mapValues(values, fn) {
370
336
  * @param end [The end value] If this is defined, start is the start value
371
337
  * @returns An array of the given length
372
338
  */
373
-
374
-
375
339
  function range(start, end, increment) {
376
340
  // when the end index is not given, start from 0
377
- var startIndex = end ? start : 0; // when the end index is not given, the end of the range is the start index
341
+ const startIndex = end ? start : 0;
378
342
 
379
- var endIndex = end ? end : start; // ensure endIndex is not a falsy value
343
+ // when the end index is not given, the end of the range is the start index
344
+ let endIndex = end ? end : start;
380
345
 
346
+ // ensure endIndex is not a falsy value
381
347
  if (!endIndex) endIndex = 0;
382
- var k = endIndex - startIndex; // the value range
383
-
384
- var length = Math.abs(k); // the length of the range
385
-
386
- var sign = k / length || 1; // the sign of the range (negative or positive)
348
+ const k = endIndex - startIndex; // the value range
349
+ const length = Math.abs(k); // the length of the range
350
+ const sign = k / length || 1; // the sign of the range (negative or positive)
351
+ const inc = increment || 1; // the step size of each increment
387
352
 
388
- var inc = increment || 1; // the step size of each increment
389
353
  // normalize the array length when dealing with floating point values
390
-
391
- var arrayLength = Math.max(Math.ceil(length / inc), 0);
392
- return Array.from(Array(arrayLength), function (_, i) {
393
- return startIndex + i * sign * inc;
394
- });
354
+ const arrayLength = Math.max(Math.ceil(length / inc), 0);
355
+ return Array.from(Array(arrayLength), (_, i) => startIndex + i * sign * inc);
395
356
  }
357
+
396
358
  /**
397
359
  * @param {Array} children: an array of child components
398
360
  * @param {Function} iteratee: a function with arguments "child", "childName", and "parent"
@@ -402,80 +364,67 @@ function range(start, end, increment) {
402
364
  * to the memo for the next iteration step
403
365
  * @returns {Array} returns an array of results from calling the iteratee on all nested children
404
366
  */
405
-
406
367
  /* eslint-disable max-params */
407
-
408
-
409
- function reduceChildren(children, iteratee) {
410
- var parentProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
411
- var initialMemo = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
412
- var combine = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function (memo, item) {
413
- return (// @ts-expect-error These defaults are hard to type
414
- memo.concat(item)
415
- );
416
- };
417
- var sharedProps = ["data", "domain", "categories", "polar", "startAngle", "endAngle", "minDomain", "maxDomain", "horizontal"];
418
-
419
- var traverseChildren = function (childArray, names, parent) {
420
- return childArray.reduce(function (memo, child, index) {
421
- var newMemo = memo;
422
- var childRole = child.type && child.type.role;
423
- var childName = child.props.name || "".concat(childRole, "-").concat(names[index]);
424
-
368
+ function reduceChildren(children, iteratee, parentProps,
369
+ // @ts-expect-error These defaults are hard to type
370
+ initialMemo, combine) {
371
+ if (parentProps === void 0) {
372
+ parentProps = {};
373
+ }
374
+ if (initialMemo === void 0) {
375
+ initialMemo = [];
376
+ }
377
+ if (combine === void 0) {
378
+ combine = (memo, item) =>
379
+ // @ts-expect-error These defaults are hard to type
380
+ memo.concat(item);
381
+ }
382
+ const sharedProps = ["data", "domain", "categories", "polar", "startAngle", "endAngle", "minDomain", "maxDomain", "horizontal"];
383
+ const traverseChildren = (childArray, names, parent) => {
384
+ return childArray.reduce((memo, child, index) => {
385
+ let newMemo = memo;
386
+ const childRole = child.type && child.type.role;
387
+ const childName = child.props.name || `${childRole}-${names[index]}`;
425
388
  if (child.props && child.props.children) {
426
- var childProps = Object.assign({}, child.props, (0, _pick2.default)(parentProps, sharedProps));
427
- var nestedChildren = child.type && child.type.role === "stack" && isFunction(child.type.getChildren) ? child.type.getChildren(childProps) : _react.default.Children.toArray(child.props.children).map(function (c) {
428
- var nestedChildProps = Object.assign({}, c.props, (0, _pick2.default)(childProps, sharedProps));
389
+ const childProps = Object.assign({}, child.props, (0, _pick2.default)(parentProps, sharedProps));
390
+ const nestedChildren = child.type && child.type.role === "stack" && isFunction(child.type.getChildren) ? child.type.getChildren(childProps) : _react.default.Children.toArray(child.props.children).map(c => {
391
+ const nestedChildProps = Object.assign({}, c.props, (0, _pick2.default)(childProps, sharedProps));
429
392
  return /*#__PURE__*/_react.default.cloneElement(c, nestedChildProps);
430
393
  });
431
-
432
- var _childNames = nestedChildren.map(function (c, i) {
433
- return "".concat(childName, "-").concat(i);
434
- });
435
-
436
- var nestedResults = traverseChildren(nestedChildren, _childNames, child);
394
+ const childNames = nestedChildren.map((c, i) => `${childName}-${i}`);
395
+ const nestedResults = traverseChildren(nestedChildren, childNames, child);
437
396
  newMemo = combine(newMemo, nestedResults);
438
397
  } else {
439
- var result = iteratee(child, childName, parent);
440
-
398
+ const result = iteratee(child, childName, parent);
441
399
  if (result) {
442
400
  newMemo = combine(newMemo, result);
443
401
  }
444
402
  }
445
-
446
403
  return newMemo;
447
404
  }, initialMemo);
448
405
  };
449
-
450
- var validChildren = children.filter(_react.isValidElement);
451
- var childNames = validChildren.map(function (c, i) {
452
- return i;
453
- });
406
+ const validChildren = children.filter(_react.isValidElement);
407
+ const childNames = validChildren.map((c, i) => i);
454
408
  return traverseChildren(validChildren, childNames);
455
409
  }
410
+
456
411
  /**
457
412
  * @param {Object} props: the props object
458
413
  * @returns {Boolean} returns true if the props object contains `horizontal: true` of if any
459
414
  * children or nested children are horizontal
460
415
  */
461
-
462
-
463
416
  function isHorizontal(props) {
464
417
  if (props.horizontal !== undefined || !props.children) {
465
418
  return props.horizontal;
466
419
  }
467
-
468
- var traverseChildren = function (childArray) {
469
- return childArray.reduce(function (memo, child) {
470
- var childProps = child.props || {};
471
-
420
+ const traverseChildren = childArray => {
421
+ return childArray.reduce((memo, child) => {
422
+ const childProps = child.props || {};
472
423
  if (memo || childProps.horizontal || !childProps.children) {
473
424
  return memo || childProps.horizontal;
474
425
  }
475
-
476
426
  return traverseChildren(_react.default.Children.toArray(childProps.children));
477
427
  }, false);
478
428
  };
479
-
480
429
  return traverseChildren(_react.default.Children.toArray(props.children));
481
430
  }
@@ -15,7 +15,5 @@ Object.defineProperty(exports, "usePreviousProps", {
15
15
  return _usePreviousProps.usePreviousProps;
16
16
  }
17
17
  });
18
-
19
18
  var _usePreviousProps = require("./use-previous-props");
20
-
21
19
  var _useAnimationState = require("./use-animation-state");