@cdc/core 4.25.2-25 → 4.25.3-6
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.
|
@@ -212,7 +212,12 @@ const DataTable = (props: DataTableProps) => {
|
|
|
212
212
|
const getClassNames = (): string => {
|
|
213
213
|
const classes = ['data-table-container']
|
|
214
214
|
|
|
215
|
-
|
|
215
|
+
const hasDownloadLinkAbove =
|
|
216
|
+
(config.table.download || config.general?.showDownloadButton) && !config.table.showDownloadLinkBelow
|
|
217
|
+
|
|
218
|
+
const isStandaloneTable = config.type === 'table'
|
|
219
|
+
|
|
220
|
+
if (!hasDownloadLinkAbove && !isStandaloneTable) {
|
|
216
221
|
classes.push('mt-4')
|
|
217
222
|
}
|
|
218
223
|
|
|
@@ -237,15 +242,19 @@ const DataTable = (props: DataTableProps) => {
|
|
|
237
242
|
}
|
|
238
243
|
}
|
|
239
244
|
|
|
240
|
-
const getMediaControlsClasses = belowTable => {
|
|
245
|
+
const getMediaControlsClasses = (belowTable, hasDownloadLink) => {
|
|
241
246
|
const classes = ['download-links']
|
|
242
247
|
if (!belowTable) {
|
|
243
|
-
|
|
248
|
+
if (hasDownloadLink) {
|
|
249
|
+
classes.push('mt-4', 'mb-2')
|
|
250
|
+
}
|
|
244
251
|
const isLegendOnBottom = config?.legend?.position === 'bottom' || isLegendWrapViewport(viewport)
|
|
245
252
|
if (config.brush?.active && !isLegendOnBottom) classes.push('brush-active')
|
|
246
253
|
if (config.brush?.active && config.legend.hide) classes.push('brush-active')
|
|
247
254
|
} else {
|
|
248
|
-
|
|
255
|
+
if (hasDownloadLink) {
|
|
256
|
+
classes.push('mt-2')
|
|
257
|
+
}
|
|
249
258
|
}
|
|
250
259
|
return classes
|
|
251
260
|
}
|
|
@@ -267,10 +276,11 @@ const DataTable = (props: DataTableProps) => {
|
|
|
267
276
|
: {}
|
|
268
277
|
|
|
269
278
|
const TableMediaControls = ({ belowTable }) => {
|
|
279
|
+
const hasDownloadLink = config.table.download || config.general?.showDownloadButton
|
|
270
280
|
return (
|
|
271
|
-
<MediaControls.Section classes={getMediaControlsClasses(belowTable)}>
|
|
281
|
+
<MediaControls.Section classes={getMediaControlsClasses(belowTable, hasDownloadLink)}>
|
|
272
282
|
<MediaControls.Link config={config} dashboardDataConfig={dataConfig} />
|
|
273
|
-
{
|
|
283
|
+
{hasDownloadLink && (
|
|
274
284
|
<DownloadButton
|
|
275
285
|
rawData={getDownloadData()}
|
|
276
286
|
fileName={`${vizTitle || 'data-table'}.csv`}
|
|
@@ -283,7 +293,7 @@ const DataTable = (props: DataTableProps) => {
|
|
|
283
293
|
|
|
284
294
|
return (
|
|
285
295
|
<ErrorBoundary component='DataTable'>
|
|
286
|
-
{
|
|
296
|
+
{!config.table.showDownloadLinkBelow && <TableMediaControls />}
|
|
287
297
|
<section id={tabbingId.replace('#', '')} className={getClassNames()} aria-label={accessibilityLabel}>
|
|
288
298
|
<SkipTo skipId={skipId} skipMessage='Skip Data Table' />
|
|
289
299
|
{config.table.collapsible !== false && (
|
|
@@ -357,9 +367,7 @@ const DataTable = (props: DataTableProps) => {
|
|
|
357
367
|
)}
|
|
358
368
|
</div>
|
|
359
369
|
</section>
|
|
360
|
-
{config.
|
|
361
|
-
<TableMediaControls belowTable={true} />
|
|
362
|
-
)}
|
|
370
|
+
{config.table.showDownloadLinkBelow && <TableMediaControls belowTable={true} />}
|
|
363
371
|
<div id={skipId} className='cdcdataviz-sr-only'>
|
|
364
372
|
Skipped data table.
|
|
365
373
|
</div>
|
|
@@ -283,7 +283,11 @@ const NestedDropdown: React.FC<NestedDropdownProps> = ({
|
|
|
283
283
|
onFocus={() => setInputHasFocus(true)}
|
|
284
284
|
/>
|
|
285
285
|
<span className='list-arrow' aria-hidden={true}>
|
|
286
|
-
|
|
286
|
+
{isListOpened ? (
|
|
287
|
+
<Icon display='caretUp' alt='arrow pointing up' />
|
|
288
|
+
) : (
|
|
289
|
+
<Icon display='caretDown' alt='arrow pointing down' />
|
|
290
|
+
)}
|
|
287
291
|
</span>
|
|
288
292
|
</div>
|
|
289
293
|
{loading && <Loader spinnerType={'text-secondary'} />}
|
|
@@ -29,11 +29,14 @@
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
[class^='main-nested-dropdown-container-'] {
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
}
|
|
35
|
+
|
|
32
36
|
[class^='main-nested-dropdown-container-'],
|
|
33
37
|
.nested-dropdown-input-container {
|
|
34
38
|
border: 1px solid var(--cool-gray-10);
|
|
35
39
|
min-width: 200px;
|
|
36
|
-
cursor: pointer;
|
|
37
40
|
padding: 0.4rem 0.75rem;
|
|
38
41
|
font-size: 1em;
|
|
39
42
|
}
|
|
@@ -57,14 +60,15 @@
|
|
|
57
60
|
|
|
58
61
|
.nested-dropdown-input-container {
|
|
59
62
|
display: block;
|
|
60
|
-
width: 100
|
|
63
|
+
width: calc(100% + 7px);
|
|
61
64
|
border-radius: 0.25rem;
|
|
62
65
|
position: relative;
|
|
63
66
|
& > span.list-arrow {
|
|
64
67
|
position: absolute;
|
|
65
68
|
top: 9px;
|
|
66
|
-
right:
|
|
69
|
+
right: 9px;
|
|
67
70
|
float: right;
|
|
71
|
+
pointer-events: none;
|
|
68
72
|
}
|
|
69
73
|
|
|
70
74
|
&.disabled {
|
|
@@ -77,7 +81,7 @@
|
|
|
77
81
|
|
|
78
82
|
& [class^='main-nested-dropdown-container-'] {
|
|
79
83
|
max-height: 375px;
|
|
80
|
-
overflow-y:
|
|
84
|
+
overflow-y: auto;
|
|
81
85
|
position: absolute;
|
|
82
86
|
z-index: 3;
|
|
83
87
|
min-width: 200px;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdc/core",
|
|
3
|
-
"version": "4.25.
|
|
3
|
+
"version": "4.25.3-6",
|
|
4
4
|
"description": "Core components, styles, hooks, and helpers, for the CDC Open Visualization project",
|
|
5
5
|
"moduleName": "CdcCore",
|
|
6
6
|
"main": "dist/cdccore",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"react": "^18.2.0",
|
|
35
35
|
"react-dom": "^18.2.0"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "d83d8555c1500ff0cad9d2c5c3486324afa15ec6",
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"sass": "^1.79.4"
|
|
40
40
|
}
|