@cdc/editor 1.4.2 → 1.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdc/editor",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "main": "dist/cdceditor",
5
5
  "bugs": {
6
6
  "url": "https://github.com/CDCgov/cdc-open-viz/issues"
@@ -16,16 +16,18 @@
16
16
  "build": "npx webpack --mode production --env packageName=CdcEditor --env folderName=editor -c ../../webpack.config.js",
17
17
  "prepublishOnly": "lerna run --scope @cdc/editor build"
18
18
  },
19
- "devDependencies": {
19
+ "dependencies": {
20
20
  "@babel/runtime": "^7.12.5",
21
21
  "@cdc/chart": "^1.3.2",
22
22
  "@cdc/core": "^1.1.2",
23
23
  "@cdc/dashboard": "^1.1.2",
24
24
  "@cdc/data-bite": "^1.1.2",
25
+ "@cdc/waffle-chart": "^1.0.0",
26
+ "@cdc/markup-include": "^1.0.0",
25
27
  "@cdc/map": "^2.6.2",
26
28
  "axios": "^0.21.1",
27
29
  "d3": "^7.0.0",
28
- "html-react-parser": "^0.14.0",
30
+ "html-react-parser": "1.4.9",
29
31
  "react-dropzone": "^11.2.4",
30
32
  "react-table": "^7.6.2",
31
33
  "use-debounce": "^5.2.0",
@@ -35,5 +37,8 @@
35
37
  "react": ">=16.8",
36
38
  "react-dom": ">=16"
37
39
  },
38
- "gitHead": "8790a2336ff2453d0d6f09ecec56b5e4beaa7377"
40
+ "resolutions": {
41
+ "@types/react": "17.x"
42
+ },
43
+ "gitHead": "170845062bcbb93f31270104688f69c4148935d8"
39
44
  }
package/src/CdcEditor.js CHANGED
@@ -15,7 +15,7 @@ import Tabs from './components/Tabs';
15
15
 
16
16
  import './scss/main.scss';
17
17
 
18
- export default function CdcEditor({ config: configObj = {newViz: true}, hostname }) {
18
+ export default function CdcEditor({ config: configObj = {newViz: true}, hostname, containerEl, sharepath }) {
19
19
  const [config, setConfig] = useState(configObj)
20
20
  const [tempConfig, setTempConfig] = useState(null)
21
21
  const [errors, setErrors] = useState([])
@@ -93,12 +93,13 @@ export default function CdcEditor({ config: configObj = {newViz: true}, hostname
93
93
  globalActive,
94
94
  setGlobalActive,
95
95
  tempConfig,
96
- setTempConfig
96
+ setTempConfig,
97
+ sharepath
97
98
  }
98
99
 
99
100
  return (
100
101
  <GlobalState.Provider value={state}>
101
- <div className={`cdc-open-viz-module cdc-editor ${currentViewport}`} ref={outerContainerRef}>
102
+ <div className={`cdc-open-viz-module cdc-editor ${currentViewport}`} ref={outerContainerRef} >
102
103
  <Tabs className="top-level" startingTab={globalActive}>
103
104
  <TabPane title="1. Import Data" className="data-designer">
104
105
  <DataImport />
@@ -107,7 +108,7 @@ export default function CdcEditor({ config: configObj = {newViz: true}, hostname
107
108
  <ChooseTab />
108
109
  </TabPane>
109
110
  <TabPane title="3. Configure" className="configure" disableRule={null === config.data || !config.type}>
110
- <ConfigureTab />
111
+ <ConfigureTab containerEl={containerEl }/>
111
112
  </TabPane>
112
113
  </Tabs>
113
114
  </div>
@@ -10,6 +10,10 @@ import PieIcon from '@cdc/core/assets/chart-pie-solid.svg';
10
10
  import GlobeIcon from '@cdc/core/assets/world-graphic.svg';
11
11
  import UsaIcon from '@cdc/core/assets/usa-graphic.svg';
12
12
  import DataBiteIcon from '@cdc/core/assets/data-bite-graphic.svg';
13
+ import WaffleChartIcon from '@cdc/core/assets/icon-grid.svg';
14
+ import MarkupIncludeIcon from '@cdc/core/assets/icon-code.svg';
15
+ import AlabamaGraphic from '@cdc/core/assets/alabama-graphic.svg';
16
+ import PairedBarIcon from '@cdc/core/assets/paired-bar.svg';
13
17
 
14
18
  export default function ChooseTab() {
15
19
  const {config, setConfig, setGlobalActive, tempConfig, setTempConfig} = useContext(GlobalState);
@@ -24,7 +28,7 @@ export default function ChooseTab() {
24
28
  /**
25
29
  * IconButton component
26
30
  */
27
- const IconButton = ({icon, label, type, subType}) => {
31
+ const IconButton = ({icon, label, type, subType, barType}) => {
28
32
  let isSubType = false
29
33
 
30
34
  if(type === 'map' && config.general) {
@@ -36,7 +40,7 @@ export default function ChooseTab() {
36
40
  isSubType = (subType === config.visualizationType)
37
41
  }
38
42
 
39
- if(type === 'dashboard' || type === 'data-bite') isSubType = true;
43
+ if(type === 'dashboard' || type === 'data-bite' || type === 'waffle-chart' || type === 'markup-include') isSubType = true;
40
44
 
41
45
  let classNames = (config.type === type && isSubType) ? 'active' : ''
42
46
 
@@ -47,6 +51,7 @@ export default function ChooseTab() {
47
51
  dataFileName: config.dataFileName,
48
52
  dataFileSourceType: config.dataFileSourceType,
49
53
  dataDescription: config.dataDescription,
54
+ dataUrl: config.dataUrl,
50
55
  newViz: true,
51
56
  type
52
57
  }
@@ -76,18 +81,22 @@ export default function ChooseTab() {
76
81
  <div className="heading-2">General</div>
77
82
  <ul className="grid">
78
83
  <li><IconButton label="Dashboard" type="dashboard" icon={ <DashboardIcon /> } /></li>
79
- <li><IconButton label="Data Bite" type="data-bite" icon={ <DataBiteIcon /> } /></li>
84
+ <li><IconButton label="Data Bite" type="data-bite" icon={<DataBiteIcon />} /></li>
85
+ <li><IconButton label="Waffle Chart" type="waffle-chart" icon={ <WaffleChartIcon /> } /></li>
86
+ <li><IconButton label="Markup Include" type="markup-include" icon={ <MarkupIncludeIcon /> } /></li>
80
87
  </ul>
81
88
  <div className="heading-2">Charts</div>
82
89
  <ul className="grid">
83
90
  <li><IconButton label="Bar" type="chart" subType="Bar" icon={ <BarIcon /> } /></li>
84
91
  <li><IconButton label="Line" type="chart" subType="Line" icon={ <LineIcon /> } /></li>
85
92
  <li><IconButton label="Pie" type="chart" subType="Pie" icon={ <PieIcon /> } /></li>
93
+ <li><IconButton label="Paired Bar" type="chart" subType="Paired Bar" icon={ <PairedBarIcon /> } /></li>
86
94
  </ul>
87
95
  <div className="heading-2">Maps</div>
88
96
  <ul className="grid">
89
- <li><IconButton label="United States" type="map" subType="us" icon={ <UsaIcon /> } /></li>
97
+ <li><IconButton label="United States (State- or County-Level)" type="map" subType="us" icon={ <UsaIcon /> } /></li>
90
98
  <li><IconButton label="World" type="map" subType="world" icon={ <GlobeIcon /> } /></li>
99
+ <li><IconButton label="U.S. State" type="map" subType="single-state" icon={ <AlabamaGraphic /> } /></li>
91
100
  </ul>
92
101
  </div>
93
102
  )
@@ -4,13 +4,15 @@ import CdcDashboard from '@cdc/dashboard'; // TODO: Lazy load this
4
4
  import CdcMap from '@cdc/map'; // TODO: Lazy load this
5
5
  import CdcChart from '@cdc/chart'; // TODO: Lazy load this
6
6
  import CdcDataBite from '@cdc/data-bite';
7
+ import CdcWaffleChart from '@cdc/waffle-chart'
8
+ import CdcMarkupInclude from '@cdc/markup-include'
7
9
 
8
10
  import '../scss/configure-tab.scss';
9
11
 
10
12
  import ErrorBoundary from '@cdc/core/components/ErrorBoundary';
11
13
  import GlobalState from '../context';
12
14
 
13
- export default function ConfigureTab() {
15
+ export default function ConfigureTab({containerEl}) {
14
16
  const { config, setTempConfig, hostname } = useContext(GlobalState);
15
17
 
16
18
  let { type } = config
@@ -19,7 +21,7 @@ export default function ConfigureTab() {
19
21
  case 'map':
20
22
  return (
21
23
  <ErrorBoundary component="CdcMap">
22
- <CdcMap isEditor={true} config={config} hostname={hostname} setConfig={setTempConfig} />
24
+ <CdcMap isEditor={true} config={config} hostname={hostname} setConfig={setTempConfig} containerEl={containerEl} />
23
25
  </ErrorBoundary>
24
26
  )
25
27
  case 'chart':
@@ -40,7 +42,19 @@ export default function ConfigureTab() {
40
42
  <CdcDataBite isEditor={true} config={config} setConfig={setTempConfig} />
41
43
  </ErrorBoundary>
42
44
  )
45
+ case 'waffle-chart':
46
+ return (
47
+ <ErrorBoundary component="CdcDashboard">
48
+ <CdcWaffleChart isEditor={true} config={config} setConfig={setTempConfig} />
49
+ </ErrorBoundary>
50
+ )
51
+ case 'markup-include':
52
+ return (
53
+ <ErrorBoundary component="CdcDashboard">
54
+ <CdcMarkupInclude isEditor={true} config={config} setConfig={setTempConfig} />
55
+ </ErrorBoundary>
56
+ )
43
57
  default:
44
58
  return <p>No visualization type selected.</p>
45
59
  }
46
- }
60
+ }