@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
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>
@@ -6,6 +6,7 @@ import { FilterFunction, JsonEditor, UpdateFunction } from 'json-edit-react'
6
6
  import { formatConfigBeforeSave as stripConfig } from '../../helpers/formatConfigBeforeSave'
7
7
  import './advanced-editor-styles.css'
8
8
  import _ from 'lodash'
9
+ import Tooltip from '../ui/Tooltip'
9
10
 
10
11
  export const AdvancedEditor = ({ loadConfig, config, convertStateToConfig, onExpandCollapse = () => {} }) => {
11
12
  const [advancedToggle, _setAdvancedToggle] = useState(false)
@@ -37,7 +38,11 @@ export const AdvancedEditor = ({ loadConfig, config, convertStateToConfig, onExp
37
38
  chart: ['Charts', 'https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/bar-chart.html', <ChartIcon />],
38
39
  dashboard: ['Dashboard', 'https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/bar-chart.html', <ChartIcon />],
39
40
  map: ['Maps', 'https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/data-map.html', <MapIcon />],
40
- 'markup-include': ['Markup Include', 'https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/Markup-Include.html', <MarkupIncludeIcon />]
41
+ 'markup-include': [
42
+ 'Markup Include',
43
+ 'https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/Markup-Include.html',
44
+ <MarkupIncludeIcon />
45
+ ]
41
46
  }
42
47
 
43
48
  if (!config.type) return <></>
@@ -63,25 +68,24 @@ export const AdvancedEditor = ({ loadConfig, config, convertStateToConfig, onExp
63
68
  </div>
64
69
  </section>
65
70
  <p className='pb-2'>
66
- This tool displays the actual <acronym title='JavaScript Object Notation'>JSON</acronym> configuration that is generated by this editor and allows you to edit properties directly and apply them.
71
+ This tool displays the actual <acronym title='JavaScript Object Notation'>JSON</acronym> configuration
72
+ that is generated by this editor and allows you to edit properties directly and apply them.
67
73
  </p>
74
+ <JsonEditor
75
+ className='advanced-json-editor'
76
+ data={configTextboxValue}
77
+ onUpdate={onUpdate}
78
+ rootName=''
79
+ collapse={collapseFields}
80
+ />
68
81
  <button
69
- className='btn '
70
- onClick={() => {
71
- navigator.clipboard.writeText(JSON.stringify(configTextboxValue))
72
- }}
73
- >
74
- Copy to Clipboard
75
- </button>
76
- <JsonEditor className='advanced-json-editor' data={configTextboxValue} onUpdate={onUpdate} rootName='' collapse={collapseFields} />
77
- <button
78
- className='btn full-width'
82
+ className='btn btn-success m-2 p-2'
79
83
  onClick={() => {
80
84
  loadConfig(configTextboxValue)
81
85
  setAdvancedToggle(!advancedToggle)
82
86
  }}
83
87
  >
84
- Apply
88
+ Apply Configuration Changes
85
89
  </button>
86
90
  </React.Fragment>
87
91
  )}
@@ -1,7 +1,7 @@
1
1
  import Icon from '../../ui/Icon'
2
2
 
3
3
  import DOMPurify from 'dompurify'
4
- import React from 'react'
4
+ import React, { useEffect } from 'react'
5
5
 
6
6
  import './Alert.styles.css'
7
7
 
@@ -14,10 +14,31 @@ type AlertProps = {
14
14
  iconSize?: number
15
15
  // heading for the alert box
16
16
  heading?: string
17
+ // dismiss function
18
+ onDismiss?: Function
19
+ // make the alert dismiss on it's own
20
+ autoDismiss?: boolean
21
+ // set seconds until autoDismiss, default is 5 seconds
22
+ secondsBeforeDismiss?: number
17
23
  }
18
24
 
19
- const Alert: React.FC<AlertProps> = ({ type = 'info', message = '', iconSize = 21, heading }) => {
25
+ const Alert: React.FC<AlertProps> = ({
26
+ type = 'info',
27
+ message = '',
28
+ iconSize = 21,
29
+ heading,
30
+ onDismiss,
31
+ autoDismiss,
32
+ secondsBeforeDismiss = 5
33
+ }) => {
20
34
  // sanitize the text for setting dangerouslySetInnerHTML
35
+
36
+ useEffect(() => {
37
+ if (autoDismiss) {
38
+ setTimeout(() => onDismiss(), secondsBeforeDismiss * 1000)
39
+ }
40
+ }, [])
41
+
21
42
  const sanitizedData = () => ({
22
43
  __html: DOMPurify.sanitize(message)
23
44
  })
@@ -26,12 +47,17 @@ const Alert: React.FC<AlertProps> = ({ type = 'info', message = '', iconSize = 2
26
47
  const styleResets = { width: 'unset', height: 'unset', paddingRight: '5px' }
27
48
 
28
49
  return (
29
- <div className={`alert alert-${type} p-1`} role='alert'>
30
- {heading && <h4 className='alert-heading'>{heading}</h4>}
31
- {type === 'success' && <Icon display='check' size={iconSize} />}
32
- {type === 'danger' && <Icon display='warningCircle' size={iconSize} />}
33
- {type === 'info' && <Icon display='info' size={iconSize} />}
34
- <span dangerouslySetInnerHTML={sanitizedData()} />
50
+ <div className={`alert alert-${type} p-1 d-flex justify-content-between`} role='alert'>
51
+ <div className='d-flex'>
52
+ {heading && <h4 className='alert-heading'>{heading}</h4>}
53
+ {type === 'success' && <Icon display='check' size={iconSize} />}
54
+ {type === 'danger' && <Icon display='warningCircle' size={iconSize} />}
55
+ {type === 'info' && <Icon display='info' size={iconSize} />}
56
+ <span dangerouslySetInnerHTML={sanitizedData()} />
57
+ </div>
58
+ <button type='button' className='close pl-5' aria-label='Close' onClick={() => onDismiss()}>
59
+ X
60
+ </button>
35
61
  </div>
36
62
  )
37
63
  }
@@ -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,9 @@ 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'
25
+ import _ from 'lodash'
23
26
 
24
27
  export type DataTableProps = {
25
28
  applyLegendToRow?: Function
@@ -71,9 +74,14 @@ const DataTable = (props: DataTableProps) => {
71
74
  const runtimeData = useMemo(() => {
72
75
  const data = removeNullColumns(parentRuntimeData)
73
76
  if (config.table.pivot) {
74
- const { columnName, valueColumn } = config.table.pivot
75
- if (columnName && valueColumn) {
76
- return pivotData(data, columnName, valueColumn)
77
+ const excludeColumns = Object.values(config.columns || {})
78
+ .filter(column => column.dataTable === false)
79
+ .map(col => col.name)
80
+ const { columnName, valueColumns } = config.table.pivot
81
+ if (columnName && valueColumns) {
82
+ // remove excluded columns so that they aren't included in the pivot calculation
83
+ const _data = data.map(row => _.omit(row, excludeColumns))
84
+ return pivotData(_data, columnName, valueColumns)
77
85
  }
78
86
  }
79
87
  return data
@@ -82,7 +90,7 @@ const DataTable = (props: DataTableProps) => {
82
90
  const [expanded, setExpanded] = useState(expandDataTable)
83
91
 
84
92
  const [sortBy, setSortBy] = useState<any>({
85
- column: config.type === 'map' ? 'geo' : 'date',
93
+ column: '',
86
94
  asc: false,
87
95
  colIndex: null
88
96
  })
@@ -130,26 +138,27 @@ const DataTable = (props: DataTableProps) => {
130
138
  }
131
139
 
132
140
  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
141
+ const rows =
142
+ isVertical && sortBy.column
143
+ ? rawRows.sort((a, b) => {
144
+ let dataA
145
+ let dataB
146
+ if (config.type === 'map' && config.columns) {
147
+ const sortByColName = config.columns[sortBy.column].name
148
+ dataA = runtimeData[a][sortByColName]
149
+ dataB = runtimeData[b][sortByColName]
150
+ }
151
+ if (['chart', 'dashboard', 'table'].includes(config.type)) {
152
+ dataA = runtimeData[a][sortBy.column]
153
+ dataB = runtimeData[b][sortBy.column]
154
+ }
155
+ if (!dataA && !dataB && config.type === 'chart' && config.xAxis && config.xAxis.type === 'date-time') {
156
+ dataA = timeParse(config.runtime.xAxis.dateParseFormat)(runtimeData[a][config.xAxis.dataKey])
157
+ dataB = timeParse(config.runtime.xAxis.dateParseFormat)(runtimeData[b][config.xAxis.dataKey])
158
+ }
159
+ return dataA && dataB ? customSort(dataA, dataB, sortBy, config) : 0
160
+ })
161
+ : rawRows
153
162
 
154
163
  const limitHeight = {
155
164
  maxHeight: config.table.limitHeight && `${config.table.height}px`,
@@ -197,6 +206,7 @@ const DataTable = (props: DataTableProps) => {
197
206
  : config.runtime?.seriesKeys),
198
207
  [config.runtime?.seriesKeys]) // eslint-disable-line
199
208
 
209
+ const hasNoData = runtimeData.length === 0
200
210
  if (config.visualizationType !== 'Box Plot') {
201
211
  const getDownloadData = () => {
202
212
  // only use fullGeoName on County maps and no other
@@ -208,17 +218,21 @@ const DataTable = (props: DataTableProps) => {
208
218
  }
209
219
  }
210
220
 
211
- const getMediaControlsClasses = () => {
221
+ const getMediaControlsClasses = belowTable => {
212
222
  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')
223
+ if (!belowTable) {
224
+ const isLegendOnBottom = config?.legend?.position === 'bottom' || isLegendWrapViewport(viewport)
225
+ if (config.brush?.active && !isLegendOnBottom) classes.push('brush-active')
226
+ if (config.brush?.active && config.legend.hide) classes.push('brush-active')
227
+ } else {
228
+ classes.push('below-table')
229
+ }
216
230
  return classes
217
231
  }
218
232
 
219
- return (
220
- <ErrorBoundary component='DataTable'>
221
- <MediaControls.Section classes={getMediaControlsClasses()}>
233
+ const TableMediaControls = ({ belowTable }) => {
234
+ return (
235
+ <MediaControls.Section classes={getMediaControlsClasses(belowTable)}>
222
236
  <MediaControls.Link config={config} dashboardDataConfig={dataConfig} />
223
237
  {(config.table.download || config.general?.showDownloadButton) && (
224
238
  <DownloadButton
@@ -228,9 +242,17 @@ const DataTable = (props: DataTableProps) => {
228
242
  />
229
243
  )}
230
244
  </MediaControls.Section>
245
+ )
246
+ }
247
+
248
+ return (
249
+ <ErrorBoundary component='DataTable'>
250
+ {!config.table.showDownloadLinkBelow && <TableMediaControls />}
231
251
  <section
232
252
  id={tabbingId.replace('#', '')}
233
- className={`data-table-container ${viewport} w-100`}
253
+ className={`data-table-container ${viewport} ${
254
+ !config.table.showDownloadLinkBelow ? 'download-link-above' : ''
255
+ }`}
234
256
  aria-label={accessibilityLabel}
235
257
  >
236
258
  <SkipTo skipId={skipId} skipMessage='Skip Data Table' />
@@ -248,6 +270,7 @@ const DataTable = (props: DataTableProps) => {
248
270
  preliminaryData={config.preliminaryData}
249
271
  viewport={viewport}
250
272
  wrapColumns={wrapColumns}
273
+ noData={hasNoData}
251
274
  childrenMatrix={
252
275
  config.type === 'map'
253
276
  ? mapCellMatrix({ rows, wrapColumns, ...props, runtimeData, viewport })
@@ -272,7 +295,7 @@ const DataTable = (props: DataTableProps) => {
272
295
  )
273
296
  }
274
297
  tableOptions={{
275
- className: `${expanded ? 'data-table' : 'data-table cdcdataviz-sr-only'}${
298
+ className: `table table-striped ${expanded ? 'data-table' : 'data-table cdcdataviz-sr-only'}${
276
299
  isVertical ? '' : ' horizontal'
277
300
  }`,
278
301
  'aria-live': 'assertive',
@@ -291,6 +314,7 @@ const DataTable = (props: DataTableProps) => {
291
314
  viewport={viewport}
292
315
  wrapColumns={wrapColumns}
293
316
  childrenMatrix={regionCellMatrix({ config })}
317
+ noData={hasNoData}
294
318
  tableName={config.visualizationType}
295
319
  caption='Table of the highlighted regions in the visualization'
296
320
  headContent={
@@ -300,12 +324,13 @@ const DataTable = (props: DataTableProps) => {
300
324
  <th>End Date</th>
301
325
  </tr>
302
326
  }
303
- tableOptions={{ className: 'region-table data-table' }}
327
+ tableOptions={{ className: 'table table-striped region-table data-table' }}
304
328
  fontSize={config.fontSize}
305
329
  />
306
330
  )}
307
331
  </div>
308
332
  </section>
333
+ {config.table.showDownloadLinkBelow && <TableMediaControls belowTable={true} />}
309
334
  <div id={skipId} className='cdcdataviz-sr-only'>
310
335
  Skipped data table.
311
336
  </div>
@@ -317,7 +342,7 @@ const DataTable = (props: DataTableProps) => {
317
342
  <ErrorBoundary component='DataTable'>
318
343
  <section
319
344
  id={tabbingId.replace('#', '')}
320
- className={`data-table-container ${viewport} w-100`}
345
+ className={`data-table-container ${viewport}`}
321
346
  aria-label={accessibilityLabel}
322
347
  >
323
348
  <SkipTo skipId={skipId} skipMessage='Skip Data Table' />
@@ -327,12 +352,13 @@ const DataTable = (props: DataTableProps) => {
327
352
  viewport={viewport}
328
353
  wrapColumns={wrapColumns}
329
354
  childrenMatrix={boxplotCellMatrix({ rows: tableData, config })}
355
+ noData={hasNoData}
330
356
  tableName={config.visualizationType}
331
357
  caption={caption}
332
358
  stickyHeader
333
359
  headContent={<BoxplotHeader categories={config.boxplot.categories} />}
334
360
  tableOptions={{
335
- className: `${expanded ? 'data-table' : 'data-table cdcdataviz-sr-only'}`,
361
+ className: `table table-striped ${expanded ? 'data-table' : 'data-table cdcdataviz-sr-only'}`,
336
362
  'aria-live': 'assertive',
337
363
  'aria-rowcount': 11,
338
364
  hidden: !expanded