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
|
@@ -2,13 +2,48 @@ import React from "react";
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import * as CustomPropTypes from "../victory-util/prop-types";
|
|
4
4
|
import { assign, defaults, uniqueId, isObject, isFunction } from "lodash";
|
|
5
|
-
import Portal from "../victory-portal/portal";
|
|
6
|
-
import PortalContext from "../victory-portal/portal-context";
|
|
5
|
+
import { Portal } from "../victory-portal/portal";
|
|
6
|
+
import { PortalContext } from "../victory-portal/portal-context";
|
|
7
7
|
import TimerContext from "../victory-util/timer-context";
|
|
8
8
|
import * as Helpers from "../victory-util/helpers";
|
|
9
9
|
import * as UserProps from "../victory-util/user-props";
|
|
10
|
+
import { OriginType } from "../victory-label/victory-label";
|
|
11
|
+
import { D3Scale } from "../victory-util/types";
|
|
12
|
+
import { VictoryThemeDefinition } from "../victory-theme/victory-theme-definition";
|
|
10
13
|
|
|
11
|
-
export
|
|
14
|
+
export interface VictoryContainerProps {
|
|
15
|
+
"aria-describedby"?: string;
|
|
16
|
+
"aria-labelledby"?: string;
|
|
17
|
+
children?: React.ReactElement | React.ReactElement[];
|
|
18
|
+
className?: string;
|
|
19
|
+
containerId?: number | string;
|
|
20
|
+
containerRef?: React.Ref<HTMLElement>;
|
|
21
|
+
desc?: string;
|
|
22
|
+
events?: React.DOMAttributes<any>;
|
|
23
|
+
height?: number;
|
|
24
|
+
name?: string;
|
|
25
|
+
origin?: OriginType;
|
|
26
|
+
ouiaId?: number | string;
|
|
27
|
+
ouiaSafe?: boolean;
|
|
28
|
+
ouiaType?: string;
|
|
29
|
+
polar?: boolean;
|
|
30
|
+
portalComponent?: React.ReactElement;
|
|
31
|
+
portalZIndex?: number;
|
|
32
|
+
preserveAspectRatio?: string;
|
|
33
|
+
responsive?: boolean;
|
|
34
|
+
role?: string;
|
|
35
|
+
scale?: {
|
|
36
|
+
x?: D3Scale;
|
|
37
|
+
y?: D3Scale;
|
|
38
|
+
};
|
|
39
|
+
style?: React.CSSProperties;
|
|
40
|
+
tabIndex?: number;
|
|
41
|
+
theme?: VictoryThemeDefinition;
|
|
42
|
+
title?: string;
|
|
43
|
+
width?: number;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export class VictoryContainer extends React.Component<VictoryContainerProps> {
|
|
12
47
|
static displayName = "VictoryContainer";
|
|
13
48
|
static role = "container";
|
|
14
49
|
static propTypes = {
|
|
@@ -54,34 +89,39 @@ export default class VictoryContainer extends React.Component {
|
|
|
54
89
|
};
|
|
55
90
|
|
|
56
91
|
static contextType = TimerContext;
|
|
92
|
+
private containerId: VictoryContainerProps["containerId"];
|
|
93
|
+
// @ts-expect-error Ref will be initialized on mount
|
|
94
|
+
private portalRef: Portal;
|
|
95
|
+
// @ts-expect-error Ref will be initialized on mount
|
|
96
|
+
private containerRef: HTMLElement;
|
|
97
|
+
private shouldHandleWheel: boolean;
|
|
57
98
|
|
|
58
|
-
constructor(props) {
|
|
99
|
+
constructor(props: VictoryContainerProps) {
|
|
59
100
|
super(props);
|
|
60
101
|
this.containerId =
|
|
61
102
|
!isObject(props) || props.containerId === undefined
|
|
62
103
|
? uniqueId("victory-container-")
|
|
63
104
|
: props.containerId;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return portal;
|
|
67
|
-
};
|
|
68
|
-
this.portalUpdate = (key, el) => this.portalRef.portalUpdate(key, el);
|
|
69
|
-
this.portalRegister = () => this.portalRef.portalRegister();
|
|
70
|
-
this.portalDeregister = (key) => this.portalRef.portalDeregister(key);
|
|
71
|
-
|
|
72
|
-
this.saveContainerRef =
|
|
73
|
-
props && isFunction(props.containerRef)
|
|
74
|
-
? props.containerRef
|
|
75
|
-
: (container) => {
|
|
76
|
-
this.containerRef = container;
|
|
77
|
-
return container;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
this.shouldHandleWheel = props && props.events && props.events.onWheel;
|
|
81
|
-
if (this.shouldHandleWheel) {
|
|
82
|
-
this.handleWheel = (e) => e.preventDefault();
|
|
83
|
-
}
|
|
105
|
+
|
|
106
|
+
this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
|
|
84
107
|
}
|
|
108
|
+
savePortalRef = (portal) => {
|
|
109
|
+
this.portalRef = portal;
|
|
110
|
+
return portal;
|
|
111
|
+
};
|
|
112
|
+
portalUpdate = (key, el) => this.portalRef.portalUpdate(key, el);
|
|
113
|
+
portalRegister = () => this.portalRef.portalRegister();
|
|
114
|
+
portalDeregister = (key) => this.portalRef.portalDeregister(key);
|
|
115
|
+
|
|
116
|
+
saveContainerRef = (container: HTMLElement) => {
|
|
117
|
+
if (isFunction(this.props.containerRef)) {
|
|
118
|
+
this.props.containerRef(container);
|
|
119
|
+
}
|
|
120
|
+
this.containerRef = container;
|
|
121
|
+
return container;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
handleWheel = (e) => e.preventDefault();
|
|
85
125
|
|
|
86
126
|
componentDidMount() {
|
|
87
127
|
if (this.shouldHandleWheel && this.containerRef) {
|
|
@@ -131,11 +171,15 @@ export default class VictoryContainer extends React.Component {
|
|
|
131
171
|
? { width: "100%", height: "100%" }
|
|
132
172
|
: { width, height };
|
|
133
173
|
const divStyle = assign(
|
|
134
|
-
{
|
|
174
|
+
{
|
|
175
|
+
pointerEvents: "none",
|
|
176
|
+
touchAction: "none",
|
|
177
|
+
position: "relative"
|
|
178
|
+
} as const,
|
|
135
179
|
dimensions
|
|
136
180
|
);
|
|
137
181
|
const portalDivStyle = assign(
|
|
138
|
-
{ zIndex: portalZIndex, position: "absolute", top: 0, left: 0 },
|
|
182
|
+
{ zIndex: portalZIndex, position: "absolute", top: 0, left: 0 } as const,
|
|
139
183
|
dimensions
|
|
140
184
|
);
|
|
141
185
|
const svgStyle = assign({ pointerEvents: "all" }, dimensions);
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { assign, defaults, isEmpty } from "lodash";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import React from "react";
|
|
5
|
-
import VictoryPortal from "../victory-portal/victory-portal";
|
|
6
|
-
import Rect from "../victory-primitives/rect";
|
|
7
|
-
import Text from "../victory-primitives/text";
|
|
8
|
-
import TSpan from "../victory-primitives/tspan";
|
|
5
|
+
import { VictoryPortal } from "../victory-portal/victory-portal";
|
|
6
|
+
import { Rect } from "../victory-primitives/rect";
|
|
7
|
+
import { Text } from "../victory-primitives/text";
|
|
8
|
+
import { TSpan } from "../victory-primitives/tspan";
|
|
9
9
|
import * as Helpers from "../victory-util/helpers";
|
|
10
10
|
import * as LabelHelpers from "../victory-util/label-helpers";
|
|
11
11
|
import * as Log from "../victory-util/log";
|
|
@@ -13,6 +13,55 @@ import * as CustomPropTypes from "../victory-util/prop-types";
|
|
|
13
13
|
import * as Style from "../victory-util/style";
|
|
14
14
|
import * as TextSize from "../victory-util/textsize";
|
|
15
15
|
import * as UserProps from "../victory-util/user-props";
|
|
16
|
+
import { StringOrCallback, StringOrNumberOrCallback } from "../types";
|
|
17
|
+
import {
|
|
18
|
+
NumberOrCallback,
|
|
19
|
+
PaddingProps,
|
|
20
|
+
VerticalAnchorType,
|
|
21
|
+
VictoryLabelStyleObject
|
|
22
|
+
} from "../victory-theme/victory-theme";
|
|
23
|
+
|
|
24
|
+
export type TextAnchorType = "start" | "middle" | "end" | "inherit";
|
|
25
|
+
export type OriginType = { x: number; y: number };
|
|
26
|
+
export type LabelOrientationType = "parallel" | "perpendicular" | "vertical";
|
|
27
|
+
|
|
28
|
+
export interface VictoryLabelProps {
|
|
29
|
+
angle?: StringOrNumberOrCallback;
|
|
30
|
+
ariaLabel?: StringOrCallback;
|
|
31
|
+
backgroundComponent?: React.ReactElement;
|
|
32
|
+
backgroundStyle?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
33
|
+
backgroundPadding?: PaddingProps | PaddingProps[];
|
|
34
|
+
capHeight?: StringOrNumberOrCallback;
|
|
35
|
+
children?: StringOrNumberOrCallback;
|
|
36
|
+
className?: string;
|
|
37
|
+
datum?: object;
|
|
38
|
+
data?: any[];
|
|
39
|
+
desc?: string;
|
|
40
|
+
direction?: string;
|
|
41
|
+
disableInlineStyles?: boolean;
|
|
42
|
+
events?: React.DOMAttributes<any>;
|
|
43
|
+
groupComponent?: React.ReactElement;
|
|
44
|
+
id?: StringOrNumberOrCallback;
|
|
45
|
+
inline?: boolean;
|
|
46
|
+
labelPlacement?: LabelOrientationType;
|
|
47
|
+
lineHeight?: StringOrNumberOrCallback | (string | number)[];
|
|
48
|
+
origin?: OriginType;
|
|
49
|
+
polar?: boolean;
|
|
50
|
+
renderInPortal?: boolean;
|
|
51
|
+
style?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
52
|
+
tabIndex?: NumberOrCallback;
|
|
53
|
+
text?: string[] | StringOrNumberOrCallback;
|
|
54
|
+
textComponent?: React.ReactElement;
|
|
55
|
+
textAnchor?: TextAnchorType | { (): TextAnchorType };
|
|
56
|
+
title?: string;
|
|
57
|
+
transform?: string | object | (() => string | object);
|
|
58
|
+
tspanComponent?: React.ReactElement;
|
|
59
|
+
verticalAnchor?: VerticalAnchorType | { (): VerticalAnchorType };
|
|
60
|
+
x?: number;
|
|
61
|
+
y?: number;
|
|
62
|
+
dx?: StringOrNumberOrCallback;
|
|
63
|
+
dy?: StringOrNumberOrCallback;
|
|
64
|
+
}
|
|
16
65
|
|
|
17
66
|
const defaultStyles = {
|
|
18
67
|
fill: "#252525",
|
|
@@ -48,7 +97,7 @@ const getFontSize = (style) => {
|
|
|
48
97
|
return defaultStyles.fontSize;
|
|
49
98
|
};
|
|
50
99
|
|
|
51
|
-
const getSingleValue = (prop, index = 0) => {
|
|
100
|
+
const getSingleValue = <T,>(prop: T | T[], index = 0): T => {
|
|
52
101
|
return Array.isArray(prop) ? prop[index] || prop[0] : prop;
|
|
53
102
|
};
|
|
54
103
|
|
|
@@ -433,9 +482,9 @@ const evaluateProps = (props) => {
|
|
|
433
482
|
});
|
|
434
483
|
};
|
|
435
484
|
|
|
436
|
-
const getCalculatedProps = (props) => {
|
|
485
|
+
const getCalculatedProps = <T extends VictoryLabelProps>(props: T) => {
|
|
437
486
|
const ariaLabel = Helpers.evaluateProp(props.ariaLabel, props);
|
|
438
|
-
const style = getSingleValue(props.style);
|
|
487
|
+
const style = getSingleValue(props.style!);
|
|
439
488
|
const lineHeight = getLineHeight(props);
|
|
440
489
|
const direction = props.direction
|
|
441
490
|
? Helpers.evaluateProp(props.direction, props)
|
|
@@ -524,7 +573,10 @@ const renderLabel = (calculatedProps, tspanValues) => {
|
|
|
524
573
|
return React.cloneElement(textComponent, textProps, tspans);
|
|
525
574
|
};
|
|
526
575
|
|
|
527
|
-
const VictoryLabel
|
|
576
|
+
export const VictoryLabel: {
|
|
577
|
+
role: string;
|
|
578
|
+
defaultStyles: typeof defaultStyles;
|
|
579
|
+
} & React.FC<VictoryLabelProps> = (props) => {
|
|
528
580
|
props = evaluateProps(props);
|
|
529
581
|
|
|
530
582
|
if (props.text === null || props.text === undefined) {
|
|
@@ -535,11 +587,11 @@ const VictoryLabel = (props) => {
|
|
|
535
587
|
const { text, style, capHeight, backgroundPadding, lineHeight } =
|
|
536
588
|
calculatedProps;
|
|
537
589
|
|
|
538
|
-
const tspanValues = text.map((line, i) => {
|
|
539
|
-
const currentStyle = getSingleValue(style
|
|
590
|
+
const tspanValues = (text as string[]).map((line, i) => {
|
|
591
|
+
const currentStyle = getSingleValue(style!, i);
|
|
540
592
|
const capHeightPx = TextSize.convertLengthToPixels(
|
|
541
593
|
`${capHeight}em`,
|
|
542
|
-
currentStyle.fontSize
|
|
594
|
+
currentStyle.fontSize as number
|
|
543
595
|
);
|
|
544
596
|
const currentLineHeight = getSingleValue(lineHeight, i);
|
|
545
597
|
return {
|
|
@@ -547,6 +599,7 @@ const VictoryLabel = (props) => {
|
|
|
547
599
|
fontSize: currentStyle.fontSize || defaultStyles.fontSize,
|
|
548
600
|
capHeight: capHeightPx,
|
|
549
601
|
text: line,
|
|
602
|
+
// @ts-expect-error TODO: This looks like a bug:
|
|
550
603
|
textSize: TextSize.approximateTextSize(line, currentStyle),
|
|
551
604
|
lineHeight: currentLineHeight,
|
|
552
605
|
backgroundPadding: getSingleValue(backgroundPadding, i)
|
|
@@ -562,7 +615,7 @@ const VictoryLabel = (props) => {
|
|
|
562
615
|
);
|
|
563
616
|
const children = [backgroundElement, label];
|
|
564
617
|
const backgroundWithLabel = React.cloneElement(
|
|
565
|
-
props.groupComponent
|
|
618
|
+
props.groupComponent!,
|
|
566
619
|
{},
|
|
567
620
|
children
|
|
568
621
|
);
|
|
@@ -603,6 +656,7 @@ VictoryLabel.propTypes = {
|
|
|
603
656
|
className: PropTypes.string,
|
|
604
657
|
data: PropTypes.array,
|
|
605
658
|
datum: PropTypes.any,
|
|
659
|
+
// @ts-expect-error "Function is not assignable to string"
|
|
606
660
|
desc: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
607
661
|
direction: PropTypes.oneOf(["rtl", "ltr", "inherit"]),
|
|
608
662
|
dx: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
@@ -619,6 +673,7 @@ VictoryLabel.propTypes = {
|
|
|
619
673
|
PropTypes.func,
|
|
620
674
|
PropTypes.array
|
|
621
675
|
]),
|
|
676
|
+
// @ts-expect-error "x is required in origin"
|
|
622
677
|
origin: PropTypes.shape({
|
|
623
678
|
x: CustomPropTypes.nonNegative,
|
|
624
679
|
y: CustomPropTypes.nonNegative
|
|
@@ -637,6 +692,7 @@ VictoryLabel.propTypes = {
|
|
|
637
692
|
PropTypes.func,
|
|
638
693
|
PropTypes.array
|
|
639
694
|
]),
|
|
695
|
+
// @ts-expect-error Function is not assignable to string"
|
|
640
696
|
textAnchor: PropTypes.oneOfType([
|
|
641
697
|
PropTypes.oneOf(["start", "middle", "end", "inherit"]),
|
|
642
698
|
PropTypes.func
|
|
@@ -649,11 +705,14 @@ VictoryLabel.propTypes = {
|
|
|
649
705
|
PropTypes.func
|
|
650
706
|
]),
|
|
651
707
|
tspanComponent: PropTypes.element,
|
|
708
|
+
// @ts-expect-error Function is not assignable to string"
|
|
652
709
|
verticalAnchor: PropTypes.oneOfType([
|
|
653
710
|
PropTypes.oneOf(["start", "middle", "end"]),
|
|
654
711
|
PropTypes.func
|
|
655
712
|
]),
|
|
713
|
+
// @ts-expect-error Number is not assignable to string
|
|
656
714
|
x: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
715
|
+
// @ts-expect-error Number is not assignable to string
|
|
657
716
|
y: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
658
717
|
};
|
|
659
718
|
|
|
@@ -666,5 +725,3 @@ VictoryLabel.defaultProps = {
|
|
|
666
725
|
capHeight: 0.71, // Magic number from d3.
|
|
667
726
|
lineHeight: 1
|
|
668
727
|
};
|
|
669
|
-
|
|
670
|
-
export default VictoryLabel;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export interface PortalContextValue {
|
|
4
|
+
portalRegister(): number;
|
|
5
|
+
portalUpdate(key: number, element: React.ReactElement): void;
|
|
6
|
+
portalDeregister(key: number): void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The React context object consumers may use to access the context of the
|
|
11
|
+
* portal.
|
|
12
|
+
*/
|
|
13
|
+
export const PortalContext = React.createContext({} as PortalContextValue);
|
|
14
|
+
PortalContext.displayName = "PortalContext";
|
|
@@ -2,8 +2,20 @@ import React from "react";
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import * as CustomPropTypes from "../victory-util/prop-types";
|
|
4
4
|
import { keys } from "lodash";
|
|
5
|
+
import { PortalContextValue } from "./portal-context";
|
|
6
|
+
|
|
7
|
+
export interface PortalProps {
|
|
8
|
+
className?: string;
|
|
9
|
+
height?: number;
|
|
10
|
+
style?: React.CSSProperties;
|
|
11
|
+
viewBox?: string;
|
|
12
|
+
width?: number;
|
|
13
|
+
}
|
|
5
14
|
|
|
6
|
-
export
|
|
15
|
+
export class Portal
|
|
16
|
+
extends React.Component<PortalProps>
|
|
17
|
+
implements PortalContextValue
|
|
18
|
+
{
|
|
7
19
|
static displayName = "Portal";
|
|
8
20
|
|
|
9
21
|
static propTypes = {
|
|
@@ -13,31 +25,30 @@ export default class Portal extends React.Component {
|
|
|
13
25
|
viewBox: PropTypes.string,
|
|
14
26
|
width: CustomPropTypes.nonNegative
|
|
15
27
|
};
|
|
28
|
+
private readonly map: Record<string, React.ReactElement>;
|
|
29
|
+
private index: number;
|
|
16
30
|
|
|
17
|
-
constructor(props) {
|
|
31
|
+
constructor(props: PortalProps) {
|
|
18
32
|
super(props);
|
|
19
33
|
this.map = {};
|
|
20
34
|
this.index = 1;
|
|
21
|
-
this.portalUpdate = this.portalUpdate.bind(this);
|
|
22
|
-
this.portalRegister = this.portalRegister.bind(this);
|
|
23
|
-
this.portalDeregister = this.portalDeregister.bind(this);
|
|
24
35
|
}
|
|
25
36
|
|
|
26
|
-
portalRegister() {
|
|
37
|
+
public portalRegister = (): number => {
|
|
27
38
|
return ++this.index;
|
|
28
|
-
}
|
|
39
|
+
};
|
|
29
40
|
|
|
30
|
-
portalUpdate(key, element) {
|
|
41
|
+
public portalUpdate = (key: number, element: React.ReactElement) => {
|
|
31
42
|
this.map[key] = element;
|
|
32
43
|
this.forceUpdate();
|
|
33
|
-
}
|
|
44
|
+
};
|
|
34
45
|
|
|
35
|
-
portalDeregister(key) {
|
|
46
|
+
public portalDeregister = (key: number) => {
|
|
36
47
|
delete this.map[key];
|
|
37
48
|
this.forceUpdate();
|
|
38
|
-
}
|
|
49
|
+
};
|
|
39
50
|
|
|
40
|
-
getChildren() {
|
|
51
|
+
private getChildren() {
|
|
41
52
|
return keys(this.map).map((key) => {
|
|
42
53
|
const el = this.map[key];
|
|
43
54
|
return el ? React.cloneElement(el, { key }) : el;
|
|
@@ -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;
|