victory-area 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 +8 -0
- package/dist/victory-area.js +287 -257
- package/dist/victory-area.min.js +1 -1
- package/es/area.d.ts +12 -12
- package/es/helper-methods.d.ts +2 -2
- package/es/index.d.ts +2 -2
- package/es/victory-area.d.ts +90 -90
- package/lib/area.d.ts +12 -12
- package/lib/helper-methods.d.ts +2 -2
- package/lib/index.d.ts +2 -2
- package/lib/victory-area.d.ts +90 -90
- package/package.json +4 -7
package/CHANGELOG.md
CHANGED
package/dist/victory-area.js
CHANGED
|
@@ -5436,23 +5436,18 @@ class VictoryClipContainer extends (react__WEBPACK_IMPORTED_MODULE_3___default()
|
|
|
5436
5436
|
"use strict";
|
|
5437
5437
|
__webpack_require__.r(__webpack_exports__);
|
|
5438
5438
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5439
|
-
/* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; }
|
|
5439
|
+
/* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
|
|
5440
|
+
/* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
|
|
5440
5441
|
/* harmony export */ });
|
|
5441
|
-
/* harmony import */ var
|
|
5442
|
-
/* harmony import */ var
|
|
5443
|
-
/* harmony import */ var
|
|
5444
|
-
/* harmony import */ var
|
|
5445
|
-
/* harmony import */ var
|
|
5446
|
-
/* harmony import */ var
|
|
5447
|
-
/* harmony import */ var
|
|
5448
|
-
/* harmony import */ var
|
|
5449
|
-
/* harmony import */ var
|
|
5450
|
-
/* 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");
|
|
5451
|
-
/* 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");
|
|
5452
|
-
/* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
5453
|
-
/* 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");
|
|
5454
|
-
|
|
5455
|
-
|
|
5442
|
+
/* 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");
|
|
5443
|
+
/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
|
|
5444
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
|
|
5445
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
|
|
5446
|
+
/* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
|
|
5447
|
+
/* 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");
|
|
5448
|
+
/* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
|
|
5449
|
+
/* 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");
|
|
5450
|
+
/* 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");
|
|
5456
5451
|
|
|
5457
5452
|
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); }
|
|
5458
5453
|
|
|
@@ -5461,175 +5456,149 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
5461
5456
|
|
|
5462
5457
|
|
|
5463
5458
|
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5459
|
+
const defaultProps = {
|
|
5460
|
+
className: "VictoryContainer",
|
|
5461
|
+
portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__.Portal, null),
|
|
5462
|
+
portalZIndex: 99,
|
|
5463
|
+
responsive: true,
|
|
5464
|
+
role: "img"
|
|
5465
|
+
};
|
|
5466
|
+
function useVictoryContainer(initialProps) {
|
|
5467
|
+
const props = {
|
|
5468
|
+
...defaultProps,
|
|
5469
|
+
...initialProps
|
|
5473
5470
|
};
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
this.props.containerRef(container);
|
|
5495
|
-
}
|
|
5496
|
-
this.containerRef = container;
|
|
5497
|
-
return container;
|
|
5471
|
+
const {
|
|
5472
|
+
title,
|
|
5473
|
+
desc,
|
|
5474
|
+
width,
|
|
5475
|
+
height,
|
|
5476
|
+
responsive
|
|
5477
|
+
} = props;
|
|
5478
|
+
const localContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
|
|
5479
|
+
|
|
5480
|
+
// Generated ID stored in ref because it needs to persist across renders
|
|
5481
|
+
const generatedId = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()("victory-container-"));
|
|
5482
|
+
const containerId = props.containerId ?? generatedId.current;
|
|
5483
|
+
const getIdForElement = elName => `${containerId}-${elName}`;
|
|
5484
|
+
const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
|
|
5485
|
+
const dimensions = responsive ? {
|
|
5486
|
+
width: "100%",
|
|
5487
|
+
height: "100%"
|
|
5488
|
+
} : {
|
|
5489
|
+
width,
|
|
5490
|
+
height
|
|
5498
5491
|
};
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
const
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
} : {
|
|
5555
|
-
width,
|
|
5556
|
-
height
|
|
5492
|
+
const viewBox = responsive ? `0 0 ${width} ${height}` : undefined;
|
|
5493
|
+
const preserveAspectRatio = responsive ? props.preserveAspectRatio : undefined;
|
|
5494
|
+
const ariaLabelledBy = [title && getIdForElement("title"), props["aria-labelledby"]].filter(Boolean).join(" ") || undefined;
|
|
5495
|
+
const ariaDescribedBy = [desc && getIdForElement("desc"), props["aria-describedby"]].filter(Boolean).join(" ") || undefined;
|
|
5496
|
+
const titleId = getIdForElement("title");
|
|
5497
|
+
const descId = getIdForElement("desc");
|
|
5498
|
+
return {
|
|
5499
|
+
...props,
|
|
5500
|
+
titleId,
|
|
5501
|
+
descId,
|
|
5502
|
+
dimensions,
|
|
5503
|
+
viewBox,
|
|
5504
|
+
preserveAspectRatio,
|
|
5505
|
+
ariaLabelledBy,
|
|
5506
|
+
ariaDescribedBy,
|
|
5507
|
+
userProps,
|
|
5508
|
+
localContainerRef
|
|
5509
|
+
};
|
|
5510
|
+
}
|
|
5511
|
+
const VictoryContainer = initialProps => {
|
|
5512
|
+
const {
|
|
5513
|
+
role,
|
|
5514
|
+
title,
|
|
5515
|
+
desc,
|
|
5516
|
+
children,
|
|
5517
|
+
className,
|
|
5518
|
+
portalZIndex,
|
|
5519
|
+
portalComponent,
|
|
5520
|
+
width,
|
|
5521
|
+
height,
|
|
5522
|
+
style,
|
|
5523
|
+
tabIndex,
|
|
5524
|
+
responsive,
|
|
5525
|
+
events,
|
|
5526
|
+
ouiaId,
|
|
5527
|
+
ouiaSafe,
|
|
5528
|
+
ouiaType,
|
|
5529
|
+
dimensions,
|
|
5530
|
+
ariaDescribedBy,
|
|
5531
|
+
ariaLabelledBy,
|
|
5532
|
+
viewBox,
|
|
5533
|
+
preserveAspectRatio,
|
|
5534
|
+
userProps,
|
|
5535
|
+
titleId,
|
|
5536
|
+
descId,
|
|
5537
|
+
containerRef,
|
|
5538
|
+
localContainerRef
|
|
5539
|
+
} = useVictoryContainer(initialProps);
|
|
5540
|
+
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
|
|
5541
|
+
if (!events?.onWheel) return;
|
|
5542
|
+
const handleWheel = e => e.preventDefault();
|
|
5543
|
+
const container = localContainerRef?.current;
|
|
5544
|
+
container?.addEventListener("wheel", handleWheel);
|
|
5545
|
+
return () => {
|
|
5546
|
+
container?.removeEventListener("wheel", handleWheel);
|
|
5557
5547
|
};
|
|
5558
|
-
|
|
5548
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5549
|
+
}, []);
|
|
5550
|
+
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", {
|
|
5551
|
+
className: className,
|
|
5552
|
+
style: {
|
|
5553
|
+
...style,
|
|
5554
|
+
width: responsive ? style?.width : dimensions.width,
|
|
5555
|
+
height: responsive ? style?.height : dimensions.height,
|
|
5559
5556
|
pointerEvents: "none",
|
|
5560
5557
|
touchAction: "none",
|
|
5561
5558
|
position: "relative"
|
|
5562
|
-
},
|
|
5563
|
-
|
|
5559
|
+
},
|
|
5560
|
+
"data-ouia-component-id": ouiaId,
|
|
5561
|
+
"data-ouia-component-type": ouiaType,
|
|
5562
|
+
"data-ouia-safe": ouiaSafe,
|
|
5563
|
+
ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_5__.mergeRefs)([localContainerRef, containerRef])
|
|
5564
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("svg", _extends({
|
|
5565
|
+
width: width,
|
|
5566
|
+
height: height,
|
|
5567
|
+
tabIndex: tabIndex,
|
|
5568
|
+
role: role,
|
|
5569
|
+
"aria-labelledby": ariaLabelledBy,
|
|
5570
|
+
"aria-describedby": ariaDescribedBy,
|
|
5571
|
+
viewBox: viewBox,
|
|
5572
|
+
preserveAspectRatio: preserveAspectRatio,
|
|
5573
|
+
style: {
|
|
5574
|
+
...dimensions,
|
|
5575
|
+
pointerEvents: "all"
|
|
5576
|
+
}
|
|
5577
|
+
}, userProps, events), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("title", {
|
|
5578
|
+
id: titleId
|
|
5579
|
+
}, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("desc", {
|
|
5580
|
+
id: descId
|
|
5581
|
+
}, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
|
|
5582
|
+
style: {
|
|
5583
|
+
...dimensions,
|
|
5564
5584
|
zIndex: portalZIndex,
|
|
5565
5585
|
position: "absolute",
|
|
5566
5586
|
top: 0,
|
|
5567
5587
|
left: 0
|
|
5568
|
-
}
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5588
|
+
}
|
|
5589
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__.PortalOutlet, {
|
|
5590
|
+
as: portalComponent,
|
|
5591
|
+
width: width,
|
|
5592
|
+
height: height,
|
|
5593
|
+
viewBox: viewBox,
|
|
5594
|
+
preserveAspectRatio: preserveAspectRatio,
|
|
5595
|
+
style: {
|
|
5596
|
+
...dimensions,
|
|
5573
5597
|
overflow: "visible"
|
|
5574
|
-
}
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
viewBox: svgProps.viewBox,
|
|
5579
|
-
preserveAspectRatio: svgProps.preserveAspectRatio,
|
|
5580
|
-
style: portalSvgStyle
|
|
5581
|
-
};
|
|
5582
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_7__.PortalContext.Provider, {
|
|
5583
|
-
value: {
|
|
5584
|
-
portalUpdate: this.portalUpdate,
|
|
5585
|
-
portalRegister: this.portalRegister,
|
|
5586
|
-
portalDeregister: this.portalDeregister
|
|
5587
|
-
}
|
|
5588
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", _extends({
|
|
5589
|
-
style: lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, style, divStyle),
|
|
5590
|
-
className: className,
|
|
5591
|
-
ref: this.saveContainerRef
|
|
5592
|
-
}, this.getOUIAProps(props)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("svg", _extends({}, svgProps, {
|
|
5593
|
-
style: svgStyle
|
|
5594
|
-
}), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("title", {
|
|
5595
|
-
id: this.getIdForElement("title")
|
|
5596
|
-
}, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("desc", {
|
|
5597
|
-
id: this.getIdForElement("desc")
|
|
5598
|
-
}, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", {
|
|
5599
|
-
style: portalDivStyle
|
|
5600
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().cloneElement(portalComponent, {
|
|
5601
|
-
...portalProps,
|
|
5602
|
-
ref: this.savePortalRef
|
|
5603
|
-
}))));
|
|
5604
|
-
}
|
|
5605
|
-
render() {
|
|
5606
|
-
const {
|
|
5607
|
-
width,
|
|
5608
|
-
height,
|
|
5609
|
-
responsive,
|
|
5610
|
-
events,
|
|
5611
|
-
title,
|
|
5612
|
-
desc,
|
|
5613
|
-
tabIndex,
|
|
5614
|
-
preserveAspectRatio,
|
|
5615
|
-
role
|
|
5616
|
-
} = this.props;
|
|
5617
|
-
const style = responsive ? this.props.style : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.omit(this.props.style, ["height", "width"]);
|
|
5618
|
-
const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__.getSafeUserProps(this.props);
|
|
5619
|
-
const svgProps = Object.assign({
|
|
5620
|
-
width,
|
|
5621
|
-
height,
|
|
5622
|
-
tabIndex,
|
|
5623
|
-
role,
|
|
5624
|
-
"aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
|
|
5625
|
-
"aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
|
|
5626
|
-
viewBox: responsive ? `0 0 ${width} ${height}` : undefined,
|
|
5627
|
-
preserveAspectRatio: responsive ? preserveAspectRatio : undefined,
|
|
5628
|
-
...userProps
|
|
5629
|
-
}, events);
|
|
5630
|
-
return this.renderContainer(this.props, svgProps, style);
|
|
5631
|
-
}
|
|
5632
|
-
}
|
|
5598
|
+
}
|
|
5599
|
+
}))));
|
|
5600
|
+
};
|
|
5601
|
+
VictoryContainer.role = "container";
|
|
5633
5602
|
|
|
5634
5603
|
/***/ }),
|
|
5635
5604
|
|
|
@@ -6142,17 +6111,83 @@ VictoryLabel.defaultStyles = defaultStyles;
|
|
|
6142
6111
|
"use strict";
|
|
6143
6112
|
__webpack_require__.r(__webpack_exports__);
|
|
6144
6113
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6145
|
-
/* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; }
|
|
6114
|
+
/* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; },
|
|
6115
|
+
/* harmony export */ "PortalProvider": function() { return /* binding */ PortalProvider; },
|
|
6116
|
+
/* harmony export */ "usePortalContext": function() { return /* binding */ usePortalContext; }
|
|
6146
6117
|
/* harmony export */ });
|
|
6147
6118
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
6148
6119
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
6149
6120
|
|
|
6150
|
-
|
|
6151
|
-
* The React context object consumers may use to access the context of the
|
|
6152
|
-
* portal.
|
|
6153
|
-
*/
|
|
6154
|
-
const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({});
|
|
6121
|
+
const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined);
|
|
6155
6122
|
PortalContext.displayName = "PortalContext";
|
|
6123
|
+
const usePortalContext = () => {
|
|
6124
|
+
const context = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(PortalContext);
|
|
6125
|
+
if (!context) {
|
|
6126
|
+
throw new Error("`usePortalContext` must be used within a `<PortalProvider />`");
|
|
6127
|
+
}
|
|
6128
|
+
return context;
|
|
6129
|
+
};
|
|
6130
|
+
const PortalProvider = _ref => {
|
|
6131
|
+
let {
|
|
6132
|
+
children
|
|
6133
|
+
} = _ref;
|
|
6134
|
+
const [portalChildren, setPortalChildren] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(new Map());
|
|
6135
|
+
const addChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((id, element) => {
|
|
6136
|
+
setPortalChildren(prevChildren => {
|
|
6137
|
+
const nextChildren = new Map(prevChildren);
|
|
6138
|
+
nextChildren.set(id, element);
|
|
6139
|
+
return nextChildren;
|
|
6140
|
+
});
|
|
6141
|
+
}, [setPortalChildren]);
|
|
6142
|
+
const removeChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(id => {
|
|
6143
|
+
setPortalChildren(prevChildren => {
|
|
6144
|
+
const nextChildren = new Map(prevChildren);
|
|
6145
|
+
nextChildren.delete(id);
|
|
6146
|
+
return nextChildren;
|
|
6147
|
+
});
|
|
6148
|
+
}, [setPortalChildren]);
|
|
6149
|
+
const contextValue = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => ({
|
|
6150
|
+
addChild,
|
|
6151
|
+
removeChild,
|
|
6152
|
+
children: portalChildren
|
|
6153
|
+
}), [addChild, removeChild, portalChildren]);
|
|
6154
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PortalContext.Provider, {
|
|
6155
|
+
value: contextValue
|
|
6156
|
+
}, children);
|
|
6157
|
+
};
|
|
6158
|
+
|
|
6159
|
+
/***/ }),
|
|
6160
|
+
|
|
6161
|
+
/***/ "../../victory-core/es/victory-portal/portal-outlet.js":
|
|
6162
|
+
/*!*************************************************************!*\
|
|
6163
|
+
!*** ../../victory-core/es/victory-portal/portal-outlet.js ***!
|
|
6164
|
+
\*************************************************************/
|
|
6165
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
6166
|
+
|
|
6167
|
+
"use strict";
|
|
6168
|
+
__webpack_require__.r(__webpack_exports__);
|
|
6169
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6170
|
+
/* harmony export */ "PortalOutlet": function() { return /* binding */ PortalOutlet; }
|
|
6171
|
+
/* harmony export */ });
|
|
6172
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
6173
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
6174
|
+
/* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
|
|
6175
|
+
|
|
6176
|
+
|
|
6177
|
+
const PortalOutlet = _ref => {
|
|
6178
|
+
let {
|
|
6179
|
+
as: portalComponent,
|
|
6180
|
+
...props
|
|
6181
|
+
} = _ref;
|
|
6182
|
+
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_1__.usePortalContext)();
|
|
6183
|
+
const children = Array.from(portalContext.children.entries()).map(_ref2 => {
|
|
6184
|
+
let [key, node] = _ref2;
|
|
6185
|
+
return !node.key ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(node, {
|
|
6186
|
+
key
|
|
6187
|
+
}) : node;
|
|
6188
|
+
});
|
|
6189
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(portalComponent, props, children);
|
|
6190
|
+
};
|
|
6156
6191
|
|
|
6157
6192
|
/***/ }),
|
|
6158
6193
|
|
|
@@ -6169,39 +6204,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6169
6204
|
/* harmony export */ });
|
|
6170
6205
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
6171
6206
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
6207
|
+
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); }
|
|
6172
6208
|
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
this.index = 1;
|
|
6179
|
-
}
|
|
6180
|
-
portalRegister = () => {
|
|
6181
|
-
return ++this.index;
|
|
6182
|
-
};
|
|
6183
|
-
portalUpdate = (key, element) => {
|
|
6184
|
-
this.map[key] = element;
|
|
6185
|
-
this.forceUpdate();
|
|
6186
|
-
};
|
|
6187
|
-
portalDeregister = key => {
|
|
6188
|
-
delete this.map[key];
|
|
6189
|
-
this.forceUpdate();
|
|
6190
|
-
};
|
|
6191
|
-
getChildren() {
|
|
6192
|
-
return Object.keys(this.map).map(key => {
|
|
6193
|
-
const el = this.map[key];
|
|
6194
|
-
return el ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(el, {
|
|
6195
|
-
key
|
|
6196
|
-
}) : el;
|
|
6197
|
-
});
|
|
6198
|
-
}
|
|
6199
|
-
|
|
6200
|
-
// Overridden in victory-core-native
|
|
6201
|
-
render() {
|
|
6202
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", this.props, this.getChildren());
|
|
6203
|
-
}
|
|
6204
|
-
}
|
|
6209
|
+
const Portal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef((props, ref) => {
|
|
6210
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
|
|
6211
|
+
ref: ref
|
|
6212
|
+
}, props));
|
|
6213
|
+
});
|
|
6205
6214
|
|
|
6206
6215
|
/***/ }),
|
|
6207
6216
|
|
|
@@ -6228,59 +6237,42 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6228
6237
|
|
|
6229
6238
|
|
|
6230
6239
|
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
this.forceUpdate();
|
|
6248
|
-
}
|
|
6249
|
-
componentDidUpdate() {
|
|
6250
|
-
if (!this.renderInPlace) {
|
|
6251
|
-
this.portalKey = this.portalKey || this.context.portalRegister();
|
|
6252
|
-
this.context.portalUpdate(this.portalKey, this.element);
|
|
6253
|
-
}
|
|
6254
|
-
}
|
|
6255
|
-
componentWillUnmount() {
|
|
6256
|
-
if (this.context && this.context.portalDeregister) {
|
|
6257
|
-
this.context.portalDeregister(this.portalKey);
|
|
6258
|
-
}
|
|
6259
|
-
}
|
|
6260
|
-
|
|
6261
|
-
// Overridden in victory-core-native
|
|
6262
|
-
renderPortal(child) {
|
|
6263
|
-
if (this.renderInPlace) {
|
|
6264
|
-
return child;
|
|
6265
|
-
}
|
|
6266
|
-
this.element = child;
|
|
6267
|
-
return null;
|
|
6268
|
-
}
|
|
6269
|
-
render() {
|
|
6270
|
-
const children = Array.isArray(this.props.children) ? this.props.children[0] : this.props.children;
|
|
6240
|
+
const defaultProps = {
|
|
6241
|
+
groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
|
|
6242
|
+
};
|
|
6243
|
+
const VictoryPortal = initialProps => {
|
|
6244
|
+
const props = {
|
|
6245
|
+
...defaultProps,
|
|
6246
|
+
...initialProps
|
|
6247
|
+
};
|
|
6248
|
+
const id = react__WEBPACK_IMPORTED_MODULE_1___default().useId();
|
|
6249
|
+
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_2__.usePortalContext)();
|
|
6250
|
+
if (!portalContext) {
|
|
6251
|
+
const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
|
|
6252
|
+
_victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
|
|
6253
|
+
}
|
|
6254
|
+
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
|
|
6255
|
+
const children = Array.isArray(props.children) ? props.children[0] : props.children;
|
|
6271
6256
|
const {
|
|
6272
6257
|
groupComponent
|
|
6273
|
-
} =
|
|
6258
|
+
} = props;
|
|
6274
6259
|
const childProps = children && children.props || {};
|
|
6275
6260
|
const standardProps = childProps.groupComponent ? {
|
|
6276
6261
|
groupComponent,
|
|
6277
6262
|
standalone: false
|
|
6278
6263
|
} : {};
|
|
6279
|
-
const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(
|
|
6264
|
+
const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(props, ["children", "groupComponent"]));
|
|
6280
6265
|
const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
}
|
|
6266
|
+
portalContext.addChild(id, child);
|
|
6267
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6268
|
+
}, [props.children]);
|
|
6269
|
+
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
|
|
6270
|
+
return () => portalContext.removeChild(id);
|
|
6271
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6272
|
+
}, []);
|
|
6273
|
+
return null;
|
|
6274
|
+
};
|
|
6275
|
+
VictoryPortal.role = "portal";
|
|
6284
6276
|
|
|
6285
6277
|
/***/ }),
|
|
6286
6278
|
|
|
@@ -9867,6 +9859,44 @@ function warn(message) {
|
|
|
9867
9859
|
|
|
9868
9860
|
/***/ }),
|
|
9869
9861
|
|
|
9862
|
+
/***/ "../../victory-core/es/victory-util/merge-refs.js":
|
|
9863
|
+
/*!********************************************************!*\
|
|
9864
|
+
!*** ../../victory-core/es/victory-util/merge-refs.js ***!
|
|
9865
|
+
\********************************************************/
|
|
9866
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
9867
|
+
|
|
9868
|
+
"use strict";
|
|
9869
|
+
__webpack_require__.r(__webpack_exports__);
|
|
9870
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9871
|
+
/* harmony export */ "mergeRefs": function() { return /* binding */ mergeRefs; }
|
|
9872
|
+
/* harmony export */ });
|
|
9873
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
9874
|
+
|
|
9875
|
+
/**
|
|
9876
|
+
* Used to merge multiple React refs into a single callback ref.
|
|
9877
|
+
*
|
|
9878
|
+
* @example
|
|
9879
|
+
* ```tsx
|
|
9880
|
+
* <div ref={mergeRefs([ref, forwardedRef])} />
|
|
9881
|
+
* ```
|
|
9882
|
+
*/
|
|
9883
|
+
function mergeRefs(refs) {
|
|
9884
|
+
return value => {
|
|
9885
|
+
refs.forEach(ref => {
|
|
9886
|
+
// If the ref is a function, it's a callback ref and we call it with the value.
|
|
9887
|
+
if (_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction(ref)) {
|
|
9888
|
+
ref(value);
|
|
9889
|
+
} else if (ref !== null && ref !== undefined) {
|
|
9890
|
+
// If the ref is an object (not null and not undefined), it's an object ref.
|
|
9891
|
+
// We assign the value to its 'current' property.
|
|
9892
|
+
ref.current = value;
|
|
9893
|
+
}
|
|
9894
|
+
});
|
|
9895
|
+
};
|
|
9896
|
+
}
|
|
9897
|
+
|
|
9898
|
+
/***/ }),
|
|
9899
|
+
|
|
9870
9900
|
/***/ "../../victory-core/es/victory-util/scale.js":
|
|
9871
9901
|
/*!***************************************************!*\
|
|
9872
9902
|
!*** ../../victory-core/es/victory-util/scale.js ***!
|