victory-core 37.3.2 → 37.3.3

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 +14 -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
@@ -23,15 +23,15 @@ export interface CallbackArgs {
23
23
  ticks?: any;
24
24
  text?: any;
25
25
  }
26
- export declare type VictoryStringOrNumberCallback = (args: CallbackArgs) => string | number;
27
- export declare type VictoryStringCallback = (args: CallbackArgs) => string;
28
- export declare type StringOrNumberOrCallback = string | number | VictoryStringOrNumberCallback;
29
- export declare type StringOrCallback = string | VictoryStringCallback;
30
- export declare type SliceNumberOrCallback<T, P extends string | number | symbol = never> = number | ((props: Omit<T, P>) => number);
31
- export declare type VictoryNumberCallback = (args: CallbackArgs) => number;
32
- export declare type VictoryPaddingCallback = (args: CallbackArgs) => number | BlockProps;
33
- export declare type VictoryOrientationCallback = (args: CallbackArgs) => OrientationTypes;
34
- export declare type NumberOrCallback = number | VictoryNumberCallback;
35
- export declare type PaddingOrCallback = number | BlockProps | VictoryPaddingCallback;
36
- export declare type OrientationOrCallback = OrientationTypes | VictoryOrientationCallback;
26
+ export type VictoryStringOrNumberCallback = (args: CallbackArgs) => string | number;
27
+ export type VictoryStringCallback = (args: CallbackArgs) => string;
28
+ export type StringOrNumberOrCallback = string | number | VictoryStringOrNumberCallback;
29
+ export type StringOrCallback = string | VictoryStringCallback;
30
+ export type SliceNumberOrCallback<T, P extends string | number | symbol = never> = number | ((props: Omit<T, P>) => number);
31
+ export type VictoryNumberCallback = (args: CallbackArgs) => number;
32
+ export type VictoryPaddingCallback = (args: CallbackArgs) => number | BlockProps;
33
+ export type VictoryOrientationCallback = (args: CallbackArgs) => OrientationTypes;
34
+ export type NumberOrCallback = number | VictoryNumberCallback;
35
+ export type PaddingOrCallback = number | BlockProps | VictoryPaddingCallback;
36
+ export type OrientationOrCallback = OrientationTypes | VictoryOrientationCallback;
37
37
  //# sourceMappingURL=callbacks.d.ts.map
@@ -2,25 +2,25 @@ import * as React from "react";
2
2
  import { ScaleLinear, ScaleLogarithmic, ScalePower, ScaleTime } from "victory-vendor/d3-scale";
3
3
  import { AnimationEasing, AnimationStyle } from "../victory-animation/victory-animation";
4
4
  import { CallbackArgs, StringOrNumberOrCallback } from "./callbacks";
5
- export declare type AxisType = "x" | "y";
6
- export declare type DatumValue = number | string | Date | null | undefined;
7
- export declare type Datum = any;
8
- export declare type ForAxes<T> = T | {
5
+ export type AxisType = "x" | "y";
6
+ export type DatumValue = number | string | Date | null | undefined;
7
+ export type Datum = any;
8
+ export type ForAxes<T> = T | {
9
9
  x?: T;
10
10
  y?: T;
11
11
  };
12
- export declare type ID = number | string;
13
- export declare type ValueOrAccessor<ValueType, PropsType = CallbackArgs> = ValueType | ((props: PropsType) => ValueType);
14
- export declare type Tuple<T> = [T, T];
15
- export declare type ValueOrAxes<T> = T | ForAxes<T>;
16
- export declare type DomainPaddingPropType = ValueOrAxes<PaddingType>;
17
- export declare type DomainPropType = ValueOrAxes<DomainTuple>;
18
- export declare type DomainValue = number | Date;
19
- export declare type DomainTuple = Tuple<number> | Tuple<Date>;
20
- export declare type PaddingType = number | Tuple<number>;
21
- export declare type RangePropType = ValueOrAxes<RangeTuple>;
22
- export declare type RangeTuple = number[];
23
- export declare type StringOrNumberOrList = string | number | (string | number)[];
12
+ export type ID = number | string;
13
+ export type ValueOrAccessor<ValueType, PropsType = CallbackArgs> = ValueType | ((props: PropsType) => ValueType);
14
+ export type Tuple<T> = [T, T];
15
+ export type ValueOrAxes<T> = T | ForAxes<T>;
16
+ export type DomainPaddingPropType = ValueOrAxes<PaddingType>;
17
+ export type DomainPropType = ValueOrAxes<DomainTuple>;
18
+ export type DomainValue = number | Date;
19
+ export type DomainTuple = Tuple<number> | Tuple<Date>;
20
+ export type PaddingType = number | Tuple<number>;
21
+ export type RangePropType = ValueOrAxes<RangeTuple>;
22
+ export type RangeTuple = number[];
23
+ export type StringOrNumberOrList = string | number | (string | number)[];
24
24
  export interface Padding {
25
25
  top: number;
26
26
  bottom: number;
@@ -69,7 +69,7 @@ export interface EventPropTypeInterface<TTarget, TEventKey> {
69
69
  };
70
70
  };
71
71
  }
72
- declare type NumberValue = number | {
72
+ type NumberValue = number | {
73
73
  valueOf(): number;
74
74
  };
75
75
  /**
@@ -91,14 +91,14 @@ export interface D3Scale<TRange = any> {
91
91
  copy: () => this;
92
92
  invert: (value: number) => number;
93
93
  }
94
- export declare type D3ScaleFn<TRange = any, TOutput = any> = () => ScaleLinear<TRange, TOutput, unknown> | ScaleLogarithmic<TRange, TOutput, unknown> | ScaleTime<TRange, TOutput, unknown> | ScalePower<TRange, TOutput, unknown>;
95
- export declare type ScaleName = "linear" | "time" | "log" | "sqrt";
96
- export declare type ScalePropType = ScaleName;
97
- export declare type ScaleXYPropType = {
94
+ export type D3ScaleFn<TRange = any, TOutput = any> = () => ScaleLinear<TRange, TOutput, unknown> | ScaleLogarithmic<TRange, TOutput, unknown> | ScaleTime<TRange, TOutput, unknown> | ScalePower<TRange, TOutput, unknown>;
95
+ export type ScaleName = "linear" | "time" | "log" | "sqrt";
96
+ export type ScalePropType = ScaleName;
97
+ export type ScaleXYPropType = {
98
98
  x: D3Scale;
99
99
  y: D3Scale;
100
100
  };
101
- export declare type CategoryPropType = string[] | {
101
+ export type CategoryPropType = string[] | {
102
102
  x: string[];
103
103
  } | {
104
104
  y: string[];
@@ -106,10 +106,10 @@ export declare type CategoryPropType = string[] | {
106
106
  x: string[];
107
107
  y: string[];
108
108
  };
109
- export declare type DataGetterPropType = ValueOrAccessor<string | string[] | number | number[], any>;
110
- export declare type InterpolationPropType = "basis" | "basisClosed" | "basisOpen" | "bundle" | "cardinal" | "cardinalClosed" | "cardinalOpen" | "catmullRom" | "catmullRomClosed" | "catmullRomOpen" | "linear" | "linearClosed" | "monotoneX" | "monotoneY" | "natural" | "radial" | "step" | "stepAfter" | "stepBefore";
111
- export declare type ColorScalePropType = "grayscale" | "qualitative" | "heatmap" | "warm" | "cool" | "red" | "green" | "blue" | string[];
112
- export declare type SortOrderPropType = "ascending" | "descending";
109
+ export type DataGetterPropType = ValueOrAccessor<string | string[] | number | number[], any>;
110
+ export type InterpolationPropType = "basis" | "basisClosed" | "basisOpen" | "bundle" | "cardinal" | "cardinalClosed" | "cardinalOpen" | "catmullRom" | "catmullRomClosed" | "catmullRomOpen" | "linear" | "linearClosed" | "monotoneX" | "monotoneY" | "natural" | "radial" | "step" | "stepAfter" | "stepBefore";
111
+ export type ColorScalePropType = "grayscale" | "qualitative" | "heatmap" | "warm" | "cool" | "red" | "green" | "blue" | string[];
112
+ export type SortOrderPropType = "ascending" | "descending";
113
113
  export interface VictoryLabelableProps {
114
114
  labelComponent?: React.ReactElement;
115
115
  }
@@ -123,10 +123,10 @@ export interface VictorySingleLabelableProps extends VictoryLabelableProps {
123
123
  (data: any): string | number | null;
124
124
  };
125
125
  }
126
- export declare type CoordinatesPropType = {
126
+ export type CoordinatesPropType = {
127
127
  x: number;
128
128
  y: number;
129
129
  };
130
- export declare type VictoryEventHandler = (event?: any, targetProps?: any, eventKey?: any, context?: any) => void;
130
+ export type VictoryEventHandler = (event?: any, targetProps?: any, eventKey?: any, context?: any) => void;
131
131
  export {};
132
132
  //# sourceMappingURL=prop-types.d.ts.map
@@ -1,5 +1,5 @@
1
- import _orderBy from "lodash/orderBy";
2
- import _isPlainObject from "lodash/isPlainObject";
1
+ import isPlainObject from "lodash/isPlainObject";
2
+ import orderBy from "lodash/orderBy";
3
3
  import { interpolate } from "victory-vendor/d3-interpolate";
4
4
  export const isInterpolatable = function (obj) {
5
5
  // d3 turns null into 0 and undefined into NaN, which we don't want.
@@ -22,7 +22,7 @@ export const isInterpolatable = function (obj) {
22
22
  return false;
23
23
  case "object":
24
24
  // Don't try to interpolate class instances (except Date or Array).
25
- return obj instanceof Date || Array.isArray(obj) || _isPlainObject(obj);
25
+ return obj instanceof Date || Array.isArray(obj) || isPlainObject(obj);
26
26
  case "function":
27
27
  // Careful! There may be extra properties on function objects that the
28
28
  // component expects to access - for instance, it may be a `d3.scale()`
@@ -108,7 +108,7 @@ export const interpolateObject = function (startValue, endValue) {
108
108
  if (typeof x === "function" || typeof y === "function") {
109
109
  return interpolateFunction(x, y);
110
110
  }
111
- if (typeof x === "object" && _isPlainObject(x) || typeof y === "object" && _isPlainObject(y)) {
111
+ if (typeof x === "object" && isPlainObject(x) || typeof y === "object" && isPlainObject(y)) {
112
112
  return interpolateObject(x, y);
113
113
  }
114
114
  return interpolate(x, y);
@@ -117,7 +117,7 @@ export const interpolateObject = function (startValue, endValue) {
117
117
  // When the value is an array, attempt to sort by "key" so that animating nodes may be identified
118
118
  // based on "key" instead of index
119
119
  const keyData = val => {
120
- return Array.isArray(val) ? _orderBy(val, "key") : val;
120
+ return Array.isArray(val) ? orderBy(val, "key") : val;
121
121
  };
122
122
  const i = {};
123
123
  const c = {};
@@ -184,7 +184,7 @@ export const victoryInterpolator = function (a, b) {
184
184
  if (typeof a === "function" || typeof b === "function") {
185
185
  return interpolateFunction(a, b);
186
186
  }
187
- if (_isPlainObject(a) || _isPlainObject(b)) {
187
+ if (isPlainObject(a) || isPlainObject(b)) {
188
188
  // @ts-expect-error These generics are tough, but they work :)
189
189
  return interpolateObject(a, b);
190
190
  }
@@ -3,14 +3,14 @@ import TimerContext from "../victory-util/timer-context";
3
3
  /**
4
4
  * Single animation object to interpolate
5
5
  */
6
- export declare type AnimationStyle = {
6
+ export type AnimationStyle = {
7
7
  [key: string]: string | number;
8
8
  };
9
9
  /**
10
10
  * Animation styles to interpolate
11
11
  */
12
- export declare type AnimationData = AnimationStyle | AnimationStyle[];
13
- 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";
12
+ export type AnimationData = AnimationStyle | AnimationStyle[];
13
+ export 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";
14
14
  export interface VictoryAnimationProps {
15
15
  children: (style: AnimationStyle, info: AnimationInfo) => React.ReactElement;
16
16
  duration?: number;
@@ -20,7 +20,10 @@ export interface VictoryClipContainerProps {
20
20
  translateX?: number;
21
21
  translateY?: number;
22
22
  }
23
- export declare class VictoryClipContainer extends React.Component<VictoryClipContainerProps> {
23
+ interface VictoryClipContainerState {
24
+ clipId?: number | string;
25
+ }
26
+ export declare class VictoryClipContainer extends React.Component<VictoryClipContainerProps, VictoryClipContainerState> {
24
27
  static displayName: string;
25
28
  static role: string;
26
29
  static defaultProps: {
@@ -31,6 +34,7 @@ export declare class VictoryClipContainer extends React.Component<VictoryClipCon
31
34
  };
32
35
  clipId: VictoryClipContainerProps["clipId"];
33
36
  constructor(props: VictoryClipContainerProps);
37
+ componentDidMount(): void;
34
38
  calculateAttributes(props: any): {
35
39
  x: number;
36
40
  y: number;
@@ -44,4 +48,5 @@ export declare class VictoryClipContainer extends React.Component<VictoryClipCon
44
48
  getTranslateValue(props: any, axis: any): any;
45
49
  render(): React.DetailedReactHTMLElement<any, HTMLElement>;
46
50
  }
51
+ export {};
47
52
  //# sourceMappingURL=victory-clip-container.d.ts.map
@@ -1,7 +1,6 @@
1
- import _uniqueId from "lodash/uniqueId";
2
- import _isObject from "lodash/isObject";
3
- import _defaults from "lodash/defaults";
4
1
  import React from "react";
2
+ import defaults from "lodash/defaults";
3
+ import uniqueId from "lodash/uniqueId";
5
4
  import * as Helpers from "../victory-util/helpers";
6
5
  import * as UserProps from "../victory-util/user-props";
7
6
  import { ClipPath } from "../victory-primitives/clip-path";
@@ -18,7 +17,20 @@ export class VictoryClipContainer extends React.Component {
18
17
  };
19
18
  constructor(props) {
20
19
  super(props);
21
- this.clipId = !_isObject(props) || props.clipId === undefined ? _uniqueId("victory-clip-") : props.clipId;
20
+ this.state = {
21
+ clipId: props?.clipId
22
+ };
23
+ }
24
+
25
+ // The clipId state is used to prevent hydration mismatches between the server and client (issue #2941).
26
+ // A better alternative would be to utilize React 18's useId hook instead of uniqueId, which would avoid needing state for this purpose.
27
+ // However, this component currently supports React 16 at the time of writing, so this workaround is necessary.
28
+ componentDidMount() {
29
+ if (!this.state.clipId) {
30
+ this.setState({
31
+ clipId: uniqueId("victory-clip-")
32
+ });
33
+ }
22
34
  }
23
35
  calculateAttributes(props) {
24
36
  const {
@@ -29,9 +41,7 @@ export class VictoryClipContainer extends React.Component {
29
41
  translateX = 0,
30
42
  translateY = 0
31
43
  } = props;
32
- const clipPadding = Helpers.getPadding({
33
- padding: props.clipPadding
34
- });
44
+ const clipPadding = Helpers.getPadding(props.clipPadding);
35
45
  const radius = props.radius || Helpers.getRadius(props);
36
46
  return {
37
47
  x: (polar ? origin.x : translateX) - clipPadding.left,
@@ -100,9 +110,7 @@ export class VictoryClipContainer extends React.Component {
100
110
  bottom,
101
111
  left,
102
112
  right
103
- } = Helpers.getPadding({
104
- padding: props.clipPadding
105
- });
113
+ } = Helpers.getPadding(props.clipPadding);
106
114
  let child;
107
115
  if (polar) {
108
116
  const radius = props.radius || Helpers.getRadius(props);
@@ -157,12 +165,12 @@ export class VictoryClipContainer extends React.Component {
157
165
  }
158
166
  const translateX = this.getTranslateValue(this.props, "x");
159
167
  const translateY = this.getTranslateValue(this.props, "y");
160
- const clipProps = _defaults({}, this.props, {
168
+ const clipProps = defaults({}, this.props, {
161
169
  clipHeight,
162
170
  clipWidth,
163
171
  translateX,
164
172
  translateY
165
173
  });
166
- return this.renderClippedGroup(clipProps, this.clipId);
174
+ return this.renderClippedGroup(clipProps, this.state.clipId);
167
175
  }
168
176
  }
@@ -1,6 +1,6 @@
1
- import _uniqueId from "lodash/uniqueId";
2
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
2
  import React, { useRef } from "react";
3
+ import uniqueId from "lodash/uniqueId";
4
4
  import { Portal } from "../victory-portal/portal";
5
5
  import * as UserProps from "../victory-util/user-props";
6
6
  import { mergeRefs } from "../victory-util";
@@ -28,7 +28,7 @@ export function useVictoryContainer(initialProps) {
28
28
  const localContainerRef = useRef(null);
29
29
 
30
30
  // Generated ID stored in ref because it needs to persist across renders
31
- const generatedId = useRef(_uniqueId("victory-container-"));
31
+ const generatedId = useRef(uniqueId("victory-container-"));
32
32
  const containerId = props.containerId ?? generatedId.current;
33
33
  const getIdForElement = elName => `${containerId}-${elName}`;
34
34
  const userProps = UserProps.getSafeUserProps(props);
@@ -2,12 +2,12 @@ import React from "react";
2
2
  import { NumberOrCallback, StringOrCallback, StringOrNumberOrCallback } from "../types/callbacks";
3
3
  import { ValueOrAccessor } from "../types/prop-types";
4
4
  import { PaddingProps, VerticalAnchorType, VictoryLabelStyleObject } from "../victory-theme/victory-theme";
5
- export declare type TextAnchorType = "start" | "middle" | "end" | "inherit";
6
- export declare type OriginType = {
5
+ export type TextAnchorType = "start" | "middle" | "end" | "inherit";
6
+ export type OriginType = {
7
7
  x: number;
8
8
  y: number;
9
9
  };
10
- export declare type LabelOrientationType = "parallel" | "perpendicular" | "vertical";
10
+ export type LabelOrientationType = "parallel" | "perpendicular" | "vertical";
11
11
  export interface VictoryLabelProps {
12
12
  angle?: StringOrNumberOrCallback;
13
13
  ariaLabel?: StringOrCallback;
@@ -1,7 +1,7 @@
1
- import _isEmpty from "lodash/isEmpty";
2
- import _defaults from "lodash/defaults";
3
1
  /* eslint no-magic-numbers: ["error", { "ignore": [-0.5, 0.5, 0, 1, 2] }]*/
4
2
  import React from "react";
3
+ import defaults from "lodash/defaults";
4
+ import isEmpty from "lodash/isEmpty";
5
5
  import { VictoryPortal } from "../victory-portal/victory-portal";
6
6
  import { Rect } from "../victory-primitives/rect";
7
7
  import { Text } from "../victory-primitives/text";
@@ -52,7 +52,7 @@ const shouldUseMultilineBackgrounds = props => {
52
52
  backgroundStyle,
53
53
  backgroundPadding
54
54
  } = props;
55
- return Array.isArray(backgroundStyle) && !_isEmpty(backgroundStyle) || Array.isArray(backgroundPadding) && !_isEmpty(backgroundPadding);
55
+ return Array.isArray(backgroundStyle) && !isEmpty(backgroundStyle) || Array.isArray(backgroundPadding) && !isEmpty(backgroundPadding);
56
56
  };
57
57
  const getStyles = (style, props) => {
58
58
  if (props.disableInlineStyles) {
@@ -63,37 +63,33 @@ const getStyles = (style, props) => {
63
63
  };
64
64
  }
65
65
  const getSingleStyle = s => {
66
- const baseStyles = Helpers.evaluateStyle(s ? _defaults({}, s, defaultStyles) : defaultStyles, props);
66
+ const baseStyles = Helpers.evaluateStyle(s ? defaults({}, s, defaultStyles) : defaultStyles, props);
67
67
  return Object.assign({}, baseStyles, {
68
68
  fontSize: getFontSize(baseStyles)
69
69
  });
70
70
  };
71
- return Array.isArray(style) && !_isEmpty(style) ? style.map(s => getSingleStyle(s)) : getSingleStyle(style);
71
+ return Array.isArray(style) && !isEmpty(style) ? style.map(s => getSingleStyle(s)) : getSingleStyle(style);
72
72
  };
73
73
  const getBackgroundStyles = (style, props) => {
74
74
  if (!style) {
75
75
  return undefined;
76
76
  }
77
- return Array.isArray(style) && !_isEmpty(style) ? style.map(s => Helpers.evaluateStyle(s, props)) : Helpers.evaluateStyle(style, props);
77
+ return Array.isArray(style) && !isEmpty(style) ? style.map(s => Helpers.evaluateStyle(s, props)) : Helpers.evaluateStyle(style, props);
78
78
  };
79
79
  const getBackgroundPadding = props => {
80
80
  if (props.backgroundPadding && Array.isArray(props.backgroundPadding)) {
81
81
  return props.backgroundPadding.map(backgroundPadding => {
82
82
  const padding = Helpers.evaluateProp(backgroundPadding, props);
83
- return Helpers.getPadding({
84
- padding
85
- });
83
+ return Helpers.getPadding(padding);
86
84
  });
87
85
  }
88
86
  const padding = Helpers.evaluateProp(props.backgroundPadding, props);
89
- return Helpers.getPadding({
90
- padding
91
- });
87
+ return Helpers.getPadding(padding);
92
88
  };
93
89
  const getLineHeight = props => {
94
90
  const lineHeight = Helpers.evaluateProp(props.lineHeight, props);
95
91
  if (Array.isArray(lineHeight)) {
96
- return _isEmpty(lineHeight) ? [1] : lineHeight;
92
+ return isEmpty(lineHeight) ? [1] : lineHeight;
97
93
  }
98
94
  return lineHeight;
99
95
  };
@@ -213,7 +209,7 @@ const getFullBackground = (calculatedProps, tspanValues) => {
213
209
  x: inline ? xCoordinate - backgroundPadding.left : xCoordinate + dx - backgroundPadding.left,
214
210
  y: yCoordinate
215
211
  };
216
- return /*#__PURE__*/React.cloneElement(backgroundComponent, _defaults({}, backgroundComponent.props, backgroundProps));
212
+ return /*#__PURE__*/React.cloneElement(backgroundComponent, defaults({}, backgroundComponent.props, backgroundProps));
217
213
  };
218
214
  const getInlineXOffset = (calculatedProps, textElements, index) => {
219
215
  const {
@@ -283,7 +279,7 @@ const getChildBackgrounds = (calculatedProps, tspanValues) => {
283
279
  x: xCoord - padding.left,
284
280
  y: yCoord
285
281
  };
286
- return /*#__PURE__*/React.cloneElement(backgroundComponent, _defaults({}, backgroundComponent.props, backgroundProps));
282
+ return /*#__PURE__*/React.cloneElement(backgroundComponent, defaults({}, backgroundComponent.props, backgroundProps));
287
283
  });
288
284
  };
289
285
  const getBackgroundElement = (calculatedProps, tspanValues) => {
@@ -429,7 +425,7 @@ const defaultProps = {
429
425
  lineHeight: 1
430
426
  };
431
427
  export const VictoryLabel = initialProps => {
432
- const props = evaluateProps(_defaults({}, initialProps, defaultProps));
428
+ const props = evaluateProps(defaults({}, initialProps, defaultProps));
433
429
  if (props.text === null || props.text === undefined) {
434
430
  return null;
435
431
  }
@@ -1,6 +1,6 @@
1
- import _uniqueId from "lodash/uniqueId";
2
- import _defaults from "lodash/defaults";
3
1
  import React, { useState } from "react";
2
+ import defaults from "lodash/defaults";
3
+ import uniqueId from "lodash/uniqueId";
4
4
  import * as Log from "../victory-util/log";
5
5
  import * as Helpers from "../victory-util/helpers";
6
6
  import { usePortalContext } from "./portal-context";
@@ -12,7 +12,7 @@ export const VictoryPortal = initialProps => {
12
12
  ...defaultProps,
13
13
  ...initialProps
14
14
  };
15
- const [id] = useState(_uniqueId());
15
+ const [id] = useState(uniqueId());
16
16
  const portalContext = usePortalContext();
17
17
  if (!portalContext) {
18
18
  const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
@@ -27,7 +27,7 @@ export const VictoryPortal = initialProps => {
27
27
  groupComponent,
28
28
  standalone: false
29
29
  } : {};
30
- const newProps = _defaults(standardProps, childProps, Helpers.omit(props, ["children", "groupComponent"]), {
30
+ const newProps = defaults(standardProps, childProps, Helpers.omit(props, ["children", "groupComponent"]), {
31
31
  key: childProps.key ?? id
32
32
  });
33
33
  const child = children && /*#__PURE__*/React.cloneElement(children, newProps);
@@ -1,6 +1,6 @@
1
- import _defaults from "lodash/defaults";
2
1
  /* eslint no-magic-numbers: ["error", { "ignore": [0, 1, 2, 180] }]*/
3
2
  import React from "react";
3
+ import defaults from "lodash/defaults";
4
4
  import * as Helpers from "../victory-util/helpers";
5
5
  import { Path } from "./path";
6
6
  const getArcPath = props => {
@@ -59,7 +59,7 @@ const defaultProps = {
59
59
  shapeRendering: "auto"
60
60
  };
61
61
  export const Arc = initialProps => {
62
- const props = evaluateProps(_defaults({}, initialProps, defaultProps));
62
+ const props = evaluateProps(defaults({}, initialProps, defaultProps));
63
63
  return /*#__PURE__*/React.cloneElement(props.pathComponent, {
64
64
  ...props.events,
65
65
  "aria-label": props.ariaLabel,
@@ -1,5 +1,5 @@
1
- import _defaults from "lodash/defaults";
2
1
  import React from "react";
2
+ import defaults from "lodash/defaults";
3
3
  import * as Helpers from "../victory-util/helpers";
4
4
  import { Rect } from "./rect";
5
5
  import { Circle } from "./circle";
@@ -20,7 +20,7 @@ const defaultProps = {
20
20
  shapeRendering: "auto"
21
21
  };
22
22
  export const Background = initialProps => {
23
- const props = evaluateProps(_defaults({}, initialProps, defaultProps));
23
+ const props = evaluateProps(defaults({}, initialProps, defaultProps));
24
24
  return props.polar ? /*#__PURE__*/React.cloneElement(props.circleComponent, {
25
25
  ...props.events,
26
26
  style: props.style,
@@ -1,5 +1,5 @@
1
- import _defaults from "lodash/defaults";
2
1
  import React from "react";
2
+ import defaults from "lodash/defaults";
3
3
  import * as Helpers from "../victory-util/helpers";
4
4
  import { Rect } from "./rect";
5
5
  const evaluateProps = props => {
@@ -32,7 +32,7 @@ const defaultProps = {
32
32
  shapeRendering: "auto"
33
33
  };
34
34
  export const Border = initialProps => {
35
- const props = evaluateProps(_defaults({}, initialProps, defaultProps));
35
+ const props = evaluateProps(defaults({}, initialProps, defaultProps));
36
36
  return /*#__PURE__*/React.cloneElement(props.rectComponent, {
37
37
  ...props.events,
38
38
  "aria-label": props.ariaLabel,
@@ -1,5 +1,5 @@
1
- import _defaults from "lodash/defaults";
2
1
  import React from "react";
2
+ import defaults from "lodash/defaults";
3
3
  import * as Helpers from "../victory-util/helpers";
4
4
  import { Line } from "./line";
5
5
  const evaluateProps = props => {
@@ -32,7 +32,7 @@ const defaultProps = {
32
32
  shapeRendering: "auto"
33
33
  };
34
34
  export const LineSegment = initialProps => {
35
- const props = evaluateProps(_defaults({}, initialProps, defaultProps));
35
+ const props = evaluateProps(defaults({}, initialProps, defaultProps));
36
36
  return /*#__PURE__*/React.cloneElement(props.lineComponent, {
37
37
  ...props.events,
38
38
  "aria-label": props.ariaLabel,
@@ -1,5 +1,5 @@
1
- import _defaults from "lodash/defaults";
2
1
  import React from "react";
2
+ import defaults from "lodash/defaults";
3
3
  import * as Helpers from "../victory-util/helpers";
4
4
  import * as pathHelpers from "../victory-util/point-path-helpers";
5
5
  import * as UserProps from "../victory-util/user-props";
@@ -52,7 +52,7 @@ const defaultProps = {
52
52
  shapeRendering: "auto"
53
53
  };
54
54
  export const Point = initialProps => {
55
- const props = evaluateProps(_defaults({}, initialProps, defaultProps));
55
+ const props = evaluateProps(defaults({}, initialProps, defaultProps));
56
56
  const userProps = UserProps.getSafeUserProps(props);
57
57
  return /*#__PURE__*/React.cloneElement(props.pathComponent, {
58
58
  ...props.events,
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
3
2
  export declare const TSpan: (props: VictoryCommonPrimitiveProps) => JSX.Element;
4
3
  //# sourceMappingURL=tspan.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
2
- export declare type ScatterSymbolType = "circle" | "cross" | "diamond" | "plus" | "minus" | "square" | "star" | "triangleDown" | "triangleUp";
2
+ export type ScatterSymbolType = "circle" | "cross" | "diamond" | "plus" | "minus" | "square" | "star" | "triangleDown" | "triangleUp";
3
3
  export interface VictoryPrimitiveShapeProps extends VictoryCommonPrimitiveProps {
4
4
  desc?: string;
5
5
  rx?: number;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
3
- export declare type WhiskerAxes = {
3
+ export type WhiskerAxes = {
4
4
  x1?: number;
5
5
  x2?: number;
6
6
  y1?: number;
@@ -1,5 +1,5 @@
1
- import _defaults from "lodash/defaults";
2
1
  import React from "react";
2
+ import defaults from "lodash/defaults";
3
3
  import * as Helpers from "../victory-util/helpers";
4
4
  import { Line } from "./line";
5
5
  const evaluateProps = props => {
@@ -31,7 +31,7 @@ const defaultProps = {
31
31
  shapeRendering: "auto"
32
32
  };
33
33
  export const Whisker = initialProps => {
34
- const props = evaluateProps(_defaults({}, initialProps, defaultProps));
34
+ const props = evaluateProps(defaults({}, initialProps, defaultProps));
35
35
  const {
36
36
  ariaLabel,
37
37
  groupComponent,
@@ -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[];