victory-brush-container 37.0.2 → 37.1.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.
@@ -543,17 +543,18 @@ const BrushHelpers = {
543
543
  "use strict";
544
544
  __webpack_require__.r(__webpack_exports__);
545
545
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
546
+ /* harmony export */ "VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS": function() { return /* binding */ VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS; },
546
547
  /* harmony export */ "VictoryBrushContainer": function() { return /* binding */ VictoryBrushContainer; },
547
- /* harmony export */ "brushContainerMixin": function() { return /* binding */ brushContainerMixin; }
548
+ /* harmony export */ "useVictoryBrushContainer": function() { return /* binding */ useVictoryBrushContainer; }
548
549
  /* harmony export */ });
549
550
  /* 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");
550
551
  /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_0__);
551
552
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
552
553
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
553
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
554
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-primitives/rect.js");
555
- /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/selection.js");
556
- /* harmony import */ var _brush_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./brush-helpers */ "./brush-helpers.ts");
554
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-primitives/rect.js");
555
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/selection.js");
556
+ /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
557
+ /* harmony import */ var _brush_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./brush-helpers */ "./brush-helpers.ts");
557
558
  /* 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");
558
559
  /* harmony import */ var react_fast_compare__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_fast_compare__WEBPACK_IMPORTED_MODULE_2__);
559
560
 
@@ -561,172 +562,176 @@ __webpack_require__.r(__webpack_exports__);
561
562
 
562
563
 
563
564
 
564
- function brushContainerMixin(Base) {
565
- // @ts-expect-error "TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'."
566
- return class VictoryBrushContainer extends Base {
567
- static displayName = "VictoryBrushContainer";
568
- static defaultProps = {
569
- ...victory_core__WEBPACK_IMPORTED_MODULE_3__.VictoryContainer.defaultProps,
570
- allowDrag: true,
571
- allowDraw: true,
572
- allowResize: true,
573
- brushComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_4__.Rect, null),
574
- brushStyle: {
575
- stroke: "transparent",
576
- fill: "black",
577
- fillOpacity: 0.1
578
- },
579
- handleComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_4__.Rect, null),
580
- handleStyle: {
581
- stroke: "transparent",
582
- fill: "transparent"
583
- },
584
- handleWidth: 8,
585
- mouseMoveThreshold: 0
565
+ const VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS = {
566
+ allowDrag: true,
567
+ allowDraw: true,
568
+ allowResize: true,
569
+ brushComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_3__.Rect, null),
570
+ brushStyle: {
571
+ stroke: "transparent",
572
+ fill: "black",
573
+ fillOpacity: 0.1
574
+ },
575
+ handleComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_3__.Rect, null),
576
+ handleStyle: {
577
+ stroke: "transparent",
578
+ fill: "transparent"
579
+ },
580
+ handleWidth: 8,
581
+ mouseMoveThreshold: 0
582
+ };
583
+ const useVictoryBrushContainer = initialProps => {
584
+ const props = {
585
+ ...VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS,
586
+ ...initialProps
587
+ };
588
+ const {
589
+ children
590
+ } = props;
591
+ const getSelectBox = coordinates => {
592
+ const {
593
+ x,
594
+ y
595
+ } = coordinates;
596
+ const {
597
+ brushStyle,
598
+ brushComponent,
599
+ name
600
+ } = props;
601
+ const brushComponentStyle = brushComponent.props && brushComponent.props.style;
602
+ const cursor = !props.allowDrag && !props.allowResize ? "auto" : "move";
603
+ return x[0] !== x[1] && y[0] !== y[1] ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(brushComponent, {
604
+ key: `${name}-brush`,
605
+ width: Math.abs(x[1] - x[0]) || 1,
606
+ height: Math.abs(y[1] - y[0]) || 1,
607
+ x: Math.min(x[0], x[1]),
608
+ y: Math.min(y[0], y[1]),
609
+ cursor,
610
+ style: lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, brushComponentStyle, brushStyle)
611
+ }) : null;
612
+ };
613
+ const getCursorPointers = () => {
614
+ const cursors = {
615
+ yProps: "ns-resize",
616
+ xProps: "ew-resize"
586
617
  };
587
- static defaultEvents(props) {
588
- return [{
589
- target: "parent",
590
- eventHandlers: {
591
- onMouseDown: (evt, targetProps) => {
592
- return props.disable ? {} : _brush_helpers__WEBPACK_IMPORTED_MODULE_5__.BrushHelpers.onMouseDown(evt, targetProps);
593
- },
594
- onTouchStart: (evt, targetProps) => {
595
- return props.disable ? {} : _brush_helpers__WEBPACK_IMPORTED_MODULE_5__.BrushHelpers.onMouseDown(evt, targetProps);
596
- },
597
- onGlobalMouseMove: (evt, targetProps) => {
598
- return props.disable || !targetProps.isPanning && !targetProps.isSelecting ? {} : _brush_helpers__WEBPACK_IMPORTED_MODULE_5__.BrushHelpers.onGlobalMouseMove(evt, targetProps);
599
- },
600
- onGlobalTouchMove: (evt, targetProps) => {
601
- return props.disable || !targetProps.isPanning && !targetProps.isSelecting ? {} : _brush_helpers__WEBPACK_IMPORTED_MODULE_5__.BrushHelpers.onGlobalMouseMove(evt, targetProps);
602
- },
603
- onGlobalMouseUp: (evt, targetProps) => {
604
- return props.disable ? {} : _brush_helpers__WEBPACK_IMPORTED_MODULE_5__.BrushHelpers.onGlobalMouseUp(evt, targetProps);
605
- },
606
- onGlobalTouchEnd: (evt, targetProps) => {
607
- return props.disable ? {} : _brush_helpers__WEBPACK_IMPORTED_MODULE_5__.BrushHelpers.onGlobalMouseUp(evt, targetProps);
608
- },
609
- onGlobalTouchCancel: (evt, targetProps) => {
610
- return props.disable ? {} : _brush_helpers__WEBPACK_IMPORTED_MODULE_5__.BrushHelpers.onGlobalMouseUp(evt, targetProps);
611
- }
612
- }
613
- }];
614
- }
615
- getSelectBox(props, coordinates) {
616
- const {
617
- x,
618
- y
619
- } = coordinates;
620
- const {
621
- brushStyle,
622
- brushComponent,
623
- name
624
- } = props;
625
- const brushComponentStyle = brushComponent.props && brushComponent.props.style;
626
- const cursor = !props.allowDrag && !props.allowResize ? "auto" : "move";
627
- return x[0] !== x[1] && y[0] !== y[1] ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(brushComponent, {
628
- key: `${name}-brush`,
629
- width: Math.abs(x[1] - x[0]) || 1,
630
- height: Math.abs(y[1] - y[0]) || 1,
631
- x: Math.min(x[0], x[1]),
632
- y: Math.min(y[0], y[1]),
633
- cursor,
634
- style: lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, brushComponentStyle, brushStyle)
635
- }) : null;
636
- }
637
- getCursorPointers(props) {
638
- const cursors = {
639
- yProps: "ns-resize",
640
- xProps: "ew-resize"
641
- };
642
- if (!props.allowResize && props.allowDrag) {
643
- cursors.xProps = "move";
644
- cursors.yProps = "move";
645
- } else if (!props.allowResize && !props.allowDrag) {
646
- cursors.xProps = "auto";
647
- cursors.yProps = "auto";
648
- }
649
- return cursors;
650
- }
651
- getHandles(props, domain) {
652
- const {
653
- handleWidth,
654
- handleStyle,
655
- handleComponent,
656
- name
657
- } = props;
658
- const domainBox = _brush_helpers__WEBPACK_IMPORTED_MODULE_5__.BrushHelpers.getDomainBox(props, domain);
659
- const {
660
- x1,
661
- x2,
662
- y1,
663
- y2
664
- } = domainBox;
665
- const {
666
- top,
667
- bottom,
668
- left,
669
- right
670
- } = _brush_helpers__WEBPACK_IMPORTED_MODULE_5__.BrushHelpers.getHandles(props, domainBox);
671
- const width = Math.abs(x2 - x1) || 1;
672
- const height = Math.abs(y2 - y1) || 1;
673
- const handleComponentStyle = handleComponent.props && handleComponent.props.style || {};
674
- const style = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, handleComponentStyle, handleStyle);
675
- const cursors = this.getCursorPointers(props);
676
- const yProps = {
677
- style,
678
- width,
679
- height: handleWidth,
680
- cursor: cursors.yProps
681
- };
682
- const xProps = {
683
- style,
684
- width: handleWidth,
685
- height,
686
- cursor: cursors.xProps
687
- };
688
- const handleProps = {
689
- top: top && Object.assign({
690
- x: top.x1,
691
- y: top.y1
692
- }, yProps),
693
- bottom: bottom && Object.assign({
694
- x: bottom.x1,
695
- y: bottom.y1
696
- }, yProps),
697
- left: left && Object.assign({
698
- y: left.y1,
699
- x: left.x1
700
- }, xProps),
701
- right: right && Object.assign({
702
- y: right.y1,
703
- x: right.x1
704
- }, xProps)
705
- };
706
- const handles = ["top", "bottom", "left", "right"].reduce((memo, curr) => handleProps[curr] ? memo.concat( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(handleComponent, Object.assign({
707
- key: `${name}-handle-${curr}`
708
- }, handleProps[curr]))) : memo, []);
709
- return handles.length ? handles : null;
710
- }
711
- getRect(props) {
712
- const {
713
- currentDomain,
714
- cachedBrushDomain
715
- } = props;
716
- const brushDomain = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, props.brushDomain, props.domain);
717
- const domain = react_fast_compare__WEBPACK_IMPORTED_MODULE_2___default()(brushDomain, cachedBrushDomain) ? lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, currentDomain, brushDomain) : brushDomain;
718
- const coordinates = victory_core__WEBPACK_IMPORTED_MODULE_6__.getDomainCoordinates(props, domain);
719
- const selectBox = this.getSelectBox(props, coordinates);
720
- return selectBox ? [selectBox, this.getHandles(props, domain)] : [];
721
- }
722
-
723
- // Overrides method in VictoryContainer
724
- getChildren(props) {
725
- return [...react__WEBPACK_IMPORTED_MODULE_1___default().Children.toArray(props.children), ...this.getRect(props)];
618
+ if (!props.allowResize && props.allowDrag) {
619
+ cursors.xProps = "move";
620
+ cursors.yProps = "move";
621
+ } else if (!props.allowResize && !props.allowDrag) {
622
+ cursors.xProps = "auto";
623
+ cursors.yProps = "auto";
726
624
  }
625
+ return cursors;
727
626
  };
728
- }
729
- const VictoryBrushContainer = brushContainerMixin(victory_core__WEBPACK_IMPORTED_MODULE_3__.VictoryContainer);
627
+ const getHandles = domain => {
628
+ const {
629
+ handleWidth,
630
+ handleStyle,
631
+ handleComponent,
632
+ name
633
+ } = props;
634
+ const domainBox = _brush_helpers__WEBPACK_IMPORTED_MODULE_4__.BrushHelpers.getDomainBox(props, domain);
635
+ const {
636
+ x1,
637
+ x2,
638
+ y1,
639
+ y2
640
+ } = domainBox;
641
+ const {
642
+ top,
643
+ bottom,
644
+ left,
645
+ right
646
+ } = _brush_helpers__WEBPACK_IMPORTED_MODULE_4__.BrushHelpers.getHandles(props, domainBox);
647
+ const width = Math.abs(x2 - x1) || 1;
648
+ const height = Math.abs(y2 - y1) || 1;
649
+ const handleComponentStyle = handleComponent.props && handleComponent.props.style || {};
650
+ const style = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, handleComponentStyle, handleStyle);
651
+ const cursors = getCursorPointers();
652
+ const yProps = {
653
+ style,
654
+ width,
655
+ height: handleWidth,
656
+ cursor: cursors.yProps
657
+ };
658
+ const xProps = {
659
+ style,
660
+ width: handleWidth,
661
+ height,
662
+ cursor: cursors.xProps
663
+ };
664
+ const handleProps = {
665
+ top: top && Object.assign({
666
+ x: top.x1,
667
+ y: top.y1
668
+ }, yProps),
669
+ bottom: bottom && Object.assign({
670
+ x: bottom.x1,
671
+ y: bottom.y1
672
+ }, yProps),
673
+ left: left && Object.assign({
674
+ y: left.y1,
675
+ x: left.x1
676
+ }, xProps),
677
+ right: right && Object.assign({
678
+ y: right.y1,
679
+ x: right.x1
680
+ }, xProps)
681
+ };
682
+ const handles = ["top", "bottom", "left", "right"].reduce((memo, curr) => handleProps[curr] ? memo.concat( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(handleComponent, Object.assign({
683
+ key: `${name}-handle-${curr}`
684
+ }, handleProps[curr]))) : memo, []);
685
+ return handles.length ? handles : null;
686
+ };
687
+ const getRect = () => {
688
+ const {
689
+ currentDomain,
690
+ cachedBrushDomain
691
+ } = props;
692
+ const brushDomain = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, props.brushDomain, props.domain);
693
+ const domain = react_fast_compare__WEBPACK_IMPORTED_MODULE_2___default()(brushDomain, cachedBrushDomain) ? lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, currentDomain, brushDomain) : brushDomain;
694
+ const coordinates = victory_core__WEBPACK_IMPORTED_MODULE_5__.getDomainCoordinates(props, domain);
695
+ const selectBox = getSelectBox(coordinates);
696
+ return selectBox ? [selectBox, getHandles(domain)] : [];
697
+ };
698
+ return {
699
+ props,
700
+ children: [...react__WEBPACK_IMPORTED_MODULE_1___default().Children.toArray(children), ...getRect()]
701
+ };
702
+ };
703
+ const VictoryBrushContainer = initialProps => {
704
+ const {
705
+ props,
706
+ children
707
+ } = useVictoryBrushContainer(initialProps);
708
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_6__.VictoryContainer, props, children);
709
+ };
710
+ VictoryBrushContainer.role = "container";
711
+ VictoryBrushContainer.defaultEvents = initialProps => {
712
+ const props = {
713
+ ...VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS,
714
+ ...initialProps
715
+ };
716
+ const createEventHandler = (handler, isDisabled) =>
717
+ // eslint-disable-next-line max-params
718
+ (event, targetProps, eventKey, context) => props.disable || isDisabled?.(targetProps) ? {} : handler(event, {
719
+ ...props,
720
+ ...targetProps
721
+ }, eventKey, context);
722
+ return [{
723
+ target: "parent",
724
+ eventHandlers: {
725
+ onMouseDown: createEventHandler(_brush_helpers__WEBPACK_IMPORTED_MODULE_4__.BrushHelpers.onMouseDown),
726
+ onTouchStart: createEventHandler(_brush_helpers__WEBPACK_IMPORTED_MODULE_4__.BrushHelpers.onMouseDown),
727
+ onGlobalMouseMove: createEventHandler(_brush_helpers__WEBPACK_IMPORTED_MODULE_4__.BrushHelpers.onGlobalMouseMove, targetProps => !targetProps.isPanning && !targetProps.isSelecting),
728
+ onGlobalTouchMove: createEventHandler(_brush_helpers__WEBPACK_IMPORTED_MODULE_4__.BrushHelpers.onGlobalMouseMove, targetProps => !targetProps.isPanning && !targetProps.isSelecting),
729
+ onGlobalMouseUp: createEventHandler(_brush_helpers__WEBPACK_IMPORTED_MODULE_4__.BrushHelpers.onGlobalMouseUp),
730
+ onGlobalTouchEnd: createEventHandler(_brush_helpers__WEBPACK_IMPORTED_MODULE_4__.BrushHelpers.onGlobalMouseUp),
731
+ onGlobalTouchCancel: createEventHandler(_brush_helpers__WEBPACK_IMPORTED_MODULE_4__.BrushHelpers.onGlobalMouseUp)
732
+ }
733
+ }];
734
+ };
730
735
 
731
736
  /***/ }),
732
737
 
@@ -2847,23 +2852,18 @@ module.exports = function isEqual(a, b) {
2847
2852
  "use strict";
2848
2853
  __webpack_require__.r(__webpack_exports__);
2849
2854
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2850
- /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; }
2855
+ /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
2856
+ /* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
2851
2857
  /* harmony export */ });
2852
- /* 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");
2853
- /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_isObject__WEBPACK_IMPORTED_MODULE_0__);
2854
- /* 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");
2855
- /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1__);
2856
- /* 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");
2857
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_2__);
2858
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "react");
2859
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
2860
- /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
2861
- /* 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");
2862
- /* 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");
2863
- /* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
2864
- /* 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");
2865
-
2866
-
2858
+ /* 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");
2859
+ /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
2860
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
2861
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
2862
+ /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
2863
+ /* 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");
2864
+ /* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
2865
+ /* 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");
2866
+ /* harmony import */ var _victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-portal/portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
2867
2867
 
2868
2868
  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); }
2869
2869
 
@@ -2872,175 +2872,149 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
2872
2872
 
2873
2873
 
2874
2874
 
2875
- class VictoryContainer extends (react__WEBPACK_IMPORTED_MODULE_3___default().Component) {
2876
- static displayName = "VictoryContainer";
2877
- static role = "container";
2878
- static defaultProps = {
2879
- className: "VictoryContainer",
2880
- portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__.Portal, null),
2881
- portalZIndex: 99,
2882
- responsive: true,
2883
- role: "img"
2875
+ const defaultProps = {
2876
+ className: "VictoryContainer",
2877
+ portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__.Portal, null),
2878
+ portalZIndex: 99,
2879
+ responsive: true,
2880
+ role: "img"
2881
+ };
2882
+ function useVictoryContainer(initialProps) {
2883
+ const props = {
2884
+ ...defaultProps,
2885
+ ...initialProps
2884
2886
  };
2885
- static contextType = _victory_util_timer_context__WEBPACK_IMPORTED_MODULE_5__["default"];
2886
-
2887
- // @ts-expect-error Ref will be initialized on mount
2888
-
2889
- // @ts-expect-error Ref will be initialized on mount
2890
-
2891
- constructor(props) {
2892
- super(props);
2893
- this.containerId = !lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default()(props) || props.containerId === undefined ? lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default()("victory-container-") : props.containerId;
2894
- this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
2895
- }
2896
- savePortalRef = portal => {
2897
- this.portalRef = portal;
2898
- return portal;
2887
+ const {
2888
+ title,
2889
+ desc,
2890
+ width,
2891
+ height,
2892
+ responsive
2893
+ } = props;
2894
+ const localContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
2895
+
2896
+ // Generated ID stored in ref because it needs to persist across renders
2897
+ const generatedId = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()("victory-container-"));
2898
+ const containerId = props.containerId ?? generatedId.current;
2899
+ const getIdForElement = elName => `${containerId}-${elName}`;
2900
+ const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
2901
+ const dimensions = responsive ? {
2902
+ width: "100%",
2903
+ height: "100%"
2904
+ } : {
2905
+ width,
2906
+ height
2899
2907
  };
2900
- portalUpdate = (key, el) => this.portalRef.portalUpdate(key, el);
2901
- portalRegister = () => this.portalRef.portalRegister();
2902
- portalDeregister = key => this.portalRef.portalDeregister(key);
2903
- saveContainerRef = container => {
2904
- if (_victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(this.props.containerRef)) {
2905
- this.props.containerRef(container);
2906
- }
2907
- this.containerRef = container;
2908
- return container;
2908
+ const viewBox = responsive ? `0 0 ${width} ${height}` : undefined;
2909
+ const preserveAspectRatio = responsive ? props.preserveAspectRatio : undefined;
2910
+ const ariaLabelledBy = [title && getIdForElement("title"), props["aria-labelledby"]].filter(Boolean).join(" ") || undefined;
2911
+ const ariaDescribedBy = [desc && getIdForElement("desc"), props["aria-describedby"]].filter(Boolean).join(" ") || undefined;
2912
+ const titleId = getIdForElement("title");
2913
+ const descId = getIdForElement("desc");
2914
+ return {
2915
+ ...props,
2916
+ titleId,
2917
+ descId,
2918
+ dimensions,
2919
+ viewBox,
2920
+ preserveAspectRatio,
2921
+ ariaLabelledBy,
2922
+ ariaDescribedBy,
2923
+ userProps,
2924
+ localContainerRef
2909
2925
  };
2910
- handleWheel = e => e.preventDefault();
2911
- componentDidMount() {
2912
- if (this.shouldHandleWheel && this.containerRef) {
2913
- this.containerRef.addEventListener("wheel", this.handleWheel);
2914
- }
2915
- }
2916
- componentWillUnmount() {
2917
- if (this.shouldHandleWheel && this.containerRef) {
2918
- this.containerRef.removeEventListener("wheel", this.handleWheel);
2919
- }
2920
- }
2921
- getIdForElement(elementName) {
2922
- return `${this.containerId}-${elementName}`;
2923
- }
2924
-
2925
- // overridden in custom containers
2926
- getChildren(props) {
2927
- return props.children;
2928
- }
2929
-
2930
- // Get props defined by the Open UI Automation (OUIA) 1.0-RC spec
2931
- // See https://ouia.readthedocs.io/en/latest/README.html#ouia-component
2932
- getOUIAProps(props) {
2933
- const {
2934
- ouiaId,
2935
- ouiaSafe,
2936
- ouiaType
2937
- } = props;
2938
- return {
2939
- ...(ouiaId && {
2940
- "data-ouia-component-id": ouiaId
2941
- }),
2942
- ...(ouiaType && {
2943
- "data-ouia-component-type": ouiaType
2944
- }),
2945
- ...(ouiaSafe !== undefined && {
2946
- "data-ouia-safe": ouiaSafe
2947
- })
2948
- };
2949
- }
2950
- renderContainer(props, svgProps, style) {
2951
- const {
2952
- title,
2953
- desc,
2954
- portalComponent,
2955
- className,
2956
- width,
2957
- height,
2958
- portalZIndex,
2959
- responsive
2960
- } = props;
2961
- const children = this.getChildren(props);
2962
- const dimensions = responsive ? {
2963
- width: "100%",
2964
- height: "100%"
2965
- } : {
2966
- width,
2967
- height
2926
+ }
2927
+ const VictoryContainer = initialProps => {
2928
+ const {
2929
+ role,
2930
+ title,
2931
+ desc,
2932
+ children,
2933
+ className,
2934
+ portalZIndex,
2935
+ portalComponent,
2936
+ width,
2937
+ height,
2938
+ style,
2939
+ tabIndex,
2940
+ responsive,
2941
+ events,
2942
+ ouiaId,
2943
+ ouiaSafe,
2944
+ ouiaType,
2945
+ dimensions,
2946
+ ariaDescribedBy,
2947
+ ariaLabelledBy,
2948
+ viewBox,
2949
+ preserveAspectRatio,
2950
+ userProps,
2951
+ titleId,
2952
+ descId,
2953
+ containerRef,
2954
+ localContainerRef
2955
+ } = useVictoryContainer(initialProps);
2956
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
2957
+ if (!events?.onWheel) return;
2958
+ const handleWheel = e => e.preventDefault();
2959
+ const container = localContainerRef?.current;
2960
+ container?.addEventListener("wheel", handleWheel);
2961
+ return () => {
2962
+ container?.removeEventListener("wheel", handleWheel);
2968
2963
  };
2969
- const divStyle = Object.assign({
2964
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2965
+ }, []);
2966
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
2967
+ className: className,
2968
+ style: {
2969
+ ...style,
2970
+ width: responsive ? style?.width : dimensions.width,
2971
+ height: responsive ? style?.height : dimensions.height,
2970
2972
  pointerEvents: "none",
2971
2973
  touchAction: "none",
2972
2974
  position: "relative"
2973
- }, dimensions);
2974
- const portalDivStyle = Object.assign({
2975
+ },
2976
+ "data-ouia-component-id": ouiaId,
2977
+ "data-ouia-component-type": ouiaType,
2978
+ "data-ouia-safe": ouiaSafe,
2979
+ ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_4__.mergeRefs)([localContainerRef, containerRef])
2980
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_5__.PortalProvider, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("svg", _extends({
2981
+ width: width,
2982
+ height: height,
2983
+ tabIndex: tabIndex,
2984
+ role: role,
2985
+ "aria-labelledby": ariaLabelledBy,
2986
+ "aria-describedby": ariaDescribedBy,
2987
+ viewBox: viewBox,
2988
+ preserveAspectRatio: preserveAspectRatio,
2989
+ style: {
2990
+ ...dimensions,
2991
+ pointerEvents: "all"
2992
+ }
2993
+ }, userProps, events), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("title", {
2994
+ id: titleId
2995
+ }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("desc", {
2996
+ id: descId
2997
+ }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
2998
+ style: {
2999
+ ...dimensions,
2975
3000
  zIndex: portalZIndex,
2976
3001
  position: "absolute",
2977
3002
  top: 0,
2978
3003
  left: 0
2979
- }, dimensions);
2980
- const svgStyle = Object.assign({
2981
- pointerEvents: "all"
2982
- }, dimensions);
2983
- const portalSvgStyle = Object.assign({
3004
+ }
3005
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__.PortalOutlet, {
3006
+ as: portalComponent,
3007
+ width: width,
3008
+ height: height,
3009
+ viewBox: viewBox,
3010
+ preserveAspectRatio: preserveAspectRatio,
3011
+ style: {
3012
+ ...dimensions,
2984
3013
  overflow: "visible"
2985
- }, dimensions);
2986
- const portalProps = {
2987
- width,
2988
- height,
2989
- viewBox: svgProps.viewBox,
2990
- preserveAspectRatio: svgProps.preserveAspectRatio,
2991
- style: portalSvgStyle
2992
- };
2993
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_7__.PortalContext.Provider, {
2994
- value: {
2995
- portalUpdate: this.portalUpdate,
2996
- portalRegister: this.portalRegister,
2997
- portalDeregister: this.portalDeregister
2998
- }
2999
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", _extends({
3000
- style: lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, style, divStyle),
3001
- className: className,
3002
- ref: this.saveContainerRef
3003
- }, this.getOUIAProps(props)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("svg", _extends({}, svgProps, {
3004
- style: svgStyle
3005
- }), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("title", {
3006
- id: this.getIdForElement("title")
3007
- }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("desc", {
3008
- id: this.getIdForElement("desc")
3009
- }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", {
3010
- style: portalDivStyle
3011
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().cloneElement(portalComponent, {
3012
- ...portalProps,
3013
- ref: this.savePortalRef
3014
- }))));
3015
- }
3016
- render() {
3017
- const {
3018
- width,
3019
- height,
3020
- responsive,
3021
- events,
3022
- title,
3023
- desc,
3024
- tabIndex,
3025
- preserveAspectRatio,
3026
- role
3027
- } = this.props;
3028
- const style = responsive ? this.props.style : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.omit(this.props.style, ["height", "width"]);
3029
- const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__.getSafeUserProps(this.props);
3030
- const svgProps = Object.assign({
3031
- width,
3032
- height,
3033
- tabIndex,
3034
- role,
3035
- "aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
3036
- "aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
3037
- viewBox: responsive ? `0 0 ${width} ${height}` : undefined,
3038
- preserveAspectRatio: responsive ? preserveAspectRatio : undefined,
3039
- ...userProps
3040
- }, events);
3041
- return this.renderContainer(this.props, svgProps, style);
3042
- }
3043
- }
3014
+ }
3015
+ }))));
3016
+ };
3017
+ VictoryContainer.role = "container";
3044
3018
 
3045
3019
  /***/ }),
3046
3020
 
@@ -3053,17 +3027,78 @@ class VictoryContainer extends (react__WEBPACK_IMPORTED_MODULE_3___default().Com
3053
3027
  "use strict";
3054
3028
  __webpack_require__.r(__webpack_exports__);
3055
3029
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3056
- /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; }
3030
+ /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; },
3031
+ /* harmony export */ "PortalProvider": function() { return /* binding */ PortalProvider; },
3032
+ /* harmony export */ "usePortalContext": function() { return /* binding */ usePortalContext; }
3057
3033
  /* harmony export */ });
3058
3034
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
3059
3035
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
3060
3036
 
3061
- /**
3062
- * The React context object consumers may use to access the context of the
3063
- * portal.
3064
- */
3065
- const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({});
3037
+ const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined);
3066
3038
  PortalContext.displayName = "PortalContext";
3039
+ const usePortalContext = () => {
3040
+ const context = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(PortalContext);
3041
+ return context;
3042
+ };
3043
+ const PortalProvider = _ref => {
3044
+ let {
3045
+ children
3046
+ } = _ref;
3047
+ const [portalChildren, setPortalChildren] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(new Map());
3048
+ const addChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((id, element) => {
3049
+ setPortalChildren(prevChildren => {
3050
+ const nextChildren = new Map(prevChildren);
3051
+ nextChildren.set(id, element);
3052
+ return nextChildren;
3053
+ });
3054
+ }, [setPortalChildren]);
3055
+ const removeChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(id => {
3056
+ setPortalChildren(prevChildren => {
3057
+ const nextChildren = new Map(prevChildren);
3058
+ nextChildren.delete(id);
3059
+ return nextChildren;
3060
+ });
3061
+ }, [setPortalChildren]);
3062
+ const contextValue = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => ({
3063
+ addChild,
3064
+ removeChild,
3065
+ children: portalChildren
3066
+ }), [addChild, removeChild, portalChildren]);
3067
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PortalContext.Provider, {
3068
+ value: contextValue
3069
+ }, children);
3070
+ };
3071
+
3072
+ /***/ }),
3073
+
3074
+ /***/ "../../victory-core/es/victory-portal/portal-outlet.js":
3075
+ /*!*************************************************************!*\
3076
+ !*** ../../victory-core/es/victory-portal/portal-outlet.js ***!
3077
+ \*************************************************************/
3078
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
3079
+
3080
+ "use strict";
3081
+ __webpack_require__.r(__webpack_exports__);
3082
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3083
+ /* harmony export */ "PortalOutlet": function() { return /* binding */ PortalOutlet; }
3084
+ /* harmony export */ });
3085
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
3086
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
3087
+ /* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
3088
+
3089
+
3090
+ const PortalOutlet = _ref => {
3091
+ let {
3092
+ as: portalComponent,
3093
+ ...props
3094
+ } = _ref;
3095
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_1__.usePortalContext)();
3096
+ if (!portalContext) {
3097
+ return null;
3098
+ }
3099
+ const children = Array.from(portalContext.children.values());
3100
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(portalComponent, props, children);
3101
+ };
3067
3102
 
3068
3103
  /***/ }),
3069
3104
 
@@ -3080,39 +3115,13 @@ __webpack_require__.r(__webpack_exports__);
3080
3115
  /* harmony export */ });
3081
3116
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
3082
3117
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
3118
+ 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); }
3083
3119
 
3084
- class Portal extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) {
3085
- static displayName = "Portal";
3086
- constructor(props) {
3087
- super(props);
3088
- this.map = {};
3089
- this.index = 1;
3090
- }
3091
- portalRegister = () => {
3092
- return ++this.index;
3093
- };
3094
- portalUpdate = (key, element) => {
3095
- this.map[key] = element;
3096
- this.forceUpdate();
3097
- };
3098
- portalDeregister = key => {
3099
- delete this.map[key];
3100
- this.forceUpdate();
3101
- };
3102
- getChildren() {
3103
- return Object.keys(this.map).map(key => {
3104
- const el = this.map[key];
3105
- return el ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(el, {
3106
- key
3107
- }) : el;
3108
- });
3109
- }
3110
-
3111
- // Overridden in victory-core-native
3112
- render() {
3113
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", this.props, this.getChildren());
3114
- }
3115
- }
3120
+ const Portal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef((props, ref) => {
3121
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
3122
+ ref: ref
3123
+ }, props));
3124
+ });
3116
3125
 
3117
3126
  /***/ }),
3118
3127
 
@@ -3673,6 +3682,44 @@ function isHorizontal(props) {
3673
3682
 
3674
3683
  /***/ }),
3675
3684
 
3685
+ /***/ "../../victory-core/es/victory-util/merge-refs.js":
3686
+ /*!********************************************************!*\
3687
+ !*** ../../victory-core/es/victory-util/merge-refs.js ***!
3688
+ \********************************************************/
3689
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
3690
+
3691
+ "use strict";
3692
+ __webpack_require__.r(__webpack_exports__);
3693
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3694
+ /* harmony export */ "mergeRefs": function() { return /* binding */ mergeRefs; }
3695
+ /* harmony export */ });
3696
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
3697
+
3698
+ /**
3699
+ * Used to merge multiple React refs into a single callback ref.
3700
+ *
3701
+ * @example
3702
+ * ```tsx
3703
+ * <div ref={mergeRefs([ref, forwardedRef])} />
3704
+ * ```
3705
+ */
3706
+ function mergeRefs(refs) {
3707
+ return value => {
3708
+ refs.forEach(ref => {
3709
+ // If the ref is a function, it's a callback ref and we call it with the value.
3710
+ if (_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction(ref)) {
3711
+ ref(value);
3712
+ } else if (ref !== null && ref !== undefined) {
3713
+ // If the ref is an object (not null and not undefined), it's an object ref.
3714
+ // We assign the value to its 'current' property.
3715
+ ref.current = value;
3716
+ }
3717
+ });
3718
+ };
3719
+ }
3720
+
3721
+ /***/ }),
3722
+
3676
3723
  /***/ "../../victory-core/es/victory-util/selection.js":
3677
3724
  /*!*******************************************************!*\
3678
3725
  !*** ../../victory-core/es/victory-util/selection.js ***!
@@ -3804,98 +3851,6 @@ function getBounds(props) {
3804
3851
 
3805
3852
  /***/ }),
3806
3853
 
3807
- /***/ "../../victory-core/es/victory-util/timer-context.js":
3808
- /*!***********************************************************!*\
3809
- !*** ../../victory-core/es/victory-util/timer-context.js ***!
3810
- \***********************************************************/
3811
- /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
3812
-
3813
- "use strict";
3814
- __webpack_require__.r(__webpack_exports__);
3815
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
3816
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
3817
- /* harmony import */ var _timer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./timer */ "../../victory-core/es/victory-util/timer.js");
3818
-
3819
-
3820
-
3821
- /**
3822
- * The React context object consumers may use to access or override the global
3823
- * timer.
3824
- */
3825
- const TimerContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({
3826
- transitionTimer: new _timer__WEBPACK_IMPORTED_MODULE_1__["default"](),
3827
- animationTimer: new _timer__WEBPACK_IMPORTED_MODULE_1__["default"]()
3828
- });
3829
- TimerContext.displayName = "TimerContext";
3830
- /* harmony default export */ __webpack_exports__["default"] = (TimerContext);
3831
-
3832
- /***/ }),
3833
-
3834
- /***/ "../../victory-core/es/victory-util/timer.js":
3835
- /*!***************************************************!*\
3836
- !*** ../../victory-core/es/victory-util/timer.js ***!
3837
- \***************************************************/
3838
- /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
3839
-
3840
- "use strict";
3841
- __webpack_require__.r(__webpack_exports__);
3842
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3843
- /* harmony export */ "default": function() { return /* binding */ Timer; }
3844
- /* harmony export */ });
3845
- /* harmony import */ var victory_vendor_d3_timer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! victory-vendor/d3-timer */ "../../victory-vendor/es/d3-timer.js");
3846
-
3847
- class Timer {
3848
- constructor() {
3849
- this.shouldAnimate = true;
3850
- this.subscribers = [];
3851
- this.timer = null;
3852
- this.activeSubscriptions = 0;
3853
- }
3854
- bypassAnimation() {
3855
- this.shouldAnimate = false;
3856
- }
3857
- resumeAnimation() {
3858
- this.shouldAnimate = true;
3859
- }
3860
- loop = () => {
3861
- this.subscribers.forEach(s => {
3862
- s.callback((0,victory_vendor_d3_timer__WEBPACK_IMPORTED_MODULE_0__.now)() - s.startTime, s.duration);
3863
- });
3864
- };
3865
- start() {
3866
- if (!this.timer) {
3867
- this.timer = (0,victory_vendor_d3_timer__WEBPACK_IMPORTED_MODULE_0__.timer)(this.loop);
3868
- }
3869
- }
3870
- stop() {
3871
- if (this.timer) {
3872
- this.timer.stop();
3873
- this.timer = null;
3874
- }
3875
- }
3876
- subscribe(callback, duration) {
3877
- const subscriptionID = this.subscribers.push({
3878
- startTime: (0,victory_vendor_d3_timer__WEBPACK_IMPORTED_MODULE_0__.now)(),
3879
- callback,
3880
- duration: this.shouldAnimate ? duration : 0
3881
- });
3882
- this.activeSubscriptions++;
3883
- this.start();
3884
- return subscriptionID;
3885
- }
3886
- unsubscribe(id) {
3887
- if (id !== null && this.subscribers[id - 1]) {
3888
- delete this.subscribers[id - 1];
3889
- this.activeSubscriptions--;
3890
- }
3891
- if (this.activeSubscriptions === 0) {
3892
- this.stop();
3893
- }
3894
- }
3895
- }
3896
-
3897
- /***/ }),
3898
-
3899
3854
  /***/ "../../victory-core/es/victory-util/user-props.js":
3900
3855
  /*!********************************************************!*\
3901
3856
  !*** ../../victory-core/es/victory-util/user-props.js ***!
@@ -4010,32 +3965,6 @@ const withSafeUserProps = (component, props) => {
4010
3965
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.cloneElement(component, getSafeUserProps(props));
4011
3966
  };
4012
3967
 
4013
- /***/ }),
4014
-
4015
- /***/ "../../victory-vendor/es/d3-timer.js":
4016
- /*!*******************************************!*\
4017
- !*** ../../victory-vendor/es/d3-timer.js ***!
4018
- \*******************************************/
4019
- /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
4020
-
4021
- "use strict";
4022
- __webpack_require__.r(__webpack_exports__);
4023
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4024
- /* harmony export */ "interval": function() { return /* reexport safe */ d3_timer__WEBPACK_IMPORTED_MODULE_0__.interval; },
4025
- /* harmony export */ "now": function() { return /* reexport safe */ d3_timer__WEBPACK_IMPORTED_MODULE_0__.now; },
4026
- /* harmony export */ "timeout": function() { return /* reexport safe */ d3_timer__WEBPACK_IMPORTED_MODULE_0__.timeout; },
4027
- /* harmony export */ "timer": function() { return /* reexport safe */ d3_timer__WEBPACK_IMPORTED_MODULE_0__.timer; },
4028
- /* harmony export */ "timerFlush": function() { return /* reexport safe */ d3_timer__WEBPACK_IMPORTED_MODULE_0__.timerFlush; }
4029
- /* harmony export */ });
4030
- /* 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");
4031
-
4032
- // `victory-vendor/d3-timer` (ESM)
4033
- // See upstream license: https://github.com/d3/d3-timer/blob/main/LICENSE
4034
- //
4035
- // Our ESM package uses the underlying installed dependencies of `node_modules/d3-timer`
4036
-
4037
-
4038
-
4039
3968
  /***/ }),
4040
3969
 
4041
3970
  /***/ "react":
@@ -4047,221 +3976,6 @@ __webpack_require__.r(__webpack_exports__);
4047
3976
  "use strict";
4048
3977
  module.exports = __WEBPACK_EXTERNAL_MODULE_react__;
4049
3978
 
4050
- /***/ }),
4051
-
4052
- /***/ "../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/index.js":
4053
- /*!*************************************************************************************!*\
4054
- !*** ../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/index.js ***!
4055
- \*************************************************************************************/
4056
- /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
4057
-
4058
- "use strict";
4059
- __webpack_require__.r(__webpack_exports__);
4060
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4061
- /* harmony export */ "interval": function() { return /* reexport safe */ _interval_js__WEBPACK_IMPORTED_MODULE_2__["default"]; },
4062
- /* harmony export */ "now": function() { return /* reexport safe */ _timer_js__WEBPACK_IMPORTED_MODULE_0__.now; },
4063
- /* harmony export */ "timeout": function() { return /* reexport safe */ _timeout_js__WEBPACK_IMPORTED_MODULE_1__["default"]; },
4064
- /* harmony export */ "timer": function() { return /* reexport safe */ _timer_js__WEBPACK_IMPORTED_MODULE_0__.timer; },
4065
- /* harmony export */ "timerFlush": function() { return /* reexport safe */ _timer_js__WEBPACK_IMPORTED_MODULE_0__.timerFlush; }
4066
- /* harmony export */ });
4067
- /* 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");
4068
- /* 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");
4069
- /* 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");
4070
-
4071
-
4072
-
4073
-
4074
-
4075
-
4076
-
4077
- /***/ }),
4078
-
4079
- /***/ "../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/interval.js":
4080
- /*!****************************************************************************************!*\
4081
- !*** ../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/interval.js ***!
4082
- \****************************************************************************************/
4083
- /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
4084
-
4085
- "use strict";
4086
- __webpack_require__.r(__webpack_exports__);
4087
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4088
- /* harmony export */ "default": function() { return /* export default binding */ __WEBPACK_DEFAULT_EXPORT__; }
4089
- /* harmony export */ });
4090
- /* 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");
4091
-
4092
-
4093
- /* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(callback, delay, time) {
4094
- var t = new _timer_js__WEBPACK_IMPORTED_MODULE_0__.Timer, total = delay;
4095
- if (delay == null) return t.restart(callback, delay, time), t;
4096
- t._restart = t.restart;
4097
- t.restart = function(callback, delay, time) {
4098
- delay = +delay, time = time == null ? (0,_timer_js__WEBPACK_IMPORTED_MODULE_0__.now)() : +time;
4099
- t._restart(function tick(elapsed) {
4100
- elapsed += total;
4101
- t._restart(tick, total += delay, time);
4102
- callback(elapsed);
4103
- }, delay, time);
4104
- }
4105
- t.restart(callback, delay, time);
4106
- return t;
4107
- }
4108
-
4109
-
4110
- /***/ }),
4111
-
4112
- /***/ "../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timeout.js":
4113
- /*!***************************************************************************************!*\
4114
- !*** ../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timeout.js ***!
4115
- \***************************************************************************************/
4116
- /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
4117
-
4118
- "use strict";
4119
- __webpack_require__.r(__webpack_exports__);
4120
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4121
- /* harmony export */ "default": function() { return /* export default binding */ __WEBPACK_DEFAULT_EXPORT__; }
4122
- /* harmony export */ });
4123
- /* 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");
4124
-
4125
-
4126
- /* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(callback, delay, time) {
4127
- var t = new _timer_js__WEBPACK_IMPORTED_MODULE_0__.Timer;
4128
- delay = delay == null ? 0 : +delay;
4129
- t.restart(elapsed => {
4130
- t.stop();
4131
- callback(elapsed + delay);
4132
- }, delay, time);
4133
- return t;
4134
- }
4135
-
4136
-
4137
- /***/ }),
4138
-
4139
- /***/ "../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js":
4140
- /*!*************************************************************************************!*\
4141
- !*** ../../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js ***!
4142
- \*************************************************************************************/
4143
- /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
4144
-
4145
- "use strict";
4146
- __webpack_require__.r(__webpack_exports__);
4147
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4148
- /* harmony export */ "Timer": function() { return /* binding */ Timer; },
4149
- /* harmony export */ "now": function() { return /* binding */ now; },
4150
- /* harmony export */ "timer": function() { return /* binding */ timer; },
4151
- /* harmony export */ "timerFlush": function() { return /* binding */ timerFlush; }
4152
- /* harmony export */ });
4153
- var frame = 0, // is an animation frame pending?
4154
- timeout = 0, // is a timeout pending?
4155
- interval = 0, // are any timers active?
4156
- pokeDelay = 1000, // how frequently we check for clock skew
4157
- taskHead,
4158
- taskTail,
4159
- clockLast = 0,
4160
- clockNow = 0,
4161
- clockSkew = 0,
4162
- clock = typeof performance === "object" && performance.now ? performance : Date,
4163
- setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };
4164
-
4165
- function now() {
4166
- return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
4167
- }
4168
-
4169
- function clearNow() {
4170
- clockNow = 0;
4171
- }
4172
-
4173
- function Timer() {
4174
- this._call =
4175
- this._time =
4176
- this._next = null;
4177
- }
4178
-
4179
- Timer.prototype = timer.prototype = {
4180
- constructor: Timer,
4181
- restart: function(callback, delay, time) {
4182
- if (typeof callback !== "function") throw new TypeError("callback is not a function");
4183
- time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
4184
- if (!this._next && taskTail !== this) {
4185
- if (taskTail) taskTail._next = this;
4186
- else taskHead = this;
4187
- taskTail = this;
4188
- }
4189
- this._call = callback;
4190
- this._time = time;
4191
- sleep();
4192
- },
4193
- stop: function() {
4194
- if (this._call) {
4195
- this._call = null;
4196
- this._time = Infinity;
4197
- sleep();
4198
- }
4199
- }
4200
- };
4201
-
4202
- function timer(callback, delay, time) {
4203
- var t = new Timer;
4204
- t.restart(callback, delay, time);
4205
- return t;
4206
- }
4207
-
4208
- function timerFlush() {
4209
- now(); // Get the current time, if not already set.
4210
- ++frame; // Pretend we’ve set an alarm, if we haven’t already.
4211
- var t = taskHead, e;
4212
- while (t) {
4213
- if ((e = clockNow - t._time) >= 0) t._call.call(undefined, e);
4214
- t = t._next;
4215
- }
4216
- --frame;
4217
- }
4218
-
4219
- function wake() {
4220
- clockNow = (clockLast = clock.now()) + clockSkew;
4221
- frame = timeout = 0;
4222
- try {
4223
- timerFlush();
4224
- } finally {
4225
- frame = 0;
4226
- nap();
4227
- clockNow = 0;
4228
- }
4229
- }
4230
-
4231
- function poke() {
4232
- var now = clock.now(), delay = now - clockLast;
4233
- if (delay > pokeDelay) clockSkew -= delay, clockLast = now;
4234
- }
4235
-
4236
- function nap() {
4237
- var t0, t1 = taskHead, t2, time = Infinity;
4238
- while (t1) {
4239
- if (t1._call) {
4240
- if (time > t1._time) time = t1._time;
4241
- t0 = t1, t1 = t1._next;
4242
- } else {
4243
- t2 = t1._next, t1._next = null;
4244
- t1 = t0 ? t0._next = t2 : taskHead = t2;
4245
- }
4246
- }
4247
- taskTail = t0;
4248
- sleep(time);
4249
- }
4250
-
4251
- function sleep(time) {
4252
- if (frame) return; // Soonest alarm already set, or will be.
4253
- if (timeout) timeout = clearTimeout(timeout);
4254
- var delay = time - clockNow; // Strictly less than if we recomputed clockNow.
4255
- if (delay > 24) {
4256
- if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);
4257
- if (interval) interval = clearInterval(interval);
4258
- } else {
4259
- if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
4260
- frame = 1, setFrame(wake);
4261
- }
4262
- }
4263
-
4264
-
4265
3979
  /***/ })
4266
3980
 
4267
3981
  /******/ });
@@ -4354,8 +4068,9 @@ var __webpack_exports__ = {};
4354
4068
  __webpack_require__.r(__webpack_exports__);
4355
4069
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4356
4070
  /* harmony export */ "BrushHelpers": function() { return /* reexport safe */ _brush_helpers__WEBPACK_IMPORTED_MODULE_1__.BrushHelpers; },
4071
+ /* harmony export */ "VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS": function() { return /* reexport safe */ _victory_brush_container__WEBPACK_IMPORTED_MODULE_0__.VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS; },
4357
4072
  /* harmony export */ "VictoryBrushContainer": function() { return /* reexport safe */ _victory_brush_container__WEBPACK_IMPORTED_MODULE_0__.VictoryBrushContainer; },
4358
- /* harmony export */ "brushContainerMixin": function() { return /* reexport safe */ _victory_brush_container__WEBPACK_IMPORTED_MODULE_0__.brushContainerMixin; }
4073
+ /* harmony export */ "useVictoryBrushContainer": function() { return /* reexport safe */ _victory_brush_container__WEBPACK_IMPORTED_MODULE_0__.useVictoryBrushContainer; }
4359
4074
  /* harmony export */ });
4360
4075
  /* harmony import */ var _victory_brush_container__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./victory-brush-container */ "./victory-brush-container.tsx");
4361
4076
  /* harmony import */ var _brush_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./brush-helpers */ "./brush-helpers.ts");