victory-core 36.7.0 → 36.8.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/CHANGELOG.md +28 -0
- package/dist/victory-core.js +371 -289
- package/dist/victory-core.min.js +1 -1
- package/es/victory-label/victory-label.js +12 -12
- package/es/victory-primitives/arc.d.ts +0 -5
- package/es/victory-primitives/arc.js +7 -7
- package/es/victory-primitives/background.d.ts +0 -6
- package/es/victory-primitives/background.js +8 -8
- package/es/victory-primitives/border.d.ts +0 -5
- package/es/victory-primitives/border.js +7 -7
- package/es/victory-primitives/circle.d.ts +2 -2
- package/es/victory-primitives/circle.js +30 -16
- package/es/victory-primitives/clip-path.d.ts +1 -8
- package/es/victory-primitives/clip-path.js +4 -10
- package/es/victory-primitives/line-segment.d.ts +0 -5
- package/es/victory-primitives/line-segment.js +7 -7
- package/es/victory-primitives/line.d.ts +2 -2
- package/es/victory-primitives/line.js +30 -16
- package/es/victory-primitives/path.d.ts +1 -1
- package/es/victory-primitives/path.js +24 -12
- package/es/victory-primitives/point.d.ts +0 -5
- package/es/victory-primitives/point.js +7 -7
- package/es/victory-primitives/rect.d.ts +2 -2
- package/es/victory-primitives/rect.js +30 -16
- package/es/victory-primitives/text.d.ts +1 -9
- package/es/victory-primitives/text.js +23 -13
- package/es/victory-primitives/tspan.js +30 -5
- package/es/victory-primitives/whisker.d.ts +0 -6
- package/es/victory-primitives/whisker.js +8 -8
- package/es/victory-util/add-events.d.ts +2 -2
- package/es/victory-util/add-events.js +4 -2
- package/es/victory-util/helpers.js +4 -3
- package/es/victory-util/textsize.js +7 -0
- package/es/victory-util/user-props.js +2 -16
- package/lib/victory-label/victory-label.js +13 -12
- package/lib/victory-primitives/arc.d.ts +0 -5
- package/lib/victory-primitives/arc.js +8 -7
- package/lib/victory-primitives/background.d.ts +0 -6
- package/lib/victory-primitives/background.js +9 -8
- package/lib/victory-primitives/border.d.ts +0 -5
- package/lib/victory-primitives/border.js +8 -7
- package/lib/victory-primitives/circle.d.ts +2 -2
- package/lib/victory-primitives/circle.js +34 -18
- package/lib/victory-primitives/clip-path.d.ts +1 -8
- package/lib/victory-primitives/clip-path.js +5 -12
- package/lib/victory-primitives/line-segment.d.ts +0 -5
- package/lib/victory-primitives/line-segment.js +8 -7
- package/lib/victory-primitives/line.d.ts +2 -2
- package/lib/victory-primitives/line.js +34 -18
- package/lib/victory-primitives/path.d.ts +1 -1
- package/lib/victory-primitives/path.js +25 -12
- package/lib/victory-primitives/point.d.ts +0 -5
- package/lib/victory-primitives/point.js +8 -7
- package/lib/victory-primitives/rect.d.ts +2 -2
- package/lib/victory-primitives/rect.js +34 -18
- package/lib/victory-primitives/text.d.ts +1 -9
- package/lib/victory-primitives/text.js +24 -14
- package/lib/victory-primitives/tspan.js +31 -5
- package/lib/victory-primitives/whisker.d.ts +0 -6
- package/lib/victory-primitives/whisker.js +9 -8
- package/lib/victory-util/add-events.d.ts +2 -2
- package/lib/victory-util/add-events.js +4 -2
- package/lib/victory-util/helpers.js +8 -3
- package/lib/victory-util/textsize.js +7 -0
- package/lib/victory-util/user-props.js +3 -16
- package/package.json +2 -2
- package/src/victory-label/victory-label.tsx +11 -12
- package/src/victory-primitives/arc.tsx +7 -7
- package/src/victory-primitives/background.tsx +8 -8
- package/src/victory-primitives/border.tsx +7 -7
- package/src/victory-primitives/circle.tsx +24 -14
- package/src/victory-primitives/clip-path.tsx +1 -13
- package/src/victory-primitives/line-segment.tsx +7 -7
- package/src/victory-primitives/line.tsx +25 -14
- package/src/victory-primitives/path.tsx +23 -17
- package/src/victory-primitives/point.tsx +7 -7
- package/src/victory-primitives/rect.tsx +25 -14
- package/src/victory-primitives/text.tsx +13 -10
- package/src/victory-primitives/tspan.tsx +15 -4
- package/src/victory-primitives/whisker.tsx +8 -8
- package/src/victory-util/add-events.tsx +14 -5
- package/src/victory-util/helpers.ts +5 -3
- package/src/victory-util/textsize.ts +5 -1
- package/src/victory-util/user-props.ts +2 -14
- package/es/v37/clone.d.ts +0 -23
- package/es/v37/clone.js +0 -32
- package/es/v37/index.d.ts +0 -5
- package/es/v37/index.js +0 -4
- package/es/v37/victory-state/defaults.d.ts +0 -3
- package/es/v37/victory-state/defaults.js +0 -2
- package/es/v37/victory-state/helpers/get-axis-data.d.ts +0 -3
- package/es/v37/victory-state/helpers/get-axis-data.js +0 -14
- package/es/v37/victory-state/helpers/get-data.d.ts +0 -15
- package/es/v37/victory-state/helpers/get-data.js +0 -87
- package/es/v37/victory-state/helpers/get-domain.d.ts +0 -6
- package/es/v37/victory-state/helpers/get-domain.js +0 -67
- package/es/v37/victory-state/helpers/get-range.d.ts +0 -6
- package/es/v37/victory-state/helpers/get-range.js +0 -36
- package/es/v37/victory-state/helpers/get-scale.d.ts +0 -6
- package/es/v37/victory-state/helpers/get-scale.js +0 -58
- package/es/v37/victory-state/index.d.ts +0 -4
- package/es/v37/victory-state/index.js +0 -3
- package/es/v37/victory-state/types.d.ts +0 -24
- package/es/v37/victory-state/types.js +0 -1
- package/es/v37/victory-state/victory-provider.d.ts +0 -21
- package/es/v37/victory-state/victory-provider.js +0 -148
- package/es/v37/victory-state/with-victory-provider.d.ts +0 -7
- package/es/v37/victory-state/with-victory-provider.js +0 -43
- package/es/v37/with-container.d.ts +0 -5
- package/es/v37/with-container.js +0 -32
- package/es/v37/with-normalized-props.d.ts +0 -17
- package/es/v37/with-normalized-props.js +0 -18
- package/lib/v37/clone.d.ts +0 -23
- package/lib/v37/clone.js +0 -43
- package/lib/v37/index.d.ts +0 -5
- package/lib/v37/index.js +0 -57
- package/lib/v37/victory-state/defaults.d.ts +0 -3
- package/lib/v37/victory-state/defaults.js +0 -10
- package/lib/v37/victory-state/helpers/get-axis-data.d.ts +0 -3
- package/lib/v37/victory-state/helpers/get-axis-data.js +0 -22
- package/lib/v37/victory-state/helpers/get-data.d.ts +0 -15
- package/lib/v37/victory-state/helpers/get-data.js +0 -98
- package/lib/v37/victory-state/helpers/get-domain.d.ts +0 -6
- package/lib/v37/victory-state/helpers/get-domain.js +0 -81
- package/lib/v37/victory-state/helpers/get-range.d.ts +0 -6
- package/lib/v37/victory-state/helpers/get-range.js +0 -45
- package/lib/v37/victory-state/helpers/get-scale.d.ts +0 -6
- package/lib/v37/victory-state/helpers/get-scale.js +0 -73
- package/lib/v37/victory-state/index.d.ts +0 -4
- package/lib/v37/victory-state/index.js +0 -44
- package/lib/v37/victory-state/types.d.ts +0 -24
- package/lib/v37/victory-state/types.js +0 -1
- package/lib/v37/victory-state/victory-provider.d.ts +0 -21
- package/lib/v37/victory-state/victory-provider.js +0 -175
- package/lib/v37/victory-state/with-victory-provider.d.ts +0 -7
- package/lib/v37/victory-state/with-victory-provider.js +0 -56
- package/lib/v37/with-container.d.ts +0 -5
- package/lib/v37/with-container.js +0 -45
- package/lib/v37/with-normalized-props.d.ts +0 -17
- package/lib/v37/with-normalized-props.js +0 -29
- package/src/v37/clone.tsx +0 -30
- package/src/v37/index.tsx +0 -4
- package/src/v37/victory-state/defaults.ts +0 -2
- package/src/v37/victory-state/helpers/get-axis-data.ts +0 -14
- package/src/v37/victory-state/helpers/get-data.ts +0 -78
- package/src/v37/victory-state/helpers/get-domain.ts +0 -62
- package/src/v37/victory-state/helpers/get-range.ts +0 -39
- package/src/v37/victory-state/helpers/get-scale.ts +0 -67
- package/src/v37/victory-state/index.ts +0 -3
- package/src/v37/victory-state/types.ts +0 -32
- package/src/v37/victory-state/victory-provider.tsx +0 -152
- package/src/v37/victory-state/with-victory-provider.tsx +0 -53
- package/src/v37/with-container.tsx +0 -38
- package/src/v37/with-normalized-props.tsx +0 -43
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { evaluateProp } from "../victory-util/helpers";
|
|
2
3
|
import { VictoryPrimitiveShapeProps } from "./types";
|
|
3
4
|
|
|
4
|
-
export const Circle =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
5
|
+
export const Circle = forwardRef<SVGCircleElement, VictoryPrimitiveShapeProps>(
|
|
6
|
+
(props, ref) => {
|
|
7
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars --
|
|
8
|
+
* origin conflicts with the SVG element's origin attribute
|
|
9
|
+
*/
|
|
10
|
+
const { desc, id, tabIndex, origin, ...rest } = props;
|
|
11
|
+
|
|
12
|
+
const svgProps: React.SVGProps<SVGCircleElement> = {
|
|
13
|
+
vectorEffect: "non-scaling-stroke",
|
|
14
|
+
id: evaluateProp(id, props)?.toString(),
|
|
15
|
+
tabIndex: evaluateProp(tabIndex, props),
|
|
16
|
+
...rest,
|
|
17
|
+
};
|
|
18
|
+
return desc ? (
|
|
19
|
+
<circle {...svgProps} ref={ref}>
|
|
20
|
+
<desc>{desc}</desc>
|
|
21
|
+
</circle>
|
|
22
|
+
) : (
|
|
23
|
+
<circle {...svgProps} ref={ref} />
|
|
24
|
+
);
|
|
25
|
+
},
|
|
26
|
+
);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
|
|
4
3
|
|
|
5
4
|
export interface ClipPathProps extends VictoryCommonPrimitiveProps {
|
|
@@ -9,17 +8,6 @@ export interface ClipPathProps extends VictoryCommonPrimitiveProps {
|
|
|
9
8
|
|
|
10
9
|
export const ClipPath = (props: ClipPathProps) => (
|
|
11
10
|
<defs>
|
|
12
|
-
{
|
|
13
|
-
// @ts-expect-error FIXME: "id cannot be a number"
|
|
14
|
-
<clipPath id={props.clipId}>{props.children}</clipPath>
|
|
15
|
-
}
|
|
11
|
+
{<clipPath id={props.clipId?.toString()}>{props.children}</clipPath>}
|
|
16
12
|
</defs>
|
|
17
13
|
);
|
|
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
|
-
};
|
|
@@ -38,8 +38,14 @@ const evaluateProps = (props) => {
|
|
|
38
38
|
return assign({}, props, { ariaLabel, desc, id, style, tabIndex });
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
+
const defaultProps = {
|
|
42
|
+
lineComponent: <Line />,
|
|
43
|
+
role: "presentation",
|
|
44
|
+
shapeRendering: "auto",
|
|
45
|
+
};
|
|
46
|
+
|
|
41
47
|
export const LineSegment = (props: LineSegmentProps) => {
|
|
42
|
-
props = evaluateProps(props);
|
|
48
|
+
props = evaluateProps({ ...defaultProps, ...props });
|
|
43
49
|
|
|
44
50
|
return React.cloneElement(props.lineComponent!, {
|
|
45
51
|
...props.events,
|
|
@@ -68,9 +74,3 @@ LineSegment.propTypes = {
|
|
|
68
74
|
y1: PropTypes.number,
|
|
69
75
|
y2: PropTypes.number,
|
|
70
76
|
};
|
|
71
|
-
|
|
72
|
-
LineSegment.defaultProps = {
|
|
73
|
-
lineComponent: <Line />,
|
|
74
|
-
role: "presentation",
|
|
75
|
-
shapeRendering: "auto",
|
|
76
|
-
};
|
|
@@ -1,16 +1,27 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { evaluateProp } from "../victory-util/helpers";
|
|
2
3
|
import { VictoryPrimitiveShapeProps } from "./types";
|
|
3
4
|
|
|
4
|
-
export const Line =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
5
|
+
export const Line = forwardRef<SVGLineElement, VictoryPrimitiveShapeProps>(
|
|
6
|
+
(props, ref) => {
|
|
7
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars --
|
|
8
|
+
* origin conflicts with the SVG element's origin attribute
|
|
9
|
+
*/
|
|
10
|
+
const { desc, id, tabIndex, origin, ...rest } = props;
|
|
11
|
+
|
|
12
|
+
const svgProps: React.SVGProps<SVGLineElement> = {
|
|
13
|
+
vectorEffect: "non-scaling-stroke",
|
|
14
|
+
id: evaluateProp(id, props)?.toString(),
|
|
15
|
+
tabIndex: evaluateProp(tabIndex, props),
|
|
16
|
+
...rest,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return desc ? (
|
|
20
|
+
<line {...svgProps} ref={ref}>
|
|
21
|
+
<desc>{desc}</desc>
|
|
22
|
+
</line>
|
|
23
|
+
) : (
|
|
24
|
+
<line {...svgProps} ref={ref} />
|
|
25
|
+
);
|
|
26
|
+
},
|
|
27
|
+
);
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
|
+
import { evaluateProp } from "../victory-util/helpers";
|
|
2
3
|
import { VictoryPrimitiveShapeProps } from "./types";
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
export const Path = forwardRef<SVGPathElement, VictoryPrimitiveShapeProps>(
|
|
6
|
+
(props, ref) => {
|
|
7
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars --
|
|
8
|
+
* origin conflicts with the SVG element's origin attribute
|
|
9
|
+
*/
|
|
10
|
+
const { desc, id, tabIndex, origin, ...rest } = props;
|
|
11
|
+
|
|
12
|
+
const svgProps: React.SVGProps<SVGPathElement> = {
|
|
13
|
+
id: evaluateProp(id, props)?.toString(),
|
|
14
|
+
tabIndex: evaluateProp(tabIndex, props),
|
|
15
|
+
...rest,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
return desc ? (
|
|
19
|
+
<path {...svgProps} ref={ref}>
|
|
20
|
+
<desc>{desc}</desc>
|
|
21
|
+
</path>
|
|
22
|
+
) : (
|
|
23
|
+
<path {...svgProps} ref={ref} />
|
|
24
|
+
);
|
|
25
|
+
},
|
|
26
|
+
);
|
|
@@ -66,8 +66,14 @@ const evaluateProps = (props) => {
|
|
|
66
66
|
});
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
+
const defaultProps = {
|
|
70
|
+
pathComponent: <Path />,
|
|
71
|
+
role: "presentation",
|
|
72
|
+
shapeRendering: "auto",
|
|
73
|
+
};
|
|
74
|
+
|
|
69
75
|
export const Point = (props: PointProps) => {
|
|
70
|
-
props = evaluateProps(props);
|
|
76
|
+
props = evaluateProps({ ...defaultProps, ...props });
|
|
71
77
|
const userProps = UserProps.getSafeUserProps(props);
|
|
72
78
|
|
|
73
79
|
return React.cloneElement(props.pathComponent!, {
|
|
@@ -109,9 +115,3 @@ Point.propTypes = {
|
|
|
109
115
|
x: PropTypes.number,
|
|
110
116
|
y: PropTypes.number,
|
|
111
117
|
};
|
|
112
|
-
|
|
113
|
-
Point.defaultProps = {
|
|
114
|
-
pathComponent: <Path />,
|
|
115
|
-
role: "presentation",
|
|
116
|
-
shapeRendering: "auto",
|
|
117
|
-
};
|
|
@@ -1,16 +1,27 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { evaluateProp } from "../victory-util/helpers";
|
|
2
3
|
import { VictoryPrimitiveShapeProps } from "./types";
|
|
3
4
|
|
|
4
|
-
export const Rect =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
5
|
+
export const Rect = forwardRef<SVGRectElement, VictoryPrimitiveShapeProps>(
|
|
6
|
+
(props, ref) => {
|
|
7
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars --
|
|
8
|
+
* origin conflicts with the SVG element's origin attribute
|
|
9
|
+
*/
|
|
10
|
+
const { desc, id, tabIndex, origin, ...rest } = props;
|
|
11
|
+
|
|
12
|
+
const svgProps: React.SVGProps<SVGRectElement> = {
|
|
13
|
+
vectorEffect: "non-scaling-stroke",
|
|
14
|
+
id: evaluateProp(id, props)?.toString(),
|
|
15
|
+
tabIndex: evaluateProp(tabIndex, props),
|
|
16
|
+
...rest,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return desc ? (
|
|
20
|
+
<rect {...svgProps} ref={ref}>
|
|
21
|
+
<desc>{desc}</desc>
|
|
22
|
+
</rect>
|
|
23
|
+
) : (
|
|
24
|
+
<rect {...svgProps} ref={ref} />
|
|
25
|
+
);
|
|
26
|
+
},
|
|
27
|
+
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
2
|
+
import { evaluateProp } from "../victory-util/helpers";
|
|
3
3
|
import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
|
|
4
4
|
|
|
5
5
|
export interface TextProps extends VictoryCommonPrimitiveProps {
|
|
@@ -9,19 +9,22 @@ export interface TextProps extends VictoryCommonPrimitiveProps {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export const Text = (props: TextProps) => {
|
|
12
|
-
|
|
12
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars --
|
|
13
|
+
* origin conflicts with the SVG element's origin attribute
|
|
14
|
+
*/
|
|
15
|
+
const { children, desc, id, origin, tabIndex, title, ...rest } = props;
|
|
16
|
+
|
|
17
|
+
const svgProps: React.SVGProps<SVGTextElement> = {
|
|
18
|
+
id: evaluateProp(id, props)?.toString(),
|
|
19
|
+
tabIndex: evaluateProp(tabIndex, props),
|
|
20
|
+
...rest,
|
|
21
|
+
};
|
|
22
|
+
|
|
13
23
|
return (
|
|
14
|
-
|
|
15
|
-
<text {...rest}>
|
|
24
|
+
<text {...svgProps}>
|
|
16
25
|
{title && <title>{title}</title>}
|
|
17
26
|
{desc && <desc>{desc}</desc>}
|
|
18
27
|
{children}
|
|
19
28
|
</text>
|
|
20
29
|
);
|
|
21
30
|
};
|
|
22
|
-
|
|
23
|
-
Text.propTypes = {
|
|
24
|
-
children: PropTypes.node,
|
|
25
|
-
desc: PropTypes.string,
|
|
26
|
-
title: PropTypes.string,
|
|
27
|
-
};
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { evaluateProp } from "../victory-util/helpers";
|
|
2
3
|
import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
|
|
3
4
|
|
|
4
|
-
export const TSpan = (props: VictoryCommonPrimitiveProps) =>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
export const TSpan = (props: VictoryCommonPrimitiveProps) => {
|
|
6
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars --
|
|
7
|
+
* origin conflicts with the SVG element's origin attribute
|
|
8
|
+
*/
|
|
9
|
+
const { desc, id, tabIndex, origin, ...rest } = props;
|
|
10
|
+
|
|
11
|
+
const svgProps: React.SVGProps<SVGTSpanElement> = {
|
|
12
|
+
id: evaluateProp(id, props)?.toString(),
|
|
13
|
+
tabIndex: evaluateProp(tabIndex, props),
|
|
14
|
+
...rest,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return <tspan {...svgProps} />;
|
|
18
|
+
};
|
|
@@ -40,8 +40,15 @@ const evaluateProps = (props) => {
|
|
|
40
40
|
return assign({}, props, { ariaLabel, desc, id, style, tabIndex });
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
const defaultProps = {
|
|
44
|
+
groupComponent: <g />,
|
|
45
|
+
lineComponent: <Line />,
|
|
46
|
+
role: "presentation",
|
|
47
|
+
shapeRendering: "auto",
|
|
48
|
+
};
|
|
49
|
+
|
|
43
50
|
export const Whisker = (props: WhiskerProps) => {
|
|
44
|
-
props = evaluateProps(props);
|
|
51
|
+
props = evaluateProps({ ...defaultProps, ...props });
|
|
45
52
|
const {
|
|
46
53
|
ariaLabel,
|
|
47
54
|
groupComponent,
|
|
@@ -107,10 +114,3 @@ Whisker.propTypes = {
|
|
|
107
114
|
y2: PropTypes.number,
|
|
108
115
|
}),
|
|
109
116
|
};
|
|
110
|
-
|
|
111
|
-
Whisker.defaultProps = {
|
|
112
|
-
groupComponent: <g />,
|
|
113
|
-
lineComponent: <Line />,
|
|
114
|
-
role: "presentation",
|
|
115
|
-
shapeRendering: "auto",
|
|
116
|
-
};
|
|
@@ -68,9 +68,9 @@ export interface EventsMixinClass<TProps> {
|
|
|
68
68
|
defaultAnimationWhitelist: string[],
|
|
69
69
|
): React.ReactElement;
|
|
70
70
|
getComponentProps(
|
|
71
|
-
component: React.
|
|
71
|
+
component: React.ReactNode,
|
|
72
72
|
type: string,
|
|
73
|
-
index: number,
|
|
73
|
+
index: string | number,
|
|
74
74
|
): TProps;
|
|
75
75
|
dataKeys: string[];
|
|
76
76
|
}
|
|
@@ -352,7 +352,11 @@ export function addEvents<
|
|
|
352
352
|
return props.events;
|
|
353
353
|
}
|
|
354
354
|
|
|
355
|
-
getComponentProps(
|
|
355
|
+
getComponentProps(
|
|
356
|
+
component: React.ReactNode,
|
|
357
|
+
type: string,
|
|
358
|
+
index: string | number,
|
|
359
|
+
) {
|
|
356
360
|
const name = this.props.name || WrappedComponent.role;
|
|
357
361
|
const key = (this.dataKeys && this.dataKeys[index]) || index;
|
|
358
362
|
const id = `${name}-${type}-${key}`;
|
|
@@ -365,13 +369,18 @@ export function addEvents<
|
|
|
365
369
|
return undefined;
|
|
366
370
|
}
|
|
367
371
|
|
|
372
|
+
const currentProps =
|
|
373
|
+
component && typeof component === "object" && "props" in component
|
|
374
|
+
? component.props
|
|
375
|
+
: undefined;
|
|
376
|
+
|
|
368
377
|
if (this.hasEvents) {
|
|
369
378
|
const baseEvents = this.getEvents(this.props, type, key);
|
|
370
379
|
const componentProps = defaults(
|
|
371
380
|
{ index, key: id },
|
|
372
381
|
this.getEventState(key, type),
|
|
373
382
|
this.getSharedEventState(key, type),
|
|
374
|
-
|
|
383
|
+
currentProps,
|
|
375
384
|
baseProps,
|
|
376
385
|
{ id },
|
|
377
386
|
);
|
|
@@ -385,7 +394,7 @@ export function addEvents<
|
|
|
385
394
|
return assign({}, componentProps, { events });
|
|
386
395
|
}
|
|
387
396
|
|
|
388
|
-
return defaults({ index, key: id },
|
|
397
|
+
return defaults({ index, key: id }, currentProps, baseProps, { id });
|
|
389
398
|
}
|
|
390
399
|
|
|
391
400
|
renderContainer(component, children) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-use-before-define */
|
|
2
|
-
import React from "react";
|
|
2
|
+
import React, { isValidElement } from "react";
|
|
3
3
|
import { defaults, isFunction, property, pick, assign, keys } from "lodash";
|
|
4
4
|
import { CallbackArgs } from "../types/callbacks";
|
|
5
5
|
import { ValueOrAccessor } from "../types/prop-types";
|
|
@@ -301,8 +301,10 @@ export function reduceChildren<
|
|
|
301
301
|
return memo;
|
|
302
302
|
}, initialMemo);
|
|
303
303
|
};
|
|
304
|
-
|
|
305
|
-
|
|
304
|
+
|
|
305
|
+
const validChildren = children.filter(isValidElement);
|
|
306
|
+
const childNames = validChildren.map((c, i) => i);
|
|
307
|
+
return traverseChildren(validChildren, childNames);
|
|
306
308
|
}
|
|
307
309
|
|
|
308
310
|
/**
|
|
@@ -297,7 +297,11 @@ const styleToKeyComponent = (style) => {
|
|
|
297
297
|
|
|
298
298
|
const _measureDimensionsInternal = memoize(
|
|
299
299
|
(text: string | string[], style?: TextSizeStyleInterface) => {
|
|
300
|
-
|
|
300
|
+
let containerElement = _getMeasurementContainer();
|
|
301
|
+
if (!containerElement.isConnected) {
|
|
302
|
+
_getMeasurementContainer.cache.clear?.();
|
|
303
|
+
containerElement = _getMeasurementContainer();
|
|
304
|
+
}
|
|
301
305
|
|
|
302
306
|
const lines = _splitToLines(text);
|
|
303
307
|
let heightAcc = 0;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { evaluateProp } from "./helpers";
|
|
2
3
|
|
|
3
4
|
/*
|
|
4
5
|
USER_PROPS_SAFELIST is to contain any string deemed safe for user props.
|
|
@@ -54,19 +55,6 @@ const testIfSafeProp = (key: string): key is SafeAttribute => {
|
|
|
54
55
|
return false;
|
|
55
56
|
};
|
|
56
57
|
|
|
57
|
-
/**
|
|
58
|
-
* Gets the value from props if a function value is provided
|
|
59
|
-
* @param {any} value: maybe function value
|
|
60
|
-
* @param {Object} props: props object
|
|
61
|
-
* @returns {any} newValue
|
|
62
|
-
*/
|
|
63
|
-
const getValue = (value, props) => {
|
|
64
|
-
if (typeof value === "function") {
|
|
65
|
-
return value(props);
|
|
66
|
-
}
|
|
67
|
-
return value;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
58
|
/**
|
|
71
59
|
* getSafeUserProps - function that takes in a props object and removes any
|
|
72
60
|
* key-value entries that do not match filter strings in the USER_PROPS_SAFELIST
|
|
@@ -83,7 +71,7 @@ export const getSafeUserProps = <T>(
|
|
|
83
71
|
Object.entries(propsToFilter)
|
|
84
72
|
.filter(([key]) => testIfSafeProp(key))
|
|
85
73
|
.map(([key, value]) => {
|
|
86
|
-
return [key,
|
|
74
|
+
return [key, evaluateProp(value, props)];
|
|
87
75
|
}),
|
|
88
76
|
);
|
|
89
77
|
};
|
package/es/v37/clone.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
/**
|
|
3
|
-
* Syntax sugar for `React.cloneElement`, so that we can use JSX instead
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* // Before:
|
|
7
|
-
* const children = React.cloneElement(props.groupComponent, { prop2 }, props.children);
|
|
8
|
-
* return React.cloneElement(props.containerComponent, { prop1 }, children);
|
|
9
|
-
*
|
|
10
|
-
* // After:
|
|
11
|
-
* return (
|
|
12
|
-
* <Clone element={props.containerComponent} prop1={prop1}>
|
|
13
|
-
* <Clone element={props.groupComponent} prop2={prop2}>
|
|
14
|
-
* {props.children}
|
|
15
|
-
* </Clone>
|
|
16
|
-
* </Clone>
|
|
17
|
-
* );
|
|
18
|
-
*/
|
|
19
|
-
export declare const Clone: <TProps>(props: React.PropsWithChildren<{
|
|
20
|
-
element: React.ReactElement<TProps, string | React.JSXElementConstructor<any>>;
|
|
21
|
-
children?: React.ReactNode | React.ReactNode[];
|
|
22
|
-
} & TProps>) => React.ReactElement<TProps, string | React.JSXElementConstructor<any>>;
|
|
23
|
-
//# sourceMappingURL=clone.d.ts.map
|
package/es/v37/clone.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
var _excluded = ["children", "element"];
|
|
2
|
-
|
|
3
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
|
-
|
|
5
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
|
-
|
|
7
|
-
import React from "react";
|
|
8
|
-
/**
|
|
9
|
-
* Syntax sugar for `React.cloneElement`, so that we can use JSX instead
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* // Before:
|
|
13
|
-
* const children = React.cloneElement(props.groupComponent, { prop2 }, props.children);
|
|
14
|
-
* return React.cloneElement(props.containerComponent, { prop1 }, children);
|
|
15
|
-
*
|
|
16
|
-
* // After:
|
|
17
|
-
* return (
|
|
18
|
-
* <Clone element={props.containerComponent} prop1={prop1}>
|
|
19
|
-
* <Clone element={props.groupComponent} prop2={prop2}>
|
|
20
|
-
* {props.children}
|
|
21
|
-
* </Clone>
|
|
22
|
-
* </Clone>
|
|
23
|
-
* );
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
export var Clone = function (props) {
|
|
27
|
-
var children = props.children,
|
|
28
|
-
element = props.element,
|
|
29
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
30
|
-
|
|
31
|
-
return /*#__PURE__*/React.cloneElement(element, rest, children);
|
|
32
|
-
};
|
package/es/v37/index.d.ts
DELETED
package/es/v37/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { isKeyValueObject } from "../../../victory-util/type-helpers";
|
|
2
|
-
export function getAxisData(data, axis) {
|
|
3
|
-
return data.reduce(function (acc, datum) {
|
|
4
|
-
if (isKeyValueObject(datum)) {
|
|
5
|
-
var value = datum[axis];
|
|
6
|
-
|
|
7
|
-
if (value && typeof value !== "string") {
|
|
8
|
-
acc.push(value);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return acc;
|
|
13
|
-
}, []);
|
|
14
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { DatumValue } from "../../../types/prop-types";
|
|
2
|
-
import { VictoryProviderProps } from "../types";
|
|
3
|
-
declare type DataProps = Pick<VictoryProviderProps, "data" | "x" | "y" | "sortKey" | "sortOrder" | "samples">;
|
|
4
|
-
export interface FormattedDatum {
|
|
5
|
-
x: DatumValue;
|
|
6
|
-
y: DatumValue;
|
|
7
|
-
_x: number | Date;
|
|
8
|
-
_y: number | Date;
|
|
9
|
-
xName?: string;
|
|
10
|
-
yName?: string;
|
|
11
|
-
[key: string]: DatumValue;
|
|
12
|
-
}
|
|
13
|
-
export declare function getData({ x: xAccessor, y: yAccessor, sortKey, sortOrder, data, }?: DataProps): FormattedDatum[];
|
|
14
|
-
export {};
|
|
15
|
-
//# sourceMappingURL=get-data.d.ts.map
|