victory-bar 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-bar.js +287 -257
- package/dist/victory-bar.min.js +1 -1
- package/es/bar-helper-methods.d.ts +6 -6
- package/es/bar.d.ts +19 -19
- package/es/geometry-helper-methods.d.ts +90 -90
- package/es/helper-methods.d.ts +7 -7
- package/es/index.d.ts +5 -5
- package/es/path-helper-methods.d.ts +7 -7
- package/es/victory-bar.d.ts +129 -129
- package/lib/bar-helper-methods.d.ts +6 -6
- package/lib/bar.d.ts +19 -19
- package/lib/geometry-helper-methods.d.ts +90 -90
- package/lib/helper-methods.d.ts +7 -7
- package/lib/index.d.ts +5 -5
- package/lib/path-helper-methods.d.ts +7 -7
- package/lib/victory-bar.d.ts +129 -129
- package/package.json +4 -7
package/CHANGELOG.md
CHANGED
package/dist/victory-bar.js
CHANGED
|
@@ -5901,23 +5901,18 @@ const VictoryAnimation = _ref => {
|
|
|
5901
5901
|
"use strict";
|
|
5902
5902
|
__webpack_require__.r(__webpack_exports__);
|
|
5903
5903
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5904
|
-
/* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; }
|
|
5904
|
+
/* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
|
|
5905
|
+
/* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
|
|
5905
5906
|
/* harmony export */ });
|
|
5906
|
-
/* harmony import */ var
|
|
5907
|
-
/* harmony import */ var
|
|
5908
|
-
/* harmony import */ var
|
|
5909
|
-
/* harmony import */ var
|
|
5910
|
-
/* harmony import */ var
|
|
5911
|
-
/* harmony import */ var
|
|
5912
|
-
/* harmony import */ var
|
|
5913
|
-
/* harmony import */ var
|
|
5914
|
-
/* harmony import */ var
|
|
5915
|
-
/* 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");
|
|
5916
|
-
/* 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");
|
|
5917
|
-
/* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
5918
|
-
/* 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");
|
|
5919
|
-
|
|
5920
|
-
|
|
5907
|
+
/* 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");
|
|
5908
|
+
/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
|
|
5909
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
|
|
5910
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
|
|
5911
|
+
/* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
|
|
5912
|
+
/* 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");
|
|
5913
|
+
/* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
|
|
5914
|
+
/* 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");
|
|
5915
|
+
/* 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");
|
|
5921
5916
|
|
|
5922
5917
|
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); }
|
|
5923
5918
|
|
|
@@ -5926,175 +5921,149 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
5926
5921
|
|
|
5927
5922
|
|
|
5928
5923
|
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
|
|
5932
|
-
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
5941
|
-
// @ts-expect-error Ref will be initialized on mount
|
|
5942
|
-
|
|
5943
|
-
// @ts-expect-error Ref will be initialized on mount
|
|
5944
|
-
|
|
5945
|
-
constructor(props) {
|
|
5946
|
-
super(props);
|
|
5947
|
-
this.containerId = !lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default()(props) || props.containerId === undefined ? lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default()("victory-container-") : props.containerId;
|
|
5948
|
-
this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
|
|
5949
|
-
}
|
|
5950
|
-
savePortalRef = portal => {
|
|
5951
|
-
this.portalRef = portal;
|
|
5952
|
-
return portal;
|
|
5924
|
+
const defaultProps = {
|
|
5925
|
+
className: "VictoryContainer",
|
|
5926
|
+
portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__.Portal, null),
|
|
5927
|
+
portalZIndex: 99,
|
|
5928
|
+
responsive: true,
|
|
5929
|
+
role: "img"
|
|
5930
|
+
};
|
|
5931
|
+
function useVictoryContainer(initialProps) {
|
|
5932
|
+
const props = {
|
|
5933
|
+
...defaultProps,
|
|
5934
|
+
...initialProps
|
|
5953
5935
|
};
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
|
|
5936
|
+
const {
|
|
5937
|
+
title,
|
|
5938
|
+
desc,
|
|
5939
|
+
width,
|
|
5940
|
+
height,
|
|
5941
|
+
responsive
|
|
5942
|
+
} = props;
|
|
5943
|
+
const localContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
|
|
5944
|
+
|
|
5945
|
+
// Generated ID stored in ref because it needs to persist across renders
|
|
5946
|
+
const generatedId = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()("victory-container-"));
|
|
5947
|
+
const containerId = props.containerId ?? generatedId.current;
|
|
5948
|
+
const getIdForElement = elName => `${containerId}-${elName}`;
|
|
5949
|
+
const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
|
|
5950
|
+
const dimensions = responsive ? {
|
|
5951
|
+
width: "100%",
|
|
5952
|
+
height: "100%"
|
|
5953
|
+
} : {
|
|
5954
|
+
width,
|
|
5955
|
+
height
|
|
5963
5956
|
};
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
const
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
} : {
|
|
6020
|
-
width,
|
|
6021
|
-
height
|
|
5957
|
+
const viewBox = responsive ? `0 0 ${width} ${height}` : undefined;
|
|
5958
|
+
const preserveAspectRatio = responsive ? props.preserveAspectRatio : undefined;
|
|
5959
|
+
const ariaLabelledBy = [title && getIdForElement("title"), props["aria-labelledby"]].filter(Boolean).join(" ") || undefined;
|
|
5960
|
+
const ariaDescribedBy = [desc && getIdForElement("desc"), props["aria-describedby"]].filter(Boolean).join(" ") || undefined;
|
|
5961
|
+
const titleId = getIdForElement("title");
|
|
5962
|
+
const descId = getIdForElement("desc");
|
|
5963
|
+
return {
|
|
5964
|
+
...props,
|
|
5965
|
+
titleId,
|
|
5966
|
+
descId,
|
|
5967
|
+
dimensions,
|
|
5968
|
+
viewBox,
|
|
5969
|
+
preserveAspectRatio,
|
|
5970
|
+
ariaLabelledBy,
|
|
5971
|
+
ariaDescribedBy,
|
|
5972
|
+
userProps,
|
|
5973
|
+
localContainerRef
|
|
5974
|
+
};
|
|
5975
|
+
}
|
|
5976
|
+
const VictoryContainer = initialProps => {
|
|
5977
|
+
const {
|
|
5978
|
+
role,
|
|
5979
|
+
title,
|
|
5980
|
+
desc,
|
|
5981
|
+
children,
|
|
5982
|
+
className,
|
|
5983
|
+
portalZIndex,
|
|
5984
|
+
portalComponent,
|
|
5985
|
+
width,
|
|
5986
|
+
height,
|
|
5987
|
+
style,
|
|
5988
|
+
tabIndex,
|
|
5989
|
+
responsive,
|
|
5990
|
+
events,
|
|
5991
|
+
ouiaId,
|
|
5992
|
+
ouiaSafe,
|
|
5993
|
+
ouiaType,
|
|
5994
|
+
dimensions,
|
|
5995
|
+
ariaDescribedBy,
|
|
5996
|
+
ariaLabelledBy,
|
|
5997
|
+
viewBox,
|
|
5998
|
+
preserveAspectRatio,
|
|
5999
|
+
userProps,
|
|
6000
|
+
titleId,
|
|
6001
|
+
descId,
|
|
6002
|
+
containerRef,
|
|
6003
|
+
localContainerRef
|
|
6004
|
+
} = useVictoryContainer(initialProps);
|
|
6005
|
+
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
|
|
6006
|
+
if (!events?.onWheel) return;
|
|
6007
|
+
const handleWheel = e => e.preventDefault();
|
|
6008
|
+
const container = localContainerRef?.current;
|
|
6009
|
+
container?.addEventListener("wheel", handleWheel);
|
|
6010
|
+
return () => {
|
|
6011
|
+
container?.removeEventListener("wheel", handleWheel);
|
|
6022
6012
|
};
|
|
6023
|
-
|
|
6013
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6014
|
+
}, []);
|
|
6015
|
+
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", {
|
|
6016
|
+
className: className,
|
|
6017
|
+
style: {
|
|
6018
|
+
...style,
|
|
6019
|
+
width: responsive ? style?.width : dimensions.width,
|
|
6020
|
+
height: responsive ? style?.height : dimensions.height,
|
|
6024
6021
|
pointerEvents: "none",
|
|
6025
6022
|
touchAction: "none",
|
|
6026
6023
|
position: "relative"
|
|
6027
|
-
},
|
|
6028
|
-
|
|
6024
|
+
},
|
|
6025
|
+
"data-ouia-component-id": ouiaId,
|
|
6026
|
+
"data-ouia-component-type": ouiaType,
|
|
6027
|
+
"data-ouia-safe": ouiaSafe,
|
|
6028
|
+
ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_5__.mergeRefs)([localContainerRef, containerRef])
|
|
6029
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("svg", _extends({
|
|
6030
|
+
width: width,
|
|
6031
|
+
height: height,
|
|
6032
|
+
tabIndex: tabIndex,
|
|
6033
|
+
role: role,
|
|
6034
|
+
"aria-labelledby": ariaLabelledBy,
|
|
6035
|
+
"aria-describedby": ariaDescribedBy,
|
|
6036
|
+
viewBox: viewBox,
|
|
6037
|
+
preserveAspectRatio: preserveAspectRatio,
|
|
6038
|
+
style: {
|
|
6039
|
+
...dimensions,
|
|
6040
|
+
pointerEvents: "all"
|
|
6041
|
+
}
|
|
6042
|
+
}, userProps, events), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("title", {
|
|
6043
|
+
id: titleId
|
|
6044
|
+
}, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("desc", {
|
|
6045
|
+
id: descId
|
|
6046
|
+
}, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
|
|
6047
|
+
style: {
|
|
6048
|
+
...dimensions,
|
|
6029
6049
|
zIndex: portalZIndex,
|
|
6030
6050
|
position: "absolute",
|
|
6031
6051
|
top: 0,
|
|
6032
6052
|
left: 0
|
|
6033
|
-
}
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6053
|
+
}
|
|
6054
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__.PortalOutlet, {
|
|
6055
|
+
as: portalComponent,
|
|
6056
|
+
width: width,
|
|
6057
|
+
height: height,
|
|
6058
|
+
viewBox: viewBox,
|
|
6059
|
+
preserveAspectRatio: preserveAspectRatio,
|
|
6060
|
+
style: {
|
|
6061
|
+
...dimensions,
|
|
6038
6062
|
overflow: "visible"
|
|
6039
|
-
}
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
viewBox: svgProps.viewBox,
|
|
6044
|
-
preserveAspectRatio: svgProps.preserveAspectRatio,
|
|
6045
|
-
style: portalSvgStyle
|
|
6046
|
-
};
|
|
6047
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_7__.PortalContext.Provider, {
|
|
6048
|
-
value: {
|
|
6049
|
-
portalUpdate: this.portalUpdate,
|
|
6050
|
-
portalRegister: this.portalRegister,
|
|
6051
|
-
portalDeregister: this.portalDeregister
|
|
6052
|
-
}
|
|
6053
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", _extends({
|
|
6054
|
-
style: lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, style, divStyle),
|
|
6055
|
-
className: className,
|
|
6056
|
-
ref: this.saveContainerRef
|
|
6057
|
-
}, this.getOUIAProps(props)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("svg", _extends({}, svgProps, {
|
|
6058
|
-
style: svgStyle
|
|
6059
|
-
}), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("title", {
|
|
6060
|
-
id: this.getIdForElement("title")
|
|
6061
|
-
}, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("desc", {
|
|
6062
|
-
id: this.getIdForElement("desc")
|
|
6063
|
-
}, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", {
|
|
6064
|
-
style: portalDivStyle
|
|
6065
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().cloneElement(portalComponent, {
|
|
6066
|
-
...portalProps,
|
|
6067
|
-
ref: this.savePortalRef
|
|
6068
|
-
}))));
|
|
6069
|
-
}
|
|
6070
|
-
render() {
|
|
6071
|
-
const {
|
|
6072
|
-
width,
|
|
6073
|
-
height,
|
|
6074
|
-
responsive,
|
|
6075
|
-
events,
|
|
6076
|
-
title,
|
|
6077
|
-
desc,
|
|
6078
|
-
tabIndex,
|
|
6079
|
-
preserveAspectRatio,
|
|
6080
|
-
role
|
|
6081
|
-
} = this.props;
|
|
6082
|
-
const style = responsive ? this.props.style : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.omit(this.props.style, ["height", "width"]);
|
|
6083
|
-
const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__.getSafeUserProps(this.props);
|
|
6084
|
-
const svgProps = Object.assign({
|
|
6085
|
-
width,
|
|
6086
|
-
height,
|
|
6087
|
-
tabIndex,
|
|
6088
|
-
role,
|
|
6089
|
-
"aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
|
|
6090
|
-
"aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
|
|
6091
|
-
viewBox: responsive ? `0 0 ${width} ${height}` : undefined,
|
|
6092
|
-
preserveAspectRatio: responsive ? preserveAspectRatio : undefined,
|
|
6093
|
-
...userProps
|
|
6094
|
-
}, events);
|
|
6095
|
-
return this.renderContainer(this.props, svgProps, style);
|
|
6096
|
-
}
|
|
6097
|
-
}
|
|
6063
|
+
}
|
|
6064
|
+
}))));
|
|
6065
|
+
};
|
|
6066
|
+
VictoryContainer.role = "container";
|
|
6098
6067
|
|
|
6099
6068
|
/***/ }),
|
|
6100
6069
|
|
|
@@ -6607,17 +6576,83 @@ VictoryLabel.defaultStyles = defaultStyles;
|
|
|
6607
6576
|
"use strict";
|
|
6608
6577
|
__webpack_require__.r(__webpack_exports__);
|
|
6609
6578
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6610
|
-
/* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; }
|
|
6579
|
+
/* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; },
|
|
6580
|
+
/* harmony export */ "PortalProvider": function() { return /* binding */ PortalProvider; },
|
|
6581
|
+
/* harmony export */ "usePortalContext": function() { return /* binding */ usePortalContext; }
|
|
6611
6582
|
/* harmony export */ });
|
|
6612
6583
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
6613
6584
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
6614
6585
|
|
|
6615
|
-
|
|
6616
|
-
* The React context object consumers may use to access the context of the
|
|
6617
|
-
* portal.
|
|
6618
|
-
*/
|
|
6619
|
-
const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({});
|
|
6586
|
+
const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined);
|
|
6620
6587
|
PortalContext.displayName = "PortalContext";
|
|
6588
|
+
const usePortalContext = () => {
|
|
6589
|
+
const context = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(PortalContext);
|
|
6590
|
+
if (!context) {
|
|
6591
|
+
throw new Error("`usePortalContext` must be used within a `<PortalProvider />`");
|
|
6592
|
+
}
|
|
6593
|
+
return context;
|
|
6594
|
+
};
|
|
6595
|
+
const PortalProvider = _ref => {
|
|
6596
|
+
let {
|
|
6597
|
+
children
|
|
6598
|
+
} = _ref;
|
|
6599
|
+
const [portalChildren, setPortalChildren] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(new Map());
|
|
6600
|
+
const addChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((id, element) => {
|
|
6601
|
+
setPortalChildren(prevChildren => {
|
|
6602
|
+
const nextChildren = new Map(prevChildren);
|
|
6603
|
+
nextChildren.set(id, element);
|
|
6604
|
+
return nextChildren;
|
|
6605
|
+
});
|
|
6606
|
+
}, [setPortalChildren]);
|
|
6607
|
+
const removeChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(id => {
|
|
6608
|
+
setPortalChildren(prevChildren => {
|
|
6609
|
+
const nextChildren = new Map(prevChildren);
|
|
6610
|
+
nextChildren.delete(id);
|
|
6611
|
+
return nextChildren;
|
|
6612
|
+
});
|
|
6613
|
+
}, [setPortalChildren]);
|
|
6614
|
+
const contextValue = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => ({
|
|
6615
|
+
addChild,
|
|
6616
|
+
removeChild,
|
|
6617
|
+
children: portalChildren
|
|
6618
|
+
}), [addChild, removeChild, portalChildren]);
|
|
6619
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PortalContext.Provider, {
|
|
6620
|
+
value: contextValue
|
|
6621
|
+
}, children);
|
|
6622
|
+
};
|
|
6623
|
+
|
|
6624
|
+
/***/ }),
|
|
6625
|
+
|
|
6626
|
+
/***/ "../../victory-core/es/victory-portal/portal-outlet.js":
|
|
6627
|
+
/*!*************************************************************!*\
|
|
6628
|
+
!*** ../../victory-core/es/victory-portal/portal-outlet.js ***!
|
|
6629
|
+
\*************************************************************/
|
|
6630
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
6631
|
+
|
|
6632
|
+
"use strict";
|
|
6633
|
+
__webpack_require__.r(__webpack_exports__);
|
|
6634
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6635
|
+
/* harmony export */ "PortalOutlet": function() { return /* binding */ PortalOutlet; }
|
|
6636
|
+
/* harmony export */ });
|
|
6637
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
6638
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
6639
|
+
/* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
|
|
6640
|
+
|
|
6641
|
+
|
|
6642
|
+
const PortalOutlet = _ref => {
|
|
6643
|
+
let {
|
|
6644
|
+
as: portalComponent,
|
|
6645
|
+
...props
|
|
6646
|
+
} = _ref;
|
|
6647
|
+
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_1__.usePortalContext)();
|
|
6648
|
+
const children = Array.from(portalContext.children.entries()).map(_ref2 => {
|
|
6649
|
+
let [key, node] = _ref2;
|
|
6650
|
+
return !node.key ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(node, {
|
|
6651
|
+
key
|
|
6652
|
+
}) : node;
|
|
6653
|
+
});
|
|
6654
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(portalComponent, props, children);
|
|
6655
|
+
};
|
|
6621
6656
|
|
|
6622
6657
|
/***/ }),
|
|
6623
6658
|
|
|
@@ -6634,39 +6669,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6634
6669
|
/* harmony export */ });
|
|
6635
6670
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
6636
6671
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
6672
|
+
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); }
|
|
6637
6673
|
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
this.index = 1;
|
|
6644
|
-
}
|
|
6645
|
-
portalRegister = () => {
|
|
6646
|
-
return ++this.index;
|
|
6647
|
-
};
|
|
6648
|
-
portalUpdate = (key, element) => {
|
|
6649
|
-
this.map[key] = element;
|
|
6650
|
-
this.forceUpdate();
|
|
6651
|
-
};
|
|
6652
|
-
portalDeregister = key => {
|
|
6653
|
-
delete this.map[key];
|
|
6654
|
-
this.forceUpdate();
|
|
6655
|
-
};
|
|
6656
|
-
getChildren() {
|
|
6657
|
-
return Object.keys(this.map).map(key => {
|
|
6658
|
-
const el = this.map[key];
|
|
6659
|
-
return el ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(el, {
|
|
6660
|
-
key
|
|
6661
|
-
}) : el;
|
|
6662
|
-
});
|
|
6663
|
-
}
|
|
6664
|
-
|
|
6665
|
-
// Overridden in victory-core-native
|
|
6666
|
-
render() {
|
|
6667
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", this.props, this.getChildren());
|
|
6668
|
-
}
|
|
6669
|
-
}
|
|
6674
|
+
const Portal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef((props, ref) => {
|
|
6675
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
|
|
6676
|
+
ref: ref
|
|
6677
|
+
}, props));
|
|
6678
|
+
});
|
|
6670
6679
|
|
|
6671
6680
|
/***/ }),
|
|
6672
6681
|
|
|
@@ -6693,59 +6702,42 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6693
6702
|
|
|
6694
6703
|
|
|
6695
6704
|
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
this.forceUpdate();
|
|
6713
|
-
}
|
|
6714
|
-
componentDidUpdate() {
|
|
6715
|
-
if (!this.renderInPlace) {
|
|
6716
|
-
this.portalKey = this.portalKey || this.context.portalRegister();
|
|
6717
|
-
this.context.portalUpdate(this.portalKey, this.element);
|
|
6718
|
-
}
|
|
6719
|
-
}
|
|
6720
|
-
componentWillUnmount() {
|
|
6721
|
-
if (this.context && this.context.portalDeregister) {
|
|
6722
|
-
this.context.portalDeregister(this.portalKey);
|
|
6723
|
-
}
|
|
6724
|
-
}
|
|
6725
|
-
|
|
6726
|
-
// Overridden in victory-core-native
|
|
6727
|
-
renderPortal(child) {
|
|
6728
|
-
if (this.renderInPlace) {
|
|
6729
|
-
return child;
|
|
6730
|
-
}
|
|
6731
|
-
this.element = child;
|
|
6732
|
-
return null;
|
|
6733
|
-
}
|
|
6734
|
-
render() {
|
|
6735
|
-
const children = Array.isArray(this.props.children) ? this.props.children[0] : this.props.children;
|
|
6705
|
+
const defaultProps = {
|
|
6706
|
+
groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
|
|
6707
|
+
};
|
|
6708
|
+
const VictoryPortal = initialProps => {
|
|
6709
|
+
const props = {
|
|
6710
|
+
...defaultProps,
|
|
6711
|
+
...initialProps
|
|
6712
|
+
};
|
|
6713
|
+
const id = react__WEBPACK_IMPORTED_MODULE_1___default().useId();
|
|
6714
|
+
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_2__.usePortalContext)();
|
|
6715
|
+
if (!portalContext) {
|
|
6716
|
+
const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
|
|
6717
|
+
_victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
|
|
6718
|
+
}
|
|
6719
|
+
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
|
|
6720
|
+
const children = Array.isArray(props.children) ? props.children[0] : props.children;
|
|
6736
6721
|
const {
|
|
6737
6722
|
groupComponent
|
|
6738
|
-
} =
|
|
6723
|
+
} = props;
|
|
6739
6724
|
const childProps = children && children.props || {};
|
|
6740
6725
|
const standardProps = childProps.groupComponent ? {
|
|
6741
6726
|
groupComponent,
|
|
6742
6727
|
standalone: false
|
|
6743
6728
|
} : {};
|
|
6744
|
-
const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(
|
|
6729
|
+
const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(props, ["children", "groupComponent"]));
|
|
6745
6730
|
const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
}
|
|
6731
|
+
portalContext.addChild(id, child);
|
|
6732
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6733
|
+
}, [props.children]);
|
|
6734
|
+
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
|
|
6735
|
+
return () => portalContext.removeChild(id);
|
|
6736
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6737
|
+
}, []);
|
|
6738
|
+
return null;
|
|
6739
|
+
};
|
|
6740
|
+
VictoryPortal.role = "portal";
|
|
6749
6741
|
|
|
6750
6742
|
/***/ }),
|
|
6751
6743
|
|
|
@@ -10099,6 +10091,44 @@ function warn(message) {
|
|
|
10099
10091
|
|
|
10100
10092
|
/***/ }),
|
|
10101
10093
|
|
|
10094
|
+
/***/ "../../victory-core/es/victory-util/merge-refs.js":
|
|
10095
|
+
/*!********************************************************!*\
|
|
10096
|
+
!*** ../../victory-core/es/victory-util/merge-refs.js ***!
|
|
10097
|
+
\********************************************************/
|
|
10098
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
10099
|
+
|
|
10100
|
+
"use strict";
|
|
10101
|
+
__webpack_require__.r(__webpack_exports__);
|
|
10102
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10103
|
+
/* harmony export */ "mergeRefs": function() { return /* binding */ mergeRefs; }
|
|
10104
|
+
/* harmony export */ });
|
|
10105
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
10106
|
+
|
|
10107
|
+
/**
|
|
10108
|
+
* Used to merge multiple React refs into a single callback ref.
|
|
10109
|
+
*
|
|
10110
|
+
* @example
|
|
10111
|
+
* ```tsx
|
|
10112
|
+
* <div ref={mergeRefs([ref, forwardedRef])} />
|
|
10113
|
+
* ```
|
|
10114
|
+
*/
|
|
10115
|
+
function mergeRefs(refs) {
|
|
10116
|
+
return value => {
|
|
10117
|
+
refs.forEach(ref => {
|
|
10118
|
+
// If the ref is a function, it's a callback ref and we call it with the value.
|
|
10119
|
+
if (_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction(ref)) {
|
|
10120
|
+
ref(value);
|
|
10121
|
+
} else if (ref !== null && ref !== undefined) {
|
|
10122
|
+
// If the ref is an object (not null and not undefined), it's an object ref.
|
|
10123
|
+
// We assign the value to its 'current' property.
|
|
10124
|
+
ref.current = value;
|
|
10125
|
+
}
|
|
10126
|
+
});
|
|
10127
|
+
};
|
|
10128
|
+
}
|
|
10129
|
+
|
|
10130
|
+
/***/ }),
|
|
10131
|
+
|
|
10102
10132
|
/***/ "../../victory-core/es/victory-util/scale.js":
|
|
10103
10133
|
/*!***************************************************!*\
|
|
10104
10134
|
!*** ../../victory-core/es/victory-util/scale.js ***!
|