victory-core 37.0.2 → 37.0.3-next.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/CHANGELOG.md +7 -0
- package/dist/victory-core.js +390 -350
- package/dist/victory-core.min.js +1 -1
- package/es/index.d.ts +18 -17
- package/es/index.js +2 -1
- package/es/types/callbacks.d.ts +36 -36
- package/es/types/prop-types.d.ts +130 -129
- 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 +62 -68
- package/es/victory-container/victory-container.js +134 -162
- package/es/victory-label/victory-label.d.ts +58 -58
- package/es/victory-portal/portal-context.d.ts +12 -11
- package/es/victory-portal/portal-context.js +37 -6
- package/es/victory-portal/portal-outlet.d.ts +12 -0
- package/es/victory-portal/portal-outlet.js +16 -0
- package/es/victory-portal/portal.d.ts +9 -20
- package/es/victory-portal/portal.js +6 -32
- package/es/victory-portal/victory-portal.d.ts +9 -26
- package/es/victory-portal/victory-portal.js +27 -44
- 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/axis.d.ts +50 -50
- package/es/victory-util/collection.d.ts +15 -15
- 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 -96
- 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 +27 -26
- package/es/victory-util/index.js +1 -0
- 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/merge-refs.d.ts +13 -0
- package/es/victory-util/merge-refs.js +23 -0
- 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 -33
- package/lib/index.d.ts +18 -17
- package/lib/index.js +16 -4
- package/lib/types/callbacks.d.ts +36 -36
- package/lib/types/prop-types.d.ts +130 -129
- 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 +62 -68
- package/lib/victory-container/victory-container.js +136 -163
- package/lib/victory-label/victory-label.d.ts +58 -58
- package/lib/victory-portal/portal-context.d.ts +12 -11
- package/lib/victory-portal/portal-context.js +40 -7
- package/lib/victory-portal/portal-outlet.d.ts +12 -0
- package/lib/victory-portal/portal-outlet.js +24 -0
- package/lib/victory-portal/portal.d.ts +9 -20
- package/lib/victory-portal/portal.js +6 -33
- package/lib/victory-portal/victory-portal.d.ts +9 -26
- package/lib/victory-portal/victory-portal.js +27 -44
- 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/axis.d.ts +50 -50
- package/lib/victory-util/collection.d.ts +15 -15
- 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 -96
- 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 +27 -26
- package/lib/victory-util/index.js +12 -0
- 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/merge-refs.d.ts +13 -0
- package/lib/victory-util/merge-refs.js +31 -0
- 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 -33
- package/package.json +2 -5
- package/src/index.ts +2 -1
- package/src/types/prop-types.ts +7 -0
- package/src/victory-container/victory-container.tsx +168 -196
- package/src/victory-portal/portal-context.tsx +69 -0
- package/src/victory-portal/portal-outlet.tsx +25 -0
- package/src/victory-portal/portal.tsx +5 -42
- package/src/victory-portal/victory-portal.tsx +34 -64
- package/src/victory-util/index.ts +1 -0
- package/src/victory-util/merge-refs.ts +26 -0
- package/src/victory-portal/portal-context.ts +0 -14
|
@@ -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,69 +1,63 @@
|
|
|
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
|
-
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
|
-
}
|
|
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
|
+
polar?: boolean;
|
|
18
|
+
portalComponent?: React.ReactElement;
|
|
19
|
+
portalZIndex?: number;
|
|
20
|
+
preserveAspectRatio?: string;
|
|
21
|
+
responsive?: boolean;
|
|
22
|
+
role?: string;
|
|
23
|
+
scale?: {
|
|
24
|
+
x?: D3Scale;
|
|
25
|
+
y?: D3Scale;
|
|
26
|
+
};
|
|
27
|
+
style?: React.CSSProperties;
|
|
28
|
+
tabIndex?: number;
|
|
29
|
+
theme?: VictoryThemeDefinition;
|
|
30
|
+
title?: string;
|
|
31
|
+
width?: number;
|
|
32
|
+
ouiaId?: number | string;
|
|
33
|
+
ouiaSafe?: boolean;
|
|
34
|
+
ouiaType?: string;
|
|
35
|
+
}
|
|
36
|
+
export declare function useVictoryContainer<TProps extends VictoryContainerProps>(initialProps: TProps): {
|
|
37
|
+
className: string;
|
|
38
|
+
portalComponent: JSX.Element;
|
|
39
|
+
portalZIndex: number;
|
|
40
|
+
responsive: boolean;
|
|
41
|
+
role: string;
|
|
42
|
+
} & TProps & {
|
|
43
|
+
titleId: string;
|
|
44
|
+
descId: string;
|
|
45
|
+
dimensions: {
|
|
46
|
+
width: string;
|
|
47
|
+
height: string;
|
|
48
|
+
} | {
|
|
49
|
+
width: number | undefined;
|
|
50
|
+
height: number | undefined;
|
|
51
|
+
};
|
|
52
|
+
viewBox: string | undefined;
|
|
53
|
+
preserveAspectRatio: string | undefined;
|
|
54
|
+
ariaLabelledBy: string | undefined;
|
|
55
|
+
ariaDescribedBy: string | undefined;
|
|
56
|
+
userProps: Record<string, string>;
|
|
57
|
+
localContainerRef: React.RefObject<HTMLDivElement>;
|
|
58
|
+
};
|
|
59
|
+
export declare const VictoryContainer: {
|
|
60
|
+
(initialProps: VictoryContainerProps): JSX.Element;
|
|
61
|
+
role: string;
|
|
62
|
+
};
|
|
69
63
|
//# sourceMappingURL=victory-container.d.ts.map
|
|
@@ -1,179 +1,151 @@
|
|
|
1
|
-
import _isObject from "lodash/isObject";
|
|
2
1
|
import _uniqueId from "lodash/uniqueId";
|
|
3
|
-
import _defaults from "lodash/defaults";
|
|
4
2
|
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); }
|
|
5
|
-
import React from "react";
|
|
3
|
+
import React, { useRef } from "react";
|
|
6
4
|
import { Portal } from "../victory-portal/portal";
|
|
7
|
-
import { PortalContext } from "../victory-portal/portal-context";
|
|
8
|
-
import TimerContext from "../victory-util/timer-context";
|
|
9
|
-
import * as Helpers from "../victory-util/helpers";
|
|
10
5
|
import * as UserProps from "../victory-util/user-props";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
import { mergeRefs } from "../victory-util";
|
|
7
|
+
import { PortalOutlet } from "../victory-portal/portal-outlet";
|
|
8
|
+
import { PortalProvider } from "../victory-portal/portal-context";
|
|
9
|
+
const defaultProps = {
|
|
10
|
+
className: "VictoryContainer",
|
|
11
|
+
portalComponent: /*#__PURE__*/React.createElement(Portal, null),
|
|
12
|
+
portalZIndex: 99,
|
|
13
|
+
responsive: true,
|
|
14
|
+
role: "img"
|
|
15
|
+
};
|
|
16
|
+
export function useVictoryContainer(initialProps) {
|
|
17
|
+
const props = {
|
|
18
|
+
...defaultProps,
|
|
19
|
+
...initialProps
|
|
20
20
|
};
|
|
21
|
-
|
|
21
|
+
const {
|
|
22
|
+
title,
|
|
23
|
+
desc,
|
|
24
|
+
width,
|
|
25
|
+
height,
|
|
26
|
+
responsive
|
|
27
|
+
} = props;
|
|
28
|
+
const localContainerRef = useRef(null);
|
|
22
29
|
|
|
23
|
-
//
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return portal;
|
|
30
|
+
// Generated ID stored in ref because it needs to persist across renders
|
|
31
|
+
const generatedId = useRef(_uniqueId("victory-container-"));
|
|
32
|
+
const containerId = props.containerId ?? generatedId.current;
|
|
33
|
+
const getIdForElement = elName => `${containerId}-${elName}`;
|
|
34
|
+
const userProps = UserProps.getSafeUserProps(props);
|
|
35
|
+
const dimensions = responsive ? {
|
|
36
|
+
width: "100%",
|
|
37
|
+
height: "100%"
|
|
38
|
+
} : {
|
|
39
|
+
width,
|
|
40
|
+
height
|
|
35
41
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
const viewBox = responsive ? `0 0 ${width} ${height}` : undefined;
|
|
43
|
+
const preserveAspectRatio = responsive ? props.preserveAspectRatio : undefined;
|
|
44
|
+
const ariaLabelledBy = [title && getIdForElement("title"), props["aria-labelledby"]].filter(Boolean).join(" ") || undefined;
|
|
45
|
+
const ariaDescribedBy = [desc && getIdForElement("desc"), props["aria-describedby"]].filter(Boolean).join(" ") || undefined;
|
|
46
|
+
const titleId = getIdForElement("title");
|
|
47
|
+
const descId = getIdForElement("desc");
|
|
48
|
+
return {
|
|
49
|
+
...props,
|
|
50
|
+
titleId,
|
|
51
|
+
descId,
|
|
52
|
+
dimensions,
|
|
53
|
+
viewBox,
|
|
54
|
+
preserveAspectRatio,
|
|
55
|
+
ariaLabelledBy,
|
|
56
|
+
ariaDescribedBy,
|
|
57
|
+
userProps,
|
|
58
|
+
localContainerRef
|
|
45
59
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
})
|
|
60
|
+
}
|
|
61
|
+
export const VictoryContainer = initialProps => {
|
|
62
|
+
const {
|
|
63
|
+
role,
|
|
64
|
+
title,
|
|
65
|
+
desc,
|
|
66
|
+
children,
|
|
67
|
+
className,
|
|
68
|
+
portalZIndex,
|
|
69
|
+
portalComponent,
|
|
70
|
+
width,
|
|
71
|
+
height,
|
|
72
|
+
style,
|
|
73
|
+
tabIndex,
|
|
74
|
+
responsive,
|
|
75
|
+
events,
|
|
76
|
+
ouiaId,
|
|
77
|
+
ouiaSafe,
|
|
78
|
+
ouiaType,
|
|
79
|
+
dimensions,
|
|
80
|
+
ariaDescribedBy,
|
|
81
|
+
ariaLabelledBy,
|
|
82
|
+
viewBox,
|
|
83
|
+
preserveAspectRatio,
|
|
84
|
+
userProps,
|
|
85
|
+
titleId,
|
|
86
|
+
descId,
|
|
87
|
+
containerRef,
|
|
88
|
+
localContainerRef
|
|
89
|
+
} = useVictoryContainer(initialProps);
|
|
90
|
+
React.useEffect(() => {
|
|
91
|
+
if (!events?.onWheel) return;
|
|
92
|
+
const handleWheel = e => e.preventDefault();
|
|
93
|
+
const container = localContainerRef?.current;
|
|
94
|
+
container?.addEventListener("wheel", handleWheel);
|
|
95
|
+
return () => {
|
|
96
|
+
container?.removeEventListener("wheel", handleWheel);
|
|
84
97
|
};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
height,
|
|
94
|
-
portalZIndex,
|
|
95
|
-
responsive
|
|
96
|
-
} = props;
|
|
97
|
-
const children = this.getChildren(props);
|
|
98
|
-
const dimensions = responsive ? {
|
|
99
|
-
width: "100%",
|
|
100
|
-
height: "100%"
|
|
101
|
-
} : {
|
|
102
|
-
width,
|
|
103
|
-
height
|
|
104
|
-
};
|
|
105
|
-
const divStyle = Object.assign({
|
|
98
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
99
|
+
}, []);
|
|
100
|
+
return /*#__PURE__*/React.createElement(PortalProvider, null, /*#__PURE__*/React.createElement("div", {
|
|
101
|
+
className: className,
|
|
102
|
+
style: {
|
|
103
|
+
...style,
|
|
104
|
+
width: responsive ? style?.width : dimensions.width,
|
|
105
|
+
height: responsive ? style?.height : dimensions.height,
|
|
106
106
|
pointerEvents: "none",
|
|
107
107
|
touchAction: "none",
|
|
108
108
|
position: "relative"
|
|
109
|
-
},
|
|
110
|
-
|
|
109
|
+
},
|
|
110
|
+
"data-ouia-component-id": ouiaId,
|
|
111
|
+
"data-ouia-component-type": ouiaType,
|
|
112
|
+
"data-ouia-safe": ouiaSafe,
|
|
113
|
+
ref: mergeRefs([localContainerRef, containerRef])
|
|
114
|
+
}, /*#__PURE__*/React.createElement("svg", _extends({
|
|
115
|
+
width: width,
|
|
116
|
+
height: height,
|
|
117
|
+
tabIndex: tabIndex,
|
|
118
|
+
role: role,
|
|
119
|
+
"aria-labelledby": ariaLabelledBy,
|
|
120
|
+
"aria-describedby": ariaDescribedBy,
|
|
121
|
+
viewBox: viewBox,
|
|
122
|
+
preserveAspectRatio: preserveAspectRatio,
|
|
123
|
+
style: {
|
|
124
|
+
...dimensions,
|
|
125
|
+
pointerEvents: "all"
|
|
126
|
+
}
|
|
127
|
+
}, userProps, events), title ? /*#__PURE__*/React.createElement("title", {
|
|
128
|
+
id: titleId
|
|
129
|
+
}, title) : null, desc ? /*#__PURE__*/React.createElement("desc", {
|
|
130
|
+
id: descId
|
|
131
|
+
}, desc) : null, children), /*#__PURE__*/React.createElement("div", {
|
|
132
|
+
style: {
|
|
133
|
+
...dimensions,
|
|
111
134
|
zIndex: portalZIndex,
|
|
112
135
|
position: "absolute",
|
|
113
136
|
top: 0,
|
|
114
137
|
left: 0
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
138
|
+
}
|
|
139
|
+
}, /*#__PURE__*/React.createElement(PortalOutlet, {
|
|
140
|
+
as: portalComponent,
|
|
141
|
+
width: width,
|
|
142
|
+
height: height,
|
|
143
|
+
viewBox: viewBox,
|
|
144
|
+
preserveAspectRatio: preserveAspectRatio,
|
|
145
|
+
style: {
|
|
146
|
+
...dimensions,
|
|
120
147
|
overflow: "visible"
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
viewBox: svgProps.viewBox,
|
|
126
|
-
preserveAspectRatio: svgProps.preserveAspectRatio,
|
|
127
|
-
style: portalSvgStyle
|
|
128
|
-
};
|
|
129
|
-
return /*#__PURE__*/React.createElement(PortalContext.Provider, {
|
|
130
|
-
value: {
|
|
131
|
-
portalUpdate: this.portalUpdate,
|
|
132
|
-
portalRegister: this.portalRegister,
|
|
133
|
-
portalDeregister: this.portalDeregister
|
|
134
|
-
}
|
|
135
|
-
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
136
|
-
style: _defaults({}, style, divStyle),
|
|
137
|
-
className: className,
|
|
138
|
-
ref: this.saveContainerRef
|
|
139
|
-
}, this.getOUIAProps(props)), /*#__PURE__*/React.createElement("svg", _extends({}, svgProps, {
|
|
140
|
-
style: svgStyle
|
|
141
|
-
}), title ? /*#__PURE__*/React.createElement("title", {
|
|
142
|
-
id: this.getIdForElement("title")
|
|
143
|
-
}, title) : null, desc ? /*#__PURE__*/React.createElement("desc", {
|
|
144
|
-
id: this.getIdForElement("desc")
|
|
145
|
-
}, desc) : null, children), /*#__PURE__*/React.createElement("div", {
|
|
146
|
-
style: portalDivStyle
|
|
147
|
-
}, /*#__PURE__*/React.cloneElement(portalComponent, {
|
|
148
|
-
...portalProps,
|
|
149
|
-
ref: this.savePortalRef
|
|
150
|
-
}))));
|
|
151
|
-
}
|
|
152
|
-
render() {
|
|
153
|
-
const {
|
|
154
|
-
width,
|
|
155
|
-
height,
|
|
156
|
-
responsive,
|
|
157
|
-
events,
|
|
158
|
-
title,
|
|
159
|
-
desc,
|
|
160
|
-
tabIndex,
|
|
161
|
-
preserveAspectRatio,
|
|
162
|
-
role
|
|
163
|
-
} = this.props;
|
|
164
|
-
const style = responsive ? this.props.style : Helpers.omit(this.props.style, ["height", "width"]);
|
|
165
|
-
const userProps = UserProps.getSafeUserProps(this.props);
|
|
166
|
-
const svgProps = Object.assign({
|
|
167
|
-
width,
|
|
168
|
-
height,
|
|
169
|
-
tabIndex,
|
|
170
|
-
role,
|
|
171
|
-
"aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
|
|
172
|
-
"aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
|
|
173
|
-
viewBox: responsive ? `0 0 ${width} ${height}` : undefined,
|
|
174
|
-
preserveAspectRatio: responsive ? preserveAspectRatio : undefined,
|
|
175
|
-
...userProps
|
|
176
|
-
}, events);
|
|
177
|
-
return this.renderContainer(this.props, svgProps, style);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
148
|
+
}
|
|
149
|
+
}))));
|
|
150
|
+
};
|
|
151
|
+
VictoryContainer.role = "container";
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { NumberOrCallback, StringOrCallback, StringOrNumberOrCallback } from "../types/callbacks";
|
|
3
|
-
import { ValueOrAccessor } from "../types/prop-types";
|
|
4
|
-
import { PaddingProps, VerticalAnchorType, VictoryLabelStyleObject } from "../victory-theme/victory-theme";
|
|
5
|
-
export declare type TextAnchorType = "start" | "middle" | "end" | "inherit";
|
|
6
|
-
export declare type OriginType = {
|
|
7
|
-
x: number;
|
|
8
|
-
y: number;
|
|
9
|
-
};
|
|
10
|
-
export declare type LabelOrientationType = "parallel" | "perpendicular" | "vertical";
|
|
11
|
-
export interface VictoryLabelProps {
|
|
12
|
-
angle?: StringOrNumberOrCallback;
|
|
13
|
-
ariaLabel?: StringOrCallback;
|
|
14
|
-
backgroundComponent?: React.ReactElement;
|
|
15
|
-
backgroundStyle?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
16
|
-
backgroundPadding?: PaddingProps | PaddingProps[];
|
|
17
|
-
capHeight?: StringOrNumberOrCallback;
|
|
18
|
-
children?: StringOrNumberOrCallback;
|
|
19
|
-
className?: string;
|
|
20
|
-
datum?: Record<string, any>;
|
|
21
|
-
data?: any[];
|
|
22
|
-
desc?: string;
|
|
23
|
-
direction?: string;
|
|
24
|
-
disableInlineStyles?: boolean;
|
|
25
|
-
events?: React.DOMAttributes<any>;
|
|
26
|
-
groupComponent?: React.ReactElement;
|
|
27
|
-
id?: StringOrNumberOrCallback;
|
|
28
|
-
inline?: boolean;
|
|
29
|
-
labelPlacement?: LabelOrientationType;
|
|
30
|
-
lineHeight?: StringOrNumberOrCallback | (string | number)[];
|
|
31
|
-
origin?: OriginType;
|
|
32
|
-
polar?: boolean;
|
|
33
|
-
renderInPortal?: boolean;
|
|
34
|
-
style?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
35
|
-
tabIndex?: NumberOrCallback;
|
|
36
|
-
text?: string[] | StringOrNumberOrCallback;
|
|
37
|
-
textComponent?: React.ReactElement;
|
|
38
|
-
textAnchor?: ValueOrAccessor<TextAnchorType>;
|
|
39
|
-
title?: string;
|
|
40
|
-
transform?: ValueOrAccessor<string | object>;
|
|
41
|
-
tspanComponent?: React.ReactElement;
|
|
42
|
-
verticalAnchor?: ValueOrAccessor<VerticalAnchorType>;
|
|
43
|
-
x?: number;
|
|
44
|
-
y?: number;
|
|
45
|
-
dx?: StringOrNumberOrCallback;
|
|
46
|
-
dy?: StringOrNumberOrCallback;
|
|
47
|
-
}
|
|
48
|
-
declare const defaultStyles: {
|
|
49
|
-
fill: string;
|
|
50
|
-
fontSize: number;
|
|
51
|
-
fontFamily: string;
|
|
52
|
-
stroke: string;
|
|
53
|
-
};
|
|
54
|
-
export declare const VictoryLabel: {
|
|
55
|
-
role: string;
|
|
56
|
-
defaultStyles: typeof defaultStyles;
|
|
57
|
-
} & React.FC<VictoryLabelProps>;
|
|
58
|
-
export {};
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NumberOrCallback, StringOrCallback, StringOrNumberOrCallback } from "../types/callbacks";
|
|
3
|
+
import { ValueOrAccessor } from "../types/prop-types";
|
|
4
|
+
import { PaddingProps, VerticalAnchorType, VictoryLabelStyleObject } from "../victory-theme/victory-theme";
|
|
5
|
+
export declare type TextAnchorType = "start" | "middle" | "end" | "inherit";
|
|
6
|
+
export declare type OriginType = {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
};
|
|
10
|
+
export declare type LabelOrientationType = "parallel" | "perpendicular" | "vertical";
|
|
11
|
+
export interface VictoryLabelProps {
|
|
12
|
+
angle?: StringOrNumberOrCallback;
|
|
13
|
+
ariaLabel?: StringOrCallback;
|
|
14
|
+
backgroundComponent?: React.ReactElement;
|
|
15
|
+
backgroundStyle?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
16
|
+
backgroundPadding?: PaddingProps | PaddingProps[];
|
|
17
|
+
capHeight?: StringOrNumberOrCallback;
|
|
18
|
+
children?: StringOrNumberOrCallback;
|
|
19
|
+
className?: string;
|
|
20
|
+
datum?: Record<string, any>;
|
|
21
|
+
data?: any[];
|
|
22
|
+
desc?: string;
|
|
23
|
+
direction?: string;
|
|
24
|
+
disableInlineStyles?: boolean;
|
|
25
|
+
events?: React.DOMAttributes<any>;
|
|
26
|
+
groupComponent?: React.ReactElement;
|
|
27
|
+
id?: StringOrNumberOrCallback;
|
|
28
|
+
inline?: boolean;
|
|
29
|
+
labelPlacement?: LabelOrientationType;
|
|
30
|
+
lineHeight?: StringOrNumberOrCallback | (string | number)[];
|
|
31
|
+
origin?: OriginType;
|
|
32
|
+
polar?: boolean;
|
|
33
|
+
renderInPortal?: boolean;
|
|
34
|
+
style?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
35
|
+
tabIndex?: NumberOrCallback;
|
|
36
|
+
text?: string[] | StringOrNumberOrCallback;
|
|
37
|
+
textComponent?: React.ReactElement;
|
|
38
|
+
textAnchor?: ValueOrAccessor<TextAnchorType>;
|
|
39
|
+
title?: string;
|
|
40
|
+
transform?: ValueOrAccessor<string | object>;
|
|
41
|
+
tspanComponent?: React.ReactElement;
|
|
42
|
+
verticalAnchor?: ValueOrAccessor<VerticalAnchorType>;
|
|
43
|
+
x?: number;
|
|
44
|
+
y?: number;
|
|
45
|
+
dx?: StringOrNumberOrCallback;
|
|
46
|
+
dy?: StringOrNumberOrCallback;
|
|
47
|
+
}
|
|
48
|
+
declare const defaultStyles: {
|
|
49
|
+
fill: string;
|
|
50
|
+
fontSize: number;
|
|
51
|
+
fontFamily: string;
|
|
52
|
+
stroke: string;
|
|
53
|
+
};
|
|
54
|
+
export declare const VictoryLabel: {
|
|
55
|
+
role: string;
|
|
56
|
+
defaultStyles: typeof defaultStyles;
|
|
57
|
+
} & React.FC<VictoryLabelProps>;
|
|
58
|
+
export {};
|
|
59
59
|
//# sourceMappingURL=victory-label.d.ts.map
|