victory-polar-axis 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-polar-axis
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
  ## 37.0.1
@@ -5502,23 +5502,18 @@ const VictoryAnimation = _ref => {
5502
5502
  "use strict";
5503
5503
  __webpack_require__.r(__webpack_exports__);
5504
5504
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5505
- /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; }
5505
+ /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
5506
+ /* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
5506
5507
  /* harmony export */ });
5507
- /* 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");
5508
- /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_isObject__WEBPACK_IMPORTED_MODULE_0__);
5509
- /* 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");
5510
- /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1__);
5511
- /* 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");
5512
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_2__);
5513
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "react");
5514
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
5515
- /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
5516
- /* 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");
5517
- /* 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");
5518
- /* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
5519
- /* 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");
5520
-
5521
-
5508
+ /* 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");
5509
+ /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
5510
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
5511
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
5512
+ /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
5513
+ /* 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");
5514
+ /* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
5515
+ /* 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");
5516
+ /* 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");
5522
5517
 
5523
5518
  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); }
5524
5519
 
@@ -5527,175 +5522,149 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
5527
5522
 
5528
5523
 
5529
5524
 
5530
- class VictoryContainer extends (react__WEBPACK_IMPORTED_MODULE_3___default().Component) {
5531
- static displayName = "VictoryContainer";
5532
- static role = "container";
5533
- static defaultProps = {
5534
- className: "VictoryContainer",
5535
- portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__.Portal, null),
5536
- portalZIndex: 99,
5537
- responsive: true,
5538
- role: "img"
5525
+ const defaultProps = {
5526
+ className: "VictoryContainer",
5527
+ portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__.Portal, null),
5528
+ portalZIndex: 99,
5529
+ responsive: true,
5530
+ role: "img"
5531
+ };
5532
+ function useVictoryContainer(initialProps) {
5533
+ const props = {
5534
+ ...defaultProps,
5535
+ ...initialProps
5539
5536
  };
5540
- static contextType = _victory_util_timer_context__WEBPACK_IMPORTED_MODULE_5__["default"];
5541
-
5542
- // @ts-expect-error Ref will be initialized on mount
5543
-
5544
- // @ts-expect-error Ref will be initialized on mount
5545
-
5546
- constructor(props) {
5547
- super(props);
5548
- this.containerId = !lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default()(props) || props.containerId === undefined ? lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default()("victory-container-") : props.containerId;
5549
- this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
5550
- }
5551
- savePortalRef = portal => {
5552
- this.portalRef = portal;
5553
- return portal;
5537
+ const {
5538
+ title,
5539
+ desc,
5540
+ width,
5541
+ height,
5542
+ responsive
5543
+ } = props;
5544
+ const localContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
5545
+
5546
+ // Generated ID stored in ref because it needs to persist across renders
5547
+ const generatedId = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()("victory-container-"));
5548
+ const containerId = props.containerId ?? generatedId.current;
5549
+ const getIdForElement = elName => `${containerId}-${elName}`;
5550
+ const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
5551
+ const dimensions = responsive ? {
5552
+ width: "100%",
5553
+ height: "100%"
5554
+ } : {
5555
+ width,
5556
+ height
5554
5557
  };
5555
- portalUpdate = (key, el) => this.portalRef.portalUpdate(key, el);
5556
- portalRegister = () => this.portalRef.portalRegister();
5557
- portalDeregister = key => this.portalRef.portalDeregister(key);
5558
- saveContainerRef = container => {
5559
- if (_victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(this.props.containerRef)) {
5560
- this.props.containerRef(container);
5561
- }
5562
- this.containerRef = container;
5563
- return container;
5558
+ const viewBox = responsive ? `0 0 ${width} ${height}` : undefined;
5559
+ const preserveAspectRatio = responsive ? props.preserveAspectRatio : undefined;
5560
+ const ariaLabelledBy = [title && getIdForElement("title"), props["aria-labelledby"]].filter(Boolean).join(" ") || undefined;
5561
+ const ariaDescribedBy = [desc && getIdForElement("desc"), props["aria-describedby"]].filter(Boolean).join(" ") || undefined;
5562
+ const titleId = getIdForElement("title");
5563
+ const descId = getIdForElement("desc");
5564
+ return {
5565
+ ...props,
5566
+ titleId,
5567
+ descId,
5568
+ dimensions,
5569
+ viewBox,
5570
+ preserveAspectRatio,
5571
+ ariaLabelledBy,
5572
+ ariaDescribedBy,
5573
+ userProps,
5574
+ localContainerRef
5564
5575
  };
5565
- handleWheel = e => e.preventDefault();
5566
- componentDidMount() {
5567
- if (this.shouldHandleWheel && this.containerRef) {
5568
- this.containerRef.addEventListener("wheel", this.handleWheel);
5569
- }
5570
- }
5571
- componentWillUnmount() {
5572
- if (this.shouldHandleWheel && this.containerRef) {
5573
- this.containerRef.removeEventListener("wheel", this.handleWheel);
5574
- }
5575
- }
5576
- getIdForElement(elementName) {
5577
- return `${this.containerId}-${elementName}`;
5578
- }
5579
-
5580
- // overridden in custom containers
5581
- getChildren(props) {
5582
- return props.children;
5583
- }
5584
-
5585
- // Get props defined by the Open UI Automation (OUIA) 1.0-RC spec
5586
- // See https://ouia.readthedocs.io/en/latest/README.html#ouia-component
5587
- getOUIAProps(props) {
5588
- const {
5589
- ouiaId,
5590
- ouiaSafe,
5591
- ouiaType
5592
- } = props;
5593
- return {
5594
- ...(ouiaId && {
5595
- "data-ouia-component-id": ouiaId
5596
- }),
5597
- ...(ouiaType && {
5598
- "data-ouia-component-type": ouiaType
5599
- }),
5600
- ...(ouiaSafe !== undefined && {
5601
- "data-ouia-safe": ouiaSafe
5602
- })
5603
- };
5604
- }
5605
- renderContainer(props, svgProps, style) {
5606
- const {
5607
- title,
5608
- desc,
5609
- portalComponent,
5610
- className,
5611
- width,
5612
- height,
5613
- portalZIndex,
5614
- responsive
5615
- } = props;
5616
- const children = this.getChildren(props);
5617
- const dimensions = responsive ? {
5618
- width: "100%",
5619
- height: "100%"
5620
- } : {
5621
- width,
5622
- height
5576
+ }
5577
+ const VictoryContainer = initialProps => {
5578
+ const {
5579
+ role,
5580
+ title,
5581
+ desc,
5582
+ children,
5583
+ className,
5584
+ portalZIndex,
5585
+ portalComponent,
5586
+ width,
5587
+ height,
5588
+ style,
5589
+ tabIndex,
5590
+ responsive,
5591
+ events,
5592
+ ouiaId,
5593
+ ouiaSafe,
5594
+ ouiaType,
5595
+ dimensions,
5596
+ ariaDescribedBy,
5597
+ ariaLabelledBy,
5598
+ viewBox,
5599
+ preserveAspectRatio,
5600
+ userProps,
5601
+ titleId,
5602
+ descId,
5603
+ containerRef,
5604
+ localContainerRef
5605
+ } = useVictoryContainer(initialProps);
5606
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
5607
+ if (!events?.onWheel) return;
5608
+ const handleWheel = e => e.preventDefault();
5609
+ const container = localContainerRef?.current;
5610
+ container?.addEventListener("wheel", handleWheel);
5611
+ return () => {
5612
+ container?.removeEventListener("wheel", handleWheel);
5623
5613
  };
5624
- const divStyle = Object.assign({
5614
+ // eslint-disable-next-line react-hooks/exhaustive-deps
5615
+ }, []);
5616
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
5617
+ className: className,
5618
+ style: {
5619
+ ...style,
5620
+ width: responsive ? style?.width : dimensions.width,
5621
+ height: responsive ? style?.height : dimensions.height,
5625
5622
  pointerEvents: "none",
5626
5623
  touchAction: "none",
5627
5624
  position: "relative"
5628
- }, dimensions);
5629
- const portalDivStyle = Object.assign({
5625
+ },
5626
+ "data-ouia-component-id": ouiaId,
5627
+ "data-ouia-component-type": ouiaType,
5628
+ "data-ouia-safe": ouiaSafe,
5629
+ ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_4__.mergeRefs)([localContainerRef, containerRef])
5630
+ }, /*#__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({
5631
+ width: width,
5632
+ height: height,
5633
+ tabIndex: tabIndex,
5634
+ role: role,
5635
+ "aria-labelledby": ariaLabelledBy,
5636
+ "aria-describedby": ariaDescribedBy,
5637
+ viewBox: viewBox,
5638
+ preserveAspectRatio: preserveAspectRatio,
5639
+ style: {
5640
+ ...dimensions,
5641
+ pointerEvents: "all"
5642
+ }
5643
+ }, userProps, events), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("title", {
5644
+ id: titleId
5645
+ }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("desc", {
5646
+ id: descId
5647
+ }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
5648
+ style: {
5649
+ ...dimensions,
5630
5650
  zIndex: portalZIndex,
5631
5651
  position: "absolute",
5632
5652
  top: 0,
5633
5653
  left: 0
5634
- }, dimensions);
5635
- const svgStyle = Object.assign({
5636
- pointerEvents: "all"
5637
- }, dimensions);
5638
- const portalSvgStyle = Object.assign({
5654
+ }
5655
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__.PortalOutlet, {
5656
+ as: portalComponent,
5657
+ width: width,
5658
+ height: height,
5659
+ viewBox: viewBox,
5660
+ preserveAspectRatio: preserveAspectRatio,
5661
+ style: {
5662
+ ...dimensions,
5639
5663
  overflow: "visible"
5640
- }, dimensions);
5641
- const portalProps = {
5642
- width,
5643
- height,
5644
- viewBox: svgProps.viewBox,
5645
- preserveAspectRatio: svgProps.preserveAspectRatio,
5646
- style: portalSvgStyle
5647
- };
5648
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_7__.PortalContext.Provider, {
5649
- value: {
5650
- portalUpdate: this.portalUpdate,
5651
- portalRegister: this.portalRegister,
5652
- portalDeregister: this.portalDeregister
5653
- }
5654
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", _extends({
5655
- style: lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, style, divStyle),
5656
- className: className,
5657
- ref: this.saveContainerRef
5658
- }, this.getOUIAProps(props)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("svg", _extends({}, svgProps, {
5659
- style: svgStyle
5660
- }), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("title", {
5661
- id: this.getIdForElement("title")
5662
- }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("desc", {
5663
- id: this.getIdForElement("desc")
5664
- }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", {
5665
- style: portalDivStyle
5666
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().cloneElement(portalComponent, {
5667
- ...portalProps,
5668
- ref: this.savePortalRef
5669
- }))));
5670
- }
5671
- render() {
5672
- const {
5673
- width,
5674
- height,
5675
- responsive,
5676
- events,
5677
- title,
5678
- desc,
5679
- tabIndex,
5680
- preserveAspectRatio,
5681
- role
5682
- } = this.props;
5683
- const style = responsive ? this.props.style : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.omit(this.props.style, ["height", "width"]);
5684
- const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__.getSafeUserProps(this.props);
5685
- const svgProps = Object.assign({
5686
- width,
5687
- height,
5688
- tabIndex,
5689
- role,
5690
- "aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
5691
- "aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
5692
- viewBox: responsive ? `0 0 ${width} ${height}` : undefined,
5693
- preserveAspectRatio: responsive ? preserveAspectRatio : undefined,
5694
- ...userProps
5695
- }, events);
5696
- return this.renderContainer(this.props, svgProps, style);
5697
- }
5698
- }
5664
+ }
5665
+ }))));
5666
+ };
5667
+ VictoryContainer.role = "container";
5699
5668
 
5700
5669
  /***/ }),
5701
5670
 
@@ -6208,17 +6177,78 @@ VictoryLabel.defaultStyles = defaultStyles;
6208
6177
  "use strict";
6209
6178
  __webpack_require__.r(__webpack_exports__);
6210
6179
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6211
- /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; }
6180
+ /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; },
6181
+ /* harmony export */ "PortalProvider": function() { return /* binding */ PortalProvider; },
6182
+ /* harmony export */ "usePortalContext": function() { return /* binding */ usePortalContext; }
6212
6183
  /* harmony export */ });
6213
6184
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
6214
6185
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6215
6186
 
6216
- /**
6217
- * The React context object consumers may use to access the context of the
6218
- * portal.
6219
- */
6220
- const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({});
6187
+ const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined);
6221
6188
  PortalContext.displayName = "PortalContext";
6189
+ const usePortalContext = () => {
6190
+ const context = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(PortalContext);
6191
+ return context;
6192
+ };
6193
+ const PortalProvider = _ref => {
6194
+ let {
6195
+ children
6196
+ } = _ref;
6197
+ const [portalChildren, setPortalChildren] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(new Map());
6198
+ const addChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((id, element) => {
6199
+ setPortalChildren(prevChildren => {
6200
+ const nextChildren = new Map(prevChildren);
6201
+ nextChildren.set(id, element);
6202
+ return nextChildren;
6203
+ });
6204
+ }, [setPortalChildren]);
6205
+ const removeChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(id => {
6206
+ setPortalChildren(prevChildren => {
6207
+ const nextChildren = new Map(prevChildren);
6208
+ nextChildren.delete(id);
6209
+ return nextChildren;
6210
+ });
6211
+ }, [setPortalChildren]);
6212
+ const contextValue = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => ({
6213
+ addChild,
6214
+ removeChild,
6215
+ children: portalChildren
6216
+ }), [addChild, removeChild, portalChildren]);
6217
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PortalContext.Provider, {
6218
+ value: contextValue
6219
+ }, children);
6220
+ };
6221
+
6222
+ /***/ }),
6223
+
6224
+ /***/ "../../victory-core/es/victory-portal/portal-outlet.js":
6225
+ /*!*************************************************************!*\
6226
+ !*** ../../victory-core/es/victory-portal/portal-outlet.js ***!
6227
+ \*************************************************************/
6228
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
6229
+
6230
+ "use strict";
6231
+ __webpack_require__.r(__webpack_exports__);
6232
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6233
+ /* harmony export */ "PortalOutlet": function() { return /* binding */ PortalOutlet; }
6234
+ /* harmony export */ });
6235
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
6236
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6237
+ /* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
6238
+
6239
+
6240
+ const PortalOutlet = _ref => {
6241
+ let {
6242
+ as: portalComponent,
6243
+ ...props
6244
+ } = _ref;
6245
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_1__.usePortalContext)();
6246
+ if (!portalContext) {
6247
+ return null;
6248
+ }
6249
+ const children = Array.from(portalContext.children.values());
6250
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(portalComponent, props, children);
6251
+ };
6222
6252
 
6223
6253
  /***/ }),
6224
6254
 
@@ -6235,39 +6265,13 @@ __webpack_require__.r(__webpack_exports__);
6235
6265
  /* harmony export */ });
6236
6266
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
6237
6267
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6268
+ 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); }
6238
6269
 
6239
- class Portal extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) {
6240
- static displayName = "Portal";
6241
- constructor(props) {
6242
- super(props);
6243
- this.map = {};
6244
- this.index = 1;
6245
- }
6246
- portalRegister = () => {
6247
- return ++this.index;
6248
- };
6249
- portalUpdate = (key, element) => {
6250
- this.map[key] = element;
6251
- this.forceUpdate();
6252
- };
6253
- portalDeregister = key => {
6254
- delete this.map[key];
6255
- this.forceUpdate();
6256
- };
6257
- getChildren() {
6258
- return Object.keys(this.map).map(key => {
6259
- const el = this.map[key];
6260
- return el ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(el, {
6261
- key
6262
- }) : el;
6263
- });
6264
- }
6265
-
6266
- // Overridden in victory-core-native
6267
- render() {
6268
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", this.props, this.getChildren());
6269
- }
6270
- }
6270
+ const Portal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef((props, ref) => {
6271
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
6272
+ ref: ref
6273
+ }, props));
6274
+ });
6271
6275
 
6272
6276
  /***/ }),
6273
6277
 
@@ -6294,59 +6298,44 @@ __webpack_require__.r(__webpack_exports__);
6294
6298
 
6295
6299
 
6296
6300
 
6297
- class VictoryPortal extends (react__WEBPACK_IMPORTED_MODULE_1___default().Component) {
6298
- static displayName = "VictoryPortal";
6299
- static role = "portal";
6300
- static defaultProps = {
6301
- groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
6301
+ const defaultProps = {
6302
+ groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
6303
+ };
6304
+ const VictoryPortal = initialProps => {
6305
+ const props = {
6306
+ ...defaultProps,
6307
+ ...initialProps
6302
6308
  };
6303
- static contextType = _portal_context__WEBPACK_IMPORTED_MODULE_2__.PortalContext;
6304
- componentDidMount() {
6305
- if (!this.checkedContext) {
6306
- if (typeof this.context.portalUpdate !== "function") {
6307
- const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
6308
- _victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
6309
- this.renderInPlace = true;
6310
- }
6311
- this.checkedContext = true;
6312
- }
6313
- this.forceUpdate();
6314
- }
6315
- componentDidUpdate() {
6316
- if (!this.renderInPlace) {
6317
- this.portalKey = this.portalKey || this.context.portalRegister();
6318
- this.context.portalUpdate(this.portalKey, this.element);
6319
- }
6320
- }
6321
- componentWillUnmount() {
6322
- if (this.context && this.context.portalDeregister) {
6323
- this.context.portalDeregister(this.portalKey);
6324
- }
6325
- }
6326
-
6327
- // Overridden in victory-core-native
6328
- renderPortal(child) {
6329
- if (this.renderInPlace) {
6330
- return child;
6331
- }
6332
- this.element = child;
6333
- return null;
6334
- }
6335
- render() {
6336
- const children = Array.isArray(this.props.children) ? this.props.children[0] : this.props.children;
6337
- const {
6338
- groupComponent
6339
- } = this.props;
6340
- const childProps = children && children.props || {};
6341
- const standardProps = childProps.groupComponent ? {
6342
- groupComponent,
6343
- standalone: false
6344
- } : {};
6345
- const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(this.props, ["children", "groupComponent"]));
6346
- const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
6347
- return this.renderPortal(child);
6309
+ const id = react__WEBPACK_IMPORTED_MODULE_1___default().useId();
6310
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_2__.usePortalContext)();
6311
+ if (!portalContext) {
6312
+ const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
6313
+ _victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
6348
6314
  }
6349
- }
6315
+ const children = Array.isArray(props.children) ? props.children[0] : props.children;
6316
+ const {
6317
+ groupComponent
6318
+ } = props;
6319
+ const childProps = children && children.props || {};
6320
+ const standardProps = childProps.groupComponent ? {
6321
+ groupComponent,
6322
+ standalone: false
6323
+ } : {};
6324
+ const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(props, ["children", "groupComponent"]), {
6325
+ key: childProps.key ?? id
6326
+ });
6327
+ const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
6328
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
6329
+ portalContext?.addChild(id, child);
6330
+ // eslint-disable-next-line react-hooks/exhaustive-deps
6331
+ }, [props.children]);
6332
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
6333
+ return () => portalContext?.removeChild(id);
6334
+ // eslint-disable-next-line react-hooks/exhaustive-deps
6335
+ }, []);
6336
+ return portalContext ? null : child;
6337
+ };
6338
+ VictoryPortal.role = "portal";
6350
6339
 
6351
6340
  /***/ }),
6352
6341
 
@@ -10294,6 +10283,44 @@ function warn(message) {
10294
10283
 
10295
10284
  /***/ }),
10296
10285
 
10286
+ /***/ "../../victory-core/es/victory-util/merge-refs.js":
10287
+ /*!********************************************************!*\
10288
+ !*** ../../victory-core/es/victory-util/merge-refs.js ***!
10289
+ \********************************************************/
10290
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
10291
+
10292
+ "use strict";
10293
+ __webpack_require__.r(__webpack_exports__);
10294
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10295
+ /* harmony export */ "mergeRefs": function() { return /* binding */ mergeRefs; }
10296
+ /* harmony export */ });
10297
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
10298
+
10299
+ /**
10300
+ * Used to merge multiple React refs into a single callback ref.
10301
+ *
10302
+ * @example
10303
+ * ```tsx
10304
+ * <div ref={mergeRefs([ref, forwardedRef])} />
10305
+ * ```
10306
+ */
10307
+ function mergeRefs(refs) {
10308
+ return value => {
10309
+ refs.forEach(ref => {
10310
+ // If the ref is a function, it's a callback ref and we call it with the value.
10311
+ if (_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction(ref)) {
10312
+ ref(value);
10313
+ } else if (ref !== null && ref !== undefined) {
10314
+ // If the ref is an object (not null and not undefined), it's an object ref.
10315
+ // We assign the value to its 'current' property.
10316
+ ref.current = value;
10317
+ }
10318
+ });
10319
+ };
10320
+ }
10321
+
10322
+ /***/ }),
10323
+
10297
10324
  /***/ "../../victory-core/es/victory-util/scale.js":
10298
10325
  /*!***************************************************!*\
10299
10326
  !*** ../../victory-core/es/victory-util/scale.js ***!