@genspectrum/dashboard-components 0.13.3 → 0.13.5

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/dist/util.d.ts CHANGED
@@ -854,7 +854,7 @@ declare global {
854
854
 
855
855
  declare global {
856
856
  interface HTMLElementTagNameMap {
857
- 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
857
+ 'gs-mutations-component': MutationsComponent;
858
858
  }
859
859
  }
860
860
 
@@ -862,7 +862,7 @@ declare global {
862
862
  declare global {
863
863
  namespace JSX {
864
864
  interface IntrinsicElements {
865
- 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
865
+ 'gs-mutations-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
866
866
  }
867
867
  }
868
868
  }
@@ -870,7 +870,7 @@ declare global {
870
870
 
871
871
  declare global {
872
872
  interface HTMLElementTagNameMap {
873
- 'gs-mutations-component': MutationsComponent;
873
+ 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
874
874
  }
875
875
  }
876
876
 
@@ -878,7 +878,7 @@ declare global {
878
878
  declare global {
879
879
  namespace JSX {
880
880
  interface IntrinsicElements {
881
- 'gs-mutations-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
881
+ 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
882
882
  }
883
883
  }
884
884
  }
@@ -1018,10 +1018,10 @@ declare global {
1018
1018
 
1019
1019
  declare global {
1020
1020
  interface HTMLElementTagNameMap {
1021
- 'gs-location-filter': LocationFilterComponent;
1021
+ 'gs-text-input': TextInputComponent;
1022
1022
  }
1023
1023
  interface HTMLElementEventMap {
1024
- 'gs-location-changed': LocationChangedEvent;
1024
+ 'gs-text-input-changed': TextInputChangedEvent;
1025
1025
  }
1026
1026
  }
1027
1027
 
@@ -1029,7 +1029,7 @@ declare global {
1029
1029
  declare global {
1030
1030
  namespace JSX {
1031
1031
  interface IntrinsicElements {
1032
- 'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1032
+ 'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1033
1033
  }
1034
1034
  }
1035
1035
  }
@@ -1037,10 +1037,10 @@ declare global {
1037
1037
 
1038
1038
  declare global {
1039
1039
  interface HTMLElementTagNameMap {
1040
- 'gs-lineage-filter': LineageFilterComponent;
1040
+ 'gs-location-filter': LocationFilterComponent;
1041
1041
  }
1042
1042
  interface HTMLElementEventMap {
1043
- 'gs-lineage-filter-changed': LineageFilterChangedEvent;
1043
+ 'gs-location-changed': LocationChangedEvent;
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-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1051
+ 'gs-location-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-text-input': TextInputComponent;
1059
+ 'gs-mutation-filter': MutationFilterComponent;
1060
1060
  }
1061
1061
  interface HTMLElementEventMap {
1062
- 'gs-text-input-changed': TextInputChangedEvent;
1062
+ 'gs-mutation-filter-changed': CustomEvent<MutationsFilter>;
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-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1070
+ 'gs-mutation-filter': 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.3",
3
+ "version": "0.13.5",
4
4
  "description": "GenSpectrum web components for building dashboards",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-only",
@@ -12,14 +12,20 @@ import { formatProportion } from '../shared/table/formatProportion';
12
12
  export interface MutationsOverTimeGridProps {
13
13
  data: MutationOverTimeDataMap;
14
14
  colorScale: ColorScale;
15
+ maxNumberOfGridRows?: number;
15
16
  }
16
17
 
17
18
  const MAX_NUMBER_OF_GRID_ROWS = 100;
18
19
  const MUTATION_CELL_WIDTH_REM = 8;
19
20
 
20
- const MutationsOverTimeGrid: FunctionComponent<MutationsOverTimeGridProps> = ({ data, colorScale }) => {
21
+ const MutationsOverTimeGrid: FunctionComponent<MutationsOverTimeGridProps> = ({
22
+ data,
23
+ colorScale,
24
+ maxNumberOfGridRows,
25
+ }) => {
26
+ const currentMaxNumberOfGridRows = maxNumberOfGridRows ?? MAX_NUMBER_OF_GRID_ROWS;
21
27
  const allMutations = data.getFirstAxisKeys();
22
- const shownMutations = allMutations.slice(0, MAX_NUMBER_OF_GRID_ROWS);
28
+ const shownMutations = allMutations.slice(0, currentMaxNumberOfGridRows);
23
29
 
24
30
  const dates = data.getSecondAxisKeys();
25
31
 
@@ -27,10 +33,10 @@ const MutationsOverTimeGrid: FunctionComponent<MutationsOverTimeGridProps> = ({
27
33
 
28
34
  return (
29
35
  <>
30
- {allMutations.length > MAX_NUMBER_OF_GRID_ROWS && (
36
+ {allMutations.length > currentMaxNumberOfGridRows && (
31
37
  <div className='pl-2'>
32
- Showing {MAX_NUMBER_OF_GRID_ROWS} of {allMutations.length} mutations. You can narrow the filter to
33
- reduce the number of mutations.
38
+ Showing {currentMaxNumberOfGridRows} of {allMutations.length} mutations. You can narrow the filter
39
+ to reduce the number of mutations.
34
40
  </div>
35
41
  )}
36
42
  {allMutations.length === 0 && (
@@ -23,6 +23,7 @@ const wastewaterMutationOverTimeSchema = z.object({
23
23
  sequenceType: sequenceTypeSchema,
24
24
  width: z.string(),
25
25
  height: z.string(),
26
+ maxNumberOfGridRows: z.number().optional(),
26
27
  });
27
28
 
28
29
  export type WastewaterMutationsOverTimeProps = z.infer<typeof wastewaterMutationOverTimeSchema>;
@@ -75,6 +76,7 @@ export const WastewaterMutationsOverTimeInner: FunctionComponent<WastewaterMutat
75
76
  <MutationsOverTimeTabs
76
77
  mutationOverTimeDataPerLocation={mutationOverTimeDataPerLocation}
77
78
  originalComponentProps={componentProps}
79
+ maxNumberOfGridRows={componentProps.maxNumberOfGridRows}
78
80
  />
79
81
  );
80
82
  };
@@ -87,17 +89,21 @@ type MutationOverTimeDataPerLocation = {
87
89
  type MutationOverTimeTabsProps = {
88
90
  mutationOverTimeDataPerLocation: MutationOverTimeDataPerLocation;
89
91
  originalComponentProps: WastewaterMutationsOverTimeProps;
92
+ maxNumberOfGridRows?: number;
90
93
  };
91
94
 
92
95
  const MutationsOverTimeTabs: FunctionComponent<MutationOverTimeTabsProps> = ({
93
96
  mutationOverTimeDataPerLocation,
94
97
  originalComponentProps,
98
+ maxNumberOfGridRows,
95
99
  }) => {
96
100
  const [colorScale, setColorScale] = useState<ColorScale>({ min: 0, max: 1, color: 'indigo' });
97
101
 
98
102
  const tabs = mutationOverTimeDataPerLocation.map(({ location, data }) => ({
99
103
  title: location,
100
- content: <MutationsOverTimeGrid data={data} colorScale={colorScale} />,
104
+ content: (
105
+ <MutationsOverTimeGrid data={data} colorScale={colorScale} maxNumberOfGridRows={maxNumberOfGridRows} />
106
+ ),
101
107
  }));
102
108
 
103
109
  const toolbar = (
@@ -140,7 +146,9 @@ const WastewaterMutationsOverTimeInfo: FunctionComponent<WastewaterMutationsOver
140
146
  return (
141
147
  <Info>
142
148
  <InfoHeadline1>Info for mutations over time</InfoHeadline1>
143
- <InfoParagraph> </InfoParagraph>
149
+ <InfoParagraph>
150
+ <slot name='infoText' />
151
+ </InfoParagraph>
144
152
  <InfoComponentCode
145
153
  componentName='wastewater-mutations-over-time'
146
154
  params={originalComponentProps}
@@ -14,9 +14,11 @@ const codeExample = String.raw`
14
14
  sequenceType='nucleotide'
15
15
  width='100%'
16
16
  height='700px'
17
- ></gs-wastewater-mutations-over-time>`;
17
+ >
18
+ <span slot="infoText">Some info text</span>
19
+ </gs-wastewater-mutations-over-time>`;
18
20
 
19
- const meta: Meta<Required<WastewaterMutationsOverTimeProps>> = {
21
+ const meta: Meta<WastewaterMutationsOverTimeProps & { infoText: string }> = {
20
22
  title: 'Wastewater visualization/Wastewater mutations over time',
21
23
  component: 'gs-wastewater-mutations-over-time',
22
24
  argTypes: {
@@ -33,6 +35,7 @@ const meta: Meta<Required<WastewaterMutationsOverTimeProps>> = {
33
35
  sequenceType: 'nucleotide',
34
36
  width: '100%',
35
37
  height: '700px',
38
+ infoText: 'Some info text',
36
39
  },
37
40
  parameters: withComponentDocs({
38
41
  componentDocs: {
@@ -47,7 +50,7 @@ const meta: Meta<Required<WastewaterMutationsOverTimeProps>> = {
47
50
 
48
51
  export default meta;
49
52
 
50
- export const WastewaterMutationsOverTime: StoryObj<Required<WastewaterMutationsOverTimeProps>> = {
53
+ export const WastewaterMutationsOverTime: StoryObj<WastewaterMutationsOverTimeProps & { infoText: string }> = {
51
54
  render: (args) => html`
52
55
  <gs-app lapis="${WISE_LAPIS_URL}">
53
56
  <gs-wastewater-mutations-over-time
@@ -55,7 +58,9 @@ export const WastewaterMutationsOverTime: StoryObj<Required<WastewaterMutationsO
55
58
  .sequenceType=${args.sequenceType}
56
59
  .width=${args.width}
57
60
  .height=${args.height}
58
- ></gs-wastewater-mutations-over-time>
61
+ >
62
+ <span slot="infoText">${args.infoText}</span>
63
+ </gs-wastewater-mutations-over-time>
59
64
  </gs-app>
60
65
  `,
61
66
  parameters: {
@@ -23,6 +23,8 @@ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsS
23
23
  * The content of the tab is a "mutations over time" grid, similar to the one used in the `gs-mutations-over-time` component.
24
24
  *
25
25
  * This component also assumes that the LAPIS instance has the field `date` which can be used for the time axis.
26
+ *
27
+ * @slot infoText - Additional information text to be shown in the info modal (the "?" button).
26
28
  */
27
29
  @customElement('gs-wastewater-mutations-over-time')
28
30
  export class WastewaterMutationsOverTimeComponent extends PreactLitAdapterWithGridJsStyles {
@@ -63,6 +65,14 @@ export class WastewaterMutationsOverTimeComponent extends PreactLitAdapterWithGr
63
65
  @property({ type: String })
64
66
  height: string = '700px';
65
67
 
68
+ /**
69
+ * The maximum number of grid rows to display.
70
+ *
71
+ * Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
72
+ */
73
+ @property({ type: Number })
74
+ maxNumberOfGridRows: number = 100;
75
+
66
76
  override render() {
67
77
  return (
68
78
  <WastewaterMutationsOverTime
@@ -70,6 +80,7 @@ export class WastewaterMutationsOverTimeComponent extends PreactLitAdapterWithGr
70
80
  sequenceType={this.sequenceType}
71
81
  width={this.width}
72
82
  height={this.height}
83
+ maxNumberOfGridRows={this.maxNumberOfGridRows}
73
84
  />
74
85
  );
75
86
  }