victory-histogram 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-histogram
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
@@ -6184,23 +6184,18 @@ const VictoryAnimation = _ref => {
6184
6184
  "use strict";
6185
6185
  __webpack_require__.r(__webpack_exports__);
6186
6186
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6187
- /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; }
6187
+ /* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
6188
+ /* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
6188
6189
  /* harmony export */ });
6189
- /* 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");
6190
- /* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_isObject__WEBPACK_IMPORTED_MODULE_0__);
6191
- /* 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");
6192
- /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1__);
6193
- /* 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");
6194
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_2__);
6195
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "react");
6196
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
6197
- /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
6198
- /* 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");
6199
- /* 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");
6200
- /* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
6201
- /* 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");
6202
-
6203
-
6190
+ /* 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");
6191
+ /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
6192
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
6193
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
6194
+ /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
6195
+ /* 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");
6196
+ /* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
6197
+ /* 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");
6198
+ /* 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");
6204
6199
 
6205
6200
  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); }
6206
6201
 
@@ -6209,175 +6204,149 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
6209
6204
 
6210
6205
 
6211
6206
 
6212
- class VictoryContainer extends (react__WEBPACK_IMPORTED_MODULE_3___default().Component) {
6213
- static displayName = "VictoryContainer";
6214
- static role = "container";
6215
- static defaultProps = {
6216
- className: "VictoryContainer",
6217
- portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_4__.Portal, null),
6218
- portalZIndex: 99,
6219
- responsive: true,
6220
- role: "img"
6221
- };
6222
- static contextType = _victory_util_timer_context__WEBPACK_IMPORTED_MODULE_5__["default"];
6223
-
6224
- // @ts-expect-error Ref will be initialized on mount
6225
-
6226
- // @ts-expect-error Ref will be initialized on mount
6227
-
6228
- constructor(props) {
6229
- super(props);
6230
- this.containerId = !lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default()(props) || props.containerId === undefined ? lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default()("victory-container-") : props.containerId;
6231
- this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
6232
- }
6233
- savePortalRef = portal => {
6234
- this.portalRef = portal;
6235
- return portal;
6207
+ const defaultProps = {
6208
+ className: "VictoryContainer",
6209
+ portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__.Portal, null),
6210
+ portalZIndex: 99,
6211
+ responsive: true,
6212
+ role: "img"
6213
+ };
6214
+ function useVictoryContainer(initialProps) {
6215
+ const props = {
6216
+ ...defaultProps,
6217
+ ...initialProps
6236
6218
  };
6237
- portalUpdate = (key, el) => this.portalRef.portalUpdate(key, el);
6238
- portalRegister = () => this.portalRef.portalRegister();
6239
- portalDeregister = key => this.portalRef.portalDeregister(key);
6240
- saveContainerRef = container => {
6241
- if (_victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(this.props.containerRef)) {
6242
- this.props.containerRef(container);
6243
- }
6244
- this.containerRef = container;
6245
- return container;
6219
+ const {
6220
+ title,
6221
+ desc,
6222
+ width,
6223
+ height,
6224
+ responsive
6225
+ } = props;
6226
+ const localContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
6227
+
6228
+ // Generated ID stored in ref because it needs to persist across renders
6229
+ const generatedId = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()("victory-container-"));
6230
+ const containerId = props.containerId ?? generatedId.current;
6231
+ const getIdForElement = elName => `${containerId}-${elName}`;
6232
+ const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
6233
+ const dimensions = responsive ? {
6234
+ width: "100%",
6235
+ height: "100%"
6236
+ } : {
6237
+ width,
6238
+ height
6246
6239
  };
6247
- handleWheel = e => e.preventDefault();
6248
- componentDidMount() {
6249
- if (this.shouldHandleWheel && this.containerRef) {
6250
- this.containerRef.addEventListener("wheel", this.handleWheel);
6251
- }
6252
- }
6253
- componentWillUnmount() {
6254
- if (this.shouldHandleWheel && this.containerRef) {
6255
- this.containerRef.removeEventListener("wheel", this.handleWheel);
6256
- }
6257
- }
6258
- getIdForElement(elementName) {
6259
- return `${this.containerId}-${elementName}`;
6260
- }
6261
-
6262
- // overridden in custom containers
6263
- getChildren(props) {
6264
- return props.children;
6265
- }
6266
-
6267
- // Get props defined by the Open UI Automation (OUIA) 1.0-RC spec
6268
- // See https://ouia.readthedocs.io/en/latest/README.html#ouia-component
6269
- getOUIAProps(props) {
6270
- const {
6271
- ouiaId,
6272
- ouiaSafe,
6273
- ouiaType
6274
- } = props;
6275
- return {
6276
- ...(ouiaId && {
6277
- "data-ouia-component-id": ouiaId
6278
- }),
6279
- ...(ouiaType && {
6280
- "data-ouia-component-type": ouiaType
6281
- }),
6282
- ...(ouiaSafe !== undefined && {
6283
- "data-ouia-safe": ouiaSafe
6284
- })
6285
- };
6286
- }
6287
- renderContainer(props, svgProps, style) {
6288
- const {
6289
- title,
6290
- desc,
6291
- portalComponent,
6292
- className,
6293
- width,
6294
- height,
6295
- portalZIndex,
6296
- responsive
6297
- } = props;
6298
- const children = this.getChildren(props);
6299
- const dimensions = responsive ? {
6300
- width: "100%",
6301
- height: "100%"
6302
- } : {
6303
- width,
6304
- height
6240
+ const viewBox = responsive ? `0 0 ${width} ${height}` : undefined;
6241
+ const preserveAspectRatio = responsive ? props.preserveAspectRatio : undefined;
6242
+ const ariaLabelledBy = [title && getIdForElement("title"), props["aria-labelledby"]].filter(Boolean).join(" ") || undefined;
6243
+ const ariaDescribedBy = [desc && getIdForElement("desc"), props["aria-describedby"]].filter(Boolean).join(" ") || undefined;
6244
+ const titleId = getIdForElement("title");
6245
+ const descId = getIdForElement("desc");
6246
+ return {
6247
+ ...props,
6248
+ titleId,
6249
+ descId,
6250
+ dimensions,
6251
+ viewBox,
6252
+ preserveAspectRatio,
6253
+ ariaLabelledBy,
6254
+ ariaDescribedBy,
6255
+ userProps,
6256
+ localContainerRef
6257
+ };
6258
+ }
6259
+ const VictoryContainer = initialProps => {
6260
+ const {
6261
+ role,
6262
+ title,
6263
+ desc,
6264
+ children,
6265
+ className,
6266
+ portalZIndex,
6267
+ portalComponent,
6268
+ width,
6269
+ height,
6270
+ style,
6271
+ tabIndex,
6272
+ responsive,
6273
+ events,
6274
+ ouiaId,
6275
+ ouiaSafe,
6276
+ ouiaType,
6277
+ dimensions,
6278
+ ariaDescribedBy,
6279
+ ariaLabelledBy,
6280
+ viewBox,
6281
+ preserveAspectRatio,
6282
+ userProps,
6283
+ titleId,
6284
+ descId,
6285
+ containerRef,
6286
+ localContainerRef
6287
+ } = useVictoryContainer(initialProps);
6288
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
6289
+ if (!events?.onWheel) return;
6290
+ const handleWheel = e => e.preventDefault();
6291
+ const container = localContainerRef?.current;
6292
+ container?.addEventListener("wheel", handleWheel);
6293
+ return () => {
6294
+ container?.removeEventListener("wheel", handleWheel);
6305
6295
  };
6306
- const divStyle = Object.assign({
6296
+ // eslint-disable-next-line react-hooks/exhaustive-deps
6297
+ }, []);
6298
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
6299
+ className: className,
6300
+ style: {
6301
+ ...style,
6302
+ width: responsive ? style?.width : dimensions.width,
6303
+ height: responsive ? style?.height : dimensions.height,
6307
6304
  pointerEvents: "none",
6308
6305
  touchAction: "none",
6309
6306
  position: "relative"
6310
- }, dimensions);
6311
- const portalDivStyle = Object.assign({
6307
+ },
6308
+ "data-ouia-component-id": ouiaId,
6309
+ "data-ouia-component-type": ouiaType,
6310
+ "data-ouia-safe": ouiaSafe,
6311
+ ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_4__.mergeRefs)([localContainerRef, containerRef])
6312
+ }, /*#__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({
6313
+ width: width,
6314
+ height: height,
6315
+ tabIndex: tabIndex,
6316
+ role: role,
6317
+ "aria-labelledby": ariaLabelledBy,
6318
+ "aria-describedby": ariaDescribedBy,
6319
+ viewBox: viewBox,
6320
+ preserveAspectRatio: preserveAspectRatio,
6321
+ style: {
6322
+ ...dimensions,
6323
+ pointerEvents: "all"
6324
+ }
6325
+ }, userProps, events), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("title", {
6326
+ id: titleId
6327
+ }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("desc", {
6328
+ id: descId
6329
+ }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
6330
+ style: {
6331
+ ...dimensions,
6312
6332
  zIndex: portalZIndex,
6313
6333
  position: "absolute",
6314
6334
  top: 0,
6315
6335
  left: 0
6316
- }, dimensions);
6317
- const svgStyle = Object.assign({
6318
- pointerEvents: "all"
6319
- }, dimensions);
6320
- const portalSvgStyle = Object.assign({
6336
+ }
6337
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__.PortalOutlet, {
6338
+ as: portalComponent,
6339
+ width: width,
6340
+ height: height,
6341
+ viewBox: viewBox,
6342
+ preserveAspectRatio: preserveAspectRatio,
6343
+ style: {
6344
+ ...dimensions,
6321
6345
  overflow: "visible"
6322
- }, dimensions);
6323
- const portalProps = {
6324
- width,
6325
- height,
6326
- viewBox: svgProps.viewBox,
6327
- preserveAspectRatio: svgProps.preserveAspectRatio,
6328
- style: portalSvgStyle
6329
- };
6330
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_7__.PortalContext.Provider, {
6331
- value: {
6332
- portalUpdate: this.portalUpdate,
6333
- portalRegister: this.portalRegister,
6334
- portalDeregister: this.portalDeregister
6335
- }
6336
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", _extends({
6337
- style: lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, style, divStyle),
6338
- className: className,
6339
- ref: this.saveContainerRef
6340
- }, this.getOUIAProps(props)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("svg", _extends({}, svgProps, {
6341
- style: svgStyle
6342
- }), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("title", {
6343
- id: this.getIdForElement("title")
6344
- }, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("desc", {
6345
- id: this.getIdForElement("desc")
6346
- }, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", {
6347
- style: portalDivStyle
6348
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().cloneElement(portalComponent, {
6349
- ...portalProps,
6350
- ref: this.savePortalRef
6351
- }))));
6352
- }
6353
- render() {
6354
- const {
6355
- width,
6356
- height,
6357
- responsive,
6358
- events,
6359
- title,
6360
- desc,
6361
- tabIndex,
6362
- preserveAspectRatio,
6363
- role
6364
- } = this.props;
6365
- const style = responsive ? this.props.style : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.omit(this.props.style, ["height", "width"]);
6366
- const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__.getSafeUserProps(this.props);
6367
- const svgProps = Object.assign({
6368
- width,
6369
- height,
6370
- tabIndex,
6371
- role,
6372
- "aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
6373
- "aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
6374
- viewBox: responsive ? `0 0 ${width} ${height}` : undefined,
6375
- preserveAspectRatio: responsive ? preserveAspectRatio : undefined,
6376
- ...userProps
6377
- }, events);
6378
- return this.renderContainer(this.props, svgProps, style);
6379
- }
6380
- }
6346
+ }
6347
+ }))));
6348
+ };
6349
+ VictoryContainer.role = "container";
6381
6350
 
6382
6351
  /***/ }),
6383
6352
 
@@ -6890,17 +6859,78 @@ VictoryLabel.defaultStyles = defaultStyles;
6890
6859
  "use strict";
6891
6860
  __webpack_require__.r(__webpack_exports__);
6892
6861
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6893
- /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; }
6862
+ /* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; },
6863
+ /* harmony export */ "PortalProvider": function() { return /* binding */ PortalProvider; },
6864
+ /* harmony export */ "usePortalContext": function() { return /* binding */ usePortalContext; }
6894
6865
  /* harmony export */ });
6895
6866
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
6896
6867
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6897
6868
 
6898
- /**
6899
- * The React context object consumers may use to access the context of the
6900
- * portal.
6901
- */
6902
- const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({});
6869
+ const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined);
6903
6870
  PortalContext.displayName = "PortalContext";
6871
+ const usePortalContext = () => {
6872
+ const context = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(PortalContext);
6873
+ return context;
6874
+ };
6875
+ const PortalProvider = _ref => {
6876
+ let {
6877
+ children
6878
+ } = _ref;
6879
+ const [portalChildren, setPortalChildren] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(new Map());
6880
+ const addChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((id, element) => {
6881
+ setPortalChildren(prevChildren => {
6882
+ const nextChildren = new Map(prevChildren);
6883
+ nextChildren.set(id, element);
6884
+ return nextChildren;
6885
+ });
6886
+ }, [setPortalChildren]);
6887
+ const removeChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(id => {
6888
+ setPortalChildren(prevChildren => {
6889
+ const nextChildren = new Map(prevChildren);
6890
+ nextChildren.delete(id);
6891
+ return nextChildren;
6892
+ });
6893
+ }, [setPortalChildren]);
6894
+ const contextValue = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => ({
6895
+ addChild,
6896
+ removeChild,
6897
+ children: portalChildren
6898
+ }), [addChild, removeChild, portalChildren]);
6899
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PortalContext.Provider, {
6900
+ value: contextValue
6901
+ }, children);
6902
+ };
6903
+
6904
+ /***/ }),
6905
+
6906
+ /***/ "../../victory-core/es/victory-portal/portal-outlet.js":
6907
+ /*!*************************************************************!*\
6908
+ !*** ../../victory-core/es/victory-portal/portal-outlet.js ***!
6909
+ \*************************************************************/
6910
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
6911
+
6912
+ "use strict";
6913
+ __webpack_require__.r(__webpack_exports__);
6914
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6915
+ /* harmony export */ "PortalOutlet": function() { return /* binding */ PortalOutlet; }
6916
+ /* harmony export */ });
6917
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
6918
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6919
+ /* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
6920
+
6921
+
6922
+ const PortalOutlet = _ref => {
6923
+ let {
6924
+ as: portalComponent,
6925
+ ...props
6926
+ } = _ref;
6927
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_1__.usePortalContext)();
6928
+ if (!portalContext) {
6929
+ return null;
6930
+ }
6931
+ const children = Array.from(portalContext.children.values());
6932
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(portalComponent, props, children);
6933
+ };
6904
6934
 
6905
6935
  /***/ }),
6906
6936
 
@@ -6917,39 +6947,13 @@ __webpack_require__.r(__webpack_exports__);
6917
6947
  /* harmony export */ });
6918
6948
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
6919
6949
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
6950
+ 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); }
6920
6951
 
6921
- class Portal extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) {
6922
- static displayName = "Portal";
6923
- constructor(props) {
6924
- super(props);
6925
- this.map = {};
6926
- this.index = 1;
6927
- }
6928
- portalRegister = () => {
6929
- return ++this.index;
6930
- };
6931
- portalUpdate = (key, element) => {
6932
- this.map[key] = element;
6933
- this.forceUpdate();
6934
- };
6935
- portalDeregister = key => {
6936
- delete this.map[key];
6937
- this.forceUpdate();
6938
- };
6939
- getChildren() {
6940
- return Object.keys(this.map).map(key => {
6941
- const el = this.map[key];
6942
- return el ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(el, {
6943
- key
6944
- }) : el;
6945
- });
6946
- }
6947
-
6948
- // Overridden in victory-core-native
6949
- render() {
6950
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", this.props, this.getChildren());
6951
- }
6952
- }
6952
+ const Portal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef((props, ref) => {
6953
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
6954
+ ref: ref
6955
+ }, props));
6956
+ });
6953
6957
 
6954
6958
  /***/ }),
6955
6959
 
@@ -6976,59 +6980,44 @@ __webpack_require__.r(__webpack_exports__);
6976
6980
 
6977
6981
 
6978
6982
 
6979
- class VictoryPortal extends (react__WEBPACK_IMPORTED_MODULE_1___default().Component) {
6980
- static displayName = "VictoryPortal";
6981
- static role = "portal";
6982
- static defaultProps = {
6983
- groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
6984
- };
6985
- static contextType = _portal_context__WEBPACK_IMPORTED_MODULE_2__.PortalContext;
6986
- componentDidMount() {
6987
- if (!this.checkedContext) {
6988
- if (typeof this.context.portalUpdate !== "function") {
6989
- const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
6990
- _victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
6991
- this.renderInPlace = true;
6992
- }
6993
- this.checkedContext = true;
6994
- }
6995
- this.forceUpdate();
6996
- }
6997
- componentDidUpdate() {
6998
- if (!this.renderInPlace) {
6999
- this.portalKey = this.portalKey || this.context.portalRegister();
7000
- this.context.portalUpdate(this.portalKey, this.element);
7001
- }
7002
- }
7003
- componentWillUnmount() {
7004
- if (this.context && this.context.portalDeregister) {
7005
- this.context.portalDeregister(this.portalKey);
7006
- }
7007
- }
7008
-
7009
- // Overridden in victory-core-native
7010
- renderPortal(child) {
7011
- if (this.renderInPlace) {
7012
- return child;
7013
- }
7014
- this.element = child;
7015
- return null;
7016
- }
7017
- render() {
7018
- const children = Array.isArray(this.props.children) ? this.props.children[0] : this.props.children;
7019
- const {
7020
- groupComponent
7021
- } = this.props;
7022
- const childProps = children && children.props || {};
7023
- const standardProps = childProps.groupComponent ? {
7024
- groupComponent,
7025
- standalone: false
7026
- } : {};
7027
- const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(this.props, ["children", "groupComponent"]));
7028
- const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
7029
- return this.renderPortal(child);
7030
- }
7031
- }
6983
+ const defaultProps = {
6984
+ groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
6985
+ };
6986
+ const VictoryPortal = initialProps => {
6987
+ const props = {
6988
+ ...defaultProps,
6989
+ ...initialProps
6990
+ };
6991
+ const id = react__WEBPACK_IMPORTED_MODULE_1___default().useId();
6992
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_2__.usePortalContext)();
6993
+ if (!portalContext) {
6994
+ const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
6995
+ _victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
6996
+ }
6997
+ const children = Array.isArray(props.children) ? props.children[0] : props.children;
6998
+ const {
6999
+ groupComponent
7000
+ } = props;
7001
+ const childProps = children && children.props || {};
7002
+ const standardProps = childProps.groupComponent ? {
7003
+ groupComponent,
7004
+ standalone: false
7005
+ } : {};
7006
+ const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(props, ["children", "groupComponent"]), {
7007
+ key: childProps.key ?? id
7008
+ });
7009
+ const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
7010
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
7011
+ portalContext?.addChild(id, child);
7012
+ // eslint-disable-next-line react-hooks/exhaustive-deps
7013
+ }, [props.children]);
7014
+ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
7015
+ return () => portalContext?.removeChild(id);
7016
+ // eslint-disable-next-line react-hooks/exhaustive-deps
7017
+ }, []);
7018
+ return portalContext ? null : child;
7019
+ };
7020
+ VictoryPortal.role = "portal";
7032
7021
 
7033
7022
  /***/ }),
7034
7023
 
@@ -10382,6 +10371,44 @@ function warn(message) {
10382
10371
 
10383
10372
  /***/ }),
10384
10373
 
10374
+ /***/ "../../victory-core/es/victory-util/merge-refs.js":
10375
+ /*!********************************************************!*\
10376
+ !*** ../../victory-core/es/victory-util/merge-refs.js ***!
10377
+ \********************************************************/
10378
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
10379
+
10380
+ "use strict";
10381
+ __webpack_require__.r(__webpack_exports__);
10382
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10383
+ /* harmony export */ "mergeRefs": function() { return /* binding */ mergeRefs; }
10384
+ /* harmony export */ });
10385
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
10386
+
10387
+ /**
10388
+ * Used to merge multiple React refs into a single callback ref.
10389
+ *
10390
+ * @example
10391
+ * ```tsx
10392
+ * <div ref={mergeRefs([ref, forwardedRef])} />
10393
+ * ```
10394
+ */
10395
+ function mergeRefs(refs) {
10396
+ return value => {
10397
+ refs.forEach(ref => {
10398
+ // If the ref is a function, it's a callback ref and we call it with the value.
10399
+ if (_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction(ref)) {
10400
+ ref(value);
10401
+ } else if (ref !== null && ref !== undefined) {
10402
+ // If the ref is an object (not null and not undefined), it's an object ref.
10403
+ // We assign the value to its 'current' property.
10404
+ ref.current = value;
10405
+ }
10406
+ });
10407
+ };
10408
+ }
10409
+
10410
+ /***/ }),
10411
+
10385
10412
  /***/ "../../victory-core/es/victory-util/scale.js":
10386
10413
  /*!***************************************************!*\
10387
10414
  !*** ../../victory-core/es/victory-util/scale.js ***!