@cdc/core 4.25.3-6 → 4.25.5-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.
Files changed (90) hide show
  1. package/assets/icon-close.svg +1 -1
  2. package/components/AdvancedEditor/AdvancedEditor.tsx +11 -9
  3. package/components/DataTable/DataTable.tsx +50 -31
  4. package/components/DataTable/components/CellAnchor.tsx +1 -1
  5. package/components/DataTable/components/ChartHeader.tsx +3 -2
  6. package/components/DataTable/components/MapHeader.tsx +1 -0
  7. package/components/DataTable/helpers/chartCellMatrix.tsx +2 -1
  8. package/components/DataTable/helpers/getChartCellValue.ts +11 -5
  9. package/components/DataTable/helpers/getDataSeriesColumns.ts +7 -3
  10. package/components/DataTable/helpers/mapCellMatrix.tsx +80 -39
  11. package/components/DataTable/helpers/tests/mapCellMatrix.test.ts +80 -0
  12. package/components/DownloadButton.tsx +17 -2
  13. package/components/EditorPanel/DataTableEditor.tsx +29 -19
  14. package/components/EditorPanel/Inputs.tsx +13 -4
  15. package/components/EditorPanel/VizFilterEditor/NestedDropdownEditor.tsx +2 -1
  16. package/components/EditorPanel/VizFilterEditor/VizFilterEditor.tsx +26 -1
  17. package/components/Filters/Filters.tsx +172 -421
  18. package/components/Filters/components/Dropdown.tsx +39 -0
  19. package/components/Filters/components/Tabs.tsx +82 -0
  20. package/components/Filters/helpers/getChangedFilters.ts +31 -0
  21. package/components/Filters/helpers/getNestedOptions.ts +2 -2
  22. package/components/Filters/helpers/getNewRuntime.ts +35 -0
  23. package/components/Filters/helpers/handleSorting.ts +2 -2
  24. package/components/Filters/helpers/tests/getChangedFilters.test.ts +92 -0
  25. package/components/Filters/helpers/tests/getNestedOptions.test.ts +31 -0
  26. package/components/Filters/helpers/tests/getNewRuntime.test.ts +82 -0
  27. package/components/Filters/index.ts +1 -1
  28. package/components/Layout/components/Visualization/index.tsx +3 -3
  29. package/components/Layout/components/Visualization/visualizations.scss +1 -1
  30. package/components/Legend/Legend.Gradient.tsx +66 -23
  31. package/components/MediaControls.jsx +14 -7
  32. package/components/MultiSelect/multiselect.styles.css +2 -0
  33. package/components/NestedDropdown/NestedDropdown.tsx +2 -2
  34. package/components/RichTooltip/RichTooltip.tsx +37 -0
  35. package/components/RichTooltip/richTooltip.css +16 -0
  36. package/components/Table/Table.tsx +142 -142
  37. package/components/Table/components/Row.tsx +1 -1
  38. package/components/Table/table.styles.css +10 -0
  39. package/components/_stories/DataTable.stories.tsx +9 -2
  40. package/components/_stories/Table.stories.tsx +1 -1
  41. package/components/_stories/styles.scss +0 -4
  42. package/components/elements/Button.jsx +4 -2
  43. package/components/ui/Accordion.jsx +8 -1
  44. package/components/ui/Title/index.tsx +4 -1
  45. package/components/ui/Title/{Title.scss → title.styles.css} +0 -2
  46. package/components/ui/_stories/Colors.stories.mdx +220 -0
  47. package/components/ui/_stories/IconGallery.stories.mdx +14 -0
  48. package/components/ui/_stories/Title.stories.tsx +29 -4
  49. package/components/ui/accordion.styles.css +3 -0
  50. package/data/colorPalettes.js +0 -1
  51. package/dist/cove-main.css +101 -159
  52. package/dist/cove-main.css.map +1 -1
  53. package/helpers/DataTransform.ts +2 -2
  54. package/helpers/addValuesToFilters.ts +1 -1
  55. package/helpers/constants.ts +6 -0
  56. package/helpers/cove/accessibility.ts +7 -8
  57. package/helpers/coveUpdateWorker.ts +17 -8
  58. package/helpers/filterOrderOptions.ts +17 -0
  59. package/helpers/formatConfigBeforeSave.ts +30 -8
  60. package/helpers/isNumber.ts +20 -0
  61. package/helpers/isRightAlignedTableValue.js +6 -2
  62. package/helpers/isSolr.ts +13 -0
  63. package/helpers/labelHash.ts +21 -0
  64. package/helpers/pivotData.ts +30 -18
  65. package/helpers/tests/formatConfigBeforeSave.test.ts +68 -0
  66. package/helpers/tests/pivotData.test.ts +96 -18
  67. package/helpers/ver/4.25.3.ts +43 -0
  68. package/helpers/ver/4.25.4.ts +33 -0
  69. package/helpers/ver/tests/4.25.4.test.ts +24 -0
  70. package/helpers/ver/tests/versionNeedsUpdate.test.ts +28 -0
  71. package/helpers/viewports.ts +4 -0
  72. package/package.json +2 -3
  73. package/styles/_global-variables.scss +5 -1
  74. package/styles/_global.scss +18 -9
  75. package/styles/_reset.scss +0 -6
  76. package/styles/base.scss +42 -0
  77. package/styles/filters.scss +5 -11
  78. package/styles/v2/components/button.scss +48 -12
  79. package/styles/v2/main.scss +0 -5
  80. package/styles/v2/themes/_color-definitions.scss +1 -4
  81. package/types/General.ts +1 -1
  82. package/types/Legend.ts +1 -0
  83. package/types/Table.ts +2 -0
  84. package/LICENSE +0 -201
  85. package/components/ui/_stories/Colors.stories.tsx +0 -92
  86. package/components/ui/_stories/Icon.stories.tsx +0 -29
  87. package/helpers/cove/fontSettings.ts +0 -2
  88. package/helpers/isNumber.js +0 -24
  89. package/helpers/isNumberLog.js +0 -18
  90. package/helpers/isSolr.js +0 -13
@@ -83,7 +83,7 @@ const DataTableEditor: React.FC<DataTableProps> = ({ config, updateField, isDash
83
83
  </Tooltip>
84
84
  }
85
85
  />
86
- {config.type !== 'table' ? (
86
+ {config.type !== 'table' && (
87
87
  <CheckBox
88
88
  value={config.table.show}
89
89
  fieldName='show'
@@ -108,15 +108,6 @@ const DataTableEditor: React.FC<DataTableProps> = ({ config, updateField, isDash
108
108
  </Tooltip>
109
109
  }
110
110
  />
111
- ) : (
112
- <CheckBox
113
- value={config.general?.showDownloadButton}
114
- fieldName='showDownloadButton'
115
- label='Show Download CSV link'
116
- section='general'
117
- updateField={updateField}
118
- className='column-heading'
119
- />
120
111
  )}
121
112
 
122
113
  {config.visualizationType !== 'Box Plot' && config.type !== 'table' && (
@@ -205,7 +196,7 @@ const DataTableEditor: React.FC<DataTableProps> = ({ config, updateField, isDash
205
196
  />
206
197
  )}
207
198
  {config?.visualizationType !== 'Sankey' && (
208
- <label>
199
+ <label onClick={e => e.preventDefault()}>
209
200
  <span className='edit-label column-heading mt-1'>Exclude Columns </span>
210
201
  <MultiSelect
211
202
  key={excludedColumns.join('') + 'excluded'}
@@ -234,6 +225,33 @@ const DataTableEditor: React.FC<DataTableProps> = ({ config, updateField, isDash
234
225
  updateField={updateField}
235
226
  />
236
227
  )}
228
+ <CheckBox
229
+ value={config.table.download}
230
+ fieldName='download'
231
+ label='Show Download CSV Link'
232
+ section='table'
233
+ updateField={updateField}
234
+ />
235
+ {config.table.download && (
236
+ <>
237
+ <CheckBox
238
+ value={config.table.showDownloadLinkBelow}
239
+ fieldName='showDownloadLinkBelow'
240
+ className='ms-4'
241
+ label='Show Link Below Table'
242
+ section='table'
243
+ updateField={updateField}
244
+ />
245
+ <CheckBox
246
+ value={config.table.downloadVisibleDataOnly}
247
+ fieldName='downloadVisibleDataOnly'
248
+ className='ms-4'
249
+ label='Download only visible data'
250
+ section='table'
251
+ updateField={updateField}
252
+ />
253
+ </>
254
+ )}
237
255
  {isDashboard && config.type !== 'table' && (
238
256
  <CheckBox
239
257
  value={config.table.showDataTableLink}
@@ -261,14 +279,6 @@ const DataTableEditor: React.FC<DataTableProps> = ({ config, updateField, isDash
261
279
  updateField={updateField}
262
280
  />
263
281
  )}
264
-
265
- <CheckBox
266
- value={config.table.showDownloadLinkBelow}
267
- fieldName='showDownloadLinkBelow'
268
- label='Show Download Link Below Table'
269
- section='table'
270
- updateField={updateField}
271
- />
272
282
  <label>
273
283
  <span className='edit-label column-heading'>Table Cell Min Width</span>
274
284
  <input
@@ -1,5 +1,6 @@
1
1
  import { memo, useEffect, useState } from 'react'
2
2
  import { useDebounce } from 'use-debounce'
3
+ import { DROPDOWN_STYLES } from '../Filters/components/Dropdown'
3
4
 
4
5
  export type Input = {
5
6
  label: string
@@ -117,9 +118,17 @@ const CheckBox = memo((props: CheckboxProps) => {
117
118
  return <></>
118
119
  }
119
120
  return (
120
- <label className='checkbox column-heading'>
121
+ <label
122
+ className='checkbox column-heading'
123
+ onClick={e => {
124
+ if (!['SPAN', 'INPUT'].includes(e.target.nodeName)) {
125
+ e.preventDefault()
126
+ }
127
+ }}
128
+ >
121
129
  <input
122
130
  type='checkbox'
131
+ className='edit-checkbox'
123
132
  name={fieldName}
124
133
  checked={value}
125
134
  onChange={e => {
@@ -160,7 +169,7 @@ const Select = memo((props: SelectProps) => {
160
169
  initial: initialValue,
161
170
  ...attributes
162
171
  } = props
163
- const optionsJsx = options.map((option, index) => {
172
+ const optionsJsx = options?.map((option, index) => {
164
173
  if (typeof option === 'string') {
165
174
  return (
166
175
  <option value={option} key={index}>
@@ -177,7 +186,7 @@ const Select = memo((props: SelectProps) => {
177
186
  })
178
187
 
179
188
  if (initialValue) {
180
- optionsJsx.unshift(
189
+ optionsJsx?.unshift(
181
190
  <option value='' key='initial'>
182
191
  {initialValue}
183
192
  </option>
@@ -194,7 +203,7 @@ const Select = memo((props: SelectProps) => {
194
203
  {tooltip}
195
204
  </span>
196
205
  <select
197
- className={`cove-form-select ${required && !value ? 'warning' : ''}`}
206
+ className={`cove-form-select ${required && !value ? 'warning' : ''} ${DROPDOWN_STYLES}`}
198
207
  name={fieldName}
199
208
  value={value}
200
209
  onChange={event => {
@@ -1,6 +1,7 @@
1
1
  import _ from 'lodash'
2
2
  import { SubGrouping, VizFilter, OrderBy } from '../../../types/VizFilter'
3
- import { filterOrderOptions, handleSorting } from '../../Filters'
3
+ import { handleSorting } from '../../Filters/helpers/handleSorting'
4
+ import { filterOrderOptions } from '../../../helpers/filterOrderOptions'
4
5
  import FilterOrder from './components/FilterOrder'
5
6
  import { Visualization } from '../../../types/Visualization'
6
7
  import { useMemo } from 'react'
@@ -5,7 +5,9 @@ import { Visualization } from '../../../types/Visualization'
5
5
  import { UpdateFieldFunc } from '../../../types/UpdateFieldFunc'
6
6
  import _ from 'lodash'
7
7
  import { MultiSelectFilter, VizFilter, VizFilterStyle } from '../../../types/VizFilter'
8
- import { filterStyleOptions, handleSorting, filterOrderOptions } from '../../Filters'
8
+ import { handleSorting } from '../../Filters/helpers/handleSorting'
9
+ import { filterOrderOptions } from '../../../helpers/filterOrderOptions'
10
+ import { filterStyleOptions } from '../../Filters'
9
11
  import FieldSetWrapper from '../FieldSetWrapper'
10
12
 
11
13
  import FilterOrder from './components/FilterOrder'
@@ -37,6 +39,15 @@ const VizFilterEditor: React.FC<VizFilterProps> = ({ config, updateField, rawDat
37
39
  updateField('filters', filterIndex, prop, value)
38
40
  }
39
41
 
42
+ const updateFilterDefaultValue = (index, value) => {
43
+ const filters = _.cloneDeep(config.filters)
44
+ const currentFilter = { ...filters[index], orderedValues: filters[index].values }
45
+ currentFilter.defaultValue = value
46
+ currentFilter.active = value
47
+ filters[index] = currentFilter
48
+ updateField(null, null, 'filters', filters)
49
+ }
50
+
40
51
  const updateFilterStyle = (index, style: VizFilterStyle) => {
41
52
  const filters = _.cloneDeep(config.filters)
42
53
  const currentFilter = { ...filters[index], orderedValues: filters[index].values }
@@ -160,6 +171,20 @@ const VizFilterEditor: React.FC<VizFilterProps> = ({ config, updateField, rawDat
160
171
  options={filterStyleOptions}
161
172
  />
162
173
 
174
+ <Select
175
+ value={filter.defaultValue}
176
+ options={
177
+ filter.resetLabel
178
+ ? [filter.resetLabel, ...config.filters?.[filterIndex].values]
179
+ : config.filters?.[filterIndex].values
180
+ }
181
+ updateField={(_section, _subSection, _key, value) => {
182
+ updateFilterDefaultValue(filterIndex, value)
183
+ }}
184
+ label='Filter Default Value'
185
+ initial='Select'
186
+ />
187
+
163
188
  {filter.filterStyle !== 'nested-dropdown' ? (
164
189
  <>
165
190
  <Select