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.
- package/CHANGELOG.md +10 -0
- package/dist/victory-tooltip.js +186 -146
- package/dist/victory-tooltip.min.js +1 -1
- package/es/flyout.js +2 -2
- package/es/victory-tooltip.d.ts +2 -2
- package/es/victory-tooltip.js +15 -19
- package/lib/flyout.js +2 -2
- package/lib/victory-tooltip.d.ts +2 -2
- package/lib/victory-tooltip.js +15 -19
- package/package.json +6 -38
- package/src/flyout.tsx +5 -5
- package/src/victory-tooltip.tsx +6 -3
package/dist/victory-tooltip.js
CHANGED
|
@@ -22,10 +22,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
22
22
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
23
23
|
/* harmony export */ "Flyout": function() { return /* binding */ Flyout; }
|
|
24
24
|
/* harmony export */ });
|
|
25
|
-
/* harmony import */ var
|
|
26
|
-
/* harmony import */ var
|
|
27
|
-
/* harmony import */ var
|
|
28
|
-
/* harmony import */ var
|
|
25
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
26
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
27
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
|
|
28
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
|
|
29
29
|
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/helpers.js");
|
|
30
30
|
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-primitives/path.js");
|
|
31
31
|
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/user-props.js");
|
|
@@ -119,12 +119,12 @@ const evaluateProps = props => {
|
|
|
119
119
|
};
|
|
120
120
|
};
|
|
121
121
|
const defaultProps = {
|
|
122
|
-
pathComponent: /*#__PURE__*/
|
|
122
|
+
pathComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_3__.Path, null),
|
|
123
123
|
role: "presentation",
|
|
124
124
|
shapeRendering: "auto"
|
|
125
125
|
};
|
|
126
126
|
const Flyout = initialProps => {
|
|
127
|
-
const props = evaluateProps(
|
|
127
|
+
const props = evaluateProps(lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, initialProps, defaultProps));
|
|
128
128
|
const userProps = victory_core__WEBPACK_IMPORTED_MODULE_4__.getSafeUserProps(props);
|
|
129
129
|
|
|
130
130
|
// check for required props for this subcomponent
|
|
@@ -149,7 +149,7 @@ const Flyout = initialProps => {
|
|
|
149
149
|
x: props.x,
|
|
150
150
|
y: props.y
|
|
151
151
|
};
|
|
152
|
-
return /*#__PURE__*/
|
|
152
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(props.pathComponent, {
|
|
153
153
|
...props.events,
|
|
154
154
|
...userProps,
|
|
155
155
|
style: props.style,
|
|
@@ -175,22 +175,22 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
175
175
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
176
176
|
/* harmony export */ "VictoryTooltip": function() { return /* binding */ VictoryTooltip; }
|
|
177
177
|
/* harmony export */ });
|
|
178
|
-
/* harmony import */ var
|
|
179
|
-
/* harmony import */ var
|
|
180
|
-
/* harmony import */ var lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/isPlainObject */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isPlainObject.js");
|
|
181
|
-
/* harmony import */ var lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_1__);
|
|
182
|
-
/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/uniqueId */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/uniqueId.js");
|
|
183
|
-
/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_2__);
|
|
184
|
-
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
|
|
185
|
-
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_3__);
|
|
186
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ "react");
|
|
187
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);
|
|
178
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
179
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
188
180
|
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-label/victory-label.js");
|
|
189
181
|
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/label-helpers.js");
|
|
190
182
|
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-theme/victory-theme.js");
|
|
191
183
|
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/helpers.js");
|
|
192
184
|
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/textsize.js");
|
|
193
185
|
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-portal/victory-portal.js");
|
|
186
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
|
|
187
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
|
|
188
|
+
/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/uniqueId */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/uniqueId.js");
|
|
189
|
+
/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_2__);
|
|
190
|
+
/* harmony import */ var lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash/isPlainObject */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isPlainObject.js");
|
|
191
|
+
/* harmony import */ var lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_3__);
|
|
192
|
+
/* harmony import */ var lodash_orderBy__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lodash/orderBy */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/orderBy.js");
|
|
193
|
+
/* harmony import */ var lodash_orderBy__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash_orderBy__WEBPACK_IMPORTED_MODULE_4__);
|
|
194
194
|
/* harmony import */ var _flyout__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./flyout */ "./flyout.tsx");
|
|
195
195
|
|
|
196
196
|
|
|
@@ -204,15 +204,15 @@ const fallbackProps = {
|
|
|
204
204
|
pointerLength: 10,
|
|
205
205
|
pointerWidth: 10
|
|
206
206
|
};
|
|
207
|
-
class VictoryTooltip extends (
|
|
207
|
+
class VictoryTooltip extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) {
|
|
208
208
|
static displayName = "VictoryTooltip";
|
|
209
209
|
static role = "tooltip";
|
|
210
210
|
static defaultProps = {
|
|
211
211
|
active: false,
|
|
212
212
|
renderInPortal: true,
|
|
213
|
-
labelComponent: /*#__PURE__*/
|
|
214
|
-
flyoutComponent: /*#__PURE__*/
|
|
215
|
-
groupComponent: /*#__PURE__*/
|
|
213
|
+
labelComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_5__.VictoryLabel, null),
|
|
214
|
+
flyoutComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_flyout__WEBPACK_IMPORTED_MODULE_6__.Flyout, null),
|
|
215
|
+
groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("g", null)
|
|
216
216
|
};
|
|
217
217
|
static defaultEvents(props) {
|
|
218
218
|
const activate = props.activateData ? [{
|
|
@@ -302,9 +302,9 @@ class VictoryTooltip extends (react__WEBPACK_IMPORTED_MODULE_4___default().Compo
|
|
|
302
302
|
getStyles(props) {
|
|
303
303
|
const theme = props.theme || victory_core__WEBPACK_IMPORTED_MODULE_8__.VictoryTheme.grayscale;
|
|
304
304
|
const defaultLabelStyles = theme && theme.tooltip && theme.tooltip.style ? theme.tooltip.style : {};
|
|
305
|
-
const baseLabelStyle = Array.isArray(props.style) ? props.style.map(s =>
|
|
305
|
+
const baseLabelStyle = Array.isArray(props.style) ? props.style.map(s => lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, s, defaultLabelStyles)) : lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, props.style, defaultLabelStyles);
|
|
306
306
|
const defaultFlyoutStyles = theme && theme.tooltip && theme.tooltip.flyoutStyle ? theme.tooltip.flyoutStyle : {};
|
|
307
|
-
const baseFlyoutStyle = props.flyoutStyle ?
|
|
307
|
+
const baseFlyoutStyle = props.flyoutStyle ? lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, props.flyoutStyle, defaultFlyoutStyles) : defaultFlyoutStyles;
|
|
308
308
|
const style = Array.isArray(baseLabelStyle) ? baseLabelStyle.map(s => victory_core__WEBPACK_IMPORTED_MODULE_9__.evaluateStyle(s, props)) : victory_core__WEBPACK_IMPORTED_MODULE_9__.evaluateStyle(baseLabelStyle, props);
|
|
309
309
|
const flyoutStyle = victory_core__WEBPACK_IMPORTED_MODULE_9__.evaluateStyle(baseFlyoutStyle, Object.assign({}, props, {
|
|
310
310
|
style
|
|
@@ -351,9 +351,7 @@ class VictoryTooltip extends (react__WEBPACK_IMPORTED_MODULE_4___default().Compo
|
|
|
351
351
|
flyoutStyle,
|
|
352
352
|
orientation
|
|
353
353
|
})) || this.getLabelPadding(style);
|
|
354
|
-
const flyoutPadding = victory_core__WEBPACK_IMPORTED_MODULE_9__.getPadding(
|
|
355
|
-
padding
|
|
356
|
-
});
|
|
354
|
+
const flyoutPadding = victory_core__WEBPACK_IMPORTED_MODULE_9__.getPadding(padding);
|
|
357
355
|
const pointerWidth = victory_core__WEBPACK_IMPORTED_MODULE_9__.evaluateProp(props.pointerWidth, Object.assign({}, props, {
|
|
358
356
|
active,
|
|
359
357
|
text,
|
|
@@ -394,8 +392,8 @@ class VictoryTooltip extends (react__WEBPACK_IMPORTED_MODULE_4___default().Compo
|
|
|
394
392
|
pointerWidth,
|
|
395
393
|
pointerLength
|
|
396
394
|
});
|
|
397
|
-
const offsetX =
|
|
398
|
-
const offsetY =
|
|
395
|
+
const offsetX = lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_3___default()(centerOffset) && centerOffset?.x !== undefined ? victory_core__WEBPACK_IMPORTED_MODULE_9__.evaluateProp(centerOffset.x, evaluatedProps) : 0;
|
|
396
|
+
const offsetY = lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_3___default()(centerOffset) && centerOffset?.y !== undefined ? victory_core__WEBPACK_IMPORTED_MODULE_9__.evaluateProp(centerOffset.y, evaluatedProps) : 0;
|
|
399
397
|
return {
|
|
400
398
|
...evaluatedProps,
|
|
401
399
|
centerOffset: {
|
|
@@ -490,8 +488,6 @@ class VictoryTooltip extends (react__WEBPACK_IMPORTED_MODULE_4___default().Compo
|
|
|
490
488
|
y: Math.round(y + adjustments.y[0] - adjustments.y[1])
|
|
491
489
|
};
|
|
492
490
|
}
|
|
493
|
-
|
|
494
|
-
// eslint-disable-next-line complexity
|
|
495
491
|
getFlyoutCenter(props, dimensions) {
|
|
496
492
|
const {
|
|
497
493
|
x,
|
|
@@ -514,8 +510,8 @@ class VictoryTooltip extends (react__WEBPACK_IMPORTED_MODULE_4___default().Compo
|
|
|
514
510
|
y: orientation === "top" || orientation === "bottom" ? y - ySign * (pointerLength + height / 2 - ySign * dy) : y + dy
|
|
515
511
|
};
|
|
516
512
|
const center = {
|
|
517
|
-
x:
|
|
518
|
-
y:
|
|
513
|
+
x: lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_3___default()(props.center) && props.center.x !== undefined ? props.center.x : flyoutCenter.x,
|
|
514
|
+
y: lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_3___default()(props.center) && props.center.y !== undefined ? props.center.y : flyoutCenter.y
|
|
519
515
|
};
|
|
520
516
|
const centerWithOffset = {
|
|
521
517
|
x: center.x + centerOffset.x,
|
|
@@ -579,7 +575,7 @@ class VictoryTooltip extends (react__WEBPACK_IMPORTED_MODULE_4___default().Compo
|
|
|
579
575
|
const sign = textAnchor === "end" ? -1 : 1;
|
|
580
576
|
return flyoutCenter.x - sign * (labelSize.width / 2);
|
|
581
577
|
};
|
|
582
|
-
return
|
|
578
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelComponent.props, {
|
|
583
579
|
key: `${this.id}-label-${index}`,
|
|
584
580
|
text,
|
|
585
581
|
datum,
|
|
@@ -614,7 +610,7 @@ class VictoryTooltip extends (react__WEBPACK_IMPORTED_MODULE_4___default().Compo
|
|
|
614
610
|
side: "left",
|
|
615
611
|
val: edges.left > point.x ? edges.left - point.x : -1
|
|
616
612
|
}];
|
|
617
|
-
return
|
|
613
|
+
return lodash_orderBy__WEBPACK_IMPORTED_MODULE_4___default()(gaps, "val", "desc")[0].side;
|
|
618
614
|
}
|
|
619
615
|
getFlyoutProps(props, calculatedValues) {
|
|
620
616
|
const {
|
|
@@ -637,7 +633,7 @@ class VictoryTooltip extends (react__WEBPACK_IMPORTED_MODULE_4___default().Compo
|
|
|
637
633
|
flyoutComponent
|
|
638
634
|
} = props;
|
|
639
635
|
const pointerOrientation = victory_core__WEBPACK_IMPORTED_MODULE_9__.evaluateProp(props.pointerOrientation, props);
|
|
640
|
-
return
|
|
636
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, flyoutComponent.props, {
|
|
641
637
|
x,
|
|
642
638
|
y,
|
|
643
639
|
dx,
|
|
@@ -677,12 +673,12 @@ class VictoryTooltip extends (react__WEBPACK_IMPORTED_MODULE_4___default().Compo
|
|
|
677
673
|
groupComponent
|
|
678
674
|
} = evaluatedProps;
|
|
679
675
|
const calculatedValues = this.getCalculatedValues(evaluatedProps);
|
|
680
|
-
const children = [/*#__PURE__*/
|
|
681
|
-
const tooltip = /*#__PURE__*/
|
|
676
|
+
const children = [/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(flyoutComponent, this.getFlyoutProps(evaluatedProps, calculatedValues)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(labelComponent, this.getLabelProps(evaluatedProps, calculatedValues))];
|
|
677
|
+
const tooltip = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(groupComponent, {
|
|
682
678
|
role: "presentation",
|
|
683
679
|
transform: calculatedValues.transform
|
|
684
680
|
}, children);
|
|
685
|
-
return renderInPortal ? /*#__PURE__*/
|
|
681
|
+
return renderInPortal ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_11__.VictoryPortal, null, tooltip) : tooltip;
|
|
686
682
|
}
|
|
687
683
|
render() {
|
|
688
684
|
const props = victory_core__WEBPACK_IMPORTED_MODULE_9__.modifyProps(this.props, fallbackProps, "tooltip");
|
|
@@ -4351,12 +4347,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4351
4347
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4352
4348
|
/* harmony export */ "VictoryLabel": function() { return /* binding */ VictoryLabel; }
|
|
4353
4349
|
/* harmony export */ });
|
|
4354
|
-
/* harmony import */ var
|
|
4355
|
-
/* harmony import */ var
|
|
4350
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
4351
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
4356
4352
|
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
|
|
4357
4353
|
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
|
|
4358
|
-
/* harmony import */ var
|
|
4359
|
-
/* harmony import */ var
|
|
4354
|
+
/* harmony import */ var lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/isEmpty */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isEmpty.js");
|
|
4355
|
+
/* harmony import */ var lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2__);
|
|
4360
4356
|
/* harmony import */ var _victory_portal_victory_portal__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../victory-portal/victory-portal */ "../../victory-core/es/victory-portal/victory-portal.js");
|
|
4361
4357
|
/* harmony import */ var _victory_primitives_rect__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../victory-primitives/rect */ "../../victory-core/es/victory-primitives/rect.js");
|
|
4362
4358
|
/* harmony import */ var _victory_primitives_text__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../victory-primitives/text */ "../../victory-core/es/victory-primitives/text.js");
|
|
@@ -4367,9 +4363,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4367
4363
|
/* harmony import */ var _victory_util_style__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/style */ "../../victory-core/es/victory-util/style.js");
|
|
4368
4364
|
/* harmony import */ var _victory_util_textsize__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../victory-util/textsize */ "../../victory-core/es/victory-util/textsize.js");
|
|
4369
4365
|
/* harmony import */ var _victory_util_user_props__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../victory-util/user-props */ "../../victory-core/es/victory-util/user-props.js");
|
|
4366
|
+
/* eslint no-magic-numbers: ["error", { "ignore": [-0.5, 0.5, 0, 1, 2] }]*/
|
|
4370
4367
|
|
|
4371
4368
|
|
|
4372
|
-
/* eslint no-magic-numbers: ["error", { "ignore": [-0.5, 0.5, 0, 1, 2] }]*/
|
|
4373
4369
|
|
|
4374
4370
|
|
|
4375
4371
|
|
|
@@ -4421,7 +4417,7 @@ const shouldUseMultilineBackgrounds = props => {
|
|
|
4421
4417
|
backgroundStyle,
|
|
4422
4418
|
backgroundPadding
|
|
4423
4419
|
} = props;
|
|
4424
|
-
return Array.isArray(backgroundStyle) && !
|
|
4420
|
+
return Array.isArray(backgroundStyle) && !lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2___default()(backgroundStyle) || Array.isArray(backgroundPadding) && !lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2___default()(backgroundPadding);
|
|
4425
4421
|
};
|
|
4426
4422
|
const getStyles = (style, props) => {
|
|
4427
4423
|
if (props.disableInlineStyles) {
|
|
@@ -4437,32 +4433,28 @@ const getStyles = (style, props) => {
|
|
|
4437
4433
|
fontSize: getFontSize(baseStyles)
|
|
4438
4434
|
});
|
|
4439
4435
|
};
|
|
4440
|
-
return Array.isArray(style) && !
|
|
4436
|
+
return Array.isArray(style) && !lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2___default()(style) ? style.map(s => getSingleStyle(s)) : getSingleStyle(style);
|
|
4441
4437
|
};
|
|
4442
4438
|
const getBackgroundStyles = (style, props) => {
|
|
4443
4439
|
if (!style) {
|
|
4444
4440
|
return undefined;
|
|
4445
4441
|
}
|
|
4446
|
-
return Array.isArray(style) && !
|
|
4442
|
+
return Array.isArray(style) && !lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2___default()(style) ? style.map(s => _victory_util_helpers__WEBPACK_IMPORTED_MODULE_3__.evaluateStyle(s, props)) : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_3__.evaluateStyle(style, props);
|
|
4447
4443
|
};
|
|
4448
4444
|
const getBackgroundPadding = props => {
|
|
4449
4445
|
if (props.backgroundPadding && Array.isArray(props.backgroundPadding)) {
|
|
4450
4446
|
return props.backgroundPadding.map(backgroundPadding => {
|
|
4451
4447
|
const padding = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_3__.evaluateProp(backgroundPadding, props);
|
|
4452
|
-
return _victory_util_helpers__WEBPACK_IMPORTED_MODULE_3__.getPadding(
|
|
4453
|
-
padding
|
|
4454
|
-
});
|
|
4448
|
+
return _victory_util_helpers__WEBPACK_IMPORTED_MODULE_3__.getPadding(padding);
|
|
4455
4449
|
});
|
|
4456
4450
|
}
|
|
4457
4451
|
const padding = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_3__.evaluateProp(props.backgroundPadding, props);
|
|
4458
|
-
return _victory_util_helpers__WEBPACK_IMPORTED_MODULE_3__.getPadding(
|
|
4459
|
-
padding
|
|
4460
|
-
});
|
|
4452
|
+
return _victory_util_helpers__WEBPACK_IMPORTED_MODULE_3__.getPadding(padding);
|
|
4461
4453
|
};
|
|
4462
4454
|
const getLineHeight = props => {
|
|
4463
4455
|
const lineHeight = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_3__.evaluateProp(props.lineHeight, props);
|
|
4464
4456
|
if (Array.isArray(lineHeight)) {
|
|
4465
|
-
return
|
|
4457
|
+
return lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2___default()(lineHeight) ? [1] : lineHeight;
|
|
4466
4458
|
}
|
|
4467
4459
|
return lineHeight;
|
|
4468
4460
|
};
|
|
@@ -4582,7 +4574,7 @@ const getFullBackground = (calculatedProps, tspanValues) => {
|
|
|
4582
4574
|
x: inline ? xCoordinate - backgroundPadding.left : xCoordinate + dx - backgroundPadding.left,
|
|
4583
4575
|
y: yCoordinate
|
|
4584
4576
|
};
|
|
4585
|
-
return /*#__PURE__*/
|
|
4577
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(backgroundComponent, lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, backgroundComponent.props, backgroundProps));
|
|
4586
4578
|
};
|
|
4587
4579
|
const getInlineXOffset = (calculatedProps, textElements, index) => {
|
|
4588
4580
|
const {
|
|
@@ -4652,7 +4644,7 @@ const getChildBackgrounds = (calculatedProps, tspanValues) => {
|
|
|
4652
4644
|
x: xCoord - padding.left,
|
|
4653
4645
|
y: yCoord
|
|
4654
4646
|
};
|
|
4655
|
-
return /*#__PURE__*/
|
|
4647
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(backgroundComponent, lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, backgroundComponent.props, backgroundProps));
|
|
4656
4648
|
});
|
|
4657
4649
|
};
|
|
4658
4650
|
const getBackgroundElement = (calculatedProps, tspanValues) => {
|
|
@@ -4783,16 +4775,16 @@ const renderLabel = (calculatedProps, tspanValues) => {
|
|
|
4783
4775
|
style: currentStyle,
|
|
4784
4776
|
children: line
|
|
4785
4777
|
};
|
|
4786
|
-
return /*#__PURE__*/
|
|
4778
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(tspanComponent, tspanProps);
|
|
4787
4779
|
});
|
|
4788
|
-
return /*#__PURE__*/
|
|
4780
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(textComponent, textProps, tspans);
|
|
4789
4781
|
};
|
|
4790
4782
|
const defaultProps = {
|
|
4791
|
-
backgroundComponent: /*#__PURE__*/
|
|
4792
|
-
groupComponent: /*#__PURE__*/
|
|
4783
|
+
backgroundComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_victory_primitives_rect__WEBPACK_IMPORTED_MODULE_8__.Rect, null),
|
|
4784
|
+
groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("g", null),
|
|
4793
4785
|
direction: "inherit",
|
|
4794
|
-
textComponent: /*#__PURE__*/
|
|
4795
|
-
tspanComponent: /*#__PURE__*/
|
|
4786
|
+
textComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_victory_primitives_text__WEBPACK_IMPORTED_MODULE_9__.Text, null),
|
|
4787
|
+
tspanComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_victory_primitives_tspan__WEBPACK_IMPORTED_MODULE_10__.TSpan, null),
|
|
4796
4788
|
capHeight: 0.71,
|
|
4797
4789
|
// Magic number from d3.
|
|
4798
4790
|
lineHeight: 1
|
|
@@ -4829,10 +4821,10 @@ const VictoryLabel = initialProps => {
|
|
|
4829
4821
|
if (props.backgroundStyle) {
|
|
4830
4822
|
const backgroundElement = getBackgroundElement(calculatedProps, tspanValues);
|
|
4831
4823
|
const children = [backgroundElement, label];
|
|
4832
|
-
const backgroundWithLabel = /*#__PURE__*/
|
|
4833
|
-
return props.renderInPortal ? /*#__PURE__*/
|
|
4824
|
+
const backgroundWithLabel = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(props.groupComponent, {}, children);
|
|
4825
|
+
return props.renderInPortal ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_victory_portal_victory_portal__WEBPACK_IMPORTED_MODULE_12__.VictoryPortal, null, backgroundWithLabel) : backgroundWithLabel;
|
|
4834
4826
|
}
|
|
4835
|
-
return props.renderInPortal ? /*#__PURE__*/
|
|
4827
|
+
return props.renderInPortal ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_victory_portal_victory_portal__WEBPACK_IMPORTED_MODULE_12__.VictoryPortal, null, label) : label;
|
|
4836
4828
|
};
|
|
4837
4829
|
VictoryLabel.displayName = "VictoryLabel";
|
|
4838
4830
|
VictoryLabel.role = "label";
|
|
@@ -4904,12 +4896,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4904
4896
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4905
4897
|
/* harmony export */ "VictoryPortal": function() { return /* binding */ VictoryPortal; }
|
|
4906
4898
|
/* harmony export */ });
|
|
4907
|
-
/* harmony import */ var
|
|
4908
|
-
/* harmony import */ var
|
|
4899
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
4900
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
4909
4901
|
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
|
|
4910
4902
|
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
|
|
4911
|
-
/* harmony import */ var
|
|
4912
|
-
/* harmony import */ var
|
|
4903
|
+
/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/uniqueId */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/uniqueId.js");
|
|
4904
|
+
/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_2__);
|
|
4913
4905
|
/* harmony import */ var _victory_util_log__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-util/log */ "../../victory-core/es/victory-util/log.js");
|
|
4914
4906
|
/* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
4915
4907
|
/* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
|
|
@@ -4920,14 +4912,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4920
4912
|
|
|
4921
4913
|
|
|
4922
4914
|
const defaultProps = {
|
|
4923
|
-
groupComponent: /*#__PURE__*/
|
|
4915
|
+
groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("g", null)
|
|
4924
4916
|
};
|
|
4925
4917
|
const VictoryPortal = initialProps => {
|
|
4926
4918
|
const props = {
|
|
4927
4919
|
...defaultProps,
|
|
4928
4920
|
...initialProps
|
|
4929
4921
|
};
|
|
4930
|
-
const [id] = (0,
|
|
4922
|
+
const [id] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_2___default()());
|
|
4931
4923
|
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_3__.usePortalContext)();
|
|
4932
4924
|
if (!portalContext) {
|
|
4933
4925
|
const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
|
|
@@ -4945,12 +4937,12 @@ const VictoryPortal = initialProps => {
|
|
|
4945
4937
|
const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_5__.omit(props, ["children", "groupComponent"]), {
|
|
4946
4938
|
key: childProps.key ?? id
|
|
4947
4939
|
});
|
|
4948
|
-
const child = children && /*#__PURE__*/
|
|
4949
|
-
|
|
4940
|
+
const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(children, newProps);
|
|
4941
|
+
react__WEBPACK_IMPORTED_MODULE_0___default().useEffect(() => {
|
|
4950
4942
|
portalContext?.addChild(id, child);
|
|
4951
4943
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4952
4944
|
}, [props.children]);
|
|
4953
|
-
|
|
4945
|
+
react__WEBPACK_IMPORTED_MODULE_0___default().useEffect(() => {
|
|
4954
4946
|
return () => portalContext?.removeChild(id);
|
|
4955
4947
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4956
4948
|
}, []);
|
|
@@ -6277,41 +6269,45 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6277
6269
|
/* harmony export */ "reduceChildren": function() { return /* binding */ reduceChildren; },
|
|
6278
6270
|
/* harmony export */ "scalePoint": function() { return /* binding */ scalePoint; }
|
|
6279
6271
|
/* harmony export */ });
|
|
6280
|
-
/* harmony import */ var
|
|
6281
|
-
/* harmony import */ var
|
|
6282
|
-
/* harmony import */ var
|
|
6283
|
-
/* harmony import */ var
|
|
6284
|
-
/* harmony import */ var
|
|
6285
|
-
/* harmony import */ var
|
|
6286
|
-
/* harmony import */ var
|
|
6287
|
-
/* harmony import */ var
|
|
6288
|
-
|
|
6272
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
6273
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
6274
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
|
|
6275
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
|
|
6276
|
+
/* harmony import */ var lodash_property__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/property */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/property.js");
|
|
6277
|
+
/* harmony import */ var lodash_property__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_property__WEBPACK_IMPORTED_MODULE_2__);
|
|
6278
|
+
/* harmony import */ var lodash_pick__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash/pick */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/pick.js");
|
|
6279
|
+
/* harmony import */ var lodash_pick__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_pick__WEBPACK_IMPORTED_MODULE_3__);
|
|
6289
6280
|
|
|
6290
6281
|
|
|
6291
|
-
/* eslint-disable no-use-before-define */
|
|
6292
6282
|
|
|
6293
|
-
// Private Functions
|
|
6294
6283
|
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6284
|
+
/**
|
|
6285
|
+
* Determine the range of a cartesian axis
|
|
6286
|
+
*/
|
|
6287
|
+
function getCartesianRange(options) {
|
|
6288
|
+
const vertical = options.axis !== "x";
|
|
6299
6289
|
if (vertical) {
|
|
6300
|
-
return [
|
|
6290
|
+
return [options.height - options.padding.bottom, options.padding.top];
|
|
6301
6291
|
}
|
|
6302
|
-
return [padding.left,
|
|
6292
|
+
return [options.padding.left, options.width - options.padding.right];
|
|
6303
6293
|
}
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6294
|
+
|
|
6295
|
+
/**
|
|
6296
|
+
* Determine the range of a polar axis in radians
|
|
6297
|
+
*/
|
|
6298
|
+
function getPolarRange(options) {
|
|
6299
|
+
if (options.axis === "x") {
|
|
6300
|
+
const startAngle = degreesToRadians(options.startAngle || 0);
|
|
6301
|
+
const endAngle = degreesToRadians(options.endAngle || 360);
|
|
6308
6302
|
return [startAngle, endAngle];
|
|
6309
6303
|
}
|
|
6310
|
-
return [
|
|
6304
|
+
return [options.innerRadius || 0, getRadius({
|
|
6305
|
+
height: options.height,
|
|
6306
|
+
width: options.width,
|
|
6307
|
+
padding: options.padding
|
|
6308
|
+
})];
|
|
6311
6309
|
}
|
|
6312
6310
|
|
|
6313
|
-
// Exported Functions
|
|
6314
|
-
|
|
6315
6311
|
/**
|
|
6316
6312
|
* Creates an object composed of the inverted keys and values of object.
|
|
6317
6313
|
* If object contains duplicate values, subsequent values overwrite property assignments of previous values.
|
|
@@ -6348,8 +6344,11 @@ function omit(originalObject, ks) {
|
|
|
6348
6344
|
}
|
|
6349
6345
|
return newObject;
|
|
6350
6346
|
}
|
|
6347
|
+
|
|
6348
|
+
/**
|
|
6349
|
+
* Coalesce the x and y values from a data point
|
|
6350
|
+
*/
|
|
6351
6351
|
function getPoint(datum) {
|
|
6352
|
-
const exists = val => val !== undefined;
|
|
6353
6352
|
const {
|
|
6354
6353
|
_x,
|
|
6355
6354
|
_x1,
|
|
@@ -6360,16 +6359,20 @@ function getPoint(datum) {
|
|
|
6360
6359
|
_y0,
|
|
6361
6360
|
_voronoiY
|
|
6362
6361
|
} = datum;
|
|
6363
|
-
const defaultX =
|
|
6364
|
-
const defaultY =
|
|
6362
|
+
const defaultX = _x1 ?? _x;
|
|
6363
|
+
const defaultY = _y1 ?? _y;
|
|
6365
6364
|
const point = {
|
|
6366
|
-
x:
|
|
6367
|
-
x0:
|
|
6368
|
-
y:
|
|
6369
|
-
y0:
|
|
6365
|
+
x: _voronoiX ?? defaultX,
|
|
6366
|
+
x0: _x0 ?? _x,
|
|
6367
|
+
y: _voronoiY ?? defaultY,
|
|
6368
|
+
y0: _y0 ?? _y
|
|
6370
6369
|
};
|
|
6371
|
-
return
|
|
6370
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, point, datum);
|
|
6372
6371
|
}
|
|
6372
|
+
|
|
6373
|
+
/**
|
|
6374
|
+
* Scale a point based on the origin, direction, and given scale function
|
|
6375
|
+
*/
|
|
6373
6376
|
function scalePoint(props, datum) {
|
|
6374
6377
|
const {
|
|
6375
6378
|
scale,
|
|
@@ -6392,11 +6395,11 @@ function scalePoint(props, datum) {
|
|
|
6392
6395
|
y0: polar ? -y0 * Math.sin(x0) + origin.x : y0
|
|
6393
6396
|
};
|
|
6394
6397
|
}
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6398
|
+
|
|
6399
|
+
/**
|
|
6400
|
+
* Returns a padding value from a number or partial padding values
|
|
6401
|
+
*/
|
|
6402
|
+
function getPadding(padding) {
|
|
6400
6403
|
const paddingVal = typeof padding === "number" ? padding : 0;
|
|
6401
6404
|
const paddingObj = typeof padding === "object" ? padding : {};
|
|
6402
6405
|
return {
|
|
@@ -6406,6 +6409,10 @@ function getPadding(props, name) {
|
|
|
6406
6409
|
right: paddingObj.right || paddingVal
|
|
6407
6410
|
};
|
|
6408
6411
|
}
|
|
6412
|
+
|
|
6413
|
+
/**
|
|
6414
|
+
* Returns true if the component is defined as a tooltip
|
|
6415
|
+
*/
|
|
6409
6416
|
function isTooltip(component) {
|
|
6410
6417
|
const labelRole = component && component.type && component.type.role;
|
|
6411
6418
|
return labelRole === "tooltip";
|
|
@@ -6420,8 +6427,8 @@ function getDefaultStyles(props, role) {
|
|
|
6420
6427
|
return defaultStyles;
|
|
6421
6428
|
}
|
|
6422
6429
|
const tooltipStyle = theme.tooltip && theme.tooltip.style || {};
|
|
6423
|
-
const labelStyle =
|
|
6424
|
-
return
|
|
6430
|
+
const labelStyle = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, tooltipStyle, defaultStyles.labels);
|
|
6431
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, {
|
|
6425
6432
|
labels: labelStyle
|
|
6426
6433
|
}, defaultStyles);
|
|
6427
6434
|
}
|
|
@@ -6429,7 +6436,7 @@ function getStyles(style, defaultStyles) {
|
|
|
6429
6436
|
const width = "100%";
|
|
6430
6437
|
const height = "100%";
|
|
6431
6438
|
if (!style) {
|
|
6432
|
-
return
|
|
6439
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({
|
|
6433
6440
|
parent: {
|
|
6434
6441
|
height,
|
|
6435
6442
|
width
|
|
@@ -6445,14 +6452,18 @@ function getStyles(style, defaultStyles) {
|
|
|
6445
6452
|
const defaultLabels = defaultStyles && defaultStyles.labels || {};
|
|
6446
6453
|
const defaultData = defaultStyles && defaultStyles.data || {};
|
|
6447
6454
|
return {
|
|
6448
|
-
parent:
|
|
6455
|
+
parent: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, parent, defaultParent, {
|
|
6449
6456
|
width,
|
|
6450
6457
|
height
|
|
6451
6458
|
}),
|
|
6452
|
-
labels:
|
|
6453
|
-
data:
|
|
6459
|
+
labels: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labels, defaultLabels),
|
|
6460
|
+
data: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, data, defaultData)
|
|
6454
6461
|
};
|
|
6455
6462
|
}
|
|
6463
|
+
|
|
6464
|
+
/**
|
|
6465
|
+
* Returns the value of a prop or accessor function with the given props
|
|
6466
|
+
*/
|
|
6456
6467
|
function evaluateProp(prop, props) {
|
|
6457
6468
|
return isFunction(prop) ? prop(props) : prop;
|
|
6458
6469
|
}
|
|
@@ -6474,19 +6485,28 @@ function degreesToRadians(degrees) {
|
|
|
6474
6485
|
function radiansToDegrees(radians) {
|
|
6475
6486
|
return typeof radians === "number" ? radians / (Math.PI / 180) : radians;
|
|
6476
6487
|
}
|
|
6477
|
-
|
|
6488
|
+
|
|
6489
|
+
/**
|
|
6490
|
+
* Get the maximum radius that will fit in the container
|
|
6491
|
+
*/
|
|
6492
|
+
function getRadius(options) {
|
|
6493
|
+
const {
|
|
6494
|
+
width,
|
|
6495
|
+
height,
|
|
6496
|
+
padding
|
|
6497
|
+
} = options;
|
|
6478
6498
|
const {
|
|
6479
6499
|
left,
|
|
6480
6500
|
right,
|
|
6481
6501
|
top,
|
|
6482
6502
|
bottom
|
|
6483
|
-
} =
|
|
6484
|
-
const {
|
|
6485
|
-
width,
|
|
6486
|
-
height
|
|
6487
|
-
} = props;
|
|
6503
|
+
} = padding;
|
|
6488
6504
|
return Math.min(width - left - right, height - top - bottom) / 2;
|
|
6489
6505
|
}
|
|
6506
|
+
|
|
6507
|
+
/**
|
|
6508
|
+
* Returns the origin for a polar chart within the padded area
|
|
6509
|
+
*/
|
|
6490
6510
|
function getPolarOrigin(props) {
|
|
6491
6511
|
const {
|
|
6492
6512
|
width,
|
|
@@ -6497,7 +6517,7 @@ function getPolarOrigin(props) {
|
|
|
6497
6517
|
bottom,
|
|
6498
6518
|
left,
|
|
6499
6519
|
right
|
|
6500
|
-
} = getPadding(props);
|
|
6520
|
+
} = getPadding(props.padding);
|
|
6501
6521
|
const radius = Math.min(width - left - right, height - top - bottom) / 2;
|
|
6502
6522
|
const offsetWidth = width / 2 + left - right;
|
|
6503
6523
|
const offsetHeight = height / 2 + top - bottom;
|
|
@@ -6506,13 +6526,30 @@ function getPolarOrigin(props) {
|
|
|
6506
6526
|
y: offsetHeight + radius > height ? radius + top - bottom : offsetHeight
|
|
6507
6527
|
};
|
|
6508
6528
|
}
|
|
6529
|
+
|
|
6530
|
+
/**
|
|
6531
|
+
* Determine the range of an axis based on the given props
|
|
6532
|
+
*/
|
|
6509
6533
|
function getRange(props, axis) {
|
|
6510
6534
|
if (props.range && props.range[axis]) {
|
|
6511
6535
|
return props.range[axis];
|
|
6512
6536
|
} else if (props.range && Array.isArray(props.range)) {
|
|
6513
6537
|
return props.range;
|
|
6514
6538
|
}
|
|
6515
|
-
return props.polar ? getPolarRange(
|
|
6539
|
+
return props.polar ? getPolarRange({
|
|
6540
|
+
axis,
|
|
6541
|
+
innerRadius: props.innerRadius,
|
|
6542
|
+
startAngle: props.startAngle,
|
|
6543
|
+
endAngle: props.endAngle,
|
|
6544
|
+
height: props.height,
|
|
6545
|
+
width: props.width,
|
|
6546
|
+
padding: getPadding(props.padding)
|
|
6547
|
+
}) : getCartesianRange({
|
|
6548
|
+
axis,
|
|
6549
|
+
height: props.height,
|
|
6550
|
+
width: props.width,
|
|
6551
|
+
padding: getPadding(props.padding)
|
|
6552
|
+
});
|
|
6516
6553
|
}
|
|
6517
6554
|
|
|
6518
6555
|
/**
|
|
@@ -6544,7 +6581,7 @@ function createAccessor(key) {
|
|
|
6544
6581
|
return x => x;
|
|
6545
6582
|
}
|
|
6546
6583
|
// otherwise, assume it is an array index, property key or path (_.property handles all three)
|
|
6547
|
-
return
|
|
6584
|
+
return lodash_property__WEBPACK_IMPORTED_MODULE_2___default()(key);
|
|
6548
6585
|
}
|
|
6549
6586
|
function modifyProps(props, fallbackProps, role) {
|
|
6550
6587
|
const theme = props.theme && props.theme[role] ? props.theme[role] : {};
|
|
@@ -6553,7 +6590,7 @@ function modifyProps(props, fallbackProps, role) {
|
|
|
6553
6590
|
const defaultObject = horizontal === undefined ? {} : {
|
|
6554
6591
|
horizontal
|
|
6555
6592
|
};
|
|
6556
|
-
return
|
|
6593
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()(defaultObject, props, themeProps, fallbackProps);
|
|
6557
6594
|
}
|
|
6558
6595
|
|
|
6559
6596
|
/**
|
|
@@ -6640,10 +6677,10 @@ initialMemo, combine) {
|
|
|
6640
6677
|
const childRole = child.type && child.type.role;
|
|
6641
6678
|
const childName = child.props.name || `${childRole}-${names[index]}`;
|
|
6642
6679
|
if (child.props && child.props.children) {
|
|
6643
|
-
const childProps = Object.assign({}, child.props,
|
|
6644
|
-
const nestedChildren = child.type && child.type.role === "stack" && isFunction(child.type.getChildren) ? child.type.getChildren(childProps) :
|
|
6645
|
-
const nestedChildProps = Object.assign({}, c.props,
|
|
6646
|
-
return /*#__PURE__*/
|
|
6680
|
+
const childProps = Object.assign({}, child.props, lodash_pick__WEBPACK_IMPORTED_MODULE_3___default()(parentProps, sharedProps));
|
|
6681
|
+
const nestedChildren = child.type && child.type.role === "stack" && isFunction(child.type.getChildren) ? child.type.getChildren(childProps) : react__WEBPACK_IMPORTED_MODULE_0___default().Children.toArray(child.props.children).map(c => {
|
|
6682
|
+
const nestedChildProps = Object.assign({}, c.props, lodash_pick__WEBPACK_IMPORTED_MODULE_3___default()(childProps, sharedProps));
|
|
6683
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(c, nestedChildProps);
|
|
6647
6684
|
});
|
|
6648
6685
|
const childNames = nestedChildren.map((c, i) => `${childName}-${i}`);
|
|
6649
6686
|
const nestedResults = traverseChildren(nestedChildren, childNames, child);
|
|
@@ -6657,7 +6694,7 @@ initialMemo, combine) {
|
|
|
6657
6694
|
return newMemo;
|
|
6658
6695
|
}, initialMemo);
|
|
6659
6696
|
};
|
|
6660
|
-
const validChildren = children.filter(
|
|
6697
|
+
const validChildren = children.filter(react__WEBPACK_IMPORTED_MODULE_0__.isValidElement);
|
|
6661
6698
|
const childNames = validChildren.map((c, i) => i);
|
|
6662
6699
|
return traverseChildren(validChildren, childNames);
|
|
6663
6700
|
}
|
|
@@ -6677,10 +6714,10 @@ function isHorizontal(props) {
|
|
|
6677
6714
|
if (memo || childProps.horizontal || !childProps.children) {
|
|
6678
6715
|
return memo || childProps.horizontal;
|
|
6679
6716
|
}
|
|
6680
|
-
return traverseChildren(
|
|
6717
|
+
return traverseChildren(react__WEBPACK_IMPORTED_MODULE_0___default().Children.toArray(childProps.children));
|
|
6681
6718
|
}, false);
|
|
6682
6719
|
};
|
|
6683
|
-
return traverseChildren(
|
|
6720
|
+
return traverseChildren(react__WEBPACK_IMPORTED_MODULE_0___default().Children.toArray(props.children));
|
|
6684
6721
|
}
|
|
6685
6722
|
|
|
6686
6723
|
/***/ }),
|
|
@@ -6701,11 +6738,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6701
6738
|
/* harmony export */ "getProps": function() { return /* binding */ getProps; },
|
|
6702
6739
|
/* harmony export */ "getText": function() { return /* binding */ getText; }
|
|
6703
6740
|
/* harmony export */ });
|
|
6741
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
6704
6742
|
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
|
|
6705
6743
|
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_0__);
|
|
6706
|
-
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
6707
6744
|
|
|
6708
|
-
|
|
6745
|
+
|
|
6709
6746
|
|
|
6710
6747
|
// Private Functions
|
|
6711
6748
|
|
|
@@ -6950,11 +6987,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6950
6987
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6951
6988
|
/* harmony export */ "warn": function() { return /* binding */ warn; }
|
|
6952
6989
|
/* harmony export */ });
|
|
6953
|
-
/* global console */
|
|
6990
|
+
/* global console process */
|
|
6954
6991
|
/* eslint-disable no-console */
|
|
6955
6992
|
|
|
6956
|
-
// TODO: Use "warning" npm module like React is switching to.
|
|
6957
6993
|
function warn(message) {
|
|
6994
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6995
|
+
// @ts-ignore - Webpack DefinePlugin will replace process.env.NODE_ENV
|
|
6958
6996
|
if (true) {
|
|
6959
6997
|
if (console && console.warn) {
|
|
6960
6998
|
console.warn(message);
|
|
@@ -7063,13 +7101,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7063
7101
|
/* harmony export */ "approximateTextSize": function() { return /* binding */ approximateTextSize; },
|
|
7064
7102
|
/* harmony export */ "convertLengthToPixels": function() { return /* binding */ convertLengthToPixels; }
|
|
7065
7103
|
/* harmony export */ });
|
|
7066
|
-
/* harmony import */ var
|
|
7067
|
-
/* harmony import */ var
|
|
7068
|
-
/* harmony import */ var
|
|
7069
|
-
/* harmony import */ var
|
|
7070
|
-
|
|
7071
|
-
// http://www.pearsonified.com/2012/01/characters-per-line.php
|
|
7104
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
|
|
7105
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_0__);
|
|
7106
|
+
/* harmony import */ var lodash_memoize__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/memoize */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/memoize.js");
|
|
7107
|
+
/* harmony import */ var lodash_memoize__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_memoize__WEBPACK_IMPORTED_MODULE_1__);
|
|
7108
|
+
// http://www.pearsonified.com/2012/01/characters-per-line.php
|
|
7072
7109
|
/* eslint-disable no-magic-numbers */
|
|
7110
|
+
|
|
7111
|
+
|
|
7112
|
+
|
|
7073
7113
|
// Based on measuring specific character widths
|
|
7074
7114
|
// as in the following example https://bl.ocks.org/tophtucker/62f93a4658387bb61e4510c37e2e97cf
|
|
7075
7115
|
// For new fonts: pull gist, open index.html locally, add font files (if not generic), enter font name in `font-family` input
|
|
@@ -7248,7 +7288,7 @@ const convertLengthToPixels = (length, fontSize) => {
|
|
|
7248
7288
|
};
|
|
7249
7289
|
const _prepareParams = (inputStyle, index) => {
|
|
7250
7290
|
const lineStyle = Array.isArray(inputStyle) ? inputStyle[index] : inputStyle;
|
|
7251
|
-
const style =
|
|
7291
|
+
const style = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, lineStyle, defaultStyle);
|
|
7252
7292
|
return Object.assign({}, style, {
|
|
7253
7293
|
fontFamily: style.fontFamily,
|
|
7254
7294
|
letterSpacing: typeof style.letterSpacing === "number" ? style.letterSpacing : convertLengthToPixels(String(style.letterSpacing), style.fontSize),
|
|
@@ -7296,7 +7336,7 @@ const _approximateDimensionsInternal = (text, style) => {
|
|
|
7296
7336
|
height: heightWithRotate * coefficients.heightOverlapCoef
|
|
7297
7337
|
};
|
|
7298
7338
|
};
|
|
7299
|
-
const _getMeasurementContainer =
|
|
7339
|
+
const _getMeasurementContainer = lodash_memoize__WEBPACK_IMPORTED_MODULE_1___default()(() => {
|
|
7300
7340
|
const element = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
7301
7341
|
element.setAttribute("xlink", "http://www.w3.org/1999/xlink");
|
|
7302
7342
|
element.setAttribute("width", "300");
|
|
@@ -7317,7 +7357,7 @@ const styleToKeyComponent = style => {
|
|
|
7317
7357
|
}
|
|
7318
7358
|
return `${style.angle}:${style.fontFamily}:${style.fontSize}:${style.letterSpacing}:${style.lineHeight}`;
|
|
7319
7359
|
};
|
|
7320
|
-
const _measureDimensionsInternal =
|
|
7360
|
+
const _measureDimensionsInternal = lodash_memoize__WEBPACK_IMPORTED_MODULE_1___default()((text, style) => {
|
|
7321
7361
|
let containerElement = _getMeasurementContainer();
|
|
7322
7362
|
if (!containerElement.isConnected) {
|
|
7323
7363
|
_getMeasurementContainer.cache.clear?.();
|