victory-core 36.4.1 → 36.5.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 (227) hide show
  1. package/dist/victory-core.js +874 -879
  2. package/dist/victory-core.min.js +1 -1
  3. package/es/index.d.ts +38 -941
  4. package/es/index.js +19 -28
  5. package/es/types.d.ts +33 -0
  6. package/es/types.js +1 -0
  7. package/es/victory-accessible-group/victory-accessible-group.d.ts +25 -0
  8. package/es/victory-accessible-group/victory-accessible-group.js +8 -16
  9. package/es/victory-animation/util.d.ts +66 -0
  10. package/es/victory-animation/util.js +2 -1
  11. package/es/victory-animation/victory-animation.d.ts +69 -0
  12. package/es/victory-animation/victory-animation.js +59 -67
  13. package/es/victory-clip-container/victory-clip-container.d.ts +76 -0
  14. package/es/victory-clip-container/victory-clip-container.js +15 -21
  15. package/es/victory-container/victory-container.d.ts +99 -0
  16. package/es/victory-container/victory-container.js +31 -31
  17. package/es/victory-label/victory-label.d.ts +61 -0
  18. package/es/victory-label/victory-label.js +13 -8
  19. package/es/victory-portal/portal-context.d.ts +11 -0
  20. package/es/victory-portal/portal-context.js +3 -4
  21. package/es/victory-portal/portal.d.ts +28 -0
  22. package/es/victory-portal/portal.js +25 -33
  23. package/es/victory-portal/victory-portal.d.ts +31 -0
  24. package/es/victory-portal/victory-portal.js +23 -22
  25. package/es/victory-primitives/arc.d.ts +21 -0
  26. package/es/victory-primitives/arc.js +3 -5
  27. package/es/victory-primitives/background.d.ts +22 -0
  28. package/es/victory-primitives/background.js +4 -6
  29. package/es/victory-primitives/border.d.ts +18 -0
  30. package/es/victory-primitives/border.js +3 -5
  31. package/es/victory-primitives/circle.d.ts +2 -0
  32. package/es/victory-primitives/circle.js +11 -8
  33. package/es/victory-primitives/clip-path.d.ts +14 -0
  34. package/es/victory-primitives/clip-path.js +6 -6
  35. package/es/victory-primitives/index.d.ts +14 -0
  36. package/es/victory-primitives/index.js +14 -0
  37. package/es/victory-primitives/line-segment.d.ts +19 -0
  38. package/es/victory-primitives/line-segment.js +3 -5
  39. package/es/victory-primitives/line.d.ts +2 -0
  40. package/es/victory-primitives/line.js +11 -8
  41. package/es/victory-primitives/path.d.ts +2 -0
  42. package/es/victory-primitives/path.js +9 -6
  43. package/es/victory-primitives/point.d.ts +21 -0
  44. package/es/victory-primitives/point.js +9 -19
  45. package/es/victory-primitives/rect.d.ts +2 -0
  46. package/es/victory-primitives/rect.js +11 -8
  47. package/es/victory-primitives/text.d.ts +16 -0
  48. package/es/victory-primitives/text.js +7 -6
  49. package/es/victory-primitives/tspan.d.ts +2 -0
  50. package/es/victory-primitives/tspan.js +7 -6
  51. package/es/victory-primitives/types.d.ts +7 -0
  52. package/es/victory-primitives/types.js +1 -0
  53. package/es/victory-primitives/whisker.d.ts +24 -0
  54. package/es/victory-primitives/whisker.js +3 -5
  55. package/es/victory-theme/grayscale.d.ts +2 -0
  56. package/es/victory-theme/grayscale.js +1 -1
  57. package/es/victory-theme/material.d.ts +2 -0
  58. package/es/victory-theme/material.js +1 -1
  59. package/es/victory-theme/victory-theme-definition.d.ts +244 -0
  60. package/es/victory-theme/victory-theme-definition.js +1 -0
  61. package/es/victory-theme/victory-theme.d.ts +5 -0
  62. package/es/victory-theme/victory-theme.js +6 -5
  63. package/es/victory-transition/victory-transition.d.ts +59 -0
  64. package/es/victory-transition/victory-transition.js +19 -23
  65. package/es/victory-util/add-events.js +6 -3
  66. package/es/victory-util/axis.js +0 -1
  67. package/es/victory-util/collection.js +0 -2
  68. package/es/victory-util/data.js +0 -2
  69. package/es/victory-util/default-transitions.js +0 -1
  70. package/es/victory-util/domain.js +0 -2
  71. package/es/victory-util/helpers.js +0 -2
  72. package/es/victory-util/immutable.js +0 -1
  73. package/es/victory-util/label-helpers.js +0 -2
  74. package/es/victory-util/log.js +0 -1
  75. package/es/victory-util/point-path-helpers.d.ts +9 -0
  76. package/es/victory-util/point-path-helpers.js +59 -61
  77. package/es/victory-util/selection.d.ts +23 -0
  78. package/es/victory-util/selection.js +0 -2
  79. package/es/victory-util/style.js +0 -2
  80. package/es/victory-util/textsize.d.ts +8 -0
  81. package/es/victory-util/timer-context.d.ts +11 -0
  82. package/es/victory-util/timer.d.ts +16 -0
  83. package/es/victory-util/timer.js +13 -8
  84. package/es/victory-util/types.d.ts +188 -0
  85. package/es/victory-util/types.js +1 -0
  86. package/lib/index.d.ts +38 -941
  87. package/lib/index.js +195 -193
  88. package/lib/types.d.ts +33 -0
  89. package/lib/types.js +1 -0
  90. package/lib/victory-accessible-group/victory-accessible-group.d.ts +25 -0
  91. package/lib/victory-accessible-group/victory-accessible-group.js +9 -15
  92. package/lib/victory-animation/util.d.ts +66 -0
  93. package/lib/victory-animation/util.js +2 -1
  94. package/lib/victory-animation/victory-animation.d.ts +69 -0
  95. package/lib/victory-animation/victory-animation.js +60 -65
  96. package/lib/victory-clip-container/victory-clip-container.d.ts +76 -0
  97. package/lib/victory-clip-container/victory-clip-container.js +19 -22
  98. package/lib/victory-container/victory-container.d.ts +99 -0
  99. package/lib/victory-container/victory-container.js +34 -31
  100. package/lib/victory-label/victory-label.d.ts +61 -0
  101. package/lib/victory-label/victory-label.js +19 -13
  102. package/lib/victory-portal/portal-context.d.ts +11 -0
  103. package/lib/victory-portal/portal-context.js +3 -4
  104. package/lib/victory-portal/portal.d.ts +28 -0
  105. package/lib/victory-portal/portal.js +26 -31
  106. package/lib/victory-portal/victory-portal.d.ts +31 -0
  107. package/lib/victory-portal/victory-portal.js +24 -20
  108. package/lib/victory-primitives/arc.d.ts +21 -0
  109. package/lib/victory-primitives/arc.js +5 -6
  110. package/lib/victory-primitives/background.d.ts +22 -0
  111. package/lib/victory-primitives/background.js +7 -8
  112. package/lib/victory-primitives/border.d.ts +18 -0
  113. package/lib/victory-primitives/border.js +5 -6
  114. package/lib/victory-primitives/circle.d.ts +2 -0
  115. package/lib/victory-primitives/circle.js +11 -6
  116. package/lib/victory-primitives/clip-path.d.ts +14 -0
  117. package/lib/victory-primitives/clip-path.js +7 -5
  118. package/lib/victory-primitives/index.d.ts +14 -0
  119. package/lib/victory-primitives/index.js +187 -0
  120. package/lib/victory-primitives/line-segment.d.ts +19 -0
  121. package/lib/victory-primitives/line-segment.js +5 -6
  122. package/lib/victory-primitives/line.d.ts +2 -0
  123. package/lib/victory-primitives/line.js +11 -6
  124. package/lib/victory-primitives/path.d.ts +2 -0
  125. package/lib/victory-primitives/path.js +9 -4
  126. package/lib/victory-primitives/point.d.ts +21 -0
  127. package/lib/victory-primitives/point.js +13 -21
  128. package/lib/victory-primitives/rect.d.ts +2 -0
  129. package/lib/victory-primitives/rect.js +11 -6
  130. package/lib/victory-primitives/text.d.ts +16 -0
  131. package/lib/victory-primitives/text.js +8 -5
  132. package/lib/victory-primitives/tspan.d.ts +2 -0
  133. package/lib/victory-primitives/tspan.js +7 -4
  134. package/lib/victory-primitives/types.d.ts +7 -0
  135. package/lib/victory-primitives/types.js +1 -0
  136. package/lib/victory-primitives/whisker.d.ts +24 -0
  137. package/lib/victory-primitives/whisker.js +5 -6
  138. package/lib/victory-theme/grayscale.d.ts +2 -0
  139. package/lib/victory-theme/grayscale.js +3 -3
  140. package/lib/victory-theme/material.d.ts +2 -0
  141. package/lib/victory-theme/material.js +3 -3
  142. package/lib/victory-theme/victory-theme-definition.d.ts +244 -0
  143. package/lib/victory-theme/victory-theme-definition.js +1 -0
  144. package/lib/victory-theme/victory-theme.d.ts +5 -0
  145. package/lib/victory-theme/victory-theme.js +22 -8
  146. package/lib/victory-transition/victory-transition.d.ts +59 -0
  147. package/lib/victory-transition/victory-transition.js +21 -23
  148. package/lib/victory-util/add-events.js +8 -4
  149. package/lib/victory-util/collection.js +0 -2
  150. package/lib/victory-util/default-transitions.js +0 -1
  151. package/lib/victory-util/helpers.js +0 -2
  152. package/lib/victory-util/immutable.js +0 -2
  153. package/lib/victory-util/label-helpers.js +0 -2
  154. package/lib/victory-util/log.js +0 -1
  155. package/lib/victory-util/point-path-helpers.d.ts +9 -0
  156. package/lib/victory-util/point-path-helpers.js +86 -73
  157. package/lib/victory-util/selection.d.ts +23 -0
  158. package/lib/victory-util/selection.js +0 -2
  159. package/lib/victory-util/style.js +0 -2
  160. package/lib/victory-util/textsize.d.ts +8 -0
  161. package/lib/victory-util/timer-context.d.ts +11 -0
  162. package/lib/victory-util/timer.d.ts +16 -0
  163. package/lib/victory-util/timer.js +13 -8
  164. package/lib/victory-util/types.d.ts +188 -0
  165. package/lib/victory-util/types.js +1 -0
  166. package/package.json +4 -4
  167. package/src/index.ts +42 -0
  168. package/src/types.ts +45 -0
  169. package/src/victory-accessible-group/{victory-accessible-group.js → victory-accessible-group.tsx} +10 -3
  170. package/src/victory-animation/{util.js → util.ts} +4 -3
  171. package/src/victory-animation/{victory-animation.js → victory-animation.tsx} +89 -12
  172. package/src/victory-clip-container/{victory-clip-container.js → victory-clip-container.tsx} +29 -5
  173. package/src/victory-container/{victory-container.js → victory-container.tsx} +70 -26
  174. package/src/victory-label/{victory-label.js → victory-label.tsx} +71 -14
  175. package/src/victory-portal/portal-context.ts +14 -0
  176. package/src/victory-portal/{portal.js → portal.tsx} +23 -12
  177. package/src/victory-portal/{victory-portal.js → victory-portal.tsx} +21 -6
  178. package/src/victory-primitives/{arc.js → arc.tsx} +15 -5
  179. package/src/victory-primitives/{background.js → background.tsx} +17 -7
  180. package/src/victory-primitives/{border.js → border.tsx} +12 -5
  181. package/src/victory-primitives/{circle.js → circle.tsx} +4 -3
  182. package/src/victory-primitives/clip-path.tsx +25 -0
  183. package/src/victory-primitives/index.ts +14 -0
  184. package/src/victory-primitives/{line-segment.js → line-segment.tsx} +13 -5
  185. package/src/victory-primitives/{line.js → line.tsx} +4 -3
  186. package/src/victory-primitives/{path.js → path.tsx} +4 -3
  187. package/src/victory-primitives/{point.js → point.tsx} +25 -20
  188. package/src/victory-primitives/{rect.js → rect.tsx} +4 -2
  189. package/src/victory-primitives/{text.js → text.tsx} +9 -3
  190. package/src/victory-primitives/tspan.tsx +7 -0
  191. package/src/victory-primitives/types.ts +19 -0
  192. package/src/victory-primitives/{whisker.js → whisker.tsx} +20 -7
  193. package/src/victory-theme/{grayscale.js → grayscale.tsx} +2 -1
  194. package/src/victory-theme/{material.js → material.tsx} +2 -1
  195. package/src/victory-theme/victory-theme-definition.ts +261 -0
  196. package/src/victory-theme/victory-theme.tsx +5 -0
  197. package/src/victory-transition/{victory-transition.js → victory-transition.tsx} +68 -19
  198. package/src/victory-util/add-events.js +6 -1
  199. package/src/victory-util/axis.js +0 -1
  200. package/src/victory-util/collection.js +0 -1
  201. package/src/victory-util/data.js +0 -1
  202. package/src/victory-util/default-transitions.js +0 -1
  203. package/src/victory-util/domain.js +0 -1
  204. package/src/victory-util/events.js +1 -1
  205. package/src/victory-util/helpers.js +0 -1
  206. package/src/victory-util/immutable.js +0 -1
  207. package/src/victory-util/label-helpers.js +0 -1
  208. package/src/victory-util/log.js +0 -1
  209. package/src/victory-util/point-path-helpers.ts +119 -0
  210. package/src/victory-util/prop-types.js +0 -1
  211. package/src/victory-util/scale.js +0 -1
  212. package/src/victory-util/selection.d.ts +23 -0
  213. package/src/victory-util/selection.js +0 -1
  214. package/src/victory-util/style.js +0 -1
  215. package/src/victory-util/textsize.d.ts +8 -0
  216. package/src/victory-util/{timer-context.js → timer-context.ts} +0 -0
  217. package/src/victory-util/{timer.js → timer.ts} +19 -4
  218. package/src/victory-util/transitions.js +0 -1
  219. package/src/victory-util/types.ts +247 -0
  220. package/src/victory-util/wrapper.js +0 -1
  221. package/src/index.d.ts +0 -941
  222. package/src/index.js +0 -51
  223. package/src/victory-portal/portal-context.js +0 -10
  224. package/src/victory-primitives/clip-path.js +0 -18
  225. package/src/victory-primitives/tspan.js +0 -5
  226. package/src/victory-theme/victory-theme.js +0 -7
  227. package/src/victory-util/point-path-helpers.js +0 -121
package/es/index.js CHANGED
@@ -1,28 +1,19 @@
1
1
  // This rule doesn't play well with namespaced exports
2
2
 
3
3
  /* eslint-disable import/export */
4
- export { default as VictoryAccessibleGroup } from "./victory-accessible-group/victory-accessible-group";
5
- export { default as VictoryAnimation } from "./victory-animation/victory-animation";
6
- export { default as VictoryContainer } from "./victory-container/victory-container";
7
- export { default as VictoryLabel } from "./victory-label/victory-label";
8
- export { default as VictoryTransition } from "./victory-transition/victory-transition";
9
- export { default as VictoryClipContainer } from "./victory-clip-container/victory-clip-container";
10
- export { default as VictoryTheme } from "./victory-theme/victory-theme";
11
- export { default as VictoryPortal } from "./victory-portal/victory-portal";
12
- export { default as Portal } from "./victory-portal/portal";
13
- export { default as Arc } from "./victory-primitives/arc";
14
- export { default as Background } from "./victory-primitives/background";
15
- export { default as Border, default as Box } from "./victory-primitives/border";
16
- export { default as Circle } from "./victory-primitives/circle";
17
- export { default as ClipPath } from "./victory-primitives/clip-path";
18
- export { default as Line } from "./victory-primitives/line";
19
- export { default as LineSegment } from "./victory-primitives/line-segment";
20
- export { default as Path } from "./victory-primitives/path";
21
- export { default as Point } from "./victory-primitives/point";
22
- export { default as Rect } from "./victory-primitives/rect";
23
- export { default as Text } from "./victory-primitives/text";
24
- export { default as TSpan } from "./victory-primitives/tspan";
25
- export { default as Whisker } from "./victory-primitives/whisker";
4
+ export * from "./victory-accessible-group/victory-accessible-group";
5
+ export * from "./victory-animation/victory-animation";
6
+ export * from "./victory-container/victory-container";
7
+ export * from "./victory-label/victory-label";
8
+ export * from "./victory-transition/victory-transition";
9
+ export * from "./victory-clip-container/victory-clip-container";
10
+ export * from "./victory-theme/victory-theme";
11
+ export * from "./victory-portal/portal";
12
+ export * from "./victory-portal/portal-context";
13
+ export * from "./victory-portal/victory-portal";
14
+ export * from "./victory-primitives";
15
+ export { Border as Box } from "./victory-primitives"; // victory-util:
16
+
26
17
  export { default as addEvents } from "./victory-util/add-events";
27
18
  import * as _Collection from "./victory-util/collection";
28
19
  export { _Collection as Collection };
@@ -52,7 +43,6 @@ import * as _Style from "./victory-util/style";
52
43
  export { _Style as Style };
53
44
  import * as _TextSize from "./victory-util/textsize";
54
45
  export { _TextSize as TextSize };
55
- export { default as Timer } from "./victory-util/timer";
56
46
  import * as _Transitions from "./victory-util/transitions";
57
47
  export { _Transitions as Transitions };
58
48
  import * as _UserProps from "./victory-util/user-props";
@@ -63,11 +53,12 @@ import * as _Wrapper from "./victory-util/wrapper";
63
53
  export { _Wrapper as Wrapper };
64
54
  import * as _Axis from "./victory-util/axis";
65
55
  export { _Axis as Axis };
66
- export { default as TimerContext } from "./victory-util/timer-context";
67
- export { default as PortalContext } from "./victory-portal/portal-context";
68
56
  import * as _Hooks from "./victory-util/hooks";
69
57
  export { _Hooks as Hooks };
70
58
  import * as _LineHelpers from "./victory-util/line-helpers";
71
- export { _LineHelpers as LineHelpers }; // TODO: Fix this default export
72
-
73
- export { default as PointPathHelpers } from "./victory-util/point-path-helpers";
59
+ export { _LineHelpers as LineHelpers };
60
+ export { default as Timer } from "./victory-util/timer";
61
+ import * as _PointPathHelpers from "./victory-util/point-path-helpers";
62
+ export { _PointPathHelpers as PointPathHelpers };
63
+ export { default as TimerContext } from "./victory-util/timer-context";
64
+ export * from "./victory-util/types";
package/es/types.d.ts ADDED
@@ -0,0 +1,33 @@
1
+ /**
2
+ * This is the first parameter of a callback when a callback is used to
3
+ * resolve the value of a property instead of a concrete value.
4
+ *
5
+ * Note that additional properties here like `scale`, `x`, `y`, etc are resolved
6
+ * values of properties from the VictoryXXXProps for each component.
7
+ */
8
+ import type { D3Scale } from "./victory-util/types";
9
+ export interface CallbackArgs {
10
+ active?: boolean;
11
+ data?: any;
12
+ datum?: any;
13
+ horizontal?: boolean;
14
+ index: number | string;
15
+ x?: number;
16
+ y?: number;
17
+ scale?: {
18
+ x?: D3Scale;
19
+ y?: D3Scale;
20
+ };
21
+ tick?: any;
22
+ ticks?: any;
23
+ text?: any;
24
+ }
25
+ export declare type VictoryStringOrNumberCallback = (args: CallbackArgs) => string | number;
26
+ export declare type VictoryStringCallback = (args: CallbackArgs) => string;
27
+ export declare type StringOrNumberOrCallback = string | number | VictoryStringOrNumberCallback;
28
+ export declare type StringOrCallback = string | VictoryStringCallback;
29
+ export declare type SliceNumberOrCallback<T, P extends string | number | symbol = never> = number | ((props: Omit<T, P>) => number);
30
+ export declare type CoordinatesPropType = {
31
+ x: number;
32
+ y: number;
33
+ };
package/es/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ export interface VictoryAccessibleGroupProps {
4
+ desc?: string;
5
+ "aria-describedby"?: string;
6
+ "aria-label"?: string;
7
+ children?: React.ReactElement | React.ReactElement[];
8
+ className?: string;
9
+ tabIndex?: number;
10
+ }
11
+ export declare class VictoryAccessibleGroup extends React.Component<VictoryAccessibleGroupProps> {
12
+ static displayName: string;
13
+ static propTypes: {
14
+ "aria-describedby": PropTypes.Requireable<string>;
15
+ "aria-label": PropTypes.Requireable<string>;
16
+ children: PropTypes.Requireable<string | number | boolean | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
17
+ className: PropTypes.Requireable<string>;
18
+ desc: PropTypes.Requireable<string>;
19
+ tabIndex: PropTypes.Requireable<number>;
20
+ };
21
+ static defaultProps: {
22
+ className: string;
23
+ };
24
+ render(): JSX.Element;
25
+ }
@@ -6,7 +6,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
6
6
 
7
7
  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); }
8
8
 
9
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
9
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
10
10
 
11
11
  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); }; }
12
12
 
@@ -16,14 +16,11 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
16
16
 
17
17
  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; } }
18
18
 
19
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
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; }
19
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
22
20
 
23
21
  import React from "react";
24
22
  import PropTypes from "prop-types";
25
-
26
- var VictoryAccessibleGroup = /*#__PURE__*/function (_React$Component) {
23
+ export var VictoryAccessibleGroup = /*#__PURE__*/function (_React$Component) {
27
24
  _inherits(VictoryAccessibleGroup, _React$Component);
28
25
 
29
26
  var _super = _createSuper(VictoryAccessibleGroup);
@@ -61,20 +58,15 @@ var VictoryAccessibleGroup = /*#__PURE__*/function (_React$Component) {
61
58
 
62
59
  return VictoryAccessibleGroup;
63
60
  }(React.Component);
64
-
65
- _defineProperty(VictoryAccessibleGroup, "displayName", "VictoryAccessibleGroup");
66
-
67
- _defineProperty(VictoryAccessibleGroup, "propTypes", {
61
+ VictoryAccessibleGroup.displayName = "VictoryAccessibleGroup";
62
+ VictoryAccessibleGroup.propTypes = {
68
63
  "aria-describedby": PropTypes.string,
69
64
  "aria-label": PropTypes.string,
70
65
  children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
71
66
  className: PropTypes.string,
72
67
  desc: PropTypes.string,
73
68
  tabIndex: PropTypes.number
74
- });
75
-
76
- _defineProperty(VictoryAccessibleGroup, "defaultProps", {
69
+ };
70
+ VictoryAccessibleGroup.defaultProps = {
77
71
  className: "VictoryAccessibleGroup"
78
- });
79
-
80
- export default VictoryAccessibleGroup;
72
+ };
@@ -0,0 +1,66 @@
1
+ export declare const isInterpolatable: (obj: any) => boolean;
2
+ /**
3
+ * Interpolate immediately to the end value at the given step `when`.
4
+ * Some nicer default behavior might be to jump at the halfway point or return
5
+ * `a` if `t` is 0 (instead of always returning `b`). But d3's default
6
+ * interpolator does not do these things:
7
+ *
8
+ * d3.interpolate('aaa', 'bbb')(0) === 'bbb'
9
+ *
10
+ * ...and things might get wonky if we don't replicate that behavior.
11
+ *
12
+ * @param {any} a - Start value.
13
+ * @param {any} b - End value.
14
+ * @param {Number} when - Step value (0 to 1) at which to jump to `b`.
15
+ * @returns {Function} An interpolation function.
16
+ */
17
+ export declare const interpolateImmediate: (a: any, b: any, when?: number) => (t: any) => any;
18
+ /**
19
+ * Interpolate to or from a function. The interpolated value will be a function
20
+ * that calls `a` (if it's a function) and `b` (if it's a function) and calls
21
+ * `d3.interpolate` on the resulting values. Note that our function won't
22
+ * necessarily be called (that's up to the component this eventually gets
23
+ * passed to) - but if it does get called, it will return an appropriately
24
+ * interpolated value.
25
+ *
26
+ * @param {any} a - Start value.
27
+ * @param {any} b - End value.
28
+ * @returns {Function} An interpolation function.
29
+ */
30
+ export declare const interpolateFunction: (a: any, b: any) => (t: any) => any;
31
+ /**
32
+ * Interpolate to or from an object. This method is a modification of the object interpolator in
33
+ * d3-interpolate https://github.com/d3/d3-interpolate/blob/master/src/object.js. This interpolator
34
+ * differs in that it uses our custom interpolators when interpolating the value of each property in
35
+ * an object. This allows the correct interpolation of nested objects, including styles
36
+ *
37
+ * @param {any} a - Start value.
38
+ * @param {any} b - End value.
39
+ * @returns {Function} An interpolation function.
40
+ */
41
+ export declare const interpolateObject: (a: any, b: any) => (t: any) => {};
42
+ export declare const interpolateString: (a: any, b: any) => any;
43
+ /**
44
+ * By default, the list of interpolators used by `d3.interpolate` has a few
45
+ * downsides:
46
+ *
47
+ * - `null` values get turned into 0.
48
+ * - `undefined`, `function`, and some other value types get turned into NaN.
49
+ * - Boolean types get turned into numbers, which probably will be meaningless
50
+ * to whatever is consuming them.
51
+ * - It tries to interpolate between identical start and end values, doing
52
+ * unnecessary calculations that sometimes result in floating point rounding
53
+ * errors.
54
+ *
55
+ * If only the default interpolators are used, `VictoryAnimation` will happily
56
+ * pass down NaN (and other bad) values as props to the wrapped component.
57
+ * The component will then either use the incorrect values or complain that it
58
+ * was passed props of the incorrect type. This custom interpolator is added
59
+ * using the `d3.interpolators` API, and prevents such cases from happening
60
+ * for most values.
61
+ *
62
+ * @param {any} a - Start value.
63
+ * @param {any} b - End value.
64
+ * @returns {Function|undefined} An interpolation function, if necessary.
65
+ */
66
+ export declare const victoryInterpolator: <T>(a: T, b: T) => (t: number) => T;
@@ -87,7 +87,7 @@ export var interpolateFunction = function (a, b) {
87
87
  }
88
88
 
89
89
  return function () {
90
- /* eslint-disable no-invalid-this */
90
+ /* eslint-disable no-invalid-this, prefer-rest-params */
91
91
  var aval = typeof a === "function" ? a.apply(this, arguments) : a;
92
92
  var bval = typeof b === "function" ? b.apply(this, arguments) : b;
93
93
  return interpolate(aval, bval)(t);
@@ -200,6 +200,7 @@ export var victoryInterpolator = function (a, b) {
200
200
  }
201
201
 
202
202
  if (_isPlainObject(a) || _isPlainObject(b)) {
203
+ // @ts-expect-error These generics are tough, but they work ok?
203
204
  return interpolateObject(a, b);
204
205
  }
205
206
 
@@ -0,0 +1,69 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import TimerContext from "../victory-util/timer-context";
4
+ import type Timer from "../victory-util/timer";
5
+ /**
6
+ * Single animation object to interpolate
7
+ */
8
+ export declare type AnimationStyle = {
9
+ [key: string]: string | number;
10
+ };
11
+ /**
12
+ * Animation styles to interpolate
13
+ */
14
+ export declare type AnimationData = AnimationStyle | AnimationStyle[];
15
+ export declare type AnimationEasing = "back" | "backIn" | "backOut" | "backInOut" | "bounce" | "bounceIn" | "bounceOut" | "bounceInOut" | "circle" | "circleIn" | "circleOut" | "circleInOut" | "linear" | "linearIn" | "linearOut" | "linearInOut" | "cubic" | "cubicIn" | "cubicOut" | "cubicInOut" | "elastic" | "elasticIn" | "elasticOut" | "elasticInOut" | "exp" | "expIn" | "expOut" | "expInOut" | "poly" | "polyIn" | "polyOut" | "polyInOut" | "quad" | "quadIn" | "quadOut" | "quadInOut" | "sin" | "sinIn" | "sinOut" | "sinInOut";
16
+ export interface VictoryAnimationProps {
17
+ children: (style: AnimationStyle, info: AnimationInfo) => React.ReactNode;
18
+ duration?: number;
19
+ easing?: AnimationEasing;
20
+ delay?: number;
21
+ onEnd?: () => void;
22
+ data: AnimationData;
23
+ }
24
+ export interface VictoryAnimationState {
25
+ data: AnimationStyle;
26
+ animationInfo: AnimationInfo;
27
+ }
28
+ export interface AnimationInfo {
29
+ progress: number;
30
+ animating: boolean;
31
+ terminating?: boolean;
32
+ }
33
+ export interface VictoryAnimation {
34
+ context: React.ContextType<typeof TimerContext>;
35
+ }
36
+ export declare class VictoryAnimation extends React.Component<VictoryAnimationProps, VictoryAnimationState> {
37
+ static displayName: string;
38
+ static propTypes: {
39
+ children: PropTypes.Requireable<(...args: any[]) => any>;
40
+ data: PropTypes.Requireable<object>;
41
+ delay: PropTypes.Requireable<number>;
42
+ duration: PropTypes.Requireable<number>;
43
+ easing: PropTypes.Requireable<string>;
44
+ onEnd: PropTypes.Requireable<(...args: any[]) => any>;
45
+ };
46
+ static defaultProps: {
47
+ data: {};
48
+ delay: number;
49
+ duration: number;
50
+ easing: string;
51
+ };
52
+ static contextType: React.Context<{
53
+ transitionTimer: Timer;
54
+ animationTimer: Timer;
55
+ }>;
56
+ private interpolator;
57
+ private queue;
58
+ private ease;
59
+ private timer;
60
+ private loopID?;
61
+ constructor(props: any, context: any);
62
+ componentDidMount(): void;
63
+ componentDidUpdate(prevProps: any): void;
64
+ componentWillUnmount(): void;
65
+ toNewName(ease: any): string;
66
+ traverseQueue(): void;
67
+ functionToBeRunEachFrame: (elapsed: any, duration: any) => void;
68
+ render(): React.ReactNode;
69
+ }
@@ -18,7 +18,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
18
18
 
19
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
20
 
21
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
21
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
22
22
 
23
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); }; }
24
24
 
@@ -28,9 +28,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
28
28
 
29
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
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; }
31
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
34
32
 
35
33
  /*global setTimeout:false */
36
34
  import React from "react";
@@ -39,8 +37,7 @@ import * as d3Ease from "victory-vendor/d3-ease";
39
37
  import { victoryInterpolator } from "./util";
40
38
  import TimerContext from "../victory-util/timer-context";
41
39
  import isEqual from "react-fast-compare";
42
-
43
- var VictoryAnimation = /*#__PURE__*/function (_React$Component) {
40
+ export var VictoryAnimation = /*#__PURE__*/function (_React$Component) {
44
41
  _inherits(VictoryAnimation, _React$Component);
45
42
 
46
43
  var _super = _createSuper(VictoryAnimation);
@@ -53,6 +50,56 @@ var VictoryAnimation = /*#__PURE__*/function (_React$Component) {
53
50
  _this = _super.call(this, props, context);
54
51
  /* defaults */
55
52
 
53
+ _this.interpolator = void 0;
54
+ _this.queue = void 0;
55
+ _this.ease = void 0;
56
+ _this.timer = void 0;
57
+ _this.loopID = void 0;
58
+
59
+ _this.functionToBeRunEachFrame = function (elapsed, duration) {
60
+ /*
61
+ step can generate imprecise values, sometimes greater than 1
62
+ if this happens set the state to 1 and return, cancelling the timer
63
+ */
64
+ duration = duration !== undefined ? duration : _this.props.duration;
65
+ var step = duration ? elapsed / duration : 1;
66
+
67
+ if (step >= 1) {
68
+ _this.setState({
69
+ data: _this.interpolator(1),
70
+ animationInfo: {
71
+ progress: 1,
72
+ animating: false,
73
+ terminating: true
74
+ }
75
+ });
76
+
77
+ if (_this.loopID) {
78
+ _this.timer.unsubscribe(_this.loopID);
79
+ }
80
+
81
+ _this.queue.shift();
82
+
83
+ _this.traverseQueue();
84
+
85
+ return;
86
+ }
87
+ /*
88
+ if we're not at the end of the timer, set the state by passing
89
+ current step value that's transformed by the ease function to the
90
+ interpolator, which is cached for performance whenever props are received
91
+ */
92
+
93
+
94
+ _this.setState({
95
+ data: _this.interpolator(_this.ease(step)),
96
+ animationInfo: {
97
+ progress: step,
98
+ animating: step < 1
99
+ }
100
+ });
101
+ };
102
+
56
103
  _this.state = {
57
104
  data: Array.isArray(_this.props.data) ? _this.props.data[0] : _this.props.data,
58
105
  animationInfo: {
@@ -65,12 +112,6 @@ var VictoryAnimation = /*#__PURE__*/function (_React$Component) {
65
112
  /* build easing function */
66
113
 
67
114
  _this.ease = d3Ease[_this.toNewName(_this.props.easing)];
68
- /*
69
- There is no autobinding of this in ES6 classes
70
- so we bind functionToBeRunEachFrame to current instance of victory animation class
71
- */
72
-
73
- _this.functionToBeRunEachFrame = _this.functionToBeRunEachFrame.bind(_assertThisInitialized(_this));
74
115
  _this.timer = _this.context.animationTimer;
75
116
  return _this;
76
117
  }
@@ -171,49 +212,6 @@ var VictoryAnimation = /*#__PURE__*/function (_React$Component) {
171
212
  }
172
213
  /* every frame we... */
173
214
 
174
- }, {
175
- key: "functionToBeRunEachFrame",
176
- value: function functionToBeRunEachFrame(elapsed, duration) {
177
- /*
178
- step can generate imprecise values, sometimes greater than 1
179
- if this happens set the state to 1 and return, cancelling the timer
180
- */
181
- duration = duration !== undefined ? duration : this.props.duration;
182
- var step = duration ? elapsed / duration : 1;
183
-
184
- if (step >= 1) {
185
- this.setState({
186
- data: this.interpolator(1),
187
- animationInfo: {
188
- progress: 1,
189
- animating: false,
190
- terminating: true
191
- }
192
- });
193
-
194
- if (this.loopID) {
195
- this.timer.unsubscribe(this.loopID);
196
- }
197
-
198
- this.queue.shift();
199
- this.traverseQueue();
200
- return;
201
- }
202
- /*
203
- if we're not at the end of the timer, set the state by passing
204
- current step value that's transformed by the ease function to the
205
- interpolator, which is cached for performance whenever props are received
206
- */
207
-
208
-
209
- this.setState({
210
- data: this.interpolator(this.ease(step)),
211
- animationInfo: {
212
- progress: step,
213
- animating: step < 1
214
- }
215
- });
216
- }
217
215
  }, {
218
216
  key: "render",
219
217
  value: function render() {
@@ -223,25 +221,19 @@ var VictoryAnimation = /*#__PURE__*/function (_React$Component) {
223
221
 
224
222
  return VictoryAnimation;
225
223
  }(React.Component);
226
-
227
- _defineProperty(VictoryAnimation, "displayName", "VictoryAnimation");
228
-
229
- _defineProperty(VictoryAnimation, "propTypes", {
224
+ VictoryAnimation.displayName = "VictoryAnimation";
225
+ VictoryAnimation.propTypes = {
230
226
  children: PropTypes.func,
231
227
  data: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
232
228
  delay: PropTypes.number,
233
229
  duration: PropTypes.number,
234
230
  easing: PropTypes.oneOf(["back", "backIn", "backOut", "backInOut", "bounce", "bounceIn", "bounceOut", "bounceInOut", "circle", "circleIn", "circleOut", "circleInOut", "linear", "linearIn", "linearOut", "linearInOut", "cubic", "cubicIn", "cubicOut", "cubicInOut", "elastic", "elasticIn", "elasticOut", "elasticInOut", "exp", "expIn", "expOut", "expInOut", "poly", "polyIn", "polyOut", "polyInOut", "quad", "quadIn", "quadOut", "quadInOut", "sin", "sinIn", "sinOut", "sinInOut"]),
235
231
  onEnd: PropTypes.func
236
- });
237
-
238
- _defineProperty(VictoryAnimation, "defaultProps", {
232
+ };
233
+ VictoryAnimation.defaultProps = {
239
234
  data: {},
240
235
  delay: 0,
241
236
  duration: 1000,
242
237
  easing: "quadInOut"
243
- });
244
-
245
- _defineProperty(VictoryAnimation, "contextType", TimerContext);
246
-
247
- export { VictoryAnimation as default };
238
+ };
239
+ VictoryAnimation.contextType = TimerContext;
@@ -0,0 +1,76 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import { BlockProps } from "../victory-theme/victory-theme";
4
+ import { OriginType } from "../victory-label/victory-label";
5
+ export interface VictoryClipContainerProps {
6
+ "aria-label"?: string;
7
+ children?: React.ReactElement | React.ReactElement[];
8
+ circleComponent?: React.ReactElement;
9
+ className?: string;
10
+ clipHeight?: number;
11
+ clipId?: number | string;
12
+ clipPadding?: BlockProps;
13
+ clipPathComponent?: React.ReactElement;
14
+ clipWidth?: number;
15
+ events?: React.DOMAttributes<any>;
16
+ groupComponent?: React.ReactElement;
17
+ origin?: OriginType;
18
+ polar?: boolean;
19
+ radius?: number;
20
+ rectComponent?: React.ReactElement;
21
+ translateX?: number;
22
+ translateY?: number;
23
+ }
24
+ export declare class VictoryClipContainer extends React.Component<VictoryClipContainerProps> {
25
+ static displayName: string;
26
+ static role: string;
27
+ static propTypes: {
28
+ "aria-label": PropTypes.Requireable<string>;
29
+ children: PropTypes.Requireable<string | number | boolean | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
30
+ circleComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
31
+ className: PropTypes.Requireable<string>;
32
+ clipHeight: any;
33
+ clipId: PropTypes.Requireable<string | number>;
34
+ clipPadding: PropTypes.Requireable<PropTypes.InferProps<{
35
+ top: PropTypes.Requireable<number>;
36
+ bottom: PropTypes.Requireable<number>;
37
+ left: PropTypes.Requireable<number>;
38
+ right: PropTypes.Requireable<number>;
39
+ }>>;
40
+ clipPathComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
41
+ clipWidth: any;
42
+ events: PropTypes.Requireable<object>;
43
+ groupComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
44
+ origin: PropTypes.Requireable<PropTypes.InferProps<{
45
+ x: any;
46
+ y: any;
47
+ }>>;
48
+ polar: PropTypes.Requireable<boolean>;
49
+ radius: any;
50
+ style: PropTypes.Requireable<object>;
51
+ tabIndex: PropTypes.Requireable<number>;
52
+ transform: PropTypes.Requireable<string>;
53
+ translateX: PropTypes.Requireable<number>;
54
+ translateY: PropTypes.Requireable<number>;
55
+ };
56
+ static defaultProps: {
57
+ circleComponent: JSX.Element;
58
+ rectComponent: JSX.Element;
59
+ clipPathComponent: JSX.Element;
60
+ groupComponent: JSX.Element;
61
+ };
62
+ private clipId;
63
+ constructor(props: VictoryClipContainerProps);
64
+ calculateAttributes(props: any): {
65
+ x: number;
66
+ y: number;
67
+ width: number;
68
+ height: number;
69
+ };
70
+ renderClippedGroup(props: any, clipId: any): React.DetailedReactHTMLElement<any, HTMLElement>;
71
+ renderGroup(props: any): React.DetailedReactHTMLElement<any, HTMLElement>;
72
+ renderClipComponent(props: any, clipId: any): React.DetailedReactHTMLElement<any, HTMLElement>;
73
+ getClipValue(props: any, axis: any): any;
74
+ getTranslateValue(props: any, axis: any): any;
75
+ render(): React.DetailedReactHTMLElement<any, HTMLElement>;
76
+ }