victory-area 37.0.2 → 37.1.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,11 @@
1
1
  # victory-area
2
2
 
3
+ ## 37.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Pin all internal victory package versions ([#2876](https://github.com/FormidableLabs/victory/pull/2876))
8
+
3
9
  ## 37.0.2
4
10
 
5
11
  ### Patch Changes
@@ -5436,23 +5436,18 @@ class VictoryClipContainer extends (react__WEBPACK_IMPORTED_MODULE_3___default()
5436
5436
  "use strict";
5437
5437
  __webpack_require__.r(__webpack_exports__);
5438
5438
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5439
- /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; }
5439
+ /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
5440
+ /* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
5440
5441
  /* harmony export */ });
5441
- /* 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");
5442
- /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_isObject__WEBPACK_IMPORTED_MODULE_0__);
5443
- /* 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");
5444
- /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1__);
5445
- /* 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");
5446
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_2__);
5447
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "react");
5448
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
5449
- /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
5450
- /* 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");
5451
- /* 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");
5452
- /* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
5453
- /* 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");
5454
-
5455
-
5442
+ /* 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");
5443
+ /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
5444
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
5445
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
5446
+ /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
5447
+ /* 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");
5448
+ /* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
5449
+ /* 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");
5450
+ /* harmony import */ var _victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-portal/portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
5456
5451
 
5457
5452
  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); }
5458
5453
 
@@ -5461,175 +5456,149 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
5461
5456
 
5462
5457
 
5463
5458
 
5464
- class VictoryContainer extends (react__WEBPACK_IMPORTED_MODULE_3___default().Component) {
5465
- static displayName = "VictoryContainer";
5466
- static role = "container";
5467
- static defaultProps = {
5468
- className: "VictoryContainer",
5469
- portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__.Portal, null),
5470
- portalZIndex: 99,
5471
- responsive: true,
5472
- role: "img"
5459
+ const defaultProps = {
5460
+ className: "VictoryContainer",
5461
+ portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__.Portal, null),
5462
+ portalZIndex: 99,
5463
+ responsive: true,
5464
+ role: "img"
5465
+ };
5466
+ function useVictoryContainer(initialProps) {
5467
+ const props = {
5468
+ ...defaultProps,
5469
+ ...initialProps
5473
5470
  };
5474
- static contextType = _victory_util_timer_context__WEBPACK_IMPORTED_MODULE_5__["default"];
5475
-
5476
- // @ts-expect-error Ref will be initialized on mount
5477
-
5478
- // @ts-expect-error Ref will be initialized on mount
5479
-
5480
- constructor(props) {
5481
- super(props);
5482
- this.containerId = !lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default()(props) || props.containerId === undefined ? lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default()("victory-container-") : props.containerId;
5483
- this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
5484
- }
5485
- savePortalRef = portal => {
5486
- this.portalRef = portal;
5487
- return portal;
5488
- };
5489
- portalUpdate = (key, el) => this.portalRef.portalUpdate(key, el);
5490
- portalRegister = () => this.portalRef.portalRegister();
5491
- portalDeregister = key => this.portalRef.portalDeregister(key);
5492
- saveContainerRef = container => {
5493
- if (_victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(this.props.containerRef)) {
5494
- this.props.containerRef(container);
5495
- }
5496
- this.containerRef = container;
5497
- return container;
5471
+ const {
5472
+ title,
5473
+ desc,
5474
+ width,
5475
+ height,
5476
+ responsive
5477
+ } = props;
5478
+ const localContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
5479
+
5480
+ // Generated ID stored in ref because it needs to persist across renders
5481
+ const generatedId = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()("victory-container-"));
5482
+ const containerId = props.containerId ?? generatedId.current;
5483
+ const getIdForElement = elName => `${containerId}-${elName}`;
5484
+ const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
5485
+ const dimensions = responsive ? {
5486
+ width: "100%",
5487
+ height: "100%"
5488
+ } : {
5489
+ width,
5490
+ height
5498
5491
  };
5499
- handleWheel = e => e.preventDefault();
5500
- componentDidMount() {
5501
- if (this.shouldHandleWheel && this.containerRef) {
5502
- this.containerRef.addEventListener("wheel", this.handleWheel);
5503
- }
5504
- }
5505
- componentWillUnmount() {
5506
- if (this.shouldHandleWheel && this.containerRef) {
5507
- this.containerRef.removeEventListener("wheel", this.handleWheel);
5508
- }
5509
- }
5510
- getIdForElement(elementName) {
5511
- return `${this.containerId}-${elementName}`;
5512
- }
5513
-
5514
- // overridden in custom containers
5515
- getChildren(props) {
5516
- return props.children;
5517
- }
5518
-
5519
- // Get props defined by the Open UI Automation (OUIA) 1.0-RC spec
5520
- // See https://ouia.readthedocs.io/en/latest/README.html#ouia-component
5521
- getOUIAProps(props) {
5522
- const {
5523
- ouiaId,
5524
- ouiaSafe,
5525
- ouiaType
5526
- } = props;
5527
- return {
5528
- ...(ouiaId && {
5529
- "data-ouia-component-id": ouiaId
5530
- }),
5531
- ...(ouiaType && {
5532
- "data-ouia-component-type": ouiaType
5533
- }),
5534
- ...(ouiaSafe !== undefined && {
5535
- "data-ouia-safe": ouiaSafe
5536
- })
5537
- };
5538
- }
5539
- renderContainer(props, svgProps, style) {
5540
- const {
5541
- title,
5542
- desc,
5543
- portalComponent,
5544
- className,
5545
- width,
5546
- height,
5547
- portalZIndex,
5548
- responsive
5549
- } = props;
5550
- const children = this.getChildren(props);
5551
- const dimensions = responsive ? {
5552
- width: "100%",
5553
- height: "100%"
5554
- } : {
5555
- width,
5556
- height
5492
+ const viewBox = responsive ? `0 0 ${width} ${height}` : undefined;
5493
+ const preserveAspectRatio = responsive ? props.preserveAspectRatio : undefined;
5494
+ const ariaLabelledBy = [title && getIdForElement("title"), props["aria-labelledby"]].filter(Boolean).join(" ") || undefined;
5495
+ const ariaDescribedBy = [desc && getIdForElement("desc"), props["aria-describedby"]].filter(Boolean).join(" ") || undefined;
5496
+ const titleId = getIdForElement("title");
5497
+ const descId = getIdForElement("desc");
5498
+ return {
5499
+ ...props,
5500
+ titleId,
5501
+ descId,
5502
+ dimensions,
5503
+ viewBox,
5504
+ preserveAspectRatio,
5505
+ ariaLabelledBy,
5506
+ ariaDescribedBy,
5507
+ userProps,
5508
+ localContainerRef
5509
+ };
5510
+ }
5511
+ const VictoryContainer = initialProps => {
5512
+ const {
5513
+ role,
5514
+ title,
5515
+ desc,
5516
+ children,
5517
+ className,
5518
+ portalZIndex,
5519
+ portalComponent,
5520
+ width,
5521
+ height,
5522
+ style,
5523
+ tabIndex,
5524
+ responsive,
5525
+ events,
5526
+ ouiaId,
5527
+ ouiaSafe,
5528
+ ouiaType,
5529
+ dimensions,
5530
+ ariaDescribedBy,
5531
+ ariaLabelledBy,
5532
+ viewBox,
5533
+ preserveAspectRatio,
5534
+ userProps,
5535
+ titleId,
5536
+ descId,
5537
+ containerRef,
5538
+ localContainerRef
5539
+ } = useVictoryContainer(initialProps);
5540
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
5541
+ if (!events?.onWheel) return;
5542
+ const handleWheel = e => e.preventDefault();
5543
+ const container = localContainerRef?.current;
5544
+ container?.addEventListener("wheel", handleWheel);
5545
+ return () => {
5546
+ container?.removeEventListener("wheel", handleWheel);
5557
5547
  };
5558
- const divStyle = Object.assign({
5548
+ // eslint-disable-next-line react-hooks/exhaustive-deps
5549
+ }, []);
5550
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
5551
+ className: className,
5552
+ style: {
5553
+ ...style,
5554
+ width: responsive ? style?.width : dimensions.width,
5555
+ height: responsive ? style?.height : dimensions.height,
5559
5556
  pointerEvents: "none",
5560
5557
  touchAction: "none",
5561
5558
  position: "relative"
5562
- }, dimensions);
5563
- const portalDivStyle = Object.assign({
5559
+ },
5560
+ "data-ouia-component-id": ouiaId,
5561
+ "data-ouia-component-type": ouiaType,
5562
+ "data-ouia-safe": ouiaSafe,
5563
+ ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_4__.mergeRefs)([localContainerRef, containerRef])
5564
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_5__.PortalProvider, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("svg", _extends({
5565
+ width: width,
5566
+ height: height,
5567
+ tabIndex: tabIndex,
5568
+ role: role,
5569
+ "aria-labelledby": ariaLabelledBy,
5570
+ "aria-describedby": ariaDescribedBy,
5571
+ viewBox: viewBox,
5572
+ preserveAspectRatio: preserveAspectRatio,
5573
+ style: {
5574
+ ...dimensions,
5575
+ pointerEvents: "all"
5576
+ }
5577
+ }, userProps, events), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("title", {
5578
+ id: titleId
5579
+ }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("desc", {
5580
+ id: descId
5581
+ }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
5582
+ style: {
5583
+ ...dimensions,
5564
5584
  zIndex: portalZIndex,
5565
5585
  position: "absolute",
5566
5586
  top: 0,
5567
5587
  left: 0
5568
- }, dimensions);
5569
- const svgStyle = Object.assign({
5570
- pointerEvents: "all"
5571
- }, dimensions);
5572
- const portalSvgStyle = Object.assign({
5588
+ }
5589
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__.PortalOutlet, {
5590
+ as: portalComponent,
5591
+ width: width,
5592
+ height: height,
5593
+ viewBox: viewBox,
5594
+ preserveAspectRatio: preserveAspectRatio,
5595
+ style: {
5596
+ ...dimensions,
5573
5597
  overflow: "visible"
5574
- }, dimensions);
5575
- const portalProps = {
5576
- width,
5577
- height,
5578
- viewBox: svgProps.viewBox,
5579
- preserveAspectRatio: svgProps.preserveAspectRatio,
5580
- style: portalSvgStyle
5581
- };
5582
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_7__.PortalContext.Provider, {
5583
- value: {
5584
- portalUpdate: this.portalUpdate,
5585
- portalRegister: this.portalRegister,
5586
- portalDeregister: this.portalDeregister
5587
- }
5588
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", _extends({
5589
- style: lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, style, divStyle),
5590
- className: className,
5591
- ref: this.saveContainerRef
5592
- }, this.getOUIAProps(props)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("svg", _extends({}, svgProps, {
5593
- style: svgStyle
5594
- }), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("title", {
5595
- id: this.getIdForElement("title")
5596
- }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("desc", {
5597
- id: this.getIdForElement("desc")
5598
- }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", {
5599
- style: portalDivStyle
5600
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().cloneElement(portalComponent, {
5601
- ...portalProps,
5602
- ref: this.savePortalRef
5603
- }))));
5604
- }
5605
- render() {
5606
- const {
5607
- width,
5608
- height,
5609
- responsive,
5610
- events,
5611
- title,
5612
- desc,
5613
- tabIndex,
5614
- preserveAspectRatio,
5615
- role
5616
- } = this.props;
5617
- const style = responsive ? this.props.style : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.omit(this.props.style, ["height", "width"]);
5618
- const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__.getSafeUserProps(this.props);
5619
- const svgProps = Object.assign({
5620
- width,
5621
- height,
5622
- tabIndex,
5623
- role,
5624
- "aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
5625
- "aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
5626
- viewBox: responsive ? `0 0 ${width} ${height}` : undefined,
5627
- preserveAspectRatio: responsive ? preserveAspectRatio : undefined,
5628
- ...userProps
5629
- }, events);
5630
- return this.renderContainer(this.props, svgProps, style);
5631
- }
5632
- }
5598
+ }
5599
+ }))));
5600
+ };
5601
+ VictoryContainer.role = "container";
5633
5602
 
5634
5603
  /***/ }),
5635
5604
 
@@ -6142,17 +6111,78 @@ VictoryLabel.defaultStyles = defaultStyles;
6142
6111
  "use strict";
6143
6112
  __webpack_require__.r(__webpack_exports__);
6144
6113
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6145
- /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; }
6114
+ /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; },
6115
+ /* harmony export */ "PortalProvider": function() { return /* binding */ PortalProvider; },
6116
+ /* harmony export */ "usePortalContext": function() { return /* binding */ usePortalContext; }
6146
6117
  /* harmony export */ });
6147
6118
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
6148
6119
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6149
6120
 
6150
- /**
6151
- * The React context object consumers may use to access the context of the
6152
- * portal.
6153
- */
6154
- const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({});
6121
+ const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined);
6155
6122
  PortalContext.displayName = "PortalContext";
6123
+ const usePortalContext = () => {
6124
+ const context = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(PortalContext);
6125
+ return context;
6126
+ };
6127
+ const PortalProvider = _ref => {
6128
+ let {
6129
+ children
6130
+ } = _ref;
6131
+ const [portalChildren, setPortalChildren] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(new Map());
6132
+ const addChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((id, element) => {
6133
+ setPortalChildren(prevChildren => {
6134
+ const nextChildren = new Map(prevChildren);
6135
+ nextChildren.set(id, element);
6136
+ return nextChildren;
6137
+ });
6138
+ }, [setPortalChildren]);
6139
+ const removeChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(id => {
6140
+ setPortalChildren(prevChildren => {
6141
+ const nextChildren = new Map(prevChildren);
6142
+ nextChildren.delete(id);
6143
+ return nextChildren;
6144
+ });
6145
+ }, [setPortalChildren]);
6146
+ const contextValue = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => ({
6147
+ addChild,
6148
+ removeChild,
6149
+ children: portalChildren
6150
+ }), [addChild, removeChild, portalChildren]);
6151
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PortalContext.Provider, {
6152
+ value: contextValue
6153
+ }, children);
6154
+ };
6155
+
6156
+ /***/ }),
6157
+
6158
+ /***/ "../../victory-core/es/victory-portal/portal-outlet.js":
6159
+ /*!*************************************************************!*\
6160
+ !*** ../../victory-core/es/victory-portal/portal-outlet.js ***!
6161
+ \*************************************************************/
6162
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
6163
+
6164
+ "use strict";
6165
+ __webpack_require__.r(__webpack_exports__);
6166
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6167
+ /* harmony export */ "PortalOutlet": function() { return /* binding */ PortalOutlet; }
6168
+ /* harmony export */ });
6169
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
6170
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6171
+ /* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
6172
+
6173
+
6174
+ const PortalOutlet = _ref => {
6175
+ let {
6176
+ as: portalComponent,
6177
+ ...props
6178
+ } = _ref;
6179
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_1__.usePortalContext)();
6180
+ if (!portalContext) {
6181
+ return null;
6182
+ }
6183
+ const children = Array.from(portalContext.children.values());
6184
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(portalComponent, props, children);
6185
+ };
6156
6186
 
6157
6187
  /***/ }),
6158
6188
 
@@ -6169,39 +6199,13 @@ __webpack_require__.r(__webpack_exports__);
6169
6199
  /* harmony export */ });
6170
6200
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
6171
6201
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6202
+ 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); }
6172
6203
 
6173
- class Portal extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) {
6174
- static displayName = "Portal";
6175
- constructor(props) {
6176
- super(props);
6177
- this.map = {};
6178
- this.index = 1;
6179
- }
6180
- portalRegister = () => {
6181
- return ++this.index;
6182
- };
6183
- portalUpdate = (key, element) => {
6184
- this.map[key] = element;
6185
- this.forceUpdate();
6186
- };
6187
- portalDeregister = key => {
6188
- delete this.map[key];
6189
- this.forceUpdate();
6190
- };
6191
- getChildren() {
6192
- return Object.keys(this.map).map(key => {
6193
- const el = this.map[key];
6194
- return el ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(el, {
6195
- key
6196
- }) : el;
6197
- });
6198
- }
6199
-
6200
- // Overridden in victory-core-native
6201
- render() {
6202
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", this.props, this.getChildren());
6203
- }
6204
- }
6204
+ const Portal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef((props, ref) => {
6205
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
6206
+ ref: ref
6207
+ }, props));
6208
+ });
6205
6209
 
6206
6210
  /***/ }),
6207
6211
 
@@ -6228,59 +6232,44 @@ __webpack_require__.r(__webpack_exports__);
6228
6232
 
6229
6233
 
6230
6234
 
6231
- class VictoryPortal extends (react__WEBPACK_IMPORTED_MODULE_1___default().Component) {
6232
- static displayName = "VictoryPortal";
6233
- static role = "portal";
6234
- static defaultProps = {
6235
- groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
6236
- };
6237
- static contextType = _portal_context__WEBPACK_IMPORTED_MODULE_2__.PortalContext;
6238
- componentDidMount() {
6239
- if (!this.checkedContext) {
6240
- if (typeof this.context.portalUpdate !== "function") {
6241
- const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
6242
- _victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
6243
- this.renderInPlace = true;
6244
- }
6245
- this.checkedContext = true;
6246
- }
6247
- this.forceUpdate();
6248
- }
6249
- componentDidUpdate() {
6250
- if (!this.renderInPlace) {
6251
- this.portalKey = this.portalKey || this.context.portalRegister();
6252
- this.context.portalUpdate(this.portalKey, this.element);
6253
- }
6254
- }
6255
- componentWillUnmount() {
6256
- if (this.context && this.context.portalDeregister) {
6257
- this.context.portalDeregister(this.portalKey);
6258
- }
6259
- }
6260
-
6261
- // Overridden in victory-core-native
6262
- renderPortal(child) {
6263
- if (this.renderInPlace) {
6264
- return child;
6265
- }
6266
- this.element = child;
6267
- return null;
6268
- }
6269
- render() {
6270
- const children = Array.isArray(this.props.children) ? this.props.children[0] : this.props.children;
6271
- const {
6272
- groupComponent
6273
- } = this.props;
6274
- const childProps = children && children.props || {};
6275
- const standardProps = childProps.groupComponent ? {
6276
- groupComponent,
6277
- standalone: false
6278
- } : {};
6279
- const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(this.props, ["children", "groupComponent"]));
6280
- const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
6281
- return this.renderPortal(child);
6282
- }
6283
- }
6235
+ const defaultProps = {
6236
+ groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
6237
+ };
6238
+ const VictoryPortal = initialProps => {
6239
+ const props = {
6240
+ ...defaultProps,
6241
+ ...initialProps
6242
+ };
6243
+ const id = react__WEBPACK_IMPORTED_MODULE_1___default().useId();
6244
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_2__.usePortalContext)();
6245
+ if (!portalContext) {
6246
+ const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
6247
+ _victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
6248
+ }
6249
+ const children = Array.isArray(props.children) ? props.children[0] : props.children;
6250
+ const {
6251
+ groupComponent
6252
+ } = props;
6253
+ const childProps = children && children.props || {};
6254
+ const standardProps = childProps.groupComponent ? {
6255
+ groupComponent,
6256
+ standalone: false
6257
+ } : {};
6258
+ const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(props, ["children", "groupComponent"]), {
6259
+ key: childProps.key ?? id
6260
+ });
6261
+ const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
6262
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
6263
+ portalContext?.addChild(id, child);
6264
+ // eslint-disable-next-line react-hooks/exhaustive-deps
6265
+ }, [props.children]);
6266
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
6267
+ return () => portalContext?.removeChild(id);
6268
+ // eslint-disable-next-line react-hooks/exhaustive-deps
6269
+ }, []);
6270
+ return portalContext ? null : child;
6271
+ };
6272
+ VictoryPortal.role = "portal";
6284
6273
 
6285
6274
  /***/ }),
6286
6275
 
@@ -9867,6 +9856,44 @@ function warn(message) {
9867
9856
 
9868
9857
  /***/ }),
9869
9858
 
9859
+ /***/ "../../victory-core/es/victory-util/merge-refs.js":
9860
+ /*!********************************************************!*\
9861
+ !*** ../../victory-core/es/victory-util/merge-refs.js ***!
9862
+ \********************************************************/
9863
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
9864
+
9865
+ "use strict";
9866
+ __webpack_require__.r(__webpack_exports__);
9867
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9868
+ /* harmony export */ "mergeRefs": function() { return /* binding */ mergeRefs; }
9869
+ /* harmony export */ });
9870
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
9871
+
9872
+ /**
9873
+ * Used to merge multiple React refs into a single callback ref.
9874
+ *
9875
+ * @example
9876
+ * ```tsx
9877
+ * <div ref={mergeRefs([ref, forwardedRef])} />
9878
+ * ```
9879
+ */
9880
+ function mergeRefs(refs) {
9881
+ return value => {
9882
+ refs.forEach(ref => {
9883
+ // If the ref is a function, it's a callback ref and we call it with the value.
9884
+ if (_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction(ref)) {
9885
+ ref(value);
9886
+ } else if (ref !== null && ref !== undefined) {
9887
+ // If the ref is an object (not null and not undefined), it's an object ref.
9888
+ // We assign the value to its 'current' property.
9889
+ ref.current = value;
9890
+ }
9891
+ });
9892
+ };
9893
+ }
9894
+
9895
+ /***/ }),
9896
+
9870
9897
  /***/ "../../victory-core/es/victory-util/scale.js":
9871
9898
  /*!***************************************************!*\
9872
9899
  !*** ../../victory-core/es/victory-util/scale.js ***!