victory-scatter 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,12 @@
1
1
  # victory-scatter
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
+
3
10
  ## 37.0.2
4
11
 
5
12
  ## 37.0.1
@@ -5094,23 +5094,18 @@ const VictoryAnimation = _ref => {
5094
5094
  "use strict";
5095
5095
  __webpack_require__.r(__webpack_exports__);
5096
5096
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5097
- /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; }
5097
+ /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
5098
+ /* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
5098
5099
  /* harmony export */ });
5099
- /* 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");
5100
- /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_isObject__WEBPACK_IMPORTED_MODULE_0__);
5101
- /* 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");
5102
- /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1__);
5103
- /* 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");
5104
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_2__);
5105
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "react");
5106
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
5107
- /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
5108
- /* 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");
5109
- /* 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");
5110
- /* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
5111
- /* 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");
5112
-
5113
-
5100
+ /* 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");
5101
+ /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
5102
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
5103
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
5104
+ /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
5105
+ /* 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");
5106
+ /* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
5107
+ /* 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");
5108
+ /* 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");
5114
5109
 
5115
5110
  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); }
5116
5111
 
@@ -5119,175 +5114,149 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
5119
5114
 
5120
5115
 
5121
5116
 
5122
- class VictoryContainer extends (react__WEBPACK_IMPORTED_MODULE_3___default().Component) {
5123
- static displayName = "VictoryContainer";
5124
- static role = "container";
5125
- static defaultProps = {
5126
- className: "VictoryContainer",
5127
- portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__.Portal, null),
5128
- portalZIndex: 99,
5129
- responsive: true,
5130
- role: "img"
5117
+ const defaultProps = {
5118
+ className: "VictoryContainer",
5119
+ portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__.Portal, null),
5120
+ portalZIndex: 99,
5121
+ responsive: true,
5122
+ role: "img"
5123
+ };
5124
+ function useVictoryContainer(initialProps) {
5125
+ const props = {
5126
+ ...defaultProps,
5127
+ ...initialProps
5131
5128
  };
5132
- static contextType = _victory_util_timer_context__WEBPACK_IMPORTED_MODULE_5__["default"];
5133
-
5134
- // @ts-expect-error Ref will be initialized on mount
5135
-
5136
- // @ts-expect-error Ref will be initialized on mount
5137
-
5138
- constructor(props) {
5139
- super(props);
5140
- this.containerId = !lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default()(props) || props.containerId === undefined ? lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default()("victory-container-") : props.containerId;
5141
- this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
5142
- }
5143
- savePortalRef = portal => {
5144
- this.portalRef = portal;
5145
- return portal;
5129
+ const {
5130
+ title,
5131
+ desc,
5132
+ width,
5133
+ height,
5134
+ responsive
5135
+ } = props;
5136
+ const localContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
5137
+
5138
+ // Generated ID stored in ref because it needs to persist across renders
5139
+ const generatedId = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()("victory-container-"));
5140
+ const containerId = props.containerId ?? generatedId.current;
5141
+ const getIdForElement = elName => `${containerId}-${elName}`;
5142
+ const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
5143
+ const dimensions = responsive ? {
5144
+ width: "100%",
5145
+ height: "100%"
5146
+ } : {
5147
+ width,
5148
+ height
5146
5149
  };
5147
- portalUpdate = (key, el) => this.portalRef.portalUpdate(key, el);
5148
- portalRegister = () => this.portalRef.portalRegister();
5149
- portalDeregister = key => this.portalRef.portalDeregister(key);
5150
- saveContainerRef = container => {
5151
- if (_victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(this.props.containerRef)) {
5152
- this.props.containerRef(container);
5153
- }
5154
- this.containerRef = container;
5155
- return container;
5150
+ const viewBox = responsive ? `0 0 ${width} ${height}` : undefined;
5151
+ const preserveAspectRatio = responsive ? props.preserveAspectRatio : undefined;
5152
+ const ariaLabelledBy = [title && getIdForElement("title"), props["aria-labelledby"]].filter(Boolean).join(" ") || undefined;
5153
+ const ariaDescribedBy = [desc && getIdForElement("desc"), props["aria-describedby"]].filter(Boolean).join(" ") || undefined;
5154
+ const titleId = getIdForElement("title");
5155
+ const descId = getIdForElement("desc");
5156
+ return {
5157
+ ...props,
5158
+ titleId,
5159
+ descId,
5160
+ dimensions,
5161
+ viewBox,
5162
+ preserveAspectRatio,
5163
+ ariaLabelledBy,
5164
+ ariaDescribedBy,
5165
+ userProps,
5166
+ localContainerRef
5156
5167
  };
5157
- handleWheel = e => e.preventDefault();
5158
- componentDidMount() {
5159
- if (this.shouldHandleWheel && this.containerRef) {
5160
- this.containerRef.addEventListener("wheel", this.handleWheel);
5161
- }
5162
- }
5163
- componentWillUnmount() {
5164
- if (this.shouldHandleWheel && this.containerRef) {
5165
- this.containerRef.removeEventListener("wheel", this.handleWheel);
5166
- }
5167
- }
5168
- getIdForElement(elementName) {
5169
- return `${this.containerId}-${elementName}`;
5170
- }
5171
-
5172
- // overridden in custom containers
5173
- getChildren(props) {
5174
- return props.children;
5175
- }
5176
-
5177
- // Get props defined by the Open UI Automation (OUIA) 1.0-RC spec
5178
- // See https://ouia.readthedocs.io/en/latest/README.html#ouia-component
5179
- getOUIAProps(props) {
5180
- const {
5181
- ouiaId,
5182
- ouiaSafe,
5183
- ouiaType
5184
- } = props;
5185
- return {
5186
- ...(ouiaId && {
5187
- "data-ouia-component-id": ouiaId
5188
- }),
5189
- ...(ouiaType && {
5190
- "data-ouia-component-type": ouiaType
5191
- }),
5192
- ...(ouiaSafe !== undefined && {
5193
- "data-ouia-safe": ouiaSafe
5194
- })
5195
- };
5196
- }
5197
- renderContainer(props, svgProps, style) {
5198
- const {
5199
- title,
5200
- desc,
5201
- portalComponent,
5202
- className,
5203
- width,
5204
- height,
5205
- portalZIndex,
5206
- responsive
5207
- } = props;
5208
- const children = this.getChildren(props);
5209
- const dimensions = responsive ? {
5210
- width: "100%",
5211
- height: "100%"
5212
- } : {
5213
- width,
5214
- height
5168
+ }
5169
+ const VictoryContainer = initialProps => {
5170
+ const {
5171
+ role,
5172
+ title,
5173
+ desc,
5174
+ children,
5175
+ className,
5176
+ portalZIndex,
5177
+ portalComponent,
5178
+ width,
5179
+ height,
5180
+ style,
5181
+ tabIndex,
5182
+ responsive,
5183
+ events,
5184
+ ouiaId,
5185
+ ouiaSafe,
5186
+ ouiaType,
5187
+ dimensions,
5188
+ ariaDescribedBy,
5189
+ ariaLabelledBy,
5190
+ viewBox,
5191
+ preserveAspectRatio,
5192
+ userProps,
5193
+ titleId,
5194
+ descId,
5195
+ containerRef,
5196
+ localContainerRef
5197
+ } = useVictoryContainer(initialProps);
5198
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
5199
+ if (!events?.onWheel) return;
5200
+ const handleWheel = e => e.preventDefault();
5201
+ const container = localContainerRef?.current;
5202
+ container?.addEventListener("wheel", handleWheel);
5203
+ return () => {
5204
+ container?.removeEventListener("wheel", handleWheel);
5215
5205
  };
5216
- const divStyle = Object.assign({
5206
+ // eslint-disable-next-line react-hooks/exhaustive-deps
5207
+ }, []);
5208
+ 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", {
5209
+ className: className,
5210
+ style: {
5211
+ ...style,
5212
+ width: responsive ? style?.width : dimensions.width,
5213
+ height: responsive ? style?.height : dimensions.height,
5217
5214
  pointerEvents: "none",
5218
5215
  touchAction: "none",
5219
5216
  position: "relative"
5220
- }, dimensions);
5221
- const portalDivStyle = Object.assign({
5217
+ },
5218
+ "data-ouia-component-id": ouiaId,
5219
+ "data-ouia-component-type": ouiaType,
5220
+ "data-ouia-safe": ouiaSafe,
5221
+ ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_5__.mergeRefs)([localContainerRef, containerRef])
5222
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("svg", _extends({
5223
+ width: width,
5224
+ height: height,
5225
+ tabIndex: tabIndex,
5226
+ role: role,
5227
+ "aria-labelledby": ariaLabelledBy,
5228
+ "aria-describedby": ariaDescribedBy,
5229
+ viewBox: viewBox,
5230
+ preserveAspectRatio: preserveAspectRatio,
5231
+ style: {
5232
+ ...dimensions,
5233
+ pointerEvents: "all"
5234
+ }
5235
+ }, userProps, events), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("title", {
5236
+ id: titleId
5237
+ }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("desc", {
5238
+ id: descId
5239
+ }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
5240
+ style: {
5241
+ ...dimensions,
5222
5242
  zIndex: portalZIndex,
5223
5243
  position: "absolute",
5224
5244
  top: 0,
5225
5245
  left: 0
5226
- }, dimensions);
5227
- const svgStyle = Object.assign({
5228
- pointerEvents: "all"
5229
- }, dimensions);
5230
- const portalSvgStyle = Object.assign({
5246
+ }
5247
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__.PortalOutlet, {
5248
+ as: portalComponent,
5249
+ width: width,
5250
+ height: height,
5251
+ viewBox: viewBox,
5252
+ preserveAspectRatio: preserveAspectRatio,
5253
+ style: {
5254
+ ...dimensions,
5231
5255
  overflow: "visible"
5232
- }, dimensions);
5233
- const portalProps = {
5234
- width,
5235
- height,
5236
- viewBox: svgProps.viewBox,
5237
- preserveAspectRatio: svgProps.preserveAspectRatio,
5238
- style: portalSvgStyle
5239
- };
5240
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_7__.PortalContext.Provider, {
5241
- value: {
5242
- portalUpdate: this.portalUpdate,
5243
- portalRegister: this.portalRegister,
5244
- portalDeregister: this.portalDeregister
5245
- }
5246
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", _extends({
5247
- style: lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, style, divStyle),
5248
- className: className,
5249
- ref: this.saveContainerRef
5250
- }, this.getOUIAProps(props)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("svg", _extends({}, svgProps, {
5251
- style: svgStyle
5252
- }), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("title", {
5253
- id: this.getIdForElement("title")
5254
- }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("desc", {
5255
- id: this.getIdForElement("desc")
5256
- }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", {
5257
- style: portalDivStyle
5258
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().cloneElement(portalComponent, {
5259
- ...portalProps,
5260
- ref: this.savePortalRef
5261
- }))));
5262
- }
5263
- render() {
5264
- const {
5265
- width,
5266
- height,
5267
- responsive,
5268
- events,
5269
- title,
5270
- desc,
5271
- tabIndex,
5272
- preserveAspectRatio,
5273
- role
5274
- } = this.props;
5275
- const style = responsive ? this.props.style : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.omit(this.props.style, ["height", "width"]);
5276
- const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__.getSafeUserProps(this.props);
5277
- const svgProps = Object.assign({
5278
- width,
5279
- height,
5280
- tabIndex,
5281
- role,
5282
- "aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
5283
- "aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
5284
- viewBox: responsive ? `0 0 ${width} ${height}` : undefined,
5285
- preserveAspectRatio: responsive ? preserveAspectRatio : undefined,
5286
- ...userProps
5287
- }, events);
5288
- return this.renderContainer(this.props, svgProps, style);
5289
- }
5290
- }
5256
+ }
5257
+ }))));
5258
+ };
5259
+ VictoryContainer.role = "container";
5291
5260
 
5292
5261
  /***/ }),
5293
5262
 
@@ -5800,17 +5769,83 @@ VictoryLabel.defaultStyles = defaultStyles;
5800
5769
  "use strict";
5801
5770
  __webpack_require__.r(__webpack_exports__);
5802
5771
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5803
- /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; }
5772
+ /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; },
5773
+ /* harmony export */ "PortalProvider": function() { return /* binding */ PortalProvider; },
5774
+ /* harmony export */ "usePortalContext": function() { return /* binding */ usePortalContext; }
5804
5775
  /* harmony export */ });
5805
5776
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
5806
5777
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
5807
5778
 
5808
- /**
5809
- * The React context object consumers may use to access the context of the
5810
- * portal.
5811
- */
5812
- const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({});
5779
+ const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined);
5813
5780
  PortalContext.displayName = "PortalContext";
5781
+ const usePortalContext = () => {
5782
+ const context = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(PortalContext);
5783
+ if (!context) {
5784
+ throw new Error("`usePortalContext` must be used within a `<PortalProvider />`");
5785
+ }
5786
+ return context;
5787
+ };
5788
+ const PortalProvider = _ref => {
5789
+ let {
5790
+ children
5791
+ } = _ref;
5792
+ const [portalChildren, setPortalChildren] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(new Map());
5793
+ const addChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((id, element) => {
5794
+ setPortalChildren(prevChildren => {
5795
+ const nextChildren = new Map(prevChildren);
5796
+ nextChildren.set(id, element);
5797
+ return nextChildren;
5798
+ });
5799
+ }, [setPortalChildren]);
5800
+ const removeChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(id => {
5801
+ setPortalChildren(prevChildren => {
5802
+ const nextChildren = new Map(prevChildren);
5803
+ nextChildren.delete(id);
5804
+ return nextChildren;
5805
+ });
5806
+ }, [setPortalChildren]);
5807
+ const contextValue = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => ({
5808
+ addChild,
5809
+ removeChild,
5810
+ children: portalChildren
5811
+ }), [addChild, removeChild, portalChildren]);
5812
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PortalContext.Provider, {
5813
+ value: contextValue
5814
+ }, children);
5815
+ };
5816
+
5817
+ /***/ }),
5818
+
5819
+ /***/ "../../victory-core/es/victory-portal/portal-outlet.js":
5820
+ /*!*************************************************************!*\
5821
+ !*** ../../victory-core/es/victory-portal/portal-outlet.js ***!
5822
+ \*************************************************************/
5823
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
5824
+
5825
+ "use strict";
5826
+ __webpack_require__.r(__webpack_exports__);
5827
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5828
+ /* harmony export */ "PortalOutlet": function() { return /* binding */ PortalOutlet; }
5829
+ /* harmony export */ });
5830
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
5831
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
5832
+ /* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
5833
+
5834
+
5835
+ const PortalOutlet = _ref => {
5836
+ let {
5837
+ as: portalComponent,
5838
+ ...props
5839
+ } = _ref;
5840
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_1__.usePortalContext)();
5841
+ const children = Array.from(portalContext.children.entries()).map(_ref2 => {
5842
+ let [key, node] = _ref2;
5843
+ return !node.key ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(node, {
5844
+ key
5845
+ }) : node;
5846
+ });
5847
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(portalComponent, props, children);
5848
+ };
5814
5849
 
5815
5850
  /***/ }),
5816
5851
 
@@ -5827,39 +5862,13 @@ __webpack_require__.r(__webpack_exports__);
5827
5862
  /* harmony export */ });
5828
5863
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
5829
5864
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
5865
+ 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); }
5830
5866
 
5831
- class Portal extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) {
5832
- static displayName = "Portal";
5833
- constructor(props) {
5834
- super(props);
5835
- this.map = {};
5836
- this.index = 1;
5837
- }
5838
- portalRegister = () => {
5839
- return ++this.index;
5840
- };
5841
- portalUpdate = (key, element) => {
5842
- this.map[key] = element;
5843
- this.forceUpdate();
5844
- };
5845
- portalDeregister = key => {
5846
- delete this.map[key];
5847
- this.forceUpdate();
5848
- };
5849
- getChildren() {
5850
- return Object.keys(this.map).map(key => {
5851
- const el = this.map[key];
5852
- return el ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(el, {
5853
- key
5854
- }) : el;
5855
- });
5856
- }
5857
-
5858
- // Overridden in victory-core-native
5859
- render() {
5860
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", this.props, this.getChildren());
5861
- }
5862
- }
5867
+ const Portal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef((props, ref) => {
5868
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
5869
+ ref: ref
5870
+ }, props));
5871
+ });
5863
5872
 
5864
5873
  /***/ }),
5865
5874
 
@@ -5886,59 +5895,42 @@ __webpack_require__.r(__webpack_exports__);
5886
5895
 
5887
5896
 
5888
5897
 
5889
- class VictoryPortal extends (react__WEBPACK_IMPORTED_MODULE_1___default().Component) {
5890
- static displayName = "VictoryPortal";
5891
- static role = "portal";
5892
- static defaultProps = {
5893
- groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
5898
+ const defaultProps = {
5899
+ groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
5900
+ };
5901
+ const VictoryPortal = initialProps => {
5902
+ const props = {
5903
+ ...defaultProps,
5904
+ ...initialProps
5894
5905
  };
5895
- static contextType = _portal_context__WEBPACK_IMPORTED_MODULE_2__.PortalContext;
5896
- componentDidMount() {
5897
- if (!this.checkedContext) {
5898
- if (typeof this.context.portalUpdate !== "function") {
5899
- const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
5900
- _victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
5901
- this.renderInPlace = true;
5902
- }
5903
- this.checkedContext = true;
5904
- }
5905
- this.forceUpdate();
5906
- }
5907
- componentDidUpdate() {
5908
- if (!this.renderInPlace) {
5909
- this.portalKey = this.portalKey || this.context.portalRegister();
5910
- this.context.portalUpdate(this.portalKey, this.element);
5911
- }
5912
- }
5913
- componentWillUnmount() {
5914
- if (this.context && this.context.portalDeregister) {
5915
- this.context.portalDeregister(this.portalKey);
5916
- }
5917
- }
5918
-
5919
- // Overridden in victory-core-native
5920
- renderPortal(child) {
5921
- if (this.renderInPlace) {
5922
- return child;
5923
- }
5924
- this.element = child;
5925
- return null;
5926
- }
5927
- render() {
5928
- const children = Array.isArray(this.props.children) ? this.props.children[0] : this.props.children;
5906
+ const id = react__WEBPACK_IMPORTED_MODULE_1___default().useId();
5907
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_2__.usePortalContext)();
5908
+ if (!portalContext) {
5909
+ const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
5910
+ _victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
5911
+ }
5912
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
5913
+ const children = Array.isArray(props.children) ? props.children[0] : props.children;
5929
5914
  const {
5930
5915
  groupComponent
5931
- } = this.props;
5916
+ } = props;
5932
5917
  const childProps = children && children.props || {};
5933
5918
  const standardProps = childProps.groupComponent ? {
5934
5919
  groupComponent,
5935
5920
  standalone: false
5936
5921
  } : {};
5937
- const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(this.props, ["children", "groupComponent"]));
5922
+ const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(props, ["children", "groupComponent"]));
5938
5923
  const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
5939
- return this.renderPortal(child);
5940
- }
5941
- }
5924
+ portalContext.addChild(id, child);
5925
+ // eslint-disable-next-line react-hooks/exhaustive-deps
5926
+ }, [props.children]);
5927
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
5928
+ return () => portalContext.removeChild(id);
5929
+ // eslint-disable-next-line react-hooks/exhaustive-deps
5930
+ }, []);
5931
+ return null;
5932
+ };
5933
+ VictoryPortal.role = "portal";
5942
5934
 
5943
5935
  /***/ }),
5944
5936
 
@@ -9489,6 +9481,44 @@ function warn(message) {
9489
9481
 
9490
9482
  /***/ }),
9491
9483
 
9484
+ /***/ "../../victory-core/es/victory-util/merge-refs.js":
9485
+ /*!********************************************************!*\
9486
+ !*** ../../victory-core/es/victory-util/merge-refs.js ***!
9487
+ \********************************************************/
9488
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
9489
+
9490
+ "use strict";
9491
+ __webpack_require__.r(__webpack_exports__);
9492
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9493
+ /* harmony export */ "mergeRefs": function() { return /* binding */ mergeRefs; }
9494
+ /* harmony export */ });
9495
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
9496
+
9497
+ /**
9498
+ * Used to merge multiple React refs into a single callback ref.
9499
+ *
9500
+ * @example
9501
+ * ```tsx
9502
+ * <div ref={mergeRefs([ref, forwardedRef])} />
9503
+ * ```
9504
+ */
9505
+ function mergeRefs(refs) {
9506
+ return value => {
9507
+ refs.forEach(ref => {
9508
+ // If the ref is a function, it's a callback ref and we call it with the value.
9509
+ if (_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction(ref)) {
9510
+ ref(value);
9511
+ } else if (ref !== null && ref !== undefined) {
9512
+ // If the ref is an object (not null and not undefined), it's an object ref.
9513
+ // We assign the value to its 'current' property.
9514
+ ref.current = value;
9515
+ }
9516
+ });
9517
+ };
9518
+ }
9519
+
9520
+ /***/ }),
9521
+
9492
9522
  /***/ "../../victory-core/es/victory-util/point-path-helpers.js":
9493
9523
  /*!****************************************************************!*\
9494
9524
  !*** ../../victory-core/es/victory-util/point-path-helpers.js ***!