@cdc/core 4.25.3 → 4.25.6-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 (89) hide show
  1. package/assets/icon-close.svg +1 -1
  2. package/components/Alert/components/Alert.tsx +1 -1
  3. package/components/DataTable/DataTable.tsx +18 -16
  4. package/components/DataTable/DataTableStandAlone.tsx +15 -9
  5. package/components/DataTable/components/CellAnchor.tsx +1 -1
  6. package/components/DataTable/components/ChartHeader.tsx +8 -5
  7. package/components/DataTable/components/DataTableEditorPanel.tsx +25 -3
  8. package/components/DataTable/components/MapHeader.tsx +1 -0
  9. package/components/DataTable/helpers/chartCellMatrix.tsx +14 -10
  10. package/components/DataTable/helpers/getChartCellValue.ts +42 -26
  11. package/components/DataTable/helpers/mapCellMatrix.tsx +25 -7
  12. package/components/DownloadButton.tsx +17 -2
  13. package/components/EditorPanel/DataTableEditor.tsx +1 -1
  14. package/components/EditorPanel/FootnotesEditor.tsx +76 -22
  15. package/components/EditorPanel/Inputs.tsx +12 -4
  16. package/components/EditorPanel/VizFilterEditor/NestedDropdownEditor.tsx +3 -2
  17. package/components/EditorPanel/VizFilterEditor/VizFilterEditor.tsx +51 -35
  18. package/components/Filters/Filters.tsx +158 -461
  19. package/components/Filters/components/Dropdown.tsx +39 -0
  20. package/components/Filters/components/Tabs.tsx +82 -0
  21. package/components/Filters/helpers/getChangedFilters.ts +31 -0
  22. package/components/Filters/helpers/getNestedOptions.ts +2 -2
  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/index.ts +1 -1
  27. package/components/Footnotes/Footnotes.tsx +1 -1
  28. package/components/Footnotes/FootnotesStandAlone.tsx +8 -33
  29. package/components/Layout/components/Visualization/index.tsx +4 -3
  30. package/components/Legend/Legend.Gradient.tsx +68 -24
  31. package/components/MultiSelect/MultiSelect.tsx +3 -6
  32. package/components/MultiSelect/multiselect.styles.css +2 -0
  33. package/components/NestedDropdown/NestedDropdown.tsx +21 -21
  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/ui/Accordion.jsx +8 -1
  43. package/components/ui/Title/index.tsx +4 -1
  44. package/components/ui/Title/{Title.scss → title.styles.css} +0 -2
  45. package/components/ui/_stories/Colors.stories.mdx +220 -0
  46. package/components/ui/_stories/IconGallery.stories.mdx +14 -0
  47. package/components/ui/_stories/Title.stories.tsx +29 -4
  48. package/components/ui/accordion.styles.css +3 -0
  49. package/data/colorPalettes.js +0 -1
  50. package/dist/cove-main.css +3 -8
  51. package/dist/cove-main.css.map +1 -1
  52. package/helpers/constants.ts +6 -0
  53. package/helpers/cove/accessibility.ts +7 -8
  54. package/helpers/cove/number.ts +5 -3
  55. package/helpers/coveUpdateWorker.ts +9 -1
  56. package/helpers/filterOrderOptions.ts +17 -0
  57. package/helpers/formatConfigBeforeSave.ts +19 -32
  58. package/helpers/isNumber.ts +20 -0
  59. package/helpers/isRightAlignedTableValue.js +1 -1
  60. package/helpers/pivotData.ts +16 -11
  61. package/helpers/tests/pivotData.test.ts +74 -0
  62. package/helpers/updateFieldFactory.ts +1 -0
  63. package/helpers/ver/4.25.3.ts +25 -2
  64. package/helpers/ver/4.25.4.ts +110 -0
  65. package/helpers/ver/4.25.6.ts +36 -0
  66. package/helpers/ver/4.25.7.ts +26 -0
  67. package/helpers/ver/tests/4.25.4.test.ts +89 -0
  68. package/helpers/ver/tests/4.25.6.test.ts +84 -0
  69. package/helpers/viewports.ts +4 -0
  70. package/package.json +7 -6
  71. package/styles/_global-variables.scss +3 -0
  72. package/styles/_global.scss +0 -4
  73. package/styles/_reset.scss +0 -6
  74. package/styles/filters.scss +0 -4
  75. package/styles/v2/main.scss +0 -5
  76. package/types/Axis.ts +2 -0
  77. package/types/DataSet.ts +14 -0
  78. package/types/Footnotes.ts +5 -2
  79. package/types/General.ts +1 -0
  80. package/types/Legend.ts +1 -0
  81. package/types/Table.ts +1 -0
  82. package/types/Visualization.ts +3 -12
  83. package/types/VizFilter.ts +3 -0
  84. package/components/ui/_stories/Colors.stories.tsx +0 -92
  85. package/components/ui/_stories/Icon.stories.tsx +0 -29
  86. package/helpers/cove/fontSettings.ts +0 -2
  87. package/helpers/isNumber.js +0 -24
  88. package/helpers/isNumberLog.js +0 -18
  89. /package/helpers/{fetchRemoteData.js → fetchRemoteData.ts} +0 -0
@@ -0,0 +1,14 @@
1
+ import { ConfigureData } from '@cdc/core/types/ConfigureData'
2
+
3
+ export type DataSet = ConfigureData & {
4
+ dataFileFormat?: string
5
+ dataFileName?: string
6
+ dataFileSize?: number
7
+ preview?: boolean
8
+ dataUrl: string
9
+ runtimeDataUrl: string
10
+ dataFileSourceType: string
11
+ loadQueryParam?: string // fetched from the browser's query string and appended to the dataUrl on load.
12
+ }
13
+
14
+ export type Datasets = Record<string, DataSet>
@@ -1,11 +1,14 @@
1
- import { Visualization } from './Visualization'
1
+ import { VizFilter } from './VizFilter'
2
2
 
3
3
  export type Footnote = {
4
4
  symbol?: string
5
5
  text: string
6
6
  }
7
7
 
8
- type Footnotes = Visualization & {
8
+ type Footnotes = {
9
+ filters?: VizFilter[]
10
+ dataKey?: string
11
+ data?: Object[]
9
12
  dynamicFootnotes?: {
10
13
  symbolColumn?: string
11
14
  textColumn: string
package/types/General.ts CHANGED
@@ -11,4 +11,5 @@ export type General = {
11
11
  showAnnotationDropdown?: boolean
12
12
  hideNullValue: boolean
13
13
  title: string
14
+ annotationDropdownText?: string
14
15
  }
package/types/Legend.ts CHANGED
@@ -15,4 +15,5 @@ export type Legend = {
15
15
  singleRow: boolean
16
16
  type: string
17
17
  verticalSorted: boolean
18
+ groupBy: string
18
19
  }
package/types/Table.ts CHANGED
@@ -8,6 +8,7 @@ export type Table = {
8
8
  cellMinWidth?: number
9
9
  collapsible?: boolean
10
10
  dateDisplayFormat?: string
11
+ showNonGeoData?: boolean
11
12
  download?: boolean
12
13
  downloadVisibleDataOnly?: boolean
13
14
  downloadImageButton?: boolean
@@ -10,6 +10,7 @@ import { FilterBehavior } from './FilterBehavior'
10
10
  import { General } from './General'
11
11
  import { Runtime } from './Runtime'
12
12
  import { DashboardFilters } from '@cdc/dashboard/src/types/DashboardFilters'
13
+ import Footnotes from './Footnotes'
13
14
 
14
15
  // This was originally created as a catchall for the different types of visualizations.
15
16
  // Currently it includes properties that ares specific to one Visualization type.
@@ -26,7 +27,6 @@ type DeprecatedVisualizationType = {
26
27
  filters: VizFilter[]
27
28
  general: General
28
29
  legend: Legend
29
- multiDashboards?: any[]
30
30
  newViz: boolean
31
31
  isResponsiveTicks: boolean
32
32
  openModal?: boolean
@@ -37,17 +37,7 @@ type DeprecatedVisualizationType = {
37
37
  table: Table
38
38
  theme: string
39
39
  title: string
40
- type:
41
- | 'dashboard'
42
- | 'chart'
43
- | 'footnotes'
44
- | 'map'
45
- | 'data-bite'
46
- | 'waffle-chart'
47
- | 'markup-include'
48
- | 'filtered-text'
49
- | 'table'
50
- | 'navigation'
40
+ type: 'chart' | 'map' | 'data-bite' | 'waffle-chart' | 'markup-include' | 'filtered-text' | 'table' | 'navigation'
51
41
  usesSharedFilter?: any
52
42
  visualizationSubType: string
53
43
  visualizationType: string
@@ -65,6 +55,7 @@ export type CommonVisualizationProperties = Partial<StatefulProperties> & {
65
55
  uid?: string | number // this is the actual key of the visualization object
66
56
  visualizationType?: string
67
57
  filterBehavior: FilterBehavior
58
+ footnotes?: Footnotes
68
59
  } & Partial<ConfigureData>
69
60
 
70
61
  export type Visualization = DeprecatedVisualizationType & CommonVisualizationProperties
@@ -30,6 +30,9 @@ export type GeneralFilter = FilterBase & {
30
30
  setByQueryParameter: string
31
31
  subGrouping: SubGrouping
32
32
  type: 'url'
33
+ filterFootnotes?: boolean
34
+ defaultValue?: string
35
+ resetLabel?: string
33
36
  }
34
37
 
35
38
  export type MultiSelectFilter = {
@@ -1,92 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
2
-
3
- const COLORS = [
4
- ['baseColor', '#333'],
5
- ['blue', '#005eaa'],
6
- ['lightestGray', '#f2f2f2'],
7
- ['lightGray', '#c7c7c7'],
8
- ['mediumGray', '#565656'],
9
- ['darkGray', '#333'],
10
- ['red', '#d8000c'],
11
- ['white', '#fff'],
12
-
13
- ['primary', '#005eaa'],
14
- ['secondary', '#88c3ea'],
15
- ['tertiary', '#c0e9ff'],
16
- ['quaternary', '#edf9ff'],
17
-
18
- ['purple-primary', '#712177'],
19
- ['purple-secondary', '#b890bb'],
20
- ['purple-tertiary', '#e3d3e4'],
21
- ['purple-quaternary', '#f7f2f7'],
22
-
23
- ['brown-primary', '#705043'],
24
- ['brown-secondary', '#ad907b'],
25
- ['brown-tertiary', '#d7ccc8'],
26
- ['brown-quaternary', '#f2ebe8'],
27
-
28
- ['teal-primary', '#00695c'],
29
- ['teal-secondary', '#4ebaaa'],
30
- ['teal-tertiary', '#ceece7'],
31
- ['teal-quaternary', '#ebf7f5'],
32
-
33
- ['pink-primary', '#af4448'],
34
- ['pink-secondary', '#e57373'],
35
- ['pink-tertiary', '#ffc2c2'],
36
- ['pink-quaternary', '#ffe7e7'],
37
-
38
- ['orange-primary', '#bb4d00'],
39
- ['orange-secondary', '#ffad42'],
40
- ['orange-tertiary', '#ffe97d'],
41
- ['orange-quaternary', '#fff4cf'],
42
-
43
- ['slate-primary', '#29434e'],
44
- ['slate-secondary', '#7e9ba5'],
45
- ['slate-tertiary', '#b6c6d2'],
46
- ['slate-quaternary', '#e2e8ed'],
47
-
48
- ['indigo-primary', '#26418f'],
49
- ['indigo-secondary', '#92a6dd'],
50
- ['indigo-tertiary', '#dee8ff'],
51
- ['indigo-quaternary', '#f2f6ff'],
52
-
53
- ['cyan-primary', '#006778'],
54
- ['cyan-secondary', '#65b0bd'],
55
- ['cyan-tertiary', '#cce5e9'],
56
- ['cyan-quaternary', '#ebf5f6'],
57
-
58
- ['green-primary', '#4b830d'],
59
- ['green-secondary', '#84bc49'],
60
- ['green-tertiary', '#dcedc8'],
61
- ['green-quaternary', '#f1f8e9'],
62
-
63
- ['amber-primary', '#fbab18'],
64
- ['amber-secondary', '#ffd54f'],
65
- ['amber-tertiary', '#ffecb3'],
66
- ['amber-quaternary', '#fff7e1']
67
- ]
68
-
69
- const ColorArray = () => {
70
- return (
71
- <table className='table'>
72
- {COLORS.map(([name, hex]) => (
73
- <tr>
74
- <td style={{ background: hex, width: '60px' }}></td>
75
- <td>{name}</td>
76
- <td>{hex}</td>
77
- </tr>
78
- ))}
79
- </table>
80
- )
81
- }
82
-
83
- const meta: Meta<typeof ColorArray> = {
84
- title: 'Components/Atoms/Colors',
85
- component: ColorArray
86
- }
87
-
88
- type Story = StoryObj<typeof ColorArray>
89
-
90
- export const Primary: Story = {}
91
-
92
- export default meta
@@ -1,29 +0,0 @@
1
- import React from 'react'
2
- import type { Meta, StoryObj } from '@storybook/react'
3
-
4
- import Icon, { ICON_TYPES } from '../Icon'
5
-
6
- const IconArray = () => {
7
- return (
8
- <>
9
- {ICON_TYPES.map(name => (
10
- <div>
11
- <span>
12
- <Icon display={name} /> {name}{' '}
13
- </span>
14
- </div>
15
- ))}
16
- </>
17
- )
18
- }
19
-
20
- const meta: Meta<typeof IconArray> = {
21
- title: 'Components/Atoms/Icon',
22
- component: IconArray
23
- }
24
-
25
- type Story = StoryObj<typeof Icon>
26
-
27
- export const Primary: Story = {}
28
-
29
- export default meta
@@ -1,2 +0,0 @@
1
- // TODO: handle with css
2
- export const appFontSize = 18
@@ -1,24 +0,0 @@
1
- /**
2
- * isNumber
3
- *
4
- * There are many ways this could be written but this one is working
5
- * to check if something is a number or not
6
- * Input: value
7
- *
8
- * Output: boolean: true or false
9
- */
10
- export default function isNumber(value = '') {
11
- // if you need to check data to see if there is junk in there that can't be handled
12
- // you can run the points through this and see values on the console
13
- // in debugging I saw cases where inbound was a 'number'
14
- // and other times a 'string' so might as well take care of both here
15
- if (typeof value === 'number') {
16
- return !Number.isNaN(value)
17
- }
18
- if (typeof value === 'string') {
19
- return value !== null && value !== '' && /\d+\.?\d*/.test(value)
20
- // regex explanation: if 1 or more digits, and a decimal followed by 0 or more digits,
21
- // then its a number
22
- }
23
- return false // if we get here something is wrong so return false
24
- }
@@ -1,18 +0,0 @@
1
- export default function isNumberLog(value = '', state = null) {
2
- // if you need to check data to see if there is junk in there that can't be handled
3
- // you can run the points through this and see values on the console
4
- console.log("entering isNumberLog value, valuetype:",value,typeof value);
5
- var test;
6
- if (typeof value === 'number') {
7
- test = !Number.isNaN(value)
8
- }
9
- if (typeof value === 'string') {
10
- test = value !== null && value !== '' && /\d+\.?\d*/.test(value)
11
- }
12
- if (test === false) {
13
- console.log('# isNumberLog FALSE on value, result', value, test)
14
- } else {
15
- console.log('# isNumberLog TRUE on value, result', value, test)
16
- }
17
- return test
18
- }