victory-group 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-group.js +259 -212
- package/dist/victory-group.min.js +1 -1
- package/es/helper-methods.d.ts +51 -51
- package/es/index.d.ts +1 -1
- package/es/victory-group.d.ts +18 -18
- package/lib/helper-methods.d.ts +51 -51
- package/lib/index.d.ts +1 -1
- package/lib/victory-group.d.ts +18 -18
- package/package.json +4 -7
package/CHANGELOG.md
CHANGED
package/dist/victory-group.js
CHANGED
|
@@ -4998,23 +4998,18 @@ module.exports = function isEqual(a, b) {
|
|
|
4998
4998
|
"use strict";
|
|
4999
4999
|
__webpack_require__.r(__webpack_exports__);
|
|
5000
5000
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5001
|
-
/* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; }
|
|
5001
|
+
/* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
|
|
5002
|
+
/* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
|
|
5002
5003
|
/* harmony export */ });
|
|
5003
|
-
/* harmony import */ var
|
|
5004
|
-
/* harmony import */ var
|
|
5005
|
-
/* harmony import */ var
|
|
5006
|
-
/* harmony import */ var
|
|
5007
|
-
/* harmony import */ var
|
|
5008
|
-
/* harmony import */ var
|
|
5009
|
-
/* harmony import */ var
|
|
5010
|
-
/* harmony import */ var
|
|
5011
|
-
/* harmony import */ var
|
|
5012
|
-
/* 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");
|
|
5013
|
-
/* 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");
|
|
5014
|
-
/* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
5015
|
-
/* 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");
|
|
5016
|
-
|
|
5017
|
-
|
|
5004
|
+
/* 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");
|
|
5005
|
+
/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
|
|
5006
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
|
|
5007
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
|
|
5008
|
+
/* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
|
|
5009
|
+
/* 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");
|
|
5010
|
+
/* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
|
|
5011
|
+
/* 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");
|
|
5012
|
+
/* 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");
|
|
5018
5013
|
|
|
5019
5014
|
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); }
|
|
5020
5015
|
|
|
@@ -5023,175 +5018,149 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
5023
5018
|
|
|
5024
5019
|
|
|
5025
5020
|
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
// @ts-expect-error Ref will be initialized on mount
|
|
5039
|
-
|
|
5040
|
-
// @ts-expect-error Ref will be initialized on mount
|
|
5041
|
-
|
|
5042
|
-
constructor(props) {
|
|
5043
|
-
super(props);
|
|
5044
|
-
this.containerId = !lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default()(props) || props.containerId === undefined ? lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default()("victory-container-") : props.containerId;
|
|
5045
|
-
this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
|
|
5046
|
-
}
|
|
5047
|
-
savePortalRef = portal => {
|
|
5048
|
-
this.portalRef = portal;
|
|
5049
|
-
return portal;
|
|
5021
|
+
const defaultProps = {
|
|
5022
|
+
className: "VictoryContainer",
|
|
5023
|
+
portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__.Portal, null),
|
|
5024
|
+
portalZIndex: 99,
|
|
5025
|
+
responsive: true,
|
|
5026
|
+
role: "img"
|
|
5027
|
+
};
|
|
5028
|
+
function useVictoryContainer(initialProps) {
|
|
5029
|
+
const props = {
|
|
5030
|
+
...defaultProps,
|
|
5031
|
+
...initialProps
|
|
5050
5032
|
};
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5033
|
+
const {
|
|
5034
|
+
title,
|
|
5035
|
+
desc,
|
|
5036
|
+
width,
|
|
5037
|
+
height,
|
|
5038
|
+
responsive
|
|
5039
|
+
} = props;
|
|
5040
|
+
const localContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
|
|
5041
|
+
|
|
5042
|
+
// Generated ID stored in ref because it needs to persist across renders
|
|
5043
|
+
const generatedId = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()("victory-container-"));
|
|
5044
|
+
const containerId = props.containerId ?? generatedId.current;
|
|
5045
|
+
const getIdForElement = elName => `${containerId}-${elName}`;
|
|
5046
|
+
const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
|
|
5047
|
+
const dimensions = responsive ? {
|
|
5048
|
+
width: "100%",
|
|
5049
|
+
height: "100%"
|
|
5050
|
+
} : {
|
|
5051
|
+
width,
|
|
5052
|
+
height
|
|
5060
5053
|
};
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
const
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
} : {
|
|
5117
|
-
width,
|
|
5118
|
-
height
|
|
5054
|
+
const viewBox = responsive ? `0 0 ${width} ${height}` : undefined;
|
|
5055
|
+
const preserveAspectRatio = responsive ? props.preserveAspectRatio : undefined;
|
|
5056
|
+
const ariaLabelledBy = [title && getIdForElement("title"), props["aria-labelledby"]].filter(Boolean).join(" ") || undefined;
|
|
5057
|
+
const ariaDescribedBy = [desc && getIdForElement("desc"), props["aria-describedby"]].filter(Boolean).join(" ") || undefined;
|
|
5058
|
+
const titleId = getIdForElement("title");
|
|
5059
|
+
const descId = getIdForElement("desc");
|
|
5060
|
+
return {
|
|
5061
|
+
...props,
|
|
5062
|
+
titleId,
|
|
5063
|
+
descId,
|
|
5064
|
+
dimensions,
|
|
5065
|
+
viewBox,
|
|
5066
|
+
preserveAspectRatio,
|
|
5067
|
+
ariaLabelledBy,
|
|
5068
|
+
ariaDescribedBy,
|
|
5069
|
+
userProps,
|
|
5070
|
+
localContainerRef
|
|
5071
|
+
};
|
|
5072
|
+
}
|
|
5073
|
+
const VictoryContainer = initialProps => {
|
|
5074
|
+
const {
|
|
5075
|
+
role,
|
|
5076
|
+
title,
|
|
5077
|
+
desc,
|
|
5078
|
+
children,
|
|
5079
|
+
className,
|
|
5080
|
+
portalZIndex,
|
|
5081
|
+
portalComponent,
|
|
5082
|
+
width,
|
|
5083
|
+
height,
|
|
5084
|
+
style,
|
|
5085
|
+
tabIndex,
|
|
5086
|
+
responsive,
|
|
5087
|
+
events,
|
|
5088
|
+
ouiaId,
|
|
5089
|
+
ouiaSafe,
|
|
5090
|
+
ouiaType,
|
|
5091
|
+
dimensions,
|
|
5092
|
+
ariaDescribedBy,
|
|
5093
|
+
ariaLabelledBy,
|
|
5094
|
+
viewBox,
|
|
5095
|
+
preserveAspectRatio,
|
|
5096
|
+
userProps,
|
|
5097
|
+
titleId,
|
|
5098
|
+
descId,
|
|
5099
|
+
containerRef,
|
|
5100
|
+
localContainerRef
|
|
5101
|
+
} = useVictoryContainer(initialProps);
|
|
5102
|
+
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
|
|
5103
|
+
if (!events?.onWheel) return;
|
|
5104
|
+
const handleWheel = e => e.preventDefault();
|
|
5105
|
+
const container = localContainerRef?.current;
|
|
5106
|
+
container?.addEventListener("wheel", handleWheel);
|
|
5107
|
+
return () => {
|
|
5108
|
+
container?.removeEventListener("wheel", handleWheel);
|
|
5119
5109
|
};
|
|
5120
|
-
|
|
5110
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5111
|
+
}, []);
|
|
5112
|
+
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", {
|
|
5113
|
+
className: className,
|
|
5114
|
+
style: {
|
|
5115
|
+
...style,
|
|
5116
|
+
width: responsive ? style?.width : dimensions.width,
|
|
5117
|
+
height: responsive ? style?.height : dimensions.height,
|
|
5121
5118
|
pointerEvents: "none",
|
|
5122
5119
|
touchAction: "none",
|
|
5123
5120
|
position: "relative"
|
|
5124
|
-
},
|
|
5125
|
-
|
|
5121
|
+
},
|
|
5122
|
+
"data-ouia-component-id": ouiaId,
|
|
5123
|
+
"data-ouia-component-type": ouiaType,
|
|
5124
|
+
"data-ouia-safe": ouiaSafe,
|
|
5125
|
+
ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_5__.mergeRefs)([localContainerRef, containerRef])
|
|
5126
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("svg", _extends({
|
|
5127
|
+
width: width,
|
|
5128
|
+
height: height,
|
|
5129
|
+
tabIndex: tabIndex,
|
|
5130
|
+
role: role,
|
|
5131
|
+
"aria-labelledby": ariaLabelledBy,
|
|
5132
|
+
"aria-describedby": ariaDescribedBy,
|
|
5133
|
+
viewBox: viewBox,
|
|
5134
|
+
preserveAspectRatio: preserveAspectRatio,
|
|
5135
|
+
style: {
|
|
5136
|
+
...dimensions,
|
|
5137
|
+
pointerEvents: "all"
|
|
5138
|
+
}
|
|
5139
|
+
}, userProps, events), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("title", {
|
|
5140
|
+
id: titleId
|
|
5141
|
+
}, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("desc", {
|
|
5142
|
+
id: descId
|
|
5143
|
+
}, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
|
|
5144
|
+
style: {
|
|
5145
|
+
...dimensions,
|
|
5126
5146
|
zIndex: portalZIndex,
|
|
5127
5147
|
position: "absolute",
|
|
5128
5148
|
top: 0,
|
|
5129
5149
|
left: 0
|
|
5130
|
-
}
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5150
|
+
}
|
|
5151
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__.PortalOutlet, {
|
|
5152
|
+
as: portalComponent,
|
|
5153
|
+
width: width,
|
|
5154
|
+
height: height,
|
|
5155
|
+
viewBox: viewBox,
|
|
5156
|
+
preserveAspectRatio: preserveAspectRatio,
|
|
5157
|
+
style: {
|
|
5158
|
+
...dimensions,
|
|
5135
5159
|
overflow: "visible"
|
|
5136
|
-
}
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
viewBox: svgProps.viewBox,
|
|
5141
|
-
preserveAspectRatio: svgProps.preserveAspectRatio,
|
|
5142
|
-
style: portalSvgStyle
|
|
5143
|
-
};
|
|
5144
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_7__.PortalContext.Provider, {
|
|
5145
|
-
value: {
|
|
5146
|
-
portalUpdate: this.portalUpdate,
|
|
5147
|
-
portalRegister: this.portalRegister,
|
|
5148
|
-
portalDeregister: this.portalDeregister
|
|
5149
|
-
}
|
|
5150
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", _extends({
|
|
5151
|
-
style: lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, style, divStyle),
|
|
5152
|
-
className: className,
|
|
5153
|
-
ref: this.saveContainerRef
|
|
5154
|
-
}, this.getOUIAProps(props)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("svg", _extends({}, svgProps, {
|
|
5155
|
-
style: svgStyle
|
|
5156
|
-
}), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("title", {
|
|
5157
|
-
id: this.getIdForElement("title")
|
|
5158
|
-
}, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("desc", {
|
|
5159
|
-
id: this.getIdForElement("desc")
|
|
5160
|
-
}, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", {
|
|
5161
|
-
style: portalDivStyle
|
|
5162
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().cloneElement(portalComponent, {
|
|
5163
|
-
...portalProps,
|
|
5164
|
-
ref: this.savePortalRef
|
|
5165
|
-
}))));
|
|
5166
|
-
}
|
|
5167
|
-
render() {
|
|
5168
|
-
const {
|
|
5169
|
-
width,
|
|
5170
|
-
height,
|
|
5171
|
-
responsive,
|
|
5172
|
-
events,
|
|
5173
|
-
title,
|
|
5174
|
-
desc,
|
|
5175
|
-
tabIndex,
|
|
5176
|
-
preserveAspectRatio,
|
|
5177
|
-
role
|
|
5178
|
-
} = this.props;
|
|
5179
|
-
const style = responsive ? this.props.style : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.omit(this.props.style, ["height", "width"]);
|
|
5180
|
-
const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__.getSafeUserProps(this.props);
|
|
5181
|
-
const svgProps = Object.assign({
|
|
5182
|
-
width,
|
|
5183
|
-
height,
|
|
5184
|
-
tabIndex,
|
|
5185
|
-
role,
|
|
5186
|
-
"aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
|
|
5187
|
-
"aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
|
|
5188
|
-
viewBox: responsive ? `0 0 ${width} ${height}` : undefined,
|
|
5189
|
-
preserveAspectRatio: responsive ? preserveAspectRatio : undefined,
|
|
5190
|
-
...userProps
|
|
5191
|
-
}, events);
|
|
5192
|
-
return this.renderContainer(this.props, svgProps, style);
|
|
5193
|
-
}
|
|
5194
|
-
}
|
|
5160
|
+
}
|
|
5161
|
+
}))));
|
|
5162
|
+
};
|
|
5163
|
+
VictoryContainer.role = "container";
|
|
5195
5164
|
|
|
5196
5165
|
/***/ }),
|
|
5197
5166
|
|
|
@@ -5204,17 +5173,83 @@ class VictoryContainer extends (react__WEBPACK_IMPORTED_MODULE_3___default().Com
|
|
|
5204
5173
|
"use strict";
|
|
5205
5174
|
__webpack_require__.r(__webpack_exports__);
|
|
5206
5175
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5207
|
-
/* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; }
|
|
5176
|
+
/* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; },
|
|
5177
|
+
/* harmony export */ "PortalProvider": function() { return /* binding */ PortalProvider; },
|
|
5178
|
+
/* harmony export */ "usePortalContext": function() { return /* binding */ usePortalContext; }
|
|
5208
5179
|
/* harmony export */ });
|
|
5209
5180
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
5210
5181
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
5211
5182
|
|
|
5212
|
-
|
|
5213
|
-
* The React context object consumers may use to access the context of the
|
|
5214
|
-
* portal.
|
|
5215
|
-
*/
|
|
5216
|
-
const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({});
|
|
5183
|
+
const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined);
|
|
5217
5184
|
PortalContext.displayName = "PortalContext";
|
|
5185
|
+
const usePortalContext = () => {
|
|
5186
|
+
const context = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(PortalContext);
|
|
5187
|
+
if (!context) {
|
|
5188
|
+
throw new Error("`usePortalContext` must be used within a `<PortalProvider />`");
|
|
5189
|
+
}
|
|
5190
|
+
return context;
|
|
5191
|
+
};
|
|
5192
|
+
const PortalProvider = _ref => {
|
|
5193
|
+
let {
|
|
5194
|
+
children
|
|
5195
|
+
} = _ref;
|
|
5196
|
+
const [portalChildren, setPortalChildren] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(new Map());
|
|
5197
|
+
const addChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((id, element) => {
|
|
5198
|
+
setPortalChildren(prevChildren => {
|
|
5199
|
+
const nextChildren = new Map(prevChildren);
|
|
5200
|
+
nextChildren.set(id, element);
|
|
5201
|
+
return nextChildren;
|
|
5202
|
+
});
|
|
5203
|
+
}, [setPortalChildren]);
|
|
5204
|
+
const removeChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(id => {
|
|
5205
|
+
setPortalChildren(prevChildren => {
|
|
5206
|
+
const nextChildren = new Map(prevChildren);
|
|
5207
|
+
nextChildren.delete(id);
|
|
5208
|
+
return nextChildren;
|
|
5209
|
+
});
|
|
5210
|
+
}, [setPortalChildren]);
|
|
5211
|
+
const contextValue = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => ({
|
|
5212
|
+
addChild,
|
|
5213
|
+
removeChild,
|
|
5214
|
+
children: portalChildren
|
|
5215
|
+
}), [addChild, removeChild, portalChildren]);
|
|
5216
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PortalContext.Provider, {
|
|
5217
|
+
value: contextValue
|
|
5218
|
+
}, children);
|
|
5219
|
+
};
|
|
5220
|
+
|
|
5221
|
+
/***/ }),
|
|
5222
|
+
|
|
5223
|
+
/***/ "../../victory-core/es/victory-portal/portal-outlet.js":
|
|
5224
|
+
/*!*************************************************************!*\
|
|
5225
|
+
!*** ../../victory-core/es/victory-portal/portal-outlet.js ***!
|
|
5226
|
+
\*************************************************************/
|
|
5227
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
5228
|
+
|
|
5229
|
+
"use strict";
|
|
5230
|
+
__webpack_require__.r(__webpack_exports__);
|
|
5231
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5232
|
+
/* harmony export */ "PortalOutlet": function() { return /* binding */ PortalOutlet; }
|
|
5233
|
+
/* harmony export */ });
|
|
5234
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
5235
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
5236
|
+
/* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
|
|
5237
|
+
|
|
5238
|
+
|
|
5239
|
+
const PortalOutlet = _ref => {
|
|
5240
|
+
let {
|
|
5241
|
+
as: portalComponent,
|
|
5242
|
+
...props
|
|
5243
|
+
} = _ref;
|
|
5244
|
+
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_1__.usePortalContext)();
|
|
5245
|
+
const children = Array.from(portalContext.children.entries()).map(_ref2 => {
|
|
5246
|
+
let [key, node] = _ref2;
|
|
5247
|
+
return !node.key ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(node, {
|
|
5248
|
+
key
|
|
5249
|
+
}) : node;
|
|
5250
|
+
});
|
|
5251
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(portalComponent, props, children);
|
|
5252
|
+
};
|
|
5218
5253
|
|
|
5219
5254
|
/***/ }),
|
|
5220
5255
|
|
|
@@ -5231,39 +5266,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
5231
5266
|
/* harmony export */ });
|
|
5232
5267
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
5233
5268
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
5269
|
+
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); }
|
|
5234
5270
|
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
this.index = 1;
|
|
5241
|
-
}
|
|
5242
|
-
portalRegister = () => {
|
|
5243
|
-
return ++this.index;
|
|
5244
|
-
};
|
|
5245
|
-
portalUpdate = (key, element) => {
|
|
5246
|
-
this.map[key] = element;
|
|
5247
|
-
this.forceUpdate();
|
|
5248
|
-
};
|
|
5249
|
-
portalDeregister = key => {
|
|
5250
|
-
delete this.map[key];
|
|
5251
|
-
this.forceUpdate();
|
|
5252
|
-
};
|
|
5253
|
-
getChildren() {
|
|
5254
|
-
return Object.keys(this.map).map(key => {
|
|
5255
|
-
const el = this.map[key];
|
|
5256
|
-
return el ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(el, {
|
|
5257
|
-
key
|
|
5258
|
-
}) : el;
|
|
5259
|
-
});
|
|
5260
|
-
}
|
|
5261
|
-
|
|
5262
|
-
// Overridden in victory-core-native
|
|
5263
|
-
render() {
|
|
5264
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", this.props, this.getChildren());
|
|
5265
|
-
}
|
|
5266
|
-
}
|
|
5271
|
+
const Portal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef((props, ref) => {
|
|
5272
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
|
|
5273
|
+
ref: ref
|
|
5274
|
+
}, props));
|
|
5275
|
+
});
|
|
5267
5276
|
|
|
5268
5277
|
/***/ }),
|
|
5269
5278
|
|
|
@@ -8217,6 +8226,44 @@ function warn(message) {
|
|
|
8217
8226
|
|
|
8218
8227
|
/***/ }),
|
|
8219
8228
|
|
|
8229
|
+
/***/ "../../victory-core/es/victory-util/merge-refs.js":
|
|
8230
|
+
/*!********************************************************!*\
|
|
8231
|
+
!*** ../../victory-core/es/victory-util/merge-refs.js ***!
|
|
8232
|
+
\********************************************************/
|
|
8233
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8234
|
+
|
|
8235
|
+
"use strict";
|
|
8236
|
+
__webpack_require__.r(__webpack_exports__);
|
|
8237
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
8238
|
+
/* harmony export */ "mergeRefs": function() { return /* binding */ mergeRefs; }
|
|
8239
|
+
/* harmony export */ });
|
|
8240
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
8241
|
+
|
|
8242
|
+
/**
|
|
8243
|
+
* Used to merge multiple React refs into a single callback ref.
|
|
8244
|
+
*
|
|
8245
|
+
* @example
|
|
8246
|
+
* ```tsx
|
|
8247
|
+
* <div ref={mergeRefs([ref, forwardedRef])} />
|
|
8248
|
+
* ```
|
|
8249
|
+
*/
|
|
8250
|
+
function mergeRefs(refs) {
|
|
8251
|
+
return value => {
|
|
8252
|
+
refs.forEach(ref => {
|
|
8253
|
+
// If the ref is a function, it's a callback ref and we call it with the value.
|
|
8254
|
+
if (_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction(ref)) {
|
|
8255
|
+
ref(value);
|
|
8256
|
+
} else if (ref !== null && ref !== undefined) {
|
|
8257
|
+
// If the ref is an object (not null and not undefined), it's an object ref.
|
|
8258
|
+
// We assign the value to its 'current' property.
|
|
8259
|
+
ref.current = value;
|
|
8260
|
+
}
|
|
8261
|
+
});
|
|
8262
|
+
};
|
|
8263
|
+
}
|
|
8264
|
+
|
|
8265
|
+
/***/ }),
|
|
8266
|
+
|
|
8220
8267
|
/***/ "../../victory-core/es/victory-util/scale.js":
|
|
8221
8268
|
/*!***************************************************!*\
|
|
8222
8269
|
!*** ../../victory-core/es/victory-util/scale.js ***!
|