victory 37.3.0 → 37.3.1

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,5 +1,7 @@
1
1
  # victory
2
2
 
3
+ ## 37.3.1
4
+
3
5
  ## 37.3.0
4
6
 
5
7
  ## 37.2.0
package/dist/victory.js CHANGED
@@ -13162,7 +13162,7 @@ class VictoryCandlestickBase extends (react__WEBPACK_IMPORTED_MODULE_0___default
13162
13162
  if (labelComponent) {
13163
13163
  const labelsComponents = this.dataKeys.map((_dataKey, index) => {
13164
13164
  const labelProps = this.getComponentProps(labelComponent, "labels", index);
13165
- if (labelProps.text !== undefined && labelProps.text !== null) {
13165
+ if (labelProps.text !== undefined && labelProps.text !== null && typeof labelProps.text !== "boolean") {
13166
13166
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(labelComponent, labelProps);
13167
13167
  }
13168
13168
  return undefined;
@@ -22859,6 +22859,8 @@ const CONTAINER_COMPONENTS_WEB = {
22859
22859
  voronoi: victory_voronoi_container__WEBPACK_IMPORTED_MODULE_9__.VictoryVoronoiContainer
22860
22860
  };
22861
22861
  function makeCreateContainerFunction(containerComponents, VictoryContainerBase) {
22862
+ // Helper type to support backwards compatibility with old types
22863
+
22862
22864
  return function combineContainers(containerA, containerB) {
22863
22865
  const ContainerA = containerComponents[containerA];
22864
22866
  const ContainerB = containerComponents[containerB];
@@ -25487,6 +25489,30 @@ const getSlices = (props, data) => {
25487
25489
  });
25488
25490
  return layoutFunction(data);
25489
25491
  };
25492
+ const getCategoriesFromProps = props => Array.isArray(props.categories) ? props.categories : props?.categories?.x ?? [];
25493
+
25494
+ /**
25495
+ * Sorts data by props.categories or props.categories.x. If all of the data keys aren't
25496
+ * included in categories, any remaining data will be appended to the data array.
25497
+ * If extraneous categories are included in the categories prop, the will be ignored and
25498
+ * have no effect on the rendered component.
25499
+ */
25500
+ const getDataSortedByCategories = (props, data) => {
25501
+ const sorted = [];
25502
+ getCategoriesFromProps(props).forEach(category => {
25503
+ const idx = data.findIndex(_ref => {
25504
+ let {
25505
+ x
25506
+ } = _ref;
25507
+ return x === category;
25508
+ });
25509
+ if (idx >= 0) {
25510
+ const datum = data.splice(idx, 1)[0];
25511
+ sorted.push(datum);
25512
+ }
25513
+ });
25514
+ return [...sorted, ...data];
25515
+ };
25490
25516
  const getCalculatedValues = props => {
25491
25517
  const {
25492
25518
  colorScale,
@@ -25498,7 +25524,7 @@ const getCalculatedValues = props => {
25498
25524
  const padding = victory_core__WEBPACK_IMPORTED_MODULE_3__.getPadding(props);
25499
25525
  const defaultRadius = getRadius(props, padding);
25500
25526
  const origin = getOrigin(props, padding);
25501
- const data = victory_core__WEBPACK_IMPORTED_MODULE_5__.getData(props);
25527
+ const data = getDataSortedByCategories(props, victory_core__WEBPACK_IMPORTED_MODULE_5__.getData(props));
25502
25528
  const slices = getSlices(props, data);
25503
25529
  return Object.assign({}, props, {
25504
25530
  style,