victory-errorbar 36.5.3 → 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/CHANGELOG.md +18 -0
- package/dist/victory-errorbar.js +2780 -1826
- package/dist/victory-errorbar.min.js +1 -1
- package/es/error-bar.d.ts +32 -0
- package/es/error-bar.js +7 -7
- package/es/helper-methods.d.ts +4 -0
- package/es/helper-methods.js +3 -3
- package/es/index.d.ts +3 -50
- package/es/index.js +2 -2
- package/es/victory-errorbar.d.ts +12 -0
- package/es/victory-errorbar.js +19 -19
- package/lib/error-bar.d.ts +32 -0
- package/lib/error-bar.js +8 -7
- package/lib/helper-methods.d.ts +4 -0
- package/lib/helper-methods.js +3 -3
- package/lib/index.d.ts +3 -50
- package/lib/index.js +23 -15
- package/lib/victory-errorbar.d.ts +12 -0
- package/lib/victory-errorbar.js +22 -24
- package/package.json +238 -7
- package/src/{error-bar.js → error-bar.tsx} +34 -6
- package/src/{helper-methods.js → helper-methods.tsx} +3 -4
- package/src/index.ts +2 -0
- package/src/{victory-errorbar.js → victory-errorbar.tsx} +35 -3
- package/src/index.d.ts +0 -50
- package/src/index.js +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-errorbar",
|
|
3
|
-
"version": "36.
|
|
3
|
+
"version": "36.6.0",
|
|
4
4
|
"description": "Error Bar 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,14 +22,244 @@
|
|
|
21
22
|
"dependencies": {
|
|
22
23
|
"lodash": "^4.17.19",
|
|
23
24
|
"prop-types": "^15.8.1",
|
|
24
|
-
"victory-core": "^36.
|
|
25
|
+
"victory-core": "^36.6.0"
|
|
25
26
|
},
|
|
26
27
|
"peerDependencies": {
|
|
27
28
|
"react": ">=16.6.0"
|
|
28
29
|
},
|
|
29
|
-
"
|
|
30
|
-
"
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"victory-errorbar": "*"
|
|
31
32
|
},
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
}
|
|
33
|
+
"wireit": {
|
|
34
|
+
"### THESE WIREIT CONFIGS ARE GENERATED ####": {},
|
|
35
|
+
"### DO NOT MODIFY THESE MANUALLY ####": {},
|
|
36
|
+
"build": {
|
|
37
|
+
"dependencies": [
|
|
38
|
+
"build:lib",
|
|
39
|
+
"build:dist",
|
|
40
|
+
"types:create"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"build:lib": {
|
|
44
|
+
"dependencies": [
|
|
45
|
+
"build:lib:esm",
|
|
46
|
+
"build:lib:cjs"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"build:lib:esm": {
|
|
50
|
+
"command": "nps build:lib:esm",
|
|
51
|
+
"files": [
|
|
52
|
+
"src/**",
|
|
53
|
+
"!src/**/*.test.*",
|
|
54
|
+
"../../.babelrc.build.js"
|
|
55
|
+
],
|
|
56
|
+
"output": [
|
|
57
|
+
"es/**/*.js",
|
|
58
|
+
"es/**/*.js.map"
|
|
59
|
+
],
|
|
60
|
+
"dependencies": [
|
|
61
|
+
"../victory-core:build:lib:esm"
|
|
62
|
+
],
|
|
63
|
+
"packageLocks": [
|
|
64
|
+
"pnpm-lock.yaml"
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
"build:lib:cjs": {
|
|
68
|
+
"command": "nps build:lib:cjs",
|
|
69
|
+
"files": [
|
|
70
|
+
"src/**",
|
|
71
|
+
"!src/**/*.test.*",
|
|
72
|
+
"../../.babelrc.build.js"
|
|
73
|
+
],
|
|
74
|
+
"output": [
|
|
75
|
+
"lib/**/*.js",
|
|
76
|
+
"lib/**/*.js.map"
|
|
77
|
+
],
|
|
78
|
+
"dependencies": [
|
|
79
|
+
"../victory-core:build:lib:cjs"
|
|
80
|
+
],
|
|
81
|
+
"packageLocks": [
|
|
82
|
+
"pnpm-lock.yaml"
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
"build:dist": {
|
|
86
|
+
"dependencies": [
|
|
87
|
+
"build:dist:dev",
|
|
88
|
+
"build:dist:min"
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
"build:dist:dev": {
|
|
92
|
+
"command": "nps build:dist:dev",
|
|
93
|
+
"files": [
|
|
94
|
+
"src/**",
|
|
95
|
+
"!src/**/*.test.*",
|
|
96
|
+
"../../.babelrc.build.js",
|
|
97
|
+
"../../config/webpack.config.js",
|
|
98
|
+
"../../config/webpack.config.dev.js"
|
|
99
|
+
],
|
|
100
|
+
"output": [
|
|
101
|
+
"dist/victory*.js",
|
|
102
|
+
"!dist/victory*.min.js*"
|
|
103
|
+
],
|
|
104
|
+
"dependencies": [
|
|
105
|
+
"../victory-core:build:lib:esm"
|
|
106
|
+
],
|
|
107
|
+
"packageLocks": [
|
|
108
|
+
"pnpm-lock.yaml"
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
"build:dist:min": {
|
|
112
|
+
"command": "nps build:dist:min",
|
|
113
|
+
"files": [
|
|
114
|
+
"src/**",
|
|
115
|
+
"!src/**/*.test.*",
|
|
116
|
+
"../../.babelrc.build.js",
|
|
117
|
+
"../../config/webpack.config.js"
|
|
118
|
+
],
|
|
119
|
+
"output": [
|
|
120
|
+
"dist/victory*.min.js*"
|
|
121
|
+
],
|
|
122
|
+
"dependencies": [
|
|
123
|
+
"../victory-core:build:lib:esm"
|
|
124
|
+
],
|
|
125
|
+
"packageLocks": [
|
|
126
|
+
"pnpm-lock.yaml"
|
|
127
|
+
]
|
|
128
|
+
},
|
|
129
|
+
"types:check": {
|
|
130
|
+
"command": "nps types:pkg:check",
|
|
131
|
+
"files": [
|
|
132
|
+
"src/**/*.{ts,tsx}",
|
|
133
|
+
"../../tsconfig.base.json",
|
|
134
|
+
"tsconfig.json"
|
|
135
|
+
],
|
|
136
|
+
"dependencies": [
|
|
137
|
+
"types:create",
|
|
138
|
+
"../victory-core:types:create",
|
|
139
|
+
"../victory-vendor:types:create",
|
|
140
|
+
"../victory-voronoi:types:create"
|
|
141
|
+
],
|
|
142
|
+
"output": [],
|
|
143
|
+
"packageLocks": [
|
|
144
|
+
"pnpm-lock.yaml"
|
|
145
|
+
]
|
|
146
|
+
},
|
|
147
|
+
"types:create": {
|
|
148
|
+
"command": "nps types:pkg:create",
|
|
149
|
+
"files": [
|
|
150
|
+
"src/**",
|
|
151
|
+
"!src/**/*.test.*",
|
|
152
|
+
"../../tsconfig.base.json",
|
|
153
|
+
"tsconfig.build.json"
|
|
154
|
+
],
|
|
155
|
+
"output": [
|
|
156
|
+
"es/**/*.d.ts",
|
|
157
|
+
"es/**/*.d.ts.map",
|
|
158
|
+
"lib/**/*.d.ts",
|
|
159
|
+
"lib/**/*.d.ts.map"
|
|
160
|
+
],
|
|
161
|
+
"dependencies": [
|
|
162
|
+
"../victory-core:types:create"
|
|
163
|
+
],
|
|
164
|
+
"packageLocks": [
|
|
165
|
+
"pnpm-lock.yaml"
|
|
166
|
+
]
|
|
167
|
+
},
|
|
168
|
+
"format": {
|
|
169
|
+
"command": "nps format:pkg",
|
|
170
|
+
"files": [
|
|
171
|
+
"src/**",
|
|
172
|
+
"*.json",
|
|
173
|
+
"../../.prettierignore",
|
|
174
|
+
"../../.prettierrc.json"
|
|
175
|
+
],
|
|
176
|
+
"output": [],
|
|
177
|
+
"packageLocks": [
|
|
178
|
+
"pnpm-lock.yaml"
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
"lint": {
|
|
182
|
+
"command": "nps lint:pkg",
|
|
183
|
+
"files": [
|
|
184
|
+
"src/**",
|
|
185
|
+
"../../.eslintignore",
|
|
186
|
+
"../../.eslintrc.js"
|
|
187
|
+
],
|
|
188
|
+
"output": [],
|
|
189
|
+
"dependencies": [
|
|
190
|
+
"../victory-core:types:create",
|
|
191
|
+
"../victory-vendor:types:create",
|
|
192
|
+
"../victory-voronoi:types:create"
|
|
193
|
+
],
|
|
194
|
+
"packageLocks": [
|
|
195
|
+
"pnpm-lock.yaml"
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
"format:fix": {
|
|
199
|
+
"command": "pnpm run format || nps format:pkg:fix",
|
|
200
|
+
"files": [
|
|
201
|
+
"src/**",
|
|
202
|
+
"*.json",
|
|
203
|
+
"../../.prettierignore",
|
|
204
|
+
"../../.prettierrc.json"
|
|
205
|
+
],
|
|
206
|
+
"output": [],
|
|
207
|
+
"packageLocks": [
|
|
208
|
+
"pnpm-lock.yaml"
|
|
209
|
+
]
|
|
210
|
+
},
|
|
211
|
+
"lint:fix": {
|
|
212
|
+
"command": "pnpm run lint || nps lint:pkg:fix",
|
|
213
|
+
"files": [
|
|
214
|
+
"src/**",
|
|
215
|
+
"../../.eslintignore",
|
|
216
|
+
"../../.eslintrc.js"
|
|
217
|
+
],
|
|
218
|
+
"output": [],
|
|
219
|
+
"dependencies": [
|
|
220
|
+
"../victory-core:types:create",
|
|
221
|
+
"../victory-vendor:types:create",
|
|
222
|
+
"../victory-voronoi:types:create"
|
|
223
|
+
],
|
|
224
|
+
"packageLocks": [
|
|
225
|
+
"pnpm-lock.yaml"
|
|
226
|
+
]
|
|
227
|
+
},
|
|
228
|
+
"jest": {
|
|
229
|
+
"command": "nps jest:pkg",
|
|
230
|
+
"files": [
|
|
231
|
+
"src/**/*.test.*",
|
|
232
|
+
"../../.babelrc.js",
|
|
233
|
+
"../../test/jest-config.js",
|
|
234
|
+
"../../test/jest-setup.ts"
|
|
235
|
+
],
|
|
236
|
+
"output": [],
|
|
237
|
+
"dependencies": [
|
|
238
|
+
"build:lib:cjs",
|
|
239
|
+
"../victory-vendor:build:lib:cjs",
|
|
240
|
+
"../victory-voronoi:build:lib:cjs"
|
|
241
|
+
],
|
|
242
|
+
"packageLocks": [
|
|
243
|
+
"pnpm-lock.yaml"
|
|
244
|
+
]
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
"scripts": {
|
|
248
|
+
"### THESE SCRIPTS ARE GENERATED ###": "true",
|
|
249
|
+
"### DO NOT MODIFY THESE MANUALLY ###": "true",
|
|
250
|
+
"build": "wireit",
|
|
251
|
+
"build:lib": "wireit",
|
|
252
|
+
"build:lib:esm": "wireit",
|
|
253
|
+
"build:lib:cjs": "wireit",
|
|
254
|
+
"build:dist": "wireit",
|
|
255
|
+
"build:dist:dev": "wireit",
|
|
256
|
+
"build:dist:min": "wireit",
|
|
257
|
+
"types:check": "wireit",
|
|
258
|
+
"types:create": "wireit",
|
|
259
|
+
"format": "wireit",
|
|
260
|
+
"format:fix": "wireit",
|
|
261
|
+
"lint": "wireit",
|
|
262
|
+
"lint:fix": "wireit",
|
|
263
|
+
"jest": "wireit"
|
|
264
|
+
}
|
|
265
|
+
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
/* eslint-disable max-statements */
|
|
2
2
|
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Helpers,
|
|
6
|
+
CommonProps,
|
|
7
|
+
Line,
|
|
8
|
+
UserProps,
|
|
9
|
+
VictoryCommonPrimitiveProps,
|
|
10
|
+
EventsMixinClass,
|
|
11
|
+
} from "victory-core";
|
|
5
12
|
import { assign } from "lodash";
|
|
6
13
|
|
|
7
14
|
const renderBorder = (props, error, type) => {
|
|
@@ -80,11 +87,34 @@ const evaluateProps = (props) => {
|
|
|
80
87
|
return assign({}, props, { ariaLabel, id, style, tabIndex });
|
|
81
88
|
};
|
|
82
89
|
|
|
83
|
-
|
|
90
|
+
export interface ErrorBarProps extends VictoryCommonPrimitiveProps {
|
|
91
|
+
borderWidth?: number;
|
|
92
|
+
datum?: any;
|
|
93
|
+
errorX?: number | any[] | boolean;
|
|
94
|
+
errorY?: number | any[] | boolean;
|
|
95
|
+
groupComponent?: React.ReactElement;
|
|
96
|
+
lineComponent?: React.ReactElement;
|
|
97
|
+
x?: number;
|
|
98
|
+
y?: number;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// ErrorProps for calculateError
|
|
102
|
+
export interface ErrorProps {
|
|
103
|
+
right?: { error: any; errorIndex: number };
|
|
104
|
+
left?: { error: any; errorIndex: number };
|
|
105
|
+
bottom?: { error: any; errorIndex: number };
|
|
106
|
+
top?: { error: any; errorIndex: number };
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
110
|
+
interface ErrorBar extends EventsMixinClass<ErrorBarProps> {}
|
|
111
|
+
|
|
112
|
+
export const ErrorBar = (props: ErrorBarProps & typeof ErrorBar.default) => {
|
|
84
113
|
props = evaluateProps(props);
|
|
114
|
+
const { groupComponent } = props;
|
|
85
115
|
const userProps = UserProps.getSafeUserProps(props);
|
|
86
116
|
const { tabIndex, ariaLabel } = props;
|
|
87
|
-
const error = calculateError(props);
|
|
117
|
+
const error: ErrorProps = calculateError(props);
|
|
88
118
|
const children = [
|
|
89
119
|
error.right ? renderBorder(props, error, "right") : null,
|
|
90
120
|
error.left ? renderBorder(props, error, "left") : null,
|
|
@@ -96,7 +126,7 @@ const ErrorBar = (props) => {
|
|
|
96
126
|
error.top ? renderCross(props, error, "top") : null,
|
|
97
127
|
].filter(Boolean);
|
|
98
128
|
return React.cloneElement(
|
|
99
|
-
|
|
129
|
+
groupComponent,
|
|
100
130
|
{ tabIndex, "aria-label": ariaLabel, ...userProps },
|
|
101
131
|
children,
|
|
102
132
|
);
|
|
@@ -128,5 +158,3 @@ ErrorBar.defaultProps = {
|
|
|
128
158
|
role: "presentation",
|
|
129
159
|
shapeRendering: "auto",
|
|
130
160
|
};
|
|
131
|
-
|
|
132
|
-
export default ErrorBar;
|
|
@@ -35,11 +35,10 @@ export const getData = (props) => {
|
|
|
35
35
|
const accessorTypes = ["x", "y", "errorX", "errorY"];
|
|
36
36
|
if (props.data) {
|
|
37
37
|
return Data.formatData(props.data, props, accessorTypes);
|
|
38
|
-
} else {
|
|
39
|
-
const generatedData =
|
|
40
|
-
props.errorX || props.errorY ? Data.generateData(props) : [];
|
|
41
|
-
return Data.formatData(generatedData, props, accessorTypes);
|
|
42
38
|
}
|
|
39
|
+
const generatedData =
|
|
40
|
+
props.errorX || props.errorY ? Data.generateData(props) : [];
|
|
41
|
+
return Data.formatData(generatedData, props, accessorTypes);
|
|
43
42
|
};
|
|
44
43
|
|
|
45
44
|
const getDomainFromData = (props, axis) => {
|
package/src/index.ts
ADDED
|
@@ -10,8 +10,17 @@ import {
|
|
|
10
10
|
DefaultTransitions,
|
|
11
11
|
CommonProps,
|
|
12
12
|
UserProps,
|
|
13
|
+
EventPropTypeInterface,
|
|
14
|
+
StringOrNumberOrCallback,
|
|
15
|
+
StringOrNumberOrList,
|
|
16
|
+
VictoryDatableProps,
|
|
17
|
+
VictoryCommonProps,
|
|
18
|
+
VictoryLabelableProps,
|
|
19
|
+
VictoryMultiLabelableProps,
|
|
20
|
+
VictoryStyleInterface,
|
|
21
|
+
EventsMixinClass,
|
|
13
22
|
} from "victory-core";
|
|
14
|
-
import ErrorBar from "./error-bar";
|
|
23
|
+
import { ErrorBar } from "./error-bar";
|
|
15
24
|
import { getBaseProps, getDomain, getData } from "./helper-methods";
|
|
16
25
|
|
|
17
26
|
const fallbackProps = {
|
|
@@ -27,7 +36,30 @@ const defaultData = [
|
|
|
27
36
|
{ x: 4, y: 4, errorX: 0.4, errorY: 0.4 },
|
|
28
37
|
];
|
|
29
38
|
|
|
30
|
-
|
|
39
|
+
export type VictoryErrorBarTTargetType = "data" | "labels" | "parent";
|
|
40
|
+
export type ErrorType =
|
|
41
|
+
| StringOrNumberOrList
|
|
42
|
+
| ((...args: any[]) => StringOrNumberOrList);
|
|
43
|
+
|
|
44
|
+
export interface VictoryErrorBarProps
|
|
45
|
+
extends Omit<VictoryCommonProps, "polar">,
|
|
46
|
+
VictoryDatableProps,
|
|
47
|
+
VictoryLabelableProps,
|
|
48
|
+
VictoryMultiLabelableProps {
|
|
49
|
+
borderWidth?: number;
|
|
50
|
+
errorX?: ErrorType;
|
|
51
|
+
errorY?: ErrorType;
|
|
52
|
+
events?: EventPropTypeInterface<
|
|
53
|
+
VictoryErrorBarTTargetType,
|
|
54
|
+
StringOrNumberOrCallback
|
|
55
|
+
>[];
|
|
56
|
+
style?: VictoryStyleInterface;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
60
|
+
interface VictoryErrorBarBase extends EventsMixinClass<VictoryErrorBarProps> {}
|
|
61
|
+
|
|
62
|
+
class VictoryErrorBarBase extends React.Component<VictoryErrorBarProps> {
|
|
31
63
|
static animationWhitelist = [
|
|
32
64
|
"data",
|
|
33
65
|
"domain",
|
|
@@ -115,4 +147,4 @@ class VictoryErrorBar extends React.Component {
|
|
|
115
147
|
}
|
|
116
148
|
}
|
|
117
149
|
|
|
118
|
-
export
|
|
150
|
+
export const VictoryErrorBar = addEvents(VictoryErrorBarBase);
|
package/src/index.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
EventPropTypeInterface,
|
|
4
|
-
StringOrNumberOrCallback,
|
|
5
|
-
StringOrNumberOrList,
|
|
6
|
-
VictoryDatableProps,
|
|
7
|
-
VictoryCommonProps,
|
|
8
|
-
VictoryCommonPrimitiveProps,
|
|
9
|
-
VictoryLabelableProps,
|
|
10
|
-
VictoryMultiLabelableProps,
|
|
11
|
-
VictoryStyleInterface,
|
|
12
|
-
} from "victory-core";
|
|
13
|
-
|
|
14
|
-
export type VictoryErrorBarTTargetType = "data" | "labels" | "parent";
|
|
15
|
-
export type ErrorType =
|
|
16
|
-
| StringOrNumberOrList
|
|
17
|
-
| ((...args: any[]) => StringOrNumberOrList);
|
|
18
|
-
|
|
19
|
-
export interface VictoryErrorBarProps
|
|
20
|
-
extends Omit<VictoryCommonProps, "polar">,
|
|
21
|
-
VictoryDatableProps,
|
|
22
|
-
VictoryLabelableProps,
|
|
23
|
-
VictoryMultiLabelableProps {
|
|
24
|
-
borderWidth?: number;
|
|
25
|
-
errorX?: ErrorType;
|
|
26
|
-
errorY?: ErrorType;
|
|
27
|
-
events?: EventPropTypeInterface<
|
|
28
|
-
VictoryErrorBarTTargetType,
|
|
29
|
-
StringOrNumberOrCallback
|
|
30
|
-
>[];
|
|
31
|
-
style?: VictoryStyleInterface;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export class VictoryErrorBar extends React.Component<
|
|
35
|
-
VictoryErrorBarProps,
|
|
36
|
-
any
|
|
37
|
-
> {}
|
|
38
|
-
|
|
39
|
-
export interface ErrorBarProps extends VictoryCommonPrimitiveProps {
|
|
40
|
-
borderWidth?: number;
|
|
41
|
-
datum?: any;
|
|
42
|
-
errorX?: number | any[] | boolean;
|
|
43
|
-
errorY?: number | any[] | boolean;
|
|
44
|
-
groupComponent?: React.ReactElement;
|
|
45
|
-
lineComponent?: React.ReactElement;
|
|
46
|
-
x?: number;
|
|
47
|
-
y?: number;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export class ErrorBar extends React.Component<ErrorBarProps, any> {}
|
package/src/index.js
DELETED