victory-core 36.3.2 → 36.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/victory-core.js +15084 -15018
- package/dist/victory-core.min.js +1 -1
- package/es/index.d.ts +38 -941
- package/es/index.js +19 -28
- package/es/types.d.ts +33 -0
- package/es/types.js +1 -0
- package/es/victory-accessible-group/victory-accessible-group.d.ts +25 -0
- package/es/victory-accessible-group/victory-accessible-group.js +35 -45
- package/es/victory-animation/util.d.ts +66 -0
- package/es/victory-animation/util.js +3 -2
- package/es/victory-animation/victory-animation.d.ts +69 -0
- package/es/victory-animation/victory-animation.js +92 -102
- package/es/victory-clip-container/victory-clip-container.d.ts +76 -0
- package/es/victory-clip-container/victory-clip-container.js +75 -82
- package/es/victory-container/victory-container.d.ts +99 -0
- package/es/victory-container/victory-container.js +97 -107
- package/es/victory-label/victory-label.d.ts +61 -0
- package/es/victory-label/victory-label.js +43 -31
- package/es/victory-portal/portal-context.d.ts +11 -0
- package/es/victory-portal/portal-context.js +3 -4
- package/es/victory-portal/portal.d.ts +28 -0
- package/es/victory-portal/portal.js +44 -50
- package/es/victory-portal/victory-portal.d.ts +31 -0
- package/es/victory-portal/victory-portal.js +38 -47
- package/es/victory-primitives/arc.d.ts +21 -0
- package/es/victory-primitives/arc.js +9 -9
- package/es/victory-primitives/background.d.ts +22 -0
- package/es/victory-primitives/background.js +12 -12
- package/es/victory-primitives/border.d.ts +18 -0
- package/es/victory-primitives/border.js +9 -9
- package/es/victory-primitives/circle.d.ts +2 -0
- package/es/victory-primitives/circle.js +17 -10
- package/es/victory-primitives/clip-path.d.ts +14 -0
- package/es/victory-primitives/clip-path.js +6 -6
- package/es/victory-primitives/index.d.ts +14 -0
- package/es/victory-primitives/index.js +14 -0
- package/es/victory-primitives/line-segment.d.ts +19 -0
- package/es/victory-primitives/line-segment.js +9 -9
- package/es/victory-primitives/line.d.ts +2 -0
- package/es/victory-primitives/line.js +17 -10
- package/es/victory-primitives/path.d.ts +2 -0
- package/es/victory-primitives/path.js +15 -8
- package/es/victory-primitives/point.d.ts +21 -0
- package/es/victory-primitives/point.js +15 -23
- package/es/victory-primitives/rect.d.ts +2 -0
- package/es/victory-primitives/rect.js +17 -10
- package/es/victory-primitives/text.d.ts +16 -0
- package/es/victory-primitives/text.js +13 -8
- package/es/victory-primitives/tspan.d.ts +2 -0
- package/es/victory-primitives/tspan.js +7 -6
- package/es/victory-primitives/types.d.ts +7 -0
- package/es/victory-primitives/types.js +1 -0
- package/es/victory-primitives/whisker.d.ts +24 -0
- package/es/victory-primitives/whisker.js +12 -12
- package/es/victory-theme/grayscale.d.ts +2 -0
- package/es/victory-theme/grayscale.js +1 -1
- package/es/victory-theme/material.d.ts +2 -0
- package/es/victory-theme/material.js +1 -1
- package/es/victory-theme/victory-theme-definition.d.ts +244 -0
- package/es/victory-theme/victory-theme-definition.js +1 -0
- package/es/victory-theme/victory-theme.d.ts +5 -0
- package/es/victory-theme/victory-theme.js +6 -5
- package/es/victory-transition/victory-transition.d.ts +59 -0
- package/es/victory-transition/victory-transition.js +38 -44
- package/es/victory-util/add-events.js +328 -319
- package/es/victory-util/axis.js +12 -6
- package/es/victory-util/collection.js +7 -5
- package/es/victory-util/common-props.js +2 -2
- package/es/victory-util/data.js +8 -6
- package/es/victory-util/default-transitions.js +0 -1
- package/es/victory-util/domain.js +7 -5
- package/es/victory-util/events.js +8 -4
- package/es/victory-util/helpers.js +1 -3
- package/es/victory-util/hooks/use-animation-state.js +11 -5
- package/es/victory-util/immutable.js +0 -1
- package/es/victory-util/label-helpers.js +0 -2
- package/es/victory-util/line-helpers.js +1 -1
- package/es/victory-util/log.js +0 -1
- package/es/victory-util/point-path-helpers.d.ts +9 -0
- package/es/victory-util/point-path-helpers.js +59 -61
- package/es/victory-util/scale.js +19 -19
- package/es/victory-util/selection.d.ts +23 -0
- package/es/victory-util/selection.js +0 -2
- package/es/victory-util/style.js +0 -2
- package/es/victory-util/textsize.d.ts +8 -0
- package/es/victory-util/textsize.js +11 -7
- package/es/victory-util/timer-context.d.ts +11 -0
- package/es/victory-util/timer-context.js +1 -1
- package/es/victory-util/timer.d.ts +16 -0
- package/es/victory-util/timer.js +16 -13
- package/es/victory-util/types.d.ts +188 -0
- package/es/victory-util/types.js +1 -0
- package/es/victory-util/user-props.js +44 -4
- package/es/victory-util/wrapper.js +18 -12
- package/lib/index.d.ts +38 -941
- package/lib/index.js +201 -189
- package/lib/types.d.ts +33 -0
- package/lib/types.js +1 -0
- package/lib/victory-accessible-group/victory-accessible-group.d.ts +25 -0
- package/lib/victory-accessible-group/victory-accessible-group.js +37 -45
- package/lib/victory-animation/util.d.ts +66 -0
- package/lib/victory-animation/util.js +4 -3
- package/lib/victory-animation/victory-animation.d.ts +69 -0
- package/lib/victory-animation/victory-animation.js +97 -102
- package/lib/victory-clip-container/victory-clip-container.d.ts +76 -0
- package/lib/victory-clip-container/victory-clip-container.js +81 -82
- package/lib/victory-container/victory-container.d.ts +99 -0
- package/lib/victory-container/victory-container.js +102 -107
- package/lib/victory-label/victory-label.d.ts +61 -0
- package/lib/victory-label/victory-label.js +49 -32
- package/lib/victory-portal/portal-context.d.ts +11 -0
- package/lib/victory-portal/portal-context.js +4 -5
- package/lib/victory-portal/portal.d.ts +28 -0
- package/lib/victory-portal/portal.js +49 -50
- package/lib/victory-portal/victory-portal.d.ts +31 -0
- package/lib/victory-portal/victory-portal.js +43 -47
- package/lib/victory-primitives/arc.d.ts +21 -0
- package/lib/victory-primitives/arc.js +13 -10
- package/lib/victory-primitives/background.d.ts +22 -0
- package/lib/victory-primitives/background.js +16 -13
- package/lib/victory-primitives/border.d.ts +18 -0
- package/lib/victory-primitives/border.js +13 -10
- package/lib/victory-primitives/circle.d.ts +2 -0
- package/lib/victory-primitives/circle.js +17 -8
- package/lib/victory-primitives/clip-path.d.ts +14 -0
- package/lib/victory-primitives/clip-path.js +7 -5
- package/lib/victory-primitives/index.d.ts +14 -0
- package/lib/victory-primitives/index.js +187 -0
- package/lib/victory-primitives/line-segment.d.ts +19 -0
- package/lib/victory-primitives/line-segment.js +13 -10
- package/lib/victory-primitives/line.d.ts +2 -0
- package/lib/victory-primitives/line.js +17 -8
- package/lib/victory-primitives/path.d.ts +2 -0
- package/lib/victory-primitives/path.js +15 -6
- package/lib/victory-primitives/point.d.ts +21 -0
- package/lib/victory-primitives/point.js +21 -25
- package/lib/victory-primitives/rect.d.ts +2 -0
- package/lib/victory-primitives/rect.js +17 -8
- package/lib/victory-primitives/text.d.ts +16 -0
- package/lib/victory-primitives/text.js +14 -7
- package/lib/victory-primitives/tspan.d.ts +2 -0
- package/lib/victory-primitives/tspan.js +7 -4
- package/lib/victory-primitives/types.d.ts +7 -0
- package/lib/victory-primitives/types.js +1 -0
- package/lib/victory-primitives/whisker.d.ts +24 -0
- package/lib/victory-primitives/whisker.js +16 -13
- package/lib/victory-theme/grayscale.d.ts +2 -0
- package/lib/victory-theme/grayscale.js +3 -3
- package/lib/victory-theme/material.d.ts +2 -0
- package/lib/victory-theme/material.js +3 -3
- package/lib/victory-theme/victory-theme-definition.d.ts +244 -0
- package/lib/victory-theme/victory-theme-definition.js +1 -0
- package/lib/victory-theme/victory-theme.d.ts +5 -0
- package/lib/victory-theme/victory-theme.js +22 -8
- package/lib/victory-transition/victory-transition.d.ts +59 -0
- package/lib/victory-transition/victory-transition.js +43 -45
- package/lib/victory-util/add-events.js +326 -316
- package/lib/victory-util/axis.js +20 -11
- package/lib/victory-util/collection.js +10 -8
- package/lib/victory-util/common-props.js +6 -4
- package/lib/victory-util/data.js +13 -7
- package/lib/victory-util/default-transitions.js +1 -2
- package/lib/victory-util/domain.js +11 -5
- package/lib/victory-util/events.js +17 -11
- package/lib/victory-util/helpers.js +14 -16
- package/lib/victory-util/hooks/index.js +4 -4
- package/lib/victory-util/hooks/use-animation-state.js +14 -6
- package/lib/victory-util/immutable.js +3 -5
- package/lib/victory-util/label-helpers.js +6 -6
- package/lib/victory-util/line-helpers.js +4 -2
- package/lib/victory-util/log.js +0 -1
- package/lib/victory-util/point-path-helpers.d.ts +9 -0
- package/lib/victory-util/point-path-helpers.js +86 -73
- package/lib/victory-util/prop-types.js +5 -3
- package/lib/victory-util/scale.js +24 -21
- package/lib/victory-util/selection.d.ts +23 -0
- package/lib/victory-util/selection.js +5 -5
- package/lib/victory-util/style.js +0 -2
- package/lib/victory-util/textsize.d.ts +8 -0
- package/lib/victory-util/textsize.js +12 -8
- package/lib/victory-util/timer-context.d.ts +11 -0
- package/lib/victory-util/timer-context.js +1 -1
- package/lib/victory-util/timer.d.ts +16 -0
- package/lib/victory-util/timer.js +16 -13
- package/lib/victory-util/types.d.ts +188 -0
- package/lib/victory-util/types.js +1 -0
- package/lib/victory-util/user-props.js +53 -6
- package/lib/victory-util/wrapper.js +31 -23
- package/package.json +6 -13
- package/src/index.ts +42 -0
- package/src/types.ts +45 -0
- package/src/victory-accessible-group/{victory-accessible-group.js → victory-accessible-group.tsx} +10 -3
- package/src/victory-animation/{util.js → util.ts} +5 -4
- package/src/victory-animation/{victory-animation.js → victory-animation.tsx} +90 -13
- package/src/victory-clip-container/{victory-clip-container.js → victory-clip-container.tsx} +32 -6
- package/src/victory-container/{victory-container.js → victory-container.tsx} +70 -26
- package/src/victory-label/{victory-label.js → victory-label.tsx} +80 -19
- package/src/victory-portal/portal-context.ts +14 -0
- package/src/victory-portal/{portal.js → portal.tsx} +23 -12
- package/src/victory-portal/{victory-portal.js → victory-portal.tsx} +21 -6
- package/src/victory-primitives/{arc.js → arc.tsx} +15 -5
- package/src/victory-primitives/{background.js → background.tsx} +17 -7
- package/src/victory-primitives/{border.js → border.tsx} +12 -5
- package/src/victory-primitives/{circle.js → circle.tsx} +4 -3
- package/src/victory-primitives/clip-path.tsx +25 -0
- package/src/victory-primitives/index.ts +14 -0
- package/src/victory-primitives/{line-segment.js → line-segment.tsx} +13 -5
- package/src/victory-primitives/{line.js → line.tsx} +4 -3
- package/src/victory-primitives/{path.js → path.tsx} +4 -3
- package/src/victory-primitives/{point.js → point.tsx} +25 -20
- package/src/victory-primitives/{rect.js → rect.tsx} +4 -2
- package/src/victory-primitives/{text.js → text.tsx} +9 -3
- package/src/victory-primitives/tspan.tsx +7 -0
- package/src/victory-primitives/types.ts +19 -0
- package/src/victory-primitives/{whisker.js → whisker.tsx} +20 -7
- package/src/victory-theme/{grayscale.js → grayscale.tsx} +2 -1
- package/src/victory-theme/{material.js → material.tsx} +2 -1
- package/src/victory-theme/victory-theme-definition.ts +261 -0
- package/src/victory-theme/victory-theme.tsx +5 -0
- package/src/victory-transition/{victory-transition.js → victory-transition.tsx} +68 -19
- package/src/victory-util/add-events.js +7 -5
- package/src/victory-util/axis.js +3 -1
- package/src/victory-util/collection.js +0 -1
- package/src/victory-util/common-props.js +2 -2
- package/src/victory-util/data.js +0 -1
- package/src/victory-util/default-transitions.js +0 -1
- package/src/victory-util/domain.js +0 -1
- package/src/victory-util/events.js +1 -1
- package/src/victory-util/helpers.js +0 -1
- package/src/victory-util/immutable.js +0 -1
- package/src/victory-util/label-helpers.js +0 -1
- package/src/victory-util/line-helpers.js +1 -1
- package/src/victory-util/log.js +0 -1
- package/src/victory-util/point-path-helpers.ts +119 -0
- package/src/victory-util/prop-types.js +0 -1
- package/src/victory-util/scale.js +18 -10
- package/src/victory-util/selection.d.ts +23 -0
- package/src/victory-util/selection.js +0 -1
- package/src/victory-util/style.js +0 -1
- package/src/victory-util/textsize.d.ts +8 -0
- package/src/victory-util/{timer-context.js → timer-context.ts} +0 -0
- package/src/victory-util/{timer.js → timer.ts} +20 -5
- package/src/victory-util/transitions.js +0 -1
- package/src/victory-util/types.ts +247 -0
- package/src/victory-util/user-props.js +31 -1
- package/src/victory-util/wrapper.js +0 -1
- package/src/index.d.ts +0 -941
- package/src/index.js +0 -51
- package/src/victory-portal/portal-context.js +0 -10
- package/src/victory-primitives/clip-path.js +0 -18
- package/src/victory-primitives/tspan.js +0 -5
- package/src/victory-theme/victory-theme.js +0 -7
- package/src/victory-util/point-path-helpers.js +0 -121
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import { OriginType } from "../victory-label/victory-label";
|
|
4
|
+
import { D3Scale } from "../victory-util/types";
|
|
5
|
+
import { VictoryThemeDefinition } from "../victory-theme/victory-theme-definition";
|
|
6
|
+
export interface VictoryContainerProps {
|
|
7
|
+
"aria-describedby"?: string;
|
|
8
|
+
"aria-labelledby"?: string;
|
|
9
|
+
children?: React.ReactElement | React.ReactElement[];
|
|
10
|
+
className?: string;
|
|
11
|
+
containerId?: number | string;
|
|
12
|
+
containerRef?: React.Ref<HTMLElement>;
|
|
13
|
+
desc?: string;
|
|
14
|
+
events?: React.DOMAttributes<any>;
|
|
15
|
+
height?: number;
|
|
16
|
+
name?: string;
|
|
17
|
+
origin?: OriginType;
|
|
18
|
+
ouiaId?: number | string;
|
|
19
|
+
ouiaSafe?: boolean;
|
|
20
|
+
ouiaType?: string;
|
|
21
|
+
polar?: boolean;
|
|
22
|
+
portalComponent?: React.ReactElement;
|
|
23
|
+
portalZIndex?: number;
|
|
24
|
+
preserveAspectRatio?: string;
|
|
25
|
+
responsive?: boolean;
|
|
26
|
+
role?: string;
|
|
27
|
+
scale?: {
|
|
28
|
+
x?: D3Scale;
|
|
29
|
+
y?: D3Scale;
|
|
30
|
+
};
|
|
31
|
+
style?: React.CSSProperties;
|
|
32
|
+
tabIndex?: number;
|
|
33
|
+
theme?: VictoryThemeDefinition;
|
|
34
|
+
title?: string;
|
|
35
|
+
width?: number;
|
|
36
|
+
}
|
|
37
|
+
export declare class VictoryContainer extends React.Component<VictoryContainerProps> {
|
|
38
|
+
static displayName: string;
|
|
39
|
+
static role: string;
|
|
40
|
+
static propTypes: {
|
|
41
|
+
"aria-describedby": PropTypes.Requireable<string>;
|
|
42
|
+
"aria-labelledby": PropTypes.Requireable<string>;
|
|
43
|
+
children: PropTypes.Requireable<string | number | boolean | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
|
|
44
|
+
className: PropTypes.Requireable<string>;
|
|
45
|
+
containerId: PropTypes.Requireable<string | number>;
|
|
46
|
+
containerRef: PropTypes.Requireable<(...args: any[]) => any>;
|
|
47
|
+
desc: PropTypes.Requireable<string>;
|
|
48
|
+
events: PropTypes.Requireable<object>;
|
|
49
|
+
height: any;
|
|
50
|
+
name: PropTypes.Requireable<string>;
|
|
51
|
+
origin: PropTypes.Requireable<PropTypes.InferProps<{
|
|
52
|
+
x: any;
|
|
53
|
+
y: any;
|
|
54
|
+
}>>;
|
|
55
|
+
ouiaId: PropTypes.Requireable<string | number>;
|
|
56
|
+
ouiaSafe: PropTypes.Requireable<boolean>;
|
|
57
|
+
ouiaType: PropTypes.Requireable<string>;
|
|
58
|
+
polar: PropTypes.Requireable<boolean>;
|
|
59
|
+
portalComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
60
|
+
portalZIndex: any;
|
|
61
|
+
preserveAspectRatio: PropTypes.Requireable<string>;
|
|
62
|
+
responsive: PropTypes.Requireable<boolean>;
|
|
63
|
+
role: PropTypes.Requireable<string>;
|
|
64
|
+
style: PropTypes.Requireable<object>;
|
|
65
|
+
tabIndex: PropTypes.Requireable<number>;
|
|
66
|
+
theme: PropTypes.Requireable<object>;
|
|
67
|
+
title: PropTypes.Requireable<string>;
|
|
68
|
+
width: any;
|
|
69
|
+
};
|
|
70
|
+
static defaultProps: {
|
|
71
|
+
className: string;
|
|
72
|
+
portalComponent: JSX.Element;
|
|
73
|
+
portalZIndex: number;
|
|
74
|
+
responsive: boolean;
|
|
75
|
+
role: string;
|
|
76
|
+
};
|
|
77
|
+
static contextType: React.Context<{
|
|
78
|
+
transitionTimer: import("..").Timer;
|
|
79
|
+
animationTimer: import("..").Timer;
|
|
80
|
+
}>;
|
|
81
|
+
private containerId;
|
|
82
|
+
private portalRef;
|
|
83
|
+
private containerRef;
|
|
84
|
+
private shouldHandleWheel;
|
|
85
|
+
constructor(props: VictoryContainerProps);
|
|
86
|
+
savePortalRef: (portal: any) => any;
|
|
87
|
+
portalUpdate: (key: any, el: any) => void;
|
|
88
|
+
portalRegister: () => number;
|
|
89
|
+
portalDeregister: (key: any) => void;
|
|
90
|
+
saveContainerRef: (container: HTMLElement) => HTMLElement;
|
|
91
|
+
handleWheel: (e: any) => any;
|
|
92
|
+
componentDidMount(): void;
|
|
93
|
+
componentWillUnmount(): void;
|
|
94
|
+
getIdForElement(elementName: any): string;
|
|
95
|
+
getChildren(props: any): any;
|
|
96
|
+
getOUIAProps(props: any): any;
|
|
97
|
+
renderContainer(props: any, svgProps: any, style: any): JSX.Element;
|
|
98
|
+
render(): JSX.Element;
|
|
99
|
+
}
|
|
@@ -4,9 +4,11 @@ import _uniqueId from "lodash/uniqueId";
|
|
|
4
4
|
import _defaults from "lodash/defaults";
|
|
5
5
|
import _assign from "lodash/assign";
|
|
6
6
|
|
|
7
|
-
function _extends() { _extends = Object.assign
|
|
7
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
8
8
|
|
|
9
|
-
function
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
+
|
|
11
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
12
|
|
|
11
13
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
14
|
|
|
@@ -14,35 +16,47 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
14
16
|
|
|
15
17
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
16
18
|
|
|
17
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
19
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
20
|
+
|
|
21
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
22
|
+
|
|
23
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
18
24
|
|
|
19
|
-
function
|
|
25
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
26
|
+
|
|
27
|
+
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
20
28
|
|
|
21
29
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
22
30
|
|
|
23
|
-
function
|
|
31
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
32
|
+
|
|
33
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
24
34
|
|
|
25
35
|
import React from "react";
|
|
26
36
|
import PropTypes from "prop-types";
|
|
27
37
|
import * as CustomPropTypes from "../victory-util/prop-types";
|
|
28
|
-
import Portal from "../victory-portal/portal";
|
|
29
|
-
import PortalContext from "../victory-portal/portal-context";
|
|
38
|
+
import { Portal } from "../victory-portal/portal";
|
|
39
|
+
import { PortalContext } from "../victory-portal/portal-context";
|
|
30
40
|
import TimerContext from "../victory-util/timer-context";
|
|
31
41
|
import * as Helpers from "../victory-util/helpers";
|
|
32
42
|
import * as UserProps from "../victory-util/user-props";
|
|
33
|
-
|
|
34
|
-
var VictoryContainer =
|
|
35
|
-
/*#__PURE__*/
|
|
36
|
-
function (_React$Component) {
|
|
43
|
+
export var VictoryContainer = /*#__PURE__*/function (_React$Component) {
|
|
37
44
|
_inherits(VictoryContainer, _React$Component);
|
|
38
45
|
|
|
46
|
+
var _super = _createSuper(VictoryContainer);
|
|
47
|
+
|
|
48
|
+
// @ts-expect-error Ref will be initialized on mount
|
|
49
|
+
// @ts-expect-error Ref will be initialized on mount
|
|
39
50
|
function VictoryContainer(props) {
|
|
40
51
|
var _this;
|
|
41
52
|
|
|
42
53
|
_classCallCheck(this, VictoryContainer);
|
|
43
54
|
|
|
44
|
-
_this =
|
|
45
|
-
_this.containerId =
|
|
55
|
+
_this = _super.call(this, props);
|
|
56
|
+
_this.containerId = void 0;
|
|
57
|
+
_this.portalRef = void 0;
|
|
58
|
+
_this.containerRef = void 0;
|
|
59
|
+
_this.shouldHandleWheel = void 0;
|
|
46
60
|
|
|
47
61
|
_this.savePortalRef = function (portal) {
|
|
48
62
|
_this.portalRef = portal;
|
|
@@ -61,18 +75,21 @@ function (_React$Component) {
|
|
|
61
75
|
return _this.portalRef.portalDeregister(key);
|
|
62
76
|
};
|
|
63
77
|
|
|
64
|
-
_this.saveContainerRef =
|
|
78
|
+
_this.saveContainerRef = function (container) {
|
|
79
|
+
if (_isFunction(_this.props.containerRef)) {
|
|
80
|
+
_this.props.containerRef(container);
|
|
81
|
+
}
|
|
82
|
+
|
|
65
83
|
_this.containerRef = container;
|
|
66
84
|
return container;
|
|
67
85
|
};
|
|
68
|
-
_this.shouldHandleWheel = props && props.events && props.events.onWheel;
|
|
69
86
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
};
|
|
74
|
-
}
|
|
87
|
+
_this.handleWheel = function (e) {
|
|
88
|
+
return e.preventDefault();
|
|
89
|
+
};
|
|
75
90
|
|
|
91
|
+
_this.containerId = !_isObject(props) || props.containerId === undefined ? _uniqueId("victory-container-") : props.containerId;
|
|
92
|
+
_this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
|
|
76
93
|
return _this;
|
|
77
94
|
}
|
|
78
95
|
|
|
@@ -109,11 +126,11 @@ function (_React$Component) {
|
|
|
109
126
|
var ouiaId = props.ouiaId,
|
|
110
127
|
ouiaSafe = props.ouiaSafe,
|
|
111
128
|
ouiaType = props.ouiaType;
|
|
112
|
-
return _objectSpread({}, ouiaId && {
|
|
129
|
+
return _objectSpread(_objectSpread(_objectSpread({}, ouiaId && {
|
|
113
130
|
"data-ouia-component-id": ouiaId
|
|
114
|
-
}, ouiaType && {
|
|
131
|
+
}), ouiaType && {
|
|
115
132
|
"data-ouia-component-type": ouiaType
|
|
116
|
-
}, ouiaSafe !== undefined && {
|
|
133
|
+
}), ouiaSafe !== undefined && {
|
|
117
134
|
"data-ouia-safe": ouiaSafe
|
|
118
135
|
});
|
|
119
136
|
}
|
|
@@ -165,41 +182,41 @@ function (_React$Component) {
|
|
|
165
182
|
preserveAspectRatio: svgProps.preserveAspectRatio,
|
|
166
183
|
style: portalSvgStyle
|
|
167
184
|
};
|
|
168
|
-
return React.createElement(PortalContext.Provider, {
|
|
185
|
+
return /*#__PURE__*/React.createElement(PortalContext.Provider, {
|
|
169
186
|
value: {
|
|
170
187
|
portalUpdate: this.portalUpdate,
|
|
171
188
|
portalRegister: this.portalRegister,
|
|
172
189
|
portalDeregister: this.portalDeregister
|
|
173
190
|
}
|
|
174
|
-
}, React.createElement("div", _extends({
|
|
191
|
+
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
175
192
|
style: _defaults({}, style, divStyle),
|
|
176
193
|
className: className,
|
|
177
194
|
ref: this.saveContainerRef
|
|
178
|
-
}, this.getOUIAProps(props)), React.createElement("svg", _extends({}, svgProps, {
|
|
195
|
+
}, this.getOUIAProps(props)), /*#__PURE__*/React.createElement("svg", _extends({}, svgProps, {
|
|
179
196
|
style: svgStyle
|
|
180
|
-
}), title ? React.createElement("title", {
|
|
197
|
+
}), title ? /*#__PURE__*/React.createElement("title", {
|
|
181
198
|
id: this.getIdForElement("title")
|
|
182
|
-
}, title) : null, desc ? React.createElement("desc", {
|
|
199
|
+
}, title) : null, desc ? /*#__PURE__*/React.createElement("desc", {
|
|
183
200
|
id: this.getIdForElement("desc")
|
|
184
|
-
}, desc) : null, children), React.createElement("div", {
|
|
201
|
+
}, desc) : null, children), /*#__PURE__*/React.createElement("div", {
|
|
185
202
|
style: portalDivStyle
|
|
186
|
-
}, React.cloneElement(portalComponent, _objectSpread({}, portalProps, {
|
|
203
|
+
}, /*#__PURE__*/React.cloneElement(portalComponent, _objectSpread(_objectSpread({}, portalProps), {}, {
|
|
187
204
|
ref: this.savePortalRef
|
|
188
205
|
})))));
|
|
189
206
|
}
|
|
190
207
|
}, {
|
|
191
208
|
key: "render",
|
|
192
209
|
value: function render() {
|
|
193
|
-
var
|
|
194
|
-
width =
|
|
195
|
-
height =
|
|
196
|
-
responsive =
|
|
197
|
-
events =
|
|
198
|
-
title =
|
|
199
|
-
desc =
|
|
200
|
-
tabIndex =
|
|
201
|
-
preserveAspectRatio =
|
|
202
|
-
role =
|
|
210
|
+
var _this$props = this.props,
|
|
211
|
+
width = _this$props.width,
|
|
212
|
+
height = _this$props.height,
|
|
213
|
+
responsive = _this$props.responsive,
|
|
214
|
+
events = _this$props.events,
|
|
215
|
+
title = _this$props.title,
|
|
216
|
+
desc = _this$props.desc,
|
|
217
|
+
tabIndex = _this$props.tabIndex,
|
|
218
|
+
preserveAspectRatio = _this$props.preserveAspectRatio,
|
|
219
|
+
role = _this$props.role;
|
|
203
220
|
var style = responsive ? this.props.style : Helpers.omit(this.props.style, ["height", "width"]);
|
|
204
221
|
var userProps = UserProps.getSafeUserProps(this.props);
|
|
205
222
|
|
|
@@ -220,70 +237,43 @@ function (_React$Component) {
|
|
|
220
237
|
|
|
221
238
|
return VictoryContainer;
|
|
222
239
|
}(React.Component);
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
role: PropTypes.string,
|
|
264
|
-
style: PropTypes.object,
|
|
265
|
-
tabIndex: PropTypes.number,
|
|
266
|
-
theme: PropTypes.object,
|
|
267
|
-
title: PropTypes.string,
|
|
268
|
-
width: CustomPropTypes.nonNegative
|
|
269
|
-
}
|
|
270
|
-
});
|
|
271
|
-
Object.defineProperty(VictoryContainer, "defaultProps", {
|
|
272
|
-
configurable: true,
|
|
273
|
-
enumerable: true,
|
|
274
|
-
writable: true,
|
|
275
|
-
value: {
|
|
276
|
-
className: "VictoryContainer",
|
|
277
|
-
portalComponent: React.createElement(Portal, null),
|
|
278
|
-
portalZIndex: 99,
|
|
279
|
-
responsive: true,
|
|
280
|
-
role: "img"
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
Object.defineProperty(VictoryContainer, "contextType", {
|
|
284
|
-
configurable: true,
|
|
285
|
-
enumerable: true,
|
|
286
|
-
writable: true,
|
|
287
|
-
value: TimerContext
|
|
288
|
-
});
|
|
289
|
-
export { VictoryContainer as default };
|
|
240
|
+
VictoryContainer.displayName = "VictoryContainer";
|
|
241
|
+
VictoryContainer.role = "container";
|
|
242
|
+
VictoryContainer.propTypes = {
|
|
243
|
+
"aria-describedby": PropTypes.string,
|
|
244
|
+
"aria-labelledby": PropTypes.string,
|
|
245
|
+
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
|
|
246
|
+
className: PropTypes.string,
|
|
247
|
+
containerId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
248
|
+
containerRef: PropTypes.func,
|
|
249
|
+
desc: PropTypes.string,
|
|
250
|
+
events: PropTypes.object,
|
|
251
|
+
height: CustomPropTypes.nonNegative,
|
|
252
|
+
name: PropTypes.string,
|
|
253
|
+
origin: PropTypes.shape({
|
|
254
|
+
x: CustomPropTypes.nonNegative,
|
|
255
|
+
y: CustomPropTypes.nonNegative
|
|
256
|
+
}),
|
|
257
|
+
ouiaId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
258
|
+
ouiaSafe: PropTypes.bool,
|
|
259
|
+
ouiaType: PropTypes.string,
|
|
260
|
+
polar: PropTypes.bool,
|
|
261
|
+
portalComponent: PropTypes.element,
|
|
262
|
+
portalZIndex: CustomPropTypes.integer,
|
|
263
|
+
preserveAspectRatio: PropTypes.string,
|
|
264
|
+
responsive: PropTypes.bool,
|
|
265
|
+
role: PropTypes.string,
|
|
266
|
+
style: PropTypes.object,
|
|
267
|
+
tabIndex: PropTypes.number,
|
|
268
|
+
theme: PropTypes.object,
|
|
269
|
+
title: PropTypes.string,
|
|
270
|
+
width: CustomPropTypes.nonNegative
|
|
271
|
+
};
|
|
272
|
+
VictoryContainer.defaultProps = {
|
|
273
|
+
className: "VictoryContainer",
|
|
274
|
+
portalComponent: /*#__PURE__*/React.createElement(Portal, null),
|
|
275
|
+
portalZIndex: 99,
|
|
276
|
+
responsive: true,
|
|
277
|
+
role: "img"
|
|
278
|
+
};
|
|
279
|
+
VictoryContainer.contextType = TimerContext;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StringOrCallback, StringOrNumberOrCallback } from "../types";
|
|
3
|
+
import { NumberOrCallback, PaddingProps, VerticalAnchorType, VictoryLabelStyleObject } from "../victory-theme/victory-theme";
|
|
4
|
+
export declare type TextAnchorType = "start" | "middle" | "end" | "inherit";
|
|
5
|
+
export declare type OriginType = {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
};
|
|
9
|
+
export declare type LabelOrientationType = "parallel" | "perpendicular" | "vertical";
|
|
10
|
+
export interface VictoryLabelProps {
|
|
11
|
+
angle?: StringOrNumberOrCallback;
|
|
12
|
+
ariaLabel?: StringOrCallback;
|
|
13
|
+
backgroundComponent?: React.ReactElement;
|
|
14
|
+
backgroundStyle?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
15
|
+
backgroundPadding?: PaddingProps | PaddingProps[];
|
|
16
|
+
capHeight?: StringOrNumberOrCallback;
|
|
17
|
+
children?: StringOrNumberOrCallback;
|
|
18
|
+
className?: string;
|
|
19
|
+
datum?: object;
|
|
20
|
+
data?: any[];
|
|
21
|
+
desc?: string;
|
|
22
|
+
direction?: string;
|
|
23
|
+
disableInlineStyles?: boolean;
|
|
24
|
+
events?: React.DOMAttributes<any>;
|
|
25
|
+
groupComponent?: React.ReactElement;
|
|
26
|
+
id?: StringOrNumberOrCallback;
|
|
27
|
+
inline?: boolean;
|
|
28
|
+
labelPlacement?: LabelOrientationType;
|
|
29
|
+
lineHeight?: StringOrNumberOrCallback | (string | number)[];
|
|
30
|
+
origin?: OriginType;
|
|
31
|
+
polar?: boolean;
|
|
32
|
+
renderInPortal?: boolean;
|
|
33
|
+
style?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
34
|
+
tabIndex?: NumberOrCallback;
|
|
35
|
+
text?: string[] | StringOrNumberOrCallback;
|
|
36
|
+
textComponent?: React.ReactElement;
|
|
37
|
+
textAnchor?: TextAnchorType | {
|
|
38
|
+
(): TextAnchorType;
|
|
39
|
+
};
|
|
40
|
+
title?: string;
|
|
41
|
+
transform?: string | object | (() => string | object);
|
|
42
|
+
tspanComponent?: React.ReactElement;
|
|
43
|
+
verticalAnchor?: VerticalAnchorType | {
|
|
44
|
+
(): VerticalAnchorType;
|
|
45
|
+
};
|
|
46
|
+
x?: number;
|
|
47
|
+
y?: number;
|
|
48
|
+
dx?: StringOrNumberOrCallback;
|
|
49
|
+
dy?: StringOrNumberOrCallback;
|
|
50
|
+
}
|
|
51
|
+
declare const defaultStyles: {
|
|
52
|
+
fill: string;
|
|
53
|
+
fontSize: number;
|
|
54
|
+
fontFamily: string;
|
|
55
|
+
stroke: string;
|
|
56
|
+
};
|
|
57
|
+
export declare const VictoryLabel: {
|
|
58
|
+
role: string;
|
|
59
|
+
defaultStyles: typeof defaultStyles;
|
|
60
|
+
} & React.FC<VictoryLabelProps>;
|
|
61
|
+
export {};
|
|
@@ -2,31 +2,37 @@ import _isEmpty from "lodash/isEmpty";
|
|
|
2
2
|
import _defaults from "lodash/defaults";
|
|
3
3
|
import _assign from "lodash/assign";
|
|
4
4
|
|
|
5
|
-
function
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
|
|
7
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
8
|
|
|
7
9
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
10
|
|
|
9
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
|
11
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
10
12
|
|
|
11
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
|
|
13
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
14
|
|
|
13
|
-
function
|
|
15
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
16
|
|
|
15
|
-
function
|
|
17
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
18
|
+
|
|
19
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
20
|
+
|
|
21
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
16
22
|
|
|
17
|
-
/*eslint no-magic-numbers: ["error", { "ignore": [-0.5, 0.5, 0, 1, 2] }]*/
|
|
18
|
-
import React from "react";
|
|
19
23
|
import PropTypes from "prop-types";
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
24
|
+
import React from "react";
|
|
25
|
+
import { VictoryPortal } from "../victory-portal/victory-portal";
|
|
26
|
+
import { Rect } from "../victory-primitives/rect";
|
|
27
|
+
import { Text } from "../victory-primitives/text";
|
|
28
|
+
import { TSpan } from "../victory-primitives/tspan";
|
|
23
29
|
import * as Helpers from "../victory-util/helpers";
|
|
24
30
|
import * as LabelHelpers from "../victory-util/label-helpers";
|
|
25
|
-
import * as Style from "../victory-util/style";
|
|
26
31
|
import * as Log from "../victory-util/log";
|
|
32
|
+
import * as CustomPropTypes from "../victory-util/prop-types";
|
|
33
|
+
import * as Style from "../victory-util/style";
|
|
27
34
|
import * as TextSize from "../victory-util/textsize";
|
|
28
|
-
import
|
|
29
|
-
import Text from "../victory-primitives/text";
|
|
35
|
+
import * as UserProps from "../victory-util/user-props";
|
|
30
36
|
var defaultStyles = {
|
|
31
37
|
fill: "#252525",
|
|
32
38
|
fontSize: 14,
|
|
@@ -274,7 +280,7 @@ var getFullBackground = function (calculatedProps, tspanValues) {
|
|
|
274
280
|
x: inline ? xCoordinate - backgroundPadding.left : xCoordinate + dx - backgroundPadding.left,
|
|
275
281
|
y: yCoordinate
|
|
276
282
|
};
|
|
277
|
-
return React.cloneElement(backgroundComponent, _defaults({}, backgroundComponent.props, backgroundProps));
|
|
283
|
+
return /*#__PURE__*/React.cloneElement(backgroundComponent, _defaults({}, backgroundComponent.props, backgroundProps));
|
|
278
284
|
};
|
|
279
285
|
|
|
280
286
|
var getInlineXOffset = function (calculatedProps, textElements, index) {
|
|
@@ -356,7 +362,7 @@ var getChildBackgrounds = function (calculatedProps, tspanValues) {
|
|
|
356
362
|
x: xCoord - padding.left,
|
|
357
363
|
y: yCoord
|
|
358
364
|
};
|
|
359
|
-
return React.cloneElement(backgroundComponent, _defaults({}, backgroundComponent.props, backgroundProps));
|
|
365
|
+
return /*#__PURE__*/React.cloneElement(backgroundComponent, _defaults({}, backgroundComponent.props, backgroundProps));
|
|
360
366
|
});
|
|
361
367
|
};
|
|
362
368
|
|
|
@@ -463,11 +469,12 @@ var renderLabel = function (calculatedProps, tspanValues) {
|
|
|
463
469
|
tabIndex = calculatedProps.tabIndex,
|
|
464
470
|
tspanComponent = calculatedProps.tspanComponent,
|
|
465
471
|
textComponent = calculatedProps.textComponent;
|
|
472
|
+
var userProps = UserProps.getSafeUserProps(calculatedProps);
|
|
466
473
|
|
|
467
|
-
var textProps = _objectSpread({
|
|
474
|
+
var textProps = _objectSpread(_objectSpread({
|
|
468
475
|
"aria-label": ariaLabel,
|
|
469
476
|
key: "text"
|
|
470
|
-
}, events, {
|
|
477
|
+
}, events), {}, {
|
|
471
478
|
direction: direction,
|
|
472
479
|
dx: dx,
|
|
473
480
|
x: x,
|
|
@@ -478,7 +485,7 @@ var renderLabel = function (calculatedProps, tspanValues) {
|
|
|
478
485
|
desc: Helpers.evaluateProp(desc, calculatedProps),
|
|
479
486
|
tabIndex: Helpers.evaluateProp(tabIndex, calculatedProps),
|
|
480
487
|
id: id
|
|
481
|
-
});
|
|
488
|
+
}, userProps);
|
|
482
489
|
|
|
483
490
|
var tspans = text.map(function (line, i) {
|
|
484
491
|
var currentStyle = tspanValues[i].style;
|
|
@@ -491,12 +498,12 @@ var renderLabel = function (calculatedProps, tspanValues) {
|
|
|
491
498
|
style: currentStyle,
|
|
492
499
|
children: line
|
|
493
500
|
};
|
|
494
|
-
return React.cloneElement(tspanComponent, tspanProps);
|
|
501
|
+
return /*#__PURE__*/React.cloneElement(tspanComponent, tspanProps);
|
|
495
502
|
});
|
|
496
|
-
return React.cloneElement(textComponent, textProps, tspans);
|
|
503
|
+
return /*#__PURE__*/React.cloneElement(textComponent, textProps, tspans);
|
|
497
504
|
};
|
|
498
505
|
|
|
499
|
-
var VictoryLabel = function (props) {
|
|
506
|
+
export var VictoryLabel = function (props) {
|
|
500
507
|
props = evaluateProps(props);
|
|
501
508
|
|
|
502
509
|
if (props.text === null || props.text === undefined) {
|
|
@@ -518,6 +525,7 @@ var VictoryLabel = function (props) {
|
|
|
518
525
|
fontSize: currentStyle.fontSize || defaultStyles.fontSize,
|
|
519
526
|
capHeight: capHeightPx,
|
|
520
527
|
text: line,
|
|
528
|
+
// @ts-expect-error TODO: This looks like a bug:
|
|
521
529
|
textSize: TextSize.approximateTextSize(line, currentStyle),
|
|
522
530
|
lineHeight: currentLineHeight,
|
|
523
531
|
backgroundPadding: getSingleValue(backgroundPadding, i)
|
|
@@ -528,13 +536,12 @@ var VictoryLabel = function (props) {
|
|
|
528
536
|
if (props.backgroundStyle) {
|
|
529
537
|
var backgroundElement = getBackgroundElement(calculatedProps, tspanValues);
|
|
530
538
|
var children = [backgroundElement, label];
|
|
531
|
-
var backgroundWithLabel = React.cloneElement(props.groupComponent, {}, children);
|
|
532
|
-
return props.renderInPortal ? React.createElement(VictoryPortal, null, backgroundWithLabel) : backgroundWithLabel;
|
|
539
|
+
var backgroundWithLabel = /*#__PURE__*/React.cloneElement(props.groupComponent, {}, children);
|
|
540
|
+
return props.renderInPortal ? /*#__PURE__*/React.createElement(VictoryPortal, null, backgroundWithLabel) : backgroundWithLabel;
|
|
533
541
|
}
|
|
534
542
|
|
|
535
|
-
return props.renderInPortal ? React.createElement(VictoryPortal, null, label) : label;
|
|
543
|
+
return props.renderInPortal ? /*#__PURE__*/React.createElement(VictoryPortal, null, label) : label;
|
|
536
544
|
};
|
|
537
|
-
|
|
538
545
|
VictoryLabel.displayName = "VictoryLabel";
|
|
539
546
|
VictoryLabel.role = "label";
|
|
540
547
|
VictoryLabel.defaultStyles = defaultStyles;
|
|
@@ -549,6 +556,7 @@ VictoryLabel.propTypes = {
|
|
|
549
556
|
className: PropTypes.string,
|
|
550
557
|
data: PropTypes.array,
|
|
551
558
|
datum: PropTypes.any,
|
|
559
|
+
// @ts-expect-error "Function is not assignable to string"
|
|
552
560
|
desc: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
553
561
|
direction: PropTypes.oneOf(["rtl", "ltr", "inherit"]),
|
|
554
562
|
dx: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
@@ -560,6 +568,7 @@ VictoryLabel.propTypes = {
|
|
|
560
568
|
inline: PropTypes.bool,
|
|
561
569
|
labelPlacement: PropTypes.oneOf(["parallel", "perpendicular", "vertical"]),
|
|
562
570
|
lineHeight: PropTypes.oneOfType([PropTypes.string, CustomPropTypes.nonNegative, PropTypes.func, PropTypes.array]),
|
|
571
|
+
// @ts-expect-error "x is required in origin"
|
|
563
572
|
origin: PropTypes.shape({
|
|
564
573
|
x: CustomPropTypes.nonNegative,
|
|
565
574
|
y: CustomPropTypes.nonNegative
|
|
@@ -573,23 +582,26 @@ VictoryLabel.propTypes = {
|
|
|
573
582
|
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
574
583
|
tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),
|
|
575
584
|
text: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.func, PropTypes.array]),
|
|
585
|
+
// @ts-expect-error Function is not assignable to string"
|
|
576
586
|
textAnchor: PropTypes.oneOfType([PropTypes.oneOf(["start", "middle", "end", "inherit"]), PropTypes.func]),
|
|
577
587
|
textComponent: PropTypes.element,
|
|
578
588
|
title: PropTypes.string,
|
|
579
589
|
transform: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]),
|
|
580
590
|
tspanComponent: PropTypes.element,
|
|
591
|
+
// @ts-expect-error Function is not assignable to string"
|
|
581
592
|
verticalAnchor: PropTypes.oneOfType([PropTypes.oneOf(["start", "middle", "end"]), PropTypes.func]),
|
|
593
|
+
// @ts-expect-error Number is not assignable to string
|
|
582
594
|
x: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
595
|
+
// @ts-expect-error Number is not assignable to string
|
|
583
596
|
y: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
584
597
|
};
|
|
585
598
|
VictoryLabel.defaultProps = {
|
|
586
|
-
backgroundComponent: React.createElement(Rect, null),
|
|
587
|
-
groupComponent: React.createElement("g", null),
|
|
599
|
+
backgroundComponent: /*#__PURE__*/React.createElement(Rect, null),
|
|
600
|
+
groupComponent: /*#__PURE__*/React.createElement("g", null),
|
|
588
601
|
direction: "inherit",
|
|
589
|
-
textComponent: React.createElement(Text, null),
|
|
590
|
-
tspanComponent: React.createElement(TSpan, null),
|
|
602
|
+
textComponent: /*#__PURE__*/React.createElement(Text, null),
|
|
603
|
+
tspanComponent: /*#__PURE__*/React.createElement(TSpan, null),
|
|
591
604
|
capHeight: 0.71,
|
|
592
605
|
// Magic number from d3.
|
|
593
606
|
lineHeight: 1
|
|
594
|
-
};
|
|
595
|
-
export default VictoryLabel;
|
|
607
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface PortalContextValue {
|
|
3
|
+
portalRegister(): number;
|
|
4
|
+
portalUpdate(key: number, element: React.ReactElement): void;
|
|
5
|
+
portalDeregister(key: number): void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The React context object consumers may use to access the context of the
|
|
9
|
+
* portal.
|
|
10
|
+
*/
|
|
11
|
+
export declare const PortalContext: React.Context<PortalContextValue>;
|