@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.
Files changed (44) hide show
  1. package/custom-elements.json +51 -3
  2. package/dist/dashboard-components.js +359 -159
  3. package/dist/dashboard-components.js.map +1 -1
  4. package/dist/genspectrum-components.d.ts +3 -3
  5. package/dist/style.css +92 -8
  6. package/package.json +1 -1
  7. package/src/constants.ts +1 -0
  8. package/src/preact/aggregatedData/aggregate.tsx +1 -1
  9. package/src/preact/components/color-scale-selector-dropdown.stories.tsx +27 -0
  10. package/src/preact/components/color-scale-selector-dropdown.tsx +17 -0
  11. package/src/preact/components/color-scale-selector.stories.tsx +61 -0
  12. package/src/preact/components/color-scale-selector.tsx +79 -0
  13. package/src/preact/components/info.stories.tsx +37 -10
  14. package/src/preact/components/info.tsx +22 -43
  15. package/src/preact/components/min-max-range-slider.tsx +1 -1
  16. package/src/preact/components/tooltip.stories.tsx +12 -2
  17. package/src/preact/components/tooltip.tsx +38 -14
  18. package/src/preact/mutationComparison/mutation-comparison.tsx +1 -1
  19. package/src/preact/mutationFilter/mutation-filter-info.tsx +1 -1
  20. package/src/preact/mutationFilter/mutation-filter.stories.tsx +1 -1
  21. package/src/preact/mutationFilter/mutation-filter.tsx +2 -3
  22. package/src/preact/mutations/mutations.tsx +1 -1
  23. package/src/preact/mutationsOverTime/__mockData__/aggregated_byDay.json +38 -0
  24. package/src/preact/mutationsOverTime/__mockData__/aggregated_byWeek.json +122 -0
  25. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_20_01_2024.json +6778 -0
  26. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_21_01_2024.json +7129 -0
  27. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_22_01_2024.json +4681 -0
  28. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_23_01_2024.json +10738 -0
  29. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_24_01_2024.json +11710 -0
  30. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_25_01_2024.json +11557 -0
  31. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_26_01_2024.json +8596 -0
  32. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_week3_2024.json +8812 -0
  33. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_week4_2024.json +9730 -0
  34. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_week5_2024.json +9865 -0
  35. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_week6_2024.json +11314 -0
  36. package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +83 -40
  37. package/src/preact/mutationsOverTime/mutations-over-time.tsx +50 -11
  38. package/src/preact/numberSequencesOverTime/number-sequences-over-time.tsx +1 -1
  39. package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +1 -1
  40. package/src/preact/shared/charts/colors.ts +1 -1
  41. package/src/utils/temporal.spec.ts +3 -4
  42. package/src/utils/temporal.ts +9 -4
  43. package/src/web-components/visualization/gs-mutations-over-time.stories.ts +262 -2
  44. package/src/preact/shared/icons/DeleteIcon.tsx +0 -17
@@ -1,27 +1,51 @@
1
- import { flip, offset, shift } from '@floating-ui/dom';
2
1
  import { type FunctionComponent } from 'preact';
3
- import { useRef } from 'preact/hooks';
4
2
  import { type JSXInternal } from 'preact/src/jsx';
5
3
 
6
- import { dropdownClass } from './dropdown';
7
- import { useFloatingUi } from '../shared/floating-ui/hooks';
4
+ export type TooltipPosition =
5
+ | 'top'
6
+ | 'top-start'
7
+ | 'top-end'
8
+ | 'bottom'
9
+ | 'bottom-start'
10
+ | 'bottom-end'
11
+ | 'left'
12
+ | 'right';
8
13
 
9
14
  export type TooltipProps = {
10
15
  content: string | JSXInternal.Element;
16
+ position?: TooltipPosition;
11
17
  };
12
18
 
13
- const Tooltip: FunctionComponent<TooltipProps> = ({ children, content }) => {
14
- const referenceRef = useRef<HTMLDivElement>(null);
15
- const floatingRef = useRef<HTMLDivElement>(null);
16
-
17
- useFloatingUi(referenceRef, floatingRef, [offset(5), shift(), flip()]);
19
+ function getPositionCss(position?: TooltipPosition) {
20
+ switch (position) {
21
+ case 'top':
22
+ return 'bottom-full translate-x-[-50%] left-1/2 mb-1';
23
+ case 'top-start':
24
+ return 'bottom-full mr-1 mb-1';
25
+ case 'top-end':
26
+ return 'bottom-full right-0 ml-1 mb-1';
27
+ case 'bottom':
28
+ return 'top-full translate-x-[-50%] left-1/2 mt-1';
29
+ case 'bottom-start':
30
+ return 'mr-1 mt-1';
31
+ case 'bottom-end':
32
+ return 'right-0 ml-1 mt-1';
33
+ case 'left':
34
+ return 'right-full translate-y-[-50%] top-1/2 mr-1';
35
+ case 'right':
36
+ return 'left-full translate-y-[-50%] top-1/2 ml-1';
37
+ case undefined:
38
+ return '';
39
+ }
40
+ }
18
41
 
42
+ const Tooltip: FunctionComponent<TooltipProps> = ({ children, content, position = 'bottom' }) => {
19
43
  return (
20
- <div className='relative'>
21
- <div className='peer' ref={referenceRef}>
22
- {children}
23
- </div>
24
- <div ref={floatingRef} className={`${dropdownClass} hidden peer-hover:block`}>
44
+ <div className='relative w-full h-full'>
45
+ <div className='peer w-full h-full'>{children}</div>
46
+ <div
47
+ className={`absolute z-10 w-max bg-white p-4 border border-gray-200 rounded-md invisible peer-hover:visible ${getPositionCss(position)}`}
48
+ >
25
49
  {content}
26
50
  </div>
27
51
  </div>
@@ -188,7 +188,7 @@ const Toolbar: FunctionComponent<ToolbarProps> = ({
188
188
  getData={() => getMutationComparisonTableData({ content: filteredData }, proportionInterval)}
189
189
  filename='mutation_comparison.csv'
190
190
  />
191
- <Info height={'100px'}>Info for mutation comparison</Info>
191
+ <Info>Info for mutation comparison</Info>
192
192
  </>
193
193
  );
194
194
  };
@@ -9,7 +9,7 @@ export const MutationFilterInfo = () => {
9
9
 
10
10
  const firstGene = referenceGenome.genes[0].name;
11
11
  return (
12
- <Info height={'80vh'}>
12
+ <Info>
13
13
  <InfoHeadline1> Mutation Filter</InfoHeadline1>
14
14
  <InfoParagraph>This component allows you to filter for mutations at specific positions.</InfoParagraph>
15
15
 
@@ -104,7 +104,7 @@ export const FiresFilterChangedEvents: StoryObj<MutationFilterProps> = {
104
104
  });
105
105
 
106
106
  await step('Remove the first mutation', async () => {
107
- const firstMutationDeleteButton = canvas.getAllByRole('button')[1];
107
+ const firstMutationDeleteButton = canvas.getAllByRole('button', { name: '✕' })[1];
108
108
  await waitFor(() => fireEvent.click(firstMutationDeleteButton));
109
109
 
110
110
  await expect(changedListenerMock).toHaveBeenCalledWith(
@@ -8,7 +8,6 @@ import { type Deletion, type Insertion, type Mutation, type Substitution } from
8
8
  import { ReferenceGenomeContext } from '../ReferenceGenomeContext';
9
9
  import { ErrorBoundary } from '../components/error-boundary';
10
10
  import { singleGraphColorRGBByName } from '../shared/charts/colors';
11
- import { DeleteIcon } from '../shared/icons/DeleteIcon';
12
11
 
13
12
  export interface MutationFilterInnerProps {
14
13
  initialValue?: SelectedMutationFilterStrings | string[] | undefined;
@@ -312,8 +311,8 @@ const SelectedFilter = <MutationType extends Mutation>({
312
311
  style={{ backgroundColor, color: textColor }}
313
312
  >
314
313
  {mutation.toString()}
315
- <button type='button' onClick={() => onDelete(mutation)}>
316
- <DeleteIcon />
314
+ <button className='ml-1' type='button' onClick={() => onDelete(mutation)}>
315
+
317
316
  </button>
318
317
  </span>
319
318
  );
@@ -207,7 +207,7 @@ const Toolbar: FunctionComponent<ToolbarProps> = ({
207
207
  filename='insertions.csv'
208
208
  />
209
209
  )}
210
- <Info height={'100px'}>Info for mutations</Info>
210
+ <Info>Info for mutations</Info>
211
211
  </>
212
212
  );
213
213
  };
@@ -0,0 +1,38 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "count": 447,
5
+ "date": "2024-01-20"
6
+ },
7
+ {
8
+ "count": 1096,
9
+ "date": "2024-01-22"
10
+ },
11
+ {
12
+ "count": 1008,
13
+ "date": "2024-01-23"
14
+ },
15
+ {
16
+ "count": 526,
17
+ "date": "2024-01-21"
18
+ },
19
+ {
20
+ "count": 866,
21
+ "date": "2024-01-24"
22
+ },
23
+ {
24
+ "count": 819,
25
+ "date": "2024-01-25"
26
+ },
27
+ {
28
+ "count": 622,
29
+ "date": "2024-01-26"
30
+ }
31
+ ],
32
+ "info": {
33
+ "dataVersion": "1721588457",
34
+ "requestId": "4181b443-024d-4520-a68b-a4f0e2249d3a",
35
+ "requestInfo": "sars_cov-2_nextstrain_open on lapis.cov-spectrum.org at 2024-07-22T16:24:29.959383752",
36
+ "reportTo": "Please report to https://github.com/GenSpectrum/LAPIS/issues in case you encounter any unexpected issues. Please include the request ID and the requestInfo in your report."
37
+ }
38
+ }
@@ -0,0 +1,122 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "count": 622,
5
+ "date": "2024-01-26"
6
+ },
7
+ {
8
+ "count": 819,
9
+ "date": "2024-01-25"
10
+ },
11
+ {
12
+ "count": 683,
13
+ "date": "2024-02-02"
14
+ },
15
+ {
16
+ "count": 526,
17
+ "date": "2024-01-21"
18
+ },
19
+ {
20
+ "count": 580,
21
+ "date": "2024-01-19"
22
+ },
23
+ {
24
+ "count": 434,
25
+ "date": "2024-01-27"
26
+ },
27
+ {
28
+ "count": 947,
29
+ "date": "2024-01-30"
30
+ },
31
+ {
32
+ "count": 831,
33
+ "date": "2024-01-18"
34
+ },
35
+ {
36
+ "count": 447,
37
+ "date": "2024-01-20"
38
+ },
39
+ {
40
+ "count": 803,
41
+ "date": "2024-02-01"
42
+ },
43
+ {
44
+ "count": 332,
45
+ "date": "2024-02-11"
46
+ },
47
+ {
48
+ "count": 967,
49
+ "date": "2024-01-17"
50
+ },
51
+ {
52
+ "count": 993,
53
+ "date": "2024-02-06"
54
+ },
55
+ {
56
+ "count": 714,
57
+ "date": "2024-02-08"
58
+ },
59
+ {
60
+ "count": 1008,
61
+ "date": "2024-01-23"
62
+ },
63
+ {
64
+ "count": 381,
65
+ "date": "2024-02-10"
66
+ },
67
+ {
68
+ "count": 914,
69
+ "date": "2024-01-31"
70
+ },
71
+ {
72
+ "count": 1071,
73
+ "date": "2024-01-29"
74
+ },
75
+ {
76
+ "count": 402,
77
+ "date": "2024-01-28"
78
+ },
79
+ {
80
+ "count": 408,
81
+ "date": "2024-02-04"
82
+ },
83
+ {
84
+ "count": 966,
85
+ "date": "2024-02-05"
86
+ },
87
+ {
88
+ "count": 901,
89
+ "date": "2024-01-15"
90
+ },
91
+ {
92
+ "count": 866,
93
+ "date": "2024-01-24"
94
+ },
95
+ {
96
+ "count": 936,
97
+ "date": "2024-01-16"
98
+ },
99
+ {
100
+ "count": 836,
101
+ "date": "2024-02-07"
102
+ },
103
+ {
104
+ "count": 1096,
105
+ "date": "2024-01-22"
106
+ },
107
+ {
108
+ "count": 636,
109
+ "date": "2024-02-09"
110
+ },
111
+ {
112
+ "count": 438,
113
+ "date": "2024-02-03"
114
+ }
115
+ ],
116
+ "info": {
117
+ "dataVersion": "1721588457",
118
+ "requestId": "52863f95-fe58-427e-8010-b11ffa5600ce",
119
+ "requestInfo": "sars_cov-2_nextstrain_open on lapis.cov-spectrum.org at 2024-07-22T16:17:18.523742468",
120
+ "reportTo": "Please report to https://github.com/GenSpectrum/LAPIS/issues in case you encounter any unexpected issues. Please include the request ID and the requestInfo in your report."
121
+ }
122
+ }