victory-chart 36.4.1 → 36.5.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.
- package/dist/victory-chart.js +810 -771
- package/dist/victory-chart.min.js +1 -1
- package/es/helper-methods.d.ts +41 -0
- package/es/helper-methods.js +2 -3
- package/es/index.d.ts +2 -40
- package/es/index.js +2 -1
- package/es/v37/victory-chart.d.ts +25 -0
- package/es/v37/victory-chart.js +56 -0
- package/es/victory-chart.d.ts +27 -0
- package/es/victory-chart.js +9 -10
- package/lib/helper-methods.d.ts +41 -0
- package/lib/helper-methods.js +2 -1
- package/lib/index.d.ts +2 -40
- package/lib/index.js +12 -8
- package/lib/v37/victory-chart.d.ts +25 -0
- package/lib/v37/victory-chart.js +72 -0
- package/lib/victory-chart.d.ts +27 -0
- package/lib/victory-chart.js +11 -12
- package/package.json +7 -7
- package/src/{helper-methods.js → helper-methods.tsx} +18 -19
- package/src/index.ts +1 -0
- package/src/v37/victory-chart.tsx +89 -0
- package/src/{victory-chart.js → victory-chart.tsx} +61 -29
- package/src/index.d.ts +0 -40
- package/src/index.js +0 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare function getBackgroundWithProps(props: any, calculatedProps: any): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
3
|
+
export declare function getCalculatedProps(props: any, childComponents: any): {
|
|
4
|
+
categories: {
|
|
5
|
+
x: any;
|
|
6
|
+
y: any;
|
|
7
|
+
};
|
|
8
|
+
domain: {
|
|
9
|
+
x: any;
|
|
10
|
+
y: any;
|
|
11
|
+
};
|
|
12
|
+
range: {
|
|
13
|
+
x: any;
|
|
14
|
+
y: any;
|
|
15
|
+
};
|
|
16
|
+
horizontal: any;
|
|
17
|
+
scale: {
|
|
18
|
+
x: import("victory-core").D3Scale<any>;
|
|
19
|
+
y: import("victory-core").D3Scale<any>;
|
|
20
|
+
};
|
|
21
|
+
stringMap: {
|
|
22
|
+
x: any;
|
|
23
|
+
y: any;
|
|
24
|
+
};
|
|
25
|
+
style: {
|
|
26
|
+
parent: any;
|
|
27
|
+
};
|
|
28
|
+
origin: {
|
|
29
|
+
x: number | Date;
|
|
30
|
+
y: number | Date;
|
|
31
|
+
};
|
|
32
|
+
padding: {
|
|
33
|
+
top: any;
|
|
34
|
+
bottom: any;
|
|
35
|
+
left: any;
|
|
36
|
+
right: any;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export declare function getChildren(props: any, childComponents: any, calculatedProps: any): any;
|
|
40
|
+
export declare const getChildComponents: (props: any, defaultAxes?: any) => (string | number | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment | React.ReactPortal)[];
|
|
41
|
+
//# sourceMappingURL=helper-methods.d.ts.map
|
package/es/helper-methods.js
CHANGED
|
@@ -13,8 +13,6 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
13
13
|
|
|
14
14
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
15
15
|
|
|
16
|
-
/* eslint-disable func-style */
|
|
17
|
-
|
|
18
16
|
/* eslint-disable no-use-before-define */
|
|
19
17
|
import React from "react";
|
|
20
18
|
import { Helpers, Scale, Axis, Wrapper } from "victory-core";
|
|
@@ -220,4 +218,5 @@ var createStringMap = function (props, childComponents, allStrings) {
|
|
|
220
218
|
x: x,
|
|
221
219
|
y: y
|
|
222
220
|
};
|
|
223
|
-
};
|
|
221
|
+
};
|
|
222
|
+
//# sourceMappingURL=helper-methods.js.map
|
package/es/index.d.ts
CHANGED
|
@@ -1,40 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
CategoryPropType,
|
|
4
|
-
DomainPropType,
|
|
5
|
-
EventPropTypeInterface,
|
|
6
|
-
StringOrNumberOrCallback,
|
|
7
|
-
VictoryCommonProps,
|
|
8
|
-
VictoryStyleInterface,
|
|
9
|
-
VictoryStyleObject
|
|
10
|
-
} from "victory-core";
|
|
11
|
-
|
|
12
|
-
export type AxesType = {
|
|
13
|
-
dependent?: React.ReactElement;
|
|
14
|
-
independent?: React.ReactElement;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export interface VictoryChartProps extends VictoryCommonProps {
|
|
18
|
-
backgroundComponent?: React.ReactElement;
|
|
19
|
-
categories?: CategoryPropType;
|
|
20
|
-
children?: React.ReactNode | React.ReactNode[];
|
|
21
|
-
desc?: string;
|
|
22
|
-
defaultAxes?: AxesType;
|
|
23
|
-
defaultPolarAxes?: AxesType;
|
|
24
|
-
domain?: DomainPropType;
|
|
25
|
-
endAngle?: number;
|
|
26
|
-
eventKey?: StringOrNumberOrCallback;
|
|
27
|
-
events?: EventPropTypeInterface<
|
|
28
|
-
string,
|
|
29
|
-
string[] | number[] | string | number
|
|
30
|
-
>[];
|
|
31
|
-
innerRadius?: number;
|
|
32
|
-
prependDefaultAxes?: boolean;
|
|
33
|
-
startAngle?: number;
|
|
34
|
-
style?: Pick<VictoryStyleInterface, "parent"> & {
|
|
35
|
-
background?: VictoryStyleObject;
|
|
36
|
-
};
|
|
37
|
-
title?: string;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export class VictoryChart extends React.Component<VictoryChartProps, any> {}
|
|
1
|
+
export * from "./victory-chart";
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
package/es/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./victory-chart";
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CategoryPropType, DomainPropType, EventPropTypeInterface, StringOrNumberOrCallback, VictoryCommonProps, VictoryStyleInterface, VictoryStyleObject } from "victory-core";
|
|
3
|
+
import { AxesType } from "..";
|
|
4
|
+
interface VictoryChartProps extends VictoryCommonProps {
|
|
5
|
+
backgroundComponent?: React.ReactElement;
|
|
6
|
+
categories?: CategoryPropType;
|
|
7
|
+
children?: React.ReactNode | React.ReactNode[];
|
|
8
|
+
desc?: string;
|
|
9
|
+
defaultAxes?: AxesType;
|
|
10
|
+
defaultPolarAxes?: AxesType;
|
|
11
|
+
domain?: DomainPropType;
|
|
12
|
+
endAngle?: number;
|
|
13
|
+
eventKey?: StringOrNumberOrCallback;
|
|
14
|
+
events?: EventPropTypeInterface<string, string[] | number[] | string | number>[];
|
|
15
|
+
innerRadius?: number;
|
|
16
|
+
prependDefaultAxes?: boolean;
|
|
17
|
+
startAngle?: number;
|
|
18
|
+
style?: Pick<VictoryStyleInterface, "parent"> & {
|
|
19
|
+
background?: VictoryStyleObject;
|
|
20
|
+
};
|
|
21
|
+
title?: string;
|
|
22
|
+
}
|
|
23
|
+
declare const _default: (props: VictoryChartProps) => JSX.Element;
|
|
24
|
+
export default _default;
|
|
25
|
+
//# sourceMappingURL=victory-chart.d.ts.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
|
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import { withContainer, useDomain, useScale, useData } from "victory-core";
|
|
9
|
+
import { VictoryAxis } from "victory-axis";
|
|
10
|
+
var DEFAULT_AXES = {
|
|
11
|
+
independent: /*#__PURE__*/React.createElement(VictoryAxis, null),
|
|
12
|
+
dependent: /*#__PURE__*/React.createElement(VictoryAxis, {
|
|
13
|
+
dependentAxis: true
|
|
14
|
+
})
|
|
15
|
+
}; // TODO: This does not accept data
|
|
16
|
+
|
|
17
|
+
var VictoryChart = function (_ref) {
|
|
18
|
+
var _ref$defaultAxes = _ref.defaultAxes,
|
|
19
|
+
defaultAxes = _ref$defaultAxes === void 0 ? DEFAULT_AXES : _ref$defaultAxes,
|
|
20
|
+
_ref$groupComponent = _ref.groupComponent,
|
|
21
|
+
groupComponent = _ref$groupComponent === void 0 ? /*#__PURE__*/React.createElement("g", null) : _ref$groupComponent,
|
|
22
|
+
children = _ref.children;
|
|
23
|
+
var scale = useScale();
|
|
24
|
+
var data = useData();
|
|
25
|
+
var domain = useDomain();
|
|
26
|
+
var axes = React.useMemo(function () {
|
|
27
|
+
var _defaultAxes$DEFAULT_ = _objectSpread(_objectSpread({}, defaultAxes), DEFAULT_AXES),
|
|
28
|
+
dependent = _defaultAxes$DEFAULT_.dependent,
|
|
29
|
+
independent = _defaultAxes$DEFAULT_.independent;
|
|
30
|
+
|
|
31
|
+
var axisProps = {
|
|
32
|
+
data: data,
|
|
33
|
+
domain: domain,
|
|
34
|
+
// @ts-expect-error we need to fix this scale type
|
|
35
|
+
scale: scale,
|
|
36
|
+
standalone: false
|
|
37
|
+
};
|
|
38
|
+
return [/*#__PURE__*/React.cloneElement(dependent, _objectSpread(_objectSpread({}, axisProps), {}, {
|
|
39
|
+
key: "dependent-axis"
|
|
40
|
+
})), /*#__PURE__*/React.cloneElement(independent, _objectSpread(_objectSpread({}, axisProps), {}, {
|
|
41
|
+
key: "independent-axis"
|
|
42
|
+
}))];
|
|
43
|
+
}, [defaultAxes, domain, scale, data]);
|
|
44
|
+
var childComponents = React.Children.map(children, function (child, index) {
|
|
45
|
+
// @ts-expect-error Why is this throwing a type error?
|
|
46
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
47
|
+
key: "child-".concat(index),
|
|
48
|
+
index: index,
|
|
49
|
+
standalone: false
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
return /*#__PURE__*/React.cloneElement(groupComponent, {}, axes, childComponents);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default withContainer(VictoryChart);
|
|
56
|
+
//# sourceMappingURL=victory-chart.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CategoryPropType, DomainPropType, EventPropTypeInterface, StringOrNumberOrCallback, VictoryCommonProps, VictoryStyleInterface, VictoryStyleObject } from "victory-core";
|
|
3
|
+
export declare const VictoryChart: React.NamedExoticComponent<VictoryChartProps>;
|
|
4
|
+
export declare type AxesType = {
|
|
5
|
+
dependent?: React.ReactElement | null;
|
|
6
|
+
independent?: React.ReactElement | null;
|
|
7
|
+
};
|
|
8
|
+
export interface VictoryChartProps extends VictoryCommonProps {
|
|
9
|
+
backgroundComponent?: React.ReactElement;
|
|
10
|
+
categories?: CategoryPropType;
|
|
11
|
+
children?: React.ReactNode | React.ReactNode[];
|
|
12
|
+
desc?: string;
|
|
13
|
+
defaultAxes?: AxesType;
|
|
14
|
+
defaultPolarAxes?: AxesType;
|
|
15
|
+
domain?: DomainPropType;
|
|
16
|
+
endAngle?: number;
|
|
17
|
+
eventKey?: StringOrNumberOrCallback;
|
|
18
|
+
events?: EventPropTypeInterface<string, string[] | number[] | string | number>[];
|
|
19
|
+
innerRadius?: number;
|
|
20
|
+
prependDefaultAxes?: boolean;
|
|
21
|
+
startAngle?: number;
|
|
22
|
+
style?: Pick<VictoryStyleInterface, "parent"> & {
|
|
23
|
+
background?: VictoryStyleObject;
|
|
24
|
+
};
|
|
25
|
+
title?: string;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=victory-chart.d.ts.map
|
package/es/victory-chart.js
CHANGED
|
@@ -22,7 +22,7 @@ var fallbackProps = {
|
|
|
22
22
|
padding: 50
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
var
|
|
25
|
+
var VictoryChartImpl = function (initialProps) {
|
|
26
26
|
var role = "chart";
|
|
27
27
|
|
|
28
28
|
var _Hooks$useAnimationSt = Hooks.useAnimationState(),
|
|
@@ -55,7 +55,6 @@ var VictoryChart = function (initialProps) {
|
|
|
55
55
|
scale = calculatedProps.scale,
|
|
56
56
|
style = calculatedProps.style,
|
|
57
57
|
origin = calculatedProps.origin,
|
|
58
|
-
radius = calculatedProps.radius,
|
|
59
58
|
horizontal = calculatedProps.horizontal;
|
|
60
59
|
var newChildren = React.useMemo(function () {
|
|
61
60
|
var children = getChildren(props, childComponents, calculatedProps);
|
|
@@ -85,7 +84,6 @@ var VictoryChart = function (initialProps) {
|
|
|
85
84
|
name: name,
|
|
86
85
|
origin: polar ? origin : undefined,
|
|
87
86
|
polar: polar,
|
|
88
|
-
radius: radius,
|
|
89
87
|
theme: theme,
|
|
90
88
|
title: title,
|
|
91
89
|
scale: scale,
|
|
@@ -95,7 +93,7 @@ var VictoryChart = function (initialProps) {
|
|
|
95
93
|
}
|
|
96
94
|
|
|
97
95
|
return {};
|
|
98
|
-
}, [desc, domain, height, horizontal, name, origin, polar,
|
|
96
|
+
}, [desc, domain, height, horizontal, name, origin, polar, scale, standalone, style, title, theme, width]);
|
|
99
97
|
var container = React.useMemo(function () {
|
|
100
98
|
if (standalone) {
|
|
101
99
|
var defaultContainerProps = _defaults({}, containerComponent.props, containerProps, UserProps.getSafeUserProps(initialProps));
|
|
@@ -130,7 +128,7 @@ var VictoryChart = function (initialProps) {
|
|
|
130
128
|
return /*#__PURE__*/React.cloneElement(container, container.props, newChildren);
|
|
131
129
|
};
|
|
132
130
|
|
|
133
|
-
|
|
131
|
+
VictoryChartImpl.propTypes = _objectSpread(_objectSpread({}, CommonProps.baseProps), {}, {
|
|
134
132
|
backgroundComponent: PropTypes.element,
|
|
135
133
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
|
|
136
134
|
defaultAxes: PropTypes.shape({
|
|
@@ -146,7 +144,7 @@ VictoryChart.propTypes = _objectSpread(_objectSpread({}, CommonProps.baseProps),
|
|
|
146
144
|
prependDefaultAxes: PropTypes.bool,
|
|
147
145
|
startAngle: PropTypes.number
|
|
148
146
|
});
|
|
149
|
-
|
|
147
|
+
VictoryChartImpl.defaultProps = {
|
|
150
148
|
backgroundComponent: /*#__PURE__*/React.createElement(Background, null),
|
|
151
149
|
containerComponent: /*#__PURE__*/React.createElement(VictoryContainer, null),
|
|
152
150
|
defaultAxes: {
|
|
@@ -165,7 +163,8 @@ VictoryChart.defaultProps = {
|
|
|
165
163
|
standalone: true,
|
|
166
164
|
theme: VictoryTheme.grayscale
|
|
167
165
|
};
|
|
168
|
-
var
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
166
|
+
export var VictoryChart = /*#__PURE__*/React.memo(VictoryChartImpl, isEqual);
|
|
167
|
+
VictoryChart.displayName = "VictoryChart"; // @ts-expect-error FIXME: Does this "expectedComponents" do anything?
|
|
168
|
+
|
|
169
|
+
VictoryChart.expectedComponents = ["groupComponent", "containerComponent"];
|
|
170
|
+
//# sourceMappingURL=victory-chart.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare function getBackgroundWithProps(props: any, calculatedProps: any): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
3
|
+
export declare function getCalculatedProps(props: any, childComponents: any): {
|
|
4
|
+
categories: {
|
|
5
|
+
x: any;
|
|
6
|
+
y: any;
|
|
7
|
+
};
|
|
8
|
+
domain: {
|
|
9
|
+
x: any;
|
|
10
|
+
y: any;
|
|
11
|
+
};
|
|
12
|
+
range: {
|
|
13
|
+
x: any;
|
|
14
|
+
y: any;
|
|
15
|
+
};
|
|
16
|
+
horizontal: any;
|
|
17
|
+
scale: {
|
|
18
|
+
x: import("victory-core").D3Scale<any>;
|
|
19
|
+
y: import("victory-core").D3Scale<any>;
|
|
20
|
+
};
|
|
21
|
+
stringMap: {
|
|
22
|
+
x: any;
|
|
23
|
+
y: any;
|
|
24
|
+
};
|
|
25
|
+
style: {
|
|
26
|
+
parent: any;
|
|
27
|
+
};
|
|
28
|
+
origin: {
|
|
29
|
+
x: number | Date;
|
|
30
|
+
y: number | Date;
|
|
31
|
+
};
|
|
32
|
+
padding: {
|
|
33
|
+
top: any;
|
|
34
|
+
bottom: any;
|
|
35
|
+
left: any;
|
|
36
|
+
right: any;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export declare function getChildren(props: any, childComponents: any, calculatedProps: any): any;
|
|
40
|
+
export declare const getChildComponents: (props: any, defaultAxes?: any) => (string | number | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment | React.ReactPortal)[];
|
|
41
|
+
//# sourceMappingURL=helper-methods.d.ts.map
|
package/lib/helper-methods.js
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -1,40 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
CategoryPropType,
|
|
4
|
-
DomainPropType,
|
|
5
|
-
EventPropTypeInterface,
|
|
6
|
-
StringOrNumberOrCallback,
|
|
7
|
-
VictoryCommonProps,
|
|
8
|
-
VictoryStyleInterface,
|
|
9
|
-
VictoryStyleObject
|
|
10
|
-
} from "victory-core";
|
|
11
|
-
|
|
12
|
-
export type AxesType = {
|
|
13
|
-
dependent?: React.ReactElement;
|
|
14
|
-
independent?: React.ReactElement;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export interface VictoryChartProps extends VictoryCommonProps {
|
|
18
|
-
backgroundComponent?: React.ReactElement;
|
|
19
|
-
categories?: CategoryPropType;
|
|
20
|
-
children?: React.ReactNode | React.ReactNode[];
|
|
21
|
-
desc?: string;
|
|
22
|
-
defaultAxes?: AxesType;
|
|
23
|
-
defaultPolarAxes?: AxesType;
|
|
24
|
-
domain?: DomainPropType;
|
|
25
|
-
endAngle?: number;
|
|
26
|
-
eventKey?: StringOrNumberOrCallback;
|
|
27
|
-
events?: EventPropTypeInterface<
|
|
28
|
-
string,
|
|
29
|
-
string[] | number[] | string | number
|
|
30
|
-
>[];
|
|
31
|
-
innerRadius?: number;
|
|
32
|
-
prependDefaultAxes?: boolean;
|
|
33
|
-
startAngle?: number;
|
|
34
|
-
style?: Pick<VictoryStyleInterface, "parent"> & {
|
|
35
|
-
background?: VictoryStyleObject;
|
|
36
|
-
};
|
|
37
|
-
title?: string;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export class VictoryChart extends React.Component<VictoryChartProps, any> {}
|
|
1
|
+
export * from "./victory-chart";
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
CHANGED
|
@@ -3,13 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "VictoryChart", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _victoryChart.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
6
|
|
|
13
|
-
var _victoryChart =
|
|
7
|
+
var _victoryChart = require("./victory-chart");
|
|
14
8
|
|
|
15
|
-
function
|
|
9
|
+
Object.keys(_victoryChart).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _victoryChart[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _victoryChart[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CategoryPropType, DomainPropType, EventPropTypeInterface, StringOrNumberOrCallback, VictoryCommonProps, VictoryStyleInterface, VictoryStyleObject } from "victory-core";
|
|
3
|
+
import { AxesType } from "..";
|
|
4
|
+
interface VictoryChartProps extends VictoryCommonProps {
|
|
5
|
+
backgroundComponent?: React.ReactElement;
|
|
6
|
+
categories?: CategoryPropType;
|
|
7
|
+
children?: React.ReactNode | React.ReactNode[];
|
|
8
|
+
desc?: string;
|
|
9
|
+
defaultAxes?: AxesType;
|
|
10
|
+
defaultPolarAxes?: AxesType;
|
|
11
|
+
domain?: DomainPropType;
|
|
12
|
+
endAngle?: number;
|
|
13
|
+
eventKey?: StringOrNumberOrCallback;
|
|
14
|
+
events?: EventPropTypeInterface<string, string[] | number[] | string | number>[];
|
|
15
|
+
innerRadius?: number;
|
|
16
|
+
prependDefaultAxes?: boolean;
|
|
17
|
+
startAngle?: number;
|
|
18
|
+
style?: Pick<VictoryStyleInterface, "parent"> & {
|
|
19
|
+
background?: VictoryStyleObject;
|
|
20
|
+
};
|
|
21
|
+
title?: string;
|
|
22
|
+
}
|
|
23
|
+
declare const _default: (props: VictoryChartProps) => JSX.Element;
|
|
24
|
+
export default _default;
|
|
25
|
+
//# sourceMappingURL=victory-chart.d.ts.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _victoryCore = require("victory-core");
|
|
11
|
+
|
|
12
|
+
var _victoryAxis = require("victory-axis");
|
|
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; }
|
|
17
|
+
|
|
18
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
+
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
+
|
|
22
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
+
|
|
24
|
+
var DEFAULT_AXES = {
|
|
25
|
+
independent: /*#__PURE__*/React.createElement(_victoryAxis.VictoryAxis, null),
|
|
26
|
+
dependent: /*#__PURE__*/React.createElement(_victoryAxis.VictoryAxis, {
|
|
27
|
+
dependentAxis: true
|
|
28
|
+
})
|
|
29
|
+
}; // TODO: This does not accept data
|
|
30
|
+
|
|
31
|
+
var VictoryChart = function (_ref) {
|
|
32
|
+
var _ref$defaultAxes = _ref.defaultAxes,
|
|
33
|
+
defaultAxes = _ref$defaultAxes === void 0 ? DEFAULT_AXES : _ref$defaultAxes,
|
|
34
|
+
_ref$groupComponent = _ref.groupComponent,
|
|
35
|
+
groupComponent = _ref$groupComponent === void 0 ? /*#__PURE__*/React.createElement("g", null) : _ref$groupComponent,
|
|
36
|
+
children = _ref.children;
|
|
37
|
+
var scale = (0, _victoryCore.useScale)();
|
|
38
|
+
var data = (0, _victoryCore.useData)();
|
|
39
|
+
var domain = (0, _victoryCore.useDomain)();
|
|
40
|
+
var axes = React.useMemo(function () {
|
|
41
|
+
var _defaultAxes$DEFAULT_ = _objectSpread(_objectSpread({}, defaultAxes), DEFAULT_AXES),
|
|
42
|
+
dependent = _defaultAxes$DEFAULT_.dependent,
|
|
43
|
+
independent = _defaultAxes$DEFAULT_.independent;
|
|
44
|
+
|
|
45
|
+
var axisProps = {
|
|
46
|
+
data: data,
|
|
47
|
+
domain: domain,
|
|
48
|
+
// @ts-expect-error we need to fix this scale type
|
|
49
|
+
scale: scale,
|
|
50
|
+
standalone: false
|
|
51
|
+
};
|
|
52
|
+
return [/*#__PURE__*/React.cloneElement(dependent, _objectSpread(_objectSpread({}, axisProps), {}, {
|
|
53
|
+
key: "dependent-axis"
|
|
54
|
+
})), /*#__PURE__*/React.cloneElement(independent, _objectSpread(_objectSpread({}, axisProps), {}, {
|
|
55
|
+
key: "independent-axis"
|
|
56
|
+
}))];
|
|
57
|
+
}, [defaultAxes, domain, scale, data]);
|
|
58
|
+
var childComponents = React.Children.map(children, function (child, index) {
|
|
59
|
+
// @ts-expect-error Why is this throwing a type error?
|
|
60
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
61
|
+
key: "child-".concat(index),
|
|
62
|
+
index: index,
|
|
63
|
+
standalone: false
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
return /*#__PURE__*/React.cloneElement(groupComponent, {}, axes, childComponents);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
var _default = (0, _victoryCore.withContainer)(VictoryChart);
|
|
70
|
+
|
|
71
|
+
exports.default = _default;
|
|
72
|
+
//# sourceMappingURL=victory-chart.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CategoryPropType, DomainPropType, EventPropTypeInterface, StringOrNumberOrCallback, VictoryCommonProps, VictoryStyleInterface, VictoryStyleObject } from "victory-core";
|
|
3
|
+
export declare const VictoryChart: React.NamedExoticComponent<VictoryChartProps>;
|
|
4
|
+
export declare type AxesType = {
|
|
5
|
+
dependent?: React.ReactElement | null;
|
|
6
|
+
independent?: React.ReactElement | null;
|
|
7
|
+
};
|
|
8
|
+
export interface VictoryChartProps extends VictoryCommonProps {
|
|
9
|
+
backgroundComponent?: React.ReactElement;
|
|
10
|
+
categories?: CategoryPropType;
|
|
11
|
+
children?: React.ReactNode | React.ReactNode[];
|
|
12
|
+
desc?: string;
|
|
13
|
+
defaultAxes?: AxesType;
|
|
14
|
+
defaultPolarAxes?: AxesType;
|
|
15
|
+
domain?: DomainPropType;
|
|
16
|
+
endAngle?: number;
|
|
17
|
+
eventKey?: StringOrNumberOrCallback;
|
|
18
|
+
events?: EventPropTypeInterface<string, string[] | number[] | string | number>[];
|
|
19
|
+
innerRadius?: number;
|
|
20
|
+
prependDefaultAxes?: boolean;
|
|
21
|
+
startAngle?: number;
|
|
22
|
+
style?: Pick<VictoryStyleInterface, "parent"> & {
|
|
23
|
+
background?: VictoryStyleObject;
|
|
24
|
+
};
|
|
25
|
+
title?: string;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=victory-chart.d.ts.map
|
package/lib/victory-chart.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.VictoryChart = void 0;
|
|
7
7
|
|
|
8
8
|
var _isEmpty2 = _interopRequireDefault(require("lodash/isEmpty"));
|
|
9
9
|
|
|
@@ -41,7 +41,7 @@ var fallbackProps = {
|
|
|
41
41
|
padding: 50
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
var
|
|
44
|
+
var VictoryChartImpl = function (initialProps) {
|
|
45
45
|
var role = "chart";
|
|
46
46
|
|
|
47
47
|
var _Hooks$useAnimationSt = _victoryCore.Hooks.useAnimationState(),
|
|
@@ -79,7 +79,6 @@ var VictoryChart = function (initialProps) {
|
|
|
79
79
|
scale = calculatedProps.scale,
|
|
80
80
|
style = calculatedProps.style,
|
|
81
81
|
origin = calculatedProps.origin,
|
|
82
|
-
radius = calculatedProps.radius,
|
|
83
82
|
horizontal = calculatedProps.horizontal;
|
|
84
83
|
|
|
85
84
|
var newChildren = _react.default.useMemo(function () {
|
|
@@ -110,7 +109,6 @@ var VictoryChart = function (initialProps) {
|
|
|
110
109
|
name: name,
|
|
111
110
|
origin: polar ? origin : undefined,
|
|
112
111
|
polar: polar,
|
|
113
|
-
radius: radius,
|
|
114
112
|
theme: theme,
|
|
115
113
|
title: title,
|
|
116
114
|
scale: scale,
|
|
@@ -120,7 +118,7 @@ var VictoryChart = function (initialProps) {
|
|
|
120
118
|
}
|
|
121
119
|
|
|
122
120
|
return {};
|
|
123
|
-
}, [desc, domain, height, horizontal, name, origin, polar,
|
|
121
|
+
}, [desc, domain, height, horizontal, name, origin, polar, scale, standalone, style, title, theme, width]);
|
|
124
122
|
|
|
125
123
|
var container = _react.default.useMemo(function () {
|
|
126
124
|
if (standalone) {
|
|
@@ -158,7 +156,7 @@ var VictoryChart = function (initialProps) {
|
|
|
158
156
|
return /*#__PURE__*/_react.default.cloneElement(container, container.props, newChildren);
|
|
159
157
|
};
|
|
160
158
|
|
|
161
|
-
|
|
159
|
+
VictoryChartImpl.propTypes = _objectSpread(_objectSpread({}, _victoryCore.CommonProps.baseProps), {}, {
|
|
162
160
|
backgroundComponent: _propTypes.default.element,
|
|
163
161
|
children: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.node), _propTypes.default.node]),
|
|
164
162
|
defaultAxes: _propTypes.default.shape({
|
|
@@ -174,7 +172,7 @@ VictoryChart.propTypes = _objectSpread(_objectSpread({}, _victoryCore.CommonProp
|
|
|
174
172
|
prependDefaultAxes: _propTypes.default.bool,
|
|
175
173
|
startAngle: _propTypes.default.number
|
|
176
174
|
});
|
|
177
|
-
|
|
175
|
+
VictoryChartImpl.defaultProps = {
|
|
178
176
|
backgroundComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.Background, null),
|
|
179
177
|
containerComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryContainer, null),
|
|
180
178
|
defaultAxes: {
|
|
@@ -194,9 +192,10 @@ VictoryChart.defaultProps = {
|
|
|
194
192
|
theme: _victoryCore.VictoryTheme.grayscale
|
|
195
193
|
};
|
|
196
194
|
|
|
197
|
-
var
|
|
195
|
+
var VictoryChart = /*#__PURE__*/_react.default.memo(VictoryChartImpl, _reactFastCompare.default);
|
|
198
196
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
197
|
+
exports.VictoryChart = VictoryChart;
|
|
198
|
+
VictoryChart.displayName = "VictoryChart"; // @ts-expect-error FIXME: Does this "expectedComponents" do anything?
|
|
199
|
+
|
|
200
|
+
VictoryChart.expectedComponents = ["groupComponent", "containerComponent"];
|
|
201
|
+
//# sourceMappingURL=victory-chart.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-chart",
|
|
3
|
-
"version": "36.
|
|
3
|
+
"version": "36.5.2",
|
|
4
4
|
"description": "Chart Component for Victory",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data visualization",
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
"lodash": "^4.17.19",
|
|
23
23
|
"prop-types": "^15.8.1",
|
|
24
24
|
"react-fast-compare": "^3.2.0",
|
|
25
|
-
"victory-axis": "^36.
|
|
26
|
-
"victory-core": "^36.
|
|
27
|
-
"victory-polar-axis": "^36.
|
|
28
|
-
"victory-shared-events": "^36.
|
|
25
|
+
"victory-axis": "^36.5.2",
|
|
26
|
+
"victory-core": "^36.5.2",
|
|
27
|
+
"victory-polar-axis": "^36.5.2",
|
|
28
|
+
"victory-shared-events": "^36.5.2"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"react": "
|
|
31
|
+
"react": ">=16.6.0"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"version": "yarn run nps build-libs && nps build-dists"
|
|
35
35
|
},
|
|
36
36
|
"sideEffects": false,
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "def218e9749ecafc159ef458dd03a8b92e227666"
|
|
38
38
|
}
|