victory-core 37.3.1 → 37.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/victory-core.js +436 -405
- package/dist/victory-core.min.js +1 -1
- package/es/types/callbacks.d.ts +11 -11
- package/es/types/prop-types.d.ts +28 -28
- package/es/victory-animation/util.js +7 -7
- package/es/victory-animation/victory-animation.d.ts +3 -3
- package/es/victory-clip-container/victory-clip-container.d.ts +6 -1
- package/es/victory-clip-container/victory-clip-container.js +20 -12
- package/es/victory-container/victory-container.js +5 -5
- package/es/victory-label/victory-label.d.ts +3 -3
- package/es/victory-label/victory-label.js +12 -16
- package/es/victory-portal/victory-portal.js +4 -4
- package/es/victory-primitives/arc.js +2 -2
- package/es/victory-primitives/background.js +2 -2
- package/es/victory-primitives/border.js +2 -2
- package/es/victory-primitives/line-segment.js +2 -2
- package/es/victory-primitives/point.js +2 -2
- package/es/victory-primitives/tspan.d.ts +0 -1
- package/es/victory-primitives/types.d.ts +1 -1
- package/es/victory-primitives/whisker.d.ts +1 -1
- package/es/victory-primitives/whisker.js +2 -2
- package/es/victory-theme/types.d.ts +11 -11
- package/es/victory-transition/victory-transition.d.ts +1 -1
- package/es/victory-transition/victory-transition.js +8 -8
- package/es/victory-util/add-events.d.ts +8 -8
- package/es/victory-util/add-events.js +14 -14
- package/es/victory-util/axis.js +12 -12
- package/es/victory-util/data.js +16 -20
- package/es/victory-util/domain.js +13 -16
- package/es/victory-util/events.d.ts +5 -5
- package/es/victory-util/events.js +17 -23
- package/es/victory-util/helpers.d.ts +94 -19
- package/es/victory-util/helpers.js +95 -50
- package/es/victory-util/hooks/use-animation-state.d.ts +2 -2
- package/es/victory-util/hooks/use-animation-state.js +4 -4
- package/es/victory-util/label-helpers.d.ts +4 -3
- package/es/victory-util/label-helpers.js +3 -3
- package/es/victory-util/line-helpers.d.ts +1 -1
- package/es/victory-util/log.js +3 -2
- package/es/victory-util/merge-refs.d.ts +2 -2
- package/es/victory-util/scale.js +2 -3
- package/es/victory-util/selection.d.ts +3 -3
- package/es/victory-util/textsize.js +7 -5
- package/es/victory-util/timer.d.ts +1 -1
- package/es/victory-util/transitions.d.ts +1 -1
- package/es/victory-util/transitions.js +15 -19
- package/es/victory-util/type-helpers.d.ts +0 -1
- package/es/victory-util/type-helpers.js +0 -5
- package/es/victory-util/user-props.d.ts +2 -2
- package/es/victory-util/wrapper.js +12 -13
- package/lib/types/callbacks.d.ts +11 -11
- package/lib/types/prop-types.d.ts +28 -28
- package/lib/victory-animation/util.js +7 -7
- package/lib/victory-animation/victory-animation.d.ts +3 -3
- package/lib/victory-clip-container/victory-clip-container.d.ts +6 -1
- package/lib/victory-clip-container/victory-clip-container.js +20 -12
- package/lib/victory-container/victory-container.js +6 -6
- package/lib/victory-label/victory-label.d.ts +3 -3
- package/lib/victory-label/victory-label.js +12 -16
- package/lib/victory-portal/victory-portal.js +5 -5
- package/lib/victory-primitives/arc.js +2 -2
- package/lib/victory-primitives/background.js +2 -2
- package/lib/victory-primitives/border.js +2 -2
- package/lib/victory-primitives/line-segment.js +2 -2
- package/lib/victory-primitives/point.js +2 -2
- package/lib/victory-primitives/tspan.d.ts +0 -1
- package/lib/victory-primitives/types.d.ts +1 -1
- package/lib/victory-primitives/whisker.d.ts +1 -1
- package/lib/victory-primitives/whisker.js +2 -2
- package/lib/victory-theme/types.d.ts +11 -11
- package/lib/victory-transition/victory-transition.d.ts +1 -1
- package/lib/victory-transition/victory-transition.js +8 -8
- package/lib/victory-util/add-events.d.ts +8 -8
- package/lib/victory-util/add-events.js +14 -14
- package/lib/victory-util/axis.js +12 -12
- package/lib/victory-util/data.js +16 -21
- package/lib/victory-util/domain.js +13 -17
- package/lib/victory-util/events.d.ts +5 -5
- package/lib/victory-util/events.js +17 -24
- package/lib/victory-util/helpers.d.ts +94 -19
- package/lib/victory-util/helpers.js +96 -52
- package/lib/victory-util/hooks/use-animation-state.d.ts +2 -2
- package/lib/victory-util/hooks/use-animation-state.js +4 -4
- package/lib/victory-util/label-helpers.d.ts +4 -3
- package/lib/victory-util/label-helpers.js +3 -5
- package/lib/victory-util/line-helpers.d.ts +1 -1
- package/lib/victory-util/log.js +3 -2
- package/lib/victory-util/merge-refs.d.ts +2 -2
- package/lib/victory-util/scale.js +2 -4
- package/lib/victory-util/selection.d.ts +3 -3
- package/lib/victory-util/textsize.js +5 -5
- package/lib/victory-util/timer.d.ts +1 -1
- package/lib/victory-util/transitions.d.ts +1 -1
- package/lib/victory-util/transitions.js +15 -19
- package/lib/victory-util/type-helpers.d.ts +0 -1
- package/lib/victory-util/type-helpers.js +0 -6
- package/lib/victory-util/user-props.d.ts +2 -2
- package/lib/victory-util/wrapper.js +12 -13
- package/package.json +6 -38
- package/src/victory-animation/util.ts +4 -2
- package/src/victory-clip-container/victory-clip-container.tsx +26 -11
- package/src/victory-container/victory-container.tsx +4 -4
- package/src/victory-label/victory-label.tsx +5 -3
- package/src/victory-portal/victory-portal.tsx +3 -1
- package/src/victory-primitives/arc.tsx +1 -1
- package/src/victory-primitives/background.tsx +1 -1
- package/src/victory-primitives/border.tsx +1 -1
- package/src/victory-primitives/line-segment.tsx +1 -1
- package/src/victory-primitives/point.tsx +3 -3
- package/src/victory-primitives/whisker.tsx +1 -1
- package/src/victory-transition/victory-transition.tsx +5 -3
- package/src/victory-util/add-events.tsx +6 -3
- package/src/victory-util/axis.tsx +8 -4
- package/src/victory-util/common-props.tsx +3 -3
- package/src/victory-util/data.ts +9 -13
- package/src/victory-util/domain.ts +8 -6
- package/src/victory-util/events.ts +18 -13
- package/src/victory-util/helpers.ts +155 -40
- package/src/victory-util/hooks/use-animation-state.ts +1 -1
- package/src/victory-util/label-helpers.ts +1 -2
- package/src/victory-util/log.ts +3 -2
- package/src/victory-util/merge-refs.ts +2 -0
- package/src/victory-util/scale.ts +1 -2
- package/src/victory-util/textsize.ts +2 -1
- package/src/victory-util/transitions.ts +6 -6
- package/src/victory-util/type-helpers.ts +0 -5
- package/src/victory-util/user-props.ts +1 -1
- package/src/victory-util/wrapper.tsx +5 -2
|
@@ -1,32 +1,77 @@
|
|
|
1
|
-
/* eslint-disable no-use-before-define */
|
|
2
1
|
import React, { isValidElement } from "react";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import defaults from "lodash/defaults";
|
|
3
|
+
import property from "lodash/property";
|
|
4
|
+
import pick from "lodash/pick";
|
|
5
|
+
|
|
5
6
|
import { ValueOrAccessor } from "../types/prop-types";
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
export type ElementPadding = {
|
|
9
|
+
top: number;
|
|
10
|
+
bottom: number;
|
|
11
|
+
left: number;
|
|
12
|
+
right: number;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type MaybePointData = {
|
|
16
|
+
x?: number;
|
|
17
|
+
x0?: number;
|
|
18
|
+
x1?: number;
|
|
19
|
+
y?: number;
|
|
20
|
+
y0?: number;
|
|
21
|
+
y1?: number;
|
|
22
|
+
_x?: number;
|
|
23
|
+
_x0?: number;
|
|
24
|
+
_x1?: number;
|
|
25
|
+
_y?: number;
|
|
26
|
+
_y0?: number;
|
|
27
|
+
_y1?: number;
|
|
28
|
+
_voronoiX?: number;
|
|
29
|
+
_voronoiY?: number;
|
|
30
|
+
};
|
|
8
31
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Determine the range of a cartesian axis
|
|
34
|
+
*/
|
|
35
|
+
function getCartesianRange(options: {
|
|
36
|
+
axis: "x" | "y";
|
|
37
|
+
height: number;
|
|
38
|
+
width: number;
|
|
39
|
+
padding: ElementPadding;
|
|
40
|
+
}): [number, number] {
|
|
41
|
+
const vertical = options.axis !== "x";
|
|
13
42
|
if (vertical) {
|
|
14
|
-
return [
|
|
43
|
+
return [options.height - options.padding.bottom, options.padding.top];
|
|
15
44
|
}
|
|
16
|
-
return [padding.left,
|
|
45
|
+
return [options.padding.left, options.width - options.padding.right];
|
|
17
46
|
}
|
|
18
47
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Determine the range of a polar axis in radians
|
|
50
|
+
*/
|
|
51
|
+
function getPolarRange(options: {
|
|
52
|
+
axis: "x" | "y";
|
|
53
|
+
innerRadius?: number;
|
|
54
|
+
startAngle?: number;
|
|
55
|
+
endAngle?: number;
|
|
56
|
+
padding: ElementPadding;
|
|
57
|
+
height: number;
|
|
58
|
+
width: number;
|
|
59
|
+
}): [number, number] {
|
|
60
|
+
if (options.axis === "x") {
|
|
61
|
+
const startAngle = degreesToRadians(options.startAngle || 0);
|
|
62
|
+
const endAngle = degreesToRadians(options.endAngle || 360);
|
|
23
63
|
return [startAngle, endAngle];
|
|
24
64
|
}
|
|
25
|
-
return [
|
|
65
|
+
return [
|
|
66
|
+
options.innerRadius || 0,
|
|
67
|
+
getRadius({
|
|
68
|
+
height: options.height,
|
|
69
|
+
width: options.width,
|
|
70
|
+
padding: options.padding,
|
|
71
|
+
}),
|
|
72
|
+
];
|
|
26
73
|
}
|
|
27
74
|
|
|
28
|
-
// Exported Functions
|
|
29
|
-
|
|
30
75
|
/**
|
|
31
76
|
* Creates an object composed of the inverted keys and values of object.
|
|
32
77
|
* If object contains duplicate values, subsequent values overwrite property assignments of previous values.
|
|
@@ -64,21 +109,36 @@ export function omit<T, Keys extends keyof T>(
|
|
|
64
109
|
return newObject;
|
|
65
110
|
}
|
|
66
111
|
|
|
67
|
-
|
|
68
|
-
|
|
112
|
+
/**
|
|
113
|
+
* Coalesce the x and y values from a data point
|
|
114
|
+
*/
|
|
115
|
+
export function getPoint(datum: MaybePointData): MaybePointData {
|
|
69
116
|
const { _x, _x1, _x0, _voronoiX, _y, _y1, _y0, _voronoiY } = datum;
|
|
70
|
-
const defaultX =
|
|
71
|
-
const defaultY =
|
|
117
|
+
const defaultX = _x1 ?? _x;
|
|
118
|
+
const defaultY = _y1 ?? _y;
|
|
119
|
+
|
|
72
120
|
const point = {
|
|
73
|
-
x:
|
|
74
|
-
x0:
|
|
75
|
-
y:
|
|
76
|
-
y0:
|
|
121
|
+
x: _voronoiX ?? defaultX,
|
|
122
|
+
x0: _x0 ?? _x,
|
|
123
|
+
y: _voronoiY ?? defaultY,
|
|
124
|
+
y0: _y0 ?? _y,
|
|
77
125
|
};
|
|
126
|
+
|
|
78
127
|
return defaults({}, point, datum);
|
|
79
128
|
}
|
|
80
129
|
|
|
81
|
-
|
|
130
|
+
/**
|
|
131
|
+
* Scale a point based on the origin, direction, and given scale function
|
|
132
|
+
*/
|
|
133
|
+
export function scalePoint(
|
|
134
|
+
props: {
|
|
135
|
+
scale: { x: (x?: number) => number; y: (y?: number) => number };
|
|
136
|
+
polar?: boolean;
|
|
137
|
+
horizontal?: boolean;
|
|
138
|
+
origin?: { x: number; y: number };
|
|
139
|
+
},
|
|
140
|
+
datum: MaybePointData,
|
|
141
|
+
) {
|
|
82
142
|
const { scale, polar, horizontal } = props;
|
|
83
143
|
const d = getPoint(datum);
|
|
84
144
|
const origin = props.origin || { x: 0, y: 0 };
|
|
@@ -94,8 +154,12 @@ export function scalePoint(props, datum) {
|
|
|
94
154
|
};
|
|
95
155
|
}
|
|
96
156
|
|
|
97
|
-
|
|
98
|
-
|
|
157
|
+
/**
|
|
158
|
+
* Returns a padding value from a number or partial padding values
|
|
159
|
+
*/
|
|
160
|
+
export function getPadding(
|
|
161
|
+
padding?: number | Partial<ElementPadding>,
|
|
162
|
+
): ElementPadding {
|
|
99
163
|
const paddingVal = typeof padding === "number" ? padding : 0;
|
|
100
164
|
const paddingObj = typeof padding === "object" ? padding : {};
|
|
101
165
|
return {
|
|
@@ -106,7 +170,10 @@ export function getPadding(props, name = "padding") {
|
|
|
106
170
|
};
|
|
107
171
|
}
|
|
108
172
|
|
|
109
|
-
|
|
173
|
+
/**
|
|
174
|
+
* Returns true if the component is defined as a tooltip
|
|
175
|
+
*/
|
|
176
|
+
export function isTooltip(component?: { type?: { role?: string } }) {
|
|
110
177
|
const labelRole = component && component.type && component.type.role;
|
|
111
178
|
return labelRole === "tooltip";
|
|
112
179
|
}
|
|
@@ -139,9 +206,12 @@ export function getStyles(style, defaultStyles) {
|
|
|
139
206
|
};
|
|
140
207
|
}
|
|
141
208
|
|
|
209
|
+
/**
|
|
210
|
+
* Returns the value of a prop or accessor function with the given props
|
|
211
|
+
*/
|
|
142
212
|
export function evaluateProp<TValue>(
|
|
143
|
-
prop: ValueOrAccessor<TValue,
|
|
144
|
-
props:
|
|
213
|
+
prop: ValueOrAccessor<TValue, Record<string, any>>,
|
|
214
|
+
props: Record<string, any>,
|
|
145
215
|
): TValue {
|
|
146
216
|
return isFunction(prop) ? prop(props) : prop;
|
|
147
217
|
}
|
|
@@ -167,15 +237,29 @@ export function radiansToDegrees(radians) {
|
|
|
167
237
|
return typeof radians === "number" ? radians / (Math.PI / 180) : radians;
|
|
168
238
|
}
|
|
169
239
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
240
|
+
/**
|
|
241
|
+
* Get the maximum radius that will fit in the container
|
|
242
|
+
*/
|
|
243
|
+
export function getRadius(options: {
|
|
244
|
+
height: number;
|
|
245
|
+
width: number;
|
|
246
|
+
padding: ElementPadding;
|
|
247
|
+
}) {
|
|
248
|
+
const { width, height, padding } = options;
|
|
249
|
+
const { left, right, top, bottom } = padding;
|
|
173
250
|
return Math.min(width - left - right, height - top - bottom) / 2;
|
|
174
251
|
}
|
|
175
252
|
|
|
176
|
-
|
|
253
|
+
/**
|
|
254
|
+
* Returns the origin for a polar chart within the padded area
|
|
255
|
+
*/
|
|
256
|
+
export function getPolarOrigin(props: {
|
|
257
|
+
height: number;
|
|
258
|
+
width: number;
|
|
259
|
+
padding: ElementPadding;
|
|
260
|
+
}): { x: number; y: number } {
|
|
177
261
|
const { width, height } = props;
|
|
178
|
-
const { top, bottom, left, right } = getPadding(props);
|
|
262
|
+
const { top, bottom, left, right } = getPadding(props.padding);
|
|
179
263
|
const radius = Math.min(width - left - right, height - top - bottom) / 2;
|
|
180
264
|
const offsetWidth = width / 2 + left - right;
|
|
181
265
|
const offsetHeight = height / 2 + top - bottom;
|
|
@@ -185,15 +269,43 @@ export function getPolarOrigin(props) {
|
|
|
185
269
|
};
|
|
186
270
|
}
|
|
187
271
|
|
|
188
|
-
|
|
272
|
+
/**
|
|
273
|
+
* Determine the range of an axis based on the given props
|
|
274
|
+
*/
|
|
275
|
+
export function getRange(
|
|
276
|
+
props: {
|
|
277
|
+
range?: [number, number];
|
|
278
|
+
polar?: boolean;
|
|
279
|
+
innerRadius?: number;
|
|
280
|
+
startAngle?: number;
|
|
281
|
+
endAngle?: number;
|
|
282
|
+
height: number;
|
|
283
|
+
width: number;
|
|
284
|
+
padding: number | Partial<ElementPadding>;
|
|
285
|
+
},
|
|
286
|
+
axis: "x" | "y",
|
|
287
|
+
) {
|
|
189
288
|
if (props.range && props.range[axis]) {
|
|
190
289
|
return props.range[axis];
|
|
191
290
|
} else if (props.range && Array.isArray(props.range)) {
|
|
192
291
|
return props.range;
|
|
193
292
|
}
|
|
194
293
|
return props.polar
|
|
195
|
-
? getPolarRange(
|
|
196
|
-
|
|
294
|
+
? getPolarRange({
|
|
295
|
+
axis,
|
|
296
|
+
innerRadius: props.innerRadius,
|
|
297
|
+
startAngle: props.startAngle,
|
|
298
|
+
endAngle: props.endAngle,
|
|
299
|
+
height: props.height,
|
|
300
|
+
width: props.width,
|
|
301
|
+
padding: getPadding(props.padding),
|
|
302
|
+
})
|
|
303
|
+
: getCartesianRange({
|
|
304
|
+
axis,
|
|
305
|
+
height: props.height,
|
|
306
|
+
width: props.width,
|
|
307
|
+
padding: getPadding(props.padding),
|
|
308
|
+
});
|
|
197
309
|
}
|
|
198
310
|
|
|
199
311
|
/**
|
|
@@ -391,7 +503,10 @@ export function reduceChildren<
|
|
|
391
503
|
* @returns {Boolean} returns true if the props object contains `horizontal: true` of if any
|
|
392
504
|
* children or nested children are horizontal
|
|
393
505
|
*/
|
|
394
|
-
export function isHorizontal(props
|
|
506
|
+
export function isHorizontal(props: {
|
|
507
|
+
horizontal?: boolean;
|
|
508
|
+
children?: React.ReactNode;
|
|
509
|
+
}) {
|
|
395
510
|
if (props.horizontal !== undefined || !props.children) {
|
|
396
511
|
return props.horizontal;
|
|
397
512
|
}
|
package/src/victory-util/log.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/* global console */
|
|
1
|
+
/* global console process */
|
|
2
2
|
/* eslint-disable no-console */
|
|
3
3
|
|
|
4
|
-
// TODO: Use "warning" npm module like React is switching to.
|
|
5
4
|
export function warn(message: string) {
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6
|
+
// @ts-ignore - Webpack DefinePlugin will replace process.env.NODE_ENV
|
|
6
7
|
if (process.env.NODE_ENV !== "production") {
|
|
7
8
|
if (console && console.warn) {
|
|
8
9
|
console.warn(message);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { isPlainObject } from "lodash";
|
|
1
|
+
import isPlainObject from "lodash/isPlainObject";
|
|
3
2
|
import * as Helpers from "./helpers";
|
|
4
3
|
import * as Collection from "./collection";
|
|
5
4
|
import * as d3Scale from "victory-vendor/d3-scale";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// http://www.pearsonified.com/2012/01/characters-per-line.php
|
|
2
2
|
/* eslint-disable no-magic-numbers */
|
|
3
|
-
import
|
|
3
|
+
import defaults from "lodash/defaults";
|
|
4
|
+
import memoize from "lodash/memoize";
|
|
4
5
|
|
|
5
6
|
// Based on measuring specific character widths
|
|
6
7
|
// as in the following example https://bl.ocks.org/tophtucker/62f93a4658387bb61e4510c37e2e97cf
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { defaults, identity } from "lodash";
|
|
2
1
|
import React from "react";
|
|
2
|
+
import defaults from "lodash/defaults";
|
|
3
|
+
import identity from "lodash/identity";
|
|
4
|
+
|
|
3
5
|
import { AnimatePropTypeInterface } from "../types/prop-types";
|
|
4
6
|
|
|
5
7
|
function getDatumKey(datum, idx) {
|
|
@@ -156,7 +158,6 @@ function getChildBeforeLoad(animate, child, data, cb): TransitionProps {
|
|
|
156
158
|
return { animate: newAnimate, data: newData, clipWidth: 0 };
|
|
157
159
|
}
|
|
158
160
|
|
|
159
|
-
// eslint-disable-next-line max-params
|
|
160
161
|
function getChildOnLoad(animate, data, cb): TransitionProps {
|
|
161
162
|
const newAnimate = Object.assign({}, animate, { onEnd: cb });
|
|
162
163
|
let newData = data;
|
|
@@ -174,7 +175,7 @@ function getChildOnLoad(animate, data, cb): TransitionProps {
|
|
|
174
175
|
return { animate: newAnimate, data: newData };
|
|
175
176
|
}
|
|
176
177
|
|
|
177
|
-
// eslint-disable-next-line max-params
|
|
178
|
+
// eslint-disable-next-line max-params
|
|
178
179
|
function getChildPropsOnExit(
|
|
179
180
|
animate,
|
|
180
181
|
child,
|
|
@@ -208,7 +209,7 @@ function getChildPropsOnExit(
|
|
|
208
209
|
return { animate: newAnimate, data: newData };
|
|
209
210
|
}
|
|
210
211
|
|
|
211
|
-
// eslint-disable-next-line max-params
|
|
212
|
+
// eslint-disable-next-line max-params
|
|
212
213
|
function getChildPropsBeforeEnter(
|
|
213
214
|
animate,
|
|
214
215
|
child,
|
|
@@ -240,7 +241,7 @@ function getChildPropsBeforeEnter(
|
|
|
240
241
|
return { animate: newAnimate, data: newData };
|
|
241
242
|
}
|
|
242
243
|
|
|
243
|
-
// eslint-disable-next-line max-params
|
|
244
|
+
// eslint-disable-next-line max-params
|
|
244
245
|
function getChildPropsOnEnter(
|
|
245
246
|
animate,
|
|
246
247
|
data,
|
|
@@ -357,7 +358,6 @@ export function getTransitionPropsFactory(props, state, setState) {
|
|
|
357
358
|
return {};
|
|
358
359
|
};
|
|
359
360
|
|
|
360
|
-
// eslint-disable-next-line max-statements, complexity, max-len
|
|
361
361
|
return function getTransitionProps(child, index): TransitionProps {
|
|
362
362
|
const data = getChildData(child) || [];
|
|
363
363
|
const animate: AnimatePropTypeInterface = defaults(
|
|
@@ -30,11 +30,6 @@ export function getValueForAxis<T = unknown>(
|
|
|
30
30
|
return value;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
34
|
-
export function isFunction<T = Function>(func?: unknown): func is T {
|
|
35
|
-
return typeof func === "function";
|
|
36
|
-
}
|
|
37
|
-
|
|
38
33
|
export function isDate(value: unknown): value is Date {
|
|
39
34
|
return value instanceof Date;
|
|
40
35
|
}
|
|
@@ -78,7 +78,7 @@ export function assert<T>(
|
|
|
78
78
|
* @returns {Object}: object containing remaining acceptable props
|
|
79
79
|
*/
|
|
80
80
|
export const getSafeUserProps = <T>(
|
|
81
|
-
props: T,
|
|
81
|
+
props: T extends Record<string, any> ? T : never,
|
|
82
82
|
): Record<SafeAttribute, string> => {
|
|
83
83
|
const propsToFilter = { ...props };
|
|
84
84
|
return Object.fromEntries(
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { defaults, uniq, groupBy, uniqBy, isPlainObject } from "lodash";
|
|
2
1
|
import React from "react";
|
|
2
|
+
import defaults from "lodash/defaults";
|
|
3
|
+
import uniq from "lodash/uniq";
|
|
4
|
+
import groupBy from "lodash/groupBy";
|
|
5
|
+
import uniqBy from "lodash/uniqBy";
|
|
6
|
+
|
|
3
7
|
import * as Axis from "./axis";
|
|
4
8
|
import * as Style from "./style";
|
|
5
9
|
import * as Data from "./data";
|
|
@@ -188,7 +192,6 @@ export function getDefaultDomainPadding(props, axis, childComponents) {
|
|
|
188
192
|
}
|
|
189
193
|
|
|
190
194
|
export function getDomainFromChildren(props, axis, childComponents) {
|
|
191
|
-
// eslint-disable-line max-statements, complexity, max-len
|
|
192
195
|
const children = childComponents
|
|
193
196
|
? childComponents.slice(0)
|
|
194
197
|
: React.Children.toArray(props.children);
|