victory-pie 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-pie
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-vendor@37.0.3-next.0
10
+
3
11
  ## 37.0.2
4
12
 
5
13
  ### Patch Changes
@@ -5298,23 +5298,18 @@ const VictoryAnimation = _ref => {
5298
5298
  "use strict";
5299
5299
  __webpack_require__.r(__webpack_exports__);
5300
5300
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5301
- /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; }
5301
+ /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
5302
+ /* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
5302
5303
  /* harmony export */ });
5303
- /* 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");
5304
- /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_isObject__WEBPACK_IMPORTED_MODULE_0__);
5305
- /* 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");
5306
- /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1__);
5307
- /* 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");
5308
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_2__);
5309
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "react");
5310
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
5311
- /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
5312
- /* 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");
5313
- /* 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");
5314
- /* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
5315
- /* 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");
5316
-
5317
-
5304
+ /* 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");
5305
+ /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
5306
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
5307
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
5308
+ /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
5309
+ /* 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");
5310
+ /* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
5311
+ /* 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");
5312
+ /* 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");
5318
5313
 
5319
5314
  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); }
5320
5315
 
@@ -5323,175 +5318,149 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
5323
5318
 
5324
5319
 
5325
5320
 
5326
- class VictoryContainer extends (react__WEBPACK_IMPORTED_MODULE_3___default().Component) {
5327
- static displayName = "VictoryContainer";
5328
- static role = "container";
5329
- static defaultProps = {
5330
- className: "VictoryContainer",
5331
- portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__.Portal, null),
5332
- portalZIndex: 99,
5333
- responsive: true,
5334
- role: "img"
5335
- };
5336
- static contextType = _victory_util_timer_context__WEBPACK_IMPORTED_MODULE_5__["default"];
5337
-
5338
- // @ts-expect-error Ref will be initialized on mount
5339
-
5340
- // @ts-expect-error Ref will be initialized on mount
5341
-
5342
- constructor(props) {
5343
- super(props);
5344
- this.containerId = !lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default()(props) || props.containerId === undefined ? lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default()("victory-container-") : props.containerId;
5345
- this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
5346
- }
5347
- savePortalRef = portal => {
5348
- this.portalRef = portal;
5349
- return portal;
5321
+ const defaultProps = {
5322
+ className: "VictoryContainer",
5323
+ portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__.Portal, null),
5324
+ portalZIndex: 99,
5325
+ responsive: true,
5326
+ role: "img"
5327
+ };
5328
+ function useVictoryContainer(initialProps) {
5329
+ const props = {
5330
+ ...defaultProps,
5331
+ ...initialProps
5350
5332
  };
5351
- portalUpdate = (key, el) => this.portalRef.portalUpdate(key, el);
5352
- portalRegister = () => this.portalRef.portalRegister();
5353
- portalDeregister = key => this.portalRef.portalDeregister(key);
5354
- saveContainerRef = container => {
5355
- if (_victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(this.props.containerRef)) {
5356
- this.props.containerRef(container);
5357
- }
5358
- this.containerRef = container;
5359
- return container;
5333
+ const {
5334
+ title,
5335
+ desc,
5336
+ width,
5337
+ height,
5338
+ responsive
5339
+ } = props;
5340
+ const localContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
5341
+
5342
+ // Generated ID stored in ref because it needs to persist across renders
5343
+ const generatedId = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()("victory-container-"));
5344
+ const containerId = props.containerId ?? generatedId.current;
5345
+ const getIdForElement = elName => `${containerId}-${elName}`;
5346
+ const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
5347
+ const dimensions = responsive ? {
5348
+ width: "100%",
5349
+ height: "100%"
5350
+ } : {
5351
+ width,
5352
+ height
5360
5353
  };
5361
- handleWheel = e => e.preventDefault();
5362
- componentDidMount() {
5363
- if (this.shouldHandleWheel && this.containerRef) {
5364
- this.containerRef.addEventListener("wheel", this.handleWheel);
5365
- }
5366
- }
5367
- componentWillUnmount() {
5368
- if (this.shouldHandleWheel && this.containerRef) {
5369
- this.containerRef.removeEventListener("wheel", this.handleWheel);
5370
- }
5371
- }
5372
- getIdForElement(elementName) {
5373
- return `${this.containerId}-${elementName}`;
5374
- }
5375
-
5376
- // overridden in custom containers
5377
- getChildren(props) {
5378
- return props.children;
5379
- }
5380
-
5381
- // Get props defined by the Open UI Automation (OUIA) 1.0-RC spec
5382
- // See https://ouia.readthedocs.io/en/latest/README.html#ouia-component
5383
- getOUIAProps(props) {
5384
- const {
5385
- ouiaId,
5386
- ouiaSafe,
5387
- ouiaType
5388
- } = props;
5389
- return {
5390
- ...(ouiaId && {
5391
- "data-ouia-component-id": ouiaId
5392
- }),
5393
- ...(ouiaType && {
5394
- "data-ouia-component-type": ouiaType
5395
- }),
5396
- ...(ouiaSafe !== undefined && {
5397
- "data-ouia-safe": ouiaSafe
5398
- })
5399
- };
5400
- }
5401
- renderContainer(props, svgProps, style) {
5402
- const {
5403
- title,
5404
- desc,
5405
- portalComponent,
5406
- className,
5407
- width,
5408
- height,
5409
- portalZIndex,
5410
- responsive
5411
- } = props;
5412
- const children = this.getChildren(props);
5413
- const dimensions = responsive ? {
5414
- width: "100%",
5415
- height: "100%"
5416
- } : {
5417
- width,
5418
- height
5354
+ const viewBox = responsive ? `0 0 ${width} ${height}` : undefined;
5355
+ const preserveAspectRatio = responsive ? props.preserveAspectRatio : undefined;
5356
+ const ariaLabelledBy = [title && getIdForElement("title"), props["aria-labelledby"]].filter(Boolean).join(" ") || undefined;
5357
+ const ariaDescribedBy = [desc && getIdForElement("desc"), props["aria-describedby"]].filter(Boolean).join(" ") || undefined;
5358
+ const titleId = getIdForElement("title");
5359
+ const descId = getIdForElement("desc");
5360
+ return {
5361
+ ...props,
5362
+ titleId,
5363
+ descId,
5364
+ dimensions,
5365
+ viewBox,
5366
+ preserveAspectRatio,
5367
+ ariaLabelledBy,
5368
+ ariaDescribedBy,
5369
+ userProps,
5370
+ localContainerRef
5371
+ };
5372
+ }
5373
+ const VictoryContainer = initialProps => {
5374
+ const {
5375
+ role,
5376
+ title,
5377
+ desc,
5378
+ children,
5379
+ className,
5380
+ portalZIndex,
5381
+ portalComponent,
5382
+ width,
5383
+ height,
5384
+ style,
5385
+ tabIndex,
5386
+ responsive,
5387
+ events,
5388
+ ouiaId,
5389
+ ouiaSafe,
5390
+ ouiaType,
5391
+ dimensions,
5392
+ ariaDescribedBy,
5393
+ ariaLabelledBy,
5394
+ viewBox,
5395
+ preserveAspectRatio,
5396
+ userProps,
5397
+ titleId,
5398
+ descId,
5399
+ containerRef,
5400
+ localContainerRef
5401
+ } = useVictoryContainer(initialProps);
5402
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
5403
+ if (!events?.onWheel) return;
5404
+ const handleWheel = e => e.preventDefault();
5405
+ const container = localContainerRef?.current;
5406
+ container?.addEventListener("wheel", handleWheel);
5407
+ return () => {
5408
+ container?.removeEventListener("wheel", handleWheel);
5419
5409
  };
5420
- const divStyle = Object.assign({
5410
+ // eslint-disable-next-line react-hooks/exhaustive-deps
5411
+ }, []);
5412
+ 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", {
5413
+ className: className,
5414
+ style: {
5415
+ ...style,
5416
+ width: responsive ? style?.width : dimensions.width,
5417
+ height: responsive ? style?.height : dimensions.height,
5421
5418
  pointerEvents: "none",
5422
5419
  touchAction: "none",
5423
5420
  position: "relative"
5424
- }, dimensions);
5425
- const portalDivStyle = Object.assign({
5421
+ },
5422
+ "data-ouia-component-id": ouiaId,
5423
+ "data-ouia-component-type": ouiaType,
5424
+ "data-ouia-safe": ouiaSafe,
5425
+ ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_5__.mergeRefs)([localContainerRef, containerRef])
5426
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("svg", _extends({
5427
+ width: width,
5428
+ height: height,
5429
+ tabIndex: tabIndex,
5430
+ role: role,
5431
+ "aria-labelledby": ariaLabelledBy,
5432
+ "aria-describedby": ariaDescribedBy,
5433
+ viewBox: viewBox,
5434
+ preserveAspectRatio: preserveAspectRatio,
5435
+ style: {
5436
+ ...dimensions,
5437
+ pointerEvents: "all"
5438
+ }
5439
+ }, userProps, events), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("title", {
5440
+ id: titleId
5441
+ }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("desc", {
5442
+ id: descId
5443
+ }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
5444
+ style: {
5445
+ ...dimensions,
5426
5446
  zIndex: portalZIndex,
5427
5447
  position: "absolute",
5428
5448
  top: 0,
5429
5449
  left: 0
5430
- }, dimensions);
5431
- const svgStyle = Object.assign({
5432
- pointerEvents: "all"
5433
- }, dimensions);
5434
- const portalSvgStyle = Object.assign({
5450
+ }
5451
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__.PortalOutlet, {
5452
+ as: portalComponent,
5453
+ width: width,
5454
+ height: height,
5455
+ viewBox: viewBox,
5456
+ preserveAspectRatio: preserveAspectRatio,
5457
+ style: {
5458
+ ...dimensions,
5435
5459
  overflow: "visible"
5436
- }, dimensions);
5437
- const portalProps = {
5438
- width,
5439
- height,
5440
- viewBox: svgProps.viewBox,
5441
- preserveAspectRatio: svgProps.preserveAspectRatio,
5442
- style: portalSvgStyle
5443
- };
5444
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_7__.PortalContext.Provider, {
5445
- value: {
5446
- portalUpdate: this.portalUpdate,
5447
- portalRegister: this.portalRegister,
5448
- portalDeregister: this.portalDeregister
5449
- }
5450
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", _extends({
5451
- style: lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, style, divStyle),
5452
- className: className,
5453
- ref: this.saveContainerRef
5454
- }, this.getOUIAProps(props)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("svg", _extends({}, svgProps, {
5455
- style: svgStyle
5456
- }), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("title", {
5457
- id: this.getIdForElement("title")
5458
- }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("desc", {
5459
- id: this.getIdForElement("desc")
5460
- }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", {
5461
- style: portalDivStyle
5462
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().cloneElement(portalComponent, {
5463
- ...portalProps,
5464
- ref: this.savePortalRef
5465
- }))));
5466
- }
5467
- render() {
5468
- const {
5469
- width,
5470
- height,
5471
- responsive,
5472
- events,
5473
- title,
5474
- desc,
5475
- tabIndex,
5476
- preserveAspectRatio,
5477
- role
5478
- } = this.props;
5479
- const style = responsive ? this.props.style : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.omit(this.props.style, ["height", "width"]);
5480
- const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__.getSafeUserProps(this.props);
5481
- const svgProps = Object.assign({
5482
- width,
5483
- height,
5484
- tabIndex,
5485
- role,
5486
- "aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
5487
- "aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
5488
- viewBox: responsive ? `0 0 ${width} ${height}` : undefined,
5489
- preserveAspectRatio: responsive ? preserveAspectRatio : undefined,
5490
- ...userProps
5491
- }, events);
5492
- return this.renderContainer(this.props, svgProps, style);
5493
- }
5494
- }
5460
+ }
5461
+ }))));
5462
+ };
5463
+ VictoryContainer.role = "container";
5495
5464
 
5496
5465
  /***/ }),
5497
5466
 
@@ -6004,17 +5973,83 @@ VictoryLabel.defaultStyles = defaultStyles;
6004
5973
  "use strict";
6005
5974
  __webpack_require__.r(__webpack_exports__);
6006
5975
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6007
- /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; }
5976
+ /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; },
5977
+ /* harmony export */ "PortalProvider": function() { return /* binding */ PortalProvider; },
5978
+ /* harmony export */ "usePortalContext": function() { return /* binding */ usePortalContext; }
6008
5979
  /* harmony export */ });
6009
5980
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
6010
5981
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6011
5982
 
6012
- /**
6013
- * The React context object consumers may use to access the context of the
6014
- * portal.
6015
- */
6016
- const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({});
5983
+ const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined);
6017
5984
  PortalContext.displayName = "PortalContext";
5985
+ const usePortalContext = () => {
5986
+ const context = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(PortalContext);
5987
+ if (!context) {
5988
+ throw new Error("`usePortalContext` must be used within a `<PortalProvider />`");
5989
+ }
5990
+ return context;
5991
+ };
5992
+ const PortalProvider = _ref => {
5993
+ let {
5994
+ children
5995
+ } = _ref;
5996
+ const [portalChildren, setPortalChildren] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(new Map());
5997
+ const addChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((id, element) => {
5998
+ setPortalChildren(prevChildren => {
5999
+ const nextChildren = new Map(prevChildren);
6000
+ nextChildren.set(id, element);
6001
+ return nextChildren;
6002
+ });
6003
+ }, [setPortalChildren]);
6004
+ const removeChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(id => {
6005
+ setPortalChildren(prevChildren => {
6006
+ const nextChildren = new Map(prevChildren);
6007
+ nextChildren.delete(id);
6008
+ return nextChildren;
6009
+ });
6010
+ }, [setPortalChildren]);
6011
+ const contextValue = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => ({
6012
+ addChild,
6013
+ removeChild,
6014
+ children: portalChildren
6015
+ }), [addChild, removeChild, portalChildren]);
6016
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PortalContext.Provider, {
6017
+ value: contextValue
6018
+ }, children);
6019
+ };
6020
+
6021
+ /***/ }),
6022
+
6023
+ /***/ "../../victory-core/es/victory-portal/portal-outlet.js":
6024
+ /*!*************************************************************!*\
6025
+ !*** ../../victory-core/es/victory-portal/portal-outlet.js ***!
6026
+ \*************************************************************/
6027
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
6028
+
6029
+ "use strict";
6030
+ __webpack_require__.r(__webpack_exports__);
6031
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6032
+ /* harmony export */ "PortalOutlet": function() { return /* binding */ PortalOutlet; }
6033
+ /* harmony export */ });
6034
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
6035
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6036
+ /* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
6037
+
6038
+
6039
+ const PortalOutlet = _ref => {
6040
+ let {
6041
+ as: portalComponent,
6042
+ ...props
6043
+ } = _ref;
6044
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_1__.usePortalContext)();
6045
+ const children = Array.from(portalContext.children.entries()).map(_ref2 => {
6046
+ let [key, node] = _ref2;
6047
+ return !node.key ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(node, {
6048
+ key
6049
+ }) : node;
6050
+ });
6051
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(portalComponent, props, children);
6052
+ };
6018
6053
 
6019
6054
  /***/ }),
6020
6055
 
@@ -6031,39 +6066,13 @@ __webpack_require__.r(__webpack_exports__);
6031
6066
  /* harmony export */ });
6032
6067
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
6033
6068
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6069
+ 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); }
6034
6070
 
6035
- class Portal extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) {
6036
- static displayName = "Portal";
6037
- constructor(props) {
6038
- super(props);
6039
- this.map = {};
6040
- this.index = 1;
6041
- }
6042
- portalRegister = () => {
6043
- return ++this.index;
6044
- };
6045
- portalUpdate = (key, element) => {
6046
- this.map[key] = element;
6047
- this.forceUpdate();
6048
- };
6049
- portalDeregister = key => {
6050
- delete this.map[key];
6051
- this.forceUpdate();
6052
- };
6053
- getChildren() {
6054
- return Object.keys(this.map).map(key => {
6055
- const el = this.map[key];
6056
- return el ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(el, {
6057
- key
6058
- }) : el;
6059
- });
6060
- }
6061
-
6062
- // Overridden in victory-core-native
6063
- render() {
6064
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", this.props, this.getChildren());
6065
- }
6066
- }
6071
+ const Portal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef((props, ref) => {
6072
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
6073
+ ref: ref
6074
+ }, props));
6075
+ });
6067
6076
 
6068
6077
  /***/ }),
6069
6078
 
@@ -6090,59 +6099,42 @@ __webpack_require__.r(__webpack_exports__);
6090
6099
 
6091
6100
 
6092
6101
 
6093
- class VictoryPortal extends (react__WEBPACK_IMPORTED_MODULE_1___default().Component) {
6094
- static displayName = "VictoryPortal";
6095
- static role = "portal";
6096
- static defaultProps = {
6097
- groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
6098
- };
6099
- static contextType = _portal_context__WEBPACK_IMPORTED_MODULE_2__.PortalContext;
6100
- componentDidMount() {
6101
- if (!this.checkedContext) {
6102
- if (typeof this.context.portalUpdate !== "function") {
6103
- const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
6104
- _victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
6105
- this.renderInPlace = true;
6106
- }
6107
- this.checkedContext = true;
6108
- }
6109
- this.forceUpdate();
6110
- }
6111
- componentDidUpdate() {
6112
- if (!this.renderInPlace) {
6113
- this.portalKey = this.portalKey || this.context.portalRegister();
6114
- this.context.portalUpdate(this.portalKey, this.element);
6115
- }
6116
- }
6117
- componentWillUnmount() {
6118
- if (this.context && this.context.portalDeregister) {
6119
- this.context.portalDeregister(this.portalKey);
6120
- }
6121
- }
6122
-
6123
- // Overridden in victory-core-native
6124
- renderPortal(child) {
6125
- if (this.renderInPlace) {
6126
- return child;
6127
- }
6128
- this.element = child;
6129
- return null;
6130
- }
6131
- render() {
6132
- const children = Array.isArray(this.props.children) ? this.props.children[0] : this.props.children;
6102
+ const defaultProps = {
6103
+ groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
6104
+ };
6105
+ const VictoryPortal = initialProps => {
6106
+ const props = {
6107
+ ...defaultProps,
6108
+ ...initialProps
6109
+ };
6110
+ const id = react__WEBPACK_IMPORTED_MODULE_1___default().useId();
6111
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_2__.usePortalContext)();
6112
+ if (!portalContext) {
6113
+ const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
6114
+ _victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
6115
+ }
6116
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
6117
+ const children = Array.isArray(props.children) ? props.children[0] : props.children;
6133
6118
  const {
6134
6119
  groupComponent
6135
- } = this.props;
6120
+ } = props;
6136
6121
  const childProps = children && children.props || {};
6137
6122
  const standardProps = childProps.groupComponent ? {
6138
6123
  groupComponent,
6139
6124
  standalone: false
6140
6125
  } : {};
6141
- const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(this.props, ["children", "groupComponent"]));
6126
+ const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(props, ["children", "groupComponent"]));
6142
6127
  const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
6143
- return this.renderPortal(child);
6144
- }
6145
- }
6128
+ portalContext.addChild(id, child);
6129
+ // eslint-disable-next-line react-hooks/exhaustive-deps
6130
+ }, [props.children]);
6131
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
6132
+ return () => portalContext.removeChild(id);
6133
+ // eslint-disable-next-line react-hooks/exhaustive-deps
6134
+ }, []);
6135
+ return null;
6136
+ };
6137
+ VictoryPortal.role = "portal";
6146
6138
 
6147
6139
  /***/ }),
6148
6140
 
@@ -9216,6 +9208,44 @@ function warn(message) {
9216
9208
 
9217
9209
  /***/ }),
9218
9210
 
9211
+ /***/ "../../victory-core/es/victory-util/merge-refs.js":
9212
+ /*!********************************************************!*\
9213
+ !*** ../../victory-core/es/victory-util/merge-refs.js ***!
9214
+ \********************************************************/
9215
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
9216
+
9217
+ "use strict";
9218
+ __webpack_require__.r(__webpack_exports__);
9219
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9220
+ /* harmony export */ "mergeRefs": function() { return /* binding */ mergeRefs; }
9221
+ /* harmony export */ });
9222
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
9223
+
9224
+ /**
9225
+ * Used to merge multiple React refs into a single callback ref.
9226
+ *
9227
+ * @example
9228
+ * ```tsx
9229
+ * <div ref={mergeRefs([ref, forwardedRef])} />
9230
+ * ```
9231
+ */
9232
+ function mergeRefs(refs) {
9233
+ return value => {
9234
+ refs.forEach(ref => {
9235
+ // If the ref is a function, it's a callback ref and we call it with the value.
9236
+ if (_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction(ref)) {
9237
+ ref(value);
9238
+ } else if (ref !== null && ref !== undefined) {
9239
+ // If the ref is an object (not null and not undefined), it's an object ref.
9240
+ // We assign the value to its 'current' property.
9241
+ ref.current = value;
9242
+ }
9243
+ });
9244
+ };
9245
+ }
9246
+
9247
+ /***/ }),
9248
+
9219
9249
  /***/ "../../victory-core/es/victory-util/scale.js":
9220
9250
  /*!***************************************************!*\
9221
9251
  !*** ../../victory-core/es/victory-util/scale.js ***!