victory-stack 36.6.0 → 36.6.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "victory-stack",
3
- "version": "36.6.0",
3
+ "version": "36.6.1",
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.0",
27
- "victory-shared-events": "^36.6.0"
26
+ "victory-core": "^36.6.1",
27
+ "victory-shared-events": "^36.6.1"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "react": ">=16.6.0"
31
31
  },
32
32
  "devDependencies": {
33
- "victory-histogram": "^36.6.0"
33
+ "victory-bar": "*",
34
+ "victory-histogram": "*",
35
+ "victory-stack": "*"
34
36
  },
35
37
  "wireit": {
36
38
  "### THESE WIREIT CONFIGS ARE GENERATED ####": {},
@@ -132,6 +134,14 @@
132
134
  "pnpm-lock.yaml"
133
135
  ]
134
136
  },
137
+ "check": {
138
+ "dependencies": [
139
+ "types:check",
140
+ "jest",
141
+ "format",
142
+ "lint"
143
+ ]
144
+ },
135
145
  "types:check": {
136
146
  "command": "nps types:pkg:check",
137
147
  "files": [
@@ -143,6 +153,7 @@
143
153
  "types:create",
144
154
  "../victory-core:types:create",
145
155
  "../victory-shared-events:types:create",
156
+ "../victory-bar:types:create",
146
157
  "../victory-histogram:types:create",
147
158
  "../victory-vendor:types:create",
148
159
  "../victory-voronoi:types:create"
@@ -187,6 +198,19 @@
187
198
  "pnpm-lock.yaml"
188
199
  ]
189
200
  },
201
+ "format:fix": {
202
+ "command": "pnpm run format || nps format:pkg:fix",
203
+ "files": [
204
+ "src/**",
205
+ "*.json",
206
+ "../../.prettierignore",
207
+ "../../.prettierrc.json"
208
+ ],
209
+ "output": [],
210
+ "packageLocks": [
211
+ "pnpm-lock.yaml"
212
+ ]
213
+ },
190
214
  "lint": {
191
215
  "command": "nps lint:pkg",
192
216
  "files": [
@@ -198,6 +222,7 @@
198
222
  "dependencies": [
199
223
  "../victory-core:types:create",
200
224
  "../victory-shared-events:types:create",
225
+ "../victory-bar:types:create",
201
226
  "../victory-histogram:types:create",
202
227
  "../victory-vendor:types:create",
203
228
  "../victory-voronoi:types:create"
@@ -206,19 +231,6 @@
206
231
  "pnpm-lock.yaml"
207
232
  ]
208
233
  },
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
234
  "lint:fix": {
223
235
  "command": "pnpm run lint || nps lint:pkg:fix",
224
236
  "files": [
@@ -230,6 +242,7 @@
230
242
  "dependencies": [
231
243
  "../victory-core:types:create",
232
244
  "../victory-shared-events:types:create",
245
+ "../victory-bar:types:create",
233
246
  "../victory-histogram:types:create",
234
247
  "../victory-vendor:types:create",
235
248
  "../victory-voronoi:types:create"
@@ -249,6 +262,7 @@
249
262
  "output": [],
250
263
  "dependencies": [
251
264
  "build:lib:cjs",
265
+ "../victory-bar:build:lib:cjs",
252
266
  "../victory-histogram:build:lib:cjs",
253
267
  "../victory-vendor:build:lib:cjs",
254
268
  "../victory-voronoi:build:lib:cjs"
@@ -268,6 +282,7 @@
268
282
  "build:dist": "wireit",
269
283
  "build:dist:dev": "wireit",
270
284
  "build:dist:min": "wireit",
285
+ "check": "wireit",
271
286
  "types:check": "wireit",
272
287
  "types:create": "wireit",
273
288
  "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((child) => {
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
- const VictoryStack = (initialProps) => {
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 } = VictoryStackMemo;
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, origin } = calculatedProps;
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, "victory-stack") },
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
- VictoryStack.propTypes = {
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
- VictoryStack.defaultProps = {
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 VictoryStackMemo = React.memo(VictoryStack, isEqual);
209
-
210
- VictoryStackMemo.displayName = "VictoryStack";
211
- VictoryStackMemo.role = "stack";
212
-
213
- VictoryStackMemo.expectedComponents = [
214
- "groupComponent",
215
- "containerComponent",
216
- "labelComponent",
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 default VictoryStackMemo;
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";