victory-core 36.4.1 → 36.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/victory-core.js +874 -879
- package/dist/victory-core.min.js +1 -1
- package/es/index.d.ts +38 -941
- package/es/index.js +19 -28
- package/es/types.d.ts +33 -0
- package/es/types.js +1 -0
- package/es/victory-accessible-group/victory-accessible-group.d.ts +25 -0
- package/es/victory-accessible-group/victory-accessible-group.js +8 -16
- package/es/victory-animation/util.d.ts +66 -0
- package/es/victory-animation/util.js +2 -1
- package/es/victory-animation/victory-animation.d.ts +69 -0
- package/es/victory-animation/victory-animation.js +59 -67
- package/es/victory-clip-container/victory-clip-container.d.ts +76 -0
- package/es/victory-clip-container/victory-clip-container.js +15 -21
- package/es/victory-container/victory-container.d.ts +99 -0
- package/es/victory-container/victory-container.js +31 -31
- package/es/victory-label/victory-label.d.ts +61 -0
- package/es/victory-label/victory-label.js +13 -8
- package/es/victory-portal/portal-context.d.ts +11 -0
- package/es/victory-portal/portal-context.js +3 -4
- package/es/victory-portal/portal.d.ts +28 -0
- package/es/victory-portal/portal.js +25 -33
- package/es/victory-portal/victory-portal.d.ts +31 -0
- package/es/victory-portal/victory-portal.js +23 -22
- package/es/victory-primitives/arc.d.ts +21 -0
- package/es/victory-primitives/arc.js +3 -5
- package/es/victory-primitives/background.d.ts +22 -0
- package/es/victory-primitives/background.js +4 -6
- package/es/victory-primitives/border.d.ts +18 -0
- package/es/victory-primitives/border.js +3 -5
- package/es/victory-primitives/circle.d.ts +2 -0
- package/es/victory-primitives/circle.js +11 -8
- package/es/victory-primitives/clip-path.d.ts +14 -0
- package/es/victory-primitives/clip-path.js +6 -6
- package/es/victory-primitives/index.d.ts +14 -0
- package/es/victory-primitives/index.js +14 -0
- package/es/victory-primitives/line-segment.d.ts +19 -0
- package/es/victory-primitives/line-segment.js +3 -5
- package/es/victory-primitives/line.d.ts +2 -0
- package/es/victory-primitives/line.js +11 -8
- package/es/victory-primitives/path.d.ts +2 -0
- package/es/victory-primitives/path.js +9 -6
- package/es/victory-primitives/point.d.ts +21 -0
- package/es/victory-primitives/point.js +9 -19
- package/es/victory-primitives/rect.d.ts +2 -0
- package/es/victory-primitives/rect.js +11 -8
- package/es/victory-primitives/text.d.ts +16 -0
- package/es/victory-primitives/text.js +7 -6
- package/es/victory-primitives/tspan.d.ts +2 -0
- package/es/victory-primitives/tspan.js +7 -6
- package/es/victory-primitives/types.d.ts +7 -0
- package/es/victory-primitives/types.js +1 -0
- package/es/victory-primitives/whisker.d.ts +24 -0
- package/es/victory-primitives/whisker.js +3 -5
- package/es/victory-theme/grayscale.d.ts +2 -0
- package/es/victory-theme/grayscale.js +1 -1
- package/es/victory-theme/material.d.ts +2 -0
- package/es/victory-theme/material.js +1 -1
- package/es/victory-theme/victory-theme-definition.d.ts +244 -0
- package/es/victory-theme/victory-theme-definition.js +1 -0
- package/es/victory-theme/victory-theme.d.ts +5 -0
- package/es/victory-theme/victory-theme.js +6 -5
- package/es/victory-transition/victory-transition.d.ts +59 -0
- package/es/victory-transition/victory-transition.js +19 -23
- package/es/victory-util/add-events.js +6 -3
- package/es/victory-util/axis.js +0 -1
- package/es/victory-util/collection.js +0 -2
- package/es/victory-util/data.js +0 -2
- package/es/victory-util/default-transitions.js +0 -1
- package/es/victory-util/domain.js +0 -2
- package/es/victory-util/helpers.js +0 -2
- package/es/victory-util/immutable.js +0 -1
- package/es/victory-util/label-helpers.js +0 -2
- package/es/victory-util/log.js +0 -1
- package/es/victory-util/point-path-helpers.d.ts +9 -0
- package/es/victory-util/point-path-helpers.js +59 -61
- package/es/victory-util/selection.d.ts +23 -0
- package/es/victory-util/selection.js +0 -2
- package/es/victory-util/style.js +0 -2
- package/es/victory-util/textsize.d.ts +8 -0
- package/es/victory-util/timer-context.d.ts +11 -0
- package/es/victory-util/timer.d.ts +16 -0
- package/es/victory-util/timer.js +13 -8
- package/es/victory-util/types.d.ts +188 -0
- package/es/victory-util/types.js +1 -0
- package/lib/index.d.ts +38 -941
- package/lib/index.js +195 -193
- package/lib/types.d.ts +33 -0
- package/lib/types.js +1 -0
- package/lib/victory-accessible-group/victory-accessible-group.d.ts +25 -0
- package/lib/victory-accessible-group/victory-accessible-group.js +9 -15
- package/lib/victory-animation/util.d.ts +66 -0
- package/lib/victory-animation/util.js +2 -1
- package/lib/victory-animation/victory-animation.d.ts +69 -0
- package/lib/victory-animation/victory-animation.js +60 -65
- package/lib/victory-clip-container/victory-clip-container.d.ts +76 -0
- package/lib/victory-clip-container/victory-clip-container.js +19 -22
- package/lib/victory-container/victory-container.d.ts +99 -0
- package/lib/victory-container/victory-container.js +34 -31
- package/lib/victory-label/victory-label.d.ts +61 -0
- package/lib/victory-label/victory-label.js +19 -13
- package/lib/victory-portal/portal-context.d.ts +11 -0
- package/lib/victory-portal/portal-context.js +3 -4
- package/lib/victory-portal/portal.d.ts +28 -0
- package/lib/victory-portal/portal.js +26 -31
- package/lib/victory-portal/victory-portal.d.ts +31 -0
- package/lib/victory-portal/victory-portal.js +24 -20
- package/lib/victory-primitives/arc.d.ts +21 -0
- package/lib/victory-primitives/arc.js +5 -6
- package/lib/victory-primitives/background.d.ts +22 -0
- package/lib/victory-primitives/background.js +7 -8
- package/lib/victory-primitives/border.d.ts +18 -0
- package/lib/victory-primitives/border.js +5 -6
- package/lib/victory-primitives/circle.d.ts +2 -0
- package/lib/victory-primitives/circle.js +11 -6
- package/lib/victory-primitives/clip-path.d.ts +14 -0
- package/lib/victory-primitives/clip-path.js +7 -5
- package/lib/victory-primitives/index.d.ts +14 -0
- package/lib/victory-primitives/index.js +187 -0
- package/lib/victory-primitives/line-segment.d.ts +19 -0
- package/lib/victory-primitives/line-segment.js +5 -6
- package/lib/victory-primitives/line.d.ts +2 -0
- package/lib/victory-primitives/line.js +11 -6
- package/lib/victory-primitives/path.d.ts +2 -0
- package/lib/victory-primitives/path.js +9 -4
- package/lib/victory-primitives/point.d.ts +21 -0
- package/lib/victory-primitives/point.js +13 -21
- package/lib/victory-primitives/rect.d.ts +2 -0
- package/lib/victory-primitives/rect.js +11 -6
- package/lib/victory-primitives/text.d.ts +16 -0
- package/lib/victory-primitives/text.js +8 -5
- package/lib/victory-primitives/tspan.d.ts +2 -0
- package/lib/victory-primitives/tspan.js +7 -4
- package/lib/victory-primitives/types.d.ts +7 -0
- package/lib/victory-primitives/types.js +1 -0
- package/lib/victory-primitives/whisker.d.ts +24 -0
- package/lib/victory-primitives/whisker.js +5 -6
- package/lib/victory-theme/grayscale.d.ts +2 -0
- package/lib/victory-theme/grayscale.js +3 -3
- package/lib/victory-theme/material.d.ts +2 -0
- package/lib/victory-theme/material.js +3 -3
- package/lib/victory-theme/victory-theme-definition.d.ts +244 -0
- package/lib/victory-theme/victory-theme-definition.js +1 -0
- package/lib/victory-theme/victory-theme.d.ts +5 -0
- package/lib/victory-theme/victory-theme.js +22 -8
- package/lib/victory-transition/victory-transition.d.ts +59 -0
- package/lib/victory-transition/victory-transition.js +21 -23
- package/lib/victory-util/add-events.js +8 -4
- package/lib/victory-util/collection.js +0 -2
- package/lib/victory-util/default-transitions.js +0 -1
- package/lib/victory-util/helpers.js +0 -2
- package/lib/victory-util/immutable.js +0 -2
- package/lib/victory-util/label-helpers.js +0 -2
- package/lib/victory-util/log.js +0 -1
- package/lib/victory-util/point-path-helpers.d.ts +9 -0
- package/lib/victory-util/point-path-helpers.js +86 -73
- package/lib/victory-util/selection.d.ts +23 -0
- package/lib/victory-util/selection.js +0 -2
- package/lib/victory-util/style.js +0 -2
- package/lib/victory-util/textsize.d.ts +8 -0
- package/lib/victory-util/timer-context.d.ts +11 -0
- package/lib/victory-util/timer.d.ts +16 -0
- package/lib/victory-util/timer.js +13 -8
- package/lib/victory-util/types.d.ts +188 -0
- package/lib/victory-util/types.js +1 -0
- package/package.json +4 -4
- package/src/index.ts +42 -0
- package/src/types.ts +45 -0
- package/src/victory-accessible-group/{victory-accessible-group.js → victory-accessible-group.tsx} +10 -3
- package/src/victory-animation/{util.js → util.ts} +4 -3
- package/src/victory-animation/{victory-animation.js → victory-animation.tsx} +89 -12
- package/src/victory-clip-container/{victory-clip-container.js → victory-clip-container.tsx} +29 -5
- package/src/victory-container/{victory-container.js → victory-container.tsx} +70 -26
- package/src/victory-label/{victory-label.js → victory-label.tsx} +71 -14
- package/src/victory-portal/portal-context.ts +14 -0
- package/src/victory-portal/{portal.js → portal.tsx} +23 -12
- package/src/victory-portal/{victory-portal.js → victory-portal.tsx} +21 -6
- package/src/victory-primitives/{arc.js → arc.tsx} +15 -5
- package/src/victory-primitives/{background.js → background.tsx} +17 -7
- package/src/victory-primitives/{border.js → border.tsx} +12 -5
- package/src/victory-primitives/{circle.js → circle.tsx} +4 -3
- package/src/victory-primitives/clip-path.tsx +25 -0
- package/src/victory-primitives/index.ts +14 -0
- package/src/victory-primitives/{line-segment.js → line-segment.tsx} +13 -5
- package/src/victory-primitives/{line.js → line.tsx} +4 -3
- package/src/victory-primitives/{path.js → path.tsx} +4 -3
- package/src/victory-primitives/{point.js → point.tsx} +25 -20
- package/src/victory-primitives/{rect.js → rect.tsx} +4 -2
- package/src/victory-primitives/{text.js → text.tsx} +9 -3
- package/src/victory-primitives/tspan.tsx +7 -0
- package/src/victory-primitives/types.ts +19 -0
- package/src/victory-primitives/{whisker.js → whisker.tsx} +20 -7
- package/src/victory-theme/{grayscale.js → grayscale.tsx} +2 -1
- package/src/victory-theme/{material.js → material.tsx} +2 -1
- package/src/victory-theme/victory-theme-definition.ts +261 -0
- package/src/victory-theme/victory-theme.tsx +5 -0
- package/src/victory-transition/{victory-transition.js → victory-transition.tsx} +68 -19
- package/src/victory-util/add-events.js +6 -1
- package/src/victory-util/axis.js +0 -1
- package/src/victory-util/collection.js +0 -1
- package/src/victory-util/data.js +0 -1
- package/src/victory-util/default-transitions.js +0 -1
- package/src/victory-util/domain.js +0 -1
- package/src/victory-util/events.js +1 -1
- package/src/victory-util/helpers.js +0 -1
- package/src/victory-util/immutable.js +0 -1
- package/src/victory-util/label-helpers.js +0 -1
- package/src/victory-util/log.js +0 -1
- package/src/victory-util/point-path-helpers.ts +119 -0
- package/src/victory-util/prop-types.js +0 -1
- package/src/victory-util/scale.js +0 -1
- package/src/victory-util/selection.d.ts +23 -0
- package/src/victory-util/selection.js +0 -1
- package/src/victory-util/style.js +0 -1
- package/src/victory-util/textsize.d.ts +8 -0
- package/src/victory-util/{timer-context.js → timer-context.ts} +0 -0
- package/src/victory-util/{timer.js → timer.ts} +19 -4
- package/src/victory-util/transitions.js +0 -1
- package/src/victory-util/types.ts +247 -0
- package/src/victory-util/wrapper.js +0 -1
- package/src/index.d.ts +0 -941
- package/src/index.js +0 -51
- package/src/victory-portal/portal-context.js +0 -10
- package/src/victory-primitives/clip-path.js +0 -18
- package/src/victory-primitives/tspan.js +0 -5
- package/src/victory-theme/victory-theme.js +0 -7
- package/src/victory-util/point-path-helpers.js +0 -121
|
@@ -19,6 +19,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
19
19
|
|
|
20
20
|
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; }
|
|
21
21
|
|
|
22
|
+
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; }
|
|
23
|
+
|
|
22
24
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
23
25
|
|
|
24
26
|
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); } }
|
|
@@ -27,7 +29,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
27
29
|
|
|
28
30
|
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); }
|
|
29
31
|
|
|
30
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
32
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
31
33
|
|
|
32
34
|
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); }; }
|
|
33
35
|
|
|
@@ -37,20 +39,17 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
37
39
|
|
|
38
40
|
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; } }
|
|
39
41
|
|
|
40
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
41
|
-
|
|
42
|
-
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; }
|
|
42
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
43
43
|
|
|
44
44
|
import React from "react";
|
|
45
45
|
import PropTypes from "prop-types";
|
|
46
46
|
import * as CustomPropTypes from "../victory-util/prop-types";
|
|
47
47
|
import * as Helpers from "../victory-util/helpers";
|
|
48
48
|
import * as UserProps from "../victory-util/user-props";
|
|
49
|
-
import ClipPath from "../victory-primitives/clip-path";
|
|
50
|
-
import Circle from "../victory-primitives/circle";
|
|
51
|
-
import Rect from "../victory-primitives/rect";
|
|
52
|
-
|
|
53
|
-
var VictoryClipContainer = /*#__PURE__*/function (_React$Component) {
|
|
49
|
+
import { ClipPath } from "../victory-primitives/clip-path";
|
|
50
|
+
import { Circle } from "../victory-primitives/circle";
|
|
51
|
+
import { Rect } from "../victory-primitives/rect";
|
|
52
|
+
export var VictoryClipContainer = /*#__PURE__*/function (_React$Component) {
|
|
54
53
|
_inherits(VictoryClipContainer, _React$Component);
|
|
55
54
|
|
|
56
55
|
var _super = _createSuper(VictoryClipContainer);
|
|
@@ -61,6 +60,7 @@ var VictoryClipContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
61
60
|
_classCallCheck(this, VictoryClipContainer);
|
|
62
61
|
|
|
63
62
|
_this = _super.call(this, props);
|
|
63
|
+
_this.clipId = void 0;
|
|
64
64
|
_this.clipId = !_isObject(props) || props.clipId === undefined ? _uniqueId("victory-clip-") : props.clipId;
|
|
65
65
|
return _this;
|
|
66
66
|
}
|
|
@@ -239,12 +239,9 @@ var VictoryClipContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
239
239
|
|
|
240
240
|
return VictoryClipContainer;
|
|
241
241
|
}(React.Component);
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
_defineProperty(VictoryClipContainer, "role", "container");
|
|
246
|
-
|
|
247
|
-
_defineProperty(VictoryClipContainer, "propTypes", {
|
|
242
|
+
VictoryClipContainer.displayName = "VictoryClipContainer";
|
|
243
|
+
VictoryClipContainer.role = "container";
|
|
244
|
+
VictoryClipContainer.propTypes = {
|
|
248
245
|
"aria-label": PropTypes.string,
|
|
249
246
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
|
|
250
247
|
circleComponent: PropTypes.element,
|
|
@@ -272,13 +269,10 @@ _defineProperty(VictoryClipContainer, "propTypes", {
|
|
|
272
269
|
transform: PropTypes.string,
|
|
273
270
|
translateX: PropTypes.number,
|
|
274
271
|
translateY: PropTypes.number
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
_defineProperty(VictoryClipContainer, "defaultProps", {
|
|
272
|
+
};
|
|
273
|
+
VictoryClipContainer.defaultProps = {
|
|
278
274
|
circleComponent: /*#__PURE__*/React.createElement(Circle, null),
|
|
279
275
|
rectComponent: /*#__PURE__*/React.createElement(Rect, null),
|
|
280
276
|
clipPathComponent: /*#__PURE__*/React.createElement(ClipPath, null),
|
|
281
277
|
groupComponent: /*#__PURE__*/React.createElement("g", null)
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
export { VictoryClipContainer as default };
|
|
278
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import { OriginType } from "../victory-label/victory-label";
|
|
4
|
+
import { D3Scale } from "../victory-util/types";
|
|
5
|
+
import { VictoryThemeDefinition } from "../victory-theme/victory-theme-definition";
|
|
6
|
+
export interface VictoryContainerProps {
|
|
7
|
+
"aria-describedby"?: string;
|
|
8
|
+
"aria-labelledby"?: string;
|
|
9
|
+
children?: React.ReactElement | React.ReactElement[];
|
|
10
|
+
className?: string;
|
|
11
|
+
containerId?: number | string;
|
|
12
|
+
containerRef?: React.Ref<HTMLElement>;
|
|
13
|
+
desc?: string;
|
|
14
|
+
events?: React.DOMAttributes<any>;
|
|
15
|
+
height?: number;
|
|
16
|
+
name?: string;
|
|
17
|
+
origin?: OriginType;
|
|
18
|
+
ouiaId?: number | string;
|
|
19
|
+
ouiaSafe?: boolean;
|
|
20
|
+
ouiaType?: string;
|
|
21
|
+
polar?: boolean;
|
|
22
|
+
portalComponent?: React.ReactElement;
|
|
23
|
+
portalZIndex?: number;
|
|
24
|
+
preserveAspectRatio?: string;
|
|
25
|
+
responsive?: boolean;
|
|
26
|
+
role?: string;
|
|
27
|
+
scale?: {
|
|
28
|
+
x?: D3Scale;
|
|
29
|
+
y?: D3Scale;
|
|
30
|
+
};
|
|
31
|
+
style?: React.CSSProperties;
|
|
32
|
+
tabIndex?: number;
|
|
33
|
+
theme?: VictoryThemeDefinition;
|
|
34
|
+
title?: string;
|
|
35
|
+
width?: number;
|
|
36
|
+
}
|
|
37
|
+
export declare class VictoryContainer extends React.Component<VictoryContainerProps> {
|
|
38
|
+
static displayName: string;
|
|
39
|
+
static role: string;
|
|
40
|
+
static propTypes: {
|
|
41
|
+
"aria-describedby": PropTypes.Requireable<string>;
|
|
42
|
+
"aria-labelledby": PropTypes.Requireable<string>;
|
|
43
|
+
children: PropTypes.Requireable<string | number | boolean | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
|
|
44
|
+
className: PropTypes.Requireable<string>;
|
|
45
|
+
containerId: PropTypes.Requireable<string | number>;
|
|
46
|
+
containerRef: PropTypes.Requireable<(...args: any[]) => any>;
|
|
47
|
+
desc: PropTypes.Requireable<string>;
|
|
48
|
+
events: PropTypes.Requireable<object>;
|
|
49
|
+
height: any;
|
|
50
|
+
name: PropTypes.Requireable<string>;
|
|
51
|
+
origin: PropTypes.Requireable<PropTypes.InferProps<{
|
|
52
|
+
x: any;
|
|
53
|
+
y: any;
|
|
54
|
+
}>>;
|
|
55
|
+
ouiaId: PropTypes.Requireable<string | number>;
|
|
56
|
+
ouiaSafe: PropTypes.Requireable<boolean>;
|
|
57
|
+
ouiaType: PropTypes.Requireable<string>;
|
|
58
|
+
polar: PropTypes.Requireable<boolean>;
|
|
59
|
+
portalComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
60
|
+
portalZIndex: any;
|
|
61
|
+
preserveAspectRatio: PropTypes.Requireable<string>;
|
|
62
|
+
responsive: PropTypes.Requireable<boolean>;
|
|
63
|
+
role: PropTypes.Requireable<string>;
|
|
64
|
+
style: PropTypes.Requireable<object>;
|
|
65
|
+
tabIndex: PropTypes.Requireable<number>;
|
|
66
|
+
theme: PropTypes.Requireable<object>;
|
|
67
|
+
title: PropTypes.Requireable<string>;
|
|
68
|
+
width: any;
|
|
69
|
+
};
|
|
70
|
+
static defaultProps: {
|
|
71
|
+
className: string;
|
|
72
|
+
portalComponent: JSX.Element;
|
|
73
|
+
portalZIndex: number;
|
|
74
|
+
responsive: boolean;
|
|
75
|
+
role: string;
|
|
76
|
+
};
|
|
77
|
+
static contextType: React.Context<{
|
|
78
|
+
transitionTimer: import("..").Timer;
|
|
79
|
+
animationTimer: import("..").Timer;
|
|
80
|
+
}>;
|
|
81
|
+
private containerId;
|
|
82
|
+
private portalRef;
|
|
83
|
+
private containerRef;
|
|
84
|
+
private shouldHandleWheel;
|
|
85
|
+
constructor(props: VictoryContainerProps);
|
|
86
|
+
savePortalRef: (portal: any) => any;
|
|
87
|
+
portalUpdate: (key: any, el: any) => void;
|
|
88
|
+
portalRegister: () => number;
|
|
89
|
+
portalDeregister: (key: any) => void;
|
|
90
|
+
saveContainerRef: (container: HTMLElement) => HTMLElement;
|
|
91
|
+
handleWheel: (e: any) => any;
|
|
92
|
+
componentDidMount(): void;
|
|
93
|
+
componentWillUnmount(): void;
|
|
94
|
+
getIdForElement(elementName: any): string;
|
|
95
|
+
getChildren(props: any): any;
|
|
96
|
+
getOUIAProps(props: any): any;
|
|
97
|
+
renderContainer(props: any, svgProps: any, style: any): JSX.Element;
|
|
98
|
+
render(): JSX.Element;
|
|
99
|
+
}
|
|
@@ -4,12 +4,14 @@ import _uniqueId from "lodash/uniqueId";
|
|
|
4
4
|
import _defaults from "lodash/defaults";
|
|
5
5
|
import _assign from "lodash/assign";
|
|
6
6
|
|
|
7
|
-
function _extends() { _extends = Object.assign
|
|
7
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
8
8
|
|
|
9
9
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
10
|
|
|
11
11
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
12
|
|
|
13
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
|
+
|
|
13
15
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
14
16
|
|
|
15
17
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
@@ -18,7 +20,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
18
20
|
|
|
19
21
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
20
22
|
|
|
21
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
23
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
22
24
|
|
|
23
25
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
24
26
|
|
|
@@ -28,31 +30,33 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
28
30
|
|
|
29
31
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
30
32
|
|
|
31
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
32
|
-
|
|
33
|
-
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; }
|
|
33
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
34
34
|
|
|
35
35
|
import React from "react";
|
|
36
36
|
import PropTypes from "prop-types";
|
|
37
37
|
import * as CustomPropTypes from "../victory-util/prop-types";
|
|
38
|
-
import Portal from "../victory-portal/portal";
|
|
39
|
-
import PortalContext from "../victory-portal/portal-context";
|
|
38
|
+
import { Portal } from "../victory-portal/portal";
|
|
39
|
+
import { PortalContext } from "../victory-portal/portal-context";
|
|
40
40
|
import TimerContext from "../victory-util/timer-context";
|
|
41
41
|
import * as Helpers from "../victory-util/helpers";
|
|
42
42
|
import * as UserProps from "../victory-util/user-props";
|
|
43
|
-
|
|
44
|
-
var VictoryContainer = /*#__PURE__*/function (_React$Component) {
|
|
43
|
+
export var VictoryContainer = /*#__PURE__*/function (_React$Component) {
|
|
45
44
|
_inherits(VictoryContainer, _React$Component);
|
|
46
45
|
|
|
47
46
|
var _super = _createSuper(VictoryContainer);
|
|
48
47
|
|
|
48
|
+
// @ts-expect-error Ref will be initialized on mount
|
|
49
|
+
// @ts-expect-error Ref will be initialized on mount
|
|
49
50
|
function VictoryContainer(props) {
|
|
50
51
|
var _this;
|
|
51
52
|
|
|
52
53
|
_classCallCheck(this, VictoryContainer);
|
|
53
54
|
|
|
54
55
|
_this = _super.call(this, props);
|
|
55
|
-
_this.containerId =
|
|
56
|
+
_this.containerId = void 0;
|
|
57
|
+
_this.portalRef = void 0;
|
|
58
|
+
_this.containerRef = void 0;
|
|
59
|
+
_this.shouldHandleWheel = void 0;
|
|
56
60
|
|
|
57
61
|
_this.savePortalRef = function (portal) {
|
|
58
62
|
_this.portalRef = portal;
|
|
@@ -71,18 +75,21 @@ var VictoryContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
71
75
|
return _this.portalRef.portalDeregister(key);
|
|
72
76
|
};
|
|
73
77
|
|
|
74
|
-
_this.saveContainerRef =
|
|
78
|
+
_this.saveContainerRef = function (container) {
|
|
79
|
+
if (_isFunction(_this.props.containerRef)) {
|
|
80
|
+
_this.props.containerRef(container);
|
|
81
|
+
}
|
|
82
|
+
|
|
75
83
|
_this.containerRef = container;
|
|
76
84
|
return container;
|
|
77
85
|
};
|
|
78
|
-
_this.shouldHandleWheel = props && props.events && props.events.onWheel;
|
|
79
86
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
};
|
|
84
|
-
}
|
|
87
|
+
_this.handleWheel = function (e) {
|
|
88
|
+
return e.preventDefault();
|
|
89
|
+
};
|
|
85
90
|
|
|
91
|
+
_this.containerId = !_isObject(props) || props.containerId === undefined ? _uniqueId("victory-container-") : props.containerId;
|
|
92
|
+
_this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
|
|
86
93
|
return _this;
|
|
87
94
|
}
|
|
88
95
|
|
|
@@ -230,12 +237,9 @@ var VictoryContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
230
237
|
|
|
231
238
|
return VictoryContainer;
|
|
232
239
|
}(React.Component);
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
_defineProperty(VictoryContainer, "role", "container");
|
|
237
|
-
|
|
238
|
-
_defineProperty(VictoryContainer, "propTypes", {
|
|
240
|
+
VictoryContainer.displayName = "VictoryContainer";
|
|
241
|
+
VictoryContainer.role = "container";
|
|
242
|
+
VictoryContainer.propTypes = {
|
|
239
243
|
"aria-describedby": PropTypes.string,
|
|
240
244
|
"aria-labelledby": PropTypes.string,
|
|
241
245
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
|
|
@@ -264,16 +268,12 @@ _defineProperty(VictoryContainer, "propTypes", {
|
|
|
264
268
|
theme: PropTypes.object,
|
|
265
269
|
title: PropTypes.string,
|
|
266
270
|
width: CustomPropTypes.nonNegative
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
_defineProperty(VictoryContainer, "defaultProps", {
|
|
271
|
+
};
|
|
272
|
+
VictoryContainer.defaultProps = {
|
|
270
273
|
className: "VictoryContainer",
|
|
271
274
|
portalComponent: /*#__PURE__*/React.createElement(Portal, null),
|
|
272
275
|
portalZIndex: 99,
|
|
273
276
|
responsive: true,
|
|
274
277
|
role: "img"
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
_defineProperty(VictoryContainer, "contextType", TimerContext);
|
|
278
|
-
|
|
279
|
-
export { VictoryContainer as default };
|
|
278
|
+
};
|
|
279
|
+
VictoryContainer.contextType = TimerContext;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StringOrCallback, StringOrNumberOrCallback } from "../types";
|
|
3
|
+
import { NumberOrCallback, PaddingProps, VerticalAnchorType, VictoryLabelStyleObject } from "../victory-theme/victory-theme";
|
|
4
|
+
export declare type TextAnchorType = "start" | "middle" | "end" | "inherit";
|
|
5
|
+
export declare type OriginType = {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
};
|
|
9
|
+
export declare type LabelOrientationType = "parallel" | "perpendicular" | "vertical";
|
|
10
|
+
export interface VictoryLabelProps {
|
|
11
|
+
angle?: StringOrNumberOrCallback;
|
|
12
|
+
ariaLabel?: StringOrCallback;
|
|
13
|
+
backgroundComponent?: React.ReactElement;
|
|
14
|
+
backgroundStyle?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
15
|
+
backgroundPadding?: PaddingProps | PaddingProps[];
|
|
16
|
+
capHeight?: StringOrNumberOrCallback;
|
|
17
|
+
children?: StringOrNumberOrCallback;
|
|
18
|
+
className?: string;
|
|
19
|
+
datum?: object;
|
|
20
|
+
data?: any[];
|
|
21
|
+
desc?: string;
|
|
22
|
+
direction?: string;
|
|
23
|
+
disableInlineStyles?: boolean;
|
|
24
|
+
events?: React.DOMAttributes<any>;
|
|
25
|
+
groupComponent?: React.ReactElement;
|
|
26
|
+
id?: StringOrNumberOrCallback;
|
|
27
|
+
inline?: boolean;
|
|
28
|
+
labelPlacement?: LabelOrientationType;
|
|
29
|
+
lineHeight?: StringOrNumberOrCallback | (string | number)[];
|
|
30
|
+
origin?: OriginType;
|
|
31
|
+
polar?: boolean;
|
|
32
|
+
renderInPortal?: boolean;
|
|
33
|
+
style?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
34
|
+
tabIndex?: NumberOrCallback;
|
|
35
|
+
text?: string[] | StringOrNumberOrCallback;
|
|
36
|
+
textComponent?: React.ReactElement;
|
|
37
|
+
textAnchor?: TextAnchorType | {
|
|
38
|
+
(): TextAnchorType;
|
|
39
|
+
};
|
|
40
|
+
title?: string;
|
|
41
|
+
transform?: string | object | (() => string | object);
|
|
42
|
+
tspanComponent?: React.ReactElement;
|
|
43
|
+
verticalAnchor?: VerticalAnchorType | {
|
|
44
|
+
(): VerticalAnchorType;
|
|
45
|
+
};
|
|
46
|
+
x?: number;
|
|
47
|
+
y?: number;
|
|
48
|
+
dx?: StringOrNumberOrCallback;
|
|
49
|
+
dy?: StringOrNumberOrCallback;
|
|
50
|
+
}
|
|
51
|
+
declare const defaultStyles: {
|
|
52
|
+
fill: string;
|
|
53
|
+
fontSize: number;
|
|
54
|
+
fontFamily: string;
|
|
55
|
+
stroke: string;
|
|
56
|
+
};
|
|
57
|
+
export declare const VictoryLabel: {
|
|
58
|
+
role: string;
|
|
59
|
+
defaultStyles: typeof defaultStyles;
|
|
60
|
+
} & React.FC<VictoryLabelProps>;
|
|
61
|
+
export {};
|
|
@@ -22,10 +22,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
22
22
|
|
|
23
23
|
import PropTypes from "prop-types";
|
|
24
24
|
import React from "react";
|
|
25
|
-
import VictoryPortal from "../victory-portal/victory-portal";
|
|
26
|
-
import Rect from "../victory-primitives/rect";
|
|
27
|
-
import Text from "../victory-primitives/text";
|
|
28
|
-
import TSpan from "../victory-primitives/tspan";
|
|
25
|
+
import { VictoryPortal } from "../victory-portal/victory-portal";
|
|
26
|
+
import { Rect } from "../victory-primitives/rect";
|
|
27
|
+
import { Text } from "../victory-primitives/text";
|
|
28
|
+
import { TSpan } from "../victory-primitives/tspan";
|
|
29
29
|
import * as Helpers from "../victory-util/helpers";
|
|
30
30
|
import * as LabelHelpers from "../victory-util/label-helpers";
|
|
31
31
|
import * as Log from "../victory-util/log";
|
|
@@ -503,7 +503,7 @@ var renderLabel = function (calculatedProps, tspanValues) {
|
|
|
503
503
|
return /*#__PURE__*/React.cloneElement(textComponent, textProps, tspans);
|
|
504
504
|
};
|
|
505
505
|
|
|
506
|
-
var VictoryLabel = function (props) {
|
|
506
|
+
export var VictoryLabel = function (props) {
|
|
507
507
|
props = evaluateProps(props);
|
|
508
508
|
|
|
509
509
|
if (props.text === null || props.text === undefined) {
|
|
@@ -525,6 +525,7 @@ var VictoryLabel = function (props) {
|
|
|
525
525
|
fontSize: currentStyle.fontSize || defaultStyles.fontSize,
|
|
526
526
|
capHeight: capHeightPx,
|
|
527
527
|
text: line,
|
|
528
|
+
// @ts-expect-error TODO: This looks like a bug:
|
|
528
529
|
textSize: TextSize.approximateTextSize(line, currentStyle),
|
|
529
530
|
lineHeight: currentLineHeight,
|
|
530
531
|
backgroundPadding: getSingleValue(backgroundPadding, i)
|
|
@@ -541,7 +542,6 @@ var VictoryLabel = function (props) {
|
|
|
541
542
|
|
|
542
543
|
return props.renderInPortal ? /*#__PURE__*/React.createElement(VictoryPortal, null, label) : label;
|
|
543
544
|
};
|
|
544
|
-
|
|
545
545
|
VictoryLabel.displayName = "VictoryLabel";
|
|
546
546
|
VictoryLabel.role = "label";
|
|
547
547
|
VictoryLabel.defaultStyles = defaultStyles;
|
|
@@ -556,6 +556,7 @@ VictoryLabel.propTypes = {
|
|
|
556
556
|
className: PropTypes.string,
|
|
557
557
|
data: PropTypes.array,
|
|
558
558
|
datum: PropTypes.any,
|
|
559
|
+
// @ts-expect-error "Function is not assignable to string"
|
|
559
560
|
desc: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
560
561
|
direction: PropTypes.oneOf(["rtl", "ltr", "inherit"]),
|
|
561
562
|
dx: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
@@ -567,6 +568,7 @@ VictoryLabel.propTypes = {
|
|
|
567
568
|
inline: PropTypes.bool,
|
|
568
569
|
labelPlacement: PropTypes.oneOf(["parallel", "perpendicular", "vertical"]),
|
|
569
570
|
lineHeight: PropTypes.oneOfType([PropTypes.string, CustomPropTypes.nonNegative, PropTypes.func, PropTypes.array]),
|
|
571
|
+
// @ts-expect-error "x is required in origin"
|
|
570
572
|
origin: PropTypes.shape({
|
|
571
573
|
x: CustomPropTypes.nonNegative,
|
|
572
574
|
y: CustomPropTypes.nonNegative
|
|
@@ -580,13 +582,17 @@ VictoryLabel.propTypes = {
|
|
|
580
582
|
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
581
583
|
tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),
|
|
582
584
|
text: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.func, PropTypes.array]),
|
|
585
|
+
// @ts-expect-error Function is not assignable to string"
|
|
583
586
|
textAnchor: PropTypes.oneOfType([PropTypes.oneOf(["start", "middle", "end", "inherit"]), PropTypes.func]),
|
|
584
587
|
textComponent: PropTypes.element,
|
|
585
588
|
title: PropTypes.string,
|
|
586
589
|
transform: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]),
|
|
587
590
|
tspanComponent: PropTypes.element,
|
|
591
|
+
// @ts-expect-error Function is not assignable to string"
|
|
588
592
|
verticalAnchor: PropTypes.oneOfType([PropTypes.oneOf(["start", "middle", "end"]), PropTypes.func]),
|
|
593
|
+
// @ts-expect-error Number is not assignable to string
|
|
589
594
|
x: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
595
|
+
// @ts-expect-error Number is not assignable to string
|
|
590
596
|
y: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
591
597
|
};
|
|
592
598
|
VictoryLabel.defaultProps = {
|
|
@@ -598,5 +604,4 @@ VictoryLabel.defaultProps = {
|
|
|
598
604
|
capHeight: 0.71,
|
|
599
605
|
// Magic number from d3.
|
|
600
606
|
lineHeight: 1
|
|
601
|
-
};
|
|
602
|
-
export default VictoryLabel;
|
|
607
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface PortalContextValue {
|
|
3
|
+
portalRegister(): number;
|
|
4
|
+
portalUpdate(key: number, element: React.ReactElement): void;
|
|
5
|
+
portalDeregister(key: number): void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The React context object consumers may use to access the context of the
|
|
9
|
+
* portal.
|
|
10
|
+
*/
|
|
11
|
+
export declare const PortalContext: React.Context<PortalContextValue>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
4
|
* The React context object consumers may use to access the context of the
|
|
4
5
|
* portal.
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
PortalContext.displayName = "PortalContext";
|
|
9
|
-
export default PortalContext;
|
|
7
|
+
export var PortalContext = /*#__PURE__*/React.createContext({});
|
|
8
|
+
PortalContext.displayName = "PortalContext";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import { PortalContextValue } from "./portal-context";
|
|
4
|
+
export interface PortalProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
height?: number;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
viewBox?: string;
|
|
9
|
+
width?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare class Portal extends React.Component<PortalProps> implements PortalContextValue {
|
|
12
|
+
static displayName: string;
|
|
13
|
+
static propTypes: {
|
|
14
|
+
className: PropTypes.Requireable<string>;
|
|
15
|
+
height: any;
|
|
16
|
+
style: PropTypes.Requireable<object>;
|
|
17
|
+
viewBox: PropTypes.Requireable<string>;
|
|
18
|
+
width: any;
|
|
19
|
+
};
|
|
20
|
+
private readonly map;
|
|
21
|
+
private index;
|
|
22
|
+
constructor(props: PortalProps);
|
|
23
|
+
portalRegister: () => number;
|
|
24
|
+
portalUpdate: (key: number, element: React.ReactElement) => void;
|
|
25
|
+
portalDeregister: (key: number) => void;
|
|
26
|
+
private getChildren;
|
|
27
|
+
render(): JSX.Element;
|
|
28
|
+
}
|
|
@@ -8,7 +8,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
8
8
|
|
|
9
9
|
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); }
|
|
10
10
|
|
|
11
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
11
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
12
|
|
|
13
13
|
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); }; }
|
|
14
14
|
|
|
@@ -18,15 +18,12 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
18
18
|
|
|
19
19
|
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; } }
|
|
20
20
|
|
|
21
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
-
|
|
23
|
-
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; }
|
|
21
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
24
22
|
|
|
25
23
|
import React from "react";
|
|
26
24
|
import PropTypes from "prop-types";
|
|
27
25
|
import * as CustomPropTypes from "../victory-util/prop-types";
|
|
28
|
-
|
|
29
|
-
var Portal = /*#__PURE__*/function (_React$Component) {
|
|
26
|
+
export var Portal = /*#__PURE__*/function (_React$Component) {
|
|
30
27
|
_inherits(Portal, _React$Component);
|
|
31
28
|
|
|
32
29
|
var _super = _createSuper(Portal);
|
|
@@ -37,32 +34,31 @@ var Portal = /*#__PURE__*/function (_React$Component) {
|
|
|
37
34
|
_classCallCheck(this, Portal);
|
|
38
35
|
|
|
39
36
|
_this = _super.call(this, props);
|
|
37
|
+
_this.map = void 0;
|
|
38
|
+
_this.index = void 0;
|
|
39
|
+
|
|
40
|
+
_this.portalRegister = function () {
|
|
41
|
+
return ++_this.index;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
_this.portalUpdate = function (key, element) {
|
|
45
|
+
_this.map[key] = element;
|
|
46
|
+
|
|
47
|
+
_this.forceUpdate();
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
_this.portalDeregister = function (key) {
|
|
51
|
+
delete _this.map[key];
|
|
52
|
+
|
|
53
|
+
_this.forceUpdate();
|
|
54
|
+
};
|
|
55
|
+
|
|
40
56
|
_this.map = {};
|
|
41
57
|
_this.index = 1;
|
|
42
|
-
_this.portalUpdate = _this.portalUpdate.bind(_assertThisInitialized(_this));
|
|
43
|
-
_this.portalRegister = _this.portalRegister.bind(_assertThisInitialized(_this));
|
|
44
|
-
_this.portalDeregister = _this.portalDeregister.bind(_assertThisInitialized(_this));
|
|
45
58
|
return _this;
|
|
46
59
|
}
|
|
47
60
|
|
|
48
61
|
_createClass(Portal, [{
|
|
49
|
-
key: "portalRegister",
|
|
50
|
-
value: function portalRegister() {
|
|
51
|
-
return ++this.index;
|
|
52
|
-
}
|
|
53
|
-
}, {
|
|
54
|
-
key: "portalUpdate",
|
|
55
|
-
value: function portalUpdate(key, element) {
|
|
56
|
-
this.map[key] = element;
|
|
57
|
-
this.forceUpdate();
|
|
58
|
-
}
|
|
59
|
-
}, {
|
|
60
|
-
key: "portalDeregister",
|
|
61
|
-
value: function portalDeregister(key) {
|
|
62
|
-
delete this.map[key];
|
|
63
|
-
this.forceUpdate();
|
|
64
|
-
}
|
|
65
|
-
}, {
|
|
66
62
|
key: "getChildren",
|
|
67
63
|
value: function getChildren() {
|
|
68
64
|
var _this2 = this;
|
|
@@ -84,15 +80,11 @@ var Portal = /*#__PURE__*/function (_React$Component) {
|
|
|
84
80
|
|
|
85
81
|
return Portal;
|
|
86
82
|
}(React.Component);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
_defineProperty(Portal, "propTypes", {
|
|
83
|
+
Portal.displayName = "Portal";
|
|
84
|
+
Portal.propTypes = {
|
|
91
85
|
className: PropTypes.string,
|
|
92
86
|
height: CustomPropTypes.nonNegative,
|
|
93
87
|
style: PropTypes.object,
|
|
94
88
|
viewBox: PropTypes.string,
|
|
95
89
|
width: CustomPropTypes.nonNegative
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export { Portal as default };
|
|
90
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import { PortalContext } from "./portal-context";
|
|
4
|
+
export interface VictoryPortalProps {
|
|
5
|
+
children?: React.ReactElement;
|
|
6
|
+
groupComponent?: React.ReactElement;
|
|
7
|
+
}
|
|
8
|
+
export interface VictoryPortal {
|
|
9
|
+
context: React.ContextType<typeof PortalContext>;
|
|
10
|
+
}
|
|
11
|
+
export declare class VictoryPortal extends React.Component<VictoryPortalProps> {
|
|
12
|
+
static displayName: string;
|
|
13
|
+
static role: string;
|
|
14
|
+
static propTypes: {
|
|
15
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
16
|
+
groupComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
17
|
+
};
|
|
18
|
+
static defaultProps: {
|
|
19
|
+
groupComponent: JSX.Element;
|
|
20
|
+
};
|
|
21
|
+
static contextType: React.Context<import("./portal-context").PortalContextValue>;
|
|
22
|
+
private checkedContext;
|
|
23
|
+
private renderInPlace;
|
|
24
|
+
private element;
|
|
25
|
+
private portalKey;
|
|
26
|
+
componentDidMount(): void;
|
|
27
|
+
componentDidUpdate(): void;
|
|
28
|
+
componentWillUnmount(): void;
|
|
29
|
+
renderPortal(child: React.ReactElement): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
|
|
30
|
+
render(): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
|
|
31
|
+
}
|