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
|
@@ -76,7 +76,26 @@ const green = {
|
|
|
76
76
|
"500": "#20C933",
|
|
77
77
|
"900": "#338A17"
|
|
78
78
|
};
|
|
79
|
-
const colors =
|
|
79
|
+
const colors = {
|
|
80
|
+
blue: blue["500"],
|
|
81
|
+
pink: pink["500"],
|
|
82
|
+
teal: teal["500"],
|
|
83
|
+
purple: purple["500"],
|
|
84
|
+
green: green["500"],
|
|
85
|
+
orange: orange["500"],
|
|
86
|
+
cyan: cyan["500"],
|
|
87
|
+
red: red["500"],
|
|
88
|
+
yellow: yellow["500"]
|
|
89
|
+
};
|
|
90
|
+
const colorScale = Object.values(colors);
|
|
91
|
+
const grayscale = [gray["200"], gray["400"], gray["600"], gray["900"]];
|
|
92
|
+
const warm = [yellow["500"], orange["500"], red["500"], pink["500"]];
|
|
93
|
+
const cool = [cyan["500"], teal["500"], blue["500"], purple["500"]];
|
|
94
|
+
const heatmap = [green["500"], yellow["500"], red["500"]];
|
|
95
|
+
const redPalette = [red["500"], red["300"], red["100"]];
|
|
96
|
+
const greenPalette = [green["500"], green["300"], green["100"]];
|
|
97
|
+
const bluePalette = [blue["500"], blue["300"], blue["100"]];
|
|
98
|
+
|
|
80
99
|
// *
|
|
81
100
|
// * Typography
|
|
82
101
|
// *
|
|
@@ -91,7 +110,7 @@ const baseProps = {
|
|
|
91
110
|
width: 450,
|
|
92
111
|
height: 300,
|
|
93
112
|
padding: 50,
|
|
94
|
-
colorScale
|
|
113
|
+
colorScale
|
|
95
114
|
};
|
|
96
115
|
// *
|
|
97
116
|
// * Labels
|
|
@@ -120,10 +139,23 @@ const borderRadius = 1;
|
|
|
120
139
|
// * Theme
|
|
121
140
|
// *
|
|
122
141
|
const clean = exports.clean = {
|
|
142
|
+
palette: {
|
|
143
|
+
colors,
|
|
144
|
+
grayscale,
|
|
145
|
+
qualitative: colorScale,
|
|
146
|
+
heatmap,
|
|
147
|
+
warm,
|
|
148
|
+
cool,
|
|
149
|
+
red: redPalette,
|
|
150
|
+
green: greenPalette,
|
|
151
|
+
blue: bluePalette
|
|
152
|
+
},
|
|
123
153
|
area: Object.assign({
|
|
124
154
|
style: {
|
|
125
155
|
data: {
|
|
126
|
-
fill:
|
|
156
|
+
fill: blue["500"],
|
|
157
|
+
strokeWidth: 2,
|
|
158
|
+
fillOpacity: 0.5
|
|
127
159
|
},
|
|
128
160
|
labels: baseLabelStyles
|
|
129
161
|
}
|
|
@@ -132,7 +164,7 @@ const clean = exports.clean = {
|
|
|
132
164
|
style: {
|
|
133
165
|
axis: {
|
|
134
166
|
fill: "transparent",
|
|
135
|
-
stroke: gray["
|
|
167
|
+
stroke: gray["500"],
|
|
136
168
|
strokeWidth: 1,
|
|
137
169
|
strokeLinecap,
|
|
138
170
|
strokeLinejoin
|
|
@@ -157,10 +189,10 @@ const clean = exports.clean = {
|
|
|
157
189
|
polarAxis: Object.assign({
|
|
158
190
|
style: {
|
|
159
191
|
axis: {
|
|
160
|
-
stroke: gray["
|
|
192
|
+
stroke: gray["500"]
|
|
161
193
|
},
|
|
162
194
|
grid: {
|
|
163
|
-
stroke: gray["
|
|
195
|
+
stroke: gray["400"],
|
|
164
196
|
strokeDasharray,
|
|
165
197
|
strokeLinecap,
|
|
166
198
|
strokeLinejoin,
|
|
@@ -169,7 +201,7 @@ const clean = exports.clean = {
|
|
|
169
201
|
ticks: {
|
|
170
202
|
fill: "transparent",
|
|
171
203
|
size: 5,
|
|
172
|
-
stroke: gray["
|
|
204
|
+
stroke: gray["400"],
|
|
173
205
|
strokeWidth: 1,
|
|
174
206
|
strokeLinecap,
|
|
175
207
|
strokeLinejoin
|
|
@@ -180,10 +212,10 @@ const clean = exports.clean = {
|
|
|
180
212
|
polarDependentAxis: Object.assign({
|
|
181
213
|
style: {
|
|
182
214
|
axis: {
|
|
183
|
-
stroke: gray["
|
|
215
|
+
stroke: gray["500"]
|
|
184
216
|
},
|
|
185
217
|
grid: {
|
|
186
|
-
stroke: gray["
|
|
218
|
+
stroke: gray["400"],
|
|
187
219
|
strokeDasharray,
|
|
188
220
|
strokeLinecap,
|
|
189
221
|
strokeLinejoin,
|
|
@@ -192,7 +224,7 @@ const clean = exports.clean = {
|
|
|
192
224
|
ticks: {
|
|
193
225
|
fill: "transparent",
|
|
194
226
|
size: 5,
|
|
195
|
-
stroke: gray["
|
|
227
|
+
stroke: gray["300"],
|
|
196
228
|
strokeWidth: 1,
|
|
197
229
|
strokeLinecap,
|
|
198
230
|
strokeLinejoin
|
|
@@ -205,7 +237,8 @@ const clean = exports.clean = {
|
|
|
205
237
|
data: {
|
|
206
238
|
fill: blue["500"],
|
|
207
239
|
padding,
|
|
208
|
-
strokeWidth:
|
|
240
|
+
strokeWidth: 1,
|
|
241
|
+
fillOpacity: 0.5
|
|
209
242
|
},
|
|
210
243
|
labels: baseLabelStyles
|
|
211
244
|
},
|
|
@@ -242,14 +275,15 @@ const clean = exports.clean = {
|
|
|
242
275
|
q1: {
|
|
243
276
|
padding,
|
|
244
277
|
fill: teal["500"],
|
|
245
|
-
rx: borderRadius
|
|
278
|
+
rx: borderRadius,
|
|
279
|
+
strokeWidth: 2
|
|
246
280
|
},
|
|
247
281
|
q1Labels: Object.assign({}, baseLabelStyles, {
|
|
248
282
|
padding: 3
|
|
249
283
|
}),
|
|
250
284
|
q3: {
|
|
251
285
|
padding,
|
|
252
|
-
fill:
|
|
286
|
+
fill: cyan["500"],
|
|
253
287
|
rx: borderRadius
|
|
254
288
|
},
|
|
255
289
|
q3Labels: Object.assign({}, baseLabelStyles, {
|
|
@@ -290,14 +324,13 @@ const clean = exports.clean = {
|
|
|
290
324
|
}
|
|
291
325
|
}, baseProps),
|
|
292
326
|
group: Object.assign({
|
|
293
|
-
colorScale
|
|
327
|
+
colorScale
|
|
294
328
|
}, baseProps),
|
|
295
329
|
histogram: Object.assign({
|
|
296
330
|
style: {
|
|
297
331
|
data: {
|
|
298
332
|
fill: cyan["500"],
|
|
299
|
-
|
|
300
|
-
strokeWidth: 0
|
|
333
|
+
fillOpacity: 0.5
|
|
301
334
|
},
|
|
302
335
|
labels: baseLabelStyles
|
|
303
336
|
},
|
|
@@ -308,21 +341,23 @@ const clean = exports.clean = {
|
|
|
308
341
|
}, baseProps),
|
|
309
342
|
label: baseLabelStyles,
|
|
310
343
|
legend: {
|
|
311
|
-
colorScale
|
|
312
|
-
gutter:
|
|
313
|
-
|
|
344
|
+
colorScale,
|
|
345
|
+
gutter: 24,
|
|
346
|
+
borderPadding: 10,
|
|
347
|
+
orientation: "horizontal",
|
|
314
348
|
titleOrientation: "top",
|
|
349
|
+
centerTitle: true,
|
|
315
350
|
style: {
|
|
316
351
|
data: {
|
|
317
352
|
type: "circle"
|
|
318
353
|
},
|
|
319
354
|
labels: {
|
|
320
355
|
...baseLabelStyles,
|
|
321
|
-
fontSize:
|
|
356
|
+
fontSize: 12
|
|
322
357
|
},
|
|
323
358
|
title: Object.assign({}, baseLabelStyles, {
|
|
324
359
|
padding,
|
|
325
|
-
fontSize:
|
|
360
|
+
fontSize: 16
|
|
326
361
|
}),
|
|
327
362
|
border: {
|
|
328
363
|
stroke: gray["200"],
|
|
@@ -336,7 +371,7 @@ const clean = exports.clean = {
|
|
|
336
371
|
data: {
|
|
337
372
|
fill: "transparent",
|
|
338
373
|
opacity: 1,
|
|
339
|
-
stroke:
|
|
374
|
+
stroke: blue["500"],
|
|
340
375
|
strokeWidth: 2,
|
|
341
376
|
strokeLinecap,
|
|
342
377
|
strokeLinejoin
|
|
@@ -346,16 +381,22 @@ const clean = exports.clean = {
|
|
|
346
381
|
}, baseProps),
|
|
347
382
|
pie: Object.assign({
|
|
348
383
|
style: {
|
|
384
|
+
parent: {
|
|
385
|
+
backgroundColor: gray.white
|
|
386
|
+
},
|
|
349
387
|
data: {
|
|
350
388
|
padding,
|
|
351
389
|
stroke: gray.white,
|
|
352
390
|
strokeWidth: 1
|
|
353
391
|
},
|
|
354
|
-
labels:
|
|
355
|
-
|
|
356
|
-
|
|
392
|
+
labels: {
|
|
393
|
+
...baseLabelStyles,
|
|
394
|
+
padding: 20,
|
|
395
|
+
fill: gray["600"],
|
|
396
|
+
fontSize: 10
|
|
397
|
+
}
|
|
357
398
|
},
|
|
358
|
-
colorScale
|
|
399
|
+
colorScale,
|
|
359
400
|
cornerRadius: borderRadius
|
|
360
401
|
}, baseProps),
|
|
361
402
|
scatter: Object.assign({
|
|
@@ -366,11 +407,14 @@ const clean = exports.clean = {
|
|
|
366
407
|
stroke: "transparent",
|
|
367
408
|
strokeWidth: 0
|
|
368
409
|
},
|
|
369
|
-
labels:
|
|
410
|
+
labels: {
|
|
411
|
+
...baseLabelStyles,
|
|
412
|
+
padding: 20
|
|
413
|
+
}
|
|
370
414
|
}
|
|
371
415
|
}, baseProps),
|
|
372
416
|
stack: Object.assign({
|
|
373
|
-
colorScale
|
|
417
|
+
colorScale
|
|
374
418
|
}, baseProps),
|
|
375
419
|
tooltip: {
|
|
376
420
|
style: Object.assign({}, baseLabelStyles, {
|
|
@@ -378,7 +422,7 @@ const clean = exports.clean = {
|
|
|
378
422
|
pointerEvents: "none"
|
|
379
423
|
}),
|
|
380
424
|
flyoutStyle: {
|
|
381
|
-
stroke: gray["
|
|
425
|
+
stroke: gray["300"],
|
|
382
426
|
strokeWidth: 2,
|
|
383
427
|
fill: gray.white,
|
|
384
428
|
pointerEvents: "none"
|
|
@@ -395,9 +439,10 @@ const clean = exports.clean = {
|
|
|
395
439
|
voronoi: Object.assign({
|
|
396
440
|
style: {
|
|
397
441
|
data: {
|
|
398
|
-
fill:
|
|
399
|
-
stroke:
|
|
400
|
-
strokeWidth: 2
|
|
442
|
+
fill: blue["100"],
|
|
443
|
+
stroke: blue["500"],
|
|
444
|
+
strokeWidth: 2,
|
|
445
|
+
opacity: 0.4
|
|
401
446
|
},
|
|
402
447
|
labels: Object.assign({}, baseLabelStyles, {
|
|
403
448
|
padding: 5,
|
|
@@ -7,9 +7,28 @@ exports.grayscale = void 0;
|
|
|
7
7
|
// *
|
|
8
8
|
// * Colors
|
|
9
9
|
// *
|
|
10
|
-
const colors =
|
|
10
|
+
const colors = {
|
|
11
|
+
blue: "#4F7DA1",
|
|
12
|
+
pink: "#E2A37F",
|
|
13
|
+
teal: "#00796B",
|
|
14
|
+
purple: "#DF948A",
|
|
15
|
+
green: "#8BC34A",
|
|
16
|
+
orange: "#F4511E",
|
|
17
|
+
cyan: "#006064",
|
|
18
|
+
red: "#DF5A49",
|
|
19
|
+
yellow: "#FFF59D"
|
|
20
|
+
};
|
|
21
|
+
const colorScale = ["#252525", "#525252", "#737373", "#969696", "#bdbdbd", "#d9d9d9", "#f0f0f0"];
|
|
11
22
|
const charcoal = "#252525";
|
|
12
23
|
const grey = "#969696";
|
|
24
|
+
const qualitative = ["#334D5C", "#45B29D", "#EFC94C", "#E27A3F", "#DF5A49", "#4F7DA1", "#55DBC1", "#EFDA97", "#E2A37F", "#DF948A"];
|
|
25
|
+
const heatmap = ["#428517", "#77D200", "#D6D305", "#EC8E19", "#C92B05"];
|
|
26
|
+
const warm = ["#940031", "#C43343", "#DC5429", "#FF821D", "#FFAF55"];
|
|
27
|
+
const cool = ["#2746B9", "#0B69D4", "#2794DB", "#31BB76", "#60E83B"];
|
|
28
|
+
const red = ["#FCAE91", "#FB6A4A", "#DE2D26", "#A50F15", "#750B0E"];
|
|
29
|
+
const green = ["#354722", "#466631", "#649146", "#8AB25C", "#A9C97E"];
|
|
30
|
+
const blue = ["#002C61", "#004B8F", "#006BC9", "#3795E5", "#65B4F4"];
|
|
31
|
+
|
|
13
32
|
// *
|
|
14
33
|
// * Typography
|
|
15
34
|
// *
|
|
@@ -23,7 +42,7 @@ const baseProps = {
|
|
|
23
42
|
width: 450,
|
|
24
43
|
height: 300,
|
|
25
44
|
padding: 50,
|
|
26
|
-
colorScale
|
|
45
|
+
colorScale
|
|
27
46
|
};
|
|
28
47
|
// *
|
|
29
48
|
// * Labels
|
|
@@ -45,6 +64,17 @@ const centeredLabelStyles = Object.assign({
|
|
|
45
64
|
const strokeLinecap = "round";
|
|
46
65
|
const strokeLinejoin = "round";
|
|
47
66
|
const grayscale = exports.grayscale = {
|
|
67
|
+
palette: {
|
|
68
|
+
colors,
|
|
69
|
+
grayscale: colorScale,
|
|
70
|
+
qualitative,
|
|
71
|
+
heatmap,
|
|
72
|
+
warm,
|
|
73
|
+
cool,
|
|
74
|
+
red,
|
|
75
|
+
green,
|
|
76
|
+
blue
|
|
77
|
+
},
|
|
48
78
|
area: Object.assign({
|
|
49
79
|
style: {
|
|
50
80
|
data: {
|
|
@@ -159,7 +189,7 @@ const grayscale = exports.grayscale = {
|
|
|
159
189
|
}
|
|
160
190
|
}, baseProps),
|
|
161
191
|
group: Object.assign({
|
|
162
|
-
colorScale
|
|
192
|
+
colorScale
|
|
163
193
|
}, baseProps),
|
|
164
194
|
histogram: Object.assign({
|
|
165
195
|
style: {
|
|
@@ -172,7 +202,7 @@ const grayscale = exports.grayscale = {
|
|
|
172
202
|
}
|
|
173
203
|
}, baseProps),
|
|
174
204
|
legend: {
|
|
175
|
-
colorScale
|
|
205
|
+
colorScale,
|
|
176
206
|
gutter: 10,
|
|
177
207
|
orientation: "vertical",
|
|
178
208
|
titleOrientation: "top",
|
|
@@ -207,7 +237,7 @@ const grayscale = exports.grayscale = {
|
|
|
207
237
|
padding: 20
|
|
208
238
|
})
|
|
209
239
|
},
|
|
210
|
-
colorScale
|
|
240
|
+
colorScale,
|
|
211
241
|
width: 400,
|
|
212
242
|
height: 400,
|
|
213
243
|
padding: 50
|
|
@@ -223,7 +253,7 @@ const grayscale = exports.grayscale = {
|
|
|
223
253
|
}
|
|
224
254
|
}, baseProps),
|
|
225
255
|
stack: Object.assign({
|
|
226
|
-
colorScale
|
|
256
|
+
colorScale
|
|
227
257
|
}, baseProps),
|
|
228
258
|
tooltip: {
|
|
229
259
|
style: Object.assign({}, baseLabelStyles, {
|
|
@@ -13,11 +13,31 @@ const lime300 = "#DCE775";
|
|
|
13
13
|
const lightGreen500 = "#8BC34A";
|
|
14
14
|
const teal700 = "#00796B";
|
|
15
15
|
const cyan900 = "#006064";
|
|
16
|
-
const
|
|
16
|
+
const colorScale = [deepOrange600, yellow200, lime300, lightGreen500, teal700, cyan900];
|
|
17
17
|
const blueGrey50 = "#ECEFF1";
|
|
18
18
|
const blueGrey300 = "#90A4AE";
|
|
19
19
|
const blueGrey700 = "#455A64";
|
|
20
20
|
const grey900 = "#212121";
|
|
21
|
+
const colors = {
|
|
22
|
+
blue: "#4F7DA1",
|
|
23
|
+
pink: "#E2A37F",
|
|
24
|
+
teal: teal700,
|
|
25
|
+
purple: "#DF948A",
|
|
26
|
+
green: lightGreen500,
|
|
27
|
+
orange: deepOrange600,
|
|
28
|
+
cyan: cyan900,
|
|
29
|
+
red: "#DF5A49",
|
|
30
|
+
yellow: yellow200
|
|
31
|
+
};
|
|
32
|
+
const grayscale = [blueGrey50, blueGrey300, blueGrey700, grey900];
|
|
33
|
+
const qualitative = ["#334D5C", "#45B29D", "#EFC94C", "#E27A3F", "#DF5A49", "#4F7DA1", "#55DBC1", "#EFDA97", "#E2A37F", "#DF948A"];
|
|
34
|
+
const heatmap = ["#428517", "#77D200", "#D6D305", "#EC8E19", "#C92B05"];
|
|
35
|
+
const warm = ["#940031", "#C43343", "#DC5429", "#FF821D", "#FFAF55"];
|
|
36
|
+
const cool = ["#2746B9", "#0B69D4", "#2794DB", "#31BB76", "#60E83B"];
|
|
37
|
+
const red = ["#FCAE91", "#FB6A4A", "#DE2D26", "#A50F15", "#750B0E"];
|
|
38
|
+
const green = ["#354722", "#466631", "#649146", "#8AB25C", "#A9C97E"];
|
|
39
|
+
const blue = ["#002C61", "#004B8F", "#006BC9", "#3795E5", "#65B4F4"];
|
|
40
|
+
|
|
21
41
|
// *
|
|
22
42
|
// * Typography
|
|
23
43
|
// *
|
|
@@ -55,6 +75,17 @@ const strokeDasharray = "10, 5";
|
|
|
55
75
|
const strokeLinecap = "round";
|
|
56
76
|
const strokeLinejoin = "round";
|
|
57
77
|
const material = exports.material = {
|
|
78
|
+
palette: {
|
|
79
|
+
colors,
|
|
80
|
+
grayscale,
|
|
81
|
+
qualitative,
|
|
82
|
+
heatmap,
|
|
83
|
+
warm,
|
|
84
|
+
cool,
|
|
85
|
+
red,
|
|
86
|
+
green,
|
|
87
|
+
blue
|
|
88
|
+
},
|
|
58
89
|
area: Object.assign({
|
|
59
90
|
style: {
|
|
60
91
|
data: {
|
|
@@ -187,7 +218,7 @@ const material = exports.material = {
|
|
|
187
218
|
}
|
|
188
219
|
}, baseProps),
|
|
189
220
|
group: Object.assign({
|
|
190
|
-
colorScale
|
|
221
|
+
colorScale
|
|
191
222
|
}, baseProps),
|
|
192
223
|
histogram: Object.assign({
|
|
193
224
|
style: {
|
|
@@ -200,7 +231,7 @@ const material = exports.material = {
|
|
|
200
231
|
}
|
|
201
232
|
}, baseProps),
|
|
202
233
|
legend: {
|
|
203
|
-
colorScale
|
|
234
|
+
colorScale,
|
|
204
235
|
gutter: 10,
|
|
205
236
|
orientation: "vertical",
|
|
206
237
|
titleOrientation: "top",
|
|
@@ -226,7 +257,7 @@ const material = exports.material = {
|
|
|
226
257
|
}
|
|
227
258
|
}, baseProps),
|
|
228
259
|
pie: Object.assign({
|
|
229
|
-
colorScale
|
|
260
|
+
colorScale,
|
|
230
261
|
style: {
|
|
231
262
|
data: {
|
|
232
263
|
padding,
|
|
@@ -250,7 +281,7 @@ const material = exports.material = {
|
|
|
250
281
|
}
|
|
251
282
|
}, baseProps),
|
|
252
283
|
stack: Object.assign({
|
|
253
|
-
colorScale
|
|
284
|
+
colorScale
|
|
254
285
|
}, baseProps),
|
|
255
286
|
tooltip: {
|
|
256
287
|
style: Object.assign({}, baseLabelStyles, {
|
|
@@ -59,7 +59,22 @@ export interface VictoryAxisCommonProps {
|
|
|
59
59
|
tickValues?: any[];
|
|
60
60
|
}
|
|
61
61
|
export declare type VerticalAnchorType = "start" | "middle" | "end";
|
|
62
|
+
declare type VictoryThemePaletteKeys = "blue" | "pink" | "teal" | "purple" | "green" | "orange" | "cyan" | "red" | "yellow";
|
|
63
|
+
export declare type VictoryThemePalette = {
|
|
64
|
+
[key in VictoryThemePaletteKeys]?: string;
|
|
65
|
+
};
|
|
62
66
|
export interface VictoryThemeDefinition {
|
|
67
|
+
palette?: {
|
|
68
|
+
colors?: VictoryThemePalette;
|
|
69
|
+
grayscale?: string[];
|
|
70
|
+
qualitative?: string[];
|
|
71
|
+
heatmap?: string[];
|
|
72
|
+
warm?: string[];
|
|
73
|
+
cool?: string[];
|
|
74
|
+
red?: string[];
|
|
75
|
+
blue?: string[];
|
|
76
|
+
green?: string[];
|
|
77
|
+
};
|
|
63
78
|
area?: {
|
|
64
79
|
style?: {
|
|
65
80
|
data?: VictoryStyleObject;
|
|
@@ -237,4 +252,5 @@ export interface VictoryThemeDefinition {
|
|
|
237
252
|
};
|
|
238
253
|
} & VictoryCommonThemeProps & VictoryDatableProps;
|
|
239
254
|
}
|
|
255
|
+
export {};
|
|
240
256
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { VictoryThemeDefinition } from "../victory-theme/victory-theme";
|
|
1
2
|
/**
|
|
2
3
|
* Given an object with CSS/SVG transform definitions, return the string value
|
|
3
4
|
* for use with the `transform` CSS property or SVG attribute. Note that we
|
|
@@ -13,7 +14,8 @@ export declare const toTransformString: (obj: any, ...more: any[]) => any;
|
|
|
13
14
|
* of 5 hex string values in that color scale. If no 'name' parameter
|
|
14
15
|
* is given, it will return the Victory default grayscale.
|
|
15
16
|
* @param {String} name The name of the color scale to return (optional).
|
|
17
|
+
* @param {Object} theme The theme object to retrieve the color scale from (optional).
|
|
16
18
|
* @returns {Array} An array of 5 hex string values composing a color scale.
|
|
17
19
|
*/
|
|
18
|
-
export declare function getColorScale(name
|
|
20
|
+
export declare function getColorScale(name?: string, theme?: VictoryThemeDefinition): string[];
|
|
19
21
|
//# sourceMappingURL=style.d.ts.map
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getColorScale = getColorScale;
|
|
7
7
|
exports.toTransformString = void 0;
|
|
8
|
+
var _victoryTheme = require("../victory-theme/victory-theme");
|
|
8
9
|
/**
|
|
9
10
|
* Given an object with CSS/SVG transform definitions, return the string value
|
|
10
11
|
* for use with the `transform` CSS property or SVG attribute. Note that we
|
|
@@ -41,19 +42,36 @@ const toTransformString = function (obj) {
|
|
|
41
42
|
* of 5 hex string values in that color scale. If no 'name' parameter
|
|
42
43
|
* is given, it will return the Victory default grayscale.
|
|
43
44
|
* @param {String} name The name of the color scale to return (optional).
|
|
45
|
+
* @param {Object} theme The theme object to retrieve the color scale from (optional).
|
|
44
46
|
* @returns {Array} An array of 5 hex string values composing a color scale.
|
|
45
47
|
*/
|
|
46
48
|
exports.toTransformString = toTransformString;
|
|
47
|
-
function getColorScale(name) {
|
|
49
|
+
function getColorScale(name, theme) {
|
|
50
|
+
if (theme === void 0) {
|
|
51
|
+
theme = _victoryTheme.VictoryTheme.material;
|
|
52
|
+
}
|
|
53
|
+
const {
|
|
54
|
+
palette: {
|
|
55
|
+
grayscale = ["#cccccc", "#969696", "#636363", "#252525"],
|
|
56
|
+
qualitative = [],
|
|
57
|
+
heatmap = [],
|
|
58
|
+
warm = [],
|
|
59
|
+
cool = [],
|
|
60
|
+
red = [],
|
|
61
|
+
blue = [],
|
|
62
|
+
green = []
|
|
63
|
+
} = {}
|
|
64
|
+
} = theme;
|
|
48
65
|
const scales = {
|
|
49
|
-
grayscale
|
|
50
|
-
qualitative
|
|
51
|
-
heatmap
|
|
52
|
-
warm
|
|
53
|
-
cool
|
|
54
|
-
red
|
|
55
|
-
blue
|
|
56
|
-
green
|
|
66
|
+
grayscale,
|
|
67
|
+
qualitative,
|
|
68
|
+
heatmap,
|
|
69
|
+
warm,
|
|
70
|
+
cool,
|
|
71
|
+
red,
|
|
72
|
+
blue,
|
|
73
|
+
green
|
|
57
74
|
};
|
|
58
|
-
|
|
75
|
+
const selectedScale = name && scales[name]?.length ? scales[name] : scales.grayscale;
|
|
76
|
+
return selectedScale;
|
|
59
77
|
}
|
|
@@ -14,9 +14,9 @@ export declare function getDomainFromChildren(props: any, axis: any, childCompon
|
|
|
14
14
|
export declare function getDomain(props: any, axis: any, childComponents: any): any;
|
|
15
15
|
export declare function getScale(props: any, axis: any, childComponents?: any): import("..").D3Scale<any>;
|
|
16
16
|
export declare function getAllEvents(props: any): any;
|
|
17
|
-
export declare function getColor(calculatedProps: any, child: any, index: any): any;
|
|
17
|
+
export declare function getColor(calculatedProps: any, child: any, index: any, theme: any): any;
|
|
18
18
|
export declare function getStyle(theme: any, style: any, role: any): any;
|
|
19
|
-
export declare function getChildStyle(child: any, index: any, calculatedProps: any): any;
|
|
19
|
+
export declare function getChildStyle(child: any, index: any, calculatedProps: any, theme: any): any;
|
|
20
20
|
export declare function getStringsFromCategories(childComponents: any, axis: any): any[];
|
|
21
21
|
export declare function getStringsFromData(childComponents: any): {
|
|
22
22
|
x: number[];
|
|
@@ -279,7 +279,9 @@ function getAllEvents(props) {
|
|
|
279
279
|
}
|
|
280
280
|
return events || [];
|
|
281
281
|
}
|
|
282
|
-
|
|
282
|
+
|
|
283
|
+
// eslint-disable-next-line max-params
|
|
284
|
+
function getColor(calculatedProps, child, index, theme) {
|
|
283
285
|
// check for styles first
|
|
284
286
|
const {
|
|
285
287
|
style
|
|
@@ -296,14 +298,16 @@ function getColor(calculatedProps, child, index) {
|
|
|
296
298
|
if (!colorScale && !color) {
|
|
297
299
|
return undefined;
|
|
298
300
|
}
|
|
299
|
-
const colors = Array.isArray(colorScale) ? colorScale : Style.getColorScale(colorScale);
|
|
301
|
+
const colors = Array.isArray(colorScale) ? colorScale : Style.getColorScale(colorScale, theme);
|
|
300
302
|
return color || colors[index % colors.length];
|
|
301
303
|
}
|
|
302
304
|
function getStyle(theme, style, role) {
|
|
303
305
|
const defaultStyle = theme && theme[role] && theme[role].style ? theme[role].style : {};
|
|
304
306
|
return Helpers.getStyles(style, defaultStyle);
|
|
305
307
|
}
|
|
306
|
-
|
|
308
|
+
|
|
309
|
+
// eslint-disable-next-line max-params
|
|
310
|
+
function getChildStyle(child, index, calculatedProps, theme) {
|
|
307
311
|
const {
|
|
308
312
|
style,
|
|
309
313
|
role
|
|
@@ -313,7 +317,7 @@ function getChildStyle(child, index, calculatedProps) {
|
|
|
313
317
|
return childStyle;
|
|
314
318
|
}
|
|
315
319
|
const childRole = child.type && child.type.role;
|
|
316
|
-
const defaultFill = childRole === "stack" ? undefined : getColor(calculatedProps, child, index);
|
|
320
|
+
const defaultFill = childRole === "stack" ? undefined : getColor(calculatedProps, child, index, theme);
|
|
317
321
|
const defaultColor = childRole === "line" ? {
|
|
318
322
|
fill: "none",
|
|
319
323
|
stroke: defaultFill
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-core",
|
|
3
|
-
"version": "37.
|
|
3
|
+
"version": "37.2.0",
|
|
4
4
|
"description": "Victory Core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data visualization",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"lodash": "^4.17.21",
|
|
24
24
|
"react-fast-compare": "^3.2.0",
|
|
25
|
-
"victory-vendor": "37.
|
|
25
|
+
"victory-vendor": "37.2.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": ">=16.6.0"
|
package/src/types/prop-types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { defaults } from "lodash";
|
|
2
|
+
import { defaults, uniqueId } from "lodash";
|
|
3
3
|
import * as Log from "../victory-util/log";
|
|
4
4
|
import * as Helpers from "../victory-util/helpers";
|
|
5
5
|
import { usePortalContext } from "./portal-context";
|
|
@@ -15,7 +15,7 @@ const defaultProps: Partial<VictoryPortalProps> = {
|
|
|
15
15
|
|
|
16
16
|
export const VictoryPortal = (initialProps: VictoryPortalProps) => {
|
|
17
17
|
const props = { ...defaultProps, ...initialProps };
|
|
18
|
-
const id =
|
|
18
|
+
const id = uniqueId();
|
|
19
19
|
const portalContext = usePortalContext();
|
|
20
20
|
|
|
21
21
|
if (!portalContext) {
|