victory-core 37.2.0 → 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 +12 -0
- package/dist/victory-core.js +109 -117
- package/dist/victory-core.min.js +1 -1
- package/es/victory-portal/victory-portal.js +2 -2
- package/es/victory-theme/clean.js +28 -31
- package/es/victory-util/wrapper.d.ts +1 -1
- package/es/victory-util/wrapper.js +8 -11
- package/lib/victory-portal/victory-portal.js +2 -2
- package/lib/victory-theme/clean.js +28 -31
- package/lib/victory-util/wrapper.d.ts +1 -1
- package/lib/victory-util/wrapper.js +9 -12
- package/package.json +2 -2
- package/src/victory-portal/victory-portal.tsx +2 -2
- package/src/victory-theme/clean.tsx +52 -30
- package/src/victory-util/wrapper.tsx +10 -23
|
@@ -28,20 +28,16 @@ const orange = {
|
|
|
28
28
|
"100": "#FEE2D5",
|
|
29
29
|
"300": "#FFA981",
|
|
30
30
|
"500": "#FF6F2C",
|
|
31
|
+
"700": "#FF4E1B",
|
|
31
32
|
"900": "#D74D26",
|
|
32
33
|
};
|
|
33
34
|
const red = {
|
|
34
35
|
"100": "#FFDCE5",
|
|
35
36
|
"300": "#FF9EB7",
|
|
36
37
|
"500": "#F82B60",
|
|
38
|
+
"700": "#D31A3D",
|
|
37
39
|
"900": "#BA1E45",
|
|
38
40
|
};
|
|
39
|
-
const pink = {
|
|
40
|
-
"100": "#FFDAF6",
|
|
41
|
-
"300": "#F99DE2",
|
|
42
|
-
"500": "#FF08C2",
|
|
43
|
-
"900": "#B2158B",
|
|
44
|
-
};
|
|
45
41
|
const purple = {
|
|
46
42
|
"100": "#EDE3FE",
|
|
47
43
|
"300": "#CDB0FF",
|
|
@@ -52,6 +48,7 @@ const blue = {
|
|
|
52
48
|
"100": "#CFDFFF",
|
|
53
49
|
"300": "#9CC7FF",
|
|
54
50
|
"500": "#2D7FF9",
|
|
51
|
+
"700": "#0056B3",
|
|
55
52
|
"900": "#2750AE",
|
|
56
53
|
};
|
|
57
54
|
const cyan = {
|
|
@@ -70,29 +67,55 @@ const green = {
|
|
|
70
67
|
"100": "#D1F7C4",
|
|
71
68
|
"300": "#93E088",
|
|
72
69
|
"500": "#20C933",
|
|
70
|
+
"700": "#1B9B2A",
|
|
73
71
|
"900": "#338A17",
|
|
74
72
|
};
|
|
75
73
|
|
|
76
74
|
const colors = {
|
|
77
75
|
blue: blue["500"],
|
|
78
|
-
|
|
79
|
-
teal: teal["500"],
|
|
80
|
-
purple: purple["500"],
|
|
76
|
+
cyan: cyan["500"],
|
|
81
77
|
green: green["500"],
|
|
78
|
+
yellow: yellow["500"],
|
|
82
79
|
orange: orange["500"],
|
|
83
|
-
cyan: cyan["500"],
|
|
84
80
|
red: red["500"],
|
|
85
|
-
|
|
81
|
+
purple: purple["500"],
|
|
82
|
+
teal: teal["500"],
|
|
86
83
|
};
|
|
87
84
|
|
|
88
85
|
const colorScale = Object.values(colors);
|
|
89
|
-
const grayscale = [
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
86
|
+
const grayscale = [
|
|
87
|
+
gray["100"],
|
|
88
|
+
gray["300"],
|
|
89
|
+
gray["500"],
|
|
90
|
+
gray["700"],
|
|
91
|
+
gray["900"],
|
|
92
|
+
];
|
|
93
|
+
const warm = [
|
|
94
|
+
yellow["300"],
|
|
95
|
+
yellow["500"],
|
|
96
|
+
orange["500"],
|
|
97
|
+
orange["900"],
|
|
98
|
+
red["500"],
|
|
99
|
+
];
|
|
100
|
+
const cool = [
|
|
101
|
+
purple["500"],
|
|
102
|
+
blue["500"],
|
|
103
|
+
cyan["500"],
|
|
104
|
+
teal["500"],
|
|
105
|
+
green["500"],
|
|
106
|
+
];
|
|
107
|
+
const heatmap = [
|
|
108
|
+
green["900"],
|
|
109
|
+
green["500"],
|
|
110
|
+
yellow["500"],
|
|
111
|
+
orange["500"],
|
|
112
|
+
red["500"],
|
|
113
|
+
];
|
|
114
|
+
const redPalette = Object.values(red);
|
|
115
|
+
const greenPalette = Object.values(green);
|
|
116
|
+
const bluePalette = Object.values(blue);
|
|
117
|
+
|
|
118
|
+
const defaultColor = blue["500"];
|
|
96
119
|
|
|
97
120
|
// *
|
|
98
121
|
// * Typography
|
|
@@ -108,7 +131,7 @@ const padding = 8;
|
|
|
108
131
|
const baseProps = {
|
|
109
132
|
width: 450,
|
|
110
133
|
height: 300,
|
|
111
|
-
padding:
|
|
134
|
+
padding: 60,
|
|
112
135
|
colorScale,
|
|
113
136
|
};
|
|
114
137
|
// *
|
|
@@ -155,7 +178,7 @@ export const clean: VictoryThemeDefinition = {
|
|
|
155
178
|
{
|
|
156
179
|
style: {
|
|
157
180
|
data: {
|
|
158
|
-
fill:
|
|
181
|
+
fill: defaultColor,
|
|
159
182
|
strokeWidth: 2,
|
|
160
183
|
fillOpacity: 0.5,
|
|
161
184
|
},
|
|
@@ -175,7 +198,7 @@ export const clean: VictoryThemeDefinition = {
|
|
|
175
198
|
strokeLinejoin,
|
|
176
199
|
},
|
|
177
200
|
axisLabel: Object.assign({}, centeredLabelStyles, {
|
|
178
|
-
padding,
|
|
201
|
+
padding: 35,
|
|
179
202
|
stroke: "transparent",
|
|
180
203
|
}),
|
|
181
204
|
grid: {
|
|
@@ -243,7 +266,7 @@ export const clean: VictoryThemeDefinition = {
|
|
|
243
266
|
{
|
|
244
267
|
style: {
|
|
245
268
|
data: {
|
|
246
|
-
fill:
|
|
269
|
+
fill: defaultColor,
|
|
247
270
|
padding,
|
|
248
271
|
strokeWidth: 1,
|
|
249
272
|
fillOpacity: 0.5,
|
|
@@ -263,9 +286,9 @@ export const clean: VictoryThemeDefinition = {
|
|
|
263
286
|
medianLabels: Object.assign({}, baseLabelStyles, { padding: 3 }),
|
|
264
287
|
min: { padding, stroke: gray["400"], strokeWidth: 2 },
|
|
265
288
|
minLabels: Object.assign({}, baseLabelStyles, { padding: 3 }),
|
|
266
|
-
q1: { padding, fill:
|
|
289
|
+
q1: { padding, fill: colorScale[0], rx: borderRadius, strokeWidth: 2 },
|
|
267
290
|
q1Labels: Object.assign({}, baseLabelStyles, { padding: 3 }),
|
|
268
|
-
q3: { padding, fill:
|
|
291
|
+
q3: { padding, fill: colorScale[1], rx: borderRadius },
|
|
269
292
|
q3Labels: Object.assign({}, baseLabelStyles, { padding: 3 }),
|
|
270
293
|
},
|
|
271
294
|
boxWidth: 20,
|
|
@@ -283,8 +306,8 @@ export const clean: VictoryThemeDefinition = {
|
|
|
283
306
|
labels: Object.assign({}, baseLabelStyles, { padding: 5 }),
|
|
284
307
|
},
|
|
285
308
|
candleColors: {
|
|
286
|
-
positive:
|
|
287
|
-
negative:
|
|
309
|
+
positive: green["500"],
|
|
310
|
+
negative: red["500"],
|
|
288
311
|
},
|
|
289
312
|
wickStrokeWidth: 2,
|
|
290
313
|
},
|
|
@@ -350,7 +373,7 @@ export const clean: VictoryThemeDefinition = {
|
|
|
350
373
|
data: {
|
|
351
374
|
fill: "transparent",
|
|
352
375
|
opacity: 1,
|
|
353
|
-
stroke:
|
|
376
|
+
stroke: defaultColor,
|
|
354
377
|
strokeWidth: 2,
|
|
355
378
|
strokeLinecap,
|
|
356
379
|
strokeLinejoin,
|
|
@@ -387,7 +410,7 @@ export const clean: VictoryThemeDefinition = {
|
|
|
387
410
|
{
|
|
388
411
|
style: {
|
|
389
412
|
data: {
|
|
390
|
-
fill:
|
|
413
|
+
fill: defaultColor,
|
|
391
414
|
opacity: 1,
|
|
392
415
|
stroke: "transparent",
|
|
393
416
|
strokeWidth: 0,
|
|
@@ -426,9 +449,8 @@ export const clean: VictoryThemeDefinition = {
|
|
|
426
449
|
style: {
|
|
427
450
|
data: {
|
|
428
451
|
fill: blue["100"],
|
|
429
|
-
stroke:
|
|
452
|
+
stroke: defaultColor,
|
|
430
453
|
strokeWidth: 2,
|
|
431
|
-
opacity: 0.4,
|
|
432
454
|
},
|
|
433
455
|
labels: Object.assign({}, baseLabelStyles, {
|
|
434
456
|
padding: 5,
|
|
@@ -356,19 +356,13 @@ export function getChildStyle(child, index, calculatedProps, theme) {
|
|
|
356
356
|
};
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
-
export function
|
|
359
|
+
export function getStringsFromChildrenCategories(childComponents, axis) {
|
|
360
360
|
const iteratee = (child) => {
|
|
361
|
-
|
|
362
|
-
if (!Domain.isDomainComponent(child) || !childProps.categories) {
|
|
361
|
+
if (!Domain.isDomainComponent(child)) {
|
|
363
362
|
return null;
|
|
364
363
|
}
|
|
365
|
-
const
|
|
366
|
-
|
|
367
|
-
? childProps.categories[axis]
|
|
368
|
-
: childProps.props.categories;
|
|
369
|
-
const categoryStrings =
|
|
370
|
-
categories && categories.filter((val) => typeof val === "string");
|
|
371
|
-
return categoryStrings ? Collection.removeUndefined(categoryStrings) : [];
|
|
364
|
+
const childProps = child.props || {};
|
|
365
|
+
return Data.getStringsFromCategories(childProps, axis);
|
|
372
366
|
};
|
|
373
367
|
return Helpers.reduceChildren(childComponents.slice(0), iteratee);
|
|
374
368
|
}
|
|
@@ -417,15 +411,14 @@ export function getCategoryAndAxisStringsFromChildren(
|
|
|
417
411
|
axis,
|
|
418
412
|
childComponents,
|
|
419
413
|
) {
|
|
420
|
-
const categories =
|
|
421
|
-
? props.categories[axis]
|
|
422
|
-
: props.categories;
|
|
414
|
+
const categories = Data.getStringsFromCategories(props, axis);
|
|
423
415
|
const axisComponent = Axis.getAxisComponent(childComponents, axis);
|
|
424
416
|
const axisStrings = axisComponent
|
|
425
417
|
? Data.getStringsFromAxes(axisComponent.props, axis)
|
|
426
418
|
: [];
|
|
427
|
-
const categoryStrings =
|
|
428
|
-
categories
|
|
419
|
+
const categoryStrings = categories.length
|
|
420
|
+
? categories
|
|
421
|
+
: getStringsFromChildrenCategories(childComponents, axis);
|
|
429
422
|
return uniq([...categoryStrings, ...axisStrings].flat());
|
|
430
423
|
}
|
|
431
424
|
|
|
@@ -445,15 +438,9 @@ export function getStringsFromChildren(props, childComponents) {
|
|
|
445
438
|
|
|
446
439
|
export function getCategories(props, childComponents, allStrings?) {
|
|
447
440
|
const xPropCategories =
|
|
448
|
-
props.categories &&
|
|
449
|
-
? props.categories.x
|
|
450
|
-
: props.categories;
|
|
451
|
-
|
|
441
|
+
props.categories && Data.getStringsFromCategories(props, "x");
|
|
452
442
|
const yPropCategories =
|
|
453
|
-
props.categories &&
|
|
454
|
-
? props.categories.y
|
|
455
|
-
: props.categories;
|
|
456
|
-
|
|
443
|
+
props.categories && Data.getStringsFromCategories(props, "y");
|
|
457
444
|
const fallbackRequired = !xPropCategories || !yPropCategories;
|
|
458
445
|
|
|
459
446
|
const fallbackProps = fallbackRequired
|