victory-core 36.6.3 → 36.6.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # victory-core
2
2
 
3
+ ## 36.6.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Allow data accessors to accept any data types (fixes [#2360](https://github.com/FormidableLabs/victory/issues/2360)) ([#2436](https://github.com/FormidableLabs/victory/pull/2436))
8
+
9
+ - Updated dependencies [[`9a6319cff`](https://github.com/FormidableLabs/victory/commit/9a6319cffbc480711b8c286dcae00575081170f0)]:
10
+ - victory-vendor@36.6.4
11
+
3
12
  ## 36.6.3
4
13
 
5
14
  ### Patch Changes
@@ -34,5 +34,4 @@ export declare type VictoryOrientationCallback = (args: CallbackArgs) => Orienta
34
34
  export declare type NumberOrCallback = number | VictoryNumberCallback;
35
35
  export declare type PaddingOrCallback = number | BlockProps | VictoryPaddingCallback;
36
36
  export declare type OrientationOrCallback = OrientationTypes | VictoryOrientationCallback;
37
- export declare type ValueOrCallback<TValue> = TValue | ((args: CallbackArgs) => TValue);
38
37
  //# sourceMappingURL=callbacks.d.ts.map
@@ -1,7 +1,7 @@
1
1
  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
- import { StringOrNumberOrCallback } from "./callbacks";
4
+ import { CallbackArgs, StringOrNumberOrCallback } from "./callbacks";
5
5
  export declare type AxisType = "x" | "y";
6
6
  export declare type DatumValue = number | string | Date | null | undefined;
7
7
  export declare type Datum = any;
@@ -10,7 +10,7 @@ export declare type ForAxes<T> = T | {
10
10
  y?: T;
11
11
  };
12
12
  export declare type ID = number | string;
13
- export declare type ValueOrAccessor<ValueType = unknown, PropsType = object> = ValueType | ((props: PropsType) => ValueType);
13
+ export declare type ValueOrAccessor<ValueType, PropsType = CallbackArgs> = ValueType | ((props: PropsType) => ValueType);
14
14
  export declare type Tuple<T> = [T, T];
15
15
  export declare type ValueOrAxes<T> = T | ForAxes<T>;
16
16
  export declare type DomainPaddingPropType = ValueOrAxes<PaddingType>;
@@ -105,7 +105,7 @@ export declare type CategoryPropType = string[] | {
105
105
  x: string[];
106
106
  y: string[];
107
107
  };
108
- export declare type DataGetterPropType = ValueOrAccessor<string | string[] | number | number[]>;
108
+ export declare type DataGetterPropType = ValueOrAccessor<string | string[] | number | number[], any>;
109
109
  export declare type InterpolationPropType = "basis" | "basisClosed" | "basisOpen" | "bundle" | "cardinal" | "cardinalClosed" | "cardinalOpen" | "catmullRom" | "catmullRomClosed" | "catmullRomOpen" | "linear" | "linearClosed" | "monotoneX" | "monotoneY" | "natural" | "radial" | "step" | "stepAfter" | "stepBefore";
110
110
  export declare type ColorScalePropType = "grayscale" | "qualitative" | "heatmap" | "warm" | "cool" | "red" | "green" | "blue" | string[];
111
111
  export declare type SortOrderPropType = "ascending" | "descending";
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
- import { NumberOrCallback, StringOrCallback, StringOrNumberOrCallback, ValueOrCallback } from "../types/callbacks";
2
+ import { NumberOrCallback, StringOrCallback, StringOrNumberOrCallback } from "../types/callbacks";
3
+ import { ValueOrAccessor } from "../types/prop-types";
3
4
  import { PaddingProps, VerticalAnchorType, VictoryLabelStyleObject } from "../victory-theme/victory-theme";
4
5
  export declare type TextAnchorType = "start" | "middle" | "end" | "inherit";
5
6
  export declare type OriginType = {
@@ -34,11 +35,11 @@ export interface VictoryLabelProps {
34
35
  tabIndex?: NumberOrCallback;
35
36
  text?: string[] | StringOrNumberOrCallback;
36
37
  textComponent?: React.ReactElement;
37
- textAnchor?: ValueOrCallback<TextAnchorType>;
38
+ textAnchor?: ValueOrAccessor<TextAnchorType>;
38
39
  title?: string;
39
- transform?: ValueOrCallback<string | object>;
40
+ transform?: ValueOrAccessor<string | object>;
40
41
  tspanComponent?: React.ReactElement;
41
- verticalAnchor?: ValueOrCallback<VerticalAnchorType>;
42
+ verticalAnchor?: ValueOrAccessor<VerticalAnchorType>;
42
43
  x?: number;
43
44
  y?: number;
44
45
  dx?: StringOrNumberOrCallback;
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
- import { CallbackArgs, ValueOrCallback } from "../types/callbacks";
2
+ import { CallbackArgs } from "../types/callbacks";
3
+ import { ValueOrAccessor } from "../types/prop-types";
3
4
  /**
4
5
  * creates an object with some keys excluded
5
6
  * replacement for lodash.omit for performance. does not mimic the entire lodash.omit api
@@ -24,7 +25,7 @@ export declare function getPadding(props: any, name?: string): {
24
25
  export declare function isTooltip(component: any): boolean;
25
26
  export declare function getDefaultStyles(props: any, role: any): any;
26
27
  export declare function getStyles(style: any, defaultStyles: any): any;
27
- export declare function evaluateProp<TValue>(prop: ValueOrCallback<TValue>, props: CallbackArgs): TValue;
28
+ export declare function evaluateProp<TValue>(prop: ValueOrAccessor<TValue, CallbackArgs>, props: CallbackArgs): TValue;
28
29
  export declare function evaluateStyle(style: any, props: any): any;
29
30
  export declare function degreesToRadians(degrees: any): any;
30
31
  export declare function radiansToDegrees(radians: any): any;
@@ -34,5 +34,4 @@ export declare type VictoryOrientationCallback = (args: CallbackArgs) => Orienta
34
34
  export declare type NumberOrCallback = number | VictoryNumberCallback;
35
35
  export declare type PaddingOrCallback = number | BlockProps | VictoryPaddingCallback;
36
36
  export declare type OrientationOrCallback = OrientationTypes | VictoryOrientationCallback;
37
- export declare type ValueOrCallback<TValue> = TValue | ((args: CallbackArgs) => TValue);
38
37
  //# sourceMappingURL=callbacks.d.ts.map
@@ -1,7 +1,7 @@
1
1
  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
- import { StringOrNumberOrCallback } from "./callbacks";
4
+ import { CallbackArgs, StringOrNumberOrCallback } from "./callbacks";
5
5
  export declare type AxisType = "x" | "y";
6
6
  export declare type DatumValue = number | string | Date | null | undefined;
7
7
  export declare type Datum = any;
@@ -10,7 +10,7 @@ export declare type ForAxes<T> = T | {
10
10
  y?: T;
11
11
  };
12
12
  export declare type ID = number | string;
13
- export declare type ValueOrAccessor<ValueType = unknown, PropsType = object> = ValueType | ((props: PropsType) => ValueType);
13
+ export declare type ValueOrAccessor<ValueType, PropsType = CallbackArgs> = ValueType | ((props: PropsType) => ValueType);
14
14
  export declare type Tuple<T> = [T, T];
15
15
  export declare type ValueOrAxes<T> = T | ForAxes<T>;
16
16
  export declare type DomainPaddingPropType = ValueOrAxes<PaddingType>;
@@ -105,7 +105,7 @@ export declare type CategoryPropType = string[] | {
105
105
  x: string[];
106
106
  y: string[];
107
107
  };
108
- export declare type DataGetterPropType = ValueOrAccessor<string | string[] | number | number[]>;
108
+ export declare type DataGetterPropType = ValueOrAccessor<string | string[] | number | number[], any>;
109
109
  export declare type InterpolationPropType = "basis" | "basisClosed" | "basisOpen" | "bundle" | "cardinal" | "cardinalClosed" | "cardinalOpen" | "catmullRom" | "catmullRomClosed" | "catmullRomOpen" | "linear" | "linearClosed" | "monotoneX" | "monotoneY" | "natural" | "radial" | "step" | "stepAfter" | "stepBefore";
110
110
  export declare type ColorScalePropType = "grayscale" | "qualitative" | "heatmap" | "warm" | "cool" | "red" | "green" | "blue" | string[];
111
111
  export declare type SortOrderPropType = "ascending" | "descending";
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
- import { NumberOrCallback, StringOrCallback, StringOrNumberOrCallback, ValueOrCallback } from "../types/callbacks";
2
+ import { NumberOrCallback, StringOrCallback, StringOrNumberOrCallback } from "../types/callbacks";
3
+ import { ValueOrAccessor } from "../types/prop-types";
3
4
  import { PaddingProps, VerticalAnchorType, VictoryLabelStyleObject } from "../victory-theme/victory-theme";
4
5
  export declare type TextAnchorType = "start" | "middle" | "end" | "inherit";
5
6
  export declare type OriginType = {
@@ -34,11 +35,11 @@ export interface VictoryLabelProps {
34
35
  tabIndex?: NumberOrCallback;
35
36
  text?: string[] | StringOrNumberOrCallback;
36
37
  textComponent?: React.ReactElement;
37
- textAnchor?: ValueOrCallback<TextAnchorType>;
38
+ textAnchor?: ValueOrAccessor<TextAnchorType>;
38
39
  title?: string;
39
- transform?: ValueOrCallback<string | object>;
40
+ transform?: ValueOrAccessor<string | object>;
40
41
  tspanComponent?: React.ReactElement;
41
- verticalAnchor?: ValueOrCallback<VerticalAnchorType>;
42
+ verticalAnchor?: ValueOrAccessor<VerticalAnchorType>;
42
43
  x?: number;
43
44
  y?: number;
44
45
  dx?: StringOrNumberOrCallback;
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
- import { CallbackArgs, ValueOrCallback } from "../types/callbacks";
2
+ import { CallbackArgs } from "../types/callbacks";
3
+ import { ValueOrAccessor } from "../types/prop-types";
3
4
  /**
4
5
  * creates an object with some keys excluded
5
6
  * replacement for lodash.omit for performance. does not mimic the entire lodash.omit api
@@ -24,7 +25,7 @@ export declare function getPadding(props: any, name?: string): {
24
25
  export declare function isTooltip(component: any): boolean;
25
26
  export declare function getDefaultStyles(props: any, role: any): any;
26
27
  export declare function getStyles(style: any, defaultStyles: any): any;
27
- export declare function evaluateProp<TValue>(prop: ValueOrCallback<TValue>, props: CallbackArgs): TValue;
28
+ export declare function evaluateProp<TValue>(prop: ValueOrAccessor<TValue, CallbackArgs>, props: CallbackArgs): TValue;
28
29
  export declare function evaluateStyle(style: any, props: any): any;
29
30
  export declare function degreesToRadians(degrees: any): any;
30
31
  export declare function radiansToDegrees(radians: any): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "victory-core",
3
- "version": "36.6.3",
3
+ "version": "36.6.4",
4
4
  "description": "Victory Core",
5
5
  "keywords": [
6
6
  "data visualization",
@@ -23,7 +23,7 @@
23
23
  "lodash": "^4.17.21",
24
24
  "prop-types": "^15.8.1",
25
25
  "react-fast-compare": "^3.2.0",
26
- "victory-vendor": "^36.6.3"
26
+ "victory-vendor": "^36.6.4"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "react": ">=16.6.0"
@@ -51,5 +51,3 @@ export type PaddingOrCallback = number | BlockProps | VictoryPaddingCallback;
51
51
  export type OrientationOrCallback =
52
52
  | OrientationTypes
53
53
  | VictoryOrientationCallback;
54
-
55
- export type ValueOrCallback<TValue> = TValue | ((args: CallbackArgs) => TValue);
@@ -9,14 +9,14 @@ import {
9
9
  AnimationEasing,
10
10
  AnimationStyle,
11
11
  } from "../victory-animation/victory-animation";
12
- import { StringOrNumberOrCallback } from "./callbacks";
12
+ import { CallbackArgs, StringOrNumberOrCallback } from "./callbacks";
13
13
 
14
14
  export type AxisType = "x" | "y";
15
15
  export type DatumValue = number | string | Date | null | undefined;
16
16
  export type Datum = any;
17
17
  export type ForAxes<T> = T | { x?: T; y?: T };
18
18
  export type ID = number | string;
19
- export type ValueOrAccessor<ValueType = unknown, PropsType = object> =
19
+ export type ValueOrAccessor<ValueType, PropsType = CallbackArgs> =
20
20
  | ValueType
21
21
  | ((props: PropsType) => ValueType);
22
22
  export type Tuple<T> = [T, T];
@@ -137,7 +137,8 @@ export type CategoryPropType =
137
137
  };
138
138
 
139
139
  export type DataGetterPropType = ValueOrAccessor<
140
- string | string[] | number | number[]
140
+ string | string[] | number | number[],
141
+ any // The arg will be the `datum`, which can have any type
141
142
  >;
142
143
 
143
144
  export type InterpolationPropType =
@@ -17,8 +17,8 @@ import {
17
17
  NumberOrCallback,
18
18
  StringOrCallback,
19
19
  StringOrNumberOrCallback,
20
- ValueOrCallback,
21
20
  } from "../types/callbacks";
21
+ import { ValueOrAccessor } from "../types/prop-types";
22
22
  import {
23
23
  PaddingProps,
24
24
  VerticalAnchorType,
@@ -56,11 +56,11 @@ export interface VictoryLabelProps {
56
56
  tabIndex?: NumberOrCallback;
57
57
  text?: string[] | StringOrNumberOrCallback;
58
58
  textComponent?: React.ReactElement;
59
- textAnchor?: ValueOrCallback<TextAnchorType>;
59
+ textAnchor?: ValueOrAccessor<TextAnchorType>;
60
60
  title?: string;
61
- transform?: ValueOrCallback<string | object>;
61
+ transform?: ValueOrAccessor<string | object>;
62
62
  tspanComponent?: React.ReactElement;
63
- verticalAnchor?: ValueOrCallback<VerticalAnchorType>;
63
+ verticalAnchor?: ValueOrAccessor<VerticalAnchorType>;
64
64
  x?: number;
65
65
  y?: number;
66
66
  dx?: StringOrNumberOrCallback;
@@ -1,7 +1,8 @@
1
1
  /* eslint-disable no-use-before-define */
2
2
  import React from "react";
3
3
  import { defaults, isFunction, property, pick, assign, keys } from "lodash";
4
- import { CallbackArgs, ValueOrCallback } from "../types/callbacks";
4
+ import { CallbackArgs } from "../types/callbacks";
5
+ import { ValueOrAccessor } from "../types/prop-types";
5
6
 
6
7
  // Private Functions
7
8
 
@@ -128,7 +129,7 @@ export function getStyles(style, defaultStyles) {
128
129
  }
129
130
 
130
131
  export function evaluateProp<TValue>(
131
- prop: ValueOrCallback<TValue>,
132
+ prop: ValueOrAccessor<TValue, CallbackArgs>,
132
133
  props: CallbackArgs,
133
134
  ): TValue {
134
135
  return isFunction(prop) ? prop(props) : prop;