victory-create-container 37.0.1 → 37.0.3-next.0

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.
@@ -11,37 +11,34 @@
11
11
  return /******/ (function() { // webpackBootstrap
12
12
  /******/ var __webpack_modules__ = ({
13
13
 
14
- /***/ "./create-container.ts":
15
- /*!*****************************!*\
16
- !*** ./create-container.ts ***!
17
- \*****************************/
14
+ /***/ "./create-container.tsx":
15
+ /*!******************************!*\
16
+ !*** ./create-container.tsx ***!
17
+ \******************************/
18
18
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
19
19
 
20
20
  "use strict";
21
21
  __webpack_require__.r(__webpack_exports__);
22
22
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
23
- /* harmony export */ "combineContainerMixins": function() { return /* binding */ combineContainerMixins; },
24
23
  /* harmony export */ "createContainer": function() { return /* binding */ createContainer; },
25
24
  /* harmony export */ "makeCreateContainerFunction": function() { return /* binding */ makeCreateContainerFunction; }
26
25
  /* harmony export */ });
27
- /* harmony import */ var lodash_isEmpty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/isEmpty */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isEmpty.js");
28
- /* harmony import */ var lodash_isEmpty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_isEmpty__WEBPACK_IMPORTED_MODULE_0__);
29
- /* harmony import */ var lodash_flow__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/flow */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/flow.js");
30
- /* harmony import */ var lodash_flow__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_flow__WEBPACK_IMPORTED_MODULE_1__);
31
- /* harmony import */ var lodash_forOwn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/forOwn */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/forOwn.js");
32
- /* harmony import */ var lodash_forOwn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_forOwn__WEBPACK_IMPORTED_MODULE_2__);
33
- /* harmony import */ var lodash_groupBy__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash/groupBy */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/groupBy.js");
34
- /* harmony import */ var lodash_groupBy__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_groupBy__WEBPACK_IMPORTED_MODULE_3__);
35
- /* harmony import */ var lodash_toPairs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lodash/toPairs */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toPairs.js");
36
- /* harmony import */ var lodash_toPairs__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash_toPairs__WEBPACK_IMPORTED_MODULE_4__);
37
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/helpers.js");
38
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/log.js");
39
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
40
- /* harmony import */ var victory_voronoi_container__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! victory-voronoi-container */ "../../victory-voronoi-container/es/victory-voronoi-container.js");
41
- /* harmony import */ var victory_zoom_container__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! victory-zoom-container */ "../../victory-zoom-container/es/victory-zoom-container.js");
42
- /* harmony import */ var victory_selection_container__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! victory-selection-container */ "../../victory-selection-container/es/victory-selection-container.js");
43
- /* harmony import */ var victory_brush_container__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! victory-brush-container */ "../../victory-brush-container/es/victory-brush-container.js");
44
- /* harmony import */ var victory_cursor_container__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! victory-cursor-container */ "../../victory-cursor-container/es/victory-cursor-container.js");
26
+ /* harmony import */ var lodash_toPairs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/toPairs */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toPairs.js");
27
+ /* harmony import */ var lodash_toPairs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_toPairs__WEBPACK_IMPORTED_MODULE_0__);
28
+ /* harmony import */ var lodash_isEmpty__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/isEmpty */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isEmpty.js");
29
+ /* harmony import */ var lodash_isEmpty__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_isEmpty__WEBPACK_IMPORTED_MODULE_1__);
30
+ /* harmony import */ var lodash_groupBy__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/groupBy */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/groupBy.js");
31
+ /* harmony import */ var lodash_groupBy__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_groupBy__WEBPACK_IMPORTED_MODULE_2__);
32
+ /* harmony import */ var lodash_forOwn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash/forOwn */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/forOwn.js");
33
+ /* harmony import */ var lodash_forOwn__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_forOwn__WEBPACK_IMPORTED_MODULE_3__);
34
+ /* harmony import */ var victory_zoom_container__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! victory-zoom-container */ "../../victory-zoom-container/es/victory-zoom-container.js");
35
+ /* harmony import */ var victory_selection_container__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! victory-selection-container */ "../../victory-selection-container/es/victory-selection-container.js");
36
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ "react");
37
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);
38
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
39
+ /* harmony import */ var victory_voronoi_container__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! victory-voronoi-container */ "../../victory-voronoi-container/es/victory-voronoi-container.js");
40
+ /* harmony import */ var victory_cursor_container__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! victory-cursor-container */ "../../victory-cursor-container/es/victory-cursor-container.js");
41
+ /* harmony import */ var victory_brush_container__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! victory-brush-container */ "../../victory-brush-container/es/victory-brush-container.js");
45
42
 
46
43
 
47
44
 
@@ -65,7 +62,7 @@ const combineEventHandlers = eventHandlersArray => {
65
62
  // takes an array of event handler objects and produces one eventHandlers object
66
63
  // creates a custom combinedHandler() for events with multiple conflicting handlers
67
64
  return eventHandlersArray.reduce((localHandlers, finalHandlers) => {
68
- lodash_forOwn__WEBPACK_IMPORTED_MODULE_2___default()(localHandlers, (localHandler, eventName) => {
65
+ lodash_forOwn__WEBPACK_IMPORTED_MODULE_3___default()(localHandlers, (localHandler, eventName) => {
69
66
  const existingHandler = finalHandlers[eventName];
70
67
  if (existingHandler) {
71
68
  // create new handler for event that concats the existing handler's mutations with new ones
@@ -86,11 +83,11 @@ const combineEventHandlers = eventHandlersArray => {
86
83
  const combineDefaultEvents = defaultEvents => {
87
84
  // takes a defaultEvents array and returns one equal or lesser length,
88
85
  // by combining any events that have the same target
89
- const eventsByTarget = lodash_groupBy__WEBPACK_IMPORTED_MODULE_3___default()(defaultEvents, "target");
90
- const events = lodash_toPairs__WEBPACK_IMPORTED_MODULE_4___default()(eventsByTarget).map(_ref => {
86
+ const eventsByTarget = lodash_groupBy__WEBPACK_IMPORTED_MODULE_2___default()(defaultEvents, "target");
87
+ const events = lodash_toPairs__WEBPACK_IMPORTED_MODULE_0___default()(eventsByTarget).map(_ref => {
91
88
  let [target, eventsArray] = _ref;
92
89
  const newEventsArray = eventsArray.filter(Boolean);
93
- return lodash_isEmpty__WEBPACK_IMPORTED_MODULE_0___default()(newEventsArray) ? null : {
90
+ return lodash_isEmpty__WEBPACK_IMPORTED_MODULE_1___default()(newEventsArray) ? null : {
94
91
  target,
95
92
  eventHandlers: combineEventHandlers(eventsArray.map(event => event.eventHandlers))
96
93
  // note: does not currently handle eventKey or childName
@@ -98,68 +95,58 @@ const combineDefaultEvents = defaultEvents => {
98
95
  });
99
96
  return events.filter(Boolean);
100
97
  };
101
- const combineContainerMixins = (mixins, Container) => {
102
- // similar to Object.assign(A, B), this function will decide conflicts in favor mixinB.
103
- // this applies to propTypes and defaultProps.
104
- // getChildren will call A's getChildren() and pass the resulting children to B's.
105
- // defaultEvents attempts to resolve any conflicts between A and B's defaultEvents.
106
- const Classes = mixins.map(mixin => mixin(Container));
107
- const instances = Classes.map(Class => new Class());
108
- const NaiveCombinedContainer = lodash_flow__WEBPACK_IMPORTED_MODULE_1___default()(mixins)(Container);
109
- const displayType = Classes.map(Class => {
110
- const match = Class.displayName.match(/Victory(.*)Container/);
111
- return match[1] || "";
112
- }).join("");
113
- return class VictoryCombinedContainer extends NaiveCombinedContainer {
114
- static displayName = `Victory${displayType}Container`;
115
- static propTypes = Classes.reduce((propTypes, Class) => ({
116
- ...propTypes,
117
- ...Class.propTypes
118
- }), {});
119
- static defaultProps = Classes.reduce((defaultProps, Class) => ({
120
- ...defaultProps,
121
- ...Class.defaultProps
122
- }), {});
123
- static defaultEvents(props) {
124
- return combineDefaultEvents(Classes.reduce((defaultEvents, Class) => {
125
- const events = victory_core__WEBPACK_IMPORTED_MODULE_5__.isFunction(Class.defaultEvents) ? Class.defaultEvents(props) : Class.defaultEvents;
126
- return [...defaultEvents, ...events];
127
- }, []));
128
- }
129
- getChildren(props) {
130
- return instances.reduce((children, instance) => instance.getChildren({
131
- ...props,
132
- children
133
- }), props.children);
134
- }
135
- };
136
- };
137
- const checkBehaviorName = (behavior, behaviors) => {
138
- if (behavior && !behaviors.includes(behavior)) {
139
- victory_core__WEBPACK_IMPORTED_MODULE_6__.warn(`"${behavior}" is not a valid behavior. Choose from [${behaviors.join(", ")}].`);
140
- }
98
+ /**
99
+ * Container hooks are used to provide the container logic to the container components through props and a modified children object
100
+ * - These hooks contain shared logic for both web and Victory Native containers.
101
+ * - In this utility, we call multiple of these hooks with the props returned by the previous to combine the container logic.
102
+ */
103
+ const CONTAINER_HOOKS = {
104
+ zoom: victory_zoom_container__WEBPACK_IMPORTED_MODULE_5__.useVictoryZoomContainer,
105
+ selection: victory_selection_container__WEBPACK_IMPORTED_MODULE_6__.useVictorySelectionContainer,
106
+ brush: victory_brush_container__WEBPACK_IMPORTED_MODULE_7__.useVictoryBrushContainer,
107
+ cursor: victory_cursor_container__WEBPACK_IMPORTED_MODULE_8__.useVictoryCursorContainer,
108
+ voronoi: victory_voronoi_container__WEBPACK_IMPORTED_MODULE_9__.useVictoryVoronoiContainer
141
109
  };
142
- const makeCreateContainerFunction = (mixinMap, Container) => function (behaviorA, behaviorB) {
143
- const behaviors = Object.keys(mixinMap);
144
- checkBehaviorName(behaviorA, behaviors);
145
- checkBehaviorName(behaviorB, behaviors);
146
- if (arguments.length <= 2 ? 0 : arguments.length - 2) {
147
- victory_core__WEBPACK_IMPORTED_MODULE_6__.warn("too many arguments given to createContainer (maximum accepted: 2).");
148
- }
149
- const firstMixins = mixinMap[behaviorA];
150
- const secondMixins = mixinMap[behaviorB] || [];
151
- if (!firstMixins) {
152
- return Container;
153
- }
154
- return combineContainerMixins([...firstMixins, ...secondMixins], Container);
110
+
111
+ /**
112
+ * Container hooks are wrappers that return a VictoryContainer with the props provided by their respective hooks, and the modified children.
113
+ * - These containers are specific to the web. Victory Native has its own container components.
114
+ * - For this utility, we only need the container components to extract the defaultEvents.
115
+ */
116
+ const CONTAINER_COMPONENTS_WEB = {
117
+ zoom: victory_zoom_container__WEBPACK_IMPORTED_MODULE_5__.VictoryZoomContainer,
118
+ selection: victory_selection_container__WEBPACK_IMPORTED_MODULE_6__.VictorySelectionContainer,
119
+ brush: victory_brush_container__WEBPACK_IMPORTED_MODULE_7__.VictoryBrushContainer,
120
+ cursor: victory_cursor_container__WEBPACK_IMPORTED_MODULE_8__.VictoryCursorContainer,
121
+ voronoi: victory_voronoi_container__WEBPACK_IMPORTED_MODULE_9__.VictoryVoronoiContainer
155
122
  };
156
- const createContainer = makeCreateContainerFunction({
157
- zoom: [victory_zoom_container__WEBPACK_IMPORTED_MODULE_7__.zoomContainerMixin],
158
- voronoi: [victory_voronoi_container__WEBPACK_IMPORTED_MODULE_8__.voronoiContainerMixin],
159
- selection: [victory_selection_container__WEBPACK_IMPORTED_MODULE_9__.selectionContainerMixin],
160
- cursor: [victory_cursor_container__WEBPACK_IMPORTED_MODULE_10__.cursorContainerMixin],
161
- brush: [victory_brush_container__WEBPACK_IMPORTED_MODULE_11__.brushContainerMixin]
162
- }, victory_core__WEBPACK_IMPORTED_MODULE_12__.VictoryContainer);
123
+ function makeCreateContainerFunction(containerComponents, VictoryContainerBase) {
124
+ return function combineContainers(containerA, containerB) {
125
+ const ContainerA = containerComponents[containerA];
126
+ const ContainerB = containerComponents[containerB];
127
+ const useContainerA = CONTAINER_HOOKS[containerA];
128
+ const useContainerB = CONTAINER_HOOKS[containerB];
129
+ const CombinedContainer = props => {
130
+ const {
131
+ children: childrenA,
132
+ props: propsA
133
+ } = useContainerA(props);
134
+ const {
135
+ children: combinedChildren,
136
+ props: combinedProps
137
+ } = useContainerB({
138
+ ...propsA,
139
+ children: childrenA
140
+ });
141
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().createElement(VictoryContainerBase, combinedProps, combinedChildren);
142
+ };
143
+ CombinedContainer.displayName = `Victory${containerA}${containerB}Container`;
144
+ CombinedContainer.role = "container";
145
+ CombinedContainer.defaultEvents = props => combineDefaultEvents([...ContainerA.defaultEvents(props), ...ContainerB.defaultEvents(props)]);
146
+ return CombinedContainer;
147
+ };
148
+ }
149
+ const createContainer = makeCreateContainerFunction(CONTAINER_COMPONENTS_WEB, victory_core__WEBPACK_IMPORTED_MODULE_10__.VictoryContainer);
163
150
 
164
151
  /***/ }),
165
152
 
@@ -919,33 +906,6 @@ Delaunay.from = function (points, fx, fy, that) {
919
906
  return new Delaunay(flatArray(points, fx, fy, that));
920
907
  }; // only public methods will be .from and .find
921
908
 
922
- /***/ }),
923
-
924
- /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_LodashWrapper.js":
925
- /*!****************************************************************************************!*\
926
- !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_LodashWrapper.js ***!
927
- \****************************************************************************************/
928
- /***/ (function(module) {
929
-
930
- /**
931
- * This method returns `undefined`.
932
- *
933
- * @static
934
- * @memberOf _
935
- * @since 2.3.0
936
- * @category Util
937
- * @example
938
- *
939
- * _.times(2, _.noop);
940
- * // => [undefined, undefined]
941
- */
942
- function noop() {
943
- // No operation performed.
944
- }
945
-
946
- module.exports = noop;
947
-
948
-
949
909
  /***/ }),
950
910
 
951
911
  /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js":
@@ -2936,94 +2896,6 @@ function createBaseFor(fromRight) {
2936
2896
  module.exports = createBaseFor;
2937
2897
 
2938
2898
 
2939
- /***/ }),
2940
-
2941
- /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createFlow.js":
2942
- /*!*************************************************************************************!*\
2943
- !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createFlow.js ***!
2944
- \*************************************************************************************/
2945
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
2946
-
2947
- var LodashWrapper = __webpack_require__(/*! ./_LodashWrapper */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_LodashWrapper.js"),
2948
- flatRest = __webpack_require__(/*! ./_flatRest */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_flatRest.js"),
2949
- getData = __webpack_require__(/*! ./_getData */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getData.js"),
2950
- getFuncName = __webpack_require__(/*! ./_getFuncName */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getFuncName.js"),
2951
- isArray = __webpack_require__(/*! ./isArray */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArray.js"),
2952
- isLaziable = __webpack_require__(/*! ./_isLaziable */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isLaziable.js");
2953
-
2954
- /** Error message constants. */
2955
- var FUNC_ERROR_TEXT = 'Expected a function';
2956
-
2957
- /** Used to compose bitmasks for function metadata. */
2958
- var WRAP_CURRY_FLAG = 8,
2959
- WRAP_PARTIAL_FLAG = 32,
2960
- WRAP_ARY_FLAG = 128,
2961
- WRAP_REARG_FLAG = 256;
2962
-
2963
- /**
2964
- * Creates a `_.flow` or `_.flowRight` function.
2965
- *
2966
- * @private
2967
- * @param {boolean} [fromRight] Specify iterating from right to left.
2968
- * @returns {Function} Returns the new flow function.
2969
- */
2970
- function createFlow(fromRight) {
2971
- return flatRest(function(funcs) {
2972
- var length = funcs.length,
2973
- index = length,
2974
- prereq = LodashWrapper.prototype.thru;
2975
-
2976
- if (fromRight) {
2977
- funcs.reverse();
2978
- }
2979
- while (index--) {
2980
- var func = funcs[index];
2981
- if (typeof func != 'function') {
2982
- throw new TypeError(FUNC_ERROR_TEXT);
2983
- }
2984
- if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
2985
- var wrapper = new LodashWrapper([], true);
2986
- }
2987
- }
2988
- index = wrapper ? index : length;
2989
- while (++index < length) {
2990
- func = funcs[index];
2991
-
2992
- var funcName = getFuncName(func),
2993
- data = funcName == 'wrapper' ? getData(func) : undefined;
2994
-
2995
- if (data && isLaziable(data[0]) &&
2996
- data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
2997
- !data[4].length && data[9] == 1
2998
- ) {
2999
- wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
3000
- } else {
3001
- wrapper = (func.length == 1 && isLaziable(func))
3002
- ? wrapper[funcName]()
3003
- : wrapper.thru(func);
3004
- }
3005
- }
3006
- return function() {
3007
- var args = arguments,
3008
- value = args[0];
3009
-
3010
- if (wrapper && args.length == 1 && isArray(value)) {
3011
- return wrapper.plant(value).value();
3012
- }
3013
- var index = 0,
3014
- result = length ? funcs[index].apply(this, args) : value;
3015
-
3016
- while (++index < length) {
3017
- result = funcs[index].call(this, result);
3018
- }
3019
- return result;
3020
- };
3021
- });
3022
- }
3023
-
3024
- module.exports = createFlow;
3025
-
3026
-
3027
2899
  /***/ }),
3028
2900
 
3029
2901
  /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createSet.js":
@@ -3439,61 +3311,6 @@ function nativeKeysIn(object) {
3439
3311
  module.exports = nativeKeysIn;
3440
3312
 
3441
3313
 
3442
- /***/ }),
3443
-
3444
- /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getData.js":
3445
- /*!**********************************************************************************!*\
3446
- !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getData.js ***!
3447
- \**********************************************************************************/
3448
- /***/ (function(module) {
3449
-
3450
- /**
3451
- * This method returns `undefined`.
3452
- *
3453
- * @static
3454
- * @memberOf _
3455
- * @since 2.3.0
3456
- * @category Util
3457
- * @example
3458
- *
3459
- * _.times(2, _.noop);
3460
- * // => [undefined, undefined]
3461
- */
3462
- function noop() {
3463
- // No operation performed.
3464
- }
3465
-
3466
- module.exports = noop;
3467
-
3468
-
3469
- /***/ }),
3470
-
3471
- /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getFuncName.js":
3472
- /*!**************************************************************************************!*\
3473
- !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getFuncName.js ***!
3474
- \**************************************************************************************/
3475
- /***/ (function(module) {
3476
-
3477
- /**
3478
- * This method returns an empty string.
3479
- *
3480
- * @static
3481
- * @memberOf _
3482
- * @since 4.13.0
3483
- * @category Util
3484
- * @returns {string} Returns the empty string.
3485
- * @example
3486
- *
3487
- * _.times(2, _.stubString);
3488
- * // => ['', '']
3489
- */
3490
- function stubString() {
3491
- return '';
3492
- }
3493
-
3494
- module.exports = stubString;
3495
-
3496
-
3497
3314
  /***/ }),
3498
3315
 
3499
3316
  /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getMatchData.js":
@@ -3780,34 +3597,6 @@ function isKey(value, object) {
3780
3597
  module.exports = isKey;
3781
3598
 
3782
3599
 
3783
- /***/ }),
3784
-
3785
- /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isLaziable.js":
3786
- /*!*************************************************************************************!*\
3787
- !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isLaziable.js ***!
3788
- \*************************************************************************************/
3789
- /***/ (function(module) {
3790
-
3791
- /**
3792
- * This method returns `false`.
3793
- *
3794
- * @static
3795
- * @memberOf _
3796
- * @since 4.13.0
3797
- * @category Util
3798
- * @returns {boolean} Returns `false`.
3799
- * @example
3800
- *
3801
- * _.times(2, _.stubFalse);
3802
- * // => [false, false]
3803
- */
3804
- function stubFalse() {
3805
- return false;
3806
- }
3807
-
3808
- module.exports = stubFalse;
3809
-
3810
-
3811
3600
  /***/ }),
3812
3601
 
3813
3602
  /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isPrototype.js":
@@ -4831,43 +4620,6 @@ function flatten(array) {
4831
4620
  module.exports = flatten;
4832
4621
 
4833
4622
 
4834
- /***/ }),
4835
-
4836
- /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/flow.js":
4837
- /*!******************************************************************************!*\
4838
- !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/flow.js ***!
4839
- \******************************************************************************/
4840
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
4841
-
4842
- var createFlow = __webpack_require__(/*! ./_createFlow */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createFlow.js");
4843
-
4844
- /**
4845
- * Creates a function that returns the result of invoking the given functions
4846
- * with the `this` binding of the created function, where each successive
4847
- * invocation is supplied the return value of the previous.
4848
- *
4849
- * @static
4850
- * @memberOf _
4851
- * @since 3.0.0
4852
- * @category Util
4853
- * @param {...(Function|Function[])} [funcs] The functions to invoke.
4854
- * @returns {Function} Returns the new composite function.
4855
- * @see _.flowRight
4856
- * @example
4857
- *
4858
- * function square(n) {
4859
- * return n * n;
4860
- * }
4861
- *
4862
- * var addSquare = _.flow([_.add, square]);
4863
- * addSquare(1, 2);
4864
- * // => 9
4865
- */
4866
- var flow = createFlow();
4867
-
4868
- module.exports = flow;
4869
-
4870
-
4871
4623
  /***/ }),
4872
4624
 
4873
4625
  /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/forOwn.js":
@@ -7245,17 +6997,18 @@ const BrushHelpers = {
7245
6997
  "use strict";
7246
6998
  __webpack_require__.r(__webpack_exports__);
7247
6999
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7000
+ /* harmony export */ "VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS": function() { return /* binding */ VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS; },
7248
7001
  /* harmony export */ "VictoryBrushContainer": function() { return /* binding */ VictoryBrushContainer; },
7249
- /* harmony export */ "brushContainerMixin": function() { return /* binding */ brushContainerMixin; }
7002
+ /* harmony export */ "useVictoryBrushContainer": function() { return /* binding */ useVictoryBrushContainer; }
7250
7003
  /* harmony export */ });
7251
7004
  /* 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");
7252
7005
  /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_0__);
7253
7006
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
7254
7007
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
7255
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
7256
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-primitives/rect.js");
7257
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/selection.js");
7258
- /* harmony import */ var _brush_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./brush-helpers */ "../../victory-brush-container/es/brush-helpers.js");
7008
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-primitives/rect.js");
7009
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/selection.js");
7010
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
7011
+ /* harmony import */ var _brush_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./brush-helpers */ "../../victory-brush-container/es/brush-helpers.js");
7259
7012
  /* harmony import */ var react_fast_compare__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-fast-compare */ "../../../node_modules/.pnpm/react-fast-compare@3.2.0/node_modules/react-fast-compare/index.js");
7260
7013
  /* harmony import */ var react_fast_compare__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_fast_compare__WEBPACK_IMPORTED_MODULE_2__);
7261
7014
 
@@ -7263,203 +7016,207 @@ __webpack_require__.r(__webpack_exports__);
7263
7016
 
7264
7017
 
7265
7018
 
7266
- function brushContainerMixin(Base) {
7267
- // @ts-expect-error "TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'."
7268
- return class VictoryBrushContainer extends Base {
7269
- static displayName = "VictoryBrushContainer";
7270
- static defaultProps = {
7271
- ...victory_core__WEBPACK_IMPORTED_MODULE_3__.VictoryContainer.defaultProps,
7272
- allowDrag: true,
7273
- allowDraw: true,
7274
- allowResize: true,
7275
- brushComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_4__.Rect, null),
7276
- brushStyle: {
7277
- stroke: "transparent",
7278
- fill: "black",
7279
- fillOpacity: 0.1
7280
- },
7281
- handleComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_4__.Rect, null),
7282
- handleStyle: {
7283
- stroke: "transparent",
7284
- fill: "transparent"
7285
- },
7286
- handleWidth: 8,
7287
- mouseMoveThreshold: 0
7019
+ const VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS = {
7020
+ allowDrag: true,
7021
+ allowDraw: true,
7022
+ allowResize: true,
7023
+ brushComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_3__.Rect, null),
7024
+ brushStyle: {
7025
+ stroke: "transparent",
7026
+ fill: "black",
7027
+ fillOpacity: 0.1
7028
+ },
7029
+ handleComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_3__.Rect, null),
7030
+ handleStyle: {
7031
+ stroke: "transparent",
7032
+ fill: "transparent"
7033
+ },
7034
+ handleWidth: 8,
7035
+ mouseMoveThreshold: 0
7036
+ };
7037
+ const useVictoryBrushContainer = initialProps => {
7038
+ const props = {
7039
+ ...VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS,
7040
+ ...initialProps
7041
+ };
7042
+ const {
7043
+ children
7044
+ } = props;
7045
+ const getSelectBox = coordinates => {
7046
+ const {
7047
+ x,
7048
+ y
7049
+ } = coordinates;
7050
+ const {
7051
+ brushStyle,
7052
+ brushComponent,
7053
+ name
7054
+ } = props;
7055
+ const brushComponentStyle = brushComponent.props && brushComponent.props.style;
7056
+ const cursor = !props.allowDrag && !props.allowResize ? "auto" : "move";
7057
+ return x[0] !== x[1] && y[0] !== y[1] ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(brushComponent, {
7058
+ key: `${name}-brush`,
7059
+ width: Math.abs(x[1] - x[0]) || 1,
7060
+ height: Math.abs(y[1] - y[0]) || 1,
7061
+ x: Math.min(x[0], x[1]),
7062
+ y: Math.min(y[0], y[1]),
7063
+ cursor,
7064
+ style: lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, brushComponentStyle, brushStyle)
7065
+ }) : null;
7066
+ };
7067
+ const getCursorPointers = () => {
7068
+ const cursors = {
7069
+ yProps: "ns-resize",
7070
+ xProps: "ew-resize"
7288
7071
  };
7289
- static defaultEvents(props) {
7290
- return [{
7291
- target: "parent",
7292
- eventHandlers: {
7293
- onMouseDown: (evt, targetProps) => {
7294
- return props.disable ? {} : _brush_helpers__WEBPACK_IMPORTED_MODULE_5__.BrushHelpers.onMouseDown(evt, targetProps);
7295
- },
7296
- onTouchStart: (evt, targetProps) => {
7297
- return props.disable ? {} : _brush_helpers__WEBPACK_IMPORTED_MODULE_5__.BrushHelpers.onMouseDown(evt, targetProps);
7298
- },
7299
- onGlobalMouseMove: (evt, targetProps) => {
7300
- return props.disable || !targetProps.isPanning && !targetProps.isSelecting ? {} : _brush_helpers__WEBPACK_IMPORTED_MODULE_5__.BrushHelpers.onGlobalMouseMove(evt, targetProps);
7301
- },
7302
- onGlobalTouchMove: (evt, targetProps) => {
7303
- return props.disable || !targetProps.isPanning && !targetProps.isSelecting ? {} : _brush_helpers__WEBPACK_IMPORTED_MODULE_5__.BrushHelpers.onGlobalMouseMove(evt, targetProps);
7304
- },
7305
- onGlobalMouseUp: (evt, targetProps) => {
7306
- return props.disable ? {} : _brush_helpers__WEBPACK_IMPORTED_MODULE_5__.BrushHelpers.onGlobalMouseUp(evt, targetProps);
7307
- },
7308
- onGlobalTouchEnd: (evt, targetProps) => {
7309
- return props.disable ? {} : _brush_helpers__WEBPACK_IMPORTED_MODULE_5__.BrushHelpers.onGlobalMouseUp(evt, targetProps);
7310
- },
7311
- onGlobalTouchCancel: (evt, targetProps) => {
7312
- return props.disable ? {} : _brush_helpers__WEBPACK_IMPORTED_MODULE_5__.BrushHelpers.onGlobalMouseUp(evt, targetProps);
7313
- }
7314
- }
7315
- }];
7316
- }
7317
- getSelectBox(props, coordinates) {
7318
- const {
7319
- x,
7320
- y
7321
- } = coordinates;
7322
- const {
7323
- brushStyle,
7324
- brushComponent,
7325
- name
7326
- } = props;
7327
- const brushComponentStyle = brushComponent.props && brushComponent.props.style;
7328
- const cursor = !props.allowDrag && !props.allowResize ? "auto" : "move";
7329
- return x[0] !== x[1] && y[0] !== y[1] ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(brushComponent, {
7330
- key: `${name}-brush`,
7331
- width: Math.abs(x[1] - x[0]) || 1,
7332
- height: Math.abs(y[1] - y[0]) || 1,
7333
- x: Math.min(x[0], x[1]),
7334
- y: Math.min(y[0], y[1]),
7335
- cursor,
7336
- style: lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, brushComponentStyle, brushStyle)
7337
- }) : null;
7338
- }
7339
- getCursorPointers(props) {
7340
- const cursors = {
7341
- yProps: "ns-resize",
7342
- xProps: "ew-resize"
7343
- };
7344
- if (!props.allowResize && props.allowDrag) {
7345
- cursors.xProps = "move";
7346
- cursors.yProps = "move";
7347
- } else if (!props.allowResize && !props.allowDrag) {
7348
- cursors.xProps = "auto";
7349
- cursors.yProps = "auto";
7350
- }
7351
- return cursors;
7352
- }
7353
- getHandles(props, domain) {
7354
- const {
7355
- handleWidth,
7356
- handleStyle,
7357
- handleComponent,
7358
- name
7359
- } = props;
7360
- const domainBox = _brush_helpers__WEBPACK_IMPORTED_MODULE_5__.BrushHelpers.getDomainBox(props, domain);
7361
- const {
7362
- x1,
7363
- x2,
7364
- y1,
7365
- y2
7366
- } = domainBox;
7367
- const {
7368
- top,
7369
- bottom,
7370
- left,
7371
- right
7372
- } = _brush_helpers__WEBPACK_IMPORTED_MODULE_5__.BrushHelpers.getHandles(props, domainBox);
7373
- const width = Math.abs(x2 - x1) || 1;
7374
- const height = Math.abs(y2 - y1) || 1;
7375
- const handleComponentStyle = handleComponent.props && handleComponent.props.style || {};
7376
- const style = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, handleComponentStyle, handleStyle);
7377
- const cursors = this.getCursorPointers(props);
7378
- const yProps = {
7379
- style,
7380
- width,
7381
- height: handleWidth,
7382
- cursor: cursors.yProps
7383
- };
7384
- const xProps = {
7385
- style,
7386
- width: handleWidth,
7387
- height,
7388
- cursor: cursors.xProps
7389
- };
7390
- const handleProps = {
7391
- top: top && Object.assign({
7392
- x: top.x1,
7393
- y: top.y1
7394
- }, yProps),
7395
- bottom: bottom && Object.assign({
7396
- x: bottom.x1,
7397
- y: bottom.y1
7398
- }, yProps),
7399
- left: left && Object.assign({
7400
- y: left.y1,
7401
- x: left.x1
7402
- }, xProps),
7403
- right: right && Object.assign({
7404
- y: right.y1,
7405
- x: right.x1
7406
- }, xProps)
7407
- };
7408
- const handles = ["top", "bottom", "left", "right"].reduce((memo, curr) => handleProps[curr] ? memo.concat( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(handleComponent, Object.assign({
7409
- key: `${name}-handle-${curr}`
7410
- }, handleProps[curr]))) : memo, []);
7411
- return handles.length ? handles : null;
7412
- }
7413
- getRect(props) {
7414
- const {
7415
- currentDomain,
7416
- cachedBrushDomain
7417
- } = props;
7418
- const brushDomain = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, props.brushDomain, props.domain);
7419
- const domain = react_fast_compare__WEBPACK_IMPORTED_MODULE_2___default()(brushDomain, cachedBrushDomain) ? lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, currentDomain, brushDomain) : brushDomain;
7420
- const coordinates = victory_core__WEBPACK_IMPORTED_MODULE_6__.getDomainCoordinates(props, domain);
7421
- const selectBox = this.getSelectBox(props, coordinates);
7422
- return selectBox ? [selectBox, this.getHandles(props, domain)] : [];
7423
- }
7424
-
7425
- // Overrides method in VictoryContainer
7426
- getChildren(props) {
7427
- return [...react__WEBPACK_IMPORTED_MODULE_1___default().Children.toArray(props.children), ...this.getRect(props)];
7072
+ if (!props.allowResize && props.allowDrag) {
7073
+ cursors.xProps = "move";
7074
+ cursors.yProps = "move";
7075
+ } else if (!props.allowResize && !props.allowDrag) {
7076
+ cursors.xProps = "auto";
7077
+ cursors.yProps = "auto";
7428
7078
  }
7079
+ return cursors;
7429
7080
  };
7430
- }
7431
- const VictoryBrushContainer = brushContainerMixin(victory_core__WEBPACK_IMPORTED_MODULE_3__.VictoryContainer);
7432
-
7433
- /***/ }),
7434
-
7435
- /***/ "../../victory-core/es/victory-clip-container/victory-clip-container.js":
7436
- /*!******************************************************************************!*\
7437
- !*** ../../victory-core/es/victory-clip-container/victory-clip-container.js ***!
7438
- \******************************************************************************/
7439
- /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
7440
-
7441
- "use strict";
7442
- __webpack_require__.r(__webpack_exports__);
7443
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7444
- /* harmony export */ "VictoryClipContainer": function() { return /* binding */ VictoryClipContainer; }
7445
- /* harmony export */ });
7446
- /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/uniqueId */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/uniqueId.js");
7447
- /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
7448
- /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/isObject */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js");
7449
- /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_isObject__WEBPACK_IMPORTED_MODULE_1__);
7450
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
7451
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_2__);
7452
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "react");
7453
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
7454
- /* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
7455
- /* harmony import */ var _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../victory-util/user-props */ "../../victory-core/es/victory-util/user-props.js");
7456
- /* harmony import */ var _victory_primitives_clip_path__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-primitives/clip-path */ "../../victory-core/es/victory-primitives/clip-path.js");
7457
- /* harmony import */ var _victory_primitives_circle__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-primitives/circle */ "../../victory-core/es/victory-primitives/circle.js");
7458
- /* harmony import */ var _victory_primitives_rect__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-primitives/rect */ "../../victory-core/es/victory-primitives/rect.js");
7459
-
7460
-
7461
-
7462
-
7081
+ const getHandles = domain => {
7082
+ const {
7083
+ handleWidth,
7084
+ handleStyle,
7085
+ handleComponent,
7086
+ name
7087
+ } = props;
7088
+ const domainBox = _brush_helpers__WEBPACK_IMPORTED_MODULE_4__.BrushHelpers.getDomainBox(props, domain);
7089
+ const {
7090
+ x1,
7091
+ x2,
7092
+ y1,
7093
+ y2
7094
+ } = domainBox;
7095
+ const {
7096
+ top,
7097
+ bottom,
7098
+ left,
7099
+ right
7100
+ } = _brush_helpers__WEBPACK_IMPORTED_MODULE_4__.BrushHelpers.getHandles(props, domainBox);
7101
+ const width = Math.abs(x2 - x1) || 1;
7102
+ const height = Math.abs(y2 - y1) || 1;
7103
+ const handleComponentStyle = handleComponent.props && handleComponent.props.style || {};
7104
+ const style = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, handleComponentStyle, handleStyle);
7105
+ const cursors = getCursorPointers();
7106
+ const yProps = {
7107
+ style,
7108
+ width,
7109
+ height: handleWidth,
7110
+ cursor: cursors.yProps
7111
+ };
7112
+ const xProps = {
7113
+ style,
7114
+ width: handleWidth,
7115
+ height,
7116
+ cursor: cursors.xProps
7117
+ };
7118
+ const handleProps = {
7119
+ top: top && Object.assign({
7120
+ x: top.x1,
7121
+ y: top.y1
7122
+ }, yProps),
7123
+ bottom: bottom && Object.assign({
7124
+ x: bottom.x1,
7125
+ y: bottom.y1
7126
+ }, yProps),
7127
+ left: left && Object.assign({
7128
+ y: left.y1,
7129
+ x: left.x1
7130
+ }, xProps),
7131
+ right: right && Object.assign({
7132
+ y: right.y1,
7133
+ x: right.x1
7134
+ }, xProps)
7135
+ };
7136
+ const handles = ["top", "bottom", "left", "right"].reduce((memo, curr) => handleProps[curr] ? memo.concat( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(handleComponent, Object.assign({
7137
+ key: `${name}-handle-${curr}`
7138
+ }, handleProps[curr]))) : memo, []);
7139
+ return handles.length ? handles : null;
7140
+ };
7141
+ const getRect = () => {
7142
+ const {
7143
+ currentDomain,
7144
+ cachedBrushDomain
7145
+ } = props;
7146
+ const brushDomain = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, props.brushDomain, props.domain);
7147
+ const domain = react_fast_compare__WEBPACK_IMPORTED_MODULE_2___default()(brushDomain, cachedBrushDomain) ? lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, currentDomain, brushDomain) : brushDomain;
7148
+ const coordinates = victory_core__WEBPACK_IMPORTED_MODULE_5__.getDomainCoordinates(props, domain);
7149
+ const selectBox = getSelectBox(coordinates);
7150
+ return selectBox ? [selectBox, getHandles(domain)] : [];
7151
+ };
7152
+ return {
7153
+ props,
7154
+ children: [...react__WEBPACK_IMPORTED_MODULE_1___default().Children.toArray(children), ...getRect()]
7155
+ };
7156
+ };
7157
+ const VictoryBrushContainer = initialProps => {
7158
+ const {
7159
+ props,
7160
+ children
7161
+ } = useVictoryBrushContainer(initialProps);
7162
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_6__.VictoryContainer, props, children);
7163
+ };
7164
+ VictoryBrushContainer.role = "container";
7165
+ VictoryBrushContainer.defaultEvents = initialProps => {
7166
+ const props = {
7167
+ ...VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS,
7168
+ ...initialProps
7169
+ };
7170
+ const createEventHandler = (handler, isDisabled) =>
7171
+ // eslint-disable-next-line max-params
7172
+ (event, targetProps, eventKey, context) => props.disable || isDisabled?.(targetProps) ? {} : handler(event, {
7173
+ ...props,
7174
+ ...targetProps
7175
+ }, eventKey, context);
7176
+ return [{
7177
+ target: "parent",
7178
+ eventHandlers: {
7179
+ onMouseDown: createEventHandler(_brush_helpers__WEBPACK_IMPORTED_MODULE_4__.BrushHelpers.onMouseDown),
7180
+ onTouchStart: createEventHandler(_brush_helpers__WEBPACK_IMPORTED_MODULE_4__.BrushHelpers.onMouseDown),
7181
+ onGlobalMouseMove: createEventHandler(_brush_helpers__WEBPACK_IMPORTED_MODULE_4__.BrushHelpers.onGlobalMouseMove, targetProps => !targetProps.isPanning && !targetProps.isSelecting),
7182
+ onGlobalTouchMove: createEventHandler(_brush_helpers__WEBPACK_IMPORTED_MODULE_4__.BrushHelpers.onGlobalMouseMove, targetProps => !targetProps.isPanning && !targetProps.isSelecting),
7183
+ onGlobalMouseUp: createEventHandler(_brush_helpers__WEBPACK_IMPORTED_MODULE_4__.BrushHelpers.onGlobalMouseUp),
7184
+ onGlobalTouchEnd: createEventHandler(_brush_helpers__WEBPACK_IMPORTED_MODULE_4__.BrushHelpers.onGlobalMouseUp),
7185
+ onGlobalTouchCancel: createEventHandler(_brush_helpers__WEBPACK_IMPORTED_MODULE_4__.BrushHelpers.onGlobalMouseUp)
7186
+ }
7187
+ }];
7188
+ };
7189
+
7190
+ /***/ }),
7191
+
7192
+ /***/ "../../victory-core/es/victory-clip-container/victory-clip-container.js":
7193
+ /*!******************************************************************************!*\
7194
+ !*** ../../victory-core/es/victory-clip-container/victory-clip-container.js ***!
7195
+ \******************************************************************************/
7196
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
7197
+
7198
+ "use strict";
7199
+ __webpack_require__.r(__webpack_exports__);
7200
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7201
+ /* harmony export */ "VictoryClipContainer": function() { return /* binding */ VictoryClipContainer; }
7202
+ /* harmony export */ });
7203
+ /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/uniqueId */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/uniqueId.js");
7204
+ /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
7205
+ /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/isObject */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js");
7206
+ /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_isObject__WEBPACK_IMPORTED_MODULE_1__);
7207
+ /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
7208
+ /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_2__);
7209
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "react");
7210
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
7211
+ /* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
7212
+ /* harmony import */ var _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../victory-util/user-props */ "../../victory-core/es/victory-util/user-props.js");
7213
+ /* harmony import */ var _victory_primitives_clip_path__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-primitives/clip-path */ "../../victory-core/es/victory-primitives/clip-path.js");
7214
+ /* harmony import */ var _victory_primitives_circle__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-primitives/circle */ "../../victory-core/es/victory-primitives/circle.js");
7215
+ /* harmony import */ var _victory_primitives_rect__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-primitives/rect */ "../../victory-core/es/victory-primitives/rect.js");
7216
+
7217
+
7218
+
7219
+
7463
7220
 
7464
7221
 
7465
7222
 
@@ -7636,23 +7393,18 @@ class VictoryClipContainer extends (react__WEBPACK_IMPORTED_MODULE_3___default()
7636
7393
  "use strict";
7637
7394
  __webpack_require__.r(__webpack_exports__);
7638
7395
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7639
- /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; }
7396
+ /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
7397
+ /* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
7640
7398
  /* harmony export */ });
7641
- /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/isObject */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js");
7642
- /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_isObject__WEBPACK_IMPORTED_MODULE_0__);
7643
- /* 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");
7644
- /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1__);
7645
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
7646
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_2__);
7647
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "react");
7648
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
7649
- /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
7650
- /* harmony import */ var _victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../victory-portal/portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
7651
- /* harmony import */ var _victory_util_timer_context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-util/timer-context */ "../../victory-core/es/victory-util/timer-context.js");
7652
- /* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
7653
- /* harmony import */ var _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../victory-util/user-props */ "../../victory-core/es/victory-util/user-props.js");
7654
-
7655
-
7399
+ /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/uniqueId */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/uniqueId.js");
7400
+ /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
7401
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
7402
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
7403
+ /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
7404
+ /* 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");
7405
+ /* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
7406
+ /* 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");
7407
+ /* harmony import */ var _victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-portal/portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
7656
7408
 
7657
7409
  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); }
7658
7410
 
@@ -7661,175 +7413,149 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
7661
7413
 
7662
7414
 
7663
7415
 
7664
- class VictoryContainer extends (react__WEBPACK_IMPORTED_MODULE_3___default().Component) {
7665
- static displayName = "VictoryContainer";
7666
- static role = "container";
7667
- static defaultProps = {
7668
- className: "VictoryContainer",
7669
- portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__.Portal, null),
7670
- portalZIndex: 99,
7671
- responsive: true,
7672
- role: "img"
7416
+ const defaultProps = {
7417
+ className: "VictoryContainer",
7418
+ portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__.Portal, null),
7419
+ portalZIndex: 99,
7420
+ responsive: true,
7421
+ role: "img"
7422
+ };
7423
+ function useVictoryContainer(initialProps) {
7424
+ const props = {
7425
+ ...defaultProps,
7426
+ ...initialProps
7673
7427
  };
7674
- static contextType = _victory_util_timer_context__WEBPACK_IMPORTED_MODULE_5__["default"];
7675
-
7676
- // @ts-expect-error Ref will be initialized on mount
7677
-
7678
- // @ts-expect-error Ref will be initialized on mount
7679
-
7680
- constructor(props) {
7681
- super(props);
7682
- this.containerId = !lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default()(props) || props.containerId === undefined ? lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default()("victory-container-") : props.containerId;
7683
- this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
7684
- }
7685
- savePortalRef = portal => {
7686
- this.portalRef = portal;
7687
- return portal;
7688
- };
7689
- portalUpdate = (key, el) => this.portalRef.portalUpdate(key, el);
7690
- portalRegister = () => this.portalRef.portalRegister();
7691
- portalDeregister = key => this.portalRef.portalDeregister(key);
7692
- saveContainerRef = container => {
7693
- if (_victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(this.props.containerRef)) {
7694
- this.props.containerRef(container);
7695
- }
7696
- this.containerRef = container;
7697
- return container;
7428
+ const {
7429
+ title,
7430
+ desc,
7431
+ width,
7432
+ height,
7433
+ responsive
7434
+ } = props;
7435
+ const localContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
7436
+
7437
+ // Generated ID stored in ref because it needs to persist across renders
7438
+ const generatedId = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()("victory-container-"));
7439
+ const containerId = props.containerId ?? generatedId.current;
7440
+ const getIdForElement = elName => `${containerId}-${elName}`;
7441
+ const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
7442
+ const dimensions = responsive ? {
7443
+ width: "100%",
7444
+ height: "100%"
7445
+ } : {
7446
+ width,
7447
+ height
7698
7448
  };
7699
- handleWheel = e => e.preventDefault();
7700
- componentDidMount() {
7701
- if (this.shouldHandleWheel && this.containerRef) {
7702
- this.containerRef.addEventListener("wheel", this.handleWheel);
7703
- }
7704
- }
7705
- componentWillUnmount() {
7706
- if (this.shouldHandleWheel && this.containerRef) {
7707
- this.containerRef.removeEventListener("wheel", this.handleWheel);
7708
- }
7709
- }
7710
- getIdForElement(elementName) {
7711
- return `${this.containerId}-${elementName}`;
7712
- }
7713
-
7714
- // overridden in custom containers
7715
- getChildren(props) {
7716
- return props.children;
7717
- }
7718
-
7719
- // Get props defined by the Open UI Automation (OUIA) 1.0-RC spec
7720
- // See https://ouia.readthedocs.io/en/latest/README.html#ouia-component
7721
- getOUIAProps(props) {
7722
- const {
7723
- ouiaId,
7724
- ouiaSafe,
7725
- ouiaType
7726
- } = props;
7727
- return {
7728
- ...(ouiaId && {
7729
- "data-ouia-component-id": ouiaId
7730
- }),
7731
- ...(ouiaType && {
7732
- "data-ouia-component-type": ouiaType
7733
- }),
7734
- ...(ouiaSafe !== undefined && {
7735
- "data-ouia-safe": ouiaSafe
7736
- })
7737
- };
7738
- }
7739
- renderContainer(props, svgProps, style) {
7740
- const {
7741
- title,
7742
- desc,
7743
- portalComponent,
7744
- className,
7745
- width,
7746
- height,
7747
- portalZIndex,
7748
- responsive
7749
- } = props;
7750
- const children = this.getChildren(props);
7751
- const dimensions = responsive ? {
7752
- width: "100%",
7753
- height: "100%"
7754
- } : {
7755
- width,
7756
- height
7449
+ const viewBox = responsive ? `0 0 ${width} ${height}` : undefined;
7450
+ const preserveAspectRatio = responsive ? props.preserveAspectRatio : undefined;
7451
+ const ariaLabelledBy = [title && getIdForElement("title"), props["aria-labelledby"]].filter(Boolean).join(" ") || undefined;
7452
+ const ariaDescribedBy = [desc && getIdForElement("desc"), props["aria-describedby"]].filter(Boolean).join(" ") || undefined;
7453
+ const titleId = getIdForElement("title");
7454
+ const descId = getIdForElement("desc");
7455
+ return {
7456
+ ...props,
7457
+ titleId,
7458
+ descId,
7459
+ dimensions,
7460
+ viewBox,
7461
+ preserveAspectRatio,
7462
+ ariaLabelledBy,
7463
+ ariaDescribedBy,
7464
+ userProps,
7465
+ localContainerRef
7466
+ };
7467
+ }
7468
+ const VictoryContainer = initialProps => {
7469
+ const {
7470
+ role,
7471
+ title,
7472
+ desc,
7473
+ children,
7474
+ className,
7475
+ portalZIndex,
7476
+ portalComponent,
7477
+ width,
7478
+ height,
7479
+ style,
7480
+ tabIndex,
7481
+ responsive,
7482
+ events,
7483
+ ouiaId,
7484
+ ouiaSafe,
7485
+ ouiaType,
7486
+ dimensions,
7487
+ ariaDescribedBy,
7488
+ ariaLabelledBy,
7489
+ viewBox,
7490
+ preserveAspectRatio,
7491
+ userProps,
7492
+ titleId,
7493
+ descId,
7494
+ containerRef,
7495
+ localContainerRef
7496
+ } = useVictoryContainer(initialProps);
7497
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
7498
+ if (!events?.onWheel) return;
7499
+ const handleWheel = e => e.preventDefault();
7500
+ const container = localContainerRef?.current;
7501
+ container?.addEventListener("wheel", handleWheel);
7502
+ return () => {
7503
+ container?.removeEventListener("wheel", handleWheel);
7757
7504
  };
7758
- const divStyle = Object.assign({
7505
+ // eslint-disable-next-line react-hooks/exhaustive-deps
7506
+ }, []);
7507
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_4__.PortalProvider, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
7508
+ className: className,
7509
+ style: {
7510
+ ...style,
7511
+ width: responsive ? style?.width : dimensions.width,
7512
+ height: responsive ? style?.height : dimensions.height,
7759
7513
  pointerEvents: "none",
7760
7514
  touchAction: "none",
7761
7515
  position: "relative"
7762
- }, dimensions);
7763
- const portalDivStyle = Object.assign({
7516
+ },
7517
+ "data-ouia-component-id": ouiaId,
7518
+ "data-ouia-component-type": ouiaType,
7519
+ "data-ouia-safe": ouiaSafe,
7520
+ ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_5__.mergeRefs)([localContainerRef, containerRef])
7521
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("svg", _extends({
7522
+ width: width,
7523
+ height: height,
7524
+ tabIndex: tabIndex,
7525
+ role: role,
7526
+ "aria-labelledby": ariaLabelledBy,
7527
+ "aria-describedby": ariaDescribedBy,
7528
+ viewBox: viewBox,
7529
+ preserveAspectRatio: preserveAspectRatio,
7530
+ style: {
7531
+ ...dimensions,
7532
+ pointerEvents: "all"
7533
+ }
7534
+ }, userProps, events), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("title", {
7535
+ id: titleId
7536
+ }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("desc", {
7537
+ id: descId
7538
+ }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
7539
+ style: {
7540
+ ...dimensions,
7764
7541
  zIndex: portalZIndex,
7765
7542
  position: "absolute",
7766
7543
  top: 0,
7767
7544
  left: 0
7768
- }, dimensions);
7769
- const svgStyle = Object.assign({
7770
- pointerEvents: "all"
7771
- }, dimensions);
7772
- const portalSvgStyle = Object.assign({
7545
+ }
7546
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__.PortalOutlet, {
7547
+ as: portalComponent,
7548
+ width: width,
7549
+ height: height,
7550
+ viewBox: viewBox,
7551
+ preserveAspectRatio: preserveAspectRatio,
7552
+ style: {
7553
+ ...dimensions,
7773
7554
  overflow: "visible"
7774
- }, dimensions);
7775
- const portalProps = {
7776
- width,
7777
- height,
7778
- viewBox: svgProps.viewBox,
7779
- preserveAspectRatio: svgProps.preserveAspectRatio,
7780
- style: portalSvgStyle
7781
- };
7782
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_7__.PortalContext.Provider, {
7783
- value: {
7784
- portalUpdate: this.portalUpdate,
7785
- portalRegister: this.portalRegister,
7786
- portalDeregister: this.portalDeregister
7787
- }
7788
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", _extends({
7789
- style: lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, style, divStyle),
7790
- className: className,
7791
- ref: this.saveContainerRef
7792
- }, this.getOUIAProps(props)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("svg", _extends({}, svgProps, {
7793
- style: svgStyle
7794
- }), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("title", {
7795
- id: this.getIdForElement("title")
7796
- }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("desc", {
7797
- id: this.getIdForElement("desc")
7798
- }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", {
7799
- style: portalDivStyle
7800
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().cloneElement(portalComponent, {
7801
- ...portalProps,
7802
- ref: this.savePortalRef
7803
- }))));
7804
- }
7805
- render() {
7806
- const {
7807
- width,
7808
- height,
7809
- responsive,
7810
- events,
7811
- title,
7812
- desc,
7813
- tabIndex,
7814
- preserveAspectRatio,
7815
- role
7816
- } = this.props;
7817
- const style = responsive ? this.props.style : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.omit(this.props.style, ["height", "width"]);
7818
- const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__.getSafeUserProps(this.props);
7819
- const svgProps = Object.assign({
7820
- width,
7821
- height,
7822
- tabIndex,
7823
- role,
7824
- "aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
7825
- "aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
7826
- viewBox: responsive ? `0 0 ${width} ${height}` : undefined,
7827
- preserveAspectRatio: responsive ? preserveAspectRatio : undefined,
7828
- ...userProps
7829
- }, events);
7830
- return this.renderContainer(this.props, svgProps, style);
7831
- }
7832
- }
7555
+ }
7556
+ }))));
7557
+ };
7558
+ VictoryContainer.role = "container";
7833
7559
 
7834
7560
  /***/ }),
7835
7561
 
@@ -8291,10 +8017,7 @@ const defaultProps = {
8291
8017
  lineHeight: 1
8292
8018
  };
8293
8019
  const VictoryLabel = initialProps => {
8294
- const props = evaluateProps({
8295
- ...defaultProps,
8296
- ...initialProps
8297
- });
8020
+ const props = evaluateProps(lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, initialProps, defaultProps));
8298
8021
  if (props.text === null || props.text === undefined) {
8299
8022
  return null;
8300
8023
  }
@@ -8345,17 +8068,83 @@ VictoryLabel.defaultStyles = defaultStyles;
8345
8068
  "use strict";
8346
8069
  __webpack_require__.r(__webpack_exports__);
8347
8070
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8348
- /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; }
8071
+ /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; },
8072
+ /* harmony export */ "PortalProvider": function() { return /* binding */ PortalProvider; },
8073
+ /* harmony export */ "usePortalContext": function() { return /* binding */ usePortalContext; }
8349
8074
  /* harmony export */ });
8350
8075
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
8351
8076
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
8352
8077
 
8353
- /**
8354
- * The React context object consumers may use to access the context of the
8355
- * portal.
8356
- */
8357
- const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({});
8078
+ const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined);
8358
8079
  PortalContext.displayName = "PortalContext";
8080
+ const usePortalContext = () => {
8081
+ const context = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(PortalContext);
8082
+ if (!context) {
8083
+ throw new Error("`usePortalContext` must be used within a `<PortalProvider />`");
8084
+ }
8085
+ return context;
8086
+ };
8087
+ const PortalProvider = _ref => {
8088
+ let {
8089
+ children
8090
+ } = _ref;
8091
+ const [portalChildren, setPortalChildren] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(new Map());
8092
+ const addChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((id, element) => {
8093
+ setPortalChildren(prevChildren => {
8094
+ const nextChildren = new Map(prevChildren);
8095
+ nextChildren.set(id, element);
8096
+ return nextChildren;
8097
+ });
8098
+ }, [setPortalChildren]);
8099
+ const removeChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(id => {
8100
+ setPortalChildren(prevChildren => {
8101
+ const nextChildren = new Map(prevChildren);
8102
+ nextChildren.delete(id);
8103
+ return nextChildren;
8104
+ });
8105
+ }, [setPortalChildren]);
8106
+ const contextValue = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => ({
8107
+ addChild,
8108
+ removeChild,
8109
+ children: portalChildren
8110
+ }), [addChild, removeChild, portalChildren]);
8111
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PortalContext.Provider, {
8112
+ value: contextValue
8113
+ }, children);
8114
+ };
8115
+
8116
+ /***/ }),
8117
+
8118
+ /***/ "../../victory-core/es/victory-portal/portal-outlet.js":
8119
+ /*!*************************************************************!*\
8120
+ !*** ../../victory-core/es/victory-portal/portal-outlet.js ***!
8121
+ \*************************************************************/
8122
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8123
+
8124
+ "use strict";
8125
+ __webpack_require__.r(__webpack_exports__);
8126
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8127
+ /* harmony export */ "PortalOutlet": function() { return /* binding */ PortalOutlet; }
8128
+ /* harmony export */ });
8129
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
8130
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
8131
+ /* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
8132
+
8133
+
8134
+ const PortalOutlet = _ref => {
8135
+ let {
8136
+ as: portalComponent,
8137
+ ...props
8138
+ } = _ref;
8139
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_1__.usePortalContext)();
8140
+ const children = Array.from(portalContext.children.entries()).map(_ref2 => {
8141
+ let [key, node] = _ref2;
8142
+ return !node.key ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(node, {
8143
+ key
8144
+ }) : node;
8145
+ });
8146
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(portalComponent, props, children);
8147
+ };
8359
8148
 
8360
8149
  /***/ }),
8361
8150
 
@@ -8372,39 +8161,13 @@ __webpack_require__.r(__webpack_exports__);
8372
8161
  /* harmony export */ });
8373
8162
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
8374
8163
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
8164
+ 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); }
8375
8165
 
8376
- class Portal extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) {
8377
- static displayName = "Portal";
8378
- constructor(props) {
8379
- super(props);
8380
- this.map = {};
8381
- this.index = 1;
8382
- }
8383
- portalRegister = () => {
8384
- return ++this.index;
8385
- };
8386
- portalUpdate = (key, element) => {
8387
- this.map[key] = element;
8388
- this.forceUpdate();
8389
- };
8390
- portalDeregister = key => {
8391
- delete this.map[key];
8392
- this.forceUpdate();
8393
- };
8394
- getChildren() {
8395
- return Object.keys(this.map).map(key => {
8396
- const el = this.map[key];
8397
- return el ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(el, {
8398
- key
8399
- }) : el;
8400
- });
8401
- }
8402
-
8403
- // Overridden in victory-core-native
8404
- render() {
8405
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", this.props, this.getChildren());
8406
- }
8407
- }
8166
+ const Portal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef((props, ref) => {
8167
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
8168
+ ref: ref
8169
+ }, props));
8170
+ });
8408
8171
 
8409
8172
  /***/ }),
8410
8173
 
@@ -8431,59 +8194,42 @@ __webpack_require__.r(__webpack_exports__);
8431
8194
 
8432
8195
 
8433
8196
 
8434
- class VictoryPortal extends (react__WEBPACK_IMPORTED_MODULE_1___default().Component) {
8435
- static displayName = "VictoryPortal";
8436
- static role = "portal";
8437
- static defaultProps = {
8438
- groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
8439
- };
8440
- static contextType = _portal_context__WEBPACK_IMPORTED_MODULE_2__.PortalContext;
8441
- componentDidMount() {
8442
- if (!this.checkedContext) {
8443
- if (typeof this.context.portalUpdate !== "function") {
8444
- const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
8445
- _victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
8446
- this.renderInPlace = true;
8447
- }
8448
- this.checkedContext = true;
8449
- }
8450
- this.forceUpdate();
8451
- }
8452
- componentDidUpdate() {
8453
- if (!this.renderInPlace) {
8454
- this.portalKey = this.portalKey || this.context.portalRegister();
8455
- this.context.portalUpdate(this.portalKey, this.element);
8456
- }
8457
- }
8458
- componentWillUnmount() {
8459
- if (this.context && this.context.portalDeregister) {
8460
- this.context.portalDeregister(this.portalKey);
8461
- }
8462
- }
8463
-
8464
- // Overridden in victory-core-native
8465
- renderPortal(child) {
8466
- if (this.renderInPlace) {
8467
- return child;
8468
- }
8469
- this.element = child;
8470
- return null;
8197
+ const defaultProps = {
8198
+ groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
8199
+ };
8200
+ const VictoryPortal = initialProps => {
8201
+ const props = {
8202
+ ...defaultProps,
8203
+ ...initialProps
8204
+ };
8205
+ const id = react__WEBPACK_IMPORTED_MODULE_1___default().useId();
8206
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_2__.usePortalContext)();
8207
+ if (!portalContext) {
8208
+ const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
8209
+ _victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
8471
8210
  }
8472
- render() {
8473
- const children = Array.isArray(this.props.children) ? this.props.children[0] : this.props.children;
8211
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
8212
+ const children = Array.isArray(props.children) ? props.children[0] : props.children;
8474
8213
  const {
8475
8214
  groupComponent
8476
- } = this.props;
8215
+ } = props;
8477
8216
  const childProps = children && children.props || {};
8478
8217
  const standardProps = childProps.groupComponent ? {
8479
8218
  groupComponent,
8480
8219
  standalone: false
8481
8220
  } : {};
8482
- const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(this.props, ["children", "groupComponent"]));
8221
+ const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(props, ["children", "groupComponent"]));
8483
8222
  const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
8484
- return this.renderPortal(child);
8485
- }
8486
- }
8223
+ portalContext.addChild(id, child);
8224
+ // eslint-disable-next-line react-hooks/exhaustive-deps
8225
+ }, [props.children]);
8226
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
8227
+ return () => portalContext.removeChild(id);
8228
+ // eslint-disable-next-line react-hooks/exhaustive-deps
8229
+ }, []);
8230
+ return null;
8231
+ };
8232
+ VictoryPortal.role = "portal";
8487
8233
 
8488
8234
  /***/ }),
8489
8235
 
@@ -8561,10 +8307,13 @@ __webpack_require__.r(__webpack_exports__);
8561
8307
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8562
8308
  /* harmony export */ "LineSegment": function() { return /* binding */ LineSegment; }
8563
8309
  /* harmony export */ });
8564
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
8565
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
8566
- /* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
8567
- /* harmony import */ var _line__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./line */ "../../victory-core/es/victory-primitives/line.js");
8310
+ /* 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");
8311
+ /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_0__);
8312
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
8313
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
8314
+ /* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
8315
+ /* harmony import */ var _line__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./line */ "../../victory-core/es/victory-primitives/line.js");
8316
+
8568
8317
 
8569
8318
 
8570
8319
 
@@ -8577,13 +8326,13 @@ const evaluateProps = props => {
8577
8326
  * `style`
8578
8327
  * `tabIndex`
8579
8328
  */
8580
- const ariaLabel = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_1__.evaluateProp(props.ariaLabel, props);
8581
- const desc = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_1__.evaluateProp(props.desc, props);
8582
- const id = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_1__.evaluateProp(props.id, props);
8583
- const style = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_1__.evaluateStyle(Object.assign({
8329
+ const ariaLabel = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_2__.evaluateProp(props.ariaLabel, props);
8330
+ const desc = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_2__.evaluateProp(props.desc, props);
8331
+ const id = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_2__.evaluateProp(props.id, props);
8332
+ const style = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_2__.evaluateStyle(Object.assign({
8584
8333
  stroke: "black"
8585
8334
  }, props.style), props);
8586
- const tabIndex = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_1__.evaluateProp(props.tabIndex, props);
8335
+ const tabIndex = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_2__.evaluateProp(props.tabIndex, props);
8587
8336
  return Object.assign({}, props, {
8588
8337
  ariaLabel,
8589
8338
  desc,
@@ -8593,16 +8342,13 @@ const evaluateProps = props => {
8593
8342
  });
8594
8343
  };
8595
8344
  const defaultProps = {
8596
- lineComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_line__WEBPACK_IMPORTED_MODULE_2__.Line, null),
8345
+ lineComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_line__WEBPACK_IMPORTED_MODULE_3__.Line, null),
8597
8346
  role: "presentation",
8598
8347
  shapeRendering: "auto"
8599
8348
  };
8600
8349
  const LineSegment = initialProps => {
8601
- const props = evaluateProps({
8602
- ...defaultProps,
8603
- ...initialProps
8604
- });
8605
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(props.lineComponent, {
8350
+ const props = evaluateProps(lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, initialProps, defaultProps));
8351
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(props.lineComponent, {
8606
8352
  ...props.events,
8607
8353
  "aria-label": props.ariaLabel,
8608
8354
  style: props.style,
@@ -11887,6 +11633,44 @@ function warn(message) {
11887
11633
 
11888
11634
  /***/ }),
11889
11635
 
11636
+ /***/ "../../victory-core/es/victory-util/merge-refs.js":
11637
+ /*!********************************************************!*\
11638
+ !*** ../../victory-core/es/victory-util/merge-refs.js ***!
11639
+ \********************************************************/
11640
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
11641
+
11642
+ "use strict";
11643
+ __webpack_require__.r(__webpack_exports__);
11644
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
11645
+ /* harmony export */ "mergeRefs": function() { return /* binding */ mergeRefs; }
11646
+ /* harmony export */ });
11647
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
11648
+
11649
+ /**
11650
+ * Used to merge multiple React refs into a single callback ref.
11651
+ *
11652
+ * @example
11653
+ * ```tsx
11654
+ * <div ref={mergeRefs([ref, forwardedRef])} />
11655
+ * ```
11656
+ */
11657
+ function mergeRefs(refs) {
11658
+ return value => {
11659
+ refs.forEach(ref => {
11660
+ // If the ref is a function, it's a callback ref and we call it with the value.
11661
+ if (_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction(ref)) {
11662
+ ref(value);
11663
+ } else if (ref !== null && ref !== undefined) {
11664
+ // If the ref is an object (not null and not undefined), it's an object ref.
11665
+ // We assign the value to its 'current' property.
11666
+ ref.current = value;
11667
+ }
11668
+ });
11669
+ };
11670
+ }
11671
+
11672
+ /***/ }),
11673
+
11890
11674
  /***/ "../../victory-core/es/victory-util/scale.js":
11891
11675
  /*!***************************************************!*\
11892
11676
  !*** ../../victory-core/es/victory-util/scale.js ***!
@@ -12559,98 +12343,6 @@ const approximateTextSize = (text, style) => _approximateTextSizeInternal.impl(t
12559
12343
 
12560
12344
  /***/ }),
12561
12345
 
12562
- /***/ "../../victory-core/es/victory-util/timer-context.js":
12563
- /*!***********************************************************!*\
12564
- !*** ../../victory-core/es/victory-util/timer-context.js ***!
12565
- \***********************************************************/
12566
- /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
12567
-
12568
- "use strict";
12569
- __webpack_require__.r(__webpack_exports__);
12570
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
12571
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
12572
- /* harmony import */ var _timer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./timer */ "../../victory-core/es/victory-util/timer.js");
12573
-
12574
-
12575
-
12576
- /**
12577
- * The React context object consumers may use to access or override the global
12578
- * timer.
12579
- */
12580
- const TimerContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({
12581
- transitionTimer: new _timer__WEBPACK_IMPORTED_MODULE_1__["default"](),
12582
- animationTimer: new _timer__WEBPACK_IMPORTED_MODULE_1__["default"]()
12583
- });
12584
- TimerContext.displayName = "TimerContext";
12585
- /* harmony default export */ __webpack_exports__["default"] = (TimerContext);
12586
-
12587
- /***/ }),
12588
-
12589
- /***/ "../../victory-core/es/victory-util/timer.js":
12590
- /*!***************************************************!*\
12591
- !*** ../../victory-core/es/victory-util/timer.js ***!
12592
- \***************************************************/
12593
- /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
12594
-
12595
- "use strict";
12596
- __webpack_require__.r(__webpack_exports__);
12597
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
12598
- /* harmony export */ "default": function() { return /* binding */ Timer; }
12599
- /* harmony export */ });
12600
- /* harmony import */ var victory_vendor_d3_timer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! victory-vendor/d3-timer */ "../../victory-vendor/es/d3-timer.js");
12601
-
12602
- class Timer {
12603
- constructor() {
12604
- this.shouldAnimate = true;
12605
- this.subscribers = [];
12606
- this.timer = null;
12607
- this.activeSubscriptions = 0;
12608
- }
12609
- bypassAnimation() {
12610
- this.shouldAnimate = false;
12611
- }
12612
- resumeAnimation() {
12613
- this.shouldAnimate = true;
12614
- }
12615
- loop = () => {
12616
- this.subscribers.forEach(s => {
12617
- s.callback((0,victory_vendor_d3_timer__WEBPACK_IMPORTED_MODULE_0__.now)() - s.startTime, s.duration);
12618
- });
12619
- };
12620
- start() {
12621
- if (!this.timer) {
12622
- this.timer = (0,victory_vendor_d3_timer__WEBPACK_IMPORTED_MODULE_0__.timer)(this.loop);
12623
- }
12624
- }
12625
- stop() {
12626
- if (this.timer) {
12627
- this.timer.stop();
12628
- this.timer = null;
12629
- }
12630
- }
12631
- subscribe(callback, duration) {
12632
- const subscriptionID = this.subscribers.push({
12633
- startTime: (0,victory_vendor_d3_timer__WEBPACK_IMPORTED_MODULE_0__.now)(),
12634
- callback,
12635
- duration: this.shouldAnimate ? duration : 0
12636
- });
12637
- this.activeSubscriptions++;
12638
- this.start();
12639
- return subscriptionID;
12640
- }
12641
- unsubscribe(id) {
12642
- if (id !== null && this.subscribers[id - 1]) {
12643
- delete this.subscribers[id - 1];
12644
- this.activeSubscriptions--;
12645
- }
12646
- if (this.activeSubscriptions === 0) {
12647
- this.stop();
12648
- }
12649
- }
12650
- }
12651
-
12652
- /***/ }),
12653
-
12654
12346
  /***/ "../../victory-core/es/victory-util/user-props.js":
12655
12347
  /*!********************************************************!*\
12656
12348
  !*** ../../victory-core/es/victory-util/user-props.js ***!
@@ -13326,8 +13018,9 @@ const CursorHelpers = new CursorHelpersClass();
13326
13018
  "use strict";
13327
13019
  __webpack_require__.r(__webpack_exports__);
13328
13020
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13021
+ /* harmony export */ "VICTORY_CURSOR_CONTAINER_DEFAULT_PROPS": function() { return /* binding */ VICTORY_CURSOR_CONTAINER_DEFAULT_PROPS; },
13329
13022
  /* harmony export */ "VictoryCursorContainer": function() { return /* binding */ VictoryCursorContainer; },
13330
- /* harmony export */ "cursorContainerMixin": function() { return /* binding */ cursorContainerMixin; }
13023
+ /* harmony export */ "useVictoryCursorContainer": function() { return /* binding */ useVictoryCursorContainer; }
13331
13024
  /* harmony export */ });
13332
13025
  /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/isObject */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js");
13333
13026
  /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_isObject__WEBPACK_IMPORTED_MODULE_0__);
@@ -13335,164 +13028,179 @@ __webpack_require__.r(__webpack_exports__);
13335
13028
  /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
13336
13029
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "react");
13337
13030
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
13338
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
13339
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-label/victory-label.js");
13340
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-primitives/line-segment.js");
13341
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/helpers.js");
13031
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-label/victory-label.js");
13032
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-primitives/line-segment.js");
13033
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/helpers.js");
13034
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
13342
13035
  /* harmony import */ var _cursor_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./cursor-helpers */ "../../victory-cursor-container/es/cursor-helpers.js");
13343
13036
 
13344
13037
 
13038
+ /* eslint-disable complexity */
13345
13039
 
13346
13040
 
13347
13041
 
13348
- function cursorContainerMixin(Base) {
13349
- // @ts-expect-error "TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'."
13350
- return class VictoryCursorContainer extends Base {
13351
- static displayName = "VictoryCursorContainer";
13352
- static defaultProps = {
13353
- ...victory_core__WEBPACK_IMPORTED_MODULE_3__.VictoryContainer.defaultProps,
13354
- cursorLabelComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_4__.VictoryLabel, null),
13355
- cursorLabelOffset: {
13356
- x: 5,
13357
- y: -10
13358
- },
13359
- cursorComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_5__.LineSegment, null)
13360
- };
13361
- static defaultEvents(props) {
13362
- return [{
13363
- target: "parent",
13364
- eventHandlers: {
13365
- onMouseLeave: (evt, targetProps) => {
13366
- return props.disable ? {} : _cursor_helpers__WEBPACK_IMPORTED_MODULE_6__.CursorHelpers.onMouseLeave(evt, targetProps);
13367
- },
13368
- onTouchCancel: () => {
13369
- return [];
13370
- },
13371
- onMouseMove: (evt, targetProps) => {
13372
- return props.disable ? {} : _cursor_helpers__WEBPACK_IMPORTED_MODULE_6__.CursorHelpers.onMouseMove(evt, targetProps);
13373
- },
13374
- onTouchMove: (evt, targetProps) => {
13375
- return props.disable ? {} : _cursor_helpers__WEBPACK_IMPORTED_MODULE_6__.CursorHelpers.onMouseMove(evt, targetProps);
13376
- }
13377
- }
13378
- }];
13042
+ const VICTORY_CURSOR_CONTAINER_DEFAULT_PROPS = {
13043
+ cursorLabelComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_3__.VictoryLabel, null),
13044
+ cursorLabelOffset: {
13045
+ x: 5,
13046
+ y: -10
13047
+ },
13048
+ cursorComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_4__.LineSegment, null)
13049
+ };
13050
+ const useVictoryCursorContainer = initialProps => {
13051
+ const props = {
13052
+ ...VICTORY_CURSOR_CONTAINER_DEFAULT_PROPS,
13053
+ ...initialProps
13054
+ };
13055
+ const {
13056
+ children
13057
+ } = props;
13058
+ const getCursorPosition = () => {
13059
+ const {
13060
+ cursorValue,
13061
+ defaultCursorValue,
13062
+ domain,
13063
+ cursorDimension
13064
+ } = props;
13065
+ if (cursorValue) {
13066
+ return cursorValue;
13379
13067
  }
13380
- getCursorPosition(props) {
13381
- const {
13382
- cursorValue,
13383
- defaultCursorValue,
13384
- domain,
13385
- cursorDimension
13386
- } = props;
13387
- if (cursorValue) {
13388
- return cursorValue;
13389
- }
13390
- if (typeof defaultCursorValue === "number") {
13391
- return {
13392
- x: (domain.x[0] + domain.x[1]) / 2,
13393
- y: (domain.y[0] + domain.y[1]) / 2,
13068
+ if (typeof defaultCursorValue === "number") {
13069
+ return {
13070
+ x: (domain.x[0] + domain.x[1]) / 2,
13071
+ y: (domain.y[0] + domain.y[1]) / 2,
13072
+ ...(cursorDimension ? {
13394
13073
  [cursorDimension]: defaultCursorValue
13395
- };
13396
- }
13397
- return defaultCursorValue;
13074
+ } : {})
13075
+ };
13398
13076
  }
13399
- getCursorLabelOffset(props) {
13400
- const {
13401
- cursorLabelOffset
13402
- } = props;
13403
- if (typeof cursorLabelOffset === "number") {
13404
- return {
13405
- x: cursorLabelOffset,
13406
- y: cursorLabelOffset
13407
- };
13408
- }
13409
- return cursorLabelOffset;
13077
+ return defaultCursorValue;
13078
+ };
13079
+ const getCursorLabelOffset = () => {
13080
+ const {
13081
+ cursorLabelOffset
13082
+ } = props;
13083
+ if (typeof cursorLabelOffset === "number") {
13084
+ return {
13085
+ x: cursorLabelOffset,
13086
+ y: cursorLabelOffset
13087
+ };
13410
13088
  }
13411
- getPadding(props) {
13412
- if (props.padding === undefined) {
13413
- const child = props.children.find(c => {
13414
- return lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default()(c.props) && c.props.padding !== undefined;
13415
- });
13416
- return victory_core__WEBPACK_IMPORTED_MODULE_7__.getPadding(child.props);
13417
- }
13418
- return victory_core__WEBPACK_IMPORTED_MODULE_7__.getPadding(props);
13089
+ return cursorLabelOffset;
13090
+ };
13091
+ const getPadding = () => {
13092
+ if (props.padding === undefined) {
13093
+ const child = Array.isArray(props.children) ? props.children.find(c => {
13094
+ return lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default()(c.props) && c.props.padding !== undefined;
13095
+ }) : props.children;
13096
+ return victory_core__WEBPACK_IMPORTED_MODULE_5__.getPadding(child?.props);
13419
13097
  }
13420
- getCursorElements(props) {
13421
- // eslint-disable-line max-statements
13422
- const {
13423
- scale,
13424
- cursorLabelComponent,
13425
- cursorLabel,
13426
- cursorComponent,
13427
- width,
13428
- height,
13429
- name,
13430
- horizontal,
13431
- theme
13432
- } = props;
13433
- const cursorDimension = _cursor_helpers__WEBPACK_IMPORTED_MODULE_6__.CursorHelpers.getDimension(props);
13434
- const cursorValue = this.getCursorPosition(props);
13435
- const cursorLabelOffset = this.getCursorLabelOffset(props);
13436
- if (!cursorValue) {
13437
- return [];
13438
- }
13439
- const newElements = [];
13440
- const padding = this.getPadding(props);
13441
- const cursorCoordinates = {
13442
- x: horizontal ? scale.y(cursorValue.y) : scale.x(cursorValue.x),
13443
- y: horizontal ? scale.x(cursorValue.x) : scale.y(cursorValue.y)
13444
- };
13445
- if (cursorLabel) {
13446
- let labelProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({
13447
- active: true
13448
- }, cursorLabelComponent.props, {
13449
- x: cursorCoordinates.x + cursorLabelOffset.x,
13450
- y: cursorCoordinates.y + cursorLabelOffset.y,
13451
- datum: cursorValue,
13452
- active: true,
13453
- key: `${name}-cursor-label`
13454
- });
13455
- if (victory_core__WEBPACK_IMPORTED_MODULE_7__.isTooltip(cursorLabelComponent)) {
13456
- const tooltipTheme = theme && theme.tooltip || {};
13457
- labelProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelProps, tooltipTheme);
13458
- }
13459
- newElements.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().cloneElement(cursorLabelComponent, lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelProps, {
13460
- text: victory_core__WEBPACK_IMPORTED_MODULE_7__.evaluateProp(cursorLabel, labelProps)
13461
- })));
13462
- }
13463
- const cursorStyle = Object.assign({
13464
- stroke: "black"
13465
- }, cursorComponent.props.style);
13466
- if (cursorDimension === "x" || cursorDimension === undefined) {
13467
- newElements.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().cloneElement(cursorComponent, {
13468
- key: `${name}-x-cursor`,
13469
- x1: cursorCoordinates.x,
13470
- x2: cursorCoordinates.x,
13471
- y1: padding.top,
13472
- y2: height - padding.bottom,
13473
- style: cursorStyle
13474
- }));
13475
- }
13476
- if (cursorDimension === "y" || cursorDimension === undefined) {
13477
- newElements.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().cloneElement(cursorComponent, {
13478
- key: `${name}-y-cursor`,
13479
- x1: padding.left,
13480
- x2: width - padding.right,
13481
- y1: cursorCoordinates.y,
13482
- y2: cursorCoordinates.y,
13483
- style: cursorStyle
13484
- }));
13485
- }
13486
- return newElements;
13098
+ return victory_core__WEBPACK_IMPORTED_MODULE_5__.getPadding(props);
13099
+ };
13100
+ const getCursorElements = () => {
13101
+ // eslint-disable-line max-statements
13102
+ const {
13103
+ scale,
13104
+ cursorLabelComponent,
13105
+ cursorLabel,
13106
+ cursorComponent,
13107
+ width,
13108
+ height,
13109
+ name,
13110
+ horizontal,
13111
+ theme
13112
+ } = props;
13113
+ const cursorDimension = _cursor_helpers__WEBPACK_IMPORTED_MODULE_6__.CursorHelpers.getDimension(props);
13114
+ const cursorValue = getCursorPosition();
13115
+ const cursorLabelOffset = getCursorLabelOffset();
13116
+ if (!cursorValue) {
13117
+ return [];
13487
13118
  }
13488
-
13489
- // Overrides method in VictoryContainer
13490
- getChildren(props) {
13491
- return [...react__WEBPACK_IMPORTED_MODULE_2___default().Children.toArray(props.children), ...this.getCursorElements(props)];
13119
+ const newElements = [];
13120
+ const padding = getPadding();
13121
+ const cursorCoordinates = scale && "x" in scale && "y" in scale && typeof scale.y === "function" && typeof scale.x === "function" ? {
13122
+ x: horizontal ? scale.y(cursorValue.y) : scale.x(cursorValue.x),
13123
+ y: horizontal ? scale.x(cursorValue.x) : scale.y(cursorValue.y)
13124
+ } : {
13125
+ x: cursorValue.x,
13126
+ y: cursorValue.y
13127
+ };
13128
+ if (cursorLabel) {
13129
+ let labelProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({
13130
+ active: true
13131
+ }, cursorLabelComponent.props, {
13132
+ x: cursorCoordinates.x + cursorLabelOffset.x,
13133
+ y: cursorCoordinates.y + cursorLabelOffset.y,
13134
+ datum: cursorValue,
13135
+ active: true,
13136
+ key: `${name}-cursor-label`
13137
+ });
13138
+ if (victory_core__WEBPACK_IMPORTED_MODULE_5__.isTooltip(cursorLabelComponent)) {
13139
+ const tooltipTheme = theme && theme.tooltip || {};
13140
+ labelProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelProps, tooltipTheme);
13141
+ }
13142
+ newElements.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().cloneElement(cursorLabelComponent, lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelProps, {
13143
+ text: victory_core__WEBPACK_IMPORTED_MODULE_5__.evaluateProp(cursorLabel, labelProps)
13144
+ })));
13492
13145
  }
13146
+ const cursorStyle = Object.assign({
13147
+ stroke: "black"
13148
+ }, cursorComponent.props.style);
13149
+ if (cursorDimension === "x" || cursorDimension === undefined) {
13150
+ newElements.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().cloneElement(cursorComponent, {
13151
+ key: `${name}-x-cursor`,
13152
+ x1: cursorCoordinates.x,
13153
+ x2: cursorCoordinates.x,
13154
+ y1: padding.top,
13155
+ y2: (typeof height === "number" ? height : 0) - padding.bottom,
13156
+ style: cursorStyle
13157
+ }));
13158
+ }
13159
+ if (cursorDimension === "y" || cursorDimension === undefined) {
13160
+ newElements.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().cloneElement(cursorComponent, {
13161
+ key: `${name}-y-cursor`,
13162
+ x1: padding.left,
13163
+ x2: (typeof width === "number" ? width : 0) - padding.right,
13164
+ y1: cursorCoordinates.y,
13165
+ y2: cursorCoordinates.y,
13166
+ style: cursorStyle
13167
+ }));
13168
+ }
13169
+ return newElements;
13493
13170
  };
13494
- }
13495
- const VictoryCursorContainer = cursorContainerMixin(victory_core__WEBPACK_IMPORTED_MODULE_3__.VictoryContainer);
13171
+ return {
13172
+ props,
13173
+ children: [...react__WEBPACK_IMPORTED_MODULE_2___default().Children.toArray(children), ...getCursorElements()]
13174
+ };
13175
+ };
13176
+ const VictoryCursorContainer = initialProps => {
13177
+ const {
13178
+ props,
13179
+ children
13180
+ } = useVictoryCursorContainer(initialProps);
13181
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_7__.VictoryContainer, props, children);
13182
+ };
13183
+ VictoryCursorContainer.role = "container";
13184
+ VictoryCursorContainer.defaultEvents = initialProps => {
13185
+ const props = {
13186
+ ...VICTORY_CURSOR_CONTAINER_DEFAULT_PROPS,
13187
+ ...initialProps
13188
+ };
13189
+ const createEventHandler = (handler, disabled) =>
13190
+ // eslint-disable-next-line max-params
13191
+ (event, targetProps, eventKey, context) => disabled || props.disable ? {} : handler(event, {
13192
+ ...props,
13193
+ ...targetProps
13194
+ }, eventKey, context);
13195
+ return [{
13196
+ target: "parent",
13197
+ eventHandlers: {
13198
+ onMouseLeave: createEventHandler(_cursor_helpers__WEBPACK_IMPORTED_MODULE_6__.CursorHelpers.onMouseLeave),
13199
+ onMouseMove: createEventHandler(_cursor_helpers__WEBPACK_IMPORTED_MODULE_6__.CursorHelpers.onMouseMove),
13200
+ onTouchMove: createEventHandler(_cursor_helpers__WEBPACK_IMPORTED_MODULE_6__.CursorHelpers.onMouseMove)
13201
+ }
13202
+ }];
13203
+ };
13496
13204
 
13497
13205
  /***/ }),
13498
13206
 
@@ -13748,88 +13456,91 @@ const SelectionHelpers = new SelectionHelpersClass();
13748
13456
  "use strict";
13749
13457
  __webpack_require__.r(__webpack_exports__);
13750
13458
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13459
+ /* harmony export */ "VICTORY_SELECTION_CONTAINER_DEFAULT_PROPS": function() { return /* binding */ VICTORY_SELECTION_CONTAINER_DEFAULT_PROPS; },
13751
13460
  /* harmony export */ "VictorySelectionContainer": function() { return /* binding */ VictorySelectionContainer; },
13752
- /* harmony export */ "selectionContainerMixin": function() { return /* binding */ selectionContainerMixin; }
13461
+ /* harmony export */ "useVictorySelectionContainer": function() { return /* binding */ useVictorySelectionContainer; }
13753
13462
  /* harmony export */ });
13754
13463
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
13755
13464
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
13756
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
13757
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-primitives/rect.js");
13465
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-primitives/rect.js");
13466
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
13758
13467
  /* harmony import */ var _selection_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selection-helpers */ "../../victory-selection-container/es/selection-helpers.js");
13759
13468
 
13760
13469
 
13761
13470
 
13762
- function selectionContainerMixin(Base) {
13763
- // @ts-expect-error "TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'."
13764
- return class VictorySelectionContainer extends Base {
13765
- static displayName = "VictorySelectionContainer";
13766
- static defaultProps = {
13767
- ...victory_core__WEBPACK_IMPORTED_MODULE_1__.VictoryContainer.defaultProps,
13768
- activateSelectedData: true,
13769
- allowSelection: true,
13770
- selectionComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_2__.Rect, null),
13771
- selectionStyle: {
13772
- stroke: "transparent",
13773
- fill: "black",
13774
- fillOpacity: 0.1
13775
- }
13776
- };
13777
- static defaultEvents(props) {
13778
- return [{
13779
- target: "parent",
13780
- eventHandlers: {
13781
- onMouseDown: (evt, targetProps) => {
13782
- return props.disable ? {} : _selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseDown(evt, targetProps);
13783
- },
13784
- onTouchStart: (evt, targetProps) => {
13785
- return props.disable ? {} : _selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseDown(evt, targetProps);
13786
- },
13787
- onMouseMove: (evt, targetProps) => {
13788
- return props.disable ? {} : _selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseMove(evt, targetProps);
13789
- },
13790
- onTouchMove: (evt, targetProps) => {
13791
- return props.disable ? {} : _selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseMove(evt, targetProps);
13792
- },
13793
- onMouseUp: (evt, targetProps) => {
13794
- return props.disable ? {} : _selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseUp(evt, targetProps);
13795
- },
13796
- onTouchEnd: (evt, targetProps) => {
13797
- return props.disable ? {} : _selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseUp(evt, targetProps);
13798
- }
13799
- }
13800
- }];
13801
- }
13802
- getRect(props) {
13803
- const {
13804
- x1,
13805
- x2,
13806
- y1,
13807
- y2,
13808
- selectionStyle,
13809
- selectionComponent,
13810
- name
13811
- } = props;
13812
- const width = Math.abs(x2 - x1) || 1;
13813
- const height = Math.abs(y2 - y1) || 1;
13814
- const x = Math.min(x1, x2);
13815
- const y = Math.min(y1, y2);
13816
- return y2 && x2 && x1 && y1 ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(selectionComponent, {
13817
- key: `${name}-selection`,
13818
- x,
13819
- y,
13820
- width,
13821
- height,
13822
- style: selectionStyle
13823
- }) : null;
13824
- }
13825
-
13826
- // Overrides method in VictoryContainer
13827
- getChildren(props) {
13828
- return [...react__WEBPACK_IMPORTED_MODULE_0___default().Children.toArray(props.children), this.getRect(props)];
13829
- }
13471
+ const VICTORY_SELECTION_CONTAINER_DEFAULT_PROPS = {
13472
+ activateSelectedData: true,
13473
+ allowSelection: true,
13474
+ selectionComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_1__.Rect, null),
13475
+ selectionStyle: {
13476
+ stroke: "transparent",
13477
+ fill: "black",
13478
+ fillOpacity: 0.1
13479
+ }
13480
+ };
13481
+ const useVictorySelectionContainer = initialProps => {
13482
+ const props = {
13483
+ ...VICTORY_SELECTION_CONTAINER_DEFAULT_PROPS,
13484
+ ...initialProps
13830
13485
  };
13831
- }
13832
- const VictorySelectionContainer = selectionContainerMixin(victory_core__WEBPACK_IMPORTED_MODULE_1__.VictoryContainer);
13486
+ const {
13487
+ x1,
13488
+ x2,
13489
+ y1,
13490
+ y2,
13491
+ selectionStyle,
13492
+ selectionComponent,
13493
+ children,
13494
+ name
13495
+ } = props;
13496
+ const width = Math.abs(x2 - x1) || 1;
13497
+ const height = Math.abs(y2 - y1) || 1;
13498
+ const x = Math.min(x1, x2);
13499
+ const y = Math.min(y1, y2);
13500
+ const shouldRenderRect = y1 && y2 && x1 && x2;
13501
+ return {
13502
+ props,
13503
+ children: [children, shouldRenderRect && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(selectionComponent, {
13504
+ key: `${name}-selection`,
13505
+ x,
13506
+ y,
13507
+ width,
13508
+ height,
13509
+ style: selectionStyle
13510
+ })]
13511
+ };
13512
+ };
13513
+ const VictorySelectionContainer = initialProps => {
13514
+ const {
13515
+ props,
13516
+ children
13517
+ } = useVictorySelectionContainer(initialProps);
13518
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_2__.VictoryContainer, props, children);
13519
+ };
13520
+ VictorySelectionContainer.role = "container";
13521
+ VictorySelectionContainer.defaultEvents = initialProps => {
13522
+ const props = {
13523
+ ...VICTORY_SELECTION_CONTAINER_DEFAULT_PROPS,
13524
+ ...initialProps
13525
+ };
13526
+ const createEventHandler = (handler, disabled) =>
13527
+ // eslint-disable-next-line max-params
13528
+ (event, targetProps, eventKey, context) => disabled || props.disable ? {} : handler(event, {
13529
+ ...props,
13530
+ ...targetProps
13531
+ }, eventKey, context);
13532
+ return [{
13533
+ target: "parent",
13534
+ eventHandlers: {
13535
+ onMouseDown: createEventHandler(_selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseDown),
13536
+ onTouchStart: createEventHandler(_selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseDown),
13537
+ onMouseMove: createEventHandler(_selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseMove),
13538
+ onTouchMove: createEventHandler(_selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseMove),
13539
+ onMouseUp: createEventHandler(_selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseUp),
13540
+ onTouchEnd: createEventHandler(_selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseUp)
13541
+ }
13542
+ }];
13543
+ };
13833
13544
 
13834
13545
  /***/ }),
13835
13546
 
@@ -13844,11 +13555,14 @@ __webpack_require__.r(__webpack_exports__);
13844
13555
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13845
13556
  /* harmony export */ "Flyout": function() { return /* binding */ Flyout; }
13846
13557
  /* harmony export */ });
13847
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
13848
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
13849
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/helpers.js");
13850
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-primitives/path.js");
13851
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/user-props.js");
13558
+ /* 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");
13559
+ /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_0__);
13560
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
13561
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
13562
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/helpers.js");
13563
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-primitives/path.js");
13564
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/user-props.js");
13565
+
13852
13566
 
13853
13567
 
13854
13568
  const getVerticalPath = props => {
@@ -13929,8 +13643,8 @@ const evaluateProps = props => {
13929
13643
  * `id`
13930
13644
  * `style`
13931
13645
  */
13932
- const id = victory_core__WEBPACK_IMPORTED_MODULE_1__.evaluateProp(props.id, props);
13933
- const style = victory_core__WEBPACK_IMPORTED_MODULE_1__.evaluateStyle(props.style, props);
13646
+ const id = victory_core__WEBPACK_IMPORTED_MODULE_2__.evaluateProp(props.id, props);
13647
+ const style = victory_core__WEBPACK_IMPORTED_MODULE_2__.evaluateStyle(props.style, props);
13934
13648
  return {
13935
13649
  ...props,
13936
13650
  id,
@@ -13938,23 +13652,20 @@ const evaluateProps = props => {
13938
13652
  };
13939
13653
  };
13940
13654
  const defaultProps = {
13941
- pathComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_2__.Path, null),
13655
+ pathComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_3__.Path, null),
13942
13656
  role: "presentation",
13943
13657
  shapeRendering: "auto"
13944
13658
  };
13945
13659
  const Flyout = initialProps => {
13946
- const props = evaluateProps({
13947
- ...defaultProps,
13948
- ...initialProps
13949
- });
13950
- const userProps = victory_core__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
13660
+ const props = evaluateProps(lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, initialProps, defaultProps));
13661
+ const userProps = victory_core__WEBPACK_IMPORTED_MODULE_4__.getSafeUserProps(props);
13951
13662
 
13952
13663
  // check for required props for this subcomponent
13953
13664
  // they should be passed in from the wrapper
13954
- victory_core__WEBPACK_IMPORTED_MODULE_3__.assert(props.height, "Flyout props[height] is undefined");
13955
- victory_core__WEBPACK_IMPORTED_MODULE_3__.assert(props.width, "Flyout props[width] is undefined");
13956
- victory_core__WEBPACK_IMPORTED_MODULE_3__.assert(props.x, "Flyout props[x] is undefined");
13957
- victory_core__WEBPACK_IMPORTED_MODULE_3__.assert(props.y, "Flyout props[y] is undefined");
13665
+ victory_core__WEBPACK_IMPORTED_MODULE_4__.assert(props.height, "Flyout props[height] is undefined");
13666
+ victory_core__WEBPACK_IMPORTED_MODULE_4__.assert(props.width, "Flyout props[width] is undefined");
13667
+ victory_core__WEBPACK_IMPORTED_MODULE_4__.assert(props.x, "Flyout props[x] is undefined");
13668
+ victory_core__WEBPACK_IMPORTED_MODULE_4__.assert(props.y, "Flyout props[y] is undefined");
13958
13669
  const flyoutPathProps = {
13959
13670
  center: props.center || {
13960
13671
  x: 0,
@@ -13971,7 +13682,7 @@ const Flyout = initialProps => {
13971
13682
  x: props.x,
13972
13683
  y: props.y
13973
13684
  };
13974
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(props.pathComponent, {
13685
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(props.pathComponent, {
13975
13686
  ...props.events,
13976
13687
  ...userProps,
13977
13688
  style: props.style,
@@ -14490,7 +14201,7 @@ class VictoryTooltip extends (react__WEBPACK_IMPORTED_MODULE_4___default().Compo
14490
14201
  renderInPortal
14491
14202
  } = props;
14492
14203
  if (!active) {
14493
- return renderInPortal ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_11__.VictoryPortal, null) : null;
14204
+ return null;
14494
14205
  }
14495
14206
  const evaluatedProps = this.getEvaluatedProps(props);
14496
14207
  const {
@@ -14561,32 +14272,6 @@ __webpack_require__.r(__webpack_exports__);
14561
14272
 
14562
14273
 
14563
14274
 
14564
- /***/ }),
14565
-
14566
- /***/ "../../victory-vendor/es/d3-timer.js":
14567
- /*!*******************************************!*\
14568
- !*** ../../victory-vendor/es/d3-timer.js ***!
14569
- \*******************************************/
14570
- /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
14571
-
14572
- "use strict";
14573
- __webpack_require__.r(__webpack_exports__);
14574
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
14575
- /* harmony export */ "interval": function() { return /* reexport safe */ d3_timer__WEBPACK_IMPORTED_MODULE_0__.interval; },
14576
- /* harmony export */ "now": function() { return /* reexport safe */ d3_timer__WEBPACK_IMPORTED_MODULE_0__.now; },
14577
- /* harmony export */ "timeout": function() { return /* reexport safe */ d3_timer__WEBPACK_IMPORTED_MODULE_0__.timeout; },
14578
- /* harmony export */ "timer": function() { return /* reexport safe */ d3_timer__WEBPACK_IMPORTED_MODULE_0__.timer; },
14579
- /* harmony export */ "timerFlush": function() { return /* reexport safe */ d3_timer__WEBPACK_IMPORTED_MODULE_0__.timerFlush; }
14580
- /* harmony export */ });
14581
- /* harmony import */ var d3_timer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3-timer */ "../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/index.js");
14582
-
14583
- // `victory-vendor/d3-timer` (ESM)
14584
- // See upstream license: https://github.com/d3/d3-timer/blob/main/LICENSE
14585
- //
14586
- // Our ESM package uses the underlying installed dependencies of `node_modules/d3-timer`
14587
-
14588
-
14589
-
14590
14275
  /***/ }),
14591
14276
 
14592
14277
  /***/ "../../victory-voronoi-container/es/victory-voronoi-container.js":
@@ -14598,8 +14283,9 @@ __webpack_require__.r(__webpack_exports__);
14598
14283
  "use strict";
14599
14284
  __webpack_require__.r(__webpack_exports__);
14600
14285
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
14286
+ /* harmony export */ "VICTORY_VORONOI_CONTAINER_DEFAULT_PROPS": function() { return /* binding */ VICTORY_VORONOI_CONTAINER_DEFAULT_PROPS; },
14601
14287
  /* harmony export */ "VictoryVoronoiContainer": function() { return /* binding */ VictoryVoronoiContainer; },
14602
- /* harmony export */ "voronoiContainerMixin": function() { return /* binding */ voronoiContainerMixin; }
14288
+ /* harmony export */ "useVictoryVoronoiContainer": function() { return /* binding */ useVictoryVoronoiContainer; }
14603
14289
  /* harmony export */ });
14604
14290
  /* harmony import */ var lodash_pick__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/pick */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/pick.js");
14605
14291
  /* harmony import */ var lodash_pick__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_pick__WEBPACK_IMPORTED_MODULE_0__);
@@ -14607,10 +14293,10 @@ __webpack_require__.r(__webpack_exports__);
14607
14293
  /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
14608
14294
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "react");
14609
14295
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
14610
- /* harmony import */ var victory_tooltip__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! victory-tooltip */ "../../victory-tooltip/es/victory-tooltip.js");
14611
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
14612
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/helpers.js");
14613
- /* harmony import */ var _voronoi_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./voronoi-helpers */ "../../victory-voronoi-container/es/voronoi-helpers.js");
14296
+ /* harmony import */ var victory_tooltip__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-tooltip */ "../../victory-tooltip/es/victory-tooltip.js");
14297
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/helpers.js");
14298
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
14299
+ /* harmony import */ var _voronoi_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./voronoi-helpers */ "../../victory-voronoi-container/es/voronoi-helpers.js");
14614
14300
 
14615
14301
 
14616
14302
  /* eslint-disable react/no-multi-comp */
@@ -14618,204 +14304,214 @@ __webpack_require__.r(__webpack_exports__);
14618
14304
 
14619
14305
 
14620
14306
 
14621
- function voronoiContainerMixin(Base) {
14622
- // @ts-expect-error "TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'."
14623
- return class VictoryVoronoiContainer extends Base {
14624
- static displayName = "VictoryVoronoiContainer";
14625
- static defaultProps = {
14626
- ...victory_core__WEBPACK_IMPORTED_MODULE_3__.VictoryContainer.defaultProps,
14627
- activateData: true,
14628
- activateLabels: true,
14629
- labelComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(victory_tooltip__WEBPACK_IMPORTED_MODULE_4__.VictoryTooltip, null),
14630
- voronoiPadding: 5
14631
- };
14632
- static defaultEvents(props) {
14633
- return [{
14634
- target: "parent",
14635
- eventHandlers: {
14636
- onMouseLeave: (evt, targetProps) => {
14637
- return props.disable ? {} : _voronoi_helpers__WEBPACK_IMPORTED_MODULE_5__.VoronoiHelpers.onMouseLeave(evt, targetProps);
14638
- },
14639
- onTouchCancel: (evt, targetProps) => {
14640
- return props.disable ? {} : _voronoi_helpers__WEBPACK_IMPORTED_MODULE_5__.VoronoiHelpers.onMouseLeave(evt, targetProps);
14641
- },
14642
- onMouseMove: (evt, targetProps) => {
14643
- return props.disable ? {} : _voronoi_helpers__WEBPACK_IMPORTED_MODULE_5__.VoronoiHelpers.onMouseMove(evt, targetProps);
14644
- },
14645
- onTouchMove: (evt, targetProps) => {
14646
- return props.disable ? {} : _voronoi_helpers__WEBPACK_IMPORTED_MODULE_5__.VoronoiHelpers.onMouseMove(evt, targetProps);
14647
- }
14648
- }
14649
- }, {
14650
- target: "data",
14651
- eventHandlers: props.disable ? {} : {
14652
- onMouseOver: () => null,
14653
- onMouseOut: () => null,
14654
- onMouseMove: () => null
14655
- }
14656
- }];
14657
- }
14658
- getDimension(props) {
14659
- const {
14660
- horizontal,
14661
- voronoiDimension
14662
- } = props;
14663
- if (!horizontal || !voronoiDimension) {
14664
- return voronoiDimension;
14665
- }
14666
- return voronoiDimension === "x" ? "y" : "x";
14667
- }
14668
- getPoint(point) {
14669
- const whitelist = ["_x", "_x1", "_x0", "_y", "_y1", "_y0"];
14670
- return lodash_pick__WEBPACK_IMPORTED_MODULE_0___default()(point, whitelist);
14671
- }
14672
- getLabelPosition(props, labelProps, points) {
14673
- const {
14674
- mousePosition,
14675
- mouseFollowTooltips
14676
- } = props;
14677
- const voronoiDimension = this.getDimension(props);
14678
- const point = this.getPoint(points[0]);
14679
- const basePosition = victory_core__WEBPACK_IMPORTED_MODULE_6__.scalePoint(props, point);
14680
- let center = mouseFollowTooltips ? mousePosition : undefined;
14681
- if (!voronoiDimension || points.length < 2) {
14682
- return {
14683
- ...basePosition,
14684
- center: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelProps.center, center)
14685
- };
14686
- }
14687
- const x = voronoiDimension === "y" ? mousePosition.x : basePosition.x;
14688
- const y = voronoiDimension === "x" ? mousePosition.y : basePosition.y;
14689
- center = mouseFollowTooltips ? mousePosition : {
14690
- x,
14691
- y
14692
- };
14693
- return {
14694
- x,
14695
- y,
14696
- center: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelProps.center, center)
14697
- };
14698
- }
14699
- getStyle(props, points, type) {
14700
- const {
14701
- labels,
14702
- labelComponent,
14703
- theme
14704
- } = props;
14705
- const componentProps = labelComponent.props || {};
14706
- const themeStyles = theme && theme.voronoi && theme.voronoi.style ? theme.voronoi.style : {};
14707
- const componentStyleArray = type === "flyout" ? componentProps.flyoutStyle : componentProps.style;
14708
- return points.reduce((memo, datum, index) => {
14709
- const labelProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, componentProps, {
14710
- datum,
14711
- active: true
14712
- });
14713
- const text = victory_core__WEBPACK_IMPORTED_MODULE_6__.isFunction(labels) ? labels(labelProps) : undefined;
14714
- const textArray = text !== undefined ? `${text}`.split("\n") : [];
14715
- const baseStyle = datum.style && datum.style[type] || {};
14716
- const componentStyle = Array.isArray(componentStyleArray) ? componentStyleArray[index] : componentStyleArray;
14717
- const style = victory_core__WEBPACK_IMPORTED_MODULE_6__.evaluateStyle(lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, componentStyle, baseStyle, themeStyles[type]), labelProps);
14718
- const styleArray = textArray.length ? textArray.map(() => style) : [style];
14719
- return memo.concat(styleArray);
14720
- }, []);
14307
+ const VICTORY_VORONOI_CONTAINER_DEFAULT_PROPS = {
14308
+ activateData: true,
14309
+ activateLabels: true,
14310
+ labelComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(victory_tooltip__WEBPACK_IMPORTED_MODULE_3__.VictoryTooltip, null),
14311
+ voronoiPadding: 5
14312
+ };
14313
+ const getPoint = point => {
14314
+ const whitelist = ["_x", "_x1", "_x0", "_y", "_y1", "_y0"];
14315
+ return lodash_pick__WEBPACK_IMPORTED_MODULE_0___default()(point, whitelist);
14316
+ };
14317
+ const useVictoryVoronoiContainer = initialProps => {
14318
+ const props = {
14319
+ ...VICTORY_VORONOI_CONTAINER_DEFAULT_PROPS,
14320
+ ...initialProps
14321
+ };
14322
+ const {
14323
+ children
14324
+ } = props;
14325
+ const getDimension = () => {
14326
+ const {
14327
+ horizontal,
14328
+ voronoiDimension
14329
+ } = props;
14330
+ if (!horizontal || !voronoiDimension) {
14331
+ return voronoiDimension;
14721
14332
  }
14722
- getDefaultLabelProps(props, points) {
14723
- const {
14724
- voronoiDimension,
14725
- horizontal,
14726
- mouseFollowTooltips
14727
- } = props;
14728
- const point = this.getPoint(points[0]);
14729
- const multiPoint = voronoiDimension && points.length > 1;
14730
- const y = point._y1 !== undefined ? point._y1 : point._y;
14731
- const defaultHorizontalOrientation = y < 0 ? "left" : "right";
14732
- const defaultOrientation = y < 0 ? "bottom" : "top";
14733
- const labelOrientation = horizontal ? defaultHorizontalOrientation : defaultOrientation;
14734
- const orientation = mouseFollowTooltips ? undefined : labelOrientation;
14333
+ return voronoiDimension === "x" ? "y" : "x";
14334
+ };
14335
+ const getLabelPosition = (labelProps, points) => {
14336
+ const {
14337
+ mousePosition,
14338
+ mouseFollowTooltips
14339
+ } = props;
14340
+ const voronoiDimension = getDimension();
14341
+ const point = getPoint(points[0]);
14342
+ const basePosition = victory_core__WEBPACK_IMPORTED_MODULE_4__.scalePoint(props, point);
14343
+ let center = mouseFollowTooltips ? mousePosition : undefined;
14344
+ if (!voronoiDimension || points.length < 2) {
14735
14345
  return {
14736
- orientation,
14737
- pointerLength: multiPoint ? 0 : undefined,
14738
- constrainToVisibleArea: multiPoint || mouseFollowTooltips ? true : undefined
14346
+ ...basePosition,
14347
+ center: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelProps.center, center)
14739
14348
  };
14740
14349
  }
14741
- getLabelProps(props, points) {
14742
- const {
14743
- labels,
14744
- scale,
14745
- labelComponent,
14746
- theme,
14747
- width,
14748
- height
14749
- } = props;
14750
- const componentProps = labelComponent.props || {};
14751
- const text = points.reduce((memo, datum) => {
14752
- const labelProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, componentProps, {
14753
- datum,
14754
- active: true
14755
- });
14756
- const t = victory_core__WEBPACK_IMPORTED_MODULE_6__.isFunction(labels) ? labels(labelProps) : null;
14757
- if (t === null || t === undefined) {
14758
- return memo;
14759
- }
14760
- return memo.concat(`${t}`.split("\n"));
14761
- }, []);
14762
-
14763
- // remove properties from first point to make datum
14764
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
14765
- const {
14766
- childName,
14767
- eventKey,
14768
- style,
14769
- continuous,
14770
- ...datum
14771
- } = points[0];
14772
- const name = props.name === childName ? childName : `${props.name}-${childName}`;
14773
- const labelProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({
14774
- key: `${name}-${eventKey}-voronoi-tooltip`,
14775
- id: `${name}-${eventKey}-voronoi-tooltip`,
14776
- active: true,
14777
- renderInPortal: false,
14778
- activePoints: points,
14350
+ const x = voronoiDimension === "y" ? mousePosition.x : basePosition.x;
14351
+ const y = voronoiDimension === "x" ? mousePosition.y : basePosition.y;
14352
+ center = mouseFollowTooltips ? mousePosition : {
14353
+ x,
14354
+ y
14355
+ };
14356
+ return {
14357
+ x,
14358
+ y,
14359
+ center: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelProps.center, center)
14360
+ };
14361
+ };
14362
+ const getStyle = (points, type) => {
14363
+ const {
14364
+ labels,
14365
+ labelComponent,
14366
+ theme
14367
+ } = props;
14368
+ const componentProps = labelComponent.props || {};
14369
+ const themeStyles = theme && theme.voronoi && theme.voronoi.style ? theme.voronoi.style : {};
14370
+ const componentStyleArray = type === "flyout" ? componentProps.flyoutStyle : componentProps.style;
14371
+ return points.reduce((memo, datum, index) => {
14372
+ const labelProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, componentProps, {
14779
14373
  datum,
14780
- scale,
14781
- theme
14782
- }, componentProps, {
14783
- text,
14784
- width,
14785
- height,
14786
- style: this.getStyle(props, points, "labels"),
14787
- flyoutStyle: this.getStyle(props, points, "flyout")[0]
14788
- }, this.getDefaultLabelProps(props, points));
14789
- const labelPosition = this.getLabelPosition(props, labelProps, points);
14790
- return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelPosition, labelProps);
14791
- }
14792
- getTooltip(props) {
14793
- const {
14794
- labels,
14795
- activePoints,
14796
- labelComponent
14797
- } = props;
14798
- if (!labels) {
14799
- return null;
14800
- }
14801
- if (Array.isArray(activePoints) && activePoints.length) {
14802
- const labelProps = this.getLabelProps(props, activePoints);
14803
- const {
14804
- text
14805
- } = labelProps;
14806
- const showLabel = Array.isArray(text) ? text.filter(Boolean).length : text;
14807
- return showLabel ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().cloneElement(labelComponent, labelProps) : null;
14374
+ active: true
14375
+ });
14376
+ const text = victory_core__WEBPACK_IMPORTED_MODULE_4__.isFunction(labels) ? labels(labelProps) : undefined;
14377
+ const textArray = text !== undefined ? `${text}`.split("\n") : [];
14378
+ const baseStyle = datum.style && datum.style[type] || {};
14379
+ const componentStyle = Array.isArray(componentStyleArray) ? componentStyleArray[index] : componentStyleArray;
14380
+ const style = victory_core__WEBPACK_IMPORTED_MODULE_4__.evaluateStyle(lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, componentStyle, baseStyle, themeStyles[type]), labelProps);
14381
+ const styleArray = textArray.length ? textArray.map(() => style) : [style];
14382
+ return memo.concat(styleArray);
14383
+ }, []);
14384
+ };
14385
+ const getDefaultLabelProps = points => {
14386
+ const {
14387
+ voronoiDimension,
14388
+ horizontal,
14389
+ mouseFollowTooltips
14390
+ } = props;
14391
+ const point = getPoint(points[0]);
14392
+ const multiPoint = voronoiDimension && points.length > 1;
14393
+ const y = point._y1 !== undefined ? point._y1 : point._y;
14394
+ const defaultHorizontalOrientation = y < 0 ? "left" : "right";
14395
+ const defaultOrientation = y < 0 ? "bottom" : "top";
14396
+ const labelOrientation = horizontal ? defaultHorizontalOrientation : defaultOrientation;
14397
+ const orientation = mouseFollowTooltips ? undefined : labelOrientation;
14398
+ return {
14399
+ orientation,
14400
+ pointerLength: multiPoint ? 0 : undefined,
14401
+ constrainToVisibleArea: multiPoint || mouseFollowTooltips ? true : undefined
14402
+ };
14403
+ };
14404
+ const getLabelProps = points => {
14405
+ const {
14406
+ labels,
14407
+ scale,
14408
+ labelComponent,
14409
+ theme,
14410
+ width,
14411
+ height
14412
+ } = props;
14413
+ const componentProps = labelComponent.props || {};
14414
+ const text = points.reduce((memo, datum) => {
14415
+ const labelProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, componentProps, {
14416
+ datum,
14417
+ active: true
14418
+ });
14419
+ const t = victory_core__WEBPACK_IMPORTED_MODULE_4__.isFunction(labels) ? labels(labelProps) : null;
14420
+ if (t === null || t === undefined) {
14421
+ return memo;
14808
14422
  }
14423
+ return memo.concat(`${t}`.split("\n"));
14424
+ }, []);
14425
+
14426
+ // remove properties from first point to make datum
14427
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
14428
+ const {
14429
+ childName,
14430
+ eventKey,
14431
+ style,
14432
+ continuous,
14433
+ ...datum
14434
+ } = points[0];
14435
+ const name = props.name === childName ? childName : `${props.name}-${childName}`;
14436
+ const labelProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({
14437
+ key: `${name}-${eventKey}-voronoi-tooltip`,
14438
+ id: `${name}-${eventKey}-voronoi-tooltip`,
14439
+ active: true,
14440
+ renderInPortal: false,
14441
+ activePoints: points,
14442
+ datum,
14443
+ scale,
14444
+ theme
14445
+ }, componentProps, {
14446
+ text,
14447
+ width,
14448
+ height,
14449
+ style: getStyle(points, "labels"),
14450
+ flyoutStyle: getStyle(points, "flyout")[0]
14451
+ }, getDefaultLabelProps(points));
14452
+ const labelPosition = getLabelPosition(labelProps, points);
14453
+ return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelPosition, labelProps);
14454
+ };
14455
+ const getTooltip = () => {
14456
+ const {
14457
+ labels,
14458
+ activePoints,
14459
+ labelComponent
14460
+ } = props;
14461
+ if (!labels) {
14809
14462
  return null;
14810
14463
  }
14811
-
14812
- // Overrides method in VictoryContainer
14813
- getChildren(props) {
14814
- return [...react__WEBPACK_IMPORTED_MODULE_2___default().Children.toArray(props.children), this.getTooltip(props)];
14464
+ if (Array.isArray(activePoints) && activePoints.length) {
14465
+ const labelProps = getLabelProps(activePoints);
14466
+ const {
14467
+ text
14468
+ } = labelProps;
14469
+ const showLabel = Array.isArray(text) ? text.filter(Boolean).length : text;
14470
+ return showLabel ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().cloneElement(labelComponent, labelProps) : null;
14815
14471
  }
14472
+ return null;
14816
14473
  };
14817
- }
14818
- const VictoryVoronoiContainer = voronoiContainerMixin(victory_core__WEBPACK_IMPORTED_MODULE_3__.VictoryContainer);
14474
+ return {
14475
+ props,
14476
+ children: [...react__WEBPACK_IMPORTED_MODULE_2___default().Children.toArray(children), getTooltip()]
14477
+ };
14478
+ };
14479
+ const VictoryVoronoiContainer = initialProps => {
14480
+ const {
14481
+ props,
14482
+ children
14483
+ } = useVictoryVoronoiContainer(initialProps);
14484
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_5__.VictoryContainer, props, children);
14485
+ };
14486
+ VictoryVoronoiContainer.role = "container";
14487
+ VictoryVoronoiContainer.defaultEvents = initialProps => {
14488
+ const props = {
14489
+ ...VICTORY_VORONOI_CONTAINER_DEFAULT_PROPS,
14490
+ ...initialProps
14491
+ };
14492
+ const createEventHandler = (handler, disabled) =>
14493
+ // eslint-disable-next-line max-params
14494
+ (event, targetProps, eventKey, context) => disabled || props.disable ? {} : handler(event, {
14495
+ ...props,
14496
+ ...targetProps
14497
+ }, eventKey, context);
14498
+ return [{
14499
+ target: "parent",
14500
+ eventHandlers: {
14501
+ onMouseLeave: createEventHandler(_voronoi_helpers__WEBPACK_IMPORTED_MODULE_6__.VoronoiHelpers.onMouseLeave),
14502
+ onTouchCancel: createEventHandler(_voronoi_helpers__WEBPACK_IMPORTED_MODULE_6__.VoronoiHelpers.onMouseLeave),
14503
+ onMouseMove: createEventHandler(_voronoi_helpers__WEBPACK_IMPORTED_MODULE_6__.VoronoiHelpers.onMouseMove),
14504
+ onTouchMove: createEventHandler(_voronoi_helpers__WEBPACK_IMPORTED_MODULE_6__.VoronoiHelpers.onMouseMove)
14505
+ }
14506
+ }, {
14507
+ target: "data",
14508
+ eventHandlers: props.disable ? {} : {
14509
+ onMouseOver: () => null,
14510
+ onMouseOut: () => null,
14511
+ onMouseMove: () => null
14512
+ }
14513
+ }];
14514
+ };
14819
14515
 
14820
14516
  /***/ }),
14821
14517
 
@@ -15092,85 +14788,120 @@ const VoronoiHelpers = new VoronoiHelpersClass();
15092
14788
  "use strict";
15093
14789
  __webpack_require__.r(__webpack_exports__);
15094
14790
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
14791
+ /* harmony export */ "VICTORY_ZOOM_CONTAINER_DEFAULT_PROPS": function() { return /* binding */ VICTORY_ZOOM_CONTAINER_DEFAULT_PROPS; },
15095
14792
  /* harmony export */ "VictoryZoomContainer": function() { return /* binding */ VictoryZoomContainer; },
15096
- /* harmony export */ "zoomContainerMixin": function() { return /* binding */ zoomContainerMixin; }
14793
+ /* harmony export */ "useVictoryZoomContainer": function() { return /* binding */ useVictoryZoomContainer; }
15097
14794
  /* harmony export */ });
15098
14795
  /* 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");
15099
14796
  /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_0__);
15100
14797
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
15101
14798
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
15102
14799
  /* harmony import */ var _zoom_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./zoom-helpers */ "../../victory-zoom-container/es/zoom-helpers.js");
15103
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
15104
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-clip-container/victory-clip-container.js");
15105
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/data.js");
15106
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/helpers.js");
14800
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-clip-container/victory-clip-container.js");
14801
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/data.js");
14802
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
15107
14803
 
15108
14804
 
15109
14805
 
15110
14806
 
15111
14807
  const DEFAULT_DOWNSAMPLE = 150;
15112
- function zoomContainerMixin(Base) {
15113
- // @ts-expect-error "TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'."
15114
- return class VictoryZoomContainer extends Base {
15115
- static displayName = "VictoryZoomContainer";
15116
- static defaultProps = {
15117
- ...victory_core__WEBPACK_IMPORTED_MODULE_2__.VictoryContainer.defaultProps,
15118
- clipContainerComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_3__.VictoryClipContainer, null),
15119
- allowPan: true,
15120
- allowZoom: true,
15121
- zoomActive: false
14808
+ const VICTORY_ZOOM_CONTAINER_DEFAULT_PROPS = {
14809
+ clipContainerComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_2__.VictoryClipContainer, null),
14810
+ allowPan: true,
14811
+ allowZoom: true,
14812
+ zoomActive: false
14813
+ };
14814
+ const useVictoryZoomContainer = initialProps => {
14815
+ const props = {
14816
+ ...VICTORY_ZOOM_CONTAINER_DEFAULT_PROPS,
14817
+ ...initialProps
14818
+ };
14819
+ const {
14820
+ children,
14821
+ currentDomain,
14822
+ zoomActive,
14823
+ allowZoom,
14824
+ downsample,
14825
+ scale,
14826
+ clipContainerComponent,
14827
+ polar,
14828
+ origin,
14829
+ horizontal
14830
+ } = props;
14831
+ const downsampleZoomData = (child, domain) => {
14832
+ const getData = childProps => {
14833
+ const {
14834
+ data,
14835
+ x,
14836
+ y
14837
+ } = childProps;
14838
+ const defaultGetData = child.type && typeof child.type.getData === "function" ? child.type.getData : () => undefined;
14839
+ // skip costly data formatting if x and y accessors are not present
14840
+ return Array.isArray(data) && !x && !y ? data : defaultGetData(childProps);
15122
14841
  };
15123
- static defaultEvents(props) {
15124
- return [{
15125
- target: "parent",
15126
- eventHandlers: {
15127
- onMouseDown: (evt, targetProps) => {
15128
- return props.disable ? {} : _zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseDown(evt, targetProps);
15129
- },
15130
- onTouchStart: (evt, targetProps) => {
15131
- return props.disable ? {} : _zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseDown(evt, targetProps);
15132
- },
15133
- onMouseUp: (evt, targetProps) => {
15134
- return props.disable ? {} : _zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseUp(evt, targetProps);
15135
- },
15136
- onTouchEnd: (evt, targetProps) => {
15137
- return props.disable ? {} : _zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseUp(evt, targetProps);
15138
- },
15139
- onMouseLeave: (evt, targetProps) => {
15140
- return props.disable ? {} : _zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseLeave(evt, targetProps);
15141
- },
15142
- onTouchCancel: (evt, targetProps) => {
15143
- return props.disable ? {} : _zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseLeave(evt, targetProps);
15144
- },
15145
- // eslint-disable-next-line max-params
15146
- onMouseMove: (evt, targetProps, eventKey, ctx) => {
15147
- if (props.disable) {
15148
- return {};
15149
- }
15150
- return _zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseMove(evt, targetProps, eventKey, ctx);
15151
- },
15152
- // eslint-disable-next-line max-params
15153
- onTouchMove: (evt, targetProps, eventKey, ctx) => {
15154
- if (props.disable) {
15155
- return {};
15156
- }
15157
- evt.preventDefault();
15158
- return _zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseMove(evt, targetProps, eventKey, ctx);
15159
- },
15160
- ...(props.disable || !props.allowZoom ? {} : {
15161
- onWheel: _zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onWheel
15162
- })
15163
- }
15164
- }];
14842
+ const data = getData(child.props);
14843
+
14844
+ // return undefined if downsample is not run, then default() will replace with child.props.data
14845
+ if (!downsample || !domain || !data) {
14846
+ return undefined;
15165
14847
  }
15166
- clipDataComponents(children, props) {
15167
- const {
15168
- scale,
15169
- clipContainerComponent,
15170
- polar,
15171
- origin,
15172
- horizontal
15173
- } = props;
14848
+ const maxPoints = downsample === true ? DEFAULT_DOWNSAMPLE : downsample;
14849
+ const dimension = props.zoomDimension || "x";
14850
+
14851
+ // important: assumes data is ordered by dimension
14852
+ // get the start and end of the data that is in the current visible domain
14853
+ let startIndex = data.findIndex(d => d[dimension] >= domain[dimension][0]);
14854
+ let endIndex = data.findIndex(d => d[dimension] > domain[dimension][1]);
14855
+ // pick one more point (if available) at each end so that VictoryLine, VictoryArea connect
14856
+ if (startIndex !== 0) {
14857
+ startIndex -= 1;
14858
+ }
14859
+ if (endIndex !== -1) {
14860
+ endIndex += 1;
14861
+ }
14862
+ const visibleData = data.slice(startIndex, endIndex);
14863
+ return victory_core__WEBPACK_IMPORTED_MODULE_3__.downsample(visibleData, maxPoints, startIndex);
14864
+ };
14865
+ const modifiedChildren = react__WEBPACK_IMPORTED_MODULE_1___default().Children.toArray(children).map(child => {
14866
+ const role = child.type && child.type.role;
14867
+ const isDataComponent = victory_core__WEBPACK_IMPORTED_MODULE_3__.isDataComponent(child);
14868
+ const originalDomain = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, props.originalDomain, props.domain);
14869
+ const zoomDomain = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, props.zoomDomain, props.domain);
14870
+ const cachedZoomDomain = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, props.cachedZoomDomain, props.domain);
14871
+ let domain;
14872
+ if (!_zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.checkDomainEquality(zoomDomain, cachedZoomDomain)) {
14873
+ // if zoomDomain has been changed, use it
14874
+ domain = zoomDomain;
14875
+ } else if (allowZoom && !zoomActive) {
14876
+ // if user has zoomed all the way out, use the child domain
14877
+ domain = child.props.domain;
14878
+ } else {
14879
+ // default: use currentDomain, set by the event handlers
14880
+ domain = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, currentDomain, originalDomain);
14881
+ }
14882
+ let newDomain = props.polar ? {
14883
+ x: originalDomain.x,
14884
+ y: [0, domain.y[1]]
14885
+ } : domain;
14886
+ if (newDomain && props.zoomDimension) {
14887
+ // if zooming is restricted to a dimension, don't squash changes to zoomDomain in other dim
14888
+ newDomain = {
14889
+ ...zoomDomain,
14890
+ [props.zoomDimension]: newDomain[props.zoomDimension]
14891
+ };
14892
+ }
14893
+
14894
+ // don't downsample stacked data
14895
+ const childProps = isDataComponent && role !== "stack" ? {
14896
+ domain: newDomain,
14897
+ data: downsampleZoomData(child, newDomain)
14898
+ } : {
14899
+ domain: newDomain
14900
+ };
14901
+ const newChild = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(child, lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(childProps, child.props));
14902
+
14903
+ // Clip data components
14904
+ if (victory_core__WEBPACK_IMPORTED_MODULE_3__.isDataComponent(newChild)) {
15174
14905
  const rangeX = horizontal ? scale.y.range() : scale.x.range();
15175
14906
  const rangeY = horizontal ? scale.x.range() : scale.y.range();
15176
14907
  const plottableWidth = Math.abs(rangeX[0] - rangeX[1]);
@@ -15186,110 +14917,51 @@ function zoomContainerMixin(Base) {
15186
14917
  radius: polar ? radius : undefined,
15187
14918
  ...clipContainerComponent.props
15188
14919
  });
15189
- return react__WEBPACK_IMPORTED_MODULE_1___default().Children.toArray(children).map(child => {
15190
- if (!victory_core__WEBPACK_IMPORTED_MODULE_5__.isDataComponent(child)) {
15191
- return child;
15192
- }
15193
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(child, {
15194
- groupComponent
15195
- });
15196
- });
15197
- }
15198
- modifyPolarDomain(domain, originalDomain) {
15199
- // Only zoom the radius of polar charts. Zooming angles is very confusing
15200
- return {
15201
- x: originalDomain.x,
15202
- y: [0, domain.y[1]]
15203
- };
15204
- }
15205
- downsampleZoomData(props, child, domain) {
15206
- const {
15207
- downsample
15208
- } = props;
15209
- const getData = childProps => {
15210
- const {
15211
- data,
15212
- x,
15213
- y
15214
- } = childProps;
15215
- const defaultGetData = child.type && victory_core__WEBPACK_IMPORTED_MODULE_6__.isFunction(child.type.getData) ? child.type.getData : () => undefined;
15216
- // skip costly data formatting if x and y accessors are not present
15217
- return Array.isArray(data) && !x && !y ? data : defaultGetData(childProps);
15218
- };
15219
- const data = getData(child.props);
15220
-
15221
- // return undefined if downsample is not run, then default() will replace with child.props.data
15222
- if (!downsample || !domain || !data) {
15223
- return undefined;
15224
- }
15225
- const maxPoints = downsample === true ? DEFAULT_DOWNSAMPLE : downsample;
15226
- const dimension = props.zoomDimension || "x";
15227
-
15228
- // important: assumes data is ordered by dimension
15229
- // get the start and end of the data that is in the current visible domain
15230
- let startIndex = data.findIndex(d => d[dimension] >= domain[dimension][0]);
15231
- let endIndex = data.findIndex(d => d[dimension] > domain[dimension][1]);
15232
- // pick one more point (if available) at each end so that VictoryLine, VictoryArea connect
15233
- if (startIndex !== 0) {
15234
- startIndex -= 1;
15235
- }
15236
- if (endIndex !== -1) {
15237
- endIndex += 1;
15238
- }
15239
- const visibleData = data.slice(startIndex, endIndex);
15240
- return victory_core__WEBPACK_IMPORTED_MODULE_5__.downsample(visibleData, maxPoints, startIndex);
15241
- }
15242
- modifyChildren(props) {
15243
- const childComponents = react__WEBPACK_IMPORTED_MODULE_1___default().Children.toArray(props.children);
15244
- return childComponents.map(child => {
15245
- const role = child.type && child.type.role;
15246
- const isDataComponent = victory_core__WEBPACK_IMPORTED_MODULE_5__.isDataComponent(child);
15247
- const {
15248
- currentDomain,
15249
- zoomActive,
15250
- allowZoom
15251
- } = props;
15252
- const originalDomain = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, props.originalDomain, props.domain);
15253
- const zoomDomain = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, props.zoomDomain, props.domain);
15254
- const cachedZoomDomain = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, props.cachedZoomDomain, props.domain);
15255
- let domain;
15256
- if (!_zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.checkDomainEquality(zoomDomain, cachedZoomDomain)) {
15257
- // if zoomDomain has been changed, use it
15258
- domain = zoomDomain;
15259
- } else if (allowZoom && !zoomActive) {
15260
- // if user has zoomed all the way out, use the child domain
15261
- domain = child.props.domain;
15262
- } else {
15263
- // default: use currentDomain, set by the event handlers
15264
- domain = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, currentDomain, originalDomain);
15265
- }
15266
- let newDomain = props.polar ? this.modifyPolarDomain(domain, originalDomain) : domain;
15267
- if (newDomain && props.zoomDimension) {
15268
- // if zooming is restricted to a dimension, don't squash changes to zoomDomain in other dim
15269
- newDomain = {
15270
- ...zoomDomain,
15271
- [props.zoomDimension]: newDomain[props.zoomDimension]
15272
- };
15273
- }
15274
- // don't downsample stacked data
15275
- const newProps = isDataComponent && role !== "stack" ? {
15276
- domain: newDomain,
15277
- data: this.downsampleZoomData(props, child, newDomain)
15278
- } : {
15279
- domain: newDomain
15280
- };
15281
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(child, lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(newProps, child.props));
14920
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(newChild, {
14921
+ groupComponent
15282
14922
  });
15283
14923
  }
15284
-
15285
- // Overrides method in VictoryContainer
15286
- getChildren(props) {
15287
- const children = this.modifyChildren(props);
15288
- return this.clipDataComponents(children, props);
15289
- }
14924
+ return newChild;
14925
+ });
14926
+ return {
14927
+ props,
14928
+ children: modifiedChildren
15290
14929
  };
15291
- }
15292
- const VictoryZoomContainer = zoomContainerMixin(victory_core__WEBPACK_IMPORTED_MODULE_2__.VictoryContainer);
14930
+ };
14931
+ const VictoryZoomContainer = initialProps => {
14932
+ const {
14933
+ props,
14934
+ children
14935
+ } = useVictoryZoomContainer(initialProps);
14936
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_5__.VictoryContainer, props, children);
14937
+ };
14938
+ VictoryZoomContainer.role = "container";
14939
+ VictoryZoomContainer.defaultEvents = initialProps => {
14940
+ const props = {
14941
+ ...VICTORY_ZOOM_CONTAINER_DEFAULT_PROPS,
14942
+ ...initialProps
14943
+ };
14944
+ const createEventHandler = (handler, disabled) =>
14945
+ // eslint-disable-next-line max-params
14946
+ (event, targetProps, eventKey, context) => disabled || props.disable ? {} : handler(event, {
14947
+ ...props,
14948
+ ...targetProps
14949
+ }, eventKey, context);
14950
+ return [{
14951
+ target: "parent",
14952
+ eventHandlers: {
14953
+ onMouseDown: createEventHandler(_zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseDown),
14954
+ onTouchStart: createEventHandler(_zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseDown),
14955
+ onMouseUp: createEventHandler(_zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseUp),
14956
+ onTouchEnd: createEventHandler(_zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseUp),
14957
+ onMouseLeave: createEventHandler(_zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseLeave),
14958
+ onTouchCancel: createEventHandler(_zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseLeave),
14959
+ onMouseMove: createEventHandler(_zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseMove),
14960
+ onTouchMove: createEventHandler(_zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseMove),
14961
+ onWheel: createEventHandler(_zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onWheel, !props.allowZoom)
14962
+ }
14963
+ }];
14964
+ };
15293
14965
 
15294
14966
  /***/ }),
15295
14967
 
@@ -20994,221 +20666,6 @@ year.every = function(k) {
20994
20666
  var years = year.range;
20995
20667
 
20996
20668
 
20997
- /***/ }),
20998
-
20999
- /***/ "../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/index.js":
21000
- /*!*************************************************************************************!*\
21001
- !*** ../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/index.js ***!
21002
- \*************************************************************************************/
21003
- /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
21004
-
21005
- "use strict";
21006
- __webpack_require__.r(__webpack_exports__);
21007
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
21008
- /* harmony export */ "interval": function() { return /* reexport safe */ _interval_js__WEBPACK_IMPORTED_MODULE_2__["default"]; },
21009
- /* harmony export */ "now": function() { return /* reexport safe */ _timer_js__WEBPACK_IMPORTED_MODULE_0__.now; },
21010
- /* harmony export */ "timeout": function() { return /* reexport safe */ _timeout_js__WEBPACK_IMPORTED_MODULE_1__["default"]; },
21011
- /* harmony export */ "timer": function() { return /* reexport safe */ _timer_js__WEBPACK_IMPORTED_MODULE_0__.timer; },
21012
- /* harmony export */ "timerFlush": function() { return /* reexport safe */ _timer_js__WEBPACK_IMPORTED_MODULE_0__.timerFlush; }
21013
- /* harmony export */ });
21014
- /* harmony import */ var _timer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./timer.js */ "../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js");
21015
- /* harmony import */ var _timeout_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./timeout.js */ "../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timeout.js");
21016
- /* harmony import */ var _interval_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./interval.js */ "../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/interval.js");
21017
-
21018
-
21019
-
21020
-
21021
-
21022
-
21023
-
21024
- /***/ }),
21025
-
21026
- /***/ "../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/interval.js":
21027
- /*!****************************************************************************************!*\
21028
- !*** ../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/interval.js ***!
21029
- \****************************************************************************************/
21030
- /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
21031
-
21032
- "use strict";
21033
- __webpack_require__.r(__webpack_exports__);
21034
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
21035
- /* harmony export */ "default": function() { return /* export default binding */ __WEBPACK_DEFAULT_EXPORT__; }
21036
- /* harmony export */ });
21037
- /* harmony import */ var _timer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./timer.js */ "../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js");
21038
-
21039
-
21040
- /* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(callback, delay, time) {
21041
- var t = new _timer_js__WEBPACK_IMPORTED_MODULE_0__.Timer, total = delay;
21042
- if (delay == null) return t.restart(callback, delay, time), t;
21043
- t._restart = t.restart;
21044
- t.restart = function(callback, delay, time) {
21045
- delay = +delay, time = time == null ? (0,_timer_js__WEBPACK_IMPORTED_MODULE_0__.now)() : +time;
21046
- t._restart(function tick(elapsed) {
21047
- elapsed += total;
21048
- t._restart(tick, total += delay, time);
21049
- callback(elapsed);
21050
- }, delay, time);
21051
- }
21052
- t.restart(callback, delay, time);
21053
- return t;
21054
- }
21055
-
21056
-
21057
- /***/ }),
21058
-
21059
- /***/ "../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timeout.js":
21060
- /*!***************************************************************************************!*\
21061
- !*** ../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timeout.js ***!
21062
- \***************************************************************************************/
21063
- /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
21064
-
21065
- "use strict";
21066
- __webpack_require__.r(__webpack_exports__);
21067
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
21068
- /* harmony export */ "default": function() { return /* export default binding */ __WEBPACK_DEFAULT_EXPORT__; }
21069
- /* harmony export */ });
21070
- /* harmony import */ var _timer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./timer.js */ "../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js");
21071
-
21072
-
21073
- /* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(callback, delay, time) {
21074
- var t = new _timer_js__WEBPACK_IMPORTED_MODULE_0__.Timer;
21075
- delay = delay == null ? 0 : +delay;
21076
- t.restart(elapsed => {
21077
- t.stop();
21078
- callback(elapsed + delay);
21079
- }, delay, time);
21080
- return t;
21081
- }
21082
-
21083
-
21084
- /***/ }),
21085
-
21086
- /***/ "../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js":
21087
- /*!*************************************************************************************!*\
21088
- !*** ../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js ***!
21089
- \*************************************************************************************/
21090
- /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
21091
-
21092
- "use strict";
21093
- __webpack_require__.r(__webpack_exports__);
21094
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
21095
- /* harmony export */ "Timer": function() { return /* binding */ Timer; },
21096
- /* harmony export */ "now": function() { return /* binding */ now; },
21097
- /* harmony export */ "timer": function() { return /* binding */ timer; },
21098
- /* harmony export */ "timerFlush": function() { return /* binding */ timerFlush; }
21099
- /* harmony export */ });
21100
- var frame = 0, // is an animation frame pending?
21101
- timeout = 0, // is a timeout pending?
21102
- interval = 0, // are any timers active?
21103
- pokeDelay = 1000, // how frequently we check for clock skew
21104
- taskHead,
21105
- taskTail,
21106
- clockLast = 0,
21107
- clockNow = 0,
21108
- clockSkew = 0,
21109
- clock = typeof performance === "object" && performance.now ? performance : Date,
21110
- setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };
21111
-
21112
- function now() {
21113
- return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
21114
- }
21115
-
21116
- function clearNow() {
21117
- clockNow = 0;
21118
- }
21119
-
21120
- function Timer() {
21121
- this._call =
21122
- this._time =
21123
- this._next = null;
21124
- }
21125
-
21126
- Timer.prototype = timer.prototype = {
21127
- constructor: Timer,
21128
- restart: function(callback, delay, time) {
21129
- if (typeof callback !== "function") throw new TypeError("callback is not a function");
21130
- time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
21131
- if (!this._next && taskTail !== this) {
21132
- if (taskTail) taskTail._next = this;
21133
- else taskHead = this;
21134
- taskTail = this;
21135
- }
21136
- this._call = callback;
21137
- this._time = time;
21138
- sleep();
21139
- },
21140
- stop: function() {
21141
- if (this._call) {
21142
- this._call = null;
21143
- this._time = Infinity;
21144
- sleep();
21145
- }
21146
- }
21147
- };
21148
-
21149
- function timer(callback, delay, time) {
21150
- var t = new Timer;
21151
- t.restart(callback, delay, time);
21152
- return t;
21153
- }
21154
-
21155
- function timerFlush() {
21156
- now(); // Get the current time, if not already set.
21157
- ++frame; // Pretend we’ve set an alarm, if we haven’t already.
21158
- var t = taskHead, e;
21159
- while (t) {
21160
- if ((e = clockNow - t._time) >= 0) t._call.call(undefined, e);
21161
- t = t._next;
21162
- }
21163
- --frame;
21164
- }
21165
-
21166
- function wake() {
21167
- clockNow = (clockLast = clock.now()) + clockSkew;
21168
- frame = timeout = 0;
21169
- try {
21170
- timerFlush();
21171
- } finally {
21172
- frame = 0;
21173
- nap();
21174
- clockNow = 0;
21175
- }
21176
- }
21177
-
21178
- function poke() {
21179
- var now = clock.now(), delay = now - clockLast;
21180
- if (delay > pokeDelay) clockSkew -= delay, clockLast = now;
21181
- }
21182
-
21183
- function nap() {
21184
- var t0, t1 = taskHead, t2, time = Infinity;
21185
- while (t1) {
21186
- if (t1._call) {
21187
- if (time > t1._time) time = t1._time;
21188
- t0 = t1, t1 = t1._next;
21189
- } else {
21190
- t2 = t1._next, t1._next = null;
21191
- t1 = t0 ? t0._next = t2 : taskHead = t2;
21192
- }
21193
- }
21194
- taskTail = t0;
21195
- sleep(time);
21196
- }
21197
-
21198
- function sleep(time) {
21199
- if (frame) return; // Soonest alarm already set, or will be.
21200
- if (timeout) timeout = clearTimeout(timeout);
21201
- var delay = time - clockNow; // Strictly less than if we recomputed clockNow.
21202
- if (delay > 24) {
21203
- if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);
21204
- if (interval) interval = clearInterval(interval);
21205
- } else {
21206
- if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
21207
- frame = 1, setFrame(wake);
21208
- }
21209
- }
21210
-
21211
-
21212
20669
  /***/ }),
21213
20670
 
21214
20671
  /***/ "../../../node_modules/.pnpm/internmap@2.0.3/node_modules/internmap/src/index.js":
@@ -21389,11 +20846,10 @@ var __webpack_exports__ = {};
21389
20846
  \******************/
21390
20847
  __webpack_require__.r(__webpack_exports__);
21391
20848
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
21392
- /* harmony export */ "combineContainerMixins": function() { return /* reexport safe */ _create_container__WEBPACK_IMPORTED_MODULE_0__.combineContainerMixins; },
21393
20849
  /* harmony export */ "createContainer": function() { return /* reexport safe */ _create_container__WEBPACK_IMPORTED_MODULE_0__.createContainer; },
21394
20850
  /* harmony export */ "makeCreateContainerFunction": function() { return /* reexport safe */ _create_container__WEBPACK_IMPORTED_MODULE_0__.makeCreateContainerFunction; }
21395
20851
  /* harmony export */ });
21396
- /* harmony import */ var _create_container__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./create-container */ "./create-container.ts");
20852
+ /* harmony import */ var _create_container__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./create-container */ "./create-container.tsx");
21397
20853
 
21398
20854
  }();
21399
20855
  /******/ return __webpack_exports__;