@cdc/filtered-text 4.24.5 → 4.24.9-1

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/filtered-text",
3
- "version": "4.24.5",
3
+ "version": "4.24.9-1",
4
4
  "description": "React component for adding filtered text on dashboards.",
5
5
  "moduleName": "CdcFilteredText",
6
6
  "main": "dist/cdcfilteredtext",
@@ -11,8 +11,9 @@
11
11
  "preview": "vite preview",
12
12
  "graph": "nx graph",
13
13
  "prepublishOnly": "lerna run --scope @cdc/filtered-text build",
14
- "test": "vitest watch --reporter verbose",
15
- "test:ui": "vitest --ui"
14
+ "test": "vitest run --reporter verbose",
15
+ "test-watch": "vitest watch --reporter verbose",
16
+ "test-watch:ui": "vitest --ui"
16
17
  },
17
18
  "repository": {
18
19
  "type": "git",
@@ -25,7 +26,7 @@
25
26
  "license": "Apache-2.0",
26
27
  "homepage": "https://github.com/CDCgov/cdc-open-viz#readme",
27
28
  "dependencies": {
28
- "@cdc/core": "^4.24.5",
29
+ "@cdc/core": "^4.24.9-1",
29
30
  "html-react-parser": "^3.0.8",
30
31
  "papaparse": "^5.3.2"
31
32
  },
@@ -33,5 +34,5 @@
33
34
  "react": "^18.2.0",
34
35
  "react-dom": "^18.2.0"
35
36
  },
36
- "gitHead": "def85aaf4cd9dc1983e80f2900199f35de82af95"
37
+ "gitHead": "4a77c2fa79c8fa6074da3b6dfee3d8e32f0b2586"
37
38
  }
@@ -14,6 +14,7 @@ import EditorPanel from './components/EditorPanel'
14
14
  import DataTransform from '@cdc/core/helpers/DataTransform'
15
15
  import useDataVizClasses from '@cdc/core/helpers/useDataVizClasses'
16
16
  import coveUpdateWorker from '@cdc/core/helpers/coveUpdateWorker'
17
+ import Layout from '@cdc/core/components/Layout'
17
18
 
18
19
  // external
19
20
  import parse from 'html-react-parser'
@@ -31,7 +32,7 @@ const CdcFilteredText = ({ config: configObj, configUrl, isDashboard = false, is
31
32
  let { title, filters } = config
32
33
  const fontSize = config.fontSize === 'small' ? '16px' : config.fontSize === 'medium' ? '22px' : '27px'
33
34
 
34
- const { contentClasses } = useDataVizClasses(config)
35
+ const { contentClasses, innerContainerClasses } = useDataVizClasses(config)
35
36
 
36
37
  // Default Functions
37
38
 
@@ -56,7 +57,7 @@ const CdcFilteredText = ({ config: configObj, configUrl, isDashboard = false, is
56
57
  }
57
58
 
58
59
  let newConfig = { ...config, ...response }
59
- const processedConfig = { ...(await coveUpdateWorker(newConfig)) }
60
+ const processedConfig = { ...coveUpdateWorker(newConfig) }
60
61
 
61
62
  updateConfig(processedConfig)
62
63
  setLoading(false)
@@ -118,27 +119,29 @@ const CdcFilteredText = ({ config: configObj, configUrl, isDashboard = false, is
118
119
  if (loading === false) {
119
120
  let body = (
120
121
  <>
121
- <Title classes={[`${config.theme}`]} title={title} style={{ fontSize }} />
122
- <div className={contentClasses.join(' ')}>
123
- <div className='cove-component__content-wrap'>
124
- {filterByTextColumn()
125
- .slice(0, 1)
126
- .map((el, i) => (
127
- <p style={{ fontSize }} key={i}>
128
- {' '}
129
- {parse(el[config.textColumn] || '')}{' '}
130
- </p>
131
- ))}
122
+ <Layout.Responsive isEditor={isEditor}>
123
+ <div className={`cove-component__content no-borders`}>
124
+ <Title classes={[`${config.theme}`]} title={title} style={{ fontSize }} />
125
+ <div className={`${contentClasses.join(' ')} body`}>
126
+ {filterByTextColumn()
127
+ .slice(0, 1)
128
+ .map((el, i) => (
129
+ <p style={{ fontSize }} key={i}>
130
+ {' '}
131
+ {parse(el[config.textColumn] || '')}{' '}
132
+ </p>
133
+ ))}
134
+ </div>
132
135
  </div>
133
- </div>
136
+ </Layout.Responsive>
134
137
  </>
135
138
  )
136
139
 
137
140
  content = (
138
- <div className={`cove ${config.theme} `}>
139
- {isEditor && <EditorPanel>{body}</EditorPanel>}
140
- {!isEditor && body}
141
- </div>
141
+ <>
142
+ {isEditor && <EditorPanel />}
143
+ {body}
144
+ </>
142
145
  )
143
146
  }
144
147
  const values = {
@@ -153,7 +156,11 @@ const CdcFilteredText = ({ config: configObj, configUrl, isDashboard = false, is
153
156
 
154
157
  return (
155
158
  <ErrorBoundary component='CdcFilteredText'>
156
- <ConfigContext.Provider value={values}>{content}</ConfigContext.Provider>
159
+ <ConfigContext.Provider value={values}>
160
+ <Layout.VisualizationWrapper config={config} isEditor={isEditor} showEditorPanel={config?.showEditorPanel}>
161
+ {content}
162
+ </Layout.VisualizationWrapper>
163
+ </ConfigContext.Provider>
157
164
  </ErrorBoundary>
158
165
  )
159
166
  }
@@ -1,9 +1,8 @@
1
1
  import React, { useState, useEffect, memo, useContext } from 'react'
2
2
 
3
- import ErrorBoundary from '@cdc/core/components/ErrorBoundary'
4
-
5
3
  import ConfigContext from '../ConfigContext'
6
4
 
5
+ import ErrorBoundary from '@cdc/core/components/ErrorBoundary'
7
6
  import Accordion from '@cdc/core/components/ui/Accordion'
8
7
  import InputText from '@cdc/core/components/inputs/InputText'
9
8
  import Button from '@cdc/core/components/elements/Button'
@@ -11,6 +10,7 @@ import Icon from '@cdc/core/components/ui/Icon'
11
10
  import Tooltip from '@cdc/core/components/ui/Tooltip'
12
11
  import InputSelect from '@cdc/core/components/inputs/InputSelect'
13
12
  import InputCheckbox from '@cdc/core/components/inputs/InputCheckbox'
13
+ import Layout from '@cdc/core/components/Layout'
14
14
  import { updateFieldFactory } from '@cdc/core/helpers/updateFieldFactory'
15
15
 
16
16
  import '@cdc/core/styles/v2/components/editor.scss'
@@ -97,6 +97,10 @@ const EditorPanel = memo(props => {
97
97
 
98
98
  const onBackClick = () => {
99
99
  setDisplayPanel(!displayPanel)
100
+ updateConfig({
101
+ ...config,
102
+ showEditorPanel: !displayPanel
103
+ })
100
104
  }
101
105
 
102
106
  const Error = () => {
@@ -248,20 +252,11 @@ const EditorPanel = memo(props => {
248
252
 
249
253
  return (
250
254
  <ErrorBoundary component='EditorPanel'>
251
- <div className='cove-editor'>
255
+ <Layout.Sidebar displayPanel={displayPanel} isDashboard={isDashboard} title={'Configure Filtered Text'} onBackClick={onBackClick}>
252
256
  {!config.newViz && config.runtime && config.runtime.editorErrorMessage && <Error />}
253
257
  {config.newViz && showConfigConfirm && <Confirm />}
254
- <button className={`cove-editor--toggle` + (!displayPanel ? ` collapsed` : ``)} title={displayPanel ? `Collapse Editor` : `Expand Editor`} onClick={onBackClick} />
255
- <section className={`cove-editor__panel` + (displayPanel ? `` : ' hidden')}>
256
- <div className='cove-editor__panel-container'>
257
- <h2 className='cove-editor__heading'>Configure Filtered Text</h2>
258
- <section className='cove-editor__content'>{editorContent}</section>
259
- </div>
260
- </section>
261
- <div className='cove-editor__content'>
262
- <div className='cove-editor__content-wrap'>{props.children}</div>
263
- </div>
264
- </div>
258
+ {editorContent}
259
+ </Layout.Sidebar>
265
260
  </ErrorBoundary>
266
261
  )
267
262
  })
@@ -1,4 +1,8 @@
1
- @import '@cdc/core/styles/v2/main';
1
+ @import '@cdc/core/styles/base';
2
+
3
+ .cdc-open-viz-module.isEditor {
4
+ background: transparent;
5
+ }
2
6
 
3
7
  .cove-accordion__panel-section {
4
8
  overflow: auto;
@@ -9,3 +13,14 @@
9
13
  margin-right: 5px;
10
14
  }
11
15
  }
16
+
17
+ .cdc-open-viz-module.type-filtered-text {
18
+ .cove-accordion__panel-section .cove-input__checkbox--small {
19
+ // float: initial;
20
+ // display: initial;
21
+ float: none;
22
+ }
23
+ .cove-component__content.body:not(:empty) {
24
+ padding: 1rem !important ;
25
+ }
26
+ }