victory-voronoi 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 +7 -0
- package/dist/victory-voronoi.js +285 -255
- package/dist/victory-voronoi.min.js +1 -1
- package/es/helper-methods.d.ts +3 -3
- package/es/index.d.ts +2 -2
- package/es/victory-voronoi.d.ts +86 -86
- package/es/voronoi.d.ts +15 -15
- package/lib/helper-methods.d.ts +3 -3
- package/lib/index.d.ts +2 -2
- package/lib/victory-voronoi.d.ts +86 -86
- package/lib/voronoi.d.ts +15 -15
- package/package.json +2 -5
package/CHANGELOG.md
CHANGED
package/dist/victory-voronoi.js
CHANGED
|
@@ -6374,23 +6374,18 @@ const VictoryAnimation = _ref => {
|
|
|
6374
6374
|
"use strict";
|
|
6375
6375
|
__webpack_require__.r(__webpack_exports__);
|
|
6376
6376
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6377
|
-
/* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; }
|
|
6377
|
+
/* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
|
|
6378
|
+
/* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
|
|
6378
6379
|
/* harmony export */ });
|
|
6379
|
-
/* harmony import */ var
|
|
6380
|
-
/* harmony import */ var
|
|
6381
|
-
/* harmony import */ var
|
|
6382
|
-
/* harmony import */ var
|
|
6383
|
-
/* harmony import */ var
|
|
6384
|
-
/* harmony import */ var
|
|
6385
|
-
/* harmony import */ var
|
|
6386
|
-
/* harmony import */ var
|
|
6387
|
-
/* harmony import */ var
|
|
6388
|
-
/* 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");
|
|
6389
|
-
/* 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");
|
|
6390
|
-
/* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
6391
|
-
/* 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");
|
|
6392
|
-
|
|
6393
|
-
|
|
6380
|
+
/* 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");
|
|
6381
|
+
/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
|
|
6382
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
|
|
6383
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
|
|
6384
|
+
/* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
|
|
6385
|
+
/* 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");
|
|
6386
|
+
/* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
|
|
6387
|
+
/* 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");
|
|
6388
|
+
/* 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");
|
|
6394
6389
|
|
|
6395
6390
|
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); }
|
|
6396
6391
|
|
|
@@ -6399,175 +6394,149 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
6399
6394
|
|
|
6400
6395
|
|
|
6401
6396
|
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6397
|
+
const defaultProps = {
|
|
6398
|
+
className: "VictoryContainer",
|
|
6399
|
+
portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__.Portal, null),
|
|
6400
|
+
portalZIndex: 99,
|
|
6401
|
+
responsive: true,
|
|
6402
|
+
role: "img"
|
|
6403
|
+
};
|
|
6404
|
+
function useVictoryContainer(initialProps) {
|
|
6405
|
+
const props = {
|
|
6406
|
+
...defaultProps,
|
|
6407
|
+
...initialProps
|
|
6411
6408
|
};
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6409
|
+
const {
|
|
6410
|
+
title,
|
|
6411
|
+
desc,
|
|
6412
|
+
width,
|
|
6413
|
+
height,
|
|
6414
|
+
responsive
|
|
6415
|
+
} = props;
|
|
6416
|
+
const localContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
|
|
6417
|
+
|
|
6418
|
+
// Generated ID stored in ref because it needs to persist across renders
|
|
6419
|
+
const generatedId = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()("victory-container-"));
|
|
6420
|
+
const containerId = props.containerId ?? generatedId.current;
|
|
6421
|
+
const getIdForElement = elName => `${containerId}-${elName}`;
|
|
6422
|
+
const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
|
|
6423
|
+
const dimensions = responsive ? {
|
|
6424
|
+
width: "100%",
|
|
6425
|
+
height: "100%"
|
|
6426
|
+
} : {
|
|
6427
|
+
width,
|
|
6428
|
+
height
|
|
6426
6429
|
};
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6430
|
+
const viewBox = responsive ? `0 0 ${width} ${height}` : undefined;
|
|
6431
|
+
const preserveAspectRatio = responsive ? props.preserveAspectRatio : undefined;
|
|
6432
|
+
const ariaLabelledBy = [title && getIdForElement("title"), props["aria-labelledby"]].filter(Boolean).join(" ") || undefined;
|
|
6433
|
+
const ariaDescribedBy = [desc && getIdForElement("desc"), props["aria-describedby"]].filter(Boolean).join(" ") || undefined;
|
|
6434
|
+
const titleId = getIdForElement("title");
|
|
6435
|
+
const descId = getIdForElement("desc");
|
|
6436
|
+
return {
|
|
6437
|
+
...props,
|
|
6438
|
+
titleId,
|
|
6439
|
+
descId,
|
|
6440
|
+
dimensions,
|
|
6441
|
+
viewBox,
|
|
6442
|
+
preserveAspectRatio,
|
|
6443
|
+
ariaLabelledBy,
|
|
6444
|
+
ariaDescribedBy,
|
|
6445
|
+
userProps,
|
|
6446
|
+
localContainerRef
|
|
6436
6447
|
};
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
})
|
|
6475
|
-
};
|
|
6476
|
-
}
|
|
6477
|
-
renderContainer(props, svgProps, style) {
|
|
6478
|
-
const {
|
|
6479
|
-
title,
|
|
6480
|
-
desc,
|
|
6481
|
-
portalComponent,
|
|
6482
|
-
className,
|
|
6483
|
-
width,
|
|
6484
|
-
height,
|
|
6485
|
-
portalZIndex,
|
|
6486
|
-
responsive
|
|
6487
|
-
} = props;
|
|
6488
|
-
const children = this.getChildren(props);
|
|
6489
|
-
const dimensions = responsive ? {
|
|
6490
|
-
width: "100%",
|
|
6491
|
-
height: "100%"
|
|
6492
|
-
} : {
|
|
6493
|
-
width,
|
|
6494
|
-
height
|
|
6448
|
+
}
|
|
6449
|
+
const VictoryContainer = initialProps => {
|
|
6450
|
+
const {
|
|
6451
|
+
role,
|
|
6452
|
+
title,
|
|
6453
|
+
desc,
|
|
6454
|
+
children,
|
|
6455
|
+
className,
|
|
6456
|
+
portalZIndex,
|
|
6457
|
+
portalComponent,
|
|
6458
|
+
width,
|
|
6459
|
+
height,
|
|
6460
|
+
style,
|
|
6461
|
+
tabIndex,
|
|
6462
|
+
responsive,
|
|
6463
|
+
events,
|
|
6464
|
+
ouiaId,
|
|
6465
|
+
ouiaSafe,
|
|
6466
|
+
ouiaType,
|
|
6467
|
+
dimensions,
|
|
6468
|
+
ariaDescribedBy,
|
|
6469
|
+
ariaLabelledBy,
|
|
6470
|
+
viewBox,
|
|
6471
|
+
preserveAspectRatio,
|
|
6472
|
+
userProps,
|
|
6473
|
+
titleId,
|
|
6474
|
+
descId,
|
|
6475
|
+
containerRef,
|
|
6476
|
+
localContainerRef
|
|
6477
|
+
} = useVictoryContainer(initialProps);
|
|
6478
|
+
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
|
|
6479
|
+
if (!events?.onWheel) return;
|
|
6480
|
+
const handleWheel = e => e.preventDefault();
|
|
6481
|
+
const container = localContainerRef?.current;
|
|
6482
|
+
container?.addEventListener("wheel", handleWheel);
|
|
6483
|
+
return () => {
|
|
6484
|
+
container?.removeEventListener("wheel", handleWheel);
|
|
6495
6485
|
};
|
|
6496
|
-
|
|
6486
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6487
|
+
}, []);
|
|
6488
|
+
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", {
|
|
6489
|
+
className: className,
|
|
6490
|
+
style: {
|
|
6491
|
+
...style,
|
|
6492
|
+
width: responsive ? style?.width : dimensions.width,
|
|
6493
|
+
height: responsive ? style?.height : dimensions.height,
|
|
6497
6494
|
pointerEvents: "none",
|
|
6498
6495
|
touchAction: "none",
|
|
6499
6496
|
position: "relative"
|
|
6500
|
-
},
|
|
6501
|
-
|
|
6497
|
+
},
|
|
6498
|
+
"data-ouia-component-id": ouiaId,
|
|
6499
|
+
"data-ouia-component-type": ouiaType,
|
|
6500
|
+
"data-ouia-safe": ouiaSafe,
|
|
6501
|
+
ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_5__.mergeRefs)([localContainerRef, containerRef])
|
|
6502
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("svg", _extends({
|
|
6503
|
+
width: width,
|
|
6504
|
+
height: height,
|
|
6505
|
+
tabIndex: tabIndex,
|
|
6506
|
+
role: role,
|
|
6507
|
+
"aria-labelledby": ariaLabelledBy,
|
|
6508
|
+
"aria-describedby": ariaDescribedBy,
|
|
6509
|
+
viewBox: viewBox,
|
|
6510
|
+
preserveAspectRatio: preserveAspectRatio,
|
|
6511
|
+
style: {
|
|
6512
|
+
...dimensions,
|
|
6513
|
+
pointerEvents: "all"
|
|
6514
|
+
}
|
|
6515
|
+
}, userProps, events), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("title", {
|
|
6516
|
+
id: titleId
|
|
6517
|
+
}, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("desc", {
|
|
6518
|
+
id: descId
|
|
6519
|
+
}, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
|
|
6520
|
+
style: {
|
|
6521
|
+
...dimensions,
|
|
6502
6522
|
zIndex: portalZIndex,
|
|
6503
6523
|
position: "absolute",
|
|
6504
6524
|
top: 0,
|
|
6505
6525
|
left: 0
|
|
6506
|
-
}
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6526
|
+
}
|
|
6527
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__.PortalOutlet, {
|
|
6528
|
+
as: portalComponent,
|
|
6529
|
+
width: width,
|
|
6530
|
+
height: height,
|
|
6531
|
+
viewBox: viewBox,
|
|
6532
|
+
preserveAspectRatio: preserveAspectRatio,
|
|
6533
|
+
style: {
|
|
6534
|
+
...dimensions,
|
|
6511
6535
|
overflow: "visible"
|
|
6512
|
-
}
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
viewBox: svgProps.viewBox,
|
|
6517
|
-
preserveAspectRatio: svgProps.preserveAspectRatio,
|
|
6518
|
-
style: portalSvgStyle
|
|
6519
|
-
};
|
|
6520
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_7__.PortalContext.Provider, {
|
|
6521
|
-
value: {
|
|
6522
|
-
portalUpdate: this.portalUpdate,
|
|
6523
|
-
portalRegister: this.portalRegister,
|
|
6524
|
-
portalDeregister: this.portalDeregister
|
|
6525
|
-
}
|
|
6526
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", _extends({
|
|
6527
|
-
style: lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, style, divStyle),
|
|
6528
|
-
className: className,
|
|
6529
|
-
ref: this.saveContainerRef
|
|
6530
|
-
}, this.getOUIAProps(props)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("svg", _extends({}, svgProps, {
|
|
6531
|
-
style: svgStyle
|
|
6532
|
-
}), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("title", {
|
|
6533
|
-
id: this.getIdForElement("title")
|
|
6534
|
-
}, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("desc", {
|
|
6535
|
-
id: this.getIdForElement("desc")
|
|
6536
|
-
}, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", {
|
|
6537
|
-
style: portalDivStyle
|
|
6538
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().cloneElement(portalComponent, {
|
|
6539
|
-
...portalProps,
|
|
6540
|
-
ref: this.savePortalRef
|
|
6541
|
-
}))));
|
|
6542
|
-
}
|
|
6543
|
-
render() {
|
|
6544
|
-
const {
|
|
6545
|
-
width,
|
|
6546
|
-
height,
|
|
6547
|
-
responsive,
|
|
6548
|
-
events,
|
|
6549
|
-
title,
|
|
6550
|
-
desc,
|
|
6551
|
-
tabIndex,
|
|
6552
|
-
preserveAspectRatio,
|
|
6553
|
-
role
|
|
6554
|
-
} = this.props;
|
|
6555
|
-
const style = responsive ? this.props.style : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.omit(this.props.style, ["height", "width"]);
|
|
6556
|
-
const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__.getSafeUserProps(this.props);
|
|
6557
|
-
const svgProps = Object.assign({
|
|
6558
|
-
width,
|
|
6559
|
-
height,
|
|
6560
|
-
tabIndex,
|
|
6561
|
-
role,
|
|
6562
|
-
"aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
|
|
6563
|
-
"aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
|
|
6564
|
-
viewBox: responsive ? `0 0 ${width} ${height}` : undefined,
|
|
6565
|
-
preserveAspectRatio: responsive ? preserveAspectRatio : undefined,
|
|
6566
|
-
...userProps
|
|
6567
|
-
}, events);
|
|
6568
|
-
return this.renderContainer(this.props, svgProps, style);
|
|
6569
|
-
}
|
|
6570
|
-
}
|
|
6536
|
+
}
|
|
6537
|
+
}))));
|
|
6538
|
+
};
|
|
6539
|
+
VictoryContainer.role = "container";
|
|
6571
6540
|
|
|
6572
6541
|
/***/ }),
|
|
6573
6542
|
|
|
@@ -7080,17 +7049,83 @@ VictoryLabel.defaultStyles = defaultStyles;
|
|
|
7080
7049
|
"use strict";
|
|
7081
7050
|
__webpack_require__.r(__webpack_exports__);
|
|
7082
7051
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7083
|
-
/* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; }
|
|
7052
|
+
/* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; },
|
|
7053
|
+
/* harmony export */ "PortalProvider": function() { return /* binding */ PortalProvider; },
|
|
7054
|
+
/* harmony export */ "usePortalContext": function() { return /* binding */ usePortalContext; }
|
|
7084
7055
|
/* harmony export */ });
|
|
7085
7056
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
7086
7057
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
7087
7058
|
|
|
7088
|
-
|
|
7089
|
-
* The React context object consumers may use to access the context of the
|
|
7090
|
-
* portal.
|
|
7091
|
-
*/
|
|
7092
|
-
const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({});
|
|
7059
|
+
const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined);
|
|
7093
7060
|
PortalContext.displayName = "PortalContext";
|
|
7061
|
+
const usePortalContext = () => {
|
|
7062
|
+
const context = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(PortalContext);
|
|
7063
|
+
if (!context) {
|
|
7064
|
+
throw new Error("`usePortalContext` must be used within a `<PortalProvider />`");
|
|
7065
|
+
}
|
|
7066
|
+
return context;
|
|
7067
|
+
};
|
|
7068
|
+
const PortalProvider = _ref => {
|
|
7069
|
+
let {
|
|
7070
|
+
children
|
|
7071
|
+
} = _ref;
|
|
7072
|
+
const [portalChildren, setPortalChildren] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(new Map());
|
|
7073
|
+
const addChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((id, element) => {
|
|
7074
|
+
setPortalChildren(prevChildren => {
|
|
7075
|
+
const nextChildren = new Map(prevChildren);
|
|
7076
|
+
nextChildren.set(id, element);
|
|
7077
|
+
return nextChildren;
|
|
7078
|
+
});
|
|
7079
|
+
}, [setPortalChildren]);
|
|
7080
|
+
const removeChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(id => {
|
|
7081
|
+
setPortalChildren(prevChildren => {
|
|
7082
|
+
const nextChildren = new Map(prevChildren);
|
|
7083
|
+
nextChildren.delete(id);
|
|
7084
|
+
return nextChildren;
|
|
7085
|
+
});
|
|
7086
|
+
}, [setPortalChildren]);
|
|
7087
|
+
const contextValue = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => ({
|
|
7088
|
+
addChild,
|
|
7089
|
+
removeChild,
|
|
7090
|
+
children: portalChildren
|
|
7091
|
+
}), [addChild, removeChild, portalChildren]);
|
|
7092
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PortalContext.Provider, {
|
|
7093
|
+
value: contextValue
|
|
7094
|
+
}, children);
|
|
7095
|
+
};
|
|
7096
|
+
|
|
7097
|
+
/***/ }),
|
|
7098
|
+
|
|
7099
|
+
/***/ "../../victory-core/es/victory-portal/portal-outlet.js":
|
|
7100
|
+
/*!*************************************************************!*\
|
|
7101
|
+
!*** ../../victory-core/es/victory-portal/portal-outlet.js ***!
|
|
7102
|
+
\*************************************************************/
|
|
7103
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
7104
|
+
|
|
7105
|
+
"use strict";
|
|
7106
|
+
__webpack_require__.r(__webpack_exports__);
|
|
7107
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7108
|
+
/* harmony export */ "PortalOutlet": function() { return /* binding */ PortalOutlet; }
|
|
7109
|
+
/* harmony export */ });
|
|
7110
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
7111
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
7112
|
+
/* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
|
|
7113
|
+
|
|
7114
|
+
|
|
7115
|
+
const PortalOutlet = _ref => {
|
|
7116
|
+
let {
|
|
7117
|
+
as: portalComponent,
|
|
7118
|
+
...props
|
|
7119
|
+
} = _ref;
|
|
7120
|
+
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_1__.usePortalContext)();
|
|
7121
|
+
const children = Array.from(portalContext.children.entries()).map(_ref2 => {
|
|
7122
|
+
let [key, node] = _ref2;
|
|
7123
|
+
return !node.key ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(node, {
|
|
7124
|
+
key
|
|
7125
|
+
}) : node;
|
|
7126
|
+
});
|
|
7127
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(portalComponent, props, children);
|
|
7128
|
+
};
|
|
7094
7129
|
|
|
7095
7130
|
/***/ }),
|
|
7096
7131
|
|
|
@@ -7107,39 +7142,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7107
7142
|
/* harmony export */ });
|
|
7108
7143
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
7109
7144
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
7145
|
+
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); }
|
|
7110
7146
|
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
this.index = 1;
|
|
7117
|
-
}
|
|
7118
|
-
portalRegister = () => {
|
|
7119
|
-
return ++this.index;
|
|
7120
|
-
};
|
|
7121
|
-
portalUpdate = (key, element) => {
|
|
7122
|
-
this.map[key] = element;
|
|
7123
|
-
this.forceUpdate();
|
|
7124
|
-
};
|
|
7125
|
-
portalDeregister = key => {
|
|
7126
|
-
delete this.map[key];
|
|
7127
|
-
this.forceUpdate();
|
|
7128
|
-
};
|
|
7129
|
-
getChildren() {
|
|
7130
|
-
return Object.keys(this.map).map(key => {
|
|
7131
|
-
const el = this.map[key];
|
|
7132
|
-
return el ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(el, {
|
|
7133
|
-
key
|
|
7134
|
-
}) : el;
|
|
7135
|
-
});
|
|
7136
|
-
}
|
|
7137
|
-
|
|
7138
|
-
// Overridden in victory-core-native
|
|
7139
|
-
render() {
|
|
7140
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", this.props, this.getChildren());
|
|
7141
|
-
}
|
|
7142
|
-
}
|
|
7147
|
+
const Portal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef((props, ref) => {
|
|
7148
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
|
|
7149
|
+
ref: ref
|
|
7150
|
+
}, props));
|
|
7151
|
+
});
|
|
7143
7152
|
|
|
7144
7153
|
/***/ }),
|
|
7145
7154
|
|
|
@@ -7166,59 +7175,42 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7166
7175
|
|
|
7167
7176
|
|
|
7168
7177
|
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7178
|
+
const defaultProps = {
|
|
7179
|
+
groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
|
|
7180
|
+
};
|
|
7181
|
+
const VictoryPortal = initialProps => {
|
|
7182
|
+
const props = {
|
|
7183
|
+
...defaultProps,
|
|
7184
|
+
...initialProps
|
|
7174
7185
|
};
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
this.checkedContext = true;
|
|
7184
|
-
}
|
|
7185
|
-
this.forceUpdate();
|
|
7186
|
-
}
|
|
7187
|
-
componentDidUpdate() {
|
|
7188
|
-
if (!this.renderInPlace) {
|
|
7189
|
-
this.portalKey = this.portalKey || this.context.portalRegister();
|
|
7190
|
-
this.context.portalUpdate(this.portalKey, this.element);
|
|
7191
|
-
}
|
|
7192
|
-
}
|
|
7193
|
-
componentWillUnmount() {
|
|
7194
|
-
if (this.context && this.context.portalDeregister) {
|
|
7195
|
-
this.context.portalDeregister(this.portalKey);
|
|
7196
|
-
}
|
|
7197
|
-
}
|
|
7198
|
-
|
|
7199
|
-
// Overridden in victory-core-native
|
|
7200
|
-
renderPortal(child) {
|
|
7201
|
-
if (this.renderInPlace) {
|
|
7202
|
-
return child;
|
|
7203
|
-
}
|
|
7204
|
-
this.element = child;
|
|
7205
|
-
return null;
|
|
7206
|
-
}
|
|
7207
|
-
render() {
|
|
7208
|
-
const children = Array.isArray(this.props.children) ? this.props.children[0] : this.props.children;
|
|
7186
|
+
const id = react__WEBPACK_IMPORTED_MODULE_1___default().useId();
|
|
7187
|
+
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_2__.usePortalContext)();
|
|
7188
|
+
if (!portalContext) {
|
|
7189
|
+
const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
|
|
7190
|
+
_victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
|
|
7191
|
+
}
|
|
7192
|
+
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
|
|
7193
|
+
const children = Array.isArray(props.children) ? props.children[0] : props.children;
|
|
7209
7194
|
const {
|
|
7210
7195
|
groupComponent
|
|
7211
|
-
} =
|
|
7196
|
+
} = props;
|
|
7212
7197
|
const childProps = children && children.props || {};
|
|
7213
7198
|
const standardProps = childProps.groupComponent ? {
|
|
7214
7199
|
groupComponent,
|
|
7215
7200
|
standalone: false
|
|
7216
7201
|
} : {};
|
|
7217
|
-
const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(
|
|
7202
|
+
const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(props, ["children", "groupComponent"]));
|
|
7218
7203
|
const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
}
|
|
7204
|
+
portalContext.addChild(id, child);
|
|
7205
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7206
|
+
}, [props.children]);
|
|
7207
|
+
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
|
|
7208
|
+
return () => portalContext.removeChild(id);
|
|
7209
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7210
|
+
}, []);
|
|
7211
|
+
return null;
|
|
7212
|
+
};
|
|
7213
|
+
VictoryPortal.role = "portal";
|
|
7222
7214
|
|
|
7223
7215
|
/***/ }),
|
|
7224
7216
|
|
|
@@ -10739,6 +10731,44 @@ function warn(message) {
|
|
|
10739
10731
|
|
|
10740
10732
|
/***/ }),
|
|
10741
10733
|
|
|
10734
|
+
/***/ "../../victory-core/es/victory-util/merge-refs.js":
|
|
10735
|
+
/*!********************************************************!*\
|
|
10736
|
+
!*** ../../victory-core/es/victory-util/merge-refs.js ***!
|
|
10737
|
+
\********************************************************/
|
|
10738
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
10739
|
+
|
|
10740
|
+
"use strict";
|
|
10741
|
+
__webpack_require__.r(__webpack_exports__);
|
|
10742
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10743
|
+
/* harmony export */ "mergeRefs": function() { return /* binding */ mergeRefs; }
|
|
10744
|
+
/* harmony export */ });
|
|
10745
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
10746
|
+
|
|
10747
|
+
/**
|
|
10748
|
+
* Used to merge multiple React refs into a single callback ref.
|
|
10749
|
+
*
|
|
10750
|
+
* @example
|
|
10751
|
+
* ```tsx
|
|
10752
|
+
* <div ref={mergeRefs([ref, forwardedRef])} />
|
|
10753
|
+
* ```
|
|
10754
|
+
*/
|
|
10755
|
+
function mergeRefs(refs) {
|
|
10756
|
+
return value => {
|
|
10757
|
+
refs.forEach(ref => {
|
|
10758
|
+
// If the ref is a function, it's a callback ref and we call it with the value.
|
|
10759
|
+
if (_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction(ref)) {
|
|
10760
|
+
ref(value);
|
|
10761
|
+
} else if (ref !== null && ref !== undefined) {
|
|
10762
|
+
// If the ref is an object (not null and not undefined), it's an object ref.
|
|
10763
|
+
// We assign the value to its 'current' property.
|
|
10764
|
+
ref.current = value;
|
|
10765
|
+
}
|
|
10766
|
+
});
|
|
10767
|
+
};
|
|
10768
|
+
}
|
|
10769
|
+
|
|
10770
|
+
/***/ }),
|
|
10771
|
+
|
|
10742
10772
|
/***/ "../../victory-core/es/victory-util/scale.js":
|
|
10743
10773
|
/*!***************************************************!*\
|
|
10744
10774
|
!*** ../../victory-core/es/victory-util/scale.js ***!
|