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 +6 -0
- package/dist/victory-polar-axis.js +289 -262
- package/dist/victory-polar-axis.min.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -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
|
|
5508
|
-
/* harmony import */ var
|
|
5509
|
-
/* harmony import */ var
|
|
5510
|
-
/* harmony import */ var
|
|
5511
|
-
/* harmony import */ var
|
|
5512
|
-
/* harmony import */ var
|
|
5513
|
-
/* harmony import */ var
|
|
5514
|
-
/* harmony import */ var
|
|
5515
|
-
/* harmony import */ var
|
|
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
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
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
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
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
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
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
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
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
|
-
|
|
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
|
-
},
|
|
5629
|
-
|
|
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
|
-
}
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
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
|
-
}
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
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
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
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
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
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
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
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 ***!
|