victory-box-plot 36.5.1 → 36.6.0

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-box-plot",
3
- "version": "36.5.1",
3
+ "version": "36.6.0",
4
4
  "description": "Box Plot 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",
@@ -21,15 +22,257 @@
21
22
  "dependencies": {
22
23
  "lodash": "^4.17.19",
23
24
  "prop-types": "^15.8.1",
24
- "victory-core": "^36.5.1",
25
- "victory-vendor": "^36.5.1"
25
+ "victory-core": "^36.6.0",
26
+ "victory-vendor": "^36.6.0"
26
27
  },
27
28
  "peerDependencies": {
28
29
  "react": ">=16.6.0"
29
30
  },
30
- "scripts": {
31
- "version": "yarn run nps build-libs && nps build-dists"
31
+ "devDependencies": {
32
+ "victory-box-plot": "*",
33
+ "victory-chart": "^36.6.0"
32
34
  },
33
- "sideEffects": false,
34
- "gitHead": "fbe60407533cd7a6da4f8155d2ef8e189583c5a2"
35
- }
35
+ "wireit": {
36
+ "### THESE WIREIT CONFIGS ARE GENERATED ####": {},
37
+ "### DO NOT MODIFY THESE MANUALLY ####": {},
38
+ "build": {
39
+ "dependencies": [
40
+ "build:lib",
41
+ "build:dist",
42
+ "types:create"
43
+ ]
44
+ },
45
+ "build:lib": {
46
+ "dependencies": [
47
+ "build:lib:esm",
48
+ "build:lib:cjs"
49
+ ]
50
+ },
51
+ "build:lib:esm": {
52
+ "command": "nps build:lib:esm",
53
+ "files": [
54
+ "src/**",
55
+ "!src/**/*.test.*",
56
+ "../../.babelrc.build.js"
57
+ ],
58
+ "output": [
59
+ "es/**/*.js",
60
+ "es/**/*.js.map"
61
+ ],
62
+ "dependencies": [
63
+ "../victory-core:build:lib:esm",
64
+ "../victory-vendor:build:lib:esm"
65
+ ],
66
+ "packageLocks": [
67
+ "pnpm-lock.yaml"
68
+ ]
69
+ },
70
+ "build:lib:cjs": {
71
+ "command": "nps build:lib:cjs",
72
+ "files": [
73
+ "src/**",
74
+ "!src/**/*.test.*",
75
+ "../../.babelrc.build.js"
76
+ ],
77
+ "output": [
78
+ "lib/**/*.js",
79
+ "lib/**/*.js.map"
80
+ ],
81
+ "dependencies": [
82
+ "../victory-core:build:lib:cjs",
83
+ "../victory-vendor:build:lib:cjs"
84
+ ],
85
+ "packageLocks": [
86
+ "pnpm-lock.yaml"
87
+ ]
88
+ },
89
+ "build:dist": {
90
+ "dependencies": [
91
+ "build:dist:dev",
92
+ "build:dist:min"
93
+ ]
94
+ },
95
+ "build:dist:dev": {
96
+ "command": "nps build:dist:dev",
97
+ "files": [
98
+ "src/**",
99
+ "!src/**/*.test.*",
100
+ "../../.babelrc.build.js",
101
+ "../../config/webpack.config.js",
102
+ "../../config/webpack.config.dev.js"
103
+ ],
104
+ "output": [
105
+ "dist/victory*.js",
106
+ "!dist/victory*.min.js*"
107
+ ],
108
+ "dependencies": [
109
+ "../victory-core:build:lib:esm",
110
+ "../victory-vendor:build:lib:esm"
111
+ ],
112
+ "packageLocks": [
113
+ "pnpm-lock.yaml"
114
+ ]
115
+ },
116
+ "build:dist:min": {
117
+ "command": "nps build:dist:min",
118
+ "files": [
119
+ "src/**",
120
+ "!src/**/*.test.*",
121
+ "../../.babelrc.build.js",
122
+ "../../config/webpack.config.js"
123
+ ],
124
+ "output": [
125
+ "dist/victory*.min.js*"
126
+ ],
127
+ "dependencies": [
128
+ "../victory-core:build:lib:esm",
129
+ "../victory-vendor:build:lib:esm"
130
+ ],
131
+ "packageLocks": [
132
+ "pnpm-lock.yaml"
133
+ ]
134
+ },
135
+ "types:check": {
136
+ "command": "nps types:pkg:check",
137
+ "files": [
138
+ "src/**/*.{ts,tsx}",
139
+ "../../tsconfig.base.json",
140
+ "tsconfig.json"
141
+ ],
142
+ "dependencies": [
143
+ "types:create",
144
+ "../victory-core:types:create",
145
+ "../victory-vendor:types:create",
146
+ "../victory-chart:types:create",
147
+ "../victory-voronoi:types:create"
148
+ ],
149
+ "output": [],
150
+ "packageLocks": [
151
+ "pnpm-lock.yaml"
152
+ ]
153
+ },
154
+ "types:create": {
155
+ "command": "nps types:pkg:create",
156
+ "files": [
157
+ "src/**",
158
+ "!src/**/*.test.*",
159
+ "../../tsconfig.base.json",
160
+ "tsconfig.build.json"
161
+ ],
162
+ "output": [
163
+ "es/**/*.d.ts",
164
+ "es/**/*.d.ts.map",
165
+ "lib/**/*.d.ts",
166
+ "lib/**/*.d.ts.map"
167
+ ],
168
+ "dependencies": [
169
+ "../victory-core:types:create",
170
+ "../victory-vendor:types:create"
171
+ ],
172
+ "packageLocks": [
173
+ "pnpm-lock.yaml"
174
+ ]
175
+ },
176
+ "format": {
177
+ "command": "nps format:pkg",
178
+ "files": [
179
+ "src/**",
180
+ "*.json",
181
+ "../../.prettierignore",
182
+ "../../.prettierrc.json"
183
+ ],
184
+ "output": [],
185
+ "packageLocks": [
186
+ "pnpm-lock.yaml"
187
+ ]
188
+ },
189
+ "lint": {
190
+ "command": "nps lint:pkg",
191
+ "files": [
192
+ "src/**",
193
+ "../../.eslintignore",
194
+ "../../.eslintrc.js"
195
+ ],
196
+ "output": [],
197
+ "dependencies": [
198
+ "../victory-vendor:build",
199
+ "../victory-core:types:create",
200
+ "../victory-vendor:types:create",
201
+ "../victory-chart:types:create",
202
+ "../victory-voronoi:types:create"
203
+ ],
204
+ "packageLocks": [
205
+ "pnpm-lock.yaml"
206
+ ]
207
+ },
208
+ "format:fix": {
209
+ "command": "pnpm run format || nps format:pkg:fix",
210
+ "files": [
211
+ "src/**",
212
+ "*.json",
213
+ "../../.prettierignore",
214
+ "../../.prettierrc.json"
215
+ ],
216
+ "output": [],
217
+ "packageLocks": [
218
+ "pnpm-lock.yaml"
219
+ ]
220
+ },
221
+ "lint:fix": {
222
+ "command": "pnpm run lint || nps lint:pkg:fix",
223
+ "files": [
224
+ "src/**",
225
+ "../../.eslintignore",
226
+ "../../.eslintrc.js"
227
+ ],
228
+ "output": [],
229
+ "dependencies": [
230
+ "../victory-vendor:build",
231
+ "../victory-core:types:create",
232
+ "../victory-vendor:types:create",
233
+ "../victory-chart:types:create",
234
+ "../victory-voronoi:types:create"
235
+ ],
236
+ "packageLocks": [
237
+ "pnpm-lock.yaml"
238
+ ]
239
+ },
240
+ "jest": {
241
+ "command": "nps jest:pkg",
242
+ "files": [
243
+ "src/**/*.test.*",
244
+ "../../.babelrc.js",
245
+ "../../test/jest-config.js",
246
+ "../../test/jest-setup.ts"
247
+ ],
248
+ "output": [],
249
+ "dependencies": [
250
+ "build:lib:cjs",
251
+ "../victory-chart:build:lib:cjs",
252
+ "../victory-vendor:build:lib:cjs",
253
+ "../victory-voronoi:build:lib:cjs"
254
+ ],
255
+ "packageLocks": [
256
+ "pnpm-lock.yaml"
257
+ ]
258
+ }
259
+ },
260
+ "scripts": {
261
+ "### THESE SCRIPTS ARE GENERATED ###": "true",
262
+ "### DO NOT MODIFY THESE MANUALLY ###": "true",
263
+ "build": "wireit",
264
+ "build:lib": "wireit",
265
+ "build:lib:esm": "wireit",
266
+ "build:lib:cjs": "wireit",
267
+ "build:dist": "wireit",
268
+ "build:dist:dev": "wireit",
269
+ "build:dist:min": "wireit",
270
+ "types:check": "wireit",
271
+ "types:create": "wireit",
272
+ "format": "wireit",
273
+ "format:fix": "wireit",
274
+ "lint": "wireit",
275
+ "lint:fix": "wireit",
276
+ "jest": "wireit"
277
+ }
278
+ }
@@ -152,7 +152,7 @@ export const getDomain = (props, axis) => {
152
152
  return Domain.createDomainFunction(getDomainFromData)(props, axis);
153
153
  };
154
154
 
155
- const getLabelStyle = (props, styleObject, namespace) => {
155
+ const getLabelStyle = (props, styleObject, namespace?) => {
156
156
  const component = props[`${namespace}LabelComponent`] || props.labelComponent;
157
157
  const baseStyle = styleObject[`${namespace}Labels`] || styleObject.labels;
158
158
  if (!Helpers.isTooltip(component)) {
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./victory-box-plot";
@@ -14,6 +14,16 @@ import {
14
14
  DefaultTransitions,
15
15
  CommonProps,
16
16
  UserProps,
17
+ EventPropTypeInterface,
18
+ DomainPropType,
19
+ DomainPaddingPropType,
20
+ OrientationTypes,
21
+ StringOrNumberOrCallback,
22
+ VictoryDatableProps,
23
+ VictoryCommonProps,
24
+ VictoryStyleObject,
25
+ VictoryLabelStyleObject,
26
+ EventsMixinClass,
17
27
  } from "victory-core";
18
28
  import { getDomain, getData, getBaseProps } from "./helper-methods";
19
29
 
@@ -49,7 +59,75 @@ const options = {
49
59
  ],
50
60
  };
51
61
 
52
- class VictoryBoxPlot extends React.Component {
62
+ export type VictoryBoxPlotLabelType =
63
+ | boolean
64
+ | (string | number)[]
65
+ | { (): any }
66
+ | { (data: any): string | null };
67
+
68
+ export interface VictoryBoxPlotStyleInterface {
69
+ parent?: VictoryStyleObject;
70
+ max?: VictoryStyleObject;
71
+ maxLabels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
72
+ min?: VictoryStyleObject;
73
+ minLabels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
74
+ median?: VictoryStyleObject;
75
+ medianLabels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
76
+ q1?: VictoryStyleObject;
77
+ q1Labels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
78
+ q3?: VictoryStyleObject;
79
+ q3Labels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
80
+ }
81
+
82
+ export interface VictoryBoxPlotLabelOrientationInterface {
83
+ max?: OrientationTypes;
84
+ min?: OrientationTypes;
85
+ median?: OrientationTypes;
86
+ q1?: OrientationTypes;
87
+ q3?: OrientationTypes;
88
+ }
89
+
90
+ export interface VictoryBoxPlotProps
91
+ extends VictoryCommonProps,
92
+ VictoryDatableProps {
93
+ boxWidth?: number;
94
+ datum?: any;
95
+ domain?: DomainPropType;
96
+ domainPadding?: DomainPaddingPropType;
97
+ events?: EventPropTypeInterface<string, StringOrNumberOrCallback>[];
98
+ eventKey?: StringOrNumberOrCallback;
99
+ horizontal?: boolean;
100
+ labelOrientation?: OrientationTypes | VictoryBoxPlotLabelOrientationInterface;
101
+ labels?: boolean;
102
+ max?: StringOrNumberOrCallback | string[];
103
+ maxComponent?: React.ReactElement;
104
+ maxLabelComponent?: React.ReactElement;
105
+ maxLabels?: VictoryBoxPlotLabelType;
106
+ median?: StringOrNumberOrCallback | string[];
107
+ medianComponent?: React.ReactElement;
108
+ medianLabelComponent?: React.ReactElement;
109
+ medianLabels?: VictoryBoxPlotLabelType;
110
+ min?: StringOrNumberOrCallback | string[];
111
+ minComponent?: React.ReactElement;
112
+ minLabelComponent?: React.ReactElement;
113
+ minLabels?: VictoryBoxPlotLabelType;
114
+ q1?: StringOrNumberOrCallback | string[];
115
+ q1Component?: React.ReactElement;
116
+ q1LabelComponent?: React.ReactElement;
117
+ q1Labels?: VictoryBoxPlotLabelType;
118
+ q3?: StringOrNumberOrCallback | string[];
119
+ q3Component?: React.ReactElement;
120
+ q3LabelComponent?: React.ReactElement;
121
+ q3Labels?: VictoryBoxPlotLabelType;
122
+ style?: VictoryBoxPlotStyleInterface;
123
+ text?: StringOrNumberOrCallback | string[];
124
+ whiskerWidth?: number;
125
+ }
126
+
127
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
128
+ interface VictoryBoxPlotBase extends EventsMixinClass<VictoryBoxPlotProps> {}
129
+
130
+ class VictoryBoxPlotBase extends React.Component<VictoryBoxPlotProps> {
53
131
  static animationWhitelist = [
54
132
  "data",
55
133
  "domain",
@@ -260,21 +338,30 @@ class VictoryBoxPlot extends React.Component {
260
338
  );
261
339
  }
262
340
  return validDataComponents;
263
- }, []);
341
+ }, [] as React.ReactElement[]);
264
342
  }),
265
343
  );
266
344
 
267
345
  const labelComponents = flatten(
268
346
  types.map((type) => {
269
- const components = this.dataKeys.map((key, index) => {
270
- const name = `${type}Labels`;
271
- const baseComponent = props[`${type}LabelComponent`];
272
- const labelProps = this.getComponentProps(baseComponent, name, index);
273
- if (labelProps.text !== undefined && labelProps.text !== null) {
274
- return React.cloneElement(baseComponent, labelProps);
275
- }
276
- return undefined;
277
- });
347
+ const components = this.dataKeys.reduce(
348
+ (validComponents, _key, index) => {
349
+ const name = `${type}Labels`;
350
+ const baseComponent = props[`${type}LabelComponent`];
351
+ const labelProps = this.getComponentProps(
352
+ baseComponent,
353
+ name,
354
+ index,
355
+ );
356
+ if (labelProps.text !== undefined && labelProps.text !== null) {
357
+ validComponents.push(
358
+ React.cloneElement(baseComponent, labelProps),
359
+ );
360
+ }
361
+ return validComponents;
362
+ },
363
+ [] as React.ReactElement[],
364
+ );
278
365
  return components.filter(Boolean);
279
366
  }),
280
367
  );
@@ -317,4 +404,4 @@ class VictoryBoxPlot extends React.Component {
317
404
  }
318
405
  }
319
406
 
320
- export default addEvents(VictoryBoxPlot, options);
407
+ export const VictoryBoxPlot = addEvents(VictoryBoxPlotBase, options);
package/src/index.d.ts DELETED
@@ -1,77 +0,0 @@
1
- import * as React from "react";
2
- import {
3
- EventPropTypeInterface,
4
- DomainPropType,
5
- DomainPaddingPropType,
6
- OrientationTypes,
7
- StringOrNumberOrCallback,
8
- VictoryDatableProps,
9
- VictoryCommonProps,
10
- VictoryStyleObject,
11
- VictoryLabelStyleObject,
12
- } from "victory-core";
13
-
14
- export type VictoryBoxPlotLabelType =
15
- | boolean
16
- | (string | number)[]
17
- | Function
18
- | { (data: any): string | null };
19
-
20
- export interface VictoryBoxPlotStyleInterface {
21
- parent?: VictoryStyleObject;
22
- max?: VictoryStyleObject;
23
- maxLabels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
24
- min?: VictoryStyleObject;
25
- minLabels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
26
- median?: VictoryStyleObject;
27
- medianLabels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
28
- q1?: VictoryStyleObject;
29
- q1Labels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
30
- q3?: VictoryStyleObject;
31
- q3Labels?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
32
- }
33
-
34
- export interface VictoryBoxPlotLabelOrientationInterface {
35
- max?: OrientationTypes;
36
- min?: OrientationTypes;
37
- median?: OrientationTypes;
38
- q1?: OrientationTypes;
39
- q3?: OrientationTypes;
40
- }
41
-
42
- export interface VictoryBoxPlotProps
43
- extends VictoryCommonProps,
44
- VictoryDatableProps {
45
- boxWidth?: number;
46
- domain?: DomainPropType;
47
- domainPadding?: DomainPaddingPropType;
48
- events?: EventPropTypeInterface<string, StringOrNumberOrCallback>[];
49
- eventKey?: StringOrNumberOrCallback;
50
- horizontal?: boolean;
51
- labelOrientation?: OrientationTypes | VictoryBoxPlotLabelOrientationInterface;
52
- labels?: boolean;
53
- max?: StringOrNumberOrCallback | string[];
54
- maxComponent?: React.ReactElement;
55
- maxLabelComponent?: React.ReactElement;
56
- maxLabels?: VictoryBoxPlotLabelType;
57
- median?: StringOrNumberOrCallback | string[];
58
- medianComponent?: React.ReactElement;
59
- medianLabelComponent?: React.ReactElement;
60
- medianLabels?: VictoryBoxPlotLabelType;
61
- min?: StringOrNumberOrCallback | string[];
62
- minComponent?: React.ReactElement;
63
- minLabelComponent?: React.ReactElement;
64
- minLabels?: VictoryBoxPlotLabelType;
65
- q1?: StringOrNumberOrCallback | string[];
66
- q1Component?: React.ReactElement;
67
- q1LabelComponent?: React.ReactElement;
68
- q1Labels?: VictoryBoxPlotLabelType;
69
- q3?: StringOrNumberOrCallback | string[];
70
- q3Component?: React.ReactElement;
71
- q3LabelComponent?: React.ReactElement;
72
- q3Labels?: VictoryBoxPlotLabelType;
73
- style?: VictoryBoxPlotStyleInterface;
74
- whiskerWidth?: number;
75
- }
76
-
77
- export class VictoryBoxPlot extends React.Component<VictoryBoxPlotProps, any> {}
package/src/index.js DELETED
@@ -1 +0,0 @@
1
- export { default as VictoryBoxPlot } from "./victory-box-plot";