victory-core 37.3.2 → 37.3.4

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 (127) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/victory-core.js +423 -371
  3. package/dist/victory-core.min.js +1 -1
  4. package/es/types/callbacks.d.ts +11 -11
  5. package/es/types/prop-types.d.ts +28 -28
  6. package/es/victory-animation/util.js +6 -6
  7. package/es/victory-animation/victory-animation.d.ts +3 -3
  8. package/es/victory-clip-container/victory-clip-container.d.ts +6 -1
  9. package/es/victory-clip-container/victory-clip-container.js +20 -12
  10. package/es/victory-container/victory-container.js +2 -2
  11. package/es/victory-label/victory-label.d.ts +3 -3
  12. package/es/victory-label/victory-label.js +12 -16
  13. package/es/victory-portal/victory-portal.js +4 -4
  14. package/es/victory-primitives/arc.js +2 -2
  15. package/es/victory-primitives/background.js +2 -2
  16. package/es/victory-primitives/border.js +2 -2
  17. package/es/victory-primitives/line-segment.js +2 -2
  18. package/es/victory-primitives/point.js +2 -2
  19. package/es/victory-primitives/tspan.d.ts +0 -1
  20. package/es/victory-primitives/types.d.ts +1 -1
  21. package/es/victory-primitives/whisker.d.ts +1 -1
  22. package/es/victory-primitives/whisker.js +2 -2
  23. package/es/victory-theme/types.d.ts +11 -11
  24. package/es/victory-transition/victory-transition.d.ts +1 -1
  25. package/es/victory-transition/victory-transition.js +7 -7
  26. package/es/victory-util/add-events.d.ts +8 -8
  27. package/es/victory-util/add-events.js +13 -13
  28. package/es/victory-util/axis.js +11 -11
  29. package/es/victory-util/data.js +16 -16
  30. package/es/victory-util/domain.js +13 -13
  31. package/es/victory-util/events.d.ts +4 -4
  32. package/es/victory-util/events.js +14 -14
  33. package/es/victory-util/helpers.d.ts +94 -19
  34. package/es/victory-util/helpers.js +95 -49
  35. package/es/victory-util/hooks/use-animation-state.d.ts +2 -2
  36. package/es/victory-util/hooks/use-animation-state.js +4 -4
  37. package/es/victory-util/label-helpers.d.ts +4 -3
  38. package/es/victory-util/label-helpers.js +3 -2
  39. package/es/victory-util/line-helpers.d.ts +1 -1
  40. package/es/victory-util/log.js +3 -2
  41. package/es/victory-util/merge-refs.d.ts +1 -1
  42. package/es/victory-util/scale.js +2 -2
  43. package/es/victory-util/selection.d.ts +3 -3
  44. package/es/victory-util/textsize.js +7 -5
  45. package/es/victory-util/timer.d.ts +1 -1
  46. package/es/victory-util/transitions.d.ts +1 -1
  47. package/es/victory-util/transitions.js +12 -12
  48. package/es/victory-util/type-helpers.d.ts +0 -1
  49. package/es/victory-util/type-helpers.js +0 -5
  50. package/es/victory-util/user-props.d.ts +2 -2
  51. package/es/victory-util/wrapper.js +12 -12
  52. package/lib/types/callbacks.d.ts +11 -11
  53. package/lib/types/prop-types.d.ts +28 -28
  54. package/lib/victory-animation/util.js +6 -6
  55. package/lib/victory-animation/victory-animation.d.ts +3 -3
  56. package/lib/victory-clip-container/victory-clip-container.d.ts +6 -1
  57. package/lib/victory-clip-container/victory-clip-container.js +20 -12
  58. package/lib/victory-container/victory-container.js +3 -3
  59. package/lib/victory-label/victory-label.d.ts +3 -3
  60. package/lib/victory-label/victory-label.js +12 -16
  61. package/lib/victory-portal/victory-portal.js +5 -5
  62. package/lib/victory-primitives/arc.js +2 -2
  63. package/lib/victory-primitives/background.js +2 -2
  64. package/lib/victory-primitives/border.js +2 -2
  65. package/lib/victory-primitives/line-segment.js +2 -2
  66. package/lib/victory-primitives/point.js +2 -2
  67. package/lib/victory-primitives/tspan.d.ts +0 -1
  68. package/lib/victory-primitives/types.d.ts +1 -1
  69. package/lib/victory-primitives/whisker.d.ts +1 -1
  70. package/lib/victory-primitives/whisker.js +2 -2
  71. package/lib/victory-theme/types.d.ts +11 -11
  72. package/lib/victory-transition/victory-transition.d.ts +1 -1
  73. package/lib/victory-transition/victory-transition.js +7 -7
  74. package/lib/victory-util/add-events.d.ts +8 -8
  75. package/lib/victory-util/add-events.js +13 -13
  76. package/lib/victory-util/axis.js +11 -11
  77. package/lib/victory-util/data.js +16 -16
  78. package/lib/victory-util/domain.js +13 -13
  79. package/lib/victory-util/events.d.ts +4 -4
  80. package/lib/victory-util/events.js +14 -14
  81. package/lib/victory-util/helpers.d.ts +94 -19
  82. package/lib/victory-util/helpers.js +96 -50
  83. package/lib/victory-util/hooks/use-animation-state.d.ts +2 -2
  84. package/lib/victory-util/hooks/use-animation-state.js +4 -4
  85. package/lib/victory-util/label-helpers.d.ts +4 -3
  86. package/lib/victory-util/label-helpers.js +3 -3
  87. package/lib/victory-util/line-helpers.d.ts +1 -1
  88. package/lib/victory-util/log.js +3 -2
  89. package/lib/victory-util/merge-refs.d.ts +1 -1
  90. package/lib/victory-util/scale.js +2 -2
  91. package/lib/victory-util/selection.d.ts +3 -3
  92. package/lib/victory-util/textsize.js +5 -5
  93. package/lib/victory-util/timer.d.ts +1 -1
  94. package/lib/victory-util/transitions.d.ts +1 -1
  95. package/lib/victory-util/transitions.js +12 -12
  96. package/lib/victory-util/type-helpers.d.ts +0 -1
  97. package/lib/victory-util/type-helpers.js +0 -6
  98. package/lib/victory-util/user-props.d.ts +2 -2
  99. package/lib/victory-util/wrapper.js +12 -12
  100. package/package.json +2 -30
  101. package/src/victory-animation/util.ts +3 -1
  102. package/src/victory-clip-container/victory-clip-container.tsx +26 -11
  103. package/src/victory-container/victory-container.tsx +1 -1
  104. package/src/victory-label/victory-label.tsx +5 -3
  105. package/src/victory-portal/victory-portal.tsx +3 -1
  106. package/src/victory-primitives/arc.tsx +1 -1
  107. package/src/victory-primitives/background.tsx +1 -1
  108. package/src/victory-primitives/border.tsx +1 -1
  109. package/src/victory-primitives/line-segment.tsx +1 -1
  110. package/src/victory-primitives/point.tsx +1 -1
  111. package/src/victory-primitives/whisker.tsx +1 -1
  112. package/src/victory-transition/victory-transition.tsx +4 -2
  113. package/src/victory-util/add-events.tsx +5 -2
  114. package/src/victory-util/axis.tsx +7 -3
  115. package/src/victory-util/data.ts +9 -10
  116. package/src/victory-util/domain.ts +8 -4
  117. package/src/victory-util/events.ts +4 -1
  118. package/src/victory-util/helpers.ts +155 -39
  119. package/src/victory-util/hooks/use-animation-state.ts +1 -1
  120. package/src/victory-util/label-helpers.ts +1 -1
  121. package/src/victory-util/log.ts +3 -2
  122. package/src/victory-util/scale.ts +1 -1
  123. package/src/victory-util/textsize.ts +2 -1
  124. package/src/victory-util/transitions.ts +3 -1
  125. package/src/victory-util/type-helpers.ts +0 -5
  126. package/src/victory-util/user-props.ts +1 -1
  127. package/src/victory-util/wrapper.tsx +5 -1
@@ -2,22 +2,22 @@ import * as React from "react";
2
2
  import { VictoryCommonThemeProps, VictoryDatableProps } from "../victory-util/common-props";
3
3
  import { NumberOrCallback, OrientationOrCallback, PaddingOrCallback, StringOrNumberOrCallback } from "../types/callbacks";
4
4
  import { DomainPropType } from "../types/prop-types";
5
- export declare type BlockProps = {
5
+ export type BlockProps = {
6
6
  top?: number;
7
7
  bottom?: number;
8
8
  left?: number;
9
9
  right?: number;
10
10
  };
11
- export declare type PaddingProps = number | BlockProps;
12
- export declare type OrientationTypes = "top" | "bottom" | "left" | "right";
13
- export declare type VictoryStyleObject = {
11
+ export type PaddingProps = number | BlockProps;
12
+ export type OrientationTypes = "top" | "bottom" | "left" | "right";
13
+ export type VictoryStyleObject = {
14
14
  [K in keyof React.CSSProperties]: StringOrNumberOrCallback;
15
15
  };
16
- export declare type LabelProps = React.CSSProperties & {
16
+ export type LabelProps = React.CSSProperties & {
17
17
  angle?: number;
18
18
  verticalAnchor?: VerticalAnchorType;
19
19
  };
20
- export declare type VictoryLabelStyleObject = {
20
+ export type VictoryLabelStyleObject = {
21
21
  [K in keyof LabelProps]: StringOrNumberOrCallback;
22
22
  };
23
23
  /**
@@ -29,10 +29,10 @@ export interface VictoryStyleInterface {
29
29
  labels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
30
30
  border?: VictoryStyleObject;
31
31
  }
32
- export declare type TickProps = React.CSSProperties & {
32
+ export type TickProps = React.CSSProperties & {
33
33
  size?: number;
34
34
  };
35
- export declare type VictoryTickStyleObject = {
35
+ export type VictoryTickStyleObject = {
36
36
  [K in keyof TickProps]: StringOrNumberOrCallback;
37
37
  };
38
38
  export interface VictoryAxisCommonProps {
@@ -59,9 +59,9 @@ export interface VictoryAxisCommonProps {
59
59
  };
60
60
  tickValues?: any[];
61
61
  }
62
- export declare type VerticalAnchorType = "start" | "middle" | "end";
63
- declare type VictoryThemePaletteKeys = "blue" | "pink" | "teal" | "purple" | "green" | "orange" | "cyan" | "red" | "yellow";
64
- export declare type VictoryThemePalette = {
62
+ export type VerticalAnchorType = "start" | "middle" | "end";
63
+ type VictoryThemePaletteKeys = "blue" | "pink" | "teal" | "purple" | "green" | "orange" | "cyan" | "red" | "yellow";
64
+ export type VictoryThemePalette = {
65
65
  [key in VictoryThemePaletteKeys]?: string;
66
66
  };
67
67
  export interface VictoryThemeDefinition {
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import TimerContext from "../victory-util/timer-context";
3
3
  import Timer from "../victory-util/timer";
4
- declare type VictoryTransitionChild = React.ReactElement<{
4
+ type VictoryTransitionChild = React.ReactElement<{
5
5
  polar?: boolean;
6
6
  domain?: number[] | {
7
7
  x: number[];
@@ -4,15 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.VictoryTransition = void 0;
7
- var _pick2 = _interopRequireDefault(require("lodash/pick"));
8
- var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
9
7
  var _react = _interopRequireDefault(require("react"));
8
+ var _defaults = _interopRequireDefault(require("lodash/defaults"));
9
+ var _pick = _interopRequireDefault(require("lodash/pick"));
10
+ var _reactFastCompare = _interopRequireDefault(require("react-fast-compare"));
10
11
  var _victoryAnimation = require("../victory-animation/victory-animation");
11
12
  var Collection = _interopRequireWildcard(require("../victory-util/collection"));
12
13
  var Helpers = _interopRequireWildcard(require("../victory-util/helpers"));
13
14
  var _timerContext = _interopRequireDefault(require("../victory-util/timer-context"));
14
15
  var Transitions = _interopRequireWildcard(require("../victory-util/transitions"));
15
- var _reactFastCompare = _interopRequireDefault(require("react-fast-compare"));
16
16
  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); }
17
17
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -130,13 +130,13 @@ class VictoryTransition extends _react.default.Component {
130
130
  y: this.getDomainFromChildren(props, "y")
131
131
  };
132
132
  const clipWidth = this.getClipWidth(props, child);
133
- const combinedProps = (0, _defaults2.default)({
133
+ const combinedProps = (0, _defaults.default)({
134
134
  domain,
135
135
  clipWidth
136
136
  }, transitionProps, child.props);
137
137
  const animationWhitelist = props.animationWhitelist || [];
138
138
  const whitelist = animationWhitelist.concat(["clipWidth"]);
139
- const propsToAnimate = whitelist.length ? (0, _pick2.default)(combinedProps, whitelist) : combinedProps;
139
+ const propsToAnimate = whitelist.length ? (0, _pick.default)(combinedProps, whitelist) : combinedProps;
140
140
  return /*#__PURE__*/_react.default.createElement(_victoryAnimation.VictoryAnimation, _extends({}, combinedProps.animate, {
141
141
  data: propsToAnimate
142
142
  }), newProps => {
@@ -144,13 +144,13 @@ class VictoryTransition extends _react.default.Component {
144
144
  const groupComponent = this.continuous ? /*#__PURE__*/_react.default.cloneElement(child.props.groupComponent, {
145
145
  clipWidth: newProps.clipWidth || 0
146
146
  }) : child.props.groupComponent;
147
- return /*#__PURE__*/_react.default.cloneElement(child, (0, _defaults2.default)({
147
+ return /*#__PURE__*/_react.default.cloneElement(child, (0, _defaults.default)({
148
148
  animate: null,
149
149
  animating: true,
150
150
  groupComponent
151
151
  }, newProps, combinedProps));
152
152
  }
153
- return /*#__PURE__*/_react.default.cloneElement(child, (0, _defaults2.default)({
153
+ return /*#__PURE__*/_react.default.cloneElement(child, (0, _defaults.default)({
154
154
  animate: null,
155
155
  animating: true
156
156
  }, newProps, combinedProps));
@@ -3,7 +3,7 @@ import { VictoryLabelableProps } from "../types/prop-types";
3
3
  import { VictoryCommonProps, VictoryDatableProps } from "./common-props";
4
4
  import type { ComponentEvent } from "./events";
5
5
  import * as Events from "./events";
6
- export declare type MixinOptions = {
6
+ export type MixinOptions = {
7
7
  components?: Array<{
8
8
  name: string;
9
9
  index?: string | number;
@@ -24,7 +24,7 @@ export interface EventsMixinClass<TProps> {
24
24
  renderContainer(component: React.ReactElement, children: React.ReactElement | React.ReactElement[]): React.ReactElement;
25
25
  cacheValues<TThis>(this: TThis, obj: Partial<TThis>): void;
26
26
  getEventState: typeof Events.getEventState;
27
- renderData(props: TProps): any;
27
+ renderData(props: TProps, shouldRenderDatum?: () => boolean): any;
28
28
  renderContinuousData(props: TProps): any;
29
29
  animateComponent(props: TProps, defaultAnimationWhitelist: string[]): React.ReactElement;
30
30
  getComponentProps(component: React.ReactNode, type: string, index: string | number): TProps;
@@ -44,12 +44,12 @@ export interface EventMixinCalculatedValues {
44
44
  /**
45
45
  * These are the common roles that we care about internally.
46
46
  */
47
- export declare type VictoryComponentCommonRole = "container" | "group" | "histogram" | "label" | "line" | "portal" | "stack" | "tooltip" | "voronoi";
47
+ export type VictoryComponentCommonRole = "container" | "group" | "histogram" | "label" | "line" | "portal" | "stack" | "tooltip" | "voronoi";
48
48
  /**
49
49
  * A component can have any "role",
50
50
  * but there are certain ones that we actually care about internally
51
51
  */
52
- export declare type VictoryComponentRole = VictoryComponentCommonRole | string;
52
+ export type VictoryComponentRole = VictoryComponentCommonRole | string;
53
53
  /**
54
54
  * Static component fields used by Victory for common behavior
55
55
  */
@@ -111,17 +111,17 @@ export declare function addEvents<TBase extends WrappedComponentClass<TProps>, T
111
111
  UNSAFE_componentWillReceiveProps?(nextProps: Readonly<TProps>, nextContext: any): void;
112
112
  componentWillUpdate?(nextProps: Readonly<TProps>, nextState: Readonly<{}>, nextContext: any): void;
113
113
  UNSAFE_componentWillUpdate?(nextProps: Readonly<TProps>, nextState: Readonly<{}>, nextContext: any): void;
114
- componentEvents: ComponentEvent[];
114
+ componentEvents: Array<ComponentEvent>;
115
115
  getSharedEventState: (key: string, value: string) => unknown;
116
116
  baseProps: Record<string, object>;
117
117
  dataKeys: string[];
118
118
  hasEvents: unknown;
119
119
  events: unknown;
120
120
  };
121
- getBaseProps?(props: TProps): Record<string, object>;
122
- role?: string | undefined;
121
+ getBaseProps?(props: TProps): EventMixinCalculatedValues["baseProps"];
122
+ role?: VictoryComponentRole;
123
123
  expectedComponents?: (string | keyof TProps)[] | undefined;
124
- getChildren?: ((props: TProps, childComponents?: React.ReactNode[] | undefined, calculatedProps?: TProps | undefined) => void) | undefined;
124
+ getChildren?: ((props: TProps, childComponents?: Array<React.ReactNode>, calculatedProps?: TProps | undefined) => void) | undefined;
125
125
  animationWhitelist?: (string | keyof TProps)[] | undefined;
126
126
  } & TBase;
127
127
  //# sourceMappingURL=add-events.d.ts.map
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.addEvents = addEvents;
7
- var _pick2 = _interopRequireDefault(require("lodash/pick"));
8
- var _isEmpty2 = _interopRequireDefault(require("lodash/isEmpty"));
9
- var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
10
7
  var _react = _interopRequireDefault(require("react"));
8
+ var _defaults = _interopRequireDefault(require("lodash/defaults"));
9
+ var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
10
+ var _pick = _interopRequireDefault(require("lodash/pick"));
11
11
  var _reactFastCompare = _interopRequireDefault(require("react-fast-compare"));
12
12
  var _victoryTransition = require("../victory-transition/victory-transition");
13
13
  var _collection = require("./collection");
@@ -146,8 +146,8 @@ function addEvents(WrappedComponent, options) {
146
146
  return {};
147
147
  }
148
148
  const getState = (key, type) => {
149
- const result = (0, _defaults2.default)({}, this.getEventState(key, type), this.getSharedEventState(key, type));
150
- return (0, _isEmpty2.default)(result) ? undefined : result;
149
+ const result = (0, _defaults.default)({}, this.getEventState(key, type), this.getSharedEventState(key, type));
150
+ return (0, _isEmpty.default)(result) ? undefined : result;
151
151
  };
152
152
  const components = options.components || defaultComponents;
153
153
  const stateChanges = components.map(component => {
@@ -160,7 +160,7 @@ function addEvents(WrappedComponent, options) {
160
160
  return stateChanges;
161
161
  }
162
162
  applyExternalMutations(props, externalMutations) {
163
- if (!(0, _isEmpty2.default)(externalMutations)) {
163
+ if (!(0, _isEmpty.default)(externalMutations)) {
164
164
  const callbacks = props.externalEventMutations.reduce((memo, mutation) => (0, _helpers.isFunction)(mutation.callback) ? memo.concat(mutation.callback) : memo, []);
165
165
  const compiledCallbacks = callbacks.length ? () => {
166
166
  callbacks.forEach(c => c());
@@ -193,7 +193,7 @@ function addEvents(WrappedComponent, options) {
193
193
  sharedEvents,
194
194
  externalEventMutations
195
195
  } = props;
196
- return (0, _isEmpty2.default)(externalEventMutations) || sharedEvents ? undefined : Events.getExternalMutations(externalEventMutations, this.baseProps, this.state);
196
+ return (0, _isEmpty.default)(externalEventMutations) || sharedEvents ? undefined : Events.getExternalMutations(externalEventMutations, this.baseProps, this.state);
197
197
  }
198
198
  cacheValues(obj) {
199
199
  Object.keys(obj).forEach(key => {
@@ -204,10 +204,10 @@ function addEvents(WrappedComponent, options) {
204
204
  const getSharedEventStateFunction = getSharedEventState || this.getSharedEventState.bind(this);
205
205
  const sharedParentState = getSharedEventStateFunction("parent", "parent");
206
206
  const parentState = this.getEventState("parent", "parent");
207
- const baseParentProps = (0, _defaults2.default)({}, parentState, sharedParentState);
207
+ const baseParentProps = (0, _defaults.default)({}, parentState, sharedParentState);
208
208
  const parentPropsList = baseParentProps.parentControlledProps;
209
- const parentProps = parentPropsList ? (0, _pick2.default)(baseParentProps, parentPropsList) : {};
210
- const modifiedProps = (0, _defaults2.default)({}, parentProps, props);
209
+ const parentProps = parentPropsList ? (0, _pick.default)(baseParentProps, parentPropsList) : {};
210
+ const modifiedProps = (0, _defaults.default)({}, parentProps, props);
211
211
  return typeof WrappedComponent.getBaseProps === "function" ? WrappedComponent.getBaseProps(modifiedProps) : {};
212
212
  }
213
213
  getAllEvents(props) {
@@ -227,18 +227,18 @@ function addEvents(WrappedComponent, options) {
227
227
  const currentProps = component && typeof component === "object" && "props" in component ? component.props : undefined;
228
228
  if (this.hasEvents) {
229
229
  const baseEvents = this.getEvents(this.props, type, key);
230
- const componentProps = (0, _defaults2.default)({
230
+ const componentProps = (0, _defaults.default)({
231
231
  index,
232
232
  key: id
233
233
  }, this.getEventState(key, type), this.getSharedEventState(key, type), currentProps, baseProps, {
234
234
  id
235
235
  });
236
- const events = (0, _defaults2.default)({}, Events.getPartialEvents(baseEvents, key, componentProps), componentProps.events);
236
+ const events = (0, _defaults.default)({}, Events.getPartialEvents(baseEvents, key, componentProps), componentProps.events);
237
237
  return Object.assign({}, componentProps, {
238
238
  events
239
239
  });
240
240
  }
241
- return (0, _defaults2.default)({
241
+ return (0, _defaults.default)({
242
242
  index,
243
243
  key: id
244
244
  }, currentProps, baseProps, {
@@ -16,11 +16,11 @@ exports.getTicks = getTicks;
16
16
  exports.isVertical = isVertical;
17
17
  exports.modifyProps = modifyProps;
18
18
  exports.stringTicks = stringTicks;
19
- var _orderBy2 = _interopRequireDefault(require("lodash/orderBy"));
20
- var _uniq2 = _interopRequireDefault(require("lodash/uniq"));
21
- var _isObject2 = _interopRequireDefault(require("lodash/isObject"));
22
- var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
23
19
  var _react = _interopRequireDefault(require("react"));
20
+ var _defaults = _interopRequireDefault(require("lodash/defaults"));
21
+ var _isObject = _interopRequireDefault(require("lodash/isObject"));
22
+ var _uniq = _interopRequireDefault(require("lodash/uniq"));
23
+ var _orderBy = _interopRequireDefault(require("lodash/orderBy"));
24
24
  var Collection = _interopRequireWildcard(require("./collection"));
25
25
  var Domain = _interopRequireWildcard(require("./domain"));
26
26
  var Helpers = _interopRequireWildcard(require("./helpers"));
@@ -159,7 +159,7 @@ function getDefaultTickFormat(props) {
159
159
  return stringTicks(props) ? (x, index) => tickValues[index] : fallbackFormat;
160
160
  }
161
161
  const invertedStringMap = stringMap && Helpers.invert(stringMap);
162
- const tickValueArray = (0, _orderBy2.default)(Object.values(stringMap), n => n);
162
+ const tickValueArray = (0, _orderBy.default)(Object.values(stringMap), n => n);
163
163
  const dataNames = tickValueArray.map(tick => invertedStringMap[tick]);
164
164
  // string ticks should have one tick of padding at the beginning
165
165
  const dataTicks = ["", ...dataNames, ""];
@@ -196,14 +196,14 @@ function getTickArray(props) {
196
196
  if (tickValues && Collection.containsStrings(tickValues)) {
197
197
  ticks = stringMap ? tickValues.map(tick => stringMap[tick]) : Helpers.range(1, tickValues.length + 1);
198
198
  }
199
- const tickArray = ticks ? (0, _uniq2.default)(ticks) : getTicksFromFormat();
199
+ const tickArray = ticks ? (0, _uniq.default)(ticks) : getTicksFromFormat();
200
200
  const buildTickArray = arr => {
201
201
  const newTickArray = [];
202
202
  const domain = props.domain && props.domain[axis] || props.domain;
203
203
  if (arr) {
204
204
  arr.forEach((t, index) => {
205
205
  if (Array.isArray(domain)) {
206
- if (t >= Collection.getMinValue(domain) && t <= Collection.getMaxValue(domain)) {
206
+ if (t >= Collection.getMinValue(domain).valueOf() && t <= Collection.getMaxValue(domain).valueOf()) {
207
207
  newTickArray.push({
208
208
  value: t,
209
209
  index
@@ -333,17 +333,17 @@ function getAxisValue(props, axis) {
333
333
  return undefined;
334
334
  }
335
335
  const scaleAxis = axis === "x" ? "y" : "x";
336
- const scale = (0, _isObject2.default)(props.scale) && Helpers.isFunction(props.scale[scaleAxis]) ? props.scale[scaleAxis] : undefined;
336
+ const scale = (0, _isObject.default)(props.scale) && Helpers.isFunction(props.scale[scaleAxis]) ? props.scale[scaleAxis] : undefined;
337
337
  if (!scale) {
338
338
  return undefined;
339
339
  }
340
340
  const stringMapAxis = axis === "x" ? "y" : "x";
341
- const stringMap = (0, _isObject2.default)(props.stringMap) && props.stringMap[stringMapAxis];
341
+ const stringMap = (0, _isObject.default)(props.stringMap) && props.stringMap[stringMapAxis];
342
342
  const axisValue = stringMap && typeof props.axisValue === "string" ? stringMap[props.axisValue] : props.axisValue;
343
343
  return scale(axisValue);
344
344
  }
345
345
  function modifyProps(props, fallbackProps) {
346
- if (!(0, _isObject2.default)(props.theme)) {
346
+ if (!(0, _isObject.default)(props.theme)) {
347
347
  return Helpers.modifyProps(props, fallbackProps, "axis");
348
348
  }
349
349
  let role = "axis";
@@ -355,7 +355,7 @@ function modifyProps(props, fallbackProps) {
355
355
  if (role === "axis") {
356
356
  return Helpers.modifyProps(props, fallbackProps, "axis");
357
357
  }
358
- const axisTheme = (0, _defaults2.default)({}, props.theme[role], props.theme.axis);
358
+ const axisTheme = (0, _defaults.default)({}, props.theme[role], props.theme.axis);
359
359
  const theme = Object.assign({}, props.theme, {
360
360
  axis: axisTheme
361
361
  });
@@ -14,15 +14,15 @@ exports.getStringsFromAxes = getStringsFromAxes;
14
14
  exports.getStringsFromCategories = getStringsFromCategories;
15
15
  exports.getStringsFromData = getStringsFromData;
16
16
  exports.isDataComponent = isDataComponent;
17
- var _omitBy2 = _interopRequireDefault(require("lodash/omitBy"));
18
- var _isUndefined2 = _interopRequireDefault(require("lodash/isUndefined"));
19
- var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
20
- var _isEmpty2 = _interopRequireDefault(require("lodash/isEmpty"));
21
- var _orderBy2 = _interopRequireDefault(require("lodash/orderBy"));
22
- var _property2 = _interopRequireDefault(require("lodash/property"));
23
- var _isPlainObject2 = _interopRequireDefault(require("lodash/isPlainObject"));
24
- var _uniq2 = _interopRequireDefault(require("lodash/uniq"));
25
17
  var _react = _interopRequireDefault(require("react"));
18
+ var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
19
+ var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
20
+ var _isPlainObject = _interopRequireDefault(require("lodash/isPlainObject"));
21
+ var _isUndefined = _interopRequireDefault(require("lodash/isUndefined"));
22
+ var _omitBy = _interopRequireDefault(require("lodash/omitBy"));
23
+ var _orderBy = _interopRequireDefault(require("lodash/orderBy"));
24
+ var _property = _interopRequireDefault(require("lodash/property"));
25
+ var _uniq = _interopRequireDefault(require("lodash/uniq"));
26
26
  var Helpers = _interopRequireWildcard(require("./helpers"));
27
27
  var Collection = _interopRequireWildcard(require("./collection"));
28
28
  var Scale = _interopRequireWildcard(require("./scale"));
@@ -45,7 +45,7 @@ function getLength(data) {
45
45
 
46
46
  // Returns generated data for a given axis based on domain and sample from props
47
47
  function generateDataArray(props, axis) {
48
- const propsDomain = (0, _isPlainObject2.default)(props.domain) ? props.domain[axis] : props.domain;
48
+ const propsDomain = (0, _isPlainObject.default)(props.domain) ? props.domain[axis] : props.domain;
49
49
  const domain = propsDomain || Scale.getBaseScale(props, axis).domain();
50
50
  const samples = props.samples || 1;
51
51
  const domainMax = Math.max(...domain);
@@ -70,7 +70,7 @@ function sortData(dataset, sortKey, sortOrder) {
70
70
  formattedSortKey = `_${sortKey}`;
71
71
  }
72
72
  const order = sortOrder === "ascending" ? "asc" : "desc";
73
- return (0, _orderBy2.default)(dataset, formattedSortKey, order);
73
+ return (0, _orderBy.default)(dataset, formattedSortKey, order);
74
74
  }
75
75
 
76
76
  // This method will remove data points that break certain scales. (log scale only)
@@ -114,7 +114,7 @@ function getEventKey(key) {
114
114
  return () => undefined;
115
115
  }
116
116
  // otherwise, assume it is an array index, property key or path (_.property handles all three)
117
- return (0, _property2.default)(key);
117
+ return (0, _property.default)(key);
118
118
  }
119
119
 
120
120
  // Returns data with an eventKey prop added to each datum
@@ -173,12 +173,12 @@ function formatDataFromDomain(dataset, domain, defaultBaseline) {
173
173
  if (isUnderMinY(baseline) && !isUnderMinY(value)) _y0 = minDomainY;
174
174
  // baseline and value with only baseline above max, set baseline to maxDomainY
175
175
  if (isOverMaxY(baseline) && !isOverMaxY(value)) _y0 = maxDomainY;
176
- return Object.assign({}, datum, (0, _omitBy2.default)({
176
+ return Object.assign({}, datum, (0, _omitBy.default)({
177
177
  _x,
178
178
  _y,
179
179
  _y0,
180
180
  _y1
181
- }, _isUndefined2.default));
181
+ }, _isUndefined.default));
182
182
  });
183
183
  }
184
184
 
@@ -192,7 +192,7 @@ function createStringMap(props, axis) {
192
192
  const stringsFromAxes = getStringsFromAxes(props, axis);
193
193
  const stringsFromCategories = getStringsFromCategories(props, axis);
194
194
  const stringsFromData = getStringsFromData(props, axis);
195
- const allStrings = (0, _uniq2.default)([...stringsFromAxes, ...stringsFromCategories, ...stringsFromData]);
195
+ const allStrings = (0, _uniq.default)([...stringsFromAxes, ...stringsFromCategories, ...stringsFromData]);
196
196
  return allStrings.length === 0 ? null : allStrings.reduce((memo, string, index) => {
197
197
  memo[string] = index + 1;
198
198
  return memo;
@@ -248,7 +248,7 @@ function formatData(dataset, props, expectedKeys) {
248
248
  memo[type] = createAccessor(type);
249
249
  return memo;
250
250
  }, {});
251
- const preformattedData = (0, _isEqual2.default)(expectedKeys, defaultKeys) && props.x === "_x" && props.y === "_y" && props.y0 === "_y0";
251
+ const preformattedData = (0, _isEqual.default)(expectedKeys, defaultKeys) && props.x === "_x" && props.y === "_y" && props.y0 === "_y0";
252
252
  let stringMap;
253
253
  if (preformattedData === false) {
254
254
  // stringMap is not required if the data is preformatted
@@ -278,7 +278,7 @@ function formatData(dataset, props, expectedKeys) {
278
278
  return memo;
279
279
  }, {});
280
280
  const formattedDatum = Object.assign({}, processedValues, parsedDatum);
281
- if (!(0, _isEmpty2.default)(formattedDatum)) {
281
+ if (!(0, _isEmpty.default)(formattedDatum)) {
282
282
  dataArr.push(formattedDatum);
283
283
  }
284
284
  return dataArr;
@@ -15,10 +15,10 @@ exports.getMaxFromProps = getMaxFromProps;
15
15
  exports.getMinFromProps = getMinFromProps;
16
16
  exports.getSymmetricDomain = getSymmetricDomain;
17
17
  exports.isDomainComponent = isDomainComponent;
18
- var _isDate2 = _interopRequireDefault(require("lodash/isDate"));
19
- var _sortedUniq2 = _interopRequireDefault(require("lodash/sortedUniq"));
20
- var _isPlainObject2 = _interopRequireDefault(require("lodash/isPlainObject"));
21
18
  var _react = _interopRequireDefault(require("react"));
19
+ var _isDate = _interopRequireDefault(require("lodash/isDate"));
20
+ var _isPlainObject = _interopRequireDefault(require("lodash/isPlainObject"));
21
+ var _sortedUniq = _interopRequireDefault(require("lodash/sortedUniq"));
22
22
  var Data = _interopRequireWildcard(require("./data"));
23
23
  var Scale = _interopRequireWildcard(require("./scale"));
24
24
  var Helpers = _interopRequireWildcard(require("./helpers"));
@@ -51,7 +51,7 @@ function getDomainPadding(props, axis) {
51
51
  right: padding
52
52
  };
53
53
  };
54
- return (0, _isPlainObject2.default)(props.domainPadding) ? formatPadding(props.domainPadding[axis]) : formatPadding(props.domainPadding);
54
+ return (0, _isPlainObject.default)(props.domainPadding) ? formatPadding(props.domainPadding[axis]) : formatPadding(props.domainPadding);
55
55
  }
56
56
  function getFlatData(dataset, axis) {
57
57
  const axisKey = `_${axis}`;
@@ -100,10 +100,10 @@ function padDomain(domain, props, axis) {
100
100
  min: min.valueOf() - simplePadding.left,
101
101
  max: max.valueOf() + simplePadding.right
102
102
  };
103
- const singleQuadrantDomainPadding = (0, _isPlainObject2.default)(props.singleQuadrantDomainPadding) ? props.singleQuadrantDomainPadding[axis] : props.singleQuadrantDomainPadding;
104
- const addsQuadrants = min >= 0 && paddedDomain.min <= 0 || max <= 0 && paddedDomain.max >= 0;
103
+ const singleQuadrantDomainPadding = (0, _isPlainObject.default)(props.singleQuadrantDomainPadding) ? props.singleQuadrantDomainPadding[axis] : props.singleQuadrantDomainPadding;
104
+ const addsQuadrants = min.valueOf() >= 0 && paddedDomain.min <= 0 || max.valueOf() <= 0 && paddedDomain.max >= 0;
105
105
  const adjust = (val, type) => {
106
- const coerce = type === "min" && min >= 0 && val <= 0 || type === "max" && max <= 0 && val >= 0;
106
+ const coerce = type === "min" && min.valueOf() >= 0 && val <= 0 || type === "max" && max.valueOf() <= 0 && val >= 0;
107
107
  return coerce ? 0 : val;
108
108
  };
109
109
  if (addsQuadrants && singleQuadrantDomainPadding !== false) {
@@ -272,7 +272,7 @@ function getDomainFromMinMax(min, max) {
272
272
  function getDomainFromProps(props, axis) {
273
273
  const minDomain = getMinFromProps(props, axis);
274
274
  const maxDomain = getMaxFromProps(props, axis);
275
- if ((0, _isPlainObject2.default)(props.domain) && props.domain[axis]) {
275
+ if ((0, _isPlainObject.default)(props.domain) && props.domain[axis]) {
276
276
  return props.domain[axis];
277
277
  } else if (Array.isArray(props.domain)) {
278
278
  return props.domain;
@@ -323,10 +323,10 @@ function getDomainWithZero(props, axis) {
323
323
  * @returns {Number|Date|undefined} the maxDomain based on props
324
324
  */
325
325
  function getMaxFromProps(props, axis) {
326
- if ((0, _isPlainObject2.default)(props.maxDomain) && props.maxDomain[axis] !== undefined) {
326
+ if ((0, _isPlainObject.default)(props.maxDomain) && props.maxDomain[axis] !== undefined) {
327
327
  return props.maxDomain[axis];
328
328
  }
329
- return typeof props.maxDomain === "number" || (0, _isDate2.default)(props.maxDomain) ? props.maxDomain : undefined;
329
+ return typeof props.maxDomain === "number" || (0, _isDate.default)(props.maxDomain) ? props.maxDomain : undefined;
330
330
  }
331
331
 
332
332
  /**
@@ -336,10 +336,10 @@ function getMaxFromProps(props, axis) {
336
336
  * @returns {Number|Date|undefined} the minDomain based on props
337
337
  */
338
338
  function getMinFromProps(props, axis) {
339
- if ((0, _isPlainObject2.default)(props.minDomain) && props.minDomain[axis] !== undefined) {
339
+ if ((0, _isPlainObject.default)(props.minDomain) && props.minDomain[axis] !== undefined) {
340
340
  return props.minDomain[axis];
341
341
  }
342
- return typeof props.minDomain === "number" || (0, _isDate2.default)(props.minDomain) ? props.minDomain : undefined;
342
+ return typeof props.minDomain === "number" || (0, _isDate.default)(props.minDomain) ? props.minDomain : undefined;
343
343
  }
344
344
 
345
345
  /**
@@ -350,7 +350,7 @@ function getMinFromProps(props, axis) {
350
350
  * @returns {Array} the symmetric domain
351
351
  */
352
352
  function getSymmetricDomain(domain, values) {
353
- const processedData = (0, _sortedUniq2.default)(values.sort((a, b) => a - b));
353
+ const processedData = (0, _sortedUniq.default)(values.sort((a, b) => a - b));
354
354
  const step = processedData[1] - processedData[0];
355
355
  return [domain[0], domain[1] + step];
356
356
  }
@@ -1,17 +1,17 @@
1
1
  import React from "react";
2
2
  import type { EventMixinCalculatedValues } from "./add-events";
3
- declare type ComponentEventKey = string | number;
3
+ type ComponentEventKey = string | number;
4
4
  export interface ComponentEvent {
5
5
  target?: "parent" | string;
6
6
  eventKey?: ComponentEventKey | ComponentEventKey[];
7
7
  eventHandlers: ComponentEventHandlers;
8
8
  }
9
- export declare type ComponentEventName = string;
9
+ export type ComponentEventName = string;
10
10
  export interface ComponentEventHandlers {
11
11
  [k: ComponentEventName]: ComponentEventHandler;
12
12
  }
13
- export declare type ComponentEventHandler = (evt: React.SyntheticEvent, childProps: unknown, eventKey: ComponentEventKey, eventName: ComponentEventName) => UpdatedProps;
14
- export declare type UpdatedProps = any;
13
+ export type ComponentEventHandler = (evt: React.SyntheticEvent, childProps: unknown, eventKey: ComponentEventKey, eventName: ComponentEventName) => UpdatedProps;
14
+ export type UpdatedProps = any;
15
15
  interface ComponentWithEvents extends EventMixinCalculatedValues {
16
16
  state: any;
17
17
  setState: any;
@@ -15,10 +15,10 @@ exports.getGlobalEvents = void 0;
15
15
  exports.getPartialEvents = getPartialEvents;
16
16
  exports.getScopedEvents = getScopedEvents;
17
17
  exports.omitGlobalEvents = void 0;
18
- var _uniq2 = _interopRequireDefault(require("lodash/uniq"));
19
- var _omitBy2 = _interopRequireDefault(require("lodash/omitBy"));
20
- var _pickBy2 = _interopRequireDefault(require("lodash/pickBy"));
21
- var _isEmpty2 = _interopRequireDefault(require("lodash/isEmpty"));
18
+ var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
19
+ var _pickBy = _interopRequireDefault(require("lodash/pickBy"));
20
+ var _omitBy = _interopRequireDefault(require("lodash/omitBy"));
21
+ var _uniq = _interopRequireDefault(require("lodash/uniq"));
22
22
  var _helpers = require("./helpers");
23
23
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
24
  const GLOBAL_EVENT_REGEX = /^onGlobal(.*)$/;
@@ -90,7 +90,7 @@ getScopedEvents) {
90
90
  */
91
91
  // eslint-disable-next-line max-params
92
92
  function getScopedEvents(events, namespace, childType, baseProps) {
93
- if ((0, _isEmpty2.default)(events)) {
93
+ if ((0, _isEmpty.default)(events)) {
94
94
  return {};
95
95
  }
96
96
 
@@ -203,7 +203,7 @@ function getScopedEvents(events, namespace, childType, baseProps) {
203
203
  // eslint-disable-next-line max-params
204
204
  const onEvent = (evt, childProps, eventKey, eventName) => {
205
205
  const eventReturn = events[eventName](evt, childProps, eventKey, this);
206
- if (!(0, _isEmpty2.default)(eventReturn)) {
206
+ if (!(0, _isEmpty.default)(eventReturn)) {
207
207
  const callbacks = compileCallbacks(eventReturn);
208
208
  this.setState(parseEventReturn(eventReturn, eventKey), callbacks);
209
209
  }
@@ -264,7 +264,7 @@ function getExternalMutationsWithChildren(mutations, baseProps, baseState, child
264
264
  const childState = baseState[childName];
265
265
  const mutation = getExternalMutations(mutations, baseProps[childName], baseState[childName], childName);
266
266
  memo[childName] = mutation ? mutation : childState;
267
- return (0, _pickBy2.default)(memo, v => !(0, _isEmpty2.default)(v));
267
+ return (0, _pickBy.default)(memo, v => !(0, _isEmpty.default)(v));
268
268
  }, {});
269
269
  }
270
270
 
@@ -300,7 +300,7 @@ function getExternalMutations(mutations, baseProps, baseState, childName) {
300
300
  } else {
301
301
  // use keys from both state and props so that elements not intially included in baseProps
302
302
  // will be used. (i.e. labels)
303
- const targets = (0, _uniq2.default)(Object.keys(keyProps).concat(Object.keys(keyState)));
303
+ const targets = (0, _uniq.default)(Object.keys(keyProps).concat(Object.keys(keyState)));
304
304
  memo[eventKey] = targets.reduce((m, target) => {
305
305
  const identifier = {
306
306
  eventKey,
@@ -309,10 +309,10 @@ function getExternalMutations(mutations, baseProps, baseState, childName) {
309
309
  };
310
310
  const mutation = getExternalMutation(mutations, keyProps[target], keyState[target], identifier);
311
311
  m[target] = mutation !== undefined ? Object.assign({}, keyState[target], mutation) : keyState[target];
312
- return (0, _pickBy2.default)(m, v => !(0, _isEmpty2.default)(v));
312
+ return (0, _pickBy.default)(m, v => !(0, _isEmpty.default)(v));
313
313
  }, {});
314
314
  }
315
- return (0, _pickBy2.default)(memo, v => !(0, _isEmpty2.default)(v));
315
+ return (0, _pickBy.default)(memo, v => !(0, _isEmpty.default)(v));
316
316
  }, {});
317
317
  }
318
318
 
@@ -344,11 +344,11 @@ function getExternalMutation(mutations, baseProps, baseState, identifier) {
344
344
  }
345
345
  // find any mutation objects that match the target
346
346
  const targetMutations = scopedMutations.filter(m => filterMutations(m, "target"));
347
- if ((0, _isEmpty2.default)(targetMutations)) {
347
+ if ((0, _isEmpty.default)(targetMutations)) {
348
348
  return undefined;
349
349
  }
350
350
  const keyMutations = targetMutations.filter(m => filterMutations(m, "eventKey"));
351
- if ((0, _isEmpty2.default)(keyMutations)) {
351
+ if ((0, _isEmpty.default)(keyMutations)) {
352
352
  return undefined;
353
353
  }
354
354
  return keyMutations.reduce((memo, curr) => {
@@ -374,9 +374,9 @@ function getGlobalEventNameFromKey(key) {
374
374
  const match = key.match(GLOBAL_EVENT_REGEX);
375
375
  return match && match[1] && match[1].toLowerCase();
376
376
  }
377
- const getGlobalEvents = events => (0, _pickBy2.default)(events, (_, key) => GLOBAL_EVENT_REGEX.test(key));
377
+ const getGlobalEvents = events => (0, _pickBy.default)(events, (_, key) => GLOBAL_EVENT_REGEX.test(key));
378
378
  exports.getGlobalEvents = getGlobalEvents;
379
- const omitGlobalEvents = events => (0, _omitBy2.default)(events, (_, key) => GLOBAL_EVENT_REGEX.test(key));
379
+ const omitGlobalEvents = events => (0, _omitBy.default)(events, (_, key) => GLOBAL_EVENT_REGEX.test(key));
380
380
  exports.omitGlobalEvents = omitGlobalEvents;
381
381
  const emulateReactEvent = event => Object.assign(event, {
382
382
  nativeEvent: event