victory-cursor-container 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-cursor-container.js +194 -152
- package/dist/victory-cursor-container.min.js +1 -1
- package/es/cursor-helpers.d.ts +0 -1
- package/es/cursor-helpers.js +2 -2
- package/es/victory-cursor-container.d.ts +36 -36
- package/es/victory-cursor-container.js +7 -9
- package/lib/cursor-helpers.d.ts +0 -1
- package/lib/cursor-helpers.js +2 -2
- package/lib/victory-cursor-container.d.ts +36 -36
- package/lib/victory-cursor-container.js +7 -10
- package/package.json +6 -38
- package/src/cursor-helpers.tsx +1 -1
- package/src/victory-cursor-container.tsx +3 -4
|
@@ -22,10 +22,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
22
22
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
23
23
|
/* harmony export */ "CursorHelpers": function() { return /* binding */ CursorHelpers; }
|
|
24
24
|
/* harmony export */ });
|
|
25
|
-
/* harmony import */ var lodash_throttle__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/throttle */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/throttle.js");
|
|
26
|
-
/* harmony import */ var lodash_throttle__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_throttle__WEBPACK_IMPORTED_MODULE_0__);
|
|
27
25
|
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/helpers.js");
|
|
28
26
|
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/selection.js");
|
|
27
|
+
/* harmony import */ var lodash_throttle__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/throttle */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/throttle.js");
|
|
28
|
+
/* harmony import */ var lodash_throttle__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_throttle__WEBPACK_IMPORTED_MODULE_0__);
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
const ON_MOUSE_MOVE_THROTTLE_MS = 16;
|
|
@@ -143,30 +143,29 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
143
143
|
/* harmony export */ "VictoryCursorContainer": function() { return /* binding */ VictoryCursorContainer; },
|
|
144
144
|
/* harmony export */ "useVictoryCursorContainer": function() { return /* binding */ useVictoryCursorContainer; }
|
|
145
145
|
/* harmony export */ });
|
|
146
|
-
/* harmony import */ var
|
|
147
|
-
/* harmony import */ var
|
|
148
|
-
/* 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");
|
|
149
|
-
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
|
|
150
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "react");
|
|
151
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
|
|
146
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
147
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
152
148
|
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-label/victory-label.js");
|
|
153
149
|
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-primitives/line-segment.js");
|
|
154
150
|
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/helpers.js");
|
|
155
151
|
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
|
|
152
|
+
/* 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");
|
|
153
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
|
|
154
|
+
/* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/isObject */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js");
|
|
155
|
+
/* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_isObject__WEBPACK_IMPORTED_MODULE_2__);
|
|
156
156
|
/* harmony import */ var _cursor_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./cursor-helpers */ "./cursor-helpers.tsx");
|
|
157
157
|
|
|
158
158
|
|
|
159
|
-
/* eslint-disable complexity */
|
|
160
159
|
|
|
161
160
|
|
|
162
161
|
|
|
163
162
|
const VICTORY_CURSOR_CONTAINER_DEFAULT_PROPS = {
|
|
164
|
-
cursorLabelComponent: /*#__PURE__*/
|
|
163
|
+
cursorLabelComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_3__.VictoryLabel, null),
|
|
165
164
|
cursorLabelOffset: {
|
|
166
165
|
x: 5,
|
|
167
166
|
y: -10
|
|
168
167
|
},
|
|
169
|
-
cursorComponent: /*#__PURE__*/
|
|
168
|
+
cursorComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_4__.LineSegment, null)
|
|
170
169
|
};
|
|
171
170
|
const useVictoryCursorContainer = initialProps => {
|
|
172
171
|
const props = {
|
|
@@ -212,14 +211,13 @@ const useVictoryCursorContainer = initialProps => {
|
|
|
212
211
|
const getPadding = () => {
|
|
213
212
|
if (props.padding === undefined) {
|
|
214
213
|
const child = Array.isArray(props.children) ? props.children.find(c => {
|
|
215
|
-
return
|
|
214
|
+
return lodash_isObject__WEBPACK_IMPORTED_MODULE_2___default()(c.props) && c.props.padding !== undefined;
|
|
216
215
|
}) : props.children;
|
|
217
216
|
return victory_core__WEBPACK_IMPORTED_MODULE_5__.getPadding(child?.props);
|
|
218
217
|
}
|
|
219
|
-
return victory_core__WEBPACK_IMPORTED_MODULE_5__.getPadding(props);
|
|
218
|
+
return victory_core__WEBPACK_IMPORTED_MODULE_5__.getPadding(props.padding);
|
|
220
219
|
};
|
|
221
220
|
const getCursorElements = () => {
|
|
222
|
-
// eslint-disable-line max-statements
|
|
223
221
|
const {
|
|
224
222
|
scale,
|
|
225
223
|
cursorLabelComponent,
|
|
@@ -260,7 +258,7 @@ const useVictoryCursorContainer = initialProps => {
|
|
|
260
258
|
const tooltipTheme = theme && theme.tooltip || {};
|
|
261
259
|
labelProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelProps, tooltipTheme);
|
|
262
260
|
}
|
|
263
|
-
newElements.push( /*#__PURE__*/
|
|
261
|
+
newElements.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(cursorLabelComponent, lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelProps, {
|
|
264
262
|
text: victory_core__WEBPACK_IMPORTED_MODULE_5__.evaluateProp(cursorLabel, labelProps)
|
|
265
263
|
})));
|
|
266
264
|
}
|
|
@@ -268,7 +266,7 @@ const useVictoryCursorContainer = initialProps => {
|
|
|
268
266
|
stroke: "black"
|
|
269
267
|
}, cursorComponent.props.style);
|
|
270
268
|
if (cursorDimension === "x" || cursorDimension === undefined) {
|
|
271
|
-
newElements.push( /*#__PURE__*/
|
|
269
|
+
newElements.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(cursorComponent, {
|
|
272
270
|
key: `${name}-x-cursor`,
|
|
273
271
|
x1: cursorCoordinates.x,
|
|
274
272
|
x2: cursorCoordinates.x,
|
|
@@ -278,7 +276,7 @@ const useVictoryCursorContainer = initialProps => {
|
|
|
278
276
|
}));
|
|
279
277
|
}
|
|
280
278
|
if (cursorDimension === "y" || cursorDimension === undefined) {
|
|
281
|
-
newElements.push( /*#__PURE__*/
|
|
279
|
+
newElements.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(cursorComponent, {
|
|
282
280
|
key: `${name}-y-cursor`,
|
|
283
281
|
x1: padding.left,
|
|
284
282
|
x2: (typeof width === "number" ? width : 0) - padding.right,
|
|
@@ -291,7 +289,7 @@ const useVictoryCursorContainer = initialProps => {
|
|
|
291
289
|
};
|
|
292
290
|
return {
|
|
293
291
|
props,
|
|
294
|
-
children: [...
|
|
292
|
+
children: [...react__WEBPACK_IMPORTED_MODULE_0___default().Children.toArray(children), ...getCursorElements()]
|
|
295
293
|
};
|
|
296
294
|
};
|
|
297
295
|
const VictoryCursorContainer = initialProps => {
|
|
@@ -299,7 +297,7 @@ const VictoryCursorContainer = initialProps => {
|
|
|
299
297
|
props,
|
|
300
298
|
children
|
|
301
299
|
} = useVictoryCursorContainer(initialProps);
|
|
302
|
-
return /*#__PURE__*/
|
|
300
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_7__.VictoryContainer, props, children);
|
|
303
301
|
};
|
|
304
302
|
VictoryCursorContainer.role = "container";
|
|
305
303
|
VictoryCursorContainer.defaultEvents = initialProps => {
|
|
@@ -2982,16 +2980,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2982
2980
|
/* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
|
|
2983
2981
|
/* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
|
|
2984
2982
|
/* harmony export */ });
|
|
2985
|
-
/* harmony import */ var
|
|
2986
|
-
/* harmony import */ var
|
|
2987
|
-
/* harmony import */ var
|
|
2988
|
-
/* harmony import */ var
|
|
2983
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
2984
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
2985
|
+
/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/uniqueId */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/uniqueId.js");
|
|
2986
|
+
/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1__);
|
|
2989
2987
|
/* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
|
|
2990
2988
|
/* harmony import */ var _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../victory-util/user-props */ "../../victory-core/es/victory-util/user-props.js");
|
|
2991
2989
|
/* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
|
|
2992
2990
|
/* harmony import */ var _victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-portal/portal-outlet */ "../../victory-core/es/victory-portal/portal-outlet.js");
|
|
2993
2991
|
/* harmony import */ var _victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-portal/portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
|
|
2994
|
-
|
|
2995
2992
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2996
2993
|
|
|
2997
2994
|
|
|
@@ -2999,9 +2996,10 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
2999
2996
|
|
|
3000
2997
|
|
|
3001
2998
|
|
|
2999
|
+
|
|
3002
3000
|
const defaultProps = {
|
|
3003
3001
|
className: "VictoryContainer",
|
|
3004
|
-
portalComponent: /*#__PURE__*/
|
|
3002
|
+
portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__.Portal, null),
|
|
3005
3003
|
portalZIndex: 99,
|
|
3006
3004
|
responsive: true,
|
|
3007
3005
|
role: "img"
|
|
@@ -3018,10 +3016,10 @@ function useVictoryContainer(initialProps) {
|
|
|
3018
3016
|
height,
|
|
3019
3017
|
responsive
|
|
3020
3018
|
} = props;
|
|
3021
|
-
const localContainerRef = (0,
|
|
3019
|
+
const localContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
3022
3020
|
|
|
3023
3021
|
// Generated ID stored in ref because it needs to persist across renders
|
|
3024
|
-
const generatedId = (0,
|
|
3022
|
+
const generatedId = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default()("victory-container-"));
|
|
3025
3023
|
const containerId = props.containerId ?? generatedId.current;
|
|
3026
3024
|
const getIdForElement = elName => `${containerId}-${elName}`;
|
|
3027
3025
|
const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
|
|
@@ -3080,7 +3078,7 @@ const VictoryContainer = initialProps => {
|
|
|
3080
3078
|
containerRef,
|
|
3081
3079
|
localContainerRef
|
|
3082
3080
|
} = useVictoryContainer(initialProps);
|
|
3083
|
-
|
|
3081
|
+
react__WEBPACK_IMPORTED_MODULE_0___default().useEffect(() => {
|
|
3084
3082
|
if (!events?.onWheel) return;
|
|
3085
3083
|
const handleWheel = e => e.preventDefault();
|
|
3086
3084
|
const container = localContainerRef?.current;
|
|
@@ -3090,21 +3088,21 @@ const VictoryContainer = initialProps => {
|
|
|
3090
3088
|
};
|
|
3091
3089
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3092
3090
|
}, []);
|
|
3093
|
-
return /*#__PURE__*/
|
|
3091
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
3094
3092
|
className: className,
|
|
3095
3093
|
style: {
|
|
3096
3094
|
...style,
|
|
3097
3095
|
width: responsive ? style?.width : dimensions.width,
|
|
3098
3096
|
height: responsive ? style?.height : dimensions.height,
|
|
3099
|
-
pointerEvents: "none",
|
|
3100
|
-
touchAction: "none",
|
|
3101
|
-
position: "relative"
|
|
3097
|
+
pointerEvents: style?.pointerEvents ?? "none",
|
|
3098
|
+
touchAction: style?.touchAction ?? "none",
|
|
3099
|
+
position: style?.position ?? "relative"
|
|
3102
3100
|
},
|
|
3103
3101
|
"data-ouia-component-id": ouiaId,
|
|
3104
3102
|
"data-ouia-component-type": ouiaType,
|
|
3105
3103
|
"data-ouia-safe": ouiaSafe,
|
|
3106
3104
|
ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_4__.mergeRefs)([localContainerRef, containerRef])
|
|
3107
|
-
}, /*#__PURE__*/
|
|
3105
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_5__.PortalProvider, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
|
|
3108
3106
|
width: width,
|
|
3109
3107
|
height: height,
|
|
3110
3108
|
tabIndex: tabIndex,
|
|
@@ -3117,11 +3115,11 @@ const VictoryContainer = initialProps => {
|
|
|
3117
3115
|
...dimensions,
|
|
3118
3116
|
pointerEvents: "all"
|
|
3119
3117
|
}
|
|
3120
|
-
}, userProps, events), title ? /*#__PURE__*/
|
|
3118
|
+
}, userProps, events), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("title", {
|
|
3121
3119
|
id: titleId
|
|
3122
|
-
}, title) : null, desc ? /*#__PURE__*/
|
|
3120
|
+
}, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("desc", {
|
|
3123
3121
|
id: descId
|
|
3124
|
-
}, desc) : null, children), /*#__PURE__*/
|
|
3122
|
+
}, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
3125
3123
|
style: {
|
|
3126
3124
|
...dimensions,
|
|
3127
3125
|
zIndex: portalZIndex,
|
|
@@ -3129,7 +3127,7 @@ const VictoryContainer = initialProps => {
|
|
|
3129
3127
|
top: 0,
|
|
3130
3128
|
left: 0
|
|
3131
3129
|
}
|
|
3132
|
-
}, /*#__PURE__*/
|
|
3130
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__.PortalOutlet, {
|
|
3133
3131
|
as: portalComponent,
|
|
3134
3132
|
width: width,
|
|
3135
3133
|
height: height,
|
|
@@ -3156,12 +3154,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3156
3154
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3157
3155
|
/* harmony export */ "VictoryLabel": function() { return /* binding */ VictoryLabel; }
|
|
3158
3156
|
/* harmony export */ });
|
|
3159
|
-
/* harmony import */ var
|
|
3160
|
-
/* harmony import */ var
|
|
3157
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
3158
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
3161
3159
|
/* 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");
|
|
3162
3160
|
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
|
|
3163
|
-
/* harmony import */ var
|
|
3164
|
-
/* harmony import */ var
|
|
3161
|
+
/* 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");
|
|
3162
|
+
/* harmony import */ var lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2__);
|
|
3165
3163
|
/* 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");
|
|
3166
3164
|
/* harmony import */ var _victory_primitives_rect__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../victory-primitives/rect */ "../../victory-core/es/victory-primitives/rect.js");
|
|
3167
3165
|
/* harmony import */ var _victory_primitives_text__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../victory-primitives/text */ "../../victory-core/es/victory-primitives/text.js");
|
|
@@ -3172,9 +3170,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3172
3170
|
/* harmony import */ var _victory_util_style__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/style */ "../../victory-core/es/victory-util/style.js");
|
|
3173
3171
|
/* harmony import */ var _victory_util_textsize__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../victory-util/textsize */ "../../victory-core/es/victory-util/textsize.js");
|
|
3174
3172
|
/* 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");
|
|
3173
|
+
/* eslint no-magic-numbers: ["error", { "ignore": [-0.5, 0.5, 0, 1, 2] }]*/
|
|
3175
3174
|
|
|
3176
3175
|
|
|
3177
|
-
/* eslint no-magic-numbers: ["error", { "ignore": [-0.5, 0.5, 0, 1, 2] }]*/
|
|
3178
3176
|
|
|
3179
3177
|
|
|
3180
3178
|
|
|
@@ -3226,7 +3224,7 @@ const shouldUseMultilineBackgrounds = props => {
|
|
|
3226
3224
|
backgroundStyle,
|
|
3227
3225
|
backgroundPadding
|
|
3228
3226
|
} = props;
|
|
3229
|
-
return Array.isArray(backgroundStyle) && !
|
|
3227
|
+
return Array.isArray(backgroundStyle) && !lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2___default()(backgroundStyle) || Array.isArray(backgroundPadding) && !lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2___default()(backgroundPadding);
|
|
3230
3228
|
};
|
|
3231
3229
|
const getStyles = (style, props) => {
|
|
3232
3230
|
if (props.disableInlineStyles) {
|
|
@@ -3242,32 +3240,28 @@ const getStyles = (style, props) => {
|
|
|
3242
3240
|
fontSize: getFontSize(baseStyles)
|
|
3243
3241
|
});
|
|
3244
3242
|
};
|
|
3245
|
-
return Array.isArray(style) && !
|
|
3243
|
+
return Array.isArray(style) && !lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2___default()(style) ? style.map(s => getSingleStyle(s)) : getSingleStyle(style);
|
|
3246
3244
|
};
|
|
3247
3245
|
const getBackgroundStyles = (style, props) => {
|
|
3248
3246
|
if (!style) {
|
|
3249
3247
|
return undefined;
|
|
3250
3248
|
}
|
|
3251
|
-
return Array.isArray(style) && !
|
|
3249
|
+
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);
|
|
3252
3250
|
};
|
|
3253
3251
|
const getBackgroundPadding = props => {
|
|
3254
3252
|
if (props.backgroundPadding && Array.isArray(props.backgroundPadding)) {
|
|
3255
3253
|
return props.backgroundPadding.map(backgroundPadding => {
|
|
3256
3254
|
const padding = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_3__.evaluateProp(backgroundPadding, props);
|
|
3257
|
-
return _victory_util_helpers__WEBPACK_IMPORTED_MODULE_3__.getPadding(
|
|
3258
|
-
padding
|
|
3259
|
-
});
|
|
3255
|
+
return _victory_util_helpers__WEBPACK_IMPORTED_MODULE_3__.getPadding(padding);
|
|
3260
3256
|
});
|
|
3261
3257
|
}
|
|
3262
3258
|
const padding = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_3__.evaluateProp(props.backgroundPadding, props);
|
|
3263
|
-
return _victory_util_helpers__WEBPACK_IMPORTED_MODULE_3__.getPadding(
|
|
3264
|
-
padding
|
|
3265
|
-
});
|
|
3259
|
+
return _victory_util_helpers__WEBPACK_IMPORTED_MODULE_3__.getPadding(padding);
|
|
3266
3260
|
};
|
|
3267
3261
|
const getLineHeight = props => {
|
|
3268
3262
|
const lineHeight = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_3__.evaluateProp(props.lineHeight, props);
|
|
3269
3263
|
if (Array.isArray(lineHeight)) {
|
|
3270
|
-
return
|
|
3264
|
+
return lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2___default()(lineHeight) ? [1] : lineHeight;
|
|
3271
3265
|
}
|
|
3272
3266
|
return lineHeight;
|
|
3273
3267
|
};
|
|
@@ -3387,7 +3381,7 @@ const getFullBackground = (calculatedProps, tspanValues) => {
|
|
|
3387
3381
|
x: inline ? xCoordinate - backgroundPadding.left : xCoordinate + dx - backgroundPadding.left,
|
|
3388
3382
|
y: yCoordinate
|
|
3389
3383
|
};
|
|
3390
|
-
return /*#__PURE__*/
|
|
3384
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(backgroundComponent, lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, backgroundComponent.props, backgroundProps));
|
|
3391
3385
|
};
|
|
3392
3386
|
const getInlineXOffset = (calculatedProps, textElements, index) => {
|
|
3393
3387
|
const {
|
|
@@ -3457,7 +3451,7 @@ const getChildBackgrounds = (calculatedProps, tspanValues) => {
|
|
|
3457
3451
|
x: xCoord - padding.left,
|
|
3458
3452
|
y: yCoord
|
|
3459
3453
|
};
|
|
3460
|
-
return /*#__PURE__*/
|
|
3454
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(backgroundComponent, lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, backgroundComponent.props, backgroundProps));
|
|
3461
3455
|
});
|
|
3462
3456
|
};
|
|
3463
3457
|
const getBackgroundElement = (calculatedProps, tspanValues) => {
|
|
@@ -3588,16 +3582,16 @@ const renderLabel = (calculatedProps, tspanValues) => {
|
|
|
3588
3582
|
style: currentStyle,
|
|
3589
3583
|
children: line
|
|
3590
3584
|
};
|
|
3591
|
-
return /*#__PURE__*/
|
|
3585
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(tspanComponent, tspanProps);
|
|
3592
3586
|
});
|
|
3593
|
-
return /*#__PURE__*/
|
|
3587
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(textComponent, textProps, tspans);
|
|
3594
3588
|
};
|
|
3595
3589
|
const defaultProps = {
|
|
3596
|
-
backgroundComponent: /*#__PURE__*/
|
|
3597
|
-
groupComponent: /*#__PURE__*/
|
|
3590
|
+
backgroundComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_victory_primitives_rect__WEBPACK_IMPORTED_MODULE_8__.Rect, null),
|
|
3591
|
+
groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("g", null),
|
|
3598
3592
|
direction: "inherit",
|
|
3599
|
-
textComponent: /*#__PURE__*/
|
|
3600
|
-
tspanComponent: /*#__PURE__*/
|
|
3593
|
+
textComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_victory_primitives_text__WEBPACK_IMPORTED_MODULE_9__.Text, null),
|
|
3594
|
+
tspanComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_victory_primitives_tspan__WEBPACK_IMPORTED_MODULE_10__.TSpan, null),
|
|
3601
3595
|
capHeight: 0.71,
|
|
3602
3596
|
// Magic number from d3.
|
|
3603
3597
|
lineHeight: 1
|
|
@@ -3634,10 +3628,10 @@ const VictoryLabel = initialProps => {
|
|
|
3634
3628
|
if (props.backgroundStyle) {
|
|
3635
3629
|
const backgroundElement = getBackgroundElement(calculatedProps, tspanValues);
|
|
3636
3630
|
const children = [backgroundElement, label];
|
|
3637
|
-
const backgroundWithLabel = /*#__PURE__*/
|
|
3638
|
-
return props.renderInPortal ? /*#__PURE__*/
|
|
3631
|
+
const backgroundWithLabel = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(props.groupComponent, {}, children);
|
|
3632
|
+
return props.renderInPortal ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_victory_portal_victory_portal__WEBPACK_IMPORTED_MODULE_12__.VictoryPortal, null, backgroundWithLabel) : backgroundWithLabel;
|
|
3639
3633
|
}
|
|
3640
|
-
return props.renderInPortal ? /*#__PURE__*/
|
|
3634
|
+
return props.renderInPortal ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_victory_portal_victory_portal__WEBPACK_IMPORTED_MODULE_12__.VictoryPortal, null, label) : label;
|
|
3641
3635
|
};
|
|
3642
3636
|
VictoryLabel.displayName = "VictoryLabel";
|
|
3643
3637
|
VictoryLabel.role = "label";
|
|
@@ -3763,12 +3757,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3763
3757
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3764
3758
|
/* harmony export */ "VictoryPortal": function() { return /* binding */ VictoryPortal; }
|
|
3765
3759
|
/* harmony export */ });
|
|
3766
|
-
/* harmony import */ var
|
|
3767
|
-
/* harmony import */ var
|
|
3760
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
3761
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
3768
3762
|
/* 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");
|
|
3769
3763
|
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
|
|
3770
|
-
/* harmony import */ var
|
|
3771
|
-
/* harmony import */ var
|
|
3764
|
+
/* 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");
|
|
3765
|
+
/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_2__);
|
|
3772
3766
|
/* harmony import */ var _victory_util_log__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-util/log */ "../../victory-core/es/victory-util/log.js");
|
|
3773
3767
|
/* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
3774
3768
|
/* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
|
|
@@ -3779,14 +3773,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3779
3773
|
|
|
3780
3774
|
|
|
3781
3775
|
const defaultProps = {
|
|
3782
|
-
groupComponent: /*#__PURE__*/
|
|
3776
|
+
groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("g", null)
|
|
3783
3777
|
};
|
|
3784
3778
|
const VictoryPortal = initialProps => {
|
|
3785
3779
|
const props = {
|
|
3786
3780
|
...defaultProps,
|
|
3787
3781
|
...initialProps
|
|
3788
3782
|
};
|
|
3789
|
-
const [id] = (0,
|
|
3783
|
+
const [id] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_2___default()());
|
|
3790
3784
|
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_3__.usePortalContext)();
|
|
3791
3785
|
if (!portalContext) {
|
|
3792
3786
|
const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
|
|
@@ -3804,12 +3798,12 @@ const VictoryPortal = initialProps => {
|
|
|
3804
3798
|
const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_5__.omit(props, ["children", "groupComponent"]), {
|
|
3805
3799
|
key: childProps.key ?? id
|
|
3806
3800
|
});
|
|
3807
|
-
const child = children && /*#__PURE__*/
|
|
3808
|
-
|
|
3801
|
+
const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(children, newProps);
|
|
3802
|
+
react__WEBPACK_IMPORTED_MODULE_0___default().useEffect(() => {
|
|
3809
3803
|
portalContext?.addChild(id, child);
|
|
3810
3804
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3811
3805
|
}, [props.children]);
|
|
3812
|
-
|
|
3806
|
+
react__WEBPACK_IMPORTED_MODULE_0___default().useEffect(() => {
|
|
3813
3807
|
return () => portalContext?.removeChild(id);
|
|
3814
3808
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3815
3809
|
}, []);
|
|
@@ -3830,10 +3824,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3830
3824
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3831
3825
|
/* harmony export */ "LineSegment": function() { return /* binding */ LineSegment; }
|
|
3832
3826
|
/* harmony export */ });
|
|
3833
|
-
/* harmony import */ var
|
|
3834
|
-
/* harmony import */ var
|
|
3835
|
-
/* harmony import */ var
|
|
3836
|
-
/* harmony import */ var
|
|
3827
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
3828
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
3829
|
+
/* 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");
|
|
3830
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
|
|
3837
3831
|
/* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
3838
3832
|
/* harmony import */ var _line__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./line */ "../../victory-core/es/victory-primitives/line.js");
|
|
3839
3833
|
|
|
@@ -3865,13 +3859,13 @@ const evaluateProps = props => {
|
|
|
3865
3859
|
});
|
|
3866
3860
|
};
|
|
3867
3861
|
const defaultProps = {
|
|
3868
|
-
lineComponent: /*#__PURE__*/
|
|
3862
|
+
lineComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_line__WEBPACK_IMPORTED_MODULE_3__.Line, null),
|
|
3869
3863
|
role: "presentation",
|
|
3870
3864
|
shapeRendering: "auto"
|
|
3871
3865
|
};
|
|
3872
3866
|
const LineSegment = initialProps => {
|
|
3873
|
-
const props = evaluateProps(
|
|
3874
|
-
return /*#__PURE__*/
|
|
3867
|
+
const props = evaluateProps(lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, initialProps, defaultProps));
|
|
3868
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(props.lineComponent, {
|
|
3875
3869
|
...props.events,
|
|
3876
3870
|
"aria-label": props.ariaLabel,
|
|
3877
3871
|
style: props.style,
|
|
@@ -5281,41 +5275,45 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
5281
5275
|
/* harmony export */ "reduceChildren": function() { return /* binding */ reduceChildren; },
|
|
5282
5276
|
/* harmony export */ "scalePoint": function() { return /* binding */ scalePoint; }
|
|
5283
5277
|
/* harmony export */ });
|
|
5284
|
-
/* harmony import */ var
|
|
5285
|
-
/* harmony import */ var
|
|
5286
|
-
/* harmony import */ var
|
|
5287
|
-
/* harmony import */ var
|
|
5288
|
-
/* harmony import */ var
|
|
5289
|
-
/* harmony import */ var
|
|
5290
|
-
/* harmony import */ var
|
|
5291
|
-
/* harmony import */ var
|
|
5292
|
-
|
|
5278
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
5279
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
5280
|
+
/* 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");
|
|
5281
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
|
|
5282
|
+
/* 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");
|
|
5283
|
+
/* harmony import */ var lodash_property__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_property__WEBPACK_IMPORTED_MODULE_2__);
|
|
5284
|
+
/* 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");
|
|
5285
|
+
/* harmony import */ var lodash_pick__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_pick__WEBPACK_IMPORTED_MODULE_3__);
|
|
5293
5286
|
|
|
5294
5287
|
|
|
5295
|
-
/* eslint-disable no-use-before-define */
|
|
5296
5288
|
|
|
5297
|
-
// Private Functions
|
|
5298
5289
|
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5290
|
+
/**
|
|
5291
|
+
* Determine the range of a cartesian axis
|
|
5292
|
+
*/
|
|
5293
|
+
function getCartesianRange(options) {
|
|
5294
|
+
const vertical = options.axis !== "x";
|
|
5303
5295
|
if (vertical) {
|
|
5304
|
-
return [
|
|
5296
|
+
return [options.height - options.padding.bottom, options.padding.top];
|
|
5305
5297
|
}
|
|
5306
|
-
return [padding.left,
|
|
5298
|
+
return [options.padding.left, options.width - options.padding.right];
|
|
5307
5299
|
}
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5300
|
+
|
|
5301
|
+
/**
|
|
5302
|
+
* Determine the range of a polar axis in radians
|
|
5303
|
+
*/
|
|
5304
|
+
function getPolarRange(options) {
|
|
5305
|
+
if (options.axis === "x") {
|
|
5306
|
+
const startAngle = degreesToRadians(options.startAngle || 0);
|
|
5307
|
+
const endAngle = degreesToRadians(options.endAngle || 360);
|
|
5312
5308
|
return [startAngle, endAngle];
|
|
5313
5309
|
}
|
|
5314
|
-
return [
|
|
5310
|
+
return [options.innerRadius || 0, getRadius({
|
|
5311
|
+
height: options.height,
|
|
5312
|
+
width: options.width,
|
|
5313
|
+
padding: options.padding
|
|
5314
|
+
})];
|
|
5315
5315
|
}
|
|
5316
5316
|
|
|
5317
|
-
// Exported Functions
|
|
5318
|
-
|
|
5319
5317
|
/**
|
|
5320
5318
|
* Creates an object composed of the inverted keys and values of object.
|
|
5321
5319
|
* If object contains duplicate values, subsequent values overwrite property assignments of previous values.
|
|
@@ -5352,8 +5350,11 @@ function omit(originalObject, ks) {
|
|
|
5352
5350
|
}
|
|
5353
5351
|
return newObject;
|
|
5354
5352
|
}
|
|
5353
|
+
|
|
5354
|
+
/**
|
|
5355
|
+
* Coalesce the x and y values from a data point
|
|
5356
|
+
*/
|
|
5355
5357
|
function getPoint(datum) {
|
|
5356
|
-
const exists = val => val !== undefined;
|
|
5357
5358
|
const {
|
|
5358
5359
|
_x,
|
|
5359
5360
|
_x1,
|
|
@@ -5364,16 +5365,20 @@ function getPoint(datum) {
|
|
|
5364
5365
|
_y0,
|
|
5365
5366
|
_voronoiY
|
|
5366
5367
|
} = datum;
|
|
5367
|
-
const defaultX =
|
|
5368
|
-
const defaultY =
|
|
5368
|
+
const defaultX = _x1 ?? _x;
|
|
5369
|
+
const defaultY = _y1 ?? _y;
|
|
5369
5370
|
const point = {
|
|
5370
|
-
x:
|
|
5371
|
-
x0:
|
|
5372
|
-
y:
|
|
5373
|
-
y0:
|
|
5371
|
+
x: _voronoiX ?? defaultX,
|
|
5372
|
+
x0: _x0 ?? _x,
|
|
5373
|
+
y: _voronoiY ?? defaultY,
|
|
5374
|
+
y0: _y0 ?? _y
|
|
5374
5375
|
};
|
|
5375
|
-
return
|
|
5376
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, point, datum);
|
|
5376
5377
|
}
|
|
5378
|
+
|
|
5379
|
+
/**
|
|
5380
|
+
* Scale a point based on the origin, direction, and given scale function
|
|
5381
|
+
*/
|
|
5377
5382
|
function scalePoint(props, datum) {
|
|
5378
5383
|
const {
|
|
5379
5384
|
scale,
|
|
@@ -5396,11 +5401,11 @@ function scalePoint(props, datum) {
|
|
|
5396
5401
|
y0: polar ? -y0 * Math.sin(x0) + origin.x : y0
|
|
5397
5402
|
};
|
|
5398
5403
|
}
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
+
|
|
5405
|
+
/**
|
|
5406
|
+
* Returns a padding value from a number or partial padding values
|
|
5407
|
+
*/
|
|
5408
|
+
function getPadding(padding) {
|
|
5404
5409
|
const paddingVal = typeof padding === "number" ? padding : 0;
|
|
5405
5410
|
const paddingObj = typeof padding === "object" ? padding : {};
|
|
5406
5411
|
return {
|
|
@@ -5410,6 +5415,10 @@ function getPadding(props, name) {
|
|
|
5410
5415
|
right: paddingObj.right || paddingVal
|
|
5411
5416
|
};
|
|
5412
5417
|
}
|
|
5418
|
+
|
|
5419
|
+
/**
|
|
5420
|
+
* Returns true if the component is defined as a tooltip
|
|
5421
|
+
*/
|
|
5413
5422
|
function isTooltip(component) {
|
|
5414
5423
|
const labelRole = component && component.type && component.type.role;
|
|
5415
5424
|
return labelRole === "tooltip";
|
|
@@ -5424,8 +5433,8 @@ function getDefaultStyles(props, role) {
|
|
|
5424
5433
|
return defaultStyles;
|
|
5425
5434
|
}
|
|
5426
5435
|
const tooltipStyle = theme.tooltip && theme.tooltip.style || {};
|
|
5427
|
-
const labelStyle =
|
|
5428
|
-
return
|
|
5436
|
+
const labelStyle = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, tooltipStyle, defaultStyles.labels);
|
|
5437
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, {
|
|
5429
5438
|
labels: labelStyle
|
|
5430
5439
|
}, defaultStyles);
|
|
5431
5440
|
}
|
|
@@ -5433,7 +5442,7 @@ function getStyles(style, defaultStyles) {
|
|
|
5433
5442
|
const width = "100%";
|
|
5434
5443
|
const height = "100%";
|
|
5435
5444
|
if (!style) {
|
|
5436
|
-
return
|
|
5445
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({
|
|
5437
5446
|
parent: {
|
|
5438
5447
|
height,
|
|
5439
5448
|
width
|
|
@@ -5449,14 +5458,18 @@ function getStyles(style, defaultStyles) {
|
|
|
5449
5458
|
const defaultLabels = defaultStyles && defaultStyles.labels || {};
|
|
5450
5459
|
const defaultData = defaultStyles && defaultStyles.data || {};
|
|
5451
5460
|
return {
|
|
5452
|
-
parent:
|
|
5461
|
+
parent: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, parent, defaultParent, {
|
|
5453
5462
|
width,
|
|
5454
5463
|
height
|
|
5455
5464
|
}),
|
|
5456
|
-
labels:
|
|
5457
|
-
data:
|
|
5465
|
+
labels: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labels, defaultLabels),
|
|
5466
|
+
data: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, data, defaultData)
|
|
5458
5467
|
};
|
|
5459
5468
|
}
|
|
5469
|
+
|
|
5470
|
+
/**
|
|
5471
|
+
* Returns the value of a prop or accessor function with the given props
|
|
5472
|
+
*/
|
|
5460
5473
|
function evaluateProp(prop, props) {
|
|
5461
5474
|
return isFunction(prop) ? prop(props) : prop;
|
|
5462
5475
|
}
|
|
@@ -5478,19 +5491,28 @@ function degreesToRadians(degrees) {
|
|
|
5478
5491
|
function radiansToDegrees(radians) {
|
|
5479
5492
|
return typeof radians === "number" ? radians / (Math.PI / 180) : radians;
|
|
5480
5493
|
}
|
|
5481
|
-
|
|
5494
|
+
|
|
5495
|
+
/**
|
|
5496
|
+
* Get the maximum radius that will fit in the container
|
|
5497
|
+
*/
|
|
5498
|
+
function getRadius(options) {
|
|
5499
|
+
const {
|
|
5500
|
+
width,
|
|
5501
|
+
height,
|
|
5502
|
+
padding
|
|
5503
|
+
} = options;
|
|
5482
5504
|
const {
|
|
5483
5505
|
left,
|
|
5484
5506
|
right,
|
|
5485
5507
|
top,
|
|
5486
5508
|
bottom
|
|
5487
|
-
} =
|
|
5488
|
-
const {
|
|
5489
|
-
width,
|
|
5490
|
-
height
|
|
5491
|
-
} = props;
|
|
5509
|
+
} = padding;
|
|
5492
5510
|
return Math.min(width - left - right, height - top - bottom) / 2;
|
|
5493
5511
|
}
|
|
5512
|
+
|
|
5513
|
+
/**
|
|
5514
|
+
* Returns the origin for a polar chart within the padded area
|
|
5515
|
+
*/
|
|
5494
5516
|
function getPolarOrigin(props) {
|
|
5495
5517
|
const {
|
|
5496
5518
|
width,
|
|
@@ -5501,7 +5523,7 @@ function getPolarOrigin(props) {
|
|
|
5501
5523
|
bottom,
|
|
5502
5524
|
left,
|
|
5503
5525
|
right
|
|
5504
|
-
} = getPadding(props);
|
|
5526
|
+
} = getPadding(props.padding);
|
|
5505
5527
|
const radius = Math.min(width - left - right, height - top - bottom) / 2;
|
|
5506
5528
|
const offsetWidth = width / 2 + left - right;
|
|
5507
5529
|
const offsetHeight = height / 2 + top - bottom;
|
|
@@ -5510,13 +5532,30 @@ function getPolarOrigin(props) {
|
|
|
5510
5532
|
y: offsetHeight + radius > height ? radius + top - bottom : offsetHeight
|
|
5511
5533
|
};
|
|
5512
5534
|
}
|
|
5535
|
+
|
|
5536
|
+
/**
|
|
5537
|
+
* Determine the range of an axis based on the given props
|
|
5538
|
+
*/
|
|
5513
5539
|
function getRange(props, axis) {
|
|
5514
5540
|
if (props.range && props.range[axis]) {
|
|
5515
5541
|
return props.range[axis];
|
|
5516
5542
|
} else if (props.range && Array.isArray(props.range)) {
|
|
5517
5543
|
return props.range;
|
|
5518
5544
|
}
|
|
5519
|
-
return props.polar ? getPolarRange(
|
|
5545
|
+
return props.polar ? getPolarRange({
|
|
5546
|
+
axis,
|
|
5547
|
+
innerRadius: props.innerRadius,
|
|
5548
|
+
startAngle: props.startAngle,
|
|
5549
|
+
endAngle: props.endAngle,
|
|
5550
|
+
height: props.height,
|
|
5551
|
+
width: props.width,
|
|
5552
|
+
padding: getPadding(props.padding)
|
|
5553
|
+
}) : getCartesianRange({
|
|
5554
|
+
axis,
|
|
5555
|
+
height: props.height,
|
|
5556
|
+
width: props.width,
|
|
5557
|
+
padding: getPadding(props.padding)
|
|
5558
|
+
});
|
|
5520
5559
|
}
|
|
5521
5560
|
|
|
5522
5561
|
/**
|
|
@@ -5548,7 +5587,7 @@ function createAccessor(key) {
|
|
|
5548
5587
|
return x => x;
|
|
5549
5588
|
}
|
|
5550
5589
|
// otherwise, assume it is an array index, property key or path (_.property handles all three)
|
|
5551
|
-
return
|
|
5590
|
+
return lodash_property__WEBPACK_IMPORTED_MODULE_2___default()(key);
|
|
5552
5591
|
}
|
|
5553
5592
|
function modifyProps(props, fallbackProps, role) {
|
|
5554
5593
|
const theme = props.theme && props.theme[role] ? props.theme[role] : {};
|
|
@@ -5557,7 +5596,7 @@ function modifyProps(props, fallbackProps, role) {
|
|
|
5557
5596
|
const defaultObject = horizontal === undefined ? {} : {
|
|
5558
5597
|
horizontal
|
|
5559
5598
|
};
|
|
5560
|
-
return
|
|
5599
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()(defaultObject, props, themeProps, fallbackProps);
|
|
5561
5600
|
}
|
|
5562
5601
|
|
|
5563
5602
|
/**
|
|
@@ -5644,10 +5683,10 @@ initialMemo, combine) {
|
|
|
5644
5683
|
const childRole = child.type && child.type.role;
|
|
5645
5684
|
const childName = child.props.name || `${childRole}-${names[index]}`;
|
|
5646
5685
|
if (child.props && child.props.children) {
|
|
5647
|
-
const childProps = Object.assign({}, child.props,
|
|
5648
|
-
const nestedChildren = child.type && child.type.role === "stack" && isFunction(child.type.getChildren) ? child.type.getChildren(childProps) :
|
|
5649
|
-
const nestedChildProps = Object.assign({}, c.props,
|
|
5650
|
-
return /*#__PURE__*/
|
|
5686
|
+
const childProps = Object.assign({}, child.props, lodash_pick__WEBPACK_IMPORTED_MODULE_3___default()(parentProps, sharedProps));
|
|
5687
|
+
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 => {
|
|
5688
|
+
const nestedChildProps = Object.assign({}, c.props, lodash_pick__WEBPACK_IMPORTED_MODULE_3___default()(childProps, sharedProps));
|
|
5689
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(c, nestedChildProps);
|
|
5651
5690
|
});
|
|
5652
5691
|
const childNames = nestedChildren.map((c, i) => `${childName}-${i}`);
|
|
5653
5692
|
const nestedResults = traverseChildren(nestedChildren, childNames, child);
|
|
@@ -5661,7 +5700,7 @@ initialMemo, combine) {
|
|
|
5661
5700
|
return newMemo;
|
|
5662
5701
|
}, initialMemo);
|
|
5663
5702
|
};
|
|
5664
|
-
const validChildren = children.filter(
|
|
5703
|
+
const validChildren = children.filter(react__WEBPACK_IMPORTED_MODULE_0__.isValidElement);
|
|
5665
5704
|
const childNames = validChildren.map((c, i) => i);
|
|
5666
5705
|
return traverseChildren(validChildren, childNames);
|
|
5667
5706
|
}
|
|
@@ -5681,10 +5720,10 @@ function isHorizontal(props) {
|
|
|
5681
5720
|
if (memo || childProps.horizontal || !childProps.children) {
|
|
5682
5721
|
return memo || childProps.horizontal;
|
|
5683
5722
|
}
|
|
5684
|
-
return traverseChildren(
|
|
5723
|
+
return traverseChildren(react__WEBPACK_IMPORTED_MODULE_0___default().Children.toArray(childProps.children));
|
|
5685
5724
|
}, false);
|
|
5686
5725
|
};
|
|
5687
|
-
return traverseChildren(
|
|
5726
|
+
return traverseChildren(react__WEBPACK_IMPORTED_MODULE_0___default().Children.toArray(props.children));
|
|
5688
5727
|
}
|
|
5689
5728
|
|
|
5690
5729
|
/***/ }),
|
|
@@ -5705,11 +5744,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
5705
5744
|
/* harmony export */ "getProps": function() { return /* binding */ getProps; },
|
|
5706
5745
|
/* harmony export */ "getText": function() { return /* binding */ getText; }
|
|
5707
5746
|
/* harmony export */ });
|
|
5747
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
5708
5748
|
/* 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");
|
|
5709
5749
|
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_0__);
|
|
5710
|
-
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
5711
5750
|
|
|
5712
|
-
|
|
5751
|
+
|
|
5713
5752
|
|
|
5714
5753
|
// Private Functions
|
|
5715
5754
|
|
|
@@ -5954,11 +5993,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
5954
5993
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5955
5994
|
/* harmony export */ "warn": function() { return /* binding */ warn; }
|
|
5956
5995
|
/* harmony export */ });
|
|
5957
|
-
/* global console */
|
|
5996
|
+
/* global console process */
|
|
5958
5997
|
/* eslint-disable no-console */
|
|
5959
5998
|
|
|
5960
|
-
// TODO: Use "warning" npm module like React is switching to.
|
|
5961
5999
|
function warn(message) {
|
|
6000
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6001
|
+
// @ts-ignore - Webpack DefinePlugin will replace process.env.NODE_ENV
|
|
5962
6002
|
if (true) {
|
|
5963
6003
|
if (console && console.warn) {
|
|
5964
6004
|
console.warn(message);
|
|
@@ -6236,13 +6276,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6236
6276
|
/* harmony export */ "approximateTextSize": function() { return /* binding */ approximateTextSize; },
|
|
6237
6277
|
/* harmony export */ "convertLengthToPixels": function() { return /* binding */ convertLengthToPixels; }
|
|
6238
6278
|
/* harmony export */ });
|
|
6239
|
-
/* harmony import */ var
|
|
6240
|
-
/* harmony import */ var
|
|
6241
|
-
/* harmony import */ var
|
|
6242
|
-
/* harmony import */ var
|
|
6243
|
-
|
|
6244
|
-
// http://www.pearsonified.com/2012/01/characters-per-line.php
|
|
6279
|
+
/* 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");
|
|
6280
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_0__);
|
|
6281
|
+
/* 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");
|
|
6282
|
+
/* harmony import */ var lodash_memoize__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_memoize__WEBPACK_IMPORTED_MODULE_1__);
|
|
6283
|
+
// http://www.pearsonified.com/2012/01/characters-per-line.php
|
|
6245
6284
|
/* eslint-disable no-magic-numbers */
|
|
6285
|
+
|
|
6286
|
+
|
|
6287
|
+
|
|
6246
6288
|
// Based on measuring specific character widths
|
|
6247
6289
|
// as in the following example https://bl.ocks.org/tophtucker/62f93a4658387bb61e4510c37e2e97cf
|
|
6248
6290
|
// For new fonts: pull gist, open index.html locally, add font files (if not generic), enter font name in `font-family` input
|
|
@@ -6421,7 +6463,7 @@ const convertLengthToPixels = (length, fontSize) => {
|
|
|
6421
6463
|
};
|
|
6422
6464
|
const _prepareParams = (inputStyle, index) => {
|
|
6423
6465
|
const lineStyle = Array.isArray(inputStyle) ? inputStyle[index] : inputStyle;
|
|
6424
|
-
const style =
|
|
6466
|
+
const style = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, lineStyle, defaultStyle);
|
|
6425
6467
|
return Object.assign({}, style, {
|
|
6426
6468
|
fontFamily: style.fontFamily,
|
|
6427
6469
|
letterSpacing: typeof style.letterSpacing === "number" ? style.letterSpacing : convertLengthToPixels(String(style.letterSpacing), style.fontSize),
|
|
@@ -6469,7 +6511,7 @@ const _approximateDimensionsInternal = (text, style) => {
|
|
|
6469
6511
|
height: heightWithRotate * coefficients.heightOverlapCoef
|
|
6470
6512
|
};
|
|
6471
6513
|
};
|
|
6472
|
-
const _getMeasurementContainer =
|
|
6514
|
+
const _getMeasurementContainer = lodash_memoize__WEBPACK_IMPORTED_MODULE_1___default()(() => {
|
|
6473
6515
|
const element = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
6474
6516
|
element.setAttribute("xlink", "http://www.w3.org/1999/xlink");
|
|
6475
6517
|
element.setAttribute("width", "300");
|
|
@@ -6490,7 +6532,7 @@ const styleToKeyComponent = style => {
|
|
|
6490
6532
|
}
|
|
6491
6533
|
return `${style.angle}:${style.fontFamily}:${style.fontSize}:${style.letterSpacing}:${style.lineHeight}`;
|
|
6492
6534
|
};
|
|
6493
|
-
const _measureDimensionsInternal =
|
|
6535
|
+
const _measureDimensionsInternal = lodash_memoize__WEBPACK_IMPORTED_MODULE_1___default()((text, style) => {
|
|
6494
6536
|
let containerElement = _getMeasurementContainer();
|
|
6495
6537
|
if (!containerElement.isConnected) {
|
|
6496
6538
|
_getMeasurementContainer.cache.clear?.();
|