victory-group 37.0.1 → 37.0.3-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # victory-group
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-shared-events@37.0.3-next.0
10
+
11
+ ## 37.0.2
12
+
13
+ ### Patch Changes
14
+
15
+ - Ensure undefined props do not overwrite defaults ([#2852](https://github.com/FormidableLabs/victory/pull/2852))
16
+
3
17
  ## 37.0.1
4
18
 
5
19
  ## 37.0.0
@@ -308,10 +308,7 @@ const VictoryGroupBase = initialProps => {
308
308
  setAnimationState,
309
309
  getProps
310
310
  } = victory_core__WEBPACK_IMPORTED_MODULE_6__.useAnimationState();
311
- const propsWithDefaults = react__WEBPACK_IMPORTED_MODULE_2___default().useMemo(() => ({
312
- ...defaultProps,
313
- ...initialProps
314
- }), [initialProps]);
311
+ const propsWithDefaults = react__WEBPACK_IMPORTED_MODULE_2___default().useMemo(() => lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, initialProps, defaultProps), [initialProps]);
315
312
  const props = getProps(propsWithDefaults);
316
313
  const modifiedProps = victory_core__WEBPACK_IMPORTED_MODULE_7__.modifyProps(props, fallbackProps, role);
317
314
  const {
@@ -5001,23 +4998,18 @@ module.exports = function isEqual(a, b) {
5001
4998
  "use strict";
5002
4999
  __webpack_require__.r(__webpack_exports__);
5003
5000
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5004
- /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; }
5001
+ /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
5002
+ /* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
5005
5003
  /* harmony export */ });
5006
- /* 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");
5007
- /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_isObject__WEBPACK_IMPORTED_MODULE_0__);
5008
- /* 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");
5009
- /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1__);
5010
- /* 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");
5011
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_2__);
5012
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "react");
5013
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
5014
- /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
5015
- /* 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");
5016
- /* 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");
5017
- /* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
5018
- /* 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");
5019
-
5020
-
5004
+ /* 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");
5005
+ /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
5006
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
5007
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
5008
+ /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
5009
+ /* 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");
5010
+ /* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
5011
+ /* 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");
5012
+ /* 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");
5021
5013
 
5022
5014
  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); }
5023
5015
 
@@ -5026,175 +5018,149 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
5026
5018
 
5027
5019
 
5028
5020
 
5029
- class VictoryContainer extends (react__WEBPACK_IMPORTED_MODULE_3___default().Component) {
5030
- static displayName = "VictoryContainer";
5031
- static role = "container";
5032
- static defaultProps = {
5033
- className: "VictoryContainer",
5034
- portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__.Portal, null),
5035
- portalZIndex: 99,
5036
- responsive: true,
5037
- role: "img"
5038
- };
5039
- static contextType = _victory_util_timer_context__WEBPACK_IMPORTED_MODULE_5__["default"];
5040
-
5041
- // @ts-expect-error Ref will be initialized on mount
5042
-
5043
- // @ts-expect-error Ref will be initialized on mount
5044
-
5045
- constructor(props) {
5046
- super(props);
5047
- this.containerId = !lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default()(props) || props.containerId === undefined ? lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default()("victory-container-") : props.containerId;
5048
- this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
5049
- }
5050
- savePortalRef = portal => {
5051
- this.portalRef = portal;
5052
- return portal;
5021
+ const defaultProps = {
5022
+ className: "VictoryContainer",
5023
+ portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__.Portal, null),
5024
+ portalZIndex: 99,
5025
+ responsive: true,
5026
+ role: "img"
5027
+ };
5028
+ function useVictoryContainer(initialProps) {
5029
+ const props = {
5030
+ ...defaultProps,
5031
+ ...initialProps
5053
5032
  };
5054
- portalUpdate = (key, el) => this.portalRef.portalUpdate(key, el);
5055
- portalRegister = () => this.portalRef.portalRegister();
5056
- portalDeregister = key => this.portalRef.portalDeregister(key);
5057
- saveContainerRef = container => {
5058
- if (_victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(this.props.containerRef)) {
5059
- this.props.containerRef(container);
5060
- }
5061
- this.containerRef = container;
5062
- return container;
5033
+ const {
5034
+ title,
5035
+ desc,
5036
+ width,
5037
+ height,
5038
+ responsive
5039
+ } = props;
5040
+ const localContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
5041
+
5042
+ // Generated ID stored in ref because it needs to persist across renders
5043
+ const generatedId = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()("victory-container-"));
5044
+ const containerId = props.containerId ?? generatedId.current;
5045
+ const getIdForElement = elName => `${containerId}-${elName}`;
5046
+ const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
5047
+ const dimensions = responsive ? {
5048
+ width: "100%",
5049
+ height: "100%"
5050
+ } : {
5051
+ width,
5052
+ height
5063
5053
  };
5064
- handleWheel = e => e.preventDefault();
5065
- componentDidMount() {
5066
- if (this.shouldHandleWheel && this.containerRef) {
5067
- this.containerRef.addEventListener("wheel", this.handleWheel);
5068
- }
5069
- }
5070
- componentWillUnmount() {
5071
- if (this.shouldHandleWheel && this.containerRef) {
5072
- this.containerRef.removeEventListener("wheel", this.handleWheel);
5073
- }
5074
- }
5075
- getIdForElement(elementName) {
5076
- return `${this.containerId}-${elementName}`;
5077
- }
5078
-
5079
- // overridden in custom containers
5080
- getChildren(props) {
5081
- return props.children;
5082
- }
5083
-
5084
- // Get props defined by the Open UI Automation (OUIA) 1.0-RC spec
5085
- // See https://ouia.readthedocs.io/en/latest/README.html#ouia-component
5086
- getOUIAProps(props) {
5087
- const {
5088
- ouiaId,
5089
- ouiaSafe,
5090
- ouiaType
5091
- } = props;
5092
- return {
5093
- ...(ouiaId && {
5094
- "data-ouia-component-id": ouiaId
5095
- }),
5096
- ...(ouiaType && {
5097
- "data-ouia-component-type": ouiaType
5098
- }),
5099
- ...(ouiaSafe !== undefined && {
5100
- "data-ouia-safe": ouiaSafe
5101
- })
5102
- };
5103
- }
5104
- renderContainer(props, svgProps, style) {
5105
- const {
5106
- title,
5107
- desc,
5108
- portalComponent,
5109
- className,
5110
- width,
5111
- height,
5112
- portalZIndex,
5113
- responsive
5114
- } = props;
5115
- const children = this.getChildren(props);
5116
- const dimensions = responsive ? {
5117
- width: "100%",
5118
- height: "100%"
5119
- } : {
5120
- width,
5121
- height
5054
+ const viewBox = responsive ? `0 0 ${width} ${height}` : undefined;
5055
+ const preserveAspectRatio = responsive ? props.preserveAspectRatio : undefined;
5056
+ const ariaLabelledBy = [title && getIdForElement("title"), props["aria-labelledby"]].filter(Boolean).join(" ") || undefined;
5057
+ const ariaDescribedBy = [desc && getIdForElement("desc"), props["aria-describedby"]].filter(Boolean).join(" ") || undefined;
5058
+ const titleId = getIdForElement("title");
5059
+ const descId = getIdForElement("desc");
5060
+ return {
5061
+ ...props,
5062
+ titleId,
5063
+ descId,
5064
+ dimensions,
5065
+ viewBox,
5066
+ preserveAspectRatio,
5067
+ ariaLabelledBy,
5068
+ ariaDescribedBy,
5069
+ userProps,
5070
+ localContainerRef
5071
+ };
5072
+ }
5073
+ const VictoryContainer = initialProps => {
5074
+ const {
5075
+ role,
5076
+ title,
5077
+ desc,
5078
+ children,
5079
+ className,
5080
+ portalZIndex,
5081
+ portalComponent,
5082
+ width,
5083
+ height,
5084
+ style,
5085
+ tabIndex,
5086
+ responsive,
5087
+ events,
5088
+ ouiaId,
5089
+ ouiaSafe,
5090
+ ouiaType,
5091
+ dimensions,
5092
+ ariaDescribedBy,
5093
+ ariaLabelledBy,
5094
+ viewBox,
5095
+ preserveAspectRatio,
5096
+ userProps,
5097
+ titleId,
5098
+ descId,
5099
+ containerRef,
5100
+ localContainerRef
5101
+ } = useVictoryContainer(initialProps);
5102
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
5103
+ if (!events?.onWheel) return;
5104
+ const handleWheel = e => e.preventDefault();
5105
+ const container = localContainerRef?.current;
5106
+ container?.addEventListener("wheel", handleWheel);
5107
+ return () => {
5108
+ container?.removeEventListener("wheel", handleWheel);
5122
5109
  };
5123
- const divStyle = Object.assign({
5110
+ // eslint-disable-next-line react-hooks/exhaustive-deps
5111
+ }, []);
5112
+ 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", {
5113
+ className: className,
5114
+ style: {
5115
+ ...style,
5116
+ width: responsive ? style?.width : dimensions.width,
5117
+ height: responsive ? style?.height : dimensions.height,
5124
5118
  pointerEvents: "none",
5125
5119
  touchAction: "none",
5126
5120
  position: "relative"
5127
- }, dimensions);
5128
- const portalDivStyle = Object.assign({
5121
+ },
5122
+ "data-ouia-component-id": ouiaId,
5123
+ "data-ouia-component-type": ouiaType,
5124
+ "data-ouia-safe": ouiaSafe,
5125
+ ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_5__.mergeRefs)([localContainerRef, containerRef])
5126
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("svg", _extends({
5127
+ width: width,
5128
+ height: height,
5129
+ tabIndex: tabIndex,
5130
+ role: role,
5131
+ "aria-labelledby": ariaLabelledBy,
5132
+ "aria-describedby": ariaDescribedBy,
5133
+ viewBox: viewBox,
5134
+ preserveAspectRatio: preserveAspectRatio,
5135
+ style: {
5136
+ ...dimensions,
5137
+ pointerEvents: "all"
5138
+ }
5139
+ }, userProps, events), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("title", {
5140
+ id: titleId
5141
+ }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("desc", {
5142
+ id: descId
5143
+ }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
5144
+ style: {
5145
+ ...dimensions,
5129
5146
  zIndex: portalZIndex,
5130
5147
  position: "absolute",
5131
5148
  top: 0,
5132
5149
  left: 0
5133
- }, dimensions);
5134
- const svgStyle = Object.assign({
5135
- pointerEvents: "all"
5136
- }, dimensions);
5137
- const portalSvgStyle = Object.assign({
5150
+ }
5151
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__.PortalOutlet, {
5152
+ as: portalComponent,
5153
+ width: width,
5154
+ height: height,
5155
+ viewBox: viewBox,
5156
+ preserveAspectRatio: preserveAspectRatio,
5157
+ style: {
5158
+ ...dimensions,
5138
5159
  overflow: "visible"
5139
- }, dimensions);
5140
- const portalProps = {
5141
- width,
5142
- height,
5143
- viewBox: svgProps.viewBox,
5144
- preserveAspectRatio: svgProps.preserveAspectRatio,
5145
- style: portalSvgStyle
5146
- };
5147
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_7__.PortalContext.Provider, {
5148
- value: {
5149
- portalUpdate: this.portalUpdate,
5150
- portalRegister: this.portalRegister,
5151
- portalDeregister: this.portalDeregister
5152
- }
5153
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", _extends({
5154
- style: lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, style, divStyle),
5155
- className: className,
5156
- ref: this.saveContainerRef
5157
- }, this.getOUIAProps(props)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("svg", _extends({}, svgProps, {
5158
- style: svgStyle
5159
- }), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("title", {
5160
- id: this.getIdForElement("title")
5161
- }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("desc", {
5162
- id: this.getIdForElement("desc")
5163
- }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", {
5164
- style: portalDivStyle
5165
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().cloneElement(portalComponent, {
5166
- ...portalProps,
5167
- ref: this.savePortalRef
5168
- }))));
5169
- }
5170
- render() {
5171
- const {
5172
- width,
5173
- height,
5174
- responsive,
5175
- events,
5176
- title,
5177
- desc,
5178
- tabIndex,
5179
- preserveAspectRatio,
5180
- role
5181
- } = this.props;
5182
- const style = responsive ? this.props.style : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.omit(this.props.style, ["height", "width"]);
5183
- const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__.getSafeUserProps(this.props);
5184
- const svgProps = Object.assign({
5185
- width,
5186
- height,
5187
- tabIndex,
5188
- role,
5189
- "aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
5190
- "aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
5191
- viewBox: responsive ? `0 0 ${width} ${height}` : undefined,
5192
- preserveAspectRatio: responsive ? preserveAspectRatio : undefined,
5193
- ...userProps
5194
- }, events);
5195
- return this.renderContainer(this.props, svgProps, style);
5196
- }
5197
- }
5160
+ }
5161
+ }))));
5162
+ };
5163
+ VictoryContainer.role = "container";
5198
5164
 
5199
5165
  /***/ }),
5200
5166
 
@@ -5207,17 +5173,83 @@ class VictoryContainer extends (react__WEBPACK_IMPORTED_MODULE_3___default().Com
5207
5173
  "use strict";
5208
5174
  __webpack_require__.r(__webpack_exports__);
5209
5175
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5210
- /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; }
5176
+ /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; },
5177
+ /* harmony export */ "PortalProvider": function() { return /* binding */ PortalProvider; },
5178
+ /* harmony export */ "usePortalContext": function() { return /* binding */ usePortalContext; }
5211
5179
  /* harmony export */ });
5212
5180
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
5213
5181
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
5214
5182
 
5215
- /**
5216
- * The React context object consumers may use to access the context of the
5217
- * portal.
5218
- */
5219
- const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({});
5183
+ const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined);
5220
5184
  PortalContext.displayName = "PortalContext";
5185
+ const usePortalContext = () => {
5186
+ const context = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(PortalContext);
5187
+ if (!context) {
5188
+ throw new Error("`usePortalContext` must be used within a `<PortalProvider />`");
5189
+ }
5190
+ return context;
5191
+ };
5192
+ const PortalProvider = _ref => {
5193
+ let {
5194
+ children
5195
+ } = _ref;
5196
+ const [portalChildren, setPortalChildren] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(new Map());
5197
+ const addChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((id, element) => {
5198
+ setPortalChildren(prevChildren => {
5199
+ const nextChildren = new Map(prevChildren);
5200
+ nextChildren.set(id, element);
5201
+ return nextChildren;
5202
+ });
5203
+ }, [setPortalChildren]);
5204
+ const removeChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(id => {
5205
+ setPortalChildren(prevChildren => {
5206
+ const nextChildren = new Map(prevChildren);
5207
+ nextChildren.delete(id);
5208
+ return nextChildren;
5209
+ });
5210
+ }, [setPortalChildren]);
5211
+ const contextValue = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => ({
5212
+ addChild,
5213
+ removeChild,
5214
+ children: portalChildren
5215
+ }), [addChild, removeChild, portalChildren]);
5216
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PortalContext.Provider, {
5217
+ value: contextValue
5218
+ }, children);
5219
+ };
5220
+
5221
+ /***/ }),
5222
+
5223
+ /***/ "../../victory-core/es/victory-portal/portal-outlet.js":
5224
+ /*!*************************************************************!*\
5225
+ !*** ../../victory-core/es/victory-portal/portal-outlet.js ***!
5226
+ \*************************************************************/
5227
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
5228
+
5229
+ "use strict";
5230
+ __webpack_require__.r(__webpack_exports__);
5231
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5232
+ /* harmony export */ "PortalOutlet": function() { return /* binding */ PortalOutlet; }
5233
+ /* harmony export */ });
5234
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
5235
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
5236
+ /* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
5237
+
5238
+
5239
+ const PortalOutlet = _ref => {
5240
+ let {
5241
+ as: portalComponent,
5242
+ ...props
5243
+ } = _ref;
5244
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_1__.usePortalContext)();
5245
+ const children = Array.from(portalContext.children.entries()).map(_ref2 => {
5246
+ let [key, node] = _ref2;
5247
+ return !node.key ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(node, {
5248
+ key
5249
+ }) : node;
5250
+ });
5251
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(portalComponent, props, children);
5252
+ };
5221
5253
 
5222
5254
  /***/ }),
5223
5255
 
@@ -5234,39 +5266,13 @@ __webpack_require__.r(__webpack_exports__);
5234
5266
  /* harmony export */ });
5235
5267
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
5236
5268
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
5269
+ 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); }
5237
5270
 
5238
- class Portal extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) {
5239
- static displayName = "Portal";
5240
- constructor(props) {
5241
- super(props);
5242
- this.map = {};
5243
- this.index = 1;
5244
- }
5245
- portalRegister = () => {
5246
- return ++this.index;
5247
- };
5248
- portalUpdate = (key, element) => {
5249
- this.map[key] = element;
5250
- this.forceUpdate();
5251
- };
5252
- portalDeregister = key => {
5253
- delete this.map[key];
5254
- this.forceUpdate();
5255
- };
5256
- getChildren() {
5257
- return Object.keys(this.map).map(key => {
5258
- const el = this.map[key];
5259
- return el ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(el, {
5260
- key
5261
- }) : el;
5262
- });
5263
- }
5264
-
5265
- // Overridden in victory-core-native
5266
- render() {
5267
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", this.props, this.getChildren());
5268
- }
5269
- }
5271
+ const Portal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef((props, ref) => {
5272
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
5273
+ ref: ref
5274
+ }, props));
5275
+ });
5270
5276
 
5271
5277
  /***/ }),
5272
5278
 
@@ -8220,6 +8226,44 @@ function warn(message) {
8220
8226
 
8221
8227
  /***/ }),
8222
8228
 
8229
+ /***/ "../../victory-core/es/victory-util/merge-refs.js":
8230
+ /*!********************************************************!*\
8231
+ !*** ../../victory-core/es/victory-util/merge-refs.js ***!
8232
+ \********************************************************/
8233
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8234
+
8235
+ "use strict";
8236
+ __webpack_require__.r(__webpack_exports__);
8237
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8238
+ /* harmony export */ "mergeRefs": function() { return /* binding */ mergeRefs; }
8239
+ /* harmony export */ });
8240
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
8241
+
8242
+ /**
8243
+ * Used to merge multiple React refs into a single callback ref.
8244
+ *
8245
+ * @example
8246
+ * ```tsx
8247
+ * <div ref={mergeRefs([ref, forwardedRef])} />
8248
+ * ```
8249
+ */
8250
+ function mergeRefs(refs) {
8251
+ return value => {
8252
+ refs.forEach(ref => {
8253
+ // If the ref is a function, it's a callback ref and we call it with the value.
8254
+ if (_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction(ref)) {
8255
+ ref(value);
8256
+ } else if (ref !== null && ref !== undefined) {
8257
+ // If the ref is an object (not null and not undefined), it's an object ref.
8258
+ // We assign the value to its 'current' property.
8259
+ ref.current = value;
8260
+ }
8261
+ });
8262
+ };
8263
+ }
8264
+
8265
+ /***/ }),
8266
+
8223
8267
  /***/ "../../victory-core/es/victory-util/scale.js":
8224
8268
  /*!***************************************************!*\
8225
8269
  !*** ../../victory-core/es/victory-util/scale.js ***!