victory-create-container 37.0.2 → 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,204 +7016,208 @@ __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
-
7463
-
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
+
7220
+
7464
7221
 
7465
7222
 
7466
7223
 
@@ -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
 
@@ -8342,17 +8068,83 @@ VictoryLabel.defaultStyles = defaultStyles;
8342
8068
  "use strict";
8343
8069
  __webpack_require__.r(__webpack_exports__);
8344
8070
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8345
- /* 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; }
8346
8074
  /* harmony export */ });
8347
8075
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
8348
8076
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
8349
8077
 
8350
- /**
8351
- * The React context object consumers may use to access the context of the
8352
- * portal.
8353
- */
8354
- const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({});
8078
+ const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined);
8355
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
+ };
8356
8148
 
8357
8149
  /***/ }),
8358
8150
 
@@ -8369,39 +8161,13 @@ __webpack_require__.r(__webpack_exports__);
8369
8161
  /* harmony export */ });
8370
8162
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
8371
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); }
8372
8165
 
8373
- class Portal extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) {
8374
- static displayName = "Portal";
8375
- constructor(props) {
8376
- super(props);
8377
- this.map = {};
8378
- this.index = 1;
8379
- }
8380
- portalRegister = () => {
8381
- return ++this.index;
8382
- };
8383
- portalUpdate = (key, element) => {
8384
- this.map[key] = element;
8385
- this.forceUpdate();
8386
- };
8387
- portalDeregister = key => {
8388
- delete this.map[key];
8389
- this.forceUpdate();
8390
- };
8391
- getChildren() {
8392
- return Object.keys(this.map).map(key => {
8393
- const el = this.map[key];
8394
- return el ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(el, {
8395
- key
8396
- }) : el;
8397
- });
8398
- }
8399
-
8400
- // Overridden in victory-core-native
8401
- render() {
8402
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", this.props, this.getChildren());
8403
- }
8404
- }
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
+ });
8405
8171
 
8406
8172
  /***/ }),
8407
8173
 
@@ -8428,59 +8194,42 @@ __webpack_require__.r(__webpack_exports__);
8428
8194
 
8429
8195
 
8430
8196
 
8431
- class VictoryPortal extends (react__WEBPACK_IMPORTED_MODULE_1___default().Component) {
8432
- static displayName = "VictoryPortal";
8433
- static role = "portal";
8434
- static defaultProps = {
8435
- groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
8436
- };
8437
- static contextType = _portal_context__WEBPACK_IMPORTED_MODULE_2__.PortalContext;
8438
- componentDidMount() {
8439
- if (!this.checkedContext) {
8440
- if (typeof this.context.portalUpdate !== "function") {
8441
- const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
8442
- _victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
8443
- this.renderInPlace = true;
8444
- }
8445
- this.checkedContext = true;
8446
- }
8447
- this.forceUpdate();
8448
- }
8449
- componentDidUpdate() {
8450
- if (!this.renderInPlace) {
8451
- this.portalKey = this.portalKey || this.context.portalRegister();
8452
- this.context.portalUpdate(this.portalKey, this.element);
8453
- }
8454
- }
8455
- componentWillUnmount() {
8456
- if (this.context && this.context.portalDeregister) {
8457
- this.context.portalDeregister(this.portalKey);
8458
- }
8459
- }
8460
-
8461
- // Overridden in victory-core-native
8462
- renderPortal(child) {
8463
- if (this.renderInPlace) {
8464
- return child;
8465
- }
8466
- this.element = child;
8467
- return null;
8468
- }
8469
- render() {
8470
- const children = Array.isArray(this.props.children) ? this.props.children[0] : this.props.children;
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);
8210
+ }
8211
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
8212
+ const children = Array.isArray(props.children) ? props.children[0] : props.children;
8471
8213
  const {
8472
8214
  groupComponent
8473
- } = this.props;
8215
+ } = props;
8474
8216
  const childProps = children && children.props || {};
8475
8217
  const standardProps = childProps.groupComponent ? {
8476
8218
  groupComponent,
8477
8219
  standalone: false
8478
8220
  } : {};
8479
- 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"]));
8480
8222
  const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
8481
- return this.renderPortal(child);
8482
- }
8483
- }
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";
8484
8233
 
8485
8234
  /***/ }),
8486
8235
 
@@ -11884,6 +11633,44 @@ function warn(message) {
11884
11633
 
11885
11634
  /***/ }),
11886
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
+
11887
11674
  /***/ "../../victory-core/es/victory-util/scale.js":
11888
11675
  /*!***************************************************!*\
11889
11676
  !*** ../../victory-core/es/victory-util/scale.js ***!
@@ -12556,98 +12343,6 @@ const approximateTextSize = (text, style) => _approximateTextSizeInternal.impl(t
12556
12343
 
12557
12344
  /***/ }),
12558
12345
 
12559
- /***/ "../../victory-core/es/victory-util/timer-context.js":
12560
- /*!***********************************************************!*\
12561
- !*** ../../victory-core/es/victory-util/timer-context.js ***!
12562
- \***********************************************************/
12563
- /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
12564
-
12565
- "use strict";
12566
- __webpack_require__.r(__webpack_exports__);
12567
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
12568
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
12569
- /* harmony import */ var _timer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./timer */ "../../victory-core/es/victory-util/timer.js");
12570
-
12571
-
12572
-
12573
- /**
12574
- * The React context object consumers may use to access or override the global
12575
- * timer.
12576
- */
12577
- const TimerContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({
12578
- transitionTimer: new _timer__WEBPACK_IMPORTED_MODULE_1__["default"](),
12579
- animationTimer: new _timer__WEBPACK_IMPORTED_MODULE_1__["default"]()
12580
- });
12581
- TimerContext.displayName = "TimerContext";
12582
- /* harmony default export */ __webpack_exports__["default"] = (TimerContext);
12583
-
12584
- /***/ }),
12585
-
12586
- /***/ "../../victory-core/es/victory-util/timer.js":
12587
- /*!***************************************************!*\
12588
- !*** ../../victory-core/es/victory-util/timer.js ***!
12589
- \***************************************************/
12590
- /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
12591
-
12592
- "use strict";
12593
- __webpack_require__.r(__webpack_exports__);
12594
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
12595
- /* harmony export */ "default": function() { return /* binding */ Timer; }
12596
- /* harmony export */ });
12597
- /* harmony import */ var victory_vendor_d3_timer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! victory-vendor/d3-timer */ "../../victory-vendor/es/d3-timer.js");
12598
-
12599
- class Timer {
12600
- constructor() {
12601
- this.shouldAnimate = true;
12602
- this.subscribers = [];
12603
- this.timer = null;
12604
- this.activeSubscriptions = 0;
12605
- }
12606
- bypassAnimation() {
12607
- this.shouldAnimate = false;
12608
- }
12609
- resumeAnimation() {
12610
- this.shouldAnimate = true;
12611
- }
12612
- loop = () => {
12613
- this.subscribers.forEach(s => {
12614
- s.callback((0,victory_vendor_d3_timer__WEBPACK_IMPORTED_MODULE_0__.now)() - s.startTime, s.duration);
12615
- });
12616
- };
12617
- start() {
12618
- if (!this.timer) {
12619
- this.timer = (0,victory_vendor_d3_timer__WEBPACK_IMPORTED_MODULE_0__.timer)(this.loop);
12620
- }
12621
- }
12622
- stop() {
12623
- if (this.timer) {
12624
- this.timer.stop();
12625
- this.timer = null;
12626
- }
12627
- }
12628
- subscribe(callback, duration) {
12629
- const subscriptionID = this.subscribers.push({
12630
- startTime: (0,victory_vendor_d3_timer__WEBPACK_IMPORTED_MODULE_0__.now)(),
12631
- callback,
12632
- duration: this.shouldAnimate ? duration : 0
12633
- });
12634
- this.activeSubscriptions++;
12635
- this.start();
12636
- return subscriptionID;
12637
- }
12638
- unsubscribe(id) {
12639
- if (id !== null && this.subscribers[id - 1]) {
12640
- delete this.subscribers[id - 1];
12641
- this.activeSubscriptions--;
12642
- }
12643
- if (this.activeSubscriptions === 0) {
12644
- this.stop();
12645
- }
12646
- }
12647
- }
12648
-
12649
- /***/ }),
12650
-
12651
12346
  /***/ "../../victory-core/es/victory-util/user-props.js":
12652
12347
  /*!********************************************************!*\
12653
12348
  !*** ../../victory-core/es/victory-util/user-props.js ***!
@@ -13323,8 +13018,9 @@ const CursorHelpers = new CursorHelpersClass();
13323
13018
  "use strict";
13324
13019
  __webpack_require__.r(__webpack_exports__);
13325
13020
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13021
+ /* harmony export */ "VICTORY_CURSOR_CONTAINER_DEFAULT_PROPS": function() { return /* binding */ VICTORY_CURSOR_CONTAINER_DEFAULT_PROPS; },
13326
13022
  /* harmony export */ "VictoryCursorContainer": function() { return /* binding */ VictoryCursorContainer; },
13327
- /* harmony export */ "cursorContainerMixin": function() { return /* binding */ cursorContainerMixin; }
13023
+ /* harmony export */ "useVictoryCursorContainer": function() { return /* binding */ useVictoryCursorContainer; }
13328
13024
  /* harmony export */ });
13329
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");
13330
13026
  /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_isObject__WEBPACK_IMPORTED_MODULE_0__);
@@ -13332,164 +13028,179 @@ __webpack_require__.r(__webpack_exports__);
13332
13028
  /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
13333
13029
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "react");
13334
13030
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
13335
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
13336
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-label/victory-label.js");
13337
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-primitives/line-segment.js");
13338
- /* 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");
13339
13035
  /* harmony import */ var _cursor_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./cursor-helpers */ "../../victory-cursor-container/es/cursor-helpers.js");
13340
13036
 
13341
13037
 
13038
+ /* eslint-disable complexity */
13342
13039
 
13343
13040
 
13344
13041
 
13345
- function cursorContainerMixin(Base) {
13346
- // @ts-expect-error "TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'."
13347
- return class VictoryCursorContainer extends Base {
13348
- static displayName = "VictoryCursorContainer";
13349
- static defaultProps = {
13350
- ...victory_core__WEBPACK_IMPORTED_MODULE_3__.VictoryContainer.defaultProps,
13351
- cursorLabelComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_4__.VictoryLabel, null),
13352
- cursorLabelOffset: {
13353
- x: 5,
13354
- y: -10
13355
- },
13356
- cursorComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_5__.LineSegment, null)
13357
- };
13358
- static defaultEvents(props) {
13359
- return [{
13360
- target: "parent",
13361
- eventHandlers: {
13362
- onMouseLeave: (evt, targetProps) => {
13363
- return props.disable ? {} : _cursor_helpers__WEBPACK_IMPORTED_MODULE_6__.CursorHelpers.onMouseLeave(evt, targetProps);
13364
- },
13365
- onTouchCancel: () => {
13366
- return [];
13367
- },
13368
- onMouseMove: (evt, targetProps) => {
13369
- return props.disable ? {} : _cursor_helpers__WEBPACK_IMPORTED_MODULE_6__.CursorHelpers.onMouseMove(evt, targetProps);
13370
- },
13371
- onTouchMove: (evt, targetProps) => {
13372
- return props.disable ? {} : _cursor_helpers__WEBPACK_IMPORTED_MODULE_6__.CursorHelpers.onMouseMove(evt, targetProps);
13373
- }
13374
- }
13375
- }];
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;
13376
13067
  }
13377
- getCursorPosition(props) {
13378
- const {
13379
- cursorValue,
13380
- defaultCursorValue,
13381
- domain,
13382
- cursorDimension
13383
- } = props;
13384
- if (cursorValue) {
13385
- return cursorValue;
13386
- }
13387
- if (typeof defaultCursorValue === "number") {
13388
- return {
13389
- x: (domain.x[0] + domain.x[1]) / 2,
13390
- 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 ? {
13391
13073
  [cursorDimension]: defaultCursorValue
13392
- };
13393
- }
13394
- return defaultCursorValue;
13074
+ } : {})
13075
+ };
13395
13076
  }
13396
- getCursorLabelOffset(props) {
13397
- const {
13398
- cursorLabelOffset
13399
- } = props;
13400
- if (typeof cursorLabelOffset === "number") {
13401
- return {
13402
- x: cursorLabelOffset,
13403
- y: cursorLabelOffset
13404
- };
13405
- }
13406
- 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
+ };
13407
13088
  }
13408
- getPadding(props) {
13409
- if (props.padding === undefined) {
13410
- const child = props.children.find(c => {
13411
- return lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default()(c.props) && c.props.padding !== undefined;
13412
- });
13413
- return victory_core__WEBPACK_IMPORTED_MODULE_7__.getPadding(child.props);
13414
- }
13415
- 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);
13416
13097
  }
13417
- getCursorElements(props) {
13418
- // eslint-disable-line max-statements
13419
- const {
13420
- scale,
13421
- cursorLabelComponent,
13422
- cursorLabel,
13423
- cursorComponent,
13424
- width,
13425
- height,
13426
- name,
13427
- horizontal,
13428
- theme
13429
- } = props;
13430
- const cursorDimension = _cursor_helpers__WEBPACK_IMPORTED_MODULE_6__.CursorHelpers.getDimension(props);
13431
- const cursorValue = this.getCursorPosition(props);
13432
- const cursorLabelOffset = this.getCursorLabelOffset(props);
13433
- if (!cursorValue) {
13434
- return [];
13435
- }
13436
- const newElements = [];
13437
- const padding = this.getPadding(props);
13438
- const cursorCoordinates = {
13439
- x: horizontal ? scale.y(cursorValue.y) : scale.x(cursorValue.x),
13440
- y: horizontal ? scale.x(cursorValue.x) : scale.y(cursorValue.y)
13441
- };
13442
- if (cursorLabel) {
13443
- let labelProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({
13444
- active: true
13445
- }, cursorLabelComponent.props, {
13446
- x: cursorCoordinates.x + cursorLabelOffset.x,
13447
- y: cursorCoordinates.y + cursorLabelOffset.y,
13448
- datum: cursorValue,
13449
- active: true,
13450
- key: `${name}-cursor-label`
13451
- });
13452
- if (victory_core__WEBPACK_IMPORTED_MODULE_7__.isTooltip(cursorLabelComponent)) {
13453
- const tooltipTheme = theme && theme.tooltip || {};
13454
- labelProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelProps, tooltipTheme);
13455
- }
13456
- newElements.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().cloneElement(cursorLabelComponent, lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelProps, {
13457
- text: victory_core__WEBPACK_IMPORTED_MODULE_7__.evaluateProp(cursorLabel, labelProps)
13458
- })));
13459
- }
13460
- const cursorStyle = Object.assign({
13461
- stroke: "black"
13462
- }, cursorComponent.props.style);
13463
- if (cursorDimension === "x" || cursorDimension === undefined) {
13464
- newElements.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().cloneElement(cursorComponent, {
13465
- key: `${name}-x-cursor`,
13466
- x1: cursorCoordinates.x,
13467
- x2: cursorCoordinates.x,
13468
- y1: padding.top,
13469
- y2: height - padding.bottom,
13470
- style: cursorStyle
13471
- }));
13472
- }
13473
- if (cursorDimension === "y" || cursorDimension === undefined) {
13474
- newElements.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().cloneElement(cursorComponent, {
13475
- key: `${name}-y-cursor`,
13476
- x1: padding.left,
13477
- x2: width - padding.right,
13478
- y1: cursorCoordinates.y,
13479
- y2: cursorCoordinates.y,
13480
- style: cursorStyle
13481
- }));
13482
- }
13483
- 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 [];
13484
13118
  }
13485
-
13486
- // Overrides method in VictoryContainer
13487
- getChildren(props) {
13488
- 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
+ })));
13489
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;
13490
13170
  };
13491
- }
13492
- 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
+ };
13493
13204
 
13494
13205
  /***/ }),
13495
13206
 
@@ -13745,88 +13456,91 @@ const SelectionHelpers = new SelectionHelpersClass();
13745
13456
  "use strict";
13746
13457
  __webpack_require__.r(__webpack_exports__);
13747
13458
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13459
+ /* harmony export */ "VICTORY_SELECTION_CONTAINER_DEFAULT_PROPS": function() { return /* binding */ VICTORY_SELECTION_CONTAINER_DEFAULT_PROPS; },
13748
13460
  /* harmony export */ "VictorySelectionContainer": function() { return /* binding */ VictorySelectionContainer; },
13749
- /* harmony export */ "selectionContainerMixin": function() { return /* binding */ selectionContainerMixin; }
13461
+ /* harmony export */ "useVictorySelectionContainer": function() { return /* binding */ useVictorySelectionContainer; }
13750
13462
  /* harmony export */ });
13751
13463
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
13752
13464
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
13753
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
13754
- /* 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");
13755
13467
  /* harmony import */ var _selection_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selection-helpers */ "../../victory-selection-container/es/selection-helpers.js");
13756
13468
 
13757
13469
 
13758
13470
 
13759
- function selectionContainerMixin(Base) {
13760
- // @ts-expect-error "TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'."
13761
- return class VictorySelectionContainer extends Base {
13762
- static displayName = "VictorySelectionContainer";
13763
- static defaultProps = {
13764
- ...victory_core__WEBPACK_IMPORTED_MODULE_1__.VictoryContainer.defaultProps,
13765
- activateSelectedData: true,
13766
- allowSelection: true,
13767
- selectionComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_2__.Rect, null),
13768
- selectionStyle: {
13769
- stroke: "transparent",
13770
- fill: "black",
13771
- fillOpacity: 0.1
13772
- }
13773
- };
13774
- static defaultEvents(props) {
13775
- return [{
13776
- target: "parent",
13777
- eventHandlers: {
13778
- onMouseDown: (evt, targetProps) => {
13779
- return props.disable ? {} : _selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseDown(evt, targetProps);
13780
- },
13781
- onTouchStart: (evt, targetProps) => {
13782
- return props.disable ? {} : _selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseDown(evt, targetProps);
13783
- },
13784
- onMouseMove: (evt, targetProps) => {
13785
- return props.disable ? {} : _selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseMove(evt, targetProps);
13786
- },
13787
- onTouchMove: (evt, targetProps) => {
13788
- return props.disable ? {} : _selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseMove(evt, targetProps);
13789
- },
13790
- onMouseUp: (evt, targetProps) => {
13791
- return props.disable ? {} : _selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseUp(evt, targetProps);
13792
- },
13793
- onTouchEnd: (evt, targetProps) => {
13794
- return props.disable ? {} : _selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseUp(evt, targetProps);
13795
- }
13796
- }
13797
- }];
13798
- }
13799
- getRect(props) {
13800
- const {
13801
- x1,
13802
- x2,
13803
- y1,
13804
- y2,
13805
- selectionStyle,
13806
- selectionComponent,
13807
- name
13808
- } = props;
13809
- const width = Math.abs(x2 - x1) || 1;
13810
- const height = Math.abs(y2 - y1) || 1;
13811
- const x = Math.min(x1, x2);
13812
- const y = Math.min(y1, y2);
13813
- return y2 && x2 && x1 && y1 ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(selectionComponent, {
13814
- key: `${name}-selection`,
13815
- x,
13816
- y,
13817
- width,
13818
- height,
13819
- style: selectionStyle
13820
- }) : null;
13821
- }
13822
-
13823
- // Overrides method in VictoryContainer
13824
- getChildren(props) {
13825
- return [...react__WEBPACK_IMPORTED_MODULE_0___default().Children.toArray(props.children), this.getRect(props)];
13826
- }
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
13827
13485
  };
13828
- }
13829
- 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
+ };
13830
13544
 
13831
13545
  /***/ }),
13832
13546
 
@@ -14487,7 +14201,7 @@ class VictoryTooltip extends (react__WEBPACK_IMPORTED_MODULE_4___default().Compo
14487
14201
  renderInPortal
14488
14202
  } = props;
14489
14203
  if (!active) {
14490
- return renderInPortal ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_11__.VictoryPortal, null) : null;
14204
+ return null;
14491
14205
  }
14492
14206
  const evaluatedProps = this.getEvaluatedProps(props);
14493
14207
  const {
@@ -14558,32 +14272,6 @@ __webpack_require__.r(__webpack_exports__);
14558
14272
 
14559
14273
 
14560
14274
 
14561
- /***/ }),
14562
-
14563
- /***/ "../../victory-vendor/es/d3-timer.js":
14564
- /*!*******************************************!*\
14565
- !*** ../../victory-vendor/es/d3-timer.js ***!
14566
- \*******************************************/
14567
- /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
14568
-
14569
- "use strict";
14570
- __webpack_require__.r(__webpack_exports__);
14571
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
14572
- /* harmony export */ "interval": function() { return /* reexport safe */ d3_timer__WEBPACK_IMPORTED_MODULE_0__.interval; },
14573
- /* harmony export */ "now": function() { return /* reexport safe */ d3_timer__WEBPACK_IMPORTED_MODULE_0__.now; },
14574
- /* harmony export */ "timeout": function() { return /* reexport safe */ d3_timer__WEBPACK_IMPORTED_MODULE_0__.timeout; },
14575
- /* harmony export */ "timer": function() { return /* reexport safe */ d3_timer__WEBPACK_IMPORTED_MODULE_0__.timer; },
14576
- /* harmony export */ "timerFlush": function() { return /* reexport safe */ d3_timer__WEBPACK_IMPORTED_MODULE_0__.timerFlush; }
14577
- /* harmony export */ });
14578
- /* 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");
14579
-
14580
- // `victory-vendor/d3-timer` (ESM)
14581
- // See upstream license: https://github.com/d3/d3-timer/blob/main/LICENSE
14582
- //
14583
- // Our ESM package uses the underlying installed dependencies of `node_modules/d3-timer`
14584
-
14585
-
14586
-
14587
14275
  /***/ }),
14588
14276
 
14589
14277
  /***/ "../../victory-voronoi-container/es/victory-voronoi-container.js":
@@ -14595,8 +14283,9 @@ __webpack_require__.r(__webpack_exports__);
14595
14283
  "use strict";
14596
14284
  __webpack_require__.r(__webpack_exports__);
14597
14285
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
14286
+ /* harmony export */ "VICTORY_VORONOI_CONTAINER_DEFAULT_PROPS": function() { return /* binding */ VICTORY_VORONOI_CONTAINER_DEFAULT_PROPS; },
14598
14287
  /* harmony export */ "VictoryVoronoiContainer": function() { return /* binding */ VictoryVoronoiContainer; },
14599
- /* harmony export */ "voronoiContainerMixin": function() { return /* binding */ voronoiContainerMixin; }
14288
+ /* harmony export */ "useVictoryVoronoiContainer": function() { return /* binding */ useVictoryVoronoiContainer; }
14600
14289
  /* harmony export */ });
14601
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");
14602
14291
  /* harmony import */ var lodash_pick__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_pick__WEBPACK_IMPORTED_MODULE_0__);
@@ -14604,10 +14293,10 @@ __webpack_require__.r(__webpack_exports__);
14604
14293
  /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
14605
14294
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "react");
14606
14295
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
14607
- /* harmony import */ var victory_tooltip__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! victory-tooltip */ "../../victory-tooltip/es/victory-tooltip.js");
14608
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
14609
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/helpers.js");
14610
- /* 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");
14611
14300
 
14612
14301
 
14613
14302
  /* eslint-disable react/no-multi-comp */
@@ -14615,204 +14304,214 @@ __webpack_require__.r(__webpack_exports__);
14615
14304
 
14616
14305
 
14617
14306
 
14618
- function voronoiContainerMixin(Base) {
14619
- // @ts-expect-error "TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'."
14620
- return class VictoryVoronoiContainer extends Base {
14621
- static displayName = "VictoryVoronoiContainer";
14622
- static defaultProps = {
14623
- ...victory_core__WEBPACK_IMPORTED_MODULE_3__.VictoryContainer.defaultProps,
14624
- activateData: true,
14625
- activateLabels: true,
14626
- labelComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(victory_tooltip__WEBPACK_IMPORTED_MODULE_4__.VictoryTooltip, null),
14627
- voronoiPadding: 5
14628
- };
14629
- static defaultEvents(props) {
14630
- return [{
14631
- target: "parent",
14632
- eventHandlers: {
14633
- onMouseLeave: (evt, targetProps) => {
14634
- return props.disable ? {} : _voronoi_helpers__WEBPACK_IMPORTED_MODULE_5__.VoronoiHelpers.onMouseLeave(evt, targetProps);
14635
- },
14636
- onTouchCancel: (evt, targetProps) => {
14637
- return props.disable ? {} : _voronoi_helpers__WEBPACK_IMPORTED_MODULE_5__.VoronoiHelpers.onMouseLeave(evt, targetProps);
14638
- },
14639
- onMouseMove: (evt, targetProps) => {
14640
- return props.disable ? {} : _voronoi_helpers__WEBPACK_IMPORTED_MODULE_5__.VoronoiHelpers.onMouseMove(evt, targetProps);
14641
- },
14642
- onTouchMove: (evt, targetProps) => {
14643
- return props.disable ? {} : _voronoi_helpers__WEBPACK_IMPORTED_MODULE_5__.VoronoiHelpers.onMouseMove(evt, targetProps);
14644
- }
14645
- }
14646
- }, {
14647
- target: "data",
14648
- eventHandlers: props.disable ? {} : {
14649
- onMouseOver: () => null,
14650
- onMouseOut: () => null,
14651
- onMouseMove: () => null
14652
- }
14653
- }];
14654
- }
14655
- getDimension(props) {
14656
- const {
14657
- horizontal,
14658
- voronoiDimension
14659
- } = props;
14660
- if (!horizontal || !voronoiDimension) {
14661
- return voronoiDimension;
14662
- }
14663
- return voronoiDimension === "x" ? "y" : "x";
14664
- }
14665
- getPoint(point) {
14666
- const whitelist = ["_x", "_x1", "_x0", "_y", "_y1", "_y0"];
14667
- return lodash_pick__WEBPACK_IMPORTED_MODULE_0___default()(point, whitelist);
14668
- }
14669
- getLabelPosition(props, labelProps, points) {
14670
- const {
14671
- mousePosition,
14672
- mouseFollowTooltips
14673
- } = props;
14674
- const voronoiDimension = this.getDimension(props);
14675
- const point = this.getPoint(points[0]);
14676
- const basePosition = victory_core__WEBPACK_IMPORTED_MODULE_6__.scalePoint(props, point);
14677
- let center = mouseFollowTooltips ? mousePosition : undefined;
14678
- if (!voronoiDimension || points.length < 2) {
14679
- return {
14680
- ...basePosition,
14681
- center: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelProps.center, center)
14682
- };
14683
- }
14684
- const x = voronoiDimension === "y" ? mousePosition.x : basePosition.x;
14685
- const y = voronoiDimension === "x" ? mousePosition.y : basePosition.y;
14686
- center = mouseFollowTooltips ? mousePosition : {
14687
- x,
14688
- y
14689
- };
14690
- return {
14691
- x,
14692
- y,
14693
- center: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelProps.center, center)
14694
- };
14695
- }
14696
- getStyle(props, points, type) {
14697
- const {
14698
- labels,
14699
- labelComponent,
14700
- theme
14701
- } = props;
14702
- const componentProps = labelComponent.props || {};
14703
- const themeStyles = theme && theme.voronoi && theme.voronoi.style ? theme.voronoi.style : {};
14704
- const componentStyleArray = type === "flyout" ? componentProps.flyoutStyle : componentProps.style;
14705
- return points.reduce((memo, datum, index) => {
14706
- const labelProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, componentProps, {
14707
- datum,
14708
- active: true
14709
- });
14710
- const text = victory_core__WEBPACK_IMPORTED_MODULE_6__.isFunction(labels) ? labels(labelProps) : undefined;
14711
- const textArray = text !== undefined ? `${text}`.split("\n") : [];
14712
- const baseStyle = datum.style && datum.style[type] || {};
14713
- const componentStyle = Array.isArray(componentStyleArray) ? componentStyleArray[index] : componentStyleArray;
14714
- const style = victory_core__WEBPACK_IMPORTED_MODULE_6__.evaluateStyle(lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, componentStyle, baseStyle, themeStyles[type]), labelProps);
14715
- const styleArray = textArray.length ? textArray.map(() => style) : [style];
14716
- return memo.concat(styleArray);
14717
- }, []);
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;
14718
14332
  }
14719
- getDefaultLabelProps(props, points) {
14720
- const {
14721
- voronoiDimension,
14722
- horizontal,
14723
- mouseFollowTooltips
14724
- } = props;
14725
- const point = this.getPoint(points[0]);
14726
- const multiPoint = voronoiDimension && points.length > 1;
14727
- const y = point._y1 !== undefined ? point._y1 : point._y;
14728
- const defaultHorizontalOrientation = y < 0 ? "left" : "right";
14729
- const defaultOrientation = y < 0 ? "bottom" : "top";
14730
- const labelOrientation = horizontal ? defaultHorizontalOrientation : defaultOrientation;
14731
- 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) {
14732
14345
  return {
14733
- orientation,
14734
- pointerLength: multiPoint ? 0 : undefined,
14735
- constrainToVisibleArea: multiPoint || mouseFollowTooltips ? true : undefined
14346
+ ...basePosition,
14347
+ center: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelProps.center, center)
14736
14348
  };
14737
14349
  }
14738
- getLabelProps(props, points) {
14739
- const {
14740
- labels,
14741
- scale,
14742
- labelComponent,
14743
- theme,
14744
- width,
14745
- height
14746
- } = props;
14747
- const componentProps = labelComponent.props || {};
14748
- const text = points.reduce((memo, datum) => {
14749
- const labelProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, componentProps, {
14750
- datum,
14751
- active: true
14752
- });
14753
- const t = victory_core__WEBPACK_IMPORTED_MODULE_6__.isFunction(labels) ? labels(labelProps) : null;
14754
- if (t === null || t === undefined) {
14755
- return memo;
14756
- }
14757
- return memo.concat(`${t}`.split("\n"));
14758
- }, []);
14759
-
14760
- // remove properties from first point to make datum
14761
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
14762
- const {
14763
- childName,
14764
- eventKey,
14765
- style,
14766
- continuous,
14767
- ...datum
14768
- } = points[0];
14769
- const name = props.name === childName ? childName : `${props.name}-${childName}`;
14770
- const labelProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({
14771
- key: `${name}-${eventKey}-voronoi-tooltip`,
14772
- id: `${name}-${eventKey}-voronoi-tooltip`,
14773
- active: true,
14774
- renderInPortal: false,
14775
- 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, {
14776
14373
  datum,
14777
- scale,
14778
- theme
14779
- }, componentProps, {
14780
- text,
14781
- width,
14782
- height,
14783
- style: this.getStyle(props, points, "labels"),
14784
- flyoutStyle: this.getStyle(props, points, "flyout")[0]
14785
- }, this.getDefaultLabelProps(props, points));
14786
- const labelPosition = this.getLabelPosition(props, labelProps, points);
14787
- return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelPosition, labelProps);
14788
- }
14789
- getTooltip(props) {
14790
- const {
14791
- labels,
14792
- activePoints,
14793
- labelComponent
14794
- } = props;
14795
- if (!labels) {
14796
- return null;
14797
- }
14798
- if (Array.isArray(activePoints) && activePoints.length) {
14799
- const labelProps = this.getLabelProps(props, activePoints);
14800
- const {
14801
- text
14802
- } = labelProps;
14803
- const showLabel = Array.isArray(text) ? text.filter(Boolean).length : text;
14804
- 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;
14805
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) {
14806
14462
  return null;
14807
14463
  }
14808
-
14809
- // Overrides method in VictoryContainer
14810
- getChildren(props) {
14811
- 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;
14812
14471
  }
14472
+ return null;
14813
14473
  };
14814
- }
14815
- 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
+ };
14816
14515
 
14817
14516
  /***/ }),
14818
14517
 
@@ -15089,85 +14788,120 @@ const VoronoiHelpers = new VoronoiHelpersClass();
15089
14788
  "use strict";
15090
14789
  __webpack_require__.r(__webpack_exports__);
15091
14790
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
14791
+ /* harmony export */ "VICTORY_ZOOM_CONTAINER_DEFAULT_PROPS": function() { return /* binding */ VICTORY_ZOOM_CONTAINER_DEFAULT_PROPS; },
15092
14792
  /* harmony export */ "VictoryZoomContainer": function() { return /* binding */ VictoryZoomContainer; },
15093
- /* harmony export */ "zoomContainerMixin": function() { return /* binding */ zoomContainerMixin; }
14793
+ /* harmony export */ "useVictoryZoomContainer": function() { return /* binding */ useVictoryZoomContainer; }
15094
14794
  /* harmony export */ });
15095
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");
15096
14796
  /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_0__);
15097
14797
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
15098
14798
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
15099
14799
  /* harmony import */ var _zoom_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./zoom-helpers */ "../../victory-zoom-container/es/zoom-helpers.js");
15100
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
15101
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-clip-container/victory-clip-container.js");
15102
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/data.js");
15103
- /* 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");
15104
14803
 
15105
14804
 
15106
14805
 
15107
14806
 
15108
14807
  const DEFAULT_DOWNSAMPLE = 150;
15109
- function zoomContainerMixin(Base) {
15110
- // @ts-expect-error "TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'."
15111
- return class VictoryZoomContainer extends Base {
15112
- static displayName = "VictoryZoomContainer";
15113
- static defaultProps = {
15114
- ...victory_core__WEBPACK_IMPORTED_MODULE_2__.VictoryContainer.defaultProps,
15115
- clipContainerComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_3__.VictoryClipContainer, null),
15116
- allowPan: true,
15117
- allowZoom: true,
15118
- 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);
15119
14841
  };
15120
- static defaultEvents(props) {
15121
- return [{
15122
- target: "parent",
15123
- eventHandlers: {
15124
- onMouseDown: (evt, targetProps) => {
15125
- return props.disable ? {} : _zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseDown(evt, targetProps);
15126
- },
15127
- onTouchStart: (evt, targetProps) => {
15128
- return props.disable ? {} : _zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseDown(evt, targetProps);
15129
- },
15130
- onMouseUp: (evt, targetProps) => {
15131
- return props.disable ? {} : _zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseUp(evt, targetProps);
15132
- },
15133
- onTouchEnd: (evt, targetProps) => {
15134
- return props.disable ? {} : _zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseUp(evt, targetProps);
15135
- },
15136
- onMouseLeave: (evt, targetProps) => {
15137
- return props.disable ? {} : _zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseLeave(evt, targetProps);
15138
- },
15139
- onTouchCancel: (evt, targetProps) => {
15140
- return props.disable ? {} : _zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseLeave(evt, targetProps);
15141
- },
15142
- // eslint-disable-next-line max-params
15143
- onMouseMove: (evt, targetProps, eventKey, ctx) => {
15144
- if (props.disable) {
15145
- return {};
15146
- }
15147
- return _zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseMove(evt, targetProps, eventKey, ctx);
15148
- },
15149
- // eslint-disable-next-line max-params
15150
- onTouchMove: (evt, targetProps, eventKey, ctx) => {
15151
- if (props.disable) {
15152
- return {};
15153
- }
15154
- evt.preventDefault();
15155
- return _zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onMouseMove(evt, targetProps, eventKey, ctx);
15156
- },
15157
- ...(props.disable || !props.allowZoom ? {} : {
15158
- onWheel: _zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.onWheel
15159
- })
15160
- }
15161
- }];
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;
15162
14847
  }
15163
- clipDataComponents(children, props) {
15164
- const {
15165
- scale,
15166
- clipContainerComponent,
15167
- polar,
15168
- origin,
15169
- horizontal
15170
- } = 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)) {
15171
14905
  const rangeX = horizontal ? scale.y.range() : scale.x.range();
15172
14906
  const rangeY = horizontal ? scale.x.range() : scale.y.range();
15173
14907
  const plottableWidth = Math.abs(rangeX[0] - rangeX[1]);
@@ -15183,110 +14917,51 @@ function zoomContainerMixin(Base) {
15183
14917
  radius: polar ? radius : undefined,
15184
14918
  ...clipContainerComponent.props
15185
14919
  });
15186
- return react__WEBPACK_IMPORTED_MODULE_1___default().Children.toArray(children).map(child => {
15187
- if (!victory_core__WEBPACK_IMPORTED_MODULE_5__.isDataComponent(child)) {
15188
- return child;
15189
- }
15190
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(child, {
15191
- groupComponent
15192
- });
15193
- });
15194
- }
15195
- modifyPolarDomain(domain, originalDomain) {
15196
- // Only zoom the radius of polar charts. Zooming angles is very confusing
15197
- return {
15198
- x: originalDomain.x,
15199
- y: [0, domain.y[1]]
15200
- };
15201
- }
15202
- downsampleZoomData(props, child, domain) {
15203
- const {
15204
- downsample
15205
- } = props;
15206
- const getData = childProps => {
15207
- const {
15208
- data,
15209
- x,
15210
- y
15211
- } = childProps;
15212
- const defaultGetData = child.type && victory_core__WEBPACK_IMPORTED_MODULE_6__.isFunction(child.type.getData) ? child.type.getData : () => undefined;
15213
- // skip costly data formatting if x and y accessors are not present
15214
- return Array.isArray(data) && !x && !y ? data : defaultGetData(childProps);
15215
- };
15216
- const data = getData(child.props);
15217
-
15218
- // return undefined if downsample is not run, then default() will replace with child.props.data
15219
- if (!downsample || !domain || !data) {
15220
- return undefined;
15221
- }
15222
- const maxPoints = downsample === true ? DEFAULT_DOWNSAMPLE : downsample;
15223
- const dimension = props.zoomDimension || "x";
15224
-
15225
- // important: assumes data is ordered by dimension
15226
- // get the start and end of the data that is in the current visible domain
15227
- let startIndex = data.findIndex(d => d[dimension] >= domain[dimension][0]);
15228
- let endIndex = data.findIndex(d => d[dimension] > domain[dimension][1]);
15229
- // pick one more point (if available) at each end so that VictoryLine, VictoryArea connect
15230
- if (startIndex !== 0) {
15231
- startIndex -= 1;
15232
- }
15233
- if (endIndex !== -1) {
15234
- endIndex += 1;
15235
- }
15236
- const visibleData = data.slice(startIndex, endIndex);
15237
- return victory_core__WEBPACK_IMPORTED_MODULE_5__.downsample(visibleData, maxPoints, startIndex);
15238
- }
15239
- modifyChildren(props) {
15240
- const childComponents = react__WEBPACK_IMPORTED_MODULE_1___default().Children.toArray(props.children);
15241
- return childComponents.map(child => {
15242
- const role = child.type && child.type.role;
15243
- const isDataComponent = victory_core__WEBPACK_IMPORTED_MODULE_5__.isDataComponent(child);
15244
- const {
15245
- currentDomain,
15246
- zoomActive,
15247
- allowZoom
15248
- } = props;
15249
- const originalDomain = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, props.originalDomain, props.domain);
15250
- const zoomDomain = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, props.zoomDomain, props.domain);
15251
- const cachedZoomDomain = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, props.cachedZoomDomain, props.domain);
15252
- let domain;
15253
- if (!_zoom_helpers__WEBPACK_IMPORTED_MODULE_4__.ZoomHelpers.checkDomainEquality(zoomDomain, cachedZoomDomain)) {
15254
- // if zoomDomain has been changed, use it
15255
- domain = zoomDomain;
15256
- } else if (allowZoom && !zoomActive) {
15257
- // if user has zoomed all the way out, use the child domain
15258
- domain = child.props.domain;
15259
- } else {
15260
- // default: use currentDomain, set by the event handlers
15261
- domain = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, currentDomain, originalDomain);
15262
- }
15263
- let newDomain = props.polar ? this.modifyPolarDomain(domain, originalDomain) : domain;
15264
- if (newDomain && props.zoomDimension) {
15265
- // if zooming is restricted to a dimension, don't squash changes to zoomDomain in other dim
15266
- newDomain = {
15267
- ...zoomDomain,
15268
- [props.zoomDimension]: newDomain[props.zoomDimension]
15269
- };
15270
- }
15271
- // don't downsample stacked data
15272
- const newProps = isDataComponent && role !== "stack" ? {
15273
- domain: newDomain,
15274
- data: this.downsampleZoomData(props, child, newDomain)
15275
- } : {
15276
- domain: newDomain
15277
- };
15278
- 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
15279
14922
  });
15280
14923
  }
15281
-
15282
- // Overrides method in VictoryContainer
15283
- getChildren(props) {
15284
- const children = this.modifyChildren(props);
15285
- return this.clipDataComponents(children, props);
15286
- }
14924
+ return newChild;
14925
+ });
14926
+ return {
14927
+ props,
14928
+ children: modifiedChildren
15287
14929
  };
15288
- }
15289
- 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
+ };
15290
14965
 
15291
14966
  /***/ }),
15292
14967
 
@@ -20991,221 +20666,6 @@ year.every = function(k) {
20991
20666
  var years = year.range;
20992
20667
 
20993
20668
 
20994
- /***/ }),
20995
-
20996
- /***/ "../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/index.js":
20997
- /*!*************************************************************************************!*\
20998
- !*** ../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/index.js ***!
20999
- \*************************************************************************************/
21000
- /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
21001
-
21002
- "use strict";
21003
- __webpack_require__.r(__webpack_exports__);
21004
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
21005
- /* harmony export */ "interval": function() { return /* reexport safe */ _interval_js__WEBPACK_IMPORTED_MODULE_2__["default"]; },
21006
- /* harmony export */ "now": function() { return /* reexport safe */ _timer_js__WEBPACK_IMPORTED_MODULE_0__.now; },
21007
- /* harmony export */ "timeout": function() { return /* reexport safe */ _timeout_js__WEBPACK_IMPORTED_MODULE_1__["default"]; },
21008
- /* harmony export */ "timer": function() { return /* reexport safe */ _timer_js__WEBPACK_IMPORTED_MODULE_0__.timer; },
21009
- /* harmony export */ "timerFlush": function() { return /* reexport safe */ _timer_js__WEBPACK_IMPORTED_MODULE_0__.timerFlush; }
21010
- /* harmony export */ });
21011
- /* 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");
21012
- /* 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");
21013
- /* 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");
21014
-
21015
-
21016
-
21017
-
21018
-
21019
-
21020
-
21021
- /***/ }),
21022
-
21023
- /***/ "../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/interval.js":
21024
- /*!****************************************************************************************!*\
21025
- !*** ../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/interval.js ***!
21026
- \****************************************************************************************/
21027
- /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
21028
-
21029
- "use strict";
21030
- __webpack_require__.r(__webpack_exports__);
21031
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
21032
- /* harmony export */ "default": function() { return /* export default binding */ __WEBPACK_DEFAULT_EXPORT__; }
21033
- /* harmony export */ });
21034
- /* 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");
21035
-
21036
-
21037
- /* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(callback, delay, time) {
21038
- var t = new _timer_js__WEBPACK_IMPORTED_MODULE_0__.Timer, total = delay;
21039
- if (delay == null) return t.restart(callback, delay, time), t;
21040
- t._restart = t.restart;
21041
- t.restart = function(callback, delay, time) {
21042
- delay = +delay, time = time == null ? (0,_timer_js__WEBPACK_IMPORTED_MODULE_0__.now)() : +time;
21043
- t._restart(function tick(elapsed) {
21044
- elapsed += total;
21045
- t._restart(tick, total += delay, time);
21046
- callback(elapsed);
21047
- }, delay, time);
21048
- }
21049
- t.restart(callback, delay, time);
21050
- return t;
21051
- }
21052
-
21053
-
21054
- /***/ }),
21055
-
21056
- /***/ "../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timeout.js":
21057
- /*!***************************************************************************************!*\
21058
- !*** ../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timeout.js ***!
21059
- \***************************************************************************************/
21060
- /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
21061
-
21062
- "use strict";
21063
- __webpack_require__.r(__webpack_exports__);
21064
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
21065
- /* harmony export */ "default": function() { return /* export default binding */ __WEBPACK_DEFAULT_EXPORT__; }
21066
- /* harmony export */ });
21067
- /* 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");
21068
-
21069
-
21070
- /* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(callback, delay, time) {
21071
- var t = new _timer_js__WEBPACK_IMPORTED_MODULE_0__.Timer;
21072
- delay = delay == null ? 0 : +delay;
21073
- t.restart(elapsed => {
21074
- t.stop();
21075
- callback(elapsed + delay);
21076
- }, delay, time);
21077
- return t;
21078
- }
21079
-
21080
-
21081
- /***/ }),
21082
-
21083
- /***/ "../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js":
21084
- /*!*************************************************************************************!*\
21085
- !*** ../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js ***!
21086
- \*************************************************************************************/
21087
- /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
21088
-
21089
- "use strict";
21090
- __webpack_require__.r(__webpack_exports__);
21091
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
21092
- /* harmony export */ "Timer": function() { return /* binding */ Timer; },
21093
- /* harmony export */ "now": function() { return /* binding */ now; },
21094
- /* harmony export */ "timer": function() { return /* binding */ timer; },
21095
- /* harmony export */ "timerFlush": function() { return /* binding */ timerFlush; }
21096
- /* harmony export */ });
21097
- var frame = 0, // is an animation frame pending?
21098
- timeout = 0, // is a timeout pending?
21099
- interval = 0, // are any timers active?
21100
- pokeDelay = 1000, // how frequently we check for clock skew
21101
- taskHead,
21102
- taskTail,
21103
- clockLast = 0,
21104
- clockNow = 0,
21105
- clockSkew = 0,
21106
- clock = typeof performance === "object" && performance.now ? performance : Date,
21107
- setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };
21108
-
21109
- function now() {
21110
- return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
21111
- }
21112
-
21113
- function clearNow() {
21114
- clockNow = 0;
21115
- }
21116
-
21117
- function Timer() {
21118
- this._call =
21119
- this._time =
21120
- this._next = null;
21121
- }
21122
-
21123
- Timer.prototype = timer.prototype = {
21124
- constructor: Timer,
21125
- restart: function(callback, delay, time) {
21126
- if (typeof callback !== "function") throw new TypeError("callback is not a function");
21127
- time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
21128
- if (!this._next && taskTail !== this) {
21129
- if (taskTail) taskTail._next = this;
21130
- else taskHead = this;
21131
- taskTail = this;
21132
- }
21133
- this._call = callback;
21134
- this._time = time;
21135
- sleep();
21136
- },
21137
- stop: function() {
21138
- if (this._call) {
21139
- this._call = null;
21140
- this._time = Infinity;
21141
- sleep();
21142
- }
21143
- }
21144
- };
21145
-
21146
- function timer(callback, delay, time) {
21147
- var t = new Timer;
21148
- t.restart(callback, delay, time);
21149
- return t;
21150
- }
21151
-
21152
- function timerFlush() {
21153
- now(); // Get the current time, if not already set.
21154
- ++frame; // Pretend we’ve set an alarm, if we haven’t already.
21155
- var t = taskHead, e;
21156
- while (t) {
21157
- if ((e = clockNow - t._time) >= 0) t._call.call(undefined, e);
21158
- t = t._next;
21159
- }
21160
- --frame;
21161
- }
21162
-
21163
- function wake() {
21164
- clockNow = (clockLast = clock.now()) + clockSkew;
21165
- frame = timeout = 0;
21166
- try {
21167
- timerFlush();
21168
- } finally {
21169
- frame = 0;
21170
- nap();
21171
- clockNow = 0;
21172
- }
21173
- }
21174
-
21175
- function poke() {
21176
- var now = clock.now(), delay = now - clockLast;
21177
- if (delay > pokeDelay) clockSkew -= delay, clockLast = now;
21178
- }
21179
-
21180
- function nap() {
21181
- var t0, t1 = taskHead, t2, time = Infinity;
21182
- while (t1) {
21183
- if (t1._call) {
21184
- if (time > t1._time) time = t1._time;
21185
- t0 = t1, t1 = t1._next;
21186
- } else {
21187
- t2 = t1._next, t1._next = null;
21188
- t1 = t0 ? t0._next = t2 : taskHead = t2;
21189
- }
21190
- }
21191
- taskTail = t0;
21192
- sleep(time);
21193
- }
21194
-
21195
- function sleep(time) {
21196
- if (frame) return; // Soonest alarm already set, or will be.
21197
- if (timeout) timeout = clearTimeout(timeout);
21198
- var delay = time - clockNow; // Strictly less than if we recomputed clockNow.
21199
- if (delay > 24) {
21200
- if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);
21201
- if (interval) interval = clearInterval(interval);
21202
- } else {
21203
- if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
21204
- frame = 1, setFrame(wake);
21205
- }
21206
- }
21207
-
21208
-
21209
20669
  /***/ }),
21210
20670
 
21211
20671
  /***/ "../../../node_modules/.pnpm/internmap@2.0.3/node_modules/internmap/src/index.js":
@@ -21386,11 +20846,10 @@ var __webpack_exports__ = {};
21386
20846
  \******************/
21387
20847
  __webpack_require__.r(__webpack_exports__);
21388
20848
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
21389
- /* harmony export */ "combineContainerMixins": function() { return /* reexport safe */ _create_container__WEBPACK_IMPORTED_MODULE_0__.combineContainerMixins; },
21390
20849
  /* harmony export */ "createContainer": function() { return /* reexport safe */ _create_container__WEBPACK_IMPORTED_MODULE_0__.createContainer; },
21391
20850
  /* harmony export */ "makeCreateContainerFunction": function() { return /* reexport safe */ _create_container__WEBPACK_IMPORTED_MODULE_0__.makeCreateContainerFunction; }
21392
20851
  /* harmony export */ });
21393
- /* 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");
21394
20853
 
21395
20854
  }();
21396
20855
  /******/ return __webpack_exports__;