victory-pie 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-pie.js +292 -265
- package/dist/victory-pie.min.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/dist/victory-pie.js
CHANGED
|
@@ -5298,23 +5298,18 @@ const VictoryAnimation = _ref => {
|
|
|
5298
5298
|
"use strict";
|
|
5299
5299
|
__webpack_require__.r(__webpack_exports__);
|
|
5300
5300
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5301
|
-
/* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; }
|
|
5301
|
+
/* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
|
|
5302
|
+
/* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
|
|
5302
5303
|
/* harmony export */ });
|
|
5303
|
-
/* harmony import */ var
|
|
5304
|
-
/* harmony import */ var
|
|
5305
|
-
/* harmony import */ var
|
|
5306
|
-
/* harmony import */ var
|
|
5307
|
-
/* harmony import */ var
|
|
5308
|
-
/* harmony import */ var
|
|
5309
|
-
/* harmony import */ var
|
|
5310
|
-
/* harmony import */ var
|
|
5311
|
-
/* harmony import */ var
|
|
5312
|
-
/* 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");
|
|
5313
|
-
/* 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");
|
|
5314
|
-
/* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
5315
|
-
/* 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");
|
|
5316
|
-
|
|
5317
|
-
|
|
5304
|
+
/* 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");
|
|
5305
|
+
/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
|
|
5306
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
|
|
5307
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
|
|
5308
|
+
/* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
|
|
5309
|
+
/* 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");
|
|
5310
|
+
/* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
|
|
5311
|
+
/* 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");
|
|
5312
|
+
/* 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");
|
|
5318
5313
|
|
|
5319
5314
|
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); }
|
|
5320
5315
|
|
|
@@ -5323,175 +5318,149 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
5323
5318
|
|
|
5324
5319
|
|
|
5325
5320
|
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
// @ts-expect-error Ref will be initialized on mount
|
|
5339
|
-
|
|
5340
|
-
// @ts-expect-error Ref will be initialized on mount
|
|
5341
|
-
|
|
5342
|
-
constructor(props) {
|
|
5343
|
-
super(props);
|
|
5344
|
-
this.containerId = !lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default()(props) || props.containerId === undefined ? lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default()("victory-container-") : props.containerId;
|
|
5345
|
-
this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
|
|
5346
|
-
}
|
|
5347
|
-
savePortalRef = portal => {
|
|
5348
|
-
this.portalRef = portal;
|
|
5349
|
-
return portal;
|
|
5321
|
+
const defaultProps = {
|
|
5322
|
+
className: "VictoryContainer",
|
|
5323
|
+
portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__.Portal, null),
|
|
5324
|
+
portalZIndex: 99,
|
|
5325
|
+
responsive: true,
|
|
5326
|
+
role: "img"
|
|
5327
|
+
};
|
|
5328
|
+
function useVictoryContainer(initialProps) {
|
|
5329
|
+
const props = {
|
|
5330
|
+
...defaultProps,
|
|
5331
|
+
...initialProps
|
|
5350
5332
|
};
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5333
|
+
const {
|
|
5334
|
+
title,
|
|
5335
|
+
desc,
|
|
5336
|
+
width,
|
|
5337
|
+
height,
|
|
5338
|
+
responsive
|
|
5339
|
+
} = props;
|
|
5340
|
+
const localContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
|
|
5341
|
+
|
|
5342
|
+
// Generated ID stored in ref because it needs to persist across renders
|
|
5343
|
+
const generatedId = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()("victory-container-"));
|
|
5344
|
+
const containerId = props.containerId ?? generatedId.current;
|
|
5345
|
+
const getIdForElement = elName => `${containerId}-${elName}`;
|
|
5346
|
+
const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
|
|
5347
|
+
const dimensions = responsive ? {
|
|
5348
|
+
width: "100%",
|
|
5349
|
+
height: "100%"
|
|
5350
|
+
} : {
|
|
5351
|
+
width,
|
|
5352
|
+
height
|
|
5360
5353
|
};
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
const
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
} : {
|
|
5417
|
-
width,
|
|
5418
|
-
height
|
|
5354
|
+
const viewBox = responsive ? `0 0 ${width} ${height}` : undefined;
|
|
5355
|
+
const preserveAspectRatio = responsive ? props.preserveAspectRatio : undefined;
|
|
5356
|
+
const ariaLabelledBy = [title && getIdForElement("title"), props["aria-labelledby"]].filter(Boolean).join(" ") || undefined;
|
|
5357
|
+
const ariaDescribedBy = [desc && getIdForElement("desc"), props["aria-describedby"]].filter(Boolean).join(" ") || undefined;
|
|
5358
|
+
const titleId = getIdForElement("title");
|
|
5359
|
+
const descId = getIdForElement("desc");
|
|
5360
|
+
return {
|
|
5361
|
+
...props,
|
|
5362
|
+
titleId,
|
|
5363
|
+
descId,
|
|
5364
|
+
dimensions,
|
|
5365
|
+
viewBox,
|
|
5366
|
+
preserveAspectRatio,
|
|
5367
|
+
ariaLabelledBy,
|
|
5368
|
+
ariaDescribedBy,
|
|
5369
|
+
userProps,
|
|
5370
|
+
localContainerRef
|
|
5371
|
+
};
|
|
5372
|
+
}
|
|
5373
|
+
const VictoryContainer = initialProps => {
|
|
5374
|
+
const {
|
|
5375
|
+
role,
|
|
5376
|
+
title,
|
|
5377
|
+
desc,
|
|
5378
|
+
children,
|
|
5379
|
+
className,
|
|
5380
|
+
portalZIndex,
|
|
5381
|
+
portalComponent,
|
|
5382
|
+
width,
|
|
5383
|
+
height,
|
|
5384
|
+
style,
|
|
5385
|
+
tabIndex,
|
|
5386
|
+
responsive,
|
|
5387
|
+
events,
|
|
5388
|
+
ouiaId,
|
|
5389
|
+
ouiaSafe,
|
|
5390
|
+
ouiaType,
|
|
5391
|
+
dimensions,
|
|
5392
|
+
ariaDescribedBy,
|
|
5393
|
+
ariaLabelledBy,
|
|
5394
|
+
viewBox,
|
|
5395
|
+
preserveAspectRatio,
|
|
5396
|
+
userProps,
|
|
5397
|
+
titleId,
|
|
5398
|
+
descId,
|
|
5399
|
+
containerRef,
|
|
5400
|
+
localContainerRef
|
|
5401
|
+
} = useVictoryContainer(initialProps);
|
|
5402
|
+
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
|
|
5403
|
+
if (!events?.onWheel) return;
|
|
5404
|
+
const handleWheel = e => e.preventDefault();
|
|
5405
|
+
const container = localContainerRef?.current;
|
|
5406
|
+
container?.addEventListener("wheel", handleWheel);
|
|
5407
|
+
return () => {
|
|
5408
|
+
container?.removeEventListener("wheel", handleWheel);
|
|
5419
5409
|
};
|
|
5420
|
-
|
|
5410
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5411
|
+
}, []);
|
|
5412
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
|
|
5413
|
+
className: className,
|
|
5414
|
+
style: {
|
|
5415
|
+
...style,
|
|
5416
|
+
width: responsive ? style?.width : dimensions.width,
|
|
5417
|
+
height: responsive ? style?.height : dimensions.height,
|
|
5421
5418
|
pointerEvents: "none",
|
|
5422
5419
|
touchAction: "none",
|
|
5423
5420
|
position: "relative"
|
|
5424
|
-
},
|
|
5425
|
-
|
|
5421
|
+
},
|
|
5422
|
+
"data-ouia-component-id": ouiaId,
|
|
5423
|
+
"data-ouia-component-type": ouiaType,
|
|
5424
|
+
"data-ouia-safe": ouiaSafe,
|
|
5425
|
+
ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_4__.mergeRefs)([localContainerRef, containerRef])
|
|
5426
|
+
}, /*#__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({
|
|
5427
|
+
width: width,
|
|
5428
|
+
height: height,
|
|
5429
|
+
tabIndex: tabIndex,
|
|
5430
|
+
role: role,
|
|
5431
|
+
"aria-labelledby": ariaLabelledBy,
|
|
5432
|
+
"aria-describedby": ariaDescribedBy,
|
|
5433
|
+
viewBox: viewBox,
|
|
5434
|
+
preserveAspectRatio: preserveAspectRatio,
|
|
5435
|
+
style: {
|
|
5436
|
+
...dimensions,
|
|
5437
|
+
pointerEvents: "all"
|
|
5438
|
+
}
|
|
5439
|
+
}, userProps, events), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("title", {
|
|
5440
|
+
id: titleId
|
|
5441
|
+
}, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("desc", {
|
|
5442
|
+
id: descId
|
|
5443
|
+
}, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
|
|
5444
|
+
style: {
|
|
5445
|
+
...dimensions,
|
|
5426
5446
|
zIndex: portalZIndex,
|
|
5427
5447
|
position: "absolute",
|
|
5428
5448
|
top: 0,
|
|
5429
5449
|
left: 0
|
|
5430
|
-
}
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5450
|
+
}
|
|
5451
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__.PortalOutlet, {
|
|
5452
|
+
as: portalComponent,
|
|
5453
|
+
width: width,
|
|
5454
|
+
height: height,
|
|
5455
|
+
viewBox: viewBox,
|
|
5456
|
+
preserveAspectRatio: preserveAspectRatio,
|
|
5457
|
+
style: {
|
|
5458
|
+
...dimensions,
|
|
5435
5459
|
overflow: "visible"
|
|
5436
|
-
}
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
viewBox: svgProps.viewBox,
|
|
5441
|
-
preserveAspectRatio: svgProps.preserveAspectRatio,
|
|
5442
|
-
style: portalSvgStyle
|
|
5443
|
-
};
|
|
5444
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_7__.PortalContext.Provider, {
|
|
5445
|
-
value: {
|
|
5446
|
-
portalUpdate: this.portalUpdate,
|
|
5447
|
-
portalRegister: this.portalRegister,
|
|
5448
|
-
portalDeregister: this.portalDeregister
|
|
5449
|
-
}
|
|
5450
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", _extends({
|
|
5451
|
-
style: lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, style, divStyle),
|
|
5452
|
-
className: className,
|
|
5453
|
-
ref: this.saveContainerRef
|
|
5454
|
-
}, this.getOUIAProps(props)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("svg", _extends({}, svgProps, {
|
|
5455
|
-
style: svgStyle
|
|
5456
|
-
}), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("title", {
|
|
5457
|
-
id: this.getIdForElement("title")
|
|
5458
|
-
}, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("desc", {
|
|
5459
|
-
id: this.getIdForElement("desc")
|
|
5460
|
-
}, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", {
|
|
5461
|
-
style: portalDivStyle
|
|
5462
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().cloneElement(portalComponent, {
|
|
5463
|
-
...portalProps,
|
|
5464
|
-
ref: this.savePortalRef
|
|
5465
|
-
}))));
|
|
5466
|
-
}
|
|
5467
|
-
render() {
|
|
5468
|
-
const {
|
|
5469
|
-
width,
|
|
5470
|
-
height,
|
|
5471
|
-
responsive,
|
|
5472
|
-
events,
|
|
5473
|
-
title,
|
|
5474
|
-
desc,
|
|
5475
|
-
tabIndex,
|
|
5476
|
-
preserveAspectRatio,
|
|
5477
|
-
role
|
|
5478
|
-
} = this.props;
|
|
5479
|
-
const style = responsive ? this.props.style : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.omit(this.props.style, ["height", "width"]);
|
|
5480
|
-
const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__.getSafeUserProps(this.props);
|
|
5481
|
-
const svgProps = Object.assign({
|
|
5482
|
-
width,
|
|
5483
|
-
height,
|
|
5484
|
-
tabIndex,
|
|
5485
|
-
role,
|
|
5486
|
-
"aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
|
|
5487
|
-
"aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
|
|
5488
|
-
viewBox: responsive ? `0 0 ${width} ${height}` : undefined,
|
|
5489
|
-
preserveAspectRatio: responsive ? preserveAspectRatio : undefined,
|
|
5490
|
-
...userProps
|
|
5491
|
-
}, events);
|
|
5492
|
-
return this.renderContainer(this.props, svgProps, style);
|
|
5493
|
-
}
|
|
5494
|
-
}
|
|
5460
|
+
}
|
|
5461
|
+
}))));
|
|
5462
|
+
};
|
|
5463
|
+
VictoryContainer.role = "container";
|
|
5495
5464
|
|
|
5496
5465
|
/***/ }),
|
|
5497
5466
|
|
|
@@ -6004,17 +5973,78 @@ VictoryLabel.defaultStyles = defaultStyles;
|
|
|
6004
5973
|
"use strict";
|
|
6005
5974
|
__webpack_require__.r(__webpack_exports__);
|
|
6006
5975
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6007
|
-
/* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; }
|
|
5976
|
+
/* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; },
|
|
5977
|
+
/* harmony export */ "PortalProvider": function() { return /* binding */ PortalProvider; },
|
|
5978
|
+
/* harmony export */ "usePortalContext": function() { return /* binding */ usePortalContext; }
|
|
6008
5979
|
/* harmony export */ });
|
|
6009
5980
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
6010
5981
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
6011
5982
|
|
|
6012
|
-
|
|
6013
|
-
* The React context object consumers may use to access the context of the
|
|
6014
|
-
* portal.
|
|
6015
|
-
*/
|
|
6016
|
-
const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({});
|
|
5983
|
+
const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined);
|
|
6017
5984
|
PortalContext.displayName = "PortalContext";
|
|
5985
|
+
const usePortalContext = () => {
|
|
5986
|
+
const context = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(PortalContext);
|
|
5987
|
+
return context;
|
|
5988
|
+
};
|
|
5989
|
+
const PortalProvider = _ref => {
|
|
5990
|
+
let {
|
|
5991
|
+
children
|
|
5992
|
+
} = _ref;
|
|
5993
|
+
const [portalChildren, setPortalChildren] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(new Map());
|
|
5994
|
+
const addChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((id, element) => {
|
|
5995
|
+
setPortalChildren(prevChildren => {
|
|
5996
|
+
const nextChildren = new Map(prevChildren);
|
|
5997
|
+
nextChildren.set(id, element);
|
|
5998
|
+
return nextChildren;
|
|
5999
|
+
});
|
|
6000
|
+
}, [setPortalChildren]);
|
|
6001
|
+
const removeChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(id => {
|
|
6002
|
+
setPortalChildren(prevChildren => {
|
|
6003
|
+
const nextChildren = new Map(prevChildren);
|
|
6004
|
+
nextChildren.delete(id);
|
|
6005
|
+
return nextChildren;
|
|
6006
|
+
});
|
|
6007
|
+
}, [setPortalChildren]);
|
|
6008
|
+
const contextValue = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => ({
|
|
6009
|
+
addChild,
|
|
6010
|
+
removeChild,
|
|
6011
|
+
children: portalChildren
|
|
6012
|
+
}), [addChild, removeChild, portalChildren]);
|
|
6013
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PortalContext.Provider, {
|
|
6014
|
+
value: contextValue
|
|
6015
|
+
}, children);
|
|
6016
|
+
};
|
|
6017
|
+
|
|
6018
|
+
/***/ }),
|
|
6019
|
+
|
|
6020
|
+
/***/ "../../victory-core/es/victory-portal/portal-outlet.js":
|
|
6021
|
+
/*!*************************************************************!*\
|
|
6022
|
+
!*** ../../victory-core/es/victory-portal/portal-outlet.js ***!
|
|
6023
|
+
\*************************************************************/
|
|
6024
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
6025
|
+
|
|
6026
|
+
"use strict";
|
|
6027
|
+
__webpack_require__.r(__webpack_exports__);
|
|
6028
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6029
|
+
/* harmony export */ "PortalOutlet": function() { return /* binding */ PortalOutlet; }
|
|
6030
|
+
/* harmony export */ });
|
|
6031
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
6032
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
6033
|
+
/* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
|
|
6034
|
+
|
|
6035
|
+
|
|
6036
|
+
const PortalOutlet = _ref => {
|
|
6037
|
+
let {
|
|
6038
|
+
as: portalComponent,
|
|
6039
|
+
...props
|
|
6040
|
+
} = _ref;
|
|
6041
|
+
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_1__.usePortalContext)();
|
|
6042
|
+
if (!portalContext) {
|
|
6043
|
+
return null;
|
|
6044
|
+
}
|
|
6045
|
+
const children = Array.from(portalContext.children.values());
|
|
6046
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(portalComponent, props, children);
|
|
6047
|
+
};
|
|
6018
6048
|
|
|
6019
6049
|
/***/ }),
|
|
6020
6050
|
|
|
@@ -6031,39 +6061,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6031
6061
|
/* harmony export */ });
|
|
6032
6062
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
6033
6063
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
6064
|
+
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); }
|
|
6034
6065
|
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
this.index = 1;
|
|
6041
|
-
}
|
|
6042
|
-
portalRegister = () => {
|
|
6043
|
-
return ++this.index;
|
|
6044
|
-
};
|
|
6045
|
-
portalUpdate = (key, element) => {
|
|
6046
|
-
this.map[key] = element;
|
|
6047
|
-
this.forceUpdate();
|
|
6048
|
-
};
|
|
6049
|
-
portalDeregister = key => {
|
|
6050
|
-
delete this.map[key];
|
|
6051
|
-
this.forceUpdate();
|
|
6052
|
-
};
|
|
6053
|
-
getChildren() {
|
|
6054
|
-
return Object.keys(this.map).map(key => {
|
|
6055
|
-
const el = this.map[key];
|
|
6056
|
-
return el ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(el, {
|
|
6057
|
-
key
|
|
6058
|
-
}) : el;
|
|
6059
|
-
});
|
|
6060
|
-
}
|
|
6061
|
-
|
|
6062
|
-
// Overridden in victory-core-native
|
|
6063
|
-
render() {
|
|
6064
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", this.props, this.getChildren());
|
|
6065
|
-
}
|
|
6066
|
-
}
|
|
6066
|
+
const Portal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef((props, ref) => {
|
|
6067
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
|
|
6068
|
+
ref: ref
|
|
6069
|
+
}, props));
|
|
6070
|
+
});
|
|
6067
6071
|
|
|
6068
6072
|
/***/ }),
|
|
6069
6073
|
|
|
@@ -6090,59 +6094,44 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6090
6094
|
|
|
6091
6095
|
|
|
6092
6096
|
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
}
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
render() {
|
|
6132
|
-
const children = Array.isArray(this.props.children) ? this.props.children[0] : this.props.children;
|
|
6133
|
-
const {
|
|
6134
|
-
groupComponent
|
|
6135
|
-
} = this.props;
|
|
6136
|
-
const childProps = children && children.props || {};
|
|
6137
|
-
const standardProps = childProps.groupComponent ? {
|
|
6138
|
-
groupComponent,
|
|
6139
|
-
standalone: false
|
|
6140
|
-
} : {};
|
|
6141
|
-
const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(this.props, ["children", "groupComponent"]));
|
|
6142
|
-
const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
|
|
6143
|
-
return this.renderPortal(child);
|
|
6144
|
-
}
|
|
6145
|
-
}
|
|
6097
|
+
const defaultProps = {
|
|
6098
|
+
groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
|
|
6099
|
+
};
|
|
6100
|
+
const VictoryPortal = initialProps => {
|
|
6101
|
+
const props = {
|
|
6102
|
+
...defaultProps,
|
|
6103
|
+
...initialProps
|
|
6104
|
+
};
|
|
6105
|
+
const id = react__WEBPACK_IMPORTED_MODULE_1___default().useId();
|
|
6106
|
+
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_2__.usePortalContext)();
|
|
6107
|
+
if (!portalContext) {
|
|
6108
|
+
const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
|
|
6109
|
+
_victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
|
|
6110
|
+
}
|
|
6111
|
+
const children = Array.isArray(props.children) ? props.children[0] : props.children;
|
|
6112
|
+
const {
|
|
6113
|
+
groupComponent
|
|
6114
|
+
} = props;
|
|
6115
|
+
const childProps = children && children.props || {};
|
|
6116
|
+
const standardProps = childProps.groupComponent ? {
|
|
6117
|
+
groupComponent,
|
|
6118
|
+
standalone: false
|
|
6119
|
+
} : {};
|
|
6120
|
+
const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(props, ["children", "groupComponent"]), {
|
|
6121
|
+
key: childProps.key ?? id
|
|
6122
|
+
});
|
|
6123
|
+
const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
|
|
6124
|
+
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
|
|
6125
|
+
portalContext?.addChild(id, child);
|
|
6126
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6127
|
+
}, [props.children]);
|
|
6128
|
+
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
|
|
6129
|
+
return () => portalContext?.removeChild(id);
|
|
6130
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6131
|
+
}, []);
|
|
6132
|
+
return portalContext ? null : child;
|
|
6133
|
+
};
|
|
6134
|
+
VictoryPortal.role = "portal";
|
|
6146
6135
|
|
|
6147
6136
|
/***/ }),
|
|
6148
6137
|
|
|
@@ -9216,6 +9205,44 @@ function warn(message) {
|
|
|
9216
9205
|
|
|
9217
9206
|
/***/ }),
|
|
9218
9207
|
|
|
9208
|
+
/***/ "../../victory-core/es/victory-util/merge-refs.js":
|
|
9209
|
+
/*!********************************************************!*\
|
|
9210
|
+
!*** ../../victory-core/es/victory-util/merge-refs.js ***!
|
|
9211
|
+
\********************************************************/
|
|
9212
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
9213
|
+
|
|
9214
|
+
"use strict";
|
|
9215
|
+
__webpack_require__.r(__webpack_exports__);
|
|
9216
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9217
|
+
/* harmony export */ "mergeRefs": function() { return /* binding */ mergeRefs; }
|
|
9218
|
+
/* harmony export */ });
|
|
9219
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
9220
|
+
|
|
9221
|
+
/**
|
|
9222
|
+
* Used to merge multiple React refs into a single callback ref.
|
|
9223
|
+
*
|
|
9224
|
+
* @example
|
|
9225
|
+
* ```tsx
|
|
9226
|
+
* <div ref={mergeRefs([ref, forwardedRef])} />
|
|
9227
|
+
* ```
|
|
9228
|
+
*/
|
|
9229
|
+
function mergeRefs(refs) {
|
|
9230
|
+
return value => {
|
|
9231
|
+
refs.forEach(ref => {
|
|
9232
|
+
// If the ref is a function, it's a callback ref and we call it with the value.
|
|
9233
|
+
if (_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction(ref)) {
|
|
9234
|
+
ref(value);
|
|
9235
|
+
} else if (ref !== null && ref !== undefined) {
|
|
9236
|
+
// If the ref is an object (not null and not undefined), it's an object ref.
|
|
9237
|
+
// We assign the value to its 'current' property.
|
|
9238
|
+
ref.current = value;
|
|
9239
|
+
}
|
|
9240
|
+
});
|
|
9241
|
+
};
|
|
9242
|
+
}
|
|
9243
|
+
|
|
9244
|
+
/***/ }),
|
|
9245
|
+
|
|
9219
9246
|
/***/ "../../victory-core/es/victory-util/scale.js":
|
|
9220
9247
|
/*!***************************************************!*\
|
|
9221
9248
|
!*** ../../victory-core/es/victory-util/scale.js ***!
|