victory-core 36.6.0 → 36.6.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 +27 -0
- package/dist/victory-core.js +5 -3
- package/es/index.js +1 -2
- package/es/types/callbacks.d.ts +2 -1
- package/es/types/callbacks.js +1 -2
- package/es/types/prop-types.js +1 -2
- package/es/victory-accessible-group/victory-accessible-group.js +1 -2
- package/es/victory-animation/util.js +1 -2
- package/es/victory-animation/victory-animation.js +1 -2
- package/es/victory-clip-container/victory-clip-container.js +1 -2
- package/es/victory-container/victory-container.js +1 -2
- package/es/victory-label/victory-label.d.ts +4 -8
- package/es/victory-label/victory-label.js +1 -2
- package/es/victory-portal/portal-context.js +1 -2
- package/es/victory-portal/portal.js +1 -2
- package/es/victory-portal/victory-portal.js +1 -2
- package/es/victory-primitives/arc.js +1 -2
- package/es/victory-primitives/background.js +1 -2
- package/es/victory-primitives/border.js +1 -2
- package/es/victory-primitives/circle.js +1 -2
- package/es/victory-primitives/clip-path.js +1 -2
- package/es/victory-primitives/index.js +1 -2
- package/es/victory-primitives/line-segment.js +1 -2
- package/es/victory-primitives/line.js +1 -2
- package/es/victory-primitives/path.js +1 -2
- package/es/victory-primitives/point.js +1 -2
- package/es/victory-primitives/rect.js +1 -2
- package/es/victory-primitives/text.js +1 -2
- package/es/victory-primitives/tspan.js +1 -2
- package/es/victory-primitives/types.js +1 -2
- package/es/victory-primitives/whisker.js +1 -2
- package/es/victory-state/defaults.js +1 -2
- package/es/victory-state/helpers/get-axis-data.js +1 -2
- package/es/victory-state/helpers/get-data.js +1 -2
- package/es/victory-state/helpers/get-domain.js +1 -2
- package/es/victory-state/helpers/get-range.js +1 -2
- package/es/victory-state/helpers/get-scale.js +1 -2
- package/es/victory-state/index.js +1 -2
- package/es/victory-state/types.js +1 -2
- package/es/victory-state/victory-provider.js +1 -2
- package/es/victory-theme/grayscale.js +1 -2
- package/es/victory-theme/material.js +1 -2
- package/es/victory-theme/types.js +1 -2
- package/es/victory-theme/victory-theme.js +1 -2
- package/es/victory-transition/victory-transition.js +1 -2
- package/es/victory-util/add-events.d.ts +25 -7
- package/es/victory-util/add-events.js +1 -2
- package/es/victory-util/axis.js +1 -2
- package/es/victory-util/collection.js +1 -2
- package/es/victory-util/common-props.js +1 -2
- package/es/victory-util/data.js +1 -2
- package/es/victory-util/default-transitions.js +1 -2
- package/es/victory-util/domain.js +1 -2
- package/es/victory-util/events.d.ts +1 -1
- package/es/victory-util/events.js +1 -2
- package/es/victory-util/helpers.d.ts +2 -1
- package/es/victory-util/helpers.js +1 -2
- package/es/victory-util/hooks/index.js +1 -2
- package/es/victory-util/hooks/use-animation-state.js +1 -2
- package/es/victory-util/hooks/use-previous-props.js +1 -2
- package/es/victory-util/immutable.js +1 -2
- package/es/victory-util/index.js +1 -2
- package/es/victory-util/label-helpers.js +1 -2
- package/es/victory-util/line-helpers.js +1 -2
- package/es/victory-util/log.js +1 -2
- package/es/victory-util/point-path-helpers.js +1 -2
- package/es/victory-util/prop-types.js +1 -2
- package/es/victory-util/scale.js +1 -2
- package/es/victory-util/selection.d.ts +1 -1
- package/es/victory-util/selection.js +2 -3
- package/es/victory-util/style.js +1 -2
- package/es/victory-util/textsize.js +1 -2
- package/es/victory-util/timer-context.js +1 -2
- package/es/victory-util/timer.js +1 -2
- package/es/victory-util/transitions.js +1 -2
- package/es/victory-util/type-helpers.js +1 -2
- package/es/victory-util/user-props.d.ts +1 -1
- package/es/victory-util/user-props.js +4 -3
- package/es/victory-util/with-container.d.ts +1 -1
- package/es/victory-util/with-container.js +1 -2
- package/es/victory-util/wrapper.d.ts +1 -1
- package/es/victory-util/wrapper.js +1 -2
- package/lib/index.js +1 -2
- package/lib/types/callbacks.d.ts +2 -1
- package/lib/types/callbacks.js +1 -2
- package/lib/types/prop-types.js +1 -2
- package/lib/victory-accessible-group/victory-accessible-group.js +1 -2
- package/lib/victory-animation/util.js +1 -2
- package/lib/victory-animation/victory-animation.js +1 -2
- package/lib/victory-clip-container/victory-clip-container.js +1 -2
- package/lib/victory-container/victory-container.js +1 -2
- package/lib/victory-label/victory-label.d.ts +4 -8
- package/lib/victory-label/victory-label.js +1 -2
- package/lib/victory-portal/portal-context.js +1 -2
- package/lib/victory-portal/portal.js +1 -2
- package/lib/victory-portal/victory-portal.js +1 -2
- package/lib/victory-primitives/arc.js +1 -2
- package/lib/victory-primitives/background.js +1 -2
- package/lib/victory-primitives/border.js +1 -2
- package/lib/victory-primitives/circle.js +1 -2
- package/lib/victory-primitives/clip-path.js +1 -2
- package/lib/victory-primitives/index.js +1 -2
- package/lib/victory-primitives/line-segment.js +1 -2
- package/lib/victory-primitives/line.js +1 -2
- package/lib/victory-primitives/path.js +1 -2
- package/lib/victory-primitives/point.js +1 -2
- package/lib/victory-primitives/rect.js +1 -2
- package/lib/victory-primitives/text.js +1 -2
- package/lib/victory-primitives/tspan.js +1 -2
- package/lib/victory-primitives/types.js +1 -2
- package/lib/victory-primitives/whisker.js +1 -2
- package/lib/victory-state/defaults.js +1 -2
- package/lib/victory-state/helpers/get-axis-data.js +1 -2
- package/lib/victory-state/helpers/get-data.js +1 -2
- package/lib/victory-state/helpers/get-domain.js +1 -2
- package/lib/victory-state/helpers/get-range.js +1 -2
- package/lib/victory-state/helpers/get-scale.js +1 -2
- package/lib/victory-state/index.js +1 -2
- package/lib/victory-state/types.js +1 -2
- package/lib/victory-state/victory-provider.js +1 -2
- package/lib/victory-theme/grayscale.js +1 -2
- package/lib/victory-theme/material.js +1 -2
- package/lib/victory-theme/types.js +1 -2
- package/lib/victory-theme/victory-theme.js +1 -2
- package/lib/victory-transition/victory-transition.js +1 -2
- package/lib/victory-util/add-events.d.ts +25 -7
- package/lib/victory-util/add-events.js +1 -2
- package/lib/victory-util/axis.js +1 -2
- package/lib/victory-util/collection.js +1 -2
- package/lib/victory-util/common-props.js +1 -2
- package/lib/victory-util/data.js +1 -2
- package/lib/victory-util/default-transitions.js +1 -2
- package/lib/victory-util/domain.js +1 -2
- package/lib/victory-util/events.d.ts +1 -1
- package/lib/victory-util/events.js +1 -2
- package/lib/victory-util/helpers.d.ts +2 -1
- package/lib/victory-util/helpers.js +1 -2
- package/lib/victory-util/hooks/index.js +1 -2
- package/lib/victory-util/hooks/use-animation-state.js +1 -2
- package/lib/victory-util/hooks/use-previous-props.js +1 -2
- package/lib/victory-util/immutable.js +1 -2
- package/lib/victory-util/index.js +1 -2
- package/lib/victory-util/label-helpers.js +1 -2
- package/lib/victory-util/line-helpers.js +1 -2
- package/lib/victory-util/log.js +1 -2
- package/lib/victory-util/point-path-helpers.js +1 -2
- package/lib/victory-util/prop-types.js +1 -2
- package/lib/victory-util/scale.js +1 -2
- package/lib/victory-util/selection.d.ts +1 -1
- package/lib/victory-util/selection.js +7 -4
- package/lib/victory-util/style.js +1 -2
- package/lib/victory-util/textsize.js +1 -2
- package/lib/victory-util/timer-context.js +1 -2
- package/lib/victory-util/timer.js +1 -2
- package/lib/victory-util/transitions.js +1 -2
- package/lib/victory-util/type-helpers.js +1 -2
- package/lib/victory-util/user-props.d.ts +1 -1
- package/lib/victory-util/user-props.js +4 -3
- package/lib/victory-util/with-container.d.ts +1 -1
- package/lib/victory-util/with-container.js +1 -2
- package/lib/victory-util/wrapper.d.ts +1 -1
- package/lib/victory-util/wrapper.js +1 -2
- package/package.json +34 -17
- package/src/types/callbacks.ts +3 -1
- package/src/victory-label/victory-label.tsx +4 -3
- package/src/victory-util/add-events.tsx +45 -6
- package/src/victory-util/events.ts +2 -1
- package/src/victory-util/helpers.ts +5 -1
- package/src/victory-util/selection.ts +3 -1
- package/src/victory-util/user-props.ts +2 -1
- package/src/victory-util/with-container.tsx +2 -2
- package/src/victory-util/wrapper.tsx +1 -1
package/lib/victory-util/data.js
CHANGED
|
@@ -499,5 +499,4 @@ function isDataComponent(component) {
|
|
|
499
499
|
|
|
500
500
|
var whitelist = ["area", "bar", "boxplot", "candlestick", "errorbar", "group", "histogram", "line", "pie", "scatter", "stack", "voronoi"];
|
|
501
501
|
return (0, _includes2.default)(whitelist, role);
|
|
502
|
-
}
|
|
503
|
-
//# sourceMappingURL=data.js.map
|
|
502
|
+
}
|
|
@@ -451,5 +451,4 @@ function isDomainComponent(component) {
|
|
|
451
451
|
|
|
452
452
|
var whitelist = ["area", "axis", "bar", "boxplot", "candlestick", "errorbar", "group", "histogram", "line", "pie", "scatter", "stack", "voronoi"];
|
|
453
453
|
return (0, _includes2.default)(whitelist, role);
|
|
454
|
-
}
|
|
455
|
-
//# sourceMappingURL=domain.js.map
|
|
454
|
+
}
|
|
@@ -6,7 +6,7 @@ export interface ComponentEvent {
|
|
|
6
6
|
eventKey?: ComponentEventKey | ComponentEventKey[];
|
|
7
7
|
eventHandlers: ComponentEventHandlers;
|
|
8
8
|
}
|
|
9
|
-
export declare type ComponentEventName =
|
|
9
|
+
export declare type ComponentEventName = string;
|
|
10
10
|
export interface ComponentEventHandlers {
|
|
11
11
|
[k: ComponentEventName]: ComponentEventHandler;
|
|
12
12
|
}
|
|
@@ -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:
|
|
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;
|
|
@@ -18,5 +18,4 @@ Object.defineProperty(exports, "usePreviousProps", {
|
|
|
18
18
|
|
|
19
19
|
var _usePreviousProps = require("./use-previous-props");
|
|
20
20
|
|
|
21
|
-
var _useAnimationState = require("./use-animation-state");
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
21
|
+
var _useAnimationState = require("./use-animation-state");
|
|
@@ -177,5 +177,4 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
177
177
|
|
|
178
178
|
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); }
|
|
179
179
|
|
|
180
|
-
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; }
|
|
181
|
-
//# sourceMappingURL=index.js.map
|
|
180
|
+
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; }
|
|
@@ -75,5 +75,4 @@ var getLineFunction = function (props) {
|
|
|
75
75
|
return polar ? d3Shape.lineRadial().defined(defined).curve(getInterpolationFunction(props)).angle(getAngleAccessor(scale)).radius(getYAccessor(scale)) : d3Shape.line().defined(defined).curve(getInterpolationFunction(props)).x(horizontal ? getYAccessor(scale) : getXAccessor(scale)).y(horizontal ? getXAccessor(scale) : getYAccessor(scale));
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
exports.getLineFunction = getLineFunction;
|
|
79
|
-
//# sourceMappingURL=line-helpers.js.map
|
|
78
|
+
exports.getLineFunction = getLineFunction;
|
package/lib/victory-util/log.js
CHANGED
|
@@ -93,5 +93,4 @@ function star(x, y, size) {
|
|
|
93
93
|
return "".concat(length * Math.sin(angle * (index + 1)) + x, ",\n ").concat(length * Math.cos(angle * (index + 1)) + y);
|
|
94
94
|
});
|
|
95
95
|
return "M ".concat(starCoords.join("L"), " z");
|
|
96
|
-
}
|
|
97
|
-
//# sourceMappingURL=point-path-helpers.js.map
|
|
96
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { VictoryCommonProps } from "./
|
|
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;
|
|
@@ -9,7 +9,11 @@ exports.getDomainCoordinates = getDomainCoordinates;
|
|
|
9
9
|
exports.getParentSVG = getParentSVG;
|
|
10
10
|
exports.getSVGEventCoordinates = getSVGEventCoordinates;
|
|
11
11
|
|
|
12
|
-
var
|
|
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) {
|
|
@@ -119,12 +123,11 @@ function getBounds(props) {
|
|
|
119
123
|
var point2 = getDataCoordinates(props, scale, x2, y2);
|
|
120
124
|
|
|
121
125
|
var makeBound = function (a, b) {
|
|
122
|
-
return [
|
|
126
|
+
return [Collection.getMinValue([a, b]), Collection.getMaxValue([a, b])];
|
|
123
127
|
};
|
|
124
128
|
|
|
125
129
|
return {
|
|
126
130
|
x: makeBound(point1.x, point2.x),
|
|
127
131
|
y: makeBound(point1.y, point2.y)
|
|
128
132
|
};
|
|
129
|
-
}
|
|
130
|
-
//# sourceMappingURL=selection.js.map
|
|
133
|
+
}
|
|
@@ -298,5 +298,4 @@ var approximateTextSize = function (text, style) {
|
|
|
298
298
|
return _approximateTextSizeInternal.impl(text, style);
|
|
299
299
|
};
|
|
300
300
|
|
|
301
|
-
exports.approximateTextSize = approximateTextSize;
|
|
302
|
-
//# sourceMappingURL=textsize.js.map
|
|
301
|
+
exports.approximateTextSize = approximateTextSize;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare type SafeAttribute =
|
|
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
|
|
@@ -136,5 +138,4 @@ var withSafeUserProps = function (component, props) {
|
|
|
136
138
|
return /*#__PURE__*/React.cloneElement(component, getSafeUserProps(props));
|
|
137
139
|
};
|
|
138
140
|
|
|
139
|
-
exports.withSafeUserProps = withSafeUserProps;
|
|
140
|
-
//# sourceMappingURL=user-props.js.map
|
|
141
|
+
exports.withSafeUserProps = withSafeUserProps;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { VictoryProviderProps } from "../victory-state";
|
|
3
3
|
import { VictoryCommonProps } from "./common-props";
|
|
4
|
-
export declare function withContainer<Props extends VictoryCommonProps>(WrappedComponent:
|
|
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
|
|
@@ -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
|
|
34
|
+
export declare function getCategories(props: any, childComponents: any, allStrings?: any): {
|
|
35
35
|
x: any;
|
|
36
36
|
y: any;
|
|
37
37
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-core",
|
|
3
|
-
"version": "36.6.
|
|
3
|
+
"version": "36.6.3",
|
|
4
4
|
"description": "Victory Core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data visualization",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"lodash": "^4.17.21",
|
|
24
24
|
"prop-types": "^15.8.1",
|
|
25
25
|
"react-fast-compare": "^3.2.0",
|
|
26
|
-
"victory-vendor": "^36.6.
|
|
26
|
+
"victory-vendor": "^36.6.3"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"react": ">=16.6.0"
|
|
@@ -55,7 +55,9 @@
|
|
|
55
55
|
"files": [
|
|
56
56
|
"src/**",
|
|
57
57
|
"!src/**/*.test.*",
|
|
58
|
-
"../../.babelrc.build.js"
|
|
58
|
+
"../../.babelrc.build.js",
|
|
59
|
+
"../../.babelrc.js",
|
|
60
|
+
"../../package-scripts.js"
|
|
59
61
|
],
|
|
60
62
|
"output": [
|
|
61
63
|
"es/**/*.js",
|
|
@@ -73,7 +75,9 @@
|
|
|
73
75
|
"files": [
|
|
74
76
|
"src/**",
|
|
75
77
|
"!src/**/*.test.*",
|
|
76
|
-
"../../.babelrc.build.js"
|
|
78
|
+
"../../.babelrc.build.js",
|
|
79
|
+
"../../.babelrc.js",
|
|
80
|
+
"../../package-scripts.js"
|
|
77
81
|
],
|
|
78
82
|
"output": [
|
|
79
83
|
"lib/**/*.js",
|
|
@@ -98,6 +102,8 @@
|
|
|
98
102
|
"src/**",
|
|
99
103
|
"!src/**/*.test.*",
|
|
100
104
|
"../../.babelrc.build.js",
|
|
105
|
+
"../../.babelrc.js",
|
|
106
|
+
"../../package-scripts.js",
|
|
101
107
|
"../../config/webpack.config.js",
|
|
102
108
|
"../../config/webpack.config.dev.js"
|
|
103
109
|
],
|
|
@@ -118,6 +124,8 @@
|
|
|
118
124
|
"src/**",
|
|
119
125
|
"!src/**/*.test.*",
|
|
120
126
|
"../../.babelrc.build.js",
|
|
127
|
+
"../../.babelrc.js",
|
|
128
|
+
"../../package-scripts.js",
|
|
121
129
|
"../../config/webpack.config.js"
|
|
122
130
|
],
|
|
123
131
|
"output": [
|
|
@@ -130,6 +138,14 @@
|
|
|
130
138
|
"pnpm-lock.yaml"
|
|
131
139
|
]
|
|
132
140
|
},
|
|
141
|
+
"check": {
|
|
142
|
+
"dependencies": [
|
|
143
|
+
"types:check",
|
|
144
|
+
"jest",
|
|
145
|
+
"format",
|
|
146
|
+
"lint"
|
|
147
|
+
]
|
|
148
|
+
},
|
|
133
149
|
"types:check": {
|
|
134
150
|
"command": "nps types:pkg:check",
|
|
135
151
|
"files": [
|
|
@@ -184,6 +200,19 @@
|
|
|
184
200
|
"pnpm-lock.yaml"
|
|
185
201
|
]
|
|
186
202
|
},
|
|
203
|
+
"format:fix": {
|
|
204
|
+
"command": "pnpm run format || nps format:pkg:fix",
|
|
205
|
+
"files": [
|
|
206
|
+
"src/**",
|
|
207
|
+
"*.json",
|
|
208
|
+
"../../.prettierignore",
|
|
209
|
+
"../../.prettierrc.json"
|
|
210
|
+
],
|
|
211
|
+
"output": [],
|
|
212
|
+
"packageLocks": [
|
|
213
|
+
"pnpm-lock.yaml"
|
|
214
|
+
]
|
|
215
|
+
},
|
|
187
216
|
"lint": {
|
|
188
217
|
"command": "nps lint:pkg",
|
|
189
218
|
"files": [
|
|
@@ -204,19 +233,6 @@
|
|
|
204
233
|
"pnpm-lock.yaml"
|
|
205
234
|
]
|
|
206
235
|
},
|
|
207
|
-
"format:fix": {
|
|
208
|
-
"command": "pnpm run format || nps format:pkg:fix",
|
|
209
|
-
"files": [
|
|
210
|
-
"src/**",
|
|
211
|
-
"*.json",
|
|
212
|
-
"../../.prettierignore",
|
|
213
|
-
"../../.prettierrc.json"
|
|
214
|
-
],
|
|
215
|
-
"output": [],
|
|
216
|
-
"packageLocks": [
|
|
217
|
-
"pnpm-lock.yaml"
|
|
218
|
-
]
|
|
219
|
-
},
|
|
220
236
|
"lint:fix": {
|
|
221
237
|
"command": "pnpm run lint || nps lint:pkg:fix",
|
|
222
238
|
"files": [
|
|
@@ -269,6 +285,7 @@
|
|
|
269
285
|
"build:dist": "wireit",
|
|
270
286
|
"build:dist:dev": "wireit",
|
|
271
287
|
"build:dist:min": "wireit",
|
|
288
|
+
"check": "wireit",
|
|
272
289
|
"types:check": "wireit",
|
|
273
290
|
"types:create": "wireit",
|
|
274
291
|
"format": "wireit",
|
package/src/types/callbacks.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface CallbackArgs {
|
|
|
13
13
|
data?: Datum[];
|
|
14
14
|
datum?: Datum;
|
|
15
15
|
horizontal?: boolean;
|
|
16
|
-
index
|
|
16
|
+
index?: ID;
|
|
17
17
|
x?: number;
|
|
18
18
|
y?: number;
|
|
19
19
|
scale?: {
|
|
@@ -51,3 +51,5 @@ export type PaddingOrCallback = number | BlockProps | VictoryPaddingCallback;
|
|
|
51
51
|
export type OrientationOrCallback =
|
|
52
52
|
| OrientationTypes
|
|
53
53
|
| VictoryOrientationCallback;
|
|
54
|
+
|
|
55
|
+
export type ValueOrCallback<TValue> = TValue | ((args: CallbackArgs) => TValue);
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
NumberOrCallback,
|
|
18
18
|
StringOrCallback,
|
|
19
19
|
StringOrNumberOrCallback,
|
|
20
|
+
ValueOrCallback,
|
|
20
21
|
} from "../types/callbacks";
|
|
21
22
|
import {
|
|
22
23
|
PaddingProps,
|
|
@@ -55,11 +56,11 @@ export interface VictoryLabelProps {
|
|
|
55
56
|
tabIndex?: NumberOrCallback;
|
|
56
57
|
text?: string[] | StringOrNumberOrCallback;
|
|
57
58
|
textComponent?: React.ReactElement;
|
|
58
|
-
textAnchor?: TextAnchorType
|
|
59
|
+
textAnchor?: ValueOrCallback<TextAnchorType>;
|
|
59
60
|
title?: string;
|
|
60
|
-
transform?: string | object
|
|
61
|
+
transform?: ValueOrCallback<string | object>;
|
|
61
62
|
tspanComponent?: React.ReactElement;
|
|
62
|
-
verticalAnchor?: VerticalAnchorType
|
|
63
|
+
verticalAnchor?: ValueOrCallback<VerticalAnchorType>;
|
|
63
64
|
x?: number;
|
|
64
65
|
y?: number;
|
|
65
66
|
dx?: StringOrNumberOrCallback;
|
|
@@ -63,7 +63,10 @@ export interface EventsMixinClass<TProps> {
|
|
|
63
63
|
getEventState: typeof Events.getEventState;
|
|
64
64
|
renderData(props: TProps);
|
|
65
65
|
renderContinuousData(props: TProps);
|
|
66
|
-
animateComponent(
|
|
66
|
+
animateComponent(
|
|
67
|
+
props: TProps,
|
|
68
|
+
defaultAnimationWhitelist: string[],
|
|
69
|
+
): React.ReactElement;
|
|
67
70
|
getComponentProps(
|
|
68
71
|
component: React.ReactElement,
|
|
69
72
|
type: string,
|
|
@@ -84,14 +87,47 @@ export interface EventMixinCalculatedValues {
|
|
|
84
87
|
events: unknown;
|
|
85
88
|
}
|
|
86
89
|
|
|
90
|
+
/**
|
|
91
|
+
* These are the common roles that we care about internally.
|
|
92
|
+
*/
|
|
93
|
+
export type VictoryComponentCommonRole =
|
|
94
|
+
| "container"
|
|
95
|
+
| "group"
|
|
96
|
+
| "histogram"
|
|
97
|
+
| "label"
|
|
98
|
+
| "line"
|
|
99
|
+
| "portal"
|
|
100
|
+
| "stack"
|
|
101
|
+
| "tooltip"
|
|
102
|
+
| "voronoi";
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* A component can have any "role",
|
|
106
|
+
* but there are certain ones that we actually care about internally
|
|
107
|
+
*/
|
|
108
|
+
export type VictoryComponentRole = VictoryComponentCommonRole | string;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Static component fields used by Victory for common behavior
|
|
112
|
+
*/
|
|
113
|
+
export interface VictoryComponentConfiguration<TProps> {
|
|
114
|
+
getBaseProps?(props: TProps): EventMixinCalculatedValues["baseProps"];
|
|
115
|
+
role?: VictoryComponentRole;
|
|
116
|
+
expectedComponents?: Array<keyof TProps | string>;
|
|
117
|
+
getChildren?: (
|
|
118
|
+
props: TProps,
|
|
119
|
+
childComponents?: Array<React.ReactNode>,
|
|
120
|
+
calculatedProps?: TProps,
|
|
121
|
+
) => void;
|
|
122
|
+
animationWhitelist?: Array<keyof TProps | string>;
|
|
123
|
+
}
|
|
124
|
+
|
|
87
125
|
/**
|
|
88
126
|
* This represents the class itself, including static fields
|
|
89
127
|
*/
|
|
90
|
-
export interface WrappedComponentClass<TProps>
|
|
128
|
+
export interface WrappedComponentClass<TProps>
|
|
129
|
+
extends VictoryComponentConfiguration<TProps> {
|
|
91
130
|
new (props: TProps): React.Component<TProps>;
|
|
92
|
-
getBaseProps?(props: TProps): EventMixinCalculatedValues["baseProps"];
|
|
93
|
-
role?: string;
|
|
94
|
-
expectedComponents?: string[];
|
|
95
131
|
}
|
|
96
132
|
|
|
97
133
|
export function addEvents<
|
|
@@ -366,7 +402,10 @@ export function addEvents<
|
|
|
366
402
|
return React.cloneElement(component, parentProps, children);
|
|
367
403
|
}
|
|
368
404
|
|
|
369
|
-
animateComponent(
|
|
405
|
+
animateComponent(
|
|
406
|
+
props: TProps,
|
|
407
|
+
defaultAnimationWhitelist: string[],
|
|
408
|
+
): React.ReactElement {
|
|
370
409
|
const animationWhitelist =
|
|
371
410
|
(typeof props.animate === "object" &&
|
|
372
411
|
props.animate?.animationWhitelist) ||
|
|
@@ -20,7 +20,8 @@ export interface ComponentEvent {
|
|
|
20
20
|
eventKey?: ComponentEventKey | ComponentEventKey[];
|
|
21
21
|
eventHandlers: ComponentEventHandlers;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
// Normally we'd use Template Literal Types, but we're avoiding it to maximize TS compatibility with TS < 4.1
|
|
24
|
+
export type ComponentEventName = string; // `on${Capitalize<string>}`;
|
|
24
25
|
export interface ComponentEventHandlers {
|
|
25
26
|
[k: ComponentEventName]: ComponentEventHandler;
|
|
26
27
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-use-before-define */
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { defaults, isFunction, property, pick, assign, keys } from "lodash";
|
|
4
|
+
import { CallbackArgs, ValueOrCallback } from "../types/callbacks";
|
|
4
5
|
|
|
5
6
|
// Private Functions
|
|
6
7
|
|
|
@@ -126,7 +127,10 @@ export function getStyles(style, defaultStyles) {
|
|
|
126
127
|
};
|
|
127
128
|
}
|
|
128
129
|
|
|
129
|
-
export function evaluateProp(
|
|
130
|
+
export function evaluateProp<TValue>(
|
|
131
|
+
prop: ValueOrCallback<TValue>,
|
|
132
|
+
props: CallbackArgs,
|
|
133
|
+
): TValue {
|
|
130
134
|
return isFunction(prop) ? prop(props) : prop;
|
|
131
135
|
}
|
|
132
136
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
2
|
+
import * as Collection from "./collection";
|
|
3
|
+
import { VictoryCommonProps } from "./common-props";
|
|
4
|
+
|
|
3
5
|
import type { DomainPropType, ScaleXYPropType } from "../types/prop-types";
|
|
4
6
|
|
|
5
7
|
// Private Functions
|
|
@@ -11,7 +11,8 @@ const USER_PROPS_SAFELIST = {
|
|
|
11
11
|
exactMatch: [] as string[],
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
// Normally we'd use Template Literal Types, but we're avoiding it to maximize TS compatibility with TS < 4.1
|
|
15
|
+
type SafeAttribute = string; // `data-${string}` | `aria-${string}`;
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* doesPropStartWith: Function that takes a prop's key and runs it against all
|
|
@@ -11,9 +11,9 @@ const defaultProviderProps = {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export function withContainer<Props extends VictoryCommonProps>(
|
|
14
|
-
WrappedComponent:
|
|
14
|
+
WrappedComponent: React.FC<Props>,
|
|
15
15
|
initialProviderProps: Partial<VictoryProviderProps> = {},
|
|
16
|
-
) {
|
|
16
|
+
): React.FC<Props> {
|
|
17
17
|
return (props: Props) => {
|
|
18
18
|
const providerProps = {
|
|
19
19
|
...defaultProviderProps,
|
|
@@ -449,7 +449,7 @@ export function getStringsFromChildren(props, childComponents) {
|
|
|
449
449
|
};
|
|
450
450
|
}
|
|
451
451
|
|
|
452
|
-
export function getCategories(props, childComponents, allStrings) {
|
|
452
|
+
export function getCategories(props, childComponents, allStrings?) {
|
|
453
453
|
const xPropCategories =
|
|
454
454
|
props.categories && !Array.isArray(props.categories)
|
|
455
455
|
? props.categories.x
|