victory-core 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 +12 -0
- package/dist/victory-core.js +205 -72
- package/dist/victory-core.min.js +1 -1
- package/es/types/prop-types.d.ts +1 -0
- package/es/victory-portal/victory-portal.js +2 -1
- package/es/victory-theme/clean.js +77 -32
- package/es/victory-theme/grayscale.js +36 -6
- package/es/victory-theme/material.js +36 -5
- package/es/victory-theme/types.d.ts +16 -0
- package/es/victory-util/style.d.ts +3 -1
- package/es/victory-util/style.js +29 -10
- package/es/victory-util/wrapper.d.ts +2 -2
- package/es/victory-util/wrapper.js +8 -4
- package/lib/types/prop-types.d.ts +1 -0
- package/lib/victory-portal/victory-portal.js +2 -1
- package/lib/victory-theme/clean.js +77 -32
- package/lib/victory-theme/grayscale.js +36 -6
- package/lib/victory-theme/material.js +36 -5
- package/lib/victory-theme/types.d.ts +16 -0
- package/lib/victory-util/style.d.ts +3 -1
- package/lib/victory-util/style.js +28 -10
- package/lib/victory-util/wrapper.d.ts +2 -2
- package/lib/victory-util/wrapper.js +8 -4
- package/package.json +2 -2
- package/src/types/prop-types.ts +1 -0
- package/src/victory-portal/victory-portal.tsx +2 -2
- package/src/victory-theme/clean.tsx +76 -39
- package/src/victory-theme/grayscale.tsx +49 -6
- package/src/victory-theme/material.tsx +50 -6
- package/src/victory-theme/types.ts +26 -0
- package/src/victory-util/style.ts +37 -22
- package/src/victory-util/wrapper.tsx +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# victory-core
|
|
2
2
|
|
|
3
|
+
## 37.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Minor updates for clean theme ([#2909](https://github.com/FormidableLabs/victory/pull/2909))
|
|
8
|
+
|
|
9
|
+
* more minor updates to clean theme ([#2915](https://github.com/FormidableLabs/victory/pull/2915))
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- replace useId for backwards compatibility ([#2916](https://github.com/FormidableLabs/victory/pull/2916))
|
|
14
|
+
|
|
3
15
|
## 37.1.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/victory-core.js
CHANGED
|
@@ -1410,31 +1410,34 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1410
1410
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1411
1411
|
/* harmony export */ "VictoryPortal": function() { return /* binding */ VictoryPortal; }
|
|
1412
1412
|
/* harmony export */ });
|
|
1413
|
-
/* harmony import */ var
|
|
1414
|
-
/* harmony import */ var
|
|
1415
|
-
/* harmony import */ var
|
|
1416
|
-
/* harmony import */ var
|
|
1417
|
-
/* harmony import */ var
|
|
1418
|
-
/* harmony import */ var
|
|
1419
|
-
/* harmony import */ var
|
|
1413
|
+
/* 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");
|
|
1414
|
+
/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
|
|
1415
|
+
/* 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");
|
|
1416
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
|
|
1417
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "react");
|
|
1418
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
|
|
1419
|
+
/* harmony import */ var _victory_util_log__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-util/log */ "./victory-util/log.ts");
|
|
1420
|
+
/* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-util/helpers */ "./victory-util/helpers.ts");
|
|
1421
|
+
/* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./portal-context */ "./victory-portal/portal-context.tsx");
|
|
1422
|
+
|
|
1420
1423
|
|
|
1421
1424
|
|
|
1422
1425
|
|
|
1423
1426
|
|
|
1424
1427
|
|
|
1425
1428
|
const defaultProps = {
|
|
1426
|
-
groupComponent: /*#__PURE__*/
|
|
1429
|
+
groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement("g", null)
|
|
1427
1430
|
};
|
|
1428
1431
|
const VictoryPortal = initialProps => {
|
|
1429
1432
|
const props = {
|
|
1430
1433
|
...defaultProps,
|
|
1431
1434
|
...initialProps
|
|
1432
1435
|
};
|
|
1433
|
-
const id =
|
|
1434
|
-
const portalContext = (0,
|
|
1436
|
+
const id = lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()();
|
|
1437
|
+
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_3__.usePortalContext)();
|
|
1435
1438
|
if (!portalContext) {
|
|
1436
1439
|
const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
|
|
1437
|
-
|
|
1440
|
+
_victory_util_log__WEBPACK_IMPORTED_MODULE_4__.warn(msg);
|
|
1438
1441
|
}
|
|
1439
1442
|
const children = Array.isArray(props.children) ? props.children[0] : props.children;
|
|
1440
1443
|
const {
|
|
@@ -1445,15 +1448,15 @@ const VictoryPortal = initialProps => {
|
|
|
1445
1448
|
groupComponent,
|
|
1446
1449
|
standalone: false
|
|
1447
1450
|
} : {};
|
|
1448
|
-
const newProps =
|
|
1451
|
+
const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_5__.omit(props, ["children", "groupComponent"]), {
|
|
1449
1452
|
key: childProps.key ?? id
|
|
1450
1453
|
});
|
|
1451
|
-
const child = children && /*#__PURE__*/
|
|
1452
|
-
|
|
1454
|
+
const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().cloneElement(children, newProps);
|
|
1455
|
+
react__WEBPACK_IMPORTED_MODULE_2___default().useEffect(() => {
|
|
1453
1456
|
portalContext?.addChild(id, child);
|
|
1454
1457
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1455
1458
|
}, [props.children]);
|
|
1456
|
-
|
|
1459
|
+
react__WEBPACK_IMPORTED_MODULE_2___default().useEffect(() => {
|
|
1457
1460
|
return () => portalContext?.removeChild(id);
|
|
1458
1461
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1459
1462
|
}, []);
|
|
@@ -2355,7 +2358,26 @@ const green = {
|
|
|
2355
2358
|
"500": "#20C933",
|
|
2356
2359
|
"900": "#338A17"
|
|
2357
2360
|
};
|
|
2358
|
-
const colors =
|
|
2361
|
+
const colors = {
|
|
2362
|
+
blue: blue["500"],
|
|
2363
|
+
pink: pink["500"],
|
|
2364
|
+
teal: teal["500"],
|
|
2365
|
+
purple: purple["500"],
|
|
2366
|
+
green: green["500"],
|
|
2367
|
+
orange: orange["500"],
|
|
2368
|
+
cyan: cyan["500"],
|
|
2369
|
+
red: red["500"],
|
|
2370
|
+
yellow: yellow["500"]
|
|
2371
|
+
};
|
|
2372
|
+
const colorScale = Object.values(colors);
|
|
2373
|
+
const grayscale = [gray["200"], gray["400"], gray["600"], gray["900"]];
|
|
2374
|
+
const warm = [yellow["500"], orange["500"], red["500"], pink["500"]];
|
|
2375
|
+
const cool = [cyan["500"], teal["500"], blue["500"], purple["500"]];
|
|
2376
|
+
const heatmap = [green["500"], yellow["500"], red["500"]];
|
|
2377
|
+
const redPalette = [red["500"], red["300"], red["100"]];
|
|
2378
|
+
const greenPalette = [green["500"], green["300"], green["100"]];
|
|
2379
|
+
const bluePalette = [blue["500"], blue["300"], blue["100"]];
|
|
2380
|
+
|
|
2359
2381
|
// *
|
|
2360
2382
|
// * Typography
|
|
2361
2383
|
// *
|
|
@@ -2370,7 +2392,7 @@ const baseProps = {
|
|
|
2370
2392
|
width: 450,
|
|
2371
2393
|
height: 300,
|
|
2372
2394
|
padding: 50,
|
|
2373
|
-
colorScale
|
|
2395
|
+
colorScale
|
|
2374
2396
|
};
|
|
2375
2397
|
// *
|
|
2376
2398
|
// * Labels
|
|
@@ -2399,10 +2421,23 @@ const borderRadius = 1;
|
|
|
2399
2421
|
// * Theme
|
|
2400
2422
|
// *
|
|
2401
2423
|
const clean = {
|
|
2424
|
+
palette: {
|
|
2425
|
+
colors,
|
|
2426
|
+
grayscale,
|
|
2427
|
+
qualitative: colorScale,
|
|
2428
|
+
heatmap,
|
|
2429
|
+
warm,
|
|
2430
|
+
cool,
|
|
2431
|
+
red: redPalette,
|
|
2432
|
+
green: greenPalette,
|
|
2433
|
+
blue: bluePalette
|
|
2434
|
+
},
|
|
2402
2435
|
area: Object.assign({
|
|
2403
2436
|
style: {
|
|
2404
2437
|
data: {
|
|
2405
|
-
fill:
|
|
2438
|
+
fill: blue["500"],
|
|
2439
|
+
strokeWidth: 2,
|
|
2440
|
+
fillOpacity: 0.5
|
|
2406
2441
|
},
|
|
2407
2442
|
labels: baseLabelStyles
|
|
2408
2443
|
}
|
|
@@ -2411,7 +2446,7 @@ const clean = {
|
|
|
2411
2446
|
style: {
|
|
2412
2447
|
axis: {
|
|
2413
2448
|
fill: "transparent",
|
|
2414
|
-
stroke: gray["
|
|
2449
|
+
stroke: gray["500"],
|
|
2415
2450
|
strokeWidth: 1,
|
|
2416
2451
|
strokeLinecap,
|
|
2417
2452
|
strokeLinejoin
|
|
@@ -2436,10 +2471,10 @@ const clean = {
|
|
|
2436
2471
|
polarAxis: Object.assign({
|
|
2437
2472
|
style: {
|
|
2438
2473
|
axis: {
|
|
2439
|
-
stroke: gray["
|
|
2474
|
+
stroke: gray["500"]
|
|
2440
2475
|
},
|
|
2441
2476
|
grid: {
|
|
2442
|
-
stroke: gray["
|
|
2477
|
+
stroke: gray["400"],
|
|
2443
2478
|
strokeDasharray,
|
|
2444
2479
|
strokeLinecap,
|
|
2445
2480
|
strokeLinejoin,
|
|
@@ -2448,7 +2483,7 @@ const clean = {
|
|
|
2448
2483
|
ticks: {
|
|
2449
2484
|
fill: "transparent",
|
|
2450
2485
|
size: 5,
|
|
2451
|
-
stroke: gray["
|
|
2486
|
+
stroke: gray["400"],
|
|
2452
2487
|
strokeWidth: 1,
|
|
2453
2488
|
strokeLinecap,
|
|
2454
2489
|
strokeLinejoin
|
|
@@ -2459,10 +2494,10 @@ const clean = {
|
|
|
2459
2494
|
polarDependentAxis: Object.assign({
|
|
2460
2495
|
style: {
|
|
2461
2496
|
axis: {
|
|
2462
|
-
stroke: gray["
|
|
2497
|
+
stroke: gray["500"]
|
|
2463
2498
|
},
|
|
2464
2499
|
grid: {
|
|
2465
|
-
stroke: gray["
|
|
2500
|
+
stroke: gray["400"],
|
|
2466
2501
|
strokeDasharray,
|
|
2467
2502
|
strokeLinecap,
|
|
2468
2503
|
strokeLinejoin,
|
|
@@ -2471,7 +2506,7 @@ const clean = {
|
|
|
2471
2506
|
ticks: {
|
|
2472
2507
|
fill: "transparent",
|
|
2473
2508
|
size: 5,
|
|
2474
|
-
stroke: gray["
|
|
2509
|
+
stroke: gray["300"],
|
|
2475
2510
|
strokeWidth: 1,
|
|
2476
2511
|
strokeLinecap,
|
|
2477
2512
|
strokeLinejoin
|
|
@@ -2484,7 +2519,8 @@ const clean = {
|
|
|
2484
2519
|
data: {
|
|
2485
2520
|
fill: blue["500"],
|
|
2486
2521
|
padding,
|
|
2487
|
-
strokeWidth:
|
|
2522
|
+
strokeWidth: 1,
|
|
2523
|
+
fillOpacity: 0.5
|
|
2488
2524
|
},
|
|
2489
2525
|
labels: baseLabelStyles
|
|
2490
2526
|
},
|
|
@@ -2521,14 +2557,15 @@ const clean = {
|
|
|
2521
2557
|
q1: {
|
|
2522
2558
|
padding,
|
|
2523
2559
|
fill: teal["500"],
|
|
2524
|
-
rx: borderRadius
|
|
2560
|
+
rx: borderRadius,
|
|
2561
|
+
strokeWidth: 2
|
|
2525
2562
|
},
|
|
2526
2563
|
q1Labels: Object.assign({}, baseLabelStyles, {
|
|
2527
2564
|
padding: 3
|
|
2528
2565
|
}),
|
|
2529
2566
|
q3: {
|
|
2530
2567
|
padding,
|
|
2531
|
-
fill:
|
|
2568
|
+
fill: cyan["500"],
|
|
2532
2569
|
rx: borderRadius
|
|
2533
2570
|
},
|
|
2534
2571
|
q3Labels: Object.assign({}, baseLabelStyles, {
|
|
@@ -2569,14 +2606,13 @@ const clean = {
|
|
|
2569
2606
|
}
|
|
2570
2607
|
}, baseProps),
|
|
2571
2608
|
group: Object.assign({
|
|
2572
|
-
colorScale
|
|
2609
|
+
colorScale
|
|
2573
2610
|
}, baseProps),
|
|
2574
2611
|
histogram: Object.assign({
|
|
2575
2612
|
style: {
|
|
2576
2613
|
data: {
|
|
2577
2614
|
fill: cyan["500"],
|
|
2578
|
-
|
|
2579
|
-
strokeWidth: 0
|
|
2615
|
+
fillOpacity: 0.5
|
|
2580
2616
|
},
|
|
2581
2617
|
labels: baseLabelStyles
|
|
2582
2618
|
},
|
|
@@ -2587,21 +2623,23 @@ const clean = {
|
|
|
2587
2623
|
}, baseProps),
|
|
2588
2624
|
label: baseLabelStyles,
|
|
2589
2625
|
legend: {
|
|
2590
|
-
colorScale
|
|
2591
|
-
gutter:
|
|
2592
|
-
|
|
2626
|
+
colorScale,
|
|
2627
|
+
gutter: 24,
|
|
2628
|
+
borderPadding: 10,
|
|
2629
|
+
orientation: "horizontal",
|
|
2593
2630
|
titleOrientation: "top",
|
|
2631
|
+
centerTitle: true,
|
|
2594
2632
|
style: {
|
|
2595
2633
|
data: {
|
|
2596
2634
|
type: "circle"
|
|
2597
2635
|
},
|
|
2598
2636
|
labels: {
|
|
2599
2637
|
...baseLabelStyles,
|
|
2600
|
-
fontSize:
|
|
2638
|
+
fontSize: 12
|
|
2601
2639
|
},
|
|
2602
2640
|
title: Object.assign({}, baseLabelStyles, {
|
|
2603
2641
|
padding,
|
|
2604
|
-
fontSize:
|
|
2642
|
+
fontSize: 16
|
|
2605
2643
|
}),
|
|
2606
2644
|
border: {
|
|
2607
2645
|
stroke: gray["200"],
|
|
@@ -2615,7 +2653,7 @@ const clean = {
|
|
|
2615
2653
|
data: {
|
|
2616
2654
|
fill: "transparent",
|
|
2617
2655
|
opacity: 1,
|
|
2618
|
-
stroke:
|
|
2656
|
+
stroke: blue["500"],
|
|
2619
2657
|
strokeWidth: 2,
|
|
2620
2658
|
strokeLinecap,
|
|
2621
2659
|
strokeLinejoin
|
|
@@ -2625,16 +2663,22 @@ const clean = {
|
|
|
2625
2663
|
}, baseProps),
|
|
2626
2664
|
pie: Object.assign({
|
|
2627
2665
|
style: {
|
|
2666
|
+
parent: {
|
|
2667
|
+
backgroundColor: gray.white
|
|
2668
|
+
},
|
|
2628
2669
|
data: {
|
|
2629
2670
|
padding,
|
|
2630
2671
|
stroke: gray.white,
|
|
2631
2672
|
strokeWidth: 1
|
|
2632
2673
|
},
|
|
2633
|
-
labels:
|
|
2634
|
-
|
|
2635
|
-
|
|
2674
|
+
labels: {
|
|
2675
|
+
...baseLabelStyles,
|
|
2676
|
+
padding: 20,
|
|
2677
|
+
fill: gray["600"],
|
|
2678
|
+
fontSize: 10
|
|
2679
|
+
}
|
|
2636
2680
|
},
|
|
2637
|
-
colorScale
|
|
2681
|
+
colorScale,
|
|
2638
2682
|
cornerRadius: borderRadius
|
|
2639
2683
|
}, baseProps),
|
|
2640
2684
|
scatter: Object.assign({
|
|
@@ -2645,11 +2689,14 @@ const clean = {
|
|
|
2645
2689
|
stroke: "transparent",
|
|
2646
2690
|
strokeWidth: 0
|
|
2647
2691
|
},
|
|
2648
|
-
labels:
|
|
2692
|
+
labels: {
|
|
2693
|
+
...baseLabelStyles,
|
|
2694
|
+
padding: 20
|
|
2695
|
+
}
|
|
2649
2696
|
}
|
|
2650
2697
|
}, baseProps),
|
|
2651
2698
|
stack: Object.assign({
|
|
2652
|
-
colorScale
|
|
2699
|
+
colorScale
|
|
2653
2700
|
}, baseProps),
|
|
2654
2701
|
tooltip: {
|
|
2655
2702
|
style: Object.assign({}, baseLabelStyles, {
|
|
@@ -2657,7 +2704,7 @@ const clean = {
|
|
|
2657
2704
|
pointerEvents: "none"
|
|
2658
2705
|
}),
|
|
2659
2706
|
flyoutStyle: {
|
|
2660
|
-
stroke: gray["
|
|
2707
|
+
stroke: gray["300"],
|
|
2661
2708
|
strokeWidth: 2,
|
|
2662
2709
|
fill: gray.white,
|
|
2663
2710
|
pointerEvents: "none"
|
|
@@ -2674,9 +2721,10 @@ const clean = {
|
|
|
2674
2721
|
voronoi: Object.assign({
|
|
2675
2722
|
style: {
|
|
2676
2723
|
data: {
|
|
2677
|
-
fill:
|
|
2678
|
-
stroke:
|
|
2679
|
-
strokeWidth: 2
|
|
2724
|
+
fill: blue["100"],
|
|
2725
|
+
stroke: blue["500"],
|
|
2726
|
+
strokeWidth: 2,
|
|
2727
|
+
opacity: 0.4
|
|
2680
2728
|
},
|
|
2681
2729
|
labels: Object.assign({}, baseLabelStyles, {
|
|
2682
2730
|
padding: 5,
|
|
@@ -2712,9 +2760,28 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2712
2760
|
// *
|
|
2713
2761
|
// * Colors
|
|
2714
2762
|
// *
|
|
2715
|
-
const colors =
|
|
2763
|
+
const colors = {
|
|
2764
|
+
blue: "#4F7DA1",
|
|
2765
|
+
pink: "#E2A37F",
|
|
2766
|
+
teal: "#00796B",
|
|
2767
|
+
purple: "#DF948A",
|
|
2768
|
+
green: "#8BC34A",
|
|
2769
|
+
orange: "#F4511E",
|
|
2770
|
+
cyan: "#006064",
|
|
2771
|
+
red: "#DF5A49",
|
|
2772
|
+
yellow: "#FFF59D"
|
|
2773
|
+
};
|
|
2774
|
+
const colorScale = ["#252525", "#525252", "#737373", "#969696", "#bdbdbd", "#d9d9d9", "#f0f0f0"];
|
|
2716
2775
|
const charcoal = "#252525";
|
|
2717
2776
|
const grey = "#969696";
|
|
2777
|
+
const qualitative = ["#334D5C", "#45B29D", "#EFC94C", "#E27A3F", "#DF5A49", "#4F7DA1", "#55DBC1", "#EFDA97", "#E2A37F", "#DF948A"];
|
|
2778
|
+
const heatmap = ["#428517", "#77D200", "#D6D305", "#EC8E19", "#C92B05"];
|
|
2779
|
+
const warm = ["#940031", "#C43343", "#DC5429", "#FF821D", "#FFAF55"];
|
|
2780
|
+
const cool = ["#2746B9", "#0B69D4", "#2794DB", "#31BB76", "#60E83B"];
|
|
2781
|
+
const red = ["#FCAE91", "#FB6A4A", "#DE2D26", "#A50F15", "#750B0E"];
|
|
2782
|
+
const green = ["#354722", "#466631", "#649146", "#8AB25C", "#A9C97E"];
|
|
2783
|
+
const blue = ["#002C61", "#004B8F", "#006BC9", "#3795E5", "#65B4F4"];
|
|
2784
|
+
|
|
2718
2785
|
// *
|
|
2719
2786
|
// * Typography
|
|
2720
2787
|
// *
|
|
@@ -2728,7 +2795,7 @@ const baseProps = {
|
|
|
2728
2795
|
width: 450,
|
|
2729
2796
|
height: 300,
|
|
2730
2797
|
padding: 50,
|
|
2731
|
-
colorScale
|
|
2798
|
+
colorScale
|
|
2732
2799
|
};
|
|
2733
2800
|
// *
|
|
2734
2801
|
// * Labels
|
|
@@ -2750,6 +2817,17 @@ const centeredLabelStyles = Object.assign({
|
|
|
2750
2817
|
const strokeLinecap = "round";
|
|
2751
2818
|
const strokeLinejoin = "round";
|
|
2752
2819
|
const grayscale = {
|
|
2820
|
+
palette: {
|
|
2821
|
+
colors,
|
|
2822
|
+
grayscale: colorScale,
|
|
2823
|
+
qualitative,
|
|
2824
|
+
heatmap,
|
|
2825
|
+
warm,
|
|
2826
|
+
cool,
|
|
2827
|
+
red,
|
|
2828
|
+
green,
|
|
2829
|
+
blue
|
|
2830
|
+
},
|
|
2753
2831
|
area: Object.assign({
|
|
2754
2832
|
style: {
|
|
2755
2833
|
data: {
|
|
@@ -2864,7 +2942,7 @@ const grayscale = {
|
|
|
2864
2942
|
}
|
|
2865
2943
|
}, baseProps),
|
|
2866
2944
|
group: Object.assign({
|
|
2867
|
-
colorScale
|
|
2945
|
+
colorScale
|
|
2868
2946
|
}, baseProps),
|
|
2869
2947
|
histogram: Object.assign({
|
|
2870
2948
|
style: {
|
|
@@ -2877,7 +2955,7 @@ const grayscale = {
|
|
|
2877
2955
|
}
|
|
2878
2956
|
}, baseProps),
|
|
2879
2957
|
legend: {
|
|
2880
|
-
colorScale
|
|
2958
|
+
colorScale,
|
|
2881
2959
|
gutter: 10,
|
|
2882
2960
|
orientation: "vertical",
|
|
2883
2961
|
titleOrientation: "top",
|
|
@@ -2912,7 +2990,7 @@ const grayscale = {
|
|
|
2912
2990
|
padding: 20
|
|
2913
2991
|
})
|
|
2914
2992
|
},
|
|
2915
|
-
colorScale
|
|
2993
|
+
colorScale,
|
|
2916
2994
|
width: 400,
|
|
2917
2995
|
height: 400,
|
|
2918
2996
|
padding: 50
|
|
@@ -2928,7 +3006,7 @@ const grayscale = {
|
|
|
2928
3006
|
}
|
|
2929
3007
|
}, baseProps),
|
|
2930
3008
|
stack: Object.assign({
|
|
2931
|
-
colorScale
|
|
3009
|
+
colorScale
|
|
2932
3010
|
}, baseProps),
|
|
2933
3011
|
tooltip: {
|
|
2934
3012
|
style: Object.assign({}, baseLabelStyles, {
|
|
@@ -2988,11 +3066,31 @@ const lime300 = "#DCE775";
|
|
|
2988
3066
|
const lightGreen500 = "#8BC34A";
|
|
2989
3067
|
const teal700 = "#00796B";
|
|
2990
3068
|
const cyan900 = "#006064";
|
|
2991
|
-
const
|
|
3069
|
+
const colorScale = [deepOrange600, yellow200, lime300, lightGreen500, teal700, cyan900];
|
|
2992
3070
|
const blueGrey50 = "#ECEFF1";
|
|
2993
3071
|
const blueGrey300 = "#90A4AE";
|
|
2994
3072
|
const blueGrey700 = "#455A64";
|
|
2995
3073
|
const grey900 = "#212121";
|
|
3074
|
+
const colors = {
|
|
3075
|
+
blue: "#4F7DA1",
|
|
3076
|
+
pink: "#E2A37F",
|
|
3077
|
+
teal: teal700,
|
|
3078
|
+
purple: "#DF948A",
|
|
3079
|
+
green: lightGreen500,
|
|
3080
|
+
orange: deepOrange600,
|
|
3081
|
+
cyan: cyan900,
|
|
3082
|
+
red: "#DF5A49",
|
|
3083
|
+
yellow: yellow200
|
|
3084
|
+
};
|
|
3085
|
+
const grayscale = [blueGrey50, blueGrey300, blueGrey700, grey900];
|
|
3086
|
+
const qualitative = ["#334D5C", "#45B29D", "#EFC94C", "#E27A3F", "#DF5A49", "#4F7DA1", "#55DBC1", "#EFDA97", "#E2A37F", "#DF948A"];
|
|
3087
|
+
const heatmap = ["#428517", "#77D200", "#D6D305", "#EC8E19", "#C92B05"];
|
|
3088
|
+
const warm = ["#940031", "#C43343", "#DC5429", "#FF821D", "#FFAF55"];
|
|
3089
|
+
const cool = ["#2746B9", "#0B69D4", "#2794DB", "#31BB76", "#60E83B"];
|
|
3090
|
+
const red = ["#FCAE91", "#FB6A4A", "#DE2D26", "#A50F15", "#750B0E"];
|
|
3091
|
+
const green = ["#354722", "#466631", "#649146", "#8AB25C", "#A9C97E"];
|
|
3092
|
+
const blue = ["#002C61", "#004B8F", "#006BC9", "#3795E5", "#65B4F4"];
|
|
3093
|
+
|
|
2996
3094
|
// *
|
|
2997
3095
|
// * Typography
|
|
2998
3096
|
// *
|
|
@@ -3030,6 +3128,17 @@ const strokeDasharray = "10, 5";
|
|
|
3030
3128
|
const strokeLinecap = "round";
|
|
3031
3129
|
const strokeLinejoin = "round";
|
|
3032
3130
|
const material = {
|
|
3131
|
+
palette: {
|
|
3132
|
+
colors,
|
|
3133
|
+
grayscale,
|
|
3134
|
+
qualitative,
|
|
3135
|
+
heatmap,
|
|
3136
|
+
warm,
|
|
3137
|
+
cool,
|
|
3138
|
+
red,
|
|
3139
|
+
green,
|
|
3140
|
+
blue
|
|
3141
|
+
},
|
|
3033
3142
|
area: Object.assign({
|
|
3034
3143
|
style: {
|
|
3035
3144
|
data: {
|
|
@@ -3162,7 +3271,7 @@ const material = {
|
|
|
3162
3271
|
}
|
|
3163
3272
|
}, baseProps),
|
|
3164
3273
|
group: Object.assign({
|
|
3165
|
-
colorScale
|
|
3274
|
+
colorScale
|
|
3166
3275
|
}, baseProps),
|
|
3167
3276
|
histogram: Object.assign({
|
|
3168
3277
|
style: {
|
|
@@ -3175,7 +3284,7 @@ const material = {
|
|
|
3175
3284
|
}
|
|
3176
3285
|
}, baseProps),
|
|
3177
3286
|
legend: {
|
|
3178
|
-
colorScale
|
|
3287
|
+
colorScale,
|
|
3179
3288
|
gutter: 10,
|
|
3180
3289
|
orientation: "vertical",
|
|
3181
3290
|
titleOrientation: "top",
|
|
@@ -3201,7 +3310,7 @@ const material = {
|
|
|
3201
3310
|
}
|
|
3202
3311
|
}, baseProps),
|
|
3203
3312
|
pie: Object.assign({
|
|
3204
|
-
colorScale
|
|
3313
|
+
colorScale,
|
|
3205
3314
|
style: {
|
|
3206
3315
|
data: {
|
|
3207
3316
|
padding,
|
|
@@ -3225,7 +3334,7 @@ const material = {
|
|
|
3225
3334
|
}
|
|
3226
3335
|
}, baseProps),
|
|
3227
3336
|
stack: Object.assign({
|
|
3228
|
-
colorScale
|
|
3337
|
+
colorScale
|
|
3229
3338
|
}, baseProps),
|
|
3230
3339
|
tooltip: {
|
|
3231
3340
|
style: Object.assign({}, baseLabelStyles, {
|
|
@@ -7173,6 +7282,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7173
7282
|
/* harmony export */ "getColorScale": function() { return /* binding */ getColorScale; },
|
|
7174
7283
|
/* harmony export */ "toTransformString": function() { return /* binding */ toTransformString; }
|
|
7175
7284
|
/* harmony export */ });
|
|
7285
|
+
/* harmony import */ var _victory_theme_victory_theme__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../victory-theme/victory-theme */ "./victory-theme/victory-theme.tsx");
|
|
7286
|
+
|
|
7287
|
+
|
|
7176
7288
|
/**
|
|
7177
7289
|
* Given an object with CSS/SVG transform definitions, return the string value
|
|
7178
7290
|
* for use with the `transform` CSS property or SVG attribute. Note that we
|
|
@@ -7209,20 +7321,37 @@ const toTransformString = function (obj) {
|
|
|
7209
7321
|
* of 5 hex string values in that color scale. If no 'name' parameter
|
|
7210
7322
|
* is given, it will return the Victory default grayscale.
|
|
7211
7323
|
* @param {String} name The name of the color scale to return (optional).
|
|
7324
|
+
* @param {Object} theme The theme object to retrieve the color scale from (optional).
|
|
7212
7325
|
* @returns {Array} An array of 5 hex string values composing a color scale.
|
|
7213
7326
|
*/
|
|
7214
|
-
function getColorScale(name) {
|
|
7327
|
+
function getColorScale(name, theme) {
|
|
7328
|
+
if (theme === void 0) {
|
|
7329
|
+
theme = _victory_theme_victory_theme__WEBPACK_IMPORTED_MODULE_0__.VictoryTheme.material;
|
|
7330
|
+
}
|
|
7331
|
+
const {
|
|
7332
|
+
palette: {
|
|
7333
|
+
grayscale = ["#cccccc", "#969696", "#636363", "#252525"],
|
|
7334
|
+
qualitative = [],
|
|
7335
|
+
heatmap = [],
|
|
7336
|
+
warm = [],
|
|
7337
|
+
cool = [],
|
|
7338
|
+
red = [],
|
|
7339
|
+
blue = [],
|
|
7340
|
+
green = []
|
|
7341
|
+
} = {}
|
|
7342
|
+
} = theme;
|
|
7215
7343
|
const scales = {
|
|
7216
|
-
grayscale
|
|
7217
|
-
qualitative
|
|
7218
|
-
heatmap
|
|
7219
|
-
warm
|
|
7220
|
-
cool
|
|
7221
|
-
red
|
|
7222
|
-
blue
|
|
7223
|
-
green
|
|
7344
|
+
grayscale,
|
|
7345
|
+
qualitative,
|
|
7346
|
+
heatmap,
|
|
7347
|
+
warm,
|
|
7348
|
+
cool,
|
|
7349
|
+
red,
|
|
7350
|
+
blue,
|
|
7351
|
+
green
|
|
7224
7352
|
};
|
|
7225
|
-
|
|
7353
|
+
const selectedScale = name && scales[name]?.length ? scales[name] : scales.grayscale;
|
|
7354
|
+
return selectedScale;
|
|
7226
7355
|
}
|
|
7227
7356
|
|
|
7228
7357
|
/***/ }),
|
|
@@ -8464,7 +8593,9 @@ function getAllEvents(props) {
|
|
|
8464
8593
|
}
|
|
8465
8594
|
return events || [];
|
|
8466
8595
|
}
|
|
8467
|
-
|
|
8596
|
+
|
|
8597
|
+
// eslint-disable-next-line max-params
|
|
8598
|
+
function getColor(calculatedProps, child, index, theme) {
|
|
8468
8599
|
// check for styles first
|
|
8469
8600
|
const {
|
|
8470
8601
|
style
|
|
@@ -8481,14 +8612,16 @@ function getColor(calculatedProps, child, index) {
|
|
|
8481
8612
|
if (!colorScale && !color) {
|
|
8482
8613
|
return undefined;
|
|
8483
8614
|
}
|
|
8484
|
-
const colors = Array.isArray(colorScale) ? colorScale : _style__WEBPACK_IMPORTED_MODULE_13__.getColorScale(colorScale);
|
|
8615
|
+
const colors = Array.isArray(colorScale) ? colorScale : _style__WEBPACK_IMPORTED_MODULE_13__.getColorScale(colorScale, theme);
|
|
8485
8616
|
return color || colors[index % colors.length];
|
|
8486
8617
|
}
|
|
8487
8618
|
function getStyle(theme, style, role) {
|
|
8488
8619
|
const defaultStyle = theme && theme[role] && theme[role].style ? theme[role].style : {};
|
|
8489
8620
|
return _helpers__WEBPACK_IMPORTED_MODULE_7__.getStyles(style, defaultStyle);
|
|
8490
8621
|
}
|
|
8491
|
-
|
|
8622
|
+
|
|
8623
|
+
// eslint-disable-next-line max-params
|
|
8624
|
+
function getChildStyle(child, index, calculatedProps, theme) {
|
|
8492
8625
|
const {
|
|
8493
8626
|
style,
|
|
8494
8627
|
role
|
|
@@ -8498,7 +8631,7 @@ function getChildStyle(child, index, calculatedProps) {
|
|
|
8498
8631
|
return childStyle;
|
|
8499
8632
|
}
|
|
8500
8633
|
const childRole = child.type && child.type.role;
|
|
8501
|
-
const defaultFill = childRole === "stack" ? undefined : getColor(calculatedProps, child, index);
|
|
8634
|
+
const defaultFill = childRole === "stack" ? undefined : getColor(calculatedProps, child, index, theme);
|
|
8502
8635
|
const defaultColor = childRole === "line" ? {
|
|
8503
8636
|
fill: "none",
|
|
8504
8637
|
stroke: defaultFill
|