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/es/types/prop-types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import _uniqueId from "lodash/uniqueId";
|
|
1
2
|
import _defaults from "lodash/defaults";
|
|
2
|
-
import React from "react";
|
|
3
|
+
import React, { useState } from "react";
|
|
3
4
|
import * as Log from "../victory-util/log";
|
|
4
5
|
import * as Helpers from "../victory-util/helpers";
|
|
5
6
|
import { usePortalContext } from "./portal-context";
|
|
@@ -11,7 +12,7 @@ export const VictoryPortal = initialProps => {
|
|
|
11
12
|
...defaultProps,
|
|
12
13
|
...initialProps
|
|
13
14
|
};
|
|
14
|
-
const id =
|
|
15
|
+
const [id] = useState(_uniqueId());
|
|
15
16
|
const portalContext = usePortalContext();
|
|
16
17
|
if (!portalContext) {
|
|
17
18
|
const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
|
|
@@ -26,20 +26,16 @@ const orange = {
|
|
|
26
26
|
"100": "#FEE2D5",
|
|
27
27
|
"300": "#FFA981",
|
|
28
28
|
"500": "#FF6F2C",
|
|
29
|
+
"700": "#FF4E1B",
|
|
29
30
|
"900": "#D74D26"
|
|
30
31
|
};
|
|
31
32
|
const red = {
|
|
32
33
|
"100": "#FFDCE5",
|
|
33
34
|
"300": "#FF9EB7",
|
|
34
35
|
"500": "#F82B60",
|
|
36
|
+
"700": "#D31A3D",
|
|
35
37
|
"900": "#BA1E45"
|
|
36
38
|
};
|
|
37
|
-
const pink = {
|
|
38
|
-
"100": "#FFDAF6",
|
|
39
|
-
"300": "#F99DE2",
|
|
40
|
-
"500": "#FF08C2",
|
|
41
|
-
"900": "#B2158B"
|
|
42
|
-
};
|
|
43
39
|
const purple = {
|
|
44
40
|
"100": "#EDE3FE",
|
|
45
41
|
"300": "#CDB0FF",
|
|
@@ -50,6 +46,7 @@ const blue = {
|
|
|
50
46
|
"100": "#CFDFFF",
|
|
51
47
|
"300": "#9CC7FF",
|
|
52
48
|
"500": "#2D7FF9",
|
|
49
|
+
"700": "#0056B3",
|
|
53
50
|
"900": "#2750AE"
|
|
54
51
|
};
|
|
55
52
|
const cyan = {
|
|
@@ -68,9 +65,29 @@ const green = {
|
|
|
68
65
|
"100": "#D1F7C4",
|
|
69
66
|
"300": "#93E088",
|
|
70
67
|
"500": "#20C933",
|
|
68
|
+
"700": "#1B9B2A",
|
|
71
69
|
"900": "#338A17"
|
|
72
70
|
};
|
|
73
|
-
const colors =
|
|
71
|
+
const colors = {
|
|
72
|
+
blue: blue["500"],
|
|
73
|
+
cyan: cyan["500"],
|
|
74
|
+
green: green["500"],
|
|
75
|
+
yellow: yellow["500"],
|
|
76
|
+
orange: orange["500"],
|
|
77
|
+
red: red["500"],
|
|
78
|
+
purple: purple["500"],
|
|
79
|
+
teal: teal["500"]
|
|
80
|
+
};
|
|
81
|
+
const colorScale = Object.values(colors);
|
|
82
|
+
const grayscale = [gray["100"], gray["300"], gray["500"], gray["700"], gray["900"]];
|
|
83
|
+
const warm = [yellow["300"], yellow["500"], orange["500"], orange["900"], red["500"]];
|
|
84
|
+
const cool = [purple["500"], blue["500"], cyan["500"], teal["500"], green["500"]];
|
|
85
|
+
const heatmap = [green["900"], green["500"], yellow["500"], orange["500"], red["500"]];
|
|
86
|
+
const redPalette = Object.values(red);
|
|
87
|
+
const greenPalette = Object.values(green);
|
|
88
|
+
const bluePalette = Object.values(blue);
|
|
89
|
+
const defaultColor = blue["500"];
|
|
90
|
+
|
|
74
91
|
// *
|
|
75
92
|
// * Typography
|
|
76
93
|
// *
|
|
@@ -84,8 +101,8 @@ const padding = 8;
|
|
|
84
101
|
const baseProps = {
|
|
85
102
|
width: 450,
|
|
86
103
|
height: 300,
|
|
87
|
-
padding:
|
|
88
|
-
colorScale
|
|
104
|
+
padding: 60,
|
|
105
|
+
colorScale
|
|
89
106
|
};
|
|
90
107
|
// *
|
|
91
108
|
// * Labels
|
|
@@ -114,10 +131,23 @@ const borderRadius = 1;
|
|
|
114
131
|
// * Theme
|
|
115
132
|
// *
|
|
116
133
|
export const clean = {
|
|
134
|
+
palette: {
|
|
135
|
+
colors,
|
|
136
|
+
grayscale,
|
|
137
|
+
qualitative: colorScale,
|
|
138
|
+
heatmap,
|
|
139
|
+
warm,
|
|
140
|
+
cool,
|
|
141
|
+
red: redPalette,
|
|
142
|
+
green: greenPalette,
|
|
143
|
+
blue: bluePalette
|
|
144
|
+
},
|
|
117
145
|
area: Object.assign({
|
|
118
146
|
style: {
|
|
119
147
|
data: {
|
|
120
|
-
fill:
|
|
148
|
+
fill: defaultColor,
|
|
149
|
+
strokeWidth: 2,
|
|
150
|
+
fillOpacity: 0.5
|
|
121
151
|
},
|
|
122
152
|
labels: baseLabelStyles
|
|
123
153
|
}
|
|
@@ -126,13 +156,13 @@ export const clean = {
|
|
|
126
156
|
style: {
|
|
127
157
|
axis: {
|
|
128
158
|
fill: "transparent",
|
|
129
|
-
stroke: gray["
|
|
159
|
+
stroke: gray["500"],
|
|
130
160
|
strokeWidth: 1,
|
|
131
161
|
strokeLinecap,
|
|
132
162
|
strokeLinejoin
|
|
133
163
|
},
|
|
134
164
|
axisLabel: Object.assign({}, centeredLabelStyles, {
|
|
135
|
-
padding,
|
|
165
|
+
padding: 35,
|
|
136
166
|
stroke: "transparent"
|
|
137
167
|
}),
|
|
138
168
|
grid: {
|
|
@@ -151,10 +181,10 @@ export const clean = {
|
|
|
151
181
|
polarAxis: Object.assign({
|
|
152
182
|
style: {
|
|
153
183
|
axis: {
|
|
154
|
-
stroke: gray["
|
|
184
|
+
stroke: gray["500"]
|
|
155
185
|
},
|
|
156
186
|
grid: {
|
|
157
|
-
stroke: gray["
|
|
187
|
+
stroke: gray["400"],
|
|
158
188
|
strokeDasharray,
|
|
159
189
|
strokeLinecap,
|
|
160
190
|
strokeLinejoin,
|
|
@@ -163,7 +193,7 @@ export const clean = {
|
|
|
163
193
|
ticks: {
|
|
164
194
|
fill: "transparent",
|
|
165
195
|
size: 5,
|
|
166
|
-
stroke: gray["
|
|
196
|
+
stroke: gray["400"],
|
|
167
197
|
strokeWidth: 1,
|
|
168
198
|
strokeLinecap,
|
|
169
199
|
strokeLinejoin
|
|
@@ -174,10 +204,10 @@ export const clean = {
|
|
|
174
204
|
polarDependentAxis: Object.assign({
|
|
175
205
|
style: {
|
|
176
206
|
axis: {
|
|
177
|
-
stroke: gray["
|
|
207
|
+
stroke: gray["500"]
|
|
178
208
|
},
|
|
179
209
|
grid: {
|
|
180
|
-
stroke: gray["
|
|
210
|
+
stroke: gray["400"],
|
|
181
211
|
strokeDasharray,
|
|
182
212
|
strokeLinecap,
|
|
183
213
|
strokeLinejoin,
|
|
@@ -186,7 +216,7 @@ export const clean = {
|
|
|
186
216
|
ticks: {
|
|
187
217
|
fill: "transparent",
|
|
188
218
|
size: 5,
|
|
189
|
-
stroke: gray["
|
|
219
|
+
stroke: gray["300"],
|
|
190
220
|
strokeWidth: 1,
|
|
191
221
|
strokeLinecap,
|
|
192
222
|
strokeLinejoin
|
|
@@ -197,9 +227,10 @@ export const clean = {
|
|
|
197
227
|
bar: Object.assign({
|
|
198
228
|
style: {
|
|
199
229
|
data: {
|
|
200
|
-
fill:
|
|
230
|
+
fill: defaultColor,
|
|
201
231
|
padding,
|
|
202
|
-
strokeWidth:
|
|
232
|
+
strokeWidth: 1,
|
|
233
|
+
fillOpacity: 0.5
|
|
203
234
|
},
|
|
204
235
|
labels: baseLabelStyles
|
|
205
236
|
},
|
|
@@ -235,15 +266,16 @@ export const clean = {
|
|
|
235
266
|
}),
|
|
236
267
|
q1: {
|
|
237
268
|
padding,
|
|
238
|
-
fill:
|
|
239
|
-
rx: borderRadius
|
|
269
|
+
fill: colorScale[0],
|
|
270
|
+
rx: borderRadius,
|
|
271
|
+
strokeWidth: 2
|
|
240
272
|
},
|
|
241
273
|
q1Labels: Object.assign({}, baseLabelStyles, {
|
|
242
274
|
padding: 3
|
|
243
275
|
}),
|
|
244
276
|
q3: {
|
|
245
277
|
padding,
|
|
246
|
-
fill:
|
|
278
|
+
fill: colorScale[1],
|
|
247
279
|
rx: borderRadius
|
|
248
280
|
},
|
|
249
281
|
q3Labels: Object.assign({}, baseLabelStyles, {
|
|
@@ -264,8 +296,8 @@ export const clean = {
|
|
|
264
296
|
})
|
|
265
297
|
},
|
|
266
298
|
candleColors: {
|
|
267
|
-
positive:
|
|
268
|
-
negative:
|
|
299
|
+
positive: green["500"],
|
|
300
|
+
negative: red["500"]
|
|
269
301
|
},
|
|
270
302
|
wickStrokeWidth: 2
|
|
271
303
|
}, baseProps),
|
|
@@ -284,14 +316,13 @@ export const clean = {
|
|
|
284
316
|
}
|
|
285
317
|
}, baseProps),
|
|
286
318
|
group: Object.assign({
|
|
287
|
-
colorScale
|
|
319
|
+
colorScale
|
|
288
320
|
}, baseProps),
|
|
289
321
|
histogram: Object.assign({
|
|
290
322
|
style: {
|
|
291
323
|
data: {
|
|
292
324
|
fill: cyan["500"],
|
|
293
|
-
|
|
294
|
-
strokeWidth: 0
|
|
325
|
+
fillOpacity: 0.5
|
|
295
326
|
},
|
|
296
327
|
labels: baseLabelStyles
|
|
297
328
|
},
|
|
@@ -302,21 +333,23 @@ export const clean = {
|
|
|
302
333
|
}, baseProps),
|
|
303
334
|
label: baseLabelStyles,
|
|
304
335
|
legend: {
|
|
305
|
-
colorScale
|
|
306
|
-
gutter:
|
|
307
|
-
|
|
336
|
+
colorScale,
|
|
337
|
+
gutter: 24,
|
|
338
|
+
borderPadding: 10,
|
|
339
|
+
orientation: "horizontal",
|
|
308
340
|
titleOrientation: "top",
|
|
341
|
+
centerTitle: true,
|
|
309
342
|
style: {
|
|
310
343
|
data: {
|
|
311
344
|
type: "circle"
|
|
312
345
|
},
|
|
313
346
|
labels: {
|
|
314
347
|
...baseLabelStyles,
|
|
315
|
-
fontSize:
|
|
348
|
+
fontSize: 12
|
|
316
349
|
},
|
|
317
350
|
title: Object.assign({}, baseLabelStyles, {
|
|
318
351
|
padding,
|
|
319
|
-
fontSize:
|
|
352
|
+
fontSize: 16
|
|
320
353
|
}),
|
|
321
354
|
border: {
|
|
322
355
|
stroke: gray["200"],
|
|
@@ -330,7 +363,7 @@ export const clean = {
|
|
|
330
363
|
data: {
|
|
331
364
|
fill: "transparent",
|
|
332
365
|
opacity: 1,
|
|
333
|
-
stroke:
|
|
366
|
+
stroke: defaultColor,
|
|
334
367
|
strokeWidth: 2,
|
|
335
368
|
strokeLinecap,
|
|
336
369
|
strokeLinejoin
|
|
@@ -340,31 +373,40 @@ export const clean = {
|
|
|
340
373
|
}, baseProps),
|
|
341
374
|
pie: Object.assign({
|
|
342
375
|
style: {
|
|
376
|
+
parent: {
|
|
377
|
+
backgroundColor: gray.white
|
|
378
|
+
},
|
|
343
379
|
data: {
|
|
344
380
|
padding,
|
|
345
381
|
stroke: gray.white,
|
|
346
382
|
strokeWidth: 1
|
|
347
383
|
},
|
|
348
|
-
labels:
|
|
349
|
-
|
|
350
|
-
|
|
384
|
+
labels: {
|
|
385
|
+
...baseLabelStyles,
|
|
386
|
+
padding: 20,
|
|
387
|
+
fill: gray["600"],
|
|
388
|
+
fontSize: 10
|
|
389
|
+
}
|
|
351
390
|
},
|
|
352
|
-
colorScale
|
|
391
|
+
colorScale,
|
|
353
392
|
cornerRadius: borderRadius
|
|
354
393
|
}, baseProps),
|
|
355
394
|
scatter: Object.assign({
|
|
356
395
|
style: {
|
|
357
396
|
data: {
|
|
358
|
-
fill:
|
|
397
|
+
fill: defaultColor,
|
|
359
398
|
opacity: 1,
|
|
360
399
|
stroke: "transparent",
|
|
361
400
|
strokeWidth: 0
|
|
362
401
|
},
|
|
363
|
-
labels:
|
|
402
|
+
labels: {
|
|
403
|
+
...baseLabelStyles,
|
|
404
|
+
padding: 20
|
|
405
|
+
}
|
|
364
406
|
}
|
|
365
407
|
}, baseProps),
|
|
366
408
|
stack: Object.assign({
|
|
367
|
-
colorScale
|
|
409
|
+
colorScale
|
|
368
410
|
}, baseProps),
|
|
369
411
|
tooltip: {
|
|
370
412
|
style: Object.assign({}, baseLabelStyles, {
|
|
@@ -372,7 +414,7 @@ export const clean = {
|
|
|
372
414
|
pointerEvents: "none"
|
|
373
415
|
}),
|
|
374
416
|
flyoutStyle: {
|
|
375
|
-
stroke: gray["
|
|
417
|
+
stroke: gray["300"],
|
|
376
418
|
strokeWidth: 2,
|
|
377
419
|
fill: gray.white,
|
|
378
420
|
pointerEvents: "none"
|
|
@@ -389,8 +431,8 @@ export const clean = {
|
|
|
389
431
|
voronoi: Object.assign({
|
|
390
432
|
style: {
|
|
391
433
|
data: {
|
|
392
|
-
fill:
|
|
393
|
-
stroke:
|
|
434
|
+
fill: blue["100"],
|
|
435
|
+
stroke: defaultColor,
|
|
394
436
|
strokeWidth: 2
|
|
395
437
|
},
|
|
396
438
|
labels: Object.assign({}, baseLabelStyles, {
|
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
// *
|
|
2
2
|
// * Colors
|
|
3
3
|
// *
|
|
4
|
-
const colors =
|
|
4
|
+
const colors = {
|
|
5
|
+
blue: "#4F7DA1",
|
|
6
|
+
pink: "#E2A37F",
|
|
7
|
+
teal: "#00796B",
|
|
8
|
+
purple: "#DF948A",
|
|
9
|
+
green: "#8BC34A",
|
|
10
|
+
orange: "#F4511E",
|
|
11
|
+
cyan: "#006064",
|
|
12
|
+
red: "#DF5A49",
|
|
13
|
+
yellow: "#FFF59D"
|
|
14
|
+
};
|
|
15
|
+
const colorScale = ["#252525", "#525252", "#737373", "#969696", "#bdbdbd", "#d9d9d9", "#f0f0f0"];
|
|
5
16
|
const charcoal = "#252525";
|
|
6
17
|
const grey = "#969696";
|
|
18
|
+
const qualitative = ["#334D5C", "#45B29D", "#EFC94C", "#E27A3F", "#DF5A49", "#4F7DA1", "#55DBC1", "#EFDA97", "#E2A37F", "#DF948A"];
|
|
19
|
+
const heatmap = ["#428517", "#77D200", "#D6D305", "#EC8E19", "#C92B05"];
|
|
20
|
+
const warm = ["#940031", "#C43343", "#DC5429", "#FF821D", "#FFAF55"];
|
|
21
|
+
const cool = ["#2746B9", "#0B69D4", "#2794DB", "#31BB76", "#60E83B"];
|
|
22
|
+
const red = ["#FCAE91", "#FB6A4A", "#DE2D26", "#A50F15", "#750B0E"];
|
|
23
|
+
const green = ["#354722", "#466631", "#649146", "#8AB25C", "#A9C97E"];
|
|
24
|
+
const blue = ["#002C61", "#004B8F", "#006BC9", "#3795E5", "#65B4F4"];
|
|
25
|
+
|
|
7
26
|
// *
|
|
8
27
|
// * Typography
|
|
9
28
|
// *
|
|
@@ -17,7 +36,7 @@ const baseProps = {
|
|
|
17
36
|
width: 450,
|
|
18
37
|
height: 300,
|
|
19
38
|
padding: 50,
|
|
20
|
-
colorScale
|
|
39
|
+
colorScale
|
|
21
40
|
};
|
|
22
41
|
// *
|
|
23
42
|
// * Labels
|
|
@@ -39,6 +58,17 @@ const centeredLabelStyles = Object.assign({
|
|
|
39
58
|
const strokeLinecap = "round";
|
|
40
59
|
const strokeLinejoin = "round";
|
|
41
60
|
export const grayscale = {
|
|
61
|
+
palette: {
|
|
62
|
+
colors,
|
|
63
|
+
grayscale: colorScale,
|
|
64
|
+
qualitative,
|
|
65
|
+
heatmap,
|
|
66
|
+
warm,
|
|
67
|
+
cool,
|
|
68
|
+
red,
|
|
69
|
+
green,
|
|
70
|
+
blue
|
|
71
|
+
},
|
|
42
72
|
area: Object.assign({
|
|
43
73
|
style: {
|
|
44
74
|
data: {
|
|
@@ -153,7 +183,7 @@ export const grayscale = {
|
|
|
153
183
|
}
|
|
154
184
|
}, baseProps),
|
|
155
185
|
group: Object.assign({
|
|
156
|
-
colorScale
|
|
186
|
+
colorScale
|
|
157
187
|
}, baseProps),
|
|
158
188
|
histogram: Object.assign({
|
|
159
189
|
style: {
|
|
@@ -166,7 +196,7 @@ export const grayscale = {
|
|
|
166
196
|
}
|
|
167
197
|
}, baseProps),
|
|
168
198
|
legend: {
|
|
169
|
-
colorScale
|
|
199
|
+
colorScale,
|
|
170
200
|
gutter: 10,
|
|
171
201
|
orientation: "vertical",
|
|
172
202
|
titleOrientation: "top",
|
|
@@ -201,7 +231,7 @@ export const grayscale = {
|
|
|
201
231
|
padding: 20
|
|
202
232
|
})
|
|
203
233
|
},
|
|
204
|
-
colorScale
|
|
234
|
+
colorScale,
|
|
205
235
|
width: 400,
|
|
206
236
|
height: 400,
|
|
207
237
|
padding: 50
|
|
@@ -217,7 +247,7 @@ export const grayscale = {
|
|
|
217
247
|
}
|
|
218
248
|
}, baseProps),
|
|
219
249
|
stack: Object.assign({
|
|
220
|
-
colorScale
|
|
250
|
+
colorScale
|
|
221
251
|
}, baseProps),
|
|
222
252
|
tooltip: {
|
|
223
253
|
style: Object.assign({}, baseLabelStyles, {
|
|
@@ -7,11 +7,31 @@ const lime300 = "#DCE775";
|
|
|
7
7
|
const lightGreen500 = "#8BC34A";
|
|
8
8
|
const teal700 = "#00796B";
|
|
9
9
|
const cyan900 = "#006064";
|
|
10
|
-
const
|
|
10
|
+
const colorScale = [deepOrange600, yellow200, lime300, lightGreen500, teal700, cyan900];
|
|
11
11
|
const blueGrey50 = "#ECEFF1";
|
|
12
12
|
const blueGrey300 = "#90A4AE";
|
|
13
13
|
const blueGrey700 = "#455A64";
|
|
14
14
|
const grey900 = "#212121";
|
|
15
|
+
const colors = {
|
|
16
|
+
blue: "#4F7DA1",
|
|
17
|
+
pink: "#E2A37F",
|
|
18
|
+
teal: teal700,
|
|
19
|
+
purple: "#DF948A",
|
|
20
|
+
green: lightGreen500,
|
|
21
|
+
orange: deepOrange600,
|
|
22
|
+
cyan: cyan900,
|
|
23
|
+
red: "#DF5A49",
|
|
24
|
+
yellow: yellow200
|
|
25
|
+
};
|
|
26
|
+
const grayscale = [blueGrey50, blueGrey300, blueGrey700, grey900];
|
|
27
|
+
const qualitative = ["#334D5C", "#45B29D", "#EFC94C", "#E27A3F", "#DF5A49", "#4F7DA1", "#55DBC1", "#EFDA97", "#E2A37F", "#DF948A"];
|
|
28
|
+
const heatmap = ["#428517", "#77D200", "#D6D305", "#EC8E19", "#C92B05"];
|
|
29
|
+
const warm = ["#940031", "#C43343", "#DC5429", "#FF821D", "#FFAF55"];
|
|
30
|
+
const cool = ["#2746B9", "#0B69D4", "#2794DB", "#31BB76", "#60E83B"];
|
|
31
|
+
const red = ["#FCAE91", "#FB6A4A", "#DE2D26", "#A50F15", "#750B0E"];
|
|
32
|
+
const green = ["#354722", "#466631", "#649146", "#8AB25C", "#A9C97E"];
|
|
33
|
+
const blue = ["#002C61", "#004B8F", "#006BC9", "#3795E5", "#65B4F4"];
|
|
34
|
+
|
|
15
35
|
// *
|
|
16
36
|
// * Typography
|
|
17
37
|
// *
|
|
@@ -49,6 +69,17 @@ const strokeDasharray = "10, 5";
|
|
|
49
69
|
const strokeLinecap = "round";
|
|
50
70
|
const strokeLinejoin = "round";
|
|
51
71
|
export const material = {
|
|
72
|
+
palette: {
|
|
73
|
+
colors,
|
|
74
|
+
grayscale,
|
|
75
|
+
qualitative,
|
|
76
|
+
heatmap,
|
|
77
|
+
warm,
|
|
78
|
+
cool,
|
|
79
|
+
red,
|
|
80
|
+
green,
|
|
81
|
+
blue
|
|
82
|
+
},
|
|
52
83
|
area: Object.assign({
|
|
53
84
|
style: {
|
|
54
85
|
data: {
|
|
@@ -181,7 +212,7 @@ export const material = {
|
|
|
181
212
|
}
|
|
182
213
|
}, baseProps),
|
|
183
214
|
group: Object.assign({
|
|
184
|
-
colorScale
|
|
215
|
+
colorScale
|
|
185
216
|
}, baseProps),
|
|
186
217
|
histogram: Object.assign({
|
|
187
218
|
style: {
|
|
@@ -194,7 +225,7 @@ export const material = {
|
|
|
194
225
|
}
|
|
195
226
|
}, baseProps),
|
|
196
227
|
legend: {
|
|
197
|
-
colorScale
|
|
228
|
+
colorScale,
|
|
198
229
|
gutter: 10,
|
|
199
230
|
orientation: "vertical",
|
|
200
231
|
titleOrientation: "top",
|
|
@@ -220,7 +251,7 @@ export const material = {
|
|
|
220
251
|
}
|
|
221
252
|
}, baseProps),
|
|
222
253
|
pie: Object.assign({
|
|
223
|
-
colorScale
|
|
254
|
+
colorScale,
|
|
224
255
|
style: {
|
|
225
256
|
data: {
|
|
226
257
|
padding,
|
|
@@ -244,7 +275,7 @@ export const material = {
|
|
|
244
275
|
}
|
|
245
276
|
}, baseProps),
|
|
246
277
|
stack: Object.assign({
|
|
247
|
-
colorScale
|
|
278
|
+
colorScale
|
|
248
279
|
}, baseProps),
|
|
249
280
|
tooltip: {
|
|
250
281
|
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
|
package/es/victory-util/style.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { VictoryTheme } from "../victory-theme/victory-theme";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Given an object with CSS/SVG transform definitions, return the string value
|
|
3
5
|
* for use with the `transform` CSS property or SVG attribute. Note that we
|
|
@@ -34,18 +36,35 @@ export const toTransformString = function (obj) {
|
|
|
34
36
|
* of 5 hex string values in that color scale. If no 'name' parameter
|
|
35
37
|
* is given, it will return the Victory default grayscale.
|
|
36
38
|
* @param {String} name The name of the color scale to return (optional).
|
|
39
|
+
* @param {Object} theme The theme object to retrieve the color scale from (optional).
|
|
37
40
|
* @returns {Array} An array of 5 hex string values composing a color scale.
|
|
38
41
|
*/
|
|
39
|
-
export function getColorScale(name) {
|
|
42
|
+
export function getColorScale(name, theme) {
|
|
43
|
+
if (theme === void 0) {
|
|
44
|
+
theme = VictoryTheme.material;
|
|
45
|
+
}
|
|
46
|
+
const {
|
|
47
|
+
palette: {
|
|
48
|
+
grayscale = ["#cccccc", "#969696", "#636363", "#252525"],
|
|
49
|
+
qualitative = [],
|
|
50
|
+
heatmap = [],
|
|
51
|
+
warm = [],
|
|
52
|
+
cool = [],
|
|
53
|
+
red = [],
|
|
54
|
+
blue = [],
|
|
55
|
+
green = []
|
|
56
|
+
} = {}
|
|
57
|
+
} = theme;
|
|
40
58
|
const scales = {
|
|
41
|
-
grayscale
|
|
42
|
-
qualitative
|
|
43
|
-
heatmap
|
|
44
|
-
warm
|
|
45
|
-
cool
|
|
46
|
-
red
|
|
47
|
-
blue
|
|
48
|
-
green
|
|
59
|
+
grayscale,
|
|
60
|
+
qualitative,
|
|
61
|
+
heatmap,
|
|
62
|
+
warm,
|
|
63
|
+
cool,
|
|
64
|
+
red,
|
|
65
|
+
blue,
|
|
66
|
+
green
|
|
49
67
|
};
|
|
50
|
-
|
|
68
|
+
const selectedScale = name && scales[name]?.length ? scales[name] : scales.grayscale;
|
|
69
|
+
return selectedScale;
|
|
51
70
|
}
|
|
@@ -14,10 +14,10 @@ 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;
|
|
20
|
-
export declare function
|
|
19
|
+
export declare function getChildStyle(child: any, index: any, calculatedProps: any, theme: any): any;
|
|
20
|
+
export declare function getStringsFromChildrenCategories(childComponents: any, axis: any): any[];
|
|
21
21
|
export declare function getStringsFromData(childComponents: any): {
|
|
22
22
|
x: number[];
|
|
23
23
|
y: number[];
|