victory-voronoi-container 37.1.2 → 37.2.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,5 +1,11 @@
1
1
  # victory-voronoi-container
2
2
 
3
+ ## 37.2.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix: #2369 `<VictoryVoronoiContainer/>` tooltip breaks when mouse moves quickly between different charts ([#2911](https://github.com/FormidableLabs/victory/pull/2911))
8
+
3
9
  ## 37.1.2
4
10
 
5
11
  ### Patch Changes
@@ -478,6 +478,7 @@ class VoronoiHelpersClass {
478
478
  }
479
479
  }
480
480
  onMouseLeave = (evt, targetProps) => {
481
+ this.onMouseMove.cancel();
481
482
  const activePoints = targetProps.activePoints || [];
482
483
  this.onDeactivated(targetProps, activePoints);
483
484
  const inactiveMutations = activePoints.length ? activePoints.map(point => this.getInactiveMutations(targetProps, point)) : [];
@@ -6788,31 +6789,34 @@ __webpack_require__.r(__webpack_exports__);
6788
6789
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
6789
6790
  /* harmony export */ "VictoryPortal": function() { return /* binding */ VictoryPortal; }
6790
6791
  /* harmony export */ });
6791
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
6792
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_0__);
6793
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
6794
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
6795
- /* harmony import */ var _victory_util_log__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../victory-util/log */ "../../victory-core/es/victory-util/log.js");
6796
- /* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
6797
- /* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
6792
+ /* 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");
6793
+ /* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
6794
+ /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
6795
+ /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
6796
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "react");
6797
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
6798
+ /* harmony import */ var _victory_util_log__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-util/log */ "../../victory-core/es/victory-util/log.js");
6799
+ /* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
6800
+ /* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
6801
+
6798
6802
 
6799
6803
 
6800
6804
 
6801
6805
 
6802
6806
 
6803
6807
  const defaultProps = {
6804
- groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement("g", null)
6808
+ groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement("g", null)
6805
6809
  };
6806
6810
  const VictoryPortal = initialProps => {
6807
6811
  const props = {
6808
6812
  ...defaultProps,
6809
6813
  ...initialProps
6810
6814
  };
6811
- const id = react__WEBPACK_IMPORTED_MODULE_1___default().useId();
6812
- const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_2__.usePortalContext)();
6815
+ const id = lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()();
6816
+ const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_3__.usePortalContext)();
6813
6817
  if (!portalContext) {
6814
6818
  const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
6815
- _victory_util_log__WEBPACK_IMPORTED_MODULE_3__.warn(msg);
6819
+ _victory_util_log__WEBPACK_IMPORTED_MODULE_4__.warn(msg);
6816
6820
  }
6817
6821
  const children = Array.isArray(props.children) ? props.children[0] : props.children;
6818
6822
  const {
@@ -6823,15 +6827,15 @@ const VictoryPortal = initialProps => {
6823
6827
  groupComponent,
6824
6828
  standalone: false
6825
6829
  } : {};
6826
- const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_4__.omit(props, ["children", "groupComponent"]), {
6830
+ const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_5__.omit(props, ["children", "groupComponent"]), {
6827
6831
  key: childProps.key ?? id
6828
6832
  });
6829
- const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(children, newProps);
6830
- react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
6833
+ const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().cloneElement(children, newProps);
6834
+ react__WEBPACK_IMPORTED_MODULE_2___default().useEffect(() => {
6831
6835
  portalContext?.addChild(id, child);
6832
6836
  // eslint-disable-next-line react-hooks/exhaustive-deps
6833
6837
  }, [props.children]);
6834
- react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(() => {
6838
+ react__WEBPACK_IMPORTED_MODULE_2___default().useEffect(() => {
6835
6839
  return () => portalContext?.removeChild(id);
6836
6840
  // eslint-disable-next-line react-hooks/exhaustive-deps
6837
6841
  }, []);
@@ -7085,7 +7089,26 @@ const green = {
7085
7089
  "500": "#20C933",
7086
7090
  "900": "#338A17"
7087
7091
  };
7088
- const colors = [blue["500"], pink["500"], teal["500"], purple["500"], green["500"], orange["500"], cyan["500"], red["500"], yellow["500"]];
7092
+ const colors = {
7093
+ blue: blue["500"],
7094
+ pink: pink["500"],
7095
+ teal: teal["500"],
7096
+ purple: purple["500"],
7097
+ green: green["500"],
7098
+ orange: orange["500"],
7099
+ cyan: cyan["500"],
7100
+ red: red["500"],
7101
+ yellow: yellow["500"]
7102
+ };
7103
+ const colorScale = Object.values(colors);
7104
+ const grayscale = [gray["200"], gray["400"], gray["600"], gray["900"]];
7105
+ const warm = [yellow["500"], orange["500"], red["500"], pink["500"]];
7106
+ const cool = [cyan["500"], teal["500"], blue["500"], purple["500"]];
7107
+ const heatmap = [green["500"], yellow["500"], red["500"]];
7108
+ const redPalette = [red["500"], red["300"], red["100"]];
7109
+ const greenPalette = [green["500"], green["300"], green["100"]];
7110
+ const bluePalette = [blue["500"], blue["300"], blue["100"]];
7111
+
7089
7112
  // *
7090
7113
  // * Typography
7091
7114
  // *
@@ -7100,7 +7123,7 @@ const baseProps = {
7100
7123
  width: 450,
7101
7124
  height: 300,
7102
7125
  padding: 50,
7103
- colorScale: colors
7126
+ colorScale
7104
7127
  };
7105
7128
  // *
7106
7129
  // * Labels
@@ -7129,10 +7152,23 @@ const borderRadius = 1;
7129
7152
  // * Theme
7130
7153
  // *
7131
7154
  const clean = {
7155
+ palette: {
7156
+ colors,
7157
+ grayscale,
7158
+ qualitative: colorScale,
7159
+ heatmap,
7160
+ warm,
7161
+ cool,
7162
+ red: redPalette,
7163
+ green: greenPalette,
7164
+ blue: bluePalette
7165
+ },
7132
7166
  area: Object.assign({
7133
7167
  style: {
7134
7168
  data: {
7135
- fill: cyan["500"]
7169
+ fill: blue["500"],
7170
+ strokeWidth: 2,
7171
+ fillOpacity: 0.5
7136
7172
  },
7137
7173
  labels: baseLabelStyles
7138
7174
  }
@@ -7141,7 +7177,7 @@ const clean = {
7141
7177
  style: {
7142
7178
  axis: {
7143
7179
  fill: "transparent",
7144
- stroke: gray["300"],
7180
+ stroke: gray["500"],
7145
7181
  strokeWidth: 1,
7146
7182
  strokeLinecap,
7147
7183
  strokeLinejoin
@@ -7166,10 +7202,10 @@ const clean = {
7166
7202
  polarAxis: Object.assign({
7167
7203
  style: {
7168
7204
  axis: {
7169
- stroke: gray["300"]
7205
+ stroke: gray["500"]
7170
7206
  },
7171
7207
  grid: {
7172
- stroke: gray["200"],
7208
+ stroke: gray["400"],
7173
7209
  strokeDasharray,
7174
7210
  strokeLinecap,
7175
7211
  strokeLinejoin,
@@ -7178,7 +7214,7 @@ const clean = {
7178
7214
  ticks: {
7179
7215
  fill: "transparent",
7180
7216
  size: 5,
7181
- stroke: gray["200"],
7217
+ stroke: gray["400"],
7182
7218
  strokeWidth: 1,
7183
7219
  strokeLinecap,
7184
7220
  strokeLinejoin
@@ -7189,10 +7225,10 @@ const clean = {
7189
7225
  polarDependentAxis: Object.assign({
7190
7226
  style: {
7191
7227
  axis: {
7192
- stroke: gray["300"]
7228
+ stroke: gray["500"]
7193
7229
  },
7194
7230
  grid: {
7195
- stroke: gray["200"],
7231
+ stroke: gray["400"],
7196
7232
  strokeDasharray,
7197
7233
  strokeLinecap,
7198
7234
  strokeLinejoin,
@@ -7201,7 +7237,7 @@ const clean = {
7201
7237
  ticks: {
7202
7238
  fill: "transparent",
7203
7239
  size: 5,
7204
- stroke: gray["200"],
7240
+ stroke: gray["300"],
7205
7241
  strokeWidth: 1,
7206
7242
  strokeLinecap,
7207
7243
  strokeLinejoin
@@ -7214,7 +7250,8 @@ const clean = {
7214
7250
  data: {
7215
7251
  fill: blue["500"],
7216
7252
  padding,
7217
- strokeWidth: 0
7253
+ strokeWidth: 1,
7254
+ fillOpacity: 0.5
7218
7255
  },
7219
7256
  labels: baseLabelStyles
7220
7257
  },
@@ -7251,14 +7288,15 @@ const clean = {
7251
7288
  q1: {
7252
7289
  padding,
7253
7290
  fill: teal["500"],
7254
- rx: borderRadius
7291
+ rx: borderRadius,
7292
+ strokeWidth: 2
7255
7293
  },
7256
7294
  q1Labels: Object.assign({}, baseLabelStyles, {
7257
7295
  padding: 3
7258
7296
  }),
7259
7297
  q3: {
7260
7298
  padding,
7261
- fill: teal["500"],
7299
+ fill: cyan["500"],
7262
7300
  rx: borderRadius
7263
7301
  },
7264
7302
  q3Labels: Object.assign({}, baseLabelStyles, {
@@ -7299,14 +7337,13 @@ const clean = {
7299
7337
  }
7300
7338
  }, baseProps),
7301
7339
  group: Object.assign({
7302
- colorScale: colors
7340
+ colorScale
7303
7341
  }, baseProps),
7304
7342
  histogram: Object.assign({
7305
7343
  style: {
7306
7344
  data: {
7307
7345
  fill: cyan["500"],
7308
- stroke: "transparent",
7309
- strokeWidth: 0
7346
+ fillOpacity: 0.5
7310
7347
  },
7311
7348
  labels: baseLabelStyles
7312
7349
  },
@@ -7317,21 +7354,23 @@ const clean = {
7317
7354
  }, baseProps),
7318
7355
  label: baseLabelStyles,
7319
7356
  legend: {
7320
- colorScale: colors,
7321
- gutter: 10,
7322
- orientation: "vertical",
7357
+ colorScale,
7358
+ gutter: 24,
7359
+ borderPadding: 10,
7360
+ orientation: "horizontal",
7323
7361
  titleOrientation: "top",
7362
+ centerTitle: true,
7324
7363
  style: {
7325
7364
  data: {
7326
7365
  type: "circle"
7327
7366
  },
7328
7367
  labels: {
7329
7368
  ...baseLabelStyles,
7330
- fontSize: 14
7369
+ fontSize: 12
7331
7370
  },
7332
7371
  title: Object.assign({}, baseLabelStyles, {
7333
7372
  padding,
7334
- fontSize: 20
7373
+ fontSize: 16
7335
7374
  }),
7336
7375
  border: {
7337
7376
  stroke: gray["200"],
@@ -7345,7 +7384,7 @@ const clean = {
7345
7384
  data: {
7346
7385
  fill: "transparent",
7347
7386
  opacity: 1,
7348
- stroke: pink["500"],
7387
+ stroke: blue["500"],
7349
7388
  strokeWidth: 2,
7350
7389
  strokeLinecap,
7351
7390
  strokeLinejoin
@@ -7355,16 +7394,22 @@ const clean = {
7355
7394
  }, baseProps),
7356
7395
  pie: Object.assign({
7357
7396
  style: {
7397
+ parent: {
7398
+ backgroundColor: gray.white
7399
+ },
7358
7400
  data: {
7359
7401
  padding,
7360
7402
  stroke: gray.white,
7361
7403
  strokeWidth: 1
7362
7404
  },
7363
- labels: Object.assign({}, baseLabelStyles, {
7364
- padding: 20
7365
- })
7405
+ labels: {
7406
+ ...baseLabelStyles,
7407
+ padding: 20,
7408
+ fill: gray["600"],
7409
+ fontSize: 10
7410
+ }
7366
7411
  },
7367
- colorScale: colors,
7412
+ colorScale,
7368
7413
  cornerRadius: borderRadius
7369
7414
  }, baseProps),
7370
7415
  scatter: Object.assign({
@@ -7375,11 +7420,14 @@ const clean = {
7375
7420
  stroke: "transparent",
7376
7421
  strokeWidth: 0
7377
7422
  },
7378
- labels: baseLabelStyles
7423
+ labels: {
7424
+ ...baseLabelStyles,
7425
+ padding: 20
7426
+ }
7379
7427
  }
7380
7428
  }, baseProps),
7381
7429
  stack: Object.assign({
7382
- colorScale: colors
7430
+ colorScale
7383
7431
  }, baseProps),
7384
7432
  tooltip: {
7385
7433
  style: Object.assign({}, baseLabelStyles, {
@@ -7387,7 +7435,7 @@ const clean = {
7387
7435
  pointerEvents: "none"
7388
7436
  }),
7389
7437
  flyoutStyle: {
7390
- stroke: gray["500"],
7438
+ stroke: gray["300"],
7391
7439
  strokeWidth: 2,
7392
7440
  fill: gray.white,
7393
7441
  pointerEvents: "none"
@@ -7404,9 +7452,10 @@ const clean = {
7404
7452
  voronoi: Object.assign({
7405
7453
  style: {
7406
7454
  data: {
7407
- fill: red["100"],
7408
- stroke: red["500"],
7409
- strokeWidth: 2
7455
+ fill: blue["100"],
7456
+ stroke: blue["500"],
7457
+ strokeWidth: 2,
7458
+ opacity: 0.4
7410
7459
  },
7411
7460
  labels: Object.assign({}, baseLabelStyles, {
7412
7461
  padding: 5,
@@ -7442,9 +7491,28 @@ __webpack_require__.r(__webpack_exports__);
7442
7491
  // *
7443
7492
  // * Colors
7444
7493
  // *
7445
- const colors = ["#252525", "#525252", "#737373", "#969696", "#bdbdbd", "#d9d9d9", "#f0f0f0"];
7494
+ const colors = {
7495
+ blue: "#4F7DA1",
7496
+ pink: "#E2A37F",
7497
+ teal: "#00796B",
7498
+ purple: "#DF948A",
7499
+ green: "#8BC34A",
7500
+ orange: "#F4511E",
7501
+ cyan: "#006064",
7502
+ red: "#DF5A49",
7503
+ yellow: "#FFF59D"
7504
+ };
7505
+ const colorScale = ["#252525", "#525252", "#737373", "#969696", "#bdbdbd", "#d9d9d9", "#f0f0f0"];
7446
7506
  const charcoal = "#252525";
7447
7507
  const grey = "#969696";
7508
+ const qualitative = ["#334D5C", "#45B29D", "#EFC94C", "#E27A3F", "#DF5A49", "#4F7DA1", "#55DBC1", "#EFDA97", "#E2A37F", "#DF948A"];
7509
+ const heatmap = ["#428517", "#77D200", "#D6D305", "#EC8E19", "#C92B05"];
7510
+ const warm = ["#940031", "#C43343", "#DC5429", "#FF821D", "#FFAF55"];
7511
+ const cool = ["#2746B9", "#0B69D4", "#2794DB", "#31BB76", "#60E83B"];
7512
+ const red = ["#FCAE91", "#FB6A4A", "#DE2D26", "#A50F15", "#750B0E"];
7513
+ const green = ["#354722", "#466631", "#649146", "#8AB25C", "#A9C97E"];
7514
+ const blue = ["#002C61", "#004B8F", "#006BC9", "#3795E5", "#65B4F4"];
7515
+
7448
7516
  // *
7449
7517
  // * Typography
7450
7518
  // *
@@ -7458,7 +7526,7 @@ const baseProps = {
7458
7526
  width: 450,
7459
7527
  height: 300,
7460
7528
  padding: 50,
7461
- colorScale: colors
7529
+ colorScale
7462
7530
  };
7463
7531
  // *
7464
7532
  // * Labels
@@ -7480,6 +7548,17 @@ const centeredLabelStyles = Object.assign({
7480
7548
  const strokeLinecap = "round";
7481
7549
  const strokeLinejoin = "round";
7482
7550
  const grayscale = {
7551
+ palette: {
7552
+ colors,
7553
+ grayscale: colorScale,
7554
+ qualitative,
7555
+ heatmap,
7556
+ warm,
7557
+ cool,
7558
+ red,
7559
+ green,
7560
+ blue
7561
+ },
7483
7562
  area: Object.assign({
7484
7563
  style: {
7485
7564
  data: {
@@ -7594,7 +7673,7 @@ const grayscale = {
7594
7673
  }
7595
7674
  }, baseProps),
7596
7675
  group: Object.assign({
7597
- colorScale: colors
7676
+ colorScale
7598
7677
  }, baseProps),
7599
7678
  histogram: Object.assign({
7600
7679
  style: {
@@ -7607,7 +7686,7 @@ const grayscale = {
7607
7686
  }
7608
7687
  }, baseProps),
7609
7688
  legend: {
7610
- colorScale: colors,
7689
+ colorScale,
7611
7690
  gutter: 10,
7612
7691
  orientation: "vertical",
7613
7692
  titleOrientation: "top",
@@ -7642,7 +7721,7 @@ const grayscale = {
7642
7721
  padding: 20
7643
7722
  })
7644
7723
  },
7645
- colorScale: colors,
7724
+ colorScale,
7646
7725
  width: 400,
7647
7726
  height: 400,
7648
7727
  padding: 50
@@ -7658,7 +7737,7 @@ const grayscale = {
7658
7737
  }
7659
7738
  }, baseProps),
7660
7739
  stack: Object.assign({
7661
- colorScale: colors
7740
+ colorScale
7662
7741
  }, baseProps),
7663
7742
  tooltip: {
7664
7743
  style: Object.assign({}, baseLabelStyles, {
@@ -7718,11 +7797,31 @@ const lime300 = "#DCE775";
7718
7797
  const lightGreen500 = "#8BC34A";
7719
7798
  const teal700 = "#00796B";
7720
7799
  const cyan900 = "#006064";
7721
- const colors = [deepOrange600, yellow200, lime300, lightGreen500, teal700, cyan900];
7800
+ const colorScale = [deepOrange600, yellow200, lime300, lightGreen500, teal700, cyan900];
7722
7801
  const blueGrey50 = "#ECEFF1";
7723
7802
  const blueGrey300 = "#90A4AE";
7724
7803
  const blueGrey700 = "#455A64";
7725
7804
  const grey900 = "#212121";
7805
+ const colors = {
7806
+ blue: "#4F7DA1",
7807
+ pink: "#E2A37F",
7808
+ teal: teal700,
7809
+ purple: "#DF948A",
7810
+ green: lightGreen500,
7811
+ orange: deepOrange600,
7812
+ cyan: cyan900,
7813
+ red: "#DF5A49",
7814
+ yellow: yellow200
7815
+ };
7816
+ const grayscale = [blueGrey50, blueGrey300, blueGrey700, grey900];
7817
+ const qualitative = ["#334D5C", "#45B29D", "#EFC94C", "#E27A3F", "#DF5A49", "#4F7DA1", "#55DBC1", "#EFDA97", "#E2A37F", "#DF948A"];
7818
+ const heatmap = ["#428517", "#77D200", "#D6D305", "#EC8E19", "#C92B05"];
7819
+ const warm = ["#940031", "#C43343", "#DC5429", "#FF821D", "#FFAF55"];
7820
+ const cool = ["#2746B9", "#0B69D4", "#2794DB", "#31BB76", "#60E83B"];
7821
+ const red = ["#FCAE91", "#FB6A4A", "#DE2D26", "#A50F15", "#750B0E"];
7822
+ const green = ["#354722", "#466631", "#649146", "#8AB25C", "#A9C97E"];
7823
+ const blue = ["#002C61", "#004B8F", "#006BC9", "#3795E5", "#65B4F4"];
7824
+
7726
7825
  // *
7727
7826
  // * Typography
7728
7827
  // *
@@ -7760,6 +7859,17 @@ const strokeDasharray = "10, 5";
7760
7859
  const strokeLinecap = "round";
7761
7860
  const strokeLinejoin = "round";
7762
7861
  const material = {
7862
+ palette: {
7863
+ colors,
7864
+ grayscale,
7865
+ qualitative,
7866
+ heatmap,
7867
+ warm,
7868
+ cool,
7869
+ red,
7870
+ green,
7871
+ blue
7872
+ },
7763
7873
  area: Object.assign({
7764
7874
  style: {
7765
7875
  data: {
@@ -7892,7 +8002,7 @@ const material = {
7892
8002
  }
7893
8003
  }, baseProps),
7894
8004
  group: Object.assign({
7895
- colorScale: colors
8005
+ colorScale
7896
8006
  }, baseProps),
7897
8007
  histogram: Object.assign({
7898
8008
  style: {
@@ -7905,7 +8015,7 @@ const material = {
7905
8015
  }
7906
8016
  }, baseProps),
7907
8017
  legend: {
7908
- colorScale: colors,
8018
+ colorScale,
7909
8019
  gutter: 10,
7910
8020
  orientation: "vertical",
7911
8021
  titleOrientation: "top",
@@ -7931,7 +8041,7 @@ const material = {
7931
8041
  }
7932
8042
  }, baseProps),
7933
8043
  pie: Object.assign({
7934
- colorScale: colors,
8044
+ colorScale,
7935
8045
  style: {
7936
8046
  data: {
7937
8047
  padding,
@@ -7955,7 +8065,7 @@ const material = {
7955
8065
  }
7956
8066
  }, baseProps),
7957
8067
  stack: Object.assign({
7958
- colorScale: colors
8068
+ colorScale
7959
8069
  }, baseProps),
7960
8070
  tooltip: {
7961
8071
  style: Object.assign({}, baseLabelStyles, {
@@ -9639,6 +9749,9 @@ __webpack_require__.r(__webpack_exports__);
9639
9749
  /* harmony export */ "getColorScale": function() { return /* binding */ getColorScale; },
9640
9750
  /* harmony export */ "toTransformString": function() { return /* binding */ toTransformString; }
9641
9751
  /* harmony export */ });
9752
+ /* harmony import */ var _victory_theme_victory_theme__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../victory-theme/victory-theme */ "../../victory-core/es/victory-theme/victory-theme.js");
9753
+
9754
+
9642
9755
  /**
9643
9756
  * Given an object with CSS/SVG transform definitions, return the string value
9644
9757
  * for use with the `transform` CSS property or SVG attribute. Note that we
@@ -9675,20 +9788,37 @@ const toTransformString = function (obj) {
9675
9788
  * of 5 hex string values in that color scale. If no 'name' parameter
9676
9789
  * is given, it will return the Victory default grayscale.
9677
9790
  * @param {String} name The name of the color scale to return (optional).
9791
+ * @param {Object} theme The theme object to retrieve the color scale from (optional).
9678
9792
  * @returns {Array} An array of 5 hex string values composing a color scale.
9679
9793
  */
9680
- function getColorScale(name) {
9794
+ function getColorScale(name, theme) {
9795
+ if (theme === void 0) {
9796
+ theme = _victory_theme_victory_theme__WEBPACK_IMPORTED_MODULE_0__.VictoryTheme.material;
9797
+ }
9798
+ const {
9799
+ palette: {
9800
+ grayscale = ["#cccccc", "#969696", "#636363", "#252525"],
9801
+ qualitative = [],
9802
+ heatmap = [],
9803
+ warm = [],
9804
+ cool = [],
9805
+ red = [],
9806
+ blue = [],
9807
+ green = []
9808
+ } = {}
9809
+ } = theme;
9681
9810
  const scales = {
9682
- grayscale: ["#cccccc", "#969696", "#636363", "#252525"],
9683
- qualitative: ["#334D5C", "#45B29D", "#EFC94C", "#E27A3F", "#DF5A49", "#4F7DA1", "#55DBC1", "#EFDA97", "#E2A37F", "#DF948A"],
9684
- heatmap: ["#428517", "#77D200", "#D6D305", "#EC8E19", "#C92B05"],
9685
- warm: ["#940031", "#C43343", "#DC5429", "#FF821D", "#FFAF55"],
9686
- cool: ["#2746B9", "#0B69D4", "#2794DB", "#31BB76", "#60E83B"],
9687
- red: ["#FCAE91", "#FB6A4A", "#DE2D26", "#A50F15", "#750B0E"],
9688
- blue: ["#002C61", "#004B8F", "#006BC9", "#3795E5", "#65B4F4"],
9689
- green: ["#354722", "#466631", "#649146", "#8AB25C", "#A9C97E"]
9811
+ grayscale,
9812
+ qualitative,
9813
+ heatmap,
9814
+ warm,
9815
+ cool,
9816
+ red,
9817
+ blue,
9818
+ green
9690
9819
  };
9691
- return name ? scales[name] : scales.grayscale;
9820
+ const selectedScale = name && scales[name]?.length ? scales[name] : scales.grayscale;
9821
+ return selectedScale;
9692
9822
  }
9693
9823
 
9694
9824
  /***/ }),