victory-box-plot 37.0.2 → 37.0.3-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # victory-box-plot
2
2
 
3
+ ## 37.0.3-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [65d02419f]
8
+ - victory-core@37.0.3-next.0
9
+ - victory-vendor@37.0.3-next.0
10
+
3
11
  ## 37.0.2
4
12
 
5
13
  ## 37.0.1
@@ -5672,23 +5672,18 @@ const VictoryAnimation = _ref => {
5672
5672
  "use strict";
5673
5673
  __webpack_require__.r(__webpack_exports__);
5674
5674
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5675
- /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; }
5675
+ /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
5676
+ /* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
5676
5677
  /* harmony export */ });
5677
- /* 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");
5678
- /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_isObject__WEBPACK_IMPORTED_MODULE_0__);
5679
- /* 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");
5680
- /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1__);
5681
- /* 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");
5682
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_2__);
5683
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "react");
5684
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
5685
- /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
5686
- /* 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");
5687
- /* 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");
5688
- /* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
5689
- /* 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");
5690
-
5691
-
5678
+ /* 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");
5679
+ /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
5680
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
5681
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
5682
+ /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
5683
+ /* 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");
5684
+ /* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
5685
+ /* 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");
5686
+ /* 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");
5692
5687
 
5693
5688
  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); }
5694
5689
 
@@ -5697,175 +5692,149 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
5697
5692
 
5698
5693
 
5699
5694
 
5700
- class VictoryContainer extends (react__WEBPACK_IMPORTED_MODULE_3___default().Component) {
5701
- static displayName = "VictoryContainer";
5702
- static role = "container";
5703
- static defaultProps = {
5704
- className: "VictoryContainer",
5705
- portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__.Portal, null),
5706
- portalZIndex: 99,
5707
- responsive: true,
5708
- role: "img"
5695
+ const defaultProps = {
5696
+ className: "VictoryContainer",
5697
+ portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__.Portal, null),
5698
+ portalZIndex: 99,
5699
+ responsive: true,
5700
+ role: "img"
5701
+ };
5702
+ function useVictoryContainer(initialProps) {
5703
+ const props = {
5704
+ ...defaultProps,
5705
+ ...initialProps
5709
5706
  };
5710
- static contextType = _victory_util_timer_context__WEBPACK_IMPORTED_MODULE_5__["default"];
5711
-
5712
- // @ts-expect-error Ref will be initialized on mount
5713
-
5714
- // @ts-expect-error Ref will be initialized on mount
5715
-
5716
- constructor(props) {
5717
- super(props);
5718
- this.containerId = !lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default()(props) || props.containerId === undefined ? lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default()("victory-container-") : props.containerId;
5719
- this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
5720
- }
5721
- savePortalRef = portal => {
5722
- this.portalRef = portal;
5723
- return portal;
5707
+ const {
5708
+ title,
5709
+ desc,
5710
+ width,
5711
+ height,
5712
+ responsive
5713
+ } = props;
5714
+ const localContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
5715
+
5716
+ // Generated ID stored in ref because it needs to persist across renders
5717
+ const generatedId = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()("victory-container-"));
5718
+ const containerId = props.containerId ?? generatedId.current;
5719
+ const getIdForElement = elName => `${containerId}-${elName}`;
5720
+ const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
5721
+ const dimensions = responsive ? {
5722
+ width: "100%",
5723
+ height: "100%"
5724
+ } : {
5725
+ width,
5726
+ height
5724
5727
  };
5725
- portalUpdate = (key, el) => this.portalRef.portalUpdate(key, el);
5726
- portalRegister = () => this.portalRef.portalRegister();
5727
- portalDeregister = key => this.portalRef.portalDeregister(key);
5728
- saveContainerRef = container => {
5729
- if (_victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(this.props.containerRef)) {
5730
- this.props.containerRef(container);
5731
- }
5732
- this.containerRef = container;
5733
- return container;
5728
+ const viewBox = responsive ? `0 0 ${width} ${height}` : undefined;
5729
+ const preserveAspectRatio = responsive ? props.preserveAspectRatio : undefined;
5730
+ const ariaLabelledBy = [title && getIdForElement("title"), props["aria-labelledby"]].filter(Boolean).join(" ") || undefined;
5731
+ const ariaDescribedBy = [desc && getIdForElement("desc"), props["aria-describedby"]].filter(Boolean).join(" ") || undefined;
5732
+ const titleId = getIdForElement("title");
5733
+ const descId = getIdForElement("desc");
5734
+ return {
5735
+ ...props,
5736
+ titleId,
5737
+ descId,
5738
+ dimensions,
5739
+ viewBox,
5740
+ preserveAspectRatio,
5741
+ ariaLabelledBy,
5742
+ ariaDescribedBy,
5743
+ userProps,
5744
+ localContainerRef
5734
5745
  };
5735
- handleWheel = e => e.preventDefault();
5736
- componentDidMount() {
5737
- if (this.shouldHandleWheel && this.containerRef) {
5738
- this.containerRef.addEventListener("wheel", this.handleWheel);
5739
- }
5740
- }
5741
- componentWillUnmount() {
5742
- if (this.shouldHandleWheel && this.containerRef) {
5743
- this.containerRef.removeEventListener("wheel", this.handleWheel);
5744
- }
5745
- }
5746
- getIdForElement(elementName) {
5747
- return `${this.containerId}-${elementName}`;
5748
- }
5749
-
5750
- // overridden in custom containers
5751
- getChildren(props) {
5752
- return props.children;
5753
- }
5754
-
5755
- // Get props defined by the Open UI Automation (OUIA) 1.0-RC spec
5756
- // See https://ouia.readthedocs.io/en/latest/README.html#ouia-component
5757
- getOUIAProps(props) {
5758
- const {
5759
- ouiaId,
5760
- ouiaSafe,
5761
- ouiaType
5762
- } = props;
5763
- return {
5764
- ...(ouiaId && {
5765
- "data-ouia-component-id": ouiaId
5766
- }),
5767
- ...(ouiaType && {
5768
- "data-ouia-component-type": ouiaType
5769
- }),
5770
- ...(ouiaSafe !== undefined && {
5771
- "data-ouia-safe": ouiaSafe
5772
- })
5773
- };
5774
- }
5775
- renderContainer(props, svgProps, style) {
5776
- const {
5777
- title,
5778
- desc,
5779
- portalComponent,
5780
- className,
5781
- width,
5782
- height,
5783
- portalZIndex,
5784
- responsive
5785
- } = props;
5786
- const children = this.getChildren(props);
5787
- const dimensions = responsive ? {
5788
- width: "100%",
5789
- height: "100%"
5790
- } : {
5791
- width,
5792
- height
5746
+ }
5747
+ const VictoryContainer = initialProps => {
5748
+ const {
5749
+ role,
5750
+ title,
5751
+ desc,
5752
+ children,
5753
+ className,
5754
+ portalZIndex,
5755
+ portalComponent,
5756
+ width,
5757
+ height,
5758
+ style,
5759
+ tabIndex,
5760
+ responsive,
5761
+ events,
5762
+ ouiaId,
5763
+ ouiaSafe,
5764
+ ouiaType,
5765
+ dimensions,
5766
+ ariaDescribedBy,
5767
+ ariaLabelledBy,
5768
+ viewBox,
5769
+ preserveAspectRatio,
5770
+ userProps,
5771
+ titleId,
5772
+ descId,
5773
+ containerRef,
5774
+ localContainerRef
5775
+ } = useVictoryContainer(initialProps);
5776
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
5777
+ if (!events?.onWheel) return;
5778
+ const handleWheel = e => e.preventDefault();
5779
+ const container = localContainerRef?.current;
5780
+ container?.addEventListener("wheel", handleWheel);
5781
+ return () => {
5782
+ container?.removeEventListener("wheel", handleWheel);
5793
5783
  };
5794
- const divStyle = Object.assign({
5784
+ // eslint-disable-next-line react-hooks/exhaustive-deps
5785
+ }, []);
5786
+ 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", {
5787
+ className: className,
5788
+ style: {
5789
+ ...style,
5790
+ width: responsive ? style?.width : dimensions.width,
5791
+ height: responsive ? style?.height : dimensions.height,
5795
5792
  pointerEvents: "none",
5796
5793
  touchAction: "none",
5797
5794
  position: "relative"
5798
- }, dimensions);
5799
- const portalDivStyle = Object.assign({
5795
+ },
5796
+ "data-ouia-component-id": ouiaId,
5797
+ "data-ouia-component-type": ouiaType,
5798
+ "data-ouia-safe": ouiaSafe,
5799
+ ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_5__.mergeRefs)([localContainerRef, containerRef])
5800
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("svg", _extends({
5801
+ width: width,
5802
+ height: height,
5803
+ tabIndex: tabIndex,
5804
+ role: role,
5805
+ "aria-labelledby": ariaLabelledBy,
5806
+ "aria-describedby": ariaDescribedBy,
5807
+ viewBox: viewBox,
5808
+ preserveAspectRatio: preserveAspectRatio,
5809
+ style: {
5810
+ ...dimensions,
5811
+ pointerEvents: "all"
5812
+ }
5813
+ }, userProps, events), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("title", {
5814
+ id: titleId
5815
+ }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("desc", {
5816
+ id: descId
5817
+ }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
5818
+ style: {
5819
+ ...dimensions,
5800
5820
  zIndex: portalZIndex,
5801
5821
  position: "absolute",
5802
5822
  top: 0,
5803
5823
  left: 0
5804
- }, dimensions);
5805
- const svgStyle = Object.assign({
5806
- pointerEvents: "all"
5807
- }, dimensions);
5808
- const portalSvgStyle = Object.assign({
5824
+ }
5825
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__.PortalOutlet, {
5826
+ as: portalComponent,
5827
+ width: width,
5828
+ height: height,
5829
+ viewBox: viewBox,
5830
+ preserveAspectRatio: preserveAspectRatio,
5831
+ style: {
5832
+ ...dimensions,
5809
5833
  overflow: "visible"
5810
- }, dimensions);
5811
- const portalProps = {
5812
- width,
5813
- height,
5814
- viewBox: svgProps.viewBox,
5815
- preserveAspectRatio: svgProps.preserveAspectRatio,
5816
- style: portalSvgStyle
5817
- };
5818
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_7__.PortalContext.Provider, {
5819
- value: {
5820
- portalUpdate: this.portalUpdate,
5821
- portalRegister: this.portalRegister,
5822
- portalDeregister: this.portalDeregister
5823
- }
5824
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", _extends({
5825
- style: lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, style, divStyle),
5826
- className: className,
5827
- ref: this.saveContainerRef
5828
- }, this.getOUIAProps(props)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("svg", _extends({}, svgProps, {
5829
- style: svgStyle
5830
- }), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("title", {
5831
- id: this.getIdForElement("title")
5832
- }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("desc", {
5833
- id: this.getIdForElement("desc")
5834
- }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", {
5835
- style: portalDivStyle
5836
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().cloneElement(portalComponent, {
5837
- ...portalProps,
5838
- ref: this.savePortalRef
5839
- }))));
5840
- }
5841
- render() {
5842
- const {
5843
- width,
5844
- height,
5845
- responsive,
5846
- events,
5847
- title,
5848
- desc,
5849
- tabIndex,
5850
- preserveAspectRatio,
5851
- role
5852
- } = this.props;
5853
- const style = responsive ? this.props.style : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.omit(this.props.style, ["height", "width"]);
5854
- const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__.getSafeUserProps(this.props);
5855
- const svgProps = Object.assign({
5856
- width,
5857
- height,
5858
- tabIndex,
5859
- role,
5860
- "aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
5861
- "aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
5862
- viewBox: responsive ? `0 0 ${width} ${height}` : undefined,
5863
- preserveAspectRatio: responsive ? preserveAspectRatio : undefined,
5864
- ...userProps
5865
- }, events);
5866
- return this.renderContainer(this.props, svgProps, style);
5867
- }
5868
- }
5834
+ }
5835
+ }))));
5836
+ };
5837
+ VictoryContainer.role = "container";
5869
5838
 
5870
5839
  /***/ }),
5871
5840
 
@@ -6378,17 +6347,83 @@ VictoryLabel.defaultStyles = defaultStyles;
6378
6347
  "use strict";
6379
6348
  __webpack_require__.r(__webpack_exports__);
6380
6349
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6381
- /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; }
6350
+ /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; },
6351
+ /* harmony export */ "PortalProvider": function() { return /* binding */ PortalProvider; },
6352
+ /* harmony export */ "usePortalContext": function() { return /* binding */ usePortalContext; }
6382
6353
  /* harmony export */ });
6383
6354
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
6384
6355
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6385
6356
 
6386
- /**
6387
- * The React context object consumers may use to access the context of the
6388
- * portal.
6389
- */
6390
- const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({});
6357
+ const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined);
6391
6358
  PortalContext.displayName = "PortalContext";
6359
+ const usePortalContext = () => {
6360
+ const context = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(PortalContext);
6361
+ if (!context) {
6362
+ throw new Error("`usePortalContext` must be used within a `<PortalProvider />`");
6363
+ }
6364
+ return context;
6365
+ };
6366
+ const PortalProvider = _ref => {
6367
+ let {
6368
+ children
6369
+ } = _ref;
6370
+ const [portalChildren, setPortalChildren] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(new Map());
6371
+ const addChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((id, element) => {
6372
+ setPortalChildren(prevChildren => {
6373
+ const nextChildren = new Map(prevChildren);
6374
+ nextChildren.set(id, element);
6375
+ return nextChildren;
6376
+ });
6377
+ }, [setPortalChildren]);
6378
+ const removeChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(id => {
6379
+ setPortalChildren(prevChildren => {
6380
+ const nextChildren = new Map(prevChildren);
6381
+ nextChildren.delete(id);
6382
+ return nextChildren;
6383
+ });
6384
+ }, [setPortalChildren]);
6385
+ const contextValue = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => ({
6386
+ addChild,
6387
+ removeChild,
6388
+ children: portalChildren
6389
+ }), [addChild, removeChild, portalChildren]);
6390
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PortalContext.Provider, {
6391
+ value: contextValue
6392
+ }, children);
6393
+ };
6394
+
6395
+ /***/ }),
6396
+
6397
+ /***/ "../../victory-core/es/victory-portal/portal-outlet.js":
6398
+ /*!*************************************************************!*\
6399
+ !*** ../../victory-core/es/victory-portal/portal-outlet.js ***!
6400
+ \*************************************************************/
6401
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
6402
+
6403
+ "use strict";
6404
+ __webpack_require__.r(__webpack_exports__);
6405
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6406
+ /* harmony export */ "PortalOutlet": function() { return /* binding */ PortalOutlet; }
6407
+ /* harmony export */ });
6408
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
6409
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6410
+ /* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
6411
+
6412
+
6413
+ const PortalOutlet = _ref => {
6414
+ let {
6415
+ as: portalComponent,
6416
+ ...props
6417
+ } = _ref;
6418
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_1__.usePortalContext)();
6419
+ const children = Array.from(portalContext.children.entries()).map(_ref2 => {
6420
+ let [key, node] = _ref2;
6421
+ return !node.key ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(node, {
6422
+ key
6423
+ }) : node;
6424
+ });
6425
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(portalComponent, props, children);
6426
+ };
6392
6427
 
6393
6428
  /***/ }),
6394
6429
 
@@ -6405,39 +6440,13 @@ __webpack_require__.r(__webpack_exports__);
6405
6440
  /* harmony export */ });
6406
6441
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
6407
6442
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6443
+ 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); }
6408
6444
 
6409
- class Portal extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) {
6410
- static displayName = "Portal";
6411
- constructor(props) {
6412
- super(props);
6413
- this.map = {};
6414
- this.index = 1;
6415
- }
6416
- portalRegister = () => {
6417
- return ++this.index;
6418
- };
6419
- portalUpdate = (key, element) => {
6420
- this.map[key] = element;
6421
- this.forceUpdate();
6422
- };
6423
- portalDeregister = key => {
6424
- delete this.map[key];
6425
- this.forceUpdate();
6426
- };
6427
- getChildren() {
6428
- return Object.keys(this.map).map(key => {
6429
- const el = this.map[key];
6430
- return el ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(el, {
6431
- key
6432
- }) : el;
6433
- });
6434
- }
6435
-
6436
- // Overridden in victory-core-native
6437
- render() {
6438
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", this.props, this.getChildren());
6439
- }
6440
- }
6445
+ const Portal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef((props, ref) => {
6446
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
6447
+ ref: ref
6448
+ }, props));
6449
+ });
6441
6450
 
6442
6451
  /***/ }),
6443
6452
 
@@ -6464,59 +6473,42 @@ __webpack_require__.r(__webpack_exports__);
6464
6473
 
6465
6474
 
6466
6475
 
6467
- class VictoryPortal extends (react__WEBPACK_IMPORTED_MODULE_1___default().Component) {
6468
- static displayName = "VictoryPortal";
6469
- static role = "portal";
6470
- static defaultProps = {
6471
- groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
6476
+ const defaultProps = {
6477
+ groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
6478
+ };
6479
+ const VictoryPortal = initialProps => {
6480
+ const props = {
6481
+ ...defaultProps,
6482
+ ...initialProps
6472
6483
  };
6473
- static contextType = _portal_context__WEBPACK_IMPORTED_MODULE_2__.PortalContext;
6474
- componentDidMount() {
6475
- if (!this.checkedContext) {
6476
- if (typeof this.context.portalUpdate !== "function") {
6477
- const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
6478
- _victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
6479
- this.renderInPlace = true;
6480
- }
6481
- this.checkedContext = true;
6482
- }
6483
- this.forceUpdate();
6484
- }
6485
- componentDidUpdate() {
6486
- if (!this.renderInPlace) {
6487
- this.portalKey = this.portalKey || this.context.portalRegister();
6488
- this.context.portalUpdate(this.portalKey, this.element);
6489
- }
6490
- }
6491
- componentWillUnmount() {
6492
- if (this.context && this.context.portalDeregister) {
6493
- this.context.portalDeregister(this.portalKey);
6494
- }
6495
- }
6496
-
6497
- // Overridden in victory-core-native
6498
- renderPortal(child) {
6499
- if (this.renderInPlace) {
6500
- return child;
6501
- }
6502
- this.element = child;
6503
- return null;
6504
- }
6505
- render() {
6506
- const children = Array.isArray(this.props.children) ? this.props.children[0] : this.props.children;
6484
+ const id = react__WEBPACK_IMPORTED_MODULE_1___default().useId();
6485
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_2__.usePortalContext)();
6486
+ if (!portalContext) {
6487
+ const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
6488
+ _victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
6489
+ }
6490
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
6491
+ const children = Array.isArray(props.children) ? props.children[0] : props.children;
6507
6492
  const {
6508
6493
  groupComponent
6509
- } = this.props;
6494
+ } = props;
6510
6495
  const childProps = children && children.props || {};
6511
6496
  const standardProps = childProps.groupComponent ? {
6512
6497
  groupComponent,
6513
6498
  standalone: false
6514
6499
  } : {};
6515
- const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(this.props, ["children", "groupComponent"]));
6500
+ const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(props, ["children", "groupComponent"]));
6516
6501
  const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
6517
- return this.renderPortal(child);
6518
- }
6519
- }
6502
+ portalContext.addChild(id, child);
6503
+ // eslint-disable-next-line react-hooks/exhaustive-deps
6504
+ }, [props.children]);
6505
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
6506
+ return () => portalContext.removeChild(id);
6507
+ // eslint-disable-next-line react-hooks/exhaustive-deps
6508
+ }, []);
6509
+ return null;
6510
+ };
6511
+ VictoryPortal.role = "portal";
6520
6512
 
6521
6513
  /***/ }),
6522
6514
 
@@ -10208,6 +10200,44 @@ function warn(message) {
10208
10200
 
10209
10201
  /***/ }),
10210
10202
 
10203
+ /***/ "../../victory-core/es/victory-util/merge-refs.js":
10204
+ /*!********************************************************!*\
10205
+ !*** ../../victory-core/es/victory-util/merge-refs.js ***!
10206
+ \********************************************************/
10207
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
10208
+
10209
+ "use strict";
10210
+ __webpack_require__.r(__webpack_exports__);
10211
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10212
+ /* harmony export */ "mergeRefs": function() { return /* binding */ mergeRefs; }
10213
+ /* harmony export */ });
10214
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
10215
+
10216
+ /**
10217
+ * Used to merge multiple React refs into a single callback ref.
10218
+ *
10219
+ * @example
10220
+ * ```tsx
10221
+ * <div ref={mergeRefs([ref, forwardedRef])} />
10222
+ * ```
10223
+ */
10224
+ function mergeRefs(refs) {
10225
+ return value => {
10226
+ refs.forEach(ref => {
10227
+ // If the ref is a function, it's a callback ref and we call it with the value.
10228
+ if (_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction(ref)) {
10229
+ ref(value);
10230
+ } else if (ref !== null && ref !== undefined) {
10231
+ // If the ref is an object (not null and not undefined), it's an object ref.
10232
+ // We assign the value to its 'current' property.
10233
+ ref.current = value;
10234
+ }
10235
+ });
10236
+ };
10237
+ }
10238
+
10239
+ /***/ }),
10240
+
10211
10241
  /***/ "../../victory-core/es/victory-util/scale.js":
10212
10242
  /*!***************************************************!*\
10213
10243
  !*** ../../victory-core/es/victory-util/scale.js ***!