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
package/es/victory-util/timer.js
CHANGED
|
@@ -2,19 +2,29 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
2
2
|
|
|
3
3
|
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); } }
|
|
4
4
|
|
|
5
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
5
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
6
6
|
|
|
7
|
-
import { timer, now } from "d3-timer";
|
|
7
|
+
import { timer, now } from "victory-vendor/d3-timer";
|
|
8
8
|
|
|
9
|
-
var Timer =
|
|
10
|
-
/*#__PURE__*/
|
|
11
|
-
function () {
|
|
9
|
+
var Timer = /*#__PURE__*/function () {
|
|
12
10
|
function Timer() {
|
|
11
|
+
var _this = this;
|
|
12
|
+
|
|
13
13
|
_classCallCheck(this, Timer);
|
|
14
14
|
|
|
15
|
+
this.shouldAnimate = void 0;
|
|
16
|
+
this.subscribers = void 0;
|
|
17
|
+
this.activeSubscriptions = void 0;
|
|
18
|
+
this.timer = void 0;
|
|
19
|
+
|
|
20
|
+
this.loop = function () {
|
|
21
|
+
_this.subscribers.forEach(function (s) {
|
|
22
|
+
s.callback(now() - s.startTime, s.duration);
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
|
|
15
26
|
this.shouldAnimate = true;
|
|
16
27
|
this.subscribers = [];
|
|
17
|
-
this.loop = this.loop.bind(this);
|
|
18
28
|
this.timer = null;
|
|
19
29
|
this.activeSubscriptions = 0;
|
|
20
30
|
}
|
|
@@ -29,13 +39,6 @@ function () {
|
|
|
29
39
|
value: function resumeAnimation() {
|
|
30
40
|
this.shouldAnimate = true;
|
|
31
41
|
}
|
|
32
|
-
}, {
|
|
33
|
-
key: "loop",
|
|
34
|
-
value: function loop() {
|
|
35
|
-
this.subscribers.forEach(function (s) {
|
|
36
|
-
s.callback(now() - s.startTime, s.duration);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
42
|
}, {
|
|
40
43
|
key: "start",
|
|
41
44
|
value: function start() {
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { OriginType } from "../victory-label/victory-label";
|
|
3
|
+
import { NumberOrCallback, PaddingProps, VictoryThemeDefinition } from "../victory-theme/victory-theme";
|
|
4
|
+
import { StringOrCallback, StringOrNumberOrCallback } from "../types";
|
|
5
|
+
import { AnimationEasing, AnimationStyle } from "../victory-animation/victory-animation";
|
|
6
|
+
export declare type StringOrNumberOrList = string | number | (string | number)[];
|
|
7
|
+
export interface AnimatePropTypeInterface {
|
|
8
|
+
duration?: number;
|
|
9
|
+
onEnd?: () => void;
|
|
10
|
+
onExit?: {
|
|
11
|
+
duration?: number;
|
|
12
|
+
before?: (datum: any) => AnimationStyle;
|
|
13
|
+
};
|
|
14
|
+
onEnter?: {
|
|
15
|
+
duration?: number;
|
|
16
|
+
before?: (datum: any) => AnimationStyle;
|
|
17
|
+
after?: (datum: any) => AnimationStyle;
|
|
18
|
+
};
|
|
19
|
+
onLoad?: {
|
|
20
|
+
duration?: number;
|
|
21
|
+
before?: (datum: any) => AnimationStyle;
|
|
22
|
+
after?: (datum: any) => AnimationStyle;
|
|
23
|
+
};
|
|
24
|
+
easing?: AnimationEasing;
|
|
25
|
+
animationWhitelist?: string[];
|
|
26
|
+
}
|
|
27
|
+
export interface EventCallbackInterface<TTarget, TEventKey> {
|
|
28
|
+
childName?: string | string[];
|
|
29
|
+
target?: TTarget;
|
|
30
|
+
eventKey?: TEventKey;
|
|
31
|
+
mutation: (props: any) => any;
|
|
32
|
+
callback?: (props: any) => any;
|
|
33
|
+
}
|
|
34
|
+
export interface EventPropTypeInterface<TTarget, TEventKey> {
|
|
35
|
+
childName?: string | Array<StringOrNumberOrCallback>;
|
|
36
|
+
target: TTarget;
|
|
37
|
+
eventKey?: TEventKey;
|
|
38
|
+
eventHandlers: {
|
|
39
|
+
[key: string]: {
|
|
40
|
+
(event: React.SyntheticEvent<any>, props?: any): EventCallbackInterface<TTarget, TEventKey>;
|
|
41
|
+
} | {
|
|
42
|
+
(event: React.SyntheticEvent<any>, props?: any): EventCallbackInterface<TTarget, TEventKey>[];
|
|
43
|
+
} | {
|
|
44
|
+
(event: React.SyntheticEvent<any>, props?: any): void;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export declare type DomainTuple = [number, number] | [Date, Date];
|
|
49
|
+
export declare type DomainPropObjectType = {
|
|
50
|
+
x?: DomainTuple;
|
|
51
|
+
y: DomainTuple;
|
|
52
|
+
} | {
|
|
53
|
+
x: DomainTuple;
|
|
54
|
+
y?: DomainTuple;
|
|
55
|
+
};
|
|
56
|
+
export declare type DomainPropType = DomainPropObjectType | DomainTuple;
|
|
57
|
+
export declare type PaddingType = number | [number, number];
|
|
58
|
+
export declare type DomainPaddingPropType = PaddingType | {
|
|
59
|
+
x?: PaddingType;
|
|
60
|
+
y?: PaddingType;
|
|
61
|
+
};
|
|
62
|
+
export declare type RangeTuple = [number, number];
|
|
63
|
+
export declare type RangePropType = RangeTuple | {
|
|
64
|
+
x?: RangeTuple;
|
|
65
|
+
y?: RangeTuple;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* D3 scale function shape. Don"t want to introduce typing dependency to d3
|
|
69
|
+
*/
|
|
70
|
+
export interface D3Scale {
|
|
71
|
+
(input: string | number): number;
|
|
72
|
+
domain: () => any;
|
|
73
|
+
range: () => any;
|
|
74
|
+
copy: () => any;
|
|
75
|
+
}
|
|
76
|
+
export declare type ScalePropType = "linear" | "time" | "log" | "sqrt";
|
|
77
|
+
export declare type CategoryPropType = string[] | {
|
|
78
|
+
x: string[];
|
|
79
|
+
} | {
|
|
80
|
+
y: string[];
|
|
81
|
+
} | {
|
|
82
|
+
x: string[];
|
|
83
|
+
y: string[];
|
|
84
|
+
};
|
|
85
|
+
export declare type DataGetterPropType = number | string | string[] | {
|
|
86
|
+
(data: any): number | string | string[];
|
|
87
|
+
} | Function;
|
|
88
|
+
export declare type InterpolationPropType = "basis" | "basisClosed" | "basisOpen" | "bundle" | "cardinal" | "cardinalClosed" | "cardinalOpen" | "catmullRom" | "catmullRomClosed" | "catmullRomOpen" | "linear" | "linearClosed" | "monotoneX" | "monotoneY" | "natural" | "radial" | "step" | "stepAfter" | "stepBefore";
|
|
89
|
+
export declare type ColorScalePropType = "grayscale" | "qualitative" | "heatmap" | "warm" | "cool" | "red" | "green" | "blue" | string[];
|
|
90
|
+
export declare type SortOrderPropType = "ascending" | "descending";
|
|
91
|
+
export declare type SVGCoordinateType = {
|
|
92
|
+
x: number;
|
|
93
|
+
y: number;
|
|
94
|
+
};
|
|
95
|
+
export interface VictoryCommonThemeProps {
|
|
96
|
+
animate?: boolean | AnimatePropTypeInterface;
|
|
97
|
+
colorScale?: ColorScalePropType;
|
|
98
|
+
containerComponent?: React.ReactElement;
|
|
99
|
+
domainPadding?: DomainPaddingPropType;
|
|
100
|
+
externalEventMutations?: EventCallbackInterface<string | string[], StringOrNumberOrList>[];
|
|
101
|
+
groupComponent?: React.ReactElement;
|
|
102
|
+
height?: number;
|
|
103
|
+
horizontal?: boolean;
|
|
104
|
+
maxDomain?: number | {
|
|
105
|
+
x?: number;
|
|
106
|
+
y?: number;
|
|
107
|
+
};
|
|
108
|
+
minDomain?: number | {
|
|
109
|
+
x?: number;
|
|
110
|
+
y?: number;
|
|
111
|
+
};
|
|
112
|
+
name?: string;
|
|
113
|
+
origin?: OriginType;
|
|
114
|
+
padding?: PaddingProps;
|
|
115
|
+
polar?: boolean;
|
|
116
|
+
range?: RangePropType;
|
|
117
|
+
scale?: ScalePropType | D3Scale | {
|
|
118
|
+
x?: ScalePropType | D3Scale;
|
|
119
|
+
y?: ScalePropType | D3Scale;
|
|
120
|
+
};
|
|
121
|
+
sharedEvents?: {
|
|
122
|
+
events: any[];
|
|
123
|
+
getEventState: Function;
|
|
124
|
+
};
|
|
125
|
+
singleQuadrantDomainPadding?: boolean | {
|
|
126
|
+
x?: boolean;
|
|
127
|
+
y?: boolean;
|
|
128
|
+
};
|
|
129
|
+
standalone?: boolean;
|
|
130
|
+
width?: number;
|
|
131
|
+
}
|
|
132
|
+
export interface VictoryCommonProps extends VictoryCommonThemeProps {
|
|
133
|
+
theme?: VictoryThemeDefinition;
|
|
134
|
+
}
|
|
135
|
+
export interface VictoryCommonPrimitiveProps {
|
|
136
|
+
active?: boolean;
|
|
137
|
+
ariaLabel?: StringOrCallback;
|
|
138
|
+
className?: string;
|
|
139
|
+
clipPath?: string;
|
|
140
|
+
data?: any;
|
|
141
|
+
desc?: string | Function;
|
|
142
|
+
disableInlineStyles?: boolean;
|
|
143
|
+
events?: object;
|
|
144
|
+
id?: number | string | Function;
|
|
145
|
+
index?: number | string;
|
|
146
|
+
origin?: OriginType;
|
|
147
|
+
polar?: boolean;
|
|
148
|
+
role?: string;
|
|
149
|
+
scale?: any;
|
|
150
|
+
shapeRendering?: string;
|
|
151
|
+
style?: any;
|
|
152
|
+
tabIndex?: NumberOrCallback;
|
|
153
|
+
transform?: string;
|
|
154
|
+
}
|
|
155
|
+
export interface VictoryDatableProps {
|
|
156
|
+
categories?: CategoryPropType;
|
|
157
|
+
data?: any[];
|
|
158
|
+
dataComponent?: React.ReactElement;
|
|
159
|
+
domain?: DomainPropType;
|
|
160
|
+
domainPadding?: DomainPaddingPropType;
|
|
161
|
+
samples?: number;
|
|
162
|
+
sortKey?: DataGetterPropType;
|
|
163
|
+
sortOrder?: SortOrderPropType;
|
|
164
|
+
x?: DataGetterPropType;
|
|
165
|
+
y?: DataGetterPropType;
|
|
166
|
+
y0?: DataGetterPropType;
|
|
167
|
+
}
|
|
168
|
+
export interface VictoryLabelableProps {
|
|
169
|
+
labelComponent?: React.ReactElement;
|
|
170
|
+
}
|
|
171
|
+
export interface VictoryMultiLabelableProps extends VictoryLabelableProps {
|
|
172
|
+
labels?: string[] | number[] | {
|
|
173
|
+
(data: any): string | string[] | number | number[] | null;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
export interface VictorySingleLabelableProps extends VictoryLabelableProps {
|
|
177
|
+
label?: string | {
|
|
178
|
+
(data: any): string | number | null;
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
export interface TextSizeStyleInterface {
|
|
182
|
+
angle?: number;
|
|
183
|
+
characterConstant?: string;
|
|
184
|
+
fontFamily?: string;
|
|
185
|
+
fontSize?: number | string;
|
|
186
|
+
letterSpacing?: string;
|
|
187
|
+
lineHeight?: number;
|
|
188
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,21 +1,29 @@
|
|
|
1
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
2
|
|
|
3
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
4
|
|
|
5
|
-
function
|
|
5
|
+
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); }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
6
10
|
|
|
7
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
12
|
|
|
9
|
-
function
|
|
13
|
+
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; }
|
|
14
|
+
|
|
15
|
+
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
16
|
|
|
11
17
|
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
18
|
|
|
19
|
+
import * as React from "react";
|
|
13
20
|
/*
|
|
14
21
|
USER_PROPS_SAFELIST is to contain any string deemed safe for user props.
|
|
15
22
|
The startsWidth array will contain the start of any accepted user-prop that
|
|
16
23
|
starts with these characters.
|
|
17
24
|
The exactMatch will contain a list of exact prop names that are accepted.
|
|
18
25
|
*/
|
|
26
|
+
|
|
19
27
|
var USER_PROPS_SAFELIST = {
|
|
20
28
|
startsWith: ["data-", "aria-"],
|
|
21
29
|
exactMatch: []
|
|
@@ -61,6 +69,21 @@ var testIfSafeProp = function (key) {
|
|
|
61
69
|
if (doesPropStartWith(key) || isExactMatch(key)) return true;
|
|
62
70
|
return false;
|
|
63
71
|
};
|
|
72
|
+
/**
|
|
73
|
+
* Gets the value from props if a function value is provided
|
|
74
|
+
* @param {any} value: maybe function value
|
|
75
|
+
* @param {Object} props: props object
|
|
76
|
+
* @returns {any} newValue
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
var getValue = function (value, props) {
|
|
81
|
+
if (typeof value === "function") {
|
|
82
|
+
return value(props);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return value;
|
|
86
|
+
};
|
|
64
87
|
/**
|
|
65
88
|
* getSafeUserProps - function that takes in a props object and removes any
|
|
66
89
|
* key-value entries that do not match filter strings in the USER_PROPS_SAFELIST
|
|
@@ -79,5 +102,22 @@ export var getSafeUserProps = function (props) {
|
|
|
79
102
|
key = _ref2[0];
|
|
80
103
|
|
|
81
104
|
return testIfSafeProp(key);
|
|
105
|
+
}).map(function (_ref3) {
|
|
106
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
107
|
+
key = _ref4[0],
|
|
108
|
+
value = _ref4[1];
|
|
109
|
+
|
|
110
|
+
return [key, getValue(value, props)];
|
|
82
111
|
}));
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Wraps a component and adds safe user props
|
|
115
|
+
*
|
|
116
|
+
* @param {ReactNode} component: parent component
|
|
117
|
+
* @param {Object} props: props to be filtered
|
|
118
|
+
* @returns {ReactNode} modified component
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
export var withSafeUserProps = function (component, props) {
|
|
122
|
+
return /*#__PURE__*/React.cloneElement(component, getSafeUserProps(props));
|
|
83
123
|
};
|
|
@@ -8,15 +8,21 @@ import _flatten from "lodash/flatten";
|
|
|
8
8
|
import _defaults from "lodash/defaults";
|
|
9
9
|
import _assign from "lodash/assign";
|
|
10
10
|
|
|
11
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
|
11
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
12
12
|
|
|
13
|
-
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."); }
|
|
14
14
|
|
|
15
|
-
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); }
|
|
16
16
|
|
|
17
|
-
function
|
|
17
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
18
18
|
|
|
19
|
-
function
|
|
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; }
|
|
22
|
+
|
|
23
|
+
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; }
|
|
24
|
+
|
|
25
|
+
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; }
|
|
20
26
|
|
|
21
27
|
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; }
|
|
22
28
|
|
|
@@ -76,7 +82,7 @@ export function addBinsToParentPropsIfHistogram(_ref) {
|
|
|
76
82
|
}, []);
|
|
77
83
|
}
|
|
78
84
|
|
|
79
|
-
return _objectSpread({}, parentProps, {
|
|
85
|
+
return _objectSpread(_objectSpread({}, parentProps), {}, {
|
|
80
86
|
bins: childBins
|
|
81
87
|
});
|
|
82
88
|
}
|
|
@@ -112,7 +118,7 @@ export function getDataFromChildren(props, childComponents) {
|
|
|
112
118
|
if (!Data.isDataComponent(child)) {
|
|
113
119
|
return null;
|
|
114
120
|
} else if (child.type && _isFunction(child.type.getData)) {
|
|
115
|
-
child = parent ? React.cloneElement(child, parent.props) : child;
|
|
121
|
+
child = parent ? /*#__PURE__*/React.cloneElement(child, parent.props) : child;
|
|
116
122
|
childData = child.type.getData(childProps);
|
|
117
123
|
} else {
|
|
118
124
|
childData = Data.getData(childProps);
|
|
@@ -259,8 +265,8 @@ export function getDomain(props, axis, childComponents) {
|
|
|
259
265
|
var dataset = (props.data || props.y) && Data.getData(props);
|
|
260
266
|
var dataDomain = dataset ? Domain.getDomainFromData(props, axis, dataset) : [];
|
|
261
267
|
var childDomain = getDomainFromChildren(props, axis, childComponents);
|
|
262
|
-
var min = minDomain || Collection.getMinValue(_toConsumableArray(dataDomain)
|
|
263
|
-
var max = maxDomain || Collection.getMaxValue(_toConsumableArray(dataDomain)
|
|
268
|
+
var min = minDomain || Collection.getMinValue([].concat(_toConsumableArray(dataDomain), _toConsumableArray(childDomain)));
|
|
269
|
+
var max = maxDomain || Collection.getMaxValue([].concat(_toConsumableArray(dataDomain), _toConsumableArray(childDomain)));
|
|
264
270
|
domain = Domain.getDomainFromMinMax(min, max);
|
|
265
271
|
}
|
|
266
272
|
|
|
@@ -417,7 +423,7 @@ export function getCategoryAndAxisStringsFromChildren(props, axis, childComponen
|
|
|
417
423
|
var axisComponent = Axis.getAxisComponent(childComponents, axis);
|
|
418
424
|
var axisStrings = axisComponent ? Data.getStringsFromAxes(axisComponent.props, axis) : [];
|
|
419
425
|
var categoryStrings = categories || getStringsFromCategories(childComponents, axis);
|
|
420
|
-
return _uniq(_flatten(_toConsumableArray(categoryStrings)
|
|
426
|
+
return _uniq(_flatten([].concat(_toConsumableArray(categoryStrings), _toConsumableArray(axisStrings))));
|
|
421
427
|
}
|
|
422
428
|
export function getStringsFromChildren(props, childComponents) {
|
|
423
429
|
childComponents = childComponents || React.Children.toArray(props.children);
|
|
@@ -425,8 +431,8 @@ export function getStringsFromChildren(props, childComponents) {
|
|
|
425
431
|
var yStrings = getCategoryAndAxisStringsFromChildren(props, "y", childComponents);
|
|
426
432
|
var dataStrings = getStringsFromData(childComponents);
|
|
427
433
|
return {
|
|
428
|
-
x: _uniq(_flatten(_toConsumableArray(xStrings)
|
|
429
|
-
y: _uniq(_flatten(_toConsumableArray(yStrings)
|
|
434
|
+
x: _uniq(_flatten([].concat(_toConsumableArray(xStrings), _toConsumableArray(dataStrings.x)))),
|
|
435
|
+
y: _uniq(_flatten([].concat(_toConsumableArray(yStrings), _toConsumableArray(dataStrings.y))))
|
|
430
436
|
};
|
|
431
437
|
}
|
|
432
438
|
export function getCategories(props, childComponents, allStrings) {
|