@cdc/core 4.24.9-1 → 4.24.10

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 (74) hide show
  1. package/assets/icon-combo-chart.svg +1 -0
  2. package/assets/icon-epi-chart.svg +27 -0
  3. package/components/BlurStrokeText.tsx +44 -0
  4. package/components/DataTable/DataTable.tsx +51 -35
  5. package/components/DataTable/DataTableStandAlone.tsx +37 -6
  6. package/components/DataTable/components/ChartHeader.tsx +31 -26
  7. package/components/DataTable/components/MapHeader.tsx +19 -10
  8. package/components/DataTable/components/SortIcon/index.tsx +25 -0
  9. package/components/DataTable/components/SortIcon/sort-icon.css +21 -0
  10. package/{styles/_data-table.scss → components/DataTable/data-table.css} +268 -298
  11. package/components/DataTable/helpers/customSort.ts +11 -15
  12. package/components/DataTable/helpers/getDataSeriesColumns.ts +5 -1
  13. package/components/DataTable/helpers/getNewSortBy.ts +35 -0
  14. package/components/DataTable/helpers/tests/customSort.test.ts +52 -0
  15. package/components/DataTable/helpers/tests/getNewSortBy.test.ts +26 -0
  16. package/components/EditorPanel/DataTableEditor.tsx +132 -26
  17. package/components/EditorPanel/Inputs.tsx +42 -4
  18. package/components/EditorPanel/VizFilterEditor/NestedDropdownEditor.tsx +25 -7
  19. package/components/EditorPanel/VizFilterEditor/VizFilterEditor.tsx +1 -1
  20. package/components/{Filters.tsx → Filters/Filters.tsx} +48 -39
  21. package/components/Filters/helpers/applyQueuedActive.ts +12 -0
  22. package/components/Filters/helpers/getNestedOptions.ts +29 -0
  23. package/components/Filters/helpers/handleSorting.ts +18 -0
  24. package/components/Filters/helpers/tests/applyQueuedActive.test.ts +49 -0
  25. package/components/Filters/helpers/tests/getNestedOptions.test.ts +93 -0
  26. package/components/Filters/helpers/tests/handleSorting.test.ts +68 -0
  27. package/components/Filters/index.ts +5 -0
  28. package/components/Layout/components/Sidebar/components/sidebar.styles.scss +1 -3
  29. package/components/Legend/Legend.Gradient.tsx +2 -9
  30. package/components/Loader/Loader.tsx +33 -0
  31. package/components/Loader/index.ts +1 -0
  32. package/components/Loader/loader.styles.css +13 -0
  33. package/components/NestedDropdown/NestedDropdown.tsx +90 -48
  34. package/components/NestedDropdown/nestedDropdownHelpers.ts +34 -0
  35. package/components/NestedDropdown/nesteddropdown.styles.css +7 -0
  36. package/components/NestedDropdown/tests/nestedDropdownHelpers.test.ts +58 -0
  37. package/components/Table/components/GroupRow.tsx +1 -1
  38. package/components/_stories/BlurStrokeTest.stories.tsx +27 -0
  39. package/components/_stories/NestedDropdown.stories.tsx +22 -46
  40. package/components/_stories/_mocks/nested-dropdown.json +30 -0
  41. package/components/_stories/styles.scss +0 -1
  42. package/components/ui/{Tooltip.jsx → Tooltip.tsx} +38 -14
  43. package/data/colorPalettes.js +107 -10
  44. package/dist/cove-main.css +6114 -0
  45. package/dist/cove-main.css.map +1 -0
  46. package/helpers/addValuesToFilters.ts +8 -3
  47. package/helpers/cove/number.js +46 -25
  48. package/helpers/coveUpdateWorker.ts +6 -7
  49. package/helpers/pivotData.ts +52 -11
  50. package/helpers/tests/gatherQueryParams.test.ts +13 -1
  51. package/helpers/tests/pivotData.test.ts +50 -0
  52. package/helpers/ver/4.24.10.ts +47 -0
  53. package/helpers/ver/4.24.9.ts +0 -3
  54. package/helpers/ver/tests/4.24.10.test.ts +45 -0
  55. package/helpers/viewports.ts +9 -0
  56. package/package.json +7 -3
  57. package/styles/_button-section.scss +4 -0
  58. package/styles/_global-variables.scss +19 -1
  59. package/styles/_global.scss +1 -8
  60. package/styles/_reset.scss +2 -15
  61. package/styles/base.scss +0 -1
  62. package/styles/cove-main.scss +6 -0
  63. package/styles/filters.scss +6 -4
  64. package/styles/v2/components/ui/tooltip.scss +42 -40
  65. package/styles/v2/layout/_component.scss +0 -6
  66. package/styles/v2/layout/index.scss +0 -1
  67. package/types/Axis.ts +2 -0
  68. package/types/General.ts +1 -0
  69. package/types/Table.ts +2 -1
  70. package/types/Visualization.ts +13 -1
  71. package/types/VizFilter.ts +2 -1
  72. package/components/DataTable/components/Icons.tsx +0 -10
  73. package/components/_stories/EditorPanel.stories.tsx +0 -54
  74. package/components/_stories/Layout.Debug.stories.tsx +0 -91
@@ -1,298 +1,268 @@
1
- .collapsed + .table-container {
2
- border-bottom: none;
3
- }
4
- .table-container {
5
- overflow-x: auto;
6
- border-right: 1px solid $lightGray;
7
- border-left: 1px solid $lightGray;
8
- border-bottom: 1px solid $lightGray;
9
- }
10
-
11
- div.data-table-heading {
12
- position: relative;
13
- background: rgba(0, 0, 0, 0.05);
14
- padding: 0.5em 0.7em;
15
- border: $lightGray 1px solid;
16
- cursor: pointer;
17
-
18
- svg {
19
- position: absolute;
20
- height: 100%;
21
- width: 15px;
22
- top: 0;
23
- right: 1em;
24
- }
25
-
26
- &:focus {
27
- z-index: 2;
28
- position: relative;
29
- }
30
- @include breakpoint(xs) {
31
- font-size: $font-small + 0.2em;
32
- }
33
- }
34
-
35
- table.horizontal {
36
- th,
37
- td {
38
- min-width: 200px;
39
- }
40
- }
41
-
42
- table.data-table {
43
- min-width: 100%;
44
- background: #fff;
45
- position: relative;
46
- border: none;
47
- overflow-x: auto;
48
- border-collapse: collapse;
49
- overflow: auto;
50
- appearance: none;
51
- table-layout: fixed;
52
- * {
53
- box-sizing: border-box;
54
- }
55
-
56
- thead {
57
- user-select: none;
58
- -moz-user-select: none;
59
- user-select: none;
60
-
61
- button {
62
- background: none;
63
- font-size: initial;
64
- color: #fff;
65
- border: 0;
66
- }
67
-
68
- tr {
69
- background: none;
70
- }
71
- }
72
- thead {
73
- color: #fff;
74
- background-color: $mediumGray;
75
- .resizer {
76
- cursor: e-resize;
77
- width: 10px;
78
- position: absolute;
79
- top: 0;
80
- bottom: 0;
81
- right: 0;
82
- touch-action: none;
83
- }
84
- tr {
85
- text-align: left;
86
- }
87
- th,
88
- td {
89
- padding: 0.5em 1.3em 0.5em 0.7em;
90
- line-height: normal;
91
- position: relative;
92
- text-align: left;
93
- cursor: pointer;
94
- border-right: 1px solid $lightGray !important;
95
- svg {
96
- margin-left: 1rem;
97
- }
98
- }
99
-
100
- th.sort {
101
- background-color: darken($mediumGray, 10%);
102
- background-repeat: no-repeat;
103
- background-position: right 0.5em center;
104
- background-size: 10px 5px;
105
- }
106
-
107
- // format the white triangle sort icon in data table headers
108
- .sort-icon {
109
- fill: white;
110
- width: 30px;
111
- float: right;
112
- align-self: center;
113
- position: absolute;
114
- right: 10px;
115
- top: 50%;
116
- transform: translateY(-50%);
117
- }
118
-
119
- th:last-child,
120
- td:last-child {
121
- border-right: 0;
122
- }
123
- }
124
-
125
- tbody {
126
- tr {
127
- width: 100%;
128
- &:hover {
129
- background: rgba(0, 0, 0, 0.05);
130
- }
131
- }
132
- }
133
-
134
- tr {
135
- border-bottom: solid 1px #e5e5e5;
136
- min-width: 100%; // Needed to fill content up
137
- &:last-child {
138
- border-bottom: 0;
139
- }
140
- }
141
-
142
- td {
143
- padding: 0.3em 0.7em;
144
-
145
- border-right: 1px solid rgba(0, 0, 0, 0.1);
146
- }
147
-
148
- th,
149
- td {
150
- width: 1% !important;
151
- white-space: nowrap;
152
- text-overflow: ellipsis;
153
- overflow: hidden;
154
- &:last-child {
155
- border-right: 0 !important;
156
- }
157
-
158
- @include breakpoint(xs) {
159
- font-size: $font-small;
160
- }
161
- }
162
- tr {
163
- & > * {
164
- width: 100%;
165
- }
166
- }
167
- th {
168
- flex-grow: 1;
169
- }
170
-
171
- td {
172
- position: relative;
173
- flex-grow: 1;
174
- }
175
-
176
- td a {
177
- padding: 0.3em 0.7em;
178
- position: absolute;
179
- top: 0;
180
- bottom: 0;
181
- right: 0;
182
- left: 0;
183
- display: block;
184
- color: inherit;
185
- text-decoration: none;
186
- }
187
-
188
- td span.table-link {
189
- text-decoration: underline;
190
- cursor: pointer;
191
- color: #075290;
192
- svg {
193
- max-width: 13px;
194
- vertical-align: baseline;
195
- margin-left: 5px;
196
- }
197
- }
198
-
199
- .boxplot-td {
200
- //display: inline-block;
201
- //box-sizing: border-box;
202
- table-layout: fixed;
203
- width: 200;
204
- //min-width: 150px;
205
- //max-width: 400px;
206
- }
207
- }
208
-
209
- .no-data {
210
- position: relative;
211
- .no-data-message {
212
- @include emptyState;
213
- h3 {
214
- font-size: 1.3rem;
215
- font-weight: 600;
216
- margin-bottom: 0.3rem;
217
- }
218
- }
219
- tr:hover {
220
- background: #fff;
221
- }
222
- th,
223
- td {
224
- width: 50%;
225
- &::before {
226
- content: '\00a0';
227
- }
228
- }
229
- }
230
-
231
- .data-table-pagination {
232
- margin: 1rem 0;
233
- display: flex;
234
- align-items: center;
235
- ul {
236
- list-style: none;
237
- margin: 0 1rem 0 0;
238
- display: flex;
239
- li + li {
240
- margin-left: 0.3rem;
241
- }
242
- button {
243
- background: $mediumGray;
244
- padding: 0.6rem 0.8rem;
245
- &:hover {
246
- background: lighten($mediumGray, 5%);
247
- }
248
- }
249
- button.btn-next {
250
- &::before {
251
- content: ' ';
252
- background-image: url(../assets/icon-caret-filled-up.svg);
253
- background-size: 10px 5px;
254
- width: 10px;
255
- height: 5px;
256
- display: block;
257
- transform: rotate(90deg);
258
- }
259
- }
260
- button.btn-prev {
261
- &::before {
262
- content: ' ';
263
- background-image: url(../assets/icon-caret-filled-up.svg);
264
- background-size: 10px 5px;
265
- width: 10px;
266
- height: 5px;
267
- display: block;
268
- transform: rotate(-90deg);
269
- }
270
- }
271
- button[disabled] {
272
- background: $mediumGray;
273
- opacity: 0.3;
274
- cursor: default;
275
- &:hover {
276
- background: $mediumGray;
277
- }
278
- }
279
- }
280
- }
281
-
282
- .btn-download {
283
- color: #fff;
284
- float: right;
285
- text-decoration: none;
286
- transition: 0.3s all;
287
- margin: 1em 0;
288
- &:hover {
289
- transition: 0.3s all;
290
- }
291
- }
292
- .cove,
293
- .cdc-open-viz-module {
294
- .download-links a:not(:last-child) {
295
- margin-right: 10px;
296
- display: inline-block;
297
- }
298
- }
1
+ .table {
2
+ width: unset;
3
+ min-width: 100%;
4
+ }
5
+
6
+ .collapsed + .table-container {
7
+ border-bottom: none;
8
+ }
9
+ .table-container {
10
+ overflow-x: auto;
11
+ border-right: 1px solid var(--lightGray);
12
+ border-left: 1px solid var(--lightGray);
13
+ border-bottom: 1px solid var(--lightGray);
14
+ }
15
+
16
+ .cdc-open-viz-module div.data-table-heading {
17
+ position: relative;
18
+ background: rgba(0, 0, 0, 0.05);
19
+ padding: 0.5em 0.7em;
20
+ border: var(--lightGray) 1px solid;
21
+
22
+ svg {
23
+ position: absolute;
24
+ height: 100%;
25
+ width: 15px;
26
+ top: 0;
27
+ right: 1em;
28
+ }
29
+
30
+ &:focus {
31
+ z-index: 2;
32
+ position: relative;
33
+ }
34
+ @media (max-width: var(--breakpoint-sm)) {
35
+ font-size: var(--font-small) + 0.2em;
36
+ }
37
+ }
38
+
39
+ table.horizontal {
40
+ th,
41
+ td {
42
+ min-width: 200px;
43
+ }
44
+ }
45
+
46
+ table.data-table {
47
+ margin-bottom: 0;
48
+ background: #fff;
49
+ position: relative;
50
+ border: none;
51
+ border-collapse: collapse;
52
+ appearance: none;
53
+ table-layout: fixed;
54
+ * {
55
+ box-sizing: border-box;
56
+ }
57
+
58
+ thead {
59
+ user-select: none;
60
+ -moz-user-select: none;
61
+ user-select: none;
62
+
63
+ button {
64
+ background: none;
65
+ font-size: initial;
66
+ color: #fff;
67
+ border: 0;
68
+ }
69
+
70
+ tr {
71
+ background: none;
72
+ }
73
+ }
74
+ thead {
75
+ color: #fff;
76
+ .resizer {
77
+ cursor: e-resize;
78
+ width: 10px;
79
+ position: absolute;
80
+ top: 0;
81
+ bottom: 0;
82
+ right: 0;
83
+ touch-action: none;
84
+ }
85
+ tr {
86
+ text-align: left;
87
+ }
88
+ th,
89
+ td {
90
+ padding: 0.5em 1.3em 0.5em 0.7em;
91
+ line-height: normal;
92
+ position: relative;
93
+ text-align: left;
94
+ border-right: 1px solid var(--lightGray) !important;
95
+ }
96
+
97
+ th {
98
+ background-color: var(--primary);
99
+ background-repeat: no-repeat;
100
+ background-position: right 0.5em center;
101
+ background-size: 10px 5px;
102
+ }
103
+
104
+ th:last-child,
105
+ td:last-child {
106
+ border-right: 0;
107
+ }
108
+ }
109
+
110
+ tr {
111
+ &.row-group {
112
+ background-color: var(--tertiary) !important;
113
+ font-weight: bold;
114
+ }
115
+ border-bottom: solid 1px #e5e5e5;
116
+ min-width: 100%; /* Needed to fill content up*/
117
+ &:last-child {
118
+ border-bottom: 0;
119
+ }
120
+ }
121
+
122
+ th,
123
+ td {
124
+ padding: 0.3em 0.7em;
125
+ border-right: 1px solid rgba(0, 0, 0, 0.1);
126
+ white-space: nowrap;
127
+ &:last-child {
128
+ border-right: 0 !important;
129
+ }
130
+ font-size: var(--font-size);
131
+ }
132
+
133
+ td {
134
+ position: relative;
135
+ svg {
136
+ margin-left: 1rem;
137
+ }
138
+ }
139
+
140
+ td a {
141
+ padding: 0.3em 0.7em;
142
+ position: absolute;
143
+ top: 0;
144
+ bottom: 0;
145
+ right: 0;
146
+ left: 0;
147
+ display: block;
148
+ color: inherit;
149
+ text-decoration: none;
150
+ }
151
+
152
+ td span.table-link {
153
+ text-decoration: underline;
154
+ cursor: pointer;
155
+ color: #075290;
156
+ svg {
157
+ max-width: 13px;
158
+ vertical-align: baseline;
159
+ margin-left: 5px;
160
+ }
161
+ }
162
+
163
+ .boxplot-td {
164
+ table-layout: fixed;
165
+ width: 200;
166
+ }
167
+ }
168
+
169
+ .no-data {
170
+ position: relative;
171
+ .no-data-message {
172
+ background: rgba(255, 255, 255, 0.5);
173
+ top: 0;
174
+ left: 0;
175
+ right: 0;
176
+ bottom: 0;
177
+ position: absolute;
178
+ text-align: center;
179
+ display: flex;
180
+ align-items: center;
181
+ justify-content: center;
182
+ z-index: 7;
183
+ :is(h3) {
184
+ font-size: 1.3rem;
185
+ font-weight: 600;
186
+ margin-bottom: 0.3rem;
187
+ }
188
+ }
189
+ tr:hover {
190
+ background: #fff;
191
+ }
192
+ th,
193
+ td {
194
+ width: 50%;
195
+ &::before {
196
+ content: '\00a0';
197
+ }
198
+ }
199
+ }
200
+
201
+ .data-table-pagination {
202
+ margin: 1rem 0;
203
+ display: flex;
204
+ align-items: center;
205
+ ul {
206
+ list-style: none;
207
+ margin: 0 1rem 0 0;
208
+ display: flex;
209
+ li + li {
210
+ margin-left: 0.3rem;
211
+ }
212
+ button {
213
+ background: var(--mediumGray);
214
+ padding: 0.6rem 0.8rem;
215
+ &:hover {
216
+ background: lighten(var(--mediumGray), 5%);
217
+ }
218
+ }
219
+ button.btn-next {
220
+ &::before {
221
+ content: ' ';
222
+ background-image: url(../assets/icon-caret-filled-up.svg);
223
+ background-size: 10px 5px;
224
+ width: 10px;
225
+ height: 5px;
226
+ display: block;
227
+ transform: rotate(90deg);
228
+ }
229
+ }
230
+ button.btn-prev {
231
+ &::before {
232
+ content: ' ';
233
+ background-image: url(../assets/icon-caret-filled-up.svg);
234
+ background-size: 10px 5px;
235
+ width: 10px;
236
+ height: 5px;
237
+ display: block;
238
+ transform: rotate(-90deg);
239
+ }
240
+ }
241
+ button[disabled] {
242
+ background: var(--mediumGray);
243
+ opacity: 0.3;
244
+ cursor: default;
245
+ &:hover {
246
+ background: var(--mediumGray);
247
+ }
248
+ }
249
+ }
250
+ }
251
+
252
+ .btn-download {
253
+ color: #fff;
254
+ float: right;
255
+ text-decoration: none;
256
+ transition: 0.3s all;
257
+ margin: 1em 0;
258
+ &:hover {
259
+ transition: 0.3s all;
260
+ }
261
+ }
262
+ .cove,
263
+ .cdc-open-viz-module {
264
+ .download-links a:not(:last-child) {
265
+ margin-right: 10px;
266
+ display: inline-block;
267
+ }
268
+ }
@@ -14,7 +14,7 @@ export const customSort = (a, b, sortBy, config) => {
14
14
  const numberB = parseInt(b.match(/\d+$/)[0], 10)
15
15
 
16
16
  // Compare the numeric parts
17
- return !sortBy.asc ? Number(numberA) - Number(numberB) : Number(numberB) - Number(numberA)
17
+ return sortBy.asc ? Number(numberA) - Number(numberB) : Number(numberB) - Number(numberA)
18
18
  }
19
19
  }
20
20
 
@@ -26,39 +26,35 @@ export const customSort = (a, b, sortBy, config) => {
26
26
  const trimmedB = String(valueB).trim()
27
27
 
28
28
  if (config.xAxis?.dataKey === sortBy.column && config.xAxis.type === 'date') {
29
- let dateA = parseDate(config.xAxis.dateParseFormat, trimmedA)
29
+ const dateA = parseDate(config.xAxis.dateParseFormat, trimmedA)?.getTime()
30
30
 
31
- let dateB = parseDate(config.xAxis.dateParseFormat, trimmedB)
32
-
33
- if (dateA && dateA.getTime) dateA = dateA.getTime()
34
-
35
- if (dateB && dateB.getTime) dateB = dateB.getTime()
36
-
37
- return !sortBy.asc ? dateA - dateB : dateB - dateA
31
+ const dateB = parseDate(config.xAxis.dateParseFormat, trimmedB)?.getTime()
32
+ console.log(dateA, dateB)
33
+ return sortBy.asc ? dateA - dateB : dateB - dateA
38
34
  }
39
35
  // Check if values are numbers
40
36
  const isNumA = !isNaN(Number(valueA)) && valueA !== undefined && valueA !== null && trimmedA !== ''
41
37
  const isNumB = !isNaN(Number(valueB)) && valueB !== undefined && valueB !== null && trimmedB !== ''
42
38
 
43
39
  // Handle empty strings or spaces
44
- if (trimmedA === '' && trimmedB !== '') return !sortBy.asc ? -1 : 1
45
- if (trimmedA !== '' && trimmedB === '') return !sortBy.asc ? 1 : -1
40
+ if (trimmedA === '' && trimmedB !== '') return sortBy.asc ? -1 : 1
41
+ if (trimmedA !== '' && trimmedB === '') return sortBy.asc ? 1 : -1
46
42
 
47
43
  // Both are numbers: Compare numerically
48
44
  if (isNumA && isNumB) {
49
- return !sortBy.asc ? Number(valueA) - Number(valueB) : Number(valueB) - Number(valueA)
45
+ return sortBy.asc ? Number(valueA) - Number(valueB) : Number(valueB) - Number(valueA)
50
46
  }
51
47
 
52
48
  // Only A is a number
53
49
  if (isNumA) {
54
- return !sortBy.asc ? -1 : 1
50
+ return sortBy.asc ? -1 : 1
55
51
  }
56
52
 
57
53
  // Only B is a number
58
54
  if (isNumB) {
59
- return !sortBy.asc ? 1 : -1
55
+ return sortBy.asc ? 1 : -1
60
56
  }
61
57
 
62
58
  // Neither are numbers: Compare as strings
63
- return !sortBy.asc ? trimmedA.localeCompare(trimmedB) : trimmedB.localeCompare(trimmedA)
59
+ return sortBy.asc ? trimmedA.localeCompare(trimmedB) : trimmedB.localeCompare(trimmedA)
64
60
  }
@@ -56,6 +56,10 @@ export const getDataSeriesColumns = (config: TableConfig, isVertical: boolean, r
56
56
  }
57
57
  })
58
58
 
59
- tmpSeriesColumns.sort((a, b) => columnOrderingHash[a] - columnOrderingHash[b])
59
+ tmpSeriesColumns.sort((a, b) => {
60
+ if (a === 'pivotColumn') return -1
61
+ if (b === 'pivotColumn') return 1
62
+ return columnOrderingHash[a] - columnOrderingHash[b]
63
+ })
60
64
  return tmpSeriesColumns
61
65
  }
@@ -0,0 +1,35 @@
1
+ type SortBy = {
2
+ asc: boolean
3
+ column?: string
4
+ }
5
+
6
+ export const getNewSortBy = (
7
+ sortBy: SortBy,
8
+ column: string,
9
+ index: number
10
+ ): { column: string; asc: boolean; colIndex: number } => {
11
+ let asc
12
+ let sortByCol = column
13
+ const ascending = sortBy.asc === true
14
+ const descending = sortBy.asc === false
15
+ const isInactive = sortBy.asc === undefined
16
+ const noColumnSelected = sortBy.column === undefined
17
+ if (noColumnSelected || sortBy.column !== column) {
18
+ // this is the first time a column is clicked
19
+ asc = true
20
+ } else {
21
+ // clicking the same column
22
+ if (descending) {
23
+ // reset
24
+ sortByCol = undefined
25
+ asc = undefined
26
+ }
27
+ if (isInactive) {
28
+ asc = true
29
+ }
30
+ if (ascending) {
31
+ asc = false
32
+ }
33
+ }
34
+ return { column: sortByCol, asc, colIndex: index }
35
+ }