@genspectrum/dashboard-components 0.6.5 → 0.6.7
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.
- package/custom-elements.json +51 -3
- package/dist/dashboard-components.js +359 -159
- package/dist/dashboard-components.js.map +1 -1
- package/dist/genspectrum-components.d.ts +3 -3
- package/dist/style.css +92 -8
- package/package.json +1 -1
- package/src/constants.ts +1 -0
- package/src/preact/aggregatedData/aggregate.tsx +1 -1
- package/src/preact/components/color-scale-selector-dropdown.stories.tsx +27 -0
- package/src/preact/components/color-scale-selector-dropdown.tsx +17 -0
- package/src/preact/components/color-scale-selector.stories.tsx +61 -0
- package/src/preact/components/color-scale-selector.tsx +79 -0
- package/src/preact/components/info.stories.tsx +37 -10
- package/src/preact/components/info.tsx +22 -43
- package/src/preact/components/min-max-range-slider.tsx +1 -1
- package/src/preact/components/tooltip.stories.tsx +12 -2
- package/src/preact/components/tooltip.tsx +38 -14
- package/src/preact/mutationComparison/mutation-comparison.tsx +1 -1
- package/src/preact/mutationFilter/mutation-filter-info.tsx +1 -1
- package/src/preact/mutationFilter/mutation-filter.stories.tsx +1 -1
- package/src/preact/mutationFilter/mutation-filter.tsx +2 -3
- package/src/preact/mutations/mutations.tsx +1 -1
- package/src/preact/mutationsOverTime/__mockData__/aggregated_byDay.json +38 -0
- package/src/preact/mutationsOverTime/__mockData__/aggregated_byWeek.json +122 -0
- package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_20_01_2024.json +6778 -0
- package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_21_01_2024.json +7129 -0
- package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_22_01_2024.json +4681 -0
- package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_23_01_2024.json +10738 -0
- package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_24_01_2024.json +11710 -0
- package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_25_01_2024.json +11557 -0
- package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_26_01_2024.json +8596 -0
- package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_week3_2024.json +8812 -0
- package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_week4_2024.json +9730 -0
- package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_week5_2024.json +9865 -0
- package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_week6_2024.json +11314 -0
- package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +83 -40
- package/src/preact/mutationsOverTime/mutations-over-time.tsx +50 -11
- package/src/preact/numberSequencesOverTime/number-sequences-over-time.tsx +1 -1
- package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +1 -1
- package/src/preact/shared/charts/colors.ts +1 -1
- package/src/utils/temporal.spec.ts +3 -4
- package/src/utils/temporal.ts +9 -4
- package/src/web-components/visualization/gs-mutations-over-time.stories.ts +262 -2
- package/src/preact/shared/icons/DeleteIcon.tsx +0 -17
|
@@ -4,8 +4,22 @@ import { html } from 'lit';
|
|
|
4
4
|
import './gs-mutations-over-time';
|
|
5
5
|
import '../app';
|
|
6
6
|
import { withComponentDocs } from '../../../.storybook/ComponentDocsBlock';
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
AGGREGATED_ENDPOINT,
|
|
9
|
+
AMINO_ACID_MUTATIONS_ENDPOINT,
|
|
10
|
+
LAPIS_URL,
|
|
11
|
+
NUCLEOTIDE_MUTATIONS_ENDPOINT,
|
|
12
|
+
} from '../../constants';
|
|
13
|
+
import aggregated_byDay from '../../preact/mutationsOverTime/__mockData__/aggregated_byDay.json';
|
|
14
|
+
import aggregated_byWeek from '../../preact/mutationsOverTime/__mockData__/aggregated_byWeek.json';
|
|
8
15
|
import aggregated_date from '../../preact/mutationsOverTime/__mockData__/aggregated_date.json';
|
|
16
|
+
import aminoAcidMutations_20_01_2024 from '../../preact/mutationsOverTime/__mockData__/aminoAcidMutations_20_01_2024.json';
|
|
17
|
+
import aminoAcidMutations_21_01_2024 from '../../preact/mutationsOverTime/__mockData__/aminoAcidMutations_21_01_2024.json';
|
|
18
|
+
import aminoAcidMutations_22_01_2024 from '../../preact/mutationsOverTime/__mockData__/aminoAcidMutations_22_01_2024.json';
|
|
19
|
+
import aminoAcidMutations_23_01_2024 from '../../preact/mutationsOverTime/__mockData__/aminoAcidMutations_23_01_2024.json';
|
|
20
|
+
import aminoAcidMutations_24_01_2024 from '../../preact/mutationsOverTime/__mockData__/aminoAcidMutations_24_01_2024.json';
|
|
21
|
+
import aminoAcidMutations_25_01_2024 from '../../preact/mutationsOverTime/__mockData__/aminoAcidMutations_25_01_2024.json';
|
|
22
|
+
import aminoAcidMutations_26_01_2024 from '../../preact/mutationsOverTime/__mockData__/aminoAcidMutations_26_01_2024.json';
|
|
9
23
|
import nucleotideMutation_01 from '../../preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_01.json';
|
|
10
24
|
import nucleotideMutation_02 from '../../preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_02.json';
|
|
11
25
|
import nucleotideMutation_03 from '../../preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_03.json';
|
|
@@ -13,6 +27,10 @@ import nucleotideMutation_04 from '../../preact/mutationsOverTime/__mockData__/n
|
|
|
13
27
|
import nucleotideMutation_05 from '../../preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_05.json';
|
|
14
28
|
import nucleotideMutation_06 from '../../preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_06.json';
|
|
15
29
|
import nucleotideMutation_07 from '../../preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_07.json';
|
|
30
|
+
import nucleotideMutation_week3 from '../../preact/mutationsOverTime/__mockData__/nucleotideMutations_week3_2024.json';
|
|
31
|
+
import nucleotideMutation_week4 from '../../preact/mutationsOverTime/__mockData__/nucleotideMutations_week4_2024.json';
|
|
32
|
+
import nucleotideMutation_week5 from '../../preact/mutationsOverTime/__mockData__/nucleotideMutations_week5_2024.json';
|
|
33
|
+
import nucleotideMutation_week6 from '../../preact/mutationsOverTime/__mockData__/nucleotideMutations_week6_2024.json';
|
|
16
34
|
import { type MutationsOverTimeProps } from '../../preact/mutationsOverTime/mutations-over-time';
|
|
17
35
|
|
|
18
36
|
const codeExample = String.raw`
|
|
@@ -85,7 +103,7 @@ const Template: StoryObj<Required<MutationsOverTimeProps>> = {
|
|
|
85
103
|
`,
|
|
86
104
|
};
|
|
87
105
|
|
|
88
|
-
export const
|
|
106
|
+
export const ByMonth: StoryObj<Required<MutationsOverTimeProps>> = {
|
|
89
107
|
...Template,
|
|
90
108
|
parameters: {
|
|
91
109
|
fetchMock: {
|
|
@@ -223,3 +241,245 @@ export const Default: StoryObj<Required<MutationsOverTimeProps>> = {
|
|
|
223
241
|
},
|
|
224
242
|
},
|
|
225
243
|
};
|
|
244
|
+
|
|
245
|
+
export const ByWeek: StoryObj<Required<MutationsOverTimeProps>> = {
|
|
246
|
+
...Template,
|
|
247
|
+
args: {
|
|
248
|
+
...Template.args,
|
|
249
|
+
lapisFilter: { pangoLineage: 'JN.1*', dateFrom: '2024-01-15', dateTo: '2024-02-11' },
|
|
250
|
+
granularity: 'week',
|
|
251
|
+
},
|
|
252
|
+
parameters: {
|
|
253
|
+
fetchMock: {
|
|
254
|
+
mocks: [
|
|
255
|
+
{
|
|
256
|
+
matcher: {
|
|
257
|
+
name: 'aggregated_dates',
|
|
258
|
+
url: AGGREGATED_ENDPOINT,
|
|
259
|
+
body: {
|
|
260
|
+
dateFrom: '2024-01-15',
|
|
261
|
+
dateTo: '2024-02-11',
|
|
262
|
+
fields: ['date'],
|
|
263
|
+
pangoLineage: 'JN.1*',
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
response: {
|
|
267
|
+
status: 200,
|
|
268
|
+
body: aggregated_byWeek,
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
matcher: {
|
|
273
|
+
name: 'nucleotideMutation_week3',
|
|
274
|
+
url: NUCLEOTIDE_MUTATIONS_ENDPOINT,
|
|
275
|
+
body: {
|
|
276
|
+
pangoLineage: 'JN.1*',
|
|
277
|
+
dateFrom: '2024-01-15',
|
|
278
|
+
dateTo: '2024-01-21',
|
|
279
|
+
minProportion: 0.001,
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
response: {
|
|
283
|
+
status: 200,
|
|
284
|
+
body: nucleotideMutation_week3,
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
matcher: {
|
|
289
|
+
name: 'nucleotideMutation_week4',
|
|
290
|
+
url: NUCLEOTIDE_MUTATIONS_ENDPOINT,
|
|
291
|
+
body: {
|
|
292
|
+
pangoLineage: 'JN.1*',
|
|
293
|
+
dateFrom: '2024-01-22',
|
|
294
|
+
dateTo: '2024-01-28',
|
|
295
|
+
minProportion: 0.001,
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
response: {
|
|
299
|
+
status: 200,
|
|
300
|
+
body: nucleotideMutation_week4,
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
matcher: {
|
|
305
|
+
name: 'nucleotideMutation_week5',
|
|
306
|
+
url: NUCLEOTIDE_MUTATIONS_ENDPOINT,
|
|
307
|
+
body: {
|
|
308
|
+
pangoLineage: 'JN.1*',
|
|
309
|
+
dateFrom: '2024-01-29',
|
|
310
|
+
dateTo: '2024-02-04',
|
|
311
|
+
minProportion: 0.001,
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
response: {
|
|
315
|
+
status: 200,
|
|
316
|
+
body: nucleotideMutation_week5,
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
matcher: {
|
|
321
|
+
name: 'nucleotideMutation_week6',
|
|
322
|
+
url: NUCLEOTIDE_MUTATIONS_ENDPOINT,
|
|
323
|
+
body: {
|
|
324
|
+
pangoLineage: 'JN.1*',
|
|
325
|
+
dateFrom: '2024-02-05',
|
|
326
|
+
dateTo: '2024-02-11',
|
|
327
|
+
minProportion: 0.001,
|
|
328
|
+
},
|
|
329
|
+
},
|
|
330
|
+
response: {
|
|
331
|
+
status: 200,
|
|
332
|
+
body: nucleotideMutation_week6,
|
|
333
|
+
},
|
|
334
|
+
},
|
|
335
|
+
],
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
export const AminoAcidMutationsByDay: StoryObj<Required<MutationsOverTimeProps>> = {
|
|
341
|
+
...Template,
|
|
342
|
+
args: {
|
|
343
|
+
...Template.args,
|
|
344
|
+
lapisFilter: { pangoLineage: 'JN.1*', dateFrom: '2024-01-20', dateTo: '2024-01-26' },
|
|
345
|
+
granularity: 'day',
|
|
346
|
+
sequenceType: 'amino acid',
|
|
347
|
+
},
|
|
348
|
+
parameters: {
|
|
349
|
+
fetchMock: {
|
|
350
|
+
mocks: [
|
|
351
|
+
{
|
|
352
|
+
matcher: {
|
|
353
|
+
name: 'aggregated_byDay',
|
|
354
|
+
url: AGGREGATED_ENDPOINT,
|
|
355
|
+
body: { pangoLineage: 'JN.1*', dateFrom: '2024-01-20', dateTo: '2024-01-26', fields: ['date'] },
|
|
356
|
+
},
|
|
357
|
+
response: {
|
|
358
|
+
status: 200,
|
|
359
|
+
body: aggregated_byDay,
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
matcher: {
|
|
364
|
+
name: 'aminoAcidMutations_20_01_2024',
|
|
365
|
+
url: AMINO_ACID_MUTATIONS_ENDPOINT,
|
|
366
|
+
body: {
|
|
367
|
+
pangoLineage: 'JN.1*',
|
|
368
|
+
dateFrom: '2024-01-20',
|
|
369
|
+
dateTo: '2024-01-20',
|
|
370
|
+
minProportion: 0.001,
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
response: {
|
|
374
|
+
status: 200,
|
|
375
|
+
body: aminoAcidMutations_20_01_2024,
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
matcher: {
|
|
380
|
+
name: 'aminoAcidMutations_21_01_2024',
|
|
381
|
+
url: AMINO_ACID_MUTATIONS_ENDPOINT,
|
|
382
|
+
body: {
|
|
383
|
+
pangoLineage: 'JN.1*',
|
|
384
|
+
dateFrom: '2024-01-21',
|
|
385
|
+
dateTo: '2024-01-21',
|
|
386
|
+
minProportion: 0.001,
|
|
387
|
+
},
|
|
388
|
+
},
|
|
389
|
+
response: {
|
|
390
|
+
status: 200,
|
|
391
|
+
body: aminoAcidMutations_21_01_2024,
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
matcher: {
|
|
396
|
+
name: 'aminoAcidMutations_22_01_2024',
|
|
397
|
+
url: AMINO_ACID_MUTATIONS_ENDPOINT,
|
|
398
|
+
body: {
|
|
399
|
+
pangoLineage: 'JN.1*',
|
|
400
|
+
dateFrom: '2024-01-22',
|
|
401
|
+
dateTo: '2024-01-22',
|
|
402
|
+
minProportion: 0.001,
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
response: {
|
|
406
|
+
status: 200,
|
|
407
|
+
body: aminoAcidMutations_22_01_2024,
|
|
408
|
+
},
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
matcher: {
|
|
412
|
+
name: 'aminoAcidMutations_23_01_2024',
|
|
413
|
+
url: AMINO_ACID_MUTATIONS_ENDPOINT,
|
|
414
|
+
body: {
|
|
415
|
+
pangoLineage: 'JN.1*',
|
|
416
|
+
dateFrom: '2024-01-23',
|
|
417
|
+
dateTo: '2024-01-23',
|
|
418
|
+
minProportion: 0.001,
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
response: {
|
|
422
|
+
status: 200,
|
|
423
|
+
body: aminoAcidMutations_23_01_2024,
|
|
424
|
+
},
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
matcher: {
|
|
428
|
+
name: 'aminoAcidMutations_24_01_2024',
|
|
429
|
+
url: AMINO_ACID_MUTATIONS_ENDPOINT,
|
|
430
|
+
body: {
|
|
431
|
+
pangoLineage: 'JN.1*',
|
|
432
|
+
dateFrom: '2024-01-24',
|
|
433
|
+
dateTo: '2024-01-24',
|
|
434
|
+
minProportion: 0.001,
|
|
435
|
+
},
|
|
436
|
+
},
|
|
437
|
+
response: {
|
|
438
|
+
status: 200,
|
|
439
|
+
body: aminoAcidMutations_24_01_2024,
|
|
440
|
+
},
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
matcher: {
|
|
444
|
+
name: 'aminoAcidMutations_25_01_2024',
|
|
445
|
+
url: AMINO_ACID_MUTATIONS_ENDPOINT,
|
|
446
|
+
body: {
|
|
447
|
+
pangoLineage: 'JN.1*',
|
|
448
|
+
dateFrom: '2024-01-25',
|
|
449
|
+
dateTo: '2024-01-25',
|
|
450
|
+
minProportion: 0.001,
|
|
451
|
+
},
|
|
452
|
+
},
|
|
453
|
+
response: {
|
|
454
|
+
status: 200,
|
|
455
|
+
body: aminoAcidMutations_25_01_2024,
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
matcher: {
|
|
460
|
+
name: 'aminoAcidMutations_26_01_2024',
|
|
461
|
+
url: AMINO_ACID_MUTATIONS_ENDPOINT,
|
|
462
|
+
body: {
|
|
463
|
+
pangoLineage: 'JN.1*',
|
|
464
|
+
dateFrom: '2024-01-26',
|
|
465
|
+
dateTo: '2024-01-26',
|
|
466
|
+
minProportion: 0.001,
|
|
467
|
+
},
|
|
468
|
+
},
|
|
469
|
+
response: {
|
|
470
|
+
status: 200,
|
|
471
|
+
body: aminoAcidMutations_26_01_2024,
|
|
472
|
+
},
|
|
473
|
+
},
|
|
474
|
+
],
|
|
475
|
+
},
|
|
476
|
+
},
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
export const HideProportionOnSmallScreen: StoryObj<Required<MutationsOverTimeProps>> = {
|
|
480
|
+
...ByMonth,
|
|
481
|
+
args: {
|
|
482
|
+
...ByMonth.args,
|
|
483
|
+
width: '300px',
|
|
484
|
+
},
|
|
485
|
+
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { FunctionComponent } from 'preact';
|
|
2
|
-
|
|
3
|
-
export const DeleteIcon: FunctionComponent = () => {
|
|
4
|
-
return (
|
|
5
|
-
<svg
|
|
6
|
-
fill='currentColor'
|
|
7
|
-
stroke-width='0'
|
|
8
|
-
xmlns='http://www.w3.org/2000/svg'
|
|
9
|
-
viewBox='0 0 16 16'
|
|
10
|
-
style='overflow: visible; color: currentcolor;'
|
|
11
|
-
height='1em'
|
|
12
|
-
width='1em'
|
|
13
|
-
>
|
|
14
|
-
<path d='M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z' />
|
|
15
|
-
</svg>
|
|
16
|
-
);
|
|
17
|
-
};
|