victory-bar 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-bar
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
  ### Patch Changes
@@ -5901,23 +5901,18 @@ const VictoryAnimation = _ref => {
5901
5901
  "use strict";
5902
5902
  __webpack_require__.r(__webpack_exports__);
5903
5903
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5904
- /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; }
5904
+ /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
5905
+ /* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
5905
5906
  /* harmony export */ });
5906
- /* 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");
5907
- /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_isObject__WEBPACK_IMPORTED_MODULE_0__);
5908
- /* 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");
5909
- /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1__);
5910
- /* 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");
5911
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_2__);
5912
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "react");
5913
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
5914
- /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
5915
- /* 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");
5916
- /* 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");
5917
- /* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
5918
- /* 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");
5919
-
5920
-
5907
+ /* 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");
5908
+ /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
5909
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
5910
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
5911
+ /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
5912
+ /* 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");
5913
+ /* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
5914
+ /* 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");
5915
+ /* 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");
5921
5916
 
5922
5917
  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); }
5923
5918
 
@@ -5926,175 +5921,149 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
5926
5921
 
5927
5922
 
5928
5923
 
5929
- class VictoryContainer extends (react__WEBPACK_IMPORTED_MODULE_3___default().Component) {
5930
- static displayName = "VictoryContainer";
5931
- static role = "container";
5932
- static defaultProps = {
5933
- className: "VictoryContainer",
5934
- portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__.Portal, null),
5935
- portalZIndex: 99,
5936
- responsive: true,
5937
- role: "img"
5938
- };
5939
- static contextType = _victory_util_timer_context__WEBPACK_IMPORTED_MODULE_5__["default"];
5940
-
5941
- // @ts-expect-error Ref will be initialized on mount
5942
-
5943
- // @ts-expect-error Ref will be initialized on mount
5944
-
5945
- constructor(props) {
5946
- super(props);
5947
- this.containerId = !lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default()(props) || props.containerId === undefined ? lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default()("victory-container-") : props.containerId;
5948
- this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
5949
- }
5950
- savePortalRef = portal => {
5951
- this.portalRef = portal;
5952
- return portal;
5924
+ const defaultProps = {
5925
+ className: "VictoryContainer",
5926
+ portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__.Portal, null),
5927
+ portalZIndex: 99,
5928
+ responsive: true,
5929
+ role: "img"
5930
+ };
5931
+ function useVictoryContainer(initialProps) {
5932
+ const props = {
5933
+ ...defaultProps,
5934
+ ...initialProps
5953
5935
  };
5954
- portalUpdate = (key, el) => this.portalRef.portalUpdate(key, el);
5955
- portalRegister = () => this.portalRef.portalRegister();
5956
- portalDeregister = key => this.portalRef.portalDeregister(key);
5957
- saveContainerRef = container => {
5958
- if (_victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(this.props.containerRef)) {
5959
- this.props.containerRef(container);
5960
- }
5961
- this.containerRef = container;
5962
- return container;
5936
+ const {
5937
+ title,
5938
+ desc,
5939
+ width,
5940
+ height,
5941
+ responsive
5942
+ } = props;
5943
+ const localContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
5944
+
5945
+ // Generated ID stored in ref because it needs to persist across renders
5946
+ const generatedId = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()("victory-container-"));
5947
+ const containerId = props.containerId ?? generatedId.current;
5948
+ const getIdForElement = elName => `${containerId}-${elName}`;
5949
+ const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
5950
+ const dimensions = responsive ? {
5951
+ width: "100%",
5952
+ height: "100%"
5953
+ } : {
5954
+ width,
5955
+ height
5963
5956
  };
5964
- handleWheel = e => e.preventDefault();
5965
- componentDidMount() {
5966
- if (this.shouldHandleWheel && this.containerRef) {
5967
- this.containerRef.addEventListener("wheel", this.handleWheel);
5968
- }
5969
- }
5970
- componentWillUnmount() {
5971
- if (this.shouldHandleWheel && this.containerRef) {
5972
- this.containerRef.removeEventListener("wheel", this.handleWheel);
5973
- }
5974
- }
5975
- getIdForElement(elementName) {
5976
- return `${this.containerId}-${elementName}`;
5977
- }
5978
-
5979
- // overridden in custom containers
5980
- getChildren(props) {
5981
- return props.children;
5982
- }
5983
-
5984
- // Get props defined by the Open UI Automation (OUIA) 1.0-RC spec
5985
- // See https://ouia.readthedocs.io/en/latest/README.html#ouia-component
5986
- getOUIAProps(props) {
5987
- const {
5988
- ouiaId,
5989
- ouiaSafe,
5990
- ouiaType
5991
- } = props;
5992
- return {
5993
- ...(ouiaId && {
5994
- "data-ouia-component-id": ouiaId
5995
- }),
5996
- ...(ouiaType && {
5997
- "data-ouia-component-type": ouiaType
5998
- }),
5999
- ...(ouiaSafe !== undefined && {
6000
- "data-ouia-safe": ouiaSafe
6001
- })
6002
- };
6003
- }
6004
- renderContainer(props, svgProps, style) {
6005
- const {
6006
- title,
6007
- desc,
6008
- portalComponent,
6009
- className,
6010
- width,
6011
- height,
6012
- portalZIndex,
6013
- responsive
6014
- } = props;
6015
- const children = this.getChildren(props);
6016
- const dimensions = responsive ? {
6017
- width: "100%",
6018
- height: "100%"
6019
- } : {
6020
- width,
6021
- height
5957
+ const viewBox = responsive ? `0 0 ${width} ${height}` : undefined;
5958
+ const preserveAspectRatio = responsive ? props.preserveAspectRatio : undefined;
5959
+ const ariaLabelledBy = [title && getIdForElement("title"), props["aria-labelledby"]].filter(Boolean).join(" ") || undefined;
5960
+ const ariaDescribedBy = [desc && getIdForElement("desc"), props["aria-describedby"]].filter(Boolean).join(" ") || undefined;
5961
+ const titleId = getIdForElement("title");
5962
+ const descId = getIdForElement("desc");
5963
+ return {
5964
+ ...props,
5965
+ titleId,
5966
+ descId,
5967
+ dimensions,
5968
+ viewBox,
5969
+ preserveAspectRatio,
5970
+ ariaLabelledBy,
5971
+ ariaDescribedBy,
5972
+ userProps,
5973
+ localContainerRef
5974
+ };
5975
+ }
5976
+ const VictoryContainer = initialProps => {
5977
+ const {
5978
+ role,
5979
+ title,
5980
+ desc,
5981
+ children,
5982
+ className,
5983
+ portalZIndex,
5984
+ portalComponent,
5985
+ width,
5986
+ height,
5987
+ style,
5988
+ tabIndex,
5989
+ responsive,
5990
+ events,
5991
+ ouiaId,
5992
+ ouiaSafe,
5993
+ ouiaType,
5994
+ dimensions,
5995
+ ariaDescribedBy,
5996
+ ariaLabelledBy,
5997
+ viewBox,
5998
+ preserveAspectRatio,
5999
+ userProps,
6000
+ titleId,
6001
+ descId,
6002
+ containerRef,
6003
+ localContainerRef
6004
+ } = useVictoryContainer(initialProps);
6005
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
6006
+ if (!events?.onWheel) return;
6007
+ const handleWheel = e => e.preventDefault();
6008
+ const container = localContainerRef?.current;
6009
+ container?.addEventListener("wheel", handleWheel);
6010
+ return () => {
6011
+ container?.removeEventListener("wheel", handleWheel);
6022
6012
  };
6023
- const divStyle = Object.assign({
6013
+ // eslint-disable-next-line react-hooks/exhaustive-deps
6014
+ }, []);
6015
+ 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", {
6016
+ className: className,
6017
+ style: {
6018
+ ...style,
6019
+ width: responsive ? style?.width : dimensions.width,
6020
+ height: responsive ? style?.height : dimensions.height,
6024
6021
  pointerEvents: "none",
6025
6022
  touchAction: "none",
6026
6023
  position: "relative"
6027
- }, dimensions);
6028
- const portalDivStyle = Object.assign({
6024
+ },
6025
+ "data-ouia-component-id": ouiaId,
6026
+ "data-ouia-component-type": ouiaType,
6027
+ "data-ouia-safe": ouiaSafe,
6028
+ ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_5__.mergeRefs)([localContainerRef, containerRef])
6029
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("svg", _extends({
6030
+ width: width,
6031
+ height: height,
6032
+ tabIndex: tabIndex,
6033
+ role: role,
6034
+ "aria-labelledby": ariaLabelledBy,
6035
+ "aria-describedby": ariaDescribedBy,
6036
+ viewBox: viewBox,
6037
+ preserveAspectRatio: preserveAspectRatio,
6038
+ style: {
6039
+ ...dimensions,
6040
+ pointerEvents: "all"
6041
+ }
6042
+ }, userProps, events), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("title", {
6043
+ id: titleId
6044
+ }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("desc", {
6045
+ id: descId
6046
+ }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
6047
+ style: {
6048
+ ...dimensions,
6029
6049
  zIndex: portalZIndex,
6030
6050
  position: "absolute",
6031
6051
  top: 0,
6032
6052
  left: 0
6033
- }, dimensions);
6034
- const svgStyle = Object.assign({
6035
- pointerEvents: "all"
6036
- }, dimensions);
6037
- const portalSvgStyle = Object.assign({
6053
+ }
6054
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__.PortalOutlet, {
6055
+ as: portalComponent,
6056
+ width: width,
6057
+ height: height,
6058
+ viewBox: viewBox,
6059
+ preserveAspectRatio: preserveAspectRatio,
6060
+ style: {
6061
+ ...dimensions,
6038
6062
  overflow: "visible"
6039
- }, dimensions);
6040
- const portalProps = {
6041
- width,
6042
- height,
6043
- viewBox: svgProps.viewBox,
6044
- preserveAspectRatio: svgProps.preserveAspectRatio,
6045
- style: portalSvgStyle
6046
- };
6047
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_7__.PortalContext.Provider, {
6048
- value: {
6049
- portalUpdate: this.portalUpdate,
6050
- portalRegister: this.portalRegister,
6051
- portalDeregister: this.portalDeregister
6052
- }
6053
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", _extends({
6054
- style: lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, style, divStyle),
6055
- className: className,
6056
- ref: this.saveContainerRef
6057
- }, this.getOUIAProps(props)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("svg", _extends({}, svgProps, {
6058
- style: svgStyle
6059
- }), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("title", {
6060
- id: this.getIdForElement("title")
6061
- }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("desc", {
6062
- id: this.getIdForElement("desc")
6063
- }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", {
6064
- style: portalDivStyle
6065
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().cloneElement(portalComponent, {
6066
- ...portalProps,
6067
- ref: this.savePortalRef
6068
- }))));
6069
- }
6070
- render() {
6071
- const {
6072
- width,
6073
- height,
6074
- responsive,
6075
- events,
6076
- title,
6077
- desc,
6078
- tabIndex,
6079
- preserveAspectRatio,
6080
- role
6081
- } = this.props;
6082
- const style = responsive ? this.props.style : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.omit(this.props.style, ["height", "width"]);
6083
- const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__.getSafeUserProps(this.props);
6084
- const svgProps = Object.assign({
6085
- width,
6086
- height,
6087
- tabIndex,
6088
- role,
6089
- "aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
6090
- "aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
6091
- viewBox: responsive ? `0 0 ${width} ${height}` : undefined,
6092
- preserveAspectRatio: responsive ? preserveAspectRatio : undefined,
6093
- ...userProps
6094
- }, events);
6095
- return this.renderContainer(this.props, svgProps, style);
6096
- }
6097
- }
6063
+ }
6064
+ }))));
6065
+ };
6066
+ VictoryContainer.role = "container";
6098
6067
 
6099
6068
  /***/ }),
6100
6069
 
@@ -6607,17 +6576,83 @@ VictoryLabel.defaultStyles = defaultStyles;
6607
6576
  "use strict";
6608
6577
  __webpack_require__.r(__webpack_exports__);
6609
6578
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6610
- /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; }
6579
+ /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; },
6580
+ /* harmony export */ "PortalProvider": function() { return /* binding */ PortalProvider; },
6581
+ /* harmony export */ "usePortalContext": function() { return /* binding */ usePortalContext; }
6611
6582
  /* harmony export */ });
6612
6583
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
6613
6584
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6614
6585
 
6615
- /**
6616
- * The React context object consumers may use to access the context of the
6617
- * portal.
6618
- */
6619
- const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({});
6586
+ const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined);
6620
6587
  PortalContext.displayName = "PortalContext";
6588
+ const usePortalContext = () => {
6589
+ const context = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(PortalContext);
6590
+ if (!context) {
6591
+ throw new Error("`usePortalContext` must be used within a `<PortalProvider />`");
6592
+ }
6593
+ return context;
6594
+ };
6595
+ const PortalProvider = _ref => {
6596
+ let {
6597
+ children
6598
+ } = _ref;
6599
+ const [portalChildren, setPortalChildren] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(new Map());
6600
+ const addChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((id, element) => {
6601
+ setPortalChildren(prevChildren => {
6602
+ const nextChildren = new Map(prevChildren);
6603
+ nextChildren.set(id, element);
6604
+ return nextChildren;
6605
+ });
6606
+ }, [setPortalChildren]);
6607
+ const removeChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(id => {
6608
+ setPortalChildren(prevChildren => {
6609
+ const nextChildren = new Map(prevChildren);
6610
+ nextChildren.delete(id);
6611
+ return nextChildren;
6612
+ });
6613
+ }, [setPortalChildren]);
6614
+ const contextValue = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => ({
6615
+ addChild,
6616
+ removeChild,
6617
+ children: portalChildren
6618
+ }), [addChild, removeChild, portalChildren]);
6619
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PortalContext.Provider, {
6620
+ value: contextValue
6621
+ }, children);
6622
+ };
6623
+
6624
+ /***/ }),
6625
+
6626
+ /***/ "../../victory-core/es/victory-portal/portal-outlet.js":
6627
+ /*!*************************************************************!*\
6628
+ !*** ../../victory-core/es/victory-portal/portal-outlet.js ***!
6629
+ \*************************************************************/
6630
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
6631
+
6632
+ "use strict";
6633
+ __webpack_require__.r(__webpack_exports__);
6634
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6635
+ /* harmony export */ "PortalOutlet": function() { return /* binding */ PortalOutlet; }
6636
+ /* harmony export */ });
6637
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
6638
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6639
+ /* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
6640
+
6641
+
6642
+ const PortalOutlet = _ref => {
6643
+ let {
6644
+ as: portalComponent,
6645
+ ...props
6646
+ } = _ref;
6647
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_1__.usePortalContext)();
6648
+ const children = Array.from(portalContext.children.entries()).map(_ref2 => {
6649
+ let [key, node] = _ref2;
6650
+ return !node.key ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(node, {
6651
+ key
6652
+ }) : node;
6653
+ });
6654
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(portalComponent, props, children);
6655
+ };
6621
6656
 
6622
6657
  /***/ }),
6623
6658
 
@@ -6634,39 +6669,13 @@ __webpack_require__.r(__webpack_exports__);
6634
6669
  /* harmony export */ });
6635
6670
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
6636
6671
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6672
+ 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); }
6637
6673
 
6638
- class Portal extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) {
6639
- static displayName = "Portal";
6640
- constructor(props) {
6641
- super(props);
6642
- this.map = {};
6643
- this.index = 1;
6644
- }
6645
- portalRegister = () => {
6646
- return ++this.index;
6647
- };
6648
- portalUpdate = (key, element) => {
6649
- this.map[key] = element;
6650
- this.forceUpdate();
6651
- };
6652
- portalDeregister = key => {
6653
- delete this.map[key];
6654
- this.forceUpdate();
6655
- };
6656
- getChildren() {
6657
- return Object.keys(this.map).map(key => {
6658
- const el = this.map[key];
6659
- return el ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(el, {
6660
- key
6661
- }) : el;
6662
- });
6663
- }
6664
-
6665
- // Overridden in victory-core-native
6666
- render() {
6667
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", this.props, this.getChildren());
6668
- }
6669
- }
6674
+ const Portal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef((props, ref) => {
6675
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
6676
+ ref: ref
6677
+ }, props));
6678
+ });
6670
6679
 
6671
6680
  /***/ }),
6672
6681
 
@@ -6693,59 +6702,42 @@ __webpack_require__.r(__webpack_exports__);
6693
6702
 
6694
6703
 
6695
6704
 
6696
- class VictoryPortal extends (react__WEBPACK_IMPORTED_MODULE_1___default().Component) {
6697
- static displayName = "VictoryPortal";
6698
- static role = "portal";
6699
- static defaultProps = {
6700
- groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
6701
- };
6702
- static contextType = _portal_context__WEBPACK_IMPORTED_MODULE_2__.PortalContext;
6703
- componentDidMount() {
6704
- if (!this.checkedContext) {
6705
- if (typeof this.context.portalUpdate !== "function") {
6706
- const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
6707
- _victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
6708
- this.renderInPlace = true;
6709
- }
6710
- this.checkedContext = true;
6711
- }
6712
- this.forceUpdate();
6713
- }
6714
- componentDidUpdate() {
6715
- if (!this.renderInPlace) {
6716
- this.portalKey = this.portalKey || this.context.portalRegister();
6717
- this.context.portalUpdate(this.portalKey, this.element);
6718
- }
6719
- }
6720
- componentWillUnmount() {
6721
- if (this.context && this.context.portalDeregister) {
6722
- this.context.portalDeregister(this.portalKey);
6723
- }
6724
- }
6725
-
6726
- // Overridden in victory-core-native
6727
- renderPortal(child) {
6728
- if (this.renderInPlace) {
6729
- return child;
6730
- }
6731
- this.element = child;
6732
- return null;
6733
- }
6734
- render() {
6735
- const children = Array.isArray(this.props.children) ? this.props.children[0] : this.props.children;
6705
+ const defaultProps = {
6706
+ groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
6707
+ };
6708
+ const VictoryPortal = initialProps => {
6709
+ const props = {
6710
+ ...defaultProps,
6711
+ ...initialProps
6712
+ };
6713
+ const id = react__WEBPACK_IMPORTED_MODULE_1___default().useId();
6714
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_2__.usePortalContext)();
6715
+ if (!portalContext) {
6716
+ const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
6717
+ _victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
6718
+ }
6719
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
6720
+ const children = Array.isArray(props.children) ? props.children[0] : props.children;
6736
6721
  const {
6737
6722
  groupComponent
6738
- } = this.props;
6723
+ } = props;
6739
6724
  const childProps = children && children.props || {};
6740
6725
  const standardProps = childProps.groupComponent ? {
6741
6726
  groupComponent,
6742
6727
  standalone: false
6743
6728
  } : {};
6744
- const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(this.props, ["children", "groupComponent"]));
6729
+ const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(props, ["children", "groupComponent"]));
6745
6730
  const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
6746
- return this.renderPortal(child);
6747
- }
6748
- }
6731
+ portalContext.addChild(id, child);
6732
+ // eslint-disable-next-line react-hooks/exhaustive-deps
6733
+ }, [props.children]);
6734
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
6735
+ return () => portalContext.removeChild(id);
6736
+ // eslint-disable-next-line react-hooks/exhaustive-deps
6737
+ }, []);
6738
+ return null;
6739
+ };
6740
+ VictoryPortal.role = "portal";
6749
6741
 
6750
6742
  /***/ }),
6751
6743
 
@@ -10099,6 +10091,44 @@ function warn(message) {
10099
10091
 
10100
10092
  /***/ }),
10101
10093
 
10094
+ /***/ "../../victory-core/es/victory-util/merge-refs.js":
10095
+ /*!********************************************************!*\
10096
+ !*** ../../victory-core/es/victory-util/merge-refs.js ***!
10097
+ \********************************************************/
10098
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
10099
+
10100
+ "use strict";
10101
+ __webpack_require__.r(__webpack_exports__);
10102
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10103
+ /* harmony export */ "mergeRefs": function() { return /* binding */ mergeRefs; }
10104
+ /* harmony export */ });
10105
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
10106
+
10107
+ /**
10108
+ * Used to merge multiple React refs into a single callback ref.
10109
+ *
10110
+ * @example
10111
+ * ```tsx
10112
+ * <div ref={mergeRefs([ref, forwardedRef])} />
10113
+ * ```
10114
+ */
10115
+ function mergeRefs(refs) {
10116
+ return value => {
10117
+ refs.forEach(ref => {
10118
+ // If the ref is a function, it's a callback ref and we call it with the value.
10119
+ if (_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction(ref)) {
10120
+ ref(value);
10121
+ } else if (ref !== null && ref !== undefined) {
10122
+ // If the ref is an object (not null and not undefined), it's an object ref.
10123
+ // We assign the value to its 'current' property.
10124
+ ref.current = value;
10125
+ }
10126
+ });
10127
+ };
10128
+ }
10129
+
10130
+ /***/ }),
10131
+
10102
10132
  /***/ "../../victory-core/es/victory-util/scale.js":
10103
10133
  /*!***************************************************!*\
10104
10134
  !*** ../../victory-core/es/victory-util/scale.js ***!