victory-cursor-container 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.
@@ -2,100 +2,135 @@ import _mapValues from "lodash/mapValues";
2
2
  import _isFunction from "lodash/isFunction";
3
3
  import _throttle from "lodash/throttle";
4
4
 
5
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
6
 
7
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
8
8
 
9
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
10
 
11
11
  import { Selection } from "victory-core";
12
12
  var ON_MOUSE_MOVE_THROTTLE_MS = 16;
13
- var CursorHelpers = {
14
- getDimension: function (props) {
15
- var horizontal = props.horizontal,
16
- cursorDimension = props.cursorDimension;
17
13
 
18
- if (!horizontal || !cursorDimension) {
19
- return cursorDimension;
20
- }
14
+ var CursorHelpersClass = /*#__PURE__*/function () {
15
+ function CursorHelpersClass() {
16
+ var _this = this;
21
17
 
22
- return cursorDimension === "x" ? "y" : "x";
23
- },
24
- withinBounds: function (point, bounds) {
25
- var _mapValues2 = _mapValues(bounds, Number),
26
- x1 = _mapValues2.x1,
27
- x2 = _mapValues2.x2,
28
- y1 = _mapValues2.y1,
29
- y2 = _mapValues2.y2;
30
-
31
- var _mapValues3 = _mapValues(point, Number),
32
- x = _mapValues3.x,
33
- y = _mapValues3.y;
34
-
35
- return x >= Math.min(x1, x2) && x <= Math.max(x1, x2) && y >= Math.min(y1, y2) && y <= Math.max(y1, y2);
36
- },
37
- onMouseMove: function (evt, targetProps) {
38
- var onCursorChange = targetProps.onCursorChange,
39
- domain = targetProps.domain;
40
- var cursorDimension = this.getDimension(targetProps);
41
- var parentSVG = targetProps.parentSVG || Selection.getParentSVG(evt);
42
- var cursorSVGPosition = Selection.getSVGEventCoordinates(evt, parentSVG);
43
- var cursorValue = Selection.getDataCoordinates(targetProps, targetProps.scale, cursorSVGPosition.x, cursorSVGPosition.y);
44
- var inBounds = this.withinBounds(cursorValue, {
45
- x1: domain.x[0],
46
- x2: domain.x[1],
47
- y1: domain.y[0],
48
- y2: domain.y[1]
49
- });
18
+ _classCallCheck(this, CursorHelpersClass);
50
19
 
51
- if (!inBounds) {
52
- cursorValue = null;
53
- }
20
+ this.handleMouseMove = function (evt, targetProps) {
21
+ var onCursorChange = targetProps.onCursorChange,
22
+ domain = targetProps.domain;
23
+
24
+ var cursorDimension = _this.getDimension(targetProps);
54
25
 
55
- if (_isFunction(onCursorChange)) {
56
- if (inBounds) {
57
- var value = cursorDimension ? cursorValue[cursorDimension] : cursorValue;
58
- onCursorChange(value, targetProps);
59
- } else if (cursorValue !== targetProps.cursorValue) {
60
- onCursorChange(targetProps.defaultCursorValue || null, targetProps);
26
+ var parentSVG = targetProps.parentSVG || Selection.getParentSVG(evt);
27
+ var cursorSVGPosition = Selection.getSVGEventCoordinates(evt, parentSVG);
28
+ var cursorValue = Selection.getDataCoordinates(targetProps, targetProps.scale, cursorSVGPosition.x, cursorSVGPosition.y);
29
+
30
+ var inBounds = _this.withinBounds(cursorValue, {
31
+ x1: domain.x[0],
32
+ x2: domain.x[1],
33
+ y1: domain.y[0],
34
+ y2: domain.y[1]
35
+ });
36
+
37
+ if (!inBounds) {
38
+ cursorValue = null;
61
39
  }
62
- }
63
40
 
64
- return [{
65
- target: "parent",
66
- eventKey: "parent",
67
- mutation: function () {
68
- return {
69
- cursorValue: cursorValue,
70
- parentSVG: parentSVG
71
- };
41
+ if (_isFunction(onCursorChange)) {
42
+ if (cursorValue) {
43
+ var value = cursorDimension ? cursorValue[cursorDimension] : cursorValue;
44
+ onCursorChange(value, targetProps);
45
+ } else if (cursorValue !== targetProps.cursorValue) {
46
+ onCursorChange(targetProps.defaultCursorValue || null, targetProps);
47
+ }
72
48
  }
73
- }];
74
- },
75
- onTouchEnd: function (evt, targetProps) {
76
- var onCursorChange = targetProps.onCursorChange;
77
49
 
78
- if (_isFunction(targetProps.onCursorChange)) {
79
- onCursorChange(null, targetProps);
80
- }
50
+ return [{
51
+ target: "parent",
52
+ eventKey: "parent",
53
+ mutation: function () {
54
+ return {
55
+ cursorValue: cursorValue,
56
+ parentSVG: parentSVG
57
+ };
58
+ }
59
+ }];
60
+ };
61
+
62
+ this.onMouseMove = _throttle(this.handleMouseMove, ON_MOUSE_MOVE_THROTTLE_MS, {
63
+ leading: true,
64
+ trailing: false
65
+ });
66
+ this.onMouseLeave = this.handleMouseMove;
81
67
 
82
- return [{
83
- target: "parent",
84
- eventKey: "parent",
85
- mutation: function () {
86
- return {
87
- cursorValue: null
88
- };
68
+ this.onTouchEnd = function (evt, targetProps) {
69
+ var onCursorChange = targetProps.onCursorChange;
70
+
71
+ if (_isFunction(targetProps.onCursorChange)) {
72
+ onCursorChange(null, targetProps);
89
73
  }
90
- }];
74
+
75
+ return [{
76
+ target: "parent",
77
+ eventKey: "parent",
78
+ mutation: function () {
79
+ return {
80
+ cursorValue: null
81
+ };
82
+ }
83
+ }];
84
+ };
91
85
  }
92
- };
93
- export default _objectSpread(_objectSpread({}, CursorHelpers), {}, {
94
- onMouseMove: _throttle(CursorHelpers.onMouseMove.bind(CursorHelpers), ON_MOUSE_MOVE_THROTTLE_MS, {
95
- leading: true,
96
- trailing: false
97
- }),
86
+
87
+ _createClass(CursorHelpersClass, [{
88
+ key: "getDimension",
89
+ value: function getDimension(props) {
90
+ var horizontal = props.horizontal,
91
+ cursorDimension = props.cursorDimension;
92
+
93
+ if (!horizontal || !cursorDimension) {
94
+ return cursorDimension;
95
+ }
96
+
97
+ return cursorDimension === "x" ? "y" : "x";
98
+ }
99
+ }, {
100
+ key: "withinBounds",
101
+ value: function withinBounds(point, bounds) {
102
+ var _mapValues2 = _mapValues(bounds, Number),
103
+ x1 = _mapValues2.x1,
104
+ x2 = _mapValues2.x2,
105
+ y1 = _mapValues2.y1,
106
+ y2 = _mapValues2.y2;
107
+
108
+ var _mapValues3 = _mapValues(point, Number),
109
+ x = _mapValues3.x,
110
+ y = _mapValues3.y;
111
+
112
+ return x >= Math.min(x1, x2) && x <= Math.max(x1, x2) && y >= Math.min(y1, y2) && y <= Math.max(y1, y2);
113
+ }
114
+ }]);
115
+
116
+ return CursorHelpersClass;
117
+ }();
118
+
119
+ export var CursorHelpers = new CursorHelpersClass();
120
+ /* {
121
+ ...CursorHelpers,
122
+ onMouseMove: throttle(
123
+ CursorHelpers.onMouseMove.bind(CursorHelpers),
124
+ ON_MOUSE_MOVE_THROTTLE_MS,
125
+ {
126
+ leading: true,
127
+ trailing: false,
128
+ },
129
+ ),
98
130
  onMouseLeave: CursorHelpers.onMouseMove.bind(CursorHelpers),
99
- onTouchEnd: CursorHelpers.onTouchEnd.bind(CursorHelpers)
100
- });
131
+ onTouchEnd: CursorHelpers.onTouchEnd.bind(CursorHelpers),
132
+ };
133
+
134
+
135
+ */
101
136
  //# sourceMappingURL=cursor-helpers.js.map
package/es/index.d.ts CHANGED
@@ -1,37 +1,3 @@
1
- import * as React from "react";
2
- import {
3
- VictoryContainerProps,
4
- CoordinatesPropType,
5
- CallbackArgs,
6
- } from "victory-core";
7
-
8
- export type CursorCoordinatesPropType = CoordinatesPropType | number;
9
-
10
- export interface VictoryCursorContainerProps extends VictoryContainerProps {
11
- cursorComponent?: React.ReactElement;
12
- cursorDimension?: "x" | "y";
13
- cursorLabel?: (point: CoordinatesPropType, args: CallbackArgs) => any | void;
14
- cursorLabelComponent?: React.ReactElement;
15
- cursorLabelOffset?: CursorCoordinatesPropType;
16
- defaultCursorValue?: CursorCoordinatesPropType;
17
- disable?: boolean;
18
- onCursorChange?: (
19
- value: CursorCoordinatesPropType,
20
- props: VictoryCursorContainerProps,
21
- ) => void;
22
- }
23
-
24
- export class VictoryCursorContainer extends React.Component<
25
- VictoryCursorContainerProps,
26
- any
27
- > {}
28
-
29
- export const CursorHelpers: {
30
- getDimension(props): any;
31
- withinBounds(point, bounds): any;
32
- onMouseMove(evt, targetProps): any;
33
- onMouseLeave(evt, targetProps): any;
34
- onTouchEnd(evt, targetProps): any;
35
- };
36
-
37
- export const cursorContainerMixin: (base: Function) => Function;
1
+ export * from "./cursor-helpers";
2
+ export * from "./victory-cursor-container";
3
+ //# sourceMappingURL=index.d.ts.map
package/es/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { cursorContainerMixin, default as VictoryCursorContainer } from "./victory-cursor-container";
2
- export { default as CursorHelpers } from "./cursor-helpers";
1
+ export * from "./cursor-helpers";
2
+ export * from "./victory-cursor-container";
3
3
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,221 @@
1
+ import PropTypes from "prop-types";
2
+ import React from "react";
3
+ import { VictoryContainer, VictoryContainerProps, CoordinatesPropType, VictoryLabelProps, ValueOrCallback } from "victory-core";
4
+ export declare type CursorCoordinatesPropType = CoordinatesPropType | number;
5
+ export interface VictoryCursorContainerProps extends VictoryContainerProps {
6
+ cursorComponent?: React.ReactElement;
7
+ cursorDimension?: "x" | "y";
8
+ cursorLabel?: ValueOrCallback<VictoryLabelProps["text"]>;
9
+ cursorLabelComponent?: React.ReactElement;
10
+ cursorLabelOffset?: CursorCoordinatesPropType;
11
+ defaultCursorValue?: CursorCoordinatesPropType;
12
+ disable?: boolean;
13
+ onCursorChange?: (value: CursorCoordinatesPropType, props: VictoryCursorContainerProps) => void;
14
+ }
15
+ declare type ComponentClass<TProps> = {
16
+ new (props: TProps): React.Component<TProps>;
17
+ };
18
+ export declare function cursorContainerMixin<TBase extends ComponentClass<TProps>, TProps extends VictoryCursorContainerProps>(Base: TBase): {
19
+ new (props: TProps): {
20
+ getCursorPosition(props: any): any;
21
+ getCursorLabelOffset(props: any): any;
22
+ getPadding(props: any): {
23
+ top: any;
24
+ bottom: any;
25
+ left: any;
26
+ right: any;
27
+ };
28
+ getCursorElements(props: any): React.ReactElement<any, string | React.JSXElementConstructor<any>>[];
29
+ getChildren(props: any): (string | number | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment)[];
30
+ context: unknown;
31
+ setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<TProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
32
+ forceUpdate(callback?: (() => void) | undefined): void;
33
+ render(): React.ReactNode;
34
+ readonly props: Readonly<TProps>;
35
+ state: Readonly<{}>;
36
+ refs: {
37
+ [key: string]: React.ReactInstance;
38
+ };
39
+ componentDidMount?(): void;
40
+ shouldComponentUpdate?(nextProps: Readonly<TProps>, nextState: Readonly<{}>, nextContext: any): boolean;
41
+ componentWillUnmount?(): void;
42
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
43
+ getSnapshotBeforeUpdate?(prevProps: Readonly<TProps>, prevState: Readonly<{}>): any;
44
+ componentDidUpdate?(prevProps: Readonly<TProps>, prevState: Readonly<{}>, snapshot?: any): void;
45
+ componentWillMount?(): void;
46
+ UNSAFE_componentWillMount?(): void;
47
+ componentWillReceiveProps?(nextProps: Readonly<TProps>, nextContext: any): void;
48
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<TProps>, nextContext: any): void;
49
+ componentWillUpdate?(nextProps: Readonly<TProps>, nextState: Readonly<{}>, nextContext: any): void;
50
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<TProps>, nextState: Readonly<{}>, nextContext: any): void;
51
+ };
52
+ displayName: string;
53
+ propTypes: {
54
+ cursorDimension: PropTypes.Requireable<string>;
55
+ cursorLabel: PropTypes.Requireable<(...args: any[]) => any>;
56
+ cursorLabelComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
57
+ cursorLabelOffset: PropTypes.Requireable<number | PropTypes.InferProps<{
58
+ x: PropTypes.Requireable<number>;
59
+ y: PropTypes.Requireable<number>;
60
+ }>>;
61
+ defaultCursorValue: PropTypes.Requireable<number | PropTypes.InferProps<{
62
+ x: PropTypes.Requireable<number>;
63
+ y: PropTypes.Requireable<number>;
64
+ }>>;
65
+ disable: PropTypes.Requireable<boolean>;
66
+ onCursorChange: PropTypes.Requireable<(...args: any[]) => any>;
67
+ "aria-describedby": PropTypes.Requireable<string>;
68
+ "aria-labelledby": PropTypes.Requireable<string>;
69
+ children: PropTypes.Requireable<string | number | boolean | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
70
+ className: PropTypes.Requireable<string>;
71
+ containerId: PropTypes.Requireable<string | number>;
72
+ containerRef: PropTypes.Requireable<(...args: any[]) => any>;
73
+ desc: PropTypes.Requireable<string>;
74
+ events: PropTypes.Requireable<object>;
75
+ height: PropTypes.Requireable<number | undefined>;
76
+ name: PropTypes.Requireable<string>;
77
+ origin: PropTypes.Requireable<PropTypes.InferProps<{
78
+ x: PropTypes.Requireable<number | undefined>;
79
+ y: PropTypes.Requireable<number | undefined>;
80
+ }>>;
81
+ ouiaId: PropTypes.Requireable<string | number>;
82
+ ouiaSafe: PropTypes.Requireable<boolean>;
83
+ ouiaType: PropTypes.Requireable<string>;
84
+ polar: PropTypes.Requireable<boolean>;
85
+ portalComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
86
+ portalZIndex: PropTypes.Requireable<number | undefined>;
87
+ preserveAspectRatio: PropTypes.Requireable<string>;
88
+ responsive: PropTypes.Requireable<boolean>;
89
+ role: PropTypes.Requireable<string>;
90
+ style: PropTypes.Requireable<object>;
91
+ tabIndex: PropTypes.Requireable<number>;
92
+ theme: PropTypes.Requireable<object>;
93
+ title: PropTypes.Requireable<string>;
94
+ width: PropTypes.Requireable<number | undefined>;
95
+ };
96
+ defaultProps: {
97
+ cursorLabelComponent: JSX.Element;
98
+ cursorLabelOffset: {
99
+ x: number;
100
+ y: number;
101
+ };
102
+ cursorComponent: JSX.Element;
103
+ className: string;
104
+ portalComponent: JSX.Element;
105
+ portalZIndex: number;
106
+ responsive: boolean;
107
+ role: string;
108
+ };
109
+ defaultEvents: (props: any) => {
110
+ target: string;
111
+ eventHandlers: {
112
+ onMouseLeave: (evt: any, targetProps: any) => {};
113
+ onTouchCancel: () => never[];
114
+ onMouseMove: (evt: any, targetProps: any) => {} | undefined;
115
+ onTouchMove: (evt: any, targetProps: any) => {} | undefined;
116
+ };
117
+ }[];
118
+ } & TBase;
119
+ export declare const VictoryCursorContainer: {
120
+ new (props: VictoryCursorContainerProps): {
121
+ getCursorPosition(props: any): any;
122
+ getCursorLabelOffset(props: any): any;
123
+ getPadding(props: any): {
124
+ top: any;
125
+ bottom: any;
126
+ left: any;
127
+ right: any;
128
+ };
129
+ getCursorElements(props: any): React.ReactElement<any, string | React.JSXElementConstructor<any>>[];
130
+ getChildren(props: any): (string | number | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment)[];
131
+ context: unknown;
132
+ setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<VictoryCursorContainerProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
133
+ forceUpdate(callback?: (() => void) | undefined): void;
134
+ render(): React.ReactNode;
135
+ readonly props: Readonly<VictoryCursorContainerProps>;
136
+ state: Readonly<{}>;
137
+ refs: {
138
+ [key: string]: React.ReactInstance;
139
+ };
140
+ componentDidMount?(): void;
141
+ shouldComponentUpdate?(nextProps: Readonly<VictoryCursorContainerProps>, nextState: Readonly<{}>, nextContext: any): boolean;
142
+ componentWillUnmount?(): void;
143
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
144
+ getSnapshotBeforeUpdate?(prevProps: Readonly<VictoryCursorContainerProps>, prevState: Readonly<{}>): any;
145
+ componentDidUpdate?(prevProps: Readonly<VictoryCursorContainerProps>, prevState: Readonly<{}>, snapshot?: any): void;
146
+ componentWillMount?(): void;
147
+ UNSAFE_componentWillMount?(): void;
148
+ componentWillReceiveProps?(nextProps: Readonly<VictoryCursorContainerProps>, nextContext: any): void;
149
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<VictoryCursorContainerProps>, nextContext: any): void;
150
+ componentWillUpdate?(nextProps: Readonly<VictoryCursorContainerProps>, nextState: Readonly<{}>, nextContext: any): void;
151
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<VictoryCursorContainerProps>, nextState: Readonly<{}>, nextContext: any): void;
152
+ };
153
+ displayName: string;
154
+ propTypes: {
155
+ cursorDimension: PropTypes.Requireable<string>;
156
+ cursorLabel: PropTypes.Requireable<(...args: any[]) => any>;
157
+ cursorLabelComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
158
+ cursorLabelOffset: PropTypes.Requireable<number | PropTypes.InferProps<{
159
+ x: PropTypes.Requireable<number>;
160
+ y: PropTypes.Requireable<number>;
161
+ }>>;
162
+ defaultCursorValue: PropTypes.Requireable<number | PropTypes.InferProps<{
163
+ x: PropTypes.Requireable<number>;
164
+ y: PropTypes.Requireable<number>;
165
+ }>>;
166
+ disable: PropTypes.Requireable<boolean>;
167
+ onCursorChange: PropTypes.Requireable<(...args: any[]) => any>;
168
+ "aria-describedby": PropTypes.Requireable<string>;
169
+ "aria-labelledby": PropTypes.Requireable<string>;
170
+ children: PropTypes.Requireable<string | number | boolean | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
171
+ className: PropTypes.Requireable<string>;
172
+ containerId: PropTypes.Requireable<string | number>;
173
+ containerRef: PropTypes.Requireable<(...args: any[]) => any>;
174
+ desc: PropTypes.Requireable<string>;
175
+ events: PropTypes.Requireable<object>;
176
+ height: PropTypes.Requireable<number | undefined>;
177
+ name: PropTypes.Requireable<string>;
178
+ origin: PropTypes.Requireable<PropTypes.InferProps<{
179
+ x: PropTypes.Requireable<number | undefined>;
180
+ y: PropTypes.Requireable<number | undefined>;
181
+ }>>;
182
+ ouiaId: PropTypes.Requireable<string | number>;
183
+ ouiaSafe: PropTypes.Requireable<boolean>;
184
+ ouiaType: PropTypes.Requireable<string>;
185
+ polar: PropTypes.Requireable<boolean>;
186
+ portalComponent: PropTypes.Requireable<PropTypes.ReactElementLike>;
187
+ portalZIndex: PropTypes.Requireable<number | undefined>;
188
+ preserveAspectRatio: PropTypes.Requireable<string>;
189
+ responsive: PropTypes.Requireable<boolean>;
190
+ role: PropTypes.Requireable<string>;
191
+ style: PropTypes.Requireable<object>;
192
+ tabIndex: PropTypes.Requireable<number>;
193
+ theme: PropTypes.Requireable<object>;
194
+ title: PropTypes.Requireable<string>;
195
+ width: PropTypes.Requireable<number | undefined>;
196
+ };
197
+ defaultProps: {
198
+ cursorLabelComponent: JSX.Element;
199
+ cursorLabelOffset: {
200
+ x: number;
201
+ y: number;
202
+ };
203
+ cursorComponent: JSX.Element;
204
+ className: string;
205
+ portalComponent: JSX.Element;
206
+ portalZIndex: number;
207
+ responsive: boolean;
208
+ role: string;
209
+ };
210
+ defaultEvents: (props: any) => {
211
+ target: string;
212
+ eventHandlers: {
213
+ onMouseLeave: (evt: any, targetProps: any) => {};
214
+ onTouchCancel: () => never[];
215
+ onMouseMove: (evt: any, targetProps: any) => {} | undefined;
216
+ onTouchMove: (evt: any, targetProps: any) => {} | undefined;
217
+ };
218
+ }[];
219
+ } & typeof VictoryContainer;
220
+ export {};
221
+ //# sourceMappingURL=victory-cursor-container.d.ts.map
@@ -43,12 +43,13 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
43
43
  import PropTypes from "prop-types";
44
44
  import React from "react";
45
45
  import { VictoryContainer, VictoryLabel, LineSegment, Helpers } from "victory-core";
46
- import CursorHelpers from "./cursor-helpers";
47
- export var cursorContainerMixin = function (base) {
46
+ import { CursorHelpers } from "./cursor-helpers";
47
+ export function cursorContainerMixin(Base) {
48
48
  var _class;
49
49
 
50
- return _class = /*#__PURE__*/function (_base) {
51
- _inherits(VictoryCursorContainer, _base);
50
+ // @ts-expect-error "TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'."
51
+ return _class = /*#__PURE__*/function (_Base) {
52
+ _inherits(VictoryCursorContainer, _Base);
52
53
 
53
54
  var _super = _createSuper(VictoryCursorContainer);
54
55
 
@@ -101,9 +102,9 @@ export var cursorContainerMixin = function (base) {
101
102
  return _isObject(c.props) && c.props.padding !== undefined;
102
103
  });
103
104
  return Helpers.getPadding(child.props);
104
- } else {
105
- return Helpers.getPadding(props);
106
105
  }
106
+
107
+ return Helpers.getPadding(props);
107
108
  }
108
109
  }, {
109
110
  key: "getCursorElements",
@@ -191,7 +192,7 @@ export var cursorContainerMixin = function (base) {
191
192
  }]);
192
193
 
193
194
  return VictoryCursorContainer;
194
- }(base), _class.displayName = "VictoryCursorContainer", _class.propTypes = _objectSpread(_objectSpread({}, VictoryContainer.propTypes), {}, {
195
+ }(Base), _class.displayName = "VictoryCursorContainer", _class.propTypes = _objectSpread(_objectSpread({}, VictoryContainer.propTypes), {}, {
195
196
  cursorDimension: PropTypes.oneOf(["x", "y"]),
196
197
  cursorLabel: PropTypes.func,
197
198
  cursorLabelComponent: PropTypes.element,
@@ -231,6 +232,6 @@ export var cursorContainerMixin = function (base) {
231
232
  }
232
233
  }];
233
234
  }, _class;
234
- };
235
- export default cursorContainerMixin(VictoryContainer);
235
+ }
236
+ export var VictoryCursorContainer = cursorContainerMixin(VictoryContainer);
236
237
  //# sourceMappingURL=victory-cursor-container.js.map
@@ -0,0 +1,33 @@
1
+ /// <reference types="lodash" />
2
+ import { Selection } from "victory-core";
3
+ declare class CursorHelpersClass {
4
+ getDimension(props: any): any;
5
+ withinBounds(point: any, bounds: any): boolean;
6
+ private handleMouseMove;
7
+ onMouseMove: import("lodash").DebouncedFunc<(evt: any, targetProps: any) => {
8
+ target: string;
9
+ eventKey: string;
10
+ mutation: () => {
11
+ cursorValue: Selection.SVGCoordinateType | null;
12
+ parentSVG: any;
13
+ };
14
+ }[]>;
15
+ onMouseLeave: (evt: any, targetProps: any) => {
16
+ target: string;
17
+ eventKey: string;
18
+ mutation: () => {
19
+ cursorValue: Selection.SVGCoordinateType | null;
20
+ parentSVG: any;
21
+ };
22
+ }[];
23
+ onTouchEnd: (evt: any, targetProps: any) => {
24
+ target: string;
25
+ eventKey: string;
26
+ mutation: () => {
27
+ cursorValue: null;
28
+ };
29
+ }[];
30
+ }
31
+ export declare const CursorHelpers: CursorHelpersClass;
32
+ export {};
33
+ //# sourceMappingURL=cursor-helpers.d.ts.map