victory-core 35.11.2 → 36.1.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/LICENSE.txt +30 -0
- package/dist/victory-core.js +4376 -1142
- package/dist/victory-core.min.js +1 -1
- package/es/index.d.ts +6 -0
- package/es/index.js +8 -2
- package/es/victory-accessible-group/victory-accessible-group.js +1 -3
- package/es/victory-animation/victory-animation.js +1 -3
- package/es/victory-clip-container/victory-clip-container.js +1 -3
- package/es/victory-container/victory-container.js +1 -3
- package/es/victory-label/victory-label.js +3 -3
- package/es/victory-portal/portal.js +1 -3
- package/es/victory-portal/victory-portal.js +1 -3
- package/es/victory-primitives/point.js +1 -1
- package/es/victory-transition/victory-transition.js +1 -3
- package/es/victory-util/add-events.js +305 -308
- package/es/victory-util/hooks.js +137 -0
- package/es/victory-util/line-helpers.js +45 -0
- package/es/{victory-primitives/path-helpers.js → victory-util/point-path-helpers.js} +0 -0
- package/es/victory-util/timer.js +1 -3
- package/es/victory-util/wrapper.js +372 -457
- package/lib/index.d.ts +6 -0
- package/lib/index.js +78 -8
- package/lib/victory-accessible-group/victory-accessible-group.js +1 -3
- package/lib/victory-animation/victory-animation.js +1 -3
- package/lib/victory-clip-container/victory-clip-container.js +1 -3
- package/lib/victory-container/victory-container.js +1 -3
- package/lib/victory-label/victory-label.js +3 -3
- package/lib/victory-portal/portal.js +1 -3
- package/lib/victory-portal/victory-portal.js +1 -3
- package/lib/victory-primitives/point.js +10 -10
- package/lib/victory-transition/victory-transition.js +1 -3
- package/lib/victory-util/add-events.js +301 -304
- package/lib/victory-util/hooks.js +162 -0
- package/lib/victory-util/line-helpers.js +56 -0
- package/lib/{victory-primitives/path-helpers.js → victory-util/point-path-helpers.js} +0 -0
- package/lib/victory-util/timer.js +1 -3
- package/lib/victory-util/wrapper.js +389 -446
- package/package.json +7 -3
- package/src/index.d.ts +6 -0
- package/src/index.js +5 -1
- package/src/victory-label/victory-label.js +3 -3
- package/src/victory-primitives/point.js +1 -1
- package/src/victory-util/hooks.js +131 -0
- package/src/victory-util/line-helpers.js +54 -0
- package/src/{victory-primitives/path-helpers.js → victory-util/point-path-helpers.js} +0 -0
- package/src/victory-util/transitions.js +0 -1
- package/src/victory-util/wrapper.js +422 -518
package/lib/index.d.ts
CHANGED
|
@@ -429,6 +429,12 @@ export interface VictoryThemeDefinition {
|
|
|
429
429
|
labels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
430
430
|
};
|
|
431
431
|
} & VictoryCommonThemeProps;
|
|
432
|
+
histogram?: {
|
|
433
|
+
style?: {
|
|
434
|
+
data?: VictoryStyleObject;
|
|
435
|
+
labels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
436
|
+
};
|
|
437
|
+
} & VictoryCommonThemeProps;
|
|
432
438
|
independentAxis?: {
|
|
433
439
|
style?: {
|
|
434
440
|
axis?: VictoryStyleObject;
|
package/lib/index.js
CHANGED
|
@@ -3,6 +3,55 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
VictoryAccessibleGroup: true,
|
|
8
|
+
VictoryAnimation: true,
|
|
9
|
+
VictoryContainer: true,
|
|
10
|
+
VictoryLabel: true,
|
|
11
|
+
VictoryTransition: true,
|
|
12
|
+
VictoryClipContainer: true,
|
|
13
|
+
VictoryTheme: true,
|
|
14
|
+
VictoryPortal: true,
|
|
15
|
+
Portal: true,
|
|
16
|
+
Arc: true,
|
|
17
|
+
Background: true,
|
|
18
|
+
Border: true,
|
|
19
|
+
Box: true,
|
|
20
|
+
Circle: true,
|
|
21
|
+
ClipPath: true,
|
|
22
|
+
Line: true,
|
|
23
|
+
LineSegment: true,
|
|
24
|
+
Path: true,
|
|
25
|
+
Point: true,
|
|
26
|
+
Rect: true,
|
|
27
|
+
Text: true,
|
|
28
|
+
TSpan: true,
|
|
29
|
+
Whisker: true,
|
|
30
|
+
addEvents: true,
|
|
31
|
+
Collection: true,
|
|
32
|
+
Data: true,
|
|
33
|
+
DefaultTransitions: true,
|
|
34
|
+
Domain: true,
|
|
35
|
+
Events: true,
|
|
36
|
+
Helpers: true,
|
|
37
|
+
Immutable: true,
|
|
38
|
+
LabelHelpers: true,
|
|
39
|
+
Log: true,
|
|
40
|
+
PropTypes: true,
|
|
41
|
+
Scale: true,
|
|
42
|
+
Selection: true,
|
|
43
|
+
Style: true,
|
|
44
|
+
TextSize: true,
|
|
45
|
+
Timer: true,
|
|
46
|
+
Transitions: true,
|
|
47
|
+
CommonProps: true,
|
|
48
|
+
Wrapper: true,
|
|
49
|
+
Axis: true,
|
|
50
|
+
TimerContext: true,
|
|
51
|
+
PortalContext: true,
|
|
52
|
+
LineHelpers: true,
|
|
53
|
+
PointPathHelpers: true
|
|
54
|
+
};
|
|
6
55
|
Object.defineProperty(exports, "VictoryAccessibleGroup", {
|
|
7
56
|
enumerable: true,
|
|
8
57
|
get: function () {
|
|
@@ -153,12 +202,6 @@ Object.defineProperty(exports, "Timer", {
|
|
|
153
202
|
return _timer.default;
|
|
154
203
|
}
|
|
155
204
|
});
|
|
156
|
-
Object.defineProperty(exports, "Wrapper", {
|
|
157
|
-
enumerable: true,
|
|
158
|
-
get: function () {
|
|
159
|
-
return _wrapper.default;
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
205
|
Object.defineProperty(exports, "TimerContext", {
|
|
163
206
|
enumerable: true,
|
|
164
207
|
get: function () {
|
|
@@ -171,7 +214,13 @@ Object.defineProperty(exports, "PortalContext", {
|
|
|
171
214
|
return _portalContext.default;
|
|
172
215
|
}
|
|
173
216
|
});
|
|
174
|
-
|
|
217
|
+
Object.defineProperty(exports, "PointPathHelpers", {
|
|
218
|
+
enumerable: true,
|
|
219
|
+
get: function () {
|
|
220
|
+
return _pointPathHelpers.default;
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
exports.LineHelpers = exports.Axis = exports.Wrapper = exports.CommonProps = exports.Transitions = exports.TextSize = exports.Style = exports.Selection = exports.Scale = exports.PropTypes = exports.Log = exports.LabelHelpers = exports.Immutable = exports.Helpers = exports.Events = exports.Domain = exports.DefaultTransitions = exports.Data = exports.Collection = void 0;
|
|
175
224
|
|
|
176
225
|
var _victoryAccessibleGroup = _interopRequireDefault(require("./victory-accessible-group/victory-accessible-group"));
|
|
177
226
|
|
|
@@ -285,7 +334,9 @@ var _CommonProps = _interopRequireWildcard(require("./victory-util/common-props"
|
|
|
285
334
|
|
|
286
335
|
exports.CommonProps = _CommonProps;
|
|
287
336
|
|
|
288
|
-
var
|
|
337
|
+
var _Wrapper = _interopRequireWildcard(require("./victory-util/wrapper"));
|
|
338
|
+
|
|
339
|
+
exports.Wrapper = _Wrapper;
|
|
289
340
|
|
|
290
341
|
var _Axis = _interopRequireWildcard(require("./victory-util/axis"));
|
|
291
342
|
|
|
@@ -295,6 +346,25 @@ var _timerContext = _interopRequireDefault(require("./victory-util/timer-context
|
|
|
295
346
|
|
|
296
347
|
var _portalContext = _interopRequireDefault(require("./victory-portal/portal-context"));
|
|
297
348
|
|
|
349
|
+
var _hooks = require("./victory-util/hooks");
|
|
350
|
+
|
|
351
|
+
Object.keys(_hooks).forEach(function (key) {
|
|
352
|
+
if (key === "default" || key === "__esModule") return;
|
|
353
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
354
|
+
Object.defineProperty(exports, key, {
|
|
355
|
+
enumerable: true,
|
|
356
|
+
get: function () {
|
|
357
|
+
return _hooks[key];
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
var _LineHelpers = _interopRequireWildcard(require("./victory-util/line-helpers"));
|
|
363
|
+
|
|
364
|
+
exports.LineHelpers = _LineHelpers;
|
|
365
|
+
|
|
366
|
+
var _pointPathHelpers = _interopRequireDefault(require("./victory-util/point-path-helpers"));
|
|
367
|
+
|
|
298
368
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
|
299
369
|
|
|
300
370
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -23,9 +23,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
23
23
|
|
|
24
24
|
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, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
25
25
|
|
|
26
|
-
var VictoryAccessibleGroup =
|
|
27
|
-
/*#__PURE__*/
|
|
28
|
-
function (_React$Component) {
|
|
26
|
+
var VictoryAccessibleGroup = /*#__PURE__*/function (_React$Component) {
|
|
29
27
|
_inherits(VictoryAccessibleGroup, _React$Component);
|
|
30
28
|
|
|
31
29
|
function VictoryAccessibleGroup() {
|
|
@@ -41,9 +41,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
|
41
41
|
|
|
42
42
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
43
43
|
|
|
44
|
-
var VictoryAnimation =
|
|
45
|
-
/*#__PURE__*/
|
|
46
|
-
function (_React$Component) {
|
|
44
|
+
var VictoryAnimation = /*#__PURE__*/function (_React$Component) {
|
|
47
45
|
_inherits(VictoryAnimation, _React$Component);
|
|
48
46
|
|
|
49
47
|
function VictoryAnimation(props, context) {
|
|
@@ -55,9 +55,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
55
55
|
|
|
56
56
|
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, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
57
57
|
|
|
58
|
-
var VictoryClipContainer =
|
|
59
|
-
/*#__PURE__*/
|
|
60
|
-
function (_React$Component) {
|
|
58
|
+
var VictoryClipContainer = /*#__PURE__*/function (_React$Component) {
|
|
61
59
|
_inherits(VictoryClipContainer, _React$Component);
|
|
62
60
|
|
|
63
61
|
function VictoryClipContainer(props) {
|
|
@@ -51,9 +51,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
51
51
|
|
|
52
52
|
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, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
53
53
|
|
|
54
|
-
var VictoryContainer =
|
|
55
|
-
/*#__PURE__*/
|
|
56
|
-
function (_React$Component) {
|
|
54
|
+
var VictoryContainer = /*#__PURE__*/function (_React$Component) {
|
|
57
55
|
_inherits(VictoryContainer, _React$Component);
|
|
58
56
|
|
|
59
57
|
function VictoryContainer(props) {
|
|
@@ -93,7 +93,7 @@ var getSingleValue = function (prop) {
|
|
|
93
93
|
return Array.isArray(prop) ? prop[index] || prop[0] : prop;
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
-
var
|
|
96
|
+
var shouldUseMultilineBackgrounds = function (props) {
|
|
97
97
|
var backgroundStyle = props.backgroundStyle,
|
|
98
98
|
backgroundPadding = props.backgroundPadding;
|
|
99
99
|
return Array.isArray(backgroundStyle) && !(0, _isEmpty2.default)(backgroundStyle) || Array.isArray(backgroundPadding) && !(0, _isEmpty2.default)(backgroundPadding);
|
|
@@ -385,7 +385,7 @@ var getChildBackgrounds = function (calculatedProps, tspanValues) {
|
|
|
385
385
|
};
|
|
386
386
|
|
|
387
387
|
var getBackgroundElement = function (calculatedProps, tspanValues) {
|
|
388
|
-
return
|
|
388
|
+
return shouldUseMultilineBackgrounds(calculatedProps) ? getChildBackgrounds(calculatedProps, tspanValues) : getFullBackground(calculatedProps, tspanValues);
|
|
389
389
|
};
|
|
390
390
|
|
|
391
391
|
var calculateSpanDy = function (tspanValues, i, calculatedProps) {
|
|
@@ -396,7 +396,7 @@ var calculateSpanDy = function (tspanValues, i, calculatedProps) {
|
|
|
396
396
|
var previousCaps = previous.fontSize - previous.capHeight;
|
|
397
397
|
var currentCaps = current.fontSize - current.capHeight;
|
|
398
398
|
var textHeight = previousHeight - previous.fontSize / 2 + current.fontSize / 2 - previousHeight / 2 + currentHeight / 2 - currentCaps / 2 + previousCaps / 2;
|
|
399
|
-
return
|
|
399
|
+
return shouldUseMultilineBackgrounds(calculatedProps) ? textHeight + current.backgroundPadding.top + previous.backgroundPadding.bottom : textHeight;
|
|
400
400
|
};
|
|
401
401
|
|
|
402
402
|
var getTSpanDy = function (tspanValues, calculatedProps, i) {
|
|
@@ -29,9 +29,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
|
29
29
|
|
|
30
30
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
31
31
|
|
|
32
|
-
var Portal =
|
|
33
|
-
/*#__PURE__*/
|
|
34
|
-
function (_React$Component) {
|
|
32
|
+
var Portal = /*#__PURE__*/function (_React$Component) {
|
|
35
33
|
_inherits(Portal, _React$Component);
|
|
36
34
|
|
|
37
35
|
function Portal(props) {
|
|
@@ -33,9 +33,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
33
33
|
|
|
34
34
|
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, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
35
35
|
|
|
36
|
-
var VictoryPortal =
|
|
37
|
-
/*#__PURE__*/
|
|
38
|
-
function (_React$Component) {
|
|
36
|
+
var VictoryPortal = /*#__PURE__*/function (_React$Component) {
|
|
39
37
|
_inherits(VictoryPortal, _React$Component);
|
|
40
38
|
|
|
41
39
|
function VictoryPortal() {
|
|
@@ -13,7 +13,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
13
13
|
|
|
14
14
|
var Helpers = _interopRequireWildcard(require("../victory-util/helpers"));
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _pointPathHelpers = _interopRequireDefault(require("../victory-util/point-path-helpers"));
|
|
17
17
|
|
|
18
18
|
var CommonProps = _interopRequireWildcard(require("../victory-util/common-props"));
|
|
19
19
|
|
|
@@ -38,15 +38,15 @@ var getPath = function (props) {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
var pathFunctions = {
|
|
41
|
-
circle:
|
|
42
|
-
square:
|
|
43
|
-
diamond:
|
|
44
|
-
triangleDown:
|
|
45
|
-
triangleUp:
|
|
46
|
-
plus:
|
|
47
|
-
minus:
|
|
48
|
-
star:
|
|
49
|
-
cross:
|
|
41
|
+
circle: _pointPathHelpers.default.circle,
|
|
42
|
+
square: _pointPathHelpers.default.square,
|
|
43
|
+
diamond: _pointPathHelpers.default.diamond,
|
|
44
|
+
triangleDown: _pointPathHelpers.default.triangleDown,
|
|
45
|
+
triangleUp: _pointPathHelpers.default.triangleUp,
|
|
46
|
+
plus: _pointPathHelpers.default.plus,
|
|
47
|
+
minus: _pointPathHelpers.default.minus,
|
|
48
|
+
star: _pointPathHelpers.default.star,
|
|
49
|
+
cross: _pointPathHelpers.default.cross
|
|
50
50
|
};
|
|
51
51
|
var symbolFunction = typeof pathFunctions[symbol] === "function" ? pathFunctions[symbol] : pathFunctions.circle;
|
|
52
52
|
return symbolFunction(x, y, size);
|
|
@@ -47,9 +47,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
|
47
47
|
|
|
48
48
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
49
49
|
|
|
50
|
-
var VictoryTransition =
|
|
51
|
-
/*#__PURE__*/
|
|
52
|
-
function (_React$Component) {
|
|
50
|
+
var VictoryTransition = /*#__PURE__*/function (_React$Component) {
|
|
53
51
|
_inherits(VictoryTransition, _React$Component);
|
|
54
52
|
|
|
55
53
|
function VictoryTransition(props, context) {
|