victory-core 36.3.2 → 36.5.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.
- package/dist/victory-core.js +15084 -15018
- package/dist/victory-core.min.js +1 -1
- package/es/index.d.ts +38 -941
- package/es/index.js +19 -28
- package/es/types.d.ts +33 -0
- package/es/types.js +1 -0
- package/es/victory-accessible-group/victory-accessible-group.d.ts +25 -0
- package/es/victory-accessible-group/victory-accessible-group.js +35 -45
- package/es/victory-animation/util.d.ts +66 -0
- package/es/victory-animation/util.js +3 -2
- package/es/victory-animation/victory-animation.d.ts +69 -0
- package/es/victory-animation/victory-animation.js +92 -102
- package/es/victory-clip-container/victory-clip-container.d.ts +76 -0
- package/es/victory-clip-container/victory-clip-container.js +75 -82
- package/es/victory-container/victory-container.d.ts +99 -0
- package/es/victory-container/victory-container.js +97 -107
- package/es/victory-label/victory-label.d.ts +61 -0
- package/es/victory-label/victory-label.js +43 -31
- package/es/victory-portal/portal-context.d.ts +11 -0
- package/es/victory-portal/portal-context.js +3 -4
- package/es/victory-portal/portal.d.ts +28 -0
- package/es/victory-portal/portal.js +44 -50
- package/es/victory-portal/victory-portal.d.ts +31 -0
- package/es/victory-portal/victory-portal.js +38 -47
- package/es/victory-primitives/arc.d.ts +21 -0
- package/es/victory-primitives/arc.js +9 -9
- package/es/victory-primitives/background.d.ts +22 -0
- package/es/victory-primitives/background.js +12 -12
- package/es/victory-primitives/border.d.ts +18 -0
- package/es/victory-primitives/border.js +9 -9
- package/es/victory-primitives/circle.d.ts +2 -0
- package/es/victory-primitives/circle.js +17 -10
- package/es/victory-primitives/clip-path.d.ts +14 -0
- package/es/victory-primitives/clip-path.js +6 -6
- package/es/victory-primitives/index.d.ts +14 -0
- package/es/victory-primitives/index.js +14 -0
- package/es/victory-primitives/line-segment.d.ts +19 -0
- package/es/victory-primitives/line-segment.js +9 -9
- package/es/victory-primitives/line.d.ts +2 -0
- package/es/victory-primitives/line.js +17 -10
- package/es/victory-primitives/path.d.ts +2 -0
- package/es/victory-primitives/path.js +15 -8
- package/es/victory-primitives/point.d.ts +21 -0
- package/es/victory-primitives/point.js +15 -23
- package/es/victory-primitives/rect.d.ts +2 -0
- package/es/victory-primitives/rect.js +17 -10
- package/es/victory-primitives/text.d.ts +16 -0
- package/es/victory-primitives/text.js +13 -8
- package/es/victory-primitives/tspan.d.ts +2 -0
- package/es/victory-primitives/tspan.js +7 -6
- package/es/victory-primitives/types.d.ts +7 -0
- package/es/victory-primitives/types.js +1 -0
- package/es/victory-primitives/whisker.d.ts +24 -0
- package/es/victory-primitives/whisker.js +12 -12
- package/es/victory-theme/grayscale.d.ts +2 -0
- package/es/victory-theme/grayscale.js +1 -1
- package/es/victory-theme/material.d.ts +2 -0
- package/es/victory-theme/material.js +1 -1
- package/es/victory-theme/victory-theme-definition.d.ts +244 -0
- package/es/victory-theme/victory-theme-definition.js +1 -0
- package/es/victory-theme/victory-theme.d.ts +5 -0
- package/es/victory-theme/victory-theme.js +6 -5
- package/es/victory-transition/victory-transition.d.ts +59 -0
- package/es/victory-transition/victory-transition.js +38 -44
- package/es/victory-util/add-events.js +328 -319
- package/es/victory-util/axis.js +12 -6
- package/es/victory-util/collection.js +7 -5
- package/es/victory-util/common-props.js +2 -2
- package/es/victory-util/data.js +8 -6
- package/es/victory-util/default-transitions.js +0 -1
- package/es/victory-util/domain.js +7 -5
- package/es/victory-util/events.js +8 -4
- package/es/victory-util/helpers.js +1 -3
- package/es/victory-util/hooks/use-animation-state.js +11 -5
- package/es/victory-util/immutable.js +0 -1
- package/es/victory-util/label-helpers.js +0 -2
- package/es/victory-util/line-helpers.js +1 -1
- package/es/victory-util/log.js +0 -1
- package/es/victory-util/point-path-helpers.d.ts +9 -0
- package/es/victory-util/point-path-helpers.js +59 -61
- package/es/victory-util/scale.js +19 -19
- package/es/victory-util/selection.d.ts +23 -0
- package/es/victory-util/selection.js +0 -2
- package/es/victory-util/style.js +0 -2
- package/es/victory-util/textsize.d.ts +8 -0
- package/es/victory-util/textsize.js +11 -7
- package/es/victory-util/timer-context.d.ts +11 -0
- package/es/victory-util/timer-context.js +1 -1
- package/es/victory-util/timer.d.ts +16 -0
- package/es/victory-util/timer.js +16 -13
- package/es/victory-util/types.d.ts +188 -0
- package/es/victory-util/types.js +1 -0
- package/es/victory-util/user-props.js +44 -4
- package/es/victory-util/wrapper.js +18 -12
- package/lib/index.d.ts +38 -941
- package/lib/index.js +201 -189
- package/lib/types.d.ts +33 -0
- package/lib/types.js +1 -0
- package/lib/victory-accessible-group/victory-accessible-group.d.ts +25 -0
- package/lib/victory-accessible-group/victory-accessible-group.js +37 -45
- package/lib/victory-animation/util.d.ts +66 -0
- package/lib/victory-animation/util.js +4 -3
- package/lib/victory-animation/victory-animation.d.ts +69 -0
- package/lib/victory-animation/victory-animation.js +97 -102
- package/lib/victory-clip-container/victory-clip-container.d.ts +76 -0
- package/lib/victory-clip-container/victory-clip-container.js +81 -82
- package/lib/victory-container/victory-container.d.ts +99 -0
- package/lib/victory-container/victory-container.js +102 -107
- package/lib/victory-label/victory-label.d.ts +61 -0
- package/lib/victory-label/victory-label.js +49 -32
- package/lib/victory-portal/portal-context.d.ts +11 -0
- package/lib/victory-portal/portal-context.js +4 -5
- package/lib/victory-portal/portal.d.ts +28 -0
- package/lib/victory-portal/portal.js +49 -50
- package/lib/victory-portal/victory-portal.d.ts +31 -0
- package/lib/victory-portal/victory-portal.js +43 -47
- package/lib/victory-primitives/arc.d.ts +21 -0
- package/lib/victory-primitives/arc.js +13 -10
- package/lib/victory-primitives/background.d.ts +22 -0
- package/lib/victory-primitives/background.js +16 -13
- package/lib/victory-primitives/border.d.ts +18 -0
- package/lib/victory-primitives/border.js +13 -10
- package/lib/victory-primitives/circle.d.ts +2 -0
- package/lib/victory-primitives/circle.js +17 -8
- package/lib/victory-primitives/clip-path.d.ts +14 -0
- package/lib/victory-primitives/clip-path.js +7 -5
- package/lib/victory-primitives/index.d.ts +14 -0
- package/lib/victory-primitives/index.js +187 -0
- package/lib/victory-primitives/line-segment.d.ts +19 -0
- package/lib/victory-primitives/line-segment.js +13 -10
- package/lib/victory-primitives/line.d.ts +2 -0
- package/lib/victory-primitives/line.js +17 -8
- package/lib/victory-primitives/path.d.ts +2 -0
- package/lib/victory-primitives/path.js +15 -6
- package/lib/victory-primitives/point.d.ts +21 -0
- package/lib/victory-primitives/point.js +21 -25
- package/lib/victory-primitives/rect.d.ts +2 -0
- package/lib/victory-primitives/rect.js +17 -8
- package/lib/victory-primitives/text.d.ts +16 -0
- package/lib/victory-primitives/text.js +14 -7
- package/lib/victory-primitives/tspan.d.ts +2 -0
- package/lib/victory-primitives/tspan.js +7 -4
- package/lib/victory-primitives/types.d.ts +7 -0
- package/lib/victory-primitives/types.js +1 -0
- package/lib/victory-primitives/whisker.d.ts +24 -0
- package/lib/victory-primitives/whisker.js +16 -13
- package/lib/victory-theme/grayscale.d.ts +2 -0
- package/lib/victory-theme/grayscale.js +3 -3
- package/lib/victory-theme/material.d.ts +2 -0
- package/lib/victory-theme/material.js +3 -3
- package/lib/victory-theme/victory-theme-definition.d.ts +244 -0
- package/lib/victory-theme/victory-theme-definition.js +1 -0
- package/lib/victory-theme/victory-theme.d.ts +5 -0
- package/lib/victory-theme/victory-theme.js +22 -8
- package/lib/victory-transition/victory-transition.d.ts +59 -0
- package/lib/victory-transition/victory-transition.js +43 -45
- package/lib/victory-util/add-events.js +326 -316
- package/lib/victory-util/axis.js +20 -11
- package/lib/victory-util/collection.js +10 -8
- package/lib/victory-util/common-props.js +6 -4
- package/lib/victory-util/data.js +13 -7
- package/lib/victory-util/default-transitions.js +1 -2
- package/lib/victory-util/domain.js +11 -5
- package/lib/victory-util/events.js +17 -11
- package/lib/victory-util/helpers.js +14 -16
- package/lib/victory-util/hooks/index.js +4 -4
- package/lib/victory-util/hooks/use-animation-state.js +14 -6
- package/lib/victory-util/immutable.js +3 -5
- package/lib/victory-util/label-helpers.js +6 -6
- package/lib/victory-util/line-helpers.js +4 -2
- package/lib/victory-util/log.js +0 -1
- package/lib/victory-util/point-path-helpers.d.ts +9 -0
- package/lib/victory-util/point-path-helpers.js +86 -73
- package/lib/victory-util/prop-types.js +5 -3
- package/lib/victory-util/scale.js +24 -21
- package/lib/victory-util/selection.d.ts +23 -0
- package/lib/victory-util/selection.js +5 -5
- package/lib/victory-util/style.js +0 -2
- package/lib/victory-util/textsize.d.ts +8 -0
- package/lib/victory-util/textsize.js +12 -8
- package/lib/victory-util/timer-context.d.ts +11 -0
- package/lib/victory-util/timer-context.js +1 -1
- package/lib/victory-util/timer.d.ts +16 -0
- package/lib/victory-util/timer.js +16 -13
- package/lib/victory-util/types.d.ts +188 -0
- package/lib/victory-util/types.js +1 -0
- package/lib/victory-util/user-props.js +53 -6
- package/lib/victory-util/wrapper.js +31 -23
- package/package.json +6 -13
- package/src/index.ts +42 -0
- package/src/types.ts +45 -0
- package/src/victory-accessible-group/{victory-accessible-group.js → victory-accessible-group.tsx} +10 -3
- package/src/victory-animation/{util.js → util.ts} +5 -4
- package/src/victory-animation/{victory-animation.js → victory-animation.tsx} +90 -13
- package/src/victory-clip-container/{victory-clip-container.js → victory-clip-container.tsx} +32 -6
- package/src/victory-container/{victory-container.js → victory-container.tsx} +70 -26
- package/src/victory-label/{victory-label.js → victory-label.tsx} +80 -19
- package/src/victory-portal/portal-context.ts +14 -0
- package/src/victory-portal/{portal.js → portal.tsx} +23 -12
- package/src/victory-portal/{victory-portal.js → victory-portal.tsx} +21 -6
- package/src/victory-primitives/{arc.js → arc.tsx} +15 -5
- package/src/victory-primitives/{background.js → background.tsx} +17 -7
- package/src/victory-primitives/{border.js → border.tsx} +12 -5
- package/src/victory-primitives/{circle.js → circle.tsx} +4 -3
- package/src/victory-primitives/clip-path.tsx +25 -0
- package/src/victory-primitives/index.ts +14 -0
- package/src/victory-primitives/{line-segment.js → line-segment.tsx} +13 -5
- package/src/victory-primitives/{line.js → line.tsx} +4 -3
- package/src/victory-primitives/{path.js → path.tsx} +4 -3
- package/src/victory-primitives/{point.js → point.tsx} +25 -20
- package/src/victory-primitives/{rect.js → rect.tsx} +4 -2
- package/src/victory-primitives/{text.js → text.tsx} +9 -3
- package/src/victory-primitives/tspan.tsx +7 -0
- package/src/victory-primitives/types.ts +19 -0
- package/src/victory-primitives/{whisker.js → whisker.tsx} +20 -7
- package/src/victory-theme/{grayscale.js → grayscale.tsx} +2 -1
- package/src/victory-theme/{material.js → material.tsx} +2 -1
- package/src/victory-theme/victory-theme-definition.ts +261 -0
- package/src/victory-theme/victory-theme.tsx +5 -0
- package/src/victory-transition/{victory-transition.js → victory-transition.tsx} +68 -19
- package/src/victory-util/add-events.js +7 -5
- package/src/victory-util/axis.js +3 -1
- package/src/victory-util/collection.js +0 -1
- package/src/victory-util/common-props.js +2 -2
- package/src/victory-util/data.js +0 -1
- package/src/victory-util/default-transitions.js +0 -1
- package/src/victory-util/domain.js +0 -1
- package/src/victory-util/events.js +1 -1
- package/src/victory-util/helpers.js +0 -1
- package/src/victory-util/immutable.js +0 -1
- package/src/victory-util/label-helpers.js +0 -1
- package/src/victory-util/line-helpers.js +1 -1
- package/src/victory-util/log.js +0 -1
- package/src/victory-util/point-path-helpers.ts +119 -0
- package/src/victory-util/prop-types.js +0 -1
- package/src/victory-util/scale.js +18 -10
- package/src/victory-util/selection.d.ts +23 -0
- package/src/victory-util/selection.js +0 -1
- package/src/victory-util/style.js +0 -1
- package/src/victory-util/textsize.d.ts +8 -0
- package/src/victory-util/{timer-context.js → timer-context.ts} +0 -0
- package/src/victory-util/{timer.js → timer.ts} +20 -5
- package/src/victory-util/transitions.js +0 -1
- package/src/victory-util/types.ts +247 -0
- package/src/victory-util/user-props.js +31 -1
- package/src/victory-util/wrapper.js +0 -1
- package/src/index.d.ts +0 -941
- package/src/index.js +0 -51
- package/src/victory-portal/portal-context.js +0 -10
- package/src/victory-primitives/clip-path.js +0 -18
- package/src/victory-primitives/tspan.js +0 -5
- package/src/victory-theme/victory-theme.js +0 -7
- package/src/victory-util/point-path-helpers.js +0 -121
|
@@ -3,9 +3,18 @@ import PropTypes from "prop-types";
|
|
|
3
3
|
import { defaults } from "lodash";
|
|
4
4
|
import * as Log from "../victory-util/log";
|
|
5
5
|
import * as Helpers from "../victory-util/helpers";
|
|
6
|
-
import PortalContext from "./portal-context";
|
|
6
|
+
import { PortalContext } from "./portal-context";
|
|
7
7
|
|
|
8
|
-
export
|
|
8
|
+
export interface VictoryPortalProps {
|
|
9
|
+
children?: React.ReactElement;
|
|
10
|
+
groupComponent?: React.ReactElement;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface VictoryPortal {
|
|
14
|
+
context: React.ContextType<typeof PortalContext>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class VictoryPortal extends React.Component<VictoryPortalProps> {
|
|
9
18
|
static displayName = "VictoryPortal";
|
|
10
19
|
|
|
11
20
|
static role = "portal";
|
|
@@ -20,6 +29,10 @@ export default class VictoryPortal extends React.Component {
|
|
|
20
29
|
};
|
|
21
30
|
|
|
22
31
|
static contextType = PortalContext;
|
|
32
|
+
private checkedContext!: boolean;
|
|
33
|
+
private renderInPlace!: boolean;
|
|
34
|
+
private element!: React.ReactElement;
|
|
35
|
+
private portalKey!: number;
|
|
23
36
|
|
|
24
37
|
componentDidMount() {
|
|
25
38
|
if (!this.checkedContext) {
|
|
@@ -49,7 +62,7 @@ export default class VictoryPortal extends React.Component {
|
|
|
49
62
|
}
|
|
50
63
|
|
|
51
64
|
// Overridden in victory-core-native
|
|
52
|
-
renderPortal(child) {
|
|
65
|
+
renderPortal(child: React.ReactElement) {
|
|
53
66
|
if (this.renderInPlace) {
|
|
54
67
|
return child;
|
|
55
68
|
}
|
|
@@ -58,9 +71,11 @@ export default class VictoryPortal extends React.Component {
|
|
|
58
71
|
}
|
|
59
72
|
|
|
60
73
|
render() {
|
|
61
|
-
const children =
|
|
62
|
-
|
|
63
|
-
|
|
74
|
+
const children = (
|
|
75
|
+
Array.isArray(this.props.children)
|
|
76
|
+
? this.props.children[0]
|
|
77
|
+
: this.props.children
|
|
78
|
+
) as React.ReactElement;
|
|
64
79
|
const { groupComponent } = this.props;
|
|
65
80
|
const childProps = (children && children.props) || {};
|
|
66
81
|
const standardProps = childProps.groupComponent
|
|
@@ -4,7 +4,19 @@ import PropTypes from "prop-types";
|
|
|
4
4
|
import * as Helpers from "../victory-util/helpers";
|
|
5
5
|
import { assign } from "lodash";
|
|
6
6
|
import * as CommonProps from "../victory-util/common-props";
|
|
7
|
-
import Path from "./path";
|
|
7
|
+
import { Path } from "./path";
|
|
8
|
+
import { VictoryCommonPrimitiveProps } from "../victory-util/types";
|
|
9
|
+
|
|
10
|
+
export interface ArcProps extends VictoryCommonPrimitiveProps {
|
|
11
|
+
closedPath?: boolean;
|
|
12
|
+
cx?: number;
|
|
13
|
+
cy?: number;
|
|
14
|
+
datum?: any;
|
|
15
|
+
endAngle?: number;
|
|
16
|
+
pathComponent?: React.ReactElement;
|
|
17
|
+
r?: number;
|
|
18
|
+
startAngle?: number;
|
|
19
|
+
}
|
|
8
20
|
|
|
9
21
|
const getArcPath = (props) => {
|
|
10
22
|
const { cx, cy, r, startAngle, endAngle, closedPath } = props;
|
|
@@ -48,10 +60,10 @@ const evaluateProps = (props) => {
|
|
|
48
60
|
return assign({}, props, { ariaLabel, desc, id, style, tabIndex });
|
|
49
61
|
};
|
|
50
62
|
|
|
51
|
-
const Arc = (props) => {
|
|
63
|
+
export const Arc = (props: ArcProps) => {
|
|
52
64
|
props = evaluateProps(props);
|
|
53
65
|
|
|
54
|
-
return React.cloneElement(props.pathComponent
|
|
66
|
+
return React.cloneElement(props.pathComponent!, {
|
|
55
67
|
...props.events,
|
|
56
68
|
"aria-label": props.ariaLabel,
|
|
57
69
|
d: getArcPath(props),
|
|
@@ -83,5 +95,3 @@ Arc.defaultProps = {
|
|
|
83
95
|
role: "presentation",
|
|
84
96
|
shapeRendering: "auto"
|
|
85
97
|
};
|
|
86
|
-
|
|
87
|
-
export default Arc;
|
|
@@ -3,8 +3,20 @@ import PropTypes from "prop-types";
|
|
|
3
3
|
import { assign } from "lodash";
|
|
4
4
|
import * as Helpers from "../victory-util/helpers";
|
|
5
5
|
import * as CommonProps from "../victory-util/common-props";
|
|
6
|
-
import Rect from "./rect";
|
|
7
|
-
import Circle from "./circle";
|
|
6
|
+
import { Rect } from "./rect";
|
|
7
|
+
import { Circle } from "./circle";
|
|
8
|
+
import { VictoryCommonPrimitiveProps } from "../victory-util/types";
|
|
9
|
+
|
|
10
|
+
export interface BackgroundProps extends VictoryCommonPrimitiveProps {
|
|
11
|
+
circleComponent?: React.ReactElement;
|
|
12
|
+
height?: number;
|
|
13
|
+
rectComponent?: React.ReactElement;
|
|
14
|
+
rx?: number;
|
|
15
|
+
ry?: number;
|
|
16
|
+
width?: number;
|
|
17
|
+
x?: number;
|
|
18
|
+
y?: number;
|
|
19
|
+
}
|
|
8
20
|
|
|
9
21
|
const evaluateProps = (props) => {
|
|
10
22
|
/**
|
|
@@ -16,11 +28,11 @@ const evaluateProps = (props) => {
|
|
|
16
28
|
return assign({}, props, { id });
|
|
17
29
|
};
|
|
18
30
|
|
|
19
|
-
const Background = (props) => {
|
|
31
|
+
export const Background = (props: BackgroundProps) => {
|
|
20
32
|
props = evaluateProps(props);
|
|
21
33
|
|
|
22
34
|
return props.polar
|
|
23
|
-
? React.cloneElement(props.circleComponent
|
|
35
|
+
? React.cloneElement(props.circleComponent!, {
|
|
24
36
|
...props.events,
|
|
25
37
|
style: props.style,
|
|
26
38
|
role: props.role,
|
|
@@ -30,7 +42,7 @@ const Background = (props) => {
|
|
|
30
42
|
r: props.height,
|
|
31
43
|
className: props.className
|
|
32
44
|
})
|
|
33
|
-
: React.cloneElement(props.rectComponent
|
|
45
|
+
: React.cloneElement(props.rectComponent!, {
|
|
34
46
|
...props.events,
|
|
35
47
|
style: props.style,
|
|
36
48
|
role: props.role,
|
|
@@ -63,5 +75,3 @@ Background.defaultProps = {
|
|
|
63
75
|
role: "presentation",
|
|
64
76
|
shapeRendering: "auto"
|
|
65
77
|
};
|
|
66
|
-
|
|
67
|
-
export default Background;
|
|
@@ -3,7 +3,16 @@ import PropTypes from "prop-types";
|
|
|
3
3
|
import * as Helpers from "../victory-util/helpers";
|
|
4
4
|
import { assign } from "lodash";
|
|
5
5
|
import * as CommonProps from "../victory-util/common-props";
|
|
6
|
-
import Rect from "./rect";
|
|
6
|
+
import { Rect } from "./rect";
|
|
7
|
+
import { VictoryCommonPrimitiveProps } from "../victory-util/types";
|
|
8
|
+
|
|
9
|
+
export interface BorderProps extends VictoryCommonPrimitiveProps {
|
|
10
|
+
width?: number;
|
|
11
|
+
height?: number;
|
|
12
|
+
rectComponent?: React.ReactElement;
|
|
13
|
+
x?: number;
|
|
14
|
+
y?: number;
|
|
15
|
+
}
|
|
7
16
|
|
|
8
17
|
const evaluateProps = (props) => {
|
|
9
18
|
/**
|
|
@@ -26,10 +35,10 @@ const evaluateProps = (props) => {
|
|
|
26
35
|
return assign({}, props, { ariaLabel, desc, id, style, tabIndex });
|
|
27
36
|
};
|
|
28
37
|
|
|
29
|
-
const Border = (props) => {
|
|
38
|
+
export const Border = (props: BorderProps) => {
|
|
30
39
|
props = evaluateProps(props);
|
|
31
40
|
|
|
32
|
-
return React.cloneElement(props.rectComponent
|
|
41
|
+
return React.cloneElement(props.rectComponent!, {
|
|
33
42
|
...props.events,
|
|
34
43
|
"aria-label": props.ariaLabel,
|
|
35
44
|
style: props.style,
|
|
@@ -61,5 +70,3 @@ Border.defaultProps = {
|
|
|
61
70
|
role: "presentation",
|
|
62
71
|
shapeRendering: "auto"
|
|
63
72
|
};
|
|
64
|
-
|
|
65
|
-
export default Border;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { VictoryPrimitiveShapeProps } from "./types";
|
|
2
3
|
|
|
3
|
-
const Circle = (props) => {
|
|
4
|
+
export const Circle = (props: VictoryPrimitiveShapeProps) => {
|
|
4
5
|
// eslint-disable-next-line react/prop-types
|
|
5
6
|
const { desc, ...rest } = props;
|
|
6
7
|
return desc ? (
|
|
8
|
+
// @ts-expect-error FIXME: "id cannot be a number"
|
|
7
9
|
<circle vectorEffect="non-scaling-stroke" {...rest}>
|
|
8
10
|
<desc>{desc}</desc>
|
|
9
11
|
</circle>
|
|
10
12
|
) : (
|
|
13
|
+
// @ts-expect-error FIXME: "id cannot be a number"
|
|
11
14
|
<circle vectorEffect="non-scaling-stroke" {...rest} />
|
|
12
15
|
);
|
|
13
16
|
};
|
|
14
|
-
|
|
15
|
-
export default Circle;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import { VictoryCommonPrimitiveProps } from "../victory-util/types";
|
|
4
|
+
|
|
5
|
+
export interface ClipPathProps extends VictoryCommonPrimitiveProps {
|
|
6
|
+
children?: React.ReactNode[] | React.ReactNode;
|
|
7
|
+
clipId?: number | string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const ClipPath = (props: ClipPathProps) => (
|
|
11
|
+
<defs>
|
|
12
|
+
{
|
|
13
|
+
// @ts-expect-error FIXME: "id cannot be a number"
|
|
14
|
+
<clipPath id={props.clipId}>{props.children}</clipPath>
|
|
15
|
+
}
|
|
16
|
+
</defs>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
ClipPath.propTypes = {
|
|
20
|
+
children: PropTypes.oneOfType([
|
|
21
|
+
PropTypes.arrayOf(PropTypes.node),
|
|
22
|
+
PropTypes.node
|
|
23
|
+
]),
|
|
24
|
+
clipId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
25
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./arc";
|
|
2
|
+
export * from "./background";
|
|
3
|
+
export * from "./border";
|
|
4
|
+
export * from "./circle";
|
|
5
|
+
export * from "./clip-path";
|
|
6
|
+
export * from "./line";
|
|
7
|
+
export * from "./line-segment";
|
|
8
|
+
export * from "./path";
|
|
9
|
+
export * from "./point";
|
|
10
|
+
export * from "./rect";
|
|
11
|
+
export * from "./text";
|
|
12
|
+
export * from "./tspan";
|
|
13
|
+
export * from "./types";
|
|
14
|
+
export * from "./whisker";
|
|
@@ -3,7 +3,17 @@ import PropTypes from "prop-types";
|
|
|
3
3
|
import * as Helpers from "../victory-util/helpers";
|
|
4
4
|
import { assign } from "lodash";
|
|
5
5
|
import * as CommonProps from "../victory-util/common-props";
|
|
6
|
-
import Line from "./line";
|
|
6
|
+
import { Line } from "./line";
|
|
7
|
+
import { VictoryCommonPrimitiveProps } from "../victory-util/types";
|
|
8
|
+
|
|
9
|
+
export interface LineSegmentProps extends VictoryCommonPrimitiveProps {
|
|
10
|
+
datum?: any;
|
|
11
|
+
lineComponent?: React.ReactElement;
|
|
12
|
+
x1?: number;
|
|
13
|
+
x2?: number;
|
|
14
|
+
y1?: number;
|
|
15
|
+
y2?: number;
|
|
16
|
+
}
|
|
7
17
|
|
|
8
18
|
const evaluateProps = (props) => {
|
|
9
19
|
/**
|
|
@@ -26,10 +36,10 @@ const evaluateProps = (props) => {
|
|
|
26
36
|
return assign({}, props, { ariaLabel, desc, id, style, tabIndex });
|
|
27
37
|
};
|
|
28
38
|
|
|
29
|
-
const LineSegment = (props) => {
|
|
39
|
+
export const LineSegment = (props: LineSegmentProps) => {
|
|
30
40
|
props = evaluateProps(props);
|
|
31
41
|
|
|
32
|
-
return React.cloneElement(props.lineComponent
|
|
42
|
+
return React.cloneElement(props.lineComponent!, {
|
|
33
43
|
...props.events,
|
|
34
44
|
"aria-label": props.ariaLabel,
|
|
35
45
|
style: props.style,
|
|
@@ -62,5 +72,3 @@ LineSegment.defaultProps = {
|
|
|
62
72
|
role: "presentation",
|
|
63
73
|
shapeRendering: "auto"
|
|
64
74
|
};
|
|
65
|
-
|
|
66
|
-
export default LineSegment;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { VictoryPrimitiveShapeProps } from "./types";
|
|
2
3
|
|
|
3
|
-
const Line = (props) => {
|
|
4
|
+
export const Line = (props: VictoryPrimitiveShapeProps) => {
|
|
4
5
|
// eslint-disable-next-line react/prop-types
|
|
5
6
|
const { desc, ...rest } = props;
|
|
6
7
|
return desc ? (
|
|
8
|
+
// @ts-expect-error FIXME: "id cannot be a number"
|
|
7
9
|
<line vectorEffect="non-scaling-stroke" {...rest}>
|
|
8
10
|
<desc>{desc}</desc>
|
|
9
11
|
</line>
|
|
10
12
|
) : (
|
|
13
|
+
// @ts-expect-error FIXME: "id cannot be a number"
|
|
11
14
|
<line vectorEffect="non-scaling-stroke" {...rest} />
|
|
12
15
|
);
|
|
13
16
|
};
|
|
14
|
-
|
|
15
|
-
export default Line;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { VictoryPrimitiveShapeProps } from "./types";
|
|
2
3
|
|
|
3
|
-
const Path = (props) => {
|
|
4
|
+
export const Path = (props: VictoryPrimitiveShapeProps) => {
|
|
4
5
|
// eslint-disable-next-line react/prop-types
|
|
5
6
|
const { desc, ...rest } = props;
|
|
6
7
|
return desc ? (
|
|
8
|
+
// @ts-expect-error FIXME: "id cannot be a number"
|
|
7
9
|
<path {...rest}>
|
|
8
10
|
<desc>{desc}</desc>
|
|
9
11
|
</path>
|
|
10
12
|
) : (
|
|
13
|
+
// @ts-expect-error FIXME: "id cannot be a number"
|
|
11
14
|
<path {...rest} />
|
|
12
15
|
);
|
|
13
16
|
};
|
|
14
|
-
|
|
15
|
-
export default Path;
|
|
@@ -1,27 +1,32 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
1
|
import { assign } from "lodash";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import React from "react";
|
|
4
4
|
import * as Helpers from "../victory-util/helpers";
|
|
5
|
-
import pathHelpers from "../victory-util/point-path-helpers";
|
|
5
|
+
import * as pathHelpers from "../victory-util/point-path-helpers";
|
|
6
6
|
import * as CommonProps from "../victory-util/common-props";
|
|
7
|
-
import
|
|
7
|
+
import * as UserProps from "../victory-util/user-props";
|
|
8
|
+
import { Path } from "./path";
|
|
9
|
+
import { VictoryCommonPrimitiveProps } from "../victory-util/types";
|
|
10
|
+
import { ScatterSymbolType } from "./types";
|
|
11
|
+
|
|
12
|
+
export interface PointProps extends VictoryCommonPrimitiveProps {
|
|
13
|
+
datum?: any;
|
|
14
|
+
getPath?: (x: number, y: number, size: number) => string;
|
|
15
|
+
pathComponent?: React.ReactElement;
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
17
|
+
size?: number | Function;
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
19
|
+
symbol?: ScatterSymbolType | Function;
|
|
20
|
+
x?: number;
|
|
21
|
+
y?: number;
|
|
22
|
+
}
|
|
8
23
|
|
|
9
24
|
const getPath = (props) => {
|
|
10
25
|
const { x, y, size, symbol } = props;
|
|
11
26
|
if (props.getPath) {
|
|
12
27
|
return props.getPath(x, y, size);
|
|
13
28
|
}
|
|
14
|
-
const pathFunctions =
|
|
15
|
-
circle: pathHelpers.circle,
|
|
16
|
-
square: pathHelpers.square,
|
|
17
|
-
diamond: pathHelpers.diamond,
|
|
18
|
-
triangleDown: pathHelpers.triangleDown,
|
|
19
|
-
triangleUp: pathHelpers.triangleUp,
|
|
20
|
-
plus: pathHelpers.plus,
|
|
21
|
-
minus: pathHelpers.minus,
|
|
22
|
-
star: pathHelpers.star,
|
|
23
|
-
cross: pathHelpers.cross
|
|
24
|
-
};
|
|
29
|
+
const pathFunctions = pathHelpers;
|
|
25
30
|
const symbolFunction =
|
|
26
31
|
typeof pathFunctions[symbol] === "function"
|
|
27
32
|
? pathFunctions[symbol]
|
|
@@ -59,10 +64,11 @@ const evaluateProps = (props) => {
|
|
|
59
64
|
});
|
|
60
65
|
};
|
|
61
66
|
|
|
62
|
-
const Point = (props) => {
|
|
67
|
+
export const Point = (props: PointProps) => {
|
|
63
68
|
props = evaluateProps(props);
|
|
69
|
+
const userProps = UserProps.getSafeUserProps(props);
|
|
64
70
|
|
|
65
|
-
return React.cloneElement(props.pathComponent
|
|
71
|
+
return React.cloneElement(props.pathComponent!, {
|
|
66
72
|
...props.events,
|
|
67
73
|
"aria-label": props.ariaLabel,
|
|
68
74
|
d: getPath(props),
|
|
@@ -73,7 +79,8 @@ const Point = (props) => {
|
|
|
73
79
|
shapeRendering: props.shapeRendering,
|
|
74
80
|
className: props.className,
|
|
75
81
|
transform: props.transform,
|
|
76
|
-
clipPath: props.clipPath
|
|
82
|
+
clipPath: props.clipPath,
|
|
83
|
+
...userProps
|
|
77
84
|
});
|
|
78
85
|
};
|
|
79
86
|
|
|
@@ -106,5 +113,3 @@ Point.defaultProps = {
|
|
|
106
113
|
role: "presentation",
|
|
107
114
|
shapeRendering: "auto"
|
|
108
115
|
};
|
|
109
|
-
|
|
110
|
-
export default Point;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { VictoryPrimitiveShapeProps } from "./types";
|
|
2
3
|
|
|
3
|
-
const Rect = (props) => {
|
|
4
|
+
export const Rect = (props: VictoryPrimitiveShapeProps) => {
|
|
4
5
|
// eslint-disable-next-line react/prop-types
|
|
5
6
|
const { desc, ...rest } = props;
|
|
6
7
|
return desc ? (
|
|
8
|
+
// @ts-expect-error FIXME: "id cannot be a number"
|
|
7
9
|
<rect vectorEffect="non-scaling-stroke" {...rest}>
|
|
8
10
|
<desc>{desc}</desc>
|
|
9
11
|
</rect>
|
|
10
12
|
) : (
|
|
13
|
+
// @ts-expect-error FIXME: "id cannot be a number"
|
|
11
14
|
<rect vectorEffect="non-scaling-stroke" {...rest} />
|
|
12
15
|
);
|
|
13
16
|
};
|
|
14
|
-
export default Rect;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
+
import { VictoryCommonPrimitiveProps } from "../victory-util/types";
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
export interface TextProps extends VictoryCommonPrimitiveProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
desc?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Text = (props: TextProps) => {
|
|
5
12
|
const { children, title, desc, ...rest } = props;
|
|
6
13
|
return (
|
|
14
|
+
// @ts-expect-error FIXME: "id cannot be a number"
|
|
7
15
|
<text {...rest}>
|
|
8
16
|
{title && <title>{title}</title>}
|
|
9
17
|
{desc && <desc>{desc}</desc>}
|
|
@@ -17,5 +25,3 @@ Text.propTypes = {
|
|
|
17
25
|
desc: PropTypes.string,
|
|
18
26
|
title: PropTypes.string
|
|
19
27
|
};
|
|
20
|
-
|
|
21
|
-
export default Text;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { VictoryCommonPrimitiveProps } from "../victory-util/types";
|
|
2
|
+
|
|
3
|
+
export type ScatterSymbolType =
|
|
4
|
+
| "circle"
|
|
5
|
+
| "cross"
|
|
6
|
+
| "diamond"
|
|
7
|
+
| "plus"
|
|
8
|
+
| "minus"
|
|
9
|
+
| "square"
|
|
10
|
+
| "star"
|
|
11
|
+
| "triangleDown"
|
|
12
|
+
| "triangleUp";
|
|
13
|
+
|
|
14
|
+
export interface VictoryPrimitiveShapeProps
|
|
15
|
+
extends VictoryCommonPrimitiveProps {
|
|
16
|
+
desc?: string;
|
|
17
|
+
rx?: number;
|
|
18
|
+
ry?: number;
|
|
19
|
+
}
|
|
@@ -3,7 +3,22 @@ import { assign } from "lodash";
|
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import * as Helpers from "../victory-util/helpers";
|
|
5
5
|
import * as CommonProps from "../victory-util/common-props";
|
|
6
|
-
import Line from "./line";
|
|
6
|
+
import { Line } from "./line";
|
|
7
|
+
import { VictoryCommonPrimitiveProps } from "../victory-util/types";
|
|
8
|
+
|
|
9
|
+
export type WhiskerAxes = {
|
|
10
|
+
x1?: number;
|
|
11
|
+
x2?: number;
|
|
12
|
+
y1?: number;
|
|
13
|
+
y2?: number;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export interface WhiskerProps extends VictoryCommonPrimitiveProps {
|
|
17
|
+
groupComponent?: React.ReactElement;
|
|
18
|
+
lineComponent?: React.ReactElement;
|
|
19
|
+
majorWhisker?: WhiskerAxes;
|
|
20
|
+
minorWhisker?: WhiskerAxes;
|
|
21
|
+
}
|
|
7
22
|
|
|
8
23
|
const evaluateProps = (props) => {
|
|
9
24
|
/**
|
|
@@ -23,7 +38,7 @@ const evaluateProps = (props) => {
|
|
|
23
38
|
return assign({}, props, { ariaLabel, desc, id, style, tabIndex });
|
|
24
39
|
};
|
|
25
40
|
|
|
26
|
-
const Whisker = (props) => {
|
|
41
|
+
export const Whisker = (props: WhiskerProps) => {
|
|
27
42
|
props = evaluateProps(props);
|
|
28
43
|
const {
|
|
29
44
|
ariaLabel,
|
|
@@ -53,9 +68,9 @@ const Whisker = (props) => {
|
|
|
53
68
|
shapeRendering
|
|
54
69
|
};
|
|
55
70
|
|
|
56
|
-
return React.cloneElement(groupComponent
|
|
71
|
+
return React.cloneElement(groupComponent!, {}, [
|
|
57
72
|
React.cloneElement(
|
|
58
|
-
lineComponent
|
|
73
|
+
lineComponent!,
|
|
59
74
|
assign(
|
|
60
75
|
{ key: "major-whisker", "aria-label": ariaLabel },
|
|
61
76
|
baseProps,
|
|
@@ -63,7 +78,7 @@ const Whisker = (props) => {
|
|
|
63
78
|
)
|
|
64
79
|
),
|
|
65
80
|
React.cloneElement(
|
|
66
|
-
lineComponent
|
|
81
|
+
lineComponent!,
|
|
67
82
|
assign(
|
|
68
83
|
{ key: "minor-whisker", "aria-label": ariaLabel },
|
|
69
84
|
baseProps,
|
|
@@ -97,5 +112,3 @@ Whisker.defaultProps = {
|
|
|
97
112
|
role: "presentation",
|
|
98
113
|
shapeRendering: "auto"
|
|
99
114
|
};
|
|
100
|
-
|
|
101
|
-
export default Whisker;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { assign } from "lodash";
|
|
2
|
+
import { VictoryThemeDefinition } from "./victory-theme-definition";
|
|
2
3
|
|
|
3
4
|
// *
|
|
4
5
|
// * Colors
|
|
@@ -49,7 +50,7 @@ const centeredLabelStyles = assign({ textAnchor: "middle" }, baseLabelStyles);
|
|
|
49
50
|
const strokeLinecap = "round";
|
|
50
51
|
const strokeLinejoin = "round";
|
|
51
52
|
|
|
52
|
-
export
|
|
53
|
+
export const grayscale: VictoryThemeDefinition = {
|
|
53
54
|
area: assign(
|
|
54
55
|
{
|
|
55
56
|
style: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { assign } from "lodash";
|
|
2
|
+
import { VictoryThemeDefinition } from "./victory-theme-definition";
|
|
2
3
|
|
|
3
4
|
// *
|
|
4
5
|
// * Colors
|
|
@@ -57,7 +58,7 @@ const strokeDasharray = "10, 5";
|
|
|
57
58
|
const strokeLinecap = "round";
|
|
58
59
|
const strokeLinejoin = "round";
|
|
59
60
|
|
|
60
|
-
export
|
|
61
|
+
export const material: VictoryThemeDefinition = {
|
|
61
62
|
area: assign(
|
|
62
63
|
{
|
|
63
64
|
style: {
|