victory-core 37.1.2 → 37.3.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 +24 -0
- package/dist/victory-core.js +293 -168
- package/dist/victory-core.min.js +1 -1
- package/es/types/prop-types.d.ts +1 -0
- package/es/victory-portal/victory-portal.js +3 -2
- package/es/victory-theme/clean.js +86 -44
- 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 +3 -3
- package/es/victory-util/wrapper.js +16 -15
- package/lib/types/prop-types.d.ts +1 -0
- package/lib/victory-portal/victory-portal.js +3 -2
- package/lib/victory-theme/clean.js +86 -44
- 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 +3 -3
- package/lib/victory-util/wrapper.js +17 -16
- package/package.json +2 -2
- package/src/types/prop-types.ts +1 -0
- package/src/victory-portal/victory-portal.tsx +3 -3
- package/src/victory-theme/clean.tsx +104 -45
- 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 +18 -27
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] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(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
|
}, []);
|
|
@@ -2311,20 +2314,16 @@ const orange = {
|
|
|
2311
2314
|
"100": "#FEE2D5",
|
|
2312
2315
|
"300": "#FFA981",
|
|
2313
2316
|
"500": "#FF6F2C",
|
|
2317
|
+
"700": "#FF4E1B",
|
|
2314
2318
|
"900": "#D74D26"
|
|
2315
2319
|
};
|
|
2316
2320
|
const red = {
|
|
2317
2321
|
"100": "#FFDCE5",
|
|
2318
2322
|
"300": "#FF9EB7",
|
|
2319
2323
|
"500": "#F82B60",
|
|
2324
|
+
"700": "#D31A3D",
|
|
2320
2325
|
"900": "#BA1E45"
|
|
2321
2326
|
};
|
|
2322
|
-
const pink = {
|
|
2323
|
-
"100": "#FFDAF6",
|
|
2324
|
-
"300": "#F99DE2",
|
|
2325
|
-
"500": "#FF08C2",
|
|
2326
|
-
"900": "#B2158B"
|
|
2327
|
-
};
|
|
2328
2327
|
const purple = {
|
|
2329
2328
|
"100": "#EDE3FE",
|
|
2330
2329
|
"300": "#CDB0FF",
|
|
@@ -2335,6 +2334,7 @@ const blue = {
|
|
|
2335
2334
|
"100": "#CFDFFF",
|
|
2336
2335
|
"300": "#9CC7FF",
|
|
2337
2336
|
"500": "#2D7FF9",
|
|
2337
|
+
"700": "#0056B3",
|
|
2338
2338
|
"900": "#2750AE"
|
|
2339
2339
|
};
|
|
2340
2340
|
const cyan = {
|
|
@@ -2353,9 +2353,29 @@ const green = {
|
|
|
2353
2353
|
"100": "#D1F7C4",
|
|
2354
2354
|
"300": "#93E088",
|
|
2355
2355
|
"500": "#20C933",
|
|
2356
|
+
"700": "#1B9B2A",
|
|
2356
2357
|
"900": "#338A17"
|
|
2357
2358
|
};
|
|
2358
|
-
const colors =
|
|
2359
|
+
const colors = {
|
|
2360
|
+
blue: blue["500"],
|
|
2361
|
+
cyan: cyan["500"],
|
|
2362
|
+
green: green["500"],
|
|
2363
|
+
yellow: yellow["500"],
|
|
2364
|
+
orange: orange["500"],
|
|
2365
|
+
red: red["500"],
|
|
2366
|
+
purple: purple["500"],
|
|
2367
|
+
teal: teal["500"]
|
|
2368
|
+
};
|
|
2369
|
+
const colorScale = Object.values(colors);
|
|
2370
|
+
const grayscale = [gray["100"], gray["300"], gray["500"], gray["700"], gray["900"]];
|
|
2371
|
+
const warm = [yellow["300"], yellow["500"], orange["500"], orange["900"], red["500"]];
|
|
2372
|
+
const cool = [purple["500"], blue["500"], cyan["500"], teal["500"], green["500"]];
|
|
2373
|
+
const heatmap = [green["900"], green["500"], yellow["500"], orange["500"], red["500"]];
|
|
2374
|
+
const redPalette = Object.values(red);
|
|
2375
|
+
const greenPalette = Object.values(green);
|
|
2376
|
+
const bluePalette = Object.values(blue);
|
|
2377
|
+
const defaultColor = blue["500"];
|
|
2378
|
+
|
|
2359
2379
|
// *
|
|
2360
2380
|
// * Typography
|
|
2361
2381
|
// *
|
|
@@ -2369,8 +2389,8 @@ const padding = 8;
|
|
|
2369
2389
|
const baseProps = {
|
|
2370
2390
|
width: 450,
|
|
2371
2391
|
height: 300,
|
|
2372
|
-
padding:
|
|
2373
|
-
colorScale
|
|
2392
|
+
padding: 60,
|
|
2393
|
+
colorScale
|
|
2374
2394
|
};
|
|
2375
2395
|
// *
|
|
2376
2396
|
// * Labels
|
|
@@ -2399,10 +2419,23 @@ const borderRadius = 1;
|
|
|
2399
2419
|
// * Theme
|
|
2400
2420
|
// *
|
|
2401
2421
|
const clean = {
|
|
2422
|
+
palette: {
|
|
2423
|
+
colors,
|
|
2424
|
+
grayscale,
|
|
2425
|
+
qualitative: colorScale,
|
|
2426
|
+
heatmap,
|
|
2427
|
+
warm,
|
|
2428
|
+
cool,
|
|
2429
|
+
red: redPalette,
|
|
2430
|
+
green: greenPalette,
|
|
2431
|
+
blue: bluePalette
|
|
2432
|
+
},
|
|
2402
2433
|
area: Object.assign({
|
|
2403
2434
|
style: {
|
|
2404
2435
|
data: {
|
|
2405
|
-
fill:
|
|
2436
|
+
fill: defaultColor,
|
|
2437
|
+
strokeWidth: 2,
|
|
2438
|
+
fillOpacity: 0.5
|
|
2406
2439
|
},
|
|
2407
2440
|
labels: baseLabelStyles
|
|
2408
2441
|
}
|
|
@@ -2411,13 +2444,13 @@ const clean = {
|
|
|
2411
2444
|
style: {
|
|
2412
2445
|
axis: {
|
|
2413
2446
|
fill: "transparent",
|
|
2414
|
-
stroke: gray["
|
|
2447
|
+
stroke: gray["500"],
|
|
2415
2448
|
strokeWidth: 1,
|
|
2416
2449
|
strokeLinecap,
|
|
2417
2450
|
strokeLinejoin
|
|
2418
2451
|
},
|
|
2419
2452
|
axisLabel: Object.assign({}, centeredLabelStyles, {
|
|
2420
|
-
padding,
|
|
2453
|
+
padding: 35,
|
|
2421
2454
|
stroke: "transparent"
|
|
2422
2455
|
}),
|
|
2423
2456
|
grid: {
|
|
@@ -2436,10 +2469,10 @@ const clean = {
|
|
|
2436
2469
|
polarAxis: Object.assign({
|
|
2437
2470
|
style: {
|
|
2438
2471
|
axis: {
|
|
2439
|
-
stroke: gray["
|
|
2472
|
+
stroke: gray["500"]
|
|
2440
2473
|
},
|
|
2441
2474
|
grid: {
|
|
2442
|
-
stroke: gray["
|
|
2475
|
+
stroke: gray["400"],
|
|
2443
2476
|
strokeDasharray,
|
|
2444
2477
|
strokeLinecap,
|
|
2445
2478
|
strokeLinejoin,
|
|
@@ -2448,7 +2481,7 @@ const clean = {
|
|
|
2448
2481
|
ticks: {
|
|
2449
2482
|
fill: "transparent",
|
|
2450
2483
|
size: 5,
|
|
2451
|
-
stroke: gray["
|
|
2484
|
+
stroke: gray["400"],
|
|
2452
2485
|
strokeWidth: 1,
|
|
2453
2486
|
strokeLinecap,
|
|
2454
2487
|
strokeLinejoin
|
|
@@ -2459,10 +2492,10 @@ const clean = {
|
|
|
2459
2492
|
polarDependentAxis: Object.assign({
|
|
2460
2493
|
style: {
|
|
2461
2494
|
axis: {
|
|
2462
|
-
stroke: gray["
|
|
2495
|
+
stroke: gray["500"]
|
|
2463
2496
|
},
|
|
2464
2497
|
grid: {
|
|
2465
|
-
stroke: gray["
|
|
2498
|
+
stroke: gray["400"],
|
|
2466
2499
|
strokeDasharray,
|
|
2467
2500
|
strokeLinecap,
|
|
2468
2501
|
strokeLinejoin,
|
|
@@ -2471,7 +2504,7 @@ const clean = {
|
|
|
2471
2504
|
ticks: {
|
|
2472
2505
|
fill: "transparent",
|
|
2473
2506
|
size: 5,
|
|
2474
|
-
stroke: gray["
|
|
2507
|
+
stroke: gray["300"],
|
|
2475
2508
|
strokeWidth: 1,
|
|
2476
2509
|
strokeLinecap,
|
|
2477
2510
|
strokeLinejoin
|
|
@@ -2482,9 +2515,10 @@ const clean = {
|
|
|
2482
2515
|
bar: Object.assign({
|
|
2483
2516
|
style: {
|
|
2484
2517
|
data: {
|
|
2485
|
-
fill:
|
|
2518
|
+
fill: defaultColor,
|
|
2486
2519
|
padding,
|
|
2487
|
-
strokeWidth:
|
|
2520
|
+
strokeWidth: 1,
|
|
2521
|
+
fillOpacity: 0.5
|
|
2488
2522
|
},
|
|
2489
2523
|
labels: baseLabelStyles
|
|
2490
2524
|
},
|
|
@@ -2520,15 +2554,16 @@ const clean = {
|
|
|
2520
2554
|
}),
|
|
2521
2555
|
q1: {
|
|
2522
2556
|
padding,
|
|
2523
|
-
fill:
|
|
2524
|
-
rx: borderRadius
|
|
2557
|
+
fill: colorScale[0],
|
|
2558
|
+
rx: borderRadius,
|
|
2559
|
+
strokeWidth: 2
|
|
2525
2560
|
},
|
|
2526
2561
|
q1Labels: Object.assign({}, baseLabelStyles, {
|
|
2527
2562
|
padding: 3
|
|
2528
2563
|
}),
|
|
2529
2564
|
q3: {
|
|
2530
2565
|
padding,
|
|
2531
|
-
fill:
|
|
2566
|
+
fill: colorScale[1],
|
|
2532
2567
|
rx: borderRadius
|
|
2533
2568
|
},
|
|
2534
2569
|
q3Labels: Object.assign({}, baseLabelStyles, {
|
|
@@ -2549,8 +2584,8 @@ const clean = {
|
|
|
2549
2584
|
})
|
|
2550
2585
|
},
|
|
2551
2586
|
candleColors: {
|
|
2552
|
-
positive:
|
|
2553
|
-
negative:
|
|
2587
|
+
positive: green["500"],
|
|
2588
|
+
negative: red["500"]
|
|
2554
2589
|
},
|
|
2555
2590
|
wickStrokeWidth: 2
|
|
2556
2591
|
}, baseProps),
|
|
@@ -2569,14 +2604,13 @@ const clean = {
|
|
|
2569
2604
|
}
|
|
2570
2605
|
}, baseProps),
|
|
2571
2606
|
group: Object.assign({
|
|
2572
|
-
colorScale
|
|
2607
|
+
colorScale
|
|
2573
2608
|
}, baseProps),
|
|
2574
2609
|
histogram: Object.assign({
|
|
2575
2610
|
style: {
|
|
2576
2611
|
data: {
|
|
2577
2612
|
fill: cyan["500"],
|
|
2578
|
-
|
|
2579
|
-
strokeWidth: 0
|
|
2613
|
+
fillOpacity: 0.5
|
|
2580
2614
|
},
|
|
2581
2615
|
labels: baseLabelStyles
|
|
2582
2616
|
},
|
|
@@ -2587,21 +2621,23 @@ const clean = {
|
|
|
2587
2621
|
}, baseProps),
|
|
2588
2622
|
label: baseLabelStyles,
|
|
2589
2623
|
legend: {
|
|
2590
|
-
colorScale
|
|
2591
|
-
gutter:
|
|
2592
|
-
|
|
2624
|
+
colorScale,
|
|
2625
|
+
gutter: 24,
|
|
2626
|
+
borderPadding: 10,
|
|
2627
|
+
orientation: "horizontal",
|
|
2593
2628
|
titleOrientation: "top",
|
|
2629
|
+
centerTitle: true,
|
|
2594
2630
|
style: {
|
|
2595
2631
|
data: {
|
|
2596
2632
|
type: "circle"
|
|
2597
2633
|
},
|
|
2598
2634
|
labels: {
|
|
2599
2635
|
...baseLabelStyles,
|
|
2600
|
-
fontSize:
|
|
2636
|
+
fontSize: 12
|
|
2601
2637
|
},
|
|
2602
2638
|
title: Object.assign({}, baseLabelStyles, {
|
|
2603
2639
|
padding,
|
|
2604
|
-
fontSize:
|
|
2640
|
+
fontSize: 16
|
|
2605
2641
|
}),
|
|
2606
2642
|
border: {
|
|
2607
2643
|
stroke: gray["200"],
|
|
@@ -2615,7 +2651,7 @@ const clean = {
|
|
|
2615
2651
|
data: {
|
|
2616
2652
|
fill: "transparent",
|
|
2617
2653
|
opacity: 1,
|
|
2618
|
-
stroke:
|
|
2654
|
+
stroke: defaultColor,
|
|
2619
2655
|
strokeWidth: 2,
|
|
2620
2656
|
strokeLinecap,
|
|
2621
2657
|
strokeLinejoin
|
|
@@ -2625,31 +2661,40 @@ const clean = {
|
|
|
2625
2661
|
}, baseProps),
|
|
2626
2662
|
pie: Object.assign({
|
|
2627
2663
|
style: {
|
|
2664
|
+
parent: {
|
|
2665
|
+
backgroundColor: gray.white
|
|
2666
|
+
},
|
|
2628
2667
|
data: {
|
|
2629
2668
|
padding,
|
|
2630
2669
|
stroke: gray.white,
|
|
2631
2670
|
strokeWidth: 1
|
|
2632
2671
|
},
|
|
2633
|
-
labels:
|
|
2634
|
-
|
|
2635
|
-
|
|
2672
|
+
labels: {
|
|
2673
|
+
...baseLabelStyles,
|
|
2674
|
+
padding: 20,
|
|
2675
|
+
fill: gray["600"],
|
|
2676
|
+
fontSize: 10
|
|
2677
|
+
}
|
|
2636
2678
|
},
|
|
2637
|
-
colorScale
|
|
2679
|
+
colorScale,
|
|
2638
2680
|
cornerRadius: borderRadius
|
|
2639
2681
|
}, baseProps),
|
|
2640
2682
|
scatter: Object.assign({
|
|
2641
2683
|
style: {
|
|
2642
2684
|
data: {
|
|
2643
|
-
fill:
|
|
2685
|
+
fill: defaultColor,
|
|
2644
2686
|
opacity: 1,
|
|
2645
2687
|
stroke: "transparent",
|
|
2646
2688
|
strokeWidth: 0
|
|
2647
2689
|
},
|
|
2648
|
-
labels:
|
|
2690
|
+
labels: {
|
|
2691
|
+
...baseLabelStyles,
|
|
2692
|
+
padding: 20
|
|
2693
|
+
}
|
|
2649
2694
|
}
|
|
2650
2695
|
}, baseProps),
|
|
2651
2696
|
stack: Object.assign({
|
|
2652
|
-
colorScale
|
|
2697
|
+
colorScale
|
|
2653
2698
|
}, baseProps),
|
|
2654
2699
|
tooltip: {
|
|
2655
2700
|
style: Object.assign({}, baseLabelStyles, {
|
|
@@ -2657,7 +2702,7 @@ const clean = {
|
|
|
2657
2702
|
pointerEvents: "none"
|
|
2658
2703
|
}),
|
|
2659
2704
|
flyoutStyle: {
|
|
2660
|
-
stroke: gray["
|
|
2705
|
+
stroke: gray["300"],
|
|
2661
2706
|
strokeWidth: 2,
|
|
2662
2707
|
fill: gray.white,
|
|
2663
2708
|
pointerEvents: "none"
|
|
@@ -2674,8 +2719,8 @@ const clean = {
|
|
|
2674
2719
|
voronoi: Object.assign({
|
|
2675
2720
|
style: {
|
|
2676
2721
|
data: {
|
|
2677
|
-
fill:
|
|
2678
|
-
stroke:
|
|
2722
|
+
fill: blue["100"],
|
|
2723
|
+
stroke: defaultColor,
|
|
2679
2724
|
strokeWidth: 2
|
|
2680
2725
|
},
|
|
2681
2726
|
labels: Object.assign({}, baseLabelStyles, {
|
|
@@ -2712,9 +2757,28 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2712
2757
|
// *
|
|
2713
2758
|
// * Colors
|
|
2714
2759
|
// *
|
|
2715
|
-
const colors =
|
|
2760
|
+
const colors = {
|
|
2761
|
+
blue: "#4F7DA1",
|
|
2762
|
+
pink: "#E2A37F",
|
|
2763
|
+
teal: "#00796B",
|
|
2764
|
+
purple: "#DF948A",
|
|
2765
|
+
green: "#8BC34A",
|
|
2766
|
+
orange: "#F4511E",
|
|
2767
|
+
cyan: "#006064",
|
|
2768
|
+
red: "#DF5A49",
|
|
2769
|
+
yellow: "#FFF59D"
|
|
2770
|
+
};
|
|
2771
|
+
const colorScale = ["#252525", "#525252", "#737373", "#969696", "#bdbdbd", "#d9d9d9", "#f0f0f0"];
|
|
2716
2772
|
const charcoal = "#252525";
|
|
2717
2773
|
const grey = "#969696";
|
|
2774
|
+
const qualitative = ["#334D5C", "#45B29D", "#EFC94C", "#E27A3F", "#DF5A49", "#4F7DA1", "#55DBC1", "#EFDA97", "#E2A37F", "#DF948A"];
|
|
2775
|
+
const heatmap = ["#428517", "#77D200", "#D6D305", "#EC8E19", "#C92B05"];
|
|
2776
|
+
const warm = ["#940031", "#C43343", "#DC5429", "#FF821D", "#FFAF55"];
|
|
2777
|
+
const cool = ["#2746B9", "#0B69D4", "#2794DB", "#31BB76", "#60E83B"];
|
|
2778
|
+
const red = ["#FCAE91", "#FB6A4A", "#DE2D26", "#A50F15", "#750B0E"];
|
|
2779
|
+
const green = ["#354722", "#466631", "#649146", "#8AB25C", "#A9C97E"];
|
|
2780
|
+
const blue = ["#002C61", "#004B8F", "#006BC9", "#3795E5", "#65B4F4"];
|
|
2781
|
+
|
|
2718
2782
|
// *
|
|
2719
2783
|
// * Typography
|
|
2720
2784
|
// *
|
|
@@ -2728,7 +2792,7 @@ const baseProps = {
|
|
|
2728
2792
|
width: 450,
|
|
2729
2793
|
height: 300,
|
|
2730
2794
|
padding: 50,
|
|
2731
|
-
colorScale
|
|
2795
|
+
colorScale
|
|
2732
2796
|
};
|
|
2733
2797
|
// *
|
|
2734
2798
|
// * Labels
|
|
@@ -2750,6 +2814,17 @@ const centeredLabelStyles = Object.assign({
|
|
|
2750
2814
|
const strokeLinecap = "round";
|
|
2751
2815
|
const strokeLinejoin = "round";
|
|
2752
2816
|
const grayscale = {
|
|
2817
|
+
palette: {
|
|
2818
|
+
colors,
|
|
2819
|
+
grayscale: colorScale,
|
|
2820
|
+
qualitative,
|
|
2821
|
+
heatmap,
|
|
2822
|
+
warm,
|
|
2823
|
+
cool,
|
|
2824
|
+
red,
|
|
2825
|
+
green,
|
|
2826
|
+
blue
|
|
2827
|
+
},
|
|
2753
2828
|
area: Object.assign({
|
|
2754
2829
|
style: {
|
|
2755
2830
|
data: {
|
|
@@ -2864,7 +2939,7 @@ const grayscale = {
|
|
|
2864
2939
|
}
|
|
2865
2940
|
}, baseProps),
|
|
2866
2941
|
group: Object.assign({
|
|
2867
|
-
colorScale
|
|
2942
|
+
colorScale
|
|
2868
2943
|
}, baseProps),
|
|
2869
2944
|
histogram: Object.assign({
|
|
2870
2945
|
style: {
|
|
@@ -2877,7 +2952,7 @@ const grayscale = {
|
|
|
2877
2952
|
}
|
|
2878
2953
|
}, baseProps),
|
|
2879
2954
|
legend: {
|
|
2880
|
-
colorScale
|
|
2955
|
+
colorScale,
|
|
2881
2956
|
gutter: 10,
|
|
2882
2957
|
orientation: "vertical",
|
|
2883
2958
|
titleOrientation: "top",
|
|
@@ -2912,7 +2987,7 @@ const grayscale = {
|
|
|
2912
2987
|
padding: 20
|
|
2913
2988
|
})
|
|
2914
2989
|
},
|
|
2915
|
-
colorScale
|
|
2990
|
+
colorScale,
|
|
2916
2991
|
width: 400,
|
|
2917
2992
|
height: 400,
|
|
2918
2993
|
padding: 50
|
|
@@ -2928,7 +3003,7 @@ const grayscale = {
|
|
|
2928
3003
|
}
|
|
2929
3004
|
}, baseProps),
|
|
2930
3005
|
stack: Object.assign({
|
|
2931
|
-
colorScale
|
|
3006
|
+
colorScale
|
|
2932
3007
|
}, baseProps),
|
|
2933
3008
|
tooltip: {
|
|
2934
3009
|
style: Object.assign({}, baseLabelStyles, {
|
|
@@ -2988,11 +3063,31 @@ const lime300 = "#DCE775";
|
|
|
2988
3063
|
const lightGreen500 = "#8BC34A";
|
|
2989
3064
|
const teal700 = "#00796B";
|
|
2990
3065
|
const cyan900 = "#006064";
|
|
2991
|
-
const
|
|
3066
|
+
const colorScale = [deepOrange600, yellow200, lime300, lightGreen500, teal700, cyan900];
|
|
2992
3067
|
const blueGrey50 = "#ECEFF1";
|
|
2993
3068
|
const blueGrey300 = "#90A4AE";
|
|
2994
3069
|
const blueGrey700 = "#455A64";
|
|
2995
3070
|
const grey900 = "#212121";
|
|
3071
|
+
const colors = {
|
|
3072
|
+
blue: "#4F7DA1",
|
|
3073
|
+
pink: "#E2A37F",
|
|
3074
|
+
teal: teal700,
|
|
3075
|
+
purple: "#DF948A",
|
|
3076
|
+
green: lightGreen500,
|
|
3077
|
+
orange: deepOrange600,
|
|
3078
|
+
cyan: cyan900,
|
|
3079
|
+
red: "#DF5A49",
|
|
3080
|
+
yellow: yellow200
|
|
3081
|
+
};
|
|
3082
|
+
const grayscale = [blueGrey50, blueGrey300, blueGrey700, grey900];
|
|
3083
|
+
const qualitative = ["#334D5C", "#45B29D", "#EFC94C", "#E27A3F", "#DF5A49", "#4F7DA1", "#55DBC1", "#EFDA97", "#E2A37F", "#DF948A"];
|
|
3084
|
+
const heatmap = ["#428517", "#77D200", "#D6D305", "#EC8E19", "#C92B05"];
|
|
3085
|
+
const warm = ["#940031", "#C43343", "#DC5429", "#FF821D", "#FFAF55"];
|
|
3086
|
+
const cool = ["#2746B9", "#0B69D4", "#2794DB", "#31BB76", "#60E83B"];
|
|
3087
|
+
const red = ["#FCAE91", "#FB6A4A", "#DE2D26", "#A50F15", "#750B0E"];
|
|
3088
|
+
const green = ["#354722", "#466631", "#649146", "#8AB25C", "#A9C97E"];
|
|
3089
|
+
const blue = ["#002C61", "#004B8F", "#006BC9", "#3795E5", "#65B4F4"];
|
|
3090
|
+
|
|
2996
3091
|
// *
|
|
2997
3092
|
// * Typography
|
|
2998
3093
|
// *
|
|
@@ -3030,6 +3125,17 @@ const strokeDasharray = "10, 5";
|
|
|
3030
3125
|
const strokeLinecap = "round";
|
|
3031
3126
|
const strokeLinejoin = "round";
|
|
3032
3127
|
const material = {
|
|
3128
|
+
palette: {
|
|
3129
|
+
colors,
|
|
3130
|
+
grayscale,
|
|
3131
|
+
qualitative,
|
|
3132
|
+
heatmap,
|
|
3133
|
+
warm,
|
|
3134
|
+
cool,
|
|
3135
|
+
red,
|
|
3136
|
+
green,
|
|
3137
|
+
blue
|
|
3138
|
+
},
|
|
3033
3139
|
area: Object.assign({
|
|
3034
3140
|
style: {
|
|
3035
3141
|
data: {
|
|
@@ -3162,7 +3268,7 @@ const material = {
|
|
|
3162
3268
|
}
|
|
3163
3269
|
}, baseProps),
|
|
3164
3270
|
group: Object.assign({
|
|
3165
|
-
colorScale
|
|
3271
|
+
colorScale
|
|
3166
3272
|
}, baseProps),
|
|
3167
3273
|
histogram: Object.assign({
|
|
3168
3274
|
style: {
|
|
@@ -3175,7 +3281,7 @@ const material = {
|
|
|
3175
3281
|
}
|
|
3176
3282
|
}, baseProps),
|
|
3177
3283
|
legend: {
|
|
3178
|
-
colorScale
|
|
3284
|
+
colorScale,
|
|
3179
3285
|
gutter: 10,
|
|
3180
3286
|
orientation: "vertical",
|
|
3181
3287
|
titleOrientation: "top",
|
|
@@ -3201,7 +3307,7 @@ const material = {
|
|
|
3201
3307
|
}
|
|
3202
3308
|
}, baseProps),
|
|
3203
3309
|
pie: Object.assign({
|
|
3204
|
-
colorScale
|
|
3310
|
+
colorScale,
|
|
3205
3311
|
style: {
|
|
3206
3312
|
data: {
|
|
3207
3313
|
padding,
|
|
@@ -3225,7 +3331,7 @@ const material = {
|
|
|
3225
3331
|
}
|
|
3226
3332
|
}, baseProps),
|
|
3227
3333
|
stack: Object.assign({
|
|
3228
|
-
colorScale
|
|
3334
|
+
colorScale
|
|
3229
3335
|
}, baseProps),
|
|
3230
3336
|
tooltip: {
|
|
3231
3337
|
style: Object.assign({}, baseLabelStyles, {
|
|
@@ -7173,6 +7279,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7173
7279
|
/* harmony export */ "getColorScale": function() { return /* binding */ getColorScale; },
|
|
7174
7280
|
/* harmony export */ "toTransformString": function() { return /* binding */ toTransformString; }
|
|
7175
7281
|
/* harmony export */ });
|
|
7282
|
+
/* harmony import */ var _victory_theme_victory_theme__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../victory-theme/victory-theme */ "./victory-theme/victory-theme.tsx");
|
|
7283
|
+
|
|
7284
|
+
|
|
7176
7285
|
/**
|
|
7177
7286
|
* Given an object with CSS/SVG transform definitions, return the string value
|
|
7178
7287
|
* for use with the `transform` CSS property or SVG attribute. Note that we
|
|
@@ -7209,20 +7318,37 @@ const toTransformString = function (obj) {
|
|
|
7209
7318
|
* of 5 hex string values in that color scale. If no 'name' parameter
|
|
7210
7319
|
* is given, it will return the Victory default grayscale.
|
|
7211
7320
|
* @param {String} name The name of the color scale to return (optional).
|
|
7321
|
+
* @param {Object} theme The theme object to retrieve the color scale from (optional).
|
|
7212
7322
|
* @returns {Array} An array of 5 hex string values composing a color scale.
|
|
7213
7323
|
*/
|
|
7214
|
-
function getColorScale(name) {
|
|
7324
|
+
function getColorScale(name, theme) {
|
|
7325
|
+
if (theme === void 0) {
|
|
7326
|
+
theme = _victory_theme_victory_theme__WEBPACK_IMPORTED_MODULE_0__.VictoryTheme.material;
|
|
7327
|
+
}
|
|
7328
|
+
const {
|
|
7329
|
+
palette: {
|
|
7330
|
+
grayscale = ["#cccccc", "#969696", "#636363", "#252525"],
|
|
7331
|
+
qualitative = [],
|
|
7332
|
+
heatmap = [],
|
|
7333
|
+
warm = [],
|
|
7334
|
+
cool = [],
|
|
7335
|
+
red = [],
|
|
7336
|
+
blue = [],
|
|
7337
|
+
green = []
|
|
7338
|
+
} = {}
|
|
7339
|
+
} = theme;
|
|
7215
7340
|
const scales = {
|
|
7216
|
-
grayscale
|
|
7217
|
-
qualitative
|
|
7218
|
-
heatmap
|
|
7219
|
-
warm
|
|
7220
|
-
cool
|
|
7221
|
-
red
|
|
7222
|
-
blue
|
|
7223
|
-
green
|
|
7341
|
+
grayscale,
|
|
7342
|
+
qualitative,
|
|
7343
|
+
heatmap,
|
|
7344
|
+
warm,
|
|
7345
|
+
cool,
|
|
7346
|
+
red,
|
|
7347
|
+
blue,
|
|
7348
|
+
green
|
|
7224
7349
|
};
|
|
7225
|
-
|
|
7350
|
+
const selectedScale = name && scales[name]?.length ? scales[name] : scales.grayscale;
|
|
7351
|
+
return selectedScale;
|
|
7226
7352
|
}
|
|
7227
7353
|
|
|
7228
7354
|
/***/ }),
|
|
@@ -8181,34 +8307,31 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
8181
8307
|
/* harmony export */ "getDomain": function() { return /* binding */ getDomain; },
|
|
8182
8308
|
/* harmony export */ "getDomainFromChildren": function() { return /* binding */ getDomainFromChildren; },
|
|
8183
8309
|
/* harmony export */ "getScale": function() { return /* binding */ getScale; },
|
|
8184
|
-
/* harmony export */ "getStringsFromCategories": function() { return /* binding */ getStringsFromCategories; },
|
|
8185
8310
|
/* harmony export */ "getStringsFromChildren": function() { return /* binding */ getStringsFromChildren; },
|
|
8311
|
+
/* harmony export */ "getStringsFromChildrenCategories": function() { return /* binding */ getStringsFromChildrenCategories; },
|
|
8186
8312
|
/* harmony export */ "getStringsFromData": function() { return /* binding */ getStringsFromData; },
|
|
8187
8313
|
/* harmony export */ "getStyle": function() { return /* binding */ getStyle; },
|
|
8188
8314
|
/* harmony export */ "getWidth": function() { return /* binding */ getWidth; }
|
|
8189
8315
|
/* harmony export */ });
|
|
8190
|
-
/* harmony import */ var
|
|
8191
|
-
/* harmony import */ var
|
|
8192
|
-
/* harmony import */ var
|
|
8193
|
-
/* harmony import */ var
|
|
8194
|
-
/* harmony import */ var
|
|
8195
|
-
/* harmony import */ var
|
|
8196
|
-
/* harmony import */ var
|
|
8197
|
-
/* harmony import */ var
|
|
8198
|
-
/* harmony import */ var
|
|
8199
|
-
/* harmony import */ var
|
|
8200
|
-
/* harmony import */ var
|
|
8201
|
-
/* harmony import */ var
|
|
8202
|
-
/* harmony import */ var
|
|
8203
|
-
/* harmony import */ var
|
|
8204
|
-
/* harmony import */ var
|
|
8205
|
-
/* harmony import */ var
|
|
8206
|
-
/* harmony import */ var
|
|
8207
|
-
/* harmony import */ var
|
|
8208
|
-
/* harmony import */ var
|
|
8209
|
-
/* harmony import */ var _scale__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./scale */ "./victory-util/scale.ts");
|
|
8210
|
-
/* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./log */ "./victory-util/log.ts");
|
|
8211
|
-
|
|
8316
|
+
/* harmony import */ var lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/uniqBy */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/uniqBy.js");
|
|
8317
|
+
/* harmony import */ var lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0__);
|
|
8318
|
+
/* harmony import */ var lodash_groupBy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/groupBy */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/groupBy.js");
|
|
8319
|
+
/* harmony import */ var lodash_groupBy__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_groupBy__WEBPACK_IMPORTED_MODULE_1__);
|
|
8320
|
+
/* harmony import */ var lodash_uniq__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/uniq */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/uniq.js");
|
|
8321
|
+
/* harmony import */ var lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_uniq__WEBPACK_IMPORTED_MODULE_2__);
|
|
8322
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
|
|
8323
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_3__);
|
|
8324
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ "react");
|
|
8325
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);
|
|
8326
|
+
/* harmony import */ var _axis__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./axis */ "./victory-util/axis.tsx");
|
|
8327
|
+
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./style */ "./victory-util/style.ts");
|
|
8328
|
+
/* harmony import */ var _data__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./data */ "./victory-util/data.ts");
|
|
8329
|
+
/* harmony import */ var _domain__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./domain */ "./victory-util/domain.ts");
|
|
8330
|
+
/* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./events */ "./victory-util/events.ts");
|
|
8331
|
+
/* harmony import */ var _collection__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./collection */ "./victory-util/collection.tsx");
|
|
8332
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./helpers */ "./victory-util/helpers.ts");
|
|
8333
|
+
/* harmony import */ var _scale__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./scale */ "./victory-util/scale.ts");
|
|
8334
|
+
/* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./log */ "./victory-util/log.ts");
|
|
8212
8335
|
|
|
8213
8336
|
|
|
8214
8337
|
|
|
@@ -8237,7 +8360,7 @@ function addBinsToParentPropsIfHistogram(_ref) {
|
|
|
8237
8360
|
return child.type && child.type.role === "histogram";
|
|
8238
8361
|
});
|
|
8239
8362
|
if (someChildrenAreHistograms && !allChildrenAreHistograms) {
|
|
8240
|
-
|
|
8363
|
+
_log__WEBPACK_IMPORTED_MODULE_5__.warn("VictoryHistogram only supports being stacked with other VictoryHistogram components. Check to make sure that you are only passing VictoryHistogram components to VictoryStack");
|
|
8241
8364
|
}
|
|
8242
8365
|
|
|
8243
8366
|
// if we are stacking histograms, we need to generate explicit bins
|
|
@@ -8250,7 +8373,7 @@ function addBinsToParentPropsIfHistogram(_ref) {
|
|
|
8250
8373
|
// if we have explicit bins then we don't need to calculate them
|
|
8251
8374
|
if (!Array.isArray(childBins)) {
|
|
8252
8375
|
const combinedData = children.reduce((memo, child) => {
|
|
8253
|
-
const xAccessor =
|
|
8376
|
+
const xAccessor = _helpers__WEBPACK_IMPORTED_MODULE_6__.createAccessor(child.props.x || "x");
|
|
8254
8377
|
return memo.concat(child.props.data.map(datum => ({
|
|
8255
8378
|
x: xAccessor(datum)
|
|
8256
8379
|
})));
|
|
@@ -8293,7 +8416,7 @@ function getDataFromChildren(props, childComponents) {
|
|
|
8293
8416
|
maxDomain
|
|
8294
8417
|
};
|
|
8295
8418
|
let stack = 0;
|
|
8296
|
-
const children = childComponents ? childComponents.slice(0) :
|
|
8419
|
+
const children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
8297
8420
|
parentProps = addBinsToParentPropsIfHistogram({
|
|
8298
8421
|
children,
|
|
8299
8422
|
props,
|
|
@@ -8304,13 +8427,13 @@ function getDataFromChildren(props, childComponents) {
|
|
|
8304
8427
|
const childProps = Object.assign({}, child.props, parentProps);
|
|
8305
8428
|
let childData;
|
|
8306
8429
|
let childElement = child;
|
|
8307
|
-
if (!
|
|
8430
|
+
if (!_data__WEBPACK_IMPORTED_MODULE_7__.isDataComponent(child)) {
|
|
8308
8431
|
return null;
|
|
8309
|
-
} else if (child.type &&
|
|
8310
|
-
childElement = parent ? /*#__PURE__*/
|
|
8432
|
+
} else if (child.type && _helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(child.type.getData)) {
|
|
8433
|
+
childElement = parent ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().cloneElement(child, parent.props) : child;
|
|
8311
8434
|
childData = childElement.type.getData(childProps);
|
|
8312
8435
|
} else {
|
|
8313
|
-
childData =
|
|
8436
|
+
childData = _data__WEBPACK_IMPORTED_MODULE_7__.getData(childProps);
|
|
8314
8437
|
}
|
|
8315
8438
|
stack += 1;
|
|
8316
8439
|
return childData.map((datum, index) => Object.assign({
|
|
@@ -8319,23 +8442,23 @@ function getDataFromChildren(props, childComponents) {
|
|
|
8319
8442
|
}, datum));
|
|
8320
8443
|
};
|
|
8321
8444
|
const stacked = children.filter(c => c.type && c.type.role === "stack").length;
|
|
8322
|
-
const combine = (memo, val) => memo.concat(
|
|
8323
|
-
const datasets =
|
|
8445
|
+
const combine = (memo, val) => memo.concat(lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0___default()(val, "_group"));
|
|
8446
|
+
const datasets = _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(children, iteratee, props, [], combine);
|
|
8324
8447
|
const group = stacked ? "_group" : "_stack";
|
|
8325
|
-
return Object.values(
|
|
8448
|
+
return Object.values(lodash_groupBy__WEBPACK_IMPORTED_MODULE_1___default()(datasets, group));
|
|
8326
8449
|
}
|
|
8327
8450
|
function getData(props, childComponents) {
|
|
8328
8451
|
if (props.data) {
|
|
8329
|
-
return
|
|
8452
|
+
return _data__WEBPACK_IMPORTED_MODULE_7__.getData(props);
|
|
8330
8453
|
}
|
|
8331
|
-
return getDataFromChildren(props, childComponents ||
|
|
8454
|
+
return getDataFromChildren(props, childComponents || react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children));
|
|
8332
8455
|
}
|
|
8333
8456
|
function getWidth(props, groupLength, seriesLength) {
|
|
8334
8457
|
const {
|
|
8335
8458
|
datasets,
|
|
8336
8459
|
horizontal
|
|
8337
8460
|
} = props;
|
|
8338
|
-
const range = horizontal ?
|
|
8461
|
+
const range = horizontal ? _helpers__WEBPACK_IMPORTED_MODULE_6__.getRange(props, "y") : _helpers__WEBPACK_IMPORTED_MODULE_6__.getRange(props, "x");
|
|
8339
8462
|
const extent = Math.abs(range[1] - range[0]);
|
|
8340
8463
|
const seriesLengthValue = seriesLength !== undefined ? seriesLength : Array.isArray(datasets[0]) && datasets[0].length || 1;
|
|
8341
8464
|
const groupLengthValue = groupLength || datasets.length;
|
|
@@ -8381,8 +8504,8 @@ function getDefaultDomainPadding(props, axis, childComponents) {
|
|
|
8381
8504
|
}
|
|
8382
8505
|
function getDomainFromChildren(props, axis, childComponents) {
|
|
8383
8506
|
// eslint-disable-line max-statements, complexity, max-len
|
|
8384
|
-
const children = childComponents ? childComponents.slice(0) :
|
|
8385
|
-
const parentData = props.data ?
|
|
8507
|
+
const children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
8508
|
+
const parentData = props.data ? _data__WEBPACK_IMPORTED_MODULE_7__.getData(props) : undefined;
|
|
8386
8509
|
const {
|
|
8387
8510
|
polar,
|
|
8388
8511
|
startAngle,
|
|
@@ -8406,65 +8529,67 @@ function getDomainFromChildren(props, axis, childComponents) {
|
|
|
8406
8529
|
}) : baseParentProps;
|
|
8407
8530
|
const iteratee = child => {
|
|
8408
8531
|
const sharedProps = Object.assign({}, child.props, parentProps);
|
|
8409
|
-
if (!
|
|
8532
|
+
if (!_domain__WEBPACK_IMPORTED_MODULE_8__.isDomainComponent(child)) {
|
|
8410
8533
|
return null;
|
|
8411
|
-
} else if (child.type &&
|
|
8534
|
+
} else if (child.type && _helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(child.type.getDomain)) {
|
|
8412
8535
|
return child.props && child.type.getDomain(sharedProps, axis);
|
|
8413
8536
|
}
|
|
8414
|
-
return
|
|
8537
|
+
return _domain__WEBPACK_IMPORTED_MODULE_8__.getDomain(sharedProps, axis);
|
|
8415
8538
|
};
|
|
8416
|
-
const childDomains =
|
|
8417
|
-
const min = childDomains.length === 0 ? 0 :
|
|
8418
|
-
const max = childDomains.length === 0 ? 1 :
|
|
8539
|
+
const childDomains = _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(children, iteratee, props);
|
|
8540
|
+
const min = childDomains.length === 0 ? 0 : _collection__WEBPACK_IMPORTED_MODULE_9__.getMinValue(childDomains);
|
|
8541
|
+
const max = childDomains.length === 0 ? 1 : _collection__WEBPACK_IMPORTED_MODULE_9__.getMaxValue(childDomains);
|
|
8419
8542
|
return [min, max];
|
|
8420
8543
|
}
|
|
8421
8544
|
function getDomain(props, axis, childComponents) {
|
|
8422
|
-
const children = childComponents ||
|
|
8423
|
-
const propsDomain =
|
|
8545
|
+
const children = childComponents || react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
8546
|
+
const propsDomain = _domain__WEBPACK_IMPORTED_MODULE_8__.getDomainFromProps(props, axis);
|
|
8424
8547
|
const domainPadding = getDefaultDomainPadding(props, axis, children);
|
|
8425
8548
|
let domain;
|
|
8426
8549
|
if (propsDomain) {
|
|
8427
8550
|
domain = propsDomain;
|
|
8428
8551
|
} else {
|
|
8429
|
-
const minDomain =
|
|
8430
|
-
const maxDomain =
|
|
8431
|
-
const dataset = (props.data || props.y) &&
|
|
8432
|
-
const dataDomain = dataset ?
|
|
8552
|
+
const minDomain = _domain__WEBPACK_IMPORTED_MODULE_8__.getMinFromProps(props, axis);
|
|
8553
|
+
const maxDomain = _domain__WEBPACK_IMPORTED_MODULE_8__.getMaxFromProps(props, axis);
|
|
8554
|
+
const dataset = (props.data || props.y) && _data__WEBPACK_IMPORTED_MODULE_7__.getData(props);
|
|
8555
|
+
const dataDomain = dataset ? _domain__WEBPACK_IMPORTED_MODULE_8__.getDomainFromData(props, axis, dataset) : [];
|
|
8433
8556
|
const childDomain = getDomainFromChildren(props, axis, children);
|
|
8434
|
-
const min = minDomain ||
|
|
8435
|
-
const max = maxDomain ||
|
|
8436
|
-
domain =
|
|
8557
|
+
const min = minDomain || _collection__WEBPACK_IMPORTED_MODULE_9__.getMinValue([...dataDomain, ...childDomain]);
|
|
8558
|
+
const max = maxDomain || _collection__WEBPACK_IMPORTED_MODULE_9__.getMaxValue([...dataDomain, ...childDomain]);
|
|
8559
|
+
domain = _domain__WEBPACK_IMPORTED_MODULE_8__.getDomainFromMinMax(min, max);
|
|
8437
8560
|
}
|
|
8438
|
-
return
|
|
8561
|
+
return _domain__WEBPACK_IMPORTED_MODULE_8__.formatDomain(domain, Object.assign({
|
|
8439
8562
|
domainPadding
|
|
8440
8563
|
}, props), axis);
|
|
8441
8564
|
}
|
|
8442
8565
|
function getScale(props, axis, childComponents) {
|
|
8443
8566
|
if (props.data) {
|
|
8444
|
-
return
|
|
8567
|
+
return _scale__WEBPACK_IMPORTED_MODULE_10__.getBaseScale(props, axis);
|
|
8445
8568
|
}
|
|
8446
|
-
const children = childComponents ? childComponents.slice(0) :
|
|
8569
|
+
const children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
8447
8570
|
const iteratee = child => {
|
|
8448
8571
|
const sharedProps = Object.assign({}, child.props, {
|
|
8449
8572
|
horizontal: props.horizontal
|
|
8450
8573
|
});
|
|
8451
|
-
return
|
|
8574
|
+
return _scale__WEBPACK_IMPORTED_MODULE_10__.getScaleType(sharedProps, axis);
|
|
8452
8575
|
};
|
|
8453
|
-
const childScale =
|
|
8576
|
+
const childScale = lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()(_helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(children, iteratee, props));
|
|
8454
8577
|
|
|
8455
8578
|
// default to linear scale if more than one uniq scale type is given by children
|
|
8456
|
-
return childScale.length > 1 ?
|
|
8579
|
+
return childScale.length > 1 ? _scale__WEBPACK_IMPORTED_MODULE_10__.getScaleFromName("linear") : _scale__WEBPACK_IMPORTED_MODULE_10__.getScaleFromName(childScale[0]);
|
|
8457
8580
|
}
|
|
8458
8581
|
function getAllEvents(props) {
|
|
8459
8582
|
const components = ["groupComponent", "containerComponent", "labelComponent"];
|
|
8460
|
-
const componentEvents =
|
|
8583
|
+
const componentEvents = _events__WEBPACK_IMPORTED_MODULE_11__.getComponentEvents(props, components);
|
|
8461
8584
|
let events = props.events;
|
|
8462
8585
|
if (Array.isArray(componentEvents)) {
|
|
8463
8586
|
events = Array.isArray(props.events) ? componentEvents.concat(...props.events) : componentEvents;
|
|
8464
8587
|
}
|
|
8465
8588
|
return events || [];
|
|
8466
8589
|
}
|
|
8467
|
-
|
|
8590
|
+
|
|
8591
|
+
// eslint-disable-next-line max-params
|
|
8592
|
+
function getColor(calculatedProps, child, index, theme) {
|
|
8468
8593
|
// check for styles first
|
|
8469
8594
|
const {
|
|
8470
8595
|
style
|
|
@@ -8481,14 +8606,16 @@ function getColor(calculatedProps, child, index) {
|
|
|
8481
8606
|
if (!colorScale && !color) {
|
|
8482
8607
|
return undefined;
|
|
8483
8608
|
}
|
|
8484
|
-
const colors = Array.isArray(colorScale) ? colorScale :
|
|
8609
|
+
const colors = Array.isArray(colorScale) ? colorScale : _style__WEBPACK_IMPORTED_MODULE_12__.getColorScale(colorScale, theme);
|
|
8485
8610
|
return color || colors[index % colors.length];
|
|
8486
8611
|
}
|
|
8487
8612
|
function getStyle(theme, style, role) {
|
|
8488
8613
|
const defaultStyle = theme && theme[role] && theme[role].style ? theme[role].style : {};
|
|
8489
|
-
return
|
|
8614
|
+
return _helpers__WEBPACK_IMPORTED_MODULE_6__.getStyles(style, defaultStyle);
|
|
8490
8615
|
}
|
|
8491
|
-
|
|
8616
|
+
|
|
8617
|
+
// eslint-disable-next-line max-params
|
|
8618
|
+
function getChildStyle(child, index, calculatedProps, theme) {
|
|
8492
8619
|
const {
|
|
8493
8620
|
style,
|
|
8494
8621
|
role
|
|
@@ -8498,7 +8625,7 @@ function getChildStyle(child, index, calculatedProps) {
|
|
|
8498
8625
|
return childStyle;
|
|
8499
8626
|
}
|
|
8500
8627
|
const childRole = child.type && child.type.role;
|
|
8501
|
-
const defaultFill = childRole === "stack" ? undefined : getColor(calculatedProps, child, index);
|
|
8628
|
+
const defaultFill = childRole === "stack" ? undefined : getColor(calculatedProps, child, index, theme);
|
|
8502
8629
|
const defaultColor = childRole === "line" ? {
|
|
8503
8630
|
fill: "none",
|
|
8504
8631
|
stroke: defaultFill
|
|
@@ -8508,8 +8635,8 @@ function getChildStyle(child, index, calculatedProps) {
|
|
|
8508
8635
|
const dataWidth = role === "stack" ? {} : {
|
|
8509
8636
|
width: getWidth(calculatedProps)
|
|
8510
8637
|
};
|
|
8511
|
-
const dataStyle =
|
|
8512
|
-
const labelsStyle =
|
|
8638
|
+
const dataStyle = lodash_defaults__WEBPACK_IMPORTED_MODULE_3___default()({}, childStyle.data, Object.assign({}, dataWidth, style.data, defaultColor));
|
|
8639
|
+
const labelsStyle = lodash_defaults__WEBPACK_IMPORTED_MODULE_3___default()({}, childStyle.labels, style.labels);
|
|
8513
8640
|
return {
|
|
8514
8641
|
...childStyle,
|
|
8515
8642
|
parent: style.parent,
|
|
@@ -8517,28 +8644,26 @@ function getChildStyle(child, index, calculatedProps) {
|
|
|
8517
8644
|
labels: labelsStyle
|
|
8518
8645
|
};
|
|
8519
8646
|
}
|
|
8520
|
-
function
|
|
8647
|
+
function getStringsFromChildrenCategories(childComponents, axis) {
|
|
8521
8648
|
const iteratee = child => {
|
|
8522
|
-
|
|
8523
|
-
if (!_domain__WEBPACK_IMPORTED_MODULE_9__.isDomainComponent(child) || !childProps.categories) {
|
|
8649
|
+
if (!_domain__WEBPACK_IMPORTED_MODULE_8__.isDomainComponent(child)) {
|
|
8524
8650
|
return null;
|
|
8525
8651
|
}
|
|
8526
|
-
const
|
|
8527
|
-
|
|
8528
|
-
return categoryStrings ? _collection__WEBPACK_IMPORTED_MODULE_10__.removeUndefined(categoryStrings) : [];
|
|
8652
|
+
const childProps = child.props || {};
|
|
8653
|
+
return _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(childProps, axis);
|
|
8529
8654
|
};
|
|
8530
|
-
return
|
|
8655
|
+
return _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(childComponents.slice(0), iteratee);
|
|
8531
8656
|
}
|
|
8532
8657
|
function getStringsFromData(childComponents) {
|
|
8533
8658
|
const iteratee = child => {
|
|
8534
8659
|
const childProps = child.props || {};
|
|
8535
8660
|
let data;
|
|
8536
|
-
if (!
|
|
8661
|
+
if (!_data__WEBPACK_IMPORTED_MODULE_7__.isDataComponent(child)) {
|
|
8537
8662
|
return null;
|
|
8538
|
-
} else if (child.type &&
|
|
8663
|
+
} else if (child.type && _helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(child.type.getData)) {
|
|
8539
8664
|
data = child.type.getData(childProps);
|
|
8540
8665
|
} else {
|
|
8541
|
-
data =
|
|
8666
|
+
data = _data__WEBPACK_IMPORTED_MODULE_7__.getData(childProps);
|
|
8542
8667
|
}
|
|
8543
8668
|
return data.map(d => ({
|
|
8544
8669
|
x: d.xName,
|
|
@@ -8557,28 +8682,28 @@ function getStringsFromData(childComponents) {
|
|
|
8557
8682
|
y: y !== undefined ? memo.y.concat(y) : memo.y
|
|
8558
8683
|
};
|
|
8559
8684
|
};
|
|
8560
|
-
return
|
|
8685
|
+
return _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(childComponents.slice(0), iteratee, {}, initialMemo, combine);
|
|
8561
8686
|
}
|
|
8562
8687
|
function getCategoryAndAxisStringsFromChildren(props, axis, childComponents) {
|
|
8563
|
-
const categories =
|
|
8564
|
-
const axisComponent =
|
|
8565
|
-
const axisStrings = axisComponent ?
|
|
8566
|
-
const categoryStrings = categories
|
|
8567
|
-
return
|
|
8688
|
+
const categories = _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(props, axis);
|
|
8689
|
+
const axisComponent = _axis__WEBPACK_IMPORTED_MODULE_13__.getAxisComponent(childComponents, axis);
|
|
8690
|
+
const axisStrings = axisComponent ? _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromAxes(axisComponent.props, axis) : [];
|
|
8691
|
+
const categoryStrings = categories.length ? categories : getStringsFromChildrenCategories(childComponents, axis);
|
|
8692
|
+
return lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()([...categoryStrings, ...axisStrings].flat());
|
|
8568
8693
|
}
|
|
8569
8694
|
function getStringsFromChildren(props, childComponents) {
|
|
8570
|
-
const children = childComponents ||
|
|
8695
|
+
const children = childComponents || react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
8571
8696
|
const xStrings = getCategoryAndAxisStringsFromChildren(props, "x", children);
|
|
8572
8697
|
const yStrings = getCategoryAndAxisStringsFromChildren(props, "y", children);
|
|
8573
8698
|
const dataStrings = getStringsFromData(children);
|
|
8574
8699
|
return {
|
|
8575
|
-
x:
|
|
8576
|
-
y:
|
|
8700
|
+
x: lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()([...xStrings, ...dataStrings.x].flat()),
|
|
8701
|
+
y: lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()([...yStrings, ...dataStrings.y].flat())
|
|
8577
8702
|
};
|
|
8578
8703
|
}
|
|
8579
8704
|
function getCategories(props, childComponents, allStrings) {
|
|
8580
|
-
const xPropCategories = props.categories &&
|
|
8581
|
-
const yPropCategories = props.categories &&
|
|
8705
|
+
const xPropCategories = props.categories && _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(props, "x");
|
|
8706
|
+
const yPropCategories = props.categories && _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(props, "y");
|
|
8582
8707
|
const fallbackRequired = !xPropCategories || !yPropCategories;
|
|
8583
8708
|
const fallbackProps = fallbackRequired ? allStrings || getStringsFromChildren(props, childComponents) : {};
|
|
8584
8709
|
const xCategories = xPropCategories || fallbackProps.x;
|