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
@@ -9,178 +9,171 @@ exports.getPolarTextAnchor = getPolarTextAnchor;
9
9
  exports.getPolarVerticalAnchor = getPolarVerticalAnchor;
10
10
  exports.getProps = getProps;
11
11
  exports.getText = getText;
12
-
13
12
  var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
14
-
15
13
  var Helpers = _interopRequireWildcard(require("./helpers"));
16
-
17
- 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); }
18
-
19
- 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; }
20
-
14
+ 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); }
15
+ 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; }
21
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+ /* eslint-disable no-use-before-define */
22
18
 
23
19
  // Private Functions
24
- function getVerticalAnchor(props) {
25
- var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
26
- var sign = datum._y >= 0 ? 1 : -1;
27
- var labelStyle = props.style && props.style.labels || {};
28
20
 
21
+ function getVerticalAnchor(props, datum) {
22
+ if (datum === void 0) {
23
+ datum = {};
24
+ }
25
+ const sign = datum._y >= 0 ? 1 : -1;
26
+ const labelStyle = props.style && props.style.labels || {};
29
27
  if (datum.verticalAnchor || labelStyle.verticalAnchor) {
30
28
  return datum.verticalAnchor || labelStyle.verticalAnchor;
31
29
  } else if (!props.horizontal) {
32
30
  return sign >= 0 ? "end" : "start";
33
31
  }
34
-
35
32
  return "middle";
36
33
  }
37
-
38
- function getTextAnchor(props) {
39
- var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
40
- var style = props.style,
41
- horizontal = props.horizontal;
42
- var sign = datum._y >= 0 ? 1 : -1;
43
- var labelStyle = style && style.labels || {};
44
-
34
+ function getTextAnchor(props, datum) {
35
+ if (datum === void 0) {
36
+ datum = {};
37
+ }
38
+ const {
39
+ style,
40
+ horizontal
41
+ } = props;
42
+ const sign = datum._y >= 0 ? 1 : -1;
43
+ const labelStyle = style && style.labels || {};
45
44
  if (datum.verticalAnchor || labelStyle.verticalAnchor) {
46
45
  return datum.verticalAnchor || labelStyle.verticalAnchor;
47
46
  } else if (!horizontal) {
48
47
  return "middle";
49
48
  }
50
-
51
49
  return sign >= 0 ? "start" : "end";
52
50
  }
53
-
54
- function getAngle(props) {
55
- var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
56
- var labelStyle = props.style && props.style.labels || {};
51
+ function getAngle(props, datum) {
52
+ if (datum === void 0) {
53
+ datum = {};
54
+ }
55
+ const labelStyle = props.style && props.style.labels || {};
57
56
  return datum.angle === undefined ? labelStyle.angle : datum.angle;
58
57
  }
59
-
60
- function getPadding(props) {
61
- var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
62
- var horizontal = props.horizontal,
63
- style = props.style;
64
- var labelStyle = style.labels || {};
65
- var defaultPadding = Helpers.evaluateProp(labelStyle.padding, props) || 0;
66
- var sign = datum._y < 0 ? -1 : 1;
58
+ function getPadding(props, datum) {
59
+ if (datum === void 0) {
60
+ datum = {};
61
+ }
62
+ const {
63
+ horizontal,
64
+ style
65
+ } = props;
66
+ const labelStyle = style.labels || {};
67
+ const defaultPadding = Helpers.evaluateProp(labelStyle.padding, props) || 0;
68
+ const sign = datum._y < 0 ? -1 : 1;
67
69
  return {
68
70
  x: horizontal ? sign * defaultPadding : 0,
69
71
  y: horizontal ? 0 : -1 * sign * defaultPadding
70
72
  };
71
73
  }
72
-
73
74
  function getOffset(props, datum) {
74
75
  if (props.polar) {
75
76
  return {};
76
77
  }
77
-
78
- var padding = getPadding(props, datum);
78
+ const padding = getPadding(props, datum);
79
79
  return {
80
80
  dx: padding.x,
81
81
  dy: padding.y
82
82
  };
83
83
  }
84
-
85
84
  function getPosition(props, datum) {
86
- var polar = props.polar;
87
-
88
- var _Helpers$scalePoint = Helpers.scalePoint(props, datum),
89
- x = _Helpers$scalePoint.x,
90
- y = _Helpers$scalePoint.y;
91
-
85
+ const {
86
+ polar
87
+ } = props;
88
+ const {
89
+ x,
90
+ y
91
+ } = Helpers.scalePoint(props, datum);
92
92
  if (!polar) {
93
93
  return {
94
- x: x,
95
- y: y
94
+ x,
95
+ y
96
96
  };
97
97
  }
98
-
99
- var polarPadding = getPolarPadding(props, datum);
98
+ const polarPadding = getPolarPadding(props, datum);
100
99
  return {
101
100
  x: x + polarPadding.x,
102
101
  y: y + polarPadding.y
103
102
  };
104
103
  }
105
-
106
104
  function getPolarPadding(props, datum) {
107
- var style = props.style;
108
- var degrees = getDegrees(props, datum);
109
- var labelStyle = style.labels || {};
110
- var padding = Helpers.evaluateProp(labelStyle.padding, props) || 0;
111
- var angle = Helpers.degreesToRadians(degrees);
105
+ const {
106
+ style
107
+ } = props;
108
+ const degrees = getDegrees(props, datum);
109
+ const labelStyle = style.labels || {};
110
+ const padding = Helpers.evaluateProp(labelStyle.padding, props) || 0;
111
+ const angle = Helpers.degreesToRadians(degrees);
112
112
  return {
113
113
  x: padding * Math.cos(angle),
114
114
  y: -padding * Math.sin(angle)
115
115
  };
116
116
  }
117
-
118
117
  function getLabelPlacement(props) {
119
- var labelComponent = props.labelComponent,
120
- labelPlacement = props.labelPlacement,
121
- polar = props.polar;
122
- var defaultLabelPlacement = polar ? "perpendicular" : "vertical";
118
+ const {
119
+ labelComponent,
120
+ labelPlacement,
121
+ polar
122
+ } = props;
123
+ const defaultLabelPlacement = polar ? "perpendicular" : "vertical";
123
124
  return labelPlacement ? labelPlacement : labelComponent.props && labelComponent.props.labelPlacement || defaultLabelPlacement;
124
125
  }
125
-
126
126
  function getPolarOrientation(degrees) {
127
127
  // eslint-disable-next-line no-magic-numbers
128
128
  if (degrees < 45 || degrees > 315) {
129
- return "right"; // eslint-disable-next-line no-magic-numbers
129
+ return "right";
130
+ // eslint-disable-next-line no-magic-numbers
130
131
  } else if (degrees >= 45 && degrees <= 135) {
131
- return "top"; // eslint-disable-next-line no-magic-numbers
132
+ return "top";
133
+ // eslint-disable-next-line no-magic-numbers
132
134
  } else if (degrees > 135 && degrees < 225) {
133
135
  return "left";
134
136
  }
135
-
136
137
  return "bottom";
137
- } // Exported Functions
138
-
138
+ }
139
139
 
140
- function getText(props) {
141
- var datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
142
- var index = arguments.length > 2 ? arguments[2] : undefined;
140
+ // Exported Functions
143
141
 
142
+ function getText(props, datum, index) {
143
+ if (datum === void 0) {
144
+ datum = {};
145
+ }
144
146
  if (datum.label !== undefined) {
145
147
  return datum.label;
146
148
  }
147
-
148
149
  return Array.isArray(props.labels) ? props.labels[index] : props.labels;
149
150
  }
150
-
151
151
  function getPolarTextAnchor(props, degrees) {
152
- var labelPlacement = getLabelPlacement(props);
153
-
152
+ const labelPlacement = getLabelPlacement(props);
154
153
  if (labelPlacement === "perpendicular" || labelPlacement === "vertical" && (degrees === 90 || degrees === 270)) {
155
154
  return "middle";
156
155
  }
157
-
158
156
  return degrees <= 90 || degrees > 270 ? "start" : "end";
159
157
  }
160
-
161
158
  function getPolarVerticalAnchor(props, degrees) {
162
- var labelPlacement = getLabelPlacement(props);
163
- var orientation = getPolarOrientation(degrees);
164
-
159
+ const labelPlacement = getLabelPlacement(props);
160
+ const orientation = getPolarOrientation(degrees);
165
161
  if (labelPlacement === "parallel" || orientation === "left" || orientation === "right") {
166
162
  return "middle";
167
163
  }
168
-
169
164
  return orientation === "top" ? "end" : "start";
170
165
  }
171
-
172
166
  function getPolarAngle(props, baseAngle) {
173
- var labelPlacement = props.labelPlacement,
174
- datum = props.datum;
175
-
167
+ const {
168
+ labelPlacement,
169
+ datum
170
+ } = props;
176
171
  if (!labelPlacement || labelPlacement === "vertical") {
177
172
  return 0;
178
173
  }
179
-
180
- var degrees = baseAngle !== undefined ? baseAngle % 360 : getDegrees(props, datum);
181
- var sign = degrees > 90 && degrees < 180 || degrees > 270 ? 1 : -1;
182
- var angle = 0;
183
-
174
+ const degrees = baseAngle !== undefined ? baseAngle % 360 : getDegrees(props, datum);
175
+ const sign = degrees > 90 && degrees < 180 || degrees > 270 ? 1 : -1;
176
+ let angle = 0;
184
177
  if (degrees === 0 || degrees === 180) {
185
178
  angle = 90;
186
179
  } else if (degrees > 0 && degrees < 180) {
@@ -188,71 +181,67 @@ function getPolarAngle(props, baseAngle) {
188
181
  } else if (degrees > 180 && degrees < 360) {
189
182
  angle = 270 - degrees;
190
183
  }
191
-
192
- var labelRotation = labelPlacement === "perpendicular" ? 0 : 90;
184
+ const labelRotation = labelPlacement === "perpendicular" ? 0 : 90;
193
185
  return angle + sign * labelRotation;
194
186
  }
195
-
196
187
  function getDegrees(props, datum) {
197
- var _Helpers$getPoint = Helpers.getPoint(datum),
198
- x = _Helpers$getPoint.x;
199
-
188
+ const {
189
+ x
190
+ } = Helpers.getPoint(datum);
200
191
  return Helpers.radiansToDegrees(props.scale.x(x)) % 360;
201
192
  }
202
-
203
193
  function getProps(props, index) {
204
- var scale = props.scale,
205
- data = props.data,
206
- style = props.style,
207
- horizontal = props.horizontal,
208
- polar = props.polar,
209
- width = props.width,
210
- height = props.height,
211
- theme = props.theme,
212
- labelComponent = props.labelComponent,
213
- disableInlineStyles = props.disableInlineStyles;
214
- var datum = data[index];
215
- var degrees = getDegrees(props, datum);
216
- var textAnchor = polar ? getPolarTextAnchor(props, degrees) : getTextAnchor(props, datum);
217
- var verticalAnchor = polar ? getPolarVerticalAnchor(props, degrees) : getVerticalAnchor(props, datum);
218
- var angle = getAngle(props, datum);
219
- var text = getText(props, datum, index);
220
- var labelPlacement = getLabelPlacement(props);
221
-
222
- var _getPosition = getPosition(props, datum),
223
- x = _getPosition.x,
224
- y = _getPosition.y;
225
-
226
- var _getOffset = getOffset(props, datum),
227
- dx = _getOffset.dx,
228
- dy = _getOffset.dy;
229
-
230
- var labelProps = {
231
- angle: angle,
232
- data: data,
233
- datum: datum,
234
- disableInlineStyles: disableInlineStyles,
235
- horizontal: horizontal,
236
- index: index,
237
- polar: polar,
238
- scale: scale,
239
- labelPlacement: labelPlacement,
240
- text: text,
241
- textAnchor: textAnchor,
242
- verticalAnchor: verticalAnchor,
243
- x: x,
244
- y: y,
245
- dx: dx,
246
- dy: dy,
247
- width: width,
248
- height: height,
194
+ const {
195
+ scale,
196
+ data,
197
+ style,
198
+ horizontal,
199
+ polar,
200
+ width,
201
+ height,
202
+ theme,
203
+ labelComponent,
204
+ disableInlineStyles
205
+ } = props;
206
+ const datum = data[index];
207
+ const degrees = getDegrees(props, datum);
208
+ const textAnchor = polar ? getPolarTextAnchor(props, degrees) : getTextAnchor(props, datum);
209
+ const verticalAnchor = polar ? getPolarVerticalAnchor(props, degrees) : getVerticalAnchor(props, datum);
210
+ const angle = getAngle(props, datum);
211
+ const text = getText(props, datum, index);
212
+ const labelPlacement = getLabelPlacement(props);
213
+ const {
214
+ x,
215
+ y
216
+ } = getPosition(props, datum);
217
+ const {
218
+ dx,
219
+ dy
220
+ } = getOffset(props, datum);
221
+ const labelProps = {
222
+ angle,
223
+ data,
224
+ datum,
225
+ disableInlineStyles,
226
+ horizontal,
227
+ index,
228
+ polar,
229
+ scale,
230
+ labelPlacement,
231
+ text,
232
+ textAnchor,
233
+ verticalAnchor,
234
+ x,
235
+ y,
236
+ dx,
237
+ dy,
238
+ width,
239
+ height,
249
240
  style: style.labels
250
241
  };
251
-
252
242
  if (!Helpers.isTooltip(labelComponent)) {
253
243
  return labelProps;
254
244
  }
255
-
256
- var tooltipTheme = theme && theme.tooltip || {};
245
+ const tooltipTheme = theme && theme.tooltip || {};
257
246
  return (0, _defaults2.default)({}, labelProps, Helpers.omit(tooltipTheme, ["style"]));
258
247
  }
@@ -1,5 +1,5 @@
1
- import * as d3Shape from "victory-vendor/d3-shape";
2
- export declare type CurveName = "basis" | "cardinal" | "bumpX" | "bumpY" | "bundle" | "catmullRom" | "linear" | "monotoneX" | "monotoneY" | "step" | "stepAfter" | "stepBefore" | "natural";
3
- export declare const getInterpolationFunction: (props: any) => any;
4
- export declare const getLineFunction: (props: any) => d3Shape.LineRadial<[number, number]> | d3Shape.Line<[number, number]>;
1
+ import * as d3Shape from "victory-vendor/d3-shape";
2
+ export declare type CurveName = "basis" | "cardinal" | "bumpX" | "bumpY" | "bundle" | "catmullRom" | "linear" | "monotoneX" | "monotoneY" | "step" | "stepAfter" | "stepBefore" | "natural";
3
+ export declare const getInterpolationFunction: (props: any) => any;
4
+ export declare const getLineFunction: (props: any) => d3Shape.LineRadial<[number, number]> | d3Shape.Line<[number, number]>;
5
5
  //# sourceMappingURL=line-helpers.d.ts.map
@@ -4,75 +4,57 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getLineFunction = exports.getInterpolationFunction = void 0;
7
-
8
7
  var d3Shape = _interopRequireWildcard(require("victory-vendor/d3-shape"));
9
-
10
- 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); }
11
-
12
- 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; }
13
-
14
- var defined = function (d) {
15
- var y = d._y1 !== undefined ? d._y1 : d._y;
8
+ 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); }
9
+ 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; }
10
+ const defined = d => {
11
+ const y = d._y1 !== undefined ? d._y1 : d._y;
16
12
  return y !== null && y !== undefined && d._y0 !== null;
17
13
  };
18
-
19
- var getXAccessor = function (scale) {
20
- return function (d) {
21
- return scale.x(d._x1 !== undefined ? d._x1 : d._x);
22
- };
14
+ const getXAccessor = scale => {
15
+ return d => scale.x(d._x1 !== undefined ? d._x1 : d._x);
23
16
  };
24
-
25
- var getYAccessor = function (scale) {
26
- return function (d) {
27
- return scale.y(d._y1 !== undefined ? d._y1 : d._y);
28
- };
17
+ const getYAccessor = scale => {
18
+ return d => scale.y(d._y1 !== undefined ? d._y1 : d._y);
29
19
  };
30
-
31
- var getAngleAccessor = function (scale) {
32
- return function (d) {
33
- var x = scale.x(d._x1 !== undefined ? d._x1 : d._x);
20
+ const getAngleAccessor = scale => {
21
+ return d => {
22
+ const x = scale.x(d._x1 !== undefined ? d._x1 : d._x);
34
23
  return -1 * x + Math.PI / 2;
35
24
  };
36
25
  };
37
-
38
- var toNewName = function (interpolation) {
26
+ const toNewName = interpolation => {
39
27
  // d3 shape changed the naming scheme for interpolators from "basis" -> "curveBasis" etc.
40
- var capitalize = function (s) {
41
- return s && s[0].toUpperCase() + s.slice(1);
42
- };
43
-
44
- return "curve".concat(capitalize(interpolation));
28
+ const capitalize = s => s && s[0].toUpperCase() + s.slice(1);
29
+ return `curve${capitalize(interpolation)}`;
45
30
  };
46
-
47
- var toNewNameClosed = function (interpolation) {
48
- return "".concat(toNewName(interpolation), "Closed");
31
+ const toNewNameClosed = interpolation => {
32
+ return `${toNewName(interpolation)}Closed`;
49
33
  };
50
-
51
- var getInterpolationFunction = function (props) {
52
- var interpolation = props.interpolation;
53
-
34
+ const getInterpolationFunction = props => {
35
+ const {
36
+ interpolation
37
+ } = props;
54
38
  if (typeof interpolation === "function") {
55
39
  return interpolation;
56
40
  }
57
-
58
41
  if (typeof interpolation === "string") {
59
- var polar = props.polar,
60
- _props$openCurve = props.openCurve,
61
- openCurve = _props$openCurve === void 0 ? !polar : _props$openCurve;
62
- var interpolationName = !openCurve ? toNewNameClosed(interpolation) : toNewName(interpolation);
42
+ const {
43
+ polar,
44
+ openCurve = !polar
45
+ } = props;
46
+ const interpolationName = !openCurve ? toNewNameClosed(interpolation) : toNewName(interpolation);
63
47
  return d3Shape[interpolationName];
64
48
  }
65
-
66
49
  return d3Shape.curveLinear;
67
50
  };
68
-
69
51
  exports.getInterpolationFunction = getInterpolationFunction;
70
-
71
- var getLineFunction = function (props) {
72
- var polar = props.polar,
73
- scale = props.scale,
74
- horizontal = props.horizontal;
52
+ const getLineFunction = props => {
53
+ const {
54
+ polar,
55
+ scale,
56
+ horizontal
57
+ } = props;
75
58
  return polar ? d3Shape.lineRadial().defined(defined).curve(getInterpolationFunction(props)).angle(getAngleAccessor(scale)).radius(getYAccessor(scale)) : d3Shape.line().defined(defined).curve(getInterpolationFunction(props)).x(horizontal ? getYAccessor(scale) : getXAccessor(scale)).y(horizontal ? getXAccessor(scale) : getYAccessor(scale));
76
59
  };
77
-
78
60
  exports.getLineFunction = getLineFunction;
@@ -1,2 +1,2 @@
1
- export declare function warn(message: string): void;
1
+ export declare function warn(message: string): void;
2
2
  //# sourceMappingURL=log.d.ts.map
@@ -4,10 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.warn = warn;
7
-
8
7
  /* global console */
9
-
10
8
  /* eslint-disable no-console */
9
+
11
10
  // TODO: Use "warning" npm module like React is switching to.
12
11
  function warn(message) {
13
12
  if (process.env.NODE_ENV !== "production") {
@@ -1,10 +1,10 @@
1
- export declare function circle(x: number, y: number, size: number): string;
2
- export declare function square(x: number, y: number, size: number): string;
3
- export declare function diamond(x: number, y: number, size: number): string;
4
- export declare function triangleDown(x: number, y: number, size: number): string;
5
- export declare function triangleUp(x: number, y: number, size: number): string;
6
- export declare function plus(x: number, y: number, size: number): string;
7
- export declare function cross(x: number, y: number, size: number): string;
8
- export declare function minus(x: number, y: number, size: number): string;
9
- export declare function star(x: number, y: number, size: number): string;
1
+ export declare function circle(x: number, y: number, size: number): string;
2
+ export declare function square(x: number, y: number, size: number): string;
3
+ export declare function diamond(x: number, y: number, size: number): string;
4
+ export declare function triangleDown(x: number, y: number, size: number): string;
5
+ export declare function triangleUp(x: number, y: number, size: number): string;
6
+ export declare function plus(x: number, y: number, size: number): string;
7
+ export declare function cross(x: number, y: number, size: number): string;
8
+ export declare function minus(x: number, y: number, size: number): string;
9
+ export declare function star(x: number, y: number, size: number): string;
10
10
  //# sourceMappingURL=point-path-helpers.d.ts.map