victory-core 36.9.2-next.3 → 37.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/CHANGELOG.md +28 -10
  2. package/README.md +1 -1
  3. package/dist/victory-core.js +4449 -6196
  4. package/dist/victory-core.min.js +1 -1
  5. package/es/index.d.ts +17 -17
  6. package/es/types/callbacks.d.ts +36 -36
  7. package/es/types/prop-types.d.ts +129 -129
  8. package/es/victory-accessible-group/victory-accessible-group.d.ts +10 -10
  9. package/es/victory-accessible-group/victory-accessible-group.js +9 -15
  10. package/es/victory-animation/util.d.ts +66 -66
  11. package/es/victory-animation/util.js +28 -47
  12. package/es/victory-animation/victory-animation.d.ts +34 -34
  13. package/es/victory-animation/victory-animation.js +51 -67
  14. package/es/victory-clip-container/victory-clip-container.d.ts +46 -46
  15. package/es/victory-clip-container/victory-clip-container.js +153 -229
  16. package/es/victory-container/victory-container.d.ts +68 -68
  17. package/es/victory-container/victory-container.js +157 -216
  18. package/es/victory-label/victory-label.d.ts +58 -58
  19. package/es/victory-label/victory-label.js +246 -323
  20. package/es/victory-portal/portal-context.d.ts +11 -11
  21. package/es/victory-portal/portal-context.js +1 -2
  22. package/es/victory-portal/portal.d.ts +20 -20
  23. package/es/victory-portal/portal.js +30 -76
  24. package/es/victory-portal/victory-portal.d.ts +26 -26
  25. package/es/victory-portal/victory-portal.js +47 -104
  26. package/es/victory-primitives/arc.d.ts +14 -14
  27. package/es/victory-primitives/arc.js +44 -47
  28. package/es/victory-primitives/background.d.ts +13 -13
  29. package/es/victory-primitives/background.js +14 -17
  30. package/es/victory-primitives/border.d.ts +10 -10
  31. package/es/victory-primitives/border.js +20 -24
  32. package/es/victory-primitives/circle.d.ts +3 -3
  33. package/es/victory-primitives/circle.js +13 -27
  34. package/es/victory-primitives/clip-path.d.ts +7 -7
  35. package/es/victory-primitives/clip-path.js +3 -7
  36. package/es/victory-primitives/index.d.ts +14 -14
  37. package/es/victory-primitives/line-segment.d.ts +11 -11
  38. package/es/victory-primitives/line-segment.js +20 -24
  39. package/es/victory-primitives/line.d.ts +3 -3
  40. package/es/victory-primitives/line.js +13 -27
  41. package/es/victory-primitives/path.d.ts +3 -3
  42. package/es/victory-primitives/path.js +13 -27
  43. package/es/victory-primitives/point.d.ts +13 -13
  44. package/es/victory-primitives/point.js +36 -40
  45. package/es/victory-primitives/rect.d.ts +3 -3
  46. package/es/victory-primitives/rect.js +13 -27
  47. package/es/victory-primitives/text.d.ts +8 -8
  48. package/es/victory-primitives/text.js +15 -28
  49. package/es/victory-primitives/tspan.d.ts +3 -3
  50. package/es/victory-primitives/tspan.js +13 -26
  51. package/es/victory-primitives/types.d.ts +7 -7
  52. package/es/victory-primitives/whisker.d.ts +15 -15
  53. package/es/victory-primitives/whisker.js +43 -47
  54. package/es/victory-theme/grayscale.d.ts +2 -2
  55. package/es/victory-theme/grayscale.js +22 -22
  56. package/es/victory-theme/material.d.ts +2 -2
  57. package/es/victory-theme/material.js +46 -46
  58. package/es/victory-theme/types.d.ts +238 -238
  59. package/es/victory-theme/victory-theme.d.ts +5 -5
  60. package/es/victory-theme/victory-theme.js +3 -3
  61. package/es/victory-transition/victory-transition.d.ts +53 -53
  62. package/es/victory-transition/victory-transition.js +126 -206
  63. package/es/victory-util/add-events.d.ts +126 -126
  64. package/es/victory-util/add-events.js +265 -380
  65. package/es/victory-util/axis.d.ts +50 -50
  66. package/es/victory-util/axis.js +133 -222
  67. package/es/victory-util/collection.d.ts +15 -8
  68. package/es/victory-util/collection.js +24 -36
  69. package/es/victory-util/common-props.d.ts +79 -79
  70. package/es/victory-util/data.d.ts +74 -74
  71. package/es/victory-util/data.js +159 -214
  72. package/es/victory-util/default-transitions.d.ts +4 -4
  73. package/es/victory-util/default-transitions.js +33 -51
  74. package/es/victory-util/domain.d.ts +90 -90
  75. package/es/victory-util/domain.js +122 -171
  76. package/es/victory-util/events.d.ts +64 -64
  77. package/es/victory-util/events.js +168 -258
  78. package/es/victory-util/helpers.d.ts +96 -91
  79. package/es/victory-util/helpers.js +162 -176
  80. package/es/victory-util/hooks/index.d.ts +2 -2
  81. package/es/victory-util/hooks/use-animation-state.d.ts +21 -21
  82. package/es/victory-util/hooks/use-animation-state.js +61 -99
  83. package/es/victory-util/hooks/use-previous-props.d.ts +1 -1
  84. package/es/victory-util/hooks/use-previous-props.js +2 -2
  85. package/es/victory-util/immutable.d.ts +11 -11
  86. package/es/victory-util/immutable.js +6 -8
  87. package/es/victory-util/index.d.ts +26 -26
  88. package/es/victory-util/label-helpers.d.ts +26 -26
  89. package/es/victory-util/label-helpers.js +128 -130
  90. package/es/victory-util/line-helpers.d.ts +4 -4
  91. package/es/victory-util/line-helpers.js +29 -41
  92. package/es/victory-util/log.d.ts +1 -1
  93. package/es/victory-util/log.js +1 -1
  94. package/es/victory-util/point-path-helpers.d.ts +9 -9
  95. package/es/victory-util/point-path-helpers.js +89 -49
  96. package/es/victory-util/scale.d.ts +9 -9
  97. package/es/victory-util/scale.js +24 -42
  98. package/es/victory-util/selection.d.ts +28 -28
  99. package/es/victory-util/selection.js +39 -40
  100. package/es/victory-util/style.d.ts +18 -18
  101. package/es/victory-util/style.js +8 -13
  102. package/es/victory-util/textsize.d.ts +35 -35
  103. package/es/victory-util/textsize.js +80 -154
  104. package/es/victory-util/timer-context.d.ts +11 -11
  105. package/es/victory-util/timer-context.js +2 -2
  106. package/es/victory-util/timer.d.ts +16 -16
  107. package/es/victory-util/timer.js +40 -76
  108. package/es/victory-util/transitions.d.ts +48 -48
  109. package/es/victory-util/transitions.js +110 -150
  110. package/es/victory-util/type-helpers.d.ts +9 -9
  111. package/es/victory-util/type-helpers.js +2 -3
  112. package/es/victory-util/user-props.d.ts +26 -26
  113. package/es/victory-util/user-props.js +24 -49
  114. package/es/victory-util/wrapper.d.ts +33 -37
  115. package/es/victory-util/wrapper.js +182 -245
  116. package/lib/index.d.ts +17 -17
  117. package/lib/index.js +0 -30
  118. package/lib/types/callbacks.d.ts +36 -36
  119. package/lib/types/prop-types.d.ts +129 -129
  120. package/lib/victory-accessible-group/victory-accessible-group.d.ts +10 -10
  121. package/lib/victory-accessible-group/victory-accessible-group.js +9 -19
  122. package/lib/victory-animation/util.d.ts +66 -66
  123. package/lib/victory-animation/util.js +28 -63
  124. package/lib/victory-animation/victory-animation.d.ts +34 -34
  125. package/lib/victory-animation/victory-animation.js +54 -83
  126. package/lib/victory-clip-container/victory-clip-container.d.ts +46 -46
  127. package/lib/victory-clip-container/victory-clip-container.js +156 -243
  128. package/lib/victory-container/victory-container.d.ts +68 -68
  129. package/lib/victory-container/victory-container.js +160 -232
  130. package/lib/victory-label/victory-label.d.ts +58 -58
  131. package/lib/victory-label/victory-label.js +248 -344
  132. package/lib/victory-portal/portal-context.d.ts +11 -11
  133. package/lib/victory-portal/portal-context.js +1 -6
  134. package/lib/victory-portal/portal.d.ts +20 -20
  135. package/lib/victory-portal/portal.js +31 -81
  136. package/lib/victory-portal/victory-portal.d.ts +26 -26
  137. package/lib/victory-portal/victory-portal.js +50 -116
  138. package/lib/victory-primitives/arc.d.ts +14 -14
  139. package/lib/victory-primitives/arc.js +48 -57
  140. package/lib/victory-primitives/background.d.ts +13 -13
  141. package/lib/victory-primitives/background.js +16 -28
  142. package/lib/victory-primitives/border.d.ts +10 -10
  143. package/lib/victory-primitives/border.js +22 -34
  144. package/lib/victory-primitives/circle.d.ts +3 -3
  145. package/lib/victory-primitives/circle.js +16 -36
  146. package/lib/victory-primitives/clip-path.d.ts +7 -7
  147. package/lib/victory-primitives/clip-path.js +3 -11
  148. package/lib/victory-primitives/index.d.ts +14 -14
  149. package/lib/victory-primitives/index.js +0 -28
  150. package/lib/victory-primitives/line-segment.d.ts +11 -11
  151. package/lib/victory-primitives/line-segment.js +22 -34
  152. package/lib/victory-primitives/line.d.ts +3 -3
  153. package/lib/victory-primitives/line.js +16 -36
  154. package/lib/victory-primitives/path.d.ts +3 -3
  155. package/lib/victory-primitives/path.js +16 -36
  156. package/lib/victory-primitives/point.d.ts +13 -13
  157. package/lib/victory-primitives/point.js +38 -52
  158. package/lib/victory-primitives/rect.d.ts +3 -3
  159. package/lib/victory-primitives/rect.js +16 -36
  160. package/lib/victory-primitives/text.d.ts +8 -8
  161. package/lib/victory-primitives/text.js +15 -33
  162. package/lib/victory-primitives/tspan.d.ts +3 -3
  163. package/lib/victory-primitives/tspan.js +13 -31
  164. package/lib/victory-primitives/types.d.ts +7 -7
  165. package/lib/victory-primitives/whisker.d.ts +15 -15
  166. package/lib/victory-primitives/whisker.js +45 -57
  167. package/lib/victory-theme/grayscale.d.ts +2 -2
  168. package/lib/victory-theme/grayscale.js +23 -24
  169. package/lib/victory-theme/material.d.ts +2 -2
  170. package/lib/victory-theme/material.js +47 -48
  171. package/lib/victory-theme/types.d.ts +238 -238
  172. package/lib/victory-theme/victory-theme.d.ts +5 -5
  173. package/lib/victory-theme/victory-theme.js +2 -7
  174. package/lib/victory-transition/victory-transition.d.ts +53 -53
  175. package/lib/victory-transition/victory-transition.js +129 -224
  176. package/lib/victory-util/add-events.d.ts +126 -126
  177. package/lib/victory-util/add-events.js +265 -382
  178. package/lib/victory-util/axis.d.ts +50 -50
  179. package/lib/victory-util/axis.js +135 -242
  180. package/lib/victory-util/collection.d.ts +15 -8
  181. package/lib/victory-util/collection.js +24 -43
  182. package/lib/victory-util/common-props.d.ts +79 -79
  183. package/lib/victory-util/data.d.ts +74 -74
  184. package/lib/victory-util/data.js +160 -239
  185. package/lib/victory-util/default-transitions.d.ts +4 -4
  186. package/lib/victory-util/default-transitions.js +33 -54
  187. package/lib/victory-util/domain.d.ts +90 -90
  188. package/lib/victory-util/domain.js +123 -193
  189. package/lib/victory-util/events.d.ts +64 -64
  190. package/lib/victory-util/events.js +167 -274
  191. package/lib/victory-util/helpers.d.ts +96 -91
  192. package/lib/victory-util/helpers.js +166 -204
  193. package/lib/victory-util/hooks/index.d.ts +2 -2
  194. package/lib/victory-util/hooks/index.js +0 -2
  195. package/lib/victory-util/hooks/use-animation-state.d.ts +21 -21
  196. package/lib/victory-util/hooks/use-animation-state.js +63 -113
  197. package/lib/victory-util/hooks/use-previous-props.d.ts +1 -1
  198. package/lib/victory-util/hooks/use-previous-props.js +2 -7
  199. package/lib/victory-util/immutable.d.ts +11 -11
  200. package/lib/victory-util/immutable.js +6 -18
  201. package/lib/victory-util/index.d.ts +26 -26
  202. package/lib/victory-util/index.js +2 -51
  203. package/lib/victory-util/label-helpers.d.ts +26 -26
  204. package/lib/victory-util/label-helpers.js +130 -141
  205. package/lib/victory-util/line-helpers.d.ts +4 -4
  206. package/lib/victory-util/line-helpers.js +31 -49
  207. package/lib/victory-util/log.d.ts +1 -1
  208. package/lib/victory-util/log.js +1 -2
  209. package/lib/victory-util/point-path-helpers.d.ts +9 -9
  210. package/lib/victory-util/point-path-helpers.js +91 -63
  211. package/lib/victory-util/scale.d.ts +9 -9
  212. package/lib/victory-util/scale.js +26 -57
  213. package/lib/victory-util/selection.d.ts +28 -28
  214. package/lib/victory-util/selection.js +41 -49
  215. package/lib/victory-util/style.d.ts +18 -18
  216. package/lib/victory-util/style.js +8 -16
  217. package/lib/victory-util/textsize.d.ts +35 -35
  218. package/lib/victory-util/textsize.js +80 -157
  219. package/lib/victory-util/timer-context.d.ts +11 -11
  220. package/lib/victory-util/timer-context.js +2 -8
  221. package/lib/victory-util/timer.d.ts +16 -16
  222. package/lib/victory-util/timer.js +40 -76
  223. package/lib/victory-util/transitions.d.ts +48 -48
  224. package/lib/victory-util/transitions.js +110 -152
  225. package/lib/victory-util/type-helpers.d.ts +9 -9
  226. package/lib/victory-util/type-helpers.js +2 -9
  227. package/lib/victory-util/user-props.d.ts +26 -26
  228. package/lib/victory-util/user-props.js +25 -59
  229. package/lib/victory-util/wrapper.d.ts +33 -37
  230. package/lib/victory-util/wrapper.js +184 -279
  231. package/package.json +6 -3
  232. package/src/types/prop-types.ts +0 -7
  233. package/src/victory-container/victory-container.tsx +195 -171
  234. package/src/victory-portal/portal-context.ts +4 -5
  235. package/src/victory-portal/portal.tsx +42 -5
  236. package/src/victory-portal/victory-portal.tsx +71 -34
  237. package/src/victory-util/add-events.tsx +6 -4
  238. package/src/victory-util/axis.tsx +12 -3
  239. package/src/victory-util/collection.tsx +13 -0
  240. package/src/victory-util/helpers.ts +11 -0
  241. package/src/victory-util/index.ts +0 -1
  242. package/src/victory-util/wrapper.tsx +1 -0
  243. package/src/victory-util/merge-refs.ts +0 -13
@@ -1,244 +1,168 @@
1
1
  import _uniqueId from "lodash/uniqueId";
2
2
  import _isObject from "lodash/isObject";
3
3
  import _defaults from "lodash/defaults";
4
-
5
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
6
-
7
- 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."); }
8
-
9
- 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); }
10
-
11
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
12
-
13
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
14
-
15
- 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
-
17
- 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; }
18
-
19
- 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; }
20
-
21
- 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; }
22
-
23
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
24
-
25
- 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); } }
26
-
27
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
28
-
29
- 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); }
30
-
31
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
32
-
33
- 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); }; }
34
-
35
- 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); }
36
-
37
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
38
-
39
- 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; } }
40
-
41
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
42
-
43
4
  import React from "react";
44
5
  import * as Helpers from "../victory-util/helpers";
45
6
  import * as UserProps from "../victory-util/user-props";
46
7
  import { ClipPath } from "../victory-primitives/clip-path";
47
8
  import { Circle } from "../victory-primitives/circle";
48
9
  import { Rect } from "../victory-primitives/rect";
49
- export var VictoryClipContainer = /*#__PURE__*/function (_React$Component) {
50
- _inherits(VictoryClipContainer, _React$Component);
51
-
52
- var _super = _createSuper(VictoryClipContainer);
53
-
54
- function VictoryClipContainer(props) {
55
- var _this;
56
-
57
- _classCallCheck(this, VictoryClipContainer);
58
-
59
- _this = _super.call(this, props);
60
- _this.clipId = void 0;
61
- _this.clipId = !_isObject(props) || props.clipId === undefined ? _uniqueId("victory-clip-") : props.clipId;
62
- return _this;
10
+ export class VictoryClipContainer extends React.Component {
11
+ static displayName = "VictoryClipContainer";
12
+ static role = "container";
13
+ static defaultProps = {
14
+ circleComponent: /*#__PURE__*/React.createElement(Circle, null),
15
+ rectComponent: /*#__PURE__*/React.createElement(Rect, null),
16
+ clipPathComponent: /*#__PURE__*/React.createElement(ClipPath, null),
17
+ groupComponent: /*#__PURE__*/React.createElement("g", null)
18
+ };
19
+ constructor(props) {
20
+ super(props);
21
+ this.clipId = !_isObject(props) || props.clipId === undefined ? _uniqueId("victory-clip-") : props.clipId;
63
22
  }
64
-
65
- _createClass(VictoryClipContainer, [{
66
- key: "calculateAttributes",
67
- value: function calculateAttributes(props) {
68
- var polar = props.polar,
69
- origin = props.origin,
70
- _props$clipWidth = props.clipWidth,
71
- clipWidth = _props$clipWidth === void 0 ? 0 : _props$clipWidth,
72
- _props$clipHeight = props.clipHeight,
73
- clipHeight = _props$clipHeight === void 0 ? 0 : _props$clipHeight,
74
- _props$translateX = props.translateX,
75
- translateX = _props$translateX === void 0 ? 0 : _props$translateX,
76
- _props$translateY = props.translateY,
77
- translateY = _props$translateY === void 0 ? 0 : _props$translateY;
78
- var clipPadding = Helpers.getPadding({
79
- padding: props.clipPadding
80
- });
81
- var radius = props.radius || Helpers.getRadius(props);
82
- return {
83
- x: (polar ? origin.x : translateX) - clipPadding.left,
84
- y: (polar ? origin.y : translateY) - clipPadding.top,
85
- width: Math.max((polar ? radius : clipWidth) + clipPadding.left + clipPadding.right, 0),
86
- height: Math.max((polar ? radius : clipHeight) + clipPadding.top + clipPadding.bottom, 0)
23
+ calculateAttributes(props) {
24
+ const {
25
+ polar,
26
+ origin,
27
+ clipWidth = 0,
28
+ clipHeight = 0,
29
+ translateX = 0,
30
+ translateY = 0
31
+ } = props;
32
+ const clipPadding = Helpers.getPadding({
33
+ padding: props.clipPadding
34
+ });
35
+ const radius = props.radius || Helpers.getRadius(props);
36
+ return {
37
+ x: (polar ? origin.x : translateX) - clipPadding.left,
38
+ y: (polar ? origin.y : translateY) - clipPadding.top,
39
+ width: Math.max((polar ? radius : clipWidth) + clipPadding.left + clipPadding.right, 0),
40
+ height: Math.max((polar ? radius : clipHeight) + clipPadding.top + clipPadding.bottom, 0)
41
+ };
42
+ }
43
+ renderClippedGroup(props, clipId) {
44
+ const userProps = UserProps.getSafeUserProps(props);
45
+ const {
46
+ style,
47
+ events,
48
+ transform,
49
+ children,
50
+ className,
51
+ groupComponent,
52
+ tabIndex
53
+ } = props;
54
+ const clipComponent = this.renderClipComponent(props, clipId);
55
+ const groupProps = Object.assign({
56
+ className,
57
+ style,
58
+ transform,
59
+ key: `clipped-group-${clipId}`,
60
+ clipPath: `url(#${clipId})`
61
+ }, events);
62
+ return /*#__PURE__*/React.cloneElement(groupComponent, {
63
+ ...groupProps,
64
+ tabIndex,
65
+ ...userProps
66
+ }, [clipComponent, ...React.Children.toArray(children)]);
67
+ }
68
+ renderGroup(props) {
69
+ const {
70
+ style,
71
+ events,
72
+ transform,
73
+ children,
74
+ className,
75
+ groupComponent,
76
+ tabIndex
77
+ } = props;
78
+ return /*#__PURE__*/React.cloneElement(groupComponent, Object.assign({
79
+ className,
80
+ style,
81
+ transform,
82
+ "aria-label": props["aria-label"],
83
+ tabIndex
84
+ }, events), children);
85
+ }
86
+ renderClipComponent(props, clipId) {
87
+ const {
88
+ polar,
89
+ origin,
90
+ clipWidth = 0,
91
+ clipHeight = 0,
92
+ translateX = 0,
93
+ translateY = 0,
94
+ circleComponent,
95
+ rectComponent,
96
+ clipPathComponent
97
+ } = props;
98
+ const {
99
+ top,
100
+ bottom,
101
+ left,
102
+ right
103
+ } = Helpers.getPadding({
104
+ padding: props.clipPadding
105
+ });
106
+ let child;
107
+ if (polar) {
108
+ const radius = props.radius || Helpers.getRadius(props);
109
+ const circleProps = {
110
+ r: Math.max(radius + left + right, radius + top + bottom, 0),
111
+ cx: origin.x - left,
112
+ cy: origin.y - top
87
113
  };
88
- }
89
- }, {
90
- key: "renderClippedGroup",
91
- value: function renderClippedGroup(props, clipId) {
92
- var userProps = UserProps.getSafeUserProps(props);
93
- var style = props.style,
94
- events = props.events,
95
- transform = props.transform,
96
- children = props.children,
97
- className = props.className,
98
- groupComponent = props.groupComponent,
99
- tabIndex = props.tabIndex;
100
- var clipComponent = this.renderClipComponent(props, clipId);
101
- var groupProps = Object.assign({
102
- className: className,
103
- style: style,
104
- transform: transform,
105
- key: "clipped-group-".concat(clipId),
106
- clipPath: "url(#".concat(clipId, ")")
107
- }, events);
108
- return /*#__PURE__*/React.cloneElement(groupComponent, _objectSpread(_objectSpread({}, groupProps), {}, {
109
- tabIndex: tabIndex
110
- }, userProps), [clipComponent].concat(_toConsumableArray(React.Children.toArray(children))));
111
- }
112
- }, {
113
- key: "renderGroup",
114
- value: function renderGroup(props) {
115
- var style = props.style,
116
- events = props.events,
117
- transform = props.transform,
118
- children = props.children,
119
- className = props.className,
120
- groupComponent = props.groupComponent,
121
- tabIndex = props.tabIndex;
122
- return /*#__PURE__*/React.cloneElement(groupComponent, Object.assign({
123
- className: className,
124
- style: style,
125
- transform: transform,
126
- "aria-label": props["aria-label"],
127
- tabIndex: tabIndex
128
- }, events), children);
129
- }
130
- }, {
131
- key: "renderClipComponent",
132
- value: function renderClipComponent(props, clipId) {
133
- var polar = props.polar,
134
- origin = props.origin,
135
- _props$clipWidth2 = props.clipWidth,
136
- clipWidth = _props$clipWidth2 === void 0 ? 0 : _props$clipWidth2,
137
- _props$clipHeight2 = props.clipHeight,
138
- clipHeight = _props$clipHeight2 === void 0 ? 0 : _props$clipHeight2,
139
- _props$translateX2 = props.translateX,
140
- translateX = _props$translateX2 === void 0 ? 0 : _props$translateX2,
141
- _props$translateY2 = props.translateY,
142
- translateY = _props$translateY2 === void 0 ? 0 : _props$translateY2,
143
- circleComponent = props.circleComponent,
144
- rectComponent = props.rectComponent,
145
- clipPathComponent = props.clipPathComponent;
146
-
147
- var _Helpers$getPadding = Helpers.getPadding({
148
- padding: props.clipPadding
149
- }),
150
- top = _Helpers$getPadding.top,
151
- bottom = _Helpers$getPadding.bottom,
152
- left = _Helpers$getPadding.left,
153
- right = _Helpers$getPadding.right;
154
-
155
- var child;
156
-
157
- if (polar) {
158
- var radius = props.radius || Helpers.getRadius(props);
159
- var circleProps = {
160
- r: Math.max(radius + left + right, radius + top + bottom, 0),
161
- cx: origin.x - left,
162
- cy: origin.y - top
163
- };
164
- child = /*#__PURE__*/React.cloneElement(circleComponent, circleProps);
165
- } else {
166
- var rectProps = {
167
- x: translateX - left,
168
- y: translateY - top,
169
- width: Math.max(clipWidth + left + right, 0),
170
- height: Math.max(clipHeight + top + bottom, 0)
171
- };
172
- child = /*#__PURE__*/React.cloneElement(rectComponent, rectProps);
173
- }
174
-
175
- return /*#__PURE__*/React.cloneElement(clipPathComponent, Object.assign({
176
- key: "clip-path-".concat(clipId)
177
- }, props, {
178
- clipId: clipId
179
- }), child);
180
- }
181
- }, {
182
- key: "getClipValue",
183
- value: function getClipValue(props, axis) {
184
- var clipValues = {
185
- x: props.clipWidth,
186
- y: props.clipHeight
114
+ child = /*#__PURE__*/React.cloneElement(circleComponent, circleProps);
115
+ } else {
116
+ const rectProps = {
117
+ x: translateX - left,
118
+ y: translateY - top,
119
+ width: Math.max(clipWidth + left + right, 0),
120
+ height: Math.max(clipHeight + top + bottom, 0)
187
121
  };
188
-
189
- if (clipValues[axis] !== undefined) {
190
- return clipValues[axis];
191
- }
192
-
193
- var range = Helpers.getRange(props, axis);
194
- return range ? Math.abs(range[0] - range[1]) || undefined : undefined;
122
+ child = /*#__PURE__*/React.cloneElement(rectComponent, rectProps);
195
123
  }
196
- }, {
197
- key: "getTranslateValue",
198
- value: function getTranslateValue(props, axis) {
199
- var translateValues = {
200
- x: props.translateX,
201
- y: props.translateY
202
- };
203
-
204
- if (translateValues[axis] !== undefined) {
205
- return translateValues[axis];
206
- }
207
-
208
- var range = Helpers.getRange(props, axis);
209
- return range ? Math.min.apply(Math, _toConsumableArray(range)) : undefined;
124
+ return /*#__PURE__*/React.cloneElement(clipPathComponent, Object.assign({
125
+ key: `clip-path-${clipId}`
126
+ }, props, {
127
+ clipId
128
+ }), child);
129
+ }
130
+ getClipValue(props, axis) {
131
+ const clipValues = {
132
+ x: props.clipWidth,
133
+ y: props.clipHeight
134
+ };
135
+ if (clipValues[axis] !== undefined) {
136
+ return clipValues[axis];
137
+ }
138
+ const range = Helpers.getRange(props, axis);
139
+ return range ? Math.abs(range[0] - range[1]) || undefined : undefined;
140
+ }
141
+ getTranslateValue(props, axis) {
142
+ const translateValues = {
143
+ x: props.translateX,
144
+ y: props.translateY
145
+ };
146
+ if (translateValues[axis] !== undefined) {
147
+ return translateValues[axis];
210
148
  }
211
- }, {
212
- key: "render",
213
- value: function render() {
214
- var clipHeight = this.getClipValue(this.props, "y");
215
- var clipWidth = this.getClipValue(this.props, "x");
216
-
217
- if (clipWidth === undefined || clipHeight === undefined) {
218
- return this.renderGroup(this.props);
219
- }
220
-
221
- var translateX = this.getTranslateValue(this.props, "x");
222
- var translateY = this.getTranslateValue(this.props, "y");
223
-
224
- var clipProps = _defaults({}, this.props, {
225
- clipHeight: clipHeight,
226
- clipWidth: clipWidth,
227
- translateX: translateX,
228
- translateY: translateY
229
- });
230
-
231
- return this.renderClippedGroup(clipProps, this.clipId);
149
+ const range = Helpers.getRange(props, axis);
150
+ return range ? Math.min(...range) : undefined;
151
+ }
152
+ render() {
153
+ const clipHeight = this.getClipValue(this.props, "y");
154
+ const clipWidth = this.getClipValue(this.props, "x");
155
+ if (clipWidth === undefined || clipHeight === undefined) {
156
+ return this.renderGroup(this.props);
232
157
  }
233
- }]);
234
-
235
- return VictoryClipContainer;
236
- }(React.Component);
237
- VictoryClipContainer.displayName = "VictoryClipContainer";
238
- VictoryClipContainer.role = "container";
239
- VictoryClipContainer.defaultProps = {
240
- circleComponent: /*#__PURE__*/React.createElement(Circle, null),
241
- rectComponent: /*#__PURE__*/React.createElement(Rect, null),
242
- clipPathComponent: /*#__PURE__*/React.createElement(ClipPath, null),
243
- groupComponent: /*#__PURE__*/React.createElement("g", null)
244
- };
158
+ const translateX = this.getTranslateValue(this.props, "x");
159
+ const translateY = this.getTranslateValue(this.props, "y");
160
+ const clipProps = _defaults({}, this.props, {
161
+ clipHeight,
162
+ clipWidth,
163
+ translateX,
164
+ translateY
165
+ });
166
+ return this.renderClippedGroup(clipProps, this.clipId);
167
+ }
168
+ }
@@ -1,69 +1,69 @@
1
- import React from "react";
2
- import { OriginType } from "../victory-label/victory-label";
3
- import { D3Scale } from "../types/prop-types";
4
- import { VictoryThemeDefinition } from "../victory-theme/types";
5
- export interface VictoryContainerProps {
6
- "aria-describedby"?: string;
7
- "aria-labelledby"?: string;
8
- children?: React.ReactElement | React.ReactElement[];
9
- className?: string;
10
- containerId?: number | string;
11
- containerRef?: React.Ref<HTMLElement>;
12
- desc?: string;
13
- events?: React.DOMAttributes<any>;
14
- height?: number;
15
- name?: string;
16
- origin?: OriginType;
17
- ouiaId?: number | string;
18
- ouiaSafe?: boolean;
19
- ouiaType?: string;
20
- polar?: boolean;
21
- portalComponent?: React.ReactElement;
22
- portalZIndex?: number;
23
- preserveAspectRatio?: string;
24
- responsive?: boolean;
25
- role?: string;
26
- scale?: {
27
- x?: D3Scale;
28
- y?: D3Scale;
29
- };
30
- style?: React.CSSProperties;
31
- tabIndex?: number;
32
- theme?: VictoryThemeDefinition;
33
- title?: string;
34
- width?: number;
35
- }
36
- export declare class VictoryContainer<TProps extends VictoryContainerProps> extends React.Component<TProps> {
37
- static displayName: string;
38
- static role: string;
39
- static defaultProps: {
40
- className: string;
41
- portalComponent: JSX.Element;
42
- portalZIndex: number;
43
- responsive: boolean;
44
- role: string;
45
- };
46
- static contextType: React.Context<{
47
- transitionTimer: import("..").Timer;
48
- animationTimer: import("..").Timer;
49
- }>;
50
- private containerId;
51
- private portalRef;
52
- private containerRef;
53
- private shouldHandleWheel;
54
- constructor(props: TProps);
55
- savePortalRef: (portal: any) => any;
56
- portalUpdate: (key: any, el: any) => void;
57
- portalRegister: () => number;
58
- portalDeregister: (key: any) => void;
59
- saveContainerRef: (container: HTMLElement) => HTMLElement;
60
- handleWheel: (e: any) => any;
61
- componentDidMount(): void;
62
- componentWillUnmount(): void;
63
- getIdForElement(elementName: any): string;
64
- getChildren(props: any): any;
65
- getOUIAProps(props: any): any;
66
- renderContainer(props: any, svgProps: any, style: any): JSX.Element;
67
- render(): JSX.Element;
68
- }
1
+ import React from "react";
2
+ import { OriginType } from "../victory-label/victory-label";
3
+ import { D3Scale } from "../types/prop-types";
4
+ import { VictoryThemeDefinition } from "../victory-theme/types";
5
+ export interface VictoryContainerProps {
6
+ "aria-describedby"?: string;
7
+ "aria-labelledby"?: string;
8
+ children?: React.ReactElement | React.ReactElement[];
9
+ className?: string;
10
+ containerId?: number | string;
11
+ containerRef?: React.Ref<HTMLElement>;
12
+ desc?: string;
13
+ events?: React.DOMAttributes<any>;
14
+ height?: number;
15
+ name?: string;
16
+ origin?: OriginType;
17
+ ouiaId?: number | string;
18
+ ouiaSafe?: boolean;
19
+ ouiaType?: string;
20
+ polar?: boolean;
21
+ portalComponent?: React.ReactElement;
22
+ portalZIndex?: number;
23
+ preserveAspectRatio?: string;
24
+ responsive?: boolean;
25
+ role?: string;
26
+ scale?: {
27
+ x?: D3Scale;
28
+ y?: D3Scale;
29
+ };
30
+ style?: React.CSSProperties;
31
+ tabIndex?: number;
32
+ theme?: VictoryThemeDefinition;
33
+ title?: string;
34
+ width?: number;
35
+ }
36
+ export declare class VictoryContainer<TProps extends VictoryContainerProps> extends React.Component<TProps> {
37
+ static displayName: string;
38
+ static role: string;
39
+ static defaultProps: {
40
+ className: string;
41
+ portalComponent: JSX.Element;
42
+ portalZIndex: number;
43
+ responsive: boolean;
44
+ role: string;
45
+ };
46
+ static contextType: React.Context<{
47
+ transitionTimer: import("..").Timer;
48
+ animationTimer: import("..").Timer;
49
+ }>;
50
+ private containerId;
51
+ private portalRef;
52
+ private containerRef;
53
+ private shouldHandleWheel;
54
+ constructor(props: TProps);
55
+ savePortalRef: (portal: any) => any;
56
+ portalUpdate: (key: any, el: any) => void;
57
+ portalRegister: () => number;
58
+ portalDeregister: (key: any) => void;
59
+ saveContainerRef: (container: HTMLElement) => HTMLElement;
60
+ handleWheel: (e: any) => any;
61
+ componentDidMount(): void;
62
+ componentWillUnmount(): void;
63
+ getIdForElement(elementName: any): string;
64
+ getChildren(props: any): any;
65
+ getOUIAProps(props: any): any;
66
+ renderContainer(props: any, svgProps: any, style: any): JSX.Element;
67
+ render(): JSX.Element;
68
+ }
69
69
  //# sourceMappingURL=victory-container.d.ts.map