victory-core 36.3.0 → 36.4.1

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 (102) hide show
  1. package/dist/victory-core.js +14792 -14613
  2. package/dist/victory-core.min.js +1 -1
  3. package/es/index.js +2 -0
  4. package/es/victory-accessible-group/victory-accessible-group.js +38 -40
  5. package/es/victory-animation/util.js +1 -1
  6. package/es/victory-animation/victory-animation.js +46 -48
  7. package/es/victory-clip-container/victory-clip-container.js +74 -75
  8. package/es/victory-container/victory-container.js +86 -94
  9. package/es/victory-label/victory-label.js +32 -25
  10. package/es/victory-portal/portal-context.js +1 -1
  11. package/es/victory-portal/portal.js +28 -26
  12. package/es/victory-portal/victory-portal.js +31 -41
  13. package/es/victory-primitives/arc.js +6 -4
  14. package/es/victory-primitives/background.js +8 -6
  15. package/es/victory-primitives/border.js +6 -4
  16. package/es/victory-primitives/circle.js +8 -4
  17. package/es/victory-primitives/clip-path.js +1 -1
  18. package/es/victory-primitives/line-segment.js +6 -4
  19. package/es/victory-primitives/line.js +8 -4
  20. package/es/victory-primitives/path.js +7 -3
  21. package/es/victory-primitives/point.js +6 -4
  22. package/es/victory-primitives/rect.js +8 -4
  23. package/es/victory-primitives/text.js +7 -3
  24. package/es/victory-primitives/tspan.js +1 -1
  25. package/es/victory-primitives/whisker.js +9 -7
  26. package/es/victory-transition/victory-transition.js +30 -32
  27. package/es/victory-util/add-events.js +324 -315
  28. package/es/victory-util/axis.js +12 -5
  29. package/es/victory-util/collection.js +8 -4
  30. package/es/victory-util/common-props.js +2 -2
  31. package/es/victory-util/data.js +9 -5
  32. package/es/victory-util/domain.js +8 -4
  33. package/es/victory-util/events.js +8 -4
  34. package/es/victory-util/helpers.js +1 -1
  35. package/es/victory-util/hooks/use-animation-state.js +11 -5
  36. package/es/victory-util/line-helpers.js +1 -1
  37. package/es/victory-util/scale.js +19 -19
  38. package/es/victory-util/textsize.js +11 -7
  39. package/es/victory-util/timer-context.js +1 -1
  40. package/es/victory-util/timer.js +3 -5
  41. package/es/victory-util/user-props.js +123 -0
  42. package/es/victory-util/wrapper.js +18 -12
  43. package/lib/index.js +72 -58
  44. package/lib/victory-accessible-group/victory-accessible-group.js +38 -40
  45. package/lib/victory-animation/util.js +2 -2
  46. package/lib/victory-animation/victory-animation.js +49 -49
  47. package/lib/victory-clip-container/victory-clip-container.js +78 -76
  48. package/lib/victory-container/victory-container.js +90 -95
  49. package/lib/victory-label/victory-label.js +38 -27
  50. package/lib/victory-portal/portal-context.js +1 -1
  51. package/lib/victory-portal/portal.js +31 -27
  52. package/lib/victory-portal/victory-portal.js +34 -42
  53. package/lib/victory-primitives/arc.js +9 -5
  54. package/lib/victory-primitives/background.js +11 -7
  55. package/lib/victory-primitives/border.js +9 -5
  56. package/lib/victory-primitives/circle.js +8 -4
  57. package/lib/victory-primitives/clip-path.js +1 -1
  58. package/lib/victory-primitives/line-segment.js +9 -5
  59. package/lib/victory-primitives/line.js +8 -4
  60. package/lib/victory-primitives/path.js +7 -3
  61. package/lib/victory-primitives/point.js +9 -5
  62. package/lib/victory-primitives/rect.js +8 -4
  63. package/lib/victory-primitives/text.js +7 -3
  64. package/lib/victory-primitives/tspan.js +1 -1
  65. package/lib/victory-primitives/whisker.js +12 -8
  66. package/lib/victory-transition/victory-transition.js +33 -33
  67. package/lib/victory-util/add-events.js +322 -311
  68. package/lib/victory-util/axis.js +20 -11
  69. package/lib/victory-util/collection.js +11 -7
  70. package/lib/victory-util/common-props.js +6 -4
  71. package/lib/victory-util/data.js +13 -7
  72. package/lib/victory-util/default-transitions.js +1 -1
  73. package/lib/victory-util/domain.js +11 -5
  74. package/lib/victory-util/events.js +17 -11
  75. package/lib/victory-util/helpers.js +14 -14
  76. package/lib/victory-util/hooks/index.js +4 -4
  77. package/lib/victory-util/hooks/use-animation-state.js +14 -6
  78. package/lib/victory-util/immutable.js +3 -3
  79. package/lib/victory-util/label-helpers.js +6 -4
  80. package/lib/victory-util/line-helpers.js +4 -2
  81. package/lib/victory-util/prop-types.js +5 -3
  82. package/lib/victory-util/scale.js +24 -21
  83. package/lib/victory-util/selection.js +6 -4
  84. package/lib/victory-util/textsize.js +12 -8
  85. package/lib/victory-util/timer-context.js +1 -1
  86. package/lib/victory-util/timer.js +3 -5
  87. package/lib/victory-util/user-props.js +139 -0
  88. package/lib/victory-util/wrapper.js +31 -23
  89. package/package.json +5 -12
  90. package/src/index.js +1 -0
  91. package/src/victory-animation/util.js +1 -1
  92. package/src/victory-animation/victory-animation.js +1 -1
  93. package/src/victory-clip-container/victory-clip-container.js +3 -1
  94. package/src/victory-container/victory-container.js +7 -1
  95. package/src/victory-label/victory-label.js +11 -7
  96. package/src/victory-util/add-events.js +2 -1
  97. package/src/victory-util/axis.js +3 -0
  98. package/src/victory-util/common-props.js +2 -2
  99. package/src/victory-util/line-helpers.js +1 -1
  100. package/src/victory-util/scale.js +18 -9
  101. package/src/victory-util/timer.js +1 -1
  102. package/src/victory-util/user-props.js +94 -0
@@ -6,21 +6,31 @@ import _assign from "lodash/assign";
6
6
 
7
7
  function _extends() { _extends = Object.assign || 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
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
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
- 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; }
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
13
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
14
 
15
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
16
 
17
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
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 || 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); }; }
18
24
 
19
- function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
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); }
20
26
 
21
27
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
22
28
 
23
- 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; }
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 : 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; }
24
34
 
25
35
  import React from "react";
26
36
  import PropTypes from "prop-types";
@@ -29,18 +39,19 @@ import Portal from "../victory-portal/portal";
29
39
  import PortalContext from "../victory-portal/portal-context";
30
40
  import TimerContext from "../victory-util/timer-context";
31
41
  import * as Helpers from "../victory-util/helpers";
42
+ import * as UserProps from "../victory-util/user-props";
32
43
 
33
- var VictoryContainer =
34
- /*#__PURE__*/
35
- function (_React$Component) {
44
+ var VictoryContainer = /*#__PURE__*/function (_React$Component) {
36
45
  _inherits(VictoryContainer, _React$Component);
37
46
 
47
+ var _super = _createSuper(VictoryContainer);
48
+
38
49
  function VictoryContainer(props) {
39
50
  var _this;
40
51
 
41
52
  _classCallCheck(this, VictoryContainer);
42
53
 
43
- _this = _possibleConstructorReturn(this, (VictoryContainer.__proto__ || Object.getPrototypeOf(VictoryContainer)).call(this, props));
54
+ _this = _super.call(this, props);
44
55
  _this.containerId = !_isObject(props) || props.containerId === undefined ? _uniqueId("victory-container-") : props.containerId;
45
56
 
46
57
  _this.savePortalRef = function (portal) {
@@ -108,11 +119,11 @@ function (_React$Component) {
108
119
  var ouiaId = props.ouiaId,
109
120
  ouiaSafe = props.ouiaSafe,
110
121
  ouiaType = props.ouiaType;
111
- return _objectSpread({}, ouiaId && {
122
+ return _objectSpread(_objectSpread(_objectSpread({}, ouiaId && {
112
123
  "data-ouia-component-id": ouiaId
113
- }, ouiaType && {
124
+ }), ouiaType && {
114
125
  "data-ouia-component-type": ouiaType
115
- }, ouiaSafe !== undefined && {
126
+ }), ouiaSafe !== undefined && {
116
127
  "data-ouia-safe": ouiaSafe
117
128
  });
118
129
  }
@@ -164,44 +175,45 @@ function (_React$Component) {
164
175
  preserveAspectRatio: svgProps.preserveAspectRatio,
165
176
  style: portalSvgStyle
166
177
  };
167
- return React.createElement(PortalContext.Provider, {
178
+ return /*#__PURE__*/React.createElement(PortalContext.Provider, {
168
179
  value: {
169
180
  portalUpdate: this.portalUpdate,
170
181
  portalRegister: this.portalRegister,
171
182
  portalDeregister: this.portalDeregister
172
183
  }
173
- }, React.createElement("div", _extends({
184
+ }, /*#__PURE__*/React.createElement("div", _extends({
174
185
  style: _defaults({}, style, divStyle),
175
186
  className: className,
176
187
  ref: this.saveContainerRef
177
- }, this.getOUIAProps(props)), React.createElement("svg", _extends({}, svgProps, {
188
+ }, this.getOUIAProps(props)), /*#__PURE__*/React.createElement("svg", _extends({}, svgProps, {
178
189
  style: svgStyle
179
- }), title ? React.createElement("title", {
190
+ }), title ? /*#__PURE__*/React.createElement("title", {
180
191
  id: this.getIdForElement("title")
181
- }, title) : null, desc ? React.createElement("desc", {
192
+ }, title) : null, desc ? /*#__PURE__*/React.createElement("desc", {
182
193
  id: this.getIdForElement("desc")
183
- }, desc) : null, children), React.createElement("div", {
194
+ }, desc) : null, children), /*#__PURE__*/React.createElement("div", {
184
195
  style: portalDivStyle
185
- }, React.cloneElement(portalComponent, _objectSpread({}, portalProps, {
196
+ }, /*#__PURE__*/React.cloneElement(portalComponent, _objectSpread(_objectSpread({}, portalProps), {}, {
186
197
  ref: this.savePortalRef
187
198
  })))));
188
199
  }
189
200
  }, {
190
201
  key: "render",
191
202
  value: function render() {
192
- var _props = this.props,
193
- width = _props.width,
194
- height = _props.height,
195
- responsive = _props.responsive,
196
- events = _props.events,
197
- title = _props.title,
198
- desc = _props.desc,
199
- tabIndex = _props.tabIndex,
200
- preserveAspectRatio = _props.preserveAspectRatio,
201
- role = _props.role;
203
+ var _this$props = this.props,
204
+ width = _this$props.width,
205
+ height = _this$props.height,
206
+ responsive = _this$props.responsive,
207
+ events = _this$props.events,
208
+ title = _this$props.title,
209
+ desc = _this$props.desc,
210
+ tabIndex = _this$props.tabIndex,
211
+ preserveAspectRatio = _this$props.preserveAspectRatio,
212
+ role = _this$props.role;
202
213
  var style = responsive ? this.props.style : Helpers.omit(this.props.style, ["height", "width"]);
214
+ var userProps = UserProps.getSafeUserProps(this.props);
203
215
 
204
- var svgProps = _assign({
216
+ var svgProps = _assign(_objectSpread({
205
217
  width: width,
206
218
  height: height,
207
219
  tabIndex: tabIndex,
@@ -210,7 +222,7 @@ function (_React$Component) {
210
222
  "aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
211
223
  viewBox: responsive ? "0 0 ".concat(width, " ").concat(height) : undefined,
212
224
  preserveAspectRatio: responsive ? preserveAspectRatio : undefined
213
- }, events);
225
+ }, userProps), events);
214
226
 
215
227
  return this.renderContainer(this.props, svgProps, style);
216
228
  }
@@ -219,69 +231,49 @@ function (_React$Component) {
219
231
  return VictoryContainer;
220
232
  }(React.Component);
221
233
 
222
- Object.defineProperty(VictoryContainer, "displayName", {
223
- configurable: true,
224
- enumerable: true,
225
- writable: true,
226
- value: "VictoryContainer"
234
+ _defineProperty(VictoryContainer, "displayName", "VictoryContainer");
235
+
236
+ _defineProperty(VictoryContainer, "role", "container");
237
+
238
+ _defineProperty(VictoryContainer, "propTypes", {
239
+ "aria-describedby": PropTypes.string,
240
+ "aria-labelledby": PropTypes.string,
241
+ children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
242
+ className: PropTypes.string,
243
+ containerId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
244
+ containerRef: PropTypes.func,
245
+ desc: PropTypes.string,
246
+ events: PropTypes.object,
247
+ height: CustomPropTypes.nonNegative,
248
+ name: PropTypes.string,
249
+ origin: PropTypes.shape({
250
+ x: CustomPropTypes.nonNegative,
251
+ y: CustomPropTypes.nonNegative
252
+ }),
253
+ ouiaId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
254
+ ouiaSafe: PropTypes.bool,
255
+ ouiaType: PropTypes.string,
256
+ polar: PropTypes.bool,
257
+ portalComponent: PropTypes.element,
258
+ portalZIndex: CustomPropTypes.integer,
259
+ preserveAspectRatio: PropTypes.string,
260
+ responsive: PropTypes.bool,
261
+ role: PropTypes.string,
262
+ style: PropTypes.object,
263
+ tabIndex: PropTypes.number,
264
+ theme: PropTypes.object,
265
+ title: PropTypes.string,
266
+ width: CustomPropTypes.nonNegative
227
267
  });
228
- Object.defineProperty(VictoryContainer, "role", {
229
- configurable: true,
230
- enumerable: true,
231
- writable: true,
232
- value: "container"
233
- });
234
- Object.defineProperty(VictoryContainer, "propTypes", {
235
- configurable: true,
236
- enumerable: true,
237
- writable: true,
238
- value: {
239
- "aria-describedby": PropTypes.string,
240
- "aria-labelledby": PropTypes.string,
241
- children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
242
- className: PropTypes.string,
243
- containerId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
244
- containerRef: PropTypes.func,
245
- desc: PropTypes.string,
246
- events: PropTypes.object,
247
- height: CustomPropTypes.nonNegative,
248
- name: PropTypes.string,
249
- origin: PropTypes.shape({
250
- x: CustomPropTypes.nonNegative,
251
- y: CustomPropTypes.nonNegative
252
- }),
253
- ouiaId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
254
- ouiaSafe: PropTypes.bool,
255
- ouiaType: PropTypes.string,
256
- polar: PropTypes.bool,
257
- portalComponent: PropTypes.element,
258
- portalZIndex: CustomPropTypes.integer,
259
- preserveAspectRatio: PropTypes.string,
260
- responsive: PropTypes.bool,
261
- role: PropTypes.string,
262
- style: PropTypes.object,
263
- tabIndex: PropTypes.number,
264
- theme: PropTypes.object,
265
- title: PropTypes.string,
266
- width: CustomPropTypes.nonNegative
267
- }
268
- });
269
- Object.defineProperty(VictoryContainer, "defaultProps", {
270
- configurable: true,
271
- enumerable: true,
272
- writable: true,
273
- value: {
274
- className: "VictoryContainer",
275
- portalComponent: React.createElement(Portal, null),
276
- portalZIndex: 99,
277
- responsive: true,
278
- role: "img"
279
- }
280
- });
281
- Object.defineProperty(VictoryContainer, "contextType", {
282
- configurable: true,
283
- enumerable: true,
284
- writable: true,
285
- value: TimerContext
268
+
269
+ _defineProperty(VictoryContainer, "defaultProps", {
270
+ className: "VictoryContainer",
271
+ portalComponent: /*#__PURE__*/React.createElement(Portal, null),
272
+ portalZIndex: 99,
273
+ responsive: true,
274
+ role: "img"
286
275
  });
276
+
277
+ _defineProperty(VictoryContainer, "contextType", TimerContext);
278
+
287
279
  export { VictoryContainer as default };
@@ -2,31 +2,37 @@ import _isEmpty from "lodash/isEmpty";
2
2
  import _defaults from "lodash/defaults";
3
3
  import _assign from "lodash/assign";
4
4
 
5
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
5
+ 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; }
6
+
7
+ 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; }
6
8
 
7
9
  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; }
8
10
 
9
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
11
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
10
12
 
11
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
13
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
14
 
13
- function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
15
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
14
16
 
15
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
17
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
18
+
19
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
20
+
21
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
16
22
 
17
- /*eslint no-magic-numbers: ["error", { "ignore": [-0.5, 0.5, 0, 1, 2] }]*/
18
- import React from "react";
19
23
  import PropTypes from "prop-types";
24
+ import React from "react";
20
25
  import VictoryPortal from "../victory-portal/victory-portal";
21
26
  import Rect from "../victory-primitives/rect";
22
- import * as CustomPropTypes from "../victory-util/prop-types";
27
+ import Text from "../victory-primitives/text";
28
+ import TSpan from "../victory-primitives/tspan";
23
29
  import * as Helpers from "../victory-util/helpers";
24
30
  import * as LabelHelpers from "../victory-util/label-helpers";
25
- import * as Style from "../victory-util/style";
26
31
  import * as Log from "../victory-util/log";
32
+ import * as CustomPropTypes from "../victory-util/prop-types";
33
+ import * as Style from "../victory-util/style";
27
34
  import * as TextSize from "../victory-util/textsize";
28
- import TSpan from "../victory-primitives/tspan";
29
- import Text from "../victory-primitives/text";
35
+ import * as UserProps from "../victory-util/user-props";
30
36
  var defaultStyles = {
31
37
  fill: "#252525",
32
38
  fontSize: 14,
@@ -274,7 +280,7 @@ var getFullBackground = function (calculatedProps, tspanValues) {
274
280
  x: inline ? xCoordinate - backgroundPadding.left : xCoordinate + dx - backgroundPadding.left,
275
281
  y: yCoordinate
276
282
  };
277
- return React.cloneElement(backgroundComponent, _defaults({}, backgroundComponent.props, backgroundProps));
283
+ return /*#__PURE__*/React.cloneElement(backgroundComponent, _defaults({}, backgroundComponent.props, backgroundProps));
278
284
  };
279
285
 
280
286
  var getInlineXOffset = function (calculatedProps, textElements, index) {
@@ -356,7 +362,7 @@ var getChildBackgrounds = function (calculatedProps, tspanValues) {
356
362
  x: xCoord - padding.left,
357
363
  y: yCoord
358
364
  };
359
- return React.cloneElement(backgroundComponent, _defaults({}, backgroundComponent.props, backgroundProps));
365
+ return /*#__PURE__*/React.cloneElement(backgroundComponent, _defaults({}, backgroundComponent.props, backgroundProps));
360
366
  });
361
367
  };
362
368
 
@@ -463,11 +469,12 @@ var renderLabel = function (calculatedProps, tspanValues) {
463
469
  tabIndex = calculatedProps.tabIndex,
464
470
  tspanComponent = calculatedProps.tspanComponent,
465
471
  textComponent = calculatedProps.textComponent;
472
+ var userProps = UserProps.getSafeUserProps(calculatedProps);
466
473
 
467
- var textProps = _objectSpread({
474
+ var textProps = _objectSpread(_objectSpread({
468
475
  "aria-label": ariaLabel,
469
476
  key: "text"
470
- }, events, {
477
+ }, events), {}, {
471
478
  direction: direction,
472
479
  dx: dx,
473
480
  x: x,
@@ -478,7 +485,7 @@ var renderLabel = function (calculatedProps, tspanValues) {
478
485
  desc: Helpers.evaluateProp(desc, calculatedProps),
479
486
  tabIndex: Helpers.evaluateProp(tabIndex, calculatedProps),
480
487
  id: id
481
- });
488
+ }, userProps);
482
489
 
483
490
  var tspans = text.map(function (line, i) {
484
491
  var currentStyle = tspanValues[i].style;
@@ -491,9 +498,9 @@ var renderLabel = function (calculatedProps, tspanValues) {
491
498
  style: currentStyle,
492
499
  children: line
493
500
  };
494
- return React.cloneElement(tspanComponent, tspanProps);
501
+ return /*#__PURE__*/React.cloneElement(tspanComponent, tspanProps);
495
502
  });
496
- return React.cloneElement(textComponent, textProps, tspans);
503
+ return /*#__PURE__*/React.cloneElement(textComponent, textProps, tspans);
497
504
  };
498
505
 
499
506
  var VictoryLabel = function (props) {
@@ -528,11 +535,11 @@ var VictoryLabel = function (props) {
528
535
  if (props.backgroundStyle) {
529
536
  var backgroundElement = getBackgroundElement(calculatedProps, tspanValues);
530
537
  var children = [backgroundElement, label];
531
- var backgroundWithLabel = React.cloneElement(props.groupComponent, {}, children);
532
- return props.renderInPortal ? React.createElement(VictoryPortal, null, backgroundWithLabel) : backgroundWithLabel;
538
+ var backgroundWithLabel = /*#__PURE__*/React.cloneElement(props.groupComponent, {}, children);
539
+ return props.renderInPortal ? /*#__PURE__*/React.createElement(VictoryPortal, null, backgroundWithLabel) : backgroundWithLabel;
533
540
  }
534
541
 
535
- return props.renderInPortal ? React.createElement(VictoryPortal, null, label) : label;
542
+ return props.renderInPortal ? /*#__PURE__*/React.createElement(VictoryPortal, null, label) : label;
536
543
  };
537
544
 
538
545
  VictoryLabel.displayName = "VictoryLabel";
@@ -583,11 +590,11 @@ VictoryLabel.propTypes = {
583
590
  y: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
584
591
  };
585
592
  VictoryLabel.defaultProps = {
586
- backgroundComponent: React.createElement(Rect, null),
587
- groupComponent: React.createElement("g", null),
593
+ backgroundComponent: /*#__PURE__*/React.createElement(Rect, null),
594
+ groupComponent: /*#__PURE__*/React.createElement("g", null),
588
595
  direction: "inherit",
589
- textComponent: React.createElement(Text, null),
590
- tspanComponent: React.createElement(TSpan, null),
596
+ textComponent: /*#__PURE__*/React.createElement(Text, null),
597
+ tspanComponent: /*#__PURE__*/React.createElement(TSpan, null),
591
598
  capHeight: 0.71,
592
599
  // Magic number from d3.
593
600
  lineHeight: 1
@@ -4,6 +4,6 @@ import React from "react";
4
4
  * portal.
5
5
  */
6
6
 
7
- var PortalContext = React.createContext({});
7
+ var PortalContext = /*#__PURE__*/React.createContext({});
8
8
  PortalContext.displayName = "PortalContext";
9
9
  export default PortalContext;
@@ -4,29 +4,39 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
4
4
 
5
5
  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); } }
6
6
 
7
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
7
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
8
 
9
- function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
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 _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; }
11
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
+
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
+
15
+ 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); }
12
16
 
13
17
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
14
18
 
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
+
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; }
24
+
15
25
  import React from "react";
16
26
  import PropTypes from "prop-types";
17
27
  import * as CustomPropTypes from "../victory-util/prop-types";
18
28
 
19
- var Portal =
20
- /*#__PURE__*/
21
- function (_React$Component) {
29
+ var Portal = /*#__PURE__*/function (_React$Component) {
22
30
  _inherits(Portal, _React$Component);
23
31
 
32
+ var _super = _createSuper(Portal);
33
+
24
34
  function Portal(props) {
25
35
  var _this;
26
36
 
27
37
  _classCallCheck(this, Portal);
28
38
 
29
- _this = _possibleConstructorReturn(this, (Portal.__proto__ || Object.getPrototypeOf(Portal)).call(this, props));
39
+ _this = _super.call(this, props);
30
40
  _this.map = {};
31
41
  _this.index = 1;
32
42
  _this.portalUpdate = _this.portalUpdate.bind(_assertThisInitialized(_this));
@@ -59,7 +69,7 @@ function (_React$Component) {
59
69
 
60
70
  return _keys(this.map).map(function (key) {
61
71
  var el = _this2.map[key];
62
- return el ? React.cloneElement(el, {
72
+ return el ? /*#__PURE__*/React.cloneElement(el, {
63
73
  key: key
64
74
  }) : el;
65
75
  });
@@ -68,29 +78,21 @@ function (_React$Component) {
68
78
  }, {
69
79
  key: "render",
70
80
  value: function render() {
71
- return React.createElement("svg", this.props, this.getChildren());
81
+ return /*#__PURE__*/React.createElement("svg", this.props, this.getChildren());
72
82
  }
73
83
  }]);
74
84
 
75
85
  return Portal;
76
86
  }(React.Component);
77
87
 
78
- Object.defineProperty(Portal, "displayName", {
79
- configurable: true,
80
- enumerable: true,
81
- writable: true,
82
- value: "Portal"
83
- });
84
- Object.defineProperty(Portal, "propTypes", {
85
- configurable: true,
86
- enumerable: true,
87
- writable: true,
88
- value: {
89
- className: PropTypes.string,
90
- height: CustomPropTypes.nonNegative,
91
- style: PropTypes.object,
92
- viewBox: PropTypes.string,
93
- width: CustomPropTypes.nonNegative
94
- }
88
+ _defineProperty(Portal, "displayName", "Portal");
89
+
90
+ _defineProperty(Portal, "propTypes", {
91
+ className: PropTypes.string,
92
+ height: CustomPropTypes.nonNegative,
93
+ style: PropTypes.object,
94
+ viewBox: PropTypes.string,
95
+ width: CustomPropTypes.nonNegative
95
96
  });
97
+
96
98
  export { Portal as default };
@@ -4,13 +4,23 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
4
4
 
5
5
  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); } }
6
6
 
7
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
7
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
8
 
9
- function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
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
+
11
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
+
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
+
15
+ 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); }
10
16
 
11
17
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
12
18
 
13
- 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; }
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
+
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; }
14
24
 
15
25
  import React from "react";
16
26
  import PropTypes from "prop-types";
@@ -18,15 +28,15 @@ import * as Log from "../victory-util/log";
18
28
  import * as Helpers from "../victory-util/helpers";
19
29
  import PortalContext from "./portal-context";
20
30
 
21
- var VictoryPortal =
22
- /*#__PURE__*/
23
- function (_React$Component) {
31
+ var VictoryPortal = /*#__PURE__*/function (_React$Component) {
24
32
  _inherits(VictoryPortal, _React$Component);
25
33
 
34
+ var _super = _createSuper(VictoryPortal);
35
+
26
36
  function VictoryPortal() {
27
37
  _classCallCheck(this, VictoryPortal);
28
38
 
29
- return _possibleConstructorReturn(this, (VictoryPortal.__proto__ || Object.getPrototypeOf(VictoryPortal)).apply(this, arguments));
39
+ return _super.apply(this, arguments);
30
40
  }
31
41
 
32
42
  _createClass(VictoryPortal, [{
@@ -83,7 +93,7 @@ function (_React$Component) {
83
93
 
84
94
  var newProps = _defaults(standardProps, childProps, Helpers.omit(this.props, ["children", "groupComponent"]));
85
95
 
86
- var child = children && React.cloneElement(children, newProps);
96
+ var child = children && /*#__PURE__*/React.cloneElement(children, newProps);
87
97
  return this.renderPortal(child);
88
98
  }
89
99
  }]);
@@ -91,39 +101,19 @@ function (_React$Component) {
91
101
  return VictoryPortal;
92
102
  }(React.Component);
93
103
 
94
- Object.defineProperty(VictoryPortal, "displayName", {
95
- configurable: true,
96
- enumerable: true,
97
- writable: true,
98
- value: "VictoryPortal"
99
- });
100
- Object.defineProperty(VictoryPortal, "role", {
101
- configurable: true,
102
- enumerable: true,
103
- writable: true,
104
- value: "portal"
105
- });
106
- Object.defineProperty(VictoryPortal, "propTypes", {
107
- configurable: true,
108
- enumerable: true,
109
- writable: true,
110
- value: {
111
- children: PropTypes.node,
112
- groupComponent: PropTypes.element
113
- }
114
- });
115
- Object.defineProperty(VictoryPortal, "defaultProps", {
116
- configurable: true,
117
- enumerable: true,
118
- writable: true,
119
- value: {
120
- groupComponent: React.createElement("g", null)
121
- }
104
+ _defineProperty(VictoryPortal, "displayName", "VictoryPortal");
105
+
106
+ _defineProperty(VictoryPortal, "role", "portal");
107
+
108
+ _defineProperty(VictoryPortal, "propTypes", {
109
+ children: PropTypes.node,
110
+ groupComponent: PropTypes.element
122
111
  });
123
- Object.defineProperty(VictoryPortal, "contextType", {
124
- configurable: true,
125
- enumerable: true,
126
- writable: true,
127
- value: PortalContext
112
+
113
+ _defineProperty(VictoryPortal, "defaultProps", {
114
+ groupComponent: /*#__PURE__*/React.createElement("g", null)
128
115
  });
116
+
117
+ _defineProperty(VictoryPortal, "contextType", PortalContext);
118
+
129
119
  export { VictoryPortal as default };