victory-errorbar 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.
@@ -0,0 +1,153 @@
1
+ import PropTypes from "prop-types";
2
+ import React from "react";
3
+ import { EventPropTypeInterface, StringOrNumberOrCallback, StringOrNumberOrList, VictoryDatableProps, VictoryCommonProps, VictoryLabelableProps, VictoryMultiLabelableProps, VictoryStyleInterface, EventsMixinClass } from "victory-core";
4
+ export declare type VictoryErrorBarTTargetType = "data" | "labels" | "parent";
5
+ export declare type ErrorType = StringOrNumberOrList | ((...args: any[]) => StringOrNumberOrList);
6
+ export interface VictoryErrorBarProps extends Omit<VictoryCommonProps, "polar">, VictoryDatableProps, VictoryLabelableProps, VictoryMultiLabelableProps {
7
+ borderWidth?: number;
8
+ errorX?: ErrorType;
9
+ errorY?: ErrorType;
10
+ events?: EventPropTypeInterface<VictoryErrorBarTTargetType, StringOrNumberOrCallback>[];
11
+ style?: VictoryStyleInterface;
12
+ }
13
+ interface VictoryErrorBarBase extends EventsMixinClass<VictoryErrorBarProps> {
14
+ }
15
+ declare class VictoryErrorBarBase extends React.Component<VictoryErrorBarProps> {
16
+ static animationWhitelist: string[];
17
+ static displayName: string;
18
+ static role: string;
19
+ static defaultTransitions: import("victory-core").AnimatePropTypeInterface;
20
+ static propTypes: {
21
+ borderWidth: PropTypes.Requireable<number>;
22
+ errorX: PropTypes.Requireable<string | number | ((...args: any[]) => any) | (string | null | undefined)[]>;
23
+ errorY: PropTypes.Requireable<string | number | ((...args: any[]) => any) | (string | null | undefined)[]>;
24
+ horizontal: PropTypes.Requireable<boolean>;
25
+ categories?: React.Validator<import("victory-core").CategoryPropType | null | undefined> | undefined;
26
+ data?: React.Validator<readonly any[] | null | undefined> | undefined;
27
+ dataComponent?: React.Validator<React.ReactElement<any, string | React.JSXElementConstructor<any>> | null | undefined> | undefined;
28
+ domain?: React.Validator<import("victory-core").ForAxes<import("victory-core").DomainTuple> | null | undefined> | undefined;
29
+ domainPadding?: React.Validator<import("victory-core").ForAxes<import("victory-core").PaddingType> | null | undefined> | undefined;
30
+ samples?: React.Validator<number | null | undefined> | undefined;
31
+ sortKey?: React.Validator<import("victory-core").DataGetterPropType | null | undefined> | undefined;
32
+ sortOrder?: React.Validator<import("victory-core").SortOrderPropType | null | undefined> | undefined;
33
+ x?: React.Validator<import("victory-core").DataGetterPropType | null | undefined> | undefined;
34
+ y?: React.Validator<import("victory-core").DataGetterPropType | null | undefined> | undefined;
35
+ y0?: React.Validator<import("victory-core").DataGetterPropType | null | undefined> | undefined;
36
+ theme?: React.Validator<import("victory-core").VictoryThemeDefinition | null | undefined> | undefined;
37
+ animate?: React.Validator<boolean | import("victory-core").AnimatePropTypeInterface | null | undefined> | undefined;
38
+ colorScale?: React.Validator<import("victory-core").ColorScalePropType | null | undefined> | undefined;
39
+ containerComponent?: React.Validator<React.ReactElement<any, string | React.JSXElementConstructor<any>> | null | undefined> | undefined;
40
+ externalEventMutations?: React.Validator<import("victory-core").EventCallbackInterface<string | string[], StringOrNumberOrList>[] | null | undefined> | undefined;
41
+ groupComponent?: React.Validator<React.ReactElement<any, string | React.JSXElementConstructor<any>> | null | undefined> | undefined;
42
+ height?: React.Validator<number | null | undefined> | undefined;
43
+ maxDomain?: React.Validator<number | {
44
+ x?: number | undefined;
45
+ y?: number | undefined;
46
+ } | null | undefined> | undefined;
47
+ minDomain?: React.Validator<number | {
48
+ x?: number | undefined;
49
+ y?: number | undefined;
50
+ } | null | undefined> | undefined;
51
+ name?: React.Validator<string | null | undefined> | undefined;
52
+ origin?: React.Validator<import("victory-core").OriginType | null | undefined> | undefined;
53
+ padding?: React.Validator<import("victory-core").PaddingProps | null | undefined> | undefined;
54
+ polar?: React.Validator<boolean | null | undefined> | undefined;
55
+ range?: React.Validator<import("victory-core").ForAxes<import("victory-core").RangeTuple> | null | undefined> | undefined;
56
+ scale?: React.Validator<import("victory-core").D3Scale<any> | import("victory-core").ScaleName | {
57
+ x?: import("victory-core").D3Scale<any> | import("victory-core").ScaleName | undefined;
58
+ y?: import("victory-core").D3Scale<any> | import("victory-core").ScaleName | undefined;
59
+ } | null | undefined> | undefined;
60
+ sharedEvents?: React.Validator<{
61
+ events: any[];
62
+ getEventState: Function;
63
+ } | null | undefined> | undefined;
64
+ singleQuadrantDomainPadding?: React.Validator<boolean | {
65
+ x?: boolean | undefined;
66
+ y?: boolean | undefined;
67
+ } | null | undefined> | undefined;
68
+ standalone?: React.Validator<boolean | null | undefined> | undefined;
69
+ width?: React.Validator<number | null | undefined> | undefined;
70
+ };
71
+ static defaultProps: {
72
+ containerComponent: JSX.Element;
73
+ data: {
74
+ x: number;
75
+ y: number;
76
+ errorX: number;
77
+ errorY: number;
78
+ }[];
79
+ dataComponent: JSX.Element;
80
+ labelComponent: JSX.Element;
81
+ groupComponent: JSX.Element;
82
+ samples: number;
83
+ sortOrder: string;
84
+ standalone: boolean;
85
+ theme: import("victory-core").VictoryThemeDefinition;
86
+ };
87
+ static getDomain: (props: any, axis: any) => any;
88
+ static getData: (props: any) => any;
89
+ static getBaseProps: (props: any) => any;
90
+ static expectedComponents: string[];
91
+ shouldAnimate(): boolean;
92
+ render(): React.ReactElement;
93
+ }
94
+ export declare const VictoryErrorBar: {
95
+ new (props: import("victory-core").EventMixinCommonProps): {
96
+ state: {};
97
+ getEventState: (eventKey: string | number, namespace: string, childType?: string | undefined) => any;
98
+ getScopedEvents: (events: any, namespace: any, childType: any, baseProps: any) => {};
99
+ getEvents: (p: any, target: any, eventKey: any) => any;
100
+ externalMutations: {} | undefined;
101
+ calculatedState: {};
102
+ globalEvents: {};
103
+ prevGlobalEventKeys: string[];
104
+ boundGlobalEvents: {};
105
+ shouldComponentUpdate(nextProps: import("victory-core").EventMixinCommonProps): boolean;
106
+ componentDidMount(): void;
107
+ componentDidUpdate(prevProps: any): void;
108
+ componentWillUnmount(): void;
109
+ addGlobalListener(key: any): void;
110
+ removeGlobalListener(key: any): void;
111
+ getStateChanges(props: any): {};
112
+ applyExternalMutations(props: any, externalMutations: any): void;
113
+ getCalculatedValues(props: any): import("victory-core").EventMixinCalculatedValues;
114
+ getExternalMutations(props: import("victory-core").EventMixinCommonProps): {} | undefined;
115
+ cacheValues(obj: any): void;
116
+ getBaseProps(props: any, getSharedEventState: any): Record<string, object>;
117
+ getAllEvents(props: any): any;
118
+ getComponentProps(component: any, type: any, index: any): any;
119
+ renderContainer(component: any, children: any): React.DetailedReactHTMLElement<any, HTMLElement>;
120
+ animateComponent(props: import("victory-core").EventMixinCommonProps, defaultAnimationWhitelist: string[]): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
121
+ renderContinuousData(props: import("victory-core").EventMixinCommonProps): React.DetailedReactHTMLElement<any, HTMLElement>;
122
+ renderData(props: any, shouldRenderDatum?: ((datum: any) => boolean) | undefined): React.DetailedReactHTMLElement<any, HTMLElement>;
123
+ context: unknown;
124
+ setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<import("victory-core").EventMixinCommonProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
125
+ forceUpdate(callback?: (() => void) | undefined): void;
126
+ render(): React.ReactNode;
127
+ readonly props: Readonly<import("victory-core").EventMixinCommonProps>;
128
+ refs: {
129
+ [key: string]: React.ReactInstance;
130
+ };
131
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
132
+ getSnapshotBeforeUpdate?(prevProps: Readonly<import("victory-core").EventMixinCommonProps>, prevState: Readonly<{}>): any;
133
+ componentWillMount?(): void;
134
+ UNSAFE_componentWillMount?(): void;
135
+ componentWillReceiveProps?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextContext: any): void;
136
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextContext: any): void;
137
+ componentWillUpdate?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextState: Readonly<{}>, nextContext: any): void;
138
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextState: Readonly<{}>, nextContext: any): void;
139
+ componentEvents: import("victory-core/lib/victory-util/events").ComponentEvent[];
140
+ getSharedEventState: (key: string, value: string) => unknown;
141
+ baseProps: Record<string, object>;
142
+ dataKeys: string[];
143
+ hasEvents: unknown;
144
+ events: unknown;
145
+ };
146
+ getBaseProps?(props: import("victory-core").EventMixinCommonProps): Record<string, object>;
147
+ role?: string | undefined;
148
+ expectedComponents?: string[] | undefined;
149
+ getChildren?: ((props: import("victory-core").EventMixinCommonProps, childComponents?: React.ReactNode[] | undefined, calculatedProps?: import("victory-core").EventMixinCommonProps | undefined) => void) | undefined;
150
+ animationWhitelist?: string[] | undefined;
151
+ } & typeof VictoryErrorBarBase;
152
+ export {};
153
+ //# sourceMappingURL=victory-errorbar.d.ts.map
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.VictoryErrorBar = void 0;
7
7
 
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
 
@@ -11,7 +11,7 @@ var _react = _interopRequireDefault(require("react"));
11
11
 
12
12
  var _victoryCore = require("victory-core");
13
13
 
14
- var _errorBar = _interopRequireDefault(require("./error-bar"));
14
+ var _errorBar = require("./error-bar");
15
15
 
16
16
  var _helperMethods = require("./helper-methods");
17
17
 
@@ -70,18 +70,18 @@ var defaultData = [{
70
70
  errorY: 0.4
71
71
  }];
72
72
 
73
- var VictoryErrorBar = /*#__PURE__*/function (_React$Component) {
74
- _inherits(VictoryErrorBar, _React$Component);
73
+ var VictoryErrorBarBase = /*#__PURE__*/function (_React$Component) {
74
+ _inherits(VictoryErrorBarBase, _React$Component);
75
75
 
76
- var _super = _createSuper(VictoryErrorBar);
76
+ var _super = _createSuper(VictoryErrorBarBase);
77
77
 
78
- function VictoryErrorBar() {
79
- _classCallCheck(this, VictoryErrorBar);
78
+ function VictoryErrorBarBase() {
79
+ _classCallCheck(this, VictoryErrorBarBase);
80
80
 
81
81
  return _super.apply(this, arguments);
82
82
  }
83
83
 
84
- _createClass(VictoryErrorBar, [{
84
+ _createClass(VictoryErrorBarBase, [{
85
85
  key: "shouldAnimate",
86
86
  value: // Overridden in native versions
87
87
  function shouldAnimate() {
@@ -105,23 +105,23 @@ var VictoryErrorBar = /*#__PURE__*/function (_React$Component) {
105
105
  }
106
106
  }]);
107
107
 
108
- return VictoryErrorBar;
108
+ return VictoryErrorBarBase;
109
109
  }(_react.default.Component);
110
110
 
111
- VictoryErrorBar.animationWhitelist = ["data", "domain", "height", "padding", "samples", "style", "width", "errorX", "errorY", "borderWidth"];
112
- VictoryErrorBar.displayName = "VictoryErrorBar";
113
- VictoryErrorBar.role = "errorbar";
114
- VictoryErrorBar.defaultTransitions = _victoryCore.DefaultTransitions.discreteTransitions();
115
- VictoryErrorBar.propTypes = _objectSpread(_objectSpread(_objectSpread({}, _victoryCore.CommonProps.baseProps), _victoryCore.CommonProps.dataProps), {}, {
111
+ VictoryErrorBarBase.animationWhitelist = ["data", "domain", "height", "padding", "samples", "style", "width", "errorX", "errorY", "borderWidth"];
112
+ VictoryErrorBarBase.displayName = "VictoryErrorBar";
113
+ VictoryErrorBarBase.role = "errorbar";
114
+ VictoryErrorBarBase.defaultTransitions = _victoryCore.DefaultTransitions.discreteTransitions();
115
+ VictoryErrorBarBase.propTypes = _objectSpread(_objectSpread(_objectSpread({}, _victoryCore.CommonProps.baseProps), _victoryCore.CommonProps.dataProps), {}, {
116
116
  borderWidth: _propTypes.default.number,
117
117
  errorX: _propTypes.default.oneOfType([_propTypes.default.func, _victoryCore.PropTypes.allOfType([_victoryCore.PropTypes.integer, _victoryCore.PropTypes.nonNegative]), _propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]),
118
118
  errorY: _propTypes.default.oneOfType([_propTypes.default.func, _victoryCore.PropTypes.allOfType([_victoryCore.PropTypes.integer, _victoryCore.PropTypes.nonNegative]), _propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]),
119
119
  horizontal: _propTypes.default.bool
120
120
  });
121
- VictoryErrorBar.defaultProps = {
121
+ VictoryErrorBarBase.defaultProps = {
122
122
  containerComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryContainer, null),
123
123
  data: defaultData,
124
- dataComponent: /*#__PURE__*/_react.default.createElement(_errorBar.default, null),
124
+ dataComponent: /*#__PURE__*/_react.default.createElement(_errorBar.ErrorBar, null),
125
125
  labelComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryLabel, null),
126
126
  groupComponent: /*#__PURE__*/_react.default.createElement("g", {
127
127
  role: "presentation"
@@ -131,16 +131,14 @@ VictoryErrorBar.defaultProps = {
131
131
  standalone: true,
132
132
  theme: _victoryCore.VictoryTheme.grayscale
133
133
  };
134
- VictoryErrorBar.getDomain = _helperMethods.getDomain;
135
- VictoryErrorBar.getData = _helperMethods.getData;
134
+ VictoryErrorBarBase.getDomain = _helperMethods.getDomain;
135
+ VictoryErrorBarBase.getData = _helperMethods.getData;
136
136
 
137
- VictoryErrorBar.getBaseProps = function (props) {
137
+ VictoryErrorBarBase.getBaseProps = function (props) {
138
138
  return (0, _helperMethods.getBaseProps)(props, fallbackProps);
139
139
  };
140
140
 
141
- VictoryErrorBar.expectedComponents = ["dataComponent", "labelComponent", "groupComponent", "containerComponent"];
142
-
143
- var _default = (0, _victoryCore.addEvents)(VictoryErrorBar);
144
-
145
- exports.default = _default;
141
+ VictoryErrorBarBase.expectedComponents = ["dataComponent", "labelComponent", "groupComponent", "containerComponent"];
142
+ var VictoryErrorBar = (0, _victoryCore.addEvents)(VictoryErrorBarBase);
143
+ exports.VictoryErrorBar = VictoryErrorBar;
146
144
  //# sourceMappingURL=victory-errorbar.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "victory-errorbar",
3
- "version": "36.5.3",
3
+ "version": "36.6.2",
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,253 @@
21
22
  "dependencies": {
22
23
  "lodash": "^4.17.19",
23
24
  "prop-types": "^15.8.1",
24
- "victory-core": "^36.5.3"
25
+ "victory-core": "^36.6.2"
25
26
  },
26
27
  "peerDependencies": {
27
28
  "react": ">=16.6.0"
28
29
  },
29
- "scripts": {
30
- "version": "yarn run nps build-libs && nps build-dists"
30
+ "devDependencies": {
31
+ "victory-errorbar": "*"
31
32
  },
32
- "sideEffects": false,
33
- "gitHead": "55338af3c57eacca5956e53c08a58e47ba41d01e"
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
+ "check": {
130
+ "dependencies": [
131
+ "types:check",
132
+ "jest",
133
+ "format",
134
+ "lint"
135
+ ]
136
+ },
137
+ "types:check": {
138
+ "command": "nps types:pkg:check",
139
+ "files": [
140
+ "src/**/*.{ts,tsx}",
141
+ "../../tsconfig.base.json",
142
+ "tsconfig.json"
143
+ ],
144
+ "dependencies": [
145
+ "types:create",
146
+ "../victory-core:types:create",
147
+ "../victory-vendor:types:create",
148
+ "../victory-voronoi:types:create"
149
+ ],
150
+ "output": [],
151
+ "packageLocks": [
152
+ "pnpm-lock.yaml"
153
+ ]
154
+ },
155
+ "types:create": {
156
+ "command": "nps types:pkg:create",
157
+ "files": [
158
+ "src/**",
159
+ "!src/**/*.test.*",
160
+ "../../tsconfig.base.json",
161
+ "tsconfig.build.json"
162
+ ],
163
+ "output": [
164
+ "es/**/*.d.ts",
165
+ "es/**/*.d.ts.map",
166
+ "lib/**/*.d.ts",
167
+ "lib/**/*.d.ts.map"
168
+ ],
169
+ "dependencies": [
170
+ "../victory-core: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
+ "format:fix": {
190
+ "command": "pnpm run format || nps format:pkg:fix",
191
+ "files": [
192
+ "src/**",
193
+ "*.json",
194
+ "../../.prettierignore",
195
+ "../../.prettierrc.json"
196
+ ],
197
+ "output": [],
198
+ "packageLocks": [
199
+ "pnpm-lock.yaml"
200
+ ]
201
+ },
202
+ "lint": {
203
+ "command": "nps lint:pkg",
204
+ "files": [
205
+ "src/**",
206
+ "../../.eslintignore",
207
+ "../../.eslintrc.js"
208
+ ],
209
+ "output": [],
210
+ "dependencies": [
211
+ "../victory-core:types:create",
212
+ "../victory-vendor:types:create",
213
+ "../victory-voronoi:types:create"
214
+ ],
215
+ "packageLocks": [
216
+ "pnpm-lock.yaml"
217
+ ]
218
+ },
219
+ "lint:fix": {
220
+ "command": "pnpm run lint || nps lint:pkg:fix",
221
+ "files": [
222
+ "src/**",
223
+ "../../.eslintignore",
224
+ "../../.eslintrc.js"
225
+ ],
226
+ "output": [],
227
+ "dependencies": [
228
+ "../victory-core:types:create",
229
+ "../victory-vendor:types:create",
230
+ "../victory-voronoi:types:create"
231
+ ],
232
+ "packageLocks": [
233
+ "pnpm-lock.yaml"
234
+ ]
235
+ },
236
+ "jest": {
237
+ "command": "nps jest:pkg",
238
+ "files": [
239
+ "src/**/*.test.*",
240
+ "../../.babelrc.js",
241
+ "../../test/jest-config.js",
242
+ "../../test/jest-setup.ts"
243
+ ],
244
+ "output": [],
245
+ "dependencies": [
246
+ "build:lib:cjs",
247
+ "../victory-vendor:build:lib:cjs",
248
+ "../victory-voronoi:build:lib:cjs"
249
+ ],
250
+ "packageLocks": [
251
+ "pnpm-lock.yaml"
252
+ ]
253
+ }
254
+ },
255
+ "scripts": {
256
+ "### THESE SCRIPTS ARE GENERATED ###": "true",
257
+ "### DO NOT MODIFY THESE MANUALLY ###": "true",
258
+ "build": "wireit",
259
+ "build:lib": "wireit",
260
+ "build:lib:esm": "wireit",
261
+ "build:lib:cjs": "wireit",
262
+ "build:dist": "wireit",
263
+ "build:dist:dev": "wireit",
264
+ "build:dist:min": "wireit",
265
+ "check": "wireit",
266
+ "types:check": "wireit",
267
+ "types:create": "wireit",
268
+ "format": "wireit",
269
+ "format:fix": "wireit",
270
+ "lint": "wireit",
271
+ "lint:fix": "wireit",
272
+ "jest": "wireit"
273
+ }
274
+ }
@@ -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 { Helpers, CommonProps, Line, UserProps } from "victory-core";
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
- const ErrorBar = (props) => {
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
- props.groupComponent,
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
@@ -0,0 +1,2 @@
1
+ export * from "./victory-errorbar";
2
+ export * from "./error-bar";
@@ -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
- class VictoryErrorBar extends React.Component {
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",
@@ -97,7 +129,7 @@ class VictoryErrorBar extends React.Component {
97
129
  return !!this.props.animate;
98
130
  }
99
131
 
100
- render() {
132
+ render(): React.ReactElement {
101
133
  const { animationWhitelist, role } = VictoryErrorBar;
102
134
  const props = Helpers.modifyProps(this.props, fallbackProps, role);
103
135
 
@@ -115,4 +147,4 @@ class VictoryErrorBar extends React.Component {
115
147
  }
116
148
  }
117
149
 
118
- export default addEvents(VictoryErrorBar);
150
+ export const VictoryErrorBar = addEvents(VictoryErrorBarBase);