victory-core 36.4.1 → 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 +874 -879
- 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 +8 -16
- package/es/victory-animation/util.d.ts +66 -0
- package/es/victory-animation/util.js +2 -1
- package/es/victory-animation/victory-animation.d.ts +69 -0
- package/es/victory-animation/victory-animation.js +59 -67
- package/es/victory-clip-container/victory-clip-container.d.ts +76 -0
- package/es/victory-clip-container/victory-clip-container.js +15 -21
- package/es/victory-container/victory-container.d.ts +99 -0
- package/es/victory-container/victory-container.js +31 -31
- package/es/victory-label/victory-label.d.ts +61 -0
- package/es/victory-label/victory-label.js +13 -8
- 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 +25 -33
- package/es/victory-portal/victory-portal.d.ts +31 -0
- package/es/victory-portal/victory-portal.js +23 -22
- package/es/victory-primitives/arc.d.ts +21 -0
- package/es/victory-primitives/arc.js +3 -5
- package/es/victory-primitives/background.d.ts +22 -0
- package/es/victory-primitives/background.js +4 -6
- package/es/victory-primitives/border.d.ts +18 -0
- package/es/victory-primitives/border.js +3 -5
- package/es/victory-primitives/circle.d.ts +2 -0
- package/es/victory-primitives/circle.js +11 -8
- 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 +3 -5
- package/es/victory-primitives/line.d.ts +2 -0
- package/es/victory-primitives/line.js +11 -8
- package/es/victory-primitives/path.d.ts +2 -0
- package/es/victory-primitives/path.js +9 -6
- package/es/victory-primitives/point.d.ts +21 -0
- package/es/victory-primitives/point.js +9 -19
- package/es/victory-primitives/rect.d.ts +2 -0
- package/es/victory-primitives/rect.js +11 -8
- package/es/victory-primitives/text.d.ts +16 -0
- package/es/victory-primitives/text.js +7 -6
- 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 +3 -5
- 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 +19 -23
- package/es/victory-util/add-events.js +6 -3
- package/es/victory-util/axis.js +0 -1
- package/es/victory-util/collection.js +0 -2
- package/es/victory-util/data.js +0 -2
- package/es/victory-util/default-transitions.js +0 -1
- package/es/victory-util/domain.js +0 -2
- package/es/victory-util/helpers.js +0 -2
- package/es/victory-util/immutable.js +0 -1
- package/es/victory-util/label-helpers.js +0 -2
- 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/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/timer-context.d.ts +11 -0
- package/es/victory-util/timer.d.ts +16 -0
- package/es/victory-util/timer.js +13 -8
- package/es/victory-util/types.d.ts +188 -0
- package/es/victory-util/types.js +1 -0
- package/lib/index.d.ts +38 -941
- package/lib/index.js +195 -193
- 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 +9 -15
- package/lib/victory-animation/util.d.ts +66 -0
- package/lib/victory-animation/util.js +2 -1
- package/lib/victory-animation/victory-animation.d.ts +69 -0
- package/lib/victory-animation/victory-animation.js +60 -65
- package/lib/victory-clip-container/victory-clip-container.d.ts +76 -0
- package/lib/victory-clip-container/victory-clip-container.js +19 -22
- package/lib/victory-container/victory-container.d.ts +99 -0
- package/lib/victory-container/victory-container.js +34 -31
- package/lib/victory-label/victory-label.d.ts +61 -0
- package/lib/victory-label/victory-label.js +19 -13
- package/lib/victory-portal/portal-context.d.ts +11 -0
- package/lib/victory-portal/portal-context.js +3 -4
- package/lib/victory-portal/portal.d.ts +28 -0
- package/lib/victory-portal/portal.js +26 -31
- package/lib/victory-portal/victory-portal.d.ts +31 -0
- package/lib/victory-portal/victory-portal.js +24 -20
- package/lib/victory-primitives/arc.d.ts +21 -0
- package/lib/victory-primitives/arc.js +5 -6
- package/lib/victory-primitives/background.d.ts +22 -0
- package/lib/victory-primitives/background.js +7 -8
- package/lib/victory-primitives/border.d.ts +18 -0
- package/lib/victory-primitives/border.js +5 -6
- package/lib/victory-primitives/circle.d.ts +2 -0
- package/lib/victory-primitives/circle.js +11 -6
- 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 +5 -6
- package/lib/victory-primitives/line.d.ts +2 -0
- package/lib/victory-primitives/line.js +11 -6
- package/lib/victory-primitives/path.d.ts +2 -0
- package/lib/victory-primitives/path.js +9 -4
- package/lib/victory-primitives/point.d.ts +21 -0
- package/lib/victory-primitives/point.js +13 -21
- package/lib/victory-primitives/rect.d.ts +2 -0
- package/lib/victory-primitives/rect.js +11 -6
- package/lib/victory-primitives/text.d.ts +16 -0
- package/lib/victory-primitives/text.js +8 -5
- 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 +5 -6
- 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 +21 -23
- package/lib/victory-util/add-events.js +8 -4
- package/lib/victory-util/collection.js +0 -2
- package/lib/victory-util/default-transitions.js +0 -1
- package/lib/victory-util/helpers.js +0 -2
- package/lib/victory-util/immutable.js +0 -2
- package/lib/victory-util/label-helpers.js +0 -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/selection.d.ts +23 -0
- package/lib/victory-util/selection.js +0 -2
- package/lib/victory-util/style.js +0 -2
- package/lib/victory-util/textsize.d.ts +8 -0
- package/lib/victory-util/timer-context.d.ts +11 -0
- package/lib/victory-util/timer.d.ts +16 -0
- package/lib/victory-util/timer.js +13 -8
- package/lib/victory-util/types.d.ts +188 -0
- package/lib/victory-util/types.js +1 -0
- package/package.json +4 -4
- 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} +4 -3
- package/src/victory-animation/{victory-animation.js → victory-animation.tsx} +89 -12
- package/src/victory-clip-container/{victory-clip-container.js → victory-clip-container.tsx} +29 -5
- package/src/victory-container/{victory-container.js → victory-container.tsx} +70 -26
- package/src/victory-label/{victory-label.js → victory-label.tsx} +71 -14
- 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 +6 -1
- package/src/victory-util/axis.js +0 -1
- package/src/victory-util/collection.js +0 -1
- 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/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 +0 -1
- 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} +19 -4
- package/src/victory-util/transitions.js +0 -1
- package/src/victory-util/types.ts +247 -0
- 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
|
@@ -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: {
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { VictoryCommonThemeProps, VictoryDatableProps } from "../index";
|
|
3
|
+
import { CallbackArgs, StringOrNumberOrCallback } from "../types";
|
|
4
|
+
|
|
5
|
+
export type BlockProps = {
|
|
6
|
+
top?: number;
|
|
7
|
+
bottom?: number;
|
|
8
|
+
left?: number;
|
|
9
|
+
right?: number;
|
|
10
|
+
};
|
|
11
|
+
export type PaddingProps = number | BlockProps;
|
|
12
|
+
export type OrientationTypes = "top" | "bottom" | "left" | "right";
|
|
13
|
+
export type VictoryNumberCallback = (args: CallbackArgs) => number;
|
|
14
|
+
export type VictoryPaddingCallback = (
|
|
15
|
+
args: CallbackArgs
|
|
16
|
+
) => number | BlockProps;
|
|
17
|
+
export type VictoryOrientationCallback = (
|
|
18
|
+
args: CallbackArgs
|
|
19
|
+
) => OrientationTypes;
|
|
20
|
+
export type NumberOrCallback = number | VictoryNumberCallback;
|
|
21
|
+
export type PaddingOrCallback = number | BlockProps | VictoryPaddingCallback;
|
|
22
|
+
export type OrientationOrCallback =
|
|
23
|
+
| OrientationTypes
|
|
24
|
+
| VictoryOrientationCallback;
|
|
25
|
+
export type VictoryStyleObject = {
|
|
26
|
+
[K in keyof React.CSSProperties]: StringOrNumberOrCallback;
|
|
27
|
+
};
|
|
28
|
+
export type LabelProps = React.CSSProperties & {
|
|
29
|
+
angle?: number;
|
|
30
|
+
verticalAnchor?: VerticalAnchorType;
|
|
31
|
+
};
|
|
32
|
+
export type VictoryLabelStyleObject = {
|
|
33
|
+
[K in keyof LabelProps]: StringOrNumberOrCallback;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Style interface used in components/themeing
|
|
38
|
+
*/
|
|
39
|
+
export interface VictoryStyleInterface {
|
|
40
|
+
parent?: VictoryStyleObject;
|
|
41
|
+
data?: VictoryStyleObject;
|
|
42
|
+
labels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
43
|
+
border?: VictoryStyleObject;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type TickProps = React.CSSProperties & { size?: number };
|
|
47
|
+
export type VictoryTickStyleObject = {
|
|
48
|
+
[K in keyof TickProps]: StringOrNumberOrCallback;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export interface VictoryAxisCommonProps {
|
|
52
|
+
axisComponent?: React.ReactElement;
|
|
53
|
+
axisLabelComponent?: React.ReactElement;
|
|
54
|
+
axisValue?: number | string | object | Date;
|
|
55
|
+
dependentAxis?: boolean;
|
|
56
|
+
disableInlineStyles?: boolean;
|
|
57
|
+
gridComponent?: React.ReactElement;
|
|
58
|
+
invertAxis?: boolean;
|
|
59
|
+
style?: {
|
|
60
|
+
parent?: VictoryStyleObject;
|
|
61
|
+
axis?: VictoryStyleObject;
|
|
62
|
+
axisLabel?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
63
|
+
grid?: VictoryStyleObject;
|
|
64
|
+
ticks?: VictoryTickStyleObject;
|
|
65
|
+
tickLabels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
66
|
+
};
|
|
67
|
+
tickComponent?: React.ReactElement;
|
|
68
|
+
tickCount?: number;
|
|
69
|
+
tickLabelComponent?: React.ReactElement;
|
|
70
|
+
tickFormat?:
|
|
71
|
+
| any[]
|
|
72
|
+
| { (tick: any, index: number, ticks: any[]): string | number };
|
|
73
|
+
tickValues?: any[];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export type VerticalAnchorType = "start" | "middle" | "end";
|
|
77
|
+
// #region Victory Theme
|
|
78
|
+
// Note: Many SVG attributes are missed in CSSProperties interface
|
|
79
|
+
export interface VictoryThemeDefinition {
|
|
80
|
+
area?: {
|
|
81
|
+
style?: {
|
|
82
|
+
data?: VictoryStyleObject;
|
|
83
|
+
labels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
84
|
+
};
|
|
85
|
+
} & VictoryCommonThemeProps &
|
|
86
|
+
VictoryDatableProps;
|
|
87
|
+
axis?: {
|
|
88
|
+
style?: {
|
|
89
|
+
axis?: VictoryStyleObject;
|
|
90
|
+
axisLabel?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
91
|
+
grid?: VictoryStyleObject;
|
|
92
|
+
ticks?: VictoryTickStyleObject;
|
|
93
|
+
tickLabels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
94
|
+
};
|
|
95
|
+
offsetX?: number;
|
|
96
|
+
offsetY?: number;
|
|
97
|
+
} & VictoryCommonThemeProps;
|
|
98
|
+
bar?: {
|
|
99
|
+
style?: {
|
|
100
|
+
data?: VictoryStyleObject;
|
|
101
|
+
labels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
102
|
+
};
|
|
103
|
+
} & VictoryCommonThemeProps &
|
|
104
|
+
VictoryDatableProps;
|
|
105
|
+
boxplot?: {
|
|
106
|
+
style?: {
|
|
107
|
+
max?: VictoryStyleObject;
|
|
108
|
+
maxLabels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
109
|
+
median?: VictoryStyleObject;
|
|
110
|
+
medianLabels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
111
|
+
min?: VictoryStyleObject;
|
|
112
|
+
minLabels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
113
|
+
q1?: VictoryStyleObject;
|
|
114
|
+
q1Labels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
115
|
+
q3?: VictoryStyleObject;
|
|
116
|
+
q3Labels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
117
|
+
};
|
|
118
|
+
boxWidth?: number;
|
|
119
|
+
} & VictoryCommonThemeProps;
|
|
120
|
+
candlestick?: {
|
|
121
|
+
style?: {
|
|
122
|
+
data?: VictoryStyleObject;
|
|
123
|
+
labels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
124
|
+
};
|
|
125
|
+
candleColors?: {
|
|
126
|
+
positive?: string;
|
|
127
|
+
negative?: string;
|
|
128
|
+
};
|
|
129
|
+
} & VictoryCommonThemeProps;
|
|
130
|
+
chart?: VictoryCommonThemeProps;
|
|
131
|
+
dependentAxis?: {
|
|
132
|
+
style?: {
|
|
133
|
+
axis?: VictoryStyleObject;
|
|
134
|
+
axisLabel?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
135
|
+
grid?: VictoryStyleObject;
|
|
136
|
+
ticks?: VictoryTickStyleObject;
|
|
137
|
+
tickLabels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
138
|
+
};
|
|
139
|
+
offsetX?: number;
|
|
140
|
+
offsetY?: number;
|
|
141
|
+
orientation?: OrientationTypes;
|
|
142
|
+
} & VictoryCommonThemeProps;
|
|
143
|
+
errorbar?: {
|
|
144
|
+
borderWidth?: number;
|
|
145
|
+
style?: {
|
|
146
|
+
data?: VictoryStyleObject;
|
|
147
|
+
labels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
148
|
+
};
|
|
149
|
+
} & VictoryCommonThemeProps;
|
|
150
|
+
group?: {
|
|
151
|
+
style?: {
|
|
152
|
+
data?: VictoryStyleObject;
|
|
153
|
+
labels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
154
|
+
};
|
|
155
|
+
} & VictoryCommonThemeProps;
|
|
156
|
+
histogram?: {
|
|
157
|
+
style?: {
|
|
158
|
+
data?: VictoryStyleObject;
|
|
159
|
+
labels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
160
|
+
};
|
|
161
|
+
} & VictoryCommonThemeProps;
|
|
162
|
+
independentAxis?: {
|
|
163
|
+
style?: {
|
|
164
|
+
axis?: VictoryStyleObject;
|
|
165
|
+
axisLabel?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
166
|
+
grid?: VictoryStyleObject;
|
|
167
|
+
ticks?: VictoryTickStyleObject;
|
|
168
|
+
tickLabels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
169
|
+
};
|
|
170
|
+
offsetX?: number;
|
|
171
|
+
offsetY?: number;
|
|
172
|
+
orientation?: OrientationTypes;
|
|
173
|
+
} & VictoryCommonThemeProps;
|
|
174
|
+
legend?: {
|
|
175
|
+
gutter?: number | BlockProps;
|
|
176
|
+
rowGutter?: number | BlockProps;
|
|
177
|
+
orientation?: string;
|
|
178
|
+
titleOrientation?: string;
|
|
179
|
+
style?: {
|
|
180
|
+
data?: VictoryStyleObject & {
|
|
181
|
+
type?: string;
|
|
182
|
+
};
|
|
183
|
+
border?: VictoryStyleObject;
|
|
184
|
+
labels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
185
|
+
title?: VictoryLabelStyleObject;
|
|
186
|
+
};
|
|
187
|
+
itemsPerRow?: number;
|
|
188
|
+
x?: number;
|
|
189
|
+
y?: number;
|
|
190
|
+
centerTitle?: boolean;
|
|
191
|
+
borderPadding?: number | BlockProps;
|
|
192
|
+
} & VictoryCommonThemeProps;
|
|
193
|
+
line?: {
|
|
194
|
+
style?: {
|
|
195
|
+
data?: VictoryStyleObject;
|
|
196
|
+
labels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
197
|
+
};
|
|
198
|
+
} & VictoryCommonThemeProps &
|
|
199
|
+
VictoryDatableProps;
|
|
200
|
+
pie?: {
|
|
201
|
+
style?: {
|
|
202
|
+
data?: VictoryStyleObject;
|
|
203
|
+
labels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
204
|
+
};
|
|
205
|
+
} & VictoryCommonThemeProps &
|
|
206
|
+
VictoryDatableProps;
|
|
207
|
+
polarAxis?: {
|
|
208
|
+
style?: {
|
|
209
|
+
axis?: VictoryStyleObject;
|
|
210
|
+
axisLabel?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
211
|
+
grid?: VictoryStyleObject;
|
|
212
|
+
ticks?: VictoryTickStyleObject;
|
|
213
|
+
tickLabels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
214
|
+
};
|
|
215
|
+
} & VictoryCommonThemeProps;
|
|
216
|
+
polarDependentAxis?: {
|
|
217
|
+
style?: {
|
|
218
|
+
axis?: VictoryStyleObject;
|
|
219
|
+
axisLabel?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
220
|
+
grid?: VictoryStyleObject;
|
|
221
|
+
ticks?: VictoryTickStyleObject;
|
|
222
|
+
tickLabels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
223
|
+
};
|
|
224
|
+
} & VictoryCommonThemeProps;
|
|
225
|
+
polarIndependentAxis?: {
|
|
226
|
+
style?: {
|
|
227
|
+
axis?: VictoryStyleObject;
|
|
228
|
+
axisLabel?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
229
|
+
grid?: VictoryStyleObject;
|
|
230
|
+
ticks?: VictoryTickStyleObject;
|
|
231
|
+
tickLabels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
232
|
+
};
|
|
233
|
+
} & VictoryCommonThemeProps;
|
|
234
|
+
scatter?: {
|
|
235
|
+
style?: {
|
|
236
|
+
data?: VictoryStyleObject;
|
|
237
|
+
labels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
238
|
+
};
|
|
239
|
+
} & VictoryCommonThemeProps &
|
|
240
|
+
VictoryDatableProps;
|
|
241
|
+
stack?: VictoryCommonThemeProps;
|
|
242
|
+
tooltip?: {
|
|
243
|
+
style?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
244
|
+
flyoutStyle?: VictoryStyleObject;
|
|
245
|
+
cornerRadius?: NumberOrCallback;
|
|
246
|
+
pointerLength?: NumberOrCallback;
|
|
247
|
+
flyoutPadding?: PaddingOrCallback;
|
|
248
|
+
flyoutWidth?: NumberOrCallback;
|
|
249
|
+
flyoutHeight?: NumberOrCallback;
|
|
250
|
+
orientation?: OrientationOrCallback;
|
|
251
|
+
pointerOrientation?: OrientationOrCallback;
|
|
252
|
+
};
|
|
253
|
+
voronoi?: {
|
|
254
|
+
style?: {
|
|
255
|
+
data?: VictoryStyleObject;
|
|
256
|
+
labels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
257
|
+
flyout?: VictoryStyleObject;
|
|
258
|
+
};
|
|
259
|
+
} & VictoryCommonThemeProps &
|
|
260
|
+
VictoryDatableProps;
|
|
261
|
+
}
|