victory-stack 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-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
+
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
@@ -327,10 +327,7 @@ const VictoryStackBase = initialProps => {
327
327
  const {
328
328
  role
329
329
  } = VictoryStack;
330
- const propsWithDefaults = react__WEBPACK_IMPORTED_MODULE_2___default().useMemo(() => ({
331
- ...defaultProps,
332
- ...initialProps
333
- }), [initialProps]);
330
+ const propsWithDefaults = react__WEBPACK_IMPORTED_MODULE_2___default().useMemo(() => lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, initialProps, defaultProps), [initialProps]);
334
331
  const {
335
332
  setAnimationState,
336
333
  getAnimationProps,
@@ -5029,23 +5026,18 @@ module.exports = function isEqual(a, b) {
5029
5026
  "use strict";
5030
5027
  __webpack_require__.r(__webpack_exports__);
5031
5028
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5032
- /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; }
5029
+ /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
5030
+ /* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
5033
5031
  /* harmony export */ });
5034
- /* 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");
5035
- /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_isObject__WEBPACK_IMPORTED_MODULE_0__);
5036
- /* 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");
5037
- /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1__);
5038
- /* 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");
5039
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_2__);
5040
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "react");
5041
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
5042
- /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
5043
- /* 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");
5044
- /* 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");
5045
- /* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
5046
- /* 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");
5047
-
5048
-
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");
5049
5041
 
5050
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); }
5051
5043
 
@@ -5054,175 +5046,149 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
5054
5046
 
5055
5047
 
5056
5048
 
5057
- class VictoryContainer extends (react__WEBPACK_IMPORTED_MODULE_3___default().Component) {
5058
- static displayName = "VictoryContainer";
5059
- static role = "container";
5060
- static defaultProps = {
5061
- className: "VictoryContainer",
5062
- portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__.Portal, null),
5063
- portalZIndex: 99,
5064
- responsive: true,
5065
- role: "img"
5066
- };
5067
- static contextType = _victory_util_timer_context__WEBPACK_IMPORTED_MODULE_5__["default"];
5068
-
5069
- // @ts-expect-error Ref will be initialized on mount
5070
-
5071
- // @ts-expect-error Ref will be initialized on mount
5072
-
5073
- constructor(props) {
5074
- super(props);
5075
- this.containerId = !lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default()(props) || props.containerId === undefined ? lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default()("victory-container-") : props.containerId;
5076
- this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
5077
- }
5078
- savePortalRef = portal => {
5079
- this.portalRef = portal;
5080
- 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
5081
5060
  };
5082
- portalUpdate = (key, el) => this.portalRef.portalUpdate(key, el);
5083
- portalRegister = () => this.portalRef.portalRegister();
5084
- portalDeregister = key => this.portalRef.portalDeregister(key);
5085
- saveContainerRef = container => {
5086
- if (_victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(this.props.containerRef)) {
5087
- this.props.containerRef(container);
5088
- }
5089
- this.containerRef = container;
5090
- 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
5091
5081
  };
5092
- handleWheel = e => e.preventDefault();
5093
- componentDidMount() {
5094
- if (this.shouldHandleWheel && this.containerRef) {
5095
- this.containerRef.addEventListener("wheel", this.handleWheel);
5096
- }
5097
- }
5098
- componentWillUnmount() {
5099
- if (this.shouldHandleWheel && this.containerRef) {
5100
- this.containerRef.removeEventListener("wheel", this.handleWheel);
5101
- }
5102
- }
5103
- getIdForElement(elementName) {
5104
- return `${this.containerId}-${elementName}`;
5105
- }
5106
-
5107
- // overridden in custom containers
5108
- getChildren(props) {
5109
- return props.children;
5110
- }
5111
-
5112
- // Get props defined by the Open UI Automation (OUIA) 1.0-RC spec
5113
- // See https://ouia.readthedocs.io/en/latest/README.html#ouia-component
5114
- getOUIAProps(props) {
5115
- const {
5116
- ouiaId,
5117
- ouiaSafe,
5118
- ouiaType
5119
- } = props;
5120
- return {
5121
- ...(ouiaId && {
5122
- "data-ouia-component-id": ouiaId
5123
- }),
5124
- ...(ouiaType && {
5125
- "data-ouia-component-type": ouiaType
5126
- }),
5127
- ...(ouiaSafe !== undefined && {
5128
- "data-ouia-safe": ouiaSafe
5129
- })
5130
- };
5131
- }
5132
- renderContainer(props, svgProps, style) {
5133
- const {
5134
- title,
5135
- desc,
5136
- portalComponent,
5137
- className,
5138
- width,
5139
- height,
5140
- portalZIndex,
5141
- responsive
5142
- } = props;
5143
- const children = this.getChildren(props);
5144
- const dimensions = responsive ? {
5145
- width: "100%",
5146
- height: "100%"
5147
- } : {
5148
- width,
5149
- 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);
5150
5137
  };
5151
- 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,
5152
5146
  pointerEvents: "none",
5153
5147
  touchAction: "none",
5154
5148
  position: "relative"
5155
- }, dimensions);
5156
- 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,
5157
5174
  zIndex: portalZIndex,
5158
5175
  position: "absolute",
5159
5176
  top: 0,
5160
5177
  left: 0
5161
- }, dimensions);
5162
- const svgStyle = Object.assign({
5163
- pointerEvents: "all"
5164
- }, dimensions);
5165
- 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,
5166
5187
  overflow: "visible"
5167
- }, dimensions);
5168
- const portalProps = {
5169
- width,
5170
- height,
5171
- viewBox: svgProps.viewBox,
5172
- preserveAspectRatio: svgProps.preserveAspectRatio,
5173
- style: portalSvgStyle
5174
- };
5175
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_7__.PortalContext.Provider, {
5176
- value: {
5177
- portalUpdate: this.portalUpdate,
5178
- portalRegister: this.portalRegister,
5179
- portalDeregister: this.portalDeregister
5180
- }
5181
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", _extends({
5182
- style: lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, style, divStyle),
5183
- className: className,
5184
- ref: this.saveContainerRef
5185
- }, this.getOUIAProps(props)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("svg", _extends({}, svgProps, {
5186
- style: svgStyle
5187
- }), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("title", {
5188
- id: this.getIdForElement("title")
5189
- }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("desc", {
5190
- id: this.getIdForElement("desc")
5191
- }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", {
5192
- style: portalDivStyle
5193
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().cloneElement(portalComponent, {
5194
- ...portalProps,
5195
- ref: this.savePortalRef
5196
- }))));
5197
- }
5198
- render() {
5199
- const {
5200
- width,
5201
- height,
5202
- responsive,
5203
- events,
5204
- title,
5205
- desc,
5206
- tabIndex,
5207
- preserveAspectRatio,
5208
- role
5209
- } = this.props;
5210
- const style = responsive ? this.props.style : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.omit(this.props.style, ["height", "width"]);
5211
- const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__.getSafeUserProps(this.props);
5212
- const svgProps = Object.assign({
5213
- width,
5214
- height,
5215
- tabIndex,
5216
- role,
5217
- "aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
5218
- "aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
5219
- viewBox: responsive ? `0 0 ${width} ${height}` : undefined,
5220
- preserveAspectRatio: responsive ? preserveAspectRatio : undefined,
5221
- ...userProps
5222
- }, events);
5223
- return this.renderContainer(this.props, svgProps, style);
5224
- }
5225
- }
5188
+ }
5189
+ }))));
5190
+ };
5191
+ VictoryContainer.role = "container";
5226
5192
 
5227
5193
  /***/ }),
5228
5194
 
@@ -5235,17 +5201,83 @@ class VictoryContainer extends (react__WEBPACK_IMPORTED_MODULE_3___default().Com
5235
5201
  "use strict";
5236
5202
  __webpack_require__.r(__webpack_exports__);
5237
5203
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5238
- /* 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; }
5239
5207
  /* harmony export */ });
5240
5208
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
5241
5209
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
5242
5210
 
5243
- /**
5244
- * The React context object consumers may use to access the context of the
5245
- * portal.
5246
- */
5247
- const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({});
5211
+ const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined);
5248
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
+ };
5249
5281
 
5250
5282
  /***/ }),
5251
5283
 
@@ -5262,39 +5294,13 @@ __webpack_require__.r(__webpack_exports__);
5262
5294
  /* harmony export */ });
5263
5295
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
5264
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); }
5265
5298
 
5266
- class Portal extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) {
5267
- static displayName = "Portal";
5268
- constructor(props) {
5269
- super(props);
5270
- this.map = {};
5271
- this.index = 1;
5272
- }
5273
- portalRegister = () => {
5274
- return ++this.index;
5275
- };
5276
- portalUpdate = (key, element) => {
5277
- this.map[key] = element;
5278
- this.forceUpdate();
5279
- };
5280
- portalDeregister = key => {
5281
- delete this.map[key];
5282
- this.forceUpdate();
5283
- };
5284
- getChildren() {
5285
- return Object.keys(this.map).map(key => {
5286
- const el = this.map[key];
5287
- return el ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(el, {
5288
- key
5289
- }) : el;
5290
- });
5291
- }
5292
-
5293
- // Overridden in victory-core-native
5294
- render() {
5295
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", this.props, this.getChildren());
5296
- }
5297
- }
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
+ });
5298
5304
 
5299
5305
  /***/ }),
5300
5306
 
@@ -8248,6 +8254,44 @@ function warn(message) {
8248
8254
 
8249
8255
  /***/ }),
8250
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
+
8251
8295
  /***/ "../../victory-core/es/victory-util/scale.js":
8252
8296
  /*!***************************************************!*\
8253
8297
  !*** ../../victory-core/es/victory-util/scale.js ***!