@cdc/waffle-chart 4.26.2 → 4.26.3
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/LICENSE +201 -0
- package/dist/cdcwafflechart.js +7817 -7156
- package/package.json +3 -3
- package/src/CdcWaffleChart.tsx +218 -160
- package/src/_stories/WaffleChart.Editor.stories.tsx +8 -7
- package/src/components/EditorPanel.jsx +36 -2
- package/src/data/initial-state.js +3 -1
- package/src/scss/main.scss +3 -10
- package/src/scss/waffle-chart.scss +72 -31
- package/src/test/CdcWaffleChart.test.jsx +2 -2
- package/src/types/Config.ts +4 -0
- package/src/images/callout-flag.svg +0 -7
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
.type-dashboard .type-waffle-chart .cove-component__content {
|
|
4
|
-
padding-top: 0;
|
|
5
|
-
}
|
|
1
|
+
@import '@cdc/core/styles/layout/wrapper-padding';
|
|
6
2
|
|
|
7
3
|
// Let core styles handle color palette
|
|
8
4
|
|
|
9
|
-
.cove {
|
|
5
|
+
.cove-visualization.type-waffle-chart {
|
|
6
|
+
|
|
7
|
+
.cove-waffle-chart__subtext.subtext,
|
|
8
|
+
.cove-waffle-chart__subtext.subtext.fst-italic {
|
|
9
|
+
line-height: var(--visualization-body-line-height);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.cove-visualization__body {
|
|
13
|
+
@include cove-visualization-body-padding;
|
|
14
|
+
}
|
|
15
|
+
|
|
10
16
|
.cove-gauge-chart {
|
|
11
17
|
&__chart {
|
|
12
|
-
width: 85%;
|
|
13
18
|
margin: 0 auto;
|
|
14
19
|
margin-left: auto;
|
|
15
20
|
height: auto;
|
|
@@ -25,7 +30,7 @@
|
|
|
25
30
|
|
|
26
31
|
&__subtext {
|
|
27
32
|
font-style: italic;
|
|
28
|
-
|
|
33
|
+
line-height: var(--visualization-body-line-height);
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
&__text {
|
|
@@ -37,7 +42,6 @@
|
|
|
37
42
|
.cove-waffle-chart {
|
|
38
43
|
display: flex;
|
|
39
44
|
flex-wrap: wrap;
|
|
40
|
-
padding: 1em 1em 0;
|
|
41
45
|
justify-content: flex-start;
|
|
42
46
|
|
|
43
47
|
&.cove-waffle-chart--verical {
|
|
@@ -52,14 +56,12 @@
|
|
|
52
56
|
|
|
53
57
|
.cove-waffle-chart__chart {
|
|
54
58
|
padding-right: 1rem;
|
|
55
|
-
margin-bottom: 1rem;
|
|
56
59
|
box-sizing: content-box;
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
.cove-waffle-chart__data {
|
|
60
63
|
flex: 1 1 0;
|
|
61
64
|
min-width: 175px;
|
|
62
|
-
margin-bottom: 1rem;
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
.cove-waffle-chart__data {
|
|
@@ -67,8 +69,6 @@
|
|
|
67
69
|
flex-wrap: wrap;
|
|
68
70
|
align-content: space-between;
|
|
69
71
|
|
|
70
|
-
font-size: 14px;
|
|
71
|
-
|
|
72
72
|
.cove-waffle-chart__data--primary {
|
|
73
73
|
font-size: 70px;
|
|
74
74
|
font-weight: 400;
|
|
@@ -134,9 +134,19 @@
|
|
|
134
134
|
// TP5 Style for Waffle Chart
|
|
135
135
|
.type-waffle-chart {
|
|
136
136
|
&.waffle__style--tp5 {
|
|
137
|
-
|
|
137
|
+
|
|
138
|
+
.cove-visualization__body,
|
|
139
|
+
.cove-visualization__body.component--has-legacy-border,
|
|
140
|
+
.cove-visualization__body.component--has-border-color-theme,
|
|
141
|
+
.cove-visualization__body.component--has-background,
|
|
142
|
+
.cove-visualization__body.component--has-accent {
|
|
143
|
+
padding: 0 !important;
|
|
138
144
|
background: none !important;
|
|
139
145
|
container-type: inline-size;
|
|
146
|
+
|
|
147
|
+
>.cove-visualization__body-wrap {
|
|
148
|
+
padding: 0 !important;
|
|
149
|
+
}
|
|
140
150
|
}
|
|
141
151
|
|
|
142
152
|
.cdc-callout {
|
|
@@ -144,7 +154,7 @@
|
|
|
144
154
|
margin: 0 !important;
|
|
145
155
|
padding: 1.5rem;
|
|
146
156
|
background-color: var(--colors-cyan-10, #eff9fa);
|
|
147
|
-
border: 1px solid
|
|
157
|
+
border: 1px solid #dff2f6 !important;
|
|
148
158
|
position: relative;
|
|
149
159
|
border-radius: 0.25rem;
|
|
150
160
|
flex-wrap: wrap;
|
|
@@ -193,6 +203,18 @@
|
|
|
193
203
|
.cove-waffle-chart__data {
|
|
194
204
|
margin-bottom: 0;
|
|
195
205
|
align-content: flex-start;
|
|
206
|
+
|
|
207
|
+
.cove-waffle-chart__data--primary {
|
|
208
|
+
font-size: 2rem;
|
|
209
|
+
color: var(--colors-cyan-60v);
|
|
210
|
+
font-weight: 400;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.cove-waffle-chart__data--text {
|
|
214
|
+
margin-top: 0.5rem;
|
|
215
|
+
font-size: 1rem;
|
|
216
|
+
line-height: 1.5rem;
|
|
217
|
+
}
|
|
196
218
|
}
|
|
197
219
|
|
|
198
220
|
.cdc-callout__heading {
|
|
@@ -201,25 +223,24 @@
|
|
|
201
223
|
font-size: 1.1rem;
|
|
202
224
|
}
|
|
203
225
|
|
|
204
|
-
.cove-waffle-chart__data--text {
|
|
205
|
-
margin-top: 0.5rem;
|
|
206
|
-
font-size: 1rem;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
226
|
.cove-waffle-chart__subtext {
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
.cove-waffle-chart__data--primary {
|
|
214
|
-
font-size: 2rem;
|
|
215
|
-
color: var(--colors-cyan-60v);
|
|
216
|
-
font-weight: 400;
|
|
227
|
+
margin-top: 1rem;
|
|
217
228
|
}
|
|
218
229
|
|
|
219
230
|
// White background variant (when "Use White Background Style" is checked)
|
|
220
231
|
&.white-background-style {
|
|
221
|
-
|
|
232
|
+
|
|
233
|
+
.cove-visualization__body,
|
|
234
|
+
.cove-visualization__body.component--has-legacy-border,
|
|
235
|
+
.cove-visualization__body.component--has-border-color-theme,
|
|
236
|
+
.cove-visualization__body.component--has-background,
|
|
237
|
+
.cove-visualization__body.component--has-accent {
|
|
238
|
+
padding: 0 !important;
|
|
222
239
|
background: white !important;
|
|
240
|
+
|
|
241
|
+
>.cove-visualization__body-wrap {
|
|
242
|
+
padding: 0 !important;
|
|
243
|
+
}
|
|
223
244
|
}
|
|
224
245
|
|
|
225
246
|
.cdc-callout {
|
|
@@ -232,9 +253,19 @@
|
|
|
232
253
|
|
|
233
254
|
// TP5 Style for Gauge Chart
|
|
234
255
|
&.gauge__style--tp5 {
|
|
235
|
-
|
|
256
|
+
|
|
257
|
+
.cove-visualization__body,
|
|
258
|
+
.cove-visualization__body.component--has-legacy-border,
|
|
259
|
+
.cove-visualization__body.component--has-border-color-theme,
|
|
260
|
+
.cove-visualization__body.component--has-background,
|
|
261
|
+
.cove-visualization__body.component--has-accent {
|
|
262
|
+
padding: 0 !important;
|
|
236
263
|
background: none !important;
|
|
237
264
|
container-type: inline-size;
|
|
265
|
+
|
|
266
|
+
>.cove-visualization__body-wrap {
|
|
267
|
+
padding: 0 !important;
|
|
268
|
+
}
|
|
238
269
|
}
|
|
239
270
|
|
|
240
271
|
.cdc-callout {
|
|
@@ -320,14 +351,24 @@
|
|
|
320
351
|
}
|
|
321
352
|
|
|
322
353
|
.cove-waffle-chart__subtext {
|
|
323
|
-
|
|
354
|
+
line-height: var(--visualization-body-line-height);
|
|
324
355
|
margin-top: auto;
|
|
325
356
|
}
|
|
326
357
|
|
|
327
358
|
// White background variant (when "Use White Background Style" is checked)
|
|
328
359
|
&.white-background-style {
|
|
329
|
-
|
|
360
|
+
|
|
361
|
+
.cove-visualization__body,
|
|
362
|
+
.cove-visualization__body.component--has-legacy-border,
|
|
363
|
+
.cove-visualization__body.component--has-border-color-theme,
|
|
364
|
+
.cove-visualization__body.component--has-background,
|
|
365
|
+
.cove-visualization__body.component--has-accent {
|
|
366
|
+
padding: 0 !important;
|
|
330
367
|
background: white !important;
|
|
368
|
+
|
|
369
|
+
>.cove-visualization__body-wrap {
|
|
370
|
+
padding: 0 !important;
|
|
371
|
+
}
|
|
331
372
|
}
|
|
332
373
|
|
|
333
374
|
.cdc-callout {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import path from 'path'
|
|
1
|
+
import path from 'node:path'
|
|
2
2
|
import { testStandaloneBuild } from '@cdc/core/helpers/tests/testStandaloneBuild.ts'
|
|
3
3
|
import { describe, it, expect } from 'vitest'
|
|
4
4
|
|
|
5
5
|
describe('Waffle Chart', () => {
|
|
6
6
|
it('Can be built in isolation', async () => {
|
|
7
7
|
const pkgDir = path.join(__dirname, '..')
|
|
8
|
-
const result = testStandaloneBuild(pkgDir)
|
|
8
|
+
const result = await testStandaloneBuild(pkgDir)
|
|
9
9
|
expect(result).toBe(true)
|
|
10
10
|
}, 300000)
|
|
11
11
|
})
|
package/src/types/Config.ts
CHANGED
|
@@ -16,6 +16,7 @@ export type Config = {
|
|
|
16
16
|
dataDenomFunction: string
|
|
17
17
|
dataFunction: string
|
|
18
18
|
dataUrl?: string
|
|
19
|
+
dataMetadata?: any
|
|
19
20
|
filters: any[]
|
|
20
21
|
// data point font size (main number)
|
|
21
22
|
fontSize: string
|
|
@@ -42,4 +43,7 @@ export type Config = {
|
|
|
42
43
|
visualizationSubType: 'linear' | ''
|
|
43
44
|
visualizationType: 'Gauge' | 'Waffle' | 'TP5 Waffle' | 'TP5 Gauge'
|
|
44
45
|
version: Version
|
|
46
|
+
locale: string
|
|
47
|
+
markupVariables?: any[]
|
|
48
|
+
enableMarkupVariables?: boolean
|
|
45
49
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" standalone="no"?>
|
|
2
|
-
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
|
3
|
-
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="481.000000pt" height="563.000000pt" viewBox="0 0 481.000000 563.000000" preserveAspectRatio="xMidYMid meet">
|
|
4
|
-
<g transform="translate(0.000000,563.000000) scale(0.100000,-0.100000)" fill="#2c7a99" stroke="none">
|
|
5
|
-
<path d="M890 5514 c-161 -43 -308 -201 -354 -381 -14 -55 -16 -314 -16 -2527 0 -2015 2 -2466 13 -2466 7 0 51 14 97 30 47 17 92 33 100 35 8 2 16 4 18 5 1 2 7 4 12 5 6 1 11 3 13 4 1 2 13 4 26 7 14 2 30 9 38 15 7 6 13 8 13 4 0 -4 7 -2 15 5 8 7 15 10 15 6 0 -3 17 1 38 10 49 21 856 293 905 305 21 5 45 13 55 19 9 5 40 16 67 24 28 8 162 52 299 99 l249 85 151 -53 c83 -29 253 -90 379 -134 264 -94 556 -198 974 -346 164 -58 308 -110 321 -115 13 -6 27 -10 33 -10 11 0 8 4951 -4 4994 -22 80 -84 183 -152 252 -75 76 -141 114 -233 133 -38 8 -477 11 -1535 10 -1268 0 -1490 -3 -1537 -15z m2687 -1570 c49 -31 82 -134 64 -201 -10 -37 -41 -64 -422 -369 -227 -181 -430 -341 -452 -356 -43 -30 -84 -35 -136 -17 -17 6 -156 107 -309 224 l-277 213 -40 -31 c-50 -39 -318 -259 -325 -267 -3 -3 -27 -24 -55 -45 -27 -22 -55 -44 -61 -50 -86 -77 -253 -202 -277 -207 -20 -4 -53 -1 -84 8 -69 19 -105 64 -111 140 -6 70 8 100 69 149 105 84 134 107 168 133 19 15 92 74 164 132 71 58 144 116 162 130 86 68 114 90 187 150 124 102 156 120 206 120 23 0 57 -7 75 -16 18 -9 145 -103 282 -209 283 -217 293 -224 303 -210 4 6 42 39 86 74 43 35 88 71 100 81 31 27 153 127 231 190 37 30 111 91 164 135 142 119 217 145 288 99z m-1431 -983 c60 -44 59 -29 62 -601 3 -596 4 -589 -70 -638 -76 -49 -171 -29 -228 50 l-30 41 0 526 c0 591 -3 569 75 623 35 25 48 28 100 25 44 -2 69 -9 91 -26z m1252 15 c37 -19 67 -55 81 -95 8 -25 10 -183 9 -555 -3 -579 -1 -555 -71 -603 -67 -45 -144 -35 -211 27 l-41 39 -3 543 -2 544 23 35 c46 68 149 99 215 65z m-610 -343 c71 -57 71 -57 71 -448 0 -322 -1 -353 -19 -392 -27 -60 -83 -95 -155 -95 -63 -1 -95 16 -132 72 -23 33 -23 36 -23 407 0 406 -1 401 57 455 34 32 54 38 116 34 35 -2 57 -11 85 -33z m-1313 -142 c54 -24 92 -71 100 -124 4 -23 5 -159 3 -302 -3 -293 -3 -293 -82 -343 -66 -41 -160 -30 -207 24 -34 40 -39 84 -39 361 0 303 3 322 61 366 53 39 105 45 164 18z"/>
|
|
6
|
-
</g>
|
|
7
|
-
</svg>
|