victory-tooltip 37.3.2 → 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 +8 -0
- package/dist/victory-tooltip.js +186 -142
- 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 -17
- package/lib/flyout.js +2 -2
- package/lib/victory-tooltip.d.ts +2 -2
- package/lib/victory-tooltip.js +15 -17
- package/package.json +2 -30
- package/src/flyout.tsx +1 -1
- package/src/victory-tooltip.tsx +6 -2
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: {
|
|
@@ -512,8 +510,8 @@ class VictoryTooltip extends (react__WEBPACK_IMPORTED_MODULE_4___default().Compo
|
|
|
512
510
|
y: orientation === "top" || orientation === "bottom" ? y - ySign * (pointerLength + height / 2 - ySign * dy) : y + dy
|
|
513
511
|
};
|
|
514
512
|
const center = {
|
|
515
|
-
x:
|
|
516
|
-
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
|
|
517
515
|
};
|
|
518
516
|
const centerWithOffset = {
|
|
519
517
|
x: center.x + centerOffset.x,
|
|
@@ -577,7 +575,7 @@ class VictoryTooltip extends (react__WEBPACK_IMPORTED_MODULE_4___default().Compo
|
|
|
577
575
|
const sign = textAnchor === "end" ? -1 : 1;
|
|
578
576
|
return flyoutCenter.x - sign * (labelSize.width / 2);
|
|
579
577
|
};
|
|
580
|
-
return
|
|
578
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelComponent.props, {
|
|
581
579
|
key: `${this.id}-label-${index}`,
|
|
582
580
|
text,
|
|
583
581
|
datum,
|
|
@@ -612,7 +610,7 @@ class VictoryTooltip extends (react__WEBPACK_IMPORTED_MODULE_4___default().Compo
|
|
|
612
610
|
side: "left",
|
|
613
611
|
val: edges.left > point.x ? edges.left - point.x : -1
|
|
614
612
|
}];
|
|
615
|
-
return
|
|
613
|
+
return lodash_orderBy__WEBPACK_IMPORTED_MODULE_4___default()(gaps, "val", "desc")[0].side;
|
|
616
614
|
}
|
|
617
615
|
getFlyoutProps(props, calculatedValues) {
|
|
618
616
|
const {
|
|
@@ -635,7 +633,7 @@ class VictoryTooltip extends (react__WEBPACK_IMPORTED_MODULE_4___default().Compo
|
|
|
635
633
|
flyoutComponent
|
|
636
634
|
} = props;
|
|
637
635
|
const pointerOrientation = victory_core__WEBPACK_IMPORTED_MODULE_9__.evaluateProp(props.pointerOrientation, props);
|
|
638
|
-
return
|
|
636
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, flyoutComponent.props, {
|
|
639
637
|
x,
|
|
640
638
|
y,
|
|
641
639
|
dx,
|
|
@@ -675,12 +673,12 @@ class VictoryTooltip extends (react__WEBPACK_IMPORTED_MODULE_4___default().Compo
|
|
|
675
673
|
groupComponent
|
|
676
674
|
} = evaluatedProps;
|
|
677
675
|
const calculatedValues = this.getCalculatedValues(evaluatedProps);
|
|
678
|
-
const children = [/*#__PURE__*/
|
|
679
|
-
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, {
|
|
680
678
|
role: "presentation",
|
|
681
679
|
transform: calculatedValues.transform
|
|
682
680
|
}, children);
|
|
683
|
-
return renderInPortal ? /*#__PURE__*/
|
|
681
|
+
return renderInPortal ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_11__.VictoryPortal, null, tooltip) : tooltip;
|
|
684
682
|
}
|
|
685
683
|
render() {
|
|
686
684
|
const props = victory_core__WEBPACK_IMPORTED_MODULE_9__.modifyProps(this.props, fallbackProps, "tooltip");
|
|
@@ -4349,12 +4347,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4349
4347
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4350
4348
|
/* harmony export */ "VictoryLabel": function() { return /* binding */ VictoryLabel; }
|
|
4351
4349
|
/* harmony export */ });
|
|
4352
|
-
/* harmony import */ var
|
|
4353
|
-
/* 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__);
|
|
4354
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");
|
|
4355
4353
|
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
|
|
4356
|
-
/* harmony import */ var
|
|
4357
|
-
/* 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__);
|
|
4358
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");
|
|
4359
4357
|
/* harmony import */ var _victory_primitives_rect__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../victory-primitives/rect */ "../../victory-core/es/victory-primitives/rect.js");
|
|
4360
4358
|
/* harmony import */ var _victory_primitives_text__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../victory-primitives/text */ "../../victory-core/es/victory-primitives/text.js");
|
|
@@ -4365,9 +4363,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4365
4363
|
/* harmony import */ var _victory_util_style__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/style */ "../../victory-core/es/victory-util/style.js");
|
|
4366
4364
|
/* harmony import */ var _victory_util_textsize__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../victory-util/textsize */ "../../victory-core/es/victory-util/textsize.js");
|
|
4367
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] }]*/
|
|
4368
4367
|
|
|
4369
4368
|
|
|
4370
|
-
/* eslint no-magic-numbers: ["error", { "ignore": [-0.5, 0.5, 0, 1, 2] }]*/
|
|
4371
4369
|
|
|
4372
4370
|
|
|
4373
4371
|
|
|
@@ -4419,7 +4417,7 @@ const shouldUseMultilineBackgrounds = props => {
|
|
|
4419
4417
|
backgroundStyle,
|
|
4420
4418
|
backgroundPadding
|
|
4421
4419
|
} = props;
|
|
4422
|
-
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);
|
|
4423
4421
|
};
|
|
4424
4422
|
const getStyles = (style, props) => {
|
|
4425
4423
|
if (props.disableInlineStyles) {
|
|
@@ -4435,32 +4433,28 @@ const getStyles = (style, props) => {
|
|
|
4435
4433
|
fontSize: getFontSize(baseStyles)
|
|
4436
4434
|
});
|
|
4437
4435
|
};
|
|
4438
|
-
return Array.isArray(style) && !
|
|
4436
|
+
return Array.isArray(style) && !lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2___default()(style) ? style.map(s => getSingleStyle(s)) : getSingleStyle(style);
|
|
4439
4437
|
};
|
|
4440
4438
|
const getBackgroundStyles = (style, props) => {
|
|
4441
4439
|
if (!style) {
|
|
4442
4440
|
return undefined;
|
|
4443
4441
|
}
|
|
4444
|
-
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);
|
|
4445
4443
|
};
|
|
4446
4444
|
const getBackgroundPadding = props => {
|
|
4447
4445
|
if (props.backgroundPadding && Array.isArray(props.backgroundPadding)) {
|
|
4448
4446
|
return props.backgroundPadding.map(backgroundPadding => {
|
|
4449
4447
|
const padding = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_3__.evaluateProp(backgroundPadding, props);
|
|
4450
|
-
return _victory_util_helpers__WEBPACK_IMPORTED_MODULE_3__.getPadding(
|
|
4451
|
-
padding
|
|
4452
|
-
});
|
|
4448
|
+
return _victory_util_helpers__WEBPACK_IMPORTED_MODULE_3__.getPadding(padding);
|
|
4453
4449
|
});
|
|
4454
4450
|
}
|
|
4455
4451
|
const padding = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_3__.evaluateProp(props.backgroundPadding, props);
|
|
4456
|
-
return _victory_util_helpers__WEBPACK_IMPORTED_MODULE_3__.getPadding(
|
|
4457
|
-
padding
|
|
4458
|
-
});
|
|
4452
|
+
return _victory_util_helpers__WEBPACK_IMPORTED_MODULE_3__.getPadding(padding);
|
|
4459
4453
|
};
|
|
4460
4454
|
const getLineHeight = props => {
|
|
4461
4455
|
const lineHeight = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_3__.evaluateProp(props.lineHeight, props);
|
|
4462
4456
|
if (Array.isArray(lineHeight)) {
|
|
4463
|
-
return
|
|
4457
|
+
return lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2___default()(lineHeight) ? [1] : lineHeight;
|
|
4464
4458
|
}
|
|
4465
4459
|
return lineHeight;
|
|
4466
4460
|
};
|
|
@@ -4580,7 +4574,7 @@ const getFullBackground = (calculatedProps, tspanValues) => {
|
|
|
4580
4574
|
x: inline ? xCoordinate - backgroundPadding.left : xCoordinate + dx - backgroundPadding.left,
|
|
4581
4575
|
y: yCoordinate
|
|
4582
4576
|
};
|
|
4583
|
-
return /*#__PURE__*/
|
|
4577
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(backgroundComponent, lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, backgroundComponent.props, backgroundProps));
|
|
4584
4578
|
};
|
|
4585
4579
|
const getInlineXOffset = (calculatedProps, textElements, index) => {
|
|
4586
4580
|
const {
|
|
@@ -4650,7 +4644,7 @@ const getChildBackgrounds = (calculatedProps, tspanValues) => {
|
|
|
4650
4644
|
x: xCoord - padding.left,
|
|
4651
4645
|
y: yCoord
|
|
4652
4646
|
};
|
|
4653
|
-
return /*#__PURE__*/
|
|
4647
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(backgroundComponent, lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, backgroundComponent.props, backgroundProps));
|
|
4654
4648
|
});
|
|
4655
4649
|
};
|
|
4656
4650
|
const getBackgroundElement = (calculatedProps, tspanValues) => {
|
|
@@ -4781,16 +4775,16 @@ const renderLabel = (calculatedProps, tspanValues) => {
|
|
|
4781
4775
|
style: currentStyle,
|
|
4782
4776
|
children: line
|
|
4783
4777
|
};
|
|
4784
|
-
return /*#__PURE__*/
|
|
4778
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(tspanComponent, tspanProps);
|
|
4785
4779
|
});
|
|
4786
|
-
return /*#__PURE__*/
|
|
4780
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(textComponent, textProps, tspans);
|
|
4787
4781
|
};
|
|
4788
4782
|
const defaultProps = {
|
|
4789
|
-
backgroundComponent: /*#__PURE__*/
|
|
4790
|
-
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),
|
|
4791
4785
|
direction: "inherit",
|
|
4792
|
-
textComponent: /*#__PURE__*/
|
|
4793
|
-
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),
|
|
4794
4788
|
capHeight: 0.71,
|
|
4795
4789
|
// Magic number from d3.
|
|
4796
4790
|
lineHeight: 1
|
|
@@ -4827,10 +4821,10 @@ const VictoryLabel = initialProps => {
|
|
|
4827
4821
|
if (props.backgroundStyle) {
|
|
4828
4822
|
const backgroundElement = getBackgroundElement(calculatedProps, tspanValues);
|
|
4829
4823
|
const children = [backgroundElement, label];
|
|
4830
|
-
const backgroundWithLabel = /*#__PURE__*/
|
|
4831
|
-
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;
|
|
4832
4826
|
}
|
|
4833
|
-
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;
|
|
4834
4828
|
};
|
|
4835
4829
|
VictoryLabel.displayName = "VictoryLabel";
|
|
4836
4830
|
VictoryLabel.role = "label";
|
|
@@ -4902,12 +4896,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4902
4896
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4903
4897
|
/* harmony export */ "VictoryPortal": function() { return /* binding */ VictoryPortal; }
|
|
4904
4898
|
/* harmony export */ });
|
|
4905
|
-
/* harmony import */ var
|
|
4906
|
-
/* 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__);
|
|
4907
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");
|
|
4908
4902
|
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
|
|
4909
|
-
/* harmony import */ var
|
|
4910
|
-
/* 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__);
|
|
4911
4905
|
/* harmony import */ var _victory_util_log__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-util/log */ "../../victory-core/es/victory-util/log.js");
|
|
4912
4906
|
/* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
4913
4907
|
/* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
|
|
@@ -4918,14 +4912,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4918
4912
|
|
|
4919
4913
|
|
|
4920
4914
|
const defaultProps = {
|
|
4921
|
-
groupComponent: /*#__PURE__*/
|
|
4915
|
+
groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("g", null)
|
|
4922
4916
|
};
|
|
4923
4917
|
const VictoryPortal = initialProps => {
|
|
4924
4918
|
const props = {
|
|
4925
4919
|
...defaultProps,
|
|
4926
4920
|
...initialProps
|
|
4927
4921
|
};
|
|
4928
|
-
const [id] = (0,
|
|
4922
|
+
const [id] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_2___default()());
|
|
4929
4923
|
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_3__.usePortalContext)();
|
|
4930
4924
|
if (!portalContext) {
|
|
4931
4925
|
const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
|
|
@@ -4943,12 +4937,12 @@ const VictoryPortal = initialProps => {
|
|
|
4943
4937
|
const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_5__.omit(props, ["children", "groupComponent"]), {
|
|
4944
4938
|
key: childProps.key ?? id
|
|
4945
4939
|
});
|
|
4946
|
-
const child = children && /*#__PURE__*/
|
|
4947
|
-
|
|
4940
|
+
const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(children, newProps);
|
|
4941
|
+
react__WEBPACK_IMPORTED_MODULE_0___default().useEffect(() => {
|
|
4948
4942
|
portalContext?.addChild(id, child);
|
|
4949
4943
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4950
4944
|
}, [props.children]);
|
|
4951
|
-
|
|
4945
|
+
react__WEBPACK_IMPORTED_MODULE_0___default().useEffect(() => {
|
|
4952
4946
|
return () => portalContext?.removeChild(id);
|
|
4953
4947
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4954
4948
|
}, []);
|
|
@@ -6275,40 +6269,45 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6275
6269
|
/* harmony export */ "reduceChildren": function() { return /* binding */ reduceChildren; },
|
|
6276
6270
|
/* harmony export */ "scalePoint": function() { return /* binding */ scalePoint; }
|
|
6277
6271
|
/* harmony export */ });
|
|
6278
|
-
/* harmony import */ var
|
|
6279
|
-
/* harmony import */ var
|
|
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
|
-
|
|
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__);
|
|
6287
6280
|
|
|
6288
6281
|
|
|
6289
6282
|
|
|
6290
|
-
// Private Functions
|
|
6291
6283
|
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6284
|
+
/**
|
|
6285
|
+
* Determine the range of a cartesian axis
|
|
6286
|
+
*/
|
|
6287
|
+
function getCartesianRange(options) {
|
|
6288
|
+
const vertical = options.axis !== "x";
|
|
6296
6289
|
if (vertical) {
|
|
6297
|
-
return [
|
|
6290
|
+
return [options.height - options.padding.bottom, options.padding.top];
|
|
6298
6291
|
}
|
|
6299
|
-
return [padding.left,
|
|
6292
|
+
return [options.padding.left, options.width - options.padding.right];
|
|
6300
6293
|
}
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
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);
|
|
6305
6302
|
return [startAngle, endAngle];
|
|
6306
6303
|
}
|
|
6307
|
-
return [
|
|
6304
|
+
return [options.innerRadius || 0, getRadius({
|
|
6305
|
+
height: options.height,
|
|
6306
|
+
width: options.width,
|
|
6307
|
+
padding: options.padding
|
|
6308
|
+
})];
|
|
6308
6309
|
}
|
|
6309
6310
|
|
|
6310
|
-
// Exported Functions
|
|
6311
|
-
|
|
6312
6311
|
/**
|
|
6313
6312
|
* Creates an object composed of the inverted keys and values of object.
|
|
6314
6313
|
* If object contains duplicate values, subsequent values overwrite property assignments of previous values.
|
|
@@ -6345,8 +6344,11 @@ function omit(originalObject, ks) {
|
|
|
6345
6344
|
}
|
|
6346
6345
|
return newObject;
|
|
6347
6346
|
}
|
|
6347
|
+
|
|
6348
|
+
/**
|
|
6349
|
+
* Coalesce the x and y values from a data point
|
|
6350
|
+
*/
|
|
6348
6351
|
function getPoint(datum) {
|
|
6349
|
-
const exists = val => val !== undefined;
|
|
6350
6352
|
const {
|
|
6351
6353
|
_x,
|
|
6352
6354
|
_x1,
|
|
@@ -6357,16 +6359,20 @@ function getPoint(datum) {
|
|
|
6357
6359
|
_y0,
|
|
6358
6360
|
_voronoiY
|
|
6359
6361
|
} = datum;
|
|
6360
|
-
const defaultX =
|
|
6361
|
-
const defaultY =
|
|
6362
|
+
const defaultX = _x1 ?? _x;
|
|
6363
|
+
const defaultY = _y1 ?? _y;
|
|
6362
6364
|
const point = {
|
|
6363
|
-
x:
|
|
6364
|
-
x0:
|
|
6365
|
-
y:
|
|
6366
|
-
y0:
|
|
6365
|
+
x: _voronoiX ?? defaultX,
|
|
6366
|
+
x0: _x0 ?? _x,
|
|
6367
|
+
y: _voronoiY ?? defaultY,
|
|
6368
|
+
y0: _y0 ?? _y
|
|
6367
6369
|
};
|
|
6368
|
-
return
|
|
6370
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, point, datum);
|
|
6369
6371
|
}
|
|
6372
|
+
|
|
6373
|
+
/**
|
|
6374
|
+
* Scale a point based on the origin, direction, and given scale function
|
|
6375
|
+
*/
|
|
6370
6376
|
function scalePoint(props, datum) {
|
|
6371
6377
|
const {
|
|
6372
6378
|
scale,
|
|
@@ -6389,11 +6395,11 @@ function scalePoint(props, datum) {
|
|
|
6389
6395
|
y0: polar ? -y0 * Math.sin(x0) + origin.x : y0
|
|
6390
6396
|
};
|
|
6391
6397
|
}
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6398
|
+
|
|
6399
|
+
/**
|
|
6400
|
+
* Returns a padding value from a number or partial padding values
|
|
6401
|
+
*/
|
|
6402
|
+
function getPadding(padding) {
|
|
6397
6403
|
const paddingVal = typeof padding === "number" ? padding : 0;
|
|
6398
6404
|
const paddingObj = typeof padding === "object" ? padding : {};
|
|
6399
6405
|
return {
|
|
@@ -6403,6 +6409,10 @@ function getPadding(props, name) {
|
|
|
6403
6409
|
right: paddingObj.right || paddingVal
|
|
6404
6410
|
};
|
|
6405
6411
|
}
|
|
6412
|
+
|
|
6413
|
+
/**
|
|
6414
|
+
* Returns true if the component is defined as a tooltip
|
|
6415
|
+
*/
|
|
6406
6416
|
function isTooltip(component) {
|
|
6407
6417
|
const labelRole = component && component.type && component.type.role;
|
|
6408
6418
|
return labelRole === "tooltip";
|
|
@@ -6417,8 +6427,8 @@ function getDefaultStyles(props, role) {
|
|
|
6417
6427
|
return defaultStyles;
|
|
6418
6428
|
}
|
|
6419
6429
|
const tooltipStyle = theme.tooltip && theme.tooltip.style || {};
|
|
6420
|
-
const labelStyle =
|
|
6421
|
-
return
|
|
6430
|
+
const labelStyle = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, tooltipStyle, defaultStyles.labels);
|
|
6431
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, {
|
|
6422
6432
|
labels: labelStyle
|
|
6423
6433
|
}, defaultStyles);
|
|
6424
6434
|
}
|
|
@@ -6426,7 +6436,7 @@ function getStyles(style, defaultStyles) {
|
|
|
6426
6436
|
const width = "100%";
|
|
6427
6437
|
const height = "100%";
|
|
6428
6438
|
if (!style) {
|
|
6429
|
-
return
|
|
6439
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({
|
|
6430
6440
|
parent: {
|
|
6431
6441
|
height,
|
|
6432
6442
|
width
|
|
@@ -6442,14 +6452,18 @@ function getStyles(style, defaultStyles) {
|
|
|
6442
6452
|
const defaultLabels = defaultStyles && defaultStyles.labels || {};
|
|
6443
6453
|
const defaultData = defaultStyles && defaultStyles.data || {};
|
|
6444
6454
|
return {
|
|
6445
|
-
parent:
|
|
6455
|
+
parent: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, parent, defaultParent, {
|
|
6446
6456
|
width,
|
|
6447
6457
|
height
|
|
6448
6458
|
}),
|
|
6449
|
-
labels:
|
|
6450
|
-
data:
|
|
6459
|
+
labels: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labels, defaultLabels),
|
|
6460
|
+
data: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, data, defaultData)
|
|
6451
6461
|
};
|
|
6452
6462
|
}
|
|
6463
|
+
|
|
6464
|
+
/**
|
|
6465
|
+
* Returns the value of a prop or accessor function with the given props
|
|
6466
|
+
*/
|
|
6453
6467
|
function evaluateProp(prop, props) {
|
|
6454
6468
|
return isFunction(prop) ? prop(props) : prop;
|
|
6455
6469
|
}
|
|
@@ -6471,19 +6485,28 @@ function degreesToRadians(degrees) {
|
|
|
6471
6485
|
function radiansToDegrees(radians) {
|
|
6472
6486
|
return typeof radians === "number" ? radians / (Math.PI / 180) : radians;
|
|
6473
6487
|
}
|
|
6474
|
-
|
|
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;
|
|
6475
6498
|
const {
|
|
6476
6499
|
left,
|
|
6477
6500
|
right,
|
|
6478
6501
|
top,
|
|
6479
6502
|
bottom
|
|
6480
|
-
} =
|
|
6481
|
-
const {
|
|
6482
|
-
width,
|
|
6483
|
-
height
|
|
6484
|
-
} = props;
|
|
6503
|
+
} = padding;
|
|
6485
6504
|
return Math.min(width - left - right, height - top - bottom) / 2;
|
|
6486
6505
|
}
|
|
6506
|
+
|
|
6507
|
+
/**
|
|
6508
|
+
* Returns the origin for a polar chart within the padded area
|
|
6509
|
+
*/
|
|
6487
6510
|
function getPolarOrigin(props) {
|
|
6488
6511
|
const {
|
|
6489
6512
|
width,
|
|
@@ -6494,7 +6517,7 @@ function getPolarOrigin(props) {
|
|
|
6494
6517
|
bottom,
|
|
6495
6518
|
left,
|
|
6496
6519
|
right
|
|
6497
|
-
} = getPadding(props);
|
|
6520
|
+
} = getPadding(props.padding);
|
|
6498
6521
|
const radius = Math.min(width - left - right, height - top - bottom) / 2;
|
|
6499
6522
|
const offsetWidth = width / 2 + left - right;
|
|
6500
6523
|
const offsetHeight = height / 2 + top - bottom;
|
|
@@ -6503,13 +6526,30 @@ function getPolarOrigin(props) {
|
|
|
6503
6526
|
y: offsetHeight + radius > height ? radius + top - bottom : offsetHeight
|
|
6504
6527
|
};
|
|
6505
6528
|
}
|
|
6529
|
+
|
|
6530
|
+
/**
|
|
6531
|
+
* Determine the range of an axis based on the given props
|
|
6532
|
+
*/
|
|
6506
6533
|
function getRange(props, axis) {
|
|
6507
6534
|
if (props.range && props.range[axis]) {
|
|
6508
6535
|
return props.range[axis];
|
|
6509
6536
|
} else if (props.range && Array.isArray(props.range)) {
|
|
6510
6537
|
return props.range;
|
|
6511
6538
|
}
|
|
6512
|
-
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
|
+
});
|
|
6513
6553
|
}
|
|
6514
6554
|
|
|
6515
6555
|
/**
|
|
@@ -6541,7 +6581,7 @@ function createAccessor(key) {
|
|
|
6541
6581
|
return x => x;
|
|
6542
6582
|
}
|
|
6543
6583
|
// otherwise, assume it is an array index, property key or path (_.property handles all three)
|
|
6544
|
-
return
|
|
6584
|
+
return lodash_property__WEBPACK_IMPORTED_MODULE_2___default()(key);
|
|
6545
6585
|
}
|
|
6546
6586
|
function modifyProps(props, fallbackProps, role) {
|
|
6547
6587
|
const theme = props.theme && props.theme[role] ? props.theme[role] : {};
|
|
@@ -6550,7 +6590,7 @@ function modifyProps(props, fallbackProps, role) {
|
|
|
6550
6590
|
const defaultObject = horizontal === undefined ? {} : {
|
|
6551
6591
|
horizontal
|
|
6552
6592
|
};
|
|
6553
|
-
return
|
|
6593
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()(defaultObject, props, themeProps, fallbackProps);
|
|
6554
6594
|
}
|
|
6555
6595
|
|
|
6556
6596
|
/**
|
|
@@ -6637,10 +6677,10 @@ initialMemo, combine) {
|
|
|
6637
6677
|
const childRole = child.type && child.type.role;
|
|
6638
6678
|
const childName = child.props.name || `${childRole}-${names[index]}`;
|
|
6639
6679
|
if (child.props && child.props.children) {
|
|
6640
|
-
const childProps = Object.assign({}, child.props,
|
|
6641
|
-
const nestedChildren = child.type && child.type.role === "stack" && isFunction(child.type.getChildren) ? child.type.getChildren(childProps) :
|
|
6642
|
-
const nestedChildProps = Object.assign({}, c.props,
|
|
6643
|
-
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);
|
|
6644
6684
|
});
|
|
6645
6685
|
const childNames = nestedChildren.map((c, i) => `${childName}-${i}`);
|
|
6646
6686
|
const nestedResults = traverseChildren(nestedChildren, childNames, child);
|
|
@@ -6654,7 +6694,7 @@ initialMemo, combine) {
|
|
|
6654
6694
|
return newMemo;
|
|
6655
6695
|
}, initialMemo);
|
|
6656
6696
|
};
|
|
6657
|
-
const validChildren = children.filter(
|
|
6697
|
+
const validChildren = children.filter(react__WEBPACK_IMPORTED_MODULE_0__.isValidElement);
|
|
6658
6698
|
const childNames = validChildren.map((c, i) => i);
|
|
6659
6699
|
return traverseChildren(validChildren, childNames);
|
|
6660
6700
|
}
|
|
@@ -6674,10 +6714,10 @@ function isHorizontal(props) {
|
|
|
6674
6714
|
if (memo || childProps.horizontal || !childProps.children) {
|
|
6675
6715
|
return memo || childProps.horizontal;
|
|
6676
6716
|
}
|
|
6677
|
-
return traverseChildren(
|
|
6717
|
+
return traverseChildren(react__WEBPACK_IMPORTED_MODULE_0___default().Children.toArray(childProps.children));
|
|
6678
6718
|
}, false);
|
|
6679
6719
|
};
|
|
6680
|
-
return traverseChildren(
|
|
6720
|
+
return traverseChildren(react__WEBPACK_IMPORTED_MODULE_0___default().Children.toArray(props.children));
|
|
6681
6721
|
}
|
|
6682
6722
|
|
|
6683
6723
|
/***/ }),
|
|
@@ -6698,9 +6738,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6698
6738
|
/* harmony export */ "getProps": function() { return /* binding */ getProps; },
|
|
6699
6739
|
/* harmony export */ "getText": function() { return /* binding */ getText; }
|
|
6700
6740
|
/* harmony export */ });
|
|
6741
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
6701
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");
|
|
6702
6743
|
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_0__);
|
|
6703
|
-
|
|
6744
|
+
|
|
6704
6745
|
|
|
6705
6746
|
|
|
6706
6747
|
// Private Functions
|
|
@@ -6946,11 +6987,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6946
6987
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6947
6988
|
/* harmony export */ "warn": function() { return /* binding */ warn; }
|
|
6948
6989
|
/* harmony export */ });
|
|
6949
|
-
/* global console */
|
|
6990
|
+
/* global console process */
|
|
6950
6991
|
/* eslint-disable no-console */
|
|
6951
6992
|
|
|
6952
|
-
// TODO: Use "warning" npm module like React is switching to.
|
|
6953
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
|
|
6954
6996
|
if (true) {
|
|
6955
6997
|
if (console && console.warn) {
|
|
6956
6998
|
console.warn(message);
|
|
@@ -7059,13 +7101,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7059
7101
|
/* harmony export */ "approximateTextSize": function() { return /* binding */ approximateTextSize; },
|
|
7060
7102
|
/* harmony export */ "convertLengthToPixels": function() { return /* binding */ convertLengthToPixels; }
|
|
7061
7103
|
/* harmony export */ });
|
|
7062
|
-
/* harmony import */ var
|
|
7063
|
-
/* harmony import */ var
|
|
7064
|
-
/* harmony import */ var
|
|
7065
|
-
/* harmony import */ var
|
|
7066
|
-
|
|
7067
|
-
// 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
|
|
7068
7109
|
/* eslint-disable no-magic-numbers */
|
|
7110
|
+
|
|
7111
|
+
|
|
7112
|
+
|
|
7069
7113
|
// Based on measuring specific character widths
|
|
7070
7114
|
// as in the following example https://bl.ocks.org/tophtucker/62f93a4658387bb61e4510c37e2e97cf
|
|
7071
7115
|
// For new fonts: pull gist, open index.html locally, add font files (if not generic), enter font name in `font-family` input
|
|
@@ -7244,7 +7288,7 @@ const convertLengthToPixels = (length, fontSize) => {
|
|
|
7244
7288
|
};
|
|
7245
7289
|
const _prepareParams = (inputStyle, index) => {
|
|
7246
7290
|
const lineStyle = Array.isArray(inputStyle) ? inputStyle[index] : inputStyle;
|
|
7247
|
-
const style =
|
|
7291
|
+
const style = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, lineStyle, defaultStyle);
|
|
7248
7292
|
return Object.assign({}, style, {
|
|
7249
7293
|
fontFamily: style.fontFamily,
|
|
7250
7294
|
letterSpacing: typeof style.letterSpacing === "number" ? style.letterSpacing : convertLengthToPixels(String(style.letterSpacing), style.fontSize),
|
|
@@ -7292,7 +7336,7 @@ const _approximateDimensionsInternal = (text, style) => {
|
|
|
7292
7336
|
height: heightWithRotate * coefficients.heightOverlapCoef
|
|
7293
7337
|
};
|
|
7294
7338
|
};
|
|
7295
|
-
const _getMeasurementContainer =
|
|
7339
|
+
const _getMeasurementContainer = lodash_memoize__WEBPACK_IMPORTED_MODULE_1___default()(() => {
|
|
7296
7340
|
const element = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
7297
7341
|
element.setAttribute("xlink", "http://www.w3.org/1999/xlink");
|
|
7298
7342
|
element.setAttribute("width", "300");
|
|
@@ -7313,7 +7357,7 @@ const styleToKeyComponent = style => {
|
|
|
7313
7357
|
}
|
|
7314
7358
|
return `${style.angle}:${style.fontFamily}:${style.fontSize}:${style.letterSpacing}:${style.lineHeight}`;
|
|
7315
7359
|
};
|
|
7316
|
-
const _measureDimensionsInternal =
|
|
7360
|
+
const _measureDimensionsInternal = lodash_memoize__WEBPACK_IMPORTED_MODULE_1___default()((text, style) => {
|
|
7317
7361
|
let containerElement = _getMeasurementContainer();
|
|
7318
7362
|
if (!containerElement.isConnected) {
|
|
7319
7363
|
_getMeasurementContainer.cache.clear?.();
|