victory-core 36.9.2-next.1 → 36.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -9
- package/LICENSE.txt +30 -0
- package/README.md +1 -1
- package/dist/victory-core.js +686 -31464
- package/dist/victory-core.min.js +1 -2
- package/es/index.d.ts +17 -17
- package/es/types/callbacks.d.ts +36 -36
- package/es/types/prop-types.d.ts +129 -130
- package/es/victory-accessible-group/victory-accessible-group.d.ts +10 -10
- package/es/victory-animation/util.d.ts +66 -66
- package/es/victory-animation/victory-animation.d.ts +34 -34
- package/es/victory-clip-container/victory-clip-container.d.ts +46 -46
- package/es/victory-container/victory-container.d.ts +68 -64
- package/es/victory-container/victory-container.js +216 -164
- package/es/victory-label/victory-label.d.ts +58 -58
- package/es/victory-portal/portal-context.d.ts +11 -9
- package/es/victory-portal/portal-context.js +1 -1
- package/es/victory-portal/portal.d.ts +20 -9
- package/es/victory-portal/portal.js +77 -6
- package/es/victory-portal/victory-portal.d.ts +26 -9
- package/es/victory-portal/victory-portal.js +98 -24
- package/es/victory-primitives/arc.d.ts +14 -14
- package/es/victory-primitives/background.d.ts +13 -13
- package/es/victory-primitives/border.d.ts +10 -10
- package/es/victory-primitives/circle.d.ts +3 -3
- package/es/victory-primitives/clip-path.d.ts +7 -7
- package/es/victory-primitives/index.d.ts +14 -14
- package/es/victory-primitives/line-segment.d.ts +11 -11
- package/es/victory-primitives/line.d.ts +3 -3
- package/es/victory-primitives/path.d.ts +3 -3
- package/es/victory-primitives/point.d.ts +13 -13
- package/es/victory-primitives/rect.d.ts +3 -3
- package/es/victory-primitives/text.d.ts +8 -8
- package/es/victory-primitives/tspan.d.ts +3 -3
- package/es/victory-primitives/types.d.ts +7 -7
- package/es/victory-primitives/whisker.d.ts +15 -15
- package/es/victory-theme/grayscale.d.ts +2 -2
- package/es/victory-theme/material.d.ts +2 -2
- package/es/victory-theme/types.d.ts +238 -238
- package/es/victory-theme/victory-theme.d.ts +5 -5
- package/es/victory-transition/victory-transition.d.ts +53 -53
- package/es/victory-util/add-events.d.ts +126 -126
- package/es/victory-util/add-events.js +4 -8
- package/es/victory-util/axis.d.ts +50 -50
- package/es/victory-util/axis.js +13 -6
- package/es/victory-util/collection.d.ts +15 -8
- package/es/victory-util/collection.js +16 -0
- package/es/victory-util/common-props.d.ts +79 -79
- package/es/victory-util/data.d.ts +74 -74
- package/es/victory-util/default-transitions.d.ts +4 -4
- package/es/victory-util/domain.d.ts +90 -90
- package/es/victory-util/events.d.ts +64 -64
- package/es/victory-util/helpers.d.ts +96 -91
- package/es/victory-util/helpers.js +12 -1
- package/es/victory-util/hooks/index.d.ts +2 -2
- package/es/victory-util/hooks/use-animation-state.d.ts +21 -21
- package/es/victory-util/hooks/use-previous-props.d.ts +1 -1
- package/es/victory-util/immutable.d.ts +11 -11
- package/es/victory-util/index.d.ts +26 -27
- package/es/victory-util/index.js +0 -1
- package/es/victory-util/label-helpers.d.ts +26 -26
- package/es/victory-util/line-helpers.d.ts +4 -4
- package/es/victory-util/log.d.ts +1 -1
- package/es/victory-util/point-path-helpers.d.ts +9 -9
- package/es/victory-util/scale.d.ts +9 -9
- package/es/victory-util/selection.d.ts +28 -28
- package/es/victory-util/style.d.ts +18 -18
- package/es/victory-util/textsize.d.ts +35 -35
- package/es/victory-util/timer-context.d.ts +11 -11
- package/es/victory-util/timer.d.ts +16 -16
- package/es/victory-util/transitions.d.ts +48 -48
- package/es/victory-util/type-helpers.d.ts +9 -9
- package/es/victory-util/user-props.d.ts +26 -26
- package/es/victory-util/wrapper.d.ts +33 -37
- package/es/victory-util/wrapper.js +2 -2
- package/lib/index.d.ts +17 -17
- package/lib/types/callbacks.d.ts +36 -36
- package/lib/types/prop-types.d.ts +129 -130
- package/lib/victory-accessible-group/victory-accessible-group.d.ts +10 -10
- package/lib/victory-animation/util.d.ts +66 -66
- package/lib/victory-animation/victory-animation.d.ts +34 -34
- package/lib/victory-clip-container/victory-clip-container.d.ts +46 -46
- package/lib/victory-container/victory-container.d.ts +68 -64
- package/lib/victory-container/victory-container.js +221 -170
- package/lib/victory-label/victory-label.d.ts +58 -58
- package/lib/victory-portal/portal-context.d.ts +11 -9
- package/lib/victory-portal/portal-context.js +1 -1
- package/lib/victory-portal/portal.d.ts +20 -9
- package/lib/victory-portal/portal.js +78 -7
- package/lib/victory-portal/victory-portal.d.ts +26 -9
- package/lib/victory-portal/victory-portal.js +99 -27
- package/lib/victory-primitives/arc.d.ts +14 -14
- package/lib/victory-primitives/background.d.ts +13 -13
- package/lib/victory-primitives/border.d.ts +10 -10
- package/lib/victory-primitives/circle.d.ts +3 -3
- package/lib/victory-primitives/clip-path.d.ts +7 -7
- package/lib/victory-primitives/index.d.ts +14 -14
- package/lib/victory-primitives/line-segment.d.ts +11 -11
- package/lib/victory-primitives/line.d.ts +3 -3
- package/lib/victory-primitives/path.d.ts +3 -3
- package/lib/victory-primitives/point.d.ts +13 -13
- package/lib/victory-primitives/rect.d.ts +3 -3
- package/lib/victory-primitives/text.d.ts +8 -8
- package/lib/victory-primitives/tspan.d.ts +3 -3
- package/lib/victory-primitives/types.d.ts +7 -7
- package/lib/victory-primitives/whisker.d.ts +15 -15
- package/lib/victory-theme/grayscale.d.ts +2 -2
- package/lib/victory-theme/material.d.ts +2 -2
- package/lib/victory-theme/types.d.ts +238 -238
- package/lib/victory-theme/victory-theme.d.ts +5 -5
- package/lib/victory-transition/victory-transition.d.ts +53 -53
- package/lib/victory-util/add-events.d.ts +126 -126
- package/lib/victory-util/add-events.js +6 -6
- package/lib/victory-util/axis.d.ts +50 -50
- package/lib/victory-util/axis.js +13 -7
- package/lib/victory-util/collection.d.ts +15 -8
- package/lib/victory-util/collection.js +18 -0
- package/lib/victory-util/common-props.d.ts +79 -79
- package/lib/victory-util/data.d.ts +74 -74
- package/lib/victory-util/default-transitions.d.ts +4 -4
- package/lib/victory-util/domain.d.ts +90 -90
- package/lib/victory-util/events.d.ts +64 -64
- package/lib/victory-util/helpers.d.ts +96 -91
- package/lib/victory-util/helpers.js +13 -0
- package/lib/victory-util/hooks/index.d.ts +2 -2
- package/lib/victory-util/hooks/use-animation-state.d.ts +21 -21
- package/lib/victory-util/hooks/use-previous-props.d.ts +1 -1
- package/lib/victory-util/immutable.d.ts +11 -11
- package/lib/victory-util/index.d.ts +26 -27
- package/lib/victory-util/index.js +0 -14
- package/lib/victory-util/label-helpers.d.ts +26 -26
- package/lib/victory-util/line-helpers.d.ts +4 -4
- package/lib/victory-util/log.d.ts +1 -1
- package/lib/victory-util/point-path-helpers.d.ts +9 -9
- package/lib/victory-util/scale.d.ts +9 -9
- package/lib/victory-util/selection.d.ts +28 -28
- package/lib/victory-util/style.d.ts +18 -18
- package/lib/victory-util/textsize.d.ts +35 -35
- package/lib/victory-util/timer-context.d.ts +11 -11
- package/lib/victory-util/timer.d.ts +16 -16
- package/lib/victory-util/transitions.d.ts +48 -48
- package/lib/victory-util/type-helpers.d.ts +9 -9
- package/lib/victory-util/user-props.d.ts +26 -26
- package/lib/victory-util/wrapper.d.ts +33 -37
- package/lib/victory-util/wrapper.js +2 -2
- package/package.json +6 -3
- package/src/types/prop-types.ts +0 -7
- package/src/victory-container/victory-container.tsx +195 -173
- package/src/victory-portal/portal-context.ts +4 -5
- package/src/victory-portal/portal.tsx +42 -5
- package/src/victory-portal/victory-portal.tsx +71 -34
- package/src/victory-util/add-events.tsx +6 -4
- package/src/victory-util/axis.tsx +12 -3
- package/src/victory-util/collection.tsx +13 -0
- package/src/victory-util/helpers.ts +11 -0
- package/src/victory-util/index.ts +0 -1
- package/src/victory-util/wrapper.tsx +1 -0
- package/dist/victory-core.min.js.LICENSE.txt +0 -19
- package/es/victory-util/merge-refs.d.ts +0 -5
- package/es/victory-util/merge-refs.js +0 -11
- package/lib/victory-util/merge-refs.d.ts +0 -5
- package/lib/victory-util/merge-refs.js +0 -18
- package/src/victory-util/merge-refs.ts +0 -13
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { BlockProps } from "../victory-theme/victory-theme";
|
|
3
|
-
import { OriginType } from "../victory-label/victory-label";
|
|
4
|
-
export interface VictoryClipContainerProps {
|
|
5
|
-
"aria-label"?: string;
|
|
6
|
-
children?: React.ReactElement | React.ReactElement[];
|
|
7
|
-
circleComponent?: React.ReactElement;
|
|
8
|
-
className?: string;
|
|
9
|
-
clipHeight?: number;
|
|
10
|
-
clipId?: number | string;
|
|
11
|
-
clipPadding?: BlockProps;
|
|
12
|
-
clipPathComponent?: React.ReactElement;
|
|
13
|
-
clipWidth?: number;
|
|
14
|
-
events?: React.DOMAttributes<any>;
|
|
15
|
-
groupComponent?: React.ReactElement;
|
|
16
|
-
origin?: OriginType;
|
|
17
|
-
polar?: boolean;
|
|
18
|
-
radius?: number;
|
|
19
|
-
rectComponent?: React.ReactElement;
|
|
20
|
-
translateX?: number;
|
|
21
|
-
translateY?: number;
|
|
22
|
-
}
|
|
23
|
-
export declare class VictoryClipContainer extends React.Component<VictoryClipContainerProps> {
|
|
24
|
-
static displayName: string;
|
|
25
|
-
static role: string;
|
|
26
|
-
static defaultProps: {
|
|
27
|
-
circleComponent: JSX.Element;
|
|
28
|
-
rectComponent: JSX.Element;
|
|
29
|
-
clipPathComponent: JSX.Element;
|
|
30
|
-
groupComponent: JSX.Element;
|
|
31
|
-
};
|
|
32
|
-
clipId: VictoryClipContainerProps["clipId"];
|
|
33
|
-
constructor(props: VictoryClipContainerProps);
|
|
34
|
-
calculateAttributes(props: any): {
|
|
35
|
-
x: number;
|
|
36
|
-
y: number;
|
|
37
|
-
width: number;
|
|
38
|
-
height: number;
|
|
39
|
-
};
|
|
40
|
-
renderClippedGroup(props: any, clipId: any): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
41
|
-
renderGroup(props: any): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
42
|
-
renderClipComponent(props: any, clipId: any): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
43
|
-
getClipValue(props: any, axis: any): any;
|
|
44
|
-
getTranslateValue(props: any, axis: any): any;
|
|
45
|
-
render(): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
46
|
-
}
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BlockProps } from "../victory-theme/victory-theme";
|
|
3
|
+
import { OriginType } from "../victory-label/victory-label";
|
|
4
|
+
export interface VictoryClipContainerProps {
|
|
5
|
+
"aria-label"?: string;
|
|
6
|
+
children?: React.ReactElement | React.ReactElement[];
|
|
7
|
+
circleComponent?: React.ReactElement;
|
|
8
|
+
className?: string;
|
|
9
|
+
clipHeight?: number;
|
|
10
|
+
clipId?: number | string;
|
|
11
|
+
clipPadding?: BlockProps;
|
|
12
|
+
clipPathComponent?: React.ReactElement;
|
|
13
|
+
clipWidth?: number;
|
|
14
|
+
events?: React.DOMAttributes<any>;
|
|
15
|
+
groupComponent?: React.ReactElement;
|
|
16
|
+
origin?: OriginType;
|
|
17
|
+
polar?: boolean;
|
|
18
|
+
radius?: number;
|
|
19
|
+
rectComponent?: React.ReactElement;
|
|
20
|
+
translateX?: number;
|
|
21
|
+
translateY?: number;
|
|
22
|
+
}
|
|
23
|
+
export declare class VictoryClipContainer extends React.Component<VictoryClipContainerProps> {
|
|
24
|
+
static displayName: string;
|
|
25
|
+
static role: string;
|
|
26
|
+
static defaultProps: {
|
|
27
|
+
circleComponent: JSX.Element;
|
|
28
|
+
rectComponent: JSX.Element;
|
|
29
|
+
clipPathComponent: JSX.Element;
|
|
30
|
+
groupComponent: JSX.Element;
|
|
31
|
+
};
|
|
32
|
+
clipId: VictoryClipContainerProps["clipId"];
|
|
33
|
+
constructor(props: VictoryClipContainerProps);
|
|
34
|
+
calculateAttributes(props: any): {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
width: number;
|
|
38
|
+
height: number;
|
|
39
|
+
};
|
|
40
|
+
renderClippedGroup(props: any, clipId: any): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
41
|
+
renderGroup(props: any): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
42
|
+
renderClipComponent(props: any, clipId: any): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
43
|
+
getClipValue(props: any, axis: any): any;
|
|
44
|
+
getTranslateValue(props: any, axis: any): any;
|
|
45
|
+
render(): React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
46
|
+
}
|
|
47
47
|
//# sourceMappingURL=victory-clip-container.d.ts.map
|
|
@@ -1,65 +1,69 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { OriginType } from "../victory-label/victory-label";
|
|
3
|
-
import { D3Scale } from "../types/prop-types";
|
|
4
|
-
import { VictoryThemeDefinition } from "../victory-theme/types";
|
|
5
|
-
export interface VictoryContainerProps {
|
|
6
|
-
"aria-describedby"?: string;
|
|
7
|
-
"aria-labelledby"?: string;
|
|
8
|
-
children?: React.ReactElement | React.ReactElement[];
|
|
9
|
-
className?: string;
|
|
10
|
-
containerId?: number | string;
|
|
11
|
-
containerRef?: React.Ref<HTMLElement>;
|
|
12
|
-
desc?: string;
|
|
13
|
-
events?: React.DOMAttributes<any>;
|
|
14
|
-
height?: number;
|
|
15
|
-
name?: string;
|
|
16
|
-
origin?: OriginType;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
export declare
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
(
|
|
63
|
-
|
|
64
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { OriginType } from "../victory-label/victory-label";
|
|
3
|
+
import { D3Scale } from "../types/prop-types";
|
|
4
|
+
import { VictoryThemeDefinition } from "../victory-theme/types";
|
|
5
|
+
export interface VictoryContainerProps {
|
|
6
|
+
"aria-describedby"?: string;
|
|
7
|
+
"aria-labelledby"?: string;
|
|
8
|
+
children?: React.ReactElement | React.ReactElement[];
|
|
9
|
+
className?: string;
|
|
10
|
+
containerId?: number | string;
|
|
11
|
+
containerRef?: React.Ref<HTMLElement>;
|
|
12
|
+
desc?: string;
|
|
13
|
+
events?: React.DOMAttributes<any>;
|
|
14
|
+
height?: number;
|
|
15
|
+
name?: string;
|
|
16
|
+
origin?: OriginType;
|
|
17
|
+
ouiaId?: number | string;
|
|
18
|
+
ouiaSafe?: boolean;
|
|
19
|
+
ouiaType?: string;
|
|
20
|
+
polar?: boolean;
|
|
21
|
+
portalComponent?: React.ReactElement;
|
|
22
|
+
portalZIndex?: number;
|
|
23
|
+
preserveAspectRatio?: string;
|
|
24
|
+
responsive?: boolean;
|
|
25
|
+
role?: string;
|
|
26
|
+
scale?: {
|
|
27
|
+
x?: D3Scale;
|
|
28
|
+
y?: D3Scale;
|
|
29
|
+
};
|
|
30
|
+
style?: React.CSSProperties;
|
|
31
|
+
tabIndex?: number;
|
|
32
|
+
theme?: VictoryThemeDefinition;
|
|
33
|
+
title?: string;
|
|
34
|
+
width?: number;
|
|
35
|
+
}
|
|
36
|
+
export declare class VictoryContainer<TProps extends VictoryContainerProps> extends React.Component<TProps> {
|
|
37
|
+
static displayName: string;
|
|
38
|
+
static role: string;
|
|
39
|
+
static defaultProps: {
|
|
40
|
+
className: string;
|
|
41
|
+
portalComponent: JSX.Element;
|
|
42
|
+
portalZIndex: number;
|
|
43
|
+
responsive: boolean;
|
|
44
|
+
role: string;
|
|
45
|
+
};
|
|
46
|
+
static contextType: React.Context<{
|
|
47
|
+
transitionTimer: import("..").Timer;
|
|
48
|
+
animationTimer: import("..").Timer;
|
|
49
|
+
}>;
|
|
50
|
+
private containerId;
|
|
51
|
+
private portalRef;
|
|
52
|
+
private containerRef;
|
|
53
|
+
private shouldHandleWheel;
|
|
54
|
+
constructor(props: TProps);
|
|
55
|
+
savePortalRef: (portal: any) => any;
|
|
56
|
+
portalUpdate: (key: any, el: any) => void;
|
|
57
|
+
portalRegister: () => number;
|
|
58
|
+
portalDeregister: (key: any) => void;
|
|
59
|
+
saveContainerRef: (container: HTMLElement) => HTMLElement;
|
|
60
|
+
handleWheel: (e: any) => any;
|
|
61
|
+
componentDidMount(): void;
|
|
62
|
+
componentWillUnmount(): void;
|
|
63
|
+
getIdForElement(elementName: any): string;
|
|
64
|
+
getChildren(props: any): any;
|
|
65
|
+
getOUIAProps(props: any): any;
|
|
66
|
+
renderContainer(props: any, svgProps: any, style: any): JSX.Element;
|
|
67
|
+
render(): JSX.Element;
|
|
68
|
+
}
|
|
65
69
|
//# sourceMappingURL=victory-container.d.ts.map
|
|
@@ -1,186 +1,238 @@
|
|
|
1
|
+
import _isObject from "lodash/isObject";
|
|
1
2
|
import _uniqueId from "lodash/uniqueId";
|
|
3
|
+
import _defaults from "lodash/defaults";
|
|
2
4
|
|
|
3
5
|
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); }
|
|
4
6
|
|
|
5
|
-
function
|
|
7
|
+
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
8
|
|
|
7
|
-
function
|
|
9
|
+
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; }
|
|
8
10
|
|
|
9
|
-
function
|
|
11
|
+
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; }
|
|
10
12
|
|
|
11
|
-
function
|
|
13
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
14
|
|
|
13
|
-
function
|
|
15
|
+
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); } }
|
|
14
16
|
|
|
15
|
-
function
|
|
17
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
16
18
|
|
|
17
|
-
function
|
|
19
|
+
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); }
|
|
18
20
|
|
|
19
|
-
function
|
|
21
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
20
22
|
|
|
21
|
-
function
|
|
23
|
+
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); }; }
|
|
24
|
+
|
|
25
|
+
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); }
|
|
26
|
+
|
|
27
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
28
|
+
|
|
29
|
+
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; } }
|
|
30
|
+
|
|
31
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
32
|
|
|
23
|
-
import React
|
|
33
|
+
import React from "react";
|
|
24
34
|
import { Portal } from "../victory-portal/portal";
|
|
25
35
|
import { PortalContext } from "../victory-portal/portal-context";
|
|
36
|
+
import TimerContext from "../victory-util/timer-context";
|
|
37
|
+
import * as Helpers from "../victory-util/helpers";
|
|
26
38
|
import * as UserProps from "../victory-util/user-props";
|
|
27
|
-
|
|
28
|
-
|
|
39
|
+
export var VictoryContainer = /*#__PURE__*/function (_React$Component) {
|
|
40
|
+
_inherits(VictoryContainer, _React$Component);
|
|
41
|
+
|
|
42
|
+
var _super = _createSuper(VictoryContainer);
|
|
43
|
+
|
|
44
|
+
// @ts-expect-error Ref will be initialized on mount
|
|
45
|
+
// @ts-expect-error Ref will be initialized on mount
|
|
46
|
+
function VictoryContainer(props) {
|
|
47
|
+
var _this;
|
|
48
|
+
|
|
49
|
+
_classCallCheck(this, VictoryContainer);
|
|
50
|
+
|
|
51
|
+
_this = _super.call(this, props);
|
|
52
|
+
_this.containerId = void 0;
|
|
53
|
+
_this.portalRef = void 0;
|
|
54
|
+
_this.containerRef = void 0;
|
|
55
|
+
_this.shouldHandleWheel = void 0;
|
|
56
|
+
|
|
57
|
+
_this.savePortalRef = function (portal) {
|
|
58
|
+
_this.portalRef = portal;
|
|
59
|
+
return portal;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
_this.portalUpdate = function (key, el) {
|
|
63
|
+
return _this.portalRef.portalUpdate(key, el);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
_this.portalRegister = function () {
|
|
67
|
+
return _this.portalRef.portalRegister();
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
_this.portalDeregister = function (key) {
|
|
71
|
+
return _this.portalRef.portalDeregister(key);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
_this.saveContainerRef = function (container) {
|
|
75
|
+
if (Helpers.isFunction(_this.props.containerRef)) {
|
|
76
|
+
_this.props.containerRef(container);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
_this.containerRef = container;
|
|
80
|
+
return container;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
_this.handleWheel = function (e) {
|
|
84
|
+
return e.preventDefault();
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
_this.containerId = !_isObject(props) || props.containerId === undefined ? _uniqueId("victory-container-") : props.containerId;
|
|
88
|
+
_this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
|
|
89
|
+
return _this;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
_createClass(VictoryContainer, [{
|
|
93
|
+
key: "componentDidMount",
|
|
94
|
+
value: function componentDidMount() {
|
|
95
|
+
if (this.shouldHandleWheel && this.containerRef) {
|
|
96
|
+
this.containerRef.addEventListener("wheel", this.handleWheel);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
key: "componentWillUnmount",
|
|
101
|
+
value: function componentWillUnmount() {
|
|
102
|
+
if (this.shouldHandleWheel && this.containerRef) {
|
|
103
|
+
this.containerRef.removeEventListener("wheel", this.handleWheel);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}, {
|
|
107
|
+
key: "getIdForElement",
|
|
108
|
+
value: function getIdForElement(elementName) {
|
|
109
|
+
return "".concat(this.containerId, "-").concat(elementName);
|
|
110
|
+
} // overridden in custom containers
|
|
111
|
+
|
|
112
|
+
}, {
|
|
113
|
+
key: "getChildren",
|
|
114
|
+
value: function getChildren(props) {
|
|
115
|
+
return props.children;
|
|
116
|
+
} // Get props defined by the Open UI Automation (OUIA) 1.0-RC spec
|
|
117
|
+
// See https://ouia.readthedocs.io/en/latest/README.html#ouia-component
|
|
118
|
+
|
|
119
|
+
}, {
|
|
120
|
+
key: "getOUIAProps",
|
|
121
|
+
value: function getOUIAProps(props) {
|
|
122
|
+
var ouiaId = props.ouiaId,
|
|
123
|
+
ouiaSafe = props.ouiaSafe,
|
|
124
|
+
ouiaType = props.ouiaType;
|
|
125
|
+
return _objectSpread(_objectSpread(_objectSpread({}, ouiaId && {
|
|
126
|
+
"data-ouia-component-id": ouiaId
|
|
127
|
+
}), ouiaType && {
|
|
128
|
+
"data-ouia-component-type": ouiaType
|
|
129
|
+
}), ouiaSafe !== undefined && {
|
|
130
|
+
"data-ouia-safe": ouiaSafe
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}, {
|
|
134
|
+
key: "renderContainer",
|
|
135
|
+
value: function renderContainer(props, svgProps, style) {
|
|
136
|
+
var title = props.title,
|
|
137
|
+
desc = props.desc,
|
|
138
|
+
portalComponent = props.portalComponent,
|
|
139
|
+
className = props.className,
|
|
140
|
+
width = props.width,
|
|
141
|
+
height = props.height,
|
|
142
|
+
portalZIndex = props.portalZIndex,
|
|
143
|
+
responsive = props.responsive;
|
|
144
|
+
var children = this.getChildren(props);
|
|
145
|
+
var dimensions = responsive ? {
|
|
146
|
+
width: "100%",
|
|
147
|
+
height: "100%"
|
|
148
|
+
} : {
|
|
149
|
+
width: width,
|
|
150
|
+
height: height
|
|
151
|
+
};
|
|
152
|
+
var divStyle = Object.assign({
|
|
153
|
+
pointerEvents: "none",
|
|
154
|
+
touchAction: "none",
|
|
155
|
+
position: "relative"
|
|
156
|
+
}, dimensions);
|
|
157
|
+
var portalDivStyle = Object.assign({
|
|
158
|
+
zIndex: portalZIndex,
|
|
159
|
+
position: "absolute",
|
|
160
|
+
top: 0,
|
|
161
|
+
left: 0
|
|
162
|
+
}, dimensions);
|
|
163
|
+
var svgStyle = Object.assign({
|
|
164
|
+
pointerEvents: "all"
|
|
165
|
+
}, dimensions);
|
|
166
|
+
var portalSvgStyle = Object.assign({
|
|
167
|
+
overflow: "visible"
|
|
168
|
+
}, dimensions);
|
|
169
|
+
var portalProps = {
|
|
170
|
+
width: width,
|
|
171
|
+
height: height,
|
|
172
|
+
viewBox: svgProps.viewBox,
|
|
173
|
+
preserveAspectRatio: svgProps.preserveAspectRatio,
|
|
174
|
+
style: portalSvgStyle
|
|
175
|
+
};
|
|
176
|
+
return /*#__PURE__*/React.createElement(PortalContext.Provider, {
|
|
177
|
+
value: {
|
|
178
|
+
portalUpdate: this.portalUpdate,
|
|
179
|
+
portalRegister: this.portalRegister,
|
|
180
|
+
portalDeregister: this.portalDeregister
|
|
181
|
+
}
|
|
182
|
+
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
183
|
+
style: _defaults({}, style, divStyle),
|
|
184
|
+
className: className,
|
|
185
|
+
ref: this.saveContainerRef
|
|
186
|
+
}, this.getOUIAProps(props)), /*#__PURE__*/React.createElement("svg", _extends({}, svgProps, {
|
|
187
|
+
style: svgStyle
|
|
188
|
+
}), title ? /*#__PURE__*/React.createElement("title", {
|
|
189
|
+
id: this.getIdForElement("title")
|
|
190
|
+
}, title) : null, desc ? /*#__PURE__*/React.createElement("desc", {
|
|
191
|
+
id: this.getIdForElement("desc")
|
|
192
|
+
}, desc) : null, children), /*#__PURE__*/React.createElement("div", {
|
|
193
|
+
style: portalDivStyle
|
|
194
|
+
}, /*#__PURE__*/React.cloneElement(portalComponent, _objectSpread(_objectSpread({}, portalProps), {}, {
|
|
195
|
+
ref: this.savePortalRef
|
|
196
|
+
})))));
|
|
197
|
+
}
|
|
198
|
+
}, {
|
|
199
|
+
key: "render",
|
|
200
|
+
value: function render() {
|
|
201
|
+
var _this$props = this.props,
|
|
202
|
+
width = _this$props.width,
|
|
203
|
+
height = _this$props.height,
|
|
204
|
+
responsive = _this$props.responsive,
|
|
205
|
+
events = _this$props.events,
|
|
206
|
+
title = _this$props.title,
|
|
207
|
+
desc = _this$props.desc,
|
|
208
|
+
tabIndex = _this$props.tabIndex,
|
|
209
|
+
preserveAspectRatio = _this$props.preserveAspectRatio,
|
|
210
|
+
role = _this$props.role;
|
|
211
|
+
var style = responsive ? this.props.style : Helpers.omit(this.props.style, ["height", "width"]);
|
|
212
|
+
var userProps = UserProps.getSafeUserProps(this.props);
|
|
213
|
+
var svgProps = Object.assign(_objectSpread({
|
|
214
|
+
width: width,
|
|
215
|
+
height: height,
|
|
216
|
+
tabIndex: tabIndex,
|
|
217
|
+
role: role,
|
|
218
|
+
"aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
|
|
219
|
+
"aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
|
|
220
|
+
viewBox: responsive ? "0 0 ".concat(width, " ").concat(height) : undefined,
|
|
221
|
+
preserveAspectRatio: responsive ? preserveAspectRatio : undefined
|
|
222
|
+
}, userProps), events);
|
|
223
|
+
return this.renderContainer(this.props, svgProps, style);
|
|
224
|
+
}
|
|
225
|
+
}]);
|
|
226
|
+
|
|
227
|
+
return VictoryContainer;
|
|
228
|
+
}(React.Component);
|
|
229
|
+
VictoryContainer.displayName = "VictoryContainer";
|
|
230
|
+
VictoryContainer.role = "container";
|
|
231
|
+
VictoryContainer.defaultProps = {
|
|
29
232
|
className: "VictoryContainer",
|
|
30
233
|
portalComponent: /*#__PURE__*/React.createElement(Portal, null),
|
|
31
234
|
portalZIndex: 99,
|
|
32
235
|
responsive: true,
|
|
33
236
|
role: "img"
|
|
34
237
|
};
|
|
35
|
-
|
|
36
|
-
var props = _objectSpread(_objectSpread({}, defaultProps), initialProps);
|
|
37
|
-
|
|
38
|
-
var title = props.title,
|
|
39
|
-
desc = props.desc,
|
|
40
|
-
width = props.width,
|
|
41
|
-
height = props.height,
|
|
42
|
-
responsive = props.responsive;
|
|
43
|
-
var localContainerRef = useRef(null);
|
|
44
|
-
|
|
45
|
-
var _React$useState = React.useState(),
|
|
46
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
47
|
-
portalElement = _React$useState2[0],
|
|
48
|
-
setPortalElement = _React$useState2[1];
|
|
49
|
-
|
|
50
|
-
var portalRef = function (element) {
|
|
51
|
-
return setPortalElement(element);
|
|
52
|
-
}; // Generated ID stored in ref because it needs to persist across renders
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
var generatedId = useRef(_uniqueId("victory-container-"));
|
|
56
|
-
var containerId = props.containerId ?? generatedId.current;
|
|
57
|
-
|
|
58
|
-
var getIdForElement = function (elName) {
|
|
59
|
-
return "".concat(containerId, "-").concat(elName);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
var userProps = UserProps.getSafeUserProps(props);
|
|
63
|
-
var dimensions = responsive ? {
|
|
64
|
-
width: "100%",
|
|
65
|
-
height: "100%"
|
|
66
|
-
} : {
|
|
67
|
-
width: width,
|
|
68
|
-
height: height
|
|
69
|
-
};
|
|
70
|
-
var viewBox = responsive ? "0 0 ".concat(width, " ").concat(height) : undefined;
|
|
71
|
-
var preserveAspectRatio = responsive ? props.preserveAspectRatio : undefined;
|
|
72
|
-
var ariaLabelledBy = [title && getIdForElement("title"), props["aria-labelledby"]].filter(Boolean).join(" ") || undefined;
|
|
73
|
-
var ariaDescribedBy = [desc && getIdForElement("desc"), props["aria-describedby"]].filter(Boolean).join(" ") || undefined;
|
|
74
|
-
var titleId = getIdForElement("title");
|
|
75
|
-
var descId = getIdForElement("desc");
|
|
76
|
-
return _objectSpread(_objectSpread({}, props), {}, {
|
|
77
|
-
titleId: titleId,
|
|
78
|
-
descId: descId,
|
|
79
|
-
dimensions: dimensions,
|
|
80
|
-
viewBox: viewBox,
|
|
81
|
-
preserveAspectRatio: preserveAspectRatio,
|
|
82
|
-
ariaLabelledBy: ariaLabelledBy,
|
|
83
|
-
ariaDescribedBy: ariaDescribedBy,
|
|
84
|
-
userProps: userProps,
|
|
85
|
-
portalRef: portalRef,
|
|
86
|
-
portalElement: portalElement,
|
|
87
|
-
localContainerRef: localContainerRef
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
export var VictoryContainer = function (initialProps) {
|
|
91
|
-
var _useVictoryContainer = useVictoryContainer(initialProps),
|
|
92
|
-
role = _useVictoryContainer.role,
|
|
93
|
-
title = _useVictoryContainer.title,
|
|
94
|
-
desc = _useVictoryContainer.desc,
|
|
95
|
-
children = _useVictoryContainer.children,
|
|
96
|
-
className = _useVictoryContainer.className,
|
|
97
|
-
portalZIndex = _useVictoryContainer.portalZIndex,
|
|
98
|
-
portalComponent = _useVictoryContainer.portalComponent,
|
|
99
|
-
width = _useVictoryContainer.width,
|
|
100
|
-
height = _useVictoryContainer.height,
|
|
101
|
-
style = _useVictoryContainer.style,
|
|
102
|
-
tabIndex = _useVictoryContainer.tabIndex,
|
|
103
|
-
responsive = _useVictoryContainer.responsive,
|
|
104
|
-
events = _useVictoryContainer.events,
|
|
105
|
-
ouiaId = _useVictoryContainer.ouiaId,
|
|
106
|
-
ouiaSafe = _useVictoryContainer.ouiaSafe,
|
|
107
|
-
ouiaType = _useVictoryContainer.ouiaType,
|
|
108
|
-
dimensions = _useVictoryContainer.dimensions,
|
|
109
|
-
ariaDescribedBy = _useVictoryContainer.ariaDescribedBy,
|
|
110
|
-
ariaLabelledBy = _useVictoryContainer.ariaLabelledBy,
|
|
111
|
-
viewBox = _useVictoryContainer.viewBox,
|
|
112
|
-
preserveAspectRatio = _useVictoryContainer.preserveAspectRatio,
|
|
113
|
-
userProps = _useVictoryContainer.userProps,
|
|
114
|
-
titleId = _useVictoryContainer.titleId,
|
|
115
|
-
descId = _useVictoryContainer.descId,
|
|
116
|
-
portalElement = _useVictoryContainer.portalElement,
|
|
117
|
-
portalRef = _useVictoryContainer.portalRef,
|
|
118
|
-
containerRef = _useVictoryContainer.containerRef,
|
|
119
|
-
localContainerRef = _useVictoryContainer.localContainerRef;
|
|
120
|
-
|
|
121
|
-
React.useEffect(function () {
|
|
122
|
-
// TODO check that this works
|
|
123
|
-
if (!(events !== null && events !== void 0 && events.onWheel)) return;
|
|
124
|
-
|
|
125
|
-
var handleWheel = function (e) {
|
|
126
|
-
return e.preventDefault();
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
var container = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current;
|
|
130
|
-
container === null || container === void 0 ? void 0 : container.addEventListener("wheel", handleWheel);
|
|
131
|
-
return function () {
|
|
132
|
-
container === null || container === void 0 ? void 0 : container.removeEventListener("wheel", handleWheel);
|
|
133
|
-
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
134
|
-
}, []);
|
|
135
|
-
return /*#__PURE__*/React.createElement(PortalContext.Provider, {
|
|
136
|
-
value: {
|
|
137
|
-
portalElement: portalElement
|
|
138
|
-
}
|
|
139
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
140
|
-
className: className,
|
|
141
|
-
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
142
|
-
width: responsive ? style === null || style === void 0 ? void 0 : style.width : dimensions.width,
|
|
143
|
-
height: responsive ? style === null || style === void 0 ? void 0 : style.height : dimensions.height,
|
|
144
|
-
pointerEvents: "none",
|
|
145
|
-
touchAction: "none",
|
|
146
|
-
position: "relative"
|
|
147
|
-
}),
|
|
148
|
-
"data-ouia-component-id": ouiaId,
|
|
149
|
-
"data-ouia-component-type": ouiaType,
|
|
150
|
-
"data-ouia-safe": ouiaSafe,
|
|
151
|
-
ref: mergeRefs([localContainerRef, containerRef])
|
|
152
|
-
}, /*#__PURE__*/React.createElement("svg", _extends({
|
|
153
|
-
width: width,
|
|
154
|
-
height: height,
|
|
155
|
-
tabIndex: tabIndex,
|
|
156
|
-
role: role,
|
|
157
|
-
"aria-labelledby": ariaLabelledBy,
|
|
158
|
-
"aria-describedby": ariaDescribedBy,
|
|
159
|
-
viewBox: viewBox,
|
|
160
|
-
preserveAspectRatio: preserveAspectRatio,
|
|
161
|
-
style: _objectSpread(_objectSpread({}, dimensions), {}, {
|
|
162
|
-
pointerEvents: "all"
|
|
163
|
-
})
|
|
164
|
-
}, userProps, events), title ? /*#__PURE__*/React.createElement("title", {
|
|
165
|
-
id: titleId
|
|
166
|
-
}, title) : null, desc ? /*#__PURE__*/React.createElement("desc", {
|
|
167
|
-
id: descId
|
|
168
|
-
}, desc) : null, children), /*#__PURE__*/React.createElement("div", {
|
|
169
|
-
style: _objectSpread(_objectSpread({}, dimensions), {}, {
|
|
170
|
-
zIndex: portalZIndex,
|
|
171
|
-
position: "absolute",
|
|
172
|
-
top: 0,
|
|
173
|
-
left: 0
|
|
174
|
-
})
|
|
175
|
-
}, /*#__PURE__*/React.cloneElement(portalComponent, {
|
|
176
|
-
width: width,
|
|
177
|
-
height: height,
|
|
178
|
-
viewBox: viewBox,
|
|
179
|
-
preserveAspectRatio: preserveAspectRatio,
|
|
180
|
-
style: _objectSpread(_objectSpread({}, dimensions), {}, {
|
|
181
|
-
overflow: "visible"
|
|
182
|
-
}),
|
|
183
|
-
ref: portalRef
|
|
184
|
-
}))));
|
|
185
|
-
};
|
|
186
|
-
VictoryContainer.role = "container";
|
|
238
|
+
VictoryContainer.contextType = TimerContext;
|