victory-tooltip 37.3.1 → 37.3.3

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.
@@ -4,12 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.VictoryTooltip = void 0;
7
- var _orderBy2 = _interopRequireDefault(require("lodash/orderBy"));
8
- var _isPlainObject2 = _interopRequireDefault(require("lodash/isPlainObject"));
9
- var _uniqueId2 = _interopRequireDefault(require("lodash/uniqueId"));
10
- var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
11
7
  var _react = _interopRequireDefault(require("react"));
12
8
  var _victoryCore = require("victory-core");
9
+ var _defaults = _interopRequireDefault(require("lodash/defaults"));
10
+ var _uniqueId = _interopRequireDefault(require("lodash/uniqueId"));
11
+ var _isPlainObject = _interopRequireDefault(require("lodash/isPlainObject"));
12
+ var _orderBy = _interopRequireDefault(require("lodash/orderBy"));
13
13
  var _flyout = require("./flyout");
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
  const fallbackProps = {
@@ -74,7 +74,7 @@ class VictoryTooltip extends _react.default.Component {
74
74
  }
75
75
  constructor(props) {
76
76
  super(props);
77
- this.id = props.id === undefined ? (0, _uniqueId2.default)("tooltip-") : props.id;
77
+ this.id = props.id === undefined ? (0, _uniqueId.default)("tooltip-") : props.id;
78
78
  }
79
79
  getDefaultOrientation(props) {
80
80
  const {
@@ -115,9 +115,9 @@ class VictoryTooltip extends _react.default.Component {
115
115
  getStyles(props) {
116
116
  const theme = props.theme || _victoryCore.VictoryTheme.grayscale;
117
117
  const defaultLabelStyles = theme && theme.tooltip && theme.tooltip.style ? theme.tooltip.style : {};
118
- const baseLabelStyle = Array.isArray(props.style) ? props.style.map(s => (0, _defaults2.default)({}, s, defaultLabelStyles)) : (0, _defaults2.default)({}, props.style, defaultLabelStyles);
118
+ const baseLabelStyle = Array.isArray(props.style) ? props.style.map(s => (0, _defaults.default)({}, s, defaultLabelStyles)) : (0, _defaults.default)({}, props.style, defaultLabelStyles);
119
119
  const defaultFlyoutStyles = theme && theme.tooltip && theme.tooltip.flyoutStyle ? theme.tooltip.flyoutStyle : {};
120
- const baseFlyoutStyle = props.flyoutStyle ? (0, _defaults2.default)({}, props.flyoutStyle, defaultFlyoutStyles) : defaultFlyoutStyles;
120
+ const baseFlyoutStyle = props.flyoutStyle ? (0, _defaults.default)({}, props.flyoutStyle, defaultFlyoutStyles) : defaultFlyoutStyles;
121
121
  const style = Array.isArray(baseLabelStyle) ? baseLabelStyle.map(s => _victoryCore.Helpers.evaluateStyle(s, props)) : _victoryCore.Helpers.evaluateStyle(baseLabelStyle, props);
122
122
  const flyoutStyle = _victoryCore.Helpers.evaluateStyle(baseFlyoutStyle, Object.assign({}, props, {
123
123
  style
@@ -164,9 +164,7 @@ class VictoryTooltip extends _react.default.Component {
164
164
  flyoutStyle,
165
165
  orientation
166
166
  })) || this.getLabelPadding(style);
167
- const flyoutPadding = _victoryCore.Helpers.getPadding({
168
- padding
169
- });
167
+ const flyoutPadding = _victoryCore.Helpers.getPadding(padding);
170
168
  const pointerWidth = _victoryCore.Helpers.evaluateProp(props.pointerWidth, Object.assign({}, props, {
171
169
  active,
172
170
  text,
@@ -207,8 +205,8 @@ class VictoryTooltip extends _react.default.Component {
207
205
  pointerWidth,
208
206
  pointerLength
209
207
  });
210
- const offsetX = (0, _isPlainObject2.default)(centerOffset) && centerOffset?.x !== undefined ? _victoryCore.Helpers.evaluateProp(centerOffset.x, evaluatedProps) : 0;
211
- const offsetY = (0, _isPlainObject2.default)(centerOffset) && centerOffset?.y !== undefined ? _victoryCore.Helpers.evaluateProp(centerOffset.y, evaluatedProps) : 0;
208
+ const offsetX = (0, _isPlainObject.default)(centerOffset) && centerOffset?.x !== undefined ? _victoryCore.Helpers.evaluateProp(centerOffset.x, evaluatedProps) : 0;
209
+ const offsetY = (0, _isPlainObject.default)(centerOffset) && centerOffset?.y !== undefined ? _victoryCore.Helpers.evaluateProp(centerOffset.y, evaluatedProps) : 0;
212
210
  return {
213
211
  ...evaluatedProps,
214
212
  centerOffset: {
@@ -303,8 +301,6 @@ class VictoryTooltip extends _react.default.Component {
303
301
  y: Math.round(y + adjustments.y[0] - adjustments.y[1])
304
302
  };
305
303
  }
306
-
307
- // eslint-disable-next-line complexity
308
304
  getFlyoutCenter(props, dimensions) {
309
305
  const {
310
306
  x,
@@ -327,8 +323,8 @@ class VictoryTooltip extends _react.default.Component {
327
323
  y: orientation === "top" || orientation === "bottom" ? y - ySign * (pointerLength + height / 2 - ySign * dy) : y + dy
328
324
  };
329
325
  const center = {
330
- x: (0, _isPlainObject2.default)(props.center) && props.center.x !== undefined ? props.center.x : flyoutCenter.x,
331
- y: (0, _isPlainObject2.default)(props.center) && props.center.y !== undefined ? props.center.y : flyoutCenter.y
326
+ x: (0, _isPlainObject.default)(props.center) && props.center.x !== undefined ? props.center.x : flyoutCenter.x,
327
+ y: (0, _isPlainObject.default)(props.center) && props.center.y !== undefined ? props.center.y : flyoutCenter.y
332
328
  };
333
329
  const centerWithOffset = {
334
330
  x: center.x + centerOffset.x,
@@ -392,7 +388,7 @@ class VictoryTooltip extends _react.default.Component {
392
388
  const sign = textAnchor === "end" ? -1 : 1;
393
389
  return flyoutCenter.x - sign * (labelSize.width / 2);
394
390
  };
395
- return (0, _defaults2.default)({}, labelComponent.props, {
391
+ return (0, _defaults.default)({}, labelComponent.props, {
396
392
  key: `${this.id}-label-${index}`,
397
393
  text,
398
394
  datum,
@@ -427,7 +423,7 @@ class VictoryTooltip extends _react.default.Component {
427
423
  side: "left",
428
424
  val: edges.left > point.x ? edges.left - point.x : -1
429
425
  }];
430
- return (0, _orderBy2.default)(gaps, "val", "desc")[0].side;
426
+ return (0, _orderBy.default)(gaps, "val", "desc")[0].side;
431
427
  }
432
428
  getFlyoutProps(props, calculatedValues) {
433
429
  const {
@@ -450,7 +446,7 @@ class VictoryTooltip extends _react.default.Component {
450
446
  flyoutComponent
451
447
  } = props;
452
448
  const pointerOrientation = _victoryCore.Helpers.evaluateProp(props.pointerOrientation, props);
453
- return (0, _defaults2.default)({}, flyoutComponent.props, {
449
+ return (0, _defaults.default)({}, flyoutComponent.props, {
454
450
  x,
455
451
  y,
456
452
  dx,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "victory-tooltip",
3
- "version": "37.3.1",
3
+ "version": "37.3.3",
4
4
  "description": "Tooltip Component for Victory",
5
5
  "keywords": [
6
6
  "data visualization",
@@ -21,7 +21,7 @@
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
23
  "lodash": "^4.17.19",
24
- "victory-core": "37.3.1"
24
+ "victory-core": "37.3.3"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "react": ">=16.6.0"
@@ -180,38 +180,10 @@
180
180
  "pnpm-lock.yaml"
181
181
  ]
182
182
  },
183
- "format": {
184
- "command": "nps format:pkg",
185
- "files": [
186
- "src/**",
187
- "*.json",
188
- "../../.prettierignore",
189
- "../../.prettierrc.json"
190
- ],
191
- "output": [],
192
- "packageLocks": [
193
- "pnpm-lock.yaml"
194
- ]
195
- },
196
- "format:fix": {
197
- "command": "pnpm run format || nps format:pkg:fix",
198
- "files": [
199
- "src/**",
200
- "*.json",
201
- "../../.prettierignore",
202
- "../../.prettierrc.json"
203
- ],
204
- "output": [],
205
- "packageLocks": [
206
- "pnpm-lock.yaml"
207
- ]
208
- },
209
183
  "lint": {
210
- "command": "nps lint:pkg",
184
+ "command": "eslint src",
211
185
  "files": [
212
- "src/**",
213
- "../../.eslintignore",
214
- "../../.eslintrc.js"
186
+ "src/**"
215
187
  ],
216
188
  "output": [],
217
189
  "dependencies": [
@@ -224,11 +196,9 @@
224
196
  ]
225
197
  },
226
198
  "lint:fix": {
227
- "command": "pnpm run lint || nps lint:pkg:fix",
199
+ "command": "eslint --fix src",
228
200
  "files": [
229
- "src/**",
230
- "../../.eslintignore",
231
- "../../.eslintrc.js"
201
+ "src/**"
232
202
  ],
233
203
  "output": [],
234
204
  "dependencies": [
@@ -272,8 +242,6 @@
272
242
  "check": "wireit",
273
243
  "types:check": "wireit",
274
244
  "types:create": "wireit",
275
- "format": "wireit",
276
- "format:fix": "wireit",
277
245
  "lint": "wireit",
278
246
  "lint:fix": "wireit",
279
247
  "jest": "wireit"
package/src/flyout.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { defaults } from "lodash";
2
+ import defaults from "lodash/defaults";
3
3
 
4
4
  import {
5
5
  Helpers,
@@ -73,8 +73,8 @@ const getVerticalPath = (props: FlyoutPathProps) => {
73
73
  const arc = `${cornerRadius} ${cornerRadius} ${direction}`;
74
74
  return `M ${centerX - pointerWidth / 2}, ${pointerEdge}
75
75
  L ${pointerLength ? x : centerX + pointerWidth / 2}, ${
76
- pointerLength ? y : pointerEdge
77
- }
76
+ pointerLength ? y : pointerEdge
77
+ }
78
78
  L ${centerX + pointerWidth / 2}, ${pointerEdge}
79
79
  L ${rightEdge - cornerRadius}, ${pointerEdge}
80
80
  A ${arc} ${rightEdge}, ${pointerEdge - sign * cornerRadius}
@@ -104,8 +104,8 @@ const getHorizontalPath = (props: FlyoutPathProps) => {
104
104
  const arc = `${cornerRadius} ${cornerRadius} ${direction}`;
105
105
  return `M ${pointerEdge}, ${centerY - pointerWidth / 2}
106
106
  L ${pointerLength ? x : pointerEdge}, ${
107
- pointerLength ? y : centerY + pointerWidth / 2
108
- }
107
+ pointerLength ? y : centerY + pointerWidth / 2
108
+ }
109
109
  L ${pointerEdge}, ${centerY + pointerWidth / 2}
110
110
  L ${pointerEdge}, ${bottomEdge - cornerRadius}
111
111
  A ${arc} ${pointerEdge + sign * cornerRadius}, ${bottomEdge}
@@ -15,7 +15,11 @@ import {
15
15
  OrientationTypes,
16
16
  VictoryThemeDefinition,
17
17
  } from "victory-core";
18
- import { defaults, uniqueId, isPlainObject, orderBy } from "lodash";
18
+
19
+ import defaults from "lodash/defaults";
20
+ import uniqueId from "lodash/uniqueId";
21
+ import isPlainObject from "lodash/isPlainObject";
22
+ import orderBy from "lodash/orderBy";
19
23
 
20
24
  import { Flyout } from "./flyout";
21
25
 
@@ -240,7 +244,7 @@ export class VictoryTooltip extends React.Component<VictoryTooltipProps> {
240
244
  }),
241
245
  ) || this.getLabelPadding(style);
242
246
 
243
- const flyoutPadding = Helpers.getPadding({ padding });
247
+ const flyoutPadding = Helpers.getPadding(padding);
244
248
 
245
249
  const pointerWidth = Helpers.evaluateProp(
246
250
  props.pointerWidth,
@@ -389,7 +393,6 @@ export class VictoryTooltip extends React.Component<VictoryTooltipProps> {
389
393
  };
390
394
  }
391
395
 
392
- // eslint-disable-next-line complexity
393
396
  getFlyoutCenter(props, dimensions) {
394
397
  const {
395
398
  x,