@cdc/core 4.24.9 → 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 (77) 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/BlurStrokeText.tsx +44 -0
  5. package/components/DataTable/DataTable.tsx +51 -35
  6. package/components/DataTable/DataTableStandAlone.tsx +37 -6
  7. package/components/DataTable/components/ChartHeader.tsx +31 -26
  8. package/components/DataTable/components/MapHeader.tsx +19 -10
  9. package/components/DataTable/components/SortIcon/index.tsx +25 -0
  10. package/components/DataTable/components/SortIcon/sort-icon.css +21 -0
  11. package/{styles/_data-table.scss → components/DataTable/data-table.css} +268 -298
  12. package/components/DataTable/helpers/customSort.ts +11 -15
  13. package/components/DataTable/helpers/getDataSeriesColumns.ts +5 -1
  14. package/components/DataTable/helpers/getNewSortBy.ts +35 -0
  15. package/components/DataTable/helpers/tests/customSort.test.ts +52 -0
  16. package/components/DataTable/helpers/tests/getNewSortBy.test.ts +26 -0
  17. package/components/EditorPanel/DataTableEditor.tsx +132 -26
  18. package/components/EditorPanel/Inputs.tsx +42 -4
  19. package/components/EditorPanel/VizFilterEditor/NestedDropdownEditor.tsx +25 -7
  20. package/components/EditorPanel/VizFilterEditor/VizFilterEditor.tsx +1 -1
  21. package/components/{Filters.tsx → Filters/Filters.tsx} +48 -39
  22. package/components/Filters/helpers/applyQueuedActive.ts +12 -0
  23. package/components/Filters/helpers/getNestedOptions.ts +29 -0
  24. package/components/Filters/helpers/handleSorting.ts +18 -0
  25. package/components/Filters/helpers/tests/applyQueuedActive.test.ts +49 -0
  26. package/components/Filters/helpers/tests/getNestedOptions.test.ts +93 -0
  27. package/components/Filters/helpers/tests/handleSorting.test.ts +68 -0
  28. package/components/Filters/index.ts +5 -0
  29. package/components/Layout/components/Sidebar/components/sidebar.styles.scss +1 -3
  30. package/components/Legend/Legend.Gradient.tsx +2 -9
  31. package/components/Loader/Loader.tsx +33 -0
  32. package/components/Loader/index.ts +1 -0
  33. package/components/Loader/loader.styles.css +13 -0
  34. package/components/NestedDropdown/NestedDropdown.tsx +90 -48
  35. package/components/NestedDropdown/nestedDropdownHelpers.ts +34 -0
  36. package/components/NestedDropdown/nesteddropdown.styles.css +7 -0
  37. package/components/NestedDropdown/tests/nestedDropdownHelpers.test.ts +58 -0
  38. package/components/Table/components/GroupRow.tsx +1 -1
  39. package/components/_stories/BlurStrokeTest.stories.tsx +27 -0
  40. package/components/_stories/NestedDropdown.stories.tsx +22 -46
  41. package/components/_stories/_mocks/nested-dropdown.json +30 -0
  42. package/components/_stories/styles.scss +0 -1
  43. package/components/ui/{Tooltip.jsx → Tooltip.tsx} +38 -14
  44. package/data/colorPalettes.js +107 -10
  45. package/dist/cove-main.css +6114 -0
  46. package/dist/cove-main.css.map +1 -0
  47. package/helpers/addValuesToFilters.ts +8 -3
  48. package/helpers/cove/number.js +46 -25
  49. package/helpers/coveUpdateWorker.ts +6 -7
  50. package/helpers/formatConfigBeforeSave.ts +16 -1
  51. package/helpers/gatherQueryParams.ts +12 -2
  52. package/helpers/pivotData.ts +52 -11
  53. package/helpers/tests/gatherQueryParams.test.ts +34 -0
  54. package/helpers/tests/pivotData.test.ts +50 -0
  55. package/helpers/ver/4.24.10.ts +47 -0
  56. package/helpers/ver/4.24.9.ts +0 -3
  57. package/helpers/ver/tests/4.24.10.test.ts +45 -0
  58. package/helpers/viewports.ts +9 -0
  59. package/package.json +7 -3
  60. package/styles/_button-section.scss +4 -0
  61. package/styles/_global-variables.scss +19 -1
  62. package/styles/_global.scss +1 -8
  63. package/styles/_reset.scss +2 -15
  64. package/styles/base.scss +0 -1
  65. package/styles/cove-main.scss +6 -0
  66. package/styles/filters.scss +6 -4
  67. package/styles/v2/components/ui/tooltip.scss +42 -40
  68. package/styles/v2/layout/_component.scss +0 -6
  69. package/styles/v2/layout/index.scss +0 -1
  70. package/types/Axis.ts +2 -0
  71. package/types/General.ts +1 -0
  72. package/types/Table.ts +2 -1
  73. package/types/Visualization.ts +13 -1
  74. package/types/VizFilter.ts +2 -1
  75. package/components/DataTable/components/Icons.tsx +0 -10
  76. package/components/_stories/EditorPanel.stories.tsx +0 -54
  77. package/components/_stories/Layout.Debug.stories.tsx +0 -91
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1 @@
1
+ <?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96.31 82.55"><g id="a"><path d="M88.56,66.3H15.36V9.68c0-1.1-.9-2-2-2H7.89c-1.1,0-2,.9-2,2V73.77c0,1.1,.9,2,2,2H88.56c1.1,0,2-.9,2-2v-5.48c0-1.1-.9-2-2-2Z"/><path d="M18.36,54.67v6.94c0,1.1,.9,2,2,2h5.48c1.1,0,2-.9,2-2l-.13-6.94c0-1.1-.9-2-2-2h-5.34c-1.1,0-2,.9-2,2Z"/><path d="M30.43,45.3v16.31c0,1.1,.9,2,2,2h5.48c1.1,0,2-.9,2-2l-.13-16.31c0-1.1-.9-2-2-2h-5.34c-1.1,0-2,.9-2,2Z"/><path d="M42.51,32.3v29.31c0,1.1,.9,2,2,2h5.48c1.1,0,2-.9,2-2l-.13-29.31c0-1.1-.9-2-2-2h-5.34c-1.1,0-2,.9-2,2Z"/><path d="M54.58,32.3v29.31c0,1.1,.9,2,2,2h5.48c1.1,0,2-.9,2-2l-.13-29.31c0-1.1-.9-2-2-2h-5.34c-1.1,0-2,.9-2,2Z"/><path d="M66.66,42.22v19.33c0,1.1,.9,2,2,2h5.48c1.1,0,2-.9,2-2l-.13-19.33c0-1.1-.9-2-2-2h-5.34c-1.1,0-2,.9-2,2Z"/><path d="M78.73,58.89v2.72c0,1.1,.9,2,2,2h5.48c1.1,0,2-.9,2-2l-.13-2.72c0-1.1-.9-2-2-2h-5.34c-1.1,0-2,.9-2,2Z"/><g><path d="M20.25,38.69c-.65,0-1.3-.32-1.68-.91-.6-.93-.34-2.16,.59-2.77,.01,0,1.17-.76,2.86-1.92,.91-.62,2.16-.39,2.78,.52,.62,.91,.39,2.16-.52,2.78-1.75,1.2-2.95,1.98-2.95,1.98-.34,.22-.71,.32-1.09,.32Z"/><path d="M28.5,32.92c-.61,0-1.21-.28-1.6-.8-.66-.88-.48-2.14,.4-2.8,1.91-1.43,3.51-2.72,4.76-3.83l.21-.19c.82-.74,2.09-.67,2.82,.16,.74,.82,.66,2.09-.16,2.82l-.22,.2c-1.34,1.19-3.03,2.55-5.02,4.04-.36,.27-.78,.4-1.2,.4Zm50.28-1.66c-.34,0-.68-.09-1-.27-1.64-.95-3.38-2.08-5.66-3.67-.91-.63-1.13-1.88-.49-2.79,.63-.9,1.88-1.13,2.79-.49,2.17,1.52,3.83,2.6,5.37,3.48,.96,.55,1.28,1.78,.73,2.73-.37,.64-1.04,1-1.73,1Zm-40.24-6.8c-.58,0-1.15-.25-1.55-.73-.7-.85-.58-2.11,.28-2.81,1.98-1.63,3.82-2.93,5.61-3.98,.95-.56,2.18-.24,2.74,.72s.24,2.18-.72,2.74c-1.61,.94-3.27,2.12-5.09,3.62-.37,.31-.82,.45-1.27,.45Zm29.37-.59c-.4,0-.8-.12-1.15-.37-1.61-1.13-3.5-2.44-5.34-3.52-.95-.56-1.27-1.78-.72-2.74,.56-.95,1.78-1.27,2.74-.72,1.98,1.16,3.95,2.52,5.63,3.7,.9,.64,1.12,1.88,.48,2.79-.39,.55-1.01,.85-1.64,.85Zm-18-5.77c-.89,0-1.7-.6-1.93-1.49-.28-1.07,.36-2.16,1.43-2.44,1.72-.45,3.46-.68,5.17-.68,.71,0,1.46,.08,2.24,.24,1.08,.23,1.77,1.29,1.55,2.37s-1.29,1.77-2.37,1.55c-.5-.11-.98-.16-1.42-.16-1.37,0-2.77,.18-4.16,.55-.17,.04-.34,.07-.51,.07Z"/><path d="M88.21,34.46c-1.26,0-2.6-.2-4-.6-1.06-.3-1.68-1.41-1.37-2.47,.3-1.06,1.41-1.68,2.47-1.37,1.04,.3,2.02,.45,2.9,.45,1.1,0,2,.9,2,2s-.9,2-2,2Z"/></g></g><g id="b"/></svg>
@@ -0,0 +1,27 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 26.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 96.3 82.6" style="enable-background:new 0 0 96.3 82.6;" xml:space="preserve">
5
+ <path d="M88.6,66.5H15.4V7.6c0-1.1-0.9-2-2-2H7.9c-1.1,0-2,0.9-2,2V74c0,1.1,0.9,2,2,2h80.7c1.1,0,2-0.9,2-2v-5.5
6
+ C90.6,67.4,89.7,66.5,88.6,66.5L88.6,66.5z"/>
7
+ <path d="M31.7,51.1V63c0,1.1,0.9,2,2,2h1.1c1.1,0,2-0.9,2-2l-0.1-11.9c0-1.1-0.9-2-2-2h-0.9C32.6,49.1,31.7,50,31.7,51.1L31.7,51.1z
8
+ "/>
9
+ <path d="M38.7,41.7V63c0,1.1,0.9,2,2,2h1.1c1.1,0,2-0.9,2-2l-0.1-21.3c0-1.1-0.9-2-2-2h-0.9C39.6,39.7,38.7,40.6,38.7,41.7
10
+ L38.7,41.7z"/>
11
+ <path d="M45.7,28.7V63c0,1.1,0.9,2,2,2h1.1c1.1,0,2-0.9,2-2l-0.1-34.3c0-1.1-0.9-2-2-2h-0.9C46.6,26.7,45.7,27.6,45.7,28.7
12
+ L45.7,28.7z"/>
13
+ <path d="M59.7,28.7V63c0,1.1,0.9,2,2,2h1.1c1.1,0,2-0.9,2-2l-0.1-34.3c0-1.1-0.9-2-2-2h-0.9C60.6,26.7,59.7,27.6,59.7,28.7
14
+ L59.7,28.7z"/>
15
+ <path d="M52.7,23.6V63c0,1.1,0.9,2,2,2h1.1c1.1,0,2-0.9,2-2l-0.1-39.4c0-1.1-0.9-2-2-2h-0.9C53.6,21.6,52.7,22.5,52.7,23.6
16
+ L52.7,23.6z"/>
17
+ <path d="M66.8,38.6v24.3c0,1.1,0.9,2,2,2h1.1c1.1,0,2-0.9,2-2l-0.1-24.3c0-1.1-0.9-2-2-2h-0.9C67.7,36.6,66.8,37.5,66.8,38.6
18
+ L66.8,38.6z"/>
19
+ <path d="M73.8,55.3V63c0,1.1,0.9,2,2,2h1.1c1.1,0,2-0.9,2-2l-0.1-7.7c0-1.1-0.9-2-2-2h-0.9C74.7,53.3,73.8,54.2,73.8,55.3L73.8,55.3
20
+ z"/>
21
+ <path d="M24.7,55.3V63c0,1.1,0.9,2,2,2h1.1c1.1,0,2-0.9,2-2l-0.1-7.7c0-1.1-0.9-2-2-2h-0.9C25.6,53.3,24.7,54.2,24.7,55.3L24.7,55.3
22
+ z"/>
23
+ <path d="M17.6,61.5V63c0,1.1,0.9,2,2,2h1.1c1.1,0,2-0.9,2-2v-1.6c0-1.1-1-1.9-2.1-1.9h-0.9C18.5,59.5,17.6,60.4,17.6,61.5L17.6,61.5
24
+ z"/>
25
+ <path d="M80.8,61.5V63c0,1.1,0.9,2,2,2h1.1c1.1,0,2-0.9,2-2v-1.6c0-1.1-1-1.9-2.1-1.9h-0.9C81.7,59.5,80.8,60.4,80.8,61.5L80.8,61.5
26
+ z"/>
27
+ </svg>
@@ -0,0 +1,44 @@
1
+ import React from 'react'
2
+ import { Text } from '@visx/text'
3
+
4
+ // Extension for visx Text component that creates a second text element and a def with a blur effect to create a feathered stroke effect using a filter with Gaussian blur. No actual stroke is used
5
+
6
+ export interface BlurStrokeTextProps extends React.ComponentProps<typeof Text> {
7
+ blurRadius?: number
8
+ stroke?: string
9
+ strokeWidth?: number
10
+ strokeMiterLimit?: number
11
+ disableStroke?: boolean
12
+ disableBlur?: boolean
13
+ }
14
+
15
+ export const BlurStrokeText: React.FC<BlurStrokeTextProps> = ({
16
+ blurRadius = 1,
17
+ stroke = 'white',
18
+ strokeWidth = 8,
19
+ strokeMiterLimit = 2,
20
+ disableStroke = false,
21
+ disableBlur = false,
22
+ ...props
23
+ }) => {
24
+ return (
25
+ <>
26
+ <defs>
27
+ <filter id='blur' x='-50%' y='-50%' width='200%' height='200%'>
28
+ <feGaussianBlur in='SourceGraphic' stdDeviation={blurRadius} />
29
+ </filter>
30
+ </defs>
31
+ {!disableStroke && (
32
+ <Text
33
+ {...props}
34
+ filter={disableBlur ? undefined : 'url(#blur)'}
35
+ fill={stroke}
36
+ stroke={stroke}
37
+ strokeWidth={strokeWidth}
38
+ strokeMiterlimit={strokeMiterLimit}
39
+ />
40
+ )}
41
+ <Text {...props} />
42
+ </>
43
+ )
44
+ }
@@ -20,6 +20,8 @@ import removeNullColumns from './helpers/removeNullColumns'
20
20
  import { TableConfig } from './types/TableConfig'
21
21
  import { Column } from '../../types/Column'
22
22
  import { pivotData } from '../../helpers/pivotData'
23
+ import { isLegendWrapViewport } from '@cdc/core/helpers/viewports'
24
+ import './data-table.css'
23
25
 
24
26
  export type DataTableProps = {
25
27
  applyLegendToRow?: Function
@@ -71,9 +73,9 @@ const DataTable = (props: DataTableProps) => {
71
73
  const runtimeData = useMemo(() => {
72
74
  const data = removeNullColumns(parentRuntimeData)
73
75
  if (config.table.pivot) {
74
- const { columnName, valueColumn } = config.table.pivot
75
- if (columnName && valueColumn) {
76
- return pivotData(data, columnName, valueColumn)
76
+ const { columnName, valueColumns } = config.table.pivot
77
+ if (columnName && valueColumns) {
78
+ return pivotData(data, columnName, valueColumns)
77
79
  }
78
80
  }
79
81
  return data
@@ -130,26 +132,27 @@ const DataTable = (props: DataTableProps) => {
130
132
  }
131
133
 
132
134
  const rawRows = Object.keys(runtimeData).filter(column => column != 'columns')
133
- const rows = isVertical
134
- ? rawRows.sort((a, b) => {
135
- let dataA
136
- let dataB
137
- if (config.type === 'map' && config.columns) {
138
- const sortByColName = config.columns[sortBy.column].name
139
- dataA = runtimeData[a][sortByColName]
140
- dataB = runtimeData[b][sortByColName]
141
- }
142
- if (config.type === 'chart' || config.type === 'dashboard') {
143
- dataA = runtimeData[a][sortBy.column]
144
- dataB = runtimeData[b][sortBy.column]
145
- }
146
- if (!dataA && !dataB && config.type === 'chart' && config.xAxis && config.xAxis.type === 'date-time') {
147
- dataA = timeParse(config.runtime.xAxis.dateParseFormat)(runtimeData[a][config.xAxis.dataKey])
148
- dataB = timeParse(config.runtime.xAxis.dateParseFormat)(runtimeData[b][config.xAxis.dataKey])
149
- }
150
- return dataA && dataB ? customSort(dataA, dataB, sortBy, config) : 0
151
- })
152
- : rawRows
135
+ const rows =
136
+ isVertical && sortBy.column
137
+ ? rawRows.sort((a, b) => {
138
+ let dataA
139
+ let dataB
140
+ if (config.type === 'map' && config.columns) {
141
+ const sortByColName = config.columns[sortBy.column].name
142
+ dataA = runtimeData[a][sortByColName]
143
+ dataB = runtimeData[b][sortByColName]
144
+ }
145
+ if (['chart', 'dashboard', 'table'].includes(config.type)) {
146
+ dataA = runtimeData[a][sortBy.column]
147
+ dataB = runtimeData[b][sortBy.column]
148
+ }
149
+ if (!dataA && !dataB && config.type === 'chart' && config.xAxis && config.xAxis.type === 'date-time') {
150
+ dataA = timeParse(config.runtime.xAxis.dateParseFormat)(runtimeData[a][config.xAxis.dataKey])
151
+ dataB = timeParse(config.runtime.xAxis.dateParseFormat)(runtimeData[b][config.xAxis.dataKey])
152
+ }
153
+ return dataA && dataB ? customSort(dataA, dataB, sortBy, config) : 0
154
+ })
155
+ : rawRows
153
156
 
154
157
  const limitHeight = {
155
158
  maxHeight: config.table.limitHeight && `${config.table.height}px`,
@@ -208,17 +211,21 @@ const DataTable = (props: DataTableProps) => {
208
211
  }
209
212
  }
210
213
 
211
- const getMediaControlsClasses = () => {
214
+ const getMediaControlsClasses = belowTable => {
212
215
  const classes = ['download-links']
213
- const isLegendOnBottom = config?.legend?.position === 'bottom' || ['sm', 'xs', 'xxs'].includes(viewport)
214
- if (config.brush?.active && !isLegendOnBottom) classes.push('brush-active')
215
- if (config.brush?.active && config.legend.hide) classes.push('brush-active')
216
+ if (!belowTable) {
217
+ const isLegendOnBottom = config?.legend?.position === 'bottom' || isLegendWrapViewport(viewport)
218
+ if (config.brush?.active && !isLegendOnBottom) classes.push('brush-active')
219
+ if (config.brush?.active && config.legend.hide) classes.push('brush-active')
220
+ } else {
221
+ classes.push('below-table')
222
+ }
216
223
  return classes
217
224
  }
218
225
 
219
- return (
220
- <ErrorBoundary component='DataTable'>
221
- <MediaControls.Section classes={getMediaControlsClasses()}>
226
+ const TableMediaControls = ({ belowTable }) => {
227
+ return (
228
+ <MediaControls.Section classes={getMediaControlsClasses(belowTable)}>
222
229
  <MediaControls.Link config={config} dashboardDataConfig={dataConfig} />
223
230
  {(config.table.download || config.general?.showDownloadButton) && (
224
231
  <DownloadButton
@@ -228,9 +235,17 @@ const DataTable = (props: DataTableProps) => {
228
235
  />
229
236
  )}
230
237
  </MediaControls.Section>
238
+ )
239
+ }
240
+
241
+ return (
242
+ <ErrorBoundary component='DataTable'>
243
+ {!config.table.showDownloadLinkBelow && <TableMediaControls />}
231
244
  <section
232
245
  id={tabbingId.replace('#', '')}
233
- className={`data-table-container ${viewport} w-100`}
246
+ className={`data-table-container ${viewport} ${
247
+ !config.table.showDownloadLinkBelow ? 'download-link-above' : ''
248
+ }`}
234
249
  aria-label={accessibilityLabel}
235
250
  >
236
251
  <SkipTo skipId={skipId} skipMessage='Skip Data Table' />
@@ -272,7 +287,7 @@ const DataTable = (props: DataTableProps) => {
272
287
  )
273
288
  }
274
289
  tableOptions={{
275
- className: `${expanded ? 'data-table' : 'data-table cdcdataviz-sr-only'}${
290
+ className: `table table-striped ${expanded ? 'data-table' : 'data-table cdcdataviz-sr-only'}${
276
291
  isVertical ? '' : ' horizontal'
277
292
  }`,
278
293
  'aria-live': 'assertive',
@@ -300,12 +315,13 @@ const DataTable = (props: DataTableProps) => {
300
315
  <th>End Date</th>
301
316
  </tr>
302
317
  }
303
- tableOptions={{ className: 'region-table data-table' }}
318
+ tableOptions={{ className: 'table table-striped region-table data-table' }}
304
319
  fontSize={config.fontSize}
305
320
  />
306
321
  )}
307
322
  </div>
308
323
  </section>
324
+ {config.table.showDownloadLinkBelow && <TableMediaControls belowTable={true} />}
309
325
  <div id={skipId} className='cdcdataviz-sr-only'>
310
326
  Skipped data table.
311
327
  </div>
@@ -317,7 +333,7 @@ const DataTable = (props: DataTableProps) => {
317
333
  <ErrorBoundary component='DataTable'>
318
334
  <section
319
335
  id={tabbingId.replace('#', '')}
320
- className={`data-table-container ${viewport} w-100`}
336
+ className={`data-table-container ${viewport}`}
321
337
  aria-label={accessibilityLabel}
322
338
  >
323
339
  <SkipTo skipId={skipId} skipMessage='Skip Data Table' />
@@ -332,7 +348,7 @@ const DataTable = (props: DataTableProps) => {
332
348
  stickyHeader
333
349
  headContent={<BoxplotHeader categories={config.boxplot.categories} />}
334
350
  tableOptions={{
335
- className: `${expanded ? 'data-table' : 'data-table cdcdataviz-sr-only'}`,
351
+ className: `table table-striped ${expanded ? 'data-table' : 'data-table cdcdataviz-sr-only'}`,
336
352
  'aria-live': 'assertive',
337
353
  'aria-rowcount': 11,
338
354
  hidden: !expanded
@@ -15,25 +15,56 @@ type StandAloneProps = {
15
15
  updateConfig?: (Visualization) => void
16
16
  }
17
17
 
18
- const DataTableStandAlone: React.FC<StandAloneProps> = ({ visualizationKey, config, updateConfig, viewport, isEditor }) => {
19
- const [filteredData, setFilteredData] = useState<Record<string, any>[]>(filterVizData(config.filters, config.formattedData))
18
+ const DataTableStandAlone: React.FC<StandAloneProps> = ({
19
+ visualizationKey,
20
+ config,
21
+ updateConfig,
22
+ viewport,
23
+ isEditor
24
+ }) => {
25
+ const [filteredData, setFilteredData] = useState<Record<string, any>[]>(
26
+ filterVizData(config.filters, config.formattedData || config.data)
27
+ )
20
28
 
21
29
  useEffect(() => {
22
30
  // when using editor changes to filter should update the data
23
- setFilteredData(filterVizData(config.filters, config?.formattedData?.length > 0 ? config.formattedData : config.data))
31
+ setFilteredData(
32
+ filterVizData(config.filters, config?.formattedData?.length > 0 ? config.formattedData : config.data)
33
+ )
24
34
  }, [config.filters])
25
35
 
26
36
  if (isEditor)
27
37
  return (
28
- <EditorWrapper component={DataTableStandAlone} visualizationKey={visualizationKey} visualizationConfig={config} updateConfig={updateConfig} type={'Table'} viewport={viewport}>
38
+ <EditorWrapper
39
+ component={DataTableStandAlone}
40
+ visualizationKey={visualizationKey}
41
+ visualizationConfig={config}
42
+ updateConfig={updateConfig}
43
+ type={'Table'}
44
+ viewport={viewport}
45
+ >
29
46
  <DataTableEditorPanel key={visualizationKey} config={config} updateConfig={updateConfig} />
30
47
  </EditorWrapper>
31
48
  )
32
49
 
33
50
  return (
34
51
  <>
35
- <Filters config={config} setConfig={updateConfig} setFilteredData={setFilteredData} filteredData={filteredData} excludedData={config.formattedData} />
36
- <DataTable expandDataTable={true} config={config} rawData={config.data} runtimeData={filteredData} tabbingId={visualizationKey} tableTitle={config.table.label} viewport={viewport || 'lg'} />
52
+ <Filters
53
+ config={config}
54
+ setConfig={updateConfig}
55
+ setFilteredData={setFilteredData}
56
+ filteredData={filteredData}
57
+ excludedData={config.formattedData}
58
+ />
59
+ <DataTable
60
+ expandDataTable={config.table.expanded}
61
+ config={config}
62
+ rawData={config.data}
63
+ runtimeData={filteredData}
64
+ tabbingId={visualizationKey}
65
+ tableTitle={config.table.label}
66
+ viewport={viewport || 'lg'}
67
+ />
37
68
  </>
38
69
  )
39
70
  }
@@ -1,8 +1,9 @@
1
1
  import { getChartCellValue } from '../helpers/getChartCellValue'
2
2
  import { getSeriesName } from '../helpers/getSeriesName'
3
3
  import { getDataSeriesColumns } from '../helpers/getDataSeriesColumns'
4
- import { DownIcon, UpIcon } from './Icons'
5
4
  import ScreenReaderText from '@cdc/core/components/elements/ScreenReaderText'
5
+ import { SortIcon } from './SortIcon'
6
+ import { getNewSortBy } from '../helpers/getNewSortBy'
6
7
 
7
8
  type ChartHeaderProps = { data; isVertical; config; setSortBy; sortBy; hasRowType? }
8
9
 
@@ -19,17 +20,6 @@ const ChartHeader = ({ data, isVertical, config, setSortBy, sortBy, hasRowType }
19
20
  }
20
21
  }
21
22
 
22
- const handleHeaderClasses = (sortBy, text) => {
23
- let classes = ['sort']
24
- if (sortBy.column === text && sortBy.asc) {
25
- classes.push('sort-asc')
26
- }
27
- if (sortBy.column === text && sortBy.desc) {
28
- classes.push('sort-desc')
29
- }
30
- return classes.join(' ')
31
- }
32
-
33
23
  const ScreenReaderSortByText = ({ text, config, sortBy }) => {
34
24
  const notApplicableText = 'Not Applicable'
35
25
  let columnHeaderText = `${text} `
@@ -47,13 +37,19 @@ const ChartHeader = ({ data, isVertical, config, setSortBy, sortBy, hasRowType }
47
37
 
48
38
  if (columnHeaderText === notApplicableText) return
49
39
 
50
- return <span className='cdcdataviz-sr-only'>{`Press command, modifier, or enter key to sort by ${columnHeaderText} in ${sortBy.column !== columnHeaderText ? 'ascending' : sortBy.column === 'desc' ? 'descending' : 'ascending'} order`}</span>
40
+ return (
41
+ <span className='cdcdataviz-sr-only'>{`Press command, modifier, or enter key to sort by ${columnHeaderText} in ${
42
+ sortBy.column !== columnHeaderText ? 'ascending' : sortBy.column === 'desc' ? 'descending' : 'ascending'
43
+ } order`}</span>
44
+ )
51
45
  }
52
46
 
53
47
  const ColumnHeadingText = ({ column, text, config }) => {
48
+ if (text === 'pivotColumn') return ''
54
49
  let notApplicableText = 'Not Applicable'
55
50
  if (text === '__series__' && config.table.indexLabel) return `${config.table.indexLabel} `
56
- if (text === '__series__' && !config.table.indexLabel) return <ScreenReaderText as='span'>{notApplicableText}</ScreenReaderText>
51
+ if (text === '__series__' && !config.table.indexLabel)
52
+ return <ScreenReaderText as='span'>{notApplicableText}</ScreenReaderText>
57
53
  return text
58
54
  }
59
55
 
@@ -71,7 +67,8 @@ const ChartHeader = ({ data, isVertical, config, setSortBy, sortBy, hasRowType }
71
67
  <tr>
72
68
  {dataSeriesColumns.map((column, index) => {
73
69
  const text = getSeriesName(column, config)
74
-
70
+ const newSortBy = getNewSortBy(sortBy, column, index)
71
+ const sortByAsc = sortBy.column === column ? sortBy.asc : undefined
75
72
  return (
76
73
  <th
77
74
  style={{ minWidth: (config.table.cellMinWidth || 0) + 'px' }}
@@ -81,19 +78,22 @@ const ChartHeader = ({ data, isVertical, config, setSortBy, sortBy, hasRowType }
81
78
  scope='col'
82
79
  onClick={() => {
83
80
  if (hasRowType) return
84
- setSortBy({ column, asc: sortBy.column === column ? !sortBy.asc : false, colIndex: index })
81
+ setSortBy(newSortBy)
85
82
  }}
86
83
  onKeyDown={e => {
87
84
  if (hasRowType) return
88
85
  if (e.keyCode === 13) {
89
- setSortBy({ column, asc: sortBy.column === column ? !sortBy.asc : false, colIndex: index })
86
+ setSortBy(newSortBy)
90
87
  }
91
88
  }}
92
- className={handleHeaderClasses(sortBy, text)}
93
- {...(sortBy.column === column ? (sortBy.asc ? { 'aria-sort': 'ascending' } : { 'aria-sort': 'descending' }) : null)}
89
+ {...(sortBy.column === column
90
+ ? sortBy.asc
91
+ ? { 'aria-sort': 'ascending' }
92
+ : { 'aria-sort': 'descending' }
93
+ : null)}
94
94
  >
95
95
  <ColumnHeadingText text={text} column={column} config={config} />
96
- {column === sortBy.column && <span className={'sort-icon'}>{!sortBy.asc ? <UpIcon /> : <DownIcon />}</span>}
96
+ {column === sortBy.column && !hasRowType && <SortIcon ascending={sortByAsc} />}
97
97
  <ScreenReaderSortByText sortBy={sortBy} config={config} text={text} />
98
98
  </th>
99
99
  )
@@ -107,7 +107,8 @@ const ChartHeader = ({ data, isVertical, config, setSortBy, sortBy, hasRowType }
107
107
  {['__series__', ...Object.keys(data)].slice(sliceVal).map((row, index) => {
108
108
  let column = config.xAxis?.dataKey
109
109
  let text = row !== '__series__' ? getChartCellValue(row, column, config, data) : '__series__'
110
-
110
+ const newSortBy = getNewSortBy(sortBy, column, index)
111
+ const sortByAsc = sortBy.colIndex === index ? sortBy.asc : undefined
111
112
  return (
112
113
  <th
113
114
  style={{ minWidth: (config.table.cellMinWidth || 0) + 'px' }}
@@ -116,18 +117,22 @@ const ChartHeader = ({ data, isVertical, config, setSortBy, sortBy, hasRowType }
116
117
  role='columnheader'
117
118
  scope='col'
118
119
  onClick={() => {
119
- setSortBy({ column: text, asc: sortBy.column === text ? !sortBy.asc : false, colIndex: index })
120
+ setSortBy(newSortBy)
120
121
  }}
121
122
  onKeyDown={e => {
122
123
  if (e.keyCode === 13) {
123
- setSortBy({ column: text, asc: sortBy.column === text ? !sortBy.asc : false, colIndex: index })
124
+ setSortBy(newSortBy)
124
125
  }
125
126
  }}
126
- className={handleHeaderClasses(sortBy, text)}
127
- {...(sortBy.column === text ? (sortBy.asc ? { 'aria-sort': 'ascending' } : { 'aria-sort': 'descending' }) : null)}
127
+ {...(sortBy.column === text
128
+ ? sortBy.asc
129
+ ? { 'aria-sort': 'ascending' }
130
+ : { 'aria-sort': 'descending' }
131
+ : null)}
128
132
  >
129
133
  <ColumnHeadingText text={text} column={column} config={config} />
130
- {index === sortBy.colIndex && <span className={'sort-icon'}>{!sortBy.asc ? <UpIcon /> : <DownIcon />}</span>}
134
+ {index === sortBy.colIndex && !hasRowType && <SortIcon ascending={sortByAsc} />}
135
+
131
136
  <ScreenReaderSortByText text={text} config={config} sortBy={sortBy} />
132
137
  </th>
133
138
  )