victory-group 36.5.3 → 36.6.2

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-group",
3
- "version": "36.5.3",
3
+ "version": "36.6.2",
4
4
  "description": "Group Layout Component for Victory",
5
5
  "keywords": [
6
6
  "data visualization",
@@ -13,6 +13,7 @@
13
13
  "url": "https://github.com/formidablelabs/victory.git"
14
14
  },
15
15
  "homepage": "https://formidable.com/open-source/victory",
16
+ "sideEffects": false,
16
17
  "main": "lib/index.js",
17
18
  "module": "es/index.js",
18
19
  "jsnext:main": "es/index.js",
@@ -22,15 +23,267 @@
22
23
  "lodash": "^4.17.19",
23
24
  "prop-types": "^15.8.1",
24
25
  "react-fast-compare": "^3.2.0",
25
- "victory-core": "^36.5.3",
26
- "victory-shared-events": "^36.5.3"
26
+ "victory-core": "^36.6.2",
27
+ "victory-shared-events": "^36.6.2"
28
+ },
29
+ "devDependencies": {
30
+ "victory-bar": "*",
31
+ "victory-group": "*"
27
32
  },
28
33
  "peerDependencies": {
29
34
  "react": ">=16.6.0"
30
35
  },
31
- "scripts": {
32
- "version": "yarn run nps build-libs && nps build-dists"
36
+ "wireit": {
37
+ "### THESE WIREIT CONFIGS ARE GENERATED ####": {},
38
+ "### DO NOT MODIFY THESE MANUALLY ####": {},
39
+ "build": {
40
+ "dependencies": [
41
+ "build:lib",
42
+ "build:dist",
43
+ "types:create"
44
+ ]
45
+ },
46
+ "build:lib": {
47
+ "dependencies": [
48
+ "build:lib:esm",
49
+ "build:lib:cjs"
50
+ ]
51
+ },
52
+ "build:lib:esm": {
53
+ "command": "nps build:lib:esm",
54
+ "files": [
55
+ "src/**",
56
+ "!src/**/*.test.*",
57
+ "../../.babelrc.build.js"
58
+ ],
59
+ "output": [
60
+ "es/**/*.js",
61
+ "es/**/*.js.map"
62
+ ],
63
+ "dependencies": [
64
+ "../victory-core:build:lib:esm",
65
+ "../victory-shared-events:build:lib:esm"
66
+ ],
67
+ "packageLocks": [
68
+ "pnpm-lock.yaml"
69
+ ]
70
+ },
71
+ "build:lib:cjs": {
72
+ "command": "nps build:lib:cjs",
73
+ "files": [
74
+ "src/**",
75
+ "!src/**/*.test.*",
76
+ "../../.babelrc.build.js"
77
+ ],
78
+ "output": [
79
+ "lib/**/*.js",
80
+ "lib/**/*.js.map"
81
+ ],
82
+ "dependencies": [
83
+ "../victory-core:build:lib:cjs",
84
+ "../victory-shared-events:build:lib:cjs"
85
+ ],
86
+ "packageLocks": [
87
+ "pnpm-lock.yaml"
88
+ ]
89
+ },
90
+ "build:dist": {
91
+ "dependencies": [
92
+ "build:dist:dev",
93
+ "build:dist:min"
94
+ ]
95
+ },
96
+ "build:dist:dev": {
97
+ "command": "nps build:dist:dev",
98
+ "files": [
99
+ "src/**",
100
+ "!src/**/*.test.*",
101
+ "../../.babelrc.build.js",
102
+ "../../config/webpack.config.js",
103
+ "../../config/webpack.config.dev.js"
104
+ ],
105
+ "output": [
106
+ "dist/victory*.js",
107
+ "!dist/victory*.min.js*"
108
+ ],
109
+ "dependencies": [
110
+ "../victory-core:build:lib:esm",
111
+ "../victory-shared-events:build:lib:esm"
112
+ ],
113
+ "packageLocks": [
114
+ "pnpm-lock.yaml"
115
+ ]
116
+ },
117
+ "build:dist:min": {
118
+ "command": "nps build:dist:min",
119
+ "files": [
120
+ "src/**",
121
+ "!src/**/*.test.*",
122
+ "../../.babelrc.build.js",
123
+ "../../config/webpack.config.js"
124
+ ],
125
+ "output": [
126
+ "dist/victory*.min.js*"
127
+ ],
128
+ "dependencies": [
129
+ "../victory-core:build:lib:esm",
130
+ "../victory-shared-events:build:lib:esm"
131
+ ],
132
+ "packageLocks": [
133
+ "pnpm-lock.yaml"
134
+ ]
135
+ },
136
+ "check": {
137
+ "dependencies": [
138
+ "types:check",
139
+ "jest",
140
+ "format",
141
+ "lint"
142
+ ]
143
+ },
144
+ "types:check": {
145
+ "command": "nps types:pkg:check",
146
+ "files": [
147
+ "src/**/*.{ts,tsx}",
148
+ "../../tsconfig.base.json",
149
+ "tsconfig.json"
150
+ ],
151
+ "dependencies": [
152
+ "types:create",
153
+ "../victory-core:types:create",
154
+ "../victory-shared-events:types:create",
155
+ "../victory-bar:types:create",
156
+ "../victory-vendor:types:create",
157
+ "../victory-voronoi:types:create"
158
+ ],
159
+ "output": [],
160
+ "packageLocks": [
161
+ "pnpm-lock.yaml"
162
+ ]
163
+ },
164
+ "types:create": {
165
+ "command": "nps types:pkg:create",
166
+ "files": [
167
+ "src/**",
168
+ "!src/**/*.test.*",
169
+ "../../tsconfig.base.json",
170
+ "tsconfig.build.json"
171
+ ],
172
+ "output": [
173
+ "es/**/*.d.ts",
174
+ "es/**/*.d.ts.map",
175
+ "lib/**/*.d.ts",
176
+ "lib/**/*.d.ts.map"
177
+ ],
178
+ "dependencies": [
179
+ "../victory-core:types:create",
180
+ "../victory-shared-events:types:create"
181
+ ],
182
+ "packageLocks": [
183
+ "pnpm-lock.yaml"
184
+ ]
185
+ },
186
+ "format": {
187
+ "command": "nps format:pkg",
188
+ "files": [
189
+ "src/**",
190
+ "*.json",
191
+ "../../.prettierignore",
192
+ "../../.prettierrc.json"
193
+ ],
194
+ "output": [],
195
+ "packageLocks": [
196
+ "pnpm-lock.yaml"
197
+ ]
198
+ },
199
+ "format:fix": {
200
+ "command": "pnpm run format || nps format:pkg:fix",
201
+ "files": [
202
+ "src/**",
203
+ "*.json",
204
+ "../../.prettierignore",
205
+ "../../.prettierrc.json"
206
+ ],
207
+ "output": [],
208
+ "packageLocks": [
209
+ "pnpm-lock.yaml"
210
+ ]
211
+ },
212
+ "lint": {
213
+ "command": "nps lint:pkg",
214
+ "files": [
215
+ "src/**",
216
+ "../../.eslintignore",
217
+ "../../.eslintrc.js"
218
+ ],
219
+ "output": [],
220
+ "dependencies": [
221
+ "../victory-core:types:create",
222
+ "../victory-shared-events:types:create",
223
+ "../victory-bar:types:create",
224
+ "../victory-vendor:types:create",
225
+ "../victory-voronoi:types:create"
226
+ ],
227
+ "packageLocks": [
228
+ "pnpm-lock.yaml"
229
+ ]
230
+ },
231
+ "lint:fix": {
232
+ "command": "pnpm run lint || nps lint:pkg:fix",
233
+ "files": [
234
+ "src/**",
235
+ "../../.eslintignore",
236
+ "../../.eslintrc.js"
237
+ ],
238
+ "output": [],
239
+ "dependencies": [
240
+ "../victory-core:types:create",
241
+ "../victory-shared-events:types:create",
242
+ "../victory-bar:types:create",
243
+ "../victory-vendor:types:create",
244
+ "../victory-voronoi:types:create"
245
+ ],
246
+ "packageLocks": [
247
+ "pnpm-lock.yaml"
248
+ ]
249
+ },
250
+ "jest": {
251
+ "command": "nps jest:pkg",
252
+ "files": [
253
+ "src/**/*.test.*",
254
+ "../../.babelrc.js",
255
+ "../../test/jest-config.js",
256
+ "../../test/jest-setup.ts"
257
+ ],
258
+ "output": [],
259
+ "dependencies": [
260
+ "build:lib:cjs",
261
+ "../victory-bar:build:lib:cjs",
262
+ "../victory-vendor:build:lib:cjs",
263
+ "../victory-voronoi:build:lib:cjs"
264
+ ],
265
+ "packageLocks": [
266
+ "pnpm-lock.yaml"
267
+ ]
268
+ }
33
269
  },
34
- "sideEffects": false,
35
- "gitHead": "55338af3c57eacca5956e53c08a58e47ba41d01e"
36
- }
270
+ "scripts": {
271
+ "### THESE SCRIPTS ARE GENERATED ###": "true",
272
+ "### DO NOT MODIFY THESE MANUALLY ###": "true",
273
+ "build": "wireit",
274
+ "build:lib": "wireit",
275
+ "build:lib:esm": "wireit",
276
+ "build:lib:cjs": "wireit",
277
+ "build:dist": "wireit",
278
+ "build:dist:dev": "wireit",
279
+ "build:dist:min": "wireit",
280
+ "check": "wireit",
281
+ "types:check": "wireit",
282
+ "types:create": "wireit",
283
+ "format": "wireit",
284
+ "format:fix": "wireit",
285
+ "lint": "wireit",
286
+ "lint:fix": "wireit",
287
+ "jest": "wireit"
288
+ }
289
+ }
@@ -18,8 +18,8 @@ export function getCalculatedProps(props, childComponents) {
18
18
  const style = Wrapper.getStyle(props.theme, props.style, role);
19
19
  const { offset, colorScale, color, polar, horizontal } = props;
20
20
  const categories =
21
- props.categories || Wrapper.getCategories(props, childComponents);
22
- const datasets = props.datasets || Wrapper.getDataFromChildren(props);
21
+ props.categories || Wrapper.getCategories(props, childComponents, null);
22
+ const datasets = props.datasets || Wrapper.getDataFromChildren(props, null);
23
23
  const domain = {
24
24
  x: Wrapper.getDomain(
25
25
  assign({}, props, { categories }),
@@ -67,12 +67,14 @@ export function getCalculatedProps(props, childComponents) {
67
67
  // With shared events, the props change on every event, and every value is re-calculated
68
68
  const withoutSharedEvents = (props) => {
69
69
  const { children } = props;
70
- const modifiedChildren = React.Children.toArray(children).map((child) => {
71
- return {
72
- ...child,
73
- props: Helpers.omit(child.props, ["sharedEvents"]),
74
- };
75
- });
70
+ const modifiedChildren = React.Children.toArray(children).map(
71
+ (child: Record<string, any> | any) => {
72
+ return {
73
+ ...child,
74
+ props: Helpers.omit(child.props, ["sharedEvents"]),
75
+ };
76
+ },
77
+ );
76
78
  props.children = modifiedChildren;
77
79
  return props;
78
80
  };
@@ -186,7 +188,7 @@ function getDataWithOffset(props, defaultDataset = [], offset) {
186
188
  });
187
189
  }
188
190
 
189
- export function getChildren(props, childComponents, calculatedProps) {
191
+ export function getChildren(props, childComponents?, calculatedProps?) {
190
192
  props = Helpers.modifyProps(props, fallbackProps, "stack");
191
193
  childComponents = childComponents || React.Children.toArray(props.children);
192
194
  calculatedProps =
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./victory-group";
@@ -2,13 +2,24 @@ 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,
5
7
  CommonProps,
8
+ DomainPaddingPropType,
9
+ DomainPropType,
10
+ EventPropTypeInterface,
6
11
  Helpers,
7
12
  Hooks,
13
+ StringOrNumberOrCallback,
8
14
  UserProps,
15
+ VictoryCommonProps,
9
16
  VictoryContainer,
17
+ VictoryDatableProps,
18
+ VictoryMultiLabelableProps,
19
+ VictoryStyleInterface,
10
20
  VictoryTheme,
11
21
  Wrapper,
22
+ VictoryComponentConfiguration,
12
23
  } from "victory-core";
13
24
  import { VictorySharedEvents } from "victory-shared-events";
14
25
  import { getChildren, useMemoizedProps } from "./helper-methods";
@@ -21,9 +32,31 @@ const fallbackProps = {
21
32
  offset: 0,
22
33
  };
23
34
 
24
- const VictoryGroup = (initialProps) => {
35
+ export type VictoryGroupTTargetType = "data" | "labels" | "parent";
36
+ export interface VictoryGroupProps
37
+ extends VictoryCommonProps,
38
+ VictoryDatableProps,
39
+ VictoryMultiLabelableProps {
40
+ categories?: CategoryPropType;
41
+ children?: React.ReactNode;
42
+ color?: string;
43
+ colorScale?: ColorScalePropType;
44
+ domain?: DomainPropType;
45
+ domainPadding?: DomainPaddingPropType;
46
+ events?: EventPropTypeInterface<
47
+ VictoryGroupTTargetType,
48
+ StringOrNumberOrCallback
49
+ >[];
50
+ eventKey?: StringOrNumberOrCallback;
51
+ horizontal?: boolean;
52
+ offset?: number;
53
+ style?: VictoryStyleInterface;
54
+ displayName?: string;
55
+ }
56
+
57
+ const VictoryGroupBase: React.FC<VictoryGroupProps> = (initialProps) => {
25
58
  // eslint-disable-next-line no-use-before-define
26
- const { role } = VictoryGroupMemo;
59
+ const role = VictoryGroup?.role;
27
60
  const { getAnimationProps, setAnimationState, getProps } =
28
61
  Hooks.useAnimationState();
29
62
  const props = getProps(initialProps);
@@ -51,7 +84,7 @@ const VictoryGroup = (initialProps) => {
51
84
  const children = getChildren(props, childComponents, calculatedProps);
52
85
  return children.map((child, index) => {
53
86
  const childProps = assign(
54
- { animate: getAnimationProps(props, child, index, "victory-group") },
87
+ { animate: getAnimationProps(props, child, index) },
55
88
  child.props,
56
89
  );
57
90
  return React.cloneElement(child, childProps);
@@ -144,32 +177,18 @@ const VictoryGroup = (initialProps) => {
144
177
  return React.cloneElement(container, container.props, newChildren);
145
178
  };
146
179
 
147
- VictoryGroup.propTypes = {
180
+ VictoryGroupBase.propTypes = {
148
181
  ...CommonProps.baseProps,
149
182
  ...CommonProps.dataProps,
150
183
  children: PropTypes.oneOfType([
151
184
  PropTypes.arrayOf(PropTypes.node),
152
185
  PropTypes.node,
153
186
  ]),
154
- color: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
155
- colorScale: PropTypes.oneOfType([
156
- PropTypes.arrayOf(PropTypes.string),
157
- PropTypes.oneOf([
158
- "grayscale",
159
- "qualitative",
160
- "heatmap",
161
- "warm",
162
- "cool",
163
- "red",
164
- "green",
165
- "blue",
166
- ]),
167
- ]),
168
187
  horizontal: PropTypes.bool,
169
188
  offset: PropTypes.number,
170
189
  };
171
190
 
172
- VictoryGroup.defaultProps = {
191
+ VictoryGroupBase.defaultProps = {
173
192
  containerComponent: <VictoryContainer />,
174
193
  groupComponent: <g />,
175
194
  samples: 50,
@@ -178,19 +197,18 @@ VictoryGroup.defaultProps = {
178
197
  theme: VictoryTheme.grayscale,
179
198
  };
180
199
 
181
- // We need to attatch the static properties to the memoized version, or else
182
- // VictoryChart will not be able to get this component's role type
183
- const VictoryGroupMemo = React.memo(VictoryGroup, isEqual);
184
-
185
- VictoryGroupMemo.displayName = "VictoryGroup";
186
- VictoryGroupMemo.role = "group";
187
-
188
- VictoryGroupMemo.expectedComponents = [
189
- "groupComponent",
190
- "containerComponent",
191
- "labelComponent",
192
- ];
193
-
194
- VictoryGroupMemo.getChildren = getChildren;
200
+ const componentConfig: VictoryComponentConfiguration<VictoryGroupProps> = {
201
+ role: "group",
202
+ expectedComponents: [
203
+ "groupComponent",
204
+ "containerComponent",
205
+ "labelComponent",
206
+ ],
207
+ getChildren,
208
+ };
195
209
 
196
- export default VictoryGroupMemo;
210
+ export const VictoryGroup = Object.assign(
211
+ React.memo(VictoryGroupBase, isEqual),
212
+ componentConfig,
213
+ );
214
+ VictoryGroup.displayName = "VictoryGroup";
package/src/index.d.ts DELETED
@@ -1,37 +0,0 @@
1
- import * as React from "react";
2
- import {
3
- CategoryPropType,
4
- ColorScalePropType,
5
- DomainPropType,
6
- DomainPaddingPropType,
7
- EventPropTypeInterface,
8
- StringOrNumberOrCallback,
9
- VictoryCommonProps,
10
- VictoryDatableProps,
11
- VictoryMultiLabelableProps,
12
- VictoryStyleInterface,
13
- } from "victory-core";
14
-
15
- export type VictoryGroupTTargetType = "data" | "labels" | "parent";
16
-
17
- export interface VictoryGroupProps
18
- extends VictoryCommonProps,
19
- VictoryDatableProps,
20
- VictoryMultiLabelableProps {
21
- categories?: CategoryPropType;
22
- children?: React.ReactNode;
23
- color?: string;
24
- colorScale?: ColorScalePropType;
25
- domain?: DomainPropType;
26
- domainPadding?: DomainPaddingPropType;
27
- events?: EventPropTypeInterface<
28
- VictoryGroupTTargetType,
29
- StringOrNumberOrCallback
30
- >[];
31
- eventKey?: StringOrNumberOrCallback;
32
- horizontal?: boolean;
33
- offset?: number;
34
- style?: VictoryStyleInterface;
35
- }
36
-
37
- export class VictoryGroup extends React.Component<VictoryGroupProps, any> {}
package/src/index.js DELETED
@@ -1 +0,0 @@
1
- export { default as VictoryGroup } from "./victory-group";