victory-errorbar 37.0.1 → 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 +13 -0
- package/dist/victory-errorbar.js +305 -278
- package/dist/victory-errorbar.min.js +1 -1
- package/es/error-bar.d.ts +31 -31
- package/es/error-bar.js +2 -4
- package/es/helper-methods.d.ts +3 -3
- package/es/index.d.ts +2 -2
- package/es/victory-errorbar.d.ts +85 -85
- package/lib/error-bar.d.ts +31 -31
- package/lib/error-bar.js +2 -4
- package/lib/helper-methods.d.ts +3 -3
- package/lib/index.d.ts +2 -2
- package/lib/victory-errorbar.d.ts +85 -85
- package/package.json +3 -6
- package/src/error-bar.tsx +3 -1
package/dist/victory-errorbar.js
CHANGED
|
@@ -22,17 +22,20 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
22
22
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
23
23
|
/* harmony export */ "ErrorBar": function() { return /* binding */ ErrorBar; }
|
|
24
24
|
/* harmony export */ });
|
|
25
|
-
/* harmony import */ var
|
|
26
|
-
/* harmony import */ var
|
|
27
|
-
/* harmony import */ var
|
|
28
|
-
/* harmony import */ var
|
|
29
|
-
/* harmony import */ var
|
|
25
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
|
|
26
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_0__);
|
|
27
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
|
|
28
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
|
|
29
|
+
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/helpers.js");
|
|
30
|
+
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-primitives/line.js");
|
|
31
|
+
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/user-props.js");
|
|
32
|
+
|
|
30
33
|
/* eslint-disable max-statements */
|
|
31
34
|
|
|
32
35
|
|
|
33
36
|
const renderBorder = (props, error, type) => {
|
|
34
37
|
const vertical = type === "right" || type === "left";
|
|
35
|
-
return /*#__PURE__*/
|
|
38
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(props.lineComponent, {
|
|
36
39
|
...props.events,
|
|
37
40
|
role: props.role,
|
|
38
41
|
shapeRendering: props.shapeRendering,
|
|
@@ -49,7 +52,7 @@ const renderBorder = (props, error, type) => {
|
|
|
49
52
|
};
|
|
50
53
|
const renderCross = (props, error, type) => {
|
|
51
54
|
const vertical = type === "top" || type === "bottom";
|
|
52
|
-
return /*#__PURE__*/
|
|
55
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(props.lineComponent, {
|
|
53
56
|
...props.events,
|
|
54
57
|
role: props.role,
|
|
55
58
|
shapeRendering: props.shapeRendering,
|
|
@@ -108,12 +111,12 @@ const evaluateProps = props => {
|
|
|
108
111
|
* `style`
|
|
109
112
|
* `tabIndex`
|
|
110
113
|
*/
|
|
111
|
-
const ariaLabel =
|
|
112
|
-
const id =
|
|
113
|
-
const style =
|
|
114
|
+
const ariaLabel = victory_core__WEBPACK_IMPORTED_MODULE_2__.evaluateProp(props.ariaLabel, props);
|
|
115
|
+
const id = victory_core__WEBPACK_IMPORTED_MODULE_2__.evaluateProp(props.id, props);
|
|
116
|
+
const style = victory_core__WEBPACK_IMPORTED_MODULE_2__.evaluateStyle(Object.assign({
|
|
114
117
|
stroke: "black"
|
|
115
118
|
}, props.style), props);
|
|
116
|
-
const tabIndex =
|
|
119
|
+
const tabIndex = victory_core__WEBPACK_IMPORTED_MODULE_2__.evaluateProp(props.tabIndex, props);
|
|
117
120
|
return Object.assign({}, props, {
|
|
118
121
|
ariaLabel,
|
|
119
122
|
id,
|
|
@@ -127,27 +130,24 @@ const evaluateProps = props => {
|
|
|
127
130
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
128
131
|
|
|
129
132
|
const defaultProps = {
|
|
130
|
-
groupComponent: /*#__PURE__*/
|
|
131
|
-
lineComponent: /*#__PURE__*/
|
|
133
|
+
groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null),
|
|
134
|
+
lineComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_3__.Line, null),
|
|
132
135
|
role: "presentation",
|
|
133
136
|
shapeRendering: "auto"
|
|
134
137
|
};
|
|
135
138
|
const ErrorBar = initialProps => {
|
|
136
|
-
const props = evaluateProps({
|
|
137
|
-
...defaultProps,
|
|
138
|
-
...initialProps
|
|
139
|
-
});
|
|
139
|
+
const props = evaluateProps(lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, initialProps, defaultProps));
|
|
140
140
|
const {
|
|
141
141
|
groupComponent
|
|
142
142
|
} = props;
|
|
143
|
-
const userProps =
|
|
143
|
+
const userProps = victory_core__WEBPACK_IMPORTED_MODULE_4__.getSafeUserProps(props);
|
|
144
144
|
const {
|
|
145
145
|
tabIndex,
|
|
146
146
|
ariaLabel
|
|
147
147
|
} = props;
|
|
148
148
|
const error = calculateError(props);
|
|
149
149
|
const children = [error.right ? renderBorder(props, error, "right") : null, error.left ? renderBorder(props, error, "left") : null, error.bottom ? renderBorder(props, error, "bottom") : null, error.top ? renderBorder(props, error, "top") : null, error.right ? renderCross(props, error, "right") : null, error.left ? renderCross(props, error, "left") : null, error.bottom ? renderCross(props, error, "bottom") : null, error.top ? renderCross(props, error, "top") : null].filter(Boolean);
|
|
150
|
-
return /*#__PURE__*/
|
|
150
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(groupComponent, {
|
|
151
151
|
tabIndex,
|
|
152
152
|
"aria-label": ariaLabel,
|
|
153
153
|
...userProps
|
|
@@ -5508,23 +5508,18 @@ const VictoryAnimation = _ref => {
|
|
|
5508
5508
|
"use strict";
|
|
5509
5509
|
__webpack_require__.r(__webpack_exports__);
|
|
5510
5510
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5511
|
-
/* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; }
|
|
5511
|
+
/* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
|
|
5512
|
+
/* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
|
|
5512
5513
|
/* harmony export */ });
|
|
5513
|
-
/* harmony import */ var
|
|
5514
|
-
/* harmony import */ var
|
|
5515
|
-
/* harmony import */ var
|
|
5516
|
-
/* harmony import */ var
|
|
5517
|
-
/* harmony import */ var
|
|
5518
|
-
/* harmony import */ var
|
|
5519
|
-
/* harmony import */ var
|
|
5520
|
-
/* harmony import */ var
|
|
5521
|
-
/* harmony import */ var
|
|
5522
|
-
/* 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");
|
|
5523
|
-
/* 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");
|
|
5524
|
-
/* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
5525
|
-
/* 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");
|
|
5526
|
-
|
|
5527
|
-
|
|
5514
|
+
/* 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");
|
|
5515
|
+
/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
|
|
5516
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
|
|
5517
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
|
|
5518
|
+
/* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
|
|
5519
|
+
/* 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");
|
|
5520
|
+
/* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
|
|
5521
|
+
/* 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");
|
|
5522
|
+
/* 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");
|
|
5528
5523
|
|
|
5529
5524
|
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); }
|
|
5530
5525
|
|
|
@@ -5533,175 +5528,149 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
5533
5528
|
|
|
5534
5529
|
|
|
5535
5530
|
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5531
|
+
const defaultProps = {
|
|
5532
|
+
className: "VictoryContainer",
|
|
5533
|
+
portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__.Portal, null),
|
|
5534
|
+
portalZIndex: 99,
|
|
5535
|
+
responsive: true,
|
|
5536
|
+
role: "img"
|
|
5537
|
+
};
|
|
5538
|
+
function useVictoryContainer(initialProps) {
|
|
5539
|
+
const props = {
|
|
5540
|
+
...defaultProps,
|
|
5541
|
+
...initialProps
|
|
5545
5542
|
};
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5543
|
+
const {
|
|
5544
|
+
title,
|
|
5545
|
+
desc,
|
|
5546
|
+
width,
|
|
5547
|
+
height,
|
|
5548
|
+
responsive
|
|
5549
|
+
} = props;
|
|
5550
|
+
const localContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
|
|
5551
|
+
|
|
5552
|
+
// Generated ID stored in ref because it needs to persist across renders
|
|
5553
|
+
const generatedId = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()("victory-container-"));
|
|
5554
|
+
const containerId = props.containerId ?? generatedId.current;
|
|
5555
|
+
const getIdForElement = elName => `${containerId}-${elName}`;
|
|
5556
|
+
const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
|
|
5557
|
+
const dimensions = responsive ? {
|
|
5558
|
+
width: "100%",
|
|
5559
|
+
height: "100%"
|
|
5560
|
+
} : {
|
|
5561
|
+
width,
|
|
5562
|
+
height
|
|
5560
5563
|
};
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5564
|
+
const viewBox = responsive ? `0 0 ${width} ${height}` : undefined;
|
|
5565
|
+
const preserveAspectRatio = responsive ? props.preserveAspectRatio : undefined;
|
|
5566
|
+
const ariaLabelledBy = [title && getIdForElement("title"), props["aria-labelledby"]].filter(Boolean).join(" ") || undefined;
|
|
5567
|
+
const ariaDescribedBy = [desc && getIdForElement("desc"), props["aria-describedby"]].filter(Boolean).join(" ") || undefined;
|
|
5568
|
+
const titleId = getIdForElement("title");
|
|
5569
|
+
const descId = getIdForElement("desc");
|
|
5570
|
+
return {
|
|
5571
|
+
...props,
|
|
5572
|
+
titleId,
|
|
5573
|
+
descId,
|
|
5574
|
+
dimensions,
|
|
5575
|
+
viewBox,
|
|
5576
|
+
preserveAspectRatio,
|
|
5577
|
+
ariaLabelledBy,
|
|
5578
|
+
ariaDescribedBy,
|
|
5579
|
+
userProps,
|
|
5580
|
+
localContainerRef
|
|
5570
5581
|
};
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
})
|
|
5609
|
-
};
|
|
5610
|
-
}
|
|
5611
|
-
renderContainer(props, svgProps, style) {
|
|
5612
|
-
const {
|
|
5613
|
-
title,
|
|
5614
|
-
desc,
|
|
5615
|
-
portalComponent,
|
|
5616
|
-
className,
|
|
5617
|
-
width,
|
|
5618
|
-
height,
|
|
5619
|
-
portalZIndex,
|
|
5620
|
-
responsive
|
|
5621
|
-
} = props;
|
|
5622
|
-
const children = this.getChildren(props);
|
|
5623
|
-
const dimensions = responsive ? {
|
|
5624
|
-
width: "100%",
|
|
5625
|
-
height: "100%"
|
|
5626
|
-
} : {
|
|
5627
|
-
width,
|
|
5628
|
-
height
|
|
5582
|
+
}
|
|
5583
|
+
const VictoryContainer = initialProps => {
|
|
5584
|
+
const {
|
|
5585
|
+
role,
|
|
5586
|
+
title,
|
|
5587
|
+
desc,
|
|
5588
|
+
children,
|
|
5589
|
+
className,
|
|
5590
|
+
portalZIndex,
|
|
5591
|
+
portalComponent,
|
|
5592
|
+
width,
|
|
5593
|
+
height,
|
|
5594
|
+
style,
|
|
5595
|
+
tabIndex,
|
|
5596
|
+
responsive,
|
|
5597
|
+
events,
|
|
5598
|
+
ouiaId,
|
|
5599
|
+
ouiaSafe,
|
|
5600
|
+
ouiaType,
|
|
5601
|
+
dimensions,
|
|
5602
|
+
ariaDescribedBy,
|
|
5603
|
+
ariaLabelledBy,
|
|
5604
|
+
viewBox,
|
|
5605
|
+
preserveAspectRatio,
|
|
5606
|
+
userProps,
|
|
5607
|
+
titleId,
|
|
5608
|
+
descId,
|
|
5609
|
+
containerRef,
|
|
5610
|
+
localContainerRef
|
|
5611
|
+
} = useVictoryContainer(initialProps);
|
|
5612
|
+
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
|
|
5613
|
+
if (!events?.onWheel) return;
|
|
5614
|
+
const handleWheel = e => e.preventDefault();
|
|
5615
|
+
const container = localContainerRef?.current;
|
|
5616
|
+
container?.addEventListener("wheel", handleWheel);
|
|
5617
|
+
return () => {
|
|
5618
|
+
container?.removeEventListener("wheel", handleWheel);
|
|
5629
5619
|
};
|
|
5630
|
-
|
|
5620
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5621
|
+
}, []);
|
|
5622
|
+
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", {
|
|
5623
|
+
className: className,
|
|
5624
|
+
style: {
|
|
5625
|
+
...style,
|
|
5626
|
+
width: responsive ? style?.width : dimensions.width,
|
|
5627
|
+
height: responsive ? style?.height : dimensions.height,
|
|
5631
5628
|
pointerEvents: "none",
|
|
5632
5629
|
touchAction: "none",
|
|
5633
5630
|
position: "relative"
|
|
5634
|
-
},
|
|
5635
|
-
|
|
5631
|
+
},
|
|
5632
|
+
"data-ouia-component-id": ouiaId,
|
|
5633
|
+
"data-ouia-component-type": ouiaType,
|
|
5634
|
+
"data-ouia-safe": ouiaSafe,
|
|
5635
|
+
ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_5__.mergeRefs)([localContainerRef, containerRef])
|
|
5636
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("svg", _extends({
|
|
5637
|
+
width: width,
|
|
5638
|
+
height: height,
|
|
5639
|
+
tabIndex: tabIndex,
|
|
5640
|
+
role: role,
|
|
5641
|
+
"aria-labelledby": ariaLabelledBy,
|
|
5642
|
+
"aria-describedby": ariaDescribedBy,
|
|
5643
|
+
viewBox: viewBox,
|
|
5644
|
+
preserveAspectRatio: preserveAspectRatio,
|
|
5645
|
+
style: {
|
|
5646
|
+
...dimensions,
|
|
5647
|
+
pointerEvents: "all"
|
|
5648
|
+
}
|
|
5649
|
+
}, userProps, events), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("title", {
|
|
5650
|
+
id: titleId
|
|
5651
|
+
}, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("desc", {
|
|
5652
|
+
id: descId
|
|
5653
|
+
}, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
|
|
5654
|
+
style: {
|
|
5655
|
+
...dimensions,
|
|
5636
5656
|
zIndex: portalZIndex,
|
|
5637
5657
|
position: "absolute",
|
|
5638
5658
|
top: 0,
|
|
5639
5659
|
left: 0
|
|
5640
|
-
}
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5660
|
+
}
|
|
5661
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__.PortalOutlet, {
|
|
5662
|
+
as: portalComponent,
|
|
5663
|
+
width: width,
|
|
5664
|
+
height: height,
|
|
5665
|
+
viewBox: viewBox,
|
|
5666
|
+
preserveAspectRatio: preserveAspectRatio,
|
|
5667
|
+
style: {
|
|
5668
|
+
...dimensions,
|
|
5645
5669
|
overflow: "visible"
|
|
5646
|
-
}
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
viewBox: svgProps.viewBox,
|
|
5651
|
-
preserveAspectRatio: svgProps.preserveAspectRatio,
|
|
5652
|
-
style: portalSvgStyle
|
|
5653
|
-
};
|
|
5654
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_7__.PortalContext.Provider, {
|
|
5655
|
-
value: {
|
|
5656
|
-
portalUpdate: this.portalUpdate,
|
|
5657
|
-
portalRegister: this.portalRegister,
|
|
5658
|
-
portalDeregister: this.portalDeregister
|
|
5659
|
-
}
|
|
5660
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", _extends({
|
|
5661
|
-
style: lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, style, divStyle),
|
|
5662
|
-
className: className,
|
|
5663
|
-
ref: this.saveContainerRef
|
|
5664
|
-
}, this.getOUIAProps(props)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("svg", _extends({}, svgProps, {
|
|
5665
|
-
style: svgStyle
|
|
5666
|
-
}), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("title", {
|
|
5667
|
-
id: this.getIdForElement("title")
|
|
5668
|
-
}, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("desc", {
|
|
5669
|
-
id: this.getIdForElement("desc")
|
|
5670
|
-
}, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", {
|
|
5671
|
-
style: portalDivStyle
|
|
5672
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().cloneElement(portalComponent, {
|
|
5673
|
-
...portalProps,
|
|
5674
|
-
ref: this.savePortalRef
|
|
5675
|
-
}))));
|
|
5676
|
-
}
|
|
5677
|
-
render() {
|
|
5678
|
-
const {
|
|
5679
|
-
width,
|
|
5680
|
-
height,
|
|
5681
|
-
responsive,
|
|
5682
|
-
events,
|
|
5683
|
-
title,
|
|
5684
|
-
desc,
|
|
5685
|
-
tabIndex,
|
|
5686
|
-
preserveAspectRatio,
|
|
5687
|
-
role
|
|
5688
|
-
} = this.props;
|
|
5689
|
-
const style = responsive ? this.props.style : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.omit(this.props.style, ["height", "width"]);
|
|
5690
|
-
const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__.getSafeUserProps(this.props);
|
|
5691
|
-
const svgProps = Object.assign({
|
|
5692
|
-
width,
|
|
5693
|
-
height,
|
|
5694
|
-
tabIndex,
|
|
5695
|
-
role,
|
|
5696
|
-
"aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
|
|
5697
|
-
"aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
|
|
5698
|
-
viewBox: responsive ? `0 0 ${width} ${height}` : undefined,
|
|
5699
|
-
preserveAspectRatio: responsive ? preserveAspectRatio : undefined,
|
|
5700
|
-
...userProps
|
|
5701
|
-
}, events);
|
|
5702
|
-
return this.renderContainer(this.props, svgProps, style);
|
|
5703
|
-
}
|
|
5704
|
-
}
|
|
5670
|
+
}
|
|
5671
|
+
}))));
|
|
5672
|
+
};
|
|
5673
|
+
VictoryContainer.role = "container";
|
|
5705
5674
|
|
|
5706
5675
|
/***/ }),
|
|
5707
5676
|
|
|
@@ -6163,10 +6132,7 @@ const defaultProps = {
|
|
|
6163
6132
|
lineHeight: 1
|
|
6164
6133
|
};
|
|
6165
6134
|
const VictoryLabel = initialProps => {
|
|
6166
|
-
const props = evaluateProps({
|
|
6167
|
-
...defaultProps,
|
|
6168
|
-
...initialProps
|
|
6169
|
-
});
|
|
6135
|
+
const props = evaluateProps(lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, initialProps, defaultProps));
|
|
6170
6136
|
if (props.text === null || props.text === undefined) {
|
|
6171
6137
|
return null;
|
|
6172
6138
|
}
|
|
@@ -6217,17 +6183,83 @@ VictoryLabel.defaultStyles = defaultStyles;
|
|
|
6217
6183
|
"use strict";
|
|
6218
6184
|
__webpack_require__.r(__webpack_exports__);
|
|
6219
6185
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6220
|
-
/* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; }
|
|
6186
|
+
/* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; },
|
|
6187
|
+
/* harmony export */ "PortalProvider": function() { return /* binding */ PortalProvider; },
|
|
6188
|
+
/* harmony export */ "usePortalContext": function() { return /* binding */ usePortalContext; }
|
|
6221
6189
|
/* harmony export */ });
|
|
6222
6190
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
6223
6191
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
6224
6192
|
|
|
6225
|
-
|
|
6226
|
-
* The React context object consumers may use to access the context of the
|
|
6227
|
-
* portal.
|
|
6228
|
-
*/
|
|
6229
|
-
const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({});
|
|
6193
|
+
const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined);
|
|
6230
6194
|
PortalContext.displayName = "PortalContext";
|
|
6195
|
+
const usePortalContext = () => {
|
|
6196
|
+
const context = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(PortalContext);
|
|
6197
|
+
if (!context) {
|
|
6198
|
+
throw new Error("`usePortalContext` must be used within a `<PortalProvider />`");
|
|
6199
|
+
}
|
|
6200
|
+
return context;
|
|
6201
|
+
};
|
|
6202
|
+
const PortalProvider = _ref => {
|
|
6203
|
+
let {
|
|
6204
|
+
children
|
|
6205
|
+
} = _ref;
|
|
6206
|
+
const [portalChildren, setPortalChildren] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(new Map());
|
|
6207
|
+
const addChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((id, element) => {
|
|
6208
|
+
setPortalChildren(prevChildren => {
|
|
6209
|
+
const nextChildren = new Map(prevChildren);
|
|
6210
|
+
nextChildren.set(id, element);
|
|
6211
|
+
return nextChildren;
|
|
6212
|
+
});
|
|
6213
|
+
}, [setPortalChildren]);
|
|
6214
|
+
const removeChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(id => {
|
|
6215
|
+
setPortalChildren(prevChildren => {
|
|
6216
|
+
const nextChildren = new Map(prevChildren);
|
|
6217
|
+
nextChildren.delete(id);
|
|
6218
|
+
return nextChildren;
|
|
6219
|
+
});
|
|
6220
|
+
}, [setPortalChildren]);
|
|
6221
|
+
const contextValue = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => ({
|
|
6222
|
+
addChild,
|
|
6223
|
+
removeChild,
|
|
6224
|
+
children: portalChildren
|
|
6225
|
+
}), [addChild, removeChild, portalChildren]);
|
|
6226
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PortalContext.Provider, {
|
|
6227
|
+
value: contextValue
|
|
6228
|
+
}, children);
|
|
6229
|
+
};
|
|
6230
|
+
|
|
6231
|
+
/***/ }),
|
|
6232
|
+
|
|
6233
|
+
/***/ "../../victory-core/es/victory-portal/portal-outlet.js":
|
|
6234
|
+
/*!*************************************************************!*\
|
|
6235
|
+
!*** ../../victory-core/es/victory-portal/portal-outlet.js ***!
|
|
6236
|
+
\*************************************************************/
|
|
6237
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
6238
|
+
|
|
6239
|
+
"use strict";
|
|
6240
|
+
__webpack_require__.r(__webpack_exports__);
|
|
6241
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6242
|
+
/* harmony export */ "PortalOutlet": function() { return /* binding */ PortalOutlet; }
|
|
6243
|
+
/* harmony export */ });
|
|
6244
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
6245
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
6246
|
+
/* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
|
|
6247
|
+
|
|
6248
|
+
|
|
6249
|
+
const PortalOutlet = _ref => {
|
|
6250
|
+
let {
|
|
6251
|
+
as: portalComponent,
|
|
6252
|
+
...props
|
|
6253
|
+
} = _ref;
|
|
6254
|
+
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_1__.usePortalContext)();
|
|
6255
|
+
const children = Array.from(portalContext.children.entries()).map(_ref2 => {
|
|
6256
|
+
let [key, node] = _ref2;
|
|
6257
|
+
return !node.key ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(node, {
|
|
6258
|
+
key
|
|
6259
|
+
}) : node;
|
|
6260
|
+
});
|
|
6261
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(portalComponent, props, children);
|
|
6262
|
+
};
|
|
6231
6263
|
|
|
6232
6264
|
/***/ }),
|
|
6233
6265
|
|
|
@@ -6244,39 +6276,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6244
6276
|
/* harmony export */ });
|
|
6245
6277
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
6246
6278
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
6279
|
+
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); }
|
|
6247
6280
|
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
this.index = 1;
|
|
6254
|
-
}
|
|
6255
|
-
portalRegister = () => {
|
|
6256
|
-
return ++this.index;
|
|
6257
|
-
};
|
|
6258
|
-
portalUpdate = (key, element) => {
|
|
6259
|
-
this.map[key] = element;
|
|
6260
|
-
this.forceUpdate();
|
|
6261
|
-
};
|
|
6262
|
-
portalDeregister = key => {
|
|
6263
|
-
delete this.map[key];
|
|
6264
|
-
this.forceUpdate();
|
|
6265
|
-
};
|
|
6266
|
-
getChildren() {
|
|
6267
|
-
return Object.keys(this.map).map(key => {
|
|
6268
|
-
const el = this.map[key];
|
|
6269
|
-
return el ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(el, {
|
|
6270
|
-
key
|
|
6271
|
-
}) : el;
|
|
6272
|
-
});
|
|
6273
|
-
}
|
|
6274
|
-
|
|
6275
|
-
// Overridden in victory-core-native
|
|
6276
|
-
render() {
|
|
6277
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", this.props, this.getChildren());
|
|
6278
|
-
}
|
|
6279
|
-
}
|
|
6281
|
+
const Portal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef((props, ref) => {
|
|
6282
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
|
|
6283
|
+
ref: ref
|
|
6284
|
+
}, props));
|
|
6285
|
+
});
|
|
6280
6286
|
|
|
6281
6287
|
/***/ }),
|
|
6282
6288
|
|
|
@@ -6303,59 +6309,42 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6303
6309
|
|
|
6304
6310
|
|
|
6305
6311
|
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6312
|
+
const defaultProps = {
|
|
6313
|
+
groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
|
|
6314
|
+
};
|
|
6315
|
+
const VictoryPortal = initialProps => {
|
|
6316
|
+
const props = {
|
|
6317
|
+
...defaultProps,
|
|
6318
|
+
...initialProps
|
|
6311
6319
|
};
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
this.checkedContext = true;
|
|
6321
|
-
}
|
|
6322
|
-
this.forceUpdate();
|
|
6323
|
-
}
|
|
6324
|
-
componentDidUpdate() {
|
|
6325
|
-
if (!this.renderInPlace) {
|
|
6326
|
-
this.portalKey = this.portalKey || this.context.portalRegister();
|
|
6327
|
-
this.context.portalUpdate(this.portalKey, this.element);
|
|
6328
|
-
}
|
|
6329
|
-
}
|
|
6330
|
-
componentWillUnmount() {
|
|
6331
|
-
if (this.context && this.context.portalDeregister) {
|
|
6332
|
-
this.context.portalDeregister(this.portalKey);
|
|
6333
|
-
}
|
|
6334
|
-
}
|
|
6335
|
-
|
|
6336
|
-
// Overridden in victory-core-native
|
|
6337
|
-
renderPortal(child) {
|
|
6338
|
-
if (this.renderInPlace) {
|
|
6339
|
-
return child;
|
|
6340
|
-
}
|
|
6341
|
-
this.element = child;
|
|
6342
|
-
return null;
|
|
6343
|
-
}
|
|
6344
|
-
render() {
|
|
6345
|
-
const children = Array.isArray(this.props.children) ? this.props.children[0] : this.props.children;
|
|
6320
|
+
const id = react__WEBPACK_IMPORTED_MODULE_1___default().useId();
|
|
6321
|
+
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_2__.usePortalContext)();
|
|
6322
|
+
if (!portalContext) {
|
|
6323
|
+
const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
|
|
6324
|
+
_victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
|
|
6325
|
+
}
|
|
6326
|
+
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
|
|
6327
|
+
const children = Array.isArray(props.children) ? props.children[0] : props.children;
|
|
6346
6328
|
const {
|
|
6347
6329
|
groupComponent
|
|
6348
|
-
} =
|
|
6330
|
+
} = props;
|
|
6349
6331
|
const childProps = children && children.props || {};
|
|
6350
6332
|
const standardProps = childProps.groupComponent ? {
|
|
6351
6333
|
groupComponent,
|
|
6352
6334
|
standalone: false
|
|
6353
6335
|
} : {};
|
|
6354
|
-
const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(
|
|
6336
|
+
const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(props, ["children", "groupComponent"]));
|
|
6355
6337
|
const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
}
|
|
6338
|
+
portalContext.addChild(id, child);
|
|
6339
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6340
|
+
}, [props.children]);
|
|
6341
|
+
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
|
|
6342
|
+
return () => portalContext.removeChild(id);
|
|
6343
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6344
|
+
}, []);
|
|
6345
|
+
return null;
|
|
6346
|
+
};
|
|
6347
|
+
VictoryPortal.role = "portal";
|
|
6359
6348
|
|
|
6360
6349
|
/***/ }),
|
|
6361
6350
|
|
|
@@ -9814,6 +9803,44 @@ function warn(message) {
|
|
|
9814
9803
|
|
|
9815
9804
|
/***/ }),
|
|
9816
9805
|
|
|
9806
|
+
/***/ "../../victory-core/es/victory-util/merge-refs.js":
|
|
9807
|
+
/*!********************************************************!*\
|
|
9808
|
+
!*** ../../victory-core/es/victory-util/merge-refs.js ***!
|
|
9809
|
+
\********************************************************/
|
|
9810
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
9811
|
+
|
|
9812
|
+
"use strict";
|
|
9813
|
+
__webpack_require__.r(__webpack_exports__);
|
|
9814
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9815
|
+
/* harmony export */ "mergeRefs": function() { return /* binding */ mergeRefs; }
|
|
9816
|
+
/* harmony export */ });
|
|
9817
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
9818
|
+
|
|
9819
|
+
/**
|
|
9820
|
+
* Used to merge multiple React refs into a single callback ref.
|
|
9821
|
+
*
|
|
9822
|
+
* @example
|
|
9823
|
+
* ```tsx
|
|
9824
|
+
* <div ref={mergeRefs([ref, forwardedRef])} />
|
|
9825
|
+
* ```
|
|
9826
|
+
*/
|
|
9827
|
+
function mergeRefs(refs) {
|
|
9828
|
+
return value => {
|
|
9829
|
+
refs.forEach(ref => {
|
|
9830
|
+
// If the ref is a function, it's a callback ref and we call it with the value.
|
|
9831
|
+
if (_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction(ref)) {
|
|
9832
|
+
ref(value);
|
|
9833
|
+
} else if (ref !== null && ref !== undefined) {
|
|
9834
|
+
// If the ref is an object (not null and not undefined), it's an object ref.
|
|
9835
|
+
// We assign the value to its 'current' property.
|
|
9836
|
+
ref.current = value;
|
|
9837
|
+
}
|
|
9838
|
+
});
|
|
9839
|
+
};
|
|
9840
|
+
}
|
|
9841
|
+
|
|
9842
|
+
/***/ }),
|
|
9843
|
+
|
|
9817
9844
|
/***/ "../../victory-core/es/victory-util/scale.js":
|
|
9818
9845
|
/*!***************************************************!*\
|
|
9819
9846
|
!*** ../../victory-core/es/victory-util/scale.js ***!
|