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