@genspectrum/dashboard-components 1.15.0 → 1.17.0

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 (60) hide show
  1. package/custom-elements.json +5 -5
  2. package/dist/components.d.ts +66 -67
  3. package/dist/components.js +457 -256
  4. package/dist/components.js.map +1 -1
  5. package/dist/util.d.ts +69 -66
  6. package/package.json +2 -9
  7. package/src/preact/MutationAnnotationsContext.tsx +1 -1
  8. package/src/preact/components/csv-download-button.tsx +22 -14
  9. package/src/preact/components/features-over-time-grid.tsx +189 -43
  10. package/src/preact/components/mutations-over-time-mutations-filter.stories.tsx +1 -1
  11. package/src/preact/components/mutations-over-time-mutations-filter.tsx +1 -1
  12. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutationsByDay/aminoAcidMutationsOverTimePage1.json +52 -0
  13. package/src/preact/mutationsOverTime/__mockData__/byWeek/mutationsOverTimePage1.json +76 -0
  14. package/src/preact/mutationsOverTime/__mockData__/defaultMockData/mockDefaultMutationsOverTimeWithFilter.json +43 -0
  15. package/src/preact/mutationsOverTime/__mockData__/defaultMockData/mutationsOverTimePage1.json +126 -0
  16. package/src/preact/mutationsOverTime/__mockData__/defaultMockData/mutationsOverTimePage2.json +116 -0
  17. package/src/preact/mutationsOverTime/__mockData__/defaultMockData/mutationsOverTimePageSize20.json +216 -0
  18. package/src/preact/mutationsOverTime/getFilteredMutationCodes.spec.ts +236 -0
  19. package/src/preact/mutationsOverTime/{getFilteredMutationsOverTimeData.ts → getFilteredMutationCodes.ts} +32 -45
  20. package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +128 -23
  21. package/src/preact/mutationsOverTime/mutations-over-time.tsx +139 -74
  22. package/src/preact/mutationsOverTime/useMutationsOverTimePageData.ts +111 -0
  23. package/src/preact/queriesOverTime/queries-over-time-row-label-tooltip.stories.tsx +8 -10
  24. package/src/preact/queriesOverTime/queries-over-time-row-label-tooltip.tsx +7 -17
  25. package/src/preact/queriesOverTime/queries-over-time.tsx +1 -1
  26. package/src/preact/shared/tanstackTable/pagination-context.tsx +5 -2
  27. package/src/preact/shared/tanstackTable/pagination.tsx +11 -9
  28. package/src/preact/shared/tanstackTable/tanstackTable.tsx +7 -4
  29. package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.tsx +1 -1
  30. package/src/query/queryMutationsOverTime.spec.ts +187 -662
  31. package/src/query/queryMutationsOverTime.ts +46 -33
  32. package/src/utilEntrypoint.ts +1 -1
  33. package/src/utils/useControlledState.ts +15 -0
  34. package/src/web-components/gs-app.ts +2 -3
  35. package/src/web-components/input/gs-date-range-filter.tsx +2 -3
  36. package/src/web-components/input/gs-lineage-filter.tsx +2 -3
  37. package/src/web-components/input/gs-location-filter.tsx +2 -3
  38. package/src/web-components/input/gs-mutation-filter.tsx +3 -4
  39. package/src/web-components/input/gs-number-range-filter.tsx +2 -3
  40. package/src/web-components/input/gs-text-filter.tsx +2 -3
  41. package/src/web-components/mutation-annotations-context.ts +3 -1
  42. package/src/web-components/visualization/gs-aggregate.tsx +2 -3
  43. package/src/web-components/visualization/gs-genome-data-viewer.tsx +2 -3
  44. package/src/web-components/visualization/gs-mutation-comparison.tsx +2 -3
  45. package/src/web-components/visualization/gs-mutations-over-time.stories.ts +78 -22
  46. package/src/web-components/visualization/gs-mutations-over-time.tsx +2 -3
  47. package/src/web-components/visualization/gs-mutations.tsx +7 -8
  48. package/src/web-components/visualization/gs-number-sequences-over-time.tsx +2 -3
  49. package/src/web-components/visualization/gs-prevalence-over-time.tsx +2 -3
  50. package/src/web-components/visualization/gs-queries-over-time.tsx +2 -3
  51. package/src/web-components/visualization/gs-relative-growth-advantage.tsx +2 -3
  52. package/src/web-components/visualization/gs-sequences-by-location.tsx +2 -3
  53. package/src/web-components/visualization/gs-statistics.tsx +2 -3
  54. package/src/web-components/wastewaterVisualization/gs-wastewater-mutations-over-time.tsx +2 -3
  55. package/standalone-bundle/dashboard-components.js +6877 -6697
  56. package/standalone-bundle/dashboard-components.js.map +1 -1
  57. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutationsByDay/aminoAcidMutationsOverTime.json +0 -5496
  58. package/src/preact/mutationsOverTime/__mockData__/byWeek/mutationsOverTime.json +0 -7100
  59. package/src/preact/mutationsOverTime/__mockData__/defaultMockData/mutationsOverTime.json +0 -12646
  60. package/src/preact/mutationsOverTime/getFilteredMutationsOverTime.spec.ts +0 -417
package/dist/util.d.ts CHANGED
@@ -71,6 +71,25 @@ export declare type ConfidenceIntervalMethod = default_2.infer<typeof confidence
71
71
 
72
72
  declare const confidenceIntervalMethodSchema: default_2.ZodUnion<[default_2.ZodLiteral<"wilson">, default_2.ZodLiteral<"none">]>;
73
73
 
74
+ export declare type CountCoverageQuery = default_2.infer<typeof countCoverageQuerySchema>;
75
+
76
+ declare const countCoverageQuerySchema: default_2.ZodObject<{
77
+ displayLabel: default_2.ZodString;
78
+ description: default_2.ZodOptional<default_2.ZodString>;
79
+ countQuery: default_2.ZodString;
80
+ coverageQuery: default_2.ZodString;
81
+ }, "strip", default_2.ZodTypeAny, {
82
+ displayLabel: string;
83
+ countQuery: string;
84
+ coverageQuery: string;
85
+ description?: string | undefined;
86
+ }, {
87
+ displayLabel: string;
88
+ countQuery: string;
89
+ coverageQuery: string;
90
+ description?: string | undefined;
91
+ }>;
92
+
74
93
  export declare type CustomColumn = default_2.infer<typeof customColumnSchema>;
75
94
 
76
95
  declare const customColumnSchema: default_2.ZodObject<{
@@ -829,11 +848,11 @@ declare const queriesOverTimeSchema: default_2.ZodObject<{
829
848
  max: number;
830
849
  };
831
850
  height?: string | undefined;
832
- hideGaps?: boolean | undefined;
833
851
  customColumns?: {
834
852
  values: Record<string, string | number>;
835
853
  header: string;
836
854
  }[] | undefined;
855
+ hideGaps?: boolean | undefined;
837
856
  }, {
838
857
  lapisFilter: Record<string, string | number | boolean | string[] | null | undefined> & {
839
858
  nucleotideMutations?: string[] | undefined;
@@ -857,33 +876,17 @@ declare const queriesOverTimeSchema: default_2.ZodObject<{
857
876
  max: number;
858
877
  };
859
878
  height?: string | undefined;
860
- hideGaps?: boolean | undefined;
861
879
  customColumns?: {
862
880
  values: Record<string, string | number>;
863
881
  header: string;
864
882
  }[] | undefined;
883
+ hideGaps?: boolean | undefined;
865
884
  }>;
866
885
 
867
886
  export declare type QueriesOverTimeView = default_2.infer<typeof queriesOverTimeViewSchema>;
868
887
 
869
888
  declare const queriesOverTimeViewSchema: default_2.ZodLiteral<"grid">;
870
889
 
871
- export declare type QueryDefinition = default_2.infer<typeof queryDefinition>;
872
-
873
- declare const queryDefinition: default_2.ZodObject<{
874
- displayLabel: default_2.ZodOptional<default_2.ZodString>;
875
- countQuery: default_2.ZodString;
876
- coverageQuery: default_2.ZodString;
877
- }, "strip", default_2.ZodTypeAny, {
878
- countQuery: string;
879
- coverageQuery: string;
880
- displayLabel?: string | undefined;
881
- }, {
882
- countQuery: string;
883
- coverageQuery: string;
884
- displayLabel?: string | undefined;
885
- }>;
886
-
887
890
  export declare type RelativeGrowthAdvantageProps = default_2.infer<typeof relativeGrowthAdvantagePropsSchema>;
888
891
 
889
892
  declare const relativeGrowthAdvantagePropsSchema: default_2.ZodObject<{
@@ -1095,9 +1098,9 @@ declare global {
1095
1098
 
1096
1099
 
1097
1100
  declare global {
1098
- namespace JSX {
1101
+ namespace React.JSX {
1099
1102
  interface IntrinsicElements {
1100
- 'gs-app': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1103
+ 'gs-app': AppComponent;
1101
1104
  }
1102
1105
  }
1103
1106
  }
@@ -1105,15 +1108,15 @@ declare global {
1105
1108
 
1106
1109
  declare global {
1107
1110
  interface HTMLElementTagNameMap {
1108
- 'gs-wastewater-mutations-over-time': WastewaterMutationsOverTimeComponent;
1111
+ 'gs-genome-data-viewer': GenomeDataViewerComponent;
1109
1112
  }
1110
1113
  }
1111
1114
 
1112
1115
 
1113
1116
  declare global {
1114
- namespace JSX {
1117
+ namespace React.JSX {
1115
1118
  interface IntrinsicElements {
1116
- 'gs-wastewater-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1119
+ 'gs-genome-data-viewer': GenomeDataViewerComponent;
1117
1120
  }
1118
1121
  }
1119
1122
  }
@@ -1121,15 +1124,15 @@ declare global {
1121
1124
 
1122
1125
  declare global {
1123
1126
  interface HTMLElementTagNameMap {
1124
- 'gs-genome-data-viewer': GenomeDataViewerComponent;
1127
+ 'gs-mutation-comparison': MutationComparisonComponent;
1125
1128
  }
1126
1129
  }
1127
1130
 
1128
1131
 
1129
1132
  declare global {
1130
- namespace JSX {
1133
+ namespace React.JSX {
1131
1134
  interface IntrinsicElements {
1132
- 'gs-genome-data-viewer': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1135
+ 'gs-mutation-comparison': MutationComparisonComponent;
1133
1136
  }
1134
1137
  }
1135
1138
  }
@@ -1137,15 +1140,15 @@ declare global {
1137
1140
 
1138
1141
  declare global {
1139
1142
  interface HTMLElementTagNameMap {
1140
- 'gs-mutation-comparison': MutationComparisonComponent;
1143
+ 'gs-mutations': MutationsComponent;
1141
1144
  }
1142
1145
  }
1143
1146
 
1144
1147
 
1145
1148
  declare global {
1146
- namespace JSX {
1149
+ namespace React.JSX {
1147
1150
  interface IntrinsicElements {
1148
- 'gs-mutation-comparison': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1151
+ 'gs-mutations': MutationsComponent;
1149
1152
  }
1150
1153
  }
1151
1154
  }
@@ -1153,15 +1156,15 @@ declare global {
1153
1156
 
1154
1157
  declare global {
1155
1158
  interface HTMLElementTagNameMap {
1156
- 'gs-mutations': MutationsComponent;
1159
+ 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
1157
1160
  }
1158
1161
  }
1159
1162
 
1160
1163
 
1161
1164
  declare global {
1162
- namespace JSX {
1165
+ namespace React.JSX {
1163
1166
  interface IntrinsicElements {
1164
- 'gs-mutations': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1167
+ 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
1165
1168
  }
1166
1169
  }
1167
1170
  }
@@ -1169,15 +1172,15 @@ declare global {
1169
1172
 
1170
1173
  declare global {
1171
1174
  interface HTMLElementTagNameMap {
1172
- 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
1175
+ 'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
1173
1176
  }
1174
1177
  }
1175
1178
 
1176
1179
 
1177
1180
  declare global {
1178
- namespace JSX {
1181
+ namespace React.JSX {
1179
1182
  interface IntrinsicElements {
1180
- 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1183
+ 'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
1181
1184
  }
1182
1185
  }
1183
1186
  }
@@ -1185,15 +1188,15 @@ declare global {
1185
1188
 
1186
1189
  declare global {
1187
1190
  interface HTMLElementTagNameMap {
1188
- 'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
1191
+ 'gs-aggregate': AggregateComponent;
1189
1192
  }
1190
1193
  }
1191
1194
 
1192
1195
 
1193
1196
  declare global {
1194
- namespace JSX {
1197
+ namespace React.JSX {
1195
1198
  interface IntrinsicElements {
1196
- 'gs-relative-growth-advantage': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1199
+ 'gs-aggregate': AggregateComponent;
1197
1200
  }
1198
1201
  }
1199
1202
  }
@@ -1201,15 +1204,15 @@ declare global {
1201
1204
 
1202
1205
  declare global {
1203
1206
  interface HTMLElementTagNameMap {
1204
- 'gs-aggregate': AggregateComponent;
1207
+ 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
1205
1208
  }
1206
1209
  }
1207
1210
 
1208
1211
 
1209
1212
  declare global {
1210
- namespace JSX {
1213
+ namespace React.JSX {
1211
1214
  interface IntrinsicElements {
1212
- 'gs-aggregate': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1215
+ 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
1213
1216
  }
1214
1217
  }
1215
1218
  }
@@ -1217,15 +1220,15 @@ declare global {
1217
1220
 
1218
1221
  declare global {
1219
1222
  interface HTMLElementTagNameMap {
1220
- 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
1223
+ 'gs-mutations-over-time': MutationsOverTimeComponent;
1221
1224
  }
1222
1225
  }
1223
1226
 
1224
1227
 
1225
1228
  declare global {
1226
- namespace JSX {
1229
+ namespace React.JSX {
1227
1230
  interface IntrinsicElements {
1228
- 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1231
+ 'gs-mutations-over-time': MutationsOverTimeComponent;
1229
1232
  }
1230
1233
  }
1231
1234
  }
@@ -1239,9 +1242,9 @@ declare global {
1239
1242
 
1240
1243
 
1241
1244
  declare global {
1242
- namespace JSX {
1245
+ namespace React.JSX {
1243
1246
  interface IntrinsicElements {
1244
- 'gs-queries-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1247
+ 'gs-queries-over-time': QueriesOverTimeComponent;
1245
1248
  }
1246
1249
  }
1247
1250
  }
@@ -1249,15 +1252,15 @@ declare global {
1249
1252
 
1250
1253
  declare global {
1251
1254
  interface HTMLElementTagNameMap {
1252
- 'gs-mutations-over-time': MutationsOverTimeComponent;
1255
+ 'gs-statistics': StatisticsComponent;
1253
1256
  }
1254
1257
  }
1255
1258
 
1256
1259
 
1257
1260
  declare global {
1258
- namespace JSX {
1261
+ namespace React.JSX {
1259
1262
  interface IntrinsicElements {
1260
- 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1263
+ 'gs-statistics': StatisticsComponent;
1261
1264
  }
1262
1265
  }
1263
1266
  }
@@ -1271,9 +1274,9 @@ declare global {
1271
1274
 
1272
1275
 
1273
1276
  declare global {
1274
- namespace JSX {
1277
+ namespace React.JSX {
1275
1278
  interface IntrinsicElements {
1276
- 'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1279
+ 'gs-sequences-by-location': SequencesByLocationComponent;
1277
1280
  }
1278
1281
  }
1279
1282
  }
@@ -1281,15 +1284,15 @@ declare global {
1281
1284
 
1282
1285
  declare global {
1283
1286
  interface HTMLElementTagNameMap {
1284
- 'gs-statistics': StatisticsComponent;
1287
+ 'gs-wastewater-mutations-over-time': WastewaterMutationsOverTimeComponent;
1285
1288
  }
1286
1289
  }
1287
1290
 
1288
1291
 
1289
1292
  declare global {
1290
- namespace JSX {
1293
+ namespace React.JSX {
1291
1294
  interface IntrinsicElements {
1292
- 'gs-statistics': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1295
+ 'gs-wastewater-mutations-over-time': WastewaterMutationsOverTimeComponent;
1293
1296
  }
1294
1297
  }
1295
1298
  }
@@ -1307,9 +1310,9 @@ declare global {
1307
1310
 
1308
1311
 
1309
1312
  declare global {
1310
- namespace JSX {
1313
+ namespace React.JSX {
1311
1314
  interface IntrinsicElements {
1312
- 'gs-date-range-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1315
+ 'gs-date-range-filter': DateRangeFilterComponent;
1313
1316
  }
1314
1317
  }
1315
1318
  }
@@ -1326,9 +1329,9 @@ declare global {
1326
1329
 
1327
1330
 
1328
1331
  declare global {
1329
- namespace JSX {
1332
+ namespace React.JSX {
1330
1333
  interface IntrinsicElements {
1331
- 'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1334
+ 'gs-location-filter': LocationFilterComponent;
1332
1335
  }
1333
1336
  }
1334
1337
  }
@@ -1345,9 +1348,9 @@ declare global {
1345
1348
 
1346
1349
 
1347
1350
  declare global {
1348
- namespace JSX {
1351
+ namespace React.JSX {
1349
1352
  interface IntrinsicElements {
1350
- 'gs-text-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1353
+ 'gs-text-filter': TextFilterComponent;
1351
1354
  }
1352
1355
  }
1353
1356
  }
@@ -1364,9 +1367,9 @@ declare global {
1364
1367
 
1365
1368
 
1366
1369
  declare global {
1367
- namespace JSX {
1370
+ namespace React.JSX {
1368
1371
  interface IntrinsicElements {
1369
- 'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1372
+ 'gs-mutation-filter': MutationFilterComponent;
1370
1373
  }
1371
1374
  }
1372
1375
  }
@@ -1384,9 +1387,9 @@ declare global {
1384
1387
 
1385
1388
 
1386
1389
  declare global {
1387
- namespace JSX {
1390
+ namespace React.JSX {
1388
1391
  interface IntrinsicElements {
1389
- 'gs-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1392
+ 'gs-lineage-filter': LineageFilterComponent;
1390
1393
  }
1391
1394
  }
1392
1395
  }
@@ -1404,9 +1407,9 @@ declare global {
1404
1407
 
1405
1408
 
1406
1409
  declare global {
1407
- namespace JSX {
1410
+ namespace React.JSX {
1408
1411
  interface IntrinsicElements {
1409
- 'gs-number-range-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1412
+ 'gs-number-range-filter': NumberRangeFilterComponent;
1410
1413
  }
1411
1414
  }
1412
1415
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genspectrum/dashboard-components",
3
- "version": "1.15.0",
3
+ "version": "1.17.0",
4
4
  "description": "GenSpectrum web components for building dashboards",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-only",
@@ -15,13 +15,6 @@
15
15
  "publishConfig": {
16
16
  "access": "public"
17
17
  },
18
- "imports": {
19
- "#*": [
20
- "./*",
21
- "./*.ts",
22
- "./*.tsx"
23
- ]
24
- },
25
18
  "exports": {
26
19
  "./components": {
27
20
  "types": "./dist/components.d.ts",
@@ -136,7 +129,7 @@
136
129
  "msw": "^2.2.14",
137
130
  "postcss": "^8.4.38",
138
131
  "prettier": "^3.2.5",
139
- "react": "^18.3.1",
132
+ "react": "^19.0.0",
140
133
  "storybook": "^8.0.9",
141
134
  "storybook-addon-fetch-mock": "^2.0.0",
142
135
  "tailwindcss": "^4.0.9",
@@ -98,7 +98,7 @@ export function useRawMutationAnnotations() {
98
98
  export function useMutationAnnotationsProvider() {
99
99
  const mutationAnnotations = useContext(MutationAnnotationsContext);
100
100
 
101
- return getMutationAnnotationsProvider(mutationAnnotations);
101
+ return useMemo(() => getMutationAnnotationsProvider(mutationAnnotations), [mutationAnnotations]);
102
102
  }
103
103
 
104
104
  export function getMutationAnnotationsProvider(mutationAnnotations: MutationAnnotationsContextValue) {
@@ -1,4 +1,5 @@
1
1
  import { type FunctionComponent } from 'preact';
2
+ import { useState } from 'preact/hooks';
2
3
 
3
4
  type ToStringable = {
4
5
  toString: () => string;
@@ -9,7 +10,7 @@ export type DataValue = string | number | boolean | null | undefined | ToStringa
9
10
  export interface CsvDownloadButtonProps {
10
11
  label?: string;
11
12
  filename?: string;
12
- getData: () => Record<string, DataValue>[];
13
+ getData: () => Record<string, DataValue>[] | Promise<Record<string, DataValue>[]>;
13
14
  className?: string;
14
15
  }
15
16
 
@@ -19,19 +20,26 @@ export const CsvDownloadButton: FunctionComponent<CsvDownloadButtonProps> = ({
19
20
  getData,
20
21
  className,
21
22
  }) => {
22
- const download = () => {
23
- const content = getDownloadContent();
24
- const blob = new Blob([content], { type: 'text/csv' });
25
- const url = URL.createObjectURL(blob);
26
- const a = document.createElement('a');
27
- a.href = url;
28
- a.download = filename;
29
- a.click();
30
- URL.revokeObjectURL(url);
23
+ const [isDownloading, setIsDownloading] = useState(false);
24
+
25
+ const download = async () => {
26
+ setIsDownloading(true);
27
+ try {
28
+ const content = await getDownloadContent();
29
+ const blob = new Blob([content], { type: 'text/csv' });
30
+ const url = URL.createObjectURL(blob);
31
+ const a = document.createElement('a');
32
+ a.href = url;
33
+ a.download = filename;
34
+ a.click();
35
+ URL.revokeObjectURL(url);
36
+ } finally {
37
+ setIsDownloading(false);
38
+ }
31
39
  };
32
40
 
33
- const getDownloadContent = () => {
34
- const data = getData();
41
+ const getDownloadContent = async () => {
42
+ const data = await getData();
35
43
  const keys = getDataKeys(data);
36
44
  const header = keys.join(',');
37
45
  const rows = data.map((row) => keys.map((key) => row[key]).join(',')).join('\n');
@@ -50,8 +58,8 @@ export const CsvDownloadButton: FunctionComponent<CsvDownloadButtonProps> = ({
50
58
  };
51
59
 
52
60
  return (
53
- <button className={className} onClick={download}>
54
- {label}
61
+ <button className={className} onClick={() => void download()} disabled={isDownloading}>
62
+ {isDownloading ? 'Downloading...' : label}
55
63
  </button>
56
64
  );
57
65
  };