victory-bar 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # victory-bar
2
2
 
3
+ ## 37.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Pin all internal victory package versions ([#2876](https://github.com/FormidableLabs/victory/pull/2876))
8
+
3
9
  ## 37.0.2
4
10
 
5
11
  ### 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_4__ = __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_5__ = __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("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_4__.mergeRefs)([localContainerRef, containerRef])
6029
+ }, /*#__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({
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,78 @@ 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
+ return context;
6591
+ };
6592
+ const PortalProvider = _ref => {
6593
+ let {
6594
+ children
6595
+ } = _ref;
6596
+ const [portalChildren, setPortalChildren] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(new Map());
6597
+ const addChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((id, element) => {
6598
+ setPortalChildren(prevChildren => {
6599
+ const nextChildren = new Map(prevChildren);
6600
+ nextChildren.set(id, element);
6601
+ return nextChildren;
6602
+ });
6603
+ }, [setPortalChildren]);
6604
+ const removeChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(id => {
6605
+ setPortalChildren(prevChildren => {
6606
+ const nextChildren = new Map(prevChildren);
6607
+ nextChildren.delete(id);
6608
+ return nextChildren;
6609
+ });
6610
+ }, [setPortalChildren]);
6611
+ const contextValue = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => ({
6612
+ addChild,
6613
+ removeChild,
6614
+ children: portalChildren
6615
+ }), [addChild, removeChild, portalChildren]);
6616
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PortalContext.Provider, {
6617
+ value: contextValue
6618
+ }, children);
6619
+ };
6620
+
6621
+ /***/ }),
6622
+
6623
+ /***/ "../../victory-core/es/victory-portal/portal-outlet.js":
6624
+ /*!*************************************************************!*\
6625
+ !*** ../../victory-core/es/victory-portal/portal-outlet.js ***!
6626
+ \*************************************************************/
6627
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
6628
+
6629
+ "use strict";
6630
+ __webpack_require__.r(__webpack_exports__);
6631
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6632
+ /* harmony export */ "PortalOutlet": function() { return /* binding */ PortalOutlet; }
6633
+ /* harmony export */ });
6634
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
6635
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6636
+ /* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
6637
+
6638
+
6639
+ const PortalOutlet = _ref => {
6640
+ let {
6641
+ as: portalComponent,
6642
+ ...props
6643
+ } = _ref;
6644
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_1__.usePortalContext)();
6645
+ if (!portalContext) {
6646
+ return null;
6647
+ }
6648
+ const children = Array.from(portalContext.children.values());
6649
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(portalComponent, props, children);
6650
+ };
6621
6651
 
6622
6652
  /***/ }),
6623
6653
 
@@ -6634,39 +6664,13 @@ __webpack_require__.r(__webpack_exports__);
6634
6664
  /* harmony export */ });
6635
6665
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
6636
6666
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6667
+ 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
6668
 
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
- }
6669
+ const Portal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef((props, ref) => {
6670
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
6671
+ ref: ref
6672
+ }, props));
6673
+ });
6670
6674
 
6671
6675
  /***/ }),
6672
6676
 
@@ -6693,59 +6697,44 @@ __webpack_require__.r(__webpack_exports__);
6693
6697
 
6694
6698
 
6695
6699
 
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;
6736
- const {
6737
- groupComponent
6738
- } = this.props;
6739
- const childProps = children && children.props || {};
6740
- const standardProps = childProps.groupComponent ? {
6741
- groupComponent,
6742
- standalone: false
6743
- } : {};
6744
- const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(this.props, ["children", "groupComponent"]));
6745
- const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
6746
- return this.renderPortal(child);
6747
- }
6748
- }
6700
+ const defaultProps = {
6701
+ groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
6702
+ };
6703
+ const VictoryPortal = initialProps => {
6704
+ const props = {
6705
+ ...defaultProps,
6706
+ ...initialProps
6707
+ };
6708
+ const id = react__WEBPACK_IMPORTED_MODULE_1___default().useId();
6709
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_2__.usePortalContext)();
6710
+ if (!portalContext) {
6711
+ const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
6712
+ _victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
6713
+ }
6714
+ const children = Array.isArray(props.children) ? props.children[0] : props.children;
6715
+ const {
6716
+ groupComponent
6717
+ } = props;
6718
+ const childProps = children && children.props || {};
6719
+ const standardProps = childProps.groupComponent ? {
6720
+ groupComponent,
6721
+ standalone: false
6722
+ } : {};
6723
+ const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(props, ["children", "groupComponent"]), {
6724
+ key: childProps.key ?? id
6725
+ });
6726
+ const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
6727
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
6728
+ portalContext?.addChild(id, child);
6729
+ // eslint-disable-next-line react-hooks/exhaustive-deps
6730
+ }, [props.children]);
6731
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
6732
+ return () => portalContext?.removeChild(id);
6733
+ // eslint-disable-next-line react-hooks/exhaustive-deps
6734
+ }, []);
6735
+ return portalContext ? null : child;
6736
+ };
6737
+ VictoryPortal.role = "portal";
6749
6738
 
6750
6739
  /***/ }),
6751
6740
 
@@ -10099,6 +10088,44 @@ function warn(message) {
10099
10088
 
10100
10089
  /***/ }),
10101
10090
 
10091
+ /***/ "../../victory-core/es/victory-util/merge-refs.js":
10092
+ /*!********************************************************!*\
10093
+ !*** ../../victory-core/es/victory-util/merge-refs.js ***!
10094
+ \********************************************************/
10095
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
10096
+
10097
+ "use strict";
10098
+ __webpack_require__.r(__webpack_exports__);
10099
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10100
+ /* harmony export */ "mergeRefs": function() { return /* binding */ mergeRefs; }
10101
+ /* harmony export */ });
10102
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
10103
+
10104
+ /**
10105
+ * Used to merge multiple React refs into a single callback ref.
10106
+ *
10107
+ * @example
10108
+ * ```tsx
10109
+ * <div ref={mergeRefs([ref, forwardedRef])} />
10110
+ * ```
10111
+ */
10112
+ function mergeRefs(refs) {
10113
+ return value => {
10114
+ refs.forEach(ref => {
10115
+ // If the ref is a function, it's a callback ref and we call it with the value.
10116
+ if (_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction(ref)) {
10117
+ ref(value);
10118
+ } else if (ref !== null && ref !== undefined) {
10119
+ // If the ref is an object (not null and not undefined), it's an object ref.
10120
+ // We assign the value to its 'current' property.
10121
+ ref.current = value;
10122
+ }
10123
+ });
10124
+ };
10125
+ }
10126
+
10127
+ /***/ }),
10128
+
10102
10129
  /***/ "../../victory-core/es/victory-util/scale.js":
10103
10130
  /*!***************************************************!*\
10104
10131
  !*** ../../victory-core/es/victory-util/scale.js ***!