@genspectrum/dashboard-components 0.13.6 → 0.13.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 (36) hide show
  1. package/custom-elements.json +28 -28
  2. package/dist/components.d.ts +19 -21
  3. package/dist/components.js +348 -231
  4. package/dist/components.js.map +1 -1
  5. package/dist/style.css +20 -5
  6. package/dist/util.d.ts +18 -18
  7. package/package.json +1 -1
  8. package/src/preact/components/tabs.tsx +3 -5
  9. package/src/preact/mutationFilter/ExampleMutation.tsx +68 -0
  10. package/src/preact/mutationFilter/mutation-filter-info.tsx +179 -112
  11. package/src/preact/mutationFilter/mutation-filter.tsx +10 -5
  12. package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +26 -4
  13. package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.stories.tsx +2 -6
  14. package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.tsx +1 -1
  15. package/src/web-components/{app.stories.ts → gs-app.stories.ts} +1 -1
  16. package/src/web-components/{app.ts → gs-app.ts} +2 -2
  17. package/src/web-components/index.ts +1 -1
  18. package/src/web-components/input/gs-date-range-selector.stories.ts +1 -1
  19. package/src/web-components/input/gs-lineage-filter.stories.ts +1 -1
  20. package/src/web-components/input/gs-location-filter.stories.ts +1 -1
  21. package/src/web-components/input/gs-mutation-filter.stories.ts +2 -2
  22. package/src/web-components/input/gs-text-input.stories.ts +1 -1
  23. package/src/web-components/visualization/gs-aggregate.stories.ts +1 -1
  24. package/src/web-components/visualization/gs-mutation-comparison.stories.ts +1 -1
  25. package/src/web-components/visualization/gs-mutations-over-time.stories.ts +1 -1
  26. package/src/web-components/visualization/gs-mutations.stories.ts +1 -1
  27. package/src/web-components/visualization/gs-number-sequences-over-time.stories.ts +1 -1
  28. package/src/web-components/visualization/gs-prevalence-over-time.stories.ts +1 -1
  29. package/src/web-components/visualization/gs-relative-growth-advantage.stories.ts +1 -1
  30. package/src/web-components/visualization/gs-sequences-by-location.stories.ts +1 -1
  31. package/src/web-components/visualization/gs-statistics.stories.ts +1 -1
  32. package/src/web-components/wastewaterVisualization/gs-wastewater-mutations-over-time.stories.ts +4 -1
  33. package/src/web-components/wastewaterVisualization/gs-wastewater-mutations-over-time.tsx +6 -2
  34. package/standalone-bundle/dashboard-components.js +5073 -5014
  35. package/standalone-bundle/dashboard-components.js.map +1 -1
  36. package/standalone-bundle/style.css +1 -1
package/dist/style.css CHANGED
@@ -3319,6 +3319,9 @@ input.tab:checked + .tab-content,
3319
3319
  .gap-y-1 {
3320
3320
  row-gap: 0.25rem;
3321
3321
  }
3322
+ .overflow-visible {
3323
+ overflow: visible;
3324
+ }
3322
3325
  .overflow-scroll {
3323
3326
  overflow: scroll;
3324
3327
  }
@@ -3328,6 +3331,9 @@ input.tab:checked + .tab-content,
3328
3331
  .whitespace-nowrap {
3329
3332
  white-space: nowrap;
3330
3333
  }
3334
+ .text-nowrap {
3335
+ text-wrap: nowrap;
3336
+ }
3331
3337
  .break-words {
3332
3338
  overflow-wrap: break-word;
3333
3339
  }
@@ -3347,9 +3353,6 @@ input.tab:checked + .tab-content,
3347
3353
  border-bottom-right-radius: 0.375rem;
3348
3354
  border-bottom-left-radius: 0.375rem;
3349
3355
  }
3350
- .rounded-tl-md {
3351
- border-top-left-radius: 0.375rem;
3352
- }
3353
3356
  .rounded-tr-md {
3354
3357
  border-top-right-radius: 0.375rem;
3355
3358
  }
@@ -3359,6 +3362,9 @@ input.tab:checked + .tab-content,
3359
3362
  .border-2 {
3360
3363
  border-width: 2px;
3361
3364
  }
3365
+ .border-b {
3366
+ border-bottom-width: 1px;
3367
+ }
3362
3368
  .border-b-2 {
3363
3369
  border-bottom-width: 2px;
3364
3370
  }
@@ -3374,9 +3380,9 @@ input.tab:checked + .tab-content,
3374
3380
  --tw-border-opacity: 1;
3375
3381
  border-color: rgb(209 213 219 / var(--tw-border-opacity, 1));
3376
3382
  }
3377
- .border-gray-400 {
3383
+ .border-gray-500 {
3378
3384
  --tw-border-opacity: 1;
3379
- border-color: rgb(156 163 175 / var(--tw-border-opacity, 1));
3385
+ border-color: rgb(107 114 128 / var(--tw-border-opacity, 1));
3380
3386
  }
3381
3387
  .border-slate-500 {
3382
3388
  --tw-border-opacity: 1;
@@ -3477,6 +3483,9 @@ input.tab:checked + .tab-content,
3477
3483
  .font-medium {
3478
3484
  font-weight: 500;
3479
3485
  }
3486
+ .font-semibold {
3487
+ font-weight: 600;
3488
+ }
3480
3489
  .leading-5 {
3481
3490
  line-height: 1.25rem;
3482
3491
  }
@@ -3623,6 +3632,12 @@ input.tab:checked + .tab-content,
3623
3632
  visibility: visible;
3624
3633
  }
3625
3634
  }
3635
+ @container (min-width: 6rem) {
3636
+
3637
+ .\@\[6rem\]\:visible {
3638
+ visibility: visible;
3639
+ }
3640
+ }
3626
3641
  @media (min-width: 640px) {
3627
3642
 
3628
3643
  .sm\:max-w-5xl {
package/dist/util.d.ts CHANGED
@@ -822,7 +822,7 @@ declare global {
822
822
 
823
823
  declare global {
824
824
  interface HTMLElementTagNameMap {
825
- 'gs-app': App;
825
+ 'gs-app': AppComponent;
826
826
  }
827
827
  }
828
828
 
@@ -918,7 +918,7 @@ declare global {
918
918
 
919
919
  declare global {
920
920
  interface HTMLElementTagNameMap {
921
- 'gs-mutations-over-time': MutationsOverTimeComponent;
921
+ 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
922
922
  }
923
923
  }
924
924
 
@@ -926,7 +926,7 @@ declare global {
926
926
  declare global {
927
927
  namespace JSX {
928
928
  interface IntrinsicElements {
929
- 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
929
+ 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
930
930
  }
931
931
  }
932
932
  }
@@ -934,7 +934,7 @@ declare global {
934
934
 
935
935
  declare global {
936
936
  interface HTMLElementTagNameMap {
937
- 'gs-sequences-by-location': SequencesByLocationComponent;
937
+ 'gs-mutations-over-time': MutationsOverTimeComponent;
938
938
  }
939
939
  }
940
940
 
@@ -942,7 +942,7 @@ declare global {
942
942
  declare global {
943
943
  namespace JSX {
944
944
  interface IntrinsicElements {
945
- 'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
945
+ 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
946
946
  }
947
947
  }
948
948
  }
@@ -950,7 +950,7 @@ declare global {
950
950
 
951
951
  declare global {
952
952
  interface HTMLElementTagNameMap {
953
- 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
953
+ 'gs-statistics': StatisticsComponent;
954
954
  }
955
955
  }
956
956
 
@@ -958,7 +958,7 @@ declare global {
958
958
  declare global {
959
959
  namespace JSX {
960
960
  interface IntrinsicElements {
961
- 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
961
+ 'gs-statistics': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
962
962
  }
963
963
  }
964
964
  }
@@ -966,7 +966,7 @@ declare global {
966
966
 
967
967
  declare global {
968
968
  interface HTMLElementTagNameMap {
969
- 'gs-statistics': StatisticsComponent;
969
+ 'gs-sequences-by-location': SequencesByLocationComponent;
970
970
  }
971
971
  }
972
972
 
@@ -974,7 +974,7 @@ declare global {
974
974
  declare global {
975
975
  namespace JSX {
976
976
  interface IntrinsicElements {
977
- 'gs-statistics': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
977
+ 'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
978
978
  }
979
979
  }
980
980
  }
@@ -1037,10 +1037,10 @@ declare global {
1037
1037
 
1038
1038
  declare global {
1039
1039
  interface HTMLElementTagNameMap {
1040
- 'gs-text-input': TextInputComponent;
1040
+ 'gs-mutation-filter': MutationFilterComponent;
1041
1041
  }
1042
1042
  interface HTMLElementEventMap {
1043
- 'gs-text-input-changed': TextInputChangedEvent;
1043
+ 'gs-mutation-filter-changed': CustomEvent<MutationsFilter>;
1044
1044
  }
1045
1045
  }
1046
1046
 
@@ -1048,7 +1048,7 @@ declare global {
1048
1048
  declare global {
1049
1049
  namespace JSX {
1050
1050
  interface IntrinsicElements {
1051
- 'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1051
+ 'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1052
1052
  }
1053
1053
  }
1054
1054
  }
@@ -1056,10 +1056,10 @@ declare global {
1056
1056
 
1057
1057
  declare global {
1058
1058
  interface HTMLElementTagNameMap {
1059
- 'gs-lineage-filter': LineageFilterComponent;
1059
+ 'gs-text-input': TextInputComponent;
1060
1060
  }
1061
1061
  interface HTMLElementEventMap {
1062
- 'gs-lineage-filter-changed': LineageFilterChangedEvent;
1062
+ 'gs-text-input-changed': TextInputChangedEvent;
1063
1063
  }
1064
1064
  }
1065
1065
 
@@ -1067,7 +1067,7 @@ declare global {
1067
1067
  declare global {
1068
1068
  namespace JSX {
1069
1069
  interface IntrinsicElements {
1070
- 'gs-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1070
+ 'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1071
1071
  }
1072
1072
  }
1073
1073
  }
@@ -1075,10 +1075,10 @@ declare global {
1075
1075
 
1076
1076
  declare global {
1077
1077
  interface HTMLElementTagNameMap {
1078
- 'gs-mutation-filter': MutationFilterComponent;
1078
+ 'gs-lineage-filter': LineageFilterComponent;
1079
1079
  }
1080
1080
  interface HTMLElementEventMap {
1081
- 'gs-mutation-filter-changed': CustomEvent<MutationsFilter>;
1081
+ 'gs-lineage-filter-changed': LineageFilterChangedEvent;
1082
1082
  }
1083
1083
  }
1084
1084
 
@@ -1086,7 +1086,7 @@ declare global {
1086
1086
  declare global {
1087
1087
  namespace JSX {
1088
1088
  interface IntrinsicElements {
1089
- 'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1089
+ 'gs-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1090
1090
  }
1091
1091
  }
1092
1092
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genspectrum/dashboard-components",
3
- "version": "0.13.6",
3
+ "version": "0.13.7",
4
4
  "description": "GenSpectrum web components for building dashboards",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-only",
@@ -23,8 +23,8 @@ const Tabs: FunctionComponent<ComponentTabsProps> = ({ tabs, toolbar }) => {
23
23
  key={tab.title}
24
24
  className={`px-4 py-2 text-sm font-medium leading-5 transition-colors duration-150 ${
25
25
  activeTab === tab.title
26
- ? 'border-b-2 border-gray-400'
27
- : 'text-gray-600 hover:bg-gray-100 hover:text-gray-700'
26
+ ? 'border-b-2 border-gray-500'
27
+ : 'border-b border-gray-300 text-gray-600 hover:bg-gray-100 hover:text-gray-700'
28
28
  }`}
29
29
  onClick={() => {
30
30
  setActiveTab(tab.title);
@@ -45,9 +45,7 @@ const Tabs: FunctionComponent<ComponentTabsProps> = ({ tabs, toolbar }) => {
45
45
  {tabElements}
46
46
  {toolbar && <div className='py-2 flex flex-wrap gap-y-1'>{toolbarElement}</div>}
47
47
  </div>
48
- <div
49
- className={`p-2 flex-grow overflow-scroll border-2 border-gray-100 rounded-b-md rounded-tr-md ${activeTab === tabs[0]?.title ? '' : 'rounded-tl-md'}`}
50
- >
48
+ <div className={`p-2 flex-grow overflow-scroll border-2 border-gray-100 rounded-b-md rounded-tr-md`}>
51
49
  {tabs.map((tab) => (
52
50
  <div className='h-full' key={tab.title} hidden={activeTab !== tab.title}>
53
51
  {tab.content}
@@ -0,0 +1,68 @@
1
+ import { useContext } from 'preact/hooks';
2
+ import type { FC } from 'react';
3
+
4
+ import { type ReferenceGenome } from '../../lapisApi/ReferenceGenome';
5
+ import type { SequenceType } from '../../types';
6
+ import { ReferenceGenomeContext } from '../ReferenceGenomeContext';
7
+
8
+ type ExampleMutationProps = {
9
+ sequenceType: SequenceType;
10
+ mutationType: 'substitution' | 'insertion';
11
+ };
12
+
13
+ export const ExampleMutation: FC<ExampleMutationProps> = ({ sequenceType, mutationType }) => {
14
+ const referenceGenome = useContext(ReferenceGenomeContext);
15
+
16
+ return <b>{getExampleMutation(referenceGenome, sequenceType, mutationType)}</b>;
17
+ };
18
+
19
+ export function getExampleMutation(
20
+ referenceGenome: ReferenceGenome,
21
+ sequenceType: SequenceType,
22
+ mutationType: 'substitution' | 'insertion',
23
+ ) {
24
+ switch (sequenceType) {
25
+ case 'amino acid': {
26
+ if (referenceGenome.genes.length === 0) {
27
+ return '';
28
+ }
29
+
30
+ const firstGene = referenceGenome.genes[0].name;
31
+
32
+ switch (mutationType) {
33
+ case 'substitution':
34
+ return `${firstGene}:57Q`;
35
+ case 'insertion':
36
+ return `ins_${firstGene}:31:N`;
37
+ }
38
+ }
39
+ // Issue of linter https://github.com/typescript-eslint/typescript-eslint/issues/3455
40
+ // eslint-disable-next-line no-fallthrough
41
+ case 'nucleotide': {
42
+ switch (referenceGenome.nucleotideSequences.length) {
43
+ case 0: {
44
+ return '';
45
+ }
46
+ case 1: {
47
+ switch (mutationType) {
48
+ case 'substitution':
49
+ return '23T';
50
+ case 'insertion':
51
+ return 'ins_1046:A';
52
+ }
53
+ }
54
+ // Issue of linter https://github.com/typescript-eslint/typescript-eslint/issues/3455
55
+ // eslint-disable-next-line no-fallthrough
56
+ default: {
57
+ const firstSegment = referenceGenome.nucleotideSequences[0].name;
58
+ switch (mutationType) {
59
+ case 'substitution':
60
+ return `${firstSegment}:23T`;
61
+ case 'insertion':
62
+ return `ins_${firstSegment}:10462:A`;
63
+ }
64
+ }
65
+ }
66
+ }
67
+ }
68
+ }