@cdc/core 4.26.2 → 4.26.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.
Files changed (186) hide show
  1. package/LICENSE +201 -0
  2. package/_stories/Gallery.Charts.stories.tsx +1 -1
  3. package/_stories/Gallery.DataBite.stories.tsx +1 -1
  4. package/_stories/Gallery.Maps.stories.tsx +1 -1
  5. package/_stories/PageART.stories.tsx +1 -1
  6. package/_stories/PageBRFSS.stories.tsx +1 -1
  7. package/_stories/PageCancerRegistries.stories.tsx +1 -1
  8. package/_stories/PageEasternEquineEncephalitis.stories.tsx +3 -3
  9. package/_stories/PageExcessiveAlcoholUse.stories.tsx +1 -1
  10. package/_stories/PageMaternalMortality.stories.tsx +1 -1
  11. package/_stories/PageOralHealth.stories.tsx +1 -1
  12. package/_stories/PageRespiratory.stories.tsx +4 -4
  13. package/_stories/PageSmokingTobacco.stories.tsx +1 -1
  14. package/_stories/PageStateDiabetesProfiles.stories.tsx +1 -1
  15. package/_stories/PageWastewater.stories.tsx +4 -4
  16. package/_stories/VegaImport.stories.tsx +3 -3
  17. package/assets/callout-flag.svg +7 -0
  18. package/components/AdvancedEditor/EmbedEditor.tsx +1 -1
  19. package/components/Alert/components/Alert.styles.css +2 -2
  20. package/components/ComboBox/combobox.styles.css +48 -48
  21. package/components/CustomColorsEditor/CustomColorsEditor.css +53 -53
  22. package/components/DataTable/DataTable.tsx +46 -18
  23. package/components/DataTable/DataTableStandAlone.tsx +1 -0
  24. package/components/DataTable/components/ChartHeader.tsx +21 -12
  25. package/components/DataTable/components/MapHeader.tsx +34 -28
  26. package/components/DataTable/components/SortIcon/sort-icon.css +5 -5
  27. package/components/DataTable/data-table.css +50 -52
  28. package/components/DataTable/helpers/applyCustomOrder.ts +17 -0
  29. package/components/DataTable/helpers/getChartCellValue.ts +10 -7
  30. package/components/DataTable/helpers/getMapDataTableColumnKeys.ts +22 -0
  31. package/components/DataTable/helpers/mapCellMatrix.tsx +33 -23
  32. package/components/DataTable/helpers/tests/mapCellMatrix.test.ts +33 -0
  33. package/components/DownloadButton.tsx +14 -6
  34. package/components/EditorPanel/ColumnsEditor.tsx +38 -31
  35. package/components/EditorPanel/CustomSortOrder.tsx +94 -0
  36. package/components/EditorPanel/DataTableEditor.tsx +139 -23
  37. package/components/EditorPanel/EditorPanel.styles.css +71 -71
  38. package/components/EditorPanel/EditorPanel.tsx +3 -8
  39. package/components/EditorPanel/EditorPanelDispatch.tsx +4 -4
  40. package/components/EditorPanel/FootnotesEditor.tsx +2 -2
  41. package/components/EditorPanel/VizFilterEditor/NestedDropdownEditor.tsx +7 -6
  42. package/components/EditorPanel/VizFilterEditor/VizFilterEditor.tsx +12 -10
  43. package/components/EditorPanel/components/MarkupVariablesEditor.tsx +160 -106
  44. package/components/EditorPanel/components/PanelMarkup.tsx +5 -1
  45. package/{styles/v2/components → components/EditorPanel}/editor.scss +67 -13
  46. package/components/EditorPanel/sections/StyleTreatmentSection.tsx +99 -0
  47. package/components/EditorPanel/sections/VisualSection.tsx +11 -0
  48. package/components/EditorWrapper/editor-wrapper.style.css +1 -1
  49. package/components/Filters/Filters.tsx +3 -5
  50. package/components/Filters/components/Tabs.tsx +19 -7
  51. package/{styles → components/Filters}/filters.scss +3 -3
  52. package/components/Footnotes/FootnotesStandAlone.tsx +4 -2
  53. package/components/HeaderThemeSelector/HeaderThemeSelector.css +61 -5
  54. package/components/Layout/components/Responsive.tsx +14 -6
  55. package/components/Layout/components/Sidebar/components/Sidebar.tsx +1 -1
  56. package/components/Layout/components/Sidebar/components/sidebar.styles.scss +12 -18
  57. package/components/Layout/components/Visualization/index.tsx +39 -38
  58. package/components/Layout/components/Visualization/visualizations.scss +232 -15
  59. package/components/Layout/components/VisualizationContainer.test.tsx +67 -0
  60. package/components/Layout/components/VisualizationContainer.tsx +37 -0
  61. package/components/Layout/components/VisualizationContent.test.tsx +182 -0
  62. package/components/Layout/components/VisualizationContent.tsx +75 -0
  63. package/components/Layout/index.tsx +5 -5
  64. package/components/Layout/styles/editor-utils.scss +3 -3
  65. package/components/Layout/styles/editor.scss +4 -4
  66. package/components/Legend/Legend.Gradient.tsx +7 -1
  67. package/components/Loader/loader.styles.css +2 -2
  68. package/components/Loading.jsx +1 -1
  69. package/components/MediaControls.tsx +10 -2
  70. package/components/MultiSelect/multiselect.styles.css +19 -19
  71. package/components/NestedDropdown/nesteddropdown.styles.css +15 -15
  72. package/components/PaletteSelector/PaletteSelector.css +15 -15
  73. package/components/RichTooltip/richTooltip.css +6 -6
  74. package/components/Table/table.styles.css +2 -2
  75. package/components/Waiting.tsx +1 -1
  76. package/components/_stories/Filters.stories.tsx +1 -1
  77. package/components/_stories/styles.scss +0 -1
  78. package/components/elements/Button.jsx +1 -1
  79. package/components/elements/Card.jsx +1 -1
  80. package/{styles/v2/components → components/elements}/button.scss +9 -8
  81. package/components/inputs/InputCheckbox.jsx +1 -1
  82. package/components/inputs/InputSelect.tsx +1 -1
  83. package/components/inputs/InputText.jsx +1 -1
  84. package/components/inputs/InputToggle.tsx +1 -1
  85. package/{styles/v2/components/input → components/inputs}/_input-check-radio.scss +2 -2
  86. package/{styles/v2/components/input → components/inputs}/_input-group.scss +3 -3
  87. package/{styles/v2/components/input → components/inputs}/_input-slider.scss +2 -2
  88. package/{styles/v2/components/input → components/inputs}/_input.scss +5 -5
  89. package/{styles/v2/components/input → components/inputs}/index.scss +2 -2
  90. package/{styles → components}/loading.scss +1 -1
  91. package/components/managers/DataDesigner.tsx +1 -1
  92. package/{styles/v2/components → components/managers}/data-designer.scss +6 -7
  93. package/components/ui/Accordion.jsx +1 -1
  94. package/components/ui/Icon.tsx +1 -1
  95. package/components/ui/LoadSpin.jsx +1 -1
  96. package/components/ui/Modal.jsx +1 -1
  97. package/components/ui/Overlay.jsx +1 -1
  98. package/components/ui/Title/index.test.tsx +34 -0
  99. package/components/ui/Title/index.tsx +24 -7
  100. package/components/ui/Title/title.styles.css +119 -25
  101. package/components/ui/Tooltip.tsx +1 -1
  102. package/components/ui/_stories/Title.stories.tsx +1 -1
  103. package/{styles/v2/components → components/ui}/accordion.scss +3 -3
  104. package/components/ui/accordion.styles.css +11 -11
  105. package/{styles/v2/components → components/ui}/modal.scss +2 -2
  106. package/{styles/v2/components → components/ui}/overlay.scss +6 -6
  107. package/{styles/v2/components → components}/ui/tooltip.scss +1 -1
  108. package/{styles → components}/waiting.scss +9 -3
  109. package/devTemplate/dev.js +50 -0
  110. package/dist/cove-main.css +528 -231
  111. package/dist/cove-main.css.map +1 -1
  112. package/generateViteConfig.js +2 -2
  113. package/helpers/backfillDefaults.ts +35 -0
  114. package/helpers/constants.ts +12 -0
  115. package/helpers/cove/date.ts +32 -3
  116. package/helpers/cove/number.ts +29 -15
  117. package/helpers/coveUpdateWorker.ts +12 -8
  118. package/helpers/displayDataAsText.ts +1 -1
  119. package/helpers/embed/embedHelper.js +13 -2
  120. package/helpers/embed/index.ts +0 -4
  121. package/helpers/extractDataAndMetadata.ts +20 -0
  122. package/helpers/fetchRemoteData.ts +14 -8
  123. package/helpers/labelHash.ts +9 -0
  124. package/helpers/markupProcessor.ts +56 -38
  125. package/helpers/prepareScreenshot.ts +6 -3
  126. package/helpers/testing.ts +1 -1
  127. package/helpers/tests/abbreviateNumber.test.ts +59 -0
  128. package/helpers/tests/backfillDefaults.test.ts +253 -0
  129. package/helpers/tests/date.test.ts +46 -0
  130. package/helpers/tests/extractDataAndMetadata.test.ts +93 -0
  131. package/helpers/tests/markupProcessor.test.ts +315 -124
  132. package/helpers/tests/number.test.ts +42 -0
  133. package/helpers/tests/prepareScreenshot.test.ts +28 -28
  134. package/helpers/tests/testStandaloneBuild.ts +36 -26
  135. package/helpers/tests/useDataVizClasses.test.ts +66 -0
  136. package/helpers/tests/visualizationWrapperUsage.test.ts +57 -0
  137. package/helpers/useDataVizClasses.ts +13 -7
  138. package/helpers/ver/4.24.4.ts +24 -0
  139. package/helpers/ver/4.26.3.ts +44 -0
  140. package/helpers/ver/4.26.4.ts +31 -0
  141. package/helpers/ver/tests/4.26.3.test.ts +168 -0
  142. package/helpers/ver/tests/4.26.4.test.ts +88 -0
  143. package/helpers/ver/tests/coveUpdateWorker.test.ts +57 -0
  144. package/package.json +2 -2
  145. package/styles/_global.scss +7 -7
  146. package/styles/_reset.scss +2 -2
  147. package/styles/{v2/base → base}/_file-selector.scss +4 -4
  148. package/styles/{v2/base → base}/_general.scss +2 -4
  149. package/styles/{v2/base → base}/index.scss +1 -1
  150. package/styles/base.scss +107 -165
  151. package/styles/cove-main.scss +3 -6
  152. package/styles/layout/_component.scss +110 -0
  153. package/styles/{v2/layout → layout}/_data-table.scss +7 -7
  154. package/styles/layout/_wrapper-padding.scss +27 -0
  155. package/styles/{v2/main.scss → main.scss} +3 -1
  156. package/styles/{v2/themes → themes}/_color-definitions.scss +46 -41
  157. package/styles/{_accessibility.scss → utils/_accessibility.scss} +1 -1
  158. package/styles/{_global-variables.scss → utils/_properties.scss} +133 -112
  159. package/styles/{v2/utils → utils}/index.scss +2 -1
  160. package/types/Axis.ts +2 -0
  161. package/types/ComponentStyles.ts +1 -0
  162. package/types/ConfigureData.ts +1 -0
  163. package/types/MarkupInclude.ts +1 -0
  164. package/types/MarkupVariable.ts +2 -1
  165. package/types/Palette.ts +1 -0
  166. package/types/Table.ts +9 -0
  167. package/types/Visualization.ts +1 -0
  168. package/styles/_common-components.css +0 -73
  169. package/styles/_variables.scss +0 -63
  170. package/styles/v2/layout/_component.scss +0 -21
  171. package/styles/v2/utils/_variables.scss +0 -9
  172. package/{styles/v2/components/card.scss → components/elements/card.css} +2 -2
  173. /package/{styles/v2/components → components/ui}/icon.scss +0 -0
  174. /package/{styles/v2/components → components/ui}/loadspin.scss +0 -0
  175. /package/styles/{v2/base → base}/_heading.scss +0 -0
  176. /package/styles/{v2/base → base}/_reset.scss +0 -0
  177. /package/styles/{v2/layout → layout}/_alert.scss +0 -0
  178. /package/styles/{v2/layout → layout}/_progression.scss +0 -0
  179. /package/styles/{v2/layout → layout}/_tooltip.scss +0 -0
  180. /package/styles/{v2/layout → layout}/index.scss +0 -0
  181. /package/styles/{v2/themes → themes}/index.scss +0 -0
  182. /package/styles/{v2/utils → utils}/_align.scss +0 -0
  183. /package/styles/{v2/utils → utils}/_animations.scss +0 -0
  184. /package/styles/{v2/utils → utils}/_breakpoints.scss +0 -0
  185. /package/styles/{v2/utils → utils}/_grid.scss +0 -0
  186. /package/styles/{v2/utils → utils}/_mixins.scss +0 -0
@@ -11,7 +11,7 @@ const meta: Meta<typeof Filters> = {
11
11
  component: Filters,
12
12
  decorators: [
13
13
  Story => (
14
- <div className='cdc-open-viz-module'>
14
+ <div className='cove-visualization'>
15
15
  <Story />
16
16
  </div>
17
17
  )
@@ -1,5 +1,4 @@
1
1
  @import '../../styles/base.scss';
2
- @import '../../styles/_variables';
3
2
  @import '../../styles/_global.scss';
4
3
 
5
4
 
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
3
3
 
4
4
  import LoadSpin from '../ui/LoadSpin'
5
5
 
6
- import '../../styles/v2/components/button.scss'
6
+ import './button.scss'
7
7
 
8
8
  const Button = ({
9
9
  style,
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
 
3
- import '../../styles/v2/components/card.scss'
3
+ import './card.css'
4
4
 
5
5
  const Card = ({ children, className, ...attributes }) => {
6
6
  return (
@@ -1,6 +1,6 @@
1
1
  @use 'sass:color';
2
- @import '../utils/variables';
3
- @import '../themes/index';
2
+ @import '../../styles/utils/properties';
3
+ @import '../../styles/themes/index';
4
4
 
5
5
  :root {
6
6
  --cove-button-primary: var(--colors-blue-vivid-60);
@@ -29,7 +29,7 @@
29
29
  }
30
30
  }
31
31
 
32
- .cdc-open-viz-module button.cove-button {
32
+ .cove-visualization button.cove-button {
33
33
  display: inline-block;
34
34
  position: relative;
35
35
  min-height: 2.125rem;
@@ -42,8 +42,8 @@
42
42
  border-radius: 6px;
43
43
  border: 0;
44
44
  outline: none;
45
- transition: background-color 500ms $transition-expo-out, color 500ms $transition-expo-out,
46
- border-color 500ms $transition-expo-out;
45
+ transition: background-color 500ms var(--transition-expo-out), color 500ms var(--transition-expo-out),
46
+ border-color 500ms var(--transition-expo-out);
47
47
 
48
48
  &.secondary {
49
49
  background-color: var(--cove-button-secondary);
@@ -70,6 +70,7 @@
70
70
  &:disabled {
71
71
  background-color: var(--cove-button-primary-disabled);
72
72
  color: var(--cove-button-primary-disabled-font-color);
73
+ border: none;
73
74
  cursor: not-allowed;
74
75
  }
75
76
 
@@ -140,7 +141,7 @@
140
141
 
141
142
  .cove-button__text {
142
143
  position: relative;
143
- transition: width 500ms $transition-expo-out;
144
+ transition: width 500ms var(--transition-expo-out);
144
145
  align-self: stretch;
145
146
 
146
147
  .cove-button__text--loading {
@@ -157,7 +158,7 @@
157
158
  top: 0;
158
159
  left: 0;
159
160
  white-space: nowrap;
160
- transition: all 500ms $transition-expo-out;
161
+ transition: all 500ms var(--transition-expo-out);
161
162
  }
162
163
  }
163
164
 
@@ -170,6 +171,6 @@
170
171
  .cove-button__text--loading,
171
172
  .cove-button__load-spin {
172
173
  white-space: nowrap;
173
- transition: all 500ms $transition-expo-out;
174
+ transition: all 500ms var(--transition-expo-out);
174
175
  opacity: 0;
175
176
  }
@@ -2,7 +2,7 @@ import React, { useState, useEffect, memo } from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
 
4
4
  import Check from '../../assets/icon-check.svg'
5
- import '../../styles/v2/components/input/index.scss'
5
+ import './index.scss'
6
6
 
7
7
  const InputCheckbox = memo(
8
8
  ({
@@ -1,4 +1,4 @@
1
- import '../../styles/v2/components/input/index.scss'
1
+ import './index.scss'
2
2
 
3
3
  interface InputProps {
4
4
  label?
@@ -1,7 +1,7 @@
1
1
  import React, { useState, useEffect, memo } from 'react'
2
2
  import { useDebounce } from 'use-debounce'
3
3
 
4
- import '../../styles/v2/components/input/index.scss'
4
+ import './index.scss'
5
5
 
6
6
  const InputText = memo(({ label, section = null, subsection = null, fieldName, updateField, value: stateValue, type = 'input', tooltip, placeholder, i = null, min = null, max = null, className, ...attributes }) => {
7
7
  const [value, setValue] = useState(stateValue)
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useEffect } from 'react'
2
2
 
3
- import '../../styles/v2/components/input/index.scss'
3
+ import './index.scss'
4
4
 
5
5
  type InputSliderProps = {
6
6
  /** Add label to the input field */
@@ -79,7 +79,7 @@
79
79
  background-color: #f4f4f4;
80
80
  border-radius: 3px;
81
81
  box-shadow: inset 0 0 0 1px #c4c4c4;
82
- transition: all 150ms $transition-expo-out;
82
+ transition: all 150ms var(--transition-expo-out);
83
83
  }
84
84
 
85
85
  .cove-input__checkbox-check {
@@ -92,6 +92,6 @@
92
92
  fill: #fff;
93
93
  pointer-events: none;
94
94
  transform: translateY(-1px);
95
- transition: all 250ms $transition-expo-out;
95
+ transition: all 250ms var(--transition-expo-out);
96
96
  opacity: 0;
97
97
  }
@@ -65,10 +65,10 @@
65
65
  font-size: 1rem;
66
66
  font-weight: 400;
67
67
  line-height: 1.5;
68
- color: $baseColor;
68
+ color: var(--baseColor);
69
69
  text-align: center;
70
70
  white-space: nowrap;
71
- background-color: $lightestGray;
72
- border: 1px solid $lightGray;
71
+ background-color: var(--lightestGray);
72
+ border: 1px solid var(--lightGray);
73
73
  border-radius: 0.1875rem;
74
74
  }
@@ -167,7 +167,7 @@
167
167
  background-color: #fff;
168
168
  box-shadow: -2px 4px 10px -7px rgb(0 0 0);
169
169
  border-radius: 100%;
170
- transition: all 200ms $transition-expo-out;
170
+ transition: all 200ms var(--transition-expo-out);
171
171
  z-index: 2;
172
172
  }
173
173
 
@@ -179,5 +179,5 @@
179
179
  height: 100%;
180
180
  background-color: #ccc;
181
181
  border-radius: 999px;
182
- transition: all 200ms $transition-expo-out;
182
+ transition: all 200ms var(--transition-expo-out);
183
183
  }
@@ -6,14 +6,14 @@
6
6
  border-style: solid !important; // intentional use of !important for CDC
7
7
  border-color: #cbcbcb !important; // intentional use of !important for CDC
8
8
  border-radius: 0.1875rem;
9
- transition: border-color 200ms $transition-expo-out;
9
+ transition: border-color 200ms var(--transition-expo-out);
10
10
  font-family: sans-serif;
11
- color: $baseColor;
11
+ color: var(--baseColor);
12
12
  width: 100%;
13
13
  max-width: 100%;
14
14
 
15
15
  &::placeholder {
16
- transition: opacity 400ms $transition-expo-out;
16
+ transition: opacity 400ms var(--transition-expo-out);
17
17
  color: #b3b3b3;
18
18
  opacity: 1;
19
19
  }
@@ -42,7 +42,7 @@
42
42
  display: inline-block;
43
43
  margin-bottom: 0.5rem;
44
44
  font-size: 0.75rem;
45
- color: $baseColor;
45
+ color: var(--baseColor);
46
46
  text-transform: uppercase;
47
47
  user-select: none;
48
48
  }
@@ -52,7 +52,7 @@
52
52
  min-height: 140px;
53
53
  max-width: 100%;
54
54
  line-height: 1.5em;
55
- color: $baseColor;
55
+ color: var(--baseColor);
56
56
  }
57
57
 
58
58
  .cove-input--hidden {
@@ -1,5 +1,5 @@
1
- @import '../../utils/variables';
2
- @import '../../themes/index';
1
+ @import '../../styles/utils/properties';
2
+ @import '../../styles/themes/index';
3
3
 
4
4
  @import 'input';
5
5
  @import 'input-check-radio';
@@ -21,7 +21,7 @@
21
21
  }
22
22
  }
23
23
 
24
- .cdc-open-viz-module .loading {
24
+ .cove-visualization .loading {
25
25
  text-align: center;
26
26
  position: absolute;
27
27
  z-index: 3;
@@ -9,7 +9,7 @@ import {
9
9
  DATA_TABLE_SINGLE_ROW,
10
10
  DATA_TABLE_MULTI_ROW
11
11
  } from '../../templates/dataDesignerTables'
12
- import '../../styles/v2/components/data-designer.scss'
12
+ import './data-designer.scss'
13
13
  import { ConfigureData } from '../../types/ConfigureData'
14
14
 
15
15
  type DataDesignerProps = {
@@ -1,5 +1,4 @@
1
- @import '../utils/variables';
2
- @import '../themes/color-definitions';
1
+ @import '../../styles/utils/properties';
3
2
 
4
3
  .cove-modal__content {
5
4
  .dataset-selector-container {
@@ -59,7 +58,7 @@
59
58
  right: 0;
60
59
  bottom: 0;
61
60
  left: 0;
62
- border: 1px solid $lightGray;
61
+ border: 1px solid var(--lightGray);
63
62
  border-radius: 0.25rem;
64
63
  }
65
64
  }
@@ -82,20 +81,20 @@
82
81
  table {
83
82
  font-size: 0.8rem;
84
83
  background-color: #fff;
85
- border: 1px solid $lightGray;
84
+ border: 1px solid var(--lightGray);
86
85
  border-collapse: collapse;
87
86
 
88
87
  th {
89
88
  color: white;
90
89
  text-align: left;
91
- background-color: $primary;
90
+ background-color: var(--primary);
92
91
  }
93
92
 
94
93
  th,
95
94
  td {
96
95
  padding: 0 5px;
97
- border-top: 1px solid $lightGray;
98
- border-bottom: 1px solid $lightGray;
96
+ border-top: 1px solid var(--lightGray);
97
+ border-bottom: 1px solid var(--lightGray);
99
98
  }
100
99
  }
101
100
  }
@@ -11,7 +11,7 @@ import PropTypes from 'prop-types'
11
11
  import Icon from './Icon'
12
12
  import Tooltip from './Tooltip'
13
13
 
14
- import '../../styles/v2/components/accordion.scss'
14
+ import './accordion.scss'
15
15
  import './accordion.styles.css'
16
16
 
17
17
  //Define the "slots" to be populated by subcomponents
@@ -38,7 +38,7 @@ import iconRotateLeft from '../../assets/icon-rotate-left.svg'
38
38
  import iconCommand from '../../assets/icon-command.svg'
39
39
  import iconMagnifyingGlass from '../../assets/icon-magnifying-glass.svg'
40
40
 
41
- import '../../styles/v2/components/icon.scss'
41
+ import './icon.scss'
42
42
 
43
43
  const iconHash = {
44
44
  caretUp: iconCaretUp,
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import '../../styles/v2/components/loadspin.scss'
2
+ import './loadspin.scss'
3
3
 
4
4
  const LoadSpin = ({ color = '#fff', opacity = 100, size = 100, className }) => {
5
5
  const n = 8
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types'
4
4
  import { useGlobalContext } from '../GlobalContext'
5
5
  import Icon from './Icon'
6
6
 
7
- import '../../styles/v2/components/modal.scss'
7
+ import './modal.scss'
8
8
 
9
9
  //Define the "slots" to be populated by subcomponents
10
10
  const ModalHeader = () => null
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react'
2
2
 
3
3
  import { useGlobalContext } from '../GlobalContext'
4
4
 
5
- import '../../styles/v2/components/overlay.scss'
5
+ import './overlay.scss'
6
6
 
7
7
  const Overlay = ({ disableBgClose, children, override = null }) => {
8
8
  //Access global modal state
@@ -0,0 +1,34 @@
1
+ import React from 'react'
2
+ import { render, screen } from '@testing-library/react'
3
+ import { describe, expect, it } from 'vitest'
4
+ import Title from './index'
5
+
6
+ const baseConfig = {
7
+ type: 'chart',
8
+ theme: 'theme-blue'
9
+ } as any
10
+
11
+ describe('Title', () => {
12
+ it('does not add legacy bottom margin classes for wrapped visualizations', () => {
13
+ render(<Title title='Wrapped title' titleStyle='legacy' config={baseConfig} />)
14
+
15
+ expect(screen.getByRole('banner')).not.toHaveClass('mb-3')
16
+ })
17
+
18
+ it('keeps legacy dashboard title spacing classes', () => {
19
+ render(<Title title='Dashboard title' titleStyle='legacy' config={baseConfig} isDashboard={true} />)
20
+
21
+ expect(screen.getByRole('banner')).toHaveClass('mb-3')
22
+ })
23
+
24
+ it('renders legacy custom header markup via modern shim wrapper', () => {
25
+ const legacyHeaderTitle =
26
+ '<header class="cove-component__header component__header theme-blue mb-0"><h2>Medicaid Coverage of Cessation Treatments, 2024-Q2</h2></header>'
27
+
28
+ const { container } = render(<Title title={legacyHeaderTitle} titleStyle='small' config={baseConfig} />)
29
+
30
+ expect(container.querySelector('.cove-title__legacy-shim')).toBeInTheDocument()
31
+ expect(container.querySelector('.cove-title h3')).not.toBeInTheDocument()
32
+ expect(container.querySelector('header.cove-component__header.component__header')).toBeInTheDocument()
33
+ })
34
+ })
@@ -19,6 +19,7 @@ type HeaderProps = {
19
19
 
20
20
  const Title = (props: HeaderProps) => {
21
21
  const {
22
+ config,
22
23
  isDashboard,
23
24
  title,
24
25
  superTitle,
@@ -29,6 +30,10 @@ const Title = (props: HeaderProps) => {
29
30
  noContent = false
30
31
  } = props
31
32
 
33
+ // Temporary visual verification gate for the legacy title shim.
34
+ const SHOW_SHIM_TITLE = false
35
+ const shimThemeClass = props.theme || config?.theme || 'theme-blue'
36
+
32
37
  if (titleStyle === 'large' || titleStyle === 'small') {
33
38
  const TitleElement = titleStyle === 'large' ? 'h2' : 'h3'
34
39
 
@@ -47,17 +52,29 @@ const Title = (props: HeaderProps) => {
47
52
  }
48
53
 
49
54
  // LEGACY BLOCKY HEADER (Original design with colored backgrounds)
50
- const updatedClasses = ['cove-component__header', 'component__header', 'mb-3', ...classes]
55
+ const updatedClasses = [
56
+ 'cove-visualization__title',
57
+ 'cove-visualization__header',
58
+ ...(isDashboard ? ['mb-3'] : []),
59
+ ...classes
60
+ ]
51
61
 
52
62
  return (
53
63
  title &&
54
64
  showTitle && (
55
- <header className={updatedClasses.join(' ')} style={props.style}>
56
- {superTitle && <sup>{parse(superTitle)}</sup>}
57
- <h2>
58
- {parse(title)} {isDashboard}
59
- </h2>
60
- </header>
65
+ <>
66
+ <header className={updatedClasses.join(' ')} style={props.style}>
67
+ {superTitle && <sup>{parse(superTitle)}</sup>}
68
+ <h2>
69
+ {parse(title)} {isDashboard}
70
+ </h2>
71
+ </header>
72
+ {SHOW_SHIM_TITLE && (
73
+ <div className='cove-title__legacy-preview'>
74
+ <header class="cove-component__header component__header theme-blue mb-0"><h2>Medicaid Coverage of Cessation Treatments, 2024-Q2</h2></header>
75
+ </div>
76
+ )}
77
+ </>
61
78
  )
62
79
  )
63
80
  }
@@ -1,27 +1,28 @@
1
- .cdc-open-viz-module header.cove-component__header {
2
- position: relative;
3
- padding: 1rem;
4
- margin: 0;
1
+ .cove-visualization header.cove-visualization__title,
2
+ .cove-visualization header.cove-visualization__header {
3
+
4
+ border-top-left-radius: 3px;
5
+ border-top-right-radius: 3px;
5
6
  color: var(--white);
7
+ margin: 0;
8
+ padding: 1rem;
9
+ position: relative;
6
10
 
7
- & > sup {
8
- font-size: var(--superTitle-font-size);
11
+ &>sup {
9
12
  font-family: var(--app-font-secondary);
13
+ font-size: var(--superTitle-font-size);
10
14
  font-weight: 500;
11
15
  text-transform: uppercase;
12
16
  top: 0;
13
17
  }
14
18
 
15
19
  h2 {
16
- font-size: var(--title-font-size);
17
- font-family: var(--app-font-secondary);
18
20
  color: var(--white);
21
+ font-family: var(--app-font-secondary);
22
+ font-size: var(--title-font-size);
19
23
  margin: 0;
20
24
  }
21
25
 
22
- border-top-left-radius: 3px;
23
- border-top-right-radius: 3px;
24
-
25
26
  &.mb-0 {
26
27
  margin-bottom: 0 !important;
27
28
  }
@@ -35,8 +36,8 @@
35
36
  }
36
37
 
37
38
  &:not(:empty) {
38
- border-bottom-width: 4px;
39
39
  border-bottom-style: solid;
40
+ border-bottom-width: 4px;
40
41
  }
41
42
 
42
43
  &.bite-header {
@@ -47,42 +48,52 @@
47
48
  background: #712177;
48
49
  border-bottom-color: #b890bb;
49
50
  }
51
+
50
52
  &.theme-brown {
51
53
  background: #705043;
52
54
  border-bottom-color: #ad907b;
53
55
  }
56
+
54
57
  &.theme-teal {
55
58
  background: #00695c;
56
59
  border-bottom-color: #4ebaaa;
57
60
  }
61
+
58
62
  &.theme-pink {
59
63
  background: #af4448;
60
64
  border-bottom-color: #e57373;
61
65
  }
66
+
62
67
  &.theme-orange {
63
68
  background: #bb4d00;
64
69
  border-bottom-color: #ffad42;
65
70
  }
71
+
66
72
  &.theme-slate {
67
73
  background: #29434e;
68
74
  border-bottom-color: #7e9ba5;
69
75
  }
76
+
70
77
  &.theme-indigo {
71
78
  background: #26418f;
72
79
  border-bottom-color: #92a6dd;
73
80
  }
81
+
74
82
  &.theme-cyan {
75
83
  background: #007b91;
76
84
  border-bottom-color: #65b0bd;
77
85
  }
86
+
78
87
  &.theme-green {
79
88
  background: #4b830d;
80
89
  border-bottom-color: #84bc49;
81
90
  }
91
+
82
92
  &.theme-amber {
83
93
  background: #fbab18;
84
94
  border-bottom-color: #ffd54f;
85
95
  }
96
+
86
97
  &.theme-blue {
87
98
  background: #005eaa;
88
99
  border-bottom-color: #88c3ea;
@@ -93,48 +104,131 @@
93
104
  }
94
105
  }
95
106
 
96
- .type-sparkline.type-chart .cove-component__header {
107
+ .type-sparkline.type-chart .cove-visualization__title,
108
+ .type-sparkline.type-chart .cove-visualization__header {
97
109
  margin: 0px !important;
98
110
  }
99
111
 
112
+ /* ============================================================================
113
+ LEGACY SHIM PREVIEW
114
+ ============================================================================ */
115
+
116
+ header.cove-component__header {
117
+ border-bottom-style: solid;
118
+ border-bottom-width: 4px;
119
+ border-top-left-radius: 3px;
120
+ border-top-right-radius: 3px;
121
+ color: var(--white);
122
+ margin: 0;
123
+ padding: 1rem;
124
+ position: relative;
125
+
126
+ h2 {
127
+ color: var(--white);
128
+ font-family: var(--app-font-secondary);
129
+ font-size: var(--title-font-size);
130
+ margin: 0;
131
+ }
132
+
133
+ &.theme-purple {
134
+ background: #712177;
135
+ border-bottom-color: #b890bb;
136
+ }
137
+
138
+ &.theme-brown {
139
+ background: #705043;
140
+ border-bottom-color: #ad907b;
141
+ }
142
+
143
+ &.theme-teal {
144
+ background: #00695c;
145
+ border-bottom-color: #4ebaaa;
146
+ }
147
+
148
+ &.theme-pink {
149
+ background: #af4448;
150
+ border-bottom-color: #e57373;
151
+ }
152
+
153
+ &.theme-orange {
154
+ background: #bb4d00;
155
+ border-bottom-color: #ffad42;
156
+ }
157
+
158
+ &.theme-slate {
159
+ background: #29434e;
160
+ border-bottom-color: #7e9ba5;
161
+ }
162
+
163
+ &.theme-indigo {
164
+ background: #26418f;
165
+ border-bottom-color: #92a6dd;
166
+ }
167
+
168
+ &.theme-cyan {
169
+ background: #007b91;
170
+ border-bottom-color: #65b0bd;
171
+ }
172
+
173
+ &.theme-green {
174
+ background: #4b830d;
175
+ border-bottom-color: #84bc49;
176
+ }
177
+
178
+ &.theme-amber {
179
+ background: #fbab18;
180
+ border-bottom-color: #ffd54f;
181
+ }
182
+
183
+ &.theme-blue {
184
+ background: #005eaa;
185
+ border-bottom-color: #88c3ea;
186
+ }
187
+
188
+ &.mb-0 {
189
+ margin-bottom: 0 !important;
190
+ }
191
+ }
192
+
100
193
  /* ============================================================================
101
194
  MODERN TITLE
102
195
  ============================================================================ */
103
196
 
104
- .cdc-open-viz-module .cove-title--small {
197
+ .cove-visualization .cove-title--small {
105
198
  margin-bottom: 0.75rem;
106
199
  }
107
200
 
108
- .cdc-open-viz-module .cove-title--large {
201
+ .cove-visualization .cove-title--large {
109
202
  margin-bottom: 1.33rem;
110
203
  }
111
204
 
112
205
  /* Used in dashboards to more closely associate a title-only component with the content below it */
113
- .cdc-open-viz-module .cove-title--no-content {
114
- margin-top: 1rem;
206
+ .cove-visualization .cove-title--no-content {
115
207
  margin-bottom: 0;
208
+ margin-top: 1rem;
116
209
  }
117
210
 
118
- .cdc-open-viz-module .cove-title h2 {
211
+ .cove-visualization .cove-title h2 {
212
+ border-bottom: 1px solid var(--cool-gray-10);
119
213
  color: #0b4778;
120
- font-size: 1.95rem;
121
214
  font-family: var(--app-font-secondary);
122
- border-bottom: 1px solid var(--cool-gray-10);
215
+ font-size: 1.95rem;
123
216
  font-weight: 300;
124
217
  }
125
218
 
126
- .cdc-open-viz-module .cove-title h3 {
127
- font-size: 1.5rem;
219
+ .cove-visualization .cove-title h3 {
128
220
  font-family: var(--app-font-secondary);
221
+ font-size: 1.5rem;
129
222
  }
130
223
 
131
- .cdc-open-viz-module .cove-title sup {
224
+ .cove-visualization .cove-title sup {
225
+ color: #666;
132
226
  font-family: var(--app-font-secondary);
133
227
  font-size: 0.75rem;
134
228
  font-weight: 600;
135
229
  text-transform: uppercase;
136
- color: #666;
230
+
137
231
  sup {
138
232
  font-size: 75%;
139
233
  }
140
- }
234
+ }