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
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import TimerContext from "../victory-util/timer-context";
|
|
4
|
+
import type Timer from "../victory-util/timer";
|
|
5
|
+
/**
|
|
6
|
+
* Single animation object to interpolate
|
|
7
|
+
*/
|
|
8
|
+
export declare type AnimationStyle = {
|
|
9
|
+
[key: string]: string | number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Animation styles to interpolate
|
|
13
|
+
*/
|
|
14
|
+
export declare type AnimationData = AnimationStyle | AnimationStyle[];
|
|
15
|
+
export declare type AnimationEasing = "back" | "backIn" | "backOut" | "backInOut" | "bounce" | "bounceIn" | "bounceOut" | "bounceInOut" | "circle" | "circleIn" | "circleOut" | "circleInOut" | "linear" | "linearIn" | "linearOut" | "linearInOut" | "cubic" | "cubicIn" | "cubicOut" | "cubicInOut" | "elastic" | "elasticIn" | "elasticOut" | "elasticInOut" | "exp" | "expIn" | "expOut" | "expInOut" | "poly" | "polyIn" | "polyOut" | "polyInOut" | "quad" | "quadIn" | "quadOut" | "quadInOut" | "sin" | "sinIn" | "sinOut" | "sinInOut";
|
|
16
|
+
export interface VictoryAnimationProps {
|
|
17
|
+
children: (style: AnimationStyle, info: AnimationInfo) => React.ReactNode;
|
|
18
|
+
duration?: number;
|
|
19
|
+
easing?: AnimationEasing;
|
|
20
|
+
delay?: number;
|
|
21
|
+
onEnd?: () => void;
|
|
22
|
+
data: AnimationData;
|
|
23
|
+
}
|
|
24
|
+
export interface VictoryAnimationState {
|
|
25
|
+
data: AnimationStyle;
|
|
26
|
+
animationInfo: AnimationInfo;
|
|
27
|
+
}
|
|
28
|
+
export interface AnimationInfo {
|
|
29
|
+
progress: number;
|
|
30
|
+
animating: boolean;
|
|
31
|
+
terminating?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface VictoryAnimation {
|
|
34
|
+
context: React.ContextType<typeof TimerContext>;
|
|
35
|
+
}
|
|
36
|
+
export declare class VictoryAnimation extends React.Component<VictoryAnimationProps, VictoryAnimationState> {
|
|
37
|
+
static displayName: string;
|
|
38
|
+
static propTypes: {
|
|
39
|
+
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
40
|
+
data: PropTypes.Requireable<object>;
|
|
41
|
+
delay: PropTypes.Requireable<number>;
|
|
42
|
+
duration: PropTypes.Requireable<number>;
|
|
43
|
+
easing: PropTypes.Requireable<string>;
|
|
44
|
+
onEnd: PropTypes.Requireable<(...args: any[]) => any>;
|
|
45
|
+
};
|
|
46
|
+
static defaultProps: {
|
|
47
|
+
data: {};
|
|
48
|
+
delay: number;
|
|
49
|
+
duration: number;
|
|
50
|
+
easing: string;
|
|
51
|
+
};
|
|
52
|
+
static contextType: React.Context<{
|
|
53
|
+
transitionTimer: Timer;
|
|
54
|
+
animationTimer: Timer;
|
|
55
|
+
}>;
|
|
56
|
+
private interpolator;
|
|
57
|
+
private queue;
|
|
58
|
+
private ease;
|
|
59
|
+
private timer;
|
|
60
|
+
private loopID?;
|
|
61
|
+
constructor(props: any, context: any);
|
|
62
|
+
componentDidMount(): void;
|
|
63
|
+
componentDidUpdate(prevProps: any): void;
|
|
64
|
+
componentWillUnmount(): void;
|
|
65
|
+
toNewName(ease: any): string;
|
|
66
|
+
traverseQueue(): void;
|
|
67
|
+
functionToBeRunEachFrame: (elapsed: any, duration: any) => void;
|
|
68
|
+
render(): React.ReactNode;
|
|
69
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.VictoryAnimation = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
@@ -43,7 +43,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
43
43
|
|
|
44
44
|
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); }
|
|
45
45
|
|
|
46
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
46
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
47
47
|
|
|
48
48
|
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); }; }
|
|
49
49
|
|
|
@@ -53,9 +53,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
53
53
|
|
|
54
54
|
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; } }
|
|
55
55
|
|
|
56
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
57
|
-
|
|
58
|
-
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; }
|
|
56
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
59
57
|
|
|
60
58
|
var VictoryAnimation = /*#__PURE__*/function (_React$Component) {
|
|
61
59
|
_inherits(VictoryAnimation, _React$Component);
|
|
@@ -70,6 +68,56 @@ var VictoryAnimation = /*#__PURE__*/function (_React$Component) {
|
|
|
70
68
|
_this = _super.call(this, props, context);
|
|
71
69
|
/* defaults */
|
|
72
70
|
|
|
71
|
+
_this.interpolator = void 0;
|
|
72
|
+
_this.queue = void 0;
|
|
73
|
+
_this.ease = void 0;
|
|
74
|
+
_this.timer = void 0;
|
|
75
|
+
_this.loopID = void 0;
|
|
76
|
+
|
|
77
|
+
_this.functionToBeRunEachFrame = function (elapsed, duration) {
|
|
78
|
+
/*
|
|
79
|
+
step can generate imprecise values, sometimes greater than 1
|
|
80
|
+
if this happens set the state to 1 and return, cancelling the timer
|
|
81
|
+
*/
|
|
82
|
+
duration = duration !== undefined ? duration : _this.props.duration;
|
|
83
|
+
var step = duration ? elapsed / duration : 1;
|
|
84
|
+
|
|
85
|
+
if (step >= 1) {
|
|
86
|
+
_this.setState({
|
|
87
|
+
data: _this.interpolator(1),
|
|
88
|
+
animationInfo: {
|
|
89
|
+
progress: 1,
|
|
90
|
+
animating: false,
|
|
91
|
+
terminating: true
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
if (_this.loopID) {
|
|
96
|
+
_this.timer.unsubscribe(_this.loopID);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
_this.queue.shift();
|
|
100
|
+
|
|
101
|
+
_this.traverseQueue();
|
|
102
|
+
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
/*
|
|
106
|
+
if we're not at the end of the timer, set the state by passing
|
|
107
|
+
current step value that's transformed by the ease function to the
|
|
108
|
+
interpolator, which is cached for performance whenever props are received
|
|
109
|
+
*/
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
_this.setState({
|
|
113
|
+
data: _this.interpolator(_this.ease(step)),
|
|
114
|
+
animationInfo: {
|
|
115
|
+
progress: step,
|
|
116
|
+
animating: step < 1
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
|
|
73
121
|
_this.state = {
|
|
74
122
|
data: Array.isArray(_this.props.data) ? _this.props.data[0] : _this.props.data,
|
|
75
123
|
animationInfo: {
|
|
@@ -82,12 +130,6 @@ var VictoryAnimation = /*#__PURE__*/function (_React$Component) {
|
|
|
82
130
|
/* build easing function */
|
|
83
131
|
|
|
84
132
|
_this.ease = d3Ease[_this.toNewName(_this.props.easing)];
|
|
85
|
-
/*
|
|
86
|
-
There is no autobinding of this in ES6 classes
|
|
87
|
-
so we bind functionToBeRunEachFrame to current instance of victory animation class
|
|
88
|
-
*/
|
|
89
|
-
|
|
90
|
-
_this.functionToBeRunEachFrame = _this.functionToBeRunEachFrame.bind(_assertThisInitialized(_this));
|
|
91
133
|
_this.timer = _this.context.animationTimer;
|
|
92
134
|
return _this;
|
|
93
135
|
}
|
|
@@ -188,49 +230,6 @@ var VictoryAnimation = /*#__PURE__*/function (_React$Component) {
|
|
|
188
230
|
}
|
|
189
231
|
/* every frame we... */
|
|
190
232
|
|
|
191
|
-
}, {
|
|
192
|
-
key: "functionToBeRunEachFrame",
|
|
193
|
-
value: function functionToBeRunEachFrame(elapsed, duration) {
|
|
194
|
-
/*
|
|
195
|
-
step can generate imprecise values, sometimes greater than 1
|
|
196
|
-
if this happens set the state to 1 and return, cancelling the timer
|
|
197
|
-
*/
|
|
198
|
-
duration = duration !== undefined ? duration : this.props.duration;
|
|
199
|
-
var step = duration ? elapsed / duration : 1;
|
|
200
|
-
|
|
201
|
-
if (step >= 1) {
|
|
202
|
-
this.setState({
|
|
203
|
-
data: this.interpolator(1),
|
|
204
|
-
animationInfo: {
|
|
205
|
-
progress: 1,
|
|
206
|
-
animating: false,
|
|
207
|
-
terminating: true
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
if (this.loopID) {
|
|
212
|
-
this.timer.unsubscribe(this.loopID);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
this.queue.shift();
|
|
216
|
-
this.traverseQueue();
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
/*
|
|
220
|
-
if we're not at the end of the timer, set the state by passing
|
|
221
|
-
current step value that's transformed by the ease function to the
|
|
222
|
-
interpolator, which is cached for performance whenever props are received
|
|
223
|
-
*/
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
this.setState({
|
|
227
|
-
data: this.interpolator(this.ease(step)),
|
|
228
|
-
animationInfo: {
|
|
229
|
-
progress: step,
|
|
230
|
-
animating: step < 1
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
233
|
}, {
|
|
235
234
|
key: "render",
|
|
236
235
|
value: function render() {
|
|
@@ -241,24 +240,20 @@ var VictoryAnimation = /*#__PURE__*/function (_React$Component) {
|
|
|
241
240
|
return VictoryAnimation;
|
|
242
241
|
}(_react.default.Component);
|
|
243
242
|
|
|
244
|
-
exports.
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
_defineProperty(VictoryAnimation, "propTypes", {
|
|
243
|
+
exports.VictoryAnimation = VictoryAnimation;
|
|
244
|
+
VictoryAnimation.displayName = "VictoryAnimation";
|
|
245
|
+
VictoryAnimation.propTypes = {
|
|
249
246
|
children: _propTypes.default.func,
|
|
250
247
|
data: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.array]),
|
|
251
248
|
delay: _propTypes.default.number,
|
|
252
249
|
duration: _propTypes.default.number,
|
|
253
250
|
easing: _propTypes.default.oneOf(["back", "backIn", "backOut", "backInOut", "bounce", "bounceIn", "bounceOut", "bounceInOut", "circle", "circleIn", "circleOut", "circleInOut", "linear", "linearIn", "linearOut", "linearInOut", "cubic", "cubicIn", "cubicOut", "cubicInOut", "elastic", "elasticIn", "elasticOut", "elasticInOut", "exp", "expIn", "expOut", "expInOut", "poly", "polyIn", "polyOut", "polyInOut", "quad", "quadIn", "quadOut", "quadInOut", "sin", "sinIn", "sinOut", "sinInOut"]),
|
|
254
251
|
onEnd: _propTypes.default.func
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
_defineProperty(VictoryAnimation, "defaultProps", {
|
|
252
|
+
};
|
|
253
|
+
VictoryAnimation.defaultProps = {
|
|
258
254
|
data: {},
|
|
259
255
|
delay: 0,
|
|
260
256
|
duration: 1000,
|
|
261
257
|
easing: "quadInOut"
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
_defineProperty(VictoryAnimation, "contextType", _timerContext.default);
|
|
258
|
+
};
|
|
259
|
+
VictoryAnimation.contextType = _timerContext.default;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import { BlockProps } from "../victory-theme/victory-theme";
|
|
4
|
+
import { OriginType } from "../victory-label/victory-label";
|
|
5
|
+
export interface VictoryClipContainerProps {
|
|
6
|
+
"aria-label"?: string;
|
|
7
|
+
children?: React.ReactElement | React.ReactElement[];
|
|
8
|
+
circleComponent?: React.ReactElement;
|
|
9
|
+
className?: string;
|
|
10
|
+
clipHeight?: number;
|
|
11
|
+
clipId?: number | string;
|
|
12
|
+
clipPadding?: BlockProps;
|
|
13
|
+
clipPathComponent?: React.ReactElement;
|
|
14
|
+
clipWidth?: number;
|
|
15
|
+
events?: React.DOMAttributes<any>;
|
|
16
|
+
groupComponent?: React.ReactElement;
|
|
17
|
+
origin?: OriginType;
|
|
18
|
+
polar?: boolean;
|
|
19
|
+
radius?: number;
|
|
20
|
+
rectComponent?: React.ReactElement;
|
|
21
|
+
translateX?: number;
|
|
22
|
+
translateY?: number;
|
|
23
|
+
}
|
|
24
|
+
export declare class VictoryClipContainer extends React.Component<VictoryClipContainerProps> {
|
|
25
|
+
static displayName: string;
|
|
26
|
+
static role: string;
|
|
27
|
+
static propTypes: {
|
|
28
|
+
"aria-label": PropTypes.Requireable<string>;
|
|
29
|
+
children: PropTypes.Requireable<string | number | boolean | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
|
|
30
|
+
circleComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
31
|
+
className: PropTypes.Requireable<string>;
|
|
32
|
+
clipHeight: any;
|
|
33
|
+
clipId: PropTypes.Requireable<string | number>;
|
|
34
|
+
clipPadding: PropTypes.Requireable<PropTypes.InferProps<{
|
|
35
|
+
top: PropTypes.Requireable<number>;
|
|
36
|
+
bottom: PropTypes.Requireable<number>;
|
|
37
|
+
left: PropTypes.Requireable<number>;
|
|
38
|
+
right: PropTypes.Requireable<number>;
|
|
39
|
+
}>>;
|
|
40
|
+
clipPathComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
41
|
+
clipWidth: any;
|
|
42
|
+
events: PropTypes.Requireable<object>;
|
|
43
|
+
groupComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
44
|
+
origin: PropTypes.Requireable<PropTypes.InferProps<{
|
|
45
|
+
x: any;
|
|
46
|
+
y: any;
|
|
47
|
+
}>>;
|
|
48
|
+
polar: PropTypes.Requireable<boolean>;
|
|
49
|
+
radius: any;
|
|
50
|
+
style: PropTypes.Requireable<object>;
|
|
51
|
+
tabIndex: PropTypes.Requireable<number>;
|
|
52
|
+
transform: PropTypes.Requireable<string>;
|
|
53
|
+
translateX: PropTypes.Requireable<number>;
|
|
54
|
+
translateY: PropTypes.Requireable<number>;
|
|
55
|
+
};
|
|
56
|
+
static defaultProps: {
|
|
57
|
+
circleComponent: JSX.Element;
|
|
58
|
+
rectComponent: JSX.Element;
|
|
59
|
+
clipPathComponent: JSX.Element;
|
|
60
|
+
groupComponent: JSX.Element;
|
|
61
|
+
};
|
|
62
|
+
private clipId;
|
|
63
|
+
constructor(props: VictoryClipContainerProps);
|
|
64
|
+
calculateAttributes(props: any): {
|
|
65
|
+
x: number;
|
|
66
|
+
y: number;
|
|
67
|
+
width: number;
|
|
68
|
+
height: number;
|
|
69
|
+
};
|
|
70
|
+
renderClippedGroup(props: any, clipId: any): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
71
|
+
renderGroup(props: any): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
72
|
+
renderClipComponent(props: any, clipId: any): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
73
|
+
getClipValue(props: any, axis: any): any;
|
|
74
|
+
getTranslateValue(props: any, axis: any): any;
|
|
75
|
+
render(): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
76
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.VictoryClipContainer = void 0;
|
|
7
7
|
|
|
8
8
|
var _uniqueId2 = _interopRequireDefault(require("lodash/uniqueId"));
|
|
9
9
|
|
|
@@ -23,11 +23,11 @@ var Helpers = _interopRequireWildcard(require("../victory-util/helpers"));
|
|
|
23
23
|
|
|
24
24
|
var UserProps = _interopRequireWildcard(require("../victory-util/user-props"));
|
|
25
25
|
|
|
26
|
-
var _clipPath =
|
|
26
|
+
var _clipPath = require("../victory-primitives/clip-path");
|
|
27
27
|
|
|
28
|
-
var _circle =
|
|
28
|
+
var _circle = require("../victory-primitives/circle");
|
|
29
29
|
|
|
30
|
-
var _rect =
|
|
30
|
+
var _rect = require("../victory-primitives/rect");
|
|
31
31
|
|
|
32
32
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
33
|
|
|
@@ -51,6 +51,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
51
51
|
|
|
52
52
|
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; }
|
|
53
53
|
|
|
54
|
+
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; }
|
|
55
|
+
|
|
54
56
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
55
57
|
|
|
56
58
|
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); } }
|
|
@@ -59,7 +61,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
59
61
|
|
|
60
62
|
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); }
|
|
61
63
|
|
|
62
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
64
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
63
65
|
|
|
64
66
|
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); }; }
|
|
65
67
|
|
|
@@ -69,9 +71,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
69
71
|
|
|
70
72
|
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; } }
|
|
71
73
|
|
|
72
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
73
|
-
|
|
74
|
-
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; }
|
|
74
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
75
75
|
|
|
76
76
|
var VictoryClipContainer = /*#__PURE__*/function (_React$Component) {
|
|
77
77
|
_inherits(VictoryClipContainer, _React$Component);
|
|
@@ -84,6 +84,7 @@ var VictoryClipContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
84
84
|
_classCallCheck(this, VictoryClipContainer);
|
|
85
85
|
|
|
86
86
|
_this = _super.call(this, props);
|
|
87
|
+
_this.clipId = void 0;
|
|
87
88
|
_this.clipId = !(0, _isObject2.default)(props) || props.clipId === undefined ? (0, _uniqueId2.default)("victory-clip-") : props.clipId;
|
|
88
89
|
return _this;
|
|
89
90
|
}
|
|
@@ -259,13 +260,10 @@ var VictoryClipContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
259
260
|
return VictoryClipContainer;
|
|
260
261
|
}(_react.default.Component);
|
|
261
262
|
|
|
262
|
-
exports.
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
_defineProperty(VictoryClipContainer, "role", "container");
|
|
267
|
-
|
|
268
|
-
_defineProperty(VictoryClipContainer, "propTypes", {
|
|
263
|
+
exports.VictoryClipContainer = VictoryClipContainer;
|
|
264
|
+
VictoryClipContainer.displayName = "VictoryClipContainer";
|
|
265
|
+
VictoryClipContainer.role = "container";
|
|
266
|
+
VictoryClipContainer.propTypes = {
|
|
269
267
|
"aria-label": _propTypes.default.string,
|
|
270
268
|
children: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.node), _propTypes.default.node]),
|
|
271
269
|
circleComponent: _propTypes.default.element,
|
|
@@ -293,11 +291,10 @@ _defineProperty(VictoryClipContainer, "propTypes", {
|
|
|
293
291
|
transform: _propTypes.default.string,
|
|
294
292
|
translateX: _propTypes.default.number,
|
|
295
293
|
translateY: _propTypes.default.number
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
clipPathComponent: /*#__PURE__*/_react.default.createElement(_clipPath.default, null),
|
|
294
|
+
};
|
|
295
|
+
VictoryClipContainer.defaultProps = {
|
|
296
|
+
circleComponent: /*#__PURE__*/_react.default.createElement(_circle.Circle, null),
|
|
297
|
+
rectComponent: /*#__PURE__*/_react.default.createElement(_rect.Rect, null),
|
|
298
|
+
clipPathComponent: /*#__PURE__*/_react.default.createElement(_clipPath.ClipPath, null),
|
|
302
299
|
groupComponent: /*#__PURE__*/_react.default.createElement("g", null)
|
|
303
|
-
}
|
|
300
|
+
};
|
|
@@ -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
|
+
}
|