@genspectrum/dashboard-components 0.2.0 → 0.3.1

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 (59) hide show
  1. package/custom-elements.json +330 -179
  2. package/dist/dashboard-components.js +379 -187
  3. package/dist/dashboard-components.js.map +1 -1
  4. package/dist/genspectrum-components.d.ts +160 -114
  5. package/dist/style.css +171 -71
  6. package/package.json +1 -2
  7. package/src/constants.ts +1 -1
  8. package/src/lapisApi/lapisApi.ts +46 -2
  9. package/src/lapisApi/lapisTypes.ts +14 -0
  10. package/src/preact/aggregatedData/aggregate.stories.tsx +4 -2
  11. package/src/preact/aggregatedData/aggregate.tsx +8 -6
  12. package/src/preact/components/error-boundary.stories.tsx +6 -14
  13. package/src/preact/components/error-boundary.tsx +2 -11
  14. package/src/preact/components/error-display.stories.tsx +12 -5
  15. package/src/preact/components/error-display.tsx +37 -3
  16. package/src/preact/components/loading-display.stories.tsx +1 -1
  17. package/src/preact/components/resize-container.tsx +5 -14
  18. package/src/preact/dateRangeSelector/date-range-selector.stories.tsx +2 -0
  19. package/src/preact/dateRangeSelector/date-range-selector.tsx +11 -8
  20. package/src/preact/locationFilter/fetchAutocompletionList.ts +15 -1
  21. package/src/preact/locationFilter/location-filter.stories.tsx +1 -1
  22. package/src/preact/locationFilter/location-filter.tsx +16 -30
  23. package/src/preact/mutationComparison/mutation-comparison.stories.tsx +6 -3
  24. package/src/preact/mutationComparison/mutation-comparison.tsx +10 -13
  25. package/src/preact/mutationComparison/queryMutationData.ts +2 -3
  26. package/src/preact/mutationFilter/mutation-filter.stories.tsx +8 -8
  27. package/src/preact/mutationFilter/mutation-filter.tsx +7 -6
  28. package/src/preact/mutations/mutations.stories.tsx +6 -3
  29. package/src/preact/mutations/mutations.tsx +8 -6
  30. package/src/preact/prevalenceOverTime/prevalence-over-time.stories.tsx +14 -7
  31. package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +10 -8
  32. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.stories.tsx +6 -3
  33. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +9 -7
  34. package/src/preact/textInput/text-input.stories.tsx +26 -0
  35. package/src/preact/textInput/text-input.tsx +4 -5
  36. package/src/query/queryPrevalenceOverTime.ts +4 -10
  37. package/src/types.ts +4 -1
  38. package/src/web-components/ResizeContainer.mdx +13 -0
  39. package/src/web-components/app.ts +3 -1
  40. package/src/web-components/input/gs-date-range-selector.stories.ts +10 -2
  41. package/src/web-components/input/gs-date-range-selector.tsx +26 -16
  42. package/src/web-components/input/gs-location-filter.stories.ts +5 -7
  43. package/src/web-components/input/gs-location-filter.tsx +6 -7
  44. package/src/web-components/input/gs-mutation-filter.stories.ts +11 -8
  45. package/src/web-components/input/gs-mutation-filter.tsx +38 -26
  46. package/src/web-components/input/gs-text-input.stories.ts +3 -3
  47. package/src/web-components/input/gs-text-input.tsx +10 -10
  48. package/src/web-components/input/introduction.mdx +11 -0
  49. package/src/web-components/introduction.mdx +15 -0
  50. package/src/web-components/visualization/gs-aggregate.stories.ts +19 -6
  51. package/src/web-components/visualization/gs-aggregate.tsx +31 -15
  52. package/src/web-components/visualization/gs-mutation-comparison.stories.ts +13 -7
  53. package/src/web-components/visualization/gs-mutation-comparison.tsx +26 -17
  54. package/src/web-components/visualization/gs-mutations.stories.ts +14 -8
  55. package/src/web-components/visualization/gs-mutations.tsx +18 -8
  56. package/src/web-components/visualization/gs-prevalence-over-time.stories.ts +28 -18
  57. package/src/web-components/visualization/gs-prevalence-over-time.tsx +45 -22
  58. package/src/web-components/visualization/gs-relative-growth-advantage.stories.ts +11 -5
  59. package/src/web-components/visualization/gs-relative-growth-advantage.tsx +21 -9
@@ -0,0 +1,11 @@
1
+ import { Meta } from '@storybook/blocks';
2
+
3
+ <Meta title='Input/Introduction' />
4
+
5
+ # Introduction
6
+
7
+ The components in this section let the user specify values for LAPIS filters.
8
+ The filters can then be used as input to the visualization components.
9
+
10
+ Every component fires `CustomEvent`s when the user interacts with it, which can be used to update the LAPIS filters.
11
+ The `detail` of the event is designed such that it can be directly passed to the LAPIS API.
@@ -0,0 +1,15 @@
1
+ import { Meta } from '@storybook/blocks';
2
+
3
+ <Meta title='Introduction' />
4
+
5
+ # Introduction
6
+
7
+ This package provides a collection of web components to build interactive dashboards that visualize
8
+ data of a specific instance of [LAPIS](https://github.com/GenSpectrum/LAPIS).
9
+
10
+ We primarily provide two kinds of components:
11
+
12
+ - Visualization components (charts, tables, etc.).
13
+ Those components fetch data from the LAPIS instance and visualize it.
14
+ - Input components that let you specify sequence filters for the LAPIS requests.
15
+ Input changes will fire events that can be listened to by the visualization components. It is the responsibility of the dashbaord maintainer to listen to those events and to wire the data correctly into the visualization components.
@@ -9,7 +9,17 @@ import type { AggregateProps } from '../../preact/aggregatedData/aggregate';
9
9
  import './gs-aggregate';
10
10
  import '../app';
11
11
 
12
- const meta: Meta<AggregateProps> = {
12
+ const codeExample = `
13
+ <gs-aggregate
14
+ fields='["division", "host"]'
15
+ filter='{"country": "USA"}'
16
+ views='["table"]'
17
+ headline="Aggregate"
18
+ width='100%'
19
+ height='700px'
20
+ ></gs-aggregate>`;
21
+
22
+ const meta: Meta<Required<AggregateProps>> = {
13
23
  title: 'Visualization/Aggregate',
14
24
  component: 'gs-aggregate',
15
25
  argTypes: {
@@ -18,7 +28,8 @@ const meta: Meta<AggregateProps> = {
18
28
  options: ['table'],
19
29
  control: { type: 'check' },
20
30
  },
21
- size: [{ control: 'object' }],
31
+ width: { control: 'text' },
32
+ height: { control: 'text' },
22
33
  headline: { control: 'text' },
23
34
  },
24
35
  parameters: withComponentDocs({
@@ -43,7 +54,7 @@ const meta: Meta<AggregateProps> = {
43
54
  componentDocs: {
44
55
  opensShadowDom: true,
45
56
  expectsChildren: false,
46
- codeExample: `<gs-aggregate fields='["division", "host"]' filter='{"country": "USA"}' views='["table"]'></gs-aggregate>`,
57
+ codeExample,
47
58
  },
48
59
  }),
49
60
  tags: ['autodocs'],
@@ -51,14 +62,15 @@ const meta: Meta<AggregateProps> = {
51
62
 
52
63
  export default meta;
53
64
 
54
- export const Table: StoryObj<AggregateProps> = {
65
+ export const Table: StoryObj<Required<AggregateProps>> = {
55
66
  render: (args) => html`
56
67
  <gs-app lapis="${LAPIS_URL}">
57
68
  <gs-aggregate
58
69
  .fields=${args.fields}
59
70
  .filter=${args.filter}
60
71
  .views=${args.views}
61
- .size=${args.size}
72
+ .width=${args.width}
73
+ .height=${args.height}
62
74
  .headline=${args.headline}
63
75
  ></gs-aggregate>
64
76
  </gs-app>
@@ -69,7 +81,8 @@ export const Table: StoryObj<AggregateProps> = {
69
81
  filter: {
70
82
  country: 'USA',
71
83
  },
72
- size: { width: '100%', height: '700px' },
84
+ width: '100%',
85
+ height: '700px',
73
86
  headline: 'Aggregate',
74
87
  },
75
88
  };
@@ -7,50 +7,65 @@ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsS
7
7
  /**
8
8
  * ## Context
9
9
  *
10
- * This component displays aggregated data, which can provide an overview of the underlying data.
10
+ * This component displays aggregated data in a table, which can provide an overview of the underlying data.
11
11
  *
12
- * It expects a list of fields to aggregate by and a filter to apply to the data.
12
+ * It expects a list of `fields` to aggregate by and a `filter` to apply to the data.
13
+ *
14
+ * ## Views
15
+ *
16
+ * ### Table View
17
+ *
18
+ * In the table view, the data is presented in a table format where each field is a column,
19
+ * along with the aggregated value and its proportion.
20
+ * The proportion represents the ratio of the aggregated value to the total count of the data
21
+ * (considering the applied filter).
13
22
  */
14
23
  @customElement('gs-aggregate')
15
24
  export class AggregateComponent extends PreactLitAdapterWithGridJsStyles {
16
25
  /**
17
26
  * The fields to aggregate by.
27
+ * Every field will be a table column.
28
+ * Every field must exist in the backing LAPIS instance.
29
+ *
30
+ * If left empty, the component will only show the absolute count of the provided `filter` and proportion `100%`.
18
31
  */
19
32
  @property({ type: Array })
20
33
  fields: string[] = [];
21
34
 
22
35
  /**
23
- * The views are used to display the aggregated data.
24
- * In the table view, the data is presented in a table format where each field is a column,
25
- * along with the aggregated value and its proportion.
26
- * The proportion represents the ratio of the aggregated value to the total count of the data
27
- * (considering the applied filter).
36
+ * A list of tabs with views that this component should provide.
28
37
  */
29
38
  @property({ type: Array })
30
39
  views: View[] = ['table'];
31
40
 
32
41
  /**
33
42
  * The filter to apply to the data.
43
+ * It must be a valid LAPIS filter object.
34
44
  */
35
45
  @property({ type: Object })
36
46
  filter: LapisFilter = {};
37
47
 
38
48
  /**
39
- * The size of the component.
49
+ * The width of the component.
40
50
  *
41
- * If not set, the component will take the full width of its container with height 700px.
51
+ * Visit https://genspectrum.github.io/dashboards/?path=/docs/components-size-of-components--docs for more information.
52
+ */
53
+ @property({ type: String })
54
+ width: string = '100%';
55
+
56
+ /**
57
+ * The height of the component.
42
58
  *
43
- * The width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.
44
- * If the unit is %, the size will be relative to the container of the component.
59
+ * Visit https://genspectrum.github.io/dashboards/?path=/docs/components-size-of-components--docs for more information.
45
60
  */
46
- @property({ type: Object })
47
- size: { width?: string; height?: string } | undefined = undefined;
61
+ @property({ type: String })
62
+ height: string = '700px';
48
63
 
49
64
  /**
50
65
  * The headline of the component. Set to an empty string to hide the headline.
51
66
  */
52
67
  @property({ type: String })
53
- headline: string | undefined = 'Aggregate';
68
+ headline: string = 'Aggregate';
54
69
 
55
70
  override render() {
56
71
  return (
@@ -58,7 +73,8 @@ export class AggregateComponent extends PreactLitAdapterWithGridJsStyles {
58
73
  fields={this.fields}
59
74
  views={this.views}
60
75
  filter={this.filter}
61
- size={this.size}
76
+ width={this.width}
77
+ height={this.height}
62
78
  headline={this.headline}
63
79
  />
64
80
  );
@@ -16,9 +16,12 @@ const codeExample = String.raw`
16
16
  variants='[{ "displayName": "variant1", "lapisFilter": { "country": "Switzerland" }}, { "displayName": "variant2", "lapisFilter": { "country": "Germany" }}]'
17
17
  sequenceType="nucleotide"
18
18
  views='["table", "venn"]'
19
+ headline="Mutation comparison"
20
+ width='100%'
21
+ height='700px'
19
22
  ></gs-mutation-comparison>`;
20
23
 
21
- const meta: Meta<MutationComparisonProps> = {
24
+ const meta: Meta<Required<MutationComparisonProps>> = {
22
25
  title: 'Visualization/Mutation comparison',
23
26
  component: 'gs-mutation-comparison',
24
27
  argTypes: {
@@ -31,7 +34,8 @@ const meta: Meta<MutationComparisonProps> = {
31
34
  options: ['table', 'venn'],
32
35
  control: { type: 'check' },
33
36
  },
34
- size: { control: 'object' },
37
+ width: { control: 'text' },
38
+ height: { control: 'text' },
35
39
  headline: { control: 'text' },
36
40
  },
37
41
  parameters: withComponentDocs({
@@ -46,14 +50,15 @@ const meta: Meta<MutationComparisonProps> = {
46
50
 
47
51
  export default meta;
48
52
 
49
- const Template: StoryObj<MutationComparisonProps> = {
53
+ const Template: StoryObj<Required<MutationComparisonProps>> = {
50
54
  render: (args) => html`
51
55
  <gs-app lapis="${LAPIS_URL}">
52
56
  <gs-mutation-comparison
53
57
  .variants=${args.variants}
54
58
  .sequenceType=${args.sequenceType}
55
59
  .views=${args.views}
56
- .size=${args.size}
60
+ .width=${args.width}
61
+ .height=${args.height}
57
62
  .headline=${args.headline}
58
63
  ></gs-mutation-comparison>
59
64
  </gs-app>
@@ -63,7 +68,7 @@ const Template: StoryObj<MutationComparisonProps> = {
63
68
  const dateTo = '2022-01-01';
64
69
  const dateFrom = '2021-01-01';
65
70
 
66
- export const Default: StoryObj<MutationComparisonProps> = {
71
+ export const Default: StoryObj<Required<MutationComparisonProps>> = {
67
72
  ...Template,
68
73
  args: {
69
74
  variants: [
@@ -83,7 +88,8 @@ export const Default: StoryObj<MutationComparisonProps> = {
83
88
  ],
84
89
  sequenceType: 'nucleotide',
85
90
  views: ['table', 'venn'],
86
- size: { width: '100%', height: '700px' },
91
+ width: '100%',
92
+ height: '700px',
87
93
  headline: 'Mutation comparison',
88
94
  },
89
95
  parameters: {
@@ -138,7 +144,7 @@ export const Default: StoryObj<MutationComparisonProps> = {
138
144
  },
139
145
  };
140
146
 
141
- export const VennDiagram: StoryObj<MutationComparisonProps> = {
147
+ export const VennDiagram: StoryObj<Required<MutationComparisonProps>> = {
142
148
  ...Default,
143
149
  play: async ({ canvasElement, step }) => {
144
150
  const canvas = await withinShadowRoot(canvasElement, 'gs-mutation-comparison');
@@ -1,15 +1,12 @@
1
1
  import { customElement, property } from 'lit/decorators.js';
2
2
 
3
- import {
4
- MutationComparison,
5
- type MutationComparisonVariant,
6
- type View,
7
- } from '../../preact/mutationComparison/mutation-comparison';
8
- import { type SequenceType } from '../../types';
3
+ import { MutationComparison, type MutationComparisonProps } from '../../preact/mutationComparison/mutation-comparison';
9
4
  import { type Equals, type Expect } from '../../utils/typeAssertions';
10
5
  import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
11
6
 
12
7
  /**
8
+ * ## Context
9
+ *
13
10
  * This component allows to compare mutations between different variants.
14
11
  * A variant is defined by its LAPIS filter.
15
12
  *
@@ -35,6 +32,8 @@ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsS
35
32
  @customElement('gs-mutation-comparison')
36
33
  export class MutationComparisonComponent extends PreactLitAdapterWithGridJsStyles {
37
34
  /**
35
+ * Required.
36
+ *
38
37
  * An array of variants to compare.
39
38
  *
40
39
  * The `lapisFilter` will be sent as is to LAPIS to filter the mutation data.
@@ -62,21 +61,26 @@ export class MutationComparisonComponent extends PreactLitAdapterWithGridJsStyle
62
61
  views: ('table' | 'venn')[] = ['table'];
63
62
 
64
63
  /**
65
- * The size of the component.
64
+ * The width of the component.
66
65
  *
67
- * If not set, the component will take the full width of its container with height 700px.
66
+ * Visit https://genspectrum.github.io/dashboards/?path=/docs/components-size-of-components--docs for more information.
67
+ */
68
+ @property({ type: String })
69
+ width: string = '100%';
70
+
71
+ /**
72
+ * The height of the component.
68
73
  *
69
- * The width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.
70
- * If the unit is %, the size will be relative to the container of the component.
74
+ * Visit https://genspectrum.github.io/dashboards/?path=/docs/components-size-of-components--docs for more information.
71
75
  */
72
- @property({ type: Object })
73
- size: { width?: string; height?: string } | undefined = undefined;
76
+ @property({ type: String })
77
+ height: string = '700px';
74
78
 
75
79
  /**
76
80
  * The headline of the component. Set to an empty string to hide the headline.
77
81
  */
78
82
  @property({ type: String })
79
- headline: string | undefined = 'Mutation comparison';
83
+ headline: string = 'Mutation comparison';
80
84
 
81
85
  override render() {
82
86
  return (
@@ -84,7 +88,8 @@ export class MutationComparisonComponent extends PreactLitAdapterWithGridJsStyle
84
88
  variants={this.variants}
85
89
  sequenceType={this.sequenceType}
86
90
  views={this.views}
87
- size={this.size}
91
+ width={this.width}
92
+ height={this.height}
88
93
  headline={this.headline}
89
94
  />
90
95
  );
@@ -99,8 +104,12 @@ declare global {
99
104
 
100
105
  /* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
101
106
  type VariantsMatches = Expect<
102
- Equals<typeof MutationComparisonComponent.prototype.variants, MutationComparisonVariant[]>
107
+ Equals<typeof MutationComparisonComponent.prototype.variants, MutationComparisonProps['variants']>
108
+ >;
109
+ type SequenceTypeMatches = Expect<
110
+ Equals<typeof MutationComparisonComponent.prototype.sequenceType, MutationComparisonProps['sequenceType']>
111
+ >;
112
+ type ViewsMatches = Expect<
113
+ Equals<typeof MutationComparisonComponent.prototype.views, MutationComparisonProps['views']>
103
114
  >;
104
- type SequenceTypeMatches = Expect<Equals<typeof MutationComparisonComponent.prototype.sequenceType, SequenceType>>;
105
- type ViewsMatches = Expect<Equals<typeof MutationComparisonComponent.prototype.views, View[]>>;
106
115
  /* eslint-enable @typescript-eslint/no-unused-vars, no-unused-vars */
@@ -16,9 +16,12 @@ const codeExample = String.raw`
16
16
  variant='{ "country": "Switzerland", "pangoLineage": "B.1.1.7", "dateTo": "2022-01-01" }'
17
17
  sequenceType="nucleotide"
18
18
  views='["grid", "table", "insertions"]'
19
+ headline="Mutations"
20
+ width='100%'
21
+ height='700px'
19
22
  ></gs-mutations>`;
20
23
 
21
- const meta: Meta<MutationsProps> = {
24
+ const meta: Meta<Required<MutationsProps>> = {
22
25
  title: 'Visualization/Mutations',
23
26
  component: 'gs-mutations',
24
27
  argTypes: {
@@ -31,14 +34,16 @@ const meta: Meta<MutationsProps> = {
31
34
  options: ['table', 'grid', 'insertions'],
32
35
  control: { type: 'check' },
33
36
  },
34
- size: { control: 'object' },
37
+ width: { control: 'text' },
38
+ height: { control: 'text' },
35
39
  headline: { control: 'text' },
36
40
  },
37
41
  args: {
38
42
  variant: { country: 'Switzerland', pangoLineage: 'B.1.1.7', dateTo: '2022-01-01' },
39
43
  sequenceType: 'nucleotide',
40
44
  views: ['grid', 'table', 'insertions'],
41
- size: { width: '100%', height: '700px' },
45
+ width: '100%',
46
+ height: '700px',
42
47
  headline: 'Mutations',
43
48
  },
44
49
  parameters: withComponentDocs({
@@ -53,21 +58,22 @@ const meta: Meta<MutationsProps> = {
53
58
 
54
59
  export default meta;
55
60
 
56
- const Template: StoryObj<MutationsProps> = {
61
+ const Template: StoryObj<Required<MutationsProps>> = {
57
62
  render: (args) => html`
58
63
  <gs-app lapis="${LAPIS_URL}">
59
64
  <gs-mutations
60
65
  .variant=${args.variant}
61
66
  .sequenceType=${args.sequenceType}
62
67
  .views=${args.views}
63
- .size=${args.size}
68
+ .width=${args.width}
69
+ .height=${args.height}
64
70
  .headline=${args.headline}
65
71
  ></gs-mutations>
66
72
  </gs-app>
67
73
  `,
68
74
  };
69
75
 
70
- export const Default: StoryObj<MutationsProps> = {
76
+ export const Default: StoryObj<Required<MutationsProps>> = {
71
77
  ...Template,
72
78
  parameters: {
73
79
  fetchMock: {
@@ -104,7 +110,7 @@ export const Default: StoryObj<MutationsProps> = {
104
110
  },
105
111
  };
106
112
 
107
- export const OnTableTab: StoryObj<MutationsProps> = {
113
+ export const OnTableTab: StoryObj<Required<MutationsProps>> = {
108
114
  ...Default,
109
115
  play: async ({ canvasElement }) => {
110
116
  const canvas = await withinShadowRoot(canvasElement, 'gs-mutations');
@@ -115,7 +121,7 @@ export const OnTableTab: StoryObj<MutationsProps> = {
115
121
  },
116
122
  };
117
123
 
118
- export const OnInsertionsTab: StoryObj<MutationsProps> = {
124
+ export const OnInsertionsTab: StoryObj<Required<MutationsProps>> = {
119
125
  ...Default,
120
126
  play: async ({ canvasElement }) => {
121
127
  const canvas = await withinShadowRoot(canvasElement, 'gs-mutations');
@@ -6,6 +6,8 @@ import type { Equals, Expect } from '../../utils/typeAssertions';
6
6
  import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
7
7
 
8
8
  /**
9
+ * ## Context
10
+ *
9
11
  * This component displays mutations (substitutions, deletions and insertions) for a given variant.
10
12
  *
11
13
  * ## Views
@@ -33,6 +35,8 @@ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsS
33
35
  @customElement('gs-mutations')
34
36
  export class MutationsComponent extends PreactLitAdapterWithGridJsStyles {
35
37
  /**
38
+ * Required.
39
+ *
36
40
  * The `variant` will be sent as is to LAPIS to filter the mutation data.
37
41
  * It must be a valid LAPIS filter object.
38
42
  */
@@ -52,21 +56,26 @@ export class MutationsComponent extends PreactLitAdapterWithGridJsStyles {
52
56
  views: ('table' | 'grid' | 'insertions')[] = ['table', 'grid'];
53
57
 
54
58
  /**
55
- * The size of the component.
59
+ * The width of the component.
56
60
  *
57
- * If not set, the component will take the full width of its container with height 700px.
61
+ * Visit https://genspectrum.github.io/dashboards/?path=/docs/components-size-of-components--docs for more information.
62
+ */
63
+ @property({ type: String })
64
+ width: string = '100%';
65
+
66
+ /**
67
+ * The height of the component.
58
68
  *
59
- * The width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.
60
- * If the unit is %, the size will be relative to the container of the component.
69
+ * Visit https://genspectrum.github.io/dashboards/?path=/docs/components-size-of-components--docs for more information.
61
70
  */
62
- @property({ type: Object })
63
- size: { width?: string; height?: string } | undefined = undefined;
71
+ @property({ type: String })
72
+ height: string = '700px';
64
73
 
65
74
  /**
66
75
  * The headline of the component. Set to an empty string to hide the headline.
67
76
  */
68
77
  @property({ type: String })
69
- headline: string | undefined = 'Mutations';
78
+ headline: string = 'Mutations';
70
79
 
71
80
  override render() {
72
81
  return (
@@ -74,7 +83,8 @@ export class MutationsComponent extends PreactLitAdapterWithGridJsStyles {
74
83
  variant={this.variant}
75
84
  sequenceType={this.sequenceType}
76
85
  views={this.views}
77
- size={this.size}
86
+ width={this.width}
87
+ height={this.height}
78
88
  headline={this.headline}
79
89
  />
80
90
  );
@@ -16,15 +16,18 @@ import { withinShadowRoot } from '../withinShadowRoot.story';
16
16
 
17
17
  const codeExample = String.raw`
18
18
  <gs-prevalence-over-time
19
- numerator='[{ "displayName": "EG", "country": "USA", "pangoLineage": "EG*" }, { "displayName": "JN.1", "country": "USA", "pangoLineage": "JN.1*" }]'
20
- denominator='{ "country": "USA", "displayName": "All" }'
19
+ numerator='[{ "displayName": "EG", "lapisFilter": { "country": "USA", "pangoLineage": "EG*" }}, { "displayName": "JN.1", "lapisFilter": { "country": "USA", "pangoLineage": "JN.1*" }}]'
20
+ denominator='{ "country": "USA"}'
21
21
  granularity="month"
22
22
  smoothingWindow="0"
23
23
  views='["bar", "line", "bubble", "table"]'
24
24
  confidenceIntervalMethods='["wilson"]'
25
+ headline="Prevalence over time"
26
+ width='100%'
27
+ height='700px'
25
28
  ></gs-prevalence-over-time>`;
26
29
 
27
- const meta: Meta<PrevalenceOverTimeProps> = {
30
+ const meta: Meta<Required<PrevalenceOverTimeProps>> = {
28
31
  title: 'Visualization/Prevalence over time',
29
32
  component: 'gs-prevalence-over-time',
30
33
  argTypes: {
@@ -43,7 +46,8 @@ const meta: Meta<PrevalenceOverTimeProps> = {
43
46
  options: ['wilson'],
44
47
  control: { type: 'check' },
45
48
  },
46
- size: [{ control: 'object' }],
49
+ width: { control: 'text' },
50
+ height: { control: 'text' },
47
51
  headline: { control: 'text' },
48
52
  },
49
53
  parameters: withComponentDocs({
@@ -58,7 +62,7 @@ const meta: Meta<PrevalenceOverTimeProps> = {
58
62
 
59
63
  export default meta;
60
64
 
61
- const Template: StoryObj<PrevalenceOverTimeProps> = {
65
+ const Template: StoryObj<Required<PrevalenceOverTimeProps>> = {
62
66
  render: (args) => html`
63
67
  <gs-app lapis="${LAPIS_URL}">
64
68
  <gs-prevalence-over-time
@@ -68,26 +72,28 @@ const Template: StoryObj<PrevalenceOverTimeProps> = {
68
72
  .smoothingWindow=${args.smoothingWindow}
69
73
  .views=${args.views}
70
74
  .confidenceIntervalMethods=${args.confidenceIntervalMethods}
71
- .size=${args.size}
75
+ .width=${args.width}
76
+ .height=${args.height}
72
77
  .headline=${args.headline}
73
78
  ></gs-prevalence-over-time>
74
79
  </gs-app>
75
80
  `,
76
81
  };
77
82
 
78
- export const TwoVariants: StoryObj<PrevalenceOverTimeProps> = {
83
+ export const TwoVariants: StoryObj<Required<PrevalenceOverTimeProps>> = {
79
84
  ...Template,
80
85
  args: {
81
86
  numerator: [
82
- { displayName: 'EG', country: 'USA', pangoLineage: 'EG*', dateFrom: '2023-01-01' },
83
- { displayName: 'JN.1', country: 'USA', pangoLineage: 'JN.1*', dateFrom: '2023-01-01' },
87
+ { displayName: 'EG', lapisFilter: { country: 'USA', pangoLineage: 'EG*', dateFrom: '2023-01-01' } },
88
+ { displayName: 'JN.1', lapisFilter: { country: 'USA', pangoLineage: 'JN.1*', dateFrom: '2023-01-01' } },
84
89
  ],
85
- denominator: { country: 'USA', dateFrom: '2023-01-01', displayName: 'All' },
90
+ denominator: { country: 'USA', dateFrom: '2023-01-01' },
86
91
  granularity: 'month',
87
92
  smoothingWindow: 0,
88
93
  views: ['bar', 'line', 'bubble', 'table'],
89
94
  confidenceIntervalMethods: ['wilson'],
90
- size: { width: '100%', height: '700px' },
95
+ width: '100%',
96
+ height: '700px',
91
97
  headline: 'Prevalence over time',
92
98
  },
93
99
  parameters: {
@@ -145,16 +151,20 @@ export const TwoVariants: StoryObj<PrevalenceOverTimeProps> = {
145
151
  },
146
152
  };
147
153
 
148
- export const OneVariant: StoryObj<PrevalenceOverTimeProps> = {
154
+ export const OneVariant: StoryObj<Required<PrevalenceOverTimeProps>> = {
149
155
  ...Template,
150
156
  args: {
151
- numerator: { displayName: 'EG', country: 'USA', pangoLineage: 'BA.2.86*', dateFrom: '2023-10-01' },
152
- denominator: { country: 'USA', dateFrom: '2023-10-01', displayName: 'All' },
157
+ numerator: {
158
+ displayName: 'EG',
159
+ lapisFilter: { country: 'USA', pangoLineage: 'BA.2.86*', dateFrom: '2023-10-01' },
160
+ },
161
+ denominator: { country: 'USA', dateFrom: '2023-10-01' },
153
162
  granularity: 'day',
154
163
  smoothingWindow: 7,
155
164
  views: ['bar', 'line', 'bubble', 'table'],
156
165
  confidenceIntervalMethods: ['wilson'],
157
- size: { width: '100%', height: '700px' },
166
+ width: '100%',
167
+ height: '700px',
158
168
  headline: 'Prevalence over time',
159
169
  },
160
170
  parameters: {
@@ -196,7 +206,7 @@ export const OneVariant: StoryObj<PrevalenceOverTimeProps> = {
196
206
  },
197
207
  };
198
208
 
199
- export const OneVariantOnLineTab: StoryObj<PrevalenceOverTimeProps> = {
209
+ export const OneVariantOnLineTab: StoryObj<Required<PrevalenceOverTimeProps>> = {
200
210
  ...OneVariant,
201
211
  play: async ({ canvasElement }) => {
202
212
  const canvas = await withinShadowRoot(canvasElement, 'gs-prevalence-over-time');
@@ -207,7 +217,7 @@ export const OneVariantOnLineTab: StoryObj<PrevalenceOverTimeProps> = {
207
217
  },
208
218
  };
209
219
 
210
- export const OneVariantOnBubbleTab: StoryObj<PrevalenceOverTimeProps> = {
220
+ export const OneVariantOnBubbleTab: StoryObj<Required<PrevalenceOverTimeProps>> = {
211
221
  ...OneVariant,
212
222
  play: async ({ canvasElement }) => {
213
223
  const canvas = await withinShadowRoot(canvasElement, 'gs-prevalence-over-time');
@@ -218,7 +228,7 @@ export const OneVariantOnBubbleTab: StoryObj<PrevalenceOverTimeProps> = {
218
228
  },
219
229
  };
220
230
 
221
- export const OneVariantOnTableTab: StoryObj<PrevalenceOverTimeProps> = {
231
+ export const OneVariantOnTableTab: StoryObj<Required<PrevalenceOverTimeProps>> = {
222
232
  ...OneVariant,
223
233
  play: async ({ canvasElement }) => {
224
234
  const canvas = await withinShadowRoot(canvasElement, 'gs-prevalence-over-time');