@cdc/waffle-chart 4.25.7 → 4.25.10

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.
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import type { Meta, StoryObj } from '@storybook/react'
2
+ import type { Meta, StoryObj } from '@storybook/react-vite'
3
3
 
4
4
  import WaffleChart from '../CdcWaffleChart'
5
5
 
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect, memo, useContext } from 'react'
2
-
2
+ import cloneConfig from '@cdc/core/helpers/cloneConfig'
3
3
  import _ from 'lodash'
4
4
  import ErrorBoundary from '@cdc/core/components/ErrorBoundary'
5
5
 
@@ -108,7 +108,7 @@ const EditorPanel = memo(props => {
108
108
  }
109
109
 
110
110
  const convertStateToConfig = () => {
111
- let strippedState = _.cloneDeep(config)
111
+ let strippedState = cloneConfig(config)
112
112
  delete strippedState.newViz
113
113
  delete strippedState.runtime
114
114
 
package/src/index.jsx CHANGED
@@ -2,7 +2,6 @@ import React from 'react'
2
2
  import ReactDOM from 'react-dom/client'
3
3
 
4
4
  import '@cdc/core/styles/cove-main.scss'
5
- import './coreStyles_wafflechart.scss'
6
5
 
7
6
  import CdcWaffleChart from './CdcWaffleChart'
8
7
 
@@ -12,6 +11,10 @@ let domContainer = document.getElementsByClassName('react-container')[0]
12
11
 
13
12
  ReactDOM.createRoot(domContainer).render(
14
13
  <React.StrictMode>
15
- <CdcWaffleChart configUrl={domContainer.attributes['data-config'].value} isEditor={isEditor} />
14
+ <CdcWaffleChart
15
+ configUrl={domContainer.attributes['data-config'].value}
16
+ interactionLabel={domContainer.attributes['data-config'].value}
17
+ isEditor={isEditor}
18
+ />
16
19
  </React.StrictMode>
17
20
  )
@@ -1,6 +1,11 @@
1
- // Placeholder test until we add them in.
1
+ import path from 'path'
2
+ import { testStandaloneBuild } from '@cdc/core/helpers/tests/testStandaloneBuild.ts'
3
+ import { describe, it, expect } from 'vitest'
4
+
2
5
  describe('Waffle Chart', () => {
3
- it('has a test.', async () => {
4
- return true
6
+ it('Can be built in isolation', async () => {
7
+ const pkgDir = path.join(__dirname, '..')
8
+ const result = testStandaloneBuild(pkgDir)
9
+ expect(result).toBe(true)
5
10
  })
6
11
  })
@@ -0,0 +1,50 @@
1
+ [
2
+ {
3
+ "Deaths": "250",
4
+ "Total Overdoses": "600",
5
+ "state": "Alabama",
6
+ "Year": "2010"
7
+ },
8
+ {
9
+ "Deaths": "16",
10
+ "Total Overdoses": "80",
11
+ "state": "Alaska",
12
+ "Year": "2008"
13
+ },
14
+ {
15
+ "Deaths": "19",
16
+ "Total Overdoses": "100",
17
+ "state": "Alaska",
18
+ "Year": "2010"
19
+ },
20
+ {
21
+ "Deaths": "93",
22
+ "Total Overdoses": "400",
23
+ "state": "Alaska",
24
+ "Year": "2012"
25
+ },
26
+ {
27
+ "Deaths": "82",
28
+ "Total Overdoses": "400",
29
+ "state": "Arizona",
30
+ "Year": "2010"
31
+ },
32
+ {
33
+ "Deaths": "150",
34
+ "Total Overdoses": "350",
35
+ "state": "California",
36
+ "Year": "2010"
37
+ },
38
+ {
39
+ "Deaths": "45",
40
+ "Total Overdoses": "120",
41
+ "state": "Colorado",
42
+ "Year": "2010"
43
+ },
44
+ {
45
+ "Deaths": "33",
46
+ "Total Overdoses": "85",
47
+ "state": "Connecticut",
48
+ "Year": "2010"
49
+ }
50
+ ]
@@ -0,0 +1,41 @@
1
+ {
2
+ "type": "waffle-chart",
3
+ "dataUrl": "/packages/waffle-chart/tests/fixtures/example-data.json",
4
+ "shape": "person",
5
+ "title": "Test Waffle Chart Title",
6
+ "showTitle": true,
7
+ "content": "of overdoses resulted in death.",
8
+ "subtext": "This test data is for E2E testing",
9
+ "orientation": "horizontal",
10
+ "filters": [],
11
+ "fontSize": null,
12
+ "overallFontSize": "medium",
13
+ "dataColumn": "Deaths",
14
+ "dataFunction": "Sum",
15
+ "dataConditionalColumn": "",
16
+ "dataConditionalOperator": null,
17
+ "dataConditionalComparate": "",
18
+ "customDenom": true,
19
+ "dataDenom": null,
20
+ "dataDenomColumn": "Total Overdoses",
21
+ "dataDenomFunction": "Sum",
22
+ "prefix": "",
23
+ "suffix": "%",
24
+ "roundToPlace": 0,
25
+ "nodeWidth": 10,
26
+ "nodeSpacer": 2,
27
+ "theme": "theme-blue",
28
+ "visualizationType": "Waffle",
29
+ "visualizationSubType": "",
30
+ "invalidComparate": false,
31
+ "showDenominator": false,
32
+ "showPercent": true,
33
+ "valueDescription": "testing",
34
+ "visual": {
35
+ "border": true,
36
+ "accent": true,
37
+ "background": true,
38
+ "hideBackgroundColor": false,
39
+ "borderColorTheme": true
40
+ }
41
+ }
package/vite.config.js CHANGED
@@ -1,4 +1,4 @@
1
- import GenerateViteConfig from '../../generateViteConfig.js'
1
+ import GenerateViteConfig from '@cdc/core/generateViteConfig.js'
2
2
  import { moduleName } from './package.json'
3
3
 
4
4
  export default GenerateViteConfig(moduleName)
@@ -1,3 +0,0 @@
1
- @import '@cdc/core/styles/base';
2
- @import '@cdc/core/styles/heading-colors';
3
- @import '@cdc/core/styles/v2/themes/color-definitions';