@genspectrum/dashboard-components 0.11.6 → 0.12.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 (43) hide show
  1. package/custom-elements.json +50 -15
  2. package/dist/{dateRangeOption-Bh2p78z0.js → LocationChangedEvent-CORvQvXv.js} +11 -1
  3. package/dist/LocationChangedEvent-CORvQvXv.js.map +1 -0
  4. package/dist/assets/{mutationOverTimeWorker-CWneD7i5.js.map → mutationOverTimeWorker-DTv93Ere.js.map} +1 -1
  5. package/dist/components.d.ts +79 -51
  6. package/dist/components.js +3951 -621
  7. package/dist/components.js.map +1 -1
  8. package/dist/style.css +151 -4
  9. package/dist/util.d.ts +78 -44
  10. package/dist/util.js +2 -1
  11. package/package.json +2 -1
  12. package/src/preact/components/csv-download-button.tsx +2 -2
  13. package/src/preact/downshift_types.d.ts +3 -0
  14. package/src/preact/locationFilter/LocationChangedEvent.ts +11 -0
  15. package/src/preact/locationFilter/fetchAutocompletionList.spec.ts +5 -5
  16. package/src/preact/locationFilter/fetchAutocompletionList.ts +9 -2
  17. package/src/preact/locationFilter/location-filter.stories.tsx +94 -10
  18. package/src/preact/locationFilter/location-filter.tsx +183 -62
  19. package/src/preact/mutationFilter/mutation-filter-info.tsx +73 -10
  20. package/src/preact/mutations/__mockData__/baselineNucleotideMutations.json +337412 -0
  21. package/src/preact/mutations/__mockData__/overallVariantCount.json +14 -0
  22. package/src/preact/mutations/getMutationsTableData.spec.ts +20 -3
  23. package/src/preact/mutations/getMutationsTableData.ts +37 -2
  24. package/src/preact/mutations/mutations-table.tsx +47 -27
  25. package/src/preact/mutations/mutations.stories.tsx +41 -9
  26. package/src/preact/mutations/mutations.tsx +22 -6
  27. package/src/preact/mutations/queryMutations.ts +28 -8
  28. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutationsByDay.ts +11077 -3062
  29. package/src/preact/mutationsOverTime/__mockData__/byWeek.ts +3883 -6606
  30. package/src/preact/mutationsOverTime/__mockData__/defaultMockData.ts +17624 -2203
  31. package/src/preact/mutationsOverTime/mutations-over-time.tsx +1 -1
  32. package/src/query/queryMutationsOverTime.spec.ts +144 -4
  33. package/src/query/queryMutationsOverTime.ts +17 -1
  34. package/src/utilEntrypoint.ts +2 -0
  35. package/src/web-components/input/gs-location-filter.stories.ts +34 -29
  36. package/src/web-components/input/gs-location-filter.tsx +6 -13
  37. package/src/web-components/visualization/gs-mutations.stories.ts +62 -4
  38. package/src/web-components/visualization/gs-mutations.tsx +44 -0
  39. package/standalone-bundle/assets/{mutationOverTimeWorker-x1ipPFL0.js.map → mutationOverTimeWorker-DEybsZ5r.js.map} +1 -1
  40. package/standalone-bundle/dashboard-components.js +11021 -8621
  41. package/standalone-bundle/dashboard-components.js.map +1 -1
  42. package/standalone-bundle/style.css +1 -1
  43. package/dist/dateRangeOption-Bh2p78z0.js.map +0 -1
package/dist/style.css CHANGED
@@ -1296,6 +1296,19 @@ html {
1296
1296
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
1297
1297
  }
1298
1298
 
1299
+ :where(.menu li:not(.menu-title, .disabled) > *:not(ul, details, .menu-title)):not(.active, .btn):hover, :where(.menu li:not(.menu-title, .disabled) > details > summary:not(.menu-title)):not(.active, .btn):hover {
1300
+ cursor: pointer;
1301
+ outline: 2px solid transparent;
1302
+ outline-offset: 2px;
1303
+ }
1304
+
1305
+ @supports (color: oklch(0% 0 0)) {
1306
+
1307
+ :where(.menu li:not(.menu-title, .disabled) > *:not(ul, details, .menu-title)):not(.active, .btn):hover, :where(.menu li:not(.menu-title, .disabled) > details > summary:not(.menu-title)):not(.active, .btn):hover {
1308
+ background-color: var(--fallback-bc,oklch(var(--bc)/0.1));
1309
+ }
1310
+ }
1311
+
1299
1312
  .tab[disabled],
1300
1313
  .tab[disabled]:hover {
1301
1314
  cursor: not-allowed;
@@ -1426,6 +1439,31 @@ html {
1426
1439
  cursor: pointer;
1427
1440
  text-decoration-line: underline;
1428
1441
  }
1442
+ .menu {
1443
+ display: flex;
1444
+ flex-direction: column;
1445
+ flex-wrap: wrap;
1446
+ font-size: 0.875rem;
1447
+ line-height: 1.25rem;
1448
+ padding: 0.5rem;
1449
+ }
1450
+ .menu :where(li ul) {
1451
+ position: relative;
1452
+ white-space: nowrap;
1453
+ margin-inline-start: 1rem;
1454
+ padding-inline-start: 0.5rem;
1455
+ }
1456
+ .menu :where(li:not(.menu-title) > *:not(ul, details, .menu-title, .btn)), .menu :where(li:not(.menu-title) > details > summary:not(.menu-title)) {
1457
+ display: grid;
1458
+ grid-auto-flow: column;
1459
+ align-content: flex-start;
1460
+ align-items: center;
1461
+ gap: 0.5rem;
1462
+ grid-auto-columns: minmax(auto, max-content) auto max-content;
1463
+ -webkit-user-select: none;
1464
+ -moz-user-select: none;
1465
+ user-select: none;
1466
+ }
1429
1467
  .menu li.disabled {
1430
1468
  cursor: not-allowed;
1431
1469
  -webkit-user-select: none;
@@ -1433,6 +1471,20 @@ html {
1433
1471
  user-select: none;
1434
1472
  color: var(--fallback-bc,oklch(var(--bc)/0.3));
1435
1473
  }
1474
+ .menu :where(li > .menu-dropdown:not(.menu-dropdown-show)) {
1475
+ display: none;
1476
+ }
1477
+ :where(.menu li) {
1478
+ position: relative;
1479
+ display: flex;
1480
+ flex-shrink: 0;
1481
+ flex-direction: column;
1482
+ flex-wrap: wrap;
1483
+ align-items: stretch;
1484
+ }
1485
+ :where(.menu li) .badge {
1486
+ justify-self: end;
1487
+ }
1436
1488
  .modal {
1437
1489
  pointer-events: none;
1438
1490
  position: fixed;
@@ -1992,6 +2044,40 @@ input.tab:checked + .tab-content,
1992
2044
  .loading-md {
1993
2045
  width: 1.5rem;
1994
2046
  }
2047
+ :where(.menu li:empty) {
2048
+ --tw-bg-opacity: 1;
2049
+ background-color: var(--fallback-bc,oklch(var(--bc)/var(--tw-bg-opacity)));
2050
+ opacity: 0.1;
2051
+ margin: 0.5rem 1rem;
2052
+ height: 1px;
2053
+ }
2054
+ .menu :where(li ul):before {
2055
+ position: absolute;
2056
+ bottom: 0.75rem;
2057
+ inset-inline-start: 0px;
2058
+ top: 0.75rem;
2059
+ width: 1px;
2060
+ --tw-bg-opacity: 1;
2061
+ background-color: var(--fallback-bc,oklch(var(--bc)/var(--tw-bg-opacity)));
2062
+ opacity: 0.1;
2063
+ content: "";
2064
+ }
2065
+ .menu :where(li:not(.menu-title) > *:not(ul, details, .menu-title, .btn)),
2066
+ .menu :where(li:not(.menu-title) > details > summary:not(.menu-title)) {
2067
+ border-radius: var(--rounded-btn, 0.5rem);
2068
+ padding-left: 1rem;
2069
+ padding-right: 1rem;
2070
+ padding-top: 0.5rem;
2071
+ padding-bottom: 0.5rem;
2072
+ text-align: start;
2073
+ transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
2074
+ transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
2075
+ transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;
2076
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
2077
+ transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
2078
+ transition-duration: 200ms;
2079
+ text-wrap: balance;
2080
+ }
1995
2081
  :where(.menu li:not(.menu-title, .disabled) > *:not(ul, details, .menu-title)):not(summary, .active, .btn).focus, :where(.menu li:not(.menu-title, .disabled) > *:not(ul, details, .menu-title)):not(summary, .active, .btn):focus, :where(.menu li:not(.menu-title, .disabled) > *:not(ul, details, .menu-title)):is(summary):not(.active, .btn):focus-visible, :where(.menu li:not(.menu-title, .disabled) > details > summary:not(.menu-title)):not(summary, .active, .btn).focus, :where(.menu li:not(.menu-title, .disabled) > details > summary:not(.menu-title)):not(summary, .active, .btn):focus, :where(.menu li:not(.menu-title, .disabled) > details > summary:not(.menu-title)):is(summary):not(.active, .btn):focus-visible {
1996
2082
  cursor: pointer;
1997
2083
  background-color: var(--fallback-bc,oklch(var(--bc)/0.1));
@@ -2008,6 +2094,30 @@ input.tab:checked + .tab-content,
2008
2094
  --tw-text-opacity: 1;
2009
2095
  color: var(--fallback-nc,oklch(var(--nc)/var(--tw-text-opacity)));
2010
2096
  }
2097
+ .menu :where(li > details > summary)::-webkit-details-marker {
2098
+ display: none;
2099
+ }
2100
+ .menu :where(li > details > summary):after,
2101
+ .menu :where(li > .menu-dropdown-toggle):after {
2102
+ justify-self: end;
2103
+ display: block;
2104
+ margin-top: -0.5rem;
2105
+ height: 0.5rem;
2106
+ width: 0.5rem;
2107
+ transform: rotate(45deg);
2108
+ transition-property: transform, margin-top;
2109
+ transition-duration: 0.3s;
2110
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
2111
+ content: "";
2112
+ transform-origin: 75% 75%;
2113
+ box-shadow: 2px 2px;
2114
+ pointer-events: none;
2115
+ }
2116
+ .menu :where(li > details[open] > summary):after,
2117
+ .menu :where(li > .menu-dropdown-toggle.menu-dropdown-show):after {
2118
+ transform: rotate(225deg);
2119
+ margin-top: 0;
2120
+ }
2011
2121
  .mockup-phone .display {
2012
2122
  overflow: hidden;
2013
2123
  border-radius: 40px;
@@ -3098,6 +3208,9 @@ input.tab:checked + .tab-content,
3098
3208
  .h-full {
3099
3209
  height: 100%;
3100
3210
  }
3211
+ .max-h-80 {
3212
+ max-height: 20rem;
3213
+ }
3101
3214
  .w-10 {
3102
3215
  width: 2.5rem;
3103
3216
  }
@@ -3129,6 +3242,9 @@ input.tab:checked + .tab-content,
3129
3242
  width: -moz-max-content;
3130
3243
  width: max-content;
3131
3244
  }
3245
+ .min-w-32 {
3246
+ min-width: 8rem;
3247
+ }
3132
3248
  .min-w-\[7\.5rem\] {
3133
3249
  min-width: 7.5rem;
3134
3250
  }
@@ -3188,6 +3304,12 @@ input.tab:checked + .tab-content,
3188
3304
  .justify-between {
3189
3305
  justify-content: space-between;
3190
3306
  }
3307
+ .gap-0\.5 {
3308
+ gap: 0.125rem;
3309
+ }
3310
+ .gap-1 {
3311
+ gap: 0.25rem;
3312
+ }
3191
3313
  .gap-2 {
3192
3314
  gap: 0.5rem;
3193
3315
  }
@@ -3237,10 +3359,6 @@ input.tab:checked + .tab-content,
3237
3359
  .border-b-2 {
3238
3360
  border-bottom-width: 2px;
3239
3361
  }
3240
- .border-error {
3241
- --tw-border-opacity: 1;
3242
- border-color: var(--fallback-er,oklch(var(--er)/var(--tw-border-opacity, 1)));
3243
- }
3244
3362
  .border-gray-100 {
3245
3363
  --tw-border-opacity: 1;
3246
3364
  border-color: rgb(243 244 246 / var(--tw-border-opacity, 1));
@@ -3261,6 +3379,10 @@ input.tab:checked + .tab-content,
3261
3379
  --tw-border-opacity: 1;
3262
3380
  border-color: rgb(100 116 139 / var(--tw-border-opacity, 1));
3263
3381
  }
3382
+ .bg-blue-300 {
3383
+ --tw-bg-opacity: 1;
3384
+ background-color: rgb(147 197 253 / var(--tw-bg-opacity, 1));
3385
+ }
3264
3386
  .bg-red-200 {
3265
3387
  --tw-bg-opacity: 1;
3266
3388
  background-color: rgb(254 202 202 / var(--tw-bg-opacity, 1));
@@ -3276,6 +3398,9 @@ input.tab:checked + .tab-content,
3276
3398
  .p-1 {
3277
3399
  padding: 0.25rem;
3278
3400
  }
3401
+ .p-1\.5 {
3402
+ padding: 0.375rem;
3403
+ }
3279
3404
  .p-2 {
3280
3405
  padding: 0.5rem;
3281
3406
  }
@@ -3286,6 +3411,14 @@ input.tab:checked + .tab-content,
3286
3411
  padding-left: 0.25rem;
3287
3412
  padding-right: 0.25rem;
3288
3413
  }
3414
+ .px-2 {
3415
+ padding-left: 0.5rem;
3416
+ padding-right: 0.5rem;
3417
+ }
3418
+ .px-3 {
3419
+ padding-left: 0.75rem;
3420
+ padding-right: 0.75rem;
3421
+ }
3289
3422
  .px-4 {
3290
3423
  padding-left: 1rem;
3291
3424
  padding-right: 1rem;
@@ -3356,6 +3489,10 @@ input.tab:checked + .tab-content,
3356
3489
  --tw-text-opacity: 1;
3357
3490
  color: rgb(37 99 235 / var(--tw-text-opacity, 1));
3358
3491
  }
3492
+ .text-gray-500 {
3493
+ --tw-text-opacity: 1;
3494
+ color: rgb(107 114 128 / var(--tw-text-opacity, 1));
3495
+ }
3359
3496
  .text-gray-600 {
3360
3497
  --tw-text-opacity: 1;
3361
3498
  color: rgb(75 85 99 / var(--tw-text-opacity, 1));
@@ -3381,6 +3518,16 @@ input.tab:checked + .tab-content,
3381
3518
  --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);
3382
3519
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
3383
3520
  }
3521
+ .shadow-md {
3522
+ --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
3523
+ --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);
3524
+ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
3525
+ }
3526
+ .shadow-sm {
3527
+ --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
3528
+ --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);
3529
+ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
3530
+ }
3384
3531
  .blur {
3385
3532
  --tw-blur: blur(8px);
3386
3533
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
package/dist/util.d.ts CHANGED
@@ -160,6 +160,12 @@ declare const lapisFilterSchema: default_2.ZodIntersection<default_2.ZodRecord<d
160
160
  aminoAcidInsertions?: string[] | undefined;
161
161
  }>>;
162
162
 
163
+ declare type LapisLocationFilter = Record<string, string | null | undefined>;
164
+
165
+ export declare class LocationChangedEvent extends CustomEvent<LapisLocationFilter> {
166
+ constructor(detail: LapisLocationFilter);
167
+ }
168
+
163
169
  export declare type MapSource = default_2.infer<typeof mapSourceSchema>;
164
170
 
165
171
  declare const mapSourceSchema: default_2.ZodObject<{
@@ -293,6 +299,22 @@ declare const mutationsPropsSchema: default_2.ZodObject<{
293
299
  nucleotideInsertions?: string[] | undefined;
294
300
  aminoAcidInsertions?: string[] | undefined;
295
301
  }>>;
302
+ baselineLapisFilter: default_2.ZodOptional<default_2.ZodIntersection<default_2.ZodRecord<default_2.ZodString, default_2.ZodUnion<[default_2.ZodString, default_2.ZodArray<default_2.ZodString, "many">, default_2.ZodNumber, default_2.ZodNull, default_2.ZodBoolean, default_2.ZodUndefined]>>, default_2.ZodObject<{
303
+ nucleotideMutations: default_2.ZodOptional<default_2.ZodArray<default_2.ZodString, "many">>;
304
+ aminoAcidMutations: default_2.ZodOptional<default_2.ZodArray<default_2.ZodString, "many">>;
305
+ nucleotideInsertions: default_2.ZodOptional<default_2.ZodArray<default_2.ZodString, "many">>;
306
+ aminoAcidInsertions: default_2.ZodOptional<default_2.ZodArray<default_2.ZodString, "many">>;
307
+ }, "strip", default_2.ZodTypeAny, {
308
+ nucleotideMutations?: string[] | undefined;
309
+ aminoAcidMutations?: string[] | undefined;
310
+ nucleotideInsertions?: string[] | undefined;
311
+ aminoAcidInsertions?: string[] | undefined;
312
+ }, {
313
+ nucleotideMutations?: string[] | undefined;
314
+ aminoAcidMutations?: string[] | undefined;
315
+ nucleotideInsertions?: string[] | undefined;
316
+ aminoAcidInsertions?: string[] | undefined;
317
+ }>>>;
296
318
  sequenceType: default_2.ZodUnion<[default_2.ZodLiteral<"nucleotide">, default_2.ZodLiteral<"amino acid">]>;
297
319
  views: default_2.ZodArray<default_2.ZodUnion<[default_2.ZodLiteral<"table">, default_2.ZodLiteral<"grid">, default_2.ZodLiteral<"insertions">]>, "many">;
298
320
  pageSize: default_2.ZodUnion<[default_2.ZodBoolean, default_2.ZodNumber]>;
@@ -310,6 +332,12 @@ declare const mutationsPropsSchema: default_2.ZodObject<{
310
332
  pageSize: number | boolean;
311
333
  sequenceType: "nucleotide" | "amino acid";
312
334
  views: ("table" | "grid" | "insertions")[];
335
+ baselineLapisFilter?: (Record<string, string | number | boolean | string[] | null | undefined> & {
336
+ nucleotideMutations?: string[] | undefined;
337
+ aminoAcidMutations?: string[] | undefined;
338
+ nucleotideInsertions?: string[] | undefined;
339
+ aminoAcidInsertions?: string[] | undefined;
340
+ }) | undefined;
313
341
  }, {
314
342
  lapisFilter: Record<string, string | number | boolean | string[] | null | undefined> & {
315
343
  nucleotideMutations?: string[] | undefined;
@@ -322,6 +350,12 @@ declare const mutationsPropsSchema: default_2.ZodObject<{
322
350
  pageSize: number | boolean;
323
351
  sequenceType: "nucleotide" | "amino acid";
324
352
  views: ("table" | "grid" | "insertions")[];
353
+ baselineLapisFilter?: (Record<string, string | number | boolean | string[] | null | undefined> & {
354
+ nucleotideMutations?: string[] | undefined;
355
+ aminoAcidMutations?: string[] | undefined;
356
+ nucleotideInsertions?: string[] | undefined;
357
+ aminoAcidInsertions?: string[] | undefined;
358
+ }) | undefined;
325
359
  }>;
326
360
 
327
361
  export declare type MutationsView = default_2.infer<typeof mutationsViewSchema>;
@@ -790,7 +824,10 @@ declare global {
790
824
 
791
825
  declare global {
792
826
  interface HTMLElementTagNameMap {
793
- 'gs-mutation-comparison-component': MutationComparisonComponent;
827
+ 'gs-location-filter': LocationFilterComponent;
828
+ }
829
+ interface HTMLElementEventMap {
830
+ 'gs-location-changed': LocationChangedEvent;
794
831
  }
795
832
  }
796
833
 
@@ -798,7 +835,7 @@ declare global {
798
835
  declare global {
799
836
  namespace JSX {
800
837
  interface IntrinsicElements {
801
- 'gs-mutation-comparison-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
838
+ 'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
802
839
  }
803
840
  }
804
841
  }
@@ -806,7 +843,11 @@ declare global {
806
843
 
807
844
  declare global {
808
845
  interface HTMLElementTagNameMap {
809
- 'gs-mutations-component': MutationsComponent;
846
+ 'gs-date-range-selector': DateRangeSelectorComponent;
847
+ }
848
+ interface HTMLElementEventMap {
849
+ 'gs-date-range-filter-changed': CustomEvent<Record<string, string>>;
850
+ 'gs-date-range-option-changed': DateRangeOptionChangedEvent;
810
851
  }
811
852
  }
812
853
 
@@ -814,7 +855,7 @@ declare global {
814
855
  declare global {
815
856
  namespace JSX {
816
857
  interface IntrinsicElements {
817
- 'gs-mutations-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
858
+ 'gs-date-range-selector': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
818
859
  }
819
860
  }
820
861
  }
@@ -822,7 +863,10 @@ declare global {
822
863
 
823
864
  declare global {
824
865
  interface HTMLElementTagNameMap {
825
- 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
866
+ 'gs-text-input': TextInputComponent;
867
+ }
868
+ interface HTMLElementEventMap {
869
+ 'gs-text-input-changed': CustomEvent<Record<string, string>>;
826
870
  }
827
871
  }
828
872
 
@@ -830,7 +874,7 @@ declare global {
830
874
  declare global {
831
875
  namespace JSX {
832
876
  interface IntrinsicElements {
833
- 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
877
+ 'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
834
878
  }
835
879
  }
836
880
  }
@@ -838,7 +882,10 @@ declare global {
838
882
 
839
883
  declare global {
840
884
  interface HTMLElementTagNameMap {
841
- 'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
885
+ 'gs-mutation-filter': MutationFilterComponent;
886
+ }
887
+ interface HTMLElementEventMap {
888
+ 'gs-mutation-filter-changed': CustomEvent<MutationsFilter>;
842
889
  }
843
890
  }
844
891
 
@@ -846,7 +893,7 @@ declare global {
846
893
  declare global {
847
894
  namespace JSX {
848
895
  interface IntrinsicElements {
849
- 'gs-relative-growth-advantage': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
896
+ 'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
850
897
  }
851
898
  }
852
899
  }
@@ -854,7 +901,10 @@ declare global {
854
901
 
855
902
  declare global {
856
903
  interface HTMLElementTagNameMap {
857
- 'gs-aggregate': AggregateComponent;
904
+ 'gs-lineage-filter': LineageFilterComponent;
905
+ }
906
+ interface HTMLElementEventMap {
907
+ 'gs-lineage-filter-changed': CustomEvent<Record<string, string>>;
858
908
  }
859
909
  }
860
910
 
@@ -862,7 +912,7 @@ declare global {
862
912
  declare global {
863
913
  namespace JSX {
864
914
  interface IntrinsicElements {
865
- 'gs-aggregate': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
915
+ 'gs-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
866
916
  }
867
917
  }
868
918
  }
@@ -870,7 +920,7 @@ declare global {
870
920
 
871
921
  declare global {
872
922
  interface HTMLElementTagNameMap {
873
- 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
923
+ 'gs-mutation-comparison-component': MutationComparisonComponent;
874
924
  }
875
925
  }
876
926
 
@@ -878,7 +928,7 @@ declare global {
878
928
  declare global {
879
929
  namespace JSX {
880
930
  interface IntrinsicElements {
881
- 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
931
+ 'gs-mutation-comparison-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
882
932
  }
883
933
  }
884
934
  }
@@ -886,7 +936,7 @@ declare global {
886
936
 
887
937
  declare global {
888
938
  interface HTMLElementTagNameMap {
889
- 'gs-mutations-over-time': MutationsOverTimeComponent;
939
+ 'gs-mutations-component': MutationsComponent;
890
940
  }
891
941
  }
892
942
 
@@ -894,7 +944,7 @@ declare global {
894
944
  declare global {
895
945
  namespace JSX {
896
946
  interface IntrinsicElements {
897
- 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
947
+ 'gs-mutations-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
898
948
  }
899
949
  }
900
950
  }
@@ -902,7 +952,7 @@ declare global {
902
952
 
903
953
  declare global {
904
954
  interface HTMLElementTagNameMap {
905
- 'gs-sequences-by-location': SequencesByLocationComponent;
955
+ 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
906
956
  }
907
957
  }
908
958
 
@@ -910,7 +960,7 @@ declare global {
910
960
  declare global {
911
961
  namespace JSX {
912
962
  interface IntrinsicElements {
913
- 'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
963
+ 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
914
964
  }
915
965
  }
916
966
  }
@@ -918,7 +968,7 @@ declare global {
918
968
 
919
969
  declare global {
920
970
  interface HTMLElementTagNameMap {
921
- 'gs-statistics': StatisticsComponent;
971
+ 'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
922
972
  }
923
973
  }
924
974
 
@@ -926,7 +976,7 @@ declare global {
926
976
  declare global {
927
977
  namespace JSX {
928
978
  interface IntrinsicElements {
929
- 'gs-statistics': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
979
+ 'gs-relative-growth-advantage': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
930
980
  }
931
981
  }
932
982
  }
@@ -934,11 +984,7 @@ declare global {
934
984
 
935
985
  declare global {
936
986
  interface HTMLElementTagNameMap {
937
- 'gs-date-range-selector': DateRangeSelectorComponent;
938
- }
939
- interface HTMLElementEventMap {
940
- 'gs-date-range-filter-changed': CustomEvent<Record<string, string>>;
941
- 'gs-date-range-option-changed': DateRangeOptionChangedEvent;
987
+ 'gs-aggregate': AggregateComponent;
942
988
  }
943
989
  }
944
990
 
@@ -946,7 +992,7 @@ declare global {
946
992
  declare global {
947
993
  namespace JSX {
948
994
  interface IntrinsicElements {
949
- 'gs-date-range-selector': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
995
+ 'gs-aggregate': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
950
996
  }
951
997
  }
952
998
  }
@@ -954,10 +1000,7 @@ declare global {
954
1000
 
955
1001
  declare global {
956
1002
  interface HTMLElementTagNameMap {
957
- 'gs-location-filter': LocationFilterComponent;
958
- }
959
- interface HTMLElementEventMap {
960
- 'gs-location-changed': CustomEvent<Record<string, string>>;
1003
+ 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
961
1004
  }
962
1005
  }
963
1006
 
@@ -965,7 +1008,7 @@ declare global {
965
1008
  declare global {
966
1009
  namespace JSX {
967
1010
  interface IntrinsicElements {
968
- 'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1011
+ 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
969
1012
  }
970
1013
  }
971
1014
  }
@@ -973,10 +1016,7 @@ declare global {
973
1016
 
974
1017
  declare global {
975
1018
  interface HTMLElementTagNameMap {
976
- 'gs-text-input': TextInputComponent;
977
- }
978
- interface HTMLElementEventMap {
979
- 'gs-text-input-changed': CustomEvent<Record<string, string>>;
1019
+ 'gs-mutations-over-time': MutationsOverTimeComponent;
980
1020
  }
981
1021
  }
982
1022
 
@@ -984,7 +1024,7 @@ declare global {
984
1024
  declare global {
985
1025
  namespace JSX {
986
1026
  interface IntrinsicElements {
987
- 'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1027
+ 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
988
1028
  }
989
1029
  }
990
1030
  }
@@ -992,10 +1032,7 @@ declare global {
992
1032
 
993
1033
  declare global {
994
1034
  interface HTMLElementTagNameMap {
995
- 'gs-mutation-filter': MutationFilterComponent;
996
- }
997
- interface HTMLElementEventMap {
998
- 'gs-mutation-filter-changed': CustomEvent<MutationsFilter>;
1035
+ 'gs-sequences-by-location': SequencesByLocationComponent;
999
1036
  }
1000
1037
  }
1001
1038
 
@@ -1003,7 +1040,7 @@ declare global {
1003
1040
  declare global {
1004
1041
  namespace JSX {
1005
1042
  interface IntrinsicElements {
1006
- 'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1043
+ 'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1007
1044
  }
1008
1045
  }
1009
1046
  }
@@ -1011,10 +1048,7 @@ declare global {
1011
1048
 
1012
1049
  declare global {
1013
1050
  interface HTMLElementTagNameMap {
1014
- 'gs-lineage-filter': LineageFilterComponent;
1015
- }
1016
- interface HTMLElementEventMap {
1017
- 'gs-lineage-filter-changed': CustomEvent<Record<string, string>>;
1051
+ 'gs-statistics': StatisticsComponent;
1018
1052
  }
1019
1053
  }
1020
1054
 
@@ -1022,7 +1056,7 @@ declare global {
1022
1056
  declare global {
1023
1057
  namespace JSX {
1024
1058
  interface IntrinsicElements {
1025
- 'gs-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1059
+ 'gs-statistics': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1026
1060
  }
1027
1061
  }
1028
1062
  }
package/dist/util.js CHANGED
@@ -1,6 +1,7 @@
1
- import { D, d, v } from "./dateRangeOption-Bh2p78z0.js";
1
+ import { D, L, d, v } from "./LocationChangedEvent-CORvQvXv.js";
2
2
  export {
3
3
  D as DateRangeOptionChangedEvent,
4
+ L as LocationChangedEvent,
4
5
  d as dateRangeOptionPresets,
5
6
  v as views
6
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genspectrum/dashboard-components",
3
- "version": "0.11.6",
3
+ "version": "0.12.0",
4
4
  "description": "GenSpectrum web components for building dashboards",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-only",
@@ -87,6 +87,7 @@
87
87
  "chartjs-chart-error-bars": "^4.4.0",
88
88
  "chartjs-chart-venn": "^4.3.0",
89
89
  "dayjs": "^1.11.10",
90
+ "downshift": "^9.0.8",
90
91
  "flatpickr": "^4.6.13",
91
92
  "gridjs": "^6.2.0",
92
93
  "leaflet": "^1.9.4",
@@ -33,9 +33,9 @@ export const CsvDownloadButton: FunctionComponent<CsvDownloadButtonProps> = ({
33
33
  const getDownloadContent = () => {
34
34
  const data = getData();
35
35
  const keys = getDataKeys(data);
36
- const header = `${keys.join(',')}\n`;
36
+ const header = keys.join(',');
37
37
  const rows = data.map((row) => keys.map((key) => row[key]).join(',')).join('\n');
38
- return header + rows;
38
+ return `${header}\n${rows}\n`;
39
39
  };
40
40
 
41
41
  const getDataKeys = (data: Record<string, DataValue>[]) => {
@@ -0,0 +1,3 @@
1
+ declare module 'downshift/preact' {
2
+ export * from 'downshift';
3
+ }
@@ -0,0 +1,11 @@
1
+ export type LapisLocationFilter = Record<string, string | null | undefined>;
2
+
3
+ export class LocationChangedEvent extends CustomEvent<LapisLocationFilter> {
4
+ constructor(detail: LapisLocationFilter) {
5
+ super('gs-location-changed', {
6
+ detail,
7
+ bubbles: true,
8
+ composed: true,
9
+ });
10
+ }
11
+ }
@@ -23,14 +23,14 @@ describe('fetchAutocompletionList', () => {
23
23
  const result = await fetchAutocompletionList(fields, DUMMY_LAPIS_URL);
24
24
 
25
25
  expect(result).to.deep.equal([
26
- { region: 'region1', country: null, division: null },
27
- { region: 'region1', country: 'country1_1', division: null },
26
+ { region: 'region1', country: undefined, division: undefined },
27
+ { region: 'region1', country: 'country1_1', division: undefined },
28
28
  { region: 'region1', country: 'country1_1', division: 'division1_1_1' },
29
29
  { region: 'region1', country: 'country1_1', division: 'division1_1_2' },
30
- { region: 'region1', country: 'country1_2', division: null },
30
+ { region: 'region1', country: 'country1_2', division: undefined },
31
31
  { region: 'region1', country: 'country1_2', division: 'division1_2_1' },
32
- { region: 'region2', country: null, division: null },
33
- { region: 'region2', country: 'country2_1', division: null },
32
+ { region: 'region2', country: undefined, division: undefined },
33
+ { region: 'region2', country: 'country2_1', division: undefined },
34
34
  ]);
35
35
  });
36
36
  });
@@ -1,6 +1,10 @@
1
1
  import { FetchAggregatedOperator } from '../../operator/FetchAggregatedOperator';
2
2
 
3
- export async function fetchAutocompletionList(fields: string[], lapis: string, signal?: AbortSignal) {
3
+ export async function fetchAutocompletionList(
4
+ fields: string[],
5
+ lapis: string,
6
+ signal?: AbortSignal,
7
+ ): Promise<Record<string, string | undefined>[]> {
4
8
  const toAncestorInHierarchyOverwriteValues = Array(fields.length - 1)
5
9
  .fill(0)
6
10
  .map((_, i) => i + 1)
@@ -20,7 +24,10 @@ export async function fetchAutocompletionList(fields: string[], lapis: string, s
20
24
  return setOfAllHierarchies;
21
25
  }, new Set());
22
26
 
23
- return [...locationValues].map((json) => JSON.parse(json)).sort(compareLocationEntries(fields));
27
+ return [...locationValues]
28
+ .map((json) => JSON.parse(json))
29
+ .sort(compareLocationEntries(fields))
30
+ .map((entry) => fields.reduce((acc, field) => ({ ...acc, [field]: entry[field] ?? undefined }), {}));
24
31
  }
25
32
 
26
33
  function compareLocationEntries(fields: string[]) {