victory-stack 36.6.0 → 36.6.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.
- package/CHANGELOG.md +28 -0
- package/dist/victory-stack.js +32 -56
- package/dist/victory-stack.min.js +1 -1
- package/es/helper-methods.d.ts +53 -0
- package/es/helper-methods.js +3 -3
- package/es/index.d.ts +2 -35
- package/es/index.js +1 -2
- package/es/victory-stack.d.ts +82 -0
- package/es/victory-stack.js +14 -16
- package/lib/helper-methods.d.ts +53 -0
- package/lib/helper-methods.js +3 -3
- package/lib/index.d.ts +2 -35
- package/lib/index.js +11 -9
- package/lib/victory-stack.d.ts +82 -0
- package/lib/victory-stack.js +16 -20
- package/package.json +42 -19
- package/src/{helper-methods.js → helper-methods.tsx} +3 -2
- package/src/index.ts +1 -0
- package/src/{victory-stack.js → victory-stack.tsx} +51 -21
- package/src/index.d.ts +0 -35
- package/src/index.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-stack",
|
|
3
|
-
"version": "36.6.
|
|
3
|
+
"version": "36.6.3",
|
|
4
4
|
"description": "Stack Layout Component for Victory",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data visualization",
|
|
@@ -23,14 +23,16 @@
|
|
|
23
23
|
"lodash": "^4.17.19",
|
|
24
24
|
"prop-types": "^15.8.1",
|
|
25
25
|
"react-fast-compare": "^3.2.0",
|
|
26
|
-
"victory-core": "^36.6.
|
|
27
|
-
"victory-shared-events": "^36.6.
|
|
26
|
+
"victory-core": "^36.6.3",
|
|
27
|
+
"victory-shared-events": "^36.6.3"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"react": ">=16.6.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"victory-
|
|
33
|
+
"victory-bar": "*",
|
|
34
|
+
"victory-histogram": "*",
|
|
35
|
+
"victory-stack": "*"
|
|
34
36
|
},
|
|
35
37
|
"wireit": {
|
|
36
38
|
"### THESE WIREIT CONFIGS ARE GENERATED ####": {},
|
|
@@ -53,7 +55,9 @@
|
|
|
53
55
|
"files": [
|
|
54
56
|
"src/**",
|
|
55
57
|
"!src/**/*.test.*",
|
|
56
|
-
"../../.babelrc.build.js"
|
|
58
|
+
"../../.babelrc.build.js",
|
|
59
|
+
"../../.babelrc.js",
|
|
60
|
+
"../../package-scripts.js"
|
|
57
61
|
],
|
|
58
62
|
"output": [
|
|
59
63
|
"es/**/*.js",
|
|
@@ -72,7 +76,9 @@
|
|
|
72
76
|
"files": [
|
|
73
77
|
"src/**",
|
|
74
78
|
"!src/**/*.test.*",
|
|
75
|
-
"../../.babelrc.build.js"
|
|
79
|
+
"../../.babelrc.build.js",
|
|
80
|
+
"../../.babelrc.js",
|
|
81
|
+
"../../package-scripts.js"
|
|
76
82
|
],
|
|
77
83
|
"output": [
|
|
78
84
|
"lib/**/*.js",
|
|
@@ -98,6 +104,8 @@
|
|
|
98
104
|
"src/**",
|
|
99
105
|
"!src/**/*.test.*",
|
|
100
106
|
"../../.babelrc.build.js",
|
|
107
|
+
"../../.babelrc.js",
|
|
108
|
+
"../../package-scripts.js",
|
|
101
109
|
"../../config/webpack.config.js",
|
|
102
110
|
"../../config/webpack.config.dev.js"
|
|
103
111
|
],
|
|
@@ -119,6 +127,8 @@
|
|
|
119
127
|
"src/**",
|
|
120
128
|
"!src/**/*.test.*",
|
|
121
129
|
"../../.babelrc.build.js",
|
|
130
|
+
"../../.babelrc.js",
|
|
131
|
+
"../../package-scripts.js",
|
|
122
132
|
"../../config/webpack.config.js"
|
|
123
133
|
],
|
|
124
134
|
"output": [
|
|
@@ -132,6 +142,14 @@
|
|
|
132
142
|
"pnpm-lock.yaml"
|
|
133
143
|
]
|
|
134
144
|
},
|
|
145
|
+
"check": {
|
|
146
|
+
"dependencies": [
|
|
147
|
+
"types:check",
|
|
148
|
+
"jest",
|
|
149
|
+
"format",
|
|
150
|
+
"lint"
|
|
151
|
+
]
|
|
152
|
+
},
|
|
135
153
|
"types:check": {
|
|
136
154
|
"command": "nps types:pkg:check",
|
|
137
155
|
"files": [
|
|
@@ -143,6 +161,7 @@
|
|
|
143
161
|
"types:create",
|
|
144
162
|
"../victory-core:types:create",
|
|
145
163
|
"../victory-shared-events:types:create",
|
|
164
|
+
"../victory-bar:types:create",
|
|
146
165
|
"../victory-histogram:types:create",
|
|
147
166
|
"../victory-vendor:types:create",
|
|
148
167
|
"../victory-voronoi:types:create"
|
|
@@ -187,6 +206,19 @@
|
|
|
187
206
|
"pnpm-lock.yaml"
|
|
188
207
|
]
|
|
189
208
|
},
|
|
209
|
+
"format:fix": {
|
|
210
|
+
"command": "pnpm run format || nps format:pkg:fix",
|
|
211
|
+
"files": [
|
|
212
|
+
"src/**",
|
|
213
|
+
"*.json",
|
|
214
|
+
"../../.prettierignore",
|
|
215
|
+
"../../.prettierrc.json"
|
|
216
|
+
],
|
|
217
|
+
"output": [],
|
|
218
|
+
"packageLocks": [
|
|
219
|
+
"pnpm-lock.yaml"
|
|
220
|
+
]
|
|
221
|
+
},
|
|
190
222
|
"lint": {
|
|
191
223
|
"command": "nps lint:pkg",
|
|
192
224
|
"files": [
|
|
@@ -198,6 +230,7 @@
|
|
|
198
230
|
"dependencies": [
|
|
199
231
|
"../victory-core:types:create",
|
|
200
232
|
"../victory-shared-events:types:create",
|
|
233
|
+
"../victory-bar:types:create",
|
|
201
234
|
"../victory-histogram:types:create",
|
|
202
235
|
"../victory-vendor:types:create",
|
|
203
236
|
"../victory-voronoi:types:create"
|
|
@@ -206,19 +239,6 @@
|
|
|
206
239
|
"pnpm-lock.yaml"
|
|
207
240
|
]
|
|
208
241
|
},
|
|
209
|
-
"format:fix": {
|
|
210
|
-
"command": "pnpm run format || nps format:pkg:fix",
|
|
211
|
-
"files": [
|
|
212
|
-
"src/**",
|
|
213
|
-
"*.json",
|
|
214
|
-
"../../.prettierignore",
|
|
215
|
-
"../../.prettierrc.json"
|
|
216
|
-
],
|
|
217
|
-
"output": [],
|
|
218
|
-
"packageLocks": [
|
|
219
|
-
"pnpm-lock.yaml"
|
|
220
|
-
]
|
|
221
|
-
},
|
|
222
242
|
"lint:fix": {
|
|
223
243
|
"command": "pnpm run lint || nps lint:pkg:fix",
|
|
224
244
|
"files": [
|
|
@@ -230,6 +250,7 @@
|
|
|
230
250
|
"dependencies": [
|
|
231
251
|
"../victory-core:types:create",
|
|
232
252
|
"../victory-shared-events:types:create",
|
|
253
|
+
"../victory-bar:types:create",
|
|
233
254
|
"../victory-histogram:types:create",
|
|
234
255
|
"../victory-vendor:types:create",
|
|
235
256
|
"../victory-voronoi:types:create"
|
|
@@ -249,6 +270,7 @@
|
|
|
249
270
|
"output": [],
|
|
250
271
|
"dependencies": [
|
|
251
272
|
"build:lib:cjs",
|
|
273
|
+
"../victory-bar:build:lib:cjs",
|
|
252
274
|
"../victory-histogram:build:lib:cjs",
|
|
253
275
|
"../victory-vendor:build:lib:cjs",
|
|
254
276
|
"../victory-voronoi:build:lib:cjs"
|
|
@@ -268,6 +290,7 @@
|
|
|
268
290
|
"build:dist": "wireit",
|
|
269
291
|
"build:dist:dev": "wireit",
|
|
270
292
|
"build:dist:min": "wireit",
|
|
293
|
+
"check": "wireit",
|
|
271
294
|
"types:check": "wireit",
|
|
272
295
|
"types:create": "wireit",
|
|
273
296
|
"format": "wireit",
|
|
@@ -25,7 +25,7 @@ function fillData(props, datasets) {
|
|
|
25
25
|
return datasets.map((dataset) => {
|
|
26
26
|
let indexOffset = 0;
|
|
27
27
|
const isDate = dataset[0] && dataset[0]._x instanceof Date;
|
|
28
|
-
const filledInData = xArr.map((x, index) => {
|
|
28
|
+
const filledInData = xArr.map((x: number | Date, index) => {
|
|
29
29
|
x = Number(x);
|
|
30
30
|
const datum = dataset[index - indexOffset];
|
|
31
31
|
|
|
@@ -162,7 +162,8 @@ export function getCalculatedProps(props, childComponents) {
|
|
|
162
162
|
// With shared events, the props change on every event, and every value is re-calculated
|
|
163
163
|
const withoutSharedEvents = (props) => {
|
|
164
164
|
const { children } = props;
|
|
165
|
-
const modifiedChildren = React.Children.toArray(children).map((
|
|
165
|
+
const modifiedChildren = React.Children.toArray(children).map((_child) => {
|
|
166
|
+
const child = _child as React.ReactElement;
|
|
166
167
|
return {
|
|
167
168
|
...child,
|
|
168
169
|
props: Helpers.omit(child.props, ["sharedEvents"]),
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./victory-stack";
|
|
@@ -2,15 +2,26 @@ import { assign, defaults, isEmpty } from "lodash";
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import {
|
|
5
|
+
CategoryPropType,
|
|
6
|
+
ColorScalePropType,
|
|
7
|
+
DomainPropType,
|
|
8
|
+
EventPropTypeInterface,
|
|
9
|
+
StringOrNumberOrCallback,
|
|
10
|
+
VictoryCommonProps,
|
|
11
|
+
VictoryLabelableProps,
|
|
12
|
+
VictoryMultiLabelableProps,
|
|
13
|
+
VictoryStyleInterface,
|
|
5
14
|
CommonProps,
|
|
6
15
|
Helpers,
|
|
7
16
|
Hooks,
|
|
8
17
|
PropTypes as CustomPropTypes,
|
|
9
18
|
UserProps,
|
|
19
|
+
VictoryComponentConfiguration,
|
|
10
20
|
VictoryContainer,
|
|
11
21
|
VictoryTheme,
|
|
12
22
|
Wrapper,
|
|
13
23
|
} from "victory-core";
|
|
24
|
+
|
|
14
25
|
import { VictorySharedEvents } from "victory-shared-events";
|
|
15
26
|
import { getChildren, useMemoizedProps } from "./helper-methods";
|
|
16
27
|
import isEqual from "react-fast-compare";
|
|
@@ -21,9 +32,29 @@ const fallbackProps = {
|
|
|
21
32
|
padding: 50,
|
|
22
33
|
};
|
|
23
34
|
|
|
24
|
-
|
|
35
|
+
export type VictoryStackTTargetType = "data" | "labels" | "parent";
|
|
36
|
+
export interface VictoryStackProps
|
|
37
|
+
extends VictoryCommonProps,
|
|
38
|
+
VictoryLabelableProps,
|
|
39
|
+
VictoryMultiLabelableProps {
|
|
40
|
+
bins?: number | number[] | Date[];
|
|
41
|
+
categories?: CategoryPropType;
|
|
42
|
+
children?: React.ReactNode | React.ReactNode[];
|
|
43
|
+
colorScale?: ColorScalePropType;
|
|
44
|
+
domain?: DomainPropType;
|
|
45
|
+
events?: EventPropTypeInterface<
|
|
46
|
+
VictoryStackTTargetType,
|
|
47
|
+
StringOrNumberOrCallback
|
|
48
|
+
>[];
|
|
49
|
+
eventKey?: StringOrNumberOrCallback;
|
|
50
|
+
fillInMissingData?: boolean;
|
|
51
|
+
style?: VictoryStyleInterface;
|
|
52
|
+
xOffset?: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const VictoryStackBase = (initialProps) => {
|
|
25
56
|
// eslint-disable-next-line no-use-before-define
|
|
26
|
-
const { role } =
|
|
57
|
+
const { role } = VictoryStack;
|
|
27
58
|
const { setAnimationState, getAnimationProps, getProps } =
|
|
28
59
|
Hooks.useAnimationState();
|
|
29
60
|
|
|
@@ -46,13 +77,13 @@ const VictoryStack = (initialProps) => {
|
|
|
46
77
|
|
|
47
78
|
const childComponents = React.Children.toArray(modifiedProps.children);
|
|
48
79
|
const calculatedProps = useMemoizedProps(modifiedProps);
|
|
49
|
-
const { domain, scale, style
|
|
80
|
+
const { domain, scale, style } = calculatedProps;
|
|
50
81
|
|
|
51
82
|
const newChildren = React.useMemo(() => {
|
|
52
83
|
const children = getChildren(props, childComponents, calculatedProps);
|
|
53
84
|
const orderedChildren = children.map((child, index) => {
|
|
54
85
|
const childProps = assign(
|
|
55
|
-
{ animate: getAnimationProps(props, child, index
|
|
86
|
+
{ animate: getAnimationProps(props, child, index) },
|
|
56
87
|
child.props,
|
|
57
88
|
);
|
|
58
89
|
return React.cloneElement(child, childProps);
|
|
@@ -77,7 +108,6 @@ const VictoryStack = (initialProps) => {
|
|
|
77
108
|
style: style.parent,
|
|
78
109
|
horizontal,
|
|
79
110
|
polar,
|
|
80
|
-
origin,
|
|
81
111
|
name,
|
|
82
112
|
};
|
|
83
113
|
}
|
|
@@ -92,7 +122,6 @@ const VictoryStack = (initialProps) => {
|
|
|
92
122
|
style,
|
|
93
123
|
horizontal,
|
|
94
124
|
polar,
|
|
95
|
-
origin,
|
|
96
125
|
name,
|
|
97
126
|
]);
|
|
98
127
|
const userProps = React.useMemo(
|
|
@@ -150,7 +179,7 @@ const VictoryStack = (initialProps) => {
|
|
|
150
179
|
return React.cloneElement(container, container.props, newChildren);
|
|
151
180
|
};
|
|
152
181
|
|
|
153
|
-
|
|
182
|
+
VictoryStackBase.propTypes = {
|
|
154
183
|
...CommonProps.baseProps,
|
|
155
184
|
bins: PropTypes.oneOfType([
|
|
156
185
|
PropTypes.arrayOf(
|
|
@@ -197,7 +226,7 @@ VictoryStack.propTypes = {
|
|
|
197
226
|
xOffset: PropTypes.number,
|
|
198
227
|
};
|
|
199
228
|
|
|
200
|
-
|
|
229
|
+
VictoryStackBase.defaultProps = {
|
|
201
230
|
containerComponent: <VictoryContainer />,
|
|
202
231
|
groupComponent: <g />,
|
|
203
232
|
standalone: true,
|
|
@@ -205,17 +234,18 @@ VictoryStack.defaultProps = {
|
|
|
205
234
|
fillInMissingData: true,
|
|
206
235
|
};
|
|
207
236
|
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
];
|
|
218
|
-
|
|
219
|
-
VictoryStackMemo.getChildren = getChildren;
|
|
237
|
+
const componentConfig: VictoryComponentConfiguration<VictoryStackProps> = {
|
|
238
|
+
role: "stack",
|
|
239
|
+
expectedComponents: [
|
|
240
|
+
"groupComponent",
|
|
241
|
+
"containerComponent",
|
|
242
|
+
"labelComponent",
|
|
243
|
+
],
|
|
244
|
+
getChildren,
|
|
245
|
+
};
|
|
220
246
|
|
|
221
|
-
export
|
|
247
|
+
export const VictoryStack = Object.assign(
|
|
248
|
+
React.memo(VictoryStackBase, isEqual),
|
|
249
|
+
componentConfig,
|
|
250
|
+
);
|
|
251
|
+
VictoryStack.displayName = "VictoryStack";
|
package/src/index.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
CategoryPropType,
|
|
4
|
-
ColorScalePropType,
|
|
5
|
-
DomainPropType,
|
|
6
|
-
EventPropTypeInterface,
|
|
7
|
-
StringOrNumberOrCallback,
|
|
8
|
-
VictoryCommonProps,
|
|
9
|
-
VictoryLabelableProps,
|
|
10
|
-
VictoryMultiLabelableProps,
|
|
11
|
-
VictoryStyleInterface,
|
|
12
|
-
} from "victory-core";
|
|
13
|
-
|
|
14
|
-
export type VictoryStackTTargetType = "data" | "labels" | "parent";
|
|
15
|
-
|
|
16
|
-
export interface VictoryStackProps
|
|
17
|
-
extends VictoryCommonProps,
|
|
18
|
-
VictoryLabelableProps,
|
|
19
|
-
VictoryMultiLabelableProps {
|
|
20
|
-
bins?: number | number[] | Date[];
|
|
21
|
-
categories?: CategoryPropType;
|
|
22
|
-
children?: React.ReactNode | React.ReactNode[];
|
|
23
|
-
colorScale?: ColorScalePropType;
|
|
24
|
-
domain?: DomainPropType;
|
|
25
|
-
events?: EventPropTypeInterface<
|
|
26
|
-
VictoryStackTTargetType,
|
|
27
|
-
StringOrNumberOrCallback
|
|
28
|
-
>[];
|
|
29
|
-
eventKey?: StringOrNumberOrCallback;
|
|
30
|
-
fillInMissingData?: boolean;
|
|
31
|
-
style?: VictoryStyleInterface;
|
|
32
|
-
xOffset?: number;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export class VictoryStack extends React.Component<VictoryStackProps, any> {}
|
package/src/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as VictoryStack } from "./victory-stack";
|