victory-histogram 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 +9 -0
- package/dist/victory-histogram.js +287 -257
- package/dist/victory-histogram.min.js +1 -1
- package/es/helper-methods.d.ts +5 -5
- package/es/index.d.ts +1 -1
- package/es/victory-histogram.d.ts +132 -132
- package/lib/helper-methods.d.ts +5 -5
- package/lib/index.d.ts +1 -1
- package/lib/victory-histogram.d.ts +132 -132
- package/package.json +4 -7
package/CHANGELOG.md
CHANGED
|
@@ -6184,23 +6184,18 @@ const VictoryAnimation = _ref => {
|
|
|
6184
6184
|
"use strict";
|
|
6185
6185
|
__webpack_require__.r(__webpack_exports__);
|
|
6186
6186
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6187
|
-
/* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; }
|
|
6187
|
+
/* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
|
|
6188
|
+
/* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
|
|
6188
6189
|
/* harmony export */ });
|
|
6189
|
-
/* harmony import */ var
|
|
6190
|
-
/* harmony import */ var
|
|
6191
|
-
/* harmony import */ var
|
|
6192
|
-
/* harmony import */ var
|
|
6193
|
-
/* harmony import */ var
|
|
6194
|
-
/* harmony import */ var
|
|
6195
|
-
/* harmony import */ var
|
|
6196
|
-
/* harmony import */ var
|
|
6197
|
-
/* harmony import */ var
|
|
6198
|
-
/* 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");
|
|
6199
|
-
/* 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");
|
|
6200
|
-
/* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
6201
|
-
/* 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");
|
|
6202
|
-
|
|
6203
|
-
|
|
6190
|
+
/* 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");
|
|
6191
|
+
/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
|
|
6192
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
|
|
6193
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
|
|
6194
|
+
/* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
|
|
6195
|
+
/* 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");
|
|
6196
|
+
/* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
|
|
6197
|
+
/* 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");
|
|
6198
|
+
/* 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");
|
|
6204
6199
|
|
|
6205
6200
|
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); }
|
|
6206
6201
|
|
|
@@ -6209,175 +6204,149 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
6209
6204
|
|
|
6210
6205
|
|
|
6211
6206
|
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
// @ts-expect-error Ref will be initialized on mount
|
|
6225
|
-
|
|
6226
|
-
// @ts-expect-error Ref will be initialized on mount
|
|
6227
|
-
|
|
6228
|
-
constructor(props) {
|
|
6229
|
-
super(props);
|
|
6230
|
-
this.containerId = !lodash_isObject__WEBPACK_IMPORTED_MODULE_0___default()(props) || props.containerId === undefined ? lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default()("victory-container-") : props.containerId;
|
|
6231
|
-
this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
|
|
6232
|
-
}
|
|
6233
|
-
savePortalRef = portal => {
|
|
6234
|
-
this.portalRef = portal;
|
|
6235
|
-
return portal;
|
|
6207
|
+
const defaultProps = {
|
|
6208
|
+
className: "VictoryContainer",
|
|
6209
|
+
portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__.Portal, null),
|
|
6210
|
+
portalZIndex: 99,
|
|
6211
|
+
responsive: true,
|
|
6212
|
+
role: "img"
|
|
6213
|
+
};
|
|
6214
|
+
function useVictoryContainer(initialProps) {
|
|
6215
|
+
const props = {
|
|
6216
|
+
...defaultProps,
|
|
6217
|
+
...initialProps
|
|
6236
6218
|
};
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6219
|
+
const {
|
|
6220
|
+
title,
|
|
6221
|
+
desc,
|
|
6222
|
+
width,
|
|
6223
|
+
height,
|
|
6224
|
+
responsive
|
|
6225
|
+
} = props;
|
|
6226
|
+
const localContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
|
|
6227
|
+
|
|
6228
|
+
// Generated ID stored in ref because it needs to persist across renders
|
|
6229
|
+
const generatedId = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()("victory-container-"));
|
|
6230
|
+
const containerId = props.containerId ?? generatedId.current;
|
|
6231
|
+
const getIdForElement = elName => `${containerId}-${elName}`;
|
|
6232
|
+
const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
|
|
6233
|
+
const dimensions = responsive ? {
|
|
6234
|
+
width: "100%",
|
|
6235
|
+
height: "100%"
|
|
6236
|
+
} : {
|
|
6237
|
+
width,
|
|
6238
|
+
height
|
|
6246
6239
|
};
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
const
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
} : {
|
|
6303
|
-
width,
|
|
6304
|
-
height
|
|
6240
|
+
const viewBox = responsive ? `0 0 ${width} ${height}` : undefined;
|
|
6241
|
+
const preserveAspectRatio = responsive ? props.preserveAspectRatio : undefined;
|
|
6242
|
+
const ariaLabelledBy = [title && getIdForElement("title"), props["aria-labelledby"]].filter(Boolean).join(" ") || undefined;
|
|
6243
|
+
const ariaDescribedBy = [desc && getIdForElement("desc"), props["aria-describedby"]].filter(Boolean).join(" ") || undefined;
|
|
6244
|
+
const titleId = getIdForElement("title");
|
|
6245
|
+
const descId = getIdForElement("desc");
|
|
6246
|
+
return {
|
|
6247
|
+
...props,
|
|
6248
|
+
titleId,
|
|
6249
|
+
descId,
|
|
6250
|
+
dimensions,
|
|
6251
|
+
viewBox,
|
|
6252
|
+
preserveAspectRatio,
|
|
6253
|
+
ariaLabelledBy,
|
|
6254
|
+
ariaDescribedBy,
|
|
6255
|
+
userProps,
|
|
6256
|
+
localContainerRef
|
|
6257
|
+
};
|
|
6258
|
+
}
|
|
6259
|
+
const VictoryContainer = initialProps => {
|
|
6260
|
+
const {
|
|
6261
|
+
role,
|
|
6262
|
+
title,
|
|
6263
|
+
desc,
|
|
6264
|
+
children,
|
|
6265
|
+
className,
|
|
6266
|
+
portalZIndex,
|
|
6267
|
+
portalComponent,
|
|
6268
|
+
width,
|
|
6269
|
+
height,
|
|
6270
|
+
style,
|
|
6271
|
+
tabIndex,
|
|
6272
|
+
responsive,
|
|
6273
|
+
events,
|
|
6274
|
+
ouiaId,
|
|
6275
|
+
ouiaSafe,
|
|
6276
|
+
ouiaType,
|
|
6277
|
+
dimensions,
|
|
6278
|
+
ariaDescribedBy,
|
|
6279
|
+
ariaLabelledBy,
|
|
6280
|
+
viewBox,
|
|
6281
|
+
preserveAspectRatio,
|
|
6282
|
+
userProps,
|
|
6283
|
+
titleId,
|
|
6284
|
+
descId,
|
|
6285
|
+
containerRef,
|
|
6286
|
+
localContainerRef
|
|
6287
|
+
} = useVictoryContainer(initialProps);
|
|
6288
|
+
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
|
|
6289
|
+
if (!events?.onWheel) return;
|
|
6290
|
+
const handleWheel = e => e.preventDefault();
|
|
6291
|
+
const container = localContainerRef?.current;
|
|
6292
|
+
container?.addEventListener("wheel", handleWheel);
|
|
6293
|
+
return () => {
|
|
6294
|
+
container?.removeEventListener("wheel", handleWheel);
|
|
6305
6295
|
};
|
|
6306
|
-
|
|
6296
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6297
|
+
}, []);
|
|
6298
|
+
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", {
|
|
6299
|
+
className: className,
|
|
6300
|
+
style: {
|
|
6301
|
+
...style,
|
|
6302
|
+
width: responsive ? style?.width : dimensions.width,
|
|
6303
|
+
height: responsive ? style?.height : dimensions.height,
|
|
6307
6304
|
pointerEvents: "none",
|
|
6308
6305
|
touchAction: "none",
|
|
6309
6306
|
position: "relative"
|
|
6310
|
-
},
|
|
6311
|
-
|
|
6307
|
+
},
|
|
6308
|
+
"data-ouia-component-id": ouiaId,
|
|
6309
|
+
"data-ouia-component-type": ouiaType,
|
|
6310
|
+
"data-ouia-safe": ouiaSafe,
|
|
6311
|
+
ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_5__.mergeRefs)([localContainerRef, containerRef])
|
|
6312
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("svg", _extends({
|
|
6313
|
+
width: width,
|
|
6314
|
+
height: height,
|
|
6315
|
+
tabIndex: tabIndex,
|
|
6316
|
+
role: role,
|
|
6317
|
+
"aria-labelledby": ariaLabelledBy,
|
|
6318
|
+
"aria-describedby": ariaDescribedBy,
|
|
6319
|
+
viewBox: viewBox,
|
|
6320
|
+
preserveAspectRatio: preserveAspectRatio,
|
|
6321
|
+
style: {
|
|
6322
|
+
...dimensions,
|
|
6323
|
+
pointerEvents: "all"
|
|
6324
|
+
}
|
|
6325
|
+
}, userProps, events), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("title", {
|
|
6326
|
+
id: titleId
|
|
6327
|
+
}, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("desc", {
|
|
6328
|
+
id: descId
|
|
6329
|
+
}, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
|
|
6330
|
+
style: {
|
|
6331
|
+
...dimensions,
|
|
6312
6332
|
zIndex: portalZIndex,
|
|
6313
6333
|
position: "absolute",
|
|
6314
6334
|
top: 0,
|
|
6315
6335
|
left: 0
|
|
6316
|
-
}
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6336
|
+
}
|
|
6337
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__.PortalOutlet, {
|
|
6338
|
+
as: portalComponent,
|
|
6339
|
+
width: width,
|
|
6340
|
+
height: height,
|
|
6341
|
+
viewBox: viewBox,
|
|
6342
|
+
preserveAspectRatio: preserveAspectRatio,
|
|
6343
|
+
style: {
|
|
6344
|
+
...dimensions,
|
|
6321
6345
|
overflow: "visible"
|
|
6322
|
-
}
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
viewBox: svgProps.viewBox,
|
|
6327
|
-
preserveAspectRatio: svgProps.preserveAspectRatio,
|
|
6328
|
-
style: portalSvgStyle
|
|
6329
|
-
};
|
|
6330
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_7__.PortalContext.Provider, {
|
|
6331
|
-
value: {
|
|
6332
|
-
portalUpdate: this.portalUpdate,
|
|
6333
|
-
portalRegister: this.portalRegister,
|
|
6334
|
-
portalDeregister: this.portalDeregister
|
|
6335
|
-
}
|
|
6336
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", _extends({
|
|
6337
|
-
style: lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, style, divStyle),
|
|
6338
|
-
className: className,
|
|
6339
|
-
ref: this.saveContainerRef
|
|
6340
|
-
}, this.getOUIAProps(props)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("svg", _extends({}, svgProps, {
|
|
6341
|
-
style: svgStyle
|
|
6342
|
-
}), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("title", {
|
|
6343
|
-
id: this.getIdForElement("title")
|
|
6344
|
-
}, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("desc", {
|
|
6345
|
-
id: this.getIdForElement("desc")
|
|
6346
|
-
}, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().createElement("div", {
|
|
6347
|
-
style: portalDivStyle
|
|
6348
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default().cloneElement(portalComponent, {
|
|
6349
|
-
...portalProps,
|
|
6350
|
-
ref: this.savePortalRef
|
|
6351
|
-
}))));
|
|
6352
|
-
}
|
|
6353
|
-
render() {
|
|
6354
|
-
const {
|
|
6355
|
-
width,
|
|
6356
|
-
height,
|
|
6357
|
-
responsive,
|
|
6358
|
-
events,
|
|
6359
|
-
title,
|
|
6360
|
-
desc,
|
|
6361
|
-
tabIndex,
|
|
6362
|
-
preserveAspectRatio,
|
|
6363
|
-
role
|
|
6364
|
-
} = this.props;
|
|
6365
|
-
const style = responsive ? this.props.style : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_6__.omit(this.props.style, ["height", "width"]);
|
|
6366
|
-
const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_8__.getSafeUserProps(this.props);
|
|
6367
|
-
const svgProps = Object.assign({
|
|
6368
|
-
width,
|
|
6369
|
-
height,
|
|
6370
|
-
tabIndex,
|
|
6371
|
-
role,
|
|
6372
|
-
"aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
|
|
6373
|
-
"aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
|
|
6374
|
-
viewBox: responsive ? `0 0 ${width} ${height}` : undefined,
|
|
6375
|
-
preserveAspectRatio: responsive ? preserveAspectRatio : undefined,
|
|
6376
|
-
...userProps
|
|
6377
|
-
}, events);
|
|
6378
|
-
return this.renderContainer(this.props, svgProps, style);
|
|
6379
|
-
}
|
|
6380
|
-
}
|
|
6346
|
+
}
|
|
6347
|
+
}))));
|
|
6348
|
+
};
|
|
6349
|
+
VictoryContainer.role = "container";
|
|
6381
6350
|
|
|
6382
6351
|
/***/ }),
|
|
6383
6352
|
|
|
@@ -6890,17 +6859,83 @@ VictoryLabel.defaultStyles = defaultStyles;
|
|
|
6890
6859
|
"use strict";
|
|
6891
6860
|
__webpack_require__.r(__webpack_exports__);
|
|
6892
6861
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6893
|
-
/* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; }
|
|
6862
|
+
/* harmony export */ "PortalContext": function() { return /* binding */ PortalContext; },
|
|
6863
|
+
/* harmony export */ "PortalProvider": function() { return /* binding */ PortalProvider; },
|
|
6864
|
+
/* harmony export */ "usePortalContext": function() { return /* binding */ usePortalContext; }
|
|
6894
6865
|
/* harmony export */ });
|
|
6895
6866
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
6896
6867
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
6897
6868
|
|
|
6898
|
-
|
|
6899
|
-
* The React context object consumers may use to access the context of the
|
|
6900
|
-
* portal.
|
|
6901
|
-
*/
|
|
6902
|
-
const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({});
|
|
6869
|
+
const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined);
|
|
6903
6870
|
PortalContext.displayName = "PortalContext";
|
|
6871
|
+
const usePortalContext = () => {
|
|
6872
|
+
const context = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(PortalContext);
|
|
6873
|
+
if (!context) {
|
|
6874
|
+
throw new Error("`usePortalContext` must be used within a `<PortalProvider />`");
|
|
6875
|
+
}
|
|
6876
|
+
return context;
|
|
6877
|
+
};
|
|
6878
|
+
const PortalProvider = _ref => {
|
|
6879
|
+
let {
|
|
6880
|
+
children
|
|
6881
|
+
} = _ref;
|
|
6882
|
+
const [portalChildren, setPortalChildren] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(new Map());
|
|
6883
|
+
const addChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((id, element) => {
|
|
6884
|
+
setPortalChildren(prevChildren => {
|
|
6885
|
+
const nextChildren = new Map(prevChildren);
|
|
6886
|
+
nextChildren.set(id, element);
|
|
6887
|
+
return nextChildren;
|
|
6888
|
+
});
|
|
6889
|
+
}, [setPortalChildren]);
|
|
6890
|
+
const removeChild = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(id => {
|
|
6891
|
+
setPortalChildren(prevChildren => {
|
|
6892
|
+
const nextChildren = new Map(prevChildren);
|
|
6893
|
+
nextChildren.delete(id);
|
|
6894
|
+
return nextChildren;
|
|
6895
|
+
});
|
|
6896
|
+
}, [setPortalChildren]);
|
|
6897
|
+
const contextValue = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => ({
|
|
6898
|
+
addChild,
|
|
6899
|
+
removeChild,
|
|
6900
|
+
children: portalChildren
|
|
6901
|
+
}), [addChild, removeChild, portalChildren]);
|
|
6902
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PortalContext.Provider, {
|
|
6903
|
+
value: contextValue
|
|
6904
|
+
}, children);
|
|
6905
|
+
};
|
|
6906
|
+
|
|
6907
|
+
/***/ }),
|
|
6908
|
+
|
|
6909
|
+
/***/ "../../victory-core/es/victory-portal/portal-outlet.js":
|
|
6910
|
+
/*!*************************************************************!*\
|
|
6911
|
+
!*** ../../victory-core/es/victory-portal/portal-outlet.js ***!
|
|
6912
|
+
\*************************************************************/
|
|
6913
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
6914
|
+
|
|
6915
|
+
"use strict";
|
|
6916
|
+
__webpack_require__.r(__webpack_exports__);
|
|
6917
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6918
|
+
/* harmony export */ "PortalOutlet": function() { return /* binding */ PortalOutlet; }
|
|
6919
|
+
/* harmony export */ });
|
|
6920
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
6921
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
6922
|
+
/* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
|
|
6923
|
+
|
|
6924
|
+
|
|
6925
|
+
const PortalOutlet = _ref => {
|
|
6926
|
+
let {
|
|
6927
|
+
as: portalComponent,
|
|
6928
|
+
...props
|
|
6929
|
+
} = _ref;
|
|
6930
|
+
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_1__.usePortalContext)();
|
|
6931
|
+
const children = Array.from(portalContext.children.entries()).map(_ref2 => {
|
|
6932
|
+
let [key, node] = _ref2;
|
|
6933
|
+
return !node.key ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(node, {
|
|
6934
|
+
key
|
|
6935
|
+
}) : node;
|
|
6936
|
+
});
|
|
6937
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(portalComponent, props, children);
|
|
6938
|
+
};
|
|
6904
6939
|
|
|
6905
6940
|
/***/ }),
|
|
6906
6941
|
|
|
@@ -6917,39 +6952,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6917
6952
|
/* harmony export */ });
|
|
6918
6953
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
6919
6954
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
6955
|
+
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); }
|
|
6920
6956
|
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
this.index = 1;
|
|
6927
|
-
}
|
|
6928
|
-
portalRegister = () => {
|
|
6929
|
-
return ++this.index;
|
|
6930
|
-
};
|
|
6931
|
-
portalUpdate = (key, element) => {
|
|
6932
|
-
this.map[key] = element;
|
|
6933
|
-
this.forceUpdate();
|
|
6934
|
-
};
|
|
6935
|
-
portalDeregister = key => {
|
|
6936
|
-
delete this.map[key];
|
|
6937
|
-
this.forceUpdate();
|
|
6938
|
-
};
|
|
6939
|
-
getChildren() {
|
|
6940
|
-
return Object.keys(this.map).map(key => {
|
|
6941
|
-
const el = this.map[key];
|
|
6942
|
-
return el ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(el, {
|
|
6943
|
-
key
|
|
6944
|
-
}) : el;
|
|
6945
|
-
});
|
|
6946
|
-
}
|
|
6947
|
-
|
|
6948
|
-
// Overridden in victory-core-native
|
|
6949
|
-
render() {
|
|
6950
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", this.props, this.getChildren());
|
|
6951
|
-
}
|
|
6952
|
-
}
|
|
6957
|
+
const Portal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef((props, ref) => {
|
|
6958
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
|
|
6959
|
+
ref: ref
|
|
6960
|
+
}, props));
|
|
6961
|
+
});
|
|
6953
6962
|
|
|
6954
6963
|
/***/ }),
|
|
6955
6964
|
|
|
@@ -6976,59 +6985,42 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6976
6985
|
|
|
6977
6986
|
|
|
6978
6987
|
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
|
|
6990
|
-
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
this.forceUpdate();
|
|
6996
|
-
}
|
|
6997
|
-
componentDidUpdate() {
|
|
6998
|
-
if (!this.renderInPlace) {
|
|
6999
|
-
this.portalKey = this.portalKey || this.context.portalRegister();
|
|
7000
|
-
this.context.portalUpdate(this.portalKey, this.element);
|
|
7001
|
-
}
|
|
7002
|
-
}
|
|
7003
|
-
componentWillUnmount() {
|
|
7004
|
-
if (this.context && this.context.portalDeregister) {
|
|
7005
|
-
this.context.portalDeregister(this.portalKey);
|
|
7006
|
-
}
|
|
7007
|
-
}
|
|
7008
|
-
|
|
7009
|
-
// Overridden in victory-core-native
|
|
7010
|
-
renderPortal(child) {
|
|
7011
|
-
if (this.renderInPlace) {
|
|
7012
|
-
return child;
|
|
7013
|
-
}
|
|
7014
|
-
this.element = child;
|
|
7015
|
-
return null;
|
|
7016
|
-
}
|
|
7017
|
-
render() {
|
|
7018
|
-
const children = Array.isArray(this.props.children) ? this.props.children[0] : this.props.children;
|
|
6988
|
+
const defaultProps = {
|
|
6989
|
+
groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
|
|
6990
|
+
};
|
|
6991
|
+
const VictoryPortal = initialProps => {
|
|
6992
|
+
const props = {
|
|
6993
|
+
...defaultProps,
|
|
6994
|
+
...initialProps
|
|
6995
|
+
};
|
|
6996
|
+
const id = react__WEBPACK_IMPORTED_MODULE_1___default().useId();
|
|
6997
|
+
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_2__.usePortalContext)();
|
|
6998
|
+
if (!portalContext) {
|
|
6999
|
+
const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
|
|
7000
|
+
_victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
|
|
7001
|
+
}
|
|
7002
|
+
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
|
|
7003
|
+
const children = Array.isArray(props.children) ? props.children[0] : props.children;
|
|
7019
7004
|
const {
|
|
7020
7005
|
groupComponent
|
|
7021
|
-
} =
|
|
7006
|
+
} = props;
|
|
7022
7007
|
const childProps = children && children.props || {};
|
|
7023
7008
|
const standardProps = childProps.groupComponent ? {
|
|
7024
7009
|
groupComponent,
|
|
7025
7010
|
standalone: false
|
|
7026
7011
|
} : {};
|
|
7027
|
-
const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(
|
|
7012
|
+
const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(props, ["children", "groupComponent"]));
|
|
7028
7013
|
const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
|
|
7029
|
-
|
|
7030
|
-
|
|
7031
|
-
}
|
|
7014
|
+
portalContext.addChild(id, child);
|
|
7015
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7016
|
+
}, [props.children]);
|
|
7017
|
+
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
|
|
7018
|
+
return () => portalContext.removeChild(id);
|
|
7019
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7020
|
+
}, []);
|
|
7021
|
+
return null;
|
|
7022
|
+
};
|
|
7023
|
+
VictoryPortal.role = "portal";
|
|
7032
7024
|
|
|
7033
7025
|
/***/ }),
|
|
7034
7026
|
|
|
@@ -10382,6 +10374,44 @@ function warn(message) {
|
|
|
10382
10374
|
|
|
10383
10375
|
/***/ }),
|
|
10384
10376
|
|
|
10377
|
+
/***/ "../../victory-core/es/victory-util/merge-refs.js":
|
|
10378
|
+
/*!********************************************************!*\
|
|
10379
|
+
!*** ../../victory-core/es/victory-util/merge-refs.js ***!
|
|
10380
|
+
\********************************************************/
|
|
10381
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
10382
|
+
|
|
10383
|
+
"use strict";
|
|
10384
|
+
__webpack_require__.r(__webpack_exports__);
|
|
10385
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10386
|
+
/* harmony export */ "mergeRefs": function() { return /* binding */ mergeRefs; }
|
|
10387
|
+
/* harmony export */ });
|
|
10388
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
10389
|
+
|
|
10390
|
+
/**
|
|
10391
|
+
* Used to merge multiple React refs into a single callback ref.
|
|
10392
|
+
*
|
|
10393
|
+
* @example
|
|
10394
|
+
* ```tsx
|
|
10395
|
+
* <div ref={mergeRefs([ref, forwardedRef])} />
|
|
10396
|
+
* ```
|
|
10397
|
+
*/
|
|
10398
|
+
function mergeRefs(refs) {
|
|
10399
|
+
return value => {
|
|
10400
|
+
refs.forEach(ref => {
|
|
10401
|
+
// If the ref is a function, it's a callback ref and we call it with the value.
|
|
10402
|
+
if (_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction(ref)) {
|
|
10403
|
+
ref(value);
|
|
10404
|
+
} else if (ref !== null && ref !== undefined) {
|
|
10405
|
+
// If the ref is an object (not null and not undefined), it's an object ref.
|
|
10406
|
+
// We assign the value to its 'current' property.
|
|
10407
|
+
ref.current = value;
|
|
10408
|
+
}
|
|
10409
|
+
});
|
|
10410
|
+
};
|
|
10411
|
+
}
|
|
10412
|
+
|
|
10413
|
+
/***/ }),
|
|
10414
|
+
|
|
10385
10415
|
/***/ "../../victory-core/es/victory-util/scale.js":
|
|
10386
10416
|
/*!***************************************************!*\
|
|
10387
10417
|
!*** ../../victory-core/es/victory-util/scale.js ***!
|