victory-scatter 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-scatter.js +289 -262
- package/dist/victory-scatter.min.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/victory-scatter.js
CHANGED
|
@@ -5094,23 +5094,18 @@ const VictoryAnimation = _ref => {
|
|
|
5094
5094
|
"use strict";
|
|
5095
5095
|
__webpack_require__.r(__webpack_exports__);
|
|
5096
5096
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5097
|
-
/* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; }
|
|
5097
|
+
/* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
|
|
5098
|
+
/* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
|
|
5098
5099
|
/* harmony export */ });
|
|
5099
|
-
/* harmony import */ var
|
|
5100
|
-
/* harmony import */ var
|
|
5101
|
-
/* harmony import */ var
|
|
5102
|
-
/* harmony import */ var
|
|
5103
|
-
/* harmony import */ var
|
|
5104
|
-
/* harmony import */ var
|
|
5105
|
-
/* harmony import */ var
|
|
5106
|
-
/* harmony import */ var
|
|
5107
|
-
/* harmony import */ var
|
|
5108
|
-
/* 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");
|
|
5109
|
-
/* 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");
|
|
5110
|
-
/* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
5111
|
-
/* 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");
|
|
5112
|
-
|
|
5113
|
-
|
|
5100
|
+
/* 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");
|
|
5101
|
+
/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
|
|
5102
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
|
|
5103
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
|
|
5104
|
+
/* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
|
|
5105
|
+
/* 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");
|
|
5106
|
+
/* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
|
|
5107
|
+
/* 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");
|
|
5108
|
+
/* 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");
|
|
5114
5109
|
|
|
5115
5110
|
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); }
|
|
5116
5111
|
|
|
@@ -5119,175 +5114,149 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
5119
5114
|
|
|
5120
5115
|
|
|
5121
5116
|
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5117
|
+
const defaultProps = {
|
|
5118
|
+
className: "VictoryContainer",
|
|
5119
|
+
portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__.Portal, null),
|
|
5120
|
+
portalZIndex: 99,
|
|
5121
|
+
responsive: true,
|
|
5122
|
+
role: "img"
|
|
5123
|
+
};
|
|
5124
|
+
function useVictoryContainer(initialProps) {
|
|
5125
|
+
const props = {
|
|
5126
|
+
...defaultProps,
|
|
5127
|
+
...initialProps
|
|
5131
5128
|
};
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5129
|
+
const {
|
|
5130
|
+
title,
|
|
5131
|
+
desc,
|
|
5132
|
+
width,
|
|
5133
|
+
height,
|
|
5134
|
+
responsive
|
|
5135
|
+
} = props;
|
|
5136
|
+
const localContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
|
|
5137
|
+
|
|
5138
|
+
// Generated ID stored in ref because it needs to persist across renders
|
|
5139
|
+
const generatedId = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()("victory-container-"));
|
|
5140
|
+
const containerId = props.containerId ?? generatedId.current;
|
|
5141
|
+
const getIdForElement = elName => `${containerId}-${elName}`;
|
|
5142
|
+
const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
|
|
5143
|
+
const dimensions = responsive ? {
|
|
5144
|
+
width: "100%",
|
|
5145
|
+
height: "100%"
|
|
5146
|
+
} : {
|
|
5147
|
+
width,
|
|
5148
|
+
height
|
|
5146
5149
|
};
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5150
|
+
const viewBox = responsive ? `0 0 ${width} ${height}` : undefined;
|
|
5151
|
+
const preserveAspectRatio = responsive ? props.preserveAspectRatio : undefined;
|
|
5152
|
+
const ariaLabelledBy = [title && getIdForElement("title"), props["aria-labelledby"]].filter(Boolean).join(" ") || undefined;
|
|
5153
|
+
const ariaDescribedBy = [desc && getIdForElement("desc"), props["aria-describedby"]].filter(Boolean).join(" ") || undefined;
|
|
5154
|
+
const titleId = getIdForElement("title");
|
|
5155
|
+
const descId = getIdForElement("desc");
|
|
5156
|
+
return {
|
|
5157
|
+
...props,
|
|
5158
|
+
titleId,
|
|
5159
|
+
descId,
|
|
5160
|
+
dimensions,
|
|
5161
|
+
viewBox,
|
|
5162
|
+
preserveAspectRatio,
|
|
5163
|
+
ariaLabelledBy,
|
|
5164
|
+
ariaDescribedBy,
|
|
5165
|
+
userProps,
|
|
5166
|
+
localContainerRef
|
|
5156
5167
|
};
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
})
|
|
5195
|
-
};
|
|
5196
|
-
}
|
|
5197
|
-
renderContainer(props, svgProps, style) {
|
|
5198
|
-
const {
|
|
5199
|
-
title,
|
|
5200
|
-
desc,
|
|
5201
|
-
portalComponent,
|
|
5202
|
-
className,
|
|
5203
|
-
width,
|
|
5204
|
-
height,
|
|
5205
|
-
portalZIndex,
|
|
5206
|
-
responsive
|
|
5207
|
-
} = props;
|
|
5208
|
-
const children = this.getChildren(props);
|
|
5209
|
-
const dimensions = responsive ? {
|
|
5210
|
-
width: "100%",
|
|
5211
|
-
height: "100%"
|
|
5212
|
-
} : {
|
|
5213
|
-
width,
|
|
5214
|
-
height
|
|
5168
|
+
}
|
|
5169
|
+
const VictoryContainer = initialProps => {
|
|
5170
|
+
const {
|
|
5171
|
+
role,
|
|
5172
|
+
title,
|
|
5173
|
+
desc,
|
|
5174
|
+
children,
|
|
5175
|
+
className,
|
|
5176
|
+
portalZIndex,
|
|
5177
|
+
portalComponent,
|
|
5178
|
+
width,
|
|
5179
|
+
height,
|
|
5180
|
+
style,
|
|
5181
|
+
tabIndex,
|
|
5182
|
+
responsive,
|
|
5183
|
+
events,
|
|
5184
|
+
ouiaId,
|
|
5185
|
+
ouiaSafe,
|
|
5186
|
+
ouiaType,
|
|
5187
|
+
dimensions,
|
|
5188
|
+
ariaDescribedBy,
|
|
5189
|
+
ariaLabelledBy,
|
|
5190
|
+
viewBox,
|
|
5191
|
+
preserveAspectRatio,
|
|
5192
|
+
userProps,
|
|
5193
|
+
titleId,
|
|
5194
|
+
descId,
|
|
5195
|
+
containerRef,
|
|
5196
|
+
localContainerRef
|
|
5197
|
+
} = useVictoryContainer(initialProps);
|
|
5198
|
+
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
|
|
5199
|
+
if (!events?.onWheel) return;
|
|
5200
|
+
const handleWheel = e => e.preventDefault();
|
|
5201
|
+
const container = localContainerRef?.current;
|
|
5202
|
+
container?.addEventListener("wheel", handleWheel);
|
|
5203
|
+
return () => {
|
|
5204
|
+
container?.removeEventListener("wheel", handleWheel);
|
|
5215
5205
|
};
|
|
5216
|
-
|
|
5206
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5207
|
+
}, []);
|
|
5208
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
|
|
5209
|
+
className: className,
|
|
5210
|
+
style: {
|
|
5211
|
+
...style,
|
|
5212
|
+
width: responsive ? style?.width : dimensions.width,
|
|
5213
|
+
height: responsive ? style?.height : dimensions.height,
|
|
5217
5214
|
pointerEvents: "none",
|
|
5218
5215
|
touchAction: "none",
|
|
5219
5216
|
position: "relative"
|
|
5220
|
-
},
|
|
5221
|
-
|
|
5217
|
+
},
|
|
5218
|
+
"data-ouia-component-id": ouiaId,
|
|
5219
|
+
"data-ouia-component-type": ouiaType,
|
|
5220
|
+
"data-ouia-safe": ouiaSafe,
|
|
5221
|
+
ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_4__.mergeRefs)([localContainerRef, containerRef])
|
|
5222
|
+
}, /*#__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({
|
|
5223
|
+
width: width,
|
|
5224
|
+
height: height,
|
|
5225
|
+
tabIndex: tabIndex,
|
|
5226
|
+
role: role,
|
|
5227
|
+
"aria-labelledby": ariaLabelledBy,
|
|
5228
|
+
"aria-describedby": ariaDescribedBy,
|
|
5229
|
+
viewBox: viewBox,
|
|
5230
|
+
preserveAspectRatio: preserveAspectRatio,
|
|
5231
|
+
style: {
|
|
5232
|
+
...dimensions,
|
|
5233
|
+
pointerEvents: "all"
|
|
5234
|
+
}
|
|
5235
|
+
}, userProps, events), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("title", {
|
|
5236
|
+
id: titleId
|
|
5237
|
+
}, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("desc", {
|
|
5238
|
+
id: descId
|
|
5239
|
+
}, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
|
|
5240
|
+
style: {
|
|
5241
|
+
...dimensions,
|
|
5222
5242
|
zIndex: portalZIndex,
|
|
5223
5243
|
position: "absolute",
|
|
5224
5244
|
top: 0,
|
|
5225
5245
|
left: 0
|
|
5226
|
-
}
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5246
|
+
}
|
|
5247
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__.PortalOutlet, {
|
|
5248
|
+
as: portalComponent,
|
|
5249
|
+
width: width,
|
|
5250
|
+
height: height,
|
|
5251
|
+
viewBox: viewBox,
|
|
5252
|
+
preserveAspectRatio: preserveAspectRatio,
|
|
5253
|
+
style: {
|
|
5254
|
+
...dimensions,
|
|
5231
5255
|
overflow: "visible"
|
|
5232
|
-
}
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
viewBox: svgProps.viewBox,
|
|
5237
|
-
preserveAspectRatio: svgProps.preserveAspectRatio,
|
|
5238
|
-
style: portalSvgStyle
|
|
5239
|
-
};
|
|
5240
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_7__.PortalContext.Provider, {
|
|
5241
|
-
value: {
|
|
5242
|
-
portalUpdate: this.portalUpdate,
|
|
5243
|
-
portalRegister: this.portalRegister,
|
|
5244
|
-
portalDeregister: this.portalDeregister
|
|
5245
|
-
}
|
|
5246
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", _extends({
|
|
5247
|
-
style: lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, style, divStyle),
|
|
5248
|
-
className: className,
|
|
5249
|
-
ref: this.saveContainerRef
|
|
5250
|
-
}, this.getOUIAProps(props)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("svg", _extends({}, svgProps, {
|
|
5251
|
-
style: svgStyle
|
|
5252
|
-
}), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("title", {
|
|
5253
|
-
id: this.getIdForElement("title")
|
|
5254
|
-
}, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("desc", {
|
|
5255
|
-
id: this.getIdForElement("desc")
|
|
5256
|
-
}, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", {
|
|
5257
|
-
style: portalDivStyle
|
|
5258
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().cloneElement(portalComponent, {
|
|
5259
|
-
...portalProps,
|
|
5260
|
-
ref: this.savePortalRef
|
|
5261
|
-
}))));
|
|
5262
|
-
}
|
|
5263
|
-
render() {
|
|
5264
|
-
const {
|
|
5265
|
-
width,
|
|
5266
|
-
height,
|
|
5267
|
-
responsive,
|
|
5268
|
-
events,
|
|
5269
|
-
title,
|
|
5270
|
-
desc,
|
|
5271
|
-
tabIndex,
|
|
5272
|
-
preserveAspectRatio,
|
|
5273
|
-
role
|
|
5274
|
-
} = this.props;
|
|
5275
|
-
const style = responsive ? this.props.style : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.omit(this.props.style, ["height", "width"]);
|
|
5276
|
-
const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__.getSafeUserProps(this.props);
|
|
5277
|
-
const svgProps = Object.assign({
|
|
5278
|
-
width,
|
|
5279
|
-
height,
|
|
5280
|
-
tabIndex,
|
|
5281
|
-
role,
|
|
5282
|
-
"aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
|
|
5283
|
-
"aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
|
|
5284
|
-
viewBox: responsive ? `0 0 ${width} ${height}` : undefined,
|
|
5285
|
-
preserveAspectRatio: responsive ? preserveAspectRatio : undefined,
|
|
5286
|
-
...userProps
|
|
5287
|
-
}, events);
|
|
5288
|
-
return this.renderContainer(this.props, svgProps, style);
|
|
5289
|
-
}
|
|
5290
|
-
}
|
|
5256
|
+
}
|
|
5257
|
+
}))));
|
|
5258
|
+
};
|
|
5259
|
+
VictoryContainer.role = "container";
|
|
5291
5260
|
|
|
5292
5261
|
/***/ }),
|
|
5293
5262
|
|
|
@@ -5800,17 +5769,78 @@ VictoryLabel.defaultStyles = defaultStyles;
|
|
|
5800
5769
|
"use strict";
|
|
5801
5770
|
__webpack_require__.r(__webpack_exports__);
|
|
5802
5771
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5803
|
-
/* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; }
|
|
5772
|
+
/* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; },
|
|
5773
|
+
/* harmony export */ "PortalProvider": function() { return /* binding */ PortalProvider; },
|
|
5774
|
+
/* harmony export */ "usePortalContext": function() { return /* binding */ usePortalContext; }
|
|
5804
5775
|
/* harmony export */ });
|
|
5805
5776
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
5806
5777
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
5807
5778
|
|
|
5808
|
-
|
|
5809
|
-
* The React context object consumers may use to access the context of the
|
|
5810
|
-
* portal.
|
|
5811
|
-
*/
|
|
5812
|
-
const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({});
|
|
5779
|
+
const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined);
|
|
5813
5780
|
PortalContext.displayName = "PortalContext";
|
|
5781
|
+
const usePortalContext = () => {
|
|
5782
|
+
const context = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(PortalContext);
|
|
5783
|
+
return context;
|
|
5784
|
+
};
|
|
5785
|
+
const PortalProvider = _ref => {
|
|
5786
|
+
let {
|
|
5787
|
+
children
|
|
5788
|
+
} = _ref;
|
|
5789
|
+
const [portalChildren, setPortalChildren] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(new Map());
|
|
5790
|
+
const addChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((id, element) => {
|
|
5791
|
+
setPortalChildren(prevChildren => {
|
|
5792
|
+
const nextChildren = new Map(prevChildren);
|
|
5793
|
+
nextChildren.set(id, element);
|
|
5794
|
+
return nextChildren;
|
|
5795
|
+
});
|
|
5796
|
+
}, [setPortalChildren]);
|
|
5797
|
+
const removeChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(id => {
|
|
5798
|
+
setPortalChildren(prevChildren => {
|
|
5799
|
+
const nextChildren = new Map(prevChildren);
|
|
5800
|
+
nextChildren.delete(id);
|
|
5801
|
+
return nextChildren;
|
|
5802
|
+
});
|
|
5803
|
+
}, [setPortalChildren]);
|
|
5804
|
+
const contextValue = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => ({
|
|
5805
|
+
addChild,
|
|
5806
|
+
removeChild,
|
|
5807
|
+
children: portalChildren
|
|
5808
|
+
}), [addChild, removeChild, portalChildren]);
|
|
5809
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PortalContext.Provider, {
|
|
5810
|
+
value: contextValue
|
|
5811
|
+
}, children);
|
|
5812
|
+
};
|
|
5813
|
+
|
|
5814
|
+
/***/ }),
|
|
5815
|
+
|
|
5816
|
+
/***/ "../../victory-core/es/victory-portal/portal-outlet.js":
|
|
5817
|
+
/*!*************************************************************!*\
|
|
5818
|
+
!*** ../../victory-core/es/victory-portal/portal-outlet.js ***!
|
|
5819
|
+
\*************************************************************/
|
|
5820
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
5821
|
+
|
|
5822
|
+
"use strict";
|
|
5823
|
+
__webpack_require__.r(__webpack_exports__);
|
|
5824
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5825
|
+
/* harmony export */ "PortalOutlet": function() { return /* binding */ PortalOutlet; }
|
|
5826
|
+
/* harmony export */ });
|
|
5827
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
5828
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
5829
|
+
/* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
|
|
5830
|
+
|
|
5831
|
+
|
|
5832
|
+
const PortalOutlet = _ref => {
|
|
5833
|
+
let {
|
|
5834
|
+
as: portalComponent,
|
|
5835
|
+
...props
|
|
5836
|
+
} = _ref;
|
|
5837
|
+
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_1__.usePortalContext)();
|
|
5838
|
+
if (!portalContext) {
|
|
5839
|
+
return null;
|
|
5840
|
+
}
|
|
5841
|
+
const children = Array.from(portalContext.children.values());
|
|
5842
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(portalComponent, props, children);
|
|
5843
|
+
};
|
|
5814
5844
|
|
|
5815
5845
|
/***/ }),
|
|
5816
5846
|
|
|
@@ -5827,39 +5857,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
5827
5857
|
/* harmony export */ });
|
|
5828
5858
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
5829
5859
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
5860
|
+
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); }
|
|
5830
5861
|
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
this.index = 1;
|
|
5837
|
-
}
|
|
5838
|
-
portalRegister = () => {
|
|
5839
|
-
return ++this.index;
|
|
5840
|
-
};
|
|
5841
|
-
portalUpdate = (key, element) => {
|
|
5842
|
-
this.map[key] = element;
|
|
5843
|
-
this.forceUpdate();
|
|
5844
|
-
};
|
|
5845
|
-
portalDeregister = key => {
|
|
5846
|
-
delete this.map[key];
|
|
5847
|
-
this.forceUpdate();
|
|
5848
|
-
};
|
|
5849
|
-
getChildren() {
|
|
5850
|
-
return Object.keys(this.map).map(key => {
|
|
5851
|
-
const el = this.map[key];
|
|
5852
|
-
return el ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(el, {
|
|
5853
|
-
key
|
|
5854
|
-
}) : el;
|
|
5855
|
-
});
|
|
5856
|
-
}
|
|
5857
|
-
|
|
5858
|
-
// Overridden in victory-core-native
|
|
5859
|
-
render() {
|
|
5860
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", this.props, this.getChildren());
|
|
5861
|
-
}
|
|
5862
|
-
}
|
|
5862
|
+
const Portal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef((props, ref) => {
|
|
5863
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
|
|
5864
|
+
ref: ref
|
|
5865
|
+
}, props));
|
|
5866
|
+
});
|
|
5863
5867
|
|
|
5864
5868
|
/***/ }),
|
|
5865
5869
|
|
|
@@ -5886,59 +5890,44 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
5886
5890
|
|
|
5887
5891
|
|
|
5888
5892
|
|
|
5889
|
-
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
|
|
5893
|
+
const defaultProps = {
|
|
5894
|
+
groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
|
|
5895
|
+
};
|
|
5896
|
+
const VictoryPortal = initialProps => {
|
|
5897
|
+
const props = {
|
|
5898
|
+
...defaultProps,
|
|
5899
|
+
...initialProps
|
|
5894
5900
|
};
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
_victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
|
|
5901
|
-
this.renderInPlace = true;
|
|
5902
|
-
}
|
|
5903
|
-
this.checkedContext = true;
|
|
5904
|
-
}
|
|
5905
|
-
this.forceUpdate();
|
|
5906
|
-
}
|
|
5907
|
-
componentDidUpdate() {
|
|
5908
|
-
if (!this.renderInPlace) {
|
|
5909
|
-
this.portalKey = this.portalKey || this.context.portalRegister();
|
|
5910
|
-
this.context.portalUpdate(this.portalKey, this.element);
|
|
5911
|
-
}
|
|
5912
|
-
}
|
|
5913
|
-
componentWillUnmount() {
|
|
5914
|
-
if (this.context && this.context.portalDeregister) {
|
|
5915
|
-
this.context.portalDeregister(this.portalKey);
|
|
5916
|
-
}
|
|
5917
|
-
}
|
|
5918
|
-
|
|
5919
|
-
// Overridden in victory-core-native
|
|
5920
|
-
renderPortal(child) {
|
|
5921
|
-
if (this.renderInPlace) {
|
|
5922
|
-
return child;
|
|
5923
|
-
}
|
|
5924
|
-
this.element = child;
|
|
5925
|
-
return null;
|
|
5926
|
-
}
|
|
5927
|
-
render() {
|
|
5928
|
-
const children = Array.isArray(this.props.children) ? this.props.children[0] : this.props.children;
|
|
5929
|
-
const {
|
|
5930
|
-
groupComponent
|
|
5931
|
-
} = this.props;
|
|
5932
|
-
const childProps = children && children.props || {};
|
|
5933
|
-
const standardProps = childProps.groupComponent ? {
|
|
5934
|
-
groupComponent,
|
|
5935
|
-
standalone: false
|
|
5936
|
-
} : {};
|
|
5937
|
-
const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(this.props, ["children", "groupComponent"]));
|
|
5938
|
-
const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
|
|
5939
|
-
return this.renderPortal(child);
|
|
5901
|
+
const id = react__WEBPACK_IMPORTED_MODULE_1___default().useId();
|
|
5902
|
+
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_2__.usePortalContext)();
|
|
5903
|
+
if (!portalContext) {
|
|
5904
|
+
const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
|
|
5905
|
+
_victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
|
|
5940
5906
|
}
|
|
5941
|
-
|
|
5907
|
+
const children = Array.isArray(props.children) ? props.children[0] : props.children;
|
|
5908
|
+
const {
|
|
5909
|
+
groupComponent
|
|
5910
|
+
} = props;
|
|
5911
|
+
const childProps = children && children.props || {};
|
|
5912
|
+
const standardProps = childProps.groupComponent ? {
|
|
5913
|
+
groupComponent,
|
|
5914
|
+
standalone: false
|
|
5915
|
+
} : {};
|
|
5916
|
+
const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(props, ["children", "groupComponent"]), {
|
|
5917
|
+
key: childProps.key ?? id
|
|
5918
|
+
});
|
|
5919
|
+
const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
|
|
5920
|
+
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
|
|
5921
|
+
portalContext?.addChild(id, child);
|
|
5922
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5923
|
+
}, [props.children]);
|
|
5924
|
+
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
|
|
5925
|
+
return () => portalContext?.removeChild(id);
|
|
5926
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5927
|
+
}, []);
|
|
5928
|
+
return portalContext ? null : child;
|
|
5929
|
+
};
|
|
5930
|
+
VictoryPortal.role = "portal";
|
|
5942
5931
|
|
|
5943
5932
|
/***/ }),
|
|
5944
5933
|
|
|
@@ -9489,6 +9478,44 @@ function warn(message) {
|
|
|
9489
9478
|
|
|
9490
9479
|
/***/ }),
|
|
9491
9480
|
|
|
9481
|
+
/***/ "../../victory-core/es/victory-util/merge-refs.js":
|
|
9482
|
+
/*!********************************************************!*\
|
|
9483
|
+
!*** ../../victory-core/es/victory-util/merge-refs.js ***!
|
|
9484
|
+
\********************************************************/
|
|
9485
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
9486
|
+
|
|
9487
|
+
"use strict";
|
|
9488
|
+
__webpack_require__.r(__webpack_exports__);
|
|
9489
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9490
|
+
/* harmony export */ "mergeRefs": function() { return /* binding */ mergeRefs; }
|
|
9491
|
+
/* harmony export */ });
|
|
9492
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
9493
|
+
|
|
9494
|
+
/**
|
|
9495
|
+
* Used to merge multiple React refs into a single callback ref.
|
|
9496
|
+
*
|
|
9497
|
+
* @example
|
|
9498
|
+
* ```tsx
|
|
9499
|
+
* <div ref={mergeRefs([ref, forwardedRef])} />
|
|
9500
|
+
* ```
|
|
9501
|
+
*/
|
|
9502
|
+
function mergeRefs(refs) {
|
|
9503
|
+
return value => {
|
|
9504
|
+
refs.forEach(ref => {
|
|
9505
|
+
// If the ref is a function, it's a callback ref and we call it with the value.
|
|
9506
|
+
if (_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction(ref)) {
|
|
9507
|
+
ref(value);
|
|
9508
|
+
} else if (ref !== null && ref !== undefined) {
|
|
9509
|
+
// If the ref is an object (not null and not undefined), it's an object ref.
|
|
9510
|
+
// We assign the value to its 'current' property.
|
|
9511
|
+
ref.current = value;
|
|
9512
|
+
}
|
|
9513
|
+
});
|
|
9514
|
+
};
|
|
9515
|
+
}
|
|
9516
|
+
|
|
9517
|
+
/***/ }),
|
|
9518
|
+
|
|
9492
9519
|
/***/ "../../victory-core/es/victory-util/point-path-helpers.js":
|
|
9493
9520
|
/*!****************************************************************!*\
|
|
9494
9521
|
!*** ../../victory-core/es/victory-util/point-path-helpers.js ***!
|