@cdc/core 4.24.9 → 4.24.11

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 (106) hide show
  1. package/LICENSE +201 -0
  2. package/assets/icon-combo-chart.svg +1 -0
  3. package/assets/icon-epi-chart.svg +27 -0
  4. package/components/AdvancedEditor/AdvancedEditor.tsx +17 -13
  5. package/components/Alert/components/Alert.tsx +34 -8
  6. package/components/BlurStrokeText.tsx +44 -0
  7. package/components/DataTable/DataTable.tsx +62 -36
  8. package/components/DataTable/DataTableStandAlone.tsx +37 -6
  9. package/components/DataTable/components/ChartHeader.tsx +31 -26
  10. package/components/DataTable/components/MapHeader.tsx +19 -10
  11. package/components/DataTable/components/SortIcon/index.tsx +25 -0
  12. package/components/DataTable/components/SortIcon/sort-icon.css +21 -0
  13. package/{styles/_data-table.scss → components/DataTable/data-table.css} +250 -298
  14. package/components/DataTable/helpers/boxplotCellMatrix.tsx +14 -13
  15. package/components/DataTable/helpers/customSort.ts +11 -15
  16. package/components/DataTable/helpers/getChartCellValue.ts +23 -5
  17. package/components/DataTable/helpers/getDataSeriesColumns.ts +5 -1
  18. package/components/DataTable/helpers/getNewSortBy.ts +35 -0
  19. package/components/DataTable/helpers/tests/customSort.test.ts +52 -0
  20. package/components/DataTable/helpers/tests/getNewSortBy.test.ts +26 -0
  21. package/components/EditorPanel/ColumnsEditor.tsx +81 -36
  22. package/components/EditorPanel/DataTableEditor.tsx +149 -43
  23. package/components/EditorPanel/FieldSetWrapper.tsx +2 -2
  24. package/components/EditorPanel/Inputs.tsx +68 -20
  25. package/components/EditorPanel/VizFilterEditor/NestedDropdownEditor.tsx +25 -7
  26. package/components/EditorPanel/VizFilterEditor/VizFilterEditor.tsx +30 -55
  27. package/components/{Filters.tsx → Filters/Filters.tsx} +60 -43
  28. package/components/Filters/helpers/applyQueuedActive.ts +12 -0
  29. package/components/Filters/helpers/getNestedOptions.ts +29 -0
  30. package/components/Filters/helpers/handleSorting.ts +18 -0
  31. package/components/Filters/helpers/tests/applyQueuedActive.test.ts +49 -0
  32. package/components/Filters/helpers/tests/getNestedOptions.test.ts +93 -0
  33. package/components/Filters/helpers/tests/handleSorting.test.ts +68 -0
  34. package/components/Filters/index.ts +5 -0
  35. package/components/Layout/components/Sidebar/components/sidebar.styles.scss +1 -7
  36. package/components/Layout/components/Visualization/visualizations.scss +1 -1
  37. package/components/Legend/Legend.Gradient.tsx +44 -36
  38. package/components/Loader/Loader.tsx +33 -0
  39. package/components/Loader/index.ts +1 -0
  40. package/components/Loader/loader.styles.css +13 -0
  41. package/components/MultiSelect/MultiSelect.tsx +85 -62
  42. package/components/MultiSelect/multiselect.styles.css +10 -7
  43. package/components/NestedDropdown/NestedDropdown.tsx +118 -56
  44. package/components/NestedDropdown/nestedDropdownHelpers.ts +34 -0
  45. package/components/NestedDropdown/nesteddropdown.styles.css +22 -13
  46. package/components/NestedDropdown/tests/nestedDropdownHelpers.test.ts +58 -0
  47. package/components/Table/Table.tsx +102 -34
  48. package/components/Table/components/GroupRow.tsx +1 -1
  49. package/components/_stories/BlurStrokeTest.stories.tsx +27 -0
  50. package/components/_stories/DataTable.stories.tsx +14 -0
  51. package/components/_stories/Filters.stories.tsx +57 -0
  52. package/components/_stories/NestedDropdown.stories.tsx +22 -46
  53. package/components/_stories/_mocks/DataTable/no-data.json +108 -0
  54. package/components/_stories/_mocks/nested-dropdown.json +30 -0
  55. package/components/_stories/styles.scss +0 -1
  56. package/components/ui/Icon.tsx +19 -6
  57. package/components/ui/{Tooltip.jsx → Tooltip.tsx} +38 -14
  58. package/data/colorPalettes.js +107 -10
  59. package/dist/cove-main.css +6080 -0
  60. package/dist/cove-main.css.map +1 -0
  61. package/helpers/DataTransform.ts +2 -1
  62. package/helpers/addValuesToFilters.ts +8 -3
  63. package/helpers/cove/{number.js → number.ts} +62 -27
  64. package/helpers/coveUpdateWorker.ts +6 -7
  65. package/helpers/fetchRemoteData.js +32 -37
  66. package/helpers/formatConfigBeforeSave.ts +17 -1
  67. package/helpers/gatherQueryParams.ts +12 -2
  68. package/helpers/pivotData.ts +52 -11
  69. package/helpers/queryStringUtils.ts +6 -0
  70. package/helpers/tests/gatherQueryParams.test.ts +34 -0
  71. package/helpers/tests/pivotData.test.ts +50 -0
  72. package/helpers/useDataVizClasses.ts +42 -20
  73. package/helpers/ver/4.24.10.ts +47 -0
  74. package/helpers/ver/4.24.9.ts +0 -3
  75. package/helpers/ver/tests/4.24.10.test.ts +45 -0
  76. package/helpers/viewports.ts +9 -0
  77. package/package.json +7 -3
  78. package/styles/_button-section.scss +5 -1
  79. package/styles/_global-variables.scss +20 -2
  80. package/styles/_global.scss +22 -30
  81. package/styles/_reset.scss +2 -26
  82. package/styles/base.scss +0 -1
  83. package/styles/cove-main.scss +6 -0
  84. package/styles/filters.scss +6 -26
  85. package/styles/v2/base/_reset.scss +0 -7
  86. package/styles/v2/components/editor.scss +0 -4
  87. package/styles/v2/components/icon.scss +1 -1
  88. package/styles/v2/components/ui/tooltip.scss +42 -40
  89. package/styles/v2/layout/_component.scss +0 -6
  90. package/styles/v2/layout/index.scss +0 -1
  91. package/types/Axis.ts +4 -0
  92. package/types/BoxPlot.ts +5 -3
  93. package/types/Color.ts +1 -1
  94. package/types/General.ts +1 -0
  95. package/types/Legend.ts +1 -2
  96. package/types/MarkupInclude.ts +1 -0
  97. package/types/Runtime.ts +3 -1
  98. package/types/Series.ts +8 -1
  99. package/types/Table.ts +3 -2
  100. package/types/Visualization.ts +19 -8
  101. package/types/VizFilter.ts +2 -1
  102. package/components/DataTable/components/Icons.tsx +0 -10
  103. package/components/_stories/EditorPanel.stories.tsx +0 -54
  104. package/components/_stories/Layout.Debug.stories.tsx +0 -91
  105. package/components/ui/Select.jsx +0 -30
  106. package/helpers/getGradientLegendWidth.ts +0 -15
@@ -1,5 +1,4 @@
1
1
  @import 'alert';
2
2
  @import 'component';
3
- @import 'data-table';
4
3
  @import 'progression';
5
4
  @import 'tooltip';
package/types/Axis.ts CHANGED
@@ -20,12 +20,14 @@ export type Axis = {
20
20
  label?: string
21
21
  labelOffset?: number
22
22
  labelPlacement?: string
23
+ labelsAboveGridlines?: boolean
23
24
  manual?: boolean
24
25
  manualStep?: number
25
26
  max?: string
26
27
  maxTickRotation?: number
27
28
  min?: string
28
29
  numTicks?: number
30
+ padding?: number
29
31
  paddingPercent?: number
30
32
  rightAxisSize?: number
31
33
  rightHideAxis?: boolean
@@ -39,6 +41,7 @@ export type Axis = {
39
41
  sortKey?: string
40
42
  showTargetLabel?: boolean
41
43
  size?: number
44
+ showYearsOnce?: boolean
42
45
  target?: number
43
46
  targetLabel?: string
44
47
  tickRotation?: number
@@ -46,4 +49,5 @@ export type Axis = {
46
49
  type: string
47
50
  axisBBox: number
48
51
  maxValue: string
52
+ sortByRecentDate: boolean
49
53
  }
package/types/BoxPlot.ts CHANGED
@@ -10,12 +10,14 @@ export type BoxPlot = {
10
10
  q3: string
11
11
  outliers: string
12
12
  values: string
13
- total: string
13
+ count: string
14
14
  lowerBounds: string
15
15
  upperBounds: string
16
16
  }
17
- plots: []
17
+ plotNonOutlierValues: boolean
18
+ plots: [{ columnOutliers: []; columnLowerBounds: number; columnUpperBounds: number }]
18
19
  categories: string[]
19
- firstQuartilePercentage: number
20
20
  geoType: string
21
+ hideOutliers: boolean
22
+ borders: string
21
23
  }
package/types/Color.ts CHANGED
@@ -2,4 +2,4 @@ type RGB = `rgb(${number}, ${number}, ${number})`
2
2
  type RGBA = `rgba(${number}, ${number}, ${number}, ${number})`
3
3
  type HEX = `#${string}`
4
4
 
5
- type Color = RGB | RGBA | HEX
5
+ export type Color = RGB | RGBA | HEX
package/types/General.ts CHANGED
@@ -8,6 +8,7 @@ export type General = {
8
8
  allowMapZoom?: boolean
9
9
  showMissingDataLabel: boolean
10
10
  showSuppressedSymbol: boolean
11
+ showZeroValueData: boolean
11
12
  showAnnotationDropdown?: boolean
12
13
  hideNullValue: boolean
13
14
  title: string
package/types/Legend.ts CHANGED
@@ -10,8 +10,7 @@ export type Legend = {
10
10
  hideSuppressedLabels: boolean
11
11
  highlightOnHover: boolean
12
12
  label: string
13
- lineMode: boolean
14
- position: string
13
+ position: 'left' | 'bottom' | 'top' | 'right' | 'side'
15
14
  reverseLabelOrder: boolean
16
15
  singleRow: boolean
17
16
  type: string
@@ -5,6 +5,7 @@ import { Visualization } from './Visualization'
5
5
  export type MarkupIncludeConfig = Visualization & {
6
6
  contentEditor: {
7
7
  // Changing the base config object creates an infinite loop, nesting it is a workaround
8
+ allowHideSection?: boolean
8
9
  inlineHTML: string
9
10
  markupVariables: Variable[]
10
11
  showHeader: boolean
package/types/Runtime.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Axis } from './Axis'
2
+ import { Series } from './Series'
2
3
 
3
4
  export type ForecastingSeriesKey = {
4
5
  stages: {
@@ -17,7 +18,8 @@ export type Runtime = {
17
18
  }
18
19
  xAxis: Axis
19
20
  yAxis: Axis
20
- seriesKeys: any[]
21
+ series: Series
22
+ seriesKeys: string[]
21
23
  seriesLabels: Record<string, any>
22
24
  seriesLabelsAll: string[]
23
25
  editorErrorMessage: string
package/types/Series.ts CHANGED
@@ -1 +1,8 @@
1
- export type Series = { dataKey: string; name: string; axis: string; type: string; tooltip: boolean }[]
1
+ export type Series = {
2
+ dataKey: string
3
+ name: string
4
+ axis: string
5
+ type: string
6
+ tooltip: boolean
7
+ dynamicCategory?: string
8
+ }[]
package/types/Table.ts CHANGED
@@ -1,6 +1,6 @@
1
- type Pivot = {
1
+ export type Pivot = {
2
2
  columnName: string
3
- valueColumn: string
3
+ valueColumns: string[]
4
4
  }
5
5
 
6
6
  export type Table = {
@@ -23,6 +23,7 @@ export type Table = {
23
23
  show?: boolean
24
24
  showDataTableLink?: boolean
25
25
  showDownloadImgButton?: boolean
26
+ showDownloadLinkBelow?: boolean
26
27
  showDownloadPdfButton?: boolean
27
28
  showDownloadUrl?: boolean
28
29
  showVertical?: boolean
@@ -19,25 +19,36 @@ import { DashboardFilters } from '@cdc/dashboard/src/types/DashboardFilters'
19
19
  type DeprecatedVisualizationType = {
20
20
  columns: Record<string, Partial<Column>>
21
21
  confidenceKeys: ConfidenceInterval
22
- dataFileName: string
23
- dataFileSourceType: string
22
+ dataFileName?: string
23
+ dataFileSourceType?: string
24
24
  dataFormat: any
25
- datasets: Record<string, any>
25
+ datasets?: Record<string, any>
26
26
  filters: VizFilter[]
27
27
  general: General
28
28
  legend: Legend
29
29
  multiDashboards?: any[]
30
30
  newViz: boolean
31
- openModal: boolean
31
+ isResponsiveTicks: boolean
32
+ openModal?: boolean
32
33
  orientation: 'vertical' | 'horizontal'
33
- originalFormattedData: any
34
+ originalFormattedData?: any
34
35
  runtime?: Runtime
35
36
  series: Series
36
37
  table: Table
37
38
  theme: string
38
39
  title: string
39
- type: 'dashboard' | 'chart' | 'footnotes' | 'map' | 'data-bite' | 'waffle-chart' | 'markup-include' | 'filtered-text' | 'table' | 'navigation'
40
- usesSharedFilter: any
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'
51
+ usesSharedFilter?: any
41
52
  visualizationSubType: string
42
53
  visualizationType: string
43
54
  xAxis: Axis
@@ -51,7 +62,7 @@ type StatefulProperties = {
51
62
 
52
63
  export type CommonVisualizationProperties = Partial<StatefulProperties> & {
53
64
  showEditorPanel?: boolean
54
- uid?: string // this is the actual key of the visualization object
65
+ uid?: string | number // this is the actual key of the visualization object
55
66
  visualizationType?: string
56
67
  filterBehavior: FilterBehavior
57
68
  } & Partial<ConfigureData>
@@ -2,6 +2,7 @@ export type OrderBy = 'asc' | 'desc' | 'cust'
2
2
 
3
3
  export type FilterBase = {
4
4
  columnName: string
5
+ orderedValues?: string[]
5
6
  values: string[]
6
7
  showDropdown: boolean
7
8
  id: number
@@ -18,7 +19,7 @@ export type VizFilterStyle =
18
19
  | 'nested-dropdown'
19
20
  export type GeneralFilter = FilterBase & {
20
21
  active: string
21
- queuedActive: string
22
+ queuedActive: string | string[]
22
23
  filterStyle: VizFilterStyle
23
24
  label: string
24
25
  order: OrderBy
@@ -1,10 +0,0 @@
1
- export const UpIcon = () => (
2
- <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 5'>
3
- <path d='M0 5l5-5 5 5z' />
4
- </svg>
5
- )
6
- export const DownIcon = () => (
7
- <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 5'>
8
- <path d='M0 0l5 5 5-5z' />
9
- </svg>
10
- )
@@ -1,54 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react'
2
-
3
- import DataTableEditor from '../EditorPanel/DataTableEditor'
4
- import { Accordion, AccordionItem, AccordionItemButton, AccordionItemHeading, AccordionItemPanel } from 'react-accessible-accordion'
5
- import { useState } from 'react'
6
-
7
- const EditorPanel = () => {
8
- const { config, isDashboard } = Primary.args
9
- const [_config, setConfig] = useState(config)
10
- const updateField = (section, subsection, fieldName, value) => {
11
- setConfig({
12
- ..._config,
13
- [section]: {
14
- ..._config[section],
15
- [fieldName]: value
16
- }
17
- })
18
- }
19
- return (
20
- <Accordion>
21
- <AccordionItem>
22
- <AccordionItemHeading>
23
- <AccordionItemButton>Data Table</AccordionItemButton>
24
- </AccordionItemHeading>
25
- <AccordionItemPanel>
26
- <DataTableEditor config={_config} isDashboard={isDashboard} updateField={updateField} isLoadedFromUrl={false} />
27
- </AccordionItemPanel>
28
- </AccordionItem>
29
- </Accordion>
30
- )
31
- }
32
-
33
- const meta: Meta<typeof DataTableEditor> = {
34
- title: 'Components/Organisms/EditorPanel',
35
- component: EditorPanel
36
- }
37
-
38
- export default meta
39
-
40
- type Story = StoryObj<typeof DataTableEditor>
41
-
42
- export const Primary: Story = {
43
- args: {
44
- config: {
45
- table: {
46
- label: 'Data Table',
47
- show: true
48
- },
49
- columns: {},
50
- visualizationType: 'Pie'
51
- },
52
- isDashboard: true
53
- }
54
- }
@@ -1,91 +0,0 @@
1
- import React from 'react'
2
- import { Meta, StoryObj } from '@storybook/react'
3
- import './styles.scss'
4
- import CdcChart from '@cdc/chart'
5
- import CdcMap from '@cdc/map'
6
- import CdcMarkupInclude from '@cdc/markup-include'
7
- import CdcFilteredText from '@cdc/filtered-text'
8
- import CdcDashboard from '@cdc/dashboard'
9
- import CdcWaffleChart from '@cdc/waffle-chart'
10
- import config from './../../../chart/src/_stories/_mock/bar-chart-suppressed.json'
11
- import mapConfig from './../../../map/examples/default-usa.json'
12
- import markupConfig from './../../../markup-include/src/data/initial-state.js'
13
- import filteredTextConfig from './_mocks/filtered-text-config.json'
14
- import waffleChartConfig from './../../../waffle-chart/examples/gallery/count.json'
15
- import dashboardConfig from './../../../dashboard/examples/full-dashboard.json'
16
-
17
- // Determine the component based on config.type
18
- const getComponent = config => {
19
- switch (config.type) {
20
- case 'map':
21
- return CdcMap
22
- case 'chart':
23
- return CdcChart
24
- case 'markup-include':
25
- return CdcMarkupInclude
26
- case 'waffle-chart':
27
- return CdcWaffleChart
28
- case 'dashboard':
29
- return CdcDashboard
30
- default:
31
- return () => <div>Unknown component type</div>
32
- }
33
- }
34
-
35
- const meta = {
36
- title: 'Components/Templates/Layout/Debug',
37
- component: args => {
38
- const Component = getComponent(args.config)
39
- return (
40
- <div className=''>
41
- <Component {...args} />
42
- </div>
43
- )
44
- }
45
- } as Meta
46
-
47
- export default meta
48
-
49
- type Story = StoryObj
50
-
51
- export const Chart: Story = {
52
- args: {
53
- config,
54
- isEditor: true
55
- }
56
- }
57
-
58
- export const Map: Story = {
59
- args: {
60
- config: mapConfig,
61
- isEditor: true
62
- }
63
- }
64
-
65
- export const MarkupInclude: StoryObj<typeof CdcMarkupInclude> = {
66
- args: {
67
- config: markupConfig,
68
- isEditor: true
69
- }
70
- }
71
-
72
- export const WaffleChart: StoryObj<typeof CdcWaffleChart> = {
73
- args: {
74
- config: waffleChartConfig,
75
- isEditor: true
76
- }
77
- }
78
-
79
- export const Dashboard: StoryObj<typeof CdcDashboard> = {
80
- args: {
81
- config: dashboardConfig,
82
- isEditor: true
83
- }
84
- }
85
-
86
- // export const WaffleChart: StoryObj<typeof CdcWaffleChart> = {
87
- // args: {
88
- // config: waffleChartConfig,
89
- // isEditor: true
90
- // }
91
- // }
@@ -1,30 +0,0 @@
1
- import React from 'react'
2
-
3
- const Select = ({ label, value, options, fieldName, section = null, subsection = null, required = false, tooltip, onchange, initial: initialValue, ...attributes }) => {
4
- let optionsJsx = options.map((optionName, index) => (
5
- <option value={optionName} key={index}>
6
- {optionName}
7
- </option>
8
- ))
9
-
10
- if (initialValue) {
11
- optionsJsx.unshift(
12
- <option value='' key='initial'>
13
- {initialValue}
14
- </option>
15
- )
16
- }
17
-
18
- return (
19
- <label>
20
- <span className='edit-label'>
21
- {label}
22
- {tooltip}
23
- </span>
24
- <select className={required && !value ? 'warning' : ''} name={fieldName} value={value} onChange={onchange} {...attributes}>
25
- {optionsJsx}
26
- </select>
27
- </label>
28
- )
29
- }
30
- export default Select
@@ -1,15 +0,0 @@
1
- export const getGradientLegendWidth = (containerWidth: number, currentViewport: string): number => {
2
- const newWidth = Number(containerWidth)
3
- switch (currentViewport) {
4
- case 'lg':
5
- return newWidth / 3
6
- case 'md':
7
- return newWidth / 2
8
- case 'sm':
9
- case 'xs':
10
- case 'xxs':
11
- return newWidth / 1.4
12
- default:
13
- return newWidth
14
- }
15
- }