victory-stack 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-stack
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
+
3
11
  ## 37.0.2
4
12
 
5
13
  ### Patch Changes
@@ -5026,23 +5026,18 @@ module.exports = function isEqual(a, b) {
5026
5026
  "use strict";
5027
5027
  __webpack_require__.r(__webpack_exports__);
5028
5028
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5029
- /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; }
5029
+ /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
5030
+ /* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
5030
5031
  /* harmony export */ });
5031
- /* 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");
5032
- /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_isObject__WEBPACK_IMPORTED_MODULE_0__);
5033
- /* 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");
5034
- /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1__);
5035
- /* 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");
5036
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_2__);
5037
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "react");
5038
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
5039
- /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
5040
- /* 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");
5041
- /* 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");
5042
- /* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
5043
- /* 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");
5044
-
5045
-
5032
+ /* 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");
5033
+ /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
5034
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
5035
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
5036
+ /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
5037
+ /* 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");
5038
+ /* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
5039
+ /* 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");
5040
+ /* 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");
5046
5041
 
5047
5042
  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); }
5048
5043
 
@@ -5051,175 +5046,149 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
5051
5046
 
5052
5047
 
5053
5048
 
5054
- class VictoryContainer extends (react__WEBPACK_IMPORTED_MODULE_3___default().Component) {
5055
- static displayName = "VictoryContainer";
5056
- static role = "container";
5057
- static defaultProps = {
5058
- className: "VictoryContainer",
5059
- portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__.Portal, null),
5060
- portalZIndex: 99,
5061
- responsive: true,
5062
- role: "img"
5063
- };
5064
- static contextType = _victory_util_timer_context__WEBPACK_IMPORTED_MODULE_5__["default"];
5065
-
5066
- // @ts-expect-error Ref will be initialized on mount
5067
-
5068
- // @ts-expect-error Ref will be initialized on mount
5069
-
5070
- constructor(props) {
5071
- super(props);
5072
- this.containerId = !lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default()(props) || props.containerId === undefined ? lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default()("victory-container-") : props.containerId;
5073
- this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
5074
- }
5075
- savePortalRef = portal => {
5076
- this.portalRef = portal;
5077
- return portal;
5049
+ const defaultProps = {
5050
+ className: "VictoryContainer",
5051
+ portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__.Portal, null),
5052
+ portalZIndex: 99,
5053
+ responsive: true,
5054
+ role: "img"
5055
+ };
5056
+ function useVictoryContainer(initialProps) {
5057
+ const props = {
5058
+ ...defaultProps,
5059
+ ...initialProps
5078
5060
  };
5079
- portalUpdate = (key, el) => this.portalRef.portalUpdate(key, el);
5080
- portalRegister = () => this.portalRef.portalRegister();
5081
- portalDeregister = key => this.portalRef.portalDeregister(key);
5082
- saveContainerRef = container => {
5083
- if (_victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(this.props.containerRef)) {
5084
- this.props.containerRef(container);
5085
- }
5086
- this.containerRef = container;
5087
- return container;
5061
+ const {
5062
+ title,
5063
+ desc,
5064
+ width,
5065
+ height,
5066
+ responsive
5067
+ } = props;
5068
+ const localContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
5069
+
5070
+ // Generated ID stored in ref because it needs to persist across renders
5071
+ const generatedId = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()("victory-container-"));
5072
+ const containerId = props.containerId ?? generatedId.current;
5073
+ const getIdForElement = elName => `${containerId}-${elName}`;
5074
+ const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
5075
+ const dimensions = responsive ? {
5076
+ width: "100%",
5077
+ height: "100%"
5078
+ } : {
5079
+ width,
5080
+ height
5088
5081
  };
5089
- handleWheel = e => e.preventDefault();
5090
- componentDidMount() {
5091
- if (this.shouldHandleWheel && this.containerRef) {
5092
- this.containerRef.addEventListener("wheel", this.handleWheel);
5093
- }
5094
- }
5095
- componentWillUnmount() {
5096
- if (this.shouldHandleWheel && this.containerRef) {
5097
- this.containerRef.removeEventListener("wheel", this.handleWheel);
5098
- }
5099
- }
5100
- getIdForElement(elementName) {
5101
- return `${this.containerId}-${elementName}`;
5102
- }
5103
-
5104
- // overridden in custom containers
5105
- getChildren(props) {
5106
- return props.children;
5107
- }
5108
-
5109
- // Get props defined by the Open UI Automation (OUIA) 1.0-RC spec
5110
- // See https://ouia.readthedocs.io/en/latest/README.html#ouia-component
5111
- getOUIAProps(props) {
5112
- const {
5113
- ouiaId,
5114
- ouiaSafe,
5115
- ouiaType
5116
- } = props;
5117
- return {
5118
- ...(ouiaId && {
5119
- "data-ouia-component-id": ouiaId
5120
- }),
5121
- ...(ouiaType && {
5122
- "data-ouia-component-type": ouiaType
5123
- }),
5124
- ...(ouiaSafe !== undefined && {
5125
- "data-ouia-safe": ouiaSafe
5126
- })
5127
- };
5128
- }
5129
- renderContainer(props, svgProps, style) {
5130
- const {
5131
- title,
5132
- desc,
5133
- portalComponent,
5134
- className,
5135
- width,
5136
- height,
5137
- portalZIndex,
5138
- responsive
5139
- } = props;
5140
- const children = this.getChildren(props);
5141
- const dimensions = responsive ? {
5142
- width: "100%",
5143
- height: "100%"
5144
- } : {
5145
- width,
5146
- height
5082
+ const viewBox = responsive ? `0 0 ${width} ${height}` : undefined;
5083
+ const preserveAspectRatio = responsive ? props.preserveAspectRatio : undefined;
5084
+ const ariaLabelledBy = [title && getIdForElement("title"), props["aria-labelledby"]].filter(Boolean).join(" ") || undefined;
5085
+ const ariaDescribedBy = [desc && getIdForElement("desc"), props["aria-describedby"]].filter(Boolean).join(" ") || undefined;
5086
+ const titleId = getIdForElement("title");
5087
+ const descId = getIdForElement("desc");
5088
+ return {
5089
+ ...props,
5090
+ titleId,
5091
+ descId,
5092
+ dimensions,
5093
+ viewBox,
5094
+ preserveAspectRatio,
5095
+ ariaLabelledBy,
5096
+ ariaDescribedBy,
5097
+ userProps,
5098
+ localContainerRef
5099
+ };
5100
+ }
5101
+ const VictoryContainer = initialProps => {
5102
+ const {
5103
+ role,
5104
+ title,
5105
+ desc,
5106
+ children,
5107
+ className,
5108
+ portalZIndex,
5109
+ portalComponent,
5110
+ width,
5111
+ height,
5112
+ style,
5113
+ tabIndex,
5114
+ responsive,
5115
+ events,
5116
+ ouiaId,
5117
+ ouiaSafe,
5118
+ ouiaType,
5119
+ dimensions,
5120
+ ariaDescribedBy,
5121
+ ariaLabelledBy,
5122
+ viewBox,
5123
+ preserveAspectRatio,
5124
+ userProps,
5125
+ titleId,
5126
+ descId,
5127
+ containerRef,
5128
+ localContainerRef
5129
+ } = useVictoryContainer(initialProps);
5130
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
5131
+ if (!events?.onWheel) return;
5132
+ const handleWheel = e => e.preventDefault();
5133
+ const container = localContainerRef?.current;
5134
+ container?.addEventListener("wheel", handleWheel);
5135
+ return () => {
5136
+ container?.removeEventListener("wheel", handleWheel);
5147
5137
  };
5148
- const divStyle = Object.assign({
5138
+ // eslint-disable-next-line react-hooks/exhaustive-deps
5139
+ }, []);
5140
+ 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", {
5141
+ className: className,
5142
+ style: {
5143
+ ...style,
5144
+ width: responsive ? style?.width : dimensions.width,
5145
+ height: responsive ? style?.height : dimensions.height,
5149
5146
  pointerEvents: "none",
5150
5147
  touchAction: "none",
5151
5148
  position: "relative"
5152
- }, dimensions);
5153
- const portalDivStyle = Object.assign({
5149
+ },
5150
+ "data-ouia-component-id": ouiaId,
5151
+ "data-ouia-component-type": ouiaType,
5152
+ "data-ouia-safe": ouiaSafe,
5153
+ ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_5__.mergeRefs)([localContainerRef, containerRef])
5154
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("svg", _extends({
5155
+ width: width,
5156
+ height: height,
5157
+ tabIndex: tabIndex,
5158
+ role: role,
5159
+ "aria-labelledby": ariaLabelledBy,
5160
+ "aria-describedby": ariaDescribedBy,
5161
+ viewBox: viewBox,
5162
+ preserveAspectRatio: preserveAspectRatio,
5163
+ style: {
5164
+ ...dimensions,
5165
+ pointerEvents: "all"
5166
+ }
5167
+ }, userProps, events), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("title", {
5168
+ id: titleId
5169
+ }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("desc", {
5170
+ id: descId
5171
+ }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
5172
+ style: {
5173
+ ...dimensions,
5154
5174
  zIndex: portalZIndex,
5155
5175
  position: "absolute",
5156
5176
  top: 0,
5157
5177
  left: 0
5158
- }, dimensions);
5159
- const svgStyle = Object.assign({
5160
- pointerEvents: "all"
5161
- }, dimensions);
5162
- const portalSvgStyle = Object.assign({
5178
+ }
5179
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__.PortalOutlet, {
5180
+ as: portalComponent,
5181
+ width: width,
5182
+ height: height,
5183
+ viewBox: viewBox,
5184
+ preserveAspectRatio: preserveAspectRatio,
5185
+ style: {
5186
+ ...dimensions,
5163
5187
  overflow: "visible"
5164
- }, dimensions);
5165
- const portalProps = {
5166
- width,
5167
- height,
5168
- viewBox: svgProps.viewBox,
5169
- preserveAspectRatio: svgProps.preserveAspectRatio,
5170
- style: portalSvgStyle
5171
- };
5172
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_7__.PortalContext.Provider, {
5173
- value: {
5174
- portalUpdate: this.portalUpdate,
5175
- portalRegister: this.portalRegister,
5176
- portalDeregister: this.portalDeregister
5177
- }
5178
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", _extends({
5179
- style: lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, style, divStyle),
5180
- className: className,
5181
- ref: this.saveContainerRef
5182
- }, this.getOUIAProps(props)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("svg", _extends({}, svgProps, {
5183
- style: svgStyle
5184
- }), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("title", {
5185
- id: this.getIdForElement("title")
5186
- }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("desc", {
5187
- id: this.getIdForElement("desc")
5188
- }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", {
5189
- style: portalDivStyle
5190
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().cloneElement(portalComponent, {
5191
- ...portalProps,
5192
- ref: this.savePortalRef
5193
- }))));
5194
- }
5195
- render() {
5196
- const {
5197
- width,
5198
- height,
5199
- responsive,
5200
- events,
5201
- title,
5202
- desc,
5203
- tabIndex,
5204
- preserveAspectRatio,
5205
- role
5206
- } = this.props;
5207
- const style = responsive ? this.props.style : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.omit(this.props.style, ["height", "width"]);
5208
- const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__.getSafeUserProps(this.props);
5209
- const svgProps = Object.assign({
5210
- width,
5211
- height,
5212
- tabIndex,
5213
- role,
5214
- "aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
5215
- "aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
5216
- viewBox: responsive ? `0 0 ${width} ${height}` : undefined,
5217
- preserveAspectRatio: responsive ? preserveAspectRatio : undefined,
5218
- ...userProps
5219
- }, events);
5220
- return this.renderContainer(this.props, svgProps, style);
5221
- }
5222
- }
5188
+ }
5189
+ }))));
5190
+ };
5191
+ VictoryContainer.role = "container";
5223
5192
 
5224
5193
  /***/ }),
5225
5194
 
@@ -5232,17 +5201,83 @@ class VictoryContainer extends (react__WEBPACK_IMPORTED_MODULE_3___default().Com
5232
5201
  "use strict";
5233
5202
  __webpack_require__.r(__webpack_exports__);
5234
5203
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5235
- /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; }
5204
+ /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; },
5205
+ /* harmony export */ "PortalProvider": function() { return /* binding */ PortalProvider; },
5206
+ /* harmony export */ "usePortalContext": function() { return /* binding */ usePortalContext; }
5236
5207
  /* harmony export */ });
5237
5208
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
5238
5209
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
5239
5210
 
5240
- /**
5241
- * The React context object consumers may use to access the context of the
5242
- * portal.
5243
- */
5244
- const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({});
5211
+ const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined);
5245
5212
  PortalContext.displayName = "PortalContext";
5213
+ const usePortalContext = () => {
5214
+ const context = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(PortalContext);
5215
+ if (!context) {
5216
+ throw new Error("`usePortalContext` must be used within a `<PortalProvider />`");
5217
+ }
5218
+ return context;
5219
+ };
5220
+ const PortalProvider = _ref => {
5221
+ let {
5222
+ children
5223
+ } = _ref;
5224
+ const [portalChildren, setPortalChildren] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(new Map());
5225
+ const addChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((id, element) => {
5226
+ setPortalChildren(prevChildren => {
5227
+ const nextChildren = new Map(prevChildren);
5228
+ nextChildren.set(id, element);
5229
+ return nextChildren;
5230
+ });
5231
+ }, [setPortalChildren]);
5232
+ const removeChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(id => {
5233
+ setPortalChildren(prevChildren => {
5234
+ const nextChildren = new Map(prevChildren);
5235
+ nextChildren.delete(id);
5236
+ return nextChildren;
5237
+ });
5238
+ }, [setPortalChildren]);
5239
+ const contextValue = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => ({
5240
+ addChild,
5241
+ removeChild,
5242
+ children: portalChildren
5243
+ }), [addChild, removeChild, portalChildren]);
5244
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PortalContext.Provider, {
5245
+ value: contextValue
5246
+ }, children);
5247
+ };
5248
+
5249
+ /***/ }),
5250
+
5251
+ /***/ "../../victory-core/es/victory-portal/portal-outlet.js":
5252
+ /*!*************************************************************!*\
5253
+ !*** ../../victory-core/es/victory-portal/portal-outlet.js ***!
5254
+ \*************************************************************/
5255
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
5256
+
5257
+ "use strict";
5258
+ __webpack_require__.r(__webpack_exports__);
5259
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5260
+ /* harmony export */ "PortalOutlet": function() { return /* binding */ PortalOutlet; }
5261
+ /* harmony export */ });
5262
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
5263
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
5264
+ /* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
5265
+
5266
+
5267
+ const PortalOutlet = _ref => {
5268
+ let {
5269
+ as: portalComponent,
5270
+ ...props
5271
+ } = _ref;
5272
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_1__.usePortalContext)();
5273
+ const children = Array.from(portalContext.children.entries()).map(_ref2 => {
5274
+ let [key, node] = _ref2;
5275
+ return !node.key ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(node, {
5276
+ key
5277
+ }) : node;
5278
+ });
5279
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(portalComponent, props, children);
5280
+ };
5246
5281
 
5247
5282
  /***/ }),
5248
5283
 
@@ -5259,39 +5294,13 @@ __webpack_require__.r(__webpack_exports__);
5259
5294
  /* harmony export */ });
5260
5295
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
5261
5296
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
5297
+ 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); }
5262
5298
 
5263
- class Portal extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) {
5264
- static displayName = "Portal";
5265
- constructor(props) {
5266
- super(props);
5267
- this.map = {};
5268
- this.index = 1;
5269
- }
5270
- portalRegister = () => {
5271
- return ++this.index;
5272
- };
5273
- portalUpdate = (key, element) => {
5274
- this.map[key] = element;
5275
- this.forceUpdate();
5276
- };
5277
- portalDeregister = key => {
5278
- delete this.map[key];
5279
- this.forceUpdate();
5280
- };
5281
- getChildren() {
5282
- return Object.keys(this.map).map(key => {
5283
- const el = this.map[key];
5284
- return el ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(el, {
5285
- key
5286
- }) : el;
5287
- });
5288
- }
5289
-
5290
- // Overridden in victory-core-native
5291
- render() {
5292
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", this.props, this.getChildren());
5293
- }
5294
- }
5299
+ const Portal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef((props, ref) => {
5300
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
5301
+ ref: ref
5302
+ }, props));
5303
+ });
5295
5304
 
5296
5305
  /***/ }),
5297
5306
 
@@ -8245,6 +8254,44 @@ function warn(message) {
8245
8254
 
8246
8255
  /***/ }),
8247
8256
 
8257
+ /***/ "../../victory-core/es/victory-util/merge-refs.js":
8258
+ /*!********************************************************!*\
8259
+ !*** ../../victory-core/es/victory-util/merge-refs.js ***!
8260
+ \********************************************************/
8261
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8262
+
8263
+ "use strict";
8264
+ __webpack_require__.r(__webpack_exports__);
8265
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8266
+ /* harmony export */ "mergeRefs": function() { return /* binding */ mergeRefs; }
8267
+ /* harmony export */ });
8268
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
8269
+
8270
+ /**
8271
+ * Used to merge multiple React refs into a single callback ref.
8272
+ *
8273
+ * @example
8274
+ * ```tsx
8275
+ * <div ref={mergeRefs([ref, forwardedRef])} />
8276
+ * ```
8277
+ */
8278
+ function mergeRefs(refs) {
8279
+ return value => {
8280
+ refs.forEach(ref => {
8281
+ // If the ref is a function, it's a callback ref and we call it with the value.
8282
+ if (_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction(ref)) {
8283
+ ref(value);
8284
+ } else if (ref !== null && ref !== undefined) {
8285
+ // If the ref is an object (not null and not undefined), it's an object ref.
8286
+ // We assign the value to its 'current' property.
8287
+ ref.current = value;
8288
+ }
8289
+ });
8290
+ };
8291
+ }
8292
+
8293
+ /***/ }),
8294
+
8248
8295
  /***/ "../../victory-core/es/victory-util/scale.js":
8249
8296
  /*!***************************************************!*\
8250
8297
  !*** ../../victory-core/es/victory-util/scale.js ***!