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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -139,8 +139,9 @@ const CursorHelpers = new CursorHelpersClass();
139
139
  "use strict";
140
140
  __webpack_require__.r(__webpack_exports__);
141
141
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
142
+ /* harmony export */ "VICTORY_CURSOR_CONTAINER_DEFAULT_PROPS": function() { return /* binding */ VICTORY_CURSOR_CONTAINER_DEFAULT_PROPS; },
142
143
  /* harmony export */ "VictoryCursorContainer": function() { return /* binding */ VictoryCursorContainer; },
143
- /* harmony export */ "cursorContainerMixin": function() { return /* binding */ cursorContainerMixin; }
144
+ /* harmony export */ "useVictoryCursorContainer": function() { return /* binding */ useVictoryCursorContainer; }
144
145
  /* harmony export */ });
145
146
  /* 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");
146
147
  /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_isObject__WEBPACK_IMPORTED_MODULE_0__);
@@ -148,164 +149,179 @@ __webpack_require__.r(__webpack_exports__);
148
149
  /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
149
150
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "react");
150
151
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
151
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
152
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-label/victory-label.js");
153
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-primitives/line-segment.js");
154
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/helpers.js");
152
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-label/victory-label.js");
153
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-primitives/line-segment.js");
154
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/helpers.js");
155
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
155
156
  /* harmony import */ var _cursor_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./cursor-helpers */ "./cursor-helpers.tsx");
156
157
 
157
158
 
159
+ /* eslint-disable complexity */
158
160
 
159
161
 
160
162
 
161
- function cursorContainerMixin(Base) {
162
- // @ts-expect-error "TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'."
163
- return class VictoryCursorContainer extends Base {
164
- static displayName = "VictoryCursorContainer";
165
- static defaultProps = {
166
- ...victory_core__WEBPACK_IMPORTED_MODULE_3__.VictoryContainer.defaultProps,
167
- cursorLabelComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_4__.VictoryLabel, null),
168
- cursorLabelOffset: {
169
- x: 5,
170
- y: -10
171
- },
172
- cursorComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_5__.LineSegment, null)
173
- };
174
- static defaultEvents(props) {
175
- return [{
176
- target: "parent",
177
- eventHandlers: {
178
- onMouseLeave: (evt, targetProps) => {
179
- return props.disable ? {} : _cursor_helpers__WEBPACK_IMPORTED_MODULE_6__.CursorHelpers.onMouseLeave(evt, targetProps);
180
- },
181
- onTouchCancel: () => {
182
- return [];
183
- },
184
- onMouseMove: (evt, targetProps) => {
185
- return props.disable ? {} : _cursor_helpers__WEBPACK_IMPORTED_MODULE_6__.CursorHelpers.onMouseMove(evt, targetProps);
186
- },
187
- onTouchMove: (evt, targetProps) => {
188
- return props.disable ? {} : _cursor_helpers__WEBPACK_IMPORTED_MODULE_6__.CursorHelpers.onMouseMove(evt, targetProps);
189
- }
190
- }
191
- }];
163
+ const VICTORY_CURSOR_CONTAINER_DEFAULT_PROPS = {
164
+ cursorLabelComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_3__.VictoryLabel, null),
165
+ cursorLabelOffset: {
166
+ x: 5,
167
+ y: -10
168
+ },
169
+ cursorComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_4__.LineSegment, null)
170
+ };
171
+ const useVictoryCursorContainer = initialProps => {
172
+ const props = {
173
+ ...VICTORY_CURSOR_CONTAINER_DEFAULT_PROPS,
174
+ ...initialProps
175
+ };
176
+ const {
177
+ children
178
+ } = props;
179
+ const getCursorPosition = () => {
180
+ const {
181
+ cursorValue,
182
+ defaultCursorValue,
183
+ domain,
184
+ cursorDimension
185
+ } = props;
186
+ if (cursorValue) {
187
+ return cursorValue;
192
188
  }
193
- getCursorPosition(props) {
194
- const {
195
- cursorValue,
196
- defaultCursorValue,
197
- domain,
198
- cursorDimension
199
- } = props;
200
- if (cursorValue) {
201
- return cursorValue;
202
- }
203
- if (typeof defaultCursorValue === "number") {
204
- return {
205
- x: (domain.x[0] + domain.x[1]) / 2,
206
- y: (domain.y[0] + domain.y[1]) / 2,
189
+ if (typeof defaultCursorValue === "number") {
190
+ return {
191
+ x: (domain.x[0] + domain.x[1]) / 2,
192
+ y: (domain.y[0] + domain.y[1]) / 2,
193
+ ...(cursorDimension ? {
207
194
  [cursorDimension]: defaultCursorValue
208
- };
209
- }
210
- return defaultCursorValue;
195
+ } : {})
196
+ };
211
197
  }
212
- getCursorLabelOffset(props) {
213
- const {
214
- cursorLabelOffset
215
- } = props;
216
- if (typeof cursorLabelOffset === "number") {
217
- return {
218
- x: cursorLabelOffset,
219
- y: cursorLabelOffset
220
- };
221
- }
222
- return cursorLabelOffset;
198
+ return defaultCursorValue;
199
+ };
200
+ const getCursorLabelOffset = () => {
201
+ const {
202
+ cursorLabelOffset
203
+ } = props;
204
+ if (typeof cursorLabelOffset === "number") {
205
+ return {
206
+ x: cursorLabelOffset,
207
+ y: cursorLabelOffset
208
+ };
223
209
  }
224
- getPadding(props) {
225
- if (props.padding === undefined) {
226
- const child = props.children.find(c => {
227
- return lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default()(c.props) && c.props.padding !== undefined;
228
- });
229
- return victory_core__WEBPACK_IMPORTED_MODULE_7__.getPadding(child.props);
230
- }
231
- return victory_core__WEBPACK_IMPORTED_MODULE_7__.getPadding(props);
210
+ return cursorLabelOffset;
211
+ };
212
+ const getPadding = () => {
213
+ if (props.padding === undefined) {
214
+ const child = Array.isArray(props.children) ? props.children.find(c => {
215
+ return lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default()(c.props) && c.props.padding !== undefined;
216
+ }) : props.children;
217
+ return victory_core__WEBPACK_IMPORTED_MODULE_5__.getPadding(child?.props);
232
218
  }
233
- getCursorElements(props) {
234
- // eslint-disable-line max-statements
235
- const {
236
- scale,
237
- cursorLabelComponent,
238
- cursorLabel,
239
- cursorComponent,
240
- width,
241
- height,
242
- name,
243
- horizontal,
244
- theme
245
- } = props;
246
- const cursorDimension = _cursor_helpers__WEBPACK_IMPORTED_MODULE_6__.CursorHelpers.getDimension(props);
247
- const cursorValue = this.getCursorPosition(props);
248
- const cursorLabelOffset = this.getCursorLabelOffset(props);
249
- if (!cursorValue) {
250
- return [];
251
- }
252
- const newElements = [];
253
- const padding = this.getPadding(props);
254
- const cursorCoordinates = {
255
- x: horizontal ? scale.y(cursorValue.y) : scale.x(cursorValue.x),
256
- y: horizontal ? scale.x(cursorValue.x) : scale.y(cursorValue.y)
257
- };
258
- if (cursorLabel) {
259
- let labelProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({
260
- active: true
261
- }, cursorLabelComponent.props, {
262
- x: cursorCoordinates.x + cursorLabelOffset.x,
263
- y: cursorCoordinates.y + cursorLabelOffset.y,
264
- datum: cursorValue,
265
- active: true,
266
- key: `${name}-cursor-label`
267
- });
268
- if (victory_core__WEBPACK_IMPORTED_MODULE_7__.isTooltip(cursorLabelComponent)) {
269
- const tooltipTheme = theme && theme.tooltip || {};
270
- labelProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelProps, tooltipTheme);
271
- }
272
- newElements.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().cloneElement(cursorLabelComponent, lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelProps, {
273
- text: victory_core__WEBPACK_IMPORTED_MODULE_7__.evaluateProp(cursorLabel, labelProps)
274
- })));
275
- }
276
- const cursorStyle = Object.assign({
277
- stroke: "black"
278
- }, cursorComponent.props.style);
279
- if (cursorDimension === "x" || cursorDimension === undefined) {
280
- newElements.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().cloneElement(cursorComponent, {
281
- key: `${name}-x-cursor`,
282
- x1: cursorCoordinates.x,
283
- x2: cursorCoordinates.x,
284
- y1: padding.top,
285
- y2: height - padding.bottom,
286
- style: cursorStyle
287
- }));
288
- }
289
- if (cursorDimension === "y" || cursorDimension === undefined) {
290
- newElements.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().cloneElement(cursorComponent, {
291
- key: `${name}-y-cursor`,
292
- x1: padding.left,
293
- x2: width - padding.right,
294
- y1: cursorCoordinates.y,
295
- y2: cursorCoordinates.y,
296
- style: cursorStyle
297
- }));
219
+ return victory_core__WEBPACK_IMPORTED_MODULE_5__.getPadding(props);
220
+ };
221
+ const getCursorElements = () => {
222
+ // eslint-disable-line max-statements
223
+ const {
224
+ scale,
225
+ cursorLabelComponent,
226
+ cursorLabel,
227
+ cursorComponent,
228
+ width,
229
+ height,
230
+ name,
231
+ horizontal,
232
+ theme
233
+ } = props;
234
+ const cursorDimension = _cursor_helpers__WEBPACK_IMPORTED_MODULE_6__.CursorHelpers.getDimension(props);
235
+ const cursorValue = getCursorPosition();
236
+ const cursorLabelOffset = getCursorLabelOffset();
237
+ if (!cursorValue) {
238
+ return [];
239
+ }
240
+ const newElements = [];
241
+ const padding = getPadding();
242
+ const cursorCoordinates = scale && "x" in scale && "y" in scale && typeof scale.y === "function" && typeof scale.x === "function" ? {
243
+ x: horizontal ? scale.y(cursorValue.y) : scale.x(cursorValue.x),
244
+ y: horizontal ? scale.x(cursorValue.x) : scale.y(cursorValue.y)
245
+ } : {
246
+ x: cursorValue.x,
247
+ y: cursorValue.y
248
+ };
249
+ if (cursorLabel) {
250
+ let labelProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({
251
+ active: true
252
+ }, cursorLabelComponent.props, {
253
+ x: cursorCoordinates.x + cursorLabelOffset.x,
254
+ y: cursorCoordinates.y + cursorLabelOffset.y,
255
+ datum: cursorValue,
256
+ active: true,
257
+ key: `${name}-cursor-label`
258
+ });
259
+ if (victory_core__WEBPACK_IMPORTED_MODULE_5__.isTooltip(cursorLabelComponent)) {
260
+ const tooltipTheme = theme && theme.tooltip || {};
261
+ labelProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelProps, tooltipTheme);
298
262
  }
299
- return newElements;
263
+ newElements.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().cloneElement(cursorLabelComponent, lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labelProps, {
264
+ text: victory_core__WEBPACK_IMPORTED_MODULE_5__.evaluateProp(cursorLabel, labelProps)
265
+ })));
300
266
  }
301
-
302
- // Overrides method in VictoryContainer
303
- getChildren(props) {
304
- return [...react__WEBPACK_IMPORTED_MODULE_2___default().Children.toArray(props.children), ...this.getCursorElements(props)];
267
+ const cursorStyle = Object.assign({
268
+ stroke: "black"
269
+ }, cursorComponent.props.style);
270
+ if (cursorDimension === "x" || cursorDimension === undefined) {
271
+ newElements.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().cloneElement(cursorComponent, {
272
+ key: `${name}-x-cursor`,
273
+ x1: cursorCoordinates.x,
274
+ x2: cursorCoordinates.x,
275
+ y1: padding.top,
276
+ y2: (typeof height === "number" ? height : 0) - padding.bottom,
277
+ style: cursorStyle
278
+ }));
279
+ }
280
+ if (cursorDimension === "y" || cursorDimension === undefined) {
281
+ newElements.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().cloneElement(cursorComponent, {
282
+ key: `${name}-y-cursor`,
283
+ x1: padding.left,
284
+ x2: (typeof width === "number" ? width : 0) - padding.right,
285
+ y1: cursorCoordinates.y,
286
+ y2: cursorCoordinates.y,
287
+ style: cursorStyle
288
+ }));
305
289
  }
290
+ return newElements;
306
291
  };
307
- }
308
- const VictoryCursorContainer = cursorContainerMixin(victory_core__WEBPACK_IMPORTED_MODULE_3__.VictoryContainer);
292
+ return {
293
+ props,
294
+ children: [...react__WEBPACK_IMPORTED_MODULE_2___default().Children.toArray(children), ...getCursorElements()]
295
+ };
296
+ };
297
+ const VictoryCursorContainer = initialProps => {
298
+ const {
299
+ props,
300
+ children
301
+ } = useVictoryCursorContainer(initialProps);
302
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_7__.VictoryContainer, props, children);
303
+ };
304
+ VictoryCursorContainer.role = "container";
305
+ VictoryCursorContainer.defaultEvents = initialProps => {
306
+ const props = {
307
+ ...VICTORY_CURSOR_CONTAINER_DEFAULT_PROPS,
308
+ ...initialProps
309
+ };
310
+ const createEventHandler = (handler, disabled) =>
311
+ // eslint-disable-next-line max-params
312
+ (event, targetProps, eventKey, context) => disabled || props.disable ? {} : handler(event, {
313
+ ...props,
314
+ ...targetProps
315
+ }, eventKey, context);
316
+ return [{
317
+ target: "parent",
318
+ eventHandlers: {
319
+ onMouseLeave: createEventHandler(_cursor_helpers__WEBPACK_IMPORTED_MODULE_6__.CursorHelpers.onMouseLeave),
320
+ onMouseMove: createEventHandler(_cursor_helpers__WEBPACK_IMPORTED_MODULE_6__.CursorHelpers.onMouseMove),
321
+ onTouchMove: createEventHandler(_cursor_helpers__WEBPACK_IMPORTED_MODULE_6__.CursorHelpers.onMouseMove)
322
+ }
323
+ }];
324
+ };
309
325
 
310
326
  /***/ }),
311
327
 
@@ -2963,23 +2979,18 @@ module.exports = uniqueId;
2963
2979
  "use strict";
2964
2980
  __webpack_require__.r(__webpack_exports__);
2965
2981
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2966
- /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; }
2982
+ /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
2983
+ /* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
2967
2984
  /* harmony export */ });
2968
- /* 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");
2969
- /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_isObject__WEBPACK_IMPORTED_MODULE_0__);
2970
- /* 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");
2971
- /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1__);
2972
- /* 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");
2973
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_2__);
2974
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "react");
2975
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
2976
- /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
2977
- /* 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");
2978
- /* 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");
2979
- /* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
2980
- /* 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");
2981
-
2982
-
2985
+ /* 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");
2986
+ /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
2987
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
2988
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
2989
+ /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
2990
+ /* harmony import */ var _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../victory-util/user-props */ "../../victory-core/es/victory-util/user-props.js");
2991
+ /* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
2992
+ /* harmony import */ var _victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-portal/portal-outlet */ "../../victory-core/es/victory-portal/portal-outlet.js");
2993
+ /* 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");
2983
2994
 
2984
2995
  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); }
2985
2996
 
@@ -2988,175 +2999,149 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
2988
2999
 
2989
3000
 
2990
3001
 
2991
- class VictoryContainer extends (react__WEBPACK_IMPORTED_MODULE_3___default().Component) {
2992
- static displayName = "VictoryContainer";
2993
- static role = "container";
2994
- static defaultProps = {
2995
- className: "VictoryContainer",
2996
- portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__.Portal, null),
2997
- portalZIndex: 99,
2998
- responsive: true,
2999
- role: "img"
3002
+ const defaultProps = {
3003
+ className: "VictoryContainer",
3004
+ portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__.Portal, null),
3005
+ portalZIndex: 99,
3006
+ responsive: true,
3007
+ role: "img"
3008
+ };
3009
+ function useVictoryContainer(initialProps) {
3010
+ const props = {
3011
+ ...defaultProps,
3012
+ ...initialProps
3000
3013
  };
3001
- static contextType = _victory_util_timer_context__WEBPACK_IMPORTED_MODULE_5__["default"];
3002
-
3003
- // @ts-expect-error Ref will be initialized on mount
3004
-
3005
- // @ts-expect-error Ref will be initialized on mount
3006
-
3007
- constructor(props) {
3008
- super(props);
3009
- this.containerId = !lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default()(props) || props.containerId === undefined ? lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default()("victory-container-") : props.containerId;
3010
- this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
3011
- }
3012
- savePortalRef = portal => {
3013
- this.portalRef = portal;
3014
- return portal;
3014
+ const {
3015
+ title,
3016
+ desc,
3017
+ width,
3018
+ height,
3019
+ responsive
3020
+ } = props;
3021
+ const localContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
3022
+
3023
+ // Generated ID stored in ref because it needs to persist across renders
3024
+ const generatedId = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()("victory-container-"));
3025
+ const containerId = props.containerId ?? generatedId.current;
3026
+ const getIdForElement = elName => `${containerId}-${elName}`;
3027
+ const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
3028
+ const dimensions = responsive ? {
3029
+ width: "100%",
3030
+ height: "100%"
3031
+ } : {
3032
+ width,
3033
+ height
3015
3034
  };
3016
- portalUpdate = (key, el) => this.portalRef.portalUpdate(key, el);
3017
- portalRegister = () => this.portalRef.portalRegister();
3018
- portalDeregister = key => this.portalRef.portalDeregister(key);
3019
- saveContainerRef = container => {
3020
- if (_victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(this.props.containerRef)) {
3021
- this.props.containerRef(container);
3022
- }
3023
- this.containerRef = container;
3024
- return container;
3035
+ const viewBox = responsive ? `0 0 ${width} ${height}` : undefined;
3036
+ const preserveAspectRatio = responsive ? props.preserveAspectRatio : undefined;
3037
+ const ariaLabelledBy = [title && getIdForElement("title"), props["aria-labelledby"]].filter(Boolean).join(" ") || undefined;
3038
+ const ariaDescribedBy = [desc && getIdForElement("desc"), props["aria-describedby"]].filter(Boolean).join(" ") || undefined;
3039
+ const titleId = getIdForElement("title");
3040
+ const descId = getIdForElement("desc");
3041
+ return {
3042
+ ...props,
3043
+ titleId,
3044
+ descId,
3045
+ dimensions,
3046
+ viewBox,
3047
+ preserveAspectRatio,
3048
+ ariaLabelledBy,
3049
+ ariaDescribedBy,
3050
+ userProps,
3051
+ localContainerRef
3025
3052
  };
3026
- handleWheel = e => e.preventDefault();
3027
- componentDidMount() {
3028
- if (this.shouldHandleWheel && this.containerRef) {
3029
- this.containerRef.addEventListener("wheel", this.handleWheel);
3030
- }
3031
- }
3032
- componentWillUnmount() {
3033
- if (this.shouldHandleWheel && this.containerRef) {
3034
- this.containerRef.removeEventListener("wheel", this.handleWheel);
3035
- }
3036
- }
3037
- getIdForElement(elementName) {
3038
- return `${this.containerId}-${elementName}`;
3039
- }
3040
-
3041
- // overridden in custom containers
3042
- getChildren(props) {
3043
- return props.children;
3044
- }
3045
-
3046
- // Get props defined by the Open UI Automation (OUIA) 1.0-RC spec
3047
- // See https://ouia.readthedocs.io/en/latest/README.html#ouia-component
3048
- getOUIAProps(props) {
3049
- const {
3050
- ouiaId,
3051
- ouiaSafe,
3052
- ouiaType
3053
- } = props;
3054
- return {
3055
- ...(ouiaId && {
3056
- "data-ouia-component-id": ouiaId
3057
- }),
3058
- ...(ouiaType && {
3059
- "data-ouia-component-type": ouiaType
3060
- }),
3061
- ...(ouiaSafe !== undefined && {
3062
- "data-ouia-safe": ouiaSafe
3063
- })
3064
- };
3065
- }
3066
- renderContainer(props, svgProps, style) {
3067
- const {
3068
- title,
3069
- desc,
3070
- portalComponent,
3071
- className,
3072
- width,
3073
- height,
3074
- portalZIndex,
3075
- responsive
3076
- } = props;
3077
- const children = this.getChildren(props);
3078
- const dimensions = responsive ? {
3079
- width: "100%",
3080
- height: "100%"
3081
- } : {
3082
- width,
3083
- height
3053
+ }
3054
+ const VictoryContainer = initialProps => {
3055
+ const {
3056
+ role,
3057
+ title,
3058
+ desc,
3059
+ children,
3060
+ className,
3061
+ portalZIndex,
3062
+ portalComponent,
3063
+ width,
3064
+ height,
3065
+ style,
3066
+ tabIndex,
3067
+ responsive,
3068
+ events,
3069
+ ouiaId,
3070
+ ouiaSafe,
3071
+ ouiaType,
3072
+ dimensions,
3073
+ ariaDescribedBy,
3074
+ ariaLabelledBy,
3075
+ viewBox,
3076
+ preserveAspectRatio,
3077
+ userProps,
3078
+ titleId,
3079
+ descId,
3080
+ containerRef,
3081
+ localContainerRef
3082
+ } = useVictoryContainer(initialProps);
3083
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
3084
+ if (!events?.onWheel) return;
3085
+ const handleWheel = e => e.preventDefault();
3086
+ const container = localContainerRef?.current;
3087
+ container?.addEventListener("wheel", handleWheel);
3088
+ return () => {
3089
+ container?.removeEventListener("wheel", handleWheel);
3084
3090
  };
3085
- const divStyle = Object.assign({
3091
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3092
+ }, []);
3093
+ 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", {
3094
+ className: className,
3095
+ style: {
3096
+ ...style,
3097
+ width: responsive ? style?.width : dimensions.width,
3098
+ height: responsive ? style?.height : dimensions.height,
3086
3099
  pointerEvents: "none",
3087
3100
  touchAction: "none",
3088
3101
  position: "relative"
3089
- }, dimensions);
3090
- const portalDivStyle = Object.assign({
3102
+ },
3103
+ "data-ouia-component-id": ouiaId,
3104
+ "data-ouia-component-type": ouiaType,
3105
+ "data-ouia-safe": ouiaSafe,
3106
+ ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_5__.mergeRefs)([localContainerRef, containerRef])
3107
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("svg", _extends({
3108
+ width: width,
3109
+ height: height,
3110
+ tabIndex: tabIndex,
3111
+ role: role,
3112
+ "aria-labelledby": ariaLabelledBy,
3113
+ "aria-describedby": ariaDescribedBy,
3114
+ viewBox: viewBox,
3115
+ preserveAspectRatio: preserveAspectRatio,
3116
+ style: {
3117
+ ...dimensions,
3118
+ pointerEvents: "all"
3119
+ }
3120
+ }, userProps, events), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("title", {
3121
+ id: titleId
3122
+ }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("desc", {
3123
+ id: descId
3124
+ }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
3125
+ style: {
3126
+ ...dimensions,
3091
3127
  zIndex: portalZIndex,
3092
3128
  position: "absolute",
3093
3129
  top: 0,
3094
3130
  left: 0
3095
- }, dimensions);
3096
- const svgStyle = Object.assign({
3097
- pointerEvents: "all"
3098
- }, dimensions);
3099
- const portalSvgStyle = Object.assign({
3131
+ }
3132
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__.PortalOutlet, {
3133
+ as: portalComponent,
3134
+ width: width,
3135
+ height: height,
3136
+ viewBox: viewBox,
3137
+ preserveAspectRatio: preserveAspectRatio,
3138
+ style: {
3139
+ ...dimensions,
3100
3140
  overflow: "visible"
3101
- }, dimensions);
3102
- const portalProps = {
3103
- width,
3104
- height,
3105
- viewBox: svgProps.viewBox,
3106
- preserveAspectRatio: svgProps.preserveAspectRatio,
3107
- style: portalSvgStyle
3108
- };
3109
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_7__.PortalContext.Provider, {
3110
- value: {
3111
- portalUpdate: this.portalUpdate,
3112
- portalRegister: this.portalRegister,
3113
- portalDeregister: this.portalDeregister
3114
- }
3115
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", _extends({
3116
- style: lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, style, divStyle),
3117
- className: className,
3118
- ref: this.saveContainerRef
3119
- }, this.getOUIAProps(props)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("svg", _extends({}, svgProps, {
3120
- style: svgStyle
3121
- }), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("title", {
3122
- id: this.getIdForElement("title")
3123
- }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("desc", {
3124
- id: this.getIdForElement("desc")
3125
- }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", {
3126
- style: portalDivStyle
3127
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().cloneElement(portalComponent, {
3128
- ...portalProps,
3129
- ref: this.savePortalRef
3130
- }))));
3131
- }
3132
- render() {
3133
- const {
3134
- width,
3135
- height,
3136
- responsive,
3137
- events,
3138
- title,
3139
- desc,
3140
- tabIndex,
3141
- preserveAspectRatio,
3142
- role
3143
- } = this.props;
3144
- const style = responsive ? this.props.style : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.omit(this.props.style, ["height", "width"]);
3145
- const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__.getSafeUserProps(this.props);
3146
- const svgProps = Object.assign({
3147
- width,
3148
- height,
3149
- tabIndex,
3150
- role,
3151
- "aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
3152
- "aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
3153
- viewBox: responsive ? `0 0 ${width} ${height}` : undefined,
3154
- preserveAspectRatio: responsive ? preserveAspectRatio : undefined,
3155
- ...userProps
3156
- }, events);
3157
- return this.renderContainer(this.props, svgProps, style);
3158
- }
3159
- }
3141
+ }
3142
+ }))));
3143
+ };
3144
+ VictoryContainer.role = "container";
3160
3145
 
3161
3146
  /***/ }),
3162
3147
 
@@ -3618,10 +3603,7 @@ const defaultProps = {
3618
3603
  lineHeight: 1
3619
3604
  };
3620
3605
  const VictoryLabel = initialProps => {
3621
- const props = evaluateProps({
3622
- ...defaultProps,
3623
- ...initialProps
3624
- });
3606
+ const props = evaluateProps(lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, initialProps, defaultProps));
3625
3607
  if (props.text === null || props.text === undefined) {
3626
3608
  return null;
3627
3609
  }
@@ -3672,17 +3654,83 @@ VictoryLabel.defaultStyles = defaultStyles;
3672
3654
  "use strict";
3673
3655
  __webpack_require__.r(__webpack_exports__);
3674
3656
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3675
- /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; }
3657
+ /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; },
3658
+ /* harmony export */ "PortalProvider": function() { return /* binding */ PortalProvider; },
3659
+ /* harmony export */ "usePortalContext": function() { return /* binding */ usePortalContext; }
3676
3660
  /* harmony export */ });
3677
3661
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
3678
3662
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
3679
3663
 
3680
- /**
3681
- * The React context object consumers may use to access the context of the
3682
- * portal.
3683
- */
3684
- const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({});
3664
+ const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined);
3685
3665
  PortalContext.displayName = "PortalContext";
3666
+ const usePortalContext = () => {
3667
+ const context = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(PortalContext);
3668
+ if (!context) {
3669
+ throw new Error("`usePortalContext` must be used within a `<PortalProvider />`");
3670
+ }
3671
+ return context;
3672
+ };
3673
+ const PortalProvider = _ref => {
3674
+ let {
3675
+ children
3676
+ } = _ref;
3677
+ const [portalChildren, setPortalChildren] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(new Map());
3678
+ const addChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((id, element) => {
3679
+ setPortalChildren(prevChildren => {
3680
+ const nextChildren = new Map(prevChildren);
3681
+ nextChildren.set(id, element);
3682
+ return nextChildren;
3683
+ });
3684
+ }, [setPortalChildren]);
3685
+ const removeChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(id => {
3686
+ setPortalChildren(prevChildren => {
3687
+ const nextChildren = new Map(prevChildren);
3688
+ nextChildren.delete(id);
3689
+ return nextChildren;
3690
+ });
3691
+ }, [setPortalChildren]);
3692
+ const contextValue = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => ({
3693
+ addChild,
3694
+ removeChild,
3695
+ children: portalChildren
3696
+ }), [addChild, removeChild, portalChildren]);
3697
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PortalContext.Provider, {
3698
+ value: contextValue
3699
+ }, children);
3700
+ };
3701
+
3702
+ /***/ }),
3703
+
3704
+ /***/ "../../victory-core/es/victory-portal/portal-outlet.js":
3705
+ /*!*************************************************************!*\
3706
+ !*** ../../victory-core/es/victory-portal/portal-outlet.js ***!
3707
+ \*************************************************************/
3708
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
3709
+
3710
+ "use strict";
3711
+ __webpack_require__.r(__webpack_exports__);
3712
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3713
+ /* harmony export */ "PortalOutlet": function() { return /* binding */ PortalOutlet; }
3714
+ /* harmony export */ });
3715
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
3716
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
3717
+ /* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
3718
+
3719
+
3720
+ const PortalOutlet = _ref => {
3721
+ let {
3722
+ as: portalComponent,
3723
+ ...props
3724
+ } = _ref;
3725
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_1__.usePortalContext)();
3726
+ const children = Array.from(portalContext.children.entries()).map(_ref2 => {
3727
+ let [key, node] = _ref2;
3728
+ return !node.key ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(node, {
3729
+ key
3730
+ }) : node;
3731
+ });
3732
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(portalComponent, props, children);
3733
+ };
3686
3734
 
3687
3735
  /***/ }),
3688
3736
 
@@ -3699,39 +3747,13 @@ __webpack_require__.r(__webpack_exports__);
3699
3747
  /* harmony export */ });
3700
3748
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
3701
3749
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
3750
+ 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); }
3702
3751
 
3703
- class Portal extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) {
3704
- static displayName = "Portal";
3705
- constructor(props) {
3706
- super(props);
3707
- this.map = {};
3708
- this.index = 1;
3709
- }
3710
- portalRegister = () => {
3711
- return ++this.index;
3712
- };
3713
- portalUpdate = (key, element) => {
3714
- this.map[key] = element;
3715
- this.forceUpdate();
3716
- };
3717
- portalDeregister = key => {
3718
- delete this.map[key];
3719
- this.forceUpdate();
3720
- };
3721
- getChildren() {
3722
- return Object.keys(this.map).map(key => {
3723
- const el = this.map[key];
3724
- return el ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(el, {
3725
- key
3726
- }) : el;
3727
- });
3728
- }
3729
-
3730
- // Overridden in victory-core-native
3731
- render() {
3732
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", this.props, this.getChildren());
3733
- }
3734
- }
3752
+ const Portal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef((props, ref) => {
3753
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
3754
+ ref: ref
3755
+ }, props));
3756
+ });
3735
3757
 
3736
3758
  /***/ }),
3737
3759
 
@@ -3758,59 +3780,42 @@ __webpack_require__.r(__webpack_exports__);
3758
3780
 
3759
3781
 
3760
3782
 
3761
- class VictoryPortal extends (react__WEBPACK_IMPORTED_MODULE_1___default().Component) {
3762
- static displayName = "VictoryPortal";
3763
- static role = "portal";
3764
- static defaultProps = {
3765
- groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
3783
+ const defaultProps = {
3784
+ groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
3785
+ };
3786
+ const VictoryPortal = initialProps => {
3787
+ const props = {
3788
+ ...defaultProps,
3789
+ ...initialProps
3766
3790
  };
3767
- static contextType = _portal_context__WEBPACK_IMPORTED_MODULE_2__.PortalContext;
3768
- componentDidMount() {
3769
- if (!this.checkedContext) {
3770
- if (typeof this.context.portalUpdate !== "function") {
3771
- const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
3772
- _victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
3773
- this.renderInPlace = true;
3774
- }
3775
- this.checkedContext = true;
3776
- }
3777
- this.forceUpdate();
3778
- }
3779
- componentDidUpdate() {
3780
- if (!this.renderInPlace) {
3781
- this.portalKey = this.portalKey || this.context.portalRegister();
3782
- this.context.portalUpdate(this.portalKey, this.element);
3783
- }
3784
- }
3785
- componentWillUnmount() {
3786
- if (this.context && this.context.portalDeregister) {
3787
- this.context.portalDeregister(this.portalKey);
3788
- }
3789
- }
3790
-
3791
- // Overridden in victory-core-native
3792
- renderPortal(child) {
3793
- if (this.renderInPlace) {
3794
- return child;
3795
- }
3796
- this.element = child;
3797
- return null;
3798
- }
3799
- render() {
3800
- const children = Array.isArray(this.props.children) ? this.props.children[0] : this.props.children;
3791
+ const id = react__WEBPACK_IMPORTED_MODULE_1___default().useId();
3792
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_2__.usePortalContext)();
3793
+ if (!portalContext) {
3794
+ const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
3795
+ _victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
3796
+ }
3797
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
3798
+ const children = Array.isArray(props.children) ? props.children[0] : props.children;
3801
3799
  const {
3802
3800
  groupComponent
3803
- } = this.props;
3801
+ } = props;
3804
3802
  const childProps = children && children.props || {};
3805
3803
  const standardProps = childProps.groupComponent ? {
3806
3804
  groupComponent,
3807
3805
  standalone: false
3808
3806
  } : {};
3809
- const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(this.props, ["children", "groupComponent"]));
3807
+ const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(props, ["children", "groupComponent"]));
3810
3808
  const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
3811
- return this.renderPortal(child);
3812
- }
3813
- }
3809
+ portalContext.addChild(id, child);
3810
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3811
+ }, [props.children]);
3812
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
3813
+ return () => portalContext.removeChild(id);
3814
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3815
+ }, []);
3816
+ return null;
3817
+ };
3818
+ VictoryPortal.role = "portal";
3814
3819
 
3815
3820
  /***/ }),
3816
3821
 
@@ -3825,10 +3830,13 @@ __webpack_require__.r(__webpack_exports__);
3825
3830
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3826
3831
  /* harmony export */ "LineSegment": function() { return /* binding */ LineSegment; }
3827
3832
  /* harmony export */ });
3828
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
3829
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
3830
- /* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
3831
- /* harmony import */ var _line__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./line */ "../../victory-core/es/victory-primitives/line.js");
3833
+ /* 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");
3834
+ /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_0__);
3835
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
3836
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
3837
+ /* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
3838
+ /* harmony import */ var _line__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./line */ "../../victory-core/es/victory-primitives/line.js");
3839
+
3832
3840
 
3833
3841
 
3834
3842
 
@@ -3841,13 +3849,13 @@ const evaluateProps = props => {
3841
3849
  * `style`
3842
3850
  * `tabIndex`
3843
3851
  */
3844
- const ariaLabel = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_1__.evaluateProp(props.ariaLabel, props);
3845
- const desc = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_1__.evaluateProp(props.desc, props);
3846
- const id = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_1__.evaluateProp(props.id, props);
3847
- const style = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_1__.evaluateStyle(Object.assign({
3852
+ const ariaLabel = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_2__.evaluateProp(props.ariaLabel, props);
3853
+ const desc = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_2__.evaluateProp(props.desc, props);
3854
+ const id = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_2__.evaluateProp(props.id, props);
3855
+ const style = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_2__.evaluateStyle(Object.assign({
3848
3856
  stroke: "black"
3849
3857
  }, props.style), props);
3850
- const tabIndex = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_1__.evaluateProp(props.tabIndex, props);
3858
+ const tabIndex = _victory_util_helpers__WEBPACK_IMPORTED_MODULE_2__.evaluateProp(props.tabIndex, props);
3851
3859
  return Object.assign({}, props, {
3852
3860
  ariaLabel,
3853
3861
  desc,
@@ -3857,16 +3865,13 @@ const evaluateProps = props => {
3857
3865
  });
3858
3866
  };
3859
3867
  const defaultProps = {
3860
- lineComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_line__WEBPACK_IMPORTED_MODULE_2__.Line, null),
3868
+ lineComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_line__WEBPACK_IMPORTED_MODULE_3__.Line, null),
3861
3869
  role: "presentation",
3862
3870
  shapeRendering: "auto"
3863
3871
  };
3864
3872
  const LineSegment = initialProps => {
3865
- const props = evaluateProps({
3866
- ...defaultProps,
3867
- ...initialProps
3868
- });
3869
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(props.lineComponent, {
3873
+ const props = evaluateProps(lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, initialProps, defaultProps));
3874
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(props.lineComponent, {
3870
3875
  ...props.events,
3871
3876
  "aria-label": props.ariaLabel,
3872
3877
  style: props.style,
@@ -4841,6 +4846,44 @@ function warn(message) {
4841
4846
 
4842
4847
  /***/ }),
4843
4848
 
4849
+ /***/ "../../victory-core/es/victory-util/merge-refs.js":
4850
+ /*!********************************************************!*\
4851
+ !*** ../../victory-core/es/victory-util/merge-refs.js ***!
4852
+ \********************************************************/
4853
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
4854
+
4855
+ "use strict";
4856
+ __webpack_require__.r(__webpack_exports__);
4857
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4858
+ /* harmony export */ "mergeRefs": function() { return /* binding */ mergeRefs; }
4859
+ /* harmony export */ });
4860
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
4861
+
4862
+ /**
4863
+ * Used to merge multiple React refs into a single callback ref.
4864
+ *
4865
+ * @example
4866
+ * ```tsx
4867
+ * <div ref={mergeRefs([ref, forwardedRef])} />
4868
+ * ```
4869
+ */
4870
+ function mergeRefs(refs) {
4871
+ return value => {
4872
+ refs.forEach(ref => {
4873
+ // If the ref is a function, it's a callback ref and we call it with the value.
4874
+ if (_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction(ref)) {
4875
+ ref(value);
4876
+ } else if (ref !== null && ref !== undefined) {
4877
+ // If the ref is an object (not null and not undefined), it's an object ref.
4878
+ // We assign the value to its 'current' property.
4879
+ ref.current = value;
4880
+ }
4881
+ });
4882
+ };
4883
+ }
4884
+
4885
+ /***/ }),
4886
+
4844
4887
  /***/ "../../victory-core/es/victory-util/selection.js":
4845
4888
  /*!*******************************************************!*\
4846
4889
  !*** ../../victory-core/es/victory-util/selection.js ***!
@@ -5366,98 +5409,6 @@ const approximateTextSize = (text, style) => _approximateTextSizeInternal.impl(t
5366
5409
 
5367
5410
  /***/ }),
5368
5411
 
5369
- /***/ "../../victory-core/es/victory-util/timer-context.js":
5370
- /*!***********************************************************!*\
5371
- !*** ../../victory-core/es/victory-util/timer-context.js ***!
5372
- \***********************************************************/
5373
- /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
5374
-
5375
- "use strict";
5376
- __webpack_require__.r(__webpack_exports__);
5377
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
5378
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
5379
- /* harmony import */ var _timer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./timer */ "../../victory-core/es/victory-util/timer.js");
5380
-
5381
-
5382
-
5383
- /**
5384
- * The React context object consumers may use to access or override the global
5385
- * timer.
5386
- */
5387
- const TimerContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({
5388
- transitionTimer: new _timer__WEBPACK_IMPORTED_MODULE_1__["default"](),
5389
- animationTimer: new _timer__WEBPACK_IMPORTED_MODULE_1__["default"]()
5390
- });
5391
- TimerContext.displayName = "TimerContext";
5392
- /* harmony default export */ __webpack_exports__["default"] = (TimerContext);
5393
-
5394
- /***/ }),
5395
-
5396
- /***/ "../../victory-core/es/victory-util/timer.js":
5397
- /*!***************************************************!*\
5398
- !*** ../../victory-core/es/victory-util/timer.js ***!
5399
- \***************************************************/
5400
- /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
5401
-
5402
- "use strict";
5403
- __webpack_require__.r(__webpack_exports__);
5404
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5405
- /* harmony export */ "default": function() { return /* binding */ Timer; }
5406
- /* harmony export */ });
5407
- /* harmony import */ var victory_vendor_d3_timer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! victory-vendor/d3-timer */ "../../victory-vendor/es/d3-timer.js");
5408
-
5409
- class Timer {
5410
- constructor() {
5411
- this.shouldAnimate = true;
5412
- this.subscribers = [];
5413
- this.timer = null;
5414
- this.activeSubscriptions = 0;
5415
- }
5416
- bypassAnimation() {
5417
- this.shouldAnimate = false;
5418
- }
5419
- resumeAnimation() {
5420
- this.shouldAnimate = true;
5421
- }
5422
- loop = () => {
5423
- this.subscribers.forEach(s => {
5424
- s.callback((0,victory_vendor_d3_timer__WEBPACK_IMPORTED_MODULE_0__.now)() - s.startTime, s.duration);
5425
- });
5426
- };
5427
- start() {
5428
- if (!this.timer) {
5429
- this.timer = (0,victory_vendor_d3_timer__WEBPACK_IMPORTED_MODULE_0__.timer)(this.loop);
5430
- }
5431
- }
5432
- stop() {
5433
- if (this.timer) {
5434
- this.timer.stop();
5435
- this.timer = null;
5436
- }
5437
- }
5438
- subscribe(callback, duration) {
5439
- const subscriptionID = this.subscribers.push({
5440
- startTime: (0,victory_vendor_d3_timer__WEBPACK_IMPORTED_MODULE_0__.now)(),
5441
- callback,
5442
- duration: this.shouldAnimate ? duration : 0
5443
- });
5444
- this.activeSubscriptions++;
5445
- this.start();
5446
- return subscriptionID;
5447
- }
5448
- unsubscribe(id) {
5449
- if (id !== null && this.subscribers[id - 1]) {
5450
- delete this.subscribers[id - 1];
5451
- this.activeSubscriptions--;
5452
- }
5453
- if (this.activeSubscriptions === 0) {
5454
- this.stop();
5455
- }
5456
- }
5457
- }
5458
-
5459
- /***/ }),
5460
-
5461
5412
  /***/ "../../victory-core/es/victory-util/user-props.js":
5462
5413
  /*!********************************************************!*\
5463
5414
  !*** ../../victory-core/es/victory-util/user-props.js ***!
@@ -5572,32 +5523,6 @@ const withSafeUserProps = (component, props) => {
5572
5523
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.cloneElement(component, getSafeUserProps(props));
5573
5524
  };
5574
5525
 
5575
- /***/ }),
5576
-
5577
- /***/ "../../victory-vendor/es/d3-timer.js":
5578
- /*!*******************************************!*\
5579
- !*** ../../victory-vendor/es/d3-timer.js ***!
5580
- \*******************************************/
5581
- /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
5582
-
5583
- "use strict";
5584
- __webpack_require__.r(__webpack_exports__);
5585
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5586
- /* harmony export */ "interval": function() { return /* reexport safe */ d3_timer__WEBPACK_IMPORTED_MODULE_0__.interval; },
5587
- /* harmony export */ "now": function() { return /* reexport safe */ d3_timer__WEBPACK_IMPORTED_MODULE_0__.now; },
5588
- /* harmony export */ "timeout": function() { return /* reexport safe */ d3_timer__WEBPACK_IMPORTED_MODULE_0__.timeout; },
5589
- /* harmony export */ "timer": function() { return /* reexport safe */ d3_timer__WEBPACK_IMPORTED_MODULE_0__.timer; },
5590
- /* harmony export */ "timerFlush": function() { return /* reexport safe */ d3_timer__WEBPACK_IMPORTED_MODULE_0__.timerFlush; }
5591
- /* harmony export */ });
5592
- /* 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");
5593
-
5594
- // `victory-vendor/d3-timer` (ESM)
5595
- // See upstream license: https://github.com/d3/d3-timer/blob/main/LICENSE
5596
- //
5597
- // Our ESM package uses the underlying installed dependencies of `node_modules/d3-timer`
5598
-
5599
-
5600
-
5601
5526
  /***/ }),
5602
5527
 
5603
5528
  /***/ "react":
@@ -5609,221 +5534,6 @@ __webpack_require__.r(__webpack_exports__);
5609
5534
  "use strict";
5610
5535
  module.exports = __WEBPACK_EXTERNAL_MODULE_react__;
5611
5536
 
5612
- /***/ }),
5613
-
5614
- /***/ "../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/index.js":
5615
- /*!*************************************************************************************!*\
5616
- !*** ../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/index.js ***!
5617
- \*************************************************************************************/
5618
- /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
5619
-
5620
- "use strict";
5621
- __webpack_require__.r(__webpack_exports__);
5622
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5623
- /* harmony export */ "interval": function() { return /* reexport safe */ _interval_js__WEBPACK_IMPORTED_MODULE_2__["default"]; },
5624
- /* harmony export */ "now": function() { return /* reexport safe */ _timer_js__WEBPACK_IMPORTED_MODULE_0__.now; },
5625
- /* harmony export */ "timeout": function() { return /* reexport safe */ _timeout_js__WEBPACK_IMPORTED_MODULE_1__["default"]; },
5626
- /* harmony export */ "timer": function() { return /* reexport safe */ _timer_js__WEBPACK_IMPORTED_MODULE_0__.timer; },
5627
- /* harmony export */ "timerFlush": function() { return /* reexport safe */ _timer_js__WEBPACK_IMPORTED_MODULE_0__.timerFlush; }
5628
- /* harmony export */ });
5629
- /* 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");
5630
- /* 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");
5631
- /* 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");
5632
-
5633
-
5634
-
5635
-
5636
-
5637
-
5638
-
5639
- /***/ }),
5640
-
5641
- /***/ "../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/interval.js":
5642
- /*!****************************************************************************************!*\
5643
- !*** ../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/interval.js ***!
5644
- \****************************************************************************************/
5645
- /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
5646
-
5647
- "use strict";
5648
- __webpack_require__.r(__webpack_exports__);
5649
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5650
- /* harmony export */ "default": function() { return /* export default binding */ __WEBPACK_DEFAULT_EXPORT__; }
5651
- /* harmony export */ });
5652
- /* 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");
5653
-
5654
-
5655
- /* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(callback, delay, time) {
5656
- var t = new _timer_js__WEBPACK_IMPORTED_MODULE_0__.Timer, total = delay;
5657
- if (delay == null) return t.restart(callback, delay, time), t;
5658
- t._restart = t.restart;
5659
- t.restart = function(callback, delay, time) {
5660
- delay = +delay, time = time == null ? (0,_timer_js__WEBPACK_IMPORTED_MODULE_0__.now)() : +time;
5661
- t._restart(function tick(elapsed) {
5662
- elapsed += total;
5663
- t._restart(tick, total += delay, time);
5664
- callback(elapsed);
5665
- }, delay, time);
5666
- }
5667
- t.restart(callback, delay, time);
5668
- return t;
5669
- }
5670
-
5671
-
5672
- /***/ }),
5673
-
5674
- /***/ "../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timeout.js":
5675
- /*!***************************************************************************************!*\
5676
- !*** ../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timeout.js ***!
5677
- \***************************************************************************************/
5678
- /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
5679
-
5680
- "use strict";
5681
- __webpack_require__.r(__webpack_exports__);
5682
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5683
- /* harmony export */ "default": function() { return /* export default binding */ __WEBPACK_DEFAULT_EXPORT__; }
5684
- /* harmony export */ });
5685
- /* 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");
5686
-
5687
-
5688
- /* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(callback, delay, time) {
5689
- var t = new _timer_js__WEBPACK_IMPORTED_MODULE_0__.Timer;
5690
- delay = delay == null ? 0 : +delay;
5691
- t.restart(elapsed => {
5692
- t.stop();
5693
- callback(elapsed + delay);
5694
- }, delay, time);
5695
- return t;
5696
- }
5697
-
5698
-
5699
- /***/ }),
5700
-
5701
- /***/ "../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js":
5702
- /*!*************************************************************************************!*\
5703
- !*** ../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js ***!
5704
- \*************************************************************************************/
5705
- /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
5706
-
5707
- "use strict";
5708
- __webpack_require__.r(__webpack_exports__);
5709
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5710
- /* harmony export */ "Timer": function() { return /* binding */ Timer; },
5711
- /* harmony export */ "now": function() { return /* binding */ now; },
5712
- /* harmony export */ "timer": function() { return /* binding */ timer; },
5713
- /* harmony export */ "timerFlush": function() { return /* binding */ timerFlush; }
5714
- /* harmony export */ });
5715
- var frame = 0, // is an animation frame pending?
5716
- timeout = 0, // is a timeout pending?
5717
- interval = 0, // are any timers active?
5718
- pokeDelay = 1000, // how frequently we check for clock skew
5719
- taskHead,
5720
- taskTail,
5721
- clockLast = 0,
5722
- clockNow = 0,
5723
- clockSkew = 0,
5724
- clock = typeof performance === "object" && performance.now ? performance : Date,
5725
- setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };
5726
-
5727
- function now() {
5728
- return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
5729
- }
5730
-
5731
- function clearNow() {
5732
- clockNow = 0;
5733
- }
5734
-
5735
- function Timer() {
5736
- this._call =
5737
- this._time =
5738
- this._next = null;
5739
- }
5740
-
5741
- Timer.prototype = timer.prototype = {
5742
- constructor: Timer,
5743
- restart: function(callback, delay, time) {
5744
- if (typeof callback !== "function") throw new TypeError("callback is not a function");
5745
- time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
5746
- if (!this._next && taskTail !== this) {
5747
- if (taskTail) taskTail._next = this;
5748
- else taskHead = this;
5749
- taskTail = this;
5750
- }
5751
- this._call = callback;
5752
- this._time = time;
5753
- sleep();
5754
- },
5755
- stop: function() {
5756
- if (this._call) {
5757
- this._call = null;
5758
- this._time = Infinity;
5759
- sleep();
5760
- }
5761
- }
5762
- };
5763
-
5764
- function timer(callback, delay, time) {
5765
- var t = new Timer;
5766
- t.restart(callback, delay, time);
5767
- return t;
5768
- }
5769
-
5770
- function timerFlush() {
5771
- now(); // Get the current time, if not already set.
5772
- ++frame; // Pretend we’ve set an alarm, if we haven’t already.
5773
- var t = taskHead, e;
5774
- while (t) {
5775
- if ((e = clockNow - t._time) >= 0) t._call.call(undefined, e);
5776
- t = t._next;
5777
- }
5778
- --frame;
5779
- }
5780
-
5781
- function wake() {
5782
- clockNow = (clockLast = clock.now()) + clockSkew;
5783
- frame = timeout = 0;
5784
- try {
5785
- timerFlush();
5786
- } finally {
5787
- frame = 0;
5788
- nap();
5789
- clockNow = 0;
5790
- }
5791
- }
5792
-
5793
- function poke() {
5794
- var now = clock.now(), delay = now - clockLast;
5795
- if (delay > pokeDelay) clockSkew -= delay, clockLast = now;
5796
- }
5797
-
5798
- function nap() {
5799
- var t0, t1 = taskHead, t2, time = Infinity;
5800
- while (t1) {
5801
- if (t1._call) {
5802
- if (time > t1._time) time = t1._time;
5803
- t0 = t1, t1 = t1._next;
5804
- } else {
5805
- t2 = t1._next, t1._next = null;
5806
- t1 = t0 ? t0._next = t2 : taskHead = t2;
5807
- }
5808
- }
5809
- taskTail = t0;
5810
- sleep(time);
5811
- }
5812
-
5813
- function sleep(time) {
5814
- if (frame) return; // Soonest alarm already set, or will be.
5815
- if (timeout) timeout = clearTimeout(timeout);
5816
- var delay = time - clockNow; // Strictly less than if we recomputed clockNow.
5817
- if (delay > 24) {
5818
- if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);
5819
- if (interval) interval = clearInterval(interval);
5820
- } else {
5821
- if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
5822
- frame = 1, setFrame(wake);
5823
- }
5824
- }
5825
-
5826
-
5827
5537
  /***/ })
5828
5538
 
5829
5539
  /******/ });
@@ -5916,8 +5626,9 @@ var __webpack_exports__ = {};
5916
5626
  __webpack_require__.r(__webpack_exports__);
5917
5627
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5918
5628
  /* harmony export */ "CursorHelpers": function() { return /* reexport safe */ _cursor_helpers__WEBPACK_IMPORTED_MODULE_0__.CursorHelpers; },
5629
+ /* harmony export */ "VICTORY_CURSOR_CONTAINER_DEFAULT_PROPS": function() { return /* reexport safe */ _victory_cursor_container__WEBPACK_IMPORTED_MODULE_1__.VICTORY_CURSOR_CONTAINER_DEFAULT_PROPS; },
5919
5630
  /* harmony export */ "VictoryCursorContainer": function() { return /* reexport safe */ _victory_cursor_container__WEBPACK_IMPORTED_MODULE_1__.VictoryCursorContainer; },
5920
- /* harmony export */ "cursorContainerMixin": function() { return /* reexport safe */ _victory_cursor_container__WEBPACK_IMPORTED_MODULE_1__.cursorContainerMixin; }
5631
+ /* harmony export */ "useVictoryCursorContainer": function() { return /* reexport safe */ _victory_cursor_container__WEBPACK_IMPORTED_MODULE_1__.useVictoryCursorContainer; }
5921
5632
  /* harmony export */ });
5922
5633
  /* harmony import */ var _cursor_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cursor-helpers */ "./cursor-helpers.tsx");
5923
5634
  /* harmony import */ var _victory_cursor_container__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./victory-cursor-container */ "./victory-cursor-container.tsx");