victory-core 36.9.2-next.3 → 37.0.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 +28 -10
- package/README.md +1 -1
- package/dist/victory-core.js +4449 -6196
- package/dist/victory-core.min.js +1 -1
- package/es/index.d.ts +17 -17
- package/es/types/callbacks.d.ts +36 -36
- package/es/types/prop-types.d.ts +129 -129
- package/es/victory-accessible-group/victory-accessible-group.d.ts +10 -10
- package/es/victory-accessible-group/victory-accessible-group.js +9 -15
- package/es/victory-animation/util.d.ts +66 -66
- package/es/victory-animation/util.js +28 -47
- package/es/victory-animation/victory-animation.d.ts +34 -34
- package/es/victory-animation/victory-animation.js +51 -67
- package/es/victory-clip-container/victory-clip-container.d.ts +46 -46
- package/es/victory-clip-container/victory-clip-container.js +153 -229
- package/es/victory-container/victory-container.d.ts +68 -68
- package/es/victory-container/victory-container.js +157 -216
- package/es/victory-label/victory-label.d.ts +58 -58
- package/es/victory-label/victory-label.js +246 -323
- package/es/victory-portal/portal-context.d.ts +11 -11
- package/es/victory-portal/portal-context.js +1 -2
- package/es/victory-portal/portal.d.ts +20 -20
- package/es/victory-portal/portal.js +30 -76
- package/es/victory-portal/victory-portal.d.ts +26 -26
- package/es/victory-portal/victory-portal.js +47 -104
- package/es/victory-primitives/arc.d.ts +14 -14
- package/es/victory-primitives/arc.js +44 -47
- package/es/victory-primitives/background.d.ts +13 -13
- package/es/victory-primitives/background.js +14 -17
- package/es/victory-primitives/border.d.ts +10 -10
- package/es/victory-primitives/border.js +20 -24
- package/es/victory-primitives/circle.d.ts +3 -3
- package/es/victory-primitives/circle.js +13 -27
- package/es/victory-primitives/clip-path.d.ts +7 -7
- package/es/victory-primitives/clip-path.js +3 -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-segment.js +20 -24
- package/es/victory-primitives/line.d.ts +3 -3
- package/es/victory-primitives/line.js +13 -27
- package/es/victory-primitives/path.d.ts +3 -3
- package/es/victory-primitives/path.js +13 -27
- package/es/victory-primitives/point.d.ts +13 -13
- package/es/victory-primitives/point.js +36 -40
- package/es/victory-primitives/rect.d.ts +3 -3
- package/es/victory-primitives/rect.js +13 -27
- package/es/victory-primitives/text.d.ts +8 -8
- package/es/victory-primitives/text.js +15 -28
- package/es/victory-primitives/tspan.d.ts +3 -3
- package/es/victory-primitives/tspan.js +13 -26
- package/es/victory-primitives/types.d.ts +7 -7
- package/es/victory-primitives/whisker.d.ts +15 -15
- package/es/victory-primitives/whisker.js +43 -47
- package/es/victory-theme/grayscale.d.ts +2 -2
- package/es/victory-theme/grayscale.js +22 -22
- package/es/victory-theme/material.d.ts +2 -2
- package/es/victory-theme/material.js +46 -46
- package/es/victory-theme/types.d.ts +238 -238
- package/es/victory-theme/victory-theme.d.ts +5 -5
- package/es/victory-theme/victory-theme.js +3 -3
- package/es/victory-transition/victory-transition.d.ts +53 -53
- package/es/victory-transition/victory-transition.js +126 -206
- package/es/victory-util/add-events.d.ts +126 -126
- package/es/victory-util/add-events.js +265 -380
- package/es/victory-util/axis.d.ts +50 -50
- package/es/victory-util/axis.js +133 -222
- package/es/victory-util/collection.d.ts +15 -8
- package/es/victory-util/collection.js +24 -36
- package/es/victory-util/common-props.d.ts +79 -79
- package/es/victory-util/data.d.ts +74 -74
- package/es/victory-util/data.js +159 -214
- package/es/victory-util/default-transitions.d.ts +4 -4
- package/es/victory-util/default-transitions.js +33 -51
- package/es/victory-util/domain.d.ts +90 -90
- package/es/victory-util/domain.js +122 -171
- package/es/victory-util/events.d.ts +64 -64
- package/es/victory-util/events.js +168 -258
- package/es/victory-util/helpers.d.ts +96 -91
- package/es/victory-util/helpers.js +162 -176
- 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-animation-state.js +61 -99
- package/es/victory-util/hooks/use-previous-props.d.ts +1 -1
- package/es/victory-util/hooks/use-previous-props.js +2 -2
- package/es/victory-util/immutable.d.ts +11 -11
- package/es/victory-util/immutable.js +6 -8
- package/es/victory-util/index.d.ts +26 -26
- package/es/victory-util/label-helpers.d.ts +26 -26
- package/es/victory-util/label-helpers.js +128 -130
- package/es/victory-util/line-helpers.d.ts +4 -4
- package/es/victory-util/line-helpers.js +29 -41
- package/es/victory-util/log.d.ts +1 -1
- package/es/victory-util/log.js +1 -1
- package/es/victory-util/point-path-helpers.d.ts +9 -9
- package/es/victory-util/point-path-helpers.js +89 -49
- package/es/victory-util/scale.d.ts +9 -9
- package/es/victory-util/scale.js +24 -42
- package/es/victory-util/selection.d.ts +28 -28
- package/es/victory-util/selection.js +39 -40
- package/es/victory-util/style.d.ts +18 -18
- package/es/victory-util/style.js +8 -13
- package/es/victory-util/textsize.d.ts +35 -35
- package/es/victory-util/textsize.js +80 -154
- package/es/victory-util/timer-context.d.ts +11 -11
- package/es/victory-util/timer-context.js +2 -2
- package/es/victory-util/timer.d.ts +16 -16
- package/es/victory-util/timer.js +40 -76
- package/es/victory-util/transitions.d.ts +48 -48
- package/es/victory-util/transitions.js +110 -150
- package/es/victory-util/type-helpers.d.ts +9 -9
- package/es/victory-util/type-helpers.js +2 -3
- package/es/victory-util/user-props.d.ts +26 -26
- package/es/victory-util/user-props.js +24 -49
- package/es/victory-util/wrapper.d.ts +33 -37
- package/es/victory-util/wrapper.js +182 -245
- package/lib/index.d.ts +17 -17
- package/lib/index.js +0 -30
- package/lib/types/callbacks.d.ts +36 -36
- package/lib/types/prop-types.d.ts +129 -129
- package/lib/victory-accessible-group/victory-accessible-group.d.ts +10 -10
- package/lib/victory-accessible-group/victory-accessible-group.js +9 -19
- package/lib/victory-animation/util.d.ts +66 -66
- package/lib/victory-animation/util.js +28 -63
- package/lib/victory-animation/victory-animation.d.ts +34 -34
- package/lib/victory-animation/victory-animation.js +54 -83
- package/lib/victory-clip-container/victory-clip-container.d.ts +46 -46
- package/lib/victory-clip-container/victory-clip-container.js +156 -243
- package/lib/victory-container/victory-container.d.ts +68 -68
- package/lib/victory-container/victory-container.js +160 -232
- package/lib/victory-label/victory-label.d.ts +58 -58
- package/lib/victory-label/victory-label.js +248 -344
- package/lib/victory-portal/portal-context.d.ts +11 -11
- package/lib/victory-portal/portal-context.js +1 -6
- package/lib/victory-portal/portal.d.ts +20 -20
- package/lib/victory-portal/portal.js +31 -81
- package/lib/victory-portal/victory-portal.d.ts +26 -26
- package/lib/victory-portal/victory-portal.js +50 -116
- package/lib/victory-primitives/arc.d.ts +14 -14
- package/lib/victory-primitives/arc.js +48 -57
- package/lib/victory-primitives/background.d.ts +13 -13
- package/lib/victory-primitives/background.js +16 -28
- package/lib/victory-primitives/border.d.ts +10 -10
- package/lib/victory-primitives/border.js +22 -34
- package/lib/victory-primitives/circle.d.ts +3 -3
- package/lib/victory-primitives/circle.js +16 -36
- package/lib/victory-primitives/clip-path.d.ts +7 -7
- package/lib/victory-primitives/clip-path.js +3 -11
- package/lib/victory-primitives/index.d.ts +14 -14
- package/lib/victory-primitives/index.js +0 -28
- package/lib/victory-primitives/line-segment.d.ts +11 -11
- package/lib/victory-primitives/line-segment.js +22 -34
- package/lib/victory-primitives/line.d.ts +3 -3
- package/lib/victory-primitives/line.js +16 -36
- package/lib/victory-primitives/path.d.ts +3 -3
- package/lib/victory-primitives/path.js +16 -36
- package/lib/victory-primitives/point.d.ts +13 -13
- package/lib/victory-primitives/point.js +38 -52
- package/lib/victory-primitives/rect.d.ts +3 -3
- package/lib/victory-primitives/rect.js +16 -36
- package/lib/victory-primitives/text.d.ts +8 -8
- package/lib/victory-primitives/text.js +15 -33
- package/lib/victory-primitives/tspan.d.ts +3 -3
- package/lib/victory-primitives/tspan.js +13 -31
- package/lib/victory-primitives/types.d.ts +7 -7
- package/lib/victory-primitives/whisker.d.ts +15 -15
- package/lib/victory-primitives/whisker.js +45 -57
- package/lib/victory-theme/grayscale.d.ts +2 -2
- package/lib/victory-theme/grayscale.js +23 -24
- package/lib/victory-theme/material.d.ts +2 -2
- package/lib/victory-theme/material.js +47 -48
- package/lib/victory-theme/types.d.ts +238 -238
- package/lib/victory-theme/victory-theme.d.ts +5 -5
- package/lib/victory-theme/victory-theme.js +2 -7
- package/lib/victory-transition/victory-transition.d.ts +53 -53
- package/lib/victory-transition/victory-transition.js +129 -224
- package/lib/victory-util/add-events.d.ts +126 -126
- package/lib/victory-util/add-events.js +265 -382
- package/lib/victory-util/axis.d.ts +50 -50
- package/lib/victory-util/axis.js +135 -242
- package/lib/victory-util/collection.d.ts +15 -8
- package/lib/victory-util/collection.js +24 -43
- package/lib/victory-util/common-props.d.ts +79 -79
- package/lib/victory-util/data.d.ts +74 -74
- package/lib/victory-util/data.js +160 -239
- package/lib/victory-util/default-transitions.d.ts +4 -4
- package/lib/victory-util/default-transitions.js +33 -54
- package/lib/victory-util/domain.d.ts +90 -90
- package/lib/victory-util/domain.js +123 -193
- package/lib/victory-util/events.d.ts +64 -64
- package/lib/victory-util/events.js +167 -274
- package/lib/victory-util/helpers.d.ts +96 -91
- package/lib/victory-util/helpers.js +166 -204
- package/lib/victory-util/hooks/index.d.ts +2 -2
- package/lib/victory-util/hooks/index.js +0 -2
- package/lib/victory-util/hooks/use-animation-state.d.ts +21 -21
- package/lib/victory-util/hooks/use-animation-state.js +63 -113
- package/lib/victory-util/hooks/use-previous-props.d.ts +1 -1
- package/lib/victory-util/hooks/use-previous-props.js +2 -7
- package/lib/victory-util/immutable.d.ts +11 -11
- package/lib/victory-util/immutable.js +6 -18
- package/lib/victory-util/index.d.ts +26 -26
- package/lib/victory-util/index.js +2 -51
- package/lib/victory-util/label-helpers.d.ts +26 -26
- package/lib/victory-util/label-helpers.js +130 -141
- package/lib/victory-util/line-helpers.d.ts +4 -4
- package/lib/victory-util/line-helpers.js +31 -49
- package/lib/victory-util/log.d.ts +1 -1
- package/lib/victory-util/log.js +1 -2
- package/lib/victory-util/point-path-helpers.d.ts +9 -9
- package/lib/victory-util/point-path-helpers.js +91 -63
- package/lib/victory-util/scale.d.ts +9 -9
- package/lib/victory-util/scale.js +26 -57
- package/lib/victory-util/selection.d.ts +28 -28
- package/lib/victory-util/selection.js +41 -49
- package/lib/victory-util/style.d.ts +18 -18
- package/lib/victory-util/style.js +8 -16
- package/lib/victory-util/textsize.d.ts +35 -35
- package/lib/victory-util/textsize.js +80 -157
- package/lib/victory-util/timer-context.d.ts +11 -11
- package/lib/victory-util/timer-context.js +2 -8
- package/lib/victory-util/timer.d.ts +16 -16
- package/lib/victory-util/timer.js +40 -76
- package/lib/victory-util/transitions.d.ts +48 -48
- package/lib/victory-util/transitions.js +110 -152
- package/lib/victory-util/type-helpers.d.ts +9 -9
- package/lib/victory-util/type-helpers.js +2 -9
- package/lib/victory-util/user-props.d.ts +26 -26
- package/lib/victory-util/user-props.js +25 -59
- package/lib/victory-util/wrapper.d.ts +33 -37
- package/lib/victory-util/wrapper.js +184 -279
- package/package.json +6 -3
- package/src/types/prop-types.ts +0 -7
- package/src/victory-container/victory-container.tsx +195 -171
- 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/src/victory-util/merge-refs.ts +0 -13
|
@@ -1,238 +1,179 @@
|
|
|
1
1
|
import _isObject from "lodash/isObject";
|
|
2
2
|
import _uniqueId from "lodash/uniqueId";
|
|
3
3
|
import _defaults from "lodash/defaults";
|
|
4
|
-
|
|
5
4
|
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); }
|
|
6
|
-
|
|
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; }
|
|
8
|
-
|
|
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; }
|
|
10
|
-
|
|
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; }
|
|
12
|
-
|
|
13
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
14
|
-
|
|
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); } }
|
|
16
|
-
|
|
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; }
|
|
18
|
-
|
|
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); }
|
|
20
|
-
|
|
21
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
22
|
-
|
|
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); }
|
|
32
|
-
|
|
33
5
|
import React from "react";
|
|
34
6
|
import { Portal } from "../victory-portal/portal";
|
|
35
7
|
import { PortalContext } from "../victory-portal/portal-context";
|
|
36
8
|
import TimerContext from "../victory-util/timer-context";
|
|
37
9
|
import * as Helpers from "../victory-util/helpers";
|
|
38
10
|
import * as UserProps from "../victory-util/user-props";
|
|
39
|
-
export
|
|
40
|
-
|
|
11
|
+
export class VictoryContainer extends React.Component {
|
|
12
|
+
static displayName = "VictoryContainer";
|
|
13
|
+
static role = "container";
|
|
14
|
+
static defaultProps = {
|
|
15
|
+
className: "VictoryContainer",
|
|
16
|
+
portalComponent: /*#__PURE__*/React.createElement(Portal, null),
|
|
17
|
+
portalZIndex: 99,
|
|
18
|
+
responsive: true,
|
|
19
|
+
role: "img"
|
|
20
|
+
};
|
|
21
|
+
static contextType = TimerContext;
|
|
41
22
|
|
|
42
|
-
var _super = _createSuper(VictoryContainer);
|
|
43
|
-
|
|
44
|
-
// @ts-expect-error Ref will be initialized on mount
|
|
45
23
|
// @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
24
|
|
|
79
|
-
|
|
80
|
-
return container;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
_this.handleWheel = function (e) {
|
|
84
|
-
return e.preventDefault();
|
|
85
|
-
};
|
|
25
|
+
// @ts-expect-error Ref will be initialized on mount
|
|
86
26
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
27
|
+
constructor(props) {
|
|
28
|
+
super(props);
|
|
29
|
+
this.containerId = !_isObject(props) || props.containerId === undefined ? _uniqueId("victory-container-") : props.containerId;
|
|
30
|
+
this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
|
|
90
31
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
32
|
+
savePortalRef = portal => {
|
|
33
|
+
this.portalRef = portal;
|
|
34
|
+
return portal;
|
|
35
|
+
};
|
|
36
|
+
portalUpdate = (key, el) => this.portalRef.portalUpdate(key, el);
|
|
37
|
+
portalRegister = () => this.portalRef.portalRegister();
|
|
38
|
+
portalDeregister = key => this.portalRef.portalDeregister(key);
|
|
39
|
+
saveContainerRef = container => {
|
|
40
|
+
if (Helpers.isFunction(this.props.containerRef)) {
|
|
41
|
+
this.props.containerRef(container);
|
|
98
42
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
43
|
+
this.containerRef = container;
|
|
44
|
+
return container;
|
|
45
|
+
};
|
|
46
|
+
handleWheel = e => e.preventDefault();
|
|
47
|
+
componentDidMount() {
|
|
48
|
+
if (this.shouldHandleWheel && this.containerRef) {
|
|
49
|
+
this.containerRef.addEventListener("wheel", this.handleWheel);
|
|
105
50
|
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
51
|
+
}
|
|
52
|
+
componentWillUnmount() {
|
|
53
|
+
if (this.shouldHandleWheel && this.containerRef) {
|
|
54
|
+
this.containerRef.removeEventListener("wheel", this.handleWheel);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
getIdForElement(elementName) {
|
|
58
|
+
return `${this.containerId}-${elementName}`;
|
|
59
|
+
}
|
|
111
60
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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
|
|
61
|
+
// overridden in custom containers
|
|
62
|
+
getChildren(props) {
|
|
63
|
+
return props.children;
|
|
64
|
+
}
|
|
118
65
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
66
|
+
// Get props defined by the Open UI Automation (OUIA) 1.0-RC spec
|
|
67
|
+
// See https://ouia.readthedocs.io/en/latest/README.html#ouia-component
|
|
68
|
+
getOUIAProps(props) {
|
|
69
|
+
const {
|
|
70
|
+
ouiaId,
|
|
71
|
+
ouiaSafe,
|
|
72
|
+
ouiaType
|
|
73
|
+
} = props;
|
|
74
|
+
return {
|
|
75
|
+
...(ouiaId && {
|
|
126
76
|
"data-ouia-component-id": ouiaId
|
|
127
|
-
}),
|
|
77
|
+
}),
|
|
78
|
+
...(ouiaType && {
|
|
128
79
|
"data-ouia-component-type": ouiaType
|
|
129
|
-
}),
|
|
80
|
+
}),
|
|
81
|
+
...(ouiaSafe !== undefined && {
|
|
130
82
|
"data-ouia-safe": ouiaSafe
|
|
131
|
-
})
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}(React.Component);
|
|
229
|
-
VictoryContainer.displayName = "VictoryContainer";
|
|
230
|
-
VictoryContainer.role = "container";
|
|
231
|
-
VictoryContainer.defaultProps = {
|
|
232
|
-
className: "VictoryContainer",
|
|
233
|
-
portalComponent: /*#__PURE__*/React.createElement(Portal, null),
|
|
234
|
-
portalZIndex: 99,
|
|
235
|
-
responsive: true,
|
|
236
|
-
role: "img"
|
|
237
|
-
};
|
|
238
|
-
VictoryContainer.contextType = TimerContext;
|
|
83
|
+
})
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
renderContainer(props, svgProps, style) {
|
|
87
|
+
const {
|
|
88
|
+
title,
|
|
89
|
+
desc,
|
|
90
|
+
portalComponent,
|
|
91
|
+
className,
|
|
92
|
+
width,
|
|
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({
|
|
106
|
+
pointerEvents: "none",
|
|
107
|
+
touchAction: "none",
|
|
108
|
+
position: "relative"
|
|
109
|
+
}, dimensions);
|
|
110
|
+
const portalDivStyle = Object.assign({
|
|
111
|
+
zIndex: portalZIndex,
|
|
112
|
+
position: "absolute",
|
|
113
|
+
top: 0,
|
|
114
|
+
left: 0
|
|
115
|
+
}, dimensions);
|
|
116
|
+
const svgStyle = Object.assign({
|
|
117
|
+
pointerEvents: "all"
|
|
118
|
+
}, dimensions);
|
|
119
|
+
const portalSvgStyle = Object.assign({
|
|
120
|
+
overflow: "visible"
|
|
121
|
+
}, dimensions);
|
|
122
|
+
const portalProps = {
|
|
123
|
+
width,
|
|
124
|
+
height,
|
|
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
|
+
}
|
|
@@ -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
|