victory-core 36.9.2 → 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.
Files changed (110) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/victory-core.js +4371 -5749
  3. package/dist/victory-core.min.js +1 -1
  4. package/es/victory-accessible-group/victory-accessible-group.js +9 -15
  5. package/es/victory-animation/util.js +28 -47
  6. package/es/victory-animation/victory-animation.js +51 -67
  7. package/es/victory-clip-container/victory-clip-container.js +153 -229
  8. package/es/victory-container/victory-container.js +157 -216
  9. package/es/victory-label/victory-label.js +246 -323
  10. package/es/victory-portal/portal-context.js +1 -2
  11. package/es/victory-portal/portal.js +30 -76
  12. package/es/victory-portal/victory-portal.js +47 -104
  13. package/es/victory-primitives/arc.js +44 -47
  14. package/es/victory-primitives/background.js +14 -17
  15. package/es/victory-primitives/border.js +20 -24
  16. package/es/victory-primitives/circle.js +13 -27
  17. package/es/victory-primitives/clip-path.js +3 -7
  18. package/es/victory-primitives/line-segment.js +20 -24
  19. package/es/victory-primitives/line.js +13 -27
  20. package/es/victory-primitives/path.js +13 -27
  21. package/es/victory-primitives/point.js +36 -40
  22. package/es/victory-primitives/rect.js +13 -27
  23. package/es/victory-primitives/text.js +15 -28
  24. package/es/victory-primitives/tspan.js +13 -26
  25. package/es/victory-primitives/whisker.js +43 -47
  26. package/es/victory-theme/grayscale.js +22 -22
  27. package/es/victory-theme/material.js +46 -46
  28. package/es/victory-theme/victory-theme.js +3 -3
  29. package/es/victory-transition/victory-transition.js +126 -206
  30. package/es/victory-util/add-events.js +263 -374
  31. package/es/victory-util/axis.js +126 -222
  32. package/es/victory-util/collection.js +13 -41
  33. package/es/victory-util/data.js +159 -214
  34. package/es/victory-util/default-transitions.js +33 -51
  35. package/es/victory-util/domain.js +122 -171
  36. package/es/victory-util/events.js +168 -258
  37. package/es/victory-util/helpers.js +153 -178
  38. package/es/victory-util/hooks/use-animation-state.js +61 -99
  39. package/es/victory-util/hooks/use-previous-props.js +2 -2
  40. package/es/victory-util/immutable.js +6 -8
  41. package/es/victory-util/label-helpers.js +128 -130
  42. package/es/victory-util/line-helpers.js +29 -41
  43. package/es/victory-util/log.js +1 -1
  44. package/es/victory-util/point-path-helpers.js +89 -49
  45. package/es/victory-util/scale.js +24 -42
  46. package/es/victory-util/selection.js +39 -40
  47. package/es/victory-util/style.js +8 -13
  48. package/es/victory-util/textsize.js +80 -154
  49. package/es/victory-util/timer-context.js +2 -2
  50. package/es/victory-util/timer.js +40 -76
  51. package/es/victory-util/transitions.js +110 -150
  52. package/es/victory-util/type-helpers.js +2 -3
  53. package/es/victory-util/user-props.js +24 -49
  54. package/es/victory-util/wrapper.js +184 -247
  55. package/lib/index.js +0 -30
  56. package/lib/victory-accessible-group/victory-accessible-group.js +9 -19
  57. package/lib/victory-animation/util.js +28 -63
  58. package/lib/victory-animation/victory-animation.js +54 -83
  59. package/lib/victory-clip-container/victory-clip-container.js +156 -243
  60. package/lib/victory-container/victory-container.js +160 -232
  61. package/lib/victory-label/victory-label.js +248 -344
  62. package/lib/victory-portal/portal-context.js +1 -6
  63. package/lib/victory-portal/portal.js +31 -81
  64. package/lib/victory-portal/victory-portal.js +50 -116
  65. package/lib/victory-primitives/arc.js +48 -57
  66. package/lib/victory-primitives/background.js +16 -28
  67. package/lib/victory-primitives/border.js +22 -34
  68. package/lib/victory-primitives/circle.js +16 -36
  69. package/lib/victory-primitives/clip-path.js +3 -11
  70. package/lib/victory-primitives/index.js +0 -28
  71. package/lib/victory-primitives/line-segment.js +22 -34
  72. package/lib/victory-primitives/line.js +16 -36
  73. package/lib/victory-primitives/path.js +16 -36
  74. package/lib/victory-primitives/point.js +38 -52
  75. package/lib/victory-primitives/rect.js +16 -36
  76. package/lib/victory-primitives/text.js +15 -33
  77. package/lib/victory-primitives/tspan.js +13 -31
  78. package/lib/victory-primitives/whisker.js +45 -57
  79. package/lib/victory-theme/grayscale.js +23 -24
  80. package/lib/victory-theme/material.js +47 -48
  81. package/lib/victory-theme/victory-theme.js +2 -7
  82. package/lib/victory-transition/victory-transition.js +129 -224
  83. package/lib/victory-util/add-events.js +263 -380
  84. package/lib/victory-util/axis.js +128 -241
  85. package/lib/victory-util/collection.js +13 -50
  86. package/lib/victory-util/data.js +160 -239
  87. package/lib/victory-util/default-transitions.js +33 -54
  88. package/lib/victory-util/domain.js +123 -193
  89. package/lib/victory-util/events.js +167 -274
  90. package/lib/victory-util/helpers.js +156 -207
  91. package/lib/victory-util/hooks/index.js +0 -2
  92. package/lib/victory-util/hooks/use-animation-state.js +63 -113
  93. package/lib/victory-util/hooks/use-previous-props.js +2 -7
  94. package/lib/victory-util/immutable.js +6 -18
  95. package/lib/victory-util/index.js +2 -51
  96. package/lib/victory-util/label-helpers.js +130 -141
  97. package/lib/victory-util/line-helpers.js +31 -49
  98. package/lib/victory-util/log.js +1 -2
  99. package/lib/victory-util/point-path-helpers.js +91 -63
  100. package/lib/victory-util/scale.js +26 -57
  101. package/lib/victory-util/selection.js +41 -49
  102. package/lib/victory-util/style.js +8 -16
  103. package/lib/victory-util/textsize.js +80 -157
  104. package/lib/victory-util/timer-context.js +2 -8
  105. package/lib/victory-util/timer.js +40 -76
  106. package/lib/victory-util/transitions.js +110 -152
  107. package/lib/victory-util/type-helpers.js +2 -9
  108. package/lib/victory-util/user-props.js +25 -59
  109. package/lib/victory-util/wrapper.js +186 -281
  110. package/package.json +2 -2
@@ -4,16 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.PortalContext = void 0;
7
-
8
7
  var _react = _interopRequireDefault(require("react"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
9
  /**
13
10
  * The React context object consumers may use to access the context of the
14
11
  * portal.
15
12
  */
16
- var PortalContext = /*#__PURE__*/_react.default.createContext({});
17
-
18
- exports.PortalContext = PortalContext;
13
+ const PortalContext = exports.PortalContext = /*#__PURE__*/_react.default.createContext({});
19
14
  PortalContext.displayName = "PortalContext";
@@ -4,88 +4,38 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Portal = void 0;
7
-
8
7
  var _react = _interopRequireDefault(require("react"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
13
-
14
- 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); } }
15
-
16
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
17
-
18
- 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); }
19
-
20
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
21
-
22
- 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); }; }
23
-
24
- 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); }
25
-
26
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
27
-
28
- 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; } }
29
-
30
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
31
-
32
- var Portal = /*#__PURE__*/function (_ref) {
33
- _inherits(Portal, _ref);
34
-
35
- var _super = _createSuper(Portal);
36
-
37
- function Portal(props) {
38
- var _this;
39
-
40
- _classCallCheck(this, Portal);
41
-
42
- _this = _super.call(this, props);
43
- _this.map = void 0;
44
- _this.index = void 0;
45
-
46
- _this.portalRegister = function () {
47
- return ++_this.index;
48
- };
49
-
50
- _this.portalUpdate = function (key, element) {
51
- _this.map[key] = element;
52
-
53
- _this.forceUpdate();
54
- };
55
-
56
- _this.portalDeregister = function (key) {
57
- delete _this.map[key];
58
-
59
- _this.forceUpdate();
60
- };
61
-
62
- _this.map = {};
63
- _this.index = 1;
64
- return _this;
9
+ class Portal extends _react.default.Component {
10
+ static displayName = "Portal";
11
+ constructor(props) {
12
+ super(props);
13
+ this.map = {};
14
+ this.index = 1;
15
+ }
16
+ portalRegister = () => {
17
+ return ++this.index;
18
+ };
19
+ portalUpdate = (key, element) => {
20
+ this.map[key] = element;
21
+ this.forceUpdate();
22
+ };
23
+ portalDeregister = key => {
24
+ delete this.map[key];
25
+ this.forceUpdate();
26
+ };
27
+ getChildren() {
28
+ return Object.keys(this.map).map(key => {
29
+ const el = this.map[key];
30
+ return el ? /*#__PURE__*/_react.default.cloneElement(el, {
31
+ key
32
+ }) : el;
33
+ });
65
34
  }
66
35
 
67
- _createClass(Portal, [{
68
- key: "getChildren",
69
- value: function getChildren() {
70
- var _this2 = this;
71
-
72
- return Object.keys(this.map).map(function (key) {
73
- var el = _this2.map[key];
74
- return el ? /*#__PURE__*/_react.default.cloneElement(el, {
75
- key: key
76
- }) : el;
77
- });
78
- } // Overridden in victory-core-native
79
-
80
- }, {
81
- key: "render",
82
- value: function render() {
83
- return /*#__PURE__*/_react.default.createElement("svg", this.props, this.getChildren());
84
- }
85
- }]);
86
-
87
- return Portal;
88
- }(_react.default.Component);
89
-
90
- exports.Portal = Portal;
91
- Portal.displayName = "Portal";
36
+ // Overridden in victory-core-native
37
+ render() {
38
+ return /*#__PURE__*/_react.default.createElement("svg", this.props, this.getChildren());
39
+ }
40
+ }
41
+ exports.Portal = Portal;
@@ -4,131 +4,65 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.VictoryPortal = void 0;
7
-
8
7
  var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
9
-
10
8
  var _react = _interopRequireDefault(require("react"));
11
-
12
9
  var Log = _interopRequireWildcard(require("../victory-util/log"));
13
-
14
10
  var Helpers = _interopRequireWildcard(require("../victory-util/helpers"));
15
-
16
11
  var _portalContext = require("./portal-context");
17
-
18
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
-
20
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
-
12
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
22
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
25
-
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
-
28
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
29
-
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); }
31
-
32
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
33
-
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); }; }
35
-
36
- 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); }
37
-
38
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
39
-
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; } }
41
-
42
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
43
-
44
- var VictoryPortal = /*#__PURE__*/function (_React$Component) {
45
- _inherits(VictoryPortal, _React$Component);
46
-
47
- var _super = _createSuper(VictoryPortal);
48
-
49
- function VictoryPortal() {
50
- var _this;
51
-
52
- _classCallCheck(this, VictoryPortal);
53
-
54
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
55
- args[_key] = arguments[_key];
56
- }
57
-
58
- _this = _super.call.apply(_super, [this].concat(args));
59
- _this.checkedContext = void 0;
60
- _this.portalKey = void 0;
61
- _this.renderInPlace = void 0;
62
- _this.element = void 0;
63
- return _this;
64
- }
65
-
66
- _createClass(VictoryPortal, [{
67
- key: "componentDidMount",
68
- value: function componentDidMount() {
69
- if (!this.checkedContext) {
70
- if (typeof this.context.portalUpdate !== "function") {
71
- var msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
72
- Log.warn(msg);
73
- this.renderInPlace = true;
74
- }
75
-
76
- this.checkedContext = true;
15
+ class VictoryPortal extends _react.default.Component {
16
+ static displayName = "VictoryPortal";
17
+ static role = "portal";
18
+ static defaultProps = {
19
+ groupComponent: /*#__PURE__*/_react.default.createElement("g", null)
20
+ };
21
+ static contextType = _portalContext.PortalContext;
22
+ componentDidMount() {
23
+ if (!this.checkedContext) {
24
+ if (typeof this.context.portalUpdate !== "function") {
25
+ const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
26
+ Log.warn(msg);
27
+ this.renderInPlace = true;
77
28
  }
78
-
79
- this.forceUpdate();
29
+ this.checkedContext = true;
80
30
  }
81
- }, {
82
- key: "componentDidUpdate",
83
- value: function componentDidUpdate() {
84
- if (!this.renderInPlace) {
85
- this.portalKey = this.portalKey || this.context.portalRegister();
86
- this.context.portalUpdate(this.portalKey, this.element);
87
- }
31
+ this.forceUpdate();
32
+ }
33
+ componentDidUpdate() {
34
+ if (!this.renderInPlace) {
35
+ this.portalKey = this.portalKey || this.context.portalRegister();
36
+ this.context.portalUpdate(this.portalKey, this.element);
88
37
  }
89
- }, {
90
- key: "componentWillUnmount",
91
- value: function componentWillUnmount() {
92
- if (this.context && this.context.portalDeregister) {
93
- this.context.portalDeregister(this.portalKey);
94
- }
95
- } // Overridden in victory-core-native
96
-
97
- }, {
98
- key: "renderPortal",
99
- value: function renderPortal(child) {
100
- if (this.renderInPlace) {
101
- return child;
102
- }
103
-
104
- this.element = child;
105
- return null;
38
+ }
39
+ componentWillUnmount() {
40
+ if (this.context && this.context.portalDeregister) {
41
+ this.context.portalDeregister(this.portalKey);
106
42
  }
107
- }, {
108
- key: "render",
109
- value: function render() {
110
- var children = Array.isArray(this.props.children) ? this.props.children[0] : this.props.children;
111
- var groupComponent = this.props.groupComponent;
112
- var childProps = children && children.props || {};
113
- var standardProps = childProps.groupComponent ? {
114
- groupComponent: groupComponent,
115
- standalone: false
116
- } : {};
117
- var newProps = (0, _defaults2.default)(standardProps, childProps, Helpers.omit(this.props, ["children", "groupComponent"]));
118
-
119
- var child = children && /*#__PURE__*/_react.default.cloneElement(children, newProps);
43
+ }
120
44
 
121
- return this.renderPortal(child);
45
+ // Overridden in victory-core-native
46
+ renderPortal(child) {
47
+ if (this.renderInPlace) {
48
+ return child;
122
49
  }
123
- }]);
124
-
125
- return VictoryPortal;
126
- }(_react.default.Component);
127
-
128
- exports.VictoryPortal = VictoryPortal;
129
- VictoryPortal.displayName = "VictoryPortal";
130
- VictoryPortal.role = "portal";
131
- VictoryPortal.defaultProps = {
132
- groupComponent: /*#__PURE__*/_react.default.createElement("g", null)
133
- };
134
- VictoryPortal.contextType = _portalContext.PortalContext;
50
+ this.element = child;
51
+ return null;
52
+ }
53
+ render() {
54
+ const children = Array.isArray(this.props.children) ? this.props.children[0] : this.props.children;
55
+ const {
56
+ groupComponent
57
+ } = this.props;
58
+ const childProps = children && children.props || {};
59
+ const standardProps = childProps.groupComponent ? {
60
+ groupComponent,
61
+ standalone: false
62
+ } : {};
63
+ const newProps = (0, _defaults2.default)(standardProps, childProps, Helpers.omit(this.props, ["children", "groupComponent"]));
64
+ const child = children && /*#__PURE__*/_react.default.cloneElement(children, newProps);
65
+ return this.renderPortal(child);
66
+ }
67
+ }
68
+ exports.VictoryPortal = VictoryPortal;
@@ -4,50 +4,40 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Arc = void 0;
7
-
8
7
  var _react = _interopRequireDefault(require("react"));
9
-
10
8
  var Helpers = _interopRequireWildcard(require("../victory-util/helpers"));
11
-
12
9
  var _path = require("./path");
13
-
14
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
-
16
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
-
10
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
11
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- 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; }
21
-
22
- 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; }
23
-
24
- 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; }
25
-
26
- var getArcPath = function (props) {
27
- var cx = props.cx,
28
- cy = props.cy,
29
- r = props.r,
30
- startAngle = props.startAngle,
31
- endAngle = props.endAngle,
32
- closedPath = props.closedPath; // Always draw the path as two arcs so that complete circles may be rendered.
33
-
34
- var halfAngle = Math.abs(endAngle - startAngle) / 2 + startAngle;
35
- var x1 = cx + r * Math.cos(Helpers.degreesToRadians(startAngle));
36
- var y1 = cy - r * Math.sin(Helpers.degreesToRadians(startAngle));
37
- var x2 = cx + r * Math.cos(Helpers.degreesToRadians(halfAngle));
38
- var y2 = cy - r * Math.sin(Helpers.degreesToRadians(halfAngle));
39
- var x3 = cx + r * Math.cos(Helpers.degreesToRadians(endAngle));
40
- var y3 = cy - r * Math.sin(Helpers.degreesToRadians(endAngle));
41
- var largerArcFlag1 = halfAngle - startAngle <= 180 ? 0 : 1;
42
- var largerArcFlag2 = endAngle - halfAngle <= 180 ? 0 : 1;
43
- var arcStart = closedPath ? " M ".concat(cx, ", ").concat(cy, " L ").concat(x1, ", ").concat(y1) : "M ".concat(x1, ", ").concat(y1);
44
- var arc1 = "A ".concat(r, ", ").concat(r, ", 0, ").concat(largerArcFlag1, ", 0, ").concat(x2, ", ").concat(y2);
45
- var arc2 = "A ".concat(r, ", ").concat(r, ", 0, ").concat(largerArcFlag2, ", 0, ").concat(x3, ", ").concat(y3);
46
- var arcEnd = closedPath ? "Z" : "";
47
- return "".concat(arcStart, " ").concat(arc1, " ").concat(arc2, " ").concat(arcEnd);
13
+ /* eslint no-magic-numbers: ["error", { "ignore": [0, 1, 2, 180] }]*/
14
+
15
+ const getArcPath = props => {
16
+ const {
17
+ cx,
18
+ cy,
19
+ r,
20
+ startAngle,
21
+ endAngle,
22
+ closedPath
23
+ } = props;
24
+ // Always draw the path as two arcs so that complete circles may be rendered.
25
+ const halfAngle = Math.abs(endAngle - startAngle) / 2 + startAngle;
26
+ const x1 = cx + r * Math.cos(Helpers.degreesToRadians(startAngle));
27
+ const y1 = cy - r * Math.sin(Helpers.degreesToRadians(startAngle));
28
+ const x2 = cx + r * Math.cos(Helpers.degreesToRadians(halfAngle));
29
+ const y2 = cy - r * Math.sin(Helpers.degreesToRadians(halfAngle));
30
+ const x3 = cx + r * Math.cos(Helpers.degreesToRadians(endAngle));
31
+ const y3 = cy - r * Math.sin(Helpers.degreesToRadians(endAngle));
32
+ const largerArcFlag1 = halfAngle - startAngle <= 180 ? 0 : 1;
33
+ const largerArcFlag2 = endAngle - halfAngle <= 180 ? 0 : 1;
34
+ const arcStart = closedPath ? ` M ${cx}, ${cy} L ${x1}, ${y1}` : `M ${x1}, ${y1}`;
35
+ const arc1 = `A ${r}, ${r}, 0, ${largerArcFlag1}, 0, ${x2}, ${y2}`;
36
+ const arc2 = `A ${r}, ${r}, 0, ${largerArcFlag2}, 0, ${x3}, ${y3}`;
37
+ const arcEnd = closedPath ? "Z" : "";
38
+ return `${arcStart} ${arc1} ${arc2} ${arcEnd}`;
48
39
  };
49
-
50
- var evaluateProps = function (props) {
40
+ const evaluateProps = props => {
51
41
  /**
52
42
  * Potential evaluated props are:
53
43
  * `ariaLabel`
@@ -56,32 +46,34 @@ var evaluateProps = function (props) {
56
46
  * `style`
57
47
  * `tabIndex`
58
48
  */
59
- var ariaLabel = Helpers.evaluateProp(props.ariaLabel, props);
60
- var desc = Helpers.evaluateProp(props.desc, props);
61
- var id = Helpers.evaluateProp(props.id, props);
62
- var style = Helpers.evaluateStyle(Object.assign({
49
+ const ariaLabel = Helpers.evaluateProp(props.ariaLabel, props);
50
+ const desc = Helpers.evaluateProp(props.desc, props);
51
+ const id = Helpers.evaluateProp(props.id, props);
52
+ const style = Helpers.evaluateStyle(Object.assign({
63
53
  stroke: "black",
64
54
  fill: "none"
65
55
  }, props.style), props);
66
- var tabIndex = Helpers.evaluateProp(props.tabIndex, props);
56
+ const tabIndex = Helpers.evaluateProp(props.tabIndex, props);
67
57
  return Object.assign({}, props, {
68
- ariaLabel: ariaLabel,
69
- desc: desc,
70
- id: id,
71
- style: style,
72
- tabIndex: tabIndex
58
+ ariaLabel,
59
+ desc,
60
+ id,
61
+ style,
62
+ tabIndex
73
63
  });
74
64
  };
75
-
76
- var defaultProps = {
65
+ const defaultProps = {
77
66
  pathComponent: /*#__PURE__*/_react.default.createElement(_path.Path, null),
78
67
  role: "presentation",
79
68
  shapeRendering: "auto"
80
69
  };
81
-
82
- var Arc = function (initialProps) {
83
- var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps));
84
- return /*#__PURE__*/_react.default.cloneElement(props.pathComponent, _objectSpread(_objectSpread({}, props.events), {}, {
70
+ const Arc = initialProps => {
71
+ const props = evaluateProps({
72
+ ...defaultProps,
73
+ ...initialProps
74
+ });
75
+ return /*#__PURE__*/_react.default.cloneElement(props.pathComponent, {
76
+ ...props.events,
85
77
  "aria-label": props.ariaLabel,
86
78
  d: getArcPath(props),
87
79
  style: props.style,
@@ -92,7 +84,6 @@ var Arc = function (initialProps) {
92
84
  shapeRendering: props.shapeRendering,
93
85
  transform: props.transform,
94
86
  clipPath: props.clipPath
95
- }));
87
+ });
96
88
  };
97
-
98
89
  exports.Arc = Arc;
@@ -4,48 +4,36 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Background = void 0;
7
-
8
7
  var _react = _interopRequireDefault(require("react"));
9
-
10
8
  var Helpers = _interopRequireWildcard(require("../victory-util/helpers"));
11
-
12
9
  var _rect = require("./rect");
13
-
14
10
  var _circle = require("./circle");
15
-
16
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
-
18
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
-
11
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
12
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
20
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
-
22
- 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; }
23
-
24
- 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; }
25
-
26
- 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; }
27
-
28
- var evaluateProps = function (props) {
14
+ const evaluateProps = props => {
29
15
  /**
30
16
  * Potential evaluated prop is:
31
17
  * `id`
32
18
  */
33
- var id = Helpers.evaluateProp(props.id, props);
19
+ const id = Helpers.evaluateProp(props.id, props);
34
20
  return Object.assign({}, props, {
35
- id: id
21
+ id
36
22
  });
37
23
  };
38
-
39
- var defaultProps = {
24
+ const defaultProps = {
40
25
  circleComponent: /*#__PURE__*/_react.default.createElement(_circle.Circle, null),
41
26
  rectComponent: /*#__PURE__*/_react.default.createElement(_rect.Rect, null),
42
27
  role: "presentation",
43
28
  shapeRendering: "auto"
44
29
  };
45
-
46
- var Background = function (initialProps) {
47
- var props = evaluateProps(_objectSpread(_objectSpread({}, defaultProps), initialProps));
48
- return props.polar ? /*#__PURE__*/_react.default.cloneElement(props.circleComponent, _objectSpread(_objectSpread({}, props.events), {}, {
30
+ const Background = initialProps => {
31
+ const props = evaluateProps({
32
+ ...defaultProps,
33
+ ...initialProps
34
+ });
35
+ return props.polar ? /*#__PURE__*/_react.default.cloneElement(props.circleComponent, {
36
+ ...props.events,
49
37
  style: props.style,
50
38
  role: props.role,
51
39
  shapeRendering: props.shapeRendering,
@@ -53,7 +41,8 @@ var Background = function (initialProps) {
53
41
  cy: props.y,
54
42
  r: props.height,
55
43
  className: props.className
56
- })) : /*#__PURE__*/_react.default.cloneElement(props.rectComponent, _objectSpread(_objectSpread({}, props.events), {}, {
44
+ }) : /*#__PURE__*/_react.default.cloneElement(props.rectComponent, {
45
+ ...props.events,
57
46
  style: props.style,
58
47
  role: props.role,
59
48
  shapeRendering: props.shapeRendering,
@@ -64,7 +53,6 @@ var Background = function (initialProps) {
64
53
  width: props.width,
65
54
  height: props.height,
66
55
  className: props.className
67
- }));
56
+ });
68
57
  };
69
-
70
58
  exports.Background = Background;