@cdc/data-bite 4.23.9 → 4.23.10-alpha
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/cdcdatabite.js +1522 -1514
- package/index.html +1 -1
- package/package.json +3 -3
- package/src/CdcDataBite.jsx +4 -2
- package/src/components/EditorPanel.jsx +1 -0
package/index.html
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<!-- DATA PRESENTATION GALLERY: https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/data_bites.html#examples -->
|
|
17
17
|
<!-- <div class="react-container" data-config="/examples/gallery/calculated-average.json"></div> -->
|
|
18
18
|
<!-- <div class="react-container" data-config="/examples/gallery/calculated-with-pic.json"></div> -->
|
|
19
|
-
|
|
19
|
+
<div class="react-container" data-config="/examples/gallery/max-value.json"></div>
|
|
20
20
|
<!-- <div class="react-container" data-config="/examples/gallery/sum-of-data.json"></div> -->
|
|
21
21
|
|
|
22
22
|
<script type="module" src="./src/index.jsx"></script>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdc/data-bite",
|
|
3
|
-
"version": "4.23.
|
|
3
|
+
"version": "4.23.10-alpha",
|
|
4
4
|
"description": "React component for displaying a single piece of data in a card module",
|
|
5
5
|
"moduleName": "CdcDataBite",
|
|
6
6
|
"main": "dist/cdcdatabite",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"homepage": "https://github.com/CDCgov/cdc-open-viz#readme",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@cdc/core": "^4.23.
|
|
29
|
+
"@cdc/core": "^4.23.10-alpha",
|
|
30
30
|
"chroma": "0.0.1",
|
|
31
31
|
"chroma-js": "^2.1.0",
|
|
32
32
|
"html-react-parser": "^3.0.8",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"react": "^18.2.0",
|
|
40
40
|
"react-dom": "^18.2.0"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "47278535fb20bb4e6b3320f8075051bedc5bca8e"
|
|
43
43
|
}
|
package/src/CdcDataBite.jsx
CHANGED
|
@@ -87,7 +87,7 @@ const CdcDataBite = props => {
|
|
|
87
87
|
let response = configObj || (await (await fetch(configUrl)).json())
|
|
88
88
|
|
|
89
89
|
// If data is included through a URL, fetch that and store
|
|
90
|
-
let responseData = response.data ??
|
|
90
|
+
let responseData = response.data ?? []
|
|
91
91
|
|
|
92
92
|
if (response.dataUrl) {
|
|
93
93
|
response.dataUrl = `${response.dataUrl}?${cacheBustingString()}`
|
|
@@ -272,7 +272,9 @@ const CdcDataBite = props => {
|
|
|
272
272
|
if (typeof value === 'number') numericalData.push(value)
|
|
273
273
|
})
|
|
274
274
|
} else {
|
|
275
|
-
|
|
275
|
+
if (config.dataColumn && config.data) {
|
|
276
|
+
numericalData = config.data.map(item => Number(item[config.dataColumn]))
|
|
277
|
+
}
|
|
276
278
|
}
|
|
277
279
|
|
|
278
280
|
switch (dataFunction) {
|