victory-errorbar 37.0.2 → 37.0.3-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # victory-errorbar
2
2
 
3
+ ## 37.0.3-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [65d02419f]
8
+ - victory-core@37.0.3-next.0
9
+
3
10
  ## 37.0.2
4
11
 
5
12
  ### 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_5__ = __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_4__ = __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(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_4__.PortalProvider, null, /*#__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_5__.mergeRefs)([localContainerRef, containerRef])
5636
+ }, /*#__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,83 @@ 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
+ if (!context) {
6198
+ throw new Error("`usePortalContext` must be used within a `<PortalProvider />`");
6199
+ }
6200
+ return context;
6201
+ };
6202
+ const PortalProvider = _ref => {
6203
+ let {
6204
+ children
6205
+ } = _ref;
6206
+ const [portalChildren, setPortalChildren] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(new Map());
6207
+ const addChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((id, element) => {
6208
+ setPortalChildren(prevChildren => {
6209
+ const nextChildren = new Map(prevChildren);
6210
+ nextChildren.set(id, element);
6211
+ return nextChildren;
6212
+ });
6213
+ }, [setPortalChildren]);
6214
+ const removeChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(id => {
6215
+ setPortalChildren(prevChildren => {
6216
+ const nextChildren = new Map(prevChildren);
6217
+ nextChildren.delete(id);
6218
+ return nextChildren;
6219
+ });
6220
+ }, [setPortalChildren]);
6221
+ const contextValue = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => ({
6222
+ addChild,
6223
+ removeChild,
6224
+ children: portalChildren
6225
+ }), [addChild, removeChild, portalChildren]);
6226
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PortalContext.Provider, {
6227
+ value: contextValue
6228
+ }, children);
6229
+ };
6230
+
6231
+ /***/ }),
6232
+
6233
+ /***/ "../../victory-core/es/victory-portal/portal-outlet.js":
6234
+ /*!*************************************************************!*\
6235
+ !*** ../../victory-core/es/victory-portal/portal-outlet.js ***!
6236
+ \*************************************************************/
6237
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
6238
+
6239
+ "use strict";
6240
+ __webpack_require__.r(__webpack_exports__);
6241
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6242
+ /* harmony export */ "PortalOutlet": function() { return /* binding */ PortalOutlet; }
6243
+ /* harmony export */ });
6244
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
6245
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6246
+ /* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
6247
+
6248
+
6249
+ const PortalOutlet = _ref => {
6250
+ let {
6251
+ as: portalComponent,
6252
+ ...props
6253
+ } = _ref;
6254
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_1__.usePortalContext)();
6255
+ const children = Array.from(portalContext.children.entries()).map(_ref2 => {
6256
+ let [key, node] = _ref2;
6257
+ return !node.key ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(node, {
6258
+ key
6259
+ }) : node;
6260
+ });
6261
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(portalComponent, props, children);
6262
+ };
6228
6263
 
6229
6264
  /***/ }),
6230
6265
 
@@ -6241,39 +6276,13 @@ __webpack_require__.r(__webpack_exports__);
6241
6276
  /* harmony export */ });
6242
6277
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
6243
6278
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6279
+ 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
6280
 
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
- }
6281
+ const Portal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef((props, ref) => {
6282
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
6283
+ ref: ref
6284
+ }, props));
6285
+ });
6277
6286
 
6278
6287
  /***/ }),
6279
6288
 
@@ -6300,59 +6309,42 @@ __webpack_require__.r(__webpack_exports__);
6300
6309
 
6301
6310
 
6302
6311
 
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)
6312
+ const defaultProps = {
6313
+ groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
6314
+ };
6315
+ const VictoryPortal = initialProps => {
6316
+ const props = {
6317
+ ...defaultProps,
6318
+ ...initialProps
6308
6319
  };
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;
6340
- }
6341
- render() {
6342
- const children = Array.isArray(this.props.children) ? this.props.children[0] : this.props.children;
6320
+ const id = react__WEBPACK_IMPORTED_MODULE_1___default().useId();
6321
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_2__.usePortalContext)();
6322
+ if (!portalContext) {
6323
+ const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
6324
+ _victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
6325
+ }
6326
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
6327
+ const children = Array.isArray(props.children) ? props.children[0] : props.children;
6343
6328
  const {
6344
6329
  groupComponent
6345
- } = this.props;
6330
+ } = props;
6346
6331
  const childProps = children && children.props || {};
6347
6332
  const standardProps = childProps.groupComponent ? {
6348
6333
  groupComponent,
6349
6334
  standalone: false
6350
6335
  } : {};
6351
- const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(this.props, ["children", "groupComponent"]));
6336
+ const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(props, ["children", "groupComponent"]));
6352
6337
  const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
6353
- return this.renderPortal(child);
6354
- }
6355
- }
6338
+ portalContext.addChild(id, child);
6339
+ // eslint-disable-next-line react-hooks/exhaustive-deps
6340
+ }, [props.children]);
6341
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
6342
+ return () => portalContext.removeChild(id);
6343
+ // eslint-disable-next-line react-hooks/exhaustive-deps
6344
+ }, []);
6345
+ return null;
6346
+ };
6347
+ VictoryPortal.role = "portal";
6356
6348
 
6357
6349
  /***/ }),
6358
6350
 
@@ -9811,6 +9803,44 @@ function warn(message) {
9811
9803
 
9812
9804
  /***/ }),
9813
9805
 
9806
+ /***/ "../../victory-core/es/victory-util/merge-refs.js":
9807
+ /*!********************************************************!*\
9808
+ !*** ../../victory-core/es/victory-util/merge-refs.js ***!
9809
+ \********************************************************/
9810
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
9811
+
9812
+ "use strict";
9813
+ __webpack_require__.r(__webpack_exports__);
9814
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9815
+ /* harmony export */ "mergeRefs": function() { return /* binding */ mergeRefs; }
9816
+ /* harmony export */ });
9817
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
9818
+
9819
+ /**
9820
+ * Used to merge multiple React refs into a single callback ref.
9821
+ *
9822
+ * @example
9823
+ * ```tsx
9824
+ * <div ref={mergeRefs([ref, forwardedRef])} />
9825
+ * ```
9826
+ */
9827
+ function mergeRefs(refs) {
9828
+ return value => {
9829
+ refs.forEach(ref => {
9830
+ // If the ref is a function, it's a callback ref and we call it with the value.
9831
+ if (_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction(ref)) {
9832
+ ref(value);
9833
+ } else if (ref !== null && ref !== undefined) {
9834
+ // If the ref is an object (not null and not undefined), it's an object ref.
9835
+ // We assign the value to its 'current' property.
9836
+ ref.current = value;
9837
+ }
9838
+ });
9839
+ };
9840
+ }
9841
+
9842
+ /***/ }),
9843
+
9814
9844
  /***/ "../../victory-core/es/victory-util/scale.js":
9815
9845
  /*!***************************************************!*\
9816
9846
  !*** ../../victory-core/es/victory-util/scale.js ***!