victory-bar 37.3.0 → 37.3.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/es/bar.js CHANGED
@@ -43,9 +43,9 @@ const defaultProps = {
43
43
  role: "presentation",
44
44
  shapeRendering: "auto"
45
45
  };
46
-
46
+ export const Bar = /*#__PURE__*/forwardRef(
47
47
  // eslint-disable-next-line prefer-arrow-callback
48
- export const Bar = /*#__PURE__*/forwardRef(function Bar(initialProps, ref) {
48
+ function Bar(initialProps, ref) {
49
49
  const props = evaluateProps(_defaults({}, initialProps, defaultProps));
50
50
  const {
51
51
  polar,
@@ -62,7 +62,6 @@ export const circle = (center, radius) => ({
62
62
  // Left-most point is returned as 0th element of array
63
63
  // Right-most point is returned as 1st elemennt of array
64
64
  intersection(circle1) {
65
- // eslint-disable-line max-statements
66
65
  const P0 = this.center;
67
66
  const P1 = circle1.center;
68
67
  const r0 = this.radius;
@@ -107,8 +107,6 @@ const getVerticalBarPoints = (position, sign, cr) => {
107
107
  y0,
108
108
  y1
109
109
  } = position;
110
-
111
- // eslint-disable-next-line max-statements, max-len
112
110
  const getHalfPoints = side => {
113
111
  const isLeft = side === "Left";
114
112
  const signL = isLeft ? 1 : -1;
@@ -192,8 +190,6 @@ const getHorizontalBarPoints = (position, sign, cr) => {
192
190
  } = position;
193
191
  const x0 = position.x0 < position.x1 ? position.x0 : position.x1;
194
192
  const x1 = position.x0 < position.x1 ? position.x1 : position.x0;
195
-
196
- // eslint-disable-next-line max-statements, max-len
197
193
  const getHalfPoints = side => {
198
194
  const isTop = side === "top";
199
195
  const signL = isTop ? -1 : 1;
@@ -273,8 +269,6 @@ const getHorizontalBarPoints = (position, sign, cr) => {
273
269
  // eslint-disable-next-line no-magic-numbers
274
270
  bottomPoints[3], bottomPoints[2]];
275
271
  };
276
-
277
- // eslint-disable-next-line max-params
278
272
  export const getVerticalBarPath = (props, width, cornerRadius) => {
279
273
  const position = getPosition(props, width);
280
274
  const sign = position.y0 > position.y1 ? 1 : -1;
@@ -282,8 +276,6 @@ export const getVerticalBarPath = (props, width, cornerRadius) => {
282
276
  const points = getVerticalBarPoints(position, sign, cornerRadius);
283
277
  return mapPointsToPath(points, cornerRadius, direction);
284
278
  };
285
-
286
- // eslint-disable-next-line max-params
287
279
  export const getHorizontalBarPath = (props, width, cornerRadius) => {
288
280
  const position = getPosition(props, width);
289
281
  const sign = position.x0 < position.x1 ? 1 : -1;
@@ -341,8 +333,6 @@ export const getVerticalPolarBarPath = (props, cornerRadius) => {
341
333
  leftMiddle
342
334
  };
343
335
  };
344
-
345
- // eslint-disable-next-line max-statements
346
336
  const getTopPath = () => {
347
337
  const {
348
338
  topRight,
@@ -385,8 +375,6 @@ export const getVerticalPolarBarPath = (props, cornerRadius) => {
385
375
  coords: subCoords[i].split(",")
386
376
  }));
387
377
  };
388
-
389
- // eslint-disable-next-line max-statements
390
378
  const getBottomPath = () => {
391
379
  const {
392
380
  bottomRight,
@@ -12,7 +12,6 @@ export interface VictoryBarProps extends VictoryCommonProps, VictoryDatableProps
12
12
  events?: EventPropTypeInterface<VictoryBarTTargetType, number | string | number[] | string[]>[];
13
13
  eventKey?: StringOrNumberOrCallback;
14
14
  getPath?: (props: VictoryBarProps) => string;
15
- horizontal?: boolean;
16
15
  style?: VictoryStyleInterface;
17
16
  }
18
17
  interface VictoryBarBase extends EventsMixinClass<VictoryBarProps> {
@@ -113,7 +112,7 @@ export declare const VictoryBar: {
113
112
  UNSAFE_componentWillReceiveProps?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextContext: any): void;
114
113
  componentWillUpdate?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextState: Readonly<{}>, nextContext: any): void;
115
114
  UNSAFE_componentWillUpdate?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextState: Readonly<{}>, nextContext: any): void;
116
- componentEvents: import("victory-core/lib/victory-util/events").ComponentEvent[];
115
+ componentEvents: import("@/victory-core/lib/victory-util/events").ComponentEvent[];
117
116
  getSharedEventState: (key: string, value: string) => unknown;
118
117
  baseProps: Record<string, object>;
119
118
  dataKeys: string[];
package/es/victory-bar.js CHANGED
@@ -21,7 +21,7 @@ const defaultData = [{
21
21
  y: 4
22
22
  }];
23
23
 
24
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
24
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
25
25
 
26
26
  /**
27
27
  * Draw SVG bar charts with React. VictoryBar is a composable component, so it doesn"t include axes
package/lib/bar.js CHANGED
@@ -52,9 +52,9 @@ const defaultProps = {
52
52
  role: "presentation",
53
53
  shapeRendering: "auto"
54
54
  };
55
-
55
+ const Bar = exports.Bar = /*#__PURE__*/(0, _react.forwardRef)(
56
56
  // eslint-disable-next-line prefer-arrow-callback
57
- const Bar = exports.Bar = /*#__PURE__*/(0, _react.forwardRef)(function Bar(initialProps, ref) {
57
+ function Bar(initialProps, ref) {
58
58
  const props = evaluateProps((0, _defaults2.default)({}, initialProps, defaultProps));
59
59
  const {
60
60
  polar,
@@ -69,7 +69,6 @@ const circle = (center, radius) => ({
69
69
  // Left-most point is returned as 0th element of array
70
70
  // Right-most point is returned as 1st elemennt of array
71
71
  intersection(circle1) {
72
- // eslint-disable-line max-statements
73
72
  const P0 = this.center;
74
73
  const P1 = circle1.center;
75
74
  const r0 = this.radius;
@@ -116,8 +116,6 @@ const getVerticalBarPoints = (position, sign, cr) => {
116
116
  y0,
117
117
  y1
118
118
  } = position;
119
-
120
- // eslint-disable-next-line max-statements, max-len
121
119
  const getHalfPoints = side => {
122
120
  const isLeft = side === "Left";
123
121
  const signL = isLeft ? 1 : -1;
@@ -201,8 +199,6 @@ const getHorizontalBarPoints = (position, sign, cr) => {
201
199
  } = position;
202
200
  const x0 = position.x0 < position.x1 ? position.x0 : position.x1;
203
201
  const x1 = position.x0 < position.x1 ? position.x1 : position.x0;
204
-
205
- // eslint-disable-next-line max-statements, max-len
206
202
  const getHalfPoints = side => {
207
203
  const isTop = side === "top";
208
204
  const signL = isTop ? -1 : 1;
@@ -282,8 +278,6 @@ const getHorizontalBarPoints = (position, sign, cr) => {
282
278
  // eslint-disable-next-line no-magic-numbers
283
279
  bottomPoints[3], bottomPoints[2]];
284
280
  };
285
-
286
- // eslint-disable-next-line max-params
287
281
  const getVerticalBarPath = (props, width, cornerRadius) => {
288
282
  const position = getPosition(props, width);
289
283
  const sign = position.y0 > position.y1 ? 1 : -1;
@@ -291,8 +285,6 @@ const getVerticalBarPath = (props, width, cornerRadius) => {
291
285
  const points = getVerticalBarPoints(position, sign, cornerRadius);
292
286
  return mapPointsToPath(points, cornerRadius, direction);
293
287
  };
294
-
295
- // eslint-disable-next-line max-params
296
288
  exports.getVerticalBarPath = getVerticalBarPath;
297
289
  const getHorizontalBarPath = (props, width, cornerRadius) => {
298
290
  const position = getPosition(props, width);
@@ -352,8 +344,6 @@ const getVerticalPolarBarPath = (props, cornerRadius) => {
352
344
  leftMiddle
353
345
  };
354
346
  };
355
-
356
- // eslint-disable-next-line max-statements
357
347
  const getTopPath = () => {
358
348
  const {
359
349
  topRight,
@@ -396,8 +386,6 @@ const getVerticalPolarBarPath = (props, cornerRadius) => {
396
386
  coords: subCoords[i].split(",")
397
387
  }));
398
388
  };
399
-
400
- // eslint-disable-next-line max-statements
401
389
  const getBottomPath = () => {
402
390
  const {
403
391
  bottomRight,
@@ -12,7 +12,6 @@ export interface VictoryBarProps extends VictoryCommonProps, VictoryDatableProps
12
12
  events?: EventPropTypeInterface<VictoryBarTTargetType, number | string | number[] | string[]>[];
13
13
  eventKey?: StringOrNumberOrCallback;
14
14
  getPath?: (props: VictoryBarProps) => string;
15
- horizontal?: boolean;
16
15
  style?: VictoryStyleInterface;
17
16
  }
18
17
  interface VictoryBarBase extends EventsMixinClass<VictoryBarProps> {
@@ -113,7 +112,7 @@ export declare const VictoryBar: {
113
112
  UNSAFE_componentWillReceiveProps?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextContext: any): void;
114
113
  componentWillUpdate?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextState: Readonly<{}>, nextContext: any): void;
115
114
  UNSAFE_componentWillUpdate?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextState: Readonly<{}>, nextContext: any): void;
116
- componentEvents: import("victory-core/lib/victory-util/events").ComponentEvent[];
115
+ componentEvents: import("@/victory-core/lib/victory-util/events").ComponentEvent[];
117
116
  getSharedEventState: (key: string, value: string) => unknown;
118
117
  baseProps: Record<string, object>;
119
118
  dataKeys: string[];
@@ -28,7 +28,7 @@ const defaultData = [{
28
28
  y: 4
29
29
  }];
30
30
 
31
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
31
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
32
32
 
33
33
  /**
34
34
  * Draw SVG bar charts with React. VictoryBar is a composable component, so it doesn"t include axes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "victory-bar",
3
- "version": "37.3.0",
3
+ "version": "37.3.2",
4
4
  "description": "Bar Component for Victory",
5
5
  "keywords": [
6
6
  "data visualization",
@@ -21,8 +21,8 @@
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
23
  "lodash": "^4.17.19",
24
- "victory-core": "37.3.0",
25
- "victory-vendor": "37.3.0"
24
+ "victory-core": "37.3.2",
25
+ "victory-vendor": "37.3.2"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "react": ">=16.6.0"
@@ -217,11 +217,9 @@
217
217
  ]
218
218
  },
219
219
  "lint": {
220
- "command": "nps lint:pkg",
220
+ "command": "eslint src",
221
221
  "files": [
222
- "src/**",
223
- "../../.eslintignore",
224
- "../../.eslintrc.js"
222
+ "src/**"
225
223
  ],
226
224
  "output": [],
227
225
  "dependencies": [
@@ -236,11 +234,9 @@
236
234
  ]
237
235
  },
238
236
  "lint:fix": {
239
- "command": "pnpm run lint || nps lint:pkg:fix",
237
+ "command": "eslint --fix src",
240
238
  "files": [
241
- "src/**",
242
- "../../.eslintignore",
243
- "../../.eslintrc.js"
239
+ "src/**"
244
240
  ],
245
241
  "output": [],
246
242
  "dependencies": [
package/src/bar.tsx CHANGED
@@ -74,37 +74,36 @@ const defaultProps: Partial<BarProps> = {
74
74
  shapeRendering: "auto",
75
75
  };
76
76
 
77
- // eslint-disable-next-line prefer-arrow-callback
78
- export const Bar = forwardRef<SVGPathElement, BarProps>(function Bar(
79
- initialProps,
80
- ref,
81
- ) {
82
- const props = evaluateProps(defaults({}, initialProps, defaultProps));
83
- const { polar, origin, style, barWidth, cornerRadius } = props;
77
+ export const Bar = forwardRef<SVGPathElement, BarProps>(
78
+ // eslint-disable-next-line prefer-arrow-callback
79
+ function Bar(initialProps, ref) {
80
+ const props = evaluateProps(defaults({}, initialProps, defaultProps));
81
+ const { polar, origin, style, barWidth, cornerRadius } = props;
84
82
 
85
- const path = polar
86
- ? getPolarBarPath(props, cornerRadius)
87
- : getBarPath(props, barWidth, cornerRadius);
88
- const defaultTransform =
89
- polar && origin ? `translate(${origin.x}, ${origin.y})` : undefined;
83
+ const path = polar
84
+ ? getPolarBarPath(props, cornerRadius)
85
+ : getBarPath(props, barWidth, cornerRadius);
86
+ const defaultTransform =
87
+ polar && origin ? `translate(${origin.x}, ${origin.y})` : undefined;
90
88
 
91
- if (!props.pathComponent) {
92
- return null;
93
- }
89
+ if (!props.pathComponent) {
90
+ return null;
91
+ }
94
92
 
95
- return React.cloneElement(props.pathComponent, {
96
- ...props.events,
97
- "aria-label": props.ariaLabel,
98
- style,
99
- d: path,
100
- className: props.className,
101
- clipPath: props.clipPath,
102
- desc: props.desc,
103
- index: props.index,
104
- role: props.role,
105
- shapeRendering: props.shapeRendering,
106
- transform: props.transform || defaultTransform,
107
- tabIndex: props.tabIndex,
108
- ref,
109
- });
110
- });
93
+ return React.cloneElement(props.pathComponent, {
94
+ ...props.events,
95
+ "aria-label": props.ariaLabel,
96
+ style,
97
+ d: path,
98
+ className: props.className,
99
+ clipPath: props.clipPath,
100
+ desc: props.desc,
101
+ index: props.index,
102
+ role: props.role,
103
+ shapeRendering: props.shapeRendering,
104
+ transform: props.transform || defaultTransform,
105
+ tabIndex: props.tabIndex,
106
+ ref,
107
+ });
108
+ },
109
+ );
@@ -66,7 +66,6 @@ export const circle = (center: Center, radius: number) => ({
66
66
  // Left-most point is returned as 0th element of array
67
67
  // Right-most point is returned as 1st elemennt of array
68
68
  intersection(circle1: { center: Center; radius: number }) {
69
- // eslint-disable-line max-statements
70
69
  const P0 = this.center;
71
70
  const P1 = circle1.center;
72
71
  const r0 = this.radius;
@@ -119,7 +119,6 @@ const mapPointsToPath = (coords, cornerRadius, direction) => {
119
119
  const getVerticalBarPoints = (position, sign, cr) => {
120
120
  const { x0, x1, y0, y1 } = position;
121
121
 
122
- // eslint-disable-next-line max-statements, max-len
123
122
  const getHalfPoints = (side) => {
124
123
  const isLeft = side === "Left";
125
124
  const signL = isLeft ? 1 : -1;
@@ -177,7 +176,6 @@ const getHorizontalBarPoints = (position, sign, cr) => {
177
176
  const x0 = position.x0 < position.x1 ? position.x0 : position.x1;
178
177
  const x1 = position.x0 < position.x1 ? position.x1 : position.x0;
179
178
 
180
- // eslint-disable-next-line max-statements, max-len
181
179
  const getHalfPoints = (side) => {
182
180
  const isTop = side === "top";
183
181
  const signL = isTop ? -1 : 1;
@@ -234,7 +232,6 @@ const getHorizontalBarPoints = (position, sign, cr) => {
234
232
  ];
235
233
  };
236
234
 
237
- // eslint-disable-next-line max-params
238
235
  export const getVerticalBarPath = (props, width, cornerRadius) => {
239
236
  const position = getPosition(props, width);
240
237
 
@@ -244,7 +241,6 @@ export const getVerticalBarPath = (props, width, cornerRadius) => {
244
241
  return mapPointsToPath(points, cornerRadius, direction);
245
242
  };
246
243
 
247
- // eslint-disable-next-line max-params
248
244
  export const getHorizontalBarPath = (props, width, cornerRadius) => {
249
245
  const position = getPosition(props, width);
250
246
 
@@ -310,7 +306,6 @@ export const getVerticalPolarBarPath = (props: BarProps, cornerRadius) => {
310
306
  };
311
307
  };
312
308
 
313
- // eslint-disable-next-line max-statements
314
309
  const getTopPath = () => {
315
310
  const { topRight, topLeft } = cornerRadius;
316
311
  const arcLength = r2 * Math.abs(end - start);
@@ -360,7 +355,6 @@ export const getVerticalPolarBarPath = (props: BarProps, cornerRadius) => {
360
355
  }));
361
356
  };
362
357
 
363
- // eslint-disable-next-line max-statements
364
358
  const getBottomPath = () => {
365
359
  const { bottomRight, bottomLeft } = cornerRadius;
366
360
  const arcLength = r1 * Math.abs(end - start);
@@ -50,7 +50,6 @@ export interface VictoryBarProps
50
50
  >[];
51
51
  eventKey?: StringOrNumberOrCallback;
52
52
  getPath?: (props: VictoryBarProps) => string;
53
- horizontal?: boolean;
54
53
  style?: VictoryStyleInterface;
55
54
  }
56
55
 
@@ -67,7 +66,7 @@ const defaultData = [
67
66
  { x: 4, y: 4 },
68
67
  ];
69
68
 
70
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
69
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
71
70
  interface VictoryBarBase extends EventsMixinClass<VictoryBarProps> {}
72
71
 
73
72
  /**