victory-core 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.
Files changed (56) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/victory-core.js +13 -34
  3. package/dist/victory-core.min.js +1 -1
  4. package/es/victory-animation/util.js +1 -1
  5. package/es/victory-container/victory-container.js +3 -3
  6. package/es/victory-theme/types.d.ts +2 -1
  7. package/es/victory-transition/victory-transition.js +1 -1
  8. package/es/victory-util/add-events.js +1 -1
  9. package/es/victory-util/axis.js +1 -1
  10. package/es/victory-util/data.js +0 -4
  11. package/es/victory-util/domain.js +0 -3
  12. package/es/victory-util/events.d.ts +1 -1
  13. package/es/victory-util/events.js +3 -9
  14. package/es/victory-util/helpers.js +0 -1
  15. package/es/victory-util/label-helpers.js +0 -1
  16. package/es/victory-util/merge-refs.d.ts +1 -1
  17. package/es/victory-util/scale.js +0 -1
  18. package/es/victory-util/transitions.js +3 -7
  19. package/es/victory-util/type-helpers.js +1 -1
  20. package/es/victory-util/wrapper.js +0 -1
  21. package/lib/victory-animation/util.js +1 -1
  22. package/lib/victory-container/victory-container.js +3 -3
  23. package/lib/victory-theme/types.d.ts +2 -1
  24. package/lib/victory-transition/victory-transition.js +1 -1
  25. package/lib/victory-util/add-events.js +1 -1
  26. package/lib/victory-util/axis.js +1 -1
  27. package/lib/victory-util/data.js +0 -5
  28. package/lib/victory-util/domain.js +0 -4
  29. package/lib/victory-util/events.d.ts +1 -1
  30. package/lib/victory-util/events.js +3 -10
  31. package/lib/victory-util/helpers.js +0 -2
  32. package/lib/victory-util/label-helpers.js +0 -2
  33. package/lib/victory-util/merge-refs.d.ts +1 -1
  34. package/lib/victory-util/scale.js +0 -2
  35. package/lib/victory-util/transitions.js +3 -7
  36. package/lib/victory-util/type-helpers.js +1 -1
  37. package/lib/victory-util/wrapper.js +0 -1
  38. package/package.json +6 -10
  39. package/src/victory-animation/util.ts +1 -1
  40. package/src/victory-container/victory-container.tsx +3 -3
  41. package/src/victory-primitives/point.tsx +2 -2
  42. package/src/victory-theme/types.ts +2 -1
  43. package/src/victory-transition/victory-transition.tsx +1 -1
  44. package/src/victory-util/add-events.tsx +1 -1
  45. package/src/victory-util/axis.tsx +1 -1
  46. package/src/victory-util/common-props.tsx +3 -3
  47. package/src/victory-util/data.ts +0 -3
  48. package/src/victory-util/domain.ts +0 -2
  49. package/src/victory-util/events.ts +14 -12
  50. package/src/victory-util/helpers.ts +0 -1
  51. package/src/victory-util/label-helpers.ts +0 -1
  52. package/src/victory-util/merge-refs.ts +2 -0
  53. package/src/victory-util/scale.ts +0 -1
  54. package/src/victory-util/transitions.ts +3 -5
  55. package/src/victory-util/type-helpers.ts +1 -1
  56. package/src/victory-util/wrapper.tsx +1 -2
@@ -155,9 +155,9 @@ export const VictoryContainer = (initialProps: VictoryContainerProps) => {
155
155
  ...style,
156
156
  width: responsive ? style?.width : dimensions.width,
157
157
  height: responsive ? style?.height : dimensions.height,
158
- pointerEvents: "none",
159
- touchAction: "none",
160
- position: "relative",
158
+ pointerEvents: style?.pointerEvents ?? "none",
159
+ touchAction: style?.touchAction ?? "none",
160
+ position: style?.position ?? "relative",
161
161
  }}
162
162
  data-ouia-component-id={ouiaId}
163
163
  data-ouia-component-type={ouiaType}
@@ -12,9 +12,9 @@ export interface PointProps extends VictoryCommonPrimitiveProps {
12
12
  datum?: any;
13
13
  getPath?: (x: number, y: number, size: number) => string;
14
14
  pathComponent?: React.ReactElement;
15
- // eslint-disable-next-line @typescript-eslint/ban-types
15
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
16
16
  size?: number | Function;
17
- // eslint-disable-next-line @typescript-eslint/ban-types
17
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
18
18
  symbol?: ScatterSymbolType | Function;
19
19
  x?: number;
20
20
  y?: number;
@@ -9,6 +9,7 @@ import {
9
9
  PaddingOrCallback,
10
10
  StringOrNumberOrCallback,
11
11
  } from "../types/callbacks";
12
+ import { DomainPropType } from "../types/prop-types";
12
13
 
13
14
  export type BlockProps = {
14
15
  top?: number;
@@ -49,7 +50,7 @@ export interface VictoryAxisCommonProps {
49
50
  axisLabelComponent?: React.ReactElement;
50
51
  axisValue?: number | string | object | Date;
51
52
  dependentAxis?: boolean;
52
- disableInlineStyles?: boolean;
53
+ domain?: DomainPropType;
53
54
  gridComponent?: React.ReactElement;
54
55
  invertAxis?: boolean;
55
56
  style?: {
@@ -66,7 +66,7 @@ export class VictoryTransition extends React.Component<
66
66
  }
67
67
 
68
68
  componentDidMount() {
69
- this.setState({ nodesShouldLoad: true }); // eslint-disable-line react/no-did-mount-set-state
69
+ this.setState({ nodesShouldLoad: true });
70
70
  }
71
71
 
72
72
  shouldComponentUpdate(nextProps: VictoryTransitionProps) {
@@ -127,7 +127,7 @@ export function addEvents<
127
127
  TBase extends WrappedComponentClass<TProps>,
128
128
  TProps extends EventMixinCommonProps,
129
129
  >(WrappedComponent: TBase, options: MixinOptions = {}) {
130
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
130
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
131
131
  interface AddEventsMixin extends EventMixinCalculatedValues {}
132
132
 
133
133
  // @ts-expect-error "TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'."
@@ -313,7 +313,7 @@ export function getTicks(props, scale: D3Scale, filterZero = false) {
313
313
  * @param {String} axis: either x or y
314
314
  * @returns {Array} returns a domain from tickValues
315
315
  */
316
- // eslint-disable-next-line max-statements
316
+
317
317
  function getDomainFromData(props, axis) {
318
318
  const { polar, startAngle = 0, endAngle = 360 } = props;
319
319
  const tickArray = getTickArray(props);
@@ -57,7 +57,7 @@ export interface VictoryCommonThemeProps {
57
57
  x?: ScalePropType | D3Scale;
58
58
  y?: ScalePropType | D3Scale;
59
59
  };
60
- // eslint-disable-next-line @typescript-eslint/ban-types
60
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
61
61
  sharedEvents?: { events: any[]; getEventState: Function };
62
62
  singleQuadrantDomainPadding?: boolean | { x?: boolean; y?: boolean };
63
63
  standalone?: boolean;
@@ -72,11 +72,11 @@ export interface VictoryCommonPrimitiveProps {
72
72
  className?: string;
73
73
  clipPath?: string;
74
74
  data?: any;
75
- // eslint-disable-next-line @typescript-eslint/ban-types
75
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
76
76
  desc?: string | Function;
77
77
  disableInlineStyles?: boolean;
78
78
  events?: object;
79
- // eslint-disable-next-line @typescript-eslint/ban-types
79
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
80
80
  id?: number | string | Function;
81
81
  index?: number | string;
82
82
  origin?: OriginType;
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-use-before-define */
2
1
  import React from "react";
3
2
  import {
4
3
  uniq,
@@ -141,7 +140,6 @@ export function formatDataFromDomain(dataset, domain, defaultBaseline?) {
141
140
  const isOverMaxX = overMax(maxDomainX);
142
141
  const isOverMaxY = overMax(maxDomainY);
143
142
 
144
- // eslint-disable-next-line complexity
145
143
  return dataset.map((datum) => {
146
144
  let { _x, _y, _y0, _y1 } = datum;
147
145
 
@@ -283,7 +281,6 @@ export function formatData(
283
281
  const data = preformattedData
284
282
  ? dataset
285
283
  : dataset.reduce((dataArr, datum, index) => {
286
- // eslint-disable-line complexity
287
284
  const parsedDatum = parseDatum(datum);
288
285
  const fallbackValues = { x: index, y: parsedDatum };
289
286
  const processedValues = expectedKeys!.reduce((memo, type) => {
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-use-before-define */
2
1
  import React from "react";
3
2
  import { isPlainObject, sortedUniq, isDate } from "lodash";
4
3
  import * as Data from "./data";
@@ -67,7 +66,6 @@ function getExtremeFromData(dataset, axis, type = "min") {
67
66
  return containsDate ? new Date(result) : result;
68
67
  }
69
68
 
70
- // eslint-disable-next-line max-statements
71
69
  function padDomain(domain, props, axis) {
72
70
  if (!props.domainPadding) {
73
71
  return domain;
@@ -1,4 +1,5 @@
1
- /* eslint-disable no-use-before-define */
1
+ import React from "react";
2
+
2
3
  import { isEmpty, pickBy, omitBy, uniq } from "lodash";
3
4
  import type { EventMixinCalculatedValues } from "./add-events";
4
5
  import { isFunction } from "./helpers";
@@ -72,9 +73,12 @@ export function getEvents(
72
73
  const selectedEvents = getSelectedEvents();
73
74
  return (
74
75
  Array.isArray(selectedEvents) &&
75
- selectedEvents.reduce((memo, event) => {
76
- return event ? Object.assign(memo, event.eventHandlers) : memo;
77
- }, {} as ComponentEvent["eventHandlers"])
76
+ selectedEvents.reduce(
77
+ (memo, event) => {
78
+ return event ? Object.assign(memo, event.eventHandlers) : memo;
79
+ },
80
+ {} as ComponentEvent["eventHandlers"],
81
+ )
78
82
  );
79
83
  };
80
84
 
@@ -84,13 +88,13 @@ export function getEvents(
84
88
  */
85
89
  const getAllEvents = () => {
86
90
  // Mandatory usage: `getEvents.bind(this)`
87
- /* eslint-disable no-invalid-this */
91
+
88
92
  if (Array.isArray(this.componentEvents)) {
89
93
  return Array.isArray(props.events)
90
94
  ? this.componentEvents.concat(...props.events)
91
95
  : this.componentEvents;
92
96
  }
93
- /* eslint-enable no-invalid-this */
97
+
94
98
  return props.events;
95
99
  };
96
100
 
@@ -127,12 +131,12 @@ export function getScopedEvents(
127
131
  }
128
132
 
129
133
  // Mandatory usage: `getScopedEvents.bind(this)`
130
- // eslint-disable-next-line no-invalid-this
134
+
131
135
  const newBaseProps = baseProps || this.baseProps;
132
136
  // returns the original base props or base state of a given target element
133
137
  const getTargetProps = (identifier, type) => {
134
138
  const { childName, target, key } = identifier;
135
- // eslint-disable-next-line no-invalid-this
139
+
136
140
  const baseType = type === "props" ? newBaseProps : this.state || {};
137
141
  const base =
138
142
  childName === undefined || childName === null || !baseType[childName]
@@ -173,7 +177,6 @@ export function getScopedEvents(
173
177
 
174
178
  // returns the state object with mutated props applied for a single key
175
179
  const getMutationObject = (key, childName) => {
176
- // eslint-disable-next-line no-invalid-this
177
180
  const baseState = this.state || {};
178
181
  if (!isFunction(eventReturn.mutation)) {
179
182
  return baseState;
@@ -270,11 +273,10 @@ export function getScopedEvents(
270
273
  // into a state mutation, and calls setState
271
274
  // eslint-disable-next-line max-params
272
275
  const onEvent = (evt, childProps, eventKey, eventName) => {
273
- // eslint-disable-next-line no-invalid-this
274
276
  const eventReturn = events[eventName](evt, childProps, eventKey, this);
275
277
  if (!isEmpty(eventReturn)) {
276
278
  const callbacks = compileCallbacks(eventReturn);
277
- // eslint-disable-next-line no-invalid-this
279
+
278
280
  this.setState(parseEventReturn(eventReturn, eventKey), callbacks);
279
281
  }
280
282
  };
@@ -319,7 +321,7 @@ export function getEventState(
319
321
  childType?: string,
320
322
  ) {
321
323
  // Mandatory usage: `getEventState.bind(this)`
322
- // eslint-disable-next-line no-invalid-this
324
+
323
325
  const state = this.state || {};
324
326
  if (!childType) {
325
327
  return eventKey === "parent"
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-use-before-define */
2
1
  import React, { isValidElement } from "react";
3
2
  import { defaults, property, pick } from "lodash";
4
3
  import { CallbackArgs } from "../types/callbacks";
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-use-before-define */
2
1
  import { VictoryLabelProps } from "../victory-label/victory-label";
3
2
  import * as Helpers from "./helpers";
4
3
  import { defaults } from "lodash";
@@ -1,3 +1,5 @@
1
+ import React from "react";
2
+
1
3
  import * as Helpers from "./helpers";
2
4
 
3
5
  type Ref<T> = React.MutableRefObject<T> | React.LegacyRef<T> | undefined | null;
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-use-before-define */
2
1
  import { isPlainObject } from "lodash";
3
2
  import * as Helpers from "./helpers";
4
3
  import * as Collection from "./collection";
@@ -156,7 +156,6 @@ function getChildBeforeLoad(animate, child, data, cb): TransitionProps {
156
156
  return { animate: newAnimate, data: newData, clipWidth: 0 };
157
157
  }
158
158
 
159
- // eslint-disable-next-line max-params
160
159
  function getChildOnLoad(animate, data, cb): TransitionProps {
161
160
  const newAnimate = Object.assign({}, animate, { onEnd: cb });
162
161
  let newData = data;
@@ -174,7 +173,7 @@ function getChildOnLoad(animate, data, cb): TransitionProps {
174
173
  return { animate: newAnimate, data: newData };
175
174
  }
176
175
 
177
- // eslint-disable-next-line max-params, max-len
176
+ // eslint-disable-next-line max-params
178
177
  function getChildPropsOnExit(
179
178
  animate,
180
179
  child,
@@ -208,7 +207,7 @@ function getChildPropsOnExit(
208
207
  return { animate: newAnimate, data: newData };
209
208
  }
210
209
 
211
- // eslint-disable-next-line max-params,max-len
210
+ // eslint-disable-next-line max-params
212
211
  function getChildPropsBeforeEnter(
213
212
  animate,
214
213
  child,
@@ -240,7 +239,7 @@ function getChildPropsBeforeEnter(
240
239
  return { animate: newAnimate, data: newData };
241
240
  }
242
241
 
243
- // eslint-disable-next-line max-params, max-len
242
+ // eslint-disable-next-line max-params
244
243
  function getChildPropsOnEnter(
245
244
  animate,
246
245
  data,
@@ -357,7 +356,6 @@ export function getTransitionPropsFactory(props, state, setState) {
357
356
  return {};
358
357
  };
359
358
 
360
- // eslint-disable-next-line max-statements, complexity, max-len
361
359
  return function getTransitionProps(child, index): TransitionProps {
362
360
  const data = getChildData(child) || [];
363
361
  const animate: AnimatePropTypeInterface = defaults(
@@ -30,7 +30,7 @@ export function getValueForAxis<T = unknown>(
30
30
  return value;
31
31
  }
32
32
 
33
- // eslint-disable-next-line @typescript-eslint/ban-types
33
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
34
34
  export function isFunction<T = Function>(func?: unknown): func is T {
35
35
  return typeof func === "function";
36
36
  }
@@ -1,4 +1,4 @@
1
- import { defaults, uniq, groupBy, uniqBy, isPlainObject } from "lodash";
1
+ import { defaults, uniq, groupBy, uniqBy } from "lodash";
2
2
  import React from "react";
3
3
  import * as Axis from "./axis";
4
4
  import * as Style from "./style";
@@ -188,7 +188,6 @@ export function getDefaultDomainPadding(props, axis, childComponents) {
188
188
  }
189
189
 
190
190
  export function getDomainFromChildren(props, axis, childComponents) {
191
- // eslint-disable-line max-statements, complexity, max-len
192
191
  const children = childComponents
193
192
  ? childComponents.slice(0)
194
193
  : React.Children.toArray(props.children);