victory-create-container 37.0.3-next.0 → 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 CHANGED
@@ -1,17 +1,12 @@
1
1
  # victory-create-container
2
2
 
3
- ## 37.0.3-next.0
3
+ ## 37.1.0
4
4
 
5
- ### Patch Changes
5
+ ### Minor Changes
6
+
7
+ - Refactor containers and portal to function components ([#2799](https://github.com/FormidableLabs/victory/pull/2799))
6
8
 
7
- - 65d02419f: Refactor containers and portal to function components
8
- - Updated dependencies [65d02419f]
9
- - victory-brush-container@37.0.3-next.0
10
- - victory-core@37.0.3-next.0
11
- - victory-cursor-container@37.0.3-next.0
12
- - victory-selection-container@37.0.3-next.0
13
- - victory-voronoi-container@37.0.3-next.0
14
- - victory-zoom-container@37.0.3-next.0
9
+ * Pin all internal victory package versions ([#2876](https://github.com/FormidableLabs/victory/pull/2876))
15
10
 
16
11
  ## 37.0.2
17
12
 
@@ -7402,9 +7402,9 @@ __webpack_require__.r(__webpack_exports__);
7402
7402
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
7403
7403
  /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
7404
7404
  /* 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");
7405
- /* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
7405
+ /* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
7406
7406
  /* 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");
7407
- /* 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");
7407
+ /* 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");
7408
7408
 
7409
7409
  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); }
7410
7410
 
@@ -7504,7 +7504,7 @@ const VictoryContainer = initialProps => {
7504
7504
  };
7505
7505
  // eslint-disable-next-line react-hooks/exhaustive-deps
7506
7506
  }, []);
7507
- 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", {
7507
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("div", {
7508
7508
  className: className,
7509
7509
  style: {
7510
7510
  ...style,
@@ -7517,8 +7517,8 @@ const VictoryContainer = initialProps => {
7517
7517
  "data-ouia-component-id": ouiaId,
7518
7518
  "data-ouia-component-type": ouiaType,
7519
7519
  "data-ouia-safe": ouiaSafe,
7520
- ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_5__.mergeRefs)([localContainerRef, containerRef])
7521
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("svg", _extends({
7520
+ ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_4__.mergeRefs)([localContainerRef, containerRef])
7521
+ }, /*#__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({
7522
7522
  width: width,
7523
7523
  height: height,
7524
7524
  tabIndex: tabIndex,
@@ -8079,9 +8079,6 @@ const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().
8079
8079
  PortalContext.displayName = "PortalContext";
8080
8080
  const usePortalContext = () => {
8081
8081
  const context = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(PortalContext);
8082
- if (!context) {
8083
- throw new Error("`usePortalContext` must be used within a `<PortalProvider />`");
8084
- }
8085
8082
  return context;
8086
8083
  };
8087
8084
  const PortalProvider = _ref => {
@@ -8137,12 +8134,10 @@ const PortalOutlet = _ref => {
8137
8134
  ...props
8138
8135
  } = _ref;
8139
8136
  const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_1__.usePortalContext)();
8140
- const children = Array.from(portalContext.children.entries()).map(_ref2 => {
8141
- let [key, node] = _ref2;
8142
- return !node.key ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(node, {
8143
- key
8144
- }) : node;
8145
- });
8137
+ if (!portalContext) {
8138
+ return null;
8139
+ }
8140
+ const children = Array.from(portalContext.children.values());
8146
8141
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(portalComponent, props, children);
8147
8142
  };
8148
8143
 
@@ -8208,26 +8203,28 @@ const VictoryPortal = initialProps => {
8208
8203
  const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
8209
8204
  _victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
8210
8205
  }
8206
+ const children = Array.isArray(props.children) ? props.children[0] : props.children;
8207
+ const {
8208
+ groupComponent
8209
+ } = props;
8210
+ const childProps = children && children.props || {};
8211
+ const standardProps = childProps.groupComponent ? {
8212
+ groupComponent,
8213
+ standalone: false
8214
+ } : {};
8215
+ const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(props, ["children", "groupComponent"]), {
8216
+ key: childProps.key ?? id
8217
+ });
8218
+ const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
8211
8219
  react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
8212
- const children = Array.isArray(props.children) ? props.children[0] : props.children;
8213
- const {
8214
- groupComponent
8215
- } = props;
8216
- const childProps = children && children.props || {};
8217
- const standardProps = childProps.groupComponent ? {
8218
- groupComponent,
8219
- standalone: false
8220
- } : {};
8221
- const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(props, ["children", "groupComponent"]));
8222
- const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
8223
- portalContext.addChild(id, child);
8220
+ portalContext?.addChild(id, child);
8224
8221
  // eslint-disable-next-line react-hooks/exhaustive-deps
8225
8222
  }, [props.children]);
8226
8223
  react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
8227
- return () => portalContext.removeChild(id);
8224
+ return () => portalContext?.removeChild(id);
8228
8225
  // eslint-disable-next-line react-hooks/exhaustive-deps
8229
8226
  }, []);
8230
- return null;
8227
+ return portalContext ? null : child;
8231
8228
  };
8232
8229
  VictoryPortal.role = "portal";
8233
8230